@serendie/ui 3.5.1-dev.202606091509 → 3.5.1
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/components/BottomNavigation/BottomNavigation.d.ts +1 -1
- package/dist/components/DataTable/DataTableComponent.d.ts +1 -1
- package/dist/components/DataTable/table/BodyCheckbox.d.ts +1 -1
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicatorIndeterminate.d.ts +1 -1
- package/dist/components/Tabs/TabItem.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/i18n/provider.d.ts +1 -1
- package/dist/node_modules/@zag-js/accordion/dist/accordion.connect.js +50 -49
- package/dist/node_modules/@zag-js/combobox/dist/combobox.connect.js +68 -70
- package/dist/node_modules/@zag-js/combobox/dist/combobox.machine.js +1 -1
- package/dist/node_modules/@zag-js/date-picker/dist/date-picker.connect.js +308 -322
- package/dist/node_modules/@zag-js/date-picker/dist/date-picker.machine.js +79 -93
- package/dist/node_modules/@zag-js/date-picker/dist/date-picker.utils.js +43 -35
- package/dist/node_modules/@zag-js/dialog/dist/dialog.dom.js +35 -36
- package/dist/node_modules/@zag-js/dialog/dist/dialog.machine.js +37 -27
- package/dist/node_modules/@zag-js/dismissable/dist/dismissable-layer.js +41 -56
- package/dist/node_modules/@zag-js/dismissable/dist/layer-stack.js +31 -51
- package/dist/node_modules/@zag-js/dismissable/dist/pointer-event-outside.js +25 -46
- package/dist/node_modules/@zag-js/dom-query/dist/controller.js +5 -5
- package/dist/node_modules/@zag-js/dom-query/dist/overflow.js +21 -13
- package/dist/node_modules/@zag-js/live-region/dist/index.js +19 -29
- package/dist/node_modules/@zag-js/menu/dist/menu.connect.js +135 -138
- package/dist/node_modules/@zag-js/menu/dist/menu.dom.js +24 -24
- package/dist/node_modules/@zag-js/menu/dist/menu.machine.js +1 -1
- package/dist/node_modules/@zag-js/popper/dist/get-placement.js +71 -82
- package/dist/node_modules/@zag-js/react/dist/machine.js +96 -105
- package/dist/node_modules/@zag-js/remove-scroll/dist/index.js +26 -34
- package/dist/node_modules/@zag-js/select/dist/select.connect.js +101 -104
- package/dist/node_modules/@zag-js/select/dist/select.machine.js +1 -1
- package/dist/node_modules/@zag-js/tabs/dist/tabs.machine.js +60 -63
- package/dist/node_modules/@zag-js/tooltip/dist/tooltip.connect.js +25 -27
- package/dist/node_modules/@zag-js/tooltip/dist/tooltip.dom.js +14 -15
- package/dist/theme/initColorScheme.d.ts +1 -1
- package/package.json +8 -8
- package/dist/node_modules/@zag-js/date-utils/dist/locale.js +0 -12
- package/dist/node_modules/@zag-js/dom-query/dist/scroll.js +0 -11
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { toCalendar as
|
|
1
|
+
import { toCalendar as B, toZoned as p, toCalendarDateTime as y } from "../../../@internationalized/date/dist/conversion.js";
|
|
2
2
|
import { DateFormatter as Z } from "../../../@internationalized/date/dist/DateFormatter.js";
|
|
3
|
-
import { createLiveRegion as
|
|
4
|
-
import { getPlacement as
|
|
5
|
-
import { getInputEls as m, getYearSelectEl as
|
|
6
|
-
import { isValidDate as
|
|
3
|
+
import { createLiveRegion as H } from "../../live-region/dist/index.js";
|
|
4
|
+
import { getPlacement as U } from "../../popper/dist/get-placement.js";
|
|
5
|
+
import { getInputEls as m, getYearSelectEl as W, getMonthSelectEl as G, getTriggerEl as D, getFocusedCell as F, getContentEl as A, getClearTriggerEl as _, getControlEl as $, getPositionerEl as j } from "./date-picker.dom.js";
|
|
6
|
+
import { isValidDate as M, adjustStartAndEndDate as N, sortDates as x, getPreviousView as K, getNextView as q, isAboveMinView as z, getVisibleRangeText as X, clampView as J, eachView as Q, isBelowMinView as ee } from "./date-picker.utils.js";
|
|
7
7
|
import { createMachine as te, createGuards as ne } from "../../core/dist/create-machine.js";
|
|
8
8
|
import { isDateOutsideRange as se, isDateEqual as f, isNextRangeInvalid as oe, isPreviousRangeInvalid as ae } from "../../date-utils/dist/assertion.js";
|
|
9
|
-
import { alignDate as
|
|
10
|
-
import { constrainValue as
|
|
9
|
+
import { alignDate as k } from "../../date-utils/dist/align.js";
|
|
10
|
+
import { constrainValue as E } from "../../date-utils/dist/constrain.js";
|
|
11
11
|
import { setElementValue as O } from "../../dom-query/dist/form.js";
|
|
12
12
|
import { raf as V } from "../../dom-query/dist/raf.js";
|
|
13
|
-
import { getDecadeRange as
|
|
14
|
-
import { getTodayDate as
|
|
13
|
+
import { getDecadeRange as L } from "../../date-utils/dist/date-year.js";
|
|
14
|
+
import { getTodayDate as b } from "../../date-utils/dist/mutation.js";
|
|
15
15
|
import { getPreviousSection as ie, getNextSection as ce, getPreviousPage as ue, getNextPage as le, getAdjustedDateFn as re } from "../../date-utils/dist/pagination.js";
|
|
16
16
|
import { restoreTextSelection as de, disableTextSelection as ge } from "../../dom-query/dist/text-selection.js";
|
|
17
17
|
import { formatSelectedDate as h } from "../../date-utils/dist/format.js";
|
|
18
18
|
import { trackDismissableElement as fe } from "../../dismissable/dist/dismissable-layer.js";
|
|
19
19
|
import { getEndDate as ve } from "../../date-utils/dist/duration.js";
|
|
20
20
|
import { parseDateString as Ve } from "../../date-utils/dist/parse-date.js";
|
|
21
|
-
var { and:
|
|
21
|
+
var { and: r } = ne();
|
|
22
22
|
function me(e, t) {
|
|
23
23
|
if ((e == null ? void 0 : e.length) !== (t == null ? void 0 : t.length)) return !1;
|
|
24
24
|
const n = Math.max(e.length, t.length);
|
|
@@ -37,37 +37,37 @@ var Be = te({
|
|
|
37
37
|
const v = new Intl.DateTimeFormat(t).resolvedOptions().calendar;
|
|
38
38
|
v !== "gregory" && v !== "iso8601" && (a = e.createCalendar(v));
|
|
39
39
|
}
|
|
40
|
-
const i = (d) => !a || d.calendar.identifier === a.identifier ? d :
|
|
41
|
-
let g = e.focusedValue || e.defaultFocusedValue || (
|
|
42
|
-
g =
|
|
43
|
-
const
|
|
40
|
+
const i = (d) => !a || d.calendar.identifier === a.identifier ? d : B(d, a), u = e.defaultValue ? x(e.defaultValue).map((d) => E(i(d), e.min, e.max)) : void 0, l = e.value ? x(e.value).map((d) => E(i(d), e.min, e.max)) : void 0;
|
|
41
|
+
let g = e.focusedValue || e.defaultFocusedValue || (l == null ? void 0 : l[0]) || (u == null ? void 0 : u[0]) || b(n, a);
|
|
42
|
+
g = E(i(g), e.min, e.max);
|
|
43
|
+
const w = "day", R = "year", Y = J(e.view || w, w, R);
|
|
44
44
|
return {
|
|
45
45
|
locale: t,
|
|
46
46
|
numOfMonths: o,
|
|
47
47
|
timeZone: n,
|
|
48
48
|
selectionMode: s,
|
|
49
|
-
defaultView:
|
|
50
|
-
minView:
|
|
49
|
+
defaultView: Y,
|
|
50
|
+
minView: w,
|
|
51
51
|
maxView: R,
|
|
52
52
|
outsideDaySelectable: !1,
|
|
53
53
|
closeOnSelect: !0,
|
|
54
|
-
format(d, { locale: v, timeZone:
|
|
54
|
+
format(d, { locale: v, timeZone: S }) {
|
|
55
55
|
return new Z(v, {
|
|
56
|
-
timeZone:
|
|
56
|
+
timeZone: S,
|
|
57
57
|
day: "2-digit",
|
|
58
58
|
month: "2-digit",
|
|
59
59
|
year: "numeric",
|
|
60
60
|
calendar: a == null ? void 0 : a.identifier
|
|
61
|
-
}).format(d.toDate(
|
|
61
|
+
}).format(d.toDate(S));
|
|
62
62
|
},
|
|
63
|
-
parse(d, { locale: v, timeZone:
|
|
64
|
-
return Ve(d, v,
|
|
63
|
+
parse(d, { locale: v, timeZone: S }) {
|
|
64
|
+
return Ve(d, v, S);
|
|
65
65
|
},
|
|
66
66
|
...e,
|
|
67
67
|
focusedValue: typeof e.focusedValue > "u" ? void 0 : g,
|
|
68
68
|
defaultFocusedValue: g,
|
|
69
|
-
value:
|
|
70
|
-
defaultValue:
|
|
69
|
+
value: l,
|
|
70
|
+
defaultValue: u ?? [],
|
|
71
71
|
positioning: {
|
|
72
72
|
placement: "bottom",
|
|
73
73
|
...e.positioning
|
|
@@ -91,9 +91,9 @@ var Be = te({
|
|
|
91
91
|
hash: (s) => s.toString(),
|
|
92
92
|
sync: !0,
|
|
93
93
|
onChange(s) {
|
|
94
|
-
var
|
|
95
|
-
const o = n(), a = o.get("view"), i = o.get("value"),
|
|
96
|
-
(
|
|
94
|
+
var l;
|
|
95
|
+
const o = n(), a = o.get("view"), i = o.get("value"), u = C(i, e);
|
|
96
|
+
(l = e("onFocusChange")) == null || l({ value: i, valueAsString: u, view: a, focusedValue: s });
|
|
97
97
|
}
|
|
98
98
|
})),
|
|
99
99
|
value: t(() => ({
|
|
@@ -129,7 +129,7 @@ var Be = te({
|
|
|
129
129
|
startValue: t(() => {
|
|
130
130
|
const s = e("focusedValue") || e("defaultFocusedValue");
|
|
131
131
|
return {
|
|
132
|
-
defaultValue:
|
|
132
|
+
defaultValue: k(s, "start", { months: e("numOfMonths") }, e("locale")),
|
|
133
133
|
isEqual: f,
|
|
134
134
|
hash: (o) => o.toString()
|
|
135
135
|
};
|
|
@@ -190,13 +190,7 @@ var Be = te({
|
|
|
190
190
|
actions: ["setFocusedDate"]
|
|
191
191
|
},
|
|
192
192
|
"VALUE.CLEAR": {
|
|
193
|
-
actions: [
|
|
194
|
-
"clearDateValue",
|
|
195
|
-
"clearFocusedDate",
|
|
196
|
-
"setActiveIndexToStart",
|
|
197
|
-
"clearHoveredDate",
|
|
198
|
-
"focusFirstInputElement"
|
|
199
|
-
]
|
|
193
|
+
actions: ["clearDateValue", "clearFocusedDate", "focusFirstInputElement"]
|
|
200
194
|
},
|
|
201
195
|
"INPUT.CHANGE": [
|
|
202
196
|
{
|
|
@@ -325,7 +319,7 @@ var Be = te({
|
|
|
325
319
|
on: {
|
|
326
320
|
"CONTROLLED.CLOSE": [
|
|
327
321
|
{
|
|
328
|
-
guard:
|
|
322
|
+
guard: r("shouldRestoreFocus", "isInteractOutsideEvent"),
|
|
329
323
|
target: "focused",
|
|
330
324
|
actions: ["focusTriggerElement"]
|
|
331
325
|
},
|
|
@@ -344,12 +338,12 @@ var Be = te({
|
|
|
344
338
|
actions: ["setFocusedValueForView", "setPreviousView"]
|
|
345
339
|
},
|
|
346
340
|
{
|
|
347
|
-
guard:
|
|
341
|
+
guard: r("isRangePicker", "hasSelectedRange"),
|
|
348
342
|
actions: ["setActiveIndexToStart", "resetSelection", "setActiveIndexToEnd"]
|
|
349
343
|
},
|
|
350
344
|
// === Grouped transitions (based on `closeOnSelect` and `isOpenControlled`) ===
|
|
351
345
|
{
|
|
352
|
-
guard:
|
|
346
|
+
guard: r("isRangePicker", "isSelectingEndDate", "closeOnSelect", "isOpenControlled"),
|
|
353
347
|
actions: [
|
|
354
348
|
"setFocusedDate",
|
|
355
349
|
"setSelectedDate",
|
|
@@ -360,7 +354,7 @@ var Be = te({
|
|
|
360
354
|
]
|
|
361
355
|
},
|
|
362
356
|
{
|
|
363
|
-
guard:
|
|
357
|
+
guard: r("isRangePicker", "isSelectingEndDate", "closeOnSelect"),
|
|
364
358
|
target: "focused",
|
|
365
359
|
actions: [
|
|
366
360
|
"setFocusedDate",
|
|
@@ -372,7 +366,7 @@ var Be = te({
|
|
|
372
366
|
]
|
|
373
367
|
},
|
|
374
368
|
{
|
|
375
|
-
guard:
|
|
369
|
+
guard: r("isRangePicker", "isSelectingEndDate"),
|
|
376
370
|
actions: ["setFocusedDate", "setSelectedDate", "setActiveIndexToStart", "clearHoveredDate"]
|
|
377
371
|
},
|
|
378
372
|
// ===
|
|
@@ -381,7 +375,7 @@ var Be = te({
|
|
|
381
375
|
actions: ["setFocusedDate", "setSelectedDate", "setActiveIndexToEnd"]
|
|
382
376
|
},
|
|
383
377
|
{
|
|
384
|
-
guard:
|
|
378
|
+
guard: r("isMultiPicker", "canSelectDate"),
|
|
385
379
|
actions: ["setFocusedDate", "toggleSelectedDate"]
|
|
386
380
|
},
|
|
387
381
|
{
|
|
@@ -390,7 +384,7 @@ var Be = te({
|
|
|
390
384
|
},
|
|
391
385
|
// === Grouped transitions (based on `closeOnSelect` and `isOpenControlled`) ===
|
|
392
386
|
{
|
|
393
|
-
guard:
|
|
387
|
+
guard: r("closeOnSelect", "isOpenControlled"),
|
|
394
388
|
actions: ["setFocusedDate", "setSelectedDate", "invokeOnClose"]
|
|
395
389
|
},
|
|
396
390
|
{
|
|
@@ -403,16 +397,10 @@ var Be = te({
|
|
|
403
397
|
}
|
|
404
398
|
// ===
|
|
405
399
|
],
|
|
406
|
-
"CELL.POINTER_MOVE":
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
guard: u("isRangePicker", "isSelectingEndDate"),
|
|
413
|
-
actions: ["setHoveredDate", "setFocusedDate"]
|
|
414
|
-
}
|
|
415
|
-
],
|
|
400
|
+
"CELL.POINTER_MOVE": {
|
|
401
|
+
guard: r("isRangePicker", "isSelectingEndDate"),
|
|
402
|
+
actions: ["setHoveredDate", "setFocusedDate"]
|
|
403
|
+
},
|
|
416
404
|
"TABLE.POINTER_LEAVE": {
|
|
417
405
|
guard: "isRangePicker",
|
|
418
406
|
actions: ["clearHoveredDate"]
|
|
@@ -439,16 +427,16 @@ var Be = te({
|
|
|
439
427
|
actions: ["setPreviousView"]
|
|
440
428
|
},
|
|
441
429
|
{
|
|
442
|
-
guard:
|
|
430
|
+
guard: r("isRangePicker", "hasSelectedRange"),
|
|
443
431
|
actions: ["setActiveIndexToStart", "clearDateValue", "setSelectedDate", "setActiveIndexToEnd"]
|
|
444
432
|
},
|
|
445
433
|
// === Grouped transitions (based on `closeOnSelect` and `isOpenControlled`) ===
|
|
446
434
|
{
|
|
447
|
-
guard:
|
|
435
|
+
guard: r("isRangePicker", "isSelectingEndDate", "closeOnSelect", "isOpenControlled"),
|
|
448
436
|
actions: ["setSelectedDate", "setActiveIndexToStart", "clearHoveredDate", "invokeOnClose"]
|
|
449
437
|
},
|
|
450
438
|
{
|
|
451
|
-
guard:
|
|
439
|
+
guard: r("isRangePicker", "isSelectingEndDate", "closeOnSelect"),
|
|
452
440
|
target: "focused",
|
|
453
441
|
actions: [
|
|
454
442
|
"setSelectedDate",
|
|
@@ -459,7 +447,7 @@ var Be = te({
|
|
|
459
447
|
]
|
|
460
448
|
},
|
|
461
449
|
{
|
|
462
|
-
guard:
|
|
450
|
+
guard: r("isRangePicker", "isSelectingEndDate"),
|
|
463
451
|
actions: ["setSelectedDate", "setActiveIndexToStart", "clearHoveredDate"]
|
|
464
452
|
},
|
|
465
453
|
// ===
|
|
@@ -468,7 +456,7 @@ var Be = te({
|
|
|
468
456
|
actions: ["setSelectedDate", "setActiveIndexToEnd", "focusNextDay"]
|
|
469
457
|
},
|
|
470
458
|
{
|
|
471
|
-
guard:
|
|
459
|
+
guard: r("isMultiPicker", "canSelectDate"),
|
|
472
460
|
actions: ["toggleSelectedDate"]
|
|
473
461
|
},
|
|
474
462
|
{
|
|
@@ -476,7 +464,7 @@ var Be = te({
|
|
|
476
464
|
},
|
|
477
465
|
// === Grouped transitions (based on `closeOnSelect` and `isOpenControlled`) ===
|
|
478
466
|
{
|
|
479
|
-
guard:
|
|
467
|
+
guard: r("closeOnSelect", "isOpenControlled"),
|
|
480
468
|
actions: ["selectFocusedDate", "invokeOnClose"]
|
|
481
469
|
},
|
|
482
470
|
{
|
|
@@ -627,7 +615,7 @@ var Be = te({
|
|
|
627
615
|
const s = t("maxSelectedDates");
|
|
628
616
|
if (s == null) return !0;
|
|
629
617
|
const o = e.get("value"), a = n.value ?? e.get("focusedValue");
|
|
630
|
-
return o.some((
|
|
618
|
+
return o.some((u) => f(u, a)) ? !0 : o.length < s;
|
|
631
619
|
},
|
|
632
620
|
shouldRestoreFocus: ({ context: e }) => !!e.get("restoreFocus"),
|
|
633
621
|
isSelectingEndDate: ({ context: e }) => e.get("activeIndex") === 1,
|
|
@@ -638,15 +626,14 @@ var Be = te({
|
|
|
638
626
|
return ((t = e.previousEvent) == null ? void 0 : t.type) === "INTERACT_OUTSIDE";
|
|
639
627
|
},
|
|
640
628
|
isInputValueEmpty: ({ event: e }) => e.value.trim() === "",
|
|
641
|
-
shouldFixOnBlur: ({ event: e }) => !!e.fixOnBlur
|
|
642
|
-
isDayPointerMoveOutsideVisibleMonth: ({ event: e }) => e.cell === "day" && e.outsideRange === !0
|
|
629
|
+
shouldFixOnBlur: ({ event: e }) => !!e.fixOnBlur
|
|
643
630
|
},
|
|
644
631
|
effects: {
|
|
645
632
|
trackPositioning({ context: e, prop: t, scope: n }) {
|
|
646
633
|
if (t("inline")) return;
|
|
647
634
|
e.get("currentPlacement") || e.set("currentPlacement", t("positioning").placement);
|
|
648
|
-
const s =
|
|
649
|
-
return
|
|
635
|
+
const s = $(n);
|
|
636
|
+
return U(s, () => j(n), {
|
|
650
637
|
...t("positioning"),
|
|
651
638
|
defer: !0,
|
|
652
639
|
onComplete(a) {
|
|
@@ -656,17 +643,16 @@ var Be = te({
|
|
|
656
643
|
},
|
|
657
644
|
setupLiveRegion({ scope: e, refs: t }) {
|
|
658
645
|
const n = e.getDoc();
|
|
659
|
-
return t.set("announcer",
|
|
646
|
+
return t.set("announcer", H({ level: "assertive", document: n })), () => {
|
|
660
647
|
var s, o;
|
|
661
648
|
return (o = (s = t.get("announcer")) == null ? void 0 : s.destroy) == null ? void 0 : o.call(s);
|
|
662
649
|
};
|
|
663
650
|
},
|
|
664
651
|
trackDismissableElement({ scope: e, send: t, context: n, prop: s }) {
|
|
665
|
-
return s("inline") ? void 0 : fe(() =>
|
|
652
|
+
return s("inline") ? void 0 : fe(() => A(e), {
|
|
666
653
|
type: "popover",
|
|
667
654
|
defer: !0,
|
|
668
|
-
|
|
669
|
-
exclude: [...m(e), S(e), $(e)],
|
|
655
|
+
exclude: [...m(e), D(e), _(e)],
|
|
670
656
|
onInteractOutside(a) {
|
|
671
657
|
n.set("restoreFocus", !a.detail.focusable);
|
|
672
658
|
},
|
|
@@ -695,15 +681,15 @@ var Be = te({
|
|
|
695
681
|
e.set("restoreFocus", !0);
|
|
696
682
|
},
|
|
697
683
|
announceValueText({ context: e, prop: t, refs: n }) {
|
|
698
|
-
var
|
|
684
|
+
var u;
|
|
699
685
|
const s = e.get("value"), o = t("locale"), a = t("timeZone");
|
|
700
686
|
let i;
|
|
701
687
|
if (t("selectionMode") === "range") {
|
|
702
|
-
const [
|
|
703
|
-
|
|
688
|
+
const [l, g] = s;
|
|
689
|
+
l && g ? i = h(l, g, o, a) : l ? i = h(l, null, o, a) : g ? i = h(g, null, o, a) : i = "";
|
|
704
690
|
} else
|
|
705
|
-
i = s.map((
|
|
706
|
-
(
|
|
691
|
+
i = s.map((l) => h(l, null, o, a)).filter(Boolean).join(",");
|
|
692
|
+
(u = n.get("announcer")) == null || u.announce(i, 3e3);
|
|
707
693
|
},
|
|
708
694
|
announceVisibleRange({ computed: e, refs: t }) {
|
|
709
695
|
var s;
|
|
@@ -711,10 +697,10 @@ var Be = te({
|
|
|
711
697
|
(s = t.get("announcer")) == null || s.announce(n);
|
|
712
698
|
},
|
|
713
699
|
disableTextSelection({ scope: e }) {
|
|
714
|
-
ge({ target:
|
|
700
|
+
ge({ target: A(e), doc: e.getDoc() });
|
|
715
701
|
},
|
|
716
702
|
enableTextSelection({ scope: e }) {
|
|
717
|
-
de({ doc: e.getDoc(), target:
|
|
703
|
+
de({ doc: e.getDoc(), target: A(e) });
|
|
718
704
|
},
|
|
719
705
|
focusFirstSelectedDate(e) {
|
|
720
706
|
const { context: t } = e;
|
|
@@ -745,7 +731,7 @@ var Be = te({
|
|
|
745
731
|
},
|
|
746
732
|
setDateValue({ context: e, event: t, prop: n }) {
|
|
747
733
|
if (!Array.isArray(t.value)) return;
|
|
748
|
-
const s = t.value.map((o) =>
|
|
734
|
+
const s = t.value.map((o) => E(o, n("min"), n("max")));
|
|
749
735
|
e.set("value", s);
|
|
750
736
|
},
|
|
751
737
|
clearDateValue({ context: e }) {
|
|
@@ -753,11 +739,11 @@ var Be = te({
|
|
|
753
739
|
},
|
|
754
740
|
setSelectedDate(e) {
|
|
755
741
|
const { context: t, event: n } = e, s = Array.from(t.get("value")), o = t.get("activeIndex"), a = s[o], i = I(e, n.value ?? t.get("focusedValue"));
|
|
756
|
-
s[o] =
|
|
742
|
+
s[o] = P(a, i), t.set("value", N(s));
|
|
757
743
|
},
|
|
758
744
|
resetSelection(e) {
|
|
759
745
|
const { context: t, event: n } = e, s = t.get("value")[0], o = I(e, n.value ?? t.get("focusedValue"));
|
|
760
|
-
t.set("value", [
|
|
746
|
+
t.set("value", [P(s, o)]);
|
|
761
747
|
},
|
|
762
748
|
toggleSelectedDate(e) {
|
|
763
749
|
const { context: t, event: n } = e, s = I(e, n.value ?? t.get("focusedValue")), o = t.get("value"), a = o.findIndex((i) => f(i, s));
|
|
@@ -777,7 +763,7 @@ var Be = te({
|
|
|
777
763
|
},
|
|
778
764
|
selectFocusedDate({ context: e, computed: t }) {
|
|
779
765
|
const n = Array.from(e.get("value")), s = e.get("activeIndex"), o = n[s], a = e.get("focusedValue").copy();
|
|
780
|
-
n[s] =
|
|
766
|
+
n[s] = P(o, a), e.set("value", N(n));
|
|
781
767
|
const i = t("valueAsString");
|
|
782
768
|
e.set("inputValue", i[s]);
|
|
783
769
|
},
|
|
@@ -869,7 +855,7 @@ var Be = te({
|
|
|
869
855
|
},
|
|
870
856
|
clearFocusedDate(e) {
|
|
871
857
|
const { context: t, prop: n } = e, s = t.get("focusedValue").calendar;
|
|
872
|
-
c(e,
|
|
858
|
+
c(e, b(n("timeZone"), s));
|
|
873
859
|
},
|
|
874
860
|
focusPreviousMonthColumn(e) {
|
|
875
861
|
const { context: t, event: n } = e, s = t.get("focusedValue").subtract({ months: n.columns });
|
|
@@ -897,11 +883,11 @@ var Be = te({
|
|
|
897
883
|
c(e, n.set({ month: s }));
|
|
898
884
|
},
|
|
899
885
|
focusFirstYear(e) {
|
|
900
|
-
const { context: t } = e, n =
|
|
886
|
+
const { context: t } = e, n = L(t.get("focusedValue").year), s = t.get("focusedValue").set({ year: n[0] });
|
|
901
887
|
c(e, s);
|
|
902
888
|
},
|
|
903
889
|
focusLastYear(e) {
|
|
904
|
-
const { context: t } = e, n =
|
|
890
|
+
const { context: t } = e, n = L(t.get("focusedValue").year), s = t.get("focusedValue").set({ year: n[n.length - 1] });
|
|
905
891
|
c(e, s);
|
|
906
892
|
},
|
|
907
893
|
setActiveIndex({ context: e, event: t }) {
|
|
@@ -933,12 +919,12 @@ var Be = te({
|
|
|
933
919
|
focusTriggerElement({ scope: e }) {
|
|
934
920
|
V(() => {
|
|
935
921
|
var t;
|
|
936
|
-
(t =
|
|
922
|
+
(t = D(e)) == null || t.focus({ preventScroll: !0 });
|
|
937
923
|
});
|
|
938
924
|
},
|
|
939
925
|
focusFirstInputElement({ scope: e, event: t }) {
|
|
940
926
|
t.focus !== !1 && V(() => {
|
|
941
|
-
const [n] = m(e), s = n ??
|
|
927
|
+
const [n] = m(e), s = n ?? D(e);
|
|
942
928
|
s == null || s.focus({ preventScroll: !0 });
|
|
943
929
|
});
|
|
944
930
|
},
|
|
@@ -947,7 +933,7 @@ var Be = te({
|
|
|
947
933
|
var a;
|
|
948
934
|
const t = m(e);
|
|
949
935
|
if (t.length === 0) {
|
|
950
|
-
(a =
|
|
936
|
+
(a = D(e)) == null || a.focus({ preventScroll: !0 });
|
|
951
937
|
return;
|
|
952
938
|
}
|
|
953
939
|
const n = t.findLastIndex((i) => i.value !== ""), s = Math.max(n, 0), o = t[s];
|
|
@@ -955,11 +941,11 @@ var Be = te({
|
|
|
955
941
|
});
|
|
956
942
|
},
|
|
957
943
|
syncMonthSelectElement({ scope: e, context: t }) {
|
|
958
|
-
const n =
|
|
944
|
+
const n = G(e);
|
|
959
945
|
O(n, t.get("startValue").month.toString());
|
|
960
946
|
},
|
|
961
947
|
syncYearSelectElement({ scope: e, context: t }) {
|
|
962
|
-
const n =
|
|
948
|
+
const n = W(e);
|
|
963
949
|
O(n, t.get("startValue").year.toString());
|
|
964
950
|
},
|
|
965
951
|
setInputValue({ context: e, event: t }) {
|
|
@@ -975,13 +961,13 @@ var Be = te({
|
|
|
975
961
|
const { event: t, prop: n } = e;
|
|
976
962
|
if (t.index == null) return;
|
|
977
963
|
const o = n("parse")(t.value, { locale: n("locale"), timeZone: n("timeZone") });
|
|
978
|
-
!o || !
|
|
964
|
+
!o || !M(o) || c(e, o);
|
|
979
965
|
},
|
|
980
966
|
selectParsedDate({ context: e, event: t, prop: n }) {
|
|
981
967
|
if (t.index == null) return;
|
|
982
968
|
let o = n("parse")(t.value, { locale: n("locale"), timeZone: n("timeZone") });
|
|
983
|
-
if ((!o || !
|
|
984
|
-
o =
|
|
969
|
+
if ((!o || !M(o)) && t.value && (o = e.get("focusedValue").copy()), !o) return;
|
|
970
|
+
o = E(o, n("min"), n("max"));
|
|
985
971
|
const a = Array.from(e.get("value"));
|
|
986
972
|
a[t.index] = o, e.set("value", a);
|
|
987
973
|
const i = C(a, n);
|
|
@@ -993,7 +979,7 @@ var Be = te({
|
|
|
993
979
|
setStartValue({ context: e, computed: t, prop: n }) {
|
|
994
980
|
const s = e.get("focusedValue");
|
|
995
981
|
if (!se(s, e.get("startValue"), t("endValue"))) return;
|
|
996
|
-
const a =
|
|
982
|
+
const a = k(s, "start", { months: n("numOfMonths") }, n("locale"));
|
|
997
983
|
e.set("startValue", a);
|
|
998
984
|
},
|
|
999
985
|
invokeOnOpen({ prop: e, context: t }) {
|
|
@@ -1022,12 +1008,12 @@ var Be = te({
|
|
|
1022
1008
|
return Q((i) => {
|
|
1023
1009
|
ee(i, s("minView")) && (a = a.set({ [i]: i === "day" ? 1 : 0 }));
|
|
1024
1010
|
}), a;
|
|
1025
|
-
},
|
|
1011
|
+
}, P = (e, t) => {
|
|
1026
1012
|
if (!e || !("hour" in e))
|
|
1027
1013
|
return t;
|
|
1028
1014
|
const n = "timeZone" in e;
|
|
1029
1015
|
let s = t;
|
|
1030
|
-
return "hour" in t || (n ? s =
|
|
1016
|
+
return "hour" in t || (n ? s = p(y(t), e.timeZone) : s = y(t)), s.set({
|
|
1031
1017
|
hour: e.hour,
|
|
1032
1018
|
minute: e.minute,
|
|
1033
1019
|
second: e.second,
|
|
@@ -1039,11 +1025,11 @@ function c(e, t) {
|
|
|
1039
1025
|
if (!t) return;
|
|
1040
1026
|
const a = I(e, t);
|
|
1041
1027
|
if (f(n.get("focusedValue"), a)) return;
|
|
1042
|
-
const
|
|
1028
|
+
const u = re(o("visibleDuration"), s("locale"), s("min"), s("max"))({
|
|
1043
1029
|
focusedDate: a,
|
|
1044
1030
|
startDate: n.get("startValue")
|
|
1045
1031
|
});
|
|
1046
|
-
n.set("startValue",
|
|
1032
|
+
n.set("startValue", u.startDate), n.set("focusedValue", u.focusedDate);
|
|
1047
1033
|
}
|
|
1048
1034
|
function T(e, t) {
|
|
1049
1035
|
const { context: n } = e;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DateFormatter as
|
|
2
|
-
import { memo as
|
|
1
|
+
import { DateFormatter as s } from "../../../@internationalized/date/dist/DateFormatter.js";
|
|
2
|
+
import { memo as S } from "../../core/dist/memo.js";
|
|
3
3
|
import { match as d } from "../../utils/dist/functions.js";
|
|
4
4
|
import { clampValue as D } from "../../utils/dist/number.js";
|
|
5
|
-
import { getDecadeRange as
|
|
5
|
+
import { getDecadeRange as V } from "../../date-utils/dist/date-year.js";
|
|
6
6
|
function k(e) {
|
|
7
7
|
const [t, r] = e;
|
|
8
8
|
let n;
|
|
@@ -12,25 +12,30 @@ function E(e, t) {
|
|
|
12
12
|
const [r, n] = t;
|
|
13
13
|
return !r || !n ? !1 : r.compare(e) <= 0 && n.compare(e) >= 0;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function F(e) {
|
|
16
16
|
return e.slice().filter((t) => t != null).sort((t, r) => t.compare(r));
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function I(e) {
|
|
19
19
|
return d(e, {
|
|
20
20
|
year: "calendar decade",
|
|
21
21
|
month: "calendar year",
|
|
22
22
|
day: "calendar month"
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
var
|
|
25
|
+
var T = {
|
|
26
26
|
day: "dd",
|
|
27
27
|
month: "mm",
|
|
28
28
|
year: "yyyy"
|
|
29
29
|
};
|
|
30
|
-
function
|
|
31
|
-
return new
|
|
30
|
+
function j(e) {
|
|
31
|
+
return new s(e).formatToParts(/* @__PURE__ */ new Date()).map((t) => T[t.type] ?? t.value).join("");
|
|
32
|
+
}
|
|
33
|
+
var $ = (e, t) => e ? /\d/.test(e) || e === t || e.length !== 1 : !0, A = (e) => !Number.isNaN(e.day) && !Number.isNaN(e.month) && !Number.isNaN(e.year), L = (e, t) => e.split("").filter((r) => $(r, t)).join("");
|
|
34
|
+
function M(e) {
|
|
35
|
+
const n = new Intl.DateTimeFormat(e).formatToParts(/* @__PURE__ */ new Date()).find((l) => l.type === "literal");
|
|
36
|
+
return n ? n.value : "/";
|
|
32
37
|
}
|
|
33
|
-
var
|
|
38
|
+
var W = {
|
|
34
39
|
dayCell(e) {
|
|
35
40
|
return e.unavailable ? `Not available. ${e.valueText}` : e.firstInRange ? `Starting range from ${e.valueText}` : e.lastInRange ? `Range ending at ${e.valueText}` : e.selected ? `Selected date. ${e.valueText}` : `Choose ${e.valueText}`;
|
|
36
41
|
},
|
|
@@ -78,49 +83,49 @@ var M = (e) => !Number.isNaN(e.day) && !Number.isNaN(e.month) && !Number.isNaN(e
|
|
|
78
83
|
function a(e, t) {
|
|
79
84
|
return e ? e === "day" ? 0 : e === "month" ? 1 : 2 : t || 0;
|
|
80
85
|
}
|
|
81
|
-
function
|
|
86
|
+
function f(e) {
|
|
82
87
|
return e === 0 ? "day" : e === 1 ? "month" : "year";
|
|
83
88
|
}
|
|
84
89
|
function w(e, t, r) {
|
|
85
|
-
return
|
|
90
|
+
return f(
|
|
86
91
|
D(a(e, 0), a(t, 0), a(r, 2))
|
|
87
92
|
);
|
|
88
93
|
}
|
|
89
|
-
function
|
|
94
|
+
function H(e, t) {
|
|
90
95
|
return a(e, 0) > a(t, 0);
|
|
91
96
|
}
|
|
92
|
-
function
|
|
97
|
+
function O(e, t) {
|
|
93
98
|
return a(e, 0) < a(t, 0);
|
|
94
99
|
}
|
|
95
|
-
function
|
|
100
|
+
function B(e, t, r) {
|
|
96
101
|
const n = a(e, 0) + 1;
|
|
97
|
-
return w(
|
|
102
|
+
return w(f(n), t, r);
|
|
98
103
|
}
|
|
99
|
-
function
|
|
104
|
+
function Z(e, t, r) {
|
|
100
105
|
const n = a(e, 0) - 1;
|
|
101
|
-
return w(
|
|
106
|
+
return w(f(n), t, r);
|
|
102
107
|
}
|
|
103
108
|
var N = ["day", "month", "year"];
|
|
104
|
-
function
|
|
109
|
+
function q(e) {
|
|
105
110
|
N.forEach((t) => e(t));
|
|
106
111
|
}
|
|
107
|
-
var
|
|
112
|
+
var z = S(
|
|
108
113
|
(e) => [e.view, e.startValue.toString(), e.endValue.toString(), e.locale],
|
|
109
114
|
([e], t) => {
|
|
110
|
-
const { startValue: r, endValue: n, locale:
|
|
115
|
+
const { startValue: r, endValue: n, locale: l, timeZone: o, selectionMode: y } = t;
|
|
111
116
|
if (e === "year") {
|
|
112
|
-
const c =
|
|
117
|
+
const c = V(r.year, { strict: !0 }), i = c.at(0).toString(), u = c.at(-1).toString();
|
|
113
118
|
return { start: i, end: u, formatted: `${i} - ${u}` };
|
|
114
119
|
}
|
|
115
120
|
if (e === "month") {
|
|
116
|
-
const c = new l
|
|
121
|
+
const c = new s(l, {
|
|
117
122
|
year: "numeric",
|
|
118
123
|
timeZone: o,
|
|
119
124
|
calendar: r.calendar.identifier
|
|
120
|
-
}), i = c.format(r.toDate(o)), u = c.format(n.toDate(o)),
|
|
121
|
-
return { start: i, end: u, formatted:
|
|
125
|
+
}), i = c.format(r.toDate(o)), u = c.format(n.toDate(o)), v = y === "range" ? `${i} - ${u}` : i;
|
|
126
|
+
return { start: i, end: u, formatted: v };
|
|
122
127
|
}
|
|
123
|
-
const g = new l
|
|
128
|
+
const g = new s(l, {
|
|
124
129
|
month: "long",
|
|
125
130
|
year: "numeric",
|
|
126
131
|
timeZone: o,
|
|
@@ -133,15 +138,18 @@ export {
|
|
|
133
138
|
k as adjustStartAndEndDate,
|
|
134
139
|
w as clampView,
|
|
135
140
|
W as defaultTranslations,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
q as eachView,
|
|
142
|
+
L as ensureValidCharacters,
|
|
143
|
+
j as getInputPlaceholder,
|
|
144
|
+
M as getLocaleSeparator,
|
|
145
|
+
B as getNextView,
|
|
146
|
+
Z as getPreviousView,
|
|
147
|
+
I as getRoleDescription,
|
|
148
|
+
z as getVisibleRangeText,
|
|
149
|
+
H as isAboveMinView,
|
|
150
|
+
O as isBelowMinView,
|
|
144
151
|
E as isDateWithinRange,
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
$ as isValidCharacter,
|
|
153
|
+
A as isValidDate,
|
|
154
|
+
F as sortDates
|
|
147
155
|
};
|