zuii 1.4.18 → 1.4.19

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.
Files changed (32) hide show
  1. package/dist/components/Dashboard/style/index.css +1 -1
  2. package/dist/components/Form/js/tel-input.d.ts +20 -0
  3. package/dist/components/Form/js/tel-input.js +15 -4
  4. package/dist/components/Form/react/FormDate.js +44 -42
  5. package/dist/components/Form/react/TelInput.d.ts +9 -1
  6. package/dist/components/Form/react/TelInput.js +62 -37
  7. package/dist/components/Form/react/index.d.ts +1 -1
  8. package/dist/components/Form/style/index.css +1 -1
  9. package/dist/components/Group/react/index.d.ts +6 -2
  10. package/dist/components/Group/react/index.js +9 -7
  11. package/dist/components/Group/style/index.css +1 -1
  12. package/dist/components/Lang-selector/js/language-selector.d.ts +2 -1
  13. package/dist/components/Lang-selector/js/language-selector.js +5 -5
  14. package/dist/components/Lang-selector/react/index.d.ts +6 -1
  15. package/dist/components/Lang-selector/react/index.js +13 -11
  16. package/dist/components/Loader/react/index.d.ts +1 -1
  17. package/dist/components/Loader/react/index.js +8 -9
  18. package/dist/components/Nav/style/index.css +1 -1
  19. package/dist/components/Placeholder/style/index.css +1 -1
  20. package/dist/components/Tab/react/index.js +27 -28
  21. package/dist/components/Table/js/table.d.ts +4 -0
  22. package/dist/components/Table/react/index.d.ts +1 -1
  23. package/dist/components/Table/react/index.js +29 -27
  24. package/dist/templates/Forms/Forms-elements.tsx +5 -1
  25. package/dist/templates/Forms/Forms.tsx +2 -2
  26. package/dist/templates/Groups/Groups.d.ts +5 -0
  27. package/dist/templates/Groups/Groups.tsx +85 -0
  28. package/dist/templates/Sliders/Sliders.tsx +0 -1
  29. package/dist/templates/Tables/Tables.tsx +9 -0
  30. package/dist/templates/index.d.ts +1 -0
  31. package/dist/templates/index.ts +1 -0
  32. package/package.json +1 -1
@@ -1 +1 @@
1
- @layer layout{.dashboard{--dashboard-nav-width: 90px;--dashboard-padding: var(--spacing-md);display:flex;height:100vh;overflow:hidden}.dashboard__navigation{display:flex;flex-direction:column;background:var(--primary);color:var(--white);padding:var(--dashboard-padding) 0;width:var(--dashboard-nav-width);gap:var(--spacing-lg)}.dashboard__navigation>:first-child{flex:1;overflow-y:auto}.dashboard__content{display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;width:100%}.dashboard__header{grid-column:span 2;background:var(--accent)}.dashboard__sub-navigation{grid-row:2;background:var(--light);width:0px;background:var(--primary-dark);color:var(--white);transition:all .3s ease-in-out}.dashboard__sub-navigation.open{width:160px}.dashboard__wrapper{padding:var(--dashboard-padding);display:flex;flex-direction:column;gap:var(--spacing-md);overflow:auto}.dashboard__card{background:var(--white);border-radius:var(--radius-base);box-shadow:var(--box-shadow-md);height:fit-content}.dashboard__card-header{background:var(--gray-200);padding:0 var(--spacing-md);border-radius:var(--radius-base) var(--radius-base) 0 0}.dashboard__card-content{padding:var(--spacing-md)}.dashboard__card-title{font-size:1.25rem;margin:0}}@layer components{.dashboard__card-header .btn{--btn-font-size: .8rem;padding:var(--spacing-xs)}.dashboard__card-header .btn .icon{font-size:.8rem}}
1
+ @layer layout{.dashboard{--dashboard-nav-width: 90px;--dashboard-padding: .8rem;display:flex;height:100vh;overflow:hidden}.dashboard__navigation{display:flex;flex-direction:column;background:var(--primary);color:var(--white);padding:1rem 0;width:var(--dashboard-nav-width);gap:var(--spacing-lg)}.dashboard__navigation>:first-child{flex:1;overflow-y:auto}.dashboard__navigation .nav{--font-size: .7rem}.dashboard__content{display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto 1fr;width:100%}.dashboard__header{grid-column:span 2;background:var(--accent)}.dashboard__sub-navigation{grid-row:2;background:var(--light);width:0px;background:var(--primary-dark);color:var(--white);transition:all .3s ease-in-out}.dashboard__sub-navigation.open{width:160px}.dashboard__wrapper{padding:var(--dashboard-padding);display:flex;flex-direction:column;gap:var(--spacing-md);overflow:auto}.dashboard__card{background:var(--white);border-radius:var(--radius-base);box-shadow:var(--box-shadow-md);height:fit-content}.dashboard__card-header{background:var(--gray-200);padding:0 var(--spacing-md);border-radius:var(--radius-base) var(--radius-base) 0 0}.dashboard__card-content{padding:var(--spacing-md)}.dashboard__card-title{font-size:1.25rem;margin:0}}@layer components{.dashboard__card-header .btn{--btn-font-size: .8rem;padding:var(--spacing-xs)}.dashboard__card-header .btn .icon{font-size:.8rem}}
@@ -10,3 +10,23 @@ export declare const getDefaultCountry: () => string;
10
10
  * @returns {MutationObserver | null} L'instance de l'observateur ou null.
11
11
  */
12
12
  export declare const watchLanguageChange: (initialCountry: any, callback: (country: string) => void) => MutationObserver | null;
13
+ /**
14
+ * Supprime visuellement les zéros initiaux du champ input visible, si applicable (ex: "fr").
15
+ * @param {HTMLInputElement} inputElement - L'élément input visible.
16
+ * @param {string} country - Le code du pays sélectionné.
17
+ */
18
+ export declare const removeLeadingZeros: (inputElement: HTMLInputElement, country: string) => void;
19
+ /**
20
+ * Met à jour la valeur de l'input caché en ajoutant un "0" initial si nécessaire pour le pays (ex: "fr").
21
+ * @param {HTMLInputElement} visibleInput - L'élément input visible.
22
+ * @param {HTMLInputElement} hiddenInput - L'élément input caché qui sera soumis.
23
+ * @param {string} country - Le code du pays sélectionné.
24
+ */
25
+ export declare const updateHiddenInputValue: (visibleInput: HTMLInputElement, hiddenInput: HTMLInputElement, country: string) => void;
26
+ /**
27
+ * Formate le numéro en s'assurant qu'il commence par un "0" si le pays le requiert (ex: "fr").
28
+ * @param {string} internationalNumber - Le numéro fourni par intl-tel-input.
29
+ * @param {string} country - Le code du pays sélectionné.
30
+ * @returns {string} Le numéro formaté.
31
+ */
32
+ export declare const formatInternationalNumber: (internationalNumber: string, country: string) => string;
@@ -1,18 +1,29 @@
1
- const r = () => {
1
+ const a = () => {
2
2
  if (typeof document > "u") return "fr";
3
3
  const t = document.documentElement.lang.toLowerCase();
4
4
  return t.startsWith("fr") ? "fr" : t.startsWith("en") ? "gb" : "fr";
5
- }, u = (t, n) => {
5
+ }, u = (t, r) => {
6
6
  if (t || typeof document > "u") return null;
7
7
  const e = new MutationObserver(() => {
8
- n(r());
8
+ r(a());
9
9
  });
10
10
  return e.observe(document.documentElement, {
11
11
  attributes: !0,
12
12
  attributeFilter: ["lang"]
13
13
  }), e;
14
+ }, s = (t, r) => {
15
+ r === "fr" && t.value.startsWith("0") && (t.value = t.value.replace(/^0+/, ""));
16
+ }, o = (t, r, e) => {
17
+ let n = t.value;
18
+ e === "fr" && n && !n.startsWith("0") && !n.startsWith("+") && (n = "0" + n), r.value = n;
19
+ }, i = (t, r) => {
20
+ let e = t;
21
+ return r === "fr" && e && !e.startsWith("+") && !e.startsWith("0") && (e = "0" + e), e;
14
22
  };
15
23
  export {
16
- r as getDefaultCountry,
24
+ i as formatInternationalNumber,
25
+ a as getDefaultCountry,
26
+ s as removeLeadingZeros,
27
+ o as updateHiddenInputValue,
17
28
  u as watchLanguageChange
18
29
  };
@@ -1,55 +1,57 @@
1
- import { jsxs as V, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as j, useRef as a, useState as C, useMemo as F, useEffect as d } from "react";
1
+ import { jsxs as d, Fragment as F, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as N, useRef as i, useState as V, useMemo as j, useEffect as p } from "react";
3
3
  import { Form as P } from "react-bootstrap";
4
4
  import { Icon as _ } from "../../Icon/react/index.js";
5
- import { getRangeSeparator as b, initDatePicker as g, formatHiddenDateValue as k } from "../js/date.js";
6
- const S = j(({
5
+ import { getRangeSeparator as b, initDatePicker as k, formatHiddenDateValue as v } from "../js/date.js";
6
+ const S = N(({
7
7
  flatpickrOptions: n,
8
8
  value: e = "",
9
- onChange: c,
10
- placeholder: p,
9
+ onChange: u,
10
+ placeholder: h,
11
11
  name: R,
12
- className: h = "",
13
- icon: u,
14
- disabled: f = !1,
15
- ...y
16
- }, I) => {
17
- const x = I, o = a(null), i = a(null), r = a(null), [s, m] = C(e || ""), D = F(() => b(n?.locale), [n?.locale]);
18
- d(() => {
19
- if (o.current)
20
- return r.current = g(
21
- o.current,
12
+ className: I = "",
13
+ icon: f,
14
+ disabled: m = !1,
15
+ ...g
16
+ }, x) => {
17
+ const y = x, a = i(null), l = i(null), r = i(null), [s, c] = V(e || ""), D = j(() => b(n?.locale), [n?.locale]);
18
+ p(() => {
19
+ if (a.current)
20
+ return r.current = k(
21
+ a.current,
22
22
  n,
23
- i.current,
24
- (l) => {
25
- m(l), c?.(l);
23
+ l.current,
24
+ (o) => {
25
+ c(o), u?.(o);
26
26
  }
27
27
  ), () => r.current?.destroy();
28
- }, [n, c]), d(() => {
29
- e !== void 0 && e !== s && (m(e || ""), r.current?.setDate(e || "", !1));
28
+ }, [n, u]), p(() => {
29
+ e !== void 0 && e !== s && (c(e || ""), r.current?.setDate(e || "", !1));
30
30
  }, [e]);
31
- const N = () => {
32
- f || r.current?.open();
31
+ const C = () => {
32
+ m || r.current?.open();
33
33
  };
34
- return /* @__PURE__ */ V("div", { className: `form__input ${h}`.trim(), children: [
35
- u && /* @__PURE__ */ t(_, { name: u, size: "sm" }),
36
- /* @__PURE__ */ t(
37
- P.Control,
38
- {
39
- ...y,
40
- ref: x,
41
- autoComplete: "off",
42
- value: s,
43
- onClick: N,
44
- readOnly: !0,
45
- disabled: f,
46
- placeholder: p,
47
- className: "form-date-control"
48
- }
49
- ),
50
- /* @__PURE__ */ t("span", { ref: i, className: "form-date-anchor" }),
51
- /* @__PURE__ */ t("input", { ref: o, style: { display: "none" }, tabIndex: -1, "aria-hidden": "true" }),
52
- /* @__PURE__ */ t("input", { type: "hidden", name: R, value: k(s, D, r.current) })
34
+ return /* @__PURE__ */ d(F, { children: [
35
+ /* @__PURE__ */ d("div", { className: `form__input ${I}`.trim(), children: [
36
+ f && /* @__PURE__ */ t(_, { name: f, size: "sm" }),
37
+ /* @__PURE__ */ t(
38
+ P.Control,
39
+ {
40
+ ...g,
41
+ ref: y,
42
+ autoComplete: "off",
43
+ value: s,
44
+ onChange: (o) => c(o.target.value),
45
+ onClick: C,
46
+ disabled: m,
47
+ placeholder: h,
48
+ className: "form-date-control"
49
+ }
50
+ ),
51
+ /* @__PURE__ */ t("span", { ref: l, className: "form-date-anchor" })
52
+ ] }),
53
+ /* @__PURE__ */ t("input", { ref: a, style: { display: "none" }, tabIndex: -1, "aria-hidden": "true" }),
54
+ /* @__PURE__ */ t("input", { type: "hidden", name: R, value: v(s, D, r.current) })
53
55
  ] });
54
56
  });
55
57
  export {
@@ -27,6 +27,14 @@ export interface TelInputProps {
27
27
  * Si l'input est désactivé.
28
28
  */
29
29
  disabled?: boolean;
30
+ /**
31
+ * Nom du champ pour le formulaire.
32
+ */
33
+ name?: string;
34
+ /**
35
+ * Nom du champ pour le formulaire.
36
+ */
37
+ nameFormat?: string;
30
38
  }
31
39
  /**
32
40
  * Composant TelInput utilisant intl-tel-input.
@@ -34,4 +42,4 @@ export interface TelInputProps {
34
42
  * @param {TelInputProps} props - Les propriétés du composant.
35
43
  * @returns {JSX.Element} Le composant TelInput rendu.
36
44
  */
37
- export declare const TelInput: ({ value, onChange, initialCountry, className, placeholder, disabled, }: TelInputProps) => import("react/jsx-runtime").JSX.Element;
45
+ export declare const TelInput: ({ value, onChange, initialCountry, className, placeholder, name, nameFormat, disabled, }: TelInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,52 +1,77 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { useRef as f, useState as g, useEffect as u } from "react";
3
- import { Form as b } from "react-bootstrap";
4
- import h from "intl-tel-input";
5
- import { getDefaultCountry as N, watchLanguageChange as y } from "../js/tel-input.js";
6
- const w = ({
7
- value: n,
8
- onChange: c,
9
- initialCountry: o,
10
- className: m = "",
11
- placeholder: l,
12
- disabled: p = !1
1
+ import { jsxs as E, Fragment as N, jsx as i } from "react/jsx-runtime";
2
+ import { useRef as s, useState as I, useEffect as f } from "react";
3
+ import { Form as D } from "react-bootstrap";
4
+ import R from "intl-tel-input";
5
+ import { getDefaultCountry as S, watchLanguageChange as x, removeLeadingZeros as j, formatInternationalNumber as w, updateHiddenInputValue as F } from "../js/tel-input.js";
6
+ const U = ({
7
+ value: u,
8
+ onChange: p,
9
+ initialCountry: d,
10
+ className: y = "",
11
+ placeholder: v,
12
+ name: m,
13
+ nameFormat: g,
14
+ disabled: C = !1
13
15
  }) => {
14
- const r = f(null), t = f(null), [i, a] = g(o || N());
15
- return u(() => {
16
- const e = y(o, (d) => {
17
- a(d);
16
+ const r = s(null), e = s(null), a = s(null), l = s(null), [c, b] = I(d || S());
17
+ return f(() => {
18
+ const t = x(d, (n) => {
19
+ b(n);
18
20
  });
19
21
  return () => {
20
- e && e.disconnect();
22
+ t && t.disconnect();
21
23
  };
22
- }, [o]), u(() => {
24
+ }, [d]), f(() => {
23
25
  if (r.current) {
24
- t.current = h(r.current, {
25
- initialCountry: i,
26
+ e.current = R(r.current, {
27
+ initialCountry: c,
26
28
  loadUtils: () => import("../../../node_modules/.pnpm/intl-tel-input@26.1.1/node_modules/intl-tel-input/build/js/utils.js"),
27
29
  separateDialCode: !0,
28
30
  strictMode: !0
29
31
  });
30
- const e = () => {
31
- c && c(t.current.getNumber());
32
+ const t = () => {
33
+ const o = e.current ? e.current.getSelectedCountryData().iso2 : c;
34
+ a.current && r.current && F(r.current, a.current, o), l.current && e.current && (l.current.value = e.current.getNumber() || "");
35
+ }, n = () => {
36
+ t();
37
+ const o = e.current ? e.current.getSelectedCountryData().iso2 : c;
38
+ if (p && e.current) {
39
+ const L = w(e.current.getNumber() || "", o);
40
+ p(L);
41
+ }
42
+ }, h = () => {
43
+ const o = e.current ? e.current.getSelectedCountryData().iso2 : c;
44
+ r.current && j(r.current, o), t();
32
45
  };
33
- return r.current.addEventListener("change", e), r.current.addEventListener("blur", e), () => {
34
- t.current && t.current.destroy();
46
+ return r.current.addEventListener("input", h), r.current.addEventListener("change", n), r.current.addEventListener("blur", n), t(), () => {
47
+ e.current && e.current.destroy(), r.current && (r.current.removeEventListener("input", h), r.current.removeEventListener("change", n), r.current.removeEventListener("blur", n));
35
48
  };
36
49
  }
37
- }, [i]), u(() => {
38
- t.current && n !== void 0 && n !== t.current.getNumber() && t.current.setNumber(n);
39
- }, [n]), /* @__PURE__ */ s("div", { className: `tel-input-wrapper form__input ${m}`.trim(), children: /* @__PURE__ */ s(
40
- b.Control,
41
- {
42
- ref: r,
43
- type: "tel",
44
- placeholder: l,
45
- disabled: p,
46
- className: "tel-input-control "
47
- }
48
- ) });
50
+ }, [c]), f(() => {
51
+ e.current && u !== void 0 && u !== e.current.getNumber() && e.current.setNumber(u);
52
+ }, [u]), /* @__PURE__ */ E(N, { children: [
53
+ /* @__PURE__ */ i("div", { className: `tel-input-wrapper form__input ${y}`.trim(), children: /* @__PURE__ */ i(
54
+ D.Control,
55
+ {
56
+ ref: r,
57
+ type: "tel",
58
+ placeholder: v,
59
+ disabled: C,
60
+ className: "tel-input-control "
61
+ }
62
+ ) }),
63
+ m && /* @__PURE__ */ i("input", { type: "hidden", name: m, ref: a }),
64
+ g && /* @__PURE__ */ i(
65
+ "input",
66
+ {
67
+ type: "hidden",
68
+ name: g,
69
+ ref: l,
70
+ defaultValue: u
71
+ }
72
+ )
73
+ ] });
49
74
  };
50
75
  export {
51
- w as TelInput
76
+ U as TelInput
52
77
  };
@@ -63,7 +63,7 @@ export declare const Form: {
63
63
  Checkbox: (props: FormCheckInputProps) => import("react/jsx-runtime").JSX.Element;
64
64
  };
65
65
  Number: ({ value, onChange, min, max, step, className, placeholder, }: NumberInputProps) => import("react/jsx-runtime").JSX.Element;
66
- Tel: ({ value, onChange, initialCountry, className, placeholder, disabled, }: TelInputProps) => import("react/jsx-runtime").JSX.Element;
66
+ Tel: ({ value, onChange, initialCountry, className, placeholder, name, nameFormat, disabled, }: TelInputProps) => import("react/jsx-runtime").JSX.Element;
67
67
  Password: ({ value, onChange, className, placeholder, disabled, }: PasswordInputProps) => import("react/jsx-runtime").JSX.Element;
68
68
  PasswordConfirm: ({ passwordToMatch, value, onChange, className, placeholder, disabled, errorMessage, }: PasswordConfirmProps) => import("react/jsx-runtime").JSX.Element;
69
69
  Range: ({ value, onChange, min, max, step, className, }: RangeInputProps) => import("react/jsx-runtime").JSX.Element;