@kolking/react-ui 1.9.0 → 1.9.2
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/components/Avatar/Avatar.js +10 -10
- package/dist/components/Avatar/helpers.js +15 -16
- package/dist/components/Badge/Badge.js +10 -10
- package/dist/components/Dialog/Dialog.d.ts +2 -2
- package/dist/components/Dialog/useDialog.d.ts +12 -6
- package/dist/components/Dialog/useDialog.js +25 -21
- package/dist/components/Dialog/withDialog.d.ts +9 -3
- package/dist/components/Dialog/withDialog.js +26 -16
- package/dist/components/Fields/Checkbox.js +15 -15
- package/dist/components/Gallery/Gallery.js +21 -20
- package/dist/components/Lightbox/Lightbox.js +95 -79
- package/dist/components/Notice/Notice.js +58 -43
- package/dist/components/Progress/ProgressBar.js +14 -14
- package/dist/components/Progress/ProgressCircular.js +15 -15
- package/dist/styles/style.css +1 -1
- package/package.json +14 -4
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsxs as b, jsx as
|
|
2
|
-
import { useId as j, useRef as
|
|
3
|
-
import { useFloating as
|
|
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
4
|
import J from "classnames";
|
|
5
5
|
import { Icon as v } from "../Icon/Icon.js";
|
|
6
6
|
import { Button as p } from "../Button/Button.js";
|
|
7
7
|
import { afterTransition as Q, htmlImage as U } from "../../utils/helpers.js";
|
|
8
8
|
import { s as e, T as W } from "../../Thumbnails-BlXFynlF.js";
|
|
9
9
|
const X = ({
|
|
10
|
-
images:
|
|
10
|
+
images: d,
|
|
11
11
|
selected: o,
|
|
12
12
|
loop: c = !0,
|
|
13
|
-
className:
|
|
13
|
+
className: x,
|
|
14
14
|
children: y,
|
|
15
|
-
onSelect:
|
|
15
|
+
onSelect: n,
|
|
16
16
|
renderImage: N = U,
|
|
17
17
|
...w
|
|
18
18
|
}) => {
|
|
19
|
-
const F = j(), a =
|
|
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
20
|
open: O,
|
|
21
21
|
onOpenChange: (t) => {
|
|
22
|
-
t ||
|
|
22
|
+
t || I();
|
|
23
23
|
}
|
|
24
|
-
}), { getFloatingProps:
|
|
24
|
+
}), { getFloatingProps: R, getItemProps: L } = B([
|
|
25
25
|
H(u),
|
|
26
26
|
K(u, { role: "dialog" }),
|
|
27
27
|
M(u, {
|
|
@@ -35,32 +35,34 @@ const X = ({
|
|
|
35
35
|
openOnArrowKeyDown: !1,
|
|
36
36
|
scrollItemIntoView: { inline: "nearest" },
|
|
37
37
|
onNavigate: (t) => {
|
|
38
|
-
t !== null && t !== o && (s.current[t]?.focus(),
|
|
38
|
+
t !== null && t !== o && (s.current[t]?.focus(), n(t));
|
|
39
39
|
}
|
|
40
40
|
})
|
|
41
41
|
]), f = m(
|
|
42
42
|
(t) => {
|
|
43
|
-
!c && (t === 0 || t === a - 1) &&
|
|
43
|
+
!c && (t === 0 || t === a - 1) && requestAnimationFrame(() => {
|
|
44
|
+
s.current[t]?.focus();
|
|
45
|
+
});
|
|
44
46
|
},
|
|
45
47
|
[c, a]
|
|
46
|
-
),
|
|
48
|
+
), I = m(() => {
|
|
47
49
|
l.floating?.classList.add(e.willhide), Q(l.floating, () => {
|
|
48
|
-
|
|
50
|
+
n(void 0);
|
|
49
51
|
});
|
|
50
|
-
}, [l.floating,
|
|
52
|
+
}, [l.floating, n]), T = m(() => {
|
|
51
53
|
const t = o === 0 ? a - 1 : o - 1;
|
|
52
|
-
|
|
53
|
-
}, [a, o, f,
|
|
54
|
+
n(t), f(t);
|
|
55
|
+
}, [a, o, f, n]), E = m(() => {
|
|
54
56
|
const t = o === a - 1 ? 0 : o + 1;
|
|
55
|
-
|
|
56
|
-
}, [a, o, f,
|
|
57
|
-
return
|
|
57
|
+
n(t), f(t);
|
|
58
|
+
}, [a, o, f, n]);
|
|
59
|
+
return A(() => {
|
|
58
60
|
const t = new IntersectionObserver(
|
|
59
61
|
(r) => {
|
|
60
62
|
r.forEach((g) => {
|
|
61
63
|
if (g.isIntersecting) {
|
|
62
64
|
const h = s.current.indexOf(g.target);
|
|
63
|
-
h !== -1 && h !== o &&
|
|
65
|
+
h !== -1 && h !== o && n(h);
|
|
64
66
|
}
|
|
65
67
|
});
|
|
66
68
|
},
|
|
@@ -74,70 +76,84 @@ const X = ({
|
|
|
74
76
|
}), () => {
|
|
75
77
|
t.disconnect();
|
|
76
78
|
};
|
|
77
|
-
}, [l.floating, o,
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
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(
|
|
80
82
|
"div",
|
|
81
83
|
{
|
|
82
|
-
...
|
|
83
|
-
ref:
|
|
84
|
+
...R(w),
|
|
85
|
+
ref: P.setFloating,
|
|
84
86
|
"data-lightbox": !0,
|
|
85
87
|
"data-floating-root": !0,
|
|
86
|
-
className: J(e.lightbox,
|
|
88
|
+
className: J(e.lightbox, x),
|
|
87
89
|
children: [
|
|
88
|
-
/* @__PURE__ */ b(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"data-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
+
),
|
|
141
157
|
y
|
|
142
158
|
]
|
|
143
159
|
}
|
|
@@ -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
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import v from "react";
|
|
3
3
|
import _ from "classnames";
|
|
4
|
-
import { cssProps as
|
|
5
|
-
const
|
|
6
|
-
progress:
|
|
7
|
-
indicator:
|
|
8
|
-
},
|
|
4
|
+
import { cssProps as b, clamp as w } from "../../utils/helpers.js";
|
|
5
|
+
const P = "Progress_progress_LSrhF", h = "Progress_indicator_KDwMt", e = {
|
|
6
|
+
progress: P,
|
|
7
|
+
indicator: h
|
|
8
|
+
}, $ = v.forwardRef(
|
|
9
9
|
({
|
|
10
10
|
value: s,
|
|
11
11
|
width: o,
|
|
@@ -15,15 +15,15 @@ const w = "Progress_progress_LSrhF", P = "Progress_indicator_KDwMt", e = {
|
|
|
15
15
|
minWidth: c,
|
|
16
16
|
maxWidth: p,
|
|
17
17
|
margin: d,
|
|
18
|
-
style:
|
|
19
|
-
className:
|
|
18
|
+
style: l,
|
|
19
|
+
className: m,
|
|
20
20
|
...g
|
|
21
21
|
}, f) => {
|
|
22
|
-
const r = s ?
|
|
22
|
+
const r = s ? w(s, 0, 100) : void 0, u = r !== void 0 ? `${r} percent` : "indeterminate";
|
|
23
23
|
return /* @__PURE__ */ a(
|
|
24
24
|
"div",
|
|
25
25
|
{
|
|
26
|
-
"aria-label":
|
|
26
|
+
"aria-label": u,
|
|
27
27
|
...g,
|
|
28
28
|
ref: f,
|
|
29
29
|
role: "progressbar",
|
|
@@ -32,10 +32,10 @@ const w = "Progress_progress_LSrhF", P = "Progress_indicator_KDwMt", e = {
|
|
|
32
32
|
"aria-valuenow": r,
|
|
33
33
|
"data-progress-bar": !0,
|
|
34
34
|
"data-progress-value": r ?? "indeterminate",
|
|
35
|
-
className: _(e.progress,
|
|
35
|
+
className: _(e.progress, m),
|
|
36
36
|
style: {
|
|
37
|
-
...
|
|
38
|
-
...
|
|
37
|
+
...l,
|
|
38
|
+
...b({ width: o, height: t, color: i, trackColor: n, minWidth: c, maxWidth: p, margin: d })
|
|
39
39
|
},
|
|
40
40
|
children: /* @__PURE__ */ a(
|
|
41
41
|
"span",
|
|
@@ -50,5 +50,5 @@ const w = "Progress_progress_LSrhF", P = "Progress_indicator_KDwMt", e = {
|
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
$ as ProgressBar
|
|
54
54
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import N from "react";
|
|
3
|
+
import b from "classnames";
|
|
4
4
|
import { cssProps as k, clamp as w } from "../../utils/helpers.js";
|
|
5
|
-
const
|
|
6
|
-
inner:
|
|
7
|
-
container:
|
|
8
|
-
range:
|
|
9
|
-
progress:
|
|
10
|
-
track:
|
|
5
|
+
const h = "Progress_inner_Zoiac", x = "Progress_container_tFVew", y = "Progress_range_uqjFb", C = "Progress_progress_MHEjj", F = "Progress_track_jWvrX", n = {
|
|
6
|
+
inner: h,
|
|
7
|
+
container: x,
|
|
8
|
+
range: y,
|
|
9
|
+
progress: C,
|
|
10
|
+
track: F
|
|
11
11
|
};
|
|
12
|
-
function
|
|
12
|
+
function R(r, s, e) {
|
|
13
13
|
return e !== void 0 ? ((e - r) / (s - r) * 100).toString() : e;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
15
|
+
const M = N.forwardRef(
|
|
16
16
|
({
|
|
17
17
|
min: r = 0,
|
|
18
18
|
max: s = 100,
|
|
@@ -29,11 +29,11 @@ const H = j.forwardRef(
|
|
|
29
29
|
children: t,
|
|
30
30
|
...v
|
|
31
31
|
}, P) => {
|
|
32
|
-
const a = e !== null ? w(e, r, s) : void 0;
|
|
32
|
+
const a = e !== null ? w(e, r, s) : void 0, j = a !== void 0 ? `${a} percent` : "indeterminate";
|
|
33
33
|
return /* @__PURE__ */ c(
|
|
34
34
|
"div",
|
|
35
35
|
{
|
|
36
|
-
"aria-label":
|
|
36
|
+
"aria-label": j,
|
|
37
37
|
...v,
|
|
38
38
|
ref: P,
|
|
39
39
|
role: "progressbar",
|
|
@@ -43,7 +43,7 @@ const H = j.forwardRef(
|
|
|
43
43
|
"data-progress-circular": !0,
|
|
44
44
|
"data-countdown": l,
|
|
45
45
|
"data-progress-value": a ?? "indeterminate",
|
|
46
|
-
className:
|
|
46
|
+
className: b(n.container, _),
|
|
47
47
|
style: {
|
|
48
48
|
...f,
|
|
49
49
|
...k({
|
|
@@ -53,7 +53,7 @@ const H = j.forwardRef(
|
|
|
53
53
|
color: d,
|
|
54
54
|
trackColor: p,
|
|
55
55
|
margin: m,
|
|
56
|
-
value:
|
|
56
|
+
value: R(r, s, a)
|
|
57
57
|
})
|
|
58
58
|
},
|
|
59
59
|
children: [
|
|
@@ -68,5 +68,5 @@ const H = j.forwardRef(
|
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
70
|
export {
|
|
71
|
-
|
|
71
|
+
M as ProgressCircular
|
|
72
72
|
};
|