askrobots / dbbasic-web-native
Public
100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.
danq9
Add canonical.html v1.0 - The single source of truth for usability standards
fb6e650
1 year ago
History
semantic-action.html · 10.5 KB · 188 lines
| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | <title>semantic-action - Semantic Components</title> |
| 7 | <script src="../semantic-components.js"></script> |
| 8 | <link rel="stylesheet" href="component-docs.css"> |
| 9 | </head> |
| 10 | <body> |
| 11 | <div class="container"> |
| 12 | <!-- Header --> |
| 13 | <div class="header"> |
| 14 | <h1 class="component-name"><semantic-action></h1> |
| 15 | <p class="tagline">Intent-based button component with multi-modal interaction support</p> |
| 16 | <div class="quick-example"> |
| 17 | <semantic-action intent="primary">Save Changes</semantic-action> |
| 18 | </div> |
| 19 | </div> |
| 20 | |
| 21 | <!-- Overview --> |
| 22 | <section class="section"> |
| 23 | <h2 class="section-title">Overview</h2> |
| 24 | <p class="section-description">The semantic-action component represents a user action with clear intent and consequence. Instead of styling a generic "button", you declare the importance (intent) and consequence (sentiment) of the action.</p> |
| 25 | </section> |
| 26 | |
| 27 | <!-- Examples --> |
| 28 | <section class="section"> |
| 29 | <h2 class="section-title">Examples</h2> |
| 30 | <div class="grid"> |
| 31 | |
| 32 | <div class="example"> |
| 33 | <div class="example-label">Primary Intent</div> |
| 34 | <div class="example-demo"> |
| 35 | <semantic-action intent="primary">Save Changes</semantic-action> |
| 36 | </div> |
| 37 | <div class="example-code"><semantic-action intent="primary">Save Changes</semantic-action></div> |
| 38 | <div class="example-notes">Use for: The main action on the page<br>Visual: Blue background (#0066cc), white text<br>Contrast: 5.9:1 (WCAG AA compliant)<br>Examples: Save, Submit, Continue, Confirm</div> |
| 39 | </div> |
| 40 | <div class="example"> |
| 41 | <div class="example-label">Constructive Sentiment</div> |
| 42 | <div class="example-demo"> |
| 43 | <semantic-action intent="primary" sentiment="constructive">Save Changes</semantic-action> |
| 44 | </div> |
| 45 | <div class="example-code"><semantic-action intent="primary" sentiment="constructive">Save Changes</semantic-action></div> |
| 46 | <div class="example-notes">Use for: Positive, safe actions<br>Visual: Green background (#34c759), white text<br>Contrast: 5.8:1 (WCAG AA compliant)<br>Examples: Save, Create, Publish, Enable</div> |
| 47 | </div> |
| 48 | <div class="example"> |
| 49 | <div class="example-label">Destructive Sentiment</div> |
| 50 | <div class="example-demo"> |
| 51 | <semantic-action intent="primary" sentiment="destructive">Delete Forever</semantic-action> |
| 52 | </div> |
| 53 | <div class="example-code"><semantic-action intent="primary" sentiment="destructive">Delete Forever</semantic-action></div> |
| 54 | <div class="example-notes">Use for: Dangerous, irreversible actions<br>Visual: Red background (#ff3b30), white text<br>Contrast: 4.5:1 (WCAG AA minimum)<br>Examples: Delete, Remove, Disable, Logout</div> |
| 55 | </div> |
| 56 | </div> |
| 57 | </section> |
| 58 | |
| 59 | <!-- Interactive States --> |
| 60 | <section class="section"> |
| 61 | <h2 class="section-title">Interactive States</h2> |
| 62 | <div class="state-showcase"> |
| 63 | |
| 64 | <div class="state-box"> |
| 65 | <div class="state-label">Default State</div> |
| 66 | <div class="state-visual state-default"> |
| 67 | <semantic-action intent="primary" >Default</semantic-action> |
| 68 | </div> |
| 69 | <div class="state-description">Blue background, white text, rounded corners, subtle shadow</div> |
| 70 | </div> |
| 71 | <div class="state-box"> |
| 72 | <div class="state-label">Hover State</div> |
| 73 | <div class="state-visual state-hover"> |
| 74 | <semantic-action intent="primary" >Hover</semantic-action> |
| 75 | </div> |
| 76 | <div class="state-description">Lifts up 2px, tight blue glow (8px blur, 0.6 opacity), brightness boost</div> |
| 77 | </div> |
| 78 | <div class="state-box"> |
| 79 | <div class="state-label">Active State</div> |
| 80 | <div class="state-visual state-active"> |
| 81 | <semantic-action intent="primary" >Active</semantic-action> |
| 82 | </div> |
| 83 | <div class="state-description">Scales 96% + pushes down 1px + inset shadow for "pressed in" feel</div> |
| 84 | </div> |
| 85 | <div class="state-box"> |
| 86 | <div class="state-label">Focus State</div> |
| 87 | <div class="state-visual state-focus"> |
| 88 | <semantic-action intent="primary" >Focus</semantic-action> |
| 89 | </div> |
| 90 | <div class="state-description">3px blue outline, 2px offset for keyboard navigation</div> |
| 91 | </div> |
| 92 | <div class="state-box"> |
| 93 | <div class="state-label">Disabled State</div> |
| 94 | <div class="state-visual state-disabled"> |
| 95 | <semantic-action intent="primary" disabled>Disabled</semantic-action> |
| 96 | </div> |
| 97 | <div class="state-description">Grey background (#3a3a3a), grey text (#8a8a8a), 60% opacity</div> |
| 98 | </div> |
| 99 | </div> |
| 100 | </section> |
| 101 | |
| 102 | <!-- Properties --> |
| 103 | <section class="section"> |
| 104 | <h2 class="section-title">Properties & Attributes</h2> |
| 105 | <table class="property-table"> |
| 106 | <thead> |
| 107 | <tr> |
| 108 | <th>Attribute</th> |
| 109 | <th>Type</th> |
| 110 | <th>Values</th> |
| 111 | <th>Default</th> |
| 112 | <th>Description</th> |
| 113 | </tr> |
| 114 | </thead> |
| 115 | <tbody> |
| 116 | |
| 117 | <tr style="border-bottom: 1px solid #333;"> |
| 118 | <td style="padding: 12px;"><span class="prop-name">intent</span></td> |
| 119 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 120 | <td style="padding: 12px;"><span class="prop-values">primary | secondary | tertiary</span></td> |
| 121 | <td style="padding: 12px;">primary</td> |
| 122 | <td style="padding: 12px;">Importance level in the interface hierarchy</td> |
| 123 | </tr> |
| 124 | <tr style="border-bottom: 1px solid #333;"> |
| 125 | <td style="padding: 12px;"><span class="prop-name">sentiment</span></td> |
| 126 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 127 | <td style="padding: 12px;"><span class="prop-values">constructive | destructive | neutral</span></td> |
| 128 | <td style="padding: 12px;">neutral</td> |
| 129 | <td style="padding: 12px;">Consequence of the action (safe, dangerous, or neutral)</td> |
| 130 | </tr> |
| 131 | <tr style="border-bottom: 1px solid #333;"> |
| 132 | <td style="padding: 12px;"><span class="prop-name">disabled</span></td> |
| 133 | <td style="padding: 12px;"><span class="prop-type">boolean</span></td> |
| 134 | <td style="padding: 12px;"><span class="prop-values">true | false</span></td> |
| 135 | <td style="padding: 12px;">false</td> |
| 136 | <td style="padding: 12px;">Whether the action is currently available</td> |
| 137 | </tr> |
| 138 | <tr style="border-bottom: 1px solid #333;"> |
| 139 | <td style="padding: 12px;"><span class="prop-name">urgency</span></td> |
| 140 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 141 | <td style="padding: 12px;"><span class="prop-values">critical | high | medium | low</span></td> |
| 142 | <td style="padding: 12px;">medium</td> |
| 143 | <td style="padding: 12px;">Priority for attention budget scoring</td> |
| 144 | </tr> |
| 145 | <tr style="border-bottom: 1px solid #333;"> |
| 146 | <td style="padding: 12px;"><span class="prop-name">attention-weight</span></td> |
| 147 | <td style="padding: 12px;"><span class="prop-type">number</span></td> |
| 148 | <td style="padding: 12px;"><span class="prop-values">0-100</span></td> |
| 149 | <td style="padding: 12px;">50</td> |
| 150 | <td style="padding: 12px;">Base attention priority (higher = more visible)</td> |
| 151 | </tr> |
| 152 | |
| 153 | </tbody> |
| 154 | </table> |
| 155 | </section> |
| 156 | |
| 157 | <!-- Events --> |
| 158 | <section class="section"> |
| 159 | <h2 class="section-title">Events</h2> |
| 160 | <table class="property-table"> |
| 161 | <thead> |
| 162 | <tr> |
| 163 | <th>Event</th> |
| 164 | <th>Trigger</th> |
| 165 | <th>Detail</th> |
| 166 | <th>Description</th> |
| 167 | </tr> |
| 168 | </thead> |
| 169 | <tbody> |
| 170 | |
| 171 | <tr style="border-bottom: 1px solid #333;"> |
| 172 | <td style="padding: 12px;"><span class="prop-name">activate</span></td> |
| 173 | <td style="padding: 12px;">Click, tap, Enter, Space, voice "activate"</td> |
| 174 | <td style="padding: 12px;"><code>{ type: "activate" }</code></td> |
| 175 | <td style="padding: 12px;">Main action event triggered by any input method</td> |
| 176 | </tr> |
| 177 | <tr style="border-bottom: 1px solid #333;"> |
| 178 | <td style="padding: 12px;"><span class="prop-name">inspect</span></td> |
| 179 | <td style="padding: 12px;">Long-press (500ms), voice "inspect"</td> |
| 180 | <td style="padding: 12px;"><code>{ type: "inspect" }</code></td> |
| 181 | <td style="padding: 12px;">Preview/detail view event for long-press interactions</td> |
| 182 | </tr> |
| 183 | </tbody> |
| 184 | </table> |
| 185 | </section> |
| 186 | </div> |
| 187 | </body> |
| 188 | </html> |