@carbon/react 1.89.0-rc.0 → 1.89.0-rc.1

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 (39) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +796 -796
  2. package/es/components/AILabel/index.d.ts +2 -5
  3. package/es/components/AILabel/index.js +2 -42
  4. package/es/components/Copy/Copy.js +1 -0
  5. package/es/components/Link/Link.js +15 -1
  6. package/es/components/Menu/MenuContext.d.ts +1 -1
  7. package/es/components/Menu/MenuContext.js +11 -4
  8. package/es/components/Menu/MenuItem.js +2 -9
  9. package/es/components/Modal/Modal.js +15 -7
  10. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -5
  11. package/es/components/MultiSelect/MultiSelect.js +3 -7
  12. package/es/components/Popover/index.d.ts +4 -0
  13. package/es/components/Popover/index.js +8 -2
  14. package/es/components/StructuredList/StructuredList.d.ts +16 -0
  15. package/es/components/StructuredList/StructuredList.js +19 -9
  16. package/es/components/Toggletip/index.d.ts +13 -36
  17. package/es/components/Toggletip/index.js +11 -51
  18. package/es/internal/Selection.js +1 -1
  19. package/es/internal/useMergedRefs.js +4 -3
  20. package/lib/components/AILabel/index.d.ts +2 -5
  21. package/lib/components/AILabel/index.js +1 -41
  22. package/lib/components/Copy/Copy.js +1 -0
  23. package/lib/components/Link/Link.js +15 -1
  24. package/lib/components/Menu/MenuContext.d.ts +1 -1
  25. package/lib/components/Menu/MenuContext.js +11 -4
  26. package/lib/components/Menu/MenuItem.js +2 -9
  27. package/lib/components/Modal/Modal.js +15 -7
  28. package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -5
  29. package/lib/components/MultiSelect/MultiSelect.js +3 -7
  30. package/lib/components/Popover/index.d.ts +4 -0
  31. package/lib/components/Popover/index.js +8 -2
  32. package/lib/components/StructuredList/StructuredList.d.ts +16 -0
  33. package/lib/components/StructuredList/StructuredList.js +19 -9
  34. package/lib/components/Toggletip/index.d.ts +13 -36
  35. package/lib/components/Toggletip/index.js +10 -50
  36. package/lib/internal/Selection.js +1 -1
  37. package/lib/internal/useMergedRefs.js +3 -2
  38. package/package.json +11 -12
  39. package/telemetry.yml +3 -2
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
+ import { ToggletipBaseProps } from '../Toggletip';
8
9
  import type { DeprecatedPopoverAlignment, NewPopoverAlignment, PopoverAlignment } from '../Popover';
9
10
  export type AILabelContentProps = React.HTMLAttributes<HTMLSpanElement>;
10
11
  export declare const AILabelContent: React.ForwardRefExoticComponent<AILabelContentProps & React.RefAttributes<unknown>>;
@@ -17,15 +18,11 @@ export declare const AILabelActions: React.ForwardRefExoticComponent<AILabelActi
17
18
  export type DeprecatedAlignment = DeprecatedPopoverAlignment;
18
19
  export type NewAlignment = NewPopoverAlignment;
19
20
  export type Alignment = PopoverAlignment;
20
- export interface AILabelProps {
21
+ export interface AILabelProps extends ToggletipBaseProps {
21
22
  AILabelContent?: React.ReactNode;
22
23
  aiText?: string;
23
24
  aiTextLabel?: string;
24
25
  textLabel?: string;
25
- align?: Alignment;
26
- autoAlign?: boolean;
27
- children?: React.ReactNode;
28
- className?: string;
29
26
  kind?: 'default' | 'inline';
30
27
  onRevertClick?: (evt: React.MouseEvent<HTMLButtonElement>) => void;
31
28
  revertActive?: boolean;
@@ -10,12 +10,10 @@
10
10
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
11
11
  var cx = require('classnames');
12
12
  var PropTypes = require('prop-types');
13
- var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
14
13
  var React = require('react');
15
14
  var usePrefix = require('../../internal/usePrefix.js');
16
15
  var index = require('../Toggletip/index.js');
17
16
  var index$1 = require('../IconButton/index.js');
18
- var mapPopoverAlign = require('../../tools/mapPopoverAlign.js');
19
17
  var iconsReact = require('@carbon/icons-react');
20
18
  var useId = require('../../internal/useId.js');
21
19
  var deprecate = require('../../prop-types/deprecate.js');
@@ -145,6 +143,7 @@ const AILabel = /*#__PURE__*/React.forwardRef(function AILabel({
145
143
  });
146
144
  AILabel.displayName = 'AILabel';
147
145
  AILabel.propTypes = {
146
+ ...index.Toggletip.propTypes,
148
147
  /**
149
148
  * Specify the content you want rendered inside the `AILabel` ToggleTip
150
149
  */
@@ -158,49 +157,10 @@ AILabel.propTypes = {
158
157
  * Specify additional text to be rendered next to the AI label in the inline variant
159
158
  */
160
159
  aiTextLabel: deprecate.deprecate(PropTypes.string, '`aiTextLabel` on `AILabel` has been deprecated - Please use the `textLabel` prop instead'),
161
- /**
162
- * Specify how the popover should align with the button
163
- */
164
- align: deprecateValuesWithin.default(PropTypes.oneOf(['top', 'top-left',
165
- // deprecated use top-start instead
166
- 'top-right',
167
- // deprecated use top-end instead
168
-
169
- 'bottom', 'bottom-left',
170
- // deprecated use bottom-start instead
171
- 'bottom-right',
172
- // deprecated use bottom-end instead
173
-
174
- 'left', 'left-bottom',
175
- // deprecated use left-end instead
176
- 'left-top',
177
- // deprecated use left-start instead
178
-
179
- 'right', 'right-bottom',
180
- // deprecated use right-end instead
181
- 'right-top',
182
- // deprecated use right-start instead
183
-
184
- // new values to match floating-ui
185
- 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']), ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'], mapPopoverAlign.mapPopoverAlign),
186
160
  /**
187
161
  * Specify the text that will be provided to the aria-label of the `AILabel` button
188
162
  */
189
163
  'aria-label': PropTypes.string,
190
- /**
191
- * Will auto-align the popover. This prop is currently experimental and is
192
- * subject to future changes. Requires React v17+
193
- * @see https://github.com/carbon-design-system/carbon/issues/18714
194
- */
195
- autoAlign: PropTypes.bool,
196
- /**
197
- * Specify the content you want rendered inside the `AILabel` ToggleTip
198
- */
199
- children: PropTypes.node,
200
- /**
201
- * Specify an optional className to be added to the `AILabel`
202
- */
203
- className: PropTypes.string,
204
164
  /**
205
165
  * Specify the type of `AILabel`, from the following list of types:
206
166
  */
@@ -61,6 +61,7 @@ function Copy({
61
61
  autoAlign: autoAlign,
62
62
  className: classNames,
63
63
  label: animation ? feedback : initialLabel,
64
+ leaveDelayMs: animation ? feedbackTimeout : undefined,
64
65
  onClick: events.composeEventHandlers([onClick, handleClick]),
65
66
  onAnimationEnd: events.composeEventHandlers([onAnimationEnd, handleAnimationEnd])
66
67
  }, other, {
@@ -52,9 +52,23 @@ const LinkBase = /*#__PURE__*/React.forwardRef(({
52
52
  linkProps['aria-disabled'] = true;
53
53
  }
54
54
  const BaseComponentAsAny = BaseComponent ?? 'a';
55
+ const handleOnClick = event => {
56
+ if (disabled) {
57
+ event.preventDefault();
58
+ event.stopPropagation();
59
+ } else {
60
+ // If the link is not disabled, we allow the onClick event to propagate
61
+ // so that any parent handlers can also respond to the click.
62
+ if (rest.onClick) {
63
+ rest.onClick(event);
64
+ }
65
+ }
66
+ };
55
67
  return /*#__PURE__*/React.createElement(BaseComponentAsAny, _rollupPluginBabelHelpers.extends({
56
68
  ref: ref
57
- }, linkProps, rest), children, !inline && Icon && /*#__PURE__*/React.createElement("div", {
69
+ }, linkProps, rest, {
70
+ onClick: handleOnClick
71
+ }), children, !inline && Icon && /*#__PURE__*/React.createElement("div", {
58
72
  className: `${prefix}--link__icon`
59
73
  }, /*#__PURE__*/React.createElement(Icon, null)));
60
74
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2023
2
+ * Copyright IBM Corp. 2023, 2025
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -30,10 +30,17 @@ function menuReducer(state, action) {
30
30
  hasSelectableItems: true
31
31
  };
32
32
  case 'registerItem':
33
- return {
34
- ...state,
35
- items: [...state.items, action.payload].filter(item => item.ref.current !== null)
36
- };
33
+ {
34
+ const newItem = action.payload;
35
+ const items = state.items.filter(item => item.ref.current);
36
+ const next = newItem.ref.current?.nextElementSibling;
37
+ const idx = items.findIndex(item => item.ref.current === next);
38
+ items.splice(idx < 0 ? items.length : idx, 0, newItem);
39
+ return {
40
+ ...state,
41
+ items
42
+ };
43
+ }
37
44
  }
38
45
  }
39
46
  const MenuContext = /*#__PURE__*/React.createContext({
@@ -130,18 +130,11 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem({
130
130
  [`${prefix}--menu-item--disabled`]: isDisabled,
131
131
  [`${prefix}--menu-item--danger`]: isDanger
132
132
  });
133
- const [isFocusable, setIsFocusable] = React.useState(false);
133
+
134
134
  // on first render, register this menuitem in the context's state
135
135
  // (used for keyboard navigation)
136
136
  React.useEffect(() => {
137
137
  registerItem();
138
-
139
- // Detects if this is the first focusable item
140
- const currentItems = context.state.items;
141
- if (!disabled && menuItem.current && currentItems.length === 0) {
142
- setIsFocusable(true);
143
- }
144
-
145
138
  // eslint-disable-next-line react-hooks/exhaustive-deps
146
139
  }, []);
147
140
 
@@ -180,7 +173,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem({
180
173
  }, rest, {
181
174
  ref: ref,
182
175
  className: classNames,
183
- tabIndex: isFocusable ? 0 : -1,
176
+ tabIndex: !disabled ? 0 : -1,
184
177
  "aria-disabled": isDisabled ?? undefined,
185
178
  "aria-haspopup": hasChildren ?? undefined,
186
179
  "aria-expanded": hasChildren ? submenuOpen : undefined,
@@ -85,6 +85,7 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal({
85
85
  const innerModal = React.useRef(null);
86
86
  const startTrap = React.useRef(null);
87
87
  const endTrap = React.useRef(null);
88
+ const wrapFocusTimeout = React.useRef(null);
88
89
  const [isScrollable, setIsScrollable] = React.useState(false);
89
90
  const prevOpen = usePreviousValue.usePreviousValue(open);
90
91
  const modalInstanceId = `modal-${useId.useId()}`;
@@ -146,13 +147,20 @@ const Modal = /*#__PURE__*/React.forwardRef(function Modal({
146
147
  const {
147
148
  current: endTrapNode
148
149
  } = endTrap;
149
- wrapFocus.wrapFocus({
150
- bodyNode,
151
- startTrapNode,
152
- endTrapNode,
153
- currentActiveNode,
154
- oldActiveNode,
155
- selectorsFloatingMenus
150
+ // use setTimeout to ensure focus is set after all browser default focus behavior. Fixes issue of
151
+ // focus not wrapping in Firefox
152
+ wrapFocusTimeout.current = setTimeout(() => {
153
+ wrapFocus.wrapFocus({
154
+ bodyNode,
155
+ startTrapNode,
156
+ endTrapNode,
157
+ currentActiveNode,
158
+ oldActiveNode,
159
+ selectorsFloatingMenus
160
+ });
161
+ if (wrapFocusTimeout.current) {
162
+ clearTimeout(wrapFocusTimeout.current);
163
+ }
156
164
  });
157
165
  }
158
166
 
@@ -124,11 +124,7 @@ const FilterableMultiSelect = /*#__PURE__*/React.forwardRef(function FilterableM
124
124
  inputValue
125
125
  }), [items, inputValue, itemToString$1, filterItems]);
126
126
  const nonSelectAllItems = React.useMemo(() => filteredItems.filter(item => !item.isSelectAll), [filteredItems]);
127
- let selectAll = filteredItems.some(item => item.isSelectAll);
128
- if ((selected ?? []).length > 0 && selectAll) {
129
- console.warn('Warning: `selectAll` should not be used when `selectedItems` is provided. Please pass either `selectAll` or `selectedItems`, not both.');
130
- selectAll = false;
131
- }
127
+ const selectAll = filteredItems.some(item => item.isSelectAll);
132
128
  const {
133
129
  selectedItems: controlledSelectedItems,
134
130
  onItemChange,
@@ -113,11 +113,7 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
113
113
  return true; // Return true if item is not an object with undefined values
114
114
  });
115
115
  }, [items]);
116
- let selectAll = filteredItems.some(item => item.isSelectAll);
117
- if ((selected ?? []).length > 0 && selectAll) {
118
- console.warn('Warning: `selectAll` should not be used when `selectedItems` is provided. Please pass either `selectAll` or `selectedItems`, not both.');
119
- selectAll = false;
120
- }
116
+ const selectAll = filteredItems.some(item => item.isSelectAll);
121
117
  const prefix = usePrefix.usePrefix();
122
118
  const {
123
119
  isFluid
@@ -491,13 +487,13 @@ const MultiSelect = /*#__PURE__*/React.forwardRef(({
491
487
  })), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
492
488
  className: `${prefix}--list-box__inner-wrapper--decorator`
493
489
  }, normalizedDecorator) : ''), /*#__PURE__*/React.createElement(index$2.default.Menu, menuProps, isOpen && sortItems(filteredItems, sortOptions).map((item, index) => {
494
- const isChecked = selectedItems.filter(selected => isEqual(selected, item)).length > 0;
495
490
  const {
496
491
  hasIndividualSelections,
497
492
  nonSelectAllSelectedCount,
498
493
  totalSelectableCount
499
494
  } = getSelectionStats(selectedItems, filteredItems);
500
- const isIndeterminate = item['isSelectAll'] && hasIndividualSelections && nonSelectAllSelectedCount < totalSelectableCount;
495
+ const isChecked = item.isSelectAll ? nonSelectAllSelectedCount === totalSelectableCount && totalSelectableCount > 0 : selectedItems.some(selected => isEqual(selected, item));
496
+ const isIndeterminate = item.isSelectAll && hasIndividualSelections && nonSelectAllSelectedCount < totalSelectableCount;
501
497
  const itemProps = getItemProps({
502
498
  item,
503
499
  // we don't want Downshift to set aria-selected for us
@@ -25,6 +25,10 @@ export interface PopoverBaseProps {
25
25
  * Specify how the popover should align with the trigger element.
26
26
  */
27
27
  align?: PopoverAlignment;
28
+ /**
29
+ * **Experimental:** Provide an offset value for alignment axis. Only takes effect when `autoalign` is enabled.
30
+ */
31
+ alignmentAxisOffset?: number;
28
32
  /**
29
33
  * Will auto-align the popover on first render if it is not visible. This prop
30
34
  * is currently experimental and is subject to future changes. Requires
@@ -19,7 +19,6 @@ var useEvent = require('../../internal/useEvent.js');
19
19
  var mapPopoverAlign = require('../../tools/mapPopoverAlign.js');
20
20
  var react = require('@floating-ui/react');
21
21
  var index = require('../FeatureFlags/index.js');
22
- var index$1 = require('../Toggletip/index.js');
23
22
 
24
23
  const PopoverContext = /*#__PURE__*/React.createContext({
25
24
  setFloating: {
@@ -64,7 +63,10 @@ forwardRef) {
64
63
  // The `Popover` should close whenever it and its children loses focus
65
64
  useEvent.useEvent(popover, 'focusout', event => {
66
65
  const relatedTarget = event.relatedTarget;
66
+
67
+ // No relatedTarget, focus moved to nowhere, so close the popover
67
68
  if (!relatedTarget) {
69
+ onRequestClose?.();
68
70
  return;
69
71
  }
70
72
  const isOutsideMainContainer = !popover.current?.contains(relatedTarget);
@@ -237,7 +239,7 @@ forwardRef) {
237
239
  // For a toggletip there is a specific trigger component, ToggletipButton.
238
240
  // In either of these cases we want to set this as the reference node for floating-ui autoAlign
239
241
  // positioning.
240
- if (enableFloatingStyles && item?.type !== PopoverContent || enableFloatingStyles && item?.type === index$1.ToggletipButton) {
242
+ if (enableFloatingStyles && item?.type !== PopoverContent || enableFloatingStyles && item?.type['displayName'] === 'ToggletipButton') {
241
243
  // Set the reference element for floating-ui
242
244
  refs.setReference(node);
243
245
  }
@@ -294,6 +296,10 @@ Popover.propTypes = {
294
296
 
295
297
  // new values to match floating-ui
296
298
  'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']), ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'], mapPopoverAlign.mapPopoverAlign),
299
+ /**
300
+ * **Experimental:** Provide an offset value for alignment axis. Only takes effect when `autoalign` is enabled.
301
+ */
302
+ alignmentAxisOffset: PropTypes.number,
297
303
  /**
298
304
  * Provide a custom element or component to render the top-level node for the
299
305
  * component.
@@ -32,6 +32,10 @@ export interface StructuredListWrapperProps extends DivAttrs {
32
32
  * Specify whether your StructuredListWrapper should have selections
33
33
  */
34
34
  selection?: boolean;
35
+ /**
36
+ * Specify which row will be selected initially
37
+ */
38
+ selectedInitialRow?: string;
35
39
  }
36
40
  export declare function StructuredListWrapper(props: StructuredListWrapperProps): import("react/jsx-runtime").JSX.Element;
37
41
  export declare namespace StructuredListWrapper {
@@ -65,6 +69,10 @@ export declare namespace StructuredListWrapper {
65
69
  * Specify whether your StructuredListWrapper should have selections
66
70
  */
67
71
  selection: PropTypes.Requireable<boolean>;
72
+ /**
73
+ * Specify which row will be selected initially
74
+ */
75
+ selectedInitialRow: PropTypes.Requireable<string>;
68
76
  };
69
77
  }
70
78
  export interface StructuredListHeadProps extends DivAttrs {
@@ -148,6 +156,10 @@ export interface StructuredListRowProps extends DivAttrs {
148
156
  * Mark if this row should be selectable
149
157
  */
150
158
  selection?: boolean;
159
+ /**
160
+ * Specify row id so that it can be used for initial selection
161
+ */
162
+ id?: string;
151
163
  }
152
164
  export declare function StructuredListRow(props: StructuredListRowProps): import("react/jsx-runtime").JSX.Element;
153
165
  export declare namespace StructuredListRow {
@@ -180,6 +192,10 @@ export declare namespace StructuredListRow {
180
192
  * Mark if this row should be selectable
181
193
  */
182
194
  selection: PropTypes.Requireable<boolean>;
195
+ /**
196
+ * Specify row id so that it can be used for initial selection
197
+ */
198
+ id: PropTypes.Requireable<string>;
183
199
  };
184
200
  }
185
201
  export interface StructuredListInputProps extends DivAttrs {
@@ -32,6 +32,7 @@ function StructuredListWrapper(props) {
32
32
  ariaLabel: deprecatedAriaLabel,
33
33
  isCondensed,
34
34
  isFlush,
35
+ selectedInitialRow,
35
36
  ...other
36
37
  } = props;
37
38
  const prefix = usePrefix.usePrefix();
@@ -40,7 +41,7 @@ function StructuredListWrapper(props) {
40
41
  [`${prefix}--structured-list--condensed`]: isCondensed,
41
42
  [`${prefix}--structured-list--flush`]: isFlush && !selection
42
43
  }, className);
43
- const [selectedRow, setSelectedRow] = React.useState(null);
44
+ const [selectedRow, setSelectedRow] = React.useState(selectedInitialRow ?? null);
44
45
  return /*#__PURE__*/React.createElement(GridSelectedRowStateContext.Provider, {
45
46
  value: selectedRow
46
47
  }, /*#__PURE__*/React.createElement(GridSelectedRowDispatchContext.Provider, {
@@ -81,7 +82,11 @@ StructuredListWrapper.propTypes = {
81
82
  /**
82
83
  * Specify whether your StructuredListWrapper should have selections
83
84
  */
84
- selection: PropTypes.bool
85
+ selection: PropTypes.bool,
86
+ /**
87
+ * Specify which row will be selected initially
88
+ */
89
+ selectedInitialRow: PropTypes.string
85
90
  };
86
91
  function StructuredListHead(props) {
87
92
  const {
@@ -143,21 +148,22 @@ function StructuredListRow(props) {
143
148
  head,
144
149
  onClick,
145
150
  selection,
151
+ id,
146
152
  ...other
147
153
  } = props;
148
154
  const [hasFocusWithin, setHasFocusWithin] = React.useState(false);
149
- const id = useId.useId('grid-input');
155
+ const rowId = id ?? useId.useId('grid-input');
150
156
  const selectedRow = React.useContext(GridSelectedRowStateContext);
151
157
  const setSelectedRow = React.useContext(GridSelectedRowDispatchContext);
152
158
  const prefix = usePrefix.usePrefix();
153
159
  const value = {
154
- id
160
+ id: rowId
155
161
  };
156
162
  const classes = cx(`${prefix}--structured-list-row`, {
157
163
  [`${prefix}--structured-list-row--header-row`]: head,
158
- [`${prefix}--structured-list-row--focused-within`]: hasFocusWithin && !selection || hasFocusWithin && selection && (selectedRow === id || selectedRow === null),
164
+ [`${prefix}--structured-list-row--focused-within`]: hasFocusWithin && !selection || hasFocusWithin && selection && (selectedRow === rowId || selectedRow === null),
159
165
  // Ensure focus on the first item when navigating through Tab keys and no row is selected (selectedRow === null)
160
- [`${prefix}--structured-list-row--selected`]: selectedRow === id
166
+ [`${prefix}--structured-list-row--selected`]: selectedRow === rowId
161
167
  }, className);
162
168
  const itemRef = React.useRef(null);
163
169
  const handleClick = () => {
@@ -178,7 +184,7 @@ function StructuredListRow(props) {
178
184
  className: classes,
179
185
  ref: itemRef,
180
186
  onClick: event => {
181
- setSelectedRow?.(id);
187
+ setSelectedRow?.(rowId);
182
188
  onClick && onClick(event);
183
189
  if (selection) {
184
190
  // focus items only when selection is enabled
@@ -194,7 +200,7 @@ function StructuredListRow(props) {
194
200
  onKeyDown: onKeyDown
195
201
  }), /*#__PURE__*/React.createElement(GridRowContext.Provider, {
196
202
  value: value
197
- }, selection && /*#__PURE__*/React.createElement(StructuredListCell, null, selectedRow === id ? /*#__PURE__*/React.createElement(iconsReact.RadioButtonChecked, {
203
+ }, selection && /*#__PURE__*/React.createElement(StructuredListCell, null, selectedRow === rowId ? /*#__PURE__*/React.createElement(iconsReact.RadioButtonChecked, {
198
204
  className: `${prefix}--structured-list__icon`
199
205
  }) : /*#__PURE__*/React.createElement(iconsReact.RadioButton, {
200
206
  className: `${prefix}--structured-list__icon`
@@ -228,7 +234,11 @@ StructuredListRow.propTypes = {
228
234
  /**
229
235
  * Mark if this row should be selectable
230
236
  */
231
- selection: PropTypes.bool
237
+ selection: PropTypes.bool,
238
+ /**
239
+ * Specify row id so that it can be used for initial selection
240
+ */
241
+ id: PropTypes.string
232
242
  };
233
243
  function StructuredListInput(props) {
234
244
  const defaultId = useId.useId('structureListInput');
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import React, { type ElementType, type ReactNode } from 'react';
9
- import { type PopoverAlignment } from '../Popover';
9
+ import { type PopoverAlignment, PopoverBaseProps } from '../Popover';
10
10
  import { PolymorphicProps } from '../../types/common';
11
11
  import { PolymorphicComponentPropWithRef } from '../../internal/PolymorphicProps';
12
12
  type ToggletipLabelProps<E extends ElementType> = {
@@ -36,12 +36,7 @@ export declare namespace ToggletipLabel {
36
36
  className: PropTypes.Requireable<string>;
37
37
  };
38
38
  }
39
- export interface ToggletipBaseProps {
40
- align?: PopoverAlignment;
41
- alignmentAxisOffset?: number;
42
- autoAlign?: boolean;
43
- className?: string;
44
- children?: ReactNode;
39
+ export interface ToggletipBaseProps extends Omit<PopoverBaseProps, 'open'> {
45
40
  defaultOpen?: boolean;
46
41
  }
47
42
  export type ToggletipProps<T extends ElementType> = PolymorphicComponentPropWithRef<T, ToggletipBaseProps>;
@@ -53,39 +48,21 @@ export type ToggletipProps<T extends ElementType> = PolymorphicComponentPropWith
53
48
  export declare function Toggletip<E extends ElementType = 'span'>({ align, as, autoAlign, className: customClassName, children, defaultOpen, ...rest }: ToggletipProps<E>): import("react/jsx-runtime").JSX.Element;
54
49
  export declare namespace Toggletip {
55
50
  var propTypes: {
56
- /**
57
- * Specify how the toggletip should align with the button
58
- */
59
- align: PropTypes.Requireable<string>;
60
- /**
61
- * **Experimental:** Provide an offset value for alignment axis. Only takes effect when `autoalign` is enabled.
62
- */
63
- alignmentAxisOffset: PropTypes.Requireable<number>;
64
- /**
65
- * Provide a custom element or component to render the top-level node for the
66
- * component.
67
- */
68
- as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
69
- /**
70
- * Will auto-align the popover on first render if it is not visible. This prop
71
- * is currently experimental and is subject to future changes. Requires
72
- * React v17+
73
- * @see https://github.com/carbon-design-system/carbon/issues/18714
74
- */
75
- autoAlign: PropTypes.Requireable<boolean>;
76
- /**
77
- * Custom children to be rendered as the content of the label
78
- */
79
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
80
- /**
81
- * Provide a custom class name to be added to the outermost node in the
82
- * component
83
- */
84
- className: PropTypes.Requireable<string>;
85
51
  /**
86
52
  * Specify if the toggletip should be open by default
87
53
  */
88
54
  defaultOpen: PropTypes.Requireable<boolean>;
55
+ align?: PopoverAlignment;
56
+ alignmentAxisOffset?: number;
57
+ autoAlign?: boolean;
58
+ autoAlignBoundary?: import("@floating-ui/dom").Boundary;
59
+ caret?: boolean;
60
+ children?: React.ReactNode;
61
+ className?: string;
62
+ dropShadow?: boolean;
63
+ highContrast?: boolean;
64
+ isTabTip?: boolean;
65
+ onRequestClose?: () => void;
89
66
  };
90
67
  }
91
68
  export interface ToggletipButtonBaseProps {
@@ -151,57 +151,17 @@ function Toggletip({
151
151
  autoAlign: autoAlign
152
152
  }, rest), children));
153
153
  }
154
- Toggletip.propTypes = {
155
- /**
156
- * Specify how the toggletip should align with the button
157
- */
158
- align: PropTypes.oneOf(['top', 'top-left',
159
- // deprecated use top-start instead
160
- 'top-right',
161
- // deprecated use top-end instead
162
-
163
- 'bottom', 'bottom-left',
164
- // deprecated use bottom-start instead
165
- 'bottom-right',
166
- // deprecated use bottom-end instead
167
154
 
168
- 'left', 'left-bottom',
169
- // deprecated use left-end instead
170
- 'left-top',
171
- // deprecated use left-start instead
172
-
173
- 'right', 'right-bottom',
174
- // deprecated use right-end instead
175
- 'right-top',
176
- // deprecated use right-start instead
177
-
178
- // new values to match floating-ui
179
- 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
180
- /**
181
- * **Experimental:** Provide an offset value for alignment axis. Only takes effect when `autoalign` is enabled.
182
- */
183
- alignmentAxisOffset: PropTypes.number,
184
- /**
185
- * Provide a custom element or component to render the top-level node for the
186
- * component.
187
- */
188
- as: PropTypes.elementType,
189
- /**
190
- * Will auto-align the popover on first render if it is not visible. This prop
191
- * is currently experimental and is subject to future changes. Requires
192
- * React v17+
193
- * @see https://github.com/carbon-design-system/carbon/issues/18714
194
- */
195
- autoAlign: PropTypes.bool,
196
- /**
197
- * Custom children to be rendered as the content of the label
198
- */
199
- children: PropTypes.node,
200
- /**
201
- * Provide a custom class name to be added to the outermost node in the
202
- * component
203
- */
204
- className: PropTypes.string,
155
+ // Get all the properties from Popover except for "open".
156
+ // The Typescript types for PropTypes are really messed up so we need lots of
157
+ // casting. It will be great when we can finally get rid of PropTypes altogether.
158
+ const {
159
+ open,
160
+ ...popoverNonOpenPropTypes
161
+ } = index.Popover.propTypes ?? {};
162
+ Toggletip.propTypes = {
163
+ // Has all of Popover's PropTypes except for "open".
164
+ ...popoverNonOpenPropTypes,
205
165
  /**
206
166
  * Specify if the toggletip should be open by default
207
167
  */
@@ -50,7 +50,7 @@ const useSelection = ({
50
50
 
51
51
  // Assert special properties (e.g., `disabled`, `isSelectAll`, etc.) are
52
52
  // `any` since those properties aren’t part of the generic type.
53
- const allSelectableItems = filteredItems.filter(item => !item?.disabled);
53
+ const allSelectableItems = filteredItems.filter(item => !item?.disabled && !item?.isSelectAll);
54
54
  const disabledItemCount = filteredItems.filter(item => item?.disabled).length;
55
55
  let newSelectedItems;
56
56
 
@@ -18,15 +18,16 @@ var React = require('react');
18
18
  * node, assigns that node to every ref in the array.
19
19
  */
20
20
  const useMergedRefs = refs => {
21
+ const memoizedRefs = React.useMemo(() => refs, refs);
21
22
  return React.useCallback(node => {
22
- refs.forEach(ref => {
23
+ memoizedRefs.forEach(ref => {
23
24
  if (typeof ref === 'function') {
24
25
  ref(node);
25
26
  } else if (ref) {
26
27
  ref.current = node;
27
28
  }
28
29
  });
29
- }, [refs]);
30
+ }, [memoizedRefs]);
30
31
  };
31
32
 
32
33
  exports.useMergedRefs = useMergedRefs;