@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,147 +0,0 @@
|
|
|
1
|
-
@use '../../../styles/global/breakpoints' as breakpoints;
|
|
2
|
-
|
|
3
|
-
// ----------------------------------------
|
|
4
|
-
// Theme tokens (global CSS variables)
|
|
5
|
-
// ----------------------------------------
|
|
6
|
-
:root {
|
|
7
|
-
--dodo-ui-Calendar-date-selected-bg: var(--dodo-color-primary-500);
|
|
8
|
-
--dodo-ui-Calendar-date-selected-hover-bg: var(--dodo-color-primary-600);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.dodo-theme--dark {
|
|
12
|
-
--dodo-ui-Calendar-date-selected-bg: var(--dodo-color-primary-300);
|
|
13
|
-
--dodo-ui-Calendar-date-selected-hover-bg: var(--dodo-color-primary-400);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.dodo-ui-Calendar {
|
|
17
|
-
font-size: 1rem;
|
|
18
|
-
color: var(--dodo-color-neutral-900);
|
|
19
|
-
display: inline-flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
|
|
22
|
-
@include breakpoints.up('sm') {
|
|
23
|
-
padding: var(--dodo-ui-space);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
[data-calendar-header] {
|
|
27
|
-
display: flex;
|
|
28
|
-
justify-content: space-between;
|
|
29
|
-
align-items: center;
|
|
30
|
-
padding: 0 calc(var(--dodo-ui-space) / 2);
|
|
31
|
-
margin-bottom: calc(var(--dodo-ui-space) * 2);
|
|
32
|
-
margin-top: var(--dodo-ui-space);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
[data-calendar-heading] {
|
|
36
|
-
margin: 0 calc(var(--dodo-ui-space) / 2);
|
|
37
|
-
font-weight: 500;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
button[data-calendar-next-button],
|
|
41
|
-
button[data-calendar-prev-button] {
|
|
42
|
-
font-size: 1.4em;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
[data-calendar-grid] {
|
|
46
|
-
width: 100%;
|
|
47
|
-
user-select: none;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
[data-calendar-grid-row] {
|
|
51
|
-
display: flex;
|
|
52
|
-
width: 100%;
|
|
53
|
-
justify-content: space-around;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
[data-calendar-grid-head] {
|
|
57
|
-
margin-bottom: var(--dodo-ui-space);
|
|
58
|
-
display: block;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[data-calendar-head-cell] {
|
|
62
|
-
display: inline-flex;
|
|
63
|
-
width: var(--dodo-ui-element-height-normal);
|
|
64
|
-
justify-content: center;
|
|
65
|
-
font-weight: 600;
|
|
66
|
-
color: var(--dodo-color-neutral-600);
|
|
67
|
-
font-size: 0.9rem;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
[data-calendar-cell] {
|
|
71
|
-
display: inline-flex;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
[data-calendar-day] {
|
|
75
|
-
transition:
|
|
76
|
-
background-color 70ms,
|
|
77
|
-
color 70ms,
|
|
78
|
-
border-color 70ms;
|
|
79
|
-
display: inline-flex;
|
|
80
|
-
justify-content: center;
|
|
81
|
-
align-items: center;
|
|
82
|
-
width: var(--dodo-ui-element-height-normal);
|
|
83
|
-
height: var(--dodo-ui-element-height-normal);
|
|
84
|
-
border-radius: var(--dodo-ui-element-roundness-1);
|
|
85
|
-
border: var(--dodo-ui-element-border-width) solid transparent;
|
|
86
|
-
position: relative;
|
|
87
|
-
|
|
88
|
-
&:hover {
|
|
89
|
-
background-color: var(--dodo-color-neutral-100);
|
|
90
|
-
border-color: var(--dodo-color-neutral-400);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
&[data-selected] {
|
|
94
|
-
background-color: var(--dodo-ui-Calendar-date-selected-bg);
|
|
95
|
-
color: var(--dodo-color-constant-white);
|
|
96
|
-
|
|
97
|
-
&:hover {
|
|
98
|
-
background-color: var(--dodo-ui-Calendar-date-selected-hover-bg);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&[data-today] {
|
|
102
|
-
background-color: var(--dodo-ui-Calendar-date-selected-bg);
|
|
103
|
-
color: var(--dodo-color-constant-white);
|
|
104
|
-
|
|
105
|
-
&:hover {
|
|
106
|
-
background-color: var(--dodo-ui-Calendar-date-selected-hover-bg);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
&::after {
|
|
110
|
-
background-color: var(--dodo-color-constant-white);
|
|
111
|
-
|
|
112
|
-
&:hover {
|
|
113
|
-
background-color: var(--dodo-color-constant-white);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
&[data-today] {
|
|
120
|
-
background-color: var(--dodo-color-primary-50);
|
|
121
|
-
&::after {
|
|
122
|
-
content: '';
|
|
123
|
-
width: var(--dodo-ui-track-element-height-small);
|
|
124
|
-
height: var(--dodo-ui-track-element-height-small);
|
|
125
|
-
border-radius: 50%;
|
|
126
|
-
display: inline-flex;
|
|
127
|
-
background-color: var(--dodo-color-primary-600);
|
|
128
|
-
position: absolute;
|
|
129
|
-
bottom: 0.2em;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
&[data-outside-month],
|
|
134
|
-
&[data-disabled] {
|
|
135
|
-
color: var(--dodo-color-neutral-400);
|
|
136
|
-
|
|
137
|
-
&:hover {
|
|
138
|
-
background-color: initial;
|
|
139
|
-
border-color: transparent;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
&[data-today] {
|
|
143
|
-
background-color: initial;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Calendar from './Calendar.svelte';
|
|
4
|
-
import type { CalendarProps } from './Calendar.svelte';
|
|
5
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
-
import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
|
|
7
|
-
import { CalendarDate, type DateValue } from '@internationalized/date';
|
|
8
|
-
import Theme from '$lib/components/Layout/Theme/Theme.svelte';
|
|
9
|
-
import { componentVariantOptions } from '$lib/attributes/variant.js';
|
|
10
|
-
import { cardColorOptions } from '$lib/components/Layout/Card/Card.svelte';
|
|
11
|
-
import { componentThemeColorsOptions } from '$lib/attributes/theme.js';
|
|
12
|
-
import { ComponentShadowOptions } from '$lib/attributes/shadow.js';
|
|
13
|
-
|
|
14
|
-
const description = `
|
|
15
|
-
a plug and play Calendar component based on bits-ui [calendar](https://bits-ui.com/docs/components/calendar).
|
|
16
|
-
|
|
17
|
-
\`\`\`ts
|
|
18
|
-
import { Calendar } from '@flightlesslabs/dodo-ui';
|
|
19
|
-
\`\`\`
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
// ------------------------------
|
|
23
|
-
// Storybook ArgTypes
|
|
24
|
-
// ------------------------------
|
|
25
|
-
export const storyCalendarArgTypes: Partial<ArgTypes<CalendarProps>> = {
|
|
26
|
-
// ------------------------------
|
|
27
|
-
// Core
|
|
28
|
-
// ------------------------------
|
|
29
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
30
|
-
value: {
|
|
31
|
-
control: { type: 'text' },
|
|
32
|
-
table: { category: 'API', subcategory: 'Base' },
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
// ------------------------------
|
|
36
|
-
// State
|
|
37
|
-
// ------------------------------
|
|
38
|
-
disabled: {
|
|
39
|
-
control: { type: 'boolean' },
|
|
40
|
-
description: 'Disabled state of the input',
|
|
41
|
-
table: { category: 'API', subcategory: 'State', defaultValue: { summary: 'false' } },
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
// ------------------------------
|
|
45
|
-
// Appearance
|
|
46
|
-
// ------------------------------
|
|
47
|
-
shadow: {
|
|
48
|
-
control: { type: 'select' },
|
|
49
|
-
options: ComponentShadowOptions,
|
|
50
|
-
description: 'Component Shadow',
|
|
51
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: '1' } },
|
|
52
|
-
},
|
|
53
|
-
color: {
|
|
54
|
-
control: { type: 'select' },
|
|
55
|
-
options: cardColorOptions,
|
|
56
|
-
description: 'Color theme token',
|
|
57
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'default' } },
|
|
58
|
-
},
|
|
59
|
-
variant: {
|
|
60
|
-
control: { type: 'select' },
|
|
61
|
-
options: componentVariantOptions,
|
|
62
|
-
description: 'Visual variant of the card',
|
|
63
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'text' } },
|
|
64
|
-
},
|
|
65
|
-
roundness: {
|
|
66
|
-
control: { type: 'select' },
|
|
67
|
-
options: componentRoundnessOptions,
|
|
68
|
-
description: 'Border radius token',
|
|
69
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
70
|
-
},
|
|
71
|
-
outline: {
|
|
72
|
-
control: { type: 'boolean' },
|
|
73
|
-
description: 'Render outlined style',
|
|
74
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
75
|
-
},
|
|
76
|
-
active: {
|
|
77
|
-
control: { type: 'boolean' },
|
|
78
|
-
description: 'Add mouse hover and active effects',
|
|
79
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
80
|
-
},
|
|
81
|
-
theme: {
|
|
82
|
-
control: { type: 'select' },
|
|
83
|
-
options: componentThemeColorsOptions,
|
|
84
|
-
description: 'Theme color',
|
|
85
|
-
table: { category: 'API', subcategory: 'Base', defaultValue: { summary: 'undefined' } },
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// ------------------------------
|
|
90
|
-
// Storybook Meta
|
|
91
|
-
// ------------------------------
|
|
92
|
-
const { Story } = defineMeta({
|
|
93
|
-
component: Calendar,
|
|
94
|
-
tags: ['autodocs'],
|
|
95
|
-
argTypes: storyCalendarArgTypes,
|
|
96
|
-
parameters: {
|
|
97
|
-
docs: {
|
|
98
|
-
description: {
|
|
99
|
-
component: description,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
let myValue = $state<DateValue>(new CalendarDate(2026, 4, 7));
|
|
106
|
-
</script>
|
|
107
|
-
|
|
108
|
-
<!-- ------------------------------ -->
|
|
109
|
-
<!-- Stories -->
|
|
110
|
-
<!-- ------------------------------ -->
|
|
111
|
-
|
|
112
|
-
<Story name="Default" />
|
|
113
|
-
|
|
114
|
-
<Story name="Controlled" asChild>
|
|
115
|
-
<Calendar bind:value={myValue} />
|
|
116
|
-
</Story>
|
|
117
|
-
|
|
118
|
-
<Story name="Starts On Sunday" args={{ weekStartsOn: 0 }} />
|
|
119
|
-
|
|
120
|
-
<Story name="Min Date" args={{ minValue: new CalendarDate(2026, 4, 7) }} />
|
|
121
|
-
|
|
122
|
-
<Story name="Max Date" args={{ maxValue: new CalendarDate(2026, 4, 7) }} />
|
|
123
|
-
|
|
124
|
-
<Story name="Light Theme" asChild>
|
|
125
|
-
<Theme type="light">
|
|
126
|
-
<Calendar />
|
|
127
|
-
</Theme>
|
|
128
|
-
</Story>
|
|
129
|
-
|
|
130
|
-
<Story name="Dark Theme" asChild globals={{ backgrounds: { value: 'dark' } }}>
|
|
131
|
-
<Theme type="dark">
|
|
132
|
-
<Calendar />
|
|
133
|
-
</Theme>
|
|
134
|
-
</Story>
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { CardProps } from '$lib/components/Layout/Card/Card.svelte';
|
|
3
|
-
import { useThemeContext } from '$lib/components/Layout/Theme/ThemeSystem/context.js';
|
|
4
|
-
|
|
5
|
-
export type CalendarProps = Omit<CalendarSingleRootProps, 'type'> &
|
|
6
|
-
Omit<CardProps, 'children' | 'ref'>;
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<script lang="ts">
|
|
10
|
-
import { Calendar as CalendarBitsUi, type CalendarSingleRootProps } from 'bits-ui';
|
|
11
|
-
import Header from './Header.svelte';
|
|
12
|
-
import CalendarGrid from './CalendarGrid/CalendarGrid.svelte';
|
|
13
|
-
let {
|
|
14
|
-
roundness = 1,
|
|
15
|
-
outline = true,
|
|
16
|
-
class: className = '',
|
|
17
|
-
theme: cardTheme,
|
|
18
|
-
color = 'default',
|
|
19
|
-
variant = 'text',
|
|
20
|
-
shadow = 0,
|
|
21
|
-
active = false,
|
|
22
|
-
weekStartsOn = 1,
|
|
23
|
-
weekdayFormat = 'short',
|
|
24
|
-
fixedWeeks = true,
|
|
25
|
-
value = $bindable(undefined),
|
|
26
|
-
...restProps
|
|
27
|
-
}: CalendarProps = $props();
|
|
28
|
-
|
|
29
|
-
const themeContext = useThemeContext();
|
|
30
|
-
const theme = $derived(cardTheme ? cardTheme : themeContext.theme);
|
|
31
|
-
|
|
32
|
-
const popupClasses = $derived(
|
|
33
|
-
[
|
|
34
|
-
'dodo-ui-Card',
|
|
35
|
-
'dodo-ui-Calendar',
|
|
36
|
-
`color--${color}`,
|
|
37
|
-
`variant--${variant}`,
|
|
38
|
-
`roundness--${roundness}`,
|
|
39
|
-
`dodo-shadow-${shadow}`,
|
|
40
|
-
outline && 'outline',
|
|
41
|
-
active && 'active',
|
|
42
|
-
theme ? `dodo-theme--${theme}` : '',
|
|
43
|
-
className,
|
|
44
|
-
].filter(Boolean),
|
|
45
|
-
);
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
<CalendarBitsUi.Root
|
|
49
|
-
{...restProps}
|
|
50
|
-
{weekStartsOn}
|
|
51
|
-
{weekdayFormat}
|
|
52
|
-
{fixedWeeks}
|
|
53
|
-
bind:value
|
|
54
|
-
type="single"
|
|
55
|
-
class={popupClasses.join(' ')}
|
|
56
|
-
>
|
|
57
|
-
{#snippet children(calendarRootSnippetProps)}
|
|
58
|
-
<Header />
|
|
59
|
-
<CalendarGrid {...calendarRootSnippetProps} />
|
|
60
|
-
{/snippet}
|
|
61
|
-
</CalendarBitsUi.Root>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Calendar, type CalendarRootSnippetProps } from 'bits-ui';
|
|
3
|
-
import TableHead from './TableHead.svelte';
|
|
4
|
-
import TableBody from './TableBody.svelte';
|
|
5
|
-
|
|
6
|
-
let { months, weekdays }: CalendarRootSnippetProps = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<div class="CalendarGrid">
|
|
10
|
-
{#each months as month (month.value)}
|
|
11
|
-
<Calendar.Grid>
|
|
12
|
-
<TableHead {weekdays} />
|
|
13
|
-
<TableBody {month} />
|
|
14
|
-
</Calendar.Grid>
|
|
15
|
-
{/each}
|
|
16
|
-
</div>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { DateValue } from '@internationalized/date';
|
|
3
|
-
import { Calendar, type Month } from 'bits-ui';
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
month: Month<DateValue>;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
let { month }: Props = $props();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<Calendar.GridBody>
|
|
13
|
-
{#each month.weeks as weekDates (weekDates)}
|
|
14
|
-
<Calendar.GridRow>
|
|
15
|
-
{#each weekDates as date (date)}
|
|
16
|
-
<Calendar.Cell {date} month={month.value}>
|
|
17
|
-
<Calendar.Day>
|
|
18
|
-
<div></div>
|
|
19
|
-
{date.day}
|
|
20
|
-
</Calendar.Day>
|
|
21
|
-
</Calendar.Cell>
|
|
22
|
-
{/each}
|
|
23
|
-
</Calendar.GridRow>
|
|
24
|
-
{/each}
|
|
25
|
-
</Calendar.GridBody>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Calendar } from 'bits-ui';
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
weekdays: string[];
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
let { weekdays }: Props = $props();
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<Calendar.GridHead>
|
|
12
|
-
<Calendar.GridRow>
|
|
13
|
-
{#each weekdays as day (day)}
|
|
14
|
-
<Calendar.HeadCell>
|
|
15
|
-
<div>{day.slice(0, 2)}</div>
|
|
16
|
-
</Calendar.HeadCell>
|
|
17
|
-
{/each}
|
|
18
|
-
</Calendar.GridRow>
|
|
19
|
-
</Calendar.GridHead>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Icon from '@iconify/svelte';
|
|
3
|
-
import { Calendar } 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
|
-
<Calendar.Header>
|
|
18
|
-
<Calendar.PrevButton class={triggerClasses.join(' ')}>
|
|
19
|
-
<Icon icon="material-symbols:chevron-left-rounded" />
|
|
20
|
-
</Calendar.PrevButton>
|
|
21
|
-
<Calendar.Heading />
|
|
22
|
-
<Calendar.NextButton class={triggerClasses.join(' ')}>
|
|
23
|
-
<Icon icon="material-symbols:chevron-right-rounded" />
|
|
24
|
-
</Calendar.NextButton>
|
|
25
|
-
</Calendar.Header>
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Card, { cardColorOptions } from './Card.svelte';
|
|
4
|
-
import type { CardProps } from './Card.svelte';
|
|
5
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
-
import { componentVariantOptions } from '$lib/attributes/variant.js';
|
|
7
|
-
import { componentRoundnessOptions } from '$lib/attributes/roundness.js';
|
|
8
|
-
import { ComponentShadowOptions } from '$lib/attributes/shadow.js';
|
|
9
|
-
import { componentThemeColorsOptions } from '$lib/attributes/theme.js';
|
|
10
|
-
|
|
11
|
-
const description = `
|
|
12
|
-
a simple, customizable, and re-usable card component
|
|
13
|
-
|
|
14
|
-
\`\`\`ts
|
|
15
|
-
import { Card } from '@flightlesslabs/dodo-ui';
|
|
16
|
-
\`\`\`
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
// ------------------------------
|
|
20
|
-
// Storybook ArgTypes
|
|
21
|
-
// ------------------------------
|
|
22
|
-
export const storyCardArgTypes: Partial<ArgTypes<CardProps>> = {
|
|
23
|
-
// ------------------------------
|
|
24
|
-
// Core
|
|
25
|
-
// ------------------------------
|
|
26
|
-
children: { table: { category: 'API', subcategory: 'Base' } },
|
|
27
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
28
|
-
|
|
29
|
-
// ------------------------------
|
|
30
|
-
// Appearance
|
|
31
|
-
// ------------------------------
|
|
32
|
-
shadow: {
|
|
33
|
-
control: { type: 'select' },
|
|
34
|
-
options: ComponentShadowOptions,
|
|
35
|
-
description: 'Component Shadow',
|
|
36
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: '1' } },
|
|
37
|
-
},
|
|
38
|
-
color: {
|
|
39
|
-
control: { type: 'select' },
|
|
40
|
-
options: cardColorOptions,
|
|
41
|
-
description: 'Color theme token',
|
|
42
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'default' } },
|
|
43
|
-
},
|
|
44
|
-
variant: {
|
|
45
|
-
control: { type: 'select' },
|
|
46
|
-
options: componentVariantOptions,
|
|
47
|
-
description: 'Visual variant of the card',
|
|
48
|
-
table: { category: 'API', subcategory: 'Appearance', defaultValue: { summary: 'text' } },
|
|
49
|
-
},
|
|
50
|
-
roundness: {
|
|
51
|
-
control: { type: 'select' },
|
|
52
|
-
options: componentRoundnessOptions,
|
|
53
|
-
description: 'Border radius token',
|
|
54
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
55
|
-
},
|
|
56
|
-
outline: {
|
|
57
|
-
control: { type: 'boolean' },
|
|
58
|
-
description: 'Render outlined style',
|
|
59
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
60
|
-
},
|
|
61
|
-
active: {
|
|
62
|
-
control: { type: 'boolean' },
|
|
63
|
-
description: 'Add mouse hover and active effects',
|
|
64
|
-
table: { category: 'API', subcategory: 'Appearance' },
|
|
65
|
-
},
|
|
66
|
-
theme: {
|
|
67
|
-
control: { type: 'select' },
|
|
68
|
-
options: componentThemeColorsOptions,
|
|
69
|
-
description: 'Theme color',
|
|
70
|
-
table: { category: 'API', subcategory: 'Base', defaultValue: { summary: 'undefined' } },
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// ------------------------------
|
|
75
|
-
// Storybook Meta
|
|
76
|
-
// ------------------------------
|
|
77
|
-
const { Story } = defineMeta({
|
|
78
|
-
component: Card,
|
|
79
|
-
tags: ['autodocs'],
|
|
80
|
-
argTypes: storyCardArgTypes,
|
|
81
|
-
parameters: {
|
|
82
|
-
docs: {
|
|
83
|
-
description: {
|
|
84
|
-
component: description,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
</script>
|
|
90
|
-
|
|
91
|
-
<!-- ------------------------------ -->
|
|
92
|
-
<!-- Stories -->
|
|
93
|
-
<!-- ------------------------------ -->
|
|
94
|
-
|
|
95
|
-
<Story name="Default"><p>Hello there</p></Story>
|
|
96
|
-
|
|
97
|
-
<Story name="Color" args={{ color: 'safe' }}><p>Hello there</p></Story>
|
|
98
|
-
|
|
99
|
-
<Story name="Active" args={{ color: 'primary', active: true }}><p>Hello there</p></Story>
|
|
100
|
-
|
|
101
|
-
<Story name="Solid" args={{ color: 'primary', variant: 'solid' }}><p>Hello there</p></Story>
|
|
102
|
-
|
|
103
|
-
<Story name="Outline" args={{ outline: true, shadow: 0 }}><p>Hello there</p></Story>
|
|
104
|
-
|
|
105
|
-
<Story name="Fixed Size" args={{ height: '200px', width: '250px' }}><p>Hello there</p></Story>
|
|
106
|
-
|
|
107
|
-
<Story name="Light Theme" args={{ theme: 'light' }}>
|
|
108
|
-
<p>Hello there</p>
|
|
109
|
-
</Story>
|
|
110
|
-
|
|
111
|
-
<Story name="Dark Theme" args={{ theme: 'dark' }} globals={{ backgrounds: { value: 'dark' } }}>
|
|
112
|
-
<p>Hello there</p>
|
|
113
|
-
</Story>
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
-
import Column, { gridColumnSizeOptions } from './Column.svelte';
|
|
4
|
-
import type { GridColumnProps } from './Column.svelte';
|
|
5
|
-
import type { ArgTypes } from 'storybook/internal/csf';
|
|
6
|
-
|
|
7
|
-
// ------------------------------
|
|
8
|
-
// Storybook ArgTypes
|
|
9
|
-
// ------------------------------
|
|
10
|
-
export const storyColumnArgTypes: Partial<ArgTypes<GridColumnProps>> = {
|
|
11
|
-
// ------------------------------
|
|
12
|
-
// Core
|
|
13
|
-
// ------------------------------
|
|
14
|
-
children: { table: { category: 'API', subcategory: 'Base' } },
|
|
15
|
-
class: { table: { category: 'API', subcategory: 'Base' } },
|
|
16
|
-
|
|
17
|
-
// ------------------------------
|
|
18
|
-
// Size
|
|
19
|
-
// ------------------------------
|
|
20
|
-
size: {
|
|
21
|
-
control: { type: 'select' },
|
|
22
|
-
options: gridColumnSizeOptions,
|
|
23
|
-
table: { category: 'API', subcategory: 'Size', defaultValue: { summary: '12' } },
|
|
24
|
-
},
|
|
25
|
-
sm: {
|
|
26
|
-
control: { type: 'select' },
|
|
27
|
-
options: gridColumnSizeOptions,
|
|
28
|
-
table: { category: 'API', subcategory: 'Size' },
|
|
29
|
-
},
|
|
30
|
-
md: {
|
|
31
|
-
control: { type: 'select' },
|
|
32
|
-
options: gridColumnSizeOptions,
|
|
33
|
-
table: { category: 'API', subcategory: 'Size' },
|
|
34
|
-
},
|
|
35
|
-
lg: {
|
|
36
|
-
control: { type: 'select' },
|
|
37
|
-
options: gridColumnSizeOptions,
|
|
38
|
-
table: { category: 'API', subcategory: 'Size' },
|
|
39
|
-
},
|
|
40
|
-
xl: {
|
|
41
|
-
control: { type: 'select' },
|
|
42
|
-
options: gridColumnSizeOptions,
|
|
43
|
-
table: { category: 'API', subcategory: 'Size' },
|
|
44
|
-
},
|
|
45
|
-
xxl: {
|
|
46
|
-
control: { type: 'select' },
|
|
47
|
-
options: gridColumnSizeOptions,
|
|
48
|
-
table: { category: 'API', subcategory: 'Size' },
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// ------------------------------
|
|
53
|
-
// Storybook Meta
|
|
54
|
-
// ------------------------------
|
|
55
|
-
const { Story } = defineMeta({
|
|
56
|
-
component: Column,
|
|
57
|
-
tags: ['autodocs'],
|
|
58
|
-
argTypes: storyColumnArgTypes,
|
|
59
|
-
});
|
|
60
|
-
</script>
|
|
61
|
-
|
|
62
|
-
<!-- ------------------------------ -->
|
|
63
|
-
<!-- Stories -->
|
|
64
|
-
<!-- ------------------------------ -->
|
|
65
|
-
|
|
66
|
-
<Story name="Default">Hello there</Story>
|