@kolking/react-ui 1.5.0 → 1.6.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/Breadcrumbs/Breadcrumbs.d.ts +11 -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 +67 -44
- 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 +1 -1
- package/dist/components/Fields/Input.js +2 -2
- package/dist/components/Fields/Numeric.js +1 -1
- package/dist/components/Fields/Radio.js +1 -1
- 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 +5 -5
- 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/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/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/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 +2 -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
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type Breadcrumb = React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
3
|
+
label: React.ReactNode;
|
|
4
|
+
};
|
|
5
|
+
export type BreadcrumbsProps = React.HTMLAttributes<HTMLOListElement> & {
|
|
6
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
items: Breadcrumb[];
|
|
8
|
+
separator?: React.ReactNode;
|
|
9
|
+
margin?: React.CSSProperties['margin'];
|
|
10
|
+
};
|
|
11
|
+
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 i } from "react/jsx-runtime";
|
|
2
|
+
import p from "classnames";
|
|
3
|
+
import { cssProps as h } from "../../utils/helpers.js";
|
|
4
|
+
const f = "Breadcrumbs_breadcrumbs_a3ubb", g = {
|
|
5
|
+
breadcrumbs: f
|
|
6
|
+
}, _ = ({
|
|
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: p(g.breadcrumbs, o),
|
|
20
|
+
style: { ...m, ...h({ size: t, margin: d }) },
|
|
21
|
+
children: s.map(({ label: u, ...e }, r) => {
|
|
22
|
+
const c = r === s.length - 1, l = e.href ? "a" : "span";
|
|
23
|
+
return /* @__PURE__ */ i("li", { children: [
|
|
24
|
+
/* @__PURE__ */ a(
|
|
25
|
+
l,
|
|
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
|
+
_ 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 { Icon as L } from "../Icon/Icon.js";
|
|
7
|
+
import { Button as N } from "../Button/Button.js";
|
|
8
|
+
import { Heading as b } from "../Heading/Heading.js";
|
|
9
|
+
import { cssProps as w } from "../../utils/helpers.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: m, className: g, 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, g),
|
|
48
|
+
style: { ...m, ...w({ 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
|
-
...
|
|
61
|
+
...e,
|
|
39
62
|
type: "button",
|
|
40
63
|
variant: "tertiary",
|
|
41
64
|
"data-dialog-close": !0,
|
|
42
65
|
"aria-label": "dismiss dialog",
|
|
43
|
-
icon: /* @__PURE__ */
|
|
44
|
-
className: i
|
|
66
|
+
icon: /* @__PURE__ */ o(L, { name: "close" }),
|
|
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 & {
|
|
@@ -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-D46mAsdt.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);
|
|
@@ -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
|
};
|
|
@@ -3,7 +3,7 @@ import b from "classnames";
|
|
|
3
3
|
import f, { useRef as y, useImperativeHandle as _, 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-
|
|
6
|
+
import { I as h } from "../../Input-D46mAsdt.js";
|
|
7
7
|
const v = "styles_numeric_dzUSE", w = "styles_increase_5S-Jo", E = "styles_decrease_j8UR6", s = {
|
|
8
8
|
numeric: v,
|
|
9
9
|
increase: w,
|
|
@@ -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-D46mAsdt.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,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseInputProps } from './Input';
|
|
3
|
+
type TickMarksProps = {
|
|
4
|
+
ticks: number | (string | number)[];
|
|
5
|
+
};
|
|
6
|
+
export type RangeProps = Omit<BaseInputProps, 'min' | 'max' | 'value' | 'defaultValue'> & {
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
value?: number;
|
|
10
|
+
defaultValue?: number;
|
|
11
|
+
ticks?: TickMarksProps['ticks'];
|
|
12
|
+
};
|
|
13
|
+
export declare const Range: React.ForwardRefExoticComponent<Omit<BaseInputProps, "max" | "min" | "defaultValue" | "value"> & {
|
|
14
|
+
min?: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
value?: number;
|
|
17
|
+
defaultValue?: number;
|
|
18
|
+
ticks?: TickMarksProps["ticks"];
|
|
19
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs as g, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import R from "classnames";
|
|
3
|
+
import w, { useRef as x, useState as T, useEffect as j, useCallback as P } from "react";
|
|
4
|
+
import { V } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
5
|
+
import { cssProps as A, wrapNode as E } from "../../utils/helpers.js";
|
|
6
|
+
const J = "styles_range_j9iED", D = "styles_range_thumb_6aftN", F = "styles_range_wrapper_LTcAf", H = "styles_range_track_HdlJx", L = "styles_ticks_YaeJb", n = {
|
|
7
|
+
range: J,
|
|
8
|
+
range_thumb: D,
|
|
9
|
+
range_wrapper: F,
|
|
10
|
+
range_track: H,
|
|
11
|
+
ticks: L
|
|
12
|
+
};
|
|
13
|
+
function f(r, a, e, s) {
|
|
14
|
+
r == null || r.style.setProperty("--progress", `${(s - a) / (e - a)}`);
|
|
15
|
+
}
|
|
16
|
+
const M = ({ ticks: r }) => {
|
|
17
|
+
const a = typeof r == "number" ? [...Array(r)] : r;
|
|
18
|
+
return a.length < 2 ? null : /* @__PURE__ */ t("ul", { "data-range-ticks": !0, className: n.ticks, children: a.map((e, s) => /* @__PURE__ */ t("li", { children: e !== void 0 && /* @__PURE__ */ t("small", { children: e }) }, s)) });
|
|
19
|
+
}, B = w.forwardRef(
|
|
20
|
+
({ size: r, height: a, error: e, ticks: s, className: m, style: y, children: u, onChange: c, ...i }, h) => {
|
|
21
|
+
const { min: l = 0, max: o = 100, defaultValue: v = 50, value: p = v } = i, d = x(null), [k, b] = T(null);
|
|
22
|
+
j(() => {
|
|
23
|
+
f(d.current, l, o, p);
|
|
24
|
+
}, [l, o, p]);
|
|
25
|
+
const N = P(
|
|
26
|
+
(_) => {
|
|
27
|
+
f(d.current, l, o, parseFloat(_.currentTarget.value)), c == null || c(_);
|
|
28
|
+
},
|
|
29
|
+
[l, o, c]
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ g(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
ref: d,
|
|
35
|
+
"data-input": "range",
|
|
36
|
+
"data-disabled": i.disabled,
|
|
37
|
+
"data-invalid": e ? !0 : void 0,
|
|
38
|
+
className: R(n.range, m),
|
|
39
|
+
style: { ...y, ...A({ size: r, height: a }) },
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ g("div", { className: n.range_wrapper, children: [
|
|
42
|
+
/* @__PURE__ */ t("div", { "data-range-track": !0, className: n.range_track }),
|
|
43
|
+
/* @__PURE__ */ t("div", { ref: b, "data-range-thumb": !0, className: n.range_thumb, children: u !== void 0 && E(u, "small") }),
|
|
44
|
+
/* @__PURE__ */ t(V, { content: e, placement: "top", anchor: k, children: /* @__PURE__ */ t("input", { ...i, ref: h, type: "range", onChange: N }) })
|
|
45
|
+
] }),
|
|
46
|
+
s !== void 0 && /* @__PURE__ */ t(M, { ticks: s })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
export {
|
|
53
|
+
B as Range
|
|
54
|
+
};
|
|
@@ -2,7 +2,7 @@ import { jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import l from "classnames";
|
|
3
3
|
import c from "react";
|
|
4
4
|
import { cssProps as m } from "../../utils/helpers.js";
|
|
5
|
-
import { V as d, s as f } from "../../ValidationTooltip-
|
|
5
|
+
import { V as d, s as f } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
6
6
|
const y = c.forwardRef(
|
|
7
7
|
({ size: o, error: t, className: s, style: a, ...r }, i) => /* @__PURE__ */ e(d, { content: t, children: /* @__PURE__ */ e(
|
|
8
8
|
"select",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import m from "react";
|
|
3
|
-
import
|
|
4
|
-
import { cssProps as
|
|
5
|
-
import { V as f } from "../../ValidationTooltip-
|
|
3
|
+
import h from "classnames";
|
|
4
|
+
import { cssProps as u } from "../../utils/helpers.js";
|
|
5
|
+
import { V as f } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
6
6
|
const _ = "styles_label_p-D4Y", w = "styles_input_VteBP", s = {
|
|
7
7
|
switch: "styles_switch_UNvH8",
|
|
8
8
|
label: _,
|
|
@@ -13,8 +13,8 @@ const _ = "styles_label_p-D4Y", w = "styles_input_VteBP", s = {
|
|
|
13
13
|
{
|
|
14
14
|
"data-input": "switch",
|
|
15
15
|
"data-required": l,
|
|
16
|
-
className:
|
|
17
|
-
style: { ...n, ...
|
|
16
|
+
className: h(s.switch, c),
|
|
17
|
+
style: { ...n, ...u({ size: a, checkedColor: o }) },
|
|
18
18
|
children: [
|
|
19
19
|
/* @__PURE__ */ t(f, { content: i, children: /* @__PURE__ */ t(
|
|
20
20
|
"input",
|
|
@@ -3,7 +3,7 @@ import c from "classnames";
|
|
|
3
3
|
import d from "react";
|
|
4
4
|
import f from "react-textarea-autosize";
|
|
5
5
|
import { cssProps as l } from "../../utils/helpers.js";
|
|
6
|
-
import { V as x, s as u } from "../../ValidationTooltip-
|
|
6
|
+
import { V as x, s as u } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
7
7
|
const _ = d.forwardRef(
|
|
8
8
|
({ autosize: t = !0, size: e, error: o, className: s, style: m, ...a }, i) => {
|
|
9
9
|
const n = t ? f : "textarea", p = t ? { minRows: 2, ...a } : a;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TooltipProps } from '../Tooltip';
|
|
2
|
-
export declare const ValidationTooltip: (props: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const ValidationTooltip: ({ className, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
+
import "classnames";
|
|
2
3
|
import "../Tooltip/Tooltip.js";
|
|
3
|
-
import { V as
|
|
4
|
+
import { V as m } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
+
m as ValidationTooltip
|
|
6
7
|
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { Checkbox as e } from "./Checkbox.js";
|
|
2
|
-
import { Field as p, FieldDescription as
|
|
3
|
-
import { I as f } from "../../Input-
|
|
2
|
+
import { Field as p, FieldDescription as x, FieldLabel as i } from "./Field.js";
|
|
3
|
+
import { I as f } from "../../Input-D46mAsdt.js";
|
|
4
4
|
import { Numeric as l } from "./Numeric.js";
|
|
5
5
|
import { Radio as d } from "./Radio.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { Range as s } from "./Range.js";
|
|
7
|
+
import { Select as b } from "./Select.js";
|
|
8
|
+
import { Switch as u } from "./Switch.js";
|
|
9
|
+
import { Textarea as R } from "./Textarea.js";
|
|
10
|
+
import { V as T } from "../../ValidationTooltip-D8d9O6Re.js";
|
|
10
11
|
export {
|
|
11
12
|
e as Checkbox,
|
|
12
13
|
p as Field,
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
x as FieldDescription,
|
|
15
|
+
i as FieldLabel,
|
|
15
16
|
f as Input,
|
|
16
17
|
l as Numeric,
|
|
17
18
|
d as Radio,
|
|
18
|
-
s as
|
|
19
|
-
b as
|
|
20
|
-
u as
|
|
21
|
-
|
|
19
|
+
s as Range,
|
|
20
|
+
b as Select,
|
|
21
|
+
u as Switch,
|
|
22
|
+
R as Textarea,
|
|
23
|
+
T as ValidationTooltip
|
|
22
24
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Placement } from '@floating-ui/react';
|
|
3
|
-
export type MenuProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
export type MenuProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {
|
|
4
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
5
|
placement?: Placement;
|
|
5
6
|
trigger: React.JSX.Element;
|
|
6
7
|
minWidth?: React.CSSProperties['minWidth'];
|
|
7
8
|
maxWidth?: React.CSSProperties['maxWidth'];
|
|
9
|
+
minHeight?: React.CSSProperties['minHeight'];
|
|
10
|
+
maxHeight?: React.CSSProperties['maxHeight'];
|
|
11
|
+
onSelect?: (index: number) => void;
|
|
8
12
|
};
|
|
9
|
-
export declare const Menu: ({ placement, trigger, minWidth, maxWidth, className, children, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const Menu: ({ size, placement, trigger, minWidth, maxWidth, minHeight, maxHeight, className, children, onSelect, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|