@instructure/ui-checkbox 8.33.1 → 8.33.2-snapshot-5

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 (38) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/es/Checkbox/CheckboxFacade/index.js +2 -12
  3. package/es/Checkbox/CheckboxFacade/props.js +1 -0
  4. package/es/Checkbox/CheckboxFacade/styles.js +4 -5
  5. package/es/Checkbox/CheckboxFacade/theme.js +6 -6
  6. package/es/Checkbox/CheckboxLocator.js +3 -1
  7. package/es/Checkbox/ToggleFacade/index.js +6 -18
  8. package/es/Checkbox/ToggleFacade/props.js +1 -0
  9. package/es/Checkbox/ToggleFacade/styles.js +3 -4
  10. package/es/Checkbox/ToggleFacade/theme.js +8 -8
  11. package/es/Checkbox/index.js +27 -55
  12. package/es/Checkbox/locator.js +1 -0
  13. package/es/Checkbox/props.js +1 -0
  14. package/es/Checkbox/styles.js +3 -5
  15. package/es/CheckboxGroup/CheckboxGroupLocator.js +3 -1
  16. package/es/CheckboxGroup/index.js +6 -20
  17. package/es/CheckboxGroup/locator.js +1 -0
  18. package/es/CheckboxGroup/props.js +1 -5
  19. package/lib/Checkbox/CheckboxFacade/index.js +2 -20
  20. package/lib/Checkbox/CheckboxFacade/props.js +1 -3
  21. package/lib/Checkbox/CheckboxFacade/styles.js +4 -6
  22. package/lib/Checkbox/CheckboxFacade/theme.js +6 -7
  23. package/lib/Checkbox/CheckboxLocator.js +1 -3
  24. package/lib/Checkbox/ToggleFacade/index.js +6 -26
  25. package/lib/Checkbox/ToggleFacade/props.js +1 -3
  26. package/lib/Checkbox/ToggleFacade/styles.js +3 -5
  27. package/lib/Checkbox/ToggleFacade/theme.js +8 -9
  28. package/lib/Checkbox/index.js +27 -72
  29. package/lib/Checkbox/locator.js +0 -2
  30. package/lib/Checkbox/props.js +1 -5
  31. package/lib/Checkbox/styles.js +3 -6
  32. package/lib/CheckboxGroup/CheckboxGroupLocator.js +1 -3
  33. package/lib/CheckboxGroup/index.js +5 -31
  34. package/lib/CheckboxGroup/locator.js +0 -2
  35. package/lib/CheckboxGroup/props.js +1 -12
  36. package/lib/index.js +0 -2
  37. package/package.json +19 -19
  38. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
13
-
14
10
  var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
15
-
16
11
  /*
17
12
  * The MIT License (MIT)
18
13
  *
@@ -36,6 +31,7 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
36
31
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
32
  * SOFTWARE.
38
33
  */
34
+
39
35
  const propTypes = {
40
36
  label: _propTypes.default.node.isRequired,
41
37
  id: _propTypes.default.string,
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -41,7 +40,7 @@ exports.default = void 0;
41
40
  */
42
41
  const generateStyle = (_componentTheme, props) => {
43
42
  const inline = props.inline,
44
- disabled = props.disabled;
43
+ disabled = props.disabled;
45
44
  return {
46
45
  checkbox: {
47
46
  label: 'checkbox',
@@ -69,10 +68,9 @@ const generateStyle = (_componentTheme, props) => {
69
68
  top: 0,
70
69
  insetInlineStart: 0,
71
70
  insetInlineEnd: 'auto',
72
- opacity: 0.0001
73
- /* selenium cannot find fully transparent elements */
74
-
71
+ opacity: 0.0001 /* selenium cannot find fully transparent elements */
75
72
  },
73
+
76
74
  control: {
77
75
  label: 'checkbox__control',
78
76
  all: 'initial',
@@ -82,6 +80,5 @@ const generateStyle = (_componentTheme, props) => {
82
80
  }
83
81
  };
84
82
  };
85
-
86
83
  var _default = generateStyle;
87
84
  exports.default = _default;
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.CheckboxGroupLocator = void 0;
7
-
8
7
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
-
10
8
  var _index = require("./index");
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,6 +29,7 @@ var _index = require("./index");
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
36
34
  const CheckboxGroupLocator = (0, _locator.locator)(_index.CheckboxGroup.selector);
37
35
  exports.CheckboxGroupLocator = CheckboxGroupLocator;
@@ -1,34 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.CheckboxGroup = void 0;
9
-
10
8
  var _react = _interopRequireWildcard(require("react"));
11
-
12
9
  var _FormFieldGroup = require("@instructure/ui-form-field/lib/FormFieldGroup");
13
-
14
10
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
15
-
16
11
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
17
-
18
12
  var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
19
-
20
13
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
21
-
22
14
  var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
23
-
24
15
  var _testable = require("@instructure/ui-testable/lib/testable.js");
25
-
26
16
  var _Checkbox = require("../Checkbox");
27
-
28
17
  var _props = require("./props");
29
-
30
18
  var _dec, _dec2, _class, _class2;
31
-
32
19
  /**
33
20
  ---
34
21
  category: components
@@ -40,60 +27,49 @@ let CheckboxGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _de
40
27
  super(props);
41
28
  this._messagesId = void 0;
42
29
  this.ref = null;
43
-
44
30
  this.handleRef = el => {
45
31
  this.ref = el;
46
32
  };
47
-
48
33
  this.handleChange = e => {
49
34
  const newValue = this.value;
50
-
51
35
  if (this.props.disabled || this.props.readOnly) {
52
36
  e.preventDefault();
53
37
  return;
54
38
  }
55
-
56
39
  if (e.target.checked) {
57
40
  newValue.push(e.target.value);
58
41
  } else {
59
42
  newValue.splice(newValue.indexOf(e.target.value), 1);
60
43
  }
61
-
62
44
  if (typeof this.props.value === 'undefined') {
63
45
  this.setState({
64
46
  value: newValue
65
47
  });
66
48
  }
67
-
68
49
  if (typeof this.props.onChange === 'function') {
69
50
  this.props.onChange(newValue);
70
51
  }
71
52
  };
72
-
73
53
  if (typeof props.value === 'undefined') {
74
54
  this.state = {
75
55
  value: props.defaultValue || []
76
56
  };
77
57
  }
78
-
79
58
  this._messagesId = props.deterministicId();
80
59
  }
81
-
82
60
  get hasMessages() {
83
61
  return this.props.messages && this.props.messages.length > 0;
84
62
  }
85
-
86
63
  get value() {
87
64
  return typeof this.props.value === 'undefined' ? [...this.state.value] : [...this.props.value];
88
65
  }
89
-
90
66
  renderChildren() {
91
67
  const _this$props = this.props,
92
- children = _this$props.children,
93
- name = _this$props.name,
94
- size = _this$props.size,
95
- disabled = _this$props.disabled,
96
- readOnly = _this$props.readOnly;
68
+ children = _this$props.children,
69
+ name = _this$props.name,
70
+ size = _this$props.size,
71
+ disabled = _this$props.disabled,
72
+ readOnly = _this$props.readOnly;
97
73
  return _react.Children.map(children, child => {
98
74
  if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Checkbox.Checkbox])) {
99
75
  return (0, _safeCloneElement.safeCloneElement)(child, {
@@ -113,7 +89,6 @@ let CheckboxGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _de
113
89
  }
114
90
  });
115
91
  }
116
-
117
92
  render() {
118
93
  return /*#__PURE__*/_react.default.createElement(_FormFieldGroup.FormFieldGroup, Object.assign({}, (0, _omitProps.omitProps)(this.props, CheckboxGroup.allowedProps), (0, _pickProps.pickProps)(this.props, _FormFieldGroup.FormFieldGroup.allowedProps), {
119
94
  description: this.props.description,
@@ -123,7 +98,6 @@ let CheckboxGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _de
123
98
  elementRef: this.handleRef
124
99
  }), this.renderChildren());
125
100
  }
126
-
127
101
  }, _class2.displayName = "CheckboxGroup", _class2.componentId = 'CheckboxGroup', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
128
102
  disabled: false,
129
103
  readOnly: false,
@@ -10,9 +10,7 @@ Object.defineProperty(exports, "CheckboxGroupLocator", {
10
10
  }
11
11
  });
12
12
  exports.default = void 0;
13
-
14
13
  var _CheckboxGroupLocator = require("./CheckboxGroupLocator");
15
-
16
14
  /*
17
15
  * The MIT License (MIT)
18
16
  *
@@ -1,22 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
13
-
14
10
  var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
15
-
16
11
  var _Children = require("@instructure/ui-prop-types/lib/Children.js");
17
-
18
12
  var _Checkbox = require("../Checkbox");
19
-
20
13
  /*
21
14
  * The MIT License (MIT)
22
15
  *
@@ -40,27 +33,24 @@ var _Checkbox = require("../Checkbox");
40
33
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
34
  * SOFTWARE.
42
35
  */
36
+
43
37
  const propTypes = {
44
38
  name: _propTypes.default.string.isRequired,
45
39
  description: _propTypes.default.node.isRequired,
46
-
47
40
  /**
48
41
  * value to set on initial render
49
42
  */
50
43
  defaultValue: _propTypes.default.array,
51
-
52
44
  /**
53
45
  * the selected values (must be accompanied by an `onChange` prop)
54
46
  */
55
47
  value: (0, _controllable.controllable)(_propTypes.default.array),
56
-
57
48
  /**
58
49
  * when used with the `value` prop, the component will not control its own state
59
50
  */
60
51
  onChange: _propTypes.default.func,
61
52
  disabled: _propTypes.default.bool,
62
53
  readOnly: _propTypes.default.bool,
63
-
64
54
  /**
65
55
  * object with shape: `{
66
56
  text: PropTypes.node,
@@ -68,7 +58,6 @@ const propTypes = {
68
58
  }`
69
59
  */
70
60
  messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
71
-
72
61
  /**
73
62
  * children of type `Checkbox`
74
63
  */
package/lib/index.js CHANGED
@@ -27,7 +27,5 @@ Object.defineProperty(exports, "ToggleFacade", {
27
27
  return _Checkbox.ToggleFacade;
28
28
  }
29
29
  });
30
-
31
30
  var _Checkbox = require("./Checkbox");
32
-
33
31
  var _CheckboxGroup = require("./CheckboxGroup");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-checkbox",
3
- "version": "8.33.1",
3
+ "version": "8.33.2-snapshot-5",
4
4
  "description": " styled HTML input type='checkbox' component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,28 +24,28 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.13.10",
27
- "@instructure/console": "8.33.1",
28
- "@instructure/emotion": "8.33.1",
29
- "@instructure/shared-types": "8.33.1",
30
- "@instructure/ui-dom-utils": "8.33.1",
31
- "@instructure/ui-form-field": "8.33.1",
32
- "@instructure/ui-icons": "8.33.1",
33
- "@instructure/ui-prop-types": "8.33.1",
34
- "@instructure/ui-react-utils": "8.33.1",
35
- "@instructure/ui-svg-images": "8.33.1",
36
- "@instructure/ui-testable": "8.33.1",
37
- "@instructure/ui-utils": "8.33.1",
38
- "@instructure/ui-view": "8.33.1",
39
- "@instructure/uid": "8.33.1",
27
+ "@instructure/console": "8.33.2-snapshot-5",
28
+ "@instructure/emotion": "8.33.2-snapshot-5",
29
+ "@instructure/shared-types": "8.33.2-snapshot-5",
30
+ "@instructure/ui-dom-utils": "8.33.2-snapshot-5",
31
+ "@instructure/ui-form-field": "8.33.2-snapshot-5",
32
+ "@instructure/ui-icons": "8.33.2-snapshot-5",
33
+ "@instructure/ui-prop-types": "8.33.2-snapshot-5",
34
+ "@instructure/ui-react-utils": "8.33.2-snapshot-5",
35
+ "@instructure/ui-svg-images": "8.33.2-snapshot-5",
36
+ "@instructure/ui-testable": "8.33.2-snapshot-5",
37
+ "@instructure/ui-utils": "8.33.2-snapshot-5",
38
+ "@instructure/ui-view": "8.33.2-snapshot-5",
39
+ "@instructure/uid": "8.33.2-snapshot-5",
40
40
  "keycode": "^2",
41
41
  "prop-types": "^15"
42
42
  },
43
43
  "devDependencies": {
44
- "@instructure/ui-babel-preset": "8.33.1",
45
- "@instructure/ui-color-utils": "8.33.1",
46
- "@instructure/ui-test-locator": "8.33.1",
47
- "@instructure/ui-test-utils": "8.33.1",
48
- "@instructure/ui-themes": "8.33.1"
44
+ "@instructure/ui-babel-preset": "8.33.2-snapshot-5",
45
+ "@instructure/ui-color-utils": "8.33.2-snapshot-5",
46
+ "@instructure/ui-test-locator": "8.33.2-snapshot-5",
47
+ "@instructure/ui-test-utils": "8.33.2-snapshot-5",
48
+ "@instructure/ui-themes": "8.33.2-snapshot-5"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": ">=16.8 <=18"