@instructure/ui-radio-input 10.26.1-snapshot-2 → 10.26.1
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 +2 -23
- package/es/RadioInput/index.js +6 -6
- package/es/RadioInput/props.js +18 -1
- package/es/RadioInputGroup/index.js +6 -6
- package/es/RadioInputGroup/props.js +19 -1
- package/lib/RadioInput/index.js +5 -5
- package/lib/RadioInput/props.js +19 -1
- package/lib/RadioInputGroup/index.js +5 -5
- package/lib/RadioInputGroup/props.js +20 -1
- package/package.json +15 -12
- package/src/RadioInput/index.tsx +4 -2
- package/src/RadioInput/props.ts +22 -1
- package/src/RadioInputGroup/index.tsx +4 -2
- package/src/RadioInputGroup/props.ts +25 -1
- package/tsconfig.build.json +2 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/RadioInput/index.d.ts +16 -0
- package/types/RadioInput/index.d.ts.map +1 -1
- package/types/RadioInput/props.d.ts +3 -2
- package/types/RadioInput/props.d.ts.map +1 -1
- package/types/RadioInputGroup/index.d.ts +15 -0
- package/types/RadioInputGroup/index.d.ts.map +1 -1
- package/types/RadioInputGroup/props.d.ts +3 -2
- package/types/RadioInputGroup/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,30 +3,9 @@
|
|
|
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
|
-
## [10.26.1
|
|
6
|
+
## [10.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### BREAKING CHANGES
|
|
15
|
-
|
|
16
|
-
* **many:** InstUI v11 contains the following breaking changes:
|
|
17
|
-
- React 16 and 17 are no longer supported
|
|
18
|
-
- remove `PropTypes` from all packages
|
|
19
|
-
- remove `CodeEditor` component
|
|
20
|
-
- remove `@instui/theme-registry` package
|
|
21
|
-
- remove `@testable`, `@experimental`, `@hack` decorators
|
|
22
|
-
- InstUISettingsProvider's `as` prop is removed
|
|
23
|
-
- `canvas.use()`, `canvasHighContrast.use()` functions are removed
|
|
24
|
-
- `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
|
|
25
|
-
- `variables` field on theme objects are removed
|
|
26
|
-
- remove deprecated props from Table: Row's `isStacked`, Body's
|
|
27
|
-
`isStacked`, `hover`, and `headers`
|
|
28
|
-
- `Table`'s `caption` prop is now required
|
|
29
|
-
- `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-radio-input
|
|
30
9
|
|
|
31
10
|
|
|
32
11
|
|
package/es/RadioInput/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class, _RadioInput;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _RadioInput;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -24,12 +24,13 @@ var _dec, _dec2, _class, _RadioInput;
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import { Component } from 'react';
|
|
27
|
+
import { testable } from '@instructure/ui-testable';
|
|
27
28
|
import { omitProps, withDeterministicId } from '@instructure/ui-react-utils';
|
|
28
29
|
import { isActiveElement } from '@instructure/ui-dom-utils';
|
|
29
30
|
import { withStyle } from '@instructure/emotion';
|
|
30
31
|
import generateStyle from './styles';
|
|
31
32
|
import generateComponentTheme from './theme';
|
|
32
|
-
import { allowedProps } from './props';
|
|
33
|
+
import { allowedProps, propTypes } from './props';
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
---
|
|
@@ -37,7 +38,7 @@ category: components
|
|
|
37
38
|
---
|
|
38
39
|
**/
|
|
39
40
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
40
|
-
let RadioInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = (_RadioInput = class RadioInput extends Component {
|
|
41
|
+
let RadioInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_RadioInput = class RadioInput extends Component {
|
|
41
42
|
constructor(props) {
|
|
42
43
|
super(props);
|
|
43
44
|
this.ref = null;
|
|
@@ -111,7 +112,6 @@ let RadioInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
111
112
|
const props = omitProps(this.props, RadioInput.allowedProps);
|
|
112
113
|
return _jsx("div", {
|
|
113
114
|
css: styles === null || styles === void 0 ? void 0 : styles.radioInput,
|
|
114
|
-
"data-cid": "RadioInput",
|
|
115
115
|
ref: el => {
|
|
116
116
|
this.ref = el;
|
|
117
117
|
},
|
|
@@ -143,13 +143,13 @@ let RadioInput = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
143
143
|
})
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
}, _RadioInput.displayName = "RadioInput", _RadioInput.componentId = 'RadioInput', _RadioInput.allowedProps = allowedProps, _RadioInput.defaultProps = {
|
|
146
|
+
}, _RadioInput.displayName = "RadioInput", _RadioInput.componentId = 'RadioInput', _RadioInput.allowedProps = allowedProps, _RadioInput.propTypes = propTypes, _RadioInput.defaultProps = {
|
|
147
147
|
variant: 'simple',
|
|
148
148
|
size: 'medium',
|
|
149
149
|
disabled: false,
|
|
150
150
|
inline: false,
|
|
151
151
|
context: 'success',
|
|
152
152
|
readOnly: false
|
|
153
|
-
}, _RadioInput)) || _class) || _class);
|
|
153
|
+
}, _RadioInput)) || _class) || _class) || _class);
|
|
154
154
|
export default RadioInput;
|
|
155
155
|
export { RadioInput };
|
package/es/RadioInput/props.js
CHANGED
|
@@ -22,5 +22,22 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
label: PropTypes.node.isRequired,
|
|
28
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
29
|
+
id: PropTypes.string,
|
|
30
|
+
name: PropTypes.string,
|
|
31
|
+
checked: PropTypes.bool,
|
|
32
|
+
disabled: PropTypes.bool,
|
|
33
|
+
readOnly: PropTypes.bool,
|
|
34
|
+
variant: PropTypes.oneOf(['simple', 'toggle']),
|
|
35
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
36
|
+
context: PropTypes.oneOf(['success', 'warning', 'danger', 'off']),
|
|
37
|
+
inline: PropTypes.bool,
|
|
38
|
+
onClick: PropTypes.func,
|
|
39
|
+
onChange: PropTypes.func,
|
|
40
|
+
inputRef: PropTypes.func
|
|
41
|
+
};
|
|
25
42
|
const allowedProps = ['label', 'value', 'id', 'name', 'checked', 'disabled', 'readOnly', 'variant', 'size', 'context', 'inline', 'onClick', 'onChange', 'inputRef'];
|
|
26
|
-
export { allowedProps };
|
|
43
|
+
export { propTypes, allowedProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class, _RadioInputGroup;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _RadioInputGroup;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -25,20 +25,21 @@ var _dec, _dec2, _class, _RadioInputGroup;
|
|
|
25
25
|
|
|
26
26
|
import { Fragment, Children, Component } from 'react';
|
|
27
27
|
import { FormFieldGroup } from '@instructure/ui-form-field';
|
|
28
|
+
import { testable } from '@instructure/ui-testable';
|
|
28
29
|
import { matchComponentTypes, safeCloneElement, omitProps, pickProps, withDeterministicId } from '@instructure/ui-react-utils';
|
|
29
30
|
import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
30
31
|
import { RadioInput } from '../RadioInput';
|
|
31
32
|
import { withStyle } from '@instructure/emotion';
|
|
32
33
|
import generateStyle from './styles';
|
|
33
34
|
import generateComponentTheme from './theme';
|
|
34
|
-
import { allowedProps } from './props';
|
|
35
|
+
import { allowedProps, propTypes } from './props';
|
|
35
36
|
import { jsxs as _jsxs, jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
36
37
|
/**
|
|
37
38
|
---
|
|
38
39
|
category: components
|
|
39
40
|
---
|
|
40
41
|
**/
|
|
41
|
-
let RadioInputGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = (_RadioInputGroup = class RadioInputGroup extends Component {
|
|
42
|
+
let RadioInputGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_RadioInputGroup = class RadioInputGroup extends Component {
|
|
42
43
|
constructor(props) {
|
|
43
44
|
super(props);
|
|
44
45
|
this.ref = null;
|
|
@@ -142,16 +143,15 @@ let RadioInputGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateS
|
|
|
142
143
|
messagesId: this._messagesId,
|
|
143
144
|
elementRef: this.handleRef,
|
|
144
145
|
role: "radiogroup",
|
|
145
|
-
"data-cid": "RadioInputGroup",
|
|
146
146
|
children: this.renderChildren()
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
}, _RadioInputGroup.displayName = "RadioInputGroup", _RadioInputGroup.componentId = 'RadioInputGroup', _RadioInputGroup.allowedProps = allowedProps, _RadioInputGroup.defaultProps = {
|
|
149
|
+
}, _RadioInputGroup.displayName = "RadioInputGroup", _RadioInputGroup.componentId = 'RadioInputGroup', _RadioInputGroup.allowedProps = allowedProps, _RadioInputGroup.propTypes = propTypes, _RadioInputGroup.defaultProps = {
|
|
150
150
|
disabled: false,
|
|
151
151
|
variant: 'simple',
|
|
152
152
|
size: 'medium',
|
|
153
153
|
layout: 'stacked',
|
|
154
154
|
readOnly: false
|
|
155
|
-
}, _RadioInputGroup)) || _class) || _class);
|
|
155
|
+
}, _RadioInputGroup)) || _class) || _class) || _class);
|
|
156
156
|
export default RadioInputGroup;
|
|
157
157
|
export { RadioInputGroup };
|
|
@@ -22,5 +22,23 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { controllable } from '@instructure/ui-prop-types';
|
|
27
|
+
import { FormPropTypes } from '@instructure/ui-form-field';
|
|
28
|
+
const propTypes = {
|
|
29
|
+
name: PropTypes.string.isRequired,
|
|
30
|
+
description: PropTypes.node.isRequired,
|
|
31
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
32
|
+
value: controllable(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
33
|
+
onChange: PropTypes.func,
|
|
34
|
+
disabled: PropTypes.bool,
|
|
35
|
+
readOnly: PropTypes.bool,
|
|
36
|
+
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
37
|
+
children: PropTypes.node,
|
|
38
|
+
variant: PropTypes.oneOf(['simple', 'toggle']),
|
|
39
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
40
|
+
layout: PropTypes.oneOf(['stacked', 'columns', 'inline']),
|
|
41
|
+
isRequired: PropTypes.bool
|
|
42
|
+
};
|
|
25
43
|
const allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'variant', 'size', 'layout', 'isRequired'];
|
|
26
|
-
export { allowedProps };
|
|
44
|
+
export { propTypes, allowedProps };
|
package/lib/RadioInput/index.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.RadioInput = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
9
10
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
10
11
|
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
11
12
|
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
@@ -14,7 +15,7 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
14
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
15
16
|
var _props = require("./props");
|
|
16
17
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
|
-
var _dec, _dec2, _class, _RadioInput;
|
|
18
|
+
var _dec, _dec2, _dec3, _class, _RadioInput;
|
|
18
19
|
/*
|
|
19
20
|
* The MIT License (MIT)
|
|
20
21
|
*
|
|
@@ -43,7 +44,7 @@ var _dec, _dec2, _class, _RadioInput;
|
|
|
43
44
|
category: components
|
|
44
45
|
---
|
|
45
46
|
**/
|
|
46
|
-
let RadioInput = exports.RadioInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_RadioInput = class RadioInput extends _react.Component {
|
|
47
|
+
let RadioInput = exports.RadioInput = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_RadioInput = class RadioInput extends _react.Component {
|
|
47
48
|
constructor(props) {
|
|
48
49
|
super(props);
|
|
49
50
|
this.ref = null;
|
|
@@ -117,7 +118,6 @@ let RadioInput = exports.RadioInput = (_dec = (0, _withDeterministicId.withDeter
|
|
|
117
118
|
const props = (0, _omitProps.omitProps)(this.props, RadioInput.allowedProps);
|
|
118
119
|
return (0, _jsxRuntime.jsx)("div", {
|
|
119
120
|
css: styles === null || styles === void 0 ? void 0 : styles.radioInput,
|
|
120
|
-
"data-cid": "RadioInput",
|
|
121
121
|
ref: el => {
|
|
122
122
|
this.ref = el;
|
|
123
123
|
},
|
|
@@ -149,12 +149,12 @@ let RadioInput = exports.RadioInput = (_dec = (0, _withDeterministicId.withDeter
|
|
|
149
149
|
})
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
}, _RadioInput.displayName = "RadioInput", _RadioInput.componentId = 'RadioInput', _RadioInput.allowedProps = _props.allowedProps, _RadioInput.defaultProps = {
|
|
152
|
+
}, _RadioInput.displayName = "RadioInput", _RadioInput.componentId = 'RadioInput', _RadioInput.allowedProps = _props.allowedProps, _RadioInput.propTypes = _props.propTypes, _RadioInput.defaultProps = {
|
|
153
153
|
variant: 'simple',
|
|
154
154
|
size: 'medium',
|
|
155
155
|
disabled: false,
|
|
156
156
|
inline: false,
|
|
157
157
|
context: 'success',
|
|
158
158
|
readOnly: false
|
|
159
|
-
}, _RadioInput)) || _class) || _class);
|
|
159
|
+
}, _RadioInput)) || _class) || _class) || _class);
|
|
160
160
|
var _default = exports.default = RadioInput;
|
package/lib/RadioInput/props.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
9
|
/*
|
|
8
10
|
* The MIT License (MIT)
|
|
9
11
|
*
|
|
@@ -28,4 +30,20 @@ exports.allowedProps = void 0;
|
|
|
28
30
|
* SOFTWARE.
|
|
29
31
|
*/
|
|
30
32
|
|
|
33
|
+
const propTypes = exports.propTypes = {
|
|
34
|
+
label: _propTypes.default.node.isRequired,
|
|
35
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
36
|
+
id: _propTypes.default.string,
|
|
37
|
+
name: _propTypes.default.string,
|
|
38
|
+
checked: _propTypes.default.bool,
|
|
39
|
+
disabled: _propTypes.default.bool,
|
|
40
|
+
readOnly: _propTypes.default.bool,
|
|
41
|
+
variant: _propTypes.default.oneOf(['simple', 'toggle']),
|
|
42
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
43
|
+
context: _propTypes.default.oneOf(['success', 'warning', 'danger', 'off']),
|
|
44
|
+
inline: _propTypes.default.bool,
|
|
45
|
+
onClick: _propTypes.default.func,
|
|
46
|
+
onChange: _propTypes.default.func,
|
|
47
|
+
inputRef: _propTypes.default.func
|
|
48
|
+
};
|
|
31
49
|
const allowedProps = exports.allowedProps = ['label', 'value', 'id', 'name', 'checked', 'disabled', 'readOnly', 'variant', 'size', 'context', 'inline', 'onClick', 'onChange', 'inputRef'];
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.RadioInputGroup = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _FormFieldGroup = require("@instructure/ui-form-field/lib/FormFieldGroup");
|
|
10
|
+
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
10
11
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
11
12
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
12
13
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
@@ -19,7 +20,7 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
19
20
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
20
21
|
var _props = require("./props");
|
|
21
22
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
22
|
-
var _dec, _dec2, _class, _RadioInputGroup;
|
|
23
|
+
var _dec, _dec2, _dec3, _class, _RadioInputGroup;
|
|
23
24
|
/*
|
|
24
25
|
* The MIT License (MIT)
|
|
25
26
|
*
|
|
@@ -48,7 +49,7 @@ var _dec, _dec2, _class, _RadioInputGroup;
|
|
|
48
49
|
category: components
|
|
49
50
|
---
|
|
50
51
|
**/
|
|
51
|
-
let RadioInputGroup = exports.RadioInputGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_RadioInputGroup = class RadioInputGroup extends _react.Component {
|
|
52
|
+
let RadioInputGroup = exports.RadioInputGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_RadioInputGroup = class RadioInputGroup extends _react.Component {
|
|
52
53
|
constructor(props) {
|
|
53
54
|
super(props);
|
|
54
55
|
this.ref = null;
|
|
@@ -152,15 +153,14 @@ let RadioInputGroup = exports.RadioInputGroup = (_dec = (0, _withDeterministicId
|
|
|
152
153
|
messagesId: this._messagesId,
|
|
153
154
|
elementRef: this.handleRef,
|
|
154
155
|
role: "radiogroup",
|
|
155
|
-
"data-cid": "RadioInputGroup",
|
|
156
156
|
children: this.renderChildren()
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
}, _RadioInputGroup.displayName = "RadioInputGroup", _RadioInputGroup.componentId = 'RadioInputGroup', _RadioInputGroup.allowedProps = _props.allowedProps, _RadioInputGroup.defaultProps = {
|
|
159
|
+
}, _RadioInputGroup.displayName = "RadioInputGroup", _RadioInputGroup.componentId = 'RadioInputGroup', _RadioInputGroup.allowedProps = _props.allowedProps, _RadioInputGroup.propTypes = _props.propTypes, _RadioInputGroup.defaultProps = {
|
|
160
160
|
disabled: false,
|
|
161
161
|
variant: 'simple',
|
|
162
162
|
size: 'medium',
|
|
163
163
|
layout: 'stacked',
|
|
164
164
|
readOnly: false
|
|
165
|
-
}, _RadioInputGroup)) || _class) || _class);
|
|
165
|
+
}, _RadioInputGroup)) || _class) || _class) || _class);
|
|
166
166
|
var _default = exports.default = RadioInputGroup;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
10
|
+
var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
|
|
7
11
|
/*
|
|
8
12
|
* The MIT License (MIT)
|
|
9
13
|
*
|
|
@@ -28,4 +32,19 @@ exports.allowedProps = void 0;
|
|
|
28
32
|
* SOFTWARE.
|
|
29
33
|
*/
|
|
30
34
|
|
|
35
|
+
const propTypes = exports.propTypes = {
|
|
36
|
+
name: _propTypes.default.string.isRequired,
|
|
37
|
+
description: _propTypes.default.node.isRequired,
|
|
38
|
+
defaultValue: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
39
|
+
value: (0, _controllable.controllable)(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])),
|
|
40
|
+
onChange: _propTypes.default.func,
|
|
41
|
+
disabled: _propTypes.default.bool,
|
|
42
|
+
readOnly: _propTypes.default.bool,
|
|
43
|
+
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
|
|
44
|
+
children: _propTypes.default.node,
|
|
45
|
+
variant: _propTypes.default.oneOf(['simple', 'toggle']),
|
|
46
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
47
|
+
layout: _propTypes.default.oneOf(['stacked', 'columns', 'inline']),
|
|
48
|
+
isRequired: _propTypes.default.bool
|
|
49
|
+
};
|
|
31
50
|
const allowedProps = exports.allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'variant', 'size', 'layout', 'isRequired'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-radio-input",
|
|
3
|
-
"version": "10.26.1
|
|
3
|
+
"version": "10.26.1",
|
|
4
4
|
"description": "A styled HTML input type='radio' element",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,24 +24,27 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.27.6",
|
|
27
|
-
"@instructure/emotion": "10.26.1
|
|
28
|
-
"@instructure/shared-types": "10.26.1
|
|
29
|
-
"@instructure/ui-dom-utils": "10.26.1
|
|
30
|
-
"@instructure/ui-form-field": "10.26.1
|
|
31
|
-
"@instructure/ui-
|
|
27
|
+
"@instructure/emotion": "10.26.1",
|
|
28
|
+
"@instructure/shared-types": "10.26.1",
|
|
29
|
+
"@instructure/ui-dom-utils": "10.26.1",
|
|
30
|
+
"@instructure/ui-form-field": "10.26.1",
|
|
31
|
+
"@instructure/ui-prop-types": "10.26.1",
|
|
32
|
+
"@instructure/ui-react-utils": "10.26.1",
|
|
33
|
+
"@instructure/ui-testable": "10.26.1",
|
|
34
|
+
"prop-types": "^15.8.1"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
|
-
"@instructure/ui-axe-check": "10.26.1
|
|
35
|
-
"@instructure/ui-babel-preset": "10.26.1
|
|
36
|
-
"@instructure/ui-color-utils": "10.26.1
|
|
37
|
-
"@instructure/ui-themes": "10.26.1
|
|
37
|
+
"@instructure/ui-axe-check": "10.26.1",
|
|
38
|
+
"@instructure/ui-babel-preset": "10.26.1",
|
|
39
|
+
"@instructure/ui-color-utils": "10.26.1",
|
|
40
|
+
"@instructure/ui-themes": "10.26.1",
|
|
38
41
|
"@testing-library/jest-dom": "^6.6.3",
|
|
39
|
-
"@testing-library/react": "
|
|
42
|
+
"@testing-library/react": "^16.0.1",
|
|
40
43
|
"@testing-library/user-event": "^14.6.1",
|
|
41
44
|
"vitest": "^3.2.2"
|
|
42
45
|
},
|
|
43
46
|
"peerDependencies": {
|
|
44
|
-
"react": ">=
|
|
47
|
+
"react": ">=16.14 <=18"
|
|
45
48
|
},
|
|
46
49
|
"publishConfig": {
|
|
47
50
|
"access": "public"
|
package/src/RadioInput/index.tsx
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
|
+
import { testable } from '@instructure/ui-testable'
|
|
27
28
|
import { omitProps, withDeterministicId } from '@instructure/ui-react-utils'
|
|
28
29
|
import { isActiveElement } from '@instructure/ui-dom-utils'
|
|
29
30
|
|
|
@@ -33,7 +34,7 @@ import generateStyle from './styles'
|
|
|
33
34
|
import generateComponentTheme from './theme'
|
|
34
35
|
|
|
35
36
|
import type { RadioInputProps, RadioInputState } from './props'
|
|
36
|
-
import { allowedProps } from './props'
|
|
37
|
+
import { allowedProps, propTypes } from './props'
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
---
|
|
@@ -42,10 +43,12 @@ category: components
|
|
|
42
43
|
**/
|
|
43
44
|
@withDeterministicId()
|
|
44
45
|
@withStyle(generateStyle, generateComponentTheme)
|
|
46
|
+
@testable()
|
|
45
47
|
class RadioInput extends Component<RadioInputProps, RadioInputState> {
|
|
46
48
|
static readonly componentId = 'RadioInput'
|
|
47
49
|
|
|
48
50
|
static allowedProps = allowedProps
|
|
51
|
+
static propTypes = propTypes
|
|
49
52
|
|
|
50
53
|
static defaultProps = {
|
|
51
54
|
variant: 'simple',
|
|
@@ -140,7 +143,6 @@ class RadioInput extends Component<RadioInputProps, RadioInputState> {
|
|
|
140
143
|
return (
|
|
141
144
|
<div
|
|
142
145
|
css={styles?.radioInput}
|
|
143
|
-
data-cid="RadioInput"
|
|
144
146
|
ref={(el) => {
|
|
145
147
|
this.ref = el
|
|
146
148
|
}}
|
package/src/RadioInput/props.ts
CHANGED
|
@@ -23,9 +23,12 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
26
28
|
import type { InputHTMLAttributes } from 'react'
|
|
27
29
|
import type {
|
|
28
30
|
OtherHTMLAttributes,
|
|
31
|
+
PropValidators,
|
|
29
32
|
RadioInputTheme
|
|
30
33
|
} from '@instructure/shared-types'
|
|
31
34
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
@@ -94,6 +97,24 @@ type RadioInputStyle = ComponentStyle<
|
|
|
94
97
|
type RadioInputState = {
|
|
95
98
|
checked?: boolean
|
|
96
99
|
}
|
|
100
|
+
|
|
101
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
102
|
+
label: PropTypes.node.isRequired,
|
|
103
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
104
|
+
id: PropTypes.string,
|
|
105
|
+
name: PropTypes.string,
|
|
106
|
+
checked: PropTypes.bool,
|
|
107
|
+
disabled: PropTypes.bool,
|
|
108
|
+
readOnly: PropTypes.bool,
|
|
109
|
+
variant: PropTypes.oneOf(['simple', 'toggle']),
|
|
110
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
111
|
+
context: PropTypes.oneOf(['success', 'warning', 'danger', 'off']),
|
|
112
|
+
inline: PropTypes.bool,
|
|
113
|
+
onClick: PropTypes.func,
|
|
114
|
+
onChange: PropTypes.func,
|
|
115
|
+
inputRef: PropTypes.func
|
|
116
|
+
}
|
|
117
|
+
|
|
97
118
|
const allowedProps: AllowedPropKeys = [
|
|
98
119
|
'label',
|
|
99
120
|
'value',
|
|
@@ -112,4 +133,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
112
133
|
]
|
|
113
134
|
|
|
114
135
|
export type { RadioInputProps, RadioInputState, RadioInputStyle }
|
|
115
|
-
export { allowedProps }
|
|
136
|
+
export { propTypes, allowedProps }
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
import { ComponentElement, Fragment, Children, Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { FormFieldGroup } from '@instructure/ui-form-field'
|
|
28
|
+
import { testable } from '@instructure/ui-testable'
|
|
28
29
|
import {
|
|
29
30
|
matchComponentTypes,
|
|
30
31
|
safeCloneElement,
|
|
@@ -43,7 +44,7 @@ import generateStyle from './styles'
|
|
|
43
44
|
import generateComponentTheme from './theme'
|
|
44
45
|
|
|
45
46
|
import type { RadioInputGroupProps, RadioInputGroupState } from './props'
|
|
46
|
-
import { allowedProps } from './props'
|
|
47
|
+
import { allowedProps, propTypes } from './props'
|
|
47
48
|
|
|
48
49
|
type RadioInputChild = ComponentElement<RadioInputProps, RadioInput>
|
|
49
50
|
|
|
@@ -54,6 +55,7 @@ category: components
|
|
|
54
55
|
**/
|
|
55
56
|
@withDeterministicId()
|
|
56
57
|
@withStyle(generateStyle, generateComponentTheme)
|
|
58
|
+
@testable()
|
|
57
59
|
class RadioInputGroup extends Component<
|
|
58
60
|
RadioInputGroupProps,
|
|
59
61
|
RadioInputGroupState
|
|
@@ -61,6 +63,7 @@ class RadioInputGroup extends Component<
|
|
|
61
63
|
static readonly componentId = 'RadioInputGroup'
|
|
62
64
|
|
|
63
65
|
static allowedProps = allowedProps
|
|
66
|
+
static propTypes = propTypes
|
|
64
67
|
|
|
65
68
|
static defaultProps = {
|
|
66
69
|
disabled: false,
|
|
@@ -189,7 +192,6 @@ class RadioInputGroup extends Component<
|
|
|
189
192
|
messagesId={this._messagesId}
|
|
190
193
|
elementRef={this.handleRef}
|
|
191
194
|
role="radiogroup"
|
|
192
|
-
data-cid="RadioInputGroup"
|
|
193
195
|
>
|
|
194
196
|
{this.renderChildren()}
|
|
195
197
|
</FormFieldGroup>
|
|
@@ -23,11 +23,16 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import { controllable } from '@instructure/ui-prop-types'
|
|
29
|
+
import { FormPropTypes } from '@instructure/ui-form-field'
|
|
26
30
|
|
|
27
31
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
28
32
|
import type { FormMessage } from '@instructure/ui-form-field'
|
|
29
33
|
import type {
|
|
30
34
|
OtherHTMLAttributes,
|
|
35
|
+
PropValidators,
|
|
31
36
|
RadioInputGroupTheme
|
|
32
37
|
} from '@instructure/shared-types'
|
|
33
38
|
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
@@ -108,6 +113,25 @@ type RadioInputGroupState = {
|
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
type RadioInputGroupStyle = ComponentStyle<'invalidAsterisk'>
|
|
116
|
+
|
|
117
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
118
|
+
name: PropTypes.string.isRequired,
|
|
119
|
+
description: PropTypes.node.isRequired,
|
|
120
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
121
|
+
value: controllable(
|
|
122
|
+
PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
123
|
+
),
|
|
124
|
+
onChange: PropTypes.func,
|
|
125
|
+
disabled: PropTypes.bool,
|
|
126
|
+
readOnly: PropTypes.bool,
|
|
127
|
+
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
128
|
+
children: PropTypes.node,
|
|
129
|
+
variant: PropTypes.oneOf(['simple', 'toggle']),
|
|
130
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
131
|
+
layout: PropTypes.oneOf(['stacked', 'columns', 'inline']),
|
|
132
|
+
isRequired: PropTypes.bool
|
|
133
|
+
}
|
|
134
|
+
|
|
111
135
|
const allowedProps: AllowedPropKeys = [
|
|
112
136
|
'name',
|
|
113
137
|
'description',
|
|
@@ -125,4 +149,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
125
149
|
]
|
|
126
150
|
|
|
127
151
|
export type { RadioInputGroupProps, RadioInputGroupState, RadioInputGroupStyle }
|
|
128
|
-
export { allowedProps }
|
|
152
|
+
export { propTypes, allowedProps }
|
package/tsconfig.build.json
CHANGED
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
{ "path": "../shared-types/tsconfig.build.json" },
|
|
12
12
|
{ "path": "../ui-dom-utils/tsconfig.build.json" },
|
|
13
13
|
{ "path": "../ui-form-field/tsconfig.build.json" },
|
|
14
|
+
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
14
15
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
16
|
+
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
15
17
|
{ "path": "../ui-babel-preset/tsconfig.build.json" },
|
|
16
18
|
{ "path": "../ui-color-utils/tsconfig.build.json" },
|
|
17
19
|
{ "path": "../ui-themes/tsconfig.build.json" },
|