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-modal.html · 8.4 KB · 174 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-modal - 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-modal></h1> |
| 15 | <p class="tagline">Context-aware modal dialogs with urgency levels and backdrop dismissal</p> |
| 16 | <div class="quick-example"> |
| 17 | <semantic-modal open> |
| 18 | <div slot="header">Confirm Action</div> |
| 19 | <div>Are you sure you want to continue?</div> |
| 20 | <div slot="actions"> |
| 21 | <semantic-action intent="primary">Confirm</semantic-action> |
| 22 | <semantic-action intent="secondary">Cancel</semantic-action> |
| 23 | </div> |
| 24 | </semantic-modal> |
| 25 | </div> |
| 26 | </div> |
| 27 | |
| 28 | <!-- Overview --> |
| 29 | <section class="section"> |
| 30 | <h2 class="section-title">Overview</h2> |
| 31 | <p class="section-description">The semantic-modal component displays overlay dialogs with attention budget awareness. Modals automatically adjust their urgency presentation and can be dismissed by clicking the backdrop or pressing Escape.</p> |
| 32 | </section> |
| 33 | |
| 34 | <!-- Examples --> |
| 35 | <section class="section"> |
| 36 | <h2 class="section-title">Examples</h2> |
| 37 | <div class="grid"> |
| 38 | |
| 39 | <div class="example"> |
| 40 | <div class="example-label">Basic Modal</div> |
| 41 | <div class="example-demo"> |
| 42 | <semantic-modal open> |
| 43 | <div slot="header">Confirm Action</div> |
| 44 | <div>Are you sure you want to continue?</div> |
| 45 | <div slot="actions"> |
| 46 | <semantic-action intent="primary">Confirm</semantic-action> |
| 47 | <semantic-action intent="secondary">Cancel</semantic-action> |
| 48 | </div> |
| 49 | </semantic-modal> |
| 50 | </div> |
| 51 | <div class="example-code"><semantic-modal open> |
| 52 | <div slot="header">Confirm Action</div> |
| 53 | <div>Are you sure you want to continue?</div> |
| 54 | <div slot="actions"> |
| 55 | <semantic-action intent="primary">Confirm</semantic-action> |
| 56 | <semantic-action intent="secondary">Cancel</semantic-action> |
| 57 | </div> |
| 58 | </semantic-modal></div> |
| 59 | <div class="example-notes">Use for: Confirmation dialogs, forms, alerts<br>Visual: Dark background, centered, backdrop blur<br>Interaction: Click backdrop or press Escape to dismiss</div> |
| 60 | </div> |
| 61 | </div> |
| 62 | </section> |
| 63 | |
| 64 | <!-- Interactive States --> |
| 65 | <section class="section"> |
| 66 | <h2 class="section-title">Interactive States</h2> |
| 67 | <div class="state-showcase"> |
| 68 | |
| 69 | <div class="state-box"> |
| 70 | <div class="state-label">Closed State</div> |
| 71 | <div class="state-visual state-closed"> |
| 72 | <semantic-modal intent="primary" >Closed</semantic-modal> |
| 73 | </div> |
| 74 | <div class="state-description">Hidden (display: none)</div> |
| 75 | </div> |
| 76 | <div class="state-box"> |
| 77 | <div class="state-label">Open State</div> |
| 78 | <div class="state-visual state-open"> |
| 79 | <semantic-modal intent="primary" >Open</semantic-modal> |
| 80 | </div> |
| 81 | <div class="state-description">Visible with backdrop fade-in and modal slide-up animation</div> |
| 82 | </div> |
| 83 | <div class="state-box"> |
| 84 | <div class="state-label">Critical State</div> |
| 85 | <div class="state-visual state-critical"> |
| 86 | <semantic-modal intent="primary" >Critical</semantic-modal> |
| 87 | </div> |
| 88 | <div class="state-description">Red border (#ff3b30) for urgent modals</div> |
| 89 | </div> |
| 90 | </div> |
| 91 | </section> |
| 92 | |
| 93 | <!-- Properties --> |
| 94 | <section class="section"> |
| 95 | <h2 class="section-title">Properties & Attributes</h2> |
| 96 | <table class="property-table"> |
| 97 | <thead> |
| 98 | <tr> |
| 99 | <th>Attribute</th> |
| 100 | <th>Type</th> |
| 101 | <th>Values</th> |
| 102 | <th>Default</th> |
| 103 | <th>Description</th> |
| 104 | </tr> |
| 105 | </thead> |
| 106 | <tbody> |
| 107 | |
| 108 | <tr style="border-bottom: 1px solid #333;"> |
| 109 | <td style="padding: 12px;"><span class="prop-name">open</span></td> |
| 110 | <td style="padding: 12px;"><span class="prop-type">boolean</span></td> |
| 111 | <td style="padding: 12px;"><span class="prop-values">true | false</span></td> |
| 112 | <td style="padding: 12px;">false</td> |
| 113 | <td style="padding: 12px;">Whether the modal is currently visible</td> |
| 114 | </tr> |
| 115 | <tr style="border-bottom: 1px solid #333;"> |
| 116 | <td style="padding: 12px;"><span class="prop-name">urgency</span></td> |
| 117 | <td style="padding: 12px;"><span class="prop-type">string</span></td> |
| 118 | <td style="padding: 12px;"><span class="prop-values">critical | high | medium | low</span></td> |
| 119 | <td style="padding: 12px;">medium</td> |
| 120 | <td style="padding: 12px;">Visual urgency level (critical shows red border)</td> |
| 121 | </tr> |
| 122 | <tr style="border-bottom: 1px solid #333;"> |
| 123 | <td style="padding: 12px;"><span class="prop-name">dismissible</span></td> |
| 124 | <td style="padding: 12px;"><span class="prop-type">boolean</span></td> |
| 125 | <td style="padding: 12px;"><span class="prop-values">true | false</span></td> |
| 126 | <td style="padding: 12px;">true</td> |
| 127 | <td style="padding: 12px;">Whether modal can be dismissed by backdrop click/Escape</td> |
| 128 | </tr> |
| 129 | |
| 130 | <tr style="border-bottom: 1px solid #333;"> |
| 131 | <td style="padding: 12px;"><span class="prop-name">header</span></td> |
| 132 | <td style="padding: 12px;"><span class="prop-type">slot</span></td> |
| 133 | <td style="padding: 12px;">Modal title/header content</td> |
| 134 | </tr> |
| 135 | <tr style="border-bottom: 1px solid #333;"> |
| 136 | <td style="padding: 12px;"><span class="prop-name">default</span></td> |
| 137 | <td style="padding: 12px;"><span class="prop-type">slot</span></td> |
| 138 | <td style="padding: 12px;">Main modal body content</td> |
| 139 | </tr> |
| 140 | <tr style="border-bottom: 1px solid #333;"> |
| 141 | <td style="padding: 12px;"><span class="prop-name">actions</span></td> |
| 142 | <td style="padding: 12px;"><span class="prop-type">slot</span></td> |
| 143 | <td style="padding: 12px;">Modal footer with action buttons</td> |
| 144 | </tr> |
| 145 | </tbody> |
| 146 | </table> |
| 147 | </section> |
| 148 | |
| 149 | <!-- Events --> |
| 150 | <section class="section"> |
| 151 | <h2 class="section-title">Events</h2> |
| 152 | <table class="property-table"> |
| 153 | <thead> |
| 154 | <tr> |
| 155 | <th>Event</th> |
| 156 | <th>Trigger</th> |
| 157 | <th>Detail</th> |
| 158 | <th>Description</th> |
| 159 | </tr> |
| 160 | </thead> |
| 161 | <tbody> |
| 162 | |
| 163 | <tr style="border-bottom: 1px solid #333;"> |
| 164 | <td style="padding: 12px;"><span class="prop-name">close</span></td> |
| 165 | <td style="padding: 12px;">Backdrop click, Escape key, close button</td> |
| 166 | <td style="padding: 12px;"><code>{ type: "close" }</code></td> |
| 167 | <td style="padding: 12px;">Modal closed event</td> |
| 168 | </tr> |
| 169 | </tbody> |
| 170 | </table> |
| 171 | </section> |
| 172 | </div> |
| 173 | </body> |
| 174 | </html> |