@rpcbase/ui 0.219.0 → 0.220.0

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