@spear-ai/spectral 1.11.2 → 1.11.3
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/Combobox.js +90 -85
- package/dist/ControlGroup/ControlGroupSelect.js +1 -1
- package/dist/MultiSelect/MultiSelectBase.js +87 -82
- package/dist/Select.js +58 -55
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +51 -48
- package/dist/styles/spectral.css +1 -1
- package/dist/utils/dropdownPositioning.d.ts +13 -0
- package/dist/utils/dropdownPositioning.d.ts.map +1 -0
- package/dist/utils/dropdownPositioning.js +43 -0
- package/dist/utils/dropdownPositioning.test.d.ts +2 -0
- package/dist/utils/dropdownPositioning.test.d.ts.map +1 -0
- package/dist/utils/dropdownPositioning.test.js +21 -0
- package/package.json +1 -1
package/dist/Select.js
CHANGED
|
@@ -6,16 +6,18 @@ import { LoaderIcon as n } from "./Icons/LoaderIcon.js";
|
|
|
6
6
|
import { t as r } from "./twUtils-VNWgstKL.js";
|
|
7
7
|
import { EmptyState as i, ErrorMessage as a, LoadingState as o, getAriaProps as s, getDropdownSurfaceClasses as c, getErrorMessageId as l, getFormFieldCSSProperties as ee, getOptionClasses as te, getStateClasses as ne, getTriggerClasses as re, groupOptions as ie, useFormFieldId as ae, useFormFieldState as oe } from "./utils/formFieldUtils.js";
|
|
8
8
|
import { Label as u } from "./Label.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { useAutoDropdownHorizontalShift as d } from "./utils/dropdownPositioning.js";
|
|
10
|
+
import { a as f, c as p, d as m, f as h, h as se, i as ce, l as le, m as ue, n as de, o as fe, p as pe, r as me, t as he, u as ge } from "./dist-fW81qjVl.js";
|
|
11
|
+
import { useState as g } from "react";
|
|
11
12
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
12
13
|
//#region src/components/Select/Select.tsx
|
|
13
14
|
var b = (b) => {
|
|
14
|
-
let x = "value" in b, { align: S = "start", alignOffset: C = 0, avoidCollisions: w = !0, className: T, collisionBoundary: E, collisionPadding: D = 10, defaultValue: O, dropdownWidth: k = "trigger", emptyMessage: A = "No options found", errorMessage: j, id: M, label: N, labelClassName: P, loadingMessage: F = "Loading…", name: I, onChange: L, options: R = [], placeholder:
|
|
15
|
-
"--spectral-select-content-width":
|
|
16
|
-
width:
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
let x = "value" in b, { align: S = "start", alignOffset: C = 0, avoidCollisions: w = !0, className: T, collisionBoundary: E, collisionPadding: D = 10, defaultValue: O, dropdownWidth: k = "trigger", emptyMessage: A = "No options found", errorMessage: j, id: M, label: N, labelClassName: P, loadingMessage: F = "Loading…", name: I, onChange: L, options: R = [], placeholder: _e = "Select an option", position: z = "popper", ref: ve, side: ye = "bottom", sideOffset: be = 4, state: B = "default", value: V, "aria-label": xe, "aria-describedby": Se, ...H } = b, U = x ? V ?? "" : V, [W, Ce] = g(!1), { dropdownShiftStyle: we, setDropdownElement: Te } = d(W), G = ae(M, I), K = l(G), q = k === "trigger" ? "var(--radix-select-trigger-width)" : k === "content" ? "max-content" : k, J = k === "trigger" || k === "content" ? k : "custom", Ee = {
|
|
16
|
+
"--spectral-select-content-width": q,
|
|
17
|
+
width: z === "item-aligned" ? q : void 0,
|
|
18
|
+
...we
|
|
19
|
+
}, { isDisabled: Y, isLoading: X, isInvalid: De } = oe(H.disabled, B), Z = s(B, Se, H.required, K), { groups: Q, ungrouped: $ } = ie(R), Oe = () => {
|
|
20
|
+
if (X) return /* @__PURE__ */ v(o, {
|
|
19
21
|
"data-testid": "spectral-select-loading",
|
|
20
22
|
message: F
|
|
21
23
|
});
|
|
@@ -24,17 +26,17 @@ var b = (b) => {
|
|
|
24
26
|
message: A
|
|
25
27
|
});
|
|
26
28
|
let t = (t) => {
|
|
27
|
-
let n =
|
|
28
|
-
return /* @__PURE__ */ y(
|
|
29
|
+
let n = U === t.value;
|
|
30
|
+
return /* @__PURE__ */ y(ce, {
|
|
29
31
|
className: r(te(!!t.disabled, !1, n), "relative flex w-full cursor-pointer items-center"),
|
|
30
32
|
"data-testid": "spectral-select-item",
|
|
31
33
|
disabled: t.disabled,
|
|
32
34
|
value: t.value,
|
|
33
|
-
children: [/* @__PURE__ */ v(
|
|
35
|
+
children: [/* @__PURE__ */ v(fe, {
|
|
34
36
|
"data-testid": "spectral-select-item-text",
|
|
35
37
|
className: "block truncate",
|
|
36
38
|
children: t.label
|
|
37
|
-
}), /* @__PURE__ */ v(
|
|
39
|
+
}), /* @__PURE__ */ v(f, {
|
|
38
40
|
"data-testid": "spectral-select-item-selected-indicator",
|
|
39
41
|
asChild: !0,
|
|
40
42
|
children: /* @__PURE__ */ v("span", {
|
|
@@ -44,13 +46,13 @@ var b = (b) => {
|
|
|
44
46
|
})]
|
|
45
47
|
}, t.value);
|
|
46
48
|
};
|
|
47
|
-
return /* @__PURE__ */ y(_, { children: [$.length > 0 && /* @__PURE__ */ y(_, { children: [$.map(t), Object.keys(Q).length > 0 && /* @__PURE__ */ v(
|
|
49
|
+
return /* @__PURE__ */ y(_, { children: [$.length > 0 && /* @__PURE__ */ y(_, { children: [$.map(t), Object.keys(Q).length > 0 && /* @__PURE__ */ v(h, {
|
|
48
50
|
className: "-mx-1 my-1 h-px bg-border-secondary",
|
|
49
51
|
"data-testid": "spectral-select-separator"
|
|
50
|
-
})] }), Object.entries(Q).map(([e, n], i) => /* @__PURE__ */ y(
|
|
52
|
+
})] }), Object.entries(Q).map(([e, n], i) => /* @__PURE__ */ y(de, {
|
|
51
53
|
"data-testid": "spectral-select-group",
|
|
52
54
|
children: [
|
|
53
|
-
i > 0 && /* @__PURE__ */ v(
|
|
55
|
+
i > 0 && /* @__PURE__ */ v(h, {
|
|
54
56
|
className: "-mx-1 my-1 h-px bg-border-secondary",
|
|
55
57
|
"data-testid": "spectral-select-group-separator"
|
|
56
58
|
}),
|
|
@@ -67,72 +69,73 @@ var b = (b) => {
|
|
|
67
69
|
className: "w-full",
|
|
68
70
|
children: [
|
|
69
71
|
N && /* @__PURE__ */ v(u, {
|
|
70
|
-
className: r("mb-2 block text-text-primary", P,
|
|
72
|
+
className: r("mb-2 block text-text-primary", P, Y && "text-text-secondary"),
|
|
71
73
|
"data-testid": "spectral-select-label",
|
|
72
|
-
htmlFor:
|
|
74
|
+
htmlFor: G,
|
|
73
75
|
children: N
|
|
74
76
|
}),
|
|
75
|
-
/* @__PURE__ */ y(
|
|
77
|
+
/* @__PURE__ */ y(le, {
|
|
76
78
|
"data-testid": "spectral-select",
|
|
77
79
|
defaultValue: O,
|
|
78
|
-
disabled:
|
|
80
|
+
disabled: Y,
|
|
79
81
|
name: I,
|
|
80
|
-
onOpenChange:
|
|
82
|
+
onOpenChange: Ce,
|
|
81
83
|
onValueChange: L,
|
|
82
|
-
open:
|
|
83
|
-
required:
|
|
84
|
-
value:
|
|
85
|
-
children: [/* @__PURE__ */ v(
|
|
86
|
-
"aria-controls":
|
|
87
|
-
"aria-expanded":
|
|
88
|
-
"aria-label":
|
|
84
|
+
open: W,
|
|
85
|
+
required: H.required,
|
|
86
|
+
value: U,
|
|
87
|
+
children: [/* @__PURE__ */ v(pe, {
|
|
88
|
+
"aria-controls": G,
|
|
89
|
+
"aria-expanded": W,
|
|
90
|
+
"aria-label": xe ?? N,
|
|
89
91
|
asChild: !0,
|
|
90
|
-
className: r(re(!1,
|
|
92
|
+
className: r(re(!1, B), ne(B), "text-input-text data-placeholder:text-input-text-placeholder!", T),
|
|
91
93
|
"data-slot": "select-trigger",
|
|
92
|
-
"data-state":
|
|
94
|
+
"data-state": B,
|
|
93
95
|
"data-testid": "spectral-select-trigger",
|
|
94
|
-
id:
|
|
95
|
-
ref:
|
|
96
|
+
id: G,
|
|
97
|
+
ref: ve,
|
|
96
98
|
role: "combobox",
|
|
97
99
|
style: ee(),
|
|
98
|
-
...
|
|
99
|
-
...
|
|
100
|
+
...Z,
|
|
101
|
+
...H,
|
|
100
102
|
children: /* @__PURE__ */ y("button", {
|
|
101
|
-
className: "min-w-0 gap-2 [&>span]:min-w-0 grid w-full cursor-pointer grid-cols-[minmax(0,1fr)_auto] items-center overflow-hidden text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text! [&>span]:block [&>span]:overflow-hidden [&>span]:text-ellipsis [&>span]:whitespace-nowrap [&>span[data-placeholder]]:text-input-text!",
|
|
103
|
+
className: "min-w-0 gap-2 [&>span]:min-w-0 grid w-full cursor-pointer grid-cols-[minmax(0,1fr)_auto] items-center overflow-hidden text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text-placeholder! [&>span]:block [&>span]:overflow-hidden [&>span]:text-ellipsis [&>span]:whitespace-nowrap [&>span[data-placeholder]]:text-input-text-placeholder!",
|
|
102
104
|
type: "button",
|
|
103
|
-
disabled:
|
|
104
|
-
children: [/* @__PURE__ */ v(
|
|
105
|
-
className: "min-w-0 block max-w-full flex-1 truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text!",
|
|
105
|
+
disabled: Y,
|
|
106
|
+
children: [/* @__PURE__ */ v(ue, {
|
|
107
|
+
className: "min-w-0 block max-w-full flex-1 truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text-placeholder!",
|
|
106
108
|
"data-testid": "spectral-select-value",
|
|
107
|
-
placeholder:
|
|
108
|
-
}), /* @__PURE__ */ v(
|
|
109
|
+
placeholder: _e
|
|
110
|
+
}), /* @__PURE__ */ v(me, {
|
|
109
111
|
asChild: !0,
|
|
110
112
|
children: /* @__PURE__ */ v("div", {
|
|
111
113
|
className: "flex shrink-0 cursor-pointer items-center",
|
|
112
|
-
children:
|
|
113
|
-
className: r("transition-transform duration-200",
|
|
114
|
+
children: X ? /* @__PURE__ */ v(n, { size: 20 }) : /* @__PURE__ */ v(t, {
|
|
115
|
+
className: r("transition-transform duration-200", W && "rotate-180"),
|
|
114
116
|
size: 20
|
|
115
117
|
})
|
|
116
118
|
})
|
|
117
119
|
})]
|
|
118
120
|
})
|
|
119
|
-
}), /* @__PURE__ */ v(
|
|
121
|
+
}), /* @__PURE__ */ v(p, { children: /* @__PURE__ */ y(he, {
|
|
120
122
|
align: S,
|
|
121
123
|
alignOffset: C,
|
|
122
124
|
avoidCollisions: w,
|
|
123
|
-
className: r("relative z-50 motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=open]:animate-in", c(), "motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95", "max-h-[min(var(--radix-select-content-available-height),300px)] motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2", "min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto",
|
|
125
|
+
className: r("relative z-50 motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=open]:animate-in", c(), "motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95", "max-h-[min(var(--radix-select-content-available-height),300px)] motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2", "min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto", z === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1"),
|
|
124
126
|
collisionBoundary: E,
|
|
125
127
|
collisionPadding: D,
|
|
126
|
-
"data-dropdown-width-mode":
|
|
127
|
-
"data-dropdown-width-value":
|
|
128
|
+
"data-dropdown-width-mode": J,
|
|
129
|
+
"data-dropdown-width-value": J === "custom" ? k : void 0,
|
|
128
130
|
"data-slot": "select-content",
|
|
129
131
|
"data-testid": "spectral-select-content",
|
|
130
|
-
position:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
position: z,
|
|
133
|
+
ref: Te,
|
|
134
|
+
side: ye,
|
|
135
|
+
sideOffset: be,
|
|
136
|
+
style: Ee,
|
|
134
137
|
children: [
|
|
135
|
-
/* @__PURE__ */ v(
|
|
138
|
+
/* @__PURE__ */ v(m, {
|
|
136
139
|
className: "py-1 flex cursor-default items-center justify-center",
|
|
137
140
|
"data-testid": "spectral-select-scroll-up-button",
|
|
138
141
|
children: /* @__PURE__ */ v(t, {
|
|
@@ -141,15 +144,15 @@ var b = (b) => {
|
|
|
141
144
|
size: 18
|
|
142
145
|
})
|
|
143
146
|
}),
|
|
144
|
-
/* @__PURE__ */ v(
|
|
147
|
+
/* @__PURE__ */ v(se, {
|
|
145
148
|
asChild: !0,
|
|
146
149
|
children: /* @__PURE__ */ v("div", {
|
|
147
|
-
className: r("p-1",
|
|
150
|
+
className: r("p-1", z === "popper" && "scroll-my-1 h-(--radix-select-trigger-height) w-(--spectral-select-content-width) min-w-(--spectral-select-content-width)"),
|
|
148
151
|
"data-testid": "spectral-select-items",
|
|
149
|
-
children:
|
|
152
|
+
children: Oe()
|
|
150
153
|
})
|
|
151
154
|
}),
|
|
152
|
-
/* @__PURE__ */ v(
|
|
155
|
+
/* @__PURE__ */ v(ge, {
|
|
153
156
|
className: "py-1 flex cursor-default items-center justify-center",
|
|
154
157
|
"data-testid": "spectral-select-scroll-down-button",
|
|
155
158
|
children: /* @__PURE__ */ v(t, {
|
|
@@ -160,9 +163,9 @@ var b = (b) => {
|
|
|
160
163
|
]
|
|
161
164
|
}) })]
|
|
162
165
|
}),
|
|
163
|
-
|
|
166
|
+
De && j && /* @__PURE__ */ v(a, {
|
|
164
167
|
"data-testid": "spectral-select-error-message",
|
|
165
|
-
id:
|
|
168
|
+
id: K,
|
|
166
169
|
message: j
|
|
167
170
|
})
|
|
168
171
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/primitives/select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/primitives/select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAErF,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,OAAO,CAAA;AA6CnD,eAAO,MAAM,MAAM,GAAI,cAAc,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,4CAE/E,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,cAAc,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,4CAErF,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,4CAEhG,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,kDAM3B,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG;IAClD,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACxB,4CAoBA,CAAA;AAED,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG;IACzE,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,4GAA8I,kBAAkB,4CAwD7L,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,4CAEhG,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,mCAAmC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,4CAkBxG,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,4CAExG,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,cAAc,CAAC,4CAMlH,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,yBAAyB,cAAc,CAAC,OAAO,eAAe,CAAC,gBAAgB,CAAC,4CAMtH,CAAA"}
|
|
@@ -4,22 +4,23 @@ import { ChevronDownIcon as t } from "../Icons/ChevronDownIcon.js";
|
|
|
4
4
|
import { ChevronUpIcon as n } from "../Icons/ChevronUpIcon.js";
|
|
5
5
|
import { t as r } from "../twUtils-VNWgstKL.js";
|
|
6
6
|
import { getDropdownSurfaceClasses as i } from "../utils/formFieldUtils.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { useAutoDropdownHorizontalShift as a } from "../utils/dropdownPositioning.js";
|
|
8
|
+
import { a as o, c as s, d as c, f as l, h as u, i as d, l as f, m as p, n as m, o as h, p as g, r as _, s as v, t as y, u as b } from "../dist-fW81qjVl.js";
|
|
9
|
+
import { useRef as x } from "react";
|
|
10
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
10
11
|
//#region src/primitives/select.tsx
|
|
11
|
-
var
|
|
12
|
+
var w = 12, T = (e) => {
|
|
12
13
|
let t = document.querySelectorAll("[aria-controls]");
|
|
13
14
|
for (let n of t) if (n.getAttribute("aria-controls") === e) return n;
|
|
14
15
|
return null;
|
|
15
|
-
},
|
|
16
|
+
}, E = (e) => {
|
|
16
17
|
let t = e.id;
|
|
17
18
|
if (!t) return;
|
|
18
|
-
let n =
|
|
19
|
+
let n = T(t);
|
|
19
20
|
if (!n) return;
|
|
20
21
|
let r = n.closest("[data-slot=\"dialog-content\"]");
|
|
21
22
|
if (!r) return;
|
|
22
|
-
let i = e.getBoundingClientRect(), a = r.getBoundingClientRect(), o = i.bottom - a.bottom +
|
|
23
|
+
let i = e.getBoundingClientRect(), a = r.getBoundingClientRect(), o = i.bottom - a.bottom + w;
|
|
23
24
|
if (o > 0) {
|
|
24
25
|
r.scrollTo({
|
|
25
26
|
top: r.scrollTop + o,
|
|
@@ -27,98 +28,100 @@ var C = 12, w = (e) => {
|
|
|
27
28
|
});
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
let s = a.top - i.top +
|
|
31
|
+
let s = a.top - i.top + w;
|
|
31
32
|
s > 0 && r.scrollTo({
|
|
32
33
|
top: Math.max(0, r.scrollTop - s),
|
|
33
34
|
behavior: "smooth"
|
|
34
35
|
});
|
|
35
|
-
},
|
|
36
|
+
}, D = ({ ...e }) => /* @__PURE__ */ S(f, {
|
|
36
37
|
"data-slot": "select",
|
|
37
38
|
...e
|
|
38
|
-
}),
|
|
39
|
+
}), O = ({ ...e }) => /* @__PURE__ */ S(m, {
|
|
39
40
|
"data-slot": "select-group",
|
|
40
41
|
...e
|
|
41
|
-
}),
|
|
42
|
-
className: r("min-w-0 block max-w-full flex-1 truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text!", e),
|
|
42
|
+
}), k = ({ className: e, ...t }) => /* @__PURE__ */ S(p, {
|
|
43
|
+
className: r("min-w-0 block max-w-full flex-1 truncate text-left whitespace-nowrap text-input-text! data-placeholder:text-input-text-placeholder!", e),
|
|
43
44
|
"data-slot": "select-value",
|
|
44
45
|
...t
|
|
45
|
-
}),
|
|
46
|
+
}), A = ({ asChild: e, children: n, className: i, size: a = "default", ...o }) => /* @__PURE__ */ C(g, {
|
|
46
47
|
asChild: e,
|
|
47
|
-
className: r("[&_svg:not([class*='text-'])]:text-text-placeholder focus-visible:border-ring focus-visible:ring-ring/50 gap-2 rounded-md px-3 py-2 text-sm shadow-xs h-9 *:data-[slot=select-value]:gap-2 [&_svg:not([class*='size-'])]:size-4 min-w-0 *:data-[slot=select-value]:min-w-0 flex w-fit cursor-pointer items-center justify-between border border-input-border bg-transparent text-input-text! transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-danger-400 data-placeholder:text-input-text! *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center data-[state=open]:**:data-[slot=select-chevron]:rotate-180 [&_svg]:pointer-events-none [&_svg]:shrink-0", i),
|
|
48
|
+
className: r("[&_svg:not([class*='text-'])]:text-text-placeholder focus-visible:border-ring focus-visible:ring-ring/50 gap-2 rounded-md px-3 py-2 text-sm shadow-xs h-9 *:data-[slot=select-value]:gap-2 [&_svg:not([class*='size-'])]:size-4 min-w-0 *:data-[slot=select-value]:min-w-0 flex w-fit cursor-pointer items-center justify-between border border-input-border bg-transparent text-input-text! transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-danger-400 data-placeholder:text-input-text-placeholder! *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center data-[state=open]:**:data-[slot=select-chevron]:rotate-180 [&_svg]:pointer-events-none [&_svg]:shrink-0", i),
|
|
48
49
|
"data-size": a,
|
|
49
50
|
"data-slot": "select-trigger",
|
|
50
51
|
...o,
|
|
51
|
-
children: [n, !e && /* @__PURE__ */
|
|
52
|
+
children: [n, !e && /* @__PURE__ */ S(_, {
|
|
52
53
|
asChild: !0,
|
|
53
|
-
children: /* @__PURE__ */
|
|
54
|
+
children: /* @__PURE__ */ S(t, {
|
|
54
55
|
className: "size-4 opacity-50 transition-transform duration-200",
|
|
55
56
|
"data-slot": "select-chevron"
|
|
56
57
|
})
|
|
57
58
|
})]
|
|
58
|
-
}),
|
|
59
|
-
let
|
|
60
|
-
if (
|
|
61
|
-
|
|
59
|
+
}), j = ({ align: e = "center", children: t, className: n, dropdownWidth: o = "trigger", onCloseAutoFocus: c, onFocusCapture: l, position: d = "popper", style: f, ...p }) => {
|
|
60
|
+
let m = x(!1), { dropdownShiftStyle: h, recalculateDropdownPosition: g, setDropdownElement: _ } = a(), v = o === "trigger" ? "var(--radix-select-trigger-width)" : o === "content" ? "max-content" : o, b = o === "trigger" || o === "content" ? o : "custom", w = (e) => {
|
|
61
|
+
if (l?.(e), m.current) return;
|
|
62
|
+
m.current = !0;
|
|
62
63
|
let t = e.currentTarget;
|
|
63
64
|
requestAnimationFrame(() => {
|
|
64
|
-
|
|
65
|
+
E(t), g();
|
|
65
66
|
});
|
|
66
|
-
},
|
|
67
|
-
|
|
67
|
+
}, T = (e) => {
|
|
68
|
+
m.current = !1, c?.(e);
|
|
68
69
|
};
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ S(s, { children: /* @__PURE__ */ C(y, {
|
|
70
71
|
align: e,
|
|
71
|
-
className: r("min-w-32 relative z-50 max-h-[--radix-select-content-available-height] origin-[--radix-select-content-transform-origin] overflow-x-hidden overflow-y-auto text-text-primary motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95", i(),
|
|
72
|
-
"data-dropdown-width-mode":
|
|
73
|
-
"data-dropdown-width-value":
|
|
72
|
+
className: r("min-w-32 relative z-50 max-h-[--radix-select-content-available-height] origin-[--radix-select-content-transform-origin] overflow-x-hidden overflow-y-auto text-text-primary motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95", i(), d === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", n),
|
|
73
|
+
"data-dropdown-width-mode": b,
|
|
74
|
+
"data-dropdown-width-value": b === "custom" ? o : void 0,
|
|
74
75
|
"data-slot": "select-content",
|
|
75
|
-
onCloseAutoFocus:
|
|
76
|
-
onFocusCapture:
|
|
77
|
-
position:
|
|
76
|
+
onCloseAutoFocus: T,
|
|
77
|
+
onFocusCapture: w,
|
|
78
|
+
position: d,
|
|
79
|
+
ref: _,
|
|
78
80
|
style: {
|
|
79
|
-
...
|
|
80
|
-
width:
|
|
81
|
+
...f,
|
|
82
|
+
width: v,
|
|
83
|
+
...h
|
|
81
84
|
},
|
|
82
|
-
...
|
|
85
|
+
...p,
|
|
83
86
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
className: r("p-1",
|
|
87
|
+
/* @__PURE__ */ S(F, {}),
|
|
88
|
+
/* @__PURE__ */ S(u, {
|
|
89
|
+
className: r("p-1", d === "popper" && "scroll-my-1 h-(--radix-select-trigger-height) w-full min-w-full"),
|
|
87
90
|
"data-slot": "select-viewport",
|
|
88
91
|
children: t
|
|
89
92
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ S(I, {})
|
|
91
94
|
]
|
|
92
95
|
}) });
|
|
93
|
-
},
|
|
96
|
+
}, M = ({ className: e, ...t }) => /* @__PURE__ */ S(v, {
|
|
94
97
|
className: r("px-2 py-1.5 text-xs text-text-primary", e),
|
|
95
98
|
"data-slot": "select-label",
|
|
96
99
|
...t
|
|
97
|
-
}),
|
|
100
|
+
}), N = ({ className: t, children: n, ...i }) => /* @__PURE__ */ C(d, {
|
|
98
101
|
className: r("gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm [&_svg:not([class*='size-'])]:size-4 *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-none select-none hover:border-input-border--hover hover:bg-accent hover:text-text-inverted! focus:border-input-border--focus focus:bg-accent focus:text-text-inverted! data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-accent data-highlighted:text-text-inverted! [&_svg]:pointer-events-none [&_svg]:shrink-0 hover:[&_svg]:text-text-inverted! focus:[&_svg]:text-text-inverted! data-highlighted:[&_svg]:text-text-inverted! *:[span]:last:flex *:[span]:last:items-center", t),
|
|
99
102
|
"data-slot": "select-item",
|
|
100
103
|
...i,
|
|
101
|
-
children: [/* @__PURE__ */
|
|
104
|
+
children: [/* @__PURE__ */ S("span", {
|
|
102
105
|
className: "right-2 size-3.5 absolute flex items-center justify-center",
|
|
103
|
-
children: /* @__PURE__ */
|
|
104
|
-
}), /* @__PURE__ */
|
|
106
|
+
children: /* @__PURE__ */ S(o, { children: /* @__PURE__ */ S(e, { className: "size-4" }) })
|
|
107
|
+
}), /* @__PURE__ */ S(h, {
|
|
105
108
|
className: "min-w-0 block max-w-full truncate whitespace-nowrap",
|
|
106
109
|
children: n
|
|
107
110
|
})]
|
|
108
|
-
}),
|
|
111
|
+
}), P = ({ className: e, ...t }) => /* @__PURE__ */ S(l, {
|
|
109
112
|
className: r("bg-border -mx-1 my-1 pointer-events-none h-px", e),
|
|
110
113
|
"data-slot": "select-separator",
|
|
111
114
|
...t
|
|
112
|
-
}),
|
|
115
|
+
}), F = ({ className: e, ...t }) => /* @__PURE__ */ S(c, {
|
|
113
116
|
className: r("py-1 flex cursor-default items-center justify-center", e),
|
|
114
117
|
"data-slot": "select-scroll-up-button",
|
|
115
118
|
...t,
|
|
116
|
-
children: /* @__PURE__ */
|
|
117
|
-
}),
|
|
119
|
+
children: /* @__PURE__ */ S(n, { className: "size-4" })
|
|
120
|
+
}), I = ({ className: e, ...n }) => /* @__PURE__ */ S(b, {
|
|
118
121
|
className: r("py-1 flex cursor-default items-center justify-center", e),
|
|
119
122
|
"data-slot": "select-scroll-down-button",
|
|
120
123
|
...n,
|
|
121
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ S(t, { className: "size-4" })
|
|
122
125
|
});
|
|
123
126
|
//#endregion
|
|
124
|
-
export {
|
|
127
|
+
export { D as Select, j as SelectContent, O as SelectGroup, N as SelectItem, M as SelectLabel, I as SelectScrollDownButton, F as SelectScrollUpButton, P as SelectSeparator, A as SelectTrigger, k as SelectValue };
|