@carbon/react 1.93.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 (37) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +923 -923
  2. package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  3. package/es/components/Copy/Copy.d.ts +1 -1
  4. package/es/components/CopyButton/CopyButton.d.ts +1 -1
  5. package/es/components/DataTable/DataTable.d.ts +1 -1
  6. package/es/components/DataTable/Table.d.ts +1 -1
  7. package/es/components/DataTable/Table.js +2 -21
  8. package/es/components/DataTable/TableToolbar.js +1 -0
  9. package/es/components/DataTable/state/sorting.d.ts +4 -2
  10. package/es/components/DatePicker/DatePicker.d.ts +8 -0
  11. package/es/components/DatePicker/DatePicker.js +22 -8
  12. package/es/components/FluidComboBox/FluidComboBox.d.ts +0 -5
  13. package/es/components/FluidComboBox/FluidComboBox.js +0 -5
  14. package/es/components/Slider/Slider.js +1 -1
  15. package/es/components/Tabs/Tabs.js +3 -45
  16. package/es/components/TreeView/TreeNode.js +5 -0
  17. package/es/components/UIShell/Content.d.ts +1 -1
  18. package/es/tools/events.d.ts +1 -1
  19. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  20. package/lib/components/Copy/Copy.d.ts +1 -1
  21. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  22. package/lib/components/DataTable/DataTable.d.ts +1 -1
  23. package/lib/components/DataTable/Table.d.ts +1 -1
  24. package/lib/components/DataTable/Table.js +1 -20
  25. package/lib/components/DataTable/TableToolbar.js +1 -0
  26. package/lib/components/DataTable/state/sorting.d.ts +4 -2
  27. package/lib/components/DatePicker/DatePicker.d.ts +8 -0
  28. package/lib/components/DatePicker/DatePicker.js +22 -8
  29. package/lib/components/FluidComboBox/FluidComboBox.d.ts +0 -5
  30. package/lib/components/FluidComboBox/FluidComboBox.js +0 -5
  31. package/lib/components/Slider/Slider.js +1 -1
  32. package/lib/components/Tabs/Tabs.js +2 -44
  33. package/lib/components/TreeView/TreeNode.js +5 -0
  34. package/lib/components/UIShell/Content.d.ts +1 -1
  35. package/lib/tools/events.d.ts +1 -1
  36. package/package.json +4 -4
  37. 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
@@ -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+
@@ -236,7 +236,7 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
236
236
  export declare const DataTable: {
237
237
  <RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
238
238
  Table: {
239
- ({ 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;
240
240
  propTypes: {
241
241
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
242
242
  className: PropTypes.Requireable<string>;
@@ -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
@@ -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
  */
@@ -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
@@ -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+
@@ -236,7 +236,7 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
236
236
  export declare const DataTable: {
237
237
  <RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
238
238
  Table: {
239
- ({ 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;
240
240
  propTypes: {
241
241
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
242
242
  className: PropTypes.Requireable<string>;
@@ -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
@@ -57,7 +57,6 @@ const Table = ({
57
57
  stickyHeader,
58
58
  overflowMenuOnHover = true,
59
59
  experimentalAutoAlign = false,
60
- tabIndex,
61
60
  ...other
62
61
  }) => {
63
62
  const {
@@ -65,7 +64,6 @@ const Table = ({
65
64
  descriptionId
66
65
  } = React.useContext(TableContext.TableContext);
67
66
  const prefix = usePrefix.usePrefix();
68
- const [isScrollable, setIsScrollable] = React.useState(false);
69
67
  const tableRef = React.useRef(null);
70
68
  const componentClass = cx(`${prefix}--data-table`, className, {
71
69
  [`${prefix}--data-table--${size}`]: size,
@@ -104,22 +102,6 @@ const Table = ({
104
102
  const debouncedSetTableAlignment = debounce.debounce(setTableAlignment, 100);
105
103
  useEvent.useWindowEvent('resize', debouncedSetTableAlignment);
106
104
 
107
- // Used to set a tabIndex when the Table is horizontally scrollable
108
- const setTabIndex = React.useCallback(() => {
109
- const tableContainer = tableRef?.current?.parentNode;
110
- const tableHeader = tableRef?.current?.firstChild;
111
- if (tableHeader?.scrollWidth > tableContainer?.clientWidth) {
112
- setIsScrollable(true);
113
- } else {
114
- setIsScrollable(false);
115
- }
116
- }, []);
117
- const debouncedSetTabIndex = debounce.debounce(setTabIndex, 100);
118
- useEvent.useWindowEvent('resize', debouncedSetTabIndex);
119
- useIsomorphicEffect.default(() => {
120
- setTabIndex();
121
- }, [setTabIndex]);
122
-
123
105
  // recalculate table alignment once fonts have loaded
124
106
  if (typeof document !== 'undefined' && document?.fonts?.status && document.fonts.status !== 'loaded') {
125
107
  document.fonts.ready.then(() => {
@@ -130,8 +112,7 @@ const Table = ({
130
112
  setTableAlignment();
131
113
  }, [setTableAlignment, size]);
132
114
  const table = /*#__PURE__*/React.createElement("div", {
133
- className: `${prefix}--data-table-content`,
134
- tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
115
+ className: `${prefix}--data-table-content`
135
116
  }, /*#__PURE__*/React.createElement("table", _rollupPluginBabelHelpers.extends({
136
117
  "aria-labelledby": titleId,
137
118
  "aria-describedby": descriptionId
@@ -29,6 +29,7 @@ const TableToolbar = ({
29
29
  [`${prefix}--table-toolbar--${size}`]: size
30
30
  });
31
31
  return /*#__PURE__*/React.createElement("section", _rollupPluginBabelHelpers.extends({
32
+ role: "group",
32
33
  "aria-label": deprecatedAriaLabel || ariaLabel
33
34
  }, rest, {
34
35
  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;
@@ -109,12 +109,6 @@ const carbonFlatpickrMonthSelectPlugin = config => fp => {
109
109
  function isLabelTextEmpty(children) {
110
110
  return children.every(child => !child.props.labelText);
111
111
  }
112
- const rightArrowHTML = `<svg width="16px" height="16px" viewBox="0 0 16 16">
113
- <polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
114
- </svg>`;
115
- const leftArrowHTML = `<svg width="16px" height="16px" viewBox="0 0 16 16">
116
- <polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
117
- </svg>`;
118
112
  function updateClassNames(calendar, prefix) {
119
113
  const calendarContainer = calendar.calendarContainer;
120
114
  const daysContainer = calendar.days;
@@ -166,6 +160,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
166
160
  short = false,
167
161
  value,
168
162
  parseDate: parseDateProp,
163
+ nextMonthAriaLabel = 'Next month',
164
+ prevMonthAriaLabel = 'Previous month',
169
165
  ...rest
170
166
  }, ref) {
171
167
  const prefix = usePrefix.usePrefix();
@@ -346,6 +342,16 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
346
342
  } else if (parseDateProp) {
347
343
  parseDate = parseDateProp;
348
344
  }
345
+
346
+ // Accessible arrow icons (localized manually)
347
+ // Flatpickr does not currently support localization of next/previous month
348
+ // labels, so we inject translated aria-labels based on the provided locale.
349
+ const rightArrowHTML = `<svg aria-label="${nextMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
350
+ <polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
351
+ </svg>`;
352
+ const leftArrowHTML = `<svg aria-label="${prevMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
353
+ <polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
354
+ </svg>`;
349
355
  const {
350
356
  current: start
351
357
  } = startInputField;
@@ -523,7 +529,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
523
529
  }
524
530
  };
525
531
  // eslint-disable-next-line react-hooks/exhaustive-deps
526
- }, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType]);
532
+ }, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType, nextMonthAriaLabel, prevMonthAriaLabel]);
527
533
 
528
534
  // this hook allows consumers to access the flatpickr calendar
529
535
  // instance for cases where functions like open() or close()
@@ -878,7 +884,15 @@ DatePicker.propTypes = {
878
884
  /**
879
885
  * Provide the text that is displayed when the control is in warning state (Fluid only)
880
886
  */
881
- warnText: PropTypes.node
887
+ warnText: PropTypes.node,
888
+ /**
889
+ * Accessible aria-label for the "next month" arrow icon.
890
+ */
891
+ nextMonthAriaLabel: PropTypes.string,
892
+ /**
893
+ * Accessible aria-label for the "previous month" arrow icon.
894
+ */
895
+ prevMonthAriaLabel: PropTypes.string
882
896
  };
883
897
 
884
898
  exports.default = DatePicker;
@@ -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
  * */
@@ -95,11 +95,6 @@ FluidComboBox.propTypes = {
95
95
  * consuming component what kind of internal state changes are occurring.
96
96
  */
97
97
  onChange: PropTypes.func.isRequired,
98
- /**
99
- * An optional callback to render the currently selected item as a react element instead of only
100
- * as a string.
101
- */
102
- renderSelectedItem: PropTypes.func,
103
98
  /**
104
99
  * In the case you want to control the dropdown selection entirely.
105
100
  */
@@ -757,7 +757,7 @@ const Slider = props => {
757
757
  * as the step.
758
758
  */
759
759
  const calcValueForDelta = (currentValue, delta, step = 1) => {
760
- const base = delta > 0 ? Math.floor(currentValue / step) * step : currentValue;
760
+ const base = delta > 0 ? Math.round(currentValue / step) * step : currentValue;
761
761
  const newValue = base + delta;
762
762
  // TODO: Why is the logical OR needed here?
763
763
  const decimals = (step.toString().split('.')[1] || '').length;