@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.
Files changed (48) hide show
  1. package/dist/Thumbnails-BlXFynlF.js +38 -0
  2. package/dist/components/Avatar/Avatar.js +15 -15
  3. package/dist/components/Avatar/helpers.js +15 -16
  4. package/dist/components/Badge/Badge.js +28 -29
  5. package/dist/components/Button/Button.d.ts +1 -1
  6. package/dist/components/Dialog/Dialog.js +44 -44
  7. package/dist/components/Dialog/useDialog.d.ts +9 -6
  8. package/dist/components/Dialog/useDialog.js +20 -28
  9. package/dist/components/Fields/Checkbox.js +15 -15
  10. package/dist/components/Fields/Numeric.js +34 -36
  11. package/dist/components/Fields/Range.d.ts +1 -1
  12. package/dist/components/Fields/Range.js +33 -33
  13. package/dist/components/Flex/Flex.d.ts +1 -1
  14. package/dist/components/Gallery/Gallery.d.ts +11 -0
  15. package/dist/components/Gallery/Gallery.js +49 -0
  16. package/dist/components/Gallery/GalleryItem.d.ts +12 -0
  17. package/dist/components/Gallery/GalleryItem.js +41 -0
  18. package/dist/components/Gallery/index.d.ts +2 -0
  19. package/dist/components/Gallery/index.js +6 -0
  20. package/dist/components/Icon/Icon.js +125 -122
  21. package/dist/components/Icon/icons.d.ts +1 -1
  22. package/dist/components/Icon/icons.js +4 -0
  23. package/dist/components/Lightbox/Lightbox.d.ts +12 -0
  24. package/dist/components/Lightbox/Lightbox.js +166 -0
  25. package/dist/components/Lightbox/Thumbnail.d.ts +7 -0
  26. package/dist/components/Lightbox/Thumbnail.js +26 -0
  27. package/dist/components/Lightbox/Thumbnails.d.ts +11 -0
  28. package/dist/components/Lightbox/Thumbnails.js +8 -0
  29. package/dist/components/Lightbox/index.d.ts +1 -0
  30. package/dist/components/Lightbox/index.js +4 -0
  31. package/dist/components/Menu/Menu.js +44 -45
  32. package/dist/components/Menu/MenuItem.js +33 -33
  33. package/dist/components/Notice/Notice.js +58 -43
  34. package/dist/components/Popover/Popover.js +40 -41
  35. package/dist/components/Progress/ProgressBar.js +14 -14
  36. package/dist/components/Progress/ProgressCircular.js +15 -15
  37. package/dist/components/Segmented/Segmented.js +43 -47
  38. package/dist/components/Tag/Tag.d.ts +1 -1
  39. package/dist/components/ToggleButton/ToggleButton.d.ts +1 -1
  40. package/dist/components/ToggleButton/ToggleGroup.js +42 -40
  41. package/dist/components/Tooltip/Tooltip.js +30 -31
  42. package/dist/index.d.ts +3 -1
  43. package/dist/index.js +71 -63
  44. package/dist/styles/style.css +1 -1
  45. package/dist/styles.module-D0C-vMZX.js +7 -0
  46. package/dist/utils/helpers.d.ts +3 -1
  47. package/dist/utils/helpers.js +30 -19
  48. 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,8 @@
1
+ import "react/jsx-runtime";
2
+ import "classnames";
3
+ import "./Thumbnail.js";
4
+ import "../../utils/helpers.js";
5
+ import { T as a } from "../../Thumbnails-BlXFynlF.js";
6
+ export {
7
+ a as Thumbnails
8
+ };
@@ -0,0 +1 @@
1
+ export * from './Lightbox';
@@ -0,0 +1,4 @@
1
+ import { Lightbox as t } from "./Lightbox.js";
2
+ export {
3
+ t as Lightbox
4
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsxs as O, Fragment as W, jsx as t } from "react/jsx-runtime";
2
- import _, { useState as l, useRef as g, useMemo as k, useEffect as A } from "react";
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: h,
11
- placement: c = "bottom-start",
12
- trigger: s,
13
- offset: R = 5,
14
- unmount: v = !0,
15
- minWidth: x,
16
- maxWidth: F,
17
- minHeight: y,
18
- maxHeight: M,
19
- className: P,
20
- children: z,
21
- onSelect: m,
22
- ...w
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 [r, u] = l(!1), [i, C] = l(null), [E, I] = l({}), f = g([]), d = g(null), { refs: o, context: e, floatingStyles: N } = H({
25
- open: r,
26
- placement: c,
27
- onOpenChange: u,
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(R),
30
+ U(h),
31
31
  q({ padding: 10 }),
32
32
  G({
33
33
  padding: 10,
34
- apply({ rects: a, availableWidth: n, availableHeight: L }) {
34
+ apply({ rects: i, availableWidth: B, availableHeight: L }) {
35
35
  D(() => {
36
- I({
37
- minHeight: y,
38
- minWidth: x ?? a.reference.width,
39
- maxWidth: F ?? n,
40
- maxHeight: M ?? L
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: S, getFloatingProps: b, getItemProps: p } = K([
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: f,
51
+ listRef: u,
52
52
  loop: !0,
53
- activeIndex: i,
54
- onNavigate: C
53
+ activeIndex: r,
54
+ onNavigate: w
55
55
  })
56
- ]), j = k(
57
- () => ({ active: i, setOpen: u, getItemProps: p, onSelect: m }),
58
- [i, p, m]
59
- ), B = Y([o.setReference, ne(s)]);
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
- var n;
62
- const a = (n = o.domReference.current) == null ? void 0 : n.closest("[data-floating-root]");
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
- s,
67
- S({ ...s.props, ref: B, "data-menu-trigger": !0 })
65
+ n,
66
+ N({ ...n.props, ref: j, "data-menu-trigger": !0 })
68
67
  ),
69
- /* @__PURE__ */ t(oe.Provider, { value: j, children: (r || !v) && /* @__PURE__ */ t(Z, { root: d.current, children: /* @__PURE__ */ t($, { context: e, modal: !1, initialFocus: -1, children: /* @__PURE__ */ t(
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
- ...b(w),
71
+ ...S(z),
73
72
  ref: o.setFloating,
74
- "data-open": r,
75
- "data-menu": c,
76
- className: te(re.menu, P),
77
- style: { ...N, ...E, ...se({ size: h }) },
78
- children: /* @__PURE__ */ t(ee, { elementsRef: f, children: z })
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 u, jsxs as y, Fragment as M } from "react/jsx-runtime";
2
- import { useContext as N, useCallback as w } from "react";
3
- import { useListItem as A } from "@floating-ui/react";
4
- import E from "classnames";
5
- import { MenuContext as F } from "./MenuContext.js";
6
- import { wrapNode as d } from "../../utils/helpers.js";
7
- import { s as f } from "../../styles.module-DHm-YTnz.js";
8
- const C = ({
9
- as: o,
10
- scheme: c = "default",
11
- icon: r,
12
- title: a,
13
- selected: s,
14
- children: n,
15
- className: l,
16
- onClick: t,
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: i, getItemProps: v, onSelect: e } = N(F), { ref: I, index: m } = A(), p = m === b, g = o ?? "button", h = w(
20
- (j) => {
21
- i(!1), e == null || e(m), t == null || t(j);
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
- [m, i, e, t]
23
+ [t, s, i, a]
24
24
  );
25
- return /* @__PURE__ */ u(
26
- g,
25
+ return /* @__PURE__ */ p(
26
+ C,
27
27
  {
28
28
  ...x,
29
- ref: I,
29
+ ref: k,
30
30
  role: "menuitem",
31
31
  "data-menu-item": !0,
32
- "data-active": p || s,
33
- "data-selected": s,
34
- tabIndex: p ? 0 : -1,
35
- type: o ? void 0 : "button",
36
- className: E(f.menuitem, f[c], l),
37
- ...v({ onClick: h }),
38
- children: n ? d(n, "span") : /* @__PURE__ */ y(M, { children: [
39
- r === "blank" ? /* @__PURE__ */ u("div", { "data-icon-blank": !0 }) : r,
40
- a !== void 0 && d(a, "span")
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
- C as MenuItem
46
+ z as MenuItem
47
47
  };
@@ -1,53 +1,68 @@
1
- import { jsxs as i, jsx as o } from "react/jsx-runtime";
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 w } from "../Icon/Icon.js";
5
- const h = "Notice_container_d9QoU", z = "Notice_content_cvC5c", j = "Notice_message_hI1yz", x = "Notice_accessory_AjvqC", C = "Notice_info_tgW7c", F = "Notice_error_ClIfR", I = "Notice_success_-vXfu", k = "Notice_warning_zFUFN", M = "Notice_neutral_Vryzr", Q = "Notice_vertical_DsMZQ", U = "Notice_plain_l9FV5", c = {
6
- container: h,
7
- content: z,
8
- message: j,
9
- accessory: x,
10
- info: C,
11
- error: F,
12
- success: I,
13
- warning: k,
14
- neutral: M,
15
- vertical: Q,
16
- plain: U
17
- }, a = {
18
- info: "info-circle",
19
- warning: "warning",
20
- error: "error-circle",
21
- success: "checkmark-circle",
22
- neutral: "info-outline"
23
- }, E = ({
24
- error: t,
25
- scheme: e = t ? "error" : "neutral",
26
- layout: n = "horizontal",
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: s,
30
- accessory: r,
31
- margin: N,
32
- padding: d,
33
- className: m,
34
- style: u,
35
- children: f,
36
- ...g
37
- }) => /* @__PURE__ */ i(
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
- ...g,
41
- "data-notice": e,
42
- "data-layout": n,
43
- className: v(c.container, c[e], c[n], c[l], m),
44
- style: { ...u, ...p({ size: _, margin: N, padding: d }) },
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__ */ i("div", { "data-notice-content": !0, className: c.content, children: [
47
- s !== void 0 ? s : a[e] && /* @__PURE__ */ o(w, { name: a[e] }),
48
- /* @__PURE__ */ o("div", { "data-notice-message": !0, className: c.message, children: t ? y(t) : f })
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
- r && /* @__PURE__ */ o("div", { "data-notice-accessory": !0, className: c.accessory, children: r })
65
+ i && /* @__PURE__ */ t("div", { "data-notice-accessory": !0, className: c.accessory, children: i })
51
66
  ]
52
67
  }
53
68
  );