@carbon/react 1.44.0 → 1.45.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 (134) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +820 -902
  2. package/es/components/Checkbox/Checkbox.d.ts +1 -1
  3. package/es/components/Checkbox/Checkbox.js +1 -1
  4. package/es/components/CheckboxGroup/CheckboxGroup.js +2 -2
  5. package/es/components/ComboBox/ComboBox.d.ts +1 -1
  6. package/es/components/ComboBox/ComboBox.js +2 -2
  7. package/es/components/ComboButton/index.js +1 -1
  8. package/es/components/ComposedModal/ModalFooter.d.ts +2 -1
  9. package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
  10. package/es/components/DataTable/DataTable.d.ts +2 -0
  11. package/es/components/DataTable/DataTable.js +3 -0
  12. package/es/components/DataTable/TableExpandRow.js +20 -3
  13. package/es/components/DataTable/TableHeader.d.ts +5 -0
  14. package/es/components/DataTable/TableHeader.js +30 -6
  15. package/es/components/DataTable/TableSlugRow.d.ts +31 -0
  16. package/es/components/DataTable/TableSlugRow.js +49 -0
  17. package/es/components/DataTable/index.d.ts +2 -1
  18. package/es/components/DataTable/index.js +3 -0
  19. package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  20. package/es/components/DatePickerInput/DatePickerInput.js +2 -2
  21. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  22. package/es/components/Dropdown/Dropdown.js +2 -2
  23. package/es/components/InlineLoading/InlineLoading.d.ts +68 -0
  24. package/es/components/InlineLoading/InlineLoading.js +4 -4
  25. package/es/components/InlineLoading/index.d.ts +9 -0
  26. package/es/components/Layer/LayerContext.d.ts +8 -0
  27. package/es/components/Layer/LayerLevel.d.ts +5 -0
  28. package/es/components/Layer/LayerLevel.js +12 -0
  29. package/es/components/Layer/index.d.ts +38 -0
  30. package/es/components/Layer/index.js +9 -8
  31. package/es/components/Menu/MenuItem.js +2 -1
  32. package/es/components/MenuButton/index.js +1 -1
  33. package/es/components/Modal/Modal.d.ts +3 -2
  34. package/es/components/MultiSelect/FilterableMultiSelect.js +2 -2
  35. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  36. package/es/components/MultiSelect/MultiSelect.js +5 -2
  37. package/es/components/Notification/Notification.js +1 -0
  38. package/es/components/NumberInput/NumberInput.d.ts +1 -1
  39. package/es/components/NumberInput/NumberInput.js +3 -3
  40. package/es/components/ProgressIndicator/ProgressIndicator.js +4 -0
  41. package/es/components/RadioButton/RadioButton.d.ts +1 -1
  42. package/es/components/RadioButton/RadioButton.js +1 -1
  43. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  44. package/es/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  45. package/es/components/Select/Select.d.ts +1 -1
  46. package/es/components/Select/Select.js +2 -2
  47. package/es/components/Slider/Slider.Skeleton.js +17 -3
  48. package/es/components/Slider/Slider.js +132 -93
  49. package/es/components/Slider/SliderHandles.d.ts +4 -0
  50. package/es/components/Slider/SliderHandles.js +65 -0
  51. package/es/components/Slug/index.js +1 -0
  52. package/es/components/Tabs/Tabs.js +1 -1
  53. package/es/components/Tag/Tag.d.ts +18 -10
  54. package/es/components/Tag/Tag.js +23 -7
  55. package/es/components/TextArea/TextArea.d.ts +7 -3
  56. package/es/components/TextArea/TextArea.js +85 -18
  57. package/es/components/TextInput/TextInput.d.ts +1 -1
  58. package/es/components/TextInput/TextInput.js +2 -2
  59. package/es/components/Tile/Tile.d.ts +8 -8
  60. package/es/components/Tile/Tile.js +11 -7
  61. package/es/components/Tooltip/Tooltip.js +48 -2
  62. package/es/components/UIShell/HeaderPanel.d.ts +36 -0
  63. package/es/components/UIShell/HeaderPanel.js +6 -6
  64. package/es/components/UIShell/Switcher.js +1 -1
  65. package/es/index.js +2 -1
  66. package/es/internal/useAnnouncer.js +2 -1
  67. package/es/internal/useNoInteractiveChildren.js +2 -6
  68. package/lib/components/Checkbox/Checkbox.d.ts +1 -1
  69. package/lib/components/Checkbox/Checkbox.js +1 -1
  70. package/lib/components/CheckboxGroup/CheckboxGroup.js +2 -2
  71. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  72. package/lib/components/ComboBox/ComboBox.js +2 -2
  73. package/lib/components/ComboButton/index.js +1 -1
  74. package/lib/components/ComposedModal/ModalFooter.d.ts +2 -1
  75. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
  76. package/lib/components/DataTable/DataTable.d.ts +2 -0
  77. package/lib/components/DataTable/DataTable.js +3 -0
  78. package/lib/components/DataTable/TableExpandRow.js +20 -3
  79. package/lib/components/DataTable/TableHeader.d.ts +5 -0
  80. package/lib/components/DataTable/TableHeader.js +29 -5
  81. package/lib/components/DataTable/TableSlugRow.d.ts +31 -0
  82. package/lib/components/DataTable/TableSlugRow.js +59 -0
  83. package/lib/components/DataTable/index.d.ts +2 -1
  84. package/lib/components/DataTable/index.js +3 -0
  85. package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  86. package/lib/components/DatePickerInput/DatePickerInput.js +2 -2
  87. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  88. package/lib/components/Dropdown/Dropdown.js +2 -2
  89. package/lib/components/InlineLoading/InlineLoading.d.ts +68 -0
  90. package/lib/components/InlineLoading/InlineLoading.js +4 -4
  91. package/lib/components/InlineLoading/index.d.ts +9 -0
  92. package/lib/components/Layer/LayerContext.d.ts +8 -0
  93. package/lib/components/Layer/LayerLevel.d.ts +5 -0
  94. package/lib/components/Layer/LayerLevel.js +18 -0
  95. package/lib/components/Layer/index.d.ts +38 -0
  96. package/lib/components/Layer/index.js +10 -9
  97. package/lib/components/Menu/MenuItem.js +2 -1
  98. package/lib/components/MenuButton/index.js +1 -1
  99. package/lib/components/Modal/Modal.d.ts +3 -2
  100. package/lib/components/MultiSelect/FilterableMultiSelect.js +2 -2
  101. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  102. package/lib/components/MultiSelect/MultiSelect.js +5 -2
  103. package/lib/components/Notification/Notification.js +1 -0
  104. package/lib/components/NumberInput/NumberInput.d.ts +1 -1
  105. package/lib/components/NumberInput/NumberInput.js +3 -3
  106. package/lib/components/ProgressIndicator/ProgressIndicator.js +4 -0
  107. package/lib/components/RadioButton/RadioButton.d.ts +1 -1
  108. package/lib/components/RadioButton/RadioButton.js +1 -1
  109. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  110. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  111. package/lib/components/Select/Select.d.ts +1 -1
  112. package/lib/components/Select/Select.js +2 -2
  113. package/lib/components/Slider/Slider.Skeleton.js +17 -3
  114. package/lib/components/Slider/Slider.js +132 -93
  115. package/lib/components/Slider/SliderHandles.d.ts +4 -0
  116. package/lib/components/Slider/SliderHandles.js +76 -0
  117. package/lib/components/Slug/index.js +1 -0
  118. package/lib/components/Tabs/Tabs.js +1 -1
  119. package/lib/components/Tag/Tag.d.ts +18 -10
  120. package/lib/components/Tag/Tag.js +23 -7
  121. package/lib/components/TextArea/TextArea.d.ts +7 -3
  122. package/lib/components/TextArea/TextArea.js +84 -17
  123. package/lib/components/TextInput/TextInput.d.ts +1 -1
  124. package/lib/components/TextInput/TextInput.js +2 -2
  125. package/lib/components/Tile/Tile.d.ts +8 -8
  126. package/lib/components/Tile/Tile.js +11 -7
  127. package/lib/components/Tooltip/Tooltip.js +47 -1
  128. package/lib/components/UIShell/HeaderPanel.d.ts +36 -0
  129. package/lib/components/UIShell/HeaderPanel.js +7 -7
  130. package/lib/components/UIShell/Switcher.js +1 -1
  131. package/lib/index.js +4 -2
  132. package/lib/internal/useAnnouncer.js +2 -1
  133. package/lib/internal/useNoInteractiveChildren.js +2 -6
  134. package/package.json +4 -7
package/es/index.js CHANGED
@@ -54,6 +54,7 @@ export { ColumnHang } from './components/Grid/ColumnHang.js';
54
54
  export { GridSettings } from './components/Grid/GridContext.js';
55
55
  export { default as IconSkeleton } from './components/Icon/Icon.Skeleton.js';
56
56
  export { IdPrefix } from './components/IdPrefix/index.js';
57
+ export { default as InlineLoading } from './components/InlineLoading/InlineLoading.js';
57
58
  export { default as Link } from './components/Link/Link.js';
58
59
  export { default as ListItem } from './components/ListItem/ListItem.js';
59
60
  export { default as Loading } from './components/Loading/Loading.js';
@@ -157,7 +158,6 @@ export { default as useContextMenu } from './components/ContextMenu/useContextMe
157
158
  export { default as Copy } from './components/Copy/Copy.js';
158
159
  export { default as CopyButton } from './components/CopyButton/CopyButton.js';
159
160
  export { default as ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary.js';
160
- export { default as InlineLoading } from './components/InlineLoading/InlineLoading.js';
161
161
  export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
162
162
  export { default as ProgressIndicatorSkeleton } from './components/ProgressIndicator/ProgressIndicator.Skeleton.js';
163
163
  export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
@@ -197,6 +197,7 @@ export { default as TableHeader } from './components/DataTable/TableHeader.js';
197
197
  export { default as TableRow } from './components/DataTable/TableRow.js';
198
198
  export { default as TableSelectAll } from './components/DataTable/TableSelectAll.js';
199
199
  export { default as TableSelectRow } from './components/DataTable/TableSelectRow.js';
200
+ export { default as TableSlugRow } from './components/DataTable/TableSlugRow.js';
200
201
  export { default as TableToolbar } from './components/DataTable/TableToolbar.js';
201
202
  export { default as TableToolbarAction } from './components/DataTable/TableToolbarAction.js';
202
203
  export { default as TableToolbarContent } from './components/DataTable/TableToolbarContent.js';
@@ -6,9 +6,10 @@
6
6
  */
7
7
 
8
8
  function useAnnouncer(textCount, maxCount) {
9
+ let entityName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'characters';
9
10
  const lastTen = maxCount - 10;
10
11
  if (textCount >= lastTen) {
11
- return `${maxCount - textCount} characters left.`;
12
+ return `${maxCount - textCount} ${entityName} left.`;
12
13
  }
13
14
  }
14
15
 
@@ -74,7 +74,7 @@ function getRoleContent(node) {
74
74
  * @see https://github.com/w3c/aria-practices/blob/0553bb51588ffa517506e2a1b2ca1422ed438c5f/examples/js/utils.js#L68
75
75
  */
76
76
  function isFocusable(element) {
77
- if (element.tabIndex < 0) {
77
+ if (element.tabIndex === undefined || element.tabIndex < 0) {
78
78
  return false;
79
79
  }
80
80
  if (element.disabled) {
@@ -85,12 +85,8 @@ function isFocusable(element) {
85
85
  return !!element.href && element.rel !== 'ignore';
86
86
  case 'INPUT':
87
87
  return element.type !== 'hidden';
88
- case 'BUTTON':
89
- case 'SELECT':
90
- case 'TEXTAREA':
91
- return true;
92
88
  default:
93
- return false;
89
+ return true;
94
90
  }
95
91
  }
96
92
 
@@ -46,7 +46,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
46
46
  */
47
47
  invalidText?: React.ReactNode;
48
48
  /**
49
- * Provide a `Slug` component to be rendered inside the `Checkbox` component
49
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
50
50
  */
51
51
  slug?: ReactNodeLike;
52
52
  /**
@@ -185,7 +185,7 @@ Checkbox.propTypes = {
185
185
  */
186
186
  readOnly: PropTypes__default["default"].bool,
187
187
  /**
188
- * Provide a `Slug` component to be rendered inside the `Checkbox` component
188
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
189
189
  */
190
190
  slug: PropTypes__default["default"].node,
191
191
  /**
@@ -57,7 +57,7 @@ function CheckboxGroup(_ref) {
57
57
 
58
58
  // Slug is always size `mini`
59
59
  let normalizedSlug;
60
- if (slug) {
60
+ if (slug && slug['type']?.displayName === 'Slug') {
61
61
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
62
62
  size: 'mini',
63
63
  kind: 'default'
@@ -119,7 +119,7 @@ CheckboxGroup.propTypes = {
119
119
  */
120
120
  readOnly: PropTypes__default["default"].bool,
121
121
  /**
122
- * Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
122
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
123
123
  */
124
124
  slug: PropTypes__default["default"].node,
125
125
  /**
@@ -137,7 +137,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
137
137
  */
138
138
  size?: ListBoxSize;
139
139
  /**
140
- * Provide a `Slug` component to be rendered inside the `ComboBox` component
140
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
141
141
  */
142
142
  slug?: ReactNodeLike;
143
143
  /**
@@ -268,7 +268,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
268
268
 
269
269
  // Slug is always size `mini`
270
270
  let normalizedSlug;
271
- if (slug) {
271
+ if (slug && slug['type']?.displayName === 'Slug') {
272
272
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
273
273
  size: 'mini'
274
274
  });
@@ -586,7 +586,7 @@ ComboBox.propTypes = {
586
586
  */
587
587
  size: ListBoxPropTypes.ListBoxSize,
588
588
  /**
589
- * Provide a `Slug` component to be rendered inside the `ComboBox` component
589
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
590
590
  */
591
591
  slug: PropTypes__default["default"].node,
592
592
  /**
@@ -30,7 +30,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
30
30
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
31
31
 
32
32
  var _ChevronDown;
33
- const spacing = 4; // top and bottom spacing between the button and the menu. in px
33
+ const spacing = 0; // top and bottom spacing between the button and the menu. in px
34
34
  const defaultTranslations = {
35
35
  'carbon.combo-button.additional-actions': 'Additional actions'
36
36
  };
@@ -1,4 +1,5 @@
1
1
  import React, { type ReactNode, type MouseEvent, type Ref } from 'react';
2
+ import { InlineLoadingStatus } from '../InlineLoading/InlineLoading';
2
3
  interface SecondaryButtonProps {
3
4
  buttonText: ReactNode;
4
5
  onClick(evt: MouseEvent): void;
@@ -70,7 +71,7 @@ export interface ModalFooterProps {
70
71
  /**
71
72
  * loading status
72
73
  */
73
- loadingStatus?: string;
74
+ loadingStatus?: InlineLoadingStatus;
74
75
  /**
75
76
  * Specify the description for the loading text
76
77
  */
@@ -140,7 +140,7 @@ class ContentSwitcher extends React__default["default"].Component {
140
140
  className: classes,
141
141
  role: "tablist",
142
142
  onChange: undefined
143
- }), children && React__default["default"].Children.map(children, (child, index) => /*#__PURE__*/React__default["default"].cloneElement(child, {
143
+ }), children && React__default["default"].Children.toArray(children).map((child, index) => /*#__PURE__*/React__default["default"].cloneElement(child, {
144
144
  index,
145
145
  onClick: events.composeEventHandlers([this.handleChildChange, child.props.onClick]),
146
146
  onKeyDown: this.handleChildChange,
@@ -22,6 +22,7 @@ import TableHeader from './TableHeader';
22
22
  import TableRow from './TableRow';
23
23
  import TableSelectAll from './TableSelectAll';
24
24
  import TableSelectRow from './TableSelectRow';
25
+ import TableSlugRow from './TableSlugRow';
25
26
  import TableToolbar from './TableToolbar';
26
27
  import TableToolbarAction from './TableToolbarAction';
27
28
  import TableToolbarContent from './TableToolbarContent';
@@ -302,6 +303,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
302
303
  static TableRow: typeof TableRow;
303
304
  static TableSelectAll: typeof TableSelectAll;
304
305
  static TableSelectRow: typeof TableSelectRow;
306
+ static TableSlugRow: typeof TableSlugRow;
305
307
  static TableToolbar: typeof TableToolbar;
306
308
  static TableToolbarAction: typeof TableToolbarAction;
307
309
  static TableToolbarContent: typeof TableToolbarContent;
@@ -35,6 +35,7 @@ var TableHeader = require('./TableHeader.js');
35
35
  var TableRow = require('./TableRow.js');
36
36
  var TableSelectAll = require('./TableSelectAll.js');
37
37
  var TableSelectRow = require('./TableSelectRow.js');
38
+ var TableSlugRow = require('./TableSlugRow.js');
38
39
  var TableToolbar = require('./TableToolbar.js');
39
40
  var TableToolbarAction = require('./TableToolbarAction.js');
40
41
  var TableToolbarContent = require('./TableToolbarContent.js');
@@ -733,6 +734,7 @@ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableHeader", void 0);
733
734
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableRow", void 0);
734
735
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableSelectAll", void 0);
735
736
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableSelectRow", void 0);
737
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableSlugRow", void 0);
736
738
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbar", void 0);
737
739
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbarAction", void 0);
738
740
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbarContent", void 0);
@@ -753,6 +755,7 @@ DataTable.TableHeader = TableHeader["default"];
753
755
  DataTable.TableRow = TableRow["default"];
754
756
  DataTable.TableSelectAll = TableSelectAll["default"];
755
757
  DataTable.TableSelectRow = TableSelectRow["default"];
758
+ DataTable.TableSlugRow = TableSlugRow["default"];
756
759
  DataTable.TableToolbar = TableToolbar["default"];
757
760
  DataTable.TableToolbarAction = TableToolbarAction["default"];
758
761
  DataTable.TableToolbarContent = TableToolbarContent["default"];
@@ -38,17 +38,34 @@ const TableExpandRow = /*#__PURE__*/React__default["default"].forwardRef((_ref,
38
38
  ...rest
39
39
  } = _ref;
40
40
  const prefix = usePrefix.usePrefix();
41
+
42
+ // We need to put the slug before the expansion arrow and all other table cells after the arrow.
43
+ let rowHasSlug;
44
+ const slug = React__default["default"].Children.toArray(children).map(child => {
45
+ if (child.type?.displayName === 'TableSlugRow') {
46
+ if (child.props.slug) {
47
+ rowHasSlug = true;
48
+ }
49
+ return child;
50
+ }
51
+ });
52
+ const normalizedChildren = React__default["default"].Children.toArray(children).map(child => {
53
+ if (child.type?.displayName !== 'TableSlugRow') {
54
+ return child;
55
+ }
56
+ });
41
57
  const className = cx__default["default"]({
42
58
  [`${prefix}--parent-row`]: true,
43
59
  [`${prefix}--expandable-row`]: isExpanded,
44
- [`${prefix}--data-table--selected`]: isSelected
60
+ [`${prefix}--data-table--selected`]: isSelected,
61
+ [`${prefix}--parent-row--slug`]: rowHasSlug
45
62
  }, rowClassName);
46
63
  const previousValue = isExpanded ? 'collapsed' : undefined;
47
64
  return /*#__PURE__*/React__default["default"].createElement("tr", _rollupPluginBabelHelpers["extends"]({}, rest, {
48
65
  ref: ref,
49
66
  className: className,
50
67
  "data-parent-row": true
51
- }), /*#__PURE__*/React__default["default"].createElement(TableCell["default"], {
68
+ }), slug, /*#__PURE__*/React__default["default"].createElement(TableCell["default"], {
52
69
  className: `${prefix}--table-expand`,
53
70
  "data-previous-value": previousValue,
54
71
  headers: expandHeader
@@ -63,7 +80,7 @@ const TableExpandRow = /*#__PURE__*/React__default["default"].forwardRef((_ref,
63
80
  }, /*#__PURE__*/React__default["default"].createElement(iconsReact.ChevronRight, {
64
81
  className: `${prefix}--table-expand__svg`,
65
82
  "aria-label": expandIconDescription
66
- }))), children);
83
+ }))), normalizedChildren);
67
84
  });
68
85
  TableExpandRow.propTypes = {
69
86
  /**
@@ -4,6 +4,7 @@
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
+ import { ReactNodeLike } from 'prop-types';
7
8
  import React, { MouseEventHandler } from 'react';
8
9
  import { ReactAttr } from '../../types/common';
9
10
  interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonElement> {
@@ -43,6 +44,10 @@ interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonEl
43
44
  * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
44
45
  */
45
46
  scope?: string;
47
+ /**
48
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `TableSlugRow` component
49
+ */
50
+ slug?: ReactNodeLike;
46
51
  /**
47
52
  * Specify which direction we are currently sorting by, should be one of DESC,
48
53
  * NONE, or ASC.
@@ -62,11 +62,26 @@ const TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function T
62
62
  scope = defaultScope,
63
63
  sortDirection,
64
64
  translateWithId: t = translateWithId,
65
+ slug,
65
66
  id,
66
67
  ...rest
67
68
  } = _ref;
68
69
  const prefix = usePrefix.usePrefix();
69
70
  const uniqueId = useId.useId('table-sort');
71
+
72
+ // Slug is always size `mini`
73
+ const slugRef = React.useRef(null);
74
+ let normalizedSlug;
75
+ if (slug) {
76
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
77
+ size: 'mini',
78
+ ref: slugRef
79
+ });
80
+ }
81
+ const headerLabelClassNames = cx__default["default"]({
82
+ [`${prefix}--table-header-label`]: true,
83
+ [`${prefix}--table-header-label--slug`]: slug
84
+ });
70
85
  if (!isSortable) {
71
86
  return /*#__PURE__*/React__default["default"].createElement("th", _rollupPluginBabelHelpers["extends"]({}, rest, {
72
87
  id: id,
@@ -75,8 +90,8 @@ const TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function T
75
90
  colSpan: colSpan,
76
91
  ref: ref
77
92
  }), children ? /*#__PURE__*/React__default["default"].createElement("div", {
78
- className: `${prefix}--table-header-label`
79
- }, children) : null);
93
+ className: headerLabelClassNames
94
+ }, children, normalizedSlug) : null);
80
95
  }
81
96
  const className = cx__default["default"](headerClassName, {
82
97
  [`${prefix}--table-sort`]: true,
@@ -90,7 +105,16 @@ const TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function T
90
105
  isSortHeader,
91
106
  sortStates: sortStates.sortStates
92
107
  });
93
- const headerClasses = cx__default["default"](headerClassName, `${prefix}--table-sort__header`);
108
+ const headerClasses = cx__default["default"](headerClassName, `${prefix}--table-sort__header`, {
109
+ [`${prefix}--table-sort__header--slug`]: slug
110
+ });
111
+ const handleClick = evt => {
112
+ if (slug && slugRef.current && slugRef.current.contains(evt.target)) {
113
+ return;
114
+ } else if (onClick) {
115
+ return onClick(evt);
116
+ }
117
+ };
94
118
  return /*#__PURE__*/React__default["default"].createElement("th", {
95
119
  id: id,
96
120
  "aria-sort": ariaSort,
@@ -105,12 +129,12 @@ const TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function T
105
129
  type: "button",
106
130
  "aria-describedby": uniqueId,
107
131
  className: className,
108
- onClick: onClick
132
+ onClick: handleClick
109
133
  }, rest), /*#__PURE__*/React__default["default"].createElement("span", {
110
134
  className: `${prefix}--table-sort__flex`
111
135
  }, /*#__PURE__*/React__default["default"].createElement("div", {
112
136
  className: `${prefix}--table-header-label`
113
- }, children), /*#__PURE__*/React__default["default"].createElement(iconsReact.ArrowUp, {
137
+ }, children), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(iconsReact.ArrowUp, {
114
138
  size: 20,
115
139
  className: `${prefix}--table-sort__icon`
116
140
  }), /*#__PURE__*/React__default["default"].createElement(iconsReact.ArrowsVertical, {
@@ -0,0 +1,31 @@
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, { ReactNodeLike } from 'prop-types';
8
+ export interface TableSlugRowProps {
9
+ /**
10
+ * The CSS class names of the cell that wraps the underlying input control
11
+ */
12
+ className?: string;
13
+ /**
14
+ * Provide a `Slug` component to be rendered inside the `TableSlugRow` component
15
+ */
16
+ slug?: ReactNodeLike;
17
+ }
18
+ declare const TableSlugRow: {
19
+ ({ className, slug }: TableSlugRowProps): JSX.Element;
20
+ propTypes: {
21
+ /**
22
+ * The CSS class names of the cell that wraps the underlying input control
23
+ */
24
+ className: PropTypes.Requireable<string>;
25
+ /**
26
+ * Provide a `Slug` component to be rendered inside the `TableSlugRow` component
27
+ */
28
+ slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
29
+ };
30
+ };
31
+ export default TableSlugRow;
@@ -0,0 +1,59 @@
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
+
8
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var PropTypes = require('prop-types');
13
+ var React = require('react');
14
+ var cx = require('classnames');
15
+ var usePrefix = require('../../internal/usePrefix.js');
16
+
17
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
+
19
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
20
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
22
+
23
+ const TableSlugRow = _ref => {
24
+ let {
25
+ className,
26
+ slug
27
+ } = _ref;
28
+ const prefix = usePrefix.usePrefix();
29
+ const TableSlugRowClasses = cx__default["default"]({
30
+ ...(className && {
31
+ [className]: true
32
+ }),
33
+ [`${prefix}--table-column-slug`]: true,
34
+ [`${prefix}--table-column-slug--active`]: slug
35
+ });
36
+
37
+ // Slug is always size `mini`
38
+ let normalizedSlug;
39
+ if (slug) {
40
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
41
+ size: 'mini'
42
+ });
43
+ }
44
+ return /*#__PURE__*/React__default["default"].createElement("td", {
45
+ className: TableSlugRowClasses
46
+ }, normalizedSlug);
47
+ };
48
+ TableSlugRow.propTypes = {
49
+ /**
50
+ * The CSS class names of the cell that wraps the underlying input control
51
+ */
52
+ className: PropTypes__default["default"].string,
53
+ /**
54
+ * Provide a `Slug` component to be rendered inside the `TableSlugRow` component
55
+ */
56
+ slug: PropTypes__default["default"].node
57
+ };
58
+
59
+ exports["default"] = TableSlugRow;
@@ -20,10 +20,11 @@ import TableHeader from './TableHeader';
20
20
  import TableRow from './TableRow';
21
21
  import TableSelectAll from './TableSelectAll';
22
22
  import TableSelectRow from './TableSelectRow';
23
+ import TableSlugRow from './TableSlugRow';
23
24
  import TableToolbar from './TableToolbar';
24
25
  import TableToolbarAction from './TableToolbarAction';
25
26
  import TableToolbarContent from './TableToolbarContent';
26
27
  import TableToolbarSearch from './TableToolbarSearch';
27
28
  import TableToolbarMenu from './TableToolbarMenu';
28
- export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
29
+ export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableSlugRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
29
30
  export default DataTable;
@@ -25,6 +25,7 @@ var TableHeader = require('./TableHeader.js');
25
25
  var TableRow = require('./TableRow.js');
26
26
  var TableSelectAll = require('./TableSelectAll.js');
27
27
  var TableSelectRow = require('./TableSelectRow.js');
28
+ var TableSlugRow = require('./TableSlugRow.js');
28
29
  var TableToolbar = require('./TableToolbar.js');
29
30
  var TableToolbarAction = require('./TableToolbarAction.js');
30
31
  var TableToolbarContent = require('./TableToolbarContent.js');
@@ -46,6 +47,7 @@ DataTable["default"].TableHeader = TableHeader["default"];
46
47
  DataTable["default"].TableRow = TableRow["default"];
47
48
  DataTable["default"].TableSelectAll = TableSelectAll["default"];
48
49
  DataTable["default"].TableSelectRow = TableSelectRow["default"];
50
+ DataTable["default"].TableSlugRow = TableSlugRow["default"];
49
51
  DataTable["default"].TableToolbar = TableToolbar["default"];
50
52
  DataTable["default"].TableToolbarAction = TableToolbarAction["default"];
51
53
  DataTable["default"].TableToolbarContent = TableToolbarContent["default"];
@@ -69,6 +71,7 @@ exports.TableHeader = TableHeader["default"];
69
71
  exports.TableRow = TableRow["default"];
70
72
  exports.TableSelectAll = TableSelectAll["default"];
71
73
  exports.TableSelectRow = TableSelectRow["default"];
74
+ exports.TableSlugRow = TableSlugRow["default"];
72
75
  exports.TableToolbar = TableToolbar["default"];
73
76
  exports.TableToolbarAction = TableToolbarAction["default"];
74
77
  exports.TableToolbarContent = TableToolbarContent["default"];
@@ -77,7 +77,7 @@ interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>, Exclude
77
77
  */
78
78
  size?: 'sm' | 'md' | 'lg';
79
79
  /**
80
- * Provide a `Slug` component to be rendered inside the `DatePickerInput` component
80
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
81
81
  */
82
82
  slug?: ReactNodeLike;
83
83
  /**
@@ -108,7 +108,7 @@ const DatePickerInput = /*#__PURE__*/React__default["default"].forwardRef(functi
108
108
 
109
109
  // Slug is always size `mini`
110
110
  let normalizedSlug;
111
- if (slug) {
111
+ if (slug && slug['type']?.displayName === 'Slug') {
112
112
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
113
113
  size: 'mini'
114
114
  });
@@ -216,7 +216,7 @@ DatePickerInput.propTypes = {
216
216
  */
217
217
  size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
218
218
  /**
219
- * Provide a `Slug` component to be rendered inside the `DatePickerInput` component
219
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
220
220
  */
221
221
  slug: PropTypes__default["default"].node,
222
222
  /**
@@ -112,7 +112,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
112
112
  */
113
113
  size?: ListBoxSize;
114
114
  /**
115
- * Provide a `Slug` component to be rendered inside the `Dropdown` component
115
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
116
116
  */
117
117
  slug?: ReactNodeLike;
118
118
  /**
@@ -238,7 +238,7 @@ const Dropdown = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
238
238
 
239
239
  // Slug is always size `mini`
240
240
  let normalizedSlug;
241
- if (slug) {
241
+ if (slug && slug['type']?.displayName === 'Slug') {
242
242
  normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
243
243
  size: 'mini'
244
244
  });
@@ -406,7 +406,7 @@ Dropdown.propTypes = {
406
406
  */
407
407
  size: ListBoxPropTypes.ListBoxSize,
408
408
  /**
409
- * Provide a `Slug` component to be rendered inside the `Dropdown` component
409
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
410
410
  */
411
411
  slug: PropTypes__default["default"].node,
412
412
  /**
@@ -0,0 +1,68 @@
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 PropTypes from 'prop-types';
9
+ export declare const InlineLoadingStatuses: readonly ["inactive", "active", "finished", "error"];
10
+ export type InlineLoadingStatus = (typeof InlineLoadingStatuses)[number];
11
+ export interface InlineLoadingProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'children'> {
12
+ /**
13
+ * Specify a custom className to be applied to the container node
14
+ */
15
+ className?: string;
16
+ /**
17
+ * Specify the description for the inline loading text
18
+ */
19
+ description?: React.ReactNode;
20
+ /**
21
+ * Specify the description for the inline loading text
22
+ */
23
+ iconDescription?: string;
24
+ /**
25
+ * Provide an optional handler to be invoked when <InlineLoading> is
26
+ * successful
27
+ */
28
+ onSuccess?: () => void;
29
+ /**
30
+ * Specify the loading status
31
+ */
32
+ status?: InlineLoadingStatus;
33
+ /**
34
+ * Provide a delay for the `setTimeout` for success
35
+ */
36
+ successDelay?: number;
37
+ }
38
+ declare const InlineLoading: {
39
+ ({ className, status, iconDescription, description, onSuccess, successDelay, ...rest }: InlineLoadingProps): JSX.Element;
40
+ propTypes: {
41
+ /**
42
+ * Specify a custom className to be applied to the container node
43
+ */
44
+ className: PropTypes.Requireable<string>;
45
+ /**
46
+ * Specify the description for the inline loading text
47
+ */
48
+ description: PropTypes.Requireable<PropTypes.ReactNodeLike>;
49
+ /**
50
+ * Specify the description for the inline loading text
51
+ */
52
+ iconDescription: PropTypes.Requireable<string>;
53
+ /**
54
+ * Provide an optional handler to be invoked when <InlineLoading> is
55
+ * successful
56
+ */
57
+ onSuccess: PropTypes.Requireable<(...args: any[]) => any>;
58
+ /**
59
+ * Specify the loading status
60
+ */
61
+ status: PropTypes.Requireable<string>;
62
+ /**
63
+ * Provide a delay for the `setTimeout` for success
64
+ */
65
+ successDelay: PropTypes.Requireable<number>;
66
+ };
67
+ };
68
+ export default InlineLoading;
@@ -23,7 +23,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
24
24
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
25
25
 
26
- function InlineLoading(_ref) {
26
+ const InlineLoading = _ref => {
27
27
  let {
28
28
  className,
29
29
  status = 'active',
@@ -31,7 +31,7 @@ function InlineLoading(_ref) {
31
31
  description,
32
32
  onSuccess,
33
33
  successDelay = 1500,
34
- ...other
34
+ ...rest
35
35
  } = _ref;
36
36
  const prefix = usePrefix.usePrefix();
37
37
  const loadingClasses = cx__default["default"](`${prefix}--inline-loading`, className);
@@ -74,10 +74,10 @@ function InlineLoading(_ref) {
74
74
  }, loading);
75
75
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
76
76
  className: loadingClasses
77
- }, other, {
77
+ }, rest, {
78
78
  "aria-live": 'assertive'
79
79
  }), loadingAnimation, description && loadingText);
80
- }
80
+ };
81
81
  InlineLoading.propTypes = {
82
82
  /**
83
83
  * Specify a custom className to be applied to the container node
@@ -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 InlineLoading from './InlineLoading';
8
+ export default InlineLoading;
9
+ export { InlineLoading };
@@ -0,0 +1,8 @@
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 declare const LayerContext: React.Context<0 | 1 | 2>;