@mittwald/flow-react-components 0.2.0-alpha.551 → 0.2.0-alpha.553

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 (165) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/assets/doc-properties.json +37652 -32936
  3. package/dist/css/all.css +1 -1
  4. package/dist/js/_virtual/_.locale.json@bb0db7b5021f874310cbe5b6cc3d9cac.mjs +2 -2
  5. package/dist/js/components/src/components/Action/Action.mjs +1 -0
  6. package/dist/js/components/src/components/Action/Action.mjs.map +1 -1
  7. package/dist/js/components/src/components/Action/models/ActionState.mjs +1 -1
  8. package/dist/js/components/src/components/Action/models/ActionState.mjs.map +1 -1
  9. package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs +1 -1
  10. package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
  11. package/dist/js/components/src/components/Button/Button.mjs +1 -1
  12. package/dist/js/components/src/components/Button/Button.mjs.map +1 -1
  13. package/dist/js/components/src/components/CartesianChart/CartesianChart.mjs +120 -25
  14. package/dist/js/components/src/components/CartesianChart/CartesianChart.mjs.map +1 -1
  15. package/dist/js/components/src/components/CartesianChart/components/Area/Area.mjs +5 -11
  16. package/dist/js/components/src/components/CartesianChart/components/Area/Area.mjs.map +1 -1
  17. package/dist/js/components/src/components/CartesianChart/components/YAxis/YAxis.mjs +1 -1
  18. package/dist/js/components/src/components/CartesianChart/components/YAxis/YAxis.mjs.map +1 -1
  19. package/dist/js/components/src/components/Checkbox/Checkbox.mjs +18 -6
  20. package/dist/js/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
  21. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs +15 -3
  22. package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs.map +1 -1
  23. package/dist/js/components/src/components/ComboBox/ComboBox.mjs +25 -4
  24. package/dist/js/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
  25. package/dist/js/components/src/components/FileField/FileField.mjs +7 -3
  26. package/dist/js/components/src/components/FileField/FileField.mjs.map +1 -1
  27. package/dist/js/components/src/components/Markdown/Markdown.mjs +2 -1
  28. package/dist/js/components/src/components/Markdown/Markdown.mjs.map +1 -1
  29. package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs +107 -45
  30. package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.mjs.map +1 -1
  31. package/dist/js/components/src/components/MarkdownEditor/MarkdownEditor.module.scss.mjs +3 -3
  32. package/dist/js/components/src/components/MarkdownEditor/components/ToolbarButton.mjs +1 -0
  33. package/dist/js/components/src/components/MarkdownEditor/components/ToolbarButton.mjs.map +1 -1
  34. package/dist/js/components/src/components/MarkdownEditor/lib/{handleKeyDown.mjs → modifyValueByMarkdownSyntax.mjs} +20 -29
  35. package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.mjs.map +1 -0
  36. package/dist/js/components/src/components/MarkdownEditor/lib/{insertAtCursor.mjs → modifyValueByType.mjs} +17 -11
  37. package/dist/js/components/src/components/MarkdownEditor/lib/modifyValueByType.mjs.map +1 -0
  38. package/dist/js/components/src/components/NumberField/NumberField.mjs +11 -2
  39. package/dist/js/components/src/components/NumberField/NumberField.mjs.map +1 -1
  40. package/dist/js/components/src/components/Popover/Popover.mjs +9 -2
  41. package/dist/js/components/src/components/Popover/Popover.mjs.map +1 -1
  42. package/dist/js/components/src/components/SearchField/SearchField.mjs +1 -1
  43. package/dist/js/components/src/components/SearchField/SearchField.mjs.map +1 -1
  44. package/dist/js/components/src/components/Select/Select.mjs +9 -9
  45. package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
  46. package/dist/js/components/src/components/TextArea/TextArea.mjs +10 -5
  47. package/dist/js/components/src/components/TextArea/TextArea.mjs.map +1 -1
  48. package/dist/js/components/src/components/TextField/TextField.mjs +9 -2
  49. package/dist/js/components/src/components/TextField/TextField.mjs.map +1 -1
  50. package/dist/js/components/src/components/propTypes/index.mjs +2 -0
  51. package/dist/js/components/src/components/propTypes/index.mjs.map +1 -1
  52. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs +14 -0
  53. package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
  54. package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +22 -11
  55. package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
  56. package/dist/js/components/src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.mjs +2 -1
  57. package/dist/js/components/src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.mjs.map +1 -1
  58. package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs +51 -0
  59. package/dist/js/components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs.map +1 -0
  60. package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs +57 -0
  61. package/dist/js/components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs.map +1 -0
  62. package/dist/js/components/src/integrations/react-hook-form/components/context/formContext.mjs.map +1 -1
  63. package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs +18 -10
  64. package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs.map +1 -1
  65. package/dist/js/react-hook-form.mjs +2 -0
  66. package/dist/js/react-hook-form.mjs.map +1 -1
  67. package/dist/types/components/Action/Action.d.ts.map +1 -1
  68. package/dist/types/components/Action/models/ActionState.d.ts +5 -0
  69. package/dist/types/components/Action/models/ActionState.d.ts.map +1 -1
  70. package/dist/types/components/CartesianChart/CartesianChart.d.ts +4 -4
  71. package/dist/types/components/CartesianChart/CartesianChart.d.ts.map +1 -1
  72. package/dist/types/components/CartesianChart/components/Area/Area.d.ts.map +1 -1
  73. package/dist/types/components/Checkbox/Checkbox.d.ts +2 -1
  74. package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
  75. package/dist/types/components/CheckboxButton/CheckboxButton.d.ts +2 -0
  76. package/dist/types/components/CheckboxButton/CheckboxButton.d.ts.map +1 -1
  77. package/dist/types/components/ComboBox/ComboBox.d.ts +2 -1
  78. package/dist/types/components/ComboBox/ComboBox.d.ts.map +1 -1
  79. package/dist/types/components/FileField/FileField.d.ts +2 -1
  80. package/dist/types/components/FileField/FileField.d.ts.map +1 -1
  81. package/dist/types/components/List/typedList.d.ts +1 -1
  82. package/dist/types/components/Markdown/Markdown.d.ts +2 -1
  83. package/dist/types/components/Markdown/Markdown.d.ts.map +1 -1
  84. package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +7 -3
  85. package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
  86. package/dist/types/components/MarkdownEditor/MarkdownEditor.test.d.ts +2 -0
  87. package/dist/types/components/MarkdownEditor/MarkdownEditor.test.d.ts.map +1 -0
  88. package/dist/types/components/MarkdownEditor/components/ToolbarButton.d.ts +1 -1
  89. package/dist/types/components/MarkdownEditor/components/ToolbarButton.d.ts.map +1 -1
  90. package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.d.ts +8 -0
  91. package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.d.ts.map +1 -0
  92. package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.test.d.ts +2 -0
  93. package/dist/types/components/MarkdownEditor/lib/modifyValueByMarkdownSyntax.test.d.ts.map +1 -0
  94. package/dist/types/components/MarkdownEditor/lib/modifyValueByType.d.ts +12 -0
  95. package/dist/types/components/MarkdownEditor/lib/modifyValueByType.d.ts.map +1 -0
  96. package/dist/types/components/MarkdownEditor/lib/modifyValueByType.test.d.ts +2 -0
  97. package/dist/types/components/MarkdownEditor/lib/modifyValueByType.test.d.ts.map +1 -0
  98. package/dist/types/components/NumberField/NumberField.d.ts +4 -3
  99. package/dist/types/components/NumberField/NumberField.d.ts.map +1 -1
  100. package/dist/types/components/Popover/Popover.d.ts.map +1 -1
  101. package/dist/types/components/Select/Select.d.ts.map +1 -1
  102. package/dist/types/components/TextArea/TextArea.d.ts +4 -7
  103. package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
  104. package/dist/types/components/TextField/TextField.d.ts.map +1 -1
  105. package/dist/types/components/propTypes/index.d.ts +4 -0
  106. package/dist/types/components/propTypes/index.d.ts.map +1 -1
  107. package/dist/types/integrations/react-hook-form/components/Field/Field.d.ts.map +1 -1
  108. package/dist/types/integrations/react-hook-form/components/Field/stories/Autocomplete.stories.d.ts.map +1 -1
  109. package/dist/types/integrations/react-hook-form/components/Field/stories/Checkbox.stories.d.ts.map +1 -1
  110. package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxButton.stories.d.ts.map +1 -1
  111. package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxGroup.stories.d.ts.map +1 -1
  112. package/dist/types/integrations/react-hook-form/components/Field/stories/ComboBox.stories.d.ts.map +1 -1
  113. package/dist/types/integrations/react-hook-form/components/Field/stories/DatePicker.stories.d.ts.map +1 -1
  114. package/dist/types/integrations/react-hook-form/components/Field/stories/DateRangePicker.stories.d.ts.map +1 -1
  115. package/dist/types/integrations/react-hook-form/components/Field/stories/FileField.stories.d.ts.map +1 -1
  116. package/dist/types/integrations/react-hook-form/components/Field/stories/MarkdownEditor.stories.d.ts.map +1 -1
  117. package/dist/types/integrations/react-hook-form/components/Field/stories/NumberField.stories.d.ts.map +1 -1
  118. package/dist/types/integrations/react-hook-form/components/Field/stories/PasswordCreationField.stories.d.ts.map +1 -1
  119. package/dist/types/integrations/react-hook-form/components/Field/stories/RadioGroup.stories.d.ts.map +1 -1
  120. package/dist/types/integrations/react-hook-form/components/Field/stories/SearchField.stories.d.ts.map +1 -1
  121. package/dist/types/integrations/react-hook-form/components/Field/stories/SegmentedControl.stories.d.ts.map +1 -1
  122. package/dist/types/integrations/react-hook-form/components/Field/stories/Select.stories.d.ts.map +1 -1
  123. package/dist/types/integrations/react-hook-form/components/Field/stories/Slider.stories.d.ts.map +1 -1
  124. package/dist/types/integrations/react-hook-form/components/Field/stories/Switch.stories.d.ts.map +1 -1
  125. package/dist/types/integrations/react-hook-form/components/Field/stories/TextArea.stories.d.ts.map +1 -1
  126. package/dist/types/integrations/react-hook-form/components/Field/stories/TextField.stories.d.ts.map +1 -1
  127. package/dist/types/integrations/react-hook-form/components/Field/stories/TimeField.stories.d.ts.map +1 -1
  128. package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts +4 -3
  129. package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
  130. package/dist/types/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.d.ts +1 -0
  131. package/dist/types/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.d.ts.map +1 -1
  132. package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.d.ts +10 -0
  133. package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.d.ts.map +1 -0
  134. package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.test.d.ts +2 -0
  135. package/dist/types/integrations/react-hook-form/components/ResetButton/ResetButton.test.d.ts.map +1 -0
  136. package/dist/types/integrations/react-hook-form/components/ResetButton/index.d.ts +3 -0
  137. package/dist/types/integrations/react-hook-form/components/ResetButton/index.d.ts.map +1 -0
  138. package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.d.ts +10 -0
  139. package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.d.ts.map +1 -0
  140. package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.test.d.ts +2 -0
  141. package/dist/types/integrations/react-hook-form/components/SubmitButton/SubmitButton.test.d.ts.map +1 -0
  142. package/dist/types/integrations/react-hook-form/components/SubmitButton/index.d.ts +3 -0
  143. package/dist/types/integrations/react-hook-form/components/SubmitButton/index.d.ts.map +1 -0
  144. package/dist/types/integrations/react-hook-form/components/context/formContext.d.ts +6 -2
  145. package/dist/types/integrations/react-hook-form/components/context/formContext.d.ts.map +1 -1
  146. package/dist/types/integrations/react-hook-form/index.d.ts +2 -0
  147. package/dist/types/integrations/react-hook-form/index.d.ts.map +1 -1
  148. package/dist/types/lib/dev/vitest.d.ts +3 -0
  149. package/dist/types/lib/dev/vitest.d.ts.map +1 -0
  150. package/dist/types/lib/propsContext/nestedPropsContext/lib.d.ts +2 -0
  151. package/dist/types/lib/propsContext/nestedPropsContext/lib.d.ts.map +1 -1
  152. package/dist/types/lib/react/ReactAriaControlledValueFix.d.ts.map +1 -1
  153. package/package.json +6 -5
  154. package/dist/js/components/src/components/MarkdownEditor/lib/handleKeyDown.mjs.map +0 -1
  155. package/dist/js/components/src/components/MarkdownEditor/lib/insertAtCursor.mjs.map +0 -1
  156. package/dist/types/components/MarkdownEditor/lib/handleKeyDown.d.ts +0 -3
  157. package/dist/types/components/MarkdownEditor/lib/handleKeyDown.d.ts.map +0 -1
  158. package/dist/types/components/MarkdownEditor/lib/handleKeyDown.test.d.ts +0 -2
  159. package/dist/types/components/MarkdownEditor/lib/handleKeyDown.test.d.ts.map +0 -1
  160. package/dist/types/components/MarkdownEditor/lib/insertAtCursor.d.ts +0 -4
  161. package/dist/types/components/MarkdownEditor/lib/insertAtCursor.d.ts.map +0 -1
  162. package/dist/types/components/MarkdownEditor/lib/insertAtCursor.test.d.ts +0 -2
  163. package/dist/types/components/MarkdownEditor/lib/insertAtCursor.test.d.ts.map +0 -1
  164. package/dist/types/lib/dev/vitestUserEvent.d.ts +0 -3
  165. package/dist/types/lib/dev/vitestUserEvent.d.ts.map +0 -1
@@ -2,11 +2,9 @@
2
2
  /* */
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import { FormContextProvider } from '../context/formContext.mjs';
5
- import { useState, useId, useMemo } from 'react';
5
+ import { useState, useId, useMemo, useRef } from 'react';
6
6
  import { FormProvider } from 'react-hook-form';
7
- import { Action } from '../../../../components/Action/Action.mjs';
8
- import 'react-aria';
9
- import '@react-aria/live-announcer';
7
+ import { useObjectRef } from '@react-aria/utils';
10
8
  import { useRegisterActionStateContext } from './lib/useRegisterActionStateContext.mjs';
11
9
 
12
10
  const DefaultFormComponent = (p) => /* @__PURE__ */ jsx("form", { ...p });
@@ -17,13 +15,17 @@ function Form(props) {
17
15
  onSubmit,
18
16
  formComponent: FormView = DefaultFormComponent,
19
17
  isReadOnly: isReadOnlyFromProps,
18
+ ref,
20
19
  ...formProps
21
20
  } = props;
22
21
  const [readonlyContextState, setReadOnlyContextState] = useState(!!isReadOnlyFromProps);
23
- const isReadOnly = isReadOnlyFromProps || readonlyContextState;
24
22
  const formId = useId();
25
23
  const FormViewComponent = useMemo(() => FormView, [formId]);
26
- const { action, registerSubmitResult } = useRegisterActionStateContext(form);
24
+ const formRef = useObjectRef(ref);
25
+ const submitButtonRef = useRef(null);
26
+ const submitHandlerResultRef = useRef(null);
27
+ const isReadOnly = isReadOnlyFromProps || readonlyContextState;
28
+ const { action, registerSubmitResult, callAfterSubmitFunction } = useRegisterActionStateContext(form);
27
29
  const handleOnSubmit = (e) => {
28
30
  const { isSubmitting, isValidating } = form.control._formState;
29
31
  const formEvent = e && "nativeEvent" in e ? e : void 0;
@@ -32,11 +34,16 @@ function Form(props) {
32
34
  formEvent?.preventDefault();
33
35
  return;
34
36
  }
35
- form.handleSubmit((values) => {
37
+ const submit = form.handleSubmit((values) => {
38
+ setReadOnlyContextState(true);
36
39
  const result = onSubmit(values, formEvent);
37
40
  registerSubmitResult(result);
38
41
  return result;
39
- })(formEvent);
42
+ });
43
+ return submit(formEvent).finally(() => {
44
+ callAfterSubmitFunction(submitHandlerResultRef.current);
45
+ setReadOnlyContextState(false);
46
+ });
40
47
  };
41
48
  return /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsx(
42
49
  FormContextProvider,
@@ -45,17 +52,21 @@ function Form(props) {
45
52
  form,
46
53
  id: formId,
47
54
  isReadOnly,
48
- setReadOnly: setReadOnlyContextState
55
+ setReadOnly: setReadOnlyContextState,
56
+ submit: handleOnSubmit,
57
+ submitButtonRef,
58
+ formActionModel: action
49
59
  },
50
- children: /* @__PURE__ */ jsx(Action, { actionModel: action, children: /* @__PURE__ */ jsx(
60
+ children: /* @__PURE__ */ jsx(
51
61
  FormViewComponent,
52
62
  {
53
63
  ...formProps,
64
+ ref: formRef,
54
65
  id: formId,
55
66
  onSubmit: handleOnSubmit,
56
67
  children
57
68
  }
58
- ) })
69
+ )
59
70
  }
60
71
  ) });
61
72
  }
@@ -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 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 { 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: 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 return (\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n value={{\n form,\n id: formId,\n isReadOnly,\n setReadOnly: setReadOnlyContextState,\n }}\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 );\n}\n\nexport default Form;\n"],"names":["RhfFormContextProvider"],"mappings":";;;;;;;;;AAsCA,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,QAAA;AAAA,IACA,eAAe,QAAA,GAAW,oBAAA;AAAA,IAC1B,UAAA,EAAY,mBAAA;AAAA,IACZ,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,CAAC,oBAAA,EAAsB,uBAAuB,IAClD,QAAA,CAAS,CAAC,CAAC,mBAAmB,CAAA;AAEhC,EAAA,MAAM,aAAa,mBAAA,IAAuB,oBAAA;AAE1C,EAAA,MAAM,SAAS,KAAA,EAAM;AACrB,EAAA,MAAM,oBAAoB,OAAA,CAAQ,MAAM,QAAA,EAAU,CAAC,MAAM,CAAC,CAAA;AAC1D,EAAA,MAAM,EAAE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/components/Form/Form.tsx"],"sourcesContent":["import { FormContextProvider } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport {\n type ComponentProps,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n type RefObject,\n useId,\n useMemo,\n useState,\n useRef,\n type FC,\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 { useObjectRef } from \"@react-aria/utils\";\nimport { useRegisterActionStateContext } from \"@/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\ntype FormComponentType = FC<\n PropsWithChildren<{\n id: string;\n onSubmit?: FormEventHandler | FormOnSubmitHandler<never>;\n ref?: RefObject<HTMLFormElement | null>;\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?: FC<Omit<FormComponentType, \"ref\">>;\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 ref,\n ...formProps\n } = props;\n\n const [readonlyContextState, setReadOnlyContextState] =\n useState(!!isReadOnlyFromProps);\n\n const formId = useId();\n const FormViewComponent = useMemo(() => FormView, [formId]);\n\n const formRef = useObjectRef(ref);\n const submitButtonRef = useRef<HTMLButtonElement>(null);\n const submitHandlerResultRef = useRef<unknown>(null);\n\n const isReadOnly = isReadOnlyFromProps || readonlyContextState;\n\n const { action, registerSubmitResult, callAfterSubmitFunction } =\n 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 const submit = form.handleSubmit((values) => {\n setReadOnlyContextState(true);\n const result = onSubmit(values, formEvent);\n registerSubmitResult(result);\n return result;\n });\n\n return submit(formEvent).finally(() => {\n callAfterSubmitFunction(submitHandlerResultRef.current);\n setReadOnlyContextState(false);\n });\n };\n\n return (\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n value={{\n form,\n id: formId,\n isReadOnly,\n setReadOnly: setReadOnlyContextState,\n submit: handleOnSubmit,\n submitButtonRef: submitButtonRef,\n formActionModel: action,\n }}\n >\n <FormViewComponent\n {...formProps}\n ref={formRef}\n id={formId}\n onSubmit={handleOnSubmit}\n >\n {children}\n </FormViewComponent>\n </FormContextProvider>\n </RhfFormContextProvider>\n );\n}\n\nexport default Form;\n"],"names":["RhfFormContextProvider"],"mappings":";;;;;;;AAyCA,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,QAAA;AAAA,IACA,eAAe,QAAA,GAAW,oBAAA;AAAA,IAC1B,UAAA,EAAY,mBAAA;AAAA,IACZ,GAAA;AAAA,IACA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,CAAC,oBAAA,EAAsB,uBAAuB,IAClD,QAAA,CAAS,CAAC,CAAC,mBAAmB,CAAA;AAEhC,EAAA,MAAM,SAAS,KAAA,EAAM;AACrB,EAAA,MAAM,oBAAoB,OAAA,CAAQ,MAAM,QAAA,EAAU,CAAC,MAAM,CAAC,CAAA;AAE1D,EAAA,MAAM,OAAA,GAAU,aAAa,GAAG,CAAA;AA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AA,EAAI,MAAA;AAAA,QACJ,UAAA;AAAA,QACA,WAAA,EAAa,uBAAA;AAAA,QACb,MAAA,EAAQ,cAAA;AAAA,QACR,eAAA;AAAA,QACA,eAAA,EAAiB;AAAA,OACnB;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACE,GAAG,SAAA;AAAA,UACJ,GAAA,EAAK,OAAA;AAAA,UACL,EAAA,EAAI,MAAA;AAAA,UACJ,QAAA,EAAU,cAAA;AAAA,UAET;AAAA;AAAA;AACH;AAAA,GACF,EACF,CAAA;AAEJ;;;;"}
@@ -66,7 +66,8 @@ const useRegisterActionStateContext = (form) => {
66
66
  };
67
67
  return {
68
68
  action,
69
- registerSubmitResult
69
+ registerSubmitResult,
70
+ callAfterSubmitFunction
70
71
  };
71
72
  };
72
73
 
@@ -1 +1 @@
1
- {"version":3,"file":"useRegisterActionStateContext.mjs","sources":["../../../../../../../../../src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.ts"],"sourcesContent":["import { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { useEffect, useRef } from \"react\";\nimport { isPromise } from \"remeda\";\nimport type { FieldValues, UseFormReturn } from \"react-hook-form\";\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\nexport const useRegisterActionStateContext = <T extends FieldValues>(\n form: UseFormReturn<T>,\n) => {\n const action = ActionModel.useNew({});\n const trackedSubmitCount = useRef(0);\n const submitHandlerResultRef = useRef<unknown>(null);\n\n useEffect(() => {\n return form.subscribe({\n formState: {\n errors: true,\n isValid: true,\n },\n callback: ({\n isValid,\n isSubmitted = false,\n isSubmitSuccessful = false,\n submitCount = 0,\n errors,\n }) => {\n if (submitCount === 0 && trackedSubmitCount.current > 0) {\n trackedSubmitCount.current = 0;\n }\n\n if (trackedSubmitCount.current === submitCount) {\n return;\n }\n trackedSubmitCount.current = submitCount;\n\n if (isSubmitted) {\n if (isSubmitSuccessful) {\n void action.state.onSucceeded();\n\n if (isValid) {\n callAfterSubmitFunction(submitHandlerResultRef.current);\n }\n } else {\n const hasFailedWithError =\n isSubmitted && errors && Object.entries(errors).length > 0\n ? errors\n : undefined;\n\n void action.state.onFailed(hasFailedWithError);\n }\n }\n },\n });\n }, [form.subscribe, action.state]);\n\n const registerSubmitResult = (result: unknown) => {\n if (isPromise(result)) {\n void action.state.onAsyncStart();\n result.then((submitResult) => {\n submitHandlerResultRef.current = submitResult;\n });\n } else {\n submitHandlerResultRef.current = result;\n }\n };\n\n return {\n action,\n registerSubmitResult,\n } as const;\n};\n"],"names":[],"mappings":";;;;AAKA,MAAM,uBAAA,GAA0B,CAAC,MAAA,KAAoB;AACnD,EAAA,MAAM,MAAA,GAAS,CAAC,SAAA,KAAuB;AACrC,IAAA,IAAI,OAAO,cAAc,UAAA,EAAY;AACnC,MAAA,SAAA,EAAU;AAAA,IACZ;AAAA,EACF,CAAA;AAEA,EAAA,IAAI,kBAAkB,OAAA,EAAS;AAC7B,IAAA,MAAA,CAAO,KAAK,MAAM,CAAA;AAAA,EACpB,CAAA,MAAO;AACL,IAAA,MAAA,CAAO,MAAM,CAAA;AAAA,EACf;AACF,CAAA;AAEO,MAAM,6BAAA,GAAgC,CAC3C,IAAA,KACG;AACH,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,MAAA,CAAO,EAAE,CAAA;AACpC,EAAA,MAAM,kBAAA,GAAqB,OAAO,CAAC,CAAA;AACnC,EAAA,MAAM,sBAAA,GAAyB,OAAgB,IAAI,CAAA;AAEnD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,OAAO,KAAK,SAAA,CAAU;AAAA,MACpB,SAAA,EAAW;AAAA,QACT,MAAA,EAAQ,IAAA;AAAA,QACR,OAAA,EAAS;AAAA,OACX;AAAA,MACA,UAAU,CAAC;AAAA,QACT,OAAA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sBAAA,CAAuB,OAAA,GAAU,MAAA;AAAA,IACnC;AAAA,EACF,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useRegisterActionStateContext.mjs","sources":["../../../../../../../../../src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.ts"],"sourcesContent":["import { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { useEffect, useRef } from \"react\";\nimport { isPromise } from \"remeda\";\nimport type { FieldValues, UseFormReturn } from \"react-hook-form\";\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\nexport const useRegisterActionStateContext = <T extends FieldValues>(\n form: UseFormReturn<T>,\n) => {\n const action = ActionModel.useNew({});\n const trackedSubmitCount = useRef(0);\n const submitHandlerResultRef = useRef<unknown>(null);\n\n useEffect(() => {\n return form.subscribe({\n formState: {\n errors: true,\n isValid: true,\n },\n callback: ({\n isValid,\n isSubmitted = false,\n isSubmitSuccessful = false,\n submitCount = 0,\n errors,\n }) => {\n if (submitCount === 0 && trackedSubmitCount.current > 0) {\n trackedSubmitCount.current = 0;\n }\n\n if (trackedSubmitCount.current === submitCount) {\n return;\n }\n trackedSubmitCount.current = submitCount;\n\n if (isSubmitted) {\n if (isSubmitSuccessful) {\n void action.state.onSucceeded();\n\n if (isValid) {\n callAfterSubmitFunction(submitHandlerResultRef.current);\n }\n } else {\n const hasFailedWithError =\n isSubmitted && errors && Object.entries(errors).length > 0\n ? errors\n : undefined;\n\n void action.state.onFailed(hasFailedWithError);\n }\n }\n },\n });\n }, [form.subscribe, action.state]);\n\n const registerSubmitResult = (result: unknown) => {\n if (isPromise(result)) {\n void action.state.onAsyncStart();\n result.then((submitResult) => {\n submitHandlerResultRef.current = submitResult;\n });\n } else {\n submitHandlerResultRef.current = result;\n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WAAA,EAAa;AACf,UAAA,IAAI,kBAAA,EAAoB;AACtB,YAAA,KAAK,MAAA,CAAO,MAAM,WAAA,EAAY;AAE9B,YAAA,IAAI,OAAA,EAAS;AACX,cAAA,uBAAA,CAAwB,uBAAuB,OAAO,CAAA;AAAA,YACxD;AAAA,UACF,CAAA,MAAO;AACL,YAAA,MAAM,kBAAA,GACJ,eAAe,MAAA,IAAU,MAAA,CAAO,QAAQ,MAAM,CAAA,CAAE,MAAA,GAAS,CAAA,GACrD,MAAA,GACA,MAAA;AAEN,YAAA,KAAK,MAAA,CAAO,KAAA,CAAM,QAAA,CAAS,kBAAkB,CAAA;AAAA,UAC/C;AAAA,QACF;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH,GAAG,CAAC,IAAA,CAAK,SAAA,EAAW,MAAA,CAAO,KAAK,CAAC,CAAA;AAEjC,EAAA,MAAM,oBAAA,GAAuB,CAAC,MAAA,KAAoB;AAChD,IAAA,IAAI,SAAA,CAAU,MAAM,CAAA,EAAG;AACrB,MAAA,KAAK,MAAA,CAAO,MAAM,YAAA,EAAa;AAC/B,MAAA,MAAA,CAAO,IAAA,CAAK,CAAC,YAAA,KAAiB;AAC5B,QAAA,sBAAA,CAAuB,OAAA,GAAU,YAAA;AAAA,MACnC,CAAC,CAAA;AAAA,IACH,CAAA,MAAO;AACL,MAAA,sBAAA,CAAuB,OAAA,GAAU,MAAA;AAAA,IACnC;AAAA,EACF,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,oBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,51 @@
1
+ "use client"
2
+ /* */
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { Button } from '../../../../components/Button/Button.mjs';
5
+ import { flowComponent } from '../../../../lib/componentFactory/flowComponent.mjs';
6
+ import { useFormContext } from '../context/formContext.mjs';
7
+ import '../../../../lib/propsContext/propsContext.mjs';
8
+ import '../../../../lib/propsContext/components/PropsContextProvider.mjs';
9
+ import { useMemo } from 'react';
10
+ import 'react-hook-form';
11
+ import 'react-aria';
12
+ import '../../../../views/FieldErrorView.mjs';
13
+ import 'react-hotkeys-hook';
14
+ import 'use-callback-ref';
15
+ import '@react-aria/utils';
16
+ import 'mobx';
17
+ import '../../../../lib/controller/overlay/context.mjs';
18
+ import 'invariant';
19
+ import '../../../../components/Action/context.mjs';
20
+ import '../../../../components/Action/models/ActionStateContext.mjs';
21
+ import 'remeda';
22
+ import '../SubmitButton/SubmitButton.mjs';
23
+
24
+ const ResetButton = flowComponent("ResetButton", (props) => {
25
+ const {
26
+ children,
27
+ ref,
28
+ buttonComponent: ButtonComponent = Button,
29
+ ...rest
30
+ } = props;
31
+ const { id: formId = props.form, form, formActionModel } = useFormContext();
32
+ const ButtonViewComponent = useMemo(() => ButtonComponent, [formId]);
33
+ const actionState = formActionModel.state.useValue();
34
+ return /* @__PURE__ */ jsx(
35
+ ButtonViewComponent,
36
+ {
37
+ color: "secondary",
38
+ variant: "soft",
39
+ ...rest,
40
+ ref,
41
+ isReadOnly: actionState === "isExecuting" || actionState === "isPending",
42
+ type: "reset",
43
+ onPress: () => form.reset(),
44
+ form: formId,
45
+ children
46
+ }
47
+ );
48
+ });
49
+
50
+ export { ResetButton, ResetButton as default };
51
+ //# sourceMappingURL=ResetButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResetButton.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/ResetButton/ResetButton.tsx"],"sourcesContent":["import { Button, type ButtonProps } from \"@/components/Button\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFormContext } from \"@/integrations/react-hook-form\";\nimport { type FC, useMemo } from \"react\";\n\nexport type ResetButtonProps = Omit<\n ButtonProps,\n \"isFailed\" | \"isSucceeded\" | \"isPending\" | \"isReadOnly\" | \"type\"\n> & {\n buttonComponent?: FC<Omit<ButtonProps, \"ref\">>;\n};\n\nexport const ResetButton = flowComponent(\"ResetButton\", (props) => {\n const {\n children,\n ref,\n buttonComponent: ButtonComponent = Button,\n ...rest\n } = props;\n\n const { id: formId = props.form, form, formActionModel } = useFormContext();\n\n const ButtonViewComponent = useMemo(() => ButtonComponent, [formId]);\n const actionState = formActionModel.state.useValue();\n\n return (\n <ButtonViewComponent\n color=\"secondary\"\n variant=\"soft\"\n {...rest}\n ref={ref}\n isReadOnly={actionState === \"isExecuting\" || actionState === \"isPending\"}\n type=\"reset\"\n onPress={() => form.reset()}\n form={formId}\n >\n {children}\n </ButtonViewComponent>\n );\n});\n\nexport default ResetButton;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYO,MAAM,WAAA,GAAc,aAAA,CAAc,aAAA,EAAe,CAAC,KAAA,KAAU;AACjE,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,GAAA;AAAA,IACA,iBAAiB,eAAA,GAAkB,MAAA;AAAA,IACnC,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,EAAE,IAAI,MAAA,GAAS,KAAA,CAAM,MAAM,IAAA,EAAM,eAAA,KAAoB,cAAA,EAAe;AAE1E,EAAA,MAAM,sBAAsB,OAAA,CAAQ,MAAM,eAAA,EAAiB,CAAC,MAAM,CAAC,CAAA;AACnE,EAAA,MAAM,WAAA,GAAc,eAAA,CAAgB,KAAA,CAAM,QAAA,EAAS;AAEnD,EAAA,uBACE,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAM,WAAA;AAAA,MACN,OAAA,EAAQ,MAAA;AAAA,MACP,GAAG,IAAA;AAAA,MACJ,GAAA;AAAA,MACA,UAAA,EAAY,WAAA,KAAgB,aAAA,IAAiB,WAAA,KAAgB,WAAA;AAAA,MAC7D,IAAA,EAAK,OAAA;AAAA,MACL,OAAA,EAAS,MAAM,IAAA,CAAK,KAAA,EAAM;AAAA,MAC1B,IAAA,EAAM,MAAA;AAAA,MAEL;AAAA;AAAA,GACH;AAEJ,CAAC;;;;"}
@@ -0,0 +1,57 @@
1
+ "use client"
2
+ /* */
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { Button } from '../../../../components/Button/Button.mjs';
5
+ import { flowComponent } from '../../../../lib/componentFactory/flowComponent.mjs';
6
+ import { useFormContext } from '../context/formContext.mjs';
7
+ import '../../../../lib/propsContext/propsContext.mjs';
8
+ import '../../../../lib/propsContext/components/PropsContextProvider.mjs';
9
+ import { useMemo } from 'react';
10
+ import 'react-hook-form';
11
+ import 'react-aria';
12
+ import '../../../../views/FieldErrorView.mjs';
13
+ import 'react-hotkeys-hook';
14
+ import { useMergeRefs } from 'use-callback-ref';
15
+ import { useObjectRef } from '@react-aria/utils';
16
+ import 'mobx';
17
+ import '../../../../lib/controller/overlay/context.mjs';
18
+ import 'invariant';
19
+ import '../../../../components/Action/context.mjs';
20
+ import '../../../../components/Action/models/ActionStateContext.mjs';
21
+ import 'remeda';
22
+ import '../ResetButton/ResetButton.mjs';
23
+ import { Action } from '../../../../components/Action/Action.mjs';
24
+ import '@react-aria/live-announcer';
25
+
26
+ const SubmitButton = flowComponent("SubmitButton", (props) => {
27
+ const {
28
+ children,
29
+ ref,
30
+ buttonComponent: ButtonComponent = Button,
31
+ ...rest
32
+ } = props;
33
+ const {
34
+ id: formId = props.form,
35
+ formActionModel,
36
+ submitButtonRef: submitButtonRefFromFormContext
37
+ } = useFormContext();
38
+ const ButtonViewComponent = useMemo(() => ButtonComponent, [formId]);
39
+ const submitButtonRefFromProps = useObjectRef(ref);
40
+ const submitButtonRef = useMergeRefs([
41
+ submitButtonRefFromProps,
42
+ submitButtonRefFromFormContext
43
+ ]);
44
+ return /* @__PURE__ */ jsx(Action, { actionModel: formActionModel, children: /* @__PURE__ */ jsx(
45
+ ButtonViewComponent,
46
+ {
47
+ ...rest,
48
+ ref: submitButtonRef,
49
+ type: "submit",
50
+ form: formId,
51
+ children
52
+ }
53
+ ) });
54
+ });
55
+
56
+ export { SubmitButton, SubmitButton as default };
57
+ //# sourceMappingURL=SubmitButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubmitButton.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/SubmitButton/SubmitButton.tsx"],"sourcesContent":["import { Button, type ButtonProps } from \"@/components/Button\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFormContext } from \"@/integrations/react-hook-form\";\nimport { Action } from \"@/components/Action\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMergeRefs } from \"use-callback-ref\";\nimport { type FC, useMemo } from \"react\";\n\nexport type SubmitButtonProps = Omit<\n ButtonProps,\n \"isFailed\" | \"isSucceeded\" | \"isPending\" | \"isReadOnly\" | \"type\"\n> & {\n buttonComponent?: FC<Omit<ButtonProps, \"ref\">>;\n};\n\nexport const SubmitButton = flowComponent(\"SubmitButton\", (props) => {\n const {\n children,\n ref,\n buttonComponent: ButtonComponent = Button,\n ...rest\n } = props;\n\n const {\n id: formId = props.form,\n formActionModel,\n submitButtonRef: submitButtonRefFromFormContext,\n } = useFormContext();\n const ButtonViewComponent = useMemo(() => ButtonComponent, [formId]);\n\n const submitButtonRefFromProps = useObjectRef(ref);\n const submitButtonRef = useMergeRefs([\n submitButtonRefFromProps,\n submitButtonRefFromFormContext,\n ]);\n\n return (\n <Action actionModel={formActionModel}>\n <ButtonViewComponent\n {...rest}\n ref={submitButtonRef}\n type=\"submit\"\n form={formId}\n >\n {children}\n </ButtonViewComponent>\n </Action>\n );\n});\n\nexport default SubmitButton;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAeO,MAAM,YAAA,GAAe,aAAA,CAAc,cAAA,EAAgB,CAAC,KAAA,KAAU;AACnE,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,GAAA;AAAA,IACA,iBAAiB,eAAA,GAAkB,MAAA;AAAA,IACnC,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM;AAAA,IACJ,EAAA,EAAI,SAAS,KAAA,CAAM,IAAA;AAAA,IACnB,eAAA;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,cAAA,EAAe;AACnB,EAAA,MAAM,sBAAsB,OAAA,CAAQ,MAAM,eAAA,EAAiB,CAAC,MAAM,CAAC,CAAA;AAEnE,EAAA,MAAM,wBAAA,GAA2B,aAAa,GAAG,CAAA;AACjD,EAAA,MAAM,kBAAkB,YAAA,CAAa;AAAA,IACnC,wBAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,uBACE,GAAA,CAAC,MAAA,EAAA,EAAO,WAAA,EAAa,eAAA,EACnB,QAAA,kBAAA,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACE,GAAG,IAAA;AAAA,MACJ,GAAA,EAAK,eAAA;AAAA,MACL,IAAA,EAAK,QAAA;AAAA,MACL,IAAA,EAAM,MAAA;AAAA,MAEL;AAAA;AAAA,GACH,EACF,CAAA;AAEJ,CAAC;;;;"}
@@ -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, type Dispatch } from \"react\";\nimport invariant from \"invariant\";\n\ninterface FormContext<F extends FieldValues> {\n form: UseFormReturn<F>;\n id: string;\n isReadOnly: boolean;\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":";;;AAcO,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;;;;"}
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 {\n createContext,\n useContext,\n type Dispatch,\n type FormEvent,\n type RefObject,\n type SetStateAction,\n} from \"react\";\nimport invariant from \"invariant\";\nimport type { ActionModel } from \"@/components/Action/models/ActionModel\";\n\ninterface FormContext<F extends FieldValues> {\n form: UseFormReturn<F>;\n id: string;\n isReadOnly: boolean;\n setReadOnly: Dispatch<SetStateAction<boolean>>;\n submitButtonRef: RefObject<HTMLButtonElement | null>;\n submit: (e?: FormEvent<HTMLFormElement> | F) => void;\n formActionModel: ActionModel;\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":";;;AAyBO,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,7 +2,7 @@
2
2
  /* */
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import * as Aria from 'react-aria-components';
5
- import { Children, isValidElement, useRef, useDeferredValue, useLayoutEffect } from 'react';
5
+ import { Children, isValidElement, useRef, useDeferredValue, useEffect, useLayoutEffect } from 'react';
6
6
  import { emitElementValueChange } from './emitElementValueChange.mjs';
7
7
 
8
8
  const ReactAriaControlledValueFix = (props) => {
@@ -11,18 +11,20 @@ const ReactAriaControlledValueFix = (props) => {
11
11
  if (!isValidElement(child)) {
12
12
  throw new Error("Expected valid element");
13
13
  }
14
- const { ref, ...inputProps } = child.props;
14
+ const { ref, inputRef, ...inputProps } = child.props;
15
15
  const [contextProps, contextRef] = Aria.useContextProps(
16
16
  inputProps,
17
- ref,
17
+ inputRef ?? ref,
18
18
  context
19
19
  );
20
20
  const elementRef = contextRef.current;
21
21
  const isInFocus = useRef(false);
22
22
  const isValidElementType = elementRef && (elementRef instanceof HTMLInputElement || elementRef instanceof HTMLTextAreaElement);
23
- const deferredValueFromContext = useDeferredValue(String(contextProps.value));
24
- useLayoutEffect(() => {
25
- if (!isValidElementType) {
23
+ const deferredValueFromContext = useDeferredValue(
24
+ String(contextProps.value ?? "")
25
+ );
26
+ useEffect(() => {
27
+ if (!isValidElementType || !elementRef) {
26
28
  return;
27
29
  }
28
30
  emitElementValueChange(elementRef, deferredValueFromContext);
@@ -32,11 +34,11 @@ const ReactAriaControlledValueFix = (props) => {
32
34
  const onBlur = () => {
33
35
  isInFocus.current = false;
34
36
  };
35
- elementRef?.addEventListener("focus", onFocus);
36
- elementRef?.addEventListener("blur", onBlur);
37
+ elementRef.addEventListener("focus", onFocus);
38
+ elementRef.addEventListener("blur", onBlur);
37
39
  return () => {
38
- elementRef?.removeEventListener("focus", onFocus);
39
- elementRef?.removeEventListener("blur", onBlur);
40
+ elementRef.removeEventListener("focus", onFocus);
41
+ elementRef.removeEventListener("blur", onBlur);
40
42
  };
41
43
  }, [elementRef]);
42
44
  useLayoutEffect(() => {
@@ -44,6 +46,12 @@ const ReactAriaControlledValueFix = (props) => {
44
46
  return;
45
47
  }
46
48
  emitElementValueChange(elementRef, deferredValueFromContext);
49
+ if (elementRef) {
50
+ const { selectionStart, selectionEnd } = elementRef;
51
+ elementRef.focus();
52
+ elementRef.selectionStart = selectionStart;
53
+ elementRef.selectionEnd = selectionEnd;
54
+ }
47
55
  }, [deferredValueFromContext]);
48
56
  const uncontrolledContextProps = {
49
57
  ...contextProps,
@@ -1 +1 @@
1
- {"version":3,"file":"ReactAriaControlledValueFix.mjs","sources":["../../../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport {\n Children,\n isValidElement,\n type Context,\n type FC,\n type ForwardedRef,\n type PropsWithChildren,\n useDeferredValue,\n useLayoutEffect,\n useRef,\n} from \"react\";\nimport { emitElementValueChange } from \"@/lib/react/emitElementValueChange\";\n\nexport interface ReactAriaControlledValueFixProps extends PropsWithChildren {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputContext: Context<any>;\n props: unknown;\n}\n\ninterface ChildProps {\n [key: string]: unknown;\n ref: ForwardedRef<Element>;\n}\n\n/**\n * React Aria (accidentally?!) enforces controlled inputs by always setting the\n * value prop on Inputs and TextAreas with its context props API. This component\n * also uses this API to only unset the value prop. Furthermore setting an input\n * value is finally done by directly on the DOM element.\n *\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/textfield/src/useTextField.ts#L182\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/numberfield/src/useNumberField.ts#L206\n */\nexport const ReactAriaControlledValueFix: FC<\n ReactAriaControlledValueFixProps\n> = (props) => {\n const { inputContext: context, children } = props;\n\n const child = Children.only(children);\n if (!isValidElement<ChildProps>(child)) {\n throw new Error(\"Expected valid element\");\n }\n\n const { ref, ...inputProps } = child.props;\n const [contextProps, contextRef] = Aria.useContextProps(\n inputProps,\n ref,\n context,\n );\n\n const elementRef = contextRef.current;\n const isInFocus = useRef(false);\n\n const isValidElementType =\n elementRef &&\n (elementRef instanceof HTMLInputElement ||\n elementRef instanceof HTMLTextAreaElement);\n\n const deferredValueFromContext = useDeferredValue(String(contextProps.value));\n\n useLayoutEffect(() => {\n if (!isValidElementType) {\n return;\n }\n\n // sync the last known value when element reference is available\n emitElementValueChange(elementRef, deferredValueFromContext);\n\n const onFocus = (event: Event) => {\n isInFocus.current = !!event?.isTrusted;\n };\n const onBlur = () => {\n isInFocus.current = false;\n };\n\n elementRef?.addEventListener(\"focus\", onFocus);\n elementRef?.addEventListener(\"blur\", onBlur);\n\n return () => {\n elementRef?.removeEventListener(\"focus\", onFocus);\n elementRef?.removeEventListener(\"blur\", onBlur);\n };\n }, [elementRef]);\n\n useLayoutEffect(() => {\n if (!isValidElementType || isInFocus.current) {\n return;\n }\n\n emitElementValueChange(elementRef, deferredValueFromContext);\n }, [deferredValueFromContext]);\n\n const uncontrolledContextProps = {\n ...contextProps,\n value: undefined,\n ref: contextRef,\n };\n\n return (\n <Aria.Provider values={[[context, uncontrolledContextProps]]}>\n {child}\n </Aria.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;AAkCO,MAAM,2BAAA,GAET,CAAC,KAAA,KAAU;AACb,EAAA,MAAM,EAAE,YAAA,EAAc,OAAA,EAAS,QAAA,EAAS,GAAI,KAAA;AAE5C,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,IAAA,CAAK,QAAQ,CAAA;AACpC,EAAA,IAAI,CAAC,cAAA,CAA2B,KAAK,CAAA,EAAG;AACtC,IAAA,MAAM,IAAI,MAAM,wBAAwB,CAAA;AAAA,EAC1C;AAEA,EAAA,MAAM,EAAE,GAAA,EAAK,GAAG,UAAA,KAAe,KAAA,CAAM,KAAA;AACrC,EAAA,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AAwB,CAAA;AAAA,EAC7D,CAAA,EAAG,CAAC,wBAAwB,CAAC,CAAA;AAE7B,EAAA,MAAM,wBAAA,GAA2B;AAAA,IAC/B,GAAG,YAAA;AAAA,IACH,KAAA,EAAO,MAAA;AAAA,IACP,GAAA,EAAK;AAAA,GACP;AAEA,EAAA,uBACE,GAAA,CAAC,IAAA,CAAK,QAAA,EAAL,EAAc,MAAA,EAAQ,CAAC,CAAC,OAAA,EAAS,wBAAwB,CAAC,CAAA,EACxD,QAAA,EAAA,KAAA,EACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReactAriaControlledValueFix.mjs","sources":["../../../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport {\n Children,\n isValidElement,\n type Context,\n type FC,\n type ForwardedRef,\n type PropsWithChildren,\n useDeferredValue,\n useLayoutEffect,\n useEffect,\n useRef,\n} from \"react\";\nimport { emitElementValueChange } from \"@/lib/react/emitElementValueChange\";\n\nexport interface ReactAriaControlledValueFixProps extends PropsWithChildren {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputContext: Context<any>;\n props: unknown;\n}\n\ninterface ChildProps {\n [key: string]: unknown;\n ref: ForwardedRef<Element>;\n inputRef: ForwardedRef<Element>;\n}\n\n/**\n * React Aria (accidentally?!) enforces controlled inputs by always setting the\n * value prop on Inputs and TextAreas with its context props API. This component\n * also uses this API to only unset the value prop. Furthermore setting an input\n * value is finally done by directly on the DOM element.\n *\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/textfield/src/useTextField.ts#L182\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/numberfield/src/useNumberField.ts#L206\n */\nexport const ReactAriaControlledValueFix: FC<\n ReactAriaControlledValueFixProps\n> = (props) => {\n const { inputContext: context, children } = props;\n\n const child = Children.only(children);\n if (!isValidElement<ChildProps>(child)) {\n throw new Error(\"Expected valid element\");\n }\n\n const { ref, inputRef, ...inputProps } = child.props;\n const [contextProps, contextRef] = Aria.useContextProps(\n inputProps,\n inputRef ?? ref,\n context,\n );\n\n const elementRef = contextRef.current;\n const isInFocus = useRef(false);\n\n const isValidElementType =\n elementRef &&\n (elementRef instanceof HTMLInputElement ||\n elementRef instanceof HTMLTextAreaElement);\n\n const deferredValueFromContext = useDeferredValue(\n String(contextProps.value ?? \"\"),\n );\n\n useEffect(() => {\n if (!isValidElementType || !elementRef) {\n return;\n }\n\n // sync the last known value when element reference is available\n emitElementValueChange(elementRef, deferredValueFromContext);\n\n const onFocus = (event: Event) => {\n isInFocus.current = !!event?.isTrusted;\n };\n const onBlur = () => {\n isInFocus.current = false;\n };\n\n elementRef.addEventListener(\"focus\", onFocus);\n elementRef.addEventListener(\"blur\", onBlur);\n\n return () => {\n elementRef.removeEventListener(\"focus\", onFocus);\n elementRef.removeEventListener(\"blur\", onBlur);\n };\n }, [elementRef]);\n\n useLayoutEffect(() => {\n if (!isValidElementType || isInFocus.current) {\n return;\n }\n\n emitElementValueChange(elementRef, deferredValueFromContext);\n if (elementRef) {\n const { selectionStart, selectionEnd } = elementRef;\n elementRef.focus();\n elementRef.selectionStart = selectionStart;\n elementRef.selectionEnd = selectionEnd;\n }\n }, [deferredValueFromContext]);\n\n const uncontrolledContextProps = {\n ...contextProps,\n value: undefined,\n ref: contextRef,\n };\n\n return (\n <Aria.Provider values={[[context, uncontrolledContextProps]]}>\n {child}\n </Aria.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;AAoCO,MAAM,2BAAA,GAET,CAAC,KAAA,KAAU;AACb,EAAA,MAAM,EAAE,YAAA,EAAc,OAAA,EAAS,QAAA,EAAS,GAAI,KAAA;AAE5C,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,IAAA,CAAK,QAAQ,CAAA;AACpC,EAAA,IAAI,CAAC,cAAA,CAA2B,KAAK,CAAA,EAAG;AACtC,IAAA,MAAM,IAAI,MAAM,wBAAwB,CAAA;AAAA,EAC1C;AAEA,EAAA,MAA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B,MAAM;AACpB,IAAA,IAAI,CAAC,kBAAA,IAAsB,SAAA,CAAU,OAAA,EAAS;AAC5C,MAAA;AAAA,IACF;AAEA,IAAA,sBAAA,CAAuB,YAAY,wBAAwB,CAAA;AAC3D,IAAA,IAAI,UAAA,EAAY;AACd,MAAA,MAAM,EAAE,cAAA,EAAgB,YAAA,EAAa,GAAI,UAAA;AACzC,MAAA,UAAA,CAAW,KAAA,EAAM;AACjB,MAAA,UAAA,CAAW,cAAA,GAAiB,cAAA;AAC5B,MAAA,UAAA,CAAW,YAAA,GAAe,YAAA;AAAA,IAC5B;AAAA,EACF,CAAA,EAAG,CAAC,wBAAwB,CAAC,CAAA;AAE7B,EAAA,MAAM,wBAAA,GAA2B;AAAA,IAC/B,GAAG,YAAA;AAAA,IACH,KAAA,EAAO,MAAA;AAAA,IACP,GAAA,EAAK;AAAA,GACP;AAEA,EAAA,uBACE,GAAA,CAAC,IAAA,CAAK,QAAA,EAAL,EAAc,MAAA,EAAQ,CAAC,CAAC,OAAA,EAAS,wBAAwB,CAAC,CAAA,EACxD,QAAA,EAAA,KAAA,EACH,CAAA;AAEJ;;;;"}
@@ -2,5 +2,7 @@
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 { SubmitButton } from './components/src/integrations/react-hook-form/components/SubmitButton/SubmitButton.mjs';
6
+ export { ResetButton } from './components/src/integrations/react-hook-form/components/ResetButton/ResetButton.mjs';
5
7
  export { useFormContext, useOptionalFormContext } from './components/src/integrations/react-hook-form/components/context/formContext.mjs';
6
8
  //# sourceMappingURL=react-hook-form.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-hook-form.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"react-hook-form.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/Action.tsx"],"names":[],"mappings":"AAgDA,eAAO,MAAM,MAAM,kHA2DlB,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Action.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/Action.tsx"],"names":[],"mappings":"AAgDA,eAAO,MAAM,MAAM,kHA6DlB,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,4 +1,9 @@
1
1
  export type ActionStateValue = "isIdle" | "isSucceeded" | "isPending" | "isExecuting" | "isFailed";
2
+ export declare const duration: {
3
+ pending: number;
4
+ succeeded: number;
5
+ failed: number;
6
+ };
2
7
  export declare class ActionState {
3
8
  private showFeedback?;
4
9
  state: ActionStateValue;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionState.d.ts","sourceRoot":"","sources":["../../../../../src/components/Action/models/ActionState.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,aAAa,GACb,WAAW,GACX,aAAa,GACb,UAAU,CAAC;AAQf,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAC,CAAU;IACxB,KAAK,EAAE,gBAAgB,CAAY;IAC1C,OAAO,CAAC,iBAAiB,CAAqB;IACvC,KAAK,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,OAAO,CAAS;;WAUV,MAAM,IAAI,WAAW;IAI5B,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAI7C,QAAQ,IAAI,gBAAgB;IAI5B,SAAS,IAAI,OAAO;IAI3B,IAAW,MAAM,IAAI,OAAO,CAE3B;IAEM,YAAY,IAAI,IAAI;IASd,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9C,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,WAAW;YAKtC,mBAAmB;YAMnB,sBAAsB;IAMpC,OAAO,CAAC,cAAc;YAMR,MAAM;IAgBpB,OAAO,CAAC,YAAY;CAGrB"}
1
+ {"version":3,"file":"ActionState.d.ts","sourceRoot":"","sources":["../../../../../src/components/Action/models/ActionState.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,aAAa,GACb,WAAW,GACX,aAAa,GACb,UAAU,CAAC;AAEf,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAC,CAAU;IACxB,KAAK,EAAE,gBAAgB,CAAY;IAC1C,OAAO,CAAC,iBAAiB,CAAqB;IACvC,KAAK,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,OAAO,CAAS;;WAUV,MAAM,IAAI,WAAW;IAI5B,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAI7C,QAAQ,IAAI,gBAAgB;IAI5B,SAAS,IAAI,OAAO;IAI3B,IAAW,MAAM,IAAI,OAAO,CAE3B;IAEM,YAAY,IAAI,IAAI;IASd,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9C,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,WAAW;YAKtC,mBAAmB;YAMnB,sBAAsB;IAMpC,OAAO,CAAC,cAAc;YAMR,MAAM;IAgBpB,OAAO,CAAC,YAAY;CAGrB"}
@@ -1,9 +1,9 @@
1
- import { CategoricalChartProps } from 'recharts/types/chart/generateCategoricalChart';
2
- import { default as React, FC, PropsWithChildren } from 'react';
1
+ import { default as React, ComponentProps, FC, PropsWithChildren } from 'react';
2
+ import * as Recharts from "recharts";
3
3
  export interface CartesianChartEmptyViewProps {
4
- data?: CategoricalChartProps["data"];
4
+ data?: ComponentProps<typeof Recharts.ComposedChart>["data"];
5
5
  }
6
- export interface CartesianChartProps extends Pick<CategoricalChartProps, "data" | "className" | "syncId" | "syncMethod">, PropsWithChildren {
6
+ export interface CartesianChartProps extends Pick<ComponentProps<typeof Recharts.ComposedChart>, "data" | "className" | "syncId" | "syncMethod">, PropsWithChildren {
7
7
  height?: string;
8
8
  /** View that is provided when data is empty/undefined */
9
9
  emptyView?: React.ComponentType<CartesianChartEmptyViewProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../../src/components/CartesianChart/CartesianChart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,KAAK,EAAE,EAMZ,KAAK,EAAE,EACP,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,mBACf,SAAQ,IAAI,CACR,qBAAqB,EACrB,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,YAAY,CAC/C,EACD,iBAAiB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC;IAC9D;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAwB;AACxB,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAyGlD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../../src/components/CartesianChart/CartesianChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,EAKZ,KAAK,cAAc,EACnB,KAAK,EAAE,EACP,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAC;AAMf,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,EAAE,cAAc,CAAC,OAAO,QAAQ,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,mBACf,SAAQ,IAAI,CACR,cAAc,CAAC,OAAO,QAAQ,CAAC,aAAa,CAAC,EAC7C,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,YAAY,CAC/C,EACD,iBAAiB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,4BAA4B,CAAC,CAAC;IAC9D;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAwB;AACxB,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA0FlD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Area.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CartesianChart/components/Area/Area.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAGrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,MAAM,WAAW,SACf,SAAQ,IAAI,CACV,QAAQ,CAAC,SAAS,EAChB,WAAW,GACX,SAAS,GACT,SAAS,GACT,aAAa,GACb,KAAK,GACL,SAAS,GACT,SAAS,GACT,MAAM,GACN,MAAM,CACT;IACD,kDAAkD;IAClD,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAG1B;AAED,wBAAwB;AACxB,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CA0B9B,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Area.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CartesianChart/components/Area/Area.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAGrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,MAAM,WAAW,SACf,SAAQ,IAAI,CACV,QAAQ,CAAC,SAAS,EAChB,WAAW,GACX,SAAS,GACT,SAAS,GACT,aAAa,GACb,KAAK,GACL,SAAS,GACT,SAAS,GACT,MAAM,GACN,MAAM,CACT;IACD,kDAAkD;IAClD,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B;AAED,wBAAwB;AACxB,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAc9B,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
2
- import { PropsWithChildren } from 'react';
2
+ import { PropsWithChildren, RefObject } from 'react';
3
3
  import * as Aria from "react-aria-components";
4
4
  export interface CheckboxProps extends PropsWithChildren<Omit<Aria.CheckboxProps, "children">>, FlowComponentProps {
5
5
  inputClassName?: string;
6
+ inputRef?: RefObject<HTMLInputElement | null>;
6
7
  }
7
8
  /** @flr-generate all */
8
9
  export declare const Checkbox: import('react').FunctionComponent<CheckboxProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAO9C,MAAM,WAAW,aACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,EAC7D,kBAAkB;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAwB;AACxB,eAAO,MAAM,QAAQ,kGAsCnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAO9C,MAAM,WAAW,aACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,EAC7D,kBAAkB;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CAC/C;AAED,wBAAwB;AACxB,eAAO,MAAM,QAAQ,kGA6CnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import { CheckboxProps } from '../Checkbox';
2
2
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
3
+ import { RefObject } from 'react';
3
4
  export interface CheckboxButtonProps extends CheckboxProps, FlowComponentProps {
5
+ inputRef?: RefObject<HTMLInputElement | null>;
4
6
  }
5
7
  /** @flr-generate all */
6
8
  export declare const CheckboxButton: import('react').FunctionComponent<CheckboxButtonProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxButton.d.ts","sourceRoot":"","sources":["../../../../src/components/CheckboxButton/CheckboxButton.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM/E,MAAM,WAAW,mBACf,SAAQ,aAAa,EACnB,kBAAkB;CAAG;AAEzB,wBAAwB;AACxB,eAAO,MAAM,cAAc,wGAuCzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"CheckboxButton.d.ts","sourceRoot":"","sources":["../../../../src/components/CheckboxButton/CheckboxButton.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAK/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,mBAAoB,SAAQ,aAAa,EAAE,kBAAkB;IAC5E,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CAC/C;AAED,wBAAwB;AACxB,eAAO,MAAM,cAAc,wGA+CzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import { PropsWithChildren, RefObject } from 'react';
2
2
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
3
3
  import { OverlayController } from '../../lib/controller';
4
4
  import { OptionsProps } from '../Options/Options';
@@ -6,6 +6,7 @@ import * as Aria from "react-aria-components";
6
6
  export interface ComboBoxProps extends Omit<Aria.ComboBoxProps<never>, "children">, Pick<Aria.InputProps, "placeholder">, Pick<OptionsProps, "renderEmptyState">, PropsWithChildren, FlowComponentProps {
7
7
  onChange?: (value: string) => void;
8
8
  controller?: OverlayController;
9
+ inputRef?: RefObject<HTMLInputElement | null>;
9
10
  }
10
11
  /** @flr-generate all */
11
12
  export declare const ComboBox: import('react').FunctionComponent<ComboBoxProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.d.ts","sourceRoot":"","sources":["../../../../src/components/ComboBox/ComboBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA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I,CAAC,YAAY,EAAE,kBAAkB,CAAC,EACtC,iBAAiB,EACjB,kBAAkB;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CAC/C;AAED,wBAAwB;AACxB,eAAO,MAAM,QAAQ,kGA6GnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import { PropsWithChildren, RefObject } from 'react';
2
2
  import { FileInputOnChangeHandler } from './components/FileInput';
3
3
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
4
4
  import type * as Aria from "react-aria-components";
@@ -7,6 +7,7 @@ export interface FileFieldProps extends PropsWithChildren, FlowComponentProps<HT
7
7
  onChange?: FileInputOnChangeHandler;
8
8
  /** Whether the component is read only. */
9
9
  isReadOnly?: boolean;
10
+ inputRef?: RefObject<HTMLInputElement>;
10
11
  }
11
12
  /** @flr-generate all */
12
13
  export declare const FileField: import('react').FunctionComponent<FileFieldProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"FileField.d.ts","sourceRoot":"","sources":["../../../../src/components/FileField/FileField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAQ/E,MAAM,WAAW,cACf,SAAQ,iBAAiB,EACvB,kBAAkB,CAAC,gBAAgB,CAAC,EACpC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC,EACrD,IAAI,CACF,IAAI,CAAC,cAAc,EACnB,YAAY,GAAG,WAAW,GAAG,oBAAoB,GAAG,YAAY,CACjE;IACH,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAwB;AACxB,eAAO,MAAM,SAAS,qGA6EpB,CAAC;AACH,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"FileField.d.ts","sourceRoot":"","sources":["../../../../src/components/FileField/FileField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,KAAK,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAQ/E,MAAM,WAAW,cACf,SAAQ,iBAAiB,EACvB,kBAAkB,CAAC,gBAAgB,CAAC,EACpC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC,EACrD,IAAI,CACF,IAAI,CAAC,cAAc,EACnB,YAAY,GAAG,WAAW,GAAG,oBAAoB,GAAG,YAAY,CACjE;IACH,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;CACxC;AAED,wBAAwB;AACxB,eAAO,MAAM,SAAS,qGAkFpB,CAAC;AACH,eAAe,SAAS,CAAC"}
@@ -101,8 +101,8 @@ export declare const typedList: <T>() => {
101
101
  rel?: string | undefined;
102
102
  isDisabled?: boolean | undefined;
103
103
  value?: undefined;
104
- target?: import('react').HTMLAttributeAnchorTarget | undefined;
105
104
  href?: import('@react-types/shared').Href | undefined;
105
+ target?: import('react').HTMLAttributeAnchorTarget | undefined;
106
106
  onPress?: ((e: import('react-aria').PressEvent) => void) | undefined;
107
107
  onPressStart?: ((e: import('react-aria').PressEvent) => void) | undefined;
108
108
  onPressEnd?: ((e: import('react-aria').PressEvent) => void) | undefined;
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { FC, RefObject } from 'react';
2
2
  import { Options } from 'react-markdown';
3
3
  import { PropsWithClassName } from '../../lib/types/props';
4
4
  export interface MarkdownProps extends PropsWithClassName, Omit<Options, "components"> {
@@ -6,6 +6,7 @@ export interface MarkdownProps extends PropsWithClassName, Omit<Options, "compon
6
6
  color?: "dark" | "light" | "default";
7
7
  /** Shifts all heading levels by the given offset. @default 0 */
8
8
  headingOffset?: number;
9
+ ref?: RefObject<HTMLDivElement>;
9
10
  }
10
11
  /** @flr-generate all */
11
12
  export declare const Markdown: FC<MarkdownProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Markdown/Markdown.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAiB,EAAE,EAAa,MAAM,OAAO,CAAC;AAE1D,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAK5D,MAAM,WAAW,aACf,SAAQ,kBAAkB,EACxB,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC;IAC7B,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACrC,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;CAGxB;AAED,wBAAwB;AACxB,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAwHtC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Markdown/Markdown.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAiB,EAAE,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAK5D,MAAM,WAAW,aACf,SAAQ,kBAAkB,EACxB,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC;IAC7B,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACrC,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,GAAG,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CACjC;AAED,wBAAwB;AACxB,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAyHtC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,9 +1,13 @@
1
- import { default as React } from 'react';
1
+ import { default as React, RefObject } from 'react';
2
2
  import { MarkdownProps } from '../Markdown';
3
3
  import { TextAreaProps } from '../TextArea';
4
4
  export type MarkdownEditorMode = "editor" | "preview";
5
- export type MarkdownEditorProps = TextAreaProps & Pick<MarkdownProps, "headingOffset">;
5
+ export type MarkdownEditorProps = Omit<TextAreaProps, "ref"> & Pick<MarkdownProps, "headingOffset" | "ref"> & {
6
+ inputRef?: RefObject<HTMLTextAreaElement | null>;
7
+ };
6
8
  /** @flr-generate all */
7
- export declare const MarkdownEditor: React.FunctionComponent<TextAreaProps & Pick<MarkdownProps, "headingOffset"> & React.RefAttributes<HTMLTextAreaElement>>;
9
+ export declare const MarkdownEditor: React.FunctionComponent<Omit<TextAreaProps, "ref"> & Pick<MarkdownProps, "ref" | "headingOffset"> & {
10
+ inputRef?: RefObject<HTMLTextAreaElement | null>;
11
+ } & React.RefAttributes<HTMLDivElement>>;
8
12
  export default MarkdownEditor;
9
13
  //# sourceMappingURL=MarkdownEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/MarkdownEditor/MarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AASrE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAC7C,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAEvC,wBAAwB;AACxB,eAAO,MAAM,cAAc,0HA4DzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"MarkdownEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/MarkdownEditor/MarkdownEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAiBrE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,GAC1D,IAAI,CAAC,aAAa,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG;IAC7C,QAAQ,CAAC,EAAE,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;CAClD,CAAC;AAEJ,wBAAwB;AACxB,eAAO,MAAM,cAAc;eAJZ,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC;wCAmJlD,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=MarkdownEditor.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarkdownEditor.test.d.ts","sourceRoot":"","sources":["../../../../src/components/MarkdownEditor/MarkdownEditor.test.tsx"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
- import { InsertType } from '../lib/insertAtCursor';
2
+ import { InsertType } from '../lib/modifyValueByType';
3
3
  import { ButtonProps } from '../../Button';
4
4
  export interface ToolBarButtonProps extends Pick<ButtonProps, "isDisabled" | "children"> {
5
5
  type: InsertType;
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/MarkdownEditor/components/ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAI/D,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;IACpD,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAiBhD,CAAC"}
1
+ {"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/MarkdownEditor/components/ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mDAAmD,CAAC;AACpF,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAI/D,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;IACpD,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAkBhD,CAAC"}