asheeui 0.6.3 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/Accordion.js +10 -10
- package/dist/components/autocomplete/Autocomplete.d.ts +8 -0
- package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/Autocomplete.js +120 -118
- package/dist/components/autocomplete/autocomplete-config.d.ts +29 -3
- package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-config.js +14 -6
- package/dist/components/date-picker/DatePicker.d.ts +20 -0
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +230 -229
- package/dist/components/date-picker/date-picker-config.d.ts +16 -0
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +14 -10
- package/dist/components/keyboard/OnScreenKeyboard.d.ts +16 -6
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +96 -90
- package/dist/components/keyboard/index.js +1 -0
- package/dist/components/keyboard/keyboard-config.d.ts +27 -1
- package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
- package/dist/components/keyboard/keyboard-config.js +12 -8
- package/dist/components/keyboard/keyboard-context.d.ts +4 -7
- package/dist/components/keyboard/keyboard-context.d.ts.map +1 -1
- package/dist/components/keyboard/keyboard-context.js +61 -58
- package/dist/components/keyboard/keyboard-styles.d.ts +13 -0
- package/dist/components/keyboard/keyboard-styles.d.ts.map +1 -0
- package/dist/components/keyboard/keyboard-styles.js +14 -0
- package/dist/components/multi-select/MultiSelect.d.ts +8 -0
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +186 -184
- package/dist/components/multi-select/multi-select-config.d.ts +18 -0
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +14 -10
- package/dist/components/resizable-screen/ResizableScreen.d.ts +23 -11
- package/dist/components/resizable-screen/ResizableScreen.d.ts.map +1 -1
- package/dist/components/resizable-screen/ResizableScreen.js +69 -60
- package/dist/components/select/Select.d.ts +8 -6
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +135 -135
- package/dist/components/select/select-config.d.ts +27 -1
- package/dist/components/select/select-config.d.ts.map +1 -1
- package/dist/components/select/select-config.js +14 -6
- package/dist/components/select-menu/SelectMenu.d.ts +23 -1
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +72 -67
- package/dist/components/select-menu/index.d.ts +1 -0
- package/dist/components/select-menu/index.d.ts.map +1 -1
- package/dist/components/select-menu/index.js +1 -0
- package/dist/components/select-menu/select-menu-config.d.ts +1 -1
- package/dist/components/select-menu/select-menu-config.js +3 -3
- package/dist/components/select-menu/use-select-floating.d.ts +95 -0
- package/dist/components/select-menu/use-select-floating.d.ts.map +1 -0
- package/dist/components/select-menu/use-select-floating.js +36 -0
- package/dist/components/toast/toast-config.d.ts +11 -0
- package/dist/components/toast/toast-config.d.ts.map +1 -1
- package/dist/components/toast/toast-config.js +4 -2
- package/dist/components/toast/toast-context.d.ts +21 -1
- package/dist/components/toast/toast-context.d.ts.map +1 -1
- package/dist/components/toast/toast-context.js +134 -114
- package/dist/components/tooltip/Tooltip.d.ts +19 -0
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +129 -121
- package/dist/components/tooltip/tooltip-config.d.ts +7 -3
- package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip-config.js +5 -4
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/utils/merge-object.d.ts +7 -1
- package/dist/utils/merge-object.d.ts.map +1 -1
- package/dist/utils/types.d.ts +16 -4
- package/dist/utils/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useAsheeConfig as
|
|
5
|
-
import { resolveCascade as
|
|
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
|
|
8
|
+
const ie = te(
|
|
9
9
|
({
|
|
10
|
-
children:
|
|
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:
|
|
19
|
-
onSizeChange:
|
|
20
|
-
handleClassName:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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 =
|
|
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 =
|
|
33
|
+
), f = n(
|
|
32
34
|
E,
|
|
33
35
|
t == null ? void 0 : t.maxSize,
|
|
34
36
|
void 0,
|
|
35
37
|
l.maxSize
|
|
36
|
-
), D =
|
|
38
|
+
), D = n(
|
|
37
39
|
K,
|
|
38
40
|
t == null ? void 0 : t.step,
|
|
39
41
|
void 0,
|
|
40
42
|
l.step
|
|
41
|
-
), z =
|
|
43
|
+
), z = n(
|
|
42
44
|
L,
|
|
43
45
|
t == null ? void 0 : t.orientation,
|
|
44
46
|
void 0,
|
|
45
47
|
l.orientation
|
|
46
|
-
),
|
|
47
|
-
|
|
48
|
+
), G = n(
|
|
49
|
+
$,
|
|
48
50
|
t == null ? void 0 : t.hideHandle,
|
|
49
51
|
void 0,
|
|
50
52
|
l.hideHandle
|
|
51
|
-
), 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, [
|
|
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 =
|
|
61
|
+
), s = k(
|
|
60
62
|
(e) => {
|
|
61
63
|
const r = g(e);
|
|
62
|
-
|
|
64
|
+
y || X(r), d == null || d(r);
|
|
63
65
|
},
|
|
64
|
-
[g,
|
|
65
|
-
),
|
|
66
|
+
[g, y, d]
|
|
67
|
+
), Y = (e) => {
|
|
66
68
|
e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), b(!0);
|
|
67
|
-
},
|
|
68
|
-
if (!
|
|
69
|
-
const r =
|
|
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
|
|
72
|
-
s(
|
|
73
|
+
const C = V / p * 100;
|
|
74
|
+
s(C);
|
|
73
75
|
}
|
|
74
76
|
}, P = (e) => {
|
|
75
|
-
if (
|
|
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
|
-
},
|
|
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
|
-
}, [
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
+
}, [J, Q] = A, i = z === "horizontal";
|
|
88
|
+
return /* @__PURE__ */ ee(
|
|
87
89
|
"div",
|
|
88
90
|
{
|
|
89
91
|
ref: (e) => {
|
|
90
|
-
|
|
92
|
+
x.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
|
|
91
93
|
},
|
|
92
94
|
className: c(
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
"flex relative",
|
|
96
|
+
o && "select-none",
|
|
97
|
+
i ? "flex-row" : "flex-col",
|
|
98
|
+
U
|
|
97
99
|
),
|
|
98
100
|
style: {
|
|
99
|
-
cursor:
|
|
100
|
-
|
|
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
|
-
"
|
|
109
|
-
|
|
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
|
-
[
|
|
118
|
+
[i ? "width" : "height"]: `${a}%`,
|
|
119
|
+
flexShrink: 0,
|
|
120
|
+
flexGrow: 0
|
|
113
121
|
},
|
|
114
|
-
children:
|
|
122
|
+
children: J
|
|
115
123
|
}
|
|
116
124
|
),
|
|
117
|
-
!
|
|
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":
|
|
134
|
+
"aria-orientation": i ? "horizontal" : "vertical",
|
|
127
135
|
"aria-label": "Resize panel split",
|
|
128
|
-
onPointerDown:
|
|
129
|
-
onPointerMove:
|
|
136
|
+
onPointerDown: Y,
|
|
137
|
+
onPointerMove: Z,
|
|
130
138
|
onPointerUp: P,
|
|
131
139
|
onPointerCancel: P,
|
|
132
|
-
onKeyDown:
|
|
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
|
-
|
|
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
|
-
|
|
143
|
-
|
|
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
|
-
"
|
|
154
|
-
|
|
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
|
-
[
|
|
165
|
+
[i ? "width" : "height"]: `${100 - a}%`,
|
|
166
|
+
flex: 1
|
|
158
167
|
},
|
|
159
|
-
children:
|
|
168
|
+
children: Q
|
|
160
169
|
}
|
|
161
170
|
)
|
|
162
171
|
]
|
|
@@ -164,7 +173,7 @@ const re = C(
|
|
|
164
173
|
);
|
|
165
174
|
}
|
|
166
175
|
);
|
|
167
|
-
|
|
176
|
+
ie.displayName = "ResizableScreen";
|
|
168
177
|
export {
|
|
169
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/select/Select.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAmBf,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK5E,KAAK,eAAe,GAAG,YAAY,GACjC,IAAI,CACF,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CACxC,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD;;;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;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAEjD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,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
|
|
3
|
-
import {
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { ChevronDownIcon as
|
|
6
|
-
import { useAsheeConfig as
|
|
7
|
-
import { resolveCascade as
|
|
8
|
-
import { FieldShell as
|
|
9
|
-
import { SelectMenu as
|
|
10
|
-
import { FALLBACK_SELECT_CONFIG as
|
|
11
|
-
import { SELECT_STATUS_BORDER_CLASS as
|
|
12
|
-
import { resolveVariantClass as
|
|
13
|
-
import { RADIUS_CLASS as
|
|
14
|
-
import {
|
|
15
|
-
|
|
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:
|
|
19
|
+
value: s,
|
|
19
20
|
onChange: S,
|
|
20
|
-
onValueChange:
|
|
21
|
-
size:
|
|
22
|
-
radius:
|
|
23
|
-
variant:
|
|
24
|
-
color:
|
|
25
|
-
status:
|
|
26
|
-
label:
|
|
27
|
-
labelAlign:
|
|
28
|
-
description:
|
|
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:
|
|
31
|
-
isLoading:
|
|
31
|
+
required: j,
|
|
32
|
+
isLoading: z,
|
|
32
33
|
disabled: v,
|
|
33
|
-
isSearch:
|
|
34
|
+
isSearch: C = !1,
|
|
34
35
|
searchPlaceholder: B = "Search options...",
|
|
35
|
-
searchInputName:
|
|
36
|
+
searchInputName: M = "select-search",
|
|
36
37
|
initialValue: n,
|
|
37
|
-
belowList:
|
|
38
|
-
placeholder:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
dropdownClassName: H,
|
|
38
|
+
belowList: Q,
|
|
39
|
+
placeholder: y = "Select...",
|
|
40
|
+
className: U,
|
|
41
|
+
dropdownClassName: G,
|
|
42
42
|
id: Z,
|
|
43
|
-
name:
|
|
43
|
+
name: x,
|
|
44
44
|
menu: q,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
74
|
-
),
|
|
75
|
-
|
|
54
|
+
t.size
|
|
55
|
+
), g = l(
|
|
56
|
+
K,
|
|
76
57
|
e == null ? void 0 : e.variant,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
),
|
|
80
|
-
|
|
58
|
+
c.defaultVariant,
|
|
59
|
+
t.variant
|
|
60
|
+
), ee = l(
|
|
61
|
+
k,
|
|
81
62
|
e == null ? void 0 : e.color,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
),
|
|
85
|
-
|
|
63
|
+
c.defaultColor,
|
|
64
|
+
t.color
|
|
65
|
+
), te = Ee(
|
|
66
|
+
F,
|
|
86
67
|
e == null ? void 0 : e.radius,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
), u =
|
|
90
|
-
|
|
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
|
-
|
|
94
|
-
),
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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(
|
|
109
|
+
S(be);
|
|
111
110
|
}
|
|
112
111
|
A(!1), R("");
|
|
113
112
|
},
|
|
114
|
-
[
|
|
115
|
-
),
|
|
116
|
-
() =>
|
|
117
|
-
[
|
|
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
|
-
|
|
119
|
+
Fe,
|
|
121
120
|
{
|
|
122
|
-
id:
|
|
123
|
-
label:
|
|
124
|
-
labelAlign:
|
|
125
|
-
description:
|
|
121
|
+
id: Y,
|
|
122
|
+
label: N,
|
|
123
|
+
labelAlign: re,
|
|
124
|
+
description: P,
|
|
126
125
|
message: D,
|
|
127
126
|
status: u,
|
|
128
|
-
required:
|
|
129
|
-
isLoading:
|
|
130
|
-
children: /* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
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: (
|
|
135
|
-
|
|
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":
|
|
138
|
+
"aria-expanded": d,
|
|
140
139
|
"aria-haspopup": "listbox",
|
|
141
140
|
"aria-invalid": u === "error",
|
|
142
|
-
className:
|
|
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
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
G
|
|
145
|
+
we[V],
|
|
146
|
+
le,
|
|
147
|
+
ae,
|
|
148
|
+
ne,
|
|
149
|
+
U
|
|
152
150
|
),
|
|
153
|
-
style:
|
|
154
|
-
...
|
|
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:
|
|
158
|
+
children: Se
|
|
161
159
|
}
|
|
162
160
|
),
|
|
163
161
|
/* @__PURE__ */ f(
|
|
164
|
-
|
|
162
|
+
Te,
|
|
165
163
|
{
|
|
166
|
-
className:
|
|
164
|
+
className: E(
|
|
167
165
|
"ml-2 shrink-0 text-foreground/70 transition-transform duration-200",
|
|
168
|
-
|
|
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
|
-
|
|
174
|
+
Ke,
|
|
177
175
|
{
|
|
178
|
-
isOpen:
|
|
179
|
-
context:
|
|
180
|
-
floatingStyles:
|
|
181
|
-
getFloatingProps:
|
|
182
|
-
setFloatingRef:
|
|
176
|
+
isOpen: d,
|
|
177
|
+
context: m,
|
|
178
|
+
floatingStyles: ie,
|
|
179
|
+
getFloatingProps: fe,
|
|
180
|
+
setFloatingRef: h.setFloating,
|
|
183
181
|
options: p,
|
|
184
|
-
selectedValues:
|
|
185
|
-
onSelectOption:
|
|
186
|
-
isSearch:
|
|
182
|
+
selectedValues: ve,
|
|
183
|
+
onSelectOption: pe,
|
|
184
|
+
isSearch: C,
|
|
187
185
|
searchPlaceholder: B,
|
|
188
|
-
searchInputName:
|
|
189
|
-
searchQuery:
|
|
186
|
+
searchInputName: M,
|
|
187
|
+
searchQuery: $,
|
|
190
188
|
onSearchChange: R,
|
|
191
|
-
belowList:
|
|
192
|
-
dropdownClassName:
|
|
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:
|
|
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;
|