@carbon/react 1.6.0 → 1.8.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/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/Form/Form.js +1 -1
- package/es/components/FormGroup/FormGroup.js +4 -4
- package/es/components/FormItem/FormItem.js +5 -6
- package/es/components/InlineLoading/InlineLoading.js +9 -5
- package/es/components/Loading/Loading.js +7 -18
- 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/Popover/index.js +137 -8
- package/es/components/ProgressBar/ProgressBar.js +6 -3
- 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/Select/Select.js +14 -7
- 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/SideNavDetails.js +8 -3
- package/es/components/UIShell/SideNavLink.js +6 -9
- package/es/index.js +7 -6
- package/es/internal/createClassWrapper.js +2 -5
- package/lib/components/ComposedModal/index.js +7 -7
- 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/Form/Form.js +1 -1
- package/lib/components/FormGroup/FormGroup.js +4 -4
- package/lib/components/FormItem/FormItem.js +5 -6
- package/lib/components/InlineLoading/InlineLoading.js +9 -5
- package/lib/components/Loading/Loading.js +6 -17
- 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/Popover/index.js +135 -6
- package/lib/components/ProgressBar/ProgressBar.js +6 -3
- 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/Select/Select.js +14 -7
- 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/SideNavDetails.js +8 -3
- package/lib/components/UIShell/SideNavLink.js +6 -9
- package/lib/index.js +83 -83
- package/lib/internal/createClassWrapper.js +2 -5
- package/package.json +8 -8
- package/es/components/MultiSelect/next/FilterableMultiSelect.js +0 -542
- 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/lib/components/MultiSelect/next/FilterableMultiSelect.js +0 -554
- 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
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default from 'react';
|
|
11
|
-
import cx from 'classnames';
|
|
12
|
-
import { usePrefix } from '../../../internal/usePrefix.js';
|
|
13
|
-
import { useId } from '../../../internal/useId.js';
|
|
14
|
-
import '../../Text/index.js';
|
|
15
|
-
import { Text } from '../../Text/Text.js';
|
|
16
|
-
|
|
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);
|
|
40
|
-
}
|
|
41
|
-
|
|
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.propTypes = {
|
|
65
|
-
/**
|
|
66
|
-
* Specify whether the `<RadioButton>` is currently checked
|
|
67
|
-
*/
|
|
68
|
-
checked: PropTypes.bool,
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Provide an optional className to be applied to the containing node
|
|
72
|
-
*/
|
|
73
|
-
className: PropTypes.string,
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Specify whether the `<RadioButton>` should be checked by default
|
|
77
|
-
*/
|
|
78
|
-
defaultChecked: PropTypes.bool,
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Specify whether the control is disabled
|
|
82
|
-
*/
|
|
83
|
-
disabled: PropTypes.bool,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Specify whether the label should be hidden, or not
|
|
87
|
-
*/
|
|
88
|
-
hideLabel: PropTypes.bool,
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Provide a unique id for the underlying `<input>` node
|
|
92
|
-
*/
|
|
93
|
-
id: PropTypes.string,
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Provide where label text should be placed
|
|
97
|
-
* NOTE: `top`/`bottom` are deprecated
|
|
98
|
-
*/
|
|
99
|
-
labelPosition: PropTypes.oneOf(['right', 'left']),
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Provide label text to be read by screen readers when interacting with the
|
|
103
|
-
* control
|
|
104
|
-
*/
|
|
105
|
-
labelText: PropTypes.node.isRequired,
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Provide a name for the underlying `<input>` node
|
|
109
|
-
*/
|
|
110
|
-
name: PropTypes.string,
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Provide an optional `onChange` hook that is called each time the value of
|
|
114
|
-
* the underlying `<input>` changes
|
|
115
|
-
*/
|
|
116
|
-
onChange: PropTypes.func,
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Provide a handler that is invoked when a user clicks on the control
|
|
120
|
-
*/
|
|
121
|
-
onClick: PropTypes.func,
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Specify the value of the `<RadioButton>`
|
|
125
|
-
*/
|
|
126
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
|
|
127
|
-
};
|
|
128
|
-
var RadioButtonNext = RadioButton;
|
|
129
|
-
|
|
130
|
-
export { RadioButtonNext as default };
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2016, 2022
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { slicedToArray as _slicedToArray, defineProperty as _defineProperty } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default, { useState } from 'react';
|
|
11
|
-
import cx from 'classnames';
|
|
12
|
-
import { Legend } from '../../Text/index.js';
|
|
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
|
-
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (valueSelected !== prevValueSelected) {
|
|
49
|
-
setSelected(valueSelected);
|
|
50
|
-
setPrevValueSelected(valueSelected);
|
|
51
|
-
}
|
|
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
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
return mappedChildren;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function handleOnChange(newSelection, value, evt) {
|
|
68
|
-
if (newSelection !== selected) {
|
|
69
|
-
setSelected(newSelection);
|
|
70
|
-
onChange(newSelection, name, evt);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
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 = {
|
|
87
|
-
/**
|
|
88
|
-
* Provide a collection of `<RadioButton>` components to render in the group
|
|
89
|
-
*/
|
|
90
|
-
children: PropTypes.node,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Provide an optional className to be applied to the container node
|
|
94
|
-
*/
|
|
95
|
-
className: PropTypes.string,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Specify the `<RadioButton>` to be selected by default
|
|
99
|
-
*/
|
|
100
|
-
defaultSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Specify whether the group is disabled
|
|
104
|
-
*/
|
|
105
|
-
disabled: PropTypes.bool,
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Provide where label text should be placed
|
|
109
|
-
*/
|
|
110
|
-
labelPosition: PropTypes.oneOf(['left', 'right']),
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Provide a legend to the RadioButtonGroup input that you are
|
|
114
|
-
* exposing to the user
|
|
115
|
-
*/
|
|
116
|
-
legendText: PropTypes.node,
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Specify the name of the underlying `<input>` nodes
|
|
120
|
-
*/
|
|
121
|
-
name: PropTypes.string.isRequired,
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Provide an optional `onChange` hook that is called whenever the value of
|
|
125
|
-
* the group changes
|
|
126
|
-
*/
|
|
127
|
-
onChange: PropTypes.func,
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Provide where radio buttons should be placed
|
|
131
|
-
*/
|
|
132
|
-
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Specify the value that is currently selected in the group
|
|
136
|
-
*/
|
|
137
|
-
valueSelected: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
138
|
-
};
|
|
139
|
-
var RadioButtonGroupNext = RadioButtonGroup;
|
|
140
|
-
|
|
141
|
-
export { RadioButtonGroupNext as default };
|