@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.
@@ -1,27 +1,27 @@
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";
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: x,
10
+ images: d,
11
11
  selected: o,
12
12
  loop: c = !0,
13
- className: I,
13
+ className: x,
14
14
  children: y,
15
- onSelect: i,
15
+ onSelect: n,
16
16
  renderImage: N = U,
17
17
  ...w
18
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({
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 || d();
22
+ t || I();
23
23
  }
24
- }), { getFloatingProps: L, getItemProps: T } = B([
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(), i(t));
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) && s.current[t]?.focus();
43
+ !c && (t === 0 || t === a - 1) && requestAnimationFrame(() => {
44
+ s.current[t]?.focus();
45
+ });
44
46
  },
45
47
  [c, a]
46
- ), d = m(() => {
48
+ ), I = m(() => {
47
49
  l.floating?.classList.add(e.willhide), Q(l.floating, () => {
48
- i(void 0);
50
+ n(void 0);
49
51
  });
50
- }, [l.floating, i]), $ = m(() => {
52
+ }, [l.floating, n]), T = m(() => {
51
53
  const t = o === 0 ? a - 1 : o - 1;
52
- i(t), f(t);
53
- }, [a, o, f, i]), E = m(() => {
54
+ n(t), f(t);
55
+ }, [a, o, f, n]), E = m(() => {
54
56
  const t = o === a - 1 ? 0 : o + 1;
55
- i(t), f(t);
56
- }, [a, o, f, i]);
57
- return q(() => {
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 && i(h);
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, i]), /* @__PURE__ */ b(V, { root: k, children: [
78
- /* @__PURE__ */ n(z, { lockScroll: !0 }),
79
- /* @__PURE__ */ n(G, { context: u, children: /* @__PURE__ */ b(
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
- ...L(w),
83
- ref: R.setFloating,
84
+ ...R(w),
85
+ ref: P.setFloating,
84
86
  "data-lightbox": !0,
85
87
  "data-floating-root": !0,
86
- className: J(e.lightbox, I),
88
+ className: J(e.lightbox, x),
87
89
  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
- ] }),
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 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
  );
@@ -1,11 +1,11 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import u from "react";
2
+ import v from "react";
3
3
  import _ from "classnames";
4
- import { cssProps as v, clamp as b } from "../../utils/helpers.js";
5
- const w = "Progress_progress_LSrhF", P = "Progress_indicator_KDwMt", e = {
6
- progress: w,
7
- indicator: P
8
- }, R = u.forwardRef(
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: m,
19
- className: l,
18
+ style: l,
19
+ className: m,
20
20
  ...g
21
21
  }, f) => {
22
- const r = s ? b(s, 0, 100) : void 0;
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": r ? `${r} percent` : "indeterminate",
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, l),
35
+ className: _(e.progress, m),
36
36
  style: {
37
- ...m,
38
- ...v({ width: o, height: t, color: i, trackColor: n, minWidth: c, maxWidth: p, margin: d })
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
- R as ProgressBar
53
+ $ as ProgressBar
54
54
  };
@@ -1,18 +1,18 @@
1
1
  import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
- import j from "react";
3
- import N from "classnames";
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 b = "Progress_inner_Zoiac", h = "Progress_container_tFVew", x = "Progress_range_uqjFb", y = "Progress_progress_MHEjj", C = "Progress_track_jWvrX", n = {
6
- inner: b,
7
- container: h,
8
- range: x,
9
- progress: y,
10
- track: C
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 F(r, s, e) {
12
+ function R(r, s, e) {
13
13
  return e !== void 0 ? ((e - r) / (s - r) * 100).toString() : e;
14
14
  }
15
- const H = j.forwardRef(
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": a ? `${a} percent` : "indeterminate",
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: N(n.container, _),
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: F(r, s, a)
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
- H as ProgressCircular
71
+ M as ProgressCircular
72
72
  };