@intlayer/design-system 3.5.6 → 3.5.8
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/.vite/manifest.json +92 -168
- package/dist/Form-0D7KBafQ.cjs +311 -0
- package/dist/Form-0D7KBafQ.cjs.map +1 -0
- package/dist/Form-7BqwvjVI.cjs +320 -0
- package/dist/Form-7BqwvjVI.cjs.map +1 -0
- package/dist/Form-B2UufQRJ.cjs +319 -0
- package/dist/Form-B2UufQRJ.cjs.map +1 -0
- package/dist/Form-BDcoNTLV.cjs.map +1 -1
- package/dist/Form-BTogr-fp.js +312 -0
- package/dist/Form-BTogr-fp.js.map +1 -0
- package/dist/Form-BVkkvSKP.js +312 -0
- package/dist/Form-BVkkvSKP.js.map +1 -0
- package/dist/Form-Be6Uhb5-.js +312 -0
- package/dist/Form-Be6Uhb5-.js.map +1 -0
- package/dist/Form-BmQQnl-6.js +312 -0
- package/dist/Form-BmQQnl-6.js.map +1 -0
- package/dist/Form-Bp_ubH9I.cjs +311 -0
- package/dist/Form-Bp_ubH9I.cjs.map +1 -0
- package/dist/Form-BtqRbgLu.cjs +311 -0
- package/dist/Form-BtqRbgLu.cjs.map +1 -0
- package/dist/Form-COVZyto7.cjs +311 -0
- package/dist/Form-COVZyto7.cjs.map +1 -0
- package/dist/Form-CVD_3nCD.js +312 -0
- package/dist/Form-CVD_3nCD.js.map +1 -0
- package/dist/Form-Cfklj1_H.js +320 -0
- package/dist/Form-Cfklj1_H.js.map +1 -0
- package/dist/Form-ClAAiVNm.cjs +311 -0
- package/dist/Form-ClAAiVNm.cjs.map +1 -0
- package/dist/Form-DhsgC7kB.js.map +1 -1
- package/dist/Form-OK9zfg6E.js +321 -0
- package/dist/Form-OK9zfg6E.js.map +1 -0
- package/dist/components/Accordion/Accordion.cjs +7 -15
- package/dist/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.d.ts +0 -1
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion/Accordion.mjs +8 -16
- package/dist/components/Accordion/Accordion.mjs.map +1 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs +1 -1
- package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs +1 -1
- package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.d.ts +4 -4
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +3 -3
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs.map +1 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs +1 -1
- package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.cjs +1 -1
- package/dist/components/Auth/SignInForm/SignInForm.mjs +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.cjs +1 -1
- package/dist/components/Auth/SignUpForm/SignUpForm.mjs +1 -1
- package/dist/components/Auth/useAuth/useCSRF.cjs +2 -2
- package/dist/components/Auth/useAuth/useCSRF.cjs.map +1 -1
- package/dist/components/Auth/useAuth/useCSRF.d.ts +1 -1
- package/dist/components/Auth/useAuth/useCSRF.mjs +1 -1
- package/dist/components/Auth/useAuth/useCSRF.mjs.map +1 -1
- package/dist/components/Auth/useAuth/useOAuth2.cjs +2 -2
- package/dist/components/Auth/useAuth/useOAuth2.cjs.map +1 -1
- package/dist/components/Auth/useAuth/useOAuth2.d.ts +1 -1
- package/dist/components/Auth/useAuth/useOAuth2.mjs +1 -1
- package/dist/components/Auth/useAuth/useOAuth2.mjs.map +1 -1
- package/dist/components/Auth/useAuth/useSession.cjs +2 -2
- package/dist/components/Auth/useAuth/useSession.cjs.map +1 -1
- package/dist/components/Auth/useAuth/useSession.mjs +1 -1
- package/dist/components/Auth/useAuth/useSession.mjs.map +1 -1
- package/dist/components/Button/Button.cjs +47 -25
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.d.ts +2 -0
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.mjs +47 -25
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/Container/index.cjs +1 -1
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.mjs +1 -1
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/CopyToClipboard/index.cjs +1 -1
- package/dist/components/CopyToClipboard/index.cjs.map +1 -1
- package/dist/components/CopyToClipboard/index.d.ts.map +1 -1
- package/dist/components/CopyToClipboard/index.mjs +1 -1
- package/dist/components/CopyToClipboard/index.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ItemLayout.cjs +0 -1
- package/dist/components/DictionaryEditor/ItemLayout.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ItemLayout.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/ItemLayout.mjs +0 -1
- package/dist/components/DictionaryEditor/ItemLayout.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +14 -13
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +15 -14
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +6 -10
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +6 -10
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +1 -1
- package/dist/components/Form/Form.cjs +1 -1
- package/dist/components/Form/Form.d.ts +2 -0
- package/dist/components/Form/Form.d.ts.map +1 -1
- package/dist/components/Form/Form.mjs +1 -1
- package/dist/components/Form/elements/AutoSizeTextAreaElement.cjs +7 -0
- package/dist/components/Form/elements/AutoSizeTextAreaElement.cjs.map +1 -0
- package/dist/components/Form/elements/AutoSizeTextAreaElement.d.ts +9 -0
- package/dist/components/Form/elements/AutoSizeTextAreaElement.d.ts.map +1 -0
- package/dist/components/Form/elements/AutoSizeTextAreaElement.mjs +7 -0
- package/dist/components/Form/elements/AutoSizeTextAreaElement.mjs.map +1 -0
- package/dist/components/Form/elements/CheckboxElement.cjs +1 -1
- package/dist/components/Form/elements/CheckboxElement.mjs +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.cjs +1 -1
- package/dist/components/Form/elements/EditableFieldInputElement.mjs +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.cjs +1 -1
- package/dist/components/Form/elements/EditableFieldTextAreaElement.mjs +1 -1
- package/dist/components/Form/elements/FormElement.cjs +1 -1
- package/dist/components/Form/elements/FormElement.mjs +1 -1
- package/dist/components/Form/elements/InputElement.cjs +1 -1
- package/dist/components/Form/elements/InputElement.mjs +1 -1
- package/dist/components/Form/elements/InputPasswordElement.cjs +1 -1
- package/dist/components/Form/elements/InputPasswordElement.mjs +1 -1
- package/dist/components/Form/elements/MultiselectElement.cjs +1 -1
- package/dist/components/Form/elements/MultiselectElement.mjs +1 -1
- package/dist/components/Form/elements/SelectElement.cjs +1 -1
- package/dist/components/Form/elements/SelectElement.mjs +1 -1
- package/dist/components/Form/elements/SwitchSelectorElement.cjs +1 -1
- package/dist/components/Form/elements/SwitchSelectorElement.mjs +1 -1
- package/dist/components/Form/elements/TextAreaElement.cjs +1 -1
- package/dist/components/Form/elements/TextAreaElement.mjs +1 -1
- package/dist/components/Form/elements/index.cjs +1 -1
- package/dist/components/Form/elements/index.mjs +1 -1
- package/dist/components/Form/index.cjs +1 -1
- package/dist/components/Form/index.mjs +1 -1
- package/dist/components/Form/layout/FormItemLayout.cjs +1 -1
- package/dist/components/Form/layout/FormItemLayout.d.ts.map +1 -1
- package/dist/components/Form/layout/FormItemLayout.mjs +1 -1
- package/dist/components/Form/layout/index.cjs +1 -1
- package/dist/components/Form/layout/index.mjs +1 -1
- package/dist/components/IDE/Code.cjs +1 -1
- package/dist/components/IDE/Code.cjs.map +1 -1
- package/dist/components/IDE/Code.mjs +1 -1
- package/dist/components/IDE/Code.mjs.map +1 -1
- package/dist/components/IDE/CodeContext.cjs +1 -1
- package/dist/components/IDE/CodeContext.mjs +1 -1
- package/dist/components/Link/Link.cjs +3 -4
- package/dist/components/Link/Link.cjs.map +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Link/Link.d.ts.map +1 -1
- package/dist/components/Link/Link.mjs +3 -4
- package/dist/components/Link/Link.mjs.map +1 -1
- package/dist/components/Loader/index.cjs +6 -1
- package/dist/components/Loader/index.cjs.map +1 -1
- package/dist/components/Loader/index.content.cjs +23 -0
- package/dist/components/Loader/index.content.cjs.map +1 -0
- package/dist/components/Loader/index.content.d.ts +8 -0
- package/dist/components/Loader/index.content.d.ts.map +1 -0
- package/dist/components/Loader/index.content.mjs +23 -0
- package/dist/components/Loader/index.content.mjs.map +1 -0
- package/dist/components/Loader/index.d.ts +2 -2
- package/dist/components/Loader/index.d.ts.map +1 -1
- package/dist/components/Loader/index.mjs +6 -1
- package/dist/components/Loader/index.mjs.map +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +1 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +1 -1
- package/dist/components/MarkDownRender/index.cjs +39 -4
- package/dist/components/MarkDownRender/index.cjs.map +1 -1
- package/dist/components/MarkDownRender/index.d.ts.map +1 -1
- package/dist/components/MarkDownRender/index.mjs +40 -5
- package/dist/components/MarkDownRender/index.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +19 -11
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.mjs +20 -12
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs +1 -1
- package/dist/components/Navbar/index.cjs +1 -1
- package/dist/components/Navbar/index.mjs +1 -1
- package/dist/components/SwitchSelector/index.cjs +1 -1
- package/dist/components/SwitchSelector/index.mjs +1 -1
- package/dist/components/TabSelector/TabSelector.cjs +1 -1
- package/dist/components/TabSelector/TabSelector.mjs +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/index.cjs +1 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +2 -1
- package/dist/hooks/intlayerAPIHooks.cjs +2 -0
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts +50 -49
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +2 -0
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.cjs +81 -78
- package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.d.ts +5 -25
- package/dist/hooks/useAsync/useAsync.d.ts.map +1 -1
- package/dist/hooks/useAsync/useAsync.mjs +81 -78
- package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.cjs +2 -2
- package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.d.ts +1 -1
- package/dist/hooks/useAsync/useAsyncStateStore.mjs +2 -2
- package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
- package/dist/hooks/useGetAllDictionaries.cjs +2 -2
- package/dist/hooks/useGetAllDictionaries.cjs.map +1 -1
- package/dist/hooks/useGetAllDictionaries.d.ts +1 -1
- package/dist/hooks/useGetAllDictionaries.d.ts.map +1 -1
- package/dist/hooks/useGetAllDictionaries.mjs +2 -2
- package/dist/hooks/useGetAllDictionaries.mjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.cjs +2 -2
- package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.d.ts +59 -58
- package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
- package/dist/hooks/useIntlayerAPI.mjs +1 -1
- package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
- package/dist/hooks/usePersistedStore.cjs +7 -5
- package/dist/hooks/usePersistedStore.cjs.map +1 -1
- package/dist/hooks/usePersistedStore.d.ts.map +1 -1
- package/dist/hooks/usePersistedStore.mjs +7 -5
- package/dist/hooks/usePersistedStore.mjs.map +1 -1
- package/dist/index-DFc7og1d.cjs +671 -0
- package/dist/index-DFc7og1d.cjs.map +1 -0
- package/dist/index-DcWYZrJW.js +672 -0
- package/dist/index-DcWYZrJW.js.map +1 -0
- package/dist/libs/intlayer-api/ai.cjs +11 -1
- package/dist/libs/intlayer-api/ai.cjs.map +1 -1
- package/dist/libs/intlayer-api/ai.d.ts +3 -1
- package/dist/libs/intlayer-api/ai.d.ts.map +1 -1
- package/dist/libs/intlayer-api/ai.mjs +11 -1
- package/dist/libs/intlayer-api/ai.mjs.map +1 -1
- package/dist/libs/intlayer-api/index.d.ts +2 -0
- package/dist/libs/intlayer-api/index.d.ts.map +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +18 -16
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "./components/Button/Button.mjs";
|
|
3
|
+
import { j as jsxRuntimeExports } from "./jsx-runtime-DaNGiM0W.js";
|
|
4
|
+
import { useFormContext } from "react-hook-form";
|
|
5
|
+
import { Input } from "./components/Input/Input.mjs";
|
|
6
|
+
import { InputPassword } from "./components/Input/InputPassword.mjs";
|
|
7
|
+
import { Checkbox } from "./components/Input/Checkbox.mjs";
|
|
8
|
+
import { TextArea } from "./components/TextArea/TextArea.mjs";
|
|
9
|
+
import { EditableFieldInput } from "./components/EditableField/EditableFieldInput.mjs";
|
|
10
|
+
import { EditableFieldTextArea } from "./components/EditableField/EditableFieldTextArea.mjs";
|
|
11
|
+
import { AutoSizedTextArea } from "./components/TextArea/AutoSizeTextArea.mjs";
|
|
12
|
+
import { forwardRef } from "react";
|
|
13
|
+
import { MultiSelect } from "./components/Select/Multiselect.mjs";
|
|
14
|
+
import { useFormField, FormField } from "./components/Form/FormField.mjs";
|
|
15
|
+
import { FormLabelLayout } from "./components/Form/layout/FormLabelLayout.mjs";
|
|
16
|
+
import { Select } from "./components/Select/Select.mjs";
|
|
17
|
+
import { SwitchSelector } from "./components/SwitchSelector/index.mjs";
|
|
18
|
+
import { Form as Form$1 } from "./components/Form/FormBase.mjs";
|
|
19
|
+
import { FormControl } from "./components/Form/FormControl.mjs";
|
|
20
|
+
import { FormDescription } from "./components/Form/FormDescription.mjs";
|
|
21
|
+
import { FormItem } from "./components/Form/FormItem.mjs";
|
|
22
|
+
import { FormMessage } from "./components/Form/FormMessage.mjs";
|
|
23
|
+
import "clsx";
|
|
24
|
+
import "tailwind-merge";
|
|
25
|
+
import "./components/Form/FormLabel.mjs";
|
|
26
|
+
const FormItemLayout = ({
|
|
27
|
+
label,
|
|
28
|
+
description,
|
|
29
|
+
isRequired,
|
|
30
|
+
info,
|
|
31
|
+
children,
|
|
32
|
+
showErrorMessage = true,
|
|
33
|
+
htmlFor
|
|
34
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Form.Item, { className: "w-full", children: [
|
|
35
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 leading-none", children: [
|
|
36
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(FormLabelLayout, { isRequired, info, htmlFor, children: label }),
|
|
37
|
+
description && /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Description, { children: description })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Form.Control, { children }),
|
|
40
|
+
showErrorMessage && /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Message, { "data-testid": "error-message" })
|
|
41
|
+
] });
|
|
42
|
+
const FormFieldElement = ({
|
|
43
|
+
field,
|
|
44
|
+
name,
|
|
45
|
+
label,
|
|
46
|
+
Element,
|
|
47
|
+
isRequired = false,
|
|
48
|
+
info,
|
|
49
|
+
description,
|
|
50
|
+
showErrorMessage = true,
|
|
51
|
+
...props
|
|
52
|
+
}) => {
|
|
53
|
+
const { error } = useFormField();
|
|
54
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55
|
+
FormItemLayout,
|
|
56
|
+
{
|
|
57
|
+
htmlFor: name,
|
|
58
|
+
label,
|
|
59
|
+
description,
|
|
60
|
+
isRequired,
|
|
61
|
+
info,
|
|
62
|
+
showErrorMessage,
|
|
63
|
+
"aria-invalid": !!error,
|
|
64
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Element, { "data-testid": "element", id: name, ...field, ...props, children: props.children })
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
const FormElement = (props) => {
|
|
69
|
+
const { control } = useFormContext();
|
|
70
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
71
|
+
Form.Field,
|
|
72
|
+
{
|
|
73
|
+
control,
|
|
74
|
+
name: props.name,
|
|
75
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntimeExports.jsx(FormFieldElement, { ...props, field })
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
const InputElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
80
|
+
FormElement,
|
|
81
|
+
{
|
|
82
|
+
id: props.name,
|
|
83
|
+
"data-testid": props.name,
|
|
84
|
+
Element: Input,
|
|
85
|
+
...props
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
const InputPasswordElement = ({
|
|
89
|
+
autoComplete,
|
|
90
|
+
...props
|
|
91
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
92
|
+
FormElement,
|
|
93
|
+
{
|
|
94
|
+
Element: InputPassword,
|
|
95
|
+
id: props.name,
|
|
96
|
+
"data-testid": props.name,
|
|
97
|
+
autoComplete,
|
|
98
|
+
minLength: 6,
|
|
99
|
+
maxLength: 255,
|
|
100
|
+
...props
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
const TextAreaElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
104
|
+
FormElement,
|
|
105
|
+
{
|
|
106
|
+
Element: TextArea,
|
|
107
|
+
id: props.name,
|
|
108
|
+
"data-testid": props.name,
|
|
109
|
+
...props
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
const EditableFieldInputElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
113
|
+
FormElement,
|
|
114
|
+
{
|
|
115
|
+
id: props.name,
|
|
116
|
+
"data-testid": props.name,
|
|
117
|
+
Element: EditableFieldInput,
|
|
118
|
+
...props
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
const EditableFieldTextAreaElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
122
|
+
FormElement,
|
|
123
|
+
{
|
|
124
|
+
id: props.name,
|
|
125
|
+
"data-testid": props.name,
|
|
126
|
+
Element: EditableFieldTextArea,
|
|
127
|
+
...props
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
const AutoSizedTextAreaElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
131
|
+
FormElement,
|
|
132
|
+
{
|
|
133
|
+
Element: AutoSizedTextArea,
|
|
134
|
+
id: props.name,
|
|
135
|
+
"data-testid": props.name,
|
|
136
|
+
...props
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
const CheckboxComponent = forwardRef(
|
|
140
|
+
({ inputLabel, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { ref, ...props, label: inputLabel })
|
|
141
|
+
);
|
|
142
|
+
CheckboxComponent.displayName = "CheckboxComponent";
|
|
143
|
+
const CheckboxElement = ({
|
|
144
|
+
autoComplete,
|
|
145
|
+
...props
|
|
146
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147
|
+
FormElement,
|
|
148
|
+
{
|
|
149
|
+
Element: CheckboxComponent,
|
|
150
|
+
id: props.name,
|
|
151
|
+
"data-testid": props.name,
|
|
152
|
+
autoComplete,
|
|
153
|
+
minLength: 6,
|
|
154
|
+
maxLength: 255,
|
|
155
|
+
...props
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
const MultiSelectElement = ({
|
|
159
|
+
name,
|
|
160
|
+
description,
|
|
161
|
+
label,
|
|
162
|
+
isRequired,
|
|
163
|
+
info,
|
|
164
|
+
showErrorMessage,
|
|
165
|
+
children,
|
|
166
|
+
...props
|
|
167
|
+
}) => {
|
|
168
|
+
const { control } = useFormContext();
|
|
169
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
170
|
+
Form.Field,
|
|
171
|
+
{
|
|
172
|
+
control,
|
|
173
|
+
name,
|
|
174
|
+
render: ({ field }) => {
|
|
175
|
+
const { error } = useFormField();
|
|
176
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
177
|
+
FormItemLayout,
|
|
178
|
+
{
|
|
179
|
+
htmlFor: name,
|
|
180
|
+
label,
|
|
181
|
+
description,
|
|
182
|
+
isRequired,
|
|
183
|
+
info,
|
|
184
|
+
showErrorMessage,
|
|
185
|
+
"aria-invalid": !!error,
|
|
186
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
187
|
+
MultiSelect,
|
|
188
|
+
{
|
|
189
|
+
onValueChange: field.onChange,
|
|
190
|
+
values: field.value,
|
|
191
|
+
...props,
|
|
192
|
+
children
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
const SelectElement = ({
|
|
202
|
+
name,
|
|
203
|
+
description,
|
|
204
|
+
label,
|
|
205
|
+
isRequired,
|
|
206
|
+
info,
|
|
207
|
+
showErrorMessage,
|
|
208
|
+
children,
|
|
209
|
+
...props
|
|
210
|
+
}) => {
|
|
211
|
+
const { control } = useFormContext();
|
|
212
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
213
|
+
Form.Field,
|
|
214
|
+
{
|
|
215
|
+
control,
|
|
216
|
+
name,
|
|
217
|
+
render: ({ field }) => {
|
|
218
|
+
const { error } = useFormField();
|
|
219
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
220
|
+
FormItemLayout,
|
|
221
|
+
{
|
|
222
|
+
htmlFor: name,
|
|
223
|
+
label,
|
|
224
|
+
description,
|
|
225
|
+
isRequired,
|
|
226
|
+
info,
|
|
227
|
+
showErrorMessage,
|
|
228
|
+
"aria-invalid": !!error,
|
|
229
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
230
|
+
Select,
|
|
231
|
+
{
|
|
232
|
+
onValueChange: field.onChange,
|
|
233
|
+
defaultValue: field.value,
|
|
234
|
+
...props,
|
|
235
|
+
children
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
};
|
|
244
|
+
const SwitchSelectorElement = ({
|
|
245
|
+
name,
|
|
246
|
+
description,
|
|
247
|
+
label,
|
|
248
|
+
isRequired,
|
|
249
|
+
info,
|
|
250
|
+
showErrorMessage,
|
|
251
|
+
children,
|
|
252
|
+
...props
|
|
253
|
+
}) => {
|
|
254
|
+
const { control } = useFormContext();
|
|
255
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
256
|
+
Form.Field,
|
|
257
|
+
{
|
|
258
|
+
control,
|
|
259
|
+
name,
|
|
260
|
+
render: ({ field }) => {
|
|
261
|
+
const { error } = useFormField();
|
|
262
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
263
|
+
FormItemLayout,
|
|
264
|
+
{
|
|
265
|
+
htmlFor: name,
|
|
266
|
+
label,
|
|
267
|
+
description,
|
|
268
|
+
isRequired,
|
|
269
|
+
info,
|
|
270
|
+
showErrorMessage,
|
|
271
|
+
"aria-invalid": !!error,
|
|
272
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchSelector, { ...field, ...props, children })
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
const Form = Form$1;
|
|
280
|
+
Form.Description = FormDescription;
|
|
281
|
+
Form.Control = FormControl;
|
|
282
|
+
Form.Field = FormField;
|
|
283
|
+
Form.Item = FormItem;
|
|
284
|
+
Form.Label = FormLabelLayout;
|
|
285
|
+
Form.Message = FormMessage;
|
|
286
|
+
Form.Element = FormElement;
|
|
287
|
+
Form.Input = InputElement;
|
|
288
|
+
Form.InputPassword = InputPasswordElement;
|
|
289
|
+
Form.Checkbox = CheckboxElement;
|
|
290
|
+
Form.TextArea = TextAreaElement;
|
|
291
|
+
Form.AutoSizedTextArea = AutoSizedTextAreaElement;
|
|
292
|
+
Form.Button = Button;
|
|
293
|
+
Form.Select = SelectElement;
|
|
294
|
+
Form.MultiSelect = MultiSelectElement;
|
|
295
|
+
Form.EditableFieldInput = EditableFieldInputElement;
|
|
296
|
+
Form.EditableFieldTextArea = EditableFieldTextAreaElement;
|
|
297
|
+
Form.SwitchSelector = SwitchSelectorElement;
|
|
298
|
+
export {
|
|
299
|
+
CheckboxElement as C,
|
|
300
|
+
EditableFieldInputElement as E,
|
|
301
|
+
Form as F,
|
|
302
|
+
InputElement as I,
|
|
303
|
+
MultiSelectElement as M,
|
|
304
|
+
SelectElement as S,
|
|
305
|
+
TextAreaElement as T,
|
|
306
|
+
FormElement as a,
|
|
307
|
+
InputPasswordElement as b,
|
|
308
|
+
EditableFieldTextAreaElement as c,
|
|
309
|
+
FormItemLayout as d,
|
|
310
|
+
SwitchSelectorElement as e
|
|
311
|
+
};
|
|
312
|
+
//# sourceMappingURL=Form-BTogr-fp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form-BTogr-fp.js","sources":["../src/components/Form/layout/FormItemLayout.tsx","../src/components/Form/elements/FormElement.tsx","../src/components/Form/elements/InputElement.tsx","../src/components/Form/elements/InputPasswordElement.tsx","../src/components/Form/elements/TextAreaElement.tsx","../src/components/Form/elements/EditableFieldInputElement.tsx","../src/components/Form/elements/EditableFieldTextAreaElement.tsx","../src/components/Form/elements/AutoSizeTextAreaElement.tsx","../src/components/Form/elements/CheckboxElement.tsx","../src/components/Form/elements/MultiselectElement.tsx","../src/components/Form/elements/SelectElement.tsx","../src/components/Form/elements/SwitchSelectorElement.tsx","../src/components/Form/Form.tsx"],"sourcesContent":["/* eslint-disable import/no-cycle */\nimport type { FC, ReactNode } from 'react';\nimport { Form } from '../Form';\nimport { FormLabelLayout, type FormLabelLayoutProps } from './FormLabelLayout';\n\nexport type FormItemLayoutProps = Omit<FormLabelLayoutProps, 'children'> & {\n label?: ReactNode;\n description?: ReactNode;\n children: ReactNode;\n showErrorMessage?: boolean;\n};\n\nexport const FormItemLayout: FC<FormItemLayoutProps> = ({\n label,\n description,\n isRequired,\n info,\n children,\n showErrorMessage = true,\n htmlFor,\n}) => (\n <Form.Item className=\"w-full\">\n <div className=\"space-y-1 leading-none\">\n <FormLabelLayout isRequired={isRequired} info={info} htmlFor={htmlFor}>\n {label}\n </FormLabelLayout>\n {description && <Form.Description>{description}</Form.Description>}\n </div>\n <Form.Control>{children}</Form.Control>\n\n {showErrorMessage && <Form.Message data-testid=\"error-message\" />}\n </Form.Item>\n);\n","/* eslint-disable import/no-cycle */\n'use client';\n\nimport type { ComponentProps, ElementType, ReactNode } from 'react';\nimport {\n useFormContext,\n type ControllerRenderProps,\n type FieldValues,\n} from 'react-hook-form';\nimport { Form } from '../Form';\nimport { useFormField } from '../FormField';\nimport { FormItemLayout, FormItemLayoutProps } from '../layout';\n\nexport type FormElementProps<T extends ElementType> = {\n name: string;\n Element: T;\n label?: ReactNode;\n isRequired?: boolean;\n info?: string;\n showErrorMessage?: boolean;\n focus?: boolean;\n} & Omit<FormItemLayoutProps, 'children'>;\n\ntype FormFieldElementProps<T extends ElementType> = FormElementProps<T> &\n ComponentProps<T> & {\n field: ControllerRenderProps<FieldValues, string>;\n };\n\nconst FormFieldElement = <T extends ElementType>({\n field,\n name,\n label,\n Element,\n isRequired = false,\n info,\n description,\n showErrorMessage = true,\n ...props\n}: FormFieldElementProps<T>) => {\n const { error } = useFormField();\n\n return (\n <FormItemLayout\n htmlFor={name}\n label={label}\n description={description}\n isRequired={isRequired}\n info={info}\n showErrorMessage={showErrorMessage}\n aria-invalid={!!error}\n >\n <Element data-testid=\"element\" id={name} {...field} {...props}>\n {props.children}\n </Element>\n </FormItemLayout>\n );\n};\n\n/**\n * FormElement is a component that allows you to create a form element with a label, description, error message, and validation.\n *\n * The Element prop is the type of the element that will be rendered.\n * This element will interact with the FormContext and will be controlled by the FormControl component.\n * The props used to control the element will be `value` and `onChange`.\n */\nexport const FormElement = <T extends ElementType>(\n props: FormElementProps<T> & ComponentProps<T>\n) => {\n const { control } = useFormContext();\n\n return (\n <Form.Field\n control={control}\n name={props.name}\n render={({ field }) => <FormFieldElement {...props} field={field} />}\n />\n );\n};\n","/* eslint-disable import/no-cycle */\nimport type { ComponentProps, FC } from 'react';\nimport { Input } from '../../../components/Input';\nimport { FormElementProps, FormElement } from './FormElement';\n\ntype InputElementProps = Omit<FormElementProps<typeof Input>, 'Element'> &\n ComponentProps<typeof Input> & {\n name: string;\n };\n\nexport const InputElement: FC<InputElementProps> = (props) => (\n <FormElement\n id={props.name}\n data-testid={props.name}\n Element={Input}\n {...props}\n />\n);\n","/* eslint-disable import/no-cycle */\nimport type { ComponentProps, FC } from 'react';\nimport { InputPassword } from '../../Input';\nimport { FormElementProps, FormElement } from './FormElement';\n\ntype InputPasswordElementProps = Omit<\n FormElementProps<typeof InputPassword>,\n 'Element'\n> &\n ComponentProps<typeof InputPassword> & {\n name: string;\n autoComplete: 'current-password' | 'new-password';\n };\n\nexport const InputPasswordElement: FC<InputPasswordElementProps> = ({\n autoComplete,\n ...props\n}) => (\n <FormElement\n Element={InputPassword}\n id={props.name}\n data-testid={props.name}\n autoComplete={autoComplete}\n minLength={6}\n maxLength={255}\n {...props}\n />\n);\n","/* eslint-disable import/no-cycle */\nimport type { FC } from 'react';\nimport { TextArea } from '../../TextArea/TextArea';\nimport { FormElement, type FormElementProps } from './FormElement';\n\ntype TextAreaElementsProps = Omit<\n FormElementProps<typeof TextArea>,\n 'Element'\n> &\n React.ComponentProps<typeof TextArea> & {\n name: string;\n };\n\nexport const TextAreaElement: FC<TextAreaElementsProps> = (props) => (\n <FormElement\n Element={TextArea}\n id={props.name}\n data-testid={props.name}\n {...props}\n />\n);\n","/* eslint-disable import/no-cycle */\nimport type { ComponentProps, ReactNode } from 'react';\nimport { EditableFieldInput } from '../../EditableField/EditableFieldInput';\nimport { FormElement, type FormElementProps } from './FormElement';\n\ntype EditableFieldInputElementProps = Omit<\n FormElementProps<typeof EditableFieldInput>,\n 'Element'\n> &\n Omit<ComponentProps<typeof EditableFieldInput>, 'onChange'> & {\n name: string;\n description?: ReactNode;\n placeholder?: string;\n className?: string;\n children?: ReactNode;\n };\n\nexport const EditableFieldInputElement = (\n props: EditableFieldInputElementProps\n) => (\n <FormElement\n id={props.name}\n data-testid={props.name}\n Element={EditableFieldInput}\n {...props}\n />\n);\n","/* eslint-disable import/no-cycle */\n\nimport type { ComponentProps, ReactNode } from 'react';\nimport { EditableFieldTextArea } from '../../EditableField/EditableFieldTextArea';\nimport { FormElement, type FormElementProps } from './FormElement';\n\ntype EditableFieldTextAreaElementProps = Omit<\n FormElementProps<typeof EditableFieldTextArea>,\n 'Element'\n> &\n Omit<ComponentProps<typeof EditableFieldTextArea>, 'onChange'> & {\n name: string;\n description?: ReactNode;\n placeholder?: string;\n className?: string;\n children?: ReactNode;\n };\n\nexport const EditableFieldTextAreaElement = (\n props: EditableFieldTextAreaElementProps\n) => (\n <FormElement\n id={props.name}\n data-testid={props.name}\n Element={EditableFieldTextArea}\n {...props}\n />\n);\n","import type { FC } from 'react';\nimport { AutoSizedTextArea } from '../../TextArea/AutoSizeTextArea';\nimport { FormElement, type FormElementProps } from './FormElement';\n\ntype AutoSizedTextAreaElementsProps = Omit<\n FormElementProps<typeof AutoSizedTextArea>,\n 'Element'\n> &\n React.ComponentProps<typeof AutoSizedTextArea> & {\n name: string;\n };\n\nexport const AutoSizedTextAreaElement: FC<AutoSizedTextAreaElementsProps> = (\n props\n) => (\n <FormElement\n Element={AutoSizedTextArea}\n id={props.name}\n data-testid={props.name}\n {...props}\n />\n);\n","/* eslint-disable import/no-cycle */\nimport { forwardRef, type ComponentProps, type FC } from 'react';\nimport { Checkbox } from '../../Input';\nimport { FormElementProps, FormElement } from './FormElement';\n\ntype CheckboxElementProps = Omit<FormElementProps<typeof Checkbox>, 'Element'> &\n ComponentProps<typeof Checkbox> & {\n name: string;\n inputLabel?: string;\n };\n\ntype CheckboxComponentProps = Omit<ComponentProps<typeof Checkbox>, 'label'> & {\n name: string;\n inputLabel?: ComponentProps<typeof Checkbox>['label'];\n};\n\nconst CheckboxComponent = forwardRef<HTMLInputElement, CheckboxComponentProps>(\n ({ inputLabel, ...props }, ref) => (\n <Checkbox ref={ref} {...props} label={inputLabel} />\n )\n);\nCheckboxComponent.displayName = 'CheckboxComponent';\n\nexport const CheckboxElement: FC<CheckboxElementProps> = ({\n autoComplete,\n ...props\n}) => (\n <FormElement\n Element={CheckboxComponent}\n id={props.name}\n data-testid={props.name}\n autoComplete={autoComplete}\n minLength={6}\n maxLength={255}\n {...props}\n />\n);\n","/* eslint-disable import/no-cycle */\nimport type { ComponentProps, ReactNode } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { MultiSelect } from '../../Select/Multiselect';\nimport { Form } from '../Form';\nimport { useFormField } from '../FormField';\nimport { FormItemLayout } from '../layout/FormItemLayout';\nimport type { FormElementProps } from './FormElement';\n\ntype SelectElementsProps = Omit<\n FormElementProps<typeof MultiSelect>,\n 'Element'\n> &\n ComponentProps<typeof MultiSelect> & {\n name: string;\n description?: string;\n placeholder?: string;\n className?: string;\n children?: ReactNode;\n };\n\nexport const MultiSelectElement = ({\n name,\n description,\n label,\n isRequired,\n info,\n showErrorMessage,\n children,\n ...props\n}: SelectElementsProps) => {\n const { control } = useFormContext();\n\n return (\n <Form.Field\n control={control}\n name={name}\n render={({ field }) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks, sonarjs/rules-of-hooks\n const { error } = useFormField();\n\n return (\n <FormItemLayout\n htmlFor={name}\n label={label}\n description={description}\n isRequired={isRequired}\n info={info}\n showErrorMessage={showErrorMessage}\n aria-invalid={!!error}\n >\n <MultiSelect\n onValueChange={field.onChange}\n values={field.value}\n {...props}\n >\n {children}\n </MultiSelect>\n </FormItemLayout>\n );\n }}\n />\n );\n};\n","/* eslint-disable react-hooks/rules-of-hooks */\n/* eslint-disable import/no-cycle */\nimport type { ComponentProps, ReactNode } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { Select } from '../../Select/Select';\nimport { Form } from '../Form';\nimport { useFormField } from '../FormField';\nimport { FormItemLayout } from '../layout/FormItemLayout';\nimport type { FormElementProps } from './FormElement';\n\ntype SelectElementsProps = Omit<FormElementProps<typeof Select>, 'Element'> &\n ComponentProps<typeof Select> & {\n name: string;\n description?: string;\n placeholder?: string;\n className?: string;\n children?: ReactNode;\n };\n\nexport const SelectElement = ({\n name,\n description,\n label,\n isRequired,\n info,\n showErrorMessage,\n children,\n ...props\n}: SelectElementsProps) => {\n const { control } = useFormContext();\n\n return (\n <Form.Field\n control={control}\n name={name}\n render={({ field }) => {\n const { error } = useFormField();\n\n return (\n <FormItemLayout\n htmlFor={name}\n label={label}\n description={description}\n isRequired={isRequired}\n info={info}\n showErrorMessage={showErrorMessage}\n aria-invalid={!!error}\n >\n <Select\n onValueChange={field.onChange}\n defaultValue={field.value}\n {...props}\n >\n {children}\n </Select>\n </FormItemLayout>\n );\n }}\n />\n );\n};\n","/* eslint-disable import/no-cycle */\nimport type { ComponentProps, ReactNode } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { SwitchSelector } from '../../SwitchSelector';\nimport { Form } from '../Form';\nimport { useFormField } from '../FormField';\nimport { FormItemLayout } from '../layout/FormItemLayout';\nimport type { FormElementProps } from './FormElement';\n\ntype SwitchSelectorElementProps = Omit<\n FormElementProps<typeof SwitchSelector>,\n 'Element'\n> &\n ComponentProps<typeof SwitchSelector> & {\n name: string;\n description?: string;\n placeholder?: string;\n className?: string;\n children?: ReactNode;\n };\n\nexport const SwitchSelectorElement = ({\n name,\n description,\n label,\n isRequired,\n info,\n showErrorMessage,\n children,\n ...props\n}: SwitchSelectorElementProps) => {\n const { control } = useFormContext();\n\n return (\n <Form.Field\n control={control}\n name={name}\n render={({ field }) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const { error } = useFormField();\n\n return (\n <FormItemLayout\n htmlFor={name}\n label={label}\n description={description}\n isRequired={isRequired}\n info={info}\n showErrorMessage={showErrorMessage}\n aria-invalid={!!error}\n >\n <SwitchSelector {...field} {...props}>\n {children}\n </SwitchSelector>\n </FormItemLayout>\n );\n }}\n />\n );\n};\n","/* eslint-disable import/no-cycle */\nimport { Button } from '../Button';\nimport {\n FormElement,\n InputElement,\n InputPasswordElement,\n TextAreaElement,\n} from './elements';\nimport { AutoSizedTextAreaElement } from './elements/AutoSizeTextAreaElement';\nimport { CheckboxElement } from './elements/CheckboxElement';\nimport { EditableFieldInputElement } from './elements/EditableFieldInputElement';\nimport { EditableFieldTextAreaElement } from './elements/EditableFieldTextAreaElement';\nimport { MultiSelectElement } from './elements/MultiselectElement';\nimport { SelectElement } from './elements/SelectElement';\nimport { SwitchSelectorElement } from './elements/SwitchSelectorElement';\nimport { Form as FormRoot } from './FormBase';\nimport { FormControl } from './FormControl';\nimport { FormDescription } from './FormDescription';\nimport { FormField } from './FormField';\nimport { FormItem } from './FormItem';\nimport { FormMessage } from './FormMessage';\nimport { FormLabelLayout } from './layout';\n\ntype FormType = typeof FormRoot & {\n Description: typeof FormDescription;\n Control: typeof FormControl;\n Field: typeof FormField;\n Item: typeof FormItem;\n Label: typeof FormLabelLayout;\n Message: typeof FormMessage;\n Element: typeof FormElement;\n Button: typeof Button;\n Input: typeof InputElement;\n InputPassword: typeof InputPasswordElement;\n Checkbox: typeof CheckboxElement;\n TextArea: typeof TextAreaElement;\n AutoSizedTextArea: typeof AutoSizedTextAreaElement;\n MultiSelect: typeof MultiSelectElement;\n Select: typeof SelectElement;\n EditableFieldInput: typeof EditableFieldInputElement;\n EditableFieldTextArea: typeof EditableFieldTextAreaElement;\n SwitchSelector: typeof SwitchSelectorElement;\n};\n\n/**\n * Form components\n *\n * Example of usage:\n * ```jsx\n * <Form\n * schema={ZodSchema}\n * onSubmitSuccess={onSubmitSuccess}\n * onSubmitError={onSubmitError}\n * autoComplete\n * >\n * <Form.Input name=\"name\" label=\"Name\" />\n * <Form.Button type=\"submit\" label=\"Click to submit\">\n * Submit\n * </Form.Button>\n * </Form>\n * ```\n */\nexport const Form = FormRoot as FormType;\nForm.Description = FormDescription;\nForm.Control = FormControl;\nForm.Field = FormField;\nForm.Item = FormItem;\nForm.Label = FormLabelLayout;\nForm.Message = FormMessage;\nForm.Element = FormElement;\nForm.Input = InputElement;\nForm.InputPassword = InputPasswordElement;\nForm.Checkbox = CheckboxElement;\nForm.TextArea = TextAreaElement;\nForm.AutoSizedTextArea = AutoSizedTextAreaElement;\nForm.Button = Button;\nForm.Select = SelectElement;\nForm.MultiSelect = MultiSelectElement;\nForm.EditableFieldInput = EditableFieldInputElement;\nForm.EditableFieldTextArea = EditableFieldTextAreaElement;\nForm.SwitchSelector = SwitchSelectorElement;\n"],"names":["jsxs","jsx","FormRoot"],"mappings":"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"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "./components/Button/Button.mjs";
|
|
3
|
+
import { j as jsxRuntimeExports } from "./jsx-runtime-DaNGiM0W.js";
|
|
4
|
+
import { useFormContext } from "react-hook-form";
|
|
5
|
+
import { Input } from "./components/Input/Input.mjs";
|
|
6
|
+
import { InputPassword } from "./components/Input/InputPassword.mjs";
|
|
7
|
+
import { Checkbox } from "./components/Input/Checkbox.mjs";
|
|
8
|
+
import { TextArea } from "./components/TextArea/TextArea.mjs";
|
|
9
|
+
import { EditableFieldInput } from "./components/EditableField/EditableFieldInput.mjs";
|
|
10
|
+
import { EditableFieldTextArea } from "./components/EditableField/EditableFieldTextArea.mjs";
|
|
11
|
+
import { AutoSizedTextArea } from "./components/TextArea/AutoSizeTextArea.mjs";
|
|
12
|
+
import { forwardRef } from "react";
|
|
13
|
+
import { MultiSelect } from "./components/Select/Multiselect.mjs";
|
|
14
|
+
import { useFormField, FormField } from "./components/Form/FormField.mjs";
|
|
15
|
+
import { FormLabelLayout } from "./components/Form/layout/FormLabelLayout.mjs";
|
|
16
|
+
import { Select } from "./components/Select/Select.mjs";
|
|
17
|
+
import { SwitchSelector } from "./components/SwitchSelector/index.mjs";
|
|
18
|
+
import { Form as Form$1 } from "./components/Form/FormBase.mjs";
|
|
19
|
+
import { FormControl } from "./components/Form/FormControl.mjs";
|
|
20
|
+
import { FormDescription } from "./components/Form/FormDescription.mjs";
|
|
21
|
+
import { FormItem } from "./components/Form/FormItem.mjs";
|
|
22
|
+
import { FormMessage } from "./components/Form/FormMessage.mjs";
|
|
23
|
+
import "clsx";
|
|
24
|
+
import "tailwind-merge";
|
|
25
|
+
import "./components/Form/FormLabel.mjs";
|
|
26
|
+
const FormItemLayout = ({
|
|
27
|
+
label,
|
|
28
|
+
description,
|
|
29
|
+
isRequired,
|
|
30
|
+
info,
|
|
31
|
+
children,
|
|
32
|
+
showErrorMessage = true,
|
|
33
|
+
htmlFor
|
|
34
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Form.Item, { className: "w-full space-y-2", children: [
|
|
35
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 leading-none", children: [
|
|
36
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(FormLabelLayout, { isRequired, info, htmlFor, children: label }),
|
|
37
|
+
description && /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Description, { children: description })
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Form.Control, { children }),
|
|
40
|
+
showErrorMessage && /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Message, { "data-testid": "error-message" })
|
|
41
|
+
] });
|
|
42
|
+
const FormFieldElement = ({
|
|
43
|
+
field,
|
|
44
|
+
name,
|
|
45
|
+
label,
|
|
46
|
+
Element,
|
|
47
|
+
isRequired = false,
|
|
48
|
+
info,
|
|
49
|
+
description,
|
|
50
|
+
showErrorMessage = true,
|
|
51
|
+
...props
|
|
52
|
+
}) => {
|
|
53
|
+
const { error } = useFormField();
|
|
54
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55
|
+
FormItemLayout,
|
|
56
|
+
{
|
|
57
|
+
htmlFor: name,
|
|
58
|
+
label,
|
|
59
|
+
description,
|
|
60
|
+
isRequired,
|
|
61
|
+
info,
|
|
62
|
+
showErrorMessage,
|
|
63
|
+
"aria-invalid": !!error,
|
|
64
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Element, { "data-testid": "element", id: name, ...field, ...props, children: props.children })
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
const FormElement = (props) => {
|
|
69
|
+
const { control } = useFormContext();
|
|
70
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
71
|
+
Form.Field,
|
|
72
|
+
{
|
|
73
|
+
control,
|
|
74
|
+
name: props.name,
|
|
75
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntimeExports.jsx(FormFieldElement, { ...props, field })
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
const InputElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
80
|
+
FormElement,
|
|
81
|
+
{
|
|
82
|
+
id: props.name,
|
|
83
|
+
"data-testid": props.name,
|
|
84
|
+
Element: Input,
|
|
85
|
+
...props
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
const InputPasswordElement = ({
|
|
89
|
+
autoComplete,
|
|
90
|
+
...props
|
|
91
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
92
|
+
FormElement,
|
|
93
|
+
{
|
|
94
|
+
Element: InputPassword,
|
|
95
|
+
id: props.name,
|
|
96
|
+
"data-testid": props.name,
|
|
97
|
+
autoComplete,
|
|
98
|
+
minLength: 6,
|
|
99
|
+
maxLength: 255,
|
|
100
|
+
...props
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
const TextAreaElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
104
|
+
FormElement,
|
|
105
|
+
{
|
|
106
|
+
Element: TextArea,
|
|
107
|
+
id: props.name,
|
|
108
|
+
"data-testid": props.name,
|
|
109
|
+
...props
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
const EditableFieldInputElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
113
|
+
FormElement,
|
|
114
|
+
{
|
|
115
|
+
id: props.name,
|
|
116
|
+
"data-testid": props.name,
|
|
117
|
+
Element: EditableFieldInput,
|
|
118
|
+
...props
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
const EditableFieldTextAreaElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
122
|
+
FormElement,
|
|
123
|
+
{
|
|
124
|
+
id: props.name,
|
|
125
|
+
"data-testid": props.name,
|
|
126
|
+
Element: EditableFieldTextArea,
|
|
127
|
+
...props
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
const AutoSizedTextAreaElement = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
131
|
+
FormElement,
|
|
132
|
+
{
|
|
133
|
+
Element: AutoSizedTextArea,
|
|
134
|
+
id: props.name,
|
|
135
|
+
"data-testid": props.name,
|
|
136
|
+
...props
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
const CheckboxComponent = forwardRef(
|
|
140
|
+
({ inputLabel, ...props }, ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { ref, ...props, label: inputLabel })
|
|
141
|
+
);
|
|
142
|
+
CheckboxComponent.displayName = "CheckboxComponent";
|
|
143
|
+
const CheckboxElement = ({
|
|
144
|
+
autoComplete,
|
|
145
|
+
...props
|
|
146
|
+
}) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147
|
+
FormElement,
|
|
148
|
+
{
|
|
149
|
+
Element: CheckboxComponent,
|
|
150
|
+
id: props.name,
|
|
151
|
+
"data-testid": props.name,
|
|
152
|
+
autoComplete,
|
|
153
|
+
minLength: 6,
|
|
154
|
+
maxLength: 255,
|
|
155
|
+
...props
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
const MultiSelectElement = ({
|
|
159
|
+
name,
|
|
160
|
+
description,
|
|
161
|
+
label,
|
|
162
|
+
isRequired,
|
|
163
|
+
info,
|
|
164
|
+
showErrorMessage,
|
|
165
|
+
children,
|
|
166
|
+
...props
|
|
167
|
+
}) => {
|
|
168
|
+
const { control } = useFormContext();
|
|
169
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
170
|
+
Form.Field,
|
|
171
|
+
{
|
|
172
|
+
control,
|
|
173
|
+
name,
|
|
174
|
+
render: ({ field }) => {
|
|
175
|
+
const { error } = useFormField();
|
|
176
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
177
|
+
FormItemLayout,
|
|
178
|
+
{
|
|
179
|
+
htmlFor: name,
|
|
180
|
+
label,
|
|
181
|
+
description,
|
|
182
|
+
isRequired,
|
|
183
|
+
info,
|
|
184
|
+
showErrorMessage,
|
|
185
|
+
"aria-invalid": !!error,
|
|
186
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
187
|
+
MultiSelect,
|
|
188
|
+
{
|
|
189
|
+
onValueChange: field.onChange,
|
|
190
|
+
values: field.value,
|
|
191
|
+
...props,
|
|
192
|
+
children
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
const SelectElement = ({
|
|
202
|
+
name,
|
|
203
|
+
description,
|
|
204
|
+
label,
|
|
205
|
+
isRequired,
|
|
206
|
+
info,
|
|
207
|
+
showErrorMessage,
|
|
208
|
+
children,
|
|
209
|
+
...props
|
|
210
|
+
}) => {
|
|
211
|
+
const { control } = useFormContext();
|
|
212
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
213
|
+
Form.Field,
|
|
214
|
+
{
|
|
215
|
+
control,
|
|
216
|
+
name,
|
|
217
|
+
render: ({ field }) => {
|
|
218
|
+
const { error } = useFormField();
|
|
219
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
220
|
+
FormItemLayout,
|
|
221
|
+
{
|
|
222
|
+
htmlFor: name,
|
|
223
|
+
label,
|
|
224
|
+
description,
|
|
225
|
+
isRequired,
|
|
226
|
+
info,
|
|
227
|
+
showErrorMessage,
|
|
228
|
+
"aria-invalid": !!error,
|
|
229
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
230
|
+
Select,
|
|
231
|
+
{
|
|
232
|
+
onValueChange: field.onChange,
|
|
233
|
+
defaultValue: field.value,
|
|
234
|
+
...props,
|
|
235
|
+
children
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
};
|
|
244
|
+
const SwitchSelectorElement = ({
|
|
245
|
+
name,
|
|
246
|
+
description,
|
|
247
|
+
label,
|
|
248
|
+
isRequired,
|
|
249
|
+
info,
|
|
250
|
+
showErrorMessage,
|
|
251
|
+
children,
|
|
252
|
+
...props
|
|
253
|
+
}) => {
|
|
254
|
+
const { control } = useFormContext();
|
|
255
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
256
|
+
Form.Field,
|
|
257
|
+
{
|
|
258
|
+
control,
|
|
259
|
+
name,
|
|
260
|
+
render: ({ field }) => {
|
|
261
|
+
const { error } = useFormField();
|
|
262
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
263
|
+
FormItemLayout,
|
|
264
|
+
{
|
|
265
|
+
htmlFor: name,
|
|
266
|
+
label,
|
|
267
|
+
description,
|
|
268
|
+
isRequired,
|
|
269
|
+
info,
|
|
270
|
+
showErrorMessage,
|
|
271
|
+
"aria-invalid": !!error,
|
|
272
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchSelector, { ...field, ...props, children })
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
const Form = Form$1;
|
|
280
|
+
Form.Description = FormDescription;
|
|
281
|
+
Form.Control = FormControl;
|
|
282
|
+
Form.Field = FormField;
|
|
283
|
+
Form.Item = FormItem;
|
|
284
|
+
Form.Label = FormLabelLayout;
|
|
285
|
+
Form.Message = FormMessage;
|
|
286
|
+
Form.Element = FormElement;
|
|
287
|
+
Form.Input = InputElement;
|
|
288
|
+
Form.InputPassword = InputPasswordElement;
|
|
289
|
+
Form.Checkbox = CheckboxElement;
|
|
290
|
+
Form.TextArea = TextAreaElement;
|
|
291
|
+
Form.AutoSizedTextArea = AutoSizedTextAreaElement;
|
|
292
|
+
Form.Button = Button;
|
|
293
|
+
Form.Select = SelectElement;
|
|
294
|
+
Form.MultiSelect = MultiSelectElement;
|
|
295
|
+
Form.EditableFieldInput = EditableFieldInputElement;
|
|
296
|
+
Form.EditableFieldTextArea = EditableFieldTextAreaElement;
|
|
297
|
+
Form.SwitchSelector = SwitchSelectorElement;
|
|
298
|
+
export {
|
|
299
|
+
CheckboxElement as C,
|
|
300
|
+
EditableFieldInputElement as E,
|
|
301
|
+
Form as F,
|
|
302
|
+
InputElement as I,
|
|
303
|
+
MultiSelectElement as M,
|
|
304
|
+
SelectElement as S,
|
|
305
|
+
TextAreaElement as T,
|
|
306
|
+
FormElement as a,
|
|
307
|
+
InputPasswordElement as b,
|
|
308
|
+
EditableFieldTextAreaElement as c,
|
|
309
|
+
FormItemLayout as d,
|
|
310
|
+
SwitchSelectorElement as e
|
|
311
|
+
};
|
|
312
|
+
//# sourceMappingURL=Form-BVkkvSKP.js.map
|