asheeui 0.6.10 → 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.
Files changed (39) hide show
  1. package/dist/components/accordion/Accordion.js +7 -7
  2. package/dist/components/autocomplete/Autocomplete.d.ts +5 -5
  3. package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
  4. package/dist/components/autocomplete/Autocomplete.js +42 -41
  5. package/dist/components/carousel/Carousel.js +43 -43
  6. package/dist/components/chip/Chip.js +8 -8
  7. package/dist/components/date-picker/Calendar.d.ts +6 -1
  8. package/dist/components/date-picker/Calendar.d.ts.map +1 -1
  9. package/dist/components/date-picker/Calendar.js +30 -30
  10. package/dist/components/date-picker/DatePicker.d.ts +7 -6
  11. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  12. package/dist/components/date-picker/DatePicker.js +166 -155
  13. package/dist/components/date-picker/date-picker-config.d.ts +12 -1
  14. package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
  15. package/dist/components/marquee/Marquee.js +22 -22
  16. package/dist/components/multi-select/MultiSelect.d.ts +5 -5
  17. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  18. package/dist/components/multi-select/MultiSelect.js +45 -44
  19. package/dist/components/select/Select.d.ts +5 -5
  20. package/dist/components/select/Select.d.ts.map +1 -1
  21. package/dist/components/select/Select.js +117 -114
  22. package/dist/components/select-menu/SelectMenu.d.ts +20 -11
  23. package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
  24. package/dist/components/select-menu/SelectMenu.js +146 -109
  25. package/dist/components/select-menu/select-menu-config.d.ts +8 -4
  26. package/dist/components/select-menu/select-menu-config.d.ts.map +1 -1
  27. package/dist/components/select-menu/select-menu-config.js +1 -1
  28. package/dist/components/select-menu/use-select-floating.d.ts +46 -17
  29. package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
  30. package/dist/components/select-menu/use-select-floating.js +36 -22
  31. package/dist/components/toast/ToastItem.js +30 -30
  32. package/dist/components/toast/ToastProvider.d.ts +5 -5
  33. package/dist/components/toast/ToastProvider.d.ts.map +1 -1
  34. package/dist/components/toast/ToastProvider.js +66 -66
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/theme/controller.d.ts.map +1 -1
  38. package/dist/theme/controller.js +14 -16
  39. package/package.json +3 -20
@@ -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
  };
@@ -60,11 +60,12 @@ export interface DatePickerProps extends BaseDatePickerProps {
60
60
  * with Floating UI for popover positioning and follows the standard AsheeUI
61
61
  * cascade system for visual tokens.
62
62
  *
63
- * By default, the calendar popover uses React's createPortal to render at the
64
- * document body level. This ensures the popover escapes CSS containment,
65
- * overflow clipping, and stacking context issues. The portal can be disabled
66
- * via the `picker.portal` prop or `components.datePicker.picker.portal` in
67
- * the config if the popover needs to stay within a specific parent container.
63
+ * By default, the calendar popover uses Floating UI's FloatingPortal to
64
+ * render at the document body level. This ensures the popover escapes CSS
65
+ * containment, overflow clipping, and stacking context issues. The portal
66
+ * can be disabled via the `picker.portal` prop or
67
+ * `components.datePicker.picker.portal` in the config if the popover needs
68
+ * to stay within a specific parent container.
68
69
  *
69
70
  * @param props - DatePicker configuration options.
70
71
  * @param props.selected - Currently selected date or null.
@@ -77,7 +78,7 @@ export interface DatePickerProps extends BaseDatePickerProps {
77
78
  * @param props.radius - Corner rounding. Defaults to "md".
78
79
  * @param props.color - Theme accent color. Defaults to "primary".
79
80
  * @param props.disabled - Whether the input is disabled. Defaults to false.
80
- * @param props.picker - Picker configuration overrides including className, portal, and portalTarget.
81
+ * @param props.picker - Picker configuration overrides including className, portal, portalTarget, and lockScroll.
81
82
  * @param props.label - Field label text.
82
83
  * @param props.description - Description text.
83
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,eAAO,MAAM,UAAU,8GAiTtB,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 n, jsxs as g, Fragment as de } from "react/jsx-runtime";
3
- import { useClick as me, useDismiss as fe, useRole as pe, useInteractions as ve, FloatingFocusManager as ye } from "@floating-ui/react";
4
- import { forwardRef as Ie, useId as Pe, useState as h, useRef as Re, useEffect as Se, useCallback as d } from "react";
5
- import { createPortal as Fe } from "react-dom";
6
- import { CalendarIcon as Ne } from "../../icons/CalendarIcon.js";
7
- import { ClearIcon as xe } from "../../icons/ClearIcon.js";
8
- import { ClockIcon as Ae } from "../../icons/ClockIcon.js";
9
- import { useAsheeConfig as De } from "../../libs/context.js";
10
- import { resolveCascade as m, resolveRadiusKey as Ke, resolveClassKey as we } from "../../utils/resolve-token.js";
11
- import { Input as Ee } from "../input/Input.js";
12
- import { Calendar as _e } from "./Calendar.js";
13
- import { formatDisplay as I, parseDateString as Le, getNewCursorPosition as Te, getDefaultPlaceholder as ze } from "./date-picker.helpers.js";
14
- import { FALLBACK_DATE_PICKER_CONFIG as f } from "./date-picker-config.js";
15
- import { RADIUS_CLASS as Oe } from "../../shared/radius.js";
16
- import { useSelectFloating as be } from "../select-menu/use-select-floating.js";
17
- import { cn as Me } from "../../utils/cn.js";
18
- import { FALLBACK_SELECT_MENU_CONFIG as Ve } from "../select-menu/select-menu-config.js";
19
- const ge = Ie(
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(
20
19
  ({
21
- selected: r,
22
- onChange: t,
23
- mode: j,
24
- isClearable: x = !1,
25
- disableFuture: B = !1,
26
- placeholder: G,
27
- size: A,
28
- radius: P,
29
- color: D,
30
- disabled: u,
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,
31
30
  picker: l,
32
- ...K
33
- }, c) => {
34
- var T, z, O;
35
- const R = De(), e = (T = R.components) == null ? void 0 : T.datePicker, U = Pe(), W = K.id ?? U, [p, v] = h(!1), [S, a] = h(""), w = Re(null), s = m(
36
- j,
37
- e == null ? void 0 : e.mode,
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,
38
37
  void 0,
39
- f.mode
40
- ), q = m(
38
+ y.mode
39
+ ), J = c(
41
40
  l == null ? void 0 : l.portal,
42
- (z = e == null ? void 0 : e.picker) == null ? void 0 : z.portal,
41
+ (O = o == null ? void 0 : o.picker) == null ? void 0 : O.portal,
43
42
  void 0,
44
- Ve.portal
45
- ), H = m(
43
+ _o.portal
44
+ ), Q = c(
46
45
  l == null ? void 0 : l.portalTarget,
47
- (O = e == null ? void 0 : e.picker) == null ? void 0 : O.portalTarget,
46
+ (z = o == null ? void 0 : o.picker) == null ? void 0 : z.portalTarget,
48
47
  void 0,
49
48
  null
50
- ), J = m(
51
- A,
52
- 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,
53
57
  void 0,
54
- f.size
55
- ), Q = m(
56
- D,
57
- e == null ? void 0 : e.color,
58
- R.defaultColor,
59
- f.color
60
- ), E = Ke(
61
- typeof P == "string" ? P : void 0,
62
- typeof (e == null ? void 0 : e.radius) == "string" ? e.radius : void 0,
63
- R.defaultRadius,
64
- f.radius
65
- ), X = we(
66
- E === "full" ? "xl" : E,
67
- Oe,
68
- f.radius
69
- ), { refs: F, floatingStyles: Y, context: y } = be({
70
- isOpen: p,
71
- onOpenChange: v,
72
- disabled: u,
73
- 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,
74
85
  // Allow calendar to size naturally side-by-side
75
- }), Z = me(y, { enabled: !u }), $ = fe(y, {
76
- enabled: !u,
77
- outsidePress: !0,
78
- outsidePressEvent: "mousedown",
79
- escapeKey: !0
80
- }), C = pe(y, { role: "dialog" }), { getReferenceProps: k, getFloatingProps: ee } = ve([
81
- Z,
82
- $,
83
- C
84
- ]);
85
- Se(() => {
86
- a(r ? I(r, s) : "");
87
- }, [r, s]);
88
- const te = d(
89
- (o) => {
90
- t == null || t(o), a(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);
91
100
  },
92
- [t, s]
93
- ), oe = d(() => v(!1), []), se = d(
94
- (o) => {
95
- var i;
96
- o.stopPropagation(), t == null || t(null), a(""), 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();
97
106
  },
98
- [t]
99
- ), re = d(
100
- (o) => {
101
- const i = o.target, ie = i.value, ue = S, ce = i.selectionStart ?? 0, b = ie.replace(/\D/g, "");
102
- if (b.length === 0) {
103
- a(""), 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);
104
113
  return;
105
114
  }
106
- const N = Le(
107
- b,
115
+ const m = ho(
116
+ v,
108
117
  s,
109
- r ?? void 0
118
+ n ?? void 0
110
119
  );
111
- if (N) {
112
- t == null || t(N);
113
- const M = I(N, s);
114
- a(M);
115
- const V = Te(
116
- ue,
117
- M,
118
- ce
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
119
128
  );
120
129
  requestAnimationFrame(() => {
121
- i.setSelectionRange(V, V);
130
+ d.setSelectionRange(j, j);
122
131
  });
123
132
  } else
124
- a(r ? I(r, s) : "");
133
+ a(n ? b(n, s) : "");
125
134
  },
126
- [s, r, t, S]
127
- ), le = G ?? ze(s), ae = /* @__PURE__ */ g(de, { children: [
128
- x && r && !u && /* @__PURE__ */ n(
135
+ [s, n, e, P]
136
+ ), io = q ?? Do(s), co = /* @__PURE__ */ B(fo, { children: [
137
+ N && n && !w && /* @__PURE__ */ r(
129
138
  "button",
130
139
  {
131
140
  type: "button",
132
- onClick: se,
141
+ onClick: no,
133
142
  "aria-label": "Clear selection",
134
143
  className: "p-0.5 rounded text-foreground/70 hover:text-foreground transition-colors",
135
- children: /* @__PURE__ */ n(xe, { className: "size-3.5" })
144
+ children: /* @__PURE__ */ r(Io, { className: "size-3.5" })
136
145
  }
137
146
  ),
138
- /* @__PURE__ */ n("span", { className: "text-foreground/70 pointer-events-none", children: s === "time" ? /* @__PURE__ */ n(Ae, {}) : /* @__PURE__ */ n(Ne, {}) })
139
- ] }), _ = p ? /* @__PURE__ */ n(
140
- ye,
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,
141
150
  {
142
- context: y,
151
+ context: k,
143
152
  modal: !1,
144
153
  initialFocus: -1,
145
154
  returnFocus: !1,
146
- children: /* @__PURE__ */ n(
155
+ children: /* @__PURE__ */ r(
147
156
  "div",
148
157
  {
149
- ref: F.setFloating,
150
- style: {
151
- ...Y,
152
- width: "max-content",
153
- minWidth: "fit-content"
154
- },
155
- className: Me(
156
- "z-100 outline-none animate-in fade-in-0 zoom-in-95 duration-150 ease-out",
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",
157
168
  l == null ? void 0 : l.className
158
169
  ),
159
- ...ee(),
160
- children: /* @__PURE__ */ n(
161
- _e,
170
+ ...lo(),
171
+ children: /* @__PURE__ */ r(
172
+ No,
162
173
  {
163
- selected: r,
174
+ selected: n,
164
175
  mode: s,
165
- isClearable: x,
166
- resolvedSizeKey: J,
167
- onSelect: te,
168
- onClose: oe,
169
- disableFuture: B,
170
- resolvedColor: Q,
171
- radiusClass: X
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, L = H ?? (typeof document < "u" ? document.body : null), ne = 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__ */ g("div", { className: "w-full relative inline-block", children: [
184
- /* @__PURE__ */ n(
185
- Ee,
194
+ return /* @__PURE__ */ B("div", { className: "w-full relative inline-block", children: [
195
+ /* @__PURE__ */ r(
196
+ go,
186
197
  {
187
- ...K,
188
- ref: ne,
189
- id: W,
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 && (q && L ? Fe(_, L) : _)
214
+ i && (J ? /* @__PURE__ */ r(po, { root: uo, children: _ }) : _)
204
215
  ] });
205
216
  }
206
217
  );
207
- ge.displayName = "DatePicker";
218
+ Eo.displayName = "DatePicker";
208
219
  export {
209
- ge 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.
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker-config.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAGrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;CAG9B,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,UAAU,EAAE,gBAAgB,CAAC;KAC9B;CACF"}
1
+ {"version":3,"file":"date-picker-config.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAElC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAGrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;CAG9B,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,UAAU,EAAE,gBAAgB,CAAC;KAC9B;CACF"}