@mittwald/flow-react-components 0.2.0-alpha.540 → 0.2.0-alpha.541
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/assets/doc-properties.json +28 -28
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +20 -10
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/context/formContext.mjs +2 -1
- package/dist/js/components/src/integrations/react-hook-form/components/context/formContext.mjs.map +1 -1
- package/dist/js/react-hook-form.mjs +1 -1
- package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/context/formContext.d.ts +3 -0
- package/dist/types/integrations/react-hook-form/components/context/formContext.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/index.d.ts +1 -1
- package/dist/types/integrations/react-hook-form/index.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.2.0-alpha.541](https://github.com/mittwald/flow/compare/0.2.0-alpha.540...0.2.0-alpha.541) (2025-11-03)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **Form:** fix correct readonly prop propagation ([#2101](https://github.com/mittwald/flow/issues/2101)) ([271e052](https://github.com/mittwald/flow/commit/271e052119b8f99e2415d24cb0372c42a642e610))
|
|
11
|
+
|
|
6
12
|
# [0.2.0-alpha.540](https://github.com/mittwald/flow/compare/0.2.0-alpha.539...0.2.0-alpha.540) (2025-11-03)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -275834,9 +275834,9 @@
|
|
|
275834
275834
|
"tags": {
|
|
275835
275835
|
"flr-generate": "all"
|
|
275836
275836
|
},
|
|
275837
|
-
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/RadioGroup/components/
|
|
275837
|
+
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/RadioGroup/components/Radio/Radio.tsx",
|
|
275838
275838
|
"description": "",
|
|
275839
|
-
"displayName": "
|
|
275839
|
+
"displayName": "Radio",
|
|
275840
275840
|
"methods": [],
|
|
275841
275841
|
"props": {
|
|
275842
275842
|
"aria-label": {
|
|
@@ -277722,9 +277722,9 @@
|
|
|
277722
277722
|
"tags": {
|
|
277723
277723
|
"flr-generate": "all"
|
|
277724
277724
|
},
|
|
277725
|
-
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/RadioGroup/components/
|
|
277725
|
+
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/RadioGroup/components/RadioButton/RadioButton.tsx",
|
|
277726
277726
|
"description": "",
|
|
277727
|
-
"displayName": "
|
|
277727
|
+
"displayName": "RadioButton",
|
|
277728
277728
|
"methods": [],
|
|
277729
277729
|
"props": {
|
|
277730
277730
|
"aria-label": {
|
|
@@ -317084,30 +317084,6 @@
|
|
|
317084
317084
|
}
|
|
317085
317085
|
}
|
|
317086
317086
|
},
|
|
317087
|
-
{
|
|
317088
|
-
"tags": {},
|
|
317089
|
-
"filePath": "src/integrations/nextjs/components/RouterProvider/RouterProvider.tsx",
|
|
317090
|
-
"description": "",
|
|
317091
|
-
"displayName": "RouterProvider",
|
|
317092
|
-
"methods": [],
|
|
317093
|
-
"props": {
|
|
317094
|
-
"children": {
|
|
317095
|
-
"defaultValue": null,
|
|
317096
|
-
"description": "",
|
|
317097
|
-
"name": "children",
|
|
317098
|
-
"declarations": [
|
|
317099
|
-
{
|
|
317100
|
-
"fileName": "flow/node_modules/.pnpm/@types+react@19.2.2/node_modules/@types/react/index.d.ts",
|
|
317101
|
-
"name": "TypeLiteral"
|
|
317102
|
-
}
|
|
317103
|
-
],
|
|
317104
|
-
"required": false,
|
|
317105
|
-
"type": {
|
|
317106
|
-
"name": "ReactNode"
|
|
317107
|
-
}
|
|
317108
|
-
}
|
|
317109
|
-
}
|
|
317110
|
-
},
|
|
317111
317087
|
{
|
|
317112
317088
|
"tags": {
|
|
317113
317089
|
"deprecated": "Use RouterProvider instead"
|
|
@@ -322636,6 +322612,30 @@
|
|
|
322636
322612
|
}
|
|
322637
322613
|
}
|
|
322638
322614
|
},
|
|
322615
|
+
{
|
|
322616
|
+
"tags": {},
|
|
322617
|
+
"filePath": "src/integrations/nextjs/components/RouterProvider/RouterProvider.tsx",
|
|
322618
|
+
"description": "",
|
|
322619
|
+
"displayName": "RouterProvider",
|
|
322620
|
+
"methods": [],
|
|
322621
|
+
"props": {
|
|
322622
|
+
"children": {
|
|
322623
|
+
"defaultValue": null,
|
|
322624
|
+
"description": "",
|
|
322625
|
+
"name": "children",
|
|
322626
|
+
"declarations": [
|
|
322627
|
+
{
|
|
322628
|
+
"fileName": "flow/node_modules/.pnpm/@types+react@19.2.2/node_modules/@types/react/index.d.ts",
|
|
322629
|
+
"name": "TypeLiteral"
|
|
322630
|
+
}
|
|
322631
|
+
],
|
|
322632
|
+
"required": false,
|
|
322633
|
+
"type": {
|
|
322634
|
+
"name": "ReactNode"
|
|
322635
|
+
}
|
|
322636
|
+
}
|
|
322637
|
+
}
|
|
322638
|
+
},
|
|
322639
322639
|
{
|
|
322640
322640
|
"tags": {},
|
|
322641
322641
|
"filePath": "/home/runner/work/flow/flow/packages/components/src/components/List/components/Table/components/TableLoadingView.tsx",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { FormContextProvider } from '../context/formContext.mjs';
|
|
5
|
-
import { useId, useMemo } from 'react';
|
|
5
|
+
import { useState, useId, useMemo } from 'react';
|
|
6
6
|
import { FormProvider } from 'react-hook-form';
|
|
7
7
|
import '../../../../lib/propsContext/propsContext.mjs';
|
|
8
8
|
import { PropsContextProvider } from '../../../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
@@ -10,6 +10,7 @@ import { Action } from '../../../../components/Action/Action.mjs';
|
|
|
10
10
|
import 'react-aria';
|
|
11
11
|
import '@react-aria/live-announcer';
|
|
12
12
|
import { useRegisterActionStateContext } from './lib/useRegisterActionStateContext.mjs';
|
|
13
|
+
import { inheritProps } from '../../../../lib/propsContext/inherit/types.mjs';
|
|
13
14
|
|
|
14
15
|
const DefaultFormComponent = (p) => /* @__PURE__ */ jsx("form", { ...p });
|
|
15
16
|
function Form(props) {
|
|
@@ -18,9 +19,11 @@ function Form(props) {
|
|
|
18
19
|
children,
|
|
19
20
|
onSubmit,
|
|
20
21
|
formComponent: FormView = DefaultFormComponent,
|
|
21
|
-
isReadOnly,
|
|
22
|
+
isReadOnly: isReadOnlyFromProps,
|
|
22
23
|
...formProps
|
|
23
24
|
} = props;
|
|
25
|
+
const [readonlyContextState, setReadonlyContextState] = useState(!!isReadOnlyFromProps);
|
|
26
|
+
const isReadOnly = isReadOnlyFromProps || readonlyContextState;
|
|
24
27
|
const formId = useId();
|
|
25
28
|
const FormViewComponent = useMemo(() => FormView, [formId]);
|
|
26
29
|
const { action, registerSubmitResult } = useRegisterActionStateContext(form);
|
|
@@ -39,7 +42,8 @@ function Form(props) {
|
|
|
39
42
|
})(formEvent);
|
|
40
43
|
};
|
|
41
44
|
const readonlyPropsContext = {
|
|
42
|
-
|
|
45
|
+
...inheritProps,
|
|
46
|
+
isReadOnly
|
|
43
47
|
};
|
|
44
48
|
const propsContext = {
|
|
45
49
|
SearchField: readonlyPropsContext,
|
|
@@ -64,15 +68,21 @@ function Form(props) {
|
|
|
64
68
|
ComboBox: readonlyPropsContext,
|
|
65
69
|
Button: readonlyPropsContext
|
|
66
70
|
};
|
|
67
|
-
return /* @__PURE__ */ jsx(PropsContextProvider, { props:
|
|
68
|
-
|
|
71
|
+
return /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, dependencies: [isReadOnly], children: /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsx(
|
|
72
|
+
FormContextProvider,
|
|
69
73
|
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
value: { form, id: formId, setReadonly: setReadonlyContextState },
|
|
75
|
+
children: /* @__PURE__ */ jsx(Action, { actionModel: action, children: /* @__PURE__ */ jsx(
|
|
76
|
+
FormViewComponent,
|
|
77
|
+
{
|
|
78
|
+
...formProps,
|
|
79
|
+
id: formId,
|
|
80
|
+
onSubmit: handleOnSubmit,
|
|
81
|
+
children
|
|
82
|
+
}
|
|
83
|
+
) })
|
|
74
84
|
}
|
|
75
|
-
) }) })
|
|
85
|
+
) }) });
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
export { Form, Form as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { FormContextProvider } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport {\n type ComponentProps,\n type ComponentType,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n useId,\n useMemo,\n} from \"react\";\nimport type {\n FieldValues,\n SubmitHandler,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { Action } from \"@/components/Action\";\nimport { useRegisterActionStateContext } from \"@/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\ntype FormComponentType = ComponentType<\n PropsWithChildren<{\n id: string;\n onSubmit?: FormEventHandler | FormOnSubmitHandler<never>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends Omit<ComponentProps<\"form\">, \"onSubmit\">,\n PropsWithChildren {\n form: UseFormReturn<F>;\n onSubmit: FormOnSubmitHandler<F>;\n formComponent?: FormComponentType;\n isReadOnly?: boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit,\n formComponent: FormView = DefaultFormComponent,\n isReadOnly,\n ...formProps\n } = props;\n\n const formId = useId();\n const FormViewComponent = useMemo(() => FormView, [formId]);\n const { action, registerSubmitResult } = useRegisterActionStateContext(form);\n\n const handleOnSubmit = (e?: FormEvent<HTMLFormElement> | F) => {\n const { isSubmitting, isValidating } = form.control._formState;\n const formEvent =\n e && \"nativeEvent\" in e ? (e as FormEvent<HTMLFormElement>) : undefined;\n\n formEvent?.stopPropagation();\n\n if (isSubmitting || isValidating) {\n formEvent?.preventDefault();\n return;\n }\n\n form.handleSubmit((values) => {\n const result = onSubmit(values, formEvent);\n registerSubmitResult(result);\n return result;\n })(formEvent);\n };\n\n const readonlyPropsContext = {\n isReadOnly
|
|
1
|
+
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { FormContextProvider } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport {\n type ComponentProps,\n type ComponentType,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n useId,\n useMemo,\n useState,\n} from \"react\";\nimport type {\n FieldValues,\n SubmitHandler,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { Action } from \"@/components/Action\";\nimport { useRegisterActionStateContext } from \"@/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext\";\nimport { inheritProps } from \"@/lib/propsContext/inherit/types\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\ntype FormComponentType = ComponentType<\n PropsWithChildren<{\n id: string;\n onSubmit?: FormEventHandler | FormOnSubmitHandler<never>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends Omit<ComponentProps<\"form\">, \"onSubmit\">,\n PropsWithChildren {\n form: UseFormReturn<F>;\n onSubmit: FormOnSubmitHandler<F>;\n formComponent?: FormComponentType;\n isReadOnly?: boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit,\n formComponent: FormView = DefaultFormComponent,\n isReadOnly: isReadOnlyFromProps,\n ...formProps\n } = props;\n\n const [readonlyContextState, setReadonlyContextState] =\n useState(!!isReadOnlyFromProps);\n\n const isReadOnly = isReadOnlyFromProps || readonlyContextState;\n\n const formId = useId();\n const FormViewComponent = useMemo(() => FormView, [formId]);\n const { action, registerSubmitResult } = useRegisterActionStateContext(form);\n\n const handleOnSubmit = (e?: FormEvent<HTMLFormElement> | F) => {\n const { isSubmitting, isValidating } = form.control._formState;\n const formEvent =\n e && \"nativeEvent\" in e ? (e as FormEvent<HTMLFormElement>) : undefined;\n\n formEvent?.stopPropagation();\n\n if (isSubmitting || isValidating) {\n formEvent?.preventDefault();\n return;\n }\n\n form.handleSubmit((values) => {\n const result = onSubmit(values, formEvent);\n registerSubmitResult(result);\n return result;\n })(formEvent);\n };\n\n const readonlyPropsContext = {\n ...inheritProps,\n isReadOnly,\n } as const;\n\n const propsContext: PropsContext = {\n SearchField: readonlyPropsContext,\n TextField: readonlyPropsContext,\n TextArea: readonlyPropsContext,\n MarkdownEditor: readonlyPropsContext,\n Checkbox: readonlyPropsContext,\n CheckboxGroup: readonlyPropsContext,\n CheckboxButton: readonlyPropsContext,\n FileField: readonlyPropsContext,\n FileDropZone: readonlyPropsContext,\n NumberField: readonlyPropsContext,\n RadioGroup: readonlyPropsContext,\n Switch: readonlyPropsContext,\n Slider: readonlyPropsContext,\n PasswordCreationField: readonlyPropsContext,\n DatePicker: readonlyPropsContext,\n DateRangePicker: readonlyPropsContext,\n TimeField: readonlyPropsContext,\n SegmentedControl: readonlyPropsContext,\n Select: readonlyPropsContext,\n ComboBox: readonlyPropsContext,\n Button: readonlyPropsContext,\n };\n\n return (\n <PropsContextProvider props={propsContext} dependencies={[isReadOnly]}>\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n value={{ form, id: formId, setReadonly: setReadonlyContextState }}\n >\n <Action actionModel={action}>\n <FormViewComponent\n {...formProps}\n id={formId}\n onSubmit={handleOnSubmit}\n >\n {children}\n </FormViewComponent>\n </Action>\n </FormContextProvider>\n </RhfFormContextProvider>\n </PropsContextProvider>\n );\n}\n\nexport default Form;\n"],"names":["RhfFormContextProvider"],"mappings":"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"}
|
package/dist/js/components/src/integrations/react-hook-form/components/context/formContext.mjs
CHANGED
|
@@ -13,6 +13,7 @@ const useFormContext = () => {
|
|
|
13
13
|
);
|
|
14
14
|
return ctx;
|
|
15
15
|
};
|
|
16
|
+
const useOptionalFormContext = () => useContext(formContext);
|
|
16
17
|
|
|
17
|
-
export { FormContextProvider, formContext, useFormContext };
|
|
18
|
+
export { FormContextProvider, formContext, useFormContext, useOptionalFormContext };
|
|
18
19
|
//# sourceMappingURL=formContext.mjs.map
|
package/dist/js/components/src/integrations/react-hook-form/components/context/formContext.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formContext.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/context/formContext.ts"],"sourcesContent":["import type { FieldValues, UseFormReturn } from \"react-hook-form\";\nimport { createContext, useContext } from \"react\";\nimport invariant from \"invariant\";\n\ninterface FormContext<F extends FieldValues> {\n form: UseFormReturn<F>;\n id: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFormContext = FormContext<any>;\n\nexport const formContext = createContext<AnyFormContext | undefined>(undefined);\n\nexport const FormContextProvider = formContext.Provider;\n\nexport const useFormContext = <F extends FieldValues>(): FormContext<F> => {\n const ctx = useContext(formContext);\n invariant(\n !!ctx,\n \"Could not useFormContext() outside a Form, or multiple versions of Flow installed.\",\n );\n return ctx;\n};\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"formContext.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/context/formContext.ts"],"sourcesContent":["import type { FieldValues, UseFormReturn } from \"react-hook-form\";\nimport { createContext, useContext, type Dispatch } from \"react\";\nimport invariant from \"invariant\";\n\ninterface FormContext<F extends FieldValues> {\n form: UseFormReturn<F>;\n id: string;\n setReadonly: Dispatch<React.SetStateAction<boolean>>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFormContext = FormContext<any>;\n\nexport const formContext = createContext<AnyFormContext | undefined>(undefined);\n\nexport const FormContextProvider = formContext.Provider;\n\nexport const useFormContext = <F extends FieldValues>(): FormContext<F> => {\n const ctx = useContext(formContext);\n invariant(\n !!ctx,\n \"Could not useFormContext() outside a Form, or multiple versions of Flow installed.\",\n );\n return ctx;\n};\n\nexport const useOptionalFormContext = <F extends FieldValues>() =>\n useContext(formContext) as FormContext<F> | undefined;\n"],"names":[],"mappings":";;;AAaO,MAAM,WAAA,GAAc,cAA0C,MAAS;AAEvE,MAAM,sBAAsB,WAAA,CAAY;AAExC,MAAM,iBAAiB,MAA6C;AACzE,EAAA,MAAM,GAAA,GAAM,WAAW,WAAW,CAAA;AAClC,EAAA,SAAA;AAAA,IACE,CAAC,CAAC,GAAA;AAAA,IACF;AAAA,GACF;AACA,EAAA,OAAO,GAAA;AACT;AAEO,MAAM,sBAAA,GAAyB,MACpC,UAAA,CAAW,WAAW;;;;"}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
export { Field, typedField } from './components/src/integrations/react-hook-form/components/Field/Field.mjs';
|
|
4
4
|
export { Form } from './components/src/integrations/react-hook-form/components/Form/Form.mjs';
|
|
5
|
-
export { useFormContext } from './components/src/integrations/react-hook-form/components/context/formContext.mjs';
|
|
5
|
+
export { useFormContext, useOptionalFormContext } from './components/src/integrations/react-hook-form/components/context/formContext.mjs';
|
|
6
6
|
//# sourceMappingURL=react-hook-form.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAIvB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAOzB,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,WAAW,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;AAE1E,KAAK,iBAAiB,GAAG,aAAa,CACpC,iBAAiB,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;CAC1D,CAAC,CACH,CAAC;AAEF,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,WAAW,CAC9C,SAAQ,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,EAC9C,iBAAiB;IACnB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAID,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,2CAsF9D;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
2
|
+
import { Dispatch } from 'react';
|
|
2
3
|
interface FormContext<F extends FieldValues> {
|
|
3
4
|
form: UseFormReturn<F>;
|
|
4
5
|
id: string;
|
|
6
|
+
setReadonly: Dispatch<React.SetStateAction<boolean>>;
|
|
5
7
|
}
|
|
6
8
|
type AnyFormContext = FormContext<any>;
|
|
7
9
|
export declare const formContext: import('react').Context<AnyFormContext | undefined>;
|
|
8
10
|
export declare const FormContextProvider: import('react').Provider<AnyFormContext | undefined>;
|
|
9
11
|
export declare const useFormContext: <F extends FieldValues>() => FormContext<F>;
|
|
12
|
+
export declare const useOptionalFormContext: <F extends FieldValues>() => FormContext<F> | undefined;
|
|
10
13
|
export {};
|
|
11
14
|
//# sourceMappingURL=formContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formContext.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/context/formContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"formContext.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/context/formContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAA6B,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjE,UAAU,WAAW,CAAC,CAAC,SAAS,WAAW;IACzC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CACtD;AAGD,KAAK,cAAc,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;AAEvC,eAAO,MAAM,WAAW,qDAAuD,CAAC;AAEhF,eAAO,MAAM,mBAAmB,sDAAuB,CAAC;AAExD,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,WAAW,OAAK,WAAW,CAAC,CAAC,CAOrE,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,WAAW,OAC/B,WAAW,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './components/Field';
|
|
2
2
|
export * from './components/Form';
|
|
3
|
-
export { useFormContext } from './components/context/formContext';
|
|
3
|
+
export { useFormContext, useOptionalFormContext, } from './components/context/formContext';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/react-hook-form/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/react-hook-form/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,kCAAkC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.541",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@internationalized/string-compiler": "^3.2.6",
|
|
60
60
|
"@mittwald/password-tools-js": "3.0.0-alpha.18",
|
|
61
|
-
"@mittwald/react-tunnel": "0.2.0-alpha.
|
|
61
|
+
"@mittwald/react-tunnel": "0.2.0-alpha.541",
|
|
62
62
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
63
63
|
"@react-aria/form": "^3.1.2",
|
|
64
64
|
"@react-aria/live-announcer": "^3.4.4",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@faker-js/faker": "^10.1.0",
|
|
102
102
|
"@internationalized/date": "^3.10.0",
|
|
103
103
|
"@mittwald/flow-core": "",
|
|
104
|
-
"@mittwald/flow-design-tokens": "0.2.0-alpha.
|
|
104
|
+
"@mittwald/flow-design-tokens": "0.2.0-alpha.541",
|
|
105
105
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
106
106
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.10",
|
|
107
107
|
"@mittwald/typescript-config": "",
|
|
@@ -174,5 +174,5 @@
|
|
|
174
174
|
"optional": true
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
|
-
"gitHead": "
|
|
177
|
+
"gitHead": "9ef442d79c5d915e70422a74a1a8f5a91349b625"
|
|
178
178
|
}
|