@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,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,166 @@
|
|
|
1
|
+
import { jsxs as b, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useId as j, useRef as q, useCallback as m, useEffect as A } from "react";
|
|
3
|
+
import { useFloating as D, 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: d,
|
|
11
|
+
selected: o,
|
|
12
|
+
loop: c = !0,
|
|
13
|
+
className: x,
|
|
14
|
+
children: y,
|
|
15
|
+
onSelect: n,
|
|
16
|
+
renderImage: N = U,
|
|
17
|
+
...w
|
|
18
|
+
}) => {
|
|
19
|
+
const F = j(), a = d.length, O = o !== void 0, s = q([]), $ = document.querySelector("[data-floating-root]") ?? document.body, k = a > 1 && (c || o > 0), C = a > 1 && (c || o < a - 1), { refs: P, context: u, elements: l } = D({
|
|
20
|
+
open: O,
|
|
21
|
+
onOpenChange: (t) => {
|
|
22
|
+
t || I();
|
|
23
|
+
}
|
|
24
|
+
}), { getFloatingProps: R, getItemProps: L } = 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(), n(t));
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
]), f = m(
|
|
42
|
+
(t) => {
|
|
43
|
+
!c && (t === 0 || t === a - 1) && requestAnimationFrame(() => {
|
|
44
|
+
s.current[t]?.focus();
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
[c, a]
|
|
48
|
+
), I = m(() => {
|
|
49
|
+
l.floating?.classList.add(e.willhide), Q(l.floating, () => {
|
|
50
|
+
n(void 0);
|
|
51
|
+
});
|
|
52
|
+
}, [l.floating, n]), T = m(() => {
|
|
53
|
+
const t = o === 0 ? a - 1 : o - 1;
|
|
54
|
+
n(t), f(t);
|
|
55
|
+
}, [a, o, f, n]), E = m(() => {
|
|
56
|
+
const t = o === a - 1 ? 0 : o + 1;
|
|
57
|
+
n(t), f(t);
|
|
58
|
+
}, [a, o, f, n]);
|
|
59
|
+
return A(() => {
|
|
60
|
+
const t = new IntersectionObserver(
|
|
61
|
+
(r) => {
|
|
62
|
+
r.forEach((g) => {
|
|
63
|
+
if (g.isIntersecting) {
|
|
64
|
+
const h = s.current.indexOf(g.target);
|
|
65
|
+
h !== -1 && h !== o && n(h);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
root: l.floating,
|
|
71
|
+
threshold: 1
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
return l.floating && s.current.forEach((r) => {
|
|
75
|
+
r && t.observe(r);
|
|
76
|
+
}), () => {
|
|
77
|
+
t.disconnect();
|
|
78
|
+
};
|
|
79
|
+
}, [l.floating, o, n]), /* @__PURE__ */ b(V, { root: $, children: [
|
|
80
|
+
/* @__PURE__ */ i(z, { lockScroll: !0 }),
|
|
81
|
+
/* @__PURE__ */ i(G, { context: u, children: /* @__PURE__ */ b(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
...R(w),
|
|
85
|
+
ref: P.setFloating,
|
|
86
|
+
"data-lightbox": !0,
|
|
87
|
+
"data-floating-root": !0,
|
|
88
|
+
className: J(e.lightbox, x),
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ b(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
role: "region",
|
|
94
|
+
"aria-label": "images",
|
|
95
|
+
"aria-roledescription": "carousel",
|
|
96
|
+
"data-lightbox-content": !0,
|
|
97
|
+
className: e.content,
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ i("div", { "data-lightbox-images": !0, className: e.images, children: d.map((t, r) => /* @__PURE__ */ i(
|
|
100
|
+
"figure",
|
|
101
|
+
{
|
|
102
|
+
ref: (g) => {
|
|
103
|
+
s.current[r] = g;
|
|
104
|
+
},
|
|
105
|
+
role: "group",
|
|
106
|
+
"aria-roledescription": "slide",
|
|
107
|
+
"aria-label": `${r + 1} of ${a}`,
|
|
108
|
+
id: `${F}${r}`,
|
|
109
|
+
"data-lightbox-image": r,
|
|
110
|
+
"data-selected": r === o,
|
|
111
|
+
"aria-current": r === o,
|
|
112
|
+
tabIndex: r === o ? 0 : -1,
|
|
113
|
+
...L(),
|
|
114
|
+
children: N({ ...t, alt: t.alt ?? `Image ${r + 1} of ${a}` })
|
|
115
|
+
},
|
|
116
|
+
r
|
|
117
|
+
)) }),
|
|
118
|
+
/* @__PURE__ */ i(
|
|
119
|
+
p,
|
|
120
|
+
{
|
|
121
|
+
type: "button",
|
|
122
|
+
variant: "tertiary",
|
|
123
|
+
"data-lightbox-close": !0,
|
|
124
|
+
"aria-label": "close lightbox",
|
|
125
|
+
icon: /* @__PURE__ */ i(v, { name: "close" }),
|
|
126
|
+
className: e.close,
|
|
127
|
+
onClick: I
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
C && /* @__PURE__ */ i(
|
|
131
|
+
p,
|
|
132
|
+
{
|
|
133
|
+
type: "button",
|
|
134
|
+
variant: "tertiary",
|
|
135
|
+
"data-lightbox-next": !0,
|
|
136
|
+
"aria-label": "next image",
|
|
137
|
+
icon: /* @__PURE__ */ i(v, { name: "arrow-right" }),
|
|
138
|
+
className: e.next,
|
|
139
|
+
onClick: E
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
k && /* @__PURE__ */ i(
|
|
143
|
+
p,
|
|
144
|
+
{
|
|
145
|
+
type: "button",
|
|
146
|
+
variant: "tertiary",
|
|
147
|
+
"data-lightbox-prev": !0,
|
|
148
|
+
"aria-label": "previous image",
|
|
149
|
+
icon: /* @__PURE__ */ i(v, { name: "arrow-left" }),
|
|
150
|
+
className: e.prev,
|
|
151
|
+
onClick: T
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
),
|
|
157
|
+
y
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
) })
|
|
161
|
+
] });
|
|
162
|
+
};
|
|
163
|
+
X.Thumbnails = W;
|
|
164
|
+
export {
|
|
165
|
+
X as Lightbox
|
|
166
|
+
};
|
|
@@ -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,53 +1,68 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import v from "classnames";
|
|
3
3
|
import { cssProps as p, getErrorMessage as y } from "../../utils/helpers.js";
|
|
4
|
-
import { Icon as
|
|
5
|
-
const
|
|
6
|
-
container:
|
|
7
|
-
content:
|
|
8
|
-
message:
|
|
9
|
-
accessory:
|
|
10
|
-
info:
|
|
11
|
-
error:
|
|
12
|
-
success:
|
|
13
|
-
warning:
|
|
14
|
-
neutral:
|
|
15
|
-
vertical:
|
|
16
|
-
plain:
|
|
17
|
-
},
|
|
18
|
-
info:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
4
|
+
import { Icon as b } from "../Icon/Icon.js";
|
|
5
|
+
const w = "Notice_container_d9QoU", h = "Notice_content_cvC5c", k = "Notice_message_hI1yz", z = "Notice_accessory_AjvqC", I = "Notice_info_tgW7c", j = "Notice_error_ClIfR", x = "Notice_success_-vXfu", C = "Notice_warning_zFUFN", F = "Notice_neutral_Vryzr", M = "Notice_vertical_DsMZQ", Q = "Notice_plain_l9FV5", c = {
|
|
6
|
+
container: w,
|
|
7
|
+
content: h,
|
|
8
|
+
message: k,
|
|
9
|
+
accessory: z,
|
|
10
|
+
info: I,
|
|
11
|
+
error: j,
|
|
12
|
+
success: x,
|
|
13
|
+
warning: C,
|
|
14
|
+
neutral: F,
|
|
15
|
+
vertical: M,
|
|
16
|
+
plain: Q
|
|
17
|
+
}, o = {
|
|
18
|
+
info: {
|
|
19
|
+
name: "info-circle",
|
|
20
|
+
label: "info icon"
|
|
21
|
+
},
|
|
22
|
+
warning: {
|
|
23
|
+
name: "warning",
|
|
24
|
+
label: "warning icon"
|
|
25
|
+
},
|
|
26
|
+
error: {
|
|
27
|
+
name: "error-circle",
|
|
28
|
+
label: "error icon"
|
|
29
|
+
},
|
|
30
|
+
success: {
|
|
31
|
+
name: "checkmark-circle",
|
|
32
|
+
label: "checkmark icon"
|
|
33
|
+
},
|
|
34
|
+
neutral: {
|
|
35
|
+
name: "info-outline",
|
|
36
|
+
label: "info icon"
|
|
37
|
+
}
|
|
38
|
+
}, U = (e) => o[e] && /* @__PURE__ */ t(b, { name: o[e].name, "aria-label": o[e].label }), E = ({
|
|
39
|
+
error: e,
|
|
40
|
+
scheme: n = e ? "error" : "neutral",
|
|
41
|
+
layout: a = "horizontal",
|
|
27
42
|
variant: l = "default",
|
|
28
|
-
size:
|
|
29
|
-
icon:
|
|
30
|
-
accessory:
|
|
31
|
-
margin:
|
|
32
|
-
padding:
|
|
33
|
-
className:
|
|
34
|
-
style:
|
|
35
|
-
children:
|
|
36
|
-
...
|
|
37
|
-
}) => /* @__PURE__ */
|
|
43
|
+
size: m,
|
|
44
|
+
icon: r,
|
|
45
|
+
accessory: i,
|
|
46
|
+
margin: _,
|
|
47
|
+
padding: N,
|
|
48
|
+
className: d,
|
|
49
|
+
style: f,
|
|
50
|
+
children: g,
|
|
51
|
+
...u
|
|
52
|
+
}) => /* @__PURE__ */ s(
|
|
38
53
|
"div",
|
|
39
54
|
{
|
|
40
|
-
...
|
|
41
|
-
"data-notice":
|
|
42
|
-
"data-layout":
|
|
43
|
-
className: v(c.container, c[
|
|
44
|
-
style: { ...
|
|
55
|
+
...u,
|
|
56
|
+
"data-notice": n,
|
|
57
|
+
"data-layout": a,
|
|
58
|
+
className: v(c.container, c[n], c[a], c[l], d),
|
|
59
|
+
style: { ...f, ...p({ size: m, margin: _, padding: N }) },
|
|
45
60
|
children: [
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ s("div", { "data-notice-content": !0, className: c.content, children: [
|
|
62
|
+
r !== void 0 ? r : U(n),
|
|
63
|
+
/* @__PURE__ */ t("div", { "data-notice-message": !0, className: c.message, children: e ? y(e) : g })
|
|
49
64
|
] }),
|
|
50
|
-
|
|
65
|
+
i && /* @__PURE__ */ t("div", { "data-notice-accessory": !0, className: c.accessory, children: i })
|
|
51
66
|
]
|
|
52
67
|
}
|
|
53
68
|
);
|