@carbon/react 1.7.0-rc.0 → 1.8.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/InlineLoading/InlineLoading.js +9 -5
- package/es/components/Loading/Loading.js +7 -18
- 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/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/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 +8 -7
- 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/InlineLoading/InlineLoading.js +9 -5
- package/lib/components/Loading/Loading.js +6 -17
- 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/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/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 +91 -91
- package/lib/internal/createClassWrapper.js +2 -5
- package/package.json +8 -8
- package/es/components/Modal/next/Modal.js +0 -274
- 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/Modal/next/Modal.js +0 -284
- 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,140 +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
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
|
-
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
-
var PropTypes = require('prop-types');
|
|
14
|
-
var React = require('react');
|
|
15
|
-
var cx = require('classnames');
|
|
16
|
-
var usePrefix = require('../../../internal/usePrefix.js');
|
|
17
|
-
var useId = require('../../../internal/useId.js');
|
|
18
|
-
require('../../Text/index.js');
|
|
19
|
-
var Text = require('../../Text/Text.js');
|
|
20
|
-
|
|
21
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
|
-
|
|
23
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
24
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
25
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
26
|
-
|
|
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);
|
|
50
|
-
}
|
|
51
|
-
|
|
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.propTypes = {
|
|
75
|
-
/**
|
|
76
|
-
* Specify whether the `<RadioButton>` is currently checked
|
|
77
|
-
*/
|
|
78
|
-
checked: PropTypes__default["default"].bool,
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Provide an optional className to be applied to the containing node
|
|
82
|
-
*/
|
|
83
|
-
className: PropTypes__default["default"].string,
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Specify whether the `<RadioButton>` should be checked by default
|
|
87
|
-
*/
|
|
88
|
-
defaultChecked: PropTypes__default["default"].bool,
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Specify whether the control is disabled
|
|
92
|
-
*/
|
|
93
|
-
disabled: PropTypes__default["default"].bool,
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Specify whether the label should be hidden, or not
|
|
97
|
-
*/
|
|
98
|
-
hideLabel: PropTypes__default["default"].bool,
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Provide a unique id for the underlying `<input>` node
|
|
102
|
-
*/
|
|
103
|
-
id: PropTypes__default["default"].string,
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Provide where label text should be placed
|
|
107
|
-
* NOTE: `top`/`bottom` are deprecated
|
|
108
|
-
*/
|
|
109
|
-
labelPosition: PropTypes__default["default"].oneOf(['right', 'left']),
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Provide label text to be read by screen readers when interacting with the
|
|
113
|
-
* control
|
|
114
|
-
*/
|
|
115
|
-
labelText: PropTypes__default["default"].node.isRequired,
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Provide a name for the underlying `<input>` node
|
|
119
|
-
*/
|
|
120
|
-
name: PropTypes__default["default"].string,
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Provide an optional `onChange` hook that is called each time the value of
|
|
124
|
-
* the underlying `<input>` changes
|
|
125
|
-
*/
|
|
126
|
-
onChange: PropTypes__default["default"].func,
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Provide a handler that is invoked when a user clicks on the control
|
|
130
|
-
*/
|
|
131
|
-
onClick: PropTypes__default["default"].func,
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Specify the value of the `<RadioButton>`
|
|
135
|
-
*/
|
|
136
|
-
value: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]).isRequired
|
|
137
|
-
};
|
|
138
|
-
var RadioButtonNext = RadioButton;
|
|
139
|
-
|
|
140
|
-
exports["default"] = RadioButtonNext;
|
|
@@ -1,151 +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
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
|
-
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
|
-
var PropTypes = require('prop-types');
|
|
14
|
-
var React = require('react');
|
|
15
|
-
var cx = require('classnames');
|
|
16
|
-
var index = require('../../Text/index.js');
|
|
17
|
-
var usePrefix = require('../../../internal/usePrefix.js');
|
|
18
|
-
|
|
19
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
-
|
|
21
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
|
-
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
|
-
|
|
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
|
-
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (valueSelected !== prevValueSelected) {
|
|
59
|
-
setSelected(valueSelected);
|
|
60
|
-
setPrevValueSelected(valueSelected);
|
|
61
|
-
}
|
|
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
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
return mappedChildren;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function handleOnChange(newSelection, value, evt) {
|
|
78
|
-
if (newSelection !== selected) {
|
|
79
|
-
setSelected(newSelection);
|
|
80
|
-
onChange(newSelection, name, evt);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
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 = {
|
|
97
|
-
/**
|
|
98
|
-
* Provide a collection of `<RadioButton>` components to render in the group
|
|
99
|
-
*/
|
|
100
|
-
children: PropTypes__default["default"].node,
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Provide an optional className to be applied to the container node
|
|
104
|
-
*/
|
|
105
|
-
className: PropTypes__default["default"].string,
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Specify the `<RadioButton>` to be selected by default
|
|
109
|
-
*/
|
|
110
|
-
defaultSelected: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Specify whether the group is disabled
|
|
114
|
-
*/
|
|
115
|
-
disabled: PropTypes__default["default"].bool,
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Provide where label text should be placed
|
|
119
|
-
*/
|
|
120
|
-
labelPosition: PropTypes__default["default"].oneOf(['left', 'right']),
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Provide a legend to the RadioButtonGroup input that you are
|
|
124
|
-
* exposing to the user
|
|
125
|
-
*/
|
|
126
|
-
legendText: PropTypes__default["default"].node,
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Specify the name of the underlying `<input>` nodes
|
|
130
|
-
*/
|
|
131
|
-
name: PropTypes__default["default"].string.isRequired,
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Provide an optional `onChange` hook that is called whenever the value of
|
|
135
|
-
* the group changes
|
|
136
|
-
*/
|
|
137
|
-
onChange: PropTypes__default["default"].func,
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Provide where radio buttons should be placed
|
|
141
|
-
*/
|
|
142
|
-
orientation: PropTypes__default["default"].oneOf(['horizontal', 'vertical']),
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Specify the value that is currently selected in the group
|
|
146
|
-
*/
|
|
147
|
-
valueSelected: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number])
|
|
148
|
-
};
|
|
149
|
-
var RadioButtonGroupNext = RadioButtonGroup;
|
|
150
|
-
|
|
151
|
-
exports["default"] = RadioButtonGroupNext;
|