@svelte-atoms/core 1.0.0-alpha.28 → 1.0.0-alpha.30
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 +852 -856
- package/dist/attachments/clickout.svelte.d.ts +1 -1
- package/dist/attachments/clickout.svelte.js +2 -2
- package/dist/components/accordion/accordion-root.svelte +61 -61
- package/dist/components/accordion/accordion-root.svelte.d.ts +1 -1
- package/dist/components/accordion/accordion.stories.svelte +145 -134
- package/dist/components/alert/alert-actions.svelte +43 -43
- package/dist/components/alert/alert-close-button.svelte +70 -70
- package/dist/components/alert/alert-content.svelte +43 -43
- package/dist/components/alert/alert-description.svelte +42 -42
- package/dist/components/alert/alert-icon.svelte +47 -47
- package/dist/components/alert/alert-root.svelte +103 -103
- package/dist/components/alert/alert-title.svelte +42 -42
- package/dist/components/alert/alert.stories.svelte +10 -11
- package/dist/components/atom/html-atom.svelte +75 -19
- package/dist/components/atom/html-atom.svelte.d.ts +1 -1
- package/dist/components/atom/snippet-renderer.svelte +5 -5
- package/dist/components/avatar/avatar.stories.svelte +22 -27
- package/dist/components/badge/badge.stories.svelte +12 -17
- package/dist/components/badge/badge.svelte +19 -19
- package/dist/components/breadcrumb/breadcrumb.stories.svelte +16 -21
- package/dist/components/button/button.stories.svelte +1 -34
- package/dist/components/calendar/calendar-body.svelte +107 -107
- package/dist/components/calendar/calendar-day.svelte +96 -97
- package/dist/components/calendar/calendar-header.svelte +29 -33
- package/dist/components/calendar/calendar-header.svelte.d.ts +0 -1
- package/dist/components/calendar/calendar-root.svelte +206 -208
- package/dist/components/calendar/calendar-week-day.svelte +34 -34
- package/dist/components/calendar/calendar.css +26 -26
- package/dist/components/calendar/calendar.stories.svelte +10 -20
- package/dist/components/calendar/calendar.stories.svelte.d.ts +24 -4
- package/dist/components/card/card-body.svelte +39 -39
- package/dist/components/card/card-footer.svelte +41 -41
- package/dist/components/card/card-root.svelte +91 -91
- package/dist/components/card/card.stories.svelte +133 -145
- package/dist/components/checkbox/checkbox.stories.svelte +22 -27
- package/dist/components/checkbox/checkbox.svelte +155 -157
- package/dist/components/collapsible/collapsible.stories.svelte +172 -173
- package/dist/components/combobox/combobox-root.svelte +65 -65
- package/dist/components/combobox/compobox.stories.svelte +51 -54
- package/dist/components/container/container.stories.svelte +20 -23
- package/dist/components/datagrid/datagrid-root.svelte +2 -2
- package/dist/components/datagrid/datagrid.css +0 -42
- package/dist/components/datagrid/datagrid.stories.svelte +72 -75
- package/dist/components/datagrid/types.d.ts +1 -1
- package/dist/components/date-picker/atoms.d.ts +0 -4
- package/dist/components/date-picker/atoms.js +0 -4
- package/dist/components/date-picker/date-picker-calendar.svelte +67 -42
- package/dist/components/date-picker/date-picker-calendar.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker-header.svelte +100 -105
- package/dist/components/date-picker/date-picker-header.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker-months.svelte +142 -150
- package/dist/components/date-picker/date-picker-months.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker-root.svelte +4 -3
- package/dist/components/date-picker/date-picker-root.svelte.d.ts +2 -15
- package/dist/components/date-picker/date-picker-years.svelte +205 -214
- package/dist/components/date-picker/date-picker-years.svelte.d.ts +2 -5
- package/dist/components/date-picker/date-picker.stories.svelte +15 -31
- package/dist/components/date-picker/types.d.ts +53 -1
- package/dist/components/dialog/dialog-content.svelte +1 -1
- package/dist/components/dialog/dialog.stories.svelte +64 -67
- package/dist/components/drawer/attachments.svelte.js +8 -9
- package/dist/components/drawer/drawer-content.svelte +57 -42
- package/dist/components/drawer/drawer.stories.svelte +212 -224
- package/dist/components/dropdown/dropdown-root.svelte +59 -59
- package/dist/components/dropdown/dropdown.stories.svelte +80 -83
- package/dist/components/element/html-element.svelte +85 -85
- package/dist/components/element/types.d.ts +1 -1
- package/dist/components/form/form.stories.svelte +96 -99
- package/dist/components/image/image.stories.svelte +20 -23
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/input/input.stories.svelte +35 -38
- package/dist/components/label/label.stories.svelte +15 -26
- package/dist/components/label/label.stories.svelte.d.ts +24 -4
- package/dist/components/lazy/index.d.ts +1 -0
- package/dist/components/lazy/index.js +1 -0
- package/dist/components/lazy/lazy.stories.svelte +28 -0
- package/dist/components/lazy/lazy.stories.svelte.d.ts +19 -0
- package/dist/components/lazy/lazy.svelte +28 -0
- package/dist/components/lazy/lazy.svelte.d.ts +5 -0
- package/dist/components/lazy/types.d.ts +10 -0
- package/dist/components/lazy/types.js +1 -0
- package/dist/components/link/link.stories.svelte +15 -26
- package/dist/components/link/link.stories.svelte.d.ts +24 -4
- package/dist/components/menu/menu-list.svelte +2 -1
- package/dist/components/menu/menu-list.svelte.d.ts +1 -0
- package/dist/components/menu/menu.stories.svelte +33 -36
- package/dist/components/popover/bond.svelte.js +31 -25
- package/dist/components/popover/popover-arrow.svelte +111 -111
- package/dist/components/popover/popover-content.svelte +2 -5
- package/dist/components/popover/popover-indicator.svelte +44 -43
- package/dist/components/popover/popover-root.svelte +1 -1
- package/dist/components/popover/popover.stories.svelte +18 -21
- package/dist/components/qr-code/index.d.ts +1 -0
- package/dist/components/qr-code/index.js +1 -0
- package/dist/components/qr-code/qr-code.stories.svelte +4 -10
- package/dist/components/qr-code/qr-code.svelte +75 -25
- package/dist/components/qr-code/qr-code.svelte.d.ts +2 -4
- package/dist/components/qr-code/types.d.ts +14 -0
- package/dist/components/qr-code/types.js +1 -0
- package/dist/components/radio/radio-group.stories.svelte +41 -50
- package/dist/components/radio/radio.stories.svelte +17 -26
- package/dist/components/radio/radio.svelte +109 -109
- package/dist/components/root/root.svelte +121 -121
- package/dist/components/root/root.svelte.d.ts +1 -1
- package/dist/components/scrollable/scrollable.stories.svelte +116 -126
- package/dist/components/sidebar/bond.svelte.d.ts +0 -5
- package/dist/components/sidebar/bond.svelte.js +1 -12
- package/dist/components/sidebar/sidebar-content.svelte +50 -39
- package/dist/components/sidebar/sidebar-content.svelte.d.ts +2 -2
- package/dist/components/sidebar/sidebar-root.svelte +39 -68
- package/dist/components/sidebar/sidebar-root.svelte.d.ts +2 -2
- package/dist/components/sidebar/sidebar.stories.svelte +43 -52
- package/dist/components/sidebar/types.d.ts +7 -6
- package/dist/components/tabs/tab/bond.svelte.d.ts +4 -1
- package/dist/components/tabs/tab/bond.svelte.js +4 -1
- package/dist/components/tabs/tabs.stories.svelte +56 -59
- package/dist/components/tooltip/tooltip-trigger.svelte +39 -37
- package/dist/components/tooltip/tooltip.stories.svelte +32 -35
- package/dist/components/tree/tree.stories.svelte +142 -134
- package/dist/context/preset.svelte.d.ts +3 -3
- package/dist/utils/function.d.ts +2 -0
- package/dist/utils/function.js +6 -0
- package/llm/variants.md +1259 -1261
- package/package.json +7 -9
- package/dist/actions/animation.svelte.d.ts +0 -6
- package/dist/actions/animation.svelte.js +0 -14
- package/dist/actions/clickout.svelte.d.ts +0 -2
- package/dist/actions/clickout.svelte.js +0 -15
- package/dist/actions/popover.svelte.d.ts +0 -19
- package/dist/actions/popover.svelte.js +0 -81
- package/dist/actions/portal.svelte.d.ts +0 -8
- package/dist/actions/portal.svelte.js +0 -32
- package/dist/attachments/gsap.svelte.d.ts +0 -2
- package/dist/attachments/gsap.svelte.js +0 -26
|
@@ -1,208 +1,206 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn, defineProperty, defineState } from '../../utils';
|
|
3
|
-
import { addMonths, format, isToday, startOfDay, subMonths } from 'date-fns';
|
|
4
|
-
import type { CalendarRange, CalendarRootProps, Day, Month } from './types';
|
|
5
|
-
import { CalendarBond, CalendarBondState, type CalendarBondProps } from './bond.svelte';
|
|
6
|
-
import { HtmlAtom } from '../atom';
|
|
7
|
-
|
|
8
|
-
import './calendar.css';
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
class: klass = '',
|
|
12
|
-
preset = 'calendar',
|
|
13
|
-
value = $bindable(),
|
|
14
|
-
range = $bindable([undefined, undefined]),
|
|
15
|
-
pivote = $bindable(new Date()),
|
|
16
|
-
start = $bindable(startOfDay(new Date())),
|
|
17
|
-
end = $bindable(),
|
|
18
|
-
min = undefined,
|
|
19
|
-
max = undefined,
|
|
20
|
-
type = 'single',
|
|
21
|
-
extend = {},
|
|
22
|
-
onchange = undefined,
|
|
23
|
-
factory = _factory,
|
|
24
|
-
children = undefined,
|
|
25
|
-
...restProps
|
|
26
|
-
}: CalendarRootProps = $props();
|
|
27
|
-
|
|
28
|
-
const monthCurrentDays = $derived(generator(pivote));
|
|
29
|
-
|
|
30
|
-
$
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
pivot.getMonth()
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
),
|
|
179
|
-
defineProperty('
|
|
180
|
-
defineProperty('
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
{@render children?.({ calendar: bond })}
|
|
208
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, defineProperty, defineState } from '../../utils';
|
|
3
|
+
import { addMonths, format, isToday, startOfDay, subMonths } from 'date-fns';
|
|
4
|
+
import type { CalendarRange, CalendarRootProps, Day, Month } from './types';
|
|
5
|
+
import { CalendarBond, CalendarBondState, type CalendarBondProps } from './bond.svelte';
|
|
6
|
+
import { HtmlAtom } from '../atom';
|
|
7
|
+
|
|
8
|
+
import './calendar.css';
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
class: klass = '',
|
|
12
|
+
preset = 'calendar',
|
|
13
|
+
value = $bindable(),
|
|
14
|
+
range = $bindable([undefined, undefined]),
|
|
15
|
+
pivote = $bindable(new Date()),
|
|
16
|
+
start = $bindable(startOfDay(new Date())),
|
|
17
|
+
end = $bindable(),
|
|
18
|
+
min = undefined,
|
|
19
|
+
max = undefined,
|
|
20
|
+
type = 'single',
|
|
21
|
+
extend = {},
|
|
22
|
+
onchange = undefined,
|
|
23
|
+
factory = _factory,
|
|
24
|
+
children = undefined,
|
|
25
|
+
...restProps
|
|
26
|
+
}: CalendarRootProps = $props();
|
|
27
|
+
|
|
28
|
+
const monthCurrentDays = $derived(generator(pivote));
|
|
29
|
+
|
|
30
|
+
const monthCurrent: Month = $derived.by(() => {
|
|
31
|
+
const start = monthCurrentDays.at(0) as Day;
|
|
32
|
+
const end = monthCurrentDays.at(-1) as Day;
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
start: start?.date,
|
|
36
|
+
end: end?.date,
|
|
37
|
+
days: monthCurrentDays,
|
|
38
|
+
name: start ? format(start.date, 'MM') : '',
|
|
39
|
+
fullname: start ? format(start.date, 'MMM') : ''
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const monthPreviousDays = $derived(generator(subMonths(pivote, 1)));
|
|
44
|
+
const monthPrevious: Month = $derived.by(() => {
|
|
45
|
+
const start = monthPreviousDays.at(0) as Day;
|
|
46
|
+
const end = monthPreviousDays.at(-1) as Day;
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
start: start?.date,
|
|
50
|
+
end: end?.date,
|
|
51
|
+
days: monthPreviousDays,
|
|
52
|
+
name: start ? format(start.date, 'MM') : '',
|
|
53
|
+
fullname: start ? format(start.date, 'MMM') : ''
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const monthNextDays = $derived(generator(addMonths(pivote, 1)));
|
|
58
|
+
|
|
59
|
+
const monthNext: Month = $derived.by(() => {
|
|
60
|
+
const start = monthNextDays.at(0) as Day;
|
|
61
|
+
const end = monthNextDays.at(-1) as Day;
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
start: start?.date,
|
|
65
|
+
end: end?.date,
|
|
66
|
+
days: monthNextDays,
|
|
67
|
+
name: start ? format(start.date, 'MM') : '',
|
|
68
|
+
fullname: start ? format(start.date, 'MMM') : ''
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
function generator(pivot: Date): Day[] {
|
|
73
|
+
const firstDay = new Date(pivot.getFullYear(), pivot.getMonth(), 1).getDay();
|
|
74
|
+
const lastMonthDaysCount = monthDays(pivot.getMonth() - 1, pivot.getFullYear());
|
|
75
|
+
const sample = startOfDay(
|
|
76
|
+
new Date(pivot.getFullYear(), pivot.getMonth() - 1, lastMonthDaysCount - firstDay)
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const array: Day[] = [];
|
|
80
|
+
|
|
81
|
+
for (let index = 0; index < 42; index++) {
|
|
82
|
+
sample.setDate(sample.getDate() + 1);
|
|
83
|
+
|
|
84
|
+
const prec =
|
|
85
|
+
pivot.getMonth() > sample.getMonth() || pivot.getFullYear() > sample.getFullYear();
|
|
86
|
+
const next =
|
|
87
|
+
(pivot.getMonth() < sample.getMonth() && pivot.getFullYear() === sample.getFullYear()) ||
|
|
88
|
+
(pivot.getMonth() > sample.getMonth() && pivot.getFullYear() < sample.getFullYear());
|
|
89
|
+
|
|
90
|
+
const disabled =
|
|
91
|
+
(min ? sample < startOfDay(min) : false) || (max ? sample > startOfDay(max) : false);
|
|
92
|
+
|
|
93
|
+
array.push({
|
|
94
|
+
id: sample.getTime(),
|
|
95
|
+
date: new Date(sample),
|
|
96
|
+
get offmonth() {
|
|
97
|
+
return next || prec;
|
|
98
|
+
},
|
|
99
|
+
dayOfMonth: sample.getDate(),
|
|
100
|
+
today: isToday(sample),
|
|
101
|
+
week: Math.floor(index / 7),
|
|
102
|
+
month: sample.getMonth(),
|
|
103
|
+
disabled: disabled,
|
|
104
|
+
weekend: sample.getDay() == 0,
|
|
105
|
+
name: format(sample, 'iii'),
|
|
106
|
+
fullname: format(sample, 'iiiii'),
|
|
107
|
+
get fromNextMonth() {
|
|
108
|
+
return next;
|
|
109
|
+
},
|
|
110
|
+
get fromPreviousMonth() {
|
|
111
|
+
return prec;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return array;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function monthDays(month: number, year = 2020) {
|
|
120
|
+
return new Date(year, month + 1, 0).getDate();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const bondProps = defineState<CalendarBondProps>(
|
|
124
|
+
[
|
|
125
|
+
defineProperty(
|
|
126
|
+
'range',
|
|
127
|
+
() => range,
|
|
128
|
+
(v: CalendarRange) => {
|
|
129
|
+
range = v;
|
|
130
|
+
onchange?.(new CustomEvent('change'), { range, pivote });
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
defineProperty(
|
|
134
|
+
'value',
|
|
135
|
+
() => range?.[0],
|
|
136
|
+
(v) => {
|
|
137
|
+
if (range?.[0]) {
|
|
138
|
+
range[0] = v;
|
|
139
|
+
}
|
|
140
|
+
onchange?.(new CustomEvent('change'), { range, pivote });
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
defineProperty(
|
|
144
|
+
'pivote',
|
|
145
|
+
() => pivote,
|
|
146
|
+
(v: Date) => {
|
|
147
|
+
pivote = v;
|
|
148
|
+
onchange?.(new CustomEvent('change'), { range, pivote });
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
defineProperty(
|
|
152
|
+
'start',
|
|
153
|
+
() => range?.[0],
|
|
154
|
+
(v: Date) => {
|
|
155
|
+
range[0] = v;
|
|
156
|
+
onchange?.(new CustomEvent('change'), { range, pivote });
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
defineProperty(
|
|
160
|
+
'end',
|
|
161
|
+
() => range?.[1],
|
|
162
|
+
(v: Date | undefined) => {
|
|
163
|
+
range[1] = v;
|
|
164
|
+
onchange?.(new CustomEvent('change'), { range, pivote });
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
defineProperty(
|
|
168
|
+
'min',
|
|
169
|
+
() => min,
|
|
170
|
+
(v: Date | undefined) => (min = v)
|
|
171
|
+
),
|
|
172
|
+
defineProperty(
|
|
173
|
+
'max',
|
|
174
|
+
() => max,
|
|
175
|
+
(v: Date | undefined) => (max = v)
|
|
176
|
+
),
|
|
177
|
+
defineProperty('type', () => type ?? 'single'),
|
|
178
|
+
defineProperty('nextMonth', () => monthNext),
|
|
179
|
+
defineProperty('currentMonth', () => monthCurrent),
|
|
180
|
+
defineProperty('previousMonth', () => monthPrevious)
|
|
181
|
+
],
|
|
182
|
+
() => ({ extend })
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const bond = factory(bondProps).share();
|
|
186
|
+
|
|
187
|
+
const rootProps = $derived({
|
|
188
|
+
...bond.root(),
|
|
189
|
+
...restProps
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
function _factory(props: typeof bondProps) {
|
|
193
|
+
const popoverState = new CalendarBondState(() => props);
|
|
194
|
+
const popoverBond = new CalendarBond(popoverState);
|
|
195
|
+
|
|
196
|
+
return popoverBond;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function getBond() {
|
|
200
|
+
return bond;
|
|
201
|
+
}
|
|
202
|
+
</script>
|
|
203
|
+
|
|
204
|
+
<HtmlAtom {preset} class={cn('h-full w-full', klass)} data-atom="calendar-root" {...rootProps}>
|
|
205
|
+
{@render children?.({ calendar: bond })}
|
|
206
|
+
</HtmlAtom>
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn } from '../../utils';
|
|
3
|
-
import { HtmlAtom } from '../atom';
|
|
4
|
-
import { CalendarBond } from './bond.svelte';
|
|
5
|
-
|
|
6
|
-
const calendarBond = CalendarBond.get();
|
|
7
|
-
|
|
8
|
-
let {
|
|
9
|
-
class: klass = '',
|
|
10
|
-
preset = 'calendar.weekday',
|
|
11
|
-
isWeekend,
|
|
12
|
-
element = $bindable(undefined),
|
|
13
|
-
children = undefined,
|
|
14
|
-
...restProps
|
|
15
|
-
} = $props();
|
|
16
|
-
|
|
17
|
-
const weekDayProps = $derived({
|
|
18
|
-
...calendarBond?.weekDay(),
|
|
19
|
-
...restProps
|
|
20
|
-
});
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<HtmlAtom
|
|
24
|
-
{preset}
|
|
25
|
-
class={cn(
|
|
26
|
-
'calendar-week-day h-fit px-2 py-2 text-center text-sm font-medium',
|
|
27
|
-
isWeekend ? 'text-primary' : '',
|
|
28
|
-
klass
|
|
29
|
-
)}
|
|
30
|
-
data-weekend={isWeekend}
|
|
31
|
-
{...weekDayProps}
|
|
32
|
-
>
|
|
33
|
-
{@render children?.()}
|
|
34
|
-
</HtmlAtom>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../utils';
|
|
3
|
+
import { HtmlAtom } from '../atom';
|
|
4
|
+
import { CalendarBond } from './bond.svelte';
|
|
5
|
+
|
|
6
|
+
const calendarBond = CalendarBond.get();
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: klass = '',
|
|
10
|
+
preset = 'calendar.weekday',
|
|
11
|
+
isWeekend,
|
|
12
|
+
element = $bindable(undefined),
|
|
13
|
+
children = undefined,
|
|
14
|
+
...restProps
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
const weekDayProps = $derived({
|
|
18
|
+
...calendarBond?.weekDay(),
|
|
19
|
+
...restProps
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<HtmlAtom
|
|
24
|
+
{preset}
|
|
25
|
+
class={cn(
|
|
26
|
+
'calendar-week-day h-fit px-2 py-2 text-center text-sm font-medium',
|
|
27
|
+
isWeekend ? 'text-primary' : '',
|
|
28
|
+
klass
|
|
29
|
+
)}
|
|
30
|
+
data-weekend={isWeekend}
|
|
31
|
+
{...weekDayProps}
|
|
32
|
+
>
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
</HtmlAtom>
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
[data-atom='calendar-root'] {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-columns: repeat(7, 1fr);
|
|
4
|
-
grid-template-rows: auto 1fr;
|
|
5
|
-
/*
|
|
6
|
-
--icare-root-background-color: color-mix(in srgb, black 5%, white 100%);
|
|
7
|
-
--icare-root-background-color-hover: color-mix(in srgb, black 5%, white 100%);
|
|
8
|
-
--icare-root-background-color-active: color-mix(in srgb, black 5%, white 100%);
|
|
9
|
-
|
|
10
|
-
--icare-root-text-color: black;
|
|
11
|
-
|
|
12
|
-
--icare-disabled-background-color: black;
|
|
13
|
-
--icare-disabled-text-color: black;
|
|
14
|
-
|
|
15
|
-
--icare-selected-background-color: black;
|
|
16
|
-
--icare-selected-text-color: white;
|
|
17
|
-
|
|
18
|
-
--icare-today-background-color: black;
|
|
19
|
-
--icare-today-text-color: black;
|
|
20
|
-
|
|
21
|
-
--icare-weekend-background-color: black;
|
|
22
|
-
--icare-weekend-text-color: black;
|
|
23
|
-
|
|
24
|
-
--icare-offmonth-background-color: black;
|
|
25
|
-
--icare-offmonth-text-color: black; */
|
|
26
|
-
}
|
|
1
|
+
[data-atom='calendar-root'] {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(7, 1fr);
|
|
4
|
+
grid-template-rows: auto 1fr;
|
|
5
|
+
/*
|
|
6
|
+
--icare-root-background-color: color-mix(in srgb, black 5%, white 100%);
|
|
7
|
+
--icare-root-background-color-hover: color-mix(in srgb, black 5%, white 100%);
|
|
8
|
+
--icare-root-background-color-active: color-mix(in srgb, black 5%, white 100%);
|
|
9
|
+
|
|
10
|
+
--icare-root-text-color: black;
|
|
11
|
+
|
|
12
|
+
--icare-disabled-background-color: black;
|
|
13
|
+
--icare-disabled-text-color: black;
|
|
14
|
+
|
|
15
|
+
--icare-selected-background-color: black;
|
|
16
|
+
--icare-selected-text-color: white;
|
|
17
|
+
|
|
18
|
+
--icare-today-background-color: black;
|
|
19
|
+
--icare-today-text-color: black;
|
|
20
|
+
|
|
21
|
+
--icare-weekend-background-color: black;
|
|
22
|
+
--icare-weekend-text-color: black;
|
|
23
|
+
|
|
24
|
+
--icare-offmonth-background-color: black;
|
|
25
|
+
--icare-offmonth-text-color: black; */
|
|
26
|
+
}
|
|
@@ -8,29 +8,19 @@
|
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
|
-
import CalendarHeader from './calendar-header.svelte';
|
|
12
|
-
import { Root } from '../root';
|
|
13
|
-
import { Card } from '../card';
|
|
14
|
-
|
|
15
|
-
let value = $state(undefined);
|
|
16
|
-
let checked = $state(false);
|
|
17
11
|
</script>
|
|
18
12
|
|
|
19
13
|
<Story name="Calendar">
|
|
20
14
|
{#snippet children({ args })}
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<CalendarModule.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</CalendarModule.Root>
|
|
32
|
-
</div>
|
|
33
|
-
{/snippet}
|
|
34
|
-
</Root>
|
|
15
|
+
<div class="flex h-fit items-center justify-center">
|
|
16
|
+
<CalendarModule.Root>
|
|
17
|
+
<CalendarModule.Header></CalendarModule.Header>
|
|
18
|
+
<CalendarModule.Body>
|
|
19
|
+
{#snippet children({ day })}
|
|
20
|
+
<CalendarModule.Day {day}></CalendarModule.Day>
|
|
21
|
+
{/snippet}
|
|
22
|
+
</CalendarModule.Body>
|
|
23
|
+
</CalendarModule.Root>
|
|
24
|
+
</div>
|
|
35
25
|
{/snippet}
|
|
36
26
|
</Story>
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
export default Calendar;
|
|
2
|
-
type Calendar = {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type Calendar = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string;
|
|
5
8
|
};
|
|
6
|
-
declare const Calendar:
|
|
9
|
+
declare const Calendar: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|