@strapi/ui-primitives 0.0.0-3cf3ff39 → 0.0.0-622b91ef

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,89 +1,89 @@
1
- import { jsx as f, jsxs as Ne, Fragment as Ae } from "react/jsx-runtime";
1
+ import { jsx as f, jsxs as Ae, Fragment as _e } from "react/jsx-runtime";
2
2
  import * as l from "react";
3
- import { useComposedRefs as O } from "@radix-ui/react-compose-refs";
4
- import { createContextScope as Je, createContext as Qe } from "@radix-ui/react-context";
5
- import { Slot as ye } from "@radix-ui/react-slot";
3
+ import { useComposedRefs as M } from "@radix-ui/react-compose-refs";
4
+ import { createContextScope as ot, createContext as nt } from "@radix-ui/react-context";
5
+ import { Slot as Te } from "@radix-ui/react-slot";
6
6
  import { composeEventHandlers as T } from "@radix-ui/primitive";
7
- import { composeEventHandlers as Rn } from "@radix-ui/primitive";
8
- import { DismissableLayer as et } from "@radix-ui/react-dismissable-layer";
9
- import { useFocusGuards as tt } from "@radix-ui/react-focus-guards";
10
- import { FocusScope as ot } from "@radix-ui/react-focus-scope";
11
- import { useId as ne } from "@radix-ui/react-id";
7
+ import { composeEventHandlers as An } from "@radix-ui/primitive";
8
+ import { DismissableLayer as rt } from "@radix-ui/react-dismissable-layer";
9
+ import { useFocusGuards as lt } from "@radix-ui/react-focus-guards";
10
+ import { FocusScope as st } from "@radix-ui/react-focus-scope";
11
+ import { useId as re } from "@radix-ui/react-id";
12
12
  import * as le from "@radix-ui/react-popper";
13
- import { createPopperScope as nt } from "@radix-ui/react-popper";
14
- import { Portal as rt } from "@radix-ui/react-portal";
15
- import { Primitive as _ } from "@radix-ui/react-primitive";
13
+ import { createPopperScope as ct } from "@radix-ui/react-popper";
14
+ import { Portal as it } from "@radix-ui/react-portal";
15
+ import { Primitive as N } from "@radix-ui/react-primitive";
16
16
  import { useControllableState as ie } from "@radix-ui/react-use-controllable-state";
17
- import { useLayoutEffect as B } from "@radix-ui/react-use-layout-effect";
18
- import { hideOthers as lt } from "aria-hidden";
19
- import * as _e from "react-dom";
20
- import { RemoveScroll as st } from "react-remove-scroll";
21
- import { clamp as Ze } from "@radix-ui/number";
22
- import { createCollection as Et } from "@radix-ui/react-collection";
23
- import { useDirection as Rt } from "@radix-ui/react-direction";
24
- import { usePrevious as Nt } from "@radix-ui/react-use-previous";
25
- import { VisuallyHidden as At } from "@radix-ui/react-visually-hidden";
26
- import { useCallbackRef as _t } from "@strapi/ui-primitives";
27
- import { useCallbackRef as An } from "@radix-ui/react-use-callback-ref";
28
- function Mt(r) {
29
- const s = `${r}CollectionProvider`, [e, t] = Je(s), [o, n] = e(s, {
17
+ import { useLayoutEffect as L } from "@radix-ui/react-use-layout-effect";
18
+ import { hideOthers as at } from "aria-hidden";
19
+ import * as Ce from "react-dom";
20
+ import { RemoveScroll as ut } from "react-remove-scroll";
21
+ import { clamp as Qe } from "@radix-ui/number";
22
+ import { createCollection as Nt } from "@radix-ui/react-collection";
23
+ import { useDirection as At } from "@radix-ui/react-direction";
24
+ import { usePrevious as _t } from "@radix-ui/react-use-previous";
25
+ import { VisuallyHidden as Mt } from "@radix-ui/react-visually-hidden";
26
+ import { useCallbackRef as Ot } from "@radix-ui/react-use-callback-ref";
27
+ import { useCallbackRef as Mn } from "@radix-ui/react-use-callback-ref";
28
+ function Dt(r) {
29
+ const c = `${r}CollectionProvider`, [e, t] = ot(c), [o, n] = e(c, {
30
30
  collectionRef: { current: null },
31
31
  itemMap: /* @__PURE__ */ new Map(),
32
32
  listeners: /* @__PURE__ */ new Set()
33
- }), i = (u) => {
34
- const { scope: m, children: b } = u, C = l.useRef(null), v = l.useRef(/* @__PURE__ */ new Map()).current, h = l.useRef(/* @__PURE__ */ new Set()).current;
35
- return /* @__PURE__ */ f(o, { scope: m, itemMap: v, collectionRef: C, listeners: h, children: b });
33
+ }), i = (d) => {
34
+ const { scope: h, children: v } = d, C = l.useRef(null), b = l.useRef(/* @__PURE__ */ new Map()).current, g = l.useRef(/* @__PURE__ */ new Set()).current;
35
+ return /* @__PURE__ */ f(o, { scope: h, itemMap: b, collectionRef: C, listeners: g, children: v });
36
36
  };
37
- i.displayName = s;
38
- const c = `${r}CollectionSlot`, a = l.forwardRef((u, m) => {
39
- const { scope: b, children: C } = u, v = n(c, b), h = O(m, v.collectionRef);
40
- return /* @__PURE__ */ f(ye, { ref: h, children: C });
37
+ i.displayName = c;
38
+ const s = `${r}CollectionSlot`, a = l.forwardRef((d, h) => {
39
+ const { scope: v, children: C } = d, b = n(s, v), g = M(h, b.collectionRef);
40
+ return /* @__PURE__ */ f(Te, { ref: g, children: C });
41
41
  });
42
- a.displayName = c;
43
- const g = `${r}CollectionItemSlot`, p = "data-radix-collection-item", x = l.forwardRef((u, m) => {
44
- const { scope: b, children: C, ...v } = u, h = l.useRef(null), w = O(m, h), R = n(g, b);
42
+ a.displayName = s;
43
+ const m = `${r}CollectionItemSlot`, u = "data-radix-collection-item", x = l.forwardRef((d, h) => {
44
+ const { scope: v, children: C, ...b } = d, g = l.useRef(null), I = M(h, g), E = n(m, v);
45
45
  return l.useEffect(() => {
46
- const M = Array.from(R.itemMap.values());
47
- return R.itemMap.set(h, { ref: h, ...v }), R.listeners.forEach((E) => E(Array.from(R.itemMap.values()), M)), () => {
48
- const E = Array.from(R.itemMap.values());
49
- R.itemMap.delete(h), R.listeners.forEach((N) => N(Array.from(R.itemMap.values()), E));
46
+ const O = Array.from(E.itemMap.values());
47
+ return E.itemMap.set(g, { ref: g, ...b }), E.listeners.forEach((A) => A(Array.from(E.itemMap.values()), O)), () => {
48
+ const A = Array.from(E.itemMap.values());
49
+ E.itemMap.delete(g), E.listeners.forEach((_) => _(Array.from(E.itemMap.values()), A));
50
50
  };
51
- }), /* @__PURE__ */ f(ye, { [p]: "", ref: w, children: C });
51
+ }), /* @__PURE__ */ f(Te, { [u]: "", ref: I, children: C });
52
52
  });
53
- x.displayName = g;
54
- function d(u) {
55
- const m = n(`${r}CollectionConsumer`, u), b = l.useCallback(() => {
56
- const v = m.collectionRef.current;
57
- if (!v)
53
+ x.displayName = m;
54
+ function p(d) {
55
+ const h = n(`${r}CollectionConsumer`, d), v = l.useCallback(() => {
56
+ const b = h.collectionRef.current;
57
+ if (!b)
58
58
  return [];
59
- const h = Array.from(v.querySelectorAll(`[${p}]`));
60
- return Array.from(m.itemMap.values()).sort(
61
- (M, E) => h.indexOf(M.ref.current) - h.indexOf(E.ref.current)
59
+ const g = Array.from(b.querySelectorAll(`[${u}]`));
60
+ return Array.from(h.itemMap.values()).sort(
61
+ (O, A) => g.indexOf(O.ref.current) - g.indexOf(A.ref.current)
62
62
  );
63
- }, [m.collectionRef, m.itemMap]), C = l.useCallback(
64
- (v) => (m.listeners.add(v), () => m.listeners.delete(v)),
65
- [m.listeners]
63
+ }, [h.collectionRef, h.itemMap]), C = l.useCallback(
64
+ (b) => (h.listeners.add(b), () => h.listeners.delete(b)),
65
+ [h.listeners]
66
66
  );
67
- return { getItems: b, subscribe: C };
67
+ return { getItems: v, subscribe: C };
68
68
  }
69
69
  return [
70
70
  { Provider: i, Slot: a, ItemSlot: x },
71
- d,
71
+ p,
72
72
  t
73
73
  ];
74
74
  }
75
- let Ie = /* @__PURE__ */ new Map();
76
- function Ot(r, s) {
77
- let e = r + (s ? Object.entries(s).sort((o, n) => o[0] < n[0] ? -1 : 1).join() : "");
78
- if (Ie.has(e))
79
- return Ie.get(e);
80
- let t = new Intl.Collator(r, s);
81
- return Ie.set(e, t), t;
75
+ let ye = /* @__PURE__ */ new Map();
76
+ function kt(r, c) {
77
+ let e = r + (c ? Object.entries(c).sort((o, n) => o[0] < n[0] ? -1 : 1).join() : "");
78
+ if (ye.has(e))
79
+ return ye.get(e);
80
+ let t = new Intl.Collator(r, c);
81
+ return ye.set(e, t), t;
82
82
  }
83
- function Me(r, s) {
84
- let e = Ot(r, {
83
+ function Me(r, c) {
84
+ let e = kt(r, {
85
85
  usage: "search",
86
- ...s
86
+ ...c
87
87
  });
88
88
  return {
89
89
  startsWith(t, o) {
@@ -98,111 +98,111 @@ function Me(r, s) {
98
98
  t = t.normalize("NFC"), o = o.normalize("NFC");
99
99
  let n = 0, i = o.length;
100
100
  for (; n + i <= t.length; n++) {
101
- let c = t.slice(n, n + i);
102
- if (e.compare(o, c) === 0)
101
+ let s = t.slice(n, n + i);
102
+ if (e.compare(o, s) === 0)
103
103
  return !0;
104
104
  }
105
105
  return !1;
106
106
  }
107
107
  };
108
108
  }
109
- const Dt = (r) => {
110
- const s = l.useRef();
109
+ const Ft = (r) => {
110
+ const c = l.useRef();
111
111
  return l.useEffect(() => {
112
- s.current = r;
113
- }), s.current;
114
- }, kt = [" ", "Enter", "ArrowUp", "ArrowDown"], Ft = ["Enter"], Lt = (r) => !!(r.length === 1 && r.match(/\S| /)), ct = "Combobox", [pe, Ce] = Mt(ct), [Bt, j] = Qe(ct), Ht = ({ children: r }) => /* @__PURE__ */ f(le.Root, { children: /* @__PURE__ */ f(pe.Provider, { scope: void 0, children: r }) }), $t = (r) => {
112
+ c.current = r;
113
+ }), c.current;
114
+ }, Lt = [" ", "Enter", "ArrowUp", "ArrowDown"], Bt = ["Enter"], Ht = (r) => !!(r.length === 1 && r.match(/\S| /)), dt = "Combobox", [ae, me] = Dt(dt), [$t, K] = nt(dt), Ut = ({ children: r }) => /* @__PURE__ */ f(le.Root, { children: /* @__PURE__ */ f(ae.Provider, { scope: void 0, children: r }) }), Kt = (r) => {
115
115
  const {
116
- allowCustomValue: s = !1,
116
+ allowCustomValue: c = !1,
117
117
  autocomplete: e = "none",
118
118
  children: t,
119
119
  open: o,
120
120
  defaultOpen: n,
121
121
  onOpenChange: i,
122
- value: c,
122
+ value: s,
123
123
  defaultValue: a,
124
- onValueChange: g,
125
- disabled: p,
124
+ onValueChange: m,
125
+ disabled: u,
126
126
  required: x = !1,
127
- locale: d = "en-EN",
128
- onTextValueChange: u,
129
- textValue: m,
130
- defaultTextValue: b,
127
+ locale: p = "en-EN",
128
+ onTextValueChange: d,
129
+ textValue: h,
130
+ defaultTextValue: v,
131
131
  filterValue: C,
132
- defaultFilterValue: v,
133
- onFilterValueChange: h,
134
- isPrintableCharacter: w = Lt
135
- } = r, [R, M] = l.useState(null), [E, N] = l.useState(null), [k, q] = l.useState(null), [K, L] = l.useState(null), [D = !1, H] = ie({
132
+ defaultFilterValue: b,
133
+ onFilterValueChange: g,
134
+ isPrintableCharacter: I = Ht
135
+ } = r, [E, O] = l.useState(null), [A, _] = l.useState(null), [k, q] = l.useState(null), [W, B] = l.useState(null), [D = !1, H] = ie({
136
136
  prop: o,
137
137
  defaultProp: n,
138
138
  onChange: i
139
- }), [F, W] = ie({
140
- prop: c,
139
+ }), [F, z] = ie({
140
+ prop: s,
141
141
  defaultProp: a,
142
- onChange: g
143
- }), [z, $] = ie({
144
- prop: m,
145
- defaultProp: s && !b ? c : b,
146
- onChange: u
142
+ onChange: m
143
+ }), [G, $] = ie({
144
+ prop: h,
145
+ defaultProp: c && !v ? s : v,
146
+ onChange: d
147
147
  }), [X, U] = ie({
148
148
  prop: C,
149
- defaultProp: v,
150
- onChange: h
151
- }), ue = ne(), se = l.useCallback(
152
- (de, Q) => {
153
- const Z = Q.map((y) => y.ref.current), [ce, ...ee] = Z, [S] = ee.slice(-1), V = K ?? Q.find((y) => y.value === F)?.ref.current;
154
- for (const y of de) {
149
+ defaultProp: b,
150
+ onChange: g
151
+ }), de = re(), se = l.useCallback(
152
+ (fe, Q) => {
153
+ const Z = Q.map((y) => y.ref.current), [ce, ...ee] = Z, [S] = ee.slice(-1), V = W ?? Q.find((y) => y.value === F)?.ref.current;
154
+ for (const y of fe) {
155
155
  if (y === V)
156
156
  return;
157
- if (y?.scrollIntoView({ block: "nearest" }), y === ce && E && (E.scrollTop = 0), y === S && E && (E.scrollTop = E.scrollHeight), L(y), e === "both") {
158
- const I = Q.find((P) => P.ref.current === y);
159
- I && $(I.textValue);
157
+ if (y?.scrollIntoView({ block: "nearest" }), y === ce && A && (A.scrollTop = 0), y === S && A && (A.scrollTop = A.scrollHeight), B(y), e === "both") {
158
+ const w = Q.find((P) => P.ref.current === y);
159
+ w && $(w.textValue);
160
160
  }
161
161
  if (y !== V)
162
162
  return;
163
163
  }
164
164
  },
165
- [e, $, E, K, F]
165
+ [e, $, A, W, F]
166
166
  );
167
167
  return l.useEffect(() => {
168
- e !== "both" && L(null);
169
- }, [z, e]), l.useEffect(() => {
170
- if (k && R)
171
- return lt([k, R]);
172
- }, [k, R]), /* @__PURE__ */ f(Ht, { children: /* @__PURE__ */ f(
173
- Bt,
168
+ e !== "both" && B(null);
169
+ }, [G, e]), l.useEffect(() => {
170
+ if (k && E)
171
+ return at([k, E]);
172
+ }, [k, E]), /* @__PURE__ */ f(Ut, { children: /* @__PURE__ */ f(
173
+ $t,
174
174
  {
175
- allowCustomValue: s,
175
+ allowCustomValue: c,
176
176
  autocomplete: e,
177
177
  required: x,
178
- trigger: R,
179
- onTriggerChange: M,
180
- contentId: ue,
178
+ trigger: E,
179
+ onTriggerChange: O,
180
+ contentId: de,
181
181
  value: F,
182
- onValueChange: W,
182
+ onValueChange: z,
183
183
  open: D,
184
184
  onOpenChange: H,
185
- disabled: p,
186
- locale: d,
185
+ disabled: u,
186
+ locale: p,
187
187
  focusFirst: se,
188
- textValue: z,
188
+ textValue: G,
189
189
  onTextValueChange: $,
190
- onViewportChange: N,
190
+ onViewportChange: _,
191
191
  onContentChange: q,
192
- visuallyFocussedItem: K,
192
+ visuallyFocussedItem: W,
193
193
  filterValue: X,
194
194
  onFilterValueChange: U,
195
- onVisuallyFocussedItemChange: L,
196
- isPrintableCharacter: w,
195
+ onVisuallyFocussedItemChange: B,
196
+ isPrintableCharacter: I,
197
197
  children: t
198
198
  }
199
199
  ) });
200
- }, Ut = "ComboboxTrigger", Kt = l.forwardRef((r, s) => {
201
- const { ...e } = r, t = j(Ut), o = () => {
200
+ }, Wt = "ComboboxTrigger", zt = l.forwardRef((r, c) => {
201
+ const { ...e } = r, t = K(Wt), o = () => {
202
202
  t.disabled || t.onOpenChange(!0);
203
203
  };
204
204
  return /* @__PURE__ */ f(le.Anchor, { asChild: !0, children: /* @__PURE__ */ f(
205
- ot,
205
+ st,
206
206
  {
207
207
  asChild: !0,
208
208
  trapped: t.open,
@@ -215,7 +215,7 @@ const Dt = (r) => {
215
215
  children: /* @__PURE__ */ f(
216
216
  "div",
217
217
  {
218
- ref: s,
218
+ ref: c,
219
219
  "data-disabled": t.disabled ? "" : void 0,
220
220
  ...e,
221
221
  onClick: T(e.onClick, () => {
@@ -229,21 +229,21 @@ const Dt = (r) => {
229
229
  )
230
230
  }
231
231
  ) });
232
- }), it = "ComboboxInput", Wt = l.forwardRef((r, s) => {
233
- const e = j(it), t = l.useRef(null), { getItems: o } = Ce(void 0), { startsWith: n } = Me(e.locale, { sensitivity: "base" }), i = e.disabled, c = O(t, s, e.onTriggerChange), a = () => {
232
+ }), ft = "ComboboxInput", Gt = l.forwardRef((r, c) => {
233
+ const e = K(ft), t = l.useRef(null), { getItems: o } = me(void 0), { startsWith: n } = Me(e.locale, { sensitivity: "base" }), i = e.disabled, s = M(t, c, e.onTriggerChange), a = () => {
234
234
  i || e.onOpenChange(!0);
235
- }, g = Dt(e.filterValue);
236
- return B(() => {
237
- const p = setTimeout(() => {
235
+ }, m = Ft(e.filterValue);
236
+ return L(() => {
237
+ const u = setTimeout(() => {
238
238
  if (e.textValue === "" || e.textValue === void 0 || e.filterValue === "" || e.filterValue === void 0)
239
239
  return;
240
240
  const x = o().find(
241
- (u) => u.type === "option" && n(u.textValue, e.textValue)
242
- ), d = vo(g ?? "", e.filterValue);
243
- x && !e.visuallyFocussedItem && d === e.filterValue.length && t.current?.setSelectionRange(e.filterValue.length, e.textValue.length);
241
+ (d) => d.type === "option" && n(d.textValue, e.textValue)
242
+ ), p = So(m ?? "", e.filterValue);
243
+ x && !e.visuallyFocussedItem && p === e.filterValue.length && t.current?.setSelectionRange(e.filterValue.length, e.textValue.length);
244
244
  });
245
- return () => clearTimeout(p);
246
- }, [e.textValue, e.filterValue, n, e.visuallyFocussedItem, o, g]), /* @__PURE__ */ f(
245
+ return () => clearTimeout(u);
246
+ }, [e.textValue, e.filterValue, n, e.visuallyFocussedItem, o, m]), /* @__PURE__ */ f(
247
247
  "input",
248
248
  {
249
249
  type: "text",
@@ -260,80 +260,82 @@ const Dt = (r) => {
260
260
  "data-placeholder": e.textValue === void 0 ? "" : void 0,
261
261
  value: e.textValue ?? "",
262
262
  ...r,
263
- ref: c,
264
- onKeyDown: T(r.onKeyDown, (p) => {
265
- if (["ArrowUp", "ArrowDown", "Home", "End"].includes(p.key))
266
- setTimeout(() => {
267
- let d = o().filter((u) => !u.disabled).map((u) => u.ref.current);
268
- if (["ArrowUp", "End"].includes(p.key) && (d = d.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(p.key)) {
269
- const u = e.visuallyFocussedItem ?? o().find((m) => m.value === e.value)?.ref.current;
270
- if (u) {
271
- let m = d.indexOf(u);
272
- m === d.length - 1 && (m = -1), d = d.slice(m + 1);
263
+ ref: s,
264
+ onKeyDown: T(r.onKeyDown, (u) => {
265
+ if (["ArrowUp", "ArrowDown", "Home", "End"].includes(u.key))
266
+ e.open || a(), setTimeout(() => {
267
+ let p = o().filter((d) => !d.disabled && d.isVisible).map((d) => d.ref.current);
268
+ if (["ArrowUp", "End"].includes(u.key) && (p = p.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(u.key)) {
269
+ const d = e.visuallyFocussedItem ?? o().find((h) => h.value === e.value)?.ref.current;
270
+ if (d) {
271
+ let h = p.indexOf(d);
272
+ h === p.length - 1 && (h = -1), p = p.slice(h + 1);
273
273
  }
274
274
  }
275
- if (["ArrowDown"].includes(p.key) && e.autocomplete === "both" && d.length > 1) {
276
- const [u, ...m] = d, b = o().find((C) => C.ref.current === u).textValue;
277
- e.textValue === b && (d = m);
275
+ if (["ArrowDown"].includes(u.key) && e.autocomplete === "both" && p.length > 1) {
276
+ const [d, ...h] = p, v = o().find((C) => C.ref.current === d).textValue;
277
+ e.textValue === v && (p = h);
278
278
  }
279
- e.focusFirst(d, o());
280
- }), p.preventDefault();
281
- else if (["Tab"].includes(p.key) && e.open)
282
- p.preventDefault();
283
- else if (["Escape"].includes(p.key))
284
- e.open ? e.onOpenChange(!1) : (e.onValueChange(void 0), e.onTextValueChange("")), p.preventDefault();
285
- else if (Ft.includes(p.key)) {
279
+ e.focusFirst(p, o());
280
+ }), u.preventDefault();
281
+ else if (["Tab"].includes(u.key) && e.open)
282
+ u.preventDefault();
283
+ else if (["Escape"].includes(u.key))
284
+ e.open ? e.onOpenChange(!1) : (e.onValueChange(void 0), e.onTextValueChange("")), u.preventDefault();
285
+ else if (Bt.includes(u.key)) {
286
286
  if (e.visuallyFocussedItem) {
287
- const x = o().find((d) => d.ref.current === e.visuallyFocussedItem);
287
+ const x = o().find((p) => p.ref.current === e.visuallyFocussedItem);
288
288
  x && (e.onValueChange(x.value), e.onTextValueChange(x.textValue), e.autocomplete === "both" && e.onFilterValueChange(x.textValue), x.ref.current?.click());
289
289
  } else {
290
290
  const x = o().find(
291
- (d) => d.type === "option" && !d.disabled && d.textValue === e.textValue
291
+ (p) => p.type === "option" && !p.disabled && p.textValue === e.textValue
292
292
  );
293
293
  x && (e.onValueChange(x.value), e.onTextValueChange(x.textValue), e.autocomplete === "both" && e.onFilterValueChange(x.textValue), x.ref.current?.click());
294
294
  }
295
- e.onOpenChange(!1), p.preventDefault();
295
+ e.onOpenChange(!1), u.preventDefault();
296
296
  } else
297
297
  e.onVisuallyFocussedItemChange(null);
298
298
  }),
299
- onChange: T(r.onChange, (p) => {
300
- e.onTextValueChange(p.currentTarget.value), e.autocomplete === "both" && e.onFilterValueChange(p.currentTarget.value);
299
+ onChange: T(r.onChange, (u) => {
300
+ e.onTextValueChange(u.currentTarget.value), e.autocomplete === "both" && e.onFilterValueChange(u.currentTarget.value);
301
301
  }),
302
- onKeyUp: T(r.onKeyUp, (p) => {
303
- if (!e.open && (e.isPrintableCharacter(p.key) || ["ArrowUp", "ArrowDown", "Home", "End", "Backspace"].includes(p.key)) && a(), setTimeout(() => {
304
- if (e.autocomplete === "both" && e.isPrintableCharacter(p.key) && e.filterValue !== void 0) {
305
- const x = e.filterValue, d = o().find((u) => n(u.textValue, x));
306
- d && e.onTextValueChange(d.textValue);
302
+ onKeyUp: T(r.onKeyUp, (u) => {
303
+ if (!e.open && (e.isPrintableCharacter(u.key) || ["Backspace"].includes(u.key)) && a(), setTimeout(() => {
304
+ if (e.autocomplete === "both" && e.isPrintableCharacter(u.key) && e.filterValue !== void 0) {
305
+ const x = e.filterValue, p = o().find((d) => n(d.textValue, x));
306
+ p && e.onTextValueChange(p.textValue);
307
307
  }
308
- }), e.autocomplete === "none" && e.isPrintableCharacter(p.key)) {
309
- const x = e.textValue ?? "", d = o().find((u) => n(u.textValue, x));
310
- d && (e.onVisuallyFocussedItemChange(d.ref.current), d.ref.current?.scrollIntoView());
308
+ }), e.autocomplete === "none" && e.isPrintableCharacter(u.key)) {
309
+ const x = e.textValue ?? "", p = o().find((d) => n(d.textValue, x));
310
+ p && (e.onVisuallyFocussedItemChange(p.ref.current), p.ref.current?.scrollIntoView());
311
311
  }
312
312
  }),
313
313
  onBlur: T(r.onBlur, () => {
314
+ if (e.open)
315
+ return;
314
316
  e.onVisuallyFocussedItemChange(null);
315
- const [p] = o().filter(
316
- (d) => d.textValue === e.textValue && d.type === "option"
317
+ const [u] = o().filter(
318
+ (p) => p.textValue === e.textValue && p.type === "option"
317
319
  );
318
- if (p) {
319
- e.onValueChange(p.value), e.autocomplete === "both" && e.onFilterValueChange(p.textValue);
320
+ if (u) {
321
+ e.onValueChange(u.value), e.autocomplete === "both" && e.onFilterValueChange(u.textValue);
320
322
  return;
321
323
  }
322
324
  if (e.allowCustomValue) {
323
325
  e.onValueChange(e.textValue), e.autocomplete === "both" && e.onFilterValueChange(e.textValue);
324
326
  return;
325
327
  }
326
- const [x] = o().filter((d) => d.value === e.value && d.type === "option");
328
+ const [x] = o().filter((p) => p.value === e.value && p.type === "option");
327
329
  x && e.textValue !== "" ? (e.onTextValueChange(x.textValue), e.autocomplete === "both" && e.onFilterValueChange(x.textValue)) : (e.onValueChange(void 0), e.onTextValueChange(""));
328
330
  })
329
331
  }
330
332
  );
331
- }), zt = l.forwardRef((r, s) => {
332
- const { children: e, ...t } = r, o = j(it), n = o.disabled, i = () => {
333
+ }), jt = l.forwardRef((r, c) => {
334
+ const { children: e, ...t } = r, o = K(ft), n = o.disabled, i = () => {
333
335
  n || (o.onOpenChange(!0), o.trigger?.focus());
334
336
  };
335
337
  return /* @__PURE__ */ f(
336
- _.button,
338
+ N.button,
337
339
  {
338
340
  "aria-hidden": !0,
339
341
  type: "button",
@@ -344,45 +346,49 @@ const Dt = (r) => {
344
346
  "data-disabled": n ? "" : void 0,
345
347
  ...t,
346
348
  tabIndex: -1,
347
- ref: s,
349
+ ref: c,
348
350
  onClick: T(t.onClick, () => {
349
351
  o.trigger?.focus();
350
352
  }),
351
- onPointerDown: T(t.onPointerDown, (c) => {
352
- c.button === 0 && c.ctrlKey === !1 && (i(), c.preventDefault());
353
+ onPointerDown: T(t.onPointerDown, (s) => {
354
+ s.button === 0 && s.ctrlKey === !1 && (i(), s.preventDefault());
353
355
  }),
354
- onKeyDown: T(t.onKeyDown, (c) => {
355
- kt.includes(c.key) && (i(), c.preventDefault());
356
+ onKeyDown: T(t.onKeyDown, (s) => {
357
+ Lt.includes(s.key) && (i(), s.preventDefault());
356
358
  }),
357
359
  children: e || "▼"
358
360
  }
359
361
  );
360
- }), Gt = "ComboboxPortal", at = (r) => /* @__PURE__ */ f(rt, { asChild: !0, ...r });
361
- at.displayName = Gt;
362
- const ut = "ComboboxContent", jt = l.forwardRef((r, s) => {
363
- const e = j(ut), [t, o] = l.useState();
364
- if (B(() => {
365
- o(new DocumentFragment());
366
- }, []), !e.open) {
367
- const n = t;
368
- return n ? _e.createPortal(
369
- /* @__PURE__ */ f(pe.Slot, { scope: void 0, children: /* @__PURE__ */ f("div", { children: r.children }) }),
370
- n
362
+ }), Yt = "ComboboxPortal", pt = (r) => /* @__PURE__ */ f(it, { asChild: !0, ...r });
363
+ pt.displayName = Yt;
364
+ const mt = "ComboboxContent", qt = l.forwardRef((r, c) => {
365
+ const e = K(mt), { getItems: t } = me(void 0), [o, n] = l.useState();
366
+ if (L(() => {
367
+ n(new DocumentFragment());
368
+ }, []), L(() => {
369
+ e.open && e.autocomplete === "none" && setTimeout(() => {
370
+ t().find((s) => s.value === e.value)?.ref.current?.scrollIntoView({ block: "nearest" });
371
+ });
372
+ }, [t, e.autocomplete, e.value, e.open]), !e.open) {
373
+ const i = o;
374
+ return i ? Ce.createPortal(
375
+ /* @__PURE__ */ f(ae.Slot, { scope: void 0, children: /* @__PURE__ */ f("div", { children: r.children }) }),
376
+ i
371
377
  ) : null;
372
378
  }
373
- return /* @__PURE__ */ f(qt, { ...r, ref: s });
374
- }), Yt = 10, qt = l.forwardRef(
375
- (r, s) => {
376
- const { onEscapeKeyDown: e, onPointerDownOutside: t, ...o } = r, n = j(ut), i = O(s, (a) => n.onContentChange(a)), { onOpenChange: c } = n;
377
- return tt(), l.useEffect(() => {
379
+ return /* @__PURE__ */ f(Zt, { ...r, ref: c });
380
+ }), Xt = 10, Zt = l.forwardRef(
381
+ (r, c) => {
382
+ const { onEscapeKeyDown: e, onPointerDownOutside: t, ...o } = r, n = K(mt), i = M(c, (a) => n.onContentChange(a)), { onOpenChange: s } = n;
383
+ return lt(), l.useEffect(() => {
378
384
  const a = () => {
379
- c(!1);
385
+ s(!1);
380
386
  };
381
387
  return window.addEventListener("blur", a), window.addEventListener("resize", a), () => {
382
388
  window.removeEventListener("blur", a), window.removeEventListener("resize", a);
383
389
  };
384
- }, [c]), /* @__PURE__ */ f(st, { allowPinchZoom: !0, children: /* @__PURE__ */ f(
385
- et,
390
+ }, [s]), /* @__PURE__ */ f(ut, { allowPinchZoom: !0, children: /* @__PURE__ */ f(
391
+ rt,
386
392
  {
387
393
  asChild: !0,
388
394
  onEscapeKeyDown: e,
@@ -394,7 +400,7 @@ const ut = "ComboboxContent", jt = l.forwardRef((r, s) => {
394
400
  n.onOpenChange(!1), n.trigger?.focus({ preventScroll: !0 });
395
401
  },
396
402
  children: /* @__PURE__ */ f(
397
- Xt,
403
+ Jt,
398
404
  {
399
405
  role: "listbox",
400
406
  id: n.contentId,
@@ -415,14 +421,14 @@ const ut = "ComboboxContent", jt = l.forwardRef((r, s) => {
415
421
  }
416
422
  ) });
417
423
  }
418
- ), Xt = l.forwardRef(
419
- (r, s) => {
420
- const { align: e = "start", collisionPadding: t = Yt, ...o } = r;
424
+ ), Jt = l.forwardRef(
425
+ (r, c) => {
426
+ const { align: e = "start", collisionPadding: t = Xt, ...o } = r;
421
427
  return /* @__PURE__ */ f(
422
428
  le.Content,
423
429
  {
424
430
  ...o,
425
- ref: s,
431
+ ref: c,
426
432
  align: e,
427
433
  collisionPadding: t,
428
434
  style: {
@@ -438,9 +444,9 @@ const ut = "ComboboxContent", jt = l.forwardRef((r, s) => {
438
444
  }
439
445
  );
440
446
  }
441
- ), Zt = "ComboboxViewport", Jt = l.forwardRef((r, s) => {
442
- const e = j(Zt), t = O(s, e.onViewportChange);
443
- return /* @__PURE__ */ Ne(Ae, { children: [
447
+ ), Qt = "ComboboxViewport", eo = l.forwardRef((r, c) => {
448
+ const e = K(Qt), t = M(c, e.onViewportChange);
449
+ return /* @__PURE__ */ Ae(_e, { children: [
444
450
  /* @__PURE__ */ f(
445
451
  "style",
446
452
  {
@@ -449,8 +455,8 @@ const ut = "ComboboxContent", jt = l.forwardRef((r, s) => {
449
455
  }
450
456
  }
451
457
  ),
452
- /* @__PURE__ */ f(pe.Slot, { scope: void 0, children: /* @__PURE__ */ f(
453
- _.div,
458
+ /* @__PURE__ */ f(ae.Slot, { scope: void 0, children: /* @__PURE__ */ f(
459
+ N.div,
454
460
  {
455
461
  "data-radix-combobox-viewport": "",
456
462
  role: "presentation",
@@ -468,175 +474,215 @@ const ut = "ComboboxContent", jt = l.forwardRef((r, s) => {
468
474
  }
469
475
  ) })
470
476
  ] });
471
- }), dt = "ComboboxItem", [Qt, ft] = Qe(dt), pt = l.forwardRef((r, s) => {
472
- const { value: e, disabled: t = !1, textValue: o, ...n } = r, i = l.useRef(null), c = O(s, i), { getItems: a } = Ce(void 0), {
473
- onTextValueChange: g,
474
- textValue: p,
475
- visuallyFocussedItem: x,
476
- ...d
477
- } = j(dt), u = ne(), [m, b] = l.useState(o ?? ""), C = l.useMemo(() => x === a().find((E) => E.ref.current === i.current)?.ref.current, [a, x]), v = d.value === e, h = () => {
478
- t || (d.onValueChange(e), g(m), d.onOpenChange(!1), d.autocomplete === "both" && d.onFilterValueChange(m), d.trigger?.focus({ preventScroll: !0 }));
479
- }, { startsWith: w } = Me(d.locale, { sensitivity: "base" }), R = l.useCallback((E) => {
480
- b((N) => N || (E?.textContent ?? "").trim());
477
+ }), Oe = "ComboboxItem", [et, De] = nt(Oe), ht = l.forwardRef((r, c) => {
478
+ const { value: e, disabled: t = !1, textValue: o, ...n } = r, [i, s] = l.useState();
479
+ L(() => {
480
+ s(new DocumentFragment());
481
481
  }, []);
482
- l.useEffect(() => {
483
- v && p === void 0 && m !== "" && g(m);
484
- }, [m, v, p, g]), B(() => {
485
- d.open && d.autocomplete === "none" && setTimeout(() => {
486
- a().find((N) => N.value === d.value)?.ref.current?.scrollIntoView({ block: "nearest" });
487
- });
488
- }, [a, d.autocomplete, d.value, d.open]);
489
- const M = ne();
490
- return d.autocomplete === "list" && m && p && !w(m, p) || d.autocomplete === "both" && m && d.filterValue && !w(m, d.filterValue) ? null : /* @__PURE__ */ f(Qt, { textId: u, onTextValueChange: R, isSelected: v, children: /* @__PURE__ */ f(pe.ItemSlot, { scope: void 0, value: e, textValue: m, disabled: t, type: "option", children: /* @__PURE__ */ f(
491
- _.div,
482
+ const { onTextValueChange: a, textValue: m, ...u } = K(Oe), x = re(), [p, d] = l.useState(o ?? ""), h = u.value === e, { startsWith: v } = Me(u.locale, { sensitivity: "base" }), C = l.useCallback((b) => {
483
+ d((g) => g || (b?.textContent ?? "").trim());
484
+ }, []);
485
+ return l.useEffect(() => {
486
+ h && m === void 0 && p !== "" && a(p);
487
+ }, [p, h, m, a]), u.autocomplete === "both" && p && u.filterValue && !v(p, u.filterValue) || u.autocomplete === "list" && p && m && !v(p, m) ? i ? Ce.createPortal(
488
+ /* @__PURE__ */ f(
489
+ et,
490
+ {
491
+ textId: x,
492
+ onTextValueChange: C,
493
+ isSelected: h,
494
+ textValue: p,
495
+ children: /* @__PURE__ */ f(
496
+ ae.ItemSlot,
497
+ {
498
+ scope: void 0,
499
+ value: e,
500
+ textValue: p,
501
+ disabled: t,
502
+ type: "option",
503
+ isVisible: !1,
504
+ children: /* @__PURE__ */ f(tt, { ref: c, value: e, disabled: t, ...n })
505
+ }
506
+ )
507
+ }
508
+ ),
509
+ i
510
+ ) : null : /* @__PURE__ */ f(
511
+ et,
512
+ {
513
+ textId: x,
514
+ onTextValueChange: C,
515
+ isSelected: h,
516
+ textValue: p,
517
+ children: /* @__PURE__ */ f(
518
+ ae.ItemSlot,
519
+ {
520
+ scope: void 0,
521
+ value: e,
522
+ textValue: p,
523
+ disabled: t,
524
+ type: "option",
525
+ isVisible: !0,
526
+ children: /* @__PURE__ */ f(tt, { ref: c, value: e, disabled: t, ...n })
527
+ }
528
+ )
529
+ }
530
+ );
531
+ }), to = "ComboboxItemImpl", tt = l.forwardRef((r, c) => {
532
+ const { value: e, disabled: t = !1, ...o } = r, n = l.useRef(null), i = M(c, n), { getItems: s } = me(void 0), { onTextValueChange: a, visuallyFocussedItem: m, ...u } = K(Oe), { isSelected: x, textValue: p, textId: d } = De(to), h = () => {
533
+ t || (u.onValueChange(e), a(p), u.onOpenChange(!1), u.autocomplete === "both" && u.onFilterValueChange(p), u.trigger?.focus({ preventScroll: !0 }));
534
+ }, v = l.useMemo(() => m === s().find((b) => b.ref.current === n.current)?.ref.current, [s, m]), C = re();
535
+ return /* @__PURE__ */ f(
536
+ N.div,
492
537
  {
493
538
  role: "option",
494
- "aria-labelledby": u,
495
- "data-highlighted": C ? "" : void 0,
496
- "aria-selected": v && C,
497
- "data-state": v ? "checked" : "unchecked",
539
+ "aria-labelledby": d,
540
+ "data-highlighted": v ? "" : void 0,
541
+ "aria-selected": x && v,
542
+ "data-state": x ? "checked" : "unchecked",
498
543
  "aria-disabled": t || void 0,
499
544
  "data-disabled": t ? "" : void 0,
500
545
  tabIndex: t ? void 0 : -1,
501
- ...n,
502
- id: M,
503
- ref: c,
504
- onPointerUp: T(n.onPointerUp, h)
546
+ ...o,
547
+ id: C,
548
+ ref: i,
549
+ onPointerUp: T(o.onPointerUp, h)
505
550
  }
506
- ) }) });
507
- }), eo = "ComboboxItemText", to = l.forwardRef((r, s) => {
508
- const { className: e, style: t, ...o } = r, n = ft(eo), i = O(s, n.onTextValueChange);
509
- return /* @__PURE__ */ f(_.span, { id: n.textId, ...o, ref: i });
510
- }), oo = "ComboboxItemIndicator", no = l.forwardRef((r, s) => {
511
- const { isSelected: e } = ft(oo);
512
- return e ? /* @__PURE__ */ f(_.span, { "aria-hidden": !0, ...r, ref: s }) : null;
513
- }), mt = "ComboboxNoValueFound", ro = l.forwardRef((r, s) => {
514
- const { textValue: e = "", locale: t } = j(mt), [o, n] = l.useState([]), { subscribe: i } = Ce(void 0), { startsWith: c } = Me(t, { sensitivity: "base" });
551
+ );
552
+ }), oo = "ComboboxItemText", no = l.forwardRef((r, c) => {
553
+ const { className: e, style: t, ...o } = r, n = De(oo), i = M(c, n.onTextValueChange);
554
+ return /* @__PURE__ */ f(N.span, { id: n.textId, ...o, ref: i });
555
+ }), ro = "ComboboxItemIndicator", lo = l.forwardRef((r, c) => {
556
+ const { isSelected: e } = De(ro);
557
+ return e ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...r, ref: c }) : null;
558
+ }), gt = "ComboboxNoValueFound", so = l.forwardRef((r, c) => {
559
+ const { textValue: e = "", filterValue: t = "", locale: o, autocomplete: n } = K(gt), [i, s] = l.useState([]), { subscribe: a } = me(void 0), { startsWith: m } = Me(o, { sensitivity: "base" });
515
560
  return l.useEffect(() => {
516
- const a = i((g) => {
517
- n(g);
561
+ const u = a((x) => {
562
+ s(x);
518
563
  });
519
564
  return () => {
520
- a();
565
+ u();
521
566
  };
522
- }, [i]), o.some((a) => c(a.textValue, e)) ? null : /* @__PURE__ */ f(_.div, { ...r, ref: s });
523
- }), lo = l.forwardRef((r, s) => {
524
- const { disabled: e = !1, ...t } = r, o = j(mt), { textValue: n, visuallyFocussedItem: i } = o, { getItems: c, subscribe: a } = Ce(void 0), g = l.useRef(null), [p, x] = l.useState(!1), d = O(s, g), u = l.useMemo(() => i === c().find((C) => C.ref.current === g.current)?.ref.current, [c, i]), m = ne(), b = () => {
567
+ }, [a]), i.length === 0 || n === "none" || n === "list" && i.some((u) => m(u.textValue, e)) || n === "both" && i.some((u) => m(u.textValue, t)) ? null : /* @__PURE__ */ f(N.div, { ...r, ref: c });
568
+ }), co = l.forwardRef((r, c) => {
569
+ const { disabled: e = !1, ...t } = r, o = K(gt), { textValue: n, visuallyFocussedItem: i } = o, { getItems: s, subscribe: a } = me(void 0), m = l.useRef(null), [u, x] = l.useState(!1), p = M(c, m), d = l.useMemo(() => i === s().find((C) => C.ref.current === m.current)?.ref.current, [s, i]), h = re(), v = () => {
525
570
  !e && n && (o.onValueChange(n), o.onTextValueChange(n), o.onOpenChange(!1), o.autocomplete === "both" && o.onFilterValueChange(n), o.trigger?.focus({ preventScroll: !0 }));
526
571
  };
527
- return B(() => {
528
- const C = a((v) => {
529
- x(!v.some((h) => h.textValue === n && h.type !== "create"));
572
+ return L(() => {
573
+ const C = a((b) => {
574
+ x(!b.some((g) => g.textValue === n && g.type !== "create"));
530
575
  });
531
- return c().length === 0 && x(!0), () => {
576
+ return s().length === 0 && x(!0), () => {
532
577
  C();
533
578
  };
534
- }, [n, a, c]), !n || !p ? null : /* @__PURE__ */ f(
535
- pe.ItemSlot,
579
+ }, [n, a, s]), !n || !u ? null : /* @__PURE__ */ f(
580
+ ae.ItemSlot,
536
581
  {
537
582
  scope: void 0,
538
583
  value: n ?? "",
539
584
  textValue: n ?? "",
540
585
  disabled: e,
586
+ isVisible: !0,
541
587
  type: "create",
542
588
  children: /* @__PURE__ */ f(
543
- _.div,
589
+ N.div,
544
590
  {
545
591
  role: "option",
546
592
  tabIndex: e ? void 0 : -1,
547
593
  "aria-disabled": e || void 0,
548
594
  "data-disabled": e ? "" : void 0,
549
- "data-highlighted": u ? "" : void 0,
595
+ "data-highlighted": d ? "" : void 0,
550
596
  ...t,
551
- id: m,
552
- ref: d,
553
- onPointerUp: T(t.onPointerUp, b)
597
+ id: h,
598
+ ref: p,
599
+ onPointerUp: T(t.onPointerUp, v)
554
600
  }
555
601
  )
556
602
  }
557
603
  );
558
- }), so = $t, co = Kt, io = Wt, ao = zt, uo = at, fo = jt, po = Jt, mo = pt, ho = to, go = no, Co = ro, xo = lo;
559
- function vo(r, s) {
560
- const e = Math.min(r.length, s.length);
604
+ }), io = Kt, ao = zt, uo = Gt, fo = jt, po = pt, mo = qt, ho = eo, go = ht, xo = no, Co = lo, vo = so, bo = co;
605
+ function So(r, c) {
606
+ const e = Math.min(r.length, c.length);
561
607
  for (let t = 0; t < e; t++)
562
- if (r[t] !== s[t])
608
+ if (r[t] !== c[t])
563
609
  return t;
564
610
  return e;
565
611
  }
566
- const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
612
+ const Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
567
613
  __proto__: null,
568
- ComboboxItem: pt,
569
- Content: fo,
570
- CreateItem: xo,
571
- Icon: ao,
572
- Item: mo,
573
- ItemIndicator: go,
574
- ItemText: ho,
575
- NoValueFound: Co,
576
- Portal: uo,
577
- Root: so,
578
- TextInput: io,
579
- Trigger: co,
580
- Viewport: po
581
- }, Symbol.toStringTag, { value: "Module" })), bo = [" ", "Enter", "ArrowUp", "ArrowDown"], So = [" ", "Enter"], me = "Select", [xe, he, wo] = Et(me), [ae, Io] = Je(me, [
582
- wo,
583
- nt
584
- ]), ve = nt(), [yo, Y] = ae(me), [To, Vo] = ae(me), Oe = (r) => {
614
+ ComboboxItem: ht,
615
+ Content: mo,
616
+ CreateItem: bo,
617
+ Icon: fo,
618
+ Item: go,
619
+ ItemIndicator: Co,
620
+ ItemText: xo,
621
+ NoValueFound: vo,
622
+ Portal: po,
623
+ Root: io,
624
+ TextInput: uo,
625
+ Trigger: ao,
626
+ Viewport: ho
627
+ }, Symbol.toStringTag, { value: "Module" })), Io = [" ", "Enter", "ArrowUp", "ArrowDown"], wo = [" ", "Enter"], he = "Select", [ve, ge, yo] = Nt(he), [ue, To] = ot(he, [
628
+ yo,
629
+ ct
630
+ ]), be = ct(), [Vo, Y] = ue(he), [Po, Eo] = ue(he), ke = (r) => {
585
631
  const {
586
- __scopeSelect: s,
632
+ __scopeSelect: c,
587
633
  children: e,
588
634
  open: t,
589
635
  defaultOpen: o,
590
636
  onOpenChange: n,
591
637
  value: i,
592
- defaultValue: c,
638
+ defaultValue: s,
593
639
  onValueChange: a,
594
- dir: g,
640
+ dir: m,
595
641
  // name,
596
642
  // autoComplete,
597
- disabled: p,
643
+ disabled: u,
598
644
  required: x,
599
- multi: d = !1
600
- } = r, u = ve(s), [m, b] = l.useState(null), [C, v] = l.useState(null), [h, w] = l.useState(!1), R = Rt(g), [M = !1, E] = ie({
645
+ multi: p = !1
646
+ } = r, d = be(c), [h, v] = l.useState(null), [C, b] = l.useState(null), [g, I] = l.useState(!1), E = At(m), [O = !1, A] = ie({
601
647
  prop: t,
602
648
  defaultProp: o,
603
649
  onChange: n
604
- }), [N, k] = ie({
650
+ }), [_, k] = ie({
605
651
  prop: i,
606
- defaultProp: c,
652
+ defaultProp: s,
607
653
  onChange(D) {
608
654
  a && (Array.isArray(D), a(D));
609
655
  }
610
- }), q = l.useRef(null), [K, L] = l.useState(/* @__PURE__ */ new Set());
611
- return /* @__PURE__ */ f(le.Root, { ...u, children: /* @__PURE__ */ f(
612
- yo,
656
+ }), q = l.useRef(null), [W, B] = l.useState(/* @__PURE__ */ new Set());
657
+ return /* @__PURE__ */ f(le.Root, { ...d, children: /* @__PURE__ */ f(
658
+ Vo,
613
659
  {
614
660
  required: x,
615
- scope: s,
616
- trigger: m,
617
- onTriggerChange: b,
661
+ scope: c,
662
+ trigger: h,
663
+ onTriggerChange: v,
618
664
  valueNode: C,
619
- onValueNodeChange: v,
620
- valueNodeHasChildren: h,
621
- onValueNodeHasChildrenChange: w,
622
- contentId: ne(),
623
- value: N,
665
+ onValueNodeChange: b,
666
+ valueNodeHasChildren: g,
667
+ onValueNodeHasChildrenChange: I,
668
+ contentId: re(),
669
+ value: _,
624
670
  onValueChange: k,
625
- open: M,
626
- onOpenChange: E,
627
- dir: R,
671
+ open: O,
672
+ onOpenChange: A,
673
+ dir: E,
628
674
  triggerPointerDownPosRef: q,
629
- disabled: p,
630
- multi: d,
631
- children: /* @__PURE__ */ f(xe.Provider, { scope: s, children: /* @__PURE__ */ f(
632
- To,
675
+ disabled: u,
676
+ multi: p,
677
+ children: /* @__PURE__ */ f(ve.Provider, { scope: c, children: /* @__PURE__ */ f(
678
+ Po,
633
679
  {
634
680
  scope: r.__scopeSelect,
635
681
  onNativeOptionAdd: l.useCallback((D) => {
636
- L((H) => new Set(H).add(D));
682
+ B((H) => new Set(H).add(D));
637
683
  }, []),
638
684
  onNativeOptionRemove: l.useCallback((D) => {
639
- L((H) => {
685
+ B((H) => {
640
686
  const F = new Set(H);
641
687
  return F.delete(D), F;
642
688
  });
@@ -647,20 +693,20 @@ const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
647
693
  }
648
694
  ) });
649
695
  };
650
- Oe.displayName = me;
651
- const ht = "SelectTrigger", De = l.forwardRef(
652
- (r, s) => {
653
- const { __scopeSelect: e, ...t } = r, o = ve(e), n = Y(ht, e), i = n.disabled, c = O(s, n.onTriggerChange), a = he(e), [g, p, x] = Tt((u) => {
654
- const m = a().filter((v) => !v.disabled), b = m.find((v) => v.value === n.value), C = Vt(m, u, b);
696
+ ke.displayName = he;
697
+ const xt = "SelectTrigger", Fe = l.forwardRef(
698
+ (r, c) => {
699
+ const { __scopeSelect: e, ...t } = r, o = be(e), n = Y(xt, e), i = n.disabled, s = M(c, n.onTriggerChange), a = ge(e), [m, u, x] = Pt((d) => {
700
+ const h = a().filter((b) => !b.disabled), v = h.find((b) => b.value === n.value), C = Et(h, d, v);
655
701
  if (C !== void 0 && !Array.isArray(C.value)) {
656
- const v = n.multi ? [C.value] : C.value;
657
- n.onValueChange(v);
702
+ const b = n.multi ? [C.value] : C.value;
703
+ n.onValueChange(b);
658
704
  }
659
- }), d = () => {
705
+ }), p = () => {
660
706
  i || (n.onOpenChange(!0), x());
661
707
  };
662
708
  return /* @__PURE__ */ f(le.Anchor, { asChild: !0, ...o, children: /* @__PURE__ */ f(
663
- _.div,
709
+ N.div,
664
710
  {
665
711
  role: "combobox",
666
712
  "aria-controls": n.contentId,
@@ -673,89 +719,89 @@ const ht = "SelectTrigger", De = l.forwardRef(
673
719
  "data-placeholder": n.value === void 0 ? "" : void 0,
674
720
  tabIndex: i ? void 0 : 0,
675
721
  ...t,
676
- ref: c,
677
- onClick: T(t.onClick, (u) => {
678
- u.currentTarget.focus();
722
+ ref: s,
723
+ onClick: T(t.onClick, (d) => {
724
+ d.currentTarget.focus();
679
725
  }),
680
- onPointerDown: T(t.onPointerDown, (u) => {
681
- const m = u.target;
682
- m.hasPointerCapture(u.pointerId) && m.releasePointerCapture(u.pointerId), (m.closest("button") ?? m.closest("div")) === u.currentTarget && u.button === 0 && u.ctrlKey === !1 && (d(), n.triggerPointerDownPosRef.current = {
683
- x: Math.round(u.pageX),
684
- y: Math.round(u.pageY)
685
- }, u.preventDefault());
726
+ onPointerDown: T(t.onPointerDown, (d) => {
727
+ const h = d.target;
728
+ h.hasPointerCapture(d.pointerId) && h.releasePointerCapture(d.pointerId), (h.closest("button") ?? h.closest("div")) === d.currentTarget && d.button === 0 && d.ctrlKey === !1 && (p(), n.triggerPointerDownPosRef.current = {
729
+ x: Math.round(d.pageX),
730
+ y: Math.round(d.pageY)
731
+ }, d.preventDefault());
686
732
  }),
687
- onKeyDown: T(t.onKeyDown, (u) => {
688
- const m = g.current !== "", b = u.ctrlKey || u.altKey || u.metaKey, C = u.target;
689
- (C.closest("button") ?? C.closest("div")) === u.currentTarget && (!b && u.key.length === 1 && p(u.key), !(m && u.key === " ") && bo.includes(u.key) && (d(), u.preventDefault()));
733
+ onKeyDown: T(t.onKeyDown, (d) => {
734
+ const h = m.current !== "", v = d.ctrlKey || d.altKey || d.metaKey, C = d.target;
735
+ (C.closest("button") ?? C.closest("div")) === d.currentTarget && (!v && d.key.length === 1 && u(d.key), !(h && d.key === " ") && Io.includes(d.key) && (p(), d.preventDefault()));
690
736
  })
691
737
  }
692
738
  ) });
693
739
  }
694
740
  );
695
- De.displayName = ht;
696
- const gt = "SelectValue", ke = l.forwardRef(
697
- (r, s) => {
698
- const { __scopeSelect: e, children: t, placeholder: o, ...n } = r, i = Y(gt, e), { onValueNodeHasChildrenChange: c } = i, a = t !== void 0, g = O(s, i.onValueNodeChange), [p, x] = l.useState([]), d = he(e);
699
- B(() => {
700
- c(a);
701
- }, [c, a]), l.useLayoutEffect(() => {
702
- if (Array.isArray(i.value) && p.length !== i.value.length) {
703
- const m = setTimeout(() => {
704
- const b = d().filter(
741
+ Fe.displayName = xt;
742
+ const Ct = "SelectValue", Le = l.forwardRef(
743
+ (r, c) => {
744
+ const { __scopeSelect: e, children: t, placeholder: o, ...n } = r, i = Y(Ct, e), { onValueNodeHasChildrenChange: s } = i, a = t !== void 0, m = M(c, i.onValueNodeChange), [u, x] = l.useState([]), p = ge(e);
745
+ L(() => {
746
+ s(a);
747
+ }, [s, a]), l.useLayoutEffect(() => {
748
+ if (Array.isArray(i.value) && u.length !== i.value.length) {
749
+ const h = setTimeout(() => {
750
+ const v = p().filter(
705
751
  (C) => Array.isArray(C.value) ? !1 : i.value?.includes(C.value)
706
752
  );
707
- x(b);
753
+ x(v);
708
754
  });
709
755
  return () => {
710
- clearTimeout(m);
756
+ clearTimeout(h);
711
757
  };
712
758
  }
713
- }, [i.value, d, p]);
714
- let u;
759
+ }, [i.value, p, u]);
760
+ let d;
715
761
  if ((i.value === void 0 || i.value.length === 0) && o !== void 0)
716
- u = /* @__PURE__ */ f("span", { children: o });
762
+ d = /* @__PURE__ */ f("span", { children: o });
717
763
  else if (typeof t == "function")
718
764
  if (Array.isArray(i.value)) {
719
- const m = i.value.map((b) => {
720
- const C = p.find((v) => v.value === b);
721
- return C ? t({ value: b, textValue: C?.textValue }) : null;
765
+ const h = i.value.map((v) => {
766
+ const C = u.find((b) => b.value === v);
767
+ return C ? t({ value: v, textValue: C?.textValue }) : null;
722
768
  });
723
- u = m.every((b) => b === null) ? o : m;
769
+ d = h.every((v) => v === null) ? o : h;
724
770
  } else
725
- u = t(i.value);
771
+ d = t(i.value);
726
772
  else
727
- u = t;
728
- return /* @__PURE__ */ f(_.span, { ...n, ref: g, children: u || null });
773
+ d = t;
774
+ return /* @__PURE__ */ f(N.span, { ...n, ref: m, children: d || null });
729
775
  }
730
776
  );
731
- ke.displayName = gt;
732
- const Po = "SelectIcon", Fe = l.forwardRef(
733
- (r, s) => {
777
+ Le.displayName = Ct;
778
+ const Ro = "SelectIcon", Be = l.forwardRef(
779
+ (r, c) => {
734
780
  const { __scopeSelect: e, children: t, ...o } = r;
735
- return /* @__PURE__ */ f(_.span, { "aria-hidden": !0, ...o, ref: s, children: t || "▼" });
781
+ return /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: c, children: t || "▼" });
736
782
  }
737
783
  );
738
- Fe.displayName = Po;
739
- const Eo = "SelectPortal", Le = (r) => /* @__PURE__ */ f(rt, { asChild: !0, ...r });
740
- Le.displayName = Eo;
741
- const re = "SelectContent", Be = l.forwardRef(
742
- (r, s) => {
743
- const e = Y(re, r.__scopeSelect), [t, o] = l.useState();
744
- if (B(() => {
784
+ Be.displayName = Ro;
785
+ const No = "SelectPortal", He = (r) => /* @__PURE__ */ f(it, { asChild: !0, ...r });
786
+ He.displayName = No;
787
+ const ne = "SelectContent", $e = l.forwardRef(
788
+ (r, c) => {
789
+ const e = Y(ne, r.__scopeSelect), [t, o] = l.useState();
790
+ if (L(() => {
745
791
  o(new DocumentFragment());
746
792
  }, []), !e.open) {
747
793
  const n = t;
748
- return n ? _e.createPortal(
749
- /* @__PURE__ */ f(Ct, { scope: r.__scopeSelect, children: /* @__PURE__ */ f(xe.Slot, { scope: r.__scopeSelect, children: /* @__PURE__ */ f("div", { children: r.children }) }) }),
794
+ return n ? Ce.createPortal(
795
+ /* @__PURE__ */ f(vt, { scope: r.__scopeSelect, children: /* @__PURE__ */ f(ve.Slot, { scope: r.__scopeSelect, children: /* @__PURE__ */ f("div", { children: r.children }) }) }),
750
796
  n
751
797
  ) : null;
752
798
  }
753
- return /* @__PURE__ */ f(xt, { ...r, ref: s });
799
+ return /* @__PURE__ */ f(bt, { ...r, ref: c });
754
800
  }
755
801
  );
756
- Be.displayName = re;
757
- const G = 10, [Ct, J] = ae(re), Ro = "SelectContentImpl", xt = l.forwardRef(
758
- (r, s) => {
802
+ $e.displayName = ne;
803
+ const j = 10, [vt, J] = ue(ne), Ao = "SelectContentImpl", bt = l.forwardRef(
804
+ (r, c) => {
759
805
  const {
760
806
  __scopeSelect: e,
761
807
  position: t = "item-aligned",
@@ -764,153 +810,153 @@ const G = 10, [Ct, J] = ae(re), Ro = "SelectContentImpl", xt = l.forwardRef(
764
810
  onPointerDownOutside: i,
765
811
  //
766
812
  // PopperContent props
767
- side: c,
813
+ side: s,
768
814
  sideOffset: a,
769
- align: g,
770
- alignOffset: p,
815
+ align: m,
816
+ alignOffset: u,
771
817
  arrowPadding: x,
772
- collisionBoundary: d,
773
- collisionPadding: u,
774
- sticky: m,
775
- hideWhenDetached: b,
818
+ collisionBoundary: p,
819
+ collisionPadding: d,
820
+ sticky: h,
821
+ hideWhenDetached: v,
776
822
  avoidCollisions: C,
777
823
  //
778
- ...v
779
- } = r, h = Y(re, e), [w, R] = l.useState(null), [M, E] = l.useState(null), N = O(s, (S) => R(S)), [k, q] = l.useState(null), [K, L] = l.useState(null), D = he(e), [H, F] = l.useState(!1), W = l.useRef(!1);
824
+ ...b
825
+ } = r, g = Y(ne, e), [I, E] = l.useState(null), [O, A] = l.useState(null), _ = M(c, (S) => E(S)), [k, q] = l.useState(null), [W, B] = l.useState(null), D = ge(e), [H, F] = l.useState(!1), z = l.useRef(!1);
780
826
  l.useEffect(() => {
781
- if (w)
782
- return lt(w);
783
- }, [w]), tt();
784
- const z = l.useCallback(
827
+ if (I)
828
+ return at(I);
829
+ }, [I]), lt();
830
+ const G = l.useCallback(
785
831
  (S) => {
786
- const [V, ...y] = D().map((A) => A.ref.current), [I] = y.slice(-1), P = document.activeElement;
787
- for (const A of S)
788
- if (A === P || (A?.scrollIntoView({ block: "nearest" }), A === V && M && (M.scrollTop = 0), A === I && M && (M.scrollTop = M.scrollHeight), A?.focus(), document.activeElement !== P))
832
+ const [V, ...y] = D().map((R) => R.ref.current), [w] = y.slice(-1), P = document.activeElement;
833
+ for (const R of S)
834
+ if (R === P || (R?.scrollIntoView({ block: "nearest" }), R === V && O && (O.scrollTop = 0), R === w && O && (O.scrollTop = O.scrollHeight), R?.focus(), document.activeElement !== P))
789
835
  return;
790
836
  },
791
- [D, M]
837
+ [D, O]
792
838
  ), $ = l.useCallback(
793
- () => z([k, w]),
794
- [z, k, w]
839
+ () => G([k, I]),
840
+ [G, k, I]
795
841
  );
796
842
  l.useEffect(() => {
797
843
  H && $();
798
844
  }, [H, $]);
799
- const { onOpenChange: X, triggerPointerDownPosRef: U } = h;
845
+ const { onOpenChange: X, triggerPointerDownPosRef: U } = g;
800
846
  l.useEffect(() => {
801
- if (w) {
847
+ if (I) {
802
848
  let S = { x: 0, y: 0 };
803
- const V = (I) => {
849
+ const V = (w) => {
804
850
  S = {
805
- x: Math.abs(Math.round(I.pageX) - (U.current?.x ?? 0)),
806
- y: Math.abs(Math.round(I.pageY) - (U.current?.y ?? 0))
851
+ x: Math.abs(Math.round(w.pageX) - (U.current?.x ?? 0)),
852
+ y: Math.abs(Math.round(w.pageY) - (U.current?.y ?? 0))
807
853
  };
808
- }, y = (I) => {
809
- S.x <= 10 && S.y <= 10 ? I.preventDefault() : w.contains(I.target) || X(!1), document.removeEventListener("pointermove", V), U.current = null;
854
+ }, y = (w) => {
855
+ S.x <= 10 && S.y <= 10 ? w.preventDefault() : I.contains(w.target) || X(!1), document.removeEventListener("pointermove", V), U.current = null;
810
856
  };
811
857
  return U.current !== null && (document.addEventListener("pointermove", V), document.addEventListener("pointerup", y, { capture: !0, once: !0 })), () => {
812
858
  document.removeEventListener("pointermove", V), document.removeEventListener("pointerup", y, { capture: !0 });
813
859
  };
814
860
  }
815
- }, [w, X, U]), l.useEffect(() => {
861
+ }, [I, X, U]), l.useEffect(() => {
816
862
  const S = () => X(!1);
817
863
  return window.addEventListener("blur", S), window.addEventListener("resize", S), () => {
818
864
  window.removeEventListener("blur", S), window.removeEventListener("resize", S);
819
865
  };
820
866
  }, [X]);
821
- const [ue, se] = Tt((S) => {
822
- const V = D().filter((P) => !P.disabled), y = V.find((P) => P.ref.current === document.activeElement), I = Vt(V, S, y);
823
- I && setTimeout(() => I.ref.current.focus());
824
- }), de = l.useCallback(
867
+ const [de, se] = Pt((S) => {
868
+ const V = D().filter((P) => !P.disabled), y = V.find((P) => P.ref.current === document.activeElement), w = Et(V, S, y);
869
+ w && setTimeout(() => w.ref.current.focus());
870
+ }), fe = l.useCallback(
825
871
  (S, V, y) => {
826
- const I = !W.current && !y;
827
- (h.value !== void 0 && h.value === V || I) && (q(S), I && (W.current = !0));
872
+ const w = !z.current && !y;
873
+ (g.value !== void 0 && g.value === V || w) && (q(S), w && (z.current = !0));
828
874
  },
829
- [h.value]
830
- ), Q = l.useCallback(() => w?.focus(), [w]), Z = l.useCallback(
875
+ [g.value]
876
+ ), Q = l.useCallback(() => I?.focus(), [I]), Z = l.useCallback(
831
877
  (S, V, y) => {
832
- const I = !W.current && !y;
833
- (h.value !== void 0 && (Array.isArray(V) ? V.every((A) => h.value?.includes(A)) : h.value === V) || I) && L(S);
878
+ const w = !z.current && !y;
879
+ (g.value !== void 0 && (Array.isArray(V) ? V.every((R) => g.value?.includes(R)) : g.value === V) || w) && B(S);
834
880
  },
835
- [h.value]
836
- ), ce = t === "popper" ? Te : vt, ee = ce === Te ? {
837
- side: c,
881
+ [g.value]
882
+ ), ce = t === "popper" ? Ve : St, ee = ce === Ve ? {
883
+ side: s,
838
884
  sideOffset: a,
839
- align: g,
840
- alignOffset: p,
885
+ align: m,
886
+ alignOffset: u,
841
887
  arrowPadding: x,
842
- collisionBoundary: d,
843
- collisionPadding: u,
844
- sticky: m,
845
- hideWhenDetached: b,
888
+ collisionBoundary: p,
889
+ collisionPadding: d,
890
+ sticky: h,
891
+ hideWhenDetached: v,
846
892
  avoidCollisions: C
847
893
  } : {};
848
894
  return /* @__PURE__ */ f(
849
- Ct,
895
+ vt,
850
896
  {
851
897
  scope: e,
852
- content: w,
853
- viewport: M,
854
- onViewportChange: E,
855
- itemRefCallback: de,
898
+ content: I,
899
+ viewport: O,
900
+ onViewportChange: A,
901
+ itemRefCallback: fe,
856
902
  selectedItem: k,
857
903
  onItemLeave: Q,
858
904
  itemTextRefCallback: Z,
859
905
  focusSelectedItem: $,
860
- selectedItemText: K,
906
+ selectedItemText: W,
861
907
  position: t,
862
908
  isPositioned: H,
863
- searchRef: ue,
864
- children: /* @__PURE__ */ f(st, { as: ye, allowPinchZoom: !0, children: /* @__PURE__ */ f(
865
- ot,
909
+ searchRef: de,
910
+ children: /* @__PURE__ */ f(ut, { as: Te, allowPinchZoom: !0, children: /* @__PURE__ */ f(
911
+ st,
866
912
  {
867
913
  asChild: !0,
868
- trapped: h.open,
914
+ trapped: g.open,
869
915
  onMountAutoFocus: (S) => {
870
916
  S.preventDefault();
871
917
  },
872
918
  onUnmountAutoFocus: T(o, (S) => {
873
- h.trigger?.focus({ preventScroll: !0 }), document.getSelection()?.empty(), S.preventDefault();
919
+ g.trigger?.focus({ preventScroll: !0 }), document.getSelection()?.empty(), S.preventDefault();
874
920
  }),
875
921
  children: /* @__PURE__ */ f(
876
- et,
922
+ rt,
877
923
  {
878
924
  asChild: !0,
879
925
  disableOutsidePointerEvents: !0,
880
926
  onEscapeKeyDown: n,
881
927
  onPointerDownOutside: i,
882
928
  onFocusOutside: (S) => S.preventDefault(),
883
- onDismiss: () => h.onOpenChange(!1),
929
+ onDismiss: () => g.onOpenChange(!1),
884
930
  children: /* @__PURE__ */ f(
885
931
  ce,
886
932
  {
887
933
  role: "listbox",
888
- id: h.contentId,
889
- "data-state": h.open ? "open" : "closed",
890
- "aria-multiselectable": h.multi ? "true" : void 0,
891
- dir: h.dir,
934
+ id: g.contentId,
935
+ "data-state": g.open ? "open" : "closed",
936
+ "aria-multiselectable": g.multi ? "true" : void 0,
937
+ dir: g.dir,
892
938
  onContextMenu: (S) => S.preventDefault(),
893
- ...v,
939
+ ...b,
894
940
  ...ee,
895
941
  onPlaced: () => F(!0),
896
- ref: N,
942
+ ref: _,
897
943
  style: {
898
944
  // flex layout so we can place the scroll buttons properly
899
945
  display: "flex",
900
946
  flexDirection: "column",
901
947
  // reset the outline by default as the content MAY get focused
902
948
  outline: "none",
903
- ...v.style
949
+ ...b.style
904
950
  },
905
- onKeyDown: T(v.onKeyDown, (S) => {
951
+ onKeyDown: T(b.onKeyDown, (S) => {
906
952
  const V = S.ctrlKey || S.altKey || S.metaKey;
907
953
  if (S.key === "Tab" && S.preventDefault(), !V && S.key.length === 1 && se(S.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(S.key)) {
908
- let I = D().filter((P) => !P.disabled).map((P) => P.ref.current);
909
- if (["ArrowUp", "End"].includes(S.key) && (I = I.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(S.key)) {
910
- const P = S.target, A = I.indexOf(P);
911
- I = I.slice(A + 1);
954
+ let w = D().filter((P) => !P.disabled).map((P) => P.ref.current);
955
+ if (["ArrowUp", "End"].includes(S.key) && (w = w.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(S.key)) {
956
+ const P = S.target, R = w.indexOf(P);
957
+ w = w.slice(R + 1);
912
958
  }
913
- setTimeout(() => z(I)), S.preventDefault();
959
+ setTimeout(() => G(w)), S.preventDefault();
914
960
  }
915
961
  })
916
962
  }
@@ -923,71 +969,71 @@ const G = 10, [Ct, J] = ae(re), Ro = "SelectContentImpl", xt = l.forwardRef(
923
969
  );
924
970
  }
925
971
  );
926
- xt.displayName = Ro;
927
- const No = "SelectItemAlignedPosition", vt = l.forwardRef(
928
- (r, s) => {
929
- const { __scopeSelect: e, onPlaced: t, ...o } = r, n = Y(re, e), i = J(re, e), [c, a] = l.useState(null), [g, p] = l.useState(null), x = O(s, (N) => p(N)), d = he(e), u = l.useRef(!1), m = l.useRef(!0), { viewport: b, selectedItem: C, selectedItemText: v, focusSelectedItem: h } = i, w = l.useCallback(() => {
930
- if (n.trigger && n.valueNode && c && g && b && C && v) {
931
- const N = n.trigger.getBoundingClientRect(), k = g.getBoundingClientRect(), q = n.valueNode.getBoundingClientRect(), K = v.getBoundingClientRect();
972
+ bt.displayName = Ao;
973
+ const _o = "SelectItemAlignedPosition", St = l.forwardRef(
974
+ (r, c) => {
975
+ const { __scopeSelect: e, onPlaced: t, ...o } = r, n = Y(ne, e), i = J(ne, e), [s, a] = l.useState(null), [m, u] = l.useState(null), x = M(c, (_) => u(_)), p = ge(e), d = l.useRef(!1), h = l.useRef(!0), { viewport: v, selectedItem: C, selectedItemText: b, focusSelectedItem: g } = i, I = l.useCallback(() => {
976
+ if (n.trigger && n.valueNode && s && m && v && C && b) {
977
+ const _ = n.trigger.getBoundingClientRect(), k = m.getBoundingClientRect(), q = n.valueNode.getBoundingClientRect(), W = b.getBoundingClientRect();
932
978
  if (n.dir !== "rtl") {
933
- const P = K.left - k.left, A = q.left - P, te = N.left - A, oe = N.width + te, be = Math.max(oe, k.width), Se = window.innerWidth - G, we = Ze(A, [G, Se - be]);
934
- c.style.minWidth = `${oe}px`, c.style.left = `${we}px`;
979
+ const P = W.left - k.left, R = q.left - P, te = _.left - R, oe = _.width + te, Se = Math.max(oe, k.width), Ie = window.innerWidth - j, we = Qe(R, [j, Ie - Se]);
980
+ s.style.minWidth = `${oe}px`, s.style.left = `${we}px`;
935
981
  } else {
936
- const P = k.right - K.right, A = window.innerWidth - q.right - P, te = window.innerWidth - N.right - A, oe = N.width + te, be = Math.max(oe, k.width), Se = window.innerWidth - G, we = Ze(A, [G, Se - be]);
937
- c.style.minWidth = `${oe}px`, c.style.right = `${we}px`;
982
+ const P = k.right - W.right, R = window.innerWidth - q.right - P, te = window.innerWidth - _.right - R, oe = _.width + te, Se = Math.max(oe, k.width), Ie = window.innerWidth - j, we = Qe(R, [j, Ie - Se]);
983
+ s.style.minWidth = `${oe}px`, s.style.right = `${we}px`;
938
984
  }
939
- const L = d(), D = window.innerHeight - G * 2, H = b.scrollHeight, F = window.getComputedStyle(g), W = parseInt(F.borderTopWidth, 10), z = parseInt(F.paddingTop, 10), $ = parseInt(F.borderBottomWidth, 10), X = parseInt(F.paddingBottom, 10), U = W + z + H + X + $, ue = Math.min(C.offsetHeight * 5, U), se = window.getComputedStyle(b), de = parseInt(se.paddingTop, 10), Q = parseInt(se.paddingBottom, 10), Z = N.top + N.height / 2 - G, ce = D - Z, ee = C.offsetHeight / 2, S = C.offsetTop + ee, V = W + z + S, y = U - V;
985
+ const B = p(), D = window.innerHeight - j * 2, H = v.scrollHeight, F = window.getComputedStyle(m), z = parseInt(F.borderTopWidth, 10), G = parseInt(F.paddingTop, 10), $ = parseInt(F.borderBottomWidth, 10), X = parseInt(F.paddingBottom, 10), U = z + G + H + X + $, de = Math.min(C.offsetHeight * 5, U), se = window.getComputedStyle(v), fe = parseInt(se.paddingTop, 10), Q = parseInt(se.paddingBottom, 10), Z = _.top + _.height / 2 - j, ce = D - Z, ee = C.offsetHeight / 2, S = C.offsetTop + ee, V = z + G + S, y = U - V;
940
986
  if (V <= Z) {
941
- const P = C === L[L.length - 1].ref.current;
942
- c.style.bottom = "0px";
943
- const A = g.clientHeight - b.offsetTop - b.offsetHeight, te = Math.max(
987
+ const P = C === B[B.length - 1].ref.current;
988
+ s.style.bottom = "0px";
989
+ const R = m.clientHeight - v.offsetTop - v.offsetHeight, te = Math.max(
944
990
  ce,
945
991
  ee + // viewport might have padding bottom, include it to avoid a scrollable viewport
946
- (P ? Q : 0) + A + $
992
+ (P ? Q : 0) + R + $
947
993
  ), oe = V + te;
948
- c.style.height = `${oe}px`;
994
+ s.style.height = `${oe}px`;
949
995
  } else {
950
- const P = C === L[0].ref.current;
951
- c.style.top = "0px";
996
+ const P = C === B[0].ref.current;
997
+ s.style.top = "0px";
952
998
  const te = Math.max(
953
999
  Z,
954
- W + b.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
955
- (P ? de : 0) + ee
1000
+ z + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
1001
+ (P ? fe : 0) + ee
956
1002
  ) + y;
957
- c.style.height = `${te}px`, b.scrollTop = V - Z + b.offsetTop;
1003
+ s.style.height = `${te}px`, v.scrollTop = V - Z + v.offsetTop;
958
1004
  }
959
- c.style.margin = `${G}px 0`, c.style.minHeight = `${ue}px`, c.style.maxHeight = `${D}px`, t?.(), requestAnimationFrame(() => u.current = !0);
1005
+ s.style.margin = `${j}px 0`, s.style.minHeight = `${de}px`, s.style.maxHeight = `${D}px`, t?.(), requestAnimationFrame(() => d.current = !0);
960
1006
  }
961
1007
  }, [
962
- d,
1008
+ p,
963
1009
  n.trigger,
964
1010
  n.valueNode,
965
- c,
966
- g,
967
- b,
968
- C,
1011
+ s,
1012
+ m,
969
1013
  v,
1014
+ C,
1015
+ b,
970
1016
  n.dir,
971
1017
  t
972
1018
  ]);
973
- B(() => w(), [w]);
974
- const [R, M] = l.useState();
975
- B(() => {
976
- g && M(window.getComputedStyle(g).zIndex);
977
- }, [g]);
978
- const E = l.useCallback(
979
- (N) => {
980
- N && m.current === !0 && (w(), h?.(), m.current = !1);
1019
+ L(() => I(), [I]);
1020
+ const [E, O] = l.useState();
1021
+ L(() => {
1022
+ m && O(window.getComputedStyle(m).zIndex);
1023
+ }, [m]);
1024
+ const A = l.useCallback(
1025
+ (_) => {
1026
+ _ && h.current === !0 && (I(), g?.(), h.current = !1);
981
1027
  },
982
- [w, h]
1028
+ [I, g]
983
1029
  );
984
1030
  return /* @__PURE__ */ f(
985
- _o,
1031
+ Oo,
986
1032
  {
987
1033
  scope: e,
988
- contentWrapper: c,
989
- shouldExpandOnScrollRef: u,
990
- onScrollButtonChange: E,
1034
+ contentWrapper: s,
1035
+ shouldExpandOnScrollRef: d,
1036
+ onScrollButtonChange: A,
991
1037
  children: /* @__PURE__ */ f(
992
1038
  "div",
993
1039
  {
@@ -996,10 +1042,10 @@ const No = "SelectItemAlignedPosition", vt = l.forwardRef(
996
1042
  display: "flex",
997
1043
  flexDirection: "column",
998
1044
  position: "fixed",
999
- zIndex: R
1045
+ zIndex: E
1000
1046
  },
1001
1047
  children: /* @__PURE__ */ f(
1002
- _.div,
1048
+ N.div,
1003
1049
  {
1004
1050
  ...o,
1005
1051
  ref: x,
@@ -1019,16 +1065,16 @@ const No = "SelectItemAlignedPosition", vt = l.forwardRef(
1019
1065
  );
1020
1066
  }
1021
1067
  );
1022
- vt.displayName = No;
1023
- const Ao = "SelectPopperPosition", Te = l.forwardRef(
1024
- (r, s) => {
1025
- const { __scopeSelect: e, align: t = "start", collisionPadding: o = G, ...n } = r, i = ve(e);
1068
+ St.displayName = _o;
1069
+ const Mo = "SelectPopperPosition", Ve = l.forwardRef(
1070
+ (r, c) => {
1071
+ const { __scopeSelect: e, align: t = "start", collisionPadding: o = j, ...n } = r, i = be(e);
1026
1072
  return /* @__PURE__ */ f(
1027
1073
  le.Content,
1028
1074
  {
1029
1075
  ...i,
1030
1076
  ...n,
1031
- ref: s,
1077
+ ref: c,
1032
1078
  align: t,
1033
1079
  collisionPadding: o,
1034
1080
  style: {
@@ -1045,14 +1091,14 @@ const Ao = "SelectPopperPosition", Te = l.forwardRef(
1045
1091
  );
1046
1092
  }
1047
1093
  );
1048
- Te.displayName = Ao;
1049
- const [_o, He] = ae(
1050
- re,
1094
+ Ve.displayName = Mo;
1095
+ const [Oo, Ue] = ue(
1096
+ ne,
1051
1097
  {}
1052
- ), Ve = "SelectViewport", $e = l.forwardRef(
1053
- (r, s) => {
1054
- const { __scopeSelect: e, ...t } = r, o = J(Ve, e), n = He(Ve, e), i = O(s, o.onViewportChange), c = l.useRef(0);
1055
- return /* @__PURE__ */ Ne(Ae, { children: [
1098
+ ), Pe = "SelectViewport", Ke = l.forwardRef(
1099
+ (r, c) => {
1100
+ const { __scopeSelect: e, ...t } = r, o = J(Pe, e), n = Ue(Pe, e), i = M(c, o.onViewportChange), s = l.useRef(0);
1101
+ return /* @__PURE__ */ Ae(_e, { children: [
1056
1102
  /* @__PURE__ */ f(
1057
1103
  "style",
1058
1104
  {
@@ -1061,8 +1107,8 @@ const [_o, He] = ae(
1061
1107
  }
1062
1108
  }
1063
1109
  ),
1064
- /* @__PURE__ */ f(xe.Slot, { scope: e, children: /* @__PURE__ */ f(
1065
- _.div,
1110
+ /* @__PURE__ */ f(ve.Slot, { scope: e, children: /* @__PURE__ */ f(
1111
+ N.div,
1066
1112
  {
1067
1113
  "data-radix-select-viewport": "",
1068
1114
  role: "presentation",
@@ -1078,89 +1124,89 @@ const [_o, He] = ae(
1078
1124
  ...t.style
1079
1125
  },
1080
1126
  onScroll: T(t.onScroll, (a) => {
1081
- const g = a.currentTarget, { contentWrapper: p, shouldExpandOnScrollRef: x } = n;
1082
- if (x?.current && p) {
1083
- const d = Math.abs(c.current - g.scrollTop);
1084
- if (d > 0) {
1085
- const u = window.innerHeight - G * 2, m = parseFloat(p.style.minHeight), b = parseFloat(p.style.height), C = Math.max(m, b);
1086
- if (C < u) {
1087
- const v = C + d, h = Math.min(u, v), w = v - h;
1088
- p.style.height = `${h}px`, p.style.bottom === "0px" && (g.scrollTop = w > 0 ? w : 0, p.style.justifyContent = "flex-end");
1127
+ const m = a.currentTarget, { contentWrapper: u, shouldExpandOnScrollRef: x } = n;
1128
+ if (x?.current && u) {
1129
+ const p = Math.abs(s.current - m.scrollTop);
1130
+ if (p > 0) {
1131
+ const d = window.innerHeight - j * 2, h = parseFloat(u.style.minHeight), v = parseFloat(u.style.height), C = Math.max(h, v);
1132
+ if (C < d) {
1133
+ const b = C + p, g = Math.min(d, b), I = b - g;
1134
+ u.style.height = `${g}px`, u.style.bottom === "0px" && (m.scrollTop = I > 0 ? I : 0, u.style.justifyContent = "flex-end");
1089
1135
  }
1090
1136
  }
1091
1137
  }
1092
- c.current = g.scrollTop;
1138
+ s.current = m.scrollTop;
1093
1139
  })
1094
1140
  }
1095
1141
  ) })
1096
1142
  ] });
1097
1143
  }
1098
1144
  );
1099
- $e.displayName = Ve;
1100
- const bt = "SelectGroup", [Mo, Oo] = ae(bt), Ue = l.forwardRef(
1101
- (r, s) => {
1102
- const { __scopeSelect: e, ...t } = r, o = ne();
1103
- return /* @__PURE__ */ f(Mo, { scope: e, id: o, children: /* @__PURE__ */ f(_.div, { role: "group", "aria-labelledby": o, ...t, ref: s }) });
1145
+ Ke.displayName = Pe;
1146
+ const It = "SelectGroup", [Do, ko] = ue(It), We = l.forwardRef(
1147
+ (r, c) => {
1148
+ const { __scopeSelect: e, ...t } = r, o = re();
1149
+ return /* @__PURE__ */ f(Do, { scope: e, id: o, children: /* @__PURE__ */ f(N.div, { role: "group", "aria-labelledby": o, ...t, ref: c }) });
1104
1150
  }
1105
1151
  );
1106
- Ue.displayName = bt;
1107
- const St = "SelectLabel", Ke = l.forwardRef(
1108
- (r, s) => {
1109
- const { __scopeSelect: e, ...t } = r, o = Oo(St, e);
1110
- return /* @__PURE__ */ f(_.div, { id: o.id, ...t, ref: s });
1152
+ We.displayName = It;
1153
+ const wt = "SelectLabel", ze = l.forwardRef(
1154
+ (r, c) => {
1155
+ const { __scopeSelect: e, ...t } = r, o = ko(wt, e);
1156
+ return /* @__PURE__ */ f(N.div, { id: o.id, ...t, ref: c });
1111
1157
  }
1112
1158
  );
1113
- Ke.displayName = St;
1114
- const ge = "SelectItem", [Do, wt] = ae(ge), We = l.forwardRef(
1115
- (r, s) => {
1116
- const { __scopeSelect: e, value: t, disabled: o = !1, textValue: n, ...i } = r, c = Y(ge, e), a = J(ge, e), g = typeof t == "string" ? Array.isArray(c.value) ? c.value.includes(t) : c.value === t : t.every((h) => c.value?.includes(h)), p = Array.isArray(c.value) && Array.isArray(t) && t.some((h) => c.value?.includes(h)), [x, d] = l.useState(n ?? ""), [u, m] = l.useState(!1), b = O(
1117
- s,
1118
- (h) => a.itemRefCallback?.(h, t, o)
1119
- ), C = ne(), v = () => {
1159
+ ze.displayName = wt;
1160
+ const xe = "SelectItem", [Fo, yt] = ue(xe), Ge = l.forwardRef(
1161
+ (r, c) => {
1162
+ const { __scopeSelect: e, value: t, disabled: o = !1, textValue: n, ...i } = r, s = Y(xe, e), a = J(xe, e), m = typeof t == "string" ? Array.isArray(s.value) ? s.value.includes(t) : s.value === t : t.every((g) => s.value?.includes(g)), u = Array.isArray(s.value) && Array.isArray(t) && t.some((g) => s.value?.includes(g)), [x, p] = l.useState(n ?? ""), [d, h] = l.useState(!1), v = M(
1163
+ c,
1164
+ (g) => a.itemRefCallback?.(g, t, o)
1165
+ ), C = re(), b = () => {
1120
1166
  if (!o) {
1121
- let h = c.multi && typeof t == "string" ? [t] : t;
1122
- p && !g ? c.onValueChange(h) : Array.isArray(c.value) && (h = Pt(t, c.value)), c.onValueChange(h), c.multi || c.onOpenChange(!1);
1167
+ let g = s.multi && typeof t == "string" ? [t] : t;
1168
+ u && !m ? s.onValueChange(g) : Array.isArray(s.value) && (g = Rt(t, s.value)), s.onValueChange(g), s.multi || s.onOpenChange(!1);
1123
1169
  }
1124
1170
  };
1125
- if (!c.multi && Array.isArray(t))
1171
+ if (!s.multi && Array.isArray(t))
1126
1172
  throw new Error("You can only pass an array of values in multi selects");
1127
1173
  return /* @__PURE__ */ f(
1128
- Do,
1174
+ Fo,
1129
1175
  {
1130
1176
  scope: e,
1131
1177
  value: t,
1132
1178
  disabled: o,
1133
1179
  textId: C,
1134
- isSelected: g,
1135
- isIntermediate: p,
1136
- onItemTextChange: l.useCallback((h) => {
1137
- d((w) => w || (h?.textContent ?? "").trim());
1180
+ isSelected: m,
1181
+ isIntermediate: u,
1182
+ onItemTextChange: l.useCallback((g) => {
1183
+ p((I) => I || (g?.textContent ?? "").trim());
1138
1184
  }, []),
1139
- children: /* @__PURE__ */ f(xe.ItemSlot, { scope: e, value: t, disabled: o, textValue: x, children: /* @__PURE__ */ f(
1140
- _.div,
1185
+ children: /* @__PURE__ */ f(ve.ItemSlot, { scope: e, value: t, disabled: o, textValue: x, children: /* @__PURE__ */ f(
1186
+ N.div,
1141
1187
  {
1142
1188
  role: "option",
1143
1189
  "aria-labelledby": C,
1144
- "data-highlighted": u ? "" : void 0,
1145
- "aria-selected": c.multi ? void 0 : g && u,
1146
- "aria-checked": c.multi ? g : void 0,
1147
- "data-state": g ? "checked" : "unchecked",
1190
+ "data-highlighted": d ? "" : void 0,
1191
+ "aria-selected": s.multi ? void 0 : m && d,
1192
+ "aria-checked": s.multi ? m : void 0,
1193
+ "data-state": m ? "checked" : "unchecked",
1148
1194
  "aria-disabled": o || void 0,
1149
1195
  "data-disabled": o ? "" : void 0,
1150
1196
  tabIndex: o ? void 0 : -1,
1151
1197
  ...i,
1152
- ref: b,
1153
- onFocus: T(i.onFocus, () => m(!0)),
1154
- onBlur: T(i.onBlur, () => m(!1)),
1155
- onPointerUp: T(i.onPointerUp, v),
1156
- onPointerMove: T(i.onPointerMove, (h) => {
1157
- o ? a.onItemLeave?.() : h.currentTarget.focus({ preventScroll: !0 });
1198
+ ref: v,
1199
+ onFocus: T(i.onFocus, () => h(!0)),
1200
+ onBlur: T(i.onBlur, () => h(!1)),
1201
+ onPointerUp: T(i.onPointerUp, b),
1202
+ onPointerMove: T(i.onPointerMove, (g) => {
1203
+ o ? a.onItemLeave?.() : g.currentTarget.focus({ preventScroll: !0 });
1158
1204
  }),
1159
- onPointerLeave: T(i.onPointerLeave, (h) => {
1160
- h.currentTarget === document.activeElement && a.onItemLeave?.();
1205
+ onPointerLeave: T(i.onPointerLeave, (g) => {
1206
+ g.currentTarget === document.activeElement && a.onItemLeave?.();
1161
1207
  }),
1162
- onKeyDown: T(i.onKeyDown, (h) => {
1163
- a.searchRef?.current !== "" && h.key === " " || (So.includes(h.key) && v(), h.key === " " && h.preventDefault());
1208
+ onKeyDown: T(i.onKeyDown, (g) => {
1209
+ a.searchRef?.current !== "" && g.key === " " || (wo.includes(g.key) && b(), g.key === " " && g.preventDefault());
1164
1210
  })
1165
1211
  }
1166
1212
  ) })
@@ -1168,106 +1214,106 @@ const ge = "SelectItem", [Do, wt] = ae(ge), We = l.forwardRef(
1168
1214
  );
1169
1215
  }
1170
1216
  );
1171
- We.displayName = ge;
1172
- const fe = "SelectItemText", ze = l.forwardRef(
1173
- (r, s) => {
1174
- const { __scopeSelect: e, className: t, style: o, ...n } = r, i = Y(fe, e), c = J(fe, e), a = wt(fe, e), g = Vo(fe, e), [p, x] = l.useState(null), d = O(
1175
- s,
1176
- (v) => x(v),
1217
+ Ge.displayName = xe;
1218
+ const pe = "SelectItemText", je = l.forwardRef(
1219
+ (r, c) => {
1220
+ const { __scopeSelect: e, className: t, style: o, ...n } = r, i = Y(pe, e), s = J(pe, e), a = yt(pe, e), m = Eo(pe, e), [u, x] = l.useState(null), p = M(
1221
+ c,
1222
+ (b) => x(b),
1177
1223
  a.onItemTextChange,
1178
- (v) => c.itemTextRefCallback?.(v, a.value, a.disabled)
1179
- ), u = p?.textContent, m = l.useMemo(
1224
+ (b) => s.itemTextRefCallback?.(b, a.value, a.disabled)
1225
+ ), d = u?.textContent, h = l.useMemo(
1180
1226
  () => /* @__PURE__ */ f(
1181
1227
  "option",
1182
1228
  {
1183
1229
  value: a.value,
1184
1230
  disabled: a.disabled,
1185
- children: u
1231
+ children: d
1186
1232
  },
1187
1233
  Array.isArray(a.value) ? a.value.join(";") : a.value
1188
1234
  ),
1189
- [a.disabled, a.value, u]
1190
- ), { onNativeOptionAdd: b, onNativeOptionRemove: C } = g;
1191
- return B(() => (b(m), () => C(m)), [b, C, m]), /* @__PURE__ */ Ne(Ae, { children: [
1192
- /* @__PURE__ */ f(_.span, { id: a.textId, ...n, ref: d }),
1193
- a.isSelected && i.valueNode && !i.valueNodeHasChildren ? _e.createPortal(n.children, i.valueNode) : null
1235
+ [a.disabled, a.value, d]
1236
+ ), { onNativeOptionAdd: v, onNativeOptionRemove: C } = m;
1237
+ return L(() => (v(h), () => C(h)), [v, C, h]), /* @__PURE__ */ Ae(_e, { children: [
1238
+ /* @__PURE__ */ f(N.span, { id: a.textId, ...n, ref: p }),
1239
+ a.isSelected && i.valueNode && !i.valueNodeHasChildren ? Ce.createPortal(n.children, i.valueNode) : null
1194
1240
  ] });
1195
1241
  }
1196
1242
  );
1197
- ze.displayName = fe;
1198
- const It = "SelectItemIndicator", Ge = l.forwardRef(
1199
- (r, s) => {
1200
- const { __scopeSelect: e, children: t, ...o } = r, n = wt(It, e);
1201
- return typeof t == "function" ? /* @__PURE__ */ f(_.span, { "aria-hidden": !0, ...o, ref: s, children: t({
1243
+ je.displayName = pe;
1244
+ const Tt = "SelectItemIndicator", Ye = l.forwardRef(
1245
+ (r, c) => {
1246
+ const { __scopeSelect: e, children: t, ...o } = r, n = yt(Tt, e);
1247
+ return typeof t == "function" ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: c, children: t({
1202
1248
  isSelected: n.isSelected,
1203
1249
  isIntermediate: n.isIntermediate
1204
- }) }) : n.isSelected ? /* @__PURE__ */ f(_.span, { "aria-hidden": !0, ...o, ref: s, children: t }) : null;
1250
+ }) }) : n.isSelected ? /* @__PURE__ */ f(N.span, { "aria-hidden": !0, ...o, ref: c, children: t }) : null;
1205
1251
  }
1206
1252
  );
1207
- Ge.displayName = It;
1208
- const Pe = "SelectScrollUpButton", je = l.forwardRef(
1209
- (r, s) => {
1210
- const e = J(Pe, r.__scopeSelect), t = He(Pe, r.__scopeSelect), [o, n] = l.useState(!1), i = O(s, t.onScrollButtonChange);
1211
- return B(() => {
1253
+ Ye.displayName = Tt;
1254
+ const Ee = "SelectScrollUpButton", qe = l.forwardRef(
1255
+ (r, c) => {
1256
+ const e = J(Ee, r.__scopeSelect), t = Ue(Ee, r.__scopeSelect), [o, n] = l.useState(!1), i = M(c, t.onScrollButtonChange);
1257
+ return L(() => {
1212
1258
  if (e.viewport && e.isPositioned) {
1213
- const c = e.viewport, a = () => {
1214
- const g = c.scrollTop > 0;
1215
- n(g);
1259
+ const s = e.viewport, a = () => {
1260
+ const m = s.scrollTop > 0;
1261
+ n(m);
1216
1262
  };
1217
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
1263
+ return a(), s.addEventListener("scroll", a), () => s.removeEventListener("scroll", a);
1218
1264
  }
1219
1265
  }, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ f(
1220
- yt,
1266
+ Vt,
1221
1267
  {
1222
1268
  ...r,
1223
1269
  ref: i,
1224
1270
  onAutoScroll: () => {
1225
- const { viewport: c, selectedItem: a } = e;
1226
- c && a && (c.scrollTop -= a.offsetHeight);
1271
+ const { viewport: s, selectedItem: a } = e;
1272
+ s && a && (s.scrollTop -= a.offsetHeight);
1227
1273
  }
1228
1274
  }
1229
1275
  ) : null;
1230
1276
  }
1231
1277
  );
1232
- je.displayName = Pe;
1233
- const Ee = "SelectScrollDownButton", Ye = l.forwardRef(
1234
- (r, s) => {
1235
- const e = J(Ee, r.__scopeSelect), t = He(Ee, r.__scopeSelect), [o, n] = l.useState(!1), i = O(s, t.onScrollButtonChange);
1236
- return B(() => {
1278
+ qe.displayName = Ee;
1279
+ const Re = "SelectScrollDownButton", Xe = l.forwardRef(
1280
+ (r, c) => {
1281
+ const e = J(Re, r.__scopeSelect), t = Ue(Re, r.__scopeSelect), [o, n] = l.useState(!1), i = M(c, t.onScrollButtonChange);
1282
+ return L(() => {
1237
1283
  if (e.viewport && e.isPositioned) {
1238
- const c = e.viewport, a = () => {
1239
- const g = c.scrollHeight - c.clientHeight, p = Math.ceil(c.scrollTop) < g;
1240
- n(p);
1284
+ const s = e.viewport, a = () => {
1285
+ const m = s.scrollHeight - s.clientHeight, u = Math.ceil(s.scrollTop) < m;
1286
+ n(u);
1241
1287
  };
1242
- return a(), c.addEventListener("scroll", a), () => c.removeEventListener("scroll", a);
1288
+ return a(), s.addEventListener("scroll", a), () => s.removeEventListener("scroll", a);
1243
1289
  }
1244
1290
  }, [e.viewport, e.isPositioned]), o ? /* @__PURE__ */ f(
1245
- yt,
1291
+ Vt,
1246
1292
  {
1247
1293
  ...r,
1248
1294
  ref: i,
1249
1295
  onAutoScroll: () => {
1250
- const { viewport: c, selectedItem: a } = e;
1251
- c && a && (c.scrollTop += a.offsetHeight);
1296
+ const { viewport: s, selectedItem: a } = e;
1297
+ s && a && (s.scrollTop += a.offsetHeight);
1252
1298
  }
1253
1299
  }
1254
1300
  ) : null;
1255
1301
  }
1256
1302
  );
1257
- Ye.displayName = Ee;
1258
- const yt = l.forwardRef(
1259
- (r, s) => {
1260
- const { __scopeSelect: e, onAutoScroll: t, ...o } = r, n = J("SelectScrollButton", e), i = l.useRef(null), c = he(e), a = l.useCallback(() => {
1303
+ Xe.displayName = Re;
1304
+ const Vt = l.forwardRef(
1305
+ (r, c) => {
1306
+ const { __scopeSelect: e, onAutoScroll: t, ...o } = r, n = J("SelectScrollButton", e), i = l.useRef(null), s = ge(e), a = l.useCallback(() => {
1261
1307
  i.current !== null && (window.clearInterval(i.current), i.current = null);
1262
1308
  }, []);
1263
- return l.useEffect(() => () => a(), [a]), B(() => {
1264
- c().find((p) => p.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1265
- }, [c]), /* @__PURE__ */ f(
1266
- _.div,
1309
+ return l.useEffect(() => () => a(), [a]), L(() => {
1310
+ s().find((u) => u.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1311
+ }, [s]), /* @__PURE__ */ f(
1312
+ N.div,
1267
1313
  {
1268
1314
  "aria-hidden": !0,
1269
1315
  ...o,
1270
- ref: s,
1316
+ ref: c,
1271
1317
  style: { flexShrink: 0, ...o.style },
1272
1318
  onPointerMove: T(o.onPointerMove, () => {
1273
1319
  n.onItemLeave?.(), i.current === null && (i.current = window.setInterval(t, 50));
@@ -1278,112 +1324,112 @@ const yt = l.forwardRef(
1278
1324
  }
1279
1325
  );
1280
1326
  }
1281
- ), ko = "SelectSeparator", qe = l.forwardRef(
1282
- (r, s) => {
1327
+ ), Lo = "SelectSeparator", Ze = l.forwardRef(
1328
+ (r, c) => {
1283
1329
  const { __scopeSelect: e, ...t } = r;
1284
- return /* @__PURE__ */ f(_.div, { "aria-hidden": !0, ...t, ref: s });
1330
+ return /* @__PURE__ */ f(N.div, { "aria-hidden": !0, ...t, ref: c });
1285
1331
  }
1286
1332
  );
1287
- qe.displayName = ko;
1288
- const Re = "SelectArrow", Xe = l.forwardRef(
1289
- (r, s) => {
1290
- const { __scopeSelect: e, ...t } = r, o = ve(e), n = Y(Re, e), i = J(Re, e);
1291
- return n.open && i.position === "popper" ? /* @__PURE__ */ f(le.Arrow, { ...o, ...t, ref: s }) : null;
1333
+ Ze.displayName = Lo;
1334
+ const Ne = "SelectArrow", Je = l.forwardRef(
1335
+ (r, c) => {
1336
+ const { __scopeSelect: e, ...t } = r, o = be(e), n = Y(Ne, e), i = J(Ne, e);
1337
+ return n.open && i.position === "popper" ? /* @__PURE__ */ f(le.Arrow, { ...o, ...t, ref: c }) : null;
1292
1338
  }
1293
1339
  );
1294
- Xe.displayName = Re;
1295
- const Fo = "BubbleSelect", Lo = l.forwardRef(
1296
- (r, s) => {
1297
- const { value: e, ...t } = r, o = l.useRef(null), n = O(s, o), i = Nt(e), c = Y(Fo, void 0);
1340
+ Je.displayName = Ne;
1341
+ const Bo = "BubbleSelect", Ho = l.forwardRef(
1342
+ (r, c) => {
1343
+ const { value: e, ...t } = r, o = l.useRef(null), n = M(c, o), i = _t(e), s = Y(Bo, void 0);
1298
1344
  l.useEffect(() => {
1299
- const g = o.current, p = window.HTMLSelectElement.prototype, d = Object.getOwnPropertyDescriptor(p, "value").set;
1300
- if (i !== e && d) {
1301
- const u = new Event("change", { bubbles: !0 });
1302
- d.call(g, e), g.dispatchEvent(u);
1345
+ const m = o.current, u = window.HTMLSelectElement.prototype, p = Object.getOwnPropertyDescriptor(u, "value").set;
1346
+ if (i !== e && p) {
1347
+ const d = new Event("change", { bubbles: !0 });
1348
+ p.call(m, e), m.dispatchEvent(d);
1303
1349
  }
1304
1350
  }, [i, e]);
1305
1351
  let a = e;
1306
- return c.multi && !Array.isArray(e) && (a = []), /* @__PURE__ */ f(At, { asChild: !0, children: /* @__PURE__ */ f(
1352
+ return s.multi && !Array.isArray(e) && (a = []), /* @__PURE__ */ f(Mt, { asChild: !0, children: /* @__PURE__ */ f(
1307
1353
  "select",
1308
1354
  {
1309
1355
  ...t,
1310
- multiple: c.multi ? !0 : void 0,
1356
+ multiple: s.multi ? !0 : void 0,
1311
1357
  ref: n,
1312
1358
  defaultValue: a
1313
1359
  }
1314
1360
  ) });
1315
1361
  }
1316
1362
  );
1317
- Lo.displayName = "BubbleSelect";
1318
- function Tt(r) {
1319
- const s = _t(r), e = l.useRef(""), t = l.useRef(0), o = l.useCallback(
1363
+ Ho.displayName = "BubbleSelect";
1364
+ function Pt(r) {
1365
+ const c = Ot(r), e = l.useRef(""), t = l.useRef(0), o = l.useCallback(
1320
1366
  (i) => {
1321
- const c = e.current + i;
1322
- s(c), function a(g) {
1323
- e.current = g, window.clearTimeout(t.current), g !== "" && (t.current = window.setTimeout(() => a(""), 1e3));
1324
- }(c);
1367
+ const s = e.current + i;
1368
+ c(s), function a(m) {
1369
+ e.current = m, window.clearTimeout(t.current), m !== "" && (t.current = window.setTimeout(() => a(""), 1e3));
1370
+ }(s);
1325
1371
  },
1326
- [s]
1372
+ [c]
1327
1373
  ), n = l.useCallback(() => {
1328
1374
  e.current = "", window.clearTimeout(t.current);
1329
1375
  }, []);
1330
1376
  return l.useEffect(() => () => window.clearTimeout(t.current), []), [e, o, n];
1331
1377
  }
1332
- function Vt(r, s, e) {
1333
- const o = s.length > 1 && Array.from(s).every((g) => g === s[0]) ? s[0] : s, n = e ? r.indexOf(e) : -1;
1334
- let i = Bo(r, Math.max(n, 0));
1335
- o.length === 1 && (i = i.filter((g) => g !== e));
1336
- const a = i.find((g) => g.textValue.toLowerCase().startsWith(o.toLowerCase()));
1378
+ function Et(r, c, e) {
1379
+ const o = c.length > 1 && Array.from(c).every((m) => m === c[0]) ? c[0] : c, n = e ? r.indexOf(e) : -1;
1380
+ let i = $o(r, Math.max(n, 0));
1381
+ o.length === 1 && (i = i.filter((m) => m !== e));
1382
+ const a = i.find((m) => m.textValue.toLowerCase().startsWith(o.toLowerCase()));
1337
1383
  return a !== e ? a : void 0;
1338
1384
  }
1339
- function Bo(r, s) {
1340
- return r.map((e, t) => r[(s + t) % r.length]);
1385
+ function $o(r, c) {
1386
+ return r.map((e, t) => r[(c + t) % r.length]);
1341
1387
  }
1342
- const Pt = (r, s = []) => {
1388
+ const Rt = (r, c = []) => {
1343
1389
  if (Array.isArray(r))
1344
- return r.reduce((t, o) => Pt(o, t), s);
1345
- const e = s.indexOf(r);
1346
- return e === -1 ? [...s, r] : [...s.slice(0, e), ...s.slice(e + 1)];
1347
- }, Ho = Oe, $o = De, Uo = ke, Ko = Fe, Wo = Le, zo = Be, Go = $e, jo = Ue, Yo = Ke, qo = We, Xo = ze, Zo = Ge, Jo = je, Qo = Ye, en = qe, tn = Xe, Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1390
+ return r.reduce((t, o) => Rt(o, t), c);
1391
+ const e = c.indexOf(r);
1392
+ return e === -1 ? [...c, r] : [...c.slice(0, e), ...c.slice(e + 1)];
1393
+ }, Uo = ke, Ko = Fe, Wo = Le, zo = Be, Go = He, jo = $e, Yo = Ke, qo = We, Xo = ze, Zo = Ge, Jo = je, Qo = Ye, en = qe, tn = Xe, on = Ze, nn = Je, En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1348
1394
  __proto__: null,
1349
- Arrow: tn,
1350
- Content: zo,
1351
- Group: jo,
1352
- Icon: Ko,
1353
- Item: qo,
1354
- ItemIndicator: Zo,
1355
- ItemText: Xo,
1356
- Label: Yo,
1357
- Portal: Wo,
1358
- Root: Ho,
1359
- ScrollDownButton: Qo,
1360
- ScrollUpButton: Jo,
1361
- Select: Oe,
1362
- SelectArrow: Xe,
1363
- SelectContent: Be,
1364
- SelectGroup: Ue,
1365
- SelectIcon: Fe,
1366
- SelectItem: We,
1367
- SelectItemIndicator: Ge,
1368
- SelectItemText: ze,
1369
- SelectLabel: Ke,
1370
- SelectPortal: Le,
1371
- SelectScrollDownButton: Ye,
1372
- SelectScrollUpButton: je,
1373
- SelectSeparator: qe,
1374
- SelectTrigger: De,
1375
- SelectValue: ke,
1376
- SelectViewport: $e,
1377
- Separator: en,
1378
- Trigger: $o,
1379
- Value: Uo,
1380
- Viewport: Go,
1381
- createSelectScope: Io
1395
+ Arrow: nn,
1396
+ Content: jo,
1397
+ Group: qo,
1398
+ Icon: zo,
1399
+ Item: Zo,
1400
+ ItemIndicator: Qo,
1401
+ ItemText: Jo,
1402
+ Label: Xo,
1403
+ Portal: Go,
1404
+ Root: Uo,
1405
+ ScrollDownButton: tn,
1406
+ ScrollUpButton: en,
1407
+ Select: ke,
1408
+ SelectArrow: Je,
1409
+ SelectContent: $e,
1410
+ SelectGroup: We,
1411
+ SelectIcon: Be,
1412
+ SelectItem: Ge,
1413
+ SelectItemIndicator: Ye,
1414
+ SelectItemText: je,
1415
+ SelectLabel: ze,
1416
+ SelectPortal: He,
1417
+ SelectScrollDownButton: Xe,
1418
+ SelectScrollUpButton: qe,
1419
+ SelectSeparator: Ze,
1420
+ SelectTrigger: Fe,
1421
+ SelectValue: Le,
1422
+ SelectViewport: Ke,
1423
+ Separator: on,
1424
+ Trigger: Ko,
1425
+ Value: Wo,
1426
+ Viewport: Yo,
1427
+ createSelectScope: To
1382
1428
  }, Symbol.toStringTag, { value: "Module" }));
1383
1429
  export {
1384
- Tn as Combobox,
1385
- Vn as Select,
1386
- Rn as composeEventHandlers,
1387
- Mt as createCollection,
1388
- An as useCallbackRef
1430
+ Pn as Combobox,
1431
+ En as Select,
1432
+ An as composeEventHandlers,
1433
+ Dt as createCollection,
1434
+ Mn as useCallbackRef
1389
1435
  };