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