fina-react-ds 1.0.21 → 1.0.23

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 (110) hide show
  1. package/dist/components/alert-dialog.d.ts +1 -1
  2. package/dist/components/alert-dialog.js +65 -59
  3. package/dist/components/avatar.d.ts +1 -1
  4. package/dist/components/avatar.js +19 -19
  5. package/dist/components/badge.js +12 -11
  6. package/dist/components/button.js +12 -11
  7. package/dist/components/checkbox.d.ts +1 -1
  8. package/dist/components/checkbox.js +17 -17
  9. package/dist/components/dialog.d.ts +1 -1
  10. package/dist/components/dialog.js +60 -60
  11. package/dist/components/dropdown-menu.d.ts +1 -1
  12. package/dist/components/dropdown-menu.js +93 -93
  13. package/dist/components/form.d.ts +2 -3
  14. package/dist/components/form.js +2 -2
  15. package/dist/components/hover-card.d.ts +1 -1
  16. package/dist/components/hover-card.js +23 -23
  17. package/dist/components/label.d.ts +1 -1
  18. package/dist/components/label.js +12 -12
  19. package/dist/components/popover.d.ts +1 -1
  20. package/dist/components/popover.js +28 -28
  21. package/dist/components/separator.d.ts +1 -1
  22. package/dist/components/separator.js +10 -10
  23. package/dist/components/sheet.d.ts +1 -1
  24. package/dist/components/sheet.js +73 -73
  25. package/dist/components/sidebar.js +73 -69
  26. package/dist/components/switch.d.ts +1 -1
  27. package/dist/components/switch.js +13 -13
  28. package/dist/components/tabs.d.ts +1 -1
  29. package/dist/components/tabs.js +22 -22
  30. package/dist/components/tooltip.d.ts +1 -1
  31. package/dist/components/tooltip.js +27 -27
  32. package/dist/index.d.ts +6 -3
  33. package/dist/index.js +190 -172
  34. package/dist/lib/http.d.ts +13 -0
  35. package/dist/lib/http.js +59 -0
  36. package/dist/lib/utils.d.ts +15 -1
  37. package/dist/lib/utils.js +29 -9
  38. package/dist/lib/yup.d.ts +2 -0
  39. package/dist/lib/yup.js +88 -0
  40. package/package.json +6 -3
  41. package/dist/_virtual/index.js +0 -5
  42. package/dist/_virtual/index2.js +0 -4
  43. package/dist/_virtual/use-sync-external-store-shim.development.js +0 -4
  44. package/dist/_virtual/use-sync-external-store-shim.production.js +0 -4
  45. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -534
  46. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -430
  47. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -215
  48. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -159
  49. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -149
  50. package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -12
  51. package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +0 -130
  52. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -24
  53. package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +0 -80
  54. package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +0 -258
  55. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +0 -51
  56. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -34
  57. package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -76
  58. package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -265
  59. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +0 -12
  60. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -133
  61. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +0 -230
  62. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -21
  63. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -149
  64. package/dist/node_modules/@radix-ui/react-hover-card/dist/index.js +0 -192
  65. package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -16
  66. package/dist/node_modules/@radix-ui/react-label/dist/index.js +0 -22
  67. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +0 -663
  68. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -247
  69. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -224
  70. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -16
  71. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -77
  72. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -39
  73. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -189
  74. package/dist/node_modules/@radix-ui/react-separator/dist/index.js +0 -27
  75. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -67
  76. package/dist/node_modules/@radix-ui/react-switch/dist/index.js +0 -136
  77. package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +0 -168
  78. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +0 -348
  79. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -16
  80. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -59
  81. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -17
  82. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +0 -19
  83. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -6
  84. package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +0 -11
  85. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -30
  86. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +0 -32
  87. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -54
  88. package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -9
  89. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -11
  90. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -116
  91. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -33
  92. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -18
  93. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -70
  94. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
  95. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
  96. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -73
  97. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -7
  98. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -27
  99. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -13
  100. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -17
  101. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -35
  102. package/dist/node_modules/tslib/tslib.es6.js +0 -31
  103. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -9
  104. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -29
  105. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -28
  106. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
  107. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -72
  108. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -73
  109. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -62
  110. package/dist/node_modules/use-sync-external-store/shim/index.js +0 -13
@@ -1,258 +0,0 @@
1
- var O = Object.defineProperty;
2
- var x = (t, r) => O(t, "name", { value: r, configurable: !0 });
3
- import * as a from "react";
4
- import { useComposedRefs as N } from "../../react-compose-refs/dist/index.js";
5
- import { createContextScope as j } from "../../react-context/dist/index.js";
6
- import { composeEventHandlers as B } from "../../primitive/dist/index.js";
7
- import { useControllableState as H } from "../../react-use-controllable-state/dist/index.js";
8
- import { usePrevious as z } from "../../react-use-previous/dist/index.js";
9
- import { useSize as G } from "../../react-use-size/dist/index.js";
10
- import { Presence as K } from "../../react-presence/dist/index.js";
11
- import { Primitive as E } from "../../react-primitive/dist/index.js";
12
- import { jsx as b, jsxs as U, Fragment as X } from "react/jsx-runtime";
13
- var I = "Checkbox", [J, de] = j(I), [Q, y] = J(I);
14
- function V(t) {
15
- const {
16
- __scopeCheckbox: r,
17
- checked: s,
18
- children: u,
19
- defaultChecked: n,
20
- disabled: e,
21
- form: p,
22
- name: f,
23
- onCheckedChange: i,
24
- required: m,
25
- value: C = "on",
26
- // @ts-expect-error
27
- internal_do_not_use_render: d
28
- } = t, [l, _] = H({
29
- prop: s,
30
- defaultProp: n ?? !1,
31
- onChange: i,
32
- caller: I
33
- }), [k, v] = a.useState(null), [g, o] = a.useState(null), c = a.useRef(!1), R = k ? !!p || !!k.closest("form") : (
34
- // We set this to true by default so that events bubble to forms without JS (SSR)
35
- !0
36
- ), P = {
37
- checked: l,
38
- disabled: e,
39
- setChecked: _,
40
- control: k,
41
- setControl: v,
42
- name: f,
43
- form: p,
44
- value: C,
45
- hasConsumerStoppedPropagationRef: c,
46
- required: m,
47
- defaultChecked: h(n) ? !1 : n,
48
- isFormControl: R,
49
- bubbleInput: g,
50
- setBubbleInput: o
51
- };
52
- return /* @__PURE__ */ b(
53
- Q,
54
- {
55
- scope: r,
56
- ...P,
57
- children: Z(d) ? d(P) : u
58
- }
59
- );
60
- }
61
- x(V, "CheckboxProvider");
62
- var w = "CheckboxTrigger", T = a.forwardRef(
63
- ({ __scopeCheckbox: t, onKeyDown: r, onClick: s, ...u }, n) => {
64
- const {
65
- control: e,
66
- value: p,
67
- disabled: f,
68
- checked: i,
69
- required: m,
70
- setControl: C,
71
- setChecked: d,
72
- hasConsumerStoppedPropagationRef: l,
73
- isFormControl: _,
74
- bubbleInput: k
75
- } = y(w, t), v = N(n, C), g = a.useRef(i);
76
- return a.useEffect(() => {
77
- const o = e == null ? void 0 : e.form;
78
- if (o) {
79
- const c = /* @__PURE__ */ x(() => d(g.current), "reset");
80
- return o.addEventListener("reset", c), () => o.removeEventListener("reset", c);
81
- }
82
- }, [e, d]), /* @__PURE__ */ b(
83
- E.button,
84
- {
85
- type: "button",
86
- role: "checkbox",
87
- "aria-checked": h(i) ? "mixed" : i,
88
- "aria-required": m,
89
- "data-state": D(i),
90
- "data-disabled": f ? "" : void 0,
91
- disabled: f,
92
- value: p,
93
- ...u,
94
- ref: v,
95
- onKeyDown: B(r, (o) => {
96
- o.key === "Enter" && o.preventDefault();
97
- }),
98
- onClick: B(s, (o) => {
99
- d((c) => h(c) ? !0 : !c), k && _ && (l.current = o.isPropagationStopped(), l.current || o.stopPropagation());
100
- })
101
- }
102
- );
103
- }
104
- );
105
- T.displayName = w;
106
- var W = a.forwardRef(
107
- (t, r) => {
108
- const {
109
- __scopeCheckbox: s,
110
- name: u,
111
- checked: n,
112
- defaultChecked: e,
113
- required: p,
114
- disabled: f,
115
- value: i,
116
- onCheckedChange: m,
117
- form: C,
118
- ...d
119
- } = t;
120
- return /* @__PURE__ */ b(
121
- V,
122
- {
123
- __scopeCheckbox: s,
124
- checked: n,
125
- defaultChecked: e,
126
- disabled: f,
127
- required: p,
128
- onCheckedChange: m,
129
- name: u,
130
- form: C,
131
- value: i,
132
- internal_do_not_use_render: /* @__PURE__ */ x(({ isFormControl: l }) => /* @__PURE__ */ U(X, { children: [
133
- /* @__PURE__ */ b(
134
- T,
135
- {
136
- ...d,
137
- ref: r,
138
- __scopeCheckbox: s
139
- }
140
- ),
141
- l && /* @__PURE__ */ b(
142
- A,
143
- {
144
- __scopeCheckbox: s
145
- }
146
- )
147
- ] }), "internal_do_not_use_render")
148
- }
149
- );
150
- }
151
- );
152
- W.displayName = I;
153
- var M = "CheckboxIndicator", Y = a.forwardRef(
154
- (t, r) => {
155
- const { __scopeCheckbox: s, forceMount: u, ...n } = t, e = y(M, s);
156
- return /* @__PURE__ */ b(
157
- K,
158
- {
159
- present: u || h(e.checked) || e.checked === !0,
160
- children: /* @__PURE__ */ b(
161
- E.span,
162
- {
163
- "data-state": D(e.checked),
164
- "data-disabled": e.disabled ? "" : void 0,
165
- ...n,
166
- ref: r,
167
- style: { pointerEvents: "none", ...t.style }
168
- }
169
- )
170
- }
171
- );
172
- }
173
- );
174
- Y.displayName = M;
175
- var q = "CheckboxBubbleInput", A = a.forwardRef(
176
- ({ __scopeCheckbox: t, ...r }, s) => {
177
- const {
178
- control: u,
179
- hasConsumerStoppedPropagationRef: n,
180
- checked: e,
181
- defaultChecked: p,
182
- required: f,
183
- disabled: i,
184
- name: m,
185
- value: C,
186
- form: d,
187
- bubbleInput: l,
188
- setBubbleInput: _
189
- } = y(q, t), k = N(s, _), v = z(e), g = G(u);
190
- a.useEffect(() => {
191
- const c = l;
192
- if (!c) return;
193
- const R = window.HTMLInputElement.prototype, S = Object.getOwnPropertyDescriptor(
194
- R,
195
- "checked"
196
- ).set, F = !n.current;
197
- if (v !== e && S) {
198
- const L = new Event("click", { bubbles: F });
199
- c.indeterminate = h(e), S.call(c, h(e) ? !1 : e), c.dispatchEvent(L);
200
- }
201
- }, [l, v, e, n]);
202
- const o = a.useRef(h(e) ? !1 : e);
203
- return /* @__PURE__ */ b(
204
- E.input,
205
- {
206
- type: "checkbox",
207
- "aria-hidden": !0,
208
- defaultChecked: p ?? o.current,
209
- required: f,
210
- disabled: i,
211
- name: m,
212
- value: C,
213
- form: d,
214
- ...r,
215
- tabIndex: -1,
216
- ref: k,
217
- style: {
218
- ...r.style,
219
- ...g,
220
- position: "absolute",
221
- pointerEvents: "none",
222
- opacity: 0,
223
- margin: 0,
224
- // We transform because the input is absolutely positioned but we have
225
- // rendered it **after** the button. This pulls it back to sit on top
226
- // of the button.
227
- transform: "translateX(-100%)"
228
- }
229
- }
230
- );
231
- }
232
- );
233
- A.displayName = q;
234
- function Z(t) {
235
- return typeof t == "function";
236
- }
237
- x(Z, "isFunction");
238
- function h(t) {
239
- return t === "indeterminate";
240
- }
241
- x(h, "isIndeterminate");
242
- function D(t) {
243
- return h(t) ? "indeterminate" : t ? "checked" : "unchecked";
244
- }
245
- x(D, "getState");
246
- export {
247
- W as Checkbox,
248
- Y as CheckboxIndicator,
249
- Y as Indicator,
250
- W as Root,
251
- de as createCheckboxScope,
252
- A as unstable_BubbleInput,
253
- A as unstable_CheckboxBubbleInput,
254
- V as unstable_CheckboxProvider,
255
- T as unstable_CheckboxTrigger,
256
- V as unstable_Provider,
257
- T as unstable_Trigger
258
- };
@@ -1,51 +0,0 @@
1
- var P = Object.defineProperty;
2
- var f = (l, i) => P(l, "name", { value: i, configurable: !0 });
3
- import r from "react";
4
- import { createContextScope as w } from "../../react-context/dist/index.js";
5
- import { useComposedRefs as x } from "../../react-compose-refs/dist/index.js";
6
- import { createSlot as A } from "../../react-slot/dist/index.js";
7
- import { jsx as p } from "react/jsx-runtime";
8
- function k(l) {
9
- const i = l + "CollectionProvider", [N, _] = w(i), [E, a] = N(
10
- i,
11
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
12
- ), C = /* @__PURE__ */ f((c) => {
13
- const { scope: e, children: s } = c, o = r.useRef(null), t = r.useRef(/* @__PURE__ */ new Map()).current;
14
- return /* @__PURE__ */ p(E, { scope: e, itemMap: t, collectionRef: o, children: s });
15
- }, "CollectionProvider");
16
- C.displayName = i;
17
- const d = l + "CollectionSlot", T = A(d), R = r.forwardRef(
18
- (c, e) => {
19
- const { scope: s, children: o } = c, t = a(d, s), n = x(e, t.collectionRef);
20
- return /* @__PURE__ */ p(T, { ref: n, children: o });
21
- }
22
- );
23
- R.displayName = d;
24
- const u = l + "CollectionItemSlot", I = "data-radix-collection-item", O = A(u), S = r.forwardRef(
25
- (c, e) => {
26
- const { scope: s, children: o, ...t } = c, n = r.useRef(null), M = x(e, n), m = a(u, s);
27
- return r.useEffect(() => (m.itemMap.set(n, { ref: n, ...t }), () => void m.itemMap.delete(n))), /* @__PURE__ */ p(O, { [I]: "", ref: M, children: o });
28
- }
29
- );
30
- S.displayName = u;
31
- function v(c) {
32
- const e = a(l + "CollectionConsumer", c);
33
- return r.useCallback(() => {
34
- const o = e.collectionRef.current;
35
- if (!o) return [];
36
- const t = Array.from(o.querySelectorAll(`[${I}]`));
37
- return Array.from(e.itemMap.values()).sort(
38
- (m, y) => t.indexOf(m.ref.current) - t.indexOf(y.ref.current)
39
- );
40
- }, [e.collectionRef, e.itemMap]);
41
- }
42
- return f(v, "useCollection"), [
43
- { Provider: C, Slot: R, ItemSlot: S },
44
- v,
45
- _
46
- ];
47
- }
48
- f(k, "createCollection");
49
- export {
50
- k as createCollection
51
- };
@@ -1,34 +0,0 @@
1
- var i = Object.defineProperty;
2
- var u = (n, t) => i(n, "name", { value: t, configurable: !0 });
3
- import * as s from "react";
4
- function f(n, t) {
5
- if (typeof n == "function")
6
- return n(t);
7
- n != null && (n.current = t);
8
- }
9
- u(f, "setRef");
10
- function p(...n) {
11
- return (t) => {
12
- let c = !1;
13
- const l = n.map((e) => {
14
- const o = f(e, t);
15
- return !c && typeof o == "function" && (c = !0), o;
16
- });
17
- if (c)
18
- return () => {
19
- for (let e = 0; e < l.length; e++) {
20
- const o = l[e];
21
- typeof o == "function" ? o() : f(n[e], null);
22
- }
23
- };
24
- };
25
- }
26
- u(p, "composeRefs");
27
- function a(...n) {
28
- return s.useCallback(p(...n), n);
29
- }
30
- u(a, "useComposedRefs");
31
- export {
32
- p as composeRefs,
33
- a as useComposedRefs
34
- };
@@ -1,76 +0,0 @@
1
- var $ = Object.defineProperty;
2
- var o = (t, r) => $(t, "name", { value: r, configurable: !0 });
3
- import * as i from "react";
4
- import { jsx as P } from "react/jsx-runtime";
5
- function M(t, r) {
6
- const c = i.createContext(r), d = /* @__PURE__ */ o((s) => {
7
- const { children: e, ...n } = s, u = i.useMemo(() => n, Object.values(n));
8
- return /* @__PURE__ */ P(c.Provider, { value: u, children: e });
9
- }, "Provider");
10
- d.displayName = t + "Provider";
11
- function x(s) {
12
- const e = i.useContext(c);
13
- if (e) return e;
14
- if (r !== void 0) return r;
15
- throw new Error(`\`${s}\` must be used within \`${t}\``);
16
- }
17
- return o(x, "useContext2"), [d, x];
18
- }
19
- o(M, "createContext2");
20
- function j(t, r = []) {
21
- let c = [];
22
- function d(s, e) {
23
- const n = i.createContext(e), u = c.length;
24
- c = [...c, e];
25
- const v = /* @__PURE__ */ o((m) => {
26
- var h;
27
- const { scope: a, children: f, ...p } = m, C = ((h = a == null ? void 0 : a[t]) == null ? void 0 : h[u]) || n, l = i.useMemo(() => p, Object.values(p));
28
- return /* @__PURE__ */ P(C.Provider, { value: l, children: f });
29
- }, "Provider");
30
- v.displayName = s + "Provider";
31
- function S(m, a) {
32
- var C;
33
- const f = ((C = a == null ? void 0 : a[t]) == null ? void 0 : C[u]) || n, p = i.useContext(f);
34
- if (p) return p;
35
- if (e !== void 0) return e;
36
- throw new Error(`\`${m}\` must be used within \`${s}\``);
37
- }
38
- return o(S, "useContext2"), [v, S];
39
- }
40
- o(d, "createContext3");
41
- const x = /* @__PURE__ */ o(() => {
42
- const s = c.map((e) => i.createContext(e));
43
- return /* @__PURE__ */ o(function(n) {
44
- const u = (n == null ? void 0 : n[t]) || s;
45
- return i.useMemo(
46
- () => ({ [`__scope${t}`]: { ...n, [t]: u } }),
47
- [n, u]
48
- );
49
- }, "useScope");
50
- }, "createScope");
51
- return x.scopeName = t, [d, w(x, ...r)];
52
- }
53
- o(j, "createContextScope");
54
- function w(...t) {
55
- const r = t[0];
56
- if (t.length === 1) return r;
57
- const c = /* @__PURE__ */ o(() => {
58
- const d = t.map((x) => ({
59
- useScope: x(),
60
- scopeName: x.scopeName
61
- }));
62
- return /* @__PURE__ */ o(function(s) {
63
- const e = d.reduce((n, { useScope: u, scopeName: v }) => {
64
- const m = u(s)[`__scope${v}`];
65
- return { ...n, ...m };
66
- }, {});
67
- return i.useMemo(() => ({ [`__scope${r.scopeName}`]: e }), [e]);
68
- }, "useComposedScopes");
69
- }, "createScope");
70
- return c.scopeName = r.scopeName, c;
71
- }
72
- o(w, "composeContextScopes");
73
- export {
74
- M as createContext,
75
- j as createContextScope
76
- };
@@ -1,265 +0,0 @@
1
- var q = Object.defineProperty;
2
- var d = (e, o) => q(e, "name", { value: o, configurable: !0 });
3
- import * as s from "react";
4
- import { composeEventHandlers as m } from "../../primitive/dist/index.js";
5
- import { useComposedRefs as h } from "../../react-compose-refs/dist/index.js";
6
- import { createContextScope as K, createContext as U } from "../../react-context/dist/index.js";
7
- import { useId as _ } from "../../react-id/dist/index.js";
8
- import { useControllableState as Y } from "../../react-use-controllable-state/dist/index.js";
9
- import { DismissableLayer as Z } from "../../react-dismissable-layer/dist/index.js";
10
- import { FocusScope as z } from "../../react-focus-scope/dist/index.js";
11
- import { Portal as J } from "../../react-portal/dist/index.js";
12
- import { Presence as E } from "../../react-presence/dist/index.js";
13
- import { Primitive as D } from "../../react-primitive/dist/index.js";
14
- import { useFocusGuards as Q } from "../../react-focus-guards/dist/index.js";
15
- import X from "../../../react-remove-scroll/dist/es2015/Combination.js";
16
- import { hideOthers as ee } from "../../../aria-hidden/dist/es2015/index.js";
17
- import { createSlot as te } from "../../react-slot/dist/index.js";
18
- import { jsx as i, jsxs as O, Fragment as I } from "react/jsx-runtime";
19
- var C = "Dialog", [x, Ie] = K(C), [oe, u] = x(C), A = /* @__PURE__ */ d((e) => {
20
- const {
21
- __scopeDialog: o,
22
- children: n,
23
- open: a,
24
- defaultOpen: r,
25
- onOpenChange: t,
26
- modal: c = !0
27
- } = e, l = s.useRef(null), f = s.useRef(null), [p, R] = Y({
28
- prop: a,
29
- defaultProp: r ?? !1,
30
- onChange: t,
31
- caller: C
32
- });
33
- return /* @__PURE__ */ i(
34
- oe,
35
- {
36
- scope: o,
37
- triggerRef: l,
38
- contentRef: f,
39
- contentId: _(),
40
- titleId: _(),
41
- descriptionId: _(),
42
- open: p,
43
- onOpenChange: R,
44
- onOpenToggle: s.useCallback(() => R((V) => !V), [R]),
45
- modal: c,
46
- children: n
47
- }
48
- );
49
- }, "Dialog");
50
- A.displayName = C;
51
- var T = "DialogTrigger", b = s.forwardRef(
52
- (e, o) => {
53
- const { __scopeDialog: n, ...a } = e, r = u(T, n), t = h(o, r.triggerRef);
54
- return /* @__PURE__ */ i(
55
- D.button,
56
- {
57
- type: "button",
58
- "aria-haspopup": "dialog",
59
- "aria-expanded": r.open,
60
- "aria-controls": r.contentId,
61
- "data-state": P(r.open),
62
- ...a,
63
- ref: t,
64
- onClick: m(e.onClick, r.onOpenToggle)
65
- }
66
- );
67
- }
68
- );
69
- b.displayName = T;
70
- var y = "DialogPortal", [re, M] = x(y, {
71
- forceMount: void 0
72
- }), w = /* @__PURE__ */ d((e) => {
73
- const { __scopeDialog: o, forceMount: n, children: a, container: r } = e, t = u(y, o);
74
- return /* @__PURE__ */ i(re, { scope: o, forceMount: n, children: s.Children.map(a, (c) => /* @__PURE__ */ i(E, { present: n || t.open, children: /* @__PURE__ */ i(J, { asChild: !0, container: r, children: c }) })) });
75
- }, "DialogPortal");
76
- w.displayName = y;
77
- var v = "DialogOverlay", S = s.forwardRef(
78
- (e, o) => {
79
- const n = M(v, e.__scopeDialog), { forceMount: a = n.forceMount, ...r } = e, t = u(v, e.__scopeDialog);
80
- return t.modal ? /* @__PURE__ */ i(E, { present: a || t.open, children: /* @__PURE__ */ i(ae, { ...r, ref: o }) }) : null;
81
- }
82
- );
83
- S.displayName = v;
84
- var ne = te("DialogOverlay.RemoveScroll"), ae = s.forwardRef(
85
- (e, o) => {
86
- const { __scopeDialog: n, ...a } = e, r = u(v, n);
87
- return (
88
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
89
- // ie. when `Overlay` and `Content` are siblings
90
- /* @__PURE__ */ i(X, { as: ne, allowPinchZoom: !0, shards: [r.contentRef], children: /* @__PURE__ */ i(
91
- D.div,
92
- {
93
- "data-state": P(r.open),
94
- ...a,
95
- ref: o,
96
- style: { pointerEvents: "auto", ...a.style }
97
- }
98
- ) })
99
- );
100
- }
101
- ), g = "DialogContent", F = s.forwardRef(
102
- (e, o) => {
103
- const n = M(g, e.__scopeDialog), { forceMount: a = n.forceMount, ...r } = e, t = u(g, e.__scopeDialog);
104
- return /* @__PURE__ */ i(E, { present: a || t.open, children: t.modal ? /* @__PURE__ */ i(ie, { ...r, ref: o }) : /* @__PURE__ */ i(se, { ...r, ref: o }) });
105
- }
106
- );
107
- F.displayName = g;
108
- var ie = s.forwardRef(
109
- (e, o) => {
110
- const n = u(g, e.__scopeDialog), a = s.useRef(null), r = h(o, n.contentRef, a);
111
- return s.useEffect(() => {
112
- const t = a.current;
113
- if (t) return ee(t);
114
- }, []), /* @__PURE__ */ i(
115
- W,
116
- {
117
- ...e,
118
- ref: r,
119
- trapFocus: n.open,
120
- disableOutsidePointerEvents: !0,
121
- onCloseAutoFocus: m(e.onCloseAutoFocus, (t) => {
122
- var c;
123
- t.preventDefault(), (c = n.triggerRef.current) == null || c.focus();
124
- }),
125
- onPointerDownOutside: m(e.onPointerDownOutside, (t) => {
126
- const c = t.detail.originalEvent, l = c.button === 0 && c.ctrlKey === !0;
127
- (c.button === 2 || l) && t.preventDefault();
128
- }),
129
- onFocusOutside: m(
130
- e.onFocusOutside,
131
- (t) => t.preventDefault()
132
- )
133
- }
134
- );
135
- }
136
- ), se = s.forwardRef(
137
- (e, o) => {
138
- const n = u(g, e.__scopeDialog), a = s.useRef(!1), r = s.useRef(!1);
139
- return /* @__PURE__ */ i(
140
- W,
141
- {
142
- ...e,
143
- ref: o,
144
- trapFocus: !1,
145
- disableOutsidePointerEvents: !1,
146
- onCloseAutoFocus: /* @__PURE__ */ d((t) => {
147
- var c, l;
148
- (c = e.onCloseAutoFocus) == null || c.call(e, t), t.defaultPrevented || (a.current || (l = n.triggerRef.current) == null || l.focus(), t.preventDefault()), a.current = !1, r.current = !1;
149
- }, "onCloseAutoFocus"),
150
- onInteractOutside: /* @__PURE__ */ d((t) => {
151
- var f, p;
152
- (f = e.onInteractOutside) == null || f.call(e, t), t.defaultPrevented || (a.current = !0, t.detail.originalEvent.type === "pointerdown" && (r.current = !0));
153
- const c = t.target;
154
- ((p = n.triggerRef.current) == null ? void 0 : p.contains(c)) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && r.current && t.preventDefault();
155
- }, "onInteractOutside")
156
- }
157
- );
158
- }
159
- ), W = s.forwardRef(
160
- (e, o) => {
161
- const { __scopeDialog: n, trapFocus: a, onOpenAutoFocus: r, onCloseAutoFocus: t, ...c } = e, l = u(g, n), f = s.useRef(null), p = h(o, f);
162
- return Q(), /* @__PURE__ */ O(I, { children: [
163
- /* @__PURE__ */ i(
164
- z,
165
- {
166
- asChild: !0,
167
- loop: !0,
168
- trapped: a,
169
- onMountAutoFocus: r,
170
- onUnmountAutoFocus: t,
171
- children: /* @__PURE__ */ i(
172
- Z,
173
- {
174
- role: "dialog",
175
- id: l.contentId,
176
- "aria-describedby": l.descriptionId,
177
- "aria-labelledby": l.titleId,
178
- "data-state": P(l.open),
179
- ...c,
180
- ref: p,
181
- onDismiss: /* @__PURE__ */ d(() => l.onOpenChange(!1), "onDismiss")
182
- }
183
- )
184
- }
185
- ),
186
- /* @__PURE__ */ O(I, { children: [
187
- /* @__PURE__ */ i(ce, { titleId: l.titleId }),
188
- /* @__PURE__ */ i(ue, { contentRef: f, descriptionId: l.descriptionId })
189
- ] })
190
- ] });
191
- }
192
- ), N = "DialogTitle", k = s.forwardRef(
193
- (e, o) => {
194
- const { __scopeDialog: n, ...a } = e, r = u(N, n);
195
- return /* @__PURE__ */ i(D.h2, { id: r.titleId, ...a, ref: o });
196
- }
197
- );
198
- k.displayName = N;
199
- var G = "DialogDescription", L = s.forwardRef(
200
- (e, o) => {
201
- const { __scopeDialog: n, ...a } = e, r = u(G, n);
202
- return /* @__PURE__ */ i(D.p, { id: r.descriptionId, ...a, ref: o });
203
- }
204
- );
205
- L.displayName = G;
206
- var $ = "DialogClose", B = s.forwardRef(
207
- (e, o) => {
208
- const { __scopeDialog: n, ...a } = e, r = u($, n);
209
- return /* @__PURE__ */ i(
210
- D.button,
211
- {
212
- type: "button",
213
- ...a,
214
- ref: o,
215
- onClick: m(e.onClick, () => r.onOpenChange(!1))
216
- }
217
- );
218
- }
219
- );
220
- B.displayName = $;
221
- function P(e) {
222
- return e ? "open" : "closed";
223
- }
224
- d(P, "getState");
225
- var j = "DialogTitleWarning", [xe, H] = U(j, {
226
- contentName: g,
227
- titleName: N,
228
- docsSlug: "dialog"
229
- }), ce = /* @__PURE__ */ d(({ titleId: e }) => {
230
- const o = H(j), n = `\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users.
231
-
232
- If you want to hide the \`${o.titleName}\`, you can wrap it with our VisuallyHidden component.
233
-
234
- For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;
235
- return s.useEffect(() => {
236
- e && (document.getElementById(e) || console.error(n));
237
- }, [n, e]), null;
238
- }, "TitleWarning"), le = "DialogDescriptionWarning", ue = /* @__PURE__ */ d(({ contentRef: e, descriptionId: o }) => {
239
- const a = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${H(le).contentName}}.`;
240
- return s.useEffect(() => {
241
- var t;
242
- const r = (t = e.current) == null ? void 0 : t.getAttribute("aria-describedby");
243
- o && r && (document.getElementById(o) || console.warn(a));
244
- }, [a, e, o]), null;
245
- }, "DescriptionWarning"), Ae = A, Te = b, be = w, Me = S, we = F, Se = k, Fe = L, We = B;
246
- export {
247
- We as Close,
248
- we as Content,
249
- Fe as Description,
250
- A as Dialog,
251
- B as DialogClose,
252
- F as DialogContent,
253
- L as DialogDescription,
254
- S as DialogOverlay,
255
- w as DialogPortal,
256
- k as DialogTitle,
257
- b as DialogTrigger,
258
- Me as Overlay,
259
- be as Portal,
260
- Ae as Root,
261
- Se as Title,
262
- Te as Trigger,
263
- xe as WarningProvider,
264
- Ie as createDialogScope
265
- };
@@ -1,12 +0,0 @@
1
- var n = Object.defineProperty;
2
- var o = (t, e) => n(t, "name", { value: e, configurable: !0 });
3
- import * as r from "react";
4
- var i = r.createContext(void 0);
5
- function a(t) {
6
- const e = r.useContext(i);
7
- return t || e || "ltr";
8
- }
9
- o(a, "useDirection");
10
- export {
11
- a as useDirection
12
- };