@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
|
@@ -3,12 +3,6 @@ export type SelectOption = {
|
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
7
|
-
* Shared base props for the Select component.
|
|
8
|
-
*
|
|
9
|
-
* These props control the visual wrapper (InputEnclosure) and
|
|
10
|
-
* common text-input behaviors.
|
|
11
|
-
*/
|
|
12
6
|
type BaseProps = Omit<ComboboxSingleRootPropsWithoutHTML, 'type'> & Omit<SelectSingleRootPropsWithoutHTML, 'type'>;
|
|
13
7
|
export type SelectProps = BaseProps & {
|
|
14
8
|
/** Visual size token (e.g. small, normal, large) */
|
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
import Theme from '../../Layout/Theme/Theme.svelte';
|
|
10
10
|
import { componentVariantOptions } from '../../../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 '../../../attributes/roundness.js';
|
|
9
9
|
import Theme from '../../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 '../../../attributes/roundness.js';
|
|
9
9
|
import Theme from '../../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,9 +1,4 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
/**
|
|
3
|
-
* Shared base props for the UtilityButton component.
|
|
4
|
-
*
|
|
5
|
-
* These props apply to both the <UtilityButton> and <a> render modes.
|
|
6
|
-
*/
|
|
7
2
|
interface UtilityButtonBaseProps {
|
|
8
3
|
/** UtilityButton contents */
|
|
9
4
|
children?: Snippet;
|
|
@@ -22,30 +17,8 @@ interface UtilityButtonBaseProps {
|
|
|
22
17
|
/** Accessible label (required for icon-only UtilityButtons) */
|
|
23
18
|
'aria-label'?: string;
|
|
24
19
|
}
|
|
25
|
-
/**
|
|
26
|
-
* UtilityButton component props (UtilityButton variant).
|
|
27
|
-
*
|
|
28
|
-
* Renders a semantic <UtilityButton> element when `href` is not provided.
|
|
29
|
-
* Inherits all native HTML UtilityButton attributes.
|
|
30
|
-
*/
|
|
31
20
|
export type UtilityButtonAsButtonProps = UtilityButtonBaseProps & ButtonAsButtonPropsBase;
|
|
32
|
-
/**
|
|
33
|
-
* UtilityButton component props (anchor variant).
|
|
34
|
-
*
|
|
35
|
-
* Renders an <a> element when `href` is provided.
|
|
36
|
-
* Inherits all native HTML anchor attributes, except `type`.
|
|
37
|
-
*/
|
|
38
21
|
export type UtilityButtonAsAnchorProps = UtilityButtonBaseProps & ButtonAsAnchorPropsBase;
|
|
39
|
-
/**
|
|
40
|
-
* UtilityButton component props.
|
|
41
|
-
*
|
|
42
|
-
* Renders a semantic <UtilityButton> by default, or an <a> element when `href` is provided.
|
|
43
|
-
* Supports design-system tokens for size, color, variant, and roundness.
|
|
44
|
-
*
|
|
45
|
-
* This type is a discriminated union:
|
|
46
|
-
* - When `href` is present, anchor props are enabled and UtilityButton-only props are disabled.
|
|
47
|
-
* - When `href` is absent, UtilityButton props are enabled and anchor-only props are disabled.
|
|
48
|
-
*/
|
|
49
22
|
export type UtilityButtonProps = UtilityButtonAsButtonProps | UtilityButtonAsAnchorProps;
|
|
50
23
|
import type { ComponentSize } from '../../../attributes/size.js';
|
|
51
24
|
import type { ComponentColor } from '../../../attributes/color.js';
|
|
@@ -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 '../../../attributes/theme.js';
|
|
12
12
|
import { ComponentShadowOptions } from '../../../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 '../../../attributes/shadow.js';
|
|
9
9
|
import { componentThemeColorsOptions } from '../../../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>
|
|
@@ -25,7 +25,7 @@ export interface CardProps {
|
|
|
25
25
|
outline?: boolean;
|
|
26
26
|
/** Add mouse hover and active effects */
|
|
27
27
|
active?: boolean;
|
|
28
|
-
/** Custom CSS class names applied to the
|
|
28
|
+
/** Custom CSS class names applied to the Card */
|
|
29
29
|
class?: string;
|
|
30
30
|
/** Visual variant (e.g. solid, text) */
|
|
31
31
|
variant?: ComponentVariant;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Grid-Column
|
|
2
|
+
@use '../../../../styles/global/breakpoints' as breakpoints;
|
|
3
|
+
@use 'sass:math';
|
|
4
|
+
@use 'sass:map';
|
|
5
|
+
|
|
6
|
+
// ----------------------------------------
|
|
7
|
+
// Config
|
|
8
|
+
// ----------------------------------------
|
|
9
|
+
|
|
10
|
+
$grid-columns: 12;
|
|
11
|
+
|
|
12
|
+
$breakpoint-keys: (default, sm, md, lg, xl, xxl);
|
|
13
|
+
|
|
14
|
+
// ----------------------------------------
|
|
15
|
+
// Function
|
|
16
|
+
// ----------------------------------------
|
|
17
|
+
|
|
18
|
+
@function col($n) {
|
|
19
|
+
@return math.div(100%, $grid-columns) * $n;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ----------------------------------------
|
|
23
|
+
// Column map
|
|
24
|
+
// ----------------------------------------
|
|
25
|
+
|
|
26
|
+
$column-size: ();
|
|
27
|
+
|
|
28
|
+
@for $i from 1 through $grid-columns {
|
|
29
|
+
$column-size: map.set($column-size, $i, col($i));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ----------------------------------------
|
|
33
|
+
// Mixin (core logic)
|
|
34
|
+
// ----------------------------------------
|
|
35
|
+
|
|
36
|
+
@mixin column-styles($bp) {
|
|
37
|
+
@each $name, $size in $column-size {
|
|
38
|
+
&--#{$name} {
|
|
39
|
+
@if $bp == default {
|
|
40
|
+
width: $size;
|
|
41
|
+
flex: initial;
|
|
42
|
+
} @else {
|
|
43
|
+
@include breakpoints.up($bp) {
|
|
44
|
+
width: $size;
|
|
45
|
+
flex: initial;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&--flex {
|
|
52
|
+
@if $bp == default {
|
|
53
|
+
flex: 1;
|
|
54
|
+
} @else {
|
|
55
|
+
@include breakpoints.up($bp) {
|
|
56
|
+
flex: 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ----------------------------------------
|
|
63
|
+
// Component
|
|
64
|
+
// ----------------------------------------
|
|
65
|
+
|
|
66
|
+
.dodo-ui-Grid-Column {
|
|
67
|
+
display: block;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
padding: calc(var(--dodo-ui-space) * var(--Grid-gap));
|
|
70
|
+
|
|
71
|
+
&.column-size {
|
|
72
|
+
@each $bp in $breakpoint-keys {
|
|
73
|
+
&--#{$bp} {
|
|
74
|
+
@include column-styles($bp);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|