@drjoshcsimmons/scl 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/dist/index100.js +29 -47
  2. package/dist/index101.js +10 -52
  3. package/dist/index102.js +55 -30
  4. package/dist/index103.js +30 -4
  5. package/dist/index104.js +3 -218
  6. package/dist/index105.js +216 -45
  7. package/dist/index106.js +47 -29
  8. package/dist/index107.js +30 -9
  9. package/dist/index108.js +30 -181
  10. package/dist/index11.js +2 -2
  11. package/dist/index110.js +9 -30
  12. package/dist/index111.js +159 -628
  13. package/dist/index112.js +1 -1
  14. package/dist/index115.js +12 -6
  15. package/dist/index116.js +47 -11
  16. package/dist/index117.js +6 -21
  17. package/dist/index118.js +206 -9
  18. package/dist/index119.js +21 -37
  19. package/dist/index12.js +1 -1
  20. package/dist/index120.js +399 -17
  21. package/dist/index121.js +21 -206
  22. package/dist/index122.js +9 -22
  23. package/dist/index123.js +38 -400
  24. package/dist/index124.js +18 -48
  25. package/dist/index125.js +25 -2
  26. package/dist/index126.js +29 -53
  27. package/dist/index127.js +5 -65
  28. package/dist/index128.js +2 -25
  29. package/dist/index129.js +53 -29
  30. package/dist/index13.js +2 -2
  31. package/dist/index130.js +65 -5
  32. package/dist/index136.js +1 -1
  33. package/dist/index137.js +1 -1
  34. package/dist/index14.js +2 -2
  35. package/dist/index141.js +1 -1
  36. package/dist/index15.js +2 -2
  37. package/dist/index17.js +4 -4
  38. package/dist/index18.js +2 -2
  39. package/dist/index20.js +1 -1
  40. package/dist/index21.js +1 -1
  41. package/dist/index22.js +1 -1
  42. package/dist/index23.js +2 -2
  43. package/dist/index24.js +1 -1
  44. package/dist/index25.js +3 -3
  45. package/dist/index26.js +1 -1
  46. package/dist/index27.js +2 -2
  47. package/dist/index29.js +1 -1
  48. package/dist/index33.js +1 -1
  49. package/dist/index36.js +1 -1
  50. package/dist/index37.js +1 -1
  51. package/dist/index45.js +1 -1
  52. package/dist/index46.js +1 -1
  53. package/dist/index48.js +245 -295
  54. package/dist/index49.js +5 -5
  55. package/dist/index50.js +303 -118
  56. package/dist/index51.js +12 -73
  57. package/dist/index52.js +244 -55
  58. package/dist/index53.js +9 -260
  59. package/dist/index54.js +225 -12
  60. package/dist/index55.js +11 -249
  61. package/dist/index56.js +5 -3
  62. package/dist/index57.js +114 -107
  63. package/dist/index58.js +73 -12
  64. package/dist/index59.js +82 -31
  65. package/dist/index6.js +1 -1
  66. package/dist/index60.js +846 -68
  67. package/dist/index61.js +9 -860
  68. package/dist/index62.js +118 -9
  69. package/dist/index63.js +16 -159
  70. package/dist/index64.js +54 -330
  71. package/dist/index65.js +213 -407
  72. package/dist/index66.js +407 -213
  73. package/dist/index67.js +332 -18
  74. package/dist/index68.js +148 -212
  75. package/dist/index69.js +31 -11
  76. package/dist/index7.js +1 -1
  77. package/dist/index70.js +236 -11
  78. package/dist/index71.js +2 -2
  79. package/dist/index72.js +12 -236
  80. package/dist/index73.js +242 -518
  81. package/dist/index74.js +530 -18
  82. package/dist/index75.js +20 -252
  83. package/dist/index80.js +1 -1
  84. package/dist/index82.js +1 -1
  85. package/dist/index84.js +122 -12
  86. package/dist/index85.js +130 -50
  87. package/dist/index86.js +13 -10
  88. package/dist/index87.js +68 -3
  89. package/dist/index88.js +15 -30
  90. package/dist/index89.js +9 -13
  91. package/dist/index9.js +1 -1
  92. package/dist/index90.js +50 -9
  93. package/dist/index91.js +47 -5
  94. package/dist/index92.js +5 -24
  95. package/dist/index93.js +23 -67
  96. package/dist/index94.js +12 -122
  97. package/dist/index95.js +633 -118
  98. package/dist/index96.js +9 -14
  99. package/dist/index97.js +52 -12
  100. package/dist/index98.js +10 -8
  101. package/dist/index99.js +3 -49
  102. package/package.json +1 -1
package/dist/index61.js CHANGED
@@ -1,862 +1,11 @@
1
- import * as t from "react";
2
- import * as be from "react-dom";
3
- import { clamp as Re } from "./index103.js";
4
- import { composeEventHandlers as E } from "./index79.js";
5
- import { createCollection as st } from "./index77.js";
6
- import { useComposedRefs as B } from "./index78.js";
7
- import { createContextScope as lt } from "./index76.js";
8
- import { useDirection as ct } from "./index83.js";
9
- import { DismissableLayer as it } from "./index94.js";
10
- import { useFocusGuards as at } from "./index97.js";
11
- import { FocusScope as dt } from "./index95.js";
12
- import { useId as Ie } from "./index82.js";
13
- import { createPopperScope as _e, Root as ut, Anchor as pt, Content as ft, Arrow as mt } from "./index104.js";
14
- import { Portal as ht } from "./index96.js";
15
- import { Primitive as M } from "./index81.js";
16
- import { createSlot as vt } from "./index105.js";
17
- import { useCallbackRef as gt } from "./index86.js";
18
- import { useControllableState as Ee } from "./index80.js";
19
- import { useLayoutEffect as Y } from "./index87.js";
20
- import { usePrevious as St } from "./index91.js";
21
- import { VISUALLY_HIDDEN_STYLES as wt } from "./index106.js";
22
- import { hideOthers as Ct } from "./index99.js";
23
- import yt from "./index98.js";
24
- import { jsx as m, jsxs as ce, Fragment as Te } from "react/jsx-runtime";
25
- var xt = [" ", "Enter", "ArrowUp", "ArrowDown"], It = [" ", "Enter"], J = "Select", [ae, de, Tt] = st(J), [te] = lt(J, [
26
- Tt,
27
- _e
28
- ]), ue = _e(), [Pt, j] = te(J), [Rt, Et] = te(J), Ne = (n) => {
29
- const {
30
- __scopeSelect: c,
31
- children: e,
32
- open: i,
33
- defaultOpen: l,
34
- onOpenChange: u,
35
- value: r,
36
- defaultValue: s,
37
- onValueChange: o,
38
- dir: p,
39
- name: g,
40
- autoComplete: C,
41
- disabled: P,
42
- required: R,
43
- form: T
44
- } = n, a = ue(c), [v, y] = t.useState(null), [d, h] = t.useState(null), [A, O] = t.useState(!1), oe = ct(p), [b, L] = Ee({
45
- prop: i,
46
- defaultProp: l ?? !1,
47
- onChange: u,
48
- caller: J
49
- }), [K, X] = Ee({
50
- prop: r,
51
- defaultProp: s,
52
- onChange: o,
53
- caller: J
54
- }), V = t.useRef(null), H = v ? T || !!v.closest("form") : !0, [G, U] = t.useState(/* @__PURE__ */ new Set()), W = Array.from(G).map((_) => _.props.value).join(";");
55
- return /* @__PURE__ */ m(ut, { ...a, children: /* @__PURE__ */ ce(
56
- Pt,
57
- {
58
- required: R,
59
- scope: c,
60
- trigger: v,
61
- onTriggerChange: y,
62
- valueNode: d,
63
- onValueNodeChange: h,
64
- valueNodeHasChildren: A,
65
- onValueNodeHasChildrenChange: O,
66
- contentId: Ie(),
67
- value: K,
68
- onValueChange: X,
69
- open: b,
70
- onOpenChange: L,
71
- dir: oe,
72
- triggerPointerDownPosRef: V,
73
- disabled: P,
74
- children: [
75
- /* @__PURE__ */ m(ae.Provider, { scope: c, children: /* @__PURE__ */ m(
76
- Rt,
77
- {
78
- scope: n.__scopeSelect,
79
- onNativeOptionAdd: t.useCallback((_) => {
80
- U((k) => new Set(k).add(_));
81
- }, []),
82
- onNativeOptionRemove: t.useCallback((_) => {
83
- U((k) => {
84
- const F = new Set(k);
85
- return F.delete(_), F;
86
- });
87
- }, []),
88
- children: e
89
- }
90
- ) }),
91
- H ? /* @__PURE__ */ ce(
92
- tt,
93
- {
94
- "aria-hidden": !0,
95
- required: R,
96
- tabIndex: -1,
97
- name: g,
98
- autoComplete: C,
99
- value: K,
100
- onChange: (_) => X(_.target.value),
101
- disabled: P,
102
- form: T,
103
- children: [
104
- K === void 0 ? /* @__PURE__ */ m("option", { value: "" }) : null,
105
- Array.from(G)
106
- ]
107
- },
108
- W
109
- ) : null
110
- ]
111
- }
112
- ) });
113
- };
114
- Ne.displayName = J;
115
- var Me = "SelectTrigger", Ae = t.forwardRef(
116
- (n, c) => {
117
- const { __scopeSelect: e, disabled: i = !1, ...l } = n, u = ue(e), r = j(Me, e), s = r.disabled || i, o = B(c, r.onTriggerChange), p = de(e), g = t.useRef("touch"), [C, P, R] = nt((a) => {
118
- const v = p().filter((h) => !h.disabled), y = v.find((h) => h.value === r.value), d = rt(v, a, y);
119
- d !== void 0 && r.onValueChange(d.value);
120
- }), T = (a) => {
121
- s || (r.onOpenChange(!0), R()), a && (r.triggerPointerDownPosRef.current = {
122
- x: Math.round(a.pageX),
123
- y: Math.round(a.pageY)
124
- });
125
- };
126
- return /* @__PURE__ */ m(pt, { asChild: !0, ...u, children: /* @__PURE__ */ m(
127
- M.button,
128
- {
129
- type: "button",
130
- role: "combobox",
131
- "aria-controls": r.contentId,
132
- "aria-expanded": r.open,
133
- "aria-required": r.required,
134
- "aria-autocomplete": "none",
135
- dir: r.dir,
136
- "data-state": r.open ? "open" : "closed",
137
- disabled: s,
138
- "data-disabled": s ? "" : void 0,
139
- "data-placeholder": ot(r.value) ? "" : void 0,
140
- ...l,
141
- ref: o,
142
- onClick: E(l.onClick, (a) => {
143
- a.currentTarget.focus(), g.current !== "mouse" && T(a);
144
- }),
145
- onPointerDown: E(l.onPointerDown, (a) => {
146
- g.current = a.pointerType;
147
- const v = a.target;
148
- v.hasPointerCapture(a.pointerId) && v.releasePointerCapture(a.pointerId), a.button === 0 && a.ctrlKey === !1 && a.pointerType === "mouse" && (T(a), a.preventDefault());
149
- }),
150
- onKeyDown: E(l.onKeyDown, (a) => {
151
- const v = C.current !== "";
152
- !(a.ctrlKey || a.altKey || a.metaKey) && a.key.length === 1 && P(a.key), !(v && a.key === " ") && xt.includes(a.key) && (T(), a.preventDefault());
153
- })
154
- }
155
- ) });
156
- }
157
- );
158
- Ae.displayName = Me;
159
- var Oe = "SelectValue", De = t.forwardRef(
160
- (n, c) => {
161
- const { __scopeSelect: e, className: i, style: l, children: u, placeholder: r = "", ...s } = n, o = j(Oe, e), { onValueNodeHasChildrenChange: p } = o, g = u !== void 0, C = B(c, o.onValueNodeChange);
162
- return Y(() => {
163
- p(g);
164
- }, [p, g]), /* @__PURE__ */ m(
165
- M.span,
166
- {
167
- ...s,
168
- ref: C,
169
- style: { pointerEvents: "none" },
170
- children: ot(o.value) ? /* @__PURE__ */ m(Te, { children: r }) : u
171
- }
172
- );
173
- }
174
- );
175
- De.displayName = Oe;
176
- var bt = "SelectIcon", Le = t.forwardRef(
177
- (n, c) => {
178
- const { __scopeSelect: e, children: i, ...l } = n;
179
- return /* @__PURE__ */ m(M.span, { "aria-hidden": !0, ...l, ref: c, children: i || "▼" });
180
- }
181
- );
182
- Le.displayName = bt;
183
- var _t = "SelectPortal", ke = (n) => /* @__PURE__ */ m(ht, { asChild: !0, ...n });
184
- ke.displayName = _t;
185
- var Q = "SelectContent", Be = t.forwardRef(
186
- (n, c) => {
187
- const e = j(Q, n.__scopeSelect), [i, l] = t.useState();
188
- if (Y(() => {
189
- l(new DocumentFragment());
190
- }, []), !e.open) {
191
- const u = i;
192
- return u ? be.createPortal(
193
- /* @__PURE__ */ m(Ve, { scope: n.__scopeSelect, children: /* @__PURE__ */ m(ae.Slot, { scope: n.__scopeSelect, children: /* @__PURE__ */ m("div", { children: n.children }) }) }),
194
- u
195
- ) : null;
196
- }
197
- return /* @__PURE__ */ m(He, { ...n, ref: c });
198
- }
199
- );
200
- Be.displayName = Q;
201
- var D = 10, [Ve, q] = te(Q), Nt = "SelectContentImpl", Mt = vt("SelectContent.RemoveScroll"), He = t.forwardRef(
202
- (n, c) => {
203
- const {
204
- __scopeSelect: e,
205
- position: i = "item-aligned",
206
- onCloseAutoFocus: l,
207
- onEscapeKeyDown: u,
208
- onPointerDownOutside: r,
209
- //
210
- // PopperContent props
211
- side: s,
212
- sideOffset: o,
213
- align: p,
214
- alignOffset: g,
215
- arrowPadding: C,
216
- collisionBoundary: P,
217
- collisionPadding: R,
218
- sticky: T,
219
- hideWhenDetached: a,
220
- avoidCollisions: v,
221
- //
222
- ...y
223
- } = n, d = j(Q, e), [h, A] = t.useState(null), [O, oe] = t.useState(null), b = B(c, (f) => A(f)), [L, K] = t.useState(null), [X, V] = t.useState(
224
- null
225
- ), H = de(e), [G, U] = t.useState(!1), W = t.useRef(!1);
226
- t.useEffect(() => {
227
- if (h) return Ct(h);
228
- }, [h]), at();
229
- const _ = t.useCallback(
230
- (f) => {
231
- const [I, ...N] = H().map((w) => w.ref.current), [x] = N.slice(-1), S = document.activeElement;
232
- for (const w of f)
233
- if (w === S || (w == null || w.scrollIntoView({ block: "nearest" }), w === I && O && (O.scrollTop = 0), w === x && O && (O.scrollTop = O.scrollHeight), w == null || w.focus(), document.activeElement !== S)) return;
234
- },
235
- [H, O]
236
- ), k = t.useCallback(
237
- () => _([L, h]),
238
- [_, L, h]
239
- );
240
- t.useEffect(() => {
241
- G && k();
242
- }, [G, k]);
243
- const { onOpenChange: F, triggerPointerDownPosRef: z } = d;
244
- t.useEffect(() => {
245
- if (h) {
246
- let f = { x: 0, y: 0 };
247
- const I = (x) => {
248
- var S, w;
249
- f = {
250
- x: Math.abs(Math.round(x.pageX) - (((S = z.current) == null ? void 0 : S.x) ?? 0)),
251
- y: Math.abs(Math.round(x.pageY) - (((w = z.current) == null ? void 0 : w.y) ?? 0))
252
- };
253
- }, N = (x) => {
254
- f.x <= 10 && f.y <= 10 ? x.preventDefault() : h.contains(x.target) || F(!1), document.removeEventListener("pointermove", I), z.current = null;
255
- };
256
- return z.current !== null && (document.addEventListener("pointermove", I), document.addEventListener("pointerup", N, { capture: !0, once: !0 })), () => {
257
- document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", N, { capture: !0 });
258
- };
259
- }
260
- }, [h, F, z]), t.useEffect(() => {
261
- const f = () => F(!1);
262
- return window.addEventListener("blur", f), window.addEventListener("resize", f), () => {
263
- window.removeEventListener("blur", f), window.removeEventListener("resize", f);
264
- };
265
- }, [F]);
266
- const [pe, se] = nt((f) => {
267
- const I = H().filter((S) => !S.disabled), N = I.find((S) => S.ref.current === document.activeElement), x = rt(I, f, N);
268
- x && setTimeout(() => x.ref.current.focus());
269
- }), fe = t.useCallback(
270
- (f, I, N) => {
271
- const x = !W.current && !N;
272
- (d.value !== void 0 && d.value === I || x) && (K(f), x && (W.current = !0));
273
- },
274
- [d.value]
275
- ), me = t.useCallback(() => h == null ? void 0 : h.focus(), [h]), ee = t.useCallback(
276
- (f, I, N) => {
277
- const x = !W.current && !N;
278
- (d.value !== void 0 && d.value === I || x) && V(f);
279
- },
280
- [d.value]
281
- ), le = i === "popper" ? Se : Ue, ne = le === Se ? {
282
- side: s,
283
- sideOffset: o,
284
- align: p,
285
- alignOffset: g,
286
- arrowPadding: C,
287
- collisionBoundary: P,
288
- collisionPadding: R,
289
- sticky: T,
290
- hideWhenDetached: a,
291
- avoidCollisions: v
292
- } : {};
293
- return /* @__PURE__ */ m(
294
- Ve,
295
- {
296
- scope: e,
297
- content: h,
298
- viewport: O,
299
- onViewportChange: oe,
300
- itemRefCallback: fe,
301
- selectedItem: L,
302
- onItemLeave: me,
303
- itemTextRefCallback: ee,
304
- focusSelectedItem: k,
305
- selectedItemText: X,
306
- position: i,
307
- isPositioned: G,
308
- searchRef: pe,
309
- children: /* @__PURE__ */ m(yt, { as: Mt, allowPinchZoom: !0, children: /* @__PURE__ */ m(
310
- dt,
311
- {
312
- asChild: !0,
313
- trapped: d.open,
314
- onMountAutoFocus: (f) => {
315
- f.preventDefault();
316
- },
317
- onUnmountAutoFocus: E(l, (f) => {
318
- var I;
319
- (I = d.trigger) == null || I.focus({ preventScroll: !0 }), f.preventDefault();
320
- }),
321
- children: /* @__PURE__ */ m(
322
- it,
323
- {
324
- asChild: !0,
325
- disableOutsidePointerEvents: !0,
326
- onEscapeKeyDown: u,
327
- onPointerDownOutside: r,
328
- onFocusOutside: (f) => f.preventDefault(),
329
- onDismiss: () => d.onOpenChange(!1),
330
- children: /* @__PURE__ */ m(
331
- le,
332
- {
333
- role: "listbox",
334
- id: d.contentId,
335
- "data-state": d.open ? "open" : "closed",
336
- dir: d.dir,
337
- onContextMenu: (f) => f.preventDefault(),
338
- ...y,
339
- ...ne,
340
- onPlaced: () => U(!0),
341
- ref: b,
342
- style: {
343
- // flex layout so we can place the scroll buttons properly
344
- display: "flex",
345
- flexDirection: "column",
346
- // reset the outline by default as the content MAY get focused
347
- outline: "none",
348
- ...y.style
349
- },
350
- onKeyDown: E(y.onKeyDown, (f) => {
351
- const I = f.ctrlKey || f.altKey || f.metaKey;
352
- if (f.key === "Tab" && f.preventDefault(), !I && f.key.length === 1 && se(f.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(f.key)) {
353
- let x = H().filter((S) => !S.disabled).map((S) => S.ref.current);
354
- if (["ArrowUp", "End"].includes(f.key) && (x = x.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(f.key)) {
355
- const S = f.target, w = x.indexOf(S);
356
- x = x.slice(w + 1);
357
- }
358
- setTimeout(() => _(x)), f.preventDefault();
359
- }
360
- })
361
- }
362
- )
363
- }
364
- )
365
- }
366
- ) })
367
- }
368
- );
369
- }
370
- );
371
- He.displayName = Nt;
372
- var At = "SelectItemAlignedPosition", Ue = t.forwardRef((n, c) => {
373
- const { __scopeSelect: e, onPlaced: i, ...l } = n, u = j(Q, e), r = q(Q, e), [s, o] = t.useState(null), [p, g] = t.useState(null), C = B(c, (b) => g(b)), P = de(e), R = t.useRef(!1), T = t.useRef(!0), { viewport: a, selectedItem: v, selectedItemText: y, focusSelectedItem: d } = r, h = t.useCallback(() => {
374
- if (u.trigger && u.valueNode && s && p && a && v && y) {
375
- const b = u.trigger.getBoundingClientRect(), L = p.getBoundingClientRect(), K = u.valueNode.getBoundingClientRect(), X = y.getBoundingClientRect();
376
- if (u.dir !== "rtl") {
377
- const S = X.left - L.left, w = K.left - S, Z = b.left - w, $ = b.width + Z, he = Math.max($, L.width), ve = window.innerWidth - D, ge = Re(w, [
378
- D,
379
- // Prevents the content from going off the starting edge of the
380
- // viewport. It may still go off the ending edge, but this can be
381
- // controlled by the user since they may want to manage overflow in a
382
- // specific way.
383
- // https://github.com/radix-ui/primitives/issues/2049
384
- Math.max(D, ve - he)
385
- ]);
386
- s.style.minWidth = $ + "px", s.style.left = ge + "px";
387
- } else {
388
- const S = L.right - X.right, w = window.innerWidth - K.right - S, Z = window.innerWidth - b.right - w, $ = b.width + Z, he = Math.max($, L.width), ve = window.innerWidth - D, ge = Re(w, [
389
- D,
390
- Math.max(D, ve - he)
391
- ]);
392
- s.style.minWidth = $ + "px", s.style.right = ge + "px";
393
- }
394
- const V = P(), H = window.innerHeight - D * 2, G = a.scrollHeight, U = window.getComputedStyle(p), W = parseInt(U.borderTopWidth, 10), _ = parseInt(U.paddingTop, 10), k = parseInt(U.borderBottomWidth, 10), F = parseInt(U.paddingBottom, 10), z = W + _ + G + F + k, pe = Math.min(v.offsetHeight * 5, z), se = window.getComputedStyle(a), fe = parseInt(se.paddingTop, 10), me = parseInt(se.paddingBottom, 10), ee = b.top + b.height / 2 - D, le = H - ee, ne = v.offsetHeight / 2, f = v.offsetTop + ne, I = W + _ + f, N = z - I;
395
- if (I <= ee) {
396
- const S = V.length > 0 && v === V[V.length - 1].ref.current;
397
- s.style.bottom = "0px";
398
- const w = p.clientHeight - a.offsetTop - a.offsetHeight, Z = Math.max(
399
- le,
400
- ne + // viewport might have padding bottom, include it to avoid a scrollable viewport
401
- (S ? me : 0) + w + k
402
- ), $ = I + Z;
403
- s.style.height = $ + "px";
404
- } else {
405
- const S = V.length > 0 && v === V[0].ref.current;
406
- s.style.top = "0px";
407
- const Z = Math.max(
408
- ee,
409
- W + a.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
410
- (S ? fe : 0) + ne
411
- ) + N;
412
- s.style.height = Z + "px", a.scrollTop = I - ee + a.offsetTop;
413
- }
414
- s.style.margin = `${D}px 0`, s.style.minHeight = pe + "px", s.style.maxHeight = H + "px", i == null || i(), requestAnimationFrame(() => R.current = !0);
415
- }
416
- }, [
417
- P,
418
- u.trigger,
419
- u.valueNode,
420
- s,
421
- p,
422
- a,
423
- v,
424
- y,
425
- u.dir,
426
- i
427
- ]);
428
- Y(() => h(), [h]);
429
- const [A, O] = t.useState();
430
- Y(() => {
431
- p && O(window.getComputedStyle(p).zIndex);
432
- }, [p]);
433
- const oe = t.useCallback(
434
- (b) => {
435
- b && T.current === !0 && (h(), d == null || d(), T.current = !1);
436
- },
437
- [h, d]
438
- );
439
- return /* @__PURE__ */ m(
440
- Dt,
441
- {
442
- scope: e,
443
- contentWrapper: s,
444
- shouldExpandOnScrollRef: R,
445
- onScrollButtonChange: oe,
446
- children: /* @__PURE__ */ m(
447
- "div",
448
- {
449
- ref: o,
450
- style: {
451
- display: "flex",
452
- flexDirection: "column",
453
- position: "fixed",
454
- zIndex: A
455
- },
456
- children: /* @__PURE__ */ m(
457
- M.div,
458
- {
459
- ...l,
460
- ref: C,
461
- style: {
462
- // When we get the height of the content, it includes borders. If we were to set
463
- // the height without having `boxSizing: 'border-box'` it would be too big.
464
- boxSizing: "border-box",
465
- // We need to ensure the content doesn't get taller than the wrapper
466
- maxHeight: "100%",
467
- ...l.style
468
- }
469
- }
470
- )
471
- }
472
- )
473
- }
474
- );
475
- });
476
- Ue.displayName = At;
477
- var Ot = "SelectPopperPosition", Se = t.forwardRef((n, c) => {
478
- const {
479
- __scopeSelect: e,
480
- align: i = "start",
481
- collisionPadding: l = D,
482
- ...u
483
- } = n, r = ue(e);
484
- return /* @__PURE__ */ m(
485
- ft,
486
- {
487
- ...r,
488
- ...u,
489
- ref: c,
490
- align: i,
491
- collisionPadding: l,
492
- style: {
493
- // Ensure border-box for floating-ui calculations
494
- boxSizing: "border-box",
495
- ...u.style,
496
- "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
497
- "--radix-select-content-available-width": "var(--radix-popper-available-width)",
498
- "--radix-select-content-available-height": "var(--radix-popper-available-height)",
499
- "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
500
- "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
501
- }
502
- }
503
- );
504
- });
505
- Se.displayName = Ot;
506
- var [Dt, Pe] = te(Q, {}), we = "SelectViewport", We = t.forwardRef(
507
- (n, c) => {
508
- const { __scopeSelect: e, nonce: i, ...l } = n, u = q(we, e), r = Pe(we, e), s = B(c, u.onViewportChange), o = t.useRef(0);
509
- return /* @__PURE__ */ ce(Te, { children: [
510
- /* @__PURE__ */ m(
511
- "style",
512
- {
513
- dangerouslySetInnerHTML: {
514
- __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
515
- },
516
- nonce: i
517
- }
518
- ),
519
- /* @__PURE__ */ m(ae.Slot, { scope: e, children: /* @__PURE__ */ m(
520
- M.div,
521
- {
522
- "data-radix-select-viewport": "",
523
- role: "presentation",
524
- ...l,
525
- ref: s,
526
- style: {
527
- // we use position: 'relative' here on the `viewport` so that when we call
528
- // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
529
- // (independent of the scrollUpButton).
530
- position: "relative",
531
- flex: 1,
532
- // Viewport should only be scrollable in the vertical direction.
533
- // This won't work in vertical writing modes, so we'll need to
534
- // revisit this if/when that is supported
535
- // https://developer.chrome.com/blog/vertical-form-controls
536
- overflow: "hidden auto",
537
- ...l.style
538
- },
539
- onScroll: E(l.onScroll, (p) => {
540
- const g = p.currentTarget, { contentWrapper: C, shouldExpandOnScrollRef: P } = r;
541
- if (P != null && P.current && C) {
542
- const R = Math.abs(o.current - g.scrollTop);
543
- if (R > 0) {
544
- const T = window.innerHeight - D * 2, a = parseFloat(C.style.minHeight), v = parseFloat(C.style.height), y = Math.max(a, v);
545
- if (y < T) {
546
- const d = y + R, h = Math.min(T, d), A = d - h;
547
- C.style.height = h + "px", C.style.bottom === "0px" && (g.scrollTop = A > 0 ? A : 0, C.style.justifyContent = "flex-end");
548
- }
549
- }
550
- }
551
- o.current = g.scrollTop;
552
- })
553
- }
554
- ) })
555
- ] });
556
- }
557
- );
558
- We.displayName = we;
559
- var Fe = "SelectGroup", [Lt, kt] = te(Fe), Ke = t.forwardRef(
560
- (n, c) => {
561
- const { __scopeSelect: e, ...i } = n, l = Ie();
562
- return /* @__PURE__ */ m(Lt, { scope: e, id: l, children: /* @__PURE__ */ m(M.div, { role: "group", "aria-labelledby": l, ...i, ref: c }) });
563
- }
564
- );
565
- Ke.displayName = Fe;
566
- var Ge = "SelectLabel", ze = t.forwardRef(
567
- (n, c) => {
568
- const { __scopeSelect: e, ...i } = n, l = kt(Ge, e);
569
- return /* @__PURE__ */ m(M.div, { id: l.id, ...i, ref: c });
570
- }
571
- );
572
- ze.displayName = Ge;
573
- var ie = "SelectItem", [Bt, Ye] = te(ie), je = t.forwardRef(
574
- (n, c) => {
575
- const {
576
- __scopeSelect: e,
577
- value: i,
578
- disabled: l = !1,
579
- textValue: u,
580
- ...r
581
- } = n, s = j(ie, e), o = q(ie, e), p = s.value === i, [g, C] = t.useState(u ?? ""), [P, R] = t.useState(!1), T = B(
582
- c,
583
- (d) => {
584
- var h;
585
- return (h = o.itemRefCallback) == null ? void 0 : h.call(o, d, i, l);
586
- }
587
- ), a = Ie(), v = t.useRef("touch"), y = () => {
588
- l || (s.onValueChange(i), s.onOpenChange(!1));
589
- };
590
- if (i === "")
591
- throw new Error(
592
- "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."
593
- );
594
- return /* @__PURE__ */ m(
595
- Bt,
596
- {
597
- scope: e,
598
- value: i,
599
- disabled: l,
600
- textId: a,
601
- isSelected: p,
602
- onItemTextChange: t.useCallback((d) => {
603
- C((h) => h || ((d == null ? void 0 : d.textContent) ?? "").trim());
604
- }, []),
605
- children: /* @__PURE__ */ m(
606
- ae.ItemSlot,
607
- {
608
- scope: e,
609
- value: i,
610
- disabled: l,
611
- textValue: g,
612
- children: /* @__PURE__ */ m(
613
- M.div,
614
- {
615
- role: "option",
616
- "aria-labelledby": a,
617
- "data-highlighted": P ? "" : void 0,
618
- "aria-selected": p && P,
619
- "data-state": p ? "checked" : "unchecked",
620
- "aria-disabled": l || void 0,
621
- "data-disabled": l ? "" : void 0,
622
- tabIndex: l ? void 0 : -1,
623
- ...r,
624
- ref: T,
625
- onFocus: E(r.onFocus, () => R(!0)),
626
- onBlur: E(r.onBlur, () => R(!1)),
627
- onClick: E(r.onClick, () => {
628
- v.current !== "mouse" && y();
629
- }),
630
- onPointerUp: E(r.onPointerUp, () => {
631
- v.current === "mouse" && y();
632
- }),
633
- onPointerDown: E(r.onPointerDown, (d) => {
634
- v.current = d.pointerType;
635
- }),
636
- onPointerMove: E(r.onPointerMove, (d) => {
637
- var h;
638
- v.current = d.pointerType, l ? (h = o.onItemLeave) == null || h.call(o) : v.current === "mouse" && d.currentTarget.focus({ preventScroll: !0 });
639
- }),
640
- onPointerLeave: E(r.onPointerLeave, (d) => {
641
- var h;
642
- d.currentTarget === document.activeElement && ((h = o.onItemLeave) == null || h.call(o));
643
- }),
644
- onKeyDown: E(r.onKeyDown, (d) => {
645
- var A;
646
- ((A = o.searchRef) == null ? void 0 : A.current) !== "" && d.key === " " || (It.includes(d.key) && y(), d.key === " " && d.preventDefault());
647
- })
648
- }
649
- )
650
- }
651
- )
652
- }
653
- );
654
- }
655
- );
656
- je.displayName = ie;
657
- var re = "SelectItemText", qe = t.forwardRef(
658
- (n, c) => {
659
- const { __scopeSelect: e, className: i, style: l, ...u } = n, r = j(re, e), s = q(re, e), o = Ye(re, e), p = Et(re, e), [g, C] = t.useState(null), P = B(
660
- c,
661
- (y) => C(y),
662
- o.onItemTextChange,
663
- (y) => {
664
- var d;
665
- return (d = s.itemTextRefCallback) == null ? void 0 : d.call(s, y, o.value, o.disabled);
666
- }
667
- ), R = g == null ? void 0 : g.textContent, T = t.useMemo(
668
- () => /* @__PURE__ */ m("option", { value: o.value, disabled: o.disabled, children: R }, o.value),
669
- [o.disabled, o.value, R]
670
- ), { onNativeOptionAdd: a, onNativeOptionRemove: v } = p;
671
- return Y(() => (a(T), () => v(T)), [a, v, T]), /* @__PURE__ */ ce(Te, { children: [
672
- /* @__PURE__ */ m(M.span, { id: o.textId, ...u, ref: P }),
673
- o.isSelected && r.valueNode && !r.valueNodeHasChildren ? be.createPortal(u.children, r.valueNode) : null
674
- ] });
675
- }
676
- );
677
- qe.displayName = re;
678
- var Xe = "SelectItemIndicator", Ze = t.forwardRef(
679
- (n, c) => {
680
- const { __scopeSelect: e, ...i } = n;
681
- return Ye(Xe, e).isSelected ? /* @__PURE__ */ m(M.span, { "aria-hidden": !0, ...i, ref: c }) : null;
682
- }
683
- );
684
- Ze.displayName = Xe;
685
- var Ce = "SelectScrollUpButton", $e = t.forwardRef((n, c) => {
686
- const e = q(Ce, n.__scopeSelect), i = Pe(Ce, n.__scopeSelect), [l, u] = t.useState(!1), r = B(c, i.onScrollButtonChange);
687
- return Y(() => {
688
- if (e.viewport && e.isPositioned) {
689
- let s = function() {
690
- const p = o.scrollTop > 0;
691
- u(p);
692
- };
693
- const o = e.viewport;
694
- return s(), o.addEventListener("scroll", s), () => o.removeEventListener("scroll", s);
695
- }
696
- }, [e.viewport, e.isPositioned]), l ? /* @__PURE__ */ m(
697
- Qe,
698
- {
699
- ...n,
700
- ref: r,
701
- onAutoScroll: () => {
702
- const { viewport: s, selectedItem: o } = e;
703
- s && o && (s.scrollTop = s.scrollTop - o.offsetHeight);
704
- }
705
- }
706
- ) : null;
707
- });
708
- $e.displayName = Ce;
709
- var ye = "SelectScrollDownButton", Je = t.forwardRef((n, c) => {
710
- const e = q(ye, n.__scopeSelect), i = Pe(ye, n.__scopeSelect), [l, u] = t.useState(!1), r = B(c, i.onScrollButtonChange);
711
- return Y(() => {
712
- if (e.viewport && e.isPositioned) {
713
- let s = function() {
714
- const p = o.scrollHeight - o.clientHeight, g = Math.ceil(o.scrollTop) < p;
715
- u(g);
716
- };
717
- const o = e.viewport;
718
- return s(), o.addEventListener("scroll", s), () => o.removeEventListener("scroll", s);
719
- }
720
- }, [e.viewport, e.isPositioned]), l ? /* @__PURE__ */ m(
721
- Qe,
722
- {
723
- ...n,
724
- ref: r,
725
- onAutoScroll: () => {
726
- const { viewport: s, selectedItem: o } = e;
727
- s && o && (s.scrollTop = s.scrollTop + o.offsetHeight);
728
- }
729
- }
730
- ) : null;
731
- });
732
- Je.displayName = ye;
733
- var Qe = t.forwardRef((n, c) => {
734
- const { __scopeSelect: e, onAutoScroll: i, ...l } = n, u = q("SelectScrollButton", e), r = t.useRef(null), s = de(e), o = t.useCallback(() => {
735
- r.current !== null && (window.clearInterval(r.current), r.current = null);
736
- }, []);
737
- return t.useEffect(() => () => o(), [o]), Y(() => {
738
- var g;
739
- const p = s().find((C) => C.ref.current === document.activeElement);
740
- (g = p == null ? void 0 : p.ref.current) == null || g.scrollIntoView({ block: "nearest" });
741
- }, [s]), /* @__PURE__ */ m(
742
- M.div,
743
- {
744
- "aria-hidden": !0,
745
- ...l,
746
- ref: c,
747
- style: { flexShrink: 0, ...l.style },
748
- onPointerDown: E(l.onPointerDown, () => {
749
- r.current === null && (r.current = window.setInterval(i, 50));
750
- }),
751
- onPointerMove: E(l.onPointerMove, () => {
752
- var p;
753
- (p = u.onItemLeave) == null || p.call(u), r.current === null && (r.current = window.setInterval(i, 50));
754
- }),
755
- onPointerLeave: E(l.onPointerLeave, () => {
756
- o();
757
- })
758
- }
759
- );
760
- }), Vt = "SelectSeparator", et = t.forwardRef(
761
- (n, c) => {
762
- const { __scopeSelect: e, ...i } = n;
763
- return /* @__PURE__ */ m(M.div, { "aria-hidden": !0, ...i, ref: c });
764
- }
765
- );
766
- et.displayName = Vt;
767
- var xe = "SelectArrow", Ht = t.forwardRef(
768
- (n, c) => {
769
- const { __scopeSelect: e, ...i } = n, l = ue(e), u = j(xe, e), r = q(xe, e);
770
- return u.open && r.position === "popper" ? /* @__PURE__ */ m(mt, { ...l, ...i, ref: c }) : null;
771
- }
772
- );
773
- Ht.displayName = xe;
774
- var Ut = "SelectBubbleInput", tt = t.forwardRef(
775
- ({ __scopeSelect: n, value: c, ...e }, i) => {
776
- const l = t.useRef(null), u = B(i, l), r = St(c);
777
- return t.useEffect(() => {
778
- const s = l.current;
779
- if (!s) return;
780
- const o = window.HTMLSelectElement.prototype, g = Object.getOwnPropertyDescriptor(
781
- o,
782
- "value"
783
- ).set;
784
- if (r !== c && g) {
785
- const C = new Event("change", { bubbles: !0 });
786
- g.call(s, c), s.dispatchEvent(C);
787
- }
788
- }, [r, c]), /* @__PURE__ */ m(
789
- M.select,
790
- {
791
- ...e,
792
- style: { ...wt, ...e.style },
793
- ref: u,
794
- defaultValue: c
795
- }
796
- );
797
- }
798
- );
799
- tt.displayName = Ut;
800
- function ot(n) {
801
- return n === "" || n === void 0;
802
- }
803
- function nt(n) {
804
- const c = gt(n), e = t.useRef(""), i = t.useRef(0), l = t.useCallback(
805
- (r) => {
806
- const s = e.current + r;
807
- c(s), function o(p) {
808
- e.current = p, window.clearTimeout(i.current), p !== "" && (i.current = window.setTimeout(() => o(""), 1e3));
809
- }(s);
810
- },
811
- [c]
812
- ), u = t.useCallback(() => {
813
- e.current = "", window.clearTimeout(i.current);
814
- }, []);
815
- return t.useEffect(() => () => window.clearTimeout(i.current), []), [e, l, u];
816
- }
817
- function rt(n, c, e) {
818
- const l = c.length > 1 && Array.from(c).every((p) => p === c[0]) ? c[0] : c, u = e ? n.indexOf(e) : -1;
819
- let r = Wt(n, Math.max(u, 0));
820
- l.length === 1 && (r = r.filter((p) => p !== e));
821
- const o = r.find(
822
- (p) => p.textValue.toLowerCase().startsWith(l.toLowerCase())
823
- );
824
- return o !== e ? o : void 0;
825
- }
826
- function Wt(n, c) {
827
- return n.map((e, i) => n[(c + i) % n.length]);
828
- }
829
- var uo = Ne, po = Ae, fo = De, mo = Le, ho = ke, vo = Be, go = We, So = Ke, wo = ze, Co = je, yo = qe, xo = Ze, Io = $e, To = Je, Po = et;
1
+ import e from "./index121.js";
2
+ /**
3
+ * @license lucide-react v0.460.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */
8
+ const r = e("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
830
9
  export {
831
- vo as Content,
832
- So as Group,
833
- mo as Icon,
834
- Co as Item,
835
- xo as ItemIndicator,
836
- yo as ItemText,
837
- wo as Label,
838
- ho as Portal,
839
- uo as Root,
840
- To as ScrollDownButton,
841
- Io as ScrollUpButton,
842
- Ne as Select,
843
- Ht as SelectArrow,
844
- Be as SelectContent,
845
- Ke as SelectGroup,
846
- Le as SelectIcon,
847
- je as SelectItem,
848
- Ze as SelectItemIndicator,
849
- qe as SelectItemText,
850
- ze as SelectLabel,
851
- ke as SelectPortal,
852
- Je as SelectScrollDownButton,
853
- $e as SelectScrollUpButton,
854
- et as SelectSeparator,
855
- Ae as SelectTrigger,
856
- De as SelectValue,
857
- We as SelectViewport,
858
- Po as Separator,
859
- po as Trigger,
860
- fo as Value,
861
- go as Viewport
10
+ r as default
862
11
  };