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.
@@ -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, floatingStyles: q, context: d, isPositioned: H } = fe({
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: H,
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 function Calendar({ selected, mode, isClearable, resolvedSizeKey, resolvedColor, radiusClass, onSelect, onClose, disableFuture, }: CalendarProps): import("react").JSX.Element;
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;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,eAAe,EACf,aAAa,EACb,WAAW,EACX,QAAQ,EACR,OAAO,EACP,aAAqB,GACtB,EAAE,aAAa,+BAgQf"}
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 q } from "react";
4
- import { ChevronLeftIcon as B } from "../../icons/ChevronLeftIcon.js";
5
- import { ChevronRightIcon as J } from "../../icons/ChevronRightIcon.js";
6
- import { buildDayCells as Q, MONTHS as U, DAYS_OF_WEEK as X } from "./date-picker.helpers.js";
7
- import { CALENDAR_COLOR_CLASSES as L, DATE_PICKER_CELL_SIZE_CLASS as tt } from "./date-picker-styles.js";
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
- function ut({
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: a,
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
- ), [i, g] = f(
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, i, t, b, p, x, 0)), s === "date" && w();
42
+ v(new Date(l, a, t, b, p, x, 0)), s === "date" && w();
43
43
  }
44
44
  function P() {
45
- i === 0 ? (g(11), k((t) => t - 1)) : g((t) => t - 1);
45
+ a === 0 ? (g(11), k((t) => t - 1)) : g((t) => t - 1);
46
46
  }
47
47
  function V() {
48
- i === 11 ? (g(0), k((t) => t + 1)) : g((t) => t + 1);
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() === i && n.getDate() === t;
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() === i && r.getDate() === t;
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, i, t) > $ : !1;
62
+ return Y ? new Date(l, a, t) > $ : !1;
63
63
  }
64
- const F = !Y || l < r.getFullYear() || l === r.getFullYear() && i < r.getMonth(), E = s === "date" || s === "datetime", z = s === "time" || s === "datetime", G = s !== "date" || C && !!n, _ = Q(l, i), W = q(() => _.map((t, e) => ({
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
- a
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
- a
88
+ i
89
89
  ),
90
- children: /* @__PURE__ */ o(B, {})
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
- U[i],
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
- a
108
+ i
109
109
  ),
110
- children: /* @__PURE__ */ o(J, {})
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
- X.map((t) => /* @__PURE__ */ o(
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
- tt[j],
133
- a,
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: a
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: a
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: a
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
- a,
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
- ut as Calendar
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 portalTarget.
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":"AAqCA,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,8GAwTtB,CAAC"}
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 h, Fragment as me } from "react/jsx-runtime";
3
- import { useClick as fe, useDismiss as pe, useRole as ve, useInteractions as ye, FloatingFocusManager as Ie, FloatingPortal as Pe } from "@floating-ui/react";
4
- import { forwardRef as Re, useId as Se, useState as M, useRef as Fe, useEffect as Ne, useCallback as d } from "react";
5
- import { CalendarIcon as xe } from "../../icons/CalendarIcon.js";
6
- import { ClearIcon as Ae } from "../../icons/ClearIcon.js";
7
- import { ClockIcon as De } from "../../icons/ClockIcon.js";
8
- import { useAsheeConfig as Ke } from "../../libs/context.js";
9
- import { resolveCascade as m, resolveRadiusKey as we, resolveClassKey as Ee } from "../../utils/resolve-token.js";
10
- import { Input as _e } from "../input/Input.js";
11
- import { Calendar as Le } from "./Calendar.js";
12
- import { formatDisplay as I, parseDateString as Te, getNewCursorPosition as ze, getDefaultPlaceholder as Oe } from "./date-picker.helpers.js";
13
- import { FALLBACK_DATE_PICKER_CONFIG as f } from "./date-picker-config.js";
14
- import { RADIUS_CLASS as be } from "../../shared/radius.js";
15
- import { useSelectFloating as ge } from "../select-menu/use-select-floating.js";
16
- import { cn as he } from "../../utils/cn.js";
17
- import { FALLBACK_SELECT_MENU_CONFIG as Me } from "../select-menu/select-menu-config.js";
18
- const Ve = Re(
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: l,
21
- onChange: t,
22
- mode: V,
23
- isClearable: x = !1,
24
- disableFuture: j = !1,
25
- placeholder: B,
26
- size: A,
27
- radius: P,
28
- color: D,
29
- disabled: u,
30
- picker: a,
31
- ...K
32
- }, c) => {
33
- var L, T, z;
34
- const R = Ke(), e = (L = R.components) == null ? void 0 : L.datePicker, G = Se(), U = K.id ?? G, [p, v] = M(!1), [S, n] = M(""), w = Fe(null), s = m(
35
- V,
36
- e == null ? void 0 : e.mode,
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
- f.mode
39
- ), W = m(
40
- a == null ? void 0 : a.portal,
41
- (T = e == null ? void 0 : e.picker) == null ? void 0 : T.portal,
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
- Me.portal
44
- ), q = m(
45
- a == null ? void 0 : a.portalTarget,
46
- (z = e == null ? void 0 : e.picker) == null ? void 0 : z.portalTarget,
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
- ), H = m(
50
- A,
51
- e == null ? void 0 : e.size,
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
- f.size
54
- ), J = m(
55
- D,
56
- e == null ? void 0 : e.color,
57
- R.defaultColor,
58
- f.color
59
- ), E = we(
60
- typeof P == "string" ? P : void 0,
61
- typeof (e == null ? void 0 : e.radius) == "string" ? e.radius : void 0,
62
- R.defaultRadius,
63
- f.radius
64
- ), Q = Ee(
65
- E === "full" ? "xl" : E,
66
- be,
67
- f.radius
68
- ), { refs: F, floatingStyles: X, context: y, isPositioned: Y } = ge({
69
- isOpen: p,
70
- onOpenChange: v,
71
- disabled: u,
72
- matchReferenceWidth: !1
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
- }), Z = fe(y, { enabled: !u }), $ = pe(y, {
75
- enabled: !u,
76
- outsidePress: !0,
77
- outsidePressEvent: "mousedown",
78
- escapeKey: !0
79
- }), C = ve(y, { role: "dialog" }), { getReferenceProps: k, getFloatingProps: ee } = ye([
80
- Z,
81
- $,
82
- C
83
- ]);
84
- Ne(() => {
85
- n(l ? I(l, s) : "");
86
- }, [l, s]);
87
- const te = d(
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
- [t, s]
92
- ), oe = d(() => v(!1), []), se = d(
93
- (o) => {
94
- var i;
95
- o.stopPropagation(), t == null || t(null), n(""), v(!1), (i = w.current) == null || i.focus();
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
- [t]
98
- ), re = d(
99
- (o) => {
100
- const i = o.target, ue = i.value, ce = S, de = i.selectionStart ?? 0, O = ue.replace(/\D/g, "");
101
- if (O.length === 0) {
102
- n(""), t == null || t(null);
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 N = Te(
106
- O,
115
+ const m = ho(
116
+ v,
107
117
  s,
108
- l ?? void 0
118
+ n ?? void 0
109
119
  );
110
- if (N) {
111
- t == null || t(N);
112
- const b = I(N, s);
113
- n(b);
114
- const g = ze(
115
- ce,
116
- b,
117
- de
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
- i.setSelectionRange(g, g);
130
+ d.setSelectionRange(j, j);
121
131
  });
122
132
  } else
123
- n(l ? I(l, s) : "");
133
+ a(n ? b(n, s) : "");
124
134
  },
125
- [s, l, t, S]
126
- ), le = B ?? Oe(s), ae = /* @__PURE__ */ h(me, { children: [
127
- x && l && !u && /* @__PURE__ */ r(
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: se,
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(Ae, { className: "size-3.5" })
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(De, {}) : /* @__PURE__ */ r(xe, {}) })
138
- ] }), _ = p ? /* @__PURE__ */ r(
139
- Ie,
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: y,
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: F.setFloating,
149
- style: {
150
- ...X,
151
- width: "max-content",
152
- minWidth: "fit-content"
153
- },
154
- className: he(
155
- "z-100 outline-none",
156
- Y ? "animate-in fade-in-0 zoom-in-95 duration-150 ease-out" : "invisible opacity-0 pointer-events-none",
157
- a == null ? void 0 : a.className
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
- ...ee(),
170
+ ...lo(),
160
171
  children: /* @__PURE__ */ r(
161
- Le,
172
+ No,
162
173
  {
163
- selected: l,
174
+ selected: n,
164
175
  mode: s,
165
- isClearable: x,
166
- resolvedSizeKey: H,
167
- onSelect: te,
168
- onClose: oe,
169
- disableFuture: j,
170
- resolvedColor: J,
171
- radiusClass: Q
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, ne = q ?? (typeof document < "u" ? document.body : null), ie = d(
178
- (o) => {
179
- o && (F.setReference(o), w.current = o, typeof c == "function" ? c(o) : c && (c.current = o));
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
- [F, c]
192
+ [R, u]
182
193
  );
183
- return /* @__PURE__ */ h("div", { className: "w-full relative inline-block", children: [
194
+ return /* @__PURE__ */ B("div", { className: "w-full relative inline-block", children: [
184
195
  /* @__PURE__ */ r(
185
- _e,
196
+ go,
186
197
  {
187
- ...K,
188
- ref: ie,
189
- id: U,
190
- size: A,
191
- radius: P,
192
- color: D,
193
- placeholder: le,
194
- value: S,
195
- onChange: re,
196
- endContent: ae,
197
- disabled: u,
198
- "aria-expanded": p,
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
- ...k()
211
+ ...eo()
201
212
  }
202
213
  ),
203
- p && (W ? /* @__PURE__ */ r(Pe, { root: ne, children: _ }) : _)
214
+ i && (J ? /* @__PURE__ */ r(po, { root: uo, children: _ }) : _)
204
215
  ] });
205
216
  }
206
217
  );
207
- Ve.displayName = "DatePicker";
218
+ Eo.displayName = "DatePicker";
208
219
  export {
209
- Ve as DatePicker
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 in a React portal.
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.