asheeui 0.6.12 → 0.6.13
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/autocomplete/Autocomplete.js +3 -3
- package/dist/components/date-picker/Calendar.d.ts +6 -1
- package/dist/components/date-picker/Calendar.d.ts.map +1 -1
- package/dist/components/date-picker/Calendar.js +30 -30
- package/dist/components/date-picker/DatePicker.d.ts +1 -1
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +167 -156
- package/dist/components/date-picker/date-picker-config.d.ts +12 -1
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +3 -3
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +107 -105
- package/dist/components/select-menu/SelectMenu.d.ts +6 -9
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +116 -107
- package/dist/components/select-menu/select-menu-config.d.ts +8 -4
- package/dist/components/select-menu/select-menu-config.d.ts.map +1 -1
- package/dist/components/select-menu/select-menu-config.js +1 -1
- package/dist/components/select-menu/use-select-floating.d.ts +46 -20
- package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
- package/dist/components/select-menu/use-select-floating.js +35 -28
- package/dist/theme/controller.d.ts.map +1 -1
- package/dist/theme/controller.js +14 -16
- package/package.json +1 -1
|
@@ -58,7 +58,7 @@ const me = se(
|
|
|
58
58
|
re(() => {
|
|
59
59
|
i ? u(i.label) : s != null && u(String(s));
|
|
60
60
|
}, [i, s]);
|
|
61
|
-
const { refs: x,
|
|
61
|
+
const { refs: x, context: d, isPositioned: q, floatingStyles: H } = fe({
|
|
62
62
|
isOpen: S,
|
|
63
63
|
onOpenChange: m,
|
|
64
64
|
disabled: O
|
|
@@ -112,11 +112,11 @@ const me = se(
|
|
|
112
112
|
ce,
|
|
113
113
|
{
|
|
114
114
|
isOpen: S,
|
|
115
|
+
floatingStyles: H,
|
|
115
116
|
context: d,
|
|
116
|
-
floatingStyles: q,
|
|
117
117
|
getFloatingProps: Y,
|
|
118
118
|
setFloatingRef: x.setFloating,
|
|
119
|
-
isPositioned:
|
|
119
|
+
isPositioned: q,
|
|
120
120
|
options: Z,
|
|
121
121
|
selectedValues: h,
|
|
122
122
|
onSelectMenuOption: k,
|
|
@@ -51,7 +51,12 @@ interface CalendarProps {
|
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Calendar popover component with month navigation and date selection.
|
|
54
|
+
*
|
|
55
|
+
* Memoized so parent-driven renders (the DatePicker popover's one-time
|
|
56
|
+
* `isPositioned` flip, input typing, open/close) do not rebuild the month
|
|
57
|
+
* grid. Every prop is a primitive or a stable callback, so React.memo can
|
|
58
|
+
* skip those renders.
|
|
54
59
|
*/
|
|
55
|
-
export declare
|
|
60
|
+
export declare const Calendar: import('react').NamedExoticComponent<CalendarProps>;
|
|
56
61
|
export {};
|
|
57
62
|
//# sourceMappingURL=Calendar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/Calendar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASvD,UAAU,aAAa;IACrB;;;OAGG;IACH,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC;;;OAGG;IACH,IAAI,EAAE,UAAU,CAAC;IACjB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,eAAe,EAAE,YAAY,CAAC;IAC9B;;;OAGG;IACH,aAAa,EAAE,KAAK,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/Calendar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASvD,UAAU,aAAa;IACrB;;;OAGG;IACH,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC;;;OAGG;IACH,IAAI,EAAE,UAAU,CAAC;IACjB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,eAAe,EAAE,YAAY,CAAC;IAC9B;;;OAGG;IACH,aAAa,EAAE,KAAK,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,qDA0QnB,CAAC"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
3
|
-
import { useState as f, useMemo as
|
|
4
|
-
import { ChevronLeftIcon as
|
|
5
|
-
import { ChevronRightIcon as
|
|
6
|
-
import { buildDayCells as
|
|
7
|
-
import { CALENDAR_COLOR_CLASSES as L, DATE_PICKER_CELL_SIZE_CLASS as
|
|
3
|
+
import { memo as q, useState as f, useMemo as B } from "react";
|
|
4
|
+
import { ChevronLeftIcon as J } from "../../icons/ChevronLeftIcon.js";
|
|
5
|
+
import { ChevronRightIcon as Q } from "../../icons/ChevronRightIcon.js";
|
|
6
|
+
import { buildDayCells as U, MONTHS as X, DAYS_OF_WEEK as tt } from "./date-picker.helpers.js";
|
|
7
|
+
import { CALENDAR_COLOR_CLASSES as L, DATE_PICKER_CELL_SIZE_CLASS as nt } from "./date-picker-styles.js";
|
|
8
8
|
import { TimeSpinner as y } from "./TimeSpinner.js";
|
|
9
9
|
import { cn as u } from "../../utils/cn.js";
|
|
10
|
-
|
|
10
|
+
const mt = q(function({
|
|
11
11
|
selected: n,
|
|
12
12
|
mode: s,
|
|
13
13
|
isClearable: C,
|
|
14
14
|
resolvedSizeKey: j,
|
|
15
15
|
resolvedColor: h,
|
|
16
|
-
radiusClass:
|
|
16
|
+
radiusClass: i,
|
|
17
17
|
onSelect: v,
|
|
18
18
|
onClose: w,
|
|
19
19
|
disableFuture: Y = !1
|
|
20
20
|
}) {
|
|
21
21
|
const r = /* @__PURE__ */ new Date(), [l, k] = f(
|
|
22
22
|
(n == null ? void 0 : n.getFullYear()) ?? r.getFullYear()
|
|
23
|
-
), [
|
|
23
|
+
), [a, g] = f(
|
|
24
24
|
(n == null ? void 0 : n.getMonth()) ?? r.getMonth()
|
|
25
25
|
), [b, A] = f((n == null ? void 0 : n.getHours()) ?? 0), [p, H] = f((n == null ? void 0 : n.getMinutes()) ?? 0), [x, T] = f((n == null ? void 0 : n.getSeconds()) ?? 0), m = L[h] ?? L.primary;
|
|
26
26
|
function M(t, e, Z) {
|
|
@@ -39,19 +39,19 @@ function ut({
|
|
|
39
39
|
T(t), M(b, p, t);
|
|
40
40
|
}
|
|
41
41
|
function K(t) {
|
|
42
|
-
v(new Date(l,
|
|
42
|
+
v(new Date(l, a, t, b, p, x, 0)), s === "date" && w();
|
|
43
43
|
}
|
|
44
44
|
function P() {
|
|
45
|
-
|
|
45
|
+
a === 0 ? (g(11), k((t) => t - 1)) : g((t) => t - 1);
|
|
46
46
|
}
|
|
47
47
|
function V() {
|
|
48
|
-
|
|
48
|
+
a === 11 ? (g(0), k((t) => t + 1)) : g((t) => t + 1);
|
|
49
49
|
}
|
|
50
50
|
function d(t) {
|
|
51
|
-
return !!n && n.getFullYear() === l && n.getMonth() ===
|
|
51
|
+
return !!n && n.getFullYear() === l && n.getMonth() === a && n.getDate() === t;
|
|
52
52
|
}
|
|
53
53
|
function N(t) {
|
|
54
|
-
return r.getFullYear() === l && r.getMonth() ===
|
|
54
|
+
return r.getFullYear() === l && r.getMonth() === a && r.getDate() === t;
|
|
55
55
|
}
|
|
56
56
|
const $ = new Date(
|
|
57
57
|
r.getFullYear(),
|
|
@@ -59,9 +59,9 @@ function ut({
|
|
|
59
59
|
r.getDate()
|
|
60
60
|
);
|
|
61
61
|
function D(t) {
|
|
62
|
-
return Y ? new Date(l,
|
|
62
|
+
return Y ? new Date(l, a, t) > $ : !1;
|
|
63
63
|
}
|
|
64
|
-
const F = !Y || l < r.getFullYear() || l === r.getFullYear() &&
|
|
64
|
+
const F = !Y || l < r.getFullYear() || l === r.getFullYear() && a < r.getMonth(), E = s === "date" || s === "datetime", z = s === "time" || s === "datetime", G = s !== "date" || C && !!n, _ = U(l, a), W = B(() => _.map((t, e) => ({
|
|
65
65
|
key: t !== null ? `day-${t}` : `empty-slot-${e}`,
|
|
66
66
|
day: t
|
|
67
67
|
})), [_]);
|
|
@@ -70,7 +70,7 @@ function ut({
|
|
|
70
70
|
{
|
|
71
71
|
className: u(
|
|
72
72
|
"bg-background border border-border/70 shadow-xl select-none p-4 w-max",
|
|
73
|
-
|
|
73
|
+
i
|
|
74
74
|
),
|
|
75
75
|
children: [
|
|
76
76
|
/* @__PURE__ */ c("div", { className: "flex flex-row", children: [
|
|
@@ -85,13 +85,13 @@ function ut({
|
|
|
85
85
|
className: u(
|
|
86
86
|
"p-1.5 text-foreground/70 transition-all active:scale-95",
|
|
87
87
|
"hover:text-foreground hover:bg-secondary",
|
|
88
|
-
|
|
88
|
+
i
|
|
89
89
|
),
|
|
90
|
-
children: /* @__PURE__ */ o(
|
|
90
|
+
children: /* @__PURE__ */ o(J, {})
|
|
91
91
|
}
|
|
92
92
|
),
|
|
93
93
|
/* @__PURE__ */ c("span", { className: "font-semibold text-sm text-foreground tracking-wide", children: [
|
|
94
|
-
|
|
94
|
+
X[a],
|
|
95
95
|
" ",
|
|
96
96
|
l
|
|
97
97
|
] }),
|
|
@@ -105,14 +105,14 @@ function ut({
|
|
|
105
105
|
className: u(
|
|
106
106
|
"p-1.5 text-foreground/70 transition-all",
|
|
107
107
|
F ? "hover:text-foreground hover:bg-secondary active:scale-95" : "opacity-30 cursor-not-allowed",
|
|
108
|
-
|
|
108
|
+
i
|
|
109
109
|
),
|
|
110
|
-
children: /* @__PURE__ */ o(
|
|
110
|
+
children: /* @__PURE__ */ o(Q, {})
|
|
111
111
|
}
|
|
112
112
|
)
|
|
113
113
|
] }),
|
|
114
114
|
/* @__PURE__ */ c("div", { className: "grid grid-cols-7 gap-1 text-center", children: [
|
|
115
|
-
|
|
115
|
+
tt.map((t) => /* @__PURE__ */ o(
|
|
116
116
|
"div",
|
|
117
117
|
{
|
|
118
118
|
className: "text-[11px] font-bold tracking-wider text-foreground/50 uppercase py-1 mb-1",
|
|
@@ -129,8 +129,8 @@ function ut({
|
|
|
129
129
|
disabled: D(e),
|
|
130
130
|
className: u(
|
|
131
131
|
"w-full flex items-center justify-center font-medium transition-all duration-200",
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
nt[j],
|
|
133
|
+
i,
|
|
134
134
|
D(e) ? "opacity-30 cursor-not-allowed text-foreground/50" : "active:scale-90",
|
|
135
135
|
!D(e) && !d(e) && !N(e) && m.hover,
|
|
136
136
|
d(e) && u(m.bg, "font-semibold shadow-sm"),
|
|
@@ -160,7 +160,7 @@ function ut({
|
|
|
160
160
|
label: "HH",
|
|
161
161
|
onChange: I,
|
|
162
162
|
resolvedColor: h,
|
|
163
|
-
radiusClass:
|
|
163
|
+
radiusClass: i
|
|
164
164
|
}
|
|
165
165
|
),
|
|
166
166
|
/* @__PURE__ */ o(
|
|
@@ -171,7 +171,7 @@ function ut({
|
|
|
171
171
|
label: "MM",
|
|
172
172
|
onChange: O,
|
|
173
173
|
resolvedColor: h,
|
|
174
|
-
radiusClass:
|
|
174
|
+
radiusClass: i
|
|
175
175
|
}
|
|
176
176
|
),
|
|
177
177
|
/* @__PURE__ */ o(
|
|
@@ -182,7 +182,7 @@ function ut({
|
|
|
182
182
|
label: "SS",
|
|
183
183
|
onChange: R,
|
|
184
184
|
resolvedColor: h,
|
|
185
|
-
radiusClass:
|
|
185
|
+
radiusClass: i
|
|
186
186
|
}
|
|
187
187
|
)
|
|
188
188
|
]
|
|
@@ -208,7 +208,7 @@ function ut({
|
|
|
208
208
|
onClick: w,
|
|
209
209
|
className: u(
|
|
210
210
|
"ml-auto text-xs font-semibold px-4 py-2 transition-all hover:opacity-90 active:scale-95 shadow-sm",
|
|
211
|
-
|
|
211
|
+
i,
|
|
212
212
|
m.bg
|
|
213
213
|
),
|
|
214
214
|
children: "Done"
|
|
@@ -218,7 +218,7 @@ function ut({
|
|
|
218
218
|
]
|
|
219
219
|
}
|
|
220
220
|
);
|
|
221
|
-
}
|
|
221
|
+
});
|
|
222
222
|
export {
|
|
223
|
-
|
|
223
|
+
mt as Calendar
|
|
224
224
|
};
|
|
@@ -78,7 +78,7 @@ export interface DatePickerProps extends BaseDatePickerProps {
|
|
|
78
78
|
* @param props.radius - Corner rounding. Defaults to "md".
|
|
79
79
|
* @param props.color - Theme accent color. Defaults to "primary".
|
|
80
80
|
* @param props.disabled - Whether the input is disabled. Defaults to false.
|
|
81
|
-
* @param props.picker - Picker configuration overrides including className, portal, and
|
|
81
|
+
* @param props.picker - Picker configuration overrides including className, portal, portalTarget, and lockScroll.
|
|
82
82
|
* @param props.label - Field label text.
|
|
83
83
|
* @param props.description - Description text.
|
|
84
84
|
* @param props.message - Validation message.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DatePicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/DatePicker.tsx"],"names":[],"mappings":"AA8BA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AASxD,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GAChE,IAAI,CACF,UAAU,EACV,UAAU,GAAG,OAAO,GAAG,cAAc,GAAG,YAAY,GAAG,cAAc,CACtE,CAAC;AAEJ;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D;;;OAGG;IACH,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IAEvC;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,eAAO,MAAM,UAAU,8GA8VtB,CAAC"}
|
|
@@ -1,210 +1,221 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import {
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { CalendarIcon as
|
|
6
|
-
import { ClearIcon as
|
|
7
|
-
import { ClockIcon as
|
|
8
|
-
import { useAsheeConfig as
|
|
9
|
-
import { resolveCascade as
|
|
10
|
-
import { Input as
|
|
11
|
-
import { Calendar as
|
|
12
|
-
import { formatDisplay as
|
|
13
|
-
import { FALLBACK_DATE_PICKER_CONFIG as
|
|
14
|
-
import { RADIUS_CLASS as
|
|
15
|
-
import { useSelectFloating as
|
|
16
|
-
import { cn as
|
|
17
|
-
import { FALLBACK_SELECT_MENU_CONFIG as
|
|
18
|
-
const
|
|
2
|
+
import { jsx as r, jsxs as B, Fragment as fo } from "react/jsx-runtime";
|
|
3
|
+
import { FloatingFocusManager as yo, FloatingPortal as po } from "@floating-ui/react";
|
|
4
|
+
import { forwardRef as vo, useId as bo, useState as G, useRef as So, useEffect as U, useCallback as f } from "react";
|
|
5
|
+
import { CalendarIcon as wo } from "../../icons/CalendarIcon.js";
|
|
6
|
+
import { ClearIcon as Io } from "../../icons/ClearIcon.js";
|
|
7
|
+
import { ClockIcon as Po } from "../../icons/ClockIcon.js";
|
|
8
|
+
import { useAsheeConfig as Ro } from "../../libs/context.js";
|
|
9
|
+
import { resolveCascade as c, resolveRadiusKey as Fo, resolveClassKey as xo } from "../../utils/resolve-token.js";
|
|
10
|
+
import { Input as go } from "../input/Input.js";
|
|
11
|
+
import { Calendar as No } from "./Calendar.js";
|
|
12
|
+
import { formatDisplay as b, parseDateString as ho, getNewCursorPosition as Ao, getDefaultPlaceholder as Do } from "./date-picker.helpers.js";
|
|
13
|
+
import { FALLBACK_DATE_PICKER_CONFIG as y } from "./date-picker-config.js";
|
|
14
|
+
import { RADIUS_CLASS as Lo } from "../../shared/radius.js";
|
|
15
|
+
import { useSelectFloating as To } from "../select-menu/use-select-floating.js";
|
|
16
|
+
import { cn as Ko } from "../../utils/cn.js";
|
|
17
|
+
import { FALLBACK_SELECT_MENU_CONFIG as _o } from "../select-menu/select-menu-config.js";
|
|
18
|
+
const Eo = vo(
|
|
19
19
|
({
|
|
20
|
-
selected:
|
|
21
|
-
onChange:
|
|
22
|
-
mode:
|
|
23
|
-
isClearable:
|
|
24
|
-
disableFuture:
|
|
25
|
-
placeholder:
|
|
26
|
-
size:
|
|
27
|
-
radius:
|
|
28
|
-
color:
|
|
29
|
-
disabled:
|
|
30
|
-
picker:
|
|
31
|
-
...
|
|
32
|
-
},
|
|
33
|
-
var
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
selected: n,
|
|
21
|
+
onChange: e,
|
|
22
|
+
mode: W,
|
|
23
|
+
isClearable: N = !1,
|
|
24
|
+
disableFuture: Y = !1,
|
|
25
|
+
placeholder: q,
|
|
26
|
+
size: h,
|
|
27
|
+
radius: S,
|
|
28
|
+
color: A,
|
|
29
|
+
disabled: w,
|
|
30
|
+
picker: l,
|
|
31
|
+
...D
|
|
32
|
+
}, u) => {
|
|
33
|
+
var E, O, z, M;
|
|
34
|
+
const I = Ro(), o = (E = I.components) == null ? void 0 : E.datePicker, $ = bo(), H = D.id ?? $, [i, p] = G(!1), [P, a] = G(""), L = So(null), s = c(
|
|
35
|
+
W,
|
|
36
|
+
o == null ? void 0 : o.mode,
|
|
37
37
|
void 0,
|
|
38
|
-
|
|
39
|
-
),
|
|
40
|
-
|
|
41
|
-
(
|
|
38
|
+
y.mode
|
|
39
|
+
), J = c(
|
|
40
|
+
l == null ? void 0 : l.portal,
|
|
41
|
+
(O = o == null ? void 0 : o.picker) == null ? void 0 : O.portal,
|
|
42
42
|
void 0,
|
|
43
|
-
|
|
44
|
-
),
|
|
45
|
-
|
|
46
|
-
(z =
|
|
43
|
+
_o.portal
|
|
44
|
+
), Q = c(
|
|
45
|
+
l == null ? void 0 : l.portalTarget,
|
|
46
|
+
(z = o == null ? void 0 : o.picker) == null ? void 0 : z.portalTarget,
|
|
47
47
|
void 0,
|
|
48
48
|
null
|
|
49
|
-
),
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
), T = c(
|
|
50
|
+
l == null ? void 0 : l.lockScroll,
|
|
51
|
+
(M = o == null ? void 0 : o.picker) == null ? void 0 : M.lockScroll,
|
|
52
|
+
void 0,
|
|
53
|
+
!0
|
|
54
|
+
), X = c(
|
|
55
|
+
h,
|
|
56
|
+
o == null ? void 0 : o.size,
|
|
52
57
|
void 0,
|
|
53
|
-
|
|
54
|
-
),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
),
|
|
60
|
-
typeof
|
|
61
|
-
typeof (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
), {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
y.size
|
|
59
|
+
), Z = c(
|
|
60
|
+
A,
|
|
61
|
+
o == null ? void 0 : o.color,
|
|
62
|
+
I.defaultColor,
|
|
63
|
+
y.color
|
|
64
|
+
), K = Fo(
|
|
65
|
+
typeof S == "string" ? S : void 0,
|
|
66
|
+
typeof (o == null ? void 0 : o.radius) == "string" ? o.radius : void 0,
|
|
67
|
+
I.defaultRadius,
|
|
68
|
+
y.radius
|
|
69
|
+
), C = xo(
|
|
70
|
+
K === "full" ? "xl" : K,
|
|
71
|
+
Lo,
|
|
72
|
+
y.radius
|
|
73
|
+
), {
|
|
74
|
+
refs: R,
|
|
75
|
+
context: k,
|
|
76
|
+
floatingStyles: oo,
|
|
77
|
+
isPositioned: to,
|
|
78
|
+
getReferenceProps: eo,
|
|
79
|
+
getFloatingProps: lo
|
|
80
|
+
} = To({
|
|
81
|
+
isOpen: i,
|
|
82
|
+
onOpenChange: p,
|
|
83
|
+
disabled: w,
|
|
84
|
+
matchReferenceWidth: !1,
|
|
73
85
|
// Allow calendar to size naturally side-by-side
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
(o) => {
|
|
89
|
-
t == null || t(o), n(o ? I(o, s) : ""), (s === "date" || o === null) && v(!1);
|
|
86
|
+
role: "dialog"
|
|
87
|
+
});
|
|
88
|
+
U(() => {
|
|
89
|
+
if (!i || !T) return;
|
|
90
|
+
const t = window.scrollY, d = document.body.style.position, F = document.body.style.top, x = document.body.style.left, g = document.body.style.right, v = document.body.style.width, m = document.body.style.overflow;
|
|
91
|
+
return document.body.style.position = "fixed", document.body.style.top = `-${t}px`, document.body.style.left = "0", document.body.style.right = "0", document.body.style.width = "100%", document.body.style.overflow = "hidden", () => {
|
|
92
|
+
document.body.style.position = d, document.body.style.top = F, document.body.style.left = x, document.body.style.right = g, document.body.style.width = v, document.body.style.overflow = m, window.scrollTo(0, t);
|
|
93
|
+
};
|
|
94
|
+
}, [i, T]), U(() => {
|
|
95
|
+
a(n ? b(n, s) : "");
|
|
96
|
+
}, [n, s]);
|
|
97
|
+
const so = f(
|
|
98
|
+
(t) => {
|
|
99
|
+
e == null || e(t), a(t ? b(t, s) : ""), (s === "date" || t === null) && p(!1);
|
|
90
100
|
},
|
|
91
|
-
[
|
|
92
|
-
),
|
|
93
|
-
(
|
|
94
|
-
var
|
|
95
|
-
|
|
101
|
+
[e, s]
|
|
102
|
+
), ro = f(() => p(!1), []), no = f(
|
|
103
|
+
(t) => {
|
|
104
|
+
var d;
|
|
105
|
+
t.stopPropagation(), e == null || e(null), a(""), p(!1), (d = L.current) == null || d.focus();
|
|
96
106
|
},
|
|
97
|
-
[
|
|
98
|
-
),
|
|
99
|
-
(
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
102
|
-
|
|
107
|
+
[e]
|
|
108
|
+
), ao = f(
|
|
109
|
+
(t) => {
|
|
110
|
+
const d = t.target, F = d.value, x = P, g = d.selectionStart ?? 0, v = F.replace(/\D/g, "");
|
|
111
|
+
if (v.length === 0) {
|
|
112
|
+
a(""), e == null || e(null);
|
|
103
113
|
return;
|
|
104
114
|
}
|
|
105
|
-
const
|
|
106
|
-
|
|
115
|
+
const m = ho(
|
|
116
|
+
v,
|
|
107
117
|
s,
|
|
108
|
-
|
|
118
|
+
n ?? void 0
|
|
109
119
|
);
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
if (m) {
|
|
121
|
+
e == null || e(m);
|
|
122
|
+
const V = b(m, s);
|
|
123
|
+
a(V);
|
|
124
|
+
const j = Ao(
|
|
125
|
+
x,
|
|
126
|
+
V,
|
|
127
|
+
g
|
|
118
128
|
);
|
|
119
129
|
requestAnimationFrame(() => {
|
|
120
|
-
|
|
130
|
+
d.setSelectionRange(j, j);
|
|
121
131
|
});
|
|
122
132
|
} else
|
|
123
|
-
n
|
|
133
|
+
a(n ? b(n, s) : "");
|
|
124
134
|
},
|
|
125
|
-
[s,
|
|
126
|
-
),
|
|
127
|
-
|
|
135
|
+
[s, n, e, P]
|
|
136
|
+
), io = q ?? Do(s), co = /* @__PURE__ */ B(fo, { children: [
|
|
137
|
+
N && n && !w && /* @__PURE__ */ r(
|
|
128
138
|
"button",
|
|
129
139
|
{
|
|
130
140
|
type: "button",
|
|
131
|
-
onClick:
|
|
141
|
+
onClick: no,
|
|
132
142
|
"aria-label": "Clear selection",
|
|
133
143
|
className: "p-0.5 rounded text-foreground/70 hover:text-foreground transition-colors",
|
|
134
|
-
children: /* @__PURE__ */ r(
|
|
144
|
+
children: /* @__PURE__ */ r(Io, { className: "size-3.5" })
|
|
135
145
|
}
|
|
136
146
|
),
|
|
137
|
-
/* @__PURE__ */ r("span", { className: "text-foreground/70 pointer-events-none", children: s === "time" ? /* @__PURE__ */ r(
|
|
138
|
-
] }), _ =
|
|
139
|
-
|
|
147
|
+
/* @__PURE__ */ r("span", { className: "text-foreground/70 pointer-events-none", children: s === "time" ? /* @__PURE__ */ r(Po, {}) : /* @__PURE__ */ r(wo, {}) })
|
|
148
|
+
] }), _ = i ? /* @__PURE__ */ r(
|
|
149
|
+
yo,
|
|
140
150
|
{
|
|
141
|
-
context:
|
|
151
|
+
context: k,
|
|
142
152
|
modal: !1,
|
|
143
153
|
initialFocus: -1,
|
|
144
154
|
returnFocus: !1,
|
|
145
155
|
children: /* @__PURE__ */ r(
|
|
146
156
|
"div",
|
|
147
157
|
{
|
|
148
|
-
ref:
|
|
149
|
-
style: {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
ref: R.setFloating,
|
|
159
|
+
style: { ...oo },
|
|
160
|
+
className: Ko(
|
|
161
|
+
"z-100 outline-none w-max",
|
|
162
|
+
// Disable transitions on the floating node. Floating UI applies
|
|
163
|
+
// position via `transform` on every scroll tick, and any inherited
|
|
164
|
+
// transform transition would ease toward each new position instead
|
|
165
|
+
// of snapping, producing a spring/bounce effect.
|
|
166
|
+
"transition-none",
|
|
167
|
+
to ? "animate-in fade-in-0 zoom-in-95 duration-150 ease-out" : "invisible opacity-0 pointer-events-none",
|
|
168
|
+
l == null ? void 0 : l.className
|
|
158
169
|
),
|
|
159
|
-
...
|
|
170
|
+
...lo(),
|
|
160
171
|
children: /* @__PURE__ */ r(
|
|
161
|
-
|
|
172
|
+
No,
|
|
162
173
|
{
|
|
163
|
-
selected:
|
|
174
|
+
selected: n,
|
|
164
175
|
mode: s,
|
|
165
|
-
isClearable:
|
|
166
|
-
resolvedSizeKey:
|
|
167
|
-
onSelect:
|
|
168
|
-
onClose:
|
|
169
|
-
disableFuture:
|
|
170
|
-
resolvedColor:
|
|
171
|
-
radiusClass:
|
|
176
|
+
isClearable: N,
|
|
177
|
+
resolvedSizeKey: X,
|
|
178
|
+
onSelect: so,
|
|
179
|
+
onClose: ro,
|
|
180
|
+
disableFuture: Y,
|
|
181
|
+
resolvedColor: Z,
|
|
182
|
+
radiusClass: C
|
|
172
183
|
}
|
|
173
184
|
)
|
|
174
185
|
}
|
|
175
186
|
)
|
|
176
187
|
}
|
|
177
|
-
) : null,
|
|
178
|
-
(
|
|
179
|
-
|
|
188
|
+
) : null, uo = Q ?? (typeof document < "u" ? document.body : null), mo = f(
|
|
189
|
+
(t) => {
|
|
190
|
+
t && (R.setReference(t), L.current = t, typeof u == "function" ? u(t) : u && (u.current = t));
|
|
180
191
|
},
|
|
181
|
-
[
|
|
192
|
+
[R, u]
|
|
182
193
|
);
|
|
183
|
-
return /* @__PURE__ */
|
|
194
|
+
return /* @__PURE__ */ B("div", { className: "w-full relative inline-block", children: [
|
|
184
195
|
/* @__PURE__ */ r(
|
|
185
|
-
|
|
196
|
+
go,
|
|
186
197
|
{
|
|
187
|
-
...
|
|
188
|
-
ref:
|
|
189
|
-
id:
|
|
190
|
-
size:
|
|
191
|
-
radius:
|
|
192
|
-
color:
|
|
193
|
-
placeholder:
|
|
194
|
-
value:
|
|
195
|
-
onChange:
|
|
196
|
-
endContent:
|
|
197
|
-
disabled:
|
|
198
|
-
"aria-expanded":
|
|
198
|
+
...D,
|
|
199
|
+
ref: mo,
|
|
200
|
+
id: H,
|
|
201
|
+
size: h,
|
|
202
|
+
radius: S,
|
|
203
|
+
color: A,
|
|
204
|
+
placeholder: io,
|
|
205
|
+
value: P,
|
|
206
|
+
onChange: ao,
|
|
207
|
+
endContent: co,
|
|
208
|
+
disabled: w,
|
|
209
|
+
"aria-expanded": i,
|
|
199
210
|
"aria-haspopup": "dialog",
|
|
200
|
-
...
|
|
211
|
+
...eo()
|
|
201
212
|
}
|
|
202
213
|
),
|
|
203
|
-
|
|
214
|
+
i && (J ? /* @__PURE__ */ r(po, { root: uo, children: _ }) : _)
|
|
204
215
|
] });
|
|
205
216
|
}
|
|
206
217
|
);
|
|
207
|
-
|
|
218
|
+
Eo.displayName = "DatePicker";
|
|
208
219
|
export {
|
|
209
|
-
|
|
220
|
+
Eo as DatePicker
|
|
210
221
|
};
|
|
@@ -38,13 +38,15 @@ export interface DatePickerConfig extends InputConfig {
|
|
|
38
38
|
*/
|
|
39
39
|
export interface PickerConfig {
|
|
40
40
|
/**
|
|
41
|
-
* Whether to render the calendar popover
|
|
41
|
+
* Whether to render the calendar popover through Floating UI's
|
|
42
|
+
* `FloatingPortal`.
|
|
42
43
|
* When true, the popover is rendered at the document body level,
|
|
43
44
|
* escaping any parent DOM hierarchy. This prevents CSS containment
|
|
44
45
|
* and stacking context issues. Defaults to true because popovers
|
|
45
46
|
* should always appear above other content.
|
|
46
47
|
*
|
|
47
48
|
* @default true
|
|
49
|
+
* @see FloatingPortal - https://floating-ui.com/docs/FloatingPortal
|
|
48
50
|
*/
|
|
49
51
|
portal?: boolean;
|
|
50
52
|
/**
|
|
@@ -53,6 +55,15 @@ export interface PickerConfig {
|
|
|
53
55
|
* Defaults to document.body.
|
|
54
56
|
*/
|
|
55
57
|
portalTarget?: HTMLElement | null;
|
|
58
|
+
/**
|
|
59
|
+
* Whether to lock page scroll while the calendar popover is open.
|
|
60
|
+
* When true, the page behind the popover cannot scroll. Uses
|
|
61
|
+
* scroll-position-compensated `position: fixed` on `<body>` so locking
|
|
62
|
+
* does not jump the page back to the top.
|
|
63
|
+
*
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
lockScroll?: boolean;
|
|
56
67
|
}
|
|
57
68
|
/**
|
|
58
69
|
* Default config values registered for the DatePicker component.
|