@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
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Source } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
1
|
# createDateFactory
|
|
4
2
|
|
|
5
3
|
A **factory function** that creates a `createDate` utility with an optional custom `dayjs` instance.
|
|
@@ -15,13 +13,9 @@ This allows advanced users to:
|
|
|
15
13
|
|
|
16
14
|
## 📦 Import
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
dark
|
|
20
|
-
language="ts"
|
|
21
|
-
code={`
|
|
16
|
+
```ts
|
|
22
17
|
import { createDateFactory } from '@flightlesslabs/dodo-ui';
|
|
23
|
-
|
|
24
|
-
/>
|
|
18
|
+
```
|
|
25
19
|
|
|
26
20
|
---
|
|
27
21
|
|
|
@@ -29,18 +23,14 @@ import { createDateFactory } from '@flightlesslabs/dodo-ui';
|
|
|
29
23
|
|
|
30
24
|
### Default Factory
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
dark
|
|
34
|
-
language="ts"
|
|
35
|
-
code={`
|
|
26
|
+
```ts
|
|
36
27
|
import { createDateFactory } from '@flightlesslabs/dodo-ui';
|
|
37
28
|
|
|
38
29
|
const { createDate } = createDateFactory();
|
|
39
30
|
|
|
40
31
|
const now = createDate();
|
|
41
32
|
console.log(now.format());
|
|
42
|
-
|
|
43
|
-
/>
|
|
33
|
+
```
|
|
44
34
|
|
|
45
35
|
---
|
|
46
36
|
|
|
@@ -59,10 +49,7 @@ Instead of relying on global `dayjs.extend`, you can:
|
|
|
59
49
|
|
|
60
50
|
### Inject your own configured instance
|
|
61
51
|
|
|
62
|
-
|
|
63
|
-
dark
|
|
64
|
-
language="ts"
|
|
65
|
-
code={`
|
|
52
|
+
```ts
|
|
66
53
|
import dayjs from 'dayjs';
|
|
67
54
|
import utc from 'dayjs/plugin/utc';
|
|
68
55
|
import timezone from 'dayjs/plugin/timezone';
|
|
@@ -73,8 +60,7 @@ dayjs.extend(timezone);
|
|
|
73
60
|
const { createDate } = createDateFactory(dayjs);
|
|
74
61
|
|
|
75
62
|
const date = createDate("2025-01-01", "YYYY-MM-DD");
|
|
76
|
-
|
|
77
|
-
/>
|
|
63
|
+
```
|
|
78
64
|
|
|
79
65
|
---
|
|
80
66
|
|
|
@@ -99,29 +85,20 @@ The factory wraps your `dayjs` instance and preserves:
|
|
|
99
85
|
|
|
100
86
|
## 📥 Returned API
|
|
101
87
|
|
|
102
|
-
|
|
103
|
-
dark
|
|
104
|
-
language="ts"
|
|
105
|
-
code={`
|
|
88
|
+
```ts
|
|
106
89
|
{
|
|
107
90
|
createDate: Function,
|
|
108
91
|
dayjs: DayjsInstance
|
|
109
92
|
}
|
|
110
|
-
|
|
111
|
-
/>
|
|
112
|
-
|
|
113
|
-
---
|
|
93
|
+
```
|
|
114
94
|
|
|
115
95
|
## 🧪 Example: Multiple Factories
|
|
116
96
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
language="ts"
|
|
120
|
-
code={`
|
|
97
|
+
|
|
98
|
+
```ts
|
|
121
99
|
const factoryA = createDateFactory(dayjsA);
|
|
122
100
|
const factoryB = createDateFactory(dayjsB);
|
|
123
101
|
|
|
124
102
|
factoryA.createDate("2025-01-01");
|
|
125
103
|
factoryB.createDate("2025-01-01");
|
|
126
|
-
|
|
127
|
-
/>
|
|
104
|
+
```
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Source } from '@storybook/addon-docs/blocks';
|
|
2
|
-
|
|
3
1
|
# timeout
|
|
4
2
|
|
|
5
3
|
A simple utility to delay execution using Promises.
|
|
@@ -10,25 +8,19 @@ Useful for **pausing async workflows**, **simulating delays**, or **controlling
|
|
|
10
8
|
|
|
11
9
|
## 📦 Import
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
dark
|
|
15
|
-
language="ts"
|
|
16
|
-
code={`
|
|
11
|
+
```ts
|
|
17
12
|
import { timeout } from '@flightlesslabs/dodo-ui';
|
|
18
|
-
|
|
19
|
-
/>
|
|
13
|
+
```
|
|
20
14
|
|
|
21
15
|
---
|
|
22
16
|
|
|
23
17
|
## 🚀 Basic Usage
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
code={`
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
```ts
|
|
29
22
|
await timeout(1000); // waits 1 second
|
|
30
|
-
|
|
31
|
-
/>
|
|
23
|
+
```
|
|
32
24
|
|
|
33
25
|
---
|
|
34
26
|
|
|
@@ -36,30 +28,22 @@ await timeout(1000); // waits 1 second
|
|
|
36
28
|
|
|
37
29
|
You can optionally pass a value that will be returned after the delay.
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
dark
|
|
41
|
-
language="ts"
|
|
42
|
-
code={`
|
|
31
|
+
```ts
|
|
43
32
|
const result = await timeout(500, "done");
|
|
44
33
|
|
|
45
34
|
console.log(result); // "done"
|
|
46
|
-
|
|
47
|
-
/>
|
|
35
|
+
```
|
|
48
36
|
|
|
49
37
|
---
|
|
50
38
|
|
|
51
39
|
## ⚙️ API
|
|
52
40
|
|
|
53
|
-
|
|
54
|
-
dark
|
|
55
|
-
language="ts"
|
|
56
|
-
code={`
|
|
41
|
+
```ts
|
|
57
42
|
function timeout<T = void>(
|
|
58
43
|
milliseconds: number,
|
|
59
44
|
value?: T
|
|
60
45
|
): Promise<T>
|
|
61
|
-
|
|
62
|
-
/>
|
|
46
|
+
```
|
|
63
47
|
|
|
64
48
|
---
|
|
65
49
|
|
|
@@ -81,13 +65,9 @@ function timeout<T = void>(
|
|
|
81
65
|
|
|
82
66
|
If a negative duration is provided, the promise will reject:
|
|
83
67
|
|
|
84
|
-
|
|
85
|
-
dark
|
|
86
|
-
language="ts"
|
|
87
|
-
code={`
|
|
68
|
+
```ts
|
|
88
69
|
await timeout(-1); // ❌ throws Error
|
|
89
|
-
|
|
90
|
-
/>
|
|
70
|
+
```
|
|
91
71
|
|
|
92
72
|
---
|
|
93
73
|
|
|
@@ -103,10 +83,7 @@ await timeout(-1); // ❌ throws Error
|
|
|
103
83
|
|
|
104
84
|
### Async Flow
|
|
105
85
|
|
|
106
|
-
|
|
107
|
-
dark
|
|
108
|
-
language="ts"
|
|
109
|
-
code={`
|
|
86
|
+
```ts
|
|
110
87
|
async function run() {
|
|
111
88
|
console.log("Start");
|
|
112
89
|
|
|
@@ -114,8 +91,7 @@ await timeout(1000);
|
|
|
114
91
|
|
|
115
92
|
console.log("End");
|
|
116
93
|
}
|
|
117
|
-
|
|
118
|
-
/>
|
|
94
|
+
```
|
|
119
95
|
|
|
120
96
|
---
|
|
121
97
|
|
|
@@ -131,4 +107,8 @@ console.log(data.success); // true
|
|
|
131
107
|
`}
|
|
132
108
|
/>
|
|
133
109
|
|
|
134
|
-
|
|
110
|
+
```ts
|
|
111
|
+
const data = await timeout(300, { success: true });
|
|
112
|
+
|
|
113
|
+
console.log(data.success); // true
|
|
114
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flightlesslabs/dodo-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"scss:global": "sh -c \"mkdir -p dist/styles && sass src/lib/styles/global/index.scss dist/styles/global.css\"",
|
|
6
6
|
"scss:components": "sh -c \"mkdir -p dist/styles && sass src/lib/styles/components.scss dist/styles/components.css\"",
|
package/src/lib/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 '$lib/attributes/roundness.js';
|
|
10
10
|
import Theme from '$lib/components/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',
|
|
@@ -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 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 '$lib/components/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>
|