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

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-15](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-15) (2022-06-23)
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;