@carbon/react 1.93.0 → 1.94.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 (59) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1034 -1009
  2. package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  3. package/es/components/ComposedModal/ComposedModal.js +3 -1
  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 +1 -1
  7. package/es/components/DataTable/Table.d.ts +1 -1
  8. package/es/components/DataTable/Table.js +2 -21
  9. package/es/components/DataTable/TableToolbar.js +1 -0
  10. package/es/components/DataTable/state/sorting.d.ts +4 -2
  11. package/es/components/DatePicker/DatePicker.d.ts +8 -0
  12. package/es/components/DatePicker/DatePicker.js +33 -10
  13. package/es/components/FeatureFlags/index.d.ts +4 -1
  14. package/es/components/FeatureFlags/index.js +5 -1
  15. package/es/components/FluidComboBox/FluidComboBox.d.ts +0 -5
  16. package/es/components/FluidComboBox/FluidComboBox.js +0 -5
  17. package/es/components/Modal/Modal.js +3 -1
  18. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
  19. package/es/components/Notification/Notification.js +3 -1
  20. package/es/components/Popover/index.d.ts +8 -0
  21. package/es/components/Popover/index.js +13 -1
  22. package/es/components/Slider/Slider.js +1 -1
  23. package/es/components/Tabs/Tabs.js +3 -45
  24. package/es/components/Toggletip/index.d.ts +2 -0
  25. package/es/components/TreeView/TreeNode.js +5 -0
  26. package/es/components/UIShell/Content.d.ts +1 -1
  27. package/es/feature-flags.js +1 -0
  28. package/es/internal/FloatingMenu.js +3 -1
  29. package/es/tools/events.d.ts +1 -1
  30. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  31. package/lib/components/ComposedModal/ComposedModal.js +3 -1
  32. package/lib/components/Copy/Copy.d.ts +1 -1
  33. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  34. package/lib/components/DataTable/DataTable.d.ts +1 -1
  35. package/lib/components/DataTable/Table.d.ts +1 -1
  36. package/lib/components/DataTable/Table.js +1 -20
  37. package/lib/components/DataTable/TableToolbar.js +1 -0
  38. package/lib/components/DataTable/state/sorting.d.ts +4 -2
  39. package/lib/components/DatePicker/DatePicker.d.ts +8 -0
  40. package/lib/components/DatePicker/DatePicker.js +33 -10
  41. package/lib/components/FeatureFlags/index.d.ts +4 -1
  42. package/lib/components/FeatureFlags/index.js +5 -1
  43. package/lib/components/FluidComboBox/FluidComboBox.d.ts +0 -5
  44. package/lib/components/FluidComboBox/FluidComboBox.js +0 -5
  45. package/lib/components/Modal/Modal.js +3 -1
  46. package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -1
  47. package/lib/components/Notification/Notification.js +3 -1
  48. package/lib/components/Popover/index.d.ts +8 -0
  49. package/lib/components/Popover/index.js +13 -1
  50. package/lib/components/Slider/Slider.js +1 -1
  51. package/lib/components/Tabs/Tabs.js +2 -44
  52. package/lib/components/Toggletip/index.d.ts +2 -0
  53. package/lib/components/TreeView/TreeNode.js +5 -0
  54. package/lib/components/UIShell/Content.d.ts +1 -1
  55. package/lib/feature-flags.js +1 -0
  56. package/lib/internal/FloatingMenu.js +3 -1
  57. package/lib/tools/events.d.ts +1 -1
  58. package/package.json +6 -6
  59. package/telemetry.yml +8 -1
@@ -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
@@ -159,7 +159,9 @@ const ComposedModalDialog = /*#__PURE__*/React.forwardRef(function ComposedModal
159
159
  const modalState = useComposedModalState.useComposedModalState(open);
160
160
  const [isOpen, setIsOpen] = presenceContext?.modalState ?? modalState;
161
161
  const enableDialogElement = index$1.useFeatureFlag('enable-dialog-element');
162
- const focusTrapWithoutSentinels = index$1.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
162
+ const deprecatedFlag = index$1.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
163
+ const focusTrapWithoutSentinelsFlag = index$1.useFeatureFlag('enable-focus-wrap-without-sentinels');
164
+ const focusTrapWithoutSentinels = deprecatedFlag || focusTrapWithoutSentinelsFlag;
163
165
  process.env.NODE_ENV !== "production" ? warning.warning(!(focusTrapWithoutSentinels && enableDialogElement), '`<Modal>` detected both `focusTrapWithoutSentinels` and ' + '`enableDialogElement` feature flags are enabled. The native dialog ' + 'element handles focus, so `enableDialogElement` must be off for ' + '`focusTrapWithoutSentinels` to have any effect.') : void 0;
164
166
 
165
167
  // Propagate open/close state to the document.body
@@ -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;
@@ -27,6 +27,7 @@ var useSavedCallback = require('../../internal/useSavedCallback.js');
27
27
  require('../FluidForm/FluidForm.js');
28
28
  var FormContext = require('../FluidForm/FormContext.js');
29
29
  var iconsReact = require('@carbon/icons-react');
30
+ var utilities = require('@carbon/utilities');
30
31
 
31
32
  // Weekdays shorthand for English locale
32
33
  // Ensure localization exists before trying to access it
@@ -59,6 +60,7 @@ const monthToStr = (monthNumber, shorthand, locale) => locale.months[shorthand ?
59
60
  * @param {string} config.selectorFlatpickrYearContainer The CSS selector for the container of year selection UI.
60
61
  * @param {string} config.selectorFlatpickrCurrentMonth The CSS selector for the text-based month selection UI.
61
62
  * @param {string} config.classFlatpickrCurrentMonth The CSS class for the text-based month selection UI.
63
+ * @param {string} config.locale The locale code.
62
64
  * @returns {Plugin} A Flatpickr plugin to use text instead of `<select>` for month picker.
63
65
  */
64
66
  const carbonFlatpickrMonthSelectPlugin = config => fp => {
@@ -75,7 +77,13 @@ const carbonFlatpickrMonthSelectPlugin = config => fp => {
75
77
  fp.monthElements.splice(0, fp.monthElements.length, ...fp.monthElements.map(() => {
76
78
  const monthElement = fp._createElement('span', config.classFlatpickrCurrentMonth);
77
79
  monthElement.textContent = monthToStr(fp.currentMonth, config.shorthand === true, fp.l10n);
78
- fp.yearElements[0].closest(config.selectorFlatpickrMonthYearContainer).insertBefore(monthElement, fp.yearElements[0].closest(config.selectorFlatpickrYearContainer));
80
+
81
+ // Depending on the locale, toggle the order of the month and year
82
+ if (utilities.datePartsOrder.isMonthFirst(config.locale)) {
83
+ fp.yearElements[0].closest(config.selectorFlatpickrMonthYearContainer).insertBefore(monthElement, fp.yearElements[0].closest(config.selectorFlatpickrYearContainer));
84
+ } else {
85
+ fp.yearElements[0].closest(config.selectorFlatpickrMonthYearContainer).insertAdjacentElement('afterend', monthElement);
86
+ }
79
87
  return monthElement;
80
88
  }));
81
89
  };
@@ -109,12 +117,6 @@ const carbonFlatpickrMonthSelectPlugin = config => fp => {
109
117
  function isLabelTextEmpty(children) {
110
118
  return children.every(child => !child.props.labelText);
111
119
  }
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
120
  function updateClassNames(calendar, prefix) {
119
121
  const calendarContainer = calendar.calendarContainer;
120
122
  const daysContainer = calendar.days;
@@ -166,6 +168,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
166
168
  short = false,
167
169
  value,
168
170
  parseDate: parseDateProp,
171
+ nextMonthAriaLabel = 'Next month',
172
+ prevMonthAriaLabel = 'Previous month',
169
173
  ...rest
170
174
  }, ref) {
171
175
  const prefix = usePrefix.usePrefix();
@@ -346,6 +350,16 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
346
350
  } else if (parseDateProp) {
347
351
  parseDate = parseDateProp;
348
352
  }
353
+
354
+ // Accessible arrow icons (localized manually)
355
+ // Flatpickr does not currently support localization of next/previous month
356
+ // labels, so we inject translated aria-labels based on the provided locale.
357
+ const rightArrowHTML = `<svg aria-label="${nextMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
358
+ <polygon points="11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 "/>
359
+ </svg>`;
360
+ const leftArrowHTML = `<svg aria-label="${prevMonthAriaLabel}" role="img" width="16px" height="16px" viewBox="0 0 16 16">
361
+ <polygon points="5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 "/>
362
+ </svg>`;
349
363
  const {
350
364
  current: start
351
365
  } = startInputField;
@@ -374,7 +388,8 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
374
388
  }) : () => {}, carbonFlatpickrMonthSelectPlugin({
375
389
  selectorFlatpickrMonthYearContainer: '.flatpickr-current-month',
376
390
  selectorFlatpickrYearContainer: '.numInputWrapper',
377
- classFlatpickrCurrentMonth: 'cur-month'
391
+ classFlatpickrCurrentMonth: 'cur-month',
392
+ locale: locale
378
393
  }), fixEventsPlugin.default({
379
394
  inputFrom: startInputField.current,
380
395
  inputTo: endInputField.current,
@@ -523,7 +538,7 @@ const DatePicker = /*#__PURE__*/React.forwardRef(function DatePicker({
523
538
  }
524
539
  };
525
540
  // eslint-disable-next-line react-hooks/exhaustive-deps
526
- }, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType]);
541
+ }, [savedOnChange, savedOnOpen, readOnly, closeOnSelect, hasInput, datePickerType, nextMonthAriaLabel, prevMonthAriaLabel]);
527
542
 
528
543
  // this hook allows consumers to access the flatpickr calendar
529
544
  // instance for cases where functions like open() or close()
@@ -878,7 +893,15 @@ DatePicker.propTypes = {
878
893
  /**
879
894
  * Provide the text that is displayed when the control is in warning state (Fluid only)
880
895
  */
881
- warnText: PropTypes.node
896
+ warnText: PropTypes.node,
897
+ /**
898
+ * Accessible aria-label for the "next month" arrow icon.
899
+ */
900
+ nextMonthAriaLabel: PropTypes.string,
901
+ /**
902
+ * Accessible aria-label for the "previous month" arrow icon.
903
+ */
904
+ prevMonthAriaLabel: PropTypes.string
882
905
  };
883
906
 
884
907
  exports.default = DatePicker;
@@ -14,6 +14,7 @@ export interface FeatureFlagsProps {
14
14
  enableV12Overflowmenu?: boolean;
15
15
  enableTreeviewControllable?: boolean;
16
16
  enableExperimentalFocusWrapWithoutSentinels?: boolean;
17
+ enableFocusWrapWithoutSentinels?: boolean;
17
18
  enableDialogElement?: boolean;
18
19
  enableV12DynamicFloatingStyles?: boolean;
19
20
  enableEnhancedFileUploader?: boolean;
@@ -29,7 +30,7 @@ declare const FeatureFlagContext: React.Context<any>;
29
30
  * along with the current `FeatureFlagContext` to provide consumers to check if
30
31
  * a feature flag is enabled or disabled in a given React tree
31
32
  */
32
- declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, }: FeatureFlagsProps): JSX.Element;
33
+ declare function FeatureFlags({ children, flags, enableV12TileDefaultIcons, enableV12TileRadioIcons, enableV12Overflowmenu, enableTreeviewControllable, enableExperimentalFocusWrapWithoutSentinels, enableFocusWrapWithoutSentinels, enableDialogElement, enableV12DynamicFloatingStyles, enableEnhancedFileUploader, enablePresence, }: FeatureFlagsProps): JSX.Element;
33
34
  declare namespace FeatureFlags {
34
35
  var propTypes: {
35
36
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -42,9 +43,11 @@ declare namespace FeatureFlags {
42
43
  enableV12Overflowmenu: PropTypes.Requireable<boolean>;
43
44
  enableTreeviewControllable: PropTypes.Requireable<boolean>;
44
45
  enableExperimentalFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
46
+ enableFocusWrapWithoutSentinels: PropTypes.Requireable<boolean>;
45
47
  enableDialogElement: PropTypes.Requireable<boolean>;
46
48
  enableV12DynamicFloatingStyles: PropTypes.Requireable<boolean>;
47
49
  enableEnhancedFileUploader: PropTypes.Requireable<boolean>;
50
+ enablePresence: PropTypes.Requireable<boolean>;
48
51
  };
49
52
  }
50
53
  /**
@@ -32,6 +32,7 @@ function FeatureFlags({
32
32
  enableV12Overflowmenu = false,
33
33
  enableTreeviewControllable = false,
34
34
  enableExperimentalFocusWrapWithoutSentinels = false,
35
+ enableFocusWrapWithoutSentinels = false,
35
36
  enableDialogElement = false,
36
37
  enableV12DynamicFloatingStyles = false,
37
38
  enableEnhancedFileUploader = false,
@@ -45,6 +46,7 @@ function FeatureFlags({
45
46
  'enable-v12-overflowmenu': enableV12Overflowmenu,
46
47
  'enable-treeview-controllable': enableTreeviewControllable,
47
48
  'enable-experimental-focus-wrap-without-sentinels': enableExperimentalFocusWrapWithoutSentinels,
49
+ 'enable-focus-wrap-without-sentinels': enableFocusWrapWithoutSentinels,
48
50
  'enable-dialog-element': enableDialogElement,
49
51
  'enable-v12-dynamic-floating-styles': enableV12DynamicFloatingStyles,
50
52
  'enable-enhanced-file-uploader': enableEnhancedFileUploader,
@@ -86,9 +88,11 @@ FeatureFlags.propTypes = {
86
88
  enableV12Overflowmenu: PropTypes.bool,
87
89
  enableTreeviewControllable: PropTypes.bool,
88
90
  enableExperimentalFocusWrapWithoutSentinels: PropTypes.bool,
91
+ enableFocusWrapWithoutSentinels: PropTypes.bool,
89
92
  enableDialogElement: PropTypes.bool,
90
93
  enableV12DynamicFloatingStyles: PropTypes.bool,
91
- enableEnhancedFileUploader: PropTypes.bool
94
+ enableEnhancedFileUploader: PropTypes.bool,
95
+ enablePresence: PropTypes.bool
92
96
  };
93
97
 
94
98
  /**
@@ -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
  */
@@ -131,7 +131,9 @@ const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
131
131
  // always mark as open when mounted with presence
132
132
  const open = externalOpen || enablePresence;
133
133
  const prevOpen = usePreviousValue.usePreviousValue(open);
134
- const focusTrapWithoutSentinels = index.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
134
+ const deprecatedFlag = index.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
135
+ const focusTrapWithoutSentinelsFlag = index.useFeatureFlag('enable-focus-wrap-without-sentinels');
136
+ const focusTrapWithoutSentinels = focusTrapWithoutSentinelsFlag || deprecatedFlag;
135
137
  const enableDialogElement = index.useFeatureFlag('enable-dialog-element');
136
138
  process.env.NODE_ENV !== "production" ? warning.warning(!(focusTrapWithoutSentinels && enableDialogElement), '`<Modal>` detected both `focusTrapWithoutSentinels` and ' + '`enableDialogElement` feature flags are enabled. The native dialog ' + 'element handles focus, so `enableDialogElement` must be off for ' + '`focusTrapWithoutSentinels` to have any effect.') : void 0;
137
139
  process.env.NODE_ENV !== "production" ? warning.warning(!(!passiveModal && preventCloseOnClickOutside === false), invalidOutsideClickMessage) : void 0;
@@ -554,7 +554,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
554
554
  });
555
555
  const inputProp = getInputProps(getDropdownProps({
556
556
  'aria-controls': isOpen ? menuId : undefined,
557
- 'aria-describedby': helperText ? helperId : undefined,
557
+ 'aria-describedby': helperText && !invalid && !warn ? helperId : undefined,
558
558
  'aria-haspopup': 'listbox',
559
559
  // Remove excess aria `aria-labelledby`. HTML <label for>
560
560
  // provides this aria information.
@@ -506,7 +506,9 @@ function ActionableNotification({
506
506
  const startTrap = React.useRef(null);
507
507
  const endTrap = React.useRef(null);
508
508
  const ref = React.useRef(null);
509
- const focusTrapWithoutSentinels = index.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
509
+ const deprecatedFlag = index.useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
510
+ const focusTrapWithoutSentinelsFlag = index.useFeatureFlag('enable-focus-wrap-without-sentinels');
511
+ const focusTrapWithoutSentinels = focusTrapWithoutSentinelsFlag || deprecatedFlag;
510
512
  useIsomorphicEffect.default(() => {
511
513
  if (hasFocus && role === 'alertdialog') {
512
514
  const button = document.querySelector('button.cds--actionable-notification__action-button');
@@ -29,6 +29,10 @@ export interface PopoverBaseProps {
29
29
  * **Experimental:** Provide an offset value for alignment axis. Only takes effect when `autoalign` is enabled.
30
30
  */
31
31
  alignmentAxisOffset?: number;
32
+ /**
33
+ * Specify the background token to use. Default is 'layer'.
34
+ */
35
+ backgroundToken?: 'layer' | 'background';
32
36
  /**
33
37
  * Will auto-align the popover on first render if it is not visible. This prop
34
38
  * is currently experimental and is subject to future changes. Requires
@@ -44,6 +48,10 @@ export interface PopoverBaseProps {
44
48
  * Specify whether a caret should be rendered
45
49
  */
46
50
  caret?: boolean;
51
+ /**
52
+ * Specify whether a border should be rendered on the popover
53
+ */
54
+ border?: boolean;
47
55
  /**
48
56
  * Provide elements to be rendered inside of the component
49
57
  */
@@ -41,9 +41,11 @@ const Popover = /*#__PURE__*/React.forwardRef(function PopoverRenderFunction({
41
41
  as: BaseComponent = 'span',
42
42
  autoAlign = false,
43
43
  autoAlignBoundary,
44
+ backgroundToken = 'layer',
44
45
  caret = isTabTip ? false : true,
45
46
  className: customClassName,
46
47
  children,
48
+ border = false,
47
49
  dropShadow = true,
48
50
  highContrast = false,
49
51
  onRequestClose,
@@ -213,11 +215,13 @@ forwardRef) {
213
215
  [`${prefix}--popover-container`]: true,
214
216
  [`${prefix}--popover--caret`]: caret,
215
217
  [`${prefix}--popover--drop-shadow`]: dropShadow,
218
+ [`${prefix}--popover--border`]: border,
216
219
  [`${prefix}--popover--high-contrast`]: highContrast,
217
220
  [`${prefix}--popover--open`]: open,
218
221
  [`${prefix}--popover--auto-align ${prefix}--autoalign`]: enableFloatingStyles,
219
222
  [`${prefix}--popover--${currentAlignment}`]: true,
220
- [`${prefix}--popover--tab-tip`]: isTabTip
223
+ [`${prefix}--popover--tab-tip`]: isTabTip,
224
+ [`${prefix}--popover--background-token__background`]: backgroundToken === 'background' && !highContrast
221
225
  }, customClassName);
222
226
  const mappedChildren = React.Children.map(children, child => {
223
227
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
@@ -329,6 +333,10 @@ Popover.propTypes = {
329
333
  * @see https://github.com/carbon-design-system/carbon/issues/18714
330
334
  */
331
335
  autoAlign: PropTypes.bool,
336
+ /**
337
+ * Specify the background token to use. Default is 'layer'.
338
+ */
339
+ backgroundToken: PropTypes.oneOf(['layer', 'background']),
332
340
  /**
333
341
  * Specify a bounding element to be used for autoAlign calculations. The viewport is used by default. This prop is currently experimental and is subject to future changes.
334
342
  */
@@ -342,6 +350,10 @@ Popover.propTypes = {
342
350
  * Specify whether a caret should be rendered
343
351
  */
344
352
  caret: PropTypes.bool,
353
+ /**
354
+ * Specify whether a border should be rendered on the popover
355
+ */
356
+ border: PropTypes.bool,
345
357
  /**
346
358
  * Provide elements to be rendered inside of the component
347
359
  */
@@ -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;
@@ -26,7 +26,6 @@ var useControllableState = require('../../internal/useControllableState.js');
26
26
  var useId = require('../../internal/useId.js');
27
27
  var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
28
28
  var useMergedRefs = require('../../internal/useMergedRefs.js');
29
- var useNoInteractiveChildren = require('../../internal/useNoInteractiveChildren.js');
30
29
  var usePrefix = require('../../internal/usePrefix.js');
31
30
  var keys = require('../../internal/keyboard/keys.js');
32
31
  var match = require('../../internal/keyboard/match.js');
@@ -1112,10 +1111,6 @@ const TabPanel = /*#__PURE__*/React.forwardRef(({
1112
1111
  ...rest
1113
1112
  }, forwardRef) => {
1114
1113
  const prefix = usePrefix.usePrefix();
1115
- const panel = React.useRef(null);
1116
- const ref = useMergedRefs.useMergedRefs([forwardRef, panel]);
1117
- const [tabIndex, setTabIndex] = React.useState(0);
1118
- const [interactiveContent, setInteractiveContent] = React.useState(false);
1119
1114
  const {
1120
1115
  selectedIndex,
1121
1116
  baseId
@@ -1123,50 +1118,13 @@ const TabPanel = /*#__PURE__*/React.forwardRef(({
1123
1118
  const index = React.useContext(TabPanelContext);
1124
1119
  const id = `${baseId}-tabpanel-${index}`;
1125
1120
  const tabId = `${baseId}-tab-${index}`;
1126
- const className = cx(`${prefix}--tab-content`, customClassName, {
1127
- [`${prefix}--tab-content--interactive`]: interactiveContent
1128
- });
1129
- React.useEffect(() => {
1130
- if (!panel.current) {
1131
- return;
1132
- }
1133
- const content = useNoInteractiveChildren.getInteractiveContent(panel.current);
1134
- if (content) {
1135
- setInteractiveContent(true);
1136
- setTabIndex(-1);
1137
- }
1138
- }, []);
1139
-
1140
- // tabindex should only be 0 if no interactive content in children
1141
- React.useEffect(() => {
1142
- const node = panel.current;
1143
- if (!node) {
1144
- return;
1145
- }
1146
- function callback() {
1147
- const content = useNoInteractiveChildren.getInteractiveContent(node);
1148
- if (content) {
1149
- setInteractiveContent(true);
1150
- setTabIndex(-1);
1151
- } else {
1152
- setInteractiveContent(false);
1153
- setTabIndex(0);
1154
- }
1155
- }
1156
- const observer = new MutationObserver(callback);
1157
- observer.observe(node, {
1158
- childList: true,
1159
- subtree: true
1160
- });
1161
- return () => observer.disconnect();
1162
- }, []);
1121
+ const className = cx(`${prefix}--tab-content`, customClassName);
1163
1122
  return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
1164
1123
  "aria-labelledby": tabId,
1165
1124
  id: id,
1166
1125
  className: className,
1167
- ref: ref,
1126
+ ref: forwardRef,
1168
1127
  role: "tabpanel",
1169
- tabIndex: tabIndex,
1170
1128
  hidden: selectedIndex !== index
1171
1129
  }), children);
1172
1130
  });
@@ -54,9 +54,11 @@ export declare namespace Toggletip {
54
54
  defaultOpen: PropTypes.Requireable<boolean>;
55
55
  align?: PopoverAlignment;
56
56
  alignmentAxisOffset?: number;
57
+ backgroundToken?: "layer" | "background";
57
58
  autoAlign?: boolean;
58
59
  autoAlignBoundary?: import("@floating-ui/dom").Boundary;
59
60
  caret?: boolean;
61
+ border?: boolean;
60
62
  children?: React.ReactNode;
61
63
  className?: string;
62
64
  dropShadow?: boolean;
@@ -146,6 +146,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
146
146
  const currentNode = React.useRef(null);
147
147
  const currentNodeLabel = React.useRef(null);
148
148
  const prefix = usePrefix.usePrefix();
149
+ const nodeLabelId = `${id}__label`;
149
150
  const renderLabelText = () => {
150
151
  if (isEllipsisApplied && tooltipText) {
151
152
  return /*#__PURE__*/React.createElement(index$1.IconButton, {
@@ -156,11 +157,13 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
156
157
  className: `${prefix}--tree-node__label__text-button`,
157
158
  wrapperClasses: `${prefix}--popover-container`
158
159
  }, /*#__PURE__*/React.createElement("span", {
160
+ id: nodeLabelId,
159
161
  ref: labelTextRef,
160
162
  className: `${prefix}--tree-node__label__text`
161
163
  }, label));
162
164
  }
163
165
  return /*#__PURE__*/React.createElement("span", {
166
+ id: nodeLabelId,
164
167
  ref: labelTextRef,
165
168
  className: `${prefix}--tree-node__label__text`
166
169
  }, label);
@@ -399,6 +402,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
399
402
  }), nodeContent), children && /*#__PURE__*/React.createElement("ul", {
400
403
  id: `${id}-subtree`,
401
404
  role: "group",
405
+ "aria-labelledby": nodeLabelId,
402
406
  className: cx(`${prefix}--tree-node__children`, {
403
407
  [`${prefix}--tree-node--hidden`]: !expanded
404
408
  })
@@ -412,6 +416,7 @@ const TreeNode = /*#__PURE__*/React.forwardRef(({
412
416
  }), nodeContent, children && /*#__PURE__*/React.createElement("ul", {
413
417
  id: `${id}-subtree`,
414
418
  role: "group",
419
+ "aria-labelledby": nodeLabelId,
415
420
  className: cx(`${prefix}--tree-node__children`, {
416
421
  [`${prefix}--tree-node--hidden`]: !expanded
417
422
  })
@@ -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;
@@ -33,6 +33,7 @@ FeatureFlags__namespace.merge({
33
33
  'enable-css-grid': true,
34
34
  'enable-v11-release': true,
35
35
  'enable-experimental-tile-contrast': false,
36
+ 'enable-tile-contrast': false,
36
37
  'enable-v12-tile-radio-icons': false,
37
38
  'enable-v12-structured-list-visible-icons': false,
38
39
  'enable-v12-dynamic-floating-styles': false
@@ -295,7 +295,9 @@ const FloatingMenu = ({
295
295
  });
296
296
  }
297
297
  };
298
- const focusTrapWithoutSentinels = FeatureFlags__namespace.enabled('enable-experimental-focus-wrap-without-sentinels');
298
+ const deprecatedFlag = FeatureFlags__namespace.enabled('enable-experimental-focus-wrap-without-sentinels');
299
+ const focusTrapWithoutSentinelsFlag = FeatureFlags__namespace.enabled('enable-focus-wrap-without-sentinels');
300
+ const focusTrapWithoutSentinels = deprecatedFlag || focusTrapWithoutSentinelsFlag;
299
301
  if (typeof document !== 'undefined') {
300
302
  const portalTarget = target ? target() : document.body;
301
303
  return /*#__PURE__*/ReactDOM.createPortal(
@@ -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;