100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.

0 downloads

dbbasic-web-native/test-popover.html
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-web-native.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-web-native.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-web-native.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add canonical.html v1.0 - The single source of truth for usability standards fb6e650 1 year ago History
test-popover.html · 12.0 KB · 281 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 Popover 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: 80px;
24 }
25
26 .demo-section h2 {
27 font-size: 20px;
28 color: #8e8e93;
29 margin-bottom: 30px;
30 }
31
32 .demo-grid {
33 display: grid;
34 grid-template-columns: repeat(2, 1fr);
35 gap: 60px;
36 margin-bottom: 40px;
37 }
38
39 .demo-box {
40 background: #1c1c1e;
41 padding: 60px;
42 border-radius: 12px;
43 display: flex;
44 align-items: center;
45 justify-content: center;
46 min-height: 150px;
47 }
48
49 .demo-label {
50 color: #8e8e93;
51 font-size: 14px;
52 margin-bottom: 12px;
53 }
54
55 .tooltip-text {
56 text-decoration: underline;
57 text-decoration-style: dotted;
58 text-decoration-color: #409cff;
59 cursor: help;
60 }
61 </style>
62</head>
63<body>
64 <h1>semantic-popover Component Test</h1>
65
66 <div class="demo-section">
67 <h2>Positions (Hover to Show)</h2>
68
69 <div class="demo-grid">
70 <div class="demo-box">
71 <semantic-popover position="top" content="This popover appears above the trigger element with a smooth animation." trigger="hover">
72 <span slot="trigger" class="tooltip-text">Hover for Top Popover</span>
73 </semantic-popover>
74 </div>
75
76 <div class="demo-box">
77 <semantic-popover position="right" content="This popover appears to the right of the trigger element." trigger="hover">
78 <span slot="trigger" class="tooltip-text">Hover for Right Popover</span>
79 </semantic-popover>
80 </div>
81
82 <div class="demo-box">
83 <semantic-popover position="bottom" content="This popover appears below the trigger element." trigger="hover">
84 <span slot="trigger" class="tooltip-text">Hover for Bottom Popover</span>
85 </semantic-popover>
86 </div>
87
88 <div class="demo-box">
89 <semantic-popover position="left" content="This popover appears to the left of the trigger element." trigger="hover">
90 <span slot="trigger" class="tooltip-text">Hover for Left Popover</span>
91 </semantic-popover>
92 </div>
93 </div>
94 </div>
95
96 <div class="demo-section">
97 <h2>With Titles</h2>
98
99 <div class="demo-grid">
100 <div class="demo-box">
101 <semantic-popover
102 position="top"
103 title="Help Information"
104 content="This popover has both a title and body text. The title is bold and stands out."
105 trigger="hover">
106 <span slot="trigger" class="tooltip-text">Popover with Title</span>
107 </semantic-popover>
108 </div>
109
110 <div class="demo-box">
111 <semantic-popover
112 position="bottom"
113 title="Quick Tip"
114 content="You can use popovers to provide contextual help without cluttering your UI."
115 trigger="hover">
116 <span slot="trigger" class="tooltip-text">Helpful Tip</span>
117 </semantic-popover>
118 </div>
119 </div>
120 </div>
121
122 <div class="demo-section">
123 <h2>Trigger Methods</h2>
124
125 <div style="display: flex; gap: 40px; flex-wrap: wrap; margin-bottom: 30px;">
126 <div>
127 <div class="demo-label">Hover Trigger (Default)</div>
128 <semantic-popover position="top" content="Shows on hover, hides when mouse leaves" trigger="hover">
129 <semantic-action slot="trigger" intent="secondary">Hover Me</semantic-action>
130 </semantic-popover>
131 </div>
132
133 <div>
134 <div class="demo-label">Click Trigger</div>
135 <semantic-popover position="top" content="Click to toggle. Click outside to close." trigger="click">
136 <semantic-action slot="trigger" intent="primary">Click Me</semantic-action>
137 </semantic-popover>
138 </div>
139
140 <div>
141 <div class="demo-label">Focus Trigger</div>
142 <semantic-popover position="top" content="Shows when focused, hides on blur" trigger="focus">
143 <semantic-action slot="trigger" intent="secondary">Tab to Focus</semantic-action>
144 </semantic-popover>
145 </div>
146 </div>
147 </div>
148
149 <div class="demo-section">
150 <h2>Real-World Examples</h2>
151
152 <div style="background: #1c1c1e; padding: 30px; border-radius: 12px; margin-bottom: 30px;">
153 <h3 style="margin-top: 0; font-size: 16px; margin-bottom: 20px;">Inline Help Text</h3>
154 <p style="color: #ababab; line-height: 1.8; margin: 0;">
155 Our platform uses
156 <semantic-popover
157 position="top"
158 title="End-to-End Encryption"
159 content="All data is encrypted both in transit and at rest using AES-256 encryption."
160 trigger="hover">
161 <span slot="trigger" class="tooltip-text">end-to-end encryption</span>
162 </semantic-popover>
163 to protect your sensitive information. We also implement
164 <semantic-popover
165 position="top"
166 title="Two-Factor Authentication"
167 content="2FA adds an extra layer of security by requiring a second form of verification."
168 trigger="hover">
169 <span slot="trigger" class="tooltip-text">two-factor authentication</span>
170 </semantic-popover>
171 for all user accounts.
172 </p>
173 </div>
174
175 <div style="background: #1c1c1e; padding: 30px; border-radius: 12px; margin-bottom: 30px;">
176 <h3 style="margin-top: 0; font-size: 16px; margin-bottom: 20px;">User Profile</h3>
177 <div style="display: flex; align-items: center; gap: 12px;">
178 <div style="width: 48px; height: 48px; background: linear-gradient(135deg, #409cff, #30d158); border-radius: 24px;"></div>
179 <div>
180 <div style="font-weight: 600; margin-bottom: 4px;">
181 <semantic-popover
182 position="right"
183 title="John Doe"
184 content="Senior Developer • Joined 2 years ago • 1,234 contributions"
185 trigger="hover">
186 <span slot="trigger" class="tooltip-text">John Doe</span>
187 </semantic-popover>
188 </div>
189 <div style="color: #8e8e93; font-size: 14px;">@johndoe</div>
190 </div>
191 </div>
192 </div>
193
194 <div style="background: #1c1c1e; padding: 30px; border-radius: 12px; margin-bottom: 30px;">
195 <h3 style="margin-top: 0; font-size: 16px; margin-bottom: 20px;">Action Buttons with Tooltips</h3>
196 <div style="display: flex; gap: 12px;">
197 <semantic-popover position="top" content="Save your changes" trigger="hover">
198 <semantic-action slot="trigger" intent="primary">💾 Save</semantic-action>
199 </semantic-popover>
200
201 <semantic-popover position="top" content="Export to CSV format" trigger="hover">
202 <semantic-action slot="trigger" intent="secondary">📄 Export</semantic-action>
203 </semantic-popover>
204
205 <semantic-popover position="top" content="Share with team members" trigger="hover">
206 <semantic-action slot="trigger" intent="secondary">🔗 Share</semantic-action>
207 </semantic-popover>
208
209 <semantic-popover
210 position="top"
211 title="Delete Item"
212 content="This action cannot be undone. Are you sure?"
213 trigger="click">
214 <semantic-action slot="trigger" intent="secondary">🗑️ Delete</semantic-action>
215 </semantic-popover>
216 </div>
217 </div>
218
219 <div style="background: #1c1c1e; padding: 30px; border-radius: 12px;">
220 <h3 style="margin-top: 0; font-size: 16px; margin-bottom: 20px;">Form Field Help</h3>
221 <div style="display: flex; flex-direction: column; gap: 16px;">
222 <div>
223 <label style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: #fff;">
224 <span>API Key</span>
225 <semantic-popover
226 position="right"
227 title="API Key"
228 content="Your unique API key for authenticating requests. Keep this secret!"
229 trigger="hover">
230 <span slot="trigger" style="color: #409cff; cursor: help; font-size: 16px;">ℹ️</span>
231 </semantic-popover>
232 </label>
233 <semantic-input type="text" placeholder="Enter your API key"></semantic-input>
234 </div>
235
236 <div>
237 <label style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: #fff;">
238 <span>Webhook URL</span>
239 <semantic-popover
240 position="right"
241 title="Webhook URL"
242 content="The endpoint where we'll send event notifications. Must be HTTPS."
243 trigger="hover">
244 <span slot="trigger" style="color: #409cff; cursor: help; font-size: 16px;">ℹ️</span>
245 </semantic-popover>
246 </label>
247 <semantic-input type="text" placeholder="https://example.com/webhook"></semantic-input>
248 </div>
249 </div>
250 </div>
251 </div>
252
253 <div class="demo-section">
254 <h2>Stress Test</h2>
255 <p style="color: #8e8e93; margin-bottom: 20px;">Multiple popovers can coexist without conflict:</p>
256 <div style="background: #1c1c1e; padding: 30px; border-radius: 12px;">
257 <p style="color: #ababab; line-height: 2; margin: 0;">
258 <semantic-popover position="top" content="Tooltip 1" trigger="hover">
259 <span slot="trigger" class="tooltip-text">First</span>
260 </semantic-popover>
261 •
262 <semantic-popover position="bottom" content="Tooltip 2" trigger="hover">
263 <span slot="trigger" class="tooltip-text">Second</span>
264 </semantic-popover>
265 •
266 <semantic-popover position="top" content="Tooltip 3" trigger="hover">
267 <span slot="trigger" class="tooltip-text">Third</span>
268 </semantic-popover>
269 •
270 <semantic-popover position="bottom" content="Tooltip 4" trigger="hover">
271 <span slot="trigger" class="tooltip-text">Fourth</span>
272 </semantic-popover>
273 •
274 <semantic-popover position="top" content="Tooltip 5" trigger="hover">
275 <span slot="trigger" class="tooltip-text">Fifth</span>
276 </semantic-popover>
277 </p>
278 </div>
279 </div>
280</body>
281</html>