@instructure/ui-checkbox 8.14.1-snapshot.7 → 8.15.1-snapshot.2
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 +4 -0
- package/es/Checkbox/CheckboxFacade/index.js +11 -6
- package/es/Checkbox/CheckboxFacade/props.js +0 -4
- package/es/Checkbox/CheckboxLocator.js +2 -1
- package/es/Checkbox/ToggleFacade/index.js +17 -12
- package/es/Checkbox/index.js +45 -43
- package/es/Checkbox/props.js +0 -29
- package/es/Checkbox/styles.js +1 -1
- package/es/CheckboxGroup/CheckboxGroupLocator.js +2 -1
- package/es/CheckboxGroup/index.js +16 -19
- package/lib/Checkbox/CheckboxFacade/index.js +11 -6
- package/lib/Checkbox/CheckboxFacade/props.js +0 -4
- package/lib/Checkbox/CheckboxLocator.js +1 -0
- package/lib/Checkbox/ToggleFacade/index.js +17 -12
- package/lib/Checkbox/index.js +47 -43
- package/lib/Checkbox/props.js +0 -29
- package/lib/Checkbox/styles.js +1 -1
- package/lib/CheckboxGroup/CheckboxGroupLocator.js +1 -0
- package/lib/CheckboxGroup/index.js +16 -19
- package/package.json +20 -20
- package/src/Checkbox/CheckboxFacade/index.tsx +4 -6
- package/src/Checkbox/CheckboxFacade/props.ts +3 -3
- package/src/Checkbox/ToggleFacade/index.tsx +4 -6
- package/src/Checkbox/ToggleFacade/props.ts +1 -0
- package/src/Checkbox/index.tsx +29 -54
- package/src/Checkbox/props.ts +36 -30
- package/src/Checkbox/styles.ts +2 -2
- package/src/CheckboxGroup/index.tsx +24 -40
- package/src/CheckboxGroup/props.ts +11 -5
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Checkbox/CheckboxFacade/index.d.ts +2 -1
- package/types/Checkbox/CheckboxFacade/index.d.ts.map +1 -1
- package/types/Checkbox/CheckboxFacade/props.d.ts +3 -0
- package/types/Checkbox/CheckboxFacade/props.d.ts.map +1 -1
- package/types/Checkbox/CheckboxLocator.d.ts +4 -4
- package/types/Checkbox/ToggleFacade/index.d.ts +2 -1
- package/types/Checkbox/ToggleFacade/index.d.ts.map +1 -1
- package/types/Checkbox/ToggleFacade/props.d.ts +1 -1
- package/types/Checkbox/ToggleFacade/props.d.ts.map +1 -1
- package/types/Checkbox/index.d.ts +32 -29
- package/types/Checkbox/index.d.ts.map +1 -1
- package/types/Checkbox/props.d.ts +34 -8
- package/types/Checkbox/props.d.ts.map +1 -1
- package/types/Checkbox/styles.d.ts +2 -1
- package/types/Checkbox/styles.d.ts.map +1 -1
- package/types/CheckboxGroup/CheckboxGroupLocator.d.ts +4 -4
- package/types/CheckboxGroup/index.d.ts +16 -14
- package/types/CheckboxGroup/index.d.ts.map +1 -1
- package/types/CheckboxGroup/props.d.ts +11 -5
- package/types/CheckboxGroup/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.15.0](https://github.com/instructure/instructure-ui/compare/v8.14.0...v8.15.0) (2022-01-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-checkbox
|
|
9
|
+
|
|
6
10
|
# [8.14.0](https://github.com/instructure/instructure-ui/compare/v8.13.0...v8.14.0) (2021-12-16)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-checkbox
|
|
@@ -37,6 +37,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
37
37
|
---
|
|
38
38
|
parent: Checkbox
|
|
39
39
|
---
|
|
40
|
+
@tsProps
|
|
40
41
|
**/
|
|
41
42
|
let CheckboxFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class CheckboxFacade extends Component {
|
|
42
43
|
constructor() {
|
|
@@ -49,11 +50,15 @@ let CheckboxFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
componentDidMount() {
|
|
52
|
-
|
|
53
|
+
var _this$props$makeStyle, _this$props;
|
|
54
|
+
|
|
55
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
componentDidUpdate(
|
|
56
|
-
|
|
58
|
+
componentDidUpdate() {
|
|
59
|
+
var _this$props$makeStyle2, _this$props2;
|
|
60
|
+
|
|
61
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
renderIcon() {
|
|
@@ -77,9 +82,9 @@ let CheckboxFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
render() {
|
|
80
|
-
const _this$
|
|
81
|
-
children = _this$
|
|
82
|
-
styles = _this$
|
|
85
|
+
const _this$props3 = this.props,
|
|
86
|
+
children = _this$props3.children,
|
|
87
|
+
styles = _this$props3.styles;
|
|
83
88
|
return jsx("span", {
|
|
84
89
|
css: styles === null || styles === void 0 ? void 0 : styles.checkboxFacade,
|
|
85
90
|
ref: this.handleRef
|
|
@@ -28,10 +28,6 @@ const propTypes = {
|
|
|
28
28
|
focused: PropTypes.bool,
|
|
29
29
|
hovered: PropTypes.bool,
|
|
30
30
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Visual state showing that child checkboxes are a combination of checked and unchecked
|
|
34
|
-
*/
|
|
35
31
|
indeterminate: PropTypes.bool
|
|
36
32
|
};
|
|
37
33
|
const allowedProps = ['children', 'checked', 'focused', 'hovered', 'size', 'indeterminate'];
|
|
@@ -22,5 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { Checkbox } from './index';
|
|
25
|
+
import { Checkbox } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
26
|
+
|
|
26
27
|
export const CheckboxLocator = locator(Checkbox.selector);
|
|
@@ -36,6 +36,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
36
36
|
---
|
|
37
37
|
parent: Checkbox
|
|
38
38
|
---
|
|
39
|
+
@tsProps
|
|
39
40
|
**/
|
|
40
41
|
let ToggleFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class ToggleFacade extends Component {
|
|
41
42
|
constructor() {
|
|
@@ -48,17 +49,21 @@ let ToggleFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
componentDidMount() {
|
|
51
|
-
|
|
52
|
+
var _this$props$makeStyle, _this$props;
|
|
53
|
+
|
|
54
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
componentDidUpdate(
|
|
55
|
-
|
|
57
|
+
componentDidUpdate() {
|
|
58
|
+
var _this$props$makeStyle2, _this$props2;
|
|
59
|
+
|
|
60
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
renderIcon() {
|
|
59
|
-
const _this$
|
|
60
|
-
styles = _this$
|
|
61
|
-
checked = _this$
|
|
64
|
+
const _this$props3 = this.props,
|
|
65
|
+
styles = _this$props3.styles,
|
|
66
|
+
checked = _this$props3.checked;
|
|
62
67
|
|
|
63
68
|
if (checked) {
|
|
64
69
|
return jsx(IconCheckSolid, {
|
|
@@ -72,18 +77,18 @@ let ToggleFacade = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
renderLabel() {
|
|
75
|
-
const _this$
|
|
76
|
-
children = _this$
|
|
77
|
-
styles = _this$
|
|
80
|
+
const _this$props4 = this.props,
|
|
81
|
+
children = _this$props4.children,
|
|
82
|
+
styles = _this$props4.styles;
|
|
78
83
|
return jsx("span", {
|
|
79
84
|
css: styles === null || styles === void 0 ? void 0 : styles.label
|
|
80
85
|
}, children);
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
render() {
|
|
84
|
-
const _this$
|
|
85
|
-
labelPlacement = _this$
|
|
86
|
-
styles = _this$
|
|
89
|
+
const _this$props5 = this.props,
|
|
90
|
+
labelPlacement = _this$props5.labelPlacement,
|
|
91
|
+
styles = _this$props5.styles;
|
|
87
92
|
return jsx("span", {
|
|
88
93
|
css: styles === null || styles === void 0 ? void 0 : styles.toggleFacade,
|
|
89
94
|
ref: this.handleRef
|
package/es/Checkbox/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
|
-
import { Component } from 'react';
|
|
28
|
+
import React, { Component } from 'react';
|
|
29
29
|
import keycode from 'keycode';
|
|
30
30
|
import { FormFieldMessages } from '@instructure/ui-form-field';
|
|
31
31
|
import { createChainedFunction } from '@instructure/ui-utils';
|
|
@@ -46,10 +46,13 @@ import { propTypes, allowedProps } from './props';
|
|
|
46
46
|
category: components
|
|
47
47
|
tags: toggle, switch
|
|
48
48
|
---
|
|
49
|
+
@tsProps
|
|
49
50
|
**/
|
|
50
51
|
let Checkbox = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Checkbox extends Component {
|
|
51
52
|
constructor(props) {
|
|
52
53
|
super(props);
|
|
54
|
+
this._defaultId = void 0;
|
|
55
|
+
this._input = null;
|
|
53
56
|
this.ref = null;
|
|
54
57
|
|
|
55
58
|
this.handleRef = el => {
|
|
@@ -80,32 +83,31 @@ let Checkbox = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(
|
|
|
80
83
|
};
|
|
81
84
|
|
|
82
85
|
this.handleKeyDown = e => {
|
|
83
|
-
if (this.props.variant === 'toggle' &&
|
|
84
|
-
this._input.click();
|
|
85
|
-
|
|
86
|
+
if (this.props.variant === 'toggle' && e.keyCode === keycode.codes.enter) {
|
|
87
|
+
this._input && this._input.click();
|
|
86
88
|
e.preventDefault();
|
|
87
89
|
}
|
|
88
90
|
};
|
|
89
91
|
|
|
90
|
-
this.handleFocus =
|
|
92
|
+
this.handleFocus = () => {
|
|
91
93
|
this.setState({
|
|
92
94
|
focused: true
|
|
93
95
|
});
|
|
94
96
|
};
|
|
95
97
|
|
|
96
|
-
this.handleBlur =
|
|
98
|
+
this.handleBlur = () => {
|
|
97
99
|
this.setState({
|
|
98
100
|
focused: false
|
|
99
101
|
});
|
|
100
102
|
};
|
|
101
103
|
|
|
102
|
-
this.handleMouseOver =
|
|
104
|
+
this.handleMouseOver = () => {
|
|
103
105
|
this.setState({
|
|
104
106
|
hovered: true
|
|
105
107
|
});
|
|
106
108
|
};
|
|
107
109
|
|
|
108
|
-
this.handleMouseOut =
|
|
110
|
+
this.handleMouseOut = () => {
|
|
109
111
|
this.setState({
|
|
110
112
|
hovered: false
|
|
111
113
|
});
|
|
@@ -113,29 +115,30 @@ let Checkbox = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(
|
|
|
113
115
|
|
|
114
116
|
this.state = {
|
|
115
117
|
focused: false,
|
|
116
|
-
hovered: false
|
|
118
|
+
hovered: false,
|
|
119
|
+
checked: typeof props.checked === 'undefined' ? !!props.defaultChecked : void 0
|
|
117
120
|
};
|
|
118
|
-
|
|
119
|
-
if (typeof props.checked === 'undefined') {
|
|
120
|
-
this.state.checked = !!props.defaultChecked;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
121
|
this._defaultId = uid('Checkbox');
|
|
124
122
|
}
|
|
125
123
|
|
|
126
124
|
componentDidMount() {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
this.
|
|
125
|
+
var _this$props$makeStyle, _this$props2;
|
|
126
|
+
|
|
127
|
+
if (this._input) {
|
|
128
|
+
this._input.indeterminate = this.props.indeterminate;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
componentDidUpdate(prevProps) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
var _this$props$makeStyle2, _this$props3;
|
|
136
|
+
|
|
137
|
+
if (prevProps.indeterminate !== this.props.indeterminate && this._input) {
|
|
138
|
+
this._input.indeterminate = this.props.indeterminate || false;
|
|
136
139
|
}
|
|
137
140
|
|
|
138
|
-
this.props.makeStyles();
|
|
141
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
get id() {
|
|
@@ -155,15 +158,15 @@ let Checkbox = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(
|
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
renderFacade() {
|
|
158
|
-
const _this$
|
|
159
|
-
size = _this$
|
|
160
|
-
disabled = _this$
|
|
161
|
-
variant = _this$
|
|
162
|
-
label = _this$
|
|
163
|
-
readOnly = _this$
|
|
164
|
-
indeterminate = _this$
|
|
165
|
-
labelPlacement = _this$
|
|
166
|
-
themeOverride = _this$
|
|
161
|
+
const _this$props4 = this.props,
|
|
162
|
+
size = _this$props4.size,
|
|
163
|
+
disabled = _this$props4.disabled,
|
|
164
|
+
variant = _this$props4.variant,
|
|
165
|
+
label = _this$props4.label,
|
|
166
|
+
readOnly = _this$props4.readOnly,
|
|
167
|
+
indeterminate = _this$props4.indeterminate,
|
|
168
|
+
labelPlacement = _this$props4.labelPlacement,
|
|
169
|
+
themeOverride = _this$props4.themeOverride;
|
|
167
170
|
const _this$state = this.state,
|
|
168
171
|
hovered = _this$state.hovered,
|
|
169
172
|
focused = _this$state.focused;
|
|
@@ -173,7 +176,6 @@ let Checkbox = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(
|
|
|
173
176
|
return jsx(ToggleFacade, {
|
|
174
177
|
disabled: disabled,
|
|
175
178
|
size: size,
|
|
176
|
-
hovered: hovered,
|
|
177
179
|
focused: focused,
|
|
178
180
|
checked: this.checked,
|
|
179
181
|
readOnly: readOnly,
|
|
@@ -203,18 +205,18 @@ let Checkbox = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(
|
|
|
203
205
|
}
|
|
204
206
|
|
|
205
207
|
render() {
|
|
206
|
-
const _this$
|
|
207
|
-
disabled = _this$
|
|
208
|
-
readOnly = _this$
|
|
209
|
-
value = _this$
|
|
210
|
-
onKeyDown = _this$
|
|
211
|
-
onFocus = _this$
|
|
212
|
-
onBlur = _this$
|
|
213
|
-
onMouseOver = _this$
|
|
214
|
-
onMouseOut = _this$
|
|
215
|
-
indeterminate = _this$
|
|
216
|
-
variant = _this$
|
|
217
|
-
styles = _this$
|
|
208
|
+
const _this$props5 = this.props,
|
|
209
|
+
disabled = _this$props5.disabled,
|
|
210
|
+
readOnly = _this$props5.readOnly,
|
|
211
|
+
value = _this$props5.value,
|
|
212
|
+
onKeyDown = _this$props5.onKeyDown,
|
|
213
|
+
onFocus = _this$props5.onFocus,
|
|
214
|
+
onBlur = _this$props5.onBlur,
|
|
215
|
+
onMouseOver = _this$props5.onMouseOver,
|
|
216
|
+
onMouseOut = _this$props5.onMouseOut,
|
|
217
|
+
indeterminate = _this$props5.indeterminate,
|
|
218
|
+
variant = _this$props5.variant,
|
|
219
|
+
styles = _this$props5.styles;
|
|
218
220
|
const props = omitProps(this.props, Checkbox.allowedProps);
|
|
219
221
|
error(!(variant === 'toggle' && indeterminate), `[Checkbox] The \`toggle\` variant does not support the \`indeterminate\` property. Use the \`simple\` variant instead.`);
|
|
220
222
|
/* eslint-disable jsx-a11y/mouse-events-have-key-events */
|
package/es/Checkbox/props.js
CHANGED
|
@@ -28,46 +28,17 @@ const propTypes = {
|
|
|
28
28
|
label: PropTypes.node.isRequired,
|
|
29
29
|
id: PropTypes.string,
|
|
30
30
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* object with shape: `{
|
|
34
|
-
* text: PropTypes.node,
|
|
35
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
36
|
-
* }`
|
|
37
|
-
*/
|
|
38
31
|
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
39
|
-
|
|
40
|
-
/* whether to set the input to checked or not on initial render */
|
|
41
32
|
defaultChecked: PropTypes.bool,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* whether the input is checked or not (must be accompanied by an `onChange` prop)
|
|
45
|
-
*/
|
|
46
33
|
checked: controllable(PropTypes.bool, 'onChange', 'defaultChecked'),
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* when used with the `checked` prop, the component will not control its own state
|
|
50
|
-
*/
|
|
51
34
|
onChange: PropTypes.func,
|
|
52
35
|
onKeyDown: PropTypes.func,
|
|
53
36
|
onFocus: PropTypes.func,
|
|
54
37
|
onBlur: PropTypes.func,
|
|
55
38
|
onMouseOver: PropTypes.func,
|
|
56
39
|
onMouseOut: PropTypes.func,
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Whether or not to disable the checkbox
|
|
60
|
-
*/
|
|
61
40
|
disabled: PropTypes.bool,
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Works just like disabled but keeps the same styles as if it were active
|
|
65
|
-
*/
|
|
66
41
|
readOnly: PropTypes.bool,
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Visual state showing that child checkboxes are a combination of checked and unchecked
|
|
70
|
-
*/
|
|
71
42
|
indeterminate: PropTypes.bool,
|
|
72
43
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
73
44
|
variant: PropTypes.oneOf(['simple', 'toggle']),
|
package/es/Checkbox/styles.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* @param {Object} state the state of the component, the style is applied to
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
|
-
const generateStyle = (
|
|
35
|
+
const generateStyle = (_componentTheme, props) => {
|
|
36
36
|
const inline = props.inline,
|
|
37
37
|
disabled = props.disabled;
|
|
38
38
|
return {
|
|
@@ -22,5 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { CheckboxGroup } from './index';
|
|
25
|
+
import { CheckboxGroup } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
26
|
+
|
|
26
27
|
export const CheckboxGroupLocator = locator(CheckboxGroup.selector);
|
|
@@ -35,10 +35,12 @@ import { propTypes, allowedProps } from './props';
|
|
|
35
35
|
---
|
|
36
36
|
category: components
|
|
37
37
|
---
|
|
38
|
+
@tsProps
|
|
38
39
|
**/
|
|
39
40
|
let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class CheckboxGroup extends Component {
|
|
40
41
|
constructor(props) {
|
|
41
|
-
super();
|
|
42
|
+
super(props);
|
|
43
|
+
this._messagesId = void 0;
|
|
42
44
|
this.ref = null;
|
|
43
45
|
|
|
44
46
|
this.handleRef = el => {
|
|
@@ -46,7 +48,7 @@ let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class C
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
this.handleChange = e => {
|
|
49
|
-
const newValue = this.value
|
|
51
|
+
const newValue = this.value;
|
|
50
52
|
|
|
51
53
|
if (this.props.disabled || this.props.readOnly) {
|
|
52
54
|
e.preventDefault();
|
|
@@ -72,7 +74,7 @@ let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class C
|
|
|
72
74
|
|
|
73
75
|
if (typeof props.value === 'undefined') {
|
|
74
76
|
this.state = {
|
|
75
|
-
value: props.defaultValue
|
|
77
|
+
value: props.defaultValue || []
|
|
76
78
|
};
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -84,11 +86,7 @@ let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class C
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
get value() {
|
|
87
|
-
|
|
88
|
-
return [];
|
|
89
|
-
} else {
|
|
90
|
-
return typeof this.props.value === 'undefined' ? [...this.state.value] : [...this.props.value];
|
|
91
|
-
}
|
|
89
|
+
return typeof this.props.value === 'undefined' ? [...this.state.value] : [...this.props.value];
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
renderChildren() {
|
|
@@ -98,18 +96,19 @@ let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class C
|
|
|
98
96
|
size = _this$props.size,
|
|
99
97
|
disabled = _this$props.disabled,
|
|
100
98
|
readOnly = _this$props.readOnly;
|
|
101
|
-
return Children.map(children,
|
|
99
|
+
return Children.map(children, child => {
|
|
102
100
|
if (matchComponentTypes(child, [Checkbox])) {
|
|
103
101
|
return safeCloneElement(child, {
|
|
104
102
|
key: `${child.props.name}`,
|
|
105
103
|
name,
|
|
104
|
+
label: child.props.label,
|
|
106
105
|
disabled: disabled || child.props.disabled,
|
|
107
106
|
readOnly: readOnly || child.props.readOnly,
|
|
108
107
|
size,
|
|
109
108
|
checked: this.value.indexOf(child.props.value) > -1,
|
|
110
109
|
onChange: this.handleChange,
|
|
111
110
|
width: child.props.width || 'auto',
|
|
112
|
-
'aria-describedby': this.hasMessages
|
|
111
|
+
'aria-describedby': this.hasMessages ? this._messagesId : void 0
|
|
113
112
|
});
|
|
114
113
|
} else {
|
|
115
114
|
return child;
|
|
@@ -118,15 +117,13 @@ let CheckboxGroup = (_dec = testable(), _dec(_class = (_temp = _class2 = class C
|
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
render() {
|
|
121
|
-
return (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}), this.renderChildren())
|
|
129
|
-
);
|
|
120
|
+
return /*#__PURE__*/React.createElement(FormFieldGroup, Object.assign({}, omitProps(this.props, CheckboxGroup.allowedProps), pickProps(this.props, FormFieldGroup.allowedProps), {
|
|
121
|
+
description: this.props.description,
|
|
122
|
+
rowSpacing: "small",
|
|
123
|
+
vAlign: "top",
|
|
124
|
+
messagesId: this._messagesId,
|
|
125
|
+
elementRef: this.handleRef
|
|
126
|
+
}), this.renderChildren());
|
|
130
127
|
}
|
|
131
128
|
|
|
132
129
|
}, _class2.displayName = "CheckboxGroup", _class2.componentId = 'CheckboxGroup', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
@@ -27,6 +27,7 @@ var _dec, _class, _class2, _temp, _SVGIcon, _IconCheckMarkSolid;
|
|
|
27
27
|
---
|
|
28
28
|
parent: Checkbox
|
|
29
29
|
---
|
|
30
|
+
@tsProps
|
|
30
31
|
**/
|
|
31
32
|
let CheckboxFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class CheckboxFacade extends _react.Component {
|
|
32
33
|
constructor() {
|
|
@@ -39,11 +40,15 @@ let CheckboxFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
componentDidMount() {
|
|
42
|
-
|
|
43
|
+
var _this$props$makeStyle, _this$props;
|
|
44
|
+
|
|
45
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
componentDidUpdate(
|
|
46
|
-
|
|
48
|
+
componentDidUpdate() {
|
|
49
|
+
var _this$props$makeStyle2, _this$props2;
|
|
50
|
+
|
|
51
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
renderIcon() {
|
|
@@ -67,9 +72,9 @@ let CheckboxFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
|
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
render() {
|
|
70
|
-
const _this$
|
|
71
|
-
children = _this$
|
|
72
|
-
styles = _this$
|
|
75
|
+
const _this$props3 = this.props,
|
|
76
|
+
children = _this$props3.children,
|
|
77
|
+
styles = _this$props3.styles;
|
|
73
78
|
return (0, _emotion.jsx)("span", {
|
|
74
79
|
css: styles === null || styles === void 0 ? void 0 : styles.checkboxFacade,
|
|
75
80
|
ref: this.handleRef
|
|
@@ -38,10 +38,6 @@ const propTypes = {
|
|
|
38
38
|
focused: _propTypes.default.bool,
|
|
39
39
|
hovered: _propTypes.default.bool,
|
|
40
40
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Visual state showing that child checkboxes are a combination of checked and unchecked
|
|
44
|
-
*/
|
|
45
41
|
indeterminate: _propTypes.default.bool
|
|
46
42
|
};
|
|
47
43
|
exports.propTypes = propTypes;
|
|
@@ -32,5 +32,6 @@ var _index = require("./index");
|
|
|
32
32
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
33
|
* SOFTWARE.
|
|
34
34
|
*/
|
|
35
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
35
36
|
const CheckboxLocator = (0, _locator.locator)(_index.Checkbox.selector);
|
|
36
37
|
exports.CheckboxLocator = CheckboxLocator;
|
|
@@ -27,6 +27,7 @@ var _dec, _class, _class2, _temp;
|
|
|
27
27
|
---
|
|
28
28
|
parent: Checkbox
|
|
29
29
|
---
|
|
30
|
+
@tsProps
|
|
30
31
|
**/
|
|
31
32
|
let ToggleFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class ToggleFacade extends _react.Component {
|
|
32
33
|
constructor() {
|
|
@@ -39,17 +40,21 @@ let ToggleFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
componentDidMount() {
|
|
42
|
-
|
|
43
|
+
var _this$props$makeStyle, _this$props;
|
|
44
|
+
|
|
45
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
componentDidUpdate(
|
|
46
|
-
|
|
48
|
+
componentDidUpdate() {
|
|
49
|
+
var _this$props$makeStyle2, _this$props2;
|
|
50
|
+
|
|
51
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
renderIcon() {
|
|
50
|
-
const _this$
|
|
51
|
-
styles = _this$
|
|
52
|
-
checked = _this$
|
|
55
|
+
const _this$props3 = this.props,
|
|
56
|
+
styles = _this$props3.styles,
|
|
57
|
+
checked = _this$props3.checked;
|
|
53
58
|
|
|
54
59
|
if (checked) {
|
|
55
60
|
return (0, _emotion.jsx)(_IconCheckSolid.IconCheckSolid, {
|
|
@@ -63,18 +68,18 @@ let ToggleFacade = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
renderLabel() {
|
|
66
|
-
const _this$
|
|
67
|
-
children = _this$
|
|
68
|
-
styles = _this$
|
|
71
|
+
const _this$props4 = this.props,
|
|
72
|
+
children = _this$props4.children,
|
|
73
|
+
styles = _this$props4.styles;
|
|
69
74
|
return (0, _emotion.jsx)("span", {
|
|
70
75
|
css: styles === null || styles === void 0 ? void 0 : styles.label
|
|
71
76
|
}, children);
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
render() {
|
|
75
|
-
const _this$
|
|
76
|
-
labelPlacement = _this$
|
|
77
|
-
styles = _this$
|
|
80
|
+
const _this$props5 = this.props,
|
|
81
|
+
labelPlacement = _this$props5.labelPlacement,
|
|
82
|
+
styles = _this$props5.styles;
|
|
78
83
|
return (0, _emotion.jsx)("span", {
|
|
79
84
|
css: styles === null || styles === void 0 ? void 0 : styles.toggleFacade,
|
|
80
85
|
ref: this.handleRef
|