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