@kolking/react-ui 1.5.0 → 1.7.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.
Files changed (58) hide show
  1. package/dist/{Input-DbQTM4UI.js → Input-D46mAsdt.js} +1 -1
  2. package/dist/ValidationTooltip-D8d9O6Re.js +31 -0
  3. package/dist/components/Avatar/Avatar.js +29 -20
  4. package/dist/components/Badge/Badge.js +11 -11
  5. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +13 -0
  6. package/dist/components/Breadcrumbs/Breadcrumbs.js +40 -0
  7. package/dist/components/Breadcrumbs/index.d.ts +1 -0
  8. package/dist/components/Breadcrumbs/index.js +4 -0
  9. package/dist/components/Button/Button.js +1 -1
  10. package/dist/components/Dialog/Dialog.d.ts +9 -5
  11. package/dist/components/Dialog/Dialog.js +68 -45
  12. package/dist/components/Dialog/useDialog.d.ts +2 -1
  13. package/dist/components/Dialog/useDialog.js +29 -42
  14. package/dist/components/Dialog/withDialog.d.ts +1 -1
  15. package/dist/components/Fields/Checkbox.js +15 -15
  16. package/dist/components/Fields/Input.js +2 -2
  17. package/dist/components/Fields/Numeric.d.ts +8 -2
  18. package/dist/components/Fields/Numeric.js +22 -22
  19. package/dist/components/Fields/Radio.js +11 -11
  20. package/dist/components/Fields/Range.d.ts +20 -0
  21. package/dist/components/Fields/Range.js +54 -0
  22. package/dist/components/Fields/Select.js +1 -1
  23. package/dist/components/Fields/Switch.js +11 -11
  24. package/dist/components/Fields/Textarea.js +1 -1
  25. package/dist/components/Fields/ValidationTooltip.d.ts +1 -1
  26. package/dist/components/Fields/ValidationTooltip.js +3 -2
  27. package/dist/components/Fields/index.d.ts +1 -0
  28. package/dist/components/Fields/index.js +14 -12
  29. package/dist/components/Heading/Heading.js +12 -12
  30. package/dist/components/Icon/Icon.js +7 -7
  31. package/dist/components/Menu/Menu.d.ts +6 -2
  32. package/dist/components/Menu/Menu.js +57 -51
  33. package/dist/components/Menu/MenuContext.d.ts +1 -0
  34. package/dist/components/Menu/MenuItem.d.ts +2 -3
  35. package/dist/components/Menu/MenuItem.js +23 -29
  36. package/dist/components/Notice/Notice.js +30 -30
  37. package/dist/components/Progress/ProgressBar.js +30 -23
  38. package/dist/components/Progress/ProgressCircular.js +13 -12
  39. package/dist/components/Segmented/Segmented.js +42 -34
  40. package/dist/components/Spinner/Spinner.js +1 -1
  41. package/dist/components/Tag/Tag.js +12 -12
  42. package/dist/components/ToggleButton/ToggleButton.d.ts +15 -1
  43. package/dist/components/ToggleButton/ToggleButton.js +17 -12
  44. package/dist/components/ToggleButton/ToggleGroup.js +34 -31
  45. package/dist/components/Tooltip/Tooltip.d.ts +2 -1
  46. package/dist/components/Tooltip/Tooltip.js +59 -56
  47. package/dist/index.d.ts +1 -0
  48. package/dist/index.js +66 -62
  49. package/dist/styles/_theme-default.scss +36 -35
  50. package/dist/styles/style.css +1 -1
  51. package/dist/styles.module-D1F3R7Vi.js +11 -0
  52. package/dist/utils/helpers.d.ts +1 -1
  53. package/dist/utils/helpers.js +3 -3
  54. package/package.json +3 -1
  55. package/dist/ValidationTooltip-BgSwl0hJ.js +0 -30
  56. package/dist/components/Dialog/DialogFocusTrap.d.ts +0 -2
  57. package/dist/components/Dialog/DialogFocusTrap.js +0 -17
  58. package/dist/styles.module-CUhWny5T.js +0 -11
@@ -2,7 +2,7 @@ import { jsxs as _, jsx as s } from "react/jsx-runtime";
2
2
  import u from "classnames";
3
3
  import h from "react";
4
4
  import { cssProps as m } from "./utils/helpers.js";
5
- import { s as t, V as x } from "./ValidationTooltip-BgSwl0hJ.js";
5
+ import { s as t, V as x } from "./ValidationTooltip-D8d9O6Re.js";
6
6
  const w = "styles_checkbox_pxrU4", v = "styles_radio_0QV8R", k = "styles_label_K65D1", g = "styles_input_j6Qji", N = {
7
7
  checkbox: w,
8
8
  radio: v,
@@ -0,0 +1,31 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import r from "classnames";
3
+ import { Tooltip as o } from "./components/Tooltip/Tooltip.js";
4
+ const a = "styles_input_a-JHN", p = "styles_wrapper_b3-VW", c = "styles_date_S0YpO", l = "styles_time_3ywit", _ = "styles_search_y6sAm", n = "styles_number_auDA-", i = "styles_textarea_KRYGO", y = "styles_select_qhElj", m = "styles_tooltip_tBrt4", w = "styles_range_tSqtV", u = "styles_wrapper_prefix_KI25W", d = "styles_wrapper_accessory_yZjv0", x = {
5
+ input: a,
6
+ wrapper: p,
7
+ date: c,
8
+ time: l,
9
+ search: _,
10
+ number: n,
11
+ textarea: i,
12
+ select: y,
13
+ tooltip: m,
14
+ range: w,
15
+ wrapper_prefix: u,
16
+ wrapper_accessory: d
17
+ }, h = ({ className: e, ...t }) => /* @__PURE__ */ s(
18
+ o,
19
+ {
20
+ placement: "top-start",
21
+ trigger: "hover focus click",
22
+ ...t,
23
+ "data-tooltip-validation": !0,
24
+ disabled: !t.content,
25
+ className: r(x.tooltip, e)
26
+ }
27
+ );
28
+ export {
29
+ h as V,
30
+ x as s
31
+ };
@@ -1,42 +1,51 @@
1
- import { jsxs as S, jsx as c } from "react/jsx-runtime";
2
- import _ from "classnames";
3
- import * as l from "react";
4
- import { forwardRef as h, useMemo as N, useState as x, useEffect as A, useCallback as E } from "react";
1
+ import { jsxs as _, jsx as i } from "react/jsx-runtime";
2
+ import h from "classnames";
3
+ import * as m from "react";
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, r) => /* @__PURE__ */ l.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 50 50", ref: r, ...a }, /* @__PURE__ */ l.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 = h(b), y = "Avatar_avatar_PNlL5", G = "Avatar_image_Jwmxk", I = "Avatar_name_sGSwN", e = {
7
+ const b = (a, t) => /* @__PURE__ */ m.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 50 50", ref: t, ...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", e = {
8
8
  avatar: y,
9
- image: G,
10
- name: I,
9
+ image: I,
10
+ initials: P,
11
11
  default: "Avatar_default_v75Mg"
12
12
  }, J = ({
13
13
  size: a = 50,
14
- name: r,
14
+ name: t,
15
15
  email: o,
16
- src: m,
16
+ src: c,
17
17
  colorize: v,
18
18
  className: d,
19
- style: g,
20
- children: u,
19
+ style: u,
20
+ children: g,
21
21
  ...f
22
22
  }) => {
23
- const t = r == null ? void 0 : r.trim(), p = v && t ? k(t) : void 0, s = N(() => m || (o ? M(a, o) : void 0), [m, a, o]), [n, i] = x(s);
24
- A(() => {
25
- i(s);
23
+ const r = t == null ? void 0 : t.trim(), p = v && r ? k(r) : void 0, s = x(() => c || (o ? M(a, o) : void 0), [c, a, o]), [l, n] = A(s);
24
+ N(() => {
25
+ n(s);
26
26
  }, [s]);
27
27
  const w = E(() => {
28
- i(void 0);
28
+ n(void 0);
29
29
  }, []);
30
- return /* @__PURE__ */ S(
30
+ return /* @__PURE__ */ _(
31
31
  "div",
32
32
  {
33
33
  ...f,
34
34
  "data-avatar": !0,
35
- className: _(e.avatar, d),
36
- style: { ...g, ...C({ size: a, backgroundColor: p }) },
35
+ className: h(e.avatar, d),
36
+ style: { ...u, ...C({ size: a, backgroundColor: p }) },
37
37
  children: [
38
- n ? /* @__PURE__ */ c("img", { className: e.image, src: n, alt: t, onError: w }) : t ? /* @__PURE__ */ c("span", { className: e.name, children: R(t) }) : /* @__PURE__ */ c(j, { className: e.default, "aria-hidden": !0 }),
39
- u
38
+ l ? /* @__PURE__ */ i(
39
+ "img",
40
+ {
41
+ "data-avatar-image": !0,
42
+ className: e.image,
43
+ src: l,
44
+ alt: r ?? "",
45
+ onError: w
46
+ }
47
+ ) : r ? /* @__PURE__ */ i("span", { "data-avatar-initials": !0, className: e.initials, children: R(r) }) : /* @__PURE__ */ i(j, { "aria-hidden": !0, "data-avatar-default": !0, className: e.default }),
48
+ g
40
49
  ]
41
50
  }
42
51
  );
@@ -2,19 +2,19 @@ import { jsx as B } from "react/jsx-runtime";
2
2
  import b from "classnames";
3
3
  import { useRef as m, useEffect as h } from "react";
4
4
  import { cssProps as w } from "../../utils/helpers.js";
5
- const E = "Badge_badge_-mEE7", M = "Badge_gray_7jA-J", P = "Badge_red_zPgCR", x = "Badge_orange_EoLmF", H = "Badge_yellow_qvbb6", I = "Badge_green_XX-1c", R = "Badge_teal_VHoFK", X = "Badge_cyan_1ksBn", j = "Badge_blue_YulfT", C = "Badge_indigo_2KXUy", F = "Badge_purple_o55fQ", K = "Badge_brown_x1GS7", O = "Badge_accent_BIYve", d = {
5
+ const E = "Badge_badge_-mEE7", M = "Badge_gray_7jA-J", P = "Badge_brown_x1GS7", x = "Badge_red_zPgCR", H = "Badge_orange_EoLmF", I = "Badge_yellow_qvbb6", R = "Badge_green_XX-1c", X = "Badge_teal_VHoFK", j = "Badge_cyan_1ksBn", C = "Badge_blue_YulfT", F = "Badge_indigo_2KXUy", K = "Badge_purple_o55fQ", O = "Badge_accent_BIYve", d = {
6
6
  badge: E,
7
7
  gray: M,
8
- red: P,
9
- orange: x,
10
- yellow: H,
11
- green: I,
12
- teal: R,
13
- cyan: X,
14
- blue: j,
15
- indigo: C,
16
- purple: F,
17
- brown: K,
8
+ brown: P,
9
+ red: x,
10
+ orange: H,
11
+ yellow: I,
12
+ green: R,
13
+ teal: X,
14
+ cyan: j,
15
+ blue: C,
16
+ indigo: F,
17
+ purple: K,
18
18
  accent: O
19
19
  }, q = ({
20
20
  size: l,
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { PolymorphicProps } from '../../utils/helpers';
3
+ export type Breadcrumb<T extends React.ElementType = 'a'> = PolymorphicProps<T, {
4
+ as?: T;
5
+ label: React.ReactNode;
6
+ }>;
7
+ export type BreadcrumbsProps = React.OlHTMLAttributes<HTMLOListElement> & {
8
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
+ items: Breadcrumb<React.ElementType>[];
10
+ separator?: React.ReactNode;
11
+ margin?: React.CSSProperties['margin'];
12
+ };
13
+ export declare const Breadcrumbs: ({ size, items, separator, margin, style, className, ...props }: BreadcrumbsProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { jsx as a, jsxs as p } from "react/jsx-runtime";
2
+ import h from "classnames";
3
+ import { cssProps as f } from "../../utils/helpers.js";
4
+ const g = "Breadcrumbs_breadcrumbs_a3ubb", j = {
5
+ breadcrumbs: g
6
+ }, v = ({
7
+ size: t,
8
+ items: s = [],
9
+ separator: b = "›",
10
+ margin: d,
11
+ style: m,
12
+ className: o,
13
+ ...n
14
+ }) => /* @__PURE__ */ a(
15
+ "ol",
16
+ {
17
+ ...n,
18
+ "data-breadcrumbs": !0,
19
+ className: h(j.breadcrumbs, o),
20
+ style: { ...m, ...f({ size: t, margin: d }) },
21
+ children: s.map(({ label: u, as: l, ...e }, r) => {
22
+ const c = r === s.length - 1, i = l ?? (e.href ? "a" : "span");
23
+ return /* @__PURE__ */ p("li", { children: [
24
+ /* @__PURE__ */ a(
25
+ i,
26
+ {
27
+ ...e,
28
+ "data-breadcrumbs-item": r,
29
+ "aria-current": c ? "page" : void 0,
30
+ children: u
31
+ }
32
+ ),
33
+ !c && /* @__PURE__ */ a("span", { "aria-hidden": !0, "data-breadcrumbs-separator": !0, children: b })
34
+ ] }, r);
35
+ })
36
+ }
37
+ );
38
+ export {
39
+ v as Breadcrumbs
40
+ };
@@ -0,0 +1 @@
1
+ export * from './Breadcrumbs';
@@ -0,0 +1,4 @@
1
+ import { Breadcrumbs as m } from "./Breadcrumbs.js";
2
+ export {
3
+ m as Breadcrumbs
4
+ };
@@ -48,7 +48,7 @@ function A({
48
48
  children: [
49
49
  o ? d(o, "span") : /* @__PURE__ */ u(B, { children: [
50
50
  i === "start" && n,
51
- e && d(e, "span"),
51
+ e !== void 0 && d(e, "span"),
52
52
  i === "end" && n
53
53
  ] }),
54
54
  t && /* @__PURE__ */ v(N, { overlay: !0 })
@@ -1,15 +1,19 @@
1
1
  import { default as React } from 'react';
2
2
  import { ButtonProps } from '../Button';
3
3
  import { HeadingProps } from '../Heading';
4
- export type DialogProps = React.DialogHTMLAttributes<HTMLDialogElement> & {
4
+ export type DialogProps = React.HTMLAttributes<HTMLDivElement> & {
5
+ open?: boolean;
5
6
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
6
7
  width?: React.CSSProperties['width'];
8
+ requestClose: () => void;
7
9
  };
8
- export declare const Dialog: React.ForwardRefExoticComponent<React.DialogHTMLAttributes<HTMLDialogElement> & {
10
+ export declare const Dialog: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
11
+ open?: boolean;
9
12
  size?: "xs" | "sm" | "md" | "lg" | "xl";
10
13
  width?: React.CSSProperties["width"];
11
- } & React.RefAttributes<HTMLDialogElement>>;
14
+ requestClose: () => void;
15
+ } & React.RefAttributes<HTMLDivElement>>;
12
16
  export declare const DialogTitle: ({ className, children, ...props }: Omit<HeadingProps, "title">) => import("react/jsx-runtime").JSX.Element;
13
- export declare const DialogContent: ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
14
- export declare const DialogFooter: ({ className, children, ...props }: React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const DialogContent: (props: React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const DialogFooter: ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
15
19
  export declare const DialogClose: ({ className, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,53 +1,76 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import g from "react";
3
- import i from "classnames";
4
- import { Icon as m } from "../Icon/Icon.js";
5
- import { Button as p } from "../Button/Button.js";
6
- import { Heading as f } from "../Heading/Heading.js";
7
- import { DialogFocusTrap as u } from "./DialogFocusTrap.js";
8
- import { cssProps as D } from "../../utils/helpers.js";
9
- const _ = "Dialog_dialog_G3gxL", w = "Dialog_wrapper_BMuhR", v = "Dialog_footer_N-aEV", N = "Dialog_close_JSEkn", e = {
10
- dialog: _,
11
- wrapper: w,
12
- footer: v,
13
- close: N
14
- }, F = g.forwardRef(
15
- ({ open: o = !1, size: a, width: r, style: l, className: s, children: c, ...d }, n) => /* @__PURE__ */ t(u, { active: o, children: /* @__PURE__ */ t(
16
- "dialog",
17
- {
18
- ...d,
19
- ref: n,
20
- "data-floating-root": !0,
21
- "data-dialog": o ? "open" : "closed",
22
- className: i(e.dialog, s),
23
- style: { ...l, ...D({ size: a, width: r }) },
24
- children: /* @__PURE__ */ t("div", { "data-dialog-wrapper": !0, className: e.wrapper, children: c })
25
- }
26
- ) })
27
- ), T = ({ className: o, children: a, ...r }) => /* @__PURE__ */ t(f, { as: "h4", ...r, "data-dialog-title": !0, title: a, className: o }), j = ({
28
- className: o,
29
- children: a,
30
- ...r
31
- }) => /* @__PURE__ */ t("div", { ...r, "data-dialog-content": !0, className: o, children: a }), k = ({
32
- className: o,
33
- children: a,
34
- ...r
35
- }) => /* @__PURE__ */ t("div", { ...r, "data-dialog-footer": !0, className: i(e.footer, o), children: a }), G = ({ className: o, ...a }) => /* @__PURE__ */ t(
36
- p,
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import y, { useRef as D, useImperativeHandle as _, useEffect as E } from "react";
3
+ import { createPortal as k } from "react-dom";
4
+ import { FocusTrap as h } from "focus-trap-react";
5
+ import s from "classnames";
6
+ import { cssProps as L } from "../../utils/helpers.js";
7
+ import { Button as N } from "../Button/Button.js";
8
+ import { Heading as b } from "../Heading/Heading.js";
9
+ import { Icon as w } from "../Icon/Icon.js";
10
+ const x = "Dialog_overlay_C98Qt", R = "Dialog_dialog_G3gxL", T = "Dialog_footer_N-aEV", I = "Dialog_close_JSEkn", i = {
11
+ overlay: x,
12
+ dialog: R,
13
+ footer: T,
14
+ close: I
15
+ }, P = { escapeDeactivates: !1 }, Q = y.forwardRef(
16
+ ({ open: t = !1, size: e, width: l, style: g, className: m, children: u, requestClose: n, ...p }, v) => {
17
+ const c = D(null);
18
+ return _(v, () => c.current), E(() => {
19
+ const r = c.current;
20
+ if (r && t) {
21
+ let d = function(a) {
22
+ a.target === a.currentTarget && n();
23
+ }, f = function(a) {
24
+ a.key === "Escape" && (a.stopPropagation(), a.preventDefault(), n());
25
+ };
26
+ return r.addEventListener("click", d), r.addEventListener("keydown", f), () => {
27
+ r.removeEventListener("click", d), r.removeEventListener("keydown", f);
28
+ };
29
+ }
30
+ }, [t, n]), t ? k(
31
+ /* @__PURE__ */ o(h, { active: t, focusTrapOptions: P, children: /* @__PURE__ */ o(
32
+ "div",
33
+ {
34
+ ...p,
35
+ ref: c,
36
+ tabIndex: 0,
37
+ "data-dialog": !0,
38
+ "data-open": t,
39
+ "data-floating-root": !0,
40
+ className: i.overlay,
41
+ children: /* @__PURE__ */ o(
42
+ "div",
43
+ {
44
+ role: "alertdialog",
45
+ "aria-modal": "true",
46
+ "data-dialog-wrapper": !0,
47
+ className: s(i.dialog, m),
48
+ style: { ...g, ...L({ size: e, width: l }) },
49
+ children: u
50
+ }
51
+ )
52
+ }
53
+ ) }),
54
+ // Append to an element with data-floating-root attribute
55
+ document.querySelector("[data-floating-root]") ?? document.body
56
+ ) : null;
57
+ }
58
+ ), V = ({ className: t, children: e, ...l }) => /* @__PURE__ */ o(b, { as: "h4", ...l, "data-dialog-title": !0, title: e, className: t }), z = (t) => /* @__PURE__ */ o("div", { ...t, "data-dialog-content": !0 }), A = ({ className: t, ...e }) => /* @__PURE__ */ o("div", { ...e, "data-dialog-footer": !0, className: s(i.footer, t) }), K = ({ className: t, ...e }) => /* @__PURE__ */ o(
59
+ N,
37
60
  {
38
- ...a,
39
61
  type: "button",
40
62
  variant: "tertiary",
63
+ "aria-label": "close dialog",
64
+ icon: /* @__PURE__ */ o(w, { name: "close" }),
65
+ ...e,
41
66
  "data-dialog-close": !0,
42
- "aria-label": "dismiss dialog",
43
- icon: /* @__PURE__ */ t(m, { name: "close" }),
44
- className: i(e.close, o)
67
+ className: s(i.close, t)
45
68
  }
46
69
  );
47
70
  export {
48
- F as Dialog,
49
- G as DialogClose,
50
- j as DialogContent,
51
- k as DialogFooter,
52
- T as DialogTitle
71
+ Q as Dialog,
72
+ K as DialogClose,
73
+ z as DialogContent,
74
+ A as DialogFooter,
75
+ V as DialogTitle
53
76
  };
@@ -7,8 +7,9 @@ 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<HTMLDialogElement>;
10
+ ref: import('react').RefObject<HTMLDivElement>;
11
11
  open: boolean;
12
+ requestClose: () => void;
12
13
  };
13
14
  data: T | undefined;
14
15
  show: (values: T) => void;
@@ -1,52 +1,39 @@
1
- import { useRef as v, useState as g, useCallback as u, useEffect as h } from "react";
2
- function S(o) {
3
- const a = v(null), i = v(o), s = v(!1), [d, E] = g((o == null ? void 0 : o.defaultOpen) ?? !1), [w, k] = g();
4
- i.current = o;
5
- const y = u((e) => {
6
- var n, t;
7
- s.current || (k(e), E(!0), (t = (n = i.current) == null ? void 0 : n.onShow) == null || t.call(n, e));
8
- }, []), c = u((e) => {
9
- s.current || E((n) => {
10
- var t;
11
- return n && (s.current = !0, (t = a.current) == null || t.addEventListener("transitionend", function r(b) {
12
- var f, p, l, m;
13
- b.target === a.current && (e !== void 0 ? (p = (f = i.current) == null ? void 0 : f.onConfirm) == null || p.call(f, e) : (m = (l = i.current) == null ? void 0 : l.onCancel) == null || m.call(l), k(void 0), s.current = !1, this.removeEventListener("transitionend", r));
14
- })), !1;
15
- });
16
- }, []);
17
- h(() => {
18
- var e, n;
19
- d ? (e = a.current) == null || e.showModal() : (n = a.current) == null || n.close();
20
- }, [d]), h(() => {
21
- const e = a.current;
22
- if (e) {
23
- let n = function(r) {
24
- r.target === r.currentTarget && c();
25
- }, t = function(r) {
26
- r.key === "Escape" && (r.stopPropagation(), r.preventDefault(), c());
27
- };
28
- return e.addEventListener("click", n), e.addEventListener("keydown", t), () => {
29
- e.removeEventListener("click", n), e.removeEventListener("keydown", t);
30
- };
31
- }
32
- }, [c]);
33
- const L = u(() => c(), [c]), C = u((e) => c(e), [c]), D = u(async (e) => {
34
- s.current = !0;
1
+ import { useRef as l, useState as y, useCallback as a } from "react";
2
+ function g(t, u) {
3
+ setTimeout(
4
+ u,
5
+ t ? parseFloat(getComputedStyle(t).transitionDuration) * 1e3 : 0
6
+ );
7
+ }
8
+ function v(t) {
9
+ const u = l(null), s = l(t), c = l(!1), [D, i] = y((t == null ? void 0 : t.defaultOpen) ?? !1), [b, d] = y();
10
+ s.current = t;
11
+ const w = a((e) => {
12
+ var r, n;
13
+ c.current || (i(!0), d(e), (n = (r = s.current) == null ? void 0 : r.onShow) == null || n.call(r, e));
14
+ }, []), o = a((e) => {
15
+ var r;
16
+ c.current || (c.current = !0, (r = u.current) == null || r.setAttribute("data-open", "false"), g(u.current, () => {
17
+ var n, C, f, m;
18
+ e !== void 0 ? (C = (n = s.current) == null ? void 0 : n.onConfirm) == null || C.call(n, e) : (m = (f = s.current) == null ? void 0 : f.onCancel) == null || m.call(f), i(!1), d(void 0), c.current = !1;
19
+ }));
20
+ }, []), p = a(() => o(), [o]), O = a((e) => o(e), [o]), S = a(async (e) => {
21
+ c.current = !0;
35
22
  try {
36
23
  return await e;
37
24
  } finally {
38
- s.current = !1;
25
+ c.current = !1;
39
26
  }
40
27
  }, []);
41
28
  return {
42
- props: { ref: a, open: d },
43
- data: w,
44
- show: y,
45
- cancel: L,
46
- confirm: C,
47
- preventClose: D
29
+ props: { ref: u, open: D, requestClose: p },
30
+ data: b,
31
+ show: w,
32
+ cancel: p,
33
+ confirm: O,
34
+ preventClose: S
48
35
  };
49
36
  }
50
37
  export {
51
- S as useDialog
38
+ v as useDialog
52
39
  };
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { DialogProps } from './Dialog';
3
3
  import { DialogOptions, DialogType } from './useDialog';
4
- type ComponentProps<T, R> = Omit<DialogProps, 'children'> & DialogOptions<T, R> & {
4
+ type ComponentProps<T, R> = Omit<DialogProps, 'children' | 'ref' | 'requestClose'> & DialogOptions<T, R> & {
5
5
  children: (dialog: DialogType<T, R>) => React.ReactNode;
6
6
  };
7
7
  export type WithDialogProps<T extends object, R> = T & {
@@ -1,23 +1,23 @@
1
- import { jsxs as i, jsx as l } from "react/jsx-runtime";
2
- import p from "classnames";
3
- import h, { useRef as x, useImperativeHandle as k, useEffect as b } from "react";
1
+ import { jsxs as h, jsx as a } from "react/jsx-runtime";
2
+ import i from "classnames";
3
+ import p, { useRef as x, useImperativeHandle as b, useEffect as k } from "react";
4
4
  import { cssProps as R } from "../../utils/helpers.js";
5
- import { I as y, s as n } from "../../Input-DbQTM4UI.js";
6
- const q = h.forwardRef(
7
- ({ size: c, error: a, label: t, className: f, style: u, required: m, indeterminate: r, ...s }, d) => {
8
- const o = s.checked, e = x(null);
9
- return k(d, () => e.current), b(() => {
10
- r != null && e.current != null && (e.current.indeterminate = !o && r);
11
- }, [e, r, o]), /* @__PURE__ */ i(
5
+ import { I as y, s as l } from "../../Input-D46mAsdt.js";
6
+ const q = p.forwardRef(
7
+ ({ size: c, error: n, label: t, className: u, style: f, required: m, indeterminate: r, ...o }, d) => {
8
+ const s = o.checked, e = x(null);
9
+ return b(d, () => e.current), k(() => {
10
+ r != null && e.current != null && (e.current.indeterminate = !s && r);
11
+ }, [e, r, s]), /* @__PURE__ */ h(
12
12
  "label",
13
13
  {
14
- "data-input": "checkbox",
14
+ "data-checkbox": !0,
15
15
  "data-required": m,
16
- className: p(n.checkbox, f),
17
- style: { ...u, ...R({ size: c }) },
16
+ className: i(l.checkbox, u),
17
+ style: { ...f, ...R({ size: c }) },
18
18
  children: [
19
- /* @__PURE__ */ l(y, { ...s, ref: e, type: "checkbox", size: c, error: a }),
20
- t && /* @__PURE__ */ l("div", { className: n.label, children: t })
19
+ /* @__PURE__ */ a(y, { ...o, ref: e, type: "checkbox", size: c, error: n }),
20
+ t && /* @__PURE__ */ a("div", { "data-checkbox-label": !0, className: l.label, children: t })
21
21
  ]
22
22
  }
23
23
  );
@@ -2,8 +2,8 @@ import "react/jsx-runtime";
2
2
  import "classnames";
3
3
  import "react";
4
4
  import "../../utils/helpers.js";
5
- import "../../ValidationTooltip-BgSwl0hJ.js";
6
- import { I as a } from "../../Input-DbQTM4UI.js";
5
+ import "../../ValidationTooltip-D8d9O6Re.js";
6
+ import { I as a } from "../../Input-D46mAsdt.js";
7
7
  export {
8
8
  a as Input
9
9
  };
@@ -1,4 +1,10 @@
1
1
  import { default as React } from 'react';
2
2
  import { InputProps } from './Input';
3
- export type NumericProps = Omit<InputProps, 'children'>;
4
- export declare const Numeric: React.ForwardRefExoticComponent<NumericProps & React.RefAttributes<HTMLInputElement>>;
3
+ export type NumericProps = Omit<InputProps, 'children'> & {
4
+ labelIncrease?: string;
5
+ labelDecrease?: string;
6
+ };
7
+ export declare const Numeric: React.ForwardRefExoticComponent<Omit<InputProps, "children"> & {
8
+ labelIncrease?: string;
9
+ labelDecrease?: string;
10
+ } & React.RefAttributes<HTMLInputElement>>;
@@ -1,43 +1,43 @@
1
- import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
- import b from "classnames";
3
- import f, { useRef as y, useImperativeHandle as _, useCallback as c } from "react";
1
+ import { jsxs as f, jsx as t } from "react/jsx-runtime";
2
+ import y from "classnames";
3
+ import _, { useRef as h, useImperativeHandle as v, useCallback as c } from "react";
4
4
  import { Icon as i } from "../Icon/Icon.js";
5
5
  import { Button as o } from "../Button/Button.js";
6
- import { I as h } from "../../Input-DbQTM4UI.js";
7
- const v = "styles_numeric_dzUSE", w = "styles_increase_5S-Jo", E = "styles_decrease_j8UR6", s = {
8
- numeric: v,
9
- increase: w,
10
- decrease: E
11
- }, j = f.forwardRef(
12
- ({ className: l, ...a }, u) => {
13
- const e = y(null);
14
- _(u, () => e.current);
15
- const m = c(() => {
6
+ import { I as w } from "../../Input-D46mAsdt.js";
7
+ const E = "styles_numeric_dzUSE", R = "styles_increase_5S-Jo", g = "styles_decrease_j8UR6", s = {
8
+ numeric: E,
9
+ increase: R,
10
+ decrease: g
11
+ }, x = _.forwardRef(
12
+ ({ labelIncrease: l = "increase", labelDecrease: u = "decrease", className: d, ...a }, m) => {
13
+ const e = h(null);
14
+ v(m, () => e.current);
15
+ const p = c(() => {
16
16
  var n, r;
17
17
  (n = e.current) == null || n.stepUp(), (r = e.current) == null || r.dispatchEvent(new Event("change", { bubbles: !0 }));
18
- }, []), d = c(() => {
18
+ }, []), b = c(() => {
19
19
  var n, r;
20
20
  (n = e.current) == null || n.stepDown(), (r = e.current) == null || r.dispatchEvent(new Event("change", { bubbles: !0 }));
21
21
  }, []);
22
- return /* @__PURE__ */ p(
23
- h,
22
+ return /* @__PURE__ */ f(
23
+ w,
24
24
  {
25
25
  ...a,
26
26
  ref: e,
27
27
  type: "number",
28
28
  wrapperType: "numeric",
29
- className: b(s.numeric, l),
29
+ className: y(s.numeric, d),
30
30
  children: [
31
31
  /* @__PURE__ */ t(
32
32
  o,
33
33
  {
34
34
  type: "button",
35
35
  variant: "secondary",
36
- "aria-label": "Increase",
36
+ "aria-label": l,
37
37
  disabled: a.disabled,
38
38
  className: s.increase,
39
39
  icon: /* @__PURE__ */ t(i, { name: "triangle-up" }),
40
- onClick: m
40
+ onClick: p
41
41
  }
42
42
  ),
43
43
  /* @__PURE__ */ t(
@@ -45,11 +45,11 @@ const v = "styles_numeric_dzUSE", w = "styles_increase_5S-Jo", E = "styles_decre
45
45
  {
46
46
  type: "button",
47
47
  variant: "secondary",
48
- "aria-label": "Decrease",
48
+ "aria-label": u,
49
49
  disabled: a.disabled,
50
50
  className: s.decrease,
51
51
  icon: /* @__PURE__ */ t(i, { name: "triangle-down" }),
52
- onClick: d
52
+ onClick: b
53
53
  }
54
54
  )
55
55
  ]
@@ -58,5 +58,5 @@ const v = "styles_numeric_dzUSE", w = "styles_increase_5S-Jo", E = "styles_decre
58
58
  }
59
59
  );
60
60
  export {
61
- j as Numeric
61
+ x as Numeric
62
62
  };