envoc-form 5.0.9 → 6.0.1-1

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 (352) hide show
  1. package/README.md +4930 -1645
  2. package/dist/index.cjs +25531 -0
  3. package/dist/index.d.ts +624 -0
  4. package/dist/index.js +25461 -0
  5. package/package.json +73 -77
  6. package/dist/css/envoc-form-styles.css +0 -3
  7. package/dist/css/envoc-form-styles.css.map +0 -1
  8. package/es/AddressInput/AddressInput.d.ts +0 -24
  9. package/es/AddressInput/AddressInput.js +0 -20
  10. package/es/AddressInput/UsStates.d.ts +0 -3
  11. package/es/AddressInput/UsStates.js +0 -53
  12. package/es/ConfirmBaseForm/ConfirmBaseForm.d.ts +0 -26
  13. package/es/ConfirmBaseForm/ConfirmBaseForm.js +0 -42
  14. package/es/ConfirmDeleteForm/ConfirmDeleteForm.d.ts +0 -24
  15. package/es/ConfirmDeleteForm/ConfirmDeleteForm.js +0 -60
  16. package/es/DatePicker/DatePickerGroup.d.ts +0 -13
  17. package/es/DatePicker/DatePickerGroup.js +0 -88
  18. package/es/DatePicker/DatePickerHelper.d.ts +0 -3
  19. package/es/DatePicker/DatePickerHelper.js +0 -1
  20. package/es/DatePicker/StringDateOnlyPickerGroup.d.ts +0 -9
  21. package/es/DatePicker/StringDateOnlyPickerGroup.js +0 -29
  22. package/es/DatePicker/StringDatePickerGroup.d.ts +0 -9
  23. package/es/DatePicker/StringDatePickerGroup.js +0 -24
  24. package/es/DateTimePicker/DateTimePickerGroup.d.ts +0 -12
  25. package/es/DateTimePicker/DateTimePickerGroup.js +0 -87
  26. package/es/DateTimePicker/DateTimePickerHelper.d.ts +0 -3
  27. package/es/DateTimePicker/DateTimePickerHelper.js +0 -1
  28. package/es/DateTimePicker/StringDateTimePickerGroup.d.ts +0 -9
  29. package/es/DateTimePicker/StringDateTimePickerGroup.js +0 -53
  30. package/es/Field/CustomFieldInputProps.d.ts +0 -7
  31. package/es/Field/CustomFieldInputProps.js +0 -1
  32. package/es/Field/CustomFieldMetaProps.d.ts +0 -4
  33. package/es/Field/CustomFieldMetaProps.js +0 -1
  34. package/es/Field/Field.d.ts +0 -29
  35. package/es/Field/Field.js +0 -59
  36. package/es/Field/FieldErrorScrollTarget.d.ts +0 -2
  37. package/es/Field/FieldErrorScrollTarget.js +0 -12
  38. package/es/Field/FieldNameContext.d.ts +0 -3
  39. package/es/Field/FieldNameContext.js +0 -3
  40. package/es/Field/FieldSection.d.ts +0 -7
  41. package/es/Field/FieldSection.js +0 -9
  42. package/es/Field/InjectedFieldProps.d.ts +0 -7
  43. package/es/Field/InjectedFieldProps.js +0 -1
  44. package/es/Field/StandAloneInput.d.ts +0 -13
  45. package/es/Field/StandAloneInput.js +0 -50
  46. package/es/Field/useStandardField.d.ts +0 -21
  47. package/es/Field/useStandardField.js +0 -92
  48. package/es/FieldArray/FieldArray.d.ts +0 -24
  49. package/es/FieldArray/FieldArray.js +0 -77
  50. package/es/File/FileGroup.d.ts +0 -10
  51. package/es/File/FileGroup.js +0 -53
  52. package/es/File/FileList.d.ts +0 -5
  53. package/es/File/FileList.js +0 -10
  54. package/es/File/humanFileSize.d.ts +0 -1
  55. package/es/File/humanFileSize.js +0 -6
  56. package/es/Form/FocusError.d.ts +0 -7
  57. package/es/Form/FocusError.js +0 -42
  58. package/es/Form/Form.d.ts +0 -33
  59. package/es/Form/Form.js +0 -141
  60. package/es/Form/FormBasedPreventNavigation.d.ts +0 -6
  61. package/es/Form/FormBasedPreventNavigation.js +0 -20
  62. package/es/Form/LegacyFormBasedPreventNavigation.d.ts +0 -17
  63. package/es/Form/LegacyFormBasedPreventNavigation.js +0 -69
  64. package/es/Form/NewFormBasedPreventNavigation.d.ts +0 -14
  65. package/es/Form/NewFormBasedPreventNavigation.js +0 -39
  66. package/es/Form/ServerErrorContext.d.ts +0 -11
  67. package/es/Form/ServerErrorContext.js +0 -9
  68. package/es/FormActions.d.ts +0 -12
  69. package/es/FormActions.js +0 -16
  70. package/es/FormDefaults.d.ts +0 -4
  71. package/es/FormDefaults.js +0 -2
  72. package/es/Group.d.ts +0 -16
  73. package/es/Group.js +0 -14
  74. package/es/Input/CheckboxGroup.d.ts +0 -6
  75. package/es/Input/CheckboxGroup.js +0 -14
  76. package/es/Input/CheckboxInputGroup.d.ts +0 -13
  77. package/es/Input/CheckboxInputGroup.js +0 -41
  78. package/es/Input/IconInputGroup.d.ts +0 -12
  79. package/es/Input/IconInputGroup.js +0 -43
  80. package/es/Input/InputGroup.d.ts +0 -12
  81. package/es/Input/InputGroup.js +0 -34
  82. package/es/Input/MoneyInputGroup.d.ts +0 -9
  83. package/es/Input/MoneyInputGroup.js +0 -43
  84. package/es/Input/NumberInputGroup.d.ts +0 -9
  85. package/es/Input/NumberInputGroup.js +0 -43
  86. package/es/Input/PhoneNumberInputGroup.d.ts +0 -10
  87. package/es/Input/PhoneNumberInputGroup.js +0 -47
  88. package/es/Input/StringInputGroup.d.ts +0 -8
  89. package/es/Input/StringInputGroup.js +0 -43
  90. package/es/Normalization/NormalizationFunction.d.ts +0 -4
  91. package/es/Normalization/NormalizationFunction.js +0 -1
  92. package/es/Normalization/normalizers.d.ts +0 -4
  93. package/es/Normalization/normalizers.js +0 -32
  94. package/es/Select/BooleanSelectGroup.d.ts +0 -7
  95. package/es/Select/BooleanSelectGroup.js +0 -28
  96. package/es/Select/NumberSelectGroup.d.ts +0 -9
  97. package/es/Select/NumberSelectGroup.js +0 -21
  98. package/es/Select/SelectGroup.d.ts +0 -29
  99. package/es/Select/SelectGroup.js +0 -65
  100. package/es/Select/SelectGroupPropsHelper.d.ts +0 -3
  101. package/es/Select/SelectGroupPropsHelper.js +0 -1
  102. package/es/Select/StringSelectGroup.d.ts +0 -9
  103. package/es/Select/StringSelectGroup.js +0 -21
  104. package/es/StandardFormActions.d.ts +0 -11
  105. package/es/StandardFormActions.js +0 -14
  106. package/es/SubmitFormButton.d.ts +0 -10
  107. package/es/SubmitFormButton.js +0 -40
  108. package/es/TextArea/TextAreaGroup.d.ts +0 -9
  109. package/es/TextArea/TextAreaGroup.js +0 -35
  110. package/es/Validation/ValidatedApiResult.d.ts +0 -6
  111. package/es/Validation/ValidatedApiResult.js +0 -1
  112. package/es/Validation/ValidationError.d.ts +0 -5
  113. package/es/Validation/ValidationError.js +0 -1
  114. package/es/Validation/ValidationFunction.d.ts +0 -4
  115. package/es/Validation/ValidationFunction.js +0 -1
  116. package/es/Validation/validators.d.ts +0 -18
  117. package/es/Validation/validators.js +0 -77
  118. package/es/index.d.ts +0 -81
  119. package/es/index.js +0 -55
  120. package/es/setupTests.d.ts +0 -1
  121. package/es/setupTests.js +0 -1
  122. package/es/utils/objectContainsNonSerializableProperty.d.ts +0 -1
  123. package/es/utils/objectContainsNonSerializableProperty.js +0 -14
  124. package/es/utils/objectToFormData.d.ts +0 -10
  125. package/es/utils/objectToFormData.js +0 -77
  126. package/es/utils/typeChecks.d.ts +0 -8
  127. package/es/utils/typeChecks.js +0 -18
  128. package/lib/AddressInput/AddressInput.d.ts +0 -24
  129. package/lib/AddressInput/AddressInput.js +0 -26
  130. package/lib/AddressInput/UsStates.d.ts +0 -3
  131. package/lib/AddressInput/UsStates.js +0 -55
  132. package/lib/ConfirmBaseForm/ConfirmBaseForm.d.ts +0 -26
  133. package/lib/ConfirmBaseForm/ConfirmBaseForm.js +0 -45
  134. package/lib/ConfirmDeleteForm/ConfirmDeleteForm.d.ts +0 -24
  135. package/lib/ConfirmDeleteForm/ConfirmDeleteForm.js +0 -66
  136. package/lib/DatePicker/DatePickerGroup.d.ts +0 -13
  137. package/lib/DatePicker/DatePickerGroup.js +0 -96
  138. package/lib/DatePicker/DatePickerHelper.d.ts +0 -3
  139. package/lib/DatePicker/DatePickerHelper.js +0 -2
  140. package/lib/DatePicker/StringDateOnlyPickerGroup.d.ts +0 -9
  141. package/lib/DatePicker/StringDateOnlyPickerGroup.js +0 -35
  142. package/lib/DatePicker/StringDatePickerGroup.d.ts +0 -9
  143. package/lib/DatePicker/StringDatePickerGroup.js +0 -30
  144. package/lib/DateTimePicker/DateTimePickerGroup.d.ts +0 -12
  145. package/lib/DateTimePicker/DateTimePickerGroup.js +0 -93
  146. package/lib/DateTimePicker/DateTimePickerHelper.d.ts +0 -3
  147. package/lib/DateTimePicker/DateTimePickerHelper.js +0 -2
  148. package/lib/DateTimePicker/StringDateTimePickerGroup.d.ts +0 -9
  149. package/lib/DateTimePicker/StringDateTimePickerGroup.js +0 -59
  150. package/lib/Field/CustomFieldInputProps.d.ts +0 -7
  151. package/lib/Field/CustomFieldInputProps.js +0 -2
  152. package/lib/Field/CustomFieldMetaProps.d.ts +0 -4
  153. package/lib/Field/CustomFieldMetaProps.js +0 -2
  154. package/lib/Field/Field.d.ts +0 -29
  155. package/lib/Field/Field.js +0 -64
  156. package/lib/Field/FieldErrorScrollTarget.d.ts +0 -2
  157. package/lib/Field/FieldErrorScrollTarget.js +0 -15
  158. package/lib/Field/FieldNameContext.d.ts +0 -3
  159. package/lib/Field/FieldNameContext.js +0 -9
  160. package/lib/Field/FieldSection.d.ts +0 -7
  161. package/lib/Field/FieldSection.js +0 -12
  162. package/lib/Field/InjectedFieldProps.d.ts +0 -7
  163. package/lib/Field/InjectedFieldProps.js +0 -2
  164. package/lib/Field/StandAloneInput.d.ts +0 -13
  165. package/lib/Field/StandAloneInput.js +0 -76
  166. package/lib/Field/useStandardField.d.ts +0 -21
  167. package/lib/Field/useStandardField.js +0 -95
  168. package/lib/FieldArray/FieldArray.d.ts +0 -24
  169. package/lib/FieldArray/FieldArray.js +0 -83
  170. package/lib/File/FileGroup.d.ts +0 -10
  171. package/lib/File/FileGroup.js +0 -58
  172. package/lib/File/FileList.d.ts +0 -5
  173. package/lib/File/FileList.js +0 -13
  174. package/lib/File/humanFileSize.d.ts +0 -1
  175. package/lib/File/humanFileSize.js +0 -10
  176. package/lib/Form/FocusError.d.ts +0 -7
  177. package/lib/Form/FocusError.js +0 -48
  178. package/lib/Form/Form.d.ts +0 -33
  179. package/lib/Form/Form.js +0 -147
  180. package/lib/Form/FormBasedPreventNavigation.d.ts +0 -6
  181. package/lib/Form/FormBasedPreventNavigation.js +0 -26
  182. package/lib/Form/LegacyFormBasedPreventNavigation.d.ts +0 -17
  183. package/lib/Form/LegacyFormBasedPreventNavigation.js +0 -72
  184. package/lib/Form/NewFormBasedPreventNavigation.d.ts +0 -14
  185. package/lib/Form/NewFormBasedPreventNavigation.js +0 -42
  186. package/lib/Form/ServerErrorContext.d.ts +0 -11
  187. package/lib/Form/ServerErrorContext.js +0 -15
  188. package/lib/FormActions.d.ts +0 -12
  189. package/lib/FormActions.js +0 -22
  190. package/lib/FormDefaults.d.ts +0 -4
  191. package/lib/FormDefaults.js +0 -5
  192. package/lib/Group.d.ts +0 -16
  193. package/lib/Group.js +0 -20
  194. package/lib/Input/CheckboxGroup.d.ts +0 -6
  195. package/lib/Input/CheckboxGroup.js +0 -20
  196. package/lib/Input/CheckboxInputGroup.d.ts +0 -13
  197. package/lib/Input/CheckboxInputGroup.js +0 -46
  198. package/lib/Input/IconInputGroup.d.ts +0 -12
  199. package/lib/Input/IconInputGroup.js +0 -48
  200. package/lib/Input/InputGroup.d.ts +0 -12
  201. package/lib/Input/InputGroup.js +0 -39
  202. package/lib/Input/MoneyInputGroup.d.ts +0 -9
  203. package/lib/Input/MoneyInputGroup.js +0 -48
  204. package/lib/Input/NumberInputGroup.d.ts +0 -9
  205. package/lib/Input/NumberInputGroup.js +0 -48
  206. package/lib/Input/PhoneNumberInputGroup.d.ts +0 -10
  207. package/lib/Input/PhoneNumberInputGroup.js +0 -52
  208. package/lib/Input/StringInputGroup.d.ts +0 -8
  209. package/lib/Input/StringInputGroup.js +0 -48
  210. package/lib/Normalization/NormalizationFunction.d.ts +0 -4
  211. package/lib/Normalization/NormalizationFunction.js +0 -2
  212. package/lib/Normalization/normalizers.d.ts +0 -4
  213. package/lib/Normalization/normalizers.js +0 -37
  214. package/lib/Select/BooleanSelectGroup.d.ts +0 -7
  215. package/lib/Select/BooleanSelectGroup.js +0 -35
  216. package/lib/Select/NumberSelectGroup.d.ts +0 -9
  217. package/lib/Select/NumberSelectGroup.js +0 -29
  218. package/lib/Select/SelectGroup.d.ts +0 -29
  219. package/lib/Select/SelectGroup.js +0 -71
  220. package/lib/Select/SelectGroupPropsHelper.d.ts +0 -3
  221. package/lib/Select/SelectGroupPropsHelper.js +0 -2
  222. package/lib/Select/StringSelectGroup.d.ts +0 -9
  223. package/lib/Select/StringSelectGroup.js +0 -29
  224. package/lib/StandardFormActions.d.ts +0 -11
  225. package/lib/StandardFormActions.js +0 -20
  226. package/lib/SubmitFormButton.d.ts +0 -10
  227. package/lib/SubmitFormButton.js +0 -45
  228. package/lib/TextArea/TextAreaGroup.d.ts +0 -9
  229. package/lib/TextArea/TextAreaGroup.js +0 -40
  230. package/lib/Validation/ValidatedApiResult.d.ts +0 -6
  231. package/lib/Validation/ValidatedApiResult.js +0 -2
  232. package/lib/Validation/ValidationError.d.ts +0 -5
  233. package/lib/Validation/ValidationError.js +0 -2
  234. package/lib/Validation/ValidationFunction.d.ts +0 -4
  235. package/lib/Validation/ValidationFunction.js +0 -2
  236. package/lib/Validation/validators.d.ts +0 -18
  237. package/lib/Validation/validators.js +0 -90
  238. package/lib/index.d.ts +0 -81
  239. package/lib/index.js +0 -126
  240. package/lib/setupTests.d.ts +0 -1
  241. package/lib/setupTests.js +0 -3
  242. package/lib/utils/objectContainsNonSerializableProperty.d.ts +0 -1
  243. package/lib/utils/objectContainsNonSerializableProperty.js +0 -17
  244. package/lib/utils/objectToFormData.d.ts +0 -10
  245. package/lib/utils/objectToFormData.js +0 -79
  246. package/lib/utils/typeChecks.d.ts +0 -8
  247. package/lib/utils/typeChecks.js +0 -29
  248. package/src/AddressInput/AddressInput.test.tsx +0 -27
  249. package/src/AddressInput/AddressInput.tsx +0 -82
  250. package/src/AddressInput/UsStates.ts +0 -55
  251. package/src/AddressInput/__snapshots__/AddressInput.test.tsx.snap +0 -183
  252. package/src/ConfirmBaseForm/ConfirmBaseForm.test.tsx +0 -24
  253. package/src/ConfirmBaseForm/ConfirmBaseForm.tsx +0 -74
  254. package/src/ConfirmBaseForm/__snapshots__/ConfirmBaseForm.test.tsx.snap +0 -23
  255. package/src/ConfirmDeleteForm/ConfirmDeleteForm.test.tsx +0 -24
  256. package/src/ConfirmDeleteForm/ConfirmDeleteForm.tsx +0 -87
  257. package/src/ConfirmDeleteForm/__snapshots__/ConfirmDeleteForm.test.tsx.snap +0 -25
  258. package/src/DatePicker/DatePicker.test.tsx +0 -48
  259. package/src/DatePicker/DatePickerGroup.tsx +0 -115
  260. package/src/DatePicker/DatePickerHelper.ts +0 -4
  261. package/src/DatePicker/StringDateOnlyPickerGroup.tsx +0 -28
  262. package/src/DatePicker/StringDatePickerGroup.tsx +0 -20
  263. package/src/DatePicker/__snapshots__/DatePicker.test.tsx.snap +0 -152
  264. package/src/DateTimePicker/DateTimePicker.test.tsx +0 -243
  265. package/src/DateTimePicker/DateTimePickerGroup.tsx +0 -116
  266. package/src/DateTimePicker/DateTimePickerHelper.ts +0 -4
  267. package/src/DateTimePicker/StringDateTimePickerGroup.tsx +0 -61
  268. package/src/DateTimePicker/__snapshots__/DateTimePicker.test.tsx.snap +0 -217
  269. package/src/Field/CustomFieldInputProps.ts +0 -10
  270. package/src/Field/CustomFieldMetaProps.ts +0 -5
  271. package/src/Field/Field.tsx +0 -127
  272. package/src/Field/FieldErrorScrollTarget.tsx +0 -12
  273. package/src/Field/FieldNameContext.ts +0 -6
  274. package/src/Field/FieldSection.tsx +0 -18
  275. package/src/Field/InjectedFieldProps.ts +0 -8
  276. package/src/Field/StandAloneInput.tsx +0 -55
  277. package/src/Field/useStandardField.ts +0 -125
  278. package/src/FieldArray/FieldArray.tsx +0 -154
  279. package/src/File/FileGroup.test.tsx +0 -35
  280. package/src/File/FileGroup.tsx +0 -82
  281. package/src/File/FileList.tsx +0 -21
  282. package/src/File/__snapshots__/FileGroup.test.tsx.snap +0 -34
  283. package/src/File/humanFileSize.ts +0 -8
  284. package/src/Form/FocusError.tsx +0 -55
  285. package/src/Form/Form.test.tsx +0 -14
  286. package/src/Form/Form.tsx +0 -234
  287. package/src/Form/FormBasedPreventNavigation.tsx +0 -56
  288. package/src/Form/LegacyFormBasedPreventNavigation.tsx +0 -77
  289. package/src/Form/NewFormBasedPreventNavigation.tsx +0 -59
  290. package/src/Form/ServerErrorContext.ts +0 -18
  291. package/src/Form/__snapshots__/Form.test.tsx.snap +0 -10
  292. package/src/FormActions.tsx +0 -47
  293. package/src/FormDefaults.ts +0 -2
  294. package/src/Group.tsx +0 -62
  295. package/src/Input/CheckboxGroup.tsx +0 -60
  296. package/src/Input/CheckboxInputGroup.tsx +0 -78
  297. package/src/Input/IconInputGroup.tsx +0 -54
  298. package/src/Input/InputGroup.tsx +0 -69
  299. package/src/Input/MoneyInputGroup.tsx +0 -47
  300. package/src/Input/NumberInputGroup.tsx +0 -45
  301. package/src/Input/PhoneNumberInputGroup.tsx +0 -45
  302. package/src/Input/StringInputGroup.tsx +0 -50
  303. package/src/Input/__Tests__/CheckboxInputGroup.test.tsx +0 -26
  304. package/src/Input/__Tests__/IconInputGroup.test.tsx +0 -35
  305. package/src/Input/__Tests__/MoneyInputGroup.test.tsx +0 -37
  306. package/src/Input/__Tests__/NumberInputGroup.test.tsx +0 -35
  307. package/src/Input/__Tests__/PhoneNumberInputGroup.test.tsx +0 -36
  308. package/src/Input/__Tests__/StringInputGroup.test.tsx +0 -27
  309. package/src/Input/__Tests__/__snapshots__/CheckboxInputGroup.test.tsx.snap +0 -33
  310. package/src/Input/__Tests__/__snapshots__/IconInputGroup.test.tsx.snap +0 -32
  311. package/src/Input/__Tests__/__snapshots__/MoneyInputGroup.test.tsx.snap +0 -34
  312. package/src/Input/__Tests__/__snapshots__/NumberInputGroup.test.tsx.snap +0 -32
  313. package/src/Input/__Tests__/__snapshots__/PhoneNumberInputGroup.test.tsx.snap +0 -33
  314. package/src/Input/__Tests__/__snapshots__/StringInputGroup.test.tsx.snap +0 -31
  315. package/src/Normalization/NormalizationFunction.ts +0 -4
  316. package/src/Normalization/normalizers.ts +0 -44
  317. package/src/Select/BooleanSelectGroup.tsx +0 -28
  318. package/src/Select/NumberSelectGroup.tsx +0 -16
  319. package/src/Select/SelectGroup.tsx +0 -132
  320. package/src/Select/SelectGroupPropsHelper.ts +0 -4
  321. package/src/Select/StringSelectGroup.tsx +0 -16
  322. package/src/Select/__tests__/BooleanSelectGroup.test.tsx +0 -35
  323. package/src/Select/__tests__/NumberSelectGroup.test.tsx +0 -87
  324. package/src/Select/__tests__/StringSelectGroup.test.tsx +0 -89
  325. package/src/Select/__tests__/__snapshots__/BooleanSelectGroup.test.tsx.snap +0 -99
  326. package/src/Select/__tests__/__snapshots__/NumberSelectGroup.test.tsx.snap +0 -197
  327. package/src/Select/__tests__/__snapshots__/StringSelectGroup.test.tsx.snap +0 -197
  328. package/src/StandardFormActions.tsx +0 -41
  329. package/src/SubmitFormButton.tsx +0 -54
  330. package/src/TextArea/TextAreaGroup.tsx +0 -64
  331. package/src/Validation/ValidatedApiResult.ts +0 -8
  332. package/src/Validation/ValidationError.ts +0 -6
  333. package/src/Validation/ValidationFunction.ts +0 -4
  334. package/src/Validation/validators.test.tsx +0 -81
  335. package/src/Validation/validators.ts +0 -97
  336. package/src/__Tests__/FormTestBase.tsx +0 -66
  337. package/src/__Tests__/RealisticForm.test.tsx +0 -82
  338. package/src/__Tests__/StandardFormActions.test.tsx +0 -17
  339. package/src/__Tests__/SubmitFormButton.test.tsx +0 -17
  340. package/src/__Tests__/__snapshots__/StandardFormActions.test.tsx.snap +0 -27
  341. package/src/__Tests__/__snapshots__/SubmitFormButton.test.tsx.snap +0 -20
  342. package/src/__Tests__/index.ts +0 -3
  343. package/src/_variables.scss +0 -11
  344. package/src/index.ts +0 -163
  345. package/src/react-app-env.d.ts +0 -1
  346. package/src/setupTests.ts +0 -1
  347. package/src/styles.scss +0 -0
  348. package/src/utils/objectContainsNonSerializableProperty.test.tsx +0 -49
  349. package/src/utils/objectContainsNonSerializableProperty.ts +0 -17
  350. package/src/utils/objectToFormData.test.tsx +0 -76
  351. package/src/utils/objectToFormData.ts +0 -105
  352. package/src/utils/typeChecks.ts +0 -18
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFile = exports.isBlob = exports.isDate = exports.isArray = exports.isObject = exports.isBoolean = exports.isNull = exports.isUndefined = void 0;
4
- var isUndefined = function (value) { return value === undefined; };
5
- exports.isUndefined = isUndefined;
6
- var isNull = function (value) { return value === null; };
7
- exports.isNull = isNull;
8
- var isBoolean = function (value) { return typeof value === 'boolean'; };
9
- exports.isBoolean = isBoolean;
10
- var isObject = function (value) { return value === Object(value); };
11
- exports.isObject = isObject;
12
- var isArray = function (value) { return Array.isArray(value); };
13
- exports.isArray = isArray;
14
- var isDate = function (value) { return value instanceof Date; };
15
- exports.isDate = isDate;
16
- var isBlob = function (value) {
17
- return value &&
18
- typeof value.size === 'number' &&
19
- typeof value.type === 'string' &&
20
- typeof value.slice === 'function';
21
- };
22
- exports.isBlob = isBlob;
23
- var isFile = function (value) {
24
- return (0, exports.isBlob)(value) &&
25
- typeof value.name === 'string' &&
26
- (typeof value.lastModifiedDate === 'object' ||
27
- typeof value.lastModified === 'number');
28
- };
29
- exports.isFile = isFile;
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import AddressInput from './AddressInput';
4
- import FormTestBase from '../__Tests__/FormTestBase';
5
-
6
- describe('AddressInput', () => {
7
- it('renders without crashing', () => {
8
- render(
9
- <FormTestBase>
10
- {({ Field }) => (
11
- <AddressInput fieldBuilder={{ Field }} name="normalAddressInput" />
12
- )}
13
- </FormTestBase>
14
- );
15
- });
16
-
17
- it('has matching snapshot', () => {
18
- const renderResult = render(
19
- <FormTestBase>
20
- {({ Field }) => (
21
- <AddressInput fieldBuilder={{ Field }} name="normalAddressInput" />
22
- )}
23
- </FormTestBase>
24
- );
25
- expect(renderResult.asFragment()).toMatchSnapshot();
26
- });
27
- });
@@ -1,82 +0,0 @@
1
- import UsStates from './UsStates';
2
- import { SingleStringSelectGroup, StringInputGroup } from '../';
3
- import FieldSection from '../Field/FieldSection';
4
- import { FormBuilderProp } from '../Form/Form';
5
- import { zipCode as zipCodeNormalizer } from '../Normalization/normalizers';
6
- import {
7
- required,
8
- zipCode as zipCodeValidator,
9
- } from '../Validation/validators';
10
-
11
- // TODO: find a permanent home for these interfaces
12
- // TODO: but also, maybe they are comfortable here?
13
- export interface AddressInputProps {
14
- fieldBuilder: Pick<FormBuilderProp<AddressDto>, 'Field'>;
15
- name: string;
16
- }
17
-
18
- interface AddressDto {
19
- address1?: string | null;
20
- address2?: string | null;
21
- zipCode?: string | null;
22
- city?: string | null;
23
- state?: string | null;
24
- }
25
-
26
- /**
27
- * Collection of `<Field/>`s for inputting an address. Includes:
28
- * ```txt
29
- * Address 1
30
- * Address 2
31
- * City
32
- * State
33
- * Zip
34
- * ```
35
- */
36
- export default function AddressInput({
37
- fieldBuilder: { Field },
38
- name,
39
- }: AddressInputProps) {
40
- return (
41
- <>
42
- <FieldSection name={name}>
43
- <Field
44
- name="address1"
45
- placeholder="Address, Line 1"
46
- label="Address 1"
47
- Component={StringInputGroup}
48
- validate={required}
49
- />
50
- <Field
51
- name="address2"
52
- placeholder="Address, Line 2"
53
- label="Address 2"
54
- Component={StringInputGroup}
55
- />
56
- <Field
57
- name="city"
58
- placeholder="City"
59
- label="City"
60
- Component={StringInputGroup}
61
- validate={required}
62
- />
63
- <Field
64
- name="state"
65
- placeholder="State"
66
- label="State"
67
- Component={SingleStringSelectGroup}
68
- options={UsStates}
69
- validate={required}
70
- />
71
- <Field
72
- name="zipCode"
73
- placeholder="Zip"
74
- label="Zip"
75
- Component={StringInputGroup}
76
- normalize={zipCodeNormalizer}
77
- validate={[required, zipCodeValidator]}
78
- />
79
- </FieldSection>
80
- </>
81
- );
82
- }
@@ -1,55 +0,0 @@
1
- import { SelectOption } from '../Select/SelectGroup';
2
-
3
- const states: SelectOption<string>[] = [
4
- { label: 'Alabama', value: 'AL' },
5
- { label: 'Alaska', value: 'AK' },
6
- { label: 'Arizona', value: 'AZ' },
7
- { label: 'Arkansas', value: 'AR' },
8
- { label: 'California', value: 'CA' },
9
- { label: 'Colorado', value: 'CO' },
10
- { label: 'Connecticut', value: 'CT' },
11
- { label: 'Delaware', value: 'DE' },
12
- { label: 'Florida', value: 'FL' },
13
- { label: 'Georgia', value: 'GA' },
14
- { label: 'Hawaii', value: 'HI' },
15
- { label: 'Idaho', value: 'ID' },
16
- { label: 'Illinois', value: 'IL' },
17
- { label: 'Indiana', value: 'IN' },
18
- { label: 'Iowa', value: 'IA' },
19
- { label: 'Kansas', value: 'KS' },
20
- { label: 'Kentucky', value: 'KY' },
21
- { label: 'Louisiana', value: 'LA' },
22
- { label: 'Maine', value: 'ME' },
23
- { label: 'Maryland', value: 'MD' },
24
- { label: 'Massachusetts', value: 'MA' },
25
- { label: 'Michigan', value: 'MI' },
26
- { label: 'Minnesota', value: 'MN' },
27
- { label: 'Mississippi', value: 'MS' },
28
- { label: 'Missouri', value: 'MO' },
29
- { label: 'Montana', value: 'MT' },
30
- { label: 'Nebraska', value: 'NE' },
31
- { label: 'Nevada', value: 'NV' },
32
- { label: 'New Hampshire', value: 'NH' },
33
- { label: 'New Jersey', value: 'NJ' },
34
- { label: 'New Mexico', value: 'NM' },
35
- { label: 'New York', value: 'NY' },
36
- { label: 'North Carolina', value: 'NC' },
37
- { label: 'North Dakota', value: 'ND' },
38
- { label: 'Ohio', value: 'OH' },
39
- { label: 'Oklahoma', value: 'OK' },
40
- { label: 'Oregon', value: 'OR' },
41
- { label: 'Pennsylvania', value: 'PA' },
42
- { label: 'Rhode Island', value: 'RI' },
43
- { label: 'South Carolina', value: 'SC' },
44
- { label: 'South Dakota', value: 'SD' },
45
- { label: 'Tennessee', value: 'TN' },
46
- { label: 'Texas', value: 'TX' },
47
- { label: 'Utah', value: 'UT' },
48
- { label: 'Vermont', value: 'VT' },
49
- { label: 'Virginia', value: 'VA' },
50
- { label: 'Washington', value: 'WA' },
51
- { label: 'West Virginia', value: 'WV' },
52
- { label: 'Wisconsin', value: 'WI' },
53
- { label: 'Wyoming', value: 'WY' },
54
- ];
55
- export default states;
@@ -1,183 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`AddressInput has matching snapshot 1`] = `
4
- <DocumentFragment>
5
- <form
6
- action="#"
7
- class="envoc-form-form"
8
- >
9
- <div
10
- class="envoc-form-string-group envoc-form-input-group envoc-form-group envoc-form-required"
11
- >
12
- <div
13
- id="normaladdressinput.address1-error-scroll-target"
14
- style="display: none;"
15
- />
16
- <label
17
- for="normalAddressInput.address1"
18
- >
19
- Address 1
20
- </label>
21
- <input
22
- aria-invalid="false"
23
- class="envoc-form-string-group envoc-form-input-group"
24
- id="normalAddressInput.address1"
25
- name="normalAddressInput.address1"
26
- placeholder="Address, Line 1"
27
- value=""
28
- />
29
- </div>
30
- <div
31
- class="envoc-form-string-group envoc-form-input-group envoc-form-group"
32
- >
33
- <div
34
- id="normaladdressinput.address2-error-scroll-target"
35
- style="display: none;"
36
- />
37
- <label
38
- for="normalAddressInput.address2"
39
- >
40
- Address 2
41
- </label>
42
- <input
43
- aria-invalid="false"
44
- class="envoc-form-string-group envoc-form-input-group"
45
- id="normalAddressInput.address2"
46
- name="normalAddressInput.address2"
47
- placeholder="Address, Line 2"
48
- value=""
49
- />
50
- </div>
51
- <div
52
- class="envoc-form-string-group envoc-form-input-group envoc-form-group envoc-form-required"
53
- >
54
- <div
55
- id="normaladdressinput.city-error-scroll-target"
56
- style="display: none;"
57
- />
58
- <label
59
- for="normalAddressInput.city"
60
- >
61
- City
62
- </label>
63
- <input
64
- aria-invalid="false"
65
- class="envoc-form-string-group envoc-form-input-group"
66
- id="normalAddressInput.city"
67
- name="normalAddressInput.city"
68
- placeholder="City"
69
- value=""
70
- />
71
- </div>
72
- <div
73
- class="envoc-form-select-group envoc-form-group envoc-form-required"
74
- >
75
- <div
76
- id="normaladdressinput.state-error-scroll-target"
77
- style="display: none;"
78
- />
79
- <label
80
- for="normalAddressInput.state"
81
- >
82
- State
83
- </label>
84
- <div
85
- class="envoc-form-select-group css-b62m3t-container"
86
- id="normalAddressInput.state"
87
- >
88
- <span
89
- class="css-1f43avz-a11yText-A11yText"
90
- id="react-select-3-live-region"
91
- />
92
- <span
93
- aria-atomic="false"
94
- aria-live="polite"
95
- aria-relevant="additions text"
96
- class="css-1f43avz-a11yText-A11yText"
97
- />
98
- <div
99
- class="react-select__control css-13cymwt-control"
100
- >
101
- <div
102
- class="react-select__value-container css-16674sh-Component"
103
- >
104
- <div
105
- class="react-select__placeholder css-1jqq78o-placeholder"
106
- id="react-select-3-placeholder"
107
- >
108
- State
109
- </div>
110
- <div
111
- class="react-select__input-container css-d9r47t-Component"
112
- data-value=""
113
- >
114
- <input
115
- aria-autocomplete="list"
116
- aria-describedby="react-select-3-placeholder"
117
- aria-expanded="false"
118
- aria-haspopup="true"
119
- autocapitalize="none"
120
- autocomplete="off"
121
- autocorrect="off"
122
- class="react-select__input"
123
- id="normalAddressInput.state"
124
- role="combobox"
125
- spellcheck="false"
126
- style="opacity: 1; width: 100%; grid-area: 1 / 2; min-width: 2px; border: 0px; margin: 0px; outline: 0; padding: 0px;"
127
- tabindex="0"
128
- type="text"
129
- value=""
130
- />
131
- </div>
132
- </div>
133
- <div
134
- class="react-select__indicators css-ny0e4k-Component"
135
- >
136
- <span
137
- class="react-select__indicator-separator css-1u9des2-indicatorSeparator"
138
- />
139
- <div
140
- aria-hidden="true"
141
- class="react-select__indicator react-select__dropdown-indicator css-1xc3v61-indicatorContainer"
142
- >
143
- <svg
144
- aria-hidden="true"
145
- class="css-tj5bde-Svg"
146
- focusable="false"
147
- height="20"
148
- viewBox="0 0 20 20"
149
- width="20"
150
- >
151
- <path
152
- d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
153
- />
154
- </svg>
155
- </div>
156
- </div>
157
- </div>
158
- </div>
159
- </div>
160
- <div
161
- class="envoc-form-string-group envoc-form-input-group envoc-form-group envoc-form-required"
162
- >
163
- <div
164
- id="normaladdressinput.zipcode-error-scroll-target"
165
- style="display: none;"
166
- />
167
- <label
168
- for="normalAddressInput.zipCode"
169
- >
170
- Zip
171
- </label>
172
- <input
173
- aria-invalid="false"
174
- class="envoc-form-string-group envoc-form-input-group"
175
- id="normalAddressInput.zipCode"
176
- name="normalAddressInput.zipCode"
177
- placeholder="Zip"
178
- value=""
179
- />
180
- </div>
181
- </form>
182
- </DocumentFragment>
183
- `;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import { useAxiosRequestProps } from 'envoc-request';
4
- import ConfirmBaseForm from './ConfirmBaseForm';
5
-
6
- describe('ConfirmBaseForm', () => {
7
- it('Renders without error', () => {
8
- render(<ConfirmBaseForm request={confirmBaseFormRequest} />);
9
- });
10
-
11
- it('has matching snapshot', () => {
12
- const renderResult = render(
13
- <ConfirmBaseForm request={confirmBaseFormRequest} />
14
- );
15
- expect(renderResult.asFragment()).toMatchSnapshot();
16
- });
17
- });
18
-
19
- const confirmBaseFormRequest = {
20
- method: 'get',
21
- url: `/boop`,
22
- onComplete: () => {},
23
- onError: () => {},
24
- } as useAxiosRequestProps;
@@ -1,74 +0,0 @@
1
- import React, { MouseEventHandler } from 'react';
2
- import { clsx } from 'clsx';
3
- import { useAxiosRequest, useAxiosRequestProps } from 'envoc-request';
4
- import { FormDefaults } from '../FormDefaults';
5
-
6
- // TODO: change the style prop type to Tailwind type (does this exist before Tailwind 3.1 ???), or
7
- // should this just be type 'string'
8
- export interface ConfirmBaseFormProps {
9
- /** Function to run when cancel button is clicked. */
10
- handleCancel?: MouseEventHandler<HTMLButtonElement>;
11
- /** Axios request upon confirmation */
12
- request: useAxiosRequestProps;
13
- style?: React.CSSProperties;
14
- /** `<h3/>` title text on top of the form. */
15
- title?: string;
16
- /** Custom confirm button text.
17
- * @defaultValue `Confirm`
18
- */
19
- confirmButtonText?: string;
20
- /** CSS class for the buttons. */
21
- confirmButtonClass?: string;
22
- /** Any components to be rendered in between the title and the buttons. */
23
- children?: React.ReactNode;
24
- }
25
-
26
- // TODO: ask about how we should use 'children'
27
- /**
28
- * Confimation dialog. Navigates to a different route to allow the user to either confirm or cancel an action.
29
- * Commonly used for confirming delete and archive.
30
- *
31
- * See `<ConfirmDeleteForm/>` if the confirmation is specifically for deletion.
32
- */
33
- export default function ConfirmBaseForm({
34
- handleCancel,
35
- request,
36
- style,
37
- title,
38
- confirmButtonText,
39
- confirmButtonClass,
40
- children,
41
- ...props
42
- }: ConfirmBaseFormProps) {
43
- const webRequest = useAxiosRequest(
44
- Object.assign({}, request, { autoExecute: false })
45
- );
46
- const onCancel = handleCancel ?? goBack;
47
-
48
- return (
49
- <div style={{ textAlign: 'center', ...style }} {...props}>
50
- <h3>{title}</h3>
51
- {children}
52
- <button
53
- className={clsx(
54
- confirmButtonClass ??
55
- FormDefaults.cssClassPrefix + 'confirm-base-form-confirm-button'
56
- )}
57
- type="button"
58
- onClick={webRequest.submitRequest}>
59
- {confirmButtonText ?? 'Confirm'}
60
- </button>
61
- <button
62
- className={clsx(
63
- FormDefaults.cssClassPrefix + 'confirm-base-form-cancel-button'
64
- )}
65
- type="button"
66
- onClick={onCancel}>
67
- Cancel
68
- </button>
69
- </div>
70
- );
71
- function goBack() {
72
- window.history.back();
73
- }
74
- }
@@ -1,23 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ConfirmBaseForm has matching snapshot 1`] = `
4
- <DocumentFragment>
5
- <div
6
- style="text-align: center;"
7
- >
8
- <h3 />
9
- <button
10
- class="envoc-form-confirm-base-form-confirm-button"
11
- type="button"
12
- >
13
- Confirm
14
- </button>
15
- <button
16
- class="envoc-form-confirm-base-form-cancel-button"
17
- type="button"
18
- >
19
- Cancel
20
- </button>
21
- </div>
22
- </DocumentFragment>
23
- `;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import { HashRouter } from 'react-router-dom';
3
- import { render } from '@testing-library/react';
4
-
5
- import ConfirmDeleteForm from './ConfirmDeleteForm';
6
-
7
- describe('ConfirmDeleteForm', () => {
8
- it('Renders without error', () => {
9
- render(
10
- <HashRouter>
11
- <ConfirmDeleteForm form="foo" />
12
- </HashRouter>
13
- );
14
- });
15
-
16
- it('has matching snapshot', () => {
17
- const renderResult = render(
18
- <HashRouter>
19
- <ConfirmDeleteForm form="foo" />
20
- </HashRouter>
21
- );
22
- expect(renderResult.asFragment()).toMatchSnapshot();
23
- });
24
- });
@@ -1,87 +0,0 @@
1
- import React from 'react';
2
- import { useNavigate, useParams } from 'react-router-dom';
3
- import { toast } from 'react-toastify';
4
- import { useAxiosRequestProps } from 'envoc-request';
5
- import ConfirmBaseForm, {
6
- ConfirmBaseFormProps,
7
- } from '../ConfirmBaseForm/ConfirmBaseForm';
8
- import { FormDefaults } from '../FormDefaults';
9
-
10
- export interface ConfirmDeleteFormProps
11
- extends Pick<ConfirmBaseFormProps, 'style'> {
12
- /** Url to navigate to on success. */
13
- successUrl?: string;
14
- /** Form name (key) to apply the confirmation on. */
15
- form: string;
16
- /** Custom message to display.
17
- * @defaultValue `Are you sure you want to delete this?`
18
- */
19
- title?: string;
20
- /** Custom function when the axios request succeeds. */
21
- handleComplete?: Function;
22
- /** Custom function when the axios request fails. */
23
- handleError?: Function;
24
- /** Any components to be rendered in between the title and the buttons. */
25
- children?: React.ReactNode;
26
- }
27
-
28
- /**
29
- * Deletion confirmation. Navigates to a different route to allow the user to either confirm or cancel an action.
30
- *
31
- * Wraps `<ConfirmBaseForm/>`.
32
- */
33
- export default function ConfirmDeleteForm({
34
- successUrl,
35
- form,
36
- title,
37
- handleComplete,
38
- handleError,
39
- children,
40
- ...props
41
- }: ConfirmDeleteFormProps) {
42
- const navigate = useNavigate();
43
- const { entityId } = useParams();
44
- const onComplete =
45
- handleComplete ??
46
- function () {
47
- toast.success('Deleted!');
48
- goBack();
49
- };
50
- const onError =
51
- handleError ??
52
- function (error: any) {
53
- toast.error(
54
- error.response?.data?.validationFailures[0]?.errorMessage ??
55
- 'Something went wrong talking to the portal. Contact support if this continues.'
56
- );
57
- };
58
-
59
- const request = {
60
- method: 'delete',
61
- url: `/api/${form}/${entityId}`,
62
- onComplete: onComplete,
63
- onError: onError,
64
- } as useAxiosRequestProps;
65
-
66
- return (
67
- <ConfirmBaseForm
68
- request={request}
69
- handleCancel={goBack}
70
- title={title ?? 'Are you sure you want to delete this?'}
71
- confirmButtonText="Yes"
72
- confirmButtonClass={
73
- FormDefaults.cssClassPrefix + 'confirm-delete-form-yes-button'
74
- }
75
- {...props}>
76
- {children}
77
- </ConfirmBaseForm>
78
- );
79
-
80
- function goBack() {
81
- if (successUrl) {
82
- navigate(successUrl);
83
- } else {
84
- navigate(-1);
85
- }
86
- }
87
- }
@@ -1,25 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`ConfirmDeleteForm has matching snapshot 1`] = `
4
- <DocumentFragment>
5
- <div
6
- style="text-align: center;"
7
- >
8
- <h3>
9
- Are you sure you want to delete this?
10
- </h3>
11
- <button
12
- class="envoc-form-confirm-delete-form-yes-button"
13
- type="button"
14
- >
15
- Yes
16
- </button>
17
- <button
18
- class="envoc-form-confirm-base-form-cancel-button"
19
- type="button"
20
- >
21
- Cancel
22
- </button>
23
- </div>
24
- </DocumentFragment>
25
- `;
@@ -1,48 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import StringDatePickerGroup from './StringDatePickerGroup';
4
- import FormTestBase from '../__Tests__/FormTestBase';
5
-
6
- //hack so the datepicker internals don't complain about this not existing in the context of jest
7
- HTMLCanvasElement.prototype.getContext = () => null;
8
-
9
- describe('IconInputGroup', () => {
10
- it('renders without crashing', () => {
11
- render(
12
- <FormTestBase>
13
- {({ Field }) => (
14
- <Field
15
- name="favoriteDate"
16
- Component={StringDatePickerGroup}
17
- label="Favorite Date"
18
- monthPlaceholder="mm"
19
- dayPlaceholder="dd"
20
- yearPlaceholder="yyyy"
21
- maxDate={new Date('9/23/2023')}
22
- minDate={new Date('6/22/2022')}
23
- />
24
- )}
25
- </FormTestBase>
26
- );
27
- });
28
-
29
- it('has matching snapshot', () => {
30
- const renderResult = render(
31
- <FormTestBase>
32
- {({ Field }) => (
33
- <Field
34
- name="favoriteDate"
35
- Component={StringDatePickerGroup}
36
- label="Favorite Date"
37
- monthPlaceholder="mm"
38
- dayPlaceholder="dd"
39
- yearPlaceholder="yyyy"
40
- maxDate={new Date('9/23/2023')}
41
- minDate={new Date('6/22/2022')}
42
- />
43
- )}
44
- </FormTestBase>
45
- );
46
- expect(renderResult.asFragment()).toMatchSnapshot();
47
- });
48
- });