@carbon/react 1.72.0 → 1.73.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 (68) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +810 -810
  2. package/es/components/AILabel/index.js +4 -2
  3. package/es/components/ComposedModal/ComposedModal.js +1 -1
  4. package/es/components/Copy/Copy.js +1 -1
  5. package/es/components/DataTable/DataTable.d.ts +8 -2
  6. package/es/components/DataTable/DataTable.js +6 -1
  7. package/es/components/DataTable/Table.js +1 -1
  8. package/es/components/DataTable/TableCell.d.ts +1 -1
  9. package/es/components/DataTable/TableCell.js +2 -2
  10. package/es/components/DataTable/TableDecoratorRow.d.ts +33 -0
  11. package/es/components/DataTable/TableDecoratorRow.js +48 -0
  12. package/es/components/DataTable/TableExpandRow.js +9 -9
  13. package/es/components/DataTable/TableHeader.d.ts +6 -1
  14. package/es/components/DataTable/TableHeader.js +20 -11
  15. package/es/components/DataTable/TableRow.js +17 -10
  16. package/es/components/DataTable/TableSlugRow.js +5 -1
  17. package/es/components/DataTable/index.d.ts +2 -1
  18. package/es/components/DataTable/index.js +3 -0
  19. package/es/components/DataTable/tools/normalize.js +3 -2
  20. package/es/components/Modal/Modal.js +1 -1
  21. package/es/components/Popover/index.js +6 -2
  22. package/es/components/Search/Search.js +1 -1
  23. package/es/components/Slider/Slider.Skeleton.d.ts +17 -1
  24. package/es/components/Slider/Slider.Skeleton.js +20 -3
  25. package/es/components/Slider/Slider.d.ts +1 -1
  26. package/es/components/Slider/Slider.js +20 -4
  27. package/es/components/Slider/SliderHandles.d.ts +4 -4
  28. package/es/components/Slider/SliderHandles.js +9 -8
  29. package/es/components/Stack/Stack.js +3 -1
  30. package/es/components/Tabs/Tabs.js +1 -1
  31. package/es/components/Toggletip/index.d.ts +16 -11
  32. package/es/components/Toggletip/index.js +5 -0
  33. package/es/index.js +1 -0
  34. package/es/prop-types/deprecateComponent.js +22 -0
  35. package/lib/components/AILabel/index.js +4 -2
  36. package/lib/components/ComposedModal/ComposedModal.js +2 -3
  37. package/lib/components/Copy/Copy.js +2 -3
  38. package/lib/components/DataTable/DataTable.d.ts +8 -2
  39. package/lib/components/DataTable/DataTable.js +6 -1
  40. package/lib/components/DataTable/Table.js +3 -4
  41. package/lib/components/DataTable/TableCell.d.ts +1 -1
  42. package/lib/components/DataTable/TableCell.js +2 -2
  43. package/lib/components/DataTable/TableDecoratorRow.d.ts +33 -0
  44. package/lib/components/DataTable/TableDecoratorRow.js +58 -0
  45. package/lib/components/DataTable/TableExpandRow.js +9 -9
  46. package/lib/components/DataTable/TableHeader.d.ts +6 -1
  47. package/lib/components/DataTable/TableHeader.js +20 -11
  48. package/lib/components/DataTable/TableRow.js +17 -11
  49. package/lib/components/DataTable/TableSlugRow.js +4 -0
  50. package/lib/components/DataTable/index.d.ts +2 -1
  51. package/lib/components/DataTable/index.js +3 -0
  52. package/lib/components/DataTable/tools/normalize.js +3 -2
  53. package/lib/components/Modal/Modal.js +2 -3
  54. package/lib/components/Popover/index.js +6 -2
  55. package/lib/components/Search/Search.js +1 -1
  56. package/lib/components/Slider/Slider.Skeleton.d.ts +17 -1
  57. package/lib/components/Slider/Slider.Skeleton.js +20 -3
  58. package/lib/components/Slider/Slider.d.ts +1 -1
  59. package/lib/components/Slider/Slider.js +21 -6
  60. package/lib/components/Slider/SliderHandles.d.ts +4 -4
  61. package/lib/components/Slider/SliderHandles.js +9 -8
  62. package/lib/components/Stack/Stack.js +3 -1
  63. package/lib/components/Tabs/Tabs.js +3 -4
  64. package/lib/components/Toggletip/index.d.ts +16 -11
  65. package/lib/components/Toggletip/index.js +5 -0
  66. package/lib/index.js +2 -0
  67. package/lib/prop-types/deprecateComponent.js +26 -0
  68. package/package.json +6 -8
@@ -118,7 +118,8 @@ const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, r
118
118
  onRevertClick(evt);
119
119
  }
120
120
  };
121
- const ariaLabelText = !aiTextLabel && !textLabel ? `${aiText} - ${slugLabel || ariaLabel}` : `${aiText} - ${aiTextLabel || textLabel}`;
121
+ const ariaLabelText = !aiTextLabel && !textLabel ? `${aiText} ${slugLabel || ariaLabel}` : `${aiText} ${aiTextLabel || textLabel}`;
122
+ const isSmallIcon = ['xs', '2xs', 'mini'].includes(size);
122
123
  return /*#__PURE__*/React__default.createElement("div", {
123
124
  className: aiLabelClasses,
124
125
  ref: ref,
@@ -130,7 +131,8 @@ const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, r
130
131
  label: revertLabel
131
132
  }, rest), _Undo || (_Undo = /*#__PURE__*/React__default.createElement(Undo, null))) : /*#__PURE__*/React__default.createElement(Toggletip, _extends({
132
133
  align: align,
133
- autoAlign: autoAlign
134
+ autoAlign: autoAlign,
135
+ alignmentAxisOffset: isSmallIcon ? -24 : 0
134
136
  }, rest), /*#__PURE__*/React__default.createElement(ToggletipButton, {
135
137
  className: aiLabelButtonClasses,
136
138
  label: ariaLabelText
@@ -12,7 +12,7 @@ import PropTypes from 'prop-types';
12
12
  import { Layer } from '../Layer/index.js';
13
13
  import { ModalHeader } from './ModalHeader.js';
14
14
  import { ModalFooter } from './ModalFooter.js';
15
- import debounce from 'lodash.debounce';
15
+ import { debounce } from 'es-toolkit/compat';
16
16
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
17
17
  import mergeRefs from '../../tools/mergeRefs.js';
18
18
  import cx from 'classnames';
@@ -8,7 +8,7 @@
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
10
  import React__default, { useState, useCallback, useEffect } from 'react';
11
- import debounce from 'lodash.debounce';
11
+ import { debounce } from 'es-toolkit/compat';
12
12
  import cx from 'classnames';
13
13
  import { composeEventHandlers } from '../../tools/events.js';
14
14
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -15,6 +15,7 @@ import TableBatchActions from './TableBatchActions';
15
15
  import TableBody from './TableBody';
16
16
  import TableCell from './TableCell';
17
17
  import TableContainer from './TableContainer';
18
+ import TableDecoratorRow from './TableDecoratorRow';
18
19
  import TableExpandHeader from './TableExpandHeader';
19
20
  import TableExpandRow from './TableExpandRow';
20
21
  import TableExpandedRow from './TableExpandedRow';
@@ -70,6 +71,7 @@ export interface DataTableHeader {
70
71
  key: string;
71
72
  header: React.ReactNode;
72
73
  slug?: React.ReactElement;
74
+ decorator?: React.ReactElement;
73
75
  }
74
76
  export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
75
77
  headers: Array<DataTableHeader>;
@@ -174,7 +176,8 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
174
176
  cell: DataTableCell<ColTypes>;
175
177
  }) => {
176
178
  [key: string]: unknown;
177
- hasSlugHeader?: boolean;
179
+ hasAILabelHeader?: boolean;
180
+ hasDecoratorHeader?: boolean;
178
181
  };
179
182
  onInputChange: (e: React.ChangeEvent<HTMLInputElement>, defaultValue?: string) => void;
180
183
  sortBy: (headerKey: string) => void;
@@ -318,6 +321,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
318
321
  static TableBody: typeof TableBody;
319
322
  static TableCell: typeof TableCell;
320
323
  static TableContainer: typeof TableContainer;
324
+ static TableDecoratorRow: typeof TableDecoratorRow;
321
325
  static TableExpandHeader: typeof TableExpandHeader;
322
326
  static TableExpandRow: typeof TableExpandRow;
323
327
  static TableExpandedRow: typeof TableExpandedRow;
@@ -358,6 +362,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
358
362
  isSortable: boolean | undefined;
359
363
  isSortHeader: boolean;
360
364
  slug: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
365
+ decorator: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
361
366
  onClick: (event: any) => void;
362
367
  };
363
368
  /**
@@ -505,7 +510,8 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
505
510
  [x: string]: any;
506
511
  cell: any;
507
512
  }) => {
508
- hasSlugHeader: any;
513
+ hasAILabelHeader: any;
514
+ hasDecoratorHeader: any;
509
515
  };
510
516
  /**
511
517
  * Helper utility to get all the currently selected rows
@@ -23,6 +23,7 @@ import TableBatchActions from './TableBatchActions.js';
23
23
  import TableBody from './TableBody.js';
24
24
  import TableCell from './TableCell.js';
25
25
  import TableContainer from './TableContainer.js';
26
+ import TableDecoratorRow from './TableDecoratorRow.js';
26
27
  import TableExpandHeader from './TableExpandHeader.js';
27
28
  import TableExpandRow from './TableExpandRow.js';
28
29
  import TableExpandedRow from './TableExpandedRow.js';
@@ -109,6 +110,7 @@ class DataTable extends React__default.Component {
109
110
  isSortable,
110
111
  isSortHeader: sortHeaderKey === header.key,
111
112
  slug: header.slug,
113
+ decorator: header.decorator,
112
114
  onClick: event => {
113
115
  const nextSortState = getNextSortState(this.props, this.state, {
114
116
  key: header.key
@@ -363,7 +365,8 @@ class DataTable extends React__default.Component {
363
365
  } = _ref4;
364
366
  return {
365
367
  ...rest,
366
- hasSlugHeader: cell.hasSlugHeader
368
+ hasAILabelHeader: cell.hasAILabelHeader,
369
+ hasDecoratorHeader: cell.hasDecoratorHeader
367
370
  };
368
371
  });
369
372
  /**
@@ -743,6 +746,7 @@ _defineProperty(DataTable, "TableBatchActions", void 0);
743
746
  _defineProperty(DataTable, "TableBody", void 0);
744
747
  _defineProperty(DataTable, "TableCell", void 0);
745
748
  _defineProperty(DataTable, "TableContainer", void 0);
749
+ _defineProperty(DataTable, "TableDecoratorRow", void 0);
746
750
  _defineProperty(DataTable, "TableExpandHeader", void 0);
747
751
  _defineProperty(DataTable, "TableExpandRow", void 0);
748
752
  _defineProperty(DataTable, "TableExpandedRow", void 0);
@@ -764,6 +768,7 @@ DataTable.TableBatchActions = TableBatchActions;
764
768
  DataTable.TableBody = TableBody;
765
769
  DataTable.TableCell = TableCell;
766
770
  DataTable.TableContainer = TableContainer;
771
+ DataTable.TableDecoratorRow = TableDecoratorRow;
767
772
  DataTable.TableExpandHeader = TableExpandHeader;
768
773
  DataTable.TableExpandRow = TableExpandRow;
769
774
  DataTable.TableExpandedRow = TableExpandedRow;
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
9
9
  import React__default, { useContext, useState, useRef, useCallback } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
- import debounce from 'lodash.debounce';
12
+ import { debounce } from 'es-toolkit/compat';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
14
  import { TableContext } from './TableContext.js';
15
15
  import { useWindowEvent } from '../../internal/useEvent.js';
@@ -22,7 +22,7 @@ interface TableCellProps extends ReactAttr<HTMLTableCellElement> {
22
22
  /**
23
23
  * Specify if the table cell is in an AI column
24
24
  */
25
- hasSlugHeader?: boolean;
25
+ hasAILabelHeader?: boolean;
26
26
  /**
27
27
  * 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
28
28
  */
@@ -14,13 +14,13 @@ const TableCell = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
14
14
  let {
15
15
  children,
16
16
  className,
17
- hasSlugHeader,
17
+ hasAILabelHeader,
18
18
  colSpan,
19
19
  ...rest
20
20
  } = _ref;
21
21
  const prefix = usePrefix();
22
22
  const tableCellClassNames = cx(className, {
23
- [`${prefix}--table-cell--column-slug`]: hasSlugHeader
23
+ [`${prefix}--table-cell--column-slug`]: hasAILabelHeader
24
24
  });
25
25
  return /*#__PURE__*/React__default.createElement("td", _extends({
26
26
  className: tableCellClassNames ? tableCellClassNames : undefined,
@@ -0,0 +1,33 @@
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 { ReactNode } from 'react';
9
+ export interface TableDecoratorRowProps {
10
+ /**
11
+ * The CSS class names of the cell that wraps the underlying input control
12
+ */
13
+ className?: string;
14
+ /**
15
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `TableDecoratorRow` component
16
+ */
17
+ decorator?: ReactNode;
18
+ }
19
+ declare const TableDecoratorRow: {
20
+ ({ className, decorator, }: TableDecoratorRowProps): import("react/jsx-runtime").JSX.Element;
21
+ displayName: string;
22
+ propTypes: {
23
+ /**
24
+ * The CSS class names of the cell that wraps the underlying input control
25
+ */
26
+ className: PropTypes.Requireable<string>;
27
+ /**
28
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `TableDecoratorRow` component
29
+ */
30
+ decorator: PropTypes.Requireable<PropTypes.ReactNodeLike>;
31
+ };
32
+ };
33
+ export default TableDecoratorRow;
@@ -0,0 +1,48 @@
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
+ import PropTypes from 'prop-types';
9
+ import React__default from 'react';
10
+ import cx from 'classnames';
11
+ import { usePrefix } from '../../internal/usePrefix.js';
12
+
13
+ const TableDecoratorRow = _ref => {
14
+ let {
15
+ className,
16
+ decorator
17
+ } = _ref;
18
+ const prefix = usePrefix();
19
+ const TableDecoratorRowClasses = cx({
20
+ ...(className && {
21
+ [className]: true
22
+ }),
23
+ [`${prefix}--table-column-decorator`]: true,
24
+ [`${prefix}--table-column-decorator--active`]: decorator
25
+ });
26
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(decorator) ? decorator : null;
27
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
28
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
29
+ size: 'mini'
30
+ });
31
+ }
32
+ return /*#__PURE__*/React__default.createElement("td", {
33
+ className: TableDecoratorRowClasses
34
+ }, normalizedDecorator);
35
+ };
36
+ TableDecoratorRow.displayName = 'TableDecoratorRow';
37
+ TableDecoratorRow.propTypes = {
38
+ /**
39
+ * The CSS class names of the cell that wraps the underlying input control
40
+ */
41
+ className: PropTypes.string,
42
+ /**
43
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `TableDecoratorRow` component
44
+ */
45
+ decorator: PropTypes.node
46
+ };
47
+
48
+ export { TableDecoratorRow as default };
@@ -29,18 +29,18 @@ const TableExpandRow = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
29
29
  } = _ref;
30
30
  const prefix = usePrefix();
31
31
 
32
- // We need to put the slug before the expansion arrow and all other table cells after the arrow.
33
- let rowHasSlug;
34
- const slug = React__default.Children.toArray(children).map(child => {
35
- if (child.type?.displayName === 'TableSlugRow') {
36
- if (child.props.slug) {
37
- rowHasSlug = true;
32
+ // We need to put the AILabel and Decorator before the expansion arrow and all other table cells after the arrow.
33
+ let rowHasAILabel;
34
+ const decorator = React__default.Children.toArray(children).map(child => {
35
+ if (child.type?.displayName === 'TableSlugRow' || child.type?.displayName === 'TableDecoratorRow') {
36
+ if (child.props.slug || child.props.decorator?.type.displayName === 'AILabel') {
37
+ rowHasAILabel = true;
38
38
  }
39
39
  return child;
40
40
  }
41
41
  });
42
42
  const normalizedChildren = React__default.Children.toArray(children).map(child => {
43
- if (child.type?.displayName !== 'TableSlugRow') {
43
+ if (child.type?.displayName !== 'TableSlugRow' && child.type?.displayName !== 'TableDecoratorRow') {
44
44
  return child;
45
45
  }
46
46
  });
@@ -48,14 +48,14 @@ const TableExpandRow = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
48
48
  [`${prefix}--parent-row`]: true,
49
49
  [`${prefix}--expandable-row`]: isExpanded,
50
50
  [`${prefix}--data-table--selected`]: isSelected,
51
- [`${prefix}--data-table--slug-row`]: rowHasSlug
51
+ [`${prefix}--data-table--slug-row ${prefix}--data-table--ai-label-row`]: rowHasAILabel
52
52
  }, rowClassName);
53
53
  const previousValue = isExpanded ? 'collapsed' : undefined;
54
54
  return /*#__PURE__*/React__default.createElement("tr", _extends({}, rest, {
55
55
  ref: ref,
56
56
  className: className,
57
57
  "data-parent-row": true
58
- }), slug, /*#__PURE__*/React__default.createElement(TableCell, {
58
+ }), decorator, /*#__PURE__*/React__default.createElement(TableCell, {
59
59
  className: `${prefix}--table-expand`,
60
60
  "data-previous-value": previousValue,
61
61
  headers: expandHeader
@@ -58,9 +58,14 @@ interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonEl
58
58
  */
59
59
  scope?: string;
60
60
  /**
61
- * **Experimental**: Provide a `Slug` component to be rendered inside the `TableSlugRow` component
61
+ * @deprecated please use decorator instead.
62
+ * Provide a `Slug` component to be rendered inside the `TableSlugRow` component
62
63
  */
63
64
  slug?: ReactNode;
65
+ /**
66
+ * **Experimental**: Provide a `decorator` component to be rendered inside the `TableDecoratorRow` component
67
+ */
68
+ decorator?: ReactNode;
64
69
  /**
65
70
  * Specify which direction we are currently sorting by, should be one of DESC,
66
71
  * NONE, or ASC.
@@ -46,6 +46,7 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
46
46
  className: headerClassName,
47
47
  children,
48
48
  colSpan,
49
+ decorator,
49
50
  isSortable = false,
50
51
  isSortHeader,
51
52
  onClick,
@@ -59,18 +60,21 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
59
60
  const prefix = usePrefix();
60
61
  const uniqueId = useId('table-sort');
61
62
 
62
- // Slug is always size `mini`
63
- const slugRef = useRef(null);
64
- let normalizedSlug;
65
- if (slug) {
66
- normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
63
+ // AILabel is always size `mini`
64
+ const AILableRef = useRef(null);
65
+ let colHasAILabel;
66
+ let normalizedDecorator = /*#__PURE__*/React__default.isValidElement(slug ?? decorator) ? slug ?? decorator : null;
67
+ if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
68
+ colHasAILabel = true;
69
+ normalizedDecorator = /*#__PURE__*/React__default.cloneElement(normalizedDecorator, {
67
70
  size: 'mini',
68
- ref: slugRef
71
+ ref: AILableRef
69
72
  });
70
73
  }
71
74
  const headerLabelClassNames = cx({
72
75
  [`${prefix}--table-header-label`]: true,
73
- [`${prefix}--table-header-label--slug`]: slug
76
+ [`${prefix}--table-header-label--slug ${prefix}--table-header-label--ai-label`]: colHasAILabel,
77
+ [`${prefix}--table-header-label--decorator`]: decorator
74
78
  });
75
79
  if (!isSortable) {
76
80
  return /*#__PURE__*/React__default.createElement("th", _extends({}, rest, {
@@ -81,7 +85,9 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
81
85
  ref: ref
82
86
  }), children ? /*#__PURE__*/React__default.createElement("div", {
83
87
  className: headerLabelClassNames
84
- }, children, normalizedSlug) : null);
88
+ }, children, /*#__PURE__*/React__default.createElement("div", {
89
+ className: `${prefix}--table-header-label--decorator-inner`
90
+ }, normalizedDecorator)) : null);
85
91
  }
86
92
  const className = cx(headerClassName, {
87
93
  [`${prefix}--table-sort`]: true,
@@ -96,10 +102,11 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
96
102
  sortStates
97
103
  });
98
104
  const headerClasses = cx(headerClassName, `${prefix}--table-sort__header`, {
99
- [`${prefix}--table-sort__header--slug`]: slug
105
+ [`${prefix}--table-sort__header--ai-label`]: colHasAILabel,
106
+ [`${prefix}--table-sort__header--decorator`]: decorator
100
107
  });
101
108
  const handleClick = evt => {
102
- if (slug && slugRef.current && slugRef.current.contains(evt.target)) {
109
+ if (colHasAILabel && AILableRef.current && AILableRef.current.contains(evt.target)) {
103
110
  return;
104
111
  } else if (onClick) {
105
112
  return onClick(evt);
@@ -130,7 +137,9 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
130
137
  }), /*#__PURE__*/React__default.createElement(ArrowsVertical, {
131
138
  size: 20,
132
139
  className: `${prefix}--table-sort__icon-unsorted`
133
- }), normalizedSlug)));
140
+ }), /*#__PURE__*/React__default.createElement("div", {
141
+ className: `${prefix}--table-header-label--decorator-inner`
142
+ }, normalizedDecorator))));
134
143
  });
135
144
  TableHeader.propTypes = {
136
145
  /**
@@ -7,18 +7,17 @@
7
7
 
8
8
  import React__default from 'react';
9
9
  import PropTypes from 'prop-types';
10
- import omit from 'lodash.omit';
11
10
  import cx from 'classnames';
12
11
  import { usePrefix } from '../../internal/usePrefix.js';
13
12
 
14
13
  const TableRow = props => {
15
14
  const prefix = usePrefix();
16
- let rowHasSlug;
15
+ let rowHasAILabel;
17
16
  if (props?.children) {
18
17
  React__default.Children.toArray(props.children).map(child => {
19
- if (child.type?.displayName === 'TableSlugRow') {
20
- if (child.props.slug) {
21
- rowHasSlug = true;
18
+ if (child.type?.displayName === 'TableSlugRow' || child.type?.displayName === 'TableDecoratorRow') {
19
+ if (child.props.slug || child.props.decorator?.type.displayName === 'AILabel') {
20
+ rowHasAILabel = true;
22
21
  }
23
22
  }
24
23
  });
@@ -27,12 +26,20 @@ const TableRow = props => {
27
26
  // only useful in `TableExpandRow`
28
27
  const className = cx(props.className, {
29
28
  [`${prefix}--data-table--selected`]: props.isSelected,
30
- [`${prefix}--data-table--slug-row`]: rowHasSlug
29
+ [`${prefix}--data-table--slug-row ${prefix}--data-table--ai-label-row`]: rowHasAILabel
31
30
  });
32
- const cleanProps = {
33
- ...omit(props, ['ariaLabel', 'aria-label', 'aria-controls', 'onExpand', 'isExpanded', 'isSelected']),
34
- className: className || undefined
35
- };
31
+ const {
32
+ ariaLabel,
33
+ 'aria-label': ariaLabelAlt,
34
+ 'aria-controls': ariaControls,
35
+ onExpand,
36
+ isExpanded,
37
+ isSelected,
38
+ ...cleanProps
39
+ } = props;
40
+ if (className) {
41
+ cleanProps.className = className;
42
+ }
36
43
  return /*#__PURE__*/React__default.createElement("tr", cleanProps);
37
44
  };
38
45
  TableRow.propTypes = {
@@ -6,15 +6,19 @@
6
6
  */
7
7
 
8
8
  import PropTypes from 'prop-types';
9
- import React__default from 'react';
9
+ import React__default, { useEffect } from 'react';
10
10
  import cx from 'classnames';
11
11
  import { usePrefix } from '../../internal/usePrefix.js';
12
+ import deprecateComponent from '../../prop-types/deprecateComponent.js';
12
13
 
13
14
  const TableSlugRow = _ref => {
14
15
  let {
15
16
  className,
16
17
  slug
17
18
  } = _ref;
19
+ useEffect(() => {
20
+ deprecateComponent('TableSlugRow', 'The `TableSlugRow` component has been deprecated and will be removed in the next major version. Use the TableDecoratorRow component instead.');
21
+ }, []);
18
22
  const prefix = usePrefix();
19
23
  const TableSlugRowClasses = cx({
20
24
  ...(className && {
@@ -13,6 +13,7 @@ import TableBody from './TableBody';
13
13
  import TableCell from './TableCell';
14
14
  import TableContainer from './TableContainer';
15
15
  import TableExpandHeader from './TableExpandHeader';
16
+ import TableDecoratorRow from './TableDecoratorRow';
16
17
  import TableExpandRow from './TableExpandRow';
17
18
  import TableExpandedRow from './TableExpandedRow';
18
19
  import TableHead from './TableHead';
@@ -27,5 +28,5 @@ import TableToolbarContent from './TableToolbarContent';
27
28
  import TableToolbarSearch from './TableToolbarSearch';
28
29
  import TableToolbarMenu from './TableToolbarMenu';
29
30
  import type { DataTableSortState } from './state/sortStates';
30
- export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableSortState, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, type TableHeaderTranslationKey, type TableHeaderTranslationArgs, TableRow, TableSelectAll, TableSelectRow, TableSlugRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
31
+ export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableSortState, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableDecoratorRow, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, type TableHeaderTranslationKey, type TableHeaderTranslationArgs, TableRow, TableSelectAll, TableSelectRow, TableSlugRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
31
32
  export default DataTable;
@@ -23,6 +23,8 @@ import TableContainer from './TableContainer.js';
23
23
  export { default as TableContainer } from './TableContainer.js';
24
24
  import TableExpandHeader from './TableExpandHeader.js';
25
25
  export { default as TableExpandHeader } from './TableExpandHeader.js';
26
+ import TableDecoratorRow from './TableDecoratorRow.js';
27
+ export { default as TableDecoratorRow } from './TableDecoratorRow.js';
26
28
  import TableExpandRow from './TableExpandRow.js';
27
29
  export { default as TableExpandRow } from './TableExpandRow.js';
28
30
  import TableExpandedRow from './TableExpandedRow.js';
@@ -57,6 +59,7 @@ DataTable.TableBatchActions = TableBatchActions;
57
59
  DataTable.TableBody = TableBody;
58
60
  DataTable.TableCell = TableCell;
59
61
  DataTable.TableContainer = TableContainer;
62
+ DataTable.TableDecoratorRow = TableDecoratorRow;
60
63
  DataTable.TableExpandHeader = TableExpandHeader;
61
64
  DataTable.TableExpandRow = TableExpandRow;
62
65
  DataTable.TableExpandedRow = TableExpandedRow;
@@ -49,7 +49,8 @@ const normalize = function (rows, headers) {
49
49
  headers.forEach((_ref, i) => {
50
50
  let {
51
51
  key,
52
- slug
52
+ slug,
53
+ decorator
53
54
  } = _ref;
54
55
  const id = getCellId(row.id, key);
55
56
  // Initialize the cell info and state values, namely for editing
@@ -60,7 +61,7 @@ const normalize = function (rows, headers) {
60
61
  isEditing: false,
61
62
  isValid: true,
62
63
  errors: null,
63
- hasSlugHeader: !!slug,
64
+ hasAILabelHeader: !!(slug || decorator?.type?.displayName === 'AILabel'),
64
65
  info: {
65
66
  header: key
66
67
  }
@@ -18,7 +18,7 @@ import InlineLoading from '../InlineLoading/InlineLoading.js';
18
18
  import { Layer } from '../Layer/index.js';
19
19
  import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
20
20
  import wrapFocus, { wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
21
- import debounce from 'lodash.debounce';
21
+ import { debounce } from 'es-toolkit/compat';
22
22
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
23
23
  import { useId } from '../../internal/useId.js';
24
24
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -61,6 +61,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
61
61
  highContrast = false,
62
62
  onRequestClose,
63
63
  open,
64
+ alignmentAxisOffset,
64
65
  ...rest
65
66
  } = _ref;
66
67
  const prefix = usePrefix();
@@ -86,7 +87,7 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
86
87
  // needs to be placed 1px further outside the popover content. To do so,
87
88
  // we look to see if any of the children has a className containing "slug"
88
89
  const initialCaretHeight = React__default.Children.toArray(children).some(x => {
89
- return x?.props?.className?.includes('slug');
90
+ return x?.props?.className?.includes('slug') || x?.props?.className?.includes('ai-label');
90
91
  }) ? 7 : 6;
91
92
  // These defaults match the defaults defined in packages/styles/scss/components/popover/_popover.scss
92
93
  const popoverDimensions = useRef({
@@ -128,7 +129,10 @@ const Popover = /*#__PURE__*/React__default.forwardRef(function PopoverRenderFun
128
129
  // https://floating-ui.com/docs/misc#clipping
129
130
  strategy: 'fixed',
130
131
  // Middleware order matters, arrow should be last
131
- middleware: [offset(!isTabTip ? popoverDimensions?.current?.offset : 0), autoAlign && flip({
132
+ middleware: [offset(!isTabTip ? {
133
+ alignmentAxis: alignmentAxisOffset,
134
+ mainAxis: popoverDimensions?.current?.offset
135
+ } : 0), autoAlign && flip({
132
136
  fallbackPlacements: align.includes('bottom') ? ['bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'top', 'top-start', 'top-end'] : ['top', 'top-start', 'top-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end'],
133
137
  fallbackStrategy: 'initialPlacement',
134
138
  fallbackAxisSideDirection: 'start',
@@ -121,7 +121,7 @@ const Search = /*#__PURE__*/React__default.forwardRef(function Search(_ref, forw
121
121
  className: searchClasses
122
122
  }, /*#__PURE__*/React__default.createElement("div", {
123
123
  "aria-label": onExpand ? 'button' : undefined,
124
- "aria-labelledby": onExpand ? uniqueId : undefined,
124
+ "aria-labelledby": onExpand ? searchId : undefined,
125
125
  role: onExpand ? 'button' : undefined,
126
126
  className: `${prefix}--search-magnifier`,
127
127
  onClick: onExpand,
@@ -7,6 +7,14 @@
7
7
  import PropTypes from 'prop-types';
8
8
  import { HTMLAttributes } from 'react';
9
9
  export interface SliderSkeletonProps extends HTMLAttributes<HTMLDivElement> {
10
+ /**
11
+ * The `ariaLabel` for the handle icon.
12
+ */
13
+ ariaLabel?: string;
14
+ /**
15
+ * The `ariaLabel` for the upper bound slider handle when there are two handles.
16
+ */
17
+ unstable_ariaLabelHandleUpper?: string;
10
18
  /**
11
19
  * Specify an optional className to add to the form item wrapper.
12
20
  */
@@ -21,8 +29,16 @@ export interface SliderSkeletonProps extends HTMLAttributes<HTMLDivElement> {
21
29
  twoHandles?: boolean;
22
30
  }
23
31
  declare const SliderSkeleton: {
24
- ({ hideLabel, className, twoHandles, ...rest }: SliderSkeletonProps): import("react/jsx-runtime").JSX.Element;
32
+ ({ ariaLabel, unstable_ariaLabelHandleUpper: ariaLabelHandleUpper, hideLabel, className, twoHandles, ...rest }: SliderSkeletonProps): import("react/jsx-runtime").JSX.Element;
25
33
  propTypes: {
34
+ /**
35
+ * The `ariaLabel` for the handle icon.
36
+ */
37
+ ariaLabel: PropTypes.Requireable<string>;
38
+ /**
39
+ * The `ariaLabel` for the upper bound slider handle when there are two handles.
40
+ */
41
+ unstable_ariaLabelHandleUpper: PropTypes.Requireable<string>;
26
42
  /**
27
43
  * Specify an optional className to add to the form item wrapper.
28
44
  */
@@ -13,9 +13,10 @@ import { usePrefix } from '../../internal/usePrefix.js';
13
13
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
14
14
  import { LowerHandle, UpperHandle } from './SliderHandles.js';
15
15
 
16
- var _LowerHandle, _UpperHandle, _UpperHandle2, _LowerHandle2;
17
16
  const SliderSkeleton = _ref => {
18
17
  let {
18
+ ariaLabel = 'slider handle',
19
+ unstable_ariaLabelHandleUpper: ariaLabelHandleUpper = 'upper slider handle',
19
20
  hideLabel,
20
21
  className,
21
22
  twoHandles,
@@ -60,15 +61,31 @@ const SliderSkeleton = _ref => {
60
61
  className: lowerThumbWrapperClasses
61
62
  }, /*#__PURE__*/React__default.createElement("div", {
62
63
  className: lowerThumbClasses
63
- }, twoHandles && !isRtl ? _LowerHandle || (_LowerHandle = /*#__PURE__*/React__default.createElement(LowerHandle, null)) : twoHandles && isRtl ? _UpperHandle || (_UpperHandle = /*#__PURE__*/React__default.createElement(UpperHandle, null)) : undefined)), twoHandles ? /*#__PURE__*/React__default.createElement("div", {
64
+ }, twoHandles && !isRtl ? /*#__PURE__*/React__default.createElement(LowerHandle, {
65
+ "aria-label": ariaLabel
66
+ }) : twoHandles && isRtl ? /*#__PURE__*/React__default.createElement(UpperHandle, {
67
+ "aria-label": ariaLabelHandleUpper
68
+ }) : undefined)), twoHandles ? /*#__PURE__*/React__default.createElement("div", {
64
69
  className: upperThumbWrapperClasses
65
70
  }, /*#__PURE__*/React__default.createElement("div", {
66
71
  className: upperThumbClasses
67
- }, twoHandles && !isRtl ? _UpperHandle2 || (_UpperHandle2 = /*#__PURE__*/React__default.createElement(UpperHandle, null)) : twoHandles && isRtl ? _LowerHandle2 || (_LowerHandle2 = /*#__PURE__*/React__default.createElement(LowerHandle, null)) : undefined)) : undefined), /*#__PURE__*/React__default.createElement("span", {
72
+ }, twoHandles && !isRtl ? /*#__PURE__*/React__default.createElement(UpperHandle, {
73
+ "aria-label": ariaLabelHandleUpper
74
+ }) : twoHandles && isRtl ? /*#__PURE__*/React__default.createElement(LowerHandle, {
75
+ "aria-label": ariaLabel
76
+ }) : undefined)) : undefined), /*#__PURE__*/React__default.createElement("span", {
68
77
  className: `${prefix}--slider__range-label`
69
78
  })));
70
79
  };
71
80
  SliderSkeleton.propTypes = {
81
+ /**
82
+ * The `ariaLabel` for the handle icon.
83
+ */
84
+ ariaLabel: PropTypes.string,
85
+ /**
86
+ * The `ariaLabel` for the upper bound slider handle when there are two handles.
87
+ */
88
+ unstable_ariaLabelHandleUpper: PropTypes.string,
72
89
  /**
73
90
  * Specify an optional className to add to the form item wrapper.
74
91
  */