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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/build/cjs/checkbox/__tests__/checkbox.test.js +1 -7
  2. package/build/cjs/checkbox/checkbox-icon.js +14 -24
  3. package/build/cjs/checkbox/checkbox.e2e.stories.js +72 -0
  4. package/build/cjs/checkbox/checkbox.js +7 -31
  5. package/build/cjs/checkbox/{checkbox.stories.js → checkbox.prod.stories.js} +54 -74
  6. package/build/cjs/checkbox/features/accepts_initial_focus/index.js +1 -2
  7. package/build/cjs/checkbox/features/accepts_label/index.js +0 -1
  8. package/build/cjs/checkbox/features/can_be_blurred/index.js +1 -2
  9. package/build/cjs/checkbox/features/can_be_changed/index.js +1 -2
  10. package/build/cjs/checkbox/features/can_be_disabled/index.js +1 -2
  11. package/build/cjs/checkbox/features/can_be_focused/index.js +1 -2
  12. package/build/cjs/checkbox/features/has_indeterminate_prop/index.js +0 -1
  13. package/build/cjs/checkbox/index.js +0 -1
  14. package/build/cjs/checkbox-field/__tests__/checkbox-field.test.js +1 -7
  15. package/build/cjs/checkbox-field/checkbox-field.e2e.stories.js +39 -0
  16. package/build/cjs/checkbox-field/checkbox-field.js +4 -30
  17. package/build/cjs/checkbox-field/{checkbox-field.stories.js → checkbox-field.prod.stories.js} +59 -74
  18. package/build/cjs/checkbox-field/features/accepts_help_text/index.js +0 -1
  19. package/build/cjs/checkbox-field/features/accepts_label/index.js +0 -1
  20. package/build/cjs/checkbox-field/features/accepts_validation_text/index.js +0 -1
  21. package/build/cjs/checkbox-field/features/can_be_required/index.js +0 -1
  22. package/build/cjs/checkbox-field/index.js +0 -1
  23. package/build/cjs/index.js +0 -2
  24. package/build/es/checkbox/checkbox-icon.js +13 -13
  25. package/build/es/checkbox/{checkbox.stories.e2e.js → checkbox.e2e.stories.js} +19 -10
  26. package/build/es/checkbox/checkbox.js +4 -19
  27. package/build/es/checkbox/{checkbox.stories.js → checkbox.prod.stories.js} +35 -25
  28. package/build/es/checkbox/features/accepts_initial_focus/index.js +1 -1
  29. package/build/es/checkbox/features/can_be_blurred/index.js +1 -1
  30. package/build/es/checkbox/features/can_be_changed/index.js +1 -1
  31. package/build/es/checkbox/features/can_be_disabled/index.js +1 -1
  32. package/build/es/checkbox/features/can_be_focused/index.js +1 -1
  33. package/build/es/checkbox-field/checkbox-field.e2e.stories.js +28 -0
  34. package/build/es/checkbox-field/checkbox-field.js +3 -22
  35. package/build/es/checkbox-field/{checkbox-field.stories.js → checkbox-field.prod.stories.js} +38 -23
  36. package/package.json +7 -7
  37. package/build/cjs/checkbox/checkbox.stories.e2e.js +0 -55
  38. package/build/cjs/checkbox-field/checkbox-field.stories.e2e.js +0 -30
  39. package/build/es/checkbox-field/checkbox-field.stories.e2e.js +0 -23
@@ -1,38 +1,40 @@
1
- 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); }
2
-
1
+ 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); }
3
2
  import { sharedPropTypes } from '@dhis2/ui-constants';
4
3
  import React from 'react';
5
4
  import { Checkbox } from './index.js';
6
5
  const subtitle = 'A checkbox is a control that allows a user to toggle an option.';
7
- const description = "\nCheckboxes are used when an option can be toggled on or off. Toggling a checkbox on (true) is always considered a positive action and should reflect a positive/true/on state. Multiple checkboxes can be used in a list where a user can toggle multiple elements.\n\nDo not use checkboxes in a list of several options where only a single option can be toggled, use [radio buttons](../?path=/docs/forms-radio-radio--default) here instead.\n\nIf there are many options that need to select from, consider using a [select](../?path=/docs/forms-single-select-single-select--with-options) instead.\n\n```js\nimport { Checkbox } from '@dhis2/ui'\n```\n";
6
+ const description = `
7
+ Checkboxes are used when an option can be toggled on or off. Toggling a checkbox on (true) is always considered a positive action and should reflect a positive/true/on state. Multiple checkboxes can be used in a list where a user can toggle multiple elements.
8
+
9
+ Do not use checkboxes in a list of several options where only a single option can be toggled, use [radio buttons](../?path=/docs/forms-radio-radio--default) here instead.
8
10
 
11
+ If there are many options that need to select from, consider using a [select](../?path=/docs/forms-single-select-single-select--with-options) instead.
12
+
13
+ \`\`\`js
14
+ import { Checkbox } from '@dhis2/ui'
15
+ \`\`\`
16
+ `;
9
17
  window.onChange = (payload, event) => {
10
18
  console.log('onClick payload', payload);
11
19
  console.log('onClick event', event);
12
20
  };
13
-
14
21
  window.onFocus = (payload, event) => {
15
22
  console.log('onFocus payload', payload);
16
23
  console.log('onFocus event', event);
17
24
  };
18
-
19
25
  window.onBlur = (payload, event) => {
20
26
  console.log('onBlur payload', payload);
21
27
  console.log('onBlur event', event);
22
28
  };
23
-
24
29
  const onChange = function () {
25
30
  return window.onChange(...arguments);
26
31
  };
27
-
28
32
  const onFocus = function () {
29
33
  return window.onFocus(...arguments);
30
34
  };
31
-
32
35
  const onBlur = function () {
33
36
  return window.onBlur(...arguments);
34
37
  };
35
-
36
38
  const defaultArgs = {
37
39
  name: 'Ex',
38
40
  label: 'Checkbox',
@@ -63,28 +65,31 @@ export default {
63
65
  }
64
66
  },
65
67
  // Sets default args on all stories unless overridden
66
- args: { ...defaultArgs
68
+ args: {
69
+ ...defaultArgs
67
70
  },
68
71
  argTypes: {
69
- checked: { ...uniqueOnStateArgType
72
+ checked: {
73
+ ...uniqueOnStateArgType
70
74
  },
71
- indeterminate: { ...uniqueOnStateArgType
75
+ indeterminate: {
76
+ ...uniqueOnStateArgType
72
77
  },
73
- valid: { ...sharedPropTypes.statusArgType
78
+ valid: {
79
+ ...sharedPropTypes.statusArgType
74
80
  },
75
- warning: { ...sharedPropTypes.statusArgType
81
+ warning: {
82
+ ...sharedPropTypes.statusArgType
76
83
  },
77
- error: { ...sharedPropTypes.statusArgType
84
+ error: {
85
+ ...sharedPropTypes.statusArgType
78
86
  }
79
87
  }
80
88
  };
81
-
82
89
  const Template = args => /*#__PURE__*/React.createElement(Checkbox, args);
83
-
84
90
  const CheckedUncheckedTemplate = args => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Checkbox, args), /*#__PURE__*/React.createElement(Checkbox, _extends({
85
91
  checked: true
86
92
  }, args)));
87
-
88
93
  export const Default = Template.bind({});
89
94
  Default.args = {
90
95
  value: 'default'
@@ -102,7 +107,6 @@ FocusedUnchecked.storyName = 'Focused unchecked';
102
107
  * 'initialFocus' causes docs page to scroll away every time a control is
103
108
  * changed, so it's disabled
104
109
  */
105
-
106
110
  FocusedUnchecked.parameters = {
107
111
  docs: {
108
112
  disable: true
@@ -178,7 +182,8 @@ FocusedUncheckedDense.parameters = {
178
182
  }
179
183
  };
180
184
  export const FocusedCheckedDense = Template.bind({});
181
- FocusedCheckedDense.args = { ...FocusedUncheckedDense.args,
185
+ FocusedCheckedDense.args = {
186
+ ...FocusedUncheckedDense.args,
182
187
  checked: true
183
188
  };
184
189
  FocusedCheckedDense.storyName = 'Focused checked - Dense';
@@ -202,27 +207,32 @@ IndeterminateDense.args = {
202
207
  };
203
208
  IndeterminateDense.storyName = 'Indeterminate - Dense';
204
209
  export const DisabledDense = CheckedUncheckedTemplate.bind({});
205
- DisabledDense.args = { ...Disabled.args,
210
+ DisabledDense.args = {
211
+ ...Disabled.args,
206
212
  dense: true
207
213
  };
208
214
  DisabledDense.storyName = 'Disabled - Dense';
209
215
  export const ValidDense = CheckedUncheckedTemplate.bind({});
210
- ValidDense.args = { ...Valid.args,
216
+ ValidDense.args = {
217
+ ...Valid.args,
211
218
  dense: true
212
219
  };
213
220
  ValidDense.storyName = 'Valid - Dense';
214
221
  export const WarningDense = CheckedUncheckedTemplate.bind({});
215
- WarningDense.args = { ...Warning.args,
222
+ WarningDense.args = {
223
+ ...Warning.args,
216
224
  dense: true
217
225
  };
218
226
  WarningDense.storyName = 'Warning - Dense';
219
227
  export const ErrorDense = CheckedUncheckedTemplate.bind({});
220
- ErrorDense.args = { ...Error.args,
228
+ ErrorDense.args = {
229
+ ...Error.args,
221
230
  dense: true
222
231
  };
223
232
  ErrorDense.storyName = 'Error - Dense';
224
233
  export const ImageLabelDense = Template.bind({});
225
- ImageLabelDense.args = { ...ImageLabel.args,
234
+ ImageLabelDense.args = {
235
+ ...ImageLabel.args,
226
236
  dense: true
227
237
  };
228
238
  ImageLabelDense.storyName = 'Image label - Dense';
@@ -1,6 +1,6 @@
1
1
  import { Given, Then } from '@badeball/cypress-cucumber-preprocessor';
2
2
  Given('a Checkbox with initialFocus is rendered', () => {
3
- cy.visitStory('Checkbox', 'With initialFocus');
3
+ cy.visitStory('Checkbox', 'With initial focus');
4
4
  });
5
5
  Then('the Checkbox is focused', () => {
6
6
  cy.focused().parent('[data-test="dhis2-uicore-checkbox"]').should('exist');
@@ -1,6 +1,6 @@
1
1
  import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
2
2
  Given('a Checkbox with initialFocus and onBlur handler is rendered', () => {
3
- cy.visitStory('Checkbox', 'With initialFocus and onBlur');
3
+ cy.visitStory('Checkbox', 'With initial focus and on blur');
4
4
  });
5
5
  When('the Checkbox is blurred', () => {
6
6
  cy.get('[data-test="dhis2-uicore-checkbox"] input').blur();
@@ -1,6 +1,6 @@
1
1
  import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
2
2
  Given('a Checkbox with onChange handler is rendered', () => {
3
- cy.visitStory('Checkbox', 'With onChange');
3
+ cy.visitStory('Checkbox', 'With on change');
4
4
  });
5
5
  When('the Checkbox is clicked', () => {
6
6
  cy.get('[data-test="dhis2-uicore-checkbox"]').click();
@@ -1,6 +1,6 @@
1
1
  import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
2
2
  Given('a disabled Checkbox with onClick handler is rendered', () => {
3
- cy.visitStory('Checkbox', 'Disabled with onClick');
3
+ cy.visitStory('Checkbox', 'Disabled with on click');
4
4
  });
5
5
  When('the Checkbox is clicked', () => {
6
6
  cy.get('[data-test="dhis2-uicore-checkbox"] input').click({
@@ -1,6 +1,6 @@
1
1
  import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
2
2
  Given('a Checkbox with onFocus handler is rendered', () => {
3
- cy.visitStory('Checkbox', 'With onFocus');
3
+ cy.visitStory('Checkbox', 'With on focus');
4
4
  });
5
5
  When('the Checkbox is focused', () => {
6
6
  cy.get('[data-test="dhis2-uicore-checkbox"] input').focus();
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { CheckboxField } from './index.js';
3
+ export default {
4
+ title: 'CheckboxField'
5
+ };
6
+ export const WithLabelAndRequired = () => /*#__PURE__*/React.createElement(CheckboxField, {
7
+ name: "Ex",
8
+ label: "CheckboxField",
9
+ required: true,
10
+ value: "checked"
11
+ });
12
+ export const WithHelpText = () => /*#__PURE__*/React.createElement(CheckboxField, {
13
+ name: "Ex",
14
+ label: "CheckboxField",
15
+ value: "checked",
16
+ helpText: "Help text"
17
+ });
18
+ export const WithLabel = () => /*#__PURE__*/React.createElement(CheckboxField, {
19
+ name: "Ex",
20
+ label: "The label",
21
+ value: "checked"
22
+ });
23
+ export const WithValidationText = () => /*#__PURE__*/React.createElement(CheckboxField, {
24
+ name: "Ex",
25
+ label: "The label",
26
+ value: "checked",
27
+ validationText: "Validation text"
28
+ });
@@ -1,10 +1,9 @@
1
+ import { sharedPropTypes } from '@dhis2/ui-constants';
1
2
  import { Field } from '@dhis2-ui/field';
2
3
  import { Required } from '@dhis2-ui/required';
3
- import { sharedPropTypes } from '@dhis2/ui-constants';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
- import { Checkbox } from '../index.js';
7
-
6
+ import { Checkbox } from '../checkbox/index.js';
8
7
  const AddRequired = _ref => {
9
8
  let {
10
9
  label,
@@ -12,16 +11,14 @@ const AddRequired = _ref => {
12
11
  dataTest
13
12
  } = _ref;
14
13
  return /*#__PURE__*/React.createElement(React.Fragment, null, label, required && /*#__PURE__*/React.createElement(Required, {
15
- dataTest: "".concat(dataTest, "-required")
14
+ dataTest: `${dataTest}-required`
16
15
  }));
17
16
  };
18
-
19
17
  AddRequired.propTypes = {
20
18
  dataTest: PropTypes.string,
21
19
  label: PropTypes.node,
22
20
  required: PropTypes.bool
23
21
  };
24
-
25
22
  const CheckboxField = _ref2 => {
26
23
  let {
27
24
  value,
@@ -76,7 +73,6 @@ const CheckboxField = _ref2 => {
76
73
  initialFocus: initialFocus
77
74
  }));
78
75
  };
79
-
80
76
  CheckboxField.defaultProps = {
81
77
  dataTest: 'dhis2-uiwidgets-checkboxfield'
82
78
  };
@@ -84,51 +80,36 @@ CheckboxField.propTypes = {
84
80
  checked: PropTypes.bool,
85
81
  className: PropTypes.string,
86
82
  dataTest: PropTypes.string,
87
-
88
83
  /** Smaller dimensions for information-dense layouts */
89
84
  dense: PropTypes.bool,
90
-
91
85
  /** Disables the checkbox */
92
86
  disabled: PropTypes.bool,
93
-
94
87
  /** Applies 'error' styling to checkbox and validation text for feedback. Mutually exclusive with `warning` and `valid` props */
95
88
  error: sharedPropTypes.statusPropType,
96
-
97
89
  /** Useful instructions for the user */
98
90
  helpText: PropTypes.string,
99
91
  initialFocus: PropTypes.bool,
100
-
101
92
  /** Labels the checkbox */
102
93
  label: PropTypes.node,
103
-
104
94
  /** Name associate with the checkbox. Passed in object as argument to event handlers */
105
95
  name: PropTypes.string,
106
-
107
96
  /** Adds an asterisk to indicate this field is required */
108
97
  required: PropTypes.bool,
109
98
  tabIndex: PropTypes.string,
110
-
111
99
  /** Applies 'valid' styling to checkbox and validation text for feedback. Mutually exclusive with `warning` and `error` props */
112
100
  valid: sharedPropTypes.statusPropType,
113
-
114
101
  /** Adds text below the checkbox to provide validation feedback. Acquires styles from `valid`, `warning` and `error` statuses */
115
102
  validationText: PropTypes.string,
116
-
117
103
  /** Value associated with the checkbox. Passed in object as argument to event handlers */
118
104
  value: PropTypes.string,
119
-
120
105
  /** Applies 'warning' styling to checkbox and validation text for feedback. Mutually exclusive with `valid` and `error` props */
121
106
  warning: sharedPropTypes.statusPropType,
122
-
123
107
  /** Called with signature `({ name: string, value: string, checked: bool }, event)` */
124
108
  onBlur: PropTypes.func,
125
-
126
109
  /** Called with signature `({ name: string, value: string, checked: bool }, event)` */
127
110
  onChange: PropTypes.func,
128
-
129
111
  /** Called with signature `({ name: string, value: string, checked: bool }, event)` */
130
112
  onFocus: PropTypes.func,
131
-
132
113
  /** Called with signature `({ name: string, value: string, checked: bool }, event)` */
133
114
  onKeyDown: PropTypes.func
134
115
  };
@@ -1,19 +1,24 @@
1
- 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); }
2
-
1
+ 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); }
3
2
  import { sharedPropTypes } from '@dhis2/ui-constants';
4
3
  import React from 'react';
5
4
  import { CheckboxField } from './index.js';
6
- const description = "\nA `CheckboxField` is a Checkbox component wrapped with extra form utilities, including the ability to add a label, help text, and validation text. Validation styles like 'error' apply to all of these subcomponents.\n\nSee the basic Checkbox for usage and design system guidelines.\n\n```js\nimport { CheckboxField } from '@dhis2/ui'\n```\n";
5
+ const description = `
6
+ A \`CheckboxField\` is a Checkbox component wrapped with extra form utilities, including the ability to add a label, help text, and validation text. Validation styles like 'error' apply to all of these subcomponents.
7
+
8
+ See the basic Checkbox for usage and design system guidelines.
7
9
 
10
+ \`\`\`js
11
+ import { CheckboxField } from '@dhis2/ui'
12
+ \`\`\`
13
+ `;
8
14
  const logger = _ref => {
9
15
  let {
10
16
  name,
11
17
  value,
12
18
  checked
13
19
  } = _ref;
14
- return console.log("name: ".concat(name, ", value: ").concat(value, ", checked: ").concat(checked));
20
+ return console.log(`name: ${name}, value: ${value}, checked: ${checked}`);
15
21
  };
16
-
17
22
  export default {
18
23
  title: 'Checkbox Field',
19
24
  component: CheckboxField,
@@ -32,34 +37,35 @@ export default {
32
37
  onChange: logger
33
38
  },
34
39
  argTypes: {
35
- valid: { ...sharedPropTypes.statusArgType
40
+ valid: {
41
+ ...sharedPropTypes.statusArgType
36
42
  },
37
- warning: { ...sharedPropTypes.statusArgType
43
+ warning: {
44
+ ...sharedPropTypes.statusArgType
38
45
  },
39
- error: { ...sharedPropTypes.statusArgType
46
+ error: {
47
+ ...sharedPropTypes.statusArgType
40
48
  }
41
49
  }
42
50
  };
43
-
44
51
  const Template = args => /*#__PURE__*/React.createElement(CheckboxField, args);
45
-
46
52
  const CheckedUncheckedTemplate = args => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CheckboxField, args), /*#__PURE__*/React.createElement(CheckboxField, _extends({}, args, {
47
53
  checked: true
48
54
  })));
49
-
50
55
  export const Default = Template.bind({});
51
56
  export const FocusedUnchecked = Template.bind({});
52
57
  FocusedUnchecked.args = {
53
58
  initialFocus: true
54
- }; // Disable stories on docs page that grab focus
55
-
59
+ };
60
+ // Disable stories on docs page that grab focus
56
61
  FocusedUnchecked.parameters = {
57
62
  docs: {
58
63
  disable: true
59
64
  }
60
65
  };
61
66
  export const FocusedChecked = Template.bind({});
62
- FocusedChecked.args = { ...FocusedUnchecked.args,
67
+ FocusedChecked.args = {
68
+ ...FocusedUnchecked.args,
63
69
  checked: true
64
70
  };
65
71
  FocusedChecked.parameters = {
@@ -117,7 +123,8 @@ DefaultDense.args = {
117
123
  dense: true
118
124
  };
119
125
  export const FocusedUncheckedDense = Template.bind({});
120
- FocusedUncheckedDense.args = { ...DefaultDense.args,
126
+ FocusedUncheckedDense.args = {
127
+ ...DefaultDense.args,
121
128
  ...FocusedUnchecked.args
122
129
  };
123
130
  FocusedUncheckedDense.parameters = {
@@ -127,7 +134,8 @@ FocusedUncheckedDense.parameters = {
127
134
  };
128
135
  FocusedUncheckedDense.storyName = 'Focused unchecked - Dense';
129
136
  export const FocusedCheckedDense = Template.bind({});
130
- FocusedCheckedDense.args = { ...DefaultDense.args,
137
+ FocusedCheckedDense.args = {
138
+ ...DefaultDense.args,
131
139
  ...FocusedChecked.args
132
140
  };
133
141
  FocusedCheckedDense.parameters = {
@@ -137,37 +145,44 @@ FocusedCheckedDense.parameters = {
137
145
  };
138
146
  FocusedCheckedDense.storyName = 'Focused checked - Dense';
139
147
  export const CheckedDense = Template.bind({});
140
- CheckedDense.args = { ...DefaultDense.args,
148
+ CheckedDense.args = {
149
+ ...DefaultDense.args,
141
150
  ...Checked.args
142
151
  };
143
152
  CheckedDense.storyName = 'Checked - Dense';
144
153
  export const RequiredDense = Template.bind({});
145
- RequiredDense.args = { ...DefaultDense.args,
154
+ RequiredDense.args = {
155
+ ...DefaultDense.args,
146
156
  ...Required.args
147
157
  };
148
158
  RequiredDense.storyName = 'Required - Dense';
149
159
  export const DisabledDense = CheckedUncheckedTemplate.bind({});
150
- DisabledDense.args = { ...DefaultDense.args,
160
+ DisabledDense.args = {
161
+ ...DefaultDense.args,
151
162
  ...Disabled.args
152
163
  };
153
164
  DisabledDense.storyName = 'Disabled - Dense';
154
165
  export const ValidDense = CheckedUncheckedTemplate.bind({});
155
- ValidDense.args = { ...DefaultDense.args,
166
+ ValidDense.args = {
167
+ ...DefaultDense.args,
156
168
  ...Valid.args
157
169
  };
158
170
  ValidDense.storyName = 'Valid - Dense';
159
171
  export const WarningDense = CheckedUncheckedTemplate.bind({});
160
- WarningDense.args = { ...DefaultDense.args,
172
+ WarningDense.args = {
173
+ ...DefaultDense.args,
161
174
  ...Warning.args
162
175
  };
163
176
  WarningDense.storyName = 'Warning - Dense';
164
177
  export const ErrorDense = CheckedUncheckedTemplate.bind({});
165
- ErrorDense.args = { ...DefaultDense.args,
178
+ ErrorDense.args = {
179
+ ...DefaultDense.args,
166
180
  ...Error.args
167
181
  };
168
182
  ErrorDense.storyName = 'Error - Dense';
169
183
  export const ImageLabelDense = Template.bind({});
170
- ImageLabelDense.args = { ...DefaultDense.args,
184
+ ImageLabelDense.args = {
185
+ ...DefaultDense.args,
171
186
  ...ImageLabel.args
172
187
  };
173
188
  ImageLabelDense.storyName = 'Image label - Dense';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/checkbox",
3
- "version": "9.10.3",
3
+ "version": "9.11.1-beta.1",
4
4
  "description": "UI Checkbox",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,20 +22,20 @@
22
22
  "access": "public"
23
23
  },
24
24
  "scripts": {
25
- "start": "start-storybook -c ../../storybook/config --port 5000",
25
+ "start": "storybook dev -c ../../storybook/config --port 5000",
26
26
  "build": "d2-app-scripts build",
27
27
  "test": "d2-app-scripts test --jestConfig ../../jest.config.shared.js"
28
28
  },
29
29
  "peerDependencies": {
30
- "react": "^16.8",
31
- "react-dom": "^16.8",
30
+ "react": "^16.13",
31
+ "react-dom": "^16.13",
32
32
  "styled-jsx": "^4"
33
33
  },
34
34
  "dependencies": {
35
35
  "@dhis2/prop-types": "^3.1.2",
36
- "@dhis2-ui/field": "9.10.3",
37
- "@dhis2-ui/required": "9.10.3",
38
- "@dhis2/ui-constants": "9.10.3",
36
+ "@dhis2-ui/field": "9.11.1-beta.1",
37
+ "@dhis2-ui/required": "9.11.1-beta.1",
38
+ "@dhis2/ui-constants": "9.11.1-beta.1",
39
39
  "classnames": "^2.3.1",
40
40
  "prop-types": "^15.7.2"
41
41
  },
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- var _react = require("@storybook/react");
4
-
5
- var _react2 = _interopRequireDefault(require("react"));
6
-
7
- var _index = require("./index.js");
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
- window.onClick = window.Cypress && window.Cypress.cy.stub();
12
- window.onChange = window.Cypress && window.Cypress.cy.stub();
13
- window.onBlur = window.Cypress && window.Cypress.cy.stub();
14
- window.onFocus = window.Cypress && window.Cypress.cy.stub();
15
- (0, _react.storiesOf)('Checkbox', module).add('With onChange', () => /*#__PURE__*/_react2.default.createElement(_index.Checkbox, {
16
- name: "Ex",
17
- label: "Checkbox",
18
- value: "default",
19
- onChange: window.onChange
20
- })).add('With initialFocus and onBlur', () => /*#__PURE__*/_react2.default.createElement(_index.Checkbox, {
21
- initialFocus: true,
22
- name: "Ex",
23
- label: "Checkbox",
24
- value: "default",
25
- onBlur: window.onBlur
26
- })).add('With onFocus', () => /*#__PURE__*/_react2.default.createElement(_index.Checkbox, {
27
- name: "Ex",
28
- label: "Checkbox",
29
- value: "default",
30
- onFocus: window.onFocus
31
- })).add('Disabled with onClick', () => /*#__PURE__*/_react2.default.createElement(_index.Checkbox, {
32
- name: "Ex",
33
- label: "Checkbox",
34
- value: "default",
35
- disabled: true,
36
- onClick: window.onClick
37
- })).add('With label', () => /*#__PURE__*/_react2.default.createElement(_index.Checkbox, {
38
- name: "Ex",
39
- label: "The label",
40
- value: "default"
41
- })).add('With initialFocus', () => /*#__PURE__*/_react2.default.createElement(_index.Checkbox, {
42
- name: "Ex",
43
- label: "The label",
44
- value: "default",
45
- initialFocus: true
46
- })).add('Indeterminate prop', () => /*#__PURE__*/_react2.default.createElement(_index.Checkbox, {
47
- name: "Ex",
48
- label: "The label",
49
- value: "default",
50
- indeterminate: true
51
- })).add('No indeterminate prop', () => /*#__PURE__*/_react2.default.createElement(_index.Checkbox, {
52
- name: "Ex",
53
- label: "The label",
54
- value: "default"
55
- }));
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- var _react = require("@storybook/react");
4
-
5
- var _react2 = _interopRequireDefault(require("react"));
6
-
7
- var _index = require("./index.js");
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
- (0, _react.storiesOf)('CheckboxField', module).add('With label and required', () => /*#__PURE__*/_react2.default.createElement(_index.CheckboxField, {
12
- name: "Ex",
13
- label: "CheckboxField",
14
- required: true,
15
- value: "checked"
16
- })).add('With help text', () => /*#__PURE__*/_react2.default.createElement(_index.CheckboxField, {
17
- name: "Ex",
18
- label: "CheckboxField",
19
- value: "checked",
20
- helpText: "Help text"
21
- })).add('With label', () => /*#__PURE__*/_react2.default.createElement(_index.CheckboxField, {
22
- name: "Ex",
23
- label: "The label",
24
- value: "checked"
25
- })).add('With validation text', () => /*#__PURE__*/_react2.default.createElement(_index.CheckboxField, {
26
- name: "Ex",
27
- label: "The label",
28
- value: "checked",
29
- validationText: "Validation text"
30
- }));
@@ -1,23 +0,0 @@
1
- import { storiesOf } from '@storybook/react';
2
- import React from 'react';
3
- import { CheckboxField } from './index.js';
4
- storiesOf('CheckboxField', module).add('With label and required', () => /*#__PURE__*/React.createElement(CheckboxField, {
5
- name: "Ex",
6
- label: "CheckboxField",
7
- required: true,
8
- value: "checked"
9
- })).add('With help text', () => /*#__PURE__*/React.createElement(CheckboxField, {
10
- name: "Ex",
11
- label: "CheckboxField",
12
- value: "checked",
13
- helpText: "Help text"
14
- })).add('With label', () => /*#__PURE__*/React.createElement(CheckboxField, {
15
- name: "Ex",
16
- label: "The label",
17
- value: "checked"
18
- })).add('With validation text', () => /*#__PURE__*/React.createElement(CheckboxField, {
19
- name: "Ex",
20
- label: "The label",
21
- value: "checked",
22
- validationText: "Validation text"
23
- }));