@carbon/react 1.24.0 → 1.26.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/Button/Button.js +2 -2
- package/es/components/CodeSnippet/CodeSnippet.js +13 -115
- package/es/components/ComboBox/ComboBox.d.ts +6 -0
- package/es/components/ComboBox/ComboBox.js +19 -172
- package/es/components/ComboButton/index.js +164 -0
- package/es/components/ComposedModal/ComposedModal.js +1 -2
- package/es/components/DataTable/Table.d.ts +74 -0
- package/es/components/DataTable/Table.js +4 -2
- package/es/components/DataTable/TableCell.d.ts +10 -0
- package/es/components/DataTable/TableContext.d.ts +13 -0
- package/es/components/DataTable/TableContext.js +2 -2
- package/es/components/DataTable/TableExpandRow.d.ts +67 -0
- package/es/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/es/components/DataTable/TableHead.d.ts +10 -0
- package/es/components/DataTable/TableHeader.d.ts +64 -0
- package/es/components/DataTable/TableHeader.js +23 -28
- package/es/components/DataTable/TableRow.d.ts +32 -0
- package/es/components/DataTable/TableSelectAll.js +1 -1
- package/es/components/DataTable/TableSelectRow.js +1 -3
- package/es/components/DataTable/TableToolbar.d.ts +19 -0
- package/es/components/DataTable/TableToolbar.js +1 -1
- package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/es/components/DataTable/TableToolbarContent.d.ts +19 -0
- package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -3
- package/es/components/DataTable/TableToolbarSearch.js +1 -0
- package/es/components/DataTable/tools/sorting.js +2 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/es/components/Dropdown/Dropdown.d.ts +6 -0
- package/es/components/Dropdown/Dropdown.js +8 -145
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FileUploader/FileUploaderButton.js +2 -0
- package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/es/components/FileUploader/FileUploaderItem.js +2 -1
- package/es/components/FileUploader/Filename.js +8 -2
- package/es/components/FluidTextArea/FluidTextArea.js +12 -1
- package/es/components/IconButton/index.js +1 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/es/components/ListBox/ListBoxSelection.js +4 -23
- package/es/components/ListBox/next/ListBoxSelection.js +2 -23
- package/es/components/Menu/Menu.js +50 -29
- package/es/components/Menu/MenuItem.js +1 -0
- package/es/components/MenuButton/index.js +127 -0
- package/es/components/Modal/Modal.js +4 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +46 -144
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +48 -28
- package/es/components/Notification/Notification.js +27 -264
- package/es/components/NumberInput/NumberInput.js +9 -1
- package/es/components/OverflowMenu/OverflowMenu.js +13 -139
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/es/components/OverflowMenuV2/index.js +15 -51
- package/es/components/Popover/index.d.ts +5 -1
- package/es/components/Popover/index.js +37 -9
- package/es/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/es/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/es/components/RadioButton/RadioButton.d.ts +64 -0
- package/es/components/RadioButton/RadioButton.js +19 -17
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +88 -26
- package/es/components/RadioTile/RadioTile.js +6 -6
- package/es/components/Search/Search.Skeleton.d.ts +36 -0
- package/es/components/Search/Search.js +3 -2
- package/es/components/Search/index.js +1 -0
- package/es/components/Select/Select.d.ts +89 -0
- package/es/components/SelectItem/SelectItem.d.ts +62 -0
- package/es/components/SelectItem/SelectItem.js +2 -4
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- package/es/components/StructuredList/StructuredList.js +11 -39
- package/es/components/Tabs/Tabs.js +29 -6
- package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/es/components/TextArea/TextArea.Skeleton.js +5 -5
- package/es/components/TextArea/TextArea.d.ts +9 -2
- package/es/components/TextArea/TextArea.js +31 -8
- package/es/components/TextArea/index.js +1 -0
- package/es/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/es/components/TextInput/index.js +1 -0
- package/es/components/Tile/Tile.js +15 -8
- package/es/components/Toggle/Toggle.js +8 -19
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/es/components/Tooltip/DefinitionTooltip.js +2 -2
- package/es/components/Tooltip/Tooltip.d.ts +117 -0
- package/es/components/Tooltip/Tooltip.js +6 -4
- package/es/components/Tooltip/index.d.ts +9 -0
- package/es/components/UIShell/HeaderMenu.js +13 -4
- package/es/components/UIShell/HeaderMenuItem.js +17 -4
- package/es/index.d.ts +2 -0
- package/es/index.js +5 -3
- package/es/internal/ClickListener.js +1 -2
- package/es/internal/keyboard/match.js +1 -1
- package/es/internal/useAttachedMenu.js +85 -0
- package/es/internal/useDelayedState.d.ts +19 -0
- package/es/internal/useDelayedState.js +7 -3
- package/es/internal/useId.js +1 -1
- package/es/tools/wrapComponent.js +9 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
- package/lib/components/ComboBox/ComboBox.d.ts +6 -0
- package/lib/components/ComboBox/ComboBox.js +18 -171
- package/lib/components/ComboButton/index.js +174 -0
- package/lib/components/ComposedModal/ComposedModal.js +1 -2
- package/lib/components/DataTable/Table.d.ts +74 -0
- package/lib/components/DataTable/Table.js +4 -2
- package/lib/components/DataTable/TableCell.d.ts +10 -0
- package/lib/components/DataTable/TableContext.d.ts +13 -0
- package/lib/components/DataTable/TableContext.js +2 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +67 -0
- package/lib/components/DataTable/TableExpandedRow.d.ts +32 -0
- package/lib/components/DataTable/TableHead.d.ts +10 -0
- package/lib/components/DataTable/TableHeader.d.ts +64 -0
- package/lib/components/DataTable/TableHeader.js +23 -28
- package/lib/components/DataTable/TableRow.d.ts +32 -0
- package/lib/components/DataTable/TableSelectAll.js +1 -1
- package/lib/components/DataTable/TableSelectRow.js +1 -3
- package/lib/components/DataTable/TableToolbar.d.ts +19 -0
- package/lib/components/DataTable/TableToolbar.js +1 -1
- package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/lib/components/DataTable/TableToolbarContent.d.ts +19 -0
- package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -3
- package/lib/components/DataTable/TableToolbarSearch.js +1 -0
- package/lib/components/DataTable/tools/sorting.js +2 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/lib/components/Dropdown/Dropdown.d.ts +6 -0
- package/lib/components/Dropdown/Dropdown.js +7 -144
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
- package/lib/components/FileUploader/FileUploader.js +1 -1
- package/lib/components/FileUploader/FileUploaderButton.js +2 -0
- package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/lib/components/FileUploader/FileUploaderItem.js +2 -1
- package/lib/components/FileUploader/Filename.js +8 -2
- package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
- package/lib/components/IconButton/index.js +1 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
- package/lib/components/ListBox/ListBoxSelection.js +4 -23
- package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
- package/lib/components/Menu/Menu.js +50 -29
- package/lib/components/Menu/MenuItem.js +1 -0
- package/lib/components/MenuButton/index.js +137 -0
- package/lib/components/Modal/Modal.js +4 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +43 -141
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +47 -27
- package/lib/components/Notification/Notification.js +27 -264
- package/lib/components/NumberInput/NumberInput.js +9 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/lib/components/OverflowMenuV2/index.js +13 -49
- package/lib/components/Popover/index.d.ts +5 -1
- package/lib/components/Popover/index.js +37 -9
- package/lib/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
- package/lib/components/RadioButton/RadioButton.Skeleton.js +3 -3
- package/lib/components/RadioButton/RadioButton.d.ts +64 -0
- package/lib/components/RadioButton/RadioButton.js +18 -16
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +86 -24
- package/lib/components/RadioTile/RadioTile.js +6 -6
- package/lib/components/Search/Search.Skeleton.d.ts +36 -0
- package/lib/components/Search/Search.js +3 -2
- package/lib/components/Search/index.js +2 -0
- package/lib/components/Select/Select.d.ts +89 -0
- package/lib/components/SelectItem/SelectItem.d.ts +62 -0
- package/lib/components/SelectItem/SelectItem.js +1 -3
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +11 -39
- package/lib/components/Tabs/Tabs.js +29 -6
- package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
- package/lib/components/TextArea/TextArea.d.ts +9 -2
- package/lib/components/TextArea/TextArea.js +30 -7
- package/lib/components/TextArea/index.js +2 -0
- package/lib/components/TextInput/TextInput.Skeleton.d.ts +33 -0
- package/lib/components/TextInput/index.js +2 -0
- package/lib/components/Tile/Tile.js +15 -8
- package/lib/components/Toggle/Toggle.js +8 -19
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.d.ts +117 -0
- package/lib/components/Tooltip/Tooltip.js +6 -4
- package/lib/components/Tooltip/index.d.ts +9 -0
- package/lib/components/UIShell/HeaderMenu.js +13 -4
- package/lib/components/UIShell/HeaderMenuItem.js +17 -4
- package/lib/index.d.ts +2 -0
- package/lib/index.js +50 -46
- package/lib/internal/ClickListener.js +1 -2
- package/lib/internal/keyboard/match.js +1 -1
- package/lib/internal/useAttachedMenu.js +89 -0
- package/lib/internal/useDelayedState.d.ts +19 -0
- package/lib/internal/useDelayedState.js +7 -3
- package/lib/internal/useId.js +1 -1
- package/lib/tools/wrapComponent.js +9 -0
- package/package.json +3 -3
|
@@ -25,7 +25,7 @@ import '../FluidForm/FluidForm.js';
|
|
|
25
25
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
26
26
|
import { match } from '../../internal/keyboard/match.js';
|
|
27
27
|
import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
|
|
28
|
-
import { Delete } from '../../internal/keyboard/keys.js';
|
|
28
|
+
import { Delete, Escape, Space, ArrowDown } from '../../internal/keyboard/keys.js';
|
|
29
29
|
|
|
30
30
|
var noop = function noop() {};
|
|
31
31
|
|
|
@@ -35,7 +35,6 @@ var _ref = useSelect.stateChangeTypes,
|
|
|
35
35
|
MenuBlur = _ref.MenuBlur,
|
|
36
36
|
MenuKeyDownArrowDown = _ref.MenuKeyDownArrowDown,
|
|
37
37
|
MenuKeyDownArrowUp = _ref.MenuKeyDownArrowUp,
|
|
38
|
-
MenuKeyDownEnter = _ref.MenuKeyDownEnter,
|
|
39
38
|
MenuKeyDownEscape = _ref.MenuKeyDownEscape,
|
|
40
39
|
MenuKeyDownSpaceButton = _ref.MenuKeyDownSpaceButton,
|
|
41
40
|
ToggleButtonClick = _ref.ToggleButtonClick;
|
|
@@ -111,20 +110,25 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
111
110
|
isFocused = _useState4[0],
|
|
112
111
|
setIsFocused = _useState4[1];
|
|
113
112
|
|
|
114
|
-
var _useState5 = useState(
|
|
113
|
+
var _useState5 = useState(false),
|
|
115
114
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
inputFocused = _useState6[0],
|
|
116
|
+
setInputFocused = _useState6[1];
|
|
118
117
|
|
|
119
|
-
var _useState7 = useState(open),
|
|
118
|
+
var _useState7 = useState(open || false),
|
|
120
119
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
isOpen = _useState8[0],
|
|
121
|
+
setIsOpen = _useState8[1];
|
|
123
122
|
|
|
124
|
-
var _useState9 = useState(
|
|
123
|
+
var _useState9 = useState(open),
|
|
125
124
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
prevOpenProp = _useState10[0],
|
|
126
|
+
setPrevOpenProp = _useState10[1];
|
|
127
|
+
|
|
128
|
+
var _useState11 = useState([]),
|
|
129
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
130
|
+
topItems = _useState12[0],
|
|
131
|
+
setTopItems = _useState12[1];
|
|
128
132
|
|
|
129
133
|
var _useSelection = useSelection({
|
|
130
134
|
disabled: disabled,
|
|
@@ -164,7 +168,14 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
164
168
|
getItemProps = _useSelect.getItemProps,
|
|
165
169
|
selectedItem = _useSelect.selectedItem;
|
|
166
170
|
|
|
167
|
-
var toggleButtonProps = getToggleButtonProps(
|
|
171
|
+
var toggleButtonProps = getToggleButtonProps({
|
|
172
|
+
onFocus: function onFocus() {
|
|
173
|
+
setInputFocused(true);
|
|
174
|
+
},
|
|
175
|
+
onBlur: function onBlur() {
|
|
176
|
+
setInputFocused(false);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
168
179
|
var mergedRef = mergeRefs(toggleButtonProps.ref, ref);
|
|
169
180
|
var selectedItems = selectedItem;
|
|
170
181
|
/**
|
|
@@ -196,7 +207,7 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
196
207
|
var helperId = !helperText ? undefined : "multiselect-helper-text-".concat(multiSelectInstanceId);
|
|
197
208
|
var fieldLabelId = "multiselect-field-label-".concat(multiSelectInstanceId);
|
|
198
209
|
var helperClasses = cx("".concat(prefix, "--form__helper-text"), _defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
|
|
199
|
-
var className = cx("".concat(prefix, "--multi-select"), [enabled ? null : containerClassName], (_cx4 = {}, _defineProperty(_cx4, "".concat(prefix, "--multi-select--invalid"), invalid), _defineProperty(_cx4, "".concat(prefix, "--multi-select--warning"), showWarning), _defineProperty(_cx4, "".concat(prefix, "--multi-select--inline"), inline), _defineProperty(_cx4, "".concat(prefix, "--multi-select--selected"), selectedItems && selectedItems.length > 0), _defineProperty(_cx4, "".concat(prefix, "--list-box--up"), direction === 'top'), _defineProperty(_cx4, "".concat(prefix, "--multi-select--readonly"), readOnly), _cx4)); // needs to be capitalized for react to render it correctly
|
|
210
|
+
var className = cx("".concat(prefix, "--multi-select"), [enabled ? null : containerClassName], (_cx4 = {}, _defineProperty(_cx4, "".concat(prefix, "--multi-select--invalid"), invalid), _defineProperty(_cx4, "".concat(prefix, "--multi-select--invalid--focused"), invalid && inputFocused), _defineProperty(_cx4, "".concat(prefix, "--multi-select--warning"), showWarning), _defineProperty(_cx4, "".concat(prefix, "--multi-select--inline"), inline), _defineProperty(_cx4, "".concat(prefix, "--multi-select--selected"), selectedItems && selectedItems.length > 0), _defineProperty(_cx4, "".concat(prefix, "--list-box--up"), direction === 'top'), _defineProperty(_cx4, "".concat(prefix, "--multi-select--readonly"), readOnly), _cx4)); // needs to be capitalized for react to render it correctly
|
|
200
211
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
201
212
|
|
|
202
213
|
var ItemToElement = itemToElement;
|
|
@@ -223,7 +234,6 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
223
234
|
switch (type) {
|
|
224
235
|
case ItemClick:
|
|
225
236
|
case MenuKeyDownSpaceButton:
|
|
226
|
-
case MenuKeyDownEnter:
|
|
227
237
|
if (changes.selectedItem === undefined) {
|
|
228
238
|
break;
|
|
229
239
|
}
|
|
@@ -250,12 +260,20 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
250
260
|
}
|
|
251
261
|
|
|
252
262
|
var onKeyDown = function onKeyDown(e) {
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
263
|
+
if (!disabled) {
|
|
264
|
+
if (match(e, Delete) || match(e, Escape)) {
|
|
265
|
+
clearSelection();
|
|
266
|
+
e.stopPropagation();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (match(e, Space) || match(e, ArrowDown)) {
|
|
270
|
+
setIsOpenWrapper(true);
|
|
271
|
+
}
|
|
256
272
|
}
|
|
257
273
|
};
|
|
258
274
|
|
|
275
|
+
var multiSelectFieldWrapperClasses = cx("".concat(prefix, "--list-box__field--wrapper"), _defineProperty({}, "".concat(prefix, "--list-box__field--wrapper--input-focused"), inputFocused));
|
|
276
|
+
|
|
259
277
|
var handleFocus = function handleFocus(evt) {
|
|
260
278
|
evt.target.classList.contains("".concat(prefix, "--tag__close-icon")) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
|
|
261
279
|
};
|
|
@@ -301,6 +319,15 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
301
319
|
className: "".concat(prefix, "--list-box__invalid-icon")
|
|
302
320
|
}), showWarning && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
|
|
303
321
|
className: "".concat(prefix, "--list-box__invalid-icon ").concat(prefix, "--list-box__invalid-icon--warning")
|
|
322
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
323
|
+
className: multiSelectFieldWrapperClasses
|
|
324
|
+
}, selectedItems.length > 0 && /*#__PURE__*/React__default.createElement(ListBox.Selection, {
|
|
325
|
+
readOnly: readOnly,
|
|
326
|
+
clearSelection: !disabled && !readOnly ? clearSelection : noop,
|
|
327
|
+
selectionCount: selectedItems.length // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
328
|
+
,
|
|
329
|
+
translateWithId: translateWithId,
|
|
330
|
+
disabled: disabled
|
|
304
331
|
}), /*#__PURE__*/React__default.createElement("button", _extends({
|
|
305
332
|
type: "button",
|
|
306
333
|
className: "".concat(prefix, "--list-box__field"),
|
|
@@ -309,20 +336,13 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
|
|
|
309
336
|
}, toggleButtonProps, {
|
|
310
337
|
ref: mergedRef,
|
|
311
338
|
onKeyDown: onKeyDown
|
|
312
|
-
}, readOnlyEventHandlers),
|
|
313
|
-
readOnly: readOnly,
|
|
314
|
-
clearSelection: !disabled && !readOnly ? clearSelection : noop,
|
|
315
|
-
selectionCount: selectedItems.length // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
316
|
-
,
|
|
317
|
-
translateWithId: translateWithId,
|
|
318
|
-
disabled: disabled
|
|
319
|
-
}), /*#__PURE__*/React__default.createElement("span", {
|
|
339
|
+
}, readOnlyEventHandlers), /*#__PURE__*/React__default.createElement("span", {
|
|
320
340
|
id: fieldLabelId,
|
|
321
341
|
className: "".concat(prefix, "--list-box__label")
|
|
322
342
|
}, label), /*#__PURE__*/React__default.createElement(ListBox.MenuIcon, {
|
|
323
|
-
isOpen:
|
|
343
|
+
isOpen: isOpen,
|
|
324
344
|
translateWithId: translateWithId
|
|
325
|
-
})), /*#__PURE__*/React__default.createElement(ListBox.Menu, _extends({
|
|
345
|
+
}))), /*#__PURE__*/React__default.createElement(ListBox.Menu, _extends({
|
|
326
346
|
"aria-multiselectable": "true"
|
|
327
347
|
}, getMenuProps()), isOpen && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
328
348
|
sortItems(items, sortOptions).map(function (item, index) {
|
|
@@ -466,7 +486,7 @@ MultiSelect.propTypes = _objectSpread2(_objectSpread2({}, sortingPropTypes), {},
|
|
|
466
486
|
|
|
467
487
|
/**
|
|
468
488
|
* `onMenuChange` is a utility for this controlled component to communicate to a
|
|
469
|
-
* consuming component that the menu was
|
|
489
|
+
* consuming component that the menu was open(`true`)/closed(`false`).
|
|
470
490
|
*/
|
|
471
491
|
onMenuChange: PropTypes.func,
|
|
472
492
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends, slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default, { useState, useRef, useEffect } from 'react';
|
|
11
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
11
12
|
import cx from 'classnames';
|
|
12
13
|
import { Close, WarningAltFilled, InformationFilled, InformationSquareFilled, ErrorFilled, CheckmarkFilled, WarningFilled } from '@carbon/icons-react';
|
|
13
14
|
import Button from '../Button/Button.js';
|
|
@@ -18,13 +19,13 @@ import { useId } from '../../internal/useId.js';
|
|
|
18
19
|
import { matches } from '../../internal/keyboard/match.js';
|
|
19
20
|
import { Escape } from '../../internal/keyboard/keys.js';
|
|
20
21
|
|
|
21
|
-
var _iconTypes;
|
|
22
|
+
var _NotificationButton$p, _NotificationButton$d, _iconTypes, _ToastNotification$pr, _InlineNotification$p, _ActionableNotificati;
|
|
22
23
|
|
|
23
24
|
var _excluded = ["children", "className", "onClick", "inline"],
|
|
24
|
-
_excluded2 = ["ariaLabel", "className", "type", "renderIcon", "name", "notificationType"],
|
|
25
|
-
_excluded3 = ["role", "onClose", "onCloseButtonClick", "statusIconDescription", "className", "children", "kind", "lowContrast", "hideCloseButton", "timeout", "title", "caption", "subtitle"],
|
|
26
|
-
_excluded4 = ["children", "title", "subtitle", "role", "onClose", "onCloseButtonClick", "statusIconDescription", "className", "kind", "lowContrast", "hideCloseButton"],
|
|
27
|
-
_excluded5 = ["actionButtonLabel", "ariaLabel", "children", "role", "onActionButtonClick", "onClose", "onCloseButtonClick", "statusIconDescription", "className", "inline", "kind", "lowContrast", "hideCloseButton", "hasFocus", "closeOnEscape", "title", "subtitle"];
|
|
25
|
+
_excluded2 = ["aria-label", "ariaLabel", "className", "type", "renderIcon", "name", "notificationType"],
|
|
26
|
+
_excluded3 = ["aria-label", "ariaLabel", "role", "onClose", "onCloseButtonClick", "statusIconDescription", "className", "children", "kind", "lowContrast", "hideCloseButton", "timeout", "title", "caption", "subtitle"],
|
|
27
|
+
_excluded4 = ["aria-label", "children", "title", "subtitle", "role", "onClose", "onCloseButtonClick", "statusIconDescription", "className", "kind", "lowContrast", "hideCloseButton"],
|
|
28
|
+
_excluded5 = ["actionButtonLabel", "aria-label", "ariaLabel", "children", "role", "onActionButtonClick", "onClose", "onCloseButtonClick", "statusIconDescription", "className", "inline", "kind", "lowContrast", "hideCloseButton", "hasFocus", "closeOnEscape", "title", "subtitle"];
|
|
28
29
|
/**
|
|
29
30
|
* Conditionally call a callback when the escape key is pressed
|
|
30
31
|
* @param {node} ref - ref of the container element to scope the functionality to
|
|
@@ -90,7 +91,8 @@ NotificationActionButton.propTypes = {
|
|
|
90
91
|
onClick: PropTypes.func
|
|
91
92
|
};
|
|
92
93
|
function NotificationButton(_ref2) {
|
|
93
|
-
var ariaLabel = _ref2
|
|
94
|
+
var ariaLabel = _ref2['aria-label'],
|
|
95
|
+
deprecatedAriaLabel = _ref2.ariaLabel,
|
|
94
96
|
className = _ref2.className,
|
|
95
97
|
type = _ref2.type,
|
|
96
98
|
IconTag = _ref2.renderIcon,
|
|
@@ -104,53 +106,16 @@ function NotificationButton(_ref2) {
|
|
|
104
106
|
return /*#__PURE__*/React__default.createElement("button", _extends({}, rest, {
|
|
105
107
|
// eslint-disable-next-line react/button-has-type
|
|
106
108
|
type: type,
|
|
107
|
-
"aria-label": ariaLabel,
|
|
108
|
-
title: ariaLabel,
|
|
109
|
+
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
110
|
+
title: deprecatedAriaLabel || ariaLabel,
|
|
109
111
|
className: buttonClassName
|
|
110
112
|
}), IconTag && /*#__PURE__*/React__default.createElement(IconTag, {
|
|
111
113
|
className: iconClassName,
|
|
112
114
|
name: name
|
|
113
115
|
}));
|
|
114
116
|
}
|
|
115
|
-
NotificationButton.propTypes = {
|
|
116
|
-
|
|
117
|
-
* Specify a label to be read by screen readers on the notification button
|
|
118
|
-
*/
|
|
119
|
-
ariaLabel: PropTypes.string,
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Specify an optional className to be applied to the notification button
|
|
123
|
-
*/
|
|
124
|
-
className: PropTypes.string,
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Specify an optional icon for the Button through a string,
|
|
128
|
-
* if something but regular "close" icon is desirable
|
|
129
|
-
*/
|
|
130
|
-
name: PropTypes.string,
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Specify the notification type
|
|
134
|
-
*/
|
|
135
|
-
notificationType: PropTypes.oneOf(['toast', 'inline', 'actionable']),
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Optional prop to allow overriding the icon rendering.
|
|
139
|
-
* Can be a React component class
|
|
140
|
-
*/
|
|
141
|
-
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Optional prop to specify the type of the Button
|
|
145
|
-
*/
|
|
146
|
-
type: PropTypes.string
|
|
147
|
-
};
|
|
148
|
-
NotificationButton.defaultProps = {
|
|
149
|
-
ariaLabel: 'close notification',
|
|
150
|
-
notificationType: 'toast',
|
|
151
|
-
type: 'button',
|
|
152
|
-
renderIcon: Close
|
|
153
|
-
};
|
|
117
|
+
NotificationButton.propTypes = (_NotificationButton$p = {}, _defineProperty(_NotificationButton$p, 'aria-label', PropTypes.string), _defineProperty(_NotificationButton$p, "ariaLabel", deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _defineProperty(_NotificationButton$p, "className", PropTypes.string), _defineProperty(_NotificationButton$p, "name", PropTypes.string), _defineProperty(_NotificationButton$p, "notificationType", PropTypes.oneOf(['toast', 'inline', 'actionable'])), _defineProperty(_NotificationButton$p, "renderIcon", PropTypes.oneOfType([PropTypes.func, PropTypes.object])), _defineProperty(_NotificationButton$p, "type", PropTypes.string), _NotificationButton$p);
|
|
118
|
+
NotificationButton.defaultProps = (_NotificationButton$d = {}, _defineProperty(_NotificationButton$d, 'aria-label', 'close notification'), _defineProperty(_NotificationButton$d, "notificationType", 'toast'), _defineProperty(_NotificationButton$d, "type", 'button'), _defineProperty(_NotificationButton$d, "renderIcon", Close), _NotificationButton$d);
|
|
154
119
|
var iconTypes = (_iconTypes = {
|
|
155
120
|
error: ErrorFilled,
|
|
156
121
|
success: CheckmarkFilled,
|
|
@@ -182,7 +147,9 @@ NotificationIcon.propTypes = {
|
|
|
182
147
|
function ToastNotification(_ref4) {
|
|
183
148
|
var _cx4;
|
|
184
149
|
|
|
185
|
-
var
|
|
150
|
+
var ariaLabel = _ref4['aria-label'],
|
|
151
|
+
deprecatedAriaLabel = _ref4.ariaLabel,
|
|
152
|
+
role = _ref4.role,
|
|
186
153
|
onClose = _ref4.onClose,
|
|
187
154
|
onCloseButtonClick = _ref4.onCloseButtonClick,
|
|
188
155
|
statusIconDescription = _ref4.statusIconDescription,
|
|
@@ -267,81 +234,11 @@ function ToastNotification(_ref4) {
|
|
|
267
234
|
notificationType: "toast",
|
|
268
235
|
onClick: handleCloseButtonClick,
|
|
269
236
|
"aria-hidden": "true",
|
|
237
|
+
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
270
238
|
tabIndex: "-1"
|
|
271
239
|
}));
|
|
272
240
|
}
|
|
273
|
-
ToastNotification.propTypes = {
|
|
274
|
-
/**
|
|
275
|
-
* Provide a description for "close" icon button that can be read by screen readers
|
|
276
|
-
*/
|
|
277
|
-
ariaLabel: PropTypes.string,
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Specify the caption
|
|
281
|
-
*/
|
|
282
|
-
caption: PropTypes.string,
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Specify the content
|
|
286
|
-
*/
|
|
287
|
-
children: PropTypes.node,
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Specify an optional className to be applied to the notification box
|
|
291
|
-
*/
|
|
292
|
-
className: PropTypes.string,
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Specify the close button should be disabled, or not
|
|
296
|
-
*/
|
|
297
|
-
hideCloseButton: PropTypes.bool,
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Specify what state the notification represents
|
|
301
|
-
*/
|
|
302
|
-
kind: PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Specify whether you are using the low contrast variant of the ToastNotification.
|
|
306
|
-
*/
|
|
307
|
-
lowContrast: PropTypes.bool,
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Provide a function that is called when menu is closed
|
|
311
|
-
*/
|
|
312
|
-
onClose: PropTypes.func,
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Provide a function that is called when the close button is clicked
|
|
316
|
-
*/
|
|
317
|
-
onCloseButtonClick: PropTypes.func,
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* By default, this value is "status". You can also provide an alternate
|
|
321
|
-
* role if it makes sense from the accessibility-side
|
|
322
|
-
*/
|
|
323
|
-
role: PropTypes.oneOf(['alert', 'log', 'status']),
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Provide a description for "status" icon that can be read by screen readers
|
|
327
|
-
*/
|
|
328
|
-
statusIconDescription: PropTypes.string,
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Specify the sub-title
|
|
332
|
-
*/
|
|
333
|
-
subtitle: PropTypes.string,
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Specify an optional duration the notification should be closed in
|
|
337
|
-
*/
|
|
338
|
-
timeout: PropTypes.number,
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Specify the title
|
|
342
|
-
*/
|
|
343
|
-
title: PropTypes.string
|
|
344
|
-
};
|
|
241
|
+
ToastNotification.propTypes = (_ToastNotification$pr = {}, _defineProperty(_ToastNotification$pr, 'aria-label', PropTypes.string), _defineProperty(_ToastNotification$pr, "ariaLabel", deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _defineProperty(_ToastNotification$pr, "caption", PropTypes.string), _defineProperty(_ToastNotification$pr, "children", PropTypes.node), _defineProperty(_ToastNotification$pr, "className", PropTypes.string), _defineProperty(_ToastNotification$pr, "hideCloseButton", PropTypes.bool), _defineProperty(_ToastNotification$pr, "kind", PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt'])), _defineProperty(_ToastNotification$pr, "lowContrast", PropTypes.bool), _defineProperty(_ToastNotification$pr, "onClose", PropTypes.func), _defineProperty(_ToastNotification$pr, "onCloseButtonClick", PropTypes.func), _defineProperty(_ToastNotification$pr, "role", PropTypes.oneOf(['alert', 'log', 'status'])), _defineProperty(_ToastNotification$pr, "statusIconDescription", PropTypes.string), _defineProperty(_ToastNotification$pr, "subtitle", PropTypes.string), _defineProperty(_ToastNotification$pr, "timeout", PropTypes.number), _defineProperty(_ToastNotification$pr, "title", PropTypes.string), _ToastNotification$pr);
|
|
345
242
|
ToastNotification.defaultProps = {
|
|
346
243
|
kind: 'error',
|
|
347
244
|
role: 'status',
|
|
@@ -352,7 +249,8 @@ ToastNotification.defaultProps = {
|
|
|
352
249
|
function InlineNotification(_ref5) {
|
|
353
250
|
var _cx5;
|
|
354
251
|
|
|
355
|
-
var
|
|
252
|
+
var ariaLabel = _ref5['aria-label'],
|
|
253
|
+
children = _ref5.children,
|
|
356
254
|
title = _ref5.title,
|
|
357
255
|
subtitle = _ref5.subtitle,
|
|
358
256
|
role = _ref5.role,
|
|
@@ -414,66 +312,11 @@ function InlineNotification(_ref5) {
|
|
|
414
312
|
notificationType: "inline",
|
|
415
313
|
onClick: handleCloseButtonClick,
|
|
416
314
|
"aria-hidden": "true",
|
|
315
|
+
"aria-label": ariaLabel,
|
|
417
316
|
tabIndex: "-1"
|
|
418
317
|
}));
|
|
419
318
|
}
|
|
420
|
-
InlineNotification.propTypes = {
|
|
421
|
-
/**
|
|
422
|
-
* Specify the content
|
|
423
|
-
*/
|
|
424
|
-
children: PropTypes.node,
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Specify an optional className to be applied to the notification box
|
|
428
|
-
*/
|
|
429
|
-
className: PropTypes.string,
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Specify the close button should be disabled, or not
|
|
433
|
-
*/
|
|
434
|
-
hideCloseButton: PropTypes.bool,
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Specify what state the notification represents
|
|
438
|
-
*/
|
|
439
|
-
kind: PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Specify whether you are using the low contrast variant of the InlineNotification.
|
|
443
|
-
*/
|
|
444
|
-
lowContrast: PropTypes.bool,
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Provide a function that is called when menu is closed
|
|
448
|
-
*/
|
|
449
|
-
onClose: PropTypes.func,
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Provide a function that is called when the close button is clicked
|
|
453
|
-
*/
|
|
454
|
-
onCloseButtonClick: PropTypes.func,
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* By default, this value is "status". You can also provide an alternate
|
|
458
|
-
* role if it makes sense from the accessibility-side.
|
|
459
|
-
*/
|
|
460
|
-
role: PropTypes.oneOf(['alert', 'log', 'status']),
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Provide a description for "status" icon that can be read by screen readers
|
|
464
|
-
*/
|
|
465
|
-
statusIconDescription: PropTypes.string,
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Specify the sub-title
|
|
469
|
-
*/
|
|
470
|
-
subtitle: PropTypes.string,
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Specify the title
|
|
474
|
-
*/
|
|
475
|
-
title: PropTypes.string
|
|
476
|
-
};
|
|
319
|
+
InlineNotification.propTypes = (_InlineNotification$p = {}, _defineProperty(_InlineNotification$p, 'aria-label', PropTypes.string), _defineProperty(_InlineNotification$p, "children", PropTypes.node), _defineProperty(_InlineNotification$p, "className", PropTypes.string), _defineProperty(_InlineNotification$p, "hideCloseButton", PropTypes.bool), _defineProperty(_InlineNotification$p, "kind", PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt'])), _defineProperty(_InlineNotification$p, "lowContrast", PropTypes.bool), _defineProperty(_InlineNotification$p, "onClose", PropTypes.func), _defineProperty(_InlineNotification$p, "onCloseButtonClick", PropTypes.func), _defineProperty(_InlineNotification$p, "role", PropTypes.oneOf(['alert', 'log', 'status'])), _defineProperty(_InlineNotification$p, "statusIconDescription", PropTypes.string), _defineProperty(_InlineNotification$p, "subtitle", PropTypes.string), _defineProperty(_InlineNotification$p, "title", PropTypes.string), _InlineNotification$p);
|
|
477
320
|
InlineNotification.defaultProps = {
|
|
478
321
|
kind: 'error',
|
|
479
322
|
role: 'status',
|
|
@@ -484,7 +327,8 @@ function ActionableNotification(_ref6) {
|
|
|
484
327
|
var _cx6;
|
|
485
328
|
|
|
486
329
|
var actionButtonLabel = _ref6.actionButtonLabel,
|
|
487
|
-
ariaLabel = _ref6
|
|
330
|
+
ariaLabel = _ref6['aria-label'],
|
|
331
|
+
deprecatedAriaLabel = _ref6.ariaLabel,
|
|
488
332
|
children = _ref6.children,
|
|
489
333
|
role = _ref6.role,
|
|
490
334
|
onActionButtonClick = _ref6.onActionButtonClick,
|
|
@@ -558,98 +402,17 @@ function ActionableNotification(_ref6) {
|
|
|
558
402
|
onClick: onActionButtonClick,
|
|
559
403
|
inline: inline
|
|
560
404
|
}, actionButtonLabel), !hideCloseButton && /*#__PURE__*/React__default.createElement(NotificationButton, {
|
|
561
|
-
"aria-label": ariaLabel,
|
|
405
|
+
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
562
406
|
notificationType: "actionable",
|
|
563
407
|
onClick: handleCloseButtonClick
|
|
564
408
|
}));
|
|
565
409
|
}
|
|
566
|
-
ActionableNotification.propTypes = {
|
|
410
|
+
ActionableNotification.propTypes = (_ActionableNotificati = {
|
|
567
411
|
/**
|
|
568
412
|
* Pass in the action button label that will be rendered within the ActionableNotification.
|
|
569
413
|
*/
|
|
570
|
-
actionButtonLabel: PropTypes.string.isRequired
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* Provide a description for "close" icon button that can be read by screen readers
|
|
574
|
-
*/
|
|
575
|
-
ariaLabel: PropTypes.string,
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* Specify the content
|
|
579
|
-
*/
|
|
580
|
-
children: PropTypes.node,
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Specify an optional className to be applied to the notification box
|
|
584
|
-
*/
|
|
585
|
-
className: PropTypes.string,
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Specify if pressing the escape key should close notifications
|
|
589
|
-
*/
|
|
590
|
-
closeOnEscape: PropTypes.bool,
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Specify if focus should be moved to the component when the notification contains actions
|
|
594
|
-
*/
|
|
595
|
-
hasFocus: PropTypes.bool,
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Specify the close button should be disabled, or not
|
|
599
|
-
*/
|
|
600
|
-
hideCloseButton: PropTypes.bool,
|
|
601
|
-
|
|
602
|
-
/*
|
|
603
|
-
* Specify if the notification should have inline styling applied instead of toast
|
|
604
|
-
*/
|
|
605
|
-
inline: PropTypes.bool,
|
|
606
|
-
|
|
607
|
-
/**
|
|
608
|
-
* Specify what state the notification represents
|
|
609
|
-
*/
|
|
610
|
-
kind: PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']).isRequired,
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Specify whether you are using the low contrast variant of the ActionableNotification.
|
|
614
|
-
*/
|
|
615
|
-
lowContrast: PropTypes.bool,
|
|
616
|
-
|
|
617
|
-
/**
|
|
618
|
-
* Provide a function that is called when the action is clicked
|
|
619
|
-
*/
|
|
620
|
-
onActionButtonClick: PropTypes.func,
|
|
621
|
-
|
|
622
|
-
/**
|
|
623
|
-
* Provide a function that is called when menu is closed
|
|
624
|
-
*/
|
|
625
|
-
onClose: PropTypes.func,
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* Provide a function that is called when the close button is clicked
|
|
629
|
-
*/
|
|
630
|
-
onCloseButtonClick: PropTypes.func,
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* By default, this value is "alertdialog". You can also provide an alternate
|
|
634
|
-
* role if it makes sense from the accessibility-side.
|
|
635
|
-
*/
|
|
636
|
-
role: PropTypes.string,
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* Provide a description for "status" icon that can be read by screen readers
|
|
640
|
-
*/
|
|
641
|
-
statusIconDescription: PropTypes.string,
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* Specify the sub-title
|
|
645
|
-
*/
|
|
646
|
-
subtitle: PropTypes.string,
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Specify the title
|
|
650
|
-
*/
|
|
651
|
-
title: PropTypes.string
|
|
652
|
-
};
|
|
414
|
+
actionButtonLabel: PropTypes.string.isRequired
|
|
415
|
+
}, _defineProperty(_ActionableNotificati, 'aria-label', PropTypes.string), _defineProperty(_ActionableNotificati, "ariaLabel", deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _defineProperty(_ActionableNotificati, "children", PropTypes.node), _defineProperty(_ActionableNotificati, "className", PropTypes.string), _defineProperty(_ActionableNotificati, "closeOnEscape", PropTypes.bool), _defineProperty(_ActionableNotificati, "hasFocus", PropTypes.bool), _defineProperty(_ActionableNotificati, "hideCloseButton", PropTypes.bool), _defineProperty(_ActionableNotificati, "inline", PropTypes.bool), _defineProperty(_ActionableNotificati, "kind", PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']).isRequired), _defineProperty(_ActionableNotificati, "lowContrast", PropTypes.bool), _defineProperty(_ActionableNotificati, "onActionButtonClick", PropTypes.func), _defineProperty(_ActionableNotificati, "onClose", PropTypes.func), _defineProperty(_ActionableNotificati, "onCloseButtonClick", PropTypes.func), _defineProperty(_ActionableNotificati, "role", PropTypes.string), _defineProperty(_ActionableNotificati, "statusIconDescription", PropTypes.string), _defineProperty(_ActionableNotificati, "subtitle", PropTypes.string), _defineProperty(_ActionableNotificati, "title", PropTypes.string), _ActionableNotificati);
|
|
653
416
|
ActionableNotification.defaultProps = {
|
|
654
417
|
kind: 'error',
|
|
655
418
|
role: 'alertdialog',
|
|
@@ -515,13 +515,21 @@ function disableWheel(e) {
|
|
|
515
515
|
}
|
|
516
516
|
/**
|
|
517
517
|
* Clamp the given value between the upper bound `max` and the lower bound `min`
|
|
518
|
+
*
|
|
519
|
+
* 16 digit min/max more precise than Infinity. Somewhere in 9 quadrillion,
|
|
520
|
+
* there will be integer display issues at runtime. 9quad is a safe cutoff.
|
|
518
521
|
* @param {number} max
|
|
519
522
|
* @param {number} min
|
|
520
523
|
* @param {number} value
|
|
521
524
|
*/
|
|
522
525
|
|
|
523
526
|
|
|
524
|
-
|
|
527
|
+
var boundLimit = 9000000000000000; // 16 digit, 9 quadrillion
|
|
528
|
+
|
|
529
|
+
function clamp() {
|
|
530
|
+
var max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : boundLimit;
|
|
531
|
+
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -boundLimit;
|
|
532
|
+
var value = arguments.length > 2 ? arguments[2] : undefined;
|
|
525
533
|
return Math.min(max, Math.max(min, value));
|
|
526
534
|
}
|
|
527
535
|
|