@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
|
@@ -5,89 +5,66 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import cx from 'classnames';
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
11
10
|
import React__default from 'react';
|
|
12
|
-
import
|
|
13
|
-
import uniqueId from '../../tools/uniqueId.js';
|
|
11
|
+
import cx from 'classnames';
|
|
14
12
|
import '../Text/index.js';
|
|
15
|
-
import {
|
|
13
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import { useId } from '../../internal/useId.js';
|
|
16
15
|
import { Text } from '../Text/Text.js';
|
|
17
16
|
|
|
18
|
-
var _excluded = ["className", "
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_this.props.onChange(_this.props.value, _this.props.name, evt);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return _this;
|
|
17
|
+
var _excluded = ["className", "disabled", "hideLabel", "id", "labelPosition", "labelText", "name", "onChange", "value"];
|
|
18
|
+
var RadioButton = /*#__PURE__*/React__default.forwardRef(function RadioButton(_ref, ref) {
|
|
19
|
+
var className = _ref.className,
|
|
20
|
+
disabled = _ref.disabled,
|
|
21
|
+
hideLabel = _ref.hideLabel,
|
|
22
|
+
id = _ref.id,
|
|
23
|
+
_ref$labelPosition = _ref.labelPosition,
|
|
24
|
+
labelPosition = _ref$labelPosition === void 0 ? 'right' : _ref$labelPosition,
|
|
25
|
+
_ref$labelText = _ref.labelText,
|
|
26
|
+
labelText = _ref$labelText === void 0 ? '' : _ref$labelText,
|
|
27
|
+
name = _ref.name,
|
|
28
|
+
_ref$onChange = _ref.onChange,
|
|
29
|
+
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
30
|
+
_ref$value = _ref.value,
|
|
31
|
+
value = _ref$value === void 0 ? '' : _ref$value,
|
|
32
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
|
|
34
|
+
var prefix = usePrefix();
|
|
35
|
+
var uid = useId('radio-button');
|
|
36
|
+
var uniqueId = id || uid;
|
|
37
|
+
|
|
38
|
+
function handleOnChange(event) {
|
|
39
|
+
onChange(value, name, event);
|
|
45
40
|
}
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
onChange: this.handleChange,
|
|
72
|
-
id: this.uid,
|
|
73
|
-
ref: ref
|
|
74
|
-
})), /*#__PURE__*/React__default.createElement("label", {
|
|
75
|
-
htmlFor: this.uid,
|
|
76
|
-
className: "".concat(prefix, "--radio-button__label")
|
|
77
|
-
}, /*#__PURE__*/React__default.createElement("span", {
|
|
78
|
-
className: "".concat(prefix, "--radio-button__appearance")
|
|
79
|
-
}), labelText && /*#__PURE__*/React__default.createElement(Text, {
|
|
80
|
-
className: innerLabelClasses
|
|
81
|
-
}, labelText)));
|
|
82
|
-
}
|
|
83
|
-
}]);
|
|
84
|
-
|
|
85
|
-
return RadioButton;
|
|
86
|
-
}(React__default.Component);
|
|
87
|
-
|
|
88
|
-
_defineProperty(RadioButton, "propTypes", {
|
|
42
|
+
var innerLabelClasses = cx(_defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
|
|
43
|
+
var wrapperClasses = cx(className, "".concat(prefix, "--radio-button-wrapper"), _defineProperty({}, "".concat(prefix, "--radio-button-wrapper--label-").concat(labelPosition), labelPosition !== 'right'));
|
|
44
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
45
|
+
className: wrapperClasses
|
|
46
|
+
}, /*#__PURE__*/React__default.createElement("input", _extends({}, rest, {
|
|
47
|
+
type: "radio",
|
|
48
|
+
className: "".concat(prefix, "--radio-button"),
|
|
49
|
+
onChange: handleOnChange,
|
|
50
|
+
id: uniqueId,
|
|
51
|
+
ref: ref,
|
|
52
|
+
disabled: disabled,
|
|
53
|
+
value: value,
|
|
54
|
+
name: name
|
|
55
|
+
})), /*#__PURE__*/React__default.createElement("label", {
|
|
56
|
+
htmlFor: uniqueId,
|
|
57
|
+
className: "".concat(prefix, "--radio-button__label")
|
|
58
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
59
|
+
className: "".concat(prefix, "--radio-button__appearance")
|
|
60
|
+
}), labelText && /*#__PURE__*/React__default.createElement(Text, {
|
|
61
|
+
className: innerLabelClasses
|
|
62
|
+
}, labelText)));
|
|
63
|
+
});
|
|
64
|
+
RadioButton.displayName = 'RadioButton';
|
|
65
|
+
RadioButton.propTypes = {
|
|
89
66
|
/**
|
|
90
|
-
* Specify whether the
|
|
67
|
+
* Specify whether the `<RadioButton>` is currently checked
|
|
91
68
|
*/
|
|
92
69
|
checked: PropTypes.bool,
|
|
93
70
|
|
|
@@ -97,7 +74,7 @@ _defineProperty(RadioButton, "propTypes", {
|
|
|
97
74
|
className: PropTypes.string,
|
|
98
75
|
|
|
99
76
|
/**
|
|
100
|
-
* Specify whether the
|
|
77
|
+
* Specify whether the `<RadioButton>` should be checked by default
|
|
101
78
|
*/
|
|
102
79
|
defaultChecked: PropTypes.bool,
|
|
103
80
|
|
|
@@ -120,7 +97,7 @@ _defineProperty(RadioButton, "propTypes", {
|
|
|
120
97
|
* Provide where label text should be placed
|
|
121
98
|
* NOTE: `top`/`bottom` are deprecated
|
|
122
99
|
*/
|
|
123
|
-
labelPosition: PropTypes.oneOf(['
|
|
100
|
+
labelPosition: PropTypes.oneOf(['right', 'left']),
|
|
124
101
|
|
|
125
102
|
/**
|
|
126
103
|
* Provide label text to be read by screen readers when interacting with the
|
|
@@ -145,28 +122,10 @@ _defineProperty(RadioButton, "propTypes", {
|
|
|
145
122
|
onClick: PropTypes.func,
|
|
146
123
|
|
|
147
124
|
/**
|
|
148
|
-
* Specify the value of the
|
|
125
|
+
* Specify the value of the `<RadioButton>`
|
|
149
126
|
*/
|
|
150
127
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
151
|
-
}
|
|
128
|
+
};
|
|
129
|
+
var RadioButton$1 = RadioButton;
|
|
152
130
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
_defineProperty(RadioButton, "defaultProps", {
|
|
156
|
-
labelText: '',
|
|
157
|
-
labelPosition: 'right',
|
|
158
|
-
onChange: function onChange() {},
|
|
159
|
-
value: ''
|
|
160
|
-
});
|
|
161
|
-
var RadioButtonClassic = (function () {
|
|
162
|
-
var forwardRef = function forwardRef(props, ref) {
|
|
163
|
-
return /*#__PURE__*/React__default.createElement(RadioButton, _extends({}, props, {
|
|
164
|
-
innerRef: ref
|
|
165
|
-
}));
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
forwardRef.displayName = 'RadioButton';
|
|
169
|
-
return /*#__PURE__*/React__default.forwardRef(forwardRef);
|
|
170
|
-
})();
|
|
171
|
-
|
|
172
|
-
export { RadioButton, RadioButtonClassic as default };
|
|
131
|
+
export { RadioButton$1 as default };
|
|
@@ -5,11 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import RadioButtonClassic from './RadioButton.js';
|
|
11
|
-
|
|
12
|
-
var RadioButton = FeatureFlags.enabled('enable-v11-release') ? RadioButtonNext : RadioButtonClassic;
|
|
13
|
-
var RadioButton$1 = RadioButton;
|
|
14
|
-
|
|
15
|
-
export { RadioButton$1 as default };
|
|
8
|
+
import RadioButton from './RadioButton.js';
|
|
9
|
+
export { default } from './RadioButton.js';
|
|
@@ -5,121 +5,87 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { slicedToArray as _slicedToArray, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default from 'react';
|
|
10
|
+
import React__default, { useState } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
-
import { warning } from '../../internal/warning.js';
|
|
13
12
|
import { Legend } from '../Text/index.js';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
|
|
15
|
+
var RadioButtonGroup = /*#__PURE__*/React__default.forwardRef(function RadioButtonGroup(_ref, ref) {
|
|
16
|
+
var _classNames;
|
|
17
|
+
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
className = _ref.className,
|
|
20
|
+
defaultSelected = _ref.defaultSelected,
|
|
21
|
+
disabled = _ref.disabled,
|
|
22
|
+
_ref$labelPosition = _ref.labelPosition,
|
|
23
|
+
labelPosition = _ref$labelPosition === void 0 ? 'right' : _ref$labelPosition,
|
|
24
|
+
legendText = _ref.legendText,
|
|
25
|
+
name = _ref.name,
|
|
26
|
+
_ref$onChange = _ref.onChange,
|
|
27
|
+
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
28
|
+
_ref$orientation = _ref.orientation,
|
|
29
|
+
orientation = _ref$orientation === void 0 ? 'horizontal' : _ref$orientation,
|
|
30
|
+
valueSelected = _ref.valueSelected;
|
|
31
|
+
var prefix = usePrefix();
|
|
32
|
+
|
|
33
|
+
var _useState = useState(valueSelected !== null && valueSelected !== void 0 ? valueSelected : defaultSelected),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
selected = _useState2[0],
|
|
36
|
+
setSelected = _useState2[1];
|
|
37
|
+
|
|
38
|
+
var _useState3 = useState(valueSelected),
|
|
39
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
+
prevValueSelected = _useState4[0],
|
|
41
|
+
setPrevValueSelected = _useState4[1];
|
|
42
|
+
/**
|
|
43
|
+
* prop + state alignment - getDerivedStateFromProps
|
|
44
|
+
* only update if selected prop changes
|
|
45
|
+
*/
|
|
30
46
|
|
|
31
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
47
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
if (valueSelected !== prevValueSelected) {
|
|
49
|
+
setSelected(valueSelected);
|
|
50
|
+
setPrevValueSelected(valueSelected);
|
|
51
|
+
}
|
|
36
52
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return /*#__PURE__*/React__default.cloneElement(radioButton, {
|
|
47
|
-
name: _this.props.name,
|
|
48
|
-
key: value,
|
|
49
|
-
value: value,
|
|
50
|
-
onChange: _this.handleChange,
|
|
51
|
-
checked: value === _this.state.selected
|
|
52
|
-
});
|
|
53
|
+
function getRadioButtons() {
|
|
54
|
+
var mappedChildren = React__default.Children.map(children, function (radioButton) {
|
|
55
|
+
var value = radioButton.props.value;
|
|
56
|
+
return /*#__PURE__*/React__default.cloneElement(radioButton, {
|
|
57
|
+
name: name,
|
|
58
|
+
key: value,
|
|
59
|
+
value: value,
|
|
60
|
+
onChange: handleOnChange,
|
|
61
|
+
checked: value === selected
|
|
53
62
|
});
|
|
54
|
-
return children;
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
_defineProperty(_assertThisInitialized(_this), "handleChange", function (newSelection, value, evt) {
|
|
58
|
-
if (newSelection !== _this.state.selected) {
|
|
59
|
-
_this.setState({
|
|
60
|
-
selected: newSelection
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
_this.props.onChange(newSelection, _this.props.name, evt);
|
|
64
|
-
}
|
|
65
63
|
});
|
|
66
|
-
|
|
67
|
-
return _this;
|
|
64
|
+
return mappedChildren;
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var _this$props = this.props,
|
|
76
|
-
disabled = _this$props.disabled,
|
|
77
|
-
className = _this$props.className,
|
|
78
|
-
hideLegend = _this$props.hideLegend,
|
|
79
|
-
orientation = _this$props.orientation,
|
|
80
|
-
labelPosition = _this$props.labelPosition,
|
|
81
|
-
legendText = _this$props.legendText;
|
|
82
|
-
var scope = this.context;
|
|
83
|
-
var enabled;
|
|
84
|
-
|
|
85
|
-
if (scope.enabled) {
|
|
86
|
-
enabled = scope.enabled('enable-v11-release');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, function (prefix) {
|
|
90
|
-
var _classNames;
|
|
91
|
-
|
|
92
|
-
var wrapperClasses = cx("".concat(prefix, "--radio-button-group"), [enabled ? null : className], (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--").concat(orientation), orientation === 'vertical'), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--label-").concat(labelPosition), labelPosition), _classNames));
|
|
93
|
-
var legendClasses = cx("".concat(prefix, "--label"), _defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLegend));
|
|
94
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
95
|
-
className: enabled ? cx("".concat(prefix, "--form-item"), className) : "".concat(prefix, "--form-item")
|
|
96
|
-
}, /*#__PURE__*/React__default.createElement("fieldset", {
|
|
97
|
-
className: wrapperClasses,
|
|
98
|
-
disabled: disabled
|
|
99
|
-
}, legendText && /*#__PURE__*/React__default.createElement(Legend, {
|
|
100
|
-
className: legendClasses
|
|
101
|
-
}, legendText), _this2.getRadioButtons()));
|
|
102
|
-
});
|
|
67
|
+
function handleOnChange(newSelection, value, evt) {
|
|
68
|
+
if (newSelection !== selected) {
|
|
69
|
+
setSelected(newSelection);
|
|
70
|
+
onChange(newSelection, name, evt);
|
|
103
71
|
}
|
|
104
|
-
}
|
|
105
|
-
key: "getDerivedStateFromProps",
|
|
106
|
-
value: function getDerivedStateFromProps(_ref, state) {
|
|
107
|
-
var valueSelected = _ref.valueSelected,
|
|
108
|
-
defaultSelected = _ref.defaultSelected;
|
|
109
|
-
var prevValueSelected = state.prevValueSelected;
|
|
110
|
-
return prevValueSelected === valueSelected ? null : {
|
|
111
|
-
selected: typeof valueSelected !== 'undefined' ? valueSelected : defaultSelected,
|
|
112
|
-
prevValueSelected: valueSelected
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
}]);
|
|
116
|
-
|
|
117
|
-
return RadioButtonGroup;
|
|
118
|
-
}(React__default.Component);
|
|
72
|
+
}
|
|
119
73
|
|
|
120
|
-
_defineProperty(
|
|
74
|
+
var fieldsetClasses = cx("".concat(prefix, "--radio-button-group"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--").concat(orientation), orientation === 'vertical'), _defineProperty(_classNames, "".concat(prefix, "--radio-button-group--label-").concat(labelPosition), labelPosition), _classNames));
|
|
75
|
+
var wrapperClasses = cx("".concat(prefix, "--form-item"), className);
|
|
76
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
77
|
+
className: wrapperClasses,
|
|
78
|
+
ref: ref
|
|
79
|
+
}, /*#__PURE__*/React__default.createElement("fieldset", {
|
|
80
|
+
className: fieldsetClasses,
|
|
81
|
+
disabled: disabled
|
|
82
|
+
}, legendText && /*#__PURE__*/React__default.createElement(Legend, {
|
|
83
|
+
className: "".concat(prefix, "--label")
|
|
84
|
+
}, legendText), getRadioButtons()));
|
|
85
|
+
});
|
|
86
|
+
RadioButtonGroup.propTypes = {
|
|
121
87
|
/**
|
|
122
|
-
* Provide a collection of
|
|
88
|
+
* Provide a collection of `<RadioButton>` components to render in the group
|
|
123
89
|
*/
|
|
124
90
|
children: PropTypes.node,
|
|
125
91
|
|
|
@@ -129,7 +95,7 @@ _defineProperty(RadioButtonGroup, "propTypes", {
|
|
|
129
95
|
className: PropTypes.string,
|
|
130
96
|
|
|
131
97
|
/**
|
|
132
|
-
* Specify the
|
|
98
|
+
* Specify the `<RadioButton>` to be selected by default
|
|
133
99
|
*/
|
|
134
100
|
defaultSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
135
101
|
|
|
@@ -138,11 +104,6 @@ _defineProperty(RadioButtonGroup, "propTypes", {
|
|
|
138
104
|
*/
|
|
139
105
|
disabled: PropTypes.bool,
|
|
140
106
|
|
|
141
|
-
/**
|
|
142
|
-
* Specify whether the legend should be hidden, or not
|
|
143
|
-
*/
|
|
144
|
-
hideLegend: PropTypes.bool,
|
|
145
|
-
|
|
146
107
|
/**
|
|
147
108
|
* Provide where label text should be placed
|
|
148
109
|
*/
|
|
@@ -174,17 +135,7 @@ _defineProperty(RadioButtonGroup, "propTypes", {
|
|
|
174
135
|
* Specify the value that is currently selected in the group
|
|
175
136
|
*/
|
|
176
137
|
valueSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
_defineProperty(RadioButtonGroup, "defaultProps", {
|
|
180
|
-
orientation: 'horizontal',
|
|
181
|
-
labelPosition: 'right',
|
|
182
|
-
hideLegend: false,
|
|
183
|
-
onChange:
|
|
184
|
-
/* istanbul ignore next */
|
|
185
|
-
function onChange() {}
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
_defineProperty(RadioButtonGroup, "contextType", FeatureFlagContext);
|
|
138
|
+
};
|
|
139
|
+
var RadioButtonGroup$1 = RadioButtonGroup;
|
|
189
140
|
|
|
190
|
-
export { RadioButtonGroup as default };
|
|
141
|
+
export { RadioButtonGroup$1 as default };
|
|
@@ -5,11 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import RadioButtonGroup$2 from './RadioButtonGroup.js';
|
|
11
|
-
|
|
12
|
-
var RadioButtonGroup = FeatureFlags.enabled('enable-v11-release') ? RadioButtonGroupNext : RadioButtonGroup$2;
|
|
13
|
-
var RadioButtonGroup$1 = RadioButtonGroup;
|
|
14
|
-
|
|
15
|
-
export { RadioButtonGroup$1 as default };
|
|
8
|
+
import RadioButtonGroup from './RadioButtonGroup.js';
|
|
9
|
+
export { default } from './RadioButtonGroup.js';
|
|
@@ -457,7 +457,8 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
457
457
|
"aria-valuemax": max,
|
|
458
458
|
"aria-valuemin": min,
|
|
459
459
|
"aria-valuenow": value,
|
|
460
|
-
style: thumbStyle
|
|
460
|
+
style: thumbStyle,
|
|
461
|
+
"aria-labelledby": labelId
|
|
461
462
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
462
463
|
className: "".concat(prefix, "--slider__track"),
|
|
463
464
|
ref: function ref(node) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, slicedToArray as _slicedToArray, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
@@ -69,12 +69,15 @@ function TreeView(_ref) {
|
|
|
69
69
|
return selectedId !== nodeId;
|
|
70
70
|
}));
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, node);
|
|
72
74
|
} else {
|
|
73
75
|
setSelected([nodeId]);
|
|
74
76
|
setActive(nodeId);
|
|
77
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, _objectSpread2({
|
|
78
|
+
activeNodeId: nodeId
|
|
79
|
+
}, node));
|
|
75
80
|
}
|
|
76
|
-
|
|
77
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, node);
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
function handleFocusEvent(event) {
|
|
@@ -213,15 +216,20 @@ function TreeView(_ref) {
|
|
|
213
216
|
}
|
|
214
217
|
});
|
|
215
218
|
}, [prefix]);
|
|
216
|
-
useEffect(function () {
|
|
217
|
-
if (preselected.length) {
|
|
218
|
-
setSelected(preselected);
|
|
219
|
-
}
|
|
220
219
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
var useActiveAndSelectedOnMount = function useActiveAndSelectedOnMount() {
|
|
221
|
+
return useEffect(function () {
|
|
222
|
+
if (preselected.length) {
|
|
223
|
+
setSelected(preselected);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (prespecifiedActive) {
|
|
227
|
+
setActive(prespecifiedActive);
|
|
228
|
+
}
|
|
229
|
+
}, []);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
useActiveAndSelectedOnMount();
|
|
225
233
|
var labelId = "".concat(treeId, "__label");
|
|
226
234
|
|
|
227
235
|
var TreeLabel = function TreeLabel() {
|
|
@@ -237,4 +237,4 @@ var HeaderMenuForwardRef = /*#__PURE__*/React__default.forwardRef(function (prop
|
|
|
237
237
|
HeaderMenuForwardRef.displayName = 'HeaderMenu';
|
|
238
238
|
var HeaderMenuForwardRef$1 = HeaderMenuForwardRef;
|
|
239
239
|
|
|
240
|
-
export { HeaderMenuForwardRef$1 as default };
|
|
240
|
+
export { HeaderMenu, HeaderMenuForwardRef$1 as default };
|
|
@@ -15,15 +15,16 @@ import SideNavItem from './SideNavItem.js';
|
|
|
15
15
|
import SideNavLinkText from './SideNavLinkText.js';
|
|
16
16
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
17
17
|
|
|
18
|
-
var _excluded = ["
|
|
18
|
+
var _excluded = ["children", "className", "renderIcon", "isActive", "large"];
|
|
19
19
|
var SideNavLink = /*#__PURE__*/React__default.forwardRef(function SideNavLink(_ref, ref) {
|
|
20
20
|
var _cx;
|
|
21
21
|
|
|
22
|
-
var
|
|
23
|
-
|
|
22
|
+
var children = _ref.children,
|
|
23
|
+
customClassName = _ref.className,
|
|
24
24
|
IconElement = _ref.renderIcon,
|
|
25
25
|
isActive = _ref.isActive,
|
|
26
|
-
large = _ref.large,
|
|
26
|
+
_ref$large = _ref.large,
|
|
27
|
+
large = _ref$large === void 0 ? false : _ref$large,
|
|
27
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
29
|
|
|
29
30
|
var prefix = usePrefix();
|
|
@@ -58,11 +59,7 @@ SideNavLink.propTypes = _objectSpread2(_objectSpread2({}, LinkPropTypes), {}, {
|
|
|
58
59
|
* Provide an icon to render in the side navigation link. Should be a React class.
|
|
59
60
|
*/
|
|
60
61
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
61
|
-
});
|
|
62
|
-
SideNavLink.defaultProps = {
|
|
63
|
-
element: 'a',
|
|
64
|
-
large: false
|
|
65
|
-
}; // eslint-disable-next-line react/display-name
|
|
62
|
+
}); // eslint-disable-next-line react/display-name
|
|
66
63
|
var SideNavLink$1 = SideNavLink;
|
|
67
64
|
|
|
68
65
|
export { SideNavLink$1 as default };
|