@hortiview/shared-components 0.0.11114 → 0.0.11146
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/dist/BigLoadingSpinner-C3wTbTD0.js +17 -0
- package/dist/GenericCard-B8x1DMa8.js +81 -0
- package/dist/ListAreaService-CRX4eEUJ.js +108 -0
- package/dist/_Map-Dtlps7IZ.js +113 -0
- package/dist/{_commonjsHelpers-CT_km90n.js → _commonjsHelpers-BkfeUUK-.js} +2 -4
- package/dist/_overArg-_0pUmCsX.js +14 -0
- package/dist/assets/Filter.css +1 -0
- package/dist/assets/GenericTable.css +1 -0
- package/dist/assets/main.css +1 -0
- package/dist/components/AlertBanner/AlertBanner.js +22 -16
- package/dist/components/AlertBanner/AlertBanner.test.js +2 -2
- package/dist/components/BaseView/BaseView.js +33 -26
- package/dist/components/BaseView/BaseView.test.js +25 -25
- package/dist/components/BasicHeading/BasicHeading.js +50 -41
- package/dist/components/BasicHeading/BasicHeading.test.js +2 -2
- package/dist/components/BlockView/BlockView.js +51 -42
- package/dist/components/BlockView/BlockView.test.js +2 -2
- package/dist/components/ChipCard/ChipCard.js +12 -10
- package/dist/components/ChipCard/ChipCard.test.js +2 -2
- package/dist/components/ContextMenu/ContextMenu.js +29 -25
- package/dist/components/ContextMenu/ContextMenu.test.js +2 -2
- package/dist/components/DeleteModal/DeleteModal.js +58 -53
- package/dist/components/DeleteModal/DeleteModal.test.js +2 -2
- package/dist/components/Disclaimer/Disclaimer.js +11 -8
- package/dist/components/Disclaimer/Disclaimer.test.js +2 -2
- package/dist/components/EmptyView/EmptyView.test.js +2 -2
- package/dist/components/Filter/Filter.js +107 -125
- package/dist/components/Filter/Filter.test.js +2 -2
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.js +19 -19
- package/dist/components/FormComponents/FormCheckBox/FormCheckBox.test.js +2 -2
- package/dist/components/FormComponents/FormDatePicker/FormDatePicker.d.ts +3 -0
- package/dist/components/FormComponents/FormDatePicker/FormDatePicker.js +6081 -7102
- package/dist/components/FormComponents/FormDatePicker/FormDatePicker.test.js +2 -2
- package/dist/components/FormComponents/FormNumber/CustomTextField.js +16 -14
- package/dist/components/FormComponents/FormNumber/FormNumber.js +2 -2
- package/dist/components/FormComponents/FormNumber/FormNumber.test.js +4 -4
- package/dist/components/FormComponents/FormRadio/FormRadio.test.js +2 -2
- package/dist/components/FormComponents/FormSelect/FormSelect.d.ts +1 -1
- package/dist/components/FormComponents/FormSelect/FormSelect.js +109 -102
- package/dist/components/FormComponents/FormSelect/FormSelect.test.js +3 -3
- package/dist/components/FormComponents/FormSelect/SelectTooltipText.js +5 -5
- package/dist/components/FormComponents/FormSlider/FormSlider.test.js +2 -2
- package/dist/components/FormComponents/FormText/FormText.js +95 -96
- package/dist/components/FormComponents/FormText/FormText.test.js +13 -13
- package/dist/components/FormComponents/FormToggle/FormToggle.d.ts +31 -0
- package/dist/components/FormComponents/FormToggle/FormToggle.js +43 -0
- package/dist/components/FormComponents/FormToggle/FormToggle.test.d.ts +1 -0
- package/dist/components/FormComponents/FormToggle/FormToggle.test.js +50 -0
- package/dist/components/FormattedNumberDisplay/FormattedNumberDisplay.js +1 -1
- package/dist/components/GenericTable/GenericTable.js +64 -81
- package/dist/components/GenericTable/GenericTable.test.js +2 -2
- package/dist/components/GenericTable/GenericTableService.js +41 -43
- package/dist/components/GenericTable/Mobile/GenericCard.js +6 -68
- package/dist/components/GenericTable/Mobile/GenericCard.test.js +3 -3
- package/dist/components/GenericTable/Mobile/GenericCardList.js +8 -9
- package/dist/components/GenericTable/Mobile/GenericCardList.test.js +2 -2
- package/dist/components/HashTabView/HashTabView.js +62 -52
- package/dist/components/HashTabView/HashTabView.test.js +2 -2
- package/dist/components/HeaderFilter/HeaderFilter.js +16 -14
- package/dist/components/HeaderFilter/HeaderFilter.test.js +2 -2
- package/dist/components/HealthCheckFailed/HealthCheckFailed.js +27 -20
- package/dist/components/HealthCheckFailed/HealthCheckFailed.test.js +2 -2
- package/dist/components/Iconify/Iconify.js +56 -6
- package/dist/components/Iconify/Iconify.test.js +3 -3
- package/dist/components/InfoGroup/InfoGroup.js +36 -30
- package/dist/components/InfoGroup/InfoGroup.test.js +2 -2
- package/dist/components/ListArea/ListArea.js +45 -357
- package/dist/components/ListArea/ListArea.test.js +4 -4
- package/dist/components/ListArea/ListAreaService.js +8 -92
- package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.js +5 -9
- package/dist/components/LoadingSpinner/Big/BigLoadingSpinner.test.js +3 -4
- package/dist/components/LoadingSpinner/Default/LoadingSpinner.js +28 -26
- package/dist/components/LoadingSpinner/Default/LoadingSpinner.test.js +2 -2
- package/dist/components/Modal/Modal.js +6 -4
- package/dist/components/OverflowTooltip/OverflowTooltip.js +21 -19
- package/dist/components/OverflowTooltip/OverflowTooltip.test.js +3 -3
- package/dist/components/OverflowTooltip/OverflowTooltipService.js +1 -2
- package/dist/components/Scrollbar/scrollbar.test.js +2 -2
- package/dist/components/SearchBar/SearchBar.js +22 -20
- package/dist/components/SearchBar/SearchBar.test.js +2 -2
- package/dist/components/VerticalDivider/VerticalDivider.js +6 -4
- package/dist/components/VerticalDivider/VerticalDivider.test.js +2 -2
- package/dist/get-BiqanC9_.js +7 -0
- package/dist/get-P-5PYZOE.js +426 -0
- package/dist/hooks/useBreakpoints.test.js +2 -2
- package/dist/hooks/useHelperText.d.ts +13 -0
- package/dist/hooks/useHelperText.js +25 -0
- package/dist/index-DzM8o582.js +10881 -0
- package/dist/isArray-2zMxXFEr.js +83 -0
- package/dist/isArray-C_5XvIlE.js +7 -0
- package/dist/isEmpty-BimaZd5G.js +225 -0
- package/dist/isString-BOHPtrlm.js +44 -0
- package/dist/magic-string.es-D4UQQyt0.js +859 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +33 -31
- package/dist/orderBy-BVQIswlJ.js +765 -0
- package/dist/{react-number-format.es-BeIT_PM7.js → react-number-format.es-BD3_OvMU.js} +156 -159
- package/dist/react-tooltip.min-c2wVkjF2.js +1354 -0
- package/dist/react.esm-FR1-H8iU.js +13471 -0
- package/dist/services/UtilService.js +12 -19
- package/dist/services/services.test.js +1 -1
- package/dist/vi.CjhMlMwf-DWv7vrn7.js +12192 -0
- package/package.json +8 -6
- package/dist/BlockView.module-BPlNT5uh.js +0 -15
- package/dist/HashTabView.module-ZhwSfDeQ.js +0 -16
- package/dist/HeaderFilter.module-DiBmulr5.js +0 -7
- package/dist/Iconify-DoU6pP1o.js +0 -97
- package/dist/_Map-DKsHX-kc.js +0 -59
- package/dist/_baseToString-dkhmFwqS.js +0 -198
- package/dist/_equalByTag-BZEJl6ST.js +0 -158
- package/dist/_overArg-BC4qXKbU.js +0 -9
- package/dist/alertBanner.module-BPiKN0gh.js +0 -11
- package/dist/assets/genericTable.css +0 -1
- package/dist/baseView.module-uWbm_a5f.js +0 -12
- package/dist/basicHeading.module-BYb8xvuk.js +0 -16
- package/dist/bigLoadingSpinner.module-GgbFol8k.js +0 -11
- package/dist/chipCard.module-BjpKuf1b.js +0 -7
- package/dist/contextMenu.module-vNQHb48g.js +0 -9
- package/dist/deleteModal.module-Ds3MDzdl.js +0 -10
- package/dist/disclaimer.module-BZydt-Q_.js +0 -8
- package/dist/formDatePicker.module-BV3ma_7y.js +0 -11
- package/dist/formNumber.module-BA05Gi6_.js +0 -7
- package/dist/formSelect.module-PUiLDSD4.js +0 -15
- package/dist/formText.module-C0by6_DK.js +0 -12
- package/dist/genericCard.module-DrQu86jX.js +0 -15
- package/dist/genericTable.module-Dk3yy2S3.js +0 -17
- package/dist/get-BJn2Enx7.js +0 -47
- package/dist/healthCheckFailed.module-B5P1ogjs.js +0 -12
- package/dist/iconify.module-Cru5NS2X.js +0 -80
- package/dist/index-IMXII42b.js +0 -11708
- package/dist/infoGroup.module-Cxw88dfC.js +0 -12
- package/dist/isArray-thIeLpc5.js +0 -35
- package/dist/isPlainObject-BlCDf1Kc.js +0 -18
- package/dist/listArea.module-BhO_OJ1S.js +0 -20
- package/dist/loadingSpinner.module-CLtqSMWA.js +0 -7
- package/dist/magic-string.es-irX7syie.js +0 -732
- package/dist/modal.module-BlDp1Wiq.js +0 -7
- package/dist/overflowTooltip.module-YyRN2MGc.js +0 -7
- package/dist/react-tooltip.min-BzHiZW8k.js +0 -1380
- package/dist/react.esm-CHvVvf3L.js +0 -12786
- package/dist/searchBar.module-9gKyrZRT.js +0 -7
- package/dist/verticalDivider.module-C3_GL-fH.js +0 -7
- package/dist/vi.JYQecGiw-BpOAB4v6.js +0 -9796
- /package/dist/assets/{alertBanner.css → AlertBanner.css} +0 -0
- /package/dist/assets/{baseView.css → BaseView.css} +0 -0
- /package/dist/assets/{basicHeading.css → BasicHeading.css} +0 -0
- /package/dist/assets/{bigLoadingSpinner.css → BigLoadingSpinner.css} +0 -0
- /package/dist/assets/{chipCard.css → ChipCard.css} +0 -0
- /package/dist/assets/{contextMenu.css → ContextMenu.css} +0 -0
- /package/dist/assets/{formNumber.css → CustomTextField.css} +0 -0
- /package/dist/assets/{deleteModal.css → DeleteModal.css} +0 -0
- /package/dist/assets/{disclaimer.css → Disclaimer.css} +0 -0
- /package/dist/assets/{formDatePicker.css → FormDatePicker.css} +0 -0
- /package/dist/assets/{formSelect.css → FormSelect.css} +0 -0
- /package/dist/assets/{formText.css → FormText.css} +0 -0
- /package/dist/assets/{genericCard.css → GenericCard.css} +0 -0
- /package/dist/assets/{healthCheckFailed.css → HealthCheckFailed.css} +0 -0
- /package/dist/assets/{iconify.css → Iconify.css} +0 -0
- /package/dist/assets/{infoGroup.css → InfoGroup.css} +0 -0
- /package/dist/assets/{listArea.css → ListAreaService.css} +0 -0
- /package/dist/assets/{loadingSpinner.css → LoadingSpinner.css} +0 -0
- /package/dist/assets/{modal.css → Modal.css} +0 -0
- /package/dist/assets/{overflowTooltip.css → OverflowTooltip.css} +0 -0
- /package/dist/assets/{searchBar.css → SearchBar.css} +0 -0
- /package/dist/assets/{verticalDivider.css → VerticalDivider.css} +0 -0
|
@@ -1,134 +1,133 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import "../../../assets/FormText.css";
|
|
2
|
+
import { jsx as t, Fragment as F, jsxs as D } from "react/jsx-runtime";
|
|
3
|
+
import { Textfield as G, TypoCaption as I } from "@element/react-components";
|
|
4
|
+
import { g as J } from "../../../get-BiqanC9_.js";
|
|
5
|
+
import { useState as q, useCallback as K, useMemo as T, useEffect as O } from "react";
|
|
6
|
+
import { useFormContext as Q, Controller as H } from "react-hook-form";
|
|
7
|
+
import { useHelperText as U } from "../../../hooks/useHelperText.js";
|
|
8
|
+
const X = "_formTextAreaHelperText_168p8_1", Y = "_invalid_168p8_7", Z = "_required_168p8_11", N = "_formTextArea_168p8_1", y = "_characterCount_168p8_25", p = "_withoutCharacterCount_168p8_31", r = {
|
|
9
|
+
formTextAreaHelperText: X,
|
|
10
|
+
invalid: Y,
|
|
11
|
+
required: Z,
|
|
12
|
+
formTextArea: N,
|
|
13
|
+
characterCount: y,
|
|
14
|
+
withoutCharacterCount: p
|
|
15
|
+
}, ee = ({
|
|
8
16
|
count: e,
|
|
9
17
|
maxCount: u,
|
|
10
|
-
invalid:
|
|
11
|
-
hasRequiredText:
|
|
18
|
+
invalid: s = !1,
|
|
19
|
+
hasRequiredText: n = !1
|
|
12
20
|
}) => /* @__PURE__ */ t(
|
|
13
21
|
"div",
|
|
14
22
|
{
|
|
15
23
|
"data-testid": "character-counter-container",
|
|
16
|
-
className: `${
|
|
17
|
-
children: /* @__PURE__ */ t(
|
|
24
|
+
className: `${r.formTextAreaHelperText} ${s ? r.invalid : ""} ${n ? r.required : ""}`,
|
|
25
|
+
children: /* @__PURE__ */ t(I, { children: `${e}/${u}` })
|
|
18
26
|
}
|
|
19
|
-
),
|
|
27
|
+
), se = (e) => e.textarea ? /* @__PURE__ */ t(te, { ...e }) : /* @__PURE__ */ t(ne, { ...e }), te = (e) => /* @__PURE__ */ t("div", { "data-testid": "form-text-area", className: r.formTextArea, children: /* @__PURE__ */ t(L, { ...e }) }), ne = (e) => /* @__PURE__ */ t(
|
|
20
28
|
"div",
|
|
21
29
|
{
|
|
22
30
|
"data-testid": "form-text-field",
|
|
23
|
-
className: `${e.hasCharacterCount ?
|
|
24
|
-
children: /* @__PURE__ */ t(
|
|
31
|
+
className: `${e.hasCharacterCount ? r.characterCount : r.withoutCharacterCount}`,
|
|
32
|
+
children: /* @__PURE__ */ t(L, { ...e })
|
|
25
33
|
}
|
|
26
|
-
),
|
|
34
|
+
), L = ({
|
|
27
35
|
propertyName: e,
|
|
28
36
|
label: u,
|
|
29
|
-
disabled:
|
|
30
|
-
textarea:
|
|
31
|
-
hasCharacterCount:
|
|
32
|
-
hidden:
|
|
33
|
-
placeholder:
|
|
34
|
-
type:
|
|
35
|
-
prefixText:
|
|
36
|
-
inputMode:
|
|
37
|
-
trailingIcon:
|
|
38
|
-
trigger:
|
|
39
|
-
rules:
|
|
40
|
-
...
|
|
37
|
+
disabled: s = !1,
|
|
38
|
+
textarea: n = !1,
|
|
39
|
+
hasCharacterCount: c = !1,
|
|
40
|
+
hidden: w = !1,
|
|
41
|
+
placeholder: B,
|
|
42
|
+
type: S,
|
|
43
|
+
prefixText: j,
|
|
44
|
+
inputMode: k,
|
|
45
|
+
trailingIcon: R,
|
|
46
|
+
trigger: C = "likeForm",
|
|
47
|
+
rules: a,
|
|
48
|
+
...i
|
|
41
49
|
}) => {
|
|
42
|
-
const {
|
|
43
|
-
|
|
44
|
-
getFieldState: m,
|
|
45
|
-
formState: { errors: C },
|
|
46
|
-
trigger: $
|
|
47
|
-
} = X(), [I, x] = A(0), [o, M] = A(), g = Q(
|
|
48
|
-
(l) => {
|
|
50
|
+
const { control: g, getFieldState: d, trigger: v } = Q(), [b, f] = q(0), [o, z] = q(), m = K(
|
|
51
|
+
(h) => {
|
|
49
52
|
if (o != null) {
|
|
50
|
-
|
|
53
|
+
f(o.length);
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
|
-
if (
|
|
54
|
-
|
|
56
|
+
if (h) {
|
|
57
|
+
f(h.length);
|
|
55
58
|
return;
|
|
56
59
|
}
|
|
57
|
-
|
|
60
|
+
f(0);
|
|
58
61
|
},
|
|
59
62
|
[o]
|
|
60
|
-
),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
)
|
|
77
|
-
()
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return U(() => {
|
|
81
|
-
(r || d) && a !== void 0 && o != null && g();
|
|
82
|
-
}, [o, r, d, a, g]), H ? /* @__PURE__ */ t(j, { name: e, control: T, render: () => /* @__PURE__ */ t(S, {}) }) : /* @__PURE__ */ t(
|
|
83
|
-
j,
|
|
63
|
+
), l = T(
|
|
64
|
+
() => i.maxlength ?? a?.maxLength?.value,
|
|
65
|
+
[a, i.maxlength]
|
|
66
|
+
), E = T(
|
|
67
|
+
() => a?.minLength?.value,
|
|
68
|
+
[a]
|
|
69
|
+
), _ = T(
|
|
70
|
+
() => a?.required?.message,
|
|
71
|
+
[a]
|
|
72
|
+
), { helperText: M, helperTextPersistent: P } = U({
|
|
73
|
+
propertyName: e,
|
|
74
|
+
helperText: i.helperText,
|
|
75
|
+
requiredText: _,
|
|
76
|
+
maxLength: l,
|
|
77
|
+
hasCharacterCount: n || c
|
|
78
|
+
});
|
|
79
|
+
return O(() => {
|
|
80
|
+
(n || c) && l !== void 0 && o != null && m();
|
|
81
|
+
}, [o, n, c, l, m]), w ? /* @__PURE__ */ t(H, { name: e, control: g, render: () => /* @__PURE__ */ t(F, {}) }) : /* @__PURE__ */ t(
|
|
82
|
+
H,
|
|
84
83
|
{
|
|
85
84
|
name: e,
|
|
86
|
-
rules:
|
|
87
|
-
control:
|
|
88
|
-
render: ({ field: { ref:
|
|
89
|
-
const
|
|
90
|
-
return !o &&
|
|
85
|
+
rules: a,
|
|
86
|
+
control: g,
|
|
87
|
+
render: ({ field: { ref: h, ...x }, formState: { defaultValues: V } }) => {
|
|
88
|
+
const A = J(V, e);
|
|
89
|
+
return !o && A && (c || n) && m(A), /* @__PURE__ */ D(F, { children: [
|
|
91
90
|
/* @__PURE__ */ t(
|
|
92
|
-
|
|
91
|
+
G,
|
|
93
92
|
{
|
|
94
|
-
...
|
|
95
|
-
...
|
|
96
|
-
value:
|
|
97
|
-
type:
|
|
93
|
+
...i,
|
|
94
|
+
...x,
|
|
95
|
+
value: x.value ?? "",
|
|
96
|
+
type: S,
|
|
98
97
|
fullWidth: !0,
|
|
99
98
|
"data-testid": `textfield-${e}`,
|
|
100
|
-
inputMode:
|
|
101
|
-
placeholder:
|
|
102
|
-
prefixText:
|
|
103
|
-
disabled:
|
|
104
|
-
helperText:
|
|
105
|
-
helperTextPersistent:
|
|
99
|
+
inputMode: k,
|
|
100
|
+
placeholder: B,
|
|
101
|
+
prefixText: j,
|
|
102
|
+
disabled: s,
|
|
103
|
+
helperText: M,
|
|
104
|
+
helperTextPersistent: P,
|
|
106
105
|
label: u,
|
|
107
106
|
variant: "outlined",
|
|
108
|
-
maxlength:
|
|
109
|
-
minLength:
|
|
110
|
-
textarea:
|
|
107
|
+
maxlength: l,
|
|
108
|
+
minLength: E,
|
|
109
|
+
textarea: n,
|
|
111
110
|
noResize: !1,
|
|
112
111
|
onBlur: () => {
|
|
113
|
-
|
|
112
|
+
C === "onBlur" && v(e), i.onBlur?.();
|
|
114
113
|
},
|
|
115
|
-
onChange: (
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
114
|
+
onChange: ($) => {
|
|
115
|
+
x.onChange($);
|
|
116
|
+
const W = $?.target?.value;
|
|
117
|
+
z(W), C === "onChange" && v(e);
|
|
119
118
|
},
|
|
120
|
-
valid: !
|
|
121
|
-
className: `${
|
|
122
|
-
trailingIcon:
|
|
119
|
+
valid: !d(e).invalid,
|
|
120
|
+
className: `${r.formText} ${d(e).invalid ? r.invalid : ""}`,
|
|
121
|
+
trailingIcon: R
|
|
123
122
|
}
|
|
124
123
|
),
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
l !== void 0 && (c || n) && /* @__PURE__ */ t(
|
|
125
|
+
ee,
|
|
127
126
|
{
|
|
128
|
-
count:
|
|
129
|
-
maxCount:
|
|
130
|
-
invalid:
|
|
131
|
-
hasRequiredText: !!
|
|
127
|
+
count: b,
|
|
128
|
+
maxCount: l,
|
|
129
|
+
invalid: d(e).invalid,
|
|
130
|
+
hasRequiredText: !!i.helperText || !!_
|
|
132
131
|
}
|
|
133
132
|
)
|
|
134
133
|
] });
|
|
@@ -137,5 +136,5 @@ const Y = ({
|
|
|
137
136
|
);
|
|
138
137
|
};
|
|
139
138
|
export {
|
|
140
|
-
|
|
139
|
+
se as FormText
|
|
141
140
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { a as s, s as r, f as d } from "../../../react.esm-
|
|
3
|
-
import { FormText as
|
|
4
|
-
import { v as a, d as u, t as
|
|
2
|
+
import { a as s, s as r, f as d } from "../../../react.esm-FR1-H8iU.js";
|
|
3
|
+
import { FormText as l } from "./FormText.js";
|
|
4
|
+
import { v as a, d as u, t as o, g as e } from "../../../vi.CjhMlMwf-DWv7vrn7.js";
|
|
5
5
|
const m = a.fn();
|
|
6
6
|
a.mock("react-hook-form", () => ({
|
|
7
7
|
...a.importActual("react-hook-form"),
|
|
@@ -43,10 +43,10 @@ a.mock("react-hook-form", () => ({
|
|
|
43
43
|
})
|
|
44
44
|
}));
|
|
45
45
|
u("FormText Test", () => {
|
|
46
|
-
|
|
46
|
+
o("render FormText and return single line text field", () => {
|
|
47
47
|
s(
|
|
48
48
|
/* @__PURE__ */ n(
|
|
49
|
-
|
|
49
|
+
l,
|
|
50
50
|
{
|
|
51
51
|
rules: {
|
|
52
52
|
maxLength: {
|
|
@@ -61,10 +61,10 @@ u("FormText Test", () => {
|
|
|
61
61
|
);
|
|
62
62
|
const t = r.getByRole("textbox");
|
|
63
63
|
e(t).toBeInTheDocument(), e(t).toBeInstanceOf(HTMLInputElement), e(t).toHaveAttribute("maxlength", "100"), e(r.getByText("address.line2")).toBeInTheDocument();
|
|
64
|
-
}),
|
|
64
|
+
}), o("change value of single line text field", () => {
|
|
65
65
|
s(
|
|
66
66
|
/* @__PURE__ */ n(
|
|
67
|
-
|
|
67
|
+
l,
|
|
68
68
|
{
|
|
69
69
|
rules: {
|
|
70
70
|
maxLength: {
|
|
@@ -79,10 +79,10 @@ u("FormText Test", () => {
|
|
|
79
79
|
);
|
|
80
80
|
const t = r.getByRole("textbox");
|
|
81
81
|
e(t).toHaveValue("test"), d.change(t, { target: { value: "test-change" } }), e(m).toHaveBeenCalled();
|
|
82
|
-
}),
|
|
82
|
+
}), o("render FormText and return text area", () => {
|
|
83
83
|
s(
|
|
84
84
|
/* @__PURE__ */ n(
|
|
85
|
-
|
|
85
|
+
l,
|
|
86
86
|
{
|
|
87
87
|
rules: {
|
|
88
88
|
required: {
|
|
@@ -102,10 +102,10 @@ u("FormText Test", () => {
|
|
|
102
102
|
);
|
|
103
103
|
const t = r.getByRole("textbox");
|
|
104
104
|
e(t).toBeInTheDocument(), e(t).toBeInstanceOf(HTMLTextAreaElement), e(t).toHaveAttribute("maxlength", "200"), e(r.getByText("address.line1")).toBeInTheDocument(), e(r.getByText("required")).toBeInTheDocument();
|
|
105
|
-
}),
|
|
105
|
+
}), o("render FormText with maxLength indicator", () => {
|
|
106
106
|
s(
|
|
107
107
|
/* @__PURE__ */ n(
|
|
108
|
-
|
|
108
|
+
l,
|
|
109
109
|
{
|
|
110
110
|
rules: {
|
|
111
111
|
maxLength: {
|
|
@@ -119,10 +119,10 @@ u("FormText Test", () => {
|
|
|
119
119
|
}
|
|
120
120
|
)
|
|
121
121
|
), e(r.getByText("address.line1")).toBeInTheDocument(), e(r.queryByText("required")).not.toBeInTheDocument(), e(r.getByText("0/200")).toBeInTheDocument();
|
|
122
|
-
}),
|
|
122
|
+
}), o("change value of text area", () => {
|
|
123
123
|
s(
|
|
124
124
|
/* @__PURE__ */ n(
|
|
125
|
-
|
|
125
|
+
l,
|
|
126
126
|
{
|
|
127
127
|
rules: {
|
|
128
128
|
required: {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SwitchProps } from '@element/react-components';
|
|
2
|
+
import { FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
type FormToggleProps<T extends FieldValues> = {
|
|
4
|
+
/** The name of the property that this toggle represents. */
|
|
5
|
+
propertyName: Path<T>;
|
|
6
|
+
/** Label to be displayed with the toggle. */
|
|
7
|
+
label: SwitchProps['label'];
|
|
8
|
+
/** Validation rules for the toggle. */
|
|
9
|
+
validate?: RegisterOptions<T>['validate'];
|
|
10
|
+
/** Determines if this input is mandatory. */
|
|
11
|
+
required?: boolean;
|
|
12
|
+
/** Function to be called when the toggle value changes. */
|
|
13
|
+
onChange?: SwitchProps['onChange'];
|
|
14
|
+
/** Determines if this input is disabled. */
|
|
15
|
+
disabled?: SwitchProps['disabled'];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* FormToggle is a custom form input component for selecting toggle.
|
|
19
|
+
* It is integrated with react-hook-form for form management.
|
|
20
|
+
*
|
|
21
|
+
* @param propertyName - the name of the property this toggle maps to in the form.
|
|
22
|
+
* @param label - label displayed along with the toggle.
|
|
23
|
+
* @param validate - validation rules for the toggle.
|
|
24
|
+
* @param required - determines if the toggle is required.
|
|
25
|
+
* @param onChange - function to be called when the toggle value changes.
|
|
26
|
+
* @param disabled - determines if the toggle is disabled.
|
|
27
|
+
*
|
|
28
|
+
* @returns A JSX element that renders a toggle form input.
|
|
29
|
+
*/
|
|
30
|
+
export declare const FormToggle: <T extends FieldValues>({ propertyName, label, validate, required, onChange, disabled, }: FormToggleProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as o, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { Group as l, Switch as p, TypoCaption as d } from "@element/react-components";
|
|
3
|
+
import { useFormContext as u, Controller as C } from "react-hook-form";
|
|
4
|
+
const v = ({
|
|
5
|
+
propertyName: t,
|
|
6
|
+
label: n,
|
|
7
|
+
validate: s,
|
|
8
|
+
required: c,
|
|
9
|
+
onChange: m,
|
|
10
|
+
disabled: a
|
|
11
|
+
}) => {
|
|
12
|
+
const { control: i } = u();
|
|
13
|
+
return /* @__PURE__ */ o(
|
|
14
|
+
C,
|
|
15
|
+
{
|
|
16
|
+
name: t,
|
|
17
|
+
control: i,
|
|
18
|
+
rules: {
|
|
19
|
+
required: c,
|
|
20
|
+
validate: s
|
|
21
|
+
},
|
|
22
|
+
render: ({ field: r, fieldState: e }) => /* @__PURE__ */ h(l, { direction: "vertical", children: [
|
|
23
|
+
/* @__PURE__ */ o(
|
|
24
|
+
p,
|
|
25
|
+
{
|
|
26
|
+
"data-testid": "checkbox",
|
|
27
|
+
...r,
|
|
28
|
+
label: n,
|
|
29
|
+
onChange: (...g) => {
|
|
30
|
+
r.onChange(...g), m?.();
|
|
31
|
+
},
|
|
32
|
+
checked: r.value,
|
|
33
|
+
disabled: a
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
e.error && /* @__PURE__ */ o(d, { "data-testid": "toggle-error-message", themeColor: "error", children: e.error.message })
|
|
37
|
+
] })
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
v as FormToggle
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { a as n, s as t, f as m } from "../../../react.esm-FR1-H8iU.js";
|
|
3
|
+
import { FormToggle as l } from "./FormToggle.js";
|
|
4
|
+
import { v as e, d as f, t as c, g as r } from "../../../vi.CjhMlMwf-DWv7vrn7.js";
|
|
5
|
+
const a = e.fn();
|
|
6
|
+
e.mock("react-hook-form", () => ({
|
|
7
|
+
...e.importActual("react-hook-form"),
|
|
8
|
+
Controller: ({
|
|
9
|
+
render: o
|
|
10
|
+
}) => o({
|
|
11
|
+
field: {
|
|
12
|
+
onChange: a
|
|
13
|
+
},
|
|
14
|
+
fieldState: { error: { message: "error" } }
|
|
15
|
+
}),
|
|
16
|
+
useFormContext: () => ({
|
|
17
|
+
control: {
|
|
18
|
+
register: e.fn(),
|
|
19
|
+
unregister: e.fn(),
|
|
20
|
+
getFieldState: e.fn(),
|
|
21
|
+
_names: {
|
|
22
|
+
array: new Set("test"),
|
|
23
|
+
mount: new Set("test"),
|
|
24
|
+
unMount: new Set("test"),
|
|
25
|
+
watch: new Set("test"),
|
|
26
|
+
focus: "test",
|
|
27
|
+
watchAll: !1
|
|
28
|
+
},
|
|
29
|
+
_subjects: {
|
|
30
|
+
watch: e.fn(),
|
|
31
|
+
array: e.fn(),
|
|
32
|
+
state: e.fn()
|
|
33
|
+
},
|
|
34
|
+
_getWatch: e.fn(),
|
|
35
|
+
_formValues: ["test"],
|
|
36
|
+
_defaultValues: ["test"]
|
|
37
|
+
},
|
|
38
|
+
formState: { errors: {} },
|
|
39
|
+
watch: () => "2024-08-07"
|
|
40
|
+
})
|
|
41
|
+
}));
|
|
42
|
+
f("FormToggle Test", () => {
|
|
43
|
+
c("render FormToggle", () => {
|
|
44
|
+
n(/* @__PURE__ */ s(l, { propertyName: "hasValue", label: "user.hasValue" })), r(t.getByText("user.hasValue")).toBeInTheDocument(), r(t.getByText("error")).toBeInTheDocument(), r(t.getByRole("switch")).toBeInTheDocument();
|
|
45
|
+
}), c("render FormToggle click", () => {
|
|
46
|
+
n(/* @__PURE__ */ s(l, { propertyName: "hasValue", label: "user.hasValue", onChange: a }));
|
|
47
|
+
const o = t.getByRole("switch");
|
|
48
|
+
m.click(o), r(a).toHaveBeenCalled();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { N as i } from "../../react-number-format.es-
|
|
2
|
+
import { N as i } from "../../react-number-format.es-BD3_OvMU.js";
|
|
3
3
|
import { useDecimalSeparator as d, useThousandSeparator as n } from "../../services/NumberService.js";
|
|
4
4
|
const y = ({
|
|
5
5
|
typographyComponent: a,
|
|
@@ -1,124 +1,107 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import "../../
|
|
7
|
-
import "../../
|
|
8
|
-
import "../../
|
|
9
|
-
import "../../
|
|
10
|
-
import "../../overflowTooltip.module-YyRN2MGc.js";
|
|
11
|
-
import "../../basicHeading.module-BYb8xvuk.js";
|
|
12
|
-
import "../../_baseToString-dkhmFwqS.js";
|
|
13
|
-
import "../../_equalByTag-BZEJl6ST.js";
|
|
14
|
-
import "../../searchBar.module-9gKyrZRT.js";
|
|
15
|
-
import "../../listArea.module-BhO_OJ1S.js";
|
|
16
|
-
import "../../verticalDivider.module-C3_GL-fH.js";
|
|
17
|
-
import "../../baseView.module-uWbm_a5f.js";
|
|
18
|
-
import "../../BlockView.module-BPlNT5uh.js";
|
|
19
|
-
import "../../chipCard.module-BjpKuf1b.js";
|
|
1
|
+
import "../../assets/GenericTable.css";
|
|
2
|
+
import { jsx as e, jsxs as B } from "react/jsx-runtime";
|
|
3
|
+
import { Elevation as N, Table as D, Group as l, TypoSubtitle as G, TableTopBar as u, Padding as W, TypoDisplay as $ } from "@element/react-components";
|
|
4
|
+
import { Fragment as k } from "react";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { u as C } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
7
|
+
import "../../isEmpty-BimaZd5G.js";
|
|
8
|
+
import "../../react-tooltip.min-c2wVkjF2.js";
|
|
9
|
+
import "../../orderBy-BVQIswlJ.js";
|
|
20
10
|
import "lodash";
|
|
21
|
-
import "../../contextMenu.module-vNQHb48g.js";
|
|
22
|
-
import "../../modal.module-BlDp1Wiq.js";
|
|
23
|
-
import "../../deleteModal.module-Ds3MDzdl.js";
|
|
24
|
-
import "../../disclaimer.module-BZydt-Q_.js";
|
|
25
|
-
import "../../HashTabView.module-ZhwSfDeQ.js";
|
|
26
|
-
import "../../HeaderFilter.module-DiBmulr5.js";
|
|
27
|
-
import "../../healthCheckFailed.module-B5P1ogjs.js";
|
|
28
|
-
import "../../infoGroup.module-Cxw88dfC.js";
|
|
29
|
-
import "../../bigLoadingSpinner.module-GgbFol8k.js";
|
|
30
|
-
import "../../loadingSpinner.module-CLtqSMWA.js";
|
|
31
|
-
import "../Scrollbar/Scrollbar.js";
|
|
32
11
|
import "react-hook-form";
|
|
33
|
-
import "../../
|
|
34
|
-
import "../../
|
|
35
|
-
import "../../
|
|
36
|
-
import "
|
|
37
|
-
import "../../isPlainObject-BlCDf1Kc.js";
|
|
38
|
-
import { useGenerateColumns as x, useGenerateTableData as _ } from "./GenericTableService.js";
|
|
12
|
+
import "../../get-BiqanC9_.js";
|
|
13
|
+
import "../../isArray-C_5XvIlE.js";
|
|
14
|
+
import "../../isString-BOHPtrlm.js";
|
|
15
|
+
import { useGenerateColumns as j, useGenerateTableData as x } from "./GenericTableService.js";
|
|
39
16
|
import { GenericCardList as A } from "./Mobile/GenericCardList.js";
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
17
|
+
const E = "_topBar_1msoo_1", F = "_filterBar_1msoo_5", I = "_emptyTable_1msoo_9", L = "_elevation_1msoo_17", M = "_table_1msoo_22", t = {
|
|
18
|
+
topBar: E,
|
|
19
|
+
filterBar: F,
|
|
20
|
+
emptyTable: I,
|
|
21
|
+
elevation: L,
|
|
22
|
+
table: M
|
|
23
|
+
}, ee = ({
|
|
24
|
+
data: i = [],
|
|
25
|
+
hiddenColumns: s = [],
|
|
43
26
|
order: f = [],
|
|
44
|
-
cellTemplates:
|
|
45
|
-
tableActions:
|
|
46
|
-
noContentText:
|
|
47
|
-
headerTranslation:
|
|
48
|
-
pagination:
|
|
49
|
-
getRowActions:
|
|
50
|
-
customColumnWidth:
|
|
51
|
-
title:
|
|
52
|
-
cardTitleColumn:
|
|
53
|
-
cardSubTitleColumn:
|
|
27
|
+
cellTemplates: b = void 0,
|
|
28
|
+
tableActions: r = [],
|
|
29
|
+
noContentText: m = "No data available",
|
|
30
|
+
headerTranslation: _ = (o) => o,
|
|
31
|
+
pagination: g = !1,
|
|
32
|
+
getRowActions: c = void 0,
|
|
33
|
+
customColumnWidth: y,
|
|
34
|
+
title: a,
|
|
35
|
+
cardTitleColumn: h,
|
|
36
|
+
cardSubTitleColumn: v
|
|
54
37
|
}) => {
|
|
55
|
-
const { isDesktop:
|
|
56
|
-
data:
|
|
38
|
+
const { isDesktop: o } = C(), n = j({
|
|
39
|
+
data: i,
|
|
57
40
|
order: f,
|
|
58
|
-
cellTemplates:
|
|
59
|
-
headerTranslation:
|
|
60
|
-
getRowActions:
|
|
61
|
-
customColumnWidth:
|
|
62
|
-
cardTitleColumn:
|
|
63
|
-
cardSubTitleColumn:
|
|
64
|
-
}), d =
|
|
65
|
-
data:
|
|
66
|
-
getRowActions:
|
|
41
|
+
cellTemplates: b,
|
|
42
|
+
headerTranslation: _,
|
|
43
|
+
getRowActions: c,
|
|
44
|
+
customColumnWidth: y,
|
|
45
|
+
cardTitleColumn: h,
|
|
46
|
+
cardSubTitleColumn: v
|
|
47
|
+
}), d = x({
|
|
48
|
+
data: i,
|
|
49
|
+
getRowActions: c
|
|
67
50
|
});
|
|
68
|
-
return
|
|
69
|
-
|
|
51
|
+
return o ? /* @__PURE__ */ e(N, { elevation: 1, className: t.elevation, "data-testid": "generic-table-elevation", children: /* @__PURE__ */ e(
|
|
52
|
+
D,
|
|
70
53
|
{
|
|
71
|
-
"data-testid": `generic-table${
|
|
54
|
+
"data-testid": `generic-table${a ? "-" + a : ""}`,
|
|
72
55
|
className: t.table,
|
|
73
56
|
fullWidth: !0,
|
|
74
57
|
alwaysUseDivTags: !0,
|
|
75
58
|
layout: "standard",
|
|
76
|
-
hiddenColumns:
|
|
59
|
+
hiddenColumns: s,
|
|
77
60
|
data: d,
|
|
78
|
-
columns:
|
|
79
|
-
leadingContent:
|
|
61
|
+
columns: n,
|
|
62
|
+
leadingContent: a && r?.length === 0 ? /* @__PURE__ */ e(u, { title: a }) : r?.length > 0 && /* @__PURE__ */ e(
|
|
80
63
|
u,
|
|
81
64
|
{
|
|
82
65
|
className: t.topBar,
|
|
83
|
-
filterBar: /* @__PURE__ */ B(
|
|
84
|
-
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
|
|
66
|
+
filterBar: /* @__PURE__ */ B(l, { fullWidth: !0, direction: "vertical", gap: "none", children: [
|
|
67
|
+
a && /* @__PURE__ */ e(W, { children: /* @__PURE__ */ e($, { level: 6, children: a }) }),
|
|
68
|
+
/* @__PURE__ */ e(
|
|
69
|
+
l,
|
|
87
70
|
{
|
|
88
71
|
className: t.filterBar,
|
|
89
72
|
fullWidth: !0,
|
|
90
73
|
primaryAlign: "end",
|
|
91
74
|
secondaryAlign: "center",
|
|
92
|
-
children:
|
|
75
|
+
children: r.map((p, T) => /* @__PURE__ */ e(k, { children: p }, `action_${T}_${p.key}`))
|
|
93
76
|
}
|
|
94
77
|
)
|
|
95
78
|
] })
|
|
96
79
|
}
|
|
97
80
|
),
|
|
98
|
-
paginated:
|
|
81
|
+
paginated: g,
|
|
99
82
|
sortable: !0,
|
|
100
|
-
noContentIncludeTable: !!
|
|
101
|
-
noContentMessage: /* @__PURE__ */
|
|
102
|
-
|
|
83
|
+
noContentIncludeTable: !!n,
|
|
84
|
+
noContentMessage: /* @__PURE__ */ e(
|
|
85
|
+
l,
|
|
103
86
|
{
|
|
104
87
|
fullWidth: !0,
|
|
105
88
|
primaryAlign: "center",
|
|
106
89
|
secondaryAlign: "center",
|
|
107
90
|
className: t.emptyTable,
|
|
108
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ e(G, { children: m })
|
|
109
92
|
}
|
|
110
93
|
)
|
|
111
94
|
}
|
|
112
|
-
) }) : /* @__PURE__ */
|
|
95
|
+
) }) : /* @__PURE__ */ e("div", { "data-testid": `generic-card-list${a ? "-" + a : ""}`, children: /* @__PURE__ */ e(
|
|
113
96
|
A,
|
|
114
97
|
{
|
|
115
98
|
data: d,
|
|
116
|
-
columns:
|
|
117
|
-
hiddenColumns:
|
|
118
|
-
noContentText:
|
|
99
|
+
columns: n,
|
|
100
|
+
hiddenColumns: s,
|
|
101
|
+
noContentText: m
|
|
119
102
|
}
|
|
120
103
|
) });
|
|
121
104
|
};
|
|
122
105
|
export {
|
|
123
|
-
|
|
106
|
+
ee as GenericTable
|
|
124
107
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as a, jsxs as B } from "react/jsx-runtime";
|
|
2
|
-
import { a as o, s as e } from "../../react.esm-
|
|
2
|
+
import { a as o, s as e } from "../../react.esm-FR1-H8iU.js";
|
|
3
3
|
import { a as m } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
4
4
|
import { GenericTable as s } from "./GenericTable.js";
|
|
5
|
-
import { d as h, v as r, t as i, g as t } from "../../vi.
|
|
5
|
+
import { d as h, v as r, t as i, g as t } from "../../vi.CjhMlMwf-DWv7vrn7.js";
|
|
6
6
|
h("GenericTable Test", () => {
|
|
7
7
|
r.spyOn(m, "useBreakpoints").mockReturnValue({
|
|
8
8
|
isDesktop: !0,
|