laif-ds 0.1.29 → 0.1.31
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/dist/components/ui/app-multiple-select-dropdown.js +77 -69
- package/dist/components/ui/data-cross-table.js +145 -172
- package/dist/components/ui/dropdown-menu.js +131 -0
- package/dist/components/ui/table.js +3 -10
- package/dist/index.d.ts +18 -3
- package/dist/index.js +168 -161
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +217 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-collection/dist/index.js +49 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +128 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-focus-scope/dist/index.js +138 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-menu/dist/index.js +625 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-popper/dist/index.js +221 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-primitive/dist/index.js +37 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-roving-focus/dist/index.js +184 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import { composeEventHandlers as w } from "../../primitive/dist/index.js";
|
|
4
|
+
import { composeRefs as G } from "../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { createContextScope as k } from "../../react-context/dist/index.js";
|
|
6
|
+
import { useControllableState as L } from "../node_modules/@radix-ui/react-use-controllable-state/dist/index.js";
|
|
7
|
+
import { Primitive as K } from "../node_modules/@radix-ui/react-primitive/dist/index.js";
|
|
8
|
+
import { createMenuScope as g, Root as U, Anchor as B, Portal as F, Content as H, Item as W, Label as $, Separator as j, Group as X, CheckboxItem as q, RadioGroup as z, RadioItem as J, ItemIndicator as Q, Arrow as V, SubTrigger as Y, SubContent as Z } from "../node_modules/@radix-ui/react-menu/dist/index.js";
|
|
9
|
+
import { useId as v } from "../../react-id/dist/index.js";
|
|
10
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
11
|
+
var f = "DropdownMenu", [oo, Co] = k(
|
|
12
|
+
f,
|
|
13
|
+
[g]
|
|
14
|
+
), i = g(), [eo, D] = oo(f), _ = (o) => {
|
|
15
|
+
const {
|
|
16
|
+
__scopeDropdownMenu: n,
|
|
17
|
+
children: r,
|
|
18
|
+
dir: e,
|
|
19
|
+
open: t,
|
|
20
|
+
defaultOpen: u,
|
|
21
|
+
onOpenChange: c,
|
|
22
|
+
modal: d = !0
|
|
23
|
+
} = o, s = i(n), M = p.useRef(null), [l, m] = L({
|
|
24
|
+
prop: t,
|
|
25
|
+
defaultProp: u ?? !1,
|
|
26
|
+
onChange: c,
|
|
27
|
+
caller: f
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ a(
|
|
30
|
+
eo,
|
|
31
|
+
{
|
|
32
|
+
scope: n,
|
|
33
|
+
triggerId: v(),
|
|
34
|
+
triggerRef: M,
|
|
35
|
+
contentId: v(),
|
|
36
|
+
open: l,
|
|
37
|
+
onOpenChange: m,
|
|
38
|
+
onOpenToggle: p.useCallback(() => m((T) => !T), [m]),
|
|
39
|
+
modal: d,
|
|
40
|
+
children: /* @__PURE__ */ a(U, { ...s, open: l, onOpenChange: m, dir: e, modal: d, children: r })
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
_.displayName = f;
|
|
45
|
+
var R = "DropdownMenuTrigger", h = p.forwardRef(
|
|
46
|
+
(o, n) => {
|
|
47
|
+
const { __scopeDropdownMenu: r, disabled: e = !1, ...t } = o, u = D(R, r), c = i(r);
|
|
48
|
+
return /* @__PURE__ */ a(B, { asChild: !0, ...c, children: /* @__PURE__ */ a(
|
|
49
|
+
K.button,
|
|
50
|
+
{
|
|
51
|
+
type: "button",
|
|
52
|
+
id: u.triggerId,
|
|
53
|
+
"aria-haspopup": "menu",
|
|
54
|
+
"aria-expanded": u.open,
|
|
55
|
+
"aria-controls": u.open ? u.contentId : void 0,
|
|
56
|
+
"data-state": u.open ? "open" : "closed",
|
|
57
|
+
"data-disabled": e ? "" : void 0,
|
|
58
|
+
disabled: e,
|
|
59
|
+
...t,
|
|
60
|
+
ref: G(n, u.triggerRef),
|
|
61
|
+
onPointerDown: w(o.onPointerDown, (d) => {
|
|
62
|
+
!e && d.button === 0 && d.ctrlKey === !1 && (u.onOpenToggle(), u.open || d.preventDefault());
|
|
63
|
+
}),
|
|
64
|
+
onKeyDown: w(o.onKeyDown, (d) => {
|
|
65
|
+
e || (["Enter", " "].includes(d.key) && u.onOpenToggle(), d.key === "ArrowDown" && u.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(d.key) && d.preventDefault());
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
) });
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
h.displayName = R;
|
|
72
|
+
var ro = "DropdownMenuPortal", I = (o) => {
|
|
73
|
+
const { __scopeDropdownMenu: n, ...r } = o, e = i(n);
|
|
74
|
+
return /* @__PURE__ */ a(F, { ...e, ...r });
|
|
75
|
+
};
|
|
76
|
+
I.displayName = ro;
|
|
77
|
+
var b = "DropdownMenuContent", S = p.forwardRef(
|
|
78
|
+
(o, n) => {
|
|
79
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = D(b, r), u = i(r), c = p.useRef(!1);
|
|
80
|
+
return /* @__PURE__ */ a(
|
|
81
|
+
H,
|
|
82
|
+
{
|
|
83
|
+
id: t.contentId,
|
|
84
|
+
"aria-labelledby": t.triggerId,
|
|
85
|
+
...u,
|
|
86
|
+
...e,
|
|
87
|
+
ref: n,
|
|
88
|
+
onCloseAutoFocus: w(o.onCloseAutoFocus, (d) => {
|
|
89
|
+
var s;
|
|
90
|
+
c.current || (s = t.triggerRef.current) == null || s.focus(), c.current = !1, d.preventDefault();
|
|
91
|
+
}),
|
|
92
|
+
onInteractOutside: w(o.onInteractOutside, (d) => {
|
|
93
|
+
const s = d.detail.originalEvent, M = s.button === 0 && s.ctrlKey === !0, l = s.button === 2 || M;
|
|
94
|
+
(!t.modal || l) && (c.current = !0);
|
|
95
|
+
}),
|
|
96
|
+
style: {
|
|
97
|
+
...o.style,
|
|
98
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
99
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
100
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
101
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
102
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
S.displayName = b;
|
|
109
|
+
var no = "DropdownMenuGroup", to = p.forwardRef(
|
|
110
|
+
(o, n) => {
|
|
111
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
112
|
+
return /* @__PURE__ */ a(X, { ...t, ...e, ref: n });
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
to.displayName = no;
|
|
116
|
+
var ao = "DropdownMenuLabel", C = p.forwardRef(
|
|
117
|
+
(o, n) => {
|
|
118
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
119
|
+
return /* @__PURE__ */ a($, { ...t, ...e, ref: n });
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
C.displayName = ao;
|
|
123
|
+
var po = "DropdownMenuItem", N = p.forwardRef(
|
|
124
|
+
(o, n) => {
|
|
125
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
126
|
+
return /* @__PURE__ */ a(W, { ...t, ...e, ref: n });
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
N.displayName = po;
|
|
130
|
+
var io = "DropdownMenuCheckboxItem", x = p.forwardRef((o, n) => {
|
|
131
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
132
|
+
return /* @__PURE__ */ a(q, { ...t, ...e, ref: n });
|
|
133
|
+
});
|
|
134
|
+
x.displayName = io;
|
|
135
|
+
var uo = "DropdownMenuRadioGroup", so = p.forwardRef((o, n) => {
|
|
136
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
137
|
+
return /* @__PURE__ */ a(z, { ...t, ...e, ref: n });
|
|
138
|
+
});
|
|
139
|
+
so.displayName = uo;
|
|
140
|
+
var co = "DropdownMenuRadioItem", A = p.forwardRef((o, n) => {
|
|
141
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
142
|
+
return /* @__PURE__ */ a(J, { ...t, ...e, ref: n });
|
|
143
|
+
});
|
|
144
|
+
A.displayName = co;
|
|
145
|
+
var lo = "DropdownMenuItemIndicator", E = p.forwardRef((o, n) => {
|
|
146
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
147
|
+
return /* @__PURE__ */ a(Q, { ...t, ...e, ref: n });
|
|
148
|
+
});
|
|
149
|
+
E.displayName = lo;
|
|
150
|
+
var mo = "DropdownMenuSeparator", P = p.forwardRef((o, n) => {
|
|
151
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
152
|
+
return /* @__PURE__ */ a(j, { ...t, ...e, ref: n });
|
|
153
|
+
});
|
|
154
|
+
P.displayName = mo;
|
|
155
|
+
var wo = "DropdownMenuArrow", fo = p.forwardRef(
|
|
156
|
+
(o, n) => {
|
|
157
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
158
|
+
return /* @__PURE__ */ a(V, { ...t, ...e, ref: n });
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
fo.displayName = wo;
|
|
162
|
+
var Mo = "DropdownMenuSubTrigger", y = p.forwardRef((o, n) => {
|
|
163
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
164
|
+
return /* @__PURE__ */ a(Y, { ...t, ...e, ref: n });
|
|
165
|
+
});
|
|
166
|
+
y.displayName = Mo;
|
|
167
|
+
var vo = "DropdownMenuSubContent", O = p.forwardRef((o, n) => {
|
|
168
|
+
const { __scopeDropdownMenu: r, ...e } = o, t = i(r);
|
|
169
|
+
return /* @__PURE__ */ a(
|
|
170
|
+
Z,
|
|
171
|
+
{
|
|
172
|
+
...t,
|
|
173
|
+
...e,
|
|
174
|
+
ref: n,
|
|
175
|
+
style: {
|
|
176
|
+
...o.style,
|
|
177
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
178
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
179
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
180
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
181
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
O.displayName = vo;
|
|
187
|
+
var No = _, xo = h, Ao = I, Eo = S, Po = C, yo = N, Oo = x, To = A, Go = E, ko = P, Lo = y, Ko = O;
|
|
188
|
+
export {
|
|
189
|
+
Oo as CheckboxItem,
|
|
190
|
+
Eo as Content,
|
|
191
|
+
_ as DropdownMenu,
|
|
192
|
+
fo as DropdownMenuArrow,
|
|
193
|
+
x as DropdownMenuCheckboxItem,
|
|
194
|
+
S as DropdownMenuContent,
|
|
195
|
+
to as DropdownMenuGroup,
|
|
196
|
+
N as DropdownMenuItem,
|
|
197
|
+
E as DropdownMenuItemIndicator,
|
|
198
|
+
C as DropdownMenuLabel,
|
|
199
|
+
I as DropdownMenuPortal,
|
|
200
|
+
so as DropdownMenuRadioGroup,
|
|
201
|
+
A as DropdownMenuRadioItem,
|
|
202
|
+
P as DropdownMenuSeparator,
|
|
203
|
+
O as DropdownMenuSubContent,
|
|
204
|
+
y as DropdownMenuSubTrigger,
|
|
205
|
+
h as DropdownMenuTrigger,
|
|
206
|
+
yo as Item,
|
|
207
|
+
Go as ItemIndicator,
|
|
208
|
+
Po as Label,
|
|
209
|
+
Ao as Portal,
|
|
210
|
+
To as RadioItem,
|
|
211
|
+
No as Root,
|
|
212
|
+
ko as Separator,
|
|
213
|
+
Ko as SubContent,
|
|
214
|
+
Lo as SubTrigger,
|
|
215
|
+
xo as Trigger,
|
|
216
|
+
Co as createDropdownMenuScope
|
|
217
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as m from "react";
|
|
3
|
+
import { Primitive as p } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
5
|
+
var v = "Arrow", e = m.forwardRef((r, i) => {
|
|
6
|
+
const { children: t, width: a = 10, height: s = 5, ...n } = r;
|
|
7
|
+
return /* @__PURE__ */ o(
|
|
8
|
+
p.svg,
|
|
9
|
+
{
|
|
10
|
+
...n,
|
|
11
|
+
ref: i,
|
|
12
|
+
width: a,
|
|
13
|
+
height: s,
|
|
14
|
+
viewBox: "0 0 30 10",
|
|
15
|
+
preserveAspectRatio: "none",
|
|
16
|
+
children: r.asChild ? t : /* @__PURE__ */ o("polygon", { points: "0,0 30,0 15,10" })
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
e.displayName = v;
|
|
21
|
+
var f = e;
|
|
22
|
+
export {
|
|
23
|
+
e as Arrow,
|
|
24
|
+
f as Root
|
|
25
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import r from "react";
|
|
3
|
+
import { createContextScope as y } from "../../../../../react-context/dist/index.js";
|
|
4
|
+
import { useComposedRefs as M } from "../../../../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { createSlot as x } from "../../../../../react-slot/dist/index.js";
|
|
6
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
7
|
+
function g(s) {
|
|
8
|
+
const m = s + "CollectionProvider", [A, N] = y(m), [_, f] = A(
|
|
9
|
+
m,
|
|
10
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
11
|
+
), p = (c) => {
|
|
12
|
+
const { scope: e, children: l } = c, o = r.useRef(null), t = r.useRef(/* @__PURE__ */ new Map()).current;
|
|
13
|
+
return /* @__PURE__ */ d(_, { scope: e, itemMap: t, collectionRef: o, children: l });
|
|
14
|
+
};
|
|
15
|
+
p.displayName = m;
|
|
16
|
+
const u = s + "CollectionSlot", E = x(u), C = r.forwardRef(
|
|
17
|
+
(c, e) => {
|
|
18
|
+
const { scope: l, children: o } = c, t = f(u, l), n = M(e, t.collectionRef);
|
|
19
|
+
return /* @__PURE__ */ d(E, { ref: n, children: o });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
C.displayName = u;
|
|
23
|
+
const a = s + "CollectionItemSlot", R = "data-radix-collection-item", T = x(a), I = r.forwardRef(
|
|
24
|
+
(c, e) => {
|
|
25
|
+
const { scope: l, children: o, ...t } = c, n = r.useRef(null), S = M(e, n), i = f(a, l);
|
|
26
|
+
return r.useEffect(() => (i.itemMap.set(n, { ref: n, ...t }), () => void i.itemMap.delete(n))), /* @__PURE__ */ d(T, { [R]: "", ref: S, children: o });
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
I.displayName = a;
|
|
30
|
+
function O(c) {
|
|
31
|
+
const e = f(s + "CollectionConsumer", c);
|
|
32
|
+
return r.useCallback(() => {
|
|
33
|
+
const o = e.collectionRef.current;
|
|
34
|
+
if (!o) return [];
|
|
35
|
+
const t = Array.from(o.querySelectorAll(`[${R}]`));
|
|
36
|
+
return Array.from(e.itemMap.values()).sort(
|
|
37
|
+
(i, v) => t.indexOf(i.ref.current) - t.indexOf(v.ref.current)
|
|
38
|
+
);
|
|
39
|
+
}, [e.collectionRef, e.itemMap]);
|
|
40
|
+
}
|
|
41
|
+
return [
|
|
42
|
+
{ Provider: p, Slot: C, ItemSlot: I },
|
|
43
|
+
O,
|
|
44
|
+
N
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
g as createCollection
|
|
49
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { composeEventHandlers as m } from "../../../../../primitive/dist/index.js";
|
|
4
|
+
import { Primitive as g, dispatchDiscreteCustomEvent as k } from "../../react-primitive/dist/index.js";
|
|
5
|
+
import { useComposedRefs as R } from "../../../../../react-compose-refs/dist/index.js";
|
|
6
|
+
import { useCallbackRef as w } from "../../../../../react-use-callback-ref/dist/index.js";
|
|
7
|
+
import { useEscapeKeydown as U } from "../../../../../react-use-escape-keydown/dist/index.js";
|
|
8
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
9
|
+
var z = "DismissableLayer", y = "dismissableLayer.update", H = "dismissableLayer.pointerDownOutside", M = "dismissableLayer.focusOutside", L, B = n.createContext({
|
|
10
|
+
layers: /* @__PURE__ */ new Set(),
|
|
11
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
12
|
+
branches: /* @__PURE__ */ new Set()
|
|
13
|
+
}), j = n.forwardRef(
|
|
14
|
+
(r, e) => {
|
|
15
|
+
const {
|
|
16
|
+
disableOutsidePointerEvents: i = !1,
|
|
17
|
+
onEscapeKeyDown: o,
|
|
18
|
+
onPointerDownOutside: t,
|
|
19
|
+
onFocusOutside: a,
|
|
20
|
+
onInteractOutside: l,
|
|
21
|
+
onDismiss: d,
|
|
22
|
+
...v
|
|
23
|
+
} = r, c = n.useContext(B), [u, S] = n.useState(null), f = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = n.useState({}), W = R(e, (s) => S(s)), p = Array.from(c.layers), [A] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), N = p.indexOf(A), b = u ? p.indexOf(u) : -1, I = c.layersWithOutsidePointerEventsDisabled.size > 0, P = b >= N, _ = q((s) => {
|
|
24
|
+
const E = s.target, C = [...c.branches].some((h) => h.contains(E));
|
|
25
|
+
!P || C || (t == null || t(s), l == null || l(s), s.defaultPrevented || d == null || d());
|
|
26
|
+
}, f), D = G((s) => {
|
|
27
|
+
const E = s.target;
|
|
28
|
+
[...c.branches].some((h) => h.contains(E)) || (a == null || a(s), l == null || l(s), s.defaultPrevented || d == null || d());
|
|
29
|
+
}, f);
|
|
30
|
+
return U((s) => {
|
|
31
|
+
b === c.layers.size - 1 && (o == null || o(s), !s.defaultPrevented && d && (s.preventDefault(), d()));
|
|
32
|
+
}, f), n.useEffect(() => {
|
|
33
|
+
if (u)
|
|
34
|
+
return i && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (L = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), O(), () => {
|
|
35
|
+
i && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = L);
|
|
36
|
+
};
|
|
37
|
+
}, [u, f, i, c]), n.useEffect(() => () => {
|
|
38
|
+
u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), O());
|
|
39
|
+
}, [u, c]), n.useEffect(() => {
|
|
40
|
+
const s = () => F({});
|
|
41
|
+
return document.addEventListener(y, s), () => document.removeEventListener(y, s);
|
|
42
|
+
}, []), /* @__PURE__ */ T(
|
|
43
|
+
g.div,
|
|
44
|
+
{
|
|
45
|
+
...v,
|
|
46
|
+
ref: W,
|
|
47
|
+
style: {
|
|
48
|
+
pointerEvents: I ? P ? "auto" : "none" : void 0,
|
|
49
|
+
...r.style
|
|
50
|
+
},
|
|
51
|
+
onFocusCapture: m(r.onFocusCapture, D.onFocusCapture),
|
|
52
|
+
onBlurCapture: m(r.onBlurCapture, D.onBlurCapture),
|
|
53
|
+
onPointerDownCapture: m(
|
|
54
|
+
r.onPointerDownCapture,
|
|
55
|
+
_.onPointerDownCapture
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
j.displayName = z;
|
|
62
|
+
var X = "DismissableLayerBranch", Y = n.forwardRef((r, e) => {
|
|
63
|
+
const i = n.useContext(B), o = n.useRef(null), t = R(e, o);
|
|
64
|
+
return n.useEffect(() => {
|
|
65
|
+
const a = o.current;
|
|
66
|
+
if (a)
|
|
67
|
+
return i.branches.add(a), () => {
|
|
68
|
+
i.branches.delete(a);
|
|
69
|
+
};
|
|
70
|
+
}, [i.branches]), /* @__PURE__ */ T(g.div, { ...r, ref: t });
|
|
71
|
+
});
|
|
72
|
+
Y.displayName = X;
|
|
73
|
+
function q(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
74
|
+
const i = w(r), o = n.useRef(!1), t = n.useRef(() => {
|
|
75
|
+
});
|
|
76
|
+
return n.useEffect(() => {
|
|
77
|
+
const a = (d) => {
|
|
78
|
+
if (d.target && !o.current) {
|
|
79
|
+
let v = function() {
|
|
80
|
+
x(
|
|
81
|
+
H,
|
|
82
|
+
i,
|
|
83
|
+
c,
|
|
84
|
+
{ discrete: !0 }
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
const c = { originalEvent: d };
|
|
88
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", t.current), t.current = v, e.addEventListener("click", t.current, { once: !0 })) : v();
|
|
89
|
+
} else
|
|
90
|
+
e.removeEventListener("click", t.current);
|
|
91
|
+
o.current = !1;
|
|
92
|
+
}, l = window.setTimeout(() => {
|
|
93
|
+
e.addEventListener("pointerdown", a);
|
|
94
|
+
}, 0);
|
|
95
|
+
return () => {
|
|
96
|
+
window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", t.current);
|
|
97
|
+
};
|
|
98
|
+
}, [e, i]), {
|
|
99
|
+
// ensures we check React component tree (not just DOM tree)
|
|
100
|
+
onPointerDownCapture: () => o.current = !0
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function G(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
104
|
+
const i = w(r), o = n.useRef(!1);
|
|
105
|
+
return n.useEffect(() => {
|
|
106
|
+
const t = (a) => {
|
|
107
|
+
a.target && !o.current && x(M, i, { originalEvent: a }, {
|
|
108
|
+
discrete: !1
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
|
|
112
|
+
}, [e, i]), {
|
|
113
|
+
onFocusCapture: () => o.current = !0,
|
|
114
|
+
onBlurCapture: () => o.current = !1
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function O() {
|
|
118
|
+
const r = new CustomEvent(y);
|
|
119
|
+
document.dispatchEvent(r);
|
|
120
|
+
}
|
|
121
|
+
function x(r, e, i, { discrete: o }) {
|
|
122
|
+
const t = i.originalEvent.target, a = new CustomEvent(r, { bubbles: !1, cancelable: !0, detail: i });
|
|
123
|
+
e && t.addEventListener(r, e, { once: !0 }), o ? k(t, a) : t.dispatchEvent(a);
|
|
124
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
j as DismissableLayer,
|
|
127
|
+
Y as DismissableLayerBranch
|
|
128
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { useComposedRefs as R } from "../../../../../react-compose-refs/dist/index.js";
|
|
4
|
+
import { Primitive as M } from "../../react-primitive/dist/index.js";
|
|
5
|
+
import { useCallbackRef as y } from "../../../../../react-use-callback-ref/dist/index.js";
|
|
6
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
7
|
+
var F = "focusScope.autoFocusOnMount", T = "focusScope.autoFocusOnUnmount", N = { bubbles: !1, cancelable: !0 }, K = "FocusScope", k = d.forwardRef((e, n) => {
|
|
8
|
+
const {
|
|
9
|
+
loop: t = !1,
|
|
10
|
+
trapped: u = !1,
|
|
11
|
+
onMountAutoFocus: p,
|
|
12
|
+
onUnmountAutoFocus: L,
|
|
13
|
+
...g
|
|
14
|
+
} = e, [o, U] = d.useState(null), E = y(p), v = y(L), b = d.useRef(null), A = R(n, (s) => U(s)), a = d.useRef({
|
|
15
|
+
paused: !1,
|
|
16
|
+
pause() {
|
|
17
|
+
this.paused = !0;
|
|
18
|
+
},
|
|
19
|
+
resume() {
|
|
20
|
+
this.paused = !1;
|
|
21
|
+
}
|
|
22
|
+
}).current;
|
|
23
|
+
d.useEffect(() => {
|
|
24
|
+
if (u) {
|
|
25
|
+
let s = function(i) {
|
|
26
|
+
if (a.paused || !o) return;
|
|
27
|
+
const c = i.target;
|
|
28
|
+
o.contains(c) ? b.current = c : f(b.current, { select: !0 });
|
|
29
|
+
}, l = function(i) {
|
|
30
|
+
if (a.paused || !o) return;
|
|
31
|
+
const c = i.relatedTarget;
|
|
32
|
+
c !== null && (o.contains(c) || f(b.current, { select: !0 }));
|
|
33
|
+
}, r = function(i) {
|
|
34
|
+
if (document.activeElement === document.body)
|
|
35
|
+
for (const h of i)
|
|
36
|
+
h.removedNodes.length > 0 && f(o);
|
|
37
|
+
};
|
|
38
|
+
document.addEventListener("focusin", s), document.addEventListener("focusout", l);
|
|
39
|
+
const m = new MutationObserver(r);
|
|
40
|
+
return o && m.observe(o, { childList: !0, subtree: !0 }), () => {
|
|
41
|
+
document.removeEventListener("focusin", s), document.removeEventListener("focusout", l), m.disconnect();
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}, [u, o, a.paused]), d.useEffect(() => {
|
|
45
|
+
if (o) {
|
|
46
|
+
S.add(a);
|
|
47
|
+
const s = document.activeElement;
|
|
48
|
+
if (!o.contains(s)) {
|
|
49
|
+
const r = new CustomEvent(F, N);
|
|
50
|
+
o.addEventListener(F, E), o.dispatchEvent(r), r.defaultPrevented || (w(W(I(o)), { select: !0 }), document.activeElement === s && f(o));
|
|
51
|
+
}
|
|
52
|
+
return () => {
|
|
53
|
+
o.removeEventListener(F, E), setTimeout(() => {
|
|
54
|
+
const r = new CustomEvent(T, N);
|
|
55
|
+
o.addEventListener(T, v), o.dispatchEvent(r), r.defaultPrevented || f(s ?? document.body, { select: !0 }), o.removeEventListener(T, v), S.remove(a);
|
|
56
|
+
}, 0);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}, [o, E, v, a]);
|
|
60
|
+
const P = d.useCallback(
|
|
61
|
+
(s) => {
|
|
62
|
+
if (!t && !u || a.paused) return;
|
|
63
|
+
const l = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, r = document.activeElement;
|
|
64
|
+
if (l && r) {
|
|
65
|
+
const m = s.currentTarget, [i, c] = x(m);
|
|
66
|
+
i && c ? !s.shiftKey && r === c ? (s.preventDefault(), t && f(i, { select: !0 })) : s.shiftKey && r === i && (s.preventDefault(), t && f(c, { select: !0 })) : r === m && s.preventDefault();
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
[t, u, a.paused]
|
|
70
|
+
);
|
|
71
|
+
return /* @__PURE__ */ _(M.div, { tabIndex: -1, ...g, ref: A, onKeyDown: P });
|
|
72
|
+
});
|
|
73
|
+
k.displayName = K;
|
|
74
|
+
function w(e, { select: n = !1 } = {}) {
|
|
75
|
+
const t = document.activeElement;
|
|
76
|
+
for (const u of e)
|
|
77
|
+
if (f(u, { select: n }), document.activeElement !== t) return;
|
|
78
|
+
}
|
|
79
|
+
function x(e) {
|
|
80
|
+
const n = I(e), t = O(n, e), u = O(n.reverse(), e);
|
|
81
|
+
return [t, u];
|
|
82
|
+
}
|
|
83
|
+
function I(e) {
|
|
84
|
+
const n = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
85
|
+
acceptNode: (u) => {
|
|
86
|
+
const p = u.tagName === "INPUT" && u.type === "hidden";
|
|
87
|
+
return u.disabled || u.hidden || p ? NodeFilter.FILTER_SKIP : u.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
for (; t.nextNode(); ) n.push(t.currentNode);
|
|
91
|
+
return n;
|
|
92
|
+
}
|
|
93
|
+
function O(e, n) {
|
|
94
|
+
for (const t of e)
|
|
95
|
+
if (!D(t, { upTo: n })) return t;
|
|
96
|
+
}
|
|
97
|
+
function D(e, { upTo: n }) {
|
|
98
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
99
|
+
for (; e; ) {
|
|
100
|
+
if (n !== void 0 && e === n) return !1;
|
|
101
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
102
|
+
e = e.parentElement;
|
|
103
|
+
}
|
|
104
|
+
return !1;
|
|
105
|
+
}
|
|
106
|
+
function H(e) {
|
|
107
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
108
|
+
}
|
|
109
|
+
function f(e, { select: n = !1 } = {}) {
|
|
110
|
+
if (e && e.focus) {
|
|
111
|
+
const t = document.activeElement;
|
|
112
|
+
e.focus({ preventScroll: !0 }), e !== t && H(e) && n && e.select();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
var S = V();
|
|
116
|
+
function V() {
|
|
117
|
+
let e = [];
|
|
118
|
+
return {
|
|
119
|
+
add(n) {
|
|
120
|
+
const t = e[0];
|
|
121
|
+
n !== t && (t == null || t.pause()), e = C(e, n), e.unshift(n);
|
|
122
|
+
},
|
|
123
|
+
remove(n) {
|
|
124
|
+
var t;
|
|
125
|
+
e = C(e, n), (t = e[0]) == null || t.resume();
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function C(e, n) {
|
|
130
|
+
const t = [...e], u = t.indexOf(n);
|
|
131
|
+
return u !== -1 && t.splice(u, 1), t;
|
|
132
|
+
}
|
|
133
|
+
function W(e) {
|
|
134
|
+
return e.filter((n) => n.tagName !== "A");
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
k as FocusScope
|
|
138
|
+
};
|