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,136 @@
|
|
|
1
|
+
function c() {
|
|
2
|
+
return typeof window < "u";
|
|
3
|
+
}
|
|
4
|
+
function u(t) {
|
|
5
|
+
return p(t) ? (t.nodeName || "").toLowerCase() : "#document";
|
|
6
|
+
}
|
|
7
|
+
function i(t) {
|
|
8
|
+
var e;
|
|
9
|
+
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
|
|
10
|
+
}
|
|
11
|
+
function N(t) {
|
|
12
|
+
var e;
|
|
13
|
+
return (e = (p(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
|
|
14
|
+
}
|
|
15
|
+
function p(t) {
|
|
16
|
+
return c() ? t instanceof Node || t instanceof i(t).Node : !1;
|
|
17
|
+
}
|
|
18
|
+
function m(t) {
|
|
19
|
+
return c() ? t instanceof Element || t instanceof i(t).Element : !1;
|
|
20
|
+
}
|
|
21
|
+
function w(t) {
|
|
22
|
+
return c() ? t instanceof HTMLElement || t instanceof i(t).HTMLElement : !1;
|
|
23
|
+
}
|
|
24
|
+
function f(t) {
|
|
25
|
+
return !c() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof i(t).ShadowRoot;
|
|
26
|
+
}
|
|
27
|
+
const E = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
28
|
+
function y(t) {
|
|
29
|
+
const {
|
|
30
|
+
overflow: e,
|
|
31
|
+
overflowX: n,
|
|
32
|
+
overflowY: o,
|
|
33
|
+
display: r
|
|
34
|
+
} = S(t);
|
|
35
|
+
return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !E.has(r);
|
|
36
|
+
}
|
|
37
|
+
const T = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
38
|
+
function A(t) {
|
|
39
|
+
return T.has(u(t));
|
|
40
|
+
}
|
|
41
|
+
const v = [":popover-open", ":modal"];
|
|
42
|
+
function L(t) {
|
|
43
|
+
return v.some((e) => {
|
|
44
|
+
try {
|
|
45
|
+
return t.matches(e);
|
|
46
|
+
} catch {
|
|
47
|
+
return !1;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const D = ["transform", "translate", "scale", "rotate", "perspective"], C = ["transform", "translate", "scale", "rotate", "perspective", "filter"], k = ["paint", "layout", "strict", "content"];
|
|
52
|
+
function V(t) {
|
|
53
|
+
const e = O(), n = m(t) ? S(t) : t;
|
|
54
|
+
return D.some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || C.some((o) => (n.willChange || "").includes(o)) || k.some((o) => (n.contain || "").includes(o));
|
|
55
|
+
}
|
|
56
|
+
function B(t) {
|
|
57
|
+
let e = s(t);
|
|
58
|
+
for (; w(e) && !h(e); ) {
|
|
59
|
+
if (V(e))
|
|
60
|
+
return e;
|
|
61
|
+
if (L(e))
|
|
62
|
+
return null;
|
|
63
|
+
e = s(e);
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
function O() {
|
|
68
|
+
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
69
|
+
}
|
|
70
|
+
const R = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
71
|
+
function h(t) {
|
|
72
|
+
return R.has(u(t));
|
|
73
|
+
}
|
|
74
|
+
function S(t) {
|
|
75
|
+
return i(t).getComputedStyle(t);
|
|
76
|
+
}
|
|
77
|
+
function F(t) {
|
|
78
|
+
return m(t) ? {
|
|
79
|
+
scrollLeft: t.scrollLeft,
|
|
80
|
+
scrollTop: t.scrollTop
|
|
81
|
+
} : {
|
|
82
|
+
scrollLeft: t.scrollX,
|
|
83
|
+
scrollTop: t.scrollY
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function s(t) {
|
|
87
|
+
if (u(t) === "html")
|
|
88
|
+
return t;
|
|
89
|
+
const e = (
|
|
90
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
91
|
+
t.assignedSlot || // DOM Element detected.
|
|
92
|
+
t.parentNode || // ShadowRoot detected.
|
|
93
|
+
f(t) && t.host || // Fallback.
|
|
94
|
+
N(t)
|
|
95
|
+
);
|
|
96
|
+
return f(e) ? e.host : e;
|
|
97
|
+
}
|
|
98
|
+
function b(t) {
|
|
99
|
+
const e = s(t);
|
|
100
|
+
return h(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : w(e) && y(e) ? e : b(e);
|
|
101
|
+
}
|
|
102
|
+
function d(t, e, n) {
|
|
103
|
+
var o;
|
|
104
|
+
e === void 0 && (e = []), n === void 0 && (n = !0);
|
|
105
|
+
const r = b(t), g = r === ((o = t.ownerDocument) == null ? void 0 : o.body), l = i(r);
|
|
106
|
+
if (g) {
|
|
107
|
+
const a = _(l);
|
|
108
|
+
return e.concat(l, l.visualViewport || [], y(r) ? r : [], a && n ? d(a) : []);
|
|
109
|
+
}
|
|
110
|
+
return e.concat(r, d(r, [], n));
|
|
111
|
+
}
|
|
112
|
+
function _(t) {
|
|
113
|
+
return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
S as getComputedStyle,
|
|
117
|
+
B as getContainingBlock,
|
|
118
|
+
N as getDocumentElement,
|
|
119
|
+
_ as getFrameElement,
|
|
120
|
+
b as getNearestOverflowAncestor,
|
|
121
|
+
u as getNodeName,
|
|
122
|
+
F as getNodeScroll,
|
|
123
|
+
d as getOverflowAncestors,
|
|
124
|
+
s as getParentNode,
|
|
125
|
+
i as getWindow,
|
|
126
|
+
V as isContainingBlock,
|
|
127
|
+
m as isElement,
|
|
128
|
+
w as isHTMLElement,
|
|
129
|
+
h as isLastTraversableNode,
|
|
130
|
+
p as isNode,
|
|
131
|
+
y as isOverflowElement,
|
|
132
|
+
f as isShadowRoot,
|
|
133
|
+
A as isTableElement,
|
|
134
|
+
L as isTopLayer,
|
|
135
|
+
O as isWebKit
|
|
136
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const j = ["top", "right", "bottom", "left"], m = Math.min, p = Math.max, C = Math.round, L = Math.floor, E = (t) => ({
|
|
2
|
+
x: t,
|
|
3
|
+
y: t
|
|
4
|
+
}), h = {
|
|
5
|
+
left: "right",
|
|
6
|
+
right: "left",
|
|
7
|
+
bottom: "top",
|
|
8
|
+
top: "bottom"
|
|
9
|
+
}, x = {
|
|
10
|
+
start: "end",
|
|
11
|
+
end: "start"
|
|
12
|
+
};
|
|
13
|
+
function R(t, e, n) {
|
|
14
|
+
return p(t, m(e, n));
|
|
15
|
+
}
|
|
16
|
+
function T(t, e) {
|
|
17
|
+
return typeof t == "function" ? t(e) : t;
|
|
18
|
+
}
|
|
19
|
+
function g(t) {
|
|
20
|
+
return t.split("-")[0];
|
|
21
|
+
}
|
|
22
|
+
function a(t) {
|
|
23
|
+
return t.split("-")[1];
|
|
24
|
+
}
|
|
25
|
+
function b(t) {
|
|
26
|
+
return t === "x" ? "y" : "x";
|
|
27
|
+
}
|
|
28
|
+
function d(t) {
|
|
29
|
+
return t === "y" ? "height" : "width";
|
|
30
|
+
}
|
|
31
|
+
const A = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
32
|
+
function P(t) {
|
|
33
|
+
return A.has(g(t)) ? "y" : "x";
|
|
34
|
+
}
|
|
35
|
+
function y(t) {
|
|
36
|
+
return b(P(t));
|
|
37
|
+
}
|
|
38
|
+
function k(t, e, n) {
|
|
39
|
+
n === void 0 && (n = !1);
|
|
40
|
+
const r = a(t), i = y(t), o = d(i);
|
|
41
|
+
let c = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
42
|
+
return e.reference[o] > e.floating[o] && (c = f(c)), [c, f(c)];
|
|
43
|
+
}
|
|
44
|
+
function q(t) {
|
|
45
|
+
const e = f(t);
|
|
46
|
+
return [s(t), e, s(e)];
|
|
47
|
+
}
|
|
48
|
+
function s(t) {
|
|
49
|
+
return t.replace(/start|end/g, (e) => x[e]);
|
|
50
|
+
}
|
|
51
|
+
const u = ["left", "right"], l = ["right", "left"], M = ["top", "bottom"], O = ["bottom", "top"];
|
|
52
|
+
function S(t, e, n) {
|
|
53
|
+
switch (t) {
|
|
54
|
+
case "top":
|
|
55
|
+
case "bottom":
|
|
56
|
+
return n ? e ? l : u : e ? u : l;
|
|
57
|
+
case "left":
|
|
58
|
+
case "right":
|
|
59
|
+
return e ? M : O;
|
|
60
|
+
default:
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function z(t, e, n, r) {
|
|
65
|
+
const i = a(t);
|
|
66
|
+
let o = S(g(t), n === "start", r);
|
|
67
|
+
return i && (o = o.map((c) => c + "-" + i), e && (o = o.concat(o.map(s)))), o;
|
|
68
|
+
}
|
|
69
|
+
function f(t) {
|
|
70
|
+
return t.replace(/left|right|bottom|top/g, (e) => h[e]);
|
|
71
|
+
}
|
|
72
|
+
function w(t) {
|
|
73
|
+
return {
|
|
74
|
+
top: 0,
|
|
75
|
+
right: 0,
|
|
76
|
+
bottom: 0,
|
|
77
|
+
left: 0,
|
|
78
|
+
...t
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function B(t) {
|
|
82
|
+
return typeof t != "number" ? w(t) : {
|
|
83
|
+
top: t,
|
|
84
|
+
right: t,
|
|
85
|
+
bottom: t,
|
|
86
|
+
left: t
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function D(t) {
|
|
90
|
+
const {
|
|
91
|
+
x: e,
|
|
92
|
+
y: n,
|
|
93
|
+
width: r,
|
|
94
|
+
height: i
|
|
95
|
+
} = t;
|
|
96
|
+
return {
|
|
97
|
+
width: r,
|
|
98
|
+
height: i,
|
|
99
|
+
top: n,
|
|
100
|
+
left: e,
|
|
101
|
+
right: e + r,
|
|
102
|
+
bottom: n + i,
|
|
103
|
+
x: e,
|
|
104
|
+
y: n
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
R as clamp,
|
|
109
|
+
E as createCoords,
|
|
110
|
+
T as evaluate,
|
|
111
|
+
w as expandPaddingObject,
|
|
112
|
+
L as floor,
|
|
113
|
+
a as getAlignment,
|
|
114
|
+
y as getAlignmentAxis,
|
|
115
|
+
k as getAlignmentSides,
|
|
116
|
+
d as getAxisLength,
|
|
117
|
+
q as getExpandedPlacements,
|
|
118
|
+
s as getOppositeAlignmentPlacement,
|
|
119
|
+
b as getOppositeAxis,
|
|
120
|
+
z as getOppositeAxisPlacements,
|
|
121
|
+
f as getOppositePlacement,
|
|
122
|
+
B as getPaddingObject,
|
|
123
|
+
g as getSide,
|
|
124
|
+
P as getSideAxis,
|
|
125
|
+
p as max,
|
|
126
|
+
m as min,
|
|
127
|
+
D as rectToClientRect,
|
|
128
|
+
C as round,
|
|
129
|
+
j as sides
|
|
130
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { Primitive as p } from "../../react-primitive/dist/index.js";
|
|
3
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
4
|
+
var v = "Arrow", e = n.forwardRef((r, i) => {
|
|
5
|
+
const { children: t, width: a = 10, height: s = 5, ...m } = r;
|
|
6
|
+
return /* @__PURE__ */ o(
|
|
7
|
+
p.svg,
|
|
8
|
+
{
|
|
9
|
+
...m,
|
|
10
|
+
ref: i,
|
|
11
|
+
width: a,
|
|
12
|
+
height: s,
|
|
13
|
+
viewBox: "0 0 30 10",
|
|
14
|
+
preserveAspectRatio: "none",
|
|
15
|
+
children: r.asChild ? t : /* @__PURE__ */ o("polygon", { points: "0,0 30,0 15,10" })
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
e.displayName = v;
|
|
20
|
+
var h = e;
|
|
21
|
+
export {
|
|
22
|
+
e as Arrow,
|
|
23
|
+
h as Root
|
|
24
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import r from "react";
|
|
2
|
+
import { createContextScope as y } from "../../react-context/dist/index.js";
|
|
3
|
+
import { useComposedRefs as M } from "../../react-compose-refs/dist/index.js";
|
|
4
|
+
import { createSlot as x } from "@radix-ui/react-slot";
|
|
5
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
6
|
+
function g(s) {
|
|
7
|
+
const m = s + "CollectionProvider", [A, N] = y(m), [_, f] = A(
|
|
8
|
+
m,
|
|
9
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
10
|
+
), p = (c) => {
|
|
11
|
+
const { scope: e, children: l } = c, o = r.useRef(null), t = r.useRef(/* @__PURE__ */ new Map()).current;
|
|
12
|
+
return /* @__PURE__ */ u(_, { scope: e, itemMap: t, collectionRef: o, children: l });
|
|
13
|
+
};
|
|
14
|
+
p.displayName = m;
|
|
15
|
+
const a = s + "CollectionSlot", E = x(a), C = r.forwardRef(
|
|
16
|
+
(c, e) => {
|
|
17
|
+
const { scope: l, children: o } = c, t = f(a, l), n = M(e, t.collectionRef);
|
|
18
|
+
return /* @__PURE__ */ u(E, { ref: n, children: o });
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
C.displayName = a;
|
|
22
|
+
const d = s + "CollectionItemSlot", R = "data-radix-collection-item", T = x(d), I = r.forwardRef(
|
|
23
|
+
(c, e) => {
|
|
24
|
+
const { scope: l, children: o, ...t } = c, n = r.useRef(null), S = M(e, n), i = f(d, l);
|
|
25
|
+
return r.useEffect(() => (i.itemMap.set(n, { ref: n, ...t }), () => {
|
|
26
|
+
i.itemMap.delete(n);
|
|
27
|
+
})), /* @__PURE__ */ u(T, { [R]: "", ref: S, children: o });
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
I.displayName = d;
|
|
31
|
+
function O(c) {
|
|
32
|
+
const e = f(s + "CollectionConsumer", c);
|
|
33
|
+
return r.useCallback(() => {
|
|
34
|
+
const o = e.collectionRef.current;
|
|
35
|
+
if (!o) return [];
|
|
36
|
+
const t = Array.from(o.querySelectorAll(`[${R}]`));
|
|
37
|
+
return Array.from(e.itemMap.values()).sort(
|
|
38
|
+
(i, v) => t.indexOf(i.ref.current) - t.indexOf(v.ref.current)
|
|
39
|
+
);
|
|
40
|
+
}, [e.collectionRef, e.itemMap]);
|
|
41
|
+
}
|
|
42
|
+
return [
|
|
43
|
+
{ Provider: p, Slot: C, ItemSlot: I },
|
|
44
|
+
O,
|
|
45
|
+
N
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
g as createCollection
|
|
50
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as f from "react";
|
|
2
|
+
function l(n, o) {
|
|
3
|
+
if (typeof n == "function")
|
|
4
|
+
return n(o);
|
|
5
|
+
n != null && (n.current = o);
|
|
6
|
+
}
|
|
7
|
+
function i(...n) {
|
|
8
|
+
return (o) => {
|
|
9
|
+
let u = !1;
|
|
10
|
+
const c = n.map((t) => {
|
|
11
|
+
const e = l(t, o);
|
|
12
|
+
return !u && typeof e == "function" && (u = !0), e;
|
|
13
|
+
});
|
|
14
|
+
if (u)
|
|
15
|
+
return () => {
|
|
16
|
+
for (let t = 0; t < c.length; t++) {
|
|
17
|
+
const e = c[t];
|
|
18
|
+
typeof e == "function" ? e() : l(n[t], null);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function s(...n) {
|
|
24
|
+
return f.useCallback(i(...n), n);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
i as composeRefs,
|
|
28
|
+
s as useComposedRefs
|
|
29
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
3
|
+
function P(e, p = []) {
|
|
4
|
+
let n = [];
|
|
5
|
+
function m(s, t) {
|
|
6
|
+
const o = u.createContext(t), c = n.length;
|
|
7
|
+
n = [...n, t];
|
|
8
|
+
const a = (i) => {
|
|
9
|
+
const { scope: f, children: C, ...x } = i, d = f?.[e]?.[c] || o, v = u.useMemo(() => x, Object.values(x));
|
|
10
|
+
return /* @__PURE__ */ _(d.Provider, { value: v, children: C });
|
|
11
|
+
};
|
|
12
|
+
a.displayName = s + "Provider";
|
|
13
|
+
function S(i, f) {
|
|
14
|
+
const C = f?.[e]?.[c] || o, x = u.useContext(C);
|
|
15
|
+
if (x) return x;
|
|
16
|
+
if (t !== void 0) return t;
|
|
17
|
+
throw new Error(`\`${i}\` must be used within \`${s}\``);
|
|
18
|
+
}
|
|
19
|
+
return [a, S];
|
|
20
|
+
}
|
|
21
|
+
const r = () => {
|
|
22
|
+
const s = n.map((t) => u.createContext(t));
|
|
23
|
+
return function(o) {
|
|
24
|
+
const c = o?.[e] || s;
|
|
25
|
+
return u.useMemo(
|
|
26
|
+
() => ({ [`__scope${e}`]: { ...o, [e]: c } }),
|
|
27
|
+
[o, c]
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
return r.scopeName = e, [m, h(r, ...p)];
|
|
32
|
+
}
|
|
33
|
+
function h(...e) {
|
|
34
|
+
const p = e[0];
|
|
35
|
+
if (e.length === 1) return p;
|
|
36
|
+
const n = () => {
|
|
37
|
+
const m = e.map((r) => ({
|
|
38
|
+
useScope: r(),
|
|
39
|
+
scopeName: r.scopeName
|
|
40
|
+
}));
|
|
41
|
+
return function(s) {
|
|
42
|
+
const t = m.reduce((o, { useScope: c, scopeName: a }) => {
|
|
43
|
+
const i = c(s)[`__scope${a}`];
|
|
44
|
+
return { ...o, ...i };
|
|
45
|
+
}, {});
|
|
46
|
+
return u.useMemo(() => ({ [`__scope${p.scopeName}`]: t }), [t]);
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
return n.scopeName = p.scopeName, n;
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
P as createContextScope
|
|
53
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { composeEventHandlers as h } from "../../primitive/dist/index.js";
|
|
3
|
+
import { Primitive as w, dispatchDiscreteCustomEvent as k } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useComposedRefs as g } from "../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { useCallbackRef as R } from "../../react-use-callback-ref/dist/index.js";
|
|
6
|
+
import { useEscapeKeydown as U } from "../../react-use-escape-keydown/dist/index.js";
|
|
7
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
8
|
+
var z = "DismissableLayer", y = "dismissableLayer.update", H = "dismissableLayer.pointerDownOutside", M = "dismissableLayer.focusOutside", C, B = n.createContext({
|
|
9
|
+
layers: /* @__PURE__ */ new Set(),
|
|
10
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
11
|
+
branches: /* @__PURE__ */ new Set()
|
|
12
|
+
}), K = n.forwardRef(
|
|
13
|
+
(s, e) => {
|
|
14
|
+
const {
|
|
15
|
+
disableOutsidePointerEvents: r = !1,
|
|
16
|
+
onEscapeKeyDown: a,
|
|
17
|
+
onPointerDownOutside: i,
|
|
18
|
+
onFocusOutside: c,
|
|
19
|
+
onInteractOutside: f,
|
|
20
|
+
onDismiss: d,
|
|
21
|
+
...E
|
|
22
|
+
} = s, o = n.useContext(B), [u, F] = n.useState(null), l = u?.ownerDocument ?? globalThis?.document, [, I] = n.useState({}), S = g(e, (t) => F(t)), p = Array.from(o.layers), [W] = [...o.layersWithOutsidePointerEventsDisabled].slice(-1), A = p.indexOf(W), b = u ? p.indexOf(u) : -1, N = o.layersWithOutsidePointerEventsDisabled.size > 0, D = b >= A, _ = Y((t) => {
|
|
23
|
+
const v = t.target, P = [...o.branches].some((m) => m.contains(v));
|
|
24
|
+
!D || P || (i?.(t), f?.(t), t.defaultPrevented || d?.());
|
|
25
|
+
}, l), O = q((t) => {
|
|
26
|
+
const v = t.target;
|
|
27
|
+
[...o.branches].some((m) => m.contains(v)) || (c?.(t), f?.(t), t.defaultPrevented || d?.());
|
|
28
|
+
}, l);
|
|
29
|
+
return U((t) => {
|
|
30
|
+
b === o.layers.size - 1 && (a?.(t), !t.defaultPrevented && d && (t.preventDefault(), d()));
|
|
31
|
+
}, l), n.useEffect(() => {
|
|
32
|
+
if (u)
|
|
33
|
+
return r && (o.layersWithOutsidePointerEventsDisabled.size === 0 && (C = l.body.style.pointerEvents, l.body.style.pointerEvents = "none"), o.layersWithOutsidePointerEventsDisabled.add(u)), o.layers.add(u), L(), () => {
|
|
34
|
+
r && o.layersWithOutsidePointerEventsDisabled.size === 1 && (l.body.style.pointerEvents = C);
|
|
35
|
+
};
|
|
36
|
+
}, [u, l, r, o]), n.useEffect(() => () => {
|
|
37
|
+
u && (o.layers.delete(u), o.layersWithOutsidePointerEventsDisabled.delete(u), L());
|
|
38
|
+
}, [u, o]), n.useEffect(() => {
|
|
39
|
+
const t = () => I({});
|
|
40
|
+
return document.addEventListener(y, t), () => document.removeEventListener(y, t);
|
|
41
|
+
}, []), /* @__PURE__ */ T(
|
|
42
|
+
w.div,
|
|
43
|
+
{
|
|
44
|
+
...E,
|
|
45
|
+
ref: S,
|
|
46
|
+
style: {
|
|
47
|
+
pointerEvents: N ? D ? "auto" : "none" : void 0,
|
|
48
|
+
...s.style
|
|
49
|
+
},
|
|
50
|
+
onFocusCapture: h(s.onFocusCapture, O.onFocusCapture),
|
|
51
|
+
onBlurCapture: h(s.onBlurCapture, O.onBlurCapture),
|
|
52
|
+
onPointerDownCapture: h(
|
|
53
|
+
s.onPointerDownCapture,
|
|
54
|
+
_.onPointerDownCapture
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
K.displayName = z;
|
|
61
|
+
var j = "DismissableLayerBranch", X = n.forwardRef((s, e) => {
|
|
62
|
+
const r = n.useContext(B), a = n.useRef(null), i = g(e, a);
|
|
63
|
+
return n.useEffect(() => {
|
|
64
|
+
const c = a.current;
|
|
65
|
+
if (c)
|
|
66
|
+
return r.branches.add(c), () => {
|
|
67
|
+
r.branches.delete(c);
|
|
68
|
+
};
|
|
69
|
+
}, [r.branches]), /* @__PURE__ */ T(w.div, { ...s, ref: i });
|
|
70
|
+
});
|
|
71
|
+
X.displayName = j;
|
|
72
|
+
function Y(s, e = globalThis?.document) {
|
|
73
|
+
const r = R(s), a = n.useRef(!1), i = n.useRef(() => {
|
|
74
|
+
});
|
|
75
|
+
return n.useEffect(() => {
|
|
76
|
+
const c = (d) => {
|
|
77
|
+
if (d.target && !a.current) {
|
|
78
|
+
let E = function() {
|
|
79
|
+
x(
|
|
80
|
+
H,
|
|
81
|
+
r,
|
|
82
|
+
o,
|
|
83
|
+
{ discrete: !0 }
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
const o = { originalEvent: d };
|
|
87
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", i.current), i.current = E, e.addEventListener("click", i.current, { once: !0 })) : E();
|
|
88
|
+
} else
|
|
89
|
+
e.removeEventListener("click", i.current);
|
|
90
|
+
a.current = !1;
|
|
91
|
+
}, f = window.setTimeout(() => {
|
|
92
|
+
e.addEventListener("pointerdown", c);
|
|
93
|
+
}, 0);
|
|
94
|
+
return () => {
|
|
95
|
+
window.clearTimeout(f), e.removeEventListener("pointerdown", c), e.removeEventListener("click", i.current);
|
|
96
|
+
};
|
|
97
|
+
}, [e, r]), {
|
|
98
|
+
// ensures we check React component tree (not just DOM tree)
|
|
99
|
+
onPointerDownCapture: () => a.current = !0
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function q(s, e = globalThis?.document) {
|
|
103
|
+
const r = R(s), a = n.useRef(!1);
|
|
104
|
+
return n.useEffect(() => {
|
|
105
|
+
const i = (c) => {
|
|
106
|
+
c.target && !a.current && x(M, r, { originalEvent: c }, {
|
|
107
|
+
discrete: !1
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
return e.addEventListener("focusin", i), () => e.removeEventListener("focusin", i);
|
|
111
|
+
}, [e, r]), {
|
|
112
|
+
onFocusCapture: () => a.current = !0,
|
|
113
|
+
onBlurCapture: () => a.current = !1
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function L() {
|
|
117
|
+
const s = new CustomEvent(y);
|
|
118
|
+
document.dispatchEvent(s);
|
|
119
|
+
}
|
|
120
|
+
function x(s, e, r, { discrete: a }) {
|
|
121
|
+
const i = r.originalEvent.target, c = new CustomEvent(s, { bubbles: !1, cancelable: !0, detail: r });
|
|
122
|
+
e && i.addEventListener(s, e, { once: !0 }), a ? k(i, c) : i.dispatchEvent(c);
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
K as DismissableLayer,
|
|
126
|
+
X as DismissableLayerBranch
|
|
127
|
+
};
|