@kolking/react-ui 1.8.20 → 1.9.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/Thumbnails-BlXFynlF.js +38 -0
- package/dist/components/Avatar/Avatar.js +12 -12
- 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 +1 -1
- package/dist/components/Dialog/useDialog.js +21 -29
- 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 +48 -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 +150 -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/Popover/Popover.js +40 -41
- 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 +31 -32
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const icons: readonly ["arrow-down-circle", "arrow-down-outline", "arrow-down", "arrow-left-circle", "arrow-left-outline", "arrow-left", "arrow-right-circle", "arrow-right-outline", "arrow-right", "arrow-up-circle", "arrow-up-outline", "arrow-up", "bell", "bubble-outline", "bubble", "bubbles-outline", "bubbles", "bug", "calendar-checkmark", "calendar-date", "calendar-plus", "calendar", "camera", "cart-outline", "cart", "cat", "checkmark-circle", "checkmark-outline", "checkmark", "chevron-left", "chevron-right", "clock-circle", "clock-outline", "close", "cloud-outline", "cloud", "collapse", "copy", "cross-circle", "cross-outline", "cross", "delete-outline", "delete", "denied", "disclosure", "dropdown", "envelope-outline", "envelope", "error-circle", "error-outline", "expand", "export", "eye-off", "eye", "eyeglasses", "frame", "gear", "heart-outline", "heart", "help-circle", "help-outline", "import", "info-circle", "info-outline", "key", "location-cross", "location", "lock-open", "lock", "map-outline", "map", "menu", "minus-circle", "minus-outline", "minus", "page-outline", "page", "paper-plane", "paperclip", "pencil-circle", "pencil-outline", "pencil", "person", "phone-circle", "phone-outline", "phone", "photos", "playback-next", "playback-pause", "playback-play", "playback-prev", "playback-stop", "plus-circle", "plus-outline", "plus", "printer", "profile-outline", "profile", "redo-circle", "redo-outline", "refresh", "reorder", "search", "shield-checkmark", "shield-lock", "star-circle", "star-outline", "star", "triangle-down", "triangle-left", "triangle-right", "triangle-up", "undo-circle", "undo-outline", "warning-outline", "warning"];
|
|
1
|
+
declare const icons: readonly ["arrow-down-circle", "arrow-down-outline", "arrow-down", "arrow-left-circle", "arrow-left-outline", "arrow-left", "arrow-right-circle", "arrow-right-outline", "arrow-right", "arrow-up-circle", "arrow-up-outline", "arrow-up", "bell", "book-outline", "book", "bubble-outline", "bubble", "bubbles-outline", "bubbles", "bug", "calendar-checkmark", "calendar-date", "calendar-plus", "calendar", "camera", "cart-outline", "cart", "cat", "checkmark-circle", "checkmark-outline", "checkmark", "chevron-left", "chevron-right", "clock-circle", "clock-outline", "close", "cloud-outline", "cloud", "collapse", "copy", "credit-card", "cross-circle", "cross-outline", "cross", "delete-outline", "delete", "denied", "disclosure", "dropdown", "envelope-outline", "envelope", "error-circle", "error-outline", "expand", "export", "eye-off", "eye", "eyeglasses", "frame", "gear", "heart-outline", "heart", "help-circle", "help-outline", "import", "info-circle", "info-outline", "key", "location-cross", "location", "lock-open", "lock", "map-outline", "map", "menu", "minus-circle", "minus-outline", "minus", "page-outline", "page", "paper-plane", "paperclip", "pencil-circle", "pencil-outline", "pencil", "person", "phone-circle", "phone-outline", "phone", "photos", "playback-next", "playback-pause", "playback-play", "playback-prev", "playback-stop", "plus-circle", "plus-outline", "plus", "printer", "profile-outline", "profile", "redo-circle", "redo-outline", "refresh", "reorder", "scissors", "search", "shield-checkmark", "shield-lock", "star-circle", "star-outline", "star", "triangle-down", "triangle-left", "triangle-right", "triangle-up", "undo-circle", "undo-outline", "warning-outline", "warning"];
|
|
2
2
|
export default icons;
|
|
@@ -12,6 +12,8 @@ const e = [
|
|
|
12
12
|
"arrow-up-outline",
|
|
13
13
|
"arrow-up",
|
|
14
14
|
"bell",
|
|
15
|
+
"book-outline",
|
|
16
|
+
"book",
|
|
15
17
|
"bubble-outline",
|
|
16
18
|
"bubble",
|
|
17
19
|
"bubbles-outline",
|
|
@@ -37,6 +39,7 @@ const e = [
|
|
|
37
39
|
"cloud",
|
|
38
40
|
"collapse",
|
|
39
41
|
"copy",
|
|
42
|
+
"credit-card",
|
|
40
43
|
"cross-circle",
|
|
41
44
|
"cross-outline",
|
|
42
45
|
"cross",
|
|
@@ -101,6 +104,7 @@ const e = [
|
|
|
101
104
|
"redo-outline",
|
|
102
105
|
"refresh",
|
|
103
106
|
"reorder",
|
|
107
|
+
"scissors",
|
|
104
108
|
"search",
|
|
105
109
|
"shield-checkmark",
|
|
106
110
|
"shield-lock",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type LightboxImage = React.ImgHTMLAttributes<HTMLImageElement>;
|
|
2
|
+
export type LightboxProps<T extends LightboxImage> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {
|
|
3
|
+
images: T[];
|
|
4
|
+
selected: number;
|
|
5
|
+
loop?: boolean;
|
|
6
|
+
onSelect: (index?: number) => void;
|
|
7
|
+
renderImage?: (image: T) => React.ReactElement;
|
|
8
|
+
};
|
|
9
|
+
export declare const Lightbox: {
|
|
10
|
+
<T extends LightboxImage>({ images, selected, loop, className, children, onSelect, renderImage, ...props }: LightboxProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
Thumbnails: <T extends LightboxImage>({ images, selected, className, style, imageSize: thumbnailSize, objectFit: thumbnailObjectFit, renderImage, onSelect, ...props }: import('./Thumbnails').ThumbnailsProps<T>) => import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { jsxs as b, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useId as j, useRef as D, useCallback as m, useEffect as q } from "react";
|
|
3
|
+
import { useFloating as A, useInteractions as B, useDismiss as H, useRole as K, useListNavigation as M, FloatingPortal as V, FloatingOverlay as z, FloatingFocusManager as G } from "@floating-ui/react";
|
|
4
|
+
import J from "classnames";
|
|
5
|
+
import { Icon as v } from "../Icon/Icon.js";
|
|
6
|
+
import { Button as p } from "../Button/Button.js";
|
|
7
|
+
import { afterTransition as Q, htmlImage as U } from "../../utils/helpers.js";
|
|
8
|
+
import { s as e, T as W } from "../../Thumbnails-BlXFynlF.js";
|
|
9
|
+
const X = ({
|
|
10
|
+
images: x,
|
|
11
|
+
selected: o,
|
|
12
|
+
loop: c = !0,
|
|
13
|
+
className: I,
|
|
14
|
+
children: y,
|
|
15
|
+
onSelect: i,
|
|
16
|
+
renderImage: N = U,
|
|
17
|
+
...w
|
|
18
|
+
}) => {
|
|
19
|
+
const F = j(), a = x.length, O = o !== void 0, s = D([]), k = document.querySelector("[data-floating-root]") ?? document.body, C = a > 1 && (c || o > 0), P = a > 1 && (c || o < a - 1), { refs: R, context: u, elements: l } = A({
|
|
20
|
+
open: O,
|
|
21
|
+
onOpenChange: (t) => {
|
|
22
|
+
t || d();
|
|
23
|
+
}
|
|
24
|
+
}), { getFloatingProps: L, getItemProps: T } = B([
|
|
25
|
+
H(u),
|
|
26
|
+
K(u, { role: "dialog" }),
|
|
27
|
+
M(u, {
|
|
28
|
+
loop: c,
|
|
29
|
+
virtual: !0,
|
|
30
|
+
listRef: s,
|
|
31
|
+
activeIndex: o,
|
|
32
|
+
selectedIndex: o,
|
|
33
|
+
orientation: "both",
|
|
34
|
+
focusItemOnHover: !1,
|
|
35
|
+
openOnArrowKeyDown: !1,
|
|
36
|
+
scrollItemIntoView: { inline: "nearest" },
|
|
37
|
+
onNavigate: (t) => {
|
|
38
|
+
t !== null && t !== o && (s.current[t]?.focus(), i(t));
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
]), f = m(
|
|
42
|
+
(t) => {
|
|
43
|
+
!c && (t === 0 || t === a - 1) && s.current[t]?.focus();
|
|
44
|
+
},
|
|
45
|
+
[c, a]
|
|
46
|
+
), d = m(() => {
|
|
47
|
+
l.floating?.classList.add(e.willhide), Q(l.floating, () => {
|
|
48
|
+
i(void 0);
|
|
49
|
+
});
|
|
50
|
+
}, [l.floating, i]), $ = m(() => {
|
|
51
|
+
const t = o === 0 ? a - 1 : o - 1;
|
|
52
|
+
i(t), f(t);
|
|
53
|
+
}, [a, o, f, i]), E = m(() => {
|
|
54
|
+
const t = o === a - 1 ? 0 : o + 1;
|
|
55
|
+
i(t), f(t);
|
|
56
|
+
}, [a, o, f, i]);
|
|
57
|
+
return q(() => {
|
|
58
|
+
const t = new IntersectionObserver(
|
|
59
|
+
(r) => {
|
|
60
|
+
r.forEach((g) => {
|
|
61
|
+
if (g.isIntersecting) {
|
|
62
|
+
const h = s.current.indexOf(g.target);
|
|
63
|
+
h !== -1 && h !== o && i(h);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
root: l.floating,
|
|
69
|
+
threshold: 1
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
return l.floating && s.current.forEach((r) => {
|
|
73
|
+
r && t.observe(r);
|
|
74
|
+
}), () => {
|
|
75
|
+
t.disconnect();
|
|
76
|
+
};
|
|
77
|
+
}, [l.floating, o, i]), /* @__PURE__ */ b(V, { root: k, children: [
|
|
78
|
+
/* @__PURE__ */ n(z, { lockScroll: !0 }),
|
|
79
|
+
/* @__PURE__ */ n(G, { context: u, children: /* @__PURE__ */ b(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
...L(w),
|
|
83
|
+
ref: R.setFloating,
|
|
84
|
+
"data-lightbox": !0,
|
|
85
|
+
"data-floating-root": !0,
|
|
86
|
+
className: J(e.lightbox, I),
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ b("div", { "data-lightbox-content": !0, className: e.content, children: [
|
|
89
|
+
/* @__PURE__ */ n("div", { "data-lightbox-images": !0, className: e.images, children: x.map((t, r) => /* @__PURE__ */ n(
|
|
90
|
+
"figure",
|
|
91
|
+
{
|
|
92
|
+
ref: (g) => {
|
|
93
|
+
s.current[r] = g;
|
|
94
|
+
},
|
|
95
|
+
id: `${F}${r}`,
|
|
96
|
+
"data-lightbox-image": r,
|
|
97
|
+
"data-selected": r === o,
|
|
98
|
+
tabIndex: r === o ? 0 : -1,
|
|
99
|
+
...T(),
|
|
100
|
+
children: N({ ...t, alt: t.alt ?? `Image ${r + 1} of ${a}` })
|
|
101
|
+
},
|
|
102
|
+
r
|
|
103
|
+
)) }),
|
|
104
|
+
/* @__PURE__ */ n(
|
|
105
|
+
p,
|
|
106
|
+
{
|
|
107
|
+
type: "button",
|
|
108
|
+
variant: "tertiary",
|
|
109
|
+
"data-lightbox-close": !0,
|
|
110
|
+
"aria-label": "close lightbox",
|
|
111
|
+
icon: /* @__PURE__ */ n(v, { name: "close" }),
|
|
112
|
+
className: e.close,
|
|
113
|
+
onClick: d
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
P && /* @__PURE__ */ n(
|
|
117
|
+
p,
|
|
118
|
+
{
|
|
119
|
+
type: "button",
|
|
120
|
+
variant: "tertiary",
|
|
121
|
+
"data-lightbox-next": !0,
|
|
122
|
+
"aria-label": "next image",
|
|
123
|
+
icon: /* @__PURE__ */ n(v, { name: "arrow-right" }),
|
|
124
|
+
className: e.next,
|
|
125
|
+
onClick: E
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
C && /* @__PURE__ */ n(
|
|
129
|
+
p,
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
variant: "tertiary",
|
|
133
|
+
"data-lightbox-prev": !0,
|
|
134
|
+
"aria-label": "previous image",
|
|
135
|
+
icon: /* @__PURE__ */ n(v, { name: "arrow-left" }),
|
|
136
|
+
className: e.prev,
|
|
137
|
+
onClick: $
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] }),
|
|
141
|
+
y
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
) })
|
|
145
|
+
] });
|
|
146
|
+
};
|
|
147
|
+
X.Thumbnails = W;
|
|
148
|
+
export {
|
|
149
|
+
X as Lightbox
|
|
150
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ThumbnailProps = {
|
|
2
|
+
index: number;
|
|
3
|
+
selected: boolean;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
onSelect: (index: number) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const Thumbnail: ({ index, selected, children, onSelect }: ThumbnailProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as c, useEffect as e, useCallback as u } from "react";
|
|
3
|
+
const m = ({ index: r, selected: o, children: i, onSelect: t }) => {
|
|
4
|
+
const l = c(null);
|
|
5
|
+
e(() => {
|
|
6
|
+
o && l.current?.scrollIntoView({ inline: "center" });
|
|
7
|
+
}, [o]);
|
|
8
|
+
const n = u(() => {
|
|
9
|
+
t(r);
|
|
10
|
+
}, [r, t]);
|
|
11
|
+
return /* @__PURE__ */ a(
|
|
12
|
+
"li",
|
|
13
|
+
{
|
|
14
|
+
ref: l,
|
|
15
|
+
role: "option",
|
|
16
|
+
"aria-selected": o,
|
|
17
|
+
"data-selected": o,
|
|
18
|
+
"data-lightbox-thumbnail": r,
|
|
19
|
+
onClick: n,
|
|
20
|
+
children: i
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
m as Thumbnail
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LightboxImage } from './Lightbox';
|
|
3
|
+
export type ThumbnailsProps<T extends LightboxImage> = Omit<React.HTMLAttributes<HTMLUListElement>, 'onSelect'> & {
|
|
4
|
+
images: T[];
|
|
5
|
+
selected: number;
|
|
6
|
+
imageSize?: React.CSSProperties['width'];
|
|
7
|
+
objectFit?: React.CSSProperties['objectFit'];
|
|
8
|
+
renderImage?: (image: T) => React.ReactElement;
|
|
9
|
+
onSelect: (index: number) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const Thumbnails: <T extends LightboxImage>({ images, selected, className, style, imageSize: thumbnailSize, objectFit: thumbnailObjectFit, renderImage, onSelect, ...props }: ThumbnailsProps<T>) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Lightbox';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as O, Fragment as W, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import _, { useState as
|
|
2
|
+
import _, { useState as a, useRef as p, useMemo as k, useEffect as A } from "react";
|
|
3
3
|
import { flushSync as D } from "react-dom";
|
|
4
4
|
import { useFloating as H, offset as U, flip as q, size as G, autoUpdate as J, useInteractions as K, useDismiss as Q, useRole as T, useClick as V, useListNavigation as X, useMergeRefs as Y, FloatingPortal as Z, FloatingFocusManager as $, FloatingList as ee } from "@floating-ui/react";
|
|
5
5
|
import te from "classnames";
|
|
@@ -7,75 +7,74 @@ import { MenuContext as oe } from "./MenuContext.js";
|
|
|
7
7
|
import { getElementRef as ne, cssProps as se } from "../../utils/helpers.js";
|
|
8
8
|
import { s as re } from "../../styles.module-DHm-YTnz.js";
|
|
9
9
|
const pe = ({
|
|
10
|
-
size:
|
|
11
|
-
placement:
|
|
12
|
-
trigger:
|
|
13
|
-
offset:
|
|
14
|
-
unmount:
|
|
15
|
-
minWidth:
|
|
16
|
-
maxWidth:
|
|
17
|
-
minHeight:
|
|
18
|
-
maxHeight:
|
|
19
|
-
className:
|
|
20
|
-
children:
|
|
21
|
-
onSelect:
|
|
22
|
-
...
|
|
10
|
+
size: g,
|
|
11
|
+
placement: l = "bottom-start",
|
|
12
|
+
trigger: n,
|
|
13
|
+
offset: h = 5,
|
|
14
|
+
unmount: R = !0,
|
|
15
|
+
minWidth: v,
|
|
16
|
+
maxWidth: x,
|
|
17
|
+
minHeight: F,
|
|
18
|
+
maxHeight: y,
|
|
19
|
+
className: M,
|
|
20
|
+
children: P,
|
|
21
|
+
onSelect: c,
|
|
22
|
+
...z
|
|
23
23
|
}) => {
|
|
24
|
-
const [
|
|
25
|
-
open:
|
|
26
|
-
placement:
|
|
27
|
-
onOpenChange:
|
|
24
|
+
const [s, m] = a(!1), [r, w] = a(null), [C, E] = a({}), u = p([]), f = p(null), { refs: o, context: e, floatingStyles: I } = H({
|
|
25
|
+
open: s,
|
|
26
|
+
placement: l,
|
|
27
|
+
onOpenChange: m,
|
|
28
28
|
whileElementsMounted: J,
|
|
29
29
|
middleware: [
|
|
30
|
-
U(
|
|
30
|
+
U(h),
|
|
31
31
|
q({ padding: 10 }),
|
|
32
32
|
G({
|
|
33
33
|
padding: 10,
|
|
34
|
-
apply({ rects:
|
|
34
|
+
apply({ rects: i, availableWidth: B, availableHeight: L }) {
|
|
35
35
|
D(() => {
|
|
36
|
-
|
|
37
|
-
minHeight:
|
|
38
|
-
minWidth:
|
|
39
|
-
maxWidth:
|
|
40
|
-
maxHeight:
|
|
36
|
+
E({
|
|
37
|
+
minHeight: F,
|
|
38
|
+
minWidth: v ?? i.reference.width,
|
|
39
|
+
maxWidth: x ?? B,
|
|
40
|
+
maxHeight: y ?? L
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
45
|
]
|
|
46
|
-
}), { getReferenceProps:
|
|
46
|
+
}), { getReferenceProps: N, getFloatingProps: S, getItemProps: d } = K([
|
|
47
47
|
Q(e),
|
|
48
48
|
T(e, { role: "menu" }),
|
|
49
49
|
V(e, { event: "mousedown" }),
|
|
50
50
|
X(e, {
|
|
51
|
-
listRef:
|
|
51
|
+
listRef: u,
|
|
52
52
|
loop: !0,
|
|
53
|
-
activeIndex:
|
|
54
|
-
onNavigate:
|
|
53
|
+
activeIndex: r,
|
|
54
|
+
onNavigate: w
|
|
55
55
|
})
|
|
56
|
-
]),
|
|
57
|
-
() => ({ active:
|
|
58
|
-
[
|
|
59
|
-
),
|
|
56
|
+
]), b = k(
|
|
57
|
+
() => ({ active: r, setOpen: m, getItemProps: d, onSelect: c }),
|
|
58
|
+
[r, d, c]
|
|
59
|
+
), j = Y([o.setReference, ne(n)]);
|
|
60
60
|
return A(() => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
d.current = a ?? document.body;
|
|
61
|
+
const i = o.domReference.current?.closest("[data-floating-root]");
|
|
62
|
+
f.current = i ?? document.body;
|
|
64
63
|
}, [o]), /* @__PURE__ */ O(W, { children: [
|
|
65
64
|
_.cloneElement(
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
n,
|
|
66
|
+
N({ ...n.props, ref: j, "data-menu-trigger": !0 })
|
|
68
67
|
),
|
|
69
|
-
/* @__PURE__ */ t(oe.Provider, { value:
|
|
68
|
+
/* @__PURE__ */ t(oe.Provider, { value: b, children: (s || !R) && /* @__PURE__ */ t(Z, { root: f.current, children: /* @__PURE__ */ t($, { context: e, modal: !1, initialFocus: -1, children: /* @__PURE__ */ t(
|
|
70
69
|
"div",
|
|
71
70
|
{
|
|
72
|
-
...
|
|
71
|
+
...S(z),
|
|
73
72
|
ref: o.setFloating,
|
|
74
|
-
"data-open":
|
|
75
|
-
"data-menu":
|
|
76
|
-
className: te(re.menu,
|
|
77
|
-
style: { ...
|
|
78
|
-
children: /* @__PURE__ */ t(ee, { elementsRef:
|
|
73
|
+
"data-open": s,
|
|
74
|
+
"data-menu": l,
|
|
75
|
+
className: te(re.menu, M),
|
|
76
|
+
style: { ...I, ...C, ...se({ size: g }) },
|
|
77
|
+
children: /* @__PURE__ */ t(ee, { elementsRef: u, children: P })
|
|
79
78
|
}
|
|
80
79
|
) }) }) })
|
|
81
80
|
] });
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { useListItem as
|
|
4
|
-
import
|
|
5
|
-
import { MenuContext as
|
|
6
|
-
import { wrapNode as
|
|
7
|
-
import { s as
|
|
8
|
-
const
|
|
9
|
-
as:
|
|
10
|
-
scheme:
|
|
11
|
-
icon:
|
|
12
|
-
title:
|
|
13
|
-
selected:
|
|
14
|
-
children:
|
|
15
|
-
className:
|
|
16
|
-
onClick:
|
|
1
|
+
import { jsx as p, jsxs as h, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as y, useCallback as M } from "react";
|
|
3
|
+
import { useListItem as N } from "@floating-ui/react";
|
|
4
|
+
import w from "classnames";
|
|
5
|
+
import { MenuContext as A } from "./MenuContext.js";
|
|
6
|
+
import { wrapNode as u } from "../../utils/helpers.js";
|
|
7
|
+
import { s as d } from "../../styles.module-DHm-YTnz.js";
|
|
8
|
+
const z = ({
|
|
9
|
+
as: e,
|
|
10
|
+
scheme: l = "default",
|
|
11
|
+
icon: o,
|
|
12
|
+
title: n,
|
|
13
|
+
selected: m,
|
|
14
|
+
children: r,
|
|
15
|
+
className: f,
|
|
16
|
+
onClick: a,
|
|
17
17
|
...x
|
|
18
18
|
}) => {
|
|
19
|
-
const { active: b, setOpen:
|
|
20
|
-
(
|
|
21
|
-
|
|
19
|
+
const { active: b, setOpen: s, getItemProps: v, onSelect: i } = y(A), { ref: k, index: t } = N(), c = t === b, C = e ?? "button", I = M(
|
|
20
|
+
(g) => {
|
|
21
|
+
s(!1), i?.(t), a?.(g);
|
|
22
22
|
},
|
|
23
|
-
[
|
|
23
|
+
[t, s, i, a]
|
|
24
24
|
);
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
25
|
+
return /* @__PURE__ */ p(
|
|
26
|
+
C,
|
|
27
27
|
{
|
|
28
28
|
...x,
|
|
29
|
-
ref:
|
|
29
|
+
ref: k,
|
|
30
30
|
role: "menuitem",
|
|
31
31
|
"data-menu-item": !0,
|
|
32
|
-
"data-active":
|
|
33
|
-
"data-selected":
|
|
34
|
-
tabIndex:
|
|
35
|
-
type:
|
|
36
|
-
className:
|
|
37
|
-
...v({ onClick:
|
|
38
|
-
children:
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
"data-active": c || m,
|
|
33
|
+
"data-selected": m,
|
|
34
|
+
tabIndex: c ? 0 : -1,
|
|
35
|
+
type: e ? void 0 : "button",
|
|
36
|
+
className: w(d.menuitem, d[l], f),
|
|
37
|
+
...v({ onClick: I }),
|
|
38
|
+
children: r ? u(r, "span") : /* @__PURE__ */ h(j, { children: [
|
|
39
|
+
o === "blank" ? /* @__PURE__ */ p("div", { "data-icon-blank": !0 }) : o,
|
|
40
|
+
n !== void 0 && u(n, "span")
|
|
41
41
|
] })
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
44
|
};
|
|
45
45
|
export {
|
|
46
|
-
|
|
46
|
+
z as MenuItem
|
|
47
47
|
};
|
|
@@ -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
|
};
|