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