@cfx-dev/ui-components 4.2.24 → 4.3.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 (176) hide show
  1. package/dist/Combination-CSgOhzm-.js +2198 -0
  2. package/dist/Combination-N-vN9BB-.js +823 -0
  3. package/dist/Table.module-DHI1mXN2.js +17 -0
  4. package/dist/assets/all_css.css +1 -0
  5. package/dist/assets/css/Checkbox.css +1 -1
  6. package/dist/assets/css/DataTable.css +1 -0
  7. package/dist/assets/css/Table.css +1 -1
  8. package/dist/assets/general/global.css +1 -1
  9. package/dist/cfxIcons-B9nzO6TW.js +98 -0
  10. package/dist/components/Accordion/Accordion.js +25 -26
  11. package/dist/components/Accordion/AccordionShowcase.js +1 -1
  12. package/dist/components/Avatar/Avatar.d.ts +2 -1
  13. package/dist/components/Avatar/Avatar.js +21 -20
  14. package/dist/components/Avatar/AvatarShowcase.js +1 -1
  15. package/dist/components/Badge/Badge.d.ts +2 -1
  16. package/dist/components/Badge/Badge.js +29 -29
  17. package/dist/components/Badge/BadgeShowcase.js +1 -1
  18. package/dist/components/BurgerMenu/BurgerMenu.js +2 -2
  19. package/dist/components/BurgerMenu/BurgerMenuButton.js +1 -1
  20. package/dist/components/BurgerMenu/BurgerMenuShowcase.js +1 -1
  21. package/dist/components/Button/Button.d.ts +5 -2
  22. package/dist/components/Button/Button.js +83 -81
  23. package/dist/components/Button/ButtonShowcase.js +2 -2
  24. package/dist/components/Button/LinkButton.d.ts +1 -1
  25. package/dist/components/Button/LinkButton.js +18 -17
  26. package/dist/components/Button/index.d.ts +1 -1
  27. package/dist/components/Button/index.js +7 -7
  28. package/dist/components/Checkbox/Checkbox.d.ts +1 -0
  29. package/dist/components/Checkbox/Checkbox.js +154 -242
  30. package/dist/components/ClipboardButton/ClipboardButton.js +7 -7
  31. package/dist/components/ControlBox/ControlBox.d.ts +3 -2
  32. package/dist/components/ControlBox/ControlBox.js +13 -10
  33. package/dist/components/CountryFlag/CountryFlag.d.ts +3 -2
  34. package/dist/components/CountryFlag/CountryFlag.js +14 -11
  35. package/dist/components/DataTable/DataTable.d.ts +40 -0
  36. package/dist/components/DataTable/DataTable.js +163 -0
  37. package/dist/components/DataTable/DataTableShowcase.d.ts +5 -0
  38. package/dist/components/DataTable/DataTableShowcase.js +60 -0
  39. package/dist/components/DataTable/index.d.ts +2 -0
  40. package/dist/components/DataTable/index.js +6 -0
  41. package/dist/components/Decorate/Decorate.d.ts +3 -2
  42. package/dist/components/Decorate/Decorate.js +19 -15
  43. package/dist/components/Dot/Dot.d.ts +2 -1
  44. package/dist/components/Dot/Dot.js +15 -13
  45. package/dist/components/DropdownSelect/DropdownSelect.d.ts +2 -1
  46. package/dist/components/DropdownSelect/DropdownSelect.js +665 -1836
  47. package/dist/components/DropdownSelect/DropdownSelectShowcase.js +1 -1
  48. package/dist/components/Flyout/Flyout.d.ts +2 -1
  49. package/dist/components/Flyout/Flyout.js +22 -20
  50. package/dist/components/Icon/Icon.d.ts +2 -1
  51. package/dist/components/Icon/Icon.js +19 -17
  52. package/dist/components/IconBig/IconBig.d.ts +2 -1
  53. package/dist/components/IconBig/IconBig.js +16 -14
  54. package/dist/components/Icons/IconsShowcase.js +1 -1
  55. package/dist/components/Icons/cfx-icons/Radio.d.ts +5 -0
  56. package/dist/components/Icons/cfx-icons/Radio.js +36 -0
  57. package/dist/components/Icons/cfx-icons/Square.js +15 -9
  58. package/dist/components/Icons/cfxIcons.d.ts +1 -0
  59. package/dist/components/Icons/cfxIcons.js +62 -60
  60. package/dist/components/Icons/index.js +1 -1
  61. package/dist/components/Indicator/Indicator.js +9 -10
  62. package/dist/components/InfoPanel/InfoPanelShowcase.js +1 -1
  63. package/dist/components/Input/Input.d.ts +4 -1
  64. package/dist/components/Input/Input.js +101 -88
  65. package/dist/components/Input/InputShowcase.js +1 -1
  66. package/dist/components/Input/RichInput.d.ts +2 -1
  67. package/dist/components/Input/RichInput.js +37 -34
  68. package/dist/components/InputDropzone/InputDropzone.d.ts +1 -1
  69. package/dist/components/InputDropzone/InputDropzone.js +1723 -625
  70. package/dist/components/Interactive/Interactive.d.ts +2 -1
  71. package/dist/components/Interactive/Interactive.js +14 -12
  72. package/dist/components/Island/Island.d.ts +2 -1
  73. package/dist/components/Island/Island.js +24 -24
  74. package/dist/components/Layout/Box/Box.d.ts +8 -2
  75. package/dist/components/Layout/Box/Box.js +53 -51
  76. package/dist/components/Layout/Box/Box.types.d.ts +22 -0
  77. package/dist/components/Layout/Box/Box.types.js +4 -0
  78. package/dist/components/Layout/Box/index.d.ts +1 -1
  79. package/dist/components/Layout/Box/index.js +3 -3
  80. package/dist/components/Layout/Center/Center.d.ts +2 -1
  81. package/dist/components/Layout/Center/Center.js +19 -18
  82. package/dist/components/Layout/Flex/Flex.d.ts +6 -10
  83. package/dist/components/Layout/Flex/Flex.js +53 -64
  84. package/dist/components/Layout/Flex/FlexRestricter.d.ts +2 -1
  85. package/dist/components/Layout/Flex/FlexRestricter.js +13 -12
  86. package/dist/components/Layout/Flex/FlexShowcase.js +1 -1
  87. package/dist/components/Layout/Flex/index.d.ts +2 -2
  88. package/dist/components/Layout/Flex/index.js +8 -8
  89. package/dist/components/Layout/Page/Page.js +11 -12
  90. package/dist/components/Layout/Scrollable/Rail.d.ts +1 -1
  91. package/dist/components/Layout/Scrollable/Scrollable.d.ts +2 -1
  92. package/dist/components/Layout/Scrollable/Scrollable.js +40 -38
  93. package/dist/components/Layout/Scrollable/ScrollableShowcase.js +1 -1
  94. package/dist/components/Layout/Scrollable/VirtualScrollable.js +98 -98
  95. package/dist/components/Link/LinkShowcase.js +1 -1
  96. package/dist/components/Loaf/Loaf.d.ts +2 -1
  97. package/dist/components/Loaf/Loaf.js +17 -16
  98. package/dist/components/Logos/LogosShowcase.js +1 -1
  99. package/dist/components/Modal/Modal.js +16 -17
  100. package/dist/components/Modal/ModalShowcase.js +14 -11
  101. package/dist/components/NavList/NavList.d.ts +2 -1
  102. package/dist/components/NavList/NavList.js +19 -18
  103. package/dist/components/OnScreenSensor.js +1 -1
  104. package/dist/components/Overlay/Overlay.d.ts +4 -2
  105. package/dist/components/Overlay/Overlay.js +31 -23
  106. package/dist/components/Popover/Popover.d.ts +3 -2
  107. package/dist/components/Popover/Popover.js +31 -30
  108. package/dist/components/Popover/PopoverShowcase.js +4 -4
  109. package/dist/components/PremiumBadge/PremiumBadge.d.ts +2 -1
  110. package/dist/components/PremiumBadge/PremiumBadge.js +12 -11
  111. package/dist/components/Select/Select.d.ts +1 -1
  112. package/dist/components/Select/Select.js +666 -1617
  113. package/dist/components/Select/SelectShowcase.js +1 -1
  114. package/dist/components/Shroud/Shroud.d.ts +2 -1
  115. package/dist/components/Shroud/Shroud.js +16 -14
  116. package/dist/components/Skeleton/Skeleton.d.ts +1 -1
  117. package/dist/components/Skeleton/Skeleton.js +26 -27
  118. package/dist/components/Skeleton/SkeletonShowcase.js +4 -4
  119. package/dist/components/Slider/Slider.d.ts +2 -1
  120. package/dist/components/Slider/Slider.js +326 -377
  121. package/dist/components/Slider/SliderShowcase.js +1 -1
  122. package/dist/components/Switch/Switch.js +109 -155
  123. package/dist/components/Table/TableBody.d.ts +8 -0
  124. package/dist/components/Table/TableBody.js +14 -0
  125. package/dist/components/Table/TableCell.d.ts +11 -0
  126. package/dist/components/Table/TableCell.js +54 -0
  127. package/dist/components/Table/TableCellCheckbox.d.ts +11 -0
  128. package/dist/components/Table/TableCellCheckbox.js +20 -0
  129. package/dist/components/Table/TableHeader.d.ts +9 -0
  130. package/dist/components/Table/TableHeader.js +24 -0
  131. package/dist/components/Table/TableIconButton.d.ts +6 -0
  132. package/dist/components/Table/TableIconButton.js +16 -0
  133. package/dist/components/Table/TableRoot.d.ts +8 -0
  134. package/dist/components/Table/TableRoot.js +23 -0
  135. package/dist/components/Table/TableRow.d.ts +13 -0
  136. package/dist/components/Table/TableRow.js +46 -0
  137. package/dist/components/Table/TableShowcase.js +56 -57
  138. package/dist/components/Table/index.d.ts +20 -2
  139. package/dist/components/Table/index.js +17 -5
  140. package/dist/components/Tabular/TabularShowcase.js +1 -1
  141. package/dist/components/Text/Text.d.ts +6 -3
  142. package/dist/components/Text/Text.js +67 -63
  143. package/dist/components/Text/TextShowcase.js +40 -33
  144. package/dist/components/Title/Title.d.ts +3 -1
  145. package/dist/components/Title/TitleShowcase.js +1 -1
  146. package/dist/components/ToggleGroup/ToggleGroupShowcase.js +1 -1
  147. package/dist/index-BHuChyf5.js +238 -0
  148. package/dist/index-Cl_RnsqN.js +386 -0
  149. package/dist/index-DZEAOJqB.js +53 -0
  150. package/dist/index-HDl8nGsm.js +70 -0
  151. package/dist/main.d.ts +6 -4
  152. package/dist/main.js +66 -65
  153. package/dist/{medium-BA3EQDZW.js → medium-Bq5NvyU7.js} +1 -1
  154. package/dist/styles-scss/global.scss +1 -0
  155. package/dist/tslib.es6-CtHwNPxX.js +72 -0
  156. package/dist/utils/hooks/useClipboardComponent.d.ts +1 -1
  157. package/dist/utils/hooks/useOutlet.js +1 -1
  158. package/dist/utils/hooks/usePopoverController.d.ts +1 -1
  159. package/dist/utils/links.js +1 -1
  160. package/dist/utils/mergeRefs.d.ts +1 -1
  161. package/dist/utils/mergeRefs.js +1 -1
  162. package/dist/utils/ui/ui.d.ts +1 -0
  163. package/dist/utils/ui/ui.js +45 -36
  164. package/dist/utils/ui/ui.types.d.ts +4 -0
  165. package/package.json +6 -5
  166. package/dist/Combination-Cbiw1XRb.js +0 -792
  167. package/dist/cfxIcons-BNd1WgpX.js +0 -96
  168. package/dist/components/Table/Table.d.ts +0 -42
  169. package/dist/components/Table/Table.js +0 -170
  170. package/dist/index-2hJuj4UN.js +0 -19069
  171. package/dist/index-AweK2ufS.js +0 -171
  172. package/dist/index-BlbvKsmN.js +0 -82
  173. package/dist/index-ByaXH_ih.js +0 -10
  174. package/dist/index-Bz27DCHt.js +0 -1342
  175. package/dist/index-Cf5Yu9oD.js +0 -67
  176. package/dist/tslib.es6-CBKHJX9H.js +0 -151
@@ -1,1132 +1,149 @@
1
- import { jsx as v, Fragment as Xe, jsxs as ne } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import D from "react";
4
- import { R as Cn, r as mt } from "../../index-2hJuj4UN.js";
5
- import { c as Je } from "../../index-rKs9bXHr.js";
6
- import { S as ze, P as O, d as bn } from "../../index-BlbvKsmN.js";
7
- import { u as xn } from "../../index-ByaXH_ih.js";
8
- import { c as pe, a as _n, b as X, u as et } from "../../index-Cf5Yu9oD.js";
9
- import { u as En, a as Pn, b as Rn, o as Tn, s as Nn, f as In, c as An, d as On, h as Mn, l as Ln, g as Dn, i as kn, e as Ge } from "../../index-Bz27DCHt.js";
10
- import { u as Bn } from "../../index-BZPx6jYI.js";
11
- import { f as ht, _ as ce, c as Fn } from "../../tslib.es6-CBKHJX9H.js";
12
- import { c as Wn, u as zn } from "../../medium-BA3EQDZW.js";
13
- import { Icon as Vn } from "../Icon/Icon.js";
14
- import { clsx as Me } from "../../utils/clsx.js";
15
- import { ui as Hn } from "../../utils/ui/ui.js";
16
- var vt = function(e) {
17
- var t = e.sideCar, n = ht(e, ["sideCar"]);
18
- if (!t)
19
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
20
- var r = t.read();
21
- if (!r)
22
- throw new Error("Sidecar medium not found");
23
- return s.createElement(r, ce({}, n));
24
- };
25
- vt.isSideCarExport = !0;
26
- function $n(e, t) {
27
- return e.useMedium(t), vt;
28
- }
29
- function B(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
30
- return function(a) {
31
- if (e == null || e(a), n === !1 || !a.defaultPrevented)
32
- return t == null ? void 0 : t(a);
33
- };
34
- }
35
- function gt(e, t = []) {
36
- let n = [];
37
- function r(i, c) {
38
- const o = s.createContext(c), u = n.length;
39
- n = [...n, c];
40
- function d(S) {
41
- const { scope: w, children: y, ...f } = S, l = (w == null ? void 0 : w[e][u]) || o, h = s.useMemo(() => f, Object.values(f));
42
- return /* @__PURE__ */ v(l.Provider, { value: h, children: y });
43
- }
44
- function g(S, w) {
45
- const y = (w == null ? void 0 : w[e][u]) || o, f = s.useContext(y);
46
- if (f) return f;
47
- if (c !== void 0) return c;
48
- throw new Error(`\`${S}\` must be used within \`${i}\``);
49
- }
50
- return d.displayName = i + "Provider", [d, g];
51
- }
52
- const a = () => {
53
- const i = n.map((c) => s.createContext(c));
54
- return function(o) {
55
- const u = (o == null ? void 0 : o[e]) || i;
56
- return s.useMemo(
57
- () => ({ [`__scope${e}`]: { ...o, [e]: u } }),
58
- [o, u]
59
- );
60
- };
61
- };
62
- return a.scopeName = e, [r, Un(a, ...t)];
63
- }
64
- function Un(...e) {
65
- const t = e[0];
66
- if (e.length === 1) return t;
67
- const n = () => {
68
- const r = e.map((a) => ({
69
- useScope: a(),
70
- scopeName: a.scopeName
71
- }));
72
- return function(i) {
73
- const c = r.reduce((o, { useScope: u, scopeName: d }) => {
74
- const S = u(i)[`__scope${d}`];
75
- return { ...o, ...S };
76
- }, {});
77
- return s.useMemo(() => ({ [`__scope${t.scopeName}`]: c }), [c]);
78
- };
79
- };
80
- return n.scopeName = t.scopeName, n;
81
- }
82
- function Kn(e, t) {
83
- typeof e == "function" ? e(t) : e != null && (e.current = t);
84
- }
85
- function Yn(...e) {
86
- return (t) => e.forEach((n) => Kn(n, t));
87
- }
88
- function K(...e) {
89
- return s.useCallback(Yn(...e), e);
90
- }
91
- function jn(e) {
92
- const t = e + "CollectionProvider", [n, r] = gt(t), [a, i] = n(
93
- t,
94
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
95
- ), c = (y) => {
96
- const { scope: f, children: l } = y, h = D.useRef(null), p = D.useRef(/* @__PURE__ */ new Map()).current;
97
- return /* @__PURE__ */ v(a, { scope: f, itemMap: p, collectionRef: h, children: l });
98
- };
99
- c.displayName = t;
100
- const o = e + "CollectionSlot", u = D.forwardRef(
101
- (y, f) => {
102
- const { scope: l, children: h } = y, p = i(o, l), m = K(f, p.collectionRef);
103
- return /* @__PURE__ */ v(ze, { ref: m, children: h });
104
- }
105
- );
106
- u.displayName = o;
107
- const d = e + "CollectionItemSlot", g = "data-radix-collection-item", S = D.forwardRef(
108
- (y, f) => {
109
- const { scope: l, children: h, ...p } = y, m = D.useRef(null), C = K(f, m), x = i(d, l);
110
- return D.useEffect(() => (x.itemMap.set(m, { ref: m, ...p }), () => void x.itemMap.delete(m))), /* @__PURE__ */ v(ze, { [g]: "", ref: C, children: h });
111
- }
112
- );
113
- S.displayName = d;
114
- function w(y) {
115
- const f = i(e + "CollectionConsumer", y);
116
- return D.useCallback(() => {
117
- const h = f.collectionRef.current;
118
- if (!h) return [];
119
- const p = Array.from(h.querySelectorAll(`[${g}]`));
120
- return Array.from(f.itemMap.values()).sort(
121
- (x, E) => p.indexOf(x.ref.current) - p.indexOf(E.ref.current)
122
- );
123
- }, [f.collectionRef, f.itemMap]);
124
- }
125
- return [
126
- { Provider: c, Slot: u, ItemSlot: S },
127
- w,
128
- r
129
- ];
130
- }
131
- function Le(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
132
- return function(a) {
133
- if (e == null || e(a), n === !1 || !a.defaultPrevented)
134
- return t == null ? void 0 : t(a);
135
- };
136
- }
137
- function Xn(e, t) {
138
- typeof e == "function" ? e(t) : e != null && (e.current = t);
139
- }
140
- function Gn(...e) {
141
- return (t) => e.forEach((n) => Xn(n, t));
142
- }
143
- function St(...e) {
144
- return s.useCallback(Gn(...e), e);
145
- }
146
- var Zn = "DismissableLayer", Ve = "dismissableLayer.update", qn = "dismissableLayer.pointerDownOutside", Qn = "dismissableLayer.focusOutside", tt, wt = s.createContext({
147
- layers: /* @__PURE__ */ new Set(),
148
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
149
- branches: /* @__PURE__ */ new Set()
150
- }), yt = s.forwardRef(
151
- (e, t) => {
152
- const {
153
- disableOutsidePointerEvents: n = !1,
154
- onEscapeKeyDown: r,
155
- onPointerDownOutside: a,
156
- onFocusOutside: i,
157
- onInteractOutside: c,
158
- onDismiss: o,
159
- ...u
160
- } = e, d = s.useContext(wt), [g, S] = s.useState(null), w = (g == null ? void 0 : g.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, y] = s.useState({}), f = St(t, (_) => S(_)), l = Array.from(d.layers), [h] = [...d.layersWithOutsidePointerEventsDisabled].slice(-1), p = l.indexOf(h), m = g ? l.indexOf(g) : -1, C = d.layersWithOutsidePointerEventsDisabled.size > 0, x = m >= p, E = tr((_) => {
161
- const N = _.target, k = [...d.branches].some((H) => H.contains(N));
162
- !x || k || (a == null || a(_), c == null || c(_), _.defaultPrevented || o == null || o());
163
- }, w), A = nr((_) => {
164
- const N = _.target;
165
- [...d.branches].some((H) => H.contains(N)) || (i == null || i(_), c == null || c(_), _.defaultPrevented || o == null || o());
166
- }, w);
167
- return En((_) => {
168
- m === d.layers.size - 1 && (r == null || r(_), !_.defaultPrevented && o && (_.preventDefault(), o()));
169
- }, w), s.useEffect(() => {
170
- if (g)
171
- return n && (d.layersWithOutsidePointerEventsDisabled.size === 0 && (tt = w.body.style.pointerEvents, w.body.style.pointerEvents = "none"), d.layersWithOutsidePointerEventsDisabled.add(g)), d.layers.add(g), nt(), () => {
172
- n && d.layersWithOutsidePointerEventsDisabled.size === 1 && (w.body.style.pointerEvents = tt);
173
- };
174
- }, [g, w, n, d]), s.useEffect(() => () => {
175
- g && (d.layers.delete(g), d.layersWithOutsidePointerEventsDisabled.delete(g), nt());
176
- }, [g, d]), s.useEffect(() => {
177
- const _ = () => y({});
178
- return document.addEventListener(Ve, _), () => document.removeEventListener(Ve, _);
179
- }, []), /* @__PURE__ */ v(
180
- O.div,
181
- {
182
- ...u,
183
- ref: f,
184
- style: {
185
- pointerEvents: C ? x ? "auto" : "none" : void 0,
186
- ...e.style
187
- },
188
- onFocusCapture: Le(e.onFocusCapture, A.onFocusCapture),
189
- onBlurCapture: Le(e.onBlurCapture, A.onBlurCapture),
190
- onPointerDownCapture: Le(
191
- e.onPointerDownCapture,
192
- E.onPointerDownCapture
193
- )
194
- }
195
- );
196
- }
197
- );
198
- yt.displayName = Zn;
199
- var Jn = "DismissableLayerBranch", er = s.forwardRef((e, t) => {
200
- const n = s.useContext(wt), r = s.useRef(null), a = St(t, r);
201
- return s.useEffect(() => {
202
- const i = r.current;
203
- if (i)
204
- return n.branches.add(i), () => {
205
- n.branches.delete(i);
206
- };
207
- }, [n.branches]), /* @__PURE__ */ v(O.div, { ...e, ref: a });
208
- });
209
- er.displayName = Jn;
210
- function tr(e, t = globalThis == null ? void 0 : globalThis.document) {
211
- const n = pe(e), r = s.useRef(!1), a = s.useRef(() => {
212
- });
213
- return s.useEffect(() => {
214
- const i = (o) => {
215
- if (o.target && !r.current) {
216
- let u = function() {
217
- Ct(
218
- qn,
219
- n,
220
- d,
221
- { discrete: !0 }
222
- );
223
- };
224
- const d = { originalEvent: o };
225
- o.pointerType === "touch" ? (t.removeEventListener("click", a.current), a.current = u, t.addEventListener("click", a.current, { once: !0 })) : u();
226
- } else
227
- t.removeEventListener("click", a.current);
228
- r.current = !1;
229
- }, c = window.setTimeout(() => {
230
- t.addEventListener("pointerdown", i);
231
- }, 0);
232
- return () => {
233
- window.clearTimeout(c), t.removeEventListener("pointerdown", i), t.removeEventListener("click", a.current);
234
- };
235
- }, [t, n]), {
236
- // ensures we check React component tree (not just DOM tree)
237
- onPointerDownCapture: () => r.current = !0
238
- };
239
- }
240
- function nr(e, t = globalThis == null ? void 0 : globalThis.document) {
241
- const n = pe(e), r = s.useRef(!1);
242
- return s.useEffect(() => {
243
- const a = (i) => {
244
- i.target && !r.current && Ct(Qn, n, { originalEvent: i }, {
245
- discrete: !1
246
- });
247
- };
248
- return t.addEventListener("focusin", a), () => t.removeEventListener("focusin", a);
249
- }, [t, n]), {
250
- onFocusCapture: () => r.current = !0,
251
- onBlurCapture: () => r.current = !1
252
- };
253
- }
254
- function nt() {
255
- const e = new CustomEvent(Ve);
256
- document.dispatchEvent(e);
257
- }
258
- function Ct(e, t, n, { discrete: r }) {
259
- const a = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
260
- t && a.addEventListener(e, t, { once: !0 }), r ? bn(a, i) : a.dispatchEvent(i);
261
- }
262
- var De = 0;
263
- function rr() {
264
- s.useEffect(() => {
265
- const e = document.querySelectorAll("[data-radix-focus-guard]");
266
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? rt()), document.body.insertAdjacentElement("beforeend", e[1] ?? rt()), De++, () => {
267
- De === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), De--;
268
- };
269
- }, []);
270
- }
271
- function rt() {
272
- const e = document.createElement("span");
273
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none", e;
274
- }
275
- function or(e, t) {
276
- typeof e == "function" ? e(t) : e != null && (e.current = t);
277
- }
278
- function ar(...e) {
279
- return (t) => e.forEach((n) => or(n, t));
280
- }
281
- function sr(...e) {
282
- return s.useCallback(ar(...e), e);
283
- }
284
- var ke = "focusScope.autoFocusOnMount", Be = "focusScope.autoFocusOnUnmount", ot = { bubbles: !1, cancelable: !0 }, cr = "FocusScope", bt = s.forwardRef((e, t) => {
285
- const {
286
- loop: n = !1,
287
- trapped: r = !1,
288
- onMountAutoFocus: a,
289
- onUnmountAutoFocus: i,
290
- ...c
291
- } = e, [o, u] = s.useState(null), d = pe(a), g = pe(i), S = s.useRef(null), w = sr(t, (l) => u(l)), y = s.useRef({
292
- paused: !1,
293
- pause() {
294
- this.paused = !0;
295
- },
296
- resume() {
297
- this.paused = !1;
298
- }
299
- }).current;
300
- s.useEffect(() => {
301
- if (r) {
302
- let l = function(C) {
303
- if (y.paused || !o) return;
304
- const x = C.target;
305
- o.contains(x) ? S.current = x : te(S.current, { select: !0 });
306
- }, h = function(C) {
307
- if (y.paused || !o) return;
308
- const x = C.relatedTarget;
309
- x !== null && (o.contains(x) || te(S.current, { select: !0 }));
310
- }, p = function(C) {
311
- if (document.activeElement === document.body)
312
- for (const E of C)
313
- E.removedNodes.length > 0 && te(o);
314
- };
315
- document.addEventListener("focusin", l), document.addEventListener("focusout", h);
316
- const m = new MutationObserver(p);
317
- return o && m.observe(o, { childList: !0, subtree: !0 }), () => {
318
- document.removeEventListener("focusin", l), document.removeEventListener("focusout", h), m.disconnect();
319
- };
320
- }
321
- }, [r, o, y.paused]), s.useEffect(() => {
322
- if (o) {
323
- st.add(y);
324
- const l = document.activeElement;
325
- if (!o.contains(l)) {
326
- const p = new CustomEvent(ke, ot);
327
- o.addEventListener(ke, d), o.dispatchEvent(p), p.defaultPrevented || (ir(pr(xt(o)), { select: !0 }), document.activeElement === l && te(o));
328
- }
329
- return () => {
330
- o.removeEventListener(ke, d), setTimeout(() => {
331
- const p = new CustomEvent(Be, ot);
332
- o.addEventListener(Be, g), o.dispatchEvent(p), p.defaultPrevented || te(l ?? document.body, { select: !0 }), o.removeEventListener(Be, g), st.remove(y);
333
- }, 0);
334
- };
335
- }
336
- }, [o, d, g, y]);
337
- const f = s.useCallback(
338
- (l) => {
339
- if (!n && !r || y.paused) return;
340
- const h = l.key === "Tab" && !l.altKey && !l.ctrlKey && !l.metaKey, p = document.activeElement;
341
- if (h && p) {
342
- const m = l.currentTarget, [C, x] = lr(m);
343
- C && x ? !l.shiftKey && p === x ? (l.preventDefault(), n && te(C, { select: !0 })) : l.shiftKey && p === C && (l.preventDefault(), n && te(x, { select: !0 })) : p === m && l.preventDefault();
344
- }
345
- },
346
- [n, r, y.paused]
347
- );
348
- return /* @__PURE__ */ v(O.div, { tabIndex: -1, ...c, ref: w, onKeyDown: f });
349
- });
350
- bt.displayName = cr;
351
- function ir(e, { select: t = !1 } = {}) {
352
- const n = document.activeElement;
353
- for (const r of e)
354
- if (te(r, { select: t }), document.activeElement !== n) return;
355
- }
356
- function lr(e) {
357
- const t = xt(e), n = at(t, e), r = at(t.reverse(), e);
358
- return [n, r];
359
- }
360
- function xt(e) {
361
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
362
- acceptNode: (r) => {
363
- const a = r.tagName === "INPUT" && r.type === "hidden";
364
- return r.disabled || r.hidden || a ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
365
- }
366
- });
367
- for (; n.nextNode(); ) t.push(n.currentNode);
368
- return t;
369
- }
370
- function at(e, t) {
371
- for (const n of e)
372
- if (!ur(n, { upTo: t })) return n;
373
- }
374
- function ur(e, { upTo: t }) {
375
- if (getComputedStyle(e).visibility === "hidden") return !0;
376
- for (; e; ) {
377
- if (t !== void 0 && e === t) return !1;
378
- if (getComputedStyle(e).display === "none") return !0;
379
- e = e.parentElement;
380
- }
381
- return !1;
382
- }
383
- function dr(e) {
384
- return e instanceof HTMLInputElement && "select" in e;
385
- }
386
- function te(e, { select: t = !1 } = {}) {
387
- if (e && e.focus) {
388
- const n = document.activeElement;
389
- e.focus({ preventScroll: !0 }), e !== n && dr(e) && t && e.select();
390
- }
391
- }
392
- var st = fr();
393
- function fr() {
394
- let e = [];
395
- return {
396
- add(t) {
397
- const n = e[0];
398
- t !== n && (n == null || n.pause()), e = ct(e, t), e.unshift(t);
399
- },
400
- remove(t) {
401
- var n;
402
- e = ct(e, t), (n = e[0]) == null || n.resume();
403
- }
404
- };
405
- }
406
- function ct(e, t) {
407
- const n = [...e], r = n.indexOf(t);
408
- return r !== -1 && n.splice(r, 1), n;
409
- }
410
- function pr(e) {
411
- return e.filter((t) => t.tagName !== "A");
412
- }
413
- var mr = "Arrow", _t = s.forwardRef((e, t) => {
414
- const { children: n, width: r = 10, height: a = 5, ...i } = e;
415
- return /* @__PURE__ */ v(
416
- O.svg,
417
- {
418
- ...i,
419
- ref: t,
420
- width: r,
421
- height: a,
422
- viewBox: "0 0 30 10",
423
- preserveAspectRatio: "none",
424
- children: e.asChild ? n : /* @__PURE__ */ v("polygon", { points: "0,0 30,0 15,10" })
425
- }
426
- );
427
- });
428
- _t.displayName = mr;
429
- var hr = _t;
430
- function vr(e, t) {
431
- typeof e == "function" ? e(t) : e != null && (e.current = t);
432
- }
433
- function gr(...e) {
434
- return (t) => e.forEach((n) => vr(n, t));
435
- }
436
- function Et(...e) {
437
- return s.useCallback(gr(...e), e);
438
- }
439
- function Sr(e, t = []) {
440
- let n = [];
441
- function r(i, c) {
442
- const o = s.createContext(c), u = n.length;
443
- n = [...n, c];
444
- function d(S) {
445
- const { scope: w, children: y, ...f } = S, l = (w == null ? void 0 : w[e][u]) || o, h = s.useMemo(() => f, Object.values(f));
446
- return /* @__PURE__ */ v(l.Provider, { value: h, children: y });
447
- }
448
- function g(S, w) {
449
- const y = (w == null ? void 0 : w[e][u]) || o, f = s.useContext(y);
450
- if (f) return f;
451
- if (c !== void 0) return c;
452
- throw new Error(`\`${S}\` must be used within \`${i}\``);
453
- }
454
- return d.displayName = i + "Provider", [d, g];
455
- }
456
- const a = () => {
457
- const i = n.map((c) => s.createContext(c));
458
- return function(o) {
459
- const u = (o == null ? void 0 : o[e]) || i;
460
- return s.useMemo(
461
- () => ({ [`__scope${e}`]: { ...o, [e]: u } }),
462
- [o, u]
463
- );
464
- };
465
- };
466
- return a.scopeName = e, [r, wr(a, ...t)];
467
- }
468
- function wr(...e) {
469
- const t = e[0];
470
- if (e.length === 1) return t;
471
- const n = () => {
472
- const r = e.map((a) => ({
473
- useScope: a(),
474
- scopeName: a.scopeName
475
- }));
476
- return function(i) {
477
- const c = r.reduce((o, { useScope: u, scopeName: d }) => {
478
- const S = u(i)[`__scope${d}`];
479
- return { ...o, ...S };
480
- }, {});
481
- return s.useMemo(() => ({ [`__scope${t.scopeName}`]: c }), [c]);
482
- };
483
- };
484
- return n.scopeName = t.scopeName, n;
485
- }
486
- var Ze = "Popper", [Pt, Rt] = Sr(Ze), [yr, Tt] = Pt(Ze), Nt = (e) => {
487
- const { __scopePopper: t, children: n } = e, [r, a] = s.useState(null);
488
- return /* @__PURE__ */ v(yr, { scope: t, anchor: r, onAnchorChange: a, children: n });
489
- };
490
- Nt.displayName = Ze;
491
- var It = "PopperAnchor", At = s.forwardRef(
492
- (e, t) => {
493
- const { __scopePopper: n, virtualRef: r, ...a } = e, i = Tt(It, n), c = s.useRef(null), o = Et(t, c);
494
- return s.useEffect(() => {
495
- i.onAnchorChange((r == null ? void 0 : r.current) || c.current);
496
- }), r ? null : /* @__PURE__ */ v(O.div, { ...a, ref: o });
497
- }
498
- );
499
- At.displayName = It;
500
- var qe = "PopperContent", [Cr, br] = Pt(qe), Ot = s.forwardRef(
501
- (e, t) => {
502
- var b, I, L, T, P, R;
503
- const {
504
- __scopePopper: n,
505
- side: r = "bottom",
506
- sideOffset: a = 0,
507
- align: i = "center",
508
- alignOffset: c = 0,
509
- arrowPadding: o = 0,
510
- avoidCollisions: u = !0,
511
- collisionBoundary: d = [],
512
- collisionPadding: g = 0,
513
- sticky: S = "partial",
514
- hideWhenDetached: w = !1,
515
- updatePositionStrategy: y = "optimized",
516
- onPlaced: f,
517
- ...l
518
- } = e, h = Tt(qe, n), [p, m] = s.useState(null), C = Et(t, (V) => m(V)), [x, E] = s.useState(null), A = _n(x), _ = (A == null ? void 0 : A.width) ?? 0, N = (A == null ? void 0 : A.height) ?? 0, k = r + (i !== "center" ? "-" + i : ""), H = typeof g == "number" ? g : { top: 0, right: 0, bottom: 0, left: 0, ...g }, G = Array.isArray(d) ? d : [d], $ = G.length > 0, W = {
519
- padding: H,
520
- boundary: G.filter(_r),
521
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
522
- altBoundary: $
523
- }, { refs: Z, floatingStyles: M, placement: U, isPositioned: F, middlewareData: z } = Pn({
524
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
525
- strategy: "fixed",
526
- placement: k,
527
- whileElementsMounted: (...V) => Rn(...V, {
528
- animationFrame: y === "always"
529
- }),
530
- elements: {
531
- reference: h.anchor
532
- },
533
- middleware: [
534
- Tn({ mainAxis: a + N, alignmentAxis: c }),
535
- u && Nn({
536
- mainAxis: !0,
537
- crossAxis: !1,
538
- limiter: S === "partial" ? Ln() : void 0,
539
- ...W
540
- }),
541
- u && In({ ...W }),
542
- An({
543
- ...W,
544
- apply: ({ elements: V, rects: q, availableWidth: Se, availableHeight: we }) => {
545
- const { width: ye, height: yn } = q.reference, xe = V.floating.style;
546
- xe.setProperty("--radix-popper-available-width", `${Se}px`), xe.setProperty("--radix-popper-available-height", `${we}px`), xe.setProperty("--radix-popper-anchor-width", `${ye}px`), xe.setProperty("--radix-popper-anchor-height", `${yn}px`);
547
- }
548
- }),
549
- x && On({ element: x, padding: o }),
550
- Er({ arrowWidth: _, arrowHeight: N }),
551
- w && Mn({ strategy: "referenceHidden", ...W })
552
- ]
553
- }), [Y, he] = Dt(U), Q = pe(f);
554
- X(() => {
555
- F && (Q == null || Q());
556
- }, [F, Q]);
557
- const ve = (b = z.arrow) == null ? void 0 : b.x, ge = (I = z.arrow) == null ? void 0 : I.y, ee = ((L = z.arrow) == null ? void 0 : L.centerOffset) !== 0, [le, se] = s.useState();
558
- return X(() => {
559
- p && se(window.getComputedStyle(p).zIndex);
560
- }, [p]), /* @__PURE__ */ v(
561
- "div",
562
- {
563
- ref: Z.setFloating,
564
- "data-radix-popper-content-wrapper": "",
565
- style: {
566
- ...M,
567
- transform: F ? M.transform : "translate(0, -200%)",
568
- // keep off the page when measuring
569
- minWidth: "max-content",
570
- zIndex: le,
571
- "--radix-popper-transform-origin": [
572
- (T = z.transformOrigin) == null ? void 0 : T.x,
573
- (P = z.transformOrigin) == null ? void 0 : P.y
574
- ].join(" "),
575
- // hide the content if using the hide middleware and should be hidden
576
- // set visibility to hidden and disable pointer events so the UI behaves
577
- // as if the PopperContent isn't there at all
578
- ...((R = z.hide) == null ? void 0 : R.referenceHidden) && {
579
- visibility: "hidden",
580
- pointerEvents: "none"
581
- }
582
- },
583
- dir: e.dir,
584
- children: /* @__PURE__ */ v(
585
- Cr,
586
- {
587
- scope: n,
588
- placedSide: Y,
589
- onArrowChange: E,
590
- arrowX: ve,
591
- arrowY: ge,
592
- shouldHideArrow: ee,
593
- children: /* @__PURE__ */ v(
594
- O.div,
595
- {
596
- "data-side": Y,
597
- "data-align": he,
598
- ...l,
599
- ref: C,
600
- style: {
601
- ...l.style,
602
- // if the PopperContent hasn't been placed yet (not all measurements done)
603
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
604
- animation: F ? void 0 : "none"
605
- }
606
- }
607
- )
608
- }
609
- )
610
- }
611
- );
612
- }
613
- );
614
- Ot.displayName = qe;
615
- var Mt = "PopperArrow", xr = {
616
- top: "bottom",
617
- right: "left",
618
- bottom: "top",
619
- left: "right"
620
- }, Lt = s.forwardRef(function(t, n) {
621
- const { __scopePopper: r, ...a } = t, i = br(Mt, r), c = xr[i.placedSide];
622
- return (
623
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
624
- // doesn't report size as we'd expect on SVG elements.
625
- // it reports their bounding box which is effectively the largest path inside the SVG.
626
- /* @__PURE__ */ v(
627
- "span",
628
- {
629
- ref: i.onArrowChange,
630
- style: {
631
- position: "absolute",
632
- left: i.arrowX,
633
- top: i.arrowY,
634
- [c]: 0,
635
- transformOrigin: {
636
- top: "",
637
- right: "0 0",
638
- bottom: "center 0",
639
- left: "100% 0"
640
- }[i.placedSide],
641
- transform: {
642
- top: "translateY(100%)",
643
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
644
- bottom: "rotate(180deg)",
645
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
646
- }[i.placedSide],
647
- visibility: i.shouldHideArrow ? "hidden" : void 0
648
- },
649
- children: /* @__PURE__ */ v(
650
- hr,
651
- {
652
- ...a,
653
- ref: n,
654
- style: {
655
- ...a.style,
656
- // ensures the element can be measured correctly (mostly for if SVG)
657
- display: "block"
658
- }
659
- }
660
- )
661
- }
662
- )
663
- );
1
+ import { jsx as i, jsxs as $, Fragment as Pe } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import q from "react";
4
+ import { R as ft, r as De } from "../../index-Cl_RnsqN.js";
5
+ import { c as Ee } from "../../index-rKs9bXHr.js";
6
+ import { a as K, P as N, d as Oe, c as mt, u as B, e as P, b as ht } from "../../index-BHuChyf5.js";
7
+ import { u as gt, c as vt } from "../../index-DZEAOJqB.js";
8
+ import { c as Le, R as _t, u as Ne, A as St, a as wt, h as xt, b as yt, d as Ct, F as It, D as Tt, C as bt, e as Pt } from "../../Combination-CSgOhzm-.js";
9
+ import { u as Nt } from "../../index-BZPx6jYI.js";
10
+ import { Icon as Rt } from "../Icon/Icon.js";
11
+ import { clsx as xe } from "../../utils/clsx.js";
12
+ import { ui as Et } from "../../utils/ui/ui.js";
13
+ var Ot = "Portal", ke = l.forwardRef((t, o) => {
14
+ var a;
15
+ const { container: e, ...r } = t, [n, d] = l.useState(!1);
16
+ K(() => d(!0), []);
17
+ const c = e || n && ((a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : a.body);
18
+ return c ? ft.createPortal(/* @__PURE__ */ i(N.div, { ...r, ref: o }), c) : null;
664
19
  });
665
- Lt.displayName = Mt;
666
- function _r(e) {
667
- return e !== null;
668
- }
669
- var Er = (e) => ({
670
- name: "transformOrigin",
671
- options: e,
672
- fn(t) {
673
- var h, p, m;
674
- const { placement: n, rects: r, middlewareData: a } = t, c = ((h = a.arrow) == null ? void 0 : h.centerOffset) !== 0, o = c ? 0 : e.arrowWidth, u = c ? 0 : e.arrowHeight, [d, g] = Dt(n), S = { start: "0%", center: "50%", end: "100%" }[g], w = (((p = a.arrow) == null ? void 0 : p.x) ?? 0) + o / 2, y = (((m = a.arrow) == null ? void 0 : m.y) ?? 0) + u / 2;
675
- let f = "", l = "";
676
- return d === "bottom" ? (f = c ? S : `${w}px`, l = `${-u}px`) : d === "top" ? (f = c ? S : `${w}px`, l = `${r.floating.height + u}px`) : d === "right" ? (f = `${-u}px`, l = c ? S : `${y}px`) : d === "left" && (f = `${r.floating.width + u}px`, l = c ? S : `${y}px`), { data: { x: f, y: l } };
677
- }
678
- });
679
- function Dt(e) {
680
- const [t, n = "center"] = e.split("-");
681
- return [t, n];
682
- }
683
- var Pr = Nt, Rr = At, Tr = Ot, Nr = Lt, Ir = "Portal", kt = s.forwardRef((e, t) => {
684
- var o;
685
- const { container: n, ...r } = e, [a, i] = s.useState(!1);
686
- X(() => i(!0), []);
687
- const c = n || a && ((o = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : o.body);
688
- return c ? Cn.createPortal(/* @__PURE__ */ v(O.div, { ...r, ref: t }), c) : null;
689
- });
690
- kt.displayName = Ir;
691
- var Ar = "VisuallyHidden", Bt = s.forwardRef(
692
- (e, t) => /* @__PURE__ */ v(
693
- O.span,
20
+ ke.displayName = Ot;
21
+ var ze = Object.freeze({
22
+ // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
23
+ position: "absolute",
24
+ border: 0,
25
+ width: 1,
26
+ height: 1,
27
+ padding: 0,
28
+ margin: -1,
29
+ overflow: "hidden",
30
+ clip: "rect(0, 0, 0, 0)",
31
+ whiteSpace: "nowrap",
32
+ wordWrap: "normal"
33
+ }), Mt = "VisuallyHidden", At = l.forwardRef(
34
+ (t, o) => /* @__PURE__ */ i(
35
+ N.span,
694
36
  {
695
- ...e,
696
- ref: t,
697
- style: {
698
- // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
699
- position: "absolute",
700
- border: 0,
701
- width: 1,
702
- height: 1,
703
- padding: 0,
704
- margin: -1,
705
- overflow: "hidden",
706
- clip: "rect(0, 0, 0, 0)",
707
- whiteSpace: "nowrap",
708
- wordWrap: "normal",
709
- ...e.style
710
- }
37
+ ...t,
38
+ ref: o,
39
+ style: { ...ze, ...t.style }
711
40
  }
712
41
  )
713
42
  );
714
- Bt.displayName = Ar;
715
- var Pe = "right-scroll-bar-position", Re = "width-before-scroll-bar", Or = "with-scroll-bars-hidden", Mr = "--removed-body-scroll-bar-size", Ft = Wn(), Fe = function() {
716
- }, Ne = s.forwardRef(function(e, t) {
717
- var n = s.useRef(null), r = s.useState({
718
- onScrollCapture: Fe,
719
- onWheelCapture: Fe,
720
- onTouchMoveCapture: Fe
721
- }), a = r[0], i = r[1], c = e.forwardProps, o = e.children, u = e.className, d = e.removeScrollBar, g = e.enabled, S = e.shards, w = e.sideCar, y = e.noIsolation, f = e.inert, l = e.allowPinchZoom, h = e.as, p = h === void 0 ? "div" : h, m = e.gapMode, C = ht(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), x = w, E = zn([n, t]), A = ce(ce({}, C), a);
722
- return s.createElement(
723
- s.Fragment,
724
- null,
725
- g && s.createElement(x, { sideCar: Ft, removeScrollBar: d, shards: S, noIsolation: y, inert: f, setCallbacks: i, allowPinchZoom: !!l, lockRef: n, gapMode: m }),
726
- c ? s.cloneElement(s.Children.only(o), ce(ce({}, A), { ref: E })) : s.createElement(p, ce({}, A, { className: u, ref: E }), o)
727
- );
728
- });
729
- Ne.defaultProps = {
730
- enabled: !0,
731
- removeScrollBar: !0,
732
- inert: !1
733
- };
734
- Ne.classNames = {
735
- fullWidth: Re,
736
- zeroRight: Pe
737
- };
738
- function Lr() {
739
- if (!document)
740
- return null;
741
- var e = document.createElement("style");
742
- e.type = "text/css";
743
- var t = Dn();
744
- return t && e.setAttribute("nonce", t), e;
745
- }
746
- function Dr(e, t) {
747
- e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
748
- }
749
- function kr(e) {
750
- var t = document.head || document.getElementsByTagName("head")[0];
751
- t.appendChild(e);
752
- }
753
- var Br = function() {
754
- var e = 0, t = null;
755
- return {
756
- add: function(n) {
757
- e == 0 && (t = Lr()) && (Dr(t, n), kr(t)), e++;
758
- },
759
- remove: function() {
760
- e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
761
- }
762
- };
763
- }, Fr = function() {
764
- var e = Br();
765
- return function(t, n) {
766
- s.useEffect(function() {
767
- return e.add(t), function() {
768
- e.remove();
769
- };
770
- }, [t && n]);
771
- };
772
- }, Wt = function() {
773
- var e = Fr(), t = function(n) {
774
- var r = n.styles, a = n.dynamic;
775
- return e(r, a), null;
776
- };
777
- return t;
778
- }, Wr = {
779
- left: 0,
780
- top: 0,
781
- right: 0,
782
- gap: 0
783
- }, We = function(e) {
784
- return parseInt(e || "", 10) || 0;
785
- }, zr = function(e) {
786
- var t = window.getComputedStyle(document.body), n = t[e === "padding" ? "paddingLeft" : "marginLeft"], r = t[e === "padding" ? "paddingTop" : "marginTop"], a = t[e === "padding" ? "paddingRight" : "marginRight"];
787
- return [We(n), We(r), We(a)];
788
- }, Vr = function(e) {
789
- if (e === void 0 && (e = "margin"), typeof window > "u")
790
- return Wr;
791
- var t = zr(e), n = document.documentElement.clientWidth, r = window.innerWidth;
792
- return {
793
- left: t[0],
794
- top: t[1],
795
- right: t[2],
796
- gap: Math.max(0, r - n + t[2] - t[0])
797
- };
798
- }, Hr = Wt(), fe = "data-scroll-locked", $r = function(e, t, n, r) {
799
- var a = e.left, i = e.top, c = e.right, o = e.gap;
800
- return n === void 0 && (n = "margin"), `
801
- .`.concat(Or, ` {
802
- overflow: hidden `).concat(r, `;
803
- padding-right: `).concat(o, "px ").concat(r, `;
804
- }
805
- body[`).concat(fe, `] {
806
- overflow: hidden `).concat(r, `;
807
- overscroll-behavior: contain;
808
- `).concat([
809
- t && "position: relative ".concat(r, ";"),
810
- n === "margin" && `
811
- padding-left: `.concat(a, `px;
812
- padding-top: `).concat(i, `px;
813
- padding-right: `).concat(c, `px;
814
- margin-left:0;
815
- margin-top:0;
816
- margin-right: `).concat(o, "px ").concat(r, `;
817
- `),
818
- n === "padding" && "padding-right: ".concat(o, "px ").concat(r, ";")
819
- ].filter(Boolean).join(""), `
820
- }
821
-
822
- .`).concat(Pe, ` {
823
- right: `).concat(o, "px ").concat(r, `;
824
- }
825
-
826
- .`).concat(Re, ` {
827
- margin-right: `).concat(o, "px ").concat(r, `;
828
- }
829
-
830
- .`).concat(Pe, " .").concat(Pe, ` {
831
- right: 0 `).concat(r, `;
832
- }
833
-
834
- .`).concat(Re, " .").concat(Re, ` {
835
- margin-right: 0 `).concat(r, `;
836
- }
837
-
838
- body[`).concat(fe, `] {
839
- `).concat(Mr, ": ").concat(o, `px;
840
- }
841
- `);
842
- }, it = function() {
843
- var e = parseInt(document.body.getAttribute(fe) || "0", 10);
844
- return isFinite(e) ? e : 0;
845
- }, Ur = function() {
846
- s.useEffect(function() {
847
- return document.body.setAttribute(fe, (it() + 1).toString()), function() {
848
- var e = it() - 1;
849
- e <= 0 ? document.body.removeAttribute(fe) : document.body.setAttribute(fe, e.toString());
850
- };
851
- }, []);
852
- }, Kr = function(e) {
853
- var t = e.noRelative, n = e.noImportant, r = e.gapMode, a = r === void 0 ? "margin" : r;
854
- Ur();
855
- var i = s.useMemo(function() {
856
- return Vr(a);
857
- }, [a]);
858
- return s.createElement(Hr, { styles: $r(i, !t, a, n ? "" : "!important") });
859
- }, He = !1;
860
- if (typeof window < "u")
861
- try {
862
- var _e = Object.defineProperty({}, "passive", {
863
- get: function() {
864
- return He = !0, !0;
865
- }
866
- });
867
- window.addEventListener("test", _e, _e), window.removeEventListener("test", _e, _e);
868
- } catch {
869
- He = !1;
870
- }
871
- var ue = He ? { passive: !1 } : !1, Yr = function(e) {
872
- return e.tagName === "TEXTAREA";
873
- }, zt = function(e, t) {
874
- var n = window.getComputedStyle(e);
875
- return (
876
- // not-not-scrollable
877
- n[t] !== "hidden" && // contains scroll inside self
878
- !(n.overflowY === n.overflowX && !Yr(e) && n[t] === "visible")
879
- );
880
- }, jr = function(e) {
881
- return zt(e, "overflowY");
882
- }, Xr = function(e) {
883
- return zt(e, "overflowX");
884
- }, lt = function(e, t) {
885
- var n = t.ownerDocument, r = t;
886
- do {
887
- typeof ShadowRoot < "u" && r instanceof ShadowRoot && (r = r.host);
888
- var a = Vt(e, r);
889
- if (a) {
890
- var i = Ht(e, r), c = i[1], o = i[2];
891
- if (c > o)
892
- return !0;
893
- }
894
- r = r.parentNode;
895
- } while (r && r !== n.body);
896
- return !1;
897
- }, Gr = function(e) {
898
- var t = e.scrollTop, n = e.scrollHeight, r = e.clientHeight;
899
- return [
900
- t,
901
- n,
902
- r
903
- ];
904
- }, Zr = function(e) {
905
- var t = e.scrollLeft, n = e.scrollWidth, r = e.clientWidth;
906
- return [
907
- t,
908
- n,
909
- r
910
- ];
911
- }, Vt = function(e, t) {
912
- return e === "v" ? jr(t) : Xr(t);
913
- }, Ht = function(e, t) {
914
- return e === "v" ? Gr(t) : Zr(t);
915
- }, qr = function(e, t) {
916
- return e === "h" && t === "rtl" ? -1 : 1;
917
- }, Qr = function(e, t, n, r, a) {
918
- var i = qr(e, window.getComputedStyle(t).direction), c = i * r, o = n.target, u = t.contains(o), d = !1, g = c > 0, S = 0, w = 0;
919
- do {
920
- var y = Ht(e, o), f = y[0], l = y[1], h = y[2], p = l - h - i * f;
921
- (f || p) && Vt(e, o) && (S += p, w += f), o instanceof ShadowRoot ? o = o.host : o = o.parentNode;
922
- } while (
923
- // portaled content
924
- !u && o !== document.body || // self content
925
- u && (t.contains(o) || t === o)
926
- );
927
- return (g && (Math.abs(S) < 1 || !a) || !g && (Math.abs(w) < 1 || !a)) && (d = !0), d;
928
- }, Ee = function(e) {
929
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
930
- }, ut = function(e) {
931
- return [e.deltaX, e.deltaY];
932
- }, dt = function(e) {
933
- return e && "current" in e ? e.current : e;
934
- }, Jr = function(e, t) {
935
- return e[0] === t[0] && e[1] === t[1];
936
- }, eo = function(e) {
937
- return `
938
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
939
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
940
- `);
941
- }, to = 0, de = [];
942
- function no(e) {
943
- var t = s.useRef([]), n = s.useRef([0, 0]), r = s.useRef(), a = s.useState(to++)[0], i = s.useState(Wt)[0], c = s.useRef(e);
944
- s.useEffect(function() {
945
- c.current = e;
946
- }, [e]), s.useEffect(function() {
947
- if (e.inert) {
948
- document.body.classList.add("block-interactivity-".concat(a));
949
- var l = Fn([e.lockRef.current], (e.shards || []).map(dt), !0).filter(Boolean);
950
- return l.forEach(function(h) {
951
- return h.classList.add("allow-interactivity-".concat(a));
952
- }), function() {
953
- document.body.classList.remove("block-interactivity-".concat(a)), l.forEach(function(h) {
954
- return h.classList.remove("allow-interactivity-".concat(a));
955
- });
956
- };
957
- }
958
- }, [e.inert, e.lockRef.current, e.shards]);
959
- var o = s.useCallback(function(l, h) {
960
- if ("touches" in l && l.touches.length === 2)
961
- return !c.current.allowPinchZoom;
962
- var p = Ee(l), m = n.current, C = "deltaX" in l ? l.deltaX : m[0] - p[0], x = "deltaY" in l ? l.deltaY : m[1] - p[1], E, A = l.target, _ = Math.abs(C) > Math.abs(x) ? "h" : "v";
963
- if ("touches" in l && _ === "h" && A.type === "range")
964
- return !1;
965
- var N = lt(_, A);
966
- if (!N)
967
- return !0;
968
- if (N ? E = _ : (E = _ === "v" ? "h" : "v", N = lt(_, A)), !N)
969
- return !1;
970
- if (!r.current && "changedTouches" in l && (C || x) && (r.current = E), !E)
971
- return !0;
972
- var k = r.current || E;
973
- return Qr(k, h, l, k === "h" ? C : x, !0);
974
- }, []), u = s.useCallback(function(l) {
975
- var h = l;
976
- if (!(!de.length || de[de.length - 1] !== i)) {
977
- var p = "deltaY" in h ? ut(h) : Ee(h), m = t.current.filter(function(E) {
978
- return E.name === h.type && (E.target === h.target || h.target === E.shadowParent) && Jr(E.delta, p);
979
- })[0];
980
- if (m && m.should) {
981
- h.cancelable && h.preventDefault();
982
- return;
983
- }
984
- if (!m) {
985
- var C = (c.current.shards || []).map(dt).filter(Boolean).filter(function(E) {
986
- return E.contains(h.target);
987
- }), x = C.length > 0 ? o(h, C[0]) : !c.current.noIsolation;
988
- x && h.cancelable && h.preventDefault();
989
- }
990
- }
991
- }, []), d = s.useCallback(function(l, h, p, m) {
992
- var C = { name: l, delta: h, target: p, should: m, shadowParent: ro(p) };
993
- t.current.push(C), setTimeout(function() {
994
- t.current = t.current.filter(function(x) {
995
- return x !== C;
996
- });
997
- }, 1);
998
- }, []), g = s.useCallback(function(l) {
999
- n.current = Ee(l), r.current = void 0;
1000
- }, []), S = s.useCallback(function(l) {
1001
- d(l.type, ut(l), l.target, o(l, e.lockRef.current));
1002
- }, []), w = s.useCallback(function(l) {
1003
- d(l.type, Ee(l), l.target, o(l, e.lockRef.current));
1004
- }, []);
1005
- s.useEffect(function() {
1006
- return de.push(i), e.setCallbacks({
1007
- onScrollCapture: S,
1008
- onWheelCapture: S,
1009
- onTouchMoveCapture: w
1010
- }), document.addEventListener("wheel", u, ue), document.addEventListener("touchmove", u, ue), document.addEventListener("touchstart", g, ue), function() {
1011
- de = de.filter(function(l) {
1012
- return l !== i;
1013
- }), document.removeEventListener("wheel", u, ue), document.removeEventListener("touchmove", u, ue), document.removeEventListener("touchstart", g, ue);
1014
- };
1015
- }, []);
1016
- var y = e.removeScrollBar, f = e.inert;
1017
- return s.createElement(
1018
- s.Fragment,
1019
- null,
1020
- f ? s.createElement(i, { styles: eo(a) }) : null,
1021
- y ? s.createElement(Kr, { gapMode: e.gapMode }) : null
1022
- );
1023
- }
1024
- function ro(e) {
1025
- for (var t = null; e !== null; )
1026
- e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
1027
- return t;
1028
- }
1029
- const oo = $n(Ft, no);
1030
- var $t = s.forwardRef(function(e, t) {
1031
- return s.createElement(Ne, ce({}, e, { ref: t, sideCar: oo }));
1032
- });
1033
- $t.classNames = Ne.classNames;
1034
- var ao = [" ", "Enter", "ArrowUp", "ArrowDown"], so = [" ", "Enter"], be = "Select", [Ie, Ae, co] = jn(be), [me, ua] = gt(be, [
1035
- co,
1036
- Rt
1037
- ]), Oe = Rt(), [io, oe] = me(be), [lo, uo] = me(be), Ut = (e) => {
43
+ At.displayName = Mt;
44
+ var Dt = [" ", "Enter", "ArrowUp", "ArrowDown"], Lt = [" ", "Enter"], oe = "Select", [pe, fe, kt] = vt(oe), [le, Bo] = mt(oe, [
45
+ kt,
46
+ Le
47
+ ]), me = Le(), [zt, Z] = le(oe), [Bt, Vt] = le(oe), Be = (t) => {
1038
48
  const {
1039
- __scopeSelect: t,
1040
- children: n,
49
+ __scopeSelect: o,
50
+ children: e,
1041
51
  open: r,
1042
- defaultOpen: a,
1043
- onOpenChange: i,
52
+ defaultOpen: n,
53
+ onOpenChange: d,
1044
54
  value: c,
1045
- defaultValue: o,
1046
- onValueChange: u,
1047
- dir: d,
1048
- name: g,
1049
- autoComplete: S,
1050
- disabled: w,
1051
- required: y
1052
- } = e, f = Oe(t), [l, h] = s.useState(null), [p, m] = s.useState(null), [C, x] = s.useState(!1), E = xn(d), [A = !1, _] = et({
55
+ defaultValue: a,
56
+ onValueChange: s,
57
+ dir: p,
58
+ name: v,
59
+ autoComplete: _,
60
+ disabled: T,
61
+ required: b,
62
+ form: S
63
+ } = t, u = me(o), [g, y] = l.useState(null), [f, h] = l.useState(null), [M, A] = l.useState(!1), se = gt(p), [R, k] = Oe({
1053
64
  prop: r,
1054
- defaultProp: a,
1055
- onChange: i
1056
- }), [N, k] = et({
65
+ defaultProp: n ?? !1,
66
+ onChange: d,
67
+ caller: oe
68
+ }), [j, Q] = Oe({
1057
69
  prop: c,
1058
- defaultProp: o,
1059
- onChange: u
1060
- }), H = s.useRef(null), G = l ? !!l.closest("form") : !0, [$, W] = s.useState(/* @__PURE__ */ new Set()), Z = Array.from($).map((M) => M.props.value).join(";");
1061
- return /* @__PURE__ */ v(Pr, { ...f, children: /* @__PURE__ */ ne(
1062
- io,
70
+ defaultProp: a,
71
+ onChange: s,
72
+ caller: oe
73
+ }), V = l.useRef(null), H = g ? S || !!g.closest("form") : !0, [G, W] = l.useState(/* @__PURE__ */ new Set()), F = Array.from(G).map((E) => E.props.value).join(";");
74
+ return /* @__PURE__ */ i(_t, { ...u, children: /* @__PURE__ */ $(
75
+ zt,
1063
76
  {
1064
- required: y,
1065
- scope: t,
1066
- trigger: l,
1067
- onTriggerChange: h,
1068
- valueNode: p,
1069
- onValueNodeChange: m,
1070
- valueNodeHasChildren: C,
1071
- onValueNodeHasChildrenChange: x,
1072
- contentId: Ge(),
1073
- value: N,
1074
- onValueChange: k,
1075
- open: A,
1076
- onOpenChange: _,
1077
- dir: E,
1078
- triggerPointerDownPosRef: H,
1079
- disabled: w,
77
+ required: b,
78
+ scope: o,
79
+ trigger: g,
80
+ onTriggerChange: y,
81
+ valueNode: f,
82
+ onValueNodeChange: h,
83
+ valueNodeHasChildren: M,
84
+ onValueNodeHasChildrenChange: A,
85
+ contentId: Ne(),
86
+ value: j,
87
+ onValueChange: Q,
88
+ open: R,
89
+ onOpenChange: k,
90
+ dir: se,
91
+ triggerPointerDownPosRef: V,
92
+ disabled: T,
1080
93
  children: [
1081
- /* @__PURE__ */ v(Ie.Provider, { scope: t, children: /* @__PURE__ */ v(
1082
- lo,
94
+ /* @__PURE__ */ i(pe.Provider, { scope: o, children: /* @__PURE__ */ i(
95
+ Bt,
1083
96
  {
1084
- scope: e.__scopeSelect,
1085
- onNativeOptionAdd: s.useCallback((M) => {
1086
- W((U) => new Set(U).add(M));
97
+ scope: t.__scopeSelect,
98
+ onNativeOptionAdd: l.useCallback((E) => {
99
+ W((z) => new Set(z).add(E));
1087
100
  }, []),
1088
- onNativeOptionRemove: s.useCallback((M) => {
1089
- W((U) => {
1090
- const F = new Set(U);
1091
- return F.delete(M), F;
101
+ onNativeOptionRemove: l.useCallback((E) => {
102
+ W((z) => {
103
+ const U = new Set(z);
104
+ return U.delete(E), U;
1092
105
  });
1093
106
  }, []),
1094
- children: n
107
+ children: e
1095
108
  }
1096
109
  ) }),
1097
- G ? /* @__PURE__ */ ne(
1098
- mn,
110
+ H ? /* @__PURE__ */ $(
111
+ st,
1099
112
  {
1100
113
  "aria-hidden": !0,
1101
- required: y,
114
+ required: b,
1102
115
  tabIndex: -1,
1103
- name: g,
1104
- autoComplete: S,
1105
- value: N,
1106
- onChange: (M) => k(M.target.value),
1107
- disabled: w,
116
+ name: v,
117
+ autoComplete: _,
118
+ value: j,
119
+ onChange: (E) => Q(E.target.value),
120
+ disabled: T,
121
+ form: S,
1108
122
  children: [
1109
- N === void 0 ? /* @__PURE__ */ v("option", { value: "" }) : null,
1110
- Array.from($)
123
+ j === void 0 ? /* @__PURE__ */ i("option", { value: "" }) : null,
124
+ Array.from(G)
1111
125
  ]
1112
126
  },
1113
- Z
127
+ F
1114
128
  ) : null
1115
129
  ]
1116
130
  }
1117
131
  ) });
1118
132
  };
1119
- Ut.displayName = be;
1120
- var Kt = "SelectTrigger", Yt = s.forwardRef(
1121
- (e, t) => {
1122
- const { __scopeSelect: n, disabled: r = !1, ...a } = e, i = Oe(n), c = oe(Kt, n), o = c.disabled || r, u = K(t, c.onTriggerChange), d = Ae(n), [g, S, w] = hn((f) => {
1123
- const l = d().filter((m) => !m.disabled), h = l.find((m) => m.value === c.value), p = vn(l, f, h);
1124
- p !== void 0 && c.onValueChange(p.value);
1125
- }), y = () => {
1126
- o || (c.onOpenChange(!0), w());
133
+ Be.displayName = oe;
134
+ var Ve = "SelectTrigger", He = l.forwardRef(
135
+ (t, o) => {
136
+ const { __scopeSelect: e, disabled: r = !1, ...n } = t, d = me(e), c = Z(Ve, e), a = c.disabled || r, s = B(o, c.onTriggerChange), p = fe(e), v = l.useRef("touch"), [_, T, b] = at((u) => {
137
+ const g = p().filter((h) => !h.disabled), y = g.find((h) => h.value === c.value), f = it(g, u, y);
138
+ f !== void 0 && c.onValueChange(f.value);
139
+ }), S = (u) => {
140
+ a || (c.onOpenChange(!0), b()), u && (c.triggerPointerDownPosRef.current = {
141
+ x: Math.round(u.pageX),
142
+ y: Math.round(u.pageY)
143
+ });
1127
144
  };
1128
- return /* @__PURE__ */ v(Rr, { asChild: !0, ...i, children: /* @__PURE__ */ v(
1129
- O.button,
145
+ return /* @__PURE__ */ i(St, { asChild: !0, ...d, children: /* @__PURE__ */ i(
146
+ N.button,
1130
147
  {
1131
148
  type: "button",
1132
149
  role: "combobox",
@@ -1136,230 +153,228 @@ var Kt = "SelectTrigger", Yt = s.forwardRef(
1136
153
  "aria-autocomplete": "none",
1137
154
  dir: c.dir,
1138
155
  "data-state": c.open ? "open" : "closed",
1139
- disabled: o,
1140
- "data-disabled": o ? "" : void 0,
1141
- "data-placeholder": pn(c.value) ? "" : void 0,
1142
- ...a,
1143
- ref: u,
1144
- onClick: B(a.onClick, (f) => {
1145
- f.currentTarget.focus();
156
+ disabled: a,
157
+ "data-disabled": a ? "" : void 0,
158
+ "data-placeholder": ct(c.value) ? "" : void 0,
159
+ ...n,
160
+ ref: s,
161
+ onClick: P(n.onClick, (u) => {
162
+ u.currentTarget.focus(), v.current !== "mouse" && S(u);
1146
163
  }),
1147
- onPointerDown: B(a.onPointerDown, (f) => {
1148
- const l = f.target;
1149
- l.hasPointerCapture(f.pointerId) && l.releasePointerCapture(f.pointerId), f.button === 0 && f.ctrlKey === !1 && (y(), c.triggerPointerDownPosRef.current = {
1150
- x: Math.round(f.pageX),
1151
- y: Math.round(f.pageY)
1152
- }, f.preventDefault());
164
+ onPointerDown: P(n.onPointerDown, (u) => {
165
+ v.current = u.pointerType;
166
+ const g = u.target;
167
+ g.hasPointerCapture(u.pointerId) && g.releasePointerCapture(u.pointerId), u.button === 0 && u.ctrlKey === !1 && u.pointerType === "mouse" && (S(u), u.preventDefault());
1153
168
  }),
1154
- onKeyDown: B(a.onKeyDown, (f) => {
1155
- const l = g.current !== "";
1156
- !(f.ctrlKey || f.altKey || f.metaKey) && f.key.length === 1 && S(f.key), !(l && f.key === " ") && ao.includes(f.key) && (y(), f.preventDefault());
169
+ onKeyDown: P(n.onKeyDown, (u) => {
170
+ const g = _.current !== "";
171
+ !(u.ctrlKey || u.altKey || u.metaKey) && u.key.length === 1 && T(u.key), !(g && u.key === " ") && Dt.includes(u.key) && (S(), u.preventDefault());
1157
172
  })
1158
173
  }
1159
174
  ) });
1160
175
  }
1161
176
  );
1162
- Yt.displayName = Kt;
1163
- var jt = "SelectValue", Xt = s.forwardRef(
1164
- (e, t) => {
1165
- const { __scopeSelect: n, className: r, style: a, children: i, placeholder: c = "", ...o } = e, u = oe(jt, n), { onValueNodeHasChildrenChange: d } = u, g = i !== void 0, S = K(t, u.onValueNodeChange);
1166
- return X(() => {
1167
- d(g);
1168
- }, [d, g]), /* @__PURE__ */ v(
1169
- O.span,
177
+ He.displayName = Ve;
178
+ var We = "SelectValue", Fe = l.forwardRef(
179
+ (t, o) => {
180
+ const { __scopeSelect: e, className: r, style: n, children: d, placeholder: c = "", ...a } = t, s = Z(We, e), { onValueNodeHasChildrenChange: p } = s, v = d !== void 0, _ = B(o, s.onValueNodeChange);
181
+ return K(() => {
182
+ p(v);
183
+ }, [p, v]), /* @__PURE__ */ i(
184
+ N.span,
1170
185
  {
1171
- ...o,
1172
- ref: S,
186
+ ...a,
187
+ ref: _,
1173
188
  style: { pointerEvents: "none" },
1174
- children: pn(u.value) ? /* @__PURE__ */ v(Xe, { children: c }) : i
189
+ children: ct(s.value) ? /* @__PURE__ */ i(Pe, { children: c }) : d
1175
190
  }
1176
191
  );
1177
192
  }
1178
193
  );
1179
- Xt.displayName = jt;
1180
- var fo = "SelectIcon", Gt = s.forwardRef(
1181
- (e, t) => {
1182
- const { __scopeSelect: n, children: r, ...a } = e;
1183
- return /* @__PURE__ */ v(O.span, { "aria-hidden": !0, ...a, ref: t, children: r || "▼" });
194
+ Fe.displayName = We;
195
+ var Ht = "SelectIcon", Ue = l.forwardRef(
196
+ (t, o) => {
197
+ const { __scopeSelect: e, children: r, ...n } = t;
198
+ return /* @__PURE__ */ i(N.span, { "aria-hidden": !0, ...n, ref: o, children: r || "▼" });
1184
199
  }
1185
200
  );
1186
- Gt.displayName = fo;
1187
- var po = "SelectPortal", Zt = (e) => /* @__PURE__ */ v(kt, { asChild: !0, ...e });
1188
- Zt.displayName = po;
1189
- var ie = "SelectContent", qt = s.forwardRef(
1190
- (e, t) => {
1191
- const n = oe(ie, e.__scopeSelect), [r, a] = s.useState();
1192
- if (X(() => {
1193
- a(new DocumentFragment());
1194
- }, []), !n.open) {
1195
- const i = r;
1196
- return i ? mt.createPortal(
1197
- /* @__PURE__ */ v(Qt, { scope: e.__scopeSelect, children: /* @__PURE__ */ v(Ie.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ v("div", { children: e.children }) }) }),
1198
- i
201
+ Ue.displayName = Ht;
202
+ var Wt = "SelectPortal", Ke = (t) => /* @__PURE__ */ i(ke, { asChild: !0, ...t });
203
+ Ke.displayName = Wt;
204
+ var ne = "SelectContent", je = l.forwardRef(
205
+ (t, o) => {
206
+ const e = Z(ne, t.__scopeSelect), [r, n] = l.useState();
207
+ if (K(() => {
208
+ n(new DocumentFragment());
209
+ }, []), !e.open) {
210
+ const d = r;
211
+ return d ? De.createPortal(
212
+ /* @__PURE__ */ i(Ge, { scope: t.__scopeSelect, children: /* @__PURE__ */ i(pe.Slot, { scope: t.__scopeSelect, children: /* @__PURE__ */ i("div", { children: t.children }) }) }),
213
+ d
1199
214
  ) : null;
1200
215
  }
1201
- return /* @__PURE__ */ v(Jt, { ...e, ref: t });
216
+ return /* @__PURE__ */ i(Ye, { ...t, ref: o });
1202
217
  }
1203
218
  );
1204
- qt.displayName = ie;
1205
- var J = 10, [Qt, ae] = me(ie), mo = "SelectContentImpl", Jt = s.forwardRef(
1206
- (e, t) => {
219
+ je.displayName = ne;
220
+ var L = 10, [Ge, J] = le(ne), Ft = "SelectContentImpl", Ut = ht("SelectContent.RemoveScroll"), Ye = l.forwardRef(
221
+ (t, o) => {
1207
222
  const {
1208
- __scopeSelect: n,
223
+ __scopeSelect: e,
1209
224
  position: r = "item-aligned",
1210
- onCloseAutoFocus: a,
1211
- onEscapeKeyDown: i,
225
+ onCloseAutoFocus: n,
226
+ onEscapeKeyDown: d,
1212
227
  onPointerDownOutside: c,
1213
228
  //
1214
229
  // PopperContent props
1215
- side: o,
1216
- sideOffset: u,
1217
- align: d,
1218
- alignOffset: g,
1219
- arrowPadding: S,
1220
- collisionBoundary: w,
1221
- collisionPadding: y,
1222
- sticky: f,
1223
- hideWhenDetached: l,
1224
- avoidCollisions: h,
230
+ side: a,
231
+ sideOffset: s,
232
+ align: p,
233
+ alignOffset: v,
234
+ arrowPadding: _,
235
+ collisionBoundary: T,
236
+ collisionPadding: b,
237
+ sticky: S,
238
+ hideWhenDetached: u,
239
+ avoidCollisions: g,
1225
240
  //
1226
- ...p
1227
- } = e, m = oe(ie, n), [C, x] = s.useState(null), [E, A] = s.useState(null), _ = K(t, (b) => x(b)), [N, k] = s.useState(null), [H, G] = s.useState(
241
+ ...y
242
+ } = t, f = Z(ne, e), [h, M] = l.useState(null), [A, se] = l.useState(null), R = B(o, (m) => M(m)), [k, j] = l.useState(null), [Q, V] = l.useState(
1228
243
  null
1229
- ), $ = Ae(n), [W, Z] = s.useState(!1), M = s.useRef(!1);
1230
- s.useEffect(() => {
1231
- if (C) return kn(C);
1232
- }, [C]), rr();
1233
- const U = s.useCallback(
1234
- (b) => {
1235
- const [I, ...L] = $().map((R) => R.ref.current), [T] = L.slice(-1), P = document.activeElement;
1236
- for (const R of b)
1237
- if (R === P || (R == null || R.scrollIntoView({ block: "nearest" }), R === I && E && (E.scrollTop = 0), R === T && E && (E.scrollTop = E.scrollHeight), R == null || R.focus(), document.activeElement !== P)) return;
244
+ ), H = fe(e), [G, W] = l.useState(!1), F = l.useRef(!1);
245
+ l.useEffect(() => {
246
+ if (h) return xt(h);
247
+ }, [h]), yt();
248
+ const E = l.useCallback(
249
+ (m) => {
250
+ const [I, ...O] = H().map((x) => x.ref.current), [C] = O.slice(-1), w = document.activeElement;
251
+ for (const x of m)
252
+ if (x === w || (x == null || x.scrollIntoView({ block: "nearest" }), x === I && A && (A.scrollTop = 0), x === C && A && (A.scrollTop = A.scrollHeight), x == null || x.focus(), document.activeElement !== w)) return;
1238
253
  },
1239
- [$, E]
1240
- ), F = s.useCallback(
1241
- () => U([N, C]),
1242
- [U, N, C]
254
+ [H, A]
255
+ ), z = l.useCallback(
256
+ () => E([k, h]),
257
+ [E, k, h]
1243
258
  );
1244
- s.useEffect(() => {
1245
- W && F();
1246
- }, [W, F]);
1247
- const { onOpenChange: z, triggerPointerDownPosRef: Y } = m;
1248
- s.useEffect(() => {
1249
- if (C) {
1250
- let b = { x: 0, y: 0 };
1251
- const I = (T) => {
1252
- var P, R;
1253
- b = {
1254
- x: Math.abs(Math.round(T.pageX) - (((P = Y.current) == null ? void 0 : P.x) ?? 0)),
1255
- y: Math.abs(Math.round(T.pageY) - (((R = Y.current) == null ? void 0 : R.y) ?? 0))
259
+ l.useEffect(() => {
260
+ G && z();
261
+ }, [G, z]);
262
+ const { onOpenChange: U, triggerPointerDownPosRef: Y } = f;
263
+ l.useEffect(() => {
264
+ if (h) {
265
+ let m = { x: 0, y: 0 };
266
+ const I = (C) => {
267
+ var w, x;
268
+ m = {
269
+ x: Math.abs(Math.round(C.pageX) - (((w = Y.current) == null ? void 0 : w.x) ?? 0)),
270
+ y: Math.abs(Math.round(C.pageY) - (((x = Y.current) == null ? void 0 : x.y) ?? 0))
1256
271
  };
1257
- }, L = (T) => {
1258
- b.x <= 10 && b.y <= 10 ? T.preventDefault() : C.contains(T.target) || z(!1), document.removeEventListener("pointermove", I), Y.current = null;
272
+ }, O = (C) => {
273
+ m.x <= 10 && m.y <= 10 ? C.preventDefault() : h.contains(C.target) || U(!1), document.removeEventListener("pointermove", I), Y.current = null;
1259
274
  };
1260
- return Y.current !== null && (document.addEventListener("pointermove", I), document.addEventListener("pointerup", L, { capture: !0, once: !0 })), () => {
1261
- document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", L, { capture: !0 });
275
+ return Y.current !== null && (document.addEventListener("pointermove", I), document.addEventListener("pointerup", O, { capture: !0, once: !0 })), () => {
276
+ document.removeEventListener("pointermove", I), document.removeEventListener("pointerup", O, { capture: !0 });
1262
277
  };
1263
278
  }
1264
- }, [C, z, Y]), s.useEffect(() => {
1265
- const b = () => z(!1);
1266
- return window.addEventListener("blur", b), window.addEventListener("resize", b), () => {
1267
- window.removeEventListener("blur", b), window.removeEventListener("resize", b);
279
+ }, [h, U, Y]), l.useEffect(() => {
280
+ const m = () => U(!1);
281
+ return window.addEventListener("blur", m), window.addEventListener("resize", m), () => {
282
+ window.removeEventListener("blur", m), window.removeEventListener("resize", m);
1268
283
  };
1269
- }, [z]);
1270
- const [he, Q] = hn((b) => {
1271
- const I = $().filter((P) => !P.disabled), L = I.find((P) => P.ref.current === document.activeElement), T = vn(I, b, L);
1272
- T && setTimeout(() => T.ref.current.focus());
1273
- }), ve = s.useCallback(
1274
- (b, I, L) => {
1275
- const T = !M.current && !L;
1276
- (m.value !== void 0 && m.value === I || T) && (k(b), T && (M.current = !0));
284
+ }, [U]);
285
+ const [he, ie] = at((m) => {
286
+ const I = H().filter((w) => !w.disabled), O = I.find((w) => w.ref.current === document.activeElement), C = it(I, m, O);
287
+ C && setTimeout(() => C.ref.current.focus());
288
+ }), ge = l.useCallback(
289
+ (m, I, O) => {
290
+ const C = !F.current && !O;
291
+ (f.value !== void 0 && f.value === I || C) && (j(m), C && (F.current = !0));
1277
292
  },
1278
- [m.value]
1279
- ), ge = s.useCallback(() => C == null ? void 0 : C.focus(), [C]), ee = s.useCallback(
1280
- (b, I, L) => {
1281
- const T = !M.current && !L;
1282
- (m.value !== void 0 && m.value === I || T) && G(b);
293
+ [f.value]
294
+ ), ve = l.useCallback(() => h == null ? void 0 : h.focus(), [h]), re = l.useCallback(
295
+ (m, I, O) => {
296
+ const C = !F.current && !O;
297
+ (f.value !== void 0 && f.value === I || C) && V(m);
1283
298
  },
1284
- [m.value]
1285
- ), le = r === "popper" ? $e : en, se = le === $e ? {
1286
- side: o,
1287
- sideOffset: u,
1288
- align: d,
1289
- alignOffset: g,
1290
- arrowPadding: S,
1291
- collisionBoundary: w,
1292
- collisionPadding: y,
1293
- sticky: f,
1294
- hideWhenDetached: l,
1295
- avoidCollisions: h
299
+ [f.value]
300
+ ), de = r === "popper" ? ye : $e, ce = de === ye ? {
301
+ side: a,
302
+ sideOffset: s,
303
+ align: p,
304
+ alignOffset: v,
305
+ arrowPadding: _,
306
+ collisionBoundary: T,
307
+ collisionPadding: b,
308
+ sticky: S,
309
+ hideWhenDetached: u,
310
+ avoidCollisions: g
1296
311
  } : {};
1297
- return /* @__PURE__ */ v(
1298
- Qt,
312
+ return /* @__PURE__ */ i(
313
+ Ge,
1299
314
  {
1300
- scope: n,
1301
- content: C,
1302
- viewport: E,
1303
- onViewportChange: A,
1304
- itemRefCallback: ve,
1305
- selectedItem: N,
1306
- onItemLeave: ge,
1307
- itemTextRefCallback: ee,
1308
- focusSelectedItem: F,
1309
- selectedItemText: H,
315
+ scope: e,
316
+ content: h,
317
+ viewport: A,
318
+ onViewportChange: se,
319
+ itemRefCallback: ge,
320
+ selectedItem: k,
321
+ onItemLeave: ve,
322
+ itemTextRefCallback: re,
323
+ focusSelectedItem: z,
324
+ selectedItemText: Q,
1310
325
  position: r,
1311
- isPositioned: W,
326
+ isPositioned: G,
1312
327
  searchRef: he,
1313
- children: /* @__PURE__ */ v($t, { as: ze, allowPinchZoom: !0, children: /* @__PURE__ */ v(
1314
- bt,
328
+ children: /* @__PURE__ */ i(Ct, { as: Ut, allowPinchZoom: !0, children: /* @__PURE__ */ i(
329
+ It,
1315
330
  {
1316
331
  asChild: !0,
1317
- trapped: m.open,
1318
- onMountAutoFocus: (b) => {
1319
- b.preventDefault();
332
+ trapped: f.open,
333
+ onMountAutoFocus: (m) => {
334
+ m.preventDefault();
1320
335
  },
1321
- onUnmountAutoFocus: B(a, (b) => {
336
+ onUnmountAutoFocus: P(n, (m) => {
1322
337
  var I;
1323
- (I = m.trigger) == null || I.focus({ preventScroll: !0 }), b.preventDefault();
338
+ (I = f.trigger) == null || I.focus({ preventScroll: !0 }), m.preventDefault();
1324
339
  }),
1325
- children: /* @__PURE__ */ v(
1326
- yt,
340
+ children: /* @__PURE__ */ i(
341
+ Tt,
1327
342
  {
1328
343
  asChild: !0,
1329
344
  disableOutsidePointerEvents: !0,
1330
- onEscapeKeyDown: i,
345
+ onEscapeKeyDown: d,
1331
346
  onPointerDownOutside: c,
1332
- onFocusOutside: (b) => b.preventDefault(),
1333
- onDismiss: () => m.onOpenChange(!1),
1334
- children: /* @__PURE__ */ v(
1335
- le,
347
+ onFocusOutside: (m) => m.preventDefault(),
348
+ onDismiss: () => f.onOpenChange(!1),
349
+ children: /* @__PURE__ */ i(
350
+ de,
1336
351
  {
1337
352
  role: "listbox",
1338
- id: m.contentId,
1339
- "data-state": m.open ? "open" : "closed",
1340
- dir: m.dir,
1341
- onContextMenu: (b) => b.preventDefault(),
1342
- ...p,
1343
- ...se,
1344
- onPlaced: () => Z(!0),
1345
- ref: _,
353
+ id: f.contentId,
354
+ "data-state": f.open ? "open" : "closed",
355
+ dir: f.dir,
356
+ onContextMenu: (m) => m.preventDefault(),
357
+ ...y,
358
+ ...ce,
359
+ onPlaced: () => W(!0),
360
+ ref: R,
1346
361
  style: {
1347
362
  // flex layout so we can place the scroll buttons properly
1348
363
  display: "flex",
1349
364
  flexDirection: "column",
1350
365
  // reset the outline by default as the content MAY get focused
1351
366
  outline: "none",
1352
- ...p.style
367
+ ...y.style
1353
368
  },
1354
- onKeyDown: B(p.onKeyDown, (b) => {
1355
- const I = b.ctrlKey || b.altKey || b.metaKey;
1356
- if (b.key === "Tab" && b.preventDefault(), !I && b.key.length === 1 && Q(b.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(b.key)) {
1357
- let T = $().filter((P) => !P.disabled).map((P) => P.ref.current);
1358
- if (["ArrowUp", "End"].includes(b.key) && (T = T.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(b.key)) {
1359
- const P = b.target, R = T.indexOf(P);
1360
- T = T.slice(R + 1);
369
+ onKeyDown: P(y.onKeyDown, (m) => {
370
+ const I = m.ctrlKey || m.altKey || m.metaKey;
371
+ if (m.key === "Tab" && m.preventDefault(), !I && m.key.length === 1 && ie(m.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(m.key)) {
372
+ let C = H().filter((w) => !w.disabled).map((w) => w.ref.current);
373
+ if (["ArrowUp", "End"].includes(m.key) && (C = C.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(m.key)) {
374
+ const w = m.target, x = C.indexOf(w);
375
+ C = C.slice(x + 1);
1361
376
  }
1362
- setTimeout(() => U(T)), b.preventDefault();
377
+ setTimeout(() => E(C)), m.preventDefault();
1363
378
  }
1364
379
  })
1365
380
  }
@@ -1372,92 +387,103 @@ var J = 10, [Qt, ae] = me(ie), mo = "SelectContentImpl", Jt = s.forwardRef(
1372
387
  );
1373
388
  }
1374
389
  );
1375
- Jt.displayName = mo;
1376
- var ho = "SelectItemAlignedPosition", en = s.forwardRef((e, t) => {
1377
- const { __scopeSelect: n, onPlaced: r, ...a } = e, i = oe(ie, n), c = ae(ie, n), [o, u] = s.useState(null), [d, g] = s.useState(null), S = K(t, (_) => g(_)), w = Ae(n), y = s.useRef(!1), f = s.useRef(!0), { viewport: l, selectedItem: h, selectedItemText: p, focusSelectedItem: m } = c, C = s.useCallback(() => {
1378
- if (i.trigger && i.valueNode && o && d && l && h && p) {
1379
- const _ = i.trigger.getBoundingClientRect(), N = d.getBoundingClientRect(), k = i.valueNode.getBoundingClientRect(), H = p.getBoundingClientRect();
1380
- if (i.dir !== "rtl") {
1381
- const P = H.left - N.left, R = k.left - P, V = _.left - R, q = _.width + V, Se = Math.max(q, N.width), we = window.innerWidth - J, ye = Je(R, [J, we - Se]);
1382
- o.style.minWidth = q + "px", o.style.left = ye + "px";
390
+ Ye.displayName = Ft;
391
+ var Kt = "SelectItemAlignedPosition", $e = l.forwardRef((t, o) => {
392
+ const { __scopeSelect: e, onPlaced: r, ...n } = t, d = Z(ne, e), c = J(ne, e), [a, s] = l.useState(null), [p, v] = l.useState(null), _ = B(o, (R) => v(R)), T = fe(e), b = l.useRef(!1), S = l.useRef(!0), { viewport: u, selectedItem: g, selectedItemText: y, focusSelectedItem: f } = c, h = l.useCallback(() => {
393
+ if (d.trigger && d.valueNode && a && p && u && g && y) {
394
+ const R = d.trigger.getBoundingClientRect(), k = p.getBoundingClientRect(), j = d.valueNode.getBoundingClientRect(), Q = y.getBoundingClientRect();
395
+ if (d.dir !== "rtl") {
396
+ const w = Q.left - k.left, x = j.left - w, ee = R.left - x, te = R.width + ee, _e = Math.max(te, k.width), Se = window.innerWidth - L, we = Ee(x, [
397
+ L,
398
+ // Prevents the content from going off the starting edge of the
399
+ // viewport. It may still go off the ending edge, but this can be
400
+ // controlled by the user since they may want to manage overflow in a
401
+ // specific way.
402
+ // https://github.com/radix-ui/primitives/issues/2049
403
+ Math.max(L, Se - _e)
404
+ ]);
405
+ a.style.minWidth = te + "px", a.style.left = we + "px";
1383
406
  } else {
1384
- const P = N.right - H.right, R = window.innerWidth - k.right - P, V = window.innerWidth - _.right - R, q = _.width + V, Se = Math.max(q, N.width), we = window.innerWidth - J, ye = Je(R, [J, we - Se]);
1385
- o.style.minWidth = q + "px", o.style.right = ye + "px";
407
+ const w = k.right - Q.right, x = window.innerWidth - j.right - w, ee = window.innerWidth - R.right - x, te = R.width + ee, _e = Math.max(te, k.width), Se = window.innerWidth - L, we = Ee(x, [
408
+ L,
409
+ Math.max(L, Se - _e)
410
+ ]);
411
+ a.style.minWidth = te + "px", a.style.right = we + "px";
1386
412
  }
1387
- const G = w(), $ = window.innerHeight - J * 2, W = l.scrollHeight, Z = window.getComputedStyle(d), M = parseInt(Z.borderTopWidth, 10), U = parseInt(Z.paddingTop, 10), F = parseInt(Z.borderBottomWidth, 10), z = parseInt(Z.paddingBottom, 10), Y = M + U + W + z + F, he = Math.min(h.offsetHeight * 5, Y), Q = window.getComputedStyle(l), ve = parseInt(Q.paddingTop, 10), ge = parseInt(Q.paddingBottom, 10), ee = _.top + _.height / 2 - J, le = $ - ee, se = h.offsetHeight / 2, b = h.offsetTop + se, I = M + U + b, L = Y - I;
1388
- if (I <= ee) {
1389
- const P = h === G[G.length - 1].ref.current;
1390
- o.style.bottom = "0px";
1391
- const R = d.clientHeight - l.offsetTop - l.offsetHeight, V = Math.max(
1392
- le,
1393
- se + // viewport might have padding bottom, include it to avoid a scrollable viewport
1394
- (P ? ge : 0) + R + F
1395
- ), q = I + V;
1396
- o.style.height = q + "px";
413
+ const V = T(), H = window.innerHeight - L * 2, G = u.scrollHeight, W = window.getComputedStyle(p), F = parseInt(W.borderTopWidth, 10), E = parseInt(W.paddingTop, 10), z = parseInt(W.borderBottomWidth, 10), U = parseInt(W.paddingBottom, 10), Y = F + E + G + U + z, he = Math.min(g.offsetHeight * 5, Y), ie = window.getComputedStyle(u), ge = parseInt(ie.paddingTop, 10), ve = parseInt(ie.paddingBottom, 10), re = R.top + R.height / 2 - L, de = H - re, ce = g.offsetHeight / 2, m = g.offsetTop + ce, I = F + E + m, O = Y - I;
414
+ if (I <= re) {
415
+ const w = V.length > 0 && g === V[V.length - 1].ref.current;
416
+ a.style.bottom = "0px";
417
+ const x = p.clientHeight - u.offsetTop - u.offsetHeight, ee = Math.max(
418
+ de,
419
+ ce + // viewport might have padding bottom, include it to avoid a scrollable viewport
420
+ (w ? ve : 0) + x + z
421
+ ), te = I + ee;
422
+ a.style.height = te + "px";
1397
423
  } else {
1398
- const P = h === G[0].ref.current;
1399
- o.style.top = "0px";
1400
- const V = Math.max(
1401
- ee,
1402
- M + l.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
1403
- (P ? ve : 0) + se
1404
- ) + L;
1405
- o.style.height = V + "px", l.scrollTop = I - ee + l.offsetTop;
424
+ const w = V.length > 0 && g === V[0].ref.current;
425
+ a.style.top = "0px";
426
+ const ee = Math.max(
427
+ re,
428
+ F + u.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
429
+ (w ? ge : 0) + ce
430
+ ) + O;
431
+ a.style.height = ee + "px", u.scrollTop = I - re + u.offsetTop;
1406
432
  }
1407
- o.style.margin = `${J}px 0`, o.style.minHeight = he + "px", o.style.maxHeight = $ + "px", r == null || r(), requestAnimationFrame(() => y.current = !0);
433
+ a.style.margin = `${L}px 0`, a.style.minHeight = he + "px", a.style.maxHeight = H + "px", r == null || r(), requestAnimationFrame(() => b.current = !0);
1408
434
  }
1409
435
  }, [
1410
- w,
1411
- i.trigger,
1412
- i.valueNode,
1413
- o,
1414
- d,
1415
- l,
1416
- h,
436
+ T,
437
+ d.trigger,
438
+ d.valueNode,
439
+ a,
1417
440
  p,
1418
- i.dir,
441
+ u,
442
+ g,
443
+ y,
444
+ d.dir,
1419
445
  r
1420
446
  ]);
1421
- X(() => C(), [C]);
1422
- const [x, E] = s.useState();
1423
- X(() => {
1424
- d && E(window.getComputedStyle(d).zIndex);
1425
- }, [d]);
1426
- const A = s.useCallback(
1427
- (_) => {
1428
- _ && f.current === !0 && (C(), m == null || m(), f.current = !1);
447
+ K(() => h(), [h]);
448
+ const [M, A] = l.useState();
449
+ K(() => {
450
+ p && A(window.getComputedStyle(p).zIndex);
451
+ }, [p]);
452
+ const se = l.useCallback(
453
+ (R) => {
454
+ R && S.current === !0 && (h(), f == null || f(), S.current = !1);
1429
455
  },
1430
- [C, m]
456
+ [h, f]
1431
457
  );
1432
- return /* @__PURE__ */ v(
1433
- go,
458
+ return /* @__PURE__ */ i(
459
+ Gt,
1434
460
  {
1435
- scope: n,
1436
- contentWrapper: o,
1437
- shouldExpandOnScrollRef: y,
1438
- onScrollButtonChange: A,
1439
- children: /* @__PURE__ */ v(
461
+ scope: e,
462
+ contentWrapper: a,
463
+ shouldExpandOnScrollRef: b,
464
+ onScrollButtonChange: se,
465
+ children: /* @__PURE__ */ i(
1440
466
  "div",
1441
467
  {
1442
- ref: u,
468
+ ref: s,
1443
469
  style: {
1444
470
  display: "flex",
1445
471
  flexDirection: "column",
1446
472
  position: "fixed",
1447
- zIndex: x
473
+ zIndex: M
1448
474
  },
1449
- children: /* @__PURE__ */ v(
1450
- O.div,
475
+ children: /* @__PURE__ */ i(
476
+ N.div,
1451
477
  {
1452
- ...a,
1453
- ref: S,
478
+ ...n,
479
+ ref: _,
1454
480
  style: {
1455
481
  // When we get the height of the content, it includes borders. If we were to set
1456
482
  // the height without having `boxSizing: 'border-box'` it would be too big.
1457
483
  boxSizing: "border-box",
1458
484
  // We need to ensure the content doesn't get taller than the wrapper
1459
485
  maxHeight: "100%",
1460
- ...a.style
486
+ ...n.style
1461
487
  }
1462
488
  }
1463
489
  )
@@ -1466,26 +492,26 @@ var ho = "SelectItemAlignedPosition", en = s.forwardRef((e, t) => {
1466
492
  }
1467
493
  );
1468
494
  });
1469
- en.displayName = ho;
1470
- var vo = "SelectPopperPosition", $e = s.forwardRef((e, t) => {
495
+ $e.displayName = Kt;
496
+ var jt = "SelectPopperPosition", ye = l.forwardRef((t, o) => {
1471
497
  const {
1472
- __scopeSelect: n,
498
+ __scopeSelect: e,
1473
499
  align: r = "start",
1474
- collisionPadding: a = J,
1475
- ...i
1476
- } = e, c = Oe(n);
1477
- return /* @__PURE__ */ v(
1478
- Tr,
500
+ collisionPadding: n = L,
501
+ ...d
502
+ } = t, c = me(e);
503
+ return /* @__PURE__ */ i(
504
+ bt,
1479
505
  {
1480
506
  ...c,
1481
- ...i,
1482
- ref: t,
507
+ ...d,
508
+ ref: o,
1483
509
  align: r,
1484
- collisionPadding: a,
510
+ collisionPadding: n,
1485
511
  style: {
1486
512
  // Ensure border-box for floating-ui calculations
1487
513
  boxSizing: "border-box",
1488
- ...i.style,
514
+ ...d.style,
1489
515
  "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
1490
516
  "--radix-select-content-available-width": "var(--radix-popper-available-width)",
1491
517
  "--radix-select-content-available-height": "var(--radix-popper-available-height)",
@@ -1495,12 +521,12 @@ var vo = "SelectPopperPosition", $e = s.forwardRef((e, t) => {
1495
521
  }
1496
522
  );
1497
523
  });
1498
- $e.displayName = vo;
1499
- var [go, Qe] = me(ie, {}), Ue = "SelectViewport", tn = s.forwardRef(
1500
- (e, t) => {
1501
- const { __scopeSelect: n, nonce: r, ...a } = e, i = ae(Ue, n), c = Qe(Ue, n), o = K(t, i.onViewportChange), u = s.useRef(0);
1502
- return /* @__PURE__ */ ne(Xe, { children: [
1503
- /* @__PURE__ */ v(
524
+ ye.displayName = jt;
525
+ var [Gt, Re] = le(ne, {}), Ce = "SelectViewport", qe = l.forwardRef(
526
+ (t, o) => {
527
+ const { __scopeSelect: e, nonce: r, ...n } = t, d = J(Ce, e), c = Re(Ce, e), a = B(o, d.onViewportChange), s = l.useRef(0);
528
+ return /* @__PURE__ */ $(Pe, { children: [
529
+ /* @__PURE__ */ i(
1504
530
  "style",
1505
531
  {
1506
532
  dangerouslySetInnerHTML: {
@@ -1509,122 +535,134 @@ var [go, Qe] = me(ie, {}), Ue = "SelectViewport", tn = s.forwardRef(
1509
535
  nonce: r
1510
536
  }
1511
537
  ),
1512
- /* @__PURE__ */ v(Ie.Slot, { scope: n, children: /* @__PURE__ */ v(
1513
- O.div,
538
+ /* @__PURE__ */ i(pe.Slot, { scope: e, children: /* @__PURE__ */ i(
539
+ N.div,
1514
540
  {
1515
541
  "data-radix-select-viewport": "",
1516
542
  role: "presentation",
1517
- ...a,
1518
- ref: o,
543
+ ...n,
544
+ ref: a,
1519
545
  style: {
1520
546
  // we use position: 'relative' here on the `viewport` so that when we call
1521
547
  // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
1522
548
  // (independent of the scrollUpButton).
1523
549
  position: "relative",
1524
550
  flex: 1,
1525
- overflow: "auto",
1526
- ...a.style
551
+ // Viewport should only be scrollable in the vertical direction.
552
+ // This won't work in vertical writing modes, so we'll need to
553
+ // revisit this if/when that is supported
554
+ // https://developer.chrome.com/blog/vertical-form-controls
555
+ overflow: "hidden auto",
556
+ ...n.style
1527
557
  },
1528
- onScroll: B(a.onScroll, (d) => {
1529
- const g = d.currentTarget, { contentWrapper: S, shouldExpandOnScrollRef: w } = c;
1530
- if (w != null && w.current && S) {
1531
- const y = Math.abs(u.current - g.scrollTop);
1532
- if (y > 0) {
1533
- const f = window.innerHeight - J * 2, l = parseFloat(S.style.minHeight), h = parseFloat(S.style.height), p = Math.max(l, h);
1534
- if (p < f) {
1535
- const m = p + y, C = Math.min(f, m), x = m - C;
1536
- S.style.height = C + "px", S.style.bottom === "0px" && (g.scrollTop = x > 0 ? x : 0, S.style.justifyContent = "flex-end");
558
+ onScroll: P(n.onScroll, (p) => {
559
+ const v = p.currentTarget, { contentWrapper: _, shouldExpandOnScrollRef: T } = c;
560
+ if (T != null && T.current && _) {
561
+ const b = Math.abs(s.current - v.scrollTop);
562
+ if (b > 0) {
563
+ const S = window.innerHeight - L * 2, u = parseFloat(_.style.minHeight), g = parseFloat(_.style.height), y = Math.max(u, g);
564
+ if (y < S) {
565
+ const f = y + b, h = Math.min(S, f), M = f - h;
566
+ _.style.height = h + "px", _.style.bottom === "0px" && (v.scrollTop = M > 0 ? M : 0, _.style.justifyContent = "flex-end");
1537
567
  }
1538
568
  }
1539
569
  }
1540
- u.current = g.scrollTop;
570
+ s.current = v.scrollTop;
1541
571
  })
1542
572
  }
1543
573
  ) })
1544
574
  ] });
1545
575
  }
1546
576
  );
1547
- tn.displayName = Ue;
1548
- var nn = "SelectGroup", [So, wo] = me(nn), yo = s.forwardRef(
1549
- (e, t) => {
1550
- const { __scopeSelect: n, ...r } = e, a = Ge();
1551
- return /* @__PURE__ */ v(So, { scope: n, id: a, children: /* @__PURE__ */ v(O.div, { role: "group", "aria-labelledby": a, ...r, ref: t }) });
577
+ qe.displayName = Ce;
578
+ var Xe = "SelectGroup", [Yt, $t] = le(Xe), qt = l.forwardRef(
579
+ (t, o) => {
580
+ const { __scopeSelect: e, ...r } = t, n = Ne();
581
+ return /* @__PURE__ */ i(Yt, { scope: e, id: n, children: /* @__PURE__ */ i(N.div, { role: "group", "aria-labelledby": n, ...r, ref: o }) });
1552
582
  }
1553
583
  );
1554
- yo.displayName = nn;
1555
- var rn = "SelectLabel", Co = s.forwardRef(
1556
- (e, t) => {
1557
- const { __scopeSelect: n, ...r } = e, a = wo(rn, n);
1558
- return /* @__PURE__ */ v(O.div, { id: a.id, ...r, ref: t });
584
+ qt.displayName = Xe;
585
+ var Ze = "SelectLabel", Xt = l.forwardRef(
586
+ (t, o) => {
587
+ const { __scopeSelect: e, ...r } = t, n = $t(Ze, e);
588
+ return /* @__PURE__ */ i(N.div, { id: n.id, ...r, ref: o });
1559
589
  }
1560
590
  );
1561
- Co.displayName = rn;
1562
- var Te = "SelectItem", [bo, on] = me(Te), an = s.forwardRef(
1563
- (e, t) => {
591
+ Xt.displayName = Ze;
592
+ var ue = "SelectItem", [Zt, Je] = le(ue), Qe = l.forwardRef(
593
+ (t, o) => {
1564
594
  const {
1565
- __scopeSelect: n,
595
+ __scopeSelect: e,
1566
596
  value: r,
1567
- disabled: a = !1,
1568
- textValue: i,
597
+ disabled: n = !1,
598
+ textValue: d,
1569
599
  ...c
1570
- } = e, o = oe(Te, n), u = ae(Te, n), d = o.value === r, [g, S] = s.useState(i ?? ""), [w, y] = s.useState(!1), f = K(
1571
- t,
1572
- (p) => {
1573
- var m;
1574
- return (m = u.itemRefCallback) == null ? void 0 : m.call(u, p, r, a);
600
+ } = t, a = Z(ue, e), s = J(ue, e), p = a.value === r, [v, _] = l.useState(d ?? ""), [T, b] = l.useState(!1), S = B(
601
+ o,
602
+ (f) => {
603
+ var h;
604
+ return (h = s.itemRefCallback) == null ? void 0 : h.call(s, f, r, n);
1575
605
  }
1576
- ), l = Ge(), h = () => {
1577
- a || (o.onValueChange(r), o.onOpenChange(!1));
606
+ ), u = Ne(), g = l.useRef("touch"), y = () => {
607
+ n || (a.onValueChange(r), a.onOpenChange(!1));
1578
608
  };
1579
609
  if (r === "")
1580
610
  throw new Error(
1581
611
  "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."
1582
612
  );
1583
- return /* @__PURE__ */ v(
1584
- bo,
613
+ return /* @__PURE__ */ i(
614
+ Zt,
1585
615
  {
1586
- scope: n,
616
+ scope: e,
1587
617
  value: r,
1588
- disabled: a,
1589
- textId: l,
1590
- isSelected: d,
1591
- onItemTextChange: s.useCallback((p) => {
1592
- S((m) => m || ((p == null ? void 0 : p.textContent) ?? "").trim());
618
+ disabled: n,
619
+ textId: u,
620
+ isSelected: p,
621
+ onItemTextChange: l.useCallback((f) => {
622
+ _((h) => h || ((f == null ? void 0 : f.textContent) ?? "").trim());
1593
623
  }, []),
1594
- children: /* @__PURE__ */ v(
1595
- Ie.ItemSlot,
624
+ children: /* @__PURE__ */ i(
625
+ pe.ItemSlot,
1596
626
  {
1597
- scope: n,
627
+ scope: e,
1598
628
  value: r,
1599
- disabled: a,
1600
- textValue: g,
1601
- children: /* @__PURE__ */ v(
1602
- O.div,
629
+ disabled: n,
630
+ textValue: v,
631
+ children: /* @__PURE__ */ i(
632
+ N.div,
1603
633
  {
1604
634
  role: "option",
1605
- "aria-labelledby": l,
1606
- "data-highlighted": w ? "" : void 0,
1607
- "aria-selected": d && w,
1608
- "data-state": d ? "checked" : "unchecked",
1609
- "aria-disabled": a || void 0,
1610
- "data-disabled": a ? "" : void 0,
1611
- tabIndex: a ? void 0 : -1,
635
+ "aria-labelledby": u,
636
+ "data-highlighted": T ? "" : void 0,
637
+ "aria-selected": p && T,
638
+ "data-state": p ? "checked" : "unchecked",
639
+ "aria-disabled": n || void 0,
640
+ "data-disabled": n ? "" : void 0,
641
+ tabIndex: n ? void 0 : -1,
1612
642
  ...c,
1613
- ref: f,
1614
- onFocus: B(c.onFocus, () => y(!0)),
1615
- onBlur: B(c.onBlur, () => y(!1)),
1616
- onPointerUp: B(c.onPointerUp, h),
1617
- onPointerMove: B(c.onPointerMove, (p) => {
1618
- var m;
1619
- a ? (m = u.onItemLeave) == null || m.call(u) : p.currentTarget.focus({ preventScroll: !0 });
643
+ ref: S,
644
+ onFocus: P(c.onFocus, () => b(!0)),
645
+ onBlur: P(c.onBlur, () => b(!1)),
646
+ onClick: P(c.onClick, () => {
647
+ g.current !== "mouse" && y();
648
+ }),
649
+ onPointerUp: P(c.onPointerUp, () => {
650
+ g.current === "mouse" && y();
651
+ }),
652
+ onPointerDown: P(c.onPointerDown, (f) => {
653
+ g.current = f.pointerType;
654
+ }),
655
+ onPointerMove: P(c.onPointerMove, (f) => {
656
+ var h;
657
+ g.current = f.pointerType, n ? (h = s.onItemLeave) == null || h.call(s) : g.current === "mouse" && f.currentTarget.focus({ preventScroll: !0 });
1620
658
  }),
1621
- onPointerLeave: B(c.onPointerLeave, (p) => {
1622
- var m;
1623
- p.currentTarget === document.activeElement && ((m = u.onItemLeave) == null || m.call(u));
659
+ onPointerLeave: P(c.onPointerLeave, (f) => {
660
+ var h;
661
+ f.currentTarget === document.activeElement && ((h = s.onItemLeave) == null || h.call(s));
1624
662
  }),
1625
- onKeyDown: B(c.onKeyDown, (p) => {
1626
- var C;
1627
- ((C = u.searchRef) == null ? void 0 : C.current) !== "" && p.key === " " || (so.includes(p.key) && h(), p.key === " " && p.preventDefault());
663
+ onKeyDown: P(c.onKeyDown, (f) => {
664
+ var M;
665
+ ((M = s.searchRef) == null ? void 0 : M.current) !== "" && f.key === " " || (Lt.includes(f.key) && y(), f.key === " " && f.preventDefault());
1628
666
  })
1629
667
  }
1630
668
  )
@@ -1634,240 +672,250 @@ var Te = "SelectItem", [bo, on] = me(Te), an = s.forwardRef(
1634
672
  );
1635
673
  }
1636
674
  );
1637
- an.displayName = Te;
1638
- var Ce = "SelectItemText", sn = s.forwardRef(
1639
- (e, t) => {
1640
- const { __scopeSelect: n, className: r, style: a, ...i } = e, c = oe(Ce, n), o = ae(Ce, n), u = on(Ce, n), d = uo(Ce, n), [g, S] = s.useState(null), w = K(
1641
- t,
1642
- (p) => S(p),
1643
- u.onItemTextChange,
1644
- (p) => {
1645
- var m;
1646
- return (m = o.itemTextRefCallback) == null ? void 0 : m.call(o, p, u.value, u.disabled);
675
+ Qe.displayName = ue;
676
+ var ae = "SelectItemText", et = l.forwardRef(
677
+ (t, o) => {
678
+ const { __scopeSelect: e, className: r, style: n, ...d } = t, c = Z(ae, e), a = J(ae, e), s = Je(ae, e), p = Vt(ae, e), [v, _] = l.useState(null), T = B(
679
+ o,
680
+ (y) => _(y),
681
+ s.onItemTextChange,
682
+ (y) => {
683
+ var f;
684
+ return (f = a.itemTextRefCallback) == null ? void 0 : f.call(a, y, s.value, s.disabled);
1647
685
  }
1648
- ), y = g == null ? void 0 : g.textContent, f = s.useMemo(
1649
- () => /* @__PURE__ */ v("option", { value: u.value, disabled: u.disabled, children: y }, u.value),
1650
- [u.disabled, u.value, y]
1651
- ), { onNativeOptionAdd: l, onNativeOptionRemove: h } = d;
1652
- return X(() => (l(f), () => h(f)), [l, h, f]), /* @__PURE__ */ ne(Xe, { children: [
1653
- /* @__PURE__ */ v(O.span, { id: u.textId, ...i, ref: w }),
1654
- u.isSelected && c.valueNode && !c.valueNodeHasChildren ? mt.createPortal(i.children, c.valueNode) : null
686
+ ), b = v == null ? void 0 : v.textContent, S = l.useMemo(
687
+ () => /* @__PURE__ */ i("option", { value: s.value, disabled: s.disabled, children: b }, s.value),
688
+ [s.disabled, s.value, b]
689
+ ), { onNativeOptionAdd: u, onNativeOptionRemove: g } = p;
690
+ return K(() => (u(S), () => g(S)), [u, g, S]), /* @__PURE__ */ $(Pe, { children: [
691
+ /* @__PURE__ */ i(N.span, { id: s.textId, ...d, ref: T }),
692
+ s.isSelected && c.valueNode && !c.valueNodeHasChildren ? De.createPortal(d.children, c.valueNode) : null
1655
693
  ] });
1656
694
  }
1657
695
  );
1658
- sn.displayName = Ce;
1659
- var cn = "SelectItemIndicator", ln = s.forwardRef(
1660
- (e, t) => {
1661
- const { __scopeSelect: n, ...r } = e;
1662
- return on(cn, n).isSelected ? /* @__PURE__ */ v(O.span, { "aria-hidden": !0, ...r, ref: t }) : null;
696
+ et.displayName = ae;
697
+ var tt = "SelectItemIndicator", ot = l.forwardRef(
698
+ (t, o) => {
699
+ const { __scopeSelect: e, ...r } = t;
700
+ return Je(tt, e).isSelected ? /* @__PURE__ */ i(N.span, { "aria-hidden": !0, ...r, ref: o }) : null;
1663
701
  }
1664
702
  );
1665
- ln.displayName = cn;
1666
- var Ke = "SelectScrollUpButton", un = s.forwardRef((e, t) => {
1667
- const n = ae(Ke, e.__scopeSelect), r = Qe(Ke, e.__scopeSelect), [a, i] = s.useState(!1), c = K(t, r.onScrollButtonChange);
1668
- return X(() => {
1669
- if (n.viewport && n.isPositioned) {
1670
- let o = function() {
1671
- const d = u.scrollTop > 0;
1672
- i(d);
703
+ ot.displayName = tt;
704
+ var Ie = "SelectScrollUpButton", nt = l.forwardRef((t, o) => {
705
+ const e = J(Ie, t.__scopeSelect), r = Re(Ie, t.__scopeSelect), [n, d] = l.useState(!1), c = B(o, r.onScrollButtonChange);
706
+ return K(() => {
707
+ if (e.viewport && e.isPositioned) {
708
+ let a = function() {
709
+ const p = s.scrollTop > 0;
710
+ d(p);
1673
711
  };
1674
- const u = n.viewport;
1675
- return o(), u.addEventListener("scroll", o), () => u.removeEventListener("scroll", o);
712
+ const s = e.viewport;
713
+ return a(), s.addEventListener("scroll", a), () => s.removeEventListener("scroll", a);
1676
714
  }
1677
- }, [n.viewport, n.isPositioned]), a ? /* @__PURE__ */ v(
1678
- fn,
715
+ }, [e.viewport, e.isPositioned]), n ? /* @__PURE__ */ i(
716
+ lt,
1679
717
  {
1680
- ...e,
718
+ ...t,
1681
719
  ref: c,
1682
720
  onAutoScroll: () => {
1683
- const { viewport: o, selectedItem: u } = n;
1684
- o && u && (o.scrollTop = o.scrollTop - u.offsetHeight);
721
+ const { viewport: a, selectedItem: s } = e;
722
+ a && s && (a.scrollTop = a.scrollTop - s.offsetHeight);
1685
723
  }
1686
724
  }
1687
725
  ) : null;
1688
726
  });
1689
- un.displayName = Ke;
1690
- var Ye = "SelectScrollDownButton", dn = s.forwardRef((e, t) => {
1691
- const n = ae(Ye, e.__scopeSelect), r = Qe(Ye, e.__scopeSelect), [a, i] = s.useState(!1), c = K(t, r.onScrollButtonChange);
1692
- return X(() => {
1693
- if (n.viewport && n.isPositioned) {
1694
- let o = function() {
1695
- const d = u.scrollHeight - u.clientHeight, g = Math.ceil(u.scrollTop) < d;
1696
- i(g);
727
+ nt.displayName = Ie;
728
+ var Te = "SelectScrollDownButton", rt = l.forwardRef((t, o) => {
729
+ const e = J(Te, t.__scopeSelect), r = Re(Te, t.__scopeSelect), [n, d] = l.useState(!1), c = B(o, r.onScrollButtonChange);
730
+ return K(() => {
731
+ if (e.viewport && e.isPositioned) {
732
+ let a = function() {
733
+ const p = s.scrollHeight - s.clientHeight, v = Math.ceil(s.scrollTop) < p;
734
+ d(v);
1697
735
  };
1698
- const u = n.viewport;
1699
- return o(), u.addEventListener("scroll", o), () => u.removeEventListener("scroll", o);
736
+ const s = e.viewport;
737
+ return a(), s.addEventListener("scroll", a), () => s.removeEventListener("scroll", a);
1700
738
  }
1701
- }, [n.viewport, n.isPositioned]), a ? /* @__PURE__ */ v(
1702
- fn,
739
+ }, [e.viewport, e.isPositioned]), n ? /* @__PURE__ */ i(
740
+ lt,
1703
741
  {
1704
- ...e,
742
+ ...t,
1705
743
  ref: c,
1706
744
  onAutoScroll: () => {
1707
- const { viewport: o, selectedItem: u } = n;
1708
- o && u && (o.scrollTop = o.scrollTop + u.offsetHeight);
745
+ const { viewport: a, selectedItem: s } = e;
746
+ a && s && (a.scrollTop = a.scrollTop + s.offsetHeight);
1709
747
  }
1710
748
  }
1711
749
  ) : null;
1712
750
  });
1713
- dn.displayName = Ye;
1714
- var fn = s.forwardRef((e, t) => {
1715
- const { __scopeSelect: n, onAutoScroll: r, ...a } = e, i = ae("SelectScrollButton", n), c = s.useRef(null), o = Ae(n), u = s.useCallback(() => {
751
+ rt.displayName = Te;
752
+ var lt = l.forwardRef((t, o) => {
753
+ const { __scopeSelect: e, onAutoScroll: r, ...n } = t, d = J("SelectScrollButton", e), c = l.useRef(null), a = fe(e), s = l.useCallback(() => {
1716
754
  c.current !== null && (window.clearInterval(c.current), c.current = null);
1717
755
  }, []);
1718
- return s.useEffect(() => () => u(), [u]), X(() => {
1719
- var g;
1720
- const d = o().find((S) => S.ref.current === document.activeElement);
1721
- (g = d == null ? void 0 : d.ref.current) == null || g.scrollIntoView({ block: "nearest" });
1722
- }, [o]), /* @__PURE__ */ v(
1723
- O.div,
756
+ return l.useEffect(() => () => s(), [s]), K(() => {
757
+ var v;
758
+ const p = a().find((_) => _.ref.current === document.activeElement);
759
+ (v = p == null ? void 0 : p.ref.current) == null || v.scrollIntoView({ block: "nearest" });
760
+ }, [a]), /* @__PURE__ */ i(
761
+ N.div,
1724
762
  {
1725
763
  "aria-hidden": !0,
1726
- ...a,
1727
- ref: t,
1728
- style: { flexShrink: 0, ...a.style },
1729
- onPointerDown: B(a.onPointerDown, () => {
764
+ ...n,
765
+ ref: o,
766
+ style: { flexShrink: 0, ...n.style },
767
+ onPointerDown: P(n.onPointerDown, () => {
1730
768
  c.current === null && (c.current = window.setInterval(r, 50));
1731
769
  }),
1732
- onPointerMove: B(a.onPointerMove, () => {
1733
- var d;
1734
- (d = i.onItemLeave) == null || d.call(i), c.current === null && (c.current = window.setInterval(r, 50));
770
+ onPointerMove: P(n.onPointerMove, () => {
771
+ var p;
772
+ (p = d.onItemLeave) == null || p.call(d), c.current === null && (c.current = window.setInterval(r, 50));
1735
773
  }),
1736
- onPointerLeave: B(a.onPointerLeave, () => {
1737
- u();
774
+ onPointerLeave: P(n.onPointerLeave, () => {
775
+ s();
1738
776
  })
1739
777
  }
1740
778
  );
1741
- }), xo = "SelectSeparator", _o = s.forwardRef(
1742
- (e, t) => {
1743
- const { __scopeSelect: n, ...r } = e;
1744
- return /* @__PURE__ */ v(O.div, { "aria-hidden": !0, ...r, ref: t });
779
+ }), Jt = "SelectSeparator", Qt = l.forwardRef(
780
+ (t, o) => {
781
+ const { __scopeSelect: e, ...r } = t;
782
+ return /* @__PURE__ */ i(N.div, { "aria-hidden": !0, ...r, ref: o });
1745
783
  }
1746
784
  );
1747
- _o.displayName = xo;
1748
- var je = "SelectArrow", Eo = s.forwardRef(
1749
- (e, t) => {
1750
- const { __scopeSelect: n, ...r } = e, a = Oe(n), i = oe(je, n), c = ae(je, n);
1751
- return i.open && c.position === "popper" ? /* @__PURE__ */ v(Nr, { ...a, ...r, ref: t }) : null;
785
+ Qt.displayName = Jt;
786
+ var be = "SelectArrow", eo = l.forwardRef(
787
+ (t, o) => {
788
+ const { __scopeSelect: e, ...r } = t, n = me(e), d = Z(be, e), c = J(be, e);
789
+ return d.open && c.position === "popper" ? /* @__PURE__ */ i(Pt, { ...n, ...r, ref: o }) : null;
1752
790
  }
1753
791
  );
1754
- Eo.displayName = je;
1755
- function pn(e) {
1756
- return e === "" || e === void 0;
1757
- }
1758
- var mn = s.forwardRef(
1759
- (e, t) => {
1760
- const { value: n, ...r } = e, a = s.useRef(null), i = K(t, a), c = Bn(n);
1761
- return s.useEffect(() => {
1762
- const o = a.current, u = window.HTMLSelectElement.prototype, g = Object.getOwnPropertyDescriptor(
1763
- u,
792
+ eo.displayName = be;
793
+ var to = "SelectBubbleInput", st = l.forwardRef(
794
+ ({ __scopeSelect: t, value: o, ...e }, r) => {
795
+ const n = l.useRef(null), d = B(r, n), c = Nt(o);
796
+ return l.useEffect(() => {
797
+ const a = n.current;
798
+ if (!a) return;
799
+ const s = window.HTMLSelectElement.prototype, v = Object.getOwnPropertyDescriptor(
800
+ s,
1764
801
  "value"
1765
802
  ).set;
1766
- if (c !== n && g) {
1767
- const S = new Event("change", { bubbles: !0 });
1768
- g.call(o, n), o.dispatchEvent(S);
803
+ if (c !== o && v) {
804
+ const _ = new Event("change", { bubbles: !0 });
805
+ v.call(a, o), a.dispatchEvent(_);
806
+ }
807
+ }, [c, o]), /* @__PURE__ */ i(
808
+ N.select,
809
+ {
810
+ ...e,
811
+ style: { ...ze, ...e.style },
812
+ ref: d,
813
+ defaultValue: o
1769
814
  }
1770
- }, [c, n]), /* @__PURE__ */ v(Bt, { asChild: !0, children: /* @__PURE__ */ v("select", { ...r, ref: i, defaultValue: n }) });
815
+ );
1771
816
  }
1772
817
  );
1773
- mn.displayName = "BubbleSelect";
1774
- function hn(e) {
1775
- const t = pe(e), n = s.useRef(""), r = s.useRef(0), a = s.useCallback(
818
+ st.displayName = to;
819
+ function ct(t) {
820
+ return t === "" || t === void 0;
821
+ }
822
+ function at(t) {
823
+ const o = wt(t), e = l.useRef(""), r = l.useRef(0), n = l.useCallback(
1776
824
  (c) => {
1777
- const o = n.current + c;
1778
- t(o), function u(d) {
1779
- n.current = d, window.clearTimeout(r.current), d !== "" && (r.current = window.setTimeout(() => u(""), 1e3));
1780
- }(o);
825
+ const a = e.current + c;
826
+ o(a), function s(p) {
827
+ e.current = p, window.clearTimeout(r.current), p !== "" && (r.current = window.setTimeout(() => s(""), 1e3));
828
+ }(a);
1781
829
  },
1782
- [t]
1783
- ), i = s.useCallback(() => {
1784
- n.current = "", window.clearTimeout(r.current);
830
+ [o]
831
+ ), d = l.useCallback(() => {
832
+ e.current = "", window.clearTimeout(r.current);
1785
833
  }, []);
1786
- return s.useEffect(() => () => window.clearTimeout(r.current), []), [n, a, i];
1787
- }
1788
- function vn(e, t, n) {
1789
- const a = t.length > 1 && Array.from(t).every((d) => d === t[0]) ? t[0] : t, i = n ? e.indexOf(n) : -1;
1790
- let c = Po(e, Math.max(i, 0));
1791
- a.length === 1 && (c = c.filter((d) => d !== n));
1792
- const u = c.find(
1793
- (d) => d.textValue.toLowerCase().startsWith(a.toLowerCase())
834
+ return l.useEffect(() => () => window.clearTimeout(r.current), []), [e, n, d];
835
+ }
836
+ function it(t, o, e) {
837
+ const n = o.length > 1 && Array.from(o).every((p) => p === o[0]) ? o[0] : o, d = e ? t.indexOf(e) : -1;
838
+ let c = oo(t, Math.max(d, 0));
839
+ n.length === 1 && (c = c.filter((p) => p !== e));
840
+ const s = c.find(
841
+ (p) => p.textValue.toLowerCase().startsWith(n.toLowerCase())
1794
842
  );
1795
- return u !== n ? u : void 0;
843
+ return s !== e ? s : void 0;
1796
844
  }
1797
- function Po(e, t) {
1798
- return e.map((n, r) => e[(t + r) % e.length]);
845
+ function oo(t, o) {
846
+ return t.map((e, r) => t[(o + r) % t.length]);
1799
847
  }
1800
- var Ro = Ut, To = Yt, No = Xt, Io = Gt, Ao = Zt, Oo = qt, Mo = tn, Lo = an, Do = sn, ko = ln, Bo = un, Fo = dn, gn = {
848
+ var no = Be, ro = He, lo = Fe, so = Ue, co = Ke, ao = je, io = qe, uo = Qe, po = et, fo = ot, mo = nt, ho = rt, dt = {
1801
849
  color: void 0,
1802
850
  size: void 0,
1803
851
  className: void 0,
1804
852
  style: void 0,
1805
853
  attr: void 0
1806
- }, ft = D.createContext && D.createContext(gn), re = function() {
1807
- return re = Object.assign || function(e) {
1808
- for (var t, n = 1, r = arguments.length; n < r; n++) {
1809
- t = arguments[n];
1810
- for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
854
+ }, Me = q.createContext && q.createContext(dt), X = function() {
855
+ return X = Object.assign || function(t) {
856
+ for (var o, e = 1, r = arguments.length; e < r; e++) {
857
+ o = arguments[e];
858
+ for (var n in o) Object.prototype.hasOwnProperty.call(o, n) && (t[n] = o[n]);
1811
859
  }
1812
- return e;
1813
- }, re.apply(this, arguments);
1814
- }, Wo = function(e, t) {
1815
- var n = {};
1816
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
1817
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, r = Object.getOwnPropertySymbols(e); a < r.length; a++)
1818
- t.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[a]) && (n[r[a]] = e[r[a]]);
1819
- return n;
860
+ return t;
861
+ }, X.apply(this, arguments);
862
+ }, go = function(t, o) {
863
+ var e = {};
864
+ for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && o.indexOf(r) < 0 && (e[r] = t[r]);
865
+ if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, r = Object.getOwnPropertySymbols(t); n < r.length; n++)
866
+ o.indexOf(r[n]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[n]) && (e[r[n]] = t[r[n]]);
867
+ return e;
1820
868
  };
1821
- function Sn(e) {
1822
- return e && e.map(function(t, n) {
1823
- return D.createElement(t.tag, re({
1824
- key: n
1825
- }, t.attr), Sn(t.child));
869
+ function ut(t) {
870
+ return t && t.map(function(o, e) {
871
+ return q.createElement(o.tag, X({
872
+ key: e
873
+ }, o.attr), ut(o.child));
1826
874
  });
1827
875
  }
1828
- function wn(e) {
1829
- return function(t) {
1830
- return D.createElement(zo, re({
1831
- attr: re({}, e.attr)
1832
- }, t), Sn(e.child));
876
+ function pt(t) {
877
+ return function(o) {
878
+ return q.createElement(vo, X({
879
+ attr: X({}, t.attr)
880
+ }, o), ut(t.child));
1833
881
  };
1834
882
  }
1835
- function zo(e) {
1836
- var t = function(n) {
1837
- var r = e.attr, a = e.size, i = e.title, c = Wo(e, ["attr", "size", "title"]), o = a || n.size || "1em", u;
1838
- return n.className && (u = n.className), e.className && (u = (u ? u + " " : "") + e.className), D.createElement("svg", re({
883
+ function vo(t) {
884
+ var o = function(e) {
885
+ var r = t.attr, n = t.size, d = t.title, c = go(t, ["attr", "size", "title"]), a = n || e.size || "1em", s;
886
+ return e.className && (s = e.className), t.className && (s = (s ? s + " " : "") + t.className), q.createElement("svg", X({
1839
887
  stroke: "currentColor",
1840
888
  fill: "currentColor",
1841
889
  strokeWidth: "0"
1842
- }, n.attr, r, c, {
1843
- className: u,
1844
- style: re(re({
1845
- color: e.color || n.color
1846
- }, n.style), e.style),
1847
- height: o,
1848
- width: o,
890
+ }, e.attr, r, c, {
891
+ className: s,
892
+ style: X(X({
893
+ color: t.color || e.color
894
+ }, e.style), t.style),
895
+ height: a,
896
+ width: a,
1849
897
  xmlns: "http://www.w3.org/2000/svg"
1850
- }), i && D.createElement("title", null, i), e.children);
898
+ }), d && q.createElement("title", null, d), t.children);
1851
899
  };
1852
- return ft !== void 0 ? D.createElement(ft.Consumer, null, function(n) {
1853
- return t(n);
1854
- }) : t(gn);
1855
- }
1856
- function pt(e) {
1857
- return wn({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z" } }] })(e);
1858
- }
1859
- function Vo(e) {
1860
- return wn({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708l6-6z" } }] })(e);
1861
- }
1862
- const Ho = "cfxui__Select__trigger__232e4", $o = "cfxui__Select__fullWidth__739d7", Uo = "cfxui__Select__icon__36b6c", Ko = "cfxui__Select__content__067da", Yo = "cfxui__Select__app__e0114", jo = "cfxui__Select__arrow__8e7eb", Xo = "cfxui__Select__option__2de5d", Go = "cfxui__Select__tickIcon__71e80", j = {
1863
- trigger: Ho,
1864
- fullWidth: $o,
1865
- icon: Uo,
1866
- content: Ko,
1867
- app: Yo,
1868
- arrow: jo,
1869
- option: Xo,
1870
- tickIcon: Go,
900
+ return Me !== void 0 ? q.createElement(Me.Consumer, null, function(e) {
901
+ return o(e);
902
+ }) : o(dt);
903
+ }
904
+ function Ae(t) {
905
+ return pt({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z" } }] })(t);
906
+ }
907
+ function _o(t) {
908
+ return pt({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708l6-6z" } }] })(t);
909
+ }
910
+ const So = "cfxui__Select__trigger__232e4", wo = "cfxui__Select__fullWidth__739d7", xo = "cfxui__Select__icon__36b6c", yo = "cfxui__Select__content__067da", Co = "cfxui__Select__app__e0114", Io = "cfxui__Select__arrow__8e7eb", To = "cfxui__Select__option__2de5d", bo = "cfxui__Select__tickIcon__71e80", D = {
911
+ trigger: So,
912
+ fullWidth: wo,
913
+ icon: xo,
914
+ content: yo,
915
+ app: Co,
916
+ arrow: Io,
917
+ option: To,
918
+ tickIcon: bo,
1871
919
  "select-size-initial-large": "cfxui__Select__select-size-initial-large__5e47d",
1872
920
  "select-size-initial-small": "cfxui__Select__select-size-initial-small__5ae12",
1873
921
  "select-size-small-large": "cfxui__Select__select-size-small-large__79811",
@@ -1882,43 +930,44 @@ const Ho = "cfxui__Select__trigger__232e4", $o = "cfxui__Select__fullWidth__739d
1882
930
  "select-size-large-small": "cfxui__Select__select-size-large-small__fb50b",
1883
931
  "select-size-xlarge-large": "cfxui__Select__select-size-xlarge-large__5abb1",
1884
932
  "select-size-xlarge-small": "cfxui__Select__select-size-xlarge-small__5ddbb"
1885
- }, da = D.forwardRef(function(t) {
933
+ };
934
+ function Vo(t) {
1886
935
  const {
1887
- value: n,
1888
- options: r,
1889
- onChange: a,
1890
- size: i = "normal",
1891
- placeholder: c,
1892
- disabled: o = !1,
1893
- fullWidth: u = !1,
1894
- className: d
1895
- } = t, [g, S] = D.useState(!1), w = Hn.getResponsiveFlatClassnames("select-size", i).map((l) => j[l]), y = Me(
1896
- d,
1897
- j.trigger,
1898
- w,
936
+ value: o,
937
+ options: e,
938
+ onChange: r,
939
+ size: n = "normal",
940
+ placeholder: d,
941
+ disabled: c = !1,
942
+ fullWidth: a = !1,
943
+ className: s
944
+ } = t, [p, v] = q.useState(!1), _ = Et.getResponsiveFlatClassnames("select-size", n).map((S) => D[S]), T = xe(
945
+ s,
946
+ D.trigger,
947
+ _,
1899
948
  {
1900
- [j.disabled]: o,
1901
- [j.fullWidth]: u
949
+ [D.disabled]: c,
950
+ [D.fullWidth]: a
1902
951
  }
1903
- ), f = Me(
1904
- j.content,
1905
- w
952
+ ), b = xe(
953
+ D.content,
954
+ _
1906
955
  );
1907
- return /* @__PURE__ */ ne(Ro, { value: n, onValueChange: a, onOpenChange: S, open: g, children: [
1908
- /* @__PURE__ */ ne(To, { disabled: o, className: y, children: [
1909
- /* @__PURE__ */ v(No, { placeholder: c }),
1910
- /* @__PURE__ */ v(Io, { className: j.icon, children: /* @__PURE__ */ v(pt, {}) })
956
+ return /* @__PURE__ */ $(no, { value: o, onValueChange: r, onOpenChange: v, open: p, children: [
957
+ /* @__PURE__ */ $(ro, { disabled: c, className: T, children: [
958
+ /* @__PURE__ */ i(lo, { placeholder: d }),
959
+ /* @__PURE__ */ i(so, { className: D.icon, children: /* @__PURE__ */ i(Ae, {}) })
1911
960
  ] }),
1912
- /* @__PURE__ */ v(Ao, { children: /* @__PURE__ */ ne(Oo, { className: f, children: [
1913
- /* @__PURE__ */ v(Bo, { className: j.arrow, children: /* @__PURE__ */ v(Vo, {}) }),
1914
- /* @__PURE__ */ v(Mo, { children: r.map((l) => /* @__PURE__ */ ne(Lo, { value: l.value, className: Me(j.option), children: [
1915
- /* @__PURE__ */ v(Do, { children: l.label }),
1916
- /* @__PURE__ */ v(ko, { className: j.indicator, children: /* @__PURE__ */ v(Vn, { name: "Tick", className: j.tickIcon }) })
1917
- ] }, l.value)) }),
1918
- /* @__PURE__ */ v(Fo, { className: j.arrow, children: /* @__PURE__ */ v(pt, {}) })
961
+ /* @__PURE__ */ i(co, { children: /* @__PURE__ */ $(ao, { className: b, children: [
962
+ /* @__PURE__ */ i(mo, { className: D.arrow, children: /* @__PURE__ */ i(_o, {}) }),
963
+ /* @__PURE__ */ i(io, { children: e.map((S) => /* @__PURE__ */ $(uo, { value: S.value, className: xe(D.option), children: [
964
+ /* @__PURE__ */ i(po, { children: S.label }),
965
+ /* @__PURE__ */ i(fo, { className: D.indicator, children: /* @__PURE__ */ i(Rt, { name: "Tick", className: D.tickIcon }) })
966
+ ] }, S.value)) }),
967
+ /* @__PURE__ */ i(ho, { className: D.arrow, children: /* @__PURE__ */ i(Ae, {}) })
1919
968
  ] }) })
1920
969
  ] });
1921
- });
970
+ }
1922
971
  export {
1923
- da as Select
972
+ Vo as Select
1924
973
  };