@powerhousedao/design-system 6.1.0-dev.1 → 6.1.0-dev.11
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/{checkbox-dqrYEK5V.d.ts → checkbox-Bxc7-H_k.d.ts} +2 -2
- package/dist/{checkbox-dqrYEK5V.d.ts.map → checkbox-Bxc7-H_k.d.ts.map} +1 -1
- package/dist/{command-BgTYBG_i.d.ts → command-BJKXyQyY.d.ts} +8 -8
- package/dist/{command-BgTYBG_i.d.ts.map → command-BJKXyQyY.d.ts.map} +1 -1
- package/dist/connect/components/toast/toast.js +1 -1
- package/dist/connect/index.d.ts +1 -1
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +18 -18
- package/dist/connect/index.js.map +1 -1
- package/dist/{content-OpXUtrTe.d.ts → content-Ce1V2wTc.d.ts} +2 -2
- package/dist/{content-OpXUtrTe.d.ts.map → content-Ce1V2wTc.d.ts.map} +1 -1
- package/dist/{enum-field-Db9I-jO3.d.ts → enum-field-EnFVRSOd.d.ts} +3 -3
- package/dist/{enum-field-Db9I-jO3.d.ts.map → enum-field-EnFVRSOd.d.ts.map} +1 -1
- package/dist/{id-autocomplete-jkaREmPP.d.ts → id-autocomplete-ClooY-ur.d.ts} +2 -2
- package/dist/{id-autocomplete-jkaREmPP.d.ts.map → id-autocomplete-ClooY-ur.d.ts.map} +1 -1
- package/dist/{id-autocomplete-input-container-NIuWfCB_.d.ts → id-autocomplete-input-container-O7l0T0zJ.d.ts} +2 -2
- package/dist/{id-autocomplete-input-container-NIuWfCB_.d.ts.map → id-autocomplete-input-container-O7l0T0zJ.d.ts.map} +1 -1
- package/dist/{id-autocomplete-list-Bi2IXdXg.d.ts → id-autocomplete-list-CpPWWmw0.d.ts} +2 -2
- package/dist/{id-autocomplete-list-Bi2IXdXg.d.ts.map → id-autocomplete-list-CpPWWmw0.d.ts.map} +1 -1
- package/dist/{id-autocomplete-list-option-CA9HIqEh.d.ts → id-autocomplete-list-option-QmSvQwgn.d.ts} +2 -2
- package/dist/{id-autocomplete-list-option-CA9HIqEh.d.ts.map → id-autocomplete-list-option-QmSvQwgn.d.ts.map} +1 -1
- package/dist/{index-DtPJq-vz.d.ts → index-BEiWWMW2.d.ts} +2 -2
- package/dist/{index-DtPJq-vz.d.ts.map → index-BEiWWMW2.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{radio-group-field-CY2UGZp_.d.ts → radio-group-field-DrZ_ca8t.d.ts} +2 -2
- package/dist/{radio-group-field-CY2UGZp_.d.ts.map → radio-group-field-DrZ_ca8t.d.ts.map} +1 -1
- package/dist/{select-field-BClhLm83.d.ts → select-field-B9KcyWc1.d.ts} +2 -2
- package/dist/{select-field-BClhLm83.d.ts.map → select-field-B9KcyWc1.d.ts.map} +1 -1
- package/dist/{selected-content-q33DjCYy.d.ts → selected-content-HHOKK679.d.ts} +2 -2
- package/dist/{selected-content-q33DjCYy.d.ts.map → selected-content-HHOKK679.d.ts.map} +1 -1
- package/dist/{splitted-input-diff-Ch6IKdEa.d.ts → splitted-input-diff-DZ_0mBKD.d.ts} +2 -2
- package/dist/{splitted-input-diff-Ch6IKdEa.d.ts.map → splitted-input-diff-DZ_0mBKD.d.ts.map} +1 -1
- package/dist/{src-BgCjYazJ.js → src-BgKEHW0i.js} +2 -2
- package/dist/src-BgKEHW0i.js.map +1 -0
- package/dist/{text-field-Cx-EfZP6.d.ts → text-field-CwxxUhUk.d.ts} +3 -3
- package/dist/{text-field-Cx-EfZP6.d.ts.map → text-field-CwxxUhUk.d.ts.map} +1 -1
- package/dist/{text-input-DUddj4-C.d.ts → text-input-By73a1-n.d.ts} +2 -2
- package/dist/{text-input-DUddj4-C.d.ts.map → text-input-By73a1-n.d.ts.map} +1 -1
- package/dist/{text-input-diff-4i2zuulO.d.ts → text-input-diff-C6OK2A4u.d.ts} +2 -2
- package/dist/{text-input-diff-4i2zuulO.d.ts.map → text-input-diff-C6OK2A4u.d.ts.map} +1 -1
- package/dist/ui/components/button/button.js +1 -1
- package/dist/ui/components/checkbox/checkbox-base.js +1 -1
- package/dist/ui/components/checkbox/checkbox.d.ts +1 -1
- package/dist/ui/components/checkbox/checkbox.js +1 -1
- package/dist/ui/components/command/command.d.ts +1 -1
- package/dist/ui/components/command/command.js +1 -1
- package/dist/ui/components/enum-field/enum-field.d.ts +1 -1
- package/dist/ui/components/enum-field/types.d.ts +1 -1
- package/dist/ui/components/form/form.js +1 -1
- package/dist/ui/components/form/form.js.map +1 -1
- package/dist/ui/components/form-description/form-description.js +1 -1
- package/dist/ui/components/form-label/form-label.js +1 -1
- package/dist/ui/components/form-message/form-message.js +1 -1
- package/dist/ui/components/form-message/message-list.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.js +1 -1
- package/dist/ui/components/id-autocomplete/types.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/use-id-autocomplete.d.ts +1 -1
- package/dist/ui/components/index.d.ts +16 -16
- package/dist/ui/components/input/splitted-input-diff.d.ts +1 -1
- package/dist/ui/components/input/splitted-input-diff.js +1 -1
- package/dist/ui/components/input/subcomponent/input-diff.js +1 -1
- package/dist/ui/components/input/subcomponent/text-diff.d.ts +1 -1
- package/dist/ui/components/input/subcomponent/text-diff.js +1 -1
- package/dist/ui/components/popover/popover.js +1 -1
- package/dist/ui/components/radio-group-field/radio-group-field.d.ts +1 -1
- package/dist/ui/components/radio-group-field/radio-group-field.js +1 -1
- package/dist/ui/components/radio-group-field/radio.js +1 -1
- package/dist/ui/components/search-autocomplete/search-autocomplete.js +1 -1
- package/dist/ui/components/search-autocomplete/use-search-autocomplete.js.map +1 -1
- package/dist/ui/components/select-field/content.d.ts +1 -1
- package/dist/ui/components/select-field/content.js +1 -1
- package/dist/ui/components/select-field/select-field.d.ts +1 -1
- package/dist/ui/components/select-field/select-field.js +1 -1
- package/dist/ui/components/select-field/selected-content.d.ts +1 -1
- package/dist/ui/components/select-field/selected-content.js +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.d.ts +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.js +1 -1
- package/dist/ui/components/select-field/use-select-field.d.ts +1 -1
- package/dist/ui/components/text-field/text-field.d.ts +1 -1
- package/dist/ui/components/text-input/text-input-diff.d.ts +1 -1
- package/dist/ui/components/text-input/text-input.d.ts +1 -1
- package/dist/ui/components/text-input/text-input.js +1 -1
- package/dist/ui/components/tooltip/tooltip.js +1 -1
- package/dist/ui/components/types.d.ts +1 -1
- package/dist/ui/components/with-field-validation/with-field-validation.d.ts +1 -1
- package/dist/ui/components/with-field-validation/with-field-validation.js +1 -1
- package/dist/ui/components/with-field-validation/with-field-validation.js.map +1 -1
- package/dist/ui/index.d.ts +17 -17
- package/dist/ui/types.d.ts +1 -1
- package/dist/{use-id-autocomplete-BPHVmVE8.d.ts → use-id-autocomplete-BcL_O50p.d.ts} +2 -2
- package/dist/{use-id-autocomplete-BPHVmVE8.d.ts.map → use-id-autocomplete-BcL_O50p.d.ts.map} +1 -1
- package/dist/{with-field-validation-vt0l1Sp7.d.ts → with-field-validation-BIac25Sm.d.ts} +2 -2
- package/dist/{with-field-validation-vt0l1Sp7.d.ts.map → with-field-validation-BIac25Sm.d.ts.map} +1 -1
- package/package.json +4 -4
- package/dist/src-BgCjYazJ.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as WithDifference, f as FieldErrorHandling } from "./index-
|
|
2
|
-
import { n as TextInputProps } from "./text-input-
|
|
1
|
+
import { _ as WithDifference, f as FieldErrorHandling } from "./index-BEiWWMW2.js";
|
|
2
|
+
import { n as TextInputProps } from "./text-input-By73a1-n.js";
|
|
3
3
|
import * as react from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/ui/components/text-field/text-field.d.ts
|
|
@@ -7,4 +7,4 @@ type TextFieldProps = TextInputProps & FieldErrorHandling & WithDifference<strin
|
|
|
7
7
|
declare const TextField: react.ForwardRefExoticComponent<TextInputProps & FieldErrorHandling & WithDifference<string> & react.RefAttributes<HTMLInputElement>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { TextFieldProps as n, TextField as t };
|
|
10
|
-
//# sourceMappingURL=text-field-
|
|
10
|
+
//# sourceMappingURL=text-field-CwxxUhUk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field-
|
|
1
|
+
{"version":3,"file":"text-field-CwxxUhUk.d.ts","names":[],"sources":["../src/ui/components/text-field/text-field.tsx"],"mappings":";;;;;KAMY,cAAA,GAAiB,cAAA,GAC3B,kBAAA,GACA,cAAA;AAAA,cAEW,SAAA,EAAS,KAAA,CAAA,yBAAA,CAAA,cAAA,GAAA,kBAAA,GAAA,cAAA,WAAA,KAAA,CAAA,aAAA,CAAA,gBAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as WithDifference, p as InputBaseProps, u as DiffMode } from "./index-
|
|
1
|
+
import { _ as WithDifference, p as InputBaseProps, u as DiffMode } from "./index-BEiWWMW2.js";
|
|
2
2
|
import { t as CommonTextProps } from "./types-BfmDXMrz.js";
|
|
3
3
|
import * as react from "react";
|
|
4
4
|
|
|
@@ -11,4 +11,4 @@ interface TextInputProps extends Omit<InputBaseProps<string> & Omit<React.InputH
|
|
|
11
11
|
declare const TextInput: react.ForwardRefExoticComponent<TextInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { TextInputProps as n, TextInput as t };
|
|
14
|
-
//# sourceMappingURL=text-input-
|
|
14
|
+
//# sourceMappingURL=text-input-By73a1-n.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input-
|
|
1
|
+
{"version":3,"file":"text-input-By73a1-n.d.ts","names":[],"sources":["../src/ui/components/text-input/text-input.tsx"],"mappings":";;;;;UAeU,cAAA,SAEN,IAAA,CACE,cAAA,WACE,IAAA,CAAK,KAAA,CAAM,mBAAA,CAAoB,gBAAA,gBAC/B,eAAA,6BAGJ,IAAA,CAAK,cAAA;EACP,KAAA;EACA,YAAA;EACA,QAAA,GAAW,OAAA,CAAQ,QAAA;AAAA;AAAA,cAGf,SAAA,EAAS,KAAA,CAAA,yBAAA,CAAA,cAAA,GAAA,KAAA,CAAA,aAAA,CAAA,gBAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as WithDifference } from "./index-
|
|
1
|
+
import { _ as WithDifference } from "./index-BEiWWMW2.js";
|
|
2
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/ui/components/text-input/text-input-diff.d.ts
|
|
@@ -17,4 +17,4 @@ declare const TextInputDiff: ({
|
|
|
17
17
|
}: TextInputDiffProps) => react_jsx_runtime0.JSX.Element;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { TextInputDiff as t };
|
|
20
|
-
//# sourceMappingURL=text-input-diff-
|
|
20
|
+
//# sourceMappingURL=text-input-diff-C6OK2A4u.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input-diff-
|
|
1
|
+
{"version":3,"file":"text-input-diff-C6OK2A4u.d.ts","names":[],"sources":["../src/ui/components/text-input/text-input-diff.tsx"],"mappings":";;;;UAKU,kBAAA,SAA2B,cAAA;EACnC,KAAA;EACA,KAAA,GAAQ,KAAA,CAAM,SAAA;EACd,QAAA;AAAA;AAAA,cAEI,aAAA;EAAiB,KAAA;EAAA,KAAA;EAAA,QAAA;EAAA,SAAA;EAAA,QAAA;EAAA;AAAA,GAOpB,kBAAA,KAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CheckboxProps, t as Checkbox } from "../../../checkbox-
|
|
1
|
+
import { n as CheckboxProps, t as Checkbox } from "../../../checkbox-Bxc7-H_k.js";
|
|
2
2
|
export { Checkbox, CheckboxProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { CheckboxBase } from "./checkbox-base.js";
|
|
3
3
|
import { FormLabel } from "../form-label/form-label.js";
|
|
4
4
|
import { FormMessageList } from "../form-message/message-list.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CommandItem, i as CommandInput, n as CommandEmpty, o as CommandList, r as CommandGroup, s as CommandLoading, t as Command } from "../../../command-
|
|
1
|
+
import { a as CommandItem, i as CommandInput, n as CommandEmpty, o as CommandList, r as CommandGroup, s as CommandLoading, t as Command } from "../../../command-BJKXyQyY.js";
|
|
2
2
|
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as EnumFieldProps, t as EnumField } from "../../../enum-field-
|
|
1
|
+
import { n as EnumFieldProps, t as EnumField } from "../../../enum-field-EnFVRSOd.js";
|
|
2
2
|
export { EnumField, EnumFieldProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as SelectProps, S as SelectOption, b as RadioGroupProps, x as SelectBaseProps } from "../../../index-
|
|
1
|
+
import { C as SelectProps, S as SelectOption, b as RadioGroupProps, x as SelectBaseProps } from "../../../index-BEiWWMW2.js";
|
|
2
2
|
export { RadioGroupProps, SelectBaseProps, SelectOption, SelectProps };
|
|
@@ -107,7 +107,7 @@ const Form = /* @__PURE__ */ forwardRef(({ children, onSubmit, resetOnSuccessful
|
|
|
107
107
|
children: /* @__PURE__ */ jsx(FormServerErrorMessage, {})
|
|
108
108
|
}), /* @__PURE__ */ jsx("form", {
|
|
109
109
|
id: formId,
|
|
110
|
-
onSubmit: methods.handleSubmit(wrappedOnSubmit),
|
|
110
|
+
onSubmit: (e) => void methods.handleSubmit(wrappedOnSubmit)(e),
|
|
111
111
|
className,
|
|
112
112
|
noValidate: true,
|
|
113
113
|
children: typeof children === "function" ? children({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","names":["castValue","deepEqual","isEmpty","forwardRef","useCallback","useEffect","useId","useImperativeHandle","FormProvider","useForm","FormServerErrorMessage","defaultOnError","Form","children","onSubmit","resetOnSuccessfulSubmit","submitChangesOnly","defaultValues","renderSubmitErrorsManually","submissionErrorMatcher","className","extraFormProps","ref","formId","methods","criteriaMode","formState","isSubmitSuccessful","reset","wrappedOnSubmit","rawData","data","Object","keys","control","_fields","forEach","fieldName","includes","fromEntries","entries","filter","value","map","form","document","getElementById","key","field","querySelector","dataCast","getAttribute","error","console","errors","setError","type","message","types","serverError","triggerSubmit","dispatchEvent","Event","bubbles","root","handleSubmit"],"sources":["../../../../src/ui/components/form/form.tsx"],"sourcesContent":["import type { ValueCast } from \"#design-system/ui/lib\";\nimport { castValue, deepEqual, isEmpty } from \"#design-system/ui/lib\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n} from \"react\";\nimport type { UseFormProps, UseFormReturn } from \"react-hook-form\";\nimport { FormProvider, useForm } from \"react-hook-form\";\nimport { FormServerErrorMessage } from \"../form-message/form-server-error-message.js\";\nimport { defaultOnError } from \"./utils.js\";\n\ntype FormMethods = UseFormReturn & {\n /**\n * Trigger the form submit event\n */\n triggerSubmit: () => void;\n\n /**\n * The id of the form in the DOM\n */\n formId: string;\n};\ninterface FormProps {\n /**\n * Content of the form. Can be either React nodes or a render function that receives form methods\n * and returns React nodes. The render function approach is useful when you need access to form state\n * or methods (e.g., to disable submit button while submitting).\n */\n children: React.ReactNode | ((methods: FormMethods) => React.ReactNode);\n\n /**\n * Handler called when the form is submitted. Receives the form data as an argument.\n * The data structure will match the names of your form fields.\n *\n * @param data - An object containing the form values, keyed by field names\n */\n onSubmit: (data: any) => void | Promise<void>;\n\n /**\n * Whether to reset the form after a successful submit.\n *\n * @default false\n */\n resetOnSuccessfulSubmit?: boolean;\n\n /**\n * Whether to submit only changed values.\n *\n * When enabled, the `onSubmit` callback will only receive fields whose values differ from their\n * corresponding `defaultValues`.\n *\n * @default false\n */\n submitChangesOnly?: boolean;\n\n /**\n * Initial values for the form fields. Keys should match the 'name' props of your form fields.\n * Useful for editing existing data or setting initial state.\n */\n defaultValues?: Record<string, any>;\n\n /**\n * Whether to handle errors that happen during the submit process manually instead of showing\n * them automatically.\n *\n * @default false The errors will be rendered automatically on top of the form.\n */\n renderSubmitErrorsManually?: boolean;\n\n /**\n * Additional props to pass to the form config from react-hook-form.\n *\n * Note: this could affect the form behavior, use with caution.\n */\n extraFormProps?: UseFormProps;\n\n /**\n * Callback to match a submission error with one or more form fields or form level errors.\n *\n * @default defaultOnError The form tries to match the error with a field name by default and if it\n * doesn't match any field name, then an generic error or the error message will be shown as a form\n * level error.\n *\n * @returns An object where each key should be a field name or \"root.serverError\" for form level errors.\n * If the keys doesn't match any field name, then the UI error should be handled manually using the form\n * error state to get the message.\n */\n submissionErrorMatcher?: (\n error: Error,\n fieldNames: string[],\n ) => Record<string, string>;\n\n /**\n * Additional CSS class name to apply to the form element.\n * Use this to customize the form's styling.\n */\n className?: string;\n}\n\n/**\n * A form component that integrates with react-hook-form for form state management and validation.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Form onSubmit={handleSubmit}>\n * <StringField name=\"email\" label=\"Email\" />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n *\n * // With form methods access\n * <Form onSubmit={handleSubmit}>\n * {({ formState: { isSubmitting } }) => (\n * <>\n * <StringField name=\"email\" label=\"Email\" />\n * <Button type=\"submit\" disabled={isSubmitting}>\n * {isSubmitting ? 'Submitting...' : 'Submit'}\n * </Button>\n * </>\n * )}\n * </Form>\n *\n * // With default values\n * <Form\n * onSubmit={handleSubmit}\n * defaultValues={{\n * email: 'user@example.com'\n * }}\n * >\n * <StringField name=\"email\" label=\"Email\" />\n * </Form>\n * ```\n */\nexport const Form = forwardRef<UseFormReturn, FormProps>(\n (\n {\n children,\n onSubmit,\n resetOnSuccessfulSubmit = false,\n submitChangesOnly = false,\n defaultValues,\n renderSubmitErrorsManually = false,\n submissionErrorMatcher = defaultOnError,\n className,\n extraFormProps,\n },\n ref,\n ) => {\n const formId = useId();\n const methods = useForm({\n defaultValues,\n criteriaMode: \"all\", // display all errors at once\n ...extraFormProps,\n });\n useImperativeHandle(ref, () => methods, [methods]);\n\n useEffect(() => {\n if (resetOnSuccessfulSubmit && methods.formState.isSubmitSuccessful) {\n methods.reset({ ...(defaultValues ?? {}) });\n }\n }, [\n resetOnSuccessfulSubmit,\n methods,\n methods.formState.isSubmitSuccessful,\n defaultValues,\n ]);\n\n const wrappedOnSubmit = useCallback(\n async (rawData: Record<string, any>) => {\n try {\n let data = rawData;\n // we should make sure that empty fields are submitted as `null`\n // react-hook-form doesn't submit fields with `undefined` values\n // so we need to add them to the data as `null`\n Object.keys(methods.control._fields).forEach((fieldName) => {\n if (!Object.keys(data).includes(fieldName)) {\n data[fieldName] = null;\n }\n });\n\n if (submitChangesOnly && !!defaultValues) {\n // remove fields that didn't change it's value\n data = Object.fromEntries(\n Object.entries(rawData).filter(\n ([fieldName, value]) =>\n !deepEqual(value, defaultValues[fieldName]),\n ),\n );\n }\n\n // at this point all the fields that need to be submitted are in the data\n // we just need to make sure that \"empty\" values are submitted as `null`\n data = Object.fromEntries(\n Object.entries(data).map(([fieldName, value]) => [\n fieldName,\n isEmpty(value) ? null : value,\n ]),\n );\n\n // cast data if needed to prevent submitting wrong data type\n const form = document.getElementById(formId);\n Object.keys(data).map((key) => {\n try {\n const value: unknown = data[key];\n if (value !== null) {\n const field = form?.querySelector(`[name=\"${key}\"]`);\n const dataCast = field?.getAttribute(\"data-cast\");\n if (dataCast) {\n data[key] = castValue(\n value,\n dataCast as ValueCast,\n ) as unknown;\n }\n }\n } catch (error) {\n // print out the error but continue the execution\n console.error(error);\n }\n });\n\n // we need to return the promise from the onSubmit callback if there is one\n // so react-hook-form can wait for it to resolve and update the form state correctly\n return await onSubmit(data);\n } catch (error: any) {\n const errors = submissionErrorMatcher(\n error as Error,\n Object.keys(methods.control._fields),\n );\n\n Object.entries(errors).forEach(([key, value]) => {\n methods.setError(key, {\n type: \"serverError\",\n message: value,\n types: {\n serverError: value,\n },\n });\n });\n }\n },\n [\n methods,\n submitChangesOnly,\n defaultValues,\n formId,\n onSubmit,\n submissionErrorMatcher,\n ],\n );\n\n const triggerSubmit = useCallback(() => {\n // trigger form submit event\n const form = document.getElementById(formId);\n if (form) {\n form.dispatchEvent(new Event(\"submit\", { bubbles: true }));\n }\n }, [formId]);\n\n return (\n <FormProvider {...methods}>\n {!renderSubmitErrorsManually &&\n methods.formState.errors.root?.serverError.message && (\n <div className=\"mb-2\">\n <FormServerErrorMessage />\n </div>\n )}\n\n <form\n id={formId}\n onSubmit={methods.handleSubmit(wrappedOnSubmit)}\n className={className}\n noValidate\n >\n {typeof children === \"function\"\n ? children({\n ...methods,\n triggerSubmit,\n formId,\n })\n : children}\n </form>\n </FormProvider>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwIA,MAAaY,OAAOT,4BAEhB,EACEU,UACAC,UACAC,0BAA0B,OAC1BC,oBAAoB,OACpBC,eACAC,6BAA6B,OAC7BC,yBAAyBR,gBACzBS,WACAC,kBAEFC,QACG;CACH,MAAMC,SAASjB,OAAO;CACtB,MAAMkB,UAAUf,QAAQ;EACtBQ;EACAQ,cAAc;EACd,GAAGJ;EACJ,CAAC;AACFd,qBAAoBe,WAAWE,SAAS,CAACA,QAAQ,CAAC;AAElDnB,iBAAgB;AACd,MAAIU,2BAA2BS,QAAQE,UAAUC,mBAC/CH,SAAQI,MAAM,EAAE,GAAIX,iBAAiB,EAAE,EAAG,CAAC;IAE5C;EACDF;EACAS;EACAA,QAAQE,UAAUC;EAClBV;EACD,CAAC;CAEF,MAAMY,kBAAkBzB,YACtB,OAAO0B,YAAiC;AACtC,MAAI;GACF,IAAIC,OAAOD;AAIXE,UAAOC,KAAKT,QAAQU,QAAQC,QAAQ,CAACC,SAASC,cAAc;AAC1D,QAAI,CAACL,OAAOC,KAAKF,KAAK,CAACO,SAASD,UAAU,CACxCN,MAAKM,aAAa;KAEpB;AAEF,OAAIrB,qBAAqB,CAAC,CAACC,cAEzBc,QAAOC,OAAOO,YACZP,OAAOQ,QAAQV,QAAQ,CAACW,QACrB,CAACJ,WAAWK,WACX,CAACzC,UAAUyC,OAAOzB,cAAcoB,WACpC,CACF,CAAC;AAKHN,UAAOC,OAAOO,YACZP,OAAOQ,QAAQT,KAAK,CAACY,KAAK,CAACN,WAAWK,WAAW,CAC/CL,WACAnC,QAAQwC,MAAM,GAAG,OAAOA,MACzB,CACH,CAAC;GAGD,MAAME,OAAOC,SAASC,eAAevB,OAAO;AAC5CS,UAAOC,KAAKF,KAAK,CAACY,KAAKI,QAAQ;AAC7B,QAAI;KACF,MAAML,QAAiBX,KAAKgB;AAC5B,SAAIL,UAAU,MAAM;MAElB,MAAMQ,YADQN,MAAMK,cAAc,UAAUF,IAAG,IAAK,GAC5BI,aAAa,YAAY;AACjD,UAAID,SACFnB,MAAKgB,OAAO/C,UACV0C,OACAQ,SACU;;aAGTE,OAAO;AAEdC,aAAQD,MAAMA,MAAM;;KAEtB;AAIF,UAAO,MAAMtC,SAASiB,KAAK;WACpBqB,OAAY;GACnB,MAAME,SAASnC,uBACbiC,OACApB,OAAOC,KAAKT,QAAQU,QAAQC,QAC9B,CAAC;AAEDH,UAAOQ,QAAQc,OAAO,CAAClB,SAAS,CAACW,KAAKL,WAAW;AAC/ClB,YAAQ+B,SAASR,KAAK;KACpBS,MAAM;KACNC,SAASf;KACTgB,OAAO,EACLC,aAAajB,OACf;KACD,CAAC;KACF;;IAGN;EACElB;EACAR;EACAC;EACAM;EACAT;EACAK;EAEJ,CAAC;CAED,MAAMyC,gBAAgBxD,kBAAkB;EAEtC,MAAMwC,OAAOC,SAASC,eAAevB,OAAO;AAC5C,MAAIqB,KACFA,MAAKiB,cAAc,IAAIC,MAAM,UAAU,EAAEC,SAAS,MAAM,CAAC,CAAC;IAE3D,CAACxC,OAAO,CAAC;AAEZ,QACE,qBAAC,cAAD;EAAc,GAAIC;YAAlB,CACG,CAACN,8BACAM,QAAQE,UAAU4B,OAAOU,MAAML,YAAYF,WACzC,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,wBAAD,EAAuB,CAAA;GAE1B,CAAA,EAEH,oBAAC,QAAD;GACE,IAAIlC;GACJ,UAAUC,QAAQyC,aAAapC,gBAAgB;GACpCT;GACX,YAAA;aAEC,OAAOP,aAAa,aACjBA,SAAS;IACP,GAAGW;IACHoC;IACArC;IACD,CAAC,GACFV;GACA,CAAA,CACO;;EAGpB"}
|
|
1
|
+
{"version":3,"file":"form.js","names":["castValue","deepEqual","isEmpty","forwardRef","useCallback","useEffect","useId","useImperativeHandle","FormProvider","useForm","FormServerErrorMessage","defaultOnError","Form","children","onSubmit","resetOnSuccessfulSubmit","submitChangesOnly","defaultValues","renderSubmitErrorsManually","submissionErrorMatcher","className","extraFormProps","ref","formId","methods","criteriaMode","formState","isSubmitSuccessful","reset","wrappedOnSubmit","rawData","data","Object","keys","control","_fields","forEach","fieldName","includes","fromEntries","entries","filter","value","map","form","document","getElementById","key","field","querySelector","dataCast","getAttribute","error","console","errors","setError","type","message","types","serverError","triggerSubmit","dispatchEvent","Event","bubbles","root","e","handleSubmit"],"sources":["../../../../src/ui/components/form/form.tsx"],"sourcesContent":["import type { ValueCast } from \"#design-system/ui/lib\";\nimport { castValue, deepEqual, isEmpty } from \"#design-system/ui/lib\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n} from \"react\";\nimport type { UseFormProps, UseFormReturn } from \"react-hook-form\";\nimport { FormProvider, useForm } from \"react-hook-form\";\nimport { FormServerErrorMessage } from \"../form-message/form-server-error-message.js\";\nimport { defaultOnError } from \"./utils.js\";\n\ntype FormMethods = UseFormReturn & {\n /**\n * Trigger the form submit event\n */\n triggerSubmit: () => void;\n\n /**\n * The id of the form in the DOM\n */\n formId: string;\n};\ninterface FormProps {\n /**\n * Content of the form. Can be either React nodes or a render function that receives form methods\n * and returns React nodes. The render function approach is useful when you need access to form state\n * or methods (e.g., to disable submit button while submitting).\n */\n children: React.ReactNode | ((methods: FormMethods) => React.ReactNode);\n\n /**\n * Handler called when the form is submitted. Receives the form data as an argument.\n * The data structure will match the names of your form fields.\n *\n * @param data - An object containing the form values, keyed by field names\n */\n onSubmit: (data: any) => void | Promise<void>;\n\n /**\n * Whether to reset the form after a successful submit.\n *\n * @default false\n */\n resetOnSuccessfulSubmit?: boolean;\n\n /**\n * Whether to submit only changed values.\n *\n * When enabled, the `onSubmit` callback will only receive fields whose values differ from their\n * corresponding `defaultValues`.\n *\n * @default false\n */\n submitChangesOnly?: boolean;\n\n /**\n * Initial values for the form fields. Keys should match the 'name' props of your form fields.\n * Useful for editing existing data or setting initial state.\n */\n defaultValues?: Record<string, any>;\n\n /**\n * Whether to handle errors that happen during the submit process manually instead of showing\n * them automatically.\n *\n * @default false The errors will be rendered automatically on top of the form.\n */\n renderSubmitErrorsManually?: boolean;\n\n /**\n * Additional props to pass to the form config from react-hook-form.\n *\n * Note: this could affect the form behavior, use with caution.\n */\n extraFormProps?: UseFormProps;\n\n /**\n * Callback to match a submission error with one or more form fields or form level errors.\n *\n * @default defaultOnError The form tries to match the error with a field name by default and if it\n * doesn't match any field name, then an generic error or the error message will be shown as a form\n * level error.\n *\n * @returns An object where each key should be a field name or \"root.serverError\" for form level errors.\n * If the keys doesn't match any field name, then the UI error should be handled manually using the form\n * error state to get the message.\n */\n submissionErrorMatcher?: (\n error: Error,\n fieldNames: string[],\n ) => Record<string, string>;\n\n /**\n * Additional CSS class name to apply to the form element.\n * Use this to customize the form's styling.\n */\n className?: string;\n}\n\n/**\n * A form component that integrates with react-hook-form for form state management and validation.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Form onSubmit={handleSubmit}>\n * <StringField name=\"email\" label=\"Email\" />\n * <Button type=\"submit\">Submit</Button>\n * </Form>\n *\n * // With form methods access\n * <Form onSubmit={handleSubmit}>\n * {({ formState: { isSubmitting } }) => (\n * <>\n * <StringField name=\"email\" label=\"Email\" />\n * <Button type=\"submit\" disabled={isSubmitting}>\n * {isSubmitting ? 'Submitting...' : 'Submit'}\n * </Button>\n * </>\n * )}\n * </Form>\n *\n * // With default values\n * <Form\n * onSubmit={handleSubmit}\n * defaultValues={{\n * email: 'user@example.com'\n * }}\n * >\n * <StringField name=\"email\" label=\"Email\" />\n * </Form>\n * ```\n */\nexport const Form = forwardRef<UseFormReturn, FormProps>(\n (\n {\n children,\n onSubmit,\n resetOnSuccessfulSubmit = false,\n submitChangesOnly = false,\n defaultValues,\n renderSubmitErrorsManually = false,\n submissionErrorMatcher = defaultOnError,\n className,\n extraFormProps,\n },\n ref,\n ) => {\n const formId = useId();\n const methods = useForm({\n defaultValues,\n criteriaMode: \"all\", // display all errors at once\n ...extraFormProps,\n });\n useImperativeHandle(ref, () => methods, [methods]);\n\n useEffect(() => {\n if (resetOnSuccessfulSubmit && methods.formState.isSubmitSuccessful) {\n methods.reset({ ...(defaultValues ?? {}) });\n }\n }, [\n resetOnSuccessfulSubmit,\n methods,\n methods.formState.isSubmitSuccessful,\n defaultValues,\n ]);\n\n const wrappedOnSubmit = useCallback(\n async (rawData: Record<string, any>) => {\n try {\n let data = rawData;\n // we should make sure that empty fields are submitted as `null`\n // react-hook-form doesn't submit fields with `undefined` values\n // so we need to add them to the data as `null`\n Object.keys(methods.control._fields).forEach((fieldName) => {\n if (!Object.keys(data).includes(fieldName)) {\n data[fieldName] = null;\n }\n });\n\n if (submitChangesOnly && !!defaultValues) {\n // remove fields that didn't change it's value\n data = Object.fromEntries(\n Object.entries(rawData).filter(\n ([fieldName, value]) =>\n !deepEqual(value, defaultValues[fieldName]),\n ),\n );\n }\n\n // at this point all the fields that need to be submitted are in the data\n // we just need to make sure that \"empty\" values are submitted as `null`\n data = Object.fromEntries(\n Object.entries(data).map(([fieldName, value]) => [\n fieldName,\n isEmpty(value) ? null : value,\n ]),\n );\n\n // cast data if needed to prevent submitting wrong data type\n const form = document.getElementById(formId);\n Object.keys(data).map((key) => {\n try {\n const value: unknown = data[key];\n if (value !== null) {\n const field = form?.querySelector(`[name=\"${key}\"]`);\n const dataCast = field?.getAttribute(\"data-cast\");\n if (dataCast) {\n data[key] = castValue(\n value,\n dataCast as ValueCast,\n ) as unknown;\n }\n }\n } catch (error) {\n // print out the error but continue the execution\n console.error(error);\n }\n });\n\n // we need to return the promise from the onSubmit callback if there is one\n // so react-hook-form can wait for it to resolve and update the form state correctly\n return await onSubmit(data);\n } catch (error: any) {\n const errors = submissionErrorMatcher(\n error as Error,\n Object.keys(methods.control._fields),\n );\n\n Object.entries(errors).forEach(([key, value]) => {\n methods.setError(key, {\n type: \"serverError\",\n message: value,\n types: {\n serverError: value,\n },\n });\n });\n }\n },\n [\n methods,\n submitChangesOnly,\n defaultValues,\n formId,\n onSubmit,\n submissionErrorMatcher,\n ],\n );\n\n const triggerSubmit = useCallback(() => {\n // trigger form submit event\n const form = document.getElementById(formId);\n if (form) {\n form.dispatchEvent(new Event(\"submit\", { bubbles: true }));\n }\n }, [formId]);\n\n return (\n <FormProvider {...methods}>\n {!renderSubmitErrorsManually &&\n methods.formState.errors.root?.serverError.message && (\n <div className=\"mb-2\">\n <FormServerErrorMessage />\n </div>\n )}\n\n <form\n id={formId}\n onSubmit={(e) => void methods.handleSubmit(wrappedOnSubmit)(e)}\n className={className}\n noValidate\n >\n {typeof children === \"function\"\n ? children({\n ...methods,\n triggerSubmit,\n formId,\n })\n : children}\n </form>\n </FormProvider>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwIA,MAAaY,OAAOT,4BAEhB,EACEU,UACAC,UACAC,0BAA0B,OAC1BC,oBAAoB,OACpBC,eACAC,6BAA6B,OAC7BC,yBAAyBR,gBACzBS,WACAC,kBAEFC,QACG;CACH,MAAMC,SAASjB,OAAO;CACtB,MAAMkB,UAAUf,QAAQ;EACtBQ;EACAQ,cAAc;EACd,GAAGJ;EACJ,CAAC;AACFd,qBAAoBe,WAAWE,SAAS,CAACA,QAAQ,CAAC;AAElDnB,iBAAgB;AACd,MAAIU,2BAA2BS,QAAQE,UAAUC,mBAC/CH,SAAQI,MAAM,EAAE,GAAIX,iBAAiB,EAAE,EAAG,CAAC;IAE5C;EACDF;EACAS;EACAA,QAAQE,UAAUC;EAClBV;EACD,CAAC;CAEF,MAAMY,kBAAkBzB,YACtB,OAAO0B,YAAiC;AACtC,MAAI;GACF,IAAIC,OAAOD;AAIXE,UAAOC,KAAKT,QAAQU,QAAQC,QAAQ,CAACC,SAASC,cAAc;AAC1D,QAAI,CAACL,OAAOC,KAAKF,KAAK,CAACO,SAASD,UAAU,CACxCN,MAAKM,aAAa;KAEpB;AAEF,OAAIrB,qBAAqB,CAAC,CAACC,cAEzBc,QAAOC,OAAOO,YACZP,OAAOQ,QAAQV,QAAQ,CAACW,QACrB,CAACJ,WAAWK,WACX,CAACzC,UAAUyC,OAAOzB,cAAcoB,WACpC,CACF,CAAC;AAKHN,UAAOC,OAAOO,YACZP,OAAOQ,QAAQT,KAAK,CAACY,KAAK,CAACN,WAAWK,WAAW,CAC/CL,WACAnC,QAAQwC,MAAM,GAAG,OAAOA,MACzB,CACH,CAAC;GAGD,MAAME,OAAOC,SAASC,eAAevB,OAAO;AAC5CS,UAAOC,KAAKF,KAAK,CAACY,KAAKI,QAAQ;AAC7B,QAAI;KACF,MAAML,QAAiBX,KAAKgB;AAC5B,SAAIL,UAAU,MAAM;MAElB,MAAMQ,YADQN,MAAMK,cAAc,UAAUF,IAAG,IAAK,GAC5BI,aAAa,YAAY;AACjD,UAAID,SACFnB,MAAKgB,OAAO/C,UACV0C,OACAQ,SACU;;aAGTE,OAAO;AAEdC,aAAQD,MAAMA,MAAM;;KAEtB;AAIF,UAAO,MAAMtC,SAASiB,KAAK;WACpBqB,OAAY;GACnB,MAAME,SAASnC,uBACbiC,OACApB,OAAOC,KAAKT,QAAQU,QAAQC,QAC9B,CAAC;AAEDH,UAAOQ,QAAQc,OAAO,CAAClB,SAAS,CAACW,KAAKL,WAAW;AAC/ClB,YAAQ+B,SAASR,KAAK;KACpBS,MAAM;KACNC,SAASf;KACTgB,OAAO,EACLC,aAAajB,OACf;KACD,CAAC;KACF;;IAGN;EACElB;EACAR;EACAC;EACAM;EACAT;EACAK;EAEJ,CAAC;CAED,MAAMyC,gBAAgBxD,kBAAkB;EAEtC,MAAMwC,OAAOC,SAASC,eAAevB,OAAO;AAC5C,MAAIqB,KACFA,MAAKiB,cAAc,IAAIC,MAAM,UAAU,EAAEC,SAAS,MAAM,CAAC,CAAC;IAE3D,CAACxC,OAAO,CAAC;AAEZ,QACE,qBAAC,cAAD;EAAc,GAAIC;YAAlB,CACG,CAACN,8BACAM,QAAQE,UAAU4B,OAAOU,MAAML,YAAYF,WACzC,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,wBAAD,EAAuB,CAAA;GAE1B,CAAA,EAEH,oBAAC,QAAD;GACE,IAAIlC;GACJ,WAAW0C,MAAM,KAAKzC,QAAQ0C,aAAarC,gBAAgB,CAACoC,EAAE;GACnD7C;GACX,YAAA;aAEC,OAAOP,aAAa,aACjBA,SAAS;IACP,GAAGW;IACHoC;IACArC;IACD,CAAC,GACFV;GACA,CAAA,CACO;;EAGpB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region src/ui/components/form-description/form-description.tsx
|
|
4
4
|
const FormDescription = ({ children, as, className }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as Icon, t as cn } from "../../../src-
|
|
1
|
+
import { h as Icon, t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { Tooltip, TooltipProvider as Provider } from "../tooltip/tooltip.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/ui/components/form-label/form-label.tsx
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as IdAutocompleteInputContainerProps, t as IdAutocompleteInputContainer } from "../../../id-autocomplete-input-container-
|
|
1
|
+
import { n as IdAutocompleteInputContainerProps, t as IdAutocompleteInputContainer } from "../../../id-autocomplete-input-container-O7l0T0zJ.js";
|
|
2
2
|
export { IdAutocompleteInputContainer, IdAutocompleteInputContainerProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as Icon, t as cn } from "../../../src-
|
|
1
|
+
import { h as Icon, t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { Tooltip, TooltipProvider as Provider } from "../tooltip/tooltip.js";
|
|
3
3
|
import { sharedValueTransformers } from "../../lib/shared-value-transformers.js";
|
|
4
4
|
import { Input } from "../input/input.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as IdAutocompleteListOptionProps, t as IdAutocompleteListOption } from "../../../id-autocomplete-list-option-
|
|
1
|
+
import { n as IdAutocompleteListOptionProps, t as IdAutocompleteListOption } from "../../../id-autocomplete-list-option-QmSvQwgn.js";
|
|
2
2
|
export { IdAutocompleteListOption, IdAutocompleteListOptionProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as Icon, t as cn } from "../../../src-
|
|
1
|
+
import { h as Icon, t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/ui/components/id-autocomplete/id-autocomplete-list-option.tsx
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as IdAutocompleteListProps, t as IdAutocompleteList } from "../../../id-autocomplete-list-
|
|
1
|
+
import { n as IdAutocompleteListProps, t as IdAutocompleteList } from "../../../id-autocomplete-list-CpPWWmw0.js";
|
|
2
2
|
export { IdAutocompleteList, IdAutocompleteListProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { CommandEmpty, CommandGroup, CommandItem, CommandList } from "../command/command.js";
|
|
3
3
|
import { IdAutocompleteListOption } from "./id-autocomplete-list-option.js";
|
|
4
4
|
import { useEffect } from "react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as IdAutocomplete } from "../../../id-autocomplete-
|
|
1
|
+
import { t as IdAutocomplete } from "../../../id-autocomplete-ClooY-ur.js";
|
|
2
2
|
export { IdAutocomplete };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { FormLabel } from "../form-label/form-label.js";
|
|
3
3
|
import { FormMessageList } from "../form-message/message-list.js";
|
|
4
4
|
import { FormDescription } from "../form-description/form-description.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { v as IdAutocompleteOption, y as IdAutocompleteProps } from "../../../index-
|
|
1
|
+
import { v as IdAutocompleteOption, y as IdAutocompleteProps } from "../../../index-BEiWWMW2.js";
|
|
2
2
|
export { IdAutocompleteOption, IdAutocompleteProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as useIdAutocomplete } from "../../../use-id-autocomplete-
|
|
1
|
+
import { t as useIdAutocomplete } from "../../../use-id-autocomplete-BcL_O50p.js";
|
|
2
2
|
export { useIdAutocomplete };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { n as ButtonProps, r as buttonVariants, t as Button } from "../../button-49Walvwn.js";
|
|
2
2
|
import { n as CharacterCounterProps, t as CharacterCounter } from "../../character-counter-BcuG4STA.js";
|
|
3
3
|
import { n as CheckboxValue, t as CheckboxBase } from "../../checkbox-base-8xXJvAbj.js";
|
|
4
|
-
import { n as CheckboxProps, t as Checkbox } from "../../checkbox-
|
|
5
|
-
import { a as CommandItem, i as CommandInput, n as CommandEmpty, o as CommandList, r as CommandGroup, s as CommandLoading, t as Command } from "../../command-
|
|
6
|
-
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../../radio-group-field-
|
|
7
|
-
import { n as SelectFieldProps, r as SelectFieldRaw, t as SelectField } from "../../select-field-
|
|
8
|
-
import { n as EnumFieldProps, t as EnumField } from "../../enum-field-
|
|
4
|
+
import { n as CheckboxProps, t as Checkbox } from "../../checkbox-Bxc7-H_k.js";
|
|
5
|
+
import { a as CommandItem, i as CommandInput, n as CommandEmpty, o as CommandList, r as CommandGroup, s as CommandLoading, t as Command } from "../../command-BJKXyQyY.js";
|
|
6
|
+
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../../radio-group-field-DrZ_ca8t.js";
|
|
7
|
+
import { n as SelectFieldProps, r as SelectFieldRaw, t as SelectField } from "../../select-field-B9KcyWc1.js";
|
|
8
|
+
import { n as EnumFieldProps, t as EnumField } from "../../enum-field-EnFVRSOd.js";
|
|
9
9
|
import { n as FormDescriptionProps, t as FormDescription } from "../../form-description-BpST5Ww-.js";
|
|
10
10
|
import { t as FormGroup } from "../../form-group-BauWlFkQ.js";
|
|
11
11
|
import { n as FormLabelProps, t as FormLabel } from "../../form-label-Cz_gcj-B.js";
|
|
@@ -13,13 +13,13 @@ import { n as FormMessageProps, r as FormMessageType, t as FormMessage } from ".
|
|
|
13
13
|
import { t as FormServerErrorMessage } from "../../form-server-error-message-CzMQQ8ru.js";
|
|
14
14
|
import { t as FormMessageList } from "../../message-list-aysvo-xf.js";
|
|
15
15
|
import { t as Form } from "../../form-B9JNvrH6.js";
|
|
16
|
-
import { n as IdAutocompleteInputContainerProps, t as IdAutocompleteInputContainer } from "../../id-autocomplete-input-container-
|
|
17
|
-
import { n as IdAutocompleteListOptionProps, t as IdAutocompleteListOption } from "../../id-autocomplete-list-option-
|
|
18
|
-
import { n as IdAutocompleteListProps, t as IdAutocompleteList } from "../../id-autocomplete-list-
|
|
19
|
-
import { t as IdAutocomplete } from "../../id-autocomplete-
|
|
20
|
-
import { t as useIdAutocomplete } from "../../use-id-autocomplete-
|
|
16
|
+
import { n as IdAutocompleteInputContainerProps, t as IdAutocompleteInputContainer } from "../../id-autocomplete-input-container-O7l0T0zJ.js";
|
|
17
|
+
import { n as IdAutocompleteListOptionProps, t as IdAutocompleteListOption } from "../../id-autocomplete-list-option-QmSvQwgn.js";
|
|
18
|
+
import { n as IdAutocompleteListProps, t as IdAutocompleteList } from "../../id-autocomplete-list-CpPWWmw0.js";
|
|
19
|
+
import { t as IdAutocomplete } from "../../id-autocomplete-ClooY-ur.js";
|
|
20
|
+
import { t as useIdAutocomplete } from "../../use-id-autocomplete-BcL_O50p.js";
|
|
21
21
|
import { n as InputProps, t as Input } from "../../input-D11GgWGm.js";
|
|
22
|
-
import { t as SplittedInputDiff } from "../../splitted-input-diff-
|
|
22
|
+
import { t as SplittedInputDiff } from "../../splitted-input-diff-DZ_0mBKD.js";
|
|
23
23
|
import { t as JsonViewer } from "../../json-viewer-vWp8vOvz.js";
|
|
24
24
|
import { i as PopoverTrigger, n as PopoverAnchor, r as PopoverContent, t as Popover } from "../../popover-glLRVxPS.js";
|
|
25
25
|
import { n as RadioGroup, t as CustomizableRadioGroupProps } from "../../radio-group-DjJbcDzB.js";
|
|
@@ -27,11 +27,11 @@ import { n as RadioProps, t as Radio } from "../../radio-DZ4xl9oz.js";
|
|
|
27
27
|
import { n as SearchAutocompleteProps, r as SearchAutocompleteRowContext, t as SearchAutocompleteOption } from "../../types-9JRQnd7a.js";
|
|
28
28
|
import { t as SearchAutocomplete } from "../../search-autocomplete-OeZbE-VN.js";
|
|
29
29
|
import { t as useSearchAutocomplete } from "../../use-search-autocomplete-Xf7shCtk.js";
|
|
30
|
-
import { t as Content } from "../../content-
|
|
31
|
-
import { t as SelectedContent } from "../../selected-content-
|
|
32
|
-
import { n as TextInputProps, t as TextInput } from "../../text-input-
|
|
33
|
-
import { n as TextFieldProps, t as TextField } from "../../text-field-
|
|
30
|
+
import { t as Content } from "../../content-Ce1V2wTc.js";
|
|
31
|
+
import { t as SelectedContent } from "../../selected-content-HHOKK679.js";
|
|
32
|
+
import { n as TextInputProps, t as TextInput } from "../../text-input-By73a1-n.js";
|
|
33
|
+
import { n as TextFieldProps, t as TextField } from "../../text-field-CwxxUhUk.js";
|
|
34
34
|
import { a as TooltipProps, i as TooltipContent, n as Root, o as Trigger, r as Tooltip, t as Provider } from "../../tooltip-Cf5jSzdt.js";
|
|
35
35
|
import { t as ValueTransformer } from "../../value-transformer-DCiU65Qa.js";
|
|
36
|
-
import { n as withFieldValidation, t as ValidationOptions } from "../../with-field-validation-
|
|
36
|
+
import { n as withFieldValidation, t as ValidationOptions } from "../../with-field-validation-BIac25Sm.js";
|
|
37
37
|
export { Button, ButtonProps, CharacterCounter, CharacterCounterProps, Checkbox, CheckboxBase, CheckboxProps, CheckboxValue, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, Content, CustomizableRadioGroupProps, EnumField, EnumFieldProps, Form, FormDescription, FormDescriptionProps, FormGroup, FormLabel, FormLabelProps, FormMessage, FormMessageList, FormMessageProps, FormMessageType, FormServerErrorMessage, IdAutocomplete, IdAutocompleteInputContainer, IdAutocompleteInputContainerProps, IdAutocompleteList, IdAutocompleteListOption, IdAutocompleteListOptionProps, IdAutocompleteListProps, Input, InputProps, JsonViewer, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Radio, RadioGroup, RadioGroupField, RadioGroupFieldProps, RadioProps, SearchAutocomplete, SearchAutocompleteOption, SearchAutocompleteProps, SearchAutocompleteRowContext, SelectField, SelectFieldProps, SelectFieldRaw, SelectedContent, SplittedInputDiff, TextField, TextFieldProps, TextInput, TextInputProps, Tooltip, TooltipContent, TooltipProps, Provider as TooltipProvider, Root as TooltipRoot, Trigger as TooltipTrigger, ValidationOptions, ValueTransformer, buttonVariants, useIdAutocomplete, useSearchAutocomplete, withFieldValidation };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SplittedInputDiff } from "../../../splitted-input-diff-
|
|
1
|
+
import { t as SplittedInputDiff } from "../../../splitted-input-diff-DZ_0mBKD.js";
|
|
2
2
|
export { SplittedInputDiff };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as Icon, t as cn } from "../../../src-
|
|
1
|
+
import { h as Icon, t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { Tooltip, TooltipProvider as Provider } from "../tooltip/tooltip.js";
|
|
3
3
|
import { InputDiff } from "./subcomponent/input-diff.js";
|
|
4
4
|
import { TextDiff } from "./subcomponent/text-diff.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../../src-
|
|
1
|
+
import { t as cn } from "../../../../src-BgKEHW0i.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region src/ui/components/input/subcomponent/input-diff.tsx
|
|
4
4
|
const InputDiff = ({ children, className, ellipsis = true, multiline = false, rows = 3, hasPadding = false }) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../../../radio-group-field-
|
|
1
|
+
import { n as RadioGroupFieldProps, t as RadioGroupField } from "../../../radio-group-field-DrZ_ca8t.js";
|
|
2
2
|
export { RadioGroupField, RadioGroupFieldProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { FormLabel } from "../form-label/form-label.js";
|
|
3
3
|
import { FormMessageList } from "../form-message/message-list.js";
|
|
4
4
|
import { withFieldValidation } from "../with-field-validation/with-field-validation.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { FormLabel } from "../form-label/form-label.js";
|
|
3
3
|
import React, { useId } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { Popover, PopoverAnchor, PopoverContent } from "../popover/popover.js";
|
|
3
3
|
import { Input } from "../input/input.js";
|
|
4
4
|
import { useSearchAutocomplete } from "./use-search-autocomplete.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-search-autocomplete.js","names":["useCallback","useEffect","useRef","useState","useSearchAutocomplete","options","fetchOptions","debounceMs","query","setQuery","results","setResults","isLoading","setIsLoading","error","setError","isOpen","setIsOpen","debounceRef","undefined","abortRef","fetchResults","searchQuery","trim","current","abort","controller","AbortController","data","signal","aborted","length","err","Error","message","handleQueryChange","value","clearTimeout","setTimeout"],"sources":["../../../../src/ui/components/search-autocomplete/use-search-autocomplete.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { SearchAutocompleteOption } from \"./types.js\";\n\ninterface UseSearchAutocompleteOptions {\n fetchOptions?: (query: string) => Promise<SearchAutocompleteOption[]>;\n debounceMs: number;\n}\n\nexport function useSearchAutocomplete(options: UseSearchAutocompleteOptions) {\n const { fetchOptions, debounceMs } = options;\n\n const [query, setQuery] = useState(\"\");\n const [results, setResults] = useState<SearchAutocompleteOption[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | undefined>();\n const [isOpen, setIsOpen] = useState(false);\n\n const debounceRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n const abortRef = useRef<AbortController>(undefined);\n\n const fetchResults = useCallback(\n async (searchQuery: string) => {\n if (!fetchOptions) return;\n\n if (!searchQuery.trim()) {\n setResults([]);\n setIsLoading(false);\n return;\n }\n\n abortRef.current?.abort();\n const controller = new AbortController();\n abortRef.current = controller;\n\n setIsLoading(true);\n setError(undefined);\n\n try {\n const data = await fetchOptions(searchQuery);\n if (!controller.signal.aborted) {\n setResults(data);\n setIsOpen(data.length > 0);\n }\n } catch (err) {\n if (!controller.signal.aborted) {\n setError(\n err instanceof Error ? err.message : \"Failed to fetch results\",\n );\n setResults([]);\n }\n } finally {\n if (!controller.signal.aborted) {\n setIsLoading(false);\n }\n }\n },\n [fetchOptions],\n );\n\n const handleQueryChange = useCallback(\n (value: string) => {\n setQuery(value);\n\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n }\n\n if (!value.trim()) {\n setResults([]);\n setIsOpen(false);\n setIsLoading(false);\n return;\n }\n\n setIsLoading(true);\n debounceRef.current = setTimeout(() => {\n fetchResults(value);\n }, debounceMs);\n },\n [debounceMs, fetchResults],\n );\n\n useEffect(() => {\n return () => {\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n }\n abortRef.current?.abort();\n };\n }, []);\n\n return {\n query,\n setQuery,\n results,\n isLoading,\n error,\n isOpen,\n setIsOpen,\n handleQueryChange,\n };\n}\n"],"mappings":";;AAQA,SAAgBI,sBAAsBC,SAAuC;CAC3E,MAAM,EAAEC,cAAcC,eAAeF;CAErC,MAAM,CAACG,OAAOC,YAAYN,SAAS,GAAG;CACtC,MAAM,CAACO,SAASC,cAAcR,SAAqC,EAAE,CAAC;CACtE,MAAM,CAACS,WAAWC,gBAAgBV,SAAS,MAAM;CACjD,MAAM,CAACW,OAAOC,YAAYZ,UAA8B;CACxD,MAAM,CAACa,QAAQC,aAAad,SAAS,MAAM;CAE3C,MAAMe,cAAchB,OAAsCiB,KAAAA,EAAU;CACpE,MAAMC,WAAWlB,OAAwBiB,KAAAA,EAAU;CAEnD,MAAME,eAAerB,YACnB,OAAOsB,gBAAwB;AAC7B,MAAI,CAAChB,aAAc;AAEnB,MAAI,CAACgB,YAAYC,MAAM,EAAE;AACvBZ,cAAW,EAAE,CAAC;AACdE,gBAAa,MAAM;AACnB;;AAGFO,WAASI,SAASC,OAAO;EACzB,MAAMC,aAAa,IAAIC,iBAAiB;AACxCP,WAASI,UAAUE;AAEnBb,eAAa,KAAK;AAClBE,WAASI,KAAAA,EAAU;AAEnB,MAAI;GACF,MAAMS,OAAO,MAAMtB,aAAagB,YAAY;AAC5C,OAAI,CAACI,WAAWG,OAAOC,SAAS;AAC9BnB,eAAWiB,KAAK;AAChBX,cAAUW,KAAKG,SAAS,EAAE;;WAErBC,KAAK;AACZ,OAAI,CAACN,WAAWG,OAAOC,SAAS;AAC9Bf,aACEiB,eAAeC,QAAQD,IAAIE,UAAU,0BACtC;AACDvB,eAAW,EAAE,CAAC;;YAER;AACR,OAAI,CAACe,WAAWG,OAAOC,QACrBjB,cAAa,MAAM;;IAIzB,CAACP,aACH,CAAC;CAED,MAAM6B,oBAAoBnC,aACvBoC,UAAkB;AACjB3B,WAAS2B,MAAM;AAEf,MAAIlB,YAAYM,QACda,cAAanB,YAAYM,QAAQ;AAGnC,MAAI,CAACY,MAAMb,MAAM,EAAE;AACjBZ,cAAW,EAAE,CAAC;AACdM,aAAU,MAAM;AAChBJ,gBAAa,MAAM;AACnB;;AAGFA,eAAa,KAAK;AAClBK,cAAYM,UAAUc,iBAAiB;
|
|
1
|
+
{"version":3,"file":"use-search-autocomplete.js","names":["useCallback","useEffect","useRef","useState","useSearchAutocomplete","options","fetchOptions","debounceMs","query","setQuery","results","setResults","isLoading","setIsLoading","error","setError","isOpen","setIsOpen","debounceRef","undefined","abortRef","fetchResults","searchQuery","trim","current","abort","controller","AbortController","data","signal","aborted","length","err","Error","message","handleQueryChange","value","clearTimeout","setTimeout"],"sources":["../../../../src/ui/components/search-autocomplete/use-search-autocomplete.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { SearchAutocompleteOption } from \"./types.js\";\n\ninterface UseSearchAutocompleteOptions {\n fetchOptions?: (query: string) => Promise<SearchAutocompleteOption[]>;\n debounceMs: number;\n}\n\nexport function useSearchAutocomplete(options: UseSearchAutocompleteOptions) {\n const { fetchOptions, debounceMs } = options;\n\n const [query, setQuery] = useState(\"\");\n const [results, setResults] = useState<SearchAutocompleteOption[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | undefined>();\n const [isOpen, setIsOpen] = useState(false);\n\n const debounceRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n const abortRef = useRef<AbortController>(undefined);\n\n const fetchResults = useCallback(\n async (searchQuery: string) => {\n if (!fetchOptions) return;\n\n if (!searchQuery.trim()) {\n setResults([]);\n setIsLoading(false);\n return;\n }\n\n abortRef.current?.abort();\n const controller = new AbortController();\n abortRef.current = controller;\n\n setIsLoading(true);\n setError(undefined);\n\n try {\n const data = await fetchOptions(searchQuery);\n if (!controller.signal.aborted) {\n setResults(data);\n setIsOpen(data.length > 0);\n }\n } catch (err) {\n if (!controller.signal.aborted) {\n setError(\n err instanceof Error ? err.message : \"Failed to fetch results\",\n );\n setResults([]);\n }\n } finally {\n if (!controller.signal.aborted) {\n setIsLoading(false);\n }\n }\n },\n [fetchOptions],\n );\n\n const handleQueryChange = useCallback(\n (value: string) => {\n setQuery(value);\n\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n }\n\n if (!value.trim()) {\n setResults([]);\n setIsOpen(false);\n setIsLoading(false);\n return;\n }\n\n setIsLoading(true);\n debounceRef.current = setTimeout(() => {\n void fetchResults(value);\n }, debounceMs);\n },\n [debounceMs, fetchResults],\n );\n\n useEffect(() => {\n return () => {\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n }\n abortRef.current?.abort();\n };\n }, []);\n\n return {\n query,\n setQuery,\n results,\n isLoading,\n error,\n isOpen,\n setIsOpen,\n handleQueryChange,\n };\n}\n"],"mappings":";;AAQA,SAAgBI,sBAAsBC,SAAuC;CAC3E,MAAM,EAAEC,cAAcC,eAAeF;CAErC,MAAM,CAACG,OAAOC,YAAYN,SAAS,GAAG;CACtC,MAAM,CAACO,SAASC,cAAcR,SAAqC,EAAE,CAAC;CACtE,MAAM,CAACS,WAAWC,gBAAgBV,SAAS,MAAM;CACjD,MAAM,CAACW,OAAOC,YAAYZ,UAA8B;CACxD,MAAM,CAACa,QAAQC,aAAad,SAAS,MAAM;CAE3C,MAAMe,cAAchB,OAAsCiB,KAAAA,EAAU;CACpE,MAAMC,WAAWlB,OAAwBiB,KAAAA,EAAU;CAEnD,MAAME,eAAerB,YACnB,OAAOsB,gBAAwB;AAC7B,MAAI,CAAChB,aAAc;AAEnB,MAAI,CAACgB,YAAYC,MAAM,EAAE;AACvBZ,cAAW,EAAE,CAAC;AACdE,gBAAa,MAAM;AACnB;;AAGFO,WAASI,SAASC,OAAO;EACzB,MAAMC,aAAa,IAAIC,iBAAiB;AACxCP,WAASI,UAAUE;AAEnBb,eAAa,KAAK;AAClBE,WAASI,KAAAA,EAAU;AAEnB,MAAI;GACF,MAAMS,OAAO,MAAMtB,aAAagB,YAAY;AAC5C,OAAI,CAACI,WAAWG,OAAOC,SAAS;AAC9BnB,eAAWiB,KAAK;AAChBX,cAAUW,KAAKG,SAAS,EAAE;;WAErBC,KAAK;AACZ,OAAI,CAACN,WAAWG,OAAOC,SAAS;AAC9Bf,aACEiB,eAAeC,QAAQD,IAAIE,UAAU,0BACtC;AACDvB,eAAW,EAAE,CAAC;;YAER;AACR,OAAI,CAACe,WAAWG,OAAOC,QACrBjB,cAAa,MAAM;;IAIzB,CAACP,aACH,CAAC;CAED,MAAM6B,oBAAoBnC,aACvBoC,UAAkB;AACjB3B,WAAS2B,MAAM;AAEf,MAAIlB,YAAYM,QACda,cAAanB,YAAYM,QAAQ;AAGnC,MAAI,CAACY,MAAMb,MAAM,EAAE;AACjBZ,cAAW,EAAE,CAAC;AACdM,aAAU,MAAM;AAChBJ,gBAAa,MAAM;AACnB;;AAGFA,eAAa,KAAK;AAClBK,cAAYM,UAAUc,iBAAiB;AAChCjB,gBAAae,MAAM;KACvB7B,WAAW;IAEhB,CAACA,YAAYc,aACf,CAAC;AAEDpB,iBAAgB;AACd,eAAa;AACX,OAAIiB,YAAYM,QACda,cAAanB,YAAYM,QAAQ;AAEnCJ,YAASI,SAASC,OAAO;;IAE1B,EAAE,CAAC;AAEN,QAAO;EACLjB;EACAC;EACAC;EACAE;EACAE;EACAE;EACAC;EACAkB;EACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Content } from "../../../content-
|
|
1
|
+
import { t as Content } from "../../../content-Ce1V2wTc.js";
|
|
2
2
|
export { Content };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as Icon, t as cn } from "../../../src-
|
|
1
|
+
import { h as Icon, t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../command/command.js";
|
|
3
3
|
import { CommandItemList } from "./subcomponents/CommandItemList.js";
|
|
4
4
|
import { useEffect } from "react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SelectFieldProps, r as SelectFieldRaw, t as SelectField } from "../../../select-field-
|
|
1
|
+
import { n as SelectFieldProps, r as SelectFieldRaw, t as SelectField } from "../../../select-field-B9KcyWc1.js";
|
|
2
2
|
export { SelectField, SelectFieldProps, SelectFieldRaw };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { Button } from "../button/button.js";
|
|
3
3
|
import { FormLabel } from "../form-label/form-label.js";
|
|
4
4
|
import { FormMessageList } from "../form-message/message-list.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SelectedContent } from "../../../selected-content-
|
|
1
|
+
import { t as SelectedContent } from "../../../selected-content-HHOKK679.js";
|
|
2
2
|
export { SelectedContent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as Icon, t as cn } from "../../../../src-
|
|
1
|
+
import { h as Icon, t as cn } from "../../../../src-BgKEHW0i.js";
|
|
2
2
|
import { CommandItem } from "../../command/command.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as TextFieldProps, t as TextField } from "../../../text-field-
|
|
1
|
+
import { n as TextFieldProps, t as TextField } from "../../../text-field-CwxxUhUk.js";
|
|
2
2
|
export { TextField, TextFieldProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as TextInputDiff } from "../../../text-input-diff-
|
|
1
|
+
import { t as TextInputDiff } from "../../../text-input-diff-C6OK2A4u.js";
|
|
2
2
|
export { TextInputDiff as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as TextInputProps, t as TextInput } from "../../../text-input-
|
|
1
|
+
import { n as TextInputProps, t as TextInput } from "../../../text-input-By73a1-n.js";
|
|
2
2
|
export { TextInput, TextInputProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { CharacterCounter } from "../character-counter/character-counter.js";
|
|
3
3
|
import { FormLabel } from "../form-label/form-label.js";
|
|
4
4
|
import { FormMessageList } from "../form-message/message-list.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cn } from "../../../src-
|
|
1
|
+
import { t as cn } from "../../../src-BgKEHW0i.js";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Content, Portal, Provider, Root, Trigger } from "@radix-ui/react-tooltip";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as SelectProps, S as SelectOption, b as RadioGroupProps, v as IdAutocompleteOption, x as SelectBaseProps, y as IdAutocompleteProps } from "../../index-
|
|
1
|
+
import { C as SelectProps, S as SelectOption, b as RadioGroupProps, v as IdAutocompleteOption, x as SelectBaseProps, y as IdAutocompleteProps } from "../../index-BEiWWMW2.js";
|
|
2
2
|
export { IdAutocompleteOption, IdAutocompleteProps, RadioGroupProps, SelectBaseProps, SelectOption, SelectProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as withFieldValidation, t as ValidationOptions } from "../../../with-field-validation-
|
|
1
|
+
import { n as withFieldValidation, t as ValidationOptions } from "../../../with-field-validation-BIac25Sm.js";
|
|
2
2
|
export { ValidationOptions, withFieldValidation };
|
|
@@ -5,7 +5,7 @@ import { Controller, useFormContext, useFormState } from "react-hook-form";
|
|
|
5
5
|
const withFieldValidation = (Component, options) => {
|
|
6
6
|
return /* @__PURE__ */ forwardRef(({ value, name, showErrorOnBlur, showErrorOnChange, validators: customValidators, ...props }, ref) => {
|
|
7
7
|
const { onChange: onChangeProp, onBlur: onBlurProp } = props;
|
|
8
|
-
const { control, formState: { errors: formErrors, defaultValues }, trigger, setValue, getValues } = useFormContext();
|
|
8
|
+
const { control, formState: { errors: formErrors, defaultValues: _defaultValues }, trigger, setValue, getValues } = useFormContext();
|
|
9
9
|
const { submitCount } = useFormState();
|
|
10
10
|
if (!name) throw new Error(`[Field: ${Component.displayName}] The name prop is required.`);
|
|
11
11
|
const errors = [...formErrors[name]?.types ? Object.values(formErrors[name].types ?? []) : []];
|