@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,139 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import DatePicker from './DatePicker.svelte';
|
|
4
|
-
import type { DatePickerProps } from './DatePicker.svelte';
|
|
5
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
-
|
|
7
|
-
import { componentSizeOptions } from '../../../attributes/size.js';
|
|
8
|
-
import { componentRoundnessOptions } from '../../../attributes/roundness.js';
|
|
9
|
-
import { CalendarDate, type DateValue } from '@internationalized/date';
|
|
10
|
-
import Theme from '../../Layout/Theme/Theme.svelte';
|
|
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
|
-
|
|
21
|
-
// ------------------------------
|
|
22
|
-
// Storybook ArgTypes
|
|
23
|
-
// ------------------------------
|
|
24
|
-
export const storyDatePickerArgTypes: Partial<ArgTypes<DatePickerProps>> = {
|
|
25
|
-
// ------------------------------
|
|
26
|
-
// Core
|
|
27
|
-
// ------------------------------
|
|
28
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
29
|
-
value: {
|
|
30
|
-
control: { type: 'text' },
|
|
31
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
32
|
-
},
|
|
33
|
-
dateFormat: {
|
|
34
|
-
control: { type: 'text' },
|
|
35
|
-
table: { category: 'API', subcategory: 'Base', defaultValue: { summary: 'dd/mm/yyyy' } },
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
// ------------------------------
|
|
39
|
-
// State
|
|
40
|
-
// ------------------------------
|
|
41
|
-
disabled: {
|
|
42
|
-
control: { type: 'boolean' },
|
|
43
|
-
description: 'Disabled state of the input',
|
|
44
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
45
|
-
},
|
|
46
|
-
focused: {
|
|
47
|
-
control: { type: 'boolean' },
|
|
48
|
-
description: 'Force focused visual state',
|
|
49
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
50
|
-
},
|
|
51
|
-
error: {
|
|
52
|
-
control: { type: 'boolean' },
|
|
53
|
-
description: 'Error visual state',
|
|
54
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
// ------------------------------
|
|
58
|
-
// Appearance
|
|
59
|
-
// ------------------------------
|
|
60
|
-
size: {
|
|
61
|
-
control: { type: 'select' },
|
|
62
|
-
options: componentSizeOptions,
|
|
63
|
-
description: 'Visual size token',
|
|
64
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'normal' } },
|
|
65
|
-
},
|
|
66
|
-
roundness: {
|
|
67
|
-
control: { type: 'select' },
|
|
68
|
-
options: componentRoundnessOptions,
|
|
69
|
-
description: 'Border radius token',
|
|
70
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: '1' } },
|
|
71
|
-
},
|
|
72
|
-
outline: {
|
|
73
|
-
control: { type: 'boolean' },
|
|
74
|
-
description: 'Render outlined enclosure',
|
|
75
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'true' } },
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
// ------------------------------
|
|
79
|
-
// Slots (Snippets)
|
|
80
|
-
// ------------------------------
|
|
81
|
-
before: {
|
|
82
|
-
table: { category: 'API', subcategory: 'Slots' },
|
|
83
|
-
description: 'Content rendered before the input',
|
|
84
|
-
},
|
|
85
|
-
after: {
|
|
86
|
-
table: { category: 'API', subcategory: 'Slots' },
|
|
87
|
-
description: 'Content rendered after the input',
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// ------------------------------
|
|
92
|
-
// Storybook Meta
|
|
93
|
-
// ------------------------------
|
|
94
|
-
const { Story } = defineMeta({
|
|
95
|
-
component: DatePicker,
|
|
96
|
-
tags: ['autodocs'],
|
|
97
|
-
argTypes: storyDatePickerArgTypes,
|
|
98
|
-
parameters: {
|
|
99
|
-
docs: {
|
|
100
|
-
description: {
|
|
101
|
-
component: description,
|
|
102
|
-
},
|
|
103
|
-
story: { height: '420px' },
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
let myValue = $state<DateValue>(new CalendarDate(2026, 4, 7));
|
|
109
|
-
</script>
|
|
110
|
-
|
|
111
|
-
<!-- ------------------------------ -->
|
|
112
|
-
<!-- Stories -->
|
|
113
|
-
<!-- ------------------------------ -->
|
|
114
|
-
|
|
115
|
-
<Story name="Default" />
|
|
116
|
-
|
|
117
|
-
<Story name="Controlled" asChild>
|
|
118
|
-
<DatePicker bind:value={myValue} />
|
|
119
|
-
</Story>
|
|
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
|
-
|
|
129
|
-
<Story name="Light Theme" asChild>
|
|
130
|
-
<Theme type="light">
|
|
131
|
-
<DatePicker />
|
|
132
|
-
</Theme>
|
|
133
|
-
</Story>
|
|
134
|
-
|
|
135
|
-
<Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
|
|
136
|
-
<Theme type="dark">
|
|
137
|
-
<DatePicker />
|
|
138
|
-
</Theme>
|
|
139
|
-
</Story>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import DatePicker from './DatePicker.svelte';
|
|
2
|
-
import type { DatePickerProps } from './DatePicker.svelte';
|
|
3
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
4
|
-
export declare const storyDatePickerArgTypes: Partial<ArgTypes<DatePickerProps>>;
|
|
5
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
6
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
7
|
-
$$bindings?: Bindings;
|
|
8
|
-
} & Exports;
|
|
9
|
-
(internal: unknown, props: {
|
|
10
|
-
$$events?: Events;
|
|
11
|
-
$$slots?: Slots;
|
|
12
|
-
}): Exports & {
|
|
13
|
-
$set?: any;
|
|
14
|
-
$on?: any;
|
|
15
|
-
};
|
|
16
|
-
z_$$bindings?: Bindings;
|
|
17
|
-
}
|
|
18
|
-
declare const DatePicker: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
}, {}, {}, string>;
|
|
21
|
-
type DatePicker = InstanceType<typeof DatePicker>;
|
|
22
|
-
export default DatePicker;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { ComponentRoundnessShape } from '../../../attributes/roundness.js';
|
|
3
|
-
import type { ComponentSize } from '../../../attributes/size.js';
|
|
4
|
-
|
|
5
|
-
export type DatePickerProps = DatePickerRootPropsWithoutHTML & {
|
|
6
|
-
/** Visual size token (e.g. small, normal, large) */
|
|
7
|
-
size?: ComponentSize;
|
|
8
|
-
|
|
9
|
-
/** Border radius token (e.g. 1–3, "pill") */
|
|
10
|
-
roundness?: ComponentRoundnessShape;
|
|
11
|
-
|
|
12
|
-
/** Render an outlined enclosure (shows border) */
|
|
13
|
-
outline?: boolean;
|
|
14
|
-
|
|
15
|
-
/** Custom CSS class names applied to the InputEnclosure */
|
|
16
|
-
class?: string;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Error visual state.
|
|
20
|
-
*
|
|
21
|
-
* When true, applies error styling to the enclosure.
|
|
22
|
-
* Intended for validation errors.
|
|
23
|
-
*/
|
|
24
|
-
error?: boolean;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Focused visual state.
|
|
28
|
-
*
|
|
29
|
-
* When true, forces focused styling on the enclosure.
|
|
30
|
-
* Usually controlled automatically via focus/blur.
|
|
31
|
-
*/
|
|
32
|
-
focused?: boolean;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Content rendered before the input (prefix).
|
|
36
|
-
*
|
|
37
|
-
* Use {#snippet before} in Svelte.
|
|
38
|
-
*/
|
|
39
|
-
before?: Snippet;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Content rendered after the input (suffix).
|
|
43
|
-
*
|
|
44
|
-
* Use {#snippet after} in Svelte.
|
|
45
|
-
*/
|
|
46
|
-
after?: Snippet;
|
|
47
|
-
|
|
48
|
-
/** Select placeholder */
|
|
49
|
-
placeholder?: string;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Date display format for the input segments.
|
|
53
|
-
*
|
|
54
|
-
* Controls the visual order and separators of the date parts
|
|
55
|
-
* (e.g. "dd/mm/yyyy", "mm-dd-yyyy", "yyyy.mm.dd").
|
|
56
|
-
*
|
|
57
|
-
* This only affects how the date is rendered in the input,
|
|
58
|
-
* not the internal parsing or keyboard interaction behavior
|
|
59
|
-
* of the DatePicker.
|
|
60
|
-
*/
|
|
61
|
-
dateFormat?: DatePickerFormat;
|
|
62
|
-
|
|
63
|
-
/** bits ui dateFieldInputProps */
|
|
64
|
-
dateFieldInputProps?: DateFieldInputProps;
|
|
65
|
-
|
|
66
|
-
/** bits ui datePickerTriggerProps */
|
|
67
|
-
datePickerTriggerProps?: DatePickerTriggerProps;
|
|
68
|
-
|
|
69
|
-
/** Props for Popup */
|
|
70
|
-
popupProps?: DatePickerPopupProps;
|
|
71
|
-
};
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<script lang="ts">
|
|
75
|
-
import {
|
|
76
|
-
DatePicker as DatePickerBitsUi,
|
|
77
|
-
type DateFieldInputProps,
|
|
78
|
-
type DatePickerRootPropsWithoutHTML,
|
|
79
|
-
type DatePickerTriggerProps,
|
|
80
|
-
} from 'bits-ui';
|
|
81
|
-
import type { Snippet } from 'svelte';
|
|
82
|
-
import DatepickerInput from './DatePickerInput/DatePickerInput.svelte';
|
|
83
|
-
import type { DatePickerFormat } from './DatePickerInput/utils.js';
|
|
84
|
-
import DatePickerPopup, {
|
|
85
|
-
type DatePickerPopupProps,
|
|
86
|
-
} from './DatePickerPopup/DatePickerPopup.svelte';
|
|
87
|
-
|
|
88
|
-
let {
|
|
89
|
-
size = 'normal',
|
|
90
|
-
roundness = 1,
|
|
91
|
-
outline = true,
|
|
92
|
-
class: className = '',
|
|
93
|
-
disabled = false,
|
|
94
|
-
error = false,
|
|
95
|
-
focused: forcedFocused = false,
|
|
96
|
-
before,
|
|
97
|
-
after,
|
|
98
|
-
open = $bindable(false),
|
|
99
|
-
value = $bindable(undefined),
|
|
100
|
-
placeholder,
|
|
101
|
-
weekdayFormat = 'short',
|
|
102
|
-
fixedWeeks = true,
|
|
103
|
-
dateFieldInputProps,
|
|
104
|
-
datePickerTriggerProps,
|
|
105
|
-
weekStartsOn = 1,
|
|
106
|
-
dateFormat = 'dd/mm/yyyy',
|
|
107
|
-
popupProps,
|
|
108
|
-
...restProps
|
|
109
|
-
}: DatePickerProps = $props();
|
|
110
|
-
</script>
|
|
111
|
-
|
|
112
|
-
<DatePickerBitsUi.Root
|
|
113
|
-
{...restProps}
|
|
114
|
-
bind:value
|
|
115
|
-
bind:open
|
|
116
|
-
{weekdayFormat}
|
|
117
|
-
{weekStartsOn}
|
|
118
|
-
{fixedWeeks}
|
|
119
|
-
>
|
|
120
|
-
<DatepickerInput
|
|
121
|
-
{size}
|
|
122
|
-
{roundness}
|
|
123
|
-
{outline}
|
|
124
|
-
class={className}
|
|
125
|
-
{disabled}
|
|
126
|
-
{error}
|
|
127
|
-
{dateFieldInputProps}
|
|
128
|
-
{datePickerTriggerProps}
|
|
129
|
-
focused={forcedFocused}
|
|
130
|
-
{before}
|
|
131
|
-
{after}
|
|
132
|
-
{placeholder}
|
|
133
|
-
{dateFormat}
|
|
134
|
-
/>
|
|
135
|
-
<DatePickerPopup {...popupProps} />
|
|
136
|
-
</DatePickerBitsUi.Root>
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { ComponentRoundnessShape } from '../../../attributes/roundness.js';
|
|
2
|
-
import type { ComponentSize } from '../../../attributes/size.js';
|
|
3
|
-
export type DatePickerProps = DatePickerRootPropsWithoutHTML & {
|
|
4
|
-
/** Visual size token (e.g. small, normal, large) */
|
|
5
|
-
size?: ComponentSize;
|
|
6
|
-
/** Border radius token (e.g. 1–3, "pill") */
|
|
7
|
-
roundness?: ComponentRoundnessShape;
|
|
8
|
-
/** Render an outlined enclosure (shows border) */
|
|
9
|
-
outline?: boolean;
|
|
10
|
-
/** Custom CSS class names applied to the InputEnclosure */
|
|
11
|
-
class?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Error visual state.
|
|
14
|
-
*
|
|
15
|
-
* When true, applies error styling to the enclosure.
|
|
16
|
-
* Intended for validation errors.
|
|
17
|
-
*/
|
|
18
|
-
error?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Focused visual state.
|
|
21
|
-
*
|
|
22
|
-
* When true, forces focused styling on the enclosure.
|
|
23
|
-
* Usually controlled automatically via focus/blur.
|
|
24
|
-
*/
|
|
25
|
-
focused?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Content rendered before the input (prefix).
|
|
28
|
-
*
|
|
29
|
-
* Use {#snippet before} in Svelte.
|
|
30
|
-
*/
|
|
31
|
-
before?: Snippet;
|
|
32
|
-
/**
|
|
33
|
-
* Content rendered after the input (suffix).
|
|
34
|
-
*
|
|
35
|
-
* Use {#snippet after} in Svelte.
|
|
36
|
-
*/
|
|
37
|
-
after?: Snippet;
|
|
38
|
-
/** Select placeholder */
|
|
39
|
-
placeholder?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Date display format for the input segments.
|
|
42
|
-
*
|
|
43
|
-
* Controls the visual order and separators of the date parts
|
|
44
|
-
* (e.g. "dd/mm/yyyy", "mm-dd-yyyy", "yyyy.mm.dd").
|
|
45
|
-
*
|
|
46
|
-
* This only affects how the date is rendered in the input,
|
|
47
|
-
* not the internal parsing or keyboard interaction behavior
|
|
48
|
-
* of the DatePicker.
|
|
49
|
-
*/
|
|
50
|
-
dateFormat?: DatePickerFormat;
|
|
51
|
-
/** bits ui dateFieldInputProps */
|
|
52
|
-
dateFieldInputProps?: DateFieldInputProps;
|
|
53
|
-
/** bits ui datePickerTriggerProps */
|
|
54
|
-
datePickerTriggerProps?: DatePickerTriggerProps;
|
|
55
|
-
/** Props for Popup */
|
|
56
|
-
popupProps?: DatePickerPopupProps;
|
|
57
|
-
};
|
|
58
|
-
import { type DateFieldInputProps, type DatePickerRootPropsWithoutHTML, type DatePickerTriggerProps } from 'bits-ui';
|
|
59
|
-
import type { Snippet } from 'svelte';
|
|
60
|
-
import type { DatePickerFormat } from './DatePickerInput/utils.js';
|
|
61
|
-
import { type DatePickerPopupProps } from './DatePickerPopup/DatePickerPopup.svelte';
|
|
62
|
-
declare const DatePicker: import("svelte").Component<DatePickerProps, {}, "value" | "open">;
|
|
63
|
-
type DatePicker = ReturnType<typeof DatePicker>;
|
|
64
|
-
export default DatePicker;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
export type DatePickerInputProps = {
|
|
5
|
-
size?: ComponentSize;
|
|
6
|
-
roundness?: ComponentRoundnessShape;
|
|
7
|
-
outline?: boolean;
|
|
8
|
-
class?: string;
|
|
9
|
-
error?: boolean;
|
|
10
|
-
focused?: boolean;
|
|
11
|
-
before?: Snippet;
|
|
12
|
-
after?: Snippet;
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
dateFieldInputProps?: DateFieldInputProps;
|
|
15
|
-
datePickerTriggerProps?: DatePickerTriggerProps;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
dateFormat?: DatePickerFormat;
|
|
18
|
-
};
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<script lang="ts">
|
|
22
|
-
import { DatePicker, type DateFieldInputProps, type DatePickerTriggerProps } from 'bits-ui';
|
|
23
|
-
import type { ComponentSize } from '../../../../attributes/size.js';
|
|
24
|
-
import type { ComponentRoundnessShape } from '../../../../attributes/roundness.js';
|
|
25
|
-
import Icon from '@iconify/svelte';
|
|
26
|
-
import Segments from './Segments.svelte';
|
|
27
|
-
import InputEnclosure from '../../InputEnclosure/InputEnclosure.svelte';
|
|
28
|
-
import type { DatePickerFormat } from './utils.js';
|
|
29
|
-
|
|
30
|
-
let {
|
|
31
|
-
size = 'normal',
|
|
32
|
-
class: className = '',
|
|
33
|
-
disabled = false,
|
|
34
|
-
error = false,
|
|
35
|
-
focused: forcedFocused = false,
|
|
36
|
-
placeholder,
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38
|
-
after,
|
|
39
|
-
dateFieldInputProps,
|
|
40
|
-
datePickerTriggerProps,
|
|
41
|
-
dateFormat = 'dd/mm/yyyy',
|
|
42
|
-
...restProps
|
|
43
|
-
}: DatePickerInputProps = $props();
|
|
44
|
-
|
|
45
|
-
let isFocused = $state(false);
|
|
46
|
-
|
|
47
|
-
function handleFocus() {
|
|
48
|
-
isFocused = true;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function handleBlur() {
|
|
52
|
-
isFocused = false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const classes = $derived(['dodo-ui-DatePicker', className].filter(Boolean));
|
|
56
|
-
|
|
57
|
-
const triggerClasses = $derived(
|
|
58
|
-
[
|
|
59
|
-
'dodo-ui-UtilityButton',
|
|
60
|
-
`size--${size}`,
|
|
61
|
-
'compact',
|
|
62
|
-
'color--primary',
|
|
63
|
-
'roundness--full',
|
|
64
|
-
error && 'error',
|
|
65
|
-
disabled && 'disabled',
|
|
66
|
-
].filter(Boolean),
|
|
67
|
-
);
|
|
68
|
-
</script>
|
|
69
|
-
|
|
70
|
-
<InputEnclosure
|
|
71
|
-
{size}
|
|
72
|
-
{disabled}
|
|
73
|
-
{error}
|
|
74
|
-
class={classes.join(' ')}
|
|
75
|
-
focused={forcedFocused || isFocused}
|
|
76
|
-
{...restProps}
|
|
77
|
-
>
|
|
78
|
-
<DatePicker.Input
|
|
79
|
-
onfocus={handleFocus}
|
|
80
|
-
onblur={handleBlur}
|
|
81
|
-
{placeholder}
|
|
82
|
-
class="InputBox"
|
|
83
|
-
{...dateFieldInputProps}
|
|
84
|
-
>
|
|
85
|
-
{#snippet children({ segments })}
|
|
86
|
-
<Segments {segments} {dateFormat} />
|
|
87
|
-
{/snippet}
|
|
88
|
-
</DatePicker.Input>
|
|
89
|
-
|
|
90
|
-
{#snippet after()}
|
|
91
|
-
<DatePicker.Trigger class={triggerClasses.join(' ')} {...datePickerTriggerProps}>
|
|
92
|
-
<Icon icon="material-symbols:calendar-month-sharp" />
|
|
93
|
-
</DatePicker.Trigger>
|
|
94
|
-
{@render after?.()}
|
|
95
|
-
{/snippet}
|
|
96
|
-
</InputEnclosure>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
export type DatePickerInputProps = {
|
|
3
|
-
size?: ComponentSize;
|
|
4
|
-
roundness?: ComponentRoundnessShape;
|
|
5
|
-
outline?: boolean;
|
|
6
|
-
class?: string;
|
|
7
|
-
error?: boolean;
|
|
8
|
-
focused?: boolean;
|
|
9
|
-
before?: Snippet;
|
|
10
|
-
after?: Snippet;
|
|
11
|
-
placeholder?: string;
|
|
12
|
-
dateFieldInputProps?: DateFieldInputProps;
|
|
13
|
-
datePickerTriggerProps?: DatePickerTriggerProps;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
dateFormat?: DatePickerFormat;
|
|
16
|
-
};
|
|
17
|
-
import { type DateFieldInputProps, type DatePickerTriggerProps } from 'bits-ui';
|
|
18
|
-
import type { ComponentSize } from '../../../../attributes/size.js';
|
|
19
|
-
import type { ComponentRoundnessShape } from '../../../../attributes/roundness.js';
|
|
20
|
-
import type { DatePickerFormat } from './utils.js';
|
|
21
|
-
declare const DatePickerInput: import("svelte").Component<DatePickerInputProps, {}, "">;
|
|
22
|
-
type DatePickerInput = ReturnType<typeof DatePickerInput>;
|
|
23
|
-
export default DatePickerInput;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { DatePicker } from 'bits-ui';
|
|
3
|
-
import { formatSegments, type DatePickerFormat, type DateSegment } from './utils.js';
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
segments: DateSegment[];
|
|
7
|
-
dateFormat: DatePickerFormat;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
let { segments, dateFormat }: Props = $props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
{#each formatSegments(segments, dateFormat) as { part, value }, i (part + i)}
|
|
14
|
-
<DatePicker.Segment {part}>
|
|
15
|
-
{value}
|
|
16
|
-
</DatePicker.Segment>
|
|
17
|
-
{/each}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type DatePickerFormat, type DateSegment } from './utils.js';
|
|
2
|
-
type Props = {
|
|
3
|
-
segments: DateSegment[];
|
|
4
|
-
dateFormat: DatePickerFormat;
|
|
5
|
-
};
|
|
6
|
-
declare const Segments: import("svelte").Component<Props, {}, "">;
|
|
7
|
-
type Segments = ReturnType<typeof Segments>;
|
|
8
|
-
export default Segments;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { SegmentPart } from 'bits-ui';
|
|
2
|
-
export type DateSegment = {
|
|
3
|
-
part: SegmentPart;
|
|
4
|
-
value: string;
|
|
5
|
-
};
|
|
6
|
-
export type FormatToken = 'dd' | 'mm' | 'yyyy' | 'hh' | 'min' | 'ss';
|
|
7
|
-
type Separator = '/' | '-' | '.' | ' ';
|
|
8
|
-
export type DatePickerFormat = `${FormatToken}${Separator}${FormatToken}${Separator}${FormatToken}` | `${FormatToken}${Separator}${FormatToken}` | `${FormatToken}`;
|
|
9
|
-
export declare function formatSegments(segments: DateSegment[], format: DatePickerFormat): DateSegment[];
|
|
10
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// ---- Formatter ----
|
|
2
|
-
export function formatSegments(segments, format) {
|
|
3
|
-
const segmentMap = Object.fromEntries(segments.map((s) => [s.part, s]));
|
|
4
|
-
const tokens = format.match(/dd|mm|yyyy|hh|min|ss|./g) ?? [];
|
|
5
|
-
return tokens.map((token) => {
|
|
6
|
-
switch (token) {
|
|
7
|
-
case 'dd':
|
|
8
|
-
return segmentMap.day ?? { part: 'day', value: '' };
|
|
9
|
-
case 'mm':
|
|
10
|
-
return segmentMap.month ?? { part: 'month', value: '' };
|
|
11
|
-
case 'yyyy':
|
|
12
|
-
return segmentMap.year ?? { part: 'year', value: '' };
|
|
13
|
-
case 'hh':
|
|
14
|
-
return segmentMap.hour ?? { part: 'hour', value: '' };
|
|
15
|
-
case 'min':
|
|
16
|
-
return segmentMap.minute ?? { part: 'minute', value: '' };
|
|
17
|
-
case 'ss':
|
|
18
|
-
return segmentMap.second ?? { part: 'second', value: '' };
|
|
19
|
-
default:
|
|
20
|
-
return {
|
|
21
|
-
part: 'literal',
|
|
22
|
-
value: token,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { DatePicker, type CalendarRootSnippetProps } from 'bits-ui';
|
|
3
|
-
|
|
4
|
-
let { months, weekdays }: CalendarRootSnippetProps = $props();
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<div class="CalendarGrid">
|
|
8
|
-
{#each months as month (month.value)}
|
|
9
|
-
<DatePicker.Grid>
|
|
10
|
-
<DatePicker.GridHead>
|
|
11
|
-
<DatePicker.GridRow>
|
|
12
|
-
{#each weekdays as day (day)}
|
|
13
|
-
<DatePicker.HeadCell>
|
|
14
|
-
<div>{day.slice(0, 2)}</div>
|
|
15
|
-
</DatePicker.HeadCell>
|
|
16
|
-
{/each}
|
|
17
|
-
</DatePicker.GridRow>
|
|
18
|
-
</DatePicker.GridHead>
|
|
19
|
-
<DatePicker.GridBody>
|
|
20
|
-
{#each month.weeks as weekDates (weekDates)}
|
|
21
|
-
<DatePicker.GridRow>
|
|
22
|
-
{#each weekDates as date (date)}
|
|
23
|
-
<DatePicker.Cell {date} month={month.value}>
|
|
24
|
-
<DatePicker.Day>
|
|
25
|
-
<div></div>
|
|
26
|
-
{date.day}
|
|
27
|
-
</DatePicker.Day>
|
|
28
|
-
</DatePicker.Cell>
|
|
29
|
-
{/each}
|
|
30
|
-
</DatePicker.GridRow>
|
|
31
|
-
{/each}
|
|
32
|
-
</DatePicker.GridBody>
|
|
33
|
-
</DatePicker.Grid>
|
|
34
|
-
{/each}
|
|
35
|
-
</div>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { CardProps } from '../../../Layout/Card/Card.svelte';
|
|
3
|
-
import { useThemeContext } from '../../../Layout/Theme/ThemeSystem/context.js';
|
|
4
|
-
|
|
5
|
-
export type DatePickerPopupProps = DatePickerContentProps & Omit<CardProps, 'children' | 'ref'>;
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<script lang="ts">
|
|
9
|
-
import { DatePicker, type DatePickerContentProps } from 'bits-ui';
|
|
10
|
-
import Header from './Header.svelte';
|
|
11
|
-
import CalendarGrid from './CalendarGrid.svelte';
|
|
12
|
-
let {
|
|
13
|
-
roundness = 1,
|
|
14
|
-
outline = false,
|
|
15
|
-
class: className = '',
|
|
16
|
-
theme: cardTheme,
|
|
17
|
-
color = 'default',
|
|
18
|
-
variant = 'text',
|
|
19
|
-
shadow = 2,
|
|
20
|
-
active = false,
|
|
21
|
-
sideOffset = 10,
|
|
22
|
-
align = 'end',
|
|
23
|
-
...restProps
|
|
24
|
-
}: DatePickerPopupProps = $props();
|
|
25
|
-
|
|
26
|
-
const themeContext = useThemeContext();
|
|
27
|
-
const theme = $derived(cardTheme ? cardTheme : themeContext.theme);
|
|
28
|
-
|
|
29
|
-
const popupClasses = $derived(
|
|
30
|
-
[
|
|
31
|
-
'dodo-ui-Card',
|
|
32
|
-
'dodo-ui-Calendar',
|
|
33
|
-
`color--${color}`,
|
|
34
|
-
`variant--${variant}`,
|
|
35
|
-
`roundness--${roundness}`,
|
|
36
|
-
`dodo-shadow-${shadow}`,
|
|
37
|
-
outline && 'outline',
|
|
38
|
-
active && 'active',
|
|
39
|
-
theme ? `dodo-theme--${theme}` : '',
|
|
40
|
-
className,
|
|
41
|
-
].filter(Boolean),
|
|
42
|
-
);
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<DatePicker.Content class={popupClasses.join(' ')} {...restProps} {sideOffset} {align}>
|
|
46
|
-
<DatePicker.Calendar>
|
|
47
|
-
{#snippet children(calendarRootSnippetProps)}
|
|
48
|
-
<Header />
|
|
49
|
-
<CalendarGrid {...calendarRootSnippetProps} />
|
|
50
|
-
{/snippet}
|
|
51
|
-
</DatePicker.Calendar>
|
|
52
|
-
</DatePicker.Content>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CardProps } from '../../../Layout/Card/Card.svelte';
|
|
2
|
-
export type DatePickerPopupProps = DatePickerContentProps & Omit<CardProps, 'children' | 'ref'>;
|
|
3
|
-
import { type DatePickerContentProps } from 'bits-ui';
|
|
4
|
-
declare const DatePickerPopup: import("svelte").Component<DatePickerPopupProps, {}, "">;
|
|
5
|
-
type DatePickerPopup = ReturnType<typeof DatePickerPopup>;
|
|
6
|
-
export default DatePickerPopup;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Icon from '@iconify/svelte';
|
|
3
|
-
import { DatePicker } from 'bits-ui';
|
|
4
|
-
|
|
5
|
-
const triggerClasses = $derived(
|
|
6
|
-
[
|
|
7
|
-
'dodo-ui-Button',
|
|
8
|
-
'compact',
|
|
9
|
-
'size--normal',
|
|
10
|
-
'variant--text',
|
|
11
|
-
'color--primary',
|
|
12
|
-
'roundness--1',
|
|
13
|
-
].filter(Boolean),
|
|
14
|
-
);
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<DatePicker.Header>
|
|
18
|
-
<DatePicker.PrevButton class={triggerClasses.join(' ')}>
|
|
19
|
-
<Icon icon="material-symbols:chevron-left-rounded" />
|
|
20
|
-
</DatePicker.PrevButton>
|
|
21
|
-
<DatePicker.Heading />
|
|
22
|
-
<DatePicker.NextButton class={triggerClasses.join(' ')}>
|
|
23
|
-
<Icon icon="material-symbols:chevron-right-rounded" />
|
|
24
|
-
</DatePicker.NextButton>
|
|
25
|
-
</DatePicker.Header>
|