@hortiview/shared-components 0.0.8594 → 0.0.8622

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,90 +1,93 @@
1
- import { jsx as n, jsxs as Y } from "react/jsx-runtime";
2
- import { Datepicker as b, Divider as j, Padding as H, Button as M } from "@element/react-components";
3
- import { g as Q } from "../../../get-UxX31Aph.js";
4
- import { useMemo as s, useState as $ } from "react";
5
- import { useFormContext as w, Controller as B } from "react-hook-form";
1
+ import { jsx as o, jsxs as Y } from "react/jsx-runtime";
2
+ import { Datepicker as w, Divider as M, Padding as U, Button as b } from "@element/react-components";
3
+ import { g as j } from "../../../get-UxX31Aph.js";
4
+ import { useMemo as s, useState as H } from "react";
5
+ import { useFormContext as I, Controller as Q } from "react-hook-form";
6
6
  import { s as l } from "../../../formDatePicker.module-BV3ma_7y.js";
7
- const G = ({
7
+ const $ = (t) => {
8
+ const a = new Date(t), u = a.getUTCDate(), f = a.getUTCMonth(), d = a.getUTCFullYear();
9
+ return new Date(d, f, u);
10
+ }, G = ({
8
11
  propertyName: t,
9
- label: k,
10
- closeLabel: p,
11
- className: P,
12
- minRangeYear: m,
13
- maxRangeYear: f,
14
- locale: D,
15
- rules: o,
16
- ...S
12
+ label: a,
13
+ closeLabel: u,
14
+ className: f,
15
+ minRangeYear: d,
16
+ maxRangeYear: g,
17
+ locale: h,
18
+ rules: i,
19
+ ...k
17
20
  }) => {
18
21
  const {
19
- control: h,
20
- formState: { errors: r, isValidating: u }
21
- } = w(), g = s(
22
- () => o?.required?.value,
23
- [o]
24
- ), x = s(
25
- () => o?.required?.message,
26
- [o]
27
- ), C = s(
28
- () => (/* @__PURE__ */ new Date()).getFullYear() - (m ?? 95),
29
- [m]
30
- ), v = s(
31
- () => (/* @__PURE__ */ new Date()).getFullYear() + (f ?? 15),
32
- [f]
33
- ), c = s(
34
- () => !u && Q(r, t) !== void 0,
35
- [r, t, u]
36
- ), T = s(() => ({
37
- valid: !c,
38
- helperTextPersistent: c || g,
22
+ control: p,
23
+ formState: { errors: r, isValidating: x }
24
+ } = I(), C = s(
25
+ () => i?.required?.value,
26
+ [i]
27
+ ), S = s(
28
+ () => i?.required?.message,
29
+ [i]
30
+ ), P = s(
31
+ () => (/* @__PURE__ */ new Date()).getFullYear() - (d ?? 95),
32
+ [d]
33
+ ), T = s(
34
+ () => (/* @__PURE__ */ new Date()).getFullYear() + (g ?? 15),
35
+ [g]
36
+ ), m = s(
37
+ () => !x && j(r, t) !== void 0,
38
+ [r, t, x]
39
+ ), v = s(() => ({
40
+ valid: !m,
41
+ helperTextPersistent: m || C,
39
42
  helperText: (() => {
40
43
  if (r && r[t]) {
41
- const i = r[t]?.message;
42
- return i || "Invalid input";
44
+ const n = r[t]?.message;
45
+ return n || "Invalid input";
43
46
  }
44
- return x;
47
+ return S;
45
48
  })(),
46
- className: `${l.fromPickerText} ${c ? l.invalid : ""}`
47
- }), [r, x, t, g, c]), [q, d] = $(!1);
48
- return /* @__PURE__ */ n(
49
- B,
49
+ className: `${l.fromPickerText} ${m ? l.invalid : ""}`
50
+ }), [r, S, t, C, m]), [F, D] = H(!1);
51
+ return /* @__PURE__ */ o(
52
+ Q,
50
53
  {
51
54
  name: t,
52
- rules: o,
53
- control: h,
54
- render: ({ field: { ref: F, onChange: i, value: a, ...O } }) => /* @__PURE__ */ n("div", { className: l.datePickerContainer, children: /* @__PURE__ */ n(
55
- b,
55
+ rules: i,
56
+ control: p,
57
+ render: ({ field: { ref: q, onChange: n, value: c, ...O } }) => /* @__PURE__ */ o("div", { className: l.datePickerContainer, children: /* @__PURE__ */ o(
58
+ w,
56
59
  {
57
- ...S,
60
+ ...k,
58
61
  ...O,
59
- className: P ?? "",
60
- value: a,
62
+ className: f ?? "",
63
+ value: c,
61
64
  variant: "outlined",
62
- label: k,
63
- format: (e) => e ? e.toLocaleDateString(D ?? "en") : "",
65
+ label: a,
66
+ format: (e) => e ? $(e.toISOString()).toLocaleDateString(h ?? "en") : "",
64
67
  disableClearing: !0,
65
68
  trailingContent: /* @__PURE__ */ Y("div", { className: l.trailingContent, children: [
66
- /* @__PURE__ */ n(j, {}),
67
- /* @__PURE__ */ n(H, { variant: "dense", children: /* @__PURE__ */ n(M, { label: p, variant: "text", onClick: () => d(!1) }) })
69
+ /* @__PURE__ */ o(M, {}),
70
+ /* @__PURE__ */ o(U, { variant: "dense", children: /* @__PURE__ */ o(b, { label: u, variant: "text", onClick: () => D(!1) }) })
68
71
  ] }),
69
72
  onClick: () => {
70
- d(!0);
73
+ D(!0);
71
74
  },
72
75
  onSelect: (e) => {
73
- i(e), d(!1);
76
+ n(e), D(!1);
74
77
  },
75
78
  onSelectMonth: (e) => {
76
- a && (e.setDate(a.getDate()), i(e));
79
+ c && (e.setDate(c.getDate()), n(e));
77
80
  },
78
81
  onSelectYear: (e) => {
79
- a && (e.setDate(a.getDate()), i(e));
82
+ c && (e.setDate(c.getDate()), n(e));
80
83
  },
81
84
  hoisted: !0,
82
85
  calendarProps: { hoisted: !0, className: l.datePickerCalendar },
83
- minQuickSelectYear: C,
84
- maxQuickSelectYear: v,
86
+ minQuickSelectYear: P,
87
+ maxQuickSelectYear: T,
85
88
  readOnly: !0,
86
- textfieldProps: T,
87
- alwaysOpen: q
89
+ textfieldProps: v,
90
+ alwaysOpen: F
88
91
  }
89
92
  ) })
90
93
  }
@@ -1,13 +1,13 @@
1
- import { jsx as r, jsxs as d, Fragment as I } from "react/jsx-runtime";
2
- import { Elevation as N, Group as c, TabBar as b, Tab as k, Padding as x } from "@element/react-components";
3
- import { useState as y, useEffect as $ } from "react";
1
+ import { jsx as t, jsxs as d, Fragment as y } from "react/jsx-runtime";
2
+ import { Elevation as I, Group as c, TabBar as N, Tab as $, Padding as b } from "@element/react-components";
3
+ import { useState as k, useEffect as x } from "react";
4
4
  import { u as w } from "../../useBreakpoints-MzTZ0tCT.js";
5
- import { s as a } from "../../HashTabView.module-DUekkiTC.js";
6
- const h = (n, t) => !t || !n ? 0 : n.findIndex((i) => i.hash === t.replace("#", "")) ?? 0, D = ({
5
+ import { s as r } from "../../HashTabView.module-DUekkiTC.js";
6
+ const u = (n, a) => !a || !n ? 0 : n.findIndex((i) => i.hash === a.replace("#", "")) ?? 0, z = ({
7
7
  tabs: n,
8
- hasHash: t = !0,
8
+ hasHash: a = !0,
9
9
  hash: i = "",
10
- clusterAlign: u = "start",
10
+ clusterAlign: h = "start",
11
11
  hasClusteredTabs: f,
12
12
  children: s,
13
13
  verticalGap: g = "none",
@@ -15,36 +15,36 @@ const h = (n, t) => !t || !n ? 0 : n.findIndex((i) => i.hash === t.replace("#",
15
15
  backgroundColor: T = "themeBackground",
16
16
  onChange: A
17
17
  }) => {
18
- const [m, p] = y(h(n, i)), { isDesktop: l } = w();
19
- $(() => {
20
- const e = h(n, i);
18
+ const [m, p] = k(u(n, i)), { isDesktop: l } = w();
19
+ x(() => {
20
+ const e = u(n, i);
21
21
  p(e);
22
- }, [i, n, t]);
22
+ }, [i, n, a]);
23
23
  const B = (e) => {
24
24
  const o = n[e].hash;
25
- o != null && t && (window.location.hash = o), p(e), A?.(e);
25
+ o != null && a && window.history.replaceState(null, "", `#${o}`), p(e), A?.(e);
26
26
  };
27
- return /* @__PURE__ */ r(
28
- N,
27
+ return /* @__PURE__ */ t(
28
+ I,
29
29
  {
30
30
  elevation: v,
31
- className: `${a.elevation} ${T === "none" ? "" : a.themeBackground}`,
31
+ className: `${r.elevation} ${T === "none" ? "" : r.themeBackground}`,
32
32
  children: /* @__PURE__ */ d(c, { direction: "vertical", gap: g, secondaryAlign: "stretch", children: [
33
- /* @__PURE__ */ d(c, { direction: l ? "horizontal" : "vertical", className: a.tabWrapper, children: [
34
- /* @__PURE__ */ r(
35
- b,
33
+ /* @__PURE__ */ d(c, { direction: l ? "horizontal" : "vertical", className: r.tabWrapper, children: [
34
+ /* @__PURE__ */ t(
35
+ N,
36
36
  {
37
- className: a.tabBar,
37
+ className: r.tabBar,
38
38
  clustered: l ? f : !1,
39
- clusterAlign: u,
39
+ clusterAlign: h,
40
40
  variant: "surface",
41
41
  activeTabIndex: m,
42
42
  onTabActivated: B,
43
- children: n.map((e, o) => /* @__PURE__ */ r(
44
- k,
43
+ children: n.map((e, o) => /* @__PURE__ */ t(
44
+ $,
45
45
  {
46
46
  icon: e.leadingIcon,
47
- className: s ? a.tabButton : "",
47
+ className: s ? r.tabButton : "",
48
48
  children: /* @__PURE__ */ d(c, { gap: "dense", children: [
49
49
  e.title,
50
50
  e.trailingIcon
@@ -54,14 +54,14 @@ const h = (n, t) => !t || !n ? 0 : n.findIndex((i) => i.hash === t.replace("#",
54
54
  ))
55
55
  }
56
56
  ),
57
- s ? /* @__PURE__ */ r(
58
- x,
57
+ s ? /* @__PURE__ */ t(
58
+ b,
59
59
  {
60
60
  variant: "dense",
61
- className: l ? a.childContainer : a.childContainerPhone,
62
- children: /* @__PURE__ */ r(c, { gap: "dense", primaryAlign: "center", secondaryAlign: "center", children: s })
61
+ className: l ? r.childContainer : r.childContainerPhone,
62
+ children: /* @__PURE__ */ t(c, { gap: "dense", primaryAlign: "center", secondaryAlign: "center", children: s })
63
63
  }
64
- ) : /* @__PURE__ */ r(I, {})
64
+ ) : /* @__PURE__ */ t(y, {})
65
65
  ] }),
66
66
  n[m]?.component
67
67
  ] })
@@ -69,5 +69,5 @@ const h = (n, t) => !t || !n ? 0 : n.findIndex((i) => i.hash === t.replace("#",
69
69
  );
70
70
  };
71
71
  export {
72
- D as HashTabView
72
+ z as HashTabView
73
73
  };
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.8594",
4
+ "version": "0.0.8622",
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>",