@kolking/react-ui 1.0.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/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/Input-Lz3ft8Tp.js +96 -0
- package/dist/ValidationTooltip-BgSwl0hJ.js +30 -0
- package/dist/_commonjsHelpers-B52_cu2H.js +26 -0
- package/dist/components/Button/Button.d.ts +26 -0
- package/dist/components/Button/Button.js +62 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +4 -0
- package/dist/components/Dialog/Dialog.d.ts +10 -0
- package/dist/components/Dialog/Dialog.js +57 -0
- package/dist/components/Dialog/DialogFocusTrap.d.ts +2 -0
- package/dist/components/Dialog/DialogFocusTrap.js +765 -0
- package/dist/components/Dialog/index.d.ts +3 -0
- package/dist/components/Dialog/index.js +12 -0
- package/dist/components/Dialog/useDialog.d.ts +19 -0
- package/dist/components/Dialog/useDialog.js +52 -0
- package/dist/components/Dialog/withDialog.d.ts +11 -0
- package/dist/components/Dialog/withDialog.js +23 -0
- package/dist/components/Fields/Checkbox.d.ts +13 -0
- package/dist/components/Fields/Checkbox.js +28 -0
- package/dist/components/Fields/Field.d.ts +20 -0
- package/dist/components/Fields/Field.js +52 -0
- package/dist/components/Fields/Input.d.ts +11 -0
- package/dist/components/Fields/Input.js +9 -0
- package/dist/components/Fields/Quantity.d.ts +7 -0
- package/dist/components/Fields/Quantity.js +61 -0
- package/dist/components/Fields/Radio.d.ts +11 -0
- package/dist/components/Fields/Radio.js +23 -0
- package/dist/components/Fields/Select.d.ts +7 -0
- package/dist/components/Fields/Select.js +21 -0
- package/dist/components/Fields/Textarea.d.ts +12 -0
- package/dist/components/Fields/Textarea.js +185 -0
- package/dist/components/Fields/ValidationTooltip.d.ts +2 -0
- package/dist/components/Fields/ValidationTooltip.js +6 -0
- package/dist/components/Fields/index.d.ts +8 -0
- package/dist/components/Fields/index.js +20 -0
- package/dist/components/Flex/Flex.d.ts +22 -0
- package/dist/components/Flex/Flex.js +36 -0
- package/dist/components/Flex/index.d.ts +1 -0
- package/dist/components/Flex/index.js +4 -0
- package/dist/components/Heading/Heading.d.ts +12 -0
- package/dist/components/Heading/Heading.js +57 -0
- package/dist/components/Heading/index.d.ts +1 -0
- package/dist/components/Heading/index.js +4 -0
- package/dist/components/Icon/Icon.d.ts +16 -0
- package/dist/components/Icon/Icon.js +125 -0
- package/dist/components/Icon/icons.d.ts +2 -0
- package/dist/components/Icon/icons.js +91 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Icon/index.js +4 -0
- package/dist/components/Menu/Menu.d.ts +9 -0
- package/dist/components/Menu/Menu.js +77 -0
- package/dist/components/Menu/MenuContext.d.ts +8 -0
- package/dist/components/Menu/MenuContext.js +5 -0
- package/dist/components/Menu/MenuItem.d.ts +7 -0
- package/dist/components/Menu/MenuItem.js +50 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.js +6 -0
- package/dist/components/Notice/Notice.d.ts +15 -0
- package/dist/components/Notice/Notice.js +56 -0
- package/dist/components/Notice/index.d.ts +1 -0
- package/dist/components/Notice/index.js +4 -0
- package/dist/components/Progress/ProgressBar.d.ts +21 -0
- package/dist/components/Progress/ProgressBar.js +47 -0
- package/dist/components/Progress/ProgressCircular.d.ts +25 -0
- package/dist/components/Progress/ProgressCircular.js +71 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/index.js +6 -0
- package/dist/components/Segmented/Segmented.d.ts +9 -0
- package/dist/components/Segmented/Segmented.js +46 -0
- package/dist/components/Segmented/index.d.ts +1 -0
- package/dist/components/Segmented/index.js +4 -0
- package/dist/components/Spinner/Spinner.d.ts +13 -0
- package/dist/components/Spinner/Spinner.js +31 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +4 -0
- package/dist/components/Tooltip/Tooltip.d.ts +14 -0
- package/dist/components/Tooltip/Tooltip.js +78 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +4 -0
- package/dist/floating-ui.react-KLg1MUz0.js +22334 -0
- package/dist/index-DyIdU--j.js +45 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.esm-Dkuk1b-q.js +211 -0
- package/dist/index.js +54 -0
- package/dist/styles/_theme-default.scss +142 -0
- package/dist/styles/_theme.scss +40 -0
- package/dist/styles/_utils.scss +118 -0
- package/dist/styles/style.css +1 -0
- package/dist/styles.module-CUhWny5T.js +11 -0
- package/dist/utils/helpers.d.ts +13 -0
- package/dist/utils/helpers.js +34 -0
- package/package.json +79 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Dialog as l, DialogClose as e, DialogContent as t, DialogFooter as a, DialogTitle as g } from "./Dialog.js";
|
|
2
|
+
import { useDialog as D } from "./useDialog.js";
|
|
3
|
+
import { withDialog as m } from "./withDialog.js";
|
|
4
|
+
export {
|
|
5
|
+
l as Dialog,
|
|
6
|
+
e as DialogClose,
|
|
7
|
+
t as DialogContent,
|
|
8
|
+
a as DialogFooter,
|
|
9
|
+
g as DialogTitle,
|
|
10
|
+
D as useDialog,
|
|
11
|
+
m as withDialog
|
|
12
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type DialogOptions<T, R> = {
|
|
2
|
+
defaultOpen?: boolean;
|
|
3
|
+
onShow?: (values: T) => void;
|
|
4
|
+
onConfirm?: (result: R) => void;
|
|
5
|
+
onCancel?: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type DialogType<T, R> = ReturnType<typeof useDialog<T, R>>;
|
|
8
|
+
export declare function useDialog<T, R>(options?: DialogOptions<T, R>): {
|
|
9
|
+
props: {
|
|
10
|
+
ref: import('react').RefObject<HTMLDialogElement>;
|
|
11
|
+
open: boolean;
|
|
12
|
+
};
|
|
13
|
+
data: T | undefined;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
show: (values: T) => void;
|
|
16
|
+
disable: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
17
|
+
confirm: (values: R) => void;
|
|
18
|
+
cancel: () => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useRef as k, useState as u, useCallback as f, useEffect as m } from "react";
|
|
2
|
+
function b(a) {
|
|
3
|
+
const s = k(null), o = k(a), [d, L] = u(!1), [l, v] = u((a == null ? void 0 : a.defaultOpen) ?? !1), [w, E] = u();
|
|
4
|
+
o.current = a;
|
|
5
|
+
const p = f((e) => {
|
|
6
|
+
var n, t;
|
|
7
|
+
E(e), v(!0), (t = (n = o.current) == null ? void 0 : n.onShow) == null || t.call(n, e);
|
|
8
|
+
}, []), c = f(
|
|
9
|
+
(e) => {
|
|
10
|
+
var n;
|
|
11
|
+
l && (v(!1), (n = s.current) == null || n.addEventListener(
|
|
12
|
+
"transitionend",
|
|
13
|
+
() => {
|
|
14
|
+
var t, i, r, h;
|
|
15
|
+
e !== void 0 ? (i = (t = o.current) == null ? void 0 : t.onConfirm) == null || i.call(t, e) : (h = (r = o.current) == null ? void 0 : r.onCancel) == null || h.call(r), E(void 0);
|
|
16
|
+
},
|
|
17
|
+
{ once: !0 }
|
|
18
|
+
));
|
|
19
|
+
},
|
|
20
|
+
[l]
|
|
21
|
+
);
|
|
22
|
+
return m(() => {
|
|
23
|
+
var e, n;
|
|
24
|
+
l ? (e = s.current) == null || e.showModal() : (n = s.current) == null || n.close();
|
|
25
|
+
}, [l]), m(() => {
|
|
26
|
+
const e = s.current;
|
|
27
|
+
function n(r) {
|
|
28
|
+
r.target === r.currentTarget && !d && c();
|
|
29
|
+
}
|
|
30
|
+
function t(r) {
|
|
31
|
+
r.key === "Escape" && d && r.preventDefault();
|
|
32
|
+
}
|
|
33
|
+
function i() {
|
|
34
|
+
c();
|
|
35
|
+
}
|
|
36
|
+
if (e)
|
|
37
|
+
return e.addEventListener("click", n), e.addEventListener("cancel", i), e.addEventListener("keydown", t), () => {
|
|
38
|
+
e.removeEventListener("click", n), e.removeEventListener("cancel", i), e.removeEventListener("keydown", t);
|
|
39
|
+
};
|
|
40
|
+
}, [d, c]), {
|
|
41
|
+
props: { ref: s, open: l },
|
|
42
|
+
data: w,
|
|
43
|
+
disabled: d,
|
|
44
|
+
show: p,
|
|
45
|
+
disable: L,
|
|
46
|
+
confirm: f((e) => c(e), [c]),
|
|
47
|
+
cancel: f(() => c(), [c])
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
b as useDialog
|
|
52
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { DialogProps } from './Dialog';
|
|
3
|
+
import { DialogOptions, DialogType } from './useDialog';
|
|
4
|
+
type ComponentProps<T, R> = Omit<DialogProps, 'children'> & DialogOptions<T, R> & {
|
|
5
|
+
children: (dialog: DialogType<T, R>) => React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export type WithDialogProps<T extends object, R> = T & {
|
|
8
|
+
dialog: DialogType<T, R>;
|
|
9
|
+
};
|
|
10
|
+
export declare function withDialog<T extends object, R>(Component: React.ComponentType<WithDialogProps<T, R>>): React.ComponentType<ComponentProps<T, R>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsxs as s, Fragment as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as d } from "./Dialog.js";
|
|
3
|
+
import { useDialog as f } from "./useDialog.js";
|
|
4
|
+
function x(t) {
|
|
5
|
+
function i({
|
|
6
|
+
children: a,
|
|
7
|
+
defaultOpen: n,
|
|
8
|
+
onShow: e,
|
|
9
|
+
onConfirm: p,
|
|
10
|
+
onCancel: m,
|
|
11
|
+
...l
|
|
12
|
+
}) {
|
|
13
|
+
const r = f({ defaultOpen: n, onShow: e, onConfirm: p, onCancel: m });
|
|
14
|
+
return /* @__PURE__ */ s(c, { children: [
|
|
15
|
+
a(r),
|
|
16
|
+
/* @__PURE__ */ o(d, { ...l, ...r.props, children: r.data && /* @__PURE__ */ o(t, { ...r.data, dialog: r }) })
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
return i;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
x as withDialog
|
|
23
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseInputProps } from './Input';
|
|
3
|
+
export type CheckboxProps = BaseInputProps & {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
indeterminate?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
9
|
+
error?: string;
|
|
10
|
+
} & {
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
indeterminate?: boolean;
|
|
13
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as p } from "../../index-DyIdU--j.js";
|
|
3
|
+
import h, { useRef as x, useImperativeHandle as k, useEffect as b } from "react";
|
|
4
|
+
import { cssProps as R } from "../../utils/helpers.js";
|
|
5
|
+
import { I as y, s as l } from "../../Input-Lz3ft8Tp.js";
|
|
6
|
+
const q = h.forwardRef(
|
|
7
|
+
({ size: c, error: n, 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(
|
|
12
|
+
"label",
|
|
13
|
+
{
|
|
14
|
+
"data-input": "checkbox",
|
|
15
|
+
"data-required": m,
|
|
16
|
+
className: p(l.checkbox, f),
|
|
17
|
+
style: { ...u, ...R({ size: c }) },
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ a(y, { ...s, ref: e, type: "checkbox", size: c, error: n }),
|
|
20
|
+
t && /* @__PURE__ */ a("div", { className: l.label, children: t })
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
export {
|
|
27
|
+
q as Checkbox
|
|
28
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface FieldConfig {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
labelAccessory?: React.ReactNode;
|
|
6
|
+
help?: React.ReactNode;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
minWidth?: React.CSSProperties['minWidth'];
|
|
10
|
+
maxWidth?: React.CSSProperties['maxWidth'];
|
|
11
|
+
}
|
|
12
|
+
export type FieldLabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
13
|
+
label?: React.ReactNode;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const FieldLabel: ({ label, required, className, children, ...props }: FieldLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export type FieldDescriptionProps = React.HTMLAttributes<HTMLDivElement>;
|
|
18
|
+
export declare const FieldDescription: ({ className, children, ...props }: FieldDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
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;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsxs as o, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { c as d } from "../../index-DyIdU--j.js";
|
|
3
|
+
import h from "react";
|
|
4
|
+
import { cssProps as _ } from "../../utils/helpers.js";
|
|
5
|
+
const p = "styles_field_hqzKT", u = "styles_header_Iwsz6", b = "styles_label_zRVTS", N = "styles_accessory_S4ccn", F = "styles_description_fZnNW", a = {
|
|
6
|
+
field: p,
|
|
7
|
+
header: u,
|
|
8
|
+
label: b,
|
|
9
|
+
accessory: N,
|
|
10
|
+
description: F
|
|
11
|
+
}, v = ({ label: e, required: s, className: l, children: t, ...r }) => /* @__PURE__ */ o("div", { "data-field-header": !0, className: a.header, children: [
|
|
12
|
+
/* @__PURE__ */ c(
|
|
13
|
+
"label",
|
|
14
|
+
{
|
|
15
|
+
...r,
|
|
16
|
+
"data-field-label": !0,
|
|
17
|
+
"data-required": s,
|
|
18
|
+
className: d(a.label, l),
|
|
19
|
+
children: e
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
h.Children.toArray(t).length > 0 && /* @__PURE__ */ c("div", { "data-field-accessory": !0, className: a.accessory, children: t })
|
|
23
|
+
] }), x = ({ className: e, children: s, ...l }) => /* @__PURE__ */ c("small", { ...l, "data-field-description": !0, className: d(a.description, e), children: s }), S = ({
|
|
24
|
+
id: e,
|
|
25
|
+
label: s,
|
|
26
|
+
labelAccessory: l,
|
|
27
|
+
help: t,
|
|
28
|
+
required: r,
|
|
29
|
+
minWidth: n,
|
|
30
|
+
maxWidth: f,
|
|
31
|
+
className: m,
|
|
32
|
+
children: y,
|
|
33
|
+
...i
|
|
34
|
+
}) => /* @__PURE__ */ o(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
...i,
|
|
38
|
+
"data-field": e || !0,
|
|
39
|
+
className: d(a.field, m),
|
|
40
|
+
style: { ...i.style, ..._({ minWidth: n, maxWidth: f }) },
|
|
41
|
+
children: [
|
|
42
|
+
s && /* @__PURE__ */ c(v, { htmlFor: e, label: s, required: r, children: l }),
|
|
43
|
+
y,
|
|
44
|
+
t && /* @__PURE__ */ c(x, { children: t })
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
export {
|
|
49
|
+
S as Field,
|
|
50
|
+
x as FieldDescription,
|
|
51
|
+
v as FieldLabel
|
|
52
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type BaseInputProps<T = React.InputHTMLAttributes<HTMLInputElement>> = Omit<T, 'size'> & {
|
|
3
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
error?: string;
|
|
5
|
+
};
|
|
6
|
+
export type InputProps = Omit<BaseInputProps, 'prefix'> & {
|
|
7
|
+
prefix?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare const Input: React.ForwardRefExoticComponent<Omit<BaseInputProps<React.InputHTMLAttributes<HTMLInputElement>>, "prefix"> & {
|
|
10
|
+
prefix?: React.ReactNode;
|
|
11
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseInputProps } from './Input';
|
|
3
|
+
export type QuantityProps = BaseInputProps;
|
|
4
|
+
export declare const Quantity: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
error?: string;
|
|
7
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as a, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { c as v } from "../../index-DyIdU--j.js";
|
|
3
|
+
import * as i from "react";
|
|
4
|
+
import w, { forwardRef as d, useRef as y, useImperativeHandle as R, useCallback as o } from "react";
|
|
5
|
+
import { cssProps as g } from "../../utils/helpers.js";
|
|
6
|
+
import { V as E } from "../../ValidationTooltip-BgSwl0hJ.js";
|
|
7
|
+
const _ = (n, e) => /* @__PURE__ */ i.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 6 5", ref: e, ...n }, /* @__PURE__ */ i.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M0 0h6L3 5z" })), x = d(_), q = (n, e) => /* @__PURE__ */ i.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 6 5", ref: e, ...n }, /* @__PURE__ */ i.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M0 5h6L3 0z" })), C = d(q), D = "styles_quantity_JqkoZ", k = "styles_increase_MKRaz", S = "styles_decrease_oD7r3", l = {
|
|
8
|
+
quantity: D,
|
|
9
|
+
increase: k,
|
|
10
|
+
decrease: S
|
|
11
|
+
}, j = w.forwardRef(
|
|
12
|
+
({ size: n, error: e, className: u, style: m, ...c }, p) => {
|
|
13
|
+
const t = y(null);
|
|
14
|
+
R(p, () => t.current);
|
|
15
|
+
const b = o(() => {
|
|
16
|
+
var r, s;
|
|
17
|
+
(r = t.current) == null || r.stepUp(), (s = t.current) == null || s.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
18
|
+
}, []), f = o(() => {
|
|
19
|
+
var r, s;
|
|
20
|
+
(r = t.current) == null || r.stepDown(), (s = t.current) == null || s.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
21
|
+
}, []);
|
|
22
|
+
return /* @__PURE__ */ a(E, { content: e, children: /* @__PURE__ */ h(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
"data-input": "quantity",
|
|
26
|
+
"data-disabled": c.disabled,
|
|
27
|
+
"data-invalid": e ? !0 : void 0,
|
|
28
|
+
className: v(l.quantity, u),
|
|
29
|
+
style: { ...m, ...g({ size: n }) },
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ a("input", { ...c, ref: t, type: "number" }),
|
|
32
|
+
/* @__PURE__ */ a(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
"aria-label": "Increase",
|
|
37
|
+
disabled: c.disabled,
|
|
38
|
+
className: l.increase,
|
|
39
|
+
onClick: b,
|
|
40
|
+
children: /* @__PURE__ */ a(C, { "aria-hidden": !0 })
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ a(
|
|
44
|
+
"button",
|
|
45
|
+
{
|
|
46
|
+
type: "button",
|
|
47
|
+
"aria-label": "Decrease",
|
|
48
|
+
disabled: c.disabled,
|
|
49
|
+
className: l.decrease,
|
|
50
|
+
onClick: f,
|
|
51
|
+
children: /* @__PURE__ */ a(x, { "aria-hidden": !0 })
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
) });
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
export {
|
|
60
|
+
j as Quantity
|
|
61
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseInputProps } from './Input';
|
|
3
|
+
export type RadioProps = BaseInputProps & {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const Radio: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
7
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
8
|
+
error?: string;
|
|
9
|
+
} & {
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { c as l } from "../../index-DyIdU--j.js";
|
|
3
|
+
import f from "react";
|
|
4
|
+
import { cssProps as n } from "../../utils/helpers.js";
|
|
5
|
+
import { I as u, s } from "../../Input-Lz3ft8Tp.js";
|
|
6
|
+
const I = f.forwardRef(
|
|
7
|
+
({ size: r, error: t, label: a, className: e, style: i, required: d, ...m }, p) => /* @__PURE__ */ c(
|
|
8
|
+
"label",
|
|
9
|
+
{
|
|
10
|
+
"data-input": "radio",
|
|
11
|
+
"data-required": d,
|
|
12
|
+
className: l(s.radio, e),
|
|
13
|
+
style: { ...i, ...n({ size: r }) },
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ o(u, { ...m, ref: p, type: "radio", size: r, error: t }),
|
|
16
|
+
a && /* @__PURE__ */ o("div", { className: s.label, children: a })
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
export {
|
|
22
|
+
I as Radio
|
|
23
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseInputProps } from './Input';
|
|
3
|
+
export type SelectProps = BaseInputProps<React.SelectHTMLAttributes<HTMLSelectElement>>;
|
|
4
|
+
export declare const Select: React.ForwardRefExoticComponent<Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size"> & {
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
6
|
+
error?: string;
|
|
7
|
+
} & React.RefAttributes<HTMLSelectElement>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { c as i } from "../../index-DyIdU--j.js";
|
|
3
|
+
import l from "react";
|
|
4
|
+
import { cssProps as m } from "../../utils/helpers.js";
|
|
5
|
+
import { V as d, s as f } from "../../ValidationTooltip-BgSwl0hJ.js";
|
|
6
|
+
const y = l.forwardRef(
|
|
7
|
+
({ size: o, error: t, className: s, style: a, ...r }, c) => /* @__PURE__ */ e(d, { content: t, children: /* @__PURE__ */ e(
|
|
8
|
+
"select",
|
|
9
|
+
{
|
|
10
|
+
...r,
|
|
11
|
+
ref: c,
|
|
12
|
+
"data-select": !0,
|
|
13
|
+
"data-invalid": t ? !0 : void 0,
|
|
14
|
+
className: i(f.select, s),
|
|
15
|
+
style: { ...a, ...m({ size: o }) }
|
|
16
|
+
}
|
|
17
|
+
) })
|
|
18
|
+
);
|
|
19
|
+
export {
|
|
20
|
+
y as Select
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TextareaAutosizeProps } from 'react-textarea-autosize';
|
|
3
|
+
import { BaseInputProps } from './Input';
|
|
4
|
+
export type TextareaProps = BaseInputProps<TextareaAutosizeProps> & {
|
|
5
|
+
autosize?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaAutosizeProps, "size"> & {
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
9
|
+
error?: string;
|
|
10
|
+
} & {
|
|
11
|
+
autosize?: boolean;
|
|
12
|
+
} & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import { c as j } from "../../index-DyIdU--j.js";
|
|
3
|
+
import * as f from "react";
|
|
4
|
+
import x, { useLayoutEffect as I } from "react";
|
|
5
|
+
import { cssProps as N } from "../../utils/helpers.js";
|
|
6
|
+
import { V as P, s as _ } from "../../ValidationTooltip-BgSwl0hJ.js";
|
|
7
|
+
function R() {
|
|
8
|
+
return R = Object.assign ? Object.assign.bind() : function(n) {
|
|
9
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
10
|
+
var r = arguments[t];
|
|
11
|
+
for (var e in r) ({}).hasOwnProperty.call(r, e) && (n[e] = r[e]);
|
|
12
|
+
}
|
|
13
|
+
return n;
|
|
14
|
+
}, R.apply(null, arguments);
|
|
15
|
+
}
|
|
16
|
+
function B(n, t) {
|
|
17
|
+
if (n == null) return {};
|
|
18
|
+
var r = {};
|
|
19
|
+
for (var e in n) if ({}.hasOwnProperty.call(n, e)) {
|
|
20
|
+
if (t.indexOf(e) !== -1) continue;
|
|
21
|
+
r[e] = n[e];
|
|
22
|
+
}
|
|
23
|
+
return r;
|
|
24
|
+
}
|
|
25
|
+
var M = I, $ = function(t) {
|
|
26
|
+
var r = x.useRef(t);
|
|
27
|
+
return M(function() {
|
|
28
|
+
r.current = t;
|
|
29
|
+
}), r;
|
|
30
|
+
}, E = function(t, r) {
|
|
31
|
+
if (typeof t == "function") {
|
|
32
|
+
t(r);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
t.current = r;
|
|
36
|
+
}, G = function(t, r) {
|
|
37
|
+
var e = x.useRef();
|
|
38
|
+
return x.useCallback(function(i) {
|
|
39
|
+
t.current = i, e.current && E(e.current, null), e.current = r, r && E(r, i);
|
|
40
|
+
}, [r]);
|
|
41
|
+
}, T = {
|
|
42
|
+
"min-height": "0",
|
|
43
|
+
"max-height": "none",
|
|
44
|
+
height: "0",
|
|
45
|
+
visibility: "hidden",
|
|
46
|
+
overflow: "hidden",
|
|
47
|
+
position: "absolute",
|
|
48
|
+
"z-index": "-1000",
|
|
49
|
+
top: "0",
|
|
50
|
+
right: "0",
|
|
51
|
+
display: "block"
|
|
52
|
+
}, V = function(t) {
|
|
53
|
+
Object.keys(T).forEach(function(r) {
|
|
54
|
+
t.style.setProperty(r, T[r], "important");
|
|
55
|
+
});
|
|
56
|
+
}, F = V, o = null, W = function(t, r) {
|
|
57
|
+
var e = t.scrollHeight;
|
|
58
|
+
return r.sizingStyle.boxSizing === "border-box" ? e + r.borderSize : e - r.paddingSize;
|
|
59
|
+
};
|
|
60
|
+
function Y(n, t, r, e) {
|
|
61
|
+
r === void 0 && (r = 1), e === void 0 && (e = 1 / 0), o || (o = document.createElement("textarea"), o.setAttribute("tabindex", "-1"), o.setAttribute("aria-hidden", "true"), F(o)), o.parentNode === null && document.body.appendChild(o);
|
|
62
|
+
var i = n.paddingSize, u = n.borderSize, a = n.sizingStyle, l = a.boxSizing;
|
|
63
|
+
Object.keys(a).forEach(function(c) {
|
|
64
|
+
var m = c;
|
|
65
|
+
o.style[m] = a[m];
|
|
66
|
+
}), F(o), o.value = t;
|
|
67
|
+
var d = W(o, n);
|
|
68
|
+
o.value = t, d = W(o, n), o.value = "x";
|
|
69
|
+
var v = o.scrollHeight - i, h = v * r;
|
|
70
|
+
l === "border-box" && (h = h + i + u), d = Math.max(h, d);
|
|
71
|
+
var g = v * e;
|
|
72
|
+
return l === "border-box" && (g = g + i + u), d = Math.min(g, d), [d, v];
|
|
73
|
+
}
|
|
74
|
+
var k = function() {
|
|
75
|
+
}, q = function(t, r) {
|
|
76
|
+
return t.reduce(function(e, i) {
|
|
77
|
+
return e[i] = r[i], e;
|
|
78
|
+
}, {});
|
|
79
|
+
}, U = [
|
|
80
|
+
"borderBottomWidth",
|
|
81
|
+
"borderLeftWidth",
|
|
82
|
+
"borderRightWidth",
|
|
83
|
+
"borderTopWidth",
|
|
84
|
+
"boxSizing",
|
|
85
|
+
"fontFamily",
|
|
86
|
+
"fontSize",
|
|
87
|
+
"fontStyle",
|
|
88
|
+
"fontWeight",
|
|
89
|
+
"letterSpacing",
|
|
90
|
+
"lineHeight",
|
|
91
|
+
"paddingBottom",
|
|
92
|
+
"paddingLeft",
|
|
93
|
+
"paddingRight",
|
|
94
|
+
"paddingTop",
|
|
95
|
+
// non-standard
|
|
96
|
+
"tabSize",
|
|
97
|
+
"textIndent",
|
|
98
|
+
// non-standard
|
|
99
|
+
"textRendering",
|
|
100
|
+
"textTransform",
|
|
101
|
+
"width",
|
|
102
|
+
"wordBreak",
|
|
103
|
+
"wordSpacing",
|
|
104
|
+
"scrollbarGutter"
|
|
105
|
+
], X = !!document.documentElement.currentStyle, Z = function(t) {
|
|
106
|
+
var r = window.getComputedStyle(t);
|
|
107
|
+
if (r === null)
|
|
108
|
+
return null;
|
|
109
|
+
var e = q(U, r), i = e.boxSizing;
|
|
110
|
+
if (i === "")
|
|
111
|
+
return null;
|
|
112
|
+
X && i === "border-box" && (e.width = parseFloat(e.width) + parseFloat(e.borderRightWidth) + parseFloat(e.borderLeftWidth) + parseFloat(e.paddingRight) + parseFloat(e.paddingLeft) + "px");
|
|
113
|
+
var u = parseFloat(e.paddingBottom) + parseFloat(e.paddingTop), a = parseFloat(e.borderBottomWidth) + parseFloat(e.borderTopWidth);
|
|
114
|
+
return {
|
|
115
|
+
sizingStyle: e,
|
|
116
|
+
paddingSize: u,
|
|
117
|
+
borderSize: a
|
|
118
|
+
};
|
|
119
|
+
}, D = Z;
|
|
120
|
+
function L(n, t, r) {
|
|
121
|
+
var e = $(r);
|
|
122
|
+
f.useLayoutEffect(function() {
|
|
123
|
+
var i = function(a) {
|
|
124
|
+
return e.current(a);
|
|
125
|
+
};
|
|
126
|
+
if (n)
|
|
127
|
+
return n.addEventListener(t, i), function() {
|
|
128
|
+
return n.removeEventListener(t, i);
|
|
129
|
+
};
|
|
130
|
+
}, []);
|
|
131
|
+
}
|
|
132
|
+
var J = function(t, r) {
|
|
133
|
+
L(document.body, "reset", function(e) {
|
|
134
|
+
t.current.form === e.target && r(e);
|
|
135
|
+
});
|
|
136
|
+
}, K = function(t) {
|
|
137
|
+
L(window, "resize", t);
|
|
138
|
+
}, Q = function(t) {
|
|
139
|
+
L(document.fonts, "loadingdone", t);
|
|
140
|
+
}, ee = ["cacheMeasurements", "maxRows", "minRows", "onChange", "onHeightChange"], te = function(t, r) {
|
|
141
|
+
var e = t.cacheMeasurements, i = t.maxRows, u = t.minRows, a = t.onChange, l = a === void 0 ? k : a, d = t.onHeightChange, v = d === void 0 ? k : d, h = B(t, ee), g = h.value !== void 0, c = f.useRef(null), m = G(c, r), w = f.useRef(0), S = f.useRef(), p = function() {
|
|
142
|
+
var s = c.current, z = e && S.current ? S.current : D(s);
|
|
143
|
+
if (z) {
|
|
144
|
+
S.current = z;
|
|
145
|
+
var H = Y(z, s.value || s.placeholder || "x", u, i), b = H[0], O = H[1];
|
|
146
|
+
w.current !== b && (w.current = b, s.style.setProperty("height", b + "px", "important"), v(b, {
|
|
147
|
+
rowHeight: O
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
}, A = function(s) {
|
|
151
|
+
g || p(), l(s);
|
|
152
|
+
};
|
|
153
|
+
return f.useLayoutEffect(p), J(c, function() {
|
|
154
|
+
if (!g) {
|
|
155
|
+
var y = c.current.value;
|
|
156
|
+
requestAnimationFrame(function() {
|
|
157
|
+
var s = c.current;
|
|
158
|
+
s && y !== s.value && p();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}), K(p), Q(p), /* @__PURE__ */ f.createElement("textarea", R({}, h, {
|
|
162
|
+
onChange: A,
|
|
163
|
+
ref: m
|
|
164
|
+
}));
|
|
165
|
+
}, re = /* @__PURE__ */ f.forwardRef(te);
|
|
166
|
+
const ue = x.forwardRef(
|
|
167
|
+
({ autosize: n = !0, size: t, error: r, className: e, style: i, ...u }, a) => {
|
|
168
|
+
const l = n ? re : "textarea", d = n ? { minRows: 2, ...u } : u;
|
|
169
|
+
return /* @__PURE__ */ C(P, { content: r, children: /* @__PURE__ */ C(
|
|
170
|
+
l,
|
|
171
|
+
{
|
|
172
|
+
...d,
|
|
173
|
+
ref: a,
|
|
174
|
+
"data-textarea": !0,
|
|
175
|
+
"data-autosize": n,
|
|
176
|
+
"data-invalid": r ? !0 : void 0,
|
|
177
|
+
className: j(_.textarea, e),
|
|
178
|
+
style: { ...i, ...N({ size: t }) }
|
|
179
|
+
}
|
|
180
|
+
) });
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
export {
|
|
184
|
+
ue as Textarea
|
|
185
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Checkbox as r } from "./Checkbox.js";
|
|
2
|
+
import { Field as p, FieldDescription as i, FieldLabel as x } from "./Field.js";
|
|
3
|
+
import { I as f } from "../../Input-Lz3ft8Tp.js";
|
|
4
|
+
import { Quantity as l } from "./Quantity.js";
|
|
5
|
+
import { Radio as n } from "./Radio.js";
|
|
6
|
+
import { Select as s } from "./Select.js";
|
|
7
|
+
import { Textarea as b } from "./Textarea.js";
|
|
8
|
+
import { V as I } from "../../ValidationTooltip-BgSwl0hJ.js";
|
|
9
|
+
export {
|
|
10
|
+
r as Checkbox,
|
|
11
|
+
p as Field,
|
|
12
|
+
i as FieldDescription,
|
|
13
|
+
x as FieldLabel,
|
|
14
|
+
f as Input,
|
|
15
|
+
l as Quantity,
|
|
16
|
+
n as Radio,
|
|
17
|
+
s as Select,
|
|
18
|
+
b as Textarea,
|
|
19
|
+
I as ValidationTooltip
|
|
20
|
+
};
|