@flightlesslabs/dodo-ui 0.22.2 → 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 +20 -34
- 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,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 '$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
|
-
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,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 '$lib/attributes/color.js';
|
|
7
|
-
import { componentSizeOptions } from '$lib/attributes/size.js';
|
|
8
|
-
import { componenRoundnessShapeOptions } from '$lib/attributes/roundness.js';
|
|
9
|
-
import Theme from '$lib/components/Layout/Theme/Theme.svelte';
|
|
10
|
-
import { componentVariantOptions } from '$lib/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,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 '$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
|
-
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,163 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import UtilityButton from './UtilityButton.svelte';
|
|
4
|
-
import type { UtilityButtonProps } from './UtilityButton.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 Theme from '$lib/components/Layout/Theme/Theme.svelte';
|
|
10
|
-
|
|
11
|
-
const description = `
|
|
12
|
-
A flexible small sized button component based on bits-ui [button](https://bits-ui.com/docs/components/button).
|
|
13
|
-
|
|
14
|
-
\`\`\`ts
|
|
15
|
-
import { UtilityButton } from '@flightlesslabs/dodo-ui';
|
|
16
|
-
\`\`\`
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
// ------------------------------
|
|
20
|
-
// Storybook ArgTypes
|
|
21
|
-
// ------------------------------
|
|
22
|
-
export const storyUtilityButtonArgTypes: Partial<ArgTypes<UtilityButtonProps>> = {
|
|
23
|
-
// ------------------------------
|
|
24
|
-
// Core
|
|
25
|
-
// ------------------------------
|
|
26
|
-
children: { table: { category: 'API', subcategory: 'Base' } },
|
|
27
|
-
href: {
|
|
28
|
-
control: { type: 'text' },
|
|
29
|
-
description: 'Render as Anchor when provided',
|
|
30
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
31
|
-
},
|
|
32
|
-
disabled: {
|
|
33
|
-
control: { type: 'boolean' },
|
|
34
|
-
description: 'Disable interactions',
|
|
35
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
36
|
-
},
|
|
37
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
38
|
-
type: { table: { category: 'API', subcategory: 'Base' } },
|
|
39
|
-
|
|
40
|
-
// ------------------------------
|
|
41
|
-
// Appearance
|
|
42
|
-
// ------------------------------
|
|
43
|
-
color: {
|
|
44
|
-
control: { type: 'select' },
|
|
45
|
-
options: componentColorOptions,
|
|
46
|
-
description: 'Color theme token',
|
|
47
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'primary' } },
|
|
48
|
-
},
|
|
49
|
-
size: {
|
|
50
|
-
control: { type: 'select' },
|
|
51
|
-
options: componentSizeOptions,
|
|
52
|
-
description: 'Visual size token',
|
|
53
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'normal' } },
|
|
54
|
-
},
|
|
55
|
-
roundness: {
|
|
56
|
-
control: { type: 'select' },
|
|
57
|
-
options: componentRoundnessOptions,
|
|
58
|
-
description: 'Border radius token',
|
|
59
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
60
|
-
},
|
|
61
|
-
compact: {
|
|
62
|
-
control: { type: 'boolean' },
|
|
63
|
-
description: 'Compact spacing (icon buttons)',
|
|
64
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
65
|
-
},
|
|
66
|
-
outline: {
|
|
67
|
-
control: { type: 'boolean' },
|
|
68
|
-
description: 'Render outlined style',
|
|
69
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
// ------------------------------
|
|
73
|
-
// Accessibility
|
|
74
|
-
// ------------------------------
|
|
75
|
-
'aria-label': {
|
|
76
|
-
control: { type: 'text' },
|
|
77
|
-
description: 'Accessible label (required for icon-only buttons)',
|
|
78
|
-
table: { category: 'API', subcategory: 'Accessibility' },
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
// ------------------------------
|
|
82
|
-
// Events (Svelte-style)
|
|
83
|
-
// ------------------------------
|
|
84
|
-
onclick: { table: { category: 'API', subcategory: 'Events' }, action: 'click' },
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// ------------------------------
|
|
88
|
-
// Storybook Meta
|
|
89
|
-
// ------------------------------
|
|
90
|
-
const { Story } = defineMeta({
|
|
91
|
-
component: UtilityButton,
|
|
92
|
-
tags: ['autodocs'],
|
|
93
|
-
argTypes: storyUtilityButtonArgTypes,
|
|
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">Click me!</Story>
|
|
109
|
-
|
|
110
|
-
<Story
|
|
111
|
-
name="Link Button"
|
|
112
|
-
args={{
|
|
113
|
-
href: 'https://www.w3schools.com/tags/tag_a.asp',
|
|
114
|
-
target: '_blank',
|
|
115
|
-
}}
|
|
116
|
-
>
|
|
117
|
-
Click me!
|
|
118
|
-
</Story>
|
|
119
|
-
|
|
120
|
-
<Story
|
|
121
|
-
name="OnClick (Actions)"
|
|
122
|
-
args={{
|
|
123
|
-
onclick: (e: Event) => {
|
|
124
|
-
const target = e.target as HTMLButtonElement;
|
|
125
|
-
alert('Button Clicked');
|
|
126
|
-
console.log('Button Clicked', target);
|
|
127
|
-
},
|
|
128
|
-
}}
|
|
129
|
-
>
|
|
130
|
-
Click me
|
|
131
|
-
</Story>
|
|
132
|
-
|
|
133
|
-
<Story name="Color" args={{ color: 'safe' }}>Click me</Story>
|
|
134
|
-
|
|
135
|
-
<Story name="Outline" args={{ outline: true }}>Click me!</Story>
|
|
136
|
-
|
|
137
|
-
<Story name="Size" args={{ size: 'large' }}>Click me!</Story>
|
|
138
|
-
|
|
139
|
-
<Story name="Disabled" args={{ disabled: true }}>Click me!</Story>
|
|
140
|
-
|
|
141
|
-
<Story name="Submit Button" args={{ type: 'submit' }}>Click me!</Story>
|
|
142
|
-
|
|
143
|
-
<Story
|
|
144
|
-
name="Compact"
|
|
145
|
-
args={{
|
|
146
|
-
compact: true,
|
|
147
|
-
'aria-label': 'Add item',
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
+
|
|
151
|
-
</Story>
|
|
152
|
-
|
|
153
|
-
<Story name="Light Theme" asChild>
|
|
154
|
-
<Theme type="light">
|
|
155
|
-
<UtilityButton>Click me!</UtilityButton>
|
|
156
|
-
</Theme>
|
|
157
|
-
</Story>
|
|
158
|
-
|
|
159
|
-
<Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
|
|
160
|
-
<Theme type="dark">
|
|
161
|
-
<UtilityButton>Click me!</UtilityButton>
|
|
162
|
-
</Theme>
|
|
163
|
-
</Story>
|