asheeui 0.6.5 → 0.6.7

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 (64) hide show
  1. package/dist/components/accordion/Accordion.js +10 -10
  2. package/dist/components/autocomplete/Autocomplete.d.ts +8 -0
  3. package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
  4. package/dist/components/autocomplete/Autocomplete.js +120 -118
  5. package/dist/components/autocomplete/autocomplete-config.d.ts +27 -1
  6. package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
  7. package/dist/components/autocomplete/autocomplete-config.js +14 -6
  8. package/dist/components/date-picker/DatePicker.d.ts +20 -0
  9. package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
  10. package/dist/components/date-picker/DatePicker.js +230 -229
  11. package/dist/components/date-picker/date-picker-config.d.ts +16 -0
  12. package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
  13. package/dist/components/date-picker/date-picker-config.js +14 -10
  14. package/dist/components/keyboard/OnScreenKeyboard.d.ts +16 -6
  15. package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
  16. package/dist/components/keyboard/OnScreenKeyboard.js +96 -90
  17. package/dist/components/keyboard/index.js +1 -0
  18. package/dist/components/keyboard/keyboard-config.d.ts +27 -1
  19. package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
  20. package/dist/components/keyboard/keyboard-config.js +12 -8
  21. package/dist/components/keyboard/keyboard-context.d.ts +4 -7
  22. package/dist/components/keyboard/keyboard-context.d.ts.map +1 -1
  23. package/dist/components/keyboard/keyboard-context.js +61 -58
  24. package/dist/components/keyboard/keyboard-styles.d.ts +13 -0
  25. package/dist/components/keyboard/keyboard-styles.d.ts.map +1 -0
  26. package/dist/components/keyboard/keyboard-styles.js +14 -0
  27. package/dist/components/multi-select/MultiSelect.d.ts +8 -0
  28. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  29. package/dist/components/multi-select/MultiSelect.js +186 -184
  30. package/dist/components/multi-select/multi-select-config.d.ts +18 -0
  31. package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
  32. package/dist/components/multi-select/multi-select-config.js +14 -10
  33. package/dist/components/resizable-screen/ResizableScreen.d.ts +23 -11
  34. package/dist/components/resizable-screen/ResizableScreen.d.ts.map +1 -1
  35. package/dist/components/resizable-screen/ResizableScreen.js +69 -60
  36. package/dist/components/select/Select.d.ts +8 -6
  37. package/dist/components/select/Select.d.ts.map +1 -1
  38. package/dist/components/select/Select.js +135 -135
  39. package/dist/components/select/select-config.d.ts +27 -1
  40. package/dist/components/select/select-config.d.ts.map +1 -1
  41. package/dist/components/select/select-config.js +14 -6
  42. package/dist/components/select-menu/SelectMenu.d.ts +23 -1
  43. package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
  44. package/dist/components/select-menu/SelectMenu.js +72 -67
  45. package/dist/components/select-menu/index.d.ts +1 -0
  46. package/dist/components/select-menu/index.d.ts.map +1 -1
  47. package/dist/components/select-menu/index.js +1 -0
  48. package/dist/components/select-menu/select-menu-config.d.ts +1 -1
  49. package/dist/components/select-menu/select-menu-config.js +3 -3
  50. package/dist/components/select-menu/use-select-floating.d.ts +95 -0
  51. package/dist/components/select-menu/use-select-floating.d.ts.map +1 -0
  52. package/dist/components/select-menu/use-select-floating.js +36 -0
  53. package/dist/components/toast/toast-config.d.ts +11 -0
  54. package/dist/components/toast/toast-config.d.ts.map +1 -1
  55. package/dist/components/toast/toast-config.js +4 -2
  56. package/dist/components/toast/toast-context.d.ts +21 -1
  57. package/dist/components/toast/toast-context.d.ts.map +1 -1
  58. package/dist/components/toast/toast-context.js +134 -114
  59. package/dist/config/resolve-config.d.ts.map +1 -1
  60. package/dist/utils/merge-object.d.ts +7 -1
  61. package/dist/utils/merge-object.d.ts.map +1 -1
  62. package/dist/utils/types.d.ts +16 -4
  63. package/dist/utils/types.d.ts.map +1 -1
  64. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  "use client";
2
- import { jsxs as W, jsx as v } from "react/jsx-runtime";
3
- import { forwardRef as C, useState as k, useRef as ee, useCallback as A } from "react";
4
- import { useAsheeConfig as te } from "../../libs/context.js";
5
- import { resolveCascade as o } from "../../utils/resolve-token.js";
2
+ import { jsxs as ee, jsx as v } from "react/jsx-runtime";
3
+ import { forwardRef as te, useState as H, useRef as re, useCallback as k } from "react";
4
+ import { useAsheeConfig as oe } from "../../libs/context.js";
5
+ import { resolveCascade as n } from "../../utils/resolve-token.js";
6
6
  import { FALLBACK_RESIZABLE_SCREEN_CONFIG as l } from "./resizable-screen-config.js";
7
7
  import { cn as c } from "../../utils/cn.js";
8
- const re = C(
8
+ const ie = te(
9
9
  ({
10
- children: H,
10
+ children: A,
11
11
  left: I,
12
12
  size: w,
13
13
  defaultSize: M,
@@ -15,106 +15,114 @@ const re = C(
15
15
  maxSize: E,
16
16
  step: K,
17
17
  orientation: L,
18
- hideHandle: j,
19
- onSizeChange: u,
20
- handleClassName: x,
21
- className: B,
22
- style: U,
23
- ..._
24
- }, d) => {
18
+ hideHandle: $,
19
+ onSizeChange: d,
20
+ handleClassName: S,
21
+ minContainerHeight: j = 200,
22
+ minContainerWidth: B = 200,
23
+ className: U,
24
+ style: _,
25
+ ...F
26
+ }, u) => {
25
27
  var R;
26
- const t = (R = te().components) == null ? void 0 : R.resizableScreen, h = o(
28
+ const t = (R = oe().components) == null ? void 0 : R.resizableScreen, h = n(
27
29
  N,
28
30
  t == null ? void 0 : t.minSize,
29
31
  void 0,
30
32
  l.minSize
31
- ), f = o(
33
+ ), f = n(
32
34
  E,
33
35
  t == null ? void 0 : t.maxSize,
34
36
  void 0,
35
37
  l.maxSize
36
- ), D = o(
38
+ ), D = n(
37
39
  K,
38
40
  t == null ? void 0 : t.step,
39
41
  void 0,
40
42
  l.step
41
- ), z = o(
43
+ ), z = n(
42
44
  L,
43
45
  t == null ? void 0 : t.orientation,
44
46
  void 0,
45
47
  l.orientation
46
- ), F = o(
47
- j,
48
+ ), G = n(
49
+ $,
48
50
  t == null ? void 0 : t.hideHandle,
49
51
  void 0,
50
52
  l.hideHandle
51
- ), O = o(
53
+ ), O = n(
52
54
  M,
53
55
  t == null ? void 0 : t.defaultSize,
54
56
  void 0,
55
57
  l.defaultSize
56
- ), T = w ?? I ?? O, [$, G] = k(T), [i, b] = k(!1), y = ee(null), S = w !== void 0, a = S ? w : $, g = A(
58
+ ), T = w ?? I ?? O, [W, X] = H(T), [o, b] = H(!1), x = re(null), y = w !== void 0, a = y ? w : W, g = k(
57
59
  (e) => Math.min(Math.max(e, h), f),
58
60
  [h, f]
59
- ), s = A(
61
+ ), s = k(
60
62
  (e) => {
61
63
  const r = g(e);
62
- S || G(r), u == null || u(r);
64
+ y || X(r), d == null || d(r);
63
65
  },
64
- [g, S, u]
65
- ), X = (e) => {
66
+ [g, y, d]
67
+ ), Y = (e) => {
66
68
  e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), b(!0);
67
- }, Y = (e) => {
68
- if (!i || !y.current) return;
69
- const r = y.current.getBoundingClientRect(), m = z === "horizontal", p = m ? r.width : r.height, Q = m ? e.clientX - r.left : e.clientY - r.top;
69
+ }, Z = (e) => {
70
+ if (!o || !x.current) return;
71
+ const r = x.current.getBoundingClientRect(), m = z === "horizontal", p = m ? r.width : r.height, V = m ? e.clientX - r.left : e.clientY - r.top;
70
72
  if (p > 0) {
71
- const V = Q / p * 100;
72
- s(V);
73
+ const C = V / p * 100;
74
+ s(C);
73
75
  }
74
76
  }, P = (e) => {
75
- if (i) {
77
+ if (o) {
76
78
  try {
77
79
  e.currentTarget.releasePointerCapture(e.pointerId);
78
80
  } catch {
79
81
  }
80
82
  b(!1);
81
83
  }
82
- }, Z = (e) => {
84
+ }, q = (e) => {
83
85
  const r = z === "horizontal", m = r ? "ArrowLeft" : "ArrowUp", p = r ? "ArrowRight" : "ArrowDown";
84
86
  e.key === m ? (e.preventDefault(), s(a - D)) : e.key === p ? (e.preventDefault(), s(a + D)) : e.key === "Home" ? (e.preventDefault(), s(h)) : e.key === "End" && (e.preventDefault(), s(f));
85
- }, [q, J] = H, n = z === "horizontal";
86
- return /* @__PURE__ */ W(
87
+ }, [J, Q] = A, i = z === "horizontal";
88
+ return /* @__PURE__ */ ee(
87
89
  "div",
88
90
  {
89
91
  ref: (e) => {
90
- y.current = e, typeof d == "function" ? d(e) : d && (d.current = e);
92
+ x.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
91
93
  },
92
94
  className: c(
93
- "w-full h-full min-h-50 min-w-0 relative flex",
94
- i && "select-none",
95
- n ? "flex-row" : "flex-col",
96
- B
95
+ "flex relative",
96
+ o && "select-none",
97
+ i ? "flex-row" : "flex-col",
98
+ U
97
99
  ),
98
100
  style: {
99
- cursor: i ? n ? "col-resize" : "row-resize" : "default",
100
- ...U
101
+ cursor: o ? i ? "col-resize" : "row-resize" : "default",
102
+ // Ensure sensible minimums so the component works even when no
103
+ // ancestor provides a definite size. These are fallbacks only.
104
+ minHeight: `${j}px`,
105
+ minWidth: `${B}px`,
106
+ ..._
101
107
  },
102
- ..._,
108
+ ...F,
103
109
  children: [
104
110
  /* @__PURE__ */ v(
105
111
  "div",
106
112
  {
107
113
  className: c(
108
- "h-full w-full min-w-0 min-h-0 overflow-clip shrink-0",
109
- i ? "transition-none" : "transition-[width,height] duration-150 ease-out"
114
+ "min-w-0 min-h-0 overflow-auto",
115
+ o ? "transition-none" : "transition-[width,height] duration-150 ease-out"
110
116
  ),
111
117
  style: {
112
- [n ? "width" : "height"]: `${a}%`
118
+ [i ? "width" : "height"]: `${a}%`,
119
+ flexShrink: 0,
120
+ flexGrow: 0
113
121
  },
114
- children: q
122
+ children: J
115
123
  }
116
124
  ),
117
- !F && // biome-ignore lint/a11y/useSemanticElements: interactive resizable handle requires div styling
125
+ !G && // biome-ignore lint/a11y/useSemanticElements: interactive resizable handle requires div styling
118
126
  /* @__PURE__ */ v(
119
127
  "div",
120
128
  {
@@ -123,24 +131,24 @@ const re = C(
123
131
  "aria-valuenow": Math.round(a),
124
132
  "aria-valuemin": h,
125
133
  "aria-valuemax": f,
126
- "aria-orientation": n ? "horizontal" : "vertical",
134
+ "aria-orientation": i ? "horizontal" : "vertical",
127
135
  "aria-label": "Resize panel split",
128
- onPointerDown: X,
129
- onPointerMove: Y,
136
+ onPointerDown: Y,
137
+ onPointerMove: Z,
130
138
  onPointerUp: P,
131
139
  onPointerCancel: P,
132
- onKeyDown: Z,
140
+ onKeyDown: q,
133
141
  className: c(
134
142
  "relative z-20 shrink-0 flex items-center justify-center outline-none select-none group touch-none",
135
- n ? "w-4 h-full cursor-col-resize -mx-2" : "h-4 w-full cursor-row-resize -my-2"
143
+ i ? "w-4 self-stretch cursor-col-resize -mx-2" : "h-4 self-stretch w-full cursor-row-resize -my-2"
136
144
  ),
137
145
  children: /* @__PURE__ */ v(
138
146
  "div",
139
147
  {
140
148
  className: c(
141
149
  "transition-colors duration-150",
142
- n ? "w-1 h-full" : "h-1 w-full",
143
- x || (i ? "bg-primary" : "bg-border group-hover:bg-primary/70 group-focus-visible:bg-primary")
150
+ i ? "w-1 self-stretch" : "h-1 self-stretch w-full",
151
+ S || (o ? "bg-primary" : "bg-border group-hover:bg-primary/70 group-focus-visible:bg-primary")
144
152
  )
145
153
  }
146
154
  )
@@ -150,13 +158,14 @@ const re = C(
150
158
  "div",
151
159
  {
152
160
  className: c(
153
- "h-full w-full min-w-0 min-h-0 overflow-clip shrink-0 flex-1",
154
- i ? "transition-none" : "transition-[width,height] duration-150 ease-out"
161
+ "min-w-0 min-h-0 overflow-auto",
162
+ o ? "transition-none" : "transition-[width,height] duration-150 ease-out"
155
163
  ),
156
164
  style: {
157
- [n ? "width" : "height"]: `${100 - a}%`
165
+ [i ? "width" : "height"]: `${100 - a}%`,
166
+ flex: 1
158
167
  },
159
- children: J
168
+ children: Q
160
169
  }
161
170
  )
162
171
  ]
@@ -164,7 +173,7 @@ const re = C(
164
173
  );
165
174
  }
166
175
  );
167
- re.displayName = "ResizableScreen";
176
+ ie.displayName = "ResizableScreen";
168
177
  export {
169
- re as ResizableScreen
178
+ ie as ResizableScreen
170
179
  };
@@ -75,11 +75,6 @@ export interface SelectProps extends BaseSelectProps {
75
75
  * @default "Select..."
76
76
  */
77
77
  placeholder?: string;
78
- /**
79
- * Custom background color for the trigger button.
80
- * Accepts any CSS color value.
81
- */
82
- buttonColor?: string;
83
78
  /**
84
79
  * Extra CSS classes for the trigger button.
85
80
  */
@@ -108,6 +103,12 @@ export interface SelectProps extends BaseSelectProps {
108
103
  * The component uses Floating UI for positioning and accessibility, and
109
104
  * integrates with the FieldShell for consistent label and validation handling.
110
105
  *
106
+ * By default, the dropdown menu uses React's createPortal to render at the
107
+ * document body level. This ensures the menu escapes CSS containment, overflow
108
+ * clipping, and stacking context issues. The portal can be disabled via the
109
+ * `portal` prop or `components.select.portal` in the config if the menu needs
110
+ * to stay within a specific parent container.
111
+ *
111
112
  * @param props - Select configuration options.
112
113
  * @param props.options - Available options to select from.
113
114
  * @param props.value - Controlled selected value.
@@ -124,13 +125,14 @@ export interface SelectProps extends BaseSelectProps {
124
125
  * @param props.initialValue - Initial value for uncontrolled usage.
125
126
  * @param props.belowList - Content below the options list.
126
127
  * @param props.placeholder - Placeholder text. Defaults to "Select...".
127
- * @param props.buttonColor - Custom background color for the trigger.
128
128
  * @param props.size - Size of the trigger. Defaults to "md".
129
129
  * @param props.radius - Corner rounding. Defaults to "md".
130
130
  * @param props.variant - Visual style variant. Defaults to "bordered".
131
131
  * @param props.color - Theme accent color. Defaults to "primary".
132
132
  * @param props.status - Validation status.
133
133
  * @param props.labelAlign - Alignment of the label. Defaults to "left".
134
+ * @param props.portal - Whether to render the dropdown in a portal. Defaults to true.
135
+ * @param props.portalTarget - Custom portal target element. Defaults to document.body.
134
136
  *
135
137
  * @example
136
138
  * ```tsx
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/select/Select.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAEL,KAAK,SAAS,EA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,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;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,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,eAAO,MAAM,MAAM,2GAsPlB,CAAC"}
@@ -1,171 +1,169 @@
1
1
  "use client";
2
- import { jsx as f, jsxs as w } from "react/jsx-runtime";
3
- import { useFloating as Se, autoUpdate as ve, offset as be, flip as ye, shift as xe, size as ge, useClick as he, useDismiss as Ae, useRole as Re, useInteractions as Le } from "@floating-ui/react";
4
- import { forwardRef as Ee, useId as Ie, useState as _, useMemo as y, useCallback as we } from "react";
5
- import { ChevronDownIcon as _e } from "../../icons/ChevronDownIcon.js";
6
- import { useAsheeConfig as Fe } from "../../libs/context.js";
7
- import { resolveCascade as m, resolveRadiusKey as Ke, resolveClassKey as Oe } from "../../utils/resolve-token.js";
8
- import { FieldShell as ke } from "../field/FieldShell.js";
9
- import { SelectMenu as Ce } from "../select-menu/SelectMenu.js";
10
- import { FALLBACK_SELECT_CONFIG as s } from "./select-config.js";
11
- import { SELECT_STATUS_BORDER_CLASS as Ne, SELECT_SIZE_CLASS as ze } from "./select-styles.js";
12
- import { resolveVariantClass as Te } from "../../shared/variant.js";
13
- import { RADIUS_CLASS as je } from "../../shared/radius.js";
14
- import { cn as F } from "../../utils/cn.js";
15
- const De = Ee(
2
+ import { jsx as f, jsxs as T } from "react/jsx-runtime";
3
+ import { useClick as ye, useDismiss as xe, useRole as Ae, useInteractions as Re } from "@floating-ui/react";
4
+ import { forwardRef as ge, useId as he, useState as I, useMemo as b, useCallback as Le } from "react";
5
+ import { ChevronDownIcon as Te } from "../../icons/ChevronDownIcon.js";
6
+ import { useAsheeConfig as Ie } from "../../libs/context.js";
7
+ import { resolveCascade as l, resolveRadiusKey as Ee, resolveClassKey as _e } from "../../utils/resolve-token.js";
8
+ import { FieldShell as Fe } from "../field/FieldShell.js";
9
+ import { SelectMenu as Ke } from "../select-menu/SelectMenu.js";
10
+ import { FALLBACK_SELECT_CONFIG as t } from "./select-config.js";
11
+ import { SELECT_STATUS_BORDER_CLASS as ke, SELECT_SIZE_CLASS as we } from "./select-styles.js";
12
+ import { resolveVariantClass as Ne } from "../../shared/variant.js";
13
+ import { RADIUS_CLASS as Oe } from "../../shared/radius.js";
14
+ import { useSelectFloating as Pe } from "../select-menu/use-select-floating.js";
15
+ import { cn as E } from "../../utils/cn.js";
16
+ const De = ge(
16
17
  ({
17
18
  options: p = [],
18
- value: r,
19
+ value: s,
19
20
  onChange: S,
20
- onValueChange: l,
21
- size: K,
22
- radius: O,
23
- variant: k,
24
- color: C,
25
- status: N,
26
- label: z,
27
- labelAlign: T,
28
- description: j,
21
+ onValueChange: a,
22
+ size: _,
23
+ radius: F,
24
+ variant: K,
25
+ color: k,
26
+ status: w,
27
+ label: N,
28
+ labelAlign: O,
29
+ description: P,
29
30
  message: D,
30
- required: M,
31
- isLoading: P,
31
+ required: j,
32
+ isLoading: z,
32
33
  disabled: v,
33
- isSearch: U = !1,
34
+ isSearch: C = !1,
34
35
  searchPlaceholder: B = "Search options...",
35
- searchInputName: Q = "select-search",
36
+ searchInputName: M = "select-search",
36
37
  initialValue: n,
37
- belowList: $,
38
- placeholder: x = "Select...",
39
- buttonColor: g,
40
- className: G,
41
- dropdownClassName: H,
38
+ belowList: Q,
39
+ placeholder: y = "Select...",
40
+ className: U,
41
+ dropdownClassName: G,
42
42
  id: Z,
43
- name: h,
43
+ name: x,
44
44
  menu: q,
45
- style: J
46
- }, a) => {
47
- var I;
48
- const i = Fe(), e = (I = i.components) == null ? void 0 : I.select, W = Ie(), X = Z ?? W, [c, A] = _(!1), [Y, R] = _(""), { refs: L, floatingStyles: V, context: d } = Se({
49
- open: c,
50
- onOpenChange: (t) => !v && A(t),
51
- placement: "bottom-start",
52
- whileElementsMounted: ve,
53
- middleware: [
54
- be(4),
55
- ye(),
56
- xe({ padding: 8 }),
57
- ge({
58
- apply({ availableHeight: t, elements: b }) {
59
- Object.assign(b.floating.style, {
60
- maxHeight: `${t}px`
61
- });
62
- }
63
- })
64
- ]
65
- }), ee = he(d, { enabled: !v }), te = Ae(d), se = Re(d, { role: "listbox" }), { getReferenceProps: re, getFloatingProps: oe } = Le([
66
- ee,
67
- te,
68
- se
69
- ]), le = m(
70
- K,
45
+ portal: H,
46
+ portalTarget: J,
47
+ style: W
48
+ }, i) => {
49
+ var L;
50
+ const c = Ie(), e = (L = c.components) == null ? void 0 : L.select, X = he(), Y = Z ?? X, [d, A] = I(!1), [$, R] = I(""), V = l(
51
+ _,
71
52
  e == null ? void 0 : e.size,
72
53
  void 0,
73
- s.size
74
- ), E = m(
75
- k,
54
+ t.size
55
+ ), g = l(
56
+ K,
76
57
  e == null ? void 0 : e.variant,
77
- i.defaultVariant,
78
- s.variant
79
- ), ne = m(
80
- C,
58
+ c.defaultVariant,
59
+ t.variant
60
+ ), ee = l(
61
+ k,
81
62
  e == null ? void 0 : e.color,
82
- i.defaultColor,
83
- s.color
84
- ), ae = Ke(
85
- O,
63
+ c.defaultColor,
64
+ t.color
65
+ ), te = Ee(
66
+ F,
86
67
  e == null ? void 0 : e.radius,
87
- i.defaultRadius,
88
- s.radius
89
- ), u = N ?? s.status, ie = m(
90
- T,
68
+ c.defaultRadius,
69
+ t.radius
70
+ ), u = w ?? t.status, re = l(
71
+ O,
91
72
  e == null ? void 0 : e.labelAlign,
92
73
  void 0,
93
- s.labelAlign
94
- ), ce = Te(
95
- E,
96
- ne
97
- ), de = u !== "default" ? Ne[u] : "", ue = E === "underlined" ? "rounded-none" : Oe(
98
- ae,
99
- je,
100
- s.radius
101
- ), o = y(
102
- () => p.find((t) => t.value === r),
103
- [p, r]
104
- ), fe = we(
105
- (t) => {
106
- if (l == null || l(t.value), S) {
107
- const b = {
108
- target: { value: t.value, name: h ?? "" }
74
+ t.labelAlign
75
+ ), se = l(
76
+ H,
77
+ e == null ? void 0 : e.portal,
78
+ void 0,
79
+ t.portal
80
+ ), oe = l(
81
+ J,
82
+ e == null ? void 0 : e.portalTarget,
83
+ void 0,
84
+ t.portalTarget
85
+ ), le = Ne(
86
+ g,
87
+ ee
88
+ ), ae = u !== "default" ? ke[u] : "", ne = g === "underlined" ? "rounded-none" : _e(
89
+ te,
90
+ Oe,
91
+ t.radius
92
+ ), o = b(
93
+ () => p.find((r) => r.value === s),
94
+ [p, s]
95
+ ), { refs: h, floatingStyles: ie, context: m } = Pe({
96
+ isOpen: d,
97
+ onOpenChange: A,
98
+ disabled: v
99
+ }), ce = ye(m, { enabled: !v }), de = xe(m), ue = Ae(m, { role: "listbox" }), { getReferenceProps: me, getFloatingProps: fe } = Re([
100
+ ce,
101
+ de,
102
+ ue
103
+ ]), pe = Le(
104
+ (r) => {
105
+ if (a == null || a(r.value), S) {
106
+ const be = {
107
+ target: { value: r.value, name: x ?? "" }
109
108
  };
110
- S(b);
109
+ S(be);
111
110
  }
112
111
  A(!1), R("");
113
112
  },
114
- [h, S, l]
115
- ), me = y(() => o != null && o.label ? o.label : n !== void 0 ? String(n) : x, [o, n, x]), pe = y(
116
- () => r != null ? [r] : [],
117
- [r]
113
+ [x, S, a]
114
+ ), Se = b(() => o != null && o.label ? o.label : n !== void 0 ? String(n) : y, [o, n, y]), ve = b(
115
+ () => s != null ? [s] : [],
116
+ [s]
118
117
  );
119
118
  return /* @__PURE__ */ f(
120
- ke,
119
+ Fe,
121
120
  {
122
- id: X,
123
- label: z,
124
- labelAlign: ie,
125
- description: j,
121
+ id: Y,
122
+ label: N,
123
+ labelAlign: re,
124
+ description: P,
126
125
  message: D,
127
126
  status: u,
128
- required: M,
129
- isLoading: P,
130
- children: /* @__PURE__ */ w("div", { className: "w-full relative inline-block", children: [
131
- /* @__PURE__ */ w(
127
+ required: j,
128
+ isLoading: z,
129
+ children: /* @__PURE__ */ T("div", { className: "w-full relative inline-block", children: [
130
+ /* @__PURE__ */ T(
132
131
  "button",
133
132
  {
134
- ref: (t) => {
135
- L.setReference(t), typeof a == "function" ? a(t) : a && (a.current = t);
133
+ ref: (r) => {
134
+ h.setReference(r), typeof i == "function" ? i(r) : i && (i.current = r);
136
135
  },
137
136
  type: "button",
138
137
  disabled: v,
139
- "aria-expanded": c,
138
+ "aria-expanded": d,
140
139
  "aria-haspopup": "listbox",
141
140
  "aria-invalid": u === "error",
142
- className: F(
141
+ className: E(
143
142
  "w-full flex items-center justify-between font-normal text-left text-foreground transition-colors outline-none select-none cursor-pointer shrink-0",
144
143
  "focus-visible:ring-2 focus-visible:ring-offset-2",
145
144
  "disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed",
146
- ze[le],
147
- ce,
148
- de,
149
- ue,
150
- g && `bg-[${g}]`,
151
- G
145
+ we[V],
146
+ le,
147
+ ae,
148
+ ne,
149
+ U
152
150
  ),
153
- style: J,
154
- ...re(),
151
+ style: W,
152
+ ...me(),
155
153
  children: [
156
154
  /* @__PURE__ */ f(
157
155
  "span",
158
156
  {
159
157
  className: o || n ? "text-foreground" : "text-foreground/70",
160
- children: me
158
+ children: Se
161
159
  }
162
160
  ),
163
161
  /* @__PURE__ */ f(
164
- _e,
162
+ Te,
165
163
  {
166
- className: F(
164
+ className: E(
167
165
  "ml-2 shrink-0 text-foreground/70 transition-transform duration-200",
168
- c && "rotate-180"
166
+ d && "rotate-180"
169
167
  )
170
168
  }
171
169
  )
@@ -173,25 +171,27 @@ const De = Ee(
173
171
  }
174
172
  ),
175
173
  /* @__PURE__ */ f(
176
- Ce,
174
+ Ke,
177
175
  {
178
- isOpen: c,
179
- context: d,
180
- floatingStyles: V,
181
- getFloatingProps: oe,
182
- setFloatingRef: L.setFloating,
176
+ isOpen: d,
177
+ context: m,
178
+ floatingStyles: ie,
179
+ getFloatingProps: fe,
180
+ setFloatingRef: h.setFloating,
183
181
  options: p,
184
- selectedValues: pe,
185
- onSelectOption: fe,
186
- isSearch: U,
182
+ selectedValues: ve,
183
+ onSelectOption: pe,
184
+ isSearch: C,
187
185
  searchPlaceholder: B,
188
- searchInputName: Q,
189
- searchQuery: Y,
186
+ searchInputName: M,
187
+ searchQuery: $,
190
188
  onSearchChange: R,
191
- belowList: $,
192
- dropdownClassName: H,
189
+ belowList: Q,
190
+ dropdownClassName: G,
193
191
  menuProps: q,
194
- menuConfig: e
192
+ menuConfig: e,
193
+ portal: se,
194
+ portalTarget: oe
195
195
  }
196
196
  )
197
197
  ] })
@@ -13,6 +13,22 @@ export interface SelectConfig extends FieldConfig {
13
13
  * Controls the menu's visual appearance and behavior.
14
14
  */
15
15
  menu?: SelectMenuConfig;
16
+ /**
17
+ * Whether to render the dropdown menu in a React portal.
18
+ * When true, the menu is rendered at the document body level,
19
+ * escaping any parent DOM hierarchy. This prevents CSS containment
20
+ * and stacking context issues. Defaults to true because dropdowns
21
+ * should always appear above other content.
22
+ *
23
+ * @default true
24
+ */
25
+ portal?: boolean;
26
+ /**
27
+ * Custom portal target element for the dropdown menu.
28
+ * When portal is enabled, the menu is rendered into this element.
29
+ * Defaults to document.body.
30
+ */
31
+ portalTarget?: HTMLElement | null;
16
32
  }
17
33
  /**
18
34
  * Default config values registered for the Select component.
@@ -25,7 +41,17 @@ export declare const defaultSelectConfig: SelectConfig;
25
41
  * These values are used when instance props, component config,
26
42
  * and global defaults are all undefined.
27
43
  */
28
- export declare const FALLBACK_SELECT_CONFIG: Required<FieldConfig>;
44
+ export declare const FALLBACK_SELECT_CONFIG: {
45
+ readonly portal: true;
46
+ readonly portalTarget: null;
47
+ readonly size: import('../field').FieldSizeKey;
48
+ readonly radius: import('../..').Radius;
49
+ readonly variant: import('../..').Variant;
50
+ readonly color: import('../..').Color;
51
+ readonly labelAlign: import('../field').LabelAlign;
52
+ readonly fullWidth: boolean;
53
+ readonly status: import('../field').FieldStatus;
54
+ };
29
55
  declare module "../../libs/registry" {
30
56
  interface ComponentTypeConfigRegistry {
31
57
  select: SelectConfig;