@hortiview/shared-components 1.6.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 +7 -0
- package/dist/assets/FormCheckBox.css +1 -0
- package/dist/assets/FormSelect.css +1 -1
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.js +31 -32
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.test.js +13 -9
- package/dist/components/FormComponents/FormSelect/FormSelect.js +60 -60
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
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
|
+
|
|
1
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)
|
|
2
9
|
|
|
3
10
|
### Features
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._invalid_1waaq_1 *[class*=mdc-checkbox__background]{border-color:var(--lmnt-theme-danger)!important}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
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
|
|
2
|
-
import { C as
|
|
3
|
-
import { G as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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,
|
|
10
11
|
required: a,
|
|
11
12
|
onChange: c,
|
|
12
|
-
disabled:
|
|
13
|
+
disabled: i
|
|
13
14
|
}) => {
|
|
14
|
-
const { control:
|
|
15
|
-
return /* @__PURE__ */
|
|
15
|
+
const { control: s } = C();
|
|
16
|
+
return /* @__PURE__ */ r(
|
|
16
17
|
u,
|
|
17
18
|
{
|
|
18
|
-
name:
|
|
19
|
-
control:
|
|
19
|
+
name: n,
|
|
20
|
+
control: s,
|
|
20
21
|
rules: {
|
|
21
22
|
required: a,
|
|
22
|
-
validate:
|
|
23
|
+
validate: t
|
|
23
24
|
},
|
|
24
|
-
render: ({ field:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
t.error && /* @__PURE__ */ o(d, { "data-testid": "checkbox-error-message", themeColor: "error", children: t.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
|
-
|
|
43
|
+
b as FormCheckBox
|
|
45
44
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { a as s, s as
|
|
2
|
+
import { a as s, s as r, f as h } from "../../../react.esm-CX1WJ2Pp.js";
|
|
3
3
|
import { FormCheckBox as n } from "./FormCheckBox.js";
|
|
4
|
-
import { v as e, d as m, t as c, g as
|
|
4
|
+
import { v as e, d as m, t as c, g as o } from "../../../vi.CjhMlMwf-BCJNwXvu.js";
|
|
5
5
|
const l = e.fn();
|
|
6
6
|
e.mock("react-hook-form", () => ({
|
|
7
7
|
...e.importActual("react-hook-form"),
|
|
8
8
|
Controller: ({
|
|
9
|
-
render:
|
|
10
|
-
}) =>
|
|
9
|
+
render: t
|
|
10
|
+
}) => t({
|
|
11
11
|
field: {
|
|
12
12
|
onChange: l
|
|
13
13
|
},
|
|
@@ -41,12 +41,16 @@ e.mock("react-hook-form", () => ({
|
|
|
41
41
|
}));
|
|
42
42
|
m("FormCheckBox Test", () => {
|
|
43
43
|
c("render FormCheckBox", () => {
|
|
44
|
-
s(/* @__PURE__ */ a(n, { propertyName: "hasValue", label: "user.hasValue" })), r
|
|
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();
|
|
45
47
|
}), c("render FormCheckBox click", () => {
|
|
46
|
-
s(
|
|
47
|
-
|
|
48
|
-
|
|
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();
|
|
49
53
|
}), c("should render checkbox with correct data-testid", () => {
|
|
50
|
-
s(/* @__PURE__ */ a(n, { propertyName: "hasValue", label: "user.hasValue" })), r
|
|
54
|
+
s(/* @__PURE__ */ a(n, { propertyName: "hasValue", label: "user.hasValue" })), o(r.getByTestId("checkbox-hasValue")).toBeInTheDocument();
|
|
51
55
|
});
|
|
52
56
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as o, Fragment as
|
|
2
|
-
import { g as
|
|
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
|
|
5
|
-
import { useFormContext as J, Controller as
|
|
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 = "
|
|
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:
|
|
20
|
-
},
|
|
19
|
+
disabled: ee
|
|
20
|
+
}, fe = ({
|
|
21
21
|
propertyName: i,
|
|
22
22
|
label: s,
|
|
23
23
|
options: r,
|
|
24
|
-
multi:
|
|
25
|
-
disabled:
|
|
26
|
-
hoisted:
|
|
27
|
-
hidden:
|
|
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:
|
|
31
|
-
searchable:
|
|
30
|
+
clearable: I = !1,
|
|
31
|
+
searchable: w = !0,
|
|
32
32
|
noOptionsMessage: T = "",
|
|
33
33
|
rules: f,
|
|
34
|
-
menuPosition:
|
|
34
|
+
menuPosition: D = "auto",
|
|
35
35
|
...l
|
|
36
36
|
}) => {
|
|
37
37
|
const {
|
|
38
38
|
control: v,
|
|
39
|
-
getFieldState:
|
|
40
|
-
formState: { errors: S, isValidating:
|
|
41
|
-
} = J(),
|
|
42
|
-
() => !
|
|
43
|
-
[S, i,
|
|
44
|
-
),
|
|
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:
|
|
47
|
+
), { helperText: b, helperTextPersistent: M } = O({
|
|
48
48
|
propertyName: i,
|
|
49
49
|
helperText: l.helperText,
|
|
50
|
-
requiredText:
|
|
50
|
+
requiredText: F,
|
|
51
51
|
hasCharacterCount: !1
|
|
52
52
|
});
|
|
53
|
-
return
|
|
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:
|
|
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:
|
|
66
|
-
let
|
|
67
|
-
G(r) &&
|
|
68
|
-
const
|
|
69
|
-
(
|
|
70
|
-
) :
|
|
71
|
-
${
|
|
72
|
-
${c ?
|
|
73
|
-
${c ?
|
|
74
|
-
${c ?
|
|
75
|
-
${c ?
|
|
76
|
-
${A ?
|
|
77
|
-
${
|
|
78
|
-
return /* @__PURE__ */
|
|
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
|
-
...
|
|
82
|
+
...j,
|
|
83
83
|
...l,
|
|
84
|
-
value:
|
|
84
|
+
value: d ?? [],
|
|
85
85
|
label: s,
|
|
86
86
|
variant: "outlined",
|
|
87
|
-
helperText:
|
|
88
|
-
helperTextPersistent:
|
|
87
|
+
helperText: b,
|
|
88
|
+
helperTextPersistent: M,
|
|
89
89
|
options: r,
|
|
90
|
-
valid: !
|
|
90
|
+
valid: !B,
|
|
91
91
|
"data-testid": l["data-testid"] ?? `select-${i}`,
|
|
92
|
-
multiSelect: !r?.length && T ? !1 :
|
|
92
|
+
multiSelect: !r?.length && T ? !1 : a,
|
|
93
93
|
className: E,
|
|
94
|
-
disabled:
|
|
94
|
+
disabled: h,
|
|
95
95
|
valueKey: n,
|
|
96
96
|
textKey: u,
|
|
97
|
-
onChange: (
|
|
98
|
-
if (
|
|
99
|
-
m(
|
|
97
|
+
onChange: (e) => {
|
|
98
|
+
if (e == null) {
|
|
99
|
+
m(e);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
if (
|
|
103
|
-
m(
|
|
102
|
+
if (a) {
|
|
103
|
+
m(e.map((V) => V[n]));
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
m(
|
|
106
|
+
m(e[n]), l?.onChange?.(e);
|
|
107
107
|
},
|
|
108
|
-
hoisted:
|
|
108
|
+
hoisted: $,
|
|
109
109
|
noOptionsMessage: T,
|
|
110
|
-
searchable:
|
|
111
|
-
clearable:
|
|
112
|
-
menuPosition:
|
|
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:
|
|
123
|
-
hidden: !
|
|
124
|
-
children: /* @__PURE__ */ o(R, { value:
|
|
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
|
-
|
|
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.
|
|
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>",
|