@hortiview/shared-components 1.5.0 → 1.7.0

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## [1.7.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v1.6.0...v1.7.0) (2025-05-06)
2
+
3
+ ### Features
4
+
5
+ * remove negative margin from form select ([7f5cb03](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/7f5cb0386ffc630af997ca008012f1749541ef08))
6
+ * required text from checkbox changed in a danger border around the box ([9f112dd](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/9f112dd036abc9ade4dd37753c9cf7646365f18b))
7
+
8
+ ## [1.6.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v1.5.0...v1.6.0) (2025-05-06)
9
+
10
+ ### Features
11
+
12
+ * add new test in FormCheckbox.test.tsx & change data-testid ([81525bd](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/81525bd36c7e3ff3de5127083d48d289d9efe039))
13
+
1
14
  ## [1.5.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v1.4.2...v1.5.0) (2025-05-05)
2
15
 
3
16
  ### Features
@@ -0,0 +1 @@
1
+ ._invalid_1waaq_1 *[class*=mdc-checkbox__background]{border-color:var(--lmnt-theme-danger)!important}
@@ -1 +1 @@
1
- ._invalidHelperText_ht9kd_1+*[class*=mdc-select-helper-text]{color:var(--lmnt-theme-danger)!important}._invalidBorder_ht9kd_5 *[class*=mdc-notched-outline]{border-color:var(--lmnt-theme-danger)!important}._invalidPlaceholder_ht9kd_9 *[class*=lmnt-select-label]{color:var(--lmnt-theme-danger)!important}._invalidDropdownIcon_ht9kd_13 *[class*=mdc-select__dropdown-icon]{fill:var(--lmnt-theme-danger)!important}._formSelectContainer_ht9kd_18{display:flex;flex-wrap:wrap;width:100%}._formSelectContainer_ht9kd_18 *[class*=mdc-select-helper-text]{color:var(--lmnt-helper-text-color)}._formSelectContainer_ht9kd_18 *[class*=lmnt__multi-value__label]{overflow:visible}._formSelect_ht9kd_18+*[class*=mdc-select-helper-text]{margin-bottom:-19.33px!important}._formSelect_ht9kd_18 *[class*=lmnt-select-menu]{z-index:2001}._multiText_ht9kd_44 *[class*=lmnt-select-value-container]{white-space:nowrap;overflow:hidden!important;text-overflow:ellipsis;display:block!important;padding:1.125rem 0!important}._tooltip_ht9kd_53{z-index:42}._disabled_ht9kd_58+*[class*=mdc-select-helper-text]{color:var(--lmnt-theme-on-surface-disabled)}[id*=select-container][class*=top] [class*=mdc-menu-surface--open]{bottom:0}[id*=select-container][class*=bottom] [class*=mdc-menu-surface--open]{top:0}
1
+ ._invalidHelperText_1qcz0_1+*[class*=mdc-select-helper-text]{color:var(--lmnt-theme-danger)!important}._invalidBorder_1qcz0_5 *[class*=mdc-notched-outline]{border-color:var(--lmnt-theme-danger)!important}._invalidPlaceholder_1qcz0_9 *[class*=lmnt-select-label]{color:var(--lmnt-theme-danger)!important}._invalidDropdownIcon_1qcz0_13 *[class*=mdc-select__dropdown-icon]{fill:var(--lmnt-theme-danger)!important}._formSelectContainer_1qcz0_18{display:flex;flex-wrap:wrap;width:100%}._formSelectContainer_1qcz0_18 *[class*=mdc-select-helper-text]{color:var(--lmnt-helper-text-color)}._formSelectContainer_1qcz0_18 *[class*=lmnt__multi-value__label]{overflow:visible}._formSelect_1qcz0_18 *[class*=lmnt-select-menu]{z-index:2001}._multiText_1qcz0_40 *[class*=lmnt-select-value-container]{white-space:nowrap;overflow:hidden!important;text-overflow:ellipsis;display:block!important;padding:1.125rem 0!important}._tooltip_1qcz0_49{z-index:42}._disabled_1qcz0_54+*[class*=mdc-select-helper-text]{color:var(--lmnt-theme-on-surface-disabled)}[id*=select-container][class*=top] [class*=mdc-menu-surface--open]{bottom:0}[id*=select-container][class*=bottom] [class*=mdc-menu-surface--open]{top:0}
@@ -1,45 +1,44 @@
1
- import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
- import { C } from "../../../index.es-BvrQnJ3j.js";
3
- import { G as x } from "../../../index.es-DntoATwO.js";
4
- import { a as d } from "../../../index.es-CF_xy2ns.js";
5
- import { useFormContext as l, Controller as u } from "react-hook-form";
6
- const v = ({
7
- propertyName: t,
8
- label: n,
9
- validate: a,
10
- required: m,
11
- onChange: s,
12
- disabled: c
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { C as d } from "../../../index.es-BvrQnJ3j.js";
3
+ import { G as h } from "../../../index.es-DntoATwO.js";
4
+ import { useFormContext as C, Controller as u } from "react-hook-form";
5
+ import '../../../assets/FormCheckBox.css';const v = "_invalid_1waaq_1", x = {
6
+ invalid: v
7
+ }, b = ({
8
+ propertyName: n,
9
+ label: e,
10
+ validate: t,
11
+ required: a,
12
+ onChange: c,
13
+ disabled: i
13
14
  }) => {
14
- const { control: h } = l();
15
- return /* @__PURE__ */ o(
15
+ const { control: s } = C();
16
+ return /* @__PURE__ */ r(
16
17
  u,
17
18
  {
18
- name: t,
19
- control: h,
19
+ name: n,
20
+ control: s,
20
21
  rules: {
21
- required: m,
22
- validate: a
22
+ required: a,
23
+ validate: t
23
24
  },
24
- render: ({ field: r, fieldState: e }) => /* @__PURE__ */ p(x, { direction: "vertical", gap: "none", children: [
25
- /* @__PURE__ */ o(
26
- C,
27
- {
28
- "data-testid": "checkbox",
29
- ...r,
30
- label: n,
31
- onChange: (...i) => {
32
- r.onChange(...i), s?.();
33
- },
34
- checked: r.value,
35
- disabled: c
36
- }
37
- ),
38
- e.error && /* @__PURE__ */ o(d, { "data-testid": "checkbox-error-message", themeColor: "error", children: e.error.message })
39
- ] })
25
+ render: ({ field: o, fieldState: l }) => /* @__PURE__ */ r(h, { direction: "vertical", gap: "none", children: /* @__PURE__ */ r(
26
+ d,
27
+ {
28
+ "data-testid": `checkbox-${n}`,
29
+ ...o,
30
+ className: l.error ? x.invalid : "",
31
+ label: e,
32
+ onChange: (...m) => {
33
+ o.onChange(...m), c?.();
34
+ },
35
+ checked: o.value,
36
+ disabled: i
37
+ }
38
+ ) })
40
39
  }
41
40
  );
42
41
  };
43
42
  export {
44
- v as FormCheckBox
43
+ b as FormCheckBox
45
44
  };
@@ -1,15 +1,15 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { a as n, s as t, f as m } from "../../../react.esm-CX1WJ2Pp.js";
3
- import { FormCheckBox as c } from "./FormCheckBox.js";
4
- import { v as e, d as h, t as l, g as r } from "../../../vi.CjhMlMwf-BCJNwXvu.js";
5
- const a = e.fn();
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { a as s, s as r, f as h } from "../../../react.esm-CX1WJ2Pp.js";
3
+ import { FormCheckBox as n } from "./FormCheckBox.js";
4
+ import { v as e, d as m, t as c, g as o } from "../../../vi.CjhMlMwf-BCJNwXvu.js";
5
+ const l = e.fn();
6
6
  e.mock("react-hook-form", () => ({
7
7
  ...e.importActual("react-hook-form"),
8
8
  Controller: ({
9
- render: o
10
- }) => o({
9
+ render: t
10
+ }) => t({
11
11
  field: {
12
- onChange: a
12
+ onChange: l
13
13
  },
14
14
  fieldState: { error: { message: "error" } }
15
15
  }),
@@ -39,12 +39,18 @@ e.mock("react-hook-form", () => ({
39
39
  watch: () => "2024-08-07"
40
40
  })
41
41
  }));
42
- h("FormCheckBox Test", () => {
43
- l("render FormCheckBox", () => {
44
- n(/* @__PURE__ */ s(c, { propertyName: "hasValue", label: "user.hasValue" })), r(t.getByText("user.hasValue")).toBeInTheDocument(), r(t.getByText("error")).toBeInTheDocument(), r(t.getByRole("checkbox")).toBeInTheDocument();
45
- }), l("render FormCheckBox click", () => {
46
- n(/* @__PURE__ */ s(c, { propertyName: "hasValue", label: "user.hasValue", onChange: a }));
47
- const o = t.getByRole("checkbox");
48
- m.click(o), r(a).toHaveBeenCalled();
42
+ m("FormCheckBox Test", () => {
43
+ c("render FormCheckBox", () => {
44
+ s(/* @__PURE__ */ a(n, { propertyName: "hasValue", label: "user.hasValue" })), o(r.getByText("user.hasValue")).toBeInTheDocument(), o(r.getByRole("checkbox")).toBeInTheDocument();
45
+ const t = document.querySelector('div[class*="invalid"]');
46
+ o(t).toBeInTheDocument();
47
+ }), c("render FormCheckBox click", () => {
48
+ s(
49
+ /* @__PURE__ */ a(n, { propertyName: "hasValue", label: "user.hasValue", onChange: l })
50
+ );
51
+ const t = r.getByRole("checkbox");
52
+ h.click(t), o(l).toHaveBeenCalled();
53
+ }), c("should render checkbox with correct data-testid", () => {
54
+ s(/* @__PURE__ */ a(n, { propertyName: "hasValue", label: "user.hasValue" })), o(r.getByTestId("checkbox-hasValue")).toBeInTheDocument();
49
55
  });
50
56
  });
@@ -1,13 +1,13 @@
1
- import { jsx as o, Fragment as k, jsxs as z } from "react/jsx-runtime";
2
- import { g as _ } from "../../../get-DFv1gXfq.js";
1
+ import { jsx as o, Fragment as g, jsxs as k } from "react/jsx-runtime";
2
+ import { g as x } from "../../../get-DFv1gXfq.js";
3
3
  import { i as G } from "../../../isArray-Dub1wGJM.js";
4
- import { useMemo as C } from "react";
5
- import { useFormContext as J, Controller as $ } from "react-hook-form";
4
+ import { useMemo as z } from "react";
5
+ import { useFormContext as J, Controller as C } from "react-hook-form";
6
6
  import { M as L } from "../../../react-tooltip.min-DSY6KDqS.js";
7
7
  import { useHelperText as O } from "../../../hooks/useHelperText.js";
8
8
  import { Select as Q } from "../../Select/Select.js";
9
9
  import { SelectTooltipText as R } from "./SelectTooltipText.js";
10
- import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1", W = "_invalidBorder_ht9kd_5", X = "_invalidPlaceholder_ht9kd_9", Y = "_invalidDropdownIcon_ht9kd_13", Z = "_formSelectContainer_ht9kd_18", N = "_formSelect_ht9kd_18", y = "_multiText_ht9kd_44", K = "_tooltip_ht9kd_53", tt = "_disabled_ht9kd_58", e = {
10
+ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_1qcz0_1", W = "_invalidBorder_1qcz0_5", X = "_invalidPlaceholder_1qcz0_9", Y = "_invalidDropdownIcon_1qcz0_13", Z = "_formSelectContainer_1qcz0_18", N = "_formSelect_1qcz0_18", y = "_multiText_1qcz0_40", K = "_tooltip_1qcz0_49", ee = "_disabled_1qcz0_54", t = {
11
11
  invalidHelperText: U,
12
12
  invalidBorder: W,
13
13
  invalidPlaceholder: X,
@@ -16,100 +16,100 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1",
16
16
  formSelect: N,
17
17
  multiText: y,
18
18
  tooltip: K,
19
- disabled: tt
20
- }, ft = ({
19
+ disabled: ee
20
+ }, fe = ({
21
21
  propertyName: i,
22
22
  label: s,
23
23
  options: r,
24
- multi: d = !1,
25
- disabled: x = !1,
26
- hoisted: H = !1,
27
- hidden: I = !1,
24
+ multi: a = !1,
25
+ disabled: h = !1,
26
+ hoisted: $ = !1,
27
+ hidden: H = !1,
28
28
  valueKey: n = "value",
29
29
  textKey: u = "text",
30
- clearable: w = !1,
31
- searchable: D = !0,
30
+ clearable: I = !1,
31
+ searchable: w = !0,
32
32
  noOptionsMessage: T = "",
33
33
  rules: f,
34
- menuPosition: P = "auto",
34
+ menuPosition: D = "auto",
35
35
  ...l
36
36
  }) => {
37
37
  const {
38
38
  control: v,
39
- getFieldState: B,
40
- formState: { errors: S, isValidating: p }
41
- } = J(), F = C(
42
- () => !p && _(S, i) !== void 0,
43
- [S, i, p]
44
- ), b = C(
39
+ getFieldState: P,
40
+ formState: { errors: S, isValidating: q }
41
+ } = J(), B = z(
42
+ () => !q && x(S, i) !== void 0,
43
+ [S, i, q]
44
+ ), F = z(
45
45
  () => f?.required?.message,
46
46
  [f]
47
- ), { helperText: M, helperTextPersistent: j } = O({
47
+ ), { helperText: b, helperTextPersistent: M } = O({
48
48
  propertyName: i,
49
49
  helperText: l.helperText,
50
- requiredText: b,
50
+ requiredText: F,
51
51
  hasCharacterCount: !1
52
52
  });
53
- return I ? /* @__PURE__ */ o($, { name: i, control: v, render: () => /* @__PURE__ */ o(k, {}) }) : /* @__PURE__ */ o(
53
+ return H ? /* @__PURE__ */ o(C, { name: i, control: v, render: () => /* @__PURE__ */ o(g, {}) }) : /* @__PURE__ */ o(
54
54
  "div",
55
55
  {
56
56
  "data-testid": "form-select-container",
57
- className: e.formSelectContainer,
57
+ className: t.formSelectContainer,
58
58
  "data-tooltip-id": s,
59
59
  children: /* @__PURE__ */ o(
60
- $,
60
+ C,
61
61
  {
62
62
  name: i,
63
63
  rules: f,
64
64
  control: v,
65
- render: ({ field: { ref: et, onChange: m, value: g, ...q } }) => {
66
- let h = r;
67
- G(r) && _(r[0], "options") !== void 0 && (h = r.flatMap((t) => _(t, "options") ?? []));
68
- const a = d ? h?.filter(
69
- (t) => g?.includes(t[n])
70
- ) : h?.find((t) => t[n] === g), A = d && l.multiDisplayType === "text" && l.fixedHeightInput, c = B(i).invalid, E = `
71
- ${e.formSelect}
72
- ${c ? e.invalidHelperText : ""}
73
- ${c ? e.invalidDropdownIcon : ""}
74
- ${c ? e.invalidBorder : ""}
75
- ${c ? e.invalidPlaceholder : ""}
76
- ${A ? e.multiText : ""}
77
- ${x ? e.disabled : ""}`;
78
- return /* @__PURE__ */ z(k, { children: [
65
+ render: ({ field: { ref: te, onChange: m, value: p, ...j } }) => {
66
+ let _ = r;
67
+ G(r) && x(r[0], "options") !== void 0 && (_ = r.flatMap((e) => x(e, "options") ?? []));
68
+ const d = a ? _?.filter(
69
+ (e) => p?.includes(e[n])
70
+ ) : _?.find((e) => e[n] === p), A = a && l.multiDisplayType === "text" && l.fixedHeightInput, c = P(i).invalid, E = `
71
+ ${t.formSelect}
72
+ ${c ? t.invalidHelperText : ""}
73
+ ${c ? t.invalidDropdownIcon : ""}
74
+ ${c ? t.invalidBorder : ""}
75
+ ${c ? t.invalidPlaceholder : ""}
76
+ ${A ? t.multiText : ""}
77
+ ${h ? t.disabled : ""}`;
78
+ return /* @__PURE__ */ k(g, { children: [
79
79
  /* @__PURE__ */ o(
80
80
  Q,
81
81
  {
82
- ...q,
82
+ ...j,
83
83
  ...l,
84
- value: a ?? [],
84
+ value: d ?? [],
85
85
  label: s,
86
86
  variant: "outlined",
87
- helperText: M,
88
- helperTextPersistent: j,
87
+ helperText: b,
88
+ helperTextPersistent: M,
89
89
  options: r,
90
- valid: !F,
90
+ valid: !B,
91
91
  "data-testid": l["data-testid"] ?? `select-${i}`,
92
- multiSelect: !r?.length && T ? !1 : d,
92
+ multiSelect: !r?.length && T ? !1 : a,
93
93
  className: E,
94
- disabled: x,
94
+ disabled: h,
95
95
  valueKey: n,
96
96
  textKey: u,
97
- onChange: (t) => {
98
- if (t == null) {
99
- m(t);
97
+ onChange: (e) => {
98
+ if (e == null) {
99
+ m(e);
100
100
  return;
101
101
  }
102
- if (d) {
103
- m(t.map((V) => V[n]));
102
+ if (a) {
103
+ m(e.map((V) => V[n]));
104
104
  return;
105
105
  }
106
- m(t[n]), l?.onChange?.(t);
106
+ m(e[n]), l?.onChange?.(e);
107
107
  },
108
- hoisted: H,
108
+ hoisted: $,
109
109
  noOptionsMessage: T,
110
- searchable: D,
111
- clearable: w,
112
- menuPosition: P
110
+ searchable: w,
111
+ clearable: I,
112
+ menuPosition: D
113
113
  }
114
114
  ),
115
115
  /* @__PURE__ */ o(
@@ -119,9 +119,9 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1",
119
119
  noArrow: !0,
120
120
  place: "bottom",
121
121
  delayShow: 420,
122
- className: e.tooltip,
123
- hidden: !a || a.length === 0 || !l.fixedHeightInput,
124
- children: /* @__PURE__ */ o(R, { value: a, textKey: u, valueKey: n })
122
+ className: t.tooltip,
123
+ hidden: !d || d.length === 0 || !l.fixedHeightInput,
124
+ children: /* @__PURE__ */ o(R, { value: d, textKey: u, valueKey: n })
125
125
  }
126
126
  )
127
127
  ] });
@@ -132,5 +132,5 @@ import '../../../assets/FormSelect.css';const U = "_invalidHelperText_ht9kd_1",
132
132
  );
133
133
  };
134
134
  export {
135
- ft as FormSelect
135
+ fe as FormSelect
136
136
  };
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": "1.5.0",
4
+ "version": "1.7.0",
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>",