@hortiview/default-components 1.4.2 → 1.4.3
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 +1 @@
|
|
|
1
|
-
._customPortal_8wq49_1>div[class*=lmnt__menu-portal]{transition:none}._customSelect_8wq49_7 div[class*=lmnt__menu-list--is-multi]{max-height:none}.
|
|
1
|
+
._customPortal_8wq49_1>div[class*=lmnt__menu-portal]{transition:none}._customSelect_8wq49_7 div[class*=lmnt__menu-list--is-multi]{max-height:none}._invalidHelperText_u3es9_1+*[class*=mdc-select-helper-text]{color:var(--lmnt-theme-danger)!important}._invalidBorder_u3es9_5 *[class*=mdc-notched-outline]{border-color:var(--lmnt-theme-danger)!important}._invalidPlaceholder_u3es9_9 *[class*=lmnt-select-label]{color:var(--lmnt-theme-danger)!important}._invalidDropdownIcon_u3es9_13 *[class*=mdc-select__dropdown-icon]{fill:var(--lmnt-theme-danger)!important}._formSelectContainer_u3es9_18{display:flex;flex-wrap:wrap;width:100%}._formSelectContainer_u3es9_18>*[class*=lmnt-select-container]{flex-direction:column}._formSelectContainer_u3es9_18 *[class*=mdc-select-helper-text]{color:var(--lmnt-helper-text-color);align-self:flex-start}._formSelectContainer_u3es9_18 *[class*=lmnt__multi-value__label]{overflow:visible}._formSelect_u3es9_18 *[class*=lmnt-select-menu]{z-index:2001}._multiText_u3es9_45 *[class*=lmnt-select-value-container]{white-space:nowrap;overflow:hidden!important;text-overflow:ellipsis;display:block!important;padding:1.125rem 0!important}._tooltip_u3es9_54{z-index:42}._disabled_u3es9_59+*[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,55 +1,55 @@
|
|
|
1
|
-
import { jsx as o, Fragment as
|
|
2
|
-
import { a as
|
|
3
|
-
import { d as
|
|
4
|
-
import { useEffect as
|
|
1
|
+
import { jsx as o, Fragment as N, jsxs as U } from "react/jsx-runtime";
|
|
2
|
+
import { a as S, v as W } from "../../useHelperText-3ahu6tTS.js";
|
|
3
|
+
import { d as z, ao as X, u as Y } from "../../useTranslation-CVaIJbcK.js";
|
|
4
|
+
import { useEffect as K, useMemo as M } from "react";
|
|
5
5
|
import { useFormContext as Z, Controller as A } from "react-hook-form";
|
|
6
6
|
import { I as k, l as G, V as J } from "../../index.es-CK4oZMKs-Da8pin7D.js";
|
|
7
7
|
import { O as Q, D as R } from "../../index.es-BGordhUK-C36NK84Q.js";
|
|
8
8
|
import { InternationalizationWrapper as ee } from "../InternationalizationWrapper/InternationalizationWrapper.js";
|
|
9
|
-
import '../../assets/DefaultFormSelect.css';const te = "_customPortal_8wq49_1", le = "_customSelect_8wq49_7",
|
|
9
|
+
import '../../assets/DefaultFormSelect.css';const te = "_customPortal_8wq49_1", le = "_customSelect_8wq49_7", D = {
|
|
10
10
|
customPortal: te,
|
|
11
11
|
customSelect: le
|
|
12
12
|
}, oe = ({
|
|
13
13
|
menuMaxHeight: e = "15rem",
|
|
14
14
|
portalClassName: t,
|
|
15
15
|
"data-testid": l = "custom-select",
|
|
16
|
-
className:
|
|
16
|
+
className: n,
|
|
17
17
|
hoisted: u,
|
|
18
|
-
...
|
|
18
|
+
..._
|
|
19
19
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
if (u && !document.getElementById(
|
|
23
|
-
const
|
|
24
|
-
|
|
20
|
+
const m = `custom-portal-${t ?? "default"}`, s = k("elementSelectForTestId-");
|
|
21
|
+
return K(() => {
|
|
22
|
+
if (u && !document.getElementById(m)) {
|
|
23
|
+
const r = document.createElement("div");
|
|
24
|
+
r.id = m, r.className = `${D.customPortal} ${t ?? ""}`, document.body.appendChild(r);
|
|
25
25
|
}
|
|
26
|
-
}, [u,
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
}, [u, m, t]), K(() => {
|
|
27
|
+
const r = document.querySelectorAll(`#${s} input[role="combobox"]`);
|
|
28
|
+
r && r.forEach((x) => {
|
|
29
|
+
x.setAttribute("data-testid", l);
|
|
30
30
|
});
|
|
31
|
-
}, [l,
|
|
31
|
+
}, [l, s]), /* @__PURE__ */ o(
|
|
32
32
|
G,
|
|
33
33
|
{
|
|
34
34
|
menuMaxHeight: e,
|
|
35
35
|
hoisted: u,
|
|
36
|
-
id:
|
|
37
|
-
portalContainer: document.getElementById(
|
|
38
|
-
className: `${
|
|
39
|
-
...
|
|
36
|
+
id: s,
|
|
37
|
+
portalContainer: document.getElementById(m) ? `#${m}` : void 0,
|
|
38
|
+
className: `${D.customSelect} ${n ?? ""}`,
|
|
39
|
+
..._
|
|
40
40
|
}
|
|
41
41
|
);
|
|
42
42
|
};
|
|
43
43
|
var ae = X();
|
|
44
|
-
const ie = /* @__PURE__ */
|
|
44
|
+
const ie = /* @__PURE__ */ z(ae), se = ({ value: e, textKey: t, valueKey: l }) => {
|
|
45
45
|
if (!(!e || e.length === 0))
|
|
46
|
-
return Array.isArray(e) ? /* @__PURE__ */ o(Q, { "data-testid": "select-tooltip", direction: "vertical", gap: "dense", children: e == null ? void 0 : e.map((
|
|
47
|
-
},
|
|
48
|
-
invalidHelperText:
|
|
49
|
-
invalidBorder:
|
|
46
|
+
return Array.isArray(e) ? /* @__PURE__ */ o(Q, { "data-testid": "select-tooltip", direction: "vertical", gap: "dense", children: e == null ? void 0 : e.map((n) => /* @__PURE__ */ o(R, { level: 2, children: n[t] }, n[l])) }) : e == null ? void 0 : e[t];
|
|
47
|
+
}, ne = "_invalidHelperText_u3es9_1", re = "_invalidBorder_u3es9_5", de = "_invalidPlaceholder_u3es9_9", me = "_invalidDropdownIcon_u3es9_13", ce = "_formSelectContainer_u3es9_18", ue = "_formSelect_u3es9_18", pe = "_multiText_u3es9_45", fe = "_tooltip_u3es9_54", he = "_disabled_u3es9_59", d = {
|
|
48
|
+
invalidHelperText: ne,
|
|
49
|
+
invalidBorder: re,
|
|
50
50
|
invalidPlaceholder: de,
|
|
51
|
-
invalidDropdownIcon:
|
|
52
|
-
formSelectContainer:
|
|
51
|
+
invalidDropdownIcon: me,
|
|
52
|
+
formSelectContainer: ce,
|
|
53
53
|
formSelect: ue,
|
|
54
54
|
multiText: pe,
|
|
55
55
|
tooltip: fe,
|
|
@@ -58,39 +58,39 @@ const ie = /* @__PURE__ */ W(ae), ne = ({ value: e, textKey: t, valueKey: l }) =
|
|
|
58
58
|
propertyName: e,
|
|
59
59
|
label: t,
|
|
60
60
|
options: l,
|
|
61
|
-
multi:
|
|
61
|
+
multi: n = !1,
|
|
62
62
|
disabled: u = !1,
|
|
63
|
-
hoisted:
|
|
64
|
-
hidden:
|
|
65
|
-
valueKey:
|
|
66
|
-
textKey:
|
|
67
|
-
clearable:
|
|
68
|
-
searchable:
|
|
69
|
-
noOptionsMessage:
|
|
63
|
+
hoisted: _ = !1,
|
|
64
|
+
hidden: m = !1,
|
|
65
|
+
valueKey: s = "value",
|
|
66
|
+
textKey: r = "text",
|
|
67
|
+
clearable: x = !1,
|
|
68
|
+
searchable: F = !0,
|
|
69
|
+
noOptionsMessage: T = "",
|
|
70
70
|
rules: p,
|
|
71
|
-
menuPosition:
|
|
71
|
+
menuPosition: w = "auto",
|
|
72
72
|
...a
|
|
73
73
|
}) => {
|
|
74
74
|
const {
|
|
75
|
-
control:
|
|
76
|
-
getFieldState:
|
|
77
|
-
formState: { errors:
|
|
78
|
-
} = Z(),
|
|
79
|
-
() => !
|
|
80
|
-
[
|
|
81
|
-
),
|
|
75
|
+
control: g,
|
|
76
|
+
getFieldState: H,
|
|
77
|
+
formState: { errors: C, isValidating: I }
|
|
78
|
+
} = Z(), O = M(
|
|
79
|
+
() => !I && S(C, e) !== void 0,
|
|
80
|
+
[C, e, I]
|
|
81
|
+
), $ = M(
|
|
82
82
|
() => {
|
|
83
83
|
var y;
|
|
84
84
|
return (y = p == null ? void 0 : p.required) == null ? void 0 : y.message;
|
|
85
85
|
},
|
|
86
86
|
[p]
|
|
87
|
-
), { helperText:
|
|
87
|
+
), { helperText: q, helperTextPersistent: E } = W({
|
|
88
88
|
propertyName: e,
|
|
89
89
|
helperText: a.helperText,
|
|
90
|
-
requiredText:
|
|
90
|
+
requiredText: $,
|
|
91
91
|
hasCharacterCount: !1
|
|
92
92
|
});
|
|
93
|
-
return
|
|
93
|
+
return m ? /* @__PURE__ */ o(A, { name: e, control: g, render: () => /* @__PURE__ */ o(N, {}) }) : /* @__PURE__ */ o(
|
|
94
94
|
"div",
|
|
95
95
|
{
|
|
96
96
|
"data-testid": "form-select-container",
|
|
@@ -101,56 +101,56 @@ const ie = /* @__PURE__ */ W(ae), ne = ({ value: e, textKey: t, valueKey: l }) =
|
|
|
101
101
|
{
|
|
102
102
|
name: e,
|
|
103
103
|
rules: p,
|
|
104
|
-
control:
|
|
105
|
-
render: ({ field: { ref: y, onChange: b, value: f, ...
|
|
106
|
-
let
|
|
107
|
-
ie(l) &&
|
|
108
|
-
const h =
|
|
109
|
-
(i) => f == null ? void 0 : f.includes(i[
|
|
110
|
-
) :
|
|
104
|
+
control: g,
|
|
105
|
+
render: ({ field: { ref: y, onChange: b, value: f, ...V } }) => {
|
|
106
|
+
let c = l;
|
|
107
|
+
ie(l) && S(l[0], "options") !== void 0 && (c = l.flatMap((i) => S(i, "options") ?? []));
|
|
108
|
+
const h = n ? c == null ? void 0 : c.filter(
|
|
109
|
+
(i) => f == null ? void 0 : f.includes(i[s])
|
|
110
|
+
) : c == null ? void 0 : c.find((i) => i[s] === f), B = n && a.multiDisplayType === "text" && a.fixedHeightInput, v = H(e).invalid, L = `
|
|
111
111
|
${d.formSelect}
|
|
112
112
|
${v ? d.invalidHelperText : ""}
|
|
113
113
|
${v ? d.invalidDropdownIcon : ""}
|
|
114
114
|
${v ? d.invalidBorder : ""}
|
|
115
115
|
${v ? d.invalidPlaceholder : ""}
|
|
116
|
-
${
|
|
116
|
+
${B ? d.multiText : ""}
|
|
117
117
|
${u ? d.disabled : ""}`;
|
|
118
|
-
return /* @__PURE__ */
|
|
118
|
+
return /* @__PURE__ */ U(N, { children: [
|
|
119
119
|
/* @__PURE__ */ o(
|
|
120
120
|
oe,
|
|
121
121
|
{
|
|
122
|
-
...
|
|
122
|
+
...V,
|
|
123
123
|
...a,
|
|
124
124
|
value: h ?? [],
|
|
125
125
|
label: t,
|
|
126
126
|
variant: "outlined",
|
|
127
|
-
helperText:
|
|
128
|
-
helperTextPersistent:
|
|
127
|
+
helperText: q,
|
|
128
|
+
helperTextPersistent: E,
|
|
129
129
|
options: l,
|
|
130
|
-
valid:
|
|
130
|
+
valid: !O,
|
|
131
131
|
"data-testid": a["data-testid"] ?? `select-${e}`,
|
|
132
|
-
multiSelect: !(l != null && l.length) &&
|
|
133
|
-
className:
|
|
132
|
+
multiSelect: !(l != null && l.length) && T ? !1 : n,
|
|
133
|
+
className: L,
|
|
134
134
|
disabled: u,
|
|
135
|
-
valueKey:
|
|
136
|
-
textKey:
|
|
135
|
+
valueKey: s,
|
|
136
|
+
textKey: r,
|
|
137
137
|
onChange: (i) => {
|
|
138
138
|
var P;
|
|
139
139
|
if (i == null) {
|
|
140
140
|
b(i);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
if (
|
|
144
|
-
b(i.map((
|
|
143
|
+
if (n) {
|
|
144
|
+
b(i.map((j) => j[s]));
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
b(i[
|
|
147
|
+
b(i[s]), (P = a == null ? void 0 : a.onChange) == null || P.call(a, i);
|
|
148
148
|
},
|
|
149
|
-
hoisted:
|
|
150
|
-
noOptionsMessage:
|
|
151
|
-
searchable:
|
|
152
|
-
clearable:
|
|
153
|
-
menuPosition:
|
|
149
|
+
hoisted: _,
|
|
150
|
+
noOptionsMessage: T,
|
|
151
|
+
searchable: F,
|
|
152
|
+
clearable: x,
|
|
153
|
+
menuPosition: w
|
|
154
154
|
}
|
|
155
155
|
),
|
|
156
156
|
/* @__PURE__ */ o(
|
|
@@ -162,7 +162,7 @@ const ie = /* @__PURE__ */ W(ae), ne = ({ value: e, textKey: t, valueKey: l }) =
|
|
|
162
162
|
delayShow: 420,
|
|
163
163
|
className: d.tooltip,
|
|
164
164
|
hidden: !h || h.length === 0 || !a.fixedHeightInput,
|
|
165
|
-
children: /* @__PURE__ */ o(
|
|
165
|
+
children: /* @__PURE__ */ o(se, { value: h, textKey: r, valueKey: s })
|
|
166
166
|
}
|
|
167
167
|
)
|
|
168
168
|
] });
|
|
@@ -171,7 +171,7 @@ const ie = /* @__PURE__ */ W(ae), ne = ({ value: e, textKey: t, valueKey: l }) =
|
|
|
171
171
|
)
|
|
172
172
|
}
|
|
173
173
|
);
|
|
174
|
-
},
|
|
174
|
+
}, Ie = (e) => {
|
|
175
175
|
const { t } = Y();
|
|
176
176
|
return /* @__PURE__ */ o(ee, { children: /* @__PURE__ */ o(
|
|
177
177
|
ve,
|
|
@@ -185,5 +185,5 @@ const ie = /* @__PURE__ */ W(ae), ne = ({ value: e, textKey: t, valueKey: l }) =
|
|
|
185
185
|
) });
|
|
186
186
|
};
|
|
187
187
|
export {
|
|
188
|
-
|
|
188
|
+
Ie as DefaultFormSelect
|
|
189
189
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/default-components",
|
|
3
3
|
"description": "This is a component library that should be used in the HortiView platform and its modules. The components provided here have default translation strings.",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@element-public/react-components": "^5.68.10-alpha.1",
|
|
86
86
|
"@element-public/themes": "^5.68.10-alpha.1",
|
|
87
87
|
"@eslint/js": "^9.17.0",
|
|
88
|
-
"@hortiview/shared-components": "^2.8.
|
|
88
|
+
"@hortiview/shared-components": "^2.8.8",
|
|
89
89
|
"@rollup/plugin-json": "^6.1.0",
|
|
90
90
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
91
91
|
"@semantic-release/changelog": "^6.0.3",
|