@flightlesslabs/dodo-ui 0.22.2 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -9
- package/dist/index.d.ts +4 -10
- package/dist/index.js +5 -10
- package/dist/styles/components.css +0 -154
- package/dist/styles/components.css.map +1 -1
- package/dist/styles/components.scss +0 -2
- package/package.json +27 -41
- package/src/lib/index.ts +6 -19
- package/src/lib/styles/components.scss +0 -2
- package/src/lib/utils/time/date-creator/createDate/createDate.test.ts +109 -0
- package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.test.ts +146 -0
- package/dist/Home.mdx +0 -69
- package/dist/components/Form/Button/Button.stories.svelte +0 -178
- package/dist/components/Form/Button/Button.stories.svelte.d.ts +0 -22
- package/dist/components/Form/Checkbox/Checkbox.stories.svelte +0 -132
- package/dist/components/Form/Checkbox/Checkbox.stories.svelte.d.ts +0 -25
- package/dist/components/Form/DatePicker/DatePicker.scss +0 -55
- package/dist/components/Form/DatePicker/DatePicker.stories.svelte +0 -139
- package/dist/components/Form/DatePicker/DatePicker.stories.svelte.d.ts +0 -22
- package/dist/components/Form/DatePicker/DatePicker.svelte +0 -136
- package/dist/components/Form/DatePicker/DatePicker.svelte.d.ts +0 -64
- package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +0 -96
- package/dist/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte.d.ts +0 -23
- package/dist/components/Form/DatePicker/DatePickerInput/Segments.svelte +0 -17
- package/dist/components/Form/DatePicker/DatePickerInput/Segments.svelte.d.ts +0 -8
- package/dist/components/Form/DatePicker/DatePickerInput/utils.d.ts +0 -10
- package/dist/components/Form/DatePicker/DatePickerInput/utils.js +0 -26
- package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +0 -35
- package/dist/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte.d.ts +0 -4
- package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +0 -52
- package/dist/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte.d.ts +0 -6
- package/dist/components/Form/DatePicker/DatePickerPopup/Header.svelte +0 -25
- package/dist/components/Form/DatePicker/DatePickerPopup/Header.svelte.d.ts +0 -3
- package/dist/components/Form/FormField/FormField.stories.svelte +0 -48
- package/dist/components/Form/FormField/FormField.stories.svelte.d.ts +0 -25
- package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte +0 -166
- package/dist/components/Form/InputEnclosure/InputEnclosure.stories.svelte.d.ts +0 -22
- package/dist/components/Form/Label/Label.stories.svelte +0 -31
- package/dist/components/Form/Label/Label.stories.svelte.d.ts +0 -25
- package/dist/components/Form/RadioGroup/Radio/Radio.stories.svelte +0 -78
- package/dist/components/Form/RadioGroup/Radio/Radio.stories.svelte.d.ts +0 -25
- package/dist/components/Form/RadioGroup/RadioGroup.stories.svelte +0 -172
- package/dist/components/Form/RadioGroup/RadioGroup.stories.svelte.d.ts +0 -25
- package/dist/components/Form/Select/Select.stories.svelte +0 -175
- package/dist/components/Form/Select/Select.stories.svelte.d.ts +0 -22
- package/dist/components/Form/Switch/Switch.stories.svelte +0 -128
- package/dist/components/Form/Switch/Switch.stories.svelte.d.ts +0 -25
- package/dist/components/Form/TextInput/TextInput.stories.svelte +0 -162
- package/dist/components/Form/TextInput/TextInput.stories.svelte.d.ts +0 -22
- package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte +0 -163
- package/dist/components/Form/UtilityButton/UtilityButton.stories.svelte.d.ts +0 -22
- package/dist/components/Info/Calendar/Calendar.scss +0 -147
- package/dist/components/Info/Calendar/Calendar.stories.svelte +0 -134
- package/dist/components/Info/Calendar/Calendar.stories.svelte.d.ts +0 -22
- package/dist/components/Info/Calendar/Calendar.svelte +0 -61
- package/dist/components/Info/Calendar/Calendar.svelte.d.ts +0 -6
- package/dist/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte +0 -16
- package/dist/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte.d.ts +0 -4
- package/dist/components/Info/Calendar/CalendarGrid/TableBody.svelte +0 -25
- package/dist/components/Info/Calendar/CalendarGrid/TableBody.svelte.d.ts +0 -8
- package/dist/components/Info/Calendar/CalendarGrid/TableHead.svelte +0 -19
- package/dist/components/Info/Calendar/CalendarGrid/TableHead.svelte.d.ts +0 -6
- package/dist/components/Info/Calendar/Header.svelte +0 -25
- package/dist/components/Info/Calendar/Header.svelte.d.ts +0 -3
- package/dist/components/Layout/Card/Card.stories.svelte +0 -113
- package/dist/components/Layout/Card/Card.stories.svelte.d.ts +0 -22
- package/dist/components/Layout/Grid/Column/Column.stories.svelte +0 -66
- package/dist/components/Layout/Grid/Column/Column.stories.svelte.d.ts +0 -22
- package/dist/components/Layout/Grid/Grid.stories.svelte +0 -192
- package/dist/components/Layout/Grid/Grid.stories.svelte.d.ts +0 -22
- package/dist/components/Layout/Grid/Row/Row.stories.svelte +0 -39
- package/dist/components/Layout/Grid/Row/Row.stories.svelte.d.ts +0 -22
- package/dist/components/Layout/Theme/Theme.stories.svelte +0 -54
- package/dist/components/Layout/Theme/Theme.stories.svelte.d.ts +0 -25
- package/dist/components/Layout/Theme/ThemeSystem/index.mdx +0 -35
- package/dist/storybook-types.d.ts +0 -129
- package/dist/storybook-types.js +0 -1
- package/dist/utils/time/date-creator/createDate/createDate.mdx +0 -98
- package/dist/utils/time/date-creator/createDateFactory/createDateFactory.mdx +0 -104
- package/dist/utils/time/timeout/timeout.mdx +0 -114
- package/src/lib/Home.mdx +0 -69
- package/src/lib/components/Form/Button/Button.stories.svelte +0 -178
- package/src/lib/components/Form/Checkbox/Checkbox.stories.svelte +0 -132
- package/src/lib/components/Form/DatePicker/DatePicker.scss +0 -55
- package/src/lib/components/Form/DatePicker/DatePicker.stories.svelte +0 -139
- package/src/lib/components/Form/DatePicker/DatePicker.svelte +0 -136
- package/src/lib/components/Form/DatePicker/DatePickerInput/DatePickerInput.svelte +0 -96
- package/src/lib/components/Form/DatePicker/DatePickerInput/Segments.svelte +0 -17
- package/src/lib/components/Form/DatePicker/DatePickerInput/utils.ts +0 -55
- package/src/lib/components/Form/DatePicker/DatePickerPopup/CalendarGrid.svelte +0 -35
- package/src/lib/components/Form/DatePicker/DatePickerPopup/DatePickerPopup.svelte +0 -52
- package/src/lib/components/Form/DatePicker/DatePickerPopup/Header.svelte +0 -25
- package/src/lib/components/Form/FormField/FormField.stories.svelte +0 -48
- package/src/lib/components/Form/InputEnclosure/InputEnclosure.stories.svelte +0 -166
- package/src/lib/components/Form/Label/Label.stories.svelte +0 -31
- package/src/lib/components/Form/RadioGroup/Radio/Radio.stories.svelte +0 -78
- package/src/lib/components/Form/RadioGroup/RadioGroup.stories.svelte +0 -172
- package/src/lib/components/Form/Select/Select.stories.svelte +0 -175
- package/src/lib/components/Form/Switch/Switch.stories.svelte +0 -128
- package/src/lib/components/Form/TextInput/TextInput.stories.svelte +0 -162
- package/src/lib/components/Form/UtilityButton/UtilityButton.stories.svelte +0 -163
- package/src/lib/components/Info/Calendar/Calendar.scss +0 -147
- package/src/lib/components/Info/Calendar/Calendar.stories.svelte +0 -134
- package/src/lib/components/Info/Calendar/Calendar.svelte +0 -61
- package/src/lib/components/Info/Calendar/CalendarGrid/CalendarGrid.svelte +0 -16
- package/src/lib/components/Info/Calendar/CalendarGrid/TableBody.svelte +0 -25
- package/src/lib/components/Info/Calendar/CalendarGrid/TableHead.svelte +0 -19
- package/src/lib/components/Info/Calendar/Header.svelte +0 -25
- package/src/lib/components/Layout/Card/Card.stories.svelte +0 -113
- package/src/lib/components/Layout/Grid/Column/Column.stories.svelte +0 -66
- package/src/lib/components/Layout/Grid/Grid.stories.svelte +0 -192
- package/src/lib/components/Layout/Grid/Row/Row.stories.svelte +0 -39
- package/src/lib/components/Layout/Theme/Theme.stories.svelte +0 -54
- package/src/lib/components/Layout/Theme/ThemeSystem/index.mdx +0 -35
- package/src/lib/storybook-types.ts +0 -182
- package/src/lib/utils/time/date-creator/createDate/createDate.mdx +0 -98
- package/src/lib/utils/time/date-creator/createDateFactory/createDateFactory.mdx +0 -104
- package/src/lib/utils/time/timeout/timeout.mdx +0 -114
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Grid from './Grid.svelte';
|
|
4
|
-
import type { GridProps } from './Grid.svelte';
|
|
5
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
-
import Column from './Column/Column.svelte';
|
|
7
|
-
import Card from '../Card/Card.svelte';
|
|
8
|
-
import Row from './Row/Row.svelte';
|
|
9
|
-
|
|
10
|
-
const description = `
|
|
11
|
-
a set of components for your basic "12 column grid" needs
|
|
12
|
-
|
|
13
|
-
\`\`\`ts
|
|
14
|
-
import { Grid, Column, Row } from '@flightlesslabs/dodo-ui';
|
|
15
|
-
\`\`\`
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
// ------------------------------
|
|
19
|
-
// Storybook ArgTypes
|
|
20
|
-
// ------------------------------
|
|
21
|
-
export const storyGridArgTypes: Partial<ArgTypes<GridProps>> = {
|
|
22
|
-
// ------------------------------
|
|
23
|
-
// Core
|
|
24
|
-
// ------------------------------
|
|
25
|
-
children: { table: { category: 'API', subcategory: 'Base' } },
|
|
26
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
27
|
-
gap: { table: { category: 'API', subcategory: 'Base', defaultValue: { summary: '1' } } },
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// ------------------------------
|
|
31
|
-
// Storybook Meta
|
|
32
|
-
// ------------------------------
|
|
33
|
-
const { Story } = defineMeta({
|
|
34
|
-
component: Grid,
|
|
35
|
-
tags: ['autodocs'],
|
|
36
|
-
argTypes: storyGridArgTypes,
|
|
37
|
-
parameters: {
|
|
38
|
-
docs: {
|
|
39
|
-
description: {
|
|
40
|
-
component: description,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<!-- ------------------------------ -->
|
|
48
|
-
<!-- Stories -->
|
|
49
|
-
<!-- ------------------------------ -->
|
|
50
|
-
|
|
51
|
-
<!-- Basic 12 column grid -->
|
|
52
|
-
<Story name="Default">
|
|
53
|
-
<Column sm={4}>Hello there</Column>
|
|
54
|
-
<Column sm={4}>Hello there</Column>
|
|
55
|
-
<Column sm={4}>Hello there</Column>
|
|
56
|
-
<Column sm={4}>Hello there</Column>
|
|
57
|
-
<Column sm={4}>Hello there</Column>
|
|
58
|
-
</Story>
|
|
59
|
-
|
|
60
|
-
<Story name="Example">
|
|
61
|
-
<Column sm={4}>
|
|
62
|
-
<Card color="primary">
|
|
63
|
-
<p>Hello there</p>
|
|
64
|
-
</Card>
|
|
65
|
-
</Column>
|
|
66
|
-
<Column sm={4}>
|
|
67
|
-
<Card color="primary">
|
|
68
|
-
<p>Hello there</p>
|
|
69
|
-
</Card>
|
|
70
|
-
</Column>
|
|
71
|
-
<Column sm={4}>
|
|
72
|
-
<Card color="primary">
|
|
73
|
-
<p>Hello there</p>
|
|
74
|
-
</Card>
|
|
75
|
-
</Column>
|
|
76
|
-
<Column sm={4}>
|
|
77
|
-
<Card color="primary">
|
|
78
|
-
<p>Hello there</p>
|
|
79
|
-
</Card>
|
|
80
|
-
</Column>
|
|
81
|
-
</Story>
|
|
82
|
-
|
|
83
|
-
<Story name="Grid Row">
|
|
84
|
-
<Row>
|
|
85
|
-
<Column sm={6} md={4} lg={3}>
|
|
86
|
-
<Card color="primary">
|
|
87
|
-
<p>Hello there</p>
|
|
88
|
-
</Card>
|
|
89
|
-
</Column>
|
|
90
|
-
<Column sm={6} md={4} lg={3}>
|
|
91
|
-
<Card color="primary">
|
|
92
|
-
<p>Hello there</p>
|
|
93
|
-
</Card>
|
|
94
|
-
</Column>
|
|
95
|
-
<Column sm={6} md={4} lg={3}>
|
|
96
|
-
<Card color="primary">
|
|
97
|
-
<p>Hello there</p>
|
|
98
|
-
</Card>
|
|
99
|
-
</Column>
|
|
100
|
-
</Row>
|
|
101
|
-
<Row>
|
|
102
|
-
<Column sm={6} md={4} lg={3}>
|
|
103
|
-
<Card color="primary">
|
|
104
|
-
<p>Hello there</p>
|
|
105
|
-
</Card>
|
|
106
|
-
</Column>
|
|
107
|
-
<Column sm={6} md={4} lg={3}>
|
|
108
|
-
<Card color="primary">
|
|
109
|
-
<p>Hello there</p>
|
|
110
|
-
</Card>
|
|
111
|
-
</Column>
|
|
112
|
-
<Column sm={6} md={4} lg={3}>
|
|
113
|
-
<Card color="primary">
|
|
114
|
-
<p>Hello there</p>
|
|
115
|
-
</Card>
|
|
116
|
-
</Column>
|
|
117
|
-
</Row>
|
|
118
|
-
</Story>
|
|
119
|
-
|
|
120
|
-
<Story name="Gap" args={{ gap: 2 }}>
|
|
121
|
-
<Column sm={4}>
|
|
122
|
-
<Card color="primary">
|
|
123
|
-
<p>Hello there</p>
|
|
124
|
-
</Card>
|
|
125
|
-
</Column>
|
|
126
|
-
<Column sm={4}>
|
|
127
|
-
<Card color="primary">
|
|
128
|
-
<p>Hello there</p>
|
|
129
|
-
</Card>
|
|
130
|
-
</Column>
|
|
131
|
-
<Column sm={4}>
|
|
132
|
-
<Card color="primary">
|
|
133
|
-
<p>Hello there</p>
|
|
134
|
-
</Card>
|
|
135
|
-
</Column>
|
|
136
|
-
<Column sm={4}>
|
|
137
|
-
<Card color="primary">
|
|
138
|
-
<p>Hello there</p>
|
|
139
|
-
</Card>
|
|
140
|
-
</Column>
|
|
141
|
-
</Story>
|
|
142
|
-
|
|
143
|
-
<Story name="Responsive">
|
|
144
|
-
<Column sm={6} md={4} lg={3}>
|
|
145
|
-
<Card color="primary">
|
|
146
|
-
<p>Hello there</p>
|
|
147
|
-
</Card>
|
|
148
|
-
</Column>
|
|
149
|
-
<Column sm={6} md={4} lg={3}>
|
|
150
|
-
<Card color="primary">
|
|
151
|
-
<p>Hello there</p>
|
|
152
|
-
</Card>
|
|
153
|
-
</Column>
|
|
154
|
-
<Column sm={6} md={4} lg={3}>
|
|
155
|
-
<Card color="primary">
|
|
156
|
-
<p>Hello there</p>
|
|
157
|
-
</Card>
|
|
158
|
-
</Column>
|
|
159
|
-
<Column sm={6} md={4} lg={3}>
|
|
160
|
-
<Card color="primary">
|
|
161
|
-
<p>Hello there</p>
|
|
162
|
-
</Card>
|
|
163
|
-
</Column>
|
|
164
|
-
<Column sm={6} md={4} lg={3}>
|
|
165
|
-
<Card color="primary">
|
|
166
|
-
<p>Hello there</p>
|
|
167
|
-
</Card>
|
|
168
|
-
</Column>
|
|
169
|
-
<Column sm={6} md={4} lg={3}>
|
|
170
|
-
<Card color="primary">
|
|
171
|
-
<p>Hello there</p>
|
|
172
|
-
</Card>
|
|
173
|
-
</Column>
|
|
174
|
-
</Story>
|
|
175
|
-
|
|
176
|
-
<Story name="Flex">
|
|
177
|
-
<Column md="flex">
|
|
178
|
-
<Card color="primary">
|
|
179
|
-
<p>Hello there</p>
|
|
180
|
-
</Card>
|
|
181
|
-
</Column>
|
|
182
|
-
<Column md={2}>
|
|
183
|
-
<Card color="primary">
|
|
184
|
-
<p>Hello there</p>
|
|
185
|
-
</Card>
|
|
186
|
-
</Column>
|
|
187
|
-
<Column md={2}>
|
|
188
|
-
<Card color="primary">
|
|
189
|
-
<p>Hello there</p>
|
|
190
|
-
</Card>
|
|
191
|
-
</Column>
|
|
192
|
-
</Story>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Row from './Row.svelte';
|
|
4
|
-
import type { GridRowProps } from './Row.svelte';
|
|
5
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
-
import Column from '../Column/Column.svelte';
|
|
7
|
-
|
|
8
|
-
// ------------------------------
|
|
9
|
-
// Storybook ArgTypes
|
|
10
|
-
// ------------------------------
|
|
11
|
-
export const storyRowArgTypes: Partial<ArgTypes<GridRowProps>> = {
|
|
12
|
-
// ------------------------------
|
|
13
|
-
// Core
|
|
14
|
-
// ------------------------------
|
|
15
|
-
children: { table: { category: 'API', subcategory: 'Base' } },
|
|
16
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// ------------------------------
|
|
20
|
-
// Storybook Meta
|
|
21
|
-
// ------------------------------
|
|
22
|
-
const { Story } = defineMeta({
|
|
23
|
-
component: Row,
|
|
24
|
-
tags: ['autodocs'],
|
|
25
|
-
argTypes: storyRowArgTypes,
|
|
26
|
-
});
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<!-- ------------------------------ -->
|
|
30
|
-
<!-- Stories -->
|
|
31
|
-
<!-- ------------------------------ -->
|
|
32
|
-
|
|
33
|
-
<Story name="Default">
|
|
34
|
-
<Column sm={4}>Hello there</Column>
|
|
35
|
-
<Column sm={4}>Hello there</Column>
|
|
36
|
-
<Column sm={4}>Hello there</Column>
|
|
37
|
-
<Column sm={4}>Hello there</Column>
|
|
38
|
-
<Column sm={4}>Hello there</Column>
|
|
39
|
-
</Story>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Theme from './Theme.svelte';
|
|
4
|
-
import type { ThemeProps } from './Theme.svelte';
|
|
5
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
-
import { componentThemeOptions } from '$lib/attributes/theme.js';
|
|
7
|
-
|
|
8
|
-
const description = `
|
|
9
|
-
Wrap your app at the root with Theme to provide a consistent light or dark class (based on system or override) to all child components
|
|
10
|
-
|
|
11
|
-
\`\`\`ts
|
|
12
|
-
import { Theme } from '@flightlesslabs/dodo-ui';
|
|
13
|
-
\`\`\`
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Storybook controls for Theme
|
|
18
|
-
*/
|
|
19
|
-
export const ThemeArgTypes: Partial<ArgTypes<ThemeProps>> = {
|
|
20
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
21
|
-
type: {
|
|
22
|
-
control: { type: 'select' },
|
|
23
|
-
options: componentThemeOptions,
|
|
24
|
-
description: 'Theme color type: auto by defualt',
|
|
25
|
-
table: { category: 'API', subcategory: 'Base', defaultValue: { summary: 'auto' } },
|
|
26
|
-
},
|
|
27
|
-
global: {
|
|
28
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const { Story } = defineMeta({
|
|
33
|
-
component: Theme,
|
|
34
|
-
tags: ['autodocs'],
|
|
35
|
-
argTypes: ThemeArgTypes,
|
|
36
|
-
parameters: {
|
|
37
|
-
docs: {
|
|
38
|
-
description: {
|
|
39
|
-
component: description,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<!-- ------------------------------ -->
|
|
47
|
-
<!-- Stories -->
|
|
48
|
-
<!-- ------------------------------ -->
|
|
49
|
-
|
|
50
|
-
<Story name="Default"></Story>
|
|
51
|
-
|
|
52
|
-
<Story name="Light" args={{ type: 'light' }}></Story>
|
|
53
|
-
|
|
54
|
-
<Story name="Dark" args={{ type: 'dark' }} globals={{ backgrounds: { value: 'dark' } }}></Story>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# 🎨 Theme System
|
|
2
|
-
|
|
3
|
-
A lightweight theme system built using context + local store.
|
|
4
|
-
|
|
5
|
-
## 🧩 Theme Context
|
|
6
|
-
|
|
7
|
-
### 📦 Import
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
import { useThemeContext } from '@flightlesslabs/dodo-ui';
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Provides access to the active theme.
|
|
14
|
-
|
|
15
|
-
### Usage
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
const { theme } = useThemeContext();
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## 🏪 Theme Store
|
|
22
|
-
|
|
23
|
-
Global theme state.
|
|
24
|
-
|
|
25
|
-
### 📦 Import
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
import { useThemeStore } from '@flightlesslabs/dodo-ui';
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Read
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
const theme = useThemeStore.theme;
|
|
35
|
-
```
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
type ControlType =
|
|
2
|
-
| 'object'
|
|
3
|
-
| 'boolean'
|
|
4
|
-
| 'check'
|
|
5
|
-
| 'inline-check'
|
|
6
|
-
| 'radio'
|
|
7
|
-
| 'inline-radio'
|
|
8
|
-
| 'select'
|
|
9
|
-
| 'multi-select'
|
|
10
|
-
| 'number'
|
|
11
|
-
| 'range'
|
|
12
|
-
| 'file'
|
|
13
|
-
| 'color'
|
|
14
|
-
| 'date'
|
|
15
|
-
| 'text';
|
|
16
|
-
|
|
17
|
-
interface ControlBase {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
/** @see https://storybook.js.org/docs/api/arg-types#controltype */
|
|
21
|
-
type?: ControlType;
|
|
22
|
-
disable?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type Control =
|
|
26
|
-
| ControlType
|
|
27
|
-
| false
|
|
28
|
-
| (ControlBase &
|
|
29
|
-
(
|
|
30
|
-
| ControlBase
|
|
31
|
-
| {
|
|
32
|
-
type: 'color';
|
|
33
|
-
/** @see https://storybook.js.org/docs/api/arg-types#controlpresetcolors */
|
|
34
|
-
presetColors?: string[];
|
|
35
|
-
}
|
|
36
|
-
| {
|
|
37
|
-
type: 'file';
|
|
38
|
-
/** @see https://storybook.js.org/docs/api/arg-types#controlaccept */
|
|
39
|
-
accept?: string;
|
|
40
|
-
}
|
|
41
|
-
| {
|
|
42
|
-
type: 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select';
|
|
43
|
-
/** @see https://storybook.js.org/docs/api/arg-types#controllabels */
|
|
44
|
-
labels?: {
|
|
45
|
-
[options: string]: string;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
| {
|
|
49
|
-
type: 'number' | 'range';
|
|
50
|
-
/** @see https://storybook.js.org/docs/api/arg-types#controlmax */
|
|
51
|
-
max?: number;
|
|
52
|
-
/** @see https://storybook.js.org/docs/api/arg-types#controlmin */
|
|
53
|
-
min?: number;
|
|
54
|
-
/** @see https://storybook.js.org/docs/api/arg-types#controlstep */
|
|
55
|
-
step?: number;
|
|
56
|
-
}
|
|
57
|
-
));
|
|
58
|
-
|
|
59
|
-
type ConditionalTest =
|
|
60
|
-
| {
|
|
61
|
-
truthy?: boolean;
|
|
62
|
-
}
|
|
63
|
-
| {
|
|
64
|
-
exists: boolean;
|
|
65
|
-
}
|
|
66
|
-
| {
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
-
eq: any;
|
|
69
|
-
}
|
|
70
|
-
| {
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
|
-
neq: any;
|
|
73
|
-
};
|
|
74
|
-
type ConditionalValue =
|
|
75
|
-
| {
|
|
76
|
-
arg: string;
|
|
77
|
-
}
|
|
78
|
-
| {
|
|
79
|
-
global: string;
|
|
80
|
-
};
|
|
81
|
-
type Conditional = ConditionalValue & ConditionalTest;
|
|
82
|
-
|
|
83
|
-
interface Args {
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
-
[name: string]: any;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
interface SBBaseType {
|
|
89
|
-
required?: boolean;
|
|
90
|
-
raw?: string;
|
|
91
|
-
}
|
|
92
|
-
type SBScalarType = SBBaseType & {
|
|
93
|
-
name: 'boolean' | 'string' | 'number' | 'function' | 'symbol';
|
|
94
|
-
};
|
|
95
|
-
type SBArrayType = SBBaseType & {
|
|
96
|
-
name: 'array';
|
|
97
|
-
value: SBType;
|
|
98
|
-
};
|
|
99
|
-
type SBObjectType = SBBaseType & {
|
|
100
|
-
name: 'object';
|
|
101
|
-
value: Record<string, SBType>;
|
|
102
|
-
};
|
|
103
|
-
type SBEnumType = SBBaseType & {
|
|
104
|
-
name: 'enum';
|
|
105
|
-
value: (string | number)[];
|
|
106
|
-
};
|
|
107
|
-
type SBIntersectionType = SBBaseType & {
|
|
108
|
-
name: 'intersection';
|
|
109
|
-
value: SBType[];
|
|
110
|
-
};
|
|
111
|
-
type SBUnionType = SBBaseType & {
|
|
112
|
-
name: 'union';
|
|
113
|
-
value: SBType[];
|
|
114
|
-
};
|
|
115
|
-
type SBOtherType = SBBaseType & {
|
|
116
|
-
name: 'other';
|
|
117
|
-
value: string;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
type SBType =
|
|
121
|
-
| SBScalarType
|
|
122
|
-
| SBEnumType
|
|
123
|
-
| SBArrayType
|
|
124
|
-
| SBObjectType
|
|
125
|
-
| SBIntersectionType
|
|
126
|
-
| SBUnionType
|
|
127
|
-
| SBOtherType;
|
|
128
|
-
|
|
129
|
-
interface InputType {
|
|
130
|
-
/** @see https://storybook.js.org/docs/api/arg-types#control */
|
|
131
|
-
control?: Control;
|
|
132
|
-
/** @see https://storybook.js.org/docs/api/arg-types#description */
|
|
133
|
-
description?: string;
|
|
134
|
-
/** @see https://storybook.js.org/docs/api/arg-types#if */
|
|
135
|
-
if?: Conditional;
|
|
136
|
-
/** @see https://storybook.js.org/docs/api/arg-types#mapping */
|
|
137
|
-
mapping?: {
|
|
138
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
139
|
-
[key: string]: any;
|
|
140
|
-
};
|
|
141
|
-
/** @see https://storybook.js.org/docs/api/arg-types#name */
|
|
142
|
-
name?: string;
|
|
143
|
-
/** @see https://storybook.js.org/docs/api/arg-types#options */
|
|
144
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
145
|
-
options?: readonly any[];
|
|
146
|
-
/** @see https://storybook.js.org/docs/api/arg-types#table */
|
|
147
|
-
table?: {
|
|
148
|
-
[key: string]: unknown;
|
|
149
|
-
/** @see https://storybook.js.org/docs/api/arg-types#tablecategory */
|
|
150
|
-
category?: string;
|
|
151
|
-
/** @see https://storybook.js.org/docs/api/arg-types#tabledefaultvalue */
|
|
152
|
-
defaultValue?: {
|
|
153
|
-
summary?: string;
|
|
154
|
-
detail?: string;
|
|
155
|
-
};
|
|
156
|
-
/** @see https://storybook.js.org/docs/api/arg-types#tabledisable */
|
|
157
|
-
disable?: boolean;
|
|
158
|
-
/** @see https://storybook.js.org/docs/api/arg-types#tablesubcategory */
|
|
159
|
-
subcategory?: string;
|
|
160
|
-
/** @see https://storybook.js.org/docs/api/arg-types#tabletype */
|
|
161
|
-
type?: {
|
|
162
|
-
summary?: string;
|
|
163
|
-
detail?: string;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
/** @see https://storybook.js.org/docs/api/arg-types#type */
|
|
167
|
-
type?: SBType | SBScalarType['name'];
|
|
168
|
-
/**
|
|
169
|
-
* @deprecated Use `table.defaultValue.summary` instead.
|
|
170
|
-
* @see https://storybook.js.org/docs/api/arg-types#defaultvalue
|
|
171
|
-
*/
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
173
|
-
defaultValue?: any;
|
|
174
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
|
-
[key: string]: any;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export type ArgTypes<TArgs = Args> = {
|
|
179
|
-
[name in keyof TArgs]: InputType;
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
export type StoryBookArgTypes = Partial<ArgTypes<Args>>;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# createDate
|
|
2
|
-
|
|
3
|
-
A centralized date factory built on top of `dayjs`.
|
|
4
|
-
|
|
5
|
-
This utility ensures **consistent parsing, timezone handling, and validation** across your application.
|
|
6
|
-
|
|
7
|
-
## 📦 Import
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
import { createDate } from '@flightlesslabs/dodo-ui';
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## 🚀 Basic Usage
|
|
14
|
-
|
|
15
|
-
### Current Date
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
const now = createDate();
|
|
19
|
-
console.log(now.format());
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### Parse a Date
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
const date = createDate("01-02-2025", "DD-MM-YYYY");
|
|
27
|
-
console.log(date.format());
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## 🌍 Timezone & UTC
|
|
31
|
-
|
|
32
|
-
### UTC Mode
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
const utcDate = createDate("2025-01-01T12:00:00Z", undefined, {
|
|
36
|
-
utc: true,
|
|
37
|
-
});
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Timezone Conversion
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
const indiaTime = createDate("01-01-2025", "DD-MM-YYYY", {
|
|
44
|
-
timezone: "Asia/Kolkata",
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## ⚙️ Options
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
interface CreateDateOptions {
|
|
52
|
-
timezone?: string;
|
|
53
|
-
utc?: boolean;
|
|
54
|
-
strict?: boolean;
|
|
55
|
-
throwOnInvalid?: boolean;
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## 🔁 Behavior Priority
|
|
60
|
-
|
|
61
|
-
1. utc (highest priority)
|
|
62
|
-
2. timezone
|
|
63
|
-
3. local
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
### timezone
|
|
68
|
-
|
|
69
|
-
- IANA timezone string
|
|
70
|
-
- Interprets input in given timezone
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
### utc
|
|
75
|
-
|
|
76
|
-
- Forces UTC mode
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
### strict
|
|
81
|
-
|
|
82
|
-
- Only applies when format is provided
|
|
83
|
-
- Has no effect on ISO / timestamps
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
### throwOnInvalid
|
|
88
|
-
|
|
89
|
-
- Throws error if date is invalid
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
## 📥 Supported Inputs
|
|
94
|
-
|
|
95
|
-
- string
|
|
96
|
-
- number (timestamp)
|
|
97
|
-
- Date object
|
|
98
|
-
- undefined
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# createDateFactory
|
|
2
|
-
|
|
3
|
-
A **factory function** that creates a `createDate` utility with an optional custom `dayjs` instance.
|
|
4
|
-
|
|
5
|
-
This allows advanced users to:
|
|
6
|
-
|
|
7
|
-
- Inject their own configured `dayjs`
|
|
8
|
-
- Share plugins across multiple libraries
|
|
9
|
-
- Avoid global `dayjs.extend` pollution
|
|
10
|
-
- Create isolated date environments
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## 📦 Import
|
|
15
|
-
|
|
16
|
-
```ts
|
|
17
|
-
import { createDateFactory } from '@flightlesslabs/dodo-ui';
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## 🚀 Basic Usage
|
|
23
|
-
|
|
24
|
-
### Default Factory
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
import { createDateFactory } from '@flightlesslabs/dodo-ui';
|
|
28
|
-
|
|
29
|
-
const { createDate } = createDateFactory();
|
|
30
|
-
|
|
31
|
-
const now = createDate();
|
|
32
|
-
console.log(now.format());
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## 🧠 Why Use a Factory?
|
|
38
|
-
|
|
39
|
-
Instead of relying on global `dayjs.extend`, you can:
|
|
40
|
-
|
|
41
|
-
- isolate plugin setups
|
|
42
|
-
- avoid conflicts in monorepos
|
|
43
|
-
- support multiple configurations
|
|
44
|
-
- improve testability
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## 🔌 Custom Dayjs Instance
|
|
49
|
-
|
|
50
|
-
### Inject your own configured instance
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
import dayjs from 'dayjs';
|
|
54
|
-
import utc from 'dayjs/plugin/utc';
|
|
55
|
-
import timezone from 'dayjs/plugin/timezone';
|
|
56
|
-
|
|
57
|
-
dayjs.extend(utc);
|
|
58
|
-
dayjs.extend(timezone);
|
|
59
|
-
|
|
60
|
-
const { createDate } = createDateFactory(dayjs);
|
|
61
|
-
|
|
62
|
-
const date = createDate("2025-01-01", "YYYY-MM-DD");
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## ⚙️ Behavior
|
|
68
|
-
|
|
69
|
-
The factory wraps your `dayjs` instance and preserves:
|
|
70
|
-
|
|
71
|
-
- UTC handling
|
|
72
|
-
- Timezone support
|
|
73
|
-
- Strict parsing
|
|
74
|
-
- Validation options
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## 🔁 Priority Order
|
|
79
|
-
|
|
80
|
-
1. utc (highest priority)
|
|
81
|
-
2. timezone
|
|
82
|
-
3. local parsing
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## 📥 Returned API
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
{
|
|
90
|
-
createDate: Function,
|
|
91
|
-
dayjs: DayjsInstance
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## 🧪 Example: Multiple Factories
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
```ts
|
|
99
|
-
const factoryA = createDateFactory(dayjsA);
|
|
100
|
-
const factoryB = createDateFactory(dayjsB);
|
|
101
|
-
|
|
102
|
-
factoryA.createDate("2025-01-01");
|
|
103
|
-
factoryB.createDate("2025-01-01");
|
|
104
|
-
```
|