@carbon/react 1.24.0 → 1.25.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.
Files changed (131) hide show
  1. package/es/components/CodeSnippet/CodeSnippet.js +13 -115
  2. package/es/components/ComboBox/ComboBox.d.ts +6 -0
  3. package/es/components/ComboBox/ComboBox.js +19 -172
  4. package/es/components/ComboButton/index.js +164 -0
  5. package/es/components/ComposedModal/ComposedModal.js +1 -2
  6. package/es/components/DataTable/TableToolbar.d.ts +19 -0
  7. package/es/components/DataTable/TableToolbar.js +1 -1
  8. package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
  9. package/es/components/DataTable/TableToolbarContent.d.ts +21 -0
  10. package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
  11. package/es/components/DataTable/TableToolbarMenu.js +3 -3
  12. package/es/components/DataTable/tools/sorting.js +2 -1
  13. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  14. package/es/components/Dropdown/Dropdown.d.ts +6 -0
  15. package/es/components/Dropdown/Dropdown.js +8 -145
  16. package/es/components/FileUploader/FileUploader.js +1 -1
  17. package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
  18. package/es/components/FileUploader/FileUploaderItem.js +2 -1
  19. package/es/components/FileUploader/Filename.js +8 -2
  20. package/es/components/FluidTextArea/FluidTextArea.js +12 -1
  21. package/es/components/IconButton/index.js +1 -0
  22. package/es/components/ListBox/ListBoxSelection.js +4 -23
  23. package/es/components/ListBox/next/ListBoxSelection.js +2 -23
  24. package/es/components/Menu/Menu.js +50 -29
  25. package/es/components/Menu/MenuItem.js +1 -0
  26. package/es/components/MenuButton/index.js +127 -0
  27. package/es/components/Modal/Modal.js +4 -3
  28. package/es/components/MultiSelect/FilterableMultiSelect.js +31 -137
  29. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  30. package/es/components/MultiSelect/MultiSelect.js +48 -26
  31. package/es/components/Notification/Notification.js +27 -264
  32. package/es/components/OverflowMenu/OverflowMenu.js +13 -139
  33. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  34. package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  35. package/es/components/OverflowMenuV2/index.js +15 -51
  36. package/es/components/Popover/index.d.ts +5 -1
  37. package/es/components/Popover/index.js +37 -9
  38. package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -4
  39. package/es/components/RadioTile/RadioTile.js +6 -6
  40. package/es/components/Select/Select.d.ts +89 -0
  41. package/es/components/SelectItem/SelectItem.d.ts +62 -0
  42. package/es/components/SelectItem/SelectItem.js +2 -4
  43. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  44. package/es/components/SkeletonText/SkeletonText.js +1 -1
  45. package/es/components/StructuredList/StructuredList.js +10 -38
  46. package/es/components/Tabs/Tabs.js +3 -1
  47. package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  48. package/es/components/TextArea/TextArea.Skeleton.js +5 -5
  49. package/es/components/TextArea/TextArea.d.ts +9 -2
  50. package/es/components/TextArea/TextArea.js +31 -8
  51. package/es/components/TextArea/index.js +1 -0
  52. package/es/components/Toggle/Toggle.js +8 -19
  53. package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  54. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  55. package/es/components/Tooltip/Tooltip.d.ts +117 -0
  56. package/es/components/Tooltip/Tooltip.js +6 -4
  57. package/es/components/Tooltip/index.d.ts +9 -0
  58. package/es/index.d.ts +2 -0
  59. package/es/index.js +5 -3
  60. package/es/internal/ClickListener.js +1 -2
  61. package/es/internal/keyboard/match.js +1 -1
  62. package/es/internal/useAttachedMenu.js +85 -0
  63. package/es/internal/useDelayedState.d.ts +19 -0
  64. package/es/internal/useDelayedState.js +7 -3
  65. package/es/internal/useId.js +1 -1
  66. package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
  67. package/lib/components/ComboBox/ComboBox.d.ts +6 -0
  68. package/lib/components/ComboBox/ComboBox.js +18 -171
  69. package/lib/components/ComboButton/index.js +174 -0
  70. package/lib/components/ComposedModal/ComposedModal.js +1 -2
  71. package/lib/components/DataTable/TableToolbar.d.ts +19 -0
  72. package/lib/components/DataTable/TableToolbar.js +1 -1
  73. package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
  74. package/lib/components/DataTable/TableToolbarContent.d.ts +21 -0
  75. package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
  76. package/lib/components/DataTable/TableToolbarMenu.js +3 -3
  77. package/lib/components/DataTable/tools/sorting.js +2 -1
  78. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  79. package/lib/components/Dropdown/Dropdown.d.ts +6 -0
  80. package/lib/components/Dropdown/Dropdown.js +7 -144
  81. package/lib/components/FileUploader/FileUploader.js +1 -1
  82. package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
  83. package/lib/components/FileUploader/FileUploaderItem.js +2 -1
  84. package/lib/components/FileUploader/Filename.js +8 -2
  85. package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
  86. package/lib/components/IconButton/index.js +1 -0
  87. package/lib/components/ListBox/ListBoxSelection.js +4 -23
  88. package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
  89. package/lib/components/Menu/Menu.js +50 -29
  90. package/lib/components/Menu/MenuItem.js +1 -0
  91. package/lib/components/MenuButton/index.js +137 -0
  92. package/lib/components/Modal/Modal.js +4 -3
  93. package/lib/components/MultiSelect/FilterableMultiSelect.js +29 -135
  94. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  95. package/lib/components/MultiSelect/MultiSelect.js +47 -25
  96. package/lib/components/Notification/Notification.js +27 -264
  97. package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
  98. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  99. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  100. package/lib/components/OverflowMenuV2/index.js +13 -49
  101. package/lib/components/Popover/index.d.ts +5 -1
  102. package/lib/components/Popover/index.js +37 -9
  103. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +6 -3
  104. package/lib/components/RadioTile/RadioTile.js +6 -6
  105. package/lib/components/Select/Select.d.ts +89 -0
  106. package/lib/components/SelectItem/SelectItem.d.ts +62 -0
  107. package/lib/components/SelectItem/SelectItem.js +1 -3
  108. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  109. package/lib/components/SkeletonText/SkeletonText.js +1 -1
  110. package/lib/components/StructuredList/StructuredList.js +10 -38
  111. package/lib/components/Tabs/Tabs.js +3 -1
  112. package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  113. package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
  114. package/lib/components/TextArea/TextArea.d.ts +9 -2
  115. package/lib/components/TextArea/TextArea.js +30 -7
  116. package/lib/components/TextArea/index.js +2 -0
  117. package/lib/components/Toggle/Toggle.js +8 -19
  118. package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  119. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  120. package/lib/components/Tooltip/Tooltip.d.ts +117 -0
  121. package/lib/components/Tooltip/Tooltip.js +6 -4
  122. package/lib/components/Tooltip/index.d.ts +9 -0
  123. package/lib/index.d.ts +2 -0
  124. package/lib/index.js +50 -46
  125. package/lib/internal/ClickListener.js +1 -2
  126. package/lib/internal/keyboard/match.js +1 -1
  127. package/lib/internal/useAttachedMenu.js +89 -0
  128. package/lib/internal/useDelayedState.d.ts +19 -0
  129. package/lib/internal/useDelayedState.js +7 -3
  130. package/lib/internal/useId.js +1 -1
  131. 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
 
@@ -111,20 +111,25 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
111
111
  isFocused = _useState4[0],
112
112
  setIsFocused = _useState4[1];
113
113
 
114
- var _useState5 = useState(open),
114
+ var _useState5 = useState(false),
115
115
  _useState6 = _slicedToArray(_useState5, 2),
116
- isOpen = _useState6[0],
117
- setIsOpen = _useState6[1];
116
+ inputFocused = _useState6[0],
117
+ setInputFocused = _useState6[1];
118
118
 
119
- var _useState7 = useState(open),
119
+ var _useState7 = useState(open || false),
120
120
  _useState8 = _slicedToArray(_useState7, 2),
121
- prevOpenProp = _useState8[0],
122
- setPrevOpenProp = _useState8[1];
121
+ isOpen = _useState8[0],
122
+ setIsOpen = _useState8[1];
123
123
 
124
- var _useState9 = useState([]),
124
+ var _useState9 = useState(open),
125
125
  _useState10 = _slicedToArray(_useState9, 2),
126
- topItems = _useState10[0],
127
- setTopItems = _useState10[1];
126
+ prevOpenProp = _useState10[0],
127
+ setPrevOpenProp = _useState10[1];
128
+
129
+ var _useState11 = useState([]),
130
+ _useState12 = _slicedToArray(_useState11, 2),
131
+ topItems = _useState12[0],
132
+ setTopItems = _useState12[1];
128
133
 
129
134
  var _useSelection = useSelection({
130
135
  disabled: disabled,
@@ -164,7 +169,14 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
164
169
  getItemProps = _useSelect.getItemProps,
165
170
  selectedItem = _useSelect.selectedItem;
166
171
 
167
- var toggleButtonProps = getToggleButtonProps();
172
+ var toggleButtonProps = getToggleButtonProps({
173
+ onFocus: function onFocus() {
174
+ setInputFocused(true);
175
+ },
176
+ onBlur: function onBlur() {
177
+ setInputFocused(false);
178
+ }
179
+ });
168
180
  var mergedRef = mergeRefs(toggleButtonProps.ref, ref);
169
181
  var selectedItems = selectedItem;
170
182
  /**
@@ -196,7 +208,7 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
196
208
  var helperId = !helperText ? undefined : "multiselect-helper-text-".concat(multiSelectInstanceId);
197
209
  var fieldLabelId = "multiselect-field-label-".concat(multiSelectInstanceId);
198
210
  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
211
+ 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
212
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
201
213
 
202
214
  var ItemToElement = itemToElement;
@@ -250,12 +262,20 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
250
262
  }
251
263
 
252
264
  var onKeyDown = function onKeyDown(e) {
253
- if (match(e, Delete) && !disabled) {
254
- clearSelection();
255
- e.stopPropagation();
265
+ if (!disabled) {
266
+ if (match(e, Delete) || match(e, Escape)) {
267
+ clearSelection();
268
+ e.stopPropagation();
269
+ }
270
+
271
+ if (match(e, Space) || match(e, ArrowDown)) {
272
+ setIsOpenWrapper(true);
273
+ }
256
274
  }
257
275
  };
258
276
 
277
+ var multiSelectFieldWrapperClasses = cx("".concat(prefix, "--list-box__field--wrapper"), _defineProperty({}, "".concat(prefix, "--list-box__field--wrapper--input-focused"), inputFocused));
278
+
259
279
  var handleFocus = function handleFocus(evt) {
260
280
  evt.target.classList.contains("".concat(prefix, "--tag__close-icon")) ? setIsFocused(false) : setIsFocused(evt.type === 'focus' ? true : false);
261
281
  };
@@ -301,6 +321,15 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
301
321
  className: "".concat(prefix, "--list-box__invalid-icon")
302
322
  }), showWarning && /*#__PURE__*/React__default.createElement(WarningAltFilled, {
303
323
  className: "".concat(prefix, "--list-box__invalid-icon ").concat(prefix, "--list-box__invalid-icon--warning")
324
+ }), /*#__PURE__*/React__default.createElement("div", {
325
+ className: multiSelectFieldWrapperClasses
326
+ }, selectedItems.length > 0 && /*#__PURE__*/React__default.createElement(ListBox.Selection, {
327
+ readOnly: readOnly,
328
+ clearSelection: !disabled && !readOnly ? clearSelection : noop,
329
+ selectionCount: selectedItems.length // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
330
+ ,
331
+ translateWithId: translateWithId,
332
+ disabled: disabled
304
333
  }), /*#__PURE__*/React__default.createElement("button", _extends({
305
334
  type: "button",
306
335
  className: "".concat(prefix, "--list-box__field"),
@@ -309,20 +338,13 @@ var MultiSelect = /*#__PURE__*/React__default.forwardRef(function MultiSelect(_r
309
338
  }, toggleButtonProps, {
310
339
  ref: mergedRef,
311
340
  onKeyDown: onKeyDown
312
- }, readOnlyEventHandlers), selectedItems.length > 0 && /*#__PURE__*/React__default.createElement(ListBox.Selection, {
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", {
341
+ }, readOnlyEventHandlers), /*#__PURE__*/React__default.createElement("span", {
320
342
  id: fieldLabelId,
321
343
  className: "".concat(prefix, "--list-box__label")
322
344
  }, label), /*#__PURE__*/React__default.createElement(ListBox.MenuIcon, {
323
- isOpen: !!isOpen,
345
+ isOpen: isOpen,
324
346
  translateWithId: translateWithId
325
- })), /*#__PURE__*/React__default.createElement(ListBox.Menu, _extends({
347
+ }))), /*#__PURE__*/React__default.createElement(ListBox.Menu, _extends({
326
348
  "aria-multiselectable": "true"
327
349
  }, getMenuProps()), isOpen && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
328
350
  sortItems(items, sortOptions).map(function (item, index) {
@@ -466,7 +488,7 @@ MultiSelect.propTypes = _objectSpread2(_objectSpread2({}, sortingPropTypes), {},
466
488
 
467
489
  /**
468
490
  * `onMenuChange` is a utility for this controlled component to communicate to a
469
- * consuming component that the menu was opend(`true`)/closed(`false`).
491
+ * consuming component that the menu was open(`true`)/closed(`false`).
470
492
  */
471
493
  onMenuChange: PropTypes.func,
472
494
 
@@ -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.ariaLabel,
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 role = _ref4.role,
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 children = _ref5.children,
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.ariaLabel,
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',