@flightlesslabs/dodo-ui 0.22.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/Grid/Grid.stories.svelte +15 -0
- package/dist/components/Layout/Theme/Theme.stories.svelte +16 -2
- package/dist/components/Layout/Theme/ThemeSystem/index.mdx +8 -26
- package/dist/styles/components.css +13 -6
- package/dist/styles/components.css.map +1 -1
- 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/Grid/Grid.stories.svelte +15 -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/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
package/dist/Home.mdx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Source } from '@storybook/addon-docs/blocks';
|
|
2
1
|
import item from '../../package.json?raw';
|
|
3
2
|
|
|
4
3
|
<main style={{ textAlign: 'center' }}>
|
|
@@ -20,58 +19,48 @@ import item from '../../package.json?raw';
|
|
|
20
19
|
<br />
|
|
21
20
|
<br />
|
|
22
21
|
|
|
23
|
-
##
|
|
22
|
+
## 🚀 Installation
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
language="bash"
|
|
28
|
-
code={`
|
|
24
|
+
|
|
25
|
+
```bash
|
|
29
26
|
pnpm add bits-ui @internationalized/date @flightlesslabs/dodo-ui
|
|
30
|
-
|
|
31
|
-
/>
|
|
27
|
+
```
|
|
32
28
|
|
|
33
29
|
We are using **bits-ui@{JSON.parse(item).devDependencies['bits-ui']}** internally
|
|
34
30
|
|
|
35
|
-
## Add
|
|
31
|
+
## 🎨 Add Styles
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
Import global styles in your root component. use the root layout (`+layout.svelte`) for SvelteKit.
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
dark
|
|
41
|
-
language="js"
|
|
42
|
-
code={`
|
|
35
|
+
```ts
|
|
43
36
|
import '@flightlesslabs/dodo-ui/styles/global.css';
|
|
44
37
|
import '@flightlesslabs/dodo-ui/styles/components.css';
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 🌗 Theme Setup
|
|
47
41
|
|
|
48
|
-
|
|
42
|
+
Wrap your application with the [Theme](?path=/docs/components-layout-theme--docs) component at the root level.
|
|
49
43
|
|
|
50
|
-
We recommend that the [Theme](?path=/docs/components-layout-theme--docs) component should be imported in the `_layout.svelte` (SvelteKit) or any other root location.
|
|
51
44
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
language="js"
|
|
55
|
-
code={`
|
|
56
|
-
import { Theme } '@flightlesslabs/dodo-ui';
|
|
45
|
+
```ts
|
|
46
|
+
import { Theme } from '@flightlesslabs/dodo-ui';
|
|
57
47
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/>
|
|
48
|
+
<Theme global>
|
|
49
|
+
<!-- Your app -->
|
|
50
|
+
</Theme>
|
|
51
|
+
```
|
|
63
52
|
|
|
64
|
-
|
|
53
|
+
Recommended: Place this in your root layout (`+layout.svelte`) for SvelteKit.
|
|
65
54
|
|
|
66
|
-
|
|
55
|
+
✨ Usage
|
|
67
56
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
code={`
|
|
57
|
+
Start by importing components like [Button](?path=/docs/components-form-button--docs).
|
|
58
|
+
|
|
59
|
+
```ts
|
|
72
60
|
import { Button } '@flightlesslabs/dodo-ui';
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
|
|
62
|
+
<Button>Hello</Button>
|
|
63
|
+
```
|
|
75
64
|
|
|
76
65
|
## Explore more
|
|
77
66
|
|
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
import { componentRoundnessOptions } from '../../../attributes/roundness.js';
|
|
10
10
|
import Theme from '../../Layout/Theme/Theme.svelte';
|
|
11
11
|
|
|
12
|
+
const description = `
|
|
13
|
+
A flexible Button component based on bits-ui [button](https://bits-ui.com/docs/components/button).
|
|
14
|
+
\`\`\`ts
|
|
15
|
+
import { Button } from '@flightlesslabs/dodo-ui';
|
|
16
|
+
\`\`\`
|
|
17
|
+
`;
|
|
18
|
+
|
|
12
19
|
// ------------------------------
|
|
13
20
|
// Storybook ArgTypes
|
|
14
21
|
// ------------------------------
|
|
@@ -95,6 +102,13 @@
|
|
|
95
102
|
component: Button,
|
|
96
103
|
tags: ['autodocs'],
|
|
97
104
|
argTypes: storyButtonArgTypes,
|
|
105
|
+
parameters: {
|
|
106
|
+
docs: {
|
|
107
|
+
description: {
|
|
108
|
+
component: description,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
98
112
|
});
|
|
99
113
|
</script>
|
|
100
114
|
|
|
@@ -102,9 +116,17 @@
|
|
|
102
116
|
<!-- Stories -->
|
|
103
117
|
<!-- ------------------------------ -->
|
|
104
118
|
|
|
105
|
-
<Story name="
|
|
119
|
+
<Story name="Default">Click me!</Story>
|
|
106
120
|
|
|
107
|
-
<Story
|
|
121
|
+
<Story
|
|
122
|
+
name="Link Button"
|
|
123
|
+
args={{
|
|
124
|
+
href: 'https://www.w3schools.com/tags/tag_a.asp',
|
|
125
|
+
target: '_blank',
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
Click me!
|
|
129
|
+
</Story>
|
|
108
130
|
|
|
109
131
|
<Story
|
|
110
132
|
name="OnClick (Actions)"
|
|
@@ -119,34 +141,22 @@
|
|
|
119
141
|
Click me
|
|
120
142
|
</Story>
|
|
121
143
|
|
|
122
|
-
<Story name="
|
|
144
|
+
<Story name="Color" args={{ color: 'safe' }}>Click me</Story>
|
|
123
145
|
|
|
124
|
-
<Story name="
|
|
146
|
+
<Story name="Text" args={{ variant: 'text' }}>Click me!</Story>
|
|
125
147
|
|
|
126
|
-
<Story name="
|
|
148
|
+
<Story name="Outline" args={{ variant: 'text', outline: true }}>Click me!</Story>
|
|
127
149
|
|
|
128
|
-
<Story name="
|
|
150
|
+
<Story name="Size" args={{ size: 'large' }}>Click me!</Story>
|
|
129
151
|
|
|
130
|
-
<Story name="
|
|
131
|
-
Danger
|
|
132
|
-
</Story>
|
|
152
|
+
<Story name="Disabled" args={{ disabled: true }}>Click me!</Story>
|
|
133
153
|
|
|
134
|
-
<Story name="Submit Button" args={{ type: 'submit' }}>
|
|
154
|
+
<Story name="Submit Button" args={{ type: 'submit' }}>Click me!</Story>
|
|
135
155
|
|
|
136
156
|
<Story name="Full Width" args={{ fullWidth: true }}>Click me!</Story>
|
|
137
157
|
|
|
138
158
|
<Story
|
|
139
|
-
name="
|
|
140
|
-
args={{
|
|
141
|
-
href: 'https://www.w3schools.com/tags/tag_a.asp',
|
|
142
|
-
target: '_blank',
|
|
143
|
-
}}
|
|
144
|
-
>
|
|
145
|
-
External Link
|
|
146
|
-
</Story>
|
|
147
|
-
|
|
148
|
-
<Story
|
|
149
|
-
name="Icon Only (A11y Example)"
|
|
159
|
+
name="Compact"
|
|
150
160
|
args={{
|
|
151
161
|
compact: true,
|
|
152
162
|
'aria-label': 'Add item',
|
|
@@ -157,12 +167,12 @@
|
|
|
157
167
|
|
|
158
168
|
<Story name="Light Theme" asChild>
|
|
159
169
|
<Theme type="light">
|
|
160
|
-
<Button>
|
|
170
|
+
<Button>Click me!</Button>
|
|
161
171
|
</Theme>
|
|
162
172
|
</Story>
|
|
163
173
|
|
|
164
174
|
<Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
|
|
165
175
|
<Theme type="dark">
|
|
166
|
-
<Button>
|
|
176
|
+
<Button>Click me!</Button>
|
|
167
177
|
</Theme>
|
|
168
178
|
</Story>
|
|
@@ -46,24 +46,8 @@
|
|
|
46
46
|
*/
|
|
47
47
|
export type ButtonAsButtonProps = ButtonBaseProps & ButtonAsButtonPropsBase;
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* Button component props (anchor variant).
|
|
51
|
-
*
|
|
52
|
-
* Renders an <a> element when `href` is provided.
|
|
53
|
-
* Inherits all native HTML anchor attributes, except `type`.
|
|
54
|
-
*/
|
|
55
49
|
export type ButtonAsAnchorProps = ButtonBaseProps & ButtonAsAnchorPropsBase;
|
|
56
50
|
|
|
57
|
-
/**
|
|
58
|
-
* Button component props.
|
|
59
|
-
*
|
|
60
|
-
* Renders a semantic <button> by default, or an <a> element when `href` is provided.
|
|
61
|
-
* Supports design-system tokens for size, color, variant, and roundness.
|
|
62
|
-
*
|
|
63
|
-
* This type is a discriminated union:
|
|
64
|
-
* - When `href` is present, anchor props are enabled and button-only props are disabled.
|
|
65
|
-
* - When `href` is absent, button props are enabled and anchor-only props are disabled.
|
|
66
|
-
*/
|
|
67
51
|
export type ButtonProps = ButtonAsButtonProps | ButtonAsAnchorProps;
|
|
68
52
|
</script>
|
|
69
53
|
|
|
@@ -77,12 +61,6 @@
|
|
|
77
61
|
import type { ButtonAsButtonProps as ButtonAsButtonPropsBase } from './ButtonAsButton.svelte';
|
|
78
62
|
import ButtonAsButton from './ButtonAsButton.svelte';
|
|
79
63
|
|
|
80
|
-
/**
|
|
81
|
-
* Button component runtime props.
|
|
82
|
-
*
|
|
83
|
-
* These props are destructured from `$props()` and mapped to the underlying
|
|
84
|
-
* Bits UI Button root component, with semantic rendering based on `href`.
|
|
85
|
-
*/
|
|
86
64
|
let {
|
|
87
65
|
size = 'normal',
|
|
88
66
|
color = 'primary',
|
|
@@ -100,9 +78,6 @@
|
|
|
100
78
|
...restProps
|
|
101
79
|
}: ButtonProps = $props();
|
|
102
80
|
|
|
103
|
-
/**
|
|
104
|
-
* Computed class list for the Button component.
|
|
105
|
-
*/
|
|
106
81
|
const classes = $derived(
|
|
107
82
|
[
|
|
108
83
|
'dodo-ui-Button',
|
|
@@ -33,23 +33,7 @@ interface ButtonBaseProps {
|
|
|
33
33
|
* Inherits all native HTML button attributes.
|
|
34
34
|
*/
|
|
35
35
|
export type ButtonAsButtonProps = ButtonBaseProps & ButtonAsButtonPropsBase;
|
|
36
|
-
/**
|
|
37
|
-
* Button component props (anchor variant).
|
|
38
|
-
*
|
|
39
|
-
* Renders an <a> element when `href` is provided.
|
|
40
|
-
* Inherits all native HTML anchor attributes, except `type`.
|
|
41
|
-
*/
|
|
42
36
|
export type ButtonAsAnchorProps = ButtonBaseProps & ButtonAsAnchorPropsBase;
|
|
43
|
-
/**
|
|
44
|
-
* Button component props.
|
|
45
|
-
*
|
|
46
|
-
* Renders a semantic <button> by default, or an <a> element when `href` is provided.
|
|
47
|
-
* Supports design-system tokens for size, color, variant, and roundness.
|
|
48
|
-
*
|
|
49
|
-
* This type is a discriminated union:
|
|
50
|
-
* - When `href` is present, anchor props are enabled and button-only props are disabled.
|
|
51
|
-
* - When `href` is absent, button props are enabled and anchor-only props are disabled.
|
|
52
|
-
*/
|
|
53
37
|
export type ButtonProps = ButtonAsButtonProps | ButtonAsAnchorProps;
|
|
54
38
|
import type { ComponentSize } from '../../../attributes/size.js';
|
|
55
39
|
import type { ComponentColor } from '../../../attributes/color.js';
|
|
@@ -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 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
|
+
|
|
12
20
|
/**
|
|
13
21
|
* Storybook controls for Checkbox
|
|
14
22
|
*/
|
|
@@ -62,6 +70,13 @@
|
|
|
62
70
|
component: Checkbox,
|
|
63
71
|
tags: ['autodocs'],
|
|
64
72
|
argTypes: CheckboxArgTypes,
|
|
73
|
+
parameters: {
|
|
74
|
+
docs: {
|
|
75
|
+
description: {
|
|
76
|
+
component: description,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
65
80
|
});
|
|
66
81
|
|
|
67
82
|
let myValue = $state<boolean>(true);
|
|
@@ -73,18 +88,10 @@
|
|
|
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
|
<Checkbox id="Checked" bind:checked={myValue}>Check this text</Checkbox>
|
|
78
93
|
</Story>
|
|
79
94
|
|
|
80
|
-
<Story name="Solid" args={{ id: 'Solid', variant: 'solid', checked: true }}>Check this text</Story>
|
|
81
|
-
|
|
82
|
-
<Story name="NoOutline" args={{ id: 'Outline', outline: false }}>Check this text</Story>
|
|
83
|
-
|
|
84
|
-
<Story name="Indeterminate" args={{ id: 'indeterminate', indeterminate: true }}>
|
|
85
|
-
Check this text
|
|
86
|
-
</Story>
|
|
87
|
-
|
|
88
95
|
<Story
|
|
89
96
|
name="OnChange (Actions)"
|
|
90
97
|
args={{
|
|
@@ -98,17 +105,19 @@
|
|
|
98
105
|
Check this text
|
|
99
106
|
</Story>
|
|
100
107
|
|
|
101
|
-
<Story name="
|
|
108
|
+
<Story name="Indeterminate" args={{ id: 'indeterminate', indeterminate: true }}>
|
|
109
|
+
Check this text
|
|
110
|
+
</Story>
|
|
102
111
|
|
|
103
|
-
<Story name="
|
|
112
|
+
<Story name="Color" args={{ id: 'Safe', color: 'safe' }}>Check this text</Story>
|
|
104
113
|
|
|
105
|
-
<Story name="
|
|
114
|
+
<Story name="Solid" args={{ id: 'Solid', variant: 'solid', checked: true }}>Check this text</Story>
|
|
106
115
|
|
|
107
|
-
<Story name="
|
|
116
|
+
<Story name="NoOutline" args={{ id: 'Outline', outline: false }}>Check this text</Story>
|
|
108
117
|
|
|
109
|
-
<Story name="
|
|
110
|
-
|
|
111
|
-
</Story>
|
|
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>
|
|
112
121
|
|
|
113
122
|
<Story name="Light Theme" asChild>
|
|
114
123
|
<Theme type="light">
|
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
import { CalendarDate, type DateValue } from '@internationalized/date';
|
|
10
10
|
import Theme from '../../Layout/Theme/Theme.svelte';
|
|
11
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
|
+
|
|
12
21
|
// ------------------------------
|
|
13
22
|
// Storybook ArgTypes
|
|
14
23
|
// ------------------------------
|
|
@@ -86,6 +95,14 @@
|
|
|
86
95
|
component: DatePicker,
|
|
87
96
|
tags: ['autodocs'],
|
|
88
97
|
argTypes: storyDatePickerArgTypes,
|
|
98
|
+
parameters: {
|
|
99
|
+
docs: {
|
|
100
|
+
description: {
|
|
101
|
+
component: description,
|
|
102
|
+
},
|
|
103
|
+
story: { height: '420px' },
|
|
104
|
+
},
|
|
105
|
+
},
|
|
89
106
|
});
|
|
90
107
|
|
|
91
108
|
let myValue = $state<DateValue>(new CalendarDate(2026, 4, 7));
|
|
@@ -97,11 +114,18 @@
|
|
|
97
114
|
|
|
98
115
|
<Story name="Default" />
|
|
99
116
|
|
|
100
|
-
|
|
101
|
-
<Story name="Selected" asChild>
|
|
117
|
+
<Story name="Controlled" asChild>
|
|
102
118
|
<DatePicker bind:value={myValue} />
|
|
103
119
|
</Story>
|
|
104
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
|
+
|
|
105
129
|
<Story name="Light Theme" asChild>
|
|
106
130
|
<Theme type="light">
|
|
107
131
|
<DatePicker />
|
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
6
|
import TextInput from '../TextInput/TextInput.svelte';
|
|
7
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
|
+
|
|
8
15
|
/**
|
|
9
16
|
* Storybook controls for FormField
|
|
10
17
|
*/
|
|
@@ -22,6 +29,13 @@
|
|
|
22
29
|
component: FormField,
|
|
23
30
|
tags: ['autodocs'],
|
|
24
31
|
argTypes: FormFieldArgTypes,
|
|
32
|
+
parameters: {
|
|
33
|
+
docs: {
|
|
34
|
+
description: {
|
|
35
|
+
component: description,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
25
39
|
});
|
|
26
40
|
</script>
|
|
27
41
|
|
|
@@ -29,15 +43,6 @@
|
|
|
29
43
|
<!-- Stories -->
|
|
30
44
|
<!-- ------------------------------ -->
|
|
31
45
|
|
|
32
|
-
<Story name="
|
|
46
|
+
<Story name="Defualt" args={{ label: 'Name:', for: 'name' }}>
|
|
33
47
|
<TextInput placeholder="Type something…" name="name" />
|
|
34
48
|
</Story>
|
|
35
|
-
|
|
36
|
-
<Story name="CustomLabel" asChild>
|
|
37
|
-
<FormField for="name2">
|
|
38
|
-
{#snippet label()}
|
|
39
|
-
Custom Label
|
|
40
|
-
{/snippet}
|
|
41
|
-
<TextInput placeholder="Type something…" name="name2" />
|
|
42
|
-
</FormField>
|
|
43
|
-
</Story>
|
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
import { componentRoundnessOptions } from '../../../attributes/roundness.js';
|
|
9
9
|
import Theme from '../../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 '../../../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',
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
/**
|
|
4
|
-
* Shared base props for the InputEnclosure component.
|
|
5
|
-
*
|
|
6
|
-
* These props apply to the root <div> wrapper that visually encloses
|
|
7
|
-
* form controls such as inputs, selects, or custom fields.
|
|
8
|
-
*/
|
|
9
3
|
interface InputEnclosureBaseProps {
|
|
10
4
|
/** InputEnclosure contents (typically an input or control slot) */
|
|
11
5
|
children?: Snippet;
|
|
@@ -49,12 +43,6 @@ interface InputEnclosureBaseProps {
|
|
|
49
43
|
*/
|
|
50
44
|
after?: Snippet;
|
|
51
45
|
}
|
|
52
|
-
/**
|
|
53
|
-
* InputEnclosure component props.
|
|
54
|
-
*
|
|
55
|
-
* Renders a semantic <div> wrapper around form controls.
|
|
56
|
-
* Inherits all native HTML div attributes (e.g. id, style, data-*, aria-*).
|
|
57
|
-
*/
|
|
58
46
|
export type InputEnclosureProps = InputEnclosureBaseProps & HTMLAttributes<HTMLDivElement>;
|
|
59
47
|
import type { ComponentSize } from '../../../attributes/size.js';
|
|
60
48
|
import type { ComponentRoundnessShape } from '../../../attributes/roundness.js';
|
|
@@ -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 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
|
|