@carbon/react 1.7.0 → 1.9.0-rc.0
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/es/components/ComposedModal/ComposedModal.js +1 -1
- package/es/components/ComposedModal/index.js +4 -4
- package/es/components/ComposedModal/next/ComposedModal.js +1 -1
- package/es/components/DataTable/DataTable.js +1 -1
- package/es/components/DataTable/Table.js +10 -2
- package/es/components/DataTable/TableContainer.js +20 -5
- package/es/components/DataTable/TableContext.js +15 -0
- package/es/components/DataTable/TableSelectRow.js +1 -1
- package/es/components/FileUploader/FileUploader.js +8 -1
- package/es/components/FileUploader/FileUploaderButton.js +3 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +3 -1
- package/es/components/FileUploader/FileUploaderItem.js +3 -1
- package/es/components/InlineLoading/InlineLoading.js +9 -5
- package/es/components/Loading/Loading.js +7 -18
- package/es/components/Menu/Menu.js +1 -1
- package/es/components/Modal/Modal.js +204 -273
- package/es/components/Modal/index.js +2 -8
- package/es/components/ModalWrapper/ModalWrapper.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +345 -386
- package/es/components/MultiSelect/index.js +4 -8
- package/es/components/Notification/Notification.js +322 -189
- package/es/components/NumberInput/NumberInput.Skeleton.js +3 -4
- package/es/components/NumberInput/NumberInput.js +308 -359
- package/es/components/RadioButton/RadioButton.js +58 -99
- package/es/components/RadioButton/index.js +2 -8
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +72 -121
- package/es/components/RadioButtonGroup/index.js +2 -8
- package/es/components/Slider/Slider.js +2 -1
- package/es/components/Switch/Switch.js +0 -1
- package/es/components/TreeView/TreeView.js +19 -11
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/HeaderMenuButton.js +4 -0
- package/es/components/UIShell/SideNavLink.js +6 -9
- package/es/index.js +10 -9
- package/es/internal/createClassWrapper.js +2 -5
- package/lib/components/ComposedModal/index.js +7 -7
- package/lib/components/ComposedModal/next/ComposedModal.js +1 -1
- package/lib/components/DataTable/DataTable.js +5 -5
- package/lib/components/DataTable/Table.js +9 -1
- package/lib/components/DataTable/TableContainer.js +19 -4
- package/lib/components/DataTable/TableContext.js +19 -0
- package/lib/components/DataTable/TableSelectRow.js +2 -2
- package/lib/components/FileUploader/FileUploader.js +8 -1
- package/lib/components/FileUploader/FileUploaderButton.js +3 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +3 -1
- package/lib/components/FileUploader/FileUploaderItem.js +3 -1
- package/lib/components/InlineLoading/InlineLoading.js +9 -5
- package/lib/components/Loading/Loading.js +6 -17
- package/lib/components/Menu/Menu.js +1 -1
- package/lib/components/Modal/Modal.js +201 -270
- package/lib/components/Modal/index.js +2 -25
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +341 -382
- package/lib/components/MultiSelect/index.js +5 -28
- package/lib/components/Notification/Notification.js +321 -188
- package/lib/components/NumberInput/NumberInput.Skeleton.js +3 -4
- package/lib/components/NumberInput/NumberInput.js +305 -376
- package/lib/components/RadioButton/RadioButton.js +57 -99
- package/lib/components/RadioButton/index.js +2 -25
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +68 -117
- package/lib/components/RadioButtonGroup/index.js +2 -25
- package/lib/components/Slider/Slider.js +2 -1
- package/lib/components/Switch/Switch.js +0 -1
- package/lib/components/TreeView/TreeView.js +18 -10
- package/lib/components/UIShell/HeaderMenu.js +1 -0
- package/lib/components/UIShell/HeaderMenuButton.js +4 -0
- package/lib/components/UIShell/SideNavLink.js +6 -9
- package/lib/index.js +95 -95
- package/lib/internal/createClassWrapper.js +2 -5
- package/package.json +7 -7
- package/scss/utilities/_hide-at-breakpoint.scss +9 -0
- package/es/components/Modal/next/Modal.js +0 -274
- package/es/components/MultiSelect/next/FilterableMultiSelect.js +0 -544
- package/es/components/Notification/index.js +0 -42
- package/es/components/Notification/next/Notification.js +0 -663
- package/es/components/RadioButton/next/RadioButton.js +0 -130
- package/es/components/RadioButtonGroup/next/RadioButtonGroup.js +0 -141
- package/es/internal/FeatureFlags.js +0 -52
- package/es/prop-types/requiredIfValueExists.js +0 -32
- package/lib/components/Modal/next/Modal.js +0 -284
- package/lib/components/MultiSelect/next/FilterableMultiSelect.js +0 -556
- package/lib/components/Notification/index.js +0 -51
- package/lib/components/Notification/next/Notification.js +0 -677
- package/lib/components/RadioButton/next/RadioButton.js +0 -140
- package/lib/components/RadioButtonGroup/next/RadioButtonGroup.js +0 -151
- package/lib/internal/FeatureFlags.js +0 -56
- package/lib/prop-types/requiredIfValueExists.js +0 -36
|
@@ -10,94 +10,71 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
-
var cx = require('classnames');
|
|
14
13
|
var PropTypes = require('prop-types');
|
|
15
14
|
var React = require('react');
|
|
16
|
-
var
|
|
17
|
-
var uniqueId = require('../../tools/uniqueId.js');
|
|
15
|
+
var cx = require('classnames');
|
|
18
16
|
require('../Text/index.js');
|
|
19
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
|
+
var useId = require('../../internal/useId.js');
|
|
20
19
|
var Text = require('../Text/Text.js');
|
|
21
20
|
|
|
22
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
22
|
|
|
24
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
25
23
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
26
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
27
26
|
|
|
28
|
-
var _excluded = ["className", "
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_this.props.onChange(_this.props.value, _this.props.name, evt);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return _this;
|
|
27
|
+
var _excluded = ["className", "disabled", "hideLabel", "id", "labelPosition", "labelText", "name", "onChange", "value"];
|
|
28
|
+
var RadioButton = /*#__PURE__*/React__default["default"].forwardRef(function RadioButton(_ref, ref) {
|
|
29
|
+
var className = _ref.className,
|
|
30
|
+
disabled = _ref.disabled,
|
|
31
|
+
hideLabel = _ref.hideLabel,
|
|
32
|
+
id = _ref.id,
|
|
33
|
+
_ref$labelPosition = _ref.labelPosition,
|
|
34
|
+
labelPosition = _ref$labelPosition === void 0 ? 'right' : _ref$labelPosition,
|
|
35
|
+
_ref$labelText = _ref.labelText,
|
|
36
|
+
labelText = _ref$labelText === void 0 ? '' : _ref$labelText,
|
|
37
|
+
name = _ref.name,
|
|
38
|
+
_ref$onChange = _ref.onChange,
|
|
39
|
+
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
40
|
+
_ref$value = _ref.value,
|
|
41
|
+
value = _ref$value === void 0 ? '' : _ref$value,
|
|
42
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
|
|
44
|
+
var prefix = usePrefix.usePrefix();
|
|
45
|
+
var uid = useId.useId('radio-button');
|
|
46
|
+
var uniqueId = id || uid;
|
|
47
|
+
|
|
48
|
+
function handleOnChange(event) {
|
|
49
|
+
onChange(value, name, event);
|
|
55
50
|
}
|
|
56
51
|
|
|
57
|
-
_rollupPluginBabelHelpers.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
onChange: this.handleChange,
|
|
82
|
-
id: this.uid,
|
|
83
|
-
ref: ref
|
|
84
|
-
})), /*#__PURE__*/React__default["default"].createElement("label", {
|
|
85
|
-
htmlFor: this.uid,
|
|
86
|
-
className: "".concat(prefix, "--radio-button__label")
|
|
87
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
88
|
-
className: "".concat(prefix, "--radio-button__appearance")
|
|
89
|
-
}), labelText && /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
90
|
-
className: innerLabelClasses
|
|
91
|
-
}, labelText)));
|
|
92
|
-
}
|
|
93
|
-
}]);
|
|
94
|
-
|
|
95
|
-
return RadioButton;
|
|
96
|
-
}(React__default["default"].Component);
|
|
97
|
-
|
|
98
|
-
_rollupPluginBabelHelpers.defineProperty(RadioButton, "propTypes", {
|
|
52
|
+
var innerLabelClasses = cx__default["default"](_rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
|
|
53
|
+
var wrapperClasses = cx__default["default"](className, "".concat(prefix, "--radio-button-wrapper"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--radio-button-wrapper--label-").concat(labelPosition), labelPosition !== 'right'));
|
|
54
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
55
|
+
className: wrapperClasses
|
|
56
|
+
}, /*#__PURE__*/React__default["default"].createElement("input", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
57
|
+
type: "radio",
|
|
58
|
+
className: "".concat(prefix, "--radio-button"),
|
|
59
|
+
onChange: handleOnChange,
|
|
60
|
+
id: uniqueId,
|
|
61
|
+
ref: ref,
|
|
62
|
+
disabled: disabled,
|
|
63
|
+
value: value,
|
|
64
|
+
name: name
|
|
65
|
+
})), /*#__PURE__*/React__default["default"].createElement("label", {
|
|
66
|
+
htmlFor: uniqueId,
|
|
67
|
+
className: "".concat(prefix, "--radio-button__label")
|
|
68
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
69
|
+
className: "".concat(prefix, "--radio-button__appearance")
|
|
70
|
+
}), labelText && /*#__PURE__*/React__default["default"].createElement(Text.Text, {
|
|
71
|
+
className: innerLabelClasses
|
|
72
|
+
}, labelText)));
|
|
73
|
+
});
|
|
74
|
+
RadioButton.displayName = 'RadioButton';
|
|
75
|
+
RadioButton.propTypes = {
|
|
99
76
|
/**
|
|
100
|
-
* Specify whether the
|
|
77
|
+
* Specify whether the `<RadioButton>` is currently checked
|
|
101
78
|
*/
|
|
102
79
|
checked: PropTypes__default["default"].bool,
|
|
103
80
|
|
|
@@ -107,7 +84,7 @@ _rollupPluginBabelHelpers.defineProperty(RadioButton, "propTypes", {
|
|
|
107
84
|
className: PropTypes__default["default"].string,
|
|
108
85
|
|
|
109
86
|
/**
|
|
110
|
-
* Specify whether the
|
|
87
|
+
* Specify whether the `<RadioButton>` should be checked by default
|
|
111
88
|
*/
|
|
112
89
|
defaultChecked: PropTypes__default["default"].bool,
|
|
113
90
|
|
|
@@ -130,7 +107,7 @@ _rollupPluginBabelHelpers.defineProperty(RadioButton, "propTypes", {
|
|
|
130
107
|
* Provide where label text should be placed
|
|
131
108
|
* NOTE: `top`/`bottom` are deprecated
|
|
132
109
|
*/
|
|
133
|
-
labelPosition: PropTypes__default["default"].oneOf(['
|
|
110
|
+
labelPosition: PropTypes__default["default"].oneOf(['right', 'left']),
|
|
134
111
|
|
|
135
112
|
/**
|
|
136
113
|
* Provide label text to be read by screen readers when interacting with the
|
|
@@ -155,29 +132,10 @@ _rollupPluginBabelHelpers.defineProperty(RadioButton, "propTypes", {
|
|
|
155
132
|
onClick: PropTypes__default["default"].func,
|
|
156
133
|
|
|
157
134
|
/**
|
|
158
|
-
* Specify the value of the
|
|
135
|
+
* Specify the value of the `<RadioButton>`
|
|
159
136
|
*/
|
|
160
137
|
value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])
|
|
161
|
-
}
|
|
138
|
+
};
|
|
139
|
+
var RadioButton$1 = RadioButton;
|
|
162
140
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
_rollupPluginBabelHelpers.defineProperty(RadioButton, "defaultProps", {
|
|
166
|
-
labelText: '',
|
|
167
|
-
labelPosition: 'right',
|
|
168
|
-
onChange: function onChange() {},
|
|
169
|
-
value: ''
|
|
170
|
-
});
|
|
171
|
-
var RadioButtonClassic = (function () {
|
|
172
|
-
var forwardRef = function forwardRef(props, ref) {
|
|
173
|
-
return /*#__PURE__*/React__default["default"].createElement(RadioButton, _rollupPluginBabelHelpers["extends"]({}, props, {
|
|
174
|
-
innerRef: ref
|
|
175
|
-
}));
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
forwardRef.displayName = 'RadioButton';
|
|
179
|
-
return /*#__PURE__*/React__default["default"].forwardRef(forwardRef);
|
|
180
|
-
})();
|
|
181
|
-
|
|
182
|
-
exports.RadioButton = RadioButton;
|
|
183
|
-
exports["default"] = RadioButtonClassic;
|
|
141
|
+
exports["default"] = RadioButton$1;
|
|
@@ -9,31 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
var RadioButton$2 = require('./next/RadioButton.js');
|
|
14
|
-
var RadioButton$3 = require('./RadioButton.js');
|
|
12
|
+
var RadioButton = require('./RadioButton.js');
|
|
15
13
|
|
|
16
|
-
function _interopNamespace(e) {
|
|
17
|
-
if (e && e.__esModule) return e;
|
|
18
|
-
var n = Object.create(null);
|
|
19
|
-
if (e) {
|
|
20
|
-
Object.keys(e).forEach(function (k) {
|
|
21
|
-
if (k !== 'default') {
|
|
22
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
23
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () { return e[k]; }
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
n["default"] = e;
|
|
31
|
-
return Object.freeze(n);
|
|
32
|
-
}
|
|
33
14
|
|
|
34
|
-
var FeatureFlags__namespace = /*#__PURE__*/_interopNamespace(FeatureFlags);
|
|
35
15
|
|
|
36
|
-
|
|
37
|
-
var RadioButton$1 = RadioButton;
|
|
38
|
-
|
|
39
|
-
exports["default"] = RadioButton$1;
|
|
16
|
+
exports["default"] = RadioButton["default"];
|
|
@@ -13,9 +13,7 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
|
-
var warning = require('../../internal/warning.js');
|
|
17
16
|
var index = require('../Text/index.js');
|
|
18
|
-
var index$1 = require('../FeatureFlags/index.js');
|
|
19
17
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
18
|
|
|
21
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -24,112 +22,80 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
24
22
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
26
24
|
|
|
27
|
-
var RadioButtonGroup = /*#__PURE__*/function (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
var RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef(function RadioButtonGroup(_ref, ref) {
|
|
26
|
+
var _classNames;
|
|
27
|
+
|
|
28
|
+
var children = _ref.children,
|
|
29
|
+
className = _ref.className,
|
|
30
|
+
defaultSelected = _ref.defaultSelected,
|
|
31
|
+
disabled = _ref.disabled,
|
|
32
|
+
_ref$labelPosition = _ref.labelPosition,
|
|
33
|
+
labelPosition = _ref$labelPosition === void 0 ? 'right' : _ref$labelPosition,
|
|
34
|
+
legendText = _ref.legendText,
|
|
35
|
+
name = _ref.name,
|
|
36
|
+
_ref$onChange = _ref.onChange,
|
|
37
|
+
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
38
|
+
_ref$orientation = _ref.orientation,
|
|
39
|
+
orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation,
|
|
40
|
+
valueSelected = _ref.valueSelected;
|
|
41
|
+
var prefix = usePrefix.usePrefix();
|
|
42
|
+
|
|
43
|
+
var _useState = React.useState(valueSelected !== null && valueSelected !== void 0 ? valueSelected : defaultSelected),
|
|
44
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
45
|
+
selected = _useState2[0],
|
|
46
|
+
setSelected = _useState2[1];
|
|
47
|
+
|
|
48
|
+
var _useState3 = React.useState(valueSelected),
|
|
49
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
50
|
+
prevValueSelected = _useState4[0],
|
|
51
|
+
setPrevValueSelected = _useState4[1];
|
|
52
|
+
/**
|
|
53
|
+
* prop + state alignment - getDerivedStateFromProps
|
|
54
|
+
* only update if selected prop changes
|
|
55
|
+
*/
|
|
40
56
|
|
|
41
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
42
57
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
if (valueSelected !== prevValueSelected) {
|
|
59
|
+
setSelected(valueSelected);
|
|
60
|
+
setPrevValueSelected(valueSelected);
|
|
61
|
+
}
|
|
46
62
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return /*#__PURE__*/React__default["default"].cloneElement(radioButton, {
|
|
57
|
-
name: _this.props.name,
|
|
58
|
-
key: value,
|
|
59
|
-
value: value,
|
|
60
|
-
onChange: _this.handleChange,
|
|
61
|
-
checked: value === _this.state.selected
|
|
62
|
-
});
|
|
63
|
+
function getRadioButtons() {
|
|
64
|
+
var mappedChildren = React__default["default"].Children.map(children, function (radioButton) {
|
|
65
|
+
var value = radioButton.props.value;
|
|
66
|
+
return /*#__PURE__*/React__default["default"].cloneElement(radioButton, {
|
|
67
|
+
name: name,
|
|
68
|
+
key: value,
|
|
69
|
+
value: value,
|
|
70
|
+
onChange: handleOnChange,
|
|
71
|
+
checked: value === selected
|
|
63
72
|
});
|
|
64
|
-
return children;
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.assertThisInitialized(_this), "handleChange", function (newSelection, value, evt) {
|
|
68
|
-
if (newSelection !== _this.state.selected) {
|
|
69
|
-
_this.setState({
|
|
70
|
-
selected: newSelection
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
_this.props.onChange(newSelection, _this.props.name, evt);
|
|
74
|
-
}
|
|
75
73
|
});
|
|
76
|
-
|
|
77
|
-
return _this;
|
|
74
|
+
return mappedChildren;
|
|
78
75
|
}
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var _this$props = this.props,
|
|
86
|
-
disabled = _this$props.disabled,
|
|
87
|
-
className = _this$props.className,
|
|
88
|
-
hideLegend = _this$props.hideLegend,
|
|
89
|
-
orientation = _this$props.orientation,
|
|
90
|
-
labelPosition = _this$props.labelPosition,
|
|
91
|
-
legendText = _this$props.legendText;
|
|
92
|
-
var scope = this.context;
|
|
93
|
-
var enabled;
|
|
94
|
-
|
|
95
|
-
if (scope.enabled) {
|
|
96
|
-
enabled = scope.enabled('enable-v11-release');
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return /*#__PURE__*/React__default["default"].createElement(usePrefix.PrefixContext.Consumer, null, function (prefix) {
|
|
100
|
-
var _classNames;
|
|
101
|
-
|
|
102
|
-
var wrapperClasses = cx__default["default"]("".concat(prefix, "--radio-button-group"), [enabled ? null : className], (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--").concat(orientation), orientation === 'vertical'), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--label-").concat(labelPosition), labelPosition), _classNames));
|
|
103
|
-
var legendClasses = cx__default["default"]("".concat(prefix, "--label"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLegend));
|
|
104
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
105
|
-
className: enabled ? cx__default["default"]("".concat(prefix, "--form-item"), className) : "".concat(prefix, "--form-item")
|
|
106
|
-
}, /*#__PURE__*/React__default["default"].createElement("fieldset", {
|
|
107
|
-
className: wrapperClasses,
|
|
108
|
-
disabled: disabled
|
|
109
|
-
}, legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
|
|
110
|
-
className: legendClasses
|
|
111
|
-
}, legendText), _this2.getRadioButtons()));
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}], [{
|
|
115
|
-
key: "getDerivedStateFromProps",
|
|
116
|
-
value: function getDerivedStateFromProps(_ref, state) {
|
|
117
|
-
var valueSelected = _ref.valueSelected,
|
|
118
|
-
defaultSelected = _ref.defaultSelected;
|
|
119
|
-
var prevValueSelected = state.prevValueSelected;
|
|
120
|
-
return prevValueSelected === valueSelected ? null : {
|
|
121
|
-
selected: typeof valueSelected !== 'undefined' ? valueSelected : defaultSelected,
|
|
122
|
-
prevValueSelected: valueSelected
|
|
123
|
-
};
|
|
77
|
+
function handleOnChange(newSelection, value, evt) {
|
|
78
|
+
if (newSelection !== selected) {
|
|
79
|
+
setSelected(newSelection);
|
|
80
|
+
onChange(newSelection, name, evt);
|
|
124
81
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return RadioButtonGroup;
|
|
128
|
-
}(React__default["default"].Component);
|
|
82
|
+
}
|
|
129
83
|
|
|
130
|
-
_rollupPluginBabelHelpers.defineProperty(
|
|
84
|
+
var fieldsetClasses = cx__default["default"]("".concat(prefix, "--radio-button-group"), (_classNames = {}, _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--").concat(orientation), orientation === 'vertical'), _rollupPluginBabelHelpers.defineProperty(_classNames, "".concat(prefix, "--radio-button-group--label-").concat(labelPosition), labelPosition), _classNames));
|
|
85
|
+
var wrapperClasses = cx__default["default"]("".concat(prefix, "--form-item"), className);
|
|
86
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
87
|
+
className: wrapperClasses,
|
|
88
|
+
ref: ref
|
|
89
|
+
}, /*#__PURE__*/React__default["default"].createElement("fieldset", {
|
|
90
|
+
className: fieldsetClasses,
|
|
91
|
+
disabled: disabled
|
|
92
|
+
}, legendText && /*#__PURE__*/React__default["default"].createElement(index.Legend, {
|
|
93
|
+
className: "".concat(prefix, "--label")
|
|
94
|
+
}, legendText), getRadioButtons()));
|
|
95
|
+
});
|
|
96
|
+
RadioButtonGroup.propTypes = {
|
|
131
97
|
/**
|
|
132
|
-
* Provide a collection of
|
|
98
|
+
* Provide a collection of `<RadioButton>` components to render in the group
|
|
133
99
|
*/
|
|
134
100
|
children: PropTypes__default["default"].node,
|
|
135
101
|
|
|
@@ -139,7 +105,7 @@ _rollupPluginBabelHelpers.defineProperty(RadioButtonGroup, "propTypes", {
|
|
|
139
105
|
className: PropTypes__default["default"].string,
|
|
140
106
|
|
|
141
107
|
/**
|
|
142
|
-
* Specify the
|
|
108
|
+
* Specify the `<RadioButton>` to be selected by default
|
|
143
109
|
*/
|
|
144
110
|
defaultSelected: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
145
111
|
|
|
@@ -148,11 +114,6 @@ _rollupPluginBabelHelpers.defineProperty(RadioButtonGroup, "propTypes", {
|
|
|
148
114
|
*/
|
|
149
115
|
disabled: PropTypes__default["default"].bool,
|
|
150
116
|
|
|
151
|
-
/**
|
|
152
|
-
* Specify whether the legend should be hidden, or not
|
|
153
|
-
*/
|
|
154
|
-
hideLegend: PropTypes__default["default"].bool,
|
|
155
|
-
|
|
156
117
|
/**
|
|
157
118
|
* Provide where label text should be placed
|
|
158
119
|
*/
|
|
@@ -184,17 +145,7 @@ _rollupPluginBabelHelpers.defineProperty(RadioButtonGroup, "propTypes", {
|
|
|
184
145
|
* Specify the value that is currently selected in the group
|
|
185
146
|
*/
|
|
186
147
|
valueSelected: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
_rollupPluginBabelHelpers.defineProperty(RadioButtonGroup, "defaultProps", {
|
|
190
|
-
orientation: 'horizontal',
|
|
191
|
-
labelPosition: 'right',
|
|
192
|
-
hideLegend: false,
|
|
193
|
-
onChange:
|
|
194
|
-
/* istanbul ignore next */
|
|
195
|
-
function onChange() {}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
_rollupPluginBabelHelpers.defineProperty(RadioButtonGroup, "contextType", index$1.FeatureFlagContext);
|
|
148
|
+
};
|
|
149
|
+
var RadioButtonGroup$1 = RadioButtonGroup;
|
|
199
150
|
|
|
200
|
-
exports["default"] = RadioButtonGroup;
|
|
151
|
+
exports["default"] = RadioButtonGroup$1;
|
|
@@ -9,31 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
var RadioButtonGroup$2 = require('./next/RadioButtonGroup.js');
|
|
14
|
-
var RadioButtonGroup$3 = require('./RadioButtonGroup.js');
|
|
12
|
+
var RadioButtonGroup = require('./RadioButtonGroup.js');
|
|
15
13
|
|
|
16
|
-
function _interopNamespace(e) {
|
|
17
|
-
if (e && e.__esModule) return e;
|
|
18
|
-
var n = Object.create(null);
|
|
19
|
-
if (e) {
|
|
20
|
-
Object.keys(e).forEach(function (k) {
|
|
21
|
-
if (k !== 'default') {
|
|
22
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
23
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () { return e[k]; }
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
n["default"] = e;
|
|
31
|
-
return Object.freeze(n);
|
|
32
|
-
}
|
|
33
14
|
|
|
34
|
-
var FeatureFlags__namespace = /*#__PURE__*/_interopNamespace(FeatureFlags);
|
|
35
15
|
|
|
36
|
-
|
|
37
|
-
var RadioButtonGroup$1 = RadioButtonGroup;
|
|
38
|
-
|
|
39
|
-
exports["default"] = RadioButtonGroup$1;
|
|
16
|
+
exports["default"] = RadioButtonGroup["default"];
|
|
@@ -487,7 +487,8 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
487
487
|
"aria-valuemax": max,
|
|
488
488
|
"aria-valuemin": min,
|
|
489
489
|
"aria-valuenow": value,
|
|
490
|
-
style: thumbStyle
|
|
490
|
+
style: thumbStyle,
|
|
491
|
+
"aria-labelledby": labelId
|
|
491
492
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
492
493
|
className: "".concat(prefix, "--slider__track"),
|
|
493
494
|
ref: function ref(node) {
|
|
@@ -98,12 +98,15 @@ function TreeView(_ref) {
|
|
|
98
98
|
return selectedId !== nodeId;
|
|
99
99
|
}));
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, node);
|
|
101
103
|
} else {
|
|
102
104
|
setSelected([nodeId]);
|
|
103
105
|
setActive(nodeId);
|
|
106
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, _rollupPluginBabelHelpers.objectSpread2({
|
|
107
|
+
activeNodeId: nodeId
|
|
108
|
+
}, node));
|
|
104
109
|
}
|
|
105
|
-
|
|
106
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, node);
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
function handleFocusEvent(event) {
|
|
@@ -242,15 +245,20 @@ function TreeView(_ref) {
|
|
|
242
245
|
}
|
|
243
246
|
});
|
|
244
247
|
}, [prefix]);
|
|
245
|
-
React.useEffect(function () {
|
|
246
|
-
if (preselected.length) {
|
|
247
|
-
setSelected(preselected);
|
|
248
|
-
}
|
|
249
248
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
var useActiveAndSelectedOnMount = function useActiveAndSelectedOnMount() {
|
|
250
|
+
return React.useEffect(function () {
|
|
251
|
+
if (preselected.length) {
|
|
252
|
+
setSelected(preselected);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (prespecifiedActive) {
|
|
256
|
+
setActive(prespecifiedActive);
|
|
257
|
+
}
|
|
258
|
+
}, []);
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
useActiveAndSelectedOnMount();
|
|
254
262
|
var labelId = "".concat(treeId, "__label");
|
|
255
263
|
|
|
256
264
|
var TreeLabel = function TreeLabel() {
|
|
@@ -247,4 +247,5 @@ var HeaderMenuForwardRef = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
|
247
247
|
HeaderMenuForwardRef.displayName = 'HeaderMenu';
|
|
248
248
|
var HeaderMenuForwardRef$1 = HeaderMenuForwardRef;
|
|
249
249
|
|
|
250
|
+
exports.HeaderMenu = HeaderMenu;
|
|
250
251
|
exports["default"] = HeaderMenuForwardRef$1;
|
|
@@ -66,6 +66,10 @@ HeaderMenuButton.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPlug
|
|
|
66
66
|
* button
|
|
67
67
|
*/
|
|
68
68
|
className: PropTypes__default["default"].string,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Specify whether the menu button is "active".
|
|
72
|
+
*/
|
|
69
73
|
isActive: PropTypes__default["default"].bool,
|
|
70
74
|
|
|
71
75
|
/**
|
|
@@ -25,15 +25,16 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
25
25
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
26
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
27
27
|
|
|
28
|
-
var _excluded = ["
|
|
28
|
+
var _excluded = ["children", "className", "renderIcon", "isActive", "large"];
|
|
29
29
|
var SideNavLink = /*#__PURE__*/React__default["default"].forwardRef(function SideNavLink(_ref, ref) {
|
|
30
30
|
var _cx;
|
|
31
31
|
|
|
32
|
-
var
|
|
33
|
-
|
|
32
|
+
var children = _ref.children,
|
|
33
|
+
customClassName = _ref.className,
|
|
34
34
|
IconElement = _ref.renderIcon,
|
|
35
35
|
isActive = _ref.isActive,
|
|
36
|
-
large = _ref.large,
|
|
36
|
+
_ref$large = _ref.large,
|
|
37
|
+
large = _ref$large === void 0 ? false : _ref$large,
|
|
37
38
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
38
39
|
|
|
39
40
|
var prefix = usePrefix.usePrefix();
|
|
@@ -68,11 +69,7 @@ SideNavLink.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBab
|
|
|
68
69
|
* Provide an icon to render in the side navigation link. Should be a React class.
|
|
69
70
|
*/
|
|
70
71
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object])
|
|
71
|
-
});
|
|
72
|
-
SideNavLink.defaultProps = {
|
|
73
|
-
element: 'a',
|
|
74
|
-
large: false
|
|
75
|
-
}; // eslint-disable-next-line react/display-name
|
|
72
|
+
}); // eslint-disable-next-line react/display-name
|
|
76
73
|
var SideNavLink$1 = SideNavLink;
|
|
77
74
|
|
|
78
75
|
exports["default"] = SideNavLink$1;
|