asheeui 0.6.10 → 0.6.12

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 (29) 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 +41 -40
  5. package/dist/components/carousel/Carousel.js +43 -43
  6. package/dist/components/chip/Chip.js +8 -8
  7. package/dist/components/date-picker/DatePicker.d.ts +6 -5
  8. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  9. package/dist/components/date-picker/DatePicker.js +87 -87
  10. package/dist/components/marquee/Marquee.js +22 -22
  11. package/dist/components/multi-select/MultiSelect.d.ts +5 -5
  12. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  13. package/dist/components/multi-select/MultiSelect.js +44 -43
  14. package/dist/components/select/Select.d.ts +5 -5
  15. package/dist/components/select/Select.d.ts.map +1 -1
  16. package/dist/components/select/Select.js +53 -52
  17. package/dist/components/select-menu/SelectMenu.d.ts +15 -3
  18. package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
  19. package/dist/components/select-menu/SelectMenu.js +144 -116
  20. package/dist/components/select-menu/use-select-floating.d.ts +5 -2
  21. package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
  22. package/dist/components/select-menu/use-select-floating.js +14 -7
  23. package/dist/components/toast/ToastItem.js +30 -30
  24. package/dist/components/toast/ToastProvider.d.ts +5 -5
  25. package/dist/components/toast/ToastProvider.d.ts.map +1 -1
  26. package/dist/components/toast/ToastProvider.js +66 -66
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/package.json +3 -20
@@ -104,11 +104,11 @@ export interface SelectProps extends SelectFieldProps, Omit<SelectConfig, "menu"
104
104
  * label, description, and message handling, and uses Floating UI for
105
105
  * positioning and accessibility.
106
106
  *
107
- * By default, the dropdown menu uses React's createPortal to render at the
108
- * document body level. This ensures the menu escapes CSS containment, overflow
109
- * clipping, and stacking context issues. The portal can be disabled via the
110
- * `menu.portal` prop or `components.select.menu.portal` in the config if the
111
- * menu needs to stay within a specific parent container.
107
+ * By default, the dropdown menu uses Floating UI's FloatingPortal to render
108
+ * at the document body level. This ensures the menu escapes CSS containment,
109
+ * overflow clipping, and stacking context issues. The portal can be disabled
110
+ * via the `menu.portal` prop or `components.select.menu.portal` in the config
111
+ * if the menu needs to stay within a specific parent container.
112
112
  *
113
113
  * @param props - Select configuration options.
114
114
  * @param props.options - Available options to select from.
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/select/Select.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK5E;;;GAGG;AACH,KAAK,gBAAgB,GAAG,IAAI,CAC1B,UAAU,EACR,OAAO,GACP,aAAa,GACb,SAAS,GACT,UAAU,GACV,WAAW,GACX,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,IAAI,GACJ,OAAO,CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,WACf,SAAQ,gBAAgB,EACtB,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAE5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAE7D;;;OAGG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,MAAM,MAAM,2GA0PlB,CAAC"}
@@ -1,36 +1,36 @@
1
1
  "use client";
2
- import { jsx as l, jsxs as g, Fragment as pe } from "react/jsx-runtime";
3
- import { useClick as ve, useDismiss as Se, useRole as be, useInteractions as ye } from "@floating-ui/react";
4
- import { forwardRef as he, useId as xe, useState as k, useMemo as h, useCallback as Re } from "react";
5
- import { ChevronDownIcon as Ae } from "../../icons/ChevronDownIcon.js";
6
- import { useAsheeConfig as Ie } from "../../libs/context.js";
7
- import { resolveCascade as p, resolveRadiusKey as Fe } from "../../utils/resolve-token.js";
8
- import { Button as Ke } from "../button/Button.js";
9
- import { FieldShell as Le } from "../field/FieldShell.js";
10
- import { SelectMenu as Ne } from "../select-menu/SelectMenu.js";
2
+ import { jsx as l, jsxs as g, Fragment as ve } from "react/jsx-runtime";
3
+ import { useClick as Se, useDismiss as be, useRole as ye, useInteractions as he } from "@floating-ui/react";
4
+ import { forwardRef as xe, useId as Re, useState as k, useMemo as h, useCallback as Ae } from "react";
5
+ import { ChevronDownIcon as Ie } from "../../icons/ChevronDownIcon.js";
6
+ import { useAsheeConfig as Fe } from "../../libs/context.js";
7
+ import { resolveCascade as p, resolveRadiusKey as Ke } from "../../utils/resolve-token.js";
8
+ import { Button as Le } from "../button/Button.js";
9
+ import { FieldShell as Ne } from "../field/FieldShell.js";
10
+ import { SelectMenu as Oe } from "../select-menu/SelectMenu.js";
11
11
  import { FALLBACK_SELECT_CONFIG as o } from "./select-config.js";
12
- import { SELECT_STATUS_BORDER_CLASS as Oe } from "./select-styles.js";
13
- import { useSelectFloating as ge } from "../select-menu/use-select-floating.js";
12
+ import { SELECT_STATUS_BORDER_CLASS as ge } from "./select-styles.js";
13
+ import { useSelectFloating as ke } from "../select-menu/use-select-floating.js";
14
14
  import { cn as x } from "../../utils/cn.js";
15
- const ke = he(
15
+ const Ee = xe(
16
16
  ({
17
17
  options: v = [],
18
18
  value: r,
19
19
  onChange: S,
20
20
  onValueChange: a,
21
21
  size: E,
22
- radius: _,
23
- variant: j,
24
- color: w,
25
- status: z,
26
- label: B,
27
- labelAlign: D,
22
+ radius: P,
23
+ variant: _,
24
+ color: j,
25
+ status: w,
26
+ label: z,
27
+ labelAlign: B,
28
28
  description: b,
29
29
  message: R,
30
- required: M,
30
+ required: D,
31
31
  isLoading: A,
32
32
  disabled: y,
33
- isSearch: P = !1,
33
+ isSearch: M = !1,
34
34
  searchPlaceholder: T = "Search options...",
35
35
  searchInputName: $ = "select-search",
36
36
  initialValue: n,
@@ -45,73 +45,73 @@ const ke = he(
45
45
  endContent: J
46
46
  }, i) => {
47
47
  var O;
48
- const c = Ie(), e = (O = c.components) == null ? void 0 : O.select, X = xe(), d = U ?? X, [u, K] = k(!1), [Y, L] = k(""), Z = p(
48
+ const c = Fe(), e = (O = c.components) == null ? void 0 : O.select, X = Re(), d = U ?? X, [u, K] = k(!1), [Y, L] = k(""), Z = p(
49
49
  E,
50
50
  e == null ? void 0 : e.size,
51
51
  void 0,
52
52
  o.size
53
53
  ), C = p(
54
- j,
54
+ _,
55
55
  e == null ? void 0 : e.variant,
56
56
  c.defaultVariant,
57
57
  o.variant
58
58
  ), V = p(
59
- w,
59
+ j,
60
60
  e == null ? void 0 : e.color,
61
61
  c.defaultColor,
62
62
  o.color
63
- ), ee = Fe(
64
- _,
63
+ ), ee = Ke(
64
+ P,
65
65
  e == null ? void 0 : e.radius,
66
66
  c.defaultRadius,
67
67
  o.radius
68
- ), m = z ?? o.status, te = p(
69
- D,
68
+ ), m = w ?? o.status, te = p(
69
+ B,
70
70
  e == null ? void 0 : e.labelAlign,
71
71
  void 0,
72
72
  o.labelAlign
73
- ), re = m !== "default" ? Oe[m] : "", s = h(
73
+ ), re = m !== "default" ? ge[m] : "", s = h(
74
74
  () => v.find((t) => t.value === r),
75
75
  [v, r]
76
- ), { refs: N, floatingStyles: se, context: f } = ge({
76
+ ), { refs: N, floatingStyles: se, context: f, isPositioned: oe } = ke({
77
77
  isOpen: u,
78
78
  onOpenChange: K,
79
79
  disabled: y
80
- }), oe = ve(f, { enabled: !y }), le = Se(f), ae = be(f, { role: "listbox" }), { getReferenceProps: ne, getFloatingProps: ie } = ye([
81
- oe,
80
+ }), le = Se(f, { enabled: !y }), ae = be(f), ne = ye(f, { role: "listbox" }), { getReferenceProps: ie, getFloatingProps: ce } = he([
82
81
  le,
83
- ae
84
- ]), ce = Re(
82
+ ae,
83
+ ne
84
+ ]), de = Ae(
85
85
  (t) => {
86
86
  if (a == null || a(t.value), S) {
87
- const fe = {
87
+ const pe = {
88
88
  target: { value: t.value, name: F ?? "" }
89
89
  };
90
- S(fe);
90
+ S(pe);
91
91
  }
92
92
  K(!1), L("");
93
93
  },
94
94
  [F, S, a]
95
- ), de = h(() => s != null && s.label ? s.label : n !== void 0 ? String(n) : I, [s, n, I]), ue = h(
95
+ ), ue = h(() => s != null && s.label ? s.label : n !== void 0 ? String(n) : I, [s, n, I]), me = h(
96
96
  () => r != null ? [r] : [],
97
97
  [r]
98
- ), me = ne();
98
+ ), fe = ie();
99
99
  return /* @__PURE__ */ l(
100
- Le,
100
+ Ne,
101
101
  {
102
102
  id: d,
103
- label: B,
103
+ label: z,
104
104
  labelAlign: te,
105
105
  description: b,
106
106
  descriptionId: b ? `${d}-description` : void 0,
107
107
  message: R,
108
108
  messageId: R ? `${d}-message` : void 0,
109
109
  status: m,
110
- required: M,
110
+ required: D,
111
111
  isLoading: A,
112
112
  children: /* @__PURE__ */ g("div", { className: "w-full relative inline-block", children: [
113
113
  /* @__PURE__ */ l(
114
- Ke,
114
+ Le,
115
115
  {
116
116
  ref: (t) => {
117
117
  N.setReference(t), typeof i == "function" ? i(t) : i && (i.current = t);
@@ -136,10 +136,10 @@ const ke = he(
136
136
  ),
137
137
  style: q,
138
138
  startContent: H,
139
- endContent: /* @__PURE__ */ g(pe, { children: [
139
+ endContent: /* @__PURE__ */ g(ve, { children: [
140
140
  J,
141
141
  /* @__PURE__ */ l(
142
- Ae,
142
+ Ie,
143
143
  {
144
144
  className: x(
145
145
  "shrink-0 text-foreground/70 transition-transform duration-200",
@@ -148,7 +148,7 @@ const ke = he(
148
148
  }
149
149
  )
150
150
  ] }),
151
- ...me,
151
+ ...fe,
152
152
  children: /* @__PURE__ */ l(
153
153
  "span",
154
154
  {
@@ -156,23 +156,24 @@ const ke = he(
156
156
  "truncate",
157
157
  s || n ? "text-foreground" : "text-foreground/70"
158
158
  ),
159
- children: de
159
+ children: ue
160
160
  }
161
161
  )
162
162
  }
163
163
  ),
164
164
  /* @__PURE__ */ l(
165
- Ne,
165
+ Oe,
166
166
  {
167
167
  isOpen: u,
168
168
  context: f,
169
169
  floatingStyles: se,
170
- getFloatingProps: ie,
170
+ getFloatingProps: ce,
171
171
  setFloatingRef: N.setFloating,
172
+ isPositioned: oe,
172
173
  options: v,
173
- selectedValues: ue,
174
- onSelectMenuOption: ce,
175
- isSearch: P,
174
+ selectedValues: me,
175
+ onSelectMenuOption: de,
176
+ isSearch: M,
176
177
  searchPlaceholder: T,
177
178
  searchInputName: $,
178
179
  searchQuery: Y,
@@ -187,7 +188,7 @@ const ke = he(
187
188
  );
188
189
  }
189
190
  );
190
- ke.displayName = "Select";
191
+ Ee.displayName = "Select";
191
192
  export {
192
- ke as Select
193
+ Ee as Select
193
194
  };
@@ -35,6 +35,17 @@ export interface SelectMenuProps {
35
35
  * Ref setter for the floating element.
36
36
  */
37
37
  setFloatingRef: (node: HTMLElement | null) => void;
38
+ /**
39
+ * Whether the floating element has completed its first position update.
40
+ * When false, the menu stays in the DOM (so Floating UI can measure it)
41
+ * but is hidden (`invisible opacity-0 pointer-events-none`), preventing a
42
+ * visible flash at its initial (0, 0) coordinate. The enter animation
43
+ * classes are only applied once this is true so the reveal and animation
44
+ * start together.
45
+ *
46
+ * @default true
47
+ */
48
+ isPositioned?: boolean;
38
49
  /**
39
50
  * Available options to display in the menu.
40
51
  */
@@ -111,8 +122,8 @@ export interface SelectMenuProps {
111
122
  * supports custom option rendering, search filtering, and configurable
112
123
  * item styles through the cascade resolution system.
113
124
  *
114
- * By default, the menu uses React's createPortal to render at the document
115
- * body level. This ensures the menu escapes CSS containment, overflow
125
+ * By default, the menu uses Floating UI's FloatingPortal to render at the
126
+ * document body level. This ensures the menu escapes CSS containment, overflow
116
127
  * clipping, and stacking context issues. The portal can be disabled via
117
128
  * the `menuProps.portal` prop if the menu needs to stay within a specific
118
129
  * parent container. This is typically controlled by the parent component.
@@ -123,6 +134,7 @@ export interface SelectMenuProps {
123
134
  * @param props.floatingStyles - CSS styles for positioning.
124
135
  * @param props.getFloatingProps - Props getter for the floating element.
125
136
  * @param props.setFloatingRef - Ref setter for the floating element.
137
+ * @param props.isPositioned - Whether the floating element has been positioned by Floating UI. Defaults to true.
126
138
  * @param props.options - Available options to display.
127
139
  * @param props.selectedValues - Currently selected values.
128
140
  * @param props.onSelectMenuOption - Callback fired when an option is selected.
@@ -179,7 +191,7 @@ export interface SelectMenuProps {
179
191
  * @see Button - The button component used for menu items.
180
192
  */
181
193
  export declare const SelectMenu: {
182
- ({ isOpen, context, floatingStyles, getFloatingProps, setFloatingRef, options, selectedValues, onSelectMenuOption, isSearch, searchPlaceholder, searchInputName, searchQuery, onSearchChange, belowList, menuConfig, menuProps, renderOption, initialFocus, returnFocus, }: SelectMenuProps): import("react").JSX.Element | null;
194
+ ({ isOpen, context, floatingStyles, getFloatingProps, setFloatingRef, isPositioned, options, selectedValues, onSelectMenuOption, isSearch, searchPlaceholder, searchInputName, searchQuery, onSearchChange, belowList, menuConfig, menuProps, renderOption, initialFocus, returnFocus, }: SelectMenuProps): import("react").JSX.Element | null;
183
195
  displayName: string;
184
196
  };
185
197
  //# sourceMappingURL=SelectMenu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../../src/components/select-menu/SelectMenu.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAEL,KAAK,SAAS,EAIf,MA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C;IAEnD;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAE5B;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAErC;;;OAGG;IACH,kBAAkB,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAEvD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,KAAK,SAAS,CAAC;IAE5E;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAErD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAkFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,eAAO,MAAM,UAAU;8RAqBpB,eAAe;;CAwMjB,CAAC"}
@@ -1,161 +1,189 @@
1
1
  "use client";
2
- import { jsx as a, jsxs as V } from "react/jsx-runtime";
3
- import { FloatingFocusManager as X } from "@floating-ui/react";
4
- import { useState as Y, useEffect as Z, useMemo as $ } from "react";
5
- import { createPortal as n } from "react-dom";
6
- import { CheckIcon as u } from "../../icons/CheckIcon.js";
7
- import { SearchIcon as m } from "../../icons/SearchIcon.js";
8
- import { useAsheeConfig as p } from "../../libs/context.js";
9
- import { resolveCascade as r, resolveRadiusKey as C } from "../../utils/resolve-token.js";
10
- import { Button as g } from "../button/Button.js";
11
- import { Input as P } from "../input/Input.js";
12
- import { FALLBACK_SELECT_MENU_CONFIG as d } from "./select-menu-config.js";
13
- import { cn as tt } from "../../utils/cn.js";
14
- const lt = ({
15
- isOpen: s,
16
- context: A,
17
- floatingStyles: F,
18
- getFloatingProps: L,
19
- setFloatingRef: M,
20
- options: v = [],
21
- selectedValues: E = [],
22
- onSelectMenuOption: Q,
23
- isSearch: y = !0,
24
- searchPlaceholder: T = "Search...",
25
- searchInputName: j = "select-menu-search",
26
- searchQuery: K,
27
- onSearchChange: b,
28
- belowList: h,
29
- menuConfig: l,
2
+ import { jsx as l, jsxs as Q, Fragment as J } from "react/jsx-runtime";
3
+ import { FloatingFocusManager as X, FloatingPortal as Y } from "@floating-ui/react";
4
+ import { useState as Z, useEffect as $, useMemo as u, memo as m } from "react";
5
+ import { CheckIcon as p } from "../../icons/CheckIcon.js";
6
+ import { SearchIcon as C } from "../../icons/SearchIcon.js";
7
+ import { useAsheeConfig as g } from "../../libs/context.js";
8
+ import { resolveCascade as o, resolveRadiusKey as P } from "../../utils/resolve-token.js";
9
+ import { Button as tt } from "../button/Button.js";
10
+ import { Input as et } from "../input/Input.js";
11
+ import { FALLBACK_SELECT_MENU_CONFIG as c } from "./select-menu-config.js";
12
+ import { cn as lt } from "../../utils/cn.js";
13
+ const rt = m(function({
14
+ filteredOptions: y,
15
+ selectedValues: w,
16
+ onSelectMenuOption: I,
17
+ renderOption: b,
18
+ itemVariant: N,
19
+ itemColor: i,
20
+ activeItemVariant: S,
21
+ activeItemColor: V,
22
+ radius: s,
23
+ size: f
24
+ }) {
25
+ const k = (r) => w.includes(r);
26
+ return y.length === 0 ? /* @__PURE__ */ l("div", { className: "px-3 py-4 text-xs text-foreground/70 text-center", children: "No options found" }) : /* @__PURE__ */ l(J, { children: y.map((r) => {
27
+ const d = k(r.value);
28
+ return b ? b(r, d) : /* @__PURE__ */ Q(
29
+ tt,
30
+ {
31
+ variant: d ? S : N,
32
+ color: d ? V : i,
33
+ radius: s,
34
+ size: f,
35
+ isDisabled: r.disabled,
36
+ onClick: () => I(r),
37
+ className: "w-full justify-between font-normal text-left transition-colors truncate",
38
+ children: [
39
+ /* @__PURE__ */ l("span", { children: r.label }),
40
+ d && /* @__PURE__ */ l(p, { className: "w-3.5 h-3.5 shrink-0 ml-2" })
41
+ ]
42
+ },
43
+ String(r.value)
44
+ );
45
+ }) });
46
+ }), at = ({
47
+ isOpen: v,
48
+ context: y,
49
+ floatingStyles: w,
50
+ getFloatingProps: I,
51
+ setFloatingRef: b,
52
+ isPositioned: N = !0,
53
+ options: i = [],
54
+ selectedValues: S = [],
55
+ onSelectMenuOption: V,
56
+ isSearch: s = !0,
57
+ searchPlaceholder: f = "Search...",
58
+ searchInputName: k = "select-menu-search",
59
+ searchQuery: r,
60
+ onSearchChange: d,
61
+ belowList: z,
62
+ menuConfig: e,
30
63
  menuProps: t = {},
31
- renderOption: x,
32
- initialFocus: R,
33
- returnFocus: _
64
+ renderOption: T,
65
+ initialFocus: j,
66
+ returnFocus: K
34
67
  }) => {
35
- const c = p(), [B, D] = Y(""), i = K ?? B, G = (e) => {
36
- b ? b(e) : D(e);
37
- }, w = r(
68
+ const h = g(), [R, _] = Z(""), x = r ?? R, n = (a) => {
69
+ d ? d(a) : _(a);
70
+ }, F = o(
38
71
  t == null ? void 0 : t.lockScroll,
39
- l == null ? void 0 : l.lockScroll,
72
+ e == null ? void 0 : e.lockScroll,
40
73
  void 0,
41
- d.lockScroll
42
- ), O = r(
74
+ c.lockScroll
75
+ ), B = o(
43
76
  t == null ? void 0 : t.portal,
44
- l == null ? void 0 : l.portal,
77
+ e == null ? void 0 : e.portal,
45
78
  void 0,
46
- d.portal
47
- ), I = r(
79
+ c.portal
80
+ ), O = o(
48
81
  t == null ? void 0 : t.portalTarget,
49
- l == null ? void 0 : l.portalTarget,
82
+ e == null ? void 0 : e.portalTarget,
50
83
  void 0,
51
84
  typeof document < "u" ? document.body : null
52
85
  );
53
- Z(() => {
54
- if (!s || !w) return;
55
- const e = document.body.style.overflow, o = document.body.style.position, J = document.body.style.width;
86
+ $(() => {
87
+ if (!v || !F) return;
88
+ const a = document.body.style.overflow, q = document.body.style.position, H = document.body.style.width;
56
89
  return document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.width = "100%", () => {
57
- document.body.style.overflow = e, document.body.style.position = o, document.body.style.width = J;
90
+ document.body.style.overflow = a, document.body.style.position = q, document.body.style.width = H;
58
91
  };
59
- }, [s, w]);
60
- const N = $(() => !y || !i.trim() ? v : v.filter(
61
- (e) => e.label.toLowerCase().includes(i.toLowerCase())
62
- ), [v, y, i]), U = (e) => E.includes(e), W = r(
92
+ }, [v, F]);
93
+ const D = u(() => !s || !x.trim() ? i : i.filter(
94
+ (a) => a.label.toLowerCase().includes(x.toLowerCase())
95
+ ), [i, s, x]), G = o(
63
96
  t == null ? void 0 : t.itemVariant,
64
- l == null ? void 0 : l.itemVariant,
97
+ e == null ? void 0 : e.itemVariant,
65
98
  void 0,
66
- d.itemVariant
67
- ), S = r(
99
+ c.itemVariant
100
+ ), L = o(
68
101
  t == null ? void 0 : t.itemColor,
69
- l == null ? void 0 : l.itemColor,
70
- c.defaultColor,
71
- d.itemColor
72
- ), q = r(
102
+ e == null ? void 0 : e.itemColor,
103
+ h.defaultColor,
104
+ c.itemColor
105
+ ), U = o(
73
106
  t == null ? void 0 : t.activeItemVariant,
74
- l == null ? void 0 : l.activeItemVariant,
75
- c.defaultVariant,
76
- d.activeItemVariant
77
- ), H = r(
107
+ e == null ? void 0 : e.activeItemVariant,
108
+ h.defaultVariant,
109
+ c.activeItemVariant
110
+ ), W = o(
78
111
  t == null ? void 0 : t.activeItemColor,
79
- l == null ? void 0 : l.activeItemColor,
80
- c.defaultColor,
81
- d.activeItemColor
82
- ), f = C(
112
+ e == null ? void 0 : e.activeItemColor,
113
+ h.defaultColor,
114
+ c.activeItemColor
115
+ ), M = P(
83
116
  t == null ? void 0 : t.radius,
84
- l == null ? void 0 : l.radius,
85
- c.defaultRadius,
86
- d.radius
87
- ), k = r(
117
+ e == null ? void 0 : e.radius,
118
+ h.defaultRadius,
119
+ c.radius
120
+ ), A = o(
88
121
  t == null ? void 0 : t.size,
89
- l == null ? void 0 : l.size,
122
+ e == null ? void 0 : e.size,
90
123
  void 0,
91
- d.size
124
+ c.size
92
125
  );
93
- if (!s) return null;
94
- const z = /* @__PURE__ */ a(
126
+ if (!v) return null;
127
+ const E = /* @__PURE__ */ l(
95
128
  X,
96
129
  {
97
- context: A,
130
+ context: y,
98
131
  modal: !1,
99
- initialFocus: R,
100
- returnFocus: _,
101
- children: /* @__PURE__ */ V(
132
+ initialFocus: j,
133
+ returnFocus: K,
134
+ children: /* @__PURE__ */ Q(
102
135
  "div",
103
136
  {
104
- ref: M,
105
- style: { ...F },
106
- className: tt(
107
- "z-100 w-full outline-none max-h-60 shadow-xl bg-background border border-border p-1 flex flex-col gap-0.5 overflow-y-auto scrollable-hidden",
108
- "animate-in fade-in-0 zoom-in-95 slide-in-from-top-1 duration-150 ease-out",
137
+ ref: b,
138
+ style: { ...w },
139
+ className: lt(
140
+ "z-30 w-full outline-none max-h-60 shadow-xl bg-background border border-border p-1 flex flex-col gap-0.5 overflow-y-auto scrollable-hidden",
141
+ N ? "animate-in fade-in-0 zoom-in-95 slide-in-from-top-1 duration-150 ease-out" : "invisible opacity-0 pointer-events-none",
109
142
  t == null ? void 0 : t.className
110
143
  ),
111
- ...L(),
144
+ ...I(),
112
145
  children: [
113
- y && /* @__PURE__ */ a("div", { className: "w-full p-1 mb-1 sticky top-0 z-10 border-b border-border", children: /* @__PURE__ */ a(
114
- P,
146
+ s && /* @__PURE__ */ l("div", { className: "w-full p-1 mb-1 sticky top-0 z-10 border-b border-border", children: /* @__PURE__ */ l(
147
+ et,
115
148
  {
116
- name: j,
149
+ name: k,
117
150
  type: "text",
118
151
  variant: "bordered",
119
- radius: f,
120
- color: S,
121
- size: k,
122
- value: i,
123
- onChange: (e) => G(e.target.value),
124
- startContent: /* @__PURE__ */ a(m, { className: "w-3.5 h-3.5 text-foreground/70" }),
125
- placeholder: T,
152
+ radius: M,
153
+ color: L,
154
+ size: A,
155
+ value: x,
156
+ onChange: (a) => n(a.target.value),
157
+ startContent: /* @__PURE__ */ l(C, { className: "w-3.5 h-3.5 text-foreground/70" }),
158
+ placeholder: f,
126
159
  autoFocus: !0,
127
160
  className: "w-full pl-8 h-8 text-xs bg-secondary/30 border-none focus-visible:ring-0"
128
161
  }
129
162
  ) }),
130
- N.length === 0 ? /* @__PURE__ */ a("div", { className: "px-3 py-4 text-xs text-foreground/70 text-center", children: "No options found" }) : N.map((e) => {
131
- const o = U(e.value);
132
- return x ? x(e, o) : /* @__PURE__ */ V(
133
- g,
134
- {
135
- variant: o ? q : W,
136
- color: o ? H : S,
137
- radius: f,
138
- size: k,
139
- isDisabled: e.disabled,
140
- onClick: () => Q(e),
141
- className: "w-full justify-between font-normal text-left transition-colors truncate",
142
- children: [
143
- /* @__PURE__ */ a("span", { children: e.label }),
144
- o && /* @__PURE__ */ a(u, { className: "w-3.5 h-3.5 shrink-0 ml-2" })
145
- ]
146
- },
147
- String(e.value)
148
- );
149
- }),
150
- h && /* @__PURE__ */ a("div", { className: "border-t border-border pt-1 mt-1", children: h })
163
+ /* @__PURE__ */ l(
164
+ rt,
165
+ {
166
+ filteredOptions: D,
167
+ selectedValues: S,
168
+ onSelectMenuOption: V,
169
+ renderOption: T,
170
+ itemVariant: G,
171
+ itemColor: L,
172
+ activeItemVariant: U,
173
+ activeItemColor: W,
174
+ radius: M,
175
+ size: A
176
+ }
177
+ ),
178
+ z && /* @__PURE__ */ l("div", { className: "border-t border-border pt-1 mt-1", children: z })
151
179
  ]
152
180
  }
153
181
  )
154
182
  }
155
183
  );
156
- return O && I ? n(z, I) : z;
184
+ return B ? /* @__PURE__ */ l(Y, { root: O, children: E }) : E;
157
185
  };
158
- lt.displayName = "SelectMenu";
186
+ at.displayName = "SelectMenu";
159
187
  export {
160
- lt as SelectMenu
188
+ at as SelectMenu
161
189
  };
@@ -56,7 +56,9 @@ export interface UseSelectFloatingProps {
56
56
  * This hook configures Floating UI with sensible defaults for dropdown
57
57
  * components. It handles automatic position updates, viewport edge detection
58
58
  * via flip and shift middleware, and optional width matching of the
59
- * reference element.
59
+ * reference element. Positioning uses `strategy: "fixed"` with Floating
60
+ * UI's event-driven `autoUpdate` tracking so portaled menus stay aligned
61
+ * while the page scrolls without paying per-frame re-render cost.
60
62
  *
61
63
  * @param props - Configuration options for the floating element.
62
64
  * @param props.isOpen - Whether the floating element is open.
@@ -66,7 +68,8 @@ export interface UseSelectFloatingProps {
66
68
  * @param props.offsetDistance - Distance from reference in pixels. Defaults to 4.
67
69
  * @param props.padding - Viewport padding for shift middleware. Defaults to 8.
68
70
  * @param props.matchReferenceWidth - Whether to match reference width. Defaults to true.
69
- * @returns The Floating UI context including refs, styles, and middleware.
71
+ * @returns The Floating UI context including refs, styles, middleware, and
72
+ * the `isPositioned` flag for gating initial-render visibility.
70
73
  *
71
74
  * @example
72
75
  * ```tsx
@@ -1 +1 @@
1
- {"version":3,"file":"use-select-floating.d.ts","sourceRoot":"","sources":["../../../src/components/select-menu/use-select-floating.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAKL,KAAK,SAAS,EAEd,KAAK,iBAAiB,EAEvB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEtC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,EACrE,MAAM,EACN,YAAY,EACZ,QAAgB,EAChB,SAA0B,EAC1B,cAAkB,EAClB,OAAW,EACX,mBAA0B,GAC3B,EAAE,sBAAsB,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAsB/C"}
1
+ {"version":3,"file":"use-select-floating.d.ts","sourceRoot":"","sources":["../../../src/components/select-menu/use-select-floating.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAKL,KAAK,SAAS,EAEd,KAAK,iBAAiB,EAEvB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEtC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,EACrE,MAAM,EACN,YAAY,EACZ,QAAgB,EAChB,SAA0B,EAC1B,cAAkB,EAClB,OAAW,EACX,mBAA0B,GAC3B,EAAE,sBAAsB,GAAG,iBAAiB,CAAC,CAAC,CAAC,CA6B/C"}