@instructure/ui-checkbox 8.25.1-snapshot-10 → 8.25.1-snapshot-13

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.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [8.25.1-snapshot-10](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-10) (2022-06-20)
6
+ ## [8.25.1-snapshot-13](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-13) (2022-06-22)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-checkbox
9
9
 
@@ -1,4 +1,4 @@
1
- var _dec, _class, _SVGIcon, _IconCheckMarkSolid;
1
+ var _dec, _class, _class2, _SVGIcon, _IconCheckMarkSolid;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -39,22 +39,15 @@ parent: Checkbox
39
39
  ---
40
40
  @tsProps
41
41
  **/
42
- let CheckboxFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class CheckboxFacade extends Component {
43
- static displayName = "CheckboxFacade";
44
- static componentId = 'CheckboxFacade';
45
- static propTypes = propTypes;
46
- static allowedProps = allowedProps;
47
- static defaultProps = {
48
- checked: false,
49
- focused: false,
50
- hovered: false,
51
- size: 'medium',
52
- indeterminate: false
53
- };
54
- ref = null;
55
- handleRef = el => {
56
- this.ref = el;
57
- };
42
+ let CheckboxFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_class2 = class CheckboxFacade extends Component {
43
+ constructor() {
44
+ super(...arguments);
45
+ this.ref = null;
46
+
47
+ this.handleRef = el => {
48
+ this.ref = el;
49
+ };
50
+ }
58
51
 
59
52
  componentDidMount() {
60
53
  var _this$props$makeStyle, _this$props;
@@ -103,6 +96,12 @@ let CheckboxFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _
103
96
  }, children));
104
97
  }
105
98
 
106
- }) || _class);
99
+ }, _class2.displayName = "CheckboxFacade", _class2.componentId = 'CheckboxFacade', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
100
+ checked: false,
101
+ focused: false,
102
+ hovered: false,
103
+ size: 'medium',
104
+ indeterminate: false
105
+ }, _class2)) || _class);
107
106
  export default CheckboxFacade;
108
107
  export { CheckboxFacade };
@@ -1,4 +1,4 @@
1
- var _dec, _class;
1
+ var _dec, _class, _class2;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -38,23 +38,15 @@ parent: Checkbox
38
38
  ---
39
39
  @tsProps
40
40
  **/
41
- let ToggleFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class ToggleFacade extends Component {
42
- static displayName = "ToggleFacade";
43
- static componentId = 'ToggleFacade';
44
- static propTypes = propTypes;
45
- static allowedProps = allowedProps;
46
- static defaultProps = {
47
- checked: false,
48
- focused: false,
49
- size: 'medium',
50
- disabled: false,
51
- readOnly: false,
52
- labelPlacement: 'end'
53
- };
54
- ref = null;
55
- handleRef = el => {
56
- this.ref = el;
57
- };
41
+ let ToggleFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_class2 = class ToggleFacade extends Component {
42
+ constructor() {
43
+ super(...arguments);
44
+ this.ref = null;
45
+
46
+ this.handleRef = el => {
47
+ this.ref = el;
48
+ };
49
+ }
58
50
 
59
51
  componentDidMount() {
60
52
  var _this$props$makeStyle, _this$props;
@@ -110,6 +102,13 @@ let ToggleFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _de
110
102
  }, this.renderIcon()))), labelPlacement === 'end' && this.renderLabel());
111
103
  }
112
104
 
113
- }) || _class);
105
+ }, _class2.displayName = "ToggleFacade", _class2.componentId = 'ToggleFacade', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
106
+ checked: false,
107
+ focused: false,
108
+ size: 'medium',
109
+ disabled: false,
110
+ readOnly: false,
111
+ labelPlacement: 'end'
112
+ }, _class2)) || _class);
114
113
  export default ToggleFacade;
115
114
  export { ToggleFacade };
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _dec3, _class;
1
+ var _dec, _dec2, _dec3, _class, _class2;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -47,23 +47,71 @@ tags: toggle, switch
47
47
  ---
48
48
  @tsProps
49
49
  **/
50
- let Checkbox = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, null), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = class Checkbox extends Component {
51
- static displayName = "Checkbox";
52
- static componentId = 'Checkbox';
53
- static propTypes = propTypes;
54
- static allowedProps = allowedProps;
55
- static defaultProps = {
56
- size: 'medium',
57
- variant: 'simple',
58
- disabled: false,
59
- inline: false,
60
- indeterminate: false,
61
- readOnly: false,
62
- labelPlacement: 'end'
63
- };
64
-
50
+ let Checkbox = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, null), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Checkbox extends Component {
65
51
  constructor(props) {
66
52
  super(props);
53
+ this._defaultId = void 0;
54
+ this._input = null;
55
+ this.ref = null;
56
+
57
+ this.handleRef = el => {
58
+ this.ref = el;
59
+ };
60
+
61
+ this.handleChange = e => {
62
+ const _this$props = this.props,
63
+ onChange = _this$props.onChange,
64
+ disabled = _this$props.disabled,
65
+ checked = _this$props.checked,
66
+ readOnly = _this$props.readOnly;
67
+
68
+ if (disabled || readOnly) {
69
+ e.preventDefault();
70
+ return;
71
+ }
72
+
73
+ if (typeof checked === 'undefined') {
74
+ this.setState({
75
+ checked: !this.state.checked
76
+ });
77
+ }
78
+
79
+ if (typeof onChange === 'function') {
80
+ onChange(e);
81
+ }
82
+ };
83
+
84
+ this.handleKeyDown = e => {
85
+ if (this.props.variant === 'toggle' && e.keyCode === keycode.codes.enter) {
86
+ this._input && this._input.click();
87
+ e.preventDefault();
88
+ }
89
+ };
90
+
91
+ this.handleFocus = () => {
92
+ this.setState({
93
+ focused: true
94
+ });
95
+ };
96
+
97
+ this.handleBlur = () => {
98
+ this.setState({
99
+ focused: false
100
+ });
101
+ };
102
+
103
+ this.handleMouseOver = () => {
104
+ this.setState({
105
+ hovered: true
106
+ });
107
+ };
108
+
109
+ this.handleMouseOut = () => {
110
+ this.setState({
111
+ hovered: false
112
+ });
113
+ };
114
+
67
115
  this.state = {
68
116
  focused: false,
69
117
  hovered: false,
@@ -78,82 +126,26 @@ let Checkbox = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, n
78
126
  this._defaultId = props.deterministicId();
79
127
  }
80
128
 
81
- _defaultId;
82
- _input = null;
83
- ref = null;
84
- handleRef = el => {
85
- this.ref = el;
86
- };
87
-
88
129
  componentDidMount() {
89
- var _this$props$makeStyle, _this$props;
130
+ var _this$props$makeStyle, _this$props2;
90
131
 
91
132
  if (this._input) {
92
133
  this._input.indeterminate = this.props.indeterminate;
93
134
  }
94
135
 
95
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
136
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
96
137
  }
97
138
 
98
139
  componentDidUpdate(prevProps) {
99
- var _this$props$makeStyle2, _this$props2;
140
+ var _this$props$makeStyle2, _this$props3;
100
141
 
101
142
  if (prevProps.indeterminate !== this.props.indeterminate && this._input) {
102
143
  this._input.indeterminate = this.props.indeterminate || false;
103
144
  }
104
145
 
105
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
146
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
106
147
  }
107
148
 
108
- handleChange = e => {
109
- const _this$props3 = this.props,
110
- onChange = _this$props3.onChange,
111
- disabled = _this$props3.disabled,
112
- checked = _this$props3.checked,
113
- readOnly = _this$props3.readOnly;
114
-
115
- if (disabled || readOnly) {
116
- e.preventDefault();
117
- return;
118
- }
119
-
120
- if (typeof checked === 'undefined') {
121
- this.setState({
122
- checked: !this.state.checked
123
- });
124
- }
125
-
126
- if (typeof onChange === 'function') {
127
- onChange(e);
128
- }
129
- };
130
- handleKeyDown = e => {
131
- if (this.props.variant === 'toggle' && e.keyCode === keycode.codes.enter) {
132
- this._input && this._input.click();
133
- e.preventDefault();
134
- }
135
- };
136
- handleFocus = () => {
137
- this.setState({
138
- focused: true
139
- });
140
- };
141
- handleBlur = () => {
142
- this.setState({
143
- focused: false
144
- });
145
- };
146
- handleMouseOver = () => {
147
- this.setState({
148
- hovered: true
149
- });
150
- };
151
- handleMouseOut = () => {
152
- this.setState({
153
- hovered: false
154
- });
155
- };
156
-
157
149
  get id() {
158
150
  return this.props.id || this._defaultId;
159
151
  }
@@ -261,6 +253,14 @@ let Checkbox = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, n
261
253
  /* eslint-enable jsx-a11y/mouse-events-have-key-events */
262
254
  }
263
255
 
264
- }) || _class) || _class) || _class);
256
+ }, _class2.displayName = "Checkbox", _class2.componentId = 'Checkbox', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
257
+ size: 'medium',
258
+ variant: 'simple',
259
+ disabled: false,
260
+ inline: false,
261
+ indeterminate: false,
262
+ readOnly: false,
263
+ labelPlacement: 'end'
264
+ }, _class2)) || _class) || _class) || _class);
265
265
  export default Checkbox;
266
266
  export { Checkbox, CheckboxFacade, ToggleFacade };
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _class;
1
+ var _dec, _dec2, _class, _class2;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -36,21 +36,40 @@ category: components
36
36
  ---
37
37
  @tsProps
38
38
  **/
39
- let CheckboxGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_class = _dec2(_class = class CheckboxGroup extends Component {
40
- static displayName = "CheckboxGroup";
41
- static componentId = 'CheckboxGroup';
42
- static propTypes = propTypes;
43
- static allowedProps = allowedProps;
44
- static defaultProps = {
45
- disabled: false,
46
- readOnly: false,
47
- size: 'medium',
48
- layout: 'stacked',
49
- children: null
50
- };
51
-
39
+ let CheckboxGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class CheckboxGroup extends Component {
52
40
  constructor(props) {
53
41
  super(props);
42
+ this._messagesId = void 0;
43
+ this.ref = null;
44
+
45
+ this.handleRef = el => {
46
+ this.ref = el;
47
+ };
48
+
49
+ this.handleChange = e => {
50
+ const newValue = this.value;
51
+
52
+ if (this.props.disabled || this.props.readOnly) {
53
+ e.preventDefault();
54
+ return;
55
+ }
56
+
57
+ if (e.target.checked) {
58
+ newValue.push(e.target.value);
59
+ } else {
60
+ newValue.splice(newValue.indexOf(e.target.value), 1);
61
+ }
62
+
63
+ if (typeof this.props.value === 'undefined') {
64
+ this.setState({
65
+ value: newValue
66
+ });
67
+ }
68
+
69
+ if (typeof this.props.onChange === 'function') {
70
+ this.props.onChange(newValue);
71
+ }
72
+ };
54
73
 
55
74
  if (typeof props.value === 'undefined') {
56
75
  this.state = {
@@ -61,41 +80,10 @@ let CheckboxGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_cla
61
80
  this._messagesId = props.deterministicId();
62
81
  }
63
82
 
64
- _messagesId;
65
- ref = null;
66
- handleRef = el => {
67
- this.ref = el;
68
- };
69
-
70
83
  get hasMessages() {
71
84
  return this.props.messages && this.props.messages.length > 0;
72
85
  }
73
86
 
74
- handleChange = e => {
75
- const newValue = this.value;
76
-
77
- if (this.props.disabled || this.props.readOnly) {
78
- e.preventDefault();
79
- return;
80
- }
81
-
82
- if (e.target.checked) {
83
- newValue.push(e.target.value);
84
- } else {
85
- newValue.splice(newValue.indexOf(e.target.value), 1);
86
- }
87
-
88
- if (typeof this.props.value === 'undefined') {
89
- this.setState({
90
- value: newValue
91
- });
92
- }
93
-
94
- if (typeof this.props.onChange === 'function') {
95
- this.props.onChange(newValue);
96
- }
97
- };
98
-
99
87
  get value() {
100
88
  return typeof this.props.value === 'undefined' ? [...this.state.value] : [...this.props.value];
101
89
  }
@@ -137,6 +125,12 @@ let CheckboxGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_cla
137
125
  }), this.renderChildren());
138
126
  }
139
127
 
140
- }) || _class) || _class);
128
+ }, _class2.displayName = "CheckboxGroup", _class2.componentId = 'CheckboxGroup', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
129
+ disabled: false,
130
+ readOnly: false,
131
+ size: 'medium',
132
+ layout: 'stacked',
133
+ children: null
134
+ }, _class2)) || _class) || _class);
141
135
  export default CheckboxGroup;
142
136
  export { CheckboxGroup };
@@ -21,7 +21,7 @@ var _theme = _interopRequireDefault(require("./theme"));
21
21
 
22
22
  var _props = require("./props");
23
23
 
24
- var _dec, _class, _SVGIcon, _IconCheckMarkSolid;
24
+ var _dec, _class, _class2, _SVGIcon, _IconCheckMarkSolid;
25
25
 
26
26
  /**
27
27
  ---
@@ -29,22 +29,15 @@ parent: Checkbox
29
29
  ---
30
30
  @tsProps
31
31
  **/
32
- let CheckboxFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = class CheckboxFacade extends _react.Component {
33
- static displayName = "CheckboxFacade";
34
- static componentId = 'CheckboxFacade';
35
- static propTypes = _props.propTypes;
36
- static allowedProps = _props.allowedProps;
37
- static defaultProps = {
38
- checked: false,
39
- focused: false,
40
- hovered: false,
41
- size: 'medium',
42
- indeterminate: false
43
- };
44
- ref = null;
45
- handleRef = el => {
46
- this.ref = el;
47
- };
32
+ let CheckboxFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_class2 = class CheckboxFacade extends _react.Component {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.ref = null;
36
+
37
+ this.handleRef = el => {
38
+ this.ref = el;
39
+ };
40
+ }
48
41
 
49
42
  componentDidMount() {
50
43
  var _this$props$makeStyle, _this$props;
@@ -93,7 +86,13 @@ let CheckboxFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
93
86
  }, children));
94
87
  }
95
88
 
96
- }) || _class);
89
+ }, _class2.displayName = "CheckboxFacade", _class2.componentId = 'CheckboxFacade', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
90
+ checked: false,
91
+ focused: false,
92
+ hovered: false,
93
+ size: 'medium',
94
+ indeterminate: false
95
+ }, _class2)) || _class);
97
96
  exports.CheckboxFacade = CheckboxFacade;
98
97
  var _default = CheckboxFacade;
99
98
  exports.default = _default;
@@ -21,7 +21,7 @@ var _theme = _interopRequireDefault(require("./theme"));
21
21
 
22
22
  var _props = require("./props");
23
23
 
24
- var _dec, _class;
24
+ var _dec, _class, _class2;
25
25
 
26
26
  /**
27
27
  ---
@@ -29,23 +29,15 @@ parent: Checkbox
29
29
  ---
30
30
  @tsProps
31
31
  **/
32
- let ToggleFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = class ToggleFacade extends _react.Component {
33
- static displayName = "ToggleFacade";
34
- static componentId = 'ToggleFacade';
35
- static propTypes = _props.propTypes;
36
- static allowedProps = _props.allowedProps;
37
- static defaultProps = {
38
- checked: false,
39
- focused: false,
40
- size: 'medium',
41
- disabled: false,
42
- readOnly: false,
43
- labelPlacement: 'end'
44
- };
45
- ref = null;
46
- handleRef = el => {
47
- this.ref = el;
48
- };
32
+ let ToggleFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_class2 = class ToggleFacade extends _react.Component {
33
+ constructor() {
34
+ super(...arguments);
35
+ this.ref = null;
36
+
37
+ this.handleRef = el => {
38
+ this.ref = el;
39
+ };
40
+ }
49
41
 
50
42
  componentDidMount() {
51
43
  var _this$props$makeStyle, _this$props;
@@ -101,7 +93,14 @@ let ToggleFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
101
93
  }, this.renderIcon()))), labelPlacement === 'end' && this.renderLabel());
102
94
  }
103
95
 
104
- }) || _class);
96
+ }, _class2.displayName = "ToggleFacade", _class2.componentId = 'ToggleFacade', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
97
+ checked: false,
98
+ focused: false,
99
+ size: 'medium',
100
+ disabled: false,
101
+ readOnly: false,
102
+ labelPlacement: 'end'
103
+ }, _class2)) || _class);
105
104
  exports.ToggleFacade = ToggleFacade;
106
105
  var _default = ToggleFacade;
107
106
  exports.default = _default;
@@ -52,7 +52,7 @@ var _styles = _interopRequireDefault(require("./styles"));
52
52
 
53
53
  var _props = require("./props");
54
54
 
55
- var _dec, _dec2, _dec3, _class;
55
+ var _dec, _dec2, _dec3, _class, _class2;
56
56
 
57
57
  /**
58
58
  ---
@@ -61,23 +61,71 @@ tags: toggle, switch
61
61
  ---
62
62
  @tsProps
63
63
  **/
64
- let Checkbox = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, null), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = class Checkbox extends _react.Component {
65
- static displayName = "Checkbox";
66
- static componentId = 'Checkbox';
67
- static propTypes = _props.propTypes;
68
- static allowedProps = _props.allowedProps;
69
- static defaultProps = {
70
- size: 'medium',
71
- variant: 'simple',
72
- disabled: false,
73
- inline: false,
74
- indeterminate: false,
75
- readOnly: false,
76
- labelPlacement: 'end'
77
- };
78
-
64
+ let Checkbox = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, null), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Checkbox extends _react.Component {
79
65
  constructor(props) {
80
66
  super(props);
67
+ this._defaultId = void 0;
68
+ this._input = null;
69
+ this.ref = null;
70
+
71
+ this.handleRef = el => {
72
+ this.ref = el;
73
+ };
74
+
75
+ this.handleChange = e => {
76
+ const _this$props = this.props,
77
+ onChange = _this$props.onChange,
78
+ disabled = _this$props.disabled,
79
+ checked = _this$props.checked,
80
+ readOnly = _this$props.readOnly;
81
+
82
+ if (disabled || readOnly) {
83
+ e.preventDefault();
84
+ return;
85
+ }
86
+
87
+ if (typeof checked === 'undefined') {
88
+ this.setState({
89
+ checked: !this.state.checked
90
+ });
91
+ }
92
+
93
+ if (typeof onChange === 'function') {
94
+ onChange(e);
95
+ }
96
+ };
97
+
98
+ this.handleKeyDown = e => {
99
+ if (this.props.variant === 'toggle' && e.keyCode === _keycode.default.codes.enter) {
100
+ this._input && this._input.click();
101
+ e.preventDefault();
102
+ }
103
+ };
104
+
105
+ this.handleFocus = () => {
106
+ this.setState({
107
+ focused: true
108
+ });
109
+ };
110
+
111
+ this.handleBlur = () => {
112
+ this.setState({
113
+ focused: false
114
+ });
115
+ };
116
+
117
+ this.handleMouseOver = () => {
118
+ this.setState({
119
+ hovered: true
120
+ });
121
+ };
122
+
123
+ this.handleMouseOut = () => {
124
+ this.setState({
125
+ hovered: false
126
+ });
127
+ };
128
+
81
129
  this.state = {
82
130
  focused: false,
83
131
  hovered: false,
@@ -92,82 +140,26 @@ let Checkbox = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
92
140
  this._defaultId = props.deterministicId();
93
141
  }
94
142
 
95
- _defaultId;
96
- _input = null;
97
- ref = null;
98
- handleRef = el => {
99
- this.ref = el;
100
- };
101
-
102
143
  componentDidMount() {
103
- var _this$props$makeStyle, _this$props;
144
+ var _this$props$makeStyle, _this$props2;
104
145
 
105
146
  if (this._input) {
106
147
  this._input.indeterminate = this.props.indeterminate;
107
148
  }
108
149
 
109
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
150
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
110
151
  }
111
152
 
112
153
  componentDidUpdate(prevProps) {
113
- var _this$props$makeStyle2, _this$props2;
154
+ var _this$props$makeStyle2, _this$props3;
114
155
 
115
156
  if (prevProps.indeterminate !== this.props.indeterminate && this._input) {
116
157
  this._input.indeterminate = this.props.indeterminate || false;
117
158
  }
118
159
 
119
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
160
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
120
161
  }
121
162
 
122
- handleChange = e => {
123
- const _this$props3 = this.props,
124
- onChange = _this$props3.onChange,
125
- disabled = _this$props3.disabled,
126
- checked = _this$props3.checked,
127
- readOnly = _this$props3.readOnly;
128
-
129
- if (disabled || readOnly) {
130
- e.preventDefault();
131
- return;
132
- }
133
-
134
- if (typeof checked === 'undefined') {
135
- this.setState({
136
- checked: !this.state.checked
137
- });
138
- }
139
-
140
- if (typeof onChange === 'function') {
141
- onChange(e);
142
- }
143
- };
144
- handleKeyDown = e => {
145
- if (this.props.variant === 'toggle' && e.keyCode === _keycode.default.codes.enter) {
146
- this._input && this._input.click();
147
- e.preventDefault();
148
- }
149
- };
150
- handleFocus = () => {
151
- this.setState({
152
- focused: true
153
- });
154
- };
155
- handleBlur = () => {
156
- this.setState({
157
- focused: false
158
- });
159
- };
160
- handleMouseOver = () => {
161
- this.setState({
162
- hovered: true
163
- });
164
- };
165
- handleMouseOut = () => {
166
- this.setState({
167
- hovered: false
168
- });
169
- };
170
-
171
163
  get id() {
172
164
  return this.props.id || this._defaultId;
173
165
  }
@@ -275,7 +267,15 @@ let Checkbox = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
275
267
  /* eslint-enable jsx-a11y/mouse-events-have-key-events */
276
268
  }
277
269
 
278
- }) || _class) || _class) || _class);
270
+ }, _class2.displayName = "Checkbox", _class2.componentId = 'Checkbox', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
271
+ size: 'medium',
272
+ variant: 'simple',
273
+ disabled: false,
274
+ inline: false,
275
+ indeterminate: false,
276
+ readOnly: false,
277
+ labelPlacement: 'end'
278
+ }, _class2)) || _class) || _class) || _class);
279
279
  exports.Checkbox = Checkbox;
280
280
  var _default = Checkbox;
281
281
  exports.default = _default;
@@ -27,7 +27,7 @@ var _Checkbox = require("../Checkbox");
27
27
 
28
28
  var _props = require("./props");
29
29
 
30
- var _dec, _dec2, _class;
30
+ var _dec, _dec2, _class, _class2;
31
31
 
32
32
  /**
33
33
  ---
@@ -35,21 +35,40 @@ category: components
35
35
  ---
36
36
  @tsProps
37
37
  **/
38
- let CheckboxGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = class CheckboxGroup extends _react.Component {
39
- static displayName = "CheckboxGroup";
40
- static componentId = 'CheckboxGroup';
41
- static propTypes = _props.propTypes;
42
- static allowedProps = _props.allowedProps;
43
- static defaultProps = {
44
- disabled: false,
45
- readOnly: false,
46
- size: 'medium',
47
- layout: 'stacked',
48
- children: null
49
- };
50
-
38
+ let CheckboxGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class CheckboxGroup extends _react.Component {
51
39
  constructor(props) {
52
40
  super(props);
41
+ this._messagesId = void 0;
42
+ this.ref = null;
43
+
44
+ this.handleRef = el => {
45
+ this.ref = el;
46
+ };
47
+
48
+ this.handleChange = e => {
49
+ const newValue = this.value;
50
+
51
+ if (this.props.disabled || this.props.readOnly) {
52
+ e.preventDefault();
53
+ return;
54
+ }
55
+
56
+ if (e.target.checked) {
57
+ newValue.push(e.target.value);
58
+ } else {
59
+ newValue.splice(newValue.indexOf(e.target.value), 1);
60
+ }
61
+
62
+ if (typeof this.props.value === 'undefined') {
63
+ this.setState({
64
+ value: newValue
65
+ });
66
+ }
67
+
68
+ if (typeof this.props.onChange === 'function') {
69
+ this.props.onChange(newValue);
70
+ }
71
+ };
53
72
 
54
73
  if (typeof props.value === 'undefined') {
55
74
  this.state = {
@@ -60,41 +79,10 @@ let CheckboxGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _de
60
79
  this._messagesId = props.deterministicId();
61
80
  }
62
81
 
63
- _messagesId;
64
- ref = null;
65
- handleRef = el => {
66
- this.ref = el;
67
- };
68
-
69
82
  get hasMessages() {
70
83
  return this.props.messages && this.props.messages.length > 0;
71
84
  }
72
85
 
73
- handleChange = e => {
74
- const newValue = this.value;
75
-
76
- if (this.props.disabled || this.props.readOnly) {
77
- e.preventDefault();
78
- return;
79
- }
80
-
81
- if (e.target.checked) {
82
- newValue.push(e.target.value);
83
- } else {
84
- newValue.splice(newValue.indexOf(e.target.value), 1);
85
- }
86
-
87
- if (typeof this.props.value === 'undefined') {
88
- this.setState({
89
- value: newValue
90
- });
91
- }
92
-
93
- if (typeof this.props.onChange === 'function') {
94
- this.props.onChange(newValue);
95
- }
96
- };
97
-
98
86
  get value() {
99
87
  return typeof this.props.value === 'undefined' ? [...this.state.value] : [...this.props.value];
100
88
  }
@@ -136,7 +124,13 @@ let CheckboxGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _de
136
124
  }), this.renderChildren());
137
125
  }
138
126
 
139
- }) || _class) || _class);
127
+ }, _class2.displayName = "CheckboxGroup", _class2.componentId = 'CheckboxGroup', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
128
+ disabled: false,
129
+ readOnly: false,
130
+ size: 'medium',
131
+ layout: 'stacked',
132
+ children: null
133
+ }, _class2)) || _class) || _class);
140
134
  exports.CheckboxGroup = CheckboxGroup;
141
135
  var _default = CheckboxGroup;
142
136
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-checkbox",
3
- "version": "8.25.1-snapshot-10",
3
+ "version": "8.25.1-snapshot-13",
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.25.1-snapshot-10",
28
- "@instructure/emotion": "8.25.1-snapshot-10",
29
- "@instructure/shared-types": "8.25.1-snapshot-10",
30
- "@instructure/ui-dom-utils": "8.25.1-snapshot-10",
31
- "@instructure/ui-form-field": "8.25.1-snapshot-10",
32
- "@instructure/ui-icons": "8.25.1-snapshot-10",
33
- "@instructure/ui-prop-types": "8.25.1-snapshot-10",
34
- "@instructure/ui-react-utils": "8.25.1-snapshot-10",
35
- "@instructure/ui-svg-images": "8.25.1-snapshot-10",
36
- "@instructure/ui-testable": "8.25.1-snapshot-10",
37
- "@instructure/ui-utils": "8.25.1-snapshot-10",
38
- "@instructure/ui-view": "8.25.1-snapshot-10",
39
- "@instructure/uid": "8.25.1-snapshot-10",
27
+ "@instructure/console": "8.25.1-snapshot-13",
28
+ "@instructure/emotion": "8.25.1-snapshot-13",
29
+ "@instructure/shared-types": "8.25.1-snapshot-13",
30
+ "@instructure/ui-dom-utils": "8.25.1-snapshot-13",
31
+ "@instructure/ui-form-field": "8.25.1-snapshot-13",
32
+ "@instructure/ui-icons": "8.25.1-snapshot-13",
33
+ "@instructure/ui-prop-types": "8.25.1-snapshot-13",
34
+ "@instructure/ui-react-utils": "8.25.1-snapshot-13",
35
+ "@instructure/ui-svg-images": "8.25.1-snapshot-13",
36
+ "@instructure/ui-testable": "8.25.1-snapshot-13",
37
+ "@instructure/ui-utils": "8.25.1-snapshot-13",
38
+ "@instructure/ui-view": "8.25.1-snapshot-13",
39
+ "@instructure/uid": "8.25.1-snapshot-13",
40
40
  "keycode": "^2",
41
41
  "prop-types": "^15"
42
42
  },
43
43
  "devDependencies": {
44
- "@instructure/ui-babel-preset": "8.25.1-snapshot-10",
45
- "@instructure/ui-color-utils": "8.25.1-snapshot-10",
46
- "@instructure/ui-test-locator": "8.25.1-snapshot-10",
47
- "@instructure/ui-test-utils": "8.25.1-snapshot-10",
48
- "@instructure/ui-themes": "8.25.1-snapshot-10"
44
+ "@instructure/ui-babel-preset": "8.25.1-snapshot-13",
45
+ "@instructure/ui-color-utils": "8.25.1-snapshot-13",
46
+ "@instructure/ui-test-locator": "8.25.1-snapshot-13",
47
+ "@instructure/ui-test-utils": "8.25.1-snapshot-13",
48
+ "@instructure/ui-themes": "8.25.1-snapshot-13"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": ">=16.8 <=17"