@kolking/react-ui 1.8.20 → 1.9.1
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/Thumbnails-BlXFynlF.js +38 -0
- package/dist/components/Avatar/Avatar.js +15 -15
- package/dist/components/Avatar/helpers.js +15 -16
- package/dist/components/Badge/Badge.js +28 -29
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Dialog/Dialog.js +44 -44
- package/dist/components/Dialog/useDialog.d.ts +9 -6
- package/dist/components/Dialog/useDialog.js +20 -28
- package/dist/components/Fields/Checkbox.js +15 -15
- package/dist/components/Fields/Numeric.js +34 -36
- package/dist/components/Fields/Range.d.ts +1 -1
- package/dist/components/Fields/Range.js +33 -33
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/Gallery/Gallery.d.ts +11 -0
- package/dist/components/Gallery/Gallery.js +49 -0
- package/dist/components/Gallery/GalleryItem.d.ts +12 -0
- package/dist/components/Gallery/GalleryItem.js +41 -0
- package/dist/components/Gallery/index.d.ts +2 -0
- package/dist/components/Gallery/index.js +6 -0
- package/dist/components/Icon/Icon.js +125 -122
- package/dist/components/Icon/icons.d.ts +1 -1
- package/dist/components/Icon/icons.js +4 -0
- package/dist/components/Lightbox/Lightbox.d.ts +12 -0
- package/dist/components/Lightbox/Lightbox.js +166 -0
- package/dist/components/Lightbox/Thumbnail.d.ts +7 -0
- package/dist/components/Lightbox/Thumbnail.js +26 -0
- package/dist/components/Lightbox/Thumbnails.d.ts +11 -0
- package/dist/components/Lightbox/Thumbnails.js +8 -0
- package/dist/components/Lightbox/index.d.ts +1 -0
- package/dist/components/Lightbox/index.js +4 -0
- package/dist/components/Menu/Menu.js +44 -45
- package/dist/components/Menu/MenuItem.js +33 -33
- package/dist/components/Notice/Notice.js +58 -43
- package/dist/components/Popover/Popover.js +40 -41
- package/dist/components/Progress/ProgressBar.js +14 -14
- package/dist/components/Progress/ProgressCircular.js +15 -15
- package/dist/components/Segmented/Segmented.js +43 -47
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/ToggleButton/ToggleButton.d.ts +1 -1
- package/dist/components/ToggleButton/ToggleGroup.js +42 -40
- package/dist/components/Tooltip/Tooltip.js +30 -31
- package/dist/index.d.ts +3 -1
- package/dist/index.js +71 -63
- package/dist/styles/style.css +1 -1
- package/dist/styles.module-D0C-vMZX.js +7 -0
- package/dist/utils/helpers.d.ts +3 -1
- package/dist/utils/helpers.js +30 -19
- package/package.json +41 -32
|
@@ -1,65 +1,64 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useFloating as
|
|
5
|
-
import { getElementRef as
|
|
6
|
-
const
|
|
7
|
-
popover:
|
|
8
|
-
},
|
|
9
|
-
open:
|
|
1
|
+
import { jsxs as j, Fragment as w, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import C, { useRef as D, useState as H, useEffect as S, useLayoutEffect as U } from "react";
|
|
3
|
+
import X from "classnames";
|
|
4
|
+
import { useFloating as b, offset as B, flip as I, shift as L, autoUpdate as N, useInteractions as T, useDismiss as q, useRole as z, useHover as A, useFocus as G, useClick as J, useMergeRefs as K, FloatingPortal as Q, FloatingFocusManager as V } from "@floating-ui/react";
|
|
5
|
+
import { getElementRef as W } from "../../utils/helpers.js";
|
|
6
|
+
const Y = "Popover_popover_sXXB0", Z = {
|
|
7
|
+
popover: Y
|
|
8
|
+
}, ne = ({
|
|
9
|
+
open: d,
|
|
10
10
|
event: s = "click",
|
|
11
11
|
placement: c = "bottom",
|
|
12
12
|
trigger: t,
|
|
13
|
-
offset:
|
|
13
|
+
offset: m = 5,
|
|
14
14
|
modal: f = !1,
|
|
15
15
|
anchor: n,
|
|
16
16
|
boundary: i,
|
|
17
17
|
disabled: l,
|
|
18
|
-
minWidth:
|
|
19
|
-
maxWidth:
|
|
20
|
-
className:
|
|
21
|
-
children:
|
|
22
|
-
onToggle:
|
|
23
|
-
...
|
|
18
|
+
minWidth: g,
|
|
19
|
+
maxWidth: R,
|
|
20
|
+
className: v,
|
|
21
|
+
children: F,
|
|
22
|
+
onToggle: P,
|
|
23
|
+
...h
|
|
24
24
|
}) => {
|
|
25
|
-
const p =
|
|
25
|
+
const p = D(null), [E, x] = H(!1), a = d ?? E, y = P ?? x, { refs: e, context: o, floatingStyles: O } = b({
|
|
26
26
|
open: a,
|
|
27
27
|
placement: c,
|
|
28
|
-
onOpenChange:
|
|
29
|
-
whileElementsMounted:
|
|
28
|
+
onOpenChange: y,
|
|
29
|
+
whileElementsMounted: N,
|
|
30
30
|
middleware: [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
B(m),
|
|
32
|
+
I({ padding: 10, boundary: i }),
|
|
33
|
+
L({ padding: 5, boundary: i })
|
|
34
34
|
]
|
|
35
|
-
}), { getReferenceProps:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
]),
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
const u = (d = e.domReference.current) == null ? void 0 : d.closest("[data-floating-root]");
|
|
35
|
+
}), { getReferenceProps: _, getFloatingProps: k } = T([
|
|
36
|
+
q(o),
|
|
37
|
+
z(o, { role: "dialog" }),
|
|
38
|
+
A(o, { move: !1, enabled: s.includes("hover") }),
|
|
39
|
+
G(o, { enabled: s.includes("focus") }),
|
|
40
|
+
J(o, { enabled: s.includes("click") })
|
|
41
|
+
]), M = K([e.setReference, W(t)]);
|
|
42
|
+
return S(() => {
|
|
43
|
+
const u = e.domReference.current?.closest("[data-floating-root]");
|
|
45
44
|
!l && u && (p.current = u);
|
|
46
|
-
}, [e, l]),
|
|
45
|
+
}, [e, l]), U(() => {
|
|
47
46
|
n && e.setPositionReference(n);
|
|
48
|
-
}, [e, n]), l ? t : /* @__PURE__ */ w
|
|
49
|
-
|
|
50
|
-
a && /* @__PURE__ */ r(
|
|
47
|
+
}, [e, n]), l ? t : /* @__PURE__ */ j(w, { children: [
|
|
48
|
+
C.cloneElement(t, _({ ...t.props, ref: M })),
|
|
49
|
+
a && /* @__PURE__ */ r(Q, { root: p, children: /* @__PURE__ */ r(V, { context: o, modal: f, visuallyHiddenDismiss: f, children: /* @__PURE__ */ r(
|
|
51
50
|
"div",
|
|
52
51
|
{
|
|
53
|
-
...
|
|
52
|
+
...k(h),
|
|
54
53
|
ref: e.setFloating,
|
|
55
54
|
"data-popover": c,
|
|
56
|
-
className:
|
|
57
|
-
style: { ...
|
|
58
|
-
children:
|
|
55
|
+
className: X(Z.popover, v),
|
|
56
|
+
style: { ...O, minWidth: g, maxWidth: R },
|
|
57
|
+
children: F
|
|
59
58
|
}
|
|
60
59
|
) }) })
|
|
61
60
|
] });
|
|
62
61
|
};
|
|
63
62
|
export {
|
|
64
|
-
|
|
63
|
+
ne as Popover
|
|
65
64
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import v from "react";
|
|
3
3
|
import _ from "classnames";
|
|
4
|
-
import { cssProps as
|
|
5
|
-
const
|
|
6
|
-
progress:
|
|
7
|
-
indicator:
|
|
8
|
-
},
|
|
4
|
+
import { cssProps as b, clamp as w } from "../../utils/helpers.js";
|
|
5
|
+
const P = "Progress_progress_LSrhF", h = "Progress_indicator_KDwMt", e = {
|
|
6
|
+
progress: P,
|
|
7
|
+
indicator: h
|
|
8
|
+
}, $ = v.forwardRef(
|
|
9
9
|
({
|
|
10
10
|
value: s,
|
|
11
11
|
width: o,
|
|
@@ -15,15 +15,15 @@ const w = "Progress_progress_LSrhF", P = "Progress_indicator_KDwMt", e = {
|
|
|
15
15
|
minWidth: c,
|
|
16
16
|
maxWidth: p,
|
|
17
17
|
margin: d,
|
|
18
|
-
style:
|
|
19
|
-
className:
|
|
18
|
+
style: l,
|
|
19
|
+
className: m,
|
|
20
20
|
...g
|
|
21
21
|
}, f) => {
|
|
22
|
-
const r = s ?
|
|
22
|
+
const r = s ? w(s, 0, 100) : void 0, u = r !== void 0 ? `${r} percent` : "indeterminate";
|
|
23
23
|
return /* @__PURE__ */ a(
|
|
24
24
|
"div",
|
|
25
25
|
{
|
|
26
|
-
"aria-label":
|
|
26
|
+
"aria-label": u,
|
|
27
27
|
...g,
|
|
28
28
|
ref: f,
|
|
29
29
|
role: "progressbar",
|
|
@@ -32,10 +32,10 @@ const w = "Progress_progress_LSrhF", P = "Progress_indicator_KDwMt", e = {
|
|
|
32
32
|
"aria-valuenow": r,
|
|
33
33
|
"data-progress-bar": !0,
|
|
34
34
|
"data-progress-value": r ?? "indeterminate",
|
|
35
|
-
className: _(e.progress,
|
|
35
|
+
className: _(e.progress, m),
|
|
36
36
|
style: {
|
|
37
|
-
...
|
|
38
|
-
...
|
|
37
|
+
...l,
|
|
38
|
+
...b({ width: o, height: t, color: i, trackColor: n, minWidth: c, maxWidth: p, margin: d })
|
|
39
39
|
},
|
|
40
40
|
children: /* @__PURE__ */ a(
|
|
41
41
|
"span",
|
|
@@ -50,5 +50,5 @@ const w = "Progress_progress_LSrhF", P = "Progress_indicator_KDwMt", e = {
|
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
$ as ProgressBar
|
|
54
54
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import N from "react";
|
|
3
|
+
import b from "classnames";
|
|
4
4
|
import { cssProps as k, clamp as w } from "../../utils/helpers.js";
|
|
5
|
-
const
|
|
6
|
-
inner:
|
|
7
|
-
container:
|
|
8
|
-
range:
|
|
9
|
-
progress:
|
|
10
|
-
track:
|
|
5
|
+
const h = "Progress_inner_Zoiac", x = "Progress_container_tFVew", y = "Progress_range_uqjFb", C = "Progress_progress_MHEjj", F = "Progress_track_jWvrX", n = {
|
|
6
|
+
inner: h,
|
|
7
|
+
container: x,
|
|
8
|
+
range: y,
|
|
9
|
+
progress: C,
|
|
10
|
+
track: F
|
|
11
11
|
};
|
|
12
|
-
function
|
|
12
|
+
function R(r, s, e) {
|
|
13
13
|
return e !== void 0 ? ((e - r) / (s - r) * 100).toString() : e;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const M = N.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
min: r = 0,
|
|
18
18
|
max: s = 100,
|
|
@@ -29,11 +29,11 @@ const H = j.forwardRef(
|
|
|
29
29
|
children: t,
|
|
30
30
|
...v
|
|
31
31
|
}, P) => {
|
|
32
|
-
const a = e !== null ? w(e, r, s) : void 0;
|
|
32
|
+
const a = e !== null ? w(e, r, s) : void 0, j = a !== void 0 ? `${a} percent` : "indeterminate";
|
|
33
33
|
return /* @__PURE__ */ c(
|
|
34
34
|
"div",
|
|
35
35
|
{
|
|
36
|
-
"aria-label":
|
|
36
|
+
"aria-label": j,
|
|
37
37
|
...v,
|
|
38
38
|
ref: P,
|
|
39
39
|
role: "progressbar",
|
|
@@ -43,7 +43,7 @@ const H = j.forwardRef(
|
|
|
43
43
|
"data-progress-circular": !0,
|
|
44
44
|
"data-countdown": l,
|
|
45
45
|
"data-progress-value": a ?? "indeterminate",
|
|
46
|
-
className:
|
|
46
|
+
className: b(n.container, _),
|
|
47
47
|
style: {
|
|
48
48
|
...f,
|
|
49
49
|
...k({
|
|
@@ -53,7 +53,7 @@ const H = j.forwardRef(
|
|
|
53
53
|
color: d,
|
|
54
54
|
trackColor: p,
|
|
55
55
|
margin: m,
|
|
56
|
-
value:
|
|
56
|
+
value: R(r, s, a)
|
|
57
57
|
})
|
|
58
58
|
},
|
|
59
59
|
children: [
|
|
@@ -68,5 +68,5 @@ const H = j.forwardRef(
|
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
70
|
export {
|
|
71
|
-
|
|
71
|
+
M as ProgressCircular
|
|
72
72
|
};
|
|
@@ -1,65 +1,61 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Composite as
|
|
5
|
-
import { cssProps as
|
|
6
|
-
const
|
|
7
|
-
button:
|
|
8
|
-
segmented:
|
|
9
|
-
},
|
|
10
|
-
size:
|
|
11
|
-
items:
|
|
12
|
-
selected: t =
|
|
13
|
-
disabled:
|
|
14
|
-
segmentsWidth:
|
|
15
|
-
margin:
|
|
16
|
-
children:
|
|
17
|
-
className:
|
|
18
|
-
style:
|
|
19
|
-
onSelect:
|
|
1
|
+
import { jsxs as S, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import h from "classnames";
|
|
3
|
+
import { useState as _, useEffect as x } from "react";
|
|
4
|
+
import { Composite as y, CompositeItem as C } from "@floating-ui/react";
|
|
5
|
+
import { cssProps as N, wrapNode as j } from "../../utils/helpers.js";
|
|
6
|
+
const k = "Segmented_button_FPqA0", q = "Segmented_segmented_UOs8Z", l = {
|
|
7
|
+
button: k,
|
|
8
|
+
segmented: q
|
|
9
|
+
}, B = ({
|
|
10
|
+
size: m,
|
|
11
|
+
items: o,
|
|
12
|
+
selected: t = o[0].value,
|
|
13
|
+
disabled: a,
|
|
14
|
+
segmentsWidth: u = "auto",
|
|
15
|
+
margin: c,
|
|
16
|
+
children: i,
|
|
17
|
+
className: p,
|
|
18
|
+
style: g,
|
|
19
|
+
onSelect: b,
|
|
20
20
|
...f
|
|
21
21
|
}) => {
|
|
22
|
-
const v =
|
|
23
|
-
return
|
|
22
|
+
const v = u === "equal" ? 0 : void 0, [s, n] = _(t);
|
|
23
|
+
return x(() => {
|
|
24
24
|
n(t);
|
|
25
|
-
}, [t]), /* @__PURE__ */
|
|
26
|
-
|
|
25
|
+
}, [t]), /* @__PURE__ */ S(
|
|
26
|
+
y,
|
|
27
27
|
{
|
|
28
28
|
...f,
|
|
29
29
|
role: "radiogroup",
|
|
30
30
|
orientation: "horizontal",
|
|
31
31
|
"data-segmented": !0,
|
|
32
|
-
"data-disabled":
|
|
33
|
-
className:
|
|
34
|
-
style: { ...
|
|
32
|
+
"data-disabled": a,
|
|
33
|
+
className: h(l.segmented, p),
|
|
34
|
+
style: { ...g, ...N({ size: m, margin: c, flexBasis: v }) },
|
|
35
35
|
children: [
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
o.map((e, r) => /* @__PURE__ */ d(
|
|
37
|
+
C,
|
|
38
38
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
children: k(e.label, "span")
|
|
53
|
-
}
|
|
54
|
-
)
|
|
39
|
+
role: "radio",
|
|
40
|
+
type: "button",
|
|
41
|
+
render: /* @__PURE__ */ d("button", {}),
|
|
42
|
+
disabled: a || e.disabled,
|
|
43
|
+
"data-segmented-item": r,
|
|
44
|
+
"aria-checked": e.value === s,
|
|
45
|
+
"data-selected": e.value === s,
|
|
46
|
+
className: l.button,
|
|
47
|
+
onClick: () => {
|
|
48
|
+
n(e.value), b?.(e.value);
|
|
49
|
+
},
|
|
50
|
+
children: j(e.label, "span")
|
|
55
51
|
},
|
|
56
|
-
|
|
52
|
+
r
|
|
57
53
|
)),
|
|
58
|
-
|
|
54
|
+
i
|
|
59
55
|
]
|
|
60
56
|
}
|
|
61
57
|
);
|
|
62
58
|
};
|
|
63
59
|
export {
|
|
64
|
-
|
|
60
|
+
B as Segmented
|
|
65
61
|
};
|
|
@@ -18,4 +18,4 @@ export declare const Tag: <T extends React.ElementType = "span">(props: {
|
|
|
18
18
|
title?: React.ReactNode;
|
|
19
19
|
icon?: React.ReactElement;
|
|
20
20
|
iconPosition?: "start" | "end";
|
|
21
|
-
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "title" | "
|
|
21
|
+
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "title" | "as" | "size" | "icon" | "scheme" | "variant" | "iconPosition"> & React.RefAttributes<unknown>) => React.ReactElement | null;
|
|
@@ -16,4 +16,4 @@ export declare const ToggleButton: React.ForwardRefExoticComponent<Omit<ButtonPr
|
|
|
16
16
|
title?: React.ReactNode;
|
|
17
17
|
icon?: React.ReactElement;
|
|
18
18
|
iconPosition?: "start" | "end";
|
|
19
|
-
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "title" | "
|
|
19
|
+
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "title" | "as" | "size" | "icon" | "scheme" | "minWidth" | "maxWidth" | "variant" | "busy" | "iconPosition"> & React.RefAttributes<unknown>) => React.ReactElement | null)>>;
|
|
@@ -1,50 +1,52 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Composite as
|
|
5
|
-
import { cssProps as
|
|
6
|
-
const
|
|
7
|
-
group:
|
|
8
|
-
},
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import b from "classnames";
|
|
3
|
+
import p, { useState as y, useEffect as I } from "react";
|
|
4
|
+
import { Composite as h, CompositeItem as k } from "@floating-ui/react";
|
|
5
|
+
import { cssProps as x } from "../../utils/helpers.js";
|
|
6
|
+
const E = "ToggleButton_group_yo9Nc", N = {
|
|
7
|
+
group: E
|
|
8
|
+
}, P = ({
|
|
9
9
|
selected: o = 0,
|
|
10
|
-
disabled:
|
|
11
|
-
minWidth:
|
|
12
|
-
maxWidth:
|
|
13
|
-
flexBasis:
|
|
14
|
-
className:
|
|
15
|
-
style:
|
|
16
|
-
children:
|
|
17
|
-
onSelect:
|
|
18
|
-
...
|
|
10
|
+
disabled: l,
|
|
11
|
+
minWidth: n,
|
|
12
|
+
maxWidth: c,
|
|
13
|
+
flexBasis: m,
|
|
14
|
+
className: u,
|
|
15
|
+
style: i,
|
|
16
|
+
children: a,
|
|
17
|
+
onSelect: d,
|
|
18
|
+
...g
|
|
19
19
|
}) => {
|
|
20
|
-
const [
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
}, [o]), /* @__PURE__ */
|
|
24
|
-
|
|
20
|
+
const [f, t] = y(o);
|
|
21
|
+
return I(() => {
|
|
22
|
+
t(o);
|
|
23
|
+
}, [o]), /* @__PURE__ */ s(
|
|
24
|
+
h,
|
|
25
25
|
{
|
|
26
|
-
...
|
|
26
|
+
...g,
|
|
27
27
|
role: "radiogroup",
|
|
28
28
|
"data-toggle-group": !0,
|
|
29
|
-
className:
|
|
30
|
-
style: { ...
|
|
31
|
-
children:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
className: b(N.group, u),
|
|
30
|
+
style: { ...i, ...x({ flexBasis: m, minWidth: n, maxWidth: c }) },
|
|
31
|
+
children: p.Children.map(a, (C, e) => {
|
|
32
|
+
const r = C;
|
|
33
|
+
return /* @__PURE__ */ s(
|
|
34
|
+
k,
|
|
35
|
+
{
|
|
36
|
+
render: p.cloneElement(r, {
|
|
37
|
+
role: "radio",
|
|
38
|
+
disabled: l || r.props?.disabled,
|
|
39
|
+
selected: e === f,
|
|
40
|
+
onClick: (_) => {
|
|
41
|
+
t(e), d?.(e), r.props?.onClick?.(_);
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
})
|
|
45
47
|
}
|
|
46
48
|
);
|
|
47
49
|
};
|
|
48
50
|
export {
|
|
49
|
-
|
|
51
|
+
P as ToggleGroup
|
|
50
52
|
};
|
|
@@ -1,74 +1,73 @@
|
|
|
1
|
-
import { jsxs as m, Fragment as S, jsx as
|
|
1
|
+
import { jsxs as m, Fragment as S, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import j, { useRef as g, useState as w, useEffect as k, useLayoutEffect as C } from "react";
|
|
3
3
|
import U from "classnames";
|
|
4
4
|
import { useFloating as W, offset as b, flip as A, shift as B, arrow as D, autoUpdate as H, useInteractions as I, useDismiss as L, useRole as V, useHover as $, useFocus as q, useClick as z, useMergeRefs as G, FloatingPortal as J, FloatingArrow as K } from "@floating-ui/react";
|
|
5
5
|
import { getElementRef as Q } from "../../utils/helpers.js";
|
|
6
|
-
const X = "Tooltip_tooltip_u1Uix", Y = "Tooltip_arrow_NBFiV", Z = "Tooltip_content_lfpfM",
|
|
6
|
+
const X = "Tooltip_tooltip_u1Uix", Y = "Tooltip_arrow_NBFiV", Z = "Tooltip_content_lfpfM", f = {
|
|
7
7
|
tooltip: X,
|
|
8
8
|
arrow: Y,
|
|
9
9
|
content: Z
|
|
10
10
|
}, rt = ({
|
|
11
|
-
trigger:
|
|
12
|
-
placement:
|
|
11
|
+
trigger: n = "hover focus",
|
|
12
|
+
placement: a = "top",
|
|
13
13
|
offset: R = 8,
|
|
14
|
-
anchor:
|
|
14
|
+
anchor: r,
|
|
15
15
|
content: h,
|
|
16
|
-
disabled:
|
|
16
|
+
disabled: l,
|
|
17
17
|
minWidth: F,
|
|
18
18
|
maxWidth: _,
|
|
19
19
|
className: v,
|
|
20
|
-
children:
|
|
20
|
+
children: s,
|
|
21
21
|
...x
|
|
22
22
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
open:
|
|
25
|
-
placement:
|
|
23
|
+
const c = g(null), u = g(null), [p, E] = w(!1), [O, y] = w(!1), { refs: t, context: e, floatingStyles: N } = W({
|
|
24
|
+
open: p,
|
|
25
|
+
placement: a,
|
|
26
26
|
onOpenChange: E,
|
|
27
27
|
whileElementsMounted: H,
|
|
28
28
|
middleware: [
|
|
29
29
|
b(R),
|
|
30
30
|
A({ padding: 10 }),
|
|
31
31
|
B({ padding: 5 }),
|
|
32
|
-
D(({ placement: o, rects:
|
|
33
|
-
|
|
34
|
-
), { element:
|
|
32
|
+
D(({ placement: o, rects: d }) => (y(
|
|
33
|
+
d.floating.width < d.reference.width && (o.endsWith("-start") || o.endsWith("-end"))
|
|
34
|
+
), { element: c, padding: 8 }))
|
|
35
35
|
]
|
|
36
36
|
}), { getReferenceProps: P, getFloatingProps: T } = I([
|
|
37
37
|
L(e),
|
|
38
38
|
V(e, { role: "tooltip" }),
|
|
39
|
-
$(e, { move: !1, enabled:
|
|
40
|
-
q(e, { enabled:
|
|
41
|
-
z(e, { enabled:
|
|
42
|
-
]), M = G([t.setReference, Q(
|
|
39
|
+
$(e, { move: !1, enabled: n.includes("hover") }),
|
|
40
|
+
q(e, { enabled: n.includes("focus") }),
|
|
41
|
+
z(e, { enabled: n.includes("click") })
|
|
42
|
+
]), M = G([t.setReference, Q(s)]);
|
|
43
43
|
return k(() => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
d && /* @__PURE__ */ f(J, { root: p, children: /* @__PURE__ */ m(
|
|
44
|
+
const o = t.domReference.current?.closest("[data-floating-root]");
|
|
45
|
+
!l && o && (u.current = o);
|
|
46
|
+
}, [t, l]), C(() => {
|
|
47
|
+
r && t.setPositionReference(r);
|
|
48
|
+
}, [t, r]), l ? s : /* @__PURE__ */ m(S, { children: [
|
|
49
|
+
j.cloneElement(s, P({ ...s.props, ref: M })),
|
|
50
|
+
p && /* @__PURE__ */ i(J, { root: u, children: /* @__PURE__ */ m(
|
|
52
51
|
"div",
|
|
53
52
|
{
|
|
54
53
|
...T(x),
|
|
55
54
|
ref: t.setFloating,
|
|
56
|
-
"data-tooltip":
|
|
57
|
-
className: U(
|
|
55
|
+
"data-tooltip": a,
|
|
56
|
+
className: U(f.tooltip, v),
|
|
58
57
|
style: { ...N, minWidth: F, maxWidth: _ },
|
|
59
58
|
children: [
|
|
60
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ i(
|
|
61
60
|
K,
|
|
62
61
|
{
|
|
63
62
|
width: 12,
|
|
64
63
|
height: 6,
|
|
65
|
-
ref:
|
|
64
|
+
ref: c,
|
|
66
65
|
context: e,
|
|
67
|
-
className:
|
|
66
|
+
className: f.arrow,
|
|
68
67
|
staticOffset: O ? 8 : null
|
|
69
68
|
}
|
|
70
69
|
),
|
|
71
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ i("div", { "data-tooltip-content": !0, className: f.content, children: h })
|
|
72
71
|
]
|
|
73
72
|
}
|
|
74
73
|
) })
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ export * from './components/Badge';
|
|
|
3
3
|
export * from './components/Breadcrumbs';
|
|
4
4
|
export * from './components/Button';
|
|
5
5
|
export * from './components/Dialog';
|
|
6
|
-
export * from './components/Flex';
|
|
7
6
|
export * from './components/Fields';
|
|
7
|
+
export * from './components/Flex';
|
|
8
|
+
export * from './components/Gallery';
|
|
8
9
|
export * from './components/Heading';
|
|
9
10
|
export * from './components/Icon';
|
|
11
|
+
export * from './components/Lightbox';
|
|
10
12
|
export * from './components/Menu';
|
|
11
13
|
export * from './components/Notice';
|
|
12
14
|
export * from './components/Popover';
|