@carbon/react 1.93.0-rc.0 → 1.94.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 (47) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1048 -1053
  2. package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  3. package/es/components/CodeSnippet/CodeSnippet.js +9 -50
  4. package/es/components/Copy/Copy.d.ts +1 -1
  5. package/es/components/CopyButton/CopyButton.d.ts +1 -1
  6. package/es/components/DataTable/DataTable.d.ts +3 -1
  7. package/es/components/DataTable/DataTable.js +7 -5
  8. package/es/components/DataTable/Table.d.ts +1 -1
  9. package/es/components/DataTable/Table.js +2 -21
  10. package/es/components/DataTable/TableExpandRow.d.ts +4 -0
  11. package/es/components/DataTable/TableRow.js +2 -0
  12. package/es/components/DataTable/TableToolbar.js +1 -0
  13. package/es/components/DataTable/state/sorting.d.ts +4 -2
  14. package/es/components/DatePicker/DatePicker.d.ts +8 -0
  15. package/es/components/DatePicker/DatePicker.js +22 -8
  16. package/es/components/FluidComboBox/FluidComboBox.d.ts +0 -5
  17. package/es/components/FluidComboBox/FluidComboBox.js +0 -5
  18. package/es/components/Popover/index.js +2 -1
  19. package/es/components/Slider/Slider.js +1 -1
  20. package/es/components/Tabs/Tabs.js +3 -45
  21. package/es/components/TreeView/TreeNode.js +5 -0
  22. package/es/components/UIShell/Content.d.ts +1 -1
  23. package/es/tools/events.d.ts +1 -1
  24. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  25. package/lib/components/CodeSnippet/CodeSnippet.js +8 -49
  26. package/lib/components/Copy/Copy.d.ts +1 -1
  27. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  28. package/lib/components/DataTable/DataTable.d.ts +3 -1
  29. package/lib/components/DataTable/DataTable.js +7 -5
  30. package/lib/components/DataTable/Table.d.ts +1 -1
  31. package/lib/components/DataTable/Table.js +1 -20
  32. package/lib/components/DataTable/TableExpandRow.d.ts +4 -0
  33. package/lib/components/DataTable/TableRow.js +2 -0
  34. package/lib/components/DataTable/TableToolbar.js +1 -0
  35. package/lib/components/DataTable/state/sorting.d.ts +4 -2
  36. package/lib/components/DatePicker/DatePicker.d.ts +8 -0
  37. package/lib/components/DatePicker/DatePicker.js +22 -8
  38. package/lib/components/FluidComboBox/FluidComboBox.d.ts +0 -5
  39. package/lib/components/FluidComboBox/FluidComboBox.js +0 -5
  40. package/lib/components/Popover/index.js +2 -1
  41. package/lib/components/Slider/Slider.js +1 -1
  42. package/lib/components/Tabs/Tabs.js +2 -44
  43. package/lib/components/TreeView/TreeNode.js +5 -0
  44. package/lib/components/UIShell/Content.d.ts +1 -1
  45. package/lib/tools/events.d.ts +1 -1
  46. package/package.json +8 -8
  47. package/telemetry.yml +2 -0
@@ -111,7 +111,7 @@ declare namespace CodeSnippet {
111
111
  /**
112
112
  * Specify how the trigger should align with the tooltip
113
113
  */
114
- align: PropTypes.Requireable<string> | PropTypes.Validator<string>;
114
+ align: PropTypes.Requireable<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top"> | PropTypes.Validator<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top">;
115
115
  /**
116
116
  * Specify a label to be read by screen readers on the containing textbox
117
117
  * node
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import PropTypes from 'prop-types';
10
- import React, { useState, useRef, useCallback, useEffect } from 'react';
10
+ import React, { useState, useRef, useCallback } from 'react';
11
11
  import cx from 'classnames';
12
12
  import { useResizeObserver } from '../../internal/useResizeObserver.js';
13
13
  import { ChevronDown } from '@carbon/icons-react';
@@ -60,8 +60,6 @@ function CodeSnippet({
60
60
  const codeContentRef = useRef(null);
61
61
  const codeContainerRef = useRef(null);
62
62
  const innerCodeRef = useRef(null);
63
- const [hasLeftOverflow, setHasLeftOverflow] = useState(false);
64
- const [hasRightOverflow, setHasRightOverflow] = useState(false);
65
63
  const getCodeRef = useCallback(() => {
66
64
  if (type === 'single') {
67
65
  return codeContainerRef;
@@ -73,39 +71,13 @@ function CodeSnippet({
73
71
  }
74
72
  }, [type]);
75
73
  const prefix = usePrefix();
76
- const getCodeRefDimensions = useCallback(() => {
77
- const {
78
- clientWidth: codeClientWidth = 0,
79
- scrollLeft: codeScrollLeft = 0,
80
- scrollWidth: codeScrollWidth = 0
81
- } = getCodeRef().current || {};
82
- return {
83
- horizontalOverflow: codeScrollWidth > codeClientWidth,
84
- codeClientWidth,
85
- codeScrollWidth,
86
- codeScrollLeft
87
- };
88
- }, [getCodeRef]);
89
- const handleScroll = useCallback(() => {
90
- if (type === 'inline' || type === 'single' && !codeContainerRef?.current || type === 'multi' && !codeContentRef?.current) {
91
- return;
92
- }
93
- const {
94
- horizontalOverflow,
95
- codeClientWidth,
96
- codeScrollWidth,
97
- codeScrollLeft
98
- } = getCodeRefDimensions();
99
- setHasLeftOverflow(horizontalOverflow && !!codeScrollLeft);
100
- setHasRightOverflow(horizontalOverflow && codeScrollLeft + codeClientWidth !== codeScrollWidth);
101
- }, [type, getCodeRefDimensions]);
102
74
  useResizeObserver({
103
75
  ref: getCodeRef(),
104
76
  onResize: () => {
105
- if (codeContentRef?.current && type === 'multi') {
77
+ if (innerCodeRef?.current && type === 'multi') {
106
78
  const {
107
79
  height
108
- } = codeContentRef.current.getBoundingClientRect();
80
+ } = innerCodeRef.current.getBoundingClientRect();
109
81
  if (maxCollapsedNumberOfRows > 0 && (maxExpandedNumberOfRows <= 0 || maxExpandedNumberOfRows > maxCollapsedNumberOfRows) && height > maxCollapsedNumberOfRows * rowHeightInPixels) {
110
82
  setShouldShowMoreLessBtn(true);
111
83
  } else {
@@ -115,14 +87,8 @@ function CodeSnippet({
115
87
  setExpandedCode(false);
116
88
  }
117
89
  }
118
- if (codeContentRef?.current && type === 'multi' || codeContainerRef?.current && type === 'single') {
119
- handleScroll();
120
- }
121
90
  }
122
91
  });
123
- useEffect(() => {
124
- handleScroll();
125
- }, [handleScroll]);
126
92
  const handleCopyClick = evt => {
127
93
  if (copyText || innerCodeRef?.current) {
128
94
  copy(copyText ?? innerCodeRef?.current?.innerText ?? '');
@@ -137,8 +103,7 @@ function CodeSnippet({
137
103
  [`${prefix}--snippet--expand`]: expandedCode,
138
104
  [`${prefix}--snippet--light`]: light,
139
105
  [`${prefix}--snippet--no-copy`]: hideCopyButton,
140
- [`${prefix}--snippet--wraptext`]: wrapText,
141
- [`${prefix}--snippet--has-right-overflow`]: type == 'multi' && hasRightOverflow
106
+ [`${prefix}--snippet--wraptext`]: wrapText
142
107
  });
143
108
  const expandCodeBtnText = expandedCode ? showLessText : showMoreText;
144
109
  if (type === 'inline') {
@@ -196,18 +161,12 @@ function CodeSnippet({
196
161
  className: `${prefix}--snippet-container`,
197
162
  "aria-label": deprecatedAriaLabel || ariaLabel || 'code-snippet',
198
163
  "aria-readonly": type === 'single' || type === 'multi' ? true : undefined,
199
- "aria-multiline": type === 'multi' ? true : undefined,
200
- onScroll: type === 'single' && handleScroll || undefined
201
- }, containerStyle), /*#__PURE__*/React.createElement("pre", {
202
- ref: codeContentRef,
203
- onScroll: type === 'multi' && handleScroll || undefined
204
- }, /*#__PURE__*/React.createElement("code", {
164
+ "aria-multiline": type === 'multi' ? true : undefined
165
+ }, containerStyle), /*#__PURE__*/React.createElement("pre", _extends({
166
+ ref: codeContentRef
167
+ }, containerStyle), /*#__PURE__*/React.createElement("code", {
205
168
  ref: innerCodeRef
206
- }, children))), hasLeftOverflow && /*#__PURE__*/React.createElement("div", {
207
- className: `${prefix}--snippet__overflow-indicator--left`
208
- }), hasRightOverflow && type !== 'multi' && /*#__PURE__*/React.createElement("div", {
209
- className: `${prefix}--snippet__overflow-indicator--right`
210
- }), !hideCopyButton && /*#__PURE__*/React.createElement(CopyButton, {
169
+ }, children))), !hideCopyButton && /*#__PURE__*/React.createElement(CopyButton, {
211
170
  align: align,
212
171
  autoAlign: autoAlign,
213
172
  size: type === 'multi' ? 'sm' : 'md',
@@ -50,7 +50,7 @@ declare namespace Copy {
50
50
  /**
51
51
  * Specify how the trigger should align with the tooltip
52
52
  */
53
- align: PropTypes.Requireable<string> | PropTypes.Validator<string>;
53
+ align: PropTypes.Requireable<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top"> | PropTypes.Validator<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top">;
54
54
  /**
55
55
  * **Experimental**: Will attempt to automatically align the tooltip. Requires
56
56
  * React v17+
@@ -51,7 +51,7 @@ declare namespace CopyButton {
51
51
  /**
52
52
  * Specify how the trigger should align with the tooltip
53
53
  */
54
- align: PropTypes.Requireable<string> | PropTypes.Validator<string>;
54
+ align: PropTypes.Requireable<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top"> | PropTypes.Validator<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top">;
55
55
  /**
56
56
  * **Experimental**: Will attempt to automatically align the tooltip. Requires
57
57
  * React v17+
@@ -92,6 +92,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
92
92
  isExpanded: boolean;
93
93
  onExpand: (event: MouseEvent<HTMLButtonElement>) => void;
94
94
  [key: string]: unknown;
95
+ id: string;
95
96
  };
96
97
  getRowProps: (options: {
97
98
  onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
@@ -105,6 +106,7 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
105
106
  key: string;
106
107
  onExpand: (event: MouseEvent<HTMLButtonElement>) => void;
107
108
  [key: string]: unknown;
109
+ expandHeader: string;
108
110
  };
109
111
  getExpandedRowProps: (options: {
110
112
  row: DataTableRow<ColTypes>;
@@ -234,7 +236,7 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
234
236
  export declare const DataTable: {
235
237
  <RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
236
238
  Table: {
237
- ({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, tabIndex, ...other }: React.PropsWithChildren<import("./Table").TableProps>): import("react/jsx-runtime").JSX.Element;
239
+ ({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, ...other }: React.PropsWithChildren<import("./Table").TableProps>): import("react/jsx-runtime").JSX.Element;
238
240
  propTypes: {
239
241
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
240
242
  className: PropTypes.Requireable<string>;
@@ -194,9 +194,10 @@ const DataTable = props => {
194
194
  ...rest,
195
195
  'aria-label': t(translationKey),
196
196
  // Provide a string of all expanded row IDs, separated by a space.
197
- 'aria-controls': rowIds.map(id => `expanded-row-${id}`).join(' '),
197
+ 'aria-controls': rowIds.map(id => `${getTablePrefix()}-expanded-row-${id}`).join(' '),
198
198
  isExpanded,
199
- onExpand: composeEventHandlers(handlers)
199
+ onExpand: composeEventHandlers(handlers),
200
+ id: `${getTablePrefix()}-expand`
200
201
  };
201
202
  };
202
203
 
@@ -228,9 +229,10 @@ const DataTable = props => {
228
229
  onExpand: composeEventHandlers([handleOnExpandRow(row.id), onClick]),
229
230
  isExpanded: row.isExpanded,
230
231
  'aria-label': t(translationKey),
231
- 'aria-controls': `expanded-row-${row.id}`,
232
+ 'aria-controls': `${getTablePrefix()}-expanded-row-${row.id}`,
232
233
  isSelected: row.isSelected,
233
- disabled: row.disabled
234
+ disabled: row.disabled,
235
+ expandHeader: `${getTablePrefix()}-expand`
234
236
  };
235
237
  };
236
238
  const getExpandedRowProps = ({
@@ -239,7 +241,7 @@ const DataTable = props => {
239
241
  }) => {
240
242
  return {
241
243
  ...rest,
242
- id: `expanded-row-${row.id}`
244
+ id: `${getTablePrefix()}-expanded-row-${row.id}`
243
245
  };
244
246
  };
245
247
 
@@ -39,7 +39,7 @@ export interface TableProps {
39
39
  tabIndex?: number;
40
40
  }
41
41
  export declare const Table: {
42
- ({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, tabIndex, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
42
+ ({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
43
43
  propTypes: {
44
44
  /**
45
45
  * Pass in the children that will be rendered within the Table
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React, { useContext, useState, useRef, useCallback } from 'react';
9
+ import React, { useContext, useRef, useCallback } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import { usePrefix } from '../../internal/usePrefix.js';
@@ -53,7 +53,6 @@ const Table = ({
53
53
  stickyHeader,
54
54
  overflowMenuOnHover = true,
55
55
  experimentalAutoAlign = false,
56
- tabIndex,
57
56
  ...other
58
57
  }) => {
59
58
  const {
@@ -61,7 +60,6 @@ const Table = ({
61
60
  descriptionId
62
61
  } = useContext(TableContext);
63
62
  const prefix = usePrefix();
64
- const [isScrollable, setIsScrollable] = useState(false);
65
63
  const tableRef = useRef(null);
66
64
  const componentClass = cx(`${prefix}--data-table`, className, {
67
65
  [`${prefix}--data-table--${size}`]: size,
@@ -100,22 +98,6 @@ const Table = ({
100
98
  const debouncedSetTableAlignment = debounce(setTableAlignment, 100);
101
99
  useWindowEvent('resize', debouncedSetTableAlignment);
102
100
 
103
- // Used to set a tabIndex when the Table is horizontally scrollable
104
- const setTabIndex = useCallback(() => {
105
- const tableContainer = tableRef?.current?.parentNode;
106
- const tableHeader = tableRef?.current?.firstChild;
107
- if (tableHeader?.scrollWidth > tableContainer?.clientWidth) {
108
- setIsScrollable(true);
109
- } else {
110
- setIsScrollable(false);
111
- }
112
- }, []);
113
- const debouncedSetTabIndex = debounce(setTabIndex, 100);
114
- useWindowEvent('resize', debouncedSetTabIndex);
115
- useIsomorphicEffect(() => {
116
- setTabIndex();
117
- }, [setTabIndex]);
118
-
119
101
  // recalculate table alignment once fonts have loaded
120
102
  if (typeof document !== 'undefined' && document?.fonts?.status && document.fonts.status !== 'loaded') {
121
103
  document.fonts.ready.then(() => {
@@ -126,8 +108,7 @@ const Table = ({
126
108
  setTableAlignment();
127
109
  }, [setTableAlignment, size]);
128
110
  const table = /*#__PURE__*/React.createElement("div", {
129
- className: `${prefix}--data-table-content`,
130
- tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
111
+ className: `${prefix}--data-table-content`
131
112
  }, /*#__PURE__*/React.createElement("table", _extends({
132
113
  "aria-labelledby": titleId,
133
114
  "aria-describedby": descriptionId
@@ -33,6 +33,10 @@ export interface TableRowExpandInteropProps {
33
33
  * Specify if the row is selected.
34
34
  */
35
35
  isSelected?: boolean;
36
+ /**
37
+ * 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
38
+ */
39
+ expandHeader?: string;
36
40
  }
37
41
  export interface TableExpandRowProps extends PropsWithChildren<Omit<HTMLAttributes<HTMLTableRowElement>, 'onClick'>>, Omit<TableRowExpandInteropProps, 'aria-label' | 'onExpand'> {
38
42
  /**
@@ -31,6 +31,8 @@ const TableRow = frFn((props, ref) => {
31
31
  isExpanded,
32
32
  // eslint-disable-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
33
33
  isSelected,
34
+ expandHeader,
35
+ // eslint-disable-line @typescript-eslint/no-unused-vars
34
36
  ...cleanProps
35
37
  } = props;
36
38
  const prefix = usePrefix();
@@ -25,6 +25,7 @@ const TableToolbar = ({
25
25
  [`${prefix}--table-toolbar--${size}`]: size
26
26
  });
27
27
  return /*#__PURE__*/React.createElement("section", _extends({
28
+ role: "group",
28
29
  "aria-label": deprecatedAriaLabel || ariaLabel
29
30
  }, rest, {
30
31
  className: className
@@ -43,7 +43,8 @@ export declare const getNextSortDirection: (prevHeader: string, currentHeader: s
43
43
  * @param state - Current table state.
44
44
  * @param key - Header key to sort by.
45
45
  */
46
- export declare const getNextSortState: <ColTypes extends any[]>(props: Props, state: State<ColTypes>, { key }: {
46
+ export declare const getNextSortState: <ColTypes extends any[]>(// eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
47
+ props: Props, state: State<ColTypes>, { key }: {
47
48
  key: string;
48
49
  }) => Pick<State<ColTypes>, "sortHeaderKey" | "sortDirection" | "rowIds">;
49
50
  /**
@@ -54,5 +55,6 @@ export declare const getNextSortState: <ColTypes extends any[]>(props: Props, st
54
55
  * @param key - Header key to sort by.
55
56
  * @param sortDirection - Sort direction to apply.
56
57
  */
57
- export declare const getSortedState: <ColTypes extends any[]>({ locale, sortRow }: Props, { rowIds, cellsById, initialRowOrder }: State<ColTypes>, key: string, sortDirection: DataTableSortState) => Pick<State<ColTypes>, "rowIds" | "sortDirection" | "sortHeaderKey">;
58
+ export declare const getSortedState: <ColTypes extends any[]>(// eslint-disable-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
59
+ { locale, sortRow }: Props, { rowIds, cellsById, initialRowOrder }: State<ColTypes>, key: string, sortDirection: DataTableSortState) => Pick<State<ColTypes>, "rowIds" | "sortDirection" | "sortHeaderKey">;
58
60
  export {};
@@ -117,6 +117,14 @@ export interface DatePickerProps {
117
117
  * Provide the text that is displayed when the control is in warning state (Fluid only)
118
118
  */
119
119
  warnText?: ReactNode;
120
+ /**
121
+ * Accessible aria-label for the "next month" arrow icon.
122
+ */
123
+ nextMonthAriaLabel?: string;
124
+ /**
125
+ * Accessible aria-label for the "previous month" arrow icon.
126
+ */
127
+ prevMonthAriaLabel?: string;
120
128
  }
121
129
  declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>;
122
130
  export default DatePicker;
@@ -105,12 +105,6 @@ const carbonFlatpickrMonthSelectPlugin = config => fp => {
105
105
  function isLabelTextEmpty(children) {
106
106
  return children.every(child => !child.props.labelText);
107
107
  }
108
- const rightArrowHTML = `<svg width="16px" height="16px" viewBox="0 0 16 16">
109
- <polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
110
- </svg>`;
111
- const leftArrowHTML = `<svg width="16px" height="16px" viewBox="0 0 16 16">
112
- <polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
113
- </svg>`;
114
108
  function updateClassNames(calendar, prefix) {
115
109
  const calendarContainer = calendar.calendarContainer;
116
110
  const daysContainer = calendar.days;
@@ -162,6 +156,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
162
156
  short = false,
163
157
  value,
164
158
  parseDate: parseDateProp,
159
+ nextMonthAriaLabel = 'Next month',
160
+ prevMonthAriaLabel = 'Previous month',
165
161
  ...rest
166
162
  }, ref) {
167
163
  const prefix = usePrefix();
@@ -342,6 +338,16 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
342
338
  } else if (parseDateProp) {
343
339
  parseDate = parseDateProp;
344
340
  }
341
+
342
+ // Accessible arrow icons (localized manually)
343
+ // Flatpickr does not currently support localization of next/previous month
344
+ // labels, so we inject translated aria-labels based on the provided locale.
345
+ const rightArrowHTML = `<svg aria-label="${nextMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
346
+ <polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
347
+ </svg>`;
348
+ const leftArrowHTML = `<svg aria-label="${prevMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
349
+ <polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
350
+ </svg>`;
345
351
  const {
346
352
  current: start
347
353
  } = startInputField;
@@ -519,7 +525,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
519
525
  }
520
526
  };
521
527
  // eslint-disable-next-line react-hooks/exhaustive-deps
522
- }, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType]);
528
+ }, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType, nextMonthAriaLabel, prevMonthAriaLabel]);
523
529
 
524
530
  // this hook allows consumers to access the flatpickr calendar
525
531
  // instance for cases where functions like open() or close()
@@ -874,7 +880,15 @@ DatePicker.propTypes = {
874
880
  /**
875
881
  * Provide the text that is displayed when the control is in warning state (Fluid only)
876
882
  */
877
- warnText: PropTypes.node
883
+ warnText: PropTypes.node,
884
+ /**
885
+ * Accessible aria-label for the "next month" arrow icon.
886
+ */
887
+ nextMonthAriaLabel: PropTypes.string,
888
+ /**
889
+ * Accessible aria-label for the "previous month" arrow icon.
890
+ */
891
+ prevMonthAriaLabel: PropTypes.string
878
892
  };
879
893
 
880
894
  export { DatePicker as default };
@@ -72,11 +72,6 @@ export interface FluidComboBoxProps<ItemType> extends ComboBoxProps<ItemType>, P
72
72
  * consuming component what kind of internal state changes are occurring.
73
73
  */
74
74
  onChange: (data: OnChangeData<ItemType>) => void;
75
- /**
76
- * An optional callback to render the currently selected item as a react element instead of only
77
- * as a string.
78
- */
79
- renderSelectedItem?: (selectedItem: ItemType) => React.ReactNode;
80
75
  /**
81
76
  * In the case you want to control the dropdown selection entirely.
82
77
  * */
@@ -91,11 +91,6 @@ FluidComboBox.propTypes = {
91
91
  * consuming component what kind of internal state changes are occurring.
92
92
  */
93
93
  onChange: PropTypes.func.isRequired,
94
- /**
95
- * An optional callback to render the currently selected item as a react element instead of only
96
- * as a string.
97
- */
98
- renderSelectedItem: PropTypes.func,
99
94
  /**
100
95
  * In the case you want to control the dropdown selection entirely.
101
96
  */
@@ -149,7 +149,8 @@ forwardRef) {
149
149
  fallbackAxisSideDirection: 'start',
150
150
  boundary: autoAlignBoundary
151
151
  }), arrow({
152
- element: caretRef
152
+ element: caretRef,
153
+ padding: 16
153
154
  }), autoAlign && hide()],
154
155
  whileElementsMounted: autoUpdate
155
156
  } : {}
@@ -755,7 +755,7 @@ const Slider = props => {
755
755
  * as the step.
756
756
  */
757
757
  const calcValueForDelta = (currentValue, delta, step = 1) => {
758
- const base = delta > 0 ? Math.floor(currentValue / step) * step : currentValue;
758
+ const base = delta > 0 ? Math.round(currentValue / step) * step : currentValue;
759
759
  const newValue = base + delta;
760
760
  // TODO: Why is the logical OR needed here?
761
761
  const decimals = (step.toString().split('.')[1] || '').length;
@@ -10,7 +10,7 @@ import { Close, ChevronLeft, ChevronRight } from '@carbon/icons-react';
10
10
  import { breakpoints } from '@carbon/layout';
11
11
  import cx from 'classnames';
12
12
  import PropTypes from 'prop-types';
13
- import React, { forwardRef, createContext, useRef, useState, useMemo, isValidElement, useEffect, useCallback } from 'react';
13
+ import React, { forwardRef, createContext, useRef, useState, useMemo, isValidElement, useCallback, useEffect } from 'react';
14
14
  import '../Grid/FlexGrid.js';
15
15
  import { Grid as GridAsGridComponent } from '../Grid/Grid.js';
16
16
  import '../Grid/Row.js';
@@ -24,7 +24,6 @@ import { useControllableState } from '../../internal/useControllableState.js';
24
24
  import { useId } from '../../internal/useId.js';
25
25
  import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
26
26
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
27
- import { getInteractiveContent } from '../../internal/useNoInteractiveChildren.js';
28
27
  import { usePrefix } from '../../internal/usePrefix.js';
29
28
  import { Delete, ArrowRight, ArrowLeft, Home, End, ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
30
29
  import { match, matches } from '../../internal/keyboard/match.js';
@@ -1110,10 +1109,6 @@ const TabPanel = /*#__PURE__*/React.forwardRef(({
1110
1109
  ...rest
1111
1110
  }, forwardRef) => {
1112
1111
  const prefix = usePrefix();
1113
- const panel = useRef(null);
1114
- const ref = useMergedRefs([forwardRef, panel]);
1115
- const [tabIndex, setTabIndex] = useState(0);
1116
- const [interactiveContent, setInteractiveContent] = useState(false);
1117
1112
  const {
1118
1113
  selectedIndex,
1119
1114
  baseId
@@ -1121,50 +1116,13 @@ const TabPanel = /*#__PURE__*/React.forwardRef(({
1121
1116
  const index = React.useContext(TabPanelContext);
1122
1117
  const id = `${baseId}-tabpanel-${index}`;
1123
1118
  const tabId = `${baseId}-tab-${index}`;
1124
- const className = cx(`${prefix}--tab-content`, customClassName, {
1125
- [`${prefix}--tab-content--interactive`]: interactiveContent
1126
- });
1127
- useEffect(() => {
1128
- if (!panel.current) {
1129
- return;
1130
- }
1131
- const content = getInteractiveContent(panel.current);
1132
- if (content) {
1133
- setInteractiveContent(true);
1134
- setTabIndex(-1);
1135
- }
1136
- }, []);
1137
-
1138
- // tabindex should only be 0 if no interactive content in children
1139
- useEffect(() => {
1140
- const node = panel.current;
1141
- if (!node) {
1142
- return;
1143
- }
1144
- function callback() {
1145
- const content = getInteractiveContent(node);
1146
- if (content) {
1147
- setInteractiveContent(true);
1148
- setTabIndex(-1);
1149
- } else {
1150
- setInteractiveContent(false);
1151
- setTabIndex(0);
1152
- }
1153
- }
1154
- const observer = new MutationObserver(callback);
1155
- observer.observe(node, {
1156
- childList: true,
1157
- subtree: true
1158
- });
1159
- return () => observer.disconnect();
1160
- }, []);
1119
+ const className = cx(`${prefix}--tab-content`, customClassName);
1161
1120
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
1162
1121
  "aria-labelledby": tabId,
1163
1122
  id: id,
1164
1123
  className: className,
1165
- ref: ref,
1124
+ ref: forwardRef,
1166
1125
  role: "tabpanel",
1167
- tabIndex: tabIndex,
1168
1126
  hidden: selectedIndex !== index
1169
1127
  }), children);
1170
1128
  });
@@ -142,6 +142,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
142
142
  const currentNode = useRef(null);
143
143
  const currentNodeLabel = useRef(null);
144
144
  const prefix = usePrefix();
145
+ const nodeLabelId = `${id}__label`;
145
146
  const renderLabelText = () => {
146
147
  if (isEllipsisApplied && tooltipText) {
147
148
  return /*#__PURE__*/React.createElement(IconButton, {
@@ -152,11 +153,13 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
152
153
  className: `${prefix}--tree-node__label__text-button`,
153
154
  wrapperClasses: `${prefix}--popover-container`
154
155
  }, /*#__PURE__*/React.createElement("span", {
156
+ id: nodeLabelId,
155
157
  ref: labelTextRef,
156
158
  className: `${prefix}--tree-node__label__text`
157
159
  }, label));
158
160
  }
159
161
  return /*#__PURE__*/React.createElement("span", {
162
+ id: nodeLabelId,
160
163
  ref: labelTextRef,
161
164
  className: `${prefix}--tree-node__label__text`
162
165
  }, label);
@@ -395,6 +398,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
395
398
  }), nodeContent), children && /*#__PURE__*/React.createElement("ul", {
396
399
  id: `${id}-subtree`,
397
400
  role: "group",
401
+ "aria-labelledby": nodeLabelId,
398
402
  className: cx(`${prefix}--tree-node__children`, {
399
403
  [`${prefix}--tree-node--hidden`]: !expanded
400
404
  })
@@ -408,6 +412,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
408
412
  }), nodeContent, children && /*#__PURE__*/React.createElement("ul", {
409
413
  id: `${id}-subtree`,
410
414
  role: "group",
415
+ "aria-labelledby": nodeLabelId,
411
416
  className: cx(`${prefix}--tree-node__children`, {
412
417
  [`${prefix}--tree-node--hidden`]: !expanded
413
418
  })
@@ -69,7 +69,7 @@ declare const Content: {
69
69
  results?: number | undefined;
70
70
  security?: string | undefined;
71
71
  unselectable?: "on" | "off" | undefined;
72
- popover?: "" | "auto" | "manual" | undefined;
72
+ popover?: "" | "auto" | "manual" | "hint" | undefined;
73
73
  popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
74
74
  popoverTarget?: string | undefined;
75
75
  inert?: boolean | undefined;
@@ -14,4 +14,4 @@ import type { SyntheticEvent } from 'react';
14
14
  * @param handlers - An array of event handler functions.
15
15
  * @returns A composite event handler.
16
16
  */
17
- export declare const composeEventHandlers: <E extends SyntheticEvent = SyntheticEvent<Element, Event>>(handlers: (((event: E, ...args: any[]) => void) | undefined)[]) => (event: E, ...args: any[]) => void;
17
+ export declare const composeEventHandlers: <E extends SyntheticEvent = SyntheticEvent>(handlers: (((event: E, ...args: any[]) => void) | undefined)[]) => (event: E, ...args: any[]) => void;
@@ -111,7 +111,7 @@ declare namespace CodeSnippet {
111
111
  /**
112
112
  * Specify how the trigger should align with the tooltip
113
113
  */
114
- align: PropTypes.Requireable<string> | PropTypes.Validator<string>;
114
+ align: PropTypes.Requireable<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top"> | PropTypes.Validator<import("@floating-ui/utils").Placement | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-bottom" | "left-top" | "right-bottom" | "right-top">;
115
115
  /**
116
116
  * Specify a label to be read by screen readers on the containing textbox
117
117
  * node