@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
|
@@ -13,6 +13,8 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var cx = require('classnames');
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var React = require('react');
|
|
16
|
+
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
17
|
+
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
16
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
17
19
|
|
|
18
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -21,15 +23,22 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
|
21
23
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
25
|
|
|
24
|
-
var _excluded = ["align", "as", "caret", "className", "children", "dropShadow", "highContrast", "open"],
|
|
26
|
+
var _excluded = ["align", "as", "autoAlign", "caret", "className", "children", "dropShadow", "highContrast", "open"],
|
|
25
27
|
_excluded2 = ["className", "children"];
|
|
26
|
-
var
|
|
28
|
+
var PopoverContext = /*#__PURE__*/React__default["default"].createContext({
|
|
29
|
+
floating: {
|
|
30
|
+
current: null
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popover(props, forwardRef) {
|
|
27
34
|
var _cx;
|
|
28
35
|
|
|
29
36
|
var _props$align = props.align,
|
|
30
37
|
align = _props$align === void 0 ? 'bottom' : _props$align,
|
|
31
38
|
_props$as = props.as,
|
|
32
39
|
BaseComponent = _props$as === void 0 ? 'span' : _props$as,
|
|
40
|
+
_props$autoAlign = props.autoAlign,
|
|
41
|
+
autoAlign = _props$autoAlign === void 0 ? false : _props$autoAlign,
|
|
33
42
|
_props$caret = props.caret,
|
|
34
43
|
caret = _props$caret === void 0 ? true : _props$caret,
|
|
35
44
|
customClassName = props.className,
|
|
@@ -42,11 +51,121 @@ var Popover = /*#__PURE__*/React__default["default"].forwardRef(function Popover
|
|
|
42
51
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
|
43
52
|
|
|
44
53
|
var prefix = usePrefix.usePrefix();
|
|
45
|
-
var
|
|
46
|
-
|
|
54
|
+
var floating = React.useRef();
|
|
55
|
+
var popover = React.useRef();
|
|
56
|
+
var value = React.useMemo(function () {
|
|
57
|
+
return {
|
|
58
|
+
floating: floating
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
var ref = useMergedRefs.useMergedRefs([forwardRef, popover]);
|
|
62
|
+
|
|
63
|
+
var _useState = React.useState(false),
|
|
64
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
|
65
|
+
autoAligned = _useState2[0],
|
|
66
|
+
setAutoAligned = _useState2[1];
|
|
67
|
+
|
|
68
|
+
var _useState3 = React.useState(align),
|
|
69
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
|
70
|
+
autoAlignment = _useState4[0],
|
|
71
|
+
setAutoAlignment = _useState4[1];
|
|
72
|
+
|
|
73
|
+
var className = cx__default["default"]((_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover-container"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--caret"), caret), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--drop-shadow"), dropShadow), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--high-contrast"), highContrast), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--open"), open), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--").concat(autoAlignment), autoAligned), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--popover--").concat(align), !autoAligned), _rollupPluginBabelHelpers.defineProperty(_cx, customClassName, !!customClassName), _cx));
|
|
74
|
+
useIsomorphicEffect["default"](function () {
|
|
75
|
+
if (!autoAlign) {
|
|
76
|
+
setAutoAligned(false);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!floating.current) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (autoAligned === true) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var rect = floating.current.getBoundingClientRect(); // The conditions, per side, of when the popover is not visible, excluding the popover's internal padding(16)
|
|
89
|
+
|
|
90
|
+
var conditions = {
|
|
91
|
+
left: rect.x < -16,
|
|
92
|
+
top: rect.y < -16,
|
|
93
|
+
right: rect.x + (rect.width - 16) > document.documentElement.clientWidth,
|
|
94
|
+
bottom: rect.y + (rect.height - 16) > document.documentElement.clientHeight
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
if (!conditions.left && !conditions.top && !conditions.right && !conditions.bottom) {
|
|
98
|
+
setAutoAligned(false);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var alignments = ['top', 'top-left', 'right-bottom', 'right', 'right-top', 'bottom-left', 'bottom', 'bottom-right', 'left-top', 'left', 'left-bottom', 'top-right']; // Creates the prioritized list of options depending on ideal alignment coming from `align`
|
|
103
|
+
|
|
104
|
+
var options = [align];
|
|
105
|
+
var option = alignments[(alignments.indexOf(align) + 1) % alignments.length];
|
|
106
|
+
|
|
107
|
+
while (option) {
|
|
108
|
+
if (options.includes(option)) {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
options.push(option);
|
|
113
|
+
option = alignments[(alignments.indexOf(option) + 1) % alignments.length];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isVisible(alignment) {
|
|
117
|
+
popover.current.classList.add("".concat(prefix, "--popover--").concat(alignment));
|
|
118
|
+
var rect = floating.current.getBoundingClientRect(); // Check if popover is not visible to the left of the screen
|
|
119
|
+
|
|
120
|
+
if (rect.x < -16) {
|
|
121
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
122
|
+
return false;
|
|
123
|
+
} // Check if popover is not visible at the top of the screen
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
if (rect.y < -16) {
|
|
127
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
128
|
+
return false;
|
|
129
|
+
} // Check if popover is not visible to right of screen
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
if (rect.x + (rect.width - 16) > document.documentElement.clientWidth) {
|
|
133
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
134
|
+
return false;
|
|
135
|
+
} // Check if popover is not visible to bottom of screen
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
if (rect.y + (rect.height - 16) > document.documentElement.clientHeight) {
|
|
139
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
popover.current.classList.remove("".concat(prefix, "--popover--").concat(alignment));
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var alignment = null;
|
|
148
|
+
|
|
149
|
+
for (var i = 0; i < options.length; i++) {
|
|
150
|
+
var _option = options[i];
|
|
151
|
+
|
|
152
|
+
if (isVisible(_option)) {
|
|
153
|
+
alignment = _option;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (alignment) {
|
|
159
|
+
setAutoAligned(true);
|
|
160
|
+
setAutoAlignment(alignment);
|
|
161
|
+
}
|
|
162
|
+
}, [autoAligned, align, autoAlign, prefix]);
|
|
163
|
+
return /*#__PURE__*/React__default["default"].createElement(PopoverContext.Provider, {
|
|
164
|
+
value: value
|
|
165
|
+
}, /*#__PURE__*/React__default["default"].createElement(BaseComponent, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
47
166
|
className: className,
|
|
48
167
|
ref: ref
|
|
49
|
-
}), children);
|
|
168
|
+
}), children));
|
|
50
169
|
}); // Note: this displayName is temporarily set so that Storybook ArgTable
|
|
51
170
|
// correctly displays the name of this component
|
|
52
171
|
|
|
@@ -66,6 +185,11 @@ Popover.propTypes = {
|
|
|
66
185
|
*/
|
|
67
186
|
as: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].elementType]),
|
|
68
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to futurue changes.
|
|
190
|
+
*/
|
|
191
|
+
autoAlign: PropTypes__default["default"].bool,
|
|
192
|
+
|
|
69
193
|
/**
|
|
70
194
|
* Specify whether a caret should be rendered
|
|
71
195
|
*/
|
|
@@ -97,12 +221,17 @@ Popover.propTypes = {
|
|
|
97
221
|
*/
|
|
98
222
|
open: PropTypes__default["default"].bool.isRequired
|
|
99
223
|
};
|
|
100
|
-
var PopoverContent = /*#__PURE__*/React__default["default"].forwardRef(function PopoverContent(_ref,
|
|
224
|
+
var PopoverContent = /*#__PURE__*/React__default["default"].forwardRef(function PopoverContent(_ref, forwardRef) {
|
|
101
225
|
var className = _ref.className,
|
|
102
226
|
children = _ref.children,
|
|
103
227
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded2);
|
|
104
228
|
|
|
105
229
|
var prefix = usePrefix.usePrefix();
|
|
230
|
+
|
|
231
|
+
var _React$useContext = React__default["default"].useContext(PopoverContext),
|
|
232
|
+
floating = _React$useContext.floating;
|
|
233
|
+
|
|
234
|
+
var ref = useMergedRefs.useMergedRefs([floating, forwardRef]);
|
|
106
235
|
return /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
|
107
236
|
className: "".concat(prefix, "--popover")
|
|
108
237
|
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -94,9 +94,9 @@ function ProgressBar(_ref) {
|
|
|
94
94
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
95
95
|
className: "".concat(prefix, "--progress-bar__track"),
|
|
96
96
|
role: "progressbar",
|
|
97
|
+
"aria-busy": !isFinished,
|
|
97
98
|
"aria-invalid": isError,
|
|
98
99
|
"aria-labelledby": labelId,
|
|
99
|
-
"aria-describedby": helperText ? helperId : null,
|
|
100
100
|
"aria-valuemin": !indeterminate ? 0 : null,
|
|
101
101
|
"aria-valuemax": !indeterminate ? max : null,
|
|
102
102
|
"aria-valuenow": !indeterminate ? cappedValue : null
|
|
@@ -106,9 +106,12 @@ function ProgressBar(_ref) {
|
|
|
106
106
|
transform: "scaleX(".concat(percentage, ")")
|
|
107
107
|
} : null
|
|
108
108
|
})), helperText && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
109
|
-
id: helperId,
|
|
110
109
|
className: "".concat(prefix, "--progress-bar__helper-text")
|
|
111
|
-
}, helperText
|
|
110
|
+
}, helperText, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
111
|
+
className: "".concat(prefix, "--visually-hidden"),
|
|
112
|
+
"aria-live": "polite",
|
|
113
|
+
id: helperId
|
|
114
|
+
}, isFinished ? 'Done' : 'Loading')));
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
ProgressBar.propTypes = {
|
|
@@ -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"];
|