@carbon/react 1.40.0 → 1.41.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.
Files changed (242) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1428 -695
  2. package/es/components/Accordion/Accordion.Skeleton.d.ts +0 -5
  3. package/es/components/Accordion/Accordion.Skeleton.js +0 -5
  4. package/es/components/Breadcrumb/BreadcrumbItem.js +3 -1
  5. package/es/components/Checkbox/Checkbox.js +3 -6
  6. package/es/components/CodeSnippet/CodeSnippet.js +5 -12
  7. package/es/components/ComboBox/ComboBox.d.ts +1 -5
  8. package/es/components/ComboBox/ComboBox.js +6 -20
  9. package/es/components/ComposedModal/ComposedModal.js +1 -4
  10. package/es/components/ComposedModal/ModalFooter.js +4 -9
  11. package/es/components/ComposedModal/ModalHeader.js +1 -4
  12. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +3 -8
  13. package/es/components/ContentSwitcher/ContentSwitcher.js +7 -11
  14. package/es/components/Copy/Copy.js +4 -8
  15. package/es/components/CopyButton/CopyButton.js +8 -7
  16. package/es/components/DataTable/DataTable.d.ts +3 -39
  17. package/es/components/DataTable/DataTable.js +10 -18
  18. package/es/components/DataTable/Table.d.ts +0 -4
  19. package/es/components/DataTable/Table.js +0 -4
  20. package/es/components/DataTable/TableBatchAction.js +12 -5
  21. package/es/components/DataTable/TableBatchActions.js +1 -6
  22. package/es/components/DataTable/TableBody.d.ts +0 -3
  23. package/es/components/DataTable/TableBody.js +1 -3
  24. package/es/components/DataTable/TableHeader.js +3 -8
  25. package/es/components/DataTable/TableSelectAll.d.ts +0 -3
  26. package/es/components/DataTable/TableSelectAll.js +1 -4
  27. package/es/components/DataTable/TableToolbar.d.ts +10 -0
  28. package/es/components/DataTable/TableToolbar.js +15 -7
  29. package/es/components/DataTable/TableToolbarMenu.js +2 -6
  30. package/es/components/DataTable/TableToolbarSearch.d.ts +2 -8
  31. package/es/components/DataTable/TableToolbarSearch.js +6 -11
  32. package/es/components/DataTable/tools/sorting.js +2 -2
  33. package/es/components/DatePicker/DatePicker.d.ts +4 -4
  34. package/es/components/DatePicker/DatePicker.js +9 -4
  35. package/es/components/DatePicker/plugins/fixEventsPlugin.js +6 -0
  36. package/es/components/DatePickerInput/DatePickerInput.js +12 -6
  37. package/es/components/Dropdown/Dropdown.js +6 -15
  38. package/es/components/FileUploader/FileUploader.d.ts +2 -11
  39. package/es/components/FileUploader/FileUploader.js +15 -19
  40. package/es/components/FileUploader/FileUploaderButton.js +2 -2
  41. package/es/components/FileUploader/FileUploaderDropContainer.d.ts +0 -7
  42. package/es/components/FileUploader/FileUploaderDropContainer.js +2 -8
  43. package/es/components/FileUploader/FileUploaderItem.d.ts +0 -4
  44. package/es/components/FileUploader/FileUploaderItem.js +12 -9
  45. package/es/components/FileUploader/Filename.d.ts +6 -10
  46. package/es/components/FileUploader/Filename.js +7 -11
  47. package/es/components/FormGroup/FormGroup.d.ts +0 -5
  48. package/es/components/FormGroup/FormGroup.js +3 -8
  49. package/es/components/FormItem/FormItem.d.ts +32 -0
  50. package/es/components/FormItem/index.d.ts +9 -0
  51. package/es/components/FormLabel/FormLabel.js +4 -1
  52. package/es/components/ListBox/ListBox.js +4 -8
  53. package/es/components/ListBox/ListBoxMenuIcon.js +1 -4
  54. package/es/components/ListBox/ListBoxMenuItem.js +4 -8
  55. package/es/components/ListBox/ListBoxSelection.d.ts +5 -5
  56. package/es/components/ListBox/ListBoxSelection.js +12 -13
  57. package/es/components/ListBox/next/ListBoxSelection.js +12 -13
  58. package/es/components/ListBox/next/ListBoxTrigger.js +3 -5
  59. package/es/components/ListItem/ListItem.d.ts +1 -1
  60. package/es/components/ListItem/ListItem.js +6 -2
  61. package/es/components/Menu/MenuItem.js +4 -1
  62. package/es/components/Modal/Modal.js +16 -27
  63. package/es/components/ModalWrapper/ModalWrapper.js +13 -19
  64. package/es/components/MultiSelect/FilterableMultiSelect.js +14 -28
  65. package/es/components/MultiSelect/MultiSelect.js +17 -33
  66. package/es/components/MultiSelect/MultiSelectPropTypes.js +2 -2
  67. package/es/components/MultiSelect/tools/sorting.js +2 -2
  68. package/es/components/Notification/Notification.d.ts +11 -29
  69. package/es/components/Notification/Notification.js +38 -57
  70. package/es/components/NumberInput/NumberInput.js +6 -2
  71. package/es/components/OverflowMenu/OverflowMenu.js +27 -33
  72. package/es/components/OverflowMenuItem/OverflowMenuItem.js +4 -1
  73. package/es/components/Pagination/experimental/PageSelector.js +3 -8
  74. package/es/components/Pagination/experimental/Pagination.js +16 -34
  75. package/es/components/ProgressIndicator/ProgressIndicator.js +7 -6
  76. package/es/components/RadioTile/RadioTile.js +6 -7
  77. package/es/components/Search/Search.Skeleton.d.ts +0 -3
  78. package/es/components/Search/Search.Skeleton.js +1 -4
  79. package/es/components/Select/Select.d.ts +2 -2
  80. package/es/components/Select/Select.js +13 -16
  81. package/es/components/SelectItem/SelectItem.d.ts +0 -6
  82. package/es/components/SelectItem/SelectItem.js +4 -10
  83. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +0 -3
  84. package/es/components/SelectItemGroup/SelectItemGroup.js +1 -4
  85. package/es/components/SkeletonIcon/SkeletonIcon.d.ts +13 -0
  86. package/es/components/SkeletonIcon/SkeletonIcon.js +2 -3
  87. package/es/components/SkeletonText/SkeletonText.d.ts +0 -6
  88. package/es/components/SkeletonText/SkeletonText.js +0 -6
  89. package/es/components/Slider/Slider.Skeleton.d.ts +9 -1
  90. package/es/components/Slider/Slider.Skeleton.js +20 -4
  91. package/es/components/Slider/Slider.d.ts +137 -25
  92. package/es/components/Slider/Slider.js +779 -186
  93. package/es/components/StructuredList/StructuredList.js +5 -2
  94. package/es/components/Switch/Switch.js +3 -7
  95. package/es/components/Tabs/Tabs.js +5 -2
  96. package/es/components/Tag/Tag.js +4 -2
  97. package/es/components/Text/Text.js +1 -1
  98. package/es/components/Text/TextDirection.d.ts +1 -1
  99. package/es/components/TextArea/TextArea.js +30 -34
  100. package/es/components/TextInput/ControlledPasswordInput.js +12 -19
  101. package/es/components/TextInput/TextInput.js +8 -3
  102. package/es/components/Tile/Tile.js +4 -2
  103. package/es/components/TileGroup/TileGroup.js +5 -4
  104. package/es/components/Toggle/Toggle.js +4 -2
  105. package/es/components/UIShell/Content.js +1 -4
  106. package/es/components/UIShell/SideNav.d.ts +1 -1
  107. package/es/components/UIShell/SideNavDetails.d.ts +32 -0
  108. package/es/components/UIShell/SideNavDetails.js +1 -2
  109. package/es/components/UIShell/SideNavDivider.d.ts +15 -0
  110. package/es/components/UIShell/SideNavDivider.js +2 -2
  111. package/es/components/UIShell/SideNavFooter.js +2 -5
  112. package/es/components/UIShell/SideNavIcon.d.ts +25 -0
  113. package/es/components/UIShell/SideNavIcon.js +4 -7
  114. package/es/components/UIShell/SideNavSwitcher.d.ts +31 -0
  115. package/es/components/UIShell/SideNavSwitcher.js +6 -5
  116. package/es/index.js +1 -1
  117. package/es/internal/FloatingMenu.js +2 -7
  118. package/es/internal/Selection.js +0 -3
  119. package/es/internal/noopFn.d.ts +7 -0
  120. package/es/internal/noopFn.js +10 -0
  121. package/es/internal/useNormalizedInputProps.js +6 -2
  122. package/lib/components/Accordion/Accordion.Skeleton.d.ts +0 -5
  123. package/lib/components/Accordion/Accordion.Skeleton.js +0 -5
  124. package/lib/components/Breadcrumb/BreadcrumbItem.js +3 -1
  125. package/lib/components/Checkbox/Checkbox.js +3 -6
  126. package/lib/components/CodeSnippet/CodeSnippet.js +5 -12
  127. package/lib/components/ComboBox/ComboBox.d.ts +1 -5
  128. package/lib/components/ComboBox/ComboBox.js +5 -19
  129. package/lib/components/ComposedModal/ComposedModal.js +1 -4
  130. package/lib/components/ComposedModal/ModalFooter.js +4 -9
  131. package/lib/components/ComposedModal/ModalHeader.js +1 -4
  132. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +3 -8
  133. package/lib/components/ContentSwitcher/ContentSwitcher.js +7 -11
  134. package/lib/components/Copy/Copy.js +4 -8
  135. package/lib/components/CopyButton/CopyButton.js +8 -7
  136. package/lib/components/DataTable/DataTable.d.ts +3 -39
  137. package/lib/components/DataTable/DataTable.js +13 -21
  138. package/lib/components/DataTable/Table.d.ts +0 -4
  139. package/lib/components/DataTable/Table.js +0 -4
  140. package/lib/components/DataTable/TableBatchAction.js +12 -5
  141. package/lib/components/DataTable/TableBatchActions.js +1 -6
  142. package/lib/components/DataTable/TableBody.d.ts +0 -3
  143. package/lib/components/DataTable/TableBody.js +1 -3
  144. package/lib/components/DataTable/TableHeader.js +3 -8
  145. package/lib/components/DataTable/TableSelectAll.d.ts +0 -3
  146. package/lib/components/DataTable/TableSelectAll.js +1 -4
  147. package/lib/components/DataTable/TableToolbar.d.ts +10 -0
  148. package/lib/components/DataTable/TableToolbar.js +15 -7
  149. package/lib/components/DataTable/TableToolbarMenu.js +2 -6
  150. package/lib/components/DataTable/TableToolbarSearch.d.ts +2 -8
  151. package/lib/components/DataTable/TableToolbarSearch.js +6 -11
  152. package/lib/components/DataTable/tools/sorting.js +2 -2
  153. package/lib/components/DatePicker/DatePicker.d.ts +4 -4
  154. package/lib/components/DatePicker/DatePicker.js +9 -4
  155. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +6 -0
  156. package/lib/components/DatePickerInput/DatePickerInput.js +12 -6
  157. package/lib/components/Dropdown/Dropdown.js +6 -15
  158. package/lib/components/FileUploader/FileUploader.d.ts +2 -11
  159. package/lib/components/FileUploader/FileUploader.js +15 -19
  160. package/lib/components/FileUploader/FileUploaderButton.js +2 -2
  161. package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +0 -7
  162. package/lib/components/FileUploader/FileUploaderDropContainer.js +2 -8
  163. package/lib/components/FileUploader/FileUploaderItem.d.ts +0 -4
  164. package/lib/components/FileUploader/FileUploaderItem.js +12 -9
  165. package/lib/components/FileUploader/Filename.d.ts +6 -10
  166. package/lib/components/FileUploader/Filename.js +7 -11
  167. package/lib/components/FormGroup/FormGroup.d.ts +0 -5
  168. package/lib/components/FormGroup/FormGroup.js +3 -8
  169. package/lib/components/FormItem/FormItem.d.ts +32 -0
  170. package/lib/components/FormItem/index.d.ts +9 -0
  171. package/lib/components/FormLabel/FormLabel.js +4 -1
  172. package/lib/components/ListBox/ListBox.js +4 -8
  173. package/lib/components/ListBox/ListBoxMenuIcon.js +1 -4
  174. package/lib/components/ListBox/ListBoxMenuItem.js +4 -8
  175. package/lib/components/ListBox/ListBoxSelection.d.ts +5 -5
  176. package/lib/components/ListBox/ListBoxSelection.js +12 -13
  177. package/lib/components/ListBox/next/ListBoxSelection.js +12 -13
  178. package/lib/components/ListBox/next/ListBoxTrigger.js +3 -5
  179. package/lib/components/ListItem/ListItem.d.ts +1 -1
  180. package/lib/components/ListItem/ListItem.js +6 -2
  181. package/lib/components/Menu/MenuItem.js +4 -1
  182. package/lib/components/Modal/Modal.js +16 -27
  183. package/lib/components/ModalWrapper/ModalWrapper.js +13 -19
  184. package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -32
  185. package/lib/components/MultiSelect/MultiSelect.js +16 -32
  186. package/lib/components/MultiSelect/MultiSelectPropTypes.js +2 -2
  187. package/lib/components/MultiSelect/tools/sorting.js +2 -2
  188. package/lib/components/Notification/Notification.d.ts +11 -29
  189. package/lib/components/Notification/Notification.js +38 -57
  190. package/lib/components/NumberInput/NumberInput.js +6 -2
  191. package/lib/components/OverflowMenu/OverflowMenu.js +27 -33
  192. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -1
  193. package/lib/components/Pagination/experimental/PageSelector.js +3 -8
  194. package/lib/components/Pagination/experimental/Pagination.js +16 -34
  195. package/lib/components/ProgressIndicator/ProgressIndicator.js +7 -6
  196. package/lib/components/RadioTile/RadioTile.js +6 -7
  197. package/lib/components/Search/Search.Skeleton.d.ts +0 -3
  198. package/lib/components/Search/Search.Skeleton.js +1 -4
  199. package/lib/components/Select/Select.d.ts +2 -2
  200. package/lib/components/Select/Select.js +13 -16
  201. package/lib/components/SelectItem/SelectItem.d.ts +0 -6
  202. package/lib/components/SelectItem/SelectItem.js +4 -10
  203. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +0 -3
  204. package/lib/components/SelectItemGroup/SelectItemGroup.js +1 -4
  205. package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +13 -0
  206. package/lib/components/SkeletonIcon/SkeletonIcon.js +2 -3
  207. package/lib/components/SkeletonText/SkeletonText.d.ts +0 -6
  208. package/lib/components/SkeletonText/SkeletonText.js +0 -6
  209. package/lib/components/Slider/Slider.Skeleton.d.ts +9 -1
  210. package/lib/components/Slider/Slider.Skeleton.js +20 -4
  211. package/lib/components/Slider/Slider.d.ts +137 -25
  212. package/lib/components/Slider/Slider.js +778 -185
  213. package/lib/components/StructuredList/StructuredList.js +5 -2
  214. package/lib/components/Switch/Switch.js +3 -7
  215. package/lib/components/Tabs/Tabs.js +5 -2
  216. package/lib/components/Tag/Tag.js +4 -2
  217. package/lib/components/Text/Text.js +1 -1
  218. package/lib/components/Text/TextDirection.d.ts +1 -1
  219. package/lib/components/TextArea/TextArea.js +30 -34
  220. package/lib/components/TextInput/ControlledPasswordInput.js +12 -19
  221. package/lib/components/TextInput/TextInput.js +8 -3
  222. package/lib/components/Tile/Tile.js +4 -2
  223. package/lib/components/TileGroup/TileGroup.js +5 -4
  224. package/lib/components/Toggle/Toggle.js +4 -2
  225. package/lib/components/UIShell/Content.js +1 -4
  226. package/lib/components/UIShell/SideNav.d.ts +1 -1
  227. package/lib/components/UIShell/SideNavDetails.d.ts +32 -0
  228. package/lib/components/UIShell/SideNavDetails.js +1 -2
  229. package/lib/components/UIShell/SideNavDivider.d.ts +15 -0
  230. package/lib/components/UIShell/SideNavDivider.js +2 -2
  231. package/lib/components/UIShell/SideNavFooter.js +2 -5
  232. package/lib/components/UIShell/SideNavIcon.d.ts +25 -0
  233. package/lib/components/UIShell/SideNavIcon.js +4 -7
  234. package/lib/components/UIShell/SideNavSwitcher.d.ts +31 -0
  235. package/lib/components/UIShell/SideNavSwitcher.js +5 -4
  236. package/lib/index.js +2 -2
  237. package/lib/internal/FloatingMenu.js +2 -7
  238. package/lib/internal/Selection.js +0 -3
  239. package/lib/internal/noopFn.d.ts +7 -0
  240. package/lib/internal/noopFn.js +14 -0
  241. package/lib/internal/useNormalizedInputProps.js +6 -2
  242. package/package.json +9 -9
@@ -13,6 +13,7 @@ import Button from '../Button/Button.js';
13
13
  import '../Button/Button.Skeleton.js';
14
14
  import { ButtonKinds } from '../../prop-types/types.js';
15
15
  import { warning } from '../../internal/warning.js';
16
+ import { noopFn } from '../../internal/noopFn.js';
16
17
 
17
18
  let didWarnAboutDeprecation = false;
18
19
  class ModalWrapper extends React__default.Component {
@@ -57,19 +58,21 @@ class ModalWrapper extends React__default.Component {
57
58
  render() {
58
59
  const {
59
60
  children,
60
- onKeyDown,
61
+ onKeyDown = noopFn,
61
62
  buttonTriggerText,
62
63
  buttonTriggerClassName,
63
64
  renderTriggerButtonIcon,
64
- triggerButtonIconDescription,
65
- triggerButtonKind,
66
- disabled,
65
+ primaryButtonText = 'Save',
66
+ secondaryButtonText = 'Cancel',
67
+ triggerButtonIconDescription = 'Provide icon description if icon is used',
68
+ triggerButtonKind = 'primary',
69
+ disabled = false,
67
70
  handleSubmit,
68
71
  // eslint-disable-line no-unused-vars
69
- shouldCloseAfterSubmit,
72
+ shouldCloseAfterSubmit = true,
70
73
  // eslint-disable-line no-unused-vars
71
- selectorPrimaryFocus,
72
- preventCloseOnClickOutside,
74
+ selectorPrimaryFocus = '[data-modal-primary-focus]',
75
+ preventCloseOnClickOutside = false,
73
76
  // eslint-disable-line no-unused-vars
74
77
  ...other
75
78
  } = this.props;
@@ -97,7 +100,9 @@ class ModalWrapper extends React__default.Component {
97
100
  onClick: this.handleOpen,
98
101
  ref: this.triggerButton
99
102
  }, buttonTriggerText), /*#__PURE__*/React__default.createElement(Modal, _extends({
100
- ref: this.modal
103
+ ref: this.modal,
104
+ primaryButtonText: primaryButtonText,
105
+ secondaryButtonText: secondaryButtonText
101
106
  }, props), children));
102
107
  }
103
108
  }
@@ -126,16 +131,5 @@ _defineProperty(ModalWrapper, "propTypes", {
126
131
  triggerButtonKind: PropTypes.oneOf(ButtonKinds),
127
132
  withHeader: PropTypes.bool
128
133
  });
129
- _defineProperty(ModalWrapper, "defaultProps", {
130
- shouldCloseAfterSubmit: true,
131
- primaryButtonText: 'Save',
132
- secondaryButtonText: 'Cancel',
133
- triggerButtonIconDescription: 'Provide icon description if icon is used',
134
- triggerButtonKind: 'primary',
135
- disabled: false,
136
- preventCloseOnClickOutside: false,
137
- selectorPrimaryFocus: '[data-modal-primary-focus]',
138
- onKeyDown: () => {}
139
- });
140
134
 
141
135
  export { ModalWrapper as default };
@@ -33,35 +33,35 @@ import { Escape, Space, Enter, Delete, Tab, Home, End } from '../../internal/key
33
33
  const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function FilterableMultiSelect(_ref, ref) {
34
34
  let {
35
35
  className: containerClassName,
36
- clearSelectionDescription,
37
- clearSelectionText,
38
- compareItems,
39
- direction,
40
- disabled,
36
+ clearSelectionDescription = 'Total items selected: ',
37
+ clearSelectionText = 'To clear selection, press Delete or Backspace',
38
+ compareItems = defaultCompareItems,
39
+ direction = 'bottom',
40
+ disabled = false,
41
41
  downshiftProps,
42
- filterItems,
42
+ filterItems = defaultFilterItems,
43
43
  helperText,
44
44
  hideLabel,
45
45
  id,
46
- initialSelectedItems,
46
+ initialSelectedItems = [],
47
47
  invalid,
48
48
  invalidText,
49
49
  items,
50
50
  itemToElement: ItemToElement,
51
51
  // needs to be capitalized for react to render it correctly
52
- itemToString,
52
+ itemToString = defaultItemToString,
53
53
  light,
54
- locale,
54
+ locale = 'en',
55
55
  onInputValueChange,
56
- open,
56
+ open = false,
57
57
  onChange,
58
58
  onMenuChange,
59
59
  placeholder,
60
60
  titleText,
61
61
  type,
62
- selectionFeedback,
62
+ selectionFeedback = 'top-after-reopen',
63
63
  size,
64
- sortItems,
64
+ sortItems = defaultSortItems,
65
65
  translateWithId,
66
66
  useTitleInItem,
67
67
  warn,
@@ -297,10 +297,10 @@ const FilterableMultiSelect = /*#__PURE__*/React__default.forwardRef(function Fi
297
297
  if (match(event, Tab)) {
298
298
  handleOnMenuChange(false);
299
299
  }
300
- if (match(event, Home)) {
300
+ if (match(event, Home) && event.code !== 'Numpad7') {
301
301
  event.target.setSelectionRange(0, 0);
302
302
  }
303
- if (match(event, End)) {
303
+ if (match(event, End) && event.code !== 'Numpad1') {
304
304
  event.target.setSelectionRange(event.target.value.length, event.target.value.length);
305
305
  }
306
306
  },
@@ -552,20 +552,6 @@ FilterableMultiSelect.propTypes = {
552
552
  */
553
553
  warnText: PropTypes.node
554
554
  };
555
- FilterableMultiSelect.defaultProps = {
556
- compareItems: defaultCompareItems,
557
- direction: 'bottom',
558
- disabled: false,
559
- filterItems: defaultFilterItems,
560
- initialSelectedItems: [],
561
- itemToString: defaultItemToString,
562
- locale: 'en',
563
- sortItems: defaultSortItems,
564
- open: false,
565
- selectionFeedback: 'top-after-reopen',
566
- clearSelectionText: 'To clear selection, press Delete or Backspace,',
567
- clearSelectionDescription: 'Total items selected: '
568
- };
569
555
  var FilterableMultiSelect$1 = FilterableMultiSelect;
570
556
 
571
557
  export { FilterableMultiSelect$1 as default };
@@ -14,7 +14,7 @@ import PropTypes from 'prop-types';
14
14
  import React__default, { useContext, useRef, useState } from 'react';
15
15
  import ListBox from '../ListBox/index.js';
16
16
  import { sortingPropTypes } from './MultiSelectPropTypes.js';
17
- import { defaultCompareItems, defaultSortItems } from './tools/sorting.js';
17
+ import { defaultSortItems, defaultCompareItems } from './tools/sorting.js';
18
18
  import { useSelection } from '../../internal/Selection.js';
19
19
  import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
20
20
  import mergeRefs from '../../tools/mergeRefs.js';
@@ -22,11 +22,11 @@ import deprecate from '../../prop-types/deprecate.js';
22
22
  import { usePrefix } from '../../internal/usePrefix.js';
23
23
  import '../FluidForm/FluidForm.js';
24
24
  import { FormContext } from '../FluidForm/FormContext.js';
25
+ import { noopFn } from '../../internal/noopFn.js';
25
26
  import { match } from '../../internal/keyboard/match.js';
26
27
  import { ListBoxSize } from '../ListBox/ListBoxPropTypes.js';
27
28
  import { Delete, Escape, Space, ArrowDown, Enter } from '../../internal/keyboard/keys.js';
28
29
 
29
- const noop = () => {};
30
30
  const getInstanceId = setupGetInstanceId();
31
31
  const {
32
32
  ItemClick,
@@ -60,18 +60,18 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
60
60
  items,
61
61
  itemToElement,
62
62
  itemToString = defaultItemToString,
63
- titleText,
63
+ titleText = false,
64
64
  hideLabel,
65
65
  helperText,
66
66
  label,
67
- type,
67
+ type = 'default',
68
68
  size,
69
- disabled,
70
- initialSelectedItems,
71
- sortItems,
72
- compareItems,
73
- clearSelectionText,
74
- clearSelectionDescription,
69
+ disabled = false,
70
+ initialSelectedItems = [],
71
+ sortItems = defaultSortItems,
72
+ compareItems = defaultCompareItems,
73
+ clearSelectionText = 'To clear selection, press Delete or Backspace',
74
+ clearSelectionDescription = 'Total items selected: ',
75
75
  light,
76
76
  invalid,
77
77
  invalidText,
@@ -80,14 +80,14 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
80
80
  useTitleInItem,
81
81
  translateWithId,
82
82
  downshiftProps,
83
- open,
84
- selectionFeedback,
83
+ open = false,
84
+ selectionFeedback = 'top-after-reopen',
85
85
  onChange,
86
86
  onMenuChange,
87
- direction,
87
+ direction = 'bottom',
88
88
  selectedItems: selected,
89
89
  readOnly,
90
- locale
90
+ locale = 'en'
91
91
  } = _ref;
92
92
  const prefix = usePrefix();
93
93
  const {
@@ -321,7 +321,7 @@ const MultiSelect = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
321
321
  className: multiSelectFieldWrapperClasses
322
322
  }, selectedItems.length > 0 && /*#__PURE__*/React__default.createElement(ListBox.Selection, {
323
323
  readOnly: readOnly,
324
- clearSelection: !disabled && !readOnly ? clearSelection : noop,
324
+ clearSelection: !disabled && !readOnly ? clearSelection : noopFn,
325
325
  selectionCount: selectedItems.length
326
326
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
327
327
  ,
@@ -394,7 +394,7 @@ MultiSelect.propTypes = {
394
394
  * Provide a compare function that is used to determine the ordering of
395
395
  * options. See 'sortItems' for more control.
396
396
  */
397
- compareItems: PropTypes.func.isRequired,
397
+ compareItems: PropTypes.func,
398
398
  /**
399
399
  * Specify the direction of the multiselect dropdown. Can be either top or bottom.
400
400
  */
@@ -516,7 +516,7 @@ MultiSelect.propTypes = {
516
516
  * locale: string,
517
517
  * }) => Array<Item>
518
518
  */
519
- sortItems: PropTypes.func.isRequired,
519
+ sortItems: PropTypes.func,
520
520
  /**
521
521
  * Provide text to be used in a `<label>` element that is tied to the
522
522
  * multiselect via ARIA attributes.
@@ -543,22 +543,6 @@ MultiSelect.propTypes = {
543
543
  */
544
544
  warnText: PropTypes.node
545
545
  };
546
- MultiSelect.defaultProps = {
547
- compareItems: defaultCompareItems,
548
- disabled: false,
549
- locale: 'en',
550
- itemToString: defaultItemToString,
551
- initialSelectedItems: [],
552
- sortItems: defaultSortItems,
553
- type: 'default',
554
- titleText: false,
555
- open: false,
556
- selectionFeedback: 'top-after-reopen',
557
- direction: 'bottom',
558
- clearSelectionText: 'To clear selection, press Delete or Backspace,',
559
- clearSelectionDescription: 'Total items selected: ',
560
- selectedItems: undefined
561
- };
562
546
  var MultiSelect$1 = MultiSelect;
563
547
 
564
548
  export { MultiSelect$1 as default };
@@ -15,7 +15,7 @@ const sortingPropTypes = {
15
15
  * compareFunction :
16
16
  * (itemA: string, itemB: string, { locale: string }) => number
17
17
  */
18
- compareItems: PropTypes.func.isRequired,
18
+ compareItems: PropTypes.func,
19
19
  /**
20
20
  * Provide a method that sorts all options in the control. Overriding this
21
21
  * prop means that you also have to handle the sort logic for selected versus
@@ -34,7 +34,7 @@ const sortingPropTypes = {
34
34
  * locale: string,
35
35
  * }) => Array<Item>
36
36
  */
37
- sortItems: PropTypes.func.isRequired
37
+ sortItems: PropTypes.func
38
38
  };
39
39
 
40
40
  export { sortingPropTypes };
@@ -9,8 +9,8 @@
9
9
  * Use the local `localCompare` with the `numeric` option to sort two,
10
10
  * potentially alpha-numeric, strings in a list of items.
11
11
  *
12
- * @param {string} itemA
13
- * @param {string} itemB
12
+ * @param {ItemType} itemA
13
+ * @param {ItemType} itemB
14
14
  * @param {object} options
15
15
  * @param {string} options.locale
16
16
  * @returns {number}
@@ -51,6 +51,16 @@ export declare namespace NotificationActionButton {
51
51
  * ==================
52
52
  */
53
53
  export interface NotificationButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
54
+ /**
55
+ * Specify a label to be read by screen readers on the container node
56
+ * 'aria-label' of the NotificationButton component.
57
+ */
58
+ ['aria-label']?: string;
59
+ /**
60
+ * @deprecated please use `aria-label` instead.
61
+ * 'aria-label' of the NotificationButton component.
62
+ */
63
+ ariaLabel?: string;
54
64
  /**
55
65
  * Specify an optional icon for the Button through a string,
56
66
  * if provided. However, regular "close" icon is preferred.
@@ -107,12 +117,6 @@ export declare namespace NotificationButton {
107
117
  */
108
118
  type: PropTypes.Requireable<string>;
109
119
  };
110
- var defaultProps: {
111
- "aria-label": string;
112
- notificationType: string;
113
- type: string;
114
- renderIcon: any;
115
- };
116
120
  }
117
121
  export interface NotificationIconProps {
118
122
  iconDescription: string;
@@ -248,13 +252,6 @@ export declare namespace ToastNotification {
248
252
  */
249
253
  title: PropTypes.Requireable<string>;
250
254
  };
251
- var defaultProps: {
252
- kind: string;
253
- role: string;
254
- onCloseButtonClick: () => void;
255
- hideCloseButton: boolean;
256
- timeout: number;
257
- };
258
255
  }
259
256
  /**
260
257
  * InlineNotification
@@ -364,12 +361,6 @@ export declare namespace InlineNotification {
364
361
  */
365
362
  title: PropTypes.Requireable<string>;
366
363
  };
367
- var defaultProps: {
368
- kind: string;
369
- role: string;
370
- onCloseButtonClick: () => void;
371
- hideCloseButton: boolean;
372
- };
373
364
  }
374
365
  /**
375
366
  * ActionableNotification
@@ -484,7 +475,7 @@ export declare namespace ActionableNotification {
484
475
  /**
485
476
  * Specify what state the notification represents
486
477
  */
487
- kind: PropTypes.Validator<string>;
478
+ kind: PropTypes.Requireable<string>;
488
479
  /**
489
480
  * Specify whether you are using the low contrast variant of the ActionableNotification.
490
481
  */
@@ -519,13 +510,4 @@ export declare namespace ActionableNotification {
519
510
  */
520
511
  title: PropTypes.Requireable<string>;
521
512
  };
522
- var defaultProps: {
523
- kind: string;
524
- role: string;
525
- onCloseButtonClick: () => void;
526
- hideCloseButton: boolean;
527
- hasFocus: boolean;
528
- closeOnEscape: boolean;
529
- inline: boolean;
530
- };
531
513
  }
@@ -11,12 +11,15 @@ import React__default, { useState, useRef, useEffect } from 'react';
11
11
  import deprecate from '../../prop-types/deprecate.js';
12
12
  import cx from 'classnames';
13
13
  import { Close, ErrorFilled, CheckmarkFilled, WarningFilled, WarningAltFilled, InformationFilled, InformationSquareFilled } from '@carbon/icons-react';
14
+ import '../Text/index.js';
14
15
  import Button from '../Button/Button.js';
15
16
  import '../Button/Button.Skeleton.js';
16
17
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
17
18
  import { useNoInteractiveChildren } from '../../internal/useNoInteractiveChildren.js';
18
19
  import { usePrefix } from '../../internal/usePrefix.js';
19
20
  import { useId } from '../../internal/useId.js';
21
+ import { noopFn } from '../../internal/noopFn.js';
22
+ import { Text } from '../Text/Text.js';
20
23
  import { matches } from '../../internal/keyboard/match.js';
21
24
  import { Escape } from '../../internal/keyboard/keys.js';
22
25
 
@@ -85,14 +88,13 @@ NotificationActionButton.propTypes = {
85
88
 
86
89
  function NotificationButton(_ref2) {
87
90
  let {
88
- 'aria-label': ariaLabel,
89
- // @ts-expect-error: deprecated prop
91
+ 'aria-label': ariaLabel = 'close notification',
90
92
  ariaLabel: deprecatedAriaLabel,
91
93
  className,
92
- type,
93
- renderIcon: IconTag,
94
+ type = 'button',
95
+ renderIcon: IconTag = Close,
94
96
  name,
95
- notificationType,
97
+ notificationType = 'toast',
96
98
  ...rest
97
99
  } = _ref2;
98
100
  const prefix = usePrefix();
@@ -146,12 +148,6 @@ NotificationButton.propTypes = {
146
148
  */
147
149
  type: PropTypes.string
148
150
  };
149
- NotificationButton.defaultProps = {
150
- ['aria-label']: 'close notification',
151
- notificationType: 'toast',
152
- type: 'button',
153
- renderIcon: Close
154
- };
155
151
 
156
152
  /**
157
153
  * NotificationIcon
@@ -198,16 +194,16 @@ function ToastNotification(_ref4) {
198
194
  ['aria-label']: ariaLabel,
199
195
  // @ts-expect-error: deprecated prop
200
196
  ariaLabel: deprecatedAriaLabel,
201
- role,
197
+ role = 'status',
202
198
  onClose,
203
- onCloseButtonClick,
199
+ onCloseButtonClick = noopFn,
204
200
  statusIconDescription,
205
201
  className,
206
202
  children,
207
- kind,
203
+ kind = 'error',
208
204
  lowContrast,
209
- hideCloseButton,
210
- timeout,
205
+ hideCloseButton = false,
206
+ timeout = 0,
211
207
  title,
212
208
  caption,
213
209
  subtitle,
@@ -265,11 +261,14 @@ function ToastNotification(_ref4) {
265
261
  }), /*#__PURE__*/React__default.createElement("div", {
266
262
  ref: contentRef,
267
263
  className: `${prefix}--toast-notification__details`
268
- }, title && /*#__PURE__*/React__default.createElement("div", {
264
+ }, title && /*#__PURE__*/React__default.createElement(Text, {
265
+ as: "div",
269
266
  className: `${prefix}--toast-notification__title`
270
- }, title), subtitle && /*#__PURE__*/React__default.createElement("div", {
267
+ }, title), subtitle && /*#__PURE__*/React__default.createElement(Text, {
268
+ as: "div",
271
269
  className: `${prefix}--toast-notification__subtitle`
272
- }, subtitle), caption && /*#__PURE__*/React__default.createElement("div", {
270
+ }, subtitle), caption && /*#__PURE__*/React__default.createElement(Text, {
271
+ as: "div",
273
272
  className: `${prefix}--toast-notification__caption`
274
273
  }, caption), children), !hideCloseButton && /*#__PURE__*/React__default.createElement(NotificationButton, {
275
274
  notificationType: "toast",
@@ -343,13 +342,6 @@ ToastNotification.propTypes = {
343
342
  */
344
343
  title: PropTypes.string
345
344
  };
346
- ToastNotification.defaultProps = {
347
- kind: 'error',
348
- role: 'status',
349
- onCloseButtonClick: () => {},
350
- hideCloseButton: false,
351
- timeout: 0
352
- };
353
345
 
354
346
  /**
355
347
  * InlineNotification
@@ -362,14 +354,14 @@ function InlineNotification(_ref5) {
362
354
  children,
363
355
  title,
364
356
  subtitle,
365
- role,
357
+ role = 'status',
366
358
  onClose,
367
- onCloseButtonClick,
359
+ onCloseButtonClick = noopFn,
368
360
  statusIconDescription,
369
361
  className,
370
- kind,
362
+ kind = 'error',
371
363
  lowContrast,
372
- hideCloseButton,
364
+ hideCloseButton = false,
373
365
  ...rest
374
366
  } = _ref5;
375
367
  const [isOpen, setIsOpen] = useState(true);
@@ -409,9 +401,11 @@ function InlineNotification(_ref5) {
409
401
  }), /*#__PURE__*/React__default.createElement("div", {
410
402
  ref: contentRef,
411
403
  className: `${prefix}--inline-notification__text-wrapper`
412
- }, title && /*#__PURE__*/React__default.createElement("div", {
404
+ }, title && /*#__PURE__*/React__default.createElement(Text, {
405
+ as: "div",
413
406
  className: `${prefix}--inline-notification__title`
414
- }, title), subtitle && /*#__PURE__*/React__default.createElement("div", {
407
+ }, title), subtitle && /*#__PURE__*/React__default.createElement(Text, {
408
+ as: "div",
415
409
  className: `${prefix}--inline-notification__subtitle`
416
410
  }, subtitle), children)), !hideCloseButton && /*#__PURE__*/React__default.createElement(NotificationButton, {
417
411
  notificationType: "inline",
@@ -472,12 +466,6 @@ InlineNotification.propTypes = {
472
466
  */
473
467
  title: PropTypes.string
474
468
  };
475
- InlineNotification.defaultProps = {
476
- kind: 'error',
477
- role: 'status',
478
- onCloseButtonClick: () => {},
479
- hideCloseButton: false
480
- };
481
469
 
482
470
  /**
483
471
  * ActionableNotification
@@ -491,18 +479,18 @@ function ActionableNotification(_ref6) {
491
479
  // @ts-expect-error: deprecated prop
492
480
  ariaLabel: deprecatedAriaLabel,
493
481
  children,
494
- role,
482
+ role = 'alertdialog',
495
483
  onActionButtonClick,
496
484
  onClose,
497
- onCloseButtonClick,
485
+ onCloseButtonClick = noopFn,
498
486
  statusIconDescription,
499
487
  className,
500
- inline,
501
- kind,
488
+ inline = false,
489
+ kind = 'error',
502
490
  lowContrast,
503
- hideCloseButton,
504
- hasFocus,
505
- closeOnEscape,
491
+ hideCloseButton = false,
492
+ hasFocus = true,
493
+ closeOnEscape = true,
506
494
  title,
507
495
  subtitle,
508
496
  ...rest
@@ -552,10 +540,12 @@ function ActionableNotification(_ref6) {
552
540
  className: `${prefix}--actionable-notification__text-wrapper`
553
541
  }, /*#__PURE__*/React__default.createElement("div", {
554
542
  className: `${prefix}--actionable-notification__content`
555
- }, title && /*#__PURE__*/React__default.createElement("div", {
543
+ }, title && /*#__PURE__*/React__default.createElement(Text, {
544
+ as: "div",
556
545
  className: `${prefix}--actionable-notification__title`,
557
546
  id: id
558
- }, title), subtitle && /*#__PURE__*/React__default.createElement("div", {
547
+ }, title), subtitle && /*#__PURE__*/React__default.createElement(Text, {
548
+ as: "div",
559
549
  className: `${prefix}--actionable-notification__subtitle`,
560
550
  id: subtitleId
561
551
  }, subtitle), children))), actionButtonLabel && /*#__PURE__*/React__default.createElement(NotificationActionButton, {
@@ -608,7 +598,7 @@ ActionableNotification.propTypes = {
608
598
  /**
609
599
  * Specify what state the notification represents
610
600
  */
611
- kind: PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']).isRequired,
601
+ kind: PropTypes.oneOf(['error', 'info', 'info-square', 'success', 'warning', 'warning-alt']),
612
602
  /**
613
603
  * Specify whether you are using the low contrast variant of the ActionableNotification.
614
604
  */
@@ -643,14 +633,5 @@ ActionableNotification.propTypes = {
643
633
  */
644
634
  title: PropTypes.string
645
635
  };
646
- ActionableNotification.defaultProps = {
647
- kind: 'error',
648
- role: 'alertdialog',
649
- onCloseButtonClick: () => {},
650
- hideCloseButton: false,
651
- hasFocus: true,
652
- closeOnEscape: true,
653
- inline: false
654
- };
655
636
 
656
637
  export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, ToastNotification };
@@ -16,6 +16,8 @@ import { usePrefix } from '../../internal/usePrefix.js';
16
16
  import deprecate from '../../prop-types/deprecate.js';
17
17
  import '../FluidForm/FluidForm.js';
18
18
  import { FormContext } from '../FluidForm/FormContext.js';
19
+ import '../Text/index.js';
20
+ import { Text } from '../Text/Text.js';
19
21
 
20
22
  var _Subtract, _Add;
21
23
  const translationIds = {
@@ -371,7 +373,8 @@ function Label(_ref) {
371
373
  [`${prefix}--visually-hidden`]: hideLabel
372
374
  });
373
375
  if (label) {
374
- return /*#__PURE__*/React__default.createElement("label", {
376
+ return /*#__PURE__*/React__default.createElement(Text, {
377
+ as: "label",
375
378
  htmlFor: id,
376
379
  className: className
377
380
  }, label);
@@ -395,7 +398,8 @@ function HelperText(_ref2) {
395
398
  [`${prefix}--form__helper-text--disabled`]: disabled
396
399
  });
397
400
  if (description) {
398
- return /*#__PURE__*/React__default.createElement("div", {
401
+ return /*#__PURE__*/React__default.createElement(Text, {
402
+ as: "div",
399
403
  id: id,
400
404
  className: className
401
405
  }, description);