@mittwald/flow-react-components 0.2.0-alpha.540 → 0.2.0-alpha.542
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 +16 -0
- package/dist/assets/doc-properties.json +21150 -21150
- package/dist/css/all.css +1 -1
- package/dist/js/components/src/components/Message/Message.mjs +13 -4
- package/dist/js/components/src/components/Message/Message.mjs.map +1 -1
- package/dist/js/components/src/components/Message/Message.module.scss.mjs +3 -1
- package/dist/js/components/src/components/Message/Message.module.scss.mjs.map +1 -1
- 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/components/Message/Message.d.ts.map +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
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import styles from './Message.module.scss.mjs';
|
|
6
|
+
import { dynamic } from '../../lib/propsContext/dynamicProps/dynamic.mjs';
|
|
7
|
+
import '../../lib/propsContext/propsContext.mjs';
|
|
8
|
+
import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
6
9
|
import 'react';
|
|
7
10
|
import '@tabler/icons-react';
|
|
8
11
|
import '../Icon/Icon.mjs';
|
|
9
12
|
import '../../views/IconView.mjs';
|
|
10
13
|
import { IconContextMenu } from '../Icon/components/icons/IconContextMenu.mjs';
|
|
11
|
-
import '../../lib/propsContext/propsContext.mjs';
|
|
12
|
-
import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
13
14
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
14
15
|
|
|
15
16
|
const Message = flowComponent("Message", (props) => {
|
|
16
17
|
const { type = "responder", children, className } = props;
|
|
17
18
|
const rootClassName = clsx(styles.message, styles[type], className);
|
|
18
19
|
const propsContext = {
|
|
19
|
-
Content: {
|
|
20
|
+
Content: {
|
|
21
|
+
className: styles.content,
|
|
22
|
+
children: dynamic((props2) => {
|
|
23
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
+
/* @__PURE__ */ jsx("div", { className: styles.tip }),
|
|
25
|
+
props2.children
|
|
26
|
+
] });
|
|
27
|
+
})
|
|
28
|
+
},
|
|
20
29
|
Header: {
|
|
21
30
|
className: styles.header,
|
|
22
31
|
Button: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.mjs","sources":["../../../../../../src/components/Message/Message.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./Message.module.scss\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport type
|
|
1
|
+
{"version":3,"file":"Message.mjs","sources":["../../../../../../src/components/Message/Message.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./Message.module.scss\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport { IconContextMenu } from \"@/components/Icon/components/icons\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\n\nexport interface MessageProps\n extends PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps {\n /** Determines the color and orientation of the message. @default \"responder\" */\n type?: \"responder\" | \"sender\";\n}\n\n/** @flr-generate all */\nexport const Message = flowComponent(\"Message\", (props) => {\n const { type = \"responder\", children, className } = props;\n\n const rootClassName = clsx(styles.message, styles[type], className);\n\n const propsContext: PropsContext = {\n Content: {\n className: styles.content,\n children: dynamic((props) => {\n return (\n <>\n <div className={styles.tip} />\n {props.children}\n </>\n );\n }),\n },\n Header: {\n className: styles.header,\n Button: {\n className: styles.action,\n size: \"s\",\n variant: \"plain\",\n color: \"secondary\",\n },\n ContextMenuTrigger: {\n Button: {\n className: styles.action,\n size: \"s\",\n variant: \"plain\",\n color: \"secondary\",\n children: <IconContextMenu />,\n },\n },\n Text: { className: styles.date },\n Align: {\n className: styles.user,\n },\n },\n };\n\n return (\n <PropsContextProvider props={propsContext}>\n <article className={rootClassName}>{children}</article>\n </PropsContextProvider>\n );\n});\n\nexport default Message;\n"],"names":["props"],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,OAAA,GAAU,aAAA,CAAc,SAAA,EAAW,CAAC,KAAA,KAAU;AACzD,EAAA,MAAM,EAAE,IAAA,GAAO,WAAA,EAAa,QAAA,EAAU,WAAU,GAAI,KAAA;AAEpD,EAAA,MAAM,gBAAgB,IAAA,CAAK,MAAA,CAAO,SAAS,MAAA,CAAO,IAAI,GAAG,SAAS,CAAA;AAElE,EAAA,MAAM,YAAA,GAA6B;AAAA,IACjC,OAAA,EAAS;AAAA,MACP,WAAW,MAAA,CAAO,OAAA;AAAA,MAClB,QAAA,EAAU,OAAA,CAAQ,CAACA,MAAAA,KAAU;AAC3B,QAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,GAAA,EAAK,CAAA;AAAA,UAC3BA,MAAAA,CAAM;AAAA,SAAA,EACT,CAAA;AAAA,MAEJ,CAAC;AAAA,KACH;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,WAAW,MAAA,CAAO,MAAA;AAAA,MAClB,MAAA,EAAQ;AAAA,QACN,WAAW,MAAA,CAAO,MAAA;AAAA,QAClB,IAAA,EAAM,GAAA;AAAA,QACN,OAAA,EAAS,OAAA;AAAA,QACT,KAAA,EAAO;AAAA,OACT;AAAA,MACA,kBAAA,EAAoB;AAAA,QAClB,MAAA,EAAQ;AAAA,UACN,WAAW,MAAA,CAAO,MAAA;AAAA,UAClB,IAAA,EAAM,GAAA;AAAA,UACN,OAAA,EAAS,OAAA;AAAA,UACT,KAAA,EAAO,WAAA;AAAA,UACP,QAAA,sBAAW,eAAA,EAAA,EAAgB;AAAA;AAC7B,OACF;AAAA,MACA,IAAA,EAAM,EAAE,SAAA,EAAW,MAAA,CAAO,IAAA,EAAK;AAAA,MAC/B,KAAA,EAAO;AAAA,QACL,WAAW,MAAA,CAAO;AAAA;AACpB;AACF,GACF;AAEA,EAAA,uBACE,GAAA,CAAC,wBAAqB,KAAA,EAAO,YAAA,EAC3B,8BAAC,SAAA,EAAA,EAAQ,SAAA,EAAW,aAAA,EAAgB,QAAA,EAAS,CAAA,EAC/C,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
const message = "flow--message";
|
|
4
4
|
const content = "flow--message--content";
|
|
5
|
+
const tip = "flow--message--tip";
|
|
5
6
|
const sender = "flow--message--sender";
|
|
6
7
|
const header = "flow--message--header";
|
|
7
8
|
const user = "flow--message--user";
|
|
@@ -11,6 +12,7 @@ const action = "flow--message--action";
|
|
|
11
12
|
const styles = {
|
|
12
13
|
message: message,
|
|
13
14
|
content: content,
|
|
15
|
+
tip: tip,
|
|
14
16
|
sender: sender,
|
|
15
17
|
header: header,
|
|
16
18
|
user: user,
|
|
@@ -19,5 +21,5 @@ const styles = {
|
|
|
19
21
|
action: action
|
|
20
22
|
};
|
|
21
23
|
|
|
22
|
-
export { action, content, date, styles as default, header, message, responder, sender, user };
|
|
24
|
+
export { action, content, date, styles as default, header, message, responder, sender, tip, user };
|
|
23
25
|
//# sourceMappingURL=Message.module.scss.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Message.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -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":";;;;;;;;;;;;AAwCA,MAAM,uBAA0C,CAAC,CAAA,qBAAM,GAAA,CAAC,MAAA,EAAA,EAAM,GAAG,CAAA,EAAG,CAAA;AAE7D,SAAS,KAA4B,KAAA,EAAqB;AAC/D,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAA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GED
|
@@ -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":"Message.d.ts","sourceRoot":"","sources":["../../../../src/components/Message/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../src/components/Message/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAO5D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sCAAsC,CAAC;AAE9C,MAAM,WAAW,YACf,SAAQ,iBAAiB,EACvB,kBAAkB,EAClB,kBAAkB;IACpB,gFAAgF;IAChF,IAAI,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;CAC/B;AAED,wBAAwB;AACxB,eAAO,MAAM,OAAO,iGA8ClB,CAAC;AAEH,eAAe,OAAO,CAAC"}
|
|
@@ -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.542",
|
|
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.542",
|
|
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.542",
|
|
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": "c1761e24b2eebf2a83fb3afb5b0bb3ef3d464d2b"
|
|
178
178
|
}
|