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,219 @@
|
|
|
1
|
+
import * as p from "react";
|
|
2
|
+
import { useFloating as fe, offset as me, shift as he, flip as ue, size as ge, arrow as we, hide as Pe, limitShift as xe } from "../../../@floating-ui/react-dom/dist/floating-ui.react-dom.js";
|
|
3
|
+
import { Root as ye } from "../../react-arrow/dist/index.js";
|
|
4
|
+
import { useComposedRefs as I } from "../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { createContextScope as Ae } from "../../react-context/dist/index.js";
|
|
6
|
+
import { Primitive as Y } from "../../react-primitive/dist/index.js";
|
|
7
|
+
import { useCallbackRef as ve } from "../../react-use-callback-ref/dist/index.js";
|
|
8
|
+
import { useLayoutEffect as z } from "../../react-use-layout-effect/dist/index.js";
|
|
9
|
+
import { useSize as Ce } from "../../react-use-size/dist/index.js";
|
|
10
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
11
|
+
import { autoUpdate as Se } from "../../../@floating-ui/dom/dist/floating-ui.dom.js";
|
|
12
|
+
var R = "Popper", [M, ke] = Ae(R), [Re, X] = M(R), D = (e) => {
|
|
13
|
+
const { __scopePopper: i, children: n } = e, [s, a] = p.useState(null);
|
|
14
|
+
return /* @__PURE__ */ f(Re, { scope: i, anchor: s, onAnchorChange: a, children: n });
|
|
15
|
+
};
|
|
16
|
+
D.displayName = R;
|
|
17
|
+
var F = "PopperAnchor", k = p.forwardRef(
|
|
18
|
+
(e, i) => {
|
|
19
|
+
const { __scopePopper: n, virtualRef: s, ...a } = e, t = X(F, n), r = p.useRef(null), u = I(i, r), o = p.useRef(null);
|
|
20
|
+
return p.useEffect(() => {
|
|
21
|
+
const c = o.current;
|
|
22
|
+
o.current = s?.current || r.current, c !== o.current && t.onAnchorChange(o.current);
|
|
23
|
+
}), s ? null : /* @__PURE__ */ f(Y.div, { ...a, ref: u });
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
k.displayName = F;
|
|
27
|
+
var b = "PopperContent", [be, Oe] = M(b), B = p.forwardRef(
|
|
28
|
+
(e, i) => {
|
|
29
|
+
const {
|
|
30
|
+
__scopePopper: n,
|
|
31
|
+
side: s = "bottom",
|
|
32
|
+
sideOffset: a = 0,
|
|
33
|
+
align: t = "center",
|
|
34
|
+
alignOffset: r = 0,
|
|
35
|
+
arrowPadding: u = 0,
|
|
36
|
+
avoidCollisions: o = !0,
|
|
37
|
+
collisionBoundary: c = [],
|
|
38
|
+
collisionPadding: g = 0,
|
|
39
|
+
sticky: m = "partial",
|
|
40
|
+
hideWhenDetached: P = !1,
|
|
41
|
+
updatePositionStrategy: x = "optimized",
|
|
42
|
+
onPlaced: d,
|
|
43
|
+
...l
|
|
44
|
+
} = e, Z = X(b, n), [C, U] = p.useState(null), q = I(i, (w) => U(w)), [S, G] = p.useState(null), O = Ce(S), J = O?.width ?? 0, E = O?.height ?? 0, K = s + (t !== "center" ? "-" + t : ""), Q = typeof g == "number" ? g : { top: 0, right: 0, bottom: 0, left: 0, ...g }, N = Array.isArray(c) ? c : [c], V = N.length > 0, y = {
|
|
45
|
+
padding: Q,
|
|
46
|
+
boundary: N.filter(Ne),
|
|
47
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
48
|
+
altBoundary: V
|
|
49
|
+
}, { refs: ee, floatingStyles: _, placement: te, isPositioned: A, middlewareData: h } = fe({
|
|
50
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
51
|
+
strategy: "fixed",
|
|
52
|
+
placement: K,
|
|
53
|
+
whileElementsMounted: (...w) => Se(...w, {
|
|
54
|
+
animationFrame: x === "always"
|
|
55
|
+
}),
|
|
56
|
+
elements: {
|
|
57
|
+
reference: Z.anchor
|
|
58
|
+
},
|
|
59
|
+
middleware: [
|
|
60
|
+
me({ mainAxis: a + E, alignmentAxis: r }),
|
|
61
|
+
o && he({
|
|
62
|
+
mainAxis: !0,
|
|
63
|
+
crossAxis: !1,
|
|
64
|
+
limiter: m === "partial" ? xe() : void 0,
|
|
65
|
+
...y
|
|
66
|
+
}),
|
|
67
|
+
o && ue({ ...y }),
|
|
68
|
+
ge({
|
|
69
|
+
...y,
|
|
70
|
+
apply: ({ elements: w, rects: W, availableWidth: ce, availableHeight: pe }) => {
|
|
71
|
+
const { width: le, height: de } = W.reference, v = w.floating.style;
|
|
72
|
+
v.setProperty("--radix-popper-available-width", `${ce}px`), v.setProperty("--radix-popper-available-height", `${pe}px`), v.setProperty("--radix-popper-anchor-width", `${le}px`), v.setProperty("--radix-popper-anchor-height", `${de}px`);
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
S && we({ element: S, padding: u }),
|
|
76
|
+
_e({ arrowWidth: J, arrowHeight: E }),
|
|
77
|
+
P && Pe({ strategy: "referenceHidden", ...y })
|
|
78
|
+
]
|
|
79
|
+
}), [$, re] = L(te), H = ve(d);
|
|
80
|
+
z(() => {
|
|
81
|
+
A && H?.();
|
|
82
|
+
}, [A, H]);
|
|
83
|
+
const oe = h.arrow?.x, ne = h.arrow?.y, ae = h.arrow?.centerOffset !== 0, [ie, se] = p.useState();
|
|
84
|
+
return z(() => {
|
|
85
|
+
C && se(window.getComputedStyle(C).zIndex);
|
|
86
|
+
}, [C]), /* @__PURE__ */ f(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
ref: ee.setFloating,
|
|
90
|
+
"data-radix-popper-content-wrapper": "",
|
|
91
|
+
style: {
|
|
92
|
+
..._,
|
|
93
|
+
transform: A ? _.transform : "translate(0, -200%)",
|
|
94
|
+
// keep off the page when measuring
|
|
95
|
+
minWidth: "max-content",
|
|
96
|
+
zIndex: ie,
|
|
97
|
+
"--radix-popper-transform-origin": [
|
|
98
|
+
h.transformOrigin?.x,
|
|
99
|
+
h.transformOrigin?.y
|
|
100
|
+
].join(" "),
|
|
101
|
+
// hide the content if using the hide middleware and should be hidden
|
|
102
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
103
|
+
// as if the PopperContent isn't there at all
|
|
104
|
+
...h.hide?.referenceHidden && {
|
|
105
|
+
visibility: "hidden",
|
|
106
|
+
pointerEvents: "none"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
dir: e.dir,
|
|
110
|
+
children: /* @__PURE__ */ f(
|
|
111
|
+
be,
|
|
112
|
+
{
|
|
113
|
+
scope: n,
|
|
114
|
+
placedSide: $,
|
|
115
|
+
onArrowChange: G,
|
|
116
|
+
arrowX: oe,
|
|
117
|
+
arrowY: ne,
|
|
118
|
+
shouldHideArrow: ae,
|
|
119
|
+
children: /* @__PURE__ */ f(
|
|
120
|
+
Y.div,
|
|
121
|
+
{
|
|
122
|
+
"data-side": $,
|
|
123
|
+
"data-align": re,
|
|
124
|
+
...l,
|
|
125
|
+
ref: q,
|
|
126
|
+
style: {
|
|
127
|
+
...l.style,
|
|
128
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
129
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
130
|
+
animation: A ? void 0 : "none"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
B.displayName = b;
|
|
141
|
+
var T = "PopperArrow", Ee = {
|
|
142
|
+
top: "bottom",
|
|
143
|
+
right: "left",
|
|
144
|
+
bottom: "top",
|
|
145
|
+
left: "right"
|
|
146
|
+
}, j = p.forwardRef(function(i, n) {
|
|
147
|
+
const { __scopePopper: s, ...a } = i, t = Oe(T, s), r = Ee[t.placedSide];
|
|
148
|
+
return (
|
|
149
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
150
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
151
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
152
|
+
/* @__PURE__ */ f(
|
|
153
|
+
"span",
|
|
154
|
+
{
|
|
155
|
+
ref: t.onArrowChange,
|
|
156
|
+
style: {
|
|
157
|
+
position: "absolute",
|
|
158
|
+
left: t.arrowX,
|
|
159
|
+
top: t.arrowY,
|
|
160
|
+
[r]: 0,
|
|
161
|
+
transformOrigin: {
|
|
162
|
+
top: "",
|
|
163
|
+
right: "0 0",
|
|
164
|
+
bottom: "center 0",
|
|
165
|
+
left: "100% 0"
|
|
166
|
+
}[t.placedSide],
|
|
167
|
+
transform: {
|
|
168
|
+
top: "translateY(100%)",
|
|
169
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
170
|
+
bottom: "rotate(180deg)",
|
|
171
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
172
|
+
}[t.placedSide],
|
|
173
|
+
visibility: t.shouldHideArrow ? "hidden" : void 0
|
|
174
|
+
},
|
|
175
|
+
children: /* @__PURE__ */ f(
|
|
176
|
+
ye,
|
|
177
|
+
{
|
|
178
|
+
...a,
|
|
179
|
+
ref: n,
|
|
180
|
+
style: {
|
|
181
|
+
...a.style,
|
|
182
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
183
|
+
display: "block"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
j.displayName = T;
|
|
192
|
+
function Ne(e) {
|
|
193
|
+
return e !== null;
|
|
194
|
+
}
|
|
195
|
+
var _e = (e) => ({
|
|
196
|
+
name: "transformOrigin",
|
|
197
|
+
options: e,
|
|
198
|
+
fn(i) {
|
|
199
|
+
const { placement: n, rects: s, middlewareData: a } = i, r = a.arrow?.centerOffset !== 0, u = r ? 0 : e.arrowWidth, o = r ? 0 : e.arrowHeight, [c, g] = L(n), m = { start: "0%", center: "50%", end: "100%" }[g], P = (a.arrow?.x ?? 0) + u / 2, x = (a.arrow?.y ?? 0) + o / 2;
|
|
200
|
+
let d = "", l = "";
|
|
201
|
+
return c === "bottom" ? (d = r ? m : `${P}px`, l = `${-o}px`) : c === "top" ? (d = r ? m : `${P}px`, l = `${s.floating.height + o}px`) : c === "right" ? (d = `${-o}px`, l = r ? m : `${x}px`) : c === "left" && (d = `${s.floating.width + o}px`, l = r ? m : `${x}px`), { data: { x: d, y: l } };
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
function L(e) {
|
|
205
|
+
const [i, n = "center"] = e.split("-");
|
|
206
|
+
return [i, n];
|
|
207
|
+
}
|
|
208
|
+
var Be = D, Te = k, je = B, Le = j;
|
|
209
|
+
export {
|
|
210
|
+
Te as Anchor,
|
|
211
|
+
Le as Arrow,
|
|
212
|
+
je as Content,
|
|
213
|
+
D as Popper,
|
|
214
|
+
k as PopperAnchor,
|
|
215
|
+
j as PopperArrow,
|
|
216
|
+
B as PopperContent,
|
|
217
|
+
Be as Root,
|
|
218
|
+
ke as createPopperScope
|
|
219
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import n from "react-dom";
|
|
3
|
+
import { Primitive as s } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useLayoutEffect as c } from "../../react-use-layout-effect/dist/index.js";
|
|
5
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
6
|
+
var l = "Portal", p = o.forwardRef((r, e) => {
|
|
7
|
+
const { container: a, ...f } = r, [i, m] = o.useState(!1);
|
|
8
|
+
c(() => m(!0), []);
|
|
9
|
+
const t = a || i && globalThis?.document?.body;
|
|
10
|
+
return t ? n.createPortal(/* @__PURE__ */ u(s.div, { ...f, ref: e }), t) : null;
|
|
11
|
+
});
|
|
12
|
+
p.displayName = l;
|
|
13
|
+
export {
|
|
14
|
+
p as Portal
|
|
15
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as i from "react";
|
|
2
|
+
import { useComposedRefs as O } from "../../react-compose-refs/dist/index.js";
|
|
3
|
+
import { useLayoutEffect as A } from "../../react-use-layout-effect/dist/index.js";
|
|
4
|
+
function E(n, e) {
|
|
5
|
+
return i.useReducer((t, r) => e[t][r] ?? t, n);
|
|
6
|
+
}
|
|
7
|
+
var T = (n) => {
|
|
8
|
+
const { present: e, children: t } = n, r = R(e), a = typeof t == "function" ? t({ present: r.isPresent }) : i.Children.only(t), c = O(r.ref, v(a));
|
|
9
|
+
return typeof t == "function" || r.isPresent ? i.cloneElement(a, { ref: c }) : null;
|
|
10
|
+
};
|
|
11
|
+
T.displayName = "Presence";
|
|
12
|
+
function R(n) {
|
|
13
|
+
const [e, t] = i.useState(), r = i.useRef(null), a = i.useRef(n), c = i.useRef("none"), p = n ? "mounted" : "unmounted", [N, s] = E(p, {
|
|
14
|
+
mounted: {
|
|
15
|
+
UNMOUNT: "unmounted",
|
|
16
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
17
|
+
},
|
|
18
|
+
unmountSuspended: {
|
|
19
|
+
MOUNT: "mounted",
|
|
20
|
+
ANIMATION_END: "unmounted"
|
|
21
|
+
},
|
|
22
|
+
unmounted: {
|
|
23
|
+
MOUNT: "mounted"
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return i.useEffect(() => {
|
|
27
|
+
const o = l(r.current);
|
|
28
|
+
c.current = N === "mounted" ? o : "none";
|
|
29
|
+
}, [N]), A(() => {
|
|
30
|
+
const o = r.current, m = a.current;
|
|
31
|
+
if (m !== n) {
|
|
32
|
+
const f = c.current, u = l(o);
|
|
33
|
+
n ? s("MOUNT") : u === "none" || o?.display === "none" ? s("UNMOUNT") : s(m && f !== u ? "ANIMATION_OUT" : "UNMOUNT"), a.current = n;
|
|
34
|
+
}
|
|
35
|
+
}, [n, s]), A(() => {
|
|
36
|
+
if (e) {
|
|
37
|
+
let o;
|
|
38
|
+
const m = e.ownerDocument.defaultView ?? window, d = (u) => {
|
|
39
|
+
const g = l(r.current).includes(CSS.escape(u.animationName));
|
|
40
|
+
if (u.target === e && g && (s("ANIMATION_END"), !a.current)) {
|
|
41
|
+
const y = e.style.animationFillMode;
|
|
42
|
+
e.style.animationFillMode = "forwards", o = m.setTimeout(() => {
|
|
43
|
+
e.style.animationFillMode === "forwards" && (e.style.animationFillMode = y);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, f = (u) => {
|
|
47
|
+
u.target === e && (c.current = l(r.current));
|
|
48
|
+
};
|
|
49
|
+
return e.addEventListener("animationstart", f), e.addEventListener("animationcancel", d), e.addEventListener("animationend", d), () => {
|
|
50
|
+
m.clearTimeout(o), e.removeEventListener("animationstart", f), e.removeEventListener("animationcancel", d), e.removeEventListener("animationend", d);
|
|
51
|
+
};
|
|
52
|
+
} else
|
|
53
|
+
s("ANIMATION_END");
|
|
54
|
+
}, [e, s]), {
|
|
55
|
+
isPresent: ["mounted", "unmountSuspended"].includes(N),
|
|
56
|
+
ref: i.useCallback((o) => {
|
|
57
|
+
r.current = o ? getComputedStyle(o) : null, t(o);
|
|
58
|
+
}, [])
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function l(n) {
|
|
62
|
+
return n?.animationName || "none";
|
|
63
|
+
}
|
|
64
|
+
function v(n) {
|
|
65
|
+
let e = Object.getOwnPropertyDescriptor(n.props, "ref")?.get, t = e && "isReactWarning" in e && e.isReactWarning;
|
|
66
|
+
return t ? n.ref : (e = Object.getOwnPropertyDescriptor(n, "ref")?.get, t = e && "isReactWarning" in e && e.isReactWarning, t ? n.props.ref : n.props.ref || n.ref);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
T as Presence
|
|
70
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as f from "react";
|
|
2
|
+
import * as p from "react-dom";
|
|
3
|
+
import { createSlot as c } from "@radix-ui/react-slot";
|
|
4
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
5
|
+
var u = [
|
|
6
|
+
"a",
|
|
7
|
+
"button",
|
|
8
|
+
"div",
|
|
9
|
+
"form",
|
|
10
|
+
"h2",
|
|
11
|
+
"h3",
|
|
12
|
+
"img",
|
|
13
|
+
"input",
|
|
14
|
+
"label",
|
|
15
|
+
"li",
|
|
16
|
+
"nav",
|
|
17
|
+
"ol",
|
|
18
|
+
"p",
|
|
19
|
+
"select",
|
|
20
|
+
"span",
|
|
21
|
+
"svg",
|
|
22
|
+
"ul"
|
|
23
|
+
], h = u.reduce((t, i) => {
|
|
24
|
+
const o = c(`Primitive.${i}`), r = f.forwardRef((e, m) => {
|
|
25
|
+
const { asChild: s, ...a } = e, n = s ? o : i;
|
|
26
|
+
return typeof window < "u" && (window[/* @__PURE__ */ Symbol.for("radix-ui")] = !0), /* @__PURE__ */ l(n, { ...a, ref: m });
|
|
27
|
+
});
|
|
28
|
+
return r.displayName = `Primitive.${i}`, { ...t, [i]: r };
|
|
29
|
+
}, {});
|
|
30
|
+
function w(t, i) {
|
|
31
|
+
t && p.flushSync(() => t.dispatchEvent(i));
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
h as Primitive,
|
|
35
|
+
w as dispatchDiscreteCustomEvent
|
|
36
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import * as c from "react";
|
|
2
|
+
import { composeEventHandlers as p } from "../../primitive/dist/index.js";
|
|
3
|
+
import { createCollection as V } from "../../react-collection/dist/index.js";
|
|
4
|
+
import { useComposedRefs as j } from "../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { createContextScope as z } from "../../react-context/dist/index.js";
|
|
6
|
+
import { useId as q } from "../../react-id/dist/index.js";
|
|
7
|
+
import { Primitive as G } from "../../react-primitive/dist/index.js";
|
|
8
|
+
import { useCallbackRef as J } from "../../react-use-callback-ref/dist/index.js";
|
|
9
|
+
import { useControllableState as Q } from "../../react-use-controllable-state/dist/index.js";
|
|
10
|
+
import { useDirection as W } from "../../react-direction/dist/index.js";
|
|
11
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
12
|
+
var y = "rovingFocusGroup.onEntryFocus", X = { bubbles: !1, cancelable: !0 }, I = "RovingFocusGroup", [D, N, Z] = V(I), [$, Fe] = z(
|
|
13
|
+
I,
|
|
14
|
+
[Z]
|
|
15
|
+
), [ee, oe] = $(I), O = c.forwardRef(
|
|
16
|
+
(e, r) => /* @__PURE__ */ d(D.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(D.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ d(te, { ...e, ref: r }) }) })
|
|
17
|
+
);
|
|
18
|
+
O.displayName = I;
|
|
19
|
+
var te = c.forwardRef((e, r) => {
|
|
20
|
+
const {
|
|
21
|
+
__scopeRovingFocusGroup: s,
|
|
22
|
+
orientation: o,
|
|
23
|
+
loop: T = !1,
|
|
24
|
+
dir: w,
|
|
25
|
+
currentTabStopId: v,
|
|
26
|
+
defaultCurrentTabStopId: C,
|
|
27
|
+
onCurrentTabStopIdChange: S,
|
|
28
|
+
onEntryFocus: m,
|
|
29
|
+
preventScrollOnEntryFocus: u = !1,
|
|
30
|
+
...b
|
|
31
|
+
} = e, F = c.useRef(null), g = j(r, F), R = W(w), [E, t] = Q({
|
|
32
|
+
prop: v,
|
|
33
|
+
defaultProp: C ?? null,
|
|
34
|
+
onChange: S,
|
|
35
|
+
caller: I
|
|
36
|
+
}), [i, h] = c.useState(!1), a = J(m), l = N(s), A = c.useRef(!1), [L, P] = c.useState(0);
|
|
37
|
+
return c.useEffect(() => {
|
|
38
|
+
const n = F.current;
|
|
39
|
+
if (n)
|
|
40
|
+
return n.addEventListener(y, a), () => n.removeEventListener(y, a);
|
|
41
|
+
}, [a]), /* @__PURE__ */ d(
|
|
42
|
+
ee,
|
|
43
|
+
{
|
|
44
|
+
scope: s,
|
|
45
|
+
orientation: o,
|
|
46
|
+
dir: R,
|
|
47
|
+
loop: T,
|
|
48
|
+
currentTabStopId: E,
|
|
49
|
+
onItemFocus: c.useCallback(
|
|
50
|
+
(n) => t(n),
|
|
51
|
+
[t]
|
|
52
|
+
),
|
|
53
|
+
onItemShiftTab: c.useCallback(() => h(!0), []),
|
|
54
|
+
onFocusableItemAdd: c.useCallback(
|
|
55
|
+
() => P((n) => n + 1),
|
|
56
|
+
[]
|
|
57
|
+
),
|
|
58
|
+
onFocusableItemRemove: c.useCallback(
|
|
59
|
+
() => P((n) => n - 1),
|
|
60
|
+
[]
|
|
61
|
+
),
|
|
62
|
+
children: /* @__PURE__ */ d(
|
|
63
|
+
G.div,
|
|
64
|
+
{
|
|
65
|
+
tabIndex: i || L === 0 ? -1 : 0,
|
|
66
|
+
"data-orientation": o,
|
|
67
|
+
...b,
|
|
68
|
+
ref: g,
|
|
69
|
+
style: { outline: "none", ...e.style },
|
|
70
|
+
onMouseDown: p(e.onMouseDown, () => {
|
|
71
|
+
A.current = !0;
|
|
72
|
+
}),
|
|
73
|
+
onFocus: p(e.onFocus, (n) => {
|
|
74
|
+
const U = !A.current;
|
|
75
|
+
if (n.target === n.currentTarget && U && !i) {
|
|
76
|
+
const x = new CustomEvent(y, X);
|
|
77
|
+
if (n.currentTarget.dispatchEvent(x), !x.defaultPrevented) {
|
|
78
|
+
const _ = l().filter((f) => f.focusable), B = _.find((f) => f.active), Y = _.find((f) => f.id === E), H = [B, Y, ..._].filter(
|
|
79
|
+
Boolean
|
|
80
|
+
).map((f) => f.ref.current);
|
|
81
|
+
k(H, u);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
A.current = !1;
|
|
85
|
+
}),
|
|
86
|
+
onBlur: p(e.onBlur, () => h(!1))
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}), K = "RovingFocusGroupItem", M = c.forwardRef(
|
|
92
|
+
(e, r) => {
|
|
93
|
+
const {
|
|
94
|
+
__scopeRovingFocusGroup: s,
|
|
95
|
+
focusable: o = !0,
|
|
96
|
+
active: T = !1,
|
|
97
|
+
tabStopId: w,
|
|
98
|
+
children: v,
|
|
99
|
+
...C
|
|
100
|
+
} = e, S = q(), m = w || S, u = oe(K, s), b = u.currentTabStopId === m, F = N(s), { onFocusableItemAdd: g, onFocusableItemRemove: R, currentTabStopId: E } = u;
|
|
101
|
+
return c.useEffect(() => {
|
|
102
|
+
if (o)
|
|
103
|
+
return g(), () => R();
|
|
104
|
+
}, [o, g, R]), /* @__PURE__ */ d(
|
|
105
|
+
D.ItemSlot,
|
|
106
|
+
{
|
|
107
|
+
scope: s,
|
|
108
|
+
id: m,
|
|
109
|
+
focusable: o,
|
|
110
|
+
active: T,
|
|
111
|
+
children: /* @__PURE__ */ d(
|
|
112
|
+
G.span,
|
|
113
|
+
{
|
|
114
|
+
tabIndex: b ? 0 : -1,
|
|
115
|
+
"data-orientation": u.orientation,
|
|
116
|
+
...C,
|
|
117
|
+
ref: r,
|
|
118
|
+
onMouseDown: p(e.onMouseDown, (t) => {
|
|
119
|
+
o ? u.onItemFocus(m) : t.preventDefault();
|
|
120
|
+
}),
|
|
121
|
+
onFocus: p(e.onFocus, () => u.onItemFocus(m)),
|
|
122
|
+
onKeyDown: p(e.onKeyDown, (t) => {
|
|
123
|
+
if (t.key === "Tab" && t.shiftKey) {
|
|
124
|
+
u.onItemShiftTab();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (t.target !== t.currentTarget) return;
|
|
128
|
+
const i = ce(t, u.orientation, u.dir);
|
|
129
|
+
if (i !== void 0) {
|
|
130
|
+
if (t.metaKey || t.ctrlKey || t.altKey || t.shiftKey) return;
|
|
131
|
+
t.preventDefault();
|
|
132
|
+
let a = F().filter((l) => l.focusable).map((l) => l.ref.current);
|
|
133
|
+
if (i === "last") a.reverse();
|
|
134
|
+
else if (i === "prev" || i === "next") {
|
|
135
|
+
i === "prev" && a.reverse();
|
|
136
|
+
const l = a.indexOf(t.currentTarget);
|
|
137
|
+
a = u.loop ? se(a, l + 1) : a.slice(l + 1);
|
|
138
|
+
}
|
|
139
|
+
setTimeout(() => k(a));
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
children: typeof v == "function" ? v({ isCurrentTabStop: b, hasTabStop: E != null }) : v
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
M.displayName = K;
|
|
150
|
+
var re = {
|
|
151
|
+
ArrowLeft: "prev",
|
|
152
|
+
ArrowUp: "prev",
|
|
153
|
+
ArrowRight: "next",
|
|
154
|
+
ArrowDown: "next",
|
|
155
|
+
PageUp: "first",
|
|
156
|
+
Home: "first",
|
|
157
|
+
PageDown: "last",
|
|
158
|
+
End: "last"
|
|
159
|
+
};
|
|
160
|
+
function ne(e, r) {
|
|
161
|
+
return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
162
|
+
}
|
|
163
|
+
function ce(e, r, s) {
|
|
164
|
+
const o = ne(e.key, s);
|
|
165
|
+
if (!(r === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(r === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
|
|
166
|
+
return re[o];
|
|
167
|
+
}
|
|
168
|
+
function k(e, r = !1) {
|
|
169
|
+
const s = document.activeElement;
|
|
170
|
+
for (const o of e)
|
|
171
|
+
if (o === s || (o.focus({ preventScroll: r }), document.activeElement !== s)) return;
|
|
172
|
+
}
|
|
173
|
+
function se(e, r) {
|
|
174
|
+
return e.map((s, o) => e[(r + o) % e.length]);
|
|
175
|
+
}
|
|
176
|
+
var ge = O, Re = M;
|
|
177
|
+
export {
|
|
178
|
+
Re as Item,
|
|
179
|
+
ge as Root,
|
|
180
|
+
O as RovingFocusGroup,
|
|
181
|
+
M as RovingFocusGroupItem,
|
|
182
|
+
Fe as createRovingFocusGroupScope
|
|
183
|
+
};
|