@pure-ds/storybook 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,442 +1,34 @@
1
- import { html } from "lit";
2
-
3
- const docsParameters = {
4
- description: {
5
- component: "Accessible tab interface with keyboard navigation",
6
- },
7
- };
8
-
9
- if (typeof window !== 'undefined') {
10
- import('../reference/reference-docs.js')
11
- .then(({ createComponentDocsPage }) => {
12
- docsParameters.page = createComponentDocsPage('pds-tabstrip');
13
- })
14
- .catch((error) => {
15
- console.warn('storybook: docs page failed to load for pds-tabstrip', error);
16
- });
17
- }
18
-
19
- const tabstripStoryStyles = html`
20
- <style>
21
- .tabstrip-panel {
22
- padding: var(--spacing-4);
23
- display: grid;
24
- gap: var(--spacing-4);
25
- }
26
-
27
- .tabstrip-panel__description {
28
- margin-bottom: var(--spacing-4);
29
- opacity: 0.9;
30
- max-width: 60ch;
31
- }
32
-
33
- .tabstrip-metrics-grid {
34
- display: grid;
35
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
36
- gap: var(--spacing-4);
37
- margin-bottom: var(--spacing-6);
38
- }
39
-
40
- .tabstrip-metric-card {
41
- display: grid;
42
- gap: var(--spacing-2);
43
- }
44
-
45
- .tabstrip-metric-value {
46
- font-size: 2.5rem;
47
- font-weight: 700;
48
- margin: var(--spacing-2) 0;
49
- }
50
-
51
- .tabstrip-metric-value--primary {
52
- color: var(--color-primary);
53
- }
54
-
55
- .tabstrip-metric-value--secondary {
56
- color: var(--color-secondary);
57
- }
58
-
59
- .tabstrip-metric-value--accent {
60
- color: var(--color-accent);
61
- }
62
-
63
- .tabstrip-metric-delta {
64
- font-size: 0.85rem;
65
- opacity: 0.7;
66
- margin: 0;
67
- }
68
-
69
- .tabstrip-activity-card {
70
- display: grid;
71
- gap: var(--spacing-3);
72
- }
73
-
74
- .tabstrip-activity-list {
75
- display: flex;
76
- flex-direction: column;
77
- gap: var(--spacing-2);
78
- }
79
-
80
- .tabstrip-activity-item {
81
- display: flex;
82
- align-items: center;
83
- gap: var(--spacing-3);
84
- padding: var(--spacing-2);
85
- border-radius: var(--radius-sm);
86
- }
87
-
88
- .tabstrip-activity-icon {
89
- color: var(--color-primary);
90
- }
91
-
92
- .tabstrip-activity-content {
93
- flex: 1;
94
- }
95
-
96
- .tabstrip-activity-meta {
97
- font-size: 0.85rem;
98
- opacity: 0.7;
99
- }
100
-
101
- .tabstrip-activity-time {
102
- font-size: 0.75rem;
103
- opacity: 0.6;
104
- white-space: nowrap;
105
- }
106
-
107
- .tabstrip-analytics-card {
108
- margin-bottom: var(--spacing-4);
109
- display: grid;
110
- gap: var(--spacing-3);
111
- }
112
-
113
- .tabstrip-traffic-list {
114
- display: grid;
115
- gap: var(--spacing-3);
116
- }
117
-
118
- .tabstrip-traffic-row {
119
- display: flex;
120
- justify-content: space-between;
121
- margin-bottom: var(--spacing-1);
122
- align-items: center;
123
- }
124
-
125
- .tabstrip-traffic-bar-track {
126
- height: 8px;
127
- background: var(--surface-elevated);
128
- border-radius: var(--radius-full);
129
- overflow: hidden;
130
- }
131
-
132
- .tabstrip-traffic-bar-fill {
133
- height: 100%;
134
- border-radius: inherit;
135
- }
136
-
137
- .tabstrip-traffic-bar-fill--45 {
138
- width: 45%;
139
- }
140
-
141
- .tabstrip-traffic-bar-fill--32 {
142
- width: 32%;
143
- }
144
-
145
- .tabstrip-traffic-bar-fill--23 {
146
- width: 23%;
147
- }
148
-
149
- .tabstrip-traffic-bar-fill--primary {
150
- background: var(--color-primary);
151
- }
152
-
153
- .tabstrip-traffic-bar-fill--secondary {
154
- background: var(--color-secondary);
155
- }
156
-
157
- .tabstrip-traffic-bar-fill--accent {
158
- background: var(--color-accent);
159
- }
160
-
161
- .tabstrip-features-card {
162
- display: grid;
163
- gap: var(--spacing-3);
164
- }
165
-
166
- .tabstrip-features-list {
167
- margin: 0;
168
- padding-left: var(--spacing-4);
169
- display: grid;
170
- gap: var(--spacing-2);
171
- }
172
-
173
- .tabstrip-settings-card,
174
- .tabstrip-notifications-card {
175
- margin-bottom: var(--spacing-4);
176
- display: grid;
177
- gap: var(--spacing-3);
178
- }
179
-
180
- .tabstrip-settings-fields {
181
- display: grid;
182
- gap: var(--spacing-3);
183
- }
184
-
185
- .tabstrip-form-label {
186
- display: grid;
187
- gap: var(--spacing-1);
188
- }
189
-
190
- .tabstrip-field-heading {
191
- font-weight: 600;
192
- }
193
-
194
- .tabstrip-input,
195
- .tabstrip-select {
196
- width: 100%;
197
- padding: var(--spacing-2);
198
- border: 1px solid var(--color-border);
199
- border-radius: var(--radius-sm);
200
- font: inherit;
201
- background: var(--color-surface);
202
- }
203
-
204
- .tabstrip-notification-group {
205
- display: grid;
206
- gap: var(--spacing-2);
207
- }
208
-
209
- .tabstrip-checkbox {
210
- display: flex;
211
- align-items: center;
212
- gap: var(--spacing-2);
213
- }
214
-
215
- .tabstrip-actions {
216
- display: flex;
217
- gap: var(--spacing-2);
218
- flex-wrap: wrap;
219
- }
220
- </style>
221
- `;
222
-
223
- const tabstripMetrics = [
224
- {
225
- title: "Total Sales",
226
- value: "$127.5K",
227
- delta: "↑ 23% from last month",
228
- valueClass: "tabstrip-metric-value--primary",
229
- },
230
- {
231
- title: "Active Users",
232
- value: "8,432",
233
- delta: "↑ 12% from last month",
234
- valueClass: "tabstrip-metric-value--secondary",
235
- },
236
- {
237
- title: "Conversion Rate",
238
- value: "3.8%",
239
- delta: "↑ 0.5% from last month",
240
- valueClass: "tabstrip-metric-value--accent",
241
- },
242
- ];
243
-
244
- const tabstripActivityItems = Array.from({ length: 4 }, (_, index) => ({
245
- orderId: 1000 + index,
246
- amount: `$${(index + 1) * 150}`,
247
- time: `${index + 1}h ago`,
248
- }));
249
-
250
- const tabstripTrafficSources = [
251
- {
252
- label: "Direct",
253
- value: "45%",
254
- fillClass: "tabstrip-traffic-bar-fill--45 tabstrip-traffic-bar-fill--primary",
255
- },
256
- {
257
- label: "Search Engines",
258
- value: "32%",
259
- fillClass: "tabstrip-traffic-bar-fill--32 tabstrip-traffic-bar-fill--secondary",
260
- },
261
- {
262
- label: "Social Media",
263
- value: "23%",
264
- fillClass: "tabstrip-traffic-bar-fill--23 tabstrip-traffic-bar-fill--accent",
265
- },
266
- ];
267
-
268
- const tabstripFeatures = [
269
- "Deep linking with URL hashes for bookmarkable tabs",
270
- "Keyboard navigation (Arrow keys, Home, End)",
271
- "Accessible ARIA attributes for screen readers",
272
- "Automatic focus management",
273
- "Responsive design that adapts to mobile",
274
- ];
275
-
276
- const tabstripNotificationOptions = [
277
- { label: "Email notifications for new orders", checked: true },
278
- { label: "Weekly performance reports", checked: true },
279
- { label: "Marketing updates", checked: false },
280
- ];
281
-
282
- const tabstripCategories = [
283
- "Electronics",
284
- "Clothing",
285
- "Home & Garden",
286
- "Sports",
287
- ];
1
+ import { html } from 'lit';
288
2
 
289
3
  export default {
290
- title: "Components/Pds Tabstrip",
291
- tags: ['autodocs', 'grouping'],
4
+ title: 'PDS/Components/pds-tabstrip',
292
5
  parameters: {
293
- pds: {
294
- tags: ["navigation", "grouping", "layout"],
295
- },
296
- docs: docsParameters,
297
- },
6
+ docs: {
7
+ description: {
8
+ component: 'Accessible tab interface with keyboard navigation'
9
+ }
10
+ }
11
+ }
298
12
  };
299
13
 
300
14
  export const Default = () => html`
301
- ${tabstripStoryStyles}
302
- <pds-tabstrip label="Product Dashboard">
303
- <pds-tabpanel id="overview" label="Overview">
304
- <div class="tabstrip-panel">
305
- <div>
306
- <h3>Product Overview</h3>
307
- <p class="tabstrip-panel__description">
308
- Complete analytics and insights for your product performance.
309
- </p>
310
- </div>
311
-
312
- <div class="tabstrip-metrics-grid">
313
- ${tabstripMetrics.map(
314
- (metric) => html`
315
- <article class="card surface-elevated tabstrip-metric-card">
316
- <h4>${metric.title}</h4>
317
- <div class="tabstrip-metric-value ${metric.valueClass}">
318
- ${metric.value}
319
- </div>
320
- <p class="tabstrip-metric-delta">${metric.delta}</p>
321
- </article>
322
- `
323
- )}
324
- </div>
325
-
326
- <article class="card tabstrip-activity-card">
327
- <h4>Recent Activity</h4>
328
- <div class="tabstrip-activity-list">
329
- ${tabstripActivityItems.map(
330
- (activity) => html`
331
- <div class="tabstrip-activity-item">
332
- <pds-icon class="tabstrip-activity-icon" icon="activity"></pds-icon>
333
- <div class="tabstrip-activity-content">
334
- <strong>New sale recorded</strong>
335
- <div class="tabstrip-activity-meta">
336
- Order #${activity.orderId} - ${activity.amount}
337
- </div>
338
- </div>
339
- <span class="tabstrip-activity-time">${activity.time}</span>
340
- </div>
341
- `
342
- )}
343
- </div>
344
- </article>
345
- </div>
346
- </pds-tabpanel>
347
-
348
- <pds-tabpanel id="details" label="Analytics">
349
- <div class="tabstrip-panel">
350
- <div>
351
- <h3>Detailed Analytics</h3>
352
- <p class="tabstrip-panel__description">
353
- Deep dive into your product metrics and user behavior.
354
- </p>
355
- </div>
356
-
357
- <article class="card tabstrip-analytics-card">
358
- <h4>Traffic Sources</h4>
359
- <div class="tabstrip-traffic-list">
360
- ${tabstripTrafficSources.map(
361
- (source) => html`
362
- <div>
363
- <div class="tabstrip-traffic-row">
364
- <span>${source.label}</span>
365
- <strong>${source.value}</strong>
366
- </div>
367
- <div class="tabstrip-traffic-bar-track">
368
- <div class="tabstrip-traffic-bar-fill ${source.fillClass}"></div>
369
- </div>
370
- </div>
371
- `
372
- )}
373
- </div>
374
- </article>
375
-
376
- <article class="card surface-elevated tabstrip-features-card">
377
- <h4>Top Features</h4>
378
- <ul class="tabstrip-features-list">
379
- ${tabstripFeatures.map((feature) => html`<li>${feature}</li>`)}
380
- </ul>
381
- </article>
382
- </div>
383
- </pds-tabpanel>
384
-
385
- <pds-tabpanel id="settings" label="Settings">
386
- <div class="tabstrip-panel">
387
- <div>
388
- <h3>Product Settings</h3>
389
- <p class="tabstrip-panel__description">
390
- Configure your product preferences and options.
391
- </p>
392
- </div>
393
-
394
- <article class="card tabstrip-settings-card">
395
- <h4>General Settings</h4>
396
- <div class="tabstrip-settings-fields">
397
- <label class="tabstrip-form-label">
398
- <span class="tabstrip-field-heading">Product Name</span>
399
- <input
400
- class="tabstrip-input"
401
- type="text"
402
- value="My Awesome Product"
403
- placeholder="Enter product name"
404
- />
405
- </label>
406
-
407
- <label class="tabstrip-form-label">
408
- <span class="tabstrip-field-heading">Product Category</span>
409
- <select class="tabstrip-select">
410
- ${tabstripCategories.map(
411
- (category) => html`<option>${category}</option>`
412
- )}
413
- </select>
414
- </label>
415
- </div>
416
- </article>
417
-
418
- <article class="card surface-elevated tabstrip-notifications-card">
419
- <h4>Notifications</h4>
420
- <fieldset class="tabstrip-notification-group" role="radiogroup">
421
- ${tabstripNotificationOptions.map(
422
- (option) => html`
423
- <label class="tabstrip-checkbox">
424
- <input type="checkbox" ?checked=${option.checked} />
425
- <span>${option.label}</span>
426
- </label>
427
- `
428
- )}
429
- </fieldset>
430
- </article>
431
-
432
- <div class="tabstrip-actions">
433
- <button class="btn-primary">
434
- <pds-icon icon="check"></pds-icon>
435
- Save Settings
436
- </button>
437
- <button class="btn-outline">Cancel</button>
438
- </div>
439
- </div>
440
- </pds-tabpanel>
15
+ <pds-tabstrip>
16
+ <button slot="tab">Overview</button>
17
+ <div slot="panel">
18
+ <h3>Overview</h3>
19
+ <p>This is the overview panel.</p>
20
+ </div>
21
+
22
+ <button slot="tab">Details</button>
23
+ <div slot="panel">
24
+ <h3>Details</h3>
25
+ <p>This is the details panel.</p>
26
+ </div>
27
+
28
+ <button slot="tab">Settings</button>
29
+ <div slot="panel">
30
+ <h3>Settings</h3>
31
+ <p>This is the settings panel.</p>
32
+ </div>
441
33
  </pds-tabstrip>
442
34
  `;