@flightlesslabs/dodo-ui 0.21.0 → 0.22.1
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/dist/Home.mdx +25 -36
- package/dist/components/Form/Button/Button.stories.svelte +33 -23
- package/dist/components/Form/Button/Button.svelte +0 -25
- package/dist/components/Form/Button/Button.svelte.d.ts +0 -16
- package/dist/components/Form/Checkbox/Checkbox.stories.svelte +25 -16
- package/dist/components/Form/Checkbox/Checkbox.svelte +0 -3
- package/dist/components/Form/DatePicker/DatePicker.stories.svelte +26 -2
- package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +1 -1
- package/dist/components/Form/FormField/FormField.stories.svelte +15 -10
- package/dist/components/Form/FormField/FormField.svelte +0 -3
- package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte +21 -7
- package/dist/components/Form/InputEnclosure/InputEnclosure.svelte +0 -21
- package/dist/components/Form/InputEnclosure/InputEnclosure.svelte.d.ts +0 -12
- package/dist/components/Form/Select/Select.stories.svelte +18 -3
- package/dist/components/Form/Select/Select.svelte +0 -6
- package/dist/components/Form/Select/Select.svelte.d.ts +0 -6
- package/dist/components/Form/Switch/Switch.stories.svelte +17 -8
- package/dist/components/Form/TextInput/TextInput.stories.svelte +19 -16
- package/dist/components/Form/TextInput/TextInput.svelte +0 -3
- package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte +42 -33
- package/dist/components/Form/UtilityButton/UtilityButton.svelte +0 -36
- package/dist/components/Form/UtilityButton/UtilityButton.svelte.d.ts +0 -27
- package/dist/components/Info/Calendar/Calendar.scss +20 -10
- package/dist/components/Info/Calendar/Calendar.stories.svelte +22 -1
- package/dist/components/Layout/Card/Card.stories.svelte +17 -2
- package/dist/components/Layout/Card/Card.svelte +1 -1
- package/dist/components/Layout/Card/Card.svelte.d.ts +1 -1
- package/dist/components/Layout/Grid/Column/Column.scss +78 -0
- package/dist/components/Layout/Grid/Column/Column.stories.svelte +66 -0
- package/dist/components/Layout/Grid/Column/Column.stories.svelte.d.ts +22 -0
- package/dist/components/Layout/Grid/Column/Column.svelte +79 -0
- package/dist/components/Layout/Grid/Column/Column.svelte.d.ts +33 -0
- package/dist/components/Layout/Grid/Grid.scss +8 -0
- package/dist/components/Layout/Grid/Grid.stories.svelte +192 -0
- package/dist/components/Layout/Grid/Grid.stories.svelte.d.ts +22 -0
- package/dist/components/Layout/Grid/Grid.svelte +32 -0
- package/dist/components/Layout/Grid/Grid.svelte.d.ts +12 -0
- package/dist/components/Layout/Grid/Row/Row.scss +7 -0
- package/dist/components/Layout/Grid/Row/Row.stories.svelte +39 -0
- package/dist/components/Layout/Grid/Row/Row.stories.svelte.d.ts +22 -0
- package/dist/components/Layout/Grid/Row/Row.svelte +21 -0
- package/dist/components/Layout/Grid/Row/Row.svelte.d.ts +10 -0
- package/dist/components/Layout/Theme/Theme.stories.svelte +16 -2
- package/dist/components/Layout/Theme/ThemeSystem/index.mdx +8 -26
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/styles/components.css +468 -6
- package/dist/styles/components.css.map +1 -1
- package/dist/styles/components.scss +3 -0
- package/dist/utils/time/date-creator/createDate/createDate.mdx +13 -38
- package/dist/utils/time/date-creator/createDateFactory/createDateFactory.mdx +11 -34
- package/dist/utils/time/timeout/timeout.mdx +19 -39
- package/package.json +1 -1
- package/src/lib/Home.mdx +25 -36
- package/src/lib/components/Form/Button/Button.stories.svelte +33 -23
- package/src/lib/components/Form/Button/Button.svelte +0 -25
- package/src/lib/components/Form/Checkbox/Checkbox.stories.svelte +25 -16
- package/src/lib/components/Form/Checkbox/Checkbox.svelte +0 -3
- package/src/lib/components/Form/DatePicker/DatePicker.stories.svelte +26 -2
- package/src/lib/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +1 -1
- package/src/lib/components/Form/FormField/FormField.stories.svelte +15 -10
- package/src/lib/components/Form/FormField/FormField.svelte +0 -3
- package/src/lib/components/Form/InputEnclosure/InputEnclosure.stories.svelte +21 -7
- package/src/lib/components/Form/InputEnclosure/InputEnclosure.svelte +0 -21
- package/src/lib/components/Form/Select/Select.stories.svelte +18 -3
- package/src/lib/components/Form/Select/Select.svelte +0 -6
- package/src/lib/components/Form/Switch/Switch.stories.svelte +17 -8
- package/src/lib/components/Form/TextInput/TextInput.stories.svelte +19 -16
- package/src/lib/components/Form/TextInput/TextInput.svelte +0 -3
- package/src/lib/components/Form/UtilityButton/UtilityButton.stories.svelte +42 -33
- package/src/lib/components/Form/UtilityButton/UtilityButton.svelte +0 -36
- package/src/lib/components/Info/Calendar/Calendar.scss +20 -10
- package/src/lib/components/Info/Calendar/Calendar.stories.svelte +22 -1
- package/src/lib/components/Layout/Card/Card.stories.svelte +17 -2
- package/src/lib/components/Layout/Card/Card.svelte +1 -1
- package/src/lib/components/Layout/Grid/Column/Column.scss +78 -0
- package/src/lib/components/Layout/Grid/Column/Column.stories.svelte +66 -0
- package/src/lib/components/Layout/Grid/Column/Column.svelte +79 -0
- package/src/lib/components/Layout/Grid/Grid.scss +8 -0
- package/src/lib/components/Layout/Grid/Grid.stories.svelte +192 -0
- package/src/lib/components/Layout/Grid/Grid.svelte +32 -0
- package/src/lib/components/Layout/Grid/Row/Row.scss +7 -0
- package/src/lib/components/Layout/Grid/Row/Row.stories.svelte +39 -0
- package/src/lib/components/Layout/Grid/Row/Row.svelte +21 -0
- package/src/lib/components/Layout/Theme/Theme.stories.svelte +16 -2
- package/src/lib/components/Layout/Theme/ThemeSystem/index.mdx +8 -26
- package/src/lib/index.ts +17 -0
- package/src/lib/styles/components.scss +3 -0
- package/src/lib/utils/time/date-creator/createDate/createDate.mdx +13 -38
- package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.mdx +11 -34
- package/src/lib/utils/time/timeout/timeout.mdx +19 -39
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
|
|
9
9
|
import Theme from '$lib/components/Layout/Theme/Theme.svelte';
|
|
10
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
|
+
|
|
11
22
|
// ------------------------------
|
|
12
23
|
// Storybook ArgTypes
|
|
13
24
|
// ------------------------------
|
|
@@ -80,6 +91,13 @@
|
|
|
80
91
|
component: InputEnclosure,
|
|
81
92
|
tags: ['autodocs'],
|
|
82
93
|
argTypes: storyInputEnclosureArgTypes,
|
|
94
|
+
parameters: {
|
|
95
|
+
docs: {
|
|
96
|
+
description: {
|
|
97
|
+
component: description,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
83
101
|
});
|
|
84
102
|
</script>
|
|
85
103
|
|
|
@@ -87,7 +105,7 @@
|
|
|
87
105
|
<!-- Stories -->
|
|
88
106
|
<!-- ------------------------------ -->
|
|
89
107
|
|
|
90
|
-
<Story name="Default
|
|
108
|
+
<Story name="Default">
|
|
91
109
|
<input placeholder="Type something…" class="InputBox" />
|
|
92
110
|
</Story>
|
|
93
111
|
|
|
@@ -111,14 +129,10 @@
|
|
|
111
129
|
<input placeholder="Large input…" class="InputBox" />
|
|
112
130
|
</Story>
|
|
113
131
|
|
|
114
|
-
<Story name="Pill Shape" args={{ roundness: 'pill' }}>
|
|
115
|
-
<input placeholder="Pill shaped input…" class="InputBox" />
|
|
116
|
-
</Story>
|
|
117
|
-
|
|
118
132
|
<Story name="With Before (Icon Prefix)" asChild>
|
|
119
133
|
<InputEnclosure>
|
|
120
134
|
{#snippet before()}
|
|
121
|
-
<span style="color: #888;">🔍</span>
|
|
135
|
+
<span style="color: #888; padding-left: 8px">🔍</span>
|
|
122
136
|
{/snippet}
|
|
123
137
|
|
|
124
138
|
<input placeholder="Search…" class="InputBox" />
|
|
@@ -128,7 +142,7 @@
|
|
|
128
142
|
<Story name="With After (Suffix Text)" asChild>
|
|
129
143
|
<InputEnclosure>
|
|
130
144
|
{#snippet after()}
|
|
131
|
-
<span style="color: #888;">.com</span>
|
|
145
|
+
<span style="color: #888; padding-right: 8px">.com</span>
|
|
132
146
|
{/snippet}
|
|
133
147
|
|
|
134
148
|
<input placeholder="Website" class="InputBox" />
|
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Shared base props for the InputEnclosure component.
|
|
7
|
-
*
|
|
8
|
-
* These props apply to the root <div> wrapper that visually encloses
|
|
9
|
-
* form controls such as inputs, selects, or custom fields.
|
|
10
|
-
*/
|
|
11
5
|
interface InputEnclosureBaseProps {
|
|
12
6
|
/** InputEnclosure contents (typically an input or control slot) */
|
|
13
7
|
children?: Snippet;
|
|
@@ -62,12 +56,6 @@
|
|
|
62
56
|
after?: Snippet;
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
/**
|
|
66
|
-
* InputEnclosure component props.
|
|
67
|
-
*
|
|
68
|
-
* Renders a semantic <div> wrapper around form controls.
|
|
69
|
-
* Inherits all native HTML div attributes (e.g. id, style, data-*, aria-*).
|
|
70
|
-
*/
|
|
71
59
|
export type InputEnclosureProps = InputEnclosureBaseProps & HTMLAttributes<HTMLDivElement>;
|
|
72
60
|
</script>
|
|
73
61
|
|
|
@@ -76,12 +64,6 @@
|
|
|
76
64
|
import type { ComponentRoundnessShape } from '$lib/attributes/roundness.js';
|
|
77
65
|
import InputAffix from './InputAffix.svelte';
|
|
78
66
|
|
|
79
|
-
/**
|
|
80
|
-
* InputEnclosure component runtime props.
|
|
81
|
-
*
|
|
82
|
-
* These props are destructured from `$props()` and mapped to
|
|
83
|
-
* CSS utility classes that control visual appearance.
|
|
84
|
-
*/
|
|
85
67
|
let {
|
|
86
68
|
children,
|
|
87
69
|
size = 'normal',
|
|
@@ -97,9 +79,6 @@
|
|
|
97
79
|
...restProps
|
|
98
80
|
}: InputEnclosureProps = $props();
|
|
99
81
|
|
|
100
|
-
/**
|
|
101
|
-
* Computed class list for the InputEnclosure component.
|
|
102
|
-
*/
|
|
103
82
|
const classes = $derived(
|
|
104
83
|
[
|
|
105
84
|
'dodo-ui-InputEnclosure',
|
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
|
|
9
9
|
import Theme from '$lib/components/Layout/Theme/Theme.svelte';
|
|
10
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
|
+
|
|
11
19
|
const options = [
|
|
12
20
|
{ value: 'one', label: 'One' },
|
|
13
21
|
{ value: 'two', label: 'Two' },
|
|
@@ -118,6 +126,13 @@
|
|
|
118
126
|
args: {
|
|
119
127
|
options,
|
|
120
128
|
},
|
|
129
|
+
parameters: {
|
|
130
|
+
docs: {
|
|
131
|
+
description: {
|
|
132
|
+
component: description,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
121
136
|
});
|
|
122
137
|
|
|
123
138
|
let myValue = $state<string | undefined>(options[1].value);
|
|
@@ -131,12 +146,10 @@
|
|
|
131
146
|
|
|
132
147
|
<Story name="Searchable" args={{ searchable: true, placeholder: 'Search a number' }} />
|
|
133
148
|
|
|
134
|
-
<Story name="
|
|
149
|
+
<Story name="Controlled" asChild>
|
|
135
150
|
<Select {options} bind:value={myValue} />
|
|
136
151
|
</Story>
|
|
137
152
|
|
|
138
|
-
<Story name="Disabled" args={{ placeholder: 'Select an option', disabled: true }} />
|
|
139
|
-
|
|
140
153
|
<Story
|
|
141
154
|
name="OnChange (Actions)"
|
|
142
155
|
args={{
|
|
@@ -147,6 +160,8 @@
|
|
|
147
160
|
}}
|
|
148
161
|
/>
|
|
149
162
|
|
|
163
|
+
<Story name="Disabled" args={{ placeholder: 'Select an option', disabled: true }} />
|
|
164
|
+
|
|
150
165
|
<Story name="Light Theme" asChild>
|
|
151
166
|
<Theme type="light">
|
|
152
167
|
<Select {options} />
|
|
@@ -6,12 +6,6 @@
|
|
|
6
6
|
label: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Shared base props for the Select component.
|
|
11
|
-
*
|
|
12
|
-
* These props control the visual wrapper (InputEnclosure) and
|
|
13
|
-
* common text-input behaviors.
|
|
14
|
-
*/
|
|
15
9
|
type BaseProps = Omit<ComboboxSingleRootPropsWithoutHTML, 'type'> &
|
|
16
10
|
Omit<SelectSingleRootPropsWithoutHTML, 'type'>;
|
|
17
11
|
|
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
import Theme from '$lib/components/Layout/Theme/Theme.svelte';
|
|
10
10
|
import { componentVariantOptions } from '$lib/attributes/variant.js';
|
|
11
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
|
+
|
|
12
20
|
/**
|
|
13
21
|
* Storybook controls for Switch
|
|
14
22
|
*/
|
|
@@ -62,6 +70,13 @@
|
|
|
62
70
|
component: Switch,
|
|
63
71
|
tags: ['autodocs'],
|
|
64
72
|
argTypes: SwitchArgTypes,
|
|
73
|
+
parameters: {
|
|
74
|
+
docs: {
|
|
75
|
+
description: {
|
|
76
|
+
component: description,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
65
80
|
});
|
|
66
81
|
|
|
67
82
|
let myValue = $state<boolean>(true);
|
|
@@ -73,7 +88,7 @@
|
|
|
73
88
|
|
|
74
89
|
<Story name="Default" args={{ id: 'Default' }}>Check this text</Story>
|
|
75
90
|
|
|
76
|
-
<Story name="
|
|
91
|
+
<Story name="Controlled" asChild>
|
|
77
92
|
<Switch id="Checked" bind:checked={myValue}>Check this text</Switch>
|
|
78
93
|
</Story>
|
|
79
94
|
|
|
@@ -94,18 +109,12 @@
|
|
|
94
109
|
Check this text
|
|
95
110
|
</Story>
|
|
96
111
|
|
|
97
|
-
<Story name="
|
|
112
|
+
<Story name="Color" args={{ id: 'Safe', color: 'safe' }}>Check this text</Story>
|
|
98
113
|
|
|
99
114
|
<Story name="Large" args={{ id: 'Large', size: 'large' }}>Check this text</Story>
|
|
100
115
|
|
|
101
116
|
<Story name="Disabled" args={{ disabled: true }}>Check this text</Story>
|
|
102
117
|
|
|
103
|
-
<Story name="Safe" args={{ id: 'Safe', color: 'safe' }}>Check this text</Story>
|
|
104
|
-
|
|
105
|
-
<Story name="Danger / Outline" args={{ id: 'Danger-Outline', color: 'danger' }}>
|
|
106
|
-
Check this text
|
|
107
|
-
</Story>
|
|
108
|
-
|
|
109
118
|
<Story name="Light Theme" asChild>
|
|
110
119
|
<Theme type="light">
|
|
111
120
|
<Switch id="Light_Theme">Check this text</Switch>
|
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
|
|
9
9
|
import Theme from '$lib/components/Layout/Theme/Theme.svelte';
|
|
10
10
|
|
|
11
|
+
const description = `
|
|
12
|
+
Input box with powers ⚡
|
|
13
|
+
|
|
14
|
+
\`\`\`ts
|
|
15
|
+
import { TextInput } from '@flightlesslabs/dodo-ui';
|
|
16
|
+
\`\`\`
|
|
17
|
+
`;
|
|
18
|
+
|
|
11
19
|
// ------------------------------
|
|
12
20
|
// Storybook ArgTypes
|
|
13
21
|
// ------------------------------
|
|
@@ -99,6 +107,13 @@
|
|
|
99
107
|
component: TextInput,
|
|
100
108
|
tags: ['autodocs'],
|
|
101
109
|
argTypes: storyTextInputArgTypes,
|
|
110
|
+
parameters: {
|
|
111
|
+
docs: {
|
|
112
|
+
description: {
|
|
113
|
+
component: description,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
102
117
|
});
|
|
103
118
|
</script>
|
|
104
119
|
|
|
@@ -112,16 +127,16 @@
|
|
|
112
127
|
|
|
113
128
|
<Story name="Error" args={{ placeholder: 'Error state…', error: true }} />
|
|
114
129
|
|
|
115
|
-
<Story name="Disabled" args={{ placeholder: 'Disabled state…', disabled: true }} />
|
|
116
|
-
|
|
117
130
|
<Story name="Large" args={{ placeholder: 'Type something…', size: 'large' }} />
|
|
118
131
|
|
|
119
132
|
<Story name="Pill Shape" args={{ placeholder: 'Type something…', roundness: 'pill' }} />
|
|
120
133
|
|
|
134
|
+
<Story name="Disabled" args={{ placeholder: 'Disabled state…', disabled: true }} />
|
|
135
|
+
|
|
121
136
|
<Story name="With Before (Prefix Icon)" asChild>
|
|
122
137
|
<TextInput placeholder="Search…">
|
|
123
138
|
{#snippet before()}
|
|
124
|
-
<span style="color: #888;">🔍</span>
|
|
139
|
+
<span style="color: #888; padding-left: 8px">🔍</span>
|
|
125
140
|
{/snippet}
|
|
126
141
|
</TextInput>
|
|
127
142
|
</Story>
|
|
@@ -129,19 +144,7 @@
|
|
|
129
144
|
<Story name="With After (Suffix Text)" asChild>
|
|
130
145
|
<TextInput placeholder="Website">
|
|
131
146
|
{#snippet after()}
|
|
132
|
-
<span style="color: #888;">.com</span>
|
|
133
|
-
{/snippet}
|
|
134
|
-
</TextInput>
|
|
135
|
-
</Story>
|
|
136
|
-
|
|
137
|
-
<Story name="With Before + After" asChild>
|
|
138
|
-
<TextInput placeholder="Amount">
|
|
139
|
-
{#snippet before()}
|
|
140
|
-
<span style="opacity: 0.6;">$</span>
|
|
141
|
-
{/snippet}
|
|
142
|
-
|
|
143
|
-
{#snippet after()}
|
|
144
|
-
<span style="opacity: 0.6;">USD</span>
|
|
147
|
+
<span style="color: #888; padding-right: 8px">.com</span>
|
|
145
148
|
{/snippet}
|
|
146
149
|
</TextInput>
|
|
147
150
|
</Story>
|
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
|
|
9
9
|
import Theme from '$lib/components/Layout/Theme/Theme.svelte';
|
|
10
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
|
+
|
|
11
19
|
// ------------------------------
|
|
12
20
|
// Storybook ArgTypes
|
|
13
21
|
// ------------------------------
|
|
@@ -83,6 +91,13 @@
|
|
|
83
91
|
component: UtilityButton,
|
|
84
92
|
tags: ['autodocs'],
|
|
85
93
|
argTypes: storyUtilityButtonArgTypes,
|
|
94
|
+
parameters: {
|
|
95
|
+
docs: {
|
|
96
|
+
description: {
|
|
97
|
+
component: description,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
86
101
|
});
|
|
87
102
|
</script>
|
|
88
103
|
|
|
@@ -90,65 +105,59 @@
|
|
|
90
105
|
<!-- Stories -->
|
|
91
106
|
<!-- ------------------------------ -->
|
|
92
107
|
|
|
93
|
-
|
|
94
|
-
<Story name="Primary">Click me!</Story>
|
|
108
|
+
<Story name="Default">Click me!</Story>
|
|
95
109
|
|
|
96
|
-
<Story
|
|
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>
|
|
97
119
|
|
|
98
120
|
<Story
|
|
99
121
|
name="OnClick (Actions)"
|
|
100
122
|
args={{
|
|
101
123
|
onclick: (e: Event) => {
|
|
102
124
|
const target = e.target as HTMLButtonElement;
|
|
103
|
-
alert('
|
|
104
|
-
console.log('
|
|
125
|
+
alert('Button Clicked');
|
|
126
|
+
console.log('Button Clicked', target);
|
|
105
127
|
},
|
|
106
128
|
}}
|
|
107
129
|
>
|
|
108
130
|
Click me
|
|
109
131
|
</Story>
|
|
110
132
|
|
|
133
|
+
<Story name="Color" args={{ color: 'safe' }}>Click me</Story>
|
|
134
|
+
|
|
111
135
|
<Story name="Outline" args={{ outline: true }}>Click me!</Story>
|
|
112
136
|
|
|
113
|
-
<Story name="
|
|
137
|
+
<Story name="Size" args={{ size: 'large' }}>Click me!</Story>
|
|
114
138
|
|
|
115
139
|
<Story name="Disabled" args={{ disabled: true }}>Click me!</Story>
|
|
116
140
|
|
|
117
|
-
<Story name="
|
|
141
|
+
<Story name="Submit Button" args={{ type: 'submit' }}>Click me!</Story>
|
|
118
142
|
|
|
119
|
-
<Story
|
|
143
|
+
<Story
|
|
144
|
+
name="Compact"
|
|
145
|
+
args={{
|
|
146
|
+
compact: true,
|
|
147
|
+
'aria-label': 'Add item',
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
+
|
|
151
|
+
</Story>
|
|
120
152
|
|
|
121
153
|
<Story name="Light Theme" asChild>
|
|
122
154
|
<Theme type="light">
|
|
123
|
-
<UtilityButton>
|
|
155
|
+
<UtilityButton>Click me!</UtilityButton>
|
|
124
156
|
</Theme>
|
|
125
157
|
</Story>
|
|
126
158
|
|
|
127
159
|
<Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
|
|
128
160
|
<Theme type="dark">
|
|
129
|
-
<UtilityButton>
|
|
161
|
+
<UtilityButton>Click me!</UtilityButton>
|
|
130
162
|
</Theme>
|
|
131
163
|
</Story>
|
|
132
|
-
|
|
133
|
-
<Story name="Submit UtilityButton" args={{ type: 'submit' }}>Submit Form</Story>
|
|
134
|
-
|
|
135
|
-
<Story
|
|
136
|
-
name="Link UtilityButton"
|
|
137
|
-
args={{
|
|
138
|
-
href: 'https://www.w3schools.com/tags/tag_a.asp',
|
|
139
|
-
target: '_blank',
|
|
140
|
-
}}
|
|
141
|
-
>
|
|
142
|
-
External Link
|
|
143
|
-
</Story>
|
|
144
|
-
|
|
145
|
-
<Story
|
|
146
|
-
name="Icon Only (A11y Example)"
|
|
147
|
-
args={{
|
|
148
|
-
compact: true,
|
|
149
|
-
roundness: 'full',
|
|
150
|
-
'aria-label': 'Add item',
|
|
151
|
-
}}
|
|
152
|
-
>
|
|
153
|
-
+
|
|
154
|
-
</Story>
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Shared base props for the UtilityButton component.
|
|
6
|
-
*
|
|
7
|
-
* These props apply to both the <UtilityButton> and <a> render modes.
|
|
8
|
-
*/
|
|
9
4
|
interface UtilityButtonBaseProps {
|
|
10
5
|
/** UtilityButton contents */
|
|
11
6
|
children?: Snippet;
|
|
@@ -32,32 +27,10 @@
|
|
|
32
27
|
'aria-label'?: string;
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
/**
|
|
36
|
-
* UtilityButton component props (UtilityButton variant).
|
|
37
|
-
*
|
|
38
|
-
* Renders a semantic <UtilityButton> element when `href` is not provided.
|
|
39
|
-
* Inherits all native HTML UtilityButton attributes.
|
|
40
|
-
*/
|
|
41
30
|
export type UtilityButtonAsButtonProps = UtilityButtonBaseProps & ButtonAsButtonPropsBase;
|
|
42
31
|
|
|
43
|
-
/**
|
|
44
|
-
* UtilityButton component props (anchor variant).
|
|
45
|
-
*
|
|
46
|
-
* Renders an <a> element when `href` is provided.
|
|
47
|
-
* Inherits all native HTML anchor attributes, except `type`.
|
|
48
|
-
*/
|
|
49
32
|
export type UtilityButtonAsAnchorProps = UtilityButtonBaseProps & ButtonAsAnchorPropsBase;
|
|
50
33
|
|
|
51
|
-
/**
|
|
52
|
-
* UtilityButton component props.
|
|
53
|
-
*
|
|
54
|
-
* Renders a semantic <UtilityButton> by default, or an <a> element when `href` is provided.
|
|
55
|
-
* Supports design-system tokens for size, color, variant, and roundness.
|
|
56
|
-
*
|
|
57
|
-
* This type is a discriminated union:
|
|
58
|
-
* - When `href` is present, anchor props are enabled and UtilityButton-only props are disabled.
|
|
59
|
-
* - When `href` is absent, UtilityButton props are enabled and anchor-only props are disabled.
|
|
60
|
-
*/
|
|
61
34
|
export type UtilityButtonProps = UtilityButtonAsButtonProps | UtilityButtonAsAnchorProps;
|
|
62
35
|
</script>
|
|
63
36
|
|
|
@@ -70,12 +43,6 @@
|
|
|
70
43
|
import ButtonAsButton from '../Button/ButtonAsButton.svelte';
|
|
71
44
|
import type { ButtonAsButtonProps as ButtonAsButtonPropsBase } from '../Button/ButtonAsButton.svelte';
|
|
72
45
|
|
|
73
|
-
/**
|
|
74
|
-
* UtilityButton component runtime props.
|
|
75
|
-
*
|
|
76
|
-
* These props are destructured from `$props()` and mapped to the underlying
|
|
77
|
-
* Bits UI UtilityButton root component, with semantic rendering based on `href`.
|
|
78
|
-
*/
|
|
79
46
|
let {
|
|
80
47
|
size = 'normal',
|
|
81
48
|
color = 'primary',
|
|
@@ -91,9 +58,6 @@
|
|
|
91
58
|
...restProps
|
|
92
59
|
}: UtilityButtonProps = $props();
|
|
93
60
|
|
|
94
|
-
/**
|
|
95
|
-
* Computed class list for the UtilityButton component.
|
|
96
|
-
*/
|
|
97
61
|
const classes = $derived(
|
|
98
62
|
[
|
|
99
63
|
'dodo-ui-UtilityButton',
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use '../../../styles/global/breakpoints' as breakpoints;
|
|
2
|
+
|
|
1
3
|
// ----------------------------------------
|
|
2
4
|
// Theme tokens (global CSS variables)
|
|
3
5
|
// ----------------------------------------
|
|
@@ -13,11 +15,14 @@
|
|
|
13
15
|
|
|
14
16
|
.dodo-ui-Calendar {
|
|
15
17
|
font-size: 1rem;
|
|
16
|
-
padding: var(--dodo-ui-space);
|
|
17
18
|
color: var(--dodo-color-neutral-900);
|
|
18
19
|
display: inline-flex;
|
|
19
20
|
flex-direction: column;
|
|
20
21
|
|
|
22
|
+
@include breakpoints.up('sm') {
|
|
23
|
+
padding: var(--dodo-ui-space);
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
[data-calendar-header] {
|
|
22
27
|
display: flex;
|
|
23
28
|
justify-content: space-between;
|
|
@@ -32,9 +37,9 @@
|
|
|
32
37
|
font-weight: 500;
|
|
33
38
|
}
|
|
34
39
|
|
|
35
|
-
[data-calendar-next-button],
|
|
36
|
-
[data-calendar-prev-button] {
|
|
37
|
-
font-size: 1.
|
|
40
|
+
button[data-calendar-next-button],
|
|
41
|
+
button[data-calendar-prev-button] {
|
|
42
|
+
font-size: 1.4em;
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
[data-calendar-grid] {
|
|
@@ -124,14 +129,19 @@
|
|
|
124
129
|
bottom: 0.2em;
|
|
125
130
|
}
|
|
126
131
|
}
|
|
127
|
-
}
|
|
128
132
|
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
&[data-outside-month],
|
|
134
|
+
&[data-disabled] {
|
|
135
|
+
color: var(--dodo-color-neutral-400);
|
|
131
136
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
&:hover {
|
|
138
|
+
background-color: initial;
|
|
139
|
+
border-color: transparent;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&[data-today] {
|
|
143
|
+
background-color: initial;
|
|
144
|
+
}
|
|
135
145
|
}
|
|
136
146
|
}
|
|
137
147
|
}
|
|
@@ -11,6 +11,14 @@
|
|
|
11
11
|
import { componentThemeColorsOptions } from '$lib/attributes/theme.js';
|
|
12
12
|
import { ComponentShadowOptions } from '$lib/attributes/shadow.js';
|
|
13
13
|
|
|
14
|
+
const description = `
|
|
15
|
+
a plug and play Calendar component based on bits-ui [calendar](https://bits-ui.com/docs/components/calendar).
|
|
16
|
+
|
|
17
|
+
\`\`\`ts
|
|
18
|
+
import { Calendar } from '@flightlesslabs/dodo-ui';
|
|
19
|
+
\`\`\`
|
|
20
|
+
`;
|
|
21
|
+
|
|
14
22
|
// ------------------------------
|
|
15
23
|
// Storybook ArgTypes
|
|
16
24
|
// ------------------------------
|
|
@@ -85,6 +93,13 @@
|
|
|
85
93
|
component: Calendar,
|
|
86
94
|
tags: ['autodocs'],
|
|
87
95
|
argTypes: storyCalendarArgTypes,
|
|
96
|
+
parameters: {
|
|
97
|
+
docs: {
|
|
98
|
+
description: {
|
|
99
|
+
component: description,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
88
103
|
});
|
|
89
104
|
|
|
90
105
|
let myValue = $state<DateValue>(new CalendarDate(2026, 4, 7));
|
|
@@ -96,10 +111,16 @@
|
|
|
96
111
|
|
|
97
112
|
<Story name="Default" />
|
|
98
113
|
|
|
99
|
-
<Story name="
|
|
114
|
+
<Story name="Controlled" asChild>
|
|
100
115
|
<Calendar bind:value={myValue} />
|
|
101
116
|
</Story>
|
|
102
117
|
|
|
118
|
+
<Story name="Starts On Sunday" args={{ weekStartsOn: 0 }} />
|
|
119
|
+
|
|
120
|
+
<Story name="Min Date" args={{ minValue: new CalendarDate(2026, 4, 7) }} />
|
|
121
|
+
|
|
122
|
+
<Story name="Max Date" args={{ maxValue: new CalendarDate(2026, 4, 7) }} />
|
|
123
|
+
|
|
103
124
|
<Story name="Light Theme" asChild>
|
|
104
125
|
<Theme type="light">
|
|
105
126
|
<Calendar />
|
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
import { ComponentShadowOptions } from '$lib/attributes/shadow.js';
|
|
9
9
|
import { componentThemeColorsOptions } from '$lib/attributes/theme.js';
|
|
10
10
|
|
|
11
|
+
const description = `
|
|
12
|
+
a simple, customizable, and re-usable card component
|
|
13
|
+
|
|
14
|
+
\`\`\`ts
|
|
15
|
+
import { Card } from '@flightlesslabs/dodo-ui';
|
|
16
|
+
\`\`\`
|
|
17
|
+
`;
|
|
18
|
+
|
|
11
19
|
// ------------------------------
|
|
12
20
|
// Storybook ArgTypes
|
|
13
21
|
// ------------------------------
|
|
@@ -70,6 +78,13 @@
|
|
|
70
78
|
component: Card,
|
|
71
79
|
tags: ['autodocs'],
|
|
72
80
|
argTypes: storyCardArgTypes,
|
|
81
|
+
parameters: {
|
|
82
|
+
docs: {
|
|
83
|
+
description: {
|
|
84
|
+
component: description,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
73
88
|
});
|
|
74
89
|
</script>
|
|
75
90
|
|
|
@@ -79,7 +94,7 @@
|
|
|
79
94
|
|
|
80
95
|
<Story name="Default"><p>Hello there</p></Story>
|
|
81
96
|
|
|
82
|
-
<Story name="
|
|
97
|
+
<Story name="Color" args={{ color: 'safe' }}><p>Hello there</p></Story>
|
|
83
98
|
|
|
84
99
|
<Story name="Active" args={{ color: 'primary', active: true }}><p>Hello there</p></Story>
|
|
85
100
|
|
|
@@ -87,7 +102,7 @@
|
|
|
87
102
|
|
|
88
103
|
<Story name="Outline" args={{ outline: true, shadow: 0 }}><p>Hello there</p></Story>
|
|
89
104
|
|
|
90
|
-
<Story name="
|
|
105
|
+
<Story name="Fixed Size" args={{ height: '200px', width: '250px' }}><p>Hello there</p></Story>
|
|
91
106
|
|
|
92
107
|
<Story name="Light Theme" args={{ theme: 'light' }}>
|
|
93
108
|
<p>Hello there</p>
|