@spear-ai/spectral 1.3.61 → 1.3.63
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/.js +181 -152
- package/dist/Accordion.d.ts +37 -0
- package/dist/Accordion.js +465 -0
- package/dist/Alert/AlertBase.js +2 -2
- package/dist/Alert.js +4 -3
- package/dist/Avatar.d.ts +12 -0
- package/dist/Avatar.js +88 -1
- package/dist/Badge.d.ts +12 -2
- package/dist/Badge.js +28 -4
- package/dist/Button.js +2 -2
- package/dist/ButtonGroup/ButtonGroupButton.d.ts +13 -0
- package/dist/ButtonGroup/ButtonGroupButton.js +51 -0
- package/dist/ButtonGroup.d.ts +29 -0
- package/dist/ButtonGroup.js +89 -0
- package/dist/ButtonIcon.js +2 -1
- package/dist/Checkbox/CheckboxBase.d.ts +2 -2
- package/dist/Checkbox/CheckboxBase.js +21 -21
- package/dist/Checkbox.d.ts +14 -0
- package/dist/Checkbox.js +98 -0
- package/dist/Dialog/DialogBase.d.ts +1 -1
- package/dist/Dialog/DialogBase.js +2 -2
- package/dist/Dialog.js +4 -4
- package/dist/Drawer.js +24 -1283
- package/dist/HoverCard.d.ts +29 -0
- package/dist/HoverCard.js +207 -0
- package/dist/Icons/CheckmarkIcon.js +9 -9
- package/dist/Icons/MessagesIcon.d.ts +3 -0
- package/dist/Icons/MessagesIcon.js +31 -0
- package/dist/Icons/MinusIcon.js +13 -13
- package/dist/Icons/index.d.ts +1 -0
- package/dist/Icons.js +50 -48
- package/dist/Input.d.ts +2 -0
- package/dist/Input.js +98 -89
- package/dist/InputGroup.d.ts +16 -0
- package/dist/InputGroup.js +129 -0
- package/dist/InputOTP.d.ts +0 -2
- package/dist/InputOTP.js +138 -142
- package/dist/Label.d.ts +3 -7
- package/dist/Label.js +11 -11
- package/dist/MultiSelect/MultiSelectBase.js +22 -22
- package/dist/Popover.d.ts +6 -7
- package/dist/Popover.js +60 -71
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +1 -1
- package/dist/RadioButtonGroup.js +1 -1
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +141 -134
- package/dist/Select.js +97 -895
- package/dist/Separator.d.ts +12 -0
- package/dist/Separator.js +24 -0
- package/dist/Skeleton.js +3 -3
- package/dist/Slider.d.ts +15 -3
- package/dist/Slider.js +464 -40
- package/dist/Switch/SwitchBase.js +1 -1
- package/dist/Switch.js +2 -2
- package/dist/Tabs/TabsBase.js +1 -1
- package/dist/Tabs.js +16 -16
- package/dist/Textarea.js +41 -42
- package/dist/Toggle.js +2 -2
- package/dist/ToggleGroup.js +1 -1
- package/dist/Tooltip/TooltipBase.js +29 -29
- package/dist/Tooltip.js +15 -15
- package/dist/Tray/TrayStoriesData.d.ts +39 -0
- package/dist/Tray/TrayStoriesData.js +438 -0
- package/dist/Tray.d.ts +28 -0
- package/dist/Tray.js +227 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/Accordion/Accordion.d.ts +37 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +12 -0
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/Badge/Badge.d.ts +12 -2
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +29 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts.map +1 -0
- package/dist/components/ButtonGroup/ButtonGroupButton.d.ts +13 -0
- package/dist/components/ButtonGroup/ButtonGroupButton.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +14 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/CheckboxBase.d.ts +2 -2
- package/dist/components/Checkbox/CheckboxBase.d.ts.map +1 -1
- package/dist/components/Dialog/DialogBase.d.ts +1 -1
- package/dist/components/HoverCard/HoverCard.d.ts +29 -0
- package/dist/components/HoverCard/HoverCard.d.ts.map +1 -0
- package/dist/components/Icons/MessagesIcon.d.ts +3 -0
- package/dist/components/Icons/MessagesIcon.d.ts.map +1 -0
- package/dist/components/Icons/iconTypes.d.ts +1 -0
- package/dist/components/Icons/iconTypes.d.ts.map +1 -1
- package/dist/components/Icons/index.d.ts +1 -0
- package/dist/components/Icons/index.d.ts.map +1 -1
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/InputGroup/InputGroup.d.ts +16 -0
- package/dist/components/InputGroup/InputGroup.d.ts.map +1 -0
- package/dist/components/InputOTP/InputOTP.d.ts +0 -2
- package/dist/components/InputOTP/InputOTP.d.ts.map +1 -1
- package/dist/components/Label/Label.d.ts +3 -7
- package/dist/components/Label/Label.d.ts.map +1 -1
- package/dist/components/Popover/Popover.d.ts +6 -7
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/components/Separator/Separator.d.ts +12 -0
- package/dist/components/Separator/Separator.d.ts.map +1 -0
- package/dist/components/Slider/Slider.d.ts +15 -3
- package/dist/components/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Tray/Tray.d.ts +28 -0
- package/dist/components/Tray/Tray.d.ts.map +1 -0
- package/dist/components/Tray/TrayStoriesData.d.ts +39 -0
- package/dist/components/Tray/TrayStoriesData.d.ts.map +1 -0
- package/dist/features/AuthCard/ForgotPasswordEmailForm.js +4 -3
- package/dist/features/AuthCard/ForgotPasswordResetForm.js +9 -9
- package/dist/features/AuthCard/PasswordInput.js +78 -9
- package/dist/features/AuthCard/SignInForm.js +8 -7
- package/dist/features/AuthCard/SignUpForm.js +8 -7
- package/dist/features/AuthCard.js +2 -2
- package/dist/features/LabelingTools.js +7 -6
- package/dist/features/SensorMetadata.js +3 -2
- package/dist/features/SettingsPopover.js +3 -2
- package/dist/index-0ioNhtNM.js +10 -0
- package/dist/{index-CBwRmAsQ.js → index-6Abv_Flm.js} +1 -1
- package/dist/{index-DUK1rxhf.js → index-B-GQStVW.js} +6 -5
- package/dist/index-B2oBi8ng.js +142 -0
- package/dist/index-BIpuW_o8.js +146 -0
- package/dist/index-BZPx6jYI.js +8 -0
- package/dist/index-BhufZRa2.js +232 -0
- package/dist/index-CAKA12cC.js +1265 -0
- package/dist/{index-Cfyte2YO.js → index-CGALWSq_.js} +1 -1
- package/dist/index-CVSxKOPp.js +13 -0
- package/dist/index-CevVJ05e.js +822 -0
- package/dist/{index-CRBC94ik.js → index-D29mdTf5.js} +1 -1
- package/dist/{index-FeGk8zep.js → index-NzygPVvJ.js} +10 -9
- package/dist/index-UEFPWH8U.js +54 -0
- package/dist/index-rKs9bXHr.js +6 -0
- package/dist/{index-Cb7rjMhE.js → index-y6Br5T4h.js} +6 -6
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/linear-cursor-small.png +0 -0
- package/dist/list.yml.webp +0 -0
- package/dist/message-alert-matte-glass-gradient.webp +0 -0
- package/dist/primitives/button.d.ts +10 -0
- package/dist/primitives/button.d.ts.map +1 -0
- package/dist/primitives/button.js +42 -0
- package/dist/primitives/input.d.ts +3 -0
- package/dist/primitives/input.d.ts.map +1 -0
- package/dist/primitives/input.js +18 -0
- package/dist/primitives/select.d.ts +16 -0
- package/dist/primitives/select.d.ts.map +1 -0
- package/dist/primitives/select.js +196 -0
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +21 -20
- package/dist/primitives/textarea.d.ts +3 -0
- package/dist/primitives/textarea.d.ts.map +1 -0
- package/dist/primitives/textarea.js +16 -0
- package/dist/{proxy-DD79Ok6n.js → proxy-C9AqCss6.js} +1 -1
- package/dist/speech-bubble-fluid-glass-gradient.webp +0 -0
- package/dist/styles/main.css +1 -1
- package/dist/utils/formFieldUtils.js +1 -1
- package/dist/utils/twUtils.js +2728 -2
- package/package.json +13 -8
- package/dist/Accordion/AccordionBase.d.ts +0 -42
- package/dist/Accordion/AccordionBase.js +0 -225
- package/dist/Badge/BadgeBase.d.ts +0 -13
- package/dist/Badge/BadgeBase.js +0 -35
- package/dist/PasswordInput-ClY_hxuN.js +0 -261
- package/dist/components/Accordion/AccordionBase.d.ts +0 -42
- package/dist/components/Accordion/AccordionBase.d.ts.map +0 -1
- package/dist/components/Badge/BadgeBase.d.ts +0 -13
- package/dist/components/Badge/BadgeBase.d.ts.map +0 -1
- package/dist/index-CA7haECj.js +0 -248
- package/dist/index-CbXx14YO.js +0 -59
- package/dist/index-VXXKXen4.js +0 -15
- package/dist/index-cCg4yNa8.js +0 -132
- package/dist/primitives/label.d.ts +0 -5
- package/dist/primitives/label.d.ts.map +0 -1
- package/dist/primitives/label.js +0 -27
- package/dist/twUtils-CRiPKpXj.js +0 -2743
package/dist/Select.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
|
-
import {
|
|
3
|
+
import { jsxs as r, jsx as e, Fragment as v } from "react/jsx-runtime";
|
|
4
4
|
import "./Icons/AnnotationsIcon.js";
|
|
5
5
|
import "./Icons/CalendarIcon.js";
|
|
6
6
|
import "./Icons/CheckCircleIcon.js";
|
|
7
7
|
import "./Icons/CheckSquareIcon.js";
|
|
8
|
-
import { CheckmarkIcon as
|
|
9
|
-
import { ChevronDownIcon as
|
|
8
|
+
import { CheckmarkIcon as H } from "./Icons/CheckmarkIcon.js";
|
|
9
|
+
import { ChevronDownIcon as l } from "./Icons/ChevronDownIcon.js";
|
|
10
10
|
import "./Icons/ChevronUpIcon.js";
|
|
11
11
|
import "./Icons/ClockIcon.js";
|
|
12
12
|
import "./Icons/CloseCircleIcon.js";
|
|
@@ -28,9 +28,10 @@ import "./Icons/LabelIcon.js";
|
|
|
28
28
|
import "./Icons/LassoIcon.js";
|
|
29
29
|
import "./Icons/LineToolIcon.js";
|
|
30
30
|
import "./Icons/LiveViewIcon.js";
|
|
31
|
-
import { LoaderIcon as
|
|
31
|
+
import { LoaderIcon as U } from "./Icons/LoaderIcon.js";
|
|
32
32
|
import "./Icons/LocationIcon.js";
|
|
33
33
|
import "./Icons/LogoutIcon.js";
|
|
34
|
+
import "./Icons/MessagesIcon.js";
|
|
34
35
|
import "./Icons/MetadataIcon.js";
|
|
35
36
|
import "./Icons/MinusIcon.js";
|
|
36
37
|
import "./Icons/OntologyIcon.js";
|
|
@@ -48,899 +49,100 @@ import "./Icons/WarningIcon.js";
|
|
|
48
49
|
import "./Icons/ZoomAllIcon.js";
|
|
49
50
|
import "./Icons/ZoomXIcon.js";
|
|
50
51
|
import "./Icons/ZoomYIcon.js";
|
|
51
|
-
import { Label as
|
|
52
|
-
import
|
|
53
|
-
import {
|
|
54
|
-
import
|
|
55
|
-
import {
|
|
56
|
-
|
|
57
|
-
import { D as vt } from "./index-cCg4yNa8.js";
|
|
58
|
-
import { h as St, u as wt, R as xt, F as Ct } from "./index-DUK1rxhf.js";
|
|
59
|
-
import { c as Oe, R as yt, a as It, C as bt, A as Tt } from "./index-FeGk8zep.js";
|
|
60
|
-
import { V as Nt } from "./index-Cfyte2YO.js";
|
|
61
|
-
import { useFormFieldId as Pt, useFormFieldState as Rt, getAriaProps as Et, getErrorMessageId as _t, groupOptions as Mt, getFormFieldCSSProperties as Ot, getStateClasses as At, getTriggerClasses as Dt, ErrorMessage as Lt, LoadingState as kt, EmptyState as Vt, getOptionClasses as Bt } from "./utils/formFieldUtils.js";
|
|
62
|
-
import { c as de } from "./twUtils-CRiPKpXj.js";
|
|
63
|
-
function Ee(r, [a, e]) {
|
|
64
|
-
return Math.min(e, Math.max(a, r));
|
|
65
|
-
}
|
|
66
|
-
var Ht = [" ", "Enter", "ArrowUp", "ArrowDown"], Ft = [" ", "Enter"], ee = "Select", [ue, me, Ut] = ht(ee), [ne] = pt(ee, [
|
|
67
|
-
Ut,
|
|
68
|
-
Oe
|
|
69
|
-
]), fe = Oe(), [Wt, $] = ne(ee), [Kt, zt] = ne(ee), Ae = (r) => {
|
|
70
|
-
const {
|
|
71
|
-
__scopeSelect: a,
|
|
72
|
-
children: e,
|
|
73
|
-
open: c,
|
|
74
|
-
defaultOpen: l,
|
|
75
|
-
onOpenChange: p,
|
|
76
|
-
value: o,
|
|
77
|
-
defaultValue: s,
|
|
78
|
-
onValueChange: i,
|
|
79
|
-
dir: m,
|
|
80
|
-
name: v,
|
|
81
|
-
autoComplete: w,
|
|
82
|
-
disabled: T,
|
|
83
|
-
required: I,
|
|
84
|
-
form: C
|
|
85
|
-
} = r, d = fe(a), [h, S] = t.useState(null), [u, g] = t.useState(null), [z, M] = t.useState(!1), Z = ft(m), [P, O] = Re({
|
|
86
|
-
prop: c,
|
|
87
|
-
defaultProp: l ?? !1,
|
|
88
|
-
onChange: p,
|
|
89
|
-
caller: ee
|
|
90
|
-
}), [H, G] = Re({
|
|
91
|
-
prop: o,
|
|
92
|
-
defaultProp: s,
|
|
93
|
-
onChange: i,
|
|
94
|
-
caller: ee
|
|
95
|
-
}), k = t.useRef(null), F = h ? C || !!h.closest("form") : !0, [U, V] = t.useState(/* @__PURE__ */ new Set()), W = Array.from(U).map((E) => E.props.value).join(";");
|
|
96
|
-
return /* @__PURE__ */ n(yt, { ...d, children: /* @__PURE__ */ B(
|
|
97
|
-
Wt,
|
|
98
|
-
{
|
|
99
|
-
required: I,
|
|
100
|
-
scope: a,
|
|
101
|
-
trigger: h,
|
|
102
|
-
onTriggerChange: S,
|
|
103
|
-
valueNode: u,
|
|
104
|
-
onValueNodeChange: g,
|
|
105
|
-
valueNodeHasChildren: z,
|
|
106
|
-
onValueNodeHasChildrenChange: M,
|
|
107
|
-
contentId: Ne(),
|
|
108
|
-
value: H,
|
|
109
|
-
onValueChange: G,
|
|
110
|
-
open: P,
|
|
111
|
-
onOpenChange: O,
|
|
112
|
-
dir: Z,
|
|
113
|
-
triggerPointerDownPosRef: k,
|
|
114
|
-
disabled: T,
|
|
115
|
-
children: [
|
|
116
|
-
/* @__PURE__ */ n(ue.Provider, { scope: a, children: /* @__PURE__ */ n(
|
|
117
|
-
Kt,
|
|
118
|
-
{
|
|
119
|
-
scope: r.__scopeSelect,
|
|
120
|
-
onNativeOptionAdd: t.useCallback((E) => {
|
|
121
|
-
V((b) => new Set(b).add(E));
|
|
122
|
-
}, []),
|
|
123
|
-
onNativeOptionRemove: t.useCallback((E) => {
|
|
124
|
-
V((b) => {
|
|
125
|
-
const A = new Set(b);
|
|
126
|
-
return A.delete(E), A;
|
|
127
|
-
});
|
|
128
|
-
}, []),
|
|
129
|
-
children: e
|
|
130
|
-
}
|
|
131
|
-
) }),
|
|
132
|
-
F ? /* @__PURE__ */ B(
|
|
133
|
-
nt,
|
|
134
|
-
{
|
|
135
|
-
"aria-hidden": !0,
|
|
136
|
-
required: I,
|
|
137
|
-
tabIndex: -1,
|
|
138
|
-
name: v,
|
|
139
|
-
autoComplete: w,
|
|
140
|
-
value: H,
|
|
141
|
-
onChange: (E) => G(E.target.value),
|
|
142
|
-
disabled: T,
|
|
143
|
-
form: C,
|
|
144
|
-
children: [
|
|
145
|
-
H === void 0 ? /* @__PURE__ */ n("option", { value: "" }) : null,
|
|
146
|
-
Array.from(U)
|
|
147
|
-
]
|
|
148
|
-
},
|
|
149
|
-
W
|
|
150
|
-
) : null
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
) });
|
|
154
|
-
};
|
|
155
|
-
Ae.displayName = ee;
|
|
156
|
-
var De = "SelectTrigger", Le = t.forwardRef(
|
|
157
|
-
(r, a) => {
|
|
158
|
-
const { __scopeSelect: e, disabled: c = !1, ...l } = r, p = fe(e), o = $(De, e), s = o.disabled || c, i = Y(a, o.onTriggerChange), m = me(e), v = t.useRef("touch"), [w, T, I] = st((d) => {
|
|
159
|
-
const h = m().filter((g) => !g.disabled), S = h.find((g) => g.value === o.value), u = it(h, d, S);
|
|
160
|
-
u !== void 0 && o.onValueChange(u.value);
|
|
161
|
-
}), C = (d) => {
|
|
162
|
-
s || (o.onOpenChange(!0), I()), d && (o.triggerPointerDownPosRef.current = {
|
|
163
|
-
x: Math.round(d.pageX),
|
|
164
|
-
y: Math.round(d.pageY)
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
return /* @__PURE__ */ n(It, { asChild: !0, ...p, children: /* @__PURE__ */ n(
|
|
168
|
-
L.button,
|
|
169
|
-
{
|
|
170
|
-
type: "button",
|
|
171
|
-
role: "combobox",
|
|
172
|
-
"aria-controls": o.contentId,
|
|
173
|
-
"aria-expanded": o.open,
|
|
174
|
-
"aria-required": o.required,
|
|
175
|
-
"aria-autocomplete": "none",
|
|
176
|
-
dir: o.dir,
|
|
177
|
-
"data-state": o.open ? "open" : "closed",
|
|
178
|
-
disabled: s,
|
|
179
|
-
"data-disabled": s ? "" : void 0,
|
|
180
|
-
"data-placeholder": rt(o.value) ? "" : void 0,
|
|
181
|
-
...l,
|
|
182
|
-
ref: i,
|
|
183
|
-
onClick: _(l.onClick, (d) => {
|
|
184
|
-
d.currentTarget.focus(), v.current !== "mouse" && C(d);
|
|
185
|
-
}),
|
|
186
|
-
onPointerDown: _(l.onPointerDown, (d) => {
|
|
187
|
-
v.current = d.pointerType;
|
|
188
|
-
const h = d.target;
|
|
189
|
-
h.hasPointerCapture(d.pointerId) && h.releasePointerCapture(d.pointerId), d.button === 0 && d.ctrlKey === !1 && d.pointerType === "mouse" && (C(d), d.preventDefault());
|
|
190
|
-
}),
|
|
191
|
-
onKeyDown: _(l.onKeyDown, (d) => {
|
|
192
|
-
const h = w.current !== "";
|
|
193
|
-
!(d.ctrlKey || d.altKey || d.metaKey) && d.key.length === 1 && T(d.key), !(h && d.key === " ") && Ht.includes(d.key) && (C(), d.preventDefault());
|
|
194
|
-
})
|
|
195
|
-
}
|
|
196
|
-
) });
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
Le.displayName = De;
|
|
200
|
-
var ke = "SelectValue", Ve = t.forwardRef(
|
|
201
|
-
(r, a) => {
|
|
202
|
-
const { __scopeSelect: e, className: c, style: l, children: p, placeholder: o = "", ...s } = r, i = $(ke, e), { onValueNodeHasChildrenChange: m } = i, v = p !== void 0, w = Y(a, i.onValueNodeChange);
|
|
203
|
-
return q(() => {
|
|
204
|
-
m(v);
|
|
205
|
-
}, [m, v]), /* @__PURE__ */ n(
|
|
206
|
-
L.span,
|
|
207
|
-
{
|
|
208
|
-
...s,
|
|
209
|
-
ref: w,
|
|
210
|
-
style: { pointerEvents: "none" },
|
|
211
|
-
children: rt(i.value) ? /* @__PURE__ */ n(ae, { children: o }) : p
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
);
|
|
216
|
-
Ve.displayName = ke;
|
|
217
|
-
var Gt = "SelectIcon", Be = t.forwardRef(
|
|
218
|
-
(r, a) => {
|
|
219
|
-
const { __scopeSelect: e, children: c, ...l } = r;
|
|
220
|
-
return /* @__PURE__ */ n(L.span, { "aria-hidden": !0, ...l, ref: a, children: c || "▼" });
|
|
221
|
-
}
|
|
222
|
-
);
|
|
223
|
-
Be.displayName = Gt;
|
|
224
|
-
var te = "SelectContent", He = t.forwardRef(
|
|
225
|
-
(r, a) => {
|
|
226
|
-
const e = $(te, r.__scopeSelect), [c, l] = t.useState();
|
|
227
|
-
if (q(() => {
|
|
228
|
-
l(new DocumentFragment());
|
|
229
|
-
}, []), !e.open) {
|
|
230
|
-
const p = c;
|
|
231
|
-
return p ? Me.createPortal(
|
|
232
|
-
/* @__PURE__ */ n(Fe, { scope: r.__scopeSelect, children: /* @__PURE__ */ n(ue.Slot, { scope: r.__scopeSelect, children: /* @__PURE__ */ n("div", { children: r.children }) }) }),
|
|
233
|
-
p
|
|
234
|
-
) : null;
|
|
235
|
-
}
|
|
236
|
-
return /* @__PURE__ */ n(Ue, { ...r, ref: a });
|
|
237
|
-
}
|
|
238
|
-
);
|
|
239
|
-
He.displayName = te;
|
|
240
|
-
var K = 10, [Fe, X] = ne(te), jt = "SelectContentImpl", Yt = mt("SelectContent.RemoveScroll"), Ue = t.forwardRef(
|
|
241
|
-
(r, a) => {
|
|
242
|
-
const {
|
|
243
|
-
__scopeSelect: e,
|
|
244
|
-
position: c = "item-aligned",
|
|
245
|
-
onCloseAutoFocus: l,
|
|
246
|
-
onEscapeKeyDown: p,
|
|
247
|
-
onPointerDownOutside: o,
|
|
248
|
-
//
|
|
249
|
-
// PopperContent props
|
|
250
|
-
side: s,
|
|
251
|
-
sideOffset: i,
|
|
252
|
-
align: m,
|
|
253
|
-
alignOffset: v,
|
|
254
|
-
arrowPadding: w,
|
|
255
|
-
collisionBoundary: T,
|
|
256
|
-
collisionPadding: I,
|
|
257
|
-
sticky: C,
|
|
258
|
-
hideWhenDetached: d,
|
|
259
|
-
avoidCollisions: h,
|
|
260
|
-
//
|
|
261
|
-
...S
|
|
262
|
-
} = r, u = $(te, e), [g, z] = t.useState(null), [M, Z] = t.useState(null), P = Y(a, (f) => z(f)), [O, H] = t.useState(null), [G, k] = t.useState(
|
|
263
|
-
null
|
|
264
|
-
), F = me(e), [U, V] = t.useState(!1), W = t.useRef(!1);
|
|
265
|
-
t.useEffect(() => {
|
|
266
|
-
if (g) return St(g);
|
|
267
|
-
}, [g]), wt();
|
|
268
|
-
const E = t.useCallback(
|
|
269
|
-
(f) => {
|
|
270
|
-
const [N, ...D] = F().map((R) => R.ref.current), [x] = D.slice(-1), y = document.activeElement;
|
|
271
|
-
for (const R of f)
|
|
272
|
-
if (R === y || (R?.scrollIntoView({ block: "nearest" }), R === N && M && (M.scrollTop = 0), R === x && M && (M.scrollTop = M.scrollHeight), R?.focus(), document.activeElement !== y)) return;
|
|
273
|
-
},
|
|
274
|
-
[F, M]
|
|
275
|
-
), b = t.useCallback(
|
|
276
|
-
() => E([O, g]),
|
|
277
|
-
[E, O, g]
|
|
278
|
-
);
|
|
279
|
-
t.useEffect(() => {
|
|
280
|
-
U && b();
|
|
281
|
-
}, [U, b]);
|
|
282
|
-
const { onOpenChange: A, triggerPointerDownPosRef: j } = u;
|
|
283
|
-
t.useEffect(() => {
|
|
284
|
-
if (g) {
|
|
285
|
-
let f = { x: 0, y: 0 };
|
|
286
|
-
const N = (x) => {
|
|
287
|
-
f = {
|
|
288
|
-
x: Math.abs(Math.round(x.pageX) - (j.current?.x ?? 0)),
|
|
289
|
-
y: Math.abs(Math.round(x.pageY) - (j.current?.y ?? 0))
|
|
290
|
-
};
|
|
291
|
-
}, D = (x) => {
|
|
292
|
-
f.x <= 10 && f.y <= 10 ? x.preventDefault() : g.contains(x.target) || A(!1), document.removeEventListener("pointermove", N), j.current = null;
|
|
293
|
-
};
|
|
294
|
-
return j.current !== null && (document.addEventListener("pointermove", N), document.addEventListener("pointerup", D, { capture: !0, once: !0 })), () => {
|
|
295
|
-
document.removeEventListener("pointermove", N), document.removeEventListener("pointerup", D, { capture: !0 });
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
}, [g, A, j]), t.useEffect(() => {
|
|
299
|
-
const f = () => A(!1);
|
|
300
|
-
return window.addEventListener("blur", f), window.addEventListener("resize", f), () => {
|
|
301
|
-
window.removeEventListener("blur", f), window.removeEventListener("resize", f);
|
|
302
|
-
};
|
|
303
|
-
}, [A]);
|
|
304
|
-
const [re, le] = st((f) => {
|
|
305
|
-
const N = F().filter((y) => !y.disabled), D = N.find((y) => y.ref.current === document.activeElement), x = it(N, f, D);
|
|
306
|
-
x && setTimeout(() => x.ref.current.focus());
|
|
307
|
-
}), he = t.useCallback(
|
|
308
|
-
(f, N, D) => {
|
|
309
|
-
const x = !W.current && !D;
|
|
310
|
-
(u.value !== void 0 && u.value === N || x) && (H(f), x && (W.current = !0));
|
|
311
|
-
},
|
|
312
|
-
[u.value]
|
|
313
|
-
), ge = t.useCallback(() => g?.focus(), [g]), oe = t.useCallback(
|
|
314
|
-
(f, N, D) => {
|
|
315
|
-
const x = !W.current && !D;
|
|
316
|
-
(u.value !== void 0 && u.value === N || x) && k(f);
|
|
317
|
-
},
|
|
318
|
-
[u.value]
|
|
319
|
-
), ce = c === "popper" ? Ce : We, se = ce === Ce ? {
|
|
320
|
-
side: s,
|
|
321
|
-
sideOffset: i,
|
|
322
|
-
align: m,
|
|
323
|
-
alignOffset: v,
|
|
324
|
-
arrowPadding: w,
|
|
325
|
-
collisionBoundary: T,
|
|
326
|
-
collisionPadding: I,
|
|
327
|
-
sticky: C,
|
|
328
|
-
hideWhenDetached: d,
|
|
329
|
-
avoidCollisions: h
|
|
330
|
-
} : {};
|
|
331
|
-
return /* @__PURE__ */ n(
|
|
332
|
-
Fe,
|
|
333
|
-
{
|
|
334
|
-
scope: e,
|
|
335
|
-
content: g,
|
|
336
|
-
viewport: M,
|
|
337
|
-
onViewportChange: Z,
|
|
338
|
-
itemRefCallback: he,
|
|
339
|
-
selectedItem: O,
|
|
340
|
-
onItemLeave: ge,
|
|
341
|
-
itemTextRefCallback: oe,
|
|
342
|
-
focusSelectedItem: b,
|
|
343
|
-
selectedItemText: G,
|
|
344
|
-
position: c,
|
|
345
|
-
isPositioned: U,
|
|
346
|
-
searchRef: re,
|
|
347
|
-
children: /* @__PURE__ */ n(xt, { as: Yt, allowPinchZoom: !0, children: /* @__PURE__ */ n(
|
|
348
|
-
Ct,
|
|
349
|
-
{
|
|
350
|
-
asChild: !0,
|
|
351
|
-
trapped: u.open,
|
|
352
|
-
onMountAutoFocus: (f) => {
|
|
353
|
-
f.preventDefault();
|
|
354
|
-
},
|
|
355
|
-
onUnmountAutoFocus: _(l, (f) => {
|
|
356
|
-
u.trigger?.focus({ preventScroll: !0 }), f.preventDefault();
|
|
357
|
-
}),
|
|
358
|
-
children: /* @__PURE__ */ n(
|
|
359
|
-
vt,
|
|
360
|
-
{
|
|
361
|
-
asChild: !0,
|
|
362
|
-
disableOutsidePointerEvents: !0,
|
|
363
|
-
onEscapeKeyDown: p,
|
|
364
|
-
onPointerDownOutside: o,
|
|
365
|
-
onFocusOutside: (f) => f.preventDefault(),
|
|
366
|
-
onDismiss: () => u.onOpenChange(!1),
|
|
367
|
-
children: /* @__PURE__ */ n(
|
|
368
|
-
ce,
|
|
369
|
-
{
|
|
370
|
-
role: "listbox",
|
|
371
|
-
id: u.contentId,
|
|
372
|
-
"data-state": u.open ? "open" : "closed",
|
|
373
|
-
dir: u.dir,
|
|
374
|
-
onContextMenu: (f) => f.preventDefault(),
|
|
375
|
-
...S,
|
|
376
|
-
...se,
|
|
377
|
-
onPlaced: () => V(!0),
|
|
378
|
-
ref: P,
|
|
379
|
-
style: {
|
|
380
|
-
// flex layout so we can place the scroll buttons properly
|
|
381
|
-
display: "flex",
|
|
382
|
-
flexDirection: "column",
|
|
383
|
-
// reset the outline by default as the content MAY get focused
|
|
384
|
-
outline: "none",
|
|
385
|
-
...S.style
|
|
386
|
-
},
|
|
387
|
-
onKeyDown: _(S.onKeyDown, (f) => {
|
|
388
|
-
const N = f.ctrlKey || f.altKey || f.metaKey;
|
|
389
|
-
if (f.key === "Tab" && f.preventDefault(), !N && f.key.length === 1 && le(f.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(f.key)) {
|
|
390
|
-
let x = F().filter((y) => !y.disabled).map((y) => y.ref.current);
|
|
391
|
-
if (["ArrowUp", "End"].includes(f.key) && (x = x.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(f.key)) {
|
|
392
|
-
const y = f.target, R = x.indexOf(y);
|
|
393
|
-
x = x.slice(R + 1);
|
|
394
|
-
}
|
|
395
|
-
setTimeout(() => E(x)), f.preventDefault();
|
|
396
|
-
}
|
|
397
|
-
})
|
|
398
|
-
}
|
|
399
|
-
)
|
|
400
|
-
}
|
|
401
|
-
)
|
|
402
|
-
}
|
|
403
|
-
) })
|
|
404
|
-
}
|
|
405
|
-
);
|
|
406
|
-
}
|
|
407
|
-
);
|
|
408
|
-
Ue.displayName = jt;
|
|
409
|
-
var qt = "SelectItemAlignedPosition", We = t.forwardRef((r, a) => {
|
|
410
|
-
const { __scopeSelect: e, onPlaced: c, ...l } = r, p = $(te, e), o = X(te, e), [s, i] = t.useState(null), [m, v] = t.useState(null), w = Y(a, (P) => v(P)), T = me(e), I = t.useRef(!1), C = t.useRef(!0), { viewport: d, selectedItem: h, selectedItemText: S, focusSelectedItem: u } = o, g = t.useCallback(() => {
|
|
411
|
-
if (p.trigger && p.valueNode && s && m && d && h && S) {
|
|
412
|
-
const P = p.trigger.getBoundingClientRect(), O = m.getBoundingClientRect(), H = p.valueNode.getBoundingClientRect(), G = S.getBoundingClientRect();
|
|
413
|
-
if (p.dir !== "rtl") {
|
|
414
|
-
const y = G.left - O.left, R = H.left - y, J = P.left - R, Q = P.width + J, ve = Math.max(Q, O.width), Se = window.innerWidth - K, we = Ee(R, [
|
|
415
|
-
K,
|
|
416
|
-
// Prevents the content from going off the starting edge of the
|
|
417
|
-
// viewport. It may still go off the ending edge, but this can be
|
|
418
|
-
// controlled by the user since they may want to manage overflow in a
|
|
419
|
-
// specific way.
|
|
420
|
-
// https://github.com/radix-ui/primitives/issues/2049
|
|
421
|
-
Math.max(K, Se - ve)
|
|
422
|
-
]);
|
|
423
|
-
s.style.minWidth = Q + "px", s.style.left = we + "px";
|
|
424
|
-
} else {
|
|
425
|
-
const y = O.right - G.right, R = window.innerWidth - H.right - y, J = window.innerWidth - P.right - R, Q = P.width + J, ve = Math.max(Q, O.width), Se = window.innerWidth - K, we = Ee(R, [
|
|
426
|
-
K,
|
|
427
|
-
Math.max(K, Se - ve)
|
|
428
|
-
]);
|
|
429
|
-
s.style.minWidth = Q + "px", s.style.right = we + "px";
|
|
430
|
-
}
|
|
431
|
-
const k = T(), F = window.innerHeight - K * 2, U = d.scrollHeight, V = window.getComputedStyle(m), W = parseInt(V.borderTopWidth, 10), E = parseInt(V.paddingTop, 10), b = parseInt(V.borderBottomWidth, 10), A = parseInt(V.paddingBottom, 10), j = W + E + U + A + b, re = Math.min(h.offsetHeight * 5, j), le = window.getComputedStyle(d), he = parseInt(le.paddingTop, 10), ge = parseInt(le.paddingBottom, 10), oe = P.top + P.height / 2 - K, ce = F - oe, se = h.offsetHeight / 2, f = h.offsetTop + se, N = W + E + f, D = j - N;
|
|
432
|
-
if (N <= oe) {
|
|
433
|
-
const y = k.length > 0 && h === k[k.length - 1].ref.current;
|
|
434
|
-
s.style.bottom = "0px";
|
|
435
|
-
const R = m.clientHeight - d.offsetTop - d.offsetHeight, J = Math.max(
|
|
436
|
-
ce,
|
|
437
|
-
se + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
438
|
-
(y ? ge : 0) + R + b
|
|
439
|
-
), Q = N + J;
|
|
440
|
-
s.style.height = Q + "px";
|
|
441
|
-
} else {
|
|
442
|
-
const y = k.length > 0 && h === k[0].ref.current;
|
|
443
|
-
s.style.top = "0px";
|
|
444
|
-
const J = Math.max(
|
|
445
|
-
oe,
|
|
446
|
-
W + d.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
447
|
-
(y ? he : 0) + se
|
|
448
|
-
) + D;
|
|
449
|
-
s.style.height = J + "px", d.scrollTop = N - oe + d.offsetTop;
|
|
450
|
-
}
|
|
451
|
-
s.style.margin = `${K}px 0`, s.style.minHeight = re + "px", s.style.maxHeight = F + "px", c?.(), requestAnimationFrame(() => I.current = !0);
|
|
452
|
-
}
|
|
453
|
-
}, [
|
|
454
|
-
T,
|
|
455
|
-
p.trigger,
|
|
456
|
-
p.valueNode,
|
|
457
|
-
s,
|
|
458
|
-
m,
|
|
459
|
-
d,
|
|
460
|
-
h,
|
|
461
|
-
S,
|
|
462
|
-
p.dir,
|
|
463
|
-
c
|
|
464
|
-
]);
|
|
465
|
-
q(() => g(), [g]);
|
|
466
|
-
const [z, M] = t.useState();
|
|
467
|
-
q(() => {
|
|
468
|
-
m && M(window.getComputedStyle(m).zIndex);
|
|
469
|
-
}, [m]);
|
|
470
|
-
const Z = t.useCallback(
|
|
471
|
-
(P) => {
|
|
472
|
-
P && C.current === !0 && (g(), u?.(), C.current = !1);
|
|
473
|
-
},
|
|
474
|
-
[g, u]
|
|
475
|
-
);
|
|
476
|
-
return /* @__PURE__ */ n(
|
|
477
|
-
Xt,
|
|
478
|
-
{
|
|
479
|
-
scope: e,
|
|
480
|
-
contentWrapper: s,
|
|
481
|
-
shouldExpandOnScrollRef: I,
|
|
482
|
-
onScrollButtonChange: Z,
|
|
483
|
-
children: /* @__PURE__ */ n(
|
|
484
|
-
"div",
|
|
485
|
-
{
|
|
486
|
-
ref: i,
|
|
487
|
-
style: {
|
|
488
|
-
display: "flex",
|
|
489
|
-
flexDirection: "column",
|
|
490
|
-
position: "fixed",
|
|
491
|
-
zIndex: z
|
|
492
|
-
},
|
|
493
|
-
children: /* @__PURE__ */ n(
|
|
494
|
-
L.div,
|
|
495
|
-
{
|
|
496
|
-
...l,
|
|
497
|
-
ref: w,
|
|
498
|
-
style: {
|
|
499
|
-
// When we get the height of the content, it includes borders. If we were to set
|
|
500
|
-
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
501
|
-
boxSizing: "border-box",
|
|
502
|
-
// We need to ensure the content doesn't get taller than the wrapper
|
|
503
|
-
maxHeight: "100%",
|
|
504
|
-
...l.style
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
)
|
|
508
|
-
}
|
|
509
|
-
)
|
|
510
|
-
}
|
|
511
|
-
);
|
|
512
|
-
});
|
|
513
|
-
We.displayName = qt;
|
|
514
|
-
var $t = "SelectPopperPosition", Ce = t.forwardRef((r, a) => {
|
|
515
|
-
const {
|
|
516
|
-
__scopeSelect: e,
|
|
517
|
-
align: c = "start",
|
|
518
|
-
collisionPadding: l = K,
|
|
519
|
-
...p
|
|
520
|
-
} = r, o = fe(e);
|
|
521
|
-
return /* @__PURE__ */ n(
|
|
522
|
-
bt,
|
|
523
|
-
{
|
|
524
|
-
...o,
|
|
525
|
-
...p,
|
|
526
|
-
ref: a,
|
|
527
|
-
align: c,
|
|
528
|
-
collisionPadding: l,
|
|
529
|
-
style: {
|
|
530
|
-
// Ensure border-box for floating-ui calculations
|
|
531
|
-
boxSizing: "border-box",
|
|
532
|
-
...p.style,
|
|
533
|
-
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
534
|
-
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
535
|
-
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
536
|
-
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
|
|
537
|
-
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
);
|
|
541
|
-
});
|
|
542
|
-
Ce.displayName = $t;
|
|
543
|
-
var [Xt, Pe] = ne(te, {}), ye = "SelectViewport", Ke = t.forwardRef(
|
|
544
|
-
(r, a) => {
|
|
545
|
-
const { __scopeSelect: e, nonce: c, ...l } = r, p = X(ye, e), o = Pe(ye, e), s = Y(a, p.onViewportChange), i = t.useRef(0);
|
|
546
|
-
return /* @__PURE__ */ B(ae, { children: [
|
|
547
|
-
/* @__PURE__ */ n(
|
|
548
|
-
"style",
|
|
549
|
-
{
|
|
550
|
-
dangerouslySetInnerHTML: {
|
|
551
|
-
__html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
|
|
552
|
-
},
|
|
553
|
-
nonce: c
|
|
554
|
-
}
|
|
555
|
-
),
|
|
556
|
-
/* @__PURE__ */ n(ue.Slot, { scope: e, children: /* @__PURE__ */ n(
|
|
557
|
-
L.div,
|
|
558
|
-
{
|
|
559
|
-
"data-radix-select-viewport": "",
|
|
560
|
-
role: "presentation",
|
|
561
|
-
...l,
|
|
562
|
-
ref: s,
|
|
563
|
-
style: {
|
|
564
|
-
// we use position: 'relative' here on the `viewport` so that when we call
|
|
565
|
-
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
566
|
-
// (independent of the scrollUpButton).
|
|
567
|
-
position: "relative",
|
|
568
|
-
flex: 1,
|
|
569
|
-
// Viewport should only be scrollable in the vertical direction.
|
|
570
|
-
// This won't work in vertical writing modes, so we'll need to
|
|
571
|
-
// revisit this if/when that is supported
|
|
572
|
-
// https://developer.chrome.com/blog/vertical-form-controls
|
|
573
|
-
overflow: "hidden auto",
|
|
574
|
-
...l.style
|
|
575
|
-
},
|
|
576
|
-
onScroll: _(l.onScroll, (m) => {
|
|
577
|
-
const v = m.currentTarget, { contentWrapper: w, shouldExpandOnScrollRef: T } = o;
|
|
578
|
-
if (T?.current && w) {
|
|
579
|
-
const I = Math.abs(i.current - v.scrollTop);
|
|
580
|
-
if (I > 0) {
|
|
581
|
-
const C = window.innerHeight - K * 2, d = parseFloat(w.style.minHeight), h = parseFloat(w.style.height), S = Math.max(d, h);
|
|
582
|
-
if (S < C) {
|
|
583
|
-
const u = S + I, g = Math.min(C, u), z = u - g;
|
|
584
|
-
w.style.height = g + "px", w.style.bottom === "0px" && (v.scrollTop = z > 0 ? z : 0, w.style.justifyContent = "flex-end");
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
i.current = v.scrollTop;
|
|
589
|
-
})
|
|
590
|
-
}
|
|
591
|
-
) })
|
|
592
|
-
] });
|
|
593
|
-
}
|
|
594
|
-
);
|
|
595
|
-
Ke.displayName = ye;
|
|
596
|
-
var ze = "SelectGroup", [Zt, Jt] = ne(ze), Ge = t.forwardRef(
|
|
597
|
-
(r, a) => {
|
|
598
|
-
const { __scopeSelect: e, ...c } = r, l = Ne();
|
|
599
|
-
return /* @__PURE__ */ n(Zt, { scope: e, id: l, children: /* @__PURE__ */ n(L.div, { role: "group", "aria-labelledby": l, ...c, ref: a }) });
|
|
600
|
-
}
|
|
601
|
-
);
|
|
602
|
-
Ge.displayName = ze;
|
|
603
|
-
var je = "SelectLabel", Ye = t.forwardRef(
|
|
604
|
-
(r, a) => {
|
|
605
|
-
const { __scopeSelect: e, ...c } = r, l = Jt(je, e);
|
|
606
|
-
return /* @__PURE__ */ n(L.div, { id: l.id, ...c, ref: a });
|
|
607
|
-
}
|
|
608
|
-
);
|
|
609
|
-
Ye.displayName = je;
|
|
610
|
-
var pe = "SelectItem", [Qt, qe] = ne(pe), $e = t.forwardRef(
|
|
611
|
-
(r, a) => {
|
|
612
|
-
const {
|
|
613
|
-
__scopeSelect: e,
|
|
614
|
-
value: c,
|
|
615
|
-
disabled: l = !1,
|
|
616
|
-
textValue: p,
|
|
617
|
-
...o
|
|
618
|
-
} = r, s = $(pe, e), i = X(pe, e), m = s.value === c, [v, w] = t.useState(p ?? ""), [T, I] = t.useState(!1), C = Y(
|
|
619
|
-
a,
|
|
620
|
-
(u) => i.itemRefCallback?.(u, c, l)
|
|
621
|
-
), d = Ne(), h = t.useRef("touch"), S = () => {
|
|
622
|
-
l || (s.onValueChange(c), s.onOpenChange(!1));
|
|
623
|
-
};
|
|
624
|
-
if (c === "")
|
|
625
|
-
throw new Error(
|
|
626
|
-
"A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
|
|
627
|
-
);
|
|
628
|
-
return /* @__PURE__ */ n(
|
|
629
|
-
Qt,
|
|
630
|
-
{
|
|
631
|
-
scope: e,
|
|
632
|
-
value: c,
|
|
633
|
-
disabled: l,
|
|
634
|
-
textId: d,
|
|
635
|
-
isSelected: m,
|
|
636
|
-
onItemTextChange: t.useCallback((u) => {
|
|
637
|
-
w((g) => g || (u?.textContent ?? "").trim());
|
|
638
|
-
}, []),
|
|
639
|
-
children: /* @__PURE__ */ n(
|
|
640
|
-
ue.ItemSlot,
|
|
641
|
-
{
|
|
642
|
-
scope: e,
|
|
643
|
-
value: c,
|
|
644
|
-
disabled: l,
|
|
645
|
-
textValue: v,
|
|
646
|
-
children: /* @__PURE__ */ n(
|
|
647
|
-
L.div,
|
|
648
|
-
{
|
|
649
|
-
role: "option",
|
|
650
|
-
"aria-labelledby": d,
|
|
651
|
-
"data-highlighted": T ? "" : void 0,
|
|
652
|
-
"aria-selected": m && T,
|
|
653
|
-
"data-state": m ? "checked" : "unchecked",
|
|
654
|
-
"aria-disabled": l || void 0,
|
|
655
|
-
"data-disabled": l ? "" : void 0,
|
|
656
|
-
tabIndex: l ? void 0 : -1,
|
|
657
|
-
...o,
|
|
658
|
-
ref: C,
|
|
659
|
-
onFocus: _(o.onFocus, () => I(!0)),
|
|
660
|
-
onBlur: _(o.onBlur, () => I(!1)),
|
|
661
|
-
onClick: _(o.onClick, () => {
|
|
662
|
-
h.current !== "mouse" && S();
|
|
663
|
-
}),
|
|
664
|
-
onPointerUp: _(o.onPointerUp, () => {
|
|
665
|
-
h.current === "mouse" && S();
|
|
666
|
-
}),
|
|
667
|
-
onPointerDown: _(o.onPointerDown, (u) => {
|
|
668
|
-
h.current = u.pointerType;
|
|
669
|
-
}),
|
|
670
|
-
onPointerMove: _(o.onPointerMove, (u) => {
|
|
671
|
-
h.current = u.pointerType, l ? i.onItemLeave?.() : h.current === "mouse" && u.currentTarget.focus({ preventScroll: !0 });
|
|
672
|
-
}),
|
|
673
|
-
onPointerLeave: _(o.onPointerLeave, (u) => {
|
|
674
|
-
u.currentTarget === document.activeElement && i.onItemLeave?.();
|
|
675
|
-
}),
|
|
676
|
-
onKeyDown: _(o.onKeyDown, (u) => {
|
|
677
|
-
i.searchRef?.current !== "" && u.key === " " || (Ft.includes(u.key) && S(), u.key === " " && u.preventDefault());
|
|
678
|
-
})
|
|
679
|
-
}
|
|
680
|
-
)
|
|
681
|
-
}
|
|
682
|
-
)
|
|
683
|
-
}
|
|
684
|
-
);
|
|
685
|
-
}
|
|
686
|
-
);
|
|
687
|
-
$e.displayName = pe;
|
|
688
|
-
var ie = "SelectItemText", Xe = t.forwardRef(
|
|
689
|
-
(r, a) => {
|
|
690
|
-
const { __scopeSelect: e, className: c, style: l, ...p } = r, o = $(ie, e), s = X(ie, e), i = qe(ie, e), m = zt(ie, e), [v, w] = t.useState(null), T = Y(
|
|
691
|
-
a,
|
|
692
|
-
(S) => w(S),
|
|
693
|
-
i.onItemTextChange,
|
|
694
|
-
(S) => s.itemTextRefCallback?.(S, i.value, i.disabled)
|
|
695
|
-
), I = v?.textContent, C = t.useMemo(
|
|
696
|
-
() => /* @__PURE__ */ n("option", { value: i.value, disabled: i.disabled, children: I }, i.value),
|
|
697
|
-
[i.disabled, i.value, I]
|
|
698
|
-
), { onNativeOptionAdd: d, onNativeOptionRemove: h } = m;
|
|
699
|
-
return q(() => (d(C), () => h(C)), [d, h, C]), /* @__PURE__ */ B(ae, { children: [
|
|
700
|
-
/* @__PURE__ */ n(L.span, { id: i.textId, ...p, ref: T }),
|
|
701
|
-
i.isSelected && o.valueNode && !o.valueNodeHasChildren ? Me.createPortal(p.children, o.valueNode) : null
|
|
702
|
-
] });
|
|
703
|
-
}
|
|
704
|
-
);
|
|
705
|
-
Xe.displayName = ie;
|
|
706
|
-
var Ze = "SelectItemIndicator", Je = t.forwardRef(
|
|
707
|
-
(r, a) => {
|
|
708
|
-
const { __scopeSelect: e, ...c } = r;
|
|
709
|
-
return qe(Ze, e).isSelected ? /* @__PURE__ */ n(L.span, { "aria-hidden": !0, ...c, ref: a }) : null;
|
|
710
|
-
}
|
|
711
|
-
);
|
|
712
|
-
Je.displayName = Ze;
|
|
713
|
-
var Ie = "SelectScrollUpButton", Qe = t.forwardRef((r, a) => {
|
|
714
|
-
const e = X(Ie, r.__scopeSelect), c = Pe(Ie, r.__scopeSelect), [l, p] = t.useState(!1), o = Y(a, c.onScrollButtonChange);
|
|
715
|
-
return q(() => {
|
|
716
|
-
if (e.viewport && e.isPositioned) {
|
|
717
|
-
let s = function() {
|
|
718
|
-
const m = i.scrollTop > 0;
|
|
719
|
-
p(m);
|
|
720
|
-
};
|
|
721
|
-
const i = e.viewport;
|
|
722
|
-
return s(), i.addEventListener("scroll", s), () => i.removeEventListener("scroll", s);
|
|
723
|
-
}
|
|
724
|
-
}, [e.viewport, e.isPositioned]), l ? /* @__PURE__ */ n(
|
|
725
|
-
tt,
|
|
726
|
-
{
|
|
727
|
-
...r,
|
|
728
|
-
ref: o,
|
|
729
|
-
onAutoScroll: () => {
|
|
730
|
-
const { viewport: s, selectedItem: i } = e;
|
|
731
|
-
s && i && (s.scrollTop = s.scrollTop - i.offsetHeight);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
) : null;
|
|
735
|
-
});
|
|
736
|
-
Qe.displayName = Ie;
|
|
737
|
-
var be = "SelectScrollDownButton", et = t.forwardRef((r, a) => {
|
|
738
|
-
const e = X(be, r.__scopeSelect), c = Pe(be, r.__scopeSelect), [l, p] = t.useState(!1), o = Y(a, c.onScrollButtonChange);
|
|
739
|
-
return q(() => {
|
|
740
|
-
if (e.viewport && e.isPositioned) {
|
|
741
|
-
let s = function() {
|
|
742
|
-
const m = i.scrollHeight - i.clientHeight, v = Math.ceil(i.scrollTop) < m;
|
|
743
|
-
p(v);
|
|
744
|
-
};
|
|
745
|
-
const i = e.viewport;
|
|
746
|
-
return s(), i.addEventListener("scroll", s), () => i.removeEventListener("scroll", s);
|
|
747
|
-
}
|
|
748
|
-
}, [e.viewport, e.isPositioned]), l ? /* @__PURE__ */ n(
|
|
749
|
-
tt,
|
|
750
|
-
{
|
|
751
|
-
...r,
|
|
752
|
-
ref: o,
|
|
753
|
-
onAutoScroll: () => {
|
|
754
|
-
const { viewport: s, selectedItem: i } = e;
|
|
755
|
-
s && i && (s.scrollTop = s.scrollTop + i.offsetHeight);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
) : null;
|
|
759
|
-
});
|
|
760
|
-
et.displayName = be;
|
|
761
|
-
var tt = t.forwardRef((r, a) => {
|
|
762
|
-
const { __scopeSelect: e, onAutoScroll: c, ...l } = r, p = X("SelectScrollButton", e), o = t.useRef(null), s = me(e), i = t.useCallback(() => {
|
|
763
|
-
o.current !== null && (window.clearInterval(o.current), o.current = null);
|
|
764
|
-
}, []);
|
|
765
|
-
return t.useEffect(() => () => i(), [i]), q(() => {
|
|
766
|
-
s().find((v) => v.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
767
|
-
}, [s]), /* @__PURE__ */ n(
|
|
768
|
-
L.div,
|
|
769
|
-
{
|
|
770
|
-
"aria-hidden": !0,
|
|
771
|
-
...l,
|
|
772
|
-
ref: a,
|
|
773
|
-
style: { flexShrink: 0, ...l.style },
|
|
774
|
-
onPointerDown: _(l.onPointerDown, () => {
|
|
775
|
-
o.current === null && (o.current = window.setInterval(c, 50));
|
|
776
|
-
}),
|
|
777
|
-
onPointerMove: _(l.onPointerMove, () => {
|
|
778
|
-
p.onItemLeave?.(), o.current === null && (o.current = window.setInterval(c, 50));
|
|
779
|
-
}),
|
|
780
|
-
onPointerLeave: _(l.onPointerLeave, () => {
|
|
781
|
-
i();
|
|
782
|
-
})
|
|
783
|
-
}
|
|
784
|
-
);
|
|
785
|
-
}), eo = "SelectSeparator", ot = t.forwardRef(
|
|
786
|
-
(r, a) => {
|
|
787
|
-
const { __scopeSelect: e, ...c } = r;
|
|
788
|
-
return /* @__PURE__ */ n(L.div, { "aria-hidden": !0, ...c, ref: a });
|
|
789
|
-
}
|
|
790
|
-
);
|
|
791
|
-
ot.displayName = eo;
|
|
792
|
-
var Te = "SelectArrow", to = t.forwardRef(
|
|
793
|
-
(r, a) => {
|
|
794
|
-
const { __scopeSelect: e, ...c } = r, l = fe(e), p = $(Te, e), o = X(Te, e);
|
|
795
|
-
return p.open && o.position === "popper" ? /* @__PURE__ */ n(Tt, { ...l, ...c, ref: a }) : null;
|
|
796
|
-
}
|
|
797
|
-
);
|
|
798
|
-
to.displayName = Te;
|
|
799
|
-
var oo = "SelectBubbleInput", nt = t.forwardRef(
|
|
800
|
-
({ __scopeSelect: r, value: a, ...e }, c) => {
|
|
801
|
-
const l = t.useRef(null), p = Y(c, l), o = gt(a);
|
|
802
|
-
return t.useEffect(() => {
|
|
803
|
-
const s = l.current;
|
|
804
|
-
if (!s) return;
|
|
805
|
-
const i = window.HTMLSelectElement.prototype, v = Object.getOwnPropertyDescriptor(
|
|
806
|
-
i,
|
|
807
|
-
"value"
|
|
808
|
-
).set;
|
|
809
|
-
if (o !== a && v) {
|
|
810
|
-
const w = new Event("change", { bubbles: !0 });
|
|
811
|
-
v.call(s, a), s.dispatchEvent(w);
|
|
812
|
-
}
|
|
813
|
-
}, [o, a]), /* @__PURE__ */ n(
|
|
814
|
-
L.select,
|
|
815
|
-
{
|
|
816
|
-
...e,
|
|
817
|
-
style: { ...Nt, ...e.style },
|
|
818
|
-
ref: p,
|
|
819
|
-
defaultValue: a
|
|
820
|
-
}
|
|
821
|
-
);
|
|
822
|
-
}
|
|
823
|
-
);
|
|
824
|
-
nt.displayName = oo;
|
|
825
|
-
function rt(r) {
|
|
826
|
-
return r === "" || r === void 0;
|
|
827
|
-
}
|
|
828
|
-
function st(r) {
|
|
829
|
-
const a = ut(r), e = t.useRef(""), c = t.useRef(0), l = t.useCallback(
|
|
830
|
-
(o) => {
|
|
831
|
-
const s = e.current + o;
|
|
832
|
-
a(s), (function i(m) {
|
|
833
|
-
e.current = m, window.clearTimeout(c.current), m !== "" && (c.current = window.setTimeout(() => i(""), 1e3));
|
|
834
|
-
})(s);
|
|
835
|
-
},
|
|
836
|
-
[a]
|
|
837
|
-
), p = t.useCallback(() => {
|
|
838
|
-
e.current = "", window.clearTimeout(c.current);
|
|
839
|
-
}, []);
|
|
840
|
-
return t.useEffect(() => () => window.clearTimeout(c.current), []), [e, l, p];
|
|
841
|
-
}
|
|
842
|
-
function it(r, a, e) {
|
|
843
|
-
const l = a.length > 1 && Array.from(a).every((m) => m === a[0]) ? a[0] : a, p = e ? r.indexOf(e) : -1;
|
|
844
|
-
let o = no(r, Math.max(p, 0));
|
|
845
|
-
l.length === 1 && (o = o.filter((m) => m !== e));
|
|
846
|
-
const i = o.find(
|
|
847
|
-
(m) => m.textValue.toLowerCase().startsWith(l.toLowerCase())
|
|
848
|
-
);
|
|
849
|
-
return i !== e ? i : void 0;
|
|
850
|
-
}
|
|
851
|
-
function no(r, a) {
|
|
852
|
-
return r.map((e, c) => r[(a + c) % r.length]);
|
|
853
|
-
}
|
|
854
|
-
var ro = Ae, so = Le, io = Ve, ao = Be, lo = He, co = Ke, po = Ge, uo = Ye, mo = $e, fo = Xe, ho = Je, go = Qe, vo = et, _e = ot;
|
|
855
|
-
const So = dt(
|
|
52
|
+
import { Label as $ } from "./Label.js";
|
|
53
|
+
import { R as J, T as K, f as Q, e as W, C as X, c as Y, V as Z, S as _, d as S, G as ee, L as te, I as re, b as ie, a as ae } from "./index-CevVJ05e.js";
|
|
54
|
+
import { useFormFieldId as oe, useFormFieldState as se, getAriaProps as me, getErrorMessageId as de, groupOptions as le, getFormFieldCSSProperties as ne, getStateClasses as ce, getTriggerClasses as pe, ErrorMessage as ue, LoadingState as he, EmptyState as fe, getOptionClasses as be } from "./utils/formFieldUtils.js";
|
|
55
|
+
import { cn as a } from "./utils/twUtils.js";
|
|
56
|
+
import { forwardRef as ge } from "react";
|
|
57
|
+
const xe = ge(
|
|
856
58
|
({
|
|
857
|
-
align:
|
|
858
|
-
alignOffset:
|
|
859
|
-
className:
|
|
860
|
-
collisionPadding:
|
|
861
|
-
defaultValue:
|
|
862
|
-
emptyMessage:
|
|
863
|
-
errorMessage:
|
|
864
|
-
id:
|
|
865
|
-
label:
|
|
866
|
-
loadingMessage:
|
|
867
|
-
name:
|
|
868
|
-
onChange:
|
|
869
|
-
options:
|
|
870
|
-
placeholder:
|
|
871
|
-
position:
|
|
872
|
-
side:
|
|
873
|
-
sideOffset:
|
|
874
|
-
state:
|
|
59
|
+
align: C = "start",
|
|
60
|
+
alignOffset: I = 0,
|
|
61
|
+
className: w,
|
|
62
|
+
collisionPadding: z = 10,
|
|
63
|
+
defaultValue: F,
|
|
64
|
+
emptyMessage: j = "No options found",
|
|
65
|
+
errorMessage: n,
|
|
66
|
+
id: L,
|
|
67
|
+
label: o,
|
|
68
|
+
loadingMessage: k = "Loading…",
|
|
69
|
+
name: c,
|
|
70
|
+
onChange: O,
|
|
71
|
+
options: p = [],
|
|
72
|
+
placeholder: T = "Select an option",
|
|
73
|
+
position: V = "popper",
|
|
74
|
+
side: D = "bottom",
|
|
75
|
+
sideOffset: E = 4,
|
|
76
|
+
state: i = "default",
|
|
875
77
|
value: u,
|
|
876
|
-
"aria-label":
|
|
877
|
-
"aria-describedby":
|
|
878
|
-
...
|
|
879
|
-
},
|
|
880
|
-
const
|
|
881
|
-
if (
|
|
882
|
-
return /* @__PURE__ */
|
|
883
|
-
if (
|
|
884
|
-
return /* @__PURE__ */
|
|
885
|
-
const
|
|
886
|
-
const
|
|
887
|
-
return /* @__PURE__ */
|
|
888
|
-
|
|
78
|
+
"aria-label": P,
|
|
79
|
+
"aria-describedby": R,
|
|
80
|
+
...s
|
|
81
|
+
}, q) => {
|
|
82
|
+
const m = oe(L, c), h = de(m), { isDisabled: f, isLoading: b, isInvalid: g } = se(s.disabled, i), B = me(i, g, h, R), { groups: x, ungrouped: y } = le(p), G = () => {
|
|
83
|
+
if (b)
|
|
84
|
+
return /* @__PURE__ */ e(he, { message: k });
|
|
85
|
+
if (p.length === 0)
|
|
86
|
+
return /* @__PURE__ */ e(fe, { message: j });
|
|
87
|
+
const N = (t) => {
|
|
88
|
+
const d = u === t.value;
|
|
89
|
+
return /* @__PURE__ */ r(
|
|
90
|
+
re,
|
|
889
91
|
{
|
|
890
|
-
value:
|
|
891
|
-
disabled:
|
|
892
|
-
className:
|
|
893
|
-
|
|
92
|
+
value: t.value,
|
|
93
|
+
disabled: t.disabled,
|
|
94
|
+
className: a(
|
|
95
|
+
be(d, !1, t.disabled),
|
|
894
96
|
"relative flex w-full cursor-pointer items-center"
|
|
895
97
|
),
|
|
896
98
|
children: [
|
|
897
|
-
/* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ e(ie, { className: "block truncate", children: t.label }),
|
|
100
|
+
/* @__PURE__ */ e(ae, { asChild: !0, children: /* @__PURE__ */ e("span", { className: "absolute right-2 flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ e(H, { size: 16 }) }) })
|
|
899
101
|
]
|
|
900
102
|
},
|
|
901
|
-
|
|
103
|
+
t.value
|
|
902
104
|
);
|
|
903
105
|
};
|
|
904
|
-
return /* @__PURE__ */
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
Object.keys(
|
|
106
|
+
return /* @__PURE__ */ r(v, { children: [
|
|
107
|
+
y.length > 0 && /* @__PURE__ */ r(v, { children: [
|
|
108
|
+
y.map(N),
|
|
109
|
+
Object.keys(x).length > 0 && /* @__PURE__ */ e(S, { className: "bg-border-secondary -mx-1 my-1 h-px" })
|
|
908
110
|
] }),
|
|
909
|
-
Object.entries(
|
|
910
|
-
|
|
911
|
-
/* @__PURE__ */
|
|
912
|
-
|
|
913
|
-
] },
|
|
111
|
+
Object.entries(x).map(([t, d], M) => /* @__PURE__ */ r(ee, { children: [
|
|
112
|
+
M > 0 && /* @__PURE__ */ e(S, { className: "bg-border-secondary -mx-1 my-1 h-px" }),
|
|
113
|
+
/* @__PURE__ */ e(te, { className: "text-text-primary px-2 py-1.5 text-base font-semibold", children: t }),
|
|
114
|
+
d.map((A) => N(A))
|
|
115
|
+
] }, t))
|
|
914
116
|
] });
|
|
915
117
|
};
|
|
916
|
-
return /* @__PURE__ */
|
|
917
|
-
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
|
|
118
|
+
return /* @__PURE__ */ r("div", { className: "w-full", "data-testid": "select-root", children: [
|
|
119
|
+
o && /* @__PURE__ */ e($, { htmlFor: m, className: a("text-text-primary mb-4 block", f && "text-text-secondary"), children: o }),
|
|
120
|
+
/* @__PURE__ */ r(
|
|
121
|
+
J,
|
|
920
122
|
{
|
|
921
123
|
value: u,
|
|
922
|
-
defaultValue:
|
|
923
|
-
onValueChange:
|
|
924
|
-
disabled:
|
|
925
|
-
name:
|
|
926
|
-
required:
|
|
124
|
+
defaultValue: F,
|
|
125
|
+
onValueChange: O,
|
|
126
|
+
disabled: f,
|
|
127
|
+
name: c,
|
|
128
|
+
required: s.required,
|
|
927
129
|
children: [
|
|
928
|
-
/* @__PURE__ */
|
|
929
|
-
|
|
130
|
+
/* @__PURE__ */ e(
|
|
131
|
+
K,
|
|
930
132
|
{
|
|
931
|
-
ref:
|
|
932
|
-
id:
|
|
933
|
-
className:
|
|
934
|
-
"aria-label":
|
|
935
|
-
"data-state":
|
|
936
|
-
style:
|
|
937
|
-
...
|
|
938
|
-
...
|
|
133
|
+
ref: q,
|
|
134
|
+
id: m,
|
|
135
|
+
className: a(pe(i, !1), ce(i), w),
|
|
136
|
+
"aria-label": P || o,
|
|
137
|
+
"data-state": i,
|
|
138
|
+
style: ne(),
|
|
139
|
+
...B,
|
|
140
|
+
...s,
|
|
939
141
|
asChild: !0,
|
|
940
|
-
children: /* @__PURE__ */
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
943
|
-
|
|
142
|
+
children: /* @__PURE__ */ r("button", { type: "button", children: [
|
|
143
|
+
/* @__PURE__ */ e(Q, { placeholder: T, className: "block truncate" }),
|
|
144
|
+
/* @__PURE__ */ e(W, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "flex items-center", children: b ? /* @__PURE__ */ e(U, { size: 20 }) : /* @__PURE__ */ e(
|
|
145
|
+
l,
|
|
944
146
|
{
|
|
945
147
|
className: "transition-transform duration-200 data-[state=open]:rotate-180",
|
|
946
148
|
size: 20
|
|
@@ -949,20 +151,20 @@ const So = dt(
|
|
|
949
151
|
] })
|
|
950
152
|
}
|
|
951
153
|
),
|
|
952
|
-
/* @__PURE__ */
|
|
953
|
-
|
|
154
|
+
/* @__PURE__ */ e(
|
|
155
|
+
X,
|
|
954
156
|
{
|
|
955
|
-
position:
|
|
956
|
-
side:
|
|
957
|
-
align:
|
|
958
|
-
sideOffset:
|
|
959
|
-
alignOffset:
|
|
960
|
-
collisionPadding:
|
|
157
|
+
position: V,
|
|
158
|
+
side: D,
|
|
159
|
+
align: C,
|
|
160
|
+
sideOffset: E,
|
|
161
|
+
alignOffset: I,
|
|
162
|
+
collisionPadding: z,
|
|
961
163
|
asChild: !0,
|
|
962
|
-
children: /* @__PURE__ */
|
|
164
|
+
children: /* @__PURE__ */ r(
|
|
963
165
|
"div",
|
|
964
166
|
{
|
|
965
|
-
className:
|
|
167
|
+
className: a(
|
|
966
168
|
"border-input-border bg-input-bg z-50 rounded-lg border shadow-md",
|
|
967
169
|
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
968
170
|
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
@@ -979,9 +181,9 @@ const So = dt(
|
|
|
979
181
|
maxHeight: "var(--radix-select-content-available-height)"
|
|
980
182
|
},
|
|
981
183
|
children: [
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ e(Y, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ e(l, { className: "rotate-180", size: 18 }) }),
|
|
185
|
+
/* @__PURE__ */ e(Z, { asChild: !0, children: /* @__PURE__ */ e("div", { className: "max-h-96 p-1", style: { position: "relative", overflow: "hidden auto" }, children: G() }) }),
|
|
186
|
+
/* @__PURE__ */ e(_, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ e(l, { size: 18 }) })
|
|
985
187
|
]
|
|
986
188
|
}
|
|
987
189
|
)
|
|
@@ -990,11 +192,11 @@ const So = dt(
|
|
|
990
192
|
]
|
|
991
193
|
}
|
|
992
194
|
),
|
|
993
|
-
|
|
195
|
+
g && n && /* @__PURE__ */ e(ue, { id: h, message: n })
|
|
994
196
|
] });
|
|
995
197
|
}
|
|
996
198
|
);
|
|
997
|
-
|
|
199
|
+
xe.displayName = "Select";
|
|
998
200
|
export {
|
|
999
|
-
|
|
201
|
+
xe as Select
|
|
1000
202
|
};
|