@oneplatformdev/ui 0.0.1-beta.6 → 0.0.1-beta.60
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/Accordion/Accordion.d.ts +2 -2
- package/Accordion/Accordion.mjs +23 -20
- package/Button/buttonVariants.mjs +5 -5
- package/Calendar/Calendar.mjs +3 -2
- package/Combobox/Combobox.mjs +124 -86
- package/Combobox/Combobox.types.d.ts +13 -1
- package/Command/Command.d.ts +1 -1
- package/DataTable/DataTable.d.ts +10 -3
- package/DataTable/DataTable.mjs +33 -33
- package/DataTable/DataTableColumnFilter.d.ts +4 -0
- package/DataTable/DataTableColumnFilter.mjs +31 -0
- package/DatePicker/DatePicker.mjs +2 -2
- package/Dropzone/Dropzone.d.ts +22 -0
- package/Dropzone/Dropzone.mjs +151 -0
- package/Dropzone/Dropzone.types.d.ts +38 -0
- package/Dropzone/DropzoneFilePreview.d.ts +4 -0
- package/Dropzone/DropzoneFilePreview.mjs +9 -0
- package/Dropzone/DropzoneSinglePickPreview.d.ts +9 -0
- package/Dropzone/DropzoneSinglePickPreview.mjs +38 -0
- package/Dropzone/DropzoneUtils.d.ts +5 -0
- package/Dropzone/DropzoneUtils.mjs +24 -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.mjs +20 -18
- 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.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/Select/Select.mjs +93 -63
- package/Select/Select.types.d.ts +9 -2
- package/Select/SelectRoot.d.ts +2 -2
- package/Select/SelectRoot.mjs +1 -0
- package/TablePagination/TablePagination.d.ts +16 -0
- package/TablePagination/TablePagination.mjs +74 -0
- package/TablePagination/index.d.ts +1 -0
- package/TablePagination/index.mjs +4 -0
- package/TablePagination/package.json +7 -0
- 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 +3 -0
- package/index.mjs +235 -225
- package/package.json +9 -8
@@ -0,0 +1,151 @@
|
|
1
|
+
import { jsxs as r, jsx as i, Fragment as U } from "react/jsx-runtime";
|
2
|
+
import { forwardRef as j, useState as g } from "react";
|
3
|
+
import { useDropzone as O } from "react-dropzone";
|
4
|
+
import { Card as X } from "../Card/Card.mjs";
|
5
|
+
import { X as Y } from "lucide-react";
|
6
|
+
import { cn as f } from "@oneplatformdev/utils";
|
7
|
+
import { F as q, D as G } from "../DropzoneFilePreview-Dhtv8F4u.js";
|
8
|
+
import { DefaultFileIcon as H, isFile as u, extractName as J } from "./DropzoneUtils.mjs";
|
9
|
+
import { DropzoneSinglePickPreview as K } from "./DropzoneSinglePickPreview.mjs";
|
10
|
+
const Q = j(
|
11
|
+
({
|
12
|
+
acceptTypes: y = G,
|
13
|
+
maxSizeMB: F,
|
14
|
+
maxFiles: h = 1,
|
15
|
+
onErrors: a,
|
16
|
+
hideErrors: D = !1,
|
17
|
+
disabled: p = !1,
|
18
|
+
classNames: o,
|
19
|
+
value: z = [],
|
20
|
+
onChangeValue: s,
|
21
|
+
className: E,
|
22
|
+
labelDropzonePrompt: I = "Drop files here or click to select",
|
23
|
+
labelDropzoneSubPrompt: b = "",
|
24
|
+
labelOrClickToSelect: R = "Click to select files",
|
25
|
+
labelSelectedFiles: S = "Selected Files",
|
26
|
+
labelUploadErrors: N = "Upload Errors",
|
27
|
+
labelFileTooLarge: W = "File is too large",
|
28
|
+
labelInvalidFileType: k = "Invalid file type",
|
29
|
+
singlePick: c = !1,
|
30
|
+
...T
|
31
|
+
}, _) => {
|
32
|
+
const [n, v] = g(z), [m, A] = g([]), B = (e, l) => {
|
33
|
+
A(l), a == null || a(l);
|
34
|
+
const t = c ? e.slice(0, 1) : [...n, ...e].slice(0, h);
|
35
|
+
v(t), s == null || s(t);
|
36
|
+
}, w = (e, l) => {
|
37
|
+
if (p) return;
|
38
|
+
e.stopPropagation();
|
39
|
+
const t = n.filter((d, x) => x !== l);
|
40
|
+
v(t), s == null || s(t);
|
41
|
+
}, { getRootProps: L, getInputProps: M, isDragActive: P } = O({
|
42
|
+
onDrop: B,
|
43
|
+
accept: y.reduce((e, l) => (e[l] = [], e), {}),
|
44
|
+
maxSize: F * 1024 * 1024,
|
45
|
+
maxFiles: c ? 1 : h,
|
46
|
+
disabled: p
|
47
|
+
});
|
48
|
+
return /* @__PURE__ */ r(
|
49
|
+
X,
|
50
|
+
{
|
51
|
+
...L(),
|
52
|
+
...T,
|
53
|
+
ref: _,
|
54
|
+
className: f(
|
55
|
+
"border-dashed p-2 text-center flex flex-col items-center justify-center cursor-pointer",
|
56
|
+
p && "border-[#E4E4E7] pointer-events-none",
|
57
|
+
m.length > 0 ? "border-red-500" : "!border-[#E4E4E7]",
|
58
|
+
P && "bg-gray-100",
|
59
|
+
c && "!shadow-none",
|
60
|
+
c && n.length > 0 && "!p-0 !shadow-none",
|
61
|
+
E
|
62
|
+
),
|
63
|
+
children: [
|
64
|
+
/* @__PURE__ */ i("input", { ...M() }),
|
65
|
+
n.length === 0 && m.length === 0 && /* @__PURE__ */ r(
|
66
|
+
"div",
|
67
|
+
{
|
68
|
+
className: f(
|
69
|
+
"flex flex-col items-center gap-1",
|
70
|
+
o == null ? void 0 : o.idleWrapper
|
71
|
+
),
|
72
|
+
children: [
|
73
|
+
/* @__PURE__ */ i(H, {}),
|
74
|
+
!p && /* @__PURE__ */ r(U, { children: [
|
75
|
+
/* @__PURE__ */ i("span", { className: "font-medium text-md text-foreground max-w-[200px]", children: I }),
|
76
|
+
/* @__PURE__ */ i("span", { className: "font-normal text-xs text-foreground max-w-[250px]", children: b })
|
77
|
+
] })
|
78
|
+
]
|
79
|
+
}
|
80
|
+
),
|
81
|
+
m.length > 0 && /* @__PURE__ */ r("div", { className: f("w-full mt-4", o == null ? void 0 : o.errorWrapper), children: [
|
82
|
+
/* @__PURE__ */ r("span", { className: "font-semibold text-red-500", children: [
|
83
|
+
N,
|
84
|
+
":"
|
85
|
+
] }),
|
86
|
+
/* @__PURE__ */ i("ul", { className: "mt-2 text-sm text-red-500 list-disc list-inside", children: m.map((e, l) => /* @__PURE__ */ r("li", { children: [
|
87
|
+
e.file.name,
|
88
|
+
" (",
|
89
|
+
(e.file.size / (1024 * 1024)).toFixed(2),
|
90
|
+
" MB)",
|
91
|
+
!D && /* @__PURE__ */ i("ul", { className: "ml-4 list-disc list-inside", children: e.errors.map((t, d) => /* @__PURE__ */ r("li", { children: [
|
92
|
+
t.code === "file-too-large" && W,
|
93
|
+
t.code === "file-invalid-type" && k,
|
94
|
+
t.code !== "file-too-large" && t.code !== "file-invalid-type" && t.message
|
95
|
+
] }, d)) })
|
96
|
+
] }, l)) })
|
97
|
+
] }),
|
98
|
+
c && n.length > 0 && /* @__PURE__ */ i(
|
99
|
+
K,
|
100
|
+
{
|
101
|
+
item: n[0],
|
102
|
+
onRemoveClick: (e) => w(e, 0),
|
103
|
+
disabled: p
|
104
|
+
}
|
105
|
+
),
|
106
|
+
!c && n.length > 0 && /* @__PURE__ */ r("div", { className: f("w-full mt-2", o == null ? void 0 : o.previewWrapper), children: [
|
107
|
+
/* @__PURE__ */ r("pre", { className: "font-semibold text-gray-600", children: [
|
108
|
+
S,
|
109
|
+
":"
|
110
|
+
] }),
|
111
|
+
/* @__PURE__ */ i("ul", { className: "mt-2 text-sm text-gray-500 flex flex-wrap gap-4 items-start justify-center", children: n.map((e, l) => {
|
112
|
+
const t = u(e) ? e.name : J(e), d = u(e) ? (e.size / (1024 * 1024)).toFixed(2) + " MB" : "";
|
113
|
+
return /* @__PURE__ */ r(
|
114
|
+
"li",
|
115
|
+
{
|
116
|
+
className: "flex flex-col items-center gap-2 relative",
|
117
|
+
children: [
|
118
|
+
/* @__PURE__ */ r("div", { className: "relative", children: [
|
119
|
+
/* @__PURE__ */ i(q, { item: e, styles: o }),
|
120
|
+
/* @__PURE__ */ i(
|
121
|
+
"div",
|
122
|
+
{
|
123
|
+
className: "absolute top-0 right-0 cursor-pointer bg-gray-300 rounded-sm",
|
124
|
+
onClick: (x) => w(x, l),
|
125
|
+
children: /* @__PURE__ */ i(Y, { size: 16, strokeWidth: 1, color: "black" })
|
126
|
+
}
|
127
|
+
)
|
128
|
+
] }),
|
129
|
+
/* @__PURE__ */ r("span", { className: "inline-flex flex-col items-center", children: [
|
130
|
+
/* @__PURE__ */ i("span", { className: "max-w-[80px] text-ellipsis overflow-hidden whitespace-nowrap", children: t }),
|
131
|
+
d && /* @__PURE__ */ r("span", { children: [
|
132
|
+
"(",
|
133
|
+
d,
|
134
|
+
")"
|
135
|
+
] })
|
136
|
+
] })
|
137
|
+
]
|
138
|
+
},
|
139
|
+
l
|
140
|
+
);
|
141
|
+
}) })
|
142
|
+
] })
|
143
|
+
]
|
144
|
+
}
|
145
|
+
);
|
146
|
+
}
|
147
|
+
);
|
148
|
+
Q.displayName = "Dropzone";
|
149
|
+
export {
|
150
|
+
Q as Dropzone
|
151
|
+
};
|
@@ -0,0 +1,38 @@
|
|
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
|
+
labelDropzoneSubPrompt?: string;
|
11
|
+
labelOrClickToSelect?: string;
|
12
|
+
labelSelectedFiles?: string;
|
13
|
+
labelUploadErrors?: string;
|
14
|
+
labelFileTooLarge?: string;
|
15
|
+
labelInvalidFileType?: string;
|
16
|
+
}
|
17
|
+
export interface DropzoneProps extends DropzoneTranslations, React.HTMLAttributes<HTMLDivElement> {
|
18
|
+
acceptTypes?: string[];
|
19
|
+
maxSizeMB: number;
|
20
|
+
maxFiles?: number;
|
21
|
+
onErrors?: (errors: FileRejection[]) => void;
|
22
|
+
hideErrors?: boolean;
|
23
|
+
disabled?: boolean;
|
24
|
+
classNames?: DropzoneStyles;
|
25
|
+
value?: DropzoneValueItem[];
|
26
|
+
onChangeValue?: (items: DropzoneValueItem[]) => void;
|
27
|
+
singlePick?: boolean;
|
28
|
+
}
|
29
|
+
export interface DropzoneStyles {
|
30
|
+
idleWrapper?: string;
|
31
|
+
previewWrapper?: string;
|
32
|
+
errorWrapper?: string;
|
33
|
+
previewWraper?: string;
|
34
|
+
previewImage?: string;
|
35
|
+
previewFile?: string;
|
36
|
+
}
|
37
|
+
export declare const DEFAULT_FILE_TYPES: string[];
|
38
|
+
export declare const DEFAULT_IMAGES_TYPES: string[];
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { DropzoneValueItem } from './Dropzone.types';
|
2
|
+
|
3
|
+
interface SinglePickPreviewProps {
|
4
|
+
item: DropzoneValueItem;
|
5
|
+
disabled?: boolean;
|
6
|
+
onRemoveClick: (e: React.MouseEvent<HTMLDivElement>) => void;
|
7
|
+
}
|
8
|
+
export declare const DropzoneSinglePickPreview: ({ item, disabled, onRemoveClick, }: SinglePickPreviewProps) => import("react/jsx-runtime").JSX.Element;
|
9
|
+
export {};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
2
|
+
import { useState as u, useEffect as f } from "react";
|
3
|
+
import { isFile as p } from "./DropzoneUtils.mjs";
|
4
|
+
import { X as h, FileIcon as m } from "lucide-react";
|
5
|
+
const b = ({
|
6
|
+
item: e,
|
7
|
+
disabled: a,
|
8
|
+
onRemoveClick: d
|
9
|
+
}) => {
|
10
|
+
const r = p(e), l = r ? e.name : e, [n, o] = u(null);
|
11
|
+
return f(() => {
|
12
|
+
if (r) {
|
13
|
+
const i = e;
|
14
|
+
if (i.type.startsWith("image/")) {
|
15
|
+
const s = new FileReader();
|
16
|
+
s.onloadend = () => o(s.result), s.readAsDataURL(i);
|
17
|
+
} else
|
18
|
+
o(null);
|
19
|
+
} else
|
20
|
+
o(typeof e == "string" ? e : null);
|
21
|
+
}, [e, r]), /* @__PURE__ */ c("div", { className: "relative w-full h-64 sm:h-80 md:h-96 overflow-hidden outline-[#E4E4E7] outline-[2px] outline-dashed outline-offset-[-1px] rounded-lg", children: [
|
22
|
+
!a && /* @__PURE__ */ t("div", { className: "absolute top-2 right-2 cursor-pointer bg-white/70 rounded-[4px] p-1 shadow", onClick: d, children: /* @__PURE__ */ t(h, { size: 16, strokeWidth: 2, color: "black" }) }),
|
23
|
+
n ? /* @__PURE__ */ t(
|
24
|
+
"img",
|
25
|
+
{
|
26
|
+
src: n,
|
27
|
+
alt: l == null ? void 0 : l.toString(),
|
28
|
+
className: "w-full h-full object-cover rounded-lg "
|
29
|
+
}
|
30
|
+
) : /* @__PURE__ */ c("div", { className: "w-full h-full flex flex-col items-center justify-center text-gray-600", children: [
|
31
|
+
/* @__PURE__ */ t(m, { size: 28 }),
|
32
|
+
/* @__PURE__ */ t("span", { className: "text-sm mt-2 break-all px-2 text-center", children: l == null ? void 0 : l.toString() })
|
33
|
+
] })
|
34
|
+
] });
|
35
|
+
};
|
36
|
+
export {
|
37
|
+
b as DropzoneSinglePickPreview
|
38
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { DropzoneValueItem } from './Dropzone.types';
|
2
|
+
|
3
|
+
export declare function isFile(item: DropzoneValueItem): item is File;
|
4
|
+
export declare function extractName(url: string): string;
|
5
|
+
export declare const DefaultFileIcon: () => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { jsxs as t, jsx as l } from "react/jsx-runtime";
|
2
|
+
function d(e) {
|
3
|
+
return e instanceof File;
|
4
|
+
}
|
5
|
+
function r(e) {
|
6
|
+
try {
|
7
|
+
const i = e.split("?")[0].split("#")[0].split("/");
|
8
|
+
return i[i.length - 1] || e;
|
9
|
+
} catch {
|
10
|
+
return e;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
const o = () => /* @__PURE__ */ t("svg", { width: "55", height: "55", viewBox: "0 0 55 55", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
14
|
+
/* @__PURE__ */ l("mask", { id: "mask0_2430_114601", maskUnits: "userSpaceOnUse", x: "7", y: "4", width: "39", height: "46", children: /* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M7.25 4.68359H45.6174V49.354H7.25V4.68359Z", fill: "white" }) }),
|
15
|
+
/* @__PURE__ */ l("g", { mask: "url(#mask0_2430_114601)", children: /* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M17.5386 8.05859C13.8103 8.05859 10.7143 11.0781 10.6266 14.8018V38.9196C10.5456 42.7468 13.5606 45.8968 17.3518 45.9801H35.5386C39.2938 45.8451 42.2661 42.7468 42.2413 38.9308V18.9216L31.8148 8.05859H17.5656H17.5386ZM17.5664 49.3551H17.2829C11.6309 49.2336 7.1309 44.5356 7.2524 38.8836V14.7613C7.38515 9.17909 11.9932 4.68359 17.5327 4.68359H17.5732H32.5334C32.9924 4.68359 33.4312 4.87034 33.7507 5.20109L45.1492 17.0743C45.4484 17.3871 45.6172 17.8078 45.6172 18.2421V38.9196C45.6532 44.5648 41.2522 49.1526 35.5979 49.3551H17.5664Z", fill: "#0D0E2B", "fill-opacity": "0.7" }) }),
|
16
|
+
/* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M43.9198 20.3703H37.7233C33.6036 20.359 30.2578 17.002 30.2578 12.889V6.34375C30.2578 5.41225 31.0138 4.65625 31.9453 4.65625C32.8768 4.65625 33.6328 5.41225 33.6328 6.34375V12.889C33.6328 15.148 35.4688 16.9885 37.7278 16.9953H43.9198C44.8513 16.9953 45.6073 17.7513 45.6073 18.6828C45.6073 19.6143 44.8513 20.3703 43.9198 20.3703Z", fill: "#0D0E2B", "fill-opacity": "0.7" }),
|
17
|
+
/* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M25.5708 37.729C24.6393 37.729 23.8833 36.973 23.8833 36.0415V22.4492C23.8833 21.5177 24.6393 20.7617 25.5708 20.7617C26.5023 20.7617 27.2583 21.5177 27.2583 22.4492V36.0415C27.2583 36.973 26.5023 37.729 25.5708 37.729Z", fill: "#0D0E2B", "fill-opacity": "0.7" }),
|
18
|
+
/* @__PURE__ */ l("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M25.5678 37.7279C25.1201 37.7279 24.6881 37.5501 24.3731 37.2306L19.0968 31.9341C18.4398 31.2726 18.4421 30.2039 19.1013 29.5469C19.7628 28.8899 20.8316 28.8899 21.4886 29.5514L25.5678 33.6509L29.6471 29.5514C30.3041 28.8899 31.3728 28.8899 32.0343 29.5469C32.6936 30.2039 32.6958 31.2726 32.0388 31.9341L26.7626 37.2306C26.4476 37.5501 26.0156 37.7279 25.5678 37.7279Z", fill: "#0D0E2B", "fill-opacity": "0.7" })
|
19
|
+
] });
|
20
|
+
export {
|
21
|
+
o as DefaultFileIcon,
|
22
|
+
r as extractName,
|
23
|
+
d as isFile
|
24
|
+
};
|
@@ -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,27 +1,29 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { DatePicker as
|
3
|
-
import { FormControl as
|
4
|
-
import { FormRenderControl as
|
5
|
-
const
|
6
|
-
const { form:
|
7
|
-
return /* @__PURE__ */
|
8
|
-
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
2
|
+
import { DatePicker as l } from "../DatePicker/DatePicker.mjs";
|
3
|
+
import { FormControl as p } from "../Form/Form.mjs";
|
4
|
+
import { FormRenderControl as s } from "../Form/FormRenderControl.mjs";
|
5
|
+
const h = (m) => {
|
6
|
+
const { form: n, name: a, label: c, onDateChange: r, ...i } = m;
|
7
|
+
return /* @__PURE__ */ e(
|
8
|
+
s,
|
9
9
|
{
|
10
|
-
form:
|
11
|
-
name:
|
12
|
-
label:
|
13
|
-
render: ({ field:
|
14
|
-
|
10
|
+
form: n,
|
11
|
+
name: a,
|
12
|
+
label: c,
|
13
|
+
render: ({ field: o }) => /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
|
14
|
+
l,
|
15
15
|
{
|
16
|
-
...
|
17
|
-
...
|
18
|
-
selectedDate:
|
19
|
-
onDateChange:
|
16
|
+
...o,
|
17
|
+
...i,
|
18
|
+
selectedDate: o.value,
|
19
|
+
onDateChange: (t) => {
|
20
|
+
o.onChange(t), r == null || r(t);
|
21
|
+
}
|
20
22
|
}
|
21
23
|
) })
|
22
24
|
}
|
23
25
|
);
|
24
26
|
};
|
25
27
|
export {
|
26
|
-
|
28
|
+
h as FormDatePicker
|
27
29
|
};
|
@@ -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>, Omit<DatePickerProps, 'onDateChange'>, Partial<Pick<DatePickerProps, 'onDateChange'>> {
|
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;
|
@@ -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;
|