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
test-disclosure.html · 8.5 KB · 182 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 Disclosure Test</title> |
| 7 | <script src="semantic-components.js"></script> |
| 8 | <style> |
| 9 | body { |
| 10 | background: #000; |
| 11 | color: #fff; |
| 12 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; |
| 13 | padding: 40px; |
| 14 | max-width: 1200px; |
| 15 | margin: 0 auto; |
| 16 | } |
| 17 | |
| 18 | h1 { |
| 19 | margin-bottom: 40px; |
| 20 | } |
| 21 | |
| 22 | .demo-section { |
| 23 | margin-bottom: 60px; |
| 24 | } |
| 25 | |
| 26 | .demo-section h2 { |
| 27 | font-size: 20px; |
| 28 | color: #8e8e93; |
| 29 | margin-bottom: 20px; |
| 30 | } |
| 31 | |
| 32 | semantic-disclosure { |
| 33 | display: block; |
| 34 | margin-bottom: 20px; |
| 35 | } |
| 36 | </style> |
| 37 | </head> |
| 38 | <body> |
| 39 | <h1>semantic-disclosure Component Test</h1> |
| 40 | |
| 41 | <div class="demo-section"> |
| 42 | <h2>Basic Disclosure (Multiple Mode)</h2> |
| 43 | <semantic-disclosure mode="multiple"> |
| 44 | <disclosure-item header="What is a disclosure component?"> |
| 45 | <p>A disclosure component (also known as accordion or collapsible) allows users to show and hide content sections. This helps organize information and reduce cognitive load by allowing users to focus on one section at a time.</p> |
| 46 | </disclosure-item> |
| 47 | |
| 48 | <disclosure-item header="How do I use it?"> |
| 49 | <p>Simply click on any header to expand or collapse that section. In multiple mode, you can have several sections open at once.</p> |
| 50 | <p>The component is fully keyboard accessible and follows WCAG AAA guidelines.</p> |
| 51 | </disclosure-item> |
| 52 | |
| 53 | <disclosure-item header="What are the key features?"> |
| 54 | <ul style="color: #ababab; line-height: 1.8;"> |
| 55 | <li>Smooth expand/collapse animations</li> |
| 56 | <li>Single or multiple open modes</li> |
| 57 | <li>Keyboard accessible</li> |
| 58 | <li>ARIA compliant for screen readers</li> |
| 59 | <li>44px minimum touch targets</li> |
| 60 | <li>Disabled state support</li> |
| 61 | </ul> |
| 62 | </disclosure-item> |
| 63 | |
| 64 | <disclosure-item header="Can sections be disabled?"> |
| 65 | <p>Yes! See the example below with disabled sections.</p> |
| 66 | </disclosure-item> |
| 67 | </semantic-disclosure> |
| 68 | </div> |
| 69 | |
| 70 | <div class="demo-section"> |
| 71 | <h2>Single Mode (Accordion)</h2> |
| 72 | <p style="color: #8e8e93; margin-bottom: 20px; font-size: 14px;">In single mode, only one section can be open at a time (classic accordion behavior).</p> |
| 73 | <semantic-disclosure mode="single"> |
| 74 | <disclosure-item header="📱 Mobile Development" open> |
| 75 | <p>Build native mobile applications for iOS and Android using modern frameworks like React Native, Flutter, or Swift/Kotlin.</p> |
| 76 | <p>Mobile-first design ensures your app works great on any device size.</p> |
| 77 | </disclosure-item> |
| 78 | |
| 79 | <disclosure-item header="💻 Web Development"> |
| 80 | <p>Create responsive web applications using HTML, CSS, and JavaScript. Modern frameworks like React, Vue, and Angular make building complex UIs easier.</p> |
| 81 | <p>Progressive Web Apps (PWAs) bridge the gap between web and native mobile apps.</p> |
| 82 | </disclosure-item> |
| 83 | |
| 84 | <disclosure-item header="🖥️ Desktop Applications"> |
| 85 | <p>Build cross-platform desktop apps using Electron, Tauri, or native frameworks. Desktop apps can offer more powerful features than web apps.</p> |
| 86 | </disclosure-item> |
| 87 | |
| 88 | <disclosure-item header="☁️ Cloud Services"> |
| 89 | <p>Deploy your applications to the cloud using services like AWS, Azure, or Google Cloud. Cloud deployment offers scalability, reliability, and global reach.</p> |
| 90 | </disclosure-item> |
| 91 | </semantic-disclosure> |
| 92 | </div> |
| 93 | |
| 94 | <div class="demo-section"> |
| 95 | <h2>With Disabled Items</h2> |
| 96 | <semantic-disclosure mode="multiple"> |
| 97 | <disclosure-item header="✅ Available Feature" open> |
| 98 | <p>This feature is available and ready to use. Click the header to collapse this section.</p> |
| 99 | </disclosure-item> |
| 100 | |
| 101 | <disclosure-item header="🔒 Premium Feature (Locked)" disabled> |
| 102 | <p>You shouldn't be able to see this content as this section is disabled.</p> |
| 103 | </disclosure-item> |
| 104 | |
| 105 | <disclosure-item header="✅ Another Available Feature"> |
| 106 | <p>This is another active section that you can expand and collapse freely.</p> |
| 107 | </disclosure-item> |
| 108 | |
| 109 | <disclosure-item header="🚧 Coming Soon" disabled> |
| 110 | <p>This content is under development.</p> |
| 111 | </disclosure-item> |
| 112 | |
| 113 | <disclosure-item header="✅ Documentation"> |
| 114 | <p>Full documentation is available for all active features. Check our docs site for detailed guides and API references.</p> |
| 115 | </disclosure-item> |
| 116 | </semantic-disclosure> |
| 117 | </div> |
| 118 | |
| 119 | <div class="demo-section"> |
| 120 | <h2>Event Handling</h2> |
| 121 | <semantic-disclosure id="event-disclosure" mode="single"> |
| 122 | <disclosure-item header="Section 1"> |
| 123 | <p>First section content. Try expanding different sections to see the event log update.</p> |
| 124 | </disclosure-item> |
| 125 | |
| 126 | <disclosure-item header="Section 2"> |
| 127 | <p>Second section content with some additional information.</p> |
| 128 | </disclosure-item> |
| 129 | |
| 130 | <disclosure-item header="Section 3"> |
| 131 | <p>Third section demonstrating event emission.</p> |
| 132 | </disclosure-item> |
| 133 | </semantic-disclosure> |
| 134 | <div id="event-log" style="margin-top: 20px; padding: 12px; background: #1c1c1e; border-radius: 8px; font-family: monospace; font-size: 13px;"> |
| 135 | <div style="color: #8e8e93; margin-bottom: 8px;">Event Log:</div> |
| 136 | <div id="log-output" style="color: #409cff;"></div> |
| 137 | </div> |
| 138 | </div> |
| 139 | |
| 140 | <div class="demo-section"> |
| 141 | <h2>FAQ Example</h2> |
| 142 | <semantic-disclosure mode="single"> |
| 143 | <disclosure-item header="How much does it cost?"> |
| 144 | <p><strong>Free tier:</strong> $0/month - Perfect for personal projects and getting started</p> |
| 145 | <p><strong>Pro tier:</strong> $29/month - Advanced features, priority support, and increased limits</p> |
| 146 | <p><strong>Enterprise:</strong> Custom pricing - White-label options, dedicated support, and custom integrations</p> |
| 147 | </disclosure-item> |
| 148 | |
| 149 | <disclosure-item header="What payment methods do you accept?"> |
| 150 | <p>We accept all major credit cards (Visa, Mastercard, American Express), PayPal, and wire transfers for enterprise accounts.</p> |
| 151 | <p>All payments are processed securely through Stripe.</p> |
| 152 | </disclosure-item> |
| 153 | |
| 154 | <disclosure-item header="Can I cancel anytime?"> |
| 155 | <p>Yes! You can cancel your subscription at any time with no penalties or fees. Your access will continue until the end of your current billing period.</p> |
| 156 | <p>We also offer a 30-day money-back guarantee for annual plans.</p> |
| 157 | </disclosure-item> |
| 158 | |
| 159 | <disclosure-item header="Do you offer refunds?"> |
| 160 | <p>We offer a full refund within 30 days of purchase if you're not satisfied with our service. After 30 days, refunds are issued on a case-by-case basis.</p> |
| 161 | </disclosure-item> |
| 162 | |
| 163 | <disclosure-item header="How do I get support?"> |
| 164 | <p>Free users can access our community forums and documentation. Pro users get email support with 24-hour response times. Enterprise users get dedicated support with 1-hour response SLAs and a dedicated account manager.</p> |
| 165 | </disclosure-item> |
| 166 | </semantic-disclosure> |
| 167 | </div> |
| 168 | |
| 169 | <script> |
| 170 | // Event handling demo |
| 171 | const eventDisclosure = document.getElementById('event-disclosure'); |
| 172 | const logOutput = document.getElementById('log-output'); |
| 173 | |
| 174 | eventDisclosure.addEventListener('disclosure-change', (e) => { |
| 175 | const time = new Date().toLocaleTimeString(); |
| 176 | const header = e.detail.item ? e.detail.item.getAttribute('header') : 'Unknown'; |
| 177 | const state = e.detail.open ? 'opened' : 'closed'; |
| 178 | logOutput.innerHTML = `[${time}] "${header}" was ${state} (index: ${e.detail.index})`; |
| 179 | }); |
| 180 | </script> |
| 181 | </body> |
| 182 | </html> |