@kolking/react-ui 1.3.0 → 1.5.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-DE1QkW7S.js → Input-DbQTM4UI.js} +39 -29
- package/dist/components/Dialog/Dialog.d.ts +10 -5
- package/dist/components/Dialog/Dialog.js +34 -38
- package/dist/components/Dialog/useDialog.d.ts +2 -3
- package/dist/components/Dialog/useDialog.js +43 -43
- package/dist/components/Fields/Checkbox.js +1 -1
- package/dist/components/Fields/Field.d.ts +1 -1
- package/dist/components/Fields/Field.js +28 -27
- package/dist/components/Fields/Input.d.ts +2 -0
- package/dist/components/Fields/Input.js +1 -1
- package/dist/components/Fields/Numeric.d.ts +4 -0
- package/dist/components/Fields/Numeric.js +62 -0
- package/dist/components/Fields/Radio.js +1 -1
- package/dist/components/Fields/Switch.d.ts +13 -0
- package/dist/components/Fields/Switch.js +36 -0
- package/dist/components/Fields/index.d.ts +2 -1
- package/dist/components/Fields/index.js +13 -11
- package/dist/components/Flex/Flex.d.ts +1 -1
- package/dist/components/Flex/Flex.js +24 -23
- package/dist/components/Segmented/Segmented.js +22 -19
- package/dist/components/ToggleButton/ToggleButton.d.ts +5 -0
- package/dist/components/ToggleButton/ToggleButton.js +16 -0
- package/dist/components/ToggleButton/ToggleGroup.d.ts +12 -0
- package/dist/components/ToggleButton/ToggleGroup.js +43 -0
- package/dist/components/ToggleButton/index.d.ts +2 -0
- package/dist/components/ToggleButton/index.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +60 -54
- package/dist/styles/_theme-default.scss +23 -21
- package/dist/styles/_utils.scss +12 -5
- package/dist/styles/style.css +1 -1
- package/dist/utils/helpers.d.ts +1 -2
- package/dist/utils/helpers.js +21 -23
- package/package.json +1 -1
- package/dist/components/Fields/Quantity.d.ts +0 -7
- package/dist/components/Fields/Quantity.js +0 -61
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as _, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import u from "classnames";
|
|
3
|
-
import
|
|
3
|
+
import h from "react";
|
|
4
4
|
import { cssProps as m } from "./utils/helpers.js";
|
|
5
|
-
import { s as t, V as
|
|
6
|
-
const
|
|
7
|
-
checkbox:
|
|
8
|
-
radio:
|
|
9
|
-
label:
|
|
10
|
-
input:
|
|
5
|
+
import { s as t, V as x } from "./ValidationTooltip-BgSwl0hJ.js";
|
|
6
|
+
const w = "styles_checkbox_pxrU4", v = "styles_radio_0QV8R", k = "styles_label_K65D1", g = "styles_input_j6Qji", N = {
|
|
7
|
+
checkbox: w,
|
|
8
|
+
radio: v,
|
|
9
|
+
label: k,
|
|
10
|
+
input: g
|
|
11
11
|
};
|
|
12
|
-
function
|
|
12
|
+
function j(e) {
|
|
13
13
|
return ![
|
|
14
14
|
"button",
|
|
15
15
|
"checkbox",
|
|
@@ -21,13 +21,13 @@ function N(a) {
|
|
|
21
21
|
"range",
|
|
22
22
|
"reset",
|
|
23
23
|
"submit"
|
|
24
|
-
].includes(
|
|
24
|
+
].includes(e);
|
|
25
25
|
}
|
|
26
|
-
function p(
|
|
27
|
-
switch (
|
|
26
|
+
function p(e) {
|
|
27
|
+
switch (e) {
|
|
28
28
|
case "checkbox":
|
|
29
29
|
case "radio":
|
|
30
|
-
return
|
|
30
|
+
return N.input;
|
|
31
31
|
case "date":
|
|
32
32
|
case "datetime":
|
|
33
33
|
case "datetime-local":
|
|
@@ -45,21 +45,31 @@ function p(a) {
|
|
|
45
45
|
case "image":
|
|
46
46
|
case "color":
|
|
47
47
|
case "file":
|
|
48
|
-
return t[
|
|
48
|
+
return t[e];
|
|
49
49
|
default:
|
|
50
50
|
return t.input;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
const
|
|
54
|
-
({
|
|
55
|
-
|
|
53
|
+
const C = h.forwardRef(
|
|
54
|
+
({
|
|
55
|
+
size: e,
|
|
56
|
+
error: c,
|
|
57
|
+
type: a = "text",
|
|
58
|
+
wrapperType: b = a,
|
|
59
|
+
prefix: i,
|
|
60
|
+
className: o,
|
|
61
|
+
style: d,
|
|
62
|
+
children: n,
|
|
63
|
+
...r
|
|
64
|
+
}, l) => {
|
|
65
|
+
const f = j(a) && (i || n) ? /* @__PURE__ */ _(
|
|
56
66
|
"div",
|
|
57
67
|
{
|
|
58
|
-
"data-input-wrapper":
|
|
68
|
+
"data-input-wrapper": b,
|
|
59
69
|
"data-disabled": r.disabled,
|
|
60
70
|
"data-invalid": c ? !0 : void 0,
|
|
61
71
|
className: u(t.wrapper, o),
|
|
62
|
-
style: { ...d, ...m({ size:
|
|
72
|
+
style: { ...d, ...m({ size: e }) },
|
|
63
73
|
children: [
|
|
64
74
|
i && /* @__PURE__ */ s("div", { "data-input-prefix": !0, className: t.wrapper_prefix, children: i }),
|
|
65
75
|
/* @__PURE__ */ s(
|
|
@@ -67,9 +77,9 @@ const Q = _.forwardRef(
|
|
|
67
77
|
{
|
|
68
78
|
...r,
|
|
69
79
|
ref: l,
|
|
70
|
-
type:
|
|
71
|
-
"data-input":
|
|
72
|
-
className: p(
|
|
80
|
+
type: a,
|
|
81
|
+
"data-input": a,
|
|
82
|
+
className: p(a)
|
|
73
83
|
}
|
|
74
84
|
),
|
|
75
85
|
n && /* @__PURE__ */ s("div", { "data-input-accessory": !0, className: t.wrapper_accessory, children: n })
|
|
@@ -80,17 +90,17 @@ const Q = _.forwardRef(
|
|
|
80
90
|
{
|
|
81
91
|
...r,
|
|
82
92
|
ref: l,
|
|
83
|
-
type:
|
|
84
|
-
"data-input":
|
|
93
|
+
type: a,
|
|
94
|
+
"data-input": a,
|
|
85
95
|
"data-invalid": c ? !0 : void 0,
|
|
86
|
-
className: u(p(
|
|
87
|
-
style: { ...d, ...m({ size:
|
|
96
|
+
className: u(p(a), o),
|
|
97
|
+
style: { ...d, ...m({ size: e }) }
|
|
88
98
|
}
|
|
89
99
|
);
|
|
90
|
-
return /* @__PURE__ */ s(
|
|
100
|
+
return /* @__PURE__ */ s(x, { content: c, children: f });
|
|
91
101
|
}
|
|
92
102
|
);
|
|
93
103
|
export {
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
C as I,
|
|
105
|
+
N as s
|
|
96
106
|
};
|
|
@@ -1,10 +1,15 @@
|
|
|
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> & {
|
|
5
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
6
|
width?: React.CSSProperties['width'];
|
|
5
7
|
};
|
|
6
|
-
export declare const Dialog: React.ForwardRefExoticComponent<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export declare const Dialog: React.ForwardRefExoticComponent<React.DialogHTMLAttributes<HTMLDialogElement> & {
|
|
9
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
10
|
+
width?: React.CSSProperties["width"];
|
|
11
|
+
} & React.RefAttributes<HTMLDialogElement>>;
|
|
12
|
+
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;
|
|
10
15
|
export declare const DialogClose: ({ className, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,57 +1,53 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { Button as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
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
10
|
dialog: _,
|
|
11
|
-
|
|
12
|
-
footer:
|
|
13
|
-
close:
|
|
14
|
-
},
|
|
15
|
-
({ open: o = !1, width:
|
|
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
16
|
"dialog",
|
|
17
17
|
{
|
|
18
|
-
...
|
|
18
|
+
...d,
|
|
19
19
|
ref: n,
|
|
20
20
|
"data-floating-root": !0,
|
|
21
21
|
"data-dialog": o ? "open" : "closed",
|
|
22
|
-
className:
|
|
23
|
-
style: { ...
|
|
24
|
-
children: c
|
|
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
25
|
}
|
|
26
26
|
) })
|
|
27
|
-
),
|
|
27
|
+
), T = ({ className: o, children: a, ...r }) => /* @__PURE__ */ t(f, { as: "h4", ...r, "data-dialog-title": !0, title: a, className: o }), j = ({
|
|
28
28
|
className: o,
|
|
29
|
-
children:
|
|
30
|
-
...
|
|
31
|
-
}) => /* @__PURE__ */
|
|
29
|
+
children: a,
|
|
30
|
+
...r
|
|
31
|
+
}) => /* @__PURE__ */ t("div", { ...r, "data-dialog-content": !0, className: o, children: a }), k = ({
|
|
32
32
|
className: o,
|
|
33
|
-
children:
|
|
34
|
-
...
|
|
35
|
-
}) => /* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
children: t,
|
|
38
|
-
...a
|
|
39
|
-
}) => /* @__PURE__ */ e("div", { ...a, "data-dialog-footer": !0, className: l(i.footer, o), children: t }), j = ({ className: o, ...t }) => /* @__PURE__ */ e(
|
|
40
|
-
m,
|
|
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,
|
|
41
37
|
{
|
|
42
|
-
...
|
|
38
|
+
...a,
|
|
43
39
|
type: "button",
|
|
44
40
|
variant: "tertiary",
|
|
45
41
|
"data-dialog-close": !0,
|
|
46
42
|
"aria-label": "dismiss dialog",
|
|
47
|
-
icon: /* @__PURE__ */
|
|
48
|
-
className:
|
|
43
|
+
icon: /* @__PURE__ */ t(m, { name: "close" }),
|
|
44
|
+
className: i(e.close, o)
|
|
49
45
|
}
|
|
50
46
|
);
|
|
51
47
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
F as Dialog,
|
|
49
|
+
G as DialogClose,
|
|
50
|
+
j as DialogContent,
|
|
51
|
+
k as DialogFooter,
|
|
52
|
+
T as DialogTitle
|
|
57
53
|
};
|
|
@@ -11,9 +11,8 @@ export declare function useDialog<T, R>(options?: DialogOptions<T, R>): {
|
|
|
11
11
|
open: boolean;
|
|
12
12
|
};
|
|
13
13
|
data: T | undefined;
|
|
14
|
-
disabled: boolean;
|
|
15
14
|
show: (values: T) => void;
|
|
16
|
-
disable: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
17
|
-
confirm: (values: R) => void;
|
|
18
15
|
cancel: () => void;
|
|
16
|
+
confirm: (values: R) => void;
|
|
17
|
+
preventClose: <T_1>(promise: Promise<T_1>) => Promise<T_1>;
|
|
19
18
|
};
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const
|
|
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
6
|
var n, t;
|
|
7
|
-
|
|
8
|
-
}, []), c =
|
|
9
|
-
(
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
));
|
|
19
|
-
},
|
|
20
|
-
[l]
|
|
21
|
-
);
|
|
22
|
-
return m(() => {
|
|
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(() => {
|
|
23
18
|
var e, n;
|
|
24
|
-
|
|
25
|
-
}, [
|
|
26
|
-
const e =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
};
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
}, [c]);
|
|
33
|
+
const L = u(() => c(), [c]), C = u((e) => c(e), [c]), D = u(async (e) => {
|
|
34
|
+
s.current = !0;
|
|
35
|
+
try {
|
|
36
|
+
return await e;
|
|
37
|
+
} finally {
|
|
38
|
+
s.current = !1;
|
|
35
39
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
}, [d, c]), {
|
|
41
|
-
props: { ref: s, open: l },
|
|
40
|
+
}, []);
|
|
41
|
+
return {
|
|
42
|
+
props: { ref: a, open: d },
|
|
42
43
|
data: w,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
cancel: f(() => c(), [c])
|
|
44
|
+
show: y,
|
|
45
|
+
cancel: L,
|
|
46
|
+
confirm: C,
|
|
47
|
+
preventClose: D
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
export {
|
|
51
|
-
|
|
51
|
+
S as useDialog
|
|
52
52
|
};
|
|
@@ -2,7 +2,7 @@ import { jsxs as i, jsx as l } from "react/jsx-runtime";
|
|
|
2
2
|
import p from "classnames";
|
|
3
3
|
import h, { useRef as x, useImperativeHandle as k, useEffect as b } from "react";
|
|
4
4
|
import { cssProps as R } from "../../utils/helpers.js";
|
|
5
|
-
import { I as y, s as n } from "../../Input-
|
|
5
|
+
import { I as y, s as n } from "../../Input-DbQTM4UI.js";
|
|
6
6
|
const q = h.forwardRef(
|
|
7
7
|
({ size: c, error: a, label: t, className: f, style: u, required: m, indeterminate: r, ...s }, d) => {
|
|
8
8
|
const o = s.checked, e = x(null);
|
|
@@ -17,4 +17,4 @@ export declare const FieldLabel: ({ label, required, className, children, ...pro
|
|
|
17
17
|
export type FieldDescriptionProps = React.HTMLAttributes<HTMLDivElement>;
|
|
18
18
|
export declare const FieldDescription: ({ className, children, ...props }: FieldDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
19
|
export type FieldProps = React.HTMLAttributes<HTMLDivElement> & FieldConfig;
|
|
20
|
-
export declare const Field: ({ id, label, labelAccessory, help, required, minWidth, maxWidth, className, children, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const Field: ({ id, label, labelAccessory, help, required, minWidth, maxWidth, className, children, style, ...props }: FieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import d from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import { cssProps as
|
|
5
|
-
const
|
|
6
|
-
field:
|
|
7
|
-
header:
|
|
8
|
-
label:
|
|
9
|
-
accessory:
|
|
10
|
-
description:
|
|
11
|
-
},
|
|
3
|
+
import _ from "react";
|
|
4
|
+
import { cssProps as p } from "../../utils/helpers.js";
|
|
5
|
+
const u = "styles_field_hqzKT", b = "styles_header_Iwsz6", N = "styles_label_zRVTS", F = "styles_accessory_S4ccn", v = "styles_description_fZnNW", a = {
|
|
6
|
+
field: u,
|
|
7
|
+
header: b,
|
|
8
|
+
label: N,
|
|
9
|
+
accessory: F,
|
|
10
|
+
description: v
|
|
11
|
+
}, x = ({ label: e, required: s, className: l, children: t, ...c }) => /* @__PURE__ */ i("div", { "data-field-header": !0, className: a.header, children: [
|
|
12
12
|
/* @__PURE__ */ r(
|
|
13
13
|
"label",
|
|
14
14
|
{
|
|
@@ -19,34 +19,35 @@ const p = "styles_field_hqzKT", u = "styles_header_Iwsz6", b = "styles_label_zRV
|
|
|
19
19
|
children: e
|
|
20
20
|
}
|
|
21
21
|
),
|
|
22
|
-
|
|
23
|
-
] }),
|
|
22
|
+
_.Children.toArray(t).length > 0 && /* @__PURE__ */ r("div", { "data-field-accessory": !0, className: a.accessory, children: t })
|
|
23
|
+
] }), z = ({ className: e, children: s, ...l }) => /* @__PURE__ */ r("small", { ...l, "data-field-description": !0, className: d(a.description, e), children: s }), T = ({
|
|
24
24
|
id: e,
|
|
25
25
|
label: s,
|
|
26
26
|
labelAccessory: l,
|
|
27
27
|
help: t,
|
|
28
28
|
required: c,
|
|
29
|
-
minWidth:
|
|
30
|
-
maxWidth:
|
|
31
|
-
className:
|
|
32
|
-
children:
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
minWidth: o,
|
|
30
|
+
maxWidth: n,
|
|
31
|
+
className: f,
|
|
32
|
+
children: m,
|
|
33
|
+
style: y,
|
|
34
|
+
...h
|
|
35
|
+
}) => /* @__PURE__ */ i(
|
|
35
36
|
"div",
|
|
36
37
|
{
|
|
37
|
-
...
|
|
38
|
+
...h,
|
|
38
39
|
"data-field": e || !0,
|
|
39
|
-
className: d(a.field,
|
|
40
|
-
style: { ...
|
|
40
|
+
className: d(a.field, f),
|
|
41
|
+
style: { ...y, ...p({ minWidth: o, maxWidth: n }) },
|
|
41
42
|
children: [
|
|
42
|
-
s && /* @__PURE__ */ r(
|
|
43
|
-
|
|
44
|
-
t && /* @__PURE__ */ r(
|
|
43
|
+
s && /* @__PURE__ */ r(x, { htmlFor: e, label: s, required: c, children: l }),
|
|
44
|
+
m,
|
|
45
|
+
t && /* @__PURE__ */ r(z, { children: t })
|
|
45
46
|
]
|
|
46
47
|
}
|
|
47
48
|
);
|
|
48
49
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
T as Field,
|
|
51
|
+
z as FieldDescription,
|
|
52
|
+
x as FieldLabel
|
|
52
53
|
};
|
|
@@ -4,8 +4,10 @@ export type BaseInputProps<T = React.InputHTMLAttributes<HTMLInputElement>> = Om
|
|
|
4
4
|
error?: string;
|
|
5
5
|
};
|
|
6
6
|
export type InputProps = Omit<BaseInputProps, 'prefix'> & {
|
|
7
|
+
wrapperType?: string;
|
|
7
8
|
prefix?: React.ReactNode;
|
|
8
9
|
};
|
|
9
10
|
export declare const Input: React.ForwardRefExoticComponent<Omit<BaseInputProps<React.InputHTMLAttributes<HTMLInputElement>>, "prefix"> & {
|
|
11
|
+
wrapperType?: string;
|
|
10
12
|
prefix?: React.ReactNode;
|
|
11
13
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,62 @@
|
|
|
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";
|
|
4
|
+
import { Icon as i } from "../Icon/Icon.js";
|
|
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(() => {
|
|
16
|
+
var n, r;
|
|
17
|
+
(n = e.current) == null || n.stepUp(), (r = e.current) == null || r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
18
|
+
}, []), d = c(() => {
|
|
19
|
+
var n, r;
|
|
20
|
+
(n = e.current) == null || n.stepDown(), (r = e.current) == null || r.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
21
|
+
}, []);
|
|
22
|
+
return /* @__PURE__ */ p(
|
|
23
|
+
h,
|
|
24
|
+
{
|
|
25
|
+
...a,
|
|
26
|
+
ref: e,
|
|
27
|
+
type: "number",
|
|
28
|
+
wrapperType: "numeric",
|
|
29
|
+
className: b(s.numeric, l),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ t(
|
|
32
|
+
o,
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
variant: "secondary",
|
|
36
|
+
"aria-label": "Increase",
|
|
37
|
+
disabled: a.disabled,
|
|
38
|
+
className: s.increase,
|
|
39
|
+
icon: /* @__PURE__ */ t(i, { name: "triangle-up" }),
|
|
40
|
+
onClick: m
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ t(
|
|
44
|
+
o,
|
|
45
|
+
{
|
|
46
|
+
type: "button",
|
|
47
|
+
variant: "secondary",
|
|
48
|
+
"aria-label": "Decrease",
|
|
49
|
+
disabled: a.disabled,
|
|
50
|
+
className: s.decrease,
|
|
51
|
+
icon: /* @__PURE__ */ t(i, { name: "triangle-down" }),
|
|
52
|
+
onClick: d
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
export {
|
|
61
|
+
j as Numeric
|
|
62
|
+
};
|
|
@@ -2,7 +2,7 @@ import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import c from "classnames";
|
|
3
3
|
import f from "react";
|
|
4
4
|
import { cssProps as n } from "../../utils/helpers.js";
|
|
5
|
-
import { I as u, s } from "../../Input-
|
|
5
|
+
import { I as u, s } from "../../Input-DbQTM4UI.js";
|
|
6
6
|
const I = f.forwardRef(
|
|
7
7
|
({ size: r, error: t, label: a, className: e, style: i, required: d, ...m }, p) => /* @__PURE__ */ l(
|
|
8
8
|
"label",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseInputProps } from './Input';
|
|
3
|
+
export type SwitchProps = BaseInputProps & {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
checkedColor?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const Switch: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
9
|
+
error?: string;
|
|
10
|
+
} & {
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
checkedColor?: string;
|
|
13
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import m from "react";
|
|
3
|
+
import u from "classnames";
|
|
4
|
+
import { cssProps as h } from "../../utils/helpers.js";
|
|
5
|
+
import { V as f } from "../../ValidationTooltip-BgSwl0hJ.js";
|
|
6
|
+
const _ = "styles_label_p-D4Y", w = "styles_input_VteBP", s = {
|
|
7
|
+
switch: "styles_switch_UNvH8",
|
|
8
|
+
label: _,
|
|
9
|
+
input: w
|
|
10
|
+
}, V = m.forwardRef(
|
|
11
|
+
({ size: a, error: i, label: e, required: l, checkedColor: o, className: c, style: n, ...r }, p) => /* @__PURE__ */ d(
|
|
12
|
+
"label",
|
|
13
|
+
{
|
|
14
|
+
"data-input": "switch",
|
|
15
|
+
"data-required": l,
|
|
16
|
+
className: u(s.switch, c),
|
|
17
|
+
style: { ...n, ...h({ size: a, checkedColor: o }) },
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ t(f, { content: i, children: /* @__PURE__ */ t(
|
|
20
|
+
"input",
|
|
21
|
+
{
|
|
22
|
+
...r,
|
|
23
|
+
ref: p,
|
|
24
|
+
type: "checkbox",
|
|
25
|
+
"data-invalid": i ? !0 : void 0,
|
|
26
|
+
className: s.input
|
|
27
|
+
}
|
|
28
|
+
) }),
|
|
29
|
+
e && /* @__PURE__ */ t("div", { className: s.label, children: e })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
export {
|
|
35
|
+
V as Switch
|
|
36
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export * from './Checkbox';
|
|
2
2
|
export * from './Field';
|
|
3
3
|
export * from './Input';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './Numeric';
|
|
5
5
|
export * from './Radio';
|
|
6
6
|
export * from './Select';
|
|
7
|
+
export * from './Switch';
|
|
7
8
|
export * from './Textarea';
|
|
8
9
|
export * from './ValidationTooltip';
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { Checkbox as
|
|
1
|
+
import { Checkbox as e } from "./Checkbox.js";
|
|
2
2
|
import { Field as p, FieldDescription as i, FieldLabel as x } from "./Field.js";
|
|
3
|
-
import { I as f } from "../../Input-
|
|
4
|
-
import {
|
|
5
|
-
import { Radio as
|
|
3
|
+
import { I as f } from "../../Input-DbQTM4UI.js";
|
|
4
|
+
import { Numeric as l } from "./Numeric.js";
|
|
5
|
+
import { Radio as d } from "./Radio.js";
|
|
6
6
|
import { Select as s } from "./Select.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Switch as b } from "./Switch.js";
|
|
8
|
+
import { Textarea as u } from "./Textarea.js";
|
|
9
|
+
import { V as S } from "../../ValidationTooltip-BgSwl0hJ.js";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
+
e as Checkbox,
|
|
11
12
|
p as Field,
|
|
12
13
|
i as FieldDescription,
|
|
13
14
|
x as FieldLabel,
|
|
14
15
|
f as Input,
|
|
15
|
-
l as
|
|
16
|
-
|
|
16
|
+
l as Numeric,
|
|
17
|
+
d as Radio,
|
|
17
18
|
s as Select,
|
|
18
|
-
b as
|
|
19
|
-
|
|
19
|
+
b as Switch,
|
|
20
|
+
u as Textarea,
|
|
21
|
+
S as ValidationTooltip
|
|
20
22
|
};
|
|
@@ -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>>, "direction" | "as" | "align" | "wrap" | "justify" | "
|
|
22
|
+
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "direction" | "as" | "align" | "wrap" | "justify" | "marginStart" | "marginEnd" | "gap"> & React.RefAttributes<unknown>) => React.ReactElement | null;
|