@dhis2/ui-forms 9.10.3 → 9.11.1-beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. package/build/cjs/CheckboxFieldFF/{CheckboxFieldFF.stories.e2e.js → CheckboxFieldFF.e2e.stories.js} +22 -15
  2. package/build/cjs/CheckboxFieldFF/CheckboxFieldFF.js +2 -12
  3. package/build/cjs/CheckboxFieldFF/{CheckboxFieldFF.stories.js → CheckboxFieldFF.prod.stories.js} +29 -24
  4. package/build/cjs/CheckboxFieldFF/features/can_toggle_a_boolean/index.js +0 -1
  5. package/build/cjs/CheckboxFieldFF/features/can_toggle_a_value/index.js +0 -1
  6. package/build/cjs/CheckboxFieldFF/features/common/index.js +0 -1
  7. package/build/cjs/CheckboxFieldFF/features/displays_error/index.js +0 -2
  8. package/build/cjs/FieldGroupFF/FieldGroupFF.js +1 -10
  9. package/build/cjs/FieldGroupFF/{FieldGroupFF.stories.js → FieldGroupFF.prod.stories.js} +11 -12
  10. package/build/cjs/FileInputFieldFF/{FileInputFieldFF.stories.e2e.js → FileInputFieldFF.e2e.stories.js} +45 -56
  11. package/build/cjs/FileInputFieldFF/FileInputFieldFF.js +2 -19
  12. package/build/cjs/FileInputFieldFF/{FileInputFieldFF.stories.js → FileInputFieldFF.prod.stories.js} +29 -22
  13. package/build/cjs/FileInputFieldFF/features/accepts_file/index.js +0 -1
  14. package/build/cjs/FileInputFieldFF/features/common/index.js +0 -1
  15. package/build/cjs/FileInputFieldFF/features/displays_error/index.js +0 -1
  16. package/build/cjs/InputFieldFF/InputFieldFF.e2e.stories.js +30 -0
  17. package/build/cjs/InputFieldFF/InputFieldFF.js +2 -12
  18. package/build/cjs/InputFieldFF/{InputFieldFF.stories.js → InputFieldFF.prod.stories.js} +29 -22
  19. package/build/cjs/InputFieldFF/features/can_set_a_value/index.js +0 -1
  20. package/build/cjs/InputFieldFF/features/displays_error/index.js +0 -2
  21. package/build/cjs/MultiSelectFieldFF/{MultiSelectFieldFF.stories.e2e.js → MultiSelectFieldFF.e2e.stories.js} +15 -17
  22. package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.js +3 -15
  23. package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.prod.stories.js +107 -0
  24. package/build/cjs/MultiSelectFieldFF/features/can_set_a_value/index.js +0 -1
  25. package/build/cjs/MultiSelectFieldFF/features/common/index.js +1 -2
  26. package/build/cjs/MultiSelectFieldFF/features/displays_error/index.js +0 -2
  27. package/build/cjs/RadioFieldFF/RadioFieldFF.e2e.stories.js +45 -0
  28. package/build/cjs/RadioFieldFF/RadioFieldFF.js +2 -12
  29. package/build/cjs/RadioFieldFF/{RadioFieldFF.stories.js → RadioFieldFF.prod.stories.js} +29 -16
  30. package/build/cjs/RadioFieldFF/features/can_set_a_value/index.js +0 -1
  31. package/build/cjs/RadioFieldFF/features/common/index.js +0 -1
  32. package/build/cjs/RadioFieldFF/features/displays_error/index.js +0 -2
  33. package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.e2e.stories.js +39 -0
  34. package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.js +2 -12
  35. package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.prod.stories.js +106 -0
  36. package/build/cjs/SingleSelectFieldFF/features/can_set_a_value/index.js +0 -1
  37. package/build/cjs/SingleSelectFieldFF/features/common/index.js +0 -1
  38. package/build/cjs/SingleSelectFieldFF/features/displays_error/index.js +0 -2
  39. package/build/cjs/SwitchFieldFF/SwitchFieldFF.e2e.stories.js +56 -0
  40. package/build/cjs/SwitchFieldFF/SwitchFieldFF.js +2 -12
  41. package/build/cjs/SwitchFieldFF/{SwitchFieldFF.stories.js → SwitchFieldFF.prod.stories.js} +29 -24
  42. package/build/cjs/SwitchFieldFF/features/can_toggle_a_boolean/index.js +0 -1
  43. package/build/cjs/SwitchFieldFF/features/can_toggle_a_value/index.js +0 -1
  44. package/build/cjs/SwitchFieldFF/features/common/index.js +0 -1
  45. package/build/cjs/SwitchFieldFF/features/displays_error/index.js +0 -2
  46. package/build/cjs/TextAreaFieldFF/TextAreaFieldFF.e2e.stories.js +30 -0
  47. package/build/cjs/TextAreaFieldFF/TextAreaFieldFF.js +2 -12
  48. package/build/cjs/TextAreaFieldFF/{TextAreaFieldFF.stories.js → TextAreaFieldFF.prod.stories.js} +29 -24
  49. package/build/cjs/TextAreaFieldFF/features/can_set_a_value/index.js +0 -1
  50. package/build/cjs/TextAreaFieldFF/features/displays_error/index.js +0 -2
  51. package/build/cjs/__tests__/__snapshots__/index.test.js.snap +3 -0
  52. package/build/cjs/__tests__/index.test.js +1 -1
  53. package/build/cjs/formDecorator.js +6 -21
  54. package/build/cjs/index.js +2 -21
  55. package/build/cjs/locales/index.js +3 -75
  56. package/build/cjs/shared/helpers/createBlurHandler.js +0 -3
  57. package/build/cjs/shared/helpers/createChangeHandler.js +0 -2
  58. package/build/cjs/shared/helpers/createFocusHandler.js +0 -3
  59. package/build/cjs/shared/helpers/createSelectChangeHandler.js +0 -2
  60. package/build/cjs/shared/helpers/createToggleChangeHandler.js +0 -3
  61. package/build/cjs/shared/helpers/getValidationText.js +0 -6
  62. package/build/cjs/shared/helpers/hasError.js +0 -2
  63. package/build/cjs/shared/helpers/isLoading.js +0 -2
  64. package/build/cjs/shared/helpers/isValid.js +0 -2
  65. package/build/cjs/shared/helpers.js +0 -9
  66. package/build/cjs/shared/propTypes.js +7 -20
  67. package/build/cjs/transformers/arrayWithIdObjects.js +2 -6
  68. package/build/cjs/transformers/index.js +0 -1
  69. package/build/cjs/validators/__tests__/alphaNumeric.test.js +0 -2
  70. package/build/cjs/validators/__tests__/boolean.test.js +0 -2
  71. package/build/cjs/validators/__tests__/composeValidators.test.js +0 -3
  72. package/build/cjs/validators/__tests__/createCharacterLengthRange.test.js +6 -6
  73. package/build/cjs/validators/__tests__/createEqualTo.test.js +0 -3
  74. package/build/cjs/validators/__tests__/createMaxCharacterLength.test.js +1 -2
  75. package/build/cjs/validators/__tests__/createMaxNumber.test.js +1 -2
  76. package/build/cjs/validators/__tests__/createMinCharacterLength.test.js +1 -2
  77. package/build/cjs/validators/__tests__/createMinNumber.test.js +1 -2
  78. package/build/cjs/validators/__tests__/createNumberRange.test.js +0 -3
  79. package/build/cjs/validators/__tests__/createPattern.test.js +1 -3
  80. package/build/cjs/validators/__tests__/dhis2Password.test.js +0 -2
  81. package/build/cjs/validators/__tests__/dhis2Username.test.js +0 -2
  82. package/build/cjs/validators/__tests__/email.test.js +7 -6
  83. package/build/cjs/validators/__tests__/hasValue.test.js +0 -2
  84. package/build/cjs/validators/__tests__/integer.test.js +0 -2
  85. package/build/cjs/validators/__tests__/internationalPhoneNumber.test.js +6 -5
  86. package/build/cjs/validators/__tests__/number.test.js +0 -2
  87. package/build/cjs/validators/__tests__/string.test.js +0 -2
  88. package/build/cjs/validators/__tests__/url.test.js +1 -2
  89. package/build/cjs/validators/alphaNumeric.js +2 -11
  90. package/build/cjs/validators/boolean.js +2 -10
  91. package/build/cjs/validators/composeValidators.js +0 -4
  92. package/build/cjs/validators/createCharacterLengthRange.js +1 -8
  93. package/build/cjs/validators/createEqualTo.js +1 -8
  94. package/build/cjs/validators/createMaxCharacterLength.js +1 -6
  95. package/build/cjs/validators/createMaxNumber.js +1 -6
  96. package/build/cjs/validators/createMinCharacterLength.js +1 -6
  97. package/build/cjs/validators/createMinNumber.js +1 -6
  98. package/build/cjs/validators/createNumberRange.js +1 -8
  99. package/build/cjs/validators/createPattern.js +2 -10
  100. package/build/cjs/validators/dhis2Password.js +6 -28
  101. package/build/cjs/validators/dhis2Username.js +2 -11
  102. package/build/cjs/validators/email.js +3 -11
  103. package/build/cjs/validators/hasValue.js +2 -10
  104. package/build/cjs/validators/helpers/index.js +1 -16
  105. package/build/cjs/validators/index.js +0 -20
  106. package/build/cjs/validators/integer.js +3 -10
  107. package/build/cjs/validators/internationalPhoneNumber.js +8 -14
  108. package/build/cjs/validators/number.js +2 -10
  109. package/build/cjs/validators/string.js +2 -10
  110. package/build/cjs/validators/test-helpers/index.js +1 -6
  111. package/build/cjs/validators/url.js +2 -11
  112. package/build/es/CheckboxFieldFF/{CheckboxFieldFF.stories.e2e.js → CheckboxFieldFF.e2e.stories.js} +14 -7
  113. package/build/es/CheckboxFieldFF/CheckboxFieldFF.js +1 -3
  114. package/build/es/CheckboxFieldFF/{CheckboxFieldFF.stories.js → CheckboxFieldFF.prod.stories.js} +29 -3
  115. package/build/es/FieldGroupFF/FieldGroupFF.js +0 -2
  116. package/build/es/FieldGroupFF/{FieldGroupFF.stories.js → FieldGroupFF.prod.stories.js} +11 -1
  117. package/build/es/FileInputFieldFF/{FileInputFieldFF.stories.e2e.js → FileInputFieldFF.e2e.stories.js} +14 -16
  118. package/build/es/FileInputFieldFF/FileInputFieldFF.js +1 -8
  119. package/build/es/FileInputFieldFF/{FileInputFieldFF.stories.js → FileInputFieldFF.prod.stories.js} +29 -3
  120. package/build/es/InputFieldFF/{InputFieldFF.stories.e2e.js → InputFieldFF.e2e.stories.js} +8 -4
  121. package/build/es/InputFieldFF/InputFieldFF.js +1 -3
  122. package/build/es/InputFieldFF/{InputFieldFF.stories.js → InputFieldFF.prod.stories.js} +29 -3
  123. package/build/es/MultiSelectFieldFF/{MultiSelectFieldFF.stories.e2e.js → MultiSelectFieldFF.e2e.stories.js} +7 -7
  124. package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.js +2 -6
  125. package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.prod.stories.js +98 -0
  126. package/build/es/MultiSelectFieldFF/features/common/index.js +1 -1
  127. package/build/es/RadioFieldFF/{RadioFieldFF.stories.e2e.js → RadioFieldFF.e2e.stories.js} +6 -3
  128. package/build/es/RadioFieldFF/RadioFieldFF.js +1 -3
  129. package/build/es/RadioFieldFF/{RadioFieldFF.stories.js → RadioFieldFF.prod.stories.js} +29 -3
  130. package/build/es/SingleSelectFieldFF/{SingleSelectFieldFF.stories.e2e.js → SingleSelectFieldFF.e2e.stories.js} +10 -6
  131. package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.js +1 -3
  132. package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.prod.stories.js +97 -0
  133. package/build/es/SwitchFieldFF/{SwitchFieldFF.stories.e2e.js → SwitchFieldFF.e2e.stories.js} +14 -7
  134. package/build/es/SwitchFieldFF/SwitchFieldFF.js +1 -3
  135. package/build/es/SwitchFieldFF/{SwitchFieldFF.stories.js → SwitchFieldFF.prod.stories.js} +29 -3
  136. package/build/es/TextAreaFieldFF/{TextAreaFieldFF.stories.e2e.js → TextAreaFieldFF.e2e.stories.js} +8 -4
  137. package/build/es/TextAreaFieldFF/TextAreaFieldFF.js +1 -3
  138. package/build/es/TextAreaFieldFF/{TextAreaFieldFF.stories.js → TextAreaFieldFF.prod.stories.js} +29 -3
  139. package/build/es/__tests__/__snapshots__/index.test.js.snap +3 -0
  140. package/build/es/__tests__/index.test.js +1 -0
  141. package/build/es/formDecorator.js +5 -12
  142. package/build/es/index.js +2 -2
  143. package/build/es/shared/helpers/createBlurHandler.js +0 -2
  144. package/build/es/shared/helpers/createChangeHandler.js +0 -2
  145. package/build/es/shared/helpers/createFocusHandler.js +0 -2
  146. package/build/es/shared/helpers/createSelectChangeHandler.js +0 -1
  147. package/build/es/shared/helpers/createToggleChangeHandler.js +0 -2
  148. package/build/es/shared/helpers/getValidationText.js +0 -5
  149. package/build/es/shared/helpers/hasError.js +0 -1
  150. package/build/es/shared/helpers/isLoading.js +0 -1
  151. package/build/es/shared/helpers/isValid.js +0 -1
  152. package/build/es/transformers/arrayWithIdObjects.js +0 -2
  153. package/build/es/validators/__tests__/createCharacterLengthRange.test.js +6 -3
  154. package/build/es/validators/__tests__/createMaxCharacterLength.test.js +1 -0
  155. package/build/es/validators/__tests__/createMaxNumber.test.js +1 -0
  156. package/build/es/validators/__tests__/createMinCharacterLength.test.js +1 -0
  157. package/build/es/validators/__tests__/createMinNumber.test.js +1 -0
  158. package/build/es/validators/__tests__/createPattern.test.js +1 -1
  159. package/build/es/validators/__tests__/email.test.js +7 -4
  160. package/build/es/validators/__tests__/internationalPhoneNumber.test.js +6 -3
  161. package/build/es/validators/__tests__/url.test.js +1 -0
  162. package/build/es/validators/alphaNumeric.js +0 -2
  163. package/build/es/validators/boolean.js +0 -2
  164. package/build/es/validators/composeValidators.js +0 -2
  165. package/build/es/validators/createCharacterLengthRange.js +0 -2
  166. package/build/es/validators/createEqualTo.js +0 -2
  167. package/build/es/validators/createMaxCharacterLength.js +0 -2
  168. package/build/es/validators/createMaxNumber.js +0 -2
  169. package/build/es/validators/createMinCharacterLength.js +0 -2
  170. package/build/es/validators/createMinNumber.js +0 -2
  171. package/build/es/validators/createNumberRange.js +0 -2
  172. package/build/es/validators/createPattern.js +0 -3
  173. package/build/es/validators/dhis2Password.js +3 -12
  174. package/build/es/validators/dhis2Username.js +0 -2
  175. package/build/es/validators/email.js +1 -2
  176. package/build/es/validators/hasValue.js +0 -2
  177. package/build/es/validators/integer.js +3 -4
  178. package/build/es/validators/internationalPhoneNumber.js +7 -7
  179. package/build/es/validators/number.js +0 -2
  180. package/build/es/validators/string.js +0 -2
  181. package/build/es/validators/test-helpers/index.js +1 -4
  182. package/build/es/validators/url.js +2 -3
  183. package/package.json +13 -13
  184. package/build/cjs/InputFieldFF/InputFieldFF.stories.e2e.js +0 -27
  185. package/build/cjs/MultiSelectFieldFF/MultiSelectFieldFF.stories.js +0 -91
  186. package/build/cjs/RadioFieldFF/RadioFieldFF.stories.e2e.js +0 -45
  187. package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.stories.e2e.js +0 -37
  188. package/build/cjs/SingleSelectFieldFF/SingleSelectFieldFF.stories.js +0 -90
  189. package/build/cjs/SwitchFieldFF/SwitchFieldFF.stories.e2e.js +0 -49
  190. package/build/cjs/TextAreaFieldFF/TextAreaFieldFF.stories.e2e.js +0 -27
  191. package/build/es/MultiSelectFieldFF/MultiSelectFieldFF.stories.js +0 -70
  192. package/build/es/SingleSelectFieldFF/SingleSelectFieldFF.stories.js +0 -69
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.RequiredAndNoSelectedValue = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactFinalForm = require("react-final-form");
9
+ var _FieldGroupFF = require("../FieldGroupFF/FieldGroupFF.js");
10
+ var _formDecorator = require("../formDecorator.js");
11
+ var _index = require("../validators/index.js");
12
+ var _RadioFieldFF = require("./RadioFieldFF.js");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ var _default = exports.default = {
15
+ title: 'Testing:RadioFieldFF',
16
+ decorators: [_formDecorator.formDecorator]
17
+ };
18
+ const RequiredAndNoSelectedValue = () => /*#__PURE__*/_react.default.createElement(_FieldGroupFF.FieldGroupFF, {
19
+ name: "choice"
20
+ }, /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
21
+ type: "radio",
22
+ component: _RadioFieldFF.RadioFieldFF,
23
+ name: "choice",
24
+ label: "One",
25
+ value: "one",
26
+ validate: _index.hasValue,
27
+ required: true
28
+ }), /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
29
+ type: "radio",
30
+ component: _RadioFieldFF.RadioFieldFF,
31
+ name: "choice",
32
+ label: "Two",
33
+ value: "two",
34
+ validate: _index.hasValue,
35
+ required: true
36
+ }), /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
37
+ type: "radio",
38
+ component: _RadioFieldFF.RadioFieldFF,
39
+ name: "choice",
40
+ label: "Three",
41
+ value: "three",
42
+ validate: _index.hasValue,
43
+ required: true
44
+ }));
45
+ exports.RequiredAndNoSelectedValue = RequiredAndNoSelectedValue;
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RadioFieldFF = void 0;
7
-
8
7
  var _radio = require("@dhis2-ui/radio");
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _react = _interopRequireDefault(require("react"));
13
-
14
10
  var _helpers = require("../shared/helpers.js");
15
-
16
11
  var _propTypes2 = require("../shared/propTypes.js");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
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
-
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
22
14
  const RadioFieldFF = _ref => {
23
15
  let {
24
16
  error,
@@ -43,12 +35,10 @@ const RadioFieldFF = _ref => {
43
35
  onBlur: (0, _helpers.createBlurHandler)(input, onBlur)
44
36
  }));
45
37
  };
46
-
47
38
  exports.RadioFieldFF = RadioFieldFF;
48
39
  RadioFieldFF.propTypes = {
49
40
  /** `input` props received from Final Form `Field` */
50
41
  input: _propTypes2.inputPropType.isRequired,
51
-
52
42
  /** `meta` props received from Final Form `Field` */
53
43
  meta: _propTypes2.metaPropType.isRequired,
54
44
  error: _propTypes.default.bool,
@@ -4,23 +4,39 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.Statuses = exports.Default = void 0;
7
-
8
7
  var _field = require("@dhis2-ui/field");
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  var _reactFinalForm = require("react-final-form");
13
-
14
10
  var _formDecorator = require("../formDecorator.js");
15
-
16
11
  var _propTypes = require("../shared/propTypes.js");
17
-
18
12
  var _RadioFieldFF = require("./RadioFieldFF.js");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ const description = `
15
+ 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.
16
+
17
+ #### Final Form
18
+
19
+ See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
20
+
21
+ 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.
19
22
 
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+ #### Props
21
24
 
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";
23
- var _default = {
25
+ The props shown in the table below are generally provided to the \`RadioFieldFF\` wrapper by the Final Form \`Field\`.
26
+
27
+ 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}\`.
28
+
29
+ Therefore, to add any props to the \`RadioFieldFF\` or \`Radio\`, add those props to the parent Final Form \`Field\` component.
30
+
31
+ Also see \`Radio\` for notes about props and implementation.
32
+
33
+ \`\`\`js
34
+ import { RadioFieldFF } from '@dhis2/ui'
35
+ \`\`\`
36
+
37
+ Press **Submit** to see the form values logged to the console.
38
+ `;
39
+ var _default = exports.default = {
24
40
  title: 'Radio Field (Final Form)',
25
41
  component: _RadioFieldFF.RadioFieldFF,
26
42
  decorators: [_formDecorator.formDecorator],
@@ -32,14 +48,14 @@ var _default = {
32
48
  }
33
49
  },
34
50
  argTypes: {
35
- input: { ..._propTypes.inputArgType
51
+ input: {
52
+ ..._propTypes.inputArgType
36
53
  },
37
- meta: { ..._propTypes.metaArgType
54
+ meta: {
55
+ ..._propTypes.metaArgType
38
56
  }
39
57
  }
40
58
  };
41
- exports.default = _default;
42
-
43
59
  const Default = () => /*#__PURE__*/_react.default.createElement(_field.FieldGroup, null, /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
44
60
  type: "radio",
45
61
  component: _RadioFieldFF.RadioFieldFF,
@@ -59,9 +75,7 @@ const Default = () => /*#__PURE__*/_react.default.createElement(_field.FieldGrou
59
75
  label: "Three",
60
76
  value: "three"
61
77
  }));
62
-
63
78
  exports.Default = Default;
64
-
65
79
  const Statuses = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_field.FieldGroup, {
66
80
  label: "Valid"
67
81
  }, /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
@@ -90,5 +104,4 @@ const Statuses = () => /*#__PURE__*/_react.default.createElement(_react.default.
90
104
  value: "error",
91
105
  error: true
92
106
  })));
93
-
94
107
  exports.Statuses = Statuses;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
4
-
5
4
  (0, _cypressCucumberPreprocessor.Given)('there are three options', () => {
6
5
  const options = [{
7
6
  value: 'one',
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
4
-
5
4
  (0, _cypressCucumberPreprocessor.Given)('a FieldGroupFF with required RadioFieldFFs and no selected value', () => {
6
5
  cy.visitStory('Testing:RadioFieldFF', 'Required and no selected value');
7
6
  cy.verifyFormValue('choice', undefined);
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
4
-
5
4
  var _hasValue = require("../../../validators/hasValue.js");
6
-
7
5
  (0, _cypressCucumberPreprocessor.When)('the user submits the form', () => {
8
6
  cy.get('button[type="submit"]').click();
9
7
  });
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.Required = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactFinalForm = require("react-final-form");
9
+ var _formDecorator = require("../formDecorator.js");
10
+ var _index = require("../validators/index.js");
11
+ var _SingleSelectFieldFF = require("./SingleSelectFieldFF.js");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const defaultOptions = [{
14
+ value: 'initial',
15
+ label: 'Initial'
16
+ }];
17
+ var _default = exports.default = {
18
+ title: 'Testing:SingleSelectFieldFF',
19
+ decorators: [_formDecorator.formDecorator],
20
+ parameters: {
21
+ options: {
22
+ showPanel: false
23
+ }
24
+ }
25
+ };
26
+ const Required = (_, _ref) => {
27
+ let {
28
+ cypressProps
29
+ } = _ref;
30
+ return /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
31
+ required: true,
32
+ name: "singleSelect",
33
+ label: "Single select",
34
+ component: _SingleSelectFieldFF.SingleSelectFieldFF,
35
+ validate: _index.hasValue,
36
+ options: cypressProps.options || defaultOptions
37
+ });
38
+ };
39
+ exports.Required = Required;
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SingleSelectFieldFF = void 0;
7
-
8
7
  var _select = require("@dhis2-ui/select");
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _react = _interopRequireDefault(require("react"));
13
-
14
10
  var _helpers = require("../shared/helpers.js");
15
-
16
11
  var _propTypes2 = require("../shared/propTypes.js");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
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
-
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
22
14
  const SingleSelectFieldFF = _ref => {
23
15
  let {
24
16
  error,
@@ -48,12 +40,10 @@ const SingleSelectFieldFF = _ref => {
48
40
  key: option.value
49
41
  }, option))));
50
42
  };
51
-
52
43
  exports.SingleSelectFieldFF = SingleSelectFieldFF;
53
44
  SingleSelectFieldFF.propTypes = {
54
45
  /** `input` props received from Final Form `Field` */
55
46
  input: _propTypes2.inputPropType.isRequired,
56
-
57
47
  /** `meta` props received from Final Form `Field` */
58
48
  meta: _propTypes2.metaPropType.isRequired,
59
49
  options: _propTypes.default.arrayOf(_propTypes.default.shape({
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.InitialValue = exports.Default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactFinalForm = require("react-final-form");
9
+ var _formDecorator = require("../formDecorator.js");
10
+ var _propTypes = require("../shared/propTypes.js");
11
+ var _SingleSelectFieldFF = require("./SingleSelectFieldFF.js");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const description = `
14
+ The \`SingleSelectFieldFF\` is a wrapper around a \`SingleSelectField\` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.
15
+
16
+ #### Final Form
17
+
18
+ See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
19
+
20
+ 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={SingleSelectFieldFF} />\`. See the code samples below for examples.
21
+
22
+ #### Props
23
+
24
+ The props shown in the table below are generally provided to the \`SingleSelectFieldFF\` wrapper by the Final Form \`Field\`.
25
+
26
+ Note that any props beyond the API of the \`Field\` component will be spread to the \`SingleSelectFieldFF\`, which passes any extra props to the underlying \`SingleSelectField\` using \`{...rest}\`.
27
+
28
+ Therefore, to add any props to the \`SingleSelectFieldFF\` or \`SingleSelectField\`, add those props to the parent Final Form \`Field\` component.
29
+
30
+ Also see \`SingleSelect\` and \`SingleSelectField\` for notes about props and implementation.
31
+
32
+ \`\`\`js
33
+ import { SingleSelectFieldFF } from '@dhis2/ui'
34
+ \`\`\`
35
+
36
+ Press **Submit** to see the form values logged to the console.
37
+
38
+ _**Note:** Dropdowns may not appear correctly on this page. See the affected demos in the 'Canvas' tab for propper dropdown placement._
39
+ `;
40
+ const options = [{
41
+ value: '1',
42
+ label: 'one'
43
+ }, {
44
+ value: '2',
45
+ label: 'two'
46
+ }, {
47
+ value: '3',
48
+ label: 'three'
49
+ }, {
50
+ value: '4',
51
+ label: 'four'
52
+ }, {
53
+ value: '5',
54
+ label: 'five'
55
+ }, {
56
+ value: '6',
57
+ label: 'six'
58
+ }, {
59
+ value: '7',
60
+ label: 'seven'
61
+ }, {
62
+ value: '8',
63
+ label: 'eight'
64
+ }, {
65
+ value: '9',
66
+ label: 'nine'
67
+ }, {
68
+ value: '10',
69
+ label: 'ten'
70
+ }];
71
+ var _default = exports.default = {
72
+ title: 'Single Select Field (Final Form)',
73
+ component: _SingleSelectFieldFF.SingleSelectFieldFF,
74
+ decorators: [_formDecorator.formDecorator],
75
+ parameters: {
76
+ docs: {
77
+ description: {
78
+ component: description
79
+ }
80
+ }
81
+ },
82
+ argTypes: {
83
+ input: {
84
+ ..._propTypes.inputArgType
85
+ },
86
+ meta: {
87
+ ..._propTypes.metaArgType
88
+ }
89
+ }
90
+ };
91
+ const Default = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
92
+ component: _SingleSelectFieldFF.SingleSelectFieldFF,
93
+ name: "agree",
94
+ label: "Do you agree?",
95
+ options: options
96
+ });
97
+ exports.Default = Default;
98
+ const InitialValue = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
99
+ component: _SingleSelectFieldFF.SingleSelectFieldFF,
100
+ name: "agree",
101
+ label: "Do you agree?",
102
+ options: options,
103
+ initialValue: "4"
104
+ });
105
+ exports.InitialValue = InitialValue;
106
+ InitialValue.storyName = 'InitialValue';
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
4
-
5
4
  (0, _cypressCucumberPreprocessor.Given)('the SingleSelect has one option', () => {
6
5
  const options = [{
7
6
  value: 'Value',
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
4
-
5
4
  (0, _cypressCucumberPreprocessor.Given)('a required SingleSelect with no selected value', () => {
6
5
  cy.visitStory('Testing:SingleSelectFieldFF', 'Required');
7
6
  cy.verifyFormValue('singleSelect', undefined);
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
4
-
5
4
  var _hasValue = require("../../../validators/hasValue.js");
6
-
7
5
  (0, _cypressCucumberPreprocessor.When)('the user submits the form', () => {
8
6
  cy.get('button[type="submit"]').click();
9
7
  });
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.UncheckedWithValue = exports.Unchecked = exports.CheckedWithValue = exports.Checked = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactFinalForm = require("react-final-form");
9
+ var _formDecorator = require("../formDecorator.js");
10
+ var _index = require("../validators/index.js");
11
+ var _SwitchFieldFF = require("./SwitchFieldFF.js");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ // https://github.com/final-form/react-final-form-arrays/issues/111
14
+ const initialValue = ['yes'];
15
+ var _default = exports.default = {
16
+ title: 'Testing:SwitchFieldFF',
17
+ decorators: [_formDecorator.formDecorator]
18
+ };
19
+ const Unchecked = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
20
+ component: _SwitchFieldFF.SwitchFieldFF,
21
+ className: "switch",
22
+ name: "switch",
23
+ label: "Label text",
24
+ validate: _index.hasValue,
25
+ required: true,
26
+ type: "checkbox"
27
+ });
28
+ exports.Unchecked = Unchecked;
29
+ const Checked = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
30
+ component: _SwitchFieldFF.SwitchFieldFF,
31
+ className: "switch",
32
+ name: "switch",
33
+ label: "Label text",
34
+ initialValue: true,
35
+ type: "checkbox"
36
+ });
37
+ exports.Checked = Checked;
38
+ const UncheckedWithValue = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
39
+ component: _SwitchFieldFF.SwitchFieldFF,
40
+ className: "switch",
41
+ name: "switch",
42
+ label: "Label text",
43
+ value: "yes",
44
+ type: "checkbox"
45
+ });
46
+ exports.UncheckedWithValue = UncheckedWithValue;
47
+ const CheckedWithValue = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
48
+ component: _SwitchFieldFF.SwitchFieldFF,
49
+ className: "switch",
50
+ name: "switch",
51
+ label: "Label text",
52
+ value: "yes",
53
+ initialValue: initialValue,
54
+ type: "checkbox"
55
+ });
56
+ exports.CheckedWithValue = CheckedWithValue;
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SwitchFieldFF = void 0;
7
-
8
7
  var _switch = require("@dhis2-ui/switch");
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _react = _interopRequireDefault(require("react"));
13
-
14
10
  var _helpers = require("../shared/helpers.js");
15
-
16
11
  var _propTypes2 = require("../shared/propTypes.js");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
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
-
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
22
14
  const SwitchFieldFF = _ref => {
23
15
  let {
24
16
  error,
@@ -43,12 +35,10 @@ const SwitchFieldFF = _ref => {
43
35
  onBlur: (0, _helpers.createBlurHandler)(input, onBlur)
44
36
  }));
45
37
  };
46
-
47
38
  exports.SwitchFieldFF = SwitchFieldFF;
48
39
  SwitchFieldFF.propTypes = {
49
40
  /** `input` props received from Final Form `Field` */
50
41
  input: _propTypes2.inputPropType.isRequired,
51
-
52
42
  /** `meta` props received from Final Form `Field` */
53
43
  meta: _propTypes2.metaPropType.isRequired,
54
44
  error: _propTypes.default.bool,
@@ -4,23 +4,39 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.ValueWhenChecked = exports.Statuses = exports.Required = exports.HelpText = exports.Disabled = exports.Default = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _reactFinalForm = require("react-final-form");
11
-
12
9
  var _formDecorator = require("../formDecorator.js");
13
-
14
10
  var _propTypes = require("../shared/propTypes.js");
15
-
16
11
  var _index = require("../validators/index.js");
17
-
18
12
  var _SwitchFieldFF = require("./SwitchFieldFF.js");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ const description = `
15
+ The \`SwitchFieldFF\` is a wrapper around a \`SwitchField\` that enables it to work with Final Form, the preferred library for form validation and utilities in DHIS 2 apps.
16
+
17
+ #### Final Form
18
+
19
+ See how to use Final Form at [Final Form - Getting Started](https://final-form.org/docs/react-final-form/getting-started).
20
+
21
+ 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={SwitchFieldFF} />\`. See the code samples below for examples.
22
+
23
+ #### Props
24
+
25
+ The props shown in the table below are generally provided to the \`SwitchFieldFF\` wrapper by the Final Form \`Field\`.
26
+
27
+ Note that any props beyond the API of the \`Field\` component will be spread to the \`SwitchFieldFF\`, which passes any extra props to the underlying \`SwitchField\` using \`{...rest}\`.
28
+
29
+ Therefore, to add any props to the \`SwitchFieldFF\` or \`SwitchField\`, add those props to the parent Final Form \`Field\` component.
19
30
 
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
+ Also see \`Switch\` and \`SwitchField\` for notes about props and implementation.
21
32
 
22
- const description = "\nThe `SwitchFieldFF` is a wrapper around a `SwitchField` 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={SwitchFieldFF} />`. See the code samples below for examples.\n\n#### Props\n\nThe props shown in the table below are generally provided to the `SwitchFieldFF` wrapper by the Final Form `Field`.\n\nNote that any props beyond the API of the `Field` component will be spread to the `SwitchFieldFF`, which passes any extra props to the underlying `SwitchField` using `{...rest}`.\n\nTherefore, to add any props to the `SwitchFieldFF` or `SwitchField`, add those props to the parent Final Form `Field` component.\n\nAlso see `Switch` and `SwitchField` for notes about props and implementation.\n\n```js\nimport { SwitchFieldFF } from '@dhis2/ui'\n```\n\nPress **Submit** to see the form values logged to the console.\n";
23
- var _default = {
33
+ \`\`\`js
34
+ import { SwitchFieldFF } from '@dhis2/ui'
35
+ \`\`\`
36
+
37
+ Press **Submit** to see the form values logged to the console.
38
+ `;
39
+ var _default = exports.default = {
24
40
  title: 'Switch Field (Final Form)',
25
41
  component: _SwitchFieldFF.SwitchFieldFF,
26
42
  decorators: [_formDecorator.formDecorator],
@@ -32,23 +48,21 @@ var _default = {
32
48
  }
33
49
  },
34
50
  argTypes: {
35
- input: { ..._propTypes.inputArgType
51
+ input: {
52
+ ..._propTypes.inputArgType
36
53
  },
37
- meta: { ..._propTypes.metaArgType
54
+ meta: {
55
+ ..._propTypes.metaArgType
38
56
  }
39
57
  }
40
58
  };
41
- exports.default = _default;
42
-
43
59
  const Default = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
44
60
  type: "checkbox",
45
61
  component: _SwitchFieldFF.SwitchFieldFF,
46
62
  name: "agree",
47
63
  label: "Do you agree?"
48
64
  });
49
-
50
65
  exports.Default = Default;
51
-
52
66
  const Required = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
53
67
  type: "checkbox",
54
68
  name: "agree",
@@ -57,9 +71,7 @@ const Required = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm
57
71
  validate: _index.hasValue,
58
72
  label: "Do you agree?"
59
73
  });
60
-
61
74
  exports.Required = Required;
62
-
63
75
  const Disabled = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
64
76
  type: "checkbox",
65
77
  name: "agree",
@@ -67,9 +79,7 @@ const Disabled = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm
67
79
  disabled: true,
68
80
  label: "Do you agree?"
69
81
  });
70
-
71
82
  exports.Disabled = Disabled;
72
-
73
83
  const HelpText = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
74
84
  type: "checkbox",
75
85
  name: "agree",
@@ -77,10 +87,8 @@ const HelpText = () => /*#__PURE__*/_react.default.createElement(_reactFinalForm
77
87
  label: "Do you agree?",
78
88
  helpText: "Click to agree"
79
89
  });
80
-
81
90
  exports.HelpText = HelpText;
82
91
  HelpText.storyName = 'Help text';
83
-
84
92
  const Statuses = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
85
93
  type: "checkbox",
86
94
  name: "valid",
@@ -103,9 +111,7 @@ const Statuses = () => /*#__PURE__*/_react.default.createElement(_react.default.
103
111
  error: true,
104
112
  validationText: "Validation text"
105
113
  }));
106
-
107
114
  exports.Statuses = Statuses;
108
-
109
115
  const ValueWhenChecked = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactFinalForm.Field, {
110
116
  type: "checkbox",
111
117
  name: "bool",
@@ -127,7 +133,6 @@ const ValueWhenChecked = () => /*#__PURE__*/_react.default.createElement(_react.
127
133
  value: "another_value_when_checked",
128
134
  helpText: "Click submit and check the console"
129
135
  }));
130
-
131
136
  exports.ValueWhenChecked = ValueWhenChecked;
132
137
  ValueWhenChecked.parameters = {
133
138
  docs: {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
4
-
5
4
  (0, _cypressCucumberPreprocessor.Given)('an unchecked Switch without value is rendered', () => {
6
5
  cy.visitStory('Testing:SwitchFieldFF', 'Unchecked');
7
6
  cy.verifyFormValue('switch', undefined);
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
4
-
5
4
  (0, _cypressCucumberPreprocessor.Given)('an unchecked Switch with a value is rendered', () => {
6
5
  cy.visitStory('Testing:SwitchFieldFF', 'Unchecked with value');
7
6
  cy.verifyFormValue('switch', undefined);
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
4
-
5
4
  (0, _cypressCucumberPreprocessor.When)('the user clicks on the Switch', () => {
6
5
  cy.get('[data-test="dhis2-uicore-switch"]').click();
7
6
  });