@dhis2/ui-forms 8.2.0 → 8.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. package/build/cjs/CheckboxFieldFF/CheckboxFieldFF.js +24 -21
  2. package/build/cjs/CheckboxFieldFF/CheckboxFieldFF.stories.js +3 -27
  3. package/build/cjs/FieldGroupFF/FieldGroupFF.js +7 -6
  4. package/build/cjs/FieldGroupFF/FieldGroupFF.stories.js +3 -13
  5. package/build/cjs/FileInputFieldFF/FileInputFieldFF.js +17 -18
  6. package/build/cjs/FileInputFieldFF/FileInputFieldFF.stories.e2e.js +12 -8
  7. package/build/cjs/FileInputFieldFF/FileInputFieldFF.stories.js +3 -27
  8. package/build/cjs/InputFieldFF/InputFieldFF.js +27 -24
  9. package/build/cjs/InputFieldFF/InputFieldFF.stories.js +3 -27
  10. package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.js +15 -14
  11. package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.stories.e2e.js +13 -10
  12. package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.stories.js +3 -29
  13. package/build/cjs/RadioFieldFF/RadioFieldFF.js +24 -21
  14. package/build/cjs/RadioFieldFF/RadioFieldFF.stories.js +3 -27
  15. package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.js +15 -14
  16. package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.stories.e2e.js +13 -10
  17. package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.stories.js +3 -29
  18. package/build/cjs/SwitchFieldFF/SwitchFieldFF.js +24 -21
  19. package/build/cjs/SwitchFieldFF/SwitchFieldFF.stories.js +3 -27
  20. package/build/cjs/TextAreaFieldFF/TextAreaFieldFF.js +26 -23
  21. package/build/cjs/TextAreaFieldFF/TextAreaFieldFF.stories.js +3 -27
  22. package/build/cjs/formDecorator.js +6 -5
  23. package/build/cjs/index.js +12 -11
  24. package/build/cjs/locales/ar/translations.json +0 -1
  25. package/build/cjs/locales/ar_IQ/translations.json +0 -1
  26. package/build/cjs/locales/ckb/translations.json +0 -1
  27. package/build/cjs/locales/cs/translations.json +0 -1
  28. package/build/cjs/locales/da/translations.json +0 -1
  29. package/build/cjs/locales/en/translations.json +0 -1
  30. package/build/cjs/locales/es/translations.json +0 -1
  31. package/build/cjs/locales/fr/translations.json +0 -1
  32. package/build/cjs/locales/id/translations.json +0 -1
  33. package/build/cjs/locales/km/translations.json +0 -1
  34. package/build/cjs/locales/lo/translations.json +0 -1
  35. package/build/cjs/locales/my/translations.json +0 -1
  36. package/build/cjs/locales/nb/translations.json +0 -1
  37. package/build/cjs/locales/prs/translations.json +0 -1
  38. package/build/cjs/locales/ps/translations.json +0 -1
  39. package/build/cjs/locales/pt/translations.json +0 -1
  40. package/build/cjs/locales/pt_BR/translations.json +0 -1
  41. package/build/cjs/locales/ru/translations.json +0 -1
  42. package/build/cjs/locales/sv/translations.json +0 -1
  43. package/build/cjs/locales/tet/translations.json +0 -1
  44. package/build/cjs/locales/tg/translations.json +0 -1
  45. package/build/cjs/locales/uk/translations.json +0 -1
  46. package/build/cjs/locales/ur/translations.json +0 -1
  47. package/build/cjs/locales/uz/translations.json +0 -1
  48. package/build/cjs/locales/uz_Latn/translations.json +0 -1
  49. package/build/cjs/locales/vi/translations.json +0 -1
  50. package/build/cjs/locales/zh/translations.json +0 -1
  51. package/build/cjs/locales/zh_CN/translations.json +0 -1
  52. package/build/cjs/shared/helpers/createChangeHandler.js +19 -16
  53. package/build/cjs/shared/helpers/createSelectChangeHandler.js +10 -6
  54. package/build/cjs/shared/propTypes.js +1 -1
  55. package/build/cjs/transformers/arrayWithIdObjects.js +6 -3
  56. package/build/cjs/validators/__tests__/createPattern.test.js +1 -1
  57. package/build/cjs/validators/composeValidators.js +10 -2
  58. package/build/cjs/validators/helpers/index.js +1 -1
  59. package/build/cjs/validators/number.js +1 -1
  60. package/build/cjs/validators/string.js +1 -1
  61. package/build/cjs/validators/test-helpers/index.js +2 -2
  62. package/build/cjs/validators/url.js +1 -1
  63. package/build/es/CheckboxFieldFF/CheckboxFieldFF.js +24 -21
  64. package/build/es/CheckboxFieldFF/CheckboxFieldFF.stories.js +2 -26
  65. package/build/es/FieldGroupFF/FieldGroupFF.js +7 -6
  66. package/build/es/FieldGroupFF/FieldGroupFF.stories.js +2 -12
  67. package/build/es/FileInputFieldFF/FileInputFieldFF.js +17 -18
  68. package/build/es/FileInputFieldFF/FileInputFieldFF.stories.e2e.js +12 -8
  69. package/build/es/FileInputFieldFF/FileInputFieldFF.stories.js +2 -26
  70. package/build/es/InputFieldFF/InputFieldFF.js +27 -24
  71. package/build/es/InputFieldFF/InputFieldFF.stories.js +2 -26
  72. package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.js +15 -14
  73. package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.stories.e2e.js +13 -10
  74. package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.stories.js +2 -28
  75. package/build/es/RadioFieldFF/RadioFieldFF.js +24 -21
  76. package/build/es/RadioFieldFF/RadioFieldFF.stories.js +2 -26
  77. package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.js +15 -14
  78. package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.stories.e2e.js +13 -10
  79. package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.stories.js +2 -28
  80. package/build/es/SwitchFieldFF/SwitchFieldFF.js +24 -21
  81. package/build/es/SwitchFieldFF/SwitchFieldFF.stories.js +2 -26
  82. package/build/es/TextAreaFieldFF/TextAreaFieldFF.js +26 -23
  83. package/build/es/TextAreaFieldFF/TextAreaFieldFF.stories.js +2 -26
  84. package/build/es/formDecorator.js +6 -5
  85. package/build/es/locales/ar/translations.json +0 -1
  86. package/build/es/locales/ar_IQ/translations.json +0 -1
  87. package/build/es/locales/ckb/translations.json +0 -1
  88. package/build/es/locales/cs/translations.json +0 -1
  89. package/build/es/locales/da/translations.json +0 -1
  90. package/build/es/locales/en/translations.json +0 -1
  91. package/build/es/locales/es/translations.json +0 -1
  92. package/build/es/locales/fr/translations.json +0 -1
  93. package/build/es/locales/id/translations.json +0 -1
  94. package/build/es/locales/km/translations.json +0 -1
  95. package/build/es/locales/lo/translations.json +0 -1
  96. package/build/es/locales/my/translations.json +0 -1
  97. package/build/es/locales/nb/translations.json +0 -1
  98. package/build/es/locales/prs/translations.json +0 -1
  99. package/build/es/locales/ps/translations.json +0 -1
  100. package/build/es/locales/pt/translations.json +0 -1
  101. package/build/es/locales/pt_BR/translations.json +0 -1
  102. package/build/es/locales/ru/translations.json +0 -1
  103. package/build/es/locales/sv/translations.json +0 -1
  104. package/build/es/locales/tet/translations.json +0 -1
  105. package/build/es/locales/tg/translations.json +0 -1
  106. package/build/es/locales/uk/translations.json +0 -1
  107. package/build/es/locales/ur/translations.json +0 -1
  108. package/build/es/locales/uz/translations.json +0 -1
  109. package/build/es/locales/uz_Latn/translations.json +0 -1
  110. package/build/es/locales/vi/translations.json +0 -1
  111. package/build/es/locales/zh/translations.json +0 -1
  112. package/build/es/locales/zh_CN/translations.json +0 -1
  113. package/build/es/shared/helpers/createChangeHandler.js +19 -16
  114. package/build/es/shared/helpers/createSelectChangeHandler.js +10 -6
  115. package/build/es/transformers/arrayWithIdObjects.js +6 -3
  116. package/build/es/validators/__tests__/createPattern.test.js +1 -1
  117. package/build/es/validators/composeValidators.js +10 -2
  118. package/build/es/validators/test-helpers/index.js +1 -1
  119. package/package.json +10 -10
@@ -19,27 +19,30 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
 
20
20
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
21
 
22
- const CheckboxFieldFF = ({
23
- error,
24
- input,
25
- meta,
26
- showValidStatus,
27
- valid,
28
- validationText,
29
- onBlur,
30
- onFocus,
31
- ...rest
32
- }) => /*#__PURE__*/_react.default.createElement(_checkbox.CheckboxField, _extends({}, rest, {
33
- name: input.name,
34
- checked: input.checked,
35
- value: input.value,
36
- error: (0, _helpers.hasError)(meta, error),
37
- valid: (0, _helpers.isValid)(meta, valid, showValidStatus),
38
- validationText: (0, _helpers.getValidationText)(meta, validationText, error),
39
- onFocus: (0, _helpers.createFocusHandler)(input, onFocus),
40
- onChange: (0, _helpers.createToggleChangeHandler)(input),
41
- onBlur: (0, _helpers.createBlurHandler)(input, onBlur)
42
- }));
22
+ const CheckboxFieldFF = _ref => {
23
+ let {
24
+ error,
25
+ input,
26
+ meta,
27
+ showValidStatus,
28
+ valid,
29
+ validationText,
30
+ onBlur,
31
+ onFocus,
32
+ ...rest
33
+ } = _ref;
34
+ return /*#__PURE__*/_react.default.createElement(_checkbox.CheckboxField, _extends({}, rest, {
35
+ name: input.name,
36
+ checked: input.checked,
37
+ value: input.value,
38
+ error: (0, _helpers.hasError)(meta, error),
39
+ valid: (0, _helpers.isValid)(meta, valid, showValidStatus),
40
+ validationText: (0, _helpers.getValidationText)(meta, validationText, error),
41
+ onFocus: (0, _helpers.createFocusHandler)(input, onFocus),
42
+ onChange: (0, _helpers.createToggleChangeHandler)(input),
43
+ onBlur: (0, _helpers.createBlurHandler)(input, onBlur)
44
+ }));
45
+ };
43
46
 
44
47
  exports.CheckboxFieldFF = CheckboxFieldFF;
45
48
  CheckboxFieldFF.propTypes = {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ValueWhenChecked = exports.Statuses = exports.HelpText = exports.Disabled = exports.RequiredWithValidate = exports.Default = exports.default = void 0;
6
+ exports.default = exports.ValueWhenChecked = exports.Statuses = exports.RequiredWithValidate = exports.HelpText = exports.Disabled = exports.Default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -19,33 +19,9 @@ var _CheckboxFieldFF = require("./CheckboxFieldFF.js");
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
- const description = `
23
- The \`CheckboxFieldFF\` is a wrapper around a \`CheckboxField\` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.
24
-
25
- #### Final Form
26
-
27
- See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
28
-
29
- Inside a Final Form \`<Form>\` component, these 'FF' UI components are intended to be used in the \`component\` prop of the [Final Form \`<Field>\` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. \`<Field component={CheckboxFieldFF} />\`. See the code samples below for examples.
30
-
31
- #### Props
32
-
33
- The props shown in the table below are generally provided to the \`CheckboxFieldFF\` wrapper by the Final Form \`Field\`.
34
-
35
- Note that any props beyond the API of the \`Field\` component will be spread to the \`CheckboxFieldFF\`, which passes any extra props to the underlying \`CheckboxField\` using \`{...rest}\`.
36
-
37
- Therefore, to add any props to the \`CheckboxFieldFF\` or \`CheckboxField\`, add those props to the parent Final Form \`Field\` component.
38
-
39
- Also see \`Checkbox\` and \`CheckboxField\` for notes about props and implementation.
40
-
41
- \`\`\`js
42
- import { CheckboxFieldFF } from '@dhis2/ui'
43
- \`\`\`
44
-
45
- Press **Submit** to see the form values logged to the console.
46
- `;
22
+ const description = "\nThe `CheckboxFieldFF` is a wrapper around a `CheckboxField` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.\n\n#### Final Form\n\nSee how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).\n\nInside a Final Form `<Form>` component, these 'FF' UI components are intended to be used in the `component` prop of the [Final Form `<Field>` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. `<Field component={CheckboxFieldFF} />`. See the code samples below for examples.\n\n#### Props\n\nThe props shown in the table below are generally provided to the `CheckboxFieldFF` wrapper by the Final Form `Field`.\n\nNote that any props beyond the API of the `Field` component will be spread to the `CheckboxFieldFF`, which passes any extra props to the underlying `CheckboxField` using `{...rest}`.\n\nTherefore, to add any props to the `CheckboxFieldFF` or `CheckboxField`, add those props to the parent Final Form `Field` component.\n\nAlso see `Checkbox` and `CheckboxField` for notes about props and implementation.\n\n```js\nimport { CheckboxFieldFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n";
47
23
  var _default = {
48
- title: 'Forms/Checkbox/Checkbox Field (Final Form)',
24
+ title: 'Checkbox Field (Final Form)',
49
25
  component: _CheckboxFieldFF.CheckboxFieldFF,
50
26
  decorators: [_formDecorator.formDecorator],
51
27
  parameters: {
@@ -15,12 +15,13 @@ var _reactFinalForm = require("react-final-form");
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- const FieldGroupFF = ({
19
- name,
20
- label,
21
- children,
22
- required
23
- }) => {
18
+ const FieldGroupFF = _ref => {
19
+ let {
20
+ name,
21
+ label,
22
+ children,
23
+ required
24
+ } = _ref;
24
25
  const {
25
26
  meta: {
26
27
  error,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Default = exports.default = void 0;
6
+ exports.default = exports.Default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -19,19 +19,9 @@ var _FieldGroupFF = require("./FieldGroupFF.js");
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
- const description = `
23
- This component is intended for use with [Final Form](https://final-form.org/docs/react-final-form/getting-started), the preferred library for form validation and utilities in DHIS 2 apps.
24
-
25
- \`FieldGroupFF\` groups related fields (using the Final Form \`<Field>\`), like checkboxes, and adds a label and name.
26
-
27
- \`\`\`js
28
- import { FieldGroupFF } from '@dhis2/ui'
29
- \`\`\`
30
-
31
- Press **Submit** to see the form values logged to the console.
32
- `;
22
+ const description = "\nThis component is intended for use with [Final Form](https://final-form.org/docs/react-final-form/getting-started), the preferred library for form validation and utilities in DHIS 2 apps.\n\n`FieldGroupFF` groups related fields (using the Final Form `<Field>`), like checkboxes, and adds a label and name.\n\n```js\nimport { FieldGroupFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n";
33
23
  var _default = {
34
- title: 'Forms/Field Group/Field Group (Final Form)',
24
+ title: 'Field Group (Final Form)',
35
25
  component: _FieldGroupFF.FieldGroupFF,
36
26
  decorators: [_formDecorator.formDecorator],
37
27
  parameters: {
@@ -39,9 +39,10 @@ const dedupeAndConcat = (currentFiles, newFileList) => {
39
39
  }).files;
40
40
  };
41
41
 
42
- const createChangeHandler = (input, multifile) => ({
43
- files
44
- }) => {
42
+ const createChangeHandler = (input, multifile) => _ref => {
43
+ let {
44
+ files
45
+ } = _ref;
45
46
  // A JavaScript FileList instance is read-only, so we cannot add files to it
46
47
  // FileList also doesn't have a .map method so by destructuring the FileList
47
48
  // instance into an array we can add, remove and map
@@ -56,18 +57,19 @@ const createRemoveHandler = (input, fileToDelete) => () => {
56
57
  input.onChange(value);
57
58
  };
58
59
 
59
- const FileInputFieldFF = ({
60
- buttonLabel,
61
- disabled,
62
- error,
63
- input,
64
- meta,
65
- multifile,
66
- showValidStatus,
67
- valid,
68
- validationText,
69
- ...rest
70
- }) => {
60
+ const FileInputFieldFF = _ref2 => {
61
+ let {
62
+ buttonLabel,
63
+ disabled,
64
+ error,
65
+ input,
66
+ meta,
67
+ multifile,
68
+ showValidStatus,
69
+ valid,
70
+ validationText,
71
+ ...rest
72
+ } = _ref2;
71
73
  const files = input.value || [];
72
74
  return /*#__PURE__*/_react.default.createElement(_fileInput.FileInputField, _extends({}, rest, {
73
75
  onChange: createChangeHandler(input, multifile),
@@ -87,9 +89,6 @@ const FileInputFieldFF = ({
87
89
  };
88
90
 
89
91
  exports.FileInputFieldFF = FileInputFieldFF;
90
- FileInputFieldFF.defaultProps = {
91
- placeholder: _index.default.t('No file(s) selected yet')
92
- };
93
92
  FileInputFieldFF.propTypes = {
94
93
  /** `input` props provided by Final Form `Field` */
95
94
  input: _propTypes2.inputPropType.isRequired,
@@ -30,9 +30,10 @@ var _FileInputFieldFF = require("./FileInputFieldFF.js");
30
30
 
31
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
32
 
33
- const StandardForm = ({
34
- values
35
- }) => {
33
+ const StandardForm = _ref => {
34
+ let {
35
+ values
36
+ } = _ref;
36
37
  return /*#__PURE__*/_react2.default.createElement("div", {
37
38
  style: {
38
39
  maxWidth: 830
@@ -214,7 +215,7 @@ const StandardForm = ({
214
215
  const [file] = files;
215
216
 
216
217
  if (file.type !== 'text/plain') {
217
- return `The file you provided is not a txt file, received "${file.type}"`;
218
+ return "The file you provided is not a txt file, received \"".concat(file.type, "\"");
218
219
  }
219
220
  },
220
221
  component: _FileInputFieldFF.FileInputFieldFF
@@ -234,7 +235,7 @@ const StandardForm = ({
234
235
  }
235
236
 
236
237
  if (file.type !== 'application/jpg') {
237
- return `One of the files is not a jpg, received "${file.type}"`;
238
+ return "One of the files is not a jpg, received \"".concat(file.type, "\"");
238
239
  }
239
240
  }, undefined);
240
241
  },
@@ -254,6 +255,9 @@ const StandardForm = ({
254
255
  options: {
255
256
  showPanel: false
256
257
  }
257
- }).add('Standard form', (_, {
258
- formRenderProps
259
- }) => /*#__PURE__*/_react2.default.createElement(StandardForm, formRenderProps));
258
+ }).add('Standard form', (_, _ref2) => {
259
+ let {
260
+ formRenderProps
261
+ } = _ref2;
262
+ return /*#__PURE__*/_react2.default.createElement(StandardForm, formRenderProps);
263
+ });
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PreventPlaceholder = exports.WithValues = exports.Multifile = exports.Required = exports.Default = exports.default = void 0;
6
+ exports.default = exports.WithValues = exports.Required = exports.PreventPlaceholder = exports.Multifile = exports.Default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -19,34 +19,10 @@ var _FileInputFieldFF = require("./FileInputFieldFF.js");
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
- const description = `
23
- The \`FileInputFieldFF\` is a wrapper around a \`FileInputField\` that enables it to work with Final Form, the preferred library in DHIS 2 apps for form validation and utilities.
24
-
25
- #### Final Form
26
-
27
- See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
28
-
29
- Inside a Final Form \`<Form>\` component, these 'FF' UI components are intended to be used in the \`component\` prop of the [Final Form \`<Field>\` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. \`<Field component={FileInputFieldFF} />\`. See the code samples below for examples.
30
-
31
- #### Props
32
-
33
- The props shown in the table below are generally provided to the \`FileInputFieldFF\` wrapper by the Final Form \`Field\`.
34
-
35
- Note that any props beyond the API of the \`Field\` component will be spread to the \`FileInputFieldFF\`, which passes any extra props to the underlying \`FileInputField\` using \`{...rest}\`.
36
-
37
- Therefore, to add any props to the \`FileInputFieldFF\` or \`FileInputField\`, add those props to the parent Final Form \`Field\` component.
38
-
39
- Also see \`FileInput\` and \`FileInputField\` for notes about props and implementation.
40
-
41
- \`\`\`js
42
- import { FileInputFieldFF } from '@dhis2/ui'
43
- \`\`\`
44
-
45
- Press **Submit** to see the form values logged to the console.
46
- `;
22
+ const description = "\nThe `FileInputFieldFF` is a wrapper around a `FileInputField` that enables it to work with Final Form, the preferred library in DHIS 2 apps for form validation and utilities.\n\n#### Final Form\n\nSee how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).\n\nInside a Final Form `<Form>` component, these 'FF' UI components are intended to be used in the `component` prop of the [Final Form `<Field>` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. `<Field component={FileInputFieldFF} />`. See the code samples below for examples.\n\n#### Props\n\nThe props shown in the table below are generally provided to the `FileInputFieldFF` wrapper by the Final Form `Field`.\n\nNote that any props beyond the API of the `Field` component will be spread to the `FileInputFieldFF`, which passes any extra props to the underlying `FileInputField` using `{...rest}`.\n\nTherefore, to add any props to the `FileInputFieldFF` or `FileInputField`, add those props to the parent Final Form `Field` component.\n\nAlso see `FileInput` and `FileInputField` for notes about props and implementation.\n\n```js\nimport { FileInputFieldFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n";
47
23
  const files = [new File([], 'file1.txt'), new File([], 'file2.txt')];
48
24
  var _default = {
49
- title: 'Forms/File Input/File Input Field (Final Form)',
25
+ title: 'File Input Field (Final Form)',
50
26
  component: _FileInputFieldFF.FileInputFieldFF,
51
27
  decorators: [_formDecorator.formDecorator],
52
28
  parameters: {
@@ -19,30 +19,33 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
 
20
20
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
21
 
22
- const InputFieldFF = ({
23
- input,
24
- meta,
25
- error,
26
- showValidStatus,
27
- valid,
28
- validationText,
29
- onBlur,
30
- onFocus,
31
- loading,
32
- showLoadingStatus,
33
- ...rest
34
- }) => /*#__PURE__*/_react.default.createElement(_input.InputField, _extends({}, rest, {
35
- name: input.name,
36
- type: input.type,
37
- error: (0, _helpers.hasError)(meta, error),
38
- valid: (0, _helpers.isValid)(meta, valid, showValidStatus),
39
- loading: (0, _helpers.isLoading)(meta, loading, showLoadingStatus),
40
- validationText: (0, _helpers.getValidationText)(meta, validationText, error),
41
- onFocus: (0, _helpers.createFocusHandler)(input, onFocus),
42
- onChange: (0, _helpers.createChangeHandler)(input),
43
- onBlur: (0, _helpers.createBlurHandler)(input, onBlur),
44
- value: input.value
45
- }));
22
+ const InputFieldFF = _ref => {
23
+ let {
24
+ input,
25
+ meta,
26
+ error,
27
+ showValidStatus,
28
+ valid,
29
+ validationText,
30
+ onBlur,
31
+ onFocus,
32
+ loading,
33
+ showLoadingStatus,
34
+ ...rest
35
+ } = _ref;
36
+ return /*#__PURE__*/_react.default.createElement(_input.InputField, _extends({}, rest, {
37
+ name: input.name,
38
+ type: input.type,
39
+ error: (0, _helpers.hasError)(meta, error),
40
+ valid: (0, _helpers.isValid)(meta, valid, showValidStatus),
41
+ loading: (0, _helpers.isLoading)(meta, loading, showLoadingStatus),
42
+ validationText: (0, _helpers.getValidationText)(meta, validationText, error),
43
+ onFocus: (0, _helpers.createFocusHandler)(input, onFocus),
44
+ onChange: (0, _helpers.createChangeHandler)(input),
45
+ onBlur: (0, _helpers.createBlurHandler)(input, onBlur),
46
+ value: input.value
47
+ }));
48
+ };
46
49
 
47
50
  exports.InputFieldFF = InputFieldFF;
48
51
  InputFieldFF.propTypes = {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Statuses = exports.HelpText = exports.Disabled = exports.Required = exports.Default = exports.default = void 0;
6
+ exports.default = exports.Statuses = exports.Required = exports.HelpText = exports.Disabled = exports.Default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -19,33 +19,9 @@ var _InputFieldFF = require("./InputFieldFF.js");
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
- const description = `
23
- The \`InputFieldFF\` is a wrapper around a \`InputField\` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.
24
-
25
- #### Final Form
26
-
27
- See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
28
-
29
- Inside a Final Form \`<Form>\` component, these 'FF' UI components are intended to be used in the \`component\` prop of the [Final Form \`<Field>\` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. \`<Field component={InputFieldFF} />\`. See the code samples below for examples.
30
-
31
- #### Props
32
-
33
- The props shown in the table below are generally provided to the \`InputFieldFF\` wrapper by the Final Form \`Field\`.
34
-
35
- Note that any props beyond the API of the \`Field\` component will be spread to the \`InputFieldFF\`, which passes any extra props to the underlying \`InputField\` using \`{...rest}\`.
36
-
37
- Therefore, to add any props to the \`InputFieldFF\` or \`InputField\`, add those props to the parent Final Form \`Field\` component.
38
-
39
- Also see \`InputField\` for notes about props and implementation.
40
-
41
- \`\`\`js
42
- import { InputFieldFF } from '@dhis2/ui'
43
- \`\`\`
44
-
45
- Press **Submit** to see the form values logged to the console.
46
- `;
22
+ const description = "\nThe `InputFieldFF` is a wrapper around a `InputField` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.\n\n#### Final Form\n\nSee how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).\n\nInside a Final Form `<Form>` component, these 'FF' UI components are intended to be used in the `component` prop of the [Final Form `<Field>` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. `<Field component={InputFieldFF} />`. See the code samples below for examples.\n\n#### Props\n\nThe props shown in the table below are generally provided to the `InputFieldFF` wrapper by the Final Form `Field`.\n\nNote that any props beyond the API of the `Field` component will be spread to the `InputFieldFF`, which passes any extra props to the underlying `InputField` using `{...rest}`.\n\nTherefore, to add any props to the `InputFieldFF` or `InputField`, add those props to the parent Final Form `Field` component.\n\nAlso see `InputField` for notes about props and implementation.\n\n```js\nimport { InputFieldFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n";
47
23
  var _default = {
48
- title: 'Forms/Input/Input Field (Final Form)',
24
+ title: 'Input Field (Final Form)',
49
25
  component: _InputFieldFF.InputFieldFF,
50
26
  decorators: [_formDecorator.formDecorator],
51
27
  parameters: {
@@ -19,20 +19,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
 
20
20
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
21
 
22
- const MultiSelectFieldFF = ({
23
- error,
24
- input,
25
- loading,
26
- meta,
27
- onBlur,
28
- onFocus,
29
- options = [],
30
- showLoadingStatus,
31
- showValidStatus,
32
- valid,
33
- validationText,
34
- ...rest
35
- }) => {
22
+ const MultiSelectFieldFF = _ref => {
23
+ let {
24
+ error,
25
+ input,
26
+ loading,
27
+ meta,
28
+ onBlur,
29
+ onFocus,
30
+ options = [],
31
+ showLoadingStatus,
32
+ showValidStatus,
33
+ valid,
34
+ validationText,
35
+ ...rest
36
+ } = _ref;
36
37
  return /*#__PURE__*/_react.default.createElement(_select.MultiSelectField, _extends({}, rest, {
37
38
  name: input.name,
38
39
  error: (0, _helpers.hasError)(meta, error),
@@ -25,13 +25,16 @@ const defaultOptions = [{
25
25
  options: {
26
26
  showPanel: false
27
27
  }
28
- }).add('Required', (_, {
29
- cypressProps
30
- }) => /*#__PURE__*/_react2.default.createElement(_reactFinalForm.Field, {
31
- required: true,
32
- name: "multiSelect",
33
- label: "Multi select",
34
- component: _MultiSelectFieldFF.MultiSelectFieldFF,
35
- validate: _index.hasValue,
36
- options: cypressProps.options || defaultOptions
37
- }));
28
+ }).add('Required', (_, _ref) => {
29
+ let {
30
+ cypressProps
31
+ } = _ref;
32
+ return /*#__PURE__*/_react2.default.createElement(_reactFinalForm.Field, {
33
+ required: true,
34
+ name: "multiSelect",
35
+ label: "Multi select",
36
+ component: _MultiSelectFieldFF.MultiSelectFieldFF,
37
+ validate: _index.hasValue,
38
+ options: cypressProps.options || defaultOptions
39
+ });
40
+ });
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.InitialValue = exports.Default = exports.default = void 0;
6
+ exports.default = exports.InitialValue = exports.Default = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -17,33 +17,7 @@ var _MultiSelectFieldFF = require("./MultiSelectFieldFF.js");
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- const description = `
21
- The \`MultiSelectFieldFF\` is a wrapper around a \`MultiSelectField\` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.
22
-
23
- #### Final Form
24
-
25
- See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
26
-
27
- Inside a Final Form \`<Form>\` component, these 'FF' UI components are intended to be used in the \`component\` prop of the [Final Form \`<Field>\` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. \`<Field component={MultiSelectFieldFF} />\`. See the code samples below for examples.
28
-
29
- #### Props
30
-
31
- The props shown in the table below are generally provided to the \`MultiSelectFieldFF\` wrapper by the Final Form \`Field\`.
32
-
33
- Note that any props beyond the API of the \`Field\` component will be spread to the \`MultiSelectFieldFF\`, which passes any extra props to the underlying \`MultiSelectField\` using \`{...rest}\`.
34
-
35
- Therefore, to add any props to the \`MultiSelectFieldFF\` or \`MultiSelectField\`, add those props to the parent Final Form \`Field\` component.
36
-
37
- Also see \`MultiSelect\` and \`MultiSelectField\` for notes about props and implementation.
38
-
39
- \`\`\`js
40
- import { MultiSelectFieldFF } from '@dhis2/ui'
41
- \`\`\`
42
-
43
- Press **Submit** to see the form values logged to the console.
44
-
45
- _**Note:** Dropdowns may not appear correctly on this page. See the affected demos in the 'Canvas' tab for propper dropdown placement._
46
- `;
20
+ const description = "\nThe `MultiSelectFieldFF` is a wrapper around a `MultiSelectField` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.\n\n#### Final Form\n\nSee how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).\n\nInside a Final Form `<Form>` component, these 'FF' UI components are intended to be used in the `component` prop of the [Final Form `<Field>` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. `<Field component={MultiSelectFieldFF} />`. See the code samples below for examples.\n\n#### Props\n\nThe props shown in the table below are generally provided to the `MultiSelectFieldFF` wrapper by the Final Form `Field`.\n\nNote that any props beyond the API of the `Field` component will be spread to the `MultiSelectFieldFF`, which passes any extra props to the underlying `MultiSelectField` using `{...rest}`.\n\nTherefore, to add any props to the `MultiSelectFieldFF` or `MultiSelectField`, add those props to the parent Final Form `Field` component.\n\nAlso see `MultiSelect` and `MultiSelectField` for notes about props and implementation.\n\n```js\nimport { MultiSelectFieldFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n\n_**Note:** Dropdowns may not appear correctly on this page. See the affected demos in the 'Canvas' tab for propper dropdown placement._\n";
47
21
  const options = [{
48
22
  value: '1',
49
23
  label: 'one'
@@ -77,7 +51,7 @@ const options = [{
77
51
  }];
78
52
  const initialValue = ['3', '4', '9', '10'];
79
53
  var _default = {
80
- title: 'Forms/Multi Select/Multi Select Field (Final Form)',
54
+ title: 'Multi Select Field (Final Form)',
81
55
  component: _MultiSelectFieldFF.MultiSelectFieldFF,
82
56
  decorators: [_formDecorator.formDecorator],
83
57
  parameters: {
@@ -19,27 +19,30 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
19
19
 
20
20
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
21
 
22
- const RadioFieldFF = ({
23
- error,
24
- input,
25
- meta,
26
- showValidStatus,
27
- valid,
28
- validationText,
29
- onBlur,
30
- onFocus,
31
- ...rest
32
- }) => /*#__PURE__*/_react.default.createElement(_radio.Radio, _extends({}, rest, {
33
- name: input.name,
34
- checked: input.checked,
35
- value: input.value,
36
- error: (0, _helpers.hasError)(meta, error),
37
- valid: (0, _helpers.isValid)(meta, valid, showValidStatus),
38
- validationText: (0, _helpers.getValidationText)(meta, validationText, error),
39
- onFocus: (0, _helpers.createFocusHandler)(input, onFocus),
40
- onChange: (0, _helpers.createToggleChangeHandler)(input),
41
- onBlur: (0, _helpers.createBlurHandler)(input, onBlur)
42
- }));
22
+ const RadioFieldFF = _ref => {
23
+ let {
24
+ error,
25
+ input,
26
+ meta,
27
+ showValidStatus,
28
+ valid,
29
+ validationText,
30
+ onBlur,
31
+ onFocus,
32
+ ...rest
33
+ } = _ref;
34
+ return /*#__PURE__*/_react.default.createElement(_radio.Radio, _extends({}, rest, {
35
+ name: input.name,
36
+ checked: input.checked,
37
+ value: input.value,
38
+ error: (0, _helpers.hasError)(meta, error),
39
+ valid: (0, _helpers.isValid)(meta, valid, showValidStatus),
40
+ validationText: (0, _helpers.getValidationText)(meta, validationText, error),
41
+ onFocus: (0, _helpers.createFocusHandler)(input, onFocus),
42
+ onChange: (0, _helpers.createToggleChangeHandler)(input),
43
+ onBlur: (0, _helpers.createBlurHandler)(input, onBlur)
44
+ }));
45
+ };
43
46
 
44
47
  exports.RadioFieldFF = RadioFieldFF;
45
48
  RadioFieldFF.propTypes = {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Statuses = exports.Default = exports.default = void 0;
6
+ exports.default = exports.Statuses = exports.Default = void 0;
7
7
 
8
8
  var _field = require("@dhis2-ui/field");
9
9
 
@@ -19,33 +19,9 @@ var _RadioFieldFF = require("./RadioFieldFF.js");
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
- const description = `
23
- The \`RadioFieldFF\` is a wrapper around a \`Radio\` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.
24
-
25
- #### Final Form
26
-
27
- See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
28
-
29
- Inside a Final Form \`<Form>\` component, these 'FF' UI components are intended to be used in the \`component\` prop of the [Final Form \`<Field>\` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. \`<Field component={RadioFieldFF} />\`. See the code samples below for examples.
30
-
31
- #### Props
32
-
33
- The props shown in the table below are generally provided to the \`RadioFieldFF\` wrapper by the Final Form \`Field\`.
34
-
35
- Note that any props beyond the API of the \`Field\` component will be spread to the \`RadioFieldFF\`, which passes any extra props to the underlying \`Radio\` using \`{...rest}\`.
36
-
37
- Therefore, to add any props to the \`RadioFieldFF\` or \`Radio\`, add those props to the parent Final Form \`Field\` component.
38
-
39
- Also see \`Radio\` for notes about props and implementation.
40
-
41
- \`\`\`js
42
- import { RadioFieldFF } from '@dhis2/ui'
43
- \`\`\`
44
-
45
- Press **Submit** to see the form values logged to the console.
46
- `;
22
+ const description = "\nThe `RadioFieldFF` is a wrapper around a `Radio` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.\n\n#### Final Form\n\nSee how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).\n\nInside a Final Form `<Form>` component, these 'FF' UI components are intended to be used in the `component` prop of the [Final Form `<Field>` components](https://final-form.org/docs/react-final-form/api/Field) where they will receive some props from the Field, e.g. `<Field component={RadioFieldFF} />`. See the code samples below for examples.\n\n#### Props\n\nThe props shown in the table below are generally provided to the `RadioFieldFF` wrapper by the Final Form `Field`.\n\nNote that any props beyond the API of the `Field` component will be spread to the `RadioFieldFF`, which passes any extra props to the underlying `Radio` using `{...rest}`.\n\nTherefore, to add any props to the `RadioFieldFF` or `Radio`, add those props to the parent Final Form `Field` component.\n\nAlso see `Radio` for notes about props and implementation.\n\n```js\nimport { RadioFieldFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n";
47
23
  var _default = {
48
- title: 'Forms/Radio/Radio Field (Final Form)',
24
+ title: 'Radio Field (Final Form)',
49
25
  component: _RadioFieldFF.RadioFieldFF,
50
26
  decorators: [_formDecorator.formDecorator],
51
27
  parameters: {