@instructure/ui-radio-input 8.33.1 → 8.33.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/RadioInput/RadioInputLocator.js +3 -1
- package/es/RadioInput/index.js +7 -26
- package/es/RadioInput/locator.js +1 -0
- package/es/RadioInput/props.js +1 -0
- package/es/RadioInput/styles.js +6 -10
- package/es/RadioInput/theme.js +8 -8
- package/es/RadioInputGroup/RadioInputGroupLocator.js +3 -1
- package/es/RadioInputGroup/index.js +14 -24
- package/es/RadioInputGroup/locator.js +1 -0
- package/es/RadioInputGroup/props.js +1 -0
- package/lib/RadioInput/RadioInputLocator.js +1 -3
- package/lib/RadioInput/index.js +6 -37
- package/lib/RadioInput/locator.js +0 -2
- package/lib/RadioInput/props.js +1 -3
- package/lib/RadioInput/styles.js +6 -11
- package/lib/RadioInput/theme.js +8 -9
- package/lib/RadioInputGroup/RadioInputGroupLocator.js +1 -3
- package/lib/RadioInputGroup/index.js +13 -35
- package/lib/RadioInputGroup/locator.js +0 -2
- package/lib/RadioInputGroup/props.js +1 -5
- package/lib/index.js +0 -2
- package/package.json +13 -13
- package/tsconfig.build.tsbuildinfo +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.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-radio-input
|
|
9
|
+
|
|
6
10
|
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-radio-input
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { RadioInput } from './index';
|
|
26
|
+
import { RadioInput } from './index';
|
|
26
27
|
|
|
28
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
27
29
|
export const RadioInputLocator = locator(RadioInput.selector);
|
package/es/RadioInput/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _dec3, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -33,95 +32,78 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
33
32
|
import generateStyle from './styles';
|
|
34
33
|
import generateComponentTheme from './theme';
|
|
35
34
|
import { allowedProps, propTypes } from './props';
|
|
35
|
+
|
|
36
36
|
/**
|
|
37
37
|
---
|
|
38
38
|
category: components
|
|
39
39
|
---
|
|
40
40
|
@tsProps
|
|
41
41
|
**/
|
|
42
|
-
|
|
43
42
|
let RadioInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class RadioInput extends Component {
|
|
44
43
|
constructor(props) {
|
|
45
44
|
super(props);
|
|
46
45
|
this.ref = null;
|
|
47
46
|
this._defaultId = void 0;
|
|
48
47
|
this._input = null;
|
|
49
|
-
|
|
50
48
|
this.handleClick = e => {
|
|
51
49
|
if (this.props.disabled || this.props.readOnly) {
|
|
52
50
|
e.preventDefault();
|
|
53
51
|
return;
|
|
54
52
|
}
|
|
55
|
-
|
|
56
53
|
if (typeof this.props.onClick === 'function') {
|
|
57
54
|
this.props.onClick(e);
|
|
58
55
|
}
|
|
59
56
|
};
|
|
60
|
-
|
|
61
57
|
this.handleChange = e => {
|
|
62
58
|
if (this.props.disabled || this.props.readOnly) {
|
|
63
59
|
e.preventDefault();
|
|
64
60
|
return;
|
|
65
61
|
}
|
|
66
|
-
|
|
67
62
|
if (typeof this.props.checked === 'undefined') {
|
|
68
63
|
this.setState({
|
|
69
64
|
checked: !this.state.checked
|
|
70
65
|
});
|
|
71
66
|
}
|
|
72
|
-
|
|
73
67
|
if (typeof this.props.onChange === 'function') {
|
|
74
68
|
this.props.onChange(e);
|
|
75
69
|
}
|
|
76
70
|
};
|
|
77
|
-
|
|
78
71
|
if (typeof props.checked === 'undefined') {
|
|
79
72
|
this.state = {
|
|
80
73
|
checked: false
|
|
81
74
|
};
|
|
82
75
|
}
|
|
83
|
-
|
|
84
76
|
this._defaultId = props.deterministicId();
|
|
85
77
|
}
|
|
86
|
-
|
|
87
78
|
componentDidMount() {
|
|
88
79
|
var _this$props$makeStyle, _this$props;
|
|
89
|
-
|
|
90
80
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
91
81
|
}
|
|
92
|
-
|
|
93
82
|
componentDidUpdate() {
|
|
94
83
|
var _this$props$makeStyle2, _this$props2;
|
|
95
|
-
|
|
96
84
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
97
85
|
}
|
|
98
|
-
|
|
99
86
|
focus() {
|
|
100
87
|
var _this$_input;
|
|
101
|
-
|
|
102
88
|
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
|
|
103
89
|
}
|
|
104
|
-
|
|
105
90
|
get id() {
|
|
106
91
|
return this.props.id || this._defaultId;
|
|
107
92
|
}
|
|
108
|
-
|
|
109
93
|
get focused() {
|
|
110
94
|
return isActiveElement(this._input);
|
|
111
95
|
}
|
|
112
|
-
|
|
113
96
|
get checked() {
|
|
114
97
|
return typeof this.props.checked === 'undefined' ? this.state.checked : this.props.checked;
|
|
115
98
|
}
|
|
116
|
-
|
|
117
99
|
render() {
|
|
118
100
|
const _this$props3 = this.props,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
101
|
+
disabled = _this$props3.disabled,
|
|
102
|
+
readOnly = _this$props3.readOnly,
|
|
103
|
+
label = _this$props3.label,
|
|
104
|
+
value = _this$props3.value,
|
|
105
|
+
name = _this$props3.name,
|
|
106
|
+
styles = _this$props3.styles;
|
|
125
107
|
const props = omitProps(this.props, RadioInput.allowedProps);
|
|
126
108
|
return jsx("div", {
|
|
127
109
|
css: styles === null || styles === void 0 ? void 0 : styles.radioInput,
|
|
@@ -152,7 +134,6 @@ let RadioInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
152
134
|
css: styles === null || styles === void 0 ? void 0 : styles.label
|
|
153
135
|
}, label)));
|
|
154
136
|
}
|
|
155
|
-
|
|
156
137
|
}, _class2.displayName = "RadioInput", _class2.componentId = 'RadioInput', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
157
138
|
variant: 'simple',
|
|
158
139
|
size: 'medium',
|
package/es/RadioInput/locator.js
CHANGED
package/es/RadioInput/props.js
CHANGED
package/es/RadioInput/styles.js
CHANGED
|
@@ -34,13 +34,11 @@
|
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props) => {
|
|
36
36
|
const disabled = props.disabled,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
variant = props.variant,
|
|
38
|
+
context = props.context,
|
|
39
|
+
size = props.size,
|
|
40
|
+
inline = props.inline;
|
|
42
41
|
const getInputStateSelector = state => `[class$=-radioInput__input]:${state} + [class$=-radioInput__control] &`;
|
|
43
|
-
|
|
44
42
|
const toggleFacadeContextVariants = {
|
|
45
43
|
success: {
|
|
46
44
|
backgroundColor: componentTheme.toggleBackgroundSuccess
|
|
@@ -261,10 +259,9 @@ const generateStyle = (componentTheme, props) => {
|
|
|
261
259
|
position: 'absolute',
|
|
262
260
|
top: '0',
|
|
263
261
|
left: '0',
|
|
264
|
-
opacity: 0.0001
|
|
265
|
-
/* selenium cannot find fully transparent elements */
|
|
266
|
-
|
|
262
|
+
opacity: 0.0001 /* selenium cannot find fully transparent elements */
|
|
267
263
|
};
|
|
264
|
+
|
|
268
265
|
return {
|
|
269
266
|
radioInput: {
|
|
270
267
|
label: 'radioInput',
|
|
@@ -320,5 +317,4 @@ const generateStyle = (componentTheme, props) => {
|
|
|
320
317
|
}
|
|
321
318
|
};
|
|
322
319
|
};
|
|
323
|
-
|
|
324
320
|
export default generateStyle;
|
package/es/RadioInput/theme.js
CHANGED
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const spacing = theme.spacing,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
borders = theme.borders,
|
|
33
|
+
colors = theme.colors,
|
|
34
|
+
forms = theme.forms,
|
|
35
|
+
shadows = theme.shadows,
|
|
36
|
+
typography = theme.typography,
|
|
37
|
+
themeName = theme.key;
|
|
38
38
|
const themeSpecificStyle = {
|
|
39
39
|
canvas: {
|
|
40
40
|
focusBorderColor: theme['ic-brand-primary'],
|
|
@@ -84,9 +84,9 @@ const generateComponentTheme = theme => {
|
|
|
84
84
|
toggleMediumFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
|
|
85
85
|
toggleLargeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium
|
|
86
86
|
};
|
|
87
|
-
return {
|
|
87
|
+
return {
|
|
88
|
+
...componentVariables,
|
|
88
89
|
...themeSpecificStyle[themeName]
|
|
89
90
|
};
|
|
90
91
|
};
|
|
91
|
-
|
|
92
92
|
export default generateComponentTheme;
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { RadioInputGroup } from './index';
|
|
26
|
+
import { RadioInputGroup } from './index';
|
|
26
27
|
|
|
28
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
27
29
|
export const RadioInputGroupLocator = locator(RadioInputGroup.selector);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -23,13 +22,13 @@ var _dec, _dec2, _class, _class2;
|
|
|
23
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
23
|
* SOFTWARE.
|
|
25
24
|
*/
|
|
25
|
+
|
|
26
26
|
import React, { Children, Component } from 'react';
|
|
27
27
|
import { FormFieldGroup } from '@instructure/ui-form-field';
|
|
28
28
|
import { testable } from '@instructure/ui-testable';
|
|
29
29
|
import { matchComponentTypes, safeCloneElement, omitProps, pickProps, withDeterministicId } from '@instructure/ui-react-utils';
|
|
30
30
|
import { RadioInput } from '../RadioInput';
|
|
31
31
|
import { allowedProps, propTypes } from './props';
|
|
32
|
-
|
|
33
32
|
/**
|
|
34
33
|
---
|
|
35
34
|
category: components
|
|
@@ -41,57 +40,48 @@ let RadioInputGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_c
|
|
|
41
40
|
super(props);
|
|
42
41
|
this.ref = null;
|
|
43
42
|
this._messagesId = void 0;
|
|
44
|
-
|
|
45
43
|
this.handleRef = el => {
|
|
46
44
|
this.ref = el;
|
|
47
45
|
};
|
|
48
|
-
|
|
49
46
|
this.handleChange = e => {
|
|
50
47
|
const value = e.target.value;
|
|
51
|
-
|
|
52
48
|
if (this.props.disabled || this.props.readOnly) {
|
|
53
49
|
e.preventDefault();
|
|
54
50
|
return;
|
|
55
51
|
}
|
|
56
|
-
|
|
57
52
|
if (typeof this.props.value === 'undefined') {
|
|
58
53
|
this.setState({
|
|
59
54
|
value
|
|
60
55
|
});
|
|
61
56
|
}
|
|
62
|
-
|
|
63
57
|
if (typeof this.props.onChange === 'function') {
|
|
64
58
|
this.props.onChange(e, value);
|
|
65
59
|
}
|
|
66
60
|
};
|
|
67
|
-
|
|
68
61
|
if (typeof props.value === 'undefined') {
|
|
69
62
|
this.state = {
|
|
70
63
|
value: props.defaultValue
|
|
71
64
|
};
|
|
72
65
|
}
|
|
73
|
-
|
|
74
66
|
this._messagesId = props.deterministicId('RadioInputGroup-messages');
|
|
75
67
|
}
|
|
76
|
-
|
|
77
68
|
get hasMessages() {
|
|
78
69
|
return !!this.props.messages && this.props.messages.length > 0;
|
|
79
70
|
}
|
|
80
|
-
|
|
81
71
|
get value() {
|
|
82
72
|
return typeof this.props.value === 'undefined' ? this.state.value : this.props.value;
|
|
83
73
|
}
|
|
84
|
-
|
|
85
74
|
renderChildren() {
|
|
86
75
|
const _this$props = this.props,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// and checks the input whose value matches the value property
|
|
76
|
+
children = _this$props.children,
|
|
77
|
+
name = _this$props.name,
|
|
78
|
+
variant = _this$props.variant,
|
|
79
|
+
size = _this$props.size,
|
|
80
|
+
disabled = _this$props.disabled,
|
|
81
|
+
readOnly = _this$props.readOnly;
|
|
94
82
|
|
|
83
|
+
// This adds the passed in name property to each RadioInput component
|
|
84
|
+
// and checks the input whose value matches the value property
|
|
95
85
|
return Children.map(children, (child, index) => {
|
|
96
86
|
if (matchComponentTypes(child, [RadioInput])) {
|
|
97
87
|
const isChecked = this.value === child.props.value;
|
|
@@ -120,11 +110,12 @@ let RadioInputGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_c
|
|
|
120
110
|
|
|
121
111
|
render() {
|
|
122
112
|
const _this$props2 = this.props,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
113
|
+
variant = _this$props2.variant,
|
|
114
|
+
layout = _this$props2.layout,
|
|
115
|
+
description = _this$props2.description;
|
|
126
116
|
return /*#__PURE__*/React.createElement(FormFieldGroup, Object.assign({}, omitProps(this.props, RadioInputGroup.allowedProps), pickProps(this.props, FormFieldGroup.allowedProps), {
|
|
127
|
-
description: description
|
|
117
|
+
description: description
|
|
118
|
+
// TODO: split out toggle variant into its own component
|
|
128
119
|
,
|
|
129
120
|
layout: layout === 'columns' && variant === 'toggle' ? 'stacked' : layout // toggles already display in cols
|
|
130
121
|
,
|
|
@@ -137,7 +128,6 @@ let RadioInputGroup = (_dec = withDeterministicId(), _dec2 = testable(), _dec(_c
|
|
|
137
128
|
elementRef: this.handleRef
|
|
138
129
|
}), this.renderChildren());
|
|
139
130
|
}
|
|
140
|
-
|
|
141
131
|
}, _class2.displayName = "RadioInputGroup", _class2.componentId = 'RadioInputGroup', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
142
132
|
disabled: false,
|
|
143
133
|
variant: 'simple',
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
import { controllable } from '@instructure/ui-prop-types';
|
|
26
27
|
import { FormPropTypes } from '@instructure/ui-form-field';
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RadioInputLocator = 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 RadioInputLocator = (0, _locator.locator)(_index.RadioInput.selector);
|
|
37
35
|
exports.RadioInputLocator = RadioInputLocator;
|
package/lib/RadioInput/index.js
CHANGED
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.RadioInput = void 0;
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
15
|
-
|
|
16
11
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
17
|
-
|
|
18
12
|
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
19
|
-
|
|
20
13
|
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
21
|
-
|
|
22
14
|
var _emotion = require("@instructure/emotion");
|
|
23
|
-
|
|
24
15
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
25
|
-
|
|
26
16
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
27
|
-
|
|
28
17
|
var _props = require("./props");
|
|
29
|
-
|
|
30
18
|
var _dec, _dec2, _dec3, _class, _class2;
|
|
31
|
-
|
|
32
19
|
/**
|
|
33
20
|
---
|
|
34
21
|
category: components
|
|
@@ -41,82 +28,65 @@ let RadioInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
41
28
|
this.ref = null;
|
|
42
29
|
this._defaultId = void 0;
|
|
43
30
|
this._input = null;
|
|
44
|
-
|
|
45
31
|
this.handleClick = e => {
|
|
46
32
|
if (this.props.disabled || this.props.readOnly) {
|
|
47
33
|
e.preventDefault();
|
|
48
34
|
return;
|
|
49
35
|
}
|
|
50
|
-
|
|
51
36
|
if (typeof this.props.onClick === 'function') {
|
|
52
37
|
this.props.onClick(e);
|
|
53
38
|
}
|
|
54
39
|
};
|
|
55
|
-
|
|
56
40
|
this.handleChange = e => {
|
|
57
41
|
if (this.props.disabled || this.props.readOnly) {
|
|
58
42
|
e.preventDefault();
|
|
59
43
|
return;
|
|
60
44
|
}
|
|
61
|
-
|
|
62
45
|
if (typeof this.props.checked === 'undefined') {
|
|
63
46
|
this.setState({
|
|
64
47
|
checked: !this.state.checked
|
|
65
48
|
});
|
|
66
49
|
}
|
|
67
|
-
|
|
68
50
|
if (typeof this.props.onChange === 'function') {
|
|
69
51
|
this.props.onChange(e);
|
|
70
52
|
}
|
|
71
53
|
};
|
|
72
|
-
|
|
73
54
|
if (typeof props.checked === 'undefined') {
|
|
74
55
|
this.state = {
|
|
75
56
|
checked: false
|
|
76
57
|
};
|
|
77
58
|
}
|
|
78
|
-
|
|
79
59
|
this._defaultId = props.deterministicId();
|
|
80
60
|
}
|
|
81
|
-
|
|
82
61
|
componentDidMount() {
|
|
83
62
|
var _this$props$makeStyle, _this$props;
|
|
84
|
-
|
|
85
63
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
86
64
|
}
|
|
87
|
-
|
|
88
65
|
componentDidUpdate() {
|
|
89
66
|
var _this$props$makeStyle2, _this$props2;
|
|
90
|
-
|
|
91
67
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
92
68
|
}
|
|
93
|
-
|
|
94
69
|
focus() {
|
|
95
70
|
var _this$_input;
|
|
96
|
-
|
|
97
71
|
(_this$_input = this._input) === null || _this$_input === void 0 ? void 0 : _this$_input.focus();
|
|
98
72
|
}
|
|
99
|
-
|
|
100
73
|
get id() {
|
|
101
74
|
return this.props.id || this._defaultId;
|
|
102
75
|
}
|
|
103
|
-
|
|
104
76
|
get focused() {
|
|
105
77
|
return (0, _isActiveElement.isActiveElement)(this._input);
|
|
106
78
|
}
|
|
107
|
-
|
|
108
79
|
get checked() {
|
|
109
80
|
return typeof this.props.checked === 'undefined' ? this.state.checked : this.props.checked;
|
|
110
81
|
}
|
|
111
|
-
|
|
112
82
|
render() {
|
|
113
83
|
const _this$props3 = this.props,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
84
|
+
disabled = _this$props3.disabled,
|
|
85
|
+
readOnly = _this$props3.readOnly,
|
|
86
|
+
label = _this$props3.label,
|
|
87
|
+
value = _this$props3.value,
|
|
88
|
+
name = _this$props3.name,
|
|
89
|
+
styles = _this$props3.styles;
|
|
120
90
|
const props = (0, _omitProps.omitProps)(this.props, RadioInput.allowedProps);
|
|
121
91
|
return (0, _emotion.jsx)("div", {
|
|
122
92
|
css: styles === null || styles === void 0 ? void 0 : styles.radioInput,
|
|
@@ -147,7 +117,6 @@ let RadioInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
147
117
|
css: styles === null || styles === void 0 ? void 0 : styles.label
|
|
148
118
|
}, label)));
|
|
149
119
|
}
|
|
150
|
-
|
|
151
120
|
}, _class2.displayName = "RadioInput", _class2.componentId = 'RadioInput', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
152
121
|
variant: 'simple',
|
|
153
122
|
size: 'medium',
|
package/lib/RadioInput/props.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
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
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
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
|
const propTypes = {
|
|
36
34
|
label: _propTypes.default.node.isRequired,
|
|
37
35
|
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
package/lib/RadioInput/styles.js
CHANGED
|
@@ -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,13 +40,11 @@ exports.default = void 0;
|
|
|
41
40
|
*/
|
|
42
41
|
const generateStyle = (componentTheme, props) => {
|
|
43
42
|
const disabled = props.disabled,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
variant = props.variant,
|
|
44
|
+
context = props.context,
|
|
45
|
+
size = props.size,
|
|
46
|
+
inline = props.inline;
|
|
49
47
|
const getInputStateSelector = state => `[class$=-radioInput__input]:${state} + [class$=-radioInput__control] &`;
|
|
50
|
-
|
|
51
48
|
const toggleFacadeContextVariants = {
|
|
52
49
|
success: {
|
|
53
50
|
backgroundColor: componentTheme.toggleBackgroundSuccess
|
|
@@ -268,10 +265,9 @@ const generateStyle = (componentTheme, props) => {
|
|
|
268
265
|
position: 'absolute',
|
|
269
266
|
top: '0',
|
|
270
267
|
left: '0',
|
|
271
|
-
opacity: 0.0001
|
|
272
|
-
/* selenium cannot find fully transparent elements */
|
|
273
|
-
|
|
268
|
+
opacity: 0.0001 /* selenium cannot find fully transparent elements */
|
|
274
269
|
};
|
|
270
|
+
|
|
275
271
|
return {
|
|
276
272
|
radioInput: {
|
|
277
273
|
label: 'radioInput',
|
|
@@ -327,6 +323,5 @@ const generateStyle = (componentTheme, props) => {
|
|
|
327
323
|
}
|
|
328
324
|
};
|
|
329
325
|
};
|
|
330
|
-
|
|
331
326
|
var _default = generateStyle;
|
|
332
327
|
exports.default = _default;
|
package/lib/RadioInput/theme.js
CHANGED
|
@@ -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
|
*
|
|
@@ -36,12 +35,12 @@ exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const spacing = theme.spacing,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
borders = theme.borders,
|
|
39
|
+
colors = theme.colors,
|
|
40
|
+
forms = theme.forms,
|
|
41
|
+
shadows = theme.shadows,
|
|
42
|
+
typography = theme.typography,
|
|
43
|
+
themeName = theme.key;
|
|
45
44
|
const themeSpecificStyle = {
|
|
46
45
|
canvas: {
|
|
47
46
|
focusBorderColor: theme['ic-brand-primary'],
|
|
@@ -91,10 +90,10 @@ const generateComponentTheme = theme => {
|
|
|
91
90
|
toggleMediumFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
|
|
92
91
|
toggleLargeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium
|
|
93
92
|
};
|
|
94
|
-
return {
|
|
93
|
+
return {
|
|
94
|
+
...componentVariables,
|
|
95
95
|
...themeSpecificStyle[themeName]
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
|
-
|
|
99
98
|
var _default = generateComponentTheme;
|
|
100
99
|
exports.default = _default;
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RadioInputGroupLocator = 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 RadioInputGroupLocator = (0, _locator.locator)(_index.RadioInputGroup.selector);
|
|
37
35
|
exports.RadioInputGroupLocator = RadioInputGroupLocator;
|