@mittwald/flow-react-components 0.2.0-alpha.477 → 0.2.0-alpha.479

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/assets/doc-properties.json +652 -933
  3. package/dist/js/components/src/components/Action/models/ActionState.mjs.map +1 -1
  4. package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs +16 -20
  5. package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs.map +1 -1
  6. package/dist/js/components/src/components/MarkdownEditor/components/ModeButton.mjs +6 -4
  7. package/dist/js/components/src/components/MarkdownEditor/components/ModeButton.mjs.map +1 -1
  8. package/dist/js/components/src/components/MarkdownEditor/components/Toolbar.mjs +14 -11
  9. package/dist/js/components/src/components/MarkdownEditor/components/Toolbar.mjs.map +1 -1
  10. package/dist/js/components/src/components/MarkdownEditor/components/ToolbarButton.mjs +3 -13
  11. package/dist/js/components/src/components/MarkdownEditor/components/ToolbarButton.mjs.map +1 -1
  12. package/dist/js/components/src/components/MarkdownEditor/lib/handleKeyDown.mjs +7 -12
  13. package/dist/js/components/src/components/MarkdownEditor/lib/handleKeyDown.mjs.map +1 -1
  14. package/dist/js/components/src/components/MarkdownEditor/lib/insertAtCursor.mjs +4 -3
  15. package/dist/js/components/src/components/MarkdownEditor/lib/insertAtCursor.mjs.map +1 -1
  16. package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs +4 -19
  17. package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
  18. package/dist/js/components/src/components/PasswordCreationField/components/PasswordGenerateButton/PasswordGenerateButton.mjs +1 -1
  19. package/dist/js/components/src/components/PasswordCreationField/components/PasswordGenerateButton/PasswordGenerateButton.mjs.map +1 -1
  20. package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +15 -26
  21. package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
  22. package/dist/js/components/src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.mjs +70 -0
  23. package/dist/js/components/src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.mjs.map +1 -0
  24. package/dist/js/components/src/lib/hooks/useManagedValue.mjs +23 -0
  25. package/dist/js/components/src/lib/hooks/useManagedValue.mjs.map +1 -0
  26. package/dist/types/components/Action/models/ActionState.d.ts +1 -1
  27. package/dist/types/components/Action/models/ActionState.d.ts.map +1 -1
  28. package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
  29. package/dist/types/components/MarkdownEditor/components/ModeButton.d.ts +5 -6
  30. package/dist/types/components/MarkdownEditor/components/ModeButton.d.ts.map +1 -1
  31. package/dist/types/components/MarkdownEditor/components/Toolbar.d.ts +9 -11
  32. package/dist/types/components/MarkdownEditor/components/Toolbar.d.ts.map +1 -1
  33. package/dist/types/components/MarkdownEditor/components/ToolbarButton.d.ts +5 -11
  34. package/dist/types/components/MarkdownEditor/components/ToolbarButton.d.ts.map +1 -1
  35. package/dist/types/components/MarkdownEditor/lib/handleKeyDown.d.ts +1 -1
  36. package/dist/types/components/MarkdownEditor/lib/handleKeyDown.d.ts.map +1 -1
  37. package/dist/types/components/MarkdownEditor/lib/insertAtCursor.d.ts +1 -1
  38. package/dist/types/components/MarkdownEditor/lib/insertAtCursor.d.ts.map +1 -1
  39. package/dist/types/components/MarkdownEditor/stories/Default.stories.d.ts.map +1 -1
  40. package/dist/types/components/PasswordCreationField/PasswordCreationField.d.ts.map +1 -1
  41. package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts +2 -2
  42. package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
  43. package/dist/types/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.d.ts +7 -0
  44. package/dist/types/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.d.ts.map +1 -0
  45. package/dist/types/lib/hooks/useManagedValue.d.ts +11 -0
  46. package/dist/types/lib/hooks/useManagedValue.d.ts.map +1 -0
  47. package/package.json +4 -4
  48. package/dist/js/components/src/components/Action/ActionStateContext.mjs +0 -24
  49. package/dist/js/components/src/components/Action/ActionStateContext.mjs.map +0 -1
  50. package/dist/js/components/src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.mjs +0 -44
  51. package/dist/js/components/src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.mjs.map +0 -1
  52. package/dist/js/components/src/integrations/react-hook-form/components/AfterFormSubmitEffect/AfterFormSubmitEffect.mjs +0 -32
  53. package/dist/js/components/src/integrations/react-hook-form/components/AfterFormSubmitEffect/AfterFormSubmitEffect.mjs.map +0 -1
  54. package/dist/types/components/Action/ActionStateContext.d.ts +0 -9
  55. package/dist/types/components/Action/ActionStateContext.d.ts.map +0 -1
  56. package/dist/types/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.d.ts +0 -7
  57. package/dist/types/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.d.ts.map +0 -1
  58. package/dist/types/integrations/react-hook-form/components/AfterFormSubmitEffect/AfterFormSubmitEffect.d.ts +0 -15
  59. package/dist/types/integrations/react-hook-form/components/AfterFormSubmitEffect/AfterFormSubmitEffect.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActionStateContext.mjs","sources":["../../../../../../src/components/Action/ActionStateContext.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport React, { useEffect } from \"react\";\nimport { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport Action from \"@/components/Action/index\";\n\ninterface Props extends PropsWithChildren {\n isStarted?: boolean;\n hasSucceeded?: boolean;\n hasFailedWithError?: unknown;\n}\n\nexport const ActionStateContext: FC<Props> = (props) => {\n const { isStarted, hasFailedWithError, hasSucceeded, children } = props;\n const action = ActionModel.useNew({});\n\n useEffect(() => {\n if (hasSucceeded) {\n void action.state.onSucceeded();\n } else if (hasFailedWithError) {\n void action.state.onFailed(hasFailedWithError);\n } else if (isStarted) {\n void action.state.onAsyncStart();\n }\n }, [isStarted, hasFailedWithError, hasSucceeded]);\n\n return <Action actionModel={action}>{children}</Action>;\n};\n"],"names":[],"mappings":";;;;;AAWa,MAAA,kBAAA,GAAgC,CAAC,KAAU,KAAA;AACtD,EAAA,MAAM,EAAE,SAAA,EAAW,kBAAoB,EAAA,YAAA,EAAc,UAAa,GAAA,KAAA;AAClE,EAAA,MAAM,MAAS,GAAA,WAAA,CAAY,MAAO,CAAA,EAAE,CAAA;AAEpC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,YAAc,EAAA;AAChB,MAAK,KAAA,MAAA,CAAO,MAAM,WAAY,EAAA;AAAA,eACrB,kBAAoB,EAAA;AAC7B,MAAK,KAAA,MAAA,CAAO,KAAM,CAAA,QAAA,CAAS,kBAAkB,CAAA;AAAA,eACpC,SAAW,EAAA;AACpB,MAAK,KAAA,MAAA,CAAO,MAAM,YAAa,EAAA;AAAA;AACjC,GACC,EAAA,CAAC,SAAW,EAAA,kBAAA,EAAoB,YAAY,CAAC,CAAA;AAEhD,EAAA,uBAAQ,GAAA,CAAA,MAAA,EAAA,EAAO,WAAa,EAAA,MAAA,EAAS,QAAS,EAAA,CAAA;AAChD;;;;"}
@@ -1,44 +0,0 @@
1
- "use client"
2
- /* */
3
- import { jsx } from 'react/jsx-runtime';
4
- import { useState, useEffect } from 'react';
5
- import { ActionStateContext } from '../../../../components/Action/ActionStateContext.mjs';
6
- import { useFormContext } from '../context/formContext.mjs';
7
-
8
- const ActionStateContextWrapper = (props) => {
9
- const { children, isAsyncSubmit } = props;
10
- const form = useFormContext().form;
11
- const [submitErrors, setSubmitErrors] = useState(void 0);
12
- const [hasSucceeded, setHasSucceeded] = useState(false);
13
- const [isStarted, setIsStarted] = useState(false);
14
- useEffect(() => {
15
- const { isSubmitted, isSubmitting, isSubmitSuccessful, errors } = form.formState;
16
- setSubmitErrors(
17
- isSubmitted && errors && Object.entries(errors).length > 0 ? errors : void 0
18
- );
19
- setHasSucceeded(isSubmitted && isSubmitSuccessful);
20
- setIsStarted(isSubmitting && isAsyncSubmit.current);
21
- }, [
22
- form.formState.isSubmitted,
23
- form.formState.isSubmitting,
24
- form.formState.isSubmitSuccessful,
25
- form.formState.errors,
26
- isAsyncSubmit.current
27
- ]);
28
- return /* @__PURE__ */ jsx(
29
- ActionStateContext,
30
- {
31
- isStarted,
32
- hasFailedWithError: submitErrors,
33
- hasSucceeded,
34
- children
35
- }
36
- );
37
- };
38
- const SubmitButtonStateProvider = (props) => {
39
- const { children, isAsyncSubmit } = props;
40
- return /* @__PURE__ */ jsx(ActionStateContextWrapper, { isAsyncSubmit, children });
41
- };
42
-
43
- export { SubmitButtonStateProvider };
44
- //# sourceMappingURL=SubmitButtonStateProvider.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SubmitButtonStateProvider.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren, RefObject } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { ActionStateContext } from \"@/components/Action/ActionStateContext\";\nimport { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\n\ninterface Props extends PropsWithChildren {\n isAsyncSubmit: RefObject<boolean>;\n}\n\nconst ActionStateContextWrapper: FC<Props> = (props) => {\n const { children, isAsyncSubmit } = props;\n\n const form = useFormContext().form;\n\n const [submitErrors, setSubmitErrors] = useState<unknown>(undefined);\n const [hasSucceeded, setHasSucceeded] = useState(false);\n const [isStarted, setIsStarted] = useState(false);\n\n useEffect(() => {\n /**\n * The mapping into sepearte states inside this effect is required, because\n * otherwise the reset() function of RHF does not work as expected\n * (subsequent resets not working, default values are not correctly re-used,\n * ...).\n *\n * A side note: This only happens if 'isSubmitted' and/or 'isSubmitting' are\n * extracted from the form state.\n */\n const { isSubmitted, isSubmitting, isSubmitSuccessful, errors } =\n form.formState;\n\n setSubmitErrors(\n isSubmitted && errors && Object.entries(errors).length > 0\n ? errors\n : undefined,\n );\n setHasSucceeded(isSubmitted && isSubmitSuccessful);\n setIsStarted(isSubmitting && isAsyncSubmit.current);\n }, [\n form.formState.isSubmitted,\n form.formState.isSubmitting,\n form.formState.isSubmitSuccessful,\n form.formState.errors,\n isAsyncSubmit.current,\n ]);\n\n return (\n <ActionStateContext\n isStarted={isStarted}\n hasFailedWithError={submitErrors}\n hasSucceeded={hasSucceeded}\n >\n {children}\n </ActionStateContext>\n );\n};\n\nexport const SubmitButtonStateProvider: FC<Props> = (props) => {\n const { children, isAsyncSubmit } = props;\n\n return (\n <ActionStateContextWrapper isAsyncSubmit={isAsyncSubmit}>\n {children}\n </ActionStateContextWrapper>\n );\n};\n"],"names":[],"mappings":";;;;;AASA,MAAM,yBAAA,GAAuC,CAAC,KAAU,KAAA;AACtD,EAAM,MAAA,EAAE,QAAU,EAAA,aAAA,EAAkB,GAAA,KAAA;AAEpC,EAAM,MAAA,IAAA,GAAO,gBAAiB,CAAA,IAAA;AAE9B,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAkB,MAAS,CAAA;AACnE,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,CAAA,GAAI,SAAS,KAAK,CAAA;AACtD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhD,EAAA,SAAA,CAAU,MAAM;AAUd,IAAA,MAAM,EAAE,WAAa,EAAA,YAAA,EAAc,kBAAoB,EAAA,MAAA,KACrD,IAAK,CAAA,SAAA;AAEP,IAAA,eAAA;AAAA,MACE,WAAA,IAAe,UAAU,MAAO,CAAA,OAAA,CAAQ,MAAM,CAAE,CAAA,MAAA,GAAS,IACrD,MACA,GAAA;AAAA,KACN;AACA,IAAA,eAAA,CAAgB,eAAe,kBAAkB,CAAA;AACjD,IAAa,YAAA,CAAA,YAAA,IAAgB,cAAc,OAAO,CAAA;AAAA,GACjD,EAAA;AAAA,IACD,KAAK,SAAU,CAAA,WAAA;AAAA,IACf,KAAK,SAAU,CAAA,YAAA;AAAA,IACf,KAAK,SAAU,CAAA,kBAAA;AAAA,IACf,KAAK,SAAU,CAAA,MAAA;AAAA,IACf,aAAc,CAAA;AAAA,GACf,CAAA;AAED,EACE,uBAAA,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,kBAAoB,EAAA,YAAA;AAAA,MACpB,YAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ,CAAA;AAEa,MAAA,yBAAA,GAAuC,CAAC,KAAU,KAAA;AAC7D,EAAM,MAAA,EAAE,QAAU,EAAA,aAAA,EAAkB,GAAA,KAAA;AAEpC,EACE,uBAAA,GAAA,CAAC,yBAA0B,EAAA,EAAA,aAAA,EACxB,QACH,EAAA,CAAA;AAEJ;;;;"}
@@ -1,32 +0,0 @@
1
- "use client"
2
- /* */
3
- import { useFormContext } from '../context/formContext.mjs';
4
- import { useEffect } from 'react';
5
- import { useFormState } from 'react-hook-form';
6
-
7
- const callAfterSubmitFunction = (result) => {
8
- const callFn = (something) => {
9
- if (typeof something === "function") {
10
- something();
11
- }
12
- };
13
- if (result instanceof Promise) {
14
- result.then(callFn);
15
- } else {
16
- callFn(result);
17
- }
18
- };
19
- const AfterFormSubmitEffect = (props) => {
20
- const { submitHandlerResultRef } = props;
21
- const form = useFormContext().form;
22
- const { isValid, isSubmitSuccessful } = useFormState(form);
23
- useEffect(() => {
24
- if (isSubmitSuccessful && isValid) {
25
- callAfterSubmitFunction(submitHandlerResultRef.current);
26
- }
27
- }, [isSubmitSuccessful, isValid, form]);
28
- return null;
29
- };
30
-
31
- export { AfterFormSubmitEffect };
32
- //# sourceMappingURL=AfterFormSubmitEffect.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AfterFormSubmitEffect.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/AfterFormSubmitEffect/AfterFormSubmitEffect.tsx"],"sourcesContent":["import { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport type { FC, RefObject } from \"react\";\nimport { useEffect } from \"react\";\nimport { useFormState } from \"react-hook-form\";\n\ninterface Props {\n submitHandlerResultRef: RefObject<unknown>;\n}\n\nconst callAfterSubmitFunction = (result: unknown) => {\n const callFn = (something: unknown) => {\n if (typeof something === \"function\") {\n something();\n }\n };\n\n if (result instanceof Promise) {\n result.then(callFn);\n } else {\n callFn(result);\n }\n};\n\n/**\n * This effect has its own component to prevent unnecessary re-renders of the\n * entire form when the form state changes (useFormState).\n *\n * This component mimics the required effect to reset a form after submit with a\n * simpler to use callback function. See the React Hook docs about resetting\n * form on submit: https://arc.net/l/quote/zslpdgfz\n */\nexport const AfterFormSubmitEffect: FC<Props> = (props) => {\n const { submitHandlerResultRef } = props;\n const form = useFormContext().form;\n const { isValid, isSubmitSuccessful } = useFormState(form);\n\n useEffect(() => {\n if (isSubmitSuccessful && isValid) {\n callAfterSubmitFunction(submitHandlerResultRef.current);\n }\n }, [isSubmitSuccessful, isValid, form]);\n\n return null;\n};\n"],"names":[],"mappings":";;;;AASA,MAAM,uBAAA,GAA0B,CAAC,MAAoB,KAAA;AACnD,EAAM,MAAA,MAAA,GAAS,CAAC,SAAuB,KAAA;AACrC,IAAI,IAAA,OAAO,cAAc,UAAY,EAAA;AACnC,MAAU,SAAA,EAAA;AAAA;AACZ,GACF;AAEA,EAAA,IAAI,kBAAkB,OAAS,EAAA;AAC7B,IAAA,MAAA,CAAO,KAAK,MAAM,CAAA;AAAA,GACb,MAAA;AACL,IAAA,MAAA,CAAO,MAAM,CAAA;AAAA;AAEjB,CAAA;AAUa,MAAA,qBAAA,GAAmC,CAAC,KAAU,KAAA;AACzD,EAAM,MAAA,EAAE,wBAA2B,GAAA,KAAA;AACnC,EAAM,MAAA,IAAA,GAAO,gBAAiB,CAAA,IAAA;AAC9B,EAAA,MAAM,EAAE,OAAA,EAAS,kBAAmB,EAAA,GAAI,aAAa,IAAI,CAAA;AAEzD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,sBAAsB,OAAS,EAAA;AACjC,MAAA,uBAAA,CAAwB,uBAAuB,OAAO,CAAA;AAAA;AACxD,GACC,EAAA,CAAC,kBAAoB,EAAA,OAAA,EAAS,IAAI,CAAC,CAAA;AAEtC,EAAO,OAAA,IAAA;AACT;;;;"}
@@ -1,9 +0,0 @@
1
- import { FC, PropsWithChildren } from 'react';
2
- interface Props extends PropsWithChildren {
3
- isStarted?: boolean;
4
- hasSucceeded?: boolean;
5
- hasFailedWithError?: unknown;
6
- }
7
- export declare const ActionStateContext: FC<Props>;
8
- export {};
9
- //# sourceMappingURL=ActionStateContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActionStateContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/ActionStateContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKnD,UAAU,KAAM,SAAQ,iBAAiB;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,KAAK,CAexC,CAAC"}
@@ -1,7 +0,0 @@
1
- import { FC, PropsWithChildren, RefObject } from 'react';
2
- interface Props extends PropsWithChildren {
3
- isAsyncSubmit: RefObject<boolean>;
4
- }
5
- export declare const SubmitButtonStateProvider: FC<Props>;
6
- export {};
7
- //# sourceMappingURL=SubmitButtonStateProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SubmitButtonStateProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK9D,UAAU,KAAM,SAAQ,iBAAiB;IACvC,aAAa,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CACnC;AAkDD,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,KAAK,CAQ/C,CAAC"}
@@ -1,15 +0,0 @@
1
- import { FC, RefObject } from 'react';
2
- interface Props {
3
- submitHandlerResultRef: RefObject<unknown>;
4
- }
5
- /**
6
- * This effect has its own component to prevent unnecessary re-renders of the
7
- * entire form when the form state changes (useFormState).
8
- *
9
- * This component mimics the required effect to reset a form after submit with a
10
- * simpler to use callback function. See the React Hook docs about resetting
11
- * form on submit: https://arc.net/l/quote/zslpdgfz
12
- */
13
- export declare const AfterFormSubmitEffect: FC<Props>;
14
- export {};
15
- //# sourceMappingURL=AfterFormSubmitEffect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AfterFormSubmitEffect.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/AfterFormSubmitEffect/AfterFormSubmitEffect.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3C,UAAU,KAAK;IACb,sBAAsB,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5C;AAgBD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,KAAK,CAY3C,CAAC"}