@carbon/react 1.40.0 → 1.41.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 (260) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1564 -872
  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 -5
  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 +4 -7
  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/TableExpandHeader.d.ts +1 -1
  25. package/es/components/DataTable/TableHeader.js +3 -8
  26. package/es/components/DataTable/TableSelectAll.d.ts +0 -3
  27. package/es/components/DataTable/TableSelectAll.js +1 -4
  28. package/es/components/DataTable/TableToolbar.d.ts +10 -0
  29. package/es/components/DataTable/TableToolbar.js +15 -7
  30. package/es/components/DataTable/TableToolbarMenu.js +2 -6
  31. package/es/components/DataTable/TableToolbarSearch.d.ts +2 -8
  32. package/es/components/DataTable/TableToolbarSearch.js +6 -11
  33. package/es/components/DataTable/tools/sorting.js +2 -2
  34. package/es/components/DatePicker/DatePicker.d.ts +4 -4
  35. package/es/components/DatePicker/DatePicker.js +9 -4
  36. package/es/components/DatePicker/plugins/fixEventsPlugin.js +6 -0
  37. package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  38. package/es/components/DatePickerInput/DatePickerInput.js +12 -6
  39. package/es/components/Dropdown/Dropdown.js +6 -15
  40. package/es/components/FileUploader/FileUploader.d.ts +2 -11
  41. package/es/components/FileUploader/FileUploader.js +15 -19
  42. package/es/components/FileUploader/FileUploaderButton.js +2 -2
  43. package/es/components/FileUploader/FileUploaderDropContainer.d.ts +0 -7
  44. package/es/components/FileUploader/FileUploaderDropContainer.js +2 -8
  45. package/es/components/FileUploader/FileUploaderItem.d.ts +0 -4
  46. package/es/components/FileUploader/FileUploaderItem.js +12 -9
  47. package/es/components/FileUploader/Filename.d.ts +6 -10
  48. package/es/components/FileUploader/Filename.js +7 -11
  49. package/es/components/FormGroup/FormGroup.d.ts +0 -5
  50. package/es/components/FormGroup/FormGroup.js +3 -8
  51. package/es/components/FormItem/FormItem.d.ts +32 -0
  52. package/es/components/FormItem/index.d.ts +9 -0
  53. package/es/components/FormLabel/FormLabel.js +4 -1
  54. package/es/components/ListBox/ListBox.js +4 -8
  55. package/es/components/ListBox/ListBoxMenuIcon.js +1 -4
  56. package/es/components/ListBox/ListBoxMenuItem.js +4 -8
  57. package/es/components/ListBox/ListBoxSelection.d.ts +5 -5
  58. package/es/components/ListBox/ListBoxSelection.js +12 -13
  59. package/es/components/ListBox/next/ListBoxSelection.js +12 -13
  60. package/es/components/ListBox/next/ListBoxTrigger.js +3 -5
  61. package/es/components/ListItem/ListItem.d.ts +1 -1
  62. package/es/components/ListItem/ListItem.js +6 -2
  63. package/es/components/Menu/MenuItem.js +4 -1
  64. package/es/components/Modal/Modal.d.ts +137 -0
  65. package/es/components/Modal/Modal.js +39 -45
  66. package/es/components/Modal/index.d.ts +9 -0
  67. package/es/components/ModalWrapper/ModalWrapper.js +13 -19
  68. package/es/components/MultiSelect/FilterableMultiSelect.js +14 -28
  69. package/es/components/MultiSelect/MultiSelect.js +17 -33
  70. package/es/components/MultiSelect/MultiSelectPropTypes.js +2 -2
  71. package/es/components/MultiSelect/tools/sorting.js +2 -2
  72. package/es/components/Notification/Notification.d.ts +11 -29
  73. package/es/components/Notification/Notification.js +38 -57
  74. package/es/components/NumberInput/NumberInput.js +6 -2
  75. package/es/components/OverflowMenu/OverflowMenu.js +27 -33
  76. package/es/components/OverflowMenuItem/OverflowMenuItem.js +4 -1
  77. package/es/components/Pagination/experimental/PageSelector.js +3 -8
  78. package/es/components/Pagination/experimental/Pagination.js +16 -34
  79. package/es/components/ProgressIndicator/ProgressIndicator.js +7 -6
  80. package/es/components/RadioTile/RadioTile.js +6 -7
  81. package/es/components/Search/Search.Skeleton.d.ts +0 -3
  82. package/es/components/Search/Search.Skeleton.js +1 -4
  83. package/es/components/Select/Select.d.ts +2 -2
  84. package/es/components/Select/Select.js +13 -16
  85. package/es/components/SelectItem/SelectItem.d.ts +0 -6
  86. package/es/components/SelectItem/SelectItem.js +4 -10
  87. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +0 -3
  88. package/es/components/SelectItemGroup/SelectItemGroup.js +1 -4
  89. package/es/components/SkeletonIcon/SkeletonIcon.d.ts +13 -0
  90. package/es/components/SkeletonIcon/SkeletonIcon.js +2 -3
  91. package/es/components/SkeletonText/SkeletonText.d.ts +0 -6
  92. package/es/components/SkeletonText/SkeletonText.js +0 -6
  93. package/es/components/Slider/Slider.Skeleton.d.ts +9 -1
  94. package/es/components/Slider/Slider.Skeleton.js +20 -4
  95. package/es/components/Slider/Slider.d.ts +137 -25
  96. package/es/components/Slider/Slider.js +779 -186
  97. package/es/components/StructuredList/StructuredList.js +5 -2
  98. package/es/components/Switch/Switch.js +3 -7
  99. package/es/components/Tabs/Tabs.js +5 -2
  100. package/es/components/Tag/Tag.js +4 -2
  101. package/es/components/Text/Text.js +1 -1
  102. package/es/components/Text/TextDirection.d.ts +1 -1
  103. package/es/components/TextArea/TextArea.js +30 -34
  104. package/es/components/TextInput/ControlledPasswordInput.js +12 -19
  105. package/es/components/TextInput/TextInput.js +8 -3
  106. package/es/components/Tile/Tile.js +5 -3
  107. package/es/components/TileGroup/TileGroup.js +5 -4
  108. package/es/components/Toggle/Toggle.js +4 -2
  109. package/es/components/Toggletip/index.d.ts +6 -1
  110. package/es/components/Toggletip/index.js +7 -1
  111. package/es/components/UIShell/Content.js +1 -4
  112. package/es/components/UIShell/SideNav.d.ts +1 -1
  113. package/es/components/UIShell/SideNavDetails.d.ts +32 -0
  114. package/es/components/UIShell/SideNavDetails.js +1 -2
  115. package/es/components/UIShell/SideNavDivider.d.ts +15 -0
  116. package/es/components/UIShell/SideNavDivider.js +2 -2
  117. package/es/components/UIShell/SideNavFooter.js +2 -5
  118. package/es/components/UIShell/SideNavIcon.d.ts +25 -0
  119. package/es/components/UIShell/SideNavIcon.js +4 -7
  120. package/es/components/UIShell/SideNavSwitcher.d.ts +31 -0
  121. package/es/components/UIShell/SideNavSwitcher.js +6 -5
  122. package/es/index.js +2 -2
  123. package/es/internal/FloatingMenu.js +2 -7
  124. package/es/internal/Selection.js +0 -3
  125. package/es/internal/noopFn.d.ts +7 -0
  126. package/es/internal/noopFn.js +10 -0
  127. package/es/internal/useNormalizedInputProps.js +6 -2
  128. package/es/internal/wrapFocus.js +5 -5
  129. package/es/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
  130. package/lib/components/Accordion/Accordion.Skeleton.d.ts +0 -5
  131. package/lib/components/Accordion/Accordion.Skeleton.js +0 -5
  132. package/lib/components/Breadcrumb/BreadcrumbItem.js +3 -1
  133. package/lib/components/Checkbox/Checkbox.js +3 -6
  134. package/lib/components/CodeSnippet/CodeSnippet.js +5 -12
  135. package/lib/components/ComboBox/ComboBox.d.ts +1 -5
  136. package/lib/components/ComboBox/ComboBox.js +5 -19
  137. package/lib/components/ComposedModal/ComposedModal.js +1 -5
  138. package/lib/components/ComposedModal/ModalFooter.js +4 -9
  139. package/lib/components/ComposedModal/ModalHeader.js +1 -4
  140. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +3 -8
  141. package/lib/components/ContentSwitcher/ContentSwitcher.js +7 -11
  142. package/lib/components/Copy/Copy.js +4 -8
  143. package/lib/components/CopyButton/CopyButton.js +8 -7
  144. package/lib/components/DataTable/DataTable.d.ts +3 -39
  145. package/lib/components/DataTable/DataTable.js +13 -21
  146. package/lib/components/DataTable/Table.d.ts +0 -4
  147. package/lib/components/DataTable/Table.js +3 -6
  148. package/lib/components/DataTable/TableBatchAction.js +12 -5
  149. package/lib/components/DataTable/TableBatchActions.js +1 -6
  150. package/lib/components/DataTable/TableBody.d.ts +0 -3
  151. package/lib/components/DataTable/TableBody.js +1 -3
  152. package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
  153. package/lib/components/DataTable/TableHeader.js +3 -8
  154. package/lib/components/DataTable/TableSelectAll.d.ts +0 -3
  155. package/lib/components/DataTable/TableSelectAll.js +1 -4
  156. package/lib/components/DataTable/TableToolbar.d.ts +10 -0
  157. package/lib/components/DataTable/TableToolbar.js +15 -7
  158. package/lib/components/DataTable/TableToolbarMenu.js +2 -6
  159. package/lib/components/DataTable/TableToolbarSearch.d.ts +2 -8
  160. package/lib/components/DataTable/TableToolbarSearch.js +6 -11
  161. package/lib/components/DataTable/tools/sorting.js +2 -2
  162. package/lib/components/DatePicker/DatePicker.d.ts +4 -4
  163. package/lib/components/DatePicker/DatePicker.js +9 -4
  164. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +6 -0
  165. package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  166. package/lib/components/DatePickerInput/DatePickerInput.js +12 -6
  167. package/lib/components/Dropdown/Dropdown.js +6 -15
  168. package/lib/components/FileUploader/FileUploader.d.ts +2 -11
  169. package/lib/components/FileUploader/FileUploader.js +15 -19
  170. package/lib/components/FileUploader/FileUploaderButton.js +2 -2
  171. package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +0 -7
  172. package/lib/components/FileUploader/FileUploaderDropContainer.js +2 -8
  173. package/lib/components/FileUploader/FileUploaderItem.d.ts +0 -4
  174. package/lib/components/FileUploader/FileUploaderItem.js +12 -9
  175. package/lib/components/FileUploader/Filename.d.ts +6 -10
  176. package/lib/components/FileUploader/Filename.js +7 -11
  177. package/lib/components/FormGroup/FormGroup.d.ts +0 -5
  178. package/lib/components/FormGroup/FormGroup.js +3 -8
  179. package/lib/components/FormItem/FormItem.d.ts +32 -0
  180. package/lib/components/FormItem/index.d.ts +9 -0
  181. package/lib/components/FormLabel/FormLabel.js +4 -1
  182. package/lib/components/ListBox/ListBox.js +4 -8
  183. package/lib/components/ListBox/ListBoxMenuIcon.js +1 -4
  184. package/lib/components/ListBox/ListBoxMenuItem.js +4 -8
  185. package/lib/components/ListBox/ListBoxSelection.d.ts +5 -5
  186. package/lib/components/ListBox/ListBoxSelection.js +12 -13
  187. package/lib/components/ListBox/next/ListBoxSelection.js +12 -13
  188. package/lib/components/ListBox/next/ListBoxTrigger.js +3 -5
  189. package/lib/components/ListItem/ListItem.d.ts +1 -1
  190. package/lib/components/ListItem/ListItem.js +6 -2
  191. package/lib/components/Menu/MenuItem.js +4 -1
  192. package/lib/components/Modal/Modal.d.ts +137 -0
  193. package/lib/components/Modal/Modal.js +40 -45
  194. package/lib/components/Modal/index.d.ts +9 -0
  195. package/lib/components/ModalWrapper/ModalWrapper.js +13 -19
  196. package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -32
  197. package/lib/components/MultiSelect/MultiSelect.js +16 -32
  198. package/lib/components/MultiSelect/MultiSelectPropTypes.js +2 -2
  199. package/lib/components/MultiSelect/tools/sorting.js +2 -2
  200. package/lib/components/Notification/Notification.d.ts +11 -29
  201. package/lib/components/Notification/Notification.js +38 -57
  202. package/lib/components/NumberInput/NumberInput.js +6 -2
  203. package/lib/components/OverflowMenu/OverflowMenu.js +27 -33
  204. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +4 -1
  205. package/lib/components/Pagination/experimental/PageSelector.js +3 -8
  206. package/lib/components/Pagination/experimental/Pagination.js +16 -34
  207. package/lib/components/ProgressIndicator/ProgressIndicator.js +7 -6
  208. package/lib/components/RadioTile/RadioTile.js +6 -7
  209. package/lib/components/Search/Search.Skeleton.d.ts +0 -3
  210. package/lib/components/Search/Search.Skeleton.js +1 -4
  211. package/lib/components/Select/Select.d.ts +2 -2
  212. package/lib/components/Select/Select.js +13 -16
  213. package/lib/components/SelectItem/SelectItem.d.ts +0 -6
  214. package/lib/components/SelectItem/SelectItem.js +4 -10
  215. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +0 -3
  216. package/lib/components/SelectItemGroup/SelectItemGroup.js +1 -4
  217. package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +13 -0
  218. package/lib/components/SkeletonIcon/SkeletonIcon.js +2 -3
  219. package/lib/components/SkeletonText/SkeletonText.d.ts +0 -6
  220. package/lib/components/SkeletonText/SkeletonText.js +0 -6
  221. package/lib/components/Slider/Slider.Skeleton.d.ts +9 -1
  222. package/lib/components/Slider/Slider.Skeleton.js +20 -4
  223. package/lib/components/Slider/Slider.d.ts +137 -25
  224. package/lib/components/Slider/Slider.js +778 -185
  225. package/lib/components/StructuredList/StructuredList.js +5 -2
  226. package/lib/components/Switch/Switch.js +3 -7
  227. package/lib/components/Tabs/Tabs.js +5 -2
  228. package/lib/components/Tag/Tag.js +4 -2
  229. package/lib/components/Text/Text.js +1 -1
  230. package/lib/components/Text/TextDirection.d.ts +1 -1
  231. package/lib/components/TextArea/TextArea.js +30 -34
  232. package/lib/components/TextInput/ControlledPasswordInput.js +12 -19
  233. package/lib/components/TextInput/TextInput.js +8 -3
  234. package/lib/components/Tile/Tile.js +5 -3
  235. package/lib/components/TileGroup/TileGroup.js +5 -4
  236. package/lib/components/Toggle/Toggle.js +4 -2
  237. package/lib/components/Toggletip/index.d.ts +6 -1
  238. package/lib/components/Toggletip/index.js +7 -1
  239. package/lib/components/UIShell/Content.js +1 -4
  240. package/lib/components/UIShell/SideNav.d.ts +1 -1
  241. package/lib/components/UIShell/SideNavDetails.d.ts +32 -0
  242. package/lib/components/UIShell/SideNavDetails.js +1 -2
  243. package/lib/components/UIShell/SideNavDivider.d.ts +15 -0
  244. package/lib/components/UIShell/SideNavDivider.js +2 -2
  245. package/lib/components/UIShell/SideNavFooter.js +2 -5
  246. package/lib/components/UIShell/SideNavIcon.d.ts +25 -0
  247. package/lib/components/UIShell/SideNavIcon.js +4 -7
  248. package/lib/components/UIShell/SideNavSwitcher.d.ts +31 -0
  249. package/lib/components/UIShell/SideNavSwitcher.js +5 -4
  250. package/lib/index.js +4 -4
  251. package/lib/internal/FloatingMenu.js +2 -7
  252. package/lib/internal/Selection.js +0 -3
  253. package/lib/internal/noopFn.d.ts +7 -0
  254. package/lib/internal/noopFn.js +14 -0
  255. package/lib/internal/useNormalizedInputProps.js +6 -2
  256. package/lib/internal/wrapFocus.js +5 -5
  257. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
  258. package/package.json +9 -9
  259. package/scss/components/slug/_index.scss +9 -0
  260. package/scss/components/slug/_slug.scss +9 -0
@@ -13,6 +13,7 @@ import uniqueId from '../../tools/uniqueId.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { composeEventHandlers } from '../../tools/events.js';
15
15
  import deprecate from '../../prop-types/deprecate.js';
16
+ import { noopFn } from '../../internal/noopFn.js';
16
17
  import { matches } from '../../internal/keyboard/match.js';
17
18
  import { Enter, Space } from '../../internal/keyboard/keys.js';
18
19
 
@@ -25,7 +26,7 @@ function FileUploaderDropContainer(_ref) {
25
26
  labelText = 'Add file',
26
27
  multiple = false,
27
28
  name,
28
- onAddFiles = () => {},
29
+ onAddFiles = noopFn,
29
30
  onClick,
30
31
  pattern = '.[0-9a-z]+$',
31
32
  // eslint-disable-next-line react/prop-types
@@ -199,12 +200,5 @@ FileUploaderDropContainer.propTypes = {
199
200
  */
200
201
  tabIndex: deprecate(PropTypes.number, 'The `tabIndex` prop for `FileUploaderButton` has ' + 'been deprecated since it now renders a button element by default.')
201
202
  };
202
- FileUploaderDropContainer.defaultProps = {
203
- labelText: 'Add file',
204
- multiple: false,
205
- onAddFiles: () => {},
206
- accept: [],
207
- pattern: '.[0-9a-z]+$'
208
- };
209
203
 
210
204
  export { FileUploaderDropContainer as default };
@@ -95,9 +95,5 @@ declare namespace FileUploaderItem {
95
95
  */
96
96
  uuid: PropTypes.Requireable<string>;
97
97
  };
98
- var defaultProps: {
99
- status: string;
100
- onDelete: () => void;
101
- };
102
98
  }
103
99
  export default FileUploaderItem;
@@ -12,8 +12,11 @@ import React__default, { useState, useRef, useLayoutEffect } from 'react';
12
12
  import Filename from './Filename.js';
13
13
  import uniqueId from '../../tools/uniqueId.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
15
+ import { noopFn } from '../../internal/noopFn.js';
16
+ import '../Text/index.js';
15
17
  import '../Tooltip/DefinitionTooltip.js';
16
18
  import { Tooltip } from '../Tooltip/Tooltip.js';
19
+ import { Text } from '../Text/Text.js';
17
20
  import { matches } from '../../internal/keyboard/match.js';
18
21
  import { Enter, Space } from '../../internal/keyboard/keys.js';
19
22
 
@@ -23,7 +26,7 @@ function FileUploaderItem(_ref) {
23
26
  name,
24
27
  status = 'uploading',
25
28
  iconDescription,
26
- onDelete = () => {},
29
+ onDelete = noopFn,
27
30
  invalid,
28
31
  errorSubject,
29
32
  errorBody,
@@ -60,11 +63,13 @@ function FileUploaderItem(_ref) {
60
63
  }, /*#__PURE__*/React__default.createElement("button", {
61
64
  className: `${prefix}--file-filename-button`,
62
65
  type: "button"
63
- }, /*#__PURE__*/React__default.createElement("p", {
66
+ }, /*#__PURE__*/React__default.createElement(Text, {
67
+ as: "p",
64
68
  title: name,
65
69
  className: `${prefix}--file-filename-button`,
66
70
  id: name
67
- }, name)))) : /*#__PURE__*/React__default.createElement("p", {
71
+ }, name)))) : /*#__PURE__*/React__default.createElement(Text, {
72
+ as: "p",
68
73
  title: name,
69
74
  className: `${prefix}--file-filename`,
70
75
  id: name
@@ -99,9 +104,11 @@ function FileUploaderItem(_ref) {
99
104
  className: `${prefix}--form-requirement`,
100
105
  role: "alert",
101
106
  id: `${name}-id-error`
102
- }, /*#__PURE__*/React__default.createElement("div", {
107
+ }, /*#__PURE__*/React__default.createElement(Text, {
108
+ as: "div",
103
109
  className: `${prefix}--form-requirement__title`
104
- }, errorSubject), errorBody && /*#__PURE__*/React__default.createElement("p", {
110
+ }, errorSubject), errorBody && /*#__PURE__*/React__default.createElement(Text, {
111
+ as: "p",
105
112
  className: `${prefix}--form-requirement__supplement`
106
113
  }, errorBody)));
107
114
  }
@@ -145,9 +152,5 @@ FileUploaderItem.propTypes = {
145
152
  */
146
153
  uuid: PropTypes.string
147
154
  };
148
- FileUploaderItem.defaultProps = {
149
- status: 'uploading',
150
- onDelete: () => {}
151
- };
152
155
 
153
156
  export { FileUploaderItem as default };
@@ -4,11 +4,12 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- /// <reference types="react" />
8
7
  import PropTypes from 'prop-types';
8
+ import React from 'react';
9
9
  import { ReactAttr } from '../../types/common';
10
10
  export type FilenameStatus = 'edit' | 'complete' | 'uploading';
11
- export interface FilenameProps extends Omit<ReactAttr<HTMLElement>, 'tabIndex'> {
11
+ type SVGAttr = React.SVGAttributes<React.ReactSVGElement>;
12
+ export interface FilenameProps extends Omit<ReactAttr & SVGAttr, 'tabIndex' | 'type'> {
12
13
  /**
13
14
  * Specify an id that describes the error to be read by screen readers when the filename is invalid
14
15
  */
@@ -32,9 +33,9 @@ export interface FilenameProps extends Omit<ReactAttr<HTMLElement>, 'tabIndex'>
32
33
  /**
33
34
  * Provide a custom tabIndex value for the `<Filename>`
34
35
  */
35
- tabIndex?: number | string;
36
+ tabIndex?: number;
36
37
  }
37
- declare function Filename({ iconDescription, status, invalid, name, ['aria-describedby']: ariaDescribedBy, ...rest }: FilenameProps): JSX.Element | null;
38
+ declare function Filename({ iconDescription, status, invalid, name, tabIndex, ['aria-describedby']: ariaDescribedBy, ...rest }: FilenameProps): JSX.Element | null;
38
39
  declare namespace Filename {
39
40
  var propTypes: {
40
41
  /**
@@ -60,12 +61,7 @@ declare namespace Filename {
60
61
  /**
61
62
  * Provide a custom tabIndex value for the `<Filename>`
62
63
  */
63
- tabIndex: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
64
- };
65
- var defaultProps: {
66
- iconDescription: string;
67
- status: string;
68
- tabIndex: string;
64
+ tabIndex: PropTypes.Requireable<number>;
69
65
  };
70
66
  }
71
67
  export default Filename;
@@ -15,10 +15,11 @@ import { usePrefix } from '../../internal/usePrefix.js';
15
15
  var _Close;
16
16
  function Filename(_ref) {
17
17
  let {
18
- iconDescription,
19
- status,
18
+ iconDescription = 'Uploading file',
19
+ status = 'uploading',
20
20
  invalid,
21
21
  name,
22
+ tabIndex = 0,
22
23
  ['aria-describedby']: ariaDescribedBy,
23
24
  ...rest
24
25
  } = _ref;
@@ -37,9 +38,9 @@ function Filename(_ref) {
37
38
  }), /*#__PURE__*/React__default.createElement("button", _extends({
38
39
  "aria-label": `${iconDescription} - ${name}`,
39
40
  className: `${prefix}--file-close`,
40
- type: "button"
41
+ type: "button",
42
+ tabIndex: tabIndex
41
43
  }, rest, {
42
- tabIndex: rest.tabIndex !== undefined ? parseInt(rest.tabIndex, 10) : undefined,
43
44
  "aria-describedby": invalid ? ariaDescribedBy : undefined
44
45
  }), _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))));
45
46
  case 'complete':
@@ -47,7 +48,7 @@ function Filename(_ref) {
47
48
  "aria-label": iconDescription,
48
49
  className: `${prefix}--file-complete`
49
50
  }, rest, {
50
- tabIndex: null
51
+ tabIndex: -1
51
52
  }), iconDescription && /*#__PURE__*/React__default.createElement("title", null, iconDescription));
52
53
  default:
53
54
  return null;
@@ -77,12 +78,7 @@ Filename.propTypes = {
77
78
  /**
78
79
  * Provide a custom tabIndex value for the `<Filename>`
79
80
  */
80
- tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
81
- };
82
- Filename.defaultProps = {
83
- iconDescription: 'Uploading file',
84
- status: 'uploading',
85
- tabIndex: '0'
81
+ tabIndex: PropTypes.number
86
82
  };
87
83
 
88
84
  export { Filename as default };
@@ -71,10 +71,5 @@ declare const FormGroup: {
71
71
  */
72
72
  messageText: PropTypes.Requireable<string>;
73
73
  };
74
- defaultProps: {
75
- invalid: boolean;
76
- message: boolean;
77
- messageText: string;
78
- };
79
74
  };
80
75
  export default FormGroup;
@@ -15,11 +15,11 @@ const FormGroup = _ref => {
15
15
  let {
16
16
  legendId,
17
17
  legendText,
18
- invalid,
18
+ invalid = false,
19
19
  children,
20
20
  className,
21
- message,
22
- messageText,
21
+ message = false,
22
+ messageText = '',
23
23
  ...rest
24
24
  } = _ref;
25
25
  const prefix = usePrefix();
@@ -68,10 +68,5 @@ FormGroup.propTypes = {
68
68
  */
69
69
  messageText: PropTypes.string
70
70
  };
71
- FormGroup.defaultProps = {
72
- invalid: false,
73
- message: false,
74
- messageText: ''
75
- };
76
71
 
77
72
  export { FormGroup as default };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ type FormItemProps = {
10
+ /**
11
+ * Provide content to be rendered in the form item
12
+ */
13
+ children?: React.ReactNode;
14
+ /**
15
+ * Provide a custom className to be applied to the containing node
16
+ */
17
+ className?: string;
18
+ };
19
+ declare function FormItem({ className, children, ...rest }: FormItemProps): JSX.Element;
20
+ declare namespace FormItem {
21
+ var propTypes: {
22
+ /**
23
+ * Provide content to be rendered in the form item
24
+ */
25
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
26
+ /**
27
+ * Provide a custom className to be applied to the containing node
28
+ */
29
+ className: PropTypes.Requireable<string>;
30
+ };
31
+ }
32
+ export default FormItem;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import FormItem from './FormItem';
8
+ export default FormItem;
9
+ export { FormItem };
@@ -10,6 +10,8 @@ import PropTypes from 'prop-types';
10
10
  import React__default from 'react';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
+ import '../Text/index.js';
14
+ import { Text } from '../Text/Text.js';
13
15
 
14
16
  function FormLabel(_ref) {
15
17
  let {
@@ -20,7 +22,8 @@ function FormLabel(_ref) {
20
22
  } = _ref;
21
23
  const prefix = usePrefix();
22
24
  const className = cx(`${prefix}--label`, `${prefix}--label--no-margin`, customClassName);
23
- return /*#__PURE__*/React__default.createElement("label", _extends({
25
+ return /*#__PURE__*/React__default.createElement(Text, _extends({
26
+ as: "label",
24
27
  htmlFor: id,
25
28
  className: className
26
29
  }, rest), children);
@@ -32,8 +32,8 @@ const ListBox = /*#__PURE__*/React__default.forwardRef(function ListBox(_ref, re
32
32
  let {
33
33
  children,
34
34
  className: containerClassName,
35
- disabled,
36
- type,
35
+ disabled = false,
36
+ type = 'default',
37
37
  size,
38
38
  invalid,
39
39
  invalidText,
@@ -88,7 +88,7 @@ ListBox.propTypes = {
88
88
  /**
89
89
  * Specify whether the ListBox is currently disabled
90
90
  */
91
- disabled: PropTypes.bool.isRequired,
91
+ disabled: PropTypes.bool,
92
92
  /**
93
93
  * Specify whether the control is currently invalid
94
94
  */
@@ -114,7 +114,7 @@ ListBox.propTypes = {
114
114
  * Specify the "type" of the ListBox. Currently supports either `default` or
115
115
  * `inline` as an option.
116
116
  */
117
- type: ListBoxType.isRequired,
117
+ type: ListBoxType,
118
118
  /**
119
119
  * Specify whether the control is currently in warning state
120
120
  */
@@ -124,9 +124,5 @@ ListBox.propTypes = {
124
124
  */
125
125
  warnText: PropTypes.node
126
126
  };
127
- ListBox.defaultProps = {
128
- disabled: false,
129
- type: 'default'
130
- };
131
127
 
132
128
  export { ListBox as default };
@@ -52,10 +52,7 @@ ListBoxMenuIcon.propTypes = {
52
52
  * icon. This function takes in an id defined in `translationIds` and should
53
53
  * return a string message for that given message id.
54
54
  */
55
- translateWithId: PropTypes.func.isRequired
56
- };
57
- ListBoxMenuIcon.defaultProps = {
58
- translateWithId: defaultTranslateWithId
55
+ translateWithId: PropTypes.func
59
56
  };
60
57
 
61
58
  export { ListBoxMenuIcon as default, translationIds };
@@ -31,8 +31,8 @@ function useIsTruncated(ref) {
31
31
  const ListBoxMenuItem = /*#__PURE__*/React__default.forwardRef(function ListBoxMenuItem(_ref, forwardedRef) {
32
32
  let {
33
33
  children,
34
- isActive,
35
- isHighlighted,
34
+ isActive = false,
35
+ isHighlighted = false,
36
36
  title,
37
37
  ...rest
38
38
  } = _ref;
@@ -65,19 +65,15 @@ ListBoxMenuItem.propTypes = {
65
65
  /**
66
66
  * Specify whether the current menu item is "active".
67
67
  */
68
- isActive: PropTypes.bool.isRequired,
68
+ isActive: PropTypes.bool,
69
69
  /**
70
70
  * Specify whether the current menu item is "highlighted".
71
71
  */
72
- isHighlighted: PropTypes.bool.isRequired,
72
+ isHighlighted: PropTypes.bool,
73
73
  /**
74
74
  * Provide an optional tooltip for the ListBoxMenuItem
75
75
  */
76
76
  title: PropTypes.string
77
77
  };
78
- ListBoxMenuItem.defaultProps = {
79
- isActive: false,
80
- isHighlighted: false
81
- };
82
78
 
83
79
  export { ListBoxMenuItem as default };
@@ -35,17 +35,17 @@ export interface ListBoxSelectionProps {
35
35
  * icon. This function takes in an id defined in `translationIds` and should
36
36
  * return a string message for that given message id.
37
37
  */
38
- translateWithId(messageId: string, args?: Record<string, unknown>): string;
38
+ translateWithId?(messageId: string, args?: Record<string, unknown>): string;
39
39
  }
40
40
  export type ListBoxSelectionComponent = React.FC<ListBoxSelectionProps>;
41
+ export declare const translationIds: {
42
+ 'clear.all': string;
43
+ 'clear.selection': string;
44
+ };
41
45
  /**
42
46
  * `ListBoxSelection` is used to provide controls for clearing a selection, in
43
47
  * addition to conditionally rendering a badge if the control has more than one
44
48
  * selection.
45
49
  */
46
50
  declare const ListBoxSelection: ListBoxSelectionComponent;
47
- export declare const translationIds: {
48
- 'clear.all': string;
49
- 'clear.selection': string;
50
- };
51
51
  export default ListBoxSelection;
@@ -12,6 +12,16 @@ import { Close } from '@carbon/icons-react';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
13
 
14
14
  var _Close, _Close2;
15
+ const translationIds = {
16
+ 'clear.all': 'clear.all',
17
+ 'clear.selection': 'clear.selection'
18
+ };
19
+ const defaultTranslations = {
20
+ [translationIds['clear.all']]: 'Clear all selected items',
21
+ [translationIds['clear.selection']]: 'Clear selected item'
22
+ };
23
+ const defaultTranslateWithId = id => defaultTranslations[id];
24
+
15
25
  /**
16
26
  * `ListBoxSelection` is used to provide controls for clearing a selection, in
17
27
  * addition to conditionally rendering a badge if the control has more than one
@@ -21,7 +31,7 @@ const ListBoxSelection = _ref => {
21
31
  let {
22
32
  clearSelection,
23
33
  selectionCount,
24
- translateWithId: t,
34
+ translateWithId: t = defaultTranslateWithId,
25
35
  disabled,
26
36
  onClearSelection,
27
37
  readOnly
@@ -69,14 +79,6 @@ const ListBoxSelection = _ref => {
69
79
  title: description
70
80
  }, selectionCount, _Close2 || (_Close2 = /*#__PURE__*/React__default.createElement(Close, null)));
71
81
  };
72
- const translationIds = {
73
- 'clear.all': 'clear.all',
74
- 'clear.selection': 'clear.selection'
75
- };
76
- const defaultTranslations = {
77
- [translationIds['clear.all']]: 'Clear all selected items',
78
- [translationIds['clear.selection']]: 'Clear selected item'
79
- };
80
82
  ListBoxSelection.propTypes = {
81
83
  /**
82
84
  * Specify a function to be invoked when a user interacts with the clear
@@ -106,10 +108,7 @@ ListBoxSelection.propTypes = {
106
108
  * icon. This function takes in an id defined in `translationIds` and should
107
109
  * return a string message for that given message id.
108
110
  */
109
- translateWithId: PropTypes.func.isRequired
110
- };
111
- ListBoxSelection.defaultProps = {
112
- translateWithId: id => defaultTranslations[id]
111
+ translateWithId: PropTypes.func
113
112
  };
114
113
 
115
114
  export { ListBoxSelection as default, translationIds };
@@ -19,11 +19,21 @@ var _Close, _Close2;
19
19
  * addition to conditionally rendering a badge if the control has more than one
20
20
  * selection.
21
21
  */
22
+
23
+ const translationIds = {
24
+ 'clear.all': 'clear.all',
25
+ 'clear.selection': 'clear.selection'
26
+ };
27
+ const defaultTranslations = {
28
+ [translationIds['clear.all']]: 'Clear all selected items',
29
+ [translationIds['clear.selection']]: 'Clear selected item'
30
+ };
31
+ const defaultTranslateWithId = id => defaultTranslations[id];
22
32
  function ListBoxSelection(_ref) {
23
33
  let {
24
34
  clearSelection,
25
35
  selectionCount,
26
- translateWithId: t,
36
+ translateWithId: t = defaultTranslateWithId,
27
37
  disabled,
28
38
  onClearSelection,
29
39
  ...rest
@@ -73,14 +83,6 @@ function ListBoxSelection(_ref) {
73
83
  type: "button"
74
84
  }), _Close2 || (_Close2 = /*#__PURE__*/React__default.createElement(Close, null)));
75
85
  }
76
- const translationIds = {
77
- 'clear.all': 'clear.all',
78
- 'clear.selection': 'clear.selection'
79
- };
80
- const defaultTranslations = {
81
- [translationIds['clear.all']]: 'Clear all selected items',
82
- [translationIds['clear.selection']]: 'Clear selected item'
83
- };
84
86
  ListBoxSelection.propTypes = {
85
87
  /**
86
88
  * Specify a function to be invoked when a user interacts with the clear
@@ -116,10 +118,7 @@ ListBoxSelection.propTypes = {
116
118
  * icon. This function takes in an id defined in `translationIds` and should
117
119
  * return a string message for that given message id.
118
120
  */
119
- translateWithId: PropTypes.func.isRequired
120
- };
121
- ListBoxSelection.defaultProps = {
122
- translateWithId: id => defaultTranslations[id]
121
+ translateWithId: PropTypes.func
123
122
  };
124
123
 
125
124
  export { ListBoxSelection as default, translationIds };
@@ -21,6 +21,7 @@ const defaultTranslations = {
21
21
  [translationIds['close.menu']]: 'Close',
22
22
  [translationIds['open.menu']]: 'Open'
23
23
  };
24
+ const defaultTranslateWithId = id => defaultTranslations[id];
24
25
 
25
26
  /**
26
27
  * `ListBoxTrigger` is used to orient the icon up or down depending on the
@@ -29,7 +30,7 @@ const defaultTranslations = {
29
30
  const ListBoxTrigger = _ref => {
30
31
  let {
31
32
  isOpen,
32
- translateWithId: t,
33
+ translateWithId: t = defaultTranslateWithId,
33
34
  ...rest
34
35
  } = _ref;
35
36
  const prefix = usePrefix();
@@ -57,10 +58,7 @@ ListBoxTrigger.propTypes = {
57
58
  * icon. This function takes in an id defined in `translationIds` and should
58
59
  * return a string message for that given message id.
59
60
  */
60
- translateWithId: PropTypes.func.isRequired
61
- };
62
- ListBoxTrigger.defaultProps = {
63
- translateWithId: id => defaultTranslations[id]
61
+ translateWithId: PropTypes.func
64
62
  };
65
63
  var ListBoxTrigger$1 = ListBoxTrigger;
66
64
 
@@ -7,7 +7,7 @@
7
7
  import PropTypes from 'prop-types';
8
8
  import { type ComponentProps } from 'react';
9
9
  type ListItemProps = ComponentProps<'li'>;
10
- declare function ListItem({ className, ...other }: ListItemProps): JSX.Element;
10
+ declare function ListItem({ className, children, ...other }: ListItemProps): JSX.Element;
11
11
  declare namespace ListItem {
12
12
  var propTypes: {
13
13
  /**
@@ -10,17 +10,21 @@ import PropTypes from 'prop-types';
10
10
  import React__default from 'react';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
13
+ import '../Text/index.js';
14
+ import { Text } from '../Text/Text.js';
13
15
 
14
16
  function ListItem(_ref) {
15
17
  let {
16
18
  className,
19
+ children,
17
20
  ...other
18
21
  } = _ref;
19
22
  const prefix = usePrefix();
20
23
  const classNames = cx(`${prefix}--list__item`, className);
21
- return /*#__PURE__*/React__default.createElement("li", _extends({
24
+ return /*#__PURE__*/React__default.createElement(Text, _extends({
25
+ as: "li",
22
26
  className: classNames
23
- }, other));
27
+ }, other), children);
24
28
  }
25
29
  ListItem.propTypes = {
26
30
  /**
@@ -15,7 +15,9 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
15
15
  import { usePrefix } from '../../internal/usePrefix.js';
16
16
  import { Menu } from './Menu.js';
17
17
  import { MenuContext } from './MenuContext.js';
18
+ import '../Text/index.js';
18
19
  import { useLayoutDirection } from '../LayoutDirection/useLayoutDirection.js';
20
+ import { Text } from '../Text/Text.js';
19
21
  import { match } from '../../internal/keyboard/match.js';
20
22
  import { ArrowRight, Enter, Space } from '../../internal/keyboard/keys.js';
21
23
 
@@ -156,7 +158,8 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef(function MenuItem(_ref,
156
158
  onKeyDown: handleKeyDown
157
159
  }), /*#__PURE__*/React__default.createElement("div", {
158
160
  className: `${prefix}--menu-item__icon`
159
- }, IconElement && /*#__PURE__*/React__default.createElement(IconElement, null)), /*#__PURE__*/React__default.createElement("div", {
161
+ }, IconElement && /*#__PURE__*/React__default.createElement(IconElement, null)), /*#__PURE__*/React__default.createElement(Text, {
162
+ as: "div",
160
163
  className: `${prefix}--menu-item__label`
161
164
  }, label), shortcut && !hasChildren && /*#__PURE__*/React__default.createElement("div", {
162
165
  className: `${prefix}--menu-item__shortcut`