@deepnoid/ui 0.1.98 → 0.1.100
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/.turbo/turbo-build.log +163 -163
- package/dist/{chunk-C5FUPNE4.mjs → chunk-AATFH6PB.mjs} +29 -12
- package/dist/{chunk-VFFLJN5N.mjs → chunk-FESRJFPF.mjs} +30 -6
- package/dist/{chunk-45N5ZAIJ.mjs → chunk-JN6ELUAT.mjs} +1 -1
- package/dist/{chunk-VIEBF2WH.mjs → chunk-ZAHEKJIU.mjs} +1 -1
- package/dist/components/fileUpload/fileUpload.d.mts +3 -13
- package/dist/components/fileUpload/fileUpload.d.ts +3 -13
- package/dist/components/fileUpload/fileUpload.js +218 -32
- package/dist/components/fileUpload/fileUpload.mjs +5 -2
- package/dist/components/fileUpload/index.js +218 -32
- package/dist/components/fileUpload/index.mjs +5 -2
- package/dist/components/input/index.js +30 -6
- package/dist/components/input/index.mjs +1 -1
- package/dist/components/input/input.d.mts +21 -0
- package/dist/components/input/input.d.ts +21 -0
- package/dist/components/input/input.js +30 -6
- package/dist/components/input/input.mjs +1 -1
- package/dist/components/pagination/index.js +30 -6
- package/dist/components/pagination/index.mjs +2 -2
- package/dist/components/pagination/pagination.js +30 -6
- package/dist/components/pagination/pagination.mjs +2 -2
- package/dist/components/table/index.js +30 -6
- package/dist/components/table/index.mjs +3 -3
- package/dist/components/table/table-body.js +30 -6
- package/dist/components/table/table-body.mjs +3 -3
- package/dist/components/table/table-head.js +30 -6
- package/dist/components/table/table-head.mjs +3 -3
- package/dist/components/table/table.js +30 -6
- package/dist/components/table/table.mjs +3 -3
- package/dist/index.js +273 -233
- package/dist/index.mjs +27 -27
- package/package.json +1 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
progress_default
|
|
4
|
+
} from "./chunk-5FFTHFBX.mjs";
|
|
2
5
|
import {
|
|
3
6
|
input_default
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FESRJFPF.mjs";
|
|
5
8
|
import {
|
|
6
9
|
button_default
|
|
7
10
|
} from "./chunk-IW57F7WZ.mjs";
|
|
@@ -17,10 +20,12 @@ function FileUpload({
|
|
|
17
20
|
buttonText,
|
|
18
21
|
maxSizeMB = 10,
|
|
19
22
|
placeholder,
|
|
23
|
+
errorMessage,
|
|
20
24
|
accept = [],
|
|
21
25
|
acceptErrorMessage = "The file type is not allowed.",
|
|
22
26
|
sizeErrorMessage = `File is too large.`,
|
|
23
27
|
onFileUpload,
|
|
28
|
+
onCancelUpload,
|
|
24
29
|
helperMessage,
|
|
25
30
|
showProgress,
|
|
26
31
|
name,
|
|
@@ -30,7 +35,7 @@ function FileUpload({
|
|
|
30
35
|
const uploadIntervalRef = useRef(null);
|
|
31
36
|
const [file, setFile] = useState(null);
|
|
32
37
|
const [uploadProgress, setUploadProgress] = useState(0);
|
|
33
|
-
const [
|
|
38
|
+
const [message, setMessage] = useState(errorMessage);
|
|
34
39
|
const slots = fileUploadStyle();
|
|
35
40
|
const handleButtonClick = () => {
|
|
36
41
|
var _a;
|
|
@@ -64,12 +69,12 @@ function FileUpload({
|
|
|
64
69
|
if (!selectedFile) return;
|
|
65
70
|
const error = validateFile(selectedFile);
|
|
66
71
|
if (error) {
|
|
67
|
-
|
|
72
|
+
setMessage(error);
|
|
68
73
|
setFile(null);
|
|
69
74
|
return;
|
|
70
75
|
}
|
|
71
76
|
setFile(selectedFile);
|
|
72
|
-
|
|
77
|
+
setMessage("");
|
|
73
78
|
startUploadSimulation(selectedFile);
|
|
74
79
|
};
|
|
75
80
|
const handleCancelUpload = () => {
|
|
@@ -78,7 +83,8 @@ function FileUpload({
|
|
|
78
83
|
}
|
|
79
84
|
setFile(null);
|
|
80
85
|
setUploadProgress(0);
|
|
81
|
-
|
|
86
|
+
setMessage("");
|
|
87
|
+
if (onCancelUpload) onCancelUpload();
|
|
82
88
|
};
|
|
83
89
|
useEffect(() => {
|
|
84
90
|
return () => {
|
|
@@ -87,10 +93,24 @@ function FileUpload({
|
|
|
87
93
|
}
|
|
88
94
|
};
|
|
89
95
|
}, []);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
setMessage(errorMessage);
|
|
98
|
+
}, [setMessage, errorMessage]);
|
|
90
99
|
return /* @__PURE__ */ jsxs("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
91
100
|
/* @__PURE__ */ jsxs("div", { className: slots.container({ class: classNames == null ? void 0 : classNames.container }), children: [
|
|
92
101
|
/* @__PURE__ */ jsxs("div", { className: slots.inputWrapper(), children: [
|
|
93
|
-
/* @__PURE__ */ jsx(
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
input_default,
|
|
104
|
+
{
|
|
105
|
+
name,
|
|
106
|
+
readOnly: true,
|
|
107
|
+
variant: "outline",
|
|
108
|
+
full: true,
|
|
109
|
+
placeholder,
|
|
110
|
+
defaultValue: file == null ? void 0 : file.name,
|
|
111
|
+
errorMessage: message
|
|
112
|
+
}
|
|
113
|
+
),
|
|
94
114
|
file && /* @__PURE__ */ jsx(
|
|
95
115
|
icon_button_default,
|
|
96
116
|
{
|
|
@@ -106,9 +126,8 @@ function FileUpload({
|
|
|
106
126
|
/* @__PURE__ */ jsx(button_default, { type: "button", variant: "outline", onClick: handleButtonClick, children: buttonText }),
|
|
107
127
|
/* @__PURE__ */ jsx("input", { ref: fileInputRef, type: "file", hidden: true, accept: accept.join(","), onChange: handleFileChange })
|
|
108
128
|
] }),
|
|
109
|
-
showProgress && file && uploadProgress < 100 && /* @__PURE__ */ jsx(
|
|
110
|
-
!
|
|
111
|
-
errorMessage && /* @__PURE__ */ jsx("p", { className: slots.errorMessage(), children: errorMessage })
|
|
129
|
+
showProgress && file && uploadProgress < 100 && /* @__PURE__ */ jsx(progress_default, { value: uploadProgress }),
|
|
130
|
+
!message && helperMessage && /* @__PURE__ */ jsx("p", { className: slots.helperMessage(), children: helperMessage })
|
|
112
131
|
] });
|
|
113
132
|
}
|
|
114
133
|
FileUpload.displayName = "FileUpload";
|
|
@@ -116,11 +135,9 @@ var fileUpload_default = FileUpload;
|
|
|
116
135
|
var fileUploadStyle = tv({
|
|
117
136
|
slots: {
|
|
118
137
|
base: ["flex", "flex-col", "gap-[5px]"],
|
|
119
|
-
container: ["flex", "
|
|
138
|
+
container: ["flex", "gap-[10px]"],
|
|
120
139
|
inputWrapper: ["relative", "flex-1"],
|
|
121
140
|
cancelButton: ["absolute", "top-1/2", "right-0", "-translate-y-1/2"],
|
|
122
|
-
progressBarContainer: ["w-full", "h-[5px]", "bg-neutral-light", "rounded-full", "overflow-hidden"],
|
|
123
|
-
progressBar: ["h-full", "bg-primary-main", "transition-all"],
|
|
124
141
|
errorMessage: ["text-danger-main", "text-sm"],
|
|
125
142
|
helperMessage: ["text-neutral-main", "text-sm"]
|
|
126
143
|
}
|
|
@@ -185,12 +185,10 @@ var inputStyle = tv(
|
|
|
185
185
|
errorMessage: ["text-danger-main"],
|
|
186
186
|
readonlyWrapper: [
|
|
187
187
|
"pointer-events-none",
|
|
188
|
-
"
|
|
189
|
-
"placeholder
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"[&>input]:!text-body-foreground",
|
|
193
|
-
"[&>input]:placeholder:!text-body-foreground"
|
|
188
|
+
"text-body-foreground",
|
|
189
|
+
"placeholder:text-body-foreground",
|
|
190
|
+
"[&>input]:text-body-foreground",
|
|
191
|
+
"[&>input]:placeholder:text-body-foreground"
|
|
194
192
|
],
|
|
195
193
|
readonly: []
|
|
196
194
|
},
|
|
@@ -299,6 +297,16 @@ var inputStyle = tv(
|
|
|
299
297
|
helperMessage: ["!text-neutral-light"],
|
|
300
298
|
errorMessage: ["!text-danger-light"]
|
|
301
299
|
}
|
|
300
|
+
},
|
|
301
|
+
readonly: {
|
|
302
|
+
true: {
|
|
303
|
+
readonlyWrapper: ["pointer-events-none"],
|
|
304
|
+
input: [
|
|
305
|
+
"group-has-[p.error]/input:!text-danger-main",
|
|
306
|
+
"group-has-[p.error]/input:placeholder:!text-danger-main"
|
|
307
|
+
],
|
|
308
|
+
content: ["group-has-[p.error]/input:!text-danger-main"]
|
|
309
|
+
}
|
|
302
310
|
}
|
|
303
311
|
},
|
|
304
312
|
compoundVariants: [
|
|
@@ -368,6 +376,22 @@ var inputStyle = tv(
|
|
|
368
376
|
"group-has-[p.error]/input:placeholder:!text-danger-light"
|
|
369
377
|
]
|
|
370
378
|
}
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
readonly: true,
|
|
382
|
+
color: "primary",
|
|
383
|
+
class: {
|
|
384
|
+
input: ["!text-primary-main", "placeholder:!text-primary-main"],
|
|
385
|
+
content: ["!text-primary-main"]
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
readonly: true,
|
|
390
|
+
color: "secondary",
|
|
391
|
+
class: {
|
|
392
|
+
input: ["!text-secondary-main", "placeholder:!text-secondary-main"],
|
|
393
|
+
content: ["!text-secondary-main"]
|
|
394
|
+
}
|
|
371
395
|
}
|
|
372
396
|
],
|
|
373
397
|
defaultVariants: {
|
|
@@ -7,16 +7,18 @@ type FileUploadProps = {
|
|
|
7
7
|
buttonText: string;
|
|
8
8
|
maxSizeMB?: number;
|
|
9
9
|
placeholder?: string;
|
|
10
|
+
errorMessage?: string;
|
|
10
11
|
accept?: string[];
|
|
11
12
|
acceptErrorMessage?: string;
|
|
12
13
|
sizeErrorMessage?: string;
|
|
13
14
|
onFileUpload?: (file: File) => void;
|
|
15
|
+
onCancelUpload?: () => void;
|
|
14
16
|
helperMessage?: string;
|
|
15
17
|
showProgress?: boolean;
|
|
16
18
|
name?: string;
|
|
17
19
|
classNames?: SlotsToClasses<FileUploadSlots>;
|
|
18
20
|
};
|
|
19
|
-
declare function FileUpload({ buttonText, maxSizeMB, placeholder, accept, acceptErrorMessage, sizeErrorMessage, onFileUpload, helperMessage, showProgress, name, classNames, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
declare function FileUpload({ buttonText, maxSizeMB, placeholder, errorMessage, accept, acceptErrorMessage, sizeErrorMessage, onFileUpload, onCancelUpload, helperMessage, showProgress, name, classNames, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
20
22
|
declare namespace FileUpload {
|
|
21
23
|
var displayName: string;
|
|
22
24
|
}
|
|
@@ -30,8 +32,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
30
32
|
errorMessage?: tailwind_merge.ClassNameValue;
|
|
31
33
|
inputWrapper?: tailwind_merge.ClassNameValue;
|
|
32
34
|
cancelButton?: tailwind_merge.ClassNameValue;
|
|
33
|
-
progressBarContainer?: tailwind_merge.ClassNameValue;
|
|
34
|
-
progressBar?: tailwind_merge.ClassNameValue;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
} | {
|
|
@@ -43,8 +43,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
43
43
|
errorMessage?: tailwind_merge.ClassNameValue;
|
|
44
44
|
inputWrapper?: tailwind_merge.ClassNameValue;
|
|
45
45
|
cancelButton?: tailwind_merge.ClassNameValue;
|
|
46
|
-
progressBarContainer?: tailwind_merge.ClassNameValue;
|
|
47
|
-
progressBar?: tailwind_merge.ClassNameValue;
|
|
48
46
|
};
|
|
49
47
|
};
|
|
50
48
|
} | {}, {
|
|
@@ -52,8 +50,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
52
50
|
container: string[];
|
|
53
51
|
inputWrapper: string[];
|
|
54
52
|
cancelButton: string[];
|
|
55
|
-
progressBarContainer: string[];
|
|
56
|
-
progressBar: string[];
|
|
57
53
|
errorMessage: string[];
|
|
58
54
|
helperMessage: string[];
|
|
59
55
|
}, undefined, {
|
|
@@ -65,8 +61,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
65
61
|
errorMessage?: tailwind_merge.ClassNameValue;
|
|
66
62
|
inputWrapper?: tailwind_merge.ClassNameValue;
|
|
67
63
|
cancelButton?: tailwind_merge.ClassNameValue;
|
|
68
|
-
progressBarContainer?: tailwind_merge.ClassNameValue;
|
|
69
|
-
progressBar?: tailwind_merge.ClassNameValue;
|
|
70
64
|
};
|
|
71
65
|
};
|
|
72
66
|
} | {}, {
|
|
@@ -74,8 +68,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
74
68
|
container: string[];
|
|
75
69
|
inputWrapper: string[];
|
|
76
70
|
cancelButton: string[];
|
|
77
|
-
progressBarContainer: string[];
|
|
78
|
-
progressBar: string[];
|
|
79
71
|
errorMessage: string[];
|
|
80
72
|
helperMessage: string[];
|
|
81
73
|
}, tailwind_variants.TVReturnType<unknown, {
|
|
@@ -83,8 +75,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
83
75
|
container: string[];
|
|
84
76
|
inputWrapper: string[];
|
|
85
77
|
cancelButton: string[];
|
|
86
|
-
progressBarContainer: string[];
|
|
87
|
-
progressBar: string[];
|
|
88
78
|
errorMessage: string[];
|
|
89
79
|
helperMessage: string[];
|
|
90
80
|
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -7,16 +7,18 @@ type FileUploadProps = {
|
|
|
7
7
|
buttonText: string;
|
|
8
8
|
maxSizeMB?: number;
|
|
9
9
|
placeholder?: string;
|
|
10
|
+
errorMessage?: string;
|
|
10
11
|
accept?: string[];
|
|
11
12
|
acceptErrorMessage?: string;
|
|
12
13
|
sizeErrorMessage?: string;
|
|
13
14
|
onFileUpload?: (file: File) => void;
|
|
15
|
+
onCancelUpload?: () => void;
|
|
14
16
|
helperMessage?: string;
|
|
15
17
|
showProgress?: boolean;
|
|
16
18
|
name?: string;
|
|
17
19
|
classNames?: SlotsToClasses<FileUploadSlots>;
|
|
18
20
|
};
|
|
19
|
-
declare function FileUpload({ buttonText, maxSizeMB, placeholder, accept, acceptErrorMessage, sizeErrorMessage, onFileUpload, helperMessage, showProgress, name, classNames, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
declare function FileUpload({ buttonText, maxSizeMB, placeholder, errorMessage, accept, acceptErrorMessage, sizeErrorMessage, onFileUpload, onCancelUpload, helperMessage, showProgress, name, classNames, }: FileUploadProps): react_jsx_runtime.JSX.Element;
|
|
20
22
|
declare namespace FileUpload {
|
|
21
23
|
var displayName: string;
|
|
22
24
|
}
|
|
@@ -30,8 +32,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
30
32
|
errorMessage?: tailwind_merge.ClassNameValue;
|
|
31
33
|
inputWrapper?: tailwind_merge.ClassNameValue;
|
|
32
34
|
cancelButton?: tailwind_merge.ClassNameValue;
|
|
33
|
-
progressBarContainer?: tailwind_merge.ClassNameValue;
|
|
34
|
-
progressBar?: tailwind_merge.ClassNameValue;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
} | {
|
|
@@ -43,8 +43,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
43
43
|
errorMessage?: tailwind_merge.ClassNameValue;
|
|
44
44
|
inputWrapper?: tailwind_merge.ClassNameValue;
|
|
45
45
|
cancelButton?: tailwind_merge.ClassNameValue;
|
|
46
|
-
progressBarContainer?: tailwind_merge.ClassNameValue;
|
|
47
|
-
progressBar?: tailwind_merge.ClassNameValue;
|
|
48
46
|
};
|
|
49
47
|
};
|
|
50
48
|
} | {}, {
|
|
@@ -52,8 +50,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
52
50
|
container: string[];
|
|
53
51
|
inputWrapper: string[];
|
|
54
52
|
cancelButton: string[];
|
|
55
|
-
progressBarContainer: string[];
|
|
56
|
-
progressBar: string[];
|
|
57
53
|
errorMessage: string[];
|
|
58
54
|
helperMessage: string[];
|
|
59
55
|
}, undefined, {
|
|
@@ -65,8 +61,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
65
61
|
errorMessage?: tailwind_merge.ClassNameValue;
|
|
66
62
|
inputWrapper?: tailwind_merge.ClassNameValue;
|
|
67
63
|
cancelButton?: tailwind_merge.ClassNameValue;
|
|
68
|
-
progressBarContainer?: tailwind_merge.ClassNameValue;
|
|
69
|
-
progressBar?: tailwind_merge.ClassNameValue;
|
|
70
64
|
};
|
|
71
65
|
};
|
|
72
66
|
} | {}, {
|
|
@@ -74,8 +68,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
74
68
|
container: string[];
|
|
75
69
|
inputWrapper: string[];
|
|
76
70
|
cancelButton: string[];
|
|
77
|
-
progressBarContainer: string[];
|
|
78
|
-
progressBar: string[];
|
|
79
71
|
errorMessage: string[];
|
|
80
72
|
helperMessage: string[];
|
|
81
73
|
}, tailwind_variants.TVReturnType<unknown, {
|
|
@@ -83,8 +75,6 @@ declare const fileUploadStyle: tailwind_variants.TVReturnType<{
|
|
|
83
75
|
container: string[];
|
|
84
76
|
inputWrapper: string[];
|
|
85
77
|
cancelButton: string[];
|
|
86
|
-
progressBarContainer: string[];
|
|
87
|
-
progressBar: string[];
|
|
88
78
|
errorMessage: string[];
|
|
89
79
|
helperMessage: string[];
|
|
90
80
|
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -107,8 +107,8 @@ __export(fileUpload_exports, {
|
|
|
107
107
|
fileUploadStyle: () => fileUploadStyle
|
|
108
108
|
});
|
|
109
109
|
module.exports = __toCommonJS(fileUpload_exports);
|
|
110
|
-
var
|
|
111
|
-
var
|
|
110
|
+
var import_react7 = require("react");
|
|
111
|
+
var import_tailwind_variants6 = require("tailwind-variants");
|
|
112
112
|
|
|
113
113
|
// src/components/input/input.tsx
|
|
114
114
|
var import_react = require("react");
|
|
@@ -5198,12 +5198,10 @@ var inputStyle = tv(
|
|
|
5198
5198
|
errorMessage: ["text-danger-main"],
|
|
5199
5199
|
readonlyWrapper: [
|
|
5200
5200
|
"pointer-events-none",
|
|
5201
|
-
"
|
|
5202
|
-
"placeholder
|
|
5203
|
-
"
|
|
5204
|
-
"
|
|
5205
|
-
"[&>input]:!text-body-foreground",
|
|
5206
|
-
"[&>input]:placeholder:!text-body-foreground"
|
|
5201
|
+
"text-body-foreground",
|
|
5202
|
+
"placeholder:text-body-foreground",
|
|
5203
|
+
"[&>input]:text-body-foreground",
|
|
5204
|
+
"[&>input]:placeholder:text-body-foreground"
|
|
5207
5205
|
],
|
|
5208
5206
|
readonly: []
|
|
5209
5207
|
},
|
|
@@ -5312,6 +5310,16 @@ var inputStyle = tv(
|
|
|
5312
5310
|
helperMessage: ["!text-neutral-light"],
|
|
5313
5311
|
errorMessage: ["!text-danger-light"]
|
|
5314
5312
|
}
|
|
5313
|
+
},
|
|
5314
|
+
readonly: {
|
|
5315
|
+
true: {
|
|
5316
|
+
readonlyWrapper: ["pointer-events-none"],
|
|
5317
|
+
input: [
|
|
5318
|
+
"group-has-[p.error]/input:!text-danger-main",
|
|
5319
|
+
"group-has-[p.error]/input:placeholder:!text-danger-main"
|
|
5320
|
+
],
|
|
5321
|
+
content: ["group-has-[p.error]/input:!text-danger-main"]
|
|
5322
|
+
}
|
|
5315
5323
|
}
|
|
5316
5324
|
},
|
|
5317
5325
|
compoundVariants: [
|
|
@@ -5381,6 +5389,22 @@ var inputStyle = tv(
|
|
|
5381
5389
|
"group-has-[p.error]/input:placeholder:!text-danger-light"
|
|
5382
5390
|
]
|
|
5383
5391
|
}
|
|
5392
|
+
},
|
|
5393
|
+
{
|
|
5394
|
+
readonly: true,
|
|
5395
|
+
color: "primary",
|
|
5396
|
+
class: {
|
|
5397
|
+
input: ["!text-primary-main", "placeholder:!text-primary-main"],
|
|
5398
|
+
content: ["!text-primary-main"]
|
|
5399
|
+
}
|
|
5400
|
+
},
|
|
5401
|
+
{
|
|
5402
|
+
readonly: true,
|
|
5403
|
+
color: "secondary",
|
|
5404
|
+
class: {
|
|
5405
|
+
input: ["!text-secondary-main", "placeholder:!text-secondary-main"],
|
|
5406
|
+
content: ["!text-secondary-main"]
|
|
5407
|
+
}
|
|
5384
5408
|
}
|
|
5385
5409
|
],
|
|
5386
5410
|
defaultVariants: {
|
|
@@ -6248,26 +6272,176 @@ var iconButtonStyle = tv({
|
|
|
6248
6272
|
}
|
|
6249
6273
|
});
|
|
6250
6274
|
|
|
6251
|
-
// src/components/
|
|
6275
|
+
// src/components/progress/progress.tsx
|
|
6276
|
+
var import_react6 = require("react");
|
|
6277
|
+
|
|
6278
|
+
// src/hooks/useIsMounted.ts
|
|
6279
|
+
var import_react5 = require("react");
|
|
6280
|
+
function useIsMounted(props = {}) {
|
|
6281
|
+
const { rerender = false, delay = 0 } = props;
|
|
6282
|
+
const isMountedRef = (0, import_react5.useRef)(false);
|
|
6283
|
+
const [isMounted, setIsMounted] = (0, import_react5.useState)(false);
|
|
6284
|
+
(0, import_react5.useEffect)(() => {
|
|
6285
|
+
isMountedRef.current = true;
|
|
6286
|
+
let timer = null;
|
|
6287
|
+
if (rerender) {
|
|
6288
|
+
if (delay > 0) {
|
|
6289
|
+
timer = setTimeout(() => {
|
|
6290
|
+
setIsMounted(true);
|
|
6291
|
+
}, delay);
|
|
6292
|
+
} else {
|
|
6293
|
+
setIsMounted(true);
|
|
6294
|
+
}
|
|
6295
|
+
}
|
|
6296
|
+
return () => {
|
|
6297
|
+
isMountedRef.current = false;
|
|
6298
|
+
if (rerender) {
|
|
6299
|
+
setIsMounted(false);
|
|
6300
|
+
}
|
|
6301
|
+
if (timer) {
|
|
6302
|
+
clearTimeout(timer);
|
|
6303
|
+
}
|
|
6304
|
+
};
|
|
6305
|
+
}, [rerender]);
|
|
6306
|
+
return [(0, import_react5.useCallback)(() => isMountedRef.current, []), isMounted];
|
|
6307
|
+
}
|
|
6308
|
+
|
|
6309
|
+
// src/components/progress/progress.tsx
|
|
6252
6310
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
6311
|
+
var Progress = (originalProps) => {
|
|
6312
|
+
const [props, variantProps] = mapPropsVariants(originalProps, progressStyle.variantKeys);
|
|
6313
|
+
const { children, classNames, value = 0, minValue = 0, maxValue = 100, ...progressProps } = props;
|
|
6314
|
+
const isIndeterminate = originalProps.isIndeterminate;
|
|
6315
|
+
const [, isMounted] = useIsMounted({
|
|
6316
|
+
rerender: true,
|
|
6317
|
+
delay: 100
|
|
6318
|
+
});
|
|
6319
|
+
const selfMounted = variantProps.disableAnimation ? true : isMounted;
|
|
6320
|
+
const percentage = (0, import_react6.useMemo)(
|
|
6321
|
+
() => isIndeterminate || !selfMounted ? void 0 : clampPercentage((value - minValue) / (maxValue - minValue) * 100),
|
|
6322
|
+
[selfMounted, isIndeterminate, value, minValue, maxValue]
|
|
6323
|
+
);
|
|
6324
|
+
const slots = (0, import_react6.useMemo)(() => progressStyle({ ...variantProps }), [variantProps]);
|
|
6325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: slots.track({ class: classNames == null ? void 0 : classNames.track }), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
6326
|
+
"div",
|
|
6327
|
+
{
|
|
6328
|
+
className: slots.indicator({ class: classNames == null ? void 0 : classNames.indicator }),
|
|
6329
|
+
style: {
|
|
6330
|
+
transform: `translateX(-${100 - (percentage || 0)}%)`
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
) }) });
|
|
6334
|
+
};
|
|
6335
|
+
var progress_default = Progress;
|
|
6336
|
+
var progressStyle = tv({
|
|
6337
|
+
slots: {
|
|
6338
|
+
base: ["flex flex-col gap-2 w-full"],
|
|
6339
|
+
track: ["z-0", "relative", "bg-neutral-soft", "overflow-hidden", "rtl:rotate-180"],
|
|
6340
|
+
indicator: ["h-full"],
|
|
6341
|
+
value: ""
|
|
6342
|
+
},
|
|
6343
|
+
variants: {
|
|
6344
|
+
color: {
|
|
6345
|
+
primary: {
|
|
6346
|
+
indicator: ["bg-gradient-to-r from-primary-light via-primary-light to-primary-main"]
|
|
6347
|
+
},
|
|
6348
|
+
secondary: {
|
|
6349
|
+
indicator: ["bg-gradient-to-r from-secondary-light via-secondary-light to-secondary-main"]
|
|
6350
|
+
},
|
|
6351
|
+
neutral: {
|
|
6352
|
+
indicator: ["bg-gradient-to-r from-neutral-light via-neutral-light to-neutral-main"]
|
|
6353
|
+
},
|
|
6354
|
+
info: {
|
|
6355
|
+
indicator: ["bg-gradient-to-r from-info-light via-info-light to-info-main"]
|
|
6356
|
+
},
|
|
6357
|
+
success: {
|
|
6358
|
+
indicator: ["bg-gradient-to-r from-success-light via-success-light to-success-main"]
|
|
6359
|
+
},
|
|
6360
|
+
warning: {
|
|
6361
|
+
indicator: ["bg-gradient-to-r from-warning-light via-warning-light to-warning-main"]
|
|
6362
|
+
},
|
|
6363
|
+
danger: {
|
|
6364
|
+
indicator: ["bg-gradient-to-r from-danger-light via-danger-light to-danger-main"]
|
|
6365
|
+
}
|
|
6366
|
+
},
|
|
6367
|
+
size: {
|
|
6368
|
+
sm: {
|
|
6369
|
+
track: ["h-[4px]", "rounded-sm"],
|
|
6370
|
+
indicator: "rounded-sm"
|
|
6371
|
+
},
|
|
6372
|
+
md: {
|
|
6373
|
+
track: ["h-[6px]", "rounded-md"],
|
|
6374
|
+
indicator: "rounded-md"
|
|
6375
|
+
},
|
|
6376
|
+
lg: {
|
|
6377
|
+
track: ["h-[8px]", "rounded-lg"],
|
|
6378
|
+
indicator: "rounded-lg"
|
|
6379
|
+
},
|
|
6380
|
+
xl: {
|
|
6381
|
+
track: ["h-[10px]", "rounded-xl"],
|
|
6382
|
+
indicator: "rounded-xl"
|
|
6383
|
+
}
|
|
6384
|
+
},
|
|
6385
|
+
isDisabled: {
|
|
6386
|
+
true: {
|
|
6387
|
+
base: "opacity-disabled cursor-not-allowed"
|
|
6388
|
+
}
|
|
6389
|
+
},
|
|
6390
|
+
disableAnimation: {
|
|
6391
|
+
true: {},
|
|
6392
|
+
false: {
|
|
6393
|
+
indicator: "transition-transform !duration-500"
|
|
6394
|
+
}
|
|
6395
|
+
},
|
|
6396
|
+
isIndeterminate: {
|
|
6397
|
+
true: {
|
|
6398
|
+
indicator: ["absolute", "w-full", "origin-left", "animate-indeterminate-bar"]
|
|
6399
|
+
}
|
|
6400
|
+
}
|
|
6401
|
+
},
|
|
6402
|
+
defaultVariants: {
|
|
6403
|
+
color: "primary",
|
|
6404
|
+
size: "md",
|
|
6405
|
+
isDisabled: false,
|
|
6406
|
+
disableAnimation: false,
|
|
6407
|
+
isIndeterminate: false
|
|
6408
|
+
},
|
|
6409
|
+
compoundVariants: [
|
|
6410
|
+
{
|
|
6411
|
+
isIndeterminate: true,
|
|
6412
|
+
disableAnimation: false,
|
|
6413
|
+
className: {
|
|
6414
|
+
indicator: "!transition-none motion-reduce:transition-none"
|
|
6415
|
+
}
|
|
6416
|
+
}
|
|
6417
|
+
]
|
|
6418
|
+
});
|
|
6419
|
+
var clampPercentage = (value) => {
|
|
6420
|
+
return Math.min(100, Math.max(0, value));
|
|
6421
|
+
};
|
|
6422
|
+
|
|
6423
|
+
// src/components/fileUpload/fileUpload.tsx
|
|
6424
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
6253
6425
|
function FileUpload({
|
|
6254
6426
|
buttonText,
|
|
6255
6427
|
maxSizeMB = 10,
|
|
6256
6428
|
placeholder,
|
|
6429
|
+
errorMessage,
|
|
6257
6430
|
accept = [],
|
|
6258
6431
|
acceptErrorMessage = "The file type is not allowed.",
|
|
6259
6432
|
sizeErrorMessage = `File is too large.`,
|
|
6260
6433
|
onFileUpload,
|
|
6434
|
+
onCancelUpload,
|
|
6261
6435
|
helperMessage,
|
|
6262
6436
|
showProgress,
|
|
6263
6437
|
name,
|
|
6264
6438
|
classNames
|
|
6265
6439
|
}) {
|
|
6266
|
-
const fileInputRef = (0,
|
|
6267
|
-
const uploadIntervalRef = (0,
|
|
6268
|
-
const [file, setFile] = (0,
|
|
6269
|
-
const [uploadProgress, setUploadProgress] = (0,
|
|
6270
|
-
const [
|
|
6440
|
+
const fileInputRef = (0, import_react7.useRef)(null);
|
|
6441
|
+
const uploadIntervalRef = (0, import_react7.useRef)(null);
|
|
6442
|
+
const [file, setFile] = (0, import_react7.useState)(null);
|
|
6443
|
+
const [uploadProgress, setUploadProgress] = (0, import_react7.useState)(0);
|
|
6444
|
+
const [message, setMessage] = (0, import_react7.useState)(errorMessage);
|
|
6271
6445
|
const slots = fileUploadStyle();
|
|
6272
6446
|
const handleButtonClick = () => {
|
|
6273
6447
|
var _a;
|
|
@@ -6301,12 +6475,12 @@ function FileUpload({
|
|
|
6301
6475
|
if (!selectedFile) return;
|
|
6302
6476
|
const error = validateFile(selectedFile);
|
|
6303
6477
|
if (error) {
|
|
6304
|
-
|
|
6478
|
+
setMessage(error);
|
|
6305
6479
|
setFile(null);
|
|
6306
6480
|
return;
|
|
6307
6481
|
}
|
|
6308
6482
|
setFile(selectedFile);
|
|
6309
|
-
|
|
6483
|
+
setMessage("");
|
|
6310
6484
|
startUploadSimulation(selectedFile);
|
|
6311
6485
|
};
|
|
6312
6486
|
const handleCancelUpload = () => {
|
|
@@ -6315,20 +6489,35 @@ function FileUpload({
|
|
|
6315
6489
|
}
|
|
6316
6490
|
setFile(null);
|
|
6317
6491
|
setUploadProgress(0);
|
|
6318
|
-
|
|
6492
|
+
setMessage("");
|
|
6493
|
+
if (onCancelUpload) onCancelUpload();
|
|
6319
6494
|
};
|
|
6320
|
-
(0,
|
|
6495
|
+
(0, import_react7.useEffect)(() => {
|
|
6321
6496
|
return () => {
|
|
6322
6497
|
if (uploadIntervalRef.current) {
|
|
6323
6498
|
clearInterval(uploadIntervalRef.current);
|
|
6324
6499
|
}
|
|
6325
6500
|
};
|
|
6326
6501
|
}, []);
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6502
|
+
(0, import_react7.useEffect)(() => {
|
|
6503
|
+
setMessage(errorMessage);
|
|
6504
|
+
}, [setMessage, errorMessage]);
|
|
6505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
6506
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: slots.container({ class: classNames == null ? void 0 : classNames.container }), children: [
|
|
6507
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: slots.inputWrapper(), children: [
|
|
6508
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6509
|
+
input_default,
|
|
6510
|
+
{
|
|
6511
|
+
name,
|
|
6512
|
+
readOnly: true,
|
|
6513
|
+
variant: "outline",
|
|
6514
|
+
full: true,
|
|
6515
|
+
placeholder,
|
|
6516
|
+
defaultValue: file == null ? void 0 : file.name,
|
|
6517
|
+
errorMessage: message
|
|
6518
|
+
}
|
|
6519
|
+
),
|
|
6520
|
+
file && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6332
6521
|
icon_button_default,
|
|
6333
6522
|
{
|
|
6334
6523
|
name: "close",
|
|
@@ -6340,24 +6529,21 @@ function FileUpload({
|
|
|
6340
6529
|
}
|
|
6341
6530
|
)
|
|
6342
6531
|
] }),
|
|
6343
|
-
/* @__PURE__ */ (0,
|
|
6344
|
-
/* @__PURE__ */ (0,
|
|
6532
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(button_default, { type: "button", variant: "outline", onClick: handleButtonClick, children: buttonText }),
|
|
6533
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { ref: fileInputRef, type: "file", hidden: true, accept: accept.join(","), onChange: handleFileChange })
|
|
6345
6534
|
] }),
|
|
6346
|
-
showProgress && file && uploadProgress < 100 && /* @__PURE__ */ (0,
|
|
6347
|
-
!
|
|
6348
|
-
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: slots.errorMessage(), children: errorMessage })
|
|
6535
|
+
showProgress && file && uploadProgress < 100 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(progress_default, { value: uploadProgress }),
|
|
6536
|
+
!message && helperMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: slots.helperMessage(), children: helperMessage })
|
|
6349
6537
|
] });
|
|
6350
6538
|
}
|
|
6351
6539
|
FileUpload.displayName = "FileUpload";
|
|
6352
6540
|
var fileUpload_default = FileUpload;
|
|
6353
|
-
var fileUploadStyle = (0,
|
|
6541
|
+
var fileUploadStyle = (0, import_tailwind_variants6.tv)({
|
|
6354
6542
|
slots: {
|
|
6355
6543
|
base: ["flex", "flex-col", "gap-[5px]"],
|
|
6356
|
-
container: ["flex", "
|
|
6544
|
+
container: ["flex", "gap-[10px]"],
|
|
6357
6545
|
inputWrapper: ["relative", "flex-1"],
|
|
6358
6546
|
cancelButton: ["absolute", "top-1/2", "right-0", "-translate-y-1/2"],
|
|
6359
|
-
progressBarContainer: ["w-full", "h-[5px]", "bg-neutral-light", "rounded-full", "overflow-hidden"],
|
|
6360
|
-
progressBar: ["h-full", "bg-primary-main", "transition-all"],
|
|
6361
6547
|
errorMessage: ["text-danger-main", "text-sm"],
|
|
6362
6548
|
helperMessage: ["text-neutral-main", "text-sm"]
|
|
6363
6549
|
}
|