@konstructio/ui 0.1.2-alpha.3 → 0.1.2-alpha.30

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 (163) hide show
  1. package/dist/DatePicker.css +1 -1
  2. package/dist/Modal-5xSxFoaD.js +99 -0
  3. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  4. package/dist/chevron-down-DgT-uSF9.js +5 -0
  5. package/dist/chevron-right-DYvXLeql.js +7 -0
  6. package/dist/chevron-up-DrQr2Fwd.js +5 -0
  7. package/dist/components/Alert/Alert.js +2 -2
  8. package/dist/components/AlertDialog/AlertDialog.js +1 -1
  9. package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
  10. package/dist/components/AlertDialog/components/index.js +1 -1
  11. package/dist/components/Badge/Badge.js +30 -33
  12. package/dist/components/Badge/Badge.variants.js +8 -6
  13. package/dist/components/Breadcrumb/Breadcrumb.js +1 -1
  14. package/dist/components/Breadcrumb/components/Item/Item.js +24 -23
  15. package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
  16. package/dist/components/Button/Button.js +1 -1
  17. package/dist/components/Button/Button.variants.js +1 -1
  18. package/dist/components/Card/Card.variants.js +5 -9
  19. package/dist/components/Checkbox/Checkbox.js +6 -6
  20. package/dist/components/Command/Command.js +2 -2
  21. package/dist/components/Command/components/Command.js +1 -1
  22. package/dist/components/Command/components/CommandEmpty.js +1 -1
  23. package/dist/components/Command/components/CommandGroup.js +1 -1
  24. package/dist/components/Command/components/CommandInput.js +2 -2
  25. package/dist/components/Command/components/CommandItem.js +1 -1
  26. package/dist/components/Command/components/CommandList.js +1 -1
  27. package/dist/components/Command/components/CommandSeparator.js +1 -1
  28. package/dist/components/Command/components/DialogContent.js +2 -2
  29. package/dist/components/Command/components/DialogOverlay.js +1 -1
  30. package/dist/components/Datepicker/DatePicker.js +1209 -1147
  31. package/dist/components/Divider/Divider.variants.js +1 -1
  32. package/dist/components/Dropdown/Dropdown.js +46 -28
  33. package/dist/components/Dropdown/Dropdown.variants.js +32 -9
  34. package/dist/components/Dropdown/components/List/List.js +133 -54
  35. package/dist/components/Dropdown/components/List/List.variants.js +9 -7
  36. package/dist/components/Dropdown/components/ListItem/ListItem.js +74 -24
  37. package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +9 -7
  38. package/dist/components/Dropdown/components/Wrapper.js +144 -109
  39. package/dist/components/Dropdown/constants/index.js +4 -0
  40. package/dist/components/Dropdown/constants/pagination.js +4 -0
  41. package/dist/components/Dropdown/contexts/dropdown.context.js +26 -8
  42. package/dist/components/Dropdown/contexts/dropdown.provider.js +48 -19
  43. package/dist/components/Dropdown/hooks/useDropdown.js +83 -39
  44. package/dist/components/Dropdown/hooks/useNavigationList.js +28 -36
  45. package/dist/components/DropdownButton/DropdownButton.js +1 -1
  46. package/dist/components/Filter/Filter.variants.js +2 -2
  47. package/dist/components/Filter/components/BadgeDropdown/BadgeMultiSelect.js +1 -1
  48. package/dist/components/Filter/components/DateFilterDropdown/DateFilterDropdown.js +1 -1
  49. package/dist/components/Input/Input.js +1 -1
  50. package/dist/components/Input/Input.variants.js +1 -1
  51. package/dist/components/Loading/Loading.js +1 -7
  52. package/dist/components/Modal/Modal.js +2 -2
  53. package/dist/components/Modal/components/Body/Body.js +1 -1
  54. package/dist/components/Modal/components/Footer/Footer.js +1 -1
  55. package/dist/components/Modal/components/Header/Header.js +1 -1
  56. package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -3
  57. package/dist/components/Modal/components/index.js +1 -1
  58. package/dist/components/NumberInput/NumberInput.js +2 -2
  59. package/dist/components/PhoneNumberInput/PhoneNumberInput.js +8 -0
  60. package/dist/components/PhoneNumberInput/PhoneNumberInput.variants.js +45 -0
  61. package/dist/components/PhoneNumberInput/components/FlagContent/FlagContent.js +27 -0
  62. package/dist/components/PhoneNumberInput/components/FlagSelectorList/FlagSelectorList.js +629 -0
  63. package/dist/components/PhoneNumberInput/components/FlagSelectorWrapper/FlagSelectorWrapper.js +36 -0
  64. package/dist/components/PhoneNumberInput/components/TruncateText/TruncateText.js +45 -0
  65. package/dist/components/PhoneNumberInput/components/Wrapper.js +625 -0
  66. package/dist/components/PhoneNumberInput/components/index.js +6 -0
  67. package/dist/components/PhoneNumberInput/contexts/index.js +8 -0
  68. package/dist/components/PhoneNumberInput/contexts/phone-number.context.js +28 -0
  69. package/dist/components/PhoneNumberInput/contexts/phone-number.hook.js +13 -0
  70. package/dist/components/PhoneNumberInput/contexts/phone-number.provider.js +6137 -0
  71. package/dist/components/PhoneNumberInput/utils/index.js +11 -0
  72. package/dist/components/PieChart/PieChart.js +647 -664
  73. package/dist/components/RadioCard/RadioCard.variants.js +1 -6
  74. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  75. package/dist/components/Range/Range.js +1 -1
  76. package/dist/components/Sidebar/Sidebar.variants.js +2 -2
  77. package/dist/components/Sidebar/components/Wrapper/Wrapper.js +29 -28
  78. package/dist/components/Slider/Slider.js +1 -1
  79. package/dist/components/Switch/Switch.js +8 -8
  80. package/dist/components/Switch/Switch.variants.js +4 -4
  81. package/dist/components/Tabs/Tabs.js +1 -1
  82. package/dist/components/Tabs/Tabs.variants.js +45 -24
  83. package/dist/components/Tabs/components/Content.js +1 -1
  84. package/dist/components/Tabs/components/List.js +1 -1
  85. package/dist/components/Tabs/components/Trigger.js +9 -8
  86. package/dist/components/Tag/Tag.js +1 -1
  87. package/dist/components/TagSelect/components/Wrapper/Wrapper.js +98 -49
  88. package/dist/components/TimePicker/TimePicker.variants.js +2 -2
  89. package/dist/components/TimePicker/components/Wrapper/Wrapper.js +2 -2
  90. package/dist/components/Toast/Toast.js +206 -181
  91. package/dist/components/Tooltip/Tooltip.js +1 -1
  92. package/dist/components/Typography/Typography.variants.js +18 -23
  93. package/dist/components/VirtualizedTable/VirtualizedTable.js +119 -0
  94. package/dist/components/VirtualizedTable/VirtualizedTable.variants.js +5 -0
  95. package/dist/components/VirtualizedTable/assets/chevron-down.js +25 -0
  96. package/dist/components/VirtualizedTable/assets/chevron-up.js +25 -0
  97. package/dist/components/VirtualizedTable/assets/index.js +6 -0
  98. package/dist/components/VirtualizedTable/components/Actions/Actions.js +72 -0
  99. package/dist/components/VirtualizedTable/components/Body/Body.js +51 -0
  100. package/dist/components/VirtualizedTable/components/DotPaginate/DotPaginate.js +165 -0
  101. package/dist/components/VirtualizedTable/components/DropdownPaginate/DropdownPaginate.js +34 -0
  102. package/dist/components/VirtualizedTable/components/Filter/Filter.js +88 -0
  103. package/dist/components/VirtualizedTable/components/FormPaginate/FormPaginate.js +48 -0
  104. package/dist/components/VirtualizedTable/components/Header/Header.js +84 -0
  105. package/dist/components/VirtualizedTable/components/Pagination/Pagination.js +53 -0
  106. package/dist/components/VirtualizedTable/components/Skeleton/Skeleton.js +67 -0
  107. package/dist/components/VirtualizedTable/components/TruncateText/TruncateText.js +34 -0
  108. package/dist/components/VirtualizedTable/components/WrapperBody/WrapperBody.js +27 -0
  109. package/dist/components/VirtualizedTable/components/index.js +16 -0
  110. package/dist/components/VirtualizedTable/constants/index.js +5 -0
  111. package/dist/components/VirtualizedTable/constants/pagination.js +5 -0
  112. package/dist/components/VirtualizedTable/contexts/index.js +8 -0
  113. package/dist/components/VirtualizedTable/contexts/table.context.js +32 -0
  114. package/dist/components/VirtualizedTable/contexts/table.hook.js +11 -0
  115. package/dist/components/VirtualizedTable/contexts/table.provider.js +85 -0
  116. package/dist/components/index.js +79 -73
  117. package/dist/contexts/theme.provider.js +0 -1
  118. package/dist/{createLucideIcon-DbC6TvM5.js → createLucideIcon-D4r5Phnh.js} +0 -24
  119. package/dist/debounce-BFejQm9P.js +200 -0
  120. package/dist/ellipsis-vertical-BVPtjl5f.js +9 -0
  121. package/dist/{index-h-Ul0anl.js → index--V_ZsiQe.js} +1 -22
  122. package/dist/index-2hB40Iuc.js +1873 -0
  123. package/dist/index-BZPx6jYI.js +8 -0
  124. package/dist/{index-bwWKd82e.js → index-BbQkJE5L.js} +1 -1
  125. package/dist/index-BtQfgaSF.js +60 -0
  126. package/dist/index-C3tHPg8y.js +662 -0
  127. package/dist/index-CIAmiWcw.js +200 -0
  128. package/dist/index-CSFe9uC5.js +14 -0
  129. package/dist/index-CSWGJT-v.js +1722 -0
  130. package/dist/index-CigKKiZS.js +91 -0
  131. package/dist/index-DDByhzds.js +137 -0
  132. package/dist/{index-BAraV3ai.js → index-DH2Fnov1.js} +11 -12
  133. package/dist/index-DLcqcWxM.js +29 -0
  134. package/dist/index-Dbt2vBmS.js +136 -0
  135. package/dist/{index-DB2XhXHn.js → index-DpW9ExsS.js} +7 -7
  136. package/dist/index-DrWQH0QF.js +55 -0
  137. package/dist/{index-D3xzCzcO.js → index-X4k_cU8k.js} +4 -4
  138. package/dist/index-kyuBfLcN.js +479 -0
  139. package/dist/{index-C1g_chDT.js → index-mPY_8Y5v.js} +2 -2
  140. package/dist/index-ohdbKsws.js +27 -0
  141. package/dist/index.d.ts +184 -18
  142. package/dist/index.js +106 -98
  143. package/dist/libphonenumber-_7ZyKWA7.js +11549 -0
  144. package/dist/package.json +46 -32
  145. package/dist/styles.css +1 -1
  146. package/dist/ui/civo-theme.css +191 -167
  147. package/dist/{useBreadcrumb-B8DnuqkR.js → useBreadcrumb-BAHbGQ_O.js} +0 -10
  148. package/dist/utils/index.js +534 -501
  149. package/dist/{x-BPcqkRZd.js → x-DPU9OdYH.js} +1 -1
  150. package/package.json +46 -32
  151. package/dist/Modal-V67Uz78z.js +0 -98
  152. package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
  153. package/dist/chevron-down-BLZPftpV.js +0 -11
  154. package/dist/chevron-up-RLP4nX7V.js +0 -54
  155. package/dist/index-BXuxPoz7.js +0 -435
  156. package/dist/index-BfXxHr_2.js +0 -125
  157. package/dist/index-C9T9HQaa.js +0 -423
  158. package/dist/index-CZnD2QxM.js +0 -32
  159. package/dist/index-CrBonFvu.js +0 -144
  160. package/dist/index-Cvx4lqTq.js +0 -47
  161. package/dist/index-DQH6odE9.js +0 -82
  162. package/dist/index-Oq5GlCHP.js +0 -131
  163. package/dist/index-iXyXtdgP.js +0 -31
@@ -1,435 +0,0 @@
1
- import * as i from "react";
2
- import { a as Ee, c as he, b as _, d as ye } from "./index-BfXxHr_2.js";
3
- import { u as S, c as De } from "./index-DQH6odE9.js";
4
- import { u as w } from "./index-bwWKd82e.js";
5
- import { P as be, D as Ce } from "./index-CrBonFvu.js";
6
- import { P as N } from "./index-C9T9HQaa.js";
7
- import { u as j } from "./index-0ioNhtNM.js";
8
- import { jsx as l, jsxs as q, Fragment as B } from "react/jsx-runtime";
9
- import { P as U } from "./index-C1g_chDT.js";
10
- import { R as Ae } from "./Combination-VYaRRJBZ.js";
11
- var x = "focusScope.autoFocusOnMount", L = "focusScope.autoFocusOnUnmount", V = { bubbles: !1, cancelable: !0 }, Re = "FocusScope", Q = i.forwardRef((e, o) => {
12
- const {
13
- loop: t = !1,
14
- trapped: n = !1,
15
- onMountAutoFocus: r,
16
- onUnmountAutoFocus: a,
17
- ...d
18
- } = e, [s, y] = i.useState(null), g = j(r), E = j(a), c = i.useRef(null), f = S(o, (u) => y(u)), p = i.useRef({
19
- paused: !1,
20
- pause() {
21
- this.paused = !0;
22
- },
23
- resume() {
24
- this.paused = !1;
25
- }
26
- }).current;
27
- i.useEffect(() => {
28
- if (n) {
29
- let u = function(D) {
30
- if (p.paused || !s) return;
31
- const h = D.target;
32
- s.contains(h) ? c.current = h : C(c.current, { select: !0 });
33
- }, b = function(D) {
34
- if (p.paused || !s) return;
35
- const h = D.relatedTarget;
36
- h !== null && (s.contains(h) || C(c.current, { select: !0 }));
37
- }, v = function(D) {
38
- if (document.activeElement === document.body)
39
- for (const $ of D)
40
- $.removedNodes.length > 0 && C(s);
41
- };
42
- document.addEventListener("focusin", u), document.addEventListener("focusout", b);
43
- const O = new MutationObserver(v);
44
- return s && O.observe(s, { childList: !0, subtree: !0 }), () => {
45
- document.removeEventListener("focusin", u), document.removeEventListener("focusout", b), O.disconnect();
46
- };
47
- }
48
- }, [n, s, p.paused]), i.useEffect(() => {
49
- if (s) {
50
- Z.add(p);
51
- const u = document.activeElement;
52
- if (!s.contains(u)) {
53
- const v = new CustomEvent(x, V);
54
- s.addEventListener(x, g), s.dispatchEvent(v), v.defaultPrevented || (Ne(Fe(X(s)), { select: !0 }), document.activeElement === u && C(s));
55
- }
56
- return () => {
57
- s.removeEventListener(x, g), setTimeout(() => {
58
- const v = new CustomEvent(L, V);
59
- s.addEventListener(L, E), s.dispatchEvent(v), v.defaultPrevented || C(u ?? document.body, { select: !0 }), s.removeEventListener(L, E), Z.remove(p);
60
- }, 0);
61
- };
62
- }
63
- }, [s, g, E, p]);
64
- const P = i.useCallback(
65
- (u) => {
66
- if (!t && !n || p.paused) return;
67
- const b = u.key === "Tab" && !u.altKey && !u.ctrlKey && !u.metaKey, v = document.activeElement;
68
- if (b && v) {
69
- const O = u.currentTarget, [D, h] = Oe(O);
70
- D && h ? !u.shiftKey && v === h ? (u.preventDefault(), t && C(D, { select: !0 })) : u.shiftKey && v === D && (u.preventDefault(), t && C(h, { select: !0 })) : v === O && u.preventDefault();
71
- }
72
- },
73
- [t, n, p.paused]
74
- );
75
- return /* @__PURE__ */ l(N.div, { tabIndex: -1, ...d, ref: f, onKeyDown: P });
76
- });
77
- Q.displayName = Re;
78
- function Ne(e, { select: o = !1 } = {}) {
79
- const t = document.activeElement;
80
- for (const n of e)
81
- if (C(n, { select: o }), document.activeElement !== t) return;
82
- }
83
- function Oe(e) {
84
- const o = X(e), t = Y(o, e), n = Y(o.reverse(), e);
85
- return [t, n];
86
- }
87
- function X(e) {
88
- const o = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
89
- acceptNode: (n) => {
90
- const r = n.tagName === "INPUT" && n.type === "hidden";
91
- return n.disabled || n.hidden || r ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
92
- }
93
- });
94
- for (; t.nextNode(); ) o.push(t.currentNode);
95
- return o;
96
- }
97
- function Y(e, o) {
98
- for (const t of e)
99
- if (!_e(t, { upTo: o })) return t;
100
- }
101
- function _e(e, { upTo: o }) {
102
- if (getComputedStyle(e).visibility === "hidden") return !0;
103
- for (; e; ) {
104
- if (o !== void 0 && e === o) return !1;
105
- if (getComputedStyle(e).display === "none") return !0;
106
- e = e.parentElement;
107
- }
108
- return !1;
109
- }
110
- function Pe(e) {
111
- return e instanceof HTMLInputElement && "select" in e;
112
- }
113
- function C(e, { select: o = !1 } = {}) {
114
- if (e && e.focus) {
115
- const t = document.activeElement;
116
- e.focus({ preventScroll: !0 }), e !== t && Pe(e) && o && e.select();
117
- }
118
- }
119
- var Z = Te();
120
- function Te() {
121
- let e = [];
122
- return {
123
- add(o) {
124
- const t = e[0];
125
- o !== t && t?.pause(), e = z(e, o), e.unshift(o);
126
- },
127
- remove(o) {
128
- e = z(e, o), e[0]?.resume();
129
- }
130
- };
131
- }
132
- function z(e, o) {
133
- const t = [...e], n = t.indexOf(o);
134
- return n !== -1 && t.splice(n, 1), t;
135
- }
136
- function Fe(e) {
137
- return e.filter((o) => o.tagName !== "A");
138
- }
139
- var k = 0;
140
- function Ie() {
141
- i.useEffect(() => {
142
- const e = document.querySelectorAll("[data-radix-focus-guard]");
143
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? J()), document.body.insertAdjacentElement("beforeend", e[1] ?? J()), k++, () => {
144
- k === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((o) => o.remove()), k--;
145
- };
146
- }, []);
147
- }
148
- function J() {
149
- const e = document.createElement("span");
150
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
151
- }
152
- var Se = function(e) {
153
- if (typeof document > "u")
154
- return null;
155
- var o = Array.isArray(e) ? e[0] : e;
156
- return o.ownerDocument.body;
157
- }, R = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), F = {}, W = 0, ee = function(e) {
158
- return e && (e.host || ee(e.parentNode));
159
- }, Me = function(e, o) {
160
- return o.map(function(t) {
161
- if (e.contains(t))
162
- return t;
163
- var n = ee(t);
164
- return n && e.contains(n) ? n : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
165
- }).filter(function(t) {
166
- return !!t;
167
- });
168
- }, we = function(e, o, t, n) {
169
- var r = Me(o, Array.isArray(e) ? e : [e]);
170
- F[t] || (F[t] = /* @__PURE__ */ new WeakMap());
171
- var a = F[t], d = [], s = /* @__PURE__ */ new Set(), y = new Set(r), g = function(c) {
172
- !c || s.has(c) || (s.add(c), g(c.parentNode));
173
- };
174
- r.forEach(g);
175
- var E = function(c) {
176
- !c || y.has(c) || Array.prototype.forEach.call(c.children, function(f) {
177
- if (s.has(f))
178
- E(f);
179
- else
180
- try {
181
- var p = f.getAttribute(n), P = p !== null && p !== "false", u = (R.get(f) || 0) + 1, b = (a.get(f) || 0) + 1;
182
- R.set(f, u), a.set(f, b), d.push(f), u === 1 && P && T.set(f, !0), b === 1 && f.setAttribute(t, "true"), P || f.setAttribute(n, "true");
183
- } catch (v) {
184
- console.error("aria-hidden: cannot operate on ", f, v);
185
- }
186
- });
187
- };
188
- return E(o), s.clear(), W++, function() {
189
- d.forEach(function(c) {
190
- var f = R.get(c) - 1, p = a.get(c) - 1;
191
- R.set(c, f), a.set(c, p), f || (T.has(c) || c.removeAttribute(n), T.delete(c)), p || c.removeAttribute(t);
192
- }), W--, W || (R = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), F = {});
193
- };
194
- }, xe = function(e, o, t) {
195
- t === void 0 && (t = "data-aria-hidden");
196
- var n = Array.from(Array.isArray(e) ? e : [e]), r = Se(e);
197
- return r ? (n.push.apply(n, Array.from(r.querySelectorAll("[aria-live]"))), we(n, r, t, "aria-hidden")) : function() {
198
- return null;
199
- };
200
- }, M = "Dialog", [te, et] = he(M), [Le, m] = te(M), oe = (e) => {
201
- const {
202
- __scopeDialog: o,
203
- children: t,
204
- open: n,
205
- defaultOpen: r,
206
- onOpenChange: a,
207
- modal: d = !0
208
- } = e, s = i.useRef(null), y = i.useRef(null), [g, E] = Ee({
209
- prop: n,
210
- defaultProp: r ?? !1,
211
- onChange: a,
212
- caller: M
213
- });
214
- return /* @__PURE__ */ l(
215
- Le,
216
- {
217
- scope: o,
218
- triggerRef: s,
219
- contentRef: y,
220
- contentId: w(),
221
- titleId: w(),
222
- descriptionId: w(),
223
- open: g,
224
- onOpenChange: E,
225
- onOpenToggle: i.useCallback(() => E((c) => !c), [E]),
226
- modal: d,
227
- children: t
228
- }
229
- );
230
- };
231
- oe.displayName = M;
232
- var ne = "DialogTrigger", re = i.forwardRef(
233
- (e, o) => {
234
- const { __scopeDialog: t, ...n } = e, r = m(ne, t), a = S(o, r.triggerRef);
235
- return /* @__PURE__ */ l(
236
- N.button,
237
- {
238
- type: "button",
239
- "aria-haspopup": "dialog",
240
- "aria-expanded": r.open,
241
- "aria-controls": r.contentId,
242
- "data-state": H(r.open),
243
- ...n,
244
- ref: a,
245
- onClick: _(e.onClick, r.onOpenToggle)
246
- }
247
- );
248
- }
249
- );
250
- re.displayName = ne;
251
- var K = "DialogPortal", [ke, ae] = te(K, {
252
- forceMount: void 0
253
- }), se = (e) => {
254
- const { __scopeDialog: o, forceMount: t, children: n, container: r } = e, a = m(K, o);
255
- return /* @__PURE__ */ l(ke, { scope: o, forceMount: t, children: i.Children.map(n, (d) => /* @__PURE__ */ l(U, { present: t || a.open, children: /* @__PURE__ */ l(be, { asChild: !0, container: r, children: d }) })) });
256
- };
257
- se.displayName = K;
258
- var I = "DialogOverlay", ie = i.forwardRef(
259
- (e, o) => {
260
- const t = ae(I, e.__scopeDialog), { forceMount: n = t.forceMount, ...r } = e, a = m(I, e.__scopeDialog);
261
- return a.modal ? /* @__PURE__ */ l(U, { present: n || a.open, children: /* @__PURE__ */ l(Ue, { ...r, ref: o }) }) : null;
262
- }
263
- );
264
- ie.displayName = I;
265
- var We = De("DialogOverlay.RemoveScroll"), Ue = i.forwardRef(
266
- (e, o) => {
267
- const { __scopeDialog: t, ...n } = e, r = m(I, t);
268
- return (
269
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
270
- // ie. when `Overlay` and `Content` are siblings
271
- /* @__PURE__ */ l(Ae, { as: We, allowPinchZoom: !0, shards: [r.contentRef], children: /* @__PURE__ */ l(
272
- N.div,
273
- {
274
- "data-state": H(r.open),
275
- ...n,
276
- ref: o,
277
- style: { pointerEvents: "auto", ...n.style }
278
- }
279
- ) })
280
- );
281
- }
282
- ), A = "DialogContent", ce = i.forwardRef(
283
- (e, o) => {
284
- const t = ae(A, e.__scopeDialog), { forceMount: n = t.forceMount, ...r } = e, a = m(A, e.__scopeDialog);
285
- return /* @__PURE__ */ l(U, { present: n || a.open, children: a.modal ? /* @__PURE__ */ l(Ke, { ...r, ref: o }) : /* @__PURE__ */ l(Ge, { ...r, ref: o }) });
286
- }
287
- );
288
- ce.displayName = A;
289
- var Ke = i.forwardRef(
290
- (e, o) => {
291
- const t = m(A, e.__scopeDialog), n = i.useRef(null), r = S(o, t.contentRef, n);
292
- return i.useEffect(() => {
293
- const a = n.current;
294
- if (a) return xe(a);
295
- }, []), /* @__PURE__ */ l(
296
- ue,
297
- {
298
- ...e,
299
- ref: r,
300
- trapFocus: t.open,
301
- disableOutsidePointerEvents: !0,
302
- onCloseAutoFocus: _(e.onCloseAutoFocus, (a) => {
303
- a.preventDefault(), t.triggerRef.current?.focus();
304
- }),
305
- onPointerDownOutside: _(e.onPointerDownOutside, (a) => {
306
- const d = a.detail.originalEvent, s = d.button === 0 && d.ctrlKey === !0;
307
- (d.button === 2 || s) && a.preventDefault();
308
- }),
309
- onFocusOutside: _(
310
- e.onFocusOutside,
311
- (a) => a.preventDefault()
312
- )
313
- }
314
- );
315
- }
316
- ), Ge = i.forwardRef(
317
- (e, o) => {
318
- const t = m(A, e.__scopeDialog), n = i.useRef(!1), r = i.useRef(!1);
319
- return /* @__PURE__ */ l(
320
- ue,
321
- {
322
- ...e,
323
- ref: o,
324
- trapFocus: !1,
325
- disableOutsidePointerEvents: !1,
326
- onCloseAutoFocus: (a) => {
327
- e.onCloseAutoFocus?.(a), a.defaultPrevented || (n.current || t.triggerRef.current?.focus(), a.preventDefault()), n.current = !1, r.current = !1;
328
- },
329
- onInteractOutside: (a) => {
330
- e.onInteractOutside?.(a), a.defaultPrevented || (n.current = !0, a.detail.originalEvent.type === "pointerdown" && (r.current = !0));
331
- const d = a.target;
332
- t.triggerRef.current?.contains(d) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && r.current && a.preventDefault();
333
- }
334
- }
335
- );
336
- }
337
- ), ue = i.forwardRef(
338
- (e, o) => {
339
- const { __scopeDialog: t, trapFocus: n, onOpenAutoFocus: r, onCloseAutoFocus: a, ...d } = e, s = m(A, t), y = i.useRef(null), g = S(o, y);
340
- return Ie(), /* @__PURE__ */ q(B, { children: [
341
- /* @__PURE__ */ l(
342
- Q,
343
- {
344
- asChild: !0,
345
- loop: !0,
346
- trapped: n,
347
- onMountAutoFocus: r,
348
- onUnmountAutoFocus: a,
349
- children: /* @__PURE__ */ l(
350
- Ce,
351
- {
352
- role: "dialog",
353
- id: s.contentId,
354
- "aria-describedby": s.descriptionId,
355
- "aria-labelledby": s.titleId,
356
- "data-state": H(s.open),
357
- ...d,
358
- ref: g,
359
- onDismiss: () => s.onOpenChange(!1)
360
- }
361
- )
362
- }
363
- ),
364
- /* @__PURE__ */ q(B, { children: [
365
- /* @__PURE__ */ l(He, { titleId: s.titleId }),
366
- /* @__PURE__ */ l(je, { contentRef: y, descriptionId: s.descriptionId })
367
- ] })
368
- ] });
369
- }
370
- ), G = "DialogTitle", le = i.forwardRef(
371
- (e, o) => {
372
- const { __scopeDialog: t, ...n } = e, r = m(G, t);
373
- return /* @__PURE__ */ l(N.h2, { id: r.titleId, ...n, ref: o });
374
- }
375
- );
376
- le.displayName = G;
377
- var fe = "DialogDescription", de = i.forwardRef(
378
- (e, o) => {
379
- const { __scopeDialog: t, ...n } = e, r = m(fe, t);
380
- return /* @__PURE__ */ l(N.p, { id: r.descriptionId, ...n, ref: o });
381
- }
382
- );
383
- de.displayName = fe;
384
- var pe = "DialogClose", ve = i.forwardRef(
385
- (e, o) => {
386
- const { __scopeDialog: t, ...n } = e, r = m(pe, t);
387
- return /* @__PURE__ */ l(
388
- N.button,
389
- {
390
- type: "button",
391
- ...n,
392
- ref: o,
393
- onClick: _(e.onClick, () => r.onOpenChange(!1))
394
- }
395
- );
396
- }
397
- );
398
- ve.displayName = pe;
399
- function H(e) {
400
- return e ? "open" : "closed";
401
- }
402
- var me = "DialogTitleWarning", [tt, ge] = ye(me, {
403
- contentName: A,
404
- titleName: G,
405
- docsSlug: "dialog"
406
- }), He = ({ titleId: e }) => {
407
- const o = ge(me), t = `\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users.
408
-
409
- If you want to hide the \`${o.titleName}\`, you can wrap it with our VisuallyHidden component.
410
-
411
- For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;
412
- return i.useEffect(() => {
413
- e && (document.getElementById(e) || console.error(t));
414
- }, [t, e]), null;
415
- }, $e = "DialogDescriptionWarning", je = ({ contentRef: e, descriptionId: o }) => {
416
- const n = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ge($e).contentName}}.`;
417
- return i.useEffect(() => {
418
- const r = e.current?.getAttribute("aria-describedby");
419
- o && r && (document.getElementById(o) || console.warn(n));
420
- }, [n, e, o]), null;
421
- }, ot = oe, nt = re, rt = se, at = ie, st = ce, it = le, ct = de, ut = ve;
422
- export {
423
- st as C,
424
- le as D,
425
- at as O,
426
- rt as P,
427
- ot as R,
428
- it as T,
429
- tt as W,
430
- se as a,
431
- ut as b,
432
- et as c,
433
- ct as d,
434
- nt as e
435
- };
@@ -1,125 +0,0 @@
1
- import * as c from "react";
2
- import { jsx as x } from "react/jsx-runtime";
3
- function R(e, s) {
4
- const t = c.createContext(s), i = (u) => {
5
- const { children: r, ...o } = u, l = c.useMemo(() => o, Object.values(o));
6
- return /* @__PURE__ */ x(t.Provider, { value: l, children: r });
7
- };
8
- i.displayName = e + "Provider";
9
- function n(u) {
10
- const r = c.useContext(t);
11
- if (r) return r;
12
- if (s !== void 0) return s;
13
- throw new Error(`\`${u}\` must be used within \`${e}\``);
14
- }
15
- return [i, n];
16
- }
17
- function g(e, s = []) {
18
- let t = [];
19
- function i(u, r) {
20
- const o = c.createContext(r), l = t.length;
21
- t = [...t, r];
22
- const d = (f) => {
23
- const { scope: m, children: p, ...v } = f, C = m?.[e]?.[l] || o, h = c.useMemo(() => v, Object.values(v));
24
- return /* @__PURE__ */ x(C.Provider, { value: h, children: p });
25
- };
26
- d.displayName = u + "Provider";
27
- function a(f, m) {
28
- const p = m?.[e]?.[l] || o, v = c.useContext(p);
29
- if (v) return v;
30
- if (r !== void 0) return r;
31
- throw new Error(`\`${f}\` must be used within \`${u}\``);
32
- }
33
- return [d, a];
34
- }
35
- const n = () => {
36
- const u = t.map((r) => c.createContext(r));
37
- return function(o) {
38
- const l = o?.[e] || u;
39
- return c.useMemo(
40
- () => ({ [`__scope${e}`]: { ...o, [e]: l } }),
41
- [o, l]
42
- );
43
- };
44
- };
45
- return n.scopeName = e, [i, S(n, ...s)];
46
- }
47
- function S(...e) {
48
- const s = e[0];
49
- if (e.length === 1) return s;
50
- const t = () => {
51
- const i = e.map((n) => ({
52
- useScope: n(),
53
- scopeName: n.scopeName
54
- }));
55
- return function(u) {
56
- const r = i.reduce((o, { useScope: l, scopeName: d }) => {
57
- const f = l(u)[`__scope${d}`];
58
- return { ...o, ...f };
59
- }, {});
60
- return c.useMemo(() => ({ [`__scope${s.scopeName}`]: r }), [r]);
61
- };
62
- };
63
- return t.scopeName = s.scopeName, t;
64
- }
65
- function _(e, s, { checkForDefaultPrevented: t = !0 } = {}) {
66
- return function(n) {
67
- if (e?.(n), t === !1 || !n.defaultPrevented)
68
- return s?.(n);
69
- };
70
- }
71
- var P = globalThis?.document ? c.useLayoutEffect : () => {
72
- }, b = c[" useInsertionEffect ".trim().toString()] || P;
73
- function y({
74
- prop: e,
75
- defaultProp: s,
76
- onChange: t = () => {
77
- },
78
- caller: i
79
- }) {
80
- const [n, u, r] = w({
81
- defaultProp: s,
82
- onChange: t
83
- }), o = e !== void 0, l = o ? e : n;
84
- {
85
- const a = c.useRef(e !== void 0);
86
- c.useEffect(() => {
87
- const f = a.current;
88
- f !== o && console.warn(
89
- `${i} is changing from ${f ? "controlled" : "uncontrolled"} to ${o ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
90
- ), a.current = o;
91
- }, [o, i]);
92
- }
93
- const d = c.useCallback(
94
- (a) => {
95
- if (o) {
96
- const f = E(a) ? a(e) : a;
97
- f !== e && r.current?.(f);
98
- } else
99
- u(a);
100
- },
101
- [o, e, u, r]
102
- );
103
- return [l, d];
104
- }
105
- function w({
106
- defaultProp: e,
107
- onChange: s
108
- }) {
109
- const [t, i] = c.useState(e), n = c.useRef(t), u = c.useRef(s);
110
- return b(() => {
111
- u.current = s;
112
- }, [s]), c.useEffect(() => {
113
- n.current !== t && (u.current?.(t), n.current = t);
114
- }, [t, n]), [t, i, u];
115
- }
116
- function E(e) {
117
- return typeof e == "function";
118
- }
119
- export {
120
- y as a,
121
- _ as b,
122
- g as c,
123
- R as d,
124
- P as u
125
- };