@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.
- package/dist/{Input-DbQTM4UI.js → Input-D46mAsdt.js} +1 -1
- package/dist/ValidationTooltip-D8d9O6Re.js +31 -0
- package/dist/components/Avatar/Avatar.js +29 -20
- package/dist/components/Badge/Badge.js +11 -11
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +13 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +40 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/Breadcrumbs/index.js +4 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Dialog/Dialog.d.ts +9 -5
- package/dist/components/Dialog/Dialog.js +68 -45
- package/dist/components/Dialog/useDialog.d.ts +2 -1
- package/dist/components/Dialog/useDialog.js +29 -42
- package/dist/components/Dialog/withDialog.d.ts +1 -1
- package/dist/components/Fields/Checkbox.js +15 -15
- package/dist/components/Fields/Input.js +2 -2
- package/dist/components/Fields/Numeric.d.ts +8 -2
- package/dist/components/Fields/Numeric.js +22 -22
- package/dist/components/Fields/Radio.js +11 -11
- package/dist/components/Fields/Range.d.ts +20 -0
- package/dist/components/Fields/Range.js +54 -0
- package/dist/components/Fields/Select.js +1 -1
- package/dist/components/Fields/Switch.js +11 -11
- package/dist/components/Fields/Textarea.js +1 -1
- package/dist/components/Fields/ValidationTooltip.d.ts +1 -1
- package/dist/components/Fields/ValidationTooltip.js +3 -2
- package/dist/components/Fields/index.d.ts +1 -0
- package/dist/components/Fields/index.js +14 -12
- package/dist/components/Heading/Heading.js +12 -12
- package/dist/components/Icon/Icon.js +7 -7
- package/dist/components/Menu/Menu.d.ts +6 -2
- package/dist/components/Menu/Menu.js +57 -51
- package/dist/components/Menu/MenuContext.d.ts +1 -0
- package/dist/components/Menu/MenuItem.d.ts +2 -3
- package/dist/components/Menu/MenuItem.js +23 -29
- package/dist/components/Notice/Notice.js +30 -30
- package/dist/components/Progress/ProgressBar.js +30 -23
- package/dist/components/Progress/ProgressCircular.js +13 -12
- package/dist/components/Segmented/Segmented.js +42 -34
- package/dist/components/Spinner/Spinner.js +1 -1
- package/dist/components/Tag/Tag.js +12 -12
- package/dist/components/ToggleButton/ToggleButton.d.ts +15 -1
- package/dist/components/ToggleButton/ToggleButton.js +17 -12
- package/dist/components/ToggleButton/ToggleGroup.js +34 -31
- package/dist/components/Tooltip/Tooltip.d.ts +2 -1
- package/dist/components/Tooltip/Tooltip.js +59 -56
- package/dist/index.d.ts +1 -0
- package/dist/index.js +66 -62
- package/dist/styles/_theme-default.scss +36 -35
- package/dist/styles/style.css +1 -1
- package/dist/styles.module-D1F3R7Vi.js +11 -0
- package/dist/utils/helpers.d.ts +1 -1
- package/dist/utils/helpers.js +3 -3
- package/package.json +3 -1
- package/dist/ValidationTooltip-BgSwl0hJ.js +0 -30
- package/dist/components/Dialog/DialogFocusTrap.d.ts +0 -2
- package/dist/components/Dialog/DialogFocusTrap.js +0 -17
- 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-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import { forwardRef as
|
|
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,
|
|
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:
|
|
10
|
-
|
|
9
|
+
image: I,
|
|
10
|
+
initials: P,
|
|
11
11
|
default: "Avatar_default_v75Mg"
|
|
12
12
|
}, J = ({
|
|
13
13
|
size: a = 50,
|
|
14
|
-
name:
|
|
14
|
+
name: t,
|
|
15
15
|
email: o,
|
|
16
|
-
src:
|
|
16
|
+
src: c,
|
|
17
17
|
colorize: v,
|
|
18
18
|
className: d,
|
|
19
|
-
style:
|
|
20
|
-
children:
|
|
19
|
+
style: u,
|
|
20
|
+
children: g,
|
|
21
21
|
...f
|
|
22
22
|
}) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
28
|
+
n(void 0);
|
|
29
29
|
}, []);
|
|
30
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ _(
|
|
31
31
|
"div",
|
|
32
32
|
{
|
|
33
33
|
...f,
|
|
34
34
|
"data-avatar": !0,
|
|
35
|
-
className:
|
|
36
|
-
style: { ...
|
|
35
|
+
className: h(e.avatar, d),
|
|
36
|
+
style: { ...u, ...C({ size: a, backgroundColor: p }) },
|
|
37
37
|
children: [
|
|
38
|
-
|
|
39
|
-
|
|
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 = "
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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';
|
|
@@ -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.
|
|
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.
|
|
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
|
-
|
|
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: (
|
|
14
|
-
export declare const DialogFooter: ({ className,
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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<
|
|
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
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}, [
|
|
21
|
-
|
|
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
|
-
|
|
25
|
+
c.current = !1;
|
|
39
26
|
}
|
|
40
27
|
}, []);
|
|
41
28
|
return {
|
|
42
|
-
props: { ref:
|
|
43
|
-
data:
|
|
44
|
-
show:
|
|
45
|
-
cancel:
|
|
46
|
-
confirm:
|
|
47
|
-
preventClose:
|
|
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
|
-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
|
6
|
-
const q =
|
|
7
|
-
({ size: c, error:
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
r != null && e.current != null && (e.current.indeterminate = !
|
|
11
|
-
}, [e, r,
|
|
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-
|
|
14
|
+
"data-checkbox": !0,
|
|
15
15
|
"data-required": m,
|
|
16
|
-
className:
|
|
17
|
-
style: { ...
|
|
16
|
+
className: i(l.checkbox, u),
|
|
17
|
+
style: { ...f, ...R({ size: c }) },
|
|
18
18
|
children: [
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
t && /* @__PURE__ */
|
|
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-
|
|
6
|
-
import { I as a } from "../../Input-
|
|
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
|
-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
|
7
|
-
const
|
|
8
|
-
numeric:
|
|
9
|
-
increase:
|
|
10
|
-
decrease:
|
|
11
|
-
},
|
|
12
|
-
({
|
|
13
|
-
const e =
|
|
14
|
-
|
|
15
|
-
const
|
|
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
|
-
}, []),
|
|
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__ */
|
|
23
|
-
|
|
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:
|
|
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":
|
|
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:
|
|
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":
|
|
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:
|
|
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
|
-
|
|
61
|
+
x as Numeric
|
|
62
62
|
};
|