@flightlesslabs/dodo-ui 0.22.2 → 0.24.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 -10
- package/dist/index.js +5 -10
- package/dist/styles/components.css +0 -154
- package/dist/styles/components.css.map +1 -1
- package/dist/styles/components.scss +0 -2
- package/package.json +27 -41
- package/src/lib/index.ts +6 -19
- package/src/lib/styles/components.scss +0 -2
- 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.scss +0 -55
- 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/DatePicker/DatePicker.svelte +0 -136
- package/dist/components/Form/DatePicker/DatePicker.svelte.d.ts +0 -64
- package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +0 -96
- package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte.d.ts +0 -23
- package/dist/components/Form/DatePicker/DatePickerInput/Segments.svelte +0 -17
- package/dist/components/Form/DatePicker/DatePickerInput/Segments.svelte.d.ts +0 -8
- package/dist/components/Form/DatePicker/DatePickerInput/utils.d.ts +0 -10
- package/dist/components/Form/DatePicker/DatePickerInput/utils.js +0 -26
- package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +0 -35
- package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte.d.ts +0 -4
- package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +0 -52
- package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte.d.ts +0 -6
- package/dist/components/Form/DatePicker/DatePickerPopup/Header.svelte +0 -25
- package/dist/components/Form/DatePicker/DatePickerPopup/Header.svelte.d.ts +0 -3
- 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.scss +0 -147
- 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/Info/Calendar/Calendar.svelte +0 -61
- package/dist/components/Info/Calendar/Calendar.svelte.d.ts +0 -6
- package/dist/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte +0 -16
- package/dist/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte.d.ts +0 -4
- package/dist/components/Info/Calendar/CalendarGrid/TableBody.svelte +0 -25
- package/dist/components/Info/Calendar/CalendarGrid/TableBody.svelte.d.ts +0 -8
- package/dist/components/Info/Calendar/CalendarGrid/TableHead.svelte +0 -19
- package/dist/components/Info/Calendar/CalendarGrid/TableHead.svelte.d.ts +0 -6
- package/dist/components/Info/Calendar/Header.svelte +0 -25
- package/dist/components/Info/Calendar/Header.svelte.d.ts +0 -3
- 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.scss +0 -55
- package/src/lib/components/Form/DatePicker/DatePicker.stories.svelte +0 -139
- package/src/lib/components/Form/DatePicker/DatePicker.svelte +0 -136
- package/src/lib/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +0 -96
- package/src/lib/components/Form/DatePicker/DatePickerInput/Segments.svelte +0 -17
- package/src/lib/components/Form/DatePicker/DatePickerInput/utils.ts +0 -55
- package/src/lib/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +0 -35
- package/src/lib/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +0 -52
- package/src/lib/components/Form/DatePicker/DatePickerPopup/Header.svelte +0 -25
- 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.scss +0 -147
- package/src/lib/components/Info/Calendar/Calendar.stories.svelte +0 -134
- package/src/lib/components/Info/Calendar/Calendar.svelte +0 -61
- package/src/lib/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte +0 -16
- package/src/lib/components/Info/Calendar/CalendarGrid/TableBody.svelte +0 -25
- package/src/lib/components/Info/Calendar/CalendarGrid/TableHead.svelte +0 -19
- package/src/lib/components/Info/Calendar/Header.svelte +0 -25
- 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,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;
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import TextInput from './TextInput.svelte';
|
|
4
|
-
import type { TextInputProps } from './TextInput.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
|
-
Input box with powers ⚡
|
|
13
|
-
|
|
14
|
-
\`\`\`ts
|
|
15
|
-
import { TextInput } from '@flightlesslabs/dodo-ui';
|
|
16
|
-
\`\`\`
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
// ------------------------------
|
|
20
|
-
// Storybook ArgTypes
|
|
21
|
-
// ------------------------------
|
|
22
|
-
export const storyTextInputArgTypes: Partial<ArgTypes<TextInputProps>> = {
|
|
23
|
-
children: {
|
|
24
|
-
table: { disable: true },
|
|
25
|
-
control: false,
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
// ------------------------------
|
|
29
|
-
// Core
|
|
30
|
-
// ------------------------------
|
|
31
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
32
|
-
placeholder: {
|
|
33
|
-
control: { type: 'text' },
|
|
34
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
35
|
-
},
|
|
36
|
-
value: {
|
|
37
|
-
control: { type: 'text' },
|
|
38
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
39
|
-
},
|
|
40
|
-
name: { table: { category: 'API', subcategory: 'Base' } },
|
|
41
|
-
|
|
42
|
-
// ------------------------------
|
|
43
|
-
// State
|
|
44
|
-
// ------------------------------
|
|
45
|
-
disabled: {
|
|
46
|
-
control: { type: 'boolean' },
|
|
47
|
-
description: 'Disabled state of the input',
|
|
48
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
49
|
-
},
|
|
50
|
-
focused: {
|
|
51
|
-
control: { type: 'boolean' },
|
|
52
|
-
description: 'Force focused visual state',
|
|
53
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
54
|
-
},
|
|
55
|
-
error: {
|
|
56
|
-
control: { type: 'boolean' },
|
|
57
|
-
description: 'Error visual state',
|
|
58
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
// ------------------------------
|
|
62
|
-
// Appearance
|
|
63
|
-
// ------------------------------
|
|
64
|
-
size: {
|
|
65
|
-
control: { type: 'select' },
|
|
66
|
-
options: componentSizeOptions,
|
|
67
|
-
description: 'Visual size token',
|
|
68
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'normal' } },
|
|
69
|
-
},
|
|
70
|
-
roundness: {
|
|
71
|
-
control: { type: 'select' },
|
|
72
|
-
options: componentRoundnessOptions,
|
|
73
|
-
description: 'Border radius token',
|
|
74
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: '1' } },
|
|
75
|
-
},
|
|
76
|
-
outline: {
|
|
77
|
-
control: { type: 'boolean' },
|
|
78
|
-
description: 'Render outlined enclosure',
|
|
79
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'true' } },
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
// ------------------------------
|
|
83
|
-
// Slots (Snippets)
|
|
84
|
-
// ------------------------------
|
|
85
|
-
before: {
|
|
86
|
-
table: { category: 'API', subcategory: 'Slots' },
|
|
87
|
-
description: 'Content rendered before the input',
|
|
88
|
-
},
|
|
89
|
-
after: {
|
|
90
|
-
table: { category: 'API', subcategory: 'Slots' },
|
|
91
|
-
description: 'Content rendered after the input',
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
// ------------------------------
|
|
95
|
-
// Events
|
|
96
|
-
// ------------------------------
|
|
97
|
-
onfocus: { table: { category: 'API', subcategory: 'Events' }, action: 'focus' },
|
|
98
|
-
onblur: { table: { category: 'API', subcategory: 'Events' }, action: 'blur' },
|
|
99
|
-
oninput: { table: { category: 'API', subcategory: 'Events' }, action: 'input' },
|
|
100
|
-
onchange: { table: { category: 'API', subcategory: 'Events' }, action: 'change' },
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// ------------------------------
|
|
104
|
-
// Storybook Meta
|
|
105
|
-
// ------------------------------
|
|
106
|
-
const { Story } = defineMeta({
|
|
107
|
-
component: TextInput,
|
|
108
|
-
tags: ['autodocs'],
|
|
109
|
-
argTypes: storyTextInputArgTypes,
|
|
110
|
-
parameters: {
|
|
111
|
-
docs: {
|
|
112
|
-
description: {
|
|
113
|
-
component: description,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
</script>
|
|
119
|
-
|
|
120
|
-
<!-- ------------------------------ -->
|
|
121
|
-
<!-- Stories -->
|
|
122
|
-
<!-- ------------------------------ -->
|
|
123
|
-
|
|
124
|
-
<Story name="Default" args={{ placeholder: 'Type something…' }} />
|
|
125
|
-
|
|
126
|
-
<Story name="Focused" args={{ placeholder: 'Focused state…', focused: true }} />
|
|
127
|
-
|
|
128
|
-
<Story name="Error" args={{ placeholder: 'Error state…', error: true }} />
|
|
129
|
-
|
|
130
|
-
<Story name="Large" args={{ placeholder: 'Type something…', size: 'large' }} />
|
|
131
|
-
|
|
132
|
-
<Story name="Pill Shape" args={{ placeholder: 'Type something…', roundness: 'pill' }} />
|
|
133
|
-
|
|
134
|
-
<Story name="Disabled" args={{ placeholder: 'Disabled state…', disabled: true }} />
|
|
135
|
-
|
|
136
|
-
<Story name="With Before (Prefix Icon)" asChild>
|
|
137
|
-
<TextInput placeholder="Search…">
|
|
138
|
-
{#snippet before()}
|
|
139
|
-
<span style="color: #888; padding-left: 8px">🔍</span>
|
|
140
|
-
{/snippet}
|
|
141
|
-
</TextInput>
|
|
142
|
-
</Story>
|
|
143
|
-
|
|
144
|
-
<Story name="With After (Suffix Text)" asChild>
|
|
145
|
-
<TextInput placeholder="Website">
|
|
146
|
-
{#snippet after()}
|
|
147
|
-
<span style="color: #888; padding-right: 8px">.com</span>
|
|
148
|
-
{/snippet}
|
|
149
|
-
</TextInput>
|
|
150
|
-
</Story>
|
|
151
|
-
|
|
152
|
-
<Story name="Light Theme" asChild>
|
|
153
|
-
<Theme type="light">
|
|
154
|
-
<TextInput placeholder="Type something…" />
|
|
155
|
-
</Theme>
|
|
156
|
-
</Story>
|
|
157
|
-
|
|
158
|
-
<Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
|
|
159
|
-
<Theme type="dark">
|
|
160
|
-
<TextInput placeholder="Type something…" />
|
|
161
|
-
</Theme>
|
|
162
|
-
</Story>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import TextInput from './TextInput.svelte';
|
|
2
|
-
import type { TextInputProps } from './TextInput.svelte';
|
|
3
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
4
|
-
export declare const storyTextInputArgTypes: Partial<ArgTypes<TextInputProps>>;
|
|
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 TextInput: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
}, {}, {}, string>;
|
|
21
|
-
type TextInput = InstanceType<typeof TextInput>;
|
|
22
|
-
export default TextInput;
|