@douglasneuroinformatics/libui 3.6.0 → 3.6.2

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.
@@ -1218,16 +1218,22 @@ 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;
1228
1234
  className?: string;
1229
1235
  content: FormContent<TData>;
1230
- fieldsFooter?: React$1.ReactNode;
1236
+ fieldsFooter?: React.ReactNode;
1231
1237
  id?: string;
1232
1238
  initialValues?: PartialNullableFormDataType<TData>;
1233
1239
  onError?: (error: z.ZodError<TData>) => void;
@@ -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 = ({ acceptedFileTypes, file, setFile }) => {
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,21 +2036,28 @@ var FileDropzone = ({ acceptedFileTypes, file, setFile }) => {
2028
2036
  maxFiles: 1,
2029
2037
  onDrop: handleDrop
2030
2038
  });
2031
- return /* @__PURE__ */ jsxs25("div", { "data-testid": "dropzone", ...getRootProps(), children: [
2032
- /* @__PURE__ */ jsx92("p", { className: "mt-1 border border-dashed p-4 text-center text-sm", "data-testid": "dropzoneText", children: file ? file.name : isDragActive ? t({
2033
- en: "File to upload",
2034
- fr: "fichier \xE0 t\xE9l\xE9charger"
2035
- }) : t({
2036
- en: "Drag'n'drop files or click on box to upload",
2037
- fr: "Glissez-d\xE9posez les fichiers ou cliquez sur la case pour les t\xE9l\xE9charger"
2038
- }) }),
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("div", { className: cn("border border-dashed p-4", className), "data-testid": "dropzone", ...getRootProps(), children: [
2048
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-col items-center gap-3", children: [
2049
+ /* @__PURE__ */ jsx92(UploadIcon, { style: { height: 24, strokeWidth: 2, width: 24 } }),
2050
+ /* @__PURE__ */ jsxs25("div", { className: "flex flex-col items-center gap-1 text-center", children: [
2051
+ /* @__PURE__ */ jsx92("h3", { className: "text-lg font-semibold tracking-tight", "data-testid": "dropzone-title", children: file ? file.name : isDragActive ? dragActiveTitle : dragInactiveTitle }),
2052
+ description && /* @__PURE__ */ jsx92("p", { className: "text-sm text-muted-foreground", children: description })
2053
+ ] })
2054
+ ] }),
2039
2055
  /* @__PURE__ */ jsx92("input", { ...getInputProps() })
2040
2056
  ] });
2041
2057
  };
2042
2058
 
2043
2059
  // src/components/Form/Form.tsx
2044
- import { useEffect as useEffect10, useState as useState8 } from "react";
2045
- import "react";
2060
+ import { useEffect as useEffect10, useLayoutEffect, useState as useState8 } from "react";
2046
2061
  import { get, set } from "lodash-es";
2047
2062
  import { twMerge } from "tailwind-merge";
2048
2063
  import "zod";
@@ -3457,7 +3472,7 @@ var Form = ({
3457
3472
  useEffect10(() => {
3458
3473
  revalidate();
3459
3474
  }, [resolvedLanguage]);
3460
- useEffect10(() => {
3475
+ useLayoutEffect(() => {
3461
3476
  if (initialValues) {
3462
3477
  setValues(getInitialValues(initialValues));
3463
3478
  }
@@ -3579,7 +3594,7 @@ var LanguageToggle = ({
3579
3594
  };
3580
3595
 
3581
3596
  // src/components/LineGraph/LineGraph.tsx
3582
- import * as React37 from "react";
3597
+ import * as React36 from "react";
3583
3598
  import { toBasicISOString as toBasicISOString3 } from "@douglasneuroinformatics/libjs";
3584
3599
  import {
3585
3600
  CartesianGrid,
@@ -3682,7 +3697,7 @@ function LineGraphComponent({
3682
3697
  /* @__PURE__ */ jsx139(Legend2, { wrapperStyle: { paddingLeft: 40, paddingTop: 10 } })
3683
3698
  ] }) });
3684
3699
  }
3685
- var LineGraph = React37.memo(LineGraphComponent);
3700
+ var LineGraph = React36.memo(LineGraphComponent);
3686
3701
 
3687
3702
  // src/components/ListboxDropdown/ListboxDropdown.tsx
3688
3703
  import "react";
@@ -4292,7 +4307,7 @@ var SheetBody = ({
4292
4307
  };
4293
4308
 
4294
4309
  // src/components/Sheet/SheetContent.tsx
4295
- import * as React50 from "react";
4310
+ import * as React49 from "react";
4296
4311
  import { Close as Close2, Content as Content11, Portal as Portal11 } from "@radix-ui/react-dialog";
4297
4312
  import { cva as cva5 } from "class-variance-authority";
4298
4313
  import { XIcon as XIcon3 } from "lucide-react";
@@ -4333,7 +4348,7 @@ var sheetVariants = cva5(
4333
4348
  }
4334
4349
  }
4335
4350
  );
4336
- var SheetContent = React50.forwardRef(function SheetContent2({ children, className, side = "right", ...props }, ref) {
4351
+ var SheetContent = React49.forwardRef(function SheetContent2({ children, className, side = "right", ...props }, ref) {
4337
4352
  return /* @__PURE__ */ jsxs59(Portal11, { children: [
4338
4353
  /* @__PURE__ */ jsx169(SheetOverlay, {}),
4339
4354
  /* @__PURE__ */ jsxs59(Content11, { className: cn(sheetVariants({ side }), className), ref, ...props, children: [
@@ -4570,10 +4585,10 @@ var ThemeToggle = ({ onClick, variant = "outline", ...props }) => {
4570
4585
  };
4571
4586
 
4572
4587
  // src/components/Tooltip/TooltipContent.tsx
4573
- import * as React54 from "react";
4588
+ import * as React53 from "react";
4574
4589
  import { Content as Content13 } from "@radix-ui/react-tooltip";
4575
4590
  import { jsx as jsx183 } from "react/jsx-runtime";
4576
- var TooltipContent = React54.forwardRef(
4591
+ var TooltipContent = React53.forwardRef(
4577
4592
  function TooltipContent2({ className, collisionPadding = 0, sideOffset = 4, ...props }, ref) {
4578
4593
  return /* @__PURE__ */ jsx183(
4579
4594
  Content13,