@schandlergarcia/sf-web-components 1.1.2 → 1.1.4
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/library/cards/ListCard.js +15 -15
- package/dist/components/library/cards/TableCard.js +22 -22
- package/dist/components/library/cards/TableCard.js.map +1 -1
- package/dist/components/library/cards/WidgetCard.js +4 -4
- package/dist/components/library/charts/D3Chart.js.map +1 -1
- package/dist/components/library/data/DataModeProvider.js +9 -9
- package/dist/components/library/data/DataModeProvider.js.map +1 -1
- package/dist/components/library/index.d.ts +17 -4
- package/dist/components/library/theme/AppThemeProvider.js +4 -4
- package/dist/components/library/theme/AppThemeProvider.js.map +1 -1
- package/dist/components/library/ui/Avatar.js +8 -8
- package/dist/components/library/ui/BreadcrumbExtras.d.ts +9 -0
- package/dist/components/library/ui/BreadcrumbExtras.js +109 -0
- package/dist/components/library/ui/BreadcrumbExtras.js.map +1 -0
- package/dist/components/library/ui/Card.d.ts +37 -11
- package/dist/components/library/ui/FieldGroup.d.ts +5 -0
- package/dist/components/library/ui/FieldGroup.js +19 -0
- package/dist/components/library/ui/FieldGroup.js.map +1 -0
- package/dist/components/library/ui/PaginationExtras.d.ts +11 -0
- package/dist/components/library/ui/PaginationExtras.js +138 -0
- package/dist/components/library/ui/PaginationExtras.js.map +1 -0
- package/dist/components/library/ui/alert.d.ts +21 -10
- package/dist/components/library/ui/alert.js +51 -56
- package/dist/components/library/ui/alert.js.map +1 -1
- package/dist/components/library/ui/card.js +72 -55
- package/dist/components/library/ui/card.js.map +1 -1
- package/dist/components/library/ui/checkbox.d.ts +4 -4
- package/dist/components/library/ui/checkbox.js +14 -26
- package/dist/components/library/ui/checkbox.js.map +1 -1
- package/dist/components/library/ui/collapsible.d.ts +5 -4
- package/dist/components/library/ui/collapsible.js +18 -24
- package/dist/components/library/ui/collapsible.js.map +1 -1
- package/dist/components/library/ui/datePicker.d.ts +10 -18
- package/dist/components/library/ui/datePicker.js +18 -85
- package/dist/components/library/ui/datePicker.js.map +1 -1
- package/dist/components/library/ui/dialog.d.ts +5 -7
- package/dist/components/library/ui/dialog.js +94 -108
- package/dist/components/library/ui/dialog.js.map +1 -1
- package/dist/components/library/ui/field.d.ts +6 -25
- package/dist/components/library/ui/field.js +52 -184
- package/dist/components/library/ui/field.js.map +1 -1
- package/dist/components/library/ui/label.d.ts +6 -4
- package/dist/components/library/ui/label.js +12 -15
- package/dist/components/library/ui/label.js.map +1 -1
- package/dist/components/library/ui/popover.d.ts +3 -7
- package/dist/components/library/ui/popover.js +24 -28
- package/dist/components/library/ui/popover.js.map +1 -1
- package/dist/components/library/ui/select.d.ts +5 -12
- package/dist/components/library/ui/select.js +79 -155
- package/dist/components/library/ui/select.js.map +1 -1
- package/dist/index.js +227 -153
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +25 -23
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +252 -257
- package/dist/node_modules/@radix-ui/react-select/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,66 +2,66 @@ import * as t from "react";
|
|
|
2
2
|
import * as be from "react-dom";
|
|
3
3
|
import { clamp as Re } from "../../number/dist/index.js";
|
|
4
4
|
import { composeEventHandlers as R } from "../../primitive/dist/index.js";
|
|
5
|
-
import { createCollection as
|
|
5
|
+
import { createCollection as et } from "../../react-collection/dist/index.js";
|
|
6
6
|
import { useComposedRefs as k } from "../../react-compose-refs/dist/index.js";
|
|
7
|
-
import { createContextScope as
|
|
8
|
-
import { useDirection as
|
|
9
|
-
import { DismissableLayer as
|
|
10
|
-
import { useFocusGuards as
|
|
11
|
-
import { FocusScope as
|
|
7
|
+
import { createContextScope as tt } from "../node_modules/@radix-ui/react-context/dist/index.js";
|
|
8
|
+
import { useDirection as ot } from "../../react-direction/dist/index.js";
|
|
9
|
+
import { DismissableLayer as nt } from "../../react-dismissable-layer/dist/index.js";
|
|
10
|
+
import { useFocusGuards as rt } from "../../react-focus-guards/dist/index.js";
|
|
11
|
+
import { FocusScope as st } from "../../react-focus-scope/dist/index.js";
|
|
12
12
|
import { useId as Ie } from "../../react-id/dist/index.js";
|
|
13
|
-
import { Root as
|
|
14
|
-
import { Portal as
|
|
13
|
+
import { Root as lt, Anchor as ct, createPopperScope as _e, Content as it, Arrow as at } from "../../react-popper/dist/index.js";
|
|
14
|
+
import { Portal as dt } from "../../react-portal/dist/index.js";
|
|
15
15
|
import { Primitive as M } from "../node_modules/@radix-ui/react-primitive/dist/index.js";
|
|
16
|
-
import { createSlot as
|
|
17
|
-
import { useCallbackRef as
|
|
16
|
+
import { createSlot as ut } from "../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
17
|
+
import { useCallbackRef as pt } from "../../react-use-callback-ref/dist/index.js";
|
|
18
18
|
import { useControllableState as Ee } from "../../react-use-controllable-state/dist/index.js";
|
|
19
19
|
import { useLayoutEffect as Y } from "../../react-use-layout-effect/dist/index.js";
|
|
20
|
-
import { usePrevious as
|
|
21
|
-
import { VISUALLY_HIDDEN_STYLES as
|
|
22
|
-
import { hideOthers as
|
|
23
|
-
import
|
|
24
|
-
import { jsx as p, jsxs as
|
|
25
|
-
var
|
|
26
|
-
|
|
20
|
+
import { usePrevious as ft } from "../../react-use-previous/dist/index.js";
|
|
21
|
+
import { VISUALLY_HIDDEN_STYLES as mt } from "../../react-visually-hidden/dist/index.js";
|
|
22
|
+
import { hideOthers as ht } from "../../../aria-hidden/dist/es2015/index.js";
|
|
23
|
+
import vt from "../../../react-remove-scroll/dist/es2015/Combination.js";
|
|
24
|
+
import { jsx as p, jsxs as ce, Fragment as Te } from "react/jsx-runtime";
|
|
25
|
+
var gt = [" ", "Enter", "ArrowUp", "ArrowDown"], St = [" ", "Enter"], J = "Select", [ae, de, wt] = et(J), [te] = tt(J, [
|
|
26
|
+
wt,
|
|
27
27
|
_e
|
|
28
|
-
]), ue = _e(), [
|
|
28
|
+
]), ue = _e(), [Ct, j] = te(J), [xt, yt] = te(J), Ne = (o) => {
|
|
29
29
|
const {
|
|
30
|
-
__scopeSelect:
|
|
30
|
+
__scopeSelect: c,
|
|
31
31
|
children: e,
|
|
32
32
|
open: i,
|
|
33
|
-
defaultOpen:
|
|
33
|
+
defaultOpen: s,
|
|
34
34
|
onOpenChange: d,
|
|
35
35
|
value: n,
|
|
36
36
|
defaultValue: r,
|
|
37
|
-
onValueChange:
|
|
37
|
+
onValueChange: l,
|
|
38
38
|
dir: f,
|
|
39
39
|
name: g,
|
|
40
40
|
autoComplete: C,
|
|
41
41
|
disabled: E,
|
|
42
42
|
required: T,
|
|
43
43
|
form: y
|
|
44
|
-
} = o, a = ue(
|
|
44
|
+
} = o, a = ue(c), [h, S] = t.useState(null), [m, v] = t.useState(null), [U, A] = t.useState(!1), oe = ot(f), [b, D] = Ee({
|
|
45
45
|
prop: i,
|
|
46
|
-
defaultProp:
|
|
46
|
+
defaultProp: s ?? !1,
|
|
47
47
|
onChange: d,
|
|
48
48
|
caller: J
|
|
49
49
|
}), [K, X] = Ee({
|
|
50
50
|
prop: n,
|
|
51
51
|
defaultProp: r,
|
|
52
|
-
onChange:
|
|
52
|
+
onChange: l,
|
|
53
53
|
caller: J
|
|
54
|
-
}),
|
|
55
|
-
return /* @__PURE__ */ p(
|
|
56
|
-
|
|
54
|
+
}), V = t.useRef(null), B = h ? y || !!h.closest("form") : !0, [G, H] = t.useState(/* @__PURE__ */ new Set()), W = Array.from(G).map((_) => _.props.value).join(";");
|
|
55
|
+
return /* @__PURE__ */ p(lt, { ...a, children: /* @__PURE__ */ ce(
|
|
56
|
+
Ct,
|
|
57
57
|
{
|
|
58
58
|
required: T,
|
|
59
|
-
scope:
|
|
59
|
+
scope: c,
|
|
60
60
|
trigger: h,
|
|
61
61
|
onTriggerChange: S,
|
|
62
62
|
valueNode: m,
|
|
63
63
|
onValueNodeChange: v,
|
|
64
|
-
valueNodeHasChildren:
|
|
64
|
+
valueNodeHasChildren: U,
|
|
65
65
|
onValueNodeHasChildrenChange: A,
|
|
66
66
|
contentId: Ie(),
|
|
67
67
|
value: K,
|
|
@@ -69,11 +69,11 @@ var yt = [" ", "Enter", "ArrowUp", "ArrowDown"], It = [" ", "Enter"], J = "Selec
|
|
|
69
69
|
open: b,
|
|
70
70
|
onOpenChange: D,
|
|
71
71
|
dir: oe,
|
|
72
|
-
triggerPointerDownPosRef:
|
|
72
|
+
triggerPointerDownPosRef: V,
|
|
73
73
|
disabled: E,
|
|
74
74
|
children: [
|
|
75
|
-
/* @__PURE__ */ p(ae.Provider, { scope:
|
|
76
|
-
|
|
75
|
+
/* @__PURE__ */ p(ae.Provider, { scope: c, children: /* @__PURE__ */ p(
|
|
76
|
+
xt,
|
|
77
77
|
{
|
|
78
78
|
scope: o.__scopeSelect,
|
|
79
79
|
onNativeOptionAdd: t.useCallback((_) => {
|
|
@@ -81,15 +81,15 @@ var yt = [" ", "Enter", "ArrowUp", "ArrowDown"], It = [" ", "Enter"], J = "Selec
|
|
|
81
81
|
}, []),
|
|
82
82
|
onNativeOptionRemove: t.useCallback((_) => {
|
|
83
83
|
H((L) => {
|
|
84
|
-
const
|
|
85
|
-
return
|
|
84
|
+
const F = new Set(L);
|
|
85
|
+
return F.delete(_), F;
|
|
86
86
|
});
|
|
87
87
|
}, []),
|
|
88
88
|
children: e
|
|
89
89
|
}
|
|
90
90
|
) }),
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
B ? /* @__PURE__ */ ce(
|
|
92
|
+
Ze,
|
|
93
93
|
{
|
|
94
94
|
"aria-hidden": !0,
|
|
95
95
|
required: T,
|
|
@@ -105,7 +105,7 @@ var yt = [" ", "Enter", "ArrowUp", "ArrowDown"], It = [" ", "Enter"], J = "Selec
|
|
|
105
105
|
Array.from(G)
|
|
106
106
|
]
|
|
107
107
|
},
|
|
108
|
-
|
|
108
|
+
W
|
|
109
109
|
) : null
|
|
110
110
|
]
|
|
111
111
|
}
|
|
@@ -113,9 +113,9 @@ var yt = [" ", "Enter", "ArrowUp", "ArrowDown"], It = [" ", "Enter"], J = "Selec
|
|
|
113
113
|
};
|
|
114
114
|
Ne.displayName = J;
|
|
115
115
|
var Me = "SelectTrigger", Ae = t.forwardRef(
|
|
116
|
-
(o,
|
|
117
|
-
const { __scopeSelect: e, disabled: i = !1, ...
|
|
118
|
-
const h = f().filter((v) => !v.disabled), S = h.find((v) => v.value === n.value), m =
|
|
116
|
+
(o, c) => {
|
|
117
|
+
const { __scopeSelect: e, disabled: i = !1, ...s } = o, d = ue(e), n = j(Me, e), r = n.disabled || i, l = k(c, n.onTriggerChange), f = de(e), g = t.useRef("touch"), [C, E, T] = Je((a) => {
|
|
118
|
+
const h = f().filter((v) => !v.disabled), S = h.find((v) => v.value === n.value), m = Qe(h, a, S);
|
|
119
119
|
m !== void 0 && n.onValueChange(m.value);
|
|
120
120
|
}), y = (a) => {
|
|
121
121
|
r || (n.onOpenChange(!0), T()), a && (n.triggerPointerDownPosRef.current = {
|
|
@@ -123,7 +123,7 @@ var Me = "SelectTrigger", Ae = t.forwardRef(
|
|
|
123
123
|
y: Math.round(a.pageY)
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
|
-
return /* @__PURE__ */ p(
|
|
126
|
+
return /* @__PURE__ */ p(ct, { asChild: !0, ...d, children: /* @__PURE__ */ p(
|
|
127
127
|
M.button,
|
|
128
128
|
{
|
|
129
129
|
type: "button",
|
|
@@ -136,20 +136,20 @@ var Me = "SelectTrigger", Ae = t.forwardRef(
|
|
|
136
136
|
"data-state": n.open ? "open" : "closed",
|
|
137
137
|
disabled: r,
|
|
138
138
|
"data-disabled": r ? "" : void 0,
|
|
139
|
-
"data-placeholder":
|
|
140
|
-
...
|
|
141
|
-
ref:
|
|
142
|
-
onClick: R(
|
|
139
|
+
"data-placeholder": $e(n.value) ? "" : void 0,
|
|
140
|
+
...s,
|
|
141
|
+
ref: l,
|
|
142
|
+
onClick: R(s.onClick, (a) => {
|
|
143
143
|
a.currentTarget.focus(), g.current !== "mouse" && y(a);
|
|
144
144
|
}),
|
|
145
|
-
onPointerDown: R(
|
|
145
|
+
onPointerDown: R(s.onPointerDown, (a) => {
|
|
146
146
|
g.current = a.pointerType;
|
|
147
147
|
const h = a.target;
|
|
148
148
|
h.hasPointerCapture(a.pointerId) && h.releasePointerCapture(a.pointerId), a.button === 0 && a.ctrlKey === !1 && a.pointerType === "mouse" && (y(a), a.preventDefault());
|
|
149
149
|
}),
|
|
150
|
-
onKeyDown: R(
|
|
150
|
+
onKeyDown: R(s.onKeyDown, (a) => {
|
|
151
151
|
const h = C.current !== "";
|
|
152
|
-
!(a.ctrlKey || a.altKey || a.metaKey) && a.key.length === 1 && E(a.key), !(h && a.key === " ") &&
|
|
152
|
+
!(a.ctrlKey || a.altKey || a.metaKey) && a.key.length === 1 && E(a.key), !(h && a.key === " ") && gt.includes(a.key) && (y(), a.preventDefault());
|
|
153
153
|
})
|
|
154
154
|
}
|
|
155
155
|
) });
|
|
@@ -157,8 +157,8 @@ var Me = "SelectTrigger", Ae = t.forwardRef(
|
|
|
157
157
|
);
|
|
158
158
|
Ae.displayName = Me;
|
|
159
159
|
var Oe = "SelectValue", De = t.forwardRef(
|
|
160
|
-
(o,
|
|
161
|
-
const { __scopeSelect: e, className: i, style:
|
|
160
|
+
(o, c) => {
|
|
161
|
+
const { __scopeSelect: e, className: i, style: s, children: d, placeholder: n = "", ...r } = o, l = j(Oe, e), { onValueNodeHasChildrenChange: f } = l, g = d !== void 0, C = k(c, l.onValueNodeChange);
|
|
162
162
|
return Y(() => {
|
|
163
163
|
f(g);
|
|
164
164
|
}, [f, g]), /* @__PURE__ */ p(
|
|
@@ -167,49 +167,49 @@ var Oe = "SelectValue", De = t.forwardRef(
|
|
|
167
167
|
...r,
|
|
168
168
|
ref: C,
|
|
169
169
|
style: { pointerEvents: "none" },
|
|
170
|
-
children:
|
|
170
|
+
children: $e(l.value) ? /* @__PURE__ */ p(Te, { children: n }) : d
|
|
171
171
|
}
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
);
|
|
175
175
|
De.displayName = Oe;
|
|
176
|
-
var
|
|
177
|
-
(o,
|
|
178
|
-
const { __scopeSelect: e, children: i, ...
|
|
179
|
-
return /* @__PURE__ */ p(M.span, { "aria-hidden": !0, ...
|
|
176
|
+
var It = "SelectIcon", Le = t.forwardRef(
|
|
177
|
+
(o, c) => {
|
|
178
|
+
const { __scopeSelect: e, children: i, ...s } = o;
|
|
179
|
+
return /* @__PURE__ */ p(M.span, { "aria-hidden": !0, ...s, ref: c, children: i || "▼" });
|
|
180
180
|
}
|
|
181
181
|
);
|
|
182
|
-
Le.displayName =
|
|
183
|
-
var
|
|
184
|
-
ke.displayName =
|
|
185
|
-
var Q = "SelectContent",
|
|
186
|
-
(o,
|
|
187
|
-
const e = j(Q, o.__scopeSelect), [i,
|
|
182
|
+
Le.displayName = It;
|
|
183
|
+
var Tt = "SelectPortal", ke = (o) => /* @__PURE__ */ p(dt, { asChild: !0, ...o });
|
|
184
|
+
ke.displayName = Tt;
|
|
185
|
+
var Q = "SelectContent", Ve = t.forwardRef(
|
|
186
|
+
(o, c) => {
|
|
187
|
+
const e = j(Q, o.__scopeSelect), [i, s] = t.useState();
|
|
188
188
|
if (Y(() => {
|
|
189
|
-
|
|
189
|
+
s(new DocumentFragment());
|
|
190
190
|
}, []), !e.open) {
|
|
191
191
|
const d = i;
|
|
192
192
|
return d ? be.createPortal(
|
|
193
|
-
/* @__PURE__ */ p(
|
|
193
|
+
/* @__PURE__ */ p(Be, { scope: o.__scopeSelect, children: /* @__PURE__ */ p(ae.Slot, { scope: o.__scopeSelect, children: /* @__PURE__ */ p("div", { children: o.children }) }) }),
|
|
194
194
|
d
|
|
195
195
|
) : null;
|
|
196
196
|
}
|
|
197
|
-
return /* @__PURE__ */ p(He, { ...o, ref:
|
|
197
|
+
return /* @__PURE__ */ p(He, { ...o, ref: c });
|
|
198
198
|
}
|
|
199
199
|
);
|
|
200
|
-
|
|
201
|
-
var O = 10, [
|
|
202
|
-
(o,
|
|
200
|
+
Ve.displayName = Q;
|
|
201
|
+
var O = 10, [Be, q] = te(Q), Pt = "SelectContentImpl", Rt = ut("SelectContent.RemoveScroll"), He = t.forwardRef(
|
|
202
|
+
(o, c) => {
|
|
203
203
|
const {
|
|
204
204
|
__scopeSelect: e,
|
|
205
205
|
position: i = "item-aligned",
|
|
206
|
-
onCloseAutoFocus:
|
|
206
|
+
onCloseAutoFocus: s,
|
|
207
207
|
onEscapeKeyDown: d,
|
|
208
208
|
onPointerDownOutside: n,
|
|
209
209
|
//
|
|
210
210
|
// PopperContent props
|
|
211
211
|
side: r,
|
|
212
|
-
sideOffset:
|
|
212
|
+
sideOffset: l,
|
|
213
213
|
align: f,
|
|
214
214
|
alignOffset: g,
|
|
215
215
|
arrowPadding: C,
|
|
@@ -220,19 +220,19 @@ var O = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.Re
|
|
|
220
220
|
avoidCollisions: h,
|
|
221
221
|
//
|
|
222
222
|
...S
|
|
223
|
-
} = o, m = j(Q, e), [v,
|
|
223
|
+
} = o, m = j(Q, e), [v, U] = t.useState(null), [A, oe] = t.useState(null), b = k(c, (u) => U(u)), [D, K] = t.useState(null), [X, V] = t.useState(
|
|
224
224
|
null
|
|
225
|
-
),
|
|
225
|
+
), B = de(e), [G, H] = t.useState(!1), W = t.useRef(!1);
|
|
226
226
|
t.useEffect(() => {
|
|
227
|
-
if (v) return
|
|
228
|
-
}, [v]),
|
|
227
|
+
if (v) return ht(v);
|
|
228
|
+
}, [v]), rt();
|
|
229
229
|
const _ = t.useCallback(
|
|
230
230
|
(u) => {
|
|
231
|
-
const [I, ...N] =
|
|
231
|
+
const [I, ...N] = B().map((P) => P.ref.current), [w] = N.slice(-1), x = document.activeElement;
|
|
232
232
|
for (const P of u)
|
|
233
233
|
if (P === x || (P?.scrollIntoView({ block: "nearest" }), P === I && A && (A.scrollTop = 0), P === w && A && (A.scrollTop = A.scrollHeight), P?.focus(), document.activeElement !== x)) return;
|
|
234
234
|
},
|
|
235
|
-
[
|
|
235
|
+
[B, A]
|
|
236
236
|
), L = t.useCallback(
|
|
237
237
|
() => _([D, v]),
|
|
238
238
|
[_, D, v]
|
|
@@ -240,7 +240,7 @@ var O = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.Re
|
|
|
240
240
|
t.useEffect(() => {
|
|
241
241
|
G && L();
|
|
242
242
|
}, [G, L]);
|
|
243
|
-
const { onOpenChange:
|
|
243
|
+
const { onOpenChange: F, triggerPointerDownPosRef: z } = m;
|
|
244
244
|
t.useEffect(() => {
|
|
245
245
|
if (v) {
|
|
246
246
|
let u = { x: 0, y: 0 };
|
|
@@ -250,36 +250,36 @@ var O = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.Re
|
|
|
250
250
|
y: Math.abs(Math.round(w.pageY) - (z.current?.y ?? 0))
|
|
251
251
|
};
|
|
252
252
|
}, N = (w) => {
|
|
253
|
-
u.x <= 10 && u.y <= 10 ? w.preventDefault() : v.contains(w.target) ||
|
|
253
|
+
u.x <= 10 && u.y <= 10 ? w.preventDefault() : v.contains(w.target) || F(!1), document.removeEventListener("pointermove", I), z.current = null;
|
|
254
254
|
};
|
|
255
255
|
return z.current !== null && (document.addEventListener("pointermove", I), document.addEventListener("pointerup", N, { capture: !0, once: !0 })), () => {
|
|
256
256
|
document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", N, { capture: !0 });
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
-
}, [v,
|
|
260
|
-
const u = () =>
|
|
259
|
+
}, [v, F, z]), t.useEffect(() => {
|
|
260
|
+
const u = () => F(!1);
|
|
261
261
|
return window.addEventListener("blur", u), window.addEventListener("resize", u), () => {
|
|
262
262
|
window.removeEventListener("blur", u), window.removeEventListener("resize", u);
|
|
263
263
|
};
|
|
264
|
-
}, [
|
|
265
|
-
const [pe,
|
|
266
|
-
const I =
|
|
264
|
+
}, [F]);
|
|
265
|
+
const [pe, se] = Je((u) => {
|
|
266
|
+
const I = B().filter((x) => !x.disabled), N = I.find((x) => x.ref.current === document.activeElement), w = Qe(I, u, N);
|
|
267
267
|
w && setTimeout(() => w.ref.current.focus());
|
|
268
268
|
}), fe = t.useCallback(
|
|
269
269
|
(u, I, N) => {
|
|
270
|
-
const w = !
|
|
271
|
-
(m.value !== void 0 && m.value === I || w) && (K(u), w && (
|
|
270
|
+
const w = !W.current && !N;
|
|
271
|
+
(m.value !== void 0 && m.value === I || w) && (K(u), w && (W.current = !0));
|
|
272
272
|
},
|
|
273
273
|
[m.value]
|
|
274
274
|
), me = t.useCallback(() => v?.focus(), [v]), ee = t.useCallback(
|
|
275
275
|
(u, I, N) => {
|
|
276
|
-
const w = !
|
|
277
|
-
(m.value !== void 0 && m.value === I || w) &&
|
|
276
|
+
const w = !W.current && !N;
|
|
277
|
+
(m.value !== void 0 && m.value === I || w) && V(u);
|
|
278
278
|
},
|
|
279
279
|
[m.value]
|
|
280
|
-
),
|
|
280
|
+
), le = i === "popper" ? Se : We, ne = le === Se ? {
|
|
281
281
|
side: r,
|
|
282
|
-
sideOffset:
|
|
282
|
+
sideOffset: l,
|
|
283
283
|
align: f,
|
|
284
284
|
alignOffset: g,
|
|
285
285
|
arrowPadding: C,
|
|
@@ -290,7 +290,7 @@ var O = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.Re
|
|
|
290
290
|
avoidCollisions: h
|
|
291
291
|
} : {};
|
|
292
292
|
return /* @__PURE__ */ p(
|
|
293
|
-
|
|
293
|
+
Be,
|
|
294
294
|
{
|
|
295
295
|
scope: e,
|
|
296
296
|
content: v,
|
|
@@ -305,19 +305,19 @@ var O = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.Re
|
|
|
305
305
|
position: i,
|
|
306
306
|
isPositioned: G,
|
|
307
307
|
searchRef: pe,
|
|
308
|
-
children: /* @__PURE__ */ p(
|
|
309
|
-
|
|
308
|
+
children: /* @__PURE__ */ p(vt, { as: Rt, allowPinchZoom: !0, children: /* @__PURE__ */ p(
|
|
309
|
+
st,
|
|
310
310
|
{
|
|
311
311
|
asChild: !0,
|
|
312
312
|
trapped: m.open,
|
|
313
313
|
onMountAutoFocus: (u) => {
|
|
314
314
|
u.preventDefault();
|
|
315
315
|
},
|
|
316
|
-
onUnmountAutoFocus: R(
|
|
316
|
+
onUnmountAutoFocus: R(s, (u) => {
|
|
317
317
|
m.trigger?.focus({ preventScroll: !0 }), u.preventDefault();
|
|
318
318
|
}),
|
|
319
319
|
children: /* @__PURE__ */ p(
|
|
320
|
-
|
|
320
|
+
nt,
|
|
321
321
|
{
|
|
322
322
|
asChild: !0,
|
|
323
323
|
disableOutsidePointerEvents: !0,
|
|
@@ -326,7 +326,7 @@ var O = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.Re
|
|
|
326
326
|
onFocusOutside: (u) => u.preventDefault(),
|
|
327
327
|
onDismiss: () => m.onOpenChange(!1),
|
|
328
328
|
children: /* @__PURE__ */ p(
|
|
329
|
-
|
|
329
|
+
le,
|
|
330
330
|
{
|
|
331
331
|
role: "listbox",
|
|
332
332
|
id: m.contentId,
|
|
@@ -347,8 +347,8 @@ var O = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.Re
|
|
|
347
347
|
},
|
|
348
348
|
onKeyDown: R(S.onKeyDown, (u) => {
|
|
349
349
|
const I = u.ctrlKey || u.altKey || u.metaKey;
|
|
350
|
-
if (u.key === "Tab" && u.preventDefault(), !I && u.key.length === 1 &&
|
|
351
|
-
let w =
|
|
350
|
+
if (u.key === "Tab" && u.preventDefault(), !I && u.key.length === 1 && se(u.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(u.key)) {
|
|
351
|
+
let w = B().filter((x) => !x.disabled).map((x) => x.ref.current);
|
|
352
352
|
if (["ArrowUp", "End"].includes(u.key) && (w = w.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(u.key)) {
|
|
353
353
|
const x = u.target, P = w.indexOf(x);
|
|
354
354
|
w = w.slice(P + 1);
|
|
@@ -366,9 +366,9 @@ var O = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.Re
|
|
|
366
366
|
);
|
|
367
367
|
}
|
|
368
368
|
);
|
|
369
|
-
He.displayName =
|
|
370
|
-
var
|
|
371
|
-
const { __scopeSelect: e, onPlaced: i, ...
|
|
369
|
+
He.displayName = Pt;
|
|
370
|
+
var Et = "SelectItemAlignedPosition", We = t.forwardRef((o, c) => {
|
|
371
|
+
const { __scopeSelect: e, onPlaced: i, ...s } = o, d = j(Q, e), n = q(Q, e), [r, l] = t.useState(null), [f, g] = t.useState(null), C = k(c, (b) => g(b)), E = de(e), T = t.useRef(!1), y = t.useRef(!0), { viewport: a, selectedItem: h, selectedItemText: S, focusSelectedItem: m } = n, v = t.useCallback(() => {
|
|
372
372
|
if (d.trigger && d.valueNode && r && f && a && h && S) {
|
|
373
373
|
const b = d.trigger.getBoundingClientRect(), D = f.getBoundingClientRect(), K = d.valueNode.getBoundingClientRect(), X = S.getBoundingClientRect();
|
|
374
374
|
if (d.dir !== "rtl") {
|
|
@@ -389,27 +389,27 @@ var At = "SelectItemAlignedPosition", Ue = t.forwardRef((o, s) => {
|
|
|
389
389
|
]);
|
|
390
390
|
r.style.minWidth = $ + "px", r.style.right = ge + "px";
|
|
391
391
|
}
|
|
392
|
-
const
|
|
392
|
+
const V = E(), B = window.innerHeight - O * 2, G = a.scrollHeight, H = window.getComputedStyle(f), W = parseInt(H.borderTopWidth, 10), _ = parseInt(H.paddingTop, 10), L = parseInt(H.borderBottomWidth, 10), F = parseInt(H.paddingBottom, 10), z = W + _ + G + F + L, pe = Math.min(h.offsetHeight * 5, z), se = window.getComputedStyle(a), fe = parseInt(se.paddingTop, 10), me = parseInt(se.paddingBottom, 10), ee = b.top + b.height / 2 - O, le = B - ee, ne = h.offsetHeight / 2, u = h.offsetTop + ne, I = W + _ + u, N = z - I;
|
|
393
393
|
if (I <= ee) {
|
|
394
|
-
const x =
|
|
394
|
+
const x = V.length > 0 && h === V[V.length - 1].ref.current;
|
|
395
395
|
r.style.bottom = "0px";
|
|
396
396
|
const P = f.clientHeight - a.offsetTop - a.offsetHeight, Z = Math.max(
|
|
397
|
-
|
|
397
|
+
le,
|
|
398
398
|
ne + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
399
399
|
(x ? me : 0) + P + L
|
|
400
400
|
), $ = I + Z;
|
|
401
401
|
r.style.height = $ + "px";
|
|
402
402
|
} else {
|
|
403
|
-
const x =
|
|
403
|
+
const x = V.length > 0 && h === V[0].ref.current;
|
|
404
404
|
r.style.top = "0px";
|
|
405
405
|
const Z = Math.max(
|
|
406
406
|
ee,
|
|
407
|
-
|
|
407
|
+
W + a.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
408
408
|
(x ? fe : 0) + ne
|
|
409
409
|
) + N;
|
|
410
410
|
r.style.height = Z + "px", a.scrollTop = I - ee + a.offsetTop;
|
|
411
411
|
}
|
|
412
|
-
r.style.margin = `${O}px 0`, r.style.minHeight = pe + "px", r.style.maxHeight =
|
|
412
|
+
r.style.margin = `${O}px 0`, r.style.minHeight = pe + "px", r.style.maxHeight = B + "px", i?.(), requestAnimationFrame(() => T.current = !0);
|
|
413
413
|
}
|
|
414
414
|
}, [
|
|
415
415
|
E,
|
|
@@ -424,7 +424,7 @@ var At = "SelectItemAlignedPosition", Ue = t.forwardRef((o, s) => {
|
|
|
424
424
|
i
|
|
425
425
|
]);
|
|
426
426
|
Y(() => v(), [v]);
|
|
427
|
-
const [
|
|
427
|
+
const [U, A] = t.useState();
|
|
428
428
|
Y(() => {
|
|
429
429
|
f && A(window.getComputedStyle(f).zIndex);
|
|
430
430
|
}, [f]);
|
|
@@ -435,7 +435,7 @@ var At = "SelectItemAlignedPosition", Ue = t.forwardRef((o, s) => {
|
|
|
435
435
|
[v, m]
|
|
436
436
|
);
|
|
437
437
|
return /* @__PURE__ */ p(
|
|
438
|
-
|
|
438
|
+
_t,
|
|
439
439
|
{
|
|
440
440
|
scope: e,
|
|
441
441
|
contentWrapper: r,
|
|
@@ -444,17 +444,17 @@ var At = "SelectItemAlignedPosition", Ue = t.forwardRef((o, s) => {
|
|
|
444
444
|
children: /* @__PURE__ */ p(
|
|
445
445
|
"div",
|
|
446
446
|
{
|
|
447
|
-
ref:
|
|
447
|
+
ref: l,
|
|
448
448
|
style: {
|
|
449
449
|
display: "flex",
|
|
450
450
|
flexDirection: "column",
|
|
451
451
|
position: "fixed",
|
|
452
|
-
zIndex:
|
|
452
|
+
zIndex: U
|
|
453
453
|
},
|
|
454
454
|
children: /* @__PURE__ */ p(
|
|
455
455
|
M.div,
|
|
456
456
|
{
|
|
457
|
-
...
|
|
457
|
+
...s,
|
|
458
458
|
ref: C,
|
|
459
459
|
style: {
|
|
460
460
|
// When we get the height of the content, it includes borders. If we were to set
|
|
@@ -462,7 +462,7 @@ var At = "SelectItemAlignedPosition", Ue = t.forwardRef((o, s) => {
|
|
|
462
462
|
boxSizing: "border-box",
|
|
463
463
|
// We need to ensure the content doesn't get taller than the wrapper
|
|
464
464
|
maxHeight: "100%",
|
|
465
|
-
...
|
|
465
|
+
...s.style
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
)
|
|
@@ -471,22 +471,22 @@ var At = "SelectItemAlignedPosition", Ue = t.forwardRef((o, s) => {
|
|
|
471
471
|
}
|
|
472
472
|
);
|
|
473
473
|
});
|
|
474
|
-
|
|
475
|
-
var
|
|
474
|
+
We.displayName = Et;
|
|
475
|
+
var bt = "SelectPopperPosition", Se = t.forwardRef((o, c) => {
|
|
476
476
|
const {
|
|
477
477
|
__scopeSelect: e,
|
|
478
478
|
align: i = "start",
|
|
479
|
-
collisionPadding:
|
|
479
|
+
collisionPadding: s = O,
|
|
480
480
|
...d
|
|
481
481
|
} = o, n = ue(e);
|
|
482
482
|
return /* @__PURE__ */ p(
|
|
483
|
-
|
|
483
|
+
it,
|
|
484
484
|
{
|
|
485
485
|
...n,
|
|
486
486
|
...d,
|
|
487
|
-
ref:
|
|
487
|
+
ref: c,
|
|
488
488
|
align: i,
|
|
489
|
-
collisionPadding:
|
|
489
|
+
collisionPadding: s,
|
|
490
490
|
style: {
|
|
491
491
|
// Ensure border-box for floating-ui calculations
|
|
492
492
|
boxSizing: "border-box",
|
|
@@ -500,11 +500,11 @@ var Ot = "SelectPopperPosition", Se = t.forwardRef((o, s) => {
|
|
|
500
500
|
}
|
|
501
501
|
);
|
|
502
502
|
});
|
|
503
|
-
Se.displayName =
|
|
504
|
-
var [
|
|
505
|
-
(o,
|
|
506
|
-
const { __scopeSelect: e, nonce: i, ...
|
|
507
|
-
return /* @__PURE__ */
|
|
503
|
+
Se.displayName = bt;
|
|
504
|
+
var [_t, Pe] = te(Q, {}), we = "SelectViewport", Fe = t.forwardRef(
|
|
505
|
+
(o, c) => {
|
|
506
|
+
const { __scopeSelect: e, nonce: i, ...s } = o, d = q(we, e), n = Pe(we, e), r = k(c, d.onViewportChange), l = t.useRef(0);
|
|
507
|
+
return /* @__PURE__ */ ce(Te, { children: [
|
|
508
508
|
/* @__PURE__ */ p(
|
|
509
509
|
"style",
|
|
510
510
|
{
|
|
@@ -519,7 +519,7 @@ var [Dt, Pe] = te(Q, {}), we = "SelectViewport", We = t.forwardRef(
|
|
|
519
519
|
{
|
|
520
520
|
"data-radix-select-viewport": "",
|
|
521
521
|
role: "presentation",
|
|
522
|
-
...
|
|
522
|
+
...s,
|
|
523
523
|
ref: r,
|
|
524
524
|
style: {
|
|
525
525
|
// we use position: 'relative' here on the `viewport` so that when we call
|
|
@@ -532,66 +532,66 @@ var [Dt, Pe] = te(Q, {}), we = "SelectViewport", We = t.forwardRef(
|
|
|
532
532
|
// revisit this if/when that is supported
|
|
533
533
|
// https://developer.chrome.com/blog/vertical-form-controls
|
|
534
534
|
overflow: "hidden auto",
|
|
535
|
-
...
|
|
535
|
+
...s.style
|
|
536
536
|
},
|
|
537
|
-
onScroll: R(
|
|
537
|
+
onScroll: R(s.onScroll, (f) => {
|
|
538
538
|
const g = f.currentTarget, { contentWrapper: C, shouldExpandOnScrollRef: E } = n;
|
|
539
539
|
if (E?.current && C) {
|
|
540
|
-
const T = Math.abs(
|
|
540
|
+
const T = Math.abs(l.current - g.scrollTop);
|
|
541
541
|
if (T > 0) {
|
|
542
542
|
const y = window.innerHeight - O * 2, a = parseFloat(C.style.minHeight), h = parseFloat(C.style.height), S = Math.max(a, h);
|
|
543
543
|
if (S < y) {
|
|
544
|
-
const m = S + T, v = Math.min(y, m),
|
|
545
|
-
C.style.height = v + "px", C.style.bottom === "0px" && (g.scrollTop =
|
|
544
|
+
const m = S + T, v = Math.min(y, m), U = m - v;
|
|
545
|
+
C.style.height = v + "px", C.style.bottom === "0px" && (g.scrollTop = U > 0 ? U : 0, C.style.justifyContent = "flex-end");
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
|
|
549
|
+
l.current = g.scrollTop;
|
|
550
550
|
})
|
|
551
551
|
}
|
|
552
552
|
) })
|
|
553
553
|
] });
|
|
554
554
|
}
|
|
555
555
|
);
|
|
556
|
-
|
|
557
|
-
var
|
|
558
|
-
(o,
|
|
559
|
-
const { __scopeSelect: e, ...i } = o,
|
|
560
|
-
return /* @__PURE__ */ p(
|
|
556
|
+
Fe.displayName = we;
|
|
557
|
+
var Ue = "SelectGroup", [Nt, Mt] = te(Ue), At = t.forwardRef(
|
|
558
|
+
(o, c) => {
|
|
559
|
+
const { __scopeSelect: e, ...i } = o, s = Ie();
|
|
560
|
+
return /* @__PURE__ */ p(Nt, { scope: e, id: s, children: /* @__PURE__ */ p(M.div, { role: "group", "aria-labelledby": s, ...i, ref: c }) });
|
|
561
561
|
}
|
|
562
562
|
);
|
|
563
|
-
|
|
564
|
-
var
|
|
565
|
-
(o,
|
|
566
|
-
const { __scopeSelect: e, ...i } = o,
|
|
567
|
-
return /* @__PURE__ */ p(M.div, { id:
|
|
563
|
+
At.displayName = Ue;
|
|
564
|
+
var Ke = "SelectLabel", Ot = t.forwardRef(
|
|
565
|
+
(o, c) => {
|
|
566
|
+
const { __scopeSelect: e, ...i } = o, s = Mt(Ke, e);
|
|
567
|
+
return /* @__PURE__ */ p(M.div, { id: s.id, ...i, ref: c });
|
|
568
568
|
}
|
|
569
569
|
);
|
|
570
|
-
|
|
571
|
-
var ie = "SelectItem", [
|
|
572
|
-
(o,
|
|
570
|
+
Ot.displayName = Ke;
|
|
571
|
+
var ie = "SelectItem", [Dt, Ge] = te(ie), ze = t.forwardRef(
|
|
572
|
+
(o, c) => {
|
|
573
573
|
const {
|
|
574
574
|
__scopeSelect: e,
|
|
575
575
|
value: i,
|
|
576
|
-
disabled:
|
|
576
|
+
disabled: s = !1,
|
|
577
577
|
textValue: d,
|
|
578
578
|
...n
|
|
579
|
-
} = o, r = j(ie, e),
|
|
580
|
-
|
|
581
|
-
(m) =>
|
|
579
|
+
} = o, r = j(ie, e), l = q(ie, e), f = r.value === i, [g, C] = t.useState(d ?? ""), [E, T] = t.useState(!1), y = k(
|
|
580
|
+
c,
|
|
581
|
+
(m) => l.itemRefCallback?.(m, i, s)
|
|
582
582
|
), a = Ie(), h = t.useRef("touch"), S = () => {
|
|
583
|
-
|
|
583
|
+
s || (r.onValueChange(i), r.onOpenChange(!1));
|
|
584
584
|
};
|
|
585
585
|
if (i === "")
|
|
586
586
|
throw new Error(
|
|
587
587
|
"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."
|
|
588
588
|
);
|
|
589
589
|
return /* @__PURE__ */ p(
|
|
590
|
-
|
|
590
|
+
Dt,
|
|
591
591
|
{
|
|
592
592
|
scope: e,
|
|
593
593
|
value: i,
|
|
594
|
-
disabled:
|
|
594
|
+
disabled: s,
|
|
595
595
|
textId: a,
|
|
596
596
|
isSelected: f,
|
|
597
597
|
onItemTextChange: t.useCallback((m) => {
|
|
@@ -602,7 +602,7 @@ var ie = "SelectItem", [Bt, Ye] = te(ie), je = t.forwardRef(
|
|
|
602
602
|
{
|
|
603
603
|
scope: e,
|
|
604
604
|
value: i,
|
|
605
|
-
disabled:
|
|
605
|
+
disabled: s,
|
|
606
606
|
textValue: g,
|
|
607
607
|
children: /* @__PURE__ */ p(
|
|
608
608
|
M.div,
|
|
@@ -612,9 +612,9 @@ var ie = "SelectItem", [Bt, Ye] = te(ie), je = t.forwardRef(
|
|
|
612
612
|
"data-highlighted": E ? "" : void 0,
|
|
613
613
|
"aria-selected": f && E,
|
|
614
614
|
"data-state": f ? "checked" : "unchecked",
|
|
615
|
-
"aria-disabled":
|
|
616
|
-
"data-disabled":
|
|
617
|
-
tabIndex:
|
|
615
|
+
"aria-disabled": s || void 0,
|
|
616
|
+
"data-disabled": s ? "" : void 0,
|
|
617
|
+
tabIndex: s ? void 0 : -1,
|
|
618
618
|
...n,
|
|
619
619
|
ref: y,
|
|
620
620
|
onFocus: R(n.onFocus, () => T(!0)),
|
|
@@ -629,13 +629,13 @@ var ie = "SelectItem", [Bt, Ye] = te(ie), je = t.forwardRef(
|
|
|
629
629
|
h.current = m.pointerType;
|
|
630
630
|
}),
|
|
631
631
|
onPointerMove: R(n.onPointerMove, (m) => {
|
|
632
|
-
h.current = m.pointerType,
|
|
632
|
+
h.current = m.pointerType, s ? l.onItemLeave?.() : h.current === "mouse" && m.currentTarget.focus({ preventScroll: !0 });
|
|
633
633
|
}),
|
|
634
634
|
onPointerLeave: R(n.onPointerLeave, (m) => {
|
|
635
|
-
m.currentTarget === document.activeElement &&
|
|
635
|
+
m.currentTarget === document.activeElement && l.onItemLeave?.();
|
|
636
636
|
}),
|
|
637
637
|
onKeyDown: R(n.onKeyDown, (m) => {
|
|
638
|
-
|
|
638
|
+
l.searchRef?.current !== "" && m.key === " " || (St.includes(m.key) && S(), m.key === " " && m.preventDefault());
|
|
639
639
|
})
|
|
640
640
|
}
|
|
641
641
|
)
|
|
@@ -645,203 +645,198 @@ var ie = "SelectItem", [Bt, Ye] = te(ie), je = t.forwardRef(
|
|
|
645
645
|
);
|
|
646
646
|
}
|
|
647
647
|
);
|
|
648
|
-
|
|
649
|
-
var re = "SelectItemText",
|
|
650
|
-
(o,
|
|
651
|
-
const { __scopeSelect: e, className: i, style:
|
|
652
|
-
|
|
648
|
+
ze.displayName = ie;
|
|
649
|
+
var re = "SelectItemText", Ye = t.forwardRef(
|
|
650
|
+
(o, c) => {
|
|
651
|
+
const { __scopeSelect: e, className: i, style: s, ...d } = o, n = j(re, e), r = q(re, e), l = Ge(re, e), f = yt(re, e), [g, C] = t.useState(null), E = k(
|
|
652
|
+
c,
|
|
653
653
|
(S) => C(S),
|
|
654
|
-
|
|
655
|
-
(S) => r.itemTextRefCallback?.(S,
|
|
654
|
+
l.onItemTextChange,
|
|
655
|
+
(S) => r.itemTextRefCallback?.(S, l.value, l.disabled)
|
|
656
656
|
), T = g?.textContent, y = t.useMemo(
|
|
657
|
-
() => /* @__PURE__ */ p("option", { value:
|
|
658
|
-
[
|
|
657
|
+
() => /* @__PURE__ */ p("option", { value: l.value, disabled: l.disabled, children: T }, l.value),
|
|
658
|
+
[l.disabled, l.value, T]
|
|
659
659
|
), { onNativeOptionAdd: a, onNativeOptionRemove: h } = f;
|
|
660
|
-
return Y(() => (a(y), () => h(y)), [a, h, y]), /* @__PURE__ */
|
|
661
|
-
/* @__PURE__ */ p(M.span, { id:
|
|
662
|
-
|
|
660
|
+
return Y(() => (a(y), () => h(y)), [a, h, y]), /* @__PURE__ */ ce(Te, { children: [
|
|
661
|
+
/* @__PURE__ */ p(M.span, { id: l.textId, ...d, ref: E }),
|
|
662
|
+
l.isSelected && n.valueNode && !n.valueNodeHasChildren ? be.createPortal(d.children, n.valueNode) : null
|
|
663
663
|
] });
|
|
664
664
|
}
|
|
665
665
|
);
|
|
666
|
-
|
|
667
|
-
var
|
|
668
|
-
(o,
|
|
666
|
+
Ye.displayName = re;
|
|
667
|
+
var je = "SelectItemIndicator", qe = t.forwardRef(
|
|
668
|
+
(o, c) => {
|
|
669
669
|
const { __scopeSelect: e, ...i } = o;
|
|
670
|
-
return
|
|
670
|
+
return Ge(je, e).isSelected ? /* @__PURE__ */ p(M.span, { "aria-hidden": !0, ...i, ref: c }) : null;
|
|
671
671
|
}
|
|
672
672
|
);
|
|
673
|
-
|
|
674
|
-
var Ce = "SelectScrollUpButton",
|
|
675
|
-
const e = q(Ce, o.__scopeSelect), i = Pe(Ce, o.__scopeSelect), [
|
|
673
|
+
qe.displayName = je;
|
|
674
|
+
var Ce = "SelectScrollUpButton", Lt = t.forwardRef((o, c) => {
|
|
675
|
+
const e = q(Ce, o.__scopeSelect), i = Pe(Ce, o.__scopeSelect), [s, d] = t.useState(!1), n = k(c, i.onScrollButtonChange);
|
|
676
676
|
return Y(() => {
|
|
677
677
|
if (e.viewport && e.isPositioned) {
|
|
678
678
|
let r = function() {
|
|
679
|
-
const f =
|
|
679
|
+
const f = l.scrollTop > 0;
|
|
680
680
|
d(f);
|
|
681
681
|
};
|
|
682
|
-
const
|
|
683
|
-
return r(),
|
|
682
|
+
const l = e.viewport;
|
|
683
|
+
return r(), l.addEventListener("scroll", r), () => l.removeEventListener("scroll", r);
|
|
684
684
|
}
|
|
685
|
-
}, [e.viewport, e.isPositioned]),
|
|
686
|
-
|
|
685
|
+
}, [e.viewport, e.isPositioned]), s ? /* @__PURE__ */ p(
|
|
686
|
+
Xe,
|
|
687
687
|
{
|
|
688
688
|
...o,
|
|
689
689
|
ref: n,
|
|
690
690
|
onAutoScroll: () => {
|
|
691
|
-
const { viewport: r, selectedItem:
|
|
692
|
-
r &&
|
|
691
|
+
const { viewport: r, selectedItem: l } = e;
|
|
692
|
+
r && l && (r.scrollTop = r.scrollTop - l.offsetHeight);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
695
|
) : null;
|
|
696
696
|
});
|
|
697
|
-
|
|
698
|
-
var xe = "SelectScrollDownButton",
|
|
699
|
-
const e = q(xe, o.__scopeSelect), i = Pe(xe, o.__scopeSelect), [
|
|
697
|
+
Lt.displayName = Ce;
|
|
698
|
+
var xe = "SelectScrollDownButton", kt = t.forwardRef((o, c) => {
|
|
699
|
+
const e = q(xe, o.__scopeSelect), i = Pe(xe, o.__scopeSelect), [s, d] = t.useState(!1), n = k(c, i.onScrollButtonChange);
|
|
700
700
|
return Y(() => {
|
|
701
701
|
if (e.viewport && e.isPositioned) {
|
|
702
702
|
let r = function() {
|
|
703
|
-
const f =
|
|
703
|
+
const f = l.scrollHeight - l.clientHeight, g = Math.ceil(l.scrollTop) < f;
|
|
704
704
|
d(g);
|
|
705
705
|
};
|
|
706
|
-
const
|
|
707
|
-
return r(),
|
|
706
|
+
const l = e.viewport;
|
|
707
|
+
return r(), l.addEventListener("scroll", r), () => l.removeEventListener("scroll", r);
|
|
708
708
|
}
|
|
709
|
-
}, [e.viewport, e.isPositioned]),
|
|
710
|
-
|
|
709
|
+
}, [e.viewport, e.isPositioned]), s ? /* @__PURE__ */ p(
|
|
710
|
+
Xe,
|
|
711
711
|
{
|
|
712
712
|
...o,
|
|
713
713
|
ref: n,
|
|
714
714
|
onAutoScroll: () => {
|
|
715
|
-
const { viewport: r, selectedItem:
|
|
716
|
-
r &&
|
|
715
|
+
const { viewport: r, selectedItem: l } = e;
|
|
716
|
+
r && l && (r.scrollTop = r.scrollTop + l.offsetHeight);
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
) : null;
|
|
720
720
|
});
|
|
721
|
-
|
|
722
|
-
var
|
|
723
|
-
const { __scopeSelect: e, onAutoScroll: i, ...
|
|
721
|
+
kt.displayName = xe;
|
|
722
|
+
var Xe = t.forwardRef((o, c) => {
|
|
723
|
+
const { __scopeSelect: e, onAutoScroll: i, ...s } = o, d = q("SelectScrollButton", e), n = t.useRef(null), r = de(e), l = t.useCallback(() => {
|
|
724
724
|
n.current !== null && (window.clearInterval(n.current), n.current = null);
|
|
725
725
|
}, []);
|
|
726
|
-
return t.useEffect(() => () =>
|
|
726
|
+
return t.useEffect(() => () => l(), [l]), Y(() => {
|
|
727
727
|
r().find((g) => g.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
728
728
|
}, [r]), /* @__PURE__ */ p(
|
|
729
729
|
M.div,
|
|
730
730
|
{
|
|
731
731
|
"aria-hidden": !0,
|
|
732
|
-
...
|
|
733
|
-
ref:
|
|
734
|
-
style: { flexShrink: 0, ...
|
|
735
|
-
onPointerDown: R(
|
|
732
|
+
...s,
|
|
733
|
+
ref: c,
|
|
734
|
+
style: { flexShrink: 0, ...s.style },
|
|
735
|
+
onPointerDown: R(s.onPointerDown, () => {
|
|
736
736
|
n.current === null && (n.current = window.setInterval(i, 50));
|
|
737
737
|
}),
|
|
738
|
-
onPointerMove: R(
|
|
738
|
+
onPointerMove: R(s.onPointerMove, () => {
|
|
739
739
|
d.onItemLeave?.(), n.current === null && (n.current = window.setInterval(i, 50));
|
|
740
740
|
}),
|
|
741
|
-
onPointerLeave: R(
|
|
742
|
-
|
|
741
|
+
onPointerLeave: R(s.onPointerLeave, () => {
|
|
742
|
+
l();
|
|
743
743
|
})
|
|
744
744
|
}
|
|
745
745
|
);
|
|
746
|
-
}), Vt = "SelectSeparator",
|
|
747
|
-
(o,
|
|
746
|
+
}), Vt = "SelectSeparator", Bt = t.forwardRef(
|
|
747
|
+
(o, c) => {
|
|
748
748
|
const { __scopeSelect: e, ...i } = o;
|
|
749
|
-
return /* @__PURE__ */ p(M.div, { "aria-hidden": !0, ...i, ref:
|
|
749
|
+
return /* @__PURE__ */ p(M.div, { "aria-hidden": !0, ...i, ref: c });
|
|
750
750
|
}
|
|
751
751
|
);
|
|
752
|
-
|
|
752
|
+
Bt.displayName = Vt;
|
|
753
753
|
var ye = "SelectArrow", Ht = t.forwardRef(
|
|
754
|
-
(o,
|
|
755
|
-
const { __scopeSelect: e, ...i } = o,
|
|
756
|
-
return d.open && n.position === "popper" ? /* @__PURE__ */ p(
|
|
754
|
+
(o, c) => {
|
|
755
|
+
const { __scopeSelect: e, ...i } = o, s = ue(e), d = j(ye, e), n = q(ye, e);
|
|
756
|
+
return d.open && n.position === "popper" ? /* @__PURE__ */ p(at, { ...s, ...i, ref: c }) : null;
|
|
757
757
|
}
|
|
758
758
|
);
|
|
759
759
|
Ht.displayName = ye;
|
|
760
|
-
var
|
|
761
|
-
({ __scopeSelect: o, value:
|
|
762
|
-
const
|
|
760
|
+
var Wt = "SelectBubbleInput", Ze = t.forwardRef(
|
|
761
|
+
({ __scopeSelect: o, value: c, ...e }, i) => {
|
|
762
|
+
const s = t.useRef(null), d = k(i, s), n = ft(c);
|
|
763
763
|
return t.useEffect(() => {
|
|
764
|
-
const r =
|
|
764
|
+
const r = s.current;
|
|
765
765
|
if (!r) return;
|
|
766
|
-
const
|
|
767
|
-
|
|
766
|
+
const l = window.HTMLSelectElement.prototype, g = Object.getOwnPropertyDescriptor(
|
|
767
|
+
l,
|
|
768
768
|
"value"
|
|
769
769
|
).set;
|
|
770
|
-
if (n !==
|
|
770
|
+
if (n !== c && g) {
|
|
771
771
|
const C = new Event("change", { bubbles: !0 });
|
|
772
|
-
g.call(r,
|
|
772
|
+
g.call(r, c), r.dispatchEvent(C);
|
|
773
773
|
}
|
|
774
|
-
}, [n,
|
|
774
|
+
}, [n, c]), /* @__PURE__ */ p(
|
|
775
775
|
M.select,
|
|
776
776
|
{
|
|
777
777
|
...e,
|
|
778
|
-
style: { ...
|
|
778
|
+
style: { ...mt, ...e.style },
|
|
779
779
|
ref: d,
|
|
780
|
-
defaultValue:
|
|
780
|
+
defaultValue: c
|
|
781
781
|
}
|
|
782
782
|
);
|
|
783
783
|
}
|
|
784
784
|
);
|
|
785
|
-
|
|
786
|
-
function
|
|
785
|
+
Ze.displayName = Wt;
|
|
786
|
+
function $e(o) {
|
|
787
787
|
return o === "" || o === void 0;
|
|
788
788
|
}
|
|
789
|
-
function
|
|
790
|
-
const
|
|
789
|
+
function Je(o) {
|
|
790
|
+
const c = pt(o), e = t.useRef(""), i = t.useRef(0), s = t.useCallback(
|
|
791
791
|
(n) => {
|
|
792
792
|
const r = e.current + n;
|
|
793
|
-
|
|
794
|
-
e.current = f, window.clearTimeout(i.current), f !== "" && (i.current = window.setTimeout(() =>
|
|
793
|
+
c(r), (function l(f) {
|
|
794
|
+
e.current = f, window.clearTimeout(i.current), f !== "" && (i.current = window.setTimeout(() => l(""), 1e3));
|
|
795
795
|
})(r);
|
|
796
796
|
},
|
|
797
|
-
[
|
|
797
|
+
[c]
|
|
798
798
|
), d = t.useCallback(() => {
|
|
799
799
|
e.current = "", window.clearTimeout(i.current);
|
|
800
800
|
}, []);
|
|
801
|
-
return t.useEffect(() => () => window.clearTimeout(i.current), []), [e,
|
|
801
|
+
return t.useEffect(() => () => window.clearTimeout(i.current), []), [e, s, d];
|
|
802
802
|
}
|
|
803
|
-
function
|
|
804
|
-
const
|
|
805
|
-
let n =
|
|
806
|
-
|
|
807
|
-
const
|
|
808
|
-
(f) => f.textValue.toLowerCase().startsWith(
|
|
803
|
+
function Qe(o, c, e) {
|
|
804
|
+
const s = c.length > 1 && Array.from(c).every((f) => f === c[0]) ? c[0] : c, d = e ? o.indexOf(e) : -1;
|
|
805
|
+
let n = Ft(o, Math.max(d, 0));
|
|
806
|
+
s.length === 1 && (n = n.filter((f) => f !== e));
|
|
807
|
+
const l = n.find(
|
|
808
|
+
(f) => f.textValue.toLowerCase().startsWith(s.toLowerCase())
|
|
809
809
|
);
|
|
810
|
-
return
|
|
810
|
+
return l !== e ? l : void 0;
|
|
811
811
|
}
|
|
812
|
-
function
|
|
813
|
-
return o.map((e, i) => o[(
|
|
812
|
+
function Ft(o, c) {
|
|
813
|
+
return o.map((e, i) => o[(c + i) % o.length]);
|
|
814
814
|
}
|
|
815
|
-
var uo = Ne, po = Ae, fo = De, mo = Le, ho = ke, vo =
|
|
815
|
+
var uo = Ne, po = Ae, fo = De, mo = Le, ho = ke, vo = Ve, go = Fe, So = ze, wo = Ye, Co = qe;
|
|
816
816
|
export {
|
|
817
817
|
vo as Content,
|
|
818
|
-
So as Group,
|
|
819
818
|
mo as Icon,
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
wo as Label,
|
|
819
|
+
So as Item,
|
|
820
|
+
Co as ItemIndicator,
|
|
821
|
+
wo as ItemText,
|
|
824
822
|
ho as Portal,
|
|
825
823
|
uo as Root,
|
|
826
|
-
To as ScrollDownButton,
|
|
827
|
-
Io as ScrollUpButton,
|
|
828
824
|
Ne as Select,
|
|
829
825
|
Ht as SelectArrow,
|
|
830
|
-
|
|
831
|
-
|
|
826
|
+
Ve as SelectContent,
|
|
827
|
+
At as SelectGroup,
|
|
832
828
|
Le as SelectIcon,
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
829
|
+
ze as SelectItem,
|
|
830
|
+
qe as SelectItemIndicator,
|
|
831
|
+
Ye as SelectItemText,
|
|
832
|
+
Ot as SelectLabel,
|
|
837
833
|
ke as SelectPortal,
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
834
|
+
kt as SelectScrollDownButton,
|
|
835
|
+
Lt as SelectScrollUpButton,
|
|
836
|
+
Bt as SelectSeparator,
|
|
841
837
|
Ae as SelectTrigger,
|
|
842
838
|
De as SelectValue,
|
|
843
|
-
|
|
844
|
-
Po as Separator,
|
|
839
|
+
Fe as SelectViewport,
|
|
845
840
|
po as Trigger,
|
|
846
841
|
fo as Value,
|
|
847
842
|
go as Viewport
|