@hortiview/shared-components 0.0.4804 → 0.0.4806

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.
@@ -1,20 +1,20 @@
1
1
  import "../../../assets/FormDatePicker.css";
2
- import { jsx as l } from "react/jsx-runtime";
3
- import { Datepicker as F } from "@element/react-components";
4
- import { useState as T, useEffect as k, useMemo as c } from "react";
5
- import { useFormContext as z, Controller as I } from "react-hook-form";
6
- const O = "_datePickerContainer_zxe48_1", Q = "_invalid_zxe48_5", Y = "_fromPickerText_zxe48_9", d = {
7
- datePickerContainer: O,
8
- invalid: Q,
9
- fromPickerText: Y
10
- }, H = ({
2
+ import { jsx as s } from "react/jsx-runtime";
3
+ import { Datepicker as T } from "@element/react-components";
4
+ import { useState as z, useEffect as k, useMemo as l } from "react";
5
+ import { useFormContext as I, Controller as O } from "react-hook-form";
6
+ const Q = "_datePickerContainer_zxe48_1", Y = "_invalid_zxe48_5", $ = "_fromPickerText_zxe48_9", c = {
7
+ datePickerContainer: Q,
8
+ invalid: Y,
9
+ fromPickerText: $
10
+ }, L = ({
11
11
  propertyName: e,
12
12
  label: x,
13
13
  required: n = !1,
14
14
  requiredText: o,
15
15
  className: P,
16
- minRangeYear: f,
17
- maxRangeYear: m,
16
+ minRangeYear: d,
17
+ maxRangeYear: f,
18
18
  locale: D
19
19
  }) => {
20
20
  const {
@@ -22,20 +22,20 @@ const O = "_datePickerContainer_zxe48_1", Q = "_invalid_zxe48_5", Y = "_fromPick
22
22
  formState: { errors: t },
23
23
  watch: S,
24
24
  getFieldState: a
25
- } = z(), [_, u] = T(), v = S(e);
25
+ } = I(), [_, m] = z(), u = S(e);
26
26
  k(() => {
27
- u(/* @__PURE__ */ new Date());
27
+ m(/* @__PURE__ */ new Date());
28
28
  }, []), k(() => {
29
- u(new Date(v));
30
- }, [v]);
31
- const C = c(
32
- () => (/* @__PURE__ */ new Date()).getFullYear() - (f ?? 95),
29
+ m(new Date(u));
30
+ }, [u]);
31
+ const C = l(
32
+ () => (/* @__PURE__ */ new Date()).getFullYear() - (d ?? 95),
33
+ [d]
34
+ ), h = l(
35
+ () => (/* @__PURE__ */ new Date()).getFullYear() + (f ?? 15),
33
36
  [f]
34
- ), h = c(
35
- () => (/* @__PURE__ */ new Date()).getFullYear() + (m ?? 15),
36
- [m]
37
- ), w = c(() => {
38
- const s = () => {
37
+ ), w = l(() => {
38
+ const v = () => {
39
39
  if (t && t[e]) {
40
40
  const r = t[e]?.message;
41
41
  return r || "Invalid input";
@@ -45,12 +45,12 @@ const O = "_datePickerContainer_zxe48_1", Q = "_invalid_zxe48_5", Y = "_fromPick
45
45
  return {
46
46
  valid: !a(e).invalid,
47
47
  helperTextPersistent: t !== void 0 || n,
48
- helperText: s(),
49
- className: `${d.fromPickerText} ${a(e).invalid ? d.invalid : ""}`
48
+ helperText: v(),
49
+ className: `${c.fromPickerText} ${a(e).invalid ? c.invalid : ""}`
50
50
  };
51
51
  }, [t, o, e, n, a]);
52
- return /* @__PURE__ */ l(
53
- I,
52
+ return /* @__PURE__ */ s(
53
+ O,
54
54
  {
55
55
  name: e,
56
56
  rules: {
@@ -60,10 +60,10 @@ const O = "_datePickerContainer_zxe48_1", Q = "_invalid_zxe48_5", Y = "_fromPick
60
60
  } : void 0
61
61
  },
62
62
  control: g,
63
- render: ({ field: { onChange: s, ...r } }) => /* @__PURE__ */ l("div", { className: d.datePickerContainer, children: /* @__PURE__ */ l(
64
- F,
63
+ render: ({ field: { ref: v, onChange: r, ...F } }) => /* @__PURE__ */ s("div", { className: c.datePickerContainer, children: /* @__PURE__ */ s(
64
+ T,
65
65
  {
66
- ...r,
66
+ ...F,
67
67
  className: P ?? "",
68
68
  value: _,
69
69
  variant: "outlined",
@@ -71,7 +71,7 @@ const O = "_datePickerContainer_zxe48_1", Q = "_invalid_zxe48_5", Y = "_fromPick
71
71
  format: (i) => i ? i.toLocaleDateString(D ?? "en") : "",
72
72
  disableClearing: !0,
73
73
  onChange: (i) => {
74
- s(i?.toISOString());
74
+ r(i?.toISOString());
75
75
  },
76
76
  minQuickSelectYear: C,
77
77
  maxQuickSelectYear: h,
@@ -83,5 +83,5 @@ const O = "_datePickerContainer_zxe48_1", Q = "_invalid_zxe48_5", Y = "_fromPick
83
83
  );
84
84
  };
85
85
  export {
86
- H as FormDatePicker
86
+ L as FormDatePicker
87
87
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hortiview/shared-components",
3
3
  "description": "This is a shared component library. It should used in the HortiView platform and its modules.",
4
- "version": "0.0.4804",
4
+ "version": "0.0.4806",
5
5
  "type": "module",
6
6
  "repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
7
7
  "author": "Falk Menge <falk.menge.ext@bayer.com>",