@oneplatformdev/ui 0.0.1-beta.4 → 0.0.1-beta.40
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/AlertDialog/AlertDialog.d.ts +14 -0
- package/AlertDialog/AlertDialog.mjs +58 -60
- package/Button/buttonVariants.mjs +3 -3
- package/Combobox/Combobox.mjs +81 -70
- package/Combobox/Combobox.types.d.ts +7 -0
- package/DataTable/DataTable.mjs +32 -51
- package/DataTable/DataTableColumnFilter.d.ts +4 -0
- package/DataTable/DataTableColumnFilter.mjs +31 -0
- package/Dropzone/Dropzone.d.ts +22 -0
- package/Dropzone/Dropzone.mjs +136 -0
- package/Dropzone/Dropzone.types.d.ts +36 -0
- package/Dropzone/DropzoneFilePreview.d.ts +4 -0
- package/Dropzone/DropzoneFilePreview.mjs +9 -0
- package/Dropzone/DropzoneUtils.d.ts +4 -0
- package/Dropzone/DropzoneUtils.mjs +15 -0
- package/Dropzone/index.d.ts +2 -0
- package/Dropzone/index.mjs +7 -0
- package/Dropzone/package.json +7 -0
- package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
- package/Form/FormRenderControl.d.ts +1 -2
- package/Form/FormRenderControl.mjs +10 -10
- package/Form/FormRenderControl.types.d.ts +4 -3
- package/FormCheckbox/FormCheckbox.d.ts +1 -2
- package/FormCheckbox/FormCheckbox.types.d.ts +1 -2
- package/FormCombobox/FormCombobox.d.ts +2 -2
- package/FormCombobox/FormCombobox.types.d.ts +1 -2
- package/FormDatePicker/FormDatePicker.d.ts +2 -2
- package/FormDatePicker/FormDatePicker.types.d.ts +1 -2
- package/FormDropzone/FormDropzone.d.ts +4 -0
- package/FormDropzone/FormDropzone.mjs +19 -0
- package/FormDropzone/FormDropzone.types.d.ts +6 -0
- package/FormDropzone/index.d.ts +2 -0
- package/FormDropzone/index.mjs +4 -0
- package/FormDropzone/package.json +7 -0
- package/FormInput/FormInput.d.ts +1 -2
- package/FormInput/FormInput.mjs +6 -7
- package/FormInput/FormInput.types.d.ts +1 -2
- package/FormSelect/FormSelect.d.ts +1 -2
- package/FormSelect/FormSelect.mjs +19 -17
- package/FormSelect/FormSelect.types.d.ts +1 -2
- package/FormTextarea/FormTextarea.d.ts +1 -2
- package/FormTextarea/FormTextarea.mjs +13 -12
- package/FormTextarea/FormTextarea.types.d.ts +1 -2
- package/Input/Input.mjs +42 -37
- package/Input/Input.types.d.ts +3 -1
- package/Input/index.d.ts +0 -1
- package/Input/index.mjs +5 -7
- package/Search/Search.mjs +5 -6
- package/Select/Select.mjs +28 -28
- package/Select/Select.types.d.ts +7 -1
- package/Sidebar/Sidebar.mjs +0 -1
- package/Tabs/Tabs.d.ts +3 -2
- package/Tabs/Tabs.mjs +20 -6
- package/Tabs/Tabs.types.d.ts +5 -2
- package/Tabs/index.mjs +8 -7
- package/Textarea/Textarea.d.ts +1 -1
- package/Textarea/Textarea.mjs +71 -15
- package/Textarea/Textarea.types.d.ts +16 -2
- package/Textarea/useAutosizeTextArea.d.ts +3 -0
- package/Textarea/useAutosizeTextArea.mjs +20 -0
- package/Toast/toastVariants.mjs +3 -3
- package/index.css +1 -1
- package/index.d.ts +2 -0
- package/index.mjs +315 -309
- package/package.json +9 -8
@@ -0,0 +1,136 @@
|
|
1
|
+
import { jsxs as t, jsx as o } from "react/jsx-runtime";
|
2
|
+
import { forwardRef as L, useState as g } from "react";
|
3
|
+
import { useDropzone as M } from "react-dropzone";
|
4
|
+
import { Card as U } from "../Card/Card.mjs";
|
5
|
+
import { File as j, X as O } from "lucide-react";
|
6
|
+
import { cn as m } from "@oneplatformdev/utils";
|
7
|
+
import { F as X, D as Y } from "../DropzoneFilePreview-Dhtv8F4u.js";
|
8
|
+
import { isFile as v, extractName as q } from "./DropzoneUtils.mjs";
|
9
|
+
const G = L(
|
10
|
+
({
|
11
|
+
acceptTypes: y = Y,
|
12
|
+
maxSizeMB: w,
|
13
|
+
maxFiles: a = 1,
|
14
|
+
onErrors: x,
|
15
|
+
hideErrors: b = !1,
|
16
|
+
disabled: p = !1,
|
17
|
+
classNames: l,
|
18
|
+
value: u = [],
|
19
|
+
onChangeValue: s,
|
20
|
+
className: F,
|
21
|
+
labelDropzonePrompt: z = "Drop files here or click to select",
|
22
|
+
labelOrClickToSelect: H = "Click to select files",
|
23
|
+
labelSelectedFiles: D = "Selected Files",
|
24
|
+
labelUploadErrors: I = "Upload Errors",
|
25
|
+
labelFileTooLarge: k = "File is too large",
|
26
|
+
labelInvalidFileType: S = "Invalid file type",
|
27
|
+
...E
|
28
|
+
}, P) => {
|
29
|
+
const [c, h] = g(u), [d, N] = g([]), W = (e, i) => {
|
30
|
+
N(i), x && x(i);
|
31
|
+
const r = [...c, ...e].slice(0, a);
|
32
|
+
h(r), s == null || s(r);
|
33
|
+
}, T = (e, i) => {
|
34
|
+
if (p) return;
|
35
|
+
e.stopPropagation();
|
36
|
+
const r = c.filter((n, f) => f !== i);
|
37
|
+
h(r), s == null || s(r);
|
38
|
+
}, { getRootProps: _, getInputProps: A, isDragActive: B } = M({
|
39
|
+
onDrop: W,
|
40
|
+
accept: y.reduce((e, i) => (e[i] = [], e), {}),
|
41
|
+
maxSize: w * 1024 * 1024,
|
42
|
+
maxFiles: a,
|
43
|
+
disabled: p
|
44
|
+
});
|
45
|
+
return /* @__PURE__ */ t(
|
46
|
+
U,
|
47
|
+
{
|
48
|
+
..._(),
|
49
|
+
...E,
|
50
|
+
className: m(
|
51
|
+
"border-dashed border-2 p-6 text-center flex flex-col items-center justify-center",
|
52
|
+
p && "bg-gray-300 pointer-events-none",
|
53
|
+
d.length > 0 ? "border-red-500" : "border-gray-300",
|
54
|
+
B && "bg-gray-100",
|
55
|
+
F
|
56
|
+
),
|
57
|
+
ref: P,
|
58
|
+
children: [
|
59
|
+
/* @__PURE__ */ o("input", { ...A() }),
|
60
|
+
c.length === 0 && d.length === 0 && /* @__PURE__ */ t(
|
61
|
+
"div",
|
62
|
+
{
|
63
|
+
className: m(
|
64
|
+
"flex flex-col items-center gap-1",
|
65
|
+
l == null ? void 0 : l.idleWrapper
|
66
|
+
),
|
67
|
+
children: [
|
68
|
+
/* @__PURE__ */ o(j, { className: "w-8 h-8 text-gray-500" }),
|
69
|
+
!p && /* @__PURE__ */ o("pre", { className: "font-semibold text-gray-600", children: z })
|
70
|
+
]
|
71
|
+
}
|
72
|
+
),
|
73
|
+
c.length > 0 && /* @__PURE__ */ t("div", { className: m("w-full mt-2", l == null ? void 0 : l.previewWrapper), children: [
|
74
|
+
/* @__PURE__ */ t("pre", { className: "font-semibold text-gray-600", children: [
|
75
|
+
D,
|
76
|
+
":"
|
77
|
+
] }),
|
78
|
+
/* @__PURE__ */ o("ul", { className: "mt-2 text-sm text-gray-500 flex flex-wrap gap-4 items-start justify-center", children: c.map((e, i) => {
|
79
|
+
const r = v(e) ? e.name : q(e), n = v(e) ? (e.size / (1024 * 1024)).toFixed(2) + " MB" : "";
|
80
|
+
return /* @__PURE__ */ t(
|
81
|
+
"li",
|
82
|
+
{
|
83
|
+
className: "flex flex-col items-center gap-2 relative",
|
84
|
+
children: [
|
85
|
+
/* @__PURE__ */ t("div", { className: "relative", children: [
|
86
|
+
/* @__PURE__ */ o(X, { item: e, styles: l }),
|
87
|
+
/* @__PURE__ */ o("div", { className: "absolute top-0 right-0 cursor-pointer bg-gray-300 rounded-sm", children: /* @__PURE__ */ o(
|
88
|
+
O,
|
89
|
+
{
|
90
|
+
size: 16,
|
91
|
+
strokeWidth: 1,
|
92
|
+
color: "black",
|
93
|
+
onClick: (f) => T(f, i)
|
94
|
+
}
|
95
|
+
) })
|
96
|
+
] }),
|
97
|
+
/* @__PURE__ */ t("span", { className: "inline-flex flex-col items-center", children: [
|
98
|
+
/* @__PURE__ */ o("span", { className: "max-w-[80px] text-ellipsis overflow-hidden whitespace-nowrap", children: r }),
|
99
|
+
n && /* @__PURE__ */ t("span", { children: [
|
100
|
+
"(",
|
101
|
+
n,
|
102
|
+
")"
|
103
|
+
] })
|
104
|
+
] })
|
105
|
+
]
|
106
|
+
},
|
107
|
+
i
|
108
|
+
);
|
109
|
+
}) })
|
110
|
+
] }),
|
111
|
+
d.length > 0 && /* @__PURE__ */ t("div", { className: m("w-full mt-4", l == null ? void 0 : l.errorWrapper), children: [
|
112
|
+
/* @__PURE__ */ t("span", { className: "font-semibold text-red-500", children: [
|
113
|
+
I,
|
114
|
+
":"
|
115
|
+
] }),
|
116
|
+
/* @__PURE__ */ o("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children: d.map((e, i) => /* @__PURE__ */ t("li", { children: [
|
117
|
+
e.file.name,
|
118
|
+
" (",
|
119
|
+
(e.file.size / (1024 * 1024)).toFixed(2),
|
120
|
+
" MB)",
|
121
|
+
!b && /* @__PURE__ */ o("ul", { className: "ml-4 list-disc list-inside", children: e.errors.map((r, n) => /* @__PURE__ */ t("li", { children: [
|
122
|
+
r.code === "file-too-large" && k,
|
123
|
+
r.code === "file-invalid-type" && S,
|
124
|
+
r.code !== "file-too-large" && r.code !== "file-invalid-type" && r.message
|
125
|
+
] }, n)) })
|
126
|
+
] }, i)) })
|
127
|
+
] })
|
128
|
+
]
|
129
|
+
}
|
130
|
+
);
|
131
|
+
}
|
132
|
+
);
|
133
|
+
G.displayName = "Dropzone";
|
134
|
+
export {
|
135
|
+
G as Dropzone
|
136
|
+
};
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { FileRejection } from 'react-dropzone';
|
2
|
+
|
3
|
+
export type DropzoneValueItem = File | string;
|
4
|
+
export interface FilePreviewProps {
|
5
|
+
item: DropzoneValueItem;
|
6
|
+
styles?: Pick<DropzoneStyles, 'previewWraper' | 'previewImage' | 'previewFile'>;
|
7
|
+
}
|
8
|
+
export interface DropzoneTranslations {
|
9
|
+
labelDropzonePrompt?: string;
|
10
|
+
labelOrClickToSelect?: string;
|
11
|
+
labelSelectedFiles?: string;
|
12
|
+
labelUploadErrors?: string;
|
13
|
+
labelFileTooLarge?: string;
|
14
|
+
labelInvalidFileType?: string;
|
15
|
+
}
|
16
|
+
export interface DropzoneProps extends DropzoneTranslations, React.HTMLAttributes<HTMLDivElement> {
|
17
|
+
acceptTypes?: string[];
|
18
|
+
maxSizeMB: number;
|
19
|
+
maxFiles?: number;
|
20
|
+
onErrors?: (errors: FileRejection[]) => void;
|
21
|
+
hideErrors?: boolean;
|
22
|
+
disabled?: boolean;
|
23
|
+
classNames?: DropzoneStyles;
|
24
|
+
value?: DropzoneValueItem[];
|
25
|
+
onChangeValue?: (items: DropzoneValueItem[]) => void;
|
26
|
+
}
|
27
|
+
export interface DropzoneStyles {
|
28
|
+
idleWrapper?: string;
|
29
|
+
previewWrapper?: string;
|
30
|
+
errorWrapper?: string;
|
31
|
+
previewWraper?: string;
|
32
|
+
previewImage?: string;
|
33
|
+
previewFile?: string;
|
34
|
+
}
|
35
|
+
export declare const DEFAULT_FILE_TYPES: string[];
|
36
|
+
export declare const DEFAULT_IMAGES_TYPES: string[];
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import { jsx as l, jsxs as d } from "react/jsx-runtime";
|
2
|
+
import { useState as m, useEffect as f } from "react";
|
3
|
+
import { File as s } from "lucide-react";
|
4
|
+
import { isFile as o } from "./Dropzone/DropzoneUtils.mjs";
|
5
|
+
import { cn as c } from "@oneplatformdev/utils";
|
6
|
+
const h = [
|
7
|
+
"application/msword",
|
8
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
9
|
+
"text/csv",
|
10
|
+
"text/plain",
|
11
|
+
"application/pdf"
|
12
|
+
], u = [
|
13
|
+
"image/png",
|
14
|
+
"image/jpeg",
|
15
|
+
"image/jpg",
|
16
|
+
"image/webp",
|
17
|
+
"image/gif"
|
18
|
+
], j = ({ item: e, styles: r }) => {
|
19
|
+
const [t, a] = m(null), p = o(e) && u.includes(e.type);
|
20
|
+
return f(() => {
|
21
|
+
let n = null;
|
22
|
+
if (o(e) && p) {
|
23
|
+
const i = new FileReader();
|
24
|
+
return i.onloadend = () => a(i.result), i.readAsDataURL(e), () => a(null);
|
25
|
+
} else {
|
26
|
+
if (typeof e == "string")
|
27
|
+
return n = new Image(), n.src = e, n.onload = () => a(e), n.onerror = () => a(null), () => {
|
28
|
+
n.onload = null, n.onerror = null;
|
29
|
+
};
|
30
|
+
a(null);
|
31
|
+
}
|
32
|
+
return () => a(null);
|
33
|
+
}, [e, p]), /* @__PURE__ */ l(
|
34
|
+
"div",
|
35
|
+
{
|
36
|
+
className: c(
|
37
|
+
"w-32 h-32 border border-gray-300 rounded-md overflow-hidden flex items-center justify-center",
|
38
|
+
r == null ? void 0 : r.previewWraper
|
39
|
+
),
|
40
|
+
children: t ? /* @__PURE__ */ l(
|
41
|
+
"img",
|
42
|
+
{
|
43
|
+
src: t,
|
44
|
+
alt: o(e) ? e.name : "external-image",
|
45
|
+
className: c("w-full h-full object-cover", r == null ? void 0 : r.previewImage)
|
46
|
+
}
|
47
|
+
) : /* @__PURE__ */ d(
|
48
|
+
"div",
|
49
|
+
{
|
50
|
+
className: c(
|
51
|
+
"flex flex-col items-center justify-center text-gray-500 text-sm p-2 text-center",
|
52
|
+
r == null ? void 0 : r.previewFile
|
53
|
+
),
|
54
|
+
children: [
|
55
|
+
/* @__PURE__ */ l(s, { className: "w-6 h-6" }),
|
56
|
+
o(e) ? /* @__PURE__ */ l("span", { className: "text-xs break-all", children: e.name }) : /* @__PURE__ */ l("span", { className: "text-xs break-all", children: e })
|
57
|
+
]
|
58
|
+
}
|
59
|
+
)
|
60
|
+
}
|
61
|
+
);
|
62
|
+
};
|
63
|
+
export {
|
64
|
+
h as D,
|
65
|
+
j as F,
|
66
|
+
u as a
|
67
|
+
};
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
2
|
-
import { UseFormReturn } from 'react-hook-form';
|
3
2
|
import { FormRenderControlProps } from './FormRenderControl.types';
|
4
3
|
|
5
|
-
export declare const FormRenderControl: <Data extends FieldValues
|
4
|
+
export declare const FormRenderControl: <Data extends FieldValues>(props: FormRenderControlProps<Data>) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,21 +1,21 @@
|
|
1
|
-
import { jsx as r, jsxs as
|
2
|
-
import { FormField as d, FormItem as
|
3
|
-
const
|
4
|
-
const { form: n, name: m, label: o, render: t,
|
1
|
+
import { jsx as r, jsxs as a } from "react/jsx-runtime";
|
2
|
+
import { FormField as d, FormItem as i, FormLabel as F, FormMessage as p } from "./Form.mjs";
|
3
|
+
const b = (e) => {
|
4
|
+
const { form: n, name: m, label: o, render: t, containerProps: l = {}, ...s } = e;
|
5
5
|
return /* @__PURE__ */ r(
|
6
6
|
d,
|
7
7
|
{
|
8
8
|
control: n.control,
|
9
9
|
name: m,
|
10
|
-
render: (
|
11
|
-
!!o && /* @__PURE__ */ r(
|
12
|
-
t(
|
13
|
-
/* @__PURE__ */ r(
|
10
|
+
render: (c) => /* @__PURE__ */ a(i, { ...l, children: [
|
11
|
+
!!o && /* @__PURE__ */ r(F, { children: o }),
|
12
|
+
t(c),
|
13
|
+
/* @__PURE__ */ r(p, {})
|
14
14
|
] }),
|
15
|
-
...
|
15
|
+
...s
|
16
16
|
}
|
17
17
|
);
|
18
18
|
};
|
19
19
|
export {
|
20
|
-
|
20
|
+
b as FormRenderControl
|
21
21
|
};
|
@@ -9,10 +9,11 @@ export type FormRenderProps<Data extends FieldValues> = ({ field, fieldState, fo
|
|
9
9
|
fieldState: ControllerFieldState;
|
10
10
|
formState: UseFormStateReturn<Data>;
|
11
11
|
}) => React.ReactElement;
|
12
|
-
export interface FormRenderControlProps<Data extends FieldValues
|
13
|
-
form:
|
12
|
+
export interface FormRenderControlProps<Data extends FieldValues> {
|
13
|
+
form: UseFormReturn<Data>;
|
14
14
|
name: FieldPath<Data>;
|
15
15
|
label?: string;
|
16
16
|
render: FormRenderProps<Data>;
|
17
|
+
containerProps?: React.HTMLAttributes<HTMLDivElement>;
|
17
18
|
}
|
18
|
-
export type FormRenderControlExtendProps<Data extends FieldValues
|
19
|
+
export type FormRenderControlExtendProps<Data extends FieldValues> = Omit<FormRenderControlProps<Data>, 'render'>;
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
2
1
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
2
|
import { FormCheckboxProps } from './FormCheckbox.types';
|
4
3
|
|
5
|
-
export declare const FormCheckbox: <Data extends FieldValues
|
4
|
+
export declare const FormCheckbox: <Data extends FieldValues>(props: FormCheckboxProps<Data>) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
2
1
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
2
|
import { FormRenderControlExtendProps } from '../Form';
|
4
3
|
|
5
|
-
export interface FormCheckboxProps<Data extends FieldValues
|
4
|
+
export interface FormCheckboxProps<Data extends FieldValues> extends FormRenderControlExtendProps<Data> {
|
6
5
|
disabled?: boolean;
|
7
6
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { FieldValues
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
2
2
|
import { FormComboboxProps } from './FormCombobox.types';
|
3
3
|
|
4
|
-
export declare const FormCombobox: <Data extends FieldValues
|
4
|
+
export declare const FormCombobox: <Data extends FieldValues>(props: FormComboboxProps<Data>) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { FormRenderControlExtendProps } from '../Form';
|
2
2
|
import { ComboboxProps } from '../Combobox';
|
3
|
-
import { UseFormReturn } from 'react-hook-form';
|
4
3
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
4
|
|
6
|
-
export interface FormComboboxProps<Data extends FieldValues
|
5
|
+
export interface FormComboboxProps<Data extends FieldValues> extends FormRenderControlExtendProps<Data>, Omit<ComboboxProps, 'value' | 'onChange'> {
|
7
6
|
}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { FormDatePickerProps } from './FormDatePicker.types';
|
2
|
-
import { FieldValues
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
3
3
|
|
4
|
-
export declare const FormDatePicker: <Data extends FieldValues
|
4
|
+
export declare const FormDatePicker: <Data extends FieldValues>(props: FormDatePickerProps<Data>) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { DatePickerProps } from '../DatePicker';
|
2
2
|
import { FormRenderControlExtendProps } from '../Form';
|
3
|
-
import { UseFormReturn } from 'react-hook-form';
|
4
3
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
4
|
|
6
|
-
export interface FormDatePickerProps<Data extends FieldValues
|
5
|
+
export interface FormDatePickerProps<Data extends FieldValues> extends FormRenderControlExtendProps<Data>, DatePickerProps {
|
7
6
|
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
2
|
+
import { FormControl as a } from "../Form/Form.mjs";
|
3
|
+
import { FormRenderControl as l } from "../Form/FormRenderControl.mjs";
|
4
|
+
import { Dropzone as f } from "../Dropzone/Dropzone.mjs";
|
5
|
+
const h = (n) => {
|
6
|
+
const { form: e, label: m, name: t, ...p } = n;
|
7
|
+
return /* @__PURE__ */ o(
|
8
|
+
l,
|
9
|
+
{
|
10
|
+
form: e,
|
11
|
+
label: m,
|
12
|
+
name: t,
|
13
|
+
render: ({ field: r }) => /* @__PURE__ */ o(a, { children: /* @__PURE__ */ o(f, { ...p, ...r, onChangeValue: r.onChange }) })
|
14
|
+
}
|
15
|
+
);
|
16
|
+
};
|
17
|
+
export {
|
18
|
+
h as FormDropzone
|
19
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { FormRenderControlExtendProps } from '../Form';
|
2
|
+
import { DropzoneProps } from '../Dropzone';
|
3
|
+
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
4
|
+
|
5
|
+
export interface FormDropzoneProps<Data extends FieldValues> extends FormRenderControlExtendProps<Data>, DropzoneProps {
|
6
|
+
}
|
package/FormInput/FormInput.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
2
1
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
2
|
import { FormInputProps } from './FormInput.types';
|
4
3
|
|
5
|
-
export declare const FormInput: <Data extends FieldValues
|
4
|
+
export declare const FormInput: <Data extends FieldValues>(props: FormInputProps<Data>) => import("react/jsx-runtime").JSX.Element;
|
package/FormInput/FormInput.mjs
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
2
2
|
import { FormControl as l } from "../Form/Form.mjs";
|
3
|
-
import { FormRenderControl as
|
4
|
-
import { Input as
|
5
|
-
|
6
|
-
const d = (m) => {
|
3
|
+
import { FormRenderControl as u } from "../Form/FormRenderControl.mjs";
|
4
|
+
import { Input as a } from "../Input/Input.mjs";
|
5
|
+
const F = (m) => {
|
7
6
|
const { form: t, label: e, name: n, ...p } = m;
|
8
7
|
return /* @__PURE__ */ r(
|
9
|
-
|
8
|
+
u,
|
10
9
|
{
|
11
10
|
form: t,
|
12
11
|
name: n,
|
13
12
|
label: e,
|
14
13
|
render: ({ field: o }) => /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(
|
15
|
-
|
14
|
+
a,
|
16
15
|
{
|
17
16
|
...o,
|
18
17
|
value: o.value || "",
|
@@ -23,5 +22,5 @@ const d = (m) => {
|
|
23
22
|
);
|
24
23
|
};
|
25
24
|
export {
|
26
|
-
|
25
|
+
F as FormInput
|
27
26
|
};
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { InputProps } from '../Input';
|
2
2
|
import { FormRenderControlExtendProps } from '../Form';
|
3
|
-
import { UseFormReturn } from 'react-hook-form';
|
4
3
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
4
|
|
6
|
-
export interface FormInputProps<Data extends FieldValues
|
5
|
+
export interface FormInputProps<Data extends FieldValues> extends FormRenderControlExtendProps<Data>, Omit<InputProps, 'form' | 'name'> {
|
7
6
|
}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
2
1
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
2
|
import { FormSelectProps } from './FormSelect.types';
|
4
3
|
|
5
|
-
export declare const FormSelect: <Data extends FieldValues,
|
4
|
+
export declare const FormSelect: <Data extends FieldValues, ExtendOptionData>(props: FormSelectProps<Data, ExtendOptionData>) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,38 +1,40 @@
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
2
|
-
import { FormControl as
|
3
|
-
import { FormRenderControl as
|
2
|
+
import { FormControl as f } from "../Form/Form.mjs";
|
3
|
+
import { FormRenderControl as d } from "../Form/FormRenderControl.mjs";
|
4
4
|
import "../Select/SelectRoot.mjs";
|
5
|
-
import { Select as
|
6
|
-
const
|
5
|
+
import { Select as g } from "../Select/Select.mjs";
|
6
|
+
const S = (n) => {
|
7
7
|
const {
|
8
|
-
form:
|
8
|
+
form: m,
|
9
9
|
label: i,
|
10
|
-
name:
|
11
|
-
options:
|
10
|
+
name: p,
|
11
|
+
options: l = [],
|
12
12
|
onChange: r,
|
13
|
-
|
14
|
-
|
13
|
+
containerProps: c,
|
14
|
+
...s
|
15
|
+
} = n;
|
15
16
|
return /* @__PURE__ */ e(
|
16
|
-
|
17
|
+
d,
|
17
18
|
{
|
18
|
-
form:
|
19
|
-
name:
|
19
|
+
form: m,
|
20
|
+
name: p,
|
20
21
|
label: i,
|
22
|
+
containerProps: c,
|
21
23
|
render: ({ field: t }) => /* @__PURE__ */ e(
|
22
|
-
|
24
|
+
g,
|
23
25
|
{
|
24
26
|
value: t.value,
|
25
|
-
options:
|
27
|
+
options: l,
|
26
28
|
onChange: (o) => {
|
27
29
|
t.onChange(o), r == null || r(o);
|
28
30
|
},
|
29
|
-
renderTrigger: (o,
|
30
|
-
...
|
31
|
+
renderTrigger: (o, a) => /* @__PURE__ */ e(f, { children: a }),
|
32
|
+
...s
|
31
33
|
}
|
32
34
|
)
|
33
35
|
}
|
34
36
|
);
|
35
37
|
};
|
36
38
|
export {
|
37
|
-
|
39
|
+
S as FormSelect
|
38
40
|
};
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { SelectProps } from '../Select';
|
2
2
|
import { FormRenderControlExtendProps } from '../Form';
|
3
|
-
import { UseFormReturn } from 'react-hook-form';
|
4
3
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
5
4
|
|
6
|
-
export interface FormSelectProps<Data extends FieldValues,
|
5
|
+
export interface FormSelectProps<Data extends FieldValues, ExtendOptionData> extends FormRenderControlExtendProps<Data>, Omit<SelectProps<ExtendOptionData>, 'onChange'>, Partial<Pick<SelectProps<ExtendOptionData>, 'onChange'>> {
|
7
6
|
}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import { UseFormReturn } from 'react-hook-form';
|
2
1
|
import { FieldValues } from 'react-hook-form/dist/types/fields';
|
3
2
|
import { FormTextareaProps } from './FormTextarea.types';
|
4
3
|
|
5
|
-
export declare const FormTextarea: <Data extends FieldValues
|
4
|
+
export declare const FormTextarea: <Data extends FieldValues>(props: FormTextareaProps<Data>) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,26 +1,27 @@
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
2
|
-
import { FormControl as
|
3
|
-
import { FormRenderControl as
|
4
|
-
import { Textarea as
|
5
|
-
const
|
6
|
-
const { form:
|
2
|
+
import { FormControl as p } from "../Form/Form.mjs";
|
3
|
+
import { FormRenderControl as i } from "../Form/FormRenderControl.mjs";
|
4
|
+
import { Textarea as s } from "../Textarea/Textarea.mjs";
|
5
|
+
const F = (e) => {
|
6
|
+
const { form: t, label: m, name: n, containerProps: a, ...l } = e;
|
7
7
|
return /* @__PURE__ */ r(
|
8
|
-
|
8
|
+
i,
|
9
9
|
{
|
10
|
-
form:
|
10
|
+
form: t,
|
11
11
|
name: n,
|
12
|
-
label:
|
13
|
-
|
14
|
-
|
12
|
+
label: m,
|
13
|
+
containerProps: a,
|
14
|
+
render: ({ field: o }) => /* @__PURE__ */ r(p, { children: /* @__PURE__ */ r(
|
15
|
+
s,
|
15
16
|
{
|
16
17
|
...o,
|
17
18
|
value: o.value || "",
|
18
|
-
...
|
19
|
+
...l
|
19
20
|
}
|
20
21
|
) })
|
21
22
|
}
|
22
23
|
);
|
23
24
|
};
|
24
25
|
export {
|
25
|
-
|
26
|
+
F as FormTextarea
|
26
27
|
};
|