zuii 1.7.4 → 1.7.6

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.
@@ -36,6 +36,7 @@ export interface FormDateProps {
36
36
  * Désactiver le champ.
37
37
  */
38
38
  disabled?: boolean;
39
+ onReady?: (flatpickerInstance: any) => void;
39
40
  }
40
41
  /**
41
42
  * Composant de sélection de date premium basé sur Flatpickr.
@@ -1,61 +1,64 @@
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";
1
+ import { jsxs as R, Fragment as V, jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as j, useRef as i, useState as v, useMemo as C, useEffect as h } 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 k, formatHiddenDateValue as v } from "../js/date.js";
6
- const S = N(({
5
+ import { getRangeSeparator as b, initDatePicker as k, formatHiddenDateValue as w } from "../js/date.js";
6
+ const $ = j(({
7
7
  flatpickrOptions: n,
8
- value: e = "",
9
- onChange: u,
10
- placeholder: h,
11
- name: R,
12
- className: I = "",
8
+ value: r = "",
9
+ onChange: a,
10
+ placeholder: y,
11
+ name: I,
12
+ className: x = "",
13
13
  icon: f,
14
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,
15
+ ...l
16
+ }, D) => {
17
+ const g = D, c = i(null), d = i(null), e = i(null), [s, u] = v(r || ""), F = C(() => b(n?.locale), [n?.locale]);
18
+ h(() => {
19
+ if (c.current)
20
+ return e.current = k(
21
+ c.current,
22
22
  n,
23
- l.current,
23
+ d.current,
24
24
  (o) => {
25
- c(o), u?.(o);
25
+ u(o), a?.(o);
26
26
  }
27
- ), () => {
28
- r.current && r.current?.destroy();
27
+ ), l.onReady?.(e.current), () => {
28
+ e.current && e.current?.destroy();
29
29
  };
30
- }, [n, u]), p(() => {
31
- e !== void 0 && e !== s && (c(e || ""), r.current?.setDate(e || "", !1));
32
- }, [e]);
33
- const C = () => {
34
- m || r.current?.open();
30
+ }, [n, a]), h(() => {
31
+ r !== void 0 && r !== s && (u(r || ""), e.current?.setDate(r || "", !1));
32
+ }, [r]);
33
+ const N = () => {
34
+ m || e.current?.open();
35
35
  };
36
- return /* @__PURE__ */ d(F, { children: [
37
- /* @__PURE__ */ d("div", { className: `form__input ${I}`.trim(), children: [
36
+ return /* @__PURE__ */ R(V, { children: [
37
+ /* @__PURE__ */ R("div", { className: `form__input ${x}`.trim(), children: [
38
38
  f && /* @__PURE__ */ t(_, { name: f, size: "sm" }),
39
39
  /* @__PURE__ */ t(
40
40
  P.Control,
41
41
  {
42
- ...g,
43
- ref: y,
42
+ ...l,
43
+ ref: g,
44
44
  autoComplete: "off",
45
45
  value: s,
46
- onChange: (o) => c(o.target.value),
47
- onClick: C,
46
+ onChange: (o) => {
47
+ const p = o.target.value;
48
+ u(p), a?.(p);
49
+ },
50
+ onClick: N,
48
51
  disabled: m,
49
- placeholder: h,
52
+ placeholder: y,
50
53
  className: "form-date-control"
51
54
  }
52
55
  ),
53
- /* @__PURE__ */ t("span", { ref: l, className: "form-date-anchor" })
56
+ /* @__PURE__ */ t("span", { ref: d, className: "form-date-anchor" })
54
57
  ] }),
55
- /* @__PURE__ */ t("input", { ref: a, style: { display: "none" }, tabIndex: -1, "aria-hidden": "true" }),
56
- /* @__PURE__ */ t("input", { type: "hidden", name: R, value: v(s, D, r.current) })
58
+ /* @__PURE__ */ t("input", { ref: c, style: { display: "none" }, tabIndex: -1, "aria-hidden": "true" }),
59
+ /* @__PURE__ */ t("input", { type: "hidden", name: I, value: w(s, F, e.current) })
57
60
  ] });
58
61
  });
59
62
  export {
60
- S as FormDate
63
+ $ as FormDate
61
64
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zuii",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
4
4
  "packageManager": "pnpm@9.9.0",
5
5
  "description": "Bibliothèque de composants UI légère, intuitive et modulaire pour les interfaces web modernes.",
6
6
  "type": "module",