fina-react-ds 0.0.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.
- package/README.md +17 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +4 -0
- package/dist/components/alert-dialog.d.ts +16 -0
- package/dist/components/alert.d.ts +8 -0
- package/dist/components/alert.js +70 -0
- package/dist/components/avatar.d.ts +5 -0
- package/dist/components/avatar.js +58 -0
- package/dist/components/badge.d.ts +8 -0
- package/dist/components/badge.js +43 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.js +152 -0
- package/dist/components/card.d.ts +8 -0
- package/dist/components/card.js +99 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.js +34 -0
- package/dist/components/dialog.d.ts +15 -0
- package/dist/components/dialog.js +148 -0
- package/dist/components/dropdown-menu.d.ts +25 -0
- package/dist/components/dropdown-menu.js +248 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.js +24 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +32 -0
- package/dist/components/pagination.d.ts +13 -0
- package/dist/components/pagination.js +128 -0
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.js +50 -0
- package/dist/components/select.d.ts +11 -0
- package/dist/components/select.js +48 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/simple-pagination.d.ts +6 -0
- package/dist/components/simple-pagination.js +34 -0
- package/dist/components/tabs.d.ts +7 -0
- package/dist/components/tabs.js +73 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/index.js +80 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +11 -0
- package/dist/lib.d.ts +16 -0
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +534 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +430 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +215 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +159 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +149 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +80 -0
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +258 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +51 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +34 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +76 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +265 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +133 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +230 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +21 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +149 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-label/dist/index.js +22 -0
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +663 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +247 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +224 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +77 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +189 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +60 -0
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +168 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +59 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +19 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +30 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +54 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +9 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +116 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +33 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +18 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +70 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +73 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +27 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +13 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +17 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +35 -0
- package/dist/node_modules/tslib/tslib.es6.js +31 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +9 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +29 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +28 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +72 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +73 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +62 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +13 -0
- package/dist/themes/base.css +1982 -0
- package/dist/themes/pro.css +188 -0
- package/dist/themes/puulse-colors.css +388 -0
- package/package.json +114 -0
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,265 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var l = (t, e) => U(t, "name", { value: e, configurable: !0 });
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import { composeEventHandlers as y } from "../../primitive/dist/index.js";
|
|
5
|
+
import { Primitive as R, dispatchDiscreteCustomEvent as z } from "../../react-primitive/dist/index.js";
|
|
6
|
+
import { useComposedRefs as w } from "../../react-compose-refs/dist/index.js";
|
|
7
|
+
import { useCallbackRef as T } from "../../react-use-callback-ref/dist/index.js";
|
|
8
|
+
import { useEscapeKeydown as H } from "../../react-use-escape-keydown/dist/index.js";
|
|
9
|
+
import { jsx as B } from "react/jsx-runtime";
|
|
10
|
+
var M = "DismissableLayer", p = "dismissableLayer.update", j = "dismissableLayer.pointerDownOutside", X = "dismissableLayer.focusOutside", O, x = r.createContext({
|
|
11
|
+
layers: /* @__PURE__ */ new Set(),
|
|
12
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
13
|
+
branches: /* @__PURE__ */ new Set()
|
|
14
|
+
}), Y = r.forwardRef(
|
|
15
|
+
(t, e) => {
|
|
16
|
+
const {
|
|
17
|
+
disableOutsidePointerEvents: i = !1,
|
|
18
|
+
onEscapeKeyDown: o,
|
|
19
|
+
onPointerDownOutside: s,
|
|
20
|
+
onFocusOutside: a,
|
|
21
|
+
onInteractOutside: f,
|
|
22
|
+
onDismiss: d,
|
|
23
|
+
...E
|
|
24
|
+
} = t, c = r.useContext(x), [u, F] = r.useState(null), v = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, W] = r.useState({}), A = w(e, (n) => F(n)), b = Array.from(c.layers), [N] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), I = b.indexOf(N), P = u ? b.indexOf(u) : -1, _ = c.layersWithOutsidePointerEventsDisabled.size > 0, D = P >= I, k = J((n) => {
|
|
25
|
+
const h = n.target, L = [...c.branches].some((m) => m.contains(h));
|
|
26
|
+
!D || L || (s == null || s(n), f == null || f(n), n.defaultPrevented || d == null || d());
|
|
27
|
+
}, v), C = K((n) => {
|
|
28
|
+
const h = n.target;
|
|
29
|
+
[...c.branches].some((m) => m.contains(h)) || (a == null || a(n), f == null || f(n), n.defaultPrevented || d == null || d());
|
|
30
|
+
}, v);
|
|
31
|
+
return H((n) => {
|
|
32
|
+
P === c.layers.size - 1 && (o == null || o(n), !n.defaultPrevented && d && (n.preventDefault(), d()));
|
|
33
|
+
}, v), r.useEffect(() => {
|
|
34
|
+
if (u)
|
|
35
|
+
return i && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (O = v.body.style.pointerEvents, v.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), g(), () => {
|
|
36
|
+
i && c.layersWithOutsidePointerEventsDisabled.size === 1 && (v.body.style.pointerEvents = O);
|
|
37
|
+
};
|
|
38
|
+
}, [u, v, i, c]), r.useEffect(() => () => {
|
|
39
|
+
u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), g());
|
|
40
|
+
}, [u, c]), r.useEffect(() => {
|
|
41
|
+
const n = /* @__PURE__ */ l(() => W({}), "handleUpdate");
|
|
42
|
+
return document.addEventListener(p, n), () => document.removeEventListener(p, n);
|
|
43
|
+
}, []), /* @__PURE__ */ B(
|
|
44
|
+
R.div,
|
|
45
|
+
{
|
|
46
|
+
...E,
|
|
47
|
+
ref: A,
|
|
48
|
+
style: {
|
|
49
|
+
pointerEvents: _ ? D ? "auto" : "none" : void 0,
|
|
50
|
+
...t.style
|
|
51
|
+
},
|
|
52
|
+
onFocusCapture: y(t.onFocusCapture, C.onFocusCapture),
|
|
53
|
+
onBlurCapture: y(t.onBlurCapture, C.onBlurCapture),
|
|
54
|
+
onPointerDownCapture: y(
|
|
55
|
+
t.onPointerDownCapture,
|
|
56
|
+
k.onPointerDownCapture
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
Y.displayName = M;
|
|
63
|
+
var q = "DismissableLayerBranch", G = r.forwardRef((t, e) => {
|
|
64
|
+
const i = r.useContext(x), o = r.useRef(null), s = w(e, o);
|
|
65
|
+
return r.useEffect(() => {
|
|
66
|
+
const a = o.current;
|
|
67
|
+
if (a)
|
|
68
|
+
return i.branches.add(a), () => {
|
|
69
|
+
i.branches.delete(a);
|
|
70
|
+
};
|
|
71
|
+
}, [i.branches]), /* @__PURE__ */ B(R.div, { ...t, ref: s });
|
|
72
|
+
});
|
|
73
|
+
G.displayName = q;
|
|
74
|
+
function J(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
75
|
+
const i = T(t), o = r.useRef(!1), s = r.useRef(() => {
|
|
76
|
+
});
|
|
77
|
+
return r.useEffect(() => {
|
|
78
|
+
const a = /* @__PURE__ */ l((d) => {
|
|
79
|
+
if (d.target && !o.current) {
|
|
80
|
+
let E = /* @__PURE__ */ l(function() {
|
|
81
|
+
S(
|
|
82
|
+
j,
|
|
83
|
+
i,
|
|
84
|
+
c,
|
|
85
|
+
{ discrete: !0 }
|
|
86
|
+
);
|
|
87
|
+
}, "handleAndDispatchPointerDownOutsideEvent2");
|
|
88
|
+
const c = { originalEvent: d };
|
|
89
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", s.current), s.current = E, e.addEventListener("click", s.current, { once: !0 })) : E();
|
|
90
|
+
} else
|
|
91
|
+
e.removeEventListener("click", s.current);
|
|
92
|
+
o.current = !1;
|
|
93
|
+
}, "handlePointerDown"), f = window.setTimeout(() => {
|
|
94
|
+
e.addEventListener("pointerdown", a);
|
|
95
|
+
}, 0);
|
|
96
|
+
return () => {
|
|
97
|
+
window.clearTimeout(f), e.removeEventListener("pointerdown", a), e.removeEventListener("click", s.current);
|
|
98
|
+
};
|
|
99
|
+
}, [e, i]), {
|
|
100
|
+
// ensures we check React component tree (not just DOM tree)
|
|
101
|
+
onPointerDownCapture: /* @__PURE__ */ l(() => o.current = !0, "onPointerDownCapture")
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
l(J, "usePointerDownOutside");
|
|
105
|
+
function K(t, e = globalThis == null ? void 0 : globalThis.document) {
|
|
106
|
+
const i = T(t), o = r.useRef(!1);
|
|
107
|
+
return r.useEffect(() => {
|
|
108
|
+
const s = /* @__PURE__ */ l((a) => {
|
|
109
|
+
a.target && !o.current && S(X, i, { originalEvent: a }, {
|
|
110
|
+
discrete: !1
|
|
111
|
+
});
|
|
112
|
+
}, "handleFocus");
|
|
113
|
+
return e.addEventListener("focusin", s), () => e.removeEventListener("focusin", s);
|
|
114
|
+
}, [e, i]), {
|
|
115
|
+
onFocusCapture: /* @__PURE__ */ l(() => o.current = !0, "onFocusCapture"),
|
|
116
|
+
onBlurCapture: /* @__PURE__ */ l(() => o.current = !1, "onBlurCapture")
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
l(K, "useFocusOutside");
|
|
120
|
+
function g() {
|
|
121
|
+
const t = new CustomEvent(p);
|
|
122
|
+
document.dispatchEvent(t);
|
|
123
|
+
}
|
|
124
|
+
l(g, "dispatchUpdate");
|
|
125
|
+
function S(t, e, i, { discrete: o }) {
|
|
126
|
+
const s = i.originalEvent.target, a = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: i });
|
|
127
|
+
e && s.addEventListener(t, e, { once: !0 }), o ? z(s, a) : s.dispatchEvent(a);
|
|
128
|
+
}
|
|
129
|
+
l(S, "handleAndDispatchCustomEvent");
|
|
130
|
+
export {
|
|
131
|
+
Y as DismissableLayer,
|
|
132
|
+
G as DismissableLayerBranch
|
|
133
|
+
};
|