@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,1048 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/web-components-vite';
2
- import { html } from 'lit';
3
- import './rel-radio';
4
- import type { RadioOption } from './rel-radio';
5
-
6
- /**
7
- * The Radio component provides a group of mutually exclusive options.
8
- * Built with Lit web components for framework-agnostic usage with full token support.
9
- *
10
- * ## Features
11
- * - **Single Selection**: Only one option can be selected at a time
12
- * - **Supporting Text**: Optional helper text for each option
13
- * - **Error State**: Visual feedback for validation errors
14
- * - **Disabled State**: Individual options can be disabled
15
- * - **Token-Based Styling**: Uses design system tokens
16
- * - **Accessible**: Proper radio button semantics and keyboard navigation
17
- */
18
- const meta: Meta = {
19
- title: 'Components/Radio',
20
- tags: ['autodocs'],
21
- component: 'rel-radio',
22
- argTypes: {
23
- name: {
24
- control: { type: 'text' },
25
- description: 'Radio group name',
26
- table: {
27
- defaultValue: { summary: 'radio-group' },
28
- type: { summary: 'string' },
29
- },
30
- },
31
- selectedValue: {
32
- control: { type: 'text' },
33
- description: 'Currently selected value',
34
- table: {
35
- defaultValue: { summary: 'null' },
36
- type: { summary: 'string | null' },
37
- },
38
- },
39
- },
40
- };
41
-
42
- export default meta;
43
- type Story = StoryObj;
44
-
45
- /**
46
- * Default radio group with basic options
47
- */
48
- export const Default: Story = {
49
- render: () => {
50
- const options: RadioOption[] = [
51
- { value: 'option1', label: 'Option 1' },
52
- { value: 'option2', label: 'Option 2' },
53
- { value: 'option3', label: 'Option 3' },
54
- ];
55
-
56
- const radio = document.createElement('rel-radio') as any;
57
- radio.options = options;
58
- radio.name = 'default-radio';
59
- radio.selectedValue = 'option1';
60
-
61
- radio.addEventListener('changed', (e: CustomEvent) => {
62
- console.log('Selected value:', e.detail.value);
63
- });
64
-
65
- return radio;
66
- },
67
- };
68
-
69
- /**
70
- * Radio group with supporting text
71
- */
72
- export const WithSupportingText: Story = {
73
- render: () => {
74
- const options: RadioOption[] = [
75
- {
76
- value: 'free',
77
- label: 'Free Plan',
78
- supportingText: 'Best for personal use and small projects',
79
- },
80
- {
81
- value: 'pro',
82
- label: 'Pro Plan',
83
- supportingText: 'Perfect for professionals and growing teams',
84
- },
85
- {
86
- value: 'enterprise',
87
- label: 'Enterprise Plan',
88
- supportingText: 'Advanced features for large organizations',
89
- },
90
- ];
91
-
92
- const radio = document.createElement('rel-radio') as any;
93
- radio.options = options;
94
- radio.name = 'plan-radio';
95
- radio.selectedValue = 'pro';
96
-
97
- return radio;
98
- },
99
- };
100
-
101
- /**
102
- * Radio group with disabled options
103
- */
104
- export const WithDisabled: Story = {
105
- render: () => {
106
- const options: RadioOption[] = [
107
- { value: 'option1', label: 'Available Option' },
108
- { value: 'option2', label: 'Disabled Option', disabled: true },
109
- { value: 'option3', label: 'Another Available' },
110
- { value: 'option4', label: 'Also Disabled', disabled: true },
111
- ];
112
-
113
- const radio = document.createElement('rel-radio') as any;
114
- radio.options = options;
115
- radio.name = 'disabled-radio';
116
- radio.selectedValue = 'option1';
117
-
118
- return radio;
119
- },
120
- };
121
-
122
- /**
123
- * Radio group with error states
124
- */
125
- export const WithErrors: Story = {
126
- render: () => {
127
- const options: RadioOption[] = [
128
- { value: 'visa', label: 'Visa' },
129
- {
130
- value: 'mastercard',
131
- label: 'Mastercard',
132
- error: true,
133
- supportingText: 'This card is expired',
134
- },
135
- { value: 'amex', label: 'American Express' },
136
- {
137
- value: 'discover',
138
- label: 'Discover',
139
- error: true,
140
- supportingText: 'This card was declined',
141
- },
142
- ];
143
-
144
- const radio = document.createElement('rel-radio') as any;
145
- radio.options = options;
146
- radio.name = 'payment-radio';
147
- radio.selectedValue = null;
148
-
149
- return radio;
150
- },
151
- };
152
-
153
- /**
154
- * Payment method selection
155
- */
156
- export const PaymentMethods: Story = {
157
- render: () => {
158
- const options: RadioOption[] = [
159
- {
160
- value: 'credit-card',
161
- label: 'Credit Card',
162
- supportingText: 'Pay with Visa, Mastercard, or American Express',
163
- },
164
- {
165
- value: 'paypal',
166
- label: 'PayPal',
167
- supportingText: 'Fast and secure payment with your PayPal account',
168
- },
169
- {
170
- value: 'bank-transfer',
171
- label: 'Bank Transfer',
172
- supportingText: 'Direct transfer from your bank account',
173
- },
174
- {
175
- value: 'crypto',
176
- label: 'Cryptocurrency',
177
- supportingText: 'Pay with Bitcoin or Ethereum',
178
- disabled: true,
179
- },
180
- ];
181
-
182
- const radio = document.createElement('rel-radio') as any;
183
- radio.options = options;
184
- radio.name = 'payment-method';
185
- radio.selectedValue = 'credit-card';
186
-
187
- return radio;
188
- },
189
- };
190
-
191
- /**
192
- * Shipping options selection
193
- */
194
- export const ShippingOptions: Story = {
195
- render: () => {
196
- const options: RadioOption[] = [
197
- {
198
- value: 'standard',
199
- label: 'Standard Shipping - Free',
200
- supportingText: 'Delivery in 5-7 business days',
201
- },
202
- {
203
- value: 'express',
204
- label: 'Express Shipping - $9.99',
205
- supportingText: 'Delivery in 2-3 business days',
206
- },
207
- {
208
- value: 'overnight',
209
- label: 'Overnight Shipping - $24.99',
210
- supportingText: 'Next business day delivery',
211
- },
212
- ];
213
-
214
- const radio = document.createElement('rel-radio') as any;
215
- radio.options = options;
216
- radio.name = 'shipping';
217
- radio.selectedValue = 'standard';
218
-
219
- return radio;
220
- },
221
- };
222
-
223
- /**
224
- * Notification preferences
225
- */
226
- export const NotificationPreferences: Story = {
227
- render: () => {
228
- const options: RadioOption[] = [
229
- {
230
- value: 'all',
231
- label: 'All Notifications',
232
- supportingText: 'Receive all updates and announcements',
233
- },
234
- {
235
- value: 'important',
236
- label: 'Important Only',
237
- supportingText: 'Only critical updates and alerts',
238
- },
239
- {
240
- value: 'none',
241
- label: 'No Notifications',
242
- supportingText: 'Turn off all notifications',
243
- },
244
- ];
245
-
246
- const radio = document.createElement('rel-radio') as any;
247
- radio.options = options;
248
- radio.name = 'notifications';
249
- radio.selectedValue = 'important';
250
-
251
- return radio;
252
- },
253
- };
254
-
255
- /**
256
- * Survey question example
257
- */
258
- export const SurveyQuestion: Story = {
259
- render: () => html`
260
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
261
- <h3 style="margin: 0 0 8px; color: var(--rel-colors-gray-heading); font-size: 18px;">
262
- How satisfied are you with our service?
263
- </h3>
264
- <p style="margin: 0 0 20px; color: var(--rel-colors-gray-placeholder); font-size: 14px;">
265
- Please select one option below
266
- </p>
267
- ${(() => {
268
- const options: RadioOption[] = [
269
- {
270
- value: 'very-satisfied',
271
- label: 'Very Satisfied',
272
- supportingText: 'Exceeds my expectations',
273
- },
274
- {
275
- value: 'satisfied',
276
- label: 'Satisfied',
277
- supportingText: 'Meets my expectations',
278
- },
279
- {
280
- value: 'neutral',
281
- label: 'Neutral',
282
- supportingText: 'Neither satisfied nor dissatisfied',
283
- },
284
- {
285
- value: 'dissatisfied',
286
- label: 'Dissatisfied',
287
- supportingText: 'Below my expectations',
288
- },
289
- {
290
- value: 'very-dissatisfied',
291
- label: 'Very Dissatisfied',
292
- supportingText: 'Far below my expectations',
293
- },
294
- ];
295
-
296
- const radio = document.createElement('rel-radio') as any;
297
- radio.options = options;
298
- radio.name = 'satisfaction';
299
- radio.selectedValue = null;
300
-
301
- return radio;
302
- })()}
303
- </div>
304
- `,
305
- };
306
-
307
- /**
308
- * Account type selection
309
- */
310
- export const AccountType: Story = {
311
- render: () => html`
312
- <div style="max-width: 500px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
313
- <h3 style="margin: 0 0 8px; color: var(--rel-colors-gray-heading); font-size: 16px;">
314
- Select Account Type
315
- </h3>
316
- <p style="margin: 0 0 20px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
317
- Choose the type of account you want to create
318
- </p>
319
- ${(() => {
320
- const options: RadioOption[] = [
321
- {
322
- value: 'personal',
323
- label: 'Personal Account',
324
- supportingText: 'For individual use and personal projects',
325
- },
326
- {
327
- value: 'business',
328
- label: 'Business Account',
329
- supportingText: 'For companies and organizations',
330
- },
331
- {
332
- value: 'developer',
333
- label: 'Developer Account',
334
- supportingText: 'Access to APIs and advanced features',
335
- },
336
- ];
337
-
338
- const radio = document.createElement('rel-radio') as any;
339
- radio.options = options;
340
- radio.name = 'account-type';
341
- radio.selectedValue = 'personal';
342
-
343
- return radio;
344
- })()}
345
- </div>
346
- `,
347
- };
348
-
349
- /**
350
- * Form with multiple radio groups
351
- */
352
- export const MultipleGroups: Story = {
353
- render: () => html`
354
- <div style="max-width: 600px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
355
- <h3 style="margin: 0 0 20px; color: var(--rel-colors-gray-heading); font-size: 18px;">
356
- Product Feedback Form
357
- </h3>
358
-
359
- <div style="margin-bottom: 28px;">
360
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 15px;">
361
- How often do you use this product?
362
- </h4>
363
- ${(() => {
364
- const options: RadioOption[] = [
365
- { value: 'daily', label: 'Daily' },
366
- { value: 'weekly', label: 'Weekly' },
367
- { value: 'monthly', label: 'Monthly' },
368
- { value: 'rarely', label: 'Rarely' },
369
- ];
370
-
371
- const radio = document.createElement('rel-radio') as any;
372
- radio.options = options;
373
- radio.name = 'frequency';
374
- radio.selectedValue = 'daily';
375
-
376
- return radio;
377
- })()}
378
- </div>
379
-
380
- <div style="margin-bottom: 28px;">
381
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 15px;">
382
- Would you recommend this product?
383
- </h4>
384
- ${(() => {
385
- const options: RadioOption[] = [
386
- { value: 'yes', label: 'Yes, definitely' },
387
- { value: 'maybe', label: 'Maybe' },
388
- { value: 'no', label: 'No, not likely' },
389
- ];
390
-
391
- const radio = document.createElement('rel-radio') as any;
392
- radio.options = options;
393
- radio.name = 'recommend';
394
- radio.selectedValue = null;
395
-
396
- return radio;
397
- })()}
398
- </div>
399
-
400
- <div>
401
- <h4 style="margin: 0 0 12px; color: var(--rel-colors-gray-heading); font-size: 15px;">
402
- Rate the overall experience
403
- </h4>
404
- ${(() => {
405
- const options: RadioOption[] = [
406
- { value: '5', label: 'Excellent' },
407
- { value: '4', label: 'Good' },
408
- { value: '3', label: 'Average' },
409
- { value: '2', label: 'Poor' },
410
- { value: '1', label: 'Very Poor' },
411
- ];
412
-
413
- const radio = document.createElement('rel-radio') as any;
414
- radio.options = options;
415
- radio.name = 'rating';
416
- radio.selectedValue = '4';
417
-
418
- return radio;
419
- })()}
420
- </div>
421
- </div>
422
- `,
423
- };
424
-
425
- /**
426
- * All states showcase
427
- */
428
- export const AllStates: Story = {
429
- render: () => html`
430
- <div style="display: flex; flex-direction: column; gap: 32px;">
431
- <div>
432
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Default State</h4>
433
- ${(() => {
434
- const options: RadioOption[] = [
435
- { value: '1', label: 'Option 1' },
436
- { value: '2', label: 'Option 2' },
437
- { value: '3', label: 'Option 3' },
438
- ];
439
-
440
- const radio = document.createElement('rel-radio') as any;
441
- radio.options = options;
442
- radio.name = 'state-default';
443
- radio.selectedValue = '2';
444
-
445
- return radio;
446
- })()}
447
- </div>
448
-
449
- <div>
450
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">With Supporting Text</h4>
451
- ${(() => {
452
- const options: RadioOption[] = [
453
- { value: '1', label: 'Option 1', supportingText: 'Helper text for option 1' },
454
- { value: '2', label: 'Option 2', supportingText: 'Helper text for option 2' },
455
- ];
456
-
457
- const radio = document.createElement('rel-radio') as any;
458
- radio.options = options;
459
- radio.name = 'state-supporting';
460
- radio.selectedValue = '1';
461
-
462
- return radio;
463
- })()}
464
- </div>
465
-
466
- <div>
467
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Disabled State</h4>
468
- ${(() => {
469
- const options: RadioOption[] = [
470
- { value: '1', label: 'Enabled Option' },
471
- { value: '2', label: 'Disabled Option', disabled: true },
472
- { value: '3', label: 'Disabled Selected', disabled: true },
473
- ];
474
-
475
- const radio = document.createElement('rel-radio') as any;
476
- radio.options = options;
477
- radio.name = 'state-disabled';
478
- radio.selectedValue = '3';
479
-
480
- return radio;
481
- })()}
482
- </div>
483
-
484
- <div>
485
- <h4 style="margin: 0 0 16px; color: var(--rel-colors-gray-heading); font-size: 16px;">Error State</h4>
486
- ${(() => {
487
- const options: RadioOption[] = [
488
- { value: '1', label: 'Valid Option' },
489
- {
490
- value: '2',
491
- label: 'Error Option',
492
- error: true,
493
- supportingText: 'This option has an error',
494
- },
495
- ];
496
-
497
- const radio = document.createElement('rel-radio') as any;
498
- radio.options = options;
499
- radio.name = 'state-error';
500
- radio.selectedValue = null;
501
-
502
- return radio;
503
- })()}
504
- </div>
505
- </div>
506
- `,
507
- };
508
-
509
- /**
510
- * Two options - Binary choice
511
- */
512
- export const TwoOptions: Story = {
513
- render: () => html`
514
- <div style="max-width: 500px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
515
- <h3 style="margin: 0 0 8px; color: var(--rel-colors-gray-heading); font-size: 16px;">
516
- Enable Two-Factor Authentication
517
- </h3>
518
- <p style="margin: 0 0 20px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
519
- Add an extra layer of security to your account
520
- </p>
521
- ${(() => {
522
- const options: RadioOption[] = [
523
- {
524
- value: 'enable',
525
- label: 'Enable 2FA',
526
- supportingText: 'Recommended for account security',
527
- },
528
- {
529
- value: 'disable',
530
- label: 'Keep Disabled',
531
- supportingText: 'Continue with password only',
532
- },
533
- ];
534
-
535
- const radio = document.createElement('rel-radio') as any;
536
- radio.options = options;
537
- radio.name = 'two-factor';
538
- radio.selectedValue = 'enable';
539
-
540
- return radio;
541
- })()}
542
- </div>
543
- `,
544
- };
545
-
546
- /**
547
- * Four options - Size selection
548
- */
549
- export const FourOptions: Story = {
550
- render: () => html`
551
- <div style="max-width: 500px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
552
- <h3 style="margin: 0 0 8px; color: var(--rel-colors-gray-heading); font-size: 16px;">
553
- Select T-Shirt Size
554
- </h3>
555
- <p style="margin: 0 0 20px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
556
- Choose your preferred size
557
- </p>
558
- ${(() => {
559
- const options: RadioOption[] = [
560
- { value: 'small', label: 'Small (S)', supportingText: 'Chest: 34-36"' },
561
- { value: 'medium', label: 'Medium (M)', supportingText: 'Chest: 38-40"' },
562
- { value: 'large', label: 'Large (L)', supportingText: 'Chest: 42-44"' },
563
- { value: 'xlarge', label: 'Extra Large (XL)', supportingText: 'Chest: 46-48"' },
564
- ];
565
-
566
- const radio = document.createElement('rel-radio') as any;
567
- radio.options = options;
568
- radio.name = 'tshirt-size';
569
- radio.selectedValue = 'medium';
570
-
571
- return radio;
572
- })()}
573
- </div>
574
- `,
575
- };
576
-
577
- /**
578
- * Six options - Priority levels
579
- */
580
- export const SixOptions: Story = {
581
- render: () => html`
582
- <div style="max-width: 550px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
583
- <h3 style="margin: 0 0 8px; color: var(--rel-colors-gray-heading); font-size: 16px;">
584
- Issue Priority Level
585
- </h3>
586
- <p style="margin: 0 0 20px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
587
- Set the priority for this support ticket
588
- </p>
589
- ${(() => {
590
- const options: RadioOption[] = [
591
- { value: 'critical', label: 'Critical', supportingText: 'System down, major impact on business' },
592
- { value: 'high', label: 'High', supportingText: 'Significant feature broken, workaround available' },
593
- { value: 'medium', label: 'Medium', supportingText: 'Feature issue, moderate impact' },
594
- { value: 'low', label: 'Low', supportingText: 'Minor issue, limited impact' },
595
- { value: 'minimal', label: 'Minimal', supportingText: 'Cosmetic issue or enhancement request' },
596
- { value: 'question', label: 'Question', supportingText: 'General inquiry or how-to question' },
597
- ];
598
-
599
- const radio = document.createElement('rel-radio') as any;
600
- radio.options = options;
601
- radio.name = 'priority';
602
- radio.selectedValue = null;
603
-
604
- return radio;
605
- })()}
606
- </div>
607
- `,
608
- };
609
-
610
- /**
611
- * Pre-selected value - User preference
612
- */
613
- export const PreselectedValue: Story = {
614
- render: () => html`
615
- <div style="max-width: 500px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
616
- <h3 style="margin: 0 0 8px; color: var(--rel-colors-gray-heading); font-size: 16px;">
617
- Default Language
618
- </h3>
619
- <p style="margin: 0 0 20px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
620
- Your current preference is pre-selected
621
- </p>
622
- ${(() => {
623
- const options: RadioOption[] = [
624
- { value: 'en', label: 'English', supportingText: 'Default language' },
625
- { value: 'es', label: 'Spanish', supportingText: 'Español' },
626
- { value: 'fr', label: 'French', supportingText: 'Français' },
627
- { value: 'de', label: 'German', supportingText: 'Deutsch' },
628
- { value: 'ja', label: 'Japanese', supportingText: '日本語' },
629
- ];
630
-
631
- const radio = document.createElement('rel-radio') as any;
632
- radio.options = options;
633
- radio.name = 'language';
634
- radio.selectedValue = 'en'; // Pre-selected
635
-
636
- return radio;
637
- })()}
638
- </div>
639
- `,
640
- };
641
-
642
- /**
643
- * Mixed states - Disabled and error options
644
- */
645
- export const MixedStates: Story = {
646
- render: () => html`
647
- <div style="max-width: 550px; background: white; padding: 24px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-200);">
648
- <h3 style="margin: 0 0 8px; color: var(--rel-colors-gray-heading); font-size: 16px;">
649
- Select Backup Storage
650
- </h3>
651
- <p style="margin: 0 0 20px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
652
- Choose where to store your backups
653
- </p>
654
- ${(() => {
655
- const options: RadioOption[] = [
656
- {
657
- value: 'local',
658
- label: 'Local Storage',
659
- supportingText: 'Store backups on this device',
660
- },
661
- {
662
- value: 'cloud',
663
- label: 'Cloud Storage',
664
- supportingText: 'Secure cloud backup with encryption',
665
- },
666
- {
667
- value: 'external',
668
- label: 'External Drive',
669
- disabled: true,
670
- supportingText: 'No external drive detected',
671
- },
672
- {
673
- value: 'network',
674
- label: 'Network Storage',
675
- error: true,
676
- supportingText: 'Connection failed - check network settings',
677
- },
678
- {
679
- value: 'ftp',
680
- label: 'FTP Server',
681
- disabled: true,
682
- supportingText: 'Feature coming soon',
683
- },
684
- ];
685
-
686
- const radio = document.createElement('rel-radio') as any;
687
- radio.options = options;
688
- radio.name = 'backup-storage';
689
- radio.selectedValue = 'cloud';
690
-
691
- return radio;
692
- })()}
693
- </div>
694
- `,
695
- };
696
-
697
- /**
698
- * Registration form - Complete form example
699
- */
700
- export const RegistrationForm: Story = {
701
- render: () => html`
702
- <div style="max-width: 650px; background: white; padding: 32px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-300);">
703
- <h2 style="margin: 0 0 8px; color: var(--rel-colors-gray-heading); font-size: 24px;">
704
- Event Registration
705
- </h2>
706
- <p style="margin: 0 0 32px; color: var(--rel-colors-gray-placeholder); font-size: 14px;">
707
- Please complete all fields to register for the conference
708
- </p>
709
-
710
- <div style="margin-bottom: 28px;">
711
- <label style="display: block; margin-bottom: 12px; color: var(--rel-colors-gray-heading); font-size: 14px; font-weight: 500;">
712
- Attendance Type *
713
- </label>
714
- ${(() => {
715
- const options: RadioOption[] = [
716
- {
717
- value: 'in-person',
718
- label: 'In-Person Attendance',
719
- supportingText: 'Join us at the venue - includes meals and materials',
720
- },
721
- {
722
- value: 'virtual',
723
- label: 'Virtual Attendance',
724
- supportingText: 'Stream live from anywhere - receive digital materials',
725
- },
726
- {
727
- value: 'hybrid',
728
- label: 'Hybrid Access',
729
- supportingText: 'Attend select sessions in-person, others virtually',
730
- disabled: true,
731
- },
732
- ];
733
-
734
- const radio = document.createElement('rel-radio') as any;
735
- radio.options = options;
736
- radio.name = 'attendance-type';
737
- radio.selectedValue = 'in-person';
738
-
739
- return radio;
740
- })()}
741
- </div>
742
-
743
- <div style="margin-bottom: 28px;">
744
- <label style="display: block; margin-bottom: 12px; color: var(--rel-colors-gray-heading); font-size: 14px; font-weight: 500;">
745
- Ticket Type *
746
- </label>
747
- ${(() => {
748
- const options: RadioOption[] = [
749
- {
750
- value: 'early-bird',
751
- label: 'Early Bird - $299',
752
- supportingText: 'Save $100 - Limited time offer ends March 15',
753
- },
754
- {
755
- value: 'standard',
756
- label: 'Standard - $399',
757
- supportingText: 'Regular admission price',
758
- },
759
- {
760
- value: 'vip',
761
- label: 'VIP Pass - $599',
762
- supportingText: 'Premium seating, exclusive networking events, and swag bag',
763
- },
764
- {
765
- value: 'student',
766
- label: 'Student - $199',
767
- supportingText: 'Valid student ID required at check-in',
768
- },
769
- ];
770
-
771
- const radio = document.createElement('rel-radio') as any;
772
- radio.options = options;
773
- radio.name = 'ticket-type';
774
- radio.selectedValue = 'early-bird';
775
-
776
- return radio;
777
- })()}
778
- </div>
779
-
780
- <div style="margin-bottom: 28px;">
781
- <label style="display: block; margin-bottom: 12px; color: var(--rel-colors-gray-heading); font-size: 14px; font-weight: 500;">
782
- Dietary Restrictions
783
- </label>
784
- ${(() => {
785
- const options: RadioOption[] = [
786
- { value: 'none', label: 'No Restrictions' },
787
- { value: 'vegetarian', label: 'Vegetarian', supportingText: 'Plant-based options' },
788
- { value: 'vegan', label: 'Vegan', supportingText: 'No animal products' },
789
- { value: 'gluten-free', label: 'Gluten-Free', supportingText: 'Celiac-friendly meals' },
790
- { value: 'other', label: 'Other', supportingText: 'Please specify in additional notes' },
791
- ];
792
-
793
- const radio = document.createElement('rel-radio') as any;
794
- radio.options = options;
795
- radio.name = 'dietary';
796
- radio.selectedValue = 'none';
797
-
798
- return radio;
799
- })()}
800
- </div>
801
-
802
- <button style="
803
- width: 100%;
804
- padding: 12px 24px;
805
- background: var(--rel-colors-black);
806
- color: white;
807
- border: none;
808
- border-radius: 8px;
809
- font-size: 16px;
810
- font-weight: 500;
811
- cursor: pointer;
812
- margin-top: 12px;
813
- ">
814
- Complete Registration
815
- </button>
816
- </div>
817
- `,
818
- };
819
-
820
- /**
821
- * Settings panel - Multiple radio groups in context
822
- */
823
- export const SettingsPanel: Story = {
824
- render: () => html`
825
- <div style="max-width: 700px; background: white; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-300);">
826
- <div style="padding: 24px; border-bottom: 1px solid #e5e7eb;">
827
- <h2 style="margin: 0; color: var(--rel-colors-gray-heading); font-size: 20px;">
828
- Application Settings
829
- </h2>
830
- </div>
831
-
832
- <div style="padding: 24px;">
833
- <div style="margin-bottom: 32px;">
834
- <h3 style="margin: 0 0 6px; color: var(--rel-colors-gray-heading); font-size: 16px;">
835
- Theme Preference
836
- </h3>
837
- <p style="margin: 0 0 16px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
838
- Choose your preferred color scheme
839
- </p>
840
- ${(() => {
841
- const options: RadioOption[] = [
842
- { value: 'light', label: 'Light Mode', supportingText: 'Classic bright interface' },
843
- { value: 'dark', label: 'Dark Mode', supportingText: 'Easier on the eyes in low light' },
844
- { value: 'auto', label: 'Auto', supportingText: 'Match system preference' },
845
- ];
846
-
847
- const radio = document.createElement('rel-radio') as any;
848
- radio.options = options;
849
- radio.name = 'theme';
850
- radio.selectedValue = 'auto';
851
-
852
- return radio;
853
- })()}
854
- </div>
855
-
856
- <div style="margin-bottom: 32px;">
857
- <h3 style="margin: 0 0 6px; color: var(--rel-colors-gray-heading); font-size: 16px;">
858
- Data Sync Frequency
859
- </h3>
860
- <p style="margin: 0 0 16px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
861
- How often should we sync your data?
862
- </p>
863
- ${(() => {
864
- const options: RadioOption[] = [
865
- { value: 'realtime', label: 'Real-time', supportingText: 'Instant updates (higher battery usage)' },
866
- { value: '15min', label: 'Every 15 minutes', supportingText: 'Balanced performance' },
867
- { value: 'hourly', label: 'Hourly', supportingText: 'Better battery life' },
868
- { value: 'manual', label: 'Manual Only', supportingText: 'Sync when you choose' },
869
- ];
870
-
871
- const radio = document.createElement('rel-radio') as any;
872
- radio.options = options;
873
- radio.name = 'sync-frequency';
874
- radio.selectedValue = '15min';
875
-
876
- return radio;
877
- })()}
878
- </div>
879
-
880
- <div style="margin-bottom: 32px;">
881
- <h3 style="margin: 0 0 6px; color: var(--rel-colors-gray-heading); font-size: 16px;">
882
- Privacy Level
883
- </h3>
884
- <p style="margin: 0 0 16px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
885
- Control what data is collected
886
- </p>
887
- ${(() => {
888
- const options: RadioOption[] = [
889
- {
890
- value: 'minimal',
891
- label: 'Minimal',
892
- supportingText: 'Only essential data for core functionality',
893
- },
894
- {
895
- value: 'standard',
896
- label: 'Standard',
897
- supportingText: 'Basic analytics to improve the service',
898
- },
899
- {
900
- value: 'full',
901
- label: 'Full',
902
- supportingText: 'Detailed analytics for personalized experience',
903
- },
904
- ];
905
-
906
- const radio = document.createElement('rel-radio') as any;
907
- radio.options = options;
908
- radio.name = 'privacy';
909
- radio.selectedValue = 'standard';
910
-
911
- return radio;
912
- })()}
913
- </div>
914
-
915
- <div>
916
- <h3 style="margin: 0 0 6px; color: var(--rel-colors-gray-heading); font-size: 16px;">
917
- Default View
918
- </h3>
919
- <p style="margin: 0 0 16px; color: var(--rel-colors-gray-placeholder); font-size: 13px;">
920
- What should you see when opening the app?
921
- </p>
922
- ${(() => {
923
- const options: RadioOption[] = [
924
- { value: 'dashboard', label: 'Dashboard', supportingText: 'Overview of all activities' },
925
- { value: 'inbox', label: 'Inbox', supportingText: 'Start with your messages' },
926
- { value: 'calendar', label: 'Calendar', supportingText: 'View your schedule' },
927
- { value: 'tasks', label: 'Tasks', supportingText: 'See pending to-dos' },
928
- {
929
- value: 'analytics',
930
- label: 'Analytics',
931
- supportingText: 'View reports and insights',
932
- disabled: true,
933
- },
934
- ];
935
-
936
- const radio = document.createElement('rel-radio') as any;
937
- radio.options = options;
938
- radio.name = 'default-view';
939
- radio.selectedValue = 'dashboard';
940
-
941
- return radio;
942
- })()}
943
- </div>
944
- </div>
945
-
946
- <div style="padding: 16px 24px; background: #f9fafb; border-top: 1px solid #e5e7eb; display: flex; justify-content: flex-end; gap: 12px; border-radius: 0 0 12px 12px;">
947
- <button style="
948
- padding: 8px 16px;
949
- background: white;
950
- color: var(--rel-colors-gray-heading);
951
- border: 1px solid #d1d5db;
952
- border-radius: 6px;
953
- font-size: 14px;
954
- cursor: pointer;
955
- ">
956
- Cancel
957
- </button>
958
- <button style="
959
- padding: 8px 16px;
960
- background: var(--rel-colors-black);
961
- color: white;
962
- border: none;
963
- border-radius: 6px;
964
- font-size: 14px;
965
- cursor: pointer;
966
- ">
967
- Save Settings
968
- </button>
969
- </div>
970
- </div>
971
- `,
972
- };
973
-
974
- /**
975
- * Subscription plan selector
976
- */
977
- export const SubscriptionPlans: Story = {
978
- render: () => html`
979
- <div style="max-width: 600px; background: white; padding: 32px; border-radius: 12px; box-shadow: var(--rel-shadows-shadow-300);">
980
- <h2 style="margin: 0 0 8px; color: var(--rel-colors-gray-heading); font-size: 22px; text-align: center;">
981
- Choose Your Plan
982
- </h2>
983
- <p style="margin: 0 0 32px; color: var(--rel-colors-gray-placeholder); font-size: 14px; text-align: center;">
984
- Select the subscription that best fits your needs
985
- </p>
986
-
987
- ${(() => {
988
- const options: RadioOption[] = [
989
- {
990
- value: 'free',
991
- label: 'Free - $0/month',
992
- supportingText: '5 projects, 100MB storage, community support',
993
- },
994
- {
995
- value: 'starter',
996
- label: 'Starter - $9/month',
997
- supportingText: '20 projects, 5GB storage, email support, basic analytics',
998
- },
999
- {
1000
- value: 'professional',
1001
- label: 'Professional - $29/month',
1002
- supportingText: 'Unlimited projects, 50GB storage, priority support, advanced analytics, API access',
1003
- },
1004
- {
1005
- value: 'team',
1006
- label: 'Team - $79/month',
1007
- supportingText: 'Everything in Pro + 5 team members, 200GB storage, dedicated support, SSO',
1008
- },
1009
- {
1010
- value: 'enterprise',
1011
- label: 'Enterprise - Custom Pricing',
1012
- supportingText: 'Custom solutions, unlimited storage, SLA, dedicated account manager',
1013
- },
1014
- ];
1015
-
1016
- const radio = document.createElement('rel-radio') as any;
1017
- radio.options = options;
1018
- radio.name = 'subscription-plan';
1019
- radio.selectedValue = 'professional';
1020
-
1021
- radio.addEventListener('changed', (e: CustomEvent) => {
1022
- console.log('Selected plan:', e.detail.value);
1023
- });
1024
-
1025
- return radio;
1026
- })()}
1027
-
1028
- <div style="margin-top: 28px; padding-top: 24px; border-top: 1px solid #e5e7eb;">
1029
- <button style="
1030
- width: 100%;
1031
- padding: 14px 24px;
1032
- background: var(--rel-colors-black);
1033
- color: white;
1034
- border: none;
1035
- border-radius: 8px;
1036
- font-size: 16px;
1037
- font-weight: 500;
1038
- cursor: pointer;
1039
- ">
1040
- Continue to Payment
1041
- </button>
1042
- <p style="margin: 12px 0 0; text-align: center; color: var(--rel-colors-gray-placeholder); font-size: 12px;">
1043
- You can cancel or change your plan anytime
1044
- </p>
1045
- </div>
1046
- </div>
1047
- `,
1048
- };