@hortiview/shared-components 0.0.4730 → 0.0.4775

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.
Files changed (47) hide show
  1. package/README.md +199 -1
  2. package/dist/_baseToString-ByHt83eL.js +282 -0
  3. package/dist/_getTag-D4bRay2z.js +226 -0
  4. package/dist/assets/formDatePicker.css +1 -0
  5. package/dist/assets/formSelect.css +1 -0
  6. package/dist/assets/formText.css +1 -0
  7. package/dist/components/BaseView/BaseView.d.ts +1 -0
  8. package/dist/components/DeleteModal/DeleteModal.js +23 -18
  9. package/dist/components/DeleteModal/DeleteModal.test.js +3 -3
  10. package/dist/components/FormComponents/FormCheckBox/FormCheckBox.d.ts +30 -0
  11. package/dist/components/FormComponents/FormCheckBox/FormCheckBox.js +42 -0
  12. package/dist/components/FormComponents/FormCheckBox/FormCheckBox.test.d.ts +1 -0
  13. package/dist/components/FormComponents/FormCheckBox/FormCheckBox.test.js +50 -0
  14. package/dist/components/FormComponents/FormDatePicker/FormDatePicker.d.ts +36 -0
  15. package/dist/components/FormComponents/FormDatePicker/FormDatePicker.js +62 -0
  16. package/dist/components/FormComponents/FormDatePicker/FormDatePicker.test.d.ts +1 -0
  17. package/dist/components/FormComponents/FormDatePicker/FormDatePicker.test.js +69 -0
  18. package/dist/components/FormComponents/FormRadio/FormRadio.d.ts +21 -0
  19. package/dist/components/FormComponents/FormRadio/FormRadio.js +30 -0
  20. package/dist/components/FormComponents/FormRadio/FormRadio.test.d.ts +1 -0
  21. package/dist/components/FormComponents/FormRadio/FormRadio.test.js +73 -0
  22. package/dist/components/FormComponents/FormSelect/FormSelect.d.ts +61 -0
  23. package/dist/components/FormComponents/FormSelect/FormSelect.js +76 -0
  24. package/dist/components/FormComponents/FormSelect/FormSelect.test.d.ts +1 -0
  25. package/dist/components/FormComponents/FormSelect/FormSelect.test.js +65 -0
  26. package/dist/components/FormComponents/FormSlider/FormSlider.d.ts +27 -0
  27. package/dist/components/FormComponents/FormSlider/FormSlider.js +37 -0
  28. package/dist/components/FormComponents/FormSlider/FormSlider.test.d.ts +1 -0
  29. package/dist/components/FormComponents/FormSlider/FormSlider.test.js +49 -0
  30. package/dist/components/FormComponents/FormText/FormText.d.ts +69 -0
  31. package/dist/components/FormComponents/FormText/FormText.js +103 -0
  32. package/dist/components/FormComponents/FormText/FormText.test.d.ts +1 -0
  33. package/dist/components/FormComponents/FormText/FormText.test.js +84 -0
  34. package/dist/components/Iconify/Iconify.d.ts +1 -0
  35. package/dist/components/ListArea/ListArea.d.ts +1 -0
  36. package/dist/components/ListArea/ListArea.js +194 -227
  37. package/dist/formDatePicker.module-DllLVp7D.js +7 -0
  38. package/dist/formSelect.module-CdHEvmH_.js +9 -0
  39. package/dist/formText.module-3BZ0M2vV.js +10 -0
  40. package/dist/get-BYajYtEc.js +46 -0
  41. package/dist/main.d.ts +6 -0
  42. package/dist/main.js +40 -28
  43. package/dist/types/HashTab.d.ts +1 -0
  44. package/dist/types/ListElement.d.ts +1 -0
  45. package/dist/types/internal/ReactRouterTypes.d.ts +1 -0
  46. package/package.json +7 -2
  47. package/dist/_getTag-DyrzUAbj.js +0 -494
@@ -0,0 +1,21 @@
1
+ import { FieldValues, Path } from 'react-hook-form';
2
+ type FormRadioProps<T extends FieldValues> = {
3
+ /** The name of the property that this radio button represents. */
4
+ propertyName: Path<T>;
5
+ /** The options to be displayed as radio buttons. */
6
+ options: {
7
+ value: string;
8
+ label: string;
9
+ }[];
10
+ };
11
+ /**
12
+ * FormRadio is a custom form input component for selecting radio buttons.
13
+ * It is integrated with react-hook-form for form management.
14
+ *
15
+ * @param propertyName - the name of the property this radio button maps to in the form.
16
+ * @param options - the options to be displayed as radio buttons.
17
+ *
18
+ * @returns A JSX element that renders a radio button form input.
19
+ */
20
+ export declare const FormRadio: <T extends FieldValues>({ propertyName, options }: FormRadioProps<T>) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as a, Fragment as m } from "react/jsx-runtime";
2
+ import { Radio as c } from "@element/react-components";
3
+ import { useFormContext as v, Controller as d } from "react-hook-form";
4
+ const h = ({ propertyName: l, options: n }) => {
5
+ const { control: o, setValue: t } = v(), u = (r) => {
6
+ const e = r.target.value;
7
+ t(l, e);
8
+ };
9
+ return /* @__PURE__ */ a(
10
+ d,
11
+ {
12
+ name: l,
13
+ control: o,
14
+ render: (r) => /* @__PURE__ */ a(m, { children: n.map((e) => /* @__PURE__ */ a(
15
+ c,
16
+ {
17
+ name: e.value,
18
+ value: e.value,
19
+ checked: r.field.value === e.value,
20
+ label: e.label,
21
+ onChange: u
22
+ },
23
+ e.value
24
+ )) })
25
+ }
26
+ );
27
+ };
28
+ export {
29
+ h as FormRadio
30
+ };
@@ -0,0 +1,73 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { r as s, s as t, f as m } from "../../../react.esm-BeDwcQWb.js";
3
+ import { FormRadio as l } from "./FormRadio.js";
4
+ import { v as e, d as c, t as i, g as o } from "../../../vi.JYQecGiw-BbUbJcT8.js";
5
+ const a = e.fn();
6
+ e.mock("react-hook-form", () => ({
7
+ ...e.importActual("react-hook-form"),
8
+ Controller: ({
9
+ render: r
10
+ }) => r({
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
+ setValue: a
41
+ })
42
+ }));
43
+ c("FormRadio Test", () => {
44
+ i("render FormRadio", () => {
45
+ s(
46
+ /* @__PURE__ */ n(
47
+ l,
48
+ {
49
+ propertyName: "hasValue",
50
+ options: [
51
+ { label: "option1", value: "1" },
52
+ { label: "option2", value: "2" }
53
+ ]
54
+ }
55
+ )
56
+ ), o(t.getByText("option1")).toBeInTheDocument(), o(t.getByText("option2")).toBeInTheDocument(), o(t.getAllByRole("radio")).toHaveLength(2);
57
+ }), i("render FormRadio click", () => {
58
+ s(
59
+ /* @__PURE__ */ n(
60
+ l,
61
+ {
62
+ propertyName: "hasValue",
63
+ options: [
64
+ { label: "option1", value: "1" },
65
+ { label: "option2", value: "2" }
66
+ ]
67
+ }
68
+ )
69
+ );
70
+ const r = t.getAllByRole("radio");
71
+ m.click(r[0]), o(a).toHaveBeenCalled();
72
+ });
73
+ });
@@ -0,0 +1,61 @@
1
+ /// <reference types="react" />
2
+ import { FieldValues, Path } from 'react-hook-form';
3
+ /**
4
+ * a generic FormSelector property type. the generic T represents the interface, which is used in the form, like {@link CreateOrganizationDto}
5
+ */
6
+ type FormSelectProps<T extends FieldValues> = {
7
+ /** the current character count */
8
+ propertyName: Path<T>;
9
+ /** the label of the select */
10
+ label: string;
11
+ /** if the select is disabled */
12
+ disabled?: boolean;
13
+ /** if the select should be hidden */
14
+ hidden?: boolean;
15
+ /** if the select is required */
16
+ required?: boolean;
17
+ /** the text which is shown if the select is required and not filled */
18
+ requiredText?: string;
19
+ /** if true the select dropdown is rendered outside of the parent. Useful for when the select needs to render in a parent with "overflow: hidden" and the dropdown will cut on the component border. */
20
+ hoisted?: boolean;
21
+ /** the key of the value attribute of the select, default: value */
22
+ valueKey?: string;
23
+ /** the key of the text attribute of the select, default: text */
24
+ textKey?: string;
25
+ /** the options, which are shown in the dropdown section of the select */
26
+ options: FormSelectOption[] | object[] | undefined;
27
+ /** if true, the select allows multiple selections */
28
+ multi?: boolean;
29
+ /** if true, the select allows the user to clear the selection */
30
+ clearable?: boolean;
31
+ /** a message if no options a present */
32
+ noOptionsMessage?: string;
33
+ };
34
+ /**
35
+ * the base option type of the selector, you can also use your own custom objects, by defining the {@link FormSelectProps} valueKey and textKey
36
+ */
37
+ export type FormSelectOption = {
38
+ text: string | JSX.Element;
39
+ value: string;
40
+ };
41
+ /**
42
+ * creates a Select which should be part of a form component.
43
+ * the Select is wrapped by the react hook forms {@link Controller} component.
44
+ * @param clearable if the select allows the user to clear the selection
45
+ * @param disabled if the select is disabled
46
+ * @param hidden if the select should be hidden
47
+ * @param hoisted if the select should be rendered outside of the parent
48
+ * @param label the label of the select
49
+ * @param multi if the select allows multiple selections
50
+ * @param options the options of the select
51
+ * @param noOptionsMessage a message if no options a present
52
+ * @param propertyName the name of the property in the form
53
+ * @param required if the select is required
54
+ * @param requiredText the text which is shown if the select is required and not filled
55
+ * @param textKey the key of the text attribute of the select, default: text
56
+ * @param valueKey the key of the value attribute of the select, default: value
57
+ *
58
+ * @returns
59
+ */
60
+ export declare const FormSelect: <T extends FieldValues>({ propertyName, label, required, requiredText, options, multi, disabled, hoisted, hidden, valueKey, textKey, clearable, noOptionsMessage, }: FormSelectProps<T>) => import("react/jsx-runtime").JSX.Element;
61
+ export {};
@@ -0,0 +1,76 @@
1
+ import { jsx as s, Fragment as V } from "react/jsx-runtime";
2
+ import { Select as k } from "@element/react-components";
3
+ import { g as u } from "../../../get-BYajYtEc.js";
4
+ import { useState as v, useMemo as w, useEffect as z } from "react";
5
+ import { useFormContext as A, Controller as x } from "react-hook-form";
6
+ import { s as i } from "../../../formSelect.module-CdHEvmH_.js";
7
+ const Q = ({
8
+ propertyName: r,
9
+ label: S,
10
+ required: m = !1,
11
+ requiredText: h,
12
+ options: o,
13
+ multi: n = !1,
14
+ disabled: g = !1,
15
+ hoisted: F = !1,
16
+ hidden: C = !1,
17
+ valueKey: t = "value",
18
+ textKey: E = "text",
19
+ clearable: M = !1,
20
+ noOptionsMessage: T = ""
21
+ }) => {
22
+ const {
23
+ control: a,
24
+ formState: { errors: l }
25
+ } = A(), [c, $] = v(!0), b = w(() => u(l, r) !== void 0, [l, r]);
26
+ return z(() => {
27
+ $(u(l, r) === void 0);
28
+ }, [l, b, r]), C ? /* @__PURE__ */ s(x, { name: r, control: a, render: () => /* @__PURE__ */ s(V, {}) }) : /* @__PURE__ */ s("div", { className: i.formSelectContainer, children: /* @__PURE__ */ s(
29
+ x,
30
+ {
31
+ name: r,
32
+ rules: {
33
+ required: m
34
+ },
35
+ control: a,
36
+ render: ({ field: { ref: B, onChange: f, value: d, ...j } }) => {
37
+ const H = n ? o?.filter(
38
+ (e) => d?.includes(e[t])
39
+ ) : o?.find((e) => e[t] === d);
40
+ return /* @__PURE__ */ s(
41
+ k,
42
+ {
43
+ ...j,
44
+ value: H,
45
+ label: S,
46
+ variant: "outlined",
47
+ helperText: h,
48
+ helperTextPersistent: m,
49
+ options: o,
50
+ valid: c,
51
+ multiSelect: n,
52
+ className: `${i.formSelect} ${c ? "" : i.invalid}`,
53
+ disabled: g,
54
+ valueKey: t,
55
+ textKey: E,
56
+ onChange: (e) => {
57
+ if (e == null)
58
+ return f(e);
59
+ if (n)
60
+ return f(e.map((P) => P[t]));
61
+ f(e[t]);
62
+ },
63
+ hoisted: F,
64
+ noOptionsMessage: T,
65
+ searchable: !0,
66
+ clearable: M,
67
+ menuMaxHeight: "15rem"
68
+ }
69
+ );
70
+ }
71
+ }
72
+ ) });
73
+ };
74
+ export {
75
+ Q as FormSelect
76
+ };
@@ -0,0 +1,65 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { r as s, s as r } from "../../../react.esm-BeDwcQWb.js";
3
+ import { FormSelect as c } from "./FormSelect.js";
4
+ import { v as e, d as l, t as u, g as t } from "../../../vi.JYQecGiw-BbUbJcT8.js";
5
+ const i = e.fn();
6
+ e.mock("react-hook-form", () => ({
7
+ ...e.importActual("react-hook-form"),
8
+ Controller: ({ render: o }) => o({
9
+ field: {
10
+ ref: void 0,
11
+ onChange: i,
12
+ value: "3"
13
+ }
14
+ }),
15
+ useFormContext: () => ({
16
+ control: {
17
+ register: e.fn(),
18
+ unregister: e.fn(),
19
+ getFieldState: e.fn(),
20
+ _names: {
21
+ array: new Set("test"),
22
+ mount: new Set("test"),
23
+ unMount: new Set("test"),
24
+ watch: new Set("test"),
25
+ focus: "test",
26
+ watchAll: !1
27
+ },
28
+ _subjects: {
29
+ watch: e.fn(),
30
+ array: e.fn(),
31
+ state: e.fn()
32
+ },
33
+ _getWatch: e.fn(),
34
+ _formValues: ["test"],
35
+ _defaultValues: ["test"]
36
+ },
37
+ formState: { errors: {} },
38
+ getFieldState: () => ({ invalid: !1 })
39
+ })
40
+ }));
41
+ l("FormSelect Test", () => {
42
+ const o = [
43
+ { id: "1", value: "Germany", description: "" },
44
+ { id: "2", value: "France", description: "" },
45
+ { id: "3", value: "Afar", description: "" }
46
+ ];
47
+ u("render FormSelect", () => {
48
+ s(
49
+ /* @__PURE__ */ a(
50
+ c,
51
+ {
52
+ label: "address.country",
53
+ required: !0,
54
+ requiredText: "required",
55
+ propertyName: "countryId",
56
+ options: o,
57
+ valueKey: "id",
58
+ textKey: "value"
59
+ }
60
+ )
61
+ );
62
+ const n = r.getByRole("combobox");
63
+ t(n).toBeInTheDocument(), t(n).toBeInstanceOf(HTMLInputElement), t(r.getByText("address.country")).toBeInTheDocument(), t(r.getByText("Afar")).toBeInTheDocument(), t(r.getByText("required")).toBeInTheDocument();
64
+ });
65
+ });
@@ -0,0 +1,27 @@
1
+ import { FieldValues, Path } from 'react-hook-form';
2
+ type FormSliderProps<T extends FieldValues> = {
3
+ /** the path to the property, like Address.AddressLine1 */
4
+ propertyName: Path<T>;
5
+ /** the label of the Slider */
6
+ label?: string;
7
+ /** the min value */
8
+ minValue?: number;
9
+ /** the max value */
10
+ maxValue?: number;
11
+ /** the step value */
12
+ step?: number;
13
+ /** if the field is disabled */
14
+ disabled?: boolean;
15
+ };
16
+ /**
17
+ * a generic FormSlider property type. the generic T represents the interface, which is used in the form, like {@link CreateOrganizationDto}
18
+ * @param propertyName the path to the property, like Address.AddressLine1
19
+ * @param label the label of the Slider
20
+ * @param minValue the min value
21
+ * @param maxValue the max value
22
+ * @param step the step value
23
+ * @param disabled if the field is disabled
24
+ * @returns a Slider component
25
+ */
26
+ export declare const FormSlider: <T extends FieldValues>({ propertyName, label, minValue, maxValue, step, disabled, }: FormSliderProps<T>) => import("react/jsx-runtime").JSX.Element;
27
+ export {};
@@ -0,0 +1,37 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Slider as s } from "@element/react-components";
3
+ import { useFormContext as u, Controller as x } from "react-hook-form";
4
+ const f = ({
5
+ propertyName: n,
6
+ label: e,
7
+ minValue: t,
8
+ maxValue: m,
9
+ step: a,
10
+ disabled: i
11
+ }) => {
12
+ const { control: l } = u();
13
+ return /* @__PURE__ */ o(
14
+ x,
15
+ {
16
+ name: n,
17
+ control: l,
18
+ render: ({ field: r }) => /* @__PURE__ */ o(
19
+ s,
20
+ {
21
+ ...r,
22
+ onChange: (p) => {
23
+ r.onChange(p.value);
24
+ },
25
+ label: e,
26
+ min: t,
27
+ max: m,
28
+ step: a,
29
+ disabled: i
30
+ }
31
+ )
32
+ }
33
+ );
34
+ };
35
+ export {
36
+ f as FormSlider
37
+ };
@@ -0,0 +1,49 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { r as a, s as n } from "../../../react.esm-BeDwcQWb.js";
3
+ import { FormSlider as l } from "./FormSlider.js";
4
+ import { v as e, d as m, t as i, g as r } from "../../../vi.JYQecGiw-BbUbJcT8.js";
5
+ const o = e.fn();
6
+ e.mock("react-hook-form", () => ({
7
+ ...e.importActual("react-hook-form"),
8
+ Controller: ({
9
+ render: t
10
+ }) => t({
11
+ field: {
12
+ onChange: o
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
+ setValue: o
41
+ })
42
+ }));
43
+ m("FormSlider Test", () => {
44
+ i("render FormSlider", () => {
45
+ a(/* @__PURE__ */ s(l, { propertyName: "slide", label: "slide", maxValue: 10, minValue: 0, step: 2 }));
46
+ const t = n.getByRole("slider");
47
+ r(t).toBeInTheDocument(), r(t).toHaveAttribute("max", "10"), r(t).toHaveAttribute("min", "0"), r(t).toHaveAttribute("step", "2");
48
+ });
49
+ });
@@ -0,0 +1,69 @@
1
+ import { ReactNode } from 'react';
2
+ import { FieldValues, Path, PathValue, Validate, ValidationRule } from 'react-hook-form';
3
+ /**
4
+ * a generic FormText property type. the generic T represents the interface, which is used in the form, like {@link CreateOrganizationDto}
5
+ */
6
+ type FormTextProps<T extends FieldValues> = {
7
+ /** the path to the property, like Address.AddressLine1 */
8
+ propertyName: Path<T>;
9
+ /** the label of the Textbox */
10
+ label: string;
11
+ /** the max character length */
12
+ maxLength?: number;
13
+ /** the min character length */
14
+ minLength?: number;
15
+ /** if the field is required */
16
+ required?: boolean;
17
+ /** the text which is shown if the field is required and not filled */
18
+ requiredText?: string;
19
+ /** a boolean to set a textarea or a textfield */
20
+ textarea?: boolean;
21
+ /** a boolean to disable the field/set to readonly */
22
+ disabled?: boolean;
23
+ /** a boolean to hide the field */
24
+ hidden?: boolean;
25
+ /** a pattern to validate the field */
26
+ pattern?: ValidationRule<RegExp>;
27
+ /** a placeholder text */
28
+ placeholder?: string;
29
+ /** the type of the input field */
30
+ type?: string;
31
+ /** a prefix text */
32
+ prefixText?: string;
33
+ /** the input mode of the field */
34
+ inputMode?: 'search' | 'text' | 'none' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | undefined;
35
+ trailingIcon?: ReactNode;
36
+ /**
37
+ * the trigger to validate the field. default is 'likeForm'
38
+ * @default 'likeForm'
39
+ * @example 'onBlur' or 'onChange'
40
+ */
41
+ trigger?: 'onBlur' | 'onChange' | 'likeForm';
42
+ /**
43
+ * a custom validation function or an object with multiple validation functions
44
+ */
45
+ validate?: Validate<PathValue<T, Path<T>>, T> | Record<string, Validate<PathValue<T, Path<T>>, T>>;
46
+ };
47
+ /**
48
+ * creates a Textfield which should be part of a form component.
49
+ * the field is wrapped by the react hook forms {@link Controller} component.
50
+ * @param disabled if the field is disabled
51
+ * @param hidden if the field should be hidden
52
+ * @param inputMode the input mode of the field @example 'search' or 'numeric'
53
+ * @param label the label of the field
54
+ * @param maxLength the max character length
55
+ * @param minLength the min character length
56
+ * @param pattern a pattern to validate the field @example /^[A-Za-z]+$/
57
+ * @param placeholder a placeholder text
58
+ * @param prefixText a prefix text
59
+ * @param propertyName the name of the property in the form
60
+ * @param required if the field is required
61
+ * @param requiredText the text which is shown if the field is required and not filled
62
+ * @param textarea if the field is a textarea
63
+ * @param trigger the trigger to validate the field. @default 'likeForm' @example 'onBlur' or 'onChange'
64
+ * @param validate a custom validation function or an object with multiple validation functions
65
+ * @param trailingIcon a trailing icon
66
+ * @returns a JSX element that renders a textfield form input
67
+ */
68
+ export declare const FormText: <T extends FieldValues>(props: FormTextProps<T>) => import("react/jsx-runtime").JSX.Element;
69
+ export {};
@@ -0,0 +1,103 @@
1
+ import { jsx as t, Fragment as R, jsxs as V } from "react/jsx-runtime";
2
+ import { Textfield as W } from "@element/react-components";
3
+ import { useState as b } from "react";
4
+ import { useFormContext as w, Controller as g } from "react-hook-form";
5
+ import { s as a } from "../../../formText.module-3BZ0M2vV.js";
6
+ const D = ({
7
+ count: e,
8
+ maxCount: u,
9
+ required: r = !1,
10
+ requiredText: l = ""
11
+ }) => /* @__PURE__ */ V("div", { className: a.formTextAreaHelperText, children: [
12
+ r ? /* @__PURE__ */ t("div", { children: l }) : /* @__PURE__ */ t("div", {}),
13
+ /* @__PURE__ */ t("div", { children: `${e}/${u}` })
14
+ ] }), X = (e) => e.textarea ? /* @__PURE__ */ t(E, { ...e }) : /* @__PURE__ */ t(G, { ...e }), E = (e) => /* @__PURE__ */ t("div", { className: a.formTextArea, children: /* @__PURE__ */ t(h, { ...e }) }), G = (e) => /* @__PURE__ */ t(h, { ...e }), h = ({
15
+ propertyName: e,
16
+ label: u,
17
+ maxLength: r,
18
+ minLength: l,
19
+ required: c = !1,
20
+ requiredText: f = "",
21
+ disabled: C = !1,
22
+ textarea: i = !1,
23
+ hidden: F = !1,
24
+ pattern: S,
25
+ placeholder: $,
26
+ type: A,
27
+ prefixText: B,
28
+ inputMode: H,
29
+ trailingIcon: j,
30
+ trigger: d = "likeForm",
31
+ validate: k
32
+ }) => {
33
+ const {
34
+ control: m,
35
+ getFieldState: v,
36
+ formState: { errors: s },
37
+ trigger: x
38
+ } = w(), [z, I] = b(0), M = (n) => {
39
+ const o = n.target.value;
40
+ I(o?.length ?? 0);
41
+ }, P = () => {
42
+ if (s && s[e]) {
43
+ const n = s[e]?.message;
44
+ return n || "Invalid input";
45
+ }
46
+ return r && i ? /* @__PURE__ */ t(
47
+ D,
48
+ {
49
+ count: z,
50
+ maxCount: r,
51
+ required: c,
52
+ requiredText: f
53
+ }
54
+ ) : f;
55
+ };
56
+ return F ? /* @__PURE__ */ t(g, { name: e, control: m, render: () => /* @__PURE__ */ t(R, {}) }) : /* @__PURE__ */ t(
57
+ g,
58
+ {
59
+ name: e,
60
+ rules: {
61
+ required: c,
62
+ maxLength: r,
63
+ minLength: l,
64
+ pattern: S,
65
+ validate: k
66
+ },
67
+ control: m,
68
+ render: ({ field: { ref: n, ...o } }) => /* @__PURE__ */ t(
69
+ W,
70
+ {
71
+ ...o,
72
+ value: o.value ?? "",
73
+ type: A,
74
+ fullWidth: !0,
75
+ inputMode: H,
76
+ placeholder: $,
77
+ prefixText: B,
78
+ disabled: C,
79
+ helperText: P(),
80
+ helperTextPersistent: s !== void 0 || c || r !== void 0 && i,
81
+ label: u,
82
+ variant: "outlined",
83
+ maxlength: r,
84
+ minLength: l,
85
+ textarea: i,
86
+ noResize: !1,
87
+ onBlur: () => {
88
+ d === "onBlur" && x(e);
89
+ },
90
+ onChange: (T) => {
91
+ o.onChange(T), i && r !== void 0 && M(T), d === "onChange" && x(e);
92
+ },
93
+ valid: !v(e).invalid,
94
+ className: `${a.formText} ${v(e).invalid ? a.invalid : ""}`,
95
+ trailingIcon: j
96
+ }
97
+ )
98
+ }
99
+ );
100
+ };
101
+ export {
102
+ X as FormText
103
+ };