@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.
@@ -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 e } from "react/jsx-runtime";
2
- import { B as l } from "../../index.es-B9C7vzr4.js";
3
- import { Allowed as s } from "../Allowed/Allowed.js";
4
- import { LoadingSpinner as a } from "../LoadingSpinner/Default/LoadingSpinner.js";
5
- const c = ({
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: n = "filled",
8
- "data-testid": o,
9
- label: r,
10
- size: m = "medium",
11
- isLoading: i = !1,
12
- ...t
13
- }) => /* @__PURE__ */ e(s, { neededPermissions: t.permissions, entityIds: t.entityIds, children: /* @__PURE__ */ e(
14
- l,
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
- ...t,
17
- buttonSize: m,
18
- "data-testid": `allowed-button-${o}`,
19
- disabled: t.disabled || i,
20
- form: t.formId,
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: n,
23
- children: i ? /* @__PURE__ */ e(a, { size: "sm", spinnerOnly: !0 }) : r
25
+ variant: i,
26
+ children: e ? /* @__PURE__ */ t(p, { size: "sm", spinnerOnly: !0 }) : n
24
27
  }
25
28
  ) });
26
29
  export {
27
- c as AllowedButton
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 i } from "react/jsx-runtime";
2
- import { I as m } from "../../index.es-BwhRJBEH.js";
3
- import { Allowed as l } from "../Allowed/Allowed.js";
4
- const f = ({
5
- "data-testid": o,
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: d = "filled",
8
- size: n = "medium",
9
- ...t
10
- }) => /* @__PURE__ */ i(l, { neededPermissions: t.permissions, entityIds: t.entityIds, children: /* @__PURE__ */ i(
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
- "data-testid": `allowed-icon-button-${o}`,
14
- form: t.formId,
15
- iconSize: n,
16
- iconType: d,
17
- variant: e,
18
- ...t
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
- f as AllowedIconButton
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 = MenuProps & {
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 {'vertical' | 'horizontal'} iconOrientation determines if menu icon should be vertical or horizontal three dots. Default is 'vertical'
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, className, ...menuProps }: ContextMenuProps) => import("react").JSX.Element | null;
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 t, jsxs as L } from "react/jsx-runtime";
2
- import { I as A } from "../../index.es-BwhRJBEH.js";
3
- import { M as B, L as O, a as x, b as V } from "../../index.es-BIgjyLDa.js";
4
- import { c as C } from "../../index-_-9ybP20.js";
5
- import { u as E } from "../../uniqueId-CJo-XRQb.js";
6
- import { useState as I, useRef as T, useCallback as M, useEffect as k, useMemo as N, Fragment as R, useLayoutEffect as z } from "react";
7
- import { u as H } from "../../useBreakpoints-DDrM9Cfx.js";
8
- import { OfflineView as S } from "../OfflineView/OfflineView.js";
9
- import { useIsAllowed as $ } from "../PermissionChecks/PermissionService.js";
10
- import { repositionMenuVertically as j } from "./ContextMenuService.js";
11
- import '../../assets/ContextMenu.css';const q = "_menu_52omh_1", D = "_mobile_52omh_7", F = "_desktop_52omh_11", G = "_icon_52omh_15", J = "_listItem_52omh_19", K = "_offlineViewMargin_52omh_51", Q = "_primaryTextTruncated_52omh_55", o = {
12
- menu: q,
13
- mobile: D,
14
- desktop: F,
15
- icon: G,
16
- listItem: J,
17
- offlineViewMargin: K,
18
- primaryTextTruncated: Q
19
- }, oe = ({
20
- triggerOpen: n = null,
21
- actions: u,
22
- iconOrientation: m = "vertical",
23
- "data-testid": f,
24
- isOnline: d = !0,
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: w } = H(), [l, c] = I(!1), _ = T(null), a = T(null), r = $(), i = M(() => {
30
- c(!1);
31
- }, []), p = M(() => {
32
- c((e) => !e);
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
- k(() => {
35
- c(n !== null ? n : !1);
36
- }, [n]), k(() => {
37
- if (!l || !s.hoistToBody) return;
38
- const e = () => {
39
- j(_.current, a.current) && i();
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
- ref: a,
48
- className: b,
49
- "data-testid": f ?? "contextMenu-undefined",
50
- open: l,
38
+ className: n.menu,
39
+ "data-testid": c ?? "contextMenu-undefined",
40
+ open: u,
51
41
  surfaceOnly: !0,
52
- onClose: i,
53
- trigger: /* @__PURE__ */ t(
54
- A,
42
+ hoistToBody: !0,
43
+ onClose: p,
44
+ trigger: /* @__PURE__ */ i(
45
+ k,
55
46
  {
56
- className: o.icon,
57
- variant: l ? "filled-primary" : void 0,
47
+ className: n.icon,
48
+ variant: u ? "filled-primary" : void 0,
58
49
  "data-testid": "open-button",
59
- icon: m === "vertical" ? "more_vert" : "more_horiz",
60
- onClick: p
50
+ icon: a === "vertical" ? "more_vert" : "more_horiz",
51
+ onClick: h
61
52
  }
62
53
  ),
63
- ...s,
64
- children: d ? /* @__PURE__ */ t(O, { "data-testid": "selection-list", children: v.map((e, h) => /* @__PURE__ */ L(R, { children: [
65
- e.dividerBefore && h !== 0 && /* @__PURE__ */ t(x, {}),
66
- /* @__PURE__ */ t(
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: h,
71
- isMobile: w,
72
- closeMenu: i
60
+ index: s,
61
+ isMobile: d,
62
+ closeMenu: p
73
63
  }
74
64
  ),
75
- e.dividerAfter && h !== v.length - 1 && /* @__PURE__ */ t(x, {})
76
- ] }, E(`LI_${e.primaryText?.toString()}_`))) }) : /* @__PURE__ */ t(
77
- S,
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: o.offlineViewMargin,
82
- ...y
71
+ className: n.offlineViewMargin,
72
+ ...f
83
73
  }
84
74
  )
85
75
  },
86
- `contextMenu-${f ?? "undefined"}`
87
- ) });
88
- }, U = ({
89
- actionProps: n,
90
- index: u,
91
- isMobile: m,
92
- closeMenu: f
76
+ `contextMenu-${c ?? "undefined"}`
77
+ );
78
+ }, F = ({
79
+ actionProps: t,
80
+ index: l,
81
+ isMobile: a,
82
+ closeMenu: c
93
83
  }) => {
94
- const d = T(null), [y, g] = I(!1), { closeOnClick: s, permissionConfiguration: w, isAllowed: l, isHidden: c, ..._ } = n;
95
- return z(() => {
96
- const a = d.current;
97
- if (!a) return;
98
- const r = a.querySelector(
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 (!r) return;
102
- const i = () => {
103
- g(r.scrollHeight > r.clientHeight);
91
+ if (!e) return;
92
+ const s = () => {
93
+ d(e.scrollHeight > e.clientHeight);
104
94
  };
105
- i();
106
- const p = new ResizeObserver(i);
107
- return p.observe(r), () => {
108
- p.disconnect();
95
+ s();
96
+ const y = new ResizeObserver(s);
97
+ return y.observe(e), () => {
98
+ y.disconnect();
109
99
  };
110
- }, [n.primaryText, m]), /* @__PURE__ */ t(
111
- V,
100
+ }, [t.primaryText, a]), /* @__PURE__ */ i(
101
+ C,
112
102
  {
113
- ref: d,
114
- "data-testid": n["data-testid"] ?? `contextMenu-action-${u}`,
115
- className: C(
116
- o.listItem,
117
- y && o.primaryTextTruncated,
118
- m ? o.mobile : o.desktop
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
- n?.onClick?.(), s !== !1 && f();
113
+ t?.onClick?.(), u !== !1 && c();
124
114
  }
125
115
  }
126
116
  );
127
117
  };
128
118
  export {
129
- oe as ContextMenu
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 == null || e.value == null))
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 _, jsxs as z } from "react/jsx-runtime";
2
- import { T as M } from "../../../index.es-CJIPOFSz.js";
3
- import { a as P } from "../../../index.es-CdZp67J9.js";
4
- import { useState as V, useCallback as W, useMemo as d } from "react";
5
- import { useFormContext as D, Controller as v } from "react-hook-form";
6
- import { useHelperText as E } from "../../../hooks/useHelperText.js";
7
- import '../../../assets/FormText.css';const G = "_formTextAreaHelperText_x4g1e_1", I = "_invalid_x4g1e_7", J = "_required_x4g1e_11", K = "_formTextArea_x4g1e_1", O = "_characterCount_x4g1e_25", Q = "_withoutCharacterCount_x4g1e_31", U = "_formText_x4g1e_1", r = {
8
- formTextAreaHelperText: G,
9
- invalid: I,
10
- required: J,
11
- formTextArea: K,
12
- characterCount: O,
13
- withoutCharacterCount: Q,
14
- formText: U
15
- }, X = ({
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: x,
18
- invalid: s = !1,
19
- hasRequiredText: n = !1
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} ${s ? r.invalid : ""} ${n ? r.required : ""}`,
25
- children: /* @__PURE__ */ t(P, { children: `${e}/${x}` })
24
+ className: `${r.formTextAreaHelperText} ${x ? r.invalid : ""} ${o ? r.required : ""}`,
25
+ children: /* @__PURE__ */ t(z, { children: `${e}/${c}` })
26
26
  }
27
- ), ne = (e) => e.textarea ? /* @__PURE__ */ t(Y, { ...e }) : /* @__PURE__ */ t(Z, { ...e }), Y = (e) => /* @__PURE__ */ t("div", { "data-testid": "form-text-area", className: r.formTextArea, children: /* @__PURE__ */ t(A, { ...e }) }), Z = (e) => /* @__PURE__ */ t(
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(A, { ...e })
32
+ children: /* @__PURE__ */ t(_, { ...e })
33
33
  }
34
- ), A = ({
34
+ ), _ = ({
35
35
  propertyName: e,
36
- label: x,
37
- disabled: s = !1,
38
- textarea: n = !1,
39
- hasCharacterCount: i = !1,
40
- hidden: $ = !1,
41
- placeholder: F,
42
- type: q,
43
- prefixText: H,
44
- inputMode: L,
45
- trailingIcon: w,
46
- trigger: h = "likeForm",
47
- rules: a,
48
- ...o
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: f, getFieldState: u, trigger: T } = D(), [B, g] = V(0), S = W(
51
- (m) => {
52
- if (!(!n && !i)) {
53
- if (m) {
54
- g(m.length);
55
- return;
56
- }
57
- g(0);
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: o.helperText,
73
- requiredText: C,
74
- maxLength: l,
75
- hasCharacterCount: n || i
61
+ helperText: a.helperText,
62
+ requiredText: T,
63
+ maxLength: i,
64
+ hasCharacterCount: o || d
76
65
  });
77
- return $ ? /* @__PURE__ */ t(v, { name: e, control: f, render: () => /* @__PURE__ */ t(_, {}) }) : /* @__PURE__ */ t(
78
- v,
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: a,
82
- control: f,
83
- render: ({ field: { ref: m, ...c } }) => (S(c.value), /* @__PURE__ */ z(_, { children: [
84
- /* @__PURE__ */ t(
85
- M,
86
- {
87
- ...o,
88
- ...c,
89
- value: c.value ?? "",
90
- type: q,
91
- fullWidth: !0,
92
- "data-testid": `textfield-${e}`,
93
- inputMode: L,
94
- placeholder: F,
95
- prefixText: H,
96
- disabled: s,
97
- helperText: k,
98
- helperTextPersistent: R,
99
- label: x,
100
- variant: "outlined",
101
- maxlength: l,
102
- minLength: j,
103
- textarea: n,
104
- noResize: !1,
105
- onBlur: () => {
106
- h === "onBlur" && T(e), o.onBlur?.();
107
- },
108
- onChange: (b) => {
109
- c.onChange(b), h === "onChange" && T(e);
110
- },
111
- valid: !u(e).invalid,
112
- className: `${r.formText} ${u(e).invalid ? r.invalid : ""}`,
113
- trailingIcon: w
114
- }
115
- ),
116
- l !== void 0 && (i || n) && /* @__PURE__ */ t(
117
- X,
118
- {
119
- count: B,
120
- maxCount: l,
121
- invalid: u(e).invalid,
122
- hasRequiredText: !!o.helperText || !!C
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
- ne as FormText
122
+ p as FormText
131
123
  };