@carbon/react 1.24.0 → 1.26.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/es/components/Button/Button.js +2 -2
  2. package/es/components/CodeSnippet/CodeSnippet.js +13 -115
  3. package/es/components/ComboBox/ComboBox.d.ts +6 -0
  4. package/es/components/ComboBox/ComboBox.js +19 -172
  5. package/es/components/ComboButton/index.js +164 -0
  6. package/es/components/ComposedModal/ComposedModal.js +1 -2
  7. package/es/components/DataTable/Table.d.ts +74 -0
  8. package/es/components/DataTable/Table.js +4 -2
  9. package/es/components/DataTable/TableCell.d.ts +10 -0
  10. package/es/components/DataTable/TableContext.d.ts +13 -0
  11. package/es/components/DataTable/TableContext.js +2 -2
  12. package/es/components/DataTable/TableExpandRow.d.ts +67 -0
  13. package/es/components/DataTable/TableExpandedRow.d.ts +32 -0
  14. package/es/components/DataTable/TableHead.d.ts +10 -0
  15. package/es/components/DataTable/TableHeader.d.ts +64 -0
  16. package/es/components/DataTable/TableHeader.js +23 -28
  17. package/es/components/DataTable/TableRow.d.ts +32 -0
  18. package/es/components/DataTable/TableSelectAll.js +1 -1
  19. package/es/components/DataTable/TableSelectRow.js +1 -3
  20. package/es/components/DataTable/TableToolbar.d.ts +19 -0
  21. package/es/components/DataTable/TableToolbar.js +1 -1
  22. package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
  23. package/es/components/DataTable/TableToolbarContent.d.ts +19 -0
  24. package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
  25. package/es/components/DataTable/TableToolbarMenu.js +3 -3
  26. package/es/components/DataTable/TableToolbarSearch.js +1 -0
  27. package/es/components/DataTable/tools/sorting.js +2 -1
  28. package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  29. package/es/components/Dropdown/Dropdown.d.ts +6 -0
  30. package/es/components/Dropdown/Dropdown.js +8 -145
  31. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -0
  32. package/es/components/FileUploader/FileUploader.js +1 -1
  33. package/es/components/FileUploader/FileUploaderButton.js +2 -0
  34. package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
  35. package/es/components/FileUploader/FileUploaderItem.js +2 -1
  36. package/es/components/FileUploader/Filename.js +8 -2
  37. package/es/components/FluidTextArea/FluidTextArea.js +12 -1
  38. package/es/components/IconButton/index.js +1 -0
  39. package/es/components/InlineCheckbox/InlineCheckbox.js +7 -53
  40. package/es/components/ListBox/ListBoxSelection.js +4 -23
  41. package/es/components/ListBox/next/ListBoxSelection.js +2 -23
  42. package/es/components/Menu/Menu.js +50 -29
  43. package/es/components/Menu/MenuItem.js +1 -0
  44. package/es/components/MenuButton/index.js +127 -0
  45. package/es/components/Modal/Modal.js +4 -3
  46. package/es/components/MultiSelect/FilterableMultiSelect.js +46 -144
  47. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  48. package/es/components/MultiSelect/MultiSelect.js +48 -28
  49. package/es/components/Notification/Notification.js +27 -264
  50. package/es/components/NumberInput/NumberInput.js +9 -1
  51. package/es/components/OverflowMenu/OverflowMenu.js +13 -139
  52. package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  53. package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  54. package/es/components/OverflowMenuV2/index.js +15 -51
  55. package/es/components/Popover/index.d.ts +5 -1
  56. package/es/components/Popover/index.js +37 -9
  57. package/es/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
  58. package/es/components/RadioButton/RadioButton.Skeleton.js +3 -3
  59. package/es/components/RadioButton/RadioButton.d.ts +64 -0
  60. package/es/components/RadioButton/RadioButton.js +19 -17
  61. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
  62. package/es/components/RadioButtonGroup/RadioButtonGroup.js +88 -26
  63. package/es/components/RadioTile/RadioTile.js +6 -6
  64. package/es/components/Search/Search.Skeleton.d.ts +36 -0
  65. package/es/components/Search/Search.js +3 -2
  66. package/es/components/Search/index.js +1 -0
  67. package/es/components/Select/Select.d.ts +89 -0
  68. package/es/components/SelectItem/SelectItem.d.ts +62 -0
  69. package/es/components/SelectItem/SelectItem.js +2 -4
  70. package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  71. package/es/components/SkeletonText/SkeletonText.js +1 -1
  72. package/es/components/StructuredList/StructuredList.js +11 -39
  73. package/es/components/Tabs/Tabs.js +29 -6
  74. package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  75. package/es/components/TextArea/TextArea.Skeleton.js +5 -5
  76. package/es/components/TextArea/TextArea.d.ts +9 -2
  77. package/es/components/TextArea/TextArea.js +31 -8
  78. package/es/components/TextArea/index.js +1 -0
  79. package/es/components/TextInput/TextInput.Skeleton.d.ts +33 -0
  80. package/es/components/TextInput/index.js +1 -0
  81. package/es/components/Tile/Tile.js +15 -8
  82. package/es/components/Toggle/Toggle.js +8 -19
  83. package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  84. package/es/components/Tooltip/DefinitionTooltip.js +2 -2
  85. package/es/components/Tooltip/Tooltip.d.ts +117 -0
  86. package/es/components/Tooltip/Tooltip.js +6 -4
  87. package/es/components/Tooltip/index.d.ts +9 -0
  88. package/es/components/UIShell/HeaderMenu.js +13 -4
  89. package/es/components/UIShell/HeaderMenuItem.js +17 -4
  90. package/es/index.d.ts +2 -0
  91. package/es/index.js +5 -3
  92. package/es/internal/ClickListener.js +1 -2
  93. package/es/internal/keyboard/match.js +1 -1
  94. package/es/internal/useAttachedMenu.js +85 -0
  95. package/es/internal/useDelayedState.d.ts +19 -0
  96. package/es/internal/useDelayedState.js +7 -3
  97. package/es/internal/useId.js +1 -1
  98. package/es/tools/wrapComponent.js +9 -0
  99. package/lib/components/Button/Button.js +2 -2
  100. package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
  101. package/lib/components/ComboBox/ComboBox.d.ts +6 -0
  102. package/lib/components/ComboBox/ComboBox.js +18 -171
  103. package/lib/components/ComboButton/index.js +174 -0
  104. package/lib/components/ComposedModal/ComposedModal.js +1 -2
  105. package/lib/components/DataTable/Table.d.ts +74 -0
  106. package/lib/components/DataTable/Table.js +4 -2
  107. package/lib/components/DataTable/TableCell.d.ts +10 -0
  108. package/lib/components/DataTable/TableContext.d.ts +13 -0
  109. package/lib/components/DataTable/TableContext.js +2 -2
  110. package/lib/components/DataTable/TableExpandRow.d.ts +67 -0
  111. package/lib/components/DataTable/TableExpandedRow.d.ts +32 -0
  112. package/lib/components/DataTable/TableHead.d.ts +10 -0
  113. package/lib/components/DataTable/TableHeader.d.ts +64 -0
  114. package/lib/components/DataTable/TableHeader.js +23 -28
  115. package/lib/components/DataTable/TableRow.d.ts +32 -0
  116. package/lib/components/DataTable/TableSelectAll.js +1 -1
  117. package/lib/components/DataTable/TableSelectRow.js +1 -3
  118. package/lib/components/DataTable/TableToolbar.d.ts +19 -0
  119. package/lib/components/DataTable/TableToolbar.js +1 -1
  120. package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
  121. package/lib/components/DataTable/TableToolbarContent.d.ts +19 -0
  122. package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
  123. package/lib/components/DataTable/TableToolbarMenu.js +3 -3
  124. package/lib/components/DataTable/TableToolbarSearch.js +1 -0
  125. package/lib/components/DataTable/tools/sorting.js +2 -1
  126. package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
  127. package/lib/components/Dropdown/Dropdown.d.ts +6 -0
  128. package/lib/components/Dropdown/Dropdown.js +7 -144
  129. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -0
  130. package/lib/components/FileUploader/FileUploader.js +1 -1
  131. package/lib/components/FileUploader/FileUploaderButton.js +2 -0
  132. package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
  133. package/lib/components/FileUploader/FileUploaderItem.js +2 -1
  134. package/lib/components/FileUploader/Filename.js +8 -2
  135. package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
  136. package/lib/components/IconButton/index.js +1 -0
  137. package/lib/components/InlineCheckbox/InlineCheckbox.js +7 -53
  138. package/lib/components/ListBox/ListBoxSelection.js +4 -23
  139. package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
  140. package/lib/components/Menu/Menu.js +50 -29
  141. package/lib/components/Menu/MenuItem.js +1 -0
  142. package/lib/components/MenuButton/index.js +137 -0
  143. package/lib/components/Modal/Modal.js +4 -3
  144. package/lib/components/MultiSelect/FilterableMultiSelect.js +43 -141
  145. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  146. package/lib/components/MultiSelect/MultiSelect.js +47 -27
  147. package/lib/components/Notification/Notification.js +27 -264
  148. package/lib/components/NumberInput/NumberInput.js +9 -1
  149. package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
  150. package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
  151. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
  152. package/lib/components/OverflowMenuV2/index.js +13 -49
  153. package/lib/components/Popover/index.d.ts +5 -1
  154. package/lib/components/Popover/index.js +37 -9
  155. package/lib/components/RadioButton/RadioButton.Skeleton.d.ts +25 -0
  156. package/lib/components/RadioButton/RadioButton.Skeleton.js +3 -3
  157. package/lib/components/RadioButton/RadioButton.d.ts +64 -0
  158. package/lib/components/RadioButton/RadioButton.js +18 -16
  159. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +80 -0
  160. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +86 -24
  161. package/lib/components/RadioTile/RadioTile.js +6 -6
  162. package/lib/components/Search/Search.Skeleton.d.ts +36 -0
  163. package/lib/components/Search/Search.js +3 -2
  164. package/lib/components/Search/index.js +2 -0
  165. package/lib/components/Select/Select.d.ts +89 -0
  166. package/lib/components/SelectItem/SelectItem.d.ts +62 -0
  167. package/lib/components/SelectItem/SelectItem.js +1 -3
  168. package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
  169. package/lib/components/SkeletonText/SkeletonText.js +1 -1
  170. package/lib/components/StructuredList/StructuredList.js +11 -39
  171. package/lib/components/Tabs/Tabs.js +29 -6
  172. package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
  173. package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
  174. package/lib/components/TextArea/TextArea.d.ts +9 -2
  175. package/lib/components/TextArea/TextArea.js +30 -7
  176. package/lib/components/TextArea/index.js +2 -0
  177. package/lib/components/TextInput/TextInput.Skeleton.d.ts +33 -0
  178. package/lib/components/TextInput/index.js +2 -0
  179. package/lib/components/Tile/Tile.js +15 -8
  180. package/lib/components/Toggle/Toggle.js +8 -19
  181. package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
  182. package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
  183. package/lib/components/Tooltip/Tooltip.d.ts +117 -0
  184. package/lib/components/Tooltip/Tooltip.js +6 -4
  185. package/lib/components/Tooltip/index.d.ts +9 -0
  186. package/lib/components/UIShell/HeaderMenu.js +13 -4
  187. package/lib/components/UIShell/HeaderMenuItem.js +17 -4
  188. package/lib/index.d.ts +2 -0
  189. package/lib/index.js +50 -46
  190. package/lib/internal/ClickListener.js +1 -2
  191. package/lib/internal/keyboard/match.js +1 -1
  192. package/lib/internal/useAttachedMenu.js +89 -0
  193. package/lib/internal/useDelayedState.d.ts +19 -0
  194. package/lib/internal/useDelayedState.js +7 -3
  195. package/lib/internal/useId.js +1 -1
  196. package/lib/tools/wrapComponent.js +9 -0
  197. package/package.json +3 -3
@@ -30,10 +30,12 @@ var Table = function Table(_ref) {
30
30
  children = _ref.children,
31
31
  useZebraStyles = _ref.useZebraStyles,
32
32
  size = _ref.size,
33
- isSortable = _ref.isSortable,
33
+ _ref$isSortable = _ref.isSortable,
34
+ isSortable = _ref$isSortable === void 0 ? false : _ref$isSortable,
34
35
  useStaticWidth = _ref.useStaticWidth,
35
36
  stickyHeader = _ref.stickyHeader,
36
- overflowMenuOnHover = _ref.overflowMenuOnHover,
37
+ _ref$overflowMenuOnHo = _ref.overflowMenuOnHover,
38
+ overflowMenuOnHover = _ref$overflowMenuOnHo === void 0 ? true : _ref$overflowMenuOnHo,
37
39
  other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
38
40
 
39
41
  var _useContext = React.useContext(TableContext.TableContext),
@@ -0,0 +1,10 @@
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 { TdHTMLAttributes } from 'react';
8
+ export type TableCellProps = TdHTMLAttributes<HTMLTableCellElement>;
9
+ declare const TableCell: React.FC<TableCellProps>;
10
+ export default TableCell;
@@ -0,0 +1,13 @@
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
+ /// <reference types="react" />
8
+ interface TableContextType {
9
+ titleId?: string;
10
+ descriptionId?: string;
11
+ }
12
+ export declare const TableContext: import("react").Context<TableContextType>;
13
+ export {};
@@ -12,8 +12,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var React = require('react');
13
13
 
14
14
  var TableContext = /*#__PURE__*/React.createContext({
15
- titleId: null,
16
- descriptionId: null
15
+ titleId: undefined,
16
+ descriptionId: undefined
17
17
  });
18
18
 
19
19
  exports.TableContext = TableContext;
@@ -0,0 +1,67 @@
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 { MouseEventHandler, PropsWithChildren } from 'react';
9
+ import { TableRowProps } from './TableRow';
10
+ interface TableExpandRowProps extends PropsWithChildren<TableRowProps> {
11
+ /**
12
+ * Specify the string read by a voice reader when the expand trigger is
13
+ * focused
14
+ */
15
+ ariaLabel: string;
16
+ /**
17
+ * The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
18
+ */
19
+ expandHeader?: string;
20
+ /**
21
+ * The description of the chevron right icon, to be put in its SVG `<title>` element.
22
+ */
23
+ expandIconDescription?: string;
24
+ /**
25
+ * Specify whether this row is expanded or not. This helps coordinate data
26
+ * attributes so that `TableExpandRow` and `TableExpandedRow` work together
27
+ */
28
+ isExpanded: boolean;
29
+ /**
30
+ * Hook for when a listener initiates a request to expand the given row
31
+ */
32
+ onExpand: MouseEventHandler<HTMLButtonElement>;
33
+ }
34
+ declare const TableExpandRow: {
35
+ ({ ariaLabel, className: rowClassName, children, isExpanded, onExpand, expandIconDescription, isSelected, expandHeader, ...rest }: TableExpandRowProps): JSX.Element;
36
+ propTypes: {
37
+ /**
38
+ * Specify the string read by a voice reader when the expand trigger is
39
+ * focused
40
+ */
41
+ ariaLabel: PropTypes.Validator<string>;
42
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
43
+ className: PropTypes.Requireable<string>;
44
+ /**
45
+ * The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
46
+ */
47
+ expandHeader: PropTypes.Requireable<string>;
48
+ /**
49
+ * The description of the chevron right icon, to be put in its SVG `<title>` element.
50
+ */
51
+ expandIconDescription: PropTypes.Requireable<string>;
52
+ /**
53
+ * Specify whether this row is expanded or not. This helps coordinate data
54
+ * attributes so that `TableExpandRow` and `TableExpandedRow` work together
55
+ */
56
+ isExpanded: PropTypes.Validator<boolean>;
57
+ /**
58
+ * Specify if the row is selected
59
+ */
60
+ isSelected: PropTypes.Requireable<boolean>;
61
+ /**
62
+ * Hook for when a listener initiates a request to expand the given row
63
+ */
64
+ onExpand: PropTypes.Validator<(...args: any[]) => any>;
65
+ };
66
+ };
67
+ export default TableExpandRow;
@@ -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 { ReactAttr } from '../../types/common';
9
+ interface TableExpandedRowProps extends ReactAttr<HTMLTableRowElement> {
10
+ /**
11
+ * The width of the expanded row's internal cell
12
+ */
13
+ colSpan: number;
14
+ }
15
+ declare const TableExpandedRow: {
16
+ ({ className: customClassName, children, colSpan, ...rest }: TableExpandedRowProps): JSX.Element;
17
+ propTypes: {
18
+ /**
19
+ * Pass in the contents for your TableExpandedRow
20
+ */
21
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
22
+ /**
23
+ * Specify an optional className to be applied to the container node
24
+ */
25
+ className: PropTypes.Requireable<string>;
26
+ /**
27
+ * The width of the expanded row's internal cell
28
+ */
29
+ colSpan: PropTypes.Validator<number>;
30
+ };
31
+ };
32
+ export default TableExpandedRow;
@@ -0,0 +1,10 @@
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 React, { ThHTMLAttributes } from 'react';
8
+ export type TableHeadProps = ThHTMLAttributes<HTMLTableSectionElement>;
9
+ declare const TableHead: React.FC<TableHeadProps>;
10
+ export default TableHead;
@@ -0,0 +1,64 @@
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 React, { MouseEventHandler } from 'react';
8
+ import { ReactAttr } from '../../types/common';
9
+ interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonElement> {
10
+ /**
11
+ * Pass in children that will be embedded in the table header label
12
+ */
13
+ children?: React.ReactNode;
14
+ /**
15
+ * Specify an optional className to be applied to the container node
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Specify `colSpan` as a non-negative integer value to indicate how
20
+ * many columns the TableHeader cell extends in a table
21
+ */
22
+ colSpan?: number;
23
+ /**
24
+ * Supply an id to the th element.
25
+ */
26
+ id?: string;
27
+ /**
28
+ * Specify whether this header is the header by which a table is being sorted
29
+ * by
30
+ */
31
+ isSortHeader?: boolean;
32
+ /**
33
+ * Specify whether this header is one through which a user can sort the table
34
+ */
35
+ isSortable?: boolean;
36
+ /**
37
+ * Hook that is invoked when the header is clicked
38
+ */
39
+ onClick?: MouseEventHandler<HTMLButtonElement>;
40
+ /**
41
+ * Specify the scope of this table header. You can find more info about this
42
+ * attribute at the following URL:
43
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
44
+ */
45
+ scope: string;
46
+ /**
47
+ * Specify which direction we are currently sorting by, should be one of DESC,
48
+ * NONE, or ASC.
49
+ */
50
+ sortDirection?: string;
51
+ /**
52
+ * Supply a method to translate internal strings with your i18n tool of
53
+ * choice. Translation keys are available on the `translationKeys` field for
54
+ * this component.
55
+ */
56
+ translateWithId?: (key: string, { header, sortDirection, isSortHeader, sortStates }: {
57
+ header: any;
58
+ sortDirection: any;
59
+ isSortHeader: any;
60
+ sortStates: any;
61
+ }) => string;
62
+ }
63
+ declare const TableHeader: React.ForwardRefExoticComponent<TableHeaderProps & React.RefAttributes<HTMLTableCellElement>>;
64
+ export default TableHeader;
@@ -32,48 +32,43 @@ var translationKeys = {
32
32
  buttonDescription: 'carbon.table.header.icon.description'
33
33
  };
34
34
 
35
- var translateWithId = function translateWithId(key, _ref) {
36
- var header = _ref.header,
37
- sortDirection = _ref.sortDirection,
38
- isSortHeader = _ref.isSortHeader,
39
- sortStates = _ref.sortStates;
40
-
41
- if (key === translationKeys.buttonDescription) {
42
- if (isSortHeader) {
35
+ var translateWithId = function translateWithId(key, args) {
36
+ if (args && key === translationKeys.buttonDescription) {
37
+ if (args.isSortHeader && sortStates.sortStates) {
43
38
  // When transitioning, we know that the sequence of states is as follows:
44
39
  // NONE -> ASC -> DESC -> NONE
45
- if (sortDirection === sortStates.NONE) {
46
- return "Click to sort rows by ".concat(header, " header in ascending order");
40
+ if (args.sortDirection === sortStates.sortStates.NONE) {
41
+ return "Click to sort rows by ".concat(args.header, " header in ascending order");
47
42
  }
48
43
 
49
- if (sortDirection === sortStates.ASC) {
50
- return "Click to sort rows by ".concat(header, " header in descending order");
44
+ if (args.sortDirection === sortStates.sortStates.ASC) {
45
+ return "Click to sort rows by ".concat(args.header, " header in descending order");
51
46
  }
52
47
 
53
- return "Click to unsort rows by ".concat(header, " header");
48
+ return "Click to unsort rows by ".concat(args.header, " header");
54
49
  }
55
50
 
56
- return "Click to sort rows by ".concat(header, " header in ascending order");
51
+ return "Click to sort rows by ".concat(args.header, " header in ascending order");
57
52
  }
58
53
 
59
54
  return '';
60
55
  };
61
56
 
62
57
  var sortDirections = (_sortDirections = {}, _rollupPluginBabelHelpers.defineProperty(_sortDirections, sortStates.sortStates.NONE, 'none'), _rollupPluginBabelHelpers.defineProperty(_sortDirections, sortStates.sortStates.ASC, 'ascending'), _rollupPluginBabelHelpers.defineProperty(_sortDirections, sortStates.sortStates.DESC, 'descending'), _sortDirections);
63
- var TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function TableHeader(_ref2, ref) {
58
+ var TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function TableHeader(_ref, ref) {
64
59
  var _cx;
65
60
 
66
- var headerClassName = _ref2.className,
67
- children = _ref2.children,
68
- colSpan = _ref2.colSpan,
69
- isSortable = _ref2.isSortable,
70
- isSortHeader = _ref2.isSortHeader,
71
- onClick = _ref2.onClick,
72
- scope = _ref2.scope,
73
- sortDirection = _ref2.sortDirection,
74
- t = _ref2.translateWithId,
75
- id = _ref2.id,
76
- rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref2, _excluded);
61
+ var headerClassName = _ref.className,
62
+ children = _ref.children,
63
+ colSpan = _ref.colSpan,
64
+ isSortable = _ref.isSortable,
65
+ isSortHeader = _ref.isSortHeader,
66
+ onClick = _ref.onClick,
67
+ scope = _ref.scope,
68
+ sortDirection = _ref.sortDirection,
69
+ t = _ref.translateWithId,
70
+ id = _ref.id,
71
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
77
72
 
78
73
  var prefix = usePrefix.usePrefix();
79
74
  var uniqueId = useId.useId('table-sort');
@@ -91,8 +86,8 @@ var TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function Tab
91
86
  }
92
87
 
93
88
  var className = cx__default["default"](headerClassName, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort--active"), isSortHeader && sortDirection !== sortStates.sortStates.NONE), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--table-sort--descending"), isSortHeader && sortDirection === sortStates.sortStates.DESC), _cx));
94
- var ariaSort = !isSortHeader ? 'none' : sortDirections[sortDirection];
95
- var sortDescription = t('carbon.table.header.icon.description', {
89
+ var ariaSort = !isSortHeader || !sortDirection ? 'none' : sortDirections[sortDirection];
90
+ var sortDescription = t && t('carbon.table.header.icon.description', {
96
91
  header: children,
97
92
  sortDirection: sortDirection,
98
93
  isSortHeader: isSortHeader,
@@ -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 { ReactAttr } from '../../types/common';
9
+ export interface TableRowProps extends ReactAttr<HTMLTableRowElement> {
10
+ /**
11
+ * Specify an optional className to be applied to the container node
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Specify if the row is selected
16
+ */
17
+ isSelected?: boolean;
18
+ }
19
+ declare const TableRow: {
20
+ (props: TableRowProps): JSX.Element;
21
+ propTypes: {
22
+ /**
23
+ * Specify an optional className to be applied to the container node
24
+ */
25
+ className: PropTypes.Requireable<string>;
26
+ /**
27
+ * Specify if the row is selected
28
+ */
29
+ isSelected: PropTypes.Requireable<boolean>;
30
+ };
31
+ };
32
+ export default TableRow;
@@ -35,7 +35,7 @@ var TableSelectAll = function TableSelectAll(_ref) {
35
35
  scope: "col",
36
36
  className: cx__default["default"]("".concat(prefix, "--table-column-checkbox"), className)
37
37
  }, /*#__PURE__*/React__default["default"].createElement(InlineCheckbox["default"], {
38
- ariaLabel: ariaLabel,
38
+ "aria-label": ariaLabel,
39
39
  checked: checked,
40
40
  id: id,
41
41
  indeterminate: indeterminate,
@@ -49,9 +49,7 @@ var TableSelectRow = function TableSelectRow(_ref) {
49
49
  }, /*#__PURE__*/React__default["default"].createElement(InlineInputComponent, _rollupPluginBabelHelpers["extends"]({}, selectionInputProps, radio && {
50
50
  labelText: ariaLabel,
51
51
  hideLabel: true
52
- }, !radio && {
53
- ariaLabel: ariaLabel
54
- })));
52
+ }, !radio && _rollupPluginBabelHelpers.defineProperty({}, 'aria-label', ariaLabel))));
55
53
  };
56
54
 
57
55
  TableSelectRow.propTypes = {
@@ -0,0 +1,19 @@
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 React from 'react';
8
+ export interface TableToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ /**
10
+ * Pass in the children that will be rendered inside the TableToolbar
11
+ */
12
+ children: React.ReactNode;
13
+ /**
14
+ * `lg` Change the row height of table
15
+ */
16
+ size?: 'sm' | 'lg';
17
+ }
18
+ declare const TableToolbar: React.FC<TableToolbarProps>;
19
+ export default TableToolbar;
@@ -13,8 +13,8 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
13
13
  var cx = require('classnames');
14
14
  var PropTypes = require('prop-types');
15
15
  var React = require('react');
16
- var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
17
16
  var usePrefix = require('../../internal/usePrefix.js');
17
+ var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
18
18
 
19
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
20
 
@@ -0,0 +1,21 @@
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 React from 'react';
8
+ import { ForwardRefReturn } from '../../types/common';
9
+ export interface TableToolbarActionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {
10
+ /**
11
+ * Pass in the children that will be rendered inside the TableToolbarAction
12
+ */
13
+ children?: React.ReactNode;
14
+ /**
15
+ * onClick handler for the TableToolbarAction
16
+ */
17
+ onClick: (event: React.MouseEvent<HTMLDivElement>) => void;
18
+ }
19
+ export type TableToolbarActionComponent = ForwardRefReturn<HTMLDivElement, TableToolbarActionProps>;
20
+ declare const TableToolbarAction: TableToolbarActionComponent;
21
+ export default TableToolbarAction;
@@ -0,0 +1,19 @@
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
+ declare const TableToolbarContent: {
8
+ ({ className: baseClassName, ...other }: {
9
+ [x: string]: any;
10
+ className?: string | undefined;
11
+ }): import("react").ReactElement<{
12
+ className: string | undefined;
13
+ }, string | import("react").JSXElementConstructor<any>>;
14
+ displayName: string;
15
+ propTypes: {
16
+ className: import("prop-types").Requireable<string>;
17
+ };
18
+ };
19
+ export default TableToolbarContent;
@@ -0,0 +1,24 @@
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 React from 'react';
8
+ export interface TableToolbarMenuProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ children: React.ReactNode;
10
+ /**
11
+ * Provide an optional class name for the toolbar menu
12
+ */
13
+ className?: string;
14
+ /**
15
+ * The description of the menu icon.
16
+ */
17
+ iconDescription: string;
18
+ /**
19
+ * Optional prop to allow overriding the default menu icon
20
+ */
21
+ renderIcon?: React.ReactNode;
22
+ }
23
+ declare const TableToolbarMenu: React.FC<TableToolbarMenuProps>;
24
+ export default TableToolbarMenu;
@@ -10,12 +10,12 @@
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var iconsReact = require('@carbon/icons-react');
13
14
  var cx = require('classnames');
14
15
  var PropTypes = require('prop-types');
15
16
  var React = require('react');
16
- var index = require('../OverflowMenu/index.js');
17
- var iconsReact = require('@carbon/icons-react');
18
17
  var usePrefix = require('../../internal/usePrefix.js');
18
+ var index = require('../OverflowMenu/index.js');
19
19
 
20
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
21
 
@@ -35,7 +35,7 @@ var TableToolbarMenu = function TableToolbarMenu(_ref) {
35
35
  var prefix = usePrefix.usePrefix();
36
36
  var toolbarActionClasses = cx__default["default"](className, "".concat(prefix, "--toolbar-action ").concat(prefix, "--overflow-menu"));
37
37
  return /*#__PURE__*/React__default["default"].createElement(index["default"], _rollupPluginBabelHelpers["extends"]({
38
- ariaLabel: iconDescription,
38
+ "aria-label": iconDescription,
39
39
  renderIcon: renderIcon,
40
40
  className: toolbarActionClasses,
41
41
  title: iconDescription,
@@ -14,6 +14,7 @@ var cx = require('classnames');
14
14
  var PropTypes = require('prop-types');
15
15
  var React = require('react');
16
16
  var Search = require('../Search/Search.js');
17
+ require('../Search/Search.Skeleton.js');
17
18
  var instanceId = require('./tools/instanceId.js');
18
19
  var usePrefix = require('../../internal/usePrefix.js');
19
20
 
@@ -106,7 +106,8 @@ var sortRows = function sortRows(_ref) {
106
106
  sortDirection: sortDirection,
107
107
  locale: locale,
108
108
  sortStates: sortStates.sortStates,
109
- compare: compare
109
+ compare: compare,
110
+ rowIds: [a, b]
110
111
  });
111
112
  });
112
113
  };
@@ -0,0 +1,107 @@
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
+ export interface DataTableSkeletonProps {
9
+ /**
10
+ * Specify an optional className to add.
11
+ */
12
+ className?: string;
13
+ /**
14
+ * Specify the number of columns that you want to render in the skeleton state
15
+ */
16
+ columnCount: number;
17
+ /**
18
+ * Optionally specify whether you want the Skeleton to be rendered as a
19
+ * compact DataTable
20
+ */
21
+ compact: boolean;
22
+ /**
23
+ * Optionally specify the displayed headers
24
+ */
25
+ headers?: [{
26
+ header: string;
27
+ key: string;
28
+ }] | {
29
+ header: string;
30
+ key: string;
31
+ };
32
+ /**
33
+ * Specify the number of rows that you want to render in the skeleton state
34
+ */
35
+ rowCount: number;
36
+ /**
37
+ * Specify if the table header should be rendered as part of the skeleton.
38
+ */
39
+ showHeader: boolean;
40
+ /**
41
+ * Specify if the table toolbar should be rendered as part of the skeleton.
42
+ */
43
+ showToolbar: boolean;
44
+ /**
45
+ * Optionally specify whether you want the DataTable to be zebra striped
46
+ */
47
+ zebra: boolean;
48
+ }
49
+ declare const DataTableSkeleton: {
50
+ ({ headers, rowCount, columnCount, zebra, compact, className, showHeader, showToolbar, ...rest }: {
51
+ [x: string]: any;
52
+ headers: any;
53
+ rowCount: any;
54
+ columnCount: any;
55
+ zebra: any;
56
+ compact: any;
57
+ className: any;
58
+ showHeader: any;
59
+ showToolbar: any;
60
+ }): JSX.Element;
61
+ propTypes: {
62
+ /**
63
+ * Specify an optional className to add.
64
+ */
65
+ className: PropTypes.Requireable<string>;
66
+ /**
67
+ * Specify the number of columns that you want to render in the skeleton state
68
+ */
69
+ columnCount: PropTypes.Requireable<number>;
70
+ /**
71
+ * Optionally specify whether you want the Skeleton to be rendered as a
72
+ * compact DataTable
73
+ */
74
+ compact: PropTypes.Requireable<boolean>;
75
+ /**
76
+ * Optionally specify the displayed headers
77
+ */
78
+ headers: PropTypes.Requireable<NonNullable<any[] | PropTypes.InferProps<{
79
+ key: PropTypes.Requireable<string>;
80
+ }> | null | undefined>>;
81
+ /**
82
+ * Specify the number of rows that you want to render in the skeleton state
83
+ */
84
+ rowCount: PropTypes.Requireable<number>;
85
+ /**
86
+ * Specify if the table header should be rendered as part of the skeleton.
87
+ */
88
+ showHeader: PropTypes.Requireable<boolean>;
89
+ /**
90
+ * Specify if the table toolbar should be rendered as part of the skeleton.
91
+ */
92
+ showToolbar: PropTypes.Requireable<boolean>;
93
+ /**
94
+ * Optionally specify whether you want the DataTable to be zebra striped
95
+ */
96
+ zebra: PropTypes.Requireable<boolean>;
97
+ };
98
+ defaultProps: {
99
+ rowCount: number;
100
+ columnCount: number;
101
+ zebra: boolean;
102
+ compact: boolean;
103
+ showHeader: boolean;
104
+ showToolbar: boolean;
105
+ };
106
+ };
107
+ export default DataTableSkeleton;
@@ -14,8 +14,14 @@ export interface OnChangeData<ItemType> {
14
14
  }
15
15
  export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes> {
16
16
  /**
17
+ * Specify a label to be read by screen readers on the container node
17
18
  * 'aria-label' of the ListBox component.
18
19
  */
20
+ ['aria-label']?: string;
21
+ /**
22
+ * @deprecated please use `aria-label` instead.
23
+ * Specify a label to be read by screen readers on the container note.
24
+ */
19
25
  ariaLabel?: string;
20
26
  /**
21
27
  * Specify the direction of the dropdown. Can be either top or bottom.