@maif/react-forms 1.0.35 → 1.0.38

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 (69) hide show
  1. package/README.md +2 -12
  2. package/lib/esm/index.js +614 -819
  3. package/lib/index.js +616 -820
  4. package/package.json +11 -4
  5. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -10
  6. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -10
  7. package/.github/workflows/build-playground.yml +0 -34
  8. package/.github/workflows/generate-release-note.yml +0 -48
  9. package/.github/workflows/release.yml +0 -73
  10. package/docs/asset-manifest.json +0 -24
  11. package/docs/index.html +0 -1
  12. package/docs/manifest.json +0 -25
  13. package/docs/robots.txt +0 -3
  14. package/docs/static/css/2.6902daba.chunk.css +0 -11
  15. package/docs/static/css/2.6902daba.chunk.css.map +0 -1
  16. package/docs/static/css/main.8693c9f3.chunk.css +0 -2
  17. package/docs/static/css/main.8693c9f3.chunk.css.map +0 -1
  18. package/docs/static/js/2.bc3a307f.chunk.js +0 -3
  19. package/docs/static/js/2.bc3a307f.chunk.js.LICENSE.txt +0 -147
  20. package/docs/static/js/2.bc3a307f.chunk.js.map +0 -1
  21. package/docs/static/js/main.a5abf7f1.chunk.js +0 -2
  22. package/docs/static/js/main.a5abf7f1.chunk.js.map +0 -1
  23. package/docs/static/js/runtime-main.368a22f5.js +0 -2
  24. package/docs/static/js/runtime-main.368a22f5.js.map +0 -1
  25. package/docs/static/media/fa-brands-400.2285773e.woff +0 -0
  26. package/docs/static/media/fa-brands-400.23f19bb0.eot +0 -0
  27. package/docs/static/media/fa-brands-400.2f517e09.svg +0 -3717
  28. package/docs/static/media/fa-brands-400.527940b1.ttf +0 -0
  29. package/docs/static/media/fa-brands-400.d878b0a6.woff2 +0 -0
  30. package/docs/static/media/fa-regular-400.4689f52c.svg +0 -801
  31. package/docs/static/media/fa-regular-400.491974d1.ttf +0 -0
  32. package/docs/static/media/fa-regular-400.77206a6b.eot +0 -0
  33. package/docs/static/media/fa-regular-400.7a333762.woff2 +0 -0
  34. package/docs/static/media/fa-regular-400.bb58e57c.woff +0 -0
  35. package/docs/static/media/fa-solid-900.1551f4f6.woff2 +0 -0
  36. package/docs/static/media/fa-solid-900.7a8b4f13.svg +0 -5034
  37. package/docs/static/media/fa-solid-900.9bbb245e.eot +0 -0
  38. package/docs/static/media/fa-solid-900.be9ee23c.ttf +0 -0
  39. package/docs/static/media/fa-solid-900.eeccf4f6.woff +0 -0
  40. package/examples/.env +0 -2
  41. package/examples/README.md +0 -0
  42. package/examples/package.json +0 -43
  43. package/examples/public/index.html +0 -43
  44. package/examples/public/manifest.json +0 -25
  45. package/examples/public/robots.txt +0 -3
  46. package/examples/src/App.css +0 -10
  47. package/examples/src/Playground.js +0 -158
  48. package/examples/src/WrapperError.js +0 -21
  49. package/examples/src/index.css +0 -13
  50. package/examples/src/index.js +0 -11
  51. package/examples/src/reportWebVitals.js +0 -13
  52. package/examples/src/schema/basic.json +0 -15
  53. package/examples/src/schema/constrainedBasic.json +0 -28
  54. package/examples/src/schema/constraintsWithRef.json +0 -44
  55. package/examples/src/schema/dynamicForm.json +0 -57
  56. package/examples/src/schema/formArray.js +0 -30
  57. package/examples/src/schema/formInForm.json +0 -39
  58. package/examples/src/schema/selector.json +0 -14
  59. package/jest-sync.config.json +0 -17
  60. package/rollup.config.js +0 -64
  61. package/scripts/build.sh +0 -34
  62. package/test/array.spec.js +0 -78
  63. package/test/bool.spec.js +0 -29
  64. package/test/date.spec.js +0 -41
  65. package/test/number.spec.js +0 -124
  66. package/test/object.spec.js +0 -14
  67. package/test/string.spec.js +0 -87
  68. package/test/testUtils.js +0 -30
  69. package/test-setup.js +0 -9
package/README.md CHANGED
@@ -70,7 +70,7 @@ export const Example = () => {
70
70
  - `code`: if the type is `string`, display a code input (draw with [react-ace](https://github.com/securingsincity/react-ace)) (add a props.setRef to get ace editor ref)
71
71
  - `singleLineCode`: renders text input with syntax highlighting (draw with [react-ace](https://github.com/securingsincity/react-ace)) (add a props.setRef to get ace editor ref)
72
72
  - `markdown`: if the type is `string`, display a markdown input
73
- - `text`: if the type is `string`, display a textarea
73
+ - `textarea`: if the type is `string`, display a textarea
74
74
  - `email`: if the type is `string`, display an email input
75
75
  - `password`: if the type is `string`, display a password input
76
76
  - `hidden`: if the type is `string`, add an hidden input in your form
@@ -219,10 +219,10 @@ httpClient = {(url, method) => fetch(url, {
219
219
  ```
220
220
  ## constraints
221
221
  Possible constraints are provided by import `constraints` from **@maif/react-form** or can be wrotes on json
222
+ By default all fields of the form are nullable (they can accept `null` or `undefined` value).
222
223
 
223
224
  - [mixed](#mixed)
224
225
  - [`constraints.required(message?:string)`](#constraintsrequiredmessagestring)
225
- - [`constraints.nullable()`](#constraintsnullable)
226
226
  - [`constraints.test(name: string, message?:string, test: (val: any) => boolean | Promise<boolean>)`](#constraintstestname-string-messagestring-test-val-any--boolean--promiseboolean)
227
227
  - [`constraints.when(ref: string, test: (val: any) => boolean, then: any = [], otherwise: any = [])`](#constraintswhenref-string-test-val-any--boolean-then-any---otherwise-any--)
228
228
  - [`constraints.oneOf(arrayOfValues: any[], message?:string)`](#constraintsoneofarrayofvalues-any-messagestring)
@@ -247,16 +247,6 @@ the following methods works for all type types of value.
247
247
  {type: 'required', message: "this field is required"}
248
248
  ```
249
249
 
250
- #### `constraints.nullable()`
251
- Indicates the `null` is a valid value for the schema. Without `nullable` `null` will be treated as an error.
252
-
253
- ```javascript
254
- constraints.nullable()
255
- ```
256
- ```javascript
257
- {type: 'nullable'}
258
- ```
259
-
260
250
  #### `constraints.test(name: string, message?:string, test: (val: any) => boolean | Promise<boolean>)`
261
251
  Adds a test function to the validation chain. The test must provide a `name`, an error `message` and a validation function that takes in entry the current value and must return a boolean result. The test can return a promise that resolve a boolean result
262
252