@hortiview/shared-components 2.28.3 → 2.29.0-alpha.df46fcc5.1
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 +807 -0
- package/README.md +1387 -0
- package/components/AllowedButton/AllowedButton.d.ts +1 -1
- package/components/AllowedButton/AllowedButton.js +24 -21
- package/components/AllowedIconButton/AllowedIconButton.d.ts +1 -1
- package/components/AllowedIconButton/AllowedIconButton.js +20 -17
- package/components/ContextMenu/ContextMenu.d.ts +3 -11
- package/components/ContextMenu/ContextMenu.js +87 -97
- package/components/FormComponents/FormNumber/CustomTextField.js +1 -1
- package/components/FormComponents/FormText/FormText.js +101 -109
- package/components/GenericTable/GenericTableService.js +22 -22
- package/main.d.ts +0 -1
- package/main.js +33 -35
- package/package.json +1 -1
- package/types/Permission.d.ts +1 -147
- package/types/Permission.js +1 -4
- package/components/ContextMenu/ContextMenuService.d.ts +0 -8
- package/components/ContextMenu/ContextMenuService.js +0 -19
- package/components/PermissionChecks/mockedPermissions.d.ts +0 -24
- package/components/PermissionChecks/mockedPermissions.js +0 -299
|
@@ -47,4 +47,4 @@ export type AllowedButtonProps = Omit<ButtonProps & React.HTMLProps<HTMLButtonEl
|
|
|
47
47
|
* @param {AllowedButtonProps} props - Component properties
|
|
48
48
|
* @returns {JSX.Element | null} The button component or null if permissions are not met
|
|
49
49
|
*/
|
|
50
|
-
export declare const AllowedButton: ({ buttonType, variant, "data-testid": testId, label, size, isLoading, ...props }: AllowedButtonProps) => import("react").JSX.Element;
|
|
50
|
+
export declare const AllowedButton: ({ buttonType, variant, "data-testid": testId, label, size, isLoading, formId, permissions, entityIds, ...props }: AllowedButtonProps) => import("react").JSX.Element;
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { B as
|
|
3
|
-
import { Allowed as
|
|
4
|
-
import { LoadingSpinner as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { B as u } from "../../index.es-B9C7vzr4.js";
|
|
3
|
+
import { Allowed as f } from "../Allowed/Allowed.js";
|
|
4
|
+
import { LoadingSpinner as p } from "../LoadingSpinner/Default/LoadingSpinner.js";
|
|
5
|
+
const h = ({
|
|
6
6
|
buttonType: d = "button",
|
|
7
|
-
variant:
|
|
8
|
-
"data-testid":
|
|
9
|
-
label:
|
|
10
|
-
size:
|
|
11
|
-
isLoading:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
variant: i = "filled",
|
|
8
|
+
"data-testid": r,
|
|
9
|
+
label: n,
|
|
10
|
+
size: l = "medium",
|
|
11
|
+
isLoading: e = !1,
|
|
12
|
+
formId: m,
|
|
13
|
+
permissions: s,
|
|
14
|
+
entityIds: a,
|
|
15
|
+
...o
|
|
16
|
+
}) => /* @__PURE__ */ t(f, { neededPermissions: s, entityIds: a, children: /* @__PURE__ */ t(
|
|
17
|
+
u,
|
|
15
18
|
{
|
|
16
|
-
...
|
|
17
|
-
buttonSize:
|
|
18
|
-
"data-testid": `allowed-button-${
|
|
19
|
-
disabled:
|
|
20
|
-
form:
|
|
19
|
+
...o,
|
|
20
|
+
buttonSize: l,
|
|
21
|
+
"data-testid": `allowed-button-${r}`,
|
|
22
|
+
disabled: o.disabled || e,
|
|
23
|
+
form: m,
|
|
21
24
|
type: d,
|
|
22
|
-
variant:
|
|
23
|
-
children:
|
|
25
|
+
variant: i,
|
|
26
|
+
children: e ? /* @__PURE__ */ t(p, { size: "sm", spinnerOnly: !0 }) : n
|
|
24
27
|
}
|
|
25
28
|
) });
|
|
26
29
|
export {
|
|
27
|
-
|
|
30
|
+
h as AllowedButton
|
|
28
31
|
};
|
|
@@ -39,4 +39,4 @@ export type AllowedIconButtonProps = Omit<IconButtonProps & React.HTMLProps<HTML
|
|
|
39
39
|
* @param {AllowedIconButtonProps} props - Component properties
|
|
40
40
|
* @returns {JSX.Element | null} The icon button component or null if permissions are not met
|
|
41
41
|
*/
|
|
42
|
-
export declare const AllowedIconButton: ({ "data-testid": testId, variant, iconType, size, ...props }: AllowedIconButtonProps) => import("react").JSX.Element;
|
|
42
|
+
export declare const AllowedIconButton: ({ "data-testid": testId, variant, iconType, size, formId, permissions, entityIds, ...props }: AllowedIconButtonProps) => import("react").JSX.Element;
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { I as
|
|
3
|
-
import { Allowed as
|
|
4
|
-
const
|
|
5
|
-
"data-testid":
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { I as s } from "../../index.es-BwhRJBEH.js";
|
|
3
|
+
import { Allowed as a } from "../Allowed/Allowed.js";
|
|
4
|
+
const u = ({
|
|
5
|
+
"data-testid": t,
|
|
6
6
|
variant: e = "filled-primary",
|
|
7
|
-
iconType:
|
|
8
|
-
size:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
m,
|
|
7
|
+
iconType: i = "filled",
|
|
8
|
+
size: d = "medium",
|
|
9
|
+
formId: r,
|
|
10
|
+
permissions: l,
|
|
11
|
+
entityIds: m,
|
|
12
|
+
...n
|
|
13
|
+
}) => /* @__PURE__ */ o(a, { neededPermissions: l, entityIds: m, children: /* @__PURE__ */ o(
|
|
14
|
+
s,
|
|
12
15
|
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
...n,
|
|
17
|
+
"data-testid": `allowed-icon-button-${t}`,
|
|
18
|
+
form: r,
|
|
19
|
+
iconSize: d,
|
|
20
|
+
iconType: i,
|
|
21
|
+
variant: e
|
|
19
22
|
}
|
|
20
23
|
) });
|
|
21
24
|
export {
|
|
22
|
-
|
|
25
|
+
u as AllowedIconButton
|
|
23
26
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ListItemProps } from '@element-public/react-list';
|
|
2
|
-
import { MenuProps } from '@element-public/react-menu';
|
|
3
2
|
import { OfflineViewProps } from '../OfflineView/OfflineView';
|
|
4
3
|
import { IsAllowedProps } from '../PermissionChecks/PermissionService.tsx';
|
|
5
|
-
type ContextMenuProps =
|
|
4
|
+
type ContextMenuProps = {
|
|
6
5
|
/**
|
|
7
6
|
* If not null, the menu will be open
|
|
8
7
|
*/
|
|
@@ -26,10 +25,6 @@ type ContextMenuProps = MenuProps & {
|
|
|
26
25
|
* Props forwarded to <OfflineView /> when offline.
|
|
27
26
|
*/
|
|
28
27
|
offlineViewProps?: Partial<OfflineViewProps>;
|
|
29
|
-
/**
|
|
30
|
-
* Optional className to apply to the menu container
|
|
31
|
-
*/
|
|
32
|
-
className?: string;
|
|
33
28
|
};
|
|
34
29
|
export type ActionProps = ListItemProps & {
|
|
35
30
|
closeOnClick?: boolean;
|
|
@@ -59,8 +54,7 @@ export type ActionProps = ListItemProps & {
|
|
|
59
54
|
*
|
|
60
55
|
* @param {boolean} triggerOpen indicates if the menu should be open
|
|
61
56
|
* @param {ListItemProps[]} actions list of actions to display in the context menu as ListItems
|
|
62
|
-
* @param
|
|
63
|
-
* @param {string} data-testid id for testing, automatically prefixed
|
|
57
|
+
* @param testId id for testing, automatically prefixed
|
|
64
58
|
* @recommended `primaryText`, `onClick`, `leadingBlock`
|
|
65
59
|
* @requires `ListItemProps` from `@element-public/react-components`
|
|
66
60
|
* @example const actions = [
|
|
@@ -70,9 +64,7 @@ export type ActionProps = ListItemProps & {
|
|
|
70
64
|
* ];
|
|
71
65
|
* @param {boolean} isOnline Whether the user is online; shows OfflineView when false.
|
|
72
66
|
* @param {OfflineViewProps} offlineViewProps Props forwarded to OfflineView when offline.
|
|
73
|
-
* @param {string} className Optional className to apply to the menu container
|
|
74
|
-
* @param {MenuProps} menuProps Element Menu props, e.g. `hoistToBody`, `themeColor`, etc.
|
|
75
67
|
* @returns a context menu with the given actions as ListItems
|
|
76
68
|
*/
|
|
77
|
-
export declare const ContextMenu: ({ triggerOpen, actions, iconOrientation, "data-testid": dataTestId, isOnline, offlineViewProps,
|
|
69
|
+
export declare const ContextMenu: ({ triggerOpen, actions, iconOrientation, "data-testid": dataTestId, isOnline, offlineViewProps, }: ContextMenuProps) => import("react").JSX.Element | null;
|
|
78
70
|
export {};
|
|
@@ -1,130 +1,120 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { I as
|
|
3
|
-
import { M as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
offlineViewProps: y,
|
|
26
|
-
className: g,
|
|
27
|
-
...s
|
|
1
|
+
import { jsx as i, jsxs as M } from "react/jsx-runtime";
|
|
2
|
+
import { I as k } from "../../index.es-BwhRJBEH.js";
|
|
3
|
+
import { M as v, L as w, a as x, b as C } from "../../index.es-BIgjyLDa.js";
|
|
4
|
+
import { useState as g, useCallback as T, useEffect as I, useMemo as b, Fragment as A, useRef as L, useLayoutEffect as B } from "react";
|
|
5
|
+
import { c as V } from "../../index-_-9ybP20.js";
|
|
6
|
+
import { u as z } from "../../uniqueId-CJo-XRQb.js";
|
|
7
|
+
import { OfflineView as H } from "../OfflineView/OfflineView.js";
|
|
8
|
+
import { useIsAllowed as N } from "../PermissionChecks/PermissionService.js";
|
|
9
|
+
import { u as O } from "../../useBreakpoints-DDrM9Cfx.js";
|
|
10
|
+
import '../../assets/ContextMenu.css';const E = "_menu_52omh_1", R = "_mobile_52omh_7", S = "_desktop_52omh_11", $ = "_icon_52omh_15", j = "_listItem_52omh_19", q = "_offlineViewMargin_52omh_51", D = "_primaryTextTruncated_52omh_55", n = {
|
|
11
|
+
menu: E,
|
|
12
|
+
mobile: R,
|
|
13
|
+
desktop: S,
|
|
14
|
+
icon: $,
|
|
15
|
+
listItem: j,
|
|
16
|
+
offlineViewMargin: q,
|
|
17
|
+
primaryTextTruncated: D
|
|
18
|
+
}, P = ({
|
|
19
|
+
triggerOpen: t = null,
|
|
20
|
+
actions: l,
|
|
21
|
+
iconOrientation: a = "vertical",
|
|
22
|
+
"data-testid": c,
|
|
23
|
+
isOnline: m = !0,
|
|
24
|
+
offlineViewProps: f
|
|
28
25
|
}) => {
|
|
29
|
-
const { isMobile:
|
|
30
|
-
|
|
31
|
-
}, []),
|
|
32
|
-
|
|
26
|
+
const { isMobile: d } = O(), [u, o] = g(!1), _ = N(), p = T(() => {
|
|
27
|
+
o(!1);
|
|
28
|
+
}, []), h = T(() => {
|
|
29
|
+
o((e) => !e);
|
|
33
30
|
}, []);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
return window.addEventListener("scroll", e, !0), () => window.removeEventListener("scroll", e, !0);
|
|
42
|
-
}, [l, i, s.hoistToBody]);
|
|
43
|
-
const b = C(o.menu, g), v = N(() => u.filter((e) => e.isHidden || e.isAllowed === !1 ? !1 : !(e.permissionConfiguration && !r(e.permissionConfiguration))), [u, r]);
|
|
44
|
-
return v.length === 0 ? null : /* @__PURE__ */ t("div", { ref: _, children: /* @__PURE__ */ t(
|
|
45
|
-
B,
|
|
31
|
+
I(() => {
|
|
32
|
+
o(t !== null ? t : !1);
|
|
33
|
+
}, [t]);
|
|
34
|
+
const r = b(() => l.filter((e) => e.isHidden || e.isAllowed === !1 ? !1 : !(e.permissionConfiguration && !_(e.permissionConfiguration))), [l, _]);
|
|
35
|
+
return r.length === 0 ? null : /* @__PURE__ */ i(
|
|
36
|
+
v,
|
|
46
37
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
open: l,
|
|
38
|
+
className: n.menu,
|
|
39
|
+
"data-testid": c ?? "contextMenu-undefined",
|
|
40
|
+
open: u,
|
|
51
41
|
surfaceOnly: !0,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
hoistToBody: !0,
|
|
43
|
+
onClose: p,
|
|
44
|
+
trigger: /* @__PURE__ */ i(
|
|
45
|
+
k,
|
|
55
46
|
{
|
|
56
|
-
className:
|
|
57
|
-
variant:
|
|
47
|
+
className: n.icon,
|
|
48
|
+
variant: u ? "filled-primary" : void 0,
|
|
58
49
|
"data-testid": "open-button",
|
|
59
|
-
icon:
|
|
60
|
-
onClick:
|
|
50
|
+
icon: a === "vertical" ? "more_vert" : "more_horiz",
|
|
51
|
+
onClick: h
|
|
61
52
|
}
|
|
62
53
|
),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
U,
|
|
54
|
+
children: m ? /* @__PURE__ */ i(w, { "data-testid": "selection-list", children: r.map((e, s) => /* @__PURE__ */ M(A, { children: [
|
|
55
|
+
e.dividerBefore && s !== 0 && /* @__PURE__ */ i(x, {}),
|
|
56
|
+
/* @__PURE__ */ i(
|
|
57
|
+
F,
|
|
68
58
|
{
|
|
69
59
|
actionProps: e,
|
|
70
|
-
index:
|
|
71
|
-
isMobile:
|
|
72
|
-
closeMenu:
|
|
60
|
+
index: s,
|
|
61
|
+
isMobile: d,
|
|
62
|
+
closeMenu: p
|
|
73
63
|
}
|
|
74
64
|
),
|
|
75
|
-
e.dividerAfter &&
|
|
76
|
-
] },
|
|
77
|
-
|
|
65
|
+
e.dividerAfter && s !== r.length - 1 && /* @__PURE__ */ i(x, {})
|
|
66
|
+
] }, z(`LI_${e.primaryText?.toString()}_`))) }) : /* @__PURE__ */ i(
|
|
67
|
+
H,
|
|
78
68
|
{
|
|
79
69
|
size: "small",
|
|
80
70
|
variant: "filled",
|
|
81
|
-
className:
|
|
82
|
-
...
|
|
71
|
+
className: n.offlineViewMargin,
|
|
72
|
+
...f
|
|
83
73
|
}
|
|
84
74
|
)
|
|
85
75
|
},
|
|
86
|
-
`contextMenu-${
|
|
87
|
-
)
|
|
88
|
-
},
|
|
89
|
-
actionProps:
|
|
90
|
-
index:
|
|
91
|
-
isMobile:
|
|
92
|
-
closeMenu:
|
|
76
|
+
`contextMenu-${c ?? "undefined"}`
|
|
77
|
+
);
|
|
78
|
+
}, F = ({
|
|
79
|
+
actionProps: t,
|
|
80
|
+
index: l,
|
|
81
|
+
isMobile: a,
|
|
82
|
+
closeMenu: c
|
|
93
83
|
}) => {
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
const
|
|
97
|
-
if (!
|
|
98
|
-
const
|
|
84
|
+
const m = L(null), [f, d] = g(!1), { closeOnClick: u, permissionConfiguration: o, isAllowed: _, isHidden: p, ...h } = t;
|
|
85
|
+
return B(() => {
|
|
86
|
+
const r = m.current;
|
|
87
|
+
if (!r) return;
|
|
88
|
+
const e = r.querySelector(
|
|
99
89
|
"[class*='mdc-list-item__primary-text']"
|
|
100
90
|
);
|
|
101
|
-
if (!
|
|
102
|
-
const
|
|
103
|
-
|
|
91
|
+
if (!e) return;
|
|
92
|
+
const s = () => {
|
|
93
|
+
d(e.scrollHeight > e.clientHeight);
|
|
104
94
|
};
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
return
|
|
108
|
-
|
|
95
|
+
s();
|
|
96
|
+
const y = new ResizeObserver(s);
|
|
97
|
+
return y.observe(e), () => {
|
|
98
|
+
y.disconnect();
|
|
109
99
|
};
|
|
110
|
-
}, [
|
|
111
|
-
|
|
100
|
+
}, [t.primaryText, a]), /* @__PURE__ */ i(
|
|
101
|
+
C,
|
|
112
102
|
{
|
|
113
|
-
ref:
|
|
114
|
-
"data-testid":
|
|
115
|
-
className:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
103
|
+
ref: m,
|
|
104
|
+
"data-testid": t["data-testid"] ?? `contextMenu-action-${l}`,
|
|
105
|
+
className: V(
|
|
106
|
+
n.listItem,
|
|
107
|
+
f && n.primaryTextTruncated,
|
|
108
|
+
a ? n.mobile : n.desktop
|
|
119
109
|
),
|
|
120
|
-
...
|
|
110
|
+
...h,
|
|
121
111
|
leadingBlockType: "icon",
|
|
122
112
|
onClick: () => {
|
|
123
|
-
|
|
113
|
+
t?.onClick?.(), u !== !1 && c();
|
|
124
114
|
}
|
|
125
115
|
}
|
|
126
116
|
);
|
|
127
117
|
};
|
|
128
118
|
export {
|
|
129
|
-
|
|
119
|
+
P as ContextMenu
|
|
130
120
|
};
|
|
@@ -14,7 +14,7 @@ import '../../../assets/CustomTextField.css';const c = "_invalid_142hx_1", h = "
|
|
|
14
14
|
trigger: i,
|
|
15
15
|
watch: l
|
|
16
16
|
} = s(), a = l(e.propertyName), d = v(() => {
|
|
17
|
-
if (!(a
|
|
17
|
+
if (!(!a || e.value === null))
|
|
18
18
|
return e.value;
|
|
19
19
|
}, [a, e.value]);
|
|
20
20
|
return /* @__PURE__ */ m(
|
|
@@ -1,131 +1,123 @@
|
|
|
1
|
-
import { jsx as t, Fragment as
|
|
2
|
-
import { T as
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import { useFormContext as
|
|
6
|
-
import { useHelperText as
|
|
7
|
-
import '../../../assets/FormText.css';const
|
|
8
|
-
formTextAreaHelperText:
|
|
9
|
-
invalid:
|
|
10
|
-
required:
|
|
11
|
-
formTextArea:
|
|
12
|
-
characterCount:
|
|
13
|
-
withoutCharacterCount:
|
|
14
|
-
formText:
|
|
15
|
-
},
|
|
1
|
+
import { jsx as t, Fragment as g, jsxs as R } from "react/jsx-runtime";
|
|
2
|
+
import { T as k } from "../../../index.es-CJIPOFSz.js";
|
|
3
|
+
import { a as z } from "../../../index.es-CdZp67J9.js";
|
|
4
|
+
import { useMemo as u } from "react";
|
|
5
|
+
import { useFormContext as M, Controller as C } from "react-hook-form";
|
|
6
|
+
import { useHelperText as P } from "../../../hooks/useHelperText.js";
|
|
7
|
+
import '../../../assets/FormText.css';const V = "_formTextAreaHelperText_x4g1e_1", W = "_invalid_x4g1e_7", b = "_required_x4g1e_11", D = "_formTextArea_x4g1e_1", E = "_characterCount_x4g1e_25", G = "_withoutCharacterCount_x4g1e_31", I = "_formText_x4g1e_1", r = {
|
|
8
|
+
formTextAreaHelperText: V,
|
|
9
|
+
invalid: W,
|
|
10
|
+
required: b,
|
|
11
|
+
formTextArea: D,
|
|
12
|
+
characterCount: E,
|
|
13
|
+
withoutCharacterCount: G,
|
|
14
|
+
formText: I
|
|
15
|
+
}, J = ({
|
|
16
16
|
count: e,
|
|
17
|
-
maxCount:
|
|
18
|
-
invalid:
|
|
19
|
-
hasRequiredText:
|
|
17
|
+
maxCount: c,
|
|
18
|
+
invalid: x = !1,
|
|
19
|
+
hasRequiredText: o = !1
|
|
20
20
|
}) => /* @__PURE__ */ t(
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
23
23
|
"data-testid": "character-counter-container",
|
|
24
|
-
className: `${r.formTextAreaHelperText} ${
|
|
25
|
-
children: /* @__PURE__ */ t(
|
|
24
|
+
className: `${r.formTextAreaHelperText} ${x ? r.invalid : ""} ${o ? r.required : ""}`,
|
|
25
|
+
children: /* @__PURE__ */ t(z, { children: `${e}/${c}` })
|
|
26
26
|
}
|
|
27
|
-
),
|
|
27
|
+
), p = (e) => e.textarea ? /* @__PURE__ */ t(K, { ...e }) : /* @__PURE__ */ t(O, { ...e }), K = (e) => /* @__PURE__ */ t("div", { "data-testid": "form-text-area", className: r.formTextArea, children: /* @__PURE__ */ t(_, { ...e }) }), O = (e) => /* @__PURE__ */ t(
|
|
28
28
|
"div",
|
|
29
29
|
{
|
|
30
30
|
"data-testid": "form-text-field",
|
|
31
31
|
className: `${e.hasCharacterCount ? r.characterCount : r.withoutCharacterCount}`,
|
|
32
|
-
children: /* @__PURE__ */ t(
|
|
32
|
+
children: /* @__PURE__ */ t(_, { ...e })
|
|
33
33
|
}
|
|
34
|
-
),
|
|
34
|
+
), _ = ({
|
|
35
35
|
propertyName: e,
|
|
36
|
-
label:
|
|
37
|
-
disabled:
|
|
38
|
-
textarea:
|
|
39
|
-
hasCharacterCount:
|
|
40
|
-
hidden:
|
|
41
|
-
placeholder:
|
|
42
|
-
type:
|
|
43
|
-
prefixText:
|
|
44
|
-
inputMode:
|
|
45
|
-
trailingIcon:
|
|
46
|
-
trigger:
|
|
47
|
-
rules:
|
|
48
|
-
...
|
|
36
|
+
label: c,
|
|
37
|
+
disabled: x = !1,
|
|
38
|
+
textarea: o = !1,
|
|
39
|
+
hasCharacterCount: d = !1,
|
|
40
|
+
hidden: v = !1,
|
|
41
|
+
placeholder: A,
|
|
42
|
+
type: $,
|
|
43
|
+
prefixText: F,
|
|
44
|
+
inputMode: q,
|
|
45
|
+
trailingIcon: H,
|
|
46
|
+
trigger: s = "likeForm",
|
|
47
|
+
rules: n,
|
|
48
|
+
...a
|
|
49
49
|
}) => {
|
|
50
|
-
const { control:
|
|
51
|
-
(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
[i, n]
|
|
61
|
-
), l = d(
|
|
62
|
-
() => o.maxlength ? o.maxlength : a?.maxLength?.value,
|
|
63
|
-
[a, o.maxlength]
|
|
64
|
-
), j = d(
|
|
65
|
-
() => a?.minLength?.value,
|
|
66
|
-
[a]
|
|
67
|
-
), C = d(
|
|
68
|
-
() => a?.required?.message,
|
|
69
|
-
[a]
|
|
70
|
-
), { helperText: k, helperTextPersistent: R } = E({
|
|
50
|
+
const { control: h, getFieldState: m, trigger: f } = M(), i = u(
|
|
51
|
+
() => a.maxlength ? a.maxlength : n?.maxLength?.value,
|
|
52
|
+
[n, a.maxlength]
|
|
53
|
+
), L = u(
|
|
54
|
+
() => n?.minLength?.value,
|
|
55
|
+
[n]
|
|
56
|
+
), T = u(
|
|
57
|
+
() => n?.required?.message,
|
|
58
|
+
[n]
|
|
59
|
+
), { helperText: w, helperTextPersistent: B } = P({
|
|
71
60
|
propertyName: e,
|
|
72
|
-
helperText:
|
|
73
|
-
requiredText:
|
|
74
|
-
maxLength:
|
|
75
|
-
hasCharacterCount:
|
|
61
|
+
helperText: a.helperText,
|
|
62
|
+
requiredText: T,
|
|
63
|
+
maxLength: i,
|
|
64
|
+
hasCharacterCount: o || d
|
|
76
65
|
});
|
|
77
|
-
return
|
|
78
|
-
|
|
66
|
+
return v ? /* @__PURE__ */ t(C, { name: e, control: h, render: () => /* @__PURE__ */ t(g, {}) }) : /* @__PURE__ */ t(
|
|
67
|
+
C,
|
|
79
68
|
{
|
|
80
69
|
name: e,
|
|
81
|
-
rules:
|
|
82
|
-
control:
|
|
83
|
-
render: ({ field: { ref:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
70
|
+
rules: n,
|
|
71
|
+
control: h,
|
|
72
|
+
render: ({ field: { ref: Q, ...l } }) => {
|
|
73
|
+
const S = String(l.value ?? "").length;
|
|
74
|
+
return /* @__PURE__ */ R(g, { children: [
|
|
75
|
+
/* @__PURE__ */ t(
|
|
76
|
+
k,
|
|
77
|
+
{
|
|
78
|
+
...a,
|
|
79
|
+
...l,
|
|
80
|
+
value: l.value ?? "",
|
|
81
|
+
type: $,
|
|
82
|
+
fullWidth: !0,
|
|
83
|
+
"data-testid": `textfield-${e}`,
|
|
84
|
+
inputMode: q,
|
|
85
|
+
placeholder: A,
|
|
86
|
+
prefixText: F,
|
|
87
|
+
disabled: x,
|
|
88
|
+
helperText: w,
|
|
89
|
+
helperTextPersistent: B,
|
|
90
|
+
label: c,
|
|
91
|
+
variant: "outlined",
|
|
92
|
+
maxlength: i,
|
|
93
|
+
minLength: L,
|
|
94
|
+
textarea: o,
|
|
95
|
+
noResize: !1,
|
|
96
|
+
onBlur: () => {
|
|
97
|
+
s === "onBlur" && f(e), a.onBlur?.();
|
|
98
|
+
},
|
|
99
|
+
onChange: (j) => {
|
|
100
|
+
l.onChange(j), s === "onChange" && f(e);
|
|
101
|
+
},
|
|
102
|
+
valid: !m(e).invalid,
|
|
103
|
+
className: `${r.formText} ${m(e).invalid ? r.invalid : ""}`,
|
|
104
|
+
trailingIcon: H
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
i !== void 0 && (d || o) && /* @__PURE__ */ t(
|
|
108
|
+
J,
|
|
109
|
+
{
|
|
110
|
+
count: S,
|
|
111
|
+
maxCount: i,
|
|
112
|
+
invalid: m(e).invalid,
|
|
113
|
+
hasRequiredText: !!a.helperText || !!T
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] });
|
|
117
|
+
}
|
|
126
118
|
}
|
|
127
119
|
);
|
|
128
120
|
};
|
|
129
121
|
export {
|
|
130
|
-
|
|
122
|
+
p as FormText
|
|
131
123
|
};
|