@drjoshcsimmons/scl 0.1.13 → 0.1.15

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 (115) hide show
  1. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
  2. package/dist/index100.js +25 -30
  3. package/dist/index101.js +8 -12
  4. package/dist/index102.js +177 -51
  5. package/dist/index103.js +47 -29
  6. package/dist/index104.js +30 -4
  7. package/dist/index105.js +52 -216
  8. package/dist/index106.js +29 -47
  9. package/dist/index107.js +30 -30
  10. package/dist/index108.js +650 -30
  11. package/dist/index110.js +30 -9
  12. package/dist/index111.js +8 -180
  13. package/dist/index112.js +15 -30
  14. package/dist/index113.js +6 -48
  15. package/dist/index115.js +47 -11
  16. package/dist/index116.js +11 -47
  17. package/dist/index117.js +206 -6
  18. package/dist/index118.js +20 -204
  19. package/dist/index119.js +399 -21
  20. package/dist/index12.js +1 -1
  21. package/dist/index120.js +20 -399
  22. package/dist/index121.js +3 -15
  23. package/dist/index122.js +32 -3
  24. package/dist/index123.js +12 -32
  25. package/dist/index124.js +48 -18
  26. package/dist/index125.js +2 -25
  27. package/dist/index126.js +53 -29
  28. package/dist/index127.js +65 -5
  29. package/dist/index128.js +25 -2
  30. package/dist/index129.js +29 -53
  31. package/dist/index13.js +1 -1
  32. package/dist/index130.js +5 -65
  33. package/dist/index136.js +1 -1
  34. package/dist/index137.js +1 -1
  35. package/dist/index14.js +2 -2
  36. package/dist/index141.js +1 -1
  37. package/dist/index142.js +1 -1
  38. package/dist/index143.js +1 -1
  39. package/dist/index148.js +11 -21
  40. package/dist/index149.js +26 -11
  41. package/dist/index15.js +54 -54
  42. package/dist/index150.js +4 -27
  43. package/dist/index151.js +22 -4
  44. package/dist/index17.js +71 -72
  45. package/dist/index18.js +2 -2
  46. package/dist/index19.js +4 -4
  47. package/dist/index21.js +15 -15
  48. package/dist/index22.js +20 -20
  49. package/dist/index23.js +2 -2
  50. package/dist/index24.js +12 -12
  51. package/dist/index25.js +57 -57
  52. package/dist/index26.js +1 -1
  53. package/dist/index27.js +31 -31
  54. package/dist/index29.js +7 -7
  55. package/dist/index31.js +14 -14
  56. package/dist/index32.js +17 -17
  57. package/dist/index33.js +10 -10
  58. package/dist/index36.js +8 -8
  59. package/dist/index37.js +18 -18
  60. package/dist/index4.js +25 -25
  61. package/dist/index45.js +1 -1
  62. package/dist/index46.js +1 -1
  63. package/dist/index48.js +62 -249
  64. package/dist/index49.js +241 -12
  65. package/dist/index50.js +410 -285
  66. package/dist/index51.js +125 -12
  67. package/dist/index52.js +3 -3
  68. package/dist/index53.js +1 -1
  69. package/dist/index54.js +102 -209
  70. package/dist/index55.js +130 -11
  71. package/dist/index56.js +236 -11
  72. package/dist/index57.js +11 -125
  73. package/dist/index58.js +57 -70
  74. package/dist/index59.js +248 -76
  75. package/dist/index6.js +36 -36
  76. package/dist/index60.js +222 -822
  77. package/dist/index61.js +6 -3
  78. package/dist/index62.js +506 -94
  79. package/dist/index63.js +1 -1
  80. package/dist/index64.js +158 -57
  81. package/dist/index65.js +71 -230
  82. package/dist/index66.js +20 -433
  83. package/dist/index67.js +823 -299
  84. package/dist/index68.js +9 -161
  85. package/dist/index69.js +218 -24
  86. package/dist/index7.js +1 -1
  87. package/dist/index70.js +11 -236
  88. package/dist/index71.js +325 -119
  89. package/dist/index72.js +310 -12
  90. package/dist/index73.js +12 -254
  91. package/dist/index74.js +25 -524
  92. package/dist/index75.js +12 -22
  93. package/dist/index77.js +1 -1
  94. package/dist/index8.js +5 -5
  95. package/dist/index80.js +1 -1
  96. package/dist/index81.js +1 -1
  97. package/dist/index82.js +1 -1
  98. package/dist/index84.js +48 -118
  99. package/dist/index85.js +10 -134
  100. package/dist/index86.js +4 -14
  101. package/dist/index87.js +29 -68
  102. package/dist/index88.js +11 -13
  103. package/dist/index89.js +124 -8
  104. package/dist/index9.js +21 -21
  105. package/dist/index90.js +15 -50
  106. package/dist/index91.js +127 -40
  107. package/dist/index92.js +218 -5
  108. package/dist/index93.js +14 -25
  109. package/dist/index94.js +66 -12
  110. package/dist/index95.js +44 -646
  111. package/dist/index96.js +50 -9
  112. package/dist/index97.js +9 -55
  113. package/dist/index98.js +3 -10
  114. package/dist/index99.js +6 -4
  115. package/package.json +1 -1
package/dist/index67.js CHANGED
@@ -1,338 +1,862 @@
1
- import * as s from "react";
2
- import { composeEventHandlers as g } from "./index79.js";
3
- import { useComposedRefs as N } from "./index78.js";
4
- import { createContextScope as K } from "./index76.js";
5
- import { DismissableLayer as W } from "./index84.js";
6
- import { useId as $ } from "./index82.js";
7
- import { createPopperScope as S, Root as z, Anchor as J, Content as Q, Arrow as Z } from "./index105.js";
8
- import { Portal as ee } from "./index86.js";
9
- import { Presence as G } from "./index87.js";
10
- import { Primitive as te } from "./index81.js";
11
- import { createSlottable as oe } from "./index110.js";
12
- import { useControllableState as re } from "./index80.js";
13
- import { Root as ne } from "./index107.js";
14
- import { jsx as f, jsxs as se } from "react/jsx-runtime";
15
- var [D] = K("Tooltip", [
16
- S
17
- ]), O = S(), j = "TooltipProvider", ie = 700, L = "tooltip.open", [ae, k] = D(j), F = (t) => {
1
+ import * as t from "react";
2
+ import * as be from "react-dom";
3
+ import { clamp as Re } from "./index98.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 "./index89.js";
10
+ import { useFocusGuards as at } from "./index90.js";
11
+ import { FocusScope as dt } from "./index91.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 "./index92.js";
14
+ import { Portal as ht } from "./index93.js";
15
+ import { Primitive as M } from "./index81.js";
16
+ import { createSlot as vt } from "./index109.js";
17
+ import { useCallbackRef as gt } from "./index85.js";
18
+ import { useControllableState as Ee } from "./index80.js";
19
+ import { useLayoutEffect as Y } from "./index86.js";
20
+ import { usePrevious as St } from "./index99.js";
21
+ import { VISUALLY_HIDDEN_STYLES as wt } from "./index110.js";
22
+ import { hideOthers as Ct } from "./index96.js";
23
+ import yt from "./index97.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) => {
18
29
  const {
19
- __scopeTooltip: o,
20
- delayDuration: e = ie,
21
- skipDelayDuration: r = 300,
22
- disableHoverableContent: n = !1,
23
- children: a
24
- } = t, l = s.useRef(!0), v = s.useRef(!1), i = s.useRef(0);
25
- return s.useEffect(() => {
26
- const p = i.current;
27
- return () => window.clearTimeout(p);
28
- }, []), /* @__PURE__ */ f(
29
- ae,
30
- {
31
- scope: o,
32
- isOpenDelayedRef: l,
33
- delayDuration: e,
34
- onOpen: s.useCallback(() => {
35
- window.clearTimeout(i.current), l.current = !1;
36
- }, []),
37
- onClose: s.useCallback(() => {
38
- window.clearTimeout(i.current), i.current = window.setTimeout(
39
- () => l.current = !0,
40
- r
41
- );
42
- }, [r]),
43
- isPointerInTransitRef: v,
44
- onPointerInTransitChange: s.useCallback((p) => {
45
- v.current = p;
46
- }, []),
47
- disableHoverableContent: n,
48
- children: a
49
- }
50
- );
51
- };
52
- F.displayName = j;
53
- var R = "Tooltip", [le, _] = D(R), B = (t) => {
54
- const {
55
- __scopeTooltip: o,
30
+ __scopeSelect: c,
56
31
  children: e,
57
- open: r,
58
- defaultOpen: n,
59
- onOpenChange: a,
60
- disableHoverableContent: l,
61
- delayDuration: v
62
- } = t, i = k(R, t.__scopeTooltip), p = O(o), [c, d] = s.useState(null), h = $(), u = s.useRef(0), m = l ?? i.disableHoverableContent, y = v ?? i.delayDuration, T = s.useRef(!1), [x, C] = re({
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({
63
50
  prop: r,
64
- defaultProp: n ?? !1,
65
- onChange: (H) => {
66
- H ? (i.onOpen(), document.dispatchEvent(new CustomEvent(L))) : i.onClose(), a == null || a(H);
67
- },
68
- caller: R
69
- }), w = s.useMemo(() => x ? T.current ? "delayed-open" : "instant-open" : "closed", [x]), P = s.useCallback(() => {
70
- window.clearTimeout(u.current), u.current = 0, T.current = !1, C(!0);
71
- }, [C]), E = s.useCallback(() => {
72
- window.clearTimeout(u.current), u.current = 0, C(!1);
73
- }, [C]), I = s.useCallback(() => {
74
- window.clearTimeout(u.current), u.current = window.setTimeout(() => {
75
- T.current = !0, C(!0), u.current = 0;
76
- }, y);
77
- }, [y, C]);
78
- return s.useEffect(() => () => {
79
- u.current && (window.clearTimeout(u.current), u.current = 0);
80
- }, []), /* @__PURE__ */ f(z, { ...p, children: /* @__PURE__ */ f(
81
- le,
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,
82
57
  {
83
- scope: o,
84
- contentId: h,
85
- open: x,
86
- stateAttribute: w,
87
- trigger: c,
88
- onTriggerChange: d,
89
- onTriggerEnter: s.useCallback(() => {
90
- i.isOpenDelayedRef.current ? I() : P();
91
- }, [i.isOpenDelayedRef, I, P]),
92
- onTriggerLeave: s.useCallback(() => {
93
- m ? E() : (window.clearTimeout(u.current), u.current = 0);
94
- }, [E, m]),
95
- onOpen: P,
96
- onClose: E,
97
- disableHoverableContent: m,
98
- children: e
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
+ ]
99
111
  }
100
112
  ) });
101
113
  };
102
- B.displayName = R;
103
- var A = "TooltipTrigger", U = s.forwardRef(
104
- (t, o) => {
105
- const { __scopeTooltip: e, ...r } = t, n = _(A, e), a = k(A, e), l = O(e), v = s.useRef(null), i = N(o, v, n.onTriggerChange), p = s.useRef(!1), c = s.useRef(!1), d = s.useCallback(() => p.current = !1, []);
106
- return s.useEffect(() => () => document.removeEventListener("pointerup", d), [d]), /* @__PURE__ */ f(J, { asChild: !0, ...l, children: /* @__PURE__ */ f(
107
- te.button,
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,
108
128
  {
109
- "aria-describedby": n.open ? n.contentId : void 0,
110
- "data-state": n.stateAttribute,
111
- ...r,
112
- ref: i,
113
- onPointerMove: g(t.onPointerMove, (h) => {
114
- h.pointerType !== "touch" && !c.current && !a.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
115
- }),
116
- onPointerLeave: g(t.onPointerLeave, () => {
117
- n.onTriggerLeave(), c.current = !1;
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);
118
144
  }),
119
- onPointerDown: g(t.onPointerDown, () => {
120
- n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", d, { once: !0 });
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());
121
149
  }),
122
- onFocus: g(t.onFocus, () => {
123
- p.current || n.onOpen();
124
- }),
125
- onBlur: g(t.onBlur, n.onClose),
126
- onClick: g(t.onClick, n.onClose)
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
+ })
127
154
  }
128
155
  ) });
129
156
  }
130
157
  );
131
- U.displayName = A;
132
- var M = "TooltipPortal", [ce, ue] = D(M, {
133
- forceMount: void 0
134
- }), V = (t) => {
135
- const { __scopeTooltip: o, forceMount: e, children: r, container: n } = t, a = _(M, o);
136
- return /* @__PURE__ */ f(ce, { scope: o, forceMount: e, children: /* @__PURE__ */ f(G, { present: e || a.open, children: /* @__PURE__ */ f(ee, { asChild: !0, container: n, children: r }) }) });
137
- };
138
- V.displayName = M;
139
- var b = "TooltipContent", Y = s.forwardRef(
140
- (t, o) => {
141
- const e = ue(b, t.__scopeTooltip), { forceMount: r = e.forceMount, side: n = "top", ...a } = t, l = _(b, t.__scopeTooltip);
142
- return /* @__PURE__ */ f(G, { present: r || l.open, children: l.disableHoverableContent ? /* @__PURE__ */ f(q, { side: n, ...a, ref: o }) : /* @__PURE__ */ f(pe, { side: n, ...a, ref: o }) });
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
+ );
143
173
  }
144
- ), pe = s.forwardRef((t, o) => {
145
- const e = _(b, t.__scopeTooltip), r = k(b, t.__scopeTooltip), n = s.useRef(null), a = N(o, n), [l, v] = s.useState(null), { trigger: i, onClose: p } = e, c = n.current, { onPointerInTransitChange: d } = r, h = s.useCallback(() => {
146
- v(null), d(!1);
147
- }, [d]), u = s.useCallback(
148
- (m, y) => {
149
- const T = m.currentTarget, x = { x: m.clientX, y: m.clientY }, C = me(x, T.getBoundingClientRect()), w = Te(x, C), P = ye(y.getBoundingClientRect()), E = xe([...w, ...P]);
150
- v(E), d(!0);
151
- },
152
- [d]
153
- );
154
- return s.useEffect(() => () => h(), [h]), s.useEffect(() => {
155
- if (i && c) {
156
- const m = (T) => u(T, c), y = (T) => u(T, i);
157
- return i.addEventListener("pointerleave", m), c.addEventListener("pointerleave", y), () => {
158
- i.removeEventListener("pointerleave", m), c.removeEventListener("pointerleave", y);
159
- };
160
- }
161
- }, [i, c, u, h]), s.useEffect(() => {
162
- if (l) {
163
- const m = (y) => {
164
- const T = y.target, x = { x: y.clientX, y: y.clientY }, C = (i == null ? void 0 : i.contains(T)) || (c == null ? void 0 : c.contains(T)), w = !Ce(x, l);
165
- C ? h() : w && (h(), p());
166
- };
167
- return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
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;
168
196
  }
169
- }, [i, c, l, p, h]), /* @__PURE__ */ f(q, { ...t, ref: a });
170
- }), [de, fe] = D(R, { isInside: !1 }), ve = oe("TooltipContent"), q = s.forwardRef(
171
- (t, o) => {
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) => {
172
203
  const {
173
- __scopeTooltip: e,
174
- children: r,
175
- "aria-label": n,
176
- onEscapeKeyDown: a,
177
- onPointerDownOutside: l,
178
- ...v
179
- } = t, i = _(b, e), p = O(e), { onClose: c } = i;
180
- return s.useEffect(() => (document.addEventListener(L, c), () => document.removeEventListener(L, c)), [c]), s.useEffect(() => {
181
- if (i.trigger) {
182
- const d = (h) => {
183
- const u = h.target;
184
- u != null && u.contains(i.trigger) && c();
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 });
185
258
  };
186
- return window.addEventListener("scroll", d, { capture: !0 }), () => window.removeEventListener("scroll", d, { capture: !0 });
187
259
  }
188
- }, [i.trigger, c]), /* @__PURE__ */ f(
189
- W,
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,
190
295
  {
191
- asChild: !0,
192
- disableOutsidePointerEvents: !1,
193
- onEscapeKeyDown: a,
194
- onPointerDownOutside: l,
195
- onFocusOutside: (d) => d.preventDefault(),
196
- onDismiss: c,
197
- children: /* @__PURE__ */ se(
198
- Q,
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,
199
311
  {
200
- "data-state": i.stateAttribute,
201
- ...p,
202
- ...v,
203
- ref: o,
204
- style: {
205
- ...v.style,
206
- "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
207
- "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
208
- "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
209
- "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
210
- "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
312
+ asChild: !0,
313
+ trapped: d.open,
314
+ onMountAutoFocus: (f) => {
315
+ f.preventDefault();
211
316
  },
212
- children: [
213
- /* @__PURE__ */ f(ve, { children: r }),
214
- /* @__PURE__ */ f(de, { scope: e, isInside: !0, children: /* @__PURE__ */ f(ne, { id: i.contentId, role: "tooltip", children: n || r }) })
215
- ]
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
+ )
216
365
  }
217
- )
366
+ ) })
218
367
  }
219
368
  );
220
369
  }
221
370
  );
222
- Y.displayName = b;
223
- var X = "TooltipArrow", he = s.forwardRef(
224
- (t, o) => {
225
- const { __scopeTooltip: e, ...r } = t, n = O(e);
226
- return fe(
227
- X,
228
- e
229
- ).isInside ? null : /* @__PURE__ */ f(Z, { ...n, ...r, ref: o });
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
+ ] });
230
556
  }
231
557
  );
232
- he.displayName = X;
233
- function me(t, o) {
234
- const e = Math.abs(o.top - t.y), r = Math.abs(o.bottom - t.y), n = Math.abs(o.right - t.x), a = Math.abs(o.left - t.x);
235
- switch (Math.min(e, r, n, a)) {
236
- case a:
237
- return "left";
238
- case n:
239
- return "right";
240
- case e:
241
- return "top";
242
- case r:
243
- return "bottom";
244
- default:
245
- throw new Error("unreachable");
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 }) });
246
563
  }
247
- }
248
- function Te(t, o, e = 5) {
249
- const r = [];
250
- switch (o) {
251
- case "top":
252
- r.push(
253
- { x: t.x - e, y: t.y + e },
254
- { x: t.x + e, y: t.y + e }
255
- );
256
- break;
257
- case "bottom":
258
- r.push(
259
- { x: t.x - e, y: t.y - e },
260
- { x: t.x + e, y: t.y - e }
261
- );
262
- break;
263
- case "left":
264
- r.push(
265
- { x: t.x + e, y: t.y - e },
266
- { x: t.x + e, y: t.y + e }
267
- );
268
- break;
269
- case "right":
270
- r.push(
271
- { x: t.x - e, y: t.y - e },
272
- { x: t.x - e, y: t.y + e }
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."
273
593
  );
274
- break;
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
+ );
275
654
  }
276
- return r;
277
- }
278
- function ye(t) {
279
- const { top: o, right: e, bottom: r, left: n } = t;
280
- return [
281
- { x: n, y: o },
282
- { x: e, y: o },
283
- { x: e, y: r },
284
- { x: n, y: r }
285
- ];
286
- }
287
- function Ce(t, o) {
288
- const { x: e, y: r } = t;
289
- let n = !1;
290
- for (let a = 0, l = o.length - 1; a < o.length; l = a++) {
291
- const v = o[a], i = o[l], p = v.x, c = v.y, d = i.x, h = i.y;
292
- c > r != h > r && e < (d - p) * (r - c) / (h - c) + p && (n = !n);
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
+ ] });
293
675
  }
294
- return n;
295
- }
296
- function xe(t) {
297
- const o = t.slice();
298
- return o.sort((e, r) => e.x < r.x ? -1 : e.x > r.x ? 1 : e.y < r.y ? -1 : e.y > r.y ? 1 : 0), ge(o);
299
- }
300
- function ge(t) {
301
- if (t.length <= 1) return t.slice();
302
- const o = [];
303
- for (let r = 0; r < t.length; r++) {
304
- const n = t[r];
305
- for (; o.length >= 2; ) {
306
- const a = o[o.length - 1], l = o[o.length - 2];
307
- if ((a.x - l.x) * (n.y - l.y) >= (a.y - l.y) * (n.x - l.x)) o.pop();
308
- else break;
309
- }
310
- o.push(n);
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;
311
682
  }
312
- o.pop();
313
- const e = [];
314
- for (let r = t.length - 1; r >= 0; r--) {
315
- const n = t[r];
316
- for (; e.length >= 2; ) {
317
- const a = e[e.length - 1], l = e[e.length - 2];
318
- if ((a.x - l.x) * (n.y - l.y) >= (a.y - l.y) * (n.x - l.x)) e.pop();
319
- else break;
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
+ })
320
758
  }
321
- e.push(n);
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;
322
771
  }
323
- return e.pop(), o.length === 1 && e.length === 1 && o[0].x === e[0].x && o[0].y === e[0].y ? o : o.concat(e);
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]);
324
828
  }
325
- var He = F, Ne = B, Se = U, Ge = V, je = Y;
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;
326
830
  export {
327
- je as Content,
328
- Ge as Portal,
329
- He as Provider,
330
- Ne as Root,
331
- B as Tooltip,
332
- he as TooltipArrow,
333
- Y as TooltipContent,
334
- V as TooltipPortal,
335
- F as TooltipProvider,
336
- U as TooltipTrigger,
337
- Se as Trigger
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
338
862
  };