zuii 1.5.10 → 1.5.11

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.
@@ -27,6 +27,8 @@ interface FileInputProps {
27
27
  /** Si l'enregistrement vidéo est autorisé (défaut: true). */
28
28
  allowVideo?: boolean;
29
29
  };
30
+ /** Le champ est requis. */
31
+ required?: boolean;
30
32
  }
31
33
  /**
32
34
  * Composant FileInput utilisant Uppy.js pour le téléchargement de fichiers.
@@ -35,5 +37,5 @@ interface FileInputProps {
35
37
  * @param {FileInputProps} props - Les propriétés du composant.
36
38
  * @returns {JSX.Element} Le composant FileInput rendu.
37
39
  */
38
- export declare const FileInput: ({ name, lang, restrictions, onComplete, onError, files, webcam }: FileInputProps) => import("react/jsx-runtime").JSX.Element;
40
+ export declare const FileInput: ({ name, lang, restrictions, onComplete, onError, files, webcam, required }: FileInputProps) => import("react/jsx-runtime").JSX.Element;
39
41
  export {};
@@ -1,23 +1,24 @@
1
- import { jsx as p, jsxs as x } from "react/jsx-runtime";
2
- import { useRef as o, useState as b, useEffect as u } from "react";
3
- import { UppyContextProvider as v } from "@uppy/react";
1
+ import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
+ import { useRef as f, useState as v, useEffect as u } from "react";
3
+ import { UppyContextProvider as w } from "@uppy/react";
4
4
  import F from "../../../node_modules/.pnpm/@uppy_react@5.2.0_@uppy_core@5.2.0_@uppy_dashboard@5.1.1_@uppy_core@5.2.0__@uppy_image-editor_4567vrulez5sapld32rywmrijm/node_modules/@uppy/react/lib/Dashboard.js";
5
- import { getUppyLocale as w, createUppyInstance as N, fetchRemoteFiles as R, setupFileOpenButtons as _, syncUppyToInput as B } from "../js/uppy.js";
6
- const j = ({
7
- name: i,
5
+ import { getUppyLocale as N, createUppyInstance as R, fetchRemoteFiles as _, setupFileOpenButtons as B, syncUppyToInput as D } from "../js/uppy.js";
6
+ const L = ({
7
+ name: p,
8
8
  lang: y,
9
9
  restrictions: l,
10
- onComplete: s,
10
+ onComplete: i,
11
11
  onError: t,
12
- files: r,
13
- webcam: g
12
+ files: s,
13
+ webcam: g,
14
+ required: x
14
15
  }) => {
15
- const c = o(null), f = o(null), U = o(/* @__PURE__ */ new Set()), a = w(y), [e] = b(() => N(l || {}, a, g));
16
+ const n = f(null), o = f(null), U = f(/* @__PURE__ */ new Set()), a = N(y), [e] = v(() => R(l || {}, a, g));
16
17
  u(() => {
17
- s && e.on("complete", s), t && e.on("error", t);
18
- const m = () => {
19
- c.current && B(e, c.current);
20
- }, h = [
18
+ i && e.on("complete", i), t && e.on("error", t);
19
+ const h = () => {
20
+ n.current && D(e, n.current);
21
+ }, m = [
21
22
  "file-added",
22
23
  "file-removed",
23
24
  "files-added",
@@ -25,18 +26,18 @@ const j = ({
25
26
  "preprocess-complete",
26
27
  "postprocess-complete"
27
28
  ];
28
- return h.forEach((n) => e.on(n, m)), () => {
29
- s && e.off("complete", s), t && e.off("error", t), h.forEach((n) => e.off(n, m));
29
+ return m.forEach((c) => e.on(c, h)), () => {
30
+ i && e.off("complete", i), t && e.off("error", t), m.forEach((c) => e.off(c, h));
30
31
  };
32
+ }, [e, i, t]), u(() => {
33
+ s && s.length > 0 && _(e, s, U.current, t);
31
34
  }, [e, s, t]), u(() => {
32
- r && r.length > 0 && R(e, r, U.current, t);
33
- }, [e, r, t]), u(() => {
34
- if (f.current)
35
- return _(f.current, e);
35
+ if (o.current)
36
+ return B(o.current, e);
36
37
  }, [e]);
37
38
  const d = !l?.maxNumberOfFiles || l.maxNumberOfFiles > 1;
38
- return /* @__PURE__ */ p(v, { uppy: e, children: /* @__PURE__ */ x("div", { className: "file-input__wrapper", id: i, children: [
39
- /* @__PURE__ */ p("div", { className: "file-input__content", ref: f, children: /* @__PURE__ */ p(
39
+ return /* @__PURE__ */ r(w, { uppy: e, children: /* @__PURE__ */ b("div", { className: "file-input__wrapper", id: p, children: [
40
+ /* @__PURE__ */ r("div", { className: "file-input__content", ref: o, children: /* @__PURE__ */ r(
40
41
  F,
41
42
  {
42
43
  uppy: e,
@@ -51,18 +52,25 @@ const j = ({
51
52
  }
52
53
  }
53
54
  ) }),
54
- i && /* @__PURE__ */ p(
55
+ p && /* @__PURE__ */ r(
55
56
  "input",
56
57
  {
57
- ref: c,
58
+ ref: n,
58
59
  type: "file",
59
- name: d ? `${i}[]` : i,
60
+ name: d ? `${p}[]` : p,
60
61
  multiple: d,
61
- style: { display: "none" }
62
+ style: {
63
+ position: "absolute",
64
+ opacity: "0",
65
+ width: "1px",
66
+ height: "1px",
67
+ pointerEvents: "none"
68
+ },
69
+ required: x
62
70
  }
63
71
  )
64
72
  ] }) });
65
73
  };
66
74
  export {
67
- j as FileInput
75
+ L as FileInput
68
76
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zuii",
3
- "version": "1.5.10",
3
+ "version": "1.5.11",
4
4
  "description": "Bibliothèque de composants UI légère, intuitive et modulaire pour les interfaces web modernes.",
5
5
  "type": "module",
6
6
  "repository": {