@reliability-design/web 1.0.2 → 1.0.3

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.
Files changed (54) hide show
  1. package/dist/components/rel-accordion/rel-accordion.ts +27 -22
  2. package/dist/components/rel-alert/rel-alert.ts +98 -66
  3. package/dist/components/rel-avatar/rel-avatar.ts +8 -15
  4. package/dist/components/rel-badge/rel-badge.ts +23 -16
  5. package/dist/components/rel-breadcrumb/rel-breadcrumb.ts +12 -12
  6. package/dist/components/rel-button/rel-button.ts +39 -59
  7. package/dist/components/rel-card/rel-card.ts +11 -10
  8. package/dist/components/rel-cardmedia/rel-cardmedia.ts +11 -17
  9. package/dist/components/rel-checkbox/rel-checkbox.ts +18 -35
  10. package/dist/components/rel-chip/rel-chip.ts +37 -128
  11. package/dist/components/rel-container/rel-container.ts +1 -6
  12. package/dist/components/rel-divider/rel-divider.ts +37 -37
  13. package/dist/components/rel-layout/rel-layout.ts +12 -14
  14. package/dist/components/rel-progress/rel-progress.ts +26 -15
  15. package/dist/components/rel-radio/rel-radio.ts +32 -72
  16. package/dist/components/rel-snackbar/rel-snackbar.ts +6 -0
  17. package/dist/components/rel-stepper/rel-stepper.ts +23 -2
  18. package/dist/components/rel-switch/rel-switch.ts +7 -5
  19. package/dist/components/rel-tab/rel-tab.ts +10 -8
  20. package/dist/components/rel-textfield/rel-textfield.ts +2 -2
  21. package/dist/index.d.mts +11 -7
  22. package/dist/index.d.ts +11 -7
  23. package/dist/index.js +367 -475
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +383 -489
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/vars-6ZIUPIU4.css +184 -0
  28. package/package.json +2 -2
  29. package/dist/components/rel-accordion/rel-accordion.stories.ts +0 -313
  30. package/dist/components/rel-alert/rel-alert.stories.ts +0 -412
  31. package/dist/components/rel-avatar/rel-avatar.stories.ts +0 -327
  32. package/dist/components/rel-badge/rel-badge.stories.ts +0 -350
  33. package/dist/components/rel-breadcrumb/rel-breadcrumb.stories.ts +0 -306
  34. package/dist/components/rel-button/rel-button.stories.ts +0 -356
  35. package/dist/components/rel-card/rel-card.stories.ts +0 -299
  36. package/dist/components/rel-cardmedia/rel-cardmedia.stories.ts +0 -368
  37. package/dist/components/rel-checkbox/rel-checkbox.stories.ts +0 -414
  38. package/dist/components/rel-chip/rel-chip.stories.ts +0 -552
  39. package/dist/components/rel-container/rel-container.stories.ts +0 -239
  40. package/dist/components/rel-divider/rel-divider.stories.ts +0 -229
  41. package/dist/components/rel-layout/rel-layout.stories.ts +0 -713
  42. package/dist/components/rel-menu/rel-menu.stories.ts +0 -910
  43. package/dist/components/rel-progress/rel-progress.stories.ts +0 -817
  44. package/dist/components/rel-radio/rel-radio.stories.ts +0 -1048
  45. package/dist/components/rel-segmented-button/rel-segmented-button.stories.ts +0 -1079
  46. package/dist/components/rel-select/rel-select.stories.ts +0 -1201
  47. package/dist/components/rel-slider/rel-slider.stories.ts +0 -730
  48. package/dist/components/rel-snackbar/rel-snackbar.stories.ts +0 -808
  49. package/dist/components/rel-stepper/rel-stepper.stories.ts +0 -752
  50. package/dist/components/rel-switch/rel-switch.stories.ts +0 -441
  51. package/dist/components/rel-tab/rel-tab.stories.ts +0 -492
  52. package/dist/components/rel-textfield/rel-textfield.stories.ts +0 -710
  53. package/dist/components/rel-toast/rel-toast.stories.ts +0 -394
  54. package/dist/components/rel-tooltip/rel-tooltip.stories.ts +0 -364
@@ -1,1079 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/web-components-vite';
2
- import { html } from 'lit';
3
- import './rel-segmented-button';
4
- import type { SegmentOption } from './rel-segmented-button';
5
-
6
- /**
7
- * The Segmented Button component provides mutually exclusive options in a compact button group.
8
- * Built with Lit web components for framework-agnostic usage with full token support.
9
- *
10
- * ## Features
11
- * - **Single Selection**: Only one segment can be active at a time
12
- * - **Multiple Sizes**: Small and medium sizes available
13
- * - **Alignment Options**: Left, middle, or right alignment
14
- * - **Disabled State**: Individual segments can be disabled
15
- * - **Token-Based Styling**: Uses design system tokens
16
- * - **Accessible**: Proper button semantics and keyboard support
17
- */
18
- const meta: Meta = {
19
- title: 'Components/Segmented Button',
20
- tags: ['autodocs'],
21
- component: 'rel-segmented-button',
22
- argTypes: {
23
- size: {
24
- control: { type: 'select' },
25
- options: ['small', 'medium'],
26
- description: 'Size of the segmented button group',
27
- table: {
28
- defaultValue: { summary: 'medium' },
29
- type: { summary: 'small | medium' },
30
- },
31
- },
32
- align: {
33
- control: { type: 'select' },
34
- options: ['left', 'middle', 'right'],
35
- description: 'Alignment of the button group',
36
- table: {
37
- defaultValue: { summary: 'left' },
38
- type: { summary: 'left | middle | right' },
39
- },
40
- },
41
- active: {
42
- control: { type: 'text' },
43
- description: 'Currently active segment value',
44
- table: {
45
- defaultValue: { summary: '' },
46
- type: { summary: 'string' },
47
- },
48
- },
49
- },
50
- };
51
-
52
- export default meta;
53
- type Story = StoryObj;
54
-
55
- /**
56
- * Default segmented button with basic options
57
- */
58
- export const Default: Story = {
59
- render: () => {
60
- const options: SegmentOption[] = [
61
- { value: 'day', label: 'Day' },
62
- { value: 'week', label: 'Week' },
63
- { value: 'month', label: 'Month' },
64
- ];
65
-
66
- const button = document.createElement('rel-segmented-button') as any;
67
- button.options = options;
68
- button.active = 'week';
69
- button.addEventListener('changed', (e: CustomEvent) => {
70
- console.log('Active segment:', e.detail.value);
71
- });
72
-
73
- return button;
74
- },
75
- };
76
-
77
- /**
78
- * Small size segmented button
79
- */
80
- export const Small: Story = {
81
- render: () => {
82
- const options: SegmentOption[] = [
83
- { value: 'xs', label: 'XS' },
84
- { value: 's', label: 'S' },
85
- { value: 'm', label: 'M' },
86
- { value: 'l', label: 'L' },
87
- { value: 'xl', label: 'XL' },
88
- ];
89
-
90
- const button = document.createElement('rel-segmented-button') as any;
91
- button.options = options;
92
- button.active = 'm';
93
- button.size = 'small';
94
-
95
- return button;
96
- },
97
- };
98
-
99
- /**
100
- * Medium size segmented button
101
- */
102
- export const Medium: Story = {
103
- render: () => {
104
- const options: SegmentOption[] = [
105
- { value: 'list', label: 'List' },
106
- { value: 'grid', label: 'Grid' },
107
- { value: 'table', label: 'Table' },
108
- ];
109
-
110
- const button = document.createElement('rel-segmented-button') as any;
111
- button.options = options;
112
- button.active = 'grid';
113
- button.size = 'medium';
114
-
115
- return button;
116
- },
117
- };
118
-
119
- /**
120
- * Segmented button with disabled options
121
- */
122
- export const WithDisabled: Story = {
123
- render: () => {
124
- const options: SegmentOption[] = [
125
- { value: 'public', label: 'Public' },
126
- { value: 'unlisted', label: 'Unlisted' },
127
- { value: 'private', label: 'Private', disabled: true },
128
- ];
129
-
130
- const button = document.createElement('rel-segmented-button') as any;
131
- button.options = options;
132
- button.active = 'public';
133
-
134
- return button;
135
- },
136
- };
137
-
138
- /**
139
- * Left aligned segmented button
140
- */
141
- export const AlignLeft: Story = {
142
- render: () => html`
143
- <div style="width: 100%; background: var(--rel-colors-gray-bg); padding: 24px; border-radius: 8px;">
144
- ${(() => {
145
- const options: SegmentOption[] = [
146
- { value: 'left', label: 'Left' },
147
- { value: 'center', label: 'Center' },
148
- { value: 'right', label: 'Right' },
149
- ];
150
-
151
- const button = document.createElement('rel-segmented-button') as any;
152
- button.options = options;
153
- button.active = 'left';
154
- button.align = 'left';
155
-
156
- return button;
157
- })()}
158
- </div>
159
- `,
160
- };
161
-
162
- /**
163
- * Middle aligned segmented button
164
- */
165
- export const AlignMiddle: Story = {
166
- render: () => html`
167
- <div style="width: 100%; background: var(--rel-colors-gray-bg); padding: 24px; border-radius: 8px;">
168
- ${(() => {
169
- const options: SegmentOption[] = [
170
- { value: 'left', label: 'Left' },
171
- { value: 'center', label: 'Center' },
172
- { value: 'right', label: 'Right' },
173
- ];
174
-
175
- const button = document.createElement('rel-segmented-button') as any;
176
- button.options = options;
177
- button.active = 'center';
178
- button.align = 'middle';
179
-
180
- return button;
181
- })()}
182
- </div>
183
- `,
184
- };
185
-
186
- /**
187
- * Right aligned segmented button
188
- */
189
- export const AlignRight: Story = {
190
- render: () => html`
191
- <div style="width: 100%; background: var(--rel-colors-gray-bg); padding: 24px; border-radius: 8px;">
192
- ${(() => {
193
- const options: SegmentOption[] = [
194
- { value: 'left', label: 'Left' },
195
- { value: 'center', label: 'Center' },
196
- { value: 'right', label: 'Right' },
197
- ];
198
-
199
- const button = document.createElement('rel-segmented-button') as any;
200
- button.options = options;
201
- button.active = 'right';
202
- button.align = 'right';
203
-
204
- return button;
205
- })()}
206
- </div>
207
- `,
208
- };
209
-
210
- /**
211
- * View mode selector
212
- */
213
- export const ViewMode: Story = {
214
- render: () => html`
215
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
216
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Select View Mode</h3>
217
- ${(() => {
218
- const options: SegmentOption[] = [
219
- { value: 'list', label: 'List View' },
220
- { value: 'grid', label: 'Grid View' },
221
- { value: 'compact', label: 'Compact View' },
222
- ];
223
-
224
- const button = document.createElement('rel-segmented-button') as any;
225
- button.options = options;
226
- button.active = 'grid';
227
-
228
- return button;
229
- })()}
230
- </div>
231
- `,
232
- };
233
-
234
- /**
235
- * Time range selector
236
- */
237
- export const TimeRange: Story = {
238
- render: () => html`
239
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
240
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Select Time Range</h3>
241
- ${(() => {
242
- const options: SegmentOption[] = [
243
- { value: '7d', label: '7 Days' },
244
- { value: '30d', label: '30 Days' },
245
- { value: '90d', label: '90 Days' },
246
- { value: '1y', label: '1 Year' },
247
- ];
248
-
249
- const button = document.createElement('rel-segmented-button') as any;
250
- button.options = options;
251
- button.active = '30d';
252
-
253
- return button;
254
- })()}
255
- </div>
256
- `,
257
- };
258
-
259
- /**
260
- * Chart type selector
261
- */
262
- export const ChartType: Story = {
263
- render: () => html`
264
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
265
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Chart Type</h3>
266
- ${(() => {
267
- const options: SegmentOption[] = [
268
- { value: 'line', label: 'Line' },
269
- { value: 'bar', label: 'Bar' },
270
- { value: 'area', label: 'Area' },
271
- { value: 'pie', label: 'Pie' },
272
- ];
273
-
274
- const button = document.createElement('rel-segmented-button') as any;
275
- button.options = options;
276
- button.active = 'line';
277
- button.size = 'small';
278
-
279
- return button;
280
- })()}
281
- </div>
282
- `,
283
- };
284
-
285
- /**
286
- * Status filter
287
- */
288
- export const StatusFilter: Story = {
289
- render: () => html`
290
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
291
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Filter by Status</h3>
292
- ${(() => {
293
- const options: SegmentOption[] = [
294
- { value: 'all', label: 'All' },
295
- { value: 'active', label: 'Active' },
296
- { value: 'pending', label: 'Pending' },
297
- { value: 'completed', label: 'Completed' },
298
- ];
299
-
300
- const button = document.createElement('rel-segmented-button') as any;
301
- button.options = options;
302
- button.active = 'all';
303
-
304
- return button;
305
- })()}
306
- </div>
307
- `,
308
- };
309
-
310
- /**
311
- * Priority selector
312
- */
313
- export const Priority: Story = {
314
- render: () => html`
315
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
316
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Set Priority</h3>
317
- ${(() => {
318
- const options: SegmentOption[] = [
319
- { value: 'low', label: 'Low' },
320
- { value: 'medium', label: 'Medium' },
321
- { value: 'high', label: 'High' },
322
- { value: 'urgent', label: 'Urgent' },
323
- ];
324
-
325
- const button = document.createElement('rel-segmented-button') as any;
326
- button.options = options;
327
- button.active = 'medium';
328
-
329
- return button;
330
- })()}
331
- </div>
332
- `,
333
- };
334
-
335
- /**
336
- * Typography alignment
337
- */
338
- export const TextAlignment: Story = {
339
- render: () => html`
340
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
341
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Text Alignment</h3>
342
- ${(() => {
343
- const options: SegmentOption[] = [
344
- { value: 'left', label: 'Left' },
345
- { value: 'center', label: 'Center' },
346
- { value: 'right', label: 'Right' },
347
- { value: 'justify', label: 'Justify' },
348
- ];
349
-
350
- const button = document.createElement('rel-segmented-button') as any;
351
- button.options = options;
352
- button.active = 'left';
353
- button.size = 'small';
354
-
355
- return button;
356
- })()}
357
- </div>
358
- `,
359
- };
360
-
361
- /**
362
- * Multiple segmented buttons in a form
363
- */
364
- export const MultipleGroups: Story = {
365
- render: () => html`
366
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
367
- <h3 style="margin: 0 0 20px; color: var(--rel-colors-gray-heading); font-size: 18px;">Report Settings</h3>
368
-
369
- <div style="margin-bottom: 24px;">
370
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Report Type</h4>
371
- ${(() => {
372
- const options: SegmentOption[] = [
373
- { value: 'summary', label: 'Summary' },
374
- { value: 'detailed', label: 'Detailed' },
375
- { value: 'custom', label: 'Custom' },
376
- ];
377
-
378
- const button = document.createElement('rel-segmented-button') as any;
379
- button.options = options;
380
- button.active = 'detailed';
381
-
382
- return button;
383
- })()}
384
- </div>
385
-
386
- <div style="margin-bottom: 24px;">
387
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Time Period</h4>
388
- ${(() => {
389
- const options: SegmentOption[] = [
390
- { value: 'week', label: 'Week' },
391
- { value: 'month', label: 'Month' },
392
- { value: 'quarter', label: 'Quarter' },
393
- { value: 'year', label: 'Year' },
394
- ];
395
-
396
- const button = document.createElement('rel-segmented-button') as any;
397
- button.options = options;
398
- button.active = 'month';
399
-
400
- return button;
401
- })()}
402
- </div>
403
-
404
- <div>
405
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Format</h4>
406
- ${(() => {
407
- const options: SegmentOption[] = [
408
- { value: 'pdf', label: 'PDF' },
409
- { value: 'excel', label: 'Excel' },
410
- { value: 'csv', label: 'CSV' },
411
- ];
412
-
413
- const button = document.createElement('rel-segmented-button') as any;
414
- button.options = options;
415
- button.active = 'pdf';
416
- button.size = 'small';
417
-
418
- return button;
419
- })()}
420
- </div>
421
- </div>
422
- `,
423
- };
424
-
425
- /**
426
- * Two segments - Binary choice
427
- */
428
- export const TwoSegments: Story = {
429
- render: () => html`
430
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
431
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Sign Up / Sign In</h3>
432
- ${(() => {
433
- const options: SegmentOption[] = [
434
- { value: 'signup', label: 'Sign Up' },
435
- { value: 'signin', label: 'Sign In' },
436
- ];
437
-
438
- const button = document.createElement('rel-segmented-button') as any;
439
- button.options = options;
440
- button.active = 'signup';
441
-
442
- return button;
443
- })()}
444
- </div>
445
- `,
446
- };
447
-
448
- /**
449
- * Three segments - Common choice
450
- */
451
- export const ThreeSegments: Story = {
452
- render: () => html`
453
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
454
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Subscription Plan</h3>
455
- ${(() => {
456
- const options: SegmentOption[] = [
457
- { value: 'basic', label: 'Basic' },
458
- { value: 'pro', label: 'Pro' },
459
- { value: 'enterprise', label: 'Enterprise' },
460
- ];
461
-
462
- const button = document.createElement('rel-segmented-button') as any;
463
- button.options = options;
464
- button.active = 'pro';
465
-
466
- return button;
467
- })()}
468
- </div>
469
- `,
470
- };
471
-
472
- /**
473
- * Four segments
474
- */
475
- export const FourSegments: Story = {
476
- render: () => html`
477
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
478
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Dashboard Layout</h3>
479
- ${(() => {
480
- const options: SegmentOption[] = [
481
- { value: 'single', label: 'Single' },
482
- { value: 'side-by-side', label: 'Side by Side' },
483
- { value: 'grid', label: 'Grid' },
484
- { value: 'custom', label: 'Custom' },
485
- ];
486
-
487
- const button = document.createElement('rel-segmented-button') as any;
488
- button.options = options;
489
- button.active = 'grid';
490
-
491
- return button;
492
- })()}
493
- </div>
494
- `,
495
- };
496
-
497
- /**
498
- * Five or more segments
499
- */
500
- export const FivePlusSegments: Story = {
501
- render: () => html`
502
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
503
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Rating Scale</h3>
504
- ${(() => {
505
- const options: SegmentOption[] = [
506
- { value: '1', label: '1' },
507
- { value: '2', label: '2' },
508
- { value: '3', label: '3' },
509
- { value: '4', label: '4' },
510
- { value: '5', label: '5' },
511
- { value: '6', label: '6' },
512
- ];
513
-
514
- const button = document.createElement('rel-segmented-button') as any;
515
- button.options = options;
516
- button.active = '4';
517
- button.size = 'small';
518
-
519
- return button;
520
- })()}
521
- </div>
522
- `,
523
- };
524
-
525
- /**
526
- * Multiple disabled segments
527
- */
528
- export const MultipleDisabled: Story = {
529
- render: () => html`
530
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
531
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Access Levels (Limited Permissions)</h3>
532
- ${(() => {
533
- const options: SegmentOption[] = [
534
- { value: 'viewer', label: 'Viewer' },
535
- { value: 'editor', label: 'Editor' },
536
- { value: 'admin', label: 'Admin', disabled: true },
537
- { value: 'owner', label: 'Owner', disabled: true },
538
- ];
539
-
540
- const button = document.createElement('rel-segmented-button') as any;
541
- button.options = options;
542
- button.active = 'viewer';
543
-
544
- return button;
545
- })()}
546
- </div>
547
- `,
548
- };
549
-
550
- /**
551
- * Disabled segment in the middle
552
- */
553
- export const DisabledMiddleSegment: Story = {
554
- render: () => html`
555
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
556
- <h3 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Feature Availability</h3>
557
- ${(() => {
558
- const options: SegmentOption[] = [
559
- { value: 'free', label: 'Free Tier' },
560
- { value: 'standard', label: 'Standard', disabled: true },
561
- { value: 'premium', label: 'Premium' },
562
- ];
563
-
564
- const button = document.createElement('rel-segmented-button') as any;
565
- button.options = options;
566
- button.active = 'free';
567
-
568
- return button;
569
- })()}
570
- <p style="margin: 12px 0 0; color: var(--rel-colors-gray-subheading); font-size: 14px;">Standard tier is temporarily unavailable</p>
571
- </div>
572
- `,
573
- };
574
-
575
- /**
576
- * Small size with different segment counts
577
- */
578
- export const SmallSizeVariations: Story = {
579
- render: () => html`
580
- <div style="display: flex; flex-direction: column; gap: 24px;">
581
- <div>
582
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Small - 2 Segments</h4>
583
- ${(() => {
584
- const options: SegmentOption[] = [
585
- { value: 'yes', label: 'Yes' },
586
- { value: 'no', label: 'No' },
587
- ];
588
-
589
- const button = document.createElement('rel-segmented-button') as any;
590
- button.options = options;
591
- button.active = 'yes';
592
- button.size = 'small';
593
-
594
- return button;
595
- })()}
596
- </div>
597
-
598
- <div>
599
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Small - 3 Segments</h4>
600
- ${(() => {
601
- const options: SegmentOption[] = [
602
- { value: 'low', label: 'Low' },
603
- { value: 'med', label: 'Med' },
604
- { value: 'high', label: 'High' },
605
- ];
606
-
607
- const button = document.createElement('rel-segmented-button') as any;
608
- button.options = options;
609
- button.active = 'med';
610
- button.size = 'small';
611
-
612
- return button;
613
- })()}
614
- </div>
615
-
616
- <div>
617
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Small - 5 Segments</h4>
618
- ${(() => {
619
- const options: SegmentOption[] = [
620
- { value: 'xs', label: 'XS' },
621
- { value: 's', label: 'S' },
622
- { value: 'm', label: 'M' },
623
- { value: 'l', label: 'L' },
624
- { value: 'xl', label: 'XL' },
625
- ];
626
-
627
- const button = document.createElement('rel-segmented-button') as any;
628
- button.options = options;
629
- button.active = 'm';
630
- button.size = 'small';
631
-
632
- return button;
633
- })()}
634
- </div>
635
- </div>
636
- `,
637
- };
638
-
639
- /**
640
- * Medium size with different segment counts
641
- */
642
- export const MediumSizeVariations: Story = {
643
- render: () => html`
644
- <div style="display: flex; flex-direction: column; gap: 24px;">
645
- <div>
646
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Medium - 2 Segments</h4>
647
- ${(() => {
648
- const options: SegmentOption[] = [
649
- { value: 'manual', label: 'Manual' },
650
- { value: 'auto', label: 'Automatic' },
651
- ];
652
-
653
- const button = document.createElement('rel-segmented-button') as any;
654
- button.options = options;
655
- button.active = 'auto';
656
- button.size = 'medium';
657
-
658
- return button;
659
- })()}
660
- </div>
661
-
662
- <div>
663
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Medium - 3 Segments</h4>
664
- ${(() => {
665
- const options: SegmentOption[] = [
666
- { value: 'morning', label: 'Morning' },
667
- { value: 'afternoon', label: 'Afternoon' },
668
- { value: 'evening', label: 'Evening' },
669
- ];
670
-
671
- const button = document.createElement('rel-segmented-button') as any;
672
- button.options = options;
673
- button.active = 'afternoon';
674
- button.size = 'medium';
675
-
676
- return button;
677
- })()}
678
- </div>
679
-
680
- <div>
681
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Medium - 4 Segments</h4>
682
- ${(() => {
683
- const options: SegmentOption[] = [
684
- { value: 'q1', label: 'Q1' },
685
- { value: 'q2', label: 'Q2' },
686
- { value: 'q3', label: 'Q3' },
687
- { value: 'q4', label: 'Q4' },
688
- ];
689
-
690
- const button = document.createElement('rel-segmented-button') as any;
691
- button.options = options;
692
- button.active = 'q2';
693
- button.size = 'medium';
694
-
695
- return button;
696
- })()}
697
- </div>
698
- </div>
699
- `,
700
- };
701
-
702
- /**
703
- * Data visualization controls
704
- */
705
- export const DataVisualizationControls: Story = {
706
- render: () => html`
707
- <div style="max-width: 800px; background: white; padding: 32px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
708
- <h3 style="margin: 0 0 24px; color: var(--rel-colors-gray-heading); font-size: 20px;">Analytics Dashboard Controls</h3>
709
-
710
- <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px;">
711
- <div>
712
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Time Range</h4>
713
- ${(() => {
714
- const options: SegmentOption[] = [
715
- { value: '24h', label: '24h' },
716
- { value: '7d', label: '7d' },
717
- { value: '30d', label: '30d' },
718
- { value: '90d', label: '90d' },
719
- ];
720
-
721
- const button = document.createElement('rel-segmented-button') as any;
722
- button.options = options;
723
- button.active = '7d';
724
- button.size = 'small';
725
-
726
- return button;
727
- })()}
728
- </div>
729
-
730
- <div>
731
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Metric</h4>
732
- ${(() => {
733
- const options: SegmentOption[] = [
734
- { value: 'users', label: 'Users' },
735
- { value: 'revenue', label: 'Revenue' },
736
- { value: 'sessions', label: 'Sessions' },
737
- ];
738
-
739
- const button = document.createElement('rel-segmented-button') as any;
740
- button.options = options;
741
- button.active = 'users';
742
- button.size = 'small';
743
-
744
- return button;
745
- })()}
746
- </div>
747
-
748
- <div>
749
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Granularity</h4>
750
- ${(() => {
751
- const options: SegmentOption[] = [
752
- { value: 'hourly', label: 'Hourly' },
753
- { value: 'daily', label: 'Daily' },
754
- { value: 'weekly', label: 'Weekly' },
755
- ];
756
-
757
- const button = document.createElement('rel-segmented-button') as any;
758
- button.options = options;
759
- button.active = 'daily';
760
- button.size = 'small';
761
-
762
- return button;
763
- })()}
764
- </div>
765
-
766
- <div>
767
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Chart Type</h4>
768
- ${(() => {
769
- const options: SegmentOption[] = [
770
- { value: 'line', label: 'Line' },
771
- { value: 'bar', label: 'Bar' },
772
- { value: 'area', label: 'Area' },
773
- ];
774
-
775
- const button = document.createElement('rel-segmented-button') as any;
776
- button.options = options;
777
- button.active = 'line';
778
- button.size = 'small';
779
-
780
- return button;
781
- })()}
782
- </div>
783
- </div>
784
- </div>
785
- `,
786
- };
787
-
788
- /**
789
- * E-commerce product filters
790
- */
791
- export const EcommerceFilters: Story = {
792
- render: () => html`
793
- <div style="max-width: 800px; background: white; padding: 32px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
794
- <h3 style="margin: 0 0 24px; color: var(--rel-colors-gray-heading); font-size: 20px;">Product Filters</h3>
795
-
796
- <div style="display: flex; flex-direction: column; gap: 20px;">
797
- <div>
798
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Availability</h4>
799
- ${(() => {
800
- const options: SegmentOption[] = [
801
- { value: 'all', label: 'All Products' },
802
- { value: 'instock', label: 'In Stock' },
803
- { value: 'outofstock', label: 'Out of Stock' },
804
- ];
805
-
806
- const button = document.createElement('rel-segmented-button') as any;
807
- button.options = options;
808
- button.active = 'instock';
809
-
810
- return button;
811
- })()}
812
- </div>
813
-
814
- <div>
815
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Price Range</h4>
816
- ${(() => {
817
- const options: SegmentOption[] = [
818
- { value: 'budget', label: 'Under $50' },
819
- { value: 'mid', label: '$50-$100' },
820
- { value: 'premium', label: '$100-$200' },
821
- { value: 'luxury', label: '$200+' },
822
- ];
823
-
824
- const button = document.createElement('rel-segmented-button') as any;
825
- button.options = options;
826
- button.active = 'mid';
827
-
828
- return button;
829
- })()}
830
- </div>
831
-
832
- <div>
833
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Sort By</h4>
834
- ${(() => {
835
- const options: SegmentOption[] = [
836
- { value: 'newest', label: 'Newest' },
837
- { value: 'popular', label: 'Most Popular' },
838
- { value: 'price-low', label: 'Price: Low to High' },
839
- { value: 'price-high', label: 'Price: High to Low' },
840
- ];
841
-
842
- const button = document.createElement('rel-segmented-button') as any;
843
- button.options = options;
844
- button.active = 'popular';
845
- button.size = 'small';
846
-
847
- return button;
848
- })()}
849
- </div>
850
- </div>
851
- </div>
852
- `,
853
- };
854
-
855
- /**
856
- * Content management system
857
- */
858
- export const CMSControls: Story = {
859
- render: () => html`
860
- <div style="max-width: 800px; background: white; padding: 32px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
861
- <h3 style="margin: 0 0 24px; color: var(--rel-colors-gray-heading); font-size: 20px;">Content Editor</h3>
862
-
863
- <div style="display: flex; flex-direction: column; gap: 20px;">
864
- <div>
865
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Editor Mode</h4>
866
- ${(() => {
867
- const options: SegmentOption[] = [
868
- { value: 'visual', label: 'Visual' },
869
- { value: 'markdown', label: 'Markdown' },
870
- { value: 'html', label: 'HTML' },
871
- ];
872
-
873
- const button = document.createElement('rel-segmented-button') as any;
874
- button.options = options;
875
- button.active = 'visual';
876
-
877
- return button;
878
- })()}
879
- </div>
880
-
881
- <div>
882
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Content Status</h4>
883
- ${(() => {
884
- const options: SegmentOption[] = [
885
- { value: 'draft', label: 'Draft' },
886
- { value: 'review', label: 'In Review' },
887
- { value: 'published', label: 'Published' },
888
- { value: 'archived', label: 'Archived' },
889
- ];
890
-
891
- const button = document.createElement('rel-segmented-button') as any;
892
- button.options = options;
893
- button.active = 'draft';
894
-
895
- return button;
896
- })()}
897
- </div>
898
-
899
- <div>
900
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 14px;">Visibility</h4>
901
- ${(() => {
902
- const options: SegmentOption[] = [
903
- { value: 'public', label: 'Public' },
904
- { value: 'private', label: 'Private' },
905
- { value: 'password', label: 'Password Protected' },
906
- ];
907
-
908
- const button = document.createElement('rel-segmented-button') as any;
909
- button.options = options;
910
- button.active = 'public';
911
- button.size = 'small';
912
-
913
- return button;
914
- })()}
915
- </div>
916
- </div>
917
- </div>
918
- `,
919
- };
920
-
921
- /**
922
- * All alignment options showcase
923
- */
924
- export const AllAlignments: Story = {
925
- render: () => html`
926
- <div style="display: flex; flex-direction: column; gap: 32px;">
927
- <div style="width: 100%; background: var(--rel-colors-gray-bg); padding: 24px; border-radius: 8px;">
928
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Left Alignment</h4>
929
- ${(() => {
930
- const options: SegmentOption[] = [
931
- { value: '1', label: 'Option 1' },
932
- { value: '2', label: 'Option 2' },
933
- { value: '3', label: 'Option 3' },
934
- ];
935
-
936
- const button = document.createElement('rel-segmented-button') as any;
937
- button.options = options;
938
- button.active = '1';
939
- button.align = 'left';
940
-
941
- return button;
942
- })()}
943
- </div>
944
-
945
- <div style="width: 100%; background: var(--rel-colors-gray-bg); padding: 24px; border-radius: 8px;">
946
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Middle Alignment</h4>
947
- ${(() => {
948
- const options: SegmentOption[] = [
949
- { value: '1', label: 'Option 1' },
950
- { value: '2', label: 'Option 2' },
951
- { value: '3', label: 'Option 3' },
952
- ];
953
-
954
- const button = document.createElement('rel-segmented-button') as any;
955
- button.options = options;
956
- button.active = '2';
957
- button.align = 'middle';
958
-
959
- return button;
960
- })()}
961
- </div>
962
-
963
- <div style="width: 100%; background: var(--rel-colors-gray-bg); padding: 24px; border-radius: 8px;">
964
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Right Alignment</h4>
965
- ${(() => {
966
- const options: SegmentOption[] = [
967
- { value: '1', label: 'Option 1' },
968
- { value: '2', label: 'Option 2' },
969
- { value: '3', label: 'Option 3' },
970
- ];
971
-
972
- const button = document.createElement('rel-segmented-button') as any;
973
- button.options = options;
974
- button.active = '3';
975
- button.align = 'right';
976
-
977
- return button;
978
- })()}
979
- </div>
980
- </div>
981
- `,
982
- };
983
-
984
- /**
985
- * All states showcase
986
- */
987
- export const AllStates: Story = {
988
- render: () => html`
989
- <div style="display: flex; flex-direction: column; gap: 32px;">
990
- <div>
991
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Small Size</h4>
992
- ${(() => {
993
- const options: SegmentOption[] = [
994
- { value: 'option1', label: 'Option 1' },
995
- { value: 'option2', label: 'Option 2' },
996
- { value: 'option3', label: 'Option 3' },
997
- ];
998
-
999
- const button = document.createElement('rel-segmented-button') as any;
1000
- button.options = options;
1001
- button.active = 'option2';
1002
- button.size = 'small';
1003
-
1004
- return button;
1005
- })()}
1006
- </div>
1007
-
1008
- <div>
1009
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Medium Size</h4>
1010
- ${(() => {
1011
- const options: SegmentOption[] = [
1012
- { value: 'option1', label: 'Option 1' },
1013
- { value: 'option2', label: 'Option 2' },
1014
- { value: 'option3', label: 'Option 3' },
1015
- ];
1016
-
1017
- const button = document.createElement('rel-segmented-button') as any;
1018
- button.options = options;
1019
- button.active = 'option2';
1020
- button.size = 'medium';
1021
-
1022
- return button;
1023
- })()}
1024
- </div>
1025
-
1026
- <div>
1027
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">With Disabled Option</h4>
1028
- ${(() => {
1029
- const options: SegmentOption[] = [
1030
- { value: 'option1', label: 'Enabled' },
1031
- { value: 'option2', label: 'Disabled', disabled: true },
1032
- { value: 'option3', label: 'Enabled' },
1033
- ];
1034
-
1035
- const button = document.createElement('rel-segmented-button') as any;
1036
- button.options = options;
1037
- button.active = 'option1';
1038
-
1039
- return button;
1040
- })()}
1041
- </div>
1042
-
1043
- <div>
1044
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Two Options</h4>
1045
- ${(() => {
1046
- const options: SegmentOption[] = [
1047
- { value: 'on', label: 'On' },
1048
- { value: 'off', label: 'Off' },
1049
- ];
1050
-
1051
- const button = document.createElement('rel-segmented-button') as any;
1052
- button.options = options;
1053
- button.active = 'on';
1054
-
1055
- return button;
1056
- })()}
1057
- </div>
1058
-
1059
- <div>
1060
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Five Options</h4>
1061
- ${(() => {
1062
- const options: SegmentOption[] = [
1063
- { value: '1', label: 'One' },
1064
- { value: '2', label: 'Two' },
1065
- { value: '3', label: 'Three' },
1066
- { value: '4', label: 'Four' },
1067
- { value: '5', label: 'Five' },
1068
- ];
1069
-
1070
- const button = document.createElement('rel-segmented-button') as any;
1071
- button.options = options;
1072
- button.active = '3';
1073
-
1074
- return button;
1075
- })()}
1076
- </div>
1077
- </div>
1078
- `,
1079
- };