envoc-form 4.0.1-9 → 4.1.0

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 (204) hide show
  1. package/README.md +5117 -12
  2. package/es/AddressInput/AddressInput.d.ts +15 -5
  3. package/es/AddressInput/AddressInput.js +10 -0
  4. package/es/ConfirmBaseForm/ConfirmBaseForm.d.ts +14 -0
  5. package/es/ConfirmBaseForm/ConfirmBaseForm.js +6 -0
  6. package/es/ConfirmDeleteForm/ConfirmDeleteForm.d.ts +13 -0
  7. package/es/ConfirmDeleteForm/ConfirmDeleteForm.js +5 -0
  8. package/es/DatePicker/DatePickerGroup.d.ts +7 -2
  9. package/es/DatePicker/DatePickerGroup.js +16 -6
  10. package/es/DatePicker/StringDateOnlyPickerGroup.d.ts +6 -1
  11. package/es/DatePicker/StringDateOnlyPickerGroup.js +5 -0
  12. package/es/DatePicker/StringDatePickerGroup.d.ts +6 -1
  13. package/es/DatePicker/StringDatePickerGroup.js +5 -0
  14. package/es/Field/Field.d.ts +9 -3
  15. package/es/Field/Field.js +9 -4
  16. package/es/Field/FieldErrorScrollTarget.d.ts +1 -0
  17. package/es/Field/FieldErrorScrollTarget.js +1 -0
  18. package/es/Field/StandAloneInput.d.ts +4 -0
  19. package/es/Field/StandAloneInput.js +1 -0
  20. package/es/Field/useStandardField.d.ts +6 -0
  21. package/es/Field/useStandardField.js +8 -9
  22. package/es/FieldArray/FieldArray.d.ts +11 -2
  23. package/es/FieldArray/FieldArray.js +7 -2
  24. package/es/File/FileGroup.d.ts +3 -1
  25. package/es/File/FileGroup.js +4 -3
  26. package/es/File/FileList.d.ts +2 -2
  27. package/es/Form/FocusError.d.ts +2 -0
  28. package/es/Form/FocusError.js +1 -0
  29. package/es/Form/Form.d.ts +6 -0
  30. package/es/Form/Form.js +1 -0
  31. package/es/Form/FormBasedPreventNavigation.d.ts +3 -1
  32. package/es/Form/FormBasedPreventNavigation.js +12 -45
  33. package/es/Form/LegacyFormBasedPreventNavigation.d.ts +17 -0
  34. package/es/Form/LegacyFormBasedPreventNavigation.js +69 -0
  35. package/es/Form/NewFormBasedPreventNavigation.d.ts +14 -0
  36. package/es/Form/NewFormBasedPreventNavigation.js +39 -0
  37. package/es/Form/ServerErrorContext.d.ts +1 -0
  38. package/es/Form/ServerErrorContext.js +1 -0
  39. package/es/FormActions.d.ts +6 -0
  40. package/es/FormActions.js +1 -0
  41. package/es/FormDefaults.d.ts +1 -0
  42. package/es/FormDefaults.js +1 -0
  43. package/es/Group.d.ts +7 -4
  44. package/es/Group.js +4 -3
  45. package/es/Input/IconInputGroup.d.ts +4 -1
  46. package/es/Input/IconInputGroup.js +3 -1
  47. package/es/Input/InputGroup.d.ts +4 -4
  48. package/es/Input/InputGroup.js +4 -4
  49. package/es/Input/MoneyInputGroup.d.ts +3 -1
  50. package/es/Input/MoneyInputGroup.js +1 -0
  51. package/es/Input/NumberInputGroup.d.ts +3 -1
  52. package/es/Input/NumberInputGroup.js +1 -0
  53. package/es/Input/StringInputGroup.d.ts +2 -1
  54. package/es/Input/StringInputGroup.js +3 -1
  55. package/es/Normalization/normalizers.d.ts +4 -2
  56. package/es/Normalization/normalizers.js +2 -0
  57. package/es/Select/BooleanSelectGroup.d.ts +2 -1
  58. package/es/Select/BooleanSelectGroup.js +1 -0
  59. package/es/Select/NumberSelectGroup.d.ts +4 -2
  60. package/es/Select/NumberSelectGroup.js +2 -0
  61. package/es/Select/SelectGroup.d.ts +8 -2
  62. package/es/Select/SelectGroup.js +5 -4
  63. package/es/Select/StringSelectGroup.d.ts +2 -0
  64. package/es/Select/StringSelectGroup.js +2 -0
  65. package/es/StandardFormActions.d.ts +5 -0
  66. package/es/StandardFormActions.js +1 -0
  67. package/es/SubmitFormButton.d.ts +4 -1
  68. package/es/SubmitFormButton.js +1 -0
  69. package/es/TextArea/TextAreaGroup.d.ts +2 -1
  70. package/es/TextArea/TextAreaGroup.js +5 -4
  71. package/es/Validation/validators.d.ts +11 -8
  72. package/es/Validation/validators.js +6 -2
  73. package/es/index.d.ts +4 -4
  74. package/es/setupTests.d.ts +1 -0
  75. package/es/setupTests.js +1 -0
  76. package/lib/AddressInput/AddressInput.d.ts +15 -5
  77. package/lib/AddressInput/AddressInput.js +10 -0
  78. package/lib/ConfirmBaseForm/ConfirmBaseForm.d.ts +14 -0
  79. package/lib/ConfirmBaseForm/ConfirmBaseForm.js +6 -0
  80. package/lib/ConfirmDeleteForm/ConfirmDeleteForm.d.ts +13 -0
  81. package/lib/ConfirmDeleteForm/ConfirmDeleteForm.js +5 -0
  82. package/lib/DatePicker/DatePickerGroup.d.ts +7 -2
  83. package/lib/DatePicker/DatePickerGroup.js +16 -6
  84. package/lib/DatePicker/StringDateOnlyPickerGroup.d.ts +6 -1
  85. package/lib/DatePicker/StringDateOnlyPickerGroup.js +5 -0
  86. package/lib/DatePicker/StringDatePickerGroup.d.ts +6 -1
  87. package/lib/DatePicker/StringDatePickerGroup.js +5 -0
  88. package/lib/Field/Field.d.ts +9 -3
  89. package/lib/Field/Field.js +9 -4
  90. package/lib/Field/FieldErrorScrollTarget.d.ts +1 -0
  91. package/lib/Field/FieldErrorScrollTarget.js +1 -0
  92. package/lib/Field/StandAloneInput.d.ts +4 -0
  93. package/lib/Field/StandAloneInput.js +1 -0
  94. package/lib/Field/useStandardField.d.ts +6 -0
  95. package/lib/Field/useStandardField.js +8 -9
  96. package/lib/FieldArray/FieldArray.d.ts +11 -2
  97. package/lib/FieldArray/FieldArray.js +7 -2
  98. package/lib/File/FileGroup.d.ts +3 -1
  99. package/lib/File/FileGroup.js +4 -3
  100. package/lib/File/FileList.d.ts +2 -2
  101. package/lib/Form/FocusError.d.ts +2 -0
  102. package/lib/Form/FocusError.js +1 -0
  103. package/lib/Form/Form.d.ts +6 -0
  104. package/lib/Form/Form.js +1 -0
  105. package/lib/Form/FormBasedPreventNavigation.d.ts +3 -1
  106. package/lib/Form/FormBasedPreventNavigation.js +13 -43
  107. package/lib/Form/LegacyFormBasedPreventNavigation.d.ts +17 -0
  108. package/lib/Form/LegacyFormBasedPreventNavigation.js +72 -0
  109. package/lib/Form/NewFormBasedPreventNavigation.d.ts +14 -0
  110. package/lib/Form/NewFormBasedPreventNavigation.js +42 -0
  111. package/lib/Form/ServerErrorContext.d.ts +1 -0
  112. package/lib/Form/ServerErrorContext.js +1 -0
  113. package/lib/FormActions.d.ts +6 -0
  114. package/lib/FormActions.js +1 -0
  115. package/lib/FormDefaults.d.ts +1 -0
  116. package/lib/FormDefaults.js +1 -0
  117. package/lib/Group.d.ts +7 -4
  118. package/lib/Group.js +4 -3
  119. package/lib/Input/IconInputGroup.d.ts +4 -1
  120. package/lib/Input/IconInputGroup.js +3 -1
  121. package/lib/Input/InputGroup.d.ts +4 -4
  122. package/lib/Input/InputGroup.js +4 -4
  123. package/lib/Input/MoneyInputGroup.d.ts +3 -1
  124. package/lib/Input/MoneyInputGroup.js +1 -0
  125. package/lib/Input/NumberInputGroup.d.ts +3 -1
  126. package/lib/Input/NumberInputGroup.js +1 -0
  127. package/lib/Input/StringInputGroup.d.ts +2 -1
  128. package/lib/Input/StringInputGroup.js +3 -1
  129. package/lib/Normalization/normalizers.d.ts +4 -2
  130. package/lib/Normalization/normalizers.js +2 -0
  131. package/lib/Select/BooleanSelectGroup.d.ts +2 -1
  132. package/lib/Select/BooleanSelectGroup.js +1 -0
  133. package/lib/Select/NumberSelectGroup.d.ts +4 -2
  134. package/lib/Select/NumberSelectGroup.js +2 -0
  135. package/lib/Select/SelectGroup.d.ts +8 -2
  136. package/lib/Select/SelectGroup.js +5 -4
  137. package/lib/Select/StringSelectGroup.d.ts +2 -0
  138. package/lib/Select/StringSelectGroup.js +2 -0
  139. package/lib/StandardFormActions.d.ts +5 -0
  140. package/lib/StandardFormActions.js +1 -0
  141. package/lib/SubmitFormButton.d.ts +4 -1
  142. package/lib/SubmitFormButton.js +1 -0
  143. package/lib/TextArea/TextAreaGroup.d.ts +2 -1
  144. package/lib/TextArea/TextAreaGroup.js +5 -4
  145. package/lib/Validation/validators.d.ts +11 -8
  146. package/lib/Validation/validators.js +6 -2
  147. package/lib/index.d.ts +4 -4
  148. package/lib/setupTests.d.ts +1 -0
  149. package/lib/setupTests.js +3 -0
  150. package/package.json +9 -6
  151. package/src/AddressInput/AddressInput.tsx +15 -5
  152. package/src/AddressInput/__snapshots__/AddressInput.test.tsx.snap +8 -4
  153. package/src/ConfirmBaseForm/ConfirmBaseForm.tsx +14 -0
  154. package/src/ConfirmDeleteForm/ConfirmDeleteForm.tsx +13 -0
  155. package/src/DatePicker/DatePicker.test.tsx +1 -1
  156. package/src/DatePicker/DatePickerGroup.tsx +18 -7
  157. package/src/DatePicker/StringDateOnlyPickerGroup.tsx +7 -2
  158. package/src/DatePicker/StringDatePickerGroup.tsx +7 -1
  159. package/src/Field/Field.tsx +20 -7
  160. package/src/Field/FieldErrorScrollTarget.tsx +1 -0
  161. package/src/Field/StandAloneInput.tsx +4 -0
  162. package/src/Field/useStandardField.ts +13 -9
  163. package/src/FieldArray/FieldArray.tsx +14 -5
  164. package/src/File/FileGroup.tsx +9 -3
  165. package/src/File/FileList.tsx +2 -2
  166. package/src/Form/FocusError.tsx +3 -0
  167. package/src/Form/Form.tsx +6 -0
  168. package/src/Form/FormBasedPreventNavigation.tsx +28 -46
  169. package/src/Form/LegacyFormBasedPreventNavigation.tsx +77 -0
  170. package/src/Form/NewFormBasedPreventNavigation.tsx +59 -0
  171. package/src/Form/ServerErrorContext.ts +1 -0
  172. package/src/FormActions.tsx +7 -0
  173. package/src/FormDefaults.ts +1 -0
  174. package/src/Group.tsx +12 -4
  175. package/src/Input/IconInputGroup.tsx +5 -2
  176. package/src/Input/InputGroup.tsx +13 -5
  177. package/src/Input/MoneyInputGroup.tsx +3 -1
  178. package/src/Input/NumberInputGroup.tsx +3 -1
  179. package/src/Input/StringInputGroup.tsx +3 -2
  180. package/src/Input/__Tests__/__snapshots__/IconInputGroup.test.tsx.snap +1 -0
  181. package/src/Input/__Tests__/__snapshots__/MoneyInputGroup.test.tsx.snap +1 -0
  182. package/src/Input/__Tests__/__snapshots__/NumberInputGroup.test.tsx.snap +1 -0
  183. package/src/Input/__Tests__/__snapshots__/StringInputGroup.test.tsx.snap +1 -0
  184. package/src/Normalization/normalizers.ts +4 -2
  185. package/src/Select/BooleanSelectGroup.tsx +2 -1
  186. package/src/Select/NumberSelectGroup.tsx +4 -2
  187. package/src/Select/SelectGroup.tsx +13 -2
  188. package/src/Select/StringSelectGroup.tsx +2 -0
  189. package/src/StandardFormActions.tsx +5 -0
  190. package/src/SubmitFormButton.tsx +5 -1
  191. package/src/TextArea/TextAreaGroup.tsx +6 -4
  192. package/src/Validation/validators.ts +19 -14
  193. package/src/__Tests__/FormTestBase.tsx +9 -8
  194. package/src/__Tests__/RealisticForm.test.tsx +82 -0
  195. package/src/index.ts +4 -4
  196. package/src/setupTests.ts +1 -0
  197. package/es/__Tests__/FormTestBase.d.ts +0 -27
  198. package/es/__Tests__/FormTestBase.js +0 -83
  199. package/es/__Tests__/index.d.ts +0 -2
  200. package/es/__Tests__/index.js +0 -2
  201. package/lib/__Tests__/FormTestBase.d.ts +0 -27
  202. package/lib/__Tests__/FormTestBase.js +0 -86
  203. package/lib/__Tests__/index.d.ts +0 -2
  204. package/lib/__Tests__/index.js +0 -8
@@ -1,53 +1,20 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { useContext, useEffect } from 'react';
13
- // see: https://gist.github.com/rmorse/426ffcc579922a82749934826fa9f743
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext } from 'react';
14
3
  import { UNSAFE_NavigationContext as NavigationContext, } from 'react-router-dom';
15
4
  import { useFormikContext } from 'formik';
5
+ import LegacyFormBasedPreventNavigation from './LegacyFormBasedPreventNavigation';
6
+ import NewFormBasedPreventNavigation from './NewFormBasedPreventNavigation';
7
+ /** Prevent the user from navigating away from a form if there are any changes. */
16
8
  export default function FormBasedPreventNavigation(_a) {
17
9
  var ignoreLostChanges = _a.ignoreLostChanges, _b = _a.promptMessage, promptMessage = _b === void 0 ? 'Changes you made may not be saved.' : _b;
18
10
  var _c = useFormikContext(), dirty = _c.dirty, isSubmitting = _c.isSubmitting;
19
11
  var preventNavigate = !ignoreLostChanges && dirty && !isSubmitting;
20
12
  var navigator = useContext(NavigationContext).navigator;
21
- useEffect(function () {
22
- if (!preventNavigate) {
23
- return;
24
- }
25
- // TODO: https://reactrouter.com/docs/en/v6/upgrading/v5#prompt-is-not-currently-supported
26
- // this is a workaround until we get native support for prompt on navigate
27
- var blocker = function (tx) {
28
- if (window.confirm(promptMessage)) {
29
- tx.retry();
30
- }
31
- };
32
- var unblock = navigator.block(function (tx) {
33
- var autoUnblockingTx = __assign(__assign({}, tx), { retry: function () {
34
- // Automatically unblock the transition so it can play all the way
35
- // through before retrying it. TODO: Figure out how to re-enable
36
- // this block if the transition is cancelled for some reason.
37
- unblock();
38
- tx.retry();
39
- } });
40
- blocker(autoUnblockingTx);
41
- });
42
- window.addEventListener('beforeunload', beforeUnload);
43
- return function () {
44
- unblock();
45
- window.removeEventListener('beforeunload', beforeUnload);
46
- };
47
- function beforeUnload(e) {
48
- e.preventDefault();
49
- e.returnValue = promptMessage;
50
- }
51
- }, [preventNavigate, promptMessage, navigator]);
52
- return null;
13
+ var isUsingDataRouter = navigator.location === undefined;
14
+ if (isUsingDataRouter) {
15
+ return (_jsx(NewFormBasedPreventNavigation, { promptMessage: promptMessage, preventNavigate: preventNavigate, navigator: navigator }));
16
+ }
17
+ else {
18
+ return (_jsx(LegacyFormBasedPreventNavigation, { promptMessage: promptMessage, preventNavigate: preventNavigate, navigator: navigator }));
19
+ }
53
20
  }
@@ -0,0 +1,17 @@
1
+ import type { History } from 'history';
2
+ import { Navigator as BaseNavigator } from 'react-router-dom';
3
+ interface Navigator extends BaseNavigator {
4
+ block?: History['block'];
5
+ }
6
+ export interface FormBasedPreventNavigationProps {
7
+ promptMessage?: string;
8
+ preventNavigate: boolean;
9
+ navigator: Navigator;
10
+ }
11
+ /** Only use this if the project uses `<BrowserRouter/>` or any router that does not support the new
12
+ * [react-router Data API](https://reactrouter.com/en/main/routers/picking-a-router#using-v64-data-apis)
13
+ *
14
+ * Legacy function to prevent the user from navigating away from a form if there are any changes.
15
+ */
16
+ export default function LegacyFormBasedPreventNavigation({ promptMessage, preventNavigate, navigator, }: FormBasedPreventNavigationProps): null;
17
+ export {};
@@ -0,0 +1,69 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { useEffect } from 'react';
13
+ /** Only use this if the project uses `<BrowserRouter/>` or any router that does not support the new
14
+ * [react-router Data API](https://reactrouter.com/en/main/routers/picking-a-router#using-v64-data-apis)
15
+ *
16
+ * Legacy function to prevent the user from navigating away from a form if there are any changes.
17
+ */
18
+ export default function LegacyFormBasedPreventNavigation(_a) {
19
+ var _b = _a.promptMessage, promptMessage = _b === void 0 ? 'Changes you made may not be saved.' : _b, preventNavigate = _a.preventNavigate, navigator = _a.navigator;
20
+ useEffect(function () {
21
+ if (!preventNavigate) {
22
+ return;
23
+ }
24
+ var unblock = function () { };
25
+ var push = navigator.push;
26
+ // TODO: https://reactrouter.com/docs/en/v6/upgrading/v5#prompt-is-not-currently-supported
27
+ // this is a workaround until we get native support for prompt on navigate
28
+ if (navigator.block) {
29
+ var blocker_1 = function (tx) {
30
+ if (window.confirm(promptMessage)) {
31
+ tx.retry();
32
+ }
33
+ };
34
+ unblock = navigator.block(function (tx) {
35
+ var autoUnblockingTx = __assign(__assign({}, tx), { retry: function () {
36
+ // Automatically unblock the transition so it can play all the way
37
+ // through before retrying it. TODO: Figure out how to re-enable
38
+ // this block if the transition is cancelled for some reason.
39
+ unblock();
40
+ tx.retry();
41
+ } });
42
+ blocker_1(autoUnblockingTx);
43
+ });
44
+ }
45
+ else {
46
+ //https://gist.github.com/MarksCode/64e438c82b0b2a1161e01c88ca0d0355
47
+ navigator.push = function () {
48
+ var args = [];
49
+ for (var _i = 0; _i < arguments.length; _i++) {
50
+ args[_i] = arguments[_i];
51
+ }
52
+ if (window.confirm(promptMessage)) {
53
+ push.apply(void 0, args);
54
+ }
55
+ };
56
+ }
57
+ window.addEventListener('beforeunload', beforeUnload);
58
+ return function () {
59
+ unblock();
60
+ navigator.push = push;
61
+ window.removeEventListener('beforeunload', beforeUnload);
62
+ };
63
+ function beforeUnload(e) {
64
+ e.preventDefault();
65
+ e.returnValue = promptMessage;
66
+ }
67
+ }, [preventNavigate, promptMessage, navigator]);
68
+ return null;
69
+ }
@@ -0,0 +1,14 @@
1
+ import type { History } from 'history';
2
+ import { Navigator as BaseNavigator } from 'react-router-dom';
3
+ interface Navigator extends BaseNavigator {
4
+ block?: History['block'];
5
+ location: Location;
6
+ }
7
+ interface FormBasedPreventNavigationProps {
8
+ promptMessage?: string;
9
+ preventNavigate: boolean;
10
+ navigator: Navigator;
11
+ }
12
+ /** Temporary function to allow backwards compatibility with routers that do not use the new Data API */
13
+ export default function NewFormBasedPreventNavigation({ promptMessage, preventNavigate, navigator, }: FormBasedPreventNavigationProps): null;
14
+ export {};
@@ -0,0 +1,39 @@
1
+ import { useEffect } from 'react';
2
+ import { unstable_usePrompt as usePrompt, } from 'react-router-dom';
3
+ /** Temporary function to allow backwards compatibility with routers that do not use the new Data API */
4
+ export default function NewFormBasedPreventNavigation(_a) {
5
+ var _b = _a.promptMessage, promptMessage = _b === void 0 ? 'Changes you made may not be saved.' : _b, preventNavigate = _a.preventNavigate, navigator = _a.navigator;
6
+ usePrompt({
7
+ when: preventNavigate,
8
+ message: promptMessage,
9
+ });
10
+ // TODO: Once react-router fully supports usePrompt and when we do not want to support routers
11
+ // that do not support the react-router Data API we can remove this.
12
+ useEffect(function () {
13
+ if (!preventNavigate) {
14
+ return;
15
+ }
16
+ var unblock = function () { };
17
+ var push = navigator.push;
18
+ navigator.push = function () {
19
+ var args = [];
20
+ for (var _i = 0; _i < arguments.length; _i++) {
21
+ args[_i] = arguments[_i];
22
+ }
23
+ if (window.confirm(promptMessage)) {
24
+ push.apply(void 0, args);
25
+ }
26
+ };
27
+ window.addEventListener('beforeunload', beforeUnload);
28
+ return function () {
29
+ unblock();
30
+ navigator.push = push;
31
+ window.removeEventListener('beforeunload', beforeUnload);
32
+ };
33
+ function beforeUnload(e) {
34
+ e.preventDefault();
35
+ e.returnValue = promptMessage;
36
+ }
37
+ }, [preventNavigate, promptMessage, navigator]);
38
+ return null;
39
+ }
@@ -7,4 +7,5 @@ export interface ServerErrorContextProps {
7
7
  getError: (path: string) => string | undefined;
8
8
  setError: (path: string, errorMessage: string | undefined) => void;
9
9
  }
10
+ /** Context to store the API errors from the server for the form. */
10
11
  export declare const ServerErrorContext: React.Context<ServerErrorContextProps>;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ /** Context to store the API errors from the server for the form. */
2
3
  export var ServerErrorContext = React.createContext({
3
4
  errors: {},
4
5
  getError: function (path) {
@@ -1,7 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  export interface FormActionsProps {
3
+ /** Allow the form to be submitted without any changes. By default this is not allowed. */
3
4
  allowPristineSubmit?: boolean;
5
+ /** The cancel button's `onClick`.
6
+ * @defaultValue `window.history.back()`
7
+ */
4
8
  handleCancel?: () => void;
9
+ /** Whether both buttons should be disabled. */
5
10
  disabled?: boolean;
6
11
  }
12
+ /** Standard cancel and submit buttons. */
7
13
  export default function FormActions({ allowPristineSubmit, handleCancel, disabled, }: FormActionsProps): JSX.Element;
package/es/FormActions.js CHANGED
@@ -13,6 +13,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
13
13
  import { FormDefaults } from './FormDefaults';
14
14
  import { useFormikContext } from 'formik';
15
15
  import SubmitFormButton from './SubmitFormButton';
16
+ /** Standard cancel and submit buttons. */
16
17
  export default function FormActions(_a) {
17
18
  var allowPristineSubmit = _a.allowPristineSubmit, handleCancel = _a.handleCancel, disabled = _a.disabled;
18
19
  var isSubmitting = useFormikContext().isSubmitting;
@@ -1,3 +1,4 @@
1
+ /** `envoc-form-` CSS class prefix */
1
2
  export declare const FormDefaults: {
2
3
  cssClassPrefix: string;
3
4
  };
@@ -1 +1,2 @@
1
+ /** `envoc-form-` CSS class prefix */
1
2
  export var FormDefaults = { cssClassPrefix: 'envoc-form-' };
package/es/Group.d.ts CHANGED
@@ -1,13 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import { InjectedFieldProps } from './Field/InjectedFieldProps';
3
3
  export interface GroupProps extends InjectedFieldProps<any> {
4
+ /** Extra class names to apply. */
4
5
  className?: string;
5
6
  children: React.ReactNode;
6
- /** simple text label before the input */
7
+ /** Simple text label before the input. */
7
8
  label?: string;
8
- /** simple helper text after the input*/
9
+ /** Simple helper text after the input. */
9
10
  helpText?: string | React.ReactNode;
11
+ /** Whether the field should be disabled. */
10
12
  disabled?: boolean;
13
+ required?: boolean;
11
14
  }
12
- /** contains standard field bits like a label, helper text, error scroll target, validation message container, etc */
13
- export default function Group({ className, children, label, helpText, meta, input, disabled, }: GroupProps): JSX.Element;
15
+ /** Contains standard field bits like a label, helper text, error scroll target, validation message container, etc. */
16
+ export default function Group({ className, children, label, helpText, meta, input, disabled, required, }: GroupProps): JSX.Element;
package/es/Group.js CHANGED
@@ -13,12 +13,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import classNames from 'classnames';
14
14
  import { FormDefaults } from './FormDefaults';
15
15
  import FieldErrorScrollTarget from './Field/FieldErrorScrollTarget';
16
- /** contains standard field bits like a label, helper text, error scroll target, validation message container, etc */
16
+ /** Contains standard field bits like a label, helper text, error scroll target, validation message container, etc. */
17
17
  export default function Group(_a) {
18
18
  var _b;
19
- var className = _a.className, children = _a.children, label = _a.label, helpText = _a.helpText, meta = _a.meta, input = _a.input, disabled = _a.disabled;
19
+ var className = _a.className, children = _a.children, label = _a.label, helpText = _a.helpText, meta = _a.meta, input = _a.input, disabled = _a.disabled, required = _a.required;
20
20
  return (_jsxs("div", __assign({ className: classNames(className, FormDefaults.cssClassPrefix + 'group', (_b = {},
21
21
  _b[FormDefaults.cssClassPrefix + 'invalid'] = meta.error,
22
22
  _b[FormDefaults.cssClassPrefix + 'disabled'] = disabled,
23
- _b)) }, { children: [_jsx(FieldErrorScrollTarget, {}), meta.warning && (_jsx("div", __assign({ className: FormDefaults.cssClassPrefix + 'warning' }, { children: meta.warning }))), _jsx("label", __assign({ htmlFor: input.id }, { children: label })), children, meta.error && (_jsx("div", __assign({ className: FormDefaults.cssClassPrefix + 'error' }, { children: meta.error }))), helpText && (_jsx("div", __assign({ className: FormDefaults.cssClassPrefix + 'help' }, { children: helpText })))] })));
23
+ _b[FormDefaults.cssClassPrefix + 'required'] = required,
24
+ _b)) }, { children: [_jsx(FieldErrorScrollTarget, {}), meta.warning && (_jsx("div", __assign({ className: FormDefaults.cssClassPrefix + 'warning' }, { children: meta.warning }))), _jsx("label", __assign({ htmlFor: input.id }, { children: label })), children, meta.error && (_jsx("div", __assign({ id: "".concat(input.id, "-error"), className: FormDefaults.cssClassPrefix + 'error' }, { children: meta.error }))), helpText && (_jsx("div", __assign({ className: FormDefaults.cssClassPrefix + 'help' }, { children: helpText })))] })));
24
25
  }
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
2
  import { InputGroupProps } from './InputGroup';
3
- export interface IconInputGroupProps extends Omit<InputGroupProps<string | undefined>, 'onChange' | 'type' | 'value'> {
3
+ export interface IconInputGroupProps extends Omit<InputGroupProps<string | undefined | null>, 'onChange' | 'type' | 'value'> {
4
4
  type?: 'color' | 'email' | 'search' | 'tel' | 'text' | 'url';
5
+ /** Icon to display on the input group. */
5
6
  icon: React.ReactNode;
7
+ /** Text to display after the input group to give more information to the user. */
6
8
  helpText?: string;
7
9
  }
10
+ /** Input group with an icon. */
8
11
  declare const IconInputGroupWithRef: React.ComponentType<IconInputGroupProps>;
9
12
  export default IconInputGroupWithRef;
@@ -26,9 +26,10 @@ import classNames from 'classnames';
26
26
  import InputGroupWithRef from './InputGroup';
27
27
  import { FormDefaults } from '../FormDefaults';
28
28
  function IconInputGroup(_a, ref) {
29
+ var _b;
29
30
  var icon = _a.icon, className = _a.className, rest = __rest(_a, ["icon", "className"]);
30
31
  var input = rest.input;
31
- return (_jsx(_Fragment, { children: _jsx(InputGroupWithRef, __assign({ icon: icon, ref: ref, className: classNames(className, FormDefaults.cssClassPrefix + 'icon-input-group'), value: input.value || '', onChange: function (e) {
32
+ return (_jsx(_Fragment, { children: _jsx(InputGroupWithRef, __assign({ icon: icon, ref: ref, className: classNames(className, FormDefaults.cssClassPrefix + 'icon-input-group'), value: (_b = input.value) !== null && _b !== void 0 ? _b : '', onChange: function (e) {
32
33
  if (!e.target.value) {
33
34
  input.onChange(undefined);
34
35
  }
@@ -37,5 +38,6 @@ function IconInputGroup(_a, ref) {
37
38
  }
38
39
  } }, rest)) }));
39
40
  }
41
+ /** Input group with an icon. */
40
42
  var IconInputGroupWithRef = React.forwardRef(IconInputGroup);
41
43
  export default IconInputGroupWithRef;
@@ -1,12 +1,12 @@
1
1
  import React, { ChangeEventHandler, LegacyRef } from 'react';
2
2
  import { InjectedFieldProps } from '../Field/InjectedFieldProps';
3
3
  import { GroupProps } from '../Group';
4
- export interface InputGroupProps<TValue> extends InjectedFieldProps<TValue>, Omit<React.HTMLProps<HTMLInputElement>, keyof InjectedFieldProps<any> | 'children' | 'className' | 'label'>, Omit<GroupProps, keyof InjectedFieldProps<any> | 'children'> {
4
+ export interface InputGroupProps<TValue> extends InjectedFieldProps<TValue>, Omit<React.HTMLProps<HTMLInputElement>, keyof InjectedFieldProps<any> | 'children' | 'className' | 'label' | 'value'>, Omit<GroupProps, keyof InjectedFieldProps<any> | 'children'> {
5
5
  onChange: ChangeEventHandler<HTMLInputElement>;
6
- value: string | number;
6
+ value: string | number | null | undefined;
7
7
  icon?: React.ReactNode;
8
8
  }
9
- /** generic controlled <input/> wrapped by a Group */
10
- declare function InputGroup<TValue>({ input, meta, label, helpText, className, disabled, onChange, value, icon, ...rest }: InputGroupProps<TValue>, ref: LegacyRef<HTMLInputElement>): JSX.Element;
9
+ declare function InputGroup<TValue>({ input, meta, label, helpText, className, required, disabled, onChange, value, icon, ...rest }: InputGroupProps<TValue>, ref: LegacyRef<HTMLInputElement>): JSX.Element;
10
+ /** Generic controlled `<input/>` wrapped by a `<Group/>` */
11
11
  declare const InputGroupWithRef: typeof InputGroup;
12
12
  export default InputGroupWithRef;
@@ -23,12 +23,12 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import React from 'react';
25
25
  import classNames from 'classnames';
26
- import Group from '../Group';
27
26
  import { FormDefaults } from '../FormDefaults';
28
- /** generic controlled <input/> wrapped by a Group */
27
+ import Group from '../Group';
29
28
  function InputGroup(_a, ref) {
30
- var input = _a.input, meta = _a.meta, label = _a.label, helpText = _a.helpText, className = _a.className, disabled = _a.disabled, onChange = _a.onChange, value = _a.value, icon = _a.icon, rest = __rest(_a, ["input", "meta", "label", "helpText", "className", "disabled", "onChange", "value", "icon"]);
31
- return (_jsxs(Group, __assign({ input: input, meta: meta, disabled: disabled, label: label, helpText: helpText, className: classNames(className, FormDefaults.cssClassPrefix + 'input-group') }, { children: [icon, _jsx("input", __assign({}, input, rest, { value: value, onChange: onChange, ref: ref, className: classNames(className, FormDefaults.cssClassPrefix + 'input-group') }))] })));
29
+ var input = _a.input, meta = _a.meta, label = _a.label, helpText = _a.helpText, className = _a.className, required = _a.required, disabled = _a.disabled, onChange = _a.onChange, value = _a.value, icon = _a.icon, rest = __rest(_a, ["input", "meta", "label", "helpText", "className", "required", "disabled", "onChange", "value", "icon"]);
30
+ return (_jsxs(Group, __assign({ input: input, meta: meta, required: required, disabled: disabled, label: label, helpText: helpText, className: classNames(className, FormDefaults.cssClassPrefix + 'input-group') }, { children: [icon, _jsx("input", __assign({}, input, rest, { "aria-invalid": !!meta.error, "aria-errormessage": !!meta.error ? "".concat(input.name, "-error") : undefined, value: value !== null && value !== void 0 ? value : '', onChange: onChange, ref: ref, className: classNames(className, FormDefaults.cssClassPrefix + 'input-group') }))] })));
32
31
  }
32
+ /** Generic controlled `<input/>` wrapped by a `<Group/>` */
33
33
  var InputGroupWithRef = React.forwardRef(InputGroup);
34
34
  export default InputGroupWithRef;
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { InputGroupProps } from './InputGroup';
3
- export interface MoneyInputGroupProps extends Omit<InputGroupProps<number | undefined>, 'onChange' | 'type' | 'value'> {
3
+ export interface MoneyInputGroupProps extends Omit<InputGroupProps<number | undefined | null>, 'onChange' | 'type' | 'value'> {
4
+ /** Custom parsing function when the value changes. */
4
5
  parseFunc?: typeof parseInt | typeof parseFloat;
5
6
  }
7
+ /** Input group for inputting money. */
6
8
  declare const MoneyInputGroupWithRef: React.FunctionComponent<MoneyInputGroupProps>;
7
9
  export default MoneyInputGroupWithRef;
@@ -38,5 +38,6 @@ function MoneyInputGroup(_a, ref) {
38
38
  }
39
39
  } })));
40
40
  }
41
+ /** Input group for inputting money. */
41
42
  var MoneyInputGroupWithRef = React.forwardRef(MoneyInputGroup);
42
43
  export default MoneyInputGroupWithRef;
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { InputGroupProps } from './InputGroup';
3
- export interface NumberInputGroupProps extends Omit<InputGroupProps<number | undefined>, 'onChange' | 'type' | 'value'> {
3
+ export interface NumberInputGroupProps extends Omit<InputGroupProps<number | undefined | null>, 'onChange' | 'type' | 'value'> {
4
+ /** Custom parsing function when the value changes. */
4
5
  parseFunc?: typeof parseInt | typeof parseFloat;
5
6
  }
7
+ /** Standard number input group. By default allows for float values. */
6
8
  declare const NumberInputGroupWithRef: React.ComponentType<NumberInputGroupProps>;
7
9
  export default NumberInputGroupWithRef;
@@ -38,5 +38,6 @@ function NumberInputGroup(_a, ref) {
38
38
  }
39
39
  } })));
40
40
  }
41
+ /** Standard number input group. By default allows for float values. */
41
42
  var NumberInputGroupWithRef = React.forwardRef(NumberInputGroup);
42
43
  export default NumberInputGroupWithRef;
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { InputGroupProps } from './InputGroup';
3
- export interface StringInputGroupProps extends Omit<InputGroupProps<string | undefined>, 'onChange' | 'type' | 'value'> {
3
+ export interface StringInputGroupProps extends Omit<InputGroupProps<string | undefined | null>, 'onChange' | 'type' | 'value'> {
4
4
  type?: 'color' | 'email' | 'search' | 'tel' | 'text' | 'url' | 'password' | 'textarea';
5
5
  }
6
+ /** Standard string input group. */
6
7
  declare const StringInputGroupWithRef: React.ComponentType<StringInputGroupProps>;
7
8
  export default StringInputGroupWithRef;
@@ -26,9 +26,10 @@ import classNames from 'classnames';
26
26
  import InputGroup from './InputGroup';
27
27
  import { FormDefaults } from '../FormDefaults';
28
28
  function StringInputGroup(_a, ref) {
29
+ var _b;
29
30
  var className = _a.className, rest = __rest(_a, ["className"]);
30
31
  var input = rest.input;
31
- return (_jsx(InputGroup, __assign({ ref: ref }, rest, { className: classNames(className, FormDefaults.cssClassPrefix + 'string-group'), value: input.value || '', onChange: function (e) {
32
+ return (_jsx(InputGroup, __assign({ ref: ref }, rest, { className: classNames(className, FormDefaults.cssClassPrefix + 'string-group'), value: (_b = input.value) !== null && _b !== void 0 ? _b : '', onChange: function (e) {
32
33
  if (!e.target.value) {
33
34
  input.onChange(undefined);
34
35
  }
@@ -37,5 +38,6 @@ function StringInputGroup(_a, ref) {
37
38
  }
38
39
  } })));
39
40
  }
41
+ /** Standard string input group. */
40
42
  var StringInputGroupWithRef = React.forwardRef(StringInputGroup);
41
43
  export default StringInputGroupWithRef;
@@ -1,2 +1,4 @@
1
- export declare const phoneNumber: (value: string | undefined) => string | undefined;
2
- export declare const zipCode: (value: string | undefined) => string | undefined;
1
+ /** Normalizer for converting a string into a valid phone number. */
2
+ export declare const phoneNumber: (value: string | undefined | null) => string | undefined;
3
+ /** Normalizer for converting a string into a valid zip code. Allows for XXXXX and XXXXX-XXXX format. */
4
+ export declare const zipCode: (value: string | undefined | null) => string | undefined;
@@ -1,3 +1,4 @@
1
+ /** Normalizer for converting a string into a valid phone number. */
1
2
  export var phoneNumber = function (value) {
2
3
  if (!value) {
3
4
  return undefined;
@@ -18,6 +19,7 @@ export var phoneNumber = function (value) {
18
19
  }
19
20
  return onlyNums;
20
21
  };
22
+ /** Normalizer for converting a string into a valid zip code. Allows for XXXXX and XXXXX-XXXX format. */
21
23
  export var zipCode = function (value) {
22
24
  if (!value) {
23
25
  return undefined;
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { SelectOption } from './SelectGroup';
3
3
  import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
4
- export interface BooleanSelectGroupProps extends Omit<SelectGroupPropsHelper<boolean>, 'options'> {
4
+ export interface BooleanSelectGroupProps extends Omit<SelectGroupPropsHelper<boolean | undefined | null>, 'options'> {
5
5
  options?: SelectOption<boolean>[];
6
6
  }
7
+ /** A `<SelectGroup/>` dropdown with two options. Default options are 'Yes' and 'No' with values of `true` and `false`. */
7
8
  export declare function BooleanSelectGroup(props: BooleanSelectGroupProps): JSX.Element;
@@ -21,6 +21,7 @@ var booleanOptions = [
21
21
  value: false,
22
22
  },
23
23
  ];
24
+ /** A `<SelectGroup/>` dropdown with two options. Default options are 'Yes' and 'No' with values of `true` and `false`. */
24
25
  export function BooleanSelectGroup(props) {
25
26
  var _a;
26
27
  return (_jsx(SelectGroup, __assign({ multiple: false }, props, { options: (_a = props.options) !== null && _a !== void 0 ? _a : booleanOptions })));
@@ -1,8 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
3
- export interface MultiNumberSelectGroupProps extends SelectGroupPropsHelper<number[]> {
3
+ export interface MultiNumberSelectGroupProps extends SelectGroupPropsHelper<number[] | undefined | null> {
4
4
  }
5
+ /** A `<SelectGroup/>` dropdown with values as numbers. Many options can be selected at a time. */
5
6
  export declare function MultiNumberSelectGroup(props: MultiNumberSelectGroupProps): JSX.Element;
6
- export interface SingleNumberSelectGroupProps extends SelectGroupPropsHelper<number> {
7
+ export interface SingleNumberSelectGroupProps extends SelectGroupPropsHelper<number | undefined | null> {
7
8
  }
9
+ /** A `<SelectGroup/>` dropdown with values as numbers. Only one option can be selected at a time. */
8
10
  export declare function SingleNumberSelectGroup(props: SingleNumberSelectGroupProps): JSX.Element;
@@ -11,9 +11,11 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import SelectGroup from './SelectGroup';
14
+ /** A `<SelectGroup/>` dropdown with values as numbers. Many options can be selected at a time. */
14
15
  export function MultiNumberSelectGroup(props) {
15
16
  return _jsx(SelectGroup, __assign({ multiple: true }, props));
16
17
  }
18
+ /** A `<SelectGroup/>` dropdown with values as numbers. Only one option can be selected at a time. */
17
19
  export function SingleNumberSelectGroup(props) {
18
20
  return _jsx(SelectGroup, __assign({ multiple: false }, props));
19
21
  }
@@ -2,7 +2,9 @@
2
2
  import { InjectedFieldProps } from '../Field/InjectedFieldProps';
3
3
  import { GroupProps } from '../Group';
4
4
  export interface SelectOption<TValue> {
5
+ /** Value for the select. This will be sent to the API. */
5
6
  value: (TValue extends Array<infer P> ? P : TValue) | undefined;
7
+ /** Label for the select. This is displayed to the user. */
6
8
  label: string;
7
9
  }
8
10
  interface OptionsApiResult<TValue> {
@@ -13,10 +15,14 @@ interface OptionsUseServiceResult<TValue> {
13
15
  resp?: Partial<SelectOption<TValue>>[] | OptionsApiResult<TValue> | null;
14
16
  error?: any;
15
17
  }
16
- export interface SelectGroupProps<TValue> extends InjectedFieldProps<TValue | undefined>, Omit<GroupProps, 'input' | 'meta' | 'children'> {
18
+ export interface SelectGroupProps<TValue> extends InjectedFieldProps<TValue | undefined | null>, Omit<GroupProps, 'input' | 'meta' | 'children'> {
19
+ /** Options for the dropdown. Includes the label and value. */
17
20
  options: SelectOption<TValue>[] | OptionsUseServiceResult<TValue>;
21
+ /** Whether the user should be able to have multiple values selected. */
18
22
  multiple: TValue extends Array<any> ? true : false;
23
+ /** Text diplayed when no value is selected. */
19
24
  placeholder?: string;
20
25
  }
21
- export default function SelectGroup<TValue>({ input, meta, className, options, multiple, placeholder, ...rest }: SelectGroupProps<TValue>): JSX.Element;
26
+ /** Generic select dropdown. Uses [react-select](https://react-select.com/home). */
27
+ export default function SelectGroup<TValue>({ input, meta, className, required, disabled, options, multiple, placeholder, ...rest }: SelectGroupProps<TValue>): JSX.Element;
22
28
  export {};
@@ -23,12 +23,13 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import { default as ReactSelect } from 'react-select';
25
25
  import classNames from 'classnames';
26
- import Group from '../Group';
27
26
  import { FormDefaults } from '../FormDefaults';
27
+ import Group from '../Group';
28
28
  // TODO: we could also name this "ReactSelectGroup" or similar but the types are strongly defined now so kept the names consistent
29
+ /** Generic select dropdown. Uses [react-select](https://react-select.com/home). */
29
30
  export default function SelectGroup(_a) {
30
31
  var _b;
31
- var input = _a.input, meta = _a.meta, className = _a.className, options = _a.options, multiple = _a.multiple, placeholder = _a.placeholder, rest = __rest(_a, ["input", "meta", "className", "options", "multiple", "placeholder"]);
32
+ var input = _a.input, meta = _a.meta, className = _a.className, required = _a.required, disabled = _a.disabled, options = _a.options, multiple = _a.multiple, placeholder = _a.placeholder, rest = __rest(_a, ["input", "meta", "className", "required", "disabled", "options", "multiple", "placeholder"]);
32
33
  var effectiveOptions = !options
33
34
  ? []
34
35
  : Array.isArray(options)
@@ -42,10 +43,10 @@ export default function SelectGroup(_a) {
42
43
  ? options.resp
43
44
  : [];
44
45
  var isLoading = (options && 'loading' in options && options.loading) || false;
45
- return (_jsx(Group, __assign({}, rest, { input: input, meta: meta, className: classNames(className, (_b = {},
46
+ return (_jsx(Group, __assign({}, rest, { input: input, meta: meta, required: required, disabled: disabled, className: classNames(className, (_b = {},
46
47
  _b[FormDefaults.cssClassPrefix + 'multiple'] = multiple,
47
48
  _b[FormDefaults.cssClassPrefix + 'loading'] = isLoading,
48
- _b), FormDefaults.cssClassPrefix + 'select-group') }, { children: _jsx(ReactSelect, { inputId: input.id, isMulti: multiple, options: effectiveOptions, onBlur: input.onBlur, value: getValue(), onChange: function (e) {
49
+ _b), FormDefaults.cssClassPrefix + 'select-group') }, { children: _jsx(ReactSelect, { inputId: input.id, isMulti: multiple, isDisabled: disabled, options: effectiveOptions, onBlur: input.onBlur, value: getValue(), onChange: function (e) {
49
50
  if (multiple === true) {
50
51
  input.onChange(e === null || e === void 0 ? void 0 : e.map(function (x) { return x.value; }));
51
52
  }
@@ -2,7 +2,9 @@
2
2
  import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
3
3
  export interface MultiStringSelectGroupProps extends SelectGroupPropsHelper<string[]> {
4
4
  }
5
+ /** A `<SelectGroup/>` dropdown with values as strings. Multiple options can be selected at a time. */
5
6
  export declare function MultiStringSelectGroup(props: MultiStringSelectGroupProps): JSX.Element;
6
7
  export interface SingleStringSelectGroupProps extends SelectGroupPropsHelper<string> {
7
8
  }
9
+ /** A `<SelectGroup/>` dropdown with the value as a string. Only one option can be selected at a time. */
8
10
  export declare function SingleStringSelectGroup(props: SingleStringSelectGroupProps): JSX.Element;
@@ -11,9 +11,11 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import SelectGroup from './SelectGroup';
14
+ /** A `<SelectGroup/>` dropdown with values as strings. Multiple options can be selected at a time. */
14
15
  export function MultiStringSelectGroup(props) {
15
16
  return _jsx(SelectGroup, __assign({ multiple: true }, props));
16
17
  }
18
+ /** A `<SelectGroup/>` dropdown with the value as a string. Only one option can be selected at a time. */
17
19
  export function SingleStringSelectGroup(props) {
18
20
  return _jsx(SelectGroup, __assign({ multiple: false }, props));
19
21
  }
@@ -1,6 +1,11 @@
1
1
  import { MouseEventHandler } from 'react';
2
2
  export interface StandardFormActionsProps {
3
+ /** Allow the form to be submitted without any changes. By default this is not allowed. */
3
4
  allowPristineSubmit?: boolean;
5
+ /** The cancel button's `onClick`.
6
+ * @defaultValue `window.history.back()`
7
+ */
4
8
  handleCancel?: MouseEventHandler<HTMLButtonElement>;
5
9
  }
10
+ /** Standard submit and cancel buttons. */
6
11
  export default function StandardFormActions({ allowPristineSubmit, handleCancel, }: StandardFormActionsProps): JSX.Element;
@@ -14,6 +14,7 @@ import classNames from 'classnames';
14
14
  import { useFormikContext } from 'formik';
15
15
  import SubmitFormButton from './SubmitFormButton';
16
16
  import { FormDefaults } from './FormDefaults';
17
+ /** Standard submit and cancel buttons. */
17
18
  export default function StandardFormActions(_a) {
18
19
  var allowPristineSubmit = _a.allowPristineSubmit, handleCancel = _a.handleCancel;
19
20
  var isSubmitting = useFormikContext().isSubmitting;