@tsed/react-formio 3.0.0-alpha.11 → 3.0.0-alpha.13

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 (228) hide show
  1. package/dist/all.d.ts +0 -0
  2. package/dist/all.js +38 -0
  3. package/dist/all.js.map +1 -0
  4. package/dist/atoms/icon/Icon.js.map +1 -1
  5. package/dist/chunks/_commonjsHelpers.js +30 -3
  6. package/dist/chunks/_commonjsHelpers.js.map +1 -1
  7. package/dist/chunks/index.js +33 -30
  8. package/dist/chunks/index.js.map +1 -1
  9. package/dist/chunks/index.module.js +16 -16
  10. package/dist/chunks/index.module.js.map +1 -1
  11. package/dist/chunks/index2.js +56953 -0
  12. package/dist/chunks/index2.js.map +1 -0
  13. package/dist/chunks/react-select-animated.esm.js +1204 -1101
  14. package/dist/chunks/react-select-animated.esm.js.map +1 -1
  15. package/dist/contexts/FormioContext.d.ts +20 -0
  16. package/dist/contexts/FormioContext.js +40 -0
  17. package/dist/contexts/FormioContext.js.map +1 -0
  18. package/dist/hooks/keyboard.constants.js.map +1 -1
  19. package/dist/hooks/useFormioContext.d.ts +10 -0
  20. package/dist/hooks/useFormioContext.js +12 -0
  21. package/dist/hooks/useFormioContext.js.map +1 -0
  22. package/dist/hooks/useI18n.d.ts +4 -0
  23. package/dist/hooks/useI18n.js +9 -0
  24. package/dist/hooks/useI18n.js.map +1 -0
  25. package/dist/hooks/useKeyboardControls.js.map +1 -1
  26. package/dist/hooks/useTooltip.js.map +1 -1
  27. package/dist/index.d.ts +1 -6
  28. package/dist/index.js +18 -13
  29. package/dist/index.js.map +1 -1
  30. package/dist/interfaces/ComponentType.d.ts +6 -2
  31. package/dist/interfaces/FormBuilderOptions.d.ts +7 -0
  32. package/dist/interfaces/FormBuilderOptions.js +2 -0
  33. package/dist/interfaces/FormBuilderOptions.js.map +1 -0
  34. package/dist/interfaces/FormOptions.d.ts +6 -13
  35. package/dist/interfaces/FormType.d.ts +4 -11
  36. package/dist/interfaces/SubmissionType.d.ts +5 -10
  37. package/dist/interfaces/index.d.ts +1 -0
  38. package/dist/molecules/alert/Alert.js.map +1 -1
  39. package/dist/molecules/button/Button.js +17 -20
  40. package/dist/molecules/button/Button.js.map +1 -1
  41. package/dist/molecules/card/Card.js.map +1 -1
  42. package/dist/molecules/forms/form-control/FormControl.js.map +1 -1
  43. package/dist/molecules/forms/input-tags/InputTags.js.map +1 -1
  44. package/dist/molecules/forms/input-tags/components/ChoicesTags.d.ts +19 -19
  45. package/dist/molecules/forms/input-tags/components/ChoicesTags.js +32 -32
  46. package/dist/molecules/forms/input-tags/components/ChoicesTags.js.map +1 -1
  47. package/dist/molecules/forms/input-tags/components/ReactTags.js +289 -300
  48. package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -1
  49. package/dist/molecules/forms/input-text/InputText.js +3 -3
  50. package/dist/molecules/forms/input-text/InputText.js.map +1 -1
  51. package/dist/molecules/forms/select/Select.js.map +1 -1
  52. package/dist/molecules/forms/select/components/ChoicesSelect.js +71 -73
  53. package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -1
  54. package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -1
  55. package/dist/molecules/forms/select/components/ReactSelect.js +13 -14
  56. package/dist/molecules/forms/select/components/ReactSelect.js.map +1 -1
  57. package/dist/molecules/forms/select/components/choices.template.js +2340 -2257
  58. package/dist/molecules/forms/select/components/choices.template.js.map +1 -1
  59. package/dist/molecules/forms/select/hooks/useOptions.js.map +1 -1
  60. package/dist/molecules/loader/Loader.js.map +1 -1
  61. package/dist/molecules/modal/Modal.js +23 -24
  62. package/dist/molecules/modal/Modal.js.map +1 -1
  63. package/dist/molecules/pagination/Pagination.d.ts +2 -1
  64. package/dist/molecules/pagination/Pagination.js +29 -29
  65. package/dist/molecules/pagination/Pagination.js.map +1 -1
  66. package/dist/molecules/pagination/PaginationButton.js.map +1 -1
  67. package/dist/molecules/pagination/utils/getPageNumbers.js.map +1 -1
  68. package/dist/molecules/table/Table.js +35 -41
  69. package/dist/molecules/table/Table.js.map +1 -1
  70. package/dist/molecules/table/components/DefaultArrowSort.js.map +1 -1
  71. package/dist/molecules/table/components/DefaultCell.js.map +1 -1
  72. package/dist/molecules/table/components/DefaultCellFooter.js.map +1 -1
  73. package/dist/molecules/table/components/DefaultCellHeader.js.map +1 -1
  74. package/dist/molecules/table/components/DefaultCellOperations.js +10 -10
  75. package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -1
  76. package/dist/molecules/table/components/DefaultFilter.js.map +1 -1
  77. package/dist/molecules/table/components/DefaultOperationButton.js +1 -1
  78. package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -1
  79. package/dist/molecules/table/filters/RangeFilter.js +23 -24
  80. package/dist/molecules/table/filters/RangeFilter.js.map +1 -1
  81. package/dist/molecules/table/filters/SelectFilter.js +11 -13
  82. package/dist/molecules/table/filters/SelectFilter.js.map +1 -1
  83. package/dist/molecules/table/filters/TextFieldFilter.js.map +1 -1
  84. package/dist/molecules/table/hooks/useTable.d.ts +3 -3
  85. package/dist/molecules/table/hooks/useTable.js +17 -16
  86. package/dist/molecules/table/hooks/useTable.js.map +1 -1
  87. package/dist/molecules/table/hooks/useUniqValues.js.map +1 -1
  88. package/dist/molecules/table/utils/mapFormToColumns.js +21 -22
  89. package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -1
  90. package/dist/molecules/tabs/Tab.js +36 -37
  91. package/dist/molecules/tabs/Tab.js.map +1 -1
  92. package/dist/molecules/tabs/TabList.js +9 -10
  93. package/dist/molecules/tabs/TabList.js.map +1 -1
  94. package/dist/molecules/tabs/TabPanel.js.map +1 -1
  95. package/dist/molecules/tabs/Tabs.js.map +1 -1
  96. package/dist/molecules/tabs/TabsBody.js.map +1 -1
  97. package/dist/molecules/tabs/TabsLegacy.d.ts +3 -2
  98. package/dist/molecules/tabs/TabsLegacy.js +30 -30
  99. package/dist/molecules/tabs/TabsLegacy.js.map +1 -1
  100. package/dist/molecules/tabs/context/TabControl.js.map +1 -1
  101. package/dist/molecules/tabs/hooks/tabControl.js.map +1 -1
  102. package/dist/organisms/form/Form.js.map +1 -1
  103. package/dist/organisms/form/access/FormAccess.js +41 -41
  104. package/dist/organisms/form/access/FormAccess.js.map +1 -1
  105. package/dist/organisms/form/access/FormAccess.schema.js +1 -0
  106. package/dist/organisms/form/access/FormAccess.schema.js.map +1 -1
  107. package/dist/organisms/form/access/FormAccess.utils.js +2 -2
  108. package/dist/organisms/form/access/FormAccess.utils.js.map +1 -1
  109. package/dist/organisms/form/actions/FormAction.js +15 -13
  110. package/dist/organisms/form/actions/FormAction.js.map +1 -1
  111. package/dist/organisms/form/builder/FormBuilder.js.map +1 -1
  112. package/dist/organisms/form/builder/FormEdit.d.ts +4 -3
  113. package/dist/organisms/form/builder/FormEdit.js +36 -36
  114. package/dist/organisms/form/builder/FormEdit.js.map +1 -1
  115. package/dist/organisms/form/builder/FormEdit.reducer.js.map +1 -1
  116. package/dist/organisms/form/builder/FormEditCtas.d.ts +2 -2
  117. package/dist/organisms/form/builder/FormEditCtas.js +36 -35
  118. package/dist/organisms/form/builder/FormEditCtas.js.map +1 -1
  119. package/dist/organisms/form/builder/FormParameters.js.map +1 -1
  120. package/dist/organisms/form/builder/useFormBuilder.d.ts +4 -4
  121. package/dist/organisms/form/builder/useFormBuilder.js +36 -33
  122. package/dist/organisms/form/builder/useFormBuilder.js.map +1 -1
  123. package/dist/organisms/form/builder/useFormEdit.d.ts +1 -1
  124. package/dist/organisms/form/builder/useFormEdit.js +17 -17
  125. package/dist/organisms/form/builder/useFormEdit.js.map +1 -1
  126. package/dist/organisms/form/exports/FormExport.d.ts +3 -2
  127. package/dist/organisms/form/exports/FormExport.js +23 -22
  128. package/dist/organisms/form/exports/FormExport.js.map +1 -1
  129. package/dist/organisms/form/preview/FormPreview.d.ts +3 -3
  130. package/dist/organisms/form/preview/FormPreview.js +5 -4
  131. package/dist/organisms/form/preview/FormPreview.js.map +1 -1
  132. package/dist/organisms/form/settings/FormSettings.js +28 -28
  133. package/dist/organisms/form/settings/FormSettings.js.map +1 -1
  134. package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -1
  135. package/dist/organisms/form/settings/FormSettings.utils.js.map +1 -1
  136. package/dist/organisms/form/useForm.d.ts +2 -1
  137. package/dist/organisms/form/useForm.js +664 -661
  138. package/dist/organisms/form/useForm.js.map +1 -1
  139. package/dist/organisms/modal/RemoveModal.js +16 -17
  140. package/dist/organisms/modal/RemoveModal.js.map +1 -1
  141. package/dist/organisms/table/actions/ActionsTable.d.ts +2 -1
  142. package/dist/organisms/table/actions/ActionsTable.js +10 -9
  143. package/dist/organisms/table/actions/ActionsTable.js.map +1 -1
  144. package/dist/organisms/table/forms/FormsTable.d.ts +1 -1
  145. package/dist/organisms/table/forms/FormsTable.js +9 -8
  146. package/dist/organisms/table/forms/FormsTable.js.map +1 -1
  147. package/dist/organisms/table/forms/components/FormsCell.js +10 -10
  148. package/dist/organisms/table/forms/components/FormsCell.js.map +1 -1
  149. package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -1
  150. package/dist/organisms/views/FormViews.d.ts +3 -3
  151. package/dist/organisms/views/FormViews.js +47 -46
  152. package/dist/organisms/views/FormViews.js.map +1 -1
  153. package/dist/registries/components.js.map +1 -1
  154. package/dist/utils/getEventValue.js.map +1 -1
  155. package/dist/utils/iconClass.js +4 -5
  156. package/dist/utils/iconClass.js.map +1 -1
  157. package/dist/utils/mapPagination.js.map +1 -1
  158. package/dist/utils/stopPropagationWrapper.js.map +1 -1
  159. package/package.json +7 -7
  160. package/src/all.ts +34 -0
  161. package/src/atoms/icon/Icon.stories.tsx +1 -1
  162. package/src/contexts/FormioContext.tsx +96 -0
  163. package/src/hooks/useFormioContext.ts +13 -0
  164. package/src/hooks/useI18n.ts +9 -0
  165. package/src/index.ts +17 -13
  166. package/src/interfaces/ComponentType.ts +2 -2
  167. package/src/interfaces/FormBuilderOptions.ts +9 -0
  168. package/src/interfaces/FormOptions.ts +7 -13
  169. package/src/interfaces/FormType.ts +5 -11
  170. package/src/interfaces/SubmissionType.ts +9 -8
  171. package/src/interfaces/index.ts +1 -0
  172. package/src/molecules/button/Button.stories.tsx +1 -1
  173. package/src/molecules/forms/form-control/FormControl.spec.tsx +5 -2
  174. package/src/molecules/forms/form-control/FormControl.stories.tsx +1 -1
  175. package/src/molecules/forms/input-tags/components/ChoicesTags.stories.tsx +1 -1
  176. package/src/molecules/forms/input-tags/components/ChoicesTags.tsx +4 -4
  177. package/src/molecules/forms/input-tags/components/ReactTags.stories.tsx +1 -1
  178. package/src/molecules/forms/input-text/InputText.stories.tsx +2 -2
  179. package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +2 -2
  180. package/src/molecules/forms/select/components/ChoicesSelect.tsx +2 -2
  181. package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +2 -2
  182. package/src/molecules/forms/select/components/ReactSelect.stories.tsx +2 -2
  183. package/src/molecules/loader/Loader.stories.tsx +1 -1
  184. package/src/molecules/modal/Modal.stories.tsx +1 -1
  185. package/src/molecules/pagination/Pagination.stories.tsx +1 -1
  186. package/src/molecules/pagination/Pagination.tsx +10 -10
  187. package/src/molecules/table/Table.stories.tsx +8 -8
  188. package/src/molecules/table/Table.tsx +1 -1
  189. package/src/molecules/table/filters/SelectFilter.tsx +1 -1
  190. package/src/molecules/table/hooks/useTable.tsx +7 -6
  191. package/src/molecules/table/utils/mapFormToColumns.tsx +6 -5
  192. package/src/molecules/tabs/Tabs.stories.tsx +2 -2
  193. package/src/molecules/tabs/TabsLegacy.stories.tsx +2 -2
  194. package/src/molecules/tabs/TabsLegacy.tsx +5 -3
  195. package/src/organisms/form/Form.stories.tsx +98 -118
  196. package/src/organisms/form/access/FormAccess.schema.ts +1 -0
  197. package/src/organisms/form/access/FormAccess.stories.tsx +5 -3
  198. package/src/organisms/form/actions/FormAction.stories.tsx +6 -2
  199. package/src/organisms/form/actions/FormAction.tsx +2 -2
  200. package/src/organisms/form/builder/FormBuilder.stories.tsx +4 -1
  201. package/src/organisms/form/builder/FormEdit.stories.tsx +11 -7
  202. package/src/organisms/form/builder/FormEdit.tsx +6 -6
  203. package/src/organisms/form/builder/FormEditCtas.tsx +10 -10
  204. package/src/organisms/form/builder/useFormBuilder.ts +12 -7
  205. package/src/organisms/form/exports/FormExport.stories.tsx +9 -12
  206. package/src/organisms/form/exports/FormExport.tsx +12 -9
  207. package/src/organisms/form/preview/FormPreview.stories.tsx +7 -10
  208. package/src/organisms/form/preview/FormPreview.tsx +7 -5
  209. package/src/organisms/form/settings/FormSettings.component.spec.tsx +3 -1
  210. package/src/organisms/form/settings/FormSettings.stories.tsx +1 -1
  211. package/src/organisms/form/settings/FormSettings.tsx +6 -6
  212. package/src/organisms/form/useForm.ts +2 -3
  213. package/src/organisms/modal/RemoveModal.stories.tsx +1 -1
  214. package/src/organisms/table/actions/ActionsTable.stories.tsx +2 -2
  215. package/src/organisms/table/actions/ActionsTable.tsx +7 -5
  216. package/src/organisms/table/forms/FormsTable.tsx +6 -5
  217. package/src/organisms/table/submissions/SubmissionsTable.stories.tsx +11 -14
  218. package/src/organisms/views/FormViews.stories.tsx +14 -17
  219. package/src/organisms/views/FormViews.tsx +18 -16
  220. package/src/utils/iconClass.ts +1 -3
  221. package/vite.config.mts +2 -2
  222. package/dist/typings.d.js +0 -2
  223. package/dist/typings.d.js.map +0 -1
  224. package/src/typings.d.ts +0 -3
  225. package/tsconfig.app.json +0 -11
  226. package/tsconfig.json +0 -21
  227. package/tsconfig.node.json +0 -13
  228. package/tsconfig.spec.json +0 -14
@@ -1,7 +1,7 @@
1
1
  import "./all.js";
2
2
 
3
- import { Meta, StoryObj } from "@storybook/react";
4
- import { expect, fn, userEvent, waitFor, within } from "@storybook/test";
3
+ import { Meta, StoryObj } from "@storybook/react-vite";
4
+ import { expect, fn, userEvent, waitFor, within } from "storybook/test";
5
5
 
6
6
  import { Icon } from "../../atoms/icon/Icon.js";
7
7
  import { Button } from "../button/Button.js";
@@ -1,6 +1,6 @@
1
1
  import "./all.js";
2
2
 
3
- import { Meta, StoryObj } from "@storybook/react";
3
+ import { Meta, StoryObj } from "@storybook/react-vite";
4
4
 
5
5
  import { TabsLegacy } from "./TabsLegacy.js";
6
6
 
@@ -37,7 +37,7 @@ export default {
37
37
  render: (args: any) => {
38
38
  return (
39
39
  <div className={"border-gray-300 border-1 shadow"}>
40
- <TabsLegacy {...args} i18n={(f) => f} />
40
+ <TabsLegacy {...args} />
41
41
  </div>
42
42
  );
43
43
  }
@@ -2,6 +2,8 @@ import "./all.js";
2
2
 
3
3
  import { CSSProperties, ReactNode } from "react";
4
4
 
5
+ import { useI18n } from "../../hooks/useI18n.js";
6
+ import type { FormOptions } from "../../interfaces/index.js";
5
7
  import { getComponent } from "../../registries/components.js";
6
8
  import type { Tab as DefaultTab } from "./Tab.js";
7
9
  import type { TabList as DefaultTabList } from "./TabList.js";
@@ -23,7 +25,7 @@ export interface TabsLegacyProps extends Record<string, any> {
23
25
  className?: string;
24
26
  reverse?: boolean;
25
27
  onClick?: (item: TabsItemProps) => void;
26
- i18n?: (f: string) => string;
28
+ i18n?: FormOptions["i18n"];
27
29
  }
28
30
 
29
31
  export function TabsLegacy({
@@ -34,7 +36,6 @@ export function TabsLegacy({
34
36
  AddButton,
35
37
  className,
36
38
  onClick,
37
- i18n = (f) => f,
38
39
  reverse,
39
40
  after,
40
41
  ...additionalProps
@@ -45,6 +46,7 @@ export function TabsLegacy({
45
46
  const TabPanel = getComponent<typeof DefaultTabPanel>("TabPanel");
46
47
  const Tabs = getComponent<typeof DefaultTabs>("Tabs");
47
48
  const tabs = items.filter((item) => item.label || item.icon);
49
+ const { t } = useI18n(additionalProps.i18n);
48
50
 
49
51
  return (
50
52
  <Tabs className={className} style={style}>
@@ -62,7 +64,7 @@ export function TabsLegacy({
62
64
  className={reverse ? "-reverse" : ""}
63
65
  after={after}
64
66
  >
65
- {i18n(item.label || "")}
67
+ {t(item.label || "")}
66
68
  </Tab>
67
69
  );
68
70
  })}
@@ -1,6 +1,7 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { expect, fn, userEvent, waitFor, within } from "@storybook/test";
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { delay, http, HttpResponse } from "msw";
3
3
  import { useEffect, useState } from "react";
4
+ import { expect, fn, userEvent, waitFor, within } from "storybook/test";
4
5
 
5
6
  import { SubmissionType } from "../../interfaces";
6
7
  import { InputText } from "../../molecules/forms/input-text/InputText";
@@ -9,12 +10,6 @@ import formFirstname from "../__fixtures__/form-firstname.fixture.json";
9
10
  import { useEditForm } from "../__fixtures__/useEditForm";
10
11
  import { Form } from "./Form";
11
12
 
12
- async function delay(number: number) {
13
- return new Promise((resolve) => {
14
- setTimeout(resolve, number);
15
- });
16
- }
17
-
18
13
  /**
19
14
  * The form component is the primary component of the system. It is what takes the form definition (json) and renders the
20
15
  * form into html. There are multiple ways to send the form to the Form component. The two main ways are to pass the `src`
@@ -332,15 +327,15 @@ export const WithOnSubmit: Story = {
332
327
  expect(firstnameInput).toHaveValue("John");
333
328
  expect(lastNameInput).toHaveValue("Doe");
334
329
 
335
- userEvent.clear(firstnameInput);
336
- userEvent.type(firstnameInput, "Jane", { delay: 100 });
330
+ await userEvent.clear(firstnameInput);
331
+ await userEvent.type(firstnameInput, "Jane", { delay: 100 });
337
332
 
338
333
  await waitFor(() => {
339
334
  expect(firstnameInput).toHaveValue("Jane");
340
335
  });
341
336
 
342
- userEvent.clear(lastNameInput);
343
- userEvent.type(lastNameInput, "Smith", { delay: 100 });
337
+ await userEvent.clear(lastNameInput);
338
+ await userEvent.type(lastNameInput, "Smith", { delay: 100 });
344
339
 
345
340
  await waitFor(() => {
346
341
  expect(lastNameInput).toHaveValue("Smith");
@@ -397,42 +392,20 @@ export const WithOnSubmit: Story = {
397
392
  * Form with custom validation hook
398
393
  */
399
394
  export const CustomValidation: Story = {
400
- parameters: {
401
- mockData: [
402
- {
403
- url: "https://test.dev/todos/1",
404
- method: "GET",
405
- status: 500,
406
- response: {
407
- message: "My custom message about this field",
408
- type: "custom",
409
- path: ["firstName"],
410
- level: "error"
411
- },
412
- delay: 800
413
- }
414
- ]
415
- },
395
+ parameters: {},
416
396
  args: {
417
397
  form: formFirstname as never,
418
398
  options: {
419
399
  hooks: {
420
400
  async customValidation(submission: SubmissionType, callback: (error: any) => void) {
421
- const response = await fetch("https://test.dev/todos/1", {
422
- headers: {
423
- Accept: "application/json",
424
- "Content-Type": "application/json"
425
- },
426
- method: "GET"
427
- });
428
-
429
- const responseData = await response.json();
430
-
431
- if (response.ok) {
432
- callback(null);
433
- } else {
434
- callback(responseData);
435
- }
401
+ setTimeout(() => {
402
+ callback({
403
+ message: "My custom message about this field",
404
+ type: "custom",
405
+ path: ["firstName"],
406
+ level: "error"
407
+ });
408
+ }, 200);
436
409
  }
437
410
  }
438
411
  }
@@ -451,15 +424,15 @@ export const CustomValidation: Story = {
451
424
  let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
452
425
  let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
453
426
 
454
- userEvent.clear(firstnameInput);
455
- userEvent.type(firstnameInput, "Jane", { delay: 100 });
427
+ await userEvent.clear(firstnameInput);
428
+ await userEvent.type(firstnameInput, "Jane", { delay: 100 });
456
429
 
457
430
  await waitFor(() => {
458
431
  expect(firstnameInput).toHaveValue("Jane");
459
432
  });
460
433
 
461
- userEvent.clear(lastNameInput);
462
- userEvent.type(lastNameInput, "Smith", { delay: 100 });
434
+ await userEvent.clear(lastNameInput);
435
+ await userEvent.type(lastNameInput, "Smith", { delay: 100 });
463
436
 
464
437
  await waitFor(() => {
465
438
  expect(lastNameInput).toHaveValue("Smith");
@@ -467,7 +440,7 @@ export const CustomValidation: Story = {
467
440
 
468
441
  let submitButton = canvas.getByRole("button", { name: "Submit" });
469
442
 
470
- userEvent.click(submitButton);
443
+ await userEvent.click(submitButton);
471
444
 
472
445
  await waitFor(async () => {
473
446
  expect(canvas.getByText("Please fix the following errors before submitting.")).toBeInTheDocument();
@@ -490,35 +463,29 @@ export const FetchSubmissionWithCustomAction: Story = {
490
463
  }
491
464
  },
492
465
  parameters: {
493
- mockData: [
494
- {
495
- url: "https://local.dev/form/Test",
496
- method: "GET",
497
- status: 200,
498
- response: formFirstname,
499
- delay: 200
500
- },
501
- {
502
- url: "https://local.dev/form/Test/submissions/1",
503
- method: "GET",
504
- status: 200,
505
- response: {
506
- firstName: "John",
507
- lastName: "Doe"
508
- },
509
- delay: 800
510
- },
511
- {
512
- url: "https://local.dev/form/Test/submissions/1",
513
- method: "PUT",
514
- status: 200,
515
- response: {
516
- firstName: "John",
517
- lastName: "Doe"
518
- },
519
- delay: 800
520
- }
521
- ]
466
+ chromatic: { disableSnapshot: false },
467
+ msw: {
468
+ handlers: [
469
+ http.get("https://local.dev/form/Test", async () => {
470
+ await delay(200);
471
+ return HttpResponse.json(JSON.parse(JSON.stringify(formFirstname)));
472
+ }),
473
+ http.get("https://local.dev/form/Test/submissions/1", async () => {
474
+ await delay(300);
475
+ return HttpResponse.json({
476
+ firstName: "Jane",
477
+ lastName: "Doe"
478
+ });
479
+ }),
480
+ http.put("https://local.dev/form/Test/submissions/1", async () => {
481
+ await delay(800);
482
+ return HttpResponse.json({
483
+ firstName: "Jane",
484
+ lastName: "Doe"
485
+ });
486
+ })
487
+ ]
488
+ }
522
489
  },
523
490
  render(args) {
524
491
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -559,18 +526,25 @@ export const FetchSubmissionWithCustomAction: Story = {
559
526
  expect(canvas.getByTestId("formio-container")).toHaveClass("formio-form-ready");
560
527
  });
561
528
 
529
+ await delay(200);
530
+
562
531
  let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
563
532
  let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
564
533
 
565
- userEvent.clear(firstnameInput);
566
- userEvent.type(firstnameInput, "Jane", { delay: 100 });
534
+ await userEvent.clear(firstnameInput);
535
+
536
+ await waitFor(() => {
537
+ expect(firstnameInput).toHaveValue("");
538
+ });
539
+
540
+ await userEvent.type(firstnameInput, "Jane", { delay: 100 });
567
541
 
568
542
  await waitFor(() => {
569
543
  expect(firstnameInput).toHaveValue("Jane");
570
544
  });
571
545
 
572
- userEvent.clear(lastNameInput);
573
- userEvent.type(lastNameInput, "Smith", { delay: 100 });
546
+ await userEvent.clear(lastNameInput);
547
+ await userEvent.type(lastNameInput, "Smith", { delay: 100 });
574
548
 
575
549
  await waitFor(() => {
576
550
  expect(lastNameInput).toHaveValue("Smith");
@@ -578,7 +552,7 @@ export const FetchSubmissionWithCustomAction: Story = {
578
552
 
579
553
  let submitButton = canvas.getByRole("button", { name: "Submit" });
580
554
 
581
- userEvent.click(submitButton);
555
+ await userEvent.click(submitButton);
582
556
 
583
557
  await delay(1000);
584
558
 
@@ -597,37 +571,36 @@ export const ErrorOnSubmitServer: Story = {
597
571
  }
598
572
  },
599
573
  parameters: {
600
- mockData: [
601
- {
602
- url: "https://local.dev/form/Test2",
603
- method: "GET",
604
- status: 200,
605
- response: formFirstname,
606
- delay: 200
607
- },
608
- {
609
- url: "https://local.dev/form/Test2/submissions/2",
610
- method: "GET",
611
- status: 200,
612
- response: {
613
- firstName: "John",
614
- lastName: "Doe"
615
- },
616
- delay: 800
617
- },
618
- {
619
- url: "https://local.dev/form/Test2/submissions/2",
620
- method: "PUT",
621
- status: 400,
622
- response: {
623
- message: "My custom message about this field",
624
- type: "custom",
625
- path: ["firstName"],
626
- level: "error"
627
- },
628
- delay: 800
629
- }
630
- ]
574
+ chromatic: { disableSnapshot: false },
575
+ msw: {
576
+ handlers: [
577
+ http.get("https://local.dev/form/Test2", async () => {
578
+ await delay(200);
579
+ return HttpResponse.json(JSON.parse(JSON.stringify(formFirstname)));
580
+ }),
581
+ http.get("https://local.dev/form/Test2/submissions/2", async () => {
582
+ await delay(300);
583
+ return HttpResponse.json({
584
+ firstName: "John",
585
+ lastName: "Doe"
586
+ });
587
+ }),
588
+ http.put("https://local.dev/form/Test2/submissions/2", async () => {
589
+ await delay(800);
590
+ return HttpResponse.json(
591
+ {
592
+ message: "My custom message about this field",
593
+ type: "custom",
594
+ path: ["firstName"],
595
+ level: "error"
596
+ },
597
+ {
598
+ status: 400
599
+ }
600
+ );
601
+ })
602
+ ]
603
+ }
631
604
  },
632
605
  render(args) {
633
606
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -668,18 +641,25 @@ export const ErrorOnSubmitServer: Story = {
668
641
  expect(canvas.getByTestId("formio-container")).toHaveClass("formio-form-ready");
669
642
  });
670
643
 
644
+ await delay(200);
645
+
671
646
  let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
672
647
  let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
673
648
 
674
- userEvent.clear(firstnameInput);
675
- userEvent.type(firstnameInput, "Jane", { delay: 100 });
649
+ await userEvent.clear(firstnameInput);
650
+
651
+ await waitFor(() => {
652
+ expect(firstnameInput).toHaveValue("");
653
+ });
654
+
655
+ await userEvent.type(firstnameInput, "Jane", { delay: 100 });
676
656
 
677
657
  await waitFor(() => {
678
658
  expect(firstnameInput).toHaveValue("Jane");
679
659
  });
680
660
 
681
- userEvent.clear(lastNameInput);
682
- userEvent.type(lastNameInput, "Smith", { delay: 100 });
661
+ await userEvent.clear(lastNameInput);
662
+ await userEvent.type(lastNameInput, "Smith", { delay: 100 });
683
663
 
684
664
  await waitFor(() => {
685
665
  expect(lastNameInput).toHaveValue("Smith");
@@ -687,7 +667,7 @@ export const ErrorOnSubmitServer: Story = {
687
667
 
688
668
  let submitButton = canvas.getByRole("button", { name: "Submit" });
689
669
 
690
- userEvent.click(submitButton);
670
+ await userEvent.click(submitButton);
691
671
 
692
672
  await delay(1000);
693
673
 
@@ -11,6 +11,7 @@ export function getRoleComponent({ label, key, description, choices, data }: any
11
11
  placeholder: "Select roles...",
12
12
  tooltip: "",
13
13
  multiple: true,
14
+ input: true,
14
15
  dataSrc: "values",
15
16
  defaultValue: "",
16
17
  data: {
@@ -1,5 +1,5 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { expect, fn, userEvent, within } from "@storybook/test";
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { expect, fn, userEvent, within } from "storybook/test";
3
3
 
4
4
  import { FormAccess } from "./FormAccess";
5
5
 
@@ -63,7 +63,9 @@ export const Sandbox: Story = {
63
63
  ],
64
64
  controller: "",
65
65
  properties: {},
66
- settings: {},
66
+ settings: {
67
+ hideTitle: false
68
+ },
67
69
  name: "textField",
68
70
  path: "textfield",
69
71
  machineName: "tcspjwhsevrzpcd:textField"
@@ -1,7 +1,7 @@
1
1
  import "../../../molecules/card/Card.js";
2
2
  import "../Form.js";
3
3
 
4
- import { Meta, StoryObj } from "@storybook/react";
4
+ import { Meta, StoryObj } from "@storybook/react-vite";
5
5
 
6
6
  import { FormAction } from "./FormAction.js";
7
7
 
@@ -88,6 +88,7 @@ export const SaveAction: Story = {
88
88
  input: false,
89
89
  tree: true,
90
90
  legend: "Action Settings",
91
+ key: "settings",
91
92
  components: [
92
93
  {
93
94
  input: false,
@@ -101,7 +102,8 @@ export const SaveAction: Story = {
101
102
  placeholder: "This form",
102
103
  basePath: "/project/5d0797bc872fc7d140559857/form",
103
104
  form: "62b18b10fbbba513555c6c5e",
104
- required: false
105
+ required: false,
106
+ input: true
105
107
  }
106
108
  ]
107
109
  }
@@ -205,6 +207,7 @@ export const EmailAction: Story = {
205
207
  input: false,
206
208
  tree: true,
207
209
  legend: "Email Settings",
210
+ key: "settings",
208
211
  components: [
209
212
  {
210
213
  type: "textfield",
@@ -340,6 +343,7 @@ export const WebhookAction: Story = {
340
343
  input: false,
341
344
  tree: true,
342
345
  legend: "Webhook Settings",
346
+ key: "settings",
343
347
  components: [
344
348
  {
345
349
  type: "textfield",
@@ -1,4 +1,4 @@
1
- import FormioUtils from "formiojs/utils";
1
+ import FormioUtils from "@formio/js/utils";
2
2
  import { PropsWithChildren, ReactElement } from "react";
3
3
 
4
4
  import { ActionDefaultsType, ActionType, FormOptions, SubmissionType } from "../../../interfaces";
@@ -44,7 +44,7 @@ export function FormAction({ actionInfo, children, onSubmit, options, ...props }
44
44
  const submission = mapData(props.submission || {}, actionInfo.defaults!);
45
45
  const form = mapSettingsForm(actionInfo.settingsForm);
46
46
 
47
- return { form, submission: { data: submission } };
47
+ return { form, submission: { data: submission } as SubmissionType<ActionType> };
48
48
  })();
49
49
 
50
50
  return (
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
2
 
3
3
  import form from "../../__fixtures__/form.fixture.json";
4
4
  import formWizard from "../../__fixtures__/form-wizard.fixture.json";
@@ -59,6 +59,9 @@ export default {
59
59
  action: "onDeleteComponent"
60
60
  }
61
61
  },
62
+ render(args) {
63
+ return <FormBuilder display={args.display} components={args.components} options={args.options} />;
64
+ },
62
65
  tags: ["autodocs"]
63
66
  } satisfies Meta<typeof FormBuilder>;
64
67
 
@@ -1,4 +1,4 @@
1
- import { Meta, StoryObj } from "@storybook/react";
1
+ import { Meta, StoryObj } from "@storybook/react-vite";
2
2
 
3
3
  import { FormEdit } from "./all";
4
4
  import { defaultDisplayChoices } from "./FormParameters";
@@ -92,7 +92,14 @@ export default {
92
92
  options: ["choicesjs", "react"]
93
93
  }
94
94
  },
95
- parameters: {}
95
+ parameters: {},
96
+ args: {
97
+ options: {
98
+ template: "tailwind",
99
+ iconset: "bx",
100
+ noDefaultSubmitButton: true
101
+ }
102
+ }
96
103
  } satisfies Meta<typeof FormEdit>;
97
104
 
98
105
  type Story = StoryObj<typeof FormEdit>;
@@ -106,7 +113,6 @@ export const EditWebForm: Story = {
106
113
  ],
107
114
  displayChoices: defaultDisplayChoices,
108
115
  enableTags: true,
109
- options: { template: "tailwind", iconset: "bx" },
110
116
  form: {
111
117
  type: "form",
112
118
  tags: [],
@@ -307,8 +313,7 @@ export const WithoutTypeChoices: Story = {
307
313
  machineName: "tcspjwhsevrzpcd:textField"
308
314
  } as any,
309
315
  displayChoices: defaultDisplayChoices,
310
- enableTags: true,
311
- options: { template: "tailwind", iconset: "bx" }
316
+ enableTags: true
312
317
  }
313
318
  };
314
319
 
@@ -412,7 +417,6 @@ export const WithoutTags: Story = {
412
417
  machineName: "tcspjwhsevrzpcd:textField"
413
418
  } as any,
414
419
  displayChoices: defaultDisplayChoices,
415
- enableTags: false,
416
- options: { template: "tailwind", iconset: "bx" }
420
+ enableTags: false
417
421
  }
418
422
  };
@@ -1,6 +1,7 @@
1
1
  import classnames from "classnames";
2
+ import type { CSSProperties } from "react";
2
3
 
3
- import type { FormOptions } from "../../../interfaces";
4
+ import type { FormBuilderOptions, FormOptions } from "../../../interfaces/index.js";
4
5
  import { getComponent } from "../../../registries/components";
5
6
  import { FormBuilder as DefaultFormBuilder } from "./FormBuilder";
6
7
  import { FormEditCTAs as DefaultFormEditCTAs } from "./FormEditCtas";
@@ -9,10 +10,10 @@ import { FormBuilderEvents } from "./useFormBuilder";
9
10
  import { useFormEdit, UseFormEditHookProps } from "./useFormEdit";
10
11
 
11
12
  export interface FormEditProps extends UseFormEditHookProps, FormBuilderEvents {
12
- options?: FormOptions;
13
+ options?: FormBuilderOptions & FormOptions;
13
14
  layout?: "html5" | "choicesjs" | "react";
14
15
  className?: string;
15
- style?: React.CSSProperties;
16
+ style?: CSSProperties;
16
17
  }
17
18
 
18
19
  export function FormEdit({
@@ -35,7 +36,6 @@ export function FormEdit({
35
36
  onCopy: initialOnCopy
36
37
  });
37
38
 
38
- const { options = {} } = props;
39
39
  const FormParameters = getComponent<typeof DefaultFormParameters>("FormParameters");
40
40
  const FormBuilder = getComponent<typeof DefaultFormBuilder>("FormBuilder");
41
41
  const FormEditCTAs = getComponent<typeof DefaultFormEditCTAs>("FormEditCTAs");
@@ -54,7 +54,7 @@ export function FormEdit({
54
54
  />
55
55
  <FormEditCTAs
56
56
  key={`form-edit-ctas-${form._id}`}
57
- options={options}
57
+ options={props.options}
58
58
  hasRedo={hasRedo}
59
59
  hasUndo={hasUndo}
60
60
  disabled={!(isValid && hasChanged)}
@@ -71,7 +71,7 @@ export function FormEdit({
71
71
  key={`form-builder-${form._id}`}
72
72
  components={form.components!}
73
73
  display={form.display}
74
- options={options}
74
+ options={props.options}
75
75
  onChange={(components) => {
76
76
  setChange("components", components);
77
77
  }}
@@ -1,8 +1,9 @@
1
1
  import { ReactElement } from "react";
2
2
 
3
3
  import { Icon as DefaultIcon } from "../../../atoms/icon/Icon";
4
+ import { useI18n } from "../../../hooks/useI18n";
4
5
  import { useTooltip } from "../../../hooks/useTooltip";
5
- import type { FormOptions } from "../../../interfaces";
6
+ import type { FormOptions } from "../../../interfaces/index.js";
6
7
  import { Button as DefaultButton } from "../../../molecules/button/Button";
7
8
  import { getComponent, registerComponent } from "../../../registries/components";
8
9
 
@@ -22,17 +23,16 @@ export interface FormEditCTAsProps extends Record<string, unknown> {
22
23
  export function FormEditCTAs({
23
24
  saveText = "Save",
24
25
  disabled,
25
- options = {},
26
26
  onCopy,
27
27
  hasUndo,
28
28
  hasRedo,
29
29
  onUndo,
30
30
  onRedo,
31
31
  onReset,
32
- onSubmit
32
+ onSubmit,
33
+ options
33
34
  }: FormEditCTAsProps): ReactElement {
34
- const { i18n: t = (t: string): string => t } = options;
35
-
35
+ const { t } = useI18n(options?.i18n);
36
36
  const copyTooltipRef: any = useTooltip({
37
37
  trigger: "hover",
38
38
  placement: "top",
@@ -64,29 +64,29 @@ export function FormEditCTAs({
64
64
  <div className={"form-edit__actions"}>
65
65
  <div>
66
66
  <Button variant='primary' className='btn-save' disabled={disabled} onClick={() => onSubmit?.()}>
67
- <Icon name='save' iconset={options.iconset} />
67
+ <Icon name='save' iconset={options?.iconset} />
68
68
  {saveText}
69
69
  </Button>
70
70
 
71
71
  <div>
72
72
  <Button variant='light' className='btn-undo' disabled={!hasUndo} onClick={() => onUndo?.()} ref={undoTooltipRef}>
73
- <Icon name='undo' iconset={options.iconset} />
73
+ <Icon name='undo' iconset={options?.iconset} />
74
74
  </Button>
75
75
 
76
76
  <Button variant='light' className='btn-redo' disabled={!hasRedo} onClick={() => onRedo?.()} ref={redoTooltipRef}>
77
- <Icon name='redo' iconset={options.iconset} />
77
+ <Icon name='redo' iconset={options?.iconset} />
78
78
  </Button>
79
79
  </div>
80
80
 
81
81
  <div>
82
82
  {onCopy && (
83
83
  <Button variant='light' className='btn-copy' onClick={() => onCopy()} ref={copyTooltipRef}>
84
- <Icon name='copy' iconset={options.iconset} />
84
+ <Icon name='copy' iconset={options?.iconset} />
85
85
  </Button>
86
86
  )}
87
87
 
88
88
  <Button variant='light' className='btn-reset' onClick={() => onReset && onReset()} ref={resetTooltipRef!}>
89
- <Icon name='reset' iconset={options.iconset} />
89
+ <Icon name='reset' iconset={options?.iconset} />
90
90
  </Button>
91
91
  </div>
92
92
  </div>