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

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-7](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-7) (2022-06-13)
6
+ ## [8.25.1-snapshot-10](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-10) (2022-06-20)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-checkbox
9
9
 
@@ -1,4 +1,4 @@
1
- var _dec, _class, _class2, _SVGIcon, _IconCheckMarkSolid;
1
+ var _dec, _class, _SVGIcon, _IconCheckMarkSolid;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -39,15 +39,22 @@ parent: Checkbox
39
39
  ---
40
40
  @tsProps
41
41
  **/
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
- }
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
+ };
51
58
 
52
59
  componentDidMount() {
53
60
  var _this$props$makeStyle, _this$props;
@@ -96,12 +103,6 @@ let CheckboxFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _
96
103
  }, children));
97
104
  }
98
105
 
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);
106
+ }) || _class);
106
107
  export default CheckboxFacade;
107
108
  export { CheckboxFacade };
@@ -1,4 +1,4 @@
1
- var _dec, _class, _class2;
1
+ var _dec, _class;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -38,15 +38,23 @@ parent: Checkbox
38
38
  ---
39
39
  @tsProps
40
40
  **/
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
- }
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
+ };
50
58
 
51
59
  componentDidMount() {
52
60
  var _this$props$makeStyle, _this$props;
@@ -102,13 +110,6 @@ let ToggleFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _de
102
110
  }, this.renderIcon()))), labelPlacement === 'end' && this.renderLabel());
103
111
  }
104
112
 
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);
113
+ }) || _class);
113
114
  export default ToggleFacade;
114
115
  export { ToggleFacade };
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _dec3, _class, _class2;
1
+ var _dec, _dec2, _dec3, _class;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -47,71 +47,23 @@ 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 = (_class2 = class Checkbox extends Component {
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
+
51
65
  constructor(props) {
52
66
  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
-
115
67
  this.state = {
116
68
  focused: false,
117
69
  hovered: false,
@@ -126,26 +78,82 @@ let Checkbox = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, n
126
78
  this._defaultId = props.deterministicId();
127
79
  }
128
80
 
81
+ _defaultId;
82
+ _input = null;
83
+ ref = null;
84
+ handleRef = el => {
85
+ this.ref = el;
86
+ };
87
+
129
88
  componentDidMount() {
130
- var _this$props$makeStyle, _this$props2;
89
+ var _this$props$makeStyle, _this$props;
131
90
 
132
91
  if (this._input) {
133
92
  this._input.indeterminate = this.props.indeterminate;
134
93
  }
135
94
 
136
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
95
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
137
96
  }
138
97
 
139
98
  componentDidUpdate(prevProps) {
140
- var _this$props$makeStyle2, _this$props3;
99
+ var _this$props$makeStyle2, _this$props2;
141
100
 
142
101
  if (prevProps.indeterminate !== this.props.indeterminate && this._input) {
143
102
  this._input.indeterminate = this.props.indeterminate || false;
144
103
  }
145
104
 
146
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
105
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
147
106
  }
148
107
 
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
+
149
157
  get id() {
150
158
  return this.props.id || this._defaultId;
151
159
  }
@@ -253,14 +261,6 @@ let Checkbox = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, n
253
261
  /* eslint-enable jsx-a11y/mouse-events-have-key-events */
254
262
  }
255
263
 
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);
264
+ }) || _class) || _class) || _class);
265
265
  export default Checkbox;
266
266
  export { Checkbox, CheckboxFacade, ToggleFacade };
@@ -1,4 +1,4 @@
1
- var _dec, _dec2, _class, _class2;
1
+ var _dec, _dec2, _class;
2
2
 
3
3
  /*
4
4
  * The MIT License (MIT)
@@ -36,40 +36,21 @@ category: components
36
36
  ---
37
37
  @tsProps
38
38
  **/
39
- let CheckboxGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class CheckboxGroup extends Component {
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
+
40
52
  constructor(props) {
41
53
  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
- };
73
54
 
74
55
  if (typeof props.value === 'undefined') {
75
56
  this.state = {
@@ -80,10 +61,41 @@ let CheckboxGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_cla
80
61
  this._messagesId = props.deterministicId();
81
62
  }
82
63
 
64
+ _messagesId;
65
+ ref = null;
66
+ handleRef = el => {
67
+ this.ref = el;
68
+ };
69
+
83
70
  get hasMessages() {
84
71
  return this.props.messages && this.props.messages.length > 0;
85
72
  }
86
73
 
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
+
87
99
  get value() {
88
100
  return typeof this.props.value === 'undefined' ? [...this.state.value] : [...this.props.value];
89
101
  }
@@ -125,12 +137,6 @@ let CheckboxGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_cla
125
137
  }), this.renderChildren());
126
138
  }
127
139
 
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);
140
+ }) || _class) || _class);
135
141
  export default CheckboxGroup;
136
142
  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, _class2, _SVGIcon, _IconCheckMarkSolid;
24
+ var _dec, _class, _SVGIcon, _IconCheckMarkSolid;
25
25
 
26
26
  /**
27
27
  ---
@@ -29,15 +29,22 @@ parent: Checkbox
29
29
  ---
30
30
  @tsProps
31
31
  **/
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
- }
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
+ };
41
48
 
42
49
  componentDidMount() {
43
50
  var _this$props$makeStyle, _this$props;
@@ -86,13 +93,7 @@ let CheckboxFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
86
93
  }, children));
87
94
  }
88
95
 
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);
96
+ }) || _class);
96
97
  exports.CheckboxFacade = CheckboxFacade;
97
98
  var _default = CheckboxFacade;
98
99
  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, _class2;
24
+ var _dec, _class;
25
25
 
26
26
  /**
27
27
  ---
@@ -29,15 +29,23 @@ parent: Checkbox
29
29
  ---
30
30
  @tsProps
31
31
  **/
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
- }
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
+ };
41
49
 
42
50
  componentDidMount() {
43
51
  var _this$props$makeStyle, _this$props;
@@ -93,14 +101,7 @@ let ToggleFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
93
101
  }, this.renderIcon()))), labelPlacement === 'end' && this.renderLabel());
94
102
  }
95
103
 
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);
104
+ }) || _class);
104
105
  exports.ToggleFacade = ToggleFacade;
105
106
  var _default = ToggleFacade;
106
107
  exports.default = _default;