@flightlesslabs/dodo-ui 0.22.1 → 0.23.0

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 (74) hide show
  1. package/README.md +1 -9
  2. package/dist/index.d.ts +4 -0
  3. package/dist/index.js +4 -0
  4. package/package.json +25 -35
  5. package/src/lib/index.ts +5 -0
  6. package/src/lib/utils/time/date-creator/createDate/createDate.test.ts +109 -0
  7. package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.test.ts +146 -0
  8. package/dist/Home.mdx +0 -69
  9. package/dist/components/Form/Button/Button.stories.svelte +0 -178
  10. package/dist/components/Form/Button/Button.stories.svelte.d.ts +0 -22
  11. package/dist/components/Form/Checkbox/Checkbox.stories.svelte +0 -132
  12. package/dist/components/Form/Checkbox/Checkbox.stories.svelte.d.ts +0 -25
  13. package/dist/components/Form/DatePicker/DatePicker.stories.svelte +0 -139
  14. package/dist/components/Form/DatePicker/DatePicker.stories.svelte.d.ts +0 -22
  15. package/dist/components/Form/FormField/FormField.stories.svelte +0 -48
  16. package/dist/components/Form/FormField/FormField.stories.svelte.d.ts +0 -25
  17. package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte +0 -166
  18. package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte.d.ts +0 -22
  19. package/dist/components/Form/Label/Label.stories.svelte +0 -31
  20. package/dist/components/Form/Label/Label.stories.svelte.d.ts +0 -25
  21. package/dist/components/Form/RadioGroup/Radio/Radio.stories.svelte +0 -78
  22. package/dist/components/Form/RadioGroup/Radio/Radio.stories.svelte.d.ts +0 -25
  23. package/dist/components/Form/RadioGroup/RadioGroup.stories.svelte +0 -172
  24. package/dist/components/Form/RadioGroup/RadioGroup.stories.svelte.d.ts +0 -25
  25. package/dist/components/Form/Select/Select.stories.svelte +0 -175
  26. package/dist/components/Form/Select/Select.stories.svelte.d.ts +0 -22
  27. package/dist/components/Form/Switch/Switch.stories.svelte +0 -128
  28. package/dist/components/Form/Switch/Switch.stories.svelte.d.ts +0 -25
  29. package/dist/components/Form/TextInput/TextInput.stories.svelte +0 -162
  30. package/dist/components/Form/TextInput/TextInput.stories.svelte.d.ts +0 -22
  31. package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte +0 -163
  32. package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte.d.ts +0 -22
  33. package/dist/components/Info/Calendar/Calendar.stories.svelte +0 -134
  34. package/dist/components/Info/Calendar/Calendar.stories.svelte.d.ts +0 -22
  35. package/dist/components/Layout/Card/Card.stories.svelte +0 -113
  36. package/dist/components/Layout/Card/Card.stories.svelte.d.ts +0 -22
  37. package/dist/components/Layout/Grid/Column/Column.stories.svelte +0 -66
  38. package/dist/components/Layout/Grid/Column/Column.stories.svelte.d.ts +0 -22
  39. package/dist/components/Layout/Grid/Grid.stories.svelte +0 -192
  40. package/dist/components/Layout/Grid/Grid.stories.svelte.d.ts +0 -22
  41. package/dist/components/Layout/Grid/Row/Row.stories.svelte +0 -39
  42. package/dist/components/Layout/Grid/Row/Row.stories.svelte.d.ts +0 -22
  43. package/dist/components/Layout/Theme/Theme.stories.svelte +0 -54
  44. package/dist/components/Layout/Theme/Theme.stories.svelte.d.ts +0 -25
  45. package/dist/components/Layout/Theme/ThemeSystem/index.mdx +0 -35
  46. package/dist/storybook-types.d.ts +0 -129
  47. package/dist/storybook-types.js +0 -1
  48. package/dist/utils/time/date-creator/createDate/createDate.mdx +0 -98
  49. package/dist/utils/time/date-creator/createDateFactory/createDateFactory.mdx +0 -104
  50. package/dist/utils/time/timeout/timeout.mdx +0 -114
  51. package/src/lib/Home.mdx +0 -69
  52. package/src/lib/components/Form/Button/Button.stories.svelte +0 -178
  53. package/src/lib/components/Form/Checkbox/Checkbox.stories.svelte +0 -132
  54. package/src/lib/components/Form/DatePicker/DatePicker.stories.svelte +0 -139
  55. package/src/lib/components/Form/FormField/FormField.stories.svelte +0 -48
  56. package/src/lib/components/Form/InputEnclosure/InputEnclosure.stories.svelte +0 -166
  57. package/src/lib/components/Form/Label/Label.stories.svelte +0 -31
  58. package/src/lib/components/Form/RadioGroup/Radio/Radio.stories.svelte +0 -78
  59. package/src/lib/components/Form/RadioGroup/RadioGroup.stories.svelte +0 -172
  60. package/src/lib/components/Form/Select/Select.stories.svelte +0 -175
  61. package/src/lib/components/Form/Switch/Switch.stories.svelte +0 -128
  62. package/src/lib/components/Form/TextInput/TextInput.stories.svelte +0 -162
  63. package/src/lib/components/Form/UtilityButton/UtilityButton.stories.svelte +0 -163
  64. package/src/lib/components/Info/Calendar/Calendar.stories.svelte +0 -134
  65. package/src/lib/components/Layout/Card/Card.stories.svelte +0 -113
  66. package/src/lib/components/Layout/Grid/Column/Column.stories.svelte +0 -66
  67. package/src/lib/components/Layout/Grid/Grid.stories.svelte +0 -192
  68. package/src/lib/components/Layout/Grid/Row/Row.stories.svelte +0 -39
  69. package/src/lib/components/Layout/Theme/Theme.stories.svelte +0 -54
  70. package/src/lib/components/Layout/Theme/ThemeSystem/index.mdx +0 -35
  71. package/src/lib/storybook-types.ts +0 -182
  72. package/src/lib/utils/time/date-creator/createDate/createDate.mdx +0 -98
  73. package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.mdx +0 -104
  74. package/src/lib/utils/time/timeout/timeout.mdx +0 -114
@@ -1,139 +0,0 @@
1
- <script module lang="ts">
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import DatePicker from './DatePicker.svelte';
4
- import type { DatePickerProps } from './DatePicker.svelte';
5
- import type { ArgTypes } from 'storybook/internal/csf';
6
-
7
- import { componentSizeOptions } from '$lib/attributes/size.js';
8
- import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
9
- import { CalendarDate, type DateValue } from '@internationalized/date';
10
- import Theme from '$lib/components/Layout/Theme/Theme.svelte';
11
-
12
- const description = `
13
- A sleek, plug and play Date Picker based on bits-ui [date-picker](https://bits-ui.com/docs/components/date-picker).
14
- \`\`\`ts
15
- import { DatePicker } from '@flightlesslabs/dodo-ui';
16
-
17
- import { CalendarDate, type DateValue } from '@internationalized/date';
18
- \`\`\`
19
- `;
20
-
21
- // ------------------------------
22
- // Storybook ArgTypes
23
- // ------------------------------
24
- export const storyDatePickerArgTypes: Partial<ArgTypes<DatePickerProps>> = {
25
- // ------------------------------
26
- // Core
27
- // ------------------------------
28
- class: { table: { category: 'API', subcategory: 'Base' } },
29
- value: {
30
- control: { type: 'text' },
31
- table: { category: 'API', subcategory: 'Base' },
32
- },
33
- dateFormat: {
34
- control: { type: 'text' },
35
- table: { category: 'API', subcategory: 'Base', defaultValue: { summary: 'dd/mm/yyyy' } },
36
- },
37
-
38
- // ------------------------------
39
- // State
40
- // ------------------------------
41
- disabled: {
42
- control: { type: 'boolean' },
43
- description: 'Disabled state of the input',
44
- table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
45
- },
46
- focused: {
47
- control: { type: 'boolean' },
48
- description: 'Force focused visual state',
49
- table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
50
- },
51
- error: {
52
- control: { type: 'boolean' },
53
- description: 'Error visual state',
54
- table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
55
- },
56
-
57
- // ------------------------------
58
- // Appearance
59
- // ------------------------------
60
- size: {
61
- control: { type: 'select' },
62
- options: componentSizeOptions,
63
- description: 'Visual size token',
64
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'normal' } },
65
- },
66
- roundness: {
67
- control: { type: 'select' },
68
- options: componentRoundnessOptions,
69
- description: 'Border radius token',
70
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: '1' } },
71
- },
72
- outline: {
73
- control: { type: 'boolean' },
74
- description: 'Render outlined enclosure',
75
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'true' } },
76
- },
77
-
78
- // ------------------------------
79
- // Slots (Snippets)
80
- // ------------------------------
81
- before: {
82
- table: { category: 'API', subcategory: 'Slots' },
83
- description: 'Content rendered before the input',
84
- },
85
- after: {
86
- table: { category: 'API', subcategory: 'Slots' },
87
- description: 'Content rendered after the input',
88
- },
89
- };
90
-
91
- // ------------------------------
92
- // Storybook Meta
93
- // ------------------------------
94
- const { Story } = defineMeta({
95
- component: DatePicker,
96
- tags: ['autodocs'],
97
- argTypes: storyDatePickerArgTypes,
98
- parameters: {
99
- docs: {
100
- description: {
101
- component: description,
102
- },
103
- story: { height: '420px' },
104
- },
105
- },
106
- });
107
-
108
- let myValue = $state<DateValue>(new CalendarDate(2026, 4, 7));
109
- </script>
110
-
111
- <!-- ------------------------------ -->
112
- <!-- Stories -->
113
- <!-- ------------------------------ -->
114
-
115
- <Story name="Default" />
116
-
117
- <Story name="Controlled" asChild>
118
- <DatePicker bind:value={myValue} />
119
- </Story>
120
-
121
- <Story name="Starts On Sunday" args={{ weekStartsOn: 0 }} />
122
-
123
- <Story name="Date Format" args={{ dateFormat: 'mm/dd/yyyy' }} />
124
-
125
- <Story name="Min Date" args={{ minValue: new CalendarDate(2026, 4, 7) }} />
126
-
127
- <Story name="Max Date" args={{ maxValue: new CalendarDate(2026, 4, 7) }} />
128
-
129
- <Story name="Light Theme" asChild>
130
- <Theme type="light">
131
- <DatePicker />
132
- </Theme>
133
- </Story>
134
-
135
- <Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
136
- <Theme type="dark">
137
- <DatePicker />
138
- </Theme>
139
- </Story>
@@ -1,48 +0,0 @@
1
- <script module lang="ts">
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import FormField from './FormField.svelte';
4
- import type { FormFieldProps } from './FormField.svelte';
5
- import type { ArgTypes } from 'storybook/internal/csf';
6
- import TextInput from '../TextInput/TextInput.svelte';
7
-
8
- const description = `
9
- a form control for input tags and more.
10
- \`\`\`ts
11
- import { FormField } from '@flightlesslabs/dodo-ui';
12
- \`\`\`
13
- `;
14
-
15
- /**
16
- * Storybook controls for FormField
17
- */
18
- export const FormFieldArgTypes: Partial<ArgTypes<FormFieldProps>> = {
19
- class: { table: { category: 'API', subcategory: 'Base' } },
20
- label: {
21
- table: { category: 'API', subcategory: 'Base' },
22
- },
23
- for: {
24
- table: { category: 'API', subcategory: 'Base' },
25
- },
26
- };
27
-
28
- const { Story } = defineMeta({
29
- component: FormField,
30
- tags: ['autodocs'],
31
- argTypes: FormFieldArgTypes,
32
- parameters: {
33
- docs: {
34
- description: {
35
- component: description,
36
- },
37
- },
38
- },
39
- });
40
- </script>
41
-
42
- <!-- ------------------------------ -->
43
- <!-- Stories -->
44
- <!-- ------------------------------ -->
45
-
46
- <Story name="Defualt" args={{ label: 'Name:', for: 'name' }}>
47
- <TextInput placeholder="Type something…" name="name" />
48
- </Story>
@@ -1,166 +0,0 @@
1
- <script module lang="ts">
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import InputEnclosure from './InputEnclosure.svelte';
4
- import type { InputEnclosureProps } from './InputEnclosure.svelte';
5
- import type { ArgTypes } from 'storybook/internal/csf';
6
-
7
- import { componentSizeOptions } from '$lib/attributes/size.js';
8
- import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
9
- import Theme from '$lib/components/Layout/Theme/Theme.svelte';
10
-
11
- const description = `
12
- An extensive wrappwer for input boxes.
13
-
14
- \`\`\`ts
15
- import { InputEnclosure } from '@flightlesslabs/dodo-ui';
16
-
17
- // apply 'InputBox' class to the input
18
- <input class="InputBox" />
19
- \`\`\`
20
- `;
21
-
22
- // ------------------------------
23
- // Storybook ArgTypes
24
- // ------------------------------
25
- export const storyInputEnclosureArgTypes: Partial<ArgTypes<InputEnclosureProps>> = {
26
- // ------------------------------
27
- // Core
28
- // ------------------------------
29
- children: {
30
- control: { type: 'text' },
31
- description: 'InputEnclosure contents (typically an input or control)',
32
- table: { category: 'API', subcategory: 'Base' },
33
- },
34
- before: {
35
- description:
36
- 'Content rendered before the input (prefix). Provided via {#snippet before} in Svelte.',
37
- table: { category: 'API', subcategory: 'Base' },
38
- },
39
- after: {
40
- description:
41
- 'Content rendered after the input (suffix). Provided via {#snippet after} in Svelte.',
42
- table: { category: 'API', subcategory: 'Base' },
43
- },
44
- class: { table: { category: 'API', subcategory: 'Base' } },
45
-
46
- // ------------------------------
47
- // State
48
- // ------------------------------
49
- disabled: {
50
- control: { type: 'boolean' },
51
- description: 'Disabled visual state',
52
- table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
53
- },
54
- focused: {
55
- control: { type: 'boolean' },
56
- description: 'Focused visual state (wrapper-level)',
57
- table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
58
- },
59
- error: {
60
- control: { type: 'boolean' },
61
- description: 'Error visual state (validation)',
62
- table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
63
- },
64
-
65
- // ------------------------------
66
- // Appearance
67
- // ------------------------------
68
- size: {
69
- control: { type: 'select' },
70
- options: componentSizeOptions,
71
- description: 'Visual size token',
72
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'normal' } },
73
- },
74
- roundness: {
75
- control: { type: 'select' },
76
- options: componentRoundnessOptions,
77
- description: 'Border radius token',
78
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: '1' } },
79
- },
80
- outline: {
81
- control: { type: 'boolean' },
82
- description: 'Render outlined enclosure',
83
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'true' } },
84
- },
85
- };
86
-
87
- // ------------------------------
88
- // Storybook Meta
89
- // ------------------------------
90
- const { Story } = defineMeta({
91
- component: InputEnclosure,
92
- tags: ['autodocs'],
93
- argTypes: storyInputEnclosureArgTypes,
94
- parameters: {
95
- docs: {
96
- description: {
97
- component: description,
98
- },
99
- },
100
- },
101
- });
102
- </script>
103
-
104
- <!-- ------------------------------ -->
105
- <!-- Stories -->
106
- <!-- ------------------------------ -->
107
-
108
- <Story name="Default">
109
- <input placeholder="Type something…" class="InputBox" />
110
- </Story>
111
-
112
- <Story name="No Outline" args={{ outline: false }}>
113
- <input placeholder="No outline…" class="InputBox" />
114
- </Story>
115
-
116
- <Story name="Focused" args={{ focused: true }}>
117
- <input placeholder="Focused state…" class="InputBox" />
118
- </Story>
119
-
120
- <Story name="Error" args={{ error: true }}>
121
- <input placeholder="Error state…" class="InputBox" />
122
- </Story>
123
-
124
- <Story name="Disabled" args={{ disabled: true }}>
125
- <input placeholder="Disabled state…" disabled class="InputBox" />
126
- </Story>
127
-
128
- <Story name="Large" args={{ size: 'large' }}>
129
- <input placeholder="Large input…" class="InputBox" />
130
- </Story>
131
-
132
- <Story name="With Before (Icon Prefix)" asChild>
133
- <InputEnclosure>
134
- {#snippet before()}
135
- <span style="color: #888; padding-left: 8px">🔍</span>
136
- {/snippet}
137
-
138
- <input placeholder="Search…" class="InputBox" />
139
- </InputEnclosure>
140
- </Story>
141
-
142
- <Story name="With After (Suffix Text)" asChild>
143
- <InputEnclosure>
144
- {#snippet after()}
145
- <span style="color: #888; padding-right: 8px">.com</span>
146
- {/snippet}
147
-
148
- <input placeholder="Website" class="InputBox" />
149
- </InputEnclosure>
150
- </Story>
151
-
152
- <Story name="Light Theme" asChild>
153
- <Theme type="light">
154
- <InputEnclosure>
155
- <input placeholder="Type something…" class="InputBox" />
156
- </InputEnclosure>
157
- </Theme>
158
- </Story>
159
-
160
- <Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
161
- <Theme type="dark">
162
- <InputEnclosure>
163
- <input placeholder="Type something…" class="InputBox" />
164
- </InputEnclosure>
165
- </Theme>
166
- </Story>
@@ -1,31 +0,0 @@
1
- <script module lang="ts">
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import Label from './Label.svelte';
4
- import type { LabelProps } from './Label.svelte';
5
- import type { ArgTypes } from 'storybook/internal/csf';
6
- import TextInput from '../TextInput/TextInput.svelte';
7
-
8
- /**
9
- * Storybook controls for Label
10
- */
11
- export const LabelArgTypes: Partial<ArgTypes<LabelProps>> = {
12
- class: { table: { category: 'API', subcategory: 'Base' } },
13
- };
14
-
15
- const { Story } = defineMeta({
16
- component: Label,
17
- tags: ['autodocs'],
18
- argTypes: LabelArgTypes,
19
- });
20
- </script>
21
-
22
- <!-- ------------------------------ -->
23
- <!-- Stories -->
24
- <!-- ------------------------------ -->
25
-
26
- <Story name="Default">Default Label</Story>
27
-
28
- <Story name="WithTextInput" asChild>
29
- <Label for="search">Search:</Label>
30
- <TextInput placeholder="Search…" name="search" />
31
- </Story>
@@ -1,78 +0,0 @@
1
- <script module lang="ts">
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import Radio from './Radio.svelte';
4
- import type { RadioProps } from './Radio.svelte';
5
- import type { ArgTypes } from 'storybook/internal/csf';
6
- import { componentColorOptions } from '$lib/attributes/color.js';
7
- import { componentSizeOptions } from '$lib/attributes/size.js';
8
- import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
9
- import { componentVariantOptions } from '$lib/attributes/variant.js';
10
- import RadioGroup from '../RadioGroup.svelte';
11
-
12
- /**
13
- * Storybook controls for Radio
14
- */
15
- export const RadioArgTypes: Partial<ArgTypes<RadioProps>> = {
16
- // ------------------------------
17
- // Core
18
- // ------------------------------
19
- children: { table: { category: 'API', subcategory: 'Base' } },
20
- disabled: {
21
- control: { type: 'boolean' },
22
- description: 'Disable interactions',
23
- table: { category: 'API', subcategory: 'Base' },
24
- },
25
- class: { table: { category: 'API', subcategory: 'Base' } },
26
-
27
- // ------------------------------
28
- // Appearance
29
- // ------------------------------
30
- color: {
31
- control: { type: 'select' },
32
- options: componentColorOptions,
33
- description: 'Color theme token',
34
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'neutral' } },
35
- },
36
- variant: {
37
- control: { type: 'select' },
38
- options: componentVariantOptions,
39
- description: 'Visual variant of the Radio',
40
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'text' } },
41
- },
42
- size: {
43
- control: { type: 'select' },
44
- options: componentSizeOptions,
45
- description: 'Visual size token',
46
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'normal' } },
47
- },
48
- roundness: {
49
- control: { type: 'select' },
50
- options: componentRoundnessOptions,
51
- description: 'Border radius token',
52
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'full' } },
53
- },
54
- outline: {
55
- control: { type: 'boolean' },
56
- description: 'Render outlined style',
57
- table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'true' } },
58
- },
59
- };
60
-
61
- const { Story } = defineMeta({
62
- component: Radio,
63
- tags: ['autodocs'],
64
- argTypes: RadioArgTypes,
65
- });
66
- </script>
67
-
68
- <!-- ------------------------------ -->
69
- <!-- Stories -->
70
- <!-- ------------------------------ -->
71
-
72
- <Story name="Default" asChild>
73
- <RadioGroup id="Default">
74
- <Radio id="Default-1" value="1">One</Radio>
75
- <Radio id="Default-2" value="2">Two</Radio>
76
- <Radio id="Default-3" value="3">Three</Radio>
77
- </RadioGroup>
78
- </Story>
@@ -1,172 +0,0 @@
1
- <script module lang="ts">
2
- import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import RadioGroup from './RadioGroup.svelte';
4
- import type { RadioGroupProps } from './RadioGroup.svelte';
5
- import type { ArgTypes } from 'storybook/internal/csf';
6
- import Radio from './Radio/Radio.svelte';
7
- import Theme from '$lib/components/Layout/Theme/Theme.svelte';
8
-
9
- /**
10
- * Storybook controls for RadioGroup
11
- */
12
- export const RadioGroupArgTypes: Partial<ArgTypes<RadioGroupProps>> = {
13
- // ------------------------------
14
- // Core
15
- // ------------------------------
16
- children: { table: { category: 'API', subcategory: 'Base' } },
17
- disabled: {
18
- control: { type: 'boolean' },
19
- description: 'Disable interactions',
20
- table: { category: 'API', subcategory: 'Base' },
21
- },
22
- class: { table: { category: 'API', subcategory: 'Base' } },
23
- orientation: {
24
- control: { type: 'select' },
25
- options: ['horizontal', 'vertical'],
26
- table: {
27
- category: 'API',
28
- subcategory: 'Base',
29
- defaultValue: { summary: 'vertical' },
30
- },
31
- },
32
- };
33
-
34
- const { Story } = defineMeta({
35
- component: RadioGroup,
36
- tags: ['autodocs'],
37
- argTypes: RadioGroupArgTypes,
38
- });
39
-
40
- let myValue = $state<string>('3');
41
- </script>
42
-
43
- <!-- ------------------------------ -->
44
- <!-- Stories -->
45
- <!-- ------------------------------ -->
46
-
47
- <!-- ------------------------------ -->
48
- <!-- Stories -->
49
- <!-- ------------------------------ -->
50
-
51
- <Story name="Default" asChild>
52
- <RadioGroup id="Default">
53
- <Radio id="Default-1" value="1">One</Radio>
54
- <Radio id="Default-2" value="2">Two</Radio>
55
- <Radio id="Default-3" value="3">Three</Radio>
56
- </RadioGroup>
57
- </Story>
58
-
59
- <Story name="Selected" asChild>
60
- <RadioGroup id="Selected" bind:value={myValue}>
61
- <Radio id="Selected-1" value="1">One</Radio>
62
- <Radio id="Selected-2" value="2">Two</Radio>
63
- <Radio id="Selected-3" value="3">Three</Radio>
64
- </RadioGroup>
65
- </Story>
66
-
67
- <Story name="Horizontal" asChild>
68
- <RadioGroup orientation="horizontal" id="Horizontal">
69
- <Radio id="Horizontal-1" value="1">One</Radio>
70
- <Radio id="Horizontal-2" value="2">Two</Radio>
71
- <Radio id="Horizontal-3" value="3">Three</Radio>
72
- </RadioGroup>
73
- </Story>
74
-
75
- <Story name="Solid" asChild>
76
- <RadioGroup id="Solid" value="1">
77
- <Radio id="Solid-1" value="1" variant="solid">One</Radio>
78
- <Radio id="Solid-2" value="2" variant="solid">Two</Radio>
79
- <Radio id="Solid-3" value="3" variant="solid">Three</Radio>
80
- </RadioGroup>
81
- </Story>
82
-
83
- <Story name="NoOutline" asChild>
84
- <RadioGroup id="NoOutline" value="1">
85
- <Radio id="NoOutline-1" value="1" outline={false}>One</Radio>
86
- <Radio id="NoOutline-2" value="2" outline={false}>Two</Radio>
87
- <Radio id="NoOutline-3" value="3" outline={false}>Three</Radio>
88
- </RadioGroup>
89
- </Story>
90
-
91
- <Story name="Disabled" asChild>
92
- <RadioGroup disabled id="Disabled" value="1">
93
- <Radio id="Disabled-1" value="1">One</Radio>
94
- <Radio id="Disabled-2" value="2">Two</Radio>
95
- <Radio id="Disabled-3" value="3">Three</Radio>
96
- </RadioGroup>
97
- </Story>
98
-
99
- <Story name="DisabledRadio" asChild>
100
- <RadioGroup id="DisabledRadio" value="2">
101
- <Radio id="DisabledRadio-1" value="1" disabled>One (disabled)</Radio>
102
- <Radio id="DisabledRadio-2" value="2">Two</Radio>
103
- <Radio id="DisabledRadio-3" value="3">Three</Radio>
104
- </RadioGroup>
105
- </Story>
106
-
107
- <Story name="Primary" asChild>
108
- <RadioGroup id="Primary" value="1">
109
- <Radio id="Primary-1" value="1" color="primary">One</Radio>
110
- <Radio id="Primary-2" value="2" color="primary">Two</Radio>
111
- <Radio id="Primary-3" value="3" color="primary">Three</Radio>
112
- </RadioGroup>
113
- </Story>
114
-
115
- <Story name="Large" asChild>
116
- <RadioGroup id="Large" value="1">
117
- <Radio id="Large-1" value="1" size="large">One</Radio>
118
- <Radio id="Large-2" value="2" size="large">Two</Radio>
119
- <Radio id="Large-3" value="3" size="large">Three</Radio>
120
- </RadioGroup>
121
- </Story>
122
-
123
- <Story name="Safe" asChild>
124
- <RadioGroup id="Safe" value="1">
125
- <Radio id="Safe-1" value="1" color="safe">One</Radio>
126
- <Radio id="Safe-2" value="2" color="safe">Two</Radio>
127
- <Radio id="Safe-3" value="3" color="safe">Three</Radio>
128
- </RadioGroup>
129
- </Story>
130
-
131
- <Story name="Danger" asChild>
132
- <RadioGroup id="Danger" value="1">
133
- <Radio id="Danger-1" value="1" color="danger">One</Radio>
134
- <Radio id="Danger-2" value="2" color="danger">Two</Radio>
135
- <Radio id="Danger-3" value="3" color="danger">Three</Radio>
136
- </RadioGroup>
137
- </Story>
138
-
139
- <Story name="onValueChange (Actions)" asChild>
140
- <RadioGroup
141
- id="onValueChange"
142
- value="1"
143
- onValueChange={(value: string) => {
144
- alert('onValueChange');
145
- console.log('onValueChange', value);
146
- }}
147
- >
148
- <Radio id="onValueChange-1" value="1">One</Radio>
149
- <Radio id="onValueChange-2" value="2">Two</Radio>
150
- <Radio id="onValueChange-3" value="3">Three</Radio>
151
- </RadioGroup>
152
- </Story>
153
-
154
- <Story name="Light Theme" asChild>
155
- <Theme type="light">
156
- <RadioGroup value="1">
157
- <Radio id="Light_theme-1" value="1">One</Radio>
158
- <Radio id="Light_theme-2" value="2">Two</Radio>
159
- <Radio id="Light_theme-3" value="3">Three</Radio>
160
- </RadioGroup>
161
- </Theme>
162
- </Story>
163
-
164
- <Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
165
- <Theme type="dark">
166
- <RadioGroup value="1">
167
- <Radio id="Dark_theme-1" value="1">One</Radio>
168
- <Radio id="Dark_theme-2" value="2">Two</Radio>
169
- <Radio id="Dark_theme-3" value="3">Three</Radio>
170
- </RadioGroup>
171
- </Theme>
172
- </Story>