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,338 @@
|
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
import { composeEventHandlers as x } from "../../primitive/dist/index.js";
|
|
3
|
+
import { useComposedRefs as N } from "../../react-compose-refs/dist/index.js";
|
|
4
|
+
import { createContextScope as W } from "../../react-context/dist/index.js";
|
|
5
|
+
import { DismissableLayer as $ } from "../../react-dismissable-layer/dist/index.js";
|
|
6
|
+
import { useId as z } from "../../react-id/dist/index.js";
|
|
7
|
+
import { Root as J, Arrow as Q, Anchor as Z, createPopperScope as S, Content as ee } from "../../react-popper/dist/index.js";
|
|
8
|
+
import { Portal as te } from "../../react-portal/dist/index.js";
|
|
9
|
+
import { Presence as G } from "../../react-presence/dist/index.js";
|
|
10
|
+
import { Primitive as oe } from "../../react-primitive/dist/index.js";
|
|
11
|
+
import { createSlottable as re } from "@radix-ui/react-slot";
|
|
12
|
+
import { useControllableState as ne } from "../../react-use-controllable-state/dist/index.js";
|
|
13
|
+
import { Root as se } from "../../react-visually-hidden/dist/index.js";
|
|
14
|
+
import { jsx as f, jsxs as ae } from "react/jsx-runtime";
|
|
15
|
+
var [O] = W("Tooltip", [
|
|
16
|
+
S
|
|
17
|
+
]), A = S(), j = "TooltipProvider", ie = 700, D = "tooltip.open", [ce, k] = O(j), F = (t) => {
|
|
18
|
+
const {
|
|
19
|
+
__scopeTooltip: o,
|
|
20
|
+
delayDuration: e = ie,
|
|
21
|
+
skipDelayDuration: r = 300,
|
|
22
|
+
disableHoverableContent: n = !1,
|
|
23
|
+
children: c
|
|
24
|
+
} = t, i = s.useRef(!0), v = s.useRef(!1), a = s.useRef(0);
|
|
25
|
+
return s.useEffect(() => {
|
|
26
|
+
const p = a.current;
|
|
27
|
+
return () => window.clearTimeout(p);
|
|
28
|
+
}, []), /* @__PURE__ */ f(
|
|
29
|
+
ce,
|
|
30
|
+
{
|
|
31
|
+
scope: o,
|
|
32
|
+
isOpenDelayedRef: i,
|
|
33
|
+
delayDuration: e,
|
|
34
|
+
onOpen: s.useCallback(() => {
|
|
35
|
+
window.clearTimeout(a.current), i.current = !1;
|
|
36
|
+
}, []),
|
|
37
|
+
onClose: s.useCallback(() => {
|
|
38
|
+
window.clearTimeout(a.current), a.current = window.setTimeout(
|
|
39
|
+
() => i.current = !0,
|
|
40
|
+
r
|
|
41
|
+
);
|
|
42
|
+
}, [r]),
|
|
43
|
+
isPointerInTransitRef: v,
|
|
44
|
+
onPointerInTransitChange: s.useCallback((p) => {
|
|
45
|
+
v.current = p;
|
|
46
|
+
}, []),
|
|
47
|
+
disableHoverableContent: n,
|
|
48
|
+
children: c
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
F.displayName = j;
|
|
53
|
+
var R = "Tooltip", [le, _] = O(R), B = (t) => {
|
|
54
|
+
const {
|
|
55
|
+
__scopeTooltip: o,
|
|
56
|
+
children: e,
|
|
57
|
+
open: r,
|
|
58
|
+
defaultOpen: n,
|
|
59
|
+
onOpenChange: c,
|
|
60
|
+
disableHoverableContent: i,
|
|
61
|
+
delayDuration: v
|
|
62
|
+
} = t, a = k(R, t.__scopeTooltip), p = A(o), [l, d] = s.useState(null), h = z(), u = s.useRef(0), m = i ?? a.disableHoverableContent, C = v ?? a.delayDuration, T = s.useRef(!1), [g, y] = ne({
|
|
63
|
+
prop: r,
|
|
64
|
+
defaultProp: n ?? !1,
|
|
65
|
+
onChange: (H) => {
|
|
66
|
+
H ? (a.onOpen(), document.dispatchEvent(new CustomEvent(D))) : a.onClose(), c?.(H);
|
|
67
|
+
},
|
|
68
|
+
caller: R
|
|
69
|
+
}), w = s.useMemo(() => g ? T.current ? "delayed-open" : "instant-open" : "closed", [g]), P = s.useCallback(() => {
|
|
70
|
+
window.clearTimeout(u.current), u.current = 0, T.current = !1, y(!0);
|
|
71
|
+
}, [y]), E = s.useCallback(() => {
|
|
72
|
+
window.clearTimeout(u.current), u.current = 0, y(!1);
|
|
73
|
+
}, [y]), I = s.useCallback(() => {
|
|
74
|
+
window.clearTimeout(u.current), u.current = window.setTimeout(() => {
|
|
75
|
+
T.current = !0, y(!0), u.current = 0;
|
|
76
|
+
}, C);
|
|
77
|
+
}, [C, y]);
|
|
78
|
+
return s.useEffect(() => () => {
|
|
79
|
+
u.current && (window.clearTimeout(u.current), u.current = 0);
|
|
80
|
+
}, []), /* @__PURE__ */ f(J, { ...p, children: /* @__PURE__ */ f(
|
|
81
|
+
le,
|
|
82
|
+
{
|
|
83
|
+
scope: o,
|
|
84
|
+
contentId: h,
|
|
85
|
+
open: g,
|
|
86
|
+
stateAttribute: w,
|
|
87
|
+
trigger: l,
|
|
88
|
+
onTriggerChange: d,
|
|
89
|
+
onTriggerEnter: s.useCallback(() => {
|
|
90
|
+
a.isOpenDelayedRef.current ? I() : P();
|
|
91
|
+
}, [a.isOpenDelayedRef, I, P]),
|
|
92
|
+
onTriggerLeave: s.useCallback(() => {
|
|
93
|
+
m ? E() : (window.clearTimeout(u.current), u.current = 0);
|
|
94
|
+
}, [E, m]),
|
|
95
|
+
onOpen: P,
|
|
96
|
+
onClose: E,
|
|
97
|
+
disableHoverableContent: m,
|
|
98
|
+
children: e
|
|
99
|
+
}
|
|
100
|
+
) });
|
|
101
|
+
};
|
|
102
|
+
B.displayName = R;
|
|
103
|
+
var L = "TooltipTrigger", U = s.forwardRef(
|
|
104
|
+
(t, o) => {
|
|
105
|
+
const { __scopeTooltip: e, ...r } = t, n = _(L, e), c = k(L, e), i = A(e), v = s.useRef(null), a = N(o, v, n.onTriggerChange), p = s.useRef(!1), l = s.useRef(!1), d = s.useCallback(() => p.current = !1, []);
|
|
106
|
+
return s.useEffect(() => () => document.removeEventListener("pointerup", d), [d]), /* @__PURE__ */ f(Z, { asChild: !0, ...i, children: /* @__PURE__ */ f(
|
|
107
|
+
oe.button,
|
|
108
|
+
{
|
|
109
|
+
"aria-describedby": n.open ? n.contentId : void 0,
|
|
110
|
+
"data-state": n.stateAttribute,
|
|
111
|
+
...r,
|
|
112
|
+
ref: a,
|
|
113
|
+
onPointerMove: x(t.onPointerMove, (h) => {
|
|
114
|
+
h.pointerType !== "touch" && !l.current && !c.isPointerInTransitRef.current && (n.onTriggerEnter(), l.current = !0);
|
|
115
|
+
}),
|
|
116
|
+
onPointerLeave: x(t.onPointerLeave, () => {
|
|
117
|
+
n.onTriggerLeave(), l.current = !1;
|
|
118
|
+
}),
|
|
119
|
+
onPointerDown: x(t.onPointerDown, () => {
|
|
120
|
+
n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", d, { once: !0 });
|
|
121
|
+
}),
|
|
122
|
+
onFocus: x(t.onFocus, () => {
|
|
123
|
+
p.current || n.onOpen();
|
|
124
|
+
}),
|
|
125
|
+
onBlur: x(t.onBlur, n.onClose),
|
|
126
|
+
onClick: x(t.onClick, n.onClose)
|
|
127
|
+
}
|
|
128
|
+
) });
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
U.displayName = L;
|
|
132
|
+
var M = "TooltipPortal", [ue, pe] = O(M, {
|
|
133
|
+
forceMount: void 0
|
|
134
|
+
}), V = (t) => {
|
|
135
|
+
const { __scopeTooltip: o, forceMount: e, children: r, container: n } = t, c = _(M, o);
|
|
136
|
+
return /* @__PURE__ */ f(ue, { scope: o, forceMount: e, children: /* @__PURE__ */ f(G, { present: e || c.open, children: /* @__PURE__ */ f(te, { asChild: !0, container: n, children: r }) }) });
|
|
137
|
+
};
|
|
138
|
+
V.displayName = M;
|
|
139
|
+
var b = "TooltipContent", Y = s.forwardRef(
|
|
140
|
+
(t, o) => {
|
|
141
|
+
const e = pe(b, t.__scopeTooltip), { forceMount: r = e.forceMount, side: n = "top", ...c } = t, i = _(b, t.__scopeTooltip);
|
|
142
|
+
return /* @__PURE__ */ f(G, { present: r || i.open, children: i.disableHoverableContent ? /* @__PURE__ */ f(q, { side: n, ...c, ref: o }) : /* @__PURE__ */ f(de, { side: n, ...c, ref: o }) });
|
|
143
|
+
}
|
|
144
|
+
), de = s.forwardRef((t, o) => {
|
|
145
|
+
const e = _(b, t.__scopeTooltip), r = k(b, t.__scopeTooltip), n = s.useRef(null), c = N(o, n), [i, v] = s.useState(null), { trigger: a, onClose: p } = e, l = n.current, { onPointerInTransitChange: d } = r, h = s.useCallback(() => {
|
|
146
|
+
v(null), d(!1);
|
|
147
|
+
}, [d]), u = s.useCallback(
|
|
148
|
+
(m, C) => {
|
|
149
|
+
const T = m.currentTarget, g = { x: m.clientX, y: m.clientY }, y = me(g, T.getBoundingClientRect()), w = Te(g, y), P = Ce(C.getBoundingClientRect()), E = ge([...w, ...P]);
|
|
150
|
+
v(E), d(!0);
|
|
151
|
+
},
|
|
152
|
+
[d]
|
|
153
|
+
);
|
|
154
|
+
return s.useEffect(() => () => h(), [h]), s.useEffect(() => {
|
|
155
|
+
if (a && l) {
|
|
156
|
+
const m = (T) => u(T, l), C = (T) => u(T, a);
|
|
157
|
+
return a.addEventListener("pointerleave", m), l.addEventListener("pointerleave", C), () => {
|
|
158
|
+
a.removeEventListener("pointerleave", m), l.removeEventListener("pointerleave", C);
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}, [a, l, u, h]), s.useEffect(() => {
|
|
162
|
+
if (i) {
|
|
163
|
+
const m = (C) => {
|
|
164
|
+
const T = C.target, g = { x: C.clientX, y: C.clientY }, y = a?.contains(T) || l?.contains(T), w = !ye(g, i);
|
|
165
|
+
y ? h() : w && (h(), p());
|
|
166
|
+
};
|
|
167
|
+
return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
|
|
168
|
+
}
|
|
169
|
+
}, [a, l, i, p, h]), /* @__PURE__ */ f(q, { ...t, ref: c });
|
|
170
|
+
}), [fe, ve] = O(R, { isInside: !1 }), he = re("TooltipContent"), q = s.forwardRef(
|
|
171
|
+
(t, o) => {
|
|
172
|
+
const {
|
|
173
|
+
__scopeTooltip: e,
|
|
174
|
+
children: r,
|
|
175
|
+
"aria-label": n,
|
|
176
|
+
onEscapeKeyDown: c,
|
|
177
|
+
onPointerDownOutside: i,
|
|
178
|
+
...v
|
|
179
|
+
} = t, a = _(b, e), p = A(e), { onClose: l } = a;
|
|
180
|
+
return s.useEffect(() => (document.addEventListener(D, l), () => document.removeEventListener(D, l)), [l]), s.useEffect(() => {
|
|
181
|
+
if (a.trigger) {
|
|
182
|
+
const d = (h) => {
|
|
183
|
+
h.target?.contains(a.trigger) && l();
|
|
184
|
+
};
|
|
185
|
+
return window.addEventListener("scroll", d, { capture: !0 }), () => window.removeEventListener("scroll", d, { capture: !0 });
|
|
186
|
+
}
|
|
187
|
+
}, [a.trigger, l]), /* @__PURE__ */ f(
|
|
188
|
+
$,
|
|
189
|
+
{
|
|
190
|
+
asChild: !0,
|
|
191
|
+
disableOutsidePointerEvents: !1,
|
|
192
|
+
onEscapeKeyDown: c,
|
|
193
|
+
onPointerDownOutside: i,
|
|
194
|
+
onFocusOutside: (d) => d.preventDefault(),
|
|
195
|
+
onDismiss: l,
|
|
196
|
+
children: /* @__PURE__ */ ae(
|
|
197
|
+
ee,
|
|
198
|
+
{
|
|
199
|
+
"data-state": a.stateAttribute,
|
|
200
|
+
...p,
|
|
201
|
+
...v,
|
|
202
|
+
ref: o,
|
|
203
|
+
style: {
|
|
204
|
+
...v.style,
|
|
205
|
+
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
206
|
+
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
207
|
+
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
208
|
+
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
209
|
+
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
210
|
+
},
|
|
211
|
+
children: [
|
|
212
|
+
/* @__PURE__ */ f(he, { children: r }),
|
|
213
|
+
/* @__PURE__ */ f(fe, { scope: e, isInside: !0, children: /* @__PURE__ */ f(se, { id: a.contentId, role: "tooltip", children: n || r }) })
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
Y.displayName = b;
|
|
222
|
+
var X = "TooltipArrow", K = s.forwardRef(
|
|
223
|
+
(t, o) => {
|
|
224
|
+
const { __scopeTooltip: e, ...r } = t, n = A(e);
|
|
225
|
+
return ve(
|
|
226
|
+
X,
|
|
227
|
+
e
|
|
228
|
+
).isInside ? null : /* @__PURE__ */ f(Q, { ...n, ...r, ref: o });
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
K.displayName = X;
|
|
232
|
+
function me(t, o) {
|
|
233
|
+
const e = Math.abs(o.top - t.y), r = Math.abs(o.bottom - t.y), n = Math.abs(o.right - t.x), c = Math.abs(o.left - t.x);
|
|
234
|
+
switch (Math.min(e, r, n, c)) {
|
|
235
|
+
case c:
|
|
236
|
+
return "left";
|
|
237
|
+
case n:
|
|
238
|
+
return "right";
|
|
239
|
+
case e:
|
|
240
|
+
return "top";
|
|
241
|
+
case r:
|
|
242
|
+
return "bottom";
|
|
243
|
+
default:
|
|
244
|
+
throw new Error("unreachable");
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function Te(t, o, e = 5) {
|
|
248
|
+
const r = [];
|
|
249
|
+
switch (o) {
|
|
250
|
+
case "top":
|
|
251
|
+
r.push(
|
|
252
|
+
{ x: t.x - e, y: t.y + e },
|
|
253
|
+
{ x: t.x + e, y: t.y + e }
|
|
254
|
+
);
|
|
255
|
+
break;
|
|
256
|
+
case "bottom":
|
|
257
|
+
r.push(
|
|
258
|
+
{ x: t.x - e, y: t.y - e },
|
|
259
|
+
{ x: t.x + e, y: t.y - e }
|
|
260
|
+
);
|
|
261
|
+
break;
|
|
262
|
+
case "left":
|
|
263
|
+
r.push(
|
|
264
|
+
{ x: t.x + e, y: t.y - e },
|
|
265
|
+
{ x: t.x + e, y: t.y + e }
|
|
266
|
+
);
|
|
267
|
+
break;
|
|
268
|
+
case "right":
|
|
269
|
+
r.push(
|
|
270
|
+
{ x: t.x - e, y: t.y - e },
|
|
271
|
+
{ x: t.x - e, y: t.y + e }
|
|
272
|
+
);
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
return r;
|
|
276
|
+
}
|
|
277
|
+
function Ce(t) {
|
|
278
|
+
const { top: o, right: e, bottom: r, left: n } = t;
|
|
279
|
+
return [
|
|
280
|
+
{ x: n, y: o },
|
|
281
|
+
{ x: e, y: o },
|
|
282
|
+
{ x: e, y: r },
|
|
283
|
+
{ x: n, y: r }
|
|
284
|
+
];
|
|
285
|
+
}
|
|
286
|
+
function ye(t, o) {
|
|
287
|
+
const { x: e, y: r } = t;
|
|
288
|
+
let n = !1;
|
|
289
|
+
for (let c = 0, i = o.length - 1; c < o.length; i = c++) {
|
|
290
|
+
const v = o[c], a = o[i], p = v.x, l = v.y, d = a.x, h = a.y;
|
|
291
|
+
l > r != h > r && e < (d - p) * (r - l) / (h - l) + p && (n = !n);
|
|
292
|
+
}
|
|
293
|
+
return n;
|
|
294
|
+
}
|
|
295
|
+
function ge(t) {
|
|
296
|
+
const o = t.slice();
|
|
297
|
+
return o.sort((e, r) => e.x < r.x ? -1 : e.x > r.x ? 1 : e.y < r.y ? -1 : e.y > r.y ? 1 : 0), xe(o);
|
|
298
|
+
}
|
|
299
|
+
function xe(t) {
|
|
300
|
+
if (t.length <= 1) return t.slice();
|
|
301
|
+
const o = [];
|
|
302
|
+
for (let r = 0; r < t.length; r++) {
|
|
303
|
+
const n = t[r];
|
|
304
|
+
for (; o.length >= 2; ) {
|
|
305
|
+
const c = o[o.length - 1], i = o[o.length - 2];
|
|
306
|
+
if ((c.x - i.x) * (n.y - i.y) >= (c.y - i.y) * (n.x - i.x)) o.pop();
|
|
307
|
+
else break;
|
|
308
|
+
}
|
|
309
|
+
o.push(n);
|
|
310
|
+
}
|
|
311
|
+
o.pop();
|
|
312
|
+
const e = [];
|
|
313
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
314
|
+
const n = t[r];
|
|
315
|
+
for (; e.length >= 2; ) {
|
|
316
|
+
const c = e[e.length - 1], i = e[e.length - 2];
|
|
317
|
+
if ((c.x - i.x) * (n.y - i.y) >= (c.y - i.y) * (n.x - i.x)) e.pop();
|
|
318
|
+
else break;
|
|
319
|
+
}
|
|
320
|
+
e.push(n);
|
|
321
|
+
}
|
|
322
|
+
return e.pop(), o.length === 1 && e.length === 1 && o[0].x === e[0].x && o[0].y === e[0].y ? o : o.concat(e);
|
|
323
|
+
}
|
|
324
|
+
var He = F, Ne = B, Se = U, Ge = V, je = Y, Fe = K;
|
|
325
|
+
export {
|
|
326
|
+
Fe as Arrow,
|
|
327
|
+
je as Content,
|
|
328
|
+
Ge as Portal,
|
|
329
|
+
He as Provider,
|
|
330
|
+
Ne as Root,
|
|
331
|
+
B as Tooltip,
|
|
332
|
+
K as TooltipArrow,
|
|
333
|
+
Y as TooltipContent,
|
|
334
|
+
V as TooltipPortal,
|
|
335
|
+
F as TooltipProvider,
|
|
336
|
+
U as TooltipTrigger,
|
|
337
|
+
Se as Trigger
|
|
338
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { useLayoutEffect as m } from "../../react-use-layout-effect/dist/index.js";
|
|
3
|
+
var v = o[" useInsertionEffect ".trim().toString()] || m;
|
|
4
|
+
function w({
|
|
5
|
+
prop: e,
|
|
6
|
+
defaultProp: s,
|
|
7
|
+
onChange: t = () => {
|
|
8
|
+
},
|
|
9
|
+
caller: f
|
|
10
|
+
}) {
|
|
11
|
+
const [u, c, i] = R({
|
|
12
|
+
defaultProp: s,
|
|
13
|
+
onChange: t
|
|
14
|
+
}), n = e !== void 0, a = n ? e : u;
|
|
15
|
+
{
|
|
16
|
+
const r = o.useRef(e !== void 0);
|
|
17
|
+
o.useEffect(() => {
|
|
18
|
+
const l = r.current;
|
|
19
|
+
l !== n && console.warn(
|
|
20
|
+
`${f} is changing from ${l ? "controlled" : "uncontrolled"} to ${n ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
21
|
+
), r.current = n;
|
|
22
|
+
}, [n, f]);
|
|
23
|
+
}
|
|
24
|
+
const d = o.useCallback(
|
|
25
|
+
(r) => {
|
|
26
|
+
if (n) {
|
|
27
|
+
const l = C(r) ? r(e) : r;
|
|
28
|
+
l !== e && i.current?.(l);
|
|
29
|
+
} else
|
|
30
|
+
c(r);
|
|
31
|
+
},
|
|
32
|
+
[n, e, c, i]
|
|
33
|
+
);
|
|
34
|
+
return [a, d];
|
|
35
|
+
}
|
|
36
|
+
function R({
|
|
37
|
+
defaultProp: e,
|
|
38
|
+
onChange: s
|
|
39
|
+
}) {
|
|
40
|
+
const [t, f] = o.useState(e), u = o.useRef(t), c = o.useRef(s);
|
|
41
|
+
return v(() => {
|
|
42
|
+
c.current = s;
|
|
43
|
+
}, [s]), o.useEffect(() => {
|
|
44
|
+
u.current !== t && (c.current?.(t), u.current = t);
|
|
45
|
+
}, [t, u]), [t, f, c];
|
|
46
|
+
}
|
|
47
|
+
function C(e) {
|
|
48
|
+
return typeof e == "function";
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
w as useControllableState
|
|
52
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import { useCallbackRef as s } from "../../react-use-callback-ref/dist/index.js";
|
|
3
|
+
function p(n, e = globalThis?.document) {
|
|
4
|
+
const t = s(n);
|
|
5
|
+
r.useEffect(() => {
|
|
6
|
+
const o = (a) => {
|
|
7
|
+
a.key === "Escape" && t(a);
|
|
8
|
+
};
|
|
9
|
+
return e.addEventListener("keydown", o, { capture: !0 }), () => e.removeEventListener("keydown", o, { capture: !0 });
|
|
10
|
+
}, [t, e]);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
p as useEscapeKeydown
|
|
14
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as h from "react";
|
|
2
|
+
import { useLayoutEffect as z } from "../../react-use-layout-effect/dist/index.js";
|
|
3
|
+
function c(r) {
|
|
4
|
+
const [d, e] = h.useState(void 0);
|
|
5
|
+
return z(() => {
|
|
6
|
+
if (r) {
|
|
7
|
+
e({ width: r.offsetWidth, height: r.offsetHeight });
|
|
8
|
+
const f = new ResizeObserver((i) => {
|
|
9
|
+
if (!Array.isArray(i) || !i.length)
|
|
10
|
+
return;
|
|
11
|
+
const b = i[0];
|
|
12
|
+
let o, t;
|
|
13
|
+
if ("borderBoxSize" in b) {
|
|
14
|
+
const s = b.borderBoxSize, u = Array.isArray(s) ? s[0] : s;
|
|
15
|
+
o = u.inlineSize, t = u.blockSize;
|
|
16
|
+
} else
|
|
17
|
+
o = r.offsetWidth, t = r.offsetHeight;
|
|
18
|
+
e({ width: o, height: t });
|
|
19
|
+
});
|
|
20
|
+
return f.observe(r, { box: "border-box" }), () => f.unobserve(r);
|
|
21
|
+
} else
|
|
22
|
+
e(void 0);
|
|
23
|
+
}, [r]), d;
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
c as useSize
|
|
27
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { Primitive as o } from "../../react-primitive/dist/index.js";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
var d = Object.freeze({
|
|
5
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
6
|
+
position: "absolute",
|
|
7
|
+
border: 0,
|
|
8
|
+
width: 1,
|
|
9
|
+
height: 1,
|
|
10
|
+
padding: 0,
|
|
11
|
+
margin: -1,
|
|
12
|
+
overflow: "hidden",
|
|
13
|
+
clip: "rect(0, 0, 0, 0)",
|
|
14
|
+
whiteSpace: "nowrap",
|
|
15
|
+
wordWrap: "normal"
|
|
16
|
+
}), l = "VisuallyHidden", e = a.forwardRef(
|
|
17
|
+
(r, i) => /* @__PURE__ */ t(
|
|
18
|
+
o.span,
|
|
19
|
+
{
|
|
20
|
+
...r,
|
|
21
|
+
ref: i,
|
|
22
|
+
style: { ...d, ...r.style }
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
e.displayName = l;
|
|
27
|
+
var p = e;
|
|
28
|
+
export {
|
|
29
|
+
p as Root,
|
|
30
|
+
d as VISUALLY_HIDDEN_STYLES,
|
|
31
|
+
e as VisuallyHidden
|
|
32
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var S = function(r) {
|
|
2
|
+
if (typeof document > "u")
|
|
3
|
+
return null;
|
|
4
|
+
var u = Array.isArray(r) ? r[0] : r;
|
|
5
|
+
return u.ownerDocument.body;
|
|
6
|
+
}, f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {}, h = 0, W = function(r) {
|
|
7
|
+
return r && (r.host || W(r.parentNode));
|
|
8
|
+
}, D = function(r, u) {
|
|
9
|
+
return u.map(function(e) {
|
|
10
|
+
if (r.contains(e))
|
|
11
|
+
return e;
|
|
12
|
+
var n = W(e);
|
|
13
|
+
return n && r.contains(n) ? n : (console.error("aria-hidden", e, "in not contained inside", r, ". Doing nothing"), null);
|
|
14
|
+
}).filter(function(e) {
|
|
15
|
+
return !!e;
|
|
16
|
+
});
|
|
17
|
+
}, E = function(r, u, e, n) {
|
|
18
|
+
var i = D(u, Array.isArray(r) ? r : [r]);
|
|
19
|
+
p[e] || (p[e] = /* @__PURE__ */ new WeakMap());
|
|
20
|
+
var s = p[e], l = [], o = /* @__PURE__ */ new Set(), b = new Set(i), y = function(t) {
|
|
21
|
+
!t || o.has(t) || (o.add(t), y(t.parentNode));
|
|
22
|
+
};
|
|
23
|
+
i.forEach(y);
|
|
24
|
+
var A = function(t) {
|
|
25
|
+
!t || b.has(t) || Array.prototype.forEach.call(t.children, function(a) {
|
|
26
|
+
if (o.has(a))
|
|
27
|
+
A(a);
|
|
28
|
+
else
|
|
29
|
+
try {
|
|
30
|
+
var c = a.getAttribute(n), w = c !== null && c !== "false", d = (f.get(a) || 0) + 1, M = (s.get(a) || 0) + 1;
|
|
31
|
+
f.set(a, d), s.set(a, M), l.push(a), d === 1 && w && v.set(a, !0), M === 1 && a.setAttribute(e, "true"), w || a.setAttribute(n, "true");
|
|
32
|
+
} catch (k) {
|
|
33
|
+
console.error("aria-hidden: cannot operate on ", a, k);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return A(u), o.clear(), h++, function() {
|
|
38
|
+
l.forEach(function(t) {
|
|
39
|
+
var a = f.get(t) - 1, c = s.get(t) - 1;
|
|
40
|
+
f.set(t, a), s.set(t, c), a || (v.has(t) || t.removeAttribute(n), v.delete(t)), c || t.removeAttribute(e);
|
|
41
|
+
}), h--, h || (f = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {});
|
|
42
|
+
};
|
|
43
|
+
}, C = function(r, u, e) {
|
|
44
|
+
e === void 0 && (e = "data-aria-hidden");
|
|
45
|
+
var n = Array.from(Array.isArray(r) ? r : [r]), i = S(r);
|
|
46
|
+
return i ? (n.push.apply(n, Array.from(i.querySelectorAll("[aria-live], script"))), E(n, i, e, "aria-hidden")) : function() {
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
C as hideOthers
|
|
52
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __assign as m } from "../../../tslib/tslib.es6.js";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { RemoveScroll as e } from "./UI.js";
|
|
4
|
+
import t from "./sidecar.js";
|
|
5
|
+
var s = r.forwardRef(function(a, o) {
|
|
6
|
+
return r.createElement(e, m({}, a, { ref: o, sideCar: t }));
|
|
7
|
+
});
|
|
8
|
+
s.classNames = e.classNames;
|
|
9
|
+
export {
|
|
10
|
+
s as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { __spreadArray as N } from "../../../tslib/tslib.es6.js";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { RemoveScrollBar as W } from "../../../react-remove-scroll-bar/dist/es2015/component.js";
|
|
4
|
+
import { styleSingleton as F } from "../../../react-style-singleton/dist/es2015/component.js";
|
|
5
|
+
import { nonPassive as s } from "./aggresiveCapture.js";
|
|
6
|
+
import { locationCouldBeScrolled as B, handleScroll as K } from "./handleScroll.js";
|
|
7
|
+
var k = function(e) {
|
|
8
|
+
return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
|
|
9
|
+
}, M = function(e) {
|
|
10
|
+
return [e.deltaX, e.deltaY];
|
|
11
|
+
}, X = function(e) {
|
|
12
|
+
return e && "current" in e ? e.current : e;
|
|
13
|
+
}, O = function(e, c) {
|
|
14
|
+
return e[0] === c[0] && e[1] === c[1];
|
|
15
|
+
}, Q = function(e) {
|
|
16
|
+
return `
|
|
17
|
+
.block-interactivity-`.concat(e, ` {pointer-events: none;}
|
|
18
|
+
.allow-interactivity-`).concat(e, ` {pointer-events: all;}
|
|
19
|
+
`);
|
|
20
|
+
}, Z = 0, f = [];
|
|
21
|
+
function J(e) {
|
|
22
|
+
var c = n.useRef([]), R = n.useRef([0, 0]), m = n.useRef(), h = n.useState(Z++)[0], g = n.useState(F)[0], S = n.useRef(e);
|
|
23
|
+
n.useEffect(function() {
|
|
24
|
+
S.current = e;
|
|
25
|
+
}, [e]), n.useEffect(function() {
|
|
26
|
+
if (e.inert) {
|
|
27
|
+
document.body.classList.add("block-interactivity-".concat(h));
|
|
28
|
+
var t = N([e.lockRef.current], (e.shards || []).map(X), !0).filter(Boolean);
|
|
29
|
+
return t.forEach(function(r) {
|
|
30
|
+
return r.classList.add("allow-interactivity-".concat(h));
|
|
31
|
+
}), function() {
|
|
32
|
+
document.body.classList.remove("block-interactivity-".concat(h)), t.forEach(function(r) {
|
|
33
|
+
return r.classList.remove("allow-interactivity-".concat(h));
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}, [e.inert, e.lockRef.current, e.shards]);
|
|
38
|
+
var C = n.useCallback(function(t, r) {
|
|
39
|
+
if ("touches" in t && t.touches.length === 2 || t.type === "wheel" && t.ctrlKey)
|
|
40
|
+
return !S.current.allowPinchZoom;
|
|
41
|
+
var l = k(t), u = R.current, o = "deltaX" in t ? t.deltaX : u[0] - l[0], i = "deltaY" in t ? t.deltaY : u[1] - l[1], a, v = t.target, d = Math.abs(o) > Math.abs(i) ? "h" : "v";
|
|
42
|
+
if ("touches" in t && d === "h" && v.type === "range")
|
|
43
|
+
return !1;
|
|
44
|
+
var P = window.getSelection(), E = P && P.anchorNode, I = E ? E === v || E.contains(v) : !1;
|
|
45
|
+
if (I)
|
|
46
|
+
return !1;
|
|
47
|
+
var b = B(d, v);
|
|
48
|
+
if (!b)
|
|
49
|
+
return !0;
|
|
50
|
+
if (b ? a = d : (a = d === "v" ? "h" : "v", b = B(d, v)), !b)
|
|
51
|
+
return !1;
|
|
52
|
+
if (!m.current && "changedTouches" in t && (o || i) && (m.current = a), !a)
|
|
53
|
+
return !0;
|
|
54
|
+
var Y = m.current || a;
|
|
55
|
+
return K(Y, r, t, Y === "h" ? o : i);
|
|
56
|
+
}, []), y = n.useCallback(function(t) {
|
|
57
|
+
var r = t;
|
|
58
|
+
if (!(!f.length || f[f.length - 1] !== g)) {
|
|
59
|
+
var l = "deltaY" in r ? M(r) : k(r), u = c.current.filter(function(a) {
|
|
60
|
+
return a.name === r.type && (a.target === r.target || r.target === a.shadowParent) && O(a.delta, l);
|
|
61
|
+
})[0];
|
|
62
|
+
if (u && u.should) {
|
|
63
|
+
r.cancelable && r.preventDefault();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!u) {
|
|
67
|
+
var o = (S.current.shards || []).map(X).filter(Boolean).filter(function(a) {
|
|
68
|
+
return a.contains(r.target);
|
|
69
|
+
}), i = o.length > 0 ? C(r, o[0]) : !S.current.noIsolation;
|
|
70
|
+
i && r.cancelable && r.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, []), w = n.useCallback(function(t, r, l, u) {
|
|
74
|
+
var o = { name: t, delta: r, target: l, should: u, shadowParent: _(l) };
|
|
75
|
+
c.current.push(o), setTimeout(function() {
|
|
76
|
+
c.current = c.current.filter(function(i) {
|
|
77
|
+
return i !== o;
|
|
78
|
+
});
|
|
79
|
+
}, 1);
|
|
80
|
+
}, []), L = n.useCallback(function(t) {
|
|
81
|
+
R.current = k(t), m.current = void 0;
|
|
82
|
+
}, []), T = n.useCallback(function(t) {
|
|
83
|
+
w(t.type, M(t), t.target, C(t, e.lockRef.current));
|
|
84
|
+
}, []), D = n.useCallback(function(t) {
|
|
85
|
+
w(t.type, k(t), t.target, C(t, e.lockRef.current));
|
|
86
|
+
}, []);
|
|
87
|
+
n.useEffect(function() {
|
|
88
|
+
return f.push(g), e.setCallbacks({
|
|
89
|
+
onScrollCapture: T,
|
|
90
|
+
onWheelCapture: T,
|
|
91
|
+
onTouchMoveCapture: D
|
|
92
|
+
}), document.addEventListener("wheel", y, s), document.addEventListener("touchmove", y, s), document.addEventListener("touchstart", L, s), function() {
|
|
93
|
+
f = f.filter(function(t) {
|
|
94
|
+
return t !== g;
|
|
95
|
+
}), document.removeEventListener("wheel", y, s), document.removeEventListener("touchmove", y, s), document.removeEventListener("touchstart", L, s);
|
|
96
|
+
};
|
|
97
|
+
}, []);
|
|
98
|
+
var x = e.removeScrollBar, A = e.inert;
|
|
99
|
+
return n.createElement(
|
|
100
|
+
n.Fragment,
|
|
101
|
+
null,
|
|
102
|
+
A ? n.createElement(g, { styles: Q(h) }) : null,
|
|
103
|
+
x ? n.createElement(W, { noRelative: e.noRelative, gapMode: e.gapMode }) : null
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
function _(e) {
|
|
107
|
+
for (var c = null; e !== null; )
|
|
108
|
+
e instanceof ShadowRoot && (c = e.host, e = e.host), e = e.parentNode;
|
|
109
|
+
return c;
|
|
110
|
+
}
|
|
111
|
+
export {
|
|
112
|
+
J as RemoveScrollSideCar,
|
|
113
|
+
M as getDeltaXY,
|
|
114
|
+
k as getTouchXY
|
|
115
|
+
};
|