kiban-design-system 3.8.0 → 3.10.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/dist/components/data-table/components/DataTableFooter.d.ts +15 -0
- package/dist/components/data-table/components/DataTableFooter.d.ts.map +1 -0
- package/dist/components/data-table/components/DataTableFooter.js +25 -0
- package/dist/components/data-table/components/DataTableHeader.d.ts +8 -0
- package/dist/components/data-table/components/DataTableHeader.d.ts.map +1 -0
- package/dist/components/data-table/components/DataTableHeader.js +27 -0
- package/dist/components/data-table/components/DataTableHeaderCell.d.ts +11 -0
- package/dist/components/data-table/components/DataTableHeaderCell.d.ts.map +1 -0
- package/dist/components/data-table/components/DataTableHeaderCell.js +81 -0
- package/dist/components/data-table/components/DataTablePagination.d.ts +9 -0
- package/dist/components/data-table/components/DataTablePagination.d.ts.map +1 -0
- package/dist/components/data-table/components/DataTablePagination.js +36 -0
- package/dist/components/data-table/components/DataTableTotalsRow.d.ts +10 -0
- package/dist/components/data-table/components/DataTableTotalsRow.d.ts.map +1 -0
- package/dist/components/data-table/components/DataTableTotalsRow.js +95 -0
- package/dist/components/data-table/data-table.d.ts +26 -0
- package/dist/components/data-table/data-table.d.ts.map +1 -0
- package/dist/components/data-table/data-table.js +134 -0
- package/dist/components/data-table/hooks/useDataTableColumns.d.ts +5 -0
- package/dist/components/data-table/hooks/useDataTableColumns.d.ts.map +1 -0
- package/dist/components/data-table/hooks/useDataTableColumns.js +39 -0
- package/dist/components/data-table/hooks/useDataTableConfig.d.ts +18 -0
- package/dist/components/data-table/hooks/useDataTableConfig.d.ts.map +1 -0
- package/dist/components/data-table/hooks/useDataTableConfig.js +54 -0
- package/dist/components/data-table/hooks/useStickyColumns.d.ts +5 -0
- package/dist/components/data-table/hooks/useStickyColumns.d.ts.map +1 -0
- package/dist/components/data-table/hooks/useStickyColumns.js +20 -0
- package/dist/components/data-table/utils/iconMap.d.ts +4 -0
- package/dist/components/data-table/utils/iconMap.d.ts.map +1 -0
- package/dist/components/data-table/utils/iconMap.js +11 -0
- package/dist/components/data-table/utils/stickyColumns.d.ts +17 -0
- package/dist/components/data-table/utils/stickyColumns.d.ts.map +1 -0
- package/dist/components/data-table/utils/stickyColumns.js +10 -0
- package/dist/components/data-table.d.ts +2 -0
- package/dist/components/data-table.d.ts.map +1 -0
- package/dist/components/header.d.ts +26 -0
- package/dist/components/header.d.ts.map +1 -0
- package/dist/components/header.js +81 -0
- package/dist/components/ui/avatar.d.ts +12 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +106 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +40 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +33 -0
- package/dist/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +126 -0
- package/dist/components/ui/table.d.ts +11 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +115 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +56 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +97 -67
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +532 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +402 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +208 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +130 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +50 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +53 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +213 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +136 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +13 -0
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +608 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +219 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +183 -0
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +338 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +10 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +32 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +7 -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 +115 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +68 -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 +71 -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 +25 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +11 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +15 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +30 -0
- package/dist/node_modules/tslib/tslib.es6.js +27 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +6 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +26 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +25 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +18 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +67 -0
- package/dist/style.css +1 -1
- package/package.json +8 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import * as p from "react";
|
|
2
|
+
import { composeEventHandlers as m } from "../../primitive/dist/index.js";
|
|
3
|
+
import { composeRefs as T } from "../../react-compose-refs/dist/index.js";
|
|
4
|
+
import { createContextScope as G } from "../../react-context/dist/index.js";
|
|
5
|
+
import { useControllableState as k } from "../../react-use-controllable-state/dist/index.js";
|
|
6
|
+
import { Primitive as L } from "../../react-primitive/dist/index.js";
|
|
7
|
+
import { SubTrigger as K, SubContent as U, Portal as B, Content as F, Item as H, CheckboxItem as W, RadioItem as $, Label as j, Separator as X, createMenuScope as v, Root as q, Anchor as z, Group as J, RadioGroup as Q, ItemIndicator as V, Arrow as Y } from "../../react-menu/dist/index.js";
|
|
8
|
+
import { useId as g } from "../../react-id/dist/index.js";
|
|
9
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
10
|
+
var f = "DropdownMenu", [Z] = G(
|
|
11
|
+
f,
|
|
12
|
+
[v]
|
|
13
|
+
), i = v(), [oo, D] = Z(f), _ = (o) => {
|
|
14
|
+
const {
|
|
15
|
+
__scopeDropdownMenu: n,
|
|
16
|
+
children: r,
|
|
17
|
+
dir: e,
|
|
18
|
+
open: a,
|
|
19
|
+
defaultOpen: u,
|
|
20
|
+
onOpenChange: s,
|
|
21
|
+
modal: d = !0
|
|
22
|
+
} = o, c = i(n), M = p.useRef(null), [l, w] = k({
|
|
23
|
+
prop: a,
|
|
24
|
+
defaultProp: u ?? !1,
|
|
25
|
+
onChange: s,
|
|
26
|
+
caller: f
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */ t(
|
|
29
|
+
oo,
|
|
30
|
+
{
|
|
31
|
+
scope: n,
|
|
32
|
+
triggerId: g(),
|
|
33
|
+
triggerRef: M,
|
|
34
|
+
contentId: g(),
|
|
35
|
+
open: l,
|
|
36
|
+
onOpenChange: w,
|
|
37
|
+
onOpenToggle: p.useCallback(() => w((O) => !O), [w]),
|
|
38
|
+
modal: d,
|
|
39
|
+
children: /* @__PURE__ */ t(q, { ...c, open: l, onOpenChange: w, dir: e, modal: d, children: r })
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
_.displayName = f;
|
|
44
|
+
var R = "DropdownMenuTrigger", h = p.forwardRef(
|
|
45
|
+
(o, n) => {
|
|
46
|
+
const { __scopeDropdownMenu: r, disabled: e = !1, ...a } = o, u = D(R, r), s = i(r);
|
|
47
|
+
return /* @__PURE__ */ t(z, { asChild: !0, ...s, children: /* @__PURE__ */ t(
|
|
48
|
+
L.button,
|
|
49
|
+
{
|
|
50
|
+
type: "button",
|
|
51
|
+
id: u.triggerId,
|
|
52
|
+
"aria-haspopup": "menu",
|
|
53
|
+
"aria-expanded": u.open,
|
|
54
|
+
"aria-controls": u.open ? u.contentId : void 0,
|
|
55
|
+
"data-state": u.open ? "open" : "closed",
|
|
56
|
+
"data-disabled": e ? "" : void 0,
|
|
57
|
+
disabled: e,
|
|
58
|
+
...a,
|
|
59
|
+
ref: T(n, u.triggerRef),
|
|
60
|
+
onPointerDown: m(o.onPointerDown, (d) => {
|
|
61
|
+
!e && d.button === 0 && d.ctrlKey === !1 && (u.onOpenToggle(), u.open || d.preventDefault());
|
|
62
|
+
}),
|
|
63
|
+
onKeyDown: m(o.onKeyDown, (d) => {
|
|
64
|
+
e || (["Enter", " "].includes(d.key) && u.onOpenToggle(), d.key === "ArrowDown" && u.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(d.key) && d.preventDefault());
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
) });
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
h.displayName = R;
|
|
71
|
+
var eo = "DropdownMenuPortal", I = (o) => {
|
|
72
|
+
const { __scopeDropdownMenu: n, ...r } = o, e = i(n);
|
|
73
|
+
return /* @__PURE__ */ t(B, { ...e, ...r });
|
|
74
|
+
};
|
|
75
|
+
I.displayName = eo;
|
|
76
|
+
var b = "DropdownMenuContent", C = p.forwardRef(
|
|
77
|
+
(o, n) => {
|
|
78
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = D(b, r), u = i(r), s = p.useRef(!1);
|
|
79
|
+
return /* @__PURE__ */ t(
|
|
80
|
+
F,
|
|
81
|
+
{
|
|
82
|
+
id: a.contentId,
|
|
83
|
+
"aria-labelledby": a.triggerId,
|
|
84
|
+
...u,
|
|
85
|
+
...e,
|
|
86
|
+
ref: n,
|
|
87
|
+
onCloseAutoFocus: m(o.onCloseAutoFocus, (d) => {
|
|
88
|
+
s.current || a.triggerRef.current?.focus(), s.current = !1, d.preventDefault();
|
|
89
|
+
}),
|
|
90
|
+
onInteractOutside: m(o.onInteractOutside, (d) => {
|
|
91
|
+
const c = d.detail.originalEvent, M = c.button === 0 && c.ctrlKey === !0, l = c.button === 2 || M;
|
|
92
|
+
(!a.modal || l) && (s.current = !0);
|
|
93
|
+
}),
|
|
94
|
+
style: {
|
|
95
|
+
...o.style,
|
|
96
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
97
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
98
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
99
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
100
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
C.displayName = b;
|
|
107
|
+
var ro = "DropdownMenuGroup", no = p.forwardRef(
|
|
108
|
+
(o, n) => {
|
|
109
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
110
|
+
return /* @__PURE__ */ t(J, { ...a, ...e, ref: n });
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
no.displayName = ro;
|
|
114
|
+
var ao = "DropdownMenuLabel", N = p.forwardRef(
|
|
115
|
+
(o, n) => {
|
|
116
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
117
|
+
return /* @__PURE__ */ t(j, { ...a, ...e, ref: n });
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
N.displayName = ao;
|
|
121
|
+
var to = "DropdownMenuItem", S = p.forwardRef(
|
|
122
|
+
(o, n) => {
|
|
123
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
124
|
+
return /* @__PURE__ */ t(H, { ...a, ...e, ref: n });
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
S.displayName = to;
|
|
128
|
+
var po = "DropdownMenuCheckboxItem", x = p.forwardRef((o, n) => {
|
|
129
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
130
|
+
return /* @__PURE__ */ t(W, { ...a, ...e, ref: n });
|
|
131
|
+
});
|
|
132
|
+
x.displayName = po;
|
|
133
|
+
var io = "DropdownMenuRadioGroup", uo = p.forwardRef((o, n) => {
|
|
134
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
135
|
+
return /* @__PURE__ */ t(Q, { ...a, ...e, ref: n });
|
|
136
|
+
});
|
|
137
|
+
uo.displayName = io;
|
|
138
|
+
var so = "DropdownMenuRadioItem", A = p.forwardRef((o, n) => {
|
|
139
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
140
|
+
return /* @__PURE__ */ t($, { ...a, ...e, ref: n });
|
|
141
|
+
});
|
|
142
|
+
A.displayName = so;
|
|
143
|
+
var co = "DropdownMenuItemIndicator", lo = p.forwardRef((o, n) => {
|
|
144
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
145
|
+
return /* @__PURE__ */ t(V, { ...a, ...e, ref: n });
|
|
146
|
+
});
|
|
147
|
+
lo.displayName = co;
|
|
148
|
+
var wo = "DropdownMenuSeparator", E = p.forwardRef((o, n) => {
|
|
149
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
150
|
+
return /* @__PURE__ */ t(X, { ...a, ...e, ref: n });
|
|
151
|
+
});
|
|
152
|
+
E.displayName = wo;
|
|
153
|
+
var mo = "DropdownMenuArrow", fo = p.forwardRef(
|
|
154
|
+
(o, n) => {
|
|
155
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
156
|
+
return /* @__PURE__ */ t(Y, { ...a, ...e, ref: n });
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
fo.displayName = mo;
|
|
160
|
+
var Mo = "DropdownMenuSubTrigger", P = p.forwardRef((o, n) => {
|
|
161
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
162
|
+
return /* @__PURE__ */ t(K, { ...a, ...e, ref: n });
|
|
163
|
+
});
|
|
164
|
+
P.displayName = Mo;
|
|
165
|
+
var go = "DropdownMenuSubContent", y = p.forwardRef((o, n) => {
|
|
166
|
+
const { __scopeDropdownMenu: r, ...e } = o, a = i(r);
|
|
167
|
+
return /* @__PURE__ */ t(
|
|
168
|
+
U,
|
|
169
|
+
{
|
|
170
|
+
...a,
|
|
171
|
+
...e,
|
|
172
|
+
ref: n,
|
|
173
|
+
style: {
|
|
174
|
+
...o.style,
|
|
175
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
176
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
177
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
178
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
179
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
});
|
|
184
|
+
y.displayName = go;
|
|
185
|
+
var No = _, So = h, xo = I, Ao = C, Eo = N, Po = S, yo = x, Oo = A, To = E, Go = P, ko = y;
|
|
186
|
+
export {
|
|
187
|
+
yo as CheckboxItem,
|
|
188
|
+
Ao as Content,
|
|
189
|
+
_ as DropdownMenu,
|
|
190
|
+
fo as DropdownMenuArrow,
|
|
191
|
+
x as DropdownMenuCheckboxItem,
|
|
192
|
+
C as DropdownMenuContent,
|
|
193
|
+
no as DropdownMenuGroup,
|
|
194
|
+
S as DropdownMenuItem,
|
|
195
|
+
lo as DropdownMenuItemIndicator,
|
|
196
|
+
N as DropdownMenuLabel,
|
|
197
|
+
I as DropdownMenuPortal,
|
|
198
|
+
uo as DropdownMenuRadioGroup,
|
|
199
|
+
A as DropdownMenuRadioItem,
|
|
200
|
+
E as DropdownMenuSeparator,
|
|
201
|
+
y as DropdownMenuSubContent,
|
|
202
|
+
P as DropdownMenuSubTrigger,
|
|
203
|
+
h as DropdownMenuTrigger,
|
|
204
|
+
Po as Item,
|
|
205
|
+
Eo as Label,
|
|
206
|
+
xo as Portal,
|
|
207
|
+
Oo as RadioItem,
|
|
208
|
+
No as Root,
|
|
209
|
+
To as Separator,
|
|
210
|
+
ko as SubContent,
|
|
211
|
+
Go as SubTrigger,
|
|
212
|
+
So as Trigger
|
|
213
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
var t = 0;
|
|
3
|
+
function a() {
|
|
4
|
+
r.useEffect(() => {
|
|
5
|
+
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
6
|
+
return document.body.insertAdjacentElement("afterbegin", e[0] ?? n()), document.body.insertAdjacentElement("beforeend", e[1] ?? n()), t++, () => {
|
|
7
|
+
t === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((o) => o.remove()), t--;
|
|
8
|
+
};
|
|
9
|
+
}, []);
|
|
10
|
+
}
|
|
11
|
+
function n() {
|
|
12
|
+
const e = document.createElement("span");
|
|
13
|
+
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;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
a as useFocusGuards
|
|
17
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { useComposedRefs as R } from "../../react-compose-refs/dist/index.js";
|
|
3
|
+
import { Primitive as M } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useCallbackRef as y } from "../../react-use-callback-ref/dist/index.js";
|
|
5
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
6
|
+
var F = "focusScope.autoFocusOnMount", T = "focusScope.autoFocusOnUnmount", N = { bubbles: !1, cancelable: !0 }, K = "FocusScope", k = d.forwardRef((e, t) => {
|
|
7
|
+
const {
|
|
8
|
+
loop: n = !1,
|
|
9
|
+
trapped: u = !1,
|
|
10
|
+
onMountAutoFocus: p,
|
|
11
|
+
onUnmountAutoFocus: L,
|
|
12
|
+
...g
|
|
13
|
+
} = e, [o, U] = d.useState(null), E = y(p), v = y(L), b = d.useRef(null), A = R(t, (s) => U(s)), a = d.useRef({
|
|
14
|
+
paused: !1,
|
|
15
|
+
pause() {
|
|
16
|
+
this.paused = !0;
|
|
17
|
+
},
|
|
18
|
+
resume() {
|
|
19
|
+
this.paused = !1;
|
|
20
|
+
}
|
|
21
|
+
}).current;
|
|
22
|
+
d.useEffect(() => {
|
|
23
|
+
if (u) {
|
|
24
|
+
let s = function(i) {
|
|
25
|
+
if (a.paused || !o) return;
|
|
26
|
+
const c = i.target;
|
|
27
|
+
o.contains(c) ? b.current = c : f(b.current, { select: !0 });
|
|
28
|
+
}, l = function(i) {
|
|
29
|
+
if (a.paused || !o) return;
|
|
30
|
+
const c = i.relatedTarget;
|
|
31
|
+
c !== null && (o.contains(c) || f(b.current, { select: !0 }));
|
|
32
|
+
}, r = function(i) {
|
|
33
|
+
if (document.activeElement === document.body)
|
|
34
|
+
for (const h of i)
|
|
35
|
+
h.removedNodes.length > 0 && f(o);
|
|
36
|
+
};
|
|
37
|
+
document.addEventListener("focusin", s), document.addEventListener("focusout", l);
|
|
38
|
+
const m = new MutationObserver(r);
|
|
39
|
+
return o && m.observe(o, { childList: !0, subtree: !0 }), () => {
|
|
40
|
+
document.removeEventListener("focusin", s), document.removeEventListener("focusout", l), m.disconnect();
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}, [u, o, a.paused]), d.useEffect(() => {
|
|
44
|
+
if (o) {
|
|
45
|
+
O.add(a);
|
|
46
|
+
const s = document.activeElement;
|
|
47
|
+
if (!o.contains(s)) {
|
|
48
|
+
const r = new CustomEvent(F, N);
|
|
49
|
+
o.addEventListener(F, E), o.dispatchEvent(r), r.defaultPrevented || (w(W(I(o)), { select: !0 }), document.activeElement === s && f(o));
|
|
50
|
+
}
|
|
51
|
+
return () => {
|
|
52
|
+
o.removeEventListener(F, E), setTimeout(() => {
|
|
53
|
+
const r = new CustomEvent(T, N);
|
|
54
|
+
o.addEventListener(T, v), o.dispatchEvent(r), r.defaultPrevented || f(s ?? document.body, { select: !0 }), o.removeEventListener(T, v), O.remove(a);
|
|
55
|
+
}, 0);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}, [o, E, v, a]);
|
|
59
|
+
const P = d.useCallback(
|
|
60
|
+
(s) => {
|
|
61
|
+
if (!n && !u || a.paused) return;
|
|
62
|
+
const l = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, r = document.activeElement;
|
|
63
|
+
if (l && r) {
|
|
64
|
+
const m = s.currentTarget, [i, c] = x(m);
|
|
65
|
+
i && c ? !s.shiftKey && r === c ? (s.preventDefault(), n && f(i, { select: !0 })) : s.shiftKey && r === i && (s.preventDefault(), n && f(c, { select: !0 })) : r === m && s.preventDefault();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[n, u, a.paused]
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ _(M.div, { tabIndex: -1, ...g, ref: A, onKeyDown: P });
|
|
71
|
+
});
|
|
72
|
+
k.displayName = K;
|
|
73
|
+
function w(e, { select: t = !1 } = {}) {
|
|
74
|
+
const n = document.activeElement;
|
|
75
|
+
for (const u of e)
|
|
76
|
+
if (f(u, { select: t }), document.activeElement !== n) return;
|
|
77
|
+
}
|
|
78
|
+
function x(e) {
|
|
79
|
+
const t = I(e), n = S(t, e), u = S(t.reverse(), e);
|
|
80
|
+
return [n, u];
|
|
81
|
+
}
|
|
82
|
+
function I(e) {
|
|
83
|
+
const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
84
|
+
acceptNode: (u) => {
|
|
85
|
+
const p = u.tagName === "INPUT" && u.type === "hidden";
|
|
86
|
+
return u.disabled || u.hidden || p ? NodeFilter.FILTER_SKIP : u.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
for (; n.nextNode(); ) t.push(n.currentNode);
|
|
90
|
+
return t;
|
|
91
|
+
}
|
|
92
|
+
function S(e, t) {
|
|
93
|
+
for (const n of e)
|
|
94
|
+
if (!D(n, { upTo: t })) return n;
|
|
95
|
+
}
|
|
96
|
+
function D(e, { upTo: t }) {
|
|
97
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
98
|
+
for (; e; ) {
|
|
99
|
+
if (t !== void 0 && e === t) return !1;
|
|
100
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
101
|
+
e = e.parentElement;
|
|
102
|
+
}
|
|
103
|
+
return !1;
|
|
104
|
+
}
|
|
105
|
+
function H(e) {
|
|
106
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
107
|
+
}
|
|
108
|
+
function f(e, { select: t = !1 } = {}) {
|
|
109
|
+
if (e && e.focus) {
|
|
110
|
+
const n = document.activeElement;
|
|
111
|
+
e.focus({ preventScroll: !0 }), e !== n && H(e) && t && e.select();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
var O = V();
|
|
115
|
+
function V() {
|
|
116
|
+
let e = [];
|
|
117
|
+
return {
|
|
118
|
+
add(t) {
|
|
119
|
+
const n = e[0];
|
|
120
|
+
t !== n && n?.pause(), e = C(e, t), e.unshift(t);
|
|
121
|
+
},
|
|
122
|
+
remove(t) {
|
|
123
|
+
e = C(e, t), e[0]?.resume();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function C(e, t) {
|
|
128
|
+
const n = [...e], u = n.indexOf(t);
|
|
129
|
+
return u !== -1 && n.splice(u, 1), n;
|
|
130
|
+
}
|
|
131
|
+
function W(e) {
|
|
132
|
+
return e.filter((t) => t.tagName !== "A");
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
k as FocusScope
|
|
136
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { useLayoutEffect as a } from "../../react-use-layout-effect/dist/index.js";
|
|
3
|
+
var s = e[" useId ".trim().toString()] || (() => {
|
|
4
|
+
}), i = 0;
|
|
5
|
+
function d(r) {
|
|
6
|
+
const [t, o] = e.useState(s());
|
|
7
|
+
return a(() => {
|
|
8
|
+
o((u) => u ?? String(i++));
|
|
9
|
+
}, [r]), t ? `radix-${t}` : "";
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
d as useId
|
|
13
|
+
};
|