@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
@@ -2,7 +2,6 @@
2
2
  "Upload file": "Carregar arquivo",
3
3
  "Upload files": "",
4
4
  "Remove": "Remover",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "Carregar arquivo",
3
3
  "Upload files": "",
4
4
  "Remove": "Remover",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "Загрузить файл",
3
3
  "Upload files": "",
4
4
  "Remove": "Убрать",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "",
3
3
  "Upload files": "",
4
4
  "Remove": "Avlägsna",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "",
3
3
  "Upload files": "",
4
4
  "Remove": "Hasai",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "Боркунии файл",
3
3
  "Upload files": "",
4
4
  "Remove": "Тоза кардан",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "",
3
3
  "Upload files": "",
4
4
  "Remove": "Прибрати",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "",
3
3
  "Upload files": "",
4
4
  "Remove": "حذف",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "Файлни юклаш",
3
3
  "Upload files": "",
4
4
  "Remove": "Олиб ташлаш",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "Faylni yuklash",
3
3
  "Upload files": "",
4
4
  "Remove": "Олиб ташлаш",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "Tải một tập tin",
3
3
  "Upload files": "",
4
4
  "Remove": "Tháo ra",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "上传文件",
3
3
  "Upload files": "上传文件",
4
4
  "Remove": "移除",
5
- "No file(s) selected yet": "尚未选择任何文件",
6
5
  "Please provide an alpha-numeric value": "请提供字母数字值",
7
6
  "Please provide a boolean value": "请提供一个布尔值",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "请在 {{lowerBound}} 和 {{upperBound}} 个字符之间输入",
@@ -2,7 +2,6 @@
2
2
  "Upload file": "",
3
3
  "Upload files": "",
4
4
  "Remove": "移除",
5
- "No file(s) selected yet": "",
6
5
  "Please provide an alpha-numeric value": "",
7
6
  "Please provide a boolean value": "",
8
7
  "Please enter between {{lowerBound}} and {{upperBound}} characters": "",
@@ -1,21 +1,24 @@
1
1
  const PRIMITIVE_TYPES = new Set(['string', 'number', 'boolean']);
2
2
 
3
- const createChangeHandler = ({
4
- onChange
5
- }) => payload => {
6
- if (payload && 'value' in payload) {
7
- // ui event signature
8
- onChange(payload.value);
9
- } else if (payload && payload.target && 'value' in payload.target) {
10
- // synthetic event
11
- onChange(payload.target.value);
12
- } else if (PRIMITIVE_TYPES.has(typeof payload)) {
13
- // directly usable value
14
- onChange(payload);
15
- } else {
16
- // ¯\_()_/¯
17
- throw new Error('Could not process event payload');
18
- }
3
+ const createChangeHandler = _ref => {
4
+ let {
5
+ onChange
6
+ } = _ref;
7
+ return payload => {
8
+ if (payload && 'value' in payload) {
9
+ // ui event signature
10
+ onChange(payload.value);
11
+ } else if (payload && payload.target && 'value' in payload.target) {
12
+ // synthetic event
13
+ onChange(payload.target.value);
14
+ } else if (PRIMITIVE_TYPES.has(typeof payload)) {
15
+ // directly usable value
16
+ onChange(payload);
17
+ } else {
18
+ // ¯\_(ツ)_/¯
19
+ throw new Error('Could not process event payload');
20
+ }
21
+ };
19
22
  };
20
23
 
21
24
  export { createChangeHandler };
@@ -1,9 +1,13 @@
1
- const createSelectChangeHandler = ({
2
- onChange
3
- }) => ({
4
- selected
5
- }) => {
6
- onChange(selected);
1
+ const createSelectChangeHandler = _ref => {
2
+ let {
3
+ onChange
4
+ } = _ref;
5
+ return _ref2 => {
6
+ let {
7
+ selected
8
+ } = _ref2;
9
+ onChange(selected);
10
+ };
7
11
  };
8
12
 
9
13
  export { createSelectChangeHandler };
@@ -1,6 +1,9 @@
1
- const format = value => !value ? [] : value.map(({
2
- id
3
- }) => id);
1
+ const format = value => !value ? [] : value.map(_ref => {
2
+ let {
3
+ id
4
+ } = _ref;
5
+ return id;
6
+ });
4
7
 
5
8
  const parse = value => !value || Array.isArray(value) && value.length === 0 ? undefined : value.map(id => ({
6
9
  id
@@ -20,7 +20,7 @@ describe('validator: createPattern', () => {
20
20
  });
21
21
  it('should return an error string when input does not match the pattern', () => {
22
22
  const escapedRegexString = '/^test$/';
23
- const invalidMsg = `Please make sure the value of this input matches the pattern ${escapedRegexString}.`;
23
+ const invalidMsg = "Please make sure the value of this input matches the pattern ".concat(escapedRegexString, ".");
24
24
  expect(equalToTestPattern('bad input')).toEqual(invalidMsg);
25
25
  });
26
26
  it('should return an custon error string when one was provided and input does not match the pattern', () => {
@@ -1,5 +1,13 @@
1
- export const composeValidators = (...validators) => {
2
- return (...args) => {
1
+ export const composeValidators = function () {
2
+ for (var _len = arguments.length, validators = new Array(_len), _key = 0; _key < _len; _key++) {
3
+ validators[_key] = arguments[_key];
4
+ }
5
+
6
+ return function () {
7
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
8
+ args[_key2] = arguments[_key2];
9
+ }
10
+
3
11
  return validators.reduce((error, validator) => error || validator(...args), undefined);
4
12
  };
5
13
  };
@@ -4,7 +4,7 @@ const testValidatorValues = (validator, returnValue, values) => {
4
4
  for (const value of values) {
5
5
  const type = typeof value;
6
6
  const valueStr = type === 'object' ? JSON.stringify(value) : value;
7
- it(`should return ${returnValueStr} for value \`${valueStr}\` of type ${type}`, () => {
7
+ it("should return ".concat(returnValueStr, " for value `").concat(valueStr, "` of type ").concat(type), () => {
8
8
  expect(validator(value)).toBe(returnValue);
9
9
  });
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/ui-forms",
3
- "version": "8.2.0",
3
+ "version": "8.2.3",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "sideEffects": [
@@ -34,15 +34,15 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@dhis2/prop-types": "^3.0.0-beta.1",
37
- "@dhis2-ui/button": "8.2.0",
38
- "@dhis2-ui/checkbox": "8.2.0",
39
- "@dhis2-ui/field": "8.2.0",
40
- "@dhis2-ui/file-input": "8.2.0",
41
- "@dhis2-ui/input": "8.2.0",
42
- "@dhis2-ui/radio": "8.2.0",
43
- "@dhis2-ui/select": "8.2.0",
44
- "@dhis2-ui/switch": "8.2.0",
45
- "@dhis2-ui/text-area": "8.2.0",
37
+ "@dhis2-ui/button": "8.2.3",
38
+ "@dhis2-ui/checkbox": "8.2.3",
39
+ "@dhis2-ui/field": "8.2.3",
40
+ "@dhis2-ui/file-input": "8.2.3",
41
+ "@dhis2-ui/input": "8.2.3",
42
+ "@dhis2-ui/radio": "8.2.3",
43
+ "@dhis2-ui/select": "8.2.3",
44
+ "@dhis2-ui/switch": "8.2.3",
45
+ "@dhis2-ui/text-area": "8.2.3",
46
46
  "classnames": "^2.3.1",
47
47
  "final-form": "^4.20.2",
48
48
  "prop-types": "^15.7.2",