@vertz/ui-primitives 0.2.38 → 0.2.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/chunk-06m8prfg.js +52 -0
- package/dist/shared/chunk-0n9jj8xr.js +24 -0
- package/dist/shared/chunk-1ben27xq.js +317 -0
- package/dist/shared/chunk-1j2mj0sa.js +45 -0
- package/dist/shared/chunk-250hj18f.js +243 -0
- package/dist/shared/chunk-2h4m9c71.js +38 -0
- package/dist/shared/chunk-2sbx20hv.js +128 -0
- package/dist/shared/chunk-2ye674gr.js +70 -0
- package/dist/shared/chunk-34d8385y.js +15 -0
- package/dist/shared/chunk-4d7bm8h0.js +113 -0
- package/dist/shared/chunk-4zjgxr7x.js +157 -0
- package/dist/shared/chunk-5c150wvr.js +140 -0
- package/dist/shared/chunk-5gycdypd.js +58 -0
- package/dist/shared/chunk-6mm7fhp8.js +105 -0
- package/dist/shared/chunk-6zmnqvh6.js +109 -0
- package/dist/shared/{chunk-yy3ft5mb.js → chunk-7amn5d71.js} +2 -2
- package/dist/shared/chunk-7pbff2hg.js +118 -0
- package/dist/shared/chunk-7zpjshwz.js +194 -0
- package/dist/shared/chunk-993ff51d.js +155 -0
- package/dist/shared/chunk-9pdt5aw7.js +24 -0
- package/dist/shared/chunk-a71m4xkv.js +106 -0
- package/dist/shared/chunk-aj8m39pk.js +127 -0
- package/dist/shared/chunk-ajawpc05.js +305 -0
- package/dist/shared/chunk-b7mzwqhj.js +125 -0
- package/dist/shared/chunk-bb887de4.js +200 -0
- package/dist/shared/chunk-bfsmbrxc.js +111 -0
- package/dist/shared/chunk-c2f63m5n.js +56 -0
- package/dist/shared/chunk-c5r3s5km.js +263 -0
- package/dist/shared/chunk-caba5bhd.js +427 -0
- package/dist/shared/chunk-crym07yc.js +264 -0
- package/dist/shared/{chunk-5964gmv0.js → chunk-csjtyvam.js} +62 -88
- package/dist/shared/chunk-d6rtejz3.js +128 -0
- package/dist/shared/chunk-dvaf0bmq.js +140 -0
- package/dist/shared/chunk-dwkv9ya6.js +22 -0
- package/dist/shared/chunk-e0ckxrjg.js +41 -0
- package/dist/shared/chunk-ennxcymj.js +225 -0
- package/dist/shared/{chunk-1jd1n0dt.js → chunk-ey38de46.js} +19 -47
- package/dist/shared/chunk-f0v1gs5e.js +52 -0
- package/dist/shared/chunk-f86rsf84.js +231 -0
- package/dist/shared/chunk-fdse46x5.js +21 -0
- package/dist/shared/chunk-gj4hrssn.js +135 -0
- package/dist/shared/chunk-gyvq4gk9.js +24 -0
- package/dist/shared/chunk-hbnps9sq.js +229 -0
- package/dist/shared/{chunk-fhss32ya.js → chunk-hdmpyeq9.js} +43 -132
- package/dist/shared/chunk-hgnkd4he.js +256 -0
- package/dist/shared/chunk-hpcyffm7.js +185 -0
- package/dist/shared/chunk-hpmvwx0h.js +99 -0
- package/dist/shared/chunk-hz0e504p.js +69 -0
- package/dist/shared/chunk-hzk4wfq9.js +43 -0
- package/dist/shared/chunk-j7znzkpa.js +48 -0
- package/dist/shared/chunk-j9kxgrnn.js +167 -0
- package/dist/shared/chunk-jetwnv0w.js +130 -0
- package/dist/shared/chunk-jjdg26c1.js +155 -0
- package/dist/shared/chunk-k0m4yh86.js +123 -0
- package/dist/shared/chunk-k43q9cjr.js +82 -0
- package/dist/shared/chunk-k9k8tbr5.js +119 -0
- package/dist/shared/chunk-meaj7br1.js +232 -0
- package/dist/shared/chunk-mgj0n08k.js +34 -0
- package/dist/shared/chunk-mjz4rp6c.js +46 -0
- package/dist/shared/chunk-n4rr5gme.js +239 -0
- package/dist/shared/chunk-nk55etpp.js +65 -0
- package/dist/shared/chunk-nkh1ks3k.js +264 -0
- package/dist/shared/chunk-pgvpvbpe.js +26 -0
- package/dist/shared/chunk-pma8gnv7.js +178 -0
- package/dist/shared/chunk-q7xv6xze.js +131 -0
- package/dist/shared/chunk-qey801nq.js +22 -0
- package/dist/shared/chunk-s6b4c3tj.js +58 -0
- package/dist/shared/chunk-sq27a4h0.js +36 -0
- package/dist/shared/chunk-taa5pj15.js +103 -0
- package/dist/shared/chunk-tc5rpvyx.js +127 -0
- package/dist/shared/chunk-tescm0b3.js +192 -0
- package/dist/shared/chunk-tkftdwnq.js +71 -0
- package/dist/shared/chunk-tqhnjcfp.js +116 -0
- package/dist/shared/chunk-vfknb5ht.js +183 -0
- package/dist/shared/chunk-vsc369w3.js +185 -0
- package/dist/shared/chunk-whq9s8v5.js +301 -0
- package/dist/shared/{chunk-hze1f32t.js → chunk-wrqddgaj.js} +1 -1
- package/dist/shared/chunk-yzbmkx4r.js +155 -0
- package/dist/shared/chunk-zaen0ajc.js +347 -0
- package/dist/src/accordion/accordion-composed.js +1 -1
- package/dist/src/accordion/accordion.js +1 -1
- package/dist/src/alert/alert-composed.js +1 -1
- package/dist/src/alert-dialog/alert-dialog-composed.js +1 -1
- package/dist/src/alert-dialog/alert-dialog.js +1 -1
- package/dist/src/avatar/avatar-composed.js +1 -1
- package/dist/src/badge/badge-composed.js +1 -1
- package/dist/src/badge/badge.js +1 -1
- package/dist/src/breadcrumb/breadcrumb-composed.js +1 -1
- package/dist/src/button/button-composed.js +1 -1
- package/dist/src/button/button.js +1 -1
- package/dist/src/calendar/calendar-composed.js +1 -1
- package/dist/src/calendar/calendar.js +1 -1
- package/dist/src/card/card-composed.js +1 -1
- package/dist/src/carousel/carousel-composed.js +1 -1
- package/dist/src/carousel/carousel.js +1 -1
- package/dist/src/checkbox/checkbox-composed.js +1 -1
- package/dist/src/checkbox/checkbox.js +1 -1
- package/dist/src/collapsible/collapsible-composed.js +1 -1
- package/dist/src/collapsible/collapsible.js +1 -1
- package/dist/src/combobox/combobox-composed.js +1 -1
- package/dist/src/combobox/combobox.js +1 -1
- package/dist/src/command/command-composed.js +1 -1
- package/dist/src/command/command.js +1 -1
- package/dist/src/composed/with-styles.js +1 -1
- package/dist/src/context-menu/context-menu-composed.js +1 -1
- package/dist/src/context-menu/context-menu.js +1 -1
- package/dist/src/date-picker/date-picker-composed.js +1 -1
- package/dist/src/date-picker/date-picker.js +1 -1
- package/dist/src/dialog/dialog-composed.js +1 -1
- package/dist/src/dialog/dialog-stack-parts.js +1 -1
- package/dist/src/dialog/dialog.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu-composed.js +1 -1
- package/dist/src/dropdown-menu/dropdown-menu.js +1 -1
- package/dist/src/empty-state/empty-state-composed.js +1 -1
- package/dist/src/form-group/form-group-composed.js +1 -1
- package/dist/src/hover-card/hover-card-composed.js +1 -1
- package/dist/src/hover-card/hover-card.js +1 -1
- package/dist/src/input/input-composed.js +1 -1
- package/dist/src/label/label-composed.js +1 -1
- package/dist/src/list/list-composed.js +1 -1
- package/dist/src/menu/menu-composed.js +1 -1
- package/dist/src/menu/menu.js +1 -1
- package/dist/src/menubar/menubar-composed.js +1 -1
- package/dist/src/menubar/menubar.js +1 -1
- package/dist/src/navigation-menu/navigation-menu-composed.js +1 -1
- package/dist/src/navigation-menu/navigation-menu.js +1 -1
- package/dist/src/pagination/pagination-composed.js +1 -1
- package/dist/src/popover/popover-composed.js +1 -1
- package/dist/src/popover/popover.js +1 -1
- package/dist/src/progress/progress-composed.js +1 -1
- package/dist/src/progress/progress.js +1 -1
- package/dist/src/radio/radio-composed.js +1 -1
- package/dist/src/radio/radio.js +1 -1
- package/dist/src/resizable-panel/resizable-panel-composed.js +1 -1
- package/dist/src/resizable-panel/resizable-panel.js +1 -1
- package/dist/src/scroll-area/scroll-area-composed.js +1 -1
- package/dist/src/scroll-area/scroll-area.js +1 -1
- package/dist/src/select/select-composed.js +1 -1
- package/dist/src/select/select.js +1 -1
- package/dist/src/separator/separator-composed.js +1 -1
- package/dist/src/sheet/sheet-composed.js +1 -1
- package/dist/src/sheet/sheet.js +1 -1
- package/dist/src/skeleton/skeleton-composed.js +1 -1
- package/dist/src/slider/slider-composed.js +1 -1
- package/dist/src/slider/slider.js +1 -1
- package/dist/src/switch/switch-composed.js +1 -1
- package/dist/src/switch/switch.js +1 -1
- package/dist/src/table/table-composed.js +1 -1
- package/dist/src/tabs/tabs-composed.js +1 -1
- package/dist/src/tabs/tabs.js +1 -1
- package/dist/src/textarea/textarea-composed.js +1 -1
- package/dist/src/toast/toast.js +1 -1
- package/dist/src/toggle/toggle-composed.js +1 -1
- package/dist/src/toggle/toggle.js +1 -1
- package/dist/src/toggle-group/toggle-group-composed.js +1 -1
- package/dist/src/toggle-group/toggle-group.js +1 -1
- package/dist/src/tooltip/tooltip-composed.js +1 -1
- package/dist/src/tooltip/tooltip.js +1 -1
- package/package.json +3 -3
- package/dist/shared/chunk-144kbnmx.js +0 -95
- package/dist/shared/chunk-1ewxfgsa.js +0 -167
- package/dist/shared/chunk-1hm0mbke.js +0 -258
- package/dist/shared/chunk-22rt6ws9.js +0 -69
- package/dist/shared/chunk-2ssqz188.js +0 -162
- package/dist/shared/chunk-33he7ay9.js +0 -218
- package/dist/shared/chunk-3jack97k.js +0 -509
- package/dist/shared/chunk-75pegjs7.js +0 -26
- package/dist/shared/chunk-862x7dja.js +0 -398
- package/dist/shared/chunk-8pk1pn5h.js +0 -215
- package/dist/shared/chunk-8t0nm721.js +0 -152
- package/dist/shared/chunk-94twh4s4.js +0 -28
- package/dist/shared/chunk-9yb26c0w.js +0 -232
- package/dist/shared/chunk-a82r2pnq.js +0 -67
- package/dist/shared/chunk-axpbdpgx.js +0 -177
- package/dist/shared/chunk-b3j6mym6.js +0 -203
- package/dist/shared/chunk-b4zzg457.js +0 -410
- package/dist/shared/chunk-b9qxfcsy.js +0 -60
- package/dist/shared/chunk-bc2qqkhr.js +0 -194
- package/dist/shared/chunk-bv12nkdm.js +0 -149
- package/dist/shared/chunk-bvxc1ww4.js +0 -164
- package/dist/shared/chunk-czv0kqj4.js +0 -107
- package/dist/shared/chunk-d83ag07h.js +0 -189
- package/dist/shared/chunk-de18ashk.js +0 -134
- package/dist/shared/chunk-dvk4h36t.js +0 -140
- package/dist/shared/chunk-dxvnerw2.js +0 -353
- package/dist/shared/chunk-e399pzdq.js +0 -241
- package/dist/shared/chunk-e4qha9as.js +0 -180
- package/dist/shared/chunk-eb2d9v6k.js +0 -68
- package/dist/shared/chunk-ect26sp5.js +0 -353
- package/dist/shared/chunk-ev367pq3.js +0 -102
- package/dist/shared/chunk-fjykbv0v.js +0 -214
- package/dist/shared/chunk-gdddk6nh.js +0 -96
- package/dist/shared/chunk-ghkw5bjq.js +0 -55
- package/dist/shared/chunk-hfjtkytb.js +0 -310
- package/dist/shared/chunk-hpvjfj0j.js +0 -31
- package/dist/shared/chunk-jpyjk616.js +0 -52
- package/dist/shared/chunk-k6d53tne.js +0 -206
- package/dist/shared/chunk-knzg86am.js +0 -168
- package/dist/shared/chunk-ktbf6xrt.js +0 -179
- package/dist/shared/chunk-m8y2p66x.js +0 -252
- package/dist/shared/chunk-metxdt5x.js +0 -28
- package/dist/shared/chunk-mgae1d93.js +0 -157
- package/dist/shared/chunk-mtx2cfbx.js +0 -175
- package/dist/shared/chunk-n436p5cb.js +0 -260
- package/dist/shared/chunk-nj420k31.js +0 -54
- package/dist/shared/chunk-nsmvdxgp.js +0 -213
- package/dist/shared/chunk-pcms04vq.js +0 -162
- package/dist/shared/chunk-pqskzq8t.js +0 -79
- package/dist/shared/chunk-pwr60kyd.js +0 -321
- package/dist/shared/chunk-pzknpa1y.js +0 -327
- package/dist/shared/chunk-q77y3rg4.js +0 -189
- package/dist/shared/chunk-qhnany7w.js +0 -179
- package/dist/shared/chunk-r3pffzss.js +0 -13
- package/dist/shared/chunk-rdr0rtpr.js +0 -131
- package/dist/shared/chunk-rj52ty6r.js +0 -147
- package/dist/shared/chunk-rnqc7735.js +0 -125
- package/dist/shared/chunk-rtk30950.js +0 -202
- package/dist/shared/chunk-s0xgd8vg.js +0 -266
- package/dist/shared/chunk-s415735j.js +0 -357
- package/dist/shared/chunk-s62e7jf4.js +0 -30
- package/dist/shared/chunk-snd8e6r8.js +0 -418
- package/dist/shared/chunk-spng4yb9.js +0 -73
- package/dist/shared/chunk-t887wwjc.js +0 -168
- package/dist/shared/chunk-tn0m98j8.js +0 -42
- package/dist/shared/chunk-v0b5pkcq.js +0 -30
- package/dist/shared/chunk-v5tj7veh.js +0 -284
- package/dist/shared/chunk-vkscwzpr.js +0 -294
- package/dist/shared/chunk-vv187snj.js +0 -112
- package/dist/shared/chunk-xv4wd0kf.js +0 -293
- package/dist/shared/chunk-y1hpsqzy.js +0 -185
- package/dist/shared/chunk-yfzddvxc.js +0 -71
- package/dist/shared/chunk-yzgzx2dh.js +0 -311
- package/dist/shared/chunk-z5j7ztf2.js +0 -467
|
@@ -1,509 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-q7xbcj9q.js";
|
|
4
|
-
|
|
5
|
-
// src/calendar/calendar-composed.tsx
|
|
6
|
-
import { computed, signal } from "@vertz/ui";
|
|
7
|
-
import { __append, __attr, __child, __conditional, __discardMountFrame, __element, __enterChildren, __exitChildren, __flushMountFrame, __insert, __list, __on, __prop, __pushMountFrame } from "@vertz/ui/internals";
|
|
8
|
-
var MONTH_NAMES = [
|
|
9
|
-
"January",
|
|
10
|
-
"February",
|
|
11
|
-
"March",
|
|
12
|
-
"April",
|
|
13
|
-
"May",
|
|
14
|
-
"June",
|
|
15
|
-
"July",
|
|
16
|
-
"August",
|
|
17
|
-
"September",
|
|
18
|
-
"October",
|
|
19
|
-
"November",
|
|
20
|
-
"December"
|
|
21
|
-
];
|
|
22
|
-
var DAY_NAMES = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
23
|
-
var MONTH_OPTIONS = MONTH_NAMES.map((name, index) => ({ name, index }));
|
|
24
|
-
function getDaysInMonth(year, month) {
|
|
25
|
-
return new Date(year, month + 1, 0).getDate();
|
|
26
|
-
}
|
|
27
|
-
function isSameDay(a, b) {
|
|
28
|
-
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
29
|
-
}
|
|
30
|
-
function addDays(date, days) {
|
|
31
|
-
const result = new Date(date);
|
|
32
|
-
result.setDate(result.getDate() + days);
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
function addMonths(date, months) {
|
|
36
|
-
const result = new Date(date);
|
|
37
|
-
result.setMonth(result.getMonth() + months);
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
function formatDate(date) {
|
|
41
|
-
const y = date.getFullYear();
|
|
42
|
-
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
43
|
-
const d = String(date.getDate()).padStart(2, "0");
|
|
44
|
-
return `${y}-${m}-${d}`;
|
|
45
|
-
}
|
|
46
|
-
function isSelectedDate(date, val) {
|
|
47
|
-
if (val === null)
|
|
48
|
-
return false;
|
|
49
|
-
if (val instanceof Date)
|
|
50
|
-
return isSameDay(val, date);
|
|
51
|
-
if (Array.isArray(val))
|
|
52
|
-
return val.some((d) => isSameDay(d, date));
|
|
53
|
-
if ("from" in val && "to" in val) {
|
|
54
|
-
return isSameDay(val.from, date) || isSameDay(val.to, date);
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
function isInRangeDate(date, val) {
|
|
59
|
-
if (val === null || !("from" in val))
|
|
60
|
-
return false;
|
|
61
|
-
const range = val;
|
|
62
|
-
return date > range.from && date < range.to;
|
|
63
|
-
}
|
|
64
|
-
function isDateDisabledCheck(date, minDate, maxDate, disabled) {
|
|
65
|
-
if (disabled?.(date))
|
|
66
|
-
return true;
|
|
67
|
-
if (minDate && date < minDate && !isSameDay(date, minDate))
|
|
68
|
-
return true;
|
|
69
|
-
if (maxDate && date > maxDate && !isSameDay(date, maxDate))
|
|
70
|
-
return true;
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
function computeYearRange(now, minDate, maxDate) {
|
|
74
|
-
const minYear = minDate ? minDate.getFullYear() : now.getFullYear() - 100;
|
|
75
|
-
const maxYear = maxDate ? maxDate.getFullYear() : now.getFullYear() + 10;
|
|
76
|
-
const years = [];
|
|
77
|
-
for (let y = minYear;y <= maxYear; y++) {
|
|
78
|
-
years.push(y);
|
|
79
|
-
}
|
|
80
|
-
return years;
|
|
81
|
-
}
|
|
82
|
-
function isMonthDisabled(month, year, minDate, maxDate) {
|
|
83
|
-
if (minDate && year === minDate.getFullYear() && month < minDate.getMonth())
|
|
84
|
-
return true;
|
|
85
|
-
if (maxDate && year === maxDate.getFullYear() && month > maxDate.getMonth())
|
|
86
|
-
return true;
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
function computeGridRows(display, weekStartsOn) {
|
|
90
|
-
const year = display.getFullYear();
|
|
91
|
-
const month = display.getMonth();
|
|
92
|
-
const daysInMonth = getDaysInMonth(year, month);
|
|
93
|
-
const firstDay = new Date(year, month, 1);
|
|
94
|
-
const firstDayOfWeek = firstDay.getDay();
|
|
95
|
-
const offset = (firstDayOfWeek - weekStartsOn + 7) % 7;
|
|
96
|
-
const startDate = addDays(firstDay, -offset);
|
|
97
|
-
const totalCells = offset + daysInMonth;
|
|
98
|
-
const totalRows = Math.ceil(totalCells / 7);
|
|
99
|
-
const rows = [];
|
|
100
|
-
let current = startDate;
|
|
101
|
-
for (let row = 0;row < totalRows; row++) {
|
|
102
|
-
const rowDates = [];
|
|
103
|
-
for (let col = 0;col < 7; col++) {
|
|
104
|
-
rowDates.push(new Date(current));
|
|
105
|
-
current = addDays(current, 1);
|
|
106
|
-
}
|
|
107
|
-
rows.push(rowDates);
|
|
108
|
-
}
|
|
109
|
-
return rows;
|
|
110
|
-
}
|
|
111
|
-
function DayCell(__props) {
|
|
112
|
-
const __mfDepth = __pushMountFrame();
|
|
113
|
-
try {
|
|
114
|
-
const dateStr = computed(() => formatDate(__props.cellDate));
|
|
115
|
-
const isOutside = computed(() => __props.cellDate.getMonth() !== __props.displayMonth.getMonth());
|
|
116
|
-
const isToday = computed(() => isSameDay(__props.cellDate, __props.now));
|
|
117
|
-
const isDisabled = computed(() => isDateDisabledCheck(__props.cellDate, __props.minDate, __props.maxDate, __props.disabled));
|
|
118
|
-
const selected = computed(() => isSelectedDate(__props.cellDate, __props.value));
|
|
119
|
-
const rangeVal = computed(() => __props.value);
|
|
120
|
-
const isRangeStart = computed(() => __props.mode === "range" && rangeVal.value && ("from" in rangeVal.value) && isSameDay(__props.cellDate, rangeVal.value.from));
|
|
121
|
-
const isRangeEnd = computed(() => __props.mode === "range" && rangeVal.value && ("to" in rangeVal.value) && isSameDay(__props.cellDate, rangeVal.value.to));
|
|
122
|
-
const inRange = computed(() => __props.mode === "range" && isInRangeDate(__props.cellDate, __props.value));
|
|
123
|
-
const __mfResult0 = (() => {
|
|
124
|
-
const __el0 = __element("button");
|
|
125
|
-
__el0.setAttribute("type", "button");
|
|
126
|
-
__attr(__el0, "class", () => cn(__props.classes?.dayButton));
|
|
127
|
-
__attr(__el0, "data-date", () => dateStr.value);
|
|
128
|
-
__attr(__el0, "data-outside-month", () => isOutside.value ? "true" : undefined);
|
|
129
|
-
__attr(__el0, "data-today", () => isToday.value ? "true" : undefined);
|
|
130
|
-
__attr(__el0, "aria-disabled", () => isDisabled.value ? "true" : undefined);
|
|
131
|
-
__attr(__el0, "aria-selected", () => selected.value ? "true" : undefined);
|
|
132
|
-
__attr(__el0, "data-range-start", () => isRangeStart.value ? "true" : undefined);
|
|
133
|
-
__attr(__el0, "data-range-end", () => isRangeEnd.value ? "true" : undefined);
|
|
134
|
-
__attr(__el0, "data-in-range", () => inRange.value ? "true" : undefined);
|
|
135
|
-
__on(__el0, "click", () => __props.onSelect(__props.cellDate));
|
|
136
|
-
__enterChildren(__el0);
|
|
137
|
-
__append(__el0, __child(() => __props.cellDate.getDate()));
|
|
138
|
-
__exitChildren();
|
|
139
|
-
return __el0;
|
|
140
|
-
})();
|
|
141
|
-
__flushMountFrame();
|
|
142
|
-
return __mfResult0;
|
|
143
|
-
} catch (__mfErr) {
|
|
144
|
-
__discardMountFrame(__mfDepth);
|
|
145
|
-
throw __mfErr;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function ComposedCalendarRoot(__props) {
|
|
149
|
-
const __mfDepth = __pushMountFrame();
|
|
150
|
-
try {
|
|
151
|
-
let selectDate = function(date) {
|
|
152
|
-
if (isDateDisabledCheck(date, __props.minDate, __props.maxDate, __props.disabled))
|
|
153
|
-
return;
|
|
154
|
-
if (mode.value === "single") {
|
|
155
|
-
value.value = date;
|
|
156
|
-
} else if (mode.value === "multiple") {
|
|
157
|
-
const current = value.value ?? [];
|
|
158
|
-
const existing = current.findIndex((d) => isSameDay(d, date));
|
|
159
|
-
if (existing >= 0) {
|
|
160
|
-
const next = [...current];
|
|
161
|
-
next.splice(existing, 1);
|
|
162
|
-
value.value = next;
|
|
163
|
-
} else {
|
|
164
|
-
value.value = [...current, date];
|
|
165
|
-
}
|
|
166
|
-
} else if (mode.value === "range") {
|
|
167
|
-
const current = value.value;
|
|
168
|
-
if (!current || "to" in current && current.to) {
|
|
169
|
-
value.value = { from: date, to: date };
|
|
170
|
-
} else {
|
|
171
|
-
if (date < current.from) {
|
|
172
|
-
value.value = { from: date, to: current.from };
|
|
173
|
-
} else {
|
|
174
|
-
value.value = { from: current.from, to: date };
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
__props.onValueChange?.(value.value);
|
|
179
|
-
}, navigateMonth = function(delta) {
|
|
180
|
-
displayMonth.value = addMonths(displayMonth.value, delta);
|
|
181
|
-
__props.onMonthChange?.(displayMonth.value);
|
|
182
|
-
}, handleGridKeydown = function(event) {
|
|
183
|
-
const gridEl = event.currentTarget;
|
|
184
|
-
const active = document.activeElement;
|
|
185
|
-
if (!active || active.tagName !== "BUTTON")
|
|
186
|
-
return;
|
|
187
|
-
const dateStr = active.getAttribute("data-date");
|
|
188
|
-
if (!dateStr)
|
|
189
|
-
return;
|
|
190
|
-
const focused = new Date(`${dateStr}T00:00:00`);
|
|
191
|
-
let next = null;
|
|
192
|
-
if (event.key === "ArrowLeft") {
|
|
193
|
-
event.preventDefault();
|
|
194
|
-
next = addDays(focused, -1);
|
|
195
|
-
} else if (event.key === "ArrowRight") {
|
|
196
|
-
event.preventDefault();
|
|
197
|
-
next = addDays(focused, 1);
|
|
198
|
-
} else if (event.key === "ArrowUp") {
|
|
199
|
-
event.preventDefault();
|
|
200
|
-
next = addDays(focused, -7);
|
|
201
|
-
} else if (event.key === "ArrowDown") {
|
|
202
|
-
event.preventDefault();
|
|
203
|
-
next = addDays(focused, 7);
|
|
204
|
-
} else if (event.key === "Home") {
|
|
205
|
-
event.preventDefault();
|
|
206
|
-
const dayOfWeek = (focused.getDay() - (__props.weekStartsOn ?? 0) + 7) % 7;
|
|
207
|
-
next = addDays(focused, -dayOfWeek);
|
|
208
|
-
} else if (event.key === "End") {
|
|
209
|
-
event.preventDefault();
|
|
210
|
-
const dayOfWeek = (focused.getDay() - (__props.weekStartsOn ?? 0) + 7) % 7;
|
|
211
|
-
next = addDays(focused, 6 - dayOfWeek);
|
|
212
|
-
} else if (event.key === "PageUp") {
|
|
213
|
-
event.preventDefault();
|
|
214
|
-
next = event.shiftKey ? addMonths(focused, -12) : addMonths(focused, -1);
|
|
215
|
-
} else if (event.key === "PageDown") {
|
|
216
|
-
event.preventDefault();
|
|
217
|
-
next = event.shiftKey ? addMonths(focused, 12) : addMonths(focused, 1);
|
|
218
|
-
} else if (event.key === "Enter" || event.key === " ") {
|
|
219
|
-
event.preventDefault();
|
|
220
|
-
selectDate(focused);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (next) {
|
|
224
|
-
if (showDropdowns.value) {
|
|
225
|
-
const minYear = yearRange.value[0] ?? now.getFullYear();
|
|
226
|
-
const maxYear = yearRange.value[yearRange.value.length - 1] ?? now.getFullYear();
|
|
227
|
-
const minMo = __props.minDate && next.getFullYear() === __props.minDate.getFullYear() ? __props.minDate.getMonth() : 0;
|
|
228
|
-
const maxMo = __props.maxDate && next.getFullYear() === __props.maxDate.getFullYear() ? __props.maxDate.getMonth() : 11;
|
|
229
|
-
if (next.getFullYear() < minYear || next.getFullYear() > maxYear || next.getFullYear() === minYear && next.getMonth() < minMo || next.getFullYear() === maxYear && next.getMonth() > maxMo) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
const needsMonthChange = next.getMonth() !== displayMonth.value.getMonth() || next.getFullYear() !== displayMonth.value.getFullYear();
|
|
234
|
-
if (needsMonthChange) {
|
|
235
|
-
displayMonth.value = new Date(next.getFullYear(), next.getMonth(), 1);
|
|
236
|
-
__props.onMonthChange?.(displayMonth.value);
|
|
237
|
-
}
|
|
238
|
-
const dateKey = formatDate(next);
|
|
239
|
-
const focusBtn = () => {
|
|
240
|
-
const btn = gridEl.querySelector(`button[data-date="${dateKey}"]`);
|
|
241
|
-
btn?.focus();
|
|
242
|
-
};
|
|
243
|
-
if (needsMonthChange) {
|
|
244
|
-
queueMicrotask(focusBtn);
|
|
245
|
-
} else {
|
|
246
|
-
focusBtn();
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}, handleMonthSelect = function(event) {
|
|
250
|
-
const target = event.target;
|
|
251
|
-
const newMonth = Number(target.value);
|
|
252
|
-
if (isMonthDisabled(newMonth, displayMonth.value.getFullYear(), __props.minDate, __props.maxDate))
|
|
253
|
-
return;
|
|
254
|
-
displayMonth.value = new Date(displayMonth.value.getFullYear(), newMonth, 1);
|
|
255
|
-
__props.onMonthChange?.(displayMonth.value);
|
|
256
|
-
}, handleYearSelect = function(event) {
|
|
257
|
-
const target = event.target;
|
|
258
|
-
const newYear = Number(target.value);
|
|
259
|
-
let month = displayMonth.value.getMonth();
|
|
260
|
-
if (isMonthDisabled(month, newYear, __props.minDate, __props.maxDate)) {
|
|
261
|
-
if (__props.minDate && newYear === __props.minDate.getFullYear())
|
|
262
|
-
month = __props.minDate.getMonth();
|
|
263
|
-
else if (__props.maxDate && newYear === __props.maxDate.getFullYear())
|
|
264
|
-
month = __props.maxDate.getMonth();
|
|
265
|
-
}
|
|
266
|
-
displayMonth.value = new Date(newYear, month, 1);
|
|
267
|
-
__props.onMonthChange?.(displayMonth.value);
|
|
268
|
-
};
|
|
269
|
-
const now = new Date;
|
|
270
|
-
const mode = computed(() => __props.mode ?? "single");
|
|
271
|
-
const displayMonth = signal(__props.defaultMonth ?? now, "displayMonth");
|
|
272
|
-
const value = signal(__props.defaultValue ?? null, "value");
|
|
273
|
-
const dayHeaders = computed(() => Array.from({ length: 7 }, (_, i) => DAY_NAMES[((__props.weekStartsOn ?? 0) + i) % 7] ?? ""));
|
|
274
|
-
const titleText = computed(() => `${MONTH_NAMES[displayMonth.value.getMonth()]} ${displayMonth.value.getFullYear()}`);
|
|
275
|
-
const showDropdowns = computed(() => (__props.captionLayout ?? "buttons") === "dropdown" || (__props.captionLayout ?? "buttons") === "dropdown-buttons");
|
|
276
|
-
const showButtons = computed(() => (__props.captionLayout ?? "buttons") === "buttons" || (__props.captionLayout ?? "buttons") === "dropdown-buttons");
|
|
277
|
-
const yearRange = computed(() => showDropdowns.value ? computeYearRange(now, __props.minDate, __props.maxDate) : []);
|
|
278
|
-
const effectiveMinYear = computed(() => showDropdowns.value ? yearRange.value[0] ?? now.getFullYear() : 0);
|
|
279
|
-
const effectiveMaxYear = computed(() => showDropdowns.value ? yearRange.value[yearRange.value.length - 1] ?? now.getFullYear() : 9999);
|
|
280
|
-
const effectiveMinMonth = computed(() => __props.minDate && effectiveMinYear.value === __props.minDate.getFullYear() ? __props.minDate.getMonth() : 0);
|
|
281
|
-
const effectiveMaxMonth = computed(() => __props.maxDate && effectiveMaxYear.value === __props.maxDate.getFullYear() ? __props.maxDate.getMonth() : 11);
|
|
282
|
-
const isAtMinBoundary = computed(() => showDropdowns.value && displayMonth.value.getFullYear() === effectiveMinYear.value && displayMonth.value.getMonth() === effectiveMinMonth.value);
|
|
283
|
-
const isAtMaxBoundary = computed(() => showDropdowns.value && displayMonth.value.getFullYear() === effectiveMaxYear.value && displayMonth.value.getMonth() === effectiveMaxMonth.value);
|
|
284
|
-
const rows = computed(() => computeGridRows(displayMonth.value, __props.weekStartsOn ?? 0));
|
|
285
|
-
const prevChevron = (() => {
|
|
286
|
-
const __el0 = __element("svg");
|
|
287
|
-
__el0.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
288
|
-
__el0.setAttribute("width", "16");
|
|
289
|
-
__el0.setAttribute("height", "16");
|
|
290
|
-
__el0.setAttribute("viewBox", "0 0 24 24");
|
|
291
|
-
__el0.setAttribute("fill", "none");
|
|
292
|
-
__el0.setAttribute("stroke", "currentColor");
|
|
293
|
-
__el0.setAttribute("stroke-width", "2");
|
|
294
|
-
__el0.setAttribute("stroke-linecap", "round");
|
|
295
|
-
__el0.setAttribute("stroke-linejoin", "round");
|
|
296
|
-
__el0.setAttribute("aria-hidden", "true");
|
|
297
|
-
__enterChildren(__el0);
|
|
298
|
-
__append(__el0, (() => {
|
|
299
|
-
const __el1 = __element("path");
|
|
300
|
-
__el1.setAttribute("d", "m15 18-6-6 6-6");
|
|
301
|
-
return __el1;
|
|
302
|
-
})());
|
|
303
|
-
__exitChildren();
|
|
304
|
-
return __el0;
|
|
305
|
-
})();
|
|
306
|
-
const nextChevron = (() => {
|
|
307
|
-
const __el2 = __element("svg");
|
|
308
|
-
__el2.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
309
|
-
__el2.setAttribute("width", "16");
|
|
310
|
-
__el2.setAttribute("height", "16");
|
|
311
|
-
__el2.setAttribute("viewBox", "0 0 24 24");
|
|
312
|
-
__el2.setAttribute("fill", "none");
|
|
313
|
-
__el2.setAttribute("stroke", "currentColor");
|
|
314
|
-
__el2.setAttribute("stroke-width", "2");
|
|
315
|
-
__el2.setAttribute("stroke-linecap", "round");
|
|
316
|
-
__el2.setAttribute("stroke-linejoin", "round");
|
|
317
|
-
__el2.setAttribute("aria-hidden", "true");
|
|
318
|
-
__enterChildren(__el2);
|
|
319
|
-
__append(__el2, (() => {
|
|
320
|
-
const __el3 = __element("path");
|
|
321
|
-
__el3.setAttribute("d", "m9 18 6-6-6-6");
|
|
322
|
-
return __el3;
|
|
323
|
-
})());
|
|
324
|
-
__exitChildren();
|
|
325
|
-
return __el2;
|
|
326
|
-
})();
|
|
327
|
-
const __mfResult0 = (() => {
|
|
328
|
-
const __el4 = __element("div");
|
|
329
|
-
__el4.setAttribute("data-v-id", "ComposedCalendarRoot");
|
|
330
|
-
__attr(__el4, "class", () => cn(__props.classes?.root));
|
|
331
|
-
__enterChildren(__el4);
|
|
332
|
-
__append(__el4, (() => {
|
|
333
|
-
const __el5 = __element("div");
|
|
334
|
-
__attr(__el5, "class", () => cn(__props.classes?.header));
|
|
335
|
-
__attr(__el5, "data-caption-layout", () => __props.captionLayout ?? "buttons");
|
|
336
|
-
__enterChildren(__el5);
|
|
337
|
-
__append(__el5, __conditional(() => showButtons.value, () => (() => {
|
|
338
|
-
const __el6 = __element("button");
|
|
339
|
-
__el6.setAttribute("type", "button");
|
|
340
|
-
__attr(__el6, "class", () => cn(__props.classes?.navButton));
|
|
341
|
-
__el6.setAttribute("aria-label", "Previous month");
|
|
342
|
-
__attr(__el6, "aria-disabled", () => isAtMinBoundary.value ? "true" : undefined);
|
|
343
|
-
__on(__el6, "click", () => {
|
|
344
|
-
if (!isAtMinBoundary.value)
|
|
345
|
-
navigateMonth(-1);
|
|
346
|
-
});
|
|
347
|
-
__enterChildren(__el6);
|
|
348
|
-
__insert(__el6, prevChevron);
|
|
349
|
-
__exitChildren();
|
|
350
|
-
return __el6;
|
|
351
|
-
})(), () => null));
|
|
352
|
-
__append(__el5, __conditional(() => showDropdowns.value, () => (() => {
|
|
353
|
-
const __el7 = document.createDocumentFragment();
|
|
354
|
-
__append(__el7, (() => {
|
|
355
|
-
const __el8 = __element("select");
|
|
356
|
-
__el8.setAttribute("aria-label", "Select month");
|
|
357
|
-
__attr(__el8, "class", () => cn(__props.classes?.monthSelect));
|
|
358
|
-
__on(__el8, "change", handleMonthSelect);
|
|
359
|
-
__enterChildren(__el8);
|
|
360
|
-
__list(__el8, () => MONTH_OPTIONS, null, (mo) => (() => {
|
|
361
|
-
const __el9 = __element("option");
|
|
362
|
-
{
|
|
363
|
-
const __v = String(mo.index);
|
|
364
|
-
if (__v != null && __v !== false)
|
|
365
|
-
__el9.setAttribute("value", __v === true ? "" : __v);
|
|
366
|
-
}
|
|
367
|
-
__attr(__el9, "disabled", () => isMonthDisabled(mo.index, displayMonth.value.getFullYear(), __props.minDate, __props.maxDate));
|
|
368
|
-
__enterChildren(__el9);
|
|
369
|
-
__insert(__el9, mo.name);
|
|
370
|
-
__exitChildren();
|
|
371
|
-
return __el9;
|
|
372
|
-
})());
|
|
373
|
-
__exitChildren();
|
|
374
|
-
__prop(__el8, "value", () => String(displayMonth.value.getMonth()));
|
|
375
|
-
return __el8;
|
|
376
|
-
})());
|
|
377
|
-
__append(__el7, (() => {
|
|
378
|
-
const __el10 = __element("select");
|
|
379
|
-
__el10.setAttribute("aria-label", "Select year");
|
|
380
|
-
__attr(__el10, "class", () => cn(__props.classes?.yearSelect));
|
|
381
|
-
__on(__el10, "change", handleYearSelect);
|
|
382
|
-
__enterChildren(__el10);
|
|
383
|
-
__list(__el10, () => yearRange.value, null, (yr) => (() => {
|
|
384
|
-
const __el11 = __element("option");
|
|
385
|
-
{
|
|
386
|
-
const __v = String(yr);
|
|
387
|
-
if (__v != null && __v !== false)
|
|
388
|
-
__el11.setAttribute("value", __v === true ? "" : __v);
|
|
389
|
-
}
|
|
390
|
-
__enterChildren(__el11);
|
|
391
|
-
__insert(__el11, yr);
|
|
392
|
-
__exitChildren();
|
|
393
|
-
return __el11;
|
|
394
|
-
})());
|
|
395
|
-
__exitChildren();
|
|
396
|
-
__prop(__el10, "value", () => String(displayMonth.value.getFullYear()));
|
|
397
|
-
return __el10;
|
|
398
|
-
})());
|
|
399
|
-
return __el7;
|
|
400
|
-
})(), () => (() => {
|
|
401
|
-
const __el12 = __element("div");
|
|
402
|
-
__attr(__el12, "class", () => cn(__props.classes?.title));
|
|
403
|
-
__enterChildren(__el12);
|
|
404
|
-
__append(__el12, __child(() => titleText.value));
|
|
405
|
-
__exitChildren();
|
|
406
|
-
return __el12;
|
|
407
|
-
})()));
|
|
408
|
-
__append(__el5, __conditional(() => showButtons.value, () => (() => {
|
|
409
|
-
const __el13 = __element("button");
|
|
410
|
-
__el13.setAttribute("type", "button");
|
|
411
|
-
__attr(__el13, "class", () => cn(__props.classes?.navButton));
|
|
412
|
-
__el13.setAttribute("aria-label", "Next month");
|
|
413
|
-
__attr(__el13, "aria-disabled", () => isAtMaxBoundary.value ? "true" : undefined);
|
|
414
|
-
__on(__el13, "click", () => {
|
|
415
|
-
if (!isAtMaxBoundary.value)
|
|
416
|
-
navigateMonth(1);
|
|
417
|
-
});
|
|
418
|
-
__enterChildren(__el13);
|
|
419
|
-
__insert(__el13, nextChevron);
|
|
420
|
-
__exitChildren();
|
|
421
|
-
return __el13;
|
|
422
|
-
})(), () => null));
|
|
423
|
-
__exitChildren();
|
|
424
|
-
return __el5;
|
|
425
|
-
})());
|
|
426
|
-
__append(__el4, (() => {
|
|
427
|
-
const __el14 = __element("table");
|
|
428
|
-
__el14.setAttribute("role", "grid");
|
|
429
|
-
__attr(__el14, "class", () => cn(__props.classes?.grid));
|
|
430
|
-
__on(__el14, "keydown", handleGridKeydown);
|
|
431
|
-
__enterChildren(__el14);
|
|
432
|
-
__append(__el14, (() => {
|
|
433
|
-
const __el15 = __element("thead");
|
|
434
|
-
__enterChildren(__el15);
|
|
435
|
-
__append(__el15, (() => {
|
|
436
|
-
const __el16 = __element("tr");
|
|
437
|
-
__enterChildren(__el16);
|
|
438
|
-
__list(__el16, () => dayHeaders.value, null, (day) => (() => {
|
|
439
|
-
const __el17 = __element("th");
|
|
440
|
-
__el17.setAttribute("scope", "col");
|
|
441
|
-
__attr(__el17, "class", () => cn(__props.classes?.headCell));
|
|
442
|
-
__enterChildren(__el17);
|
|
443
|
-
__insert(__el17, day);
|
|
444
|
-
__exitChildren();
|
|
445
|
-
return __el17;
|
|
446
|
-
})());
|
|
447
|
-
__exitChildren();
|
|
448
|
-
return __el16;
|
|
449
|
-
})());
|
|
450
|
-
__exitChildren();
|
|
451
|
-
return __el15;
|
|
452
|
-
})());
|
|
453
|
-
__append(__el14, (() => {
|
|
454
|
-
const __el18 = __element("tbody");
|
|
455
|
-
__enterChildren(__el18);
|
|
456
|
-
__list(__el18, () => rows.value, null, (rowDates) => (() => {
|
|
457
|
-
const __el19 = __element("tr");
|
|
458
|
-
__enterChildren(__el19);
|
|
459
|
-
__list(__el19, () => rowDates, null, (cellDate) => (() => {
|
|
460
|
-
const __el20 = __element("td");
|
|
461
|
-
__el20.setAttribute("role", "gridcell");
|
|
462
|
-
__attr(__el20, "class", () => cn(__props.classes?.cell));
|
|
463
|
-
__enterChildren(__el20);
|
|
464
|
-
__append(__el20, DayCell({ get cellDate() {
|
|
465
|
-
return cellDate;
|
|
466
|
-
}, get displayMonth() {
|
|
467
|
-
return displayMonth.value;
|
|
468
|
-
}, get now() {
|
|
469
|
-
return now;
|
|
470
|
-
}, get mode() {
|
|
471
|
-
return mode.value;
|
|
472
|
-
}, get value() {
|
|
473
|
-
return value.value;
|
|
474
|
-
}, get minDate() {
|
|
475
|
-
return __props.minDate;
|
|
476
|
-
}, get maxDate() {
|
|
477
|
-
return __props.maxDate;
|
|
478
|
-
}, get disabled() {
|
|
479
|
-
return __props.disabled;
|
|
480
|
-
}, get classes() {
|
|
481
|
-
return __props.classes;
|
|
482
|
-
}, get onSelect() {
|
|
483
|
-
return selectDate;
|
|
484
|
-
} }));
|
|
485
|
-
__exitChildren();
|
|
486
|
-
return __el20;
|
|
487
|
-
})());
|
|
488
|
-
__exitChildren();
|
|
489
|
-
return __el19;
|
|
490
|
-
})());
|
|
491
|
-
__exitChildren();
|
|
492
|
-
return __el18;
|
|
493
|
-
})());
|
|
494
|
-
__exitChildren();
|
|
495
|
-
return __el14;
|
|
496
|
-
})());
|
|
497
|
-
__exitChildren();
|
|
498
|
-
return __el4;
|
|
499
|
-
})();
|
|
500
|
-
__flushMountFrame();
|
|
501
|
-
return __mfResult0;
|
|
502
|
-
} catch (__mfErr) {
|
|
503
|
-
__discardMountFrame(__mfDepth);
|
|
504
|
-
throw __mfErr;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
var ComposedCalendar = ComposedCalendarRoot;
|
|
508
|
-
|
|
509
|
-
export { ComposedCalendar };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-q7xbcj9q.js";
|
|
4
|
-
|
|
5
|
-
// src/input/input-composed.tsx
|
|
6
|
-
import { __attr, __discardMountFrame, __element, __flushMountFrame, __pushMountFrame, __spread } from "@vertz/ui/internals";
|
|
7
|
-
function ComposedInputRoot(__props) {
|
|
8
|
-
const { classes: __$drop_0, className: __$drop_1, class: __$drop_2, ...props } = __props;
|
|
9
|
-
const __mfDepth = __pushMountFrame();
|
|
10
|
-
try {
|
|
11
|
-
const __mfResult0 = (() => {
|
|
12
|
-
const __el0 = __element("input");
|
|
13
|
-
__attr(__el0, "class", () => cn(__props.classes?.base, __props.className ?? __props.class));
|
|
14
|
-
__spread(__el0, props);
|
|
15
|
-
return __el0;
|
|
16
|
-
})();
|
|
17
|
-
__flushMountFrame();
|
|
18
|
-
return __mfResult0;
|
|
19
|
-
} catch (__mfErr) {
|
|
20
|
-
__discardMountFrame(__mfDepth);
|
|
21
|
-
throw __mfErr;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
var ComposedInput = ComposedInputRoot;
|
|
25
|
-
|
|
26
|
-
export { ComposedInput };
|