@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.
- package/README.md +1 -9
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +25 -35
- package/src/lib/index.ts +5 -0
- package/src/lib/utils/time/date-creator/createDate/createDate.test.ts +109 -0
- package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.test.ts +146 -0
- package/dist/Home.mdx +0 -69
- package/dist/components/Form/Button/Button.stories.svelte +0 -178
- package/dist/components/Form/Button/Button.stories.svelte.d.ts +0 -22
- package/dist/components/Form/Checkbox/Checkbox.stories.svelte +0 -132
- package/dist/components/Form/Checkbox/Checkbox.stories.svelte.d.ts +0 -25
- package/dist/components/Form/DatePicker/DatePicker.stories.svelte +0 -139
- package/dist/components/Form/DatePicker/DatePicker.stories.svelte.d.ts +0 -22
- package/dist/components/Form/FormField/FormField.stories.svelte +0 -48
- package/dist/components/Form/FormField/FormField.stories.svelte.d.ts +0 -25
- package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte +0 -166
- package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte.d.ts +0 -22
- package/dist/components/Form/Label/Label.stories.svelte +0 -31
- package/dist/components/Form/Label/Label.stories.svelte.d.ts +0 -25
- package/dist/components/Form/RadioGroup/Radio/Radio.stories.svelte +0 -78
- package/dist/components/Form/RadioGroup/Radio/Radio.stories.svelte.d.ts +0 -25
- package/dist/components/Form/RadioGroup/RadioGroup.stories.svelte +0 -172
- package/dist/components/Form/RadioGroup/RadioGroup.stories.svelte.d.ts +0 -25
- package/dist/components/Form/Select/Select.stories.svelte +0 -175
- package/dist/components/Form/Select/Select.stories.svelte.d.ts +0 -22
- package/dist/components/Form/Switch/Switch.stories.svelte +0 -128
- package/dist/components/Form/Switch/Switch.stories.svelte.d.ts +0 -25
- package/dist/components/Form/TextInput/TextInput.stories.svelte +0 -162
- package/dist/components/Form/TextInput/TextInput.stories.svelte.d.ts +0 -22
- package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte +0 -163
- package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte.d.ts +0 -22
- package/dist/components/Info/Calendar/Calendar.stories.svelte +0 -134
- package/dist/components/Info/Calendar/Calendar.stories.svelte.d.ts +0 -22
- package/dist/components/Layout/Card/Card.stories.svelte +0 -113
- package/dist/components/Layout/Card/Card.stories.svelte.d.ts +0 -22
- package/dist/components/Layout/Grid/Column/Column.stories.svelte +0 -66
- package/dist/components/Layout/Grid/Column/Column.stories.svelte.d.ts +0 -22
- package/dist/components/Layout/Grid/Grid.stories.svelte +0 -192
- package/dist/components/Layout/Grid/Grid.stories.svelte.d.ts +0 -22
- package/dist/components/Layout/Grid/Row/Row.stories.svelte +0 -39
- package/dist/components/Layout/Grid/Row/Row.stories.svelte.d.ts +0 -22
- package/dist/components/Layout/Theme/Theme.stories.svelte +0 -54
- package/dist/components/Layout/Theme/Theme.stories.svelte.d.ts +0 -25
- package/dist/components/Layout/Theme/ThemeSystem/index.mdx +0 -35
- package/dist/storybook-types.d.ts +0 -129
- package/dist/storybook-types.js +0 -1
- package/dist/utils/time/date-creator/createDate/createDate.mdx +0 -98
- package/dist/utils/time/date-creator/createDateFactory/createDateFactory.mdx +0 -104
- package/dist/utils/time/timeout/timeout.mdx +0 -114
- package/src/lib/Home.mdx +0 -69
- package/src/lib/components/Form/Button/Button.stories.svelte +0 -178
- package/src/lib/components/Form/Checkbox/Checkbox.stories.svelte +0 -132
- package/src/lib/components/Form/DatePicker/DatePicker.stories.svelte +0 -139
- package/src/lib/components/Form/FormField/FormField.stories.svelte +0 -48
- package/src/lib/components/Form/InputEnclosure/InputEnclosure.stories.svelte +0 -166
- package/src/lib/components/Form/Label/Label.stories.svelte +0 -31
- package/src/lib/components/Form/RadioGroup/Radio/Radio.stories.svelte +0 -78
- package/src/lib/components/Form/RadioGroup/RadioGroup.stories.svelte +0 -172
- package/src/lib/components/Form/Select/Select.stories.svelte +0 -175
- package/src/lib/components/Form/Switch/Switch.stories.svelte +0 -128
- package/src/lib/components/Form/TextInput/TextInput.stories.svelte +0 -162
- package/src/lib/components/Form/UtilityButton/UtilityButton.stories.svelte +0 -163
- package/src/lib/components/Info/Calendar/Calendar.stories.svelte +0 -134
- package/src/lib/components/Layout/Card/Card.stories.svelte +0 -113
- package/src/lib/components/Layout/Grid/Column/Column.stories.svelte +0 -66
- package/src/lib/components/Layout/Grid/Grid.stories.svelte +0 -192
- package/src/lib/components/Layout/Grid/Row/Row.stories.svelte +0 -39
- package/src/lib/components/Layout/Theme/Theme.stories.svelte +0 -54
- package/src/lib/components/Layout/Theme/ThemeSystem/index.mdx +0 -35
- package/src/lib/storybook-types.ts +0 -182
- package/src/lib/utils/time/date-creator/createDate/createDate.mdx +0 -98
- package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.mdx +0 -104
- package/src/lib/utils/time/timeout/timeout.mdx +0 -114
|
@@ -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 '../../../../attributes/color.js';
|
|
7
|
-
import { componentSizeOptions } from '../../../../attributes/size.js';
|
|
8
|
-
import { componentRoundnessOptions } from '../../../../attributes/roundness.js';
|
|
9
|
-
import { componentVariantOptions } from '../../../../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,25 +0,0 @@
|
|
|
1
|
-
import Radio from './Radio.svelte';
|
|
2
|
-
import type { RadioProps } from './Radio.svelte';
|
|
3
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
4
|
-
/**
|
|
5
|
-
* Storybook controls for Radio
|
|
6
|
-
*/
|
|
7
|
-
export declare const RadioArgTypes: Partial<ArgTypes<RadioProps>>;
|
|
8
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
9
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
10
|
-
$$bindings?: Bindings;
|
|
11
|
-
} & Exports;
|
|
12
|
-
(internal: unknown, props: {
|
|
13
|
-
$$events?: Events;
|
|
14
|
-
$$slots?: Slots;
|
|
15
|
-
}): Exports & {
|
|
16
|
-
$set?: any;
|
|
17
|
-
$on?: any;
|
|
18
|
-
};
|
|
19
|
-
z_$$bindings?: Bindings;
|
|
20
|
-
}
|
|
21
|
-
declare const Radio: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
22
|
-
[evt: string]: CustomEvent<any>;
|
|
23
|
-
}, {}, {}, string>;
|
|
24
|
-
type Radio = InstanceType<typeof Radio>;
|
|
25
|
-
export default Radio;
|
|
@@ -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 '../../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>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import RadioGroup from './RadioGroup.svelte';
|
|
2
|
-
import type { RadioGroupProps } from './RadioGroup.svelte';
|
|
3
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
4
|
-
/**
|
|
5
|
-
* Storybook controls for RadioGroup
|
|
6
|
-
*/
|
|
7
|
-
export declare const RadioGroupArgTypes: Partial<ArgTypes<RadioGroupProps>>;
|
|
8
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
9
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
10
|
-
$$bindings?: Bindings;
|
|
11
|
-
} & Exports;
|
|
12
|
-
(internal: unknown, props: {
|
|
13
|
-
$$events?: Events;
|
|
14
|
-
$$slots?: Slots;
|
|
15
|
-
}): Exports & {
|
|
16
|
-
$set?: any;
|
|
17
|
-
$on?: any;
|
|
18
|
-
};
|
|
19
|
-
z_$$bindings?: Bindings;
|
|
20
|
-
}
|
|
21
|
-
declare const RadioGroup: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
22
|
-
[evt: string]: CustomEvent<any>;
|
|
23
|
-
}, {}, {}, string>;
|
|
24
|
-
type RadioGroup = InstanceType<typeof RadioGroup>;
|
|
25
|
-
export default RadioGroup;
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Select from './Select.svelte';
|
|
4
|
-
import type { SelectProps } from './Select.svelte';
|
|
5
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
-
|
|
7
|
-
import { componentSizeOptions } from '../../../attributes/size.js';
|
|
8
|
-
import { componentRoundnessOptions } from '../../../attributes/roundness.js';
|
|
9
|
-
import Theme from '../../Layout/Theme/Theme.svelte';
|
|
10
|
-
|
|
11
|
-
const description = `
|
|
12
|
-
A searchable Select component based on bits-ui [combobox](https://bits-ui.com/docs/components/combobox).
|
|
13
|
-
|
|
14
|
-
\`\`\`ts
|
|
15
|
-
import { Select } from '@flightlesslabs/dodo-ui';
|
|
16
|
-
\`\`\`
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
const options = [
|
|
20
|
-
{ value: 'one', label: 'One' },
|
|
21
|
-
{ value: 'two', label: 'Two' },
|
|
22
|
-
{ value: 'three', label: 'Three' },
|
|
23
|
-
{ value: 'four', label: 'Four' },
|
|
24
|
-
{ value: 'five', label: 'Five' },
|
|
25
|
-
{ value: 'six', label: 'Six' },
|
|
26
|
-
{ value: 'seven', label: 'Seven' },
|
|
27
|
-
{ value: 'eight', label: 'Eight' },
|
|
28
|
-
{ value: 'nine', label: 'Nine' },
|
|
29
|
-
{ value: 'ten', label: 'Ten' },
|
|
30
|
-
{ value: 'eleven', label: 'Eleven' },
|
|
31
|
-
{ value: 'twelve', label: 'Twelve' },
|
|
32
|
-
{ value: 'thirteen', label: 'Thirteen' },
|
|
33
|
-
{ value: 'fourteen', label: 'Fourteen' },
|
|
34
|
-
{ value: 'fifteen', label: 'Fifteen' },
|
|
35
|
-
{ value: 'sixteen', label: 'Sixteen' },
|
|
36
|
-
{ value: 'seventeen', label: 'Seventeen' },
|
|
37
|
-
{ value: 'eighteen', label: 'Eighteen' },
|
|
38
|
-
{ value: 'nineteen', label: 'Nineteen' },
|
|
39
|
-
{ value: 'twenty', label: 'Twenty' },
|
|
40
|
-
{ value: 'twentyOne', label: 'Twenty One' },
|
|
41
|
-
{ value: 'twentyTwo', label: 'Twenty Two' },
|
|
42
|
-
{ value: 'twentyThree', label: 'Twenty Three' },
|
|
43
|
-
{ value: 'twentyFour', label: 'Twenty Four' },
|
|
44
|
-
{ value: 'twentyFive', label: 'Twenty Five' },
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
// ------------------------------
|
|
48
|
-
// Storybook ArgTypes
|
|
49
|
-
// ------------------------------
|
|
50
|
-
export const storySelectArgTypes: Partial<ArgTypes<SelectProps>> = {
|
|
51
|
-
// ------------------------------
|
|
52
|
-
// Core
|
|
53
|
-
// ------------------------------
|
|
54
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
55
|
-
value: {
|
|
56
|
-
control: { type: 'text' },
|
|
57
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
58
|
-
},
|
|
59
|
-
name: { table: { category: 'API', subcategory: 'Base' } },
|
|
60
|
-
options: { table: { category: 'API', subcategory: 'Base' } },
|
|
61
|
-
searchable: {
|
|
62
|
-
control: { type: 'boolean' },
|
|
63
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
// ------------------------------
|
|
67
|
-
// State
|
|
68
|
-
// ------------------------------
|
|
69
|
-
disabled: {
|
|
70
|
-
control: { type: 'boolean' },
|
|
71
|
-
description: 'Disabled state of the input',
|
|
72
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
73
|
-
},
|
|
74
|
-
focused: {
|
|
75
|
-
control: { type: 'boolean' },
|
|
76
|
-
description: 'Force focused visual state',
|
|
77
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
78
|
-
},
|
|
79
|
-
error: {
|
|
80
|
-
control: { type: 'boolean' },
|
|
81
|
-
description: 'Error visual state',
|
|
82
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
// ------------------------------
|
|
86
|
-
// Appearance
|
|
87
|
-
// ------------------------------
|
|
88
|
-
size: {
|
|
89
|
-
control: { type: 'select' },
|
|
90
|
-
options: componentSizeOptions,
|
|
91
|
-
description: 'Visual size token',
|
|
92
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'normal' } },
|
|
93
|
-
},
|
|
94
|
-
roundness: {
|
|
95
|
-
control: { type: 'select' },
|
|
96
|
-
options: componentRoundnessOptions,
|
|
97
|
-
description: 'Border radius token',
|
|
98
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: '1' } },
|
|
99
|
-
},
|
|
100
|
-
outline: {
|
|
101
|
-
control: { type: 'boolean' },
|
|
102
|
-
description: 'Render outlined enclosure',
|
|
103
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'true' } },
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
// ------------------------------
|
|
107
|
-
// Slots (Snippets)
|
|
108
|
-
// ------------------------------
|
|
109
|
-
before: {
|
|
110
|
-
table: { category: 'API', subcategory: 'Slots' },
|
|
111
|
-
description: 'Content rendered before the input',
|
|
112
|
-
},
|
|
113
|
-
after: {
|
|
114
|
-
table: { category: 'API', subcategory: 'Slots' },
|
|
115
|
-
description: 'Content rendered after the input',
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
// ------------------------------
|
|
120
|
-
// Storybook Meta
|
|
121
|
-
// ------------------------------
|
|
122
|
-
const { Story } = defineMeta({
|
|
123
|
-
component: Select,
|
|
124
|
-
tags: ['autodocs'],
|
|
125
|
-
argTypes: storySelectArgTypes,
|
|
126
|
-
args: {
|
|
127
|
-
options,
|
|
128
|
-
},
|
|
129
|
-
parameters: {
|
|
130
|
-
docs: {
|
|
131
|
-
description: {
|
|
132
|
-
component: description,
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
let myValue = $state<string | undefined>(options[1].value);
|
|
139
|
-
</script>
|
|
140
|
-
|
|
141
|
-
<!-- ------------------------------ -->
|
|
142
|
-
<!-- Stories -->
|
|
143
|
-
<!-- ------------------------------ -->
|
|
144
|
-
|
|
145
|
-
<Story name="Default" args={{ placeholder: 'Select an option' }} />
|
|
146
|
-
|
|
147
|
-
<Story name="Searchable" args={{ searchable: true, placeholder: 'Search a number' }} />
|
|
148
|
-
|
|
149
|
-
<Story name="Controlled" asChild>
|
|
150
|
-
<Select {options} bind:value={myValue} />
|
|
151
|
-
</Story>
|
|
152
|
-
|
|
153
|
-
<Story
|
|
154
|
-
name="OnChange (Actions)"
|
|
155
|
-
args={{
|
|
156
|
-
onValueChange: (val: string) => {
|
|
157
|
-
alert('OnChange');
|
|
158
|
-
console.log('OnChange', val);
|
|
159
|
-
},
|
|
160
|
-
}}
|
|
161
|
-
/>
|
|
162
|
-
|
|
163
|
-
<Story name="Disabled" args={{ placeholder: 'Select an option', disabled: true }} />
|
|
164
|
-
|
|
165
|
-
<Story name="Light Theme" asChild>
|
|
166
|
-
<Theme type="light">
|
|
167
|
-
<Select {options} />
|
|
168
|
-
</Theme>
|
|
169
|
-
</Story>
|
|
170
|
-
|
|
171
|
-
<Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
|
|
172
|
-
<Theme type="dark">
|
|
173
|
-
<Select {options} popupProps={{ theme: 'dark' }} />
|
|
174
|
-
</Theme>
|
|
175
|
-
</Story>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import Select from './Select.svelte';
|
|
2
|
-
import type { SelectProps } from './Select.svelte';
|
|
3
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
4
|
-
export declare const storySelectArgTypes: Partial<ArgTypes<SelectProps>>;
|
|
5
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
6
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
7
|
-
$$bindings?: Bindings;
|
|
8
|
-
} & Exports;
|
|
9
|
-
(internal: unknown, props: {
|
|
10
|
-
$$events?: Events;
|
|
11
|
-
$$slots?: Slots;
|
|
12
|
-
}): Exports & {
|
|
13
|
-
$set?: any;
|
|
14
|
-
$on?: any;
|
|
15
|
-
};
|
|
16
|
-
z_$$bindings?: Bindings;
|
|
17
|
-
}
|
|
18
|
-
declare const Select: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
}, {}, {}, string>;
|
|
21
|
-
type Select = InstanceType<typeof Select>;
|
|
22
|
-
export default Select;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Switch from './Switch.svelte';
|
|
4
|
-
import type { SwitchProps } from './Switch.svelte';
|
|
5
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
-
import { componentColorOptions } from '../../../attributes/color.js';
|
|
7
|
-
import { componentSizeOptions } from '../../../attributes/size.js';
|
|
8
|
-
import { componenRoundnessShapeOptions } from '../../../attributes/roundness.js';
|
|
9
|
-
import Theme from '../../Layout/Theme/Theme.svelte';
|
|
10
|
-
import { componentVariantOptions } from '../../../attributes/variant.js';
|
|
11
|
-
|
|
12
|
-
const description = `
|
|
13
|
-
A Switch/toggle component based on bits-ui [switch](https://bits-ui.com/docs/components/switch).
|
|
14
|
-
|
|
15
|
-
\`\`\`ts
|
|
16
|
-
import { Switch } from '@flightlesslabs/dodo-ui';
|
|
17
|
-
\`\`\`
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Storybook controls for Switch
|
|
22
|
-
*/
|
|
23
|
-
export const SwitchArgTypes: Partial<ArgTypes<SwitchProps>> = {
|
|
24
|
-
// ------------------------------
|
|
25
|
-
// Core
|
|
26
|
-
// ------------------------------
|
|
27
|
-
children: { table: { category: 'API', subcategory: 'Base' } },
|
|
28
|
-
disabled: {
|
|
29
|
-
control: { type: 'boolean' },
|
|
30
|
-
description: 'Disable interactions',
|
|
31
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
32
|
-
},
|
|
33
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
34
|
-
|
|
35
|
-
// ------------------------------
|
|
36
|
-
// Appearance
|
|
37
|
-
// ------------------------------
|
|
38
|
-
color: {
|
|
39
|
-
control: { type: 'select' },
|
|
40
|
-
options: componentColorOptions,
|
|
41
|
-
description: 'Color theme token',
|
|
42
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'neutral' } },
|
|
43
|
-
},
|
|
44
|
-
variant: {
|
|
45
|
-
control: { type: 'select' },
|
|
46
|
-
options: componentVariantOptions,
|
|
47
|
-
description: 'Visual variant of the Switch',
|
|
48
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'text' } },
|
|
49
|
-
},
|
|
50
|
-
size: {
|
|
51
|
-
control: { type: 'select' },
|
|
52
|
-
options: componentSizeOptions,
|
|
53
|
-
description: 'Visual size token',
|
|
54
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'normal' } },
|
|
55
|
-
},
|
|
56
|
-
roundness: {
|
|
57
|
-
control: { type: 'select' },
|
|
58
|
-
options: componenRoundnessShapeOptions,
|
|
59
|
-
description: 'Border radius token',
|
|
60
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
61
|
-
},
|
|
62
|
-
outline: {
|
|
63
|
-
control: { type: 'boolean' },
|
|
64
|
-
description: 'Render outlined style',
|
|
65
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'true' } },
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const { Story } = defineMeta({
|
|
70
|
-
component: Switch,
|
|
71
|
-
tags: ['autodocs'],
|
|
72
|
-
argTypes: SwitchArgTypes,
|
|
73
|
-
parameters: {
|
|
74
|
-
docs: {
|
|
75
|
-
description: {
|
|
76
|
-
component: description,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
let myValue = $state<boolean>(true);
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<!-- ------------------------------ -->
|
|
86
|
-
<!-- Stories -->
|
|
87
|
-
<!-- ------------------------------ -->
|
|
88
|
-
|
|
89
|
-
<Story name="Default" args={{ id: 'Default' }}>Check this text</Story>
|
|
90
|
-
|
|
91
|
-
<Story name="Controlled" asChild>
|
|
92
|
-
<Switch id="Checked" bind:checked={myValue}>Check this text</Switch>
|
|
93
|
-
</Story>
|
|
94
|
-
|
|
95
|
-
<Story name="Solid" args={{ id: 'Solid', variant: 'solid', checked: true }}>Check this text</Story>
|
|
96
|
-
|
|
97
|
-
<Story name="NoOutline" args={{ id: 'Outline', outline: false }}>Check this text</Story>
|
|
98
|
-
|
|
99
|
-
<Story
|
|
100
|
-
name="OnChange (Actions)"
|
|
101
|
-
args={{
|
|
102
|
-
id: 'OnChange_Action',
|
|
103
|
-
onCheckedChange: (checked: boolean) => {
|
|
104
|
-
alert('OnChange');
|
|
105
|
-
console.log('OnChange', checked);
|
|
106
|
-
},
|
|
107
|
-
}}
|
|
108
|
-
>
|
|
109
|
-
Check this text
|
|
110
|
-
</Story>
|
|
111
|
-
|
|
112
|
-
<Story name="Color" args={{ id: 'Safe', color: 'safe' }}>Check this text</Story>
|
|
113
|
-
|
|
114
|
-
<Story name="Large" args={{ id: 'Large', size: 'large' }}>Check this text</Story>
|
|
115
|
-
|
|
116
|
-
<Story name="Disabled" args={{ disabled: true }}>Check this text</Story>
|
|
117
|
-
|
|
118
|
-
<Story name="Light Theme" asChild>
|
|
119
|
-
<Theme type="light">
|
|
120
|
-
<Switch id="Light_Theme">Check this text</Switch>
|
|
121
|
-
</Theme>
|
|
122
|
-
</Story>
|
|
123
|
-
|
|
124
|
-
<Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
|
|
125
|
-
<Theme type="dark">
|
|
126
|
-
<Switch id="Dark_Theme">Check this text</Switch>
|
|
127
|
-
</Theme>
|
|
128
|
-
</Story>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import Switch from './Switch.svelte';
|
|
2
|
-
import type { SwitchProps } from './Switch.svelte';
|
|
3
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
4
|
-
/**
|
|
5
|
-
* Storybook controls for Switch
|
|
6
|
-
*/
|
|
7
|
-
export declare const SwitchArgTypes: Partial<ArgTypes<SwitchProps>>;
|
|
8
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
9
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
10
|
-
$$bindings?: Bindings;
|
|
11
|
-
} & Exports;
|
|
12
|
-
(internal: unknown, props: {
|
|
13
|
-
$$events?: Events;
|
|
14
|
-
$$slots?: Slots;
|
|
15
|
-
}): Exports & {
|
|
16
|
-
$set?: any;
|
|
17
|
-
$on?: any;
|
|
18
|
-
};
|
|
19
|
-
z_$$bindings?: Bindings;
|
|
20
|
-
}
|
|
21
|
-
declare const Switch: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
22
|
-
[evt: string]: CustomEvent<any>;
|
|
23
|
-
}, {}, {}, string>;
|
|
24
|
-
type Switch = InstanceType<typeof Switch>;
|
|
25
|
-
export default Switch;
|