-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinteractive.html
More file actions
430 lines (400 loc) · 20.5 KB
/
interactive.html
File metadata and controls
430 lines (400 loc) · 20.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Components - ATXP Design System</title>
<link rel="stylesheet" href="../../dist/styles.css">
<style>
body {
margin: 0;
padding: 2rem;
font-family: Inter, system-ui, sans-serif;
background-color: var(--theme-background);
color: var(--theme-foreground);
}
.demo-section {
margin-bottom: 3rem;
}
.demo-section h2 {
margin-bottom: 1rem;
font-size: 1.5rem;
font-weight: 600;
}
.demo-section p {
color: var(--theme-muted-foreground);
margin-bottom: 1.5rem;
}
/* Tabs Styles */
.tabs-content {
display: none;
}
.tabs-content.active {
display: block;
}
/* Accordion Styles */
.accordion-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out;
}
.accordion-content.open {
max-height: 500px;
}
.accordion-trigger svg {
transition: transform 0.2s;
}
.accordion-trigger.open svg {
transform: rotate(180deg);
}
</style>
</head>
<body>
<h1 style="margin-bottom: 2rem; font-size: 2rem; font-weight: bold;">Interactive Components</h1>
<!-- Tabs -->
<section class="demo-section">
<h2>Tabs</h2>
<p>Organize content into separate views where only one view is visible at a time.</p>
<div class="rounded-lg border border-border bg-card p-6" style="max-width: 600px;">
<!-- Tabs List -->
<div class="inline-flex h-auto items-center justify-start gap-0 text-muted-foreground" role="tablist" data-tabs="demo-tabs">
<button
role="tab"
aria-selected="true"
aria-controls="tab-account"
data-tab-trigger="account"
class="inline-flex items-center justify-center whitespace-nowrap rounded-xs px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 bg-background text-foreground shadow-sm font-semibold"
>
Account
</button>
<button
role="tab"
aria-selected="false"
aria-controls="tab-password"
data-tab-trigger="password"
class="inline-flex items-center justify-center whitespace-nowrap rounded-xs px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 text-muted-foreground"
>
Password
</button>
<button
role="tab"
aria-selected="false"
aria-controls="tab-notifications"
data-tab-trigger="notifications"
class="inline-flex items-center justify-center whitespace-nowrap rounded-xs px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 text-muted-foreground"
>
Notifications
</button>
</div>
<!-- Tabs Content -->
<div class="tabs-content active" id="tab-account" role="tabpanel" style="margin-top: 1rem;">
<h3 style="font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem;">Account Settings</h3>
<p style="color: var(--theme-muted-foreground); margin-bottom: 1rem;">
Make changes to your account here. Click save when you're done.
</p>
<div style="display: flex; flex-direction: column; gap: 1rem;">
<div>
<label style="display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem;">Name</label>
<input type="text" value="John Doe" class="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2" />
</div>
<div>
<label style="display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem;">Email</label>
<input type="email" value="john@example.com" class="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2" />
</div>
<button class="inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-lg text-sm font-medium leading-5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 bg-primary text-primary-foreground hover:bg-primary/90 h-9 px-4 py-2">
Save Changes
</button>
</div>
</div>
<div class="tabs-content" id="tab-password" role="tabpanel" style="margin-top: 1rem;">
<h3 style="font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem;">Change Password</h3>
<p style="color: var(--theme-muted-foreground); margin-bottom: 1rem;">
Update your password here. After saving, you'll be logged out.
</p>
<div style="display: flex; flex-direction: column; gap: 1rem;">
<div>
<label style="display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem;">Current Password</label>
<input type="password" class="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2" />
</div>
<div>
<label style="display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem;">New Password</label>
<input type="password" class="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2" />
</div>
<button class="inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-lg text-sm font-medium leading-5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 bg-primary text-primary-foreground hover:bg-primary/90 h-9 px-4 py-2">
Update Password
</button>
</div>
</div>
<div class="tabs-content" id="tab-notifications" role="tabpanel" style="margin-top: 1rem;">
<h3 style="font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem;">Notification Settings</h3>
<p style="color: var(--theme-muted-foreground); margin-bottom: 1rem;">
Configure how you receive notifications.
</p>
<div style="display: flex; flex-direction: column; gap: 1rem;">
<div style="display: flex; justify-content: space-between; align-items: center;">
<div>
<div style="font-weight: 500;">Email Notifications</div>
<div style="font-size: 0.875rem; color: var(--theme-muted-foreground);">Receive email updates</div>
</div>
<input type="checkbox" checked />
</div>
<div style="display: flex; justify-content: space-between; align-items: center;">
<div>
<div style="font-weight: 500;">Push Notifications</div>
<div style="font-size: 0.875rem; color: var(--theme-muted-foreground);">Receive push notifications</div>
</div>
<input type="checkbox" />
</div>
<button class="inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-lg text-sm font-medium leading-5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 bg-primary text-primary-foreground hover:bg-primary/90 h-9 px-4 py-2">
Save Preferences
</button>
</div>
</div>
</div>
</section>
<!-- Accordion -->
<section class="demo-section">
<h2>Accordion</h2>
<p>Collapsible content sections for organizing information.</p>
<div style="max-width: 600px;">
<!-- Accordion Item 1 -->
<div class="border-b border-border">
<div class="flex">
<button
class="accordion-trigger flex flex-1 items-center justify-between py-4 text-base font-medium transition-all hover:underline"
data-accordion-trigger="item-1"
>
<span>What is the ATXP Design System?</span>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="shrink-0 text-foreground">
<polyline points="6 9 12 15 18 9"/>
</svg>
</button>
</div>
<div class="accordion-content text-sm" data-accordion-content="item-1">
<div class="pb-4 pt-0">
The ATXP Design System is a comprehensive collection of reusable components, design tokens, and guidelines that help teams build consistent and accessible user interfaces quickly.
</div>
</div>
</div>
<!-- Accordion Item 2 -->
<div class="border-b border-border">
<div class="flex">
<button
class="accordion-trigger flex flex-1 items-center justify-between py-4 text-base font-medium transition-all hover:underline"
data-accordion-trigger="item-2"
>
<span>How do I install the design system?</span>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="shrink-0 text-foreground">
<polyline points="6 9 12 15 18 9"/>
</svg>
</button>
</div>
<div class="accordion-content text-sm" data-accordion-content="item-2">
<div class="pb-4 pt-0">
You can install the design system using npm or yarn:<br><br>
<code style="background-color: var(--theme-muted); padding: 0.25rem 0.5rem; border-radius: 0.25rem;">npm install @atxp/design-system</code><br><br>
Then import the CSS in your application.
</div>
</div>
</div>
<!-- Accordion Item 3 -->
<div class="border-b border-border">
<div class="flex">
<button
class="accordion-trigger flex flex-1 items-center justify-between py-4 text-base font-medium transition-all hover:underline"
data-accordion-trigger="item-3"
>
<span>Can I customize the theme?</span>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="shrink-0 text-foreground">
<polyline points="6 9 12 15 18 9"/>
</svg>
</button>
</div>
<div class="accordion-content text-sm" data-accordion-content="item-3">
<div class="pb-4 pt-0">
Yes! The design system supports multiple themes (light, dark, ATXP, DBG) and you can easily create custom themes by defining CSS variables. All theme tokens use CSS custom properties for maximum flexibility.
</div>
</div>
</div>
<!-- Accordion Item 4 -->
<div class="border-b border-border">
<div class="flex">
<button
class="accordion-trigger flex flex-1 items-center justify-between py-4 text-base font-medium transition-all hover:underline"
data-accordion-trigger="item-4"
>
<span>Is it accessible?</span>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="shrink-0 text-foreground">
<polyline points="6 9 12 15 18 9"/>
</svg>
</button>
</div>
<div class="accordion-content text-sm" data-accordion-content="item-4">
<div class="pb-4 pt-0">
Absolutely! All components are built with accessibility in mind, following WAI-ARIA guidelines. Components include proper ARIA labels, keyboard navigation, focus management, and screen reader support.
</div>
</div>
</div>
</div>
</section>
<!-- Progress -->
<section class="demo-section">
<h2>Progress</h2>
<p>Visual indicator showing task completion.</p>
<div style="display: flex; flex-direction: column; gap: 2rem; max-width: 500px;">
<div>
<div style="display: flex; justify-content: space-between; margin-bottom: 0.5rem;">
<span style="font-size: 0.875rem; font-weight: 500;">Uploading...</span>
<span style="font-size: 0.875rem; color: var(--theme-muted-foreground);">25%</span>
</div>
<div class="relative h-4 w-full overflow-hidden rounded-full bg-secondary" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="25">
<div class="h-full bg-primary transition-all duration-300 ease-in-out" style="width: 25%"></div>
</div>
</div>
<div>
<div style="display: flex; justify-content: space-between; margin-bottom: 0.5rem;">
<span style="font-size: 0.875rem; font-weight: 500;">Processing...</span>
<span style="font-size: 0.875rem; color: var(--theme-muted-foreground);">60%</span>
</div>
<div class="relative h-4 w-full overflow-hidden rounded-full bg-secondary" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="60">
<div class="h-full bg-primary transition-all duration-300 ease-in-out" style="width: 60%"></div>
</div>
</div>
<div>
<div style="display: flex; justify-content: space-between; margin-bottom: 0.5rem;">
<span style="font-size: 0.875rem; font-weight: 500;">Complete!</span>
<span style="font-size: 0.875rem; color: var(--theme-success);">100%</span>
</div>
<div class="relative h-4 w-full overflow-hidden rounded-full bg-secondary" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="100">
<div class="h-full bg-primary transition-all duration-300 ease-in-out" style="width: 100%"></div>
</div>
</div>
<!-- Animated Progress Example -->
<div>
<div style="display: flex; justify-content: space-between; margin-bottom: 0.5rem;">
<span style="font-size: 0.875rem; font-weight: 500;">Simulated Progress</span>
<span style="font-size: 0.875rem; color: var(--theme-muted-foreground);" id="progress-value">0%</span>
</div>
<div class="relative h-4 w-full overflow-hidden rounded-full bg-secondary" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<div id="progress-bar" class="h-full bg-primary transition-all duration-300 ease-in-out" style="width: 0%"></div>
</div>
<button
onclick="simulateProgress()"
class="inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-lg text-sm font-medium leading-5 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 bg-primary text-primary-foreground hover:bg-primary/90 h-9 px-4 py-2"
style="margin-top: 1rem;"
>
Start Progress
</button>
</div>
</div>
</section>
<!-- Skeleton -->
<section class="demo-section">
<h2>Skeleton</h2>
<p>Loading placeholders for content.</p>
<div style="display: grid; gap: 2rem;">
<div>
<h3 style="font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem;">Card Skeleton</h3>
<div class="rounded-lg border border-border bg-card p-6" style="max-width: 400px;">
<div style="display: flex; items-center gap: 1rem; margin-bottom: 1rem;">
<div class="animate-pulse rounded-md bg-muted h-10 w-10 rounded-full"></div>
<div style="flex: 1; display: flex; flex-direction: column; gap: 0.5rem;">
<div class="animate-pulse rounded-md bg-muted h-4 w-32"></div>
<div class="animate-pulse rounded-md bg-muted h-3 w-24"></div>
</div>
</div>
<div class="animate-pulse rounded-md bg-muted h-32 w-full" style="margin-bottom: 1rem;"></div>
<div style="display: flex; flex-direction: column; gap: 0.5rem;">
<div class="animate-pulse rounded-md bg-muted h-4 w-full"></div>
<div class="animate-pulse rounded-md bg-muted h-4 w-full"></div>
<div class="animate-pulse rounded-md bg-muted h-4 w-48"></div>
</div>
</div>
</div>
<div>
<h3 style="font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem;">List Skeleton</h3>
<div style="display: flex; flex-direction: column; gap: 1rem; max-width: 400px;">
<div style="display: flex; items-center; gap: 1rem;">
<div class="animate-pulse rounded-md bg-muted h-12 w-12"></div>
<div style="flex: 1; display: flex; flex-direction: column; gap: 0.5rem;">
<div class="animate-pulse rounded-md bg-muted h-4 w-48"></div>
<div class="animate-pulse rounded-md bg-muted h-3 w-32"></div>
</div>
</div>
<div style="display: flex; items-center; gap: 1rem;">
<div class="animate-pulse rounded-md bg-muted h-12 w-12"></div>
<div style="flex: 1; display: flex; flex-direction: column; gap: 0.5rem;">
<div class="animate-pulse rounded-md bg-muted h-4 w-48"></div>
<div class="animate-pulse rounded-md bg-muted h-3 w-32"></div>
</div>
</div>
<div style="display: flex; items-center; gap: 1rem;">
<div class="animate-pulse rounded-md bg-muted h-12 w-12"></div>
<div style="flex: 1; display: flex; flex-direction: column; gap: 0.5rem;">
<div class="animate-pulse rounded-md bg-muted h-4 w-48"></div>
<div class="animate-pulse rounded-md bg-muted h-3 w-32"></div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- JavaScript -->
<script>
// Tabs functionality
document.querySelectorAll('[data-tab-trigger]').forEach(trigger => {
trigger.addEventListener('click', function() {
const tabId = this.getAttribute('data-tab-trigger');
const tabsContainer = this.closest('[data-tabs]');
// Update triggers
tabsContainer.querySelectorAll('[data-tab-trigger]').forEach(t => {
t.setAttribute('aria-selected', 'false');
t.classList.remove('bg-background', 'text-foreground', 'shadow-sm', 'font-semibold');
t.classList.add('text-muted-foreground');
});
this.setAttribute('aria-selected', 'true');
this.classList.add('bg-background', 'text-foreground', 'shadow-sm', 'font-semibold');
this.classList.remove('text-muted-foreground');
// Update content
document.querySelectorAll('.tabs-content').forEach(content => {
content.classList.remove('active');
});
document.getElementById('tab-' + tabId).classList.add('active');
});
});
// Accordion functionality
document.querySelectorAll('[data-accordion-trigger]').forEach(trigger => {
trigger.addEventListener('click', function() {
const itemId = this.getAttribute('data-accordion-trigger');
const content = document.querySelector(`[data-accordion-content="${itemId}"]`);
const isOpen = content.classList.contains('open');
if (isOpen) {
content.classList.remove('open');
this.classList.remove('open');
} else {
content.classList.add('open');
this.classList.add('open');
}
});
});
// Simulated progress
let progressInterval;
function simulateProgress() {
const progressBar = document.getElementById('progress-bar');
const progressValue = document.getElementById('progress-value');
let progress = 0;
clearInterval(progressInterval);
progressBar.style.width = '0%';
progressInterval = setInterval(() => {
progress += Math.random() * 15;
if (progress >= 100) {
progress = 100;
clearInterval(progressInterval);
}
progressBar.style.width = progress + '%';
progressValue.textContent = Math.round(progress) + '%';
}, 300);
}
</script>
</body>
</html>