@douglasneuroinformatics/libui 3.6.1 → 3.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.d.ts +7 -1
- package/dist/components.js +38 -11
- package/dist/components.js.map +1 -1
- package/dist/douglasneuroinformatics-libui-3.6.3.tgz +0 -0
- package/package.json +1 -1
- package/src/components/FileDropzone/FileDropzone.spec.tsx +2 -2
- package/src/components/FileDropzone/FileDropzone.tsx +47 -16
- package/dist/douglasneuroinformatics-libui-3.6.1.tgz +0 -0
package/dist/components.d.ts
CHANGED
|
@@ -1218,10 +1218,16 @@ type FileDropzoneProps = {
|
|
|
1218
1218
|
acceptedFileTypes: {
|
|
1219
1219
|
[key: string]: string[];
|
|
1220
1220
|
};
|
|
1221
|
+
className?: string;
|
|
1222
|
+
description?: string;
|
|
1221
1223
|
file: File | null;
|
|
1222
1224
|
setFile: (file: File) => void;
|
|
1225
|
+
titles?: {
|
|
1226
|
+
dragActive: string;
|
|
1227
|
+
dragInactive: string;
|
|
1228
|
+
};
|
|
1223
1229
|
};
|
|
1224
|
-
declare const FileDropzone: ({ acceptedFileTypes, file, setFile }: FileDropzoneProps) => react_jsx_runtime.JSX.Element;
|
|
1230
|
+
declare const FileDropzone: ({ acceptedFileTypes, className, description, file, setFile, titles }: FileDropzoneProps) => react_jsx_runtime.JSX.Element;
|
|
1225
1231
|
|
|
1226
1232
|
type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TSchema> = z.TypeOf<TSchema>> = {
|
|
1227
1233
|
[key: `data-${string}`]: unknown;
|
package/dist/components.js
CHANGED
|
@@ -2010,9 +2010,17 @@ var ErrorBoundary = ({ children }) => {
|
|
|
2010
2010
|
|
|
2011
2011
|
// src/components/FileDropzone/FileDropzone.tsx
|
|
2012
2012
|
import { useCallback } from "react";
|
|
2013
|
+
import { UploadIcon } from "lucide-react";
|
|
2013
2014
|
import { useDropzone } from "react-dropzone";
|
|
2014
2015
|
import { jsx as jsx92, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2015
|
-
var FileDropzone = ({
|
|
2016
|
+
var FileDropzone = ({
|
|
2017
|
+
acceptedFileTypes,
|
|
2018
|
+
className,
|
|
2019
|
+
description,
|
|
2020
|
+
file,
|
|
2021
|
+
setFile,
|
|
2022
|
+
titles
|
|
2023
|
+
}) => {
|
|
2016
2024
|
const { t } = useTranslation();
|
|
2017
2025
|
const handleDrop = useCallback(
|
|
2018
2026
|
(acceptedFiles, rejectedFiles) => {
|
|
@@ -2028,16 +2036,35 @@ var FileDropzone = ({ acceptedFileTypes, file, setFile }) => {
|
|
|
2028
2036
|
maxFiles: 1,
|
|
2029
2037
|
onDrop: handleDrop
|
|
2030
2038
|
});
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2039
|
+
const dragActiveTitle = titles?.dragActive ?? t({
|
|
2040
|
+
en: "File to upload",
|
|
2041
|
+
fr: "fichier \xE0 t\xE9l\xE9charger"
|
|
2042
|
+
});
|
|
2043
|
+
const dragInactiveTitle = titles?.dragInactive ?? t({
|
|
2044
|
+
en: "Drag and drop files or click on box to upload",
|
|
2045
|
+
fr: "Glissez-d\xE9posez les fichiers ou cliquez sur la case pour les t\xE9l\xE9charger"
|
|
2046
|
+
});
|
|
2047
|
+
return /* @__PURE__ */ jsxs25(
|
|
2048
|
+
"div",
|
|
2049
|
+
{
|
|
2050
|
+
className: cn(
|
|
2051
|
+
"flex flex-col items-center justify-center rounded-md border border-dashed border-slate-400 p-4 dark:border-slate-600",
|
|
2052
|
+
className
|
|
2053
|
+
),
|
|
2054
|
+
"data-testid": "dropzone",
|
|
2055
|
+
...getRootProps(),
|
|
2056
|
+
children: [
|
|
2057
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-col items-center justify-center gap-3", children: [
|
|
2058
|
+
/* @__PURE__ */ jsx92(UploadIcon, { style: { height: 24, strokeWidth: 2, width: 24 } }),
|
|
2059
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-col items-center gap-1 text-center", children: [
|
|
2060
|
+
/* @__PURE__ */ jsx92("h3", { className: "text-lg font-semibold tracking-tight", "data-testid": "dropzone-title", children: file ? file.name : isDragActive ? dragActiveTitle : dragInactiveTitle }),
|
|
2061
|
+
description && /* @__PURE__ */ jsx92("p", { className: "text-sm text-muted-foreground", children: description })
|
|
2062
|
+
] })
|
|
2063
|
+
] }),
|
|
2064
|
+
/* @__PURE__ */ jsx92("input", { ...getInputProps() })
|
|
2065
|
+
]
|
|
2066
|
+
}
|
|
2067
|
+
);
|
|
2041
2068
|
};
|
|
2042
2069
|
|
|
2043
2070
|
// src/components/Form/Form.tsx
|