@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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import a from "classnames";
|
|
3
|
+
import { Thumbnail as g } from "./components/Lightbox/Thumbnail.js";
|
|
4
|
+
import { cssProps as u, htmlImage as _ } from "./utils/helpers.js";
|
|
5
|
+
const x = "Lightbox_lightbox_JQunO", p = "Lightbox_images_WFWsL", L = "Lightbox_thumbnails_jQSPH", f = "Lightbox_willhide_z2lO8", d = "Lightbox_content_UfCvB", v = "Lightbox_prev_qIKJt", T = "Lightbox_next_qZR61", j = "Lightbox_close_SgBu9", w = {
|
|
6
|
+
lightbox: x,
|
|
7
|
+
images: p,
|
|
8
|
+
thumbnails: L,
|
|
9
|
+
willhide: f,
|
|
10
|
+
content: d,
|
|
11
|
+
prev: v,
|
|
12
|
+
next: T,
|
|
13
|
+
close: j
|
|
14
|
+
}, F = ({
|
|
15
|
+
images: o,
|
|
16
|
+
selected: i,
|
|
17
|
+
className: n,
|
|
18
|
+
style: e,
|
|
19
|
+
imageSize: h,
|
|
20
|
+
objectFit: c,
|
|
21
|
+
renderImage: b = _,
|
|
22
|
+
onSelect: m,
|
|
23
|
+
...r
|
|
24
|
+
}) => o.length <= 1 ? null : /* @__PURE__ */ s(
|
|
25
|
+
"ul",
|
|
26
|
+
{
|
|
27
|
+
...r,
|
|
28
|
+
role: "listbox",
|
|
29
|
+
"data-lightbox-thumbnails": !0,
|
|
30
|
+
className: a(w.thumbnails, n),
|
|
31
|
+
style: { ...e, ...u({ thumbnailSize: h, thumbnailObjectFit: c }) },
|
|
32
|
+
children: o.map((l, t) => /* @__PURE__ */ s(g, { index: t, selected: t === i, onSelect: m, children: b({ ...l, alt: l.alt ?? `Thumbnail ${t + 1}` }) }, t))
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
export {
|
|
36
|
+
F as T,
|
|
37
|
+
w as s
|
|
38
|
+
};
|
|
@@ -4,47 +4,47 @@ import * as m from "react";
|
|
|
4
4
|
import { forwardRef as S, useMemo as x, useState as A, useEffect as N, useCallback as E } from "react";
|
|
5
5
|
import { cssProps as C } from "../../utils/helpers.js";
|
|
6
6
|
import { getStringColor as k, getGravatarUri as M, getInitials as R } from "./helpers.js";
|
|
7
|
-
const b = (a,
|
|
7
|
+
const b = (a, e) => /* @__PURE__ */ m.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 50 50", ref: e, ...a }, /* @__PURE__ */ m.createElement("path", { fill: "currentColor", d: "M25 31c4.97 0 9-4.253 9-9.5S29.97 12 25 12s-9 4.253-9 9.5 4.03 9.5 9 9.5Zm19 19c0-8.837-8.507-15-19-15S6 41.163 6 50h38Z" })), j = S(b), y = "Avatar_avatar_PNlL5", I = "Avatar_image_Jwmxk", P = "Avatar_initials_i0r2T", r = {
|
|
8
8
|
avatar: y,
|
|
9
9
|
image: I,
|
|
10
10
|
initials: P,
|
|
11
11
|
default: "Avatar_default_v75Mg"
|
|
12
12
|
}, J = ({
|
|
13
13
|
size: a = 50,
|
|
14
|
-
name:
|
|
14
|
+
name: e,
|
|
15
15
|
email: o,
|
|
16
|
-
src:
|
|
16
|
+
src: n,
|
|
17
17
|
colorize: v,
|
|
18
18
|
className: d,
|
|
19
19
|
style: u,
|
|
20
20
|
children: g,
|
|
21
21
|
...f
|
|
22
22
|
}) => {
|
|
23
|
-
const
|
|
23
|
+
const t = e?.trim(), p = v && t ? k(t) : void 0, s = x(() => n || (o ? M(a, o) : void 0), [n, a, o]), [c, l] = A(s);
|
|
24
24
|
N(() => {
|
|
25
|
-
|
|
25
|
+
l(s);
|
|
26
26
|
}, [s]);
|
|
27
27
|
const w = E(() => {
|
|
28
|
-
|
|
28
|
+
l(void 0);
|
|
29
29
|
}, []);
|
|
30
30
|
return /* @__PURE__ */ _(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
33
33
|
...f,
|
|
34
34
|
"data-avatar": !0,
|
|
35
|
-
className: h(
|
|
35
|
+
className: h(r.avatar, d),
|
|
36
36
|
style: { ...u, ...C({ size: a, backgroundColor: p }) },
|
|
37
37
|
children: [
|
|
38
|
-
|
|
38
|
+
c ? /* @__PURE__ */ i(
|
|
39
39
|
"img",
|
|
40
40
|
{
|
|
41
41
|
"data-avatar-image": !0,
|
|
42
|
-
className:
|
|
43
|
-
src:
|
|
44
|
-
alt:
|
|
42
|
+
className: r.image,
|
|
43
|
+
src: c,
|
|
44
|
+
alt: t ?? "",
|
|
45
45
|
onError: w
|
|
46
46
|
}
|
|
47
|
-
) :
|
|
47
|
+
) : t ? /* @__PURE__ */ i("span", { "data-avatar-initials": !0, className: r.initials, children: R(t) }) : /* @__PURE__ */ i(j, { "aria-hidden": !0, "data-avatar-default": !0, className: r.default }),
|
|
48
48
|
g
|
|
49
49
|
]
|
|
50
50
|
}
|
|
@@ -2,64 +2,63 @@ import { jsx as h } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef as _, useLayoutEffect as w, useEffect as l } from "react";
|
|
3
3
|
import E from "classnames";
|
|
4
4
|
import { wrapNode as P, cssProps as H } from "../../utils/helpers.js";
|
|
5
|
-
const M = "Badge_badge_-mEE7", k = "Badge_appear_LbxbS", x = "Badge_accent_BIYve", L = "Badge_gray_7jA-J",
|
|
5
|
+
const M = "Badge_badge_-mEE7", k = "Badge_appear_LbxbS", x = "Badge_accent_BIYve", L = "Badge_gray_7jA-J", v = "Badge_brown_x1GS7", I = "Badge_red_zPgCR", R = "Badge_orange_EoLmF", S = "Badge_yellow_qvbb6", X = "Badge_green_XX-1c", j = "Badge_teal_VHoFK", C = "Badge_cyan_1ksBn", F = "Badge_blue_YulfT", K = "Badge_indigo_2KXUy", N = "Badge_purple_o55fQ", O = "Badge_pink_T5H--", d = {
|
|
6
6
|
badge: M,
|
|
7
7
|
appear: k,
|
|
8
8
|
accent: x,
|
|
9
9
|
gray: L,
|
|
10
|
-
brown:
|
|
11
|
-
red:
|
|
12
|
-
orange:
|
|
13
|
-
yellow:
|
|
14
|
-
green:
|
|
15
|
-
teal:
|
|
10
|
+
brown: v,
|
|
11
|
+
red: I,
|
|
12
|
+
orange: R,
|
|
13
|
+
yellow: S,
|
|
14
|
+
green: X,
|
|
15
|
+
teal: j,
|
|
16
16
|
cyan: C,
|
|
17
17
|
blue: F,
|
|
18
18
|
indigo: K,
|
|
19
19
|
purple: N,
|
|
20
20
|
pink: O
|
|
21
21
|
};
|
|
22
|
-
function T(
|
|
23
|
-
const n = _();
|
|
22
|
+
function T(o) {
|
|
23
|
+
const n = _(void 0);
|
|
24
24
|
return l(() => {
|
|
25
|
-
n.current =
|
|
25
|
+
n.current = o;
|
|
26
26
|
}), n.current;
|
|
27
27
|
}
|
|
28
28
|
const A = ({
|
|
29
|
-
size:
|
|
29
|
+
size: o,
|
|
30
30
|
scheme: n = "red",
|
|
31
|
-
placement:
|
|
32
|
-
value:
|
|
33
|
-
maxValue:
|
|
31
|
+
placement: a = "top-right",
|
|
32
|
+
value: r,
|
|
33
|
+
maxValue: s = 99,
|
|
34
34
|
className: u,
|
|
35
35
|
style: f,
|
|
36
36
|
...y
|
|
37
37
|
}) => {
|
|
38
|
-
const e = !
|
|
38
|
+
const e = !r, g = T(e), t = _(null);
|
|
39
39
|
if (w(() => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
) : 0, b = i * (1 - Math.sin(45 * Math.PI / 180)), m = (1 + Math.min(i / r, 1)) * (r / 4);
|
|
40
|
+
g && !e && t.current?.classList.add(d.appear);
|
|
41
|
+
}, [g, e]), l(() => {
|
|
42
|
+
if (!e && a && t.current) {
|
|
43
|
+
const i = t.current.clientHeight, c = t.current.parentElement, p = c ? Math.min(
|
|
44
|
+
parseInt(getComputedStyle(c).getPropertyValue("border-radius")),
|
|
45
|
+
c.clientHeight / 2
|
|
46
|
+
) : 0, b = p * (1 - Math.sin(45 * Math.PI / 180)), m = (1 + Math.min(p / i, 1)) * (i / 4);
|
|
48
47
|
t.current.style.setProperty("--offset", `${b - m}px`);
|
|
49
48
|
}
|
|
50
|
-
}, [e,
|
|
49
|
+
}, [e, a]), e)
|
|
51
50
|
return null;
|
|
52
|
-
const B = typeof
|
|
51
|
+
const B = typeof r == "number" && s > 0 && r > s;
|
|
53
52
|
return /* @__PURE__ */ h(
|
|
54
53
|
"div",
|
|
55
54
|
{
|
|
56
55
|
...y,
|
|
57
56
|
ref: t,
|
|
58
57
|
"data-badge": n,
|
|
59
|
-
"data-placement":
|
|
60
|
-
className: E(
|
|
61
|
-
style: { ...f, ...H({ size:
|
|
62
|
-
children: P(B ? `${
|
|
58
|
+
"data-placement": a,
|
|
59
|
+
className: E(d.badge, d[n], u),
|
|
60
|
+
style: { ...f, ...H({ size: o }) },
|
|
61
|
+
children: P(B ? `${s}+` : r, "span")
|
|
63
62
|
}
|
|
64
63
|
);
|
|
65
64
|
};
|
|
@@ -23,4 +23,4 @@ export declare const Button: <T extends React.ElementType = "button">(props: {
|
|
|
23
23
|
title?: React.ReactNode;
|
|
24
24
|
icon?: React.ReactElement;
|
|
25
25
|
iconPosition?: "start" | "end";
|
|
26
|
-
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "title" | "
|
|
26
|
+
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "title" | "as" | "size" | "icon" | "scheme" | "minWidth" | "maxWidth" | "variant" | "busy" | "iconPosition"> & React.RefAttributes<unknown>) => React.ReactElement | null;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import h, { useState as x, useLayoutEffect as m, useContext as
|
|
2
|
+
import h, { useState as x, useLayoutEffect as m, useContext as p } from "react";
|
|
3
3
|
import s from "classnames";
|
|
4
|
-
import { useFloating as N, useInteractions as
|
|
5
|
-
import { cssProps as
|
|
6
|
-
import { DialogContext as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Heading as
|
|
9
|
-
import { Icon as
|
|
10
|
-
const
|
|
11
|
-
overlay:
|
|
12
|
-
dialog:
|
|
13
|
-
title:
|
|
4
|
+
import { useFloating as N, useInteractions as P, useDismiss as L, useRole as E, useMergeRefs as S, FloatingPortal as k, FloatingOverlay as M, FloatingFocusManager as O, useId as Q } from "@floating-ui/react";
|
|
5
|
+
import { cssProps as j } from "../../utils/helpers.js";
|
|
6
|
+
import { DialogContext as c } from "./DialogContext.js";
|
|
7
|
+
import { Button as q } from "../Button/Button.js";
|
|
8
|
+
import { Heading as w } from "../Heading/Heading.js";
|
|
9
|
+
import { Icon as B } from "../Icon/Icon.js";
|
|
10
|
+
const G = "Dialog_overlay_C98Qt", H = "Dialog_dialog_G3gxL", J = "Dialog_title_2pDPQ", V = "Dialog_footer_N-aEV", z = "Dialog_close_JSEkn", i = {
|
|
11
|
+
overlay: G,
|
|
12
|
+
dialog: H,
|
|
13
|
+
title: J,
|
|
14
14
|
footer: V,
|
|
15
15
|
close: z
|
|
16
16
|
}, oo = h.forwardRef(
|
|
@@ -19,73 +19,73 @@ const H = "Dialog_overlay_C98Qt", J = "Dialog_dialog_G3gxL", P = "Dialog_title_2
|
|
|
19
19
|
size: e,
|
|
20
20
|
width: a,
|
|
21
21
|
lockScroll: l = !0,
|
|
22
|
-
style:
|
|
23
|
-
className:
|
|
24
|
-
children:
|
|
25
|
-
setTriggerProps:
|
|
26
|
-
requestClose:
|
|
27
|
-
...
|
|
28
|
-
},
|
|
29
|
-
const [
|
|
22
|
+
style: r,
|
|
23
|
+
className: y,
|
|
24
|
+
children: v,
|
|
25
|
+
setTriggerProps: d,
|
|
26
|
+
requestClose: g,
|
|
27
|
+
...D
|
|
28
|
+
}, _) => {
|
|
29
|
+
const [u, b] = x(), { refs: F, context: n } = N({
|
|
30
30
|
open: o,
|
|
31
|
-
onOpenChange:
|
|
32
|
-
}), { getFloatingProps: C, getReferenceProps:
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
onOpenChange: g
|
|
32
|
+
}), { getFloatingProps: C, getReferenceProps: f } = P([
|
|
33
|
+
L(n),
|
|
34
|
+
E(n, { role: "dialog" })
|
|
35
35
|
]);
|
|
36
36
|
m(() => {
|
|
37
|
-
|
|
38
|
-
}, [
|
|
39
|
-
const I =
|
|
40
|
-
return o ? /* @__PURE__ */ t(
|
|
41
|
-
|
|
37
|
+
d?.(f());
|
|
38
|
+
}, [d, f]);
|
|
39
|
+
const I = S([F.setFloating, _]), R = document.querySelector("[data-floating-root]") ?? document.body;
|
|
40
|
+
return o ? /* @__PURE__ */ t(c.Provider, { value: { labelId: u, setLabelId: b, requestClose: g }, children: /* @__PURE__ */ t(k, { root: R, children: /* @__PURE__ */ t(
|
|
41
|
+
M,
|
|
42
42
|
{
|
|
43
43
|
"data-floating-root": !0,
|
|
44
44
|
"data-dialog-overlay": !0,
|
|
45
45
|
lockScroll: l,
|
|
46
|
-
className:
|
|
47
|
-
children: /* @__PURE__ */ t(
|
|
46
|
+
className: i.overlay,
|
|
47
|
+
children: /* @__PURE__ */ t(O, { context: n, children: /* @__PURE__ */ t(
|
|
48
48
|
"div",
|
|
49
49
|
{
|
|
50
|
-
...C(
|
|
50
|
+
...C(D),
|
|
51
51
|
ref: I,
|
|
52
52
|
"data-dialog": !0,
|
|
53
53
|
"data-open": o,
|
|
54
|
-
"aria-labelledby":
|
|
55
|
-
className: s(
|
|
56
|
-
style: { ...
|
|
57
|
-
children:
|
|
54
|
+
"aria-labelledby": u,
|
|
55
|
+
className: s(i.dialog, y),
|
|
56
|
+
style: { ...r, ...j({ size: e, width: a }) },
|
|
57
|
+
children: v
|
|
58
58
|
}
|
|
59
59
|
) })
|
|
60
60
|
}
|
|
61
61
|
) }) }) : null;
|
|
62
62
|
}
|
|
63
63
|
), to = ({ className: o, children: e, ...a }) => {
|
|
64
|
-
const l =
|
|
65
|
-
return m(() => (
|
|
66
|
-
|
|
64
|
+
const l = Q(), { setLabelId: r } = p(c);
|
|
65
|
+
return m(() => (r(l), () => r(void 0)), [l, r]), /* @__PURE__ */ t(
|
|
66
|
+
w,
|
|
67
67
|
{
|
|
68
68
|
as: "h4",
|
|
69
69
|
...a,
|
|
70
70
|
id: l,
|
|
71
71
|
"data-dialog-title": !0,
|
|
72
72
|
title: e,
|
|
73
|
-
className: s(
|
|
73
|
+
className: s(i.title, o)
|
|
74
74
|
}
|
|
75
75
|
);
|
|
76
|
-
}, eo = (o) => /* @__PURE__ */ t("div", { ...o, "data-dialog-content": !0 }), ao = ({ className: o, ...e }) => /* @__PURE__ */ t("div", { ...e, "data-dialog-footer": !0, className: s(
|
|
77
|
-
const { requestClose: a } =
|
|
76
|
+
}, eo = (o) => /* @__PURE__ */ t("div", { ...o, "data-dialog-content": !0 }), ao = ({ className: o, ...e }) => /* @__PURE__ */ t("div", { ...e, "data-dialog-footer": !0, className: s(i.footer, o) }), lo = ({ className: o, ...e }) => {
|
|
77
|
+
const { requestClose: a } = p(c);
|
|
78
78
|
return /* @__PURE__ */ t(
|
|
79
|
-
|
|
79
|
+
q,
|
|
80
80
|
{
|
|
81
81
|
type: "button",
|
|
82
82
|
variant: "tertiary",
|
|
83
83
|
"aria-label": "close dialog",
|
|
84
|
-
icon: /* @__PURE__ */ t(
|
|
84
|
+
icon: /* @__PURE__ */ t(B, { name: "close" }),
|
|
85
85
|
onClick: a,
|
|
86
86
|
...e,
|
|
87
87
|
"data-dialog-close": !0,
|
|
88
|
-
className: s(
|
|
88
|
+
className: s(i.close, o)
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
91
|
};
|
|
@@ -7,7 +7,7 @@ export type DialogOptions<T, R> = {
|
|
|
7
7
|
export type DialogType<T, R> = ReturnType<typeof useDialog<T, R>>;
|
|
8
8
|
export declare function useDialog<T, R>(options?: DialogOptions<T, R>): {
|
|
9
9
|
props: {
|
|
10
|
-
ref: import('react').RefObject<HTMLDivElement>;
|
|
10
|
+
ref: import('react').RefObject<HTMLDivElement | null>;
|
|
11
11
|
open: boolean;
|
|
12
12
|
setTriggerProps: import('react').Dispatch<import('react').SetStateAction<{}>>;
|
|
13
13
|
requestClose: () => void;
|
|
@@ -1,40 +1,32 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const g = o((e) => {
|
|
12
|
-
var n, s;
|
|
13
|
-
t.current || (p(!0), d(e), (s = (n = c.current) == null ? void 0 : n.onShow) == null || s.call(n, e));
|
|
14
|
-
}, []), u = o((e) => {
|
|
15
|
-
var n;
|
|
16
|
-
t.current || (t.current = !0, (n = a.current) == null || n.setAttribute("data-open", "false"), T(a.current, () => {
|
|
17
|
-
var s, C, i, y;
|
|
18
|
-
e !== void 0 ? (C = (s = c.current) == null ? void 0 : s.onConfirm) == null || C.call(s, e) : (y = (i = c.current) == null ? void 0 : i.onCancel) == null || y.call(i), p(!1), d(void 0), t.current = !1;
|
|
1
|
+
import { useRef as u, useState as a, useCallback as t } from "react";
|
|
2
|
+
import { afterTransition as y } from "../../utils/helpers.js";
|
|
3
|
+
function h(s) {
|
|
4
|
+
const c = u(null), n = u(s), r = u(!1), [g, d] = a({}), [m, f] = a(s?.defaultOpen ?? !1), [C, i] = a();
|
|
5
|
+
n.current = s;
|
|
6
|
+
const l = t((e) => {
|
|
7
|
+
r.current || (f(!0), i(e), n.current?.onShow?.(e));
|
|
8
|
+
}, []), o = t((e) => {
|
|
9
|
+
r.current || (r.current = !0, c.current?.setAttribute("data-open", "false"), y(c.current, () => {
|
|
10
|
+
e !== void 0 ? n.current?.onConfirm?.(e) : n.current?.onCancel?.(), f(!1), i(void 0), r.current = !1;
|
|
19
11
|
}));
|
|
20
|
-
}, []),
|
|
21
|
-
|
|
12
|
+
}, []), p = t(() => o(), [o]), b = t((e) => o(e), [o]), w = t(async (e) => {
|
|
13
|
+
r.current = !0;
|
|
22
14
|
try {
|
|
23
15
|
return await e;
|
|
24
16
|
} finally {
|
|
25
|
-
|
|
17
|
+
r.current = !1;
|
|
26
18
|
}
|
|
27
19
|
}, []);
|
|
28
20
|
return {
|
|
29
|
-
props: { ref:
|
|
30
|
-
trigger: { ...
|
|
31
|
-
data:
|
|
32
|
-
show:
|
|
33
|
-
cancel:
|
|
34
|
-
confirm:
|
|
35
|
-
preventClose:
|
|
21
|
+
props: { ref: c, open: m, setTriggerProps: d, requestClose: p },
|
|
22
|
+
trigger: { ...g, onClick: l },
|
|
23
|
+
data: C,
|
|
24
|
+
show: l,
|
|
25
|
+
cancel: p,
|
|
26
|
+
confirm: b,
|
|
27
|
+
preventClose: w
|
|
36
28
|
};
|
|
37
29
|
}
|
|
38
30
|
export {
|
|
39
|
-
|
|
31
|
+
h as useDialog
|
|
40
32
|
};
|
|
@@ -1,56 +1,54 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { Button as
|
|
1
|
+
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import b from "classnames";
|
|
3
|
+
import f, { useRef as y, useImperativeHandle as _, useCallback as a } from "react";
|
|
4
|
+
import { Icon as c } from "../Icon/Icon.js";
|
|
5
|
+
import { Button as s } from "../Button/Button.js";
|
|
6
6
|
import "../../utils/helpers.js";
|
|
7
|
-
import { I as
|
|
8
|
-
const
|
|
9
|
-
numeric:
|
|
10
|
-
increase:
|
|
11
|
-
decrease:
|
|
12
|
-
},
|
|
13
|
-
({ labelIncrease:
|
|
14
|
-
const e =
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var r, t;
|
|
21
|
-
(r = e.current) == null || r.stepDown(), (t = e.current) == null || t.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
7
|
+
import { I as h } from "../../Input-BG84zXZH.js";
|
|
8
|
+
const v = "styles_numeric_dzUSE", w = "styles_increase_5S-Jo", E = "styles_decrease_j8UR6", t = {
|
|
9
|
+
numeric: v,
|
|
10
|
+
increase: w,
|
|
11
|
+
decrease: E
|
|
12
|
+
}, k = f.forwardRef(
|
|
13
|
+
({ labelIncrease: i = "increase", labelDecrease: o = "decrease", className: l, ...n }, d) => {
|
|
14
|
+
const e = y(null);
|
|
15
|
+
_(d, () => e.current);
|
|
16
|
+
const u = a(() => {
|
|
17
|
+
e.current?.stepUp(), e.current?.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
18
|
+
}, []), m = a(() => {
|
|
19
|
+
e.current?.stepDown(), e.current?.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
22
20
|
}, []);
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
21
|
+
return /* @__PURE__ */ p(
|
|
22
|
+
h,
|
|
25
23
|
{
|
|
26
24
|
...n,
|
|
27
25
|
ref: e,
|
|
28
26
|
type: "number",
|
|
29
27
|
wrapperType: "numeric",
|
|
30
|
-
className:
|
|
28
|
+
className: b(t.numeric, l),
|
|
31
29
|
children: [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
30
|
+
/* @__PURE__ */ r(
|
|
31
|
+
s,
|
|
34
32
|
{
|
|
35
33
|
type: "button",
|
|
36
34
|
variant: "secondary",
|
|
37
|
-
"aria-label":
|
|
35
|
+
"aria-label": i,
|
|
38
36
|
disabled: n.disabled || n.readOnly,
|
|
39
|
-
className:
|
|
40
|
-
icon: /* @__PURE__ */
|
|
41
|
-
onClick:
|
|
37
|
+
className: t.increase,
|
|
38
|
+
icon: /* @__PURE__ */ r(c, { name: "triangle-up" }),
|
|
39
|
+
onClick: u
|
|
42
40
|
}
|
|
43
41
|
),
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
|
|
42
|
+
/* @__PURE__ */ r(
|
|
43
|
+
s,
|
|
46
44
|
{
|
|
47
45
|
type: "button",
|
|
48
46
|
variant: "secondary",
|
|
49
|
-
"aria-label":
|
|
47
|
+
"aria-label": o,
|
|
50
48
|
disabled: n.disabled || n.readOnly,
|
|
51
|
-
className:
|
|
52
|
-
icon: /* @__PURE__ */
|
|
53
|
-
onClick:
|
|
49
|
+
className: t.decrease,
|
|
50
|
+
icon: /* @__PURE__ */ r(c, { name: "triangle-down" }),
|
|
51
|
+
onClick: m
|
|
54
52
|
}
|
|
55
53
|
)
|
|
56
54
|
]
|
|
@@ -59,5 +57,5 @@ const E = "styles_numeric_dzUSE", R = "styles_increase_5S-Jo", g = "styles_decre
|
|
|
59
57
|
}
|
|
60
58
|
);
|
|
61
59
|
export {
|
|
62
|
-
|
|
60
|
+
k as Numeric
|
|
63
61
|
};
|
|
@@ -10,7 +10,7 @@ export type RangeProps = Omit<BaseInputProps, 'min' | 'max' | 'value' | 'default
|
|
|
10
10
|
defaultValue?: number;
|
|
11
11
|
ticks?: TickMarksProps['ticks'];
|
|
12
12
|
};
|
|
13
|
-
export declare const Range: React.ForwardRefExoticComponent<Omit<BaseInputProps, "
|
|
13
|
+
export declare const Range: React.ForwardRefExoticComponent<Omit<BaseInputProps, "defaultValue" | "value" | "max" | "min"> & {
|
|
14
14
|
min?: number;
|
|
15
15
|
max?: number;
|
|
16
16
|
value?: number;
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import N from "classnames";
|
|
3
3
|
import R, { useRef as x, useState as T, useEffect as j, useCallback as P } from "react";
|
|
4
4
|
import { cssProps as V, wrapNode as A } from "../../utils/helpers.js";
|
|
5
|
-
import { V as
|
|
6
|
-
const
|
|
7
|
-
range:
|
|
8
|
-
range_thumb:
|
|
9
|
-
range_wrapper:
|
|
10
|
-
range_track:
|
|
11
|
-
ticks:
|
|
5
|
+
import { V as C } from "../../ValidationTooltip-N4SQpl9r.js";
|
|
6
|
+
const E = "styles_range_j9iED", J = "styles_range_thumb_6aftN", D = "styles_range_wrapper_LTcAf", F = "styles_range_track_HdlJx", H = "styles_ticks_YaeJb", s = {
|
|
7
|
+
range: E,
|
|
8
|
+
range_thumb: J,
|
|
9
|
+
range_wrapper: D,
|
|
10
|
+
range_track: F,
|
|
11
|
+
ticks: H
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function _(a, r, t, n) {
|
|
14
|
+
a?.style.setProperty("--progress", `${(n - r) / (t - r)}`);
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
},
|
|
20
|
-
({ size:
|
|
21
|
-
const { min: l = 0, max: o = 100, defaultValue: v = 50, value:
|
|
16
|
+
const L = ({ ticks: a }) => {
|
|
17
|
+
const r = typeof a == "number" ? [...Array(a)] : a;
|
|
18
|
+
return r.length < 2 ? null : /* @__PURE__ */ e("ul", { "data-range-ticks": !0, className: s.ticks, children: r.map((t, n) => /* @__PURE__ */ e("li", { children: t !== void 0 && /* @__PURE__ */ e("small", { children: t }) }, n)) });
|
|
19
|
+
}, z = R.forwardRef(
|
|
20
|
+
({ size: a, height: r, error: t, ticks: n, className: f, style: h, children: d, onChange: u, ...c }, y) => {
|
|
21
|
+
const { min: l = 0, max: o = 100, defaultValue: v = 50, value: g = v } = c, i = x(null), [k, b] = T(null);
|
|
22
22
|
j(() => {
|
|
23
|
-
|
|
24
|
-
}, [l, o,
|
|
23
|
+
_(i.current, l, o, g);
|
|
24
|
+
}, [l, o, g]);
|
|
25
25
|
const w = P(
|
|
26
|
-
(
|
|
27
|
-
|
|
26
|
+
(m) => {
|
|
27
|
+
_(i.current, l, o, parseFloat(m.currentTarget.value)), u?.(m);
|
|
28
28
|
},
|
|
29
|
-
[l, o,
|
|
29
|
+
[l, o, u]
|
|
30
30
|
);
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ p(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
34
|
-
ref:
|
|
34
|
+
ref: i,
|
|
35
35
|
"data-range": !0,
|
|
36
|
-
"data-disabled":
|
|
37
|
-
"data-invalid":
|
|
38
|
-
className: N(
|
|
39
|
-
style: { ...
|
|
36
|
+
"data-disabled": c.disabled,
|
|
37
|
+
"data-invalid": t ? !0 : void 0,
|
|
38
|
+
className: N(s.range, f),
|
|
39
|
+
style: { ...h, ...V({ size: a, height: r }) },
|
|
40
40
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ p("div", { "data-range-wrapper": !0, className: s.range_wrapper, children: [
|
|
42
|
+
/* @__PURE__ */ e("div", { "data-range-track": !0, className: s.range_track }),
|
|
43
|
+
/* @__PURE__ */ e("div", { ref: b, "data-range-thumb": !0, className: s.range_thumb, children: d !== void 0 && A(d, "small") }),
|
|
44
|
+
/* @__PURE__ */ e(C, { content: t, placement: "top", anchor: k, children: /* @__PURE__ */ e("input", { ...c, ref: y, type: "range", onChange: w }) })
|
|
45
45
|
] }),
|
|
46
|
-
|
|
46
|
+
n !== void 0 && /* @__PURE__ */ e(L, { ticks: n })
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
z as Range
|
|
54
54
|
};
|
|
@@ -19,4 +19,4 @@ export declare const Flex: <T extends React.ElementType = "div">(props: {
|
|
|
19
19
|
wrap?: React.CSSProperties["flexWrap"];
|
|
20
20
|
marginStart?: React.CSSProperties["marginBlockStart"];
|
|
21
21
|
marginEnd?: React.CSSProperties["marginBlockEnd"];
|
|
22
|
-
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "
|
|
22
|
+
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "as" | "align" | "wrap" | "justify" | "marginStart" | "marginEnd" | "direction" | "gap"> & React.RefAttributes<unknown>) => React.ReactElement | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CompositeProps } from '@floating-ui/react';
|
|
3
|
+
export type GalleryProps = React.HTMLAttributes<HTMLDivElement> & Omit<CompositeProps, 'cols'> & {
|
|
4
|
+
cols?: number | 'auto';
|
|
5
|
+
gap?: React.CSSProperties['gap'];
|
|
6
|
+
itemSize?: React.CSSProperties['width'];
|
|
7
|
+
objectFit?: React.CSSProperties['objectFit'];
|
|
8
|
+
marginStart?: React.CSSProperties['marginBlockStart'];
|
|
9
|
+
marginEnd?: React.CSSProperties['marginBlockEnd'];
|
|
10
|
+
};
|
|
11
|
+
export declare const Gallery: ({ gap, loop, cols, itemSize, objectFit: imageObjectFit, marginStart, marginEnd, className, style, children, ...props }: GalleryProps) => import("react/jsx-runtime").JSX.Element;
|