@sprinklrjs/spaceweb 14.13.1 → 14.14.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 (72) hide show
  1. package/a11y/accessibilityIsolation.d.ts +5 -0
  2. package/a11y/accessibilityIsolation.js +12 -0
  3. package/asyncSelect/hooks/useAsyncSelect.d.ts +54 -0
  4. package/asyncSelect/hooks/useGroupedAsyncSelect.d.ts +54 -0
  5. package/baseui/modal/modal.d.ts +4 -0
  6. package/baseui/modal/modal.js +24 -2
  7. package/baseui/select/default-props.d.ts +1 -0
  8. package/baseui/select/default-props.js +2 -0
  9. package/baseui/select/select-component.d.ts +4 -0
  10. package/baseui/select/select-component.js +14 -3
  11. package/baseui/select/stateful-select.d.ts +1 -0
  12. package/baseui/select/types.d.ts +5 -0
  13. package/esm/a11y/accessibilityIsolation.d.ts +5 -0
  14. package/esm/a11y/accessibilityIsolation.js +8 -0
  15. package/esm/asyncSelect/hooks/useAsyncSelect.d.ts +54 -0
  16. package/esm/asyncSelect/hooks/useGroupedAsyncSelect.d.ts +54 -0
  17. package/esm/baseui/modal/modal.d.ts +4 -0
  18. package/esm/baseui/modal/modal.js +24 -2
  19. package/esm/baseui/select/default-props.d.ts +1 -0
  20. package/esm/baseui/select/default-props.js +2 -0
  21. package/esm/baseui/select/select-component.d.ts +4 -0
  22. package/esm/baseui/select/select-component.js +12 -2
  23. package/esm/baseui/select/stateful-select.d.ts +1 -0
  24. package/esm/baseui/select/types.d.ts +5 -0
  25. package/esm/list/list-item.d.ts +1 -1
  26. package/esm/list/list-item.js +11 -4
  27. package/esm/list/types.d.ts +2 -2
  28. package/esm/list/useListItemTooltip.d.ts +10 -0
  29. package/esm/list/useListItemTooltip.js +38 -0
  30. package/esm/locale/en_US.js +1 -0
  31. package/esm/menu/StatefulSubMenu.d.ts +1 -1
  32. package/esm/menu/SubMenu.d.ts +1 -1
  33. package/esm/menu/menu-item.d.ts +1 -1
  34. package/esm/menu/menu-item.js +2 -2
  35. package/esm/select/index.d.ts +1 -1
  36. package/esm/select/index.js +1 -1
  37. package/esm/select/locale.d.ts +1 -0
  38. package/esm/select/multi-value.d.ts +1 -0
  39. package/esm/select/multi-value.js +4 -3
  40. package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.d.ts +1 -1
  41. package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.js +28 -7
  42. package/esm/select/selectMenuAdapter/SelectMenuItem.d.ts +2 -2
  43. package/esm/select/selectMenuAdapter/SelectMenuItem.js +13 -6
  44. package/esm/select/selectMenuAdapter/hooks/useRootSelectAllKeyboardNav.d.ts +22 -0
  45. package/esm/select/selectMenuAdapter/hooks/useRootSelectAllKeyboardNav.js +113 -0
  46. package/esm/select/styled-component.js +16 -6
  47. package/esm/select/types.d.ts +1 -0
  48. package/list/list-item.d.ts +1 -1
  49. package/list/list-item.js +10 -3
  50. package/list/types.d.ts +2 -2
  51. package/list/useListItemTooltip.d.ts +10 -0
  52. package/list/useListItemTooltip.js +42 -0
  53. package/locale/en_US.js +1 -0
  54. package/menu/StatefulSubMenu.d.ts +1 -1
  55. package/menu/SubMenu.d.ts +1 -1
  56. package/menu/menu-item.d.ts +1 -1
  57. package/menu/menu-item.js +2 -2
  58. package/package.json +3 -2
  59. package/select/index.d.ts +1 -1
  60. package/select/index.js +2 -1
  61. package/select/locale.d.ts +1 -0
  62. package/select/multi-value.d.ts +1 -0
  63. package/select/multi-value.js +4 -3
  64. package/select/selectMenuAdapter/CollapsibleSelectMenu.d.ts +1 -1
  65. package/select/selectMenuAdapter/CollapsibleSelectMenu.js +27 -6
  66. package/select/selectMenuAdapter/SelectMenuItem.d.ts +2 -2
  67. package/select/selectMenuAdapter/SelectMenuItem.js +13 -6
  68. package/select/selectMenuAdapter/hooks/useRootSelectAllKeyboardNav.d.ts +22 -0
  69. package/select/selectMenuAdapter/hooks/useRootSelectAllKeyboardNav.js +117 -0
  70. package/select/styled-component.js +16 -6
  71. package/select/types.d.ts +1 -0
  72. package/tsconfig.build.tsbuildinfo +1 -1
@@ -15,6 +15,7 @@ import { SIZE, ROLE, CLOSE_SOURCE, BASEWEB_NAME, SIZE_WIDTHS } from './constants
15
15
  import { Root as StyledRoot, Dialog as StyledDialog, DialogContainer as StyledDialogContainer, Hidden, } from './styled-components';
16
16
  import { CloseIcon } from './close-icon';
17
17
  import { isFocusVisible, forkFocus, forkBlur } from '../utils/focusVisible';
18
+ import { isolateAccessibilityTree } from '../../a11y/accessibilityIsolation';
18
19
  var Modal = /** @class */ (function (_super) {
19
20
  __extends(Modal, _super);
20
21
  function Modal() {
@@ -61,6 +62,11 @@ var Modal = /** @class */ (function (_super) {
61
62
  _this.onCloseClick = function () {
62
63
  _this.triggerClose(CLOSE_SOURCE.closeButton);
63
64
  };
65
+ _this.onLayerMount = function () {
66
+ if (_this.props.isOpen) {
67
+ _this.enableModalAccessibilityIsolation();
68
+ }
69
+ };
64
70
  _this.animateOutComplete = function () {
65
71
  _this.setState({
66
72
  isVisible: false,
@@ -82,6 +88,7 @@ var Modal = /** @class */ (function (_super) {
82
88
  }
83
89
  };
84
90
  Modal.prototype.componentWillUnmount = function () {
91
+ this.disableModalAccessibilityIsolation();
85
92
  this.resetMountNodeScroll();
86
93
  this.clearTimers();
87
94
  this.prevMounted = this.mounted;
@@ -121,6 +128,19 @@ var Modal = /** @class */ (function (_super) {
121
128
  this.lastMountNodeOverflowStyle = null;
122
129
  }
123
130
  };
131
+ Modal.prototype.enableModalAccessibilityIsolation = function () {
132
+ if (this.releaseModalAccessibilityIsolation || !this.rootRef.current) {
133
+ return;
134
+ }
135
+ this.releaseModalAccessibilityIsolation = isolateAccessibilityTree(this.rootRef.current);
136
+ };
137
+ Modal.prototype.disableModalAccessibilityIsolation = function () {
138
+ if (!this.releaseModalAccessibilityIsolation) {
139
+ return;
140
+ }
141
+ this.releaseModalAccessibilityIsolation();
142
+ this.releaseModalAccessibilityIsolation = undefined;
143
+ };
124
144
  Modal.prototype.clearTimers = function () {
125
145
  if (this.animateOutTimer) {
126
146
  clearTimeout(this.animateOutTimer);
@@ -140,6 +160,7 @@ var Modal = /** @class */ (function (_super) {
140
160
  // Clear any existing timers (like previous animateOutTimer)
141
161
  this.clearTimers();
142
162
  this.disableMountNodeScroll();
163
+ this.enableModalAccessibilityIsolation();
143
164
  if (this.props.animate) {
144
165
  this.animateStartTimer = requestAnimationFrame(function () {
145
166
  _this.setState({ isVisible: true });
@@ -150,6 +171,7 @@ var Modal = /** @class */ (function (_super) {
150
171
  }
151
172
  };
152
173
  Modal.prototype.didClose = function () {
174
+ this.disableModalAccessibilityIsolation();
153
175
  this.resetMountNodeScroll();
154
176
  this.animateOutTimer = setTimeout(this.animateOutComplete, 500);
155
177
  };
@@ -206,7 +228,7 @@ var Modal = /** @class */ (function (_super) {
206
228
  }
207
229
  return (_jsx(FocusLock, __assign({ disabled: !focusLock,
208
230
  // Allow focus to escape when UI is within an iframe
209
- crossFrame: false, returnFocus: returnFocus, autoFocus: autoFocus }, { children: _jsx(Root, __assign({ "data-baseweb": BASEWEB_NAME, ref: this.rootRef }, sharedProps, rootProps, { children: _jsx(DialogContainer, __assign({ "data-testid": "spaceweb-modal-dialog-container", ref: this.dialogContainerRef }, sharedProps, dialogContainerProps, { children: _jsxs(Dialog, __assign({ tabIndex: -1, "aria-modal": true, role: role }, sharedProps, dialogProps, { style: [dialogueWidth ? { '--sw-width': dialogueWidth } : {}, dialogProps === null || dialogProps === void 0 ? void 0 : dialogProps.style] }, { children: [renderedContent, closeable ? (_jsx(Close, __assign({ onClick: this.onCloseClick }, sharedProps, closeProps, { onFocus: forkFocus(closeProps, this.handleFocus), onBlur: forkBlur(closeProps, this.handleBlur) }, { children: _jsx(CloseIcon, {}) }))) : null] })) })) })) })));
231
+ crossFrame: false, returnFocus: returnFocus, autoFocus: autoFocus }, { children: _jsx(Root, __assign({ "data-baseweb": BASEWEB_NAME, ref: this.rootRef }, sharedProps, rootProps, { children: _jsx(DialogContainer, __assign({ "data-testid": "spaceweb-modal-dialog-container", ref: this.dialogContainerRef }, sharedProps, dialogContainerProps, { children: _jsxs(Dialog, __assign({ tabIndex: -1, role: role }, sharedProps, dialogProps, { style: [dialogueWidth ? { '--sw-width': dialogueWidth } : {}, dialogProps === null || dialogProps === void 0 ? void 0 : dialogProps.style] }, { children: [renderedContent, closeable ? (_jsx(Close, __assign({ onClick: this.onCloseClick }, sharedProps, closeProps, { onFocus: forkFocus(closeProps, this.handleFocus), onBlur: forkBlur(closeProps, this.handleBlur) }, { children: _jsx(CloseIcon, {}) }))) : null] })) })) })) })));
210
232
  };
211
233
  Modal.prototype.render = function () {
212
234
  // Only render an open and non-renderAll modal on the browser (portals aren't supported server-side)
@@ -214,7 +236,7 @@ var Modal = /** @class */ (function (_super) {
214
236
  var renderedContent = mountedAndOpen || this.props.renderAll ? this.getChildren() : null;
215
237
  if (renderedContent) {
216
238
  if (mountedAndOpen) {
217
- return (_jsx(Layer, __assign({ onEscape: this.onEscape, onDocumentClick: this.onDocumentClick, mountNode: this.props.mountNode }, { children: this.renderModal(renderedContent) })));
239
+ return (_jsx(Layer, __assign({ onEscape: this.onEscape, onDocumentClick: this.onDocumentClick, onMount: this.onLayerMount, mountNode: this.props.mountNode }, { children: this.renderModal(renderedContent) })));
218
240
  }
219
241
  return _jsx(Hidden, { children: renderedContent });
220
242
  }
@@ -32,6 +32,7 @@ declare const defaultProps: {
32
32
  filterOutSelected: boolean;
33
33
  getOptionLabel: null;
34
34
  getValueLabel: null;
35
+ getValueAriaLabel: null;
35
36
  ignoreCase: boolean;
36
37
  isLoading: boolean;
37
38
  labelKey: string;
@@ -31,6 +31,8 @@ var defaultProps = {
31
31
  getOptionLabel: null,
32
32
  // @ts-ignore
33
33
  getValueLabel: null,
34
+ // @ts-ignore
35
+ getValueAriaLabel: null,
34
36
  ignoreCase: true,
35
37
  isLoading: false,
36
38
  labelKey: 'label',
@@ -5,6 +5,8 @@ type GetOptionLabel = NonNullable<SelectProps['getOptionLabel']>;
5
5
  export declare function getOptionLabel({ option }: Parameters<GetOptionLabel>[0], { selectLocale, labelKey }: SelectProps): ReactNode;
6
6
  type GetValueLabel = NonNullable<SelectProps['getValueLabel']>;
7
7
  export declare function getValueLabel({ option }: Parameters<GetValueLabel>[0], { labelKey }: SelectProps): ReactNode;
8
+ type GetValueAriaLabel = NonNullable<SelectProps['getValueAriaLabel']>;
9
+ export declare function getValueAriaLabel({ option }: Parameters<GetValueAriaLabel>[0], { labelKey }: SelectProps): string | undefined;
8
10
  declare class Select extends Component<SelectProps, SelectState> {
9
11
  static defaultProps: {
10
12
  'aria-label': null;
@@ -39,6 +41,7 @@ declare class Select extends Component<SelectProps, SelectState> {
39
41
  filterOutSelected: boolean;
40
42
  getOptionLabel: null;
41
43
  getValueLabel: null;
44
+ getValueAriaLabel: null;
42
45
  ignoreCase: boolean;
43
46
  isLoading: boolean;
44
47
  labelKey: string;
@@ -108,6 +111,7 @@ declare class Select extends Component<SelectProps, SelectState> {
108
111
  handleKeyDown: (event: KeyboardEvent) => void;
109
112
  getOptionLabel: GetOptionLabel;
110
113
  getValueLabel: GetValueLabel;
114
+ getValueAriaLabel: GetValueAriaLabel;
111
115
  getMemoizedOptionsMap: (options: Options, valueKey: string) => Map<string, Option>;
112
116
  /**
113
117
  * Extends the value into an array from the given options
@@ -49,6 +49,12 @@ export function getValueLabel(_a, _b) {
49
49
  var labelKey = _b.labelKey;
50
50
  return labelKey && option[labelKey];
51
51
  }
52
+ export function getValueAriaLabel(_a, _b) {
53
+ var option = _a.option;
54
+ var labelKey = _b.labelKey;
55
+ var label = labelKey && option[labelKey];
56
+ return typeof label === 'string' ? label : undefined;
57
+ }
52
58
  var Select = /** @class */ (function (_super) {
53
59
  __extends(Select, _super);
54
60
  function Select() {
@@ -401,6 +407,8 @@ var Select = /** @class */ (function (_super) {
401
407
  _this.getOptionLabel = function (optionData, props) { return getOptionLabel(optionData, props); };
402
408
  // eslint-disable-next-line class-methods-use-this -- delegates to module-level helper
403
409
  _this.getValueLabel = function (optionData, props) { return getValueLabel(optionData, props); };
410
+ // eslint-disable-next-line class-methods-use-this -- delegates to module-level helper
411
+ _this.getValueAriaLabel = function (optionData, props) { return getValueAriaLabel(optionData, props); };
404
412
  _this.getMemoizedOptionsMap = memoizeOne(function (options, valueKey) {
405
413
  var normalizedOptions = _this.getMemoizedNormalizedOptions(options);
406
414
  return new Map(normalizedOptions.map(function (option) { return [String(option[valueKey]), option]; }));
@@ -768,6 +776,7 @@ var Select = /** @class */ (function (_super) {
768
776
  var _a = this.props.overrides, overrides = _a === void 0 ? {} : _a;
769
777
  var sharedProps = this.getSharedProps();
770
778
  var renderLabel = this.props.getValueLabel || this.getValueLabel;
779
+ var renderAriaLabel = this.props.getValueAriaLabel || this.getValueAriaLabel;
771
780
  var Value = this.props.valueComponent || Noop;
772
781
  var _b = __read(getOverrides(overrides.ExtraTagPopover, StatefulPopover), 2), ExtraTagPopover = _b[0], extraTagPopoverProps = _b[1];
773
782
  var _c = __read(getOverrides(overrides.ExtraTagPopoverList, List), 2), ExtraTagPopoverList = _c[0], extraTagPopoverListProps = _c[1];
@@ -796,7 +805,7 @@ var Select = /** @class */ (function (_super) {
796
805
  // if not stopped, backspace event will be handled by select as well.
797
806
  // which might remove pop last item from select.
798
807
  e.stopPropagation();
799
- }, disabled: disabled, overrides: { Tag: overrides.Tag, MultiValue: overrides.MultiValue }, tabIndex: 0 }, sharedProps, { "$disabled": disabled, ref: i === _this.state.focusedExtraValueTagIdx
808
+ }, disabled: disabled, overrides: { Tag: overrides.Tag, MultiValue: overrides.MultiValue }, tabIndex: 0 }, sharedProps, { "$disabled": disabled, ariaLabel: renderAriaLabel({ option: value, index: i }, _this.props), ref: i === _this.state.focusedExtraValueTagIdx
800
809
  ? function (valueEl) {
801
810
  valueEl === null || valueEl === void 0 ? void 0 : valueEl.focus();
802
811
  }
@@ -813,6 +822,7 @@ var Select = /** @class */ (function (_super) {
813
822
  var _b = this.props.overrides, overrides = _b === void 0 ? {} : _b;
814
823
  var sharedProps = this.getSharedProps();
815
824
  var renderLabel = this.props.getValueLabel || this.getValueLabel;
825
+ var renderAriaLabel = this.props.getValueAriaLabel || this.getValueAriaLabel;
816
826
  var Value = this.props.valueComponent || Noop;
817
827
  if (!valueArray.length) {
818
828
  return null;
@@ -823,7 +833,7 @@ var Select = /** @class */ (function (_super) {
823
833
  var remainingTagsCount = valueArray.length - _limitTag;
824
834
  return (_jsxs(_Fragment, { children: [valueArray.slice(0, _limitTag).map(function (value, i) {
825
835
  var disabled = sharedProps.$disabled || value.clearableValue === false;
826
- return (_jsx(Value, __assign({ value: value, removeValue: function () { return _this.removeValueAndFocus(value); }, disabled: disabled, overrides: { Tag: overrides.Tag, MultiValue: overrides.MultiValue } }, sharedProps, { "$disabled": disabled, noTooltipOnTruncation: _this.props.noTooltipOnTruncation,
836
+ return (_jsx(Value, __assign({ value: value, removeValue: function () { return _this.removeValueAndFocus(value); }, disabled: disabled, overrides: { Tag: overrides.Tag, MultiValue: overrides.MultiValue } }, sharedProps, { "$disabled": disabled, noTooltipOnTruncation: _this.props.noTooltipOnTruncation, ariaLabel: renderAriaLabel({ option: value, index: i }, _this.props),
827
837
  //react calls ref function whenever we pass it and not just on mount
828
838
  ref: i === _this.state.currentValueTagIdx
829
839
  ? function (valueEl) {
@@ -35,6 +35,7 @@ declare namespace StatefulSelect {
35
35
  filterOutSelected: boolean;
36
36
  getOptionLabel: null;
37
37
  getValueLabel: null;
38
+ getValueAriaLabel: null;
38
39
  ignoreCase: boolean;
39
40
  isLoading: boolean;
40
41
  labelKey: string;
@@ -153,6 +153,11 @@ export type SelectProps = {
153
153
  option: Option;
154
154
  index?: number;
155
155
  }, props: SelectProps) => React.ReactNode) | null;
156
+ /** A custom method to get an aria-label for a selected option tag. */
157
+ getValueAriaLabel?: ((a: {
158
+ option: Option;
159
+ index?: number;
160
+ }, props: SelectProps) => string | undefined) | null;
156
161
  /** Sets the id attribute of the internal input element. Allows for usage with labels. */
157
162
  id?: string;
158
163
  /** Defines if the comparison for a new creatable value should be case-insensitive. */
@@ -22,6 +22,6 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
22
22
  } | undefined;
23
23
  selected?: boolean | undefined;
24
24
  startEnhancer?: Enhancer<ListItemSharedProps>;
25
- tooltipContent?: React.ReactNode | import("../baseui/popover").StatefulContentRenderProp;
25
+ tooltipContent?: React.ReactNode | import("../baseui/popover").ContentRenderProp;
26
26
  } & React.RefAttributes<HTMLElement>>>;
27
27
  export default _default;
@@ -7,7 +7,8 @@ import useCombinedRefs from '../hooks/useCombinedRef';
7
7
  import { useOverrides } from '../overrides';
8
8
  import { StyledChildContainer, StyledEndEnhancer, StyledListItem, StyledStartEnhancer } from './styled-component';
9
9
  import { useFocusVisible } from '../hooks/useFocusVisible';
10
- import { StatefulTooltip as DefaultStatefulTooltip } from '../tooltip';
10
+ import { Tooltip as DefaultTooltip } from '../tooltip';
11
+ import useListItemTooltip, { getListItemTooltipHandlers } from './useListItemTooltip';
11
12
  var ListItem = React.forwardRef(function (_a, ref) {
12
13
  var startEnhancer = _a.startEnhancer, children = _a.children, className = _a.className, style = _a.style, _b = _a.alignItems, alignItems = _b === void 0 ? 'center' : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, endEnhancer = _a.endEnhancer, _d = _a.selected, selected = _d === void 0 ? false : _d, _e = _a.highlighted, highlighted = _e === void 0 ? false : _e, _f = _a.autoFocus, autoFocus = _f === void 0 ? false : _f, _g = _a.button, button = _g === void 0 ? false : _g, _h = _a.overrides, overrides = _h === void 0 ? {} : _h, _j = _a.tabIndex, tabIndex = _j === void 0 ? button ? 0 : undefined : _j, _k = _a.$as, $as = _k === void 0 ? 'li' : _k, onClick = _a.onClick, onKeyDown = _a.onKeyDown, onFocus = _a.onFocus, onBlur = _a.onBlur, _l = _a.tooltipContent, tooltipContent = _l === void 0 ? '' : _l, restProps = __rest(_a, ["startEnhancer", "children", "className", "style", "alignItems", "disabled", "endEnhancer", "selected", "highlighted", "autoFocus", "button", "overrides", "tabIndex", "$as", "onClick", "onKeyDown", "onFocus", "onBlur", "tooltipContent"]);
13
14
  var ownRef = useRef(null);
@@ -46,9 +47,15 @@ var ListItem = React.forwardRef(function (_a, ref) {
46
47
  var renderEnhancer = function (enhancer) {
47
48
  return typeof enhancer === 'function' ? enhancer(sharedProps) : enhancer;
48
49
  };
49
- var _r = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.StatefulTooltip, DefaultStatefulTooltip), 2), StatefulTooltip = _r[0], statefulTooltipProps = _r[1];
50
- var listEl = (_jsxs(Root, __assign({ "data-spaceweb": "list-item", role: "listitem", ref: combinedRef, tabIndex: tabIndex, "aria-disabled": disabled, "$as": $as, onClick: disabled ? _noop : onClick, onKeyDown: handleKeyDown, "data-highlighted": highlighted }, sharedProps, restProps, rootProps, useFocusVisibleProps, { style: [style, rootProps === null || rootProps === void 0 ? void 0 : rootProps.style], className: [className, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className] }, { children: [startEnhancer && (_jsx(StartEnhancer, __assign({}, sharedProps, startEnhancerProps, { children: renderEnhancer(startEnhancer) }))), _jsx(ChildContainer, __assign({}, sharedProps, childContainerProps, { children: children })), endEnhancer && (_jsx(EndEnhancer, __assign({}, sharedProps, endEnhancerProps, { children: renderEnhancer(endEnhancer) })))] })));
51
- return tooltipContent ? (_jsx(StatefulTooltip, __assign({ placement: "bottom", content: tooltipContent, viewportAsBoundary: true }, statefulTooltipProps, { children: listEl }))) : (listEl);
50
+ var _r = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.StatefulTooltip, DefaultTooltip), 2), Tooltip = _r[0], tooltipProps = _r[1];
51
+ var tooltipControlProps = useListItemTooltip({
52
+ highlighted: highlighted,
53
+ tooltipHandlers: getListItemTooltipHandlers(tooltipProps),
54
+ });
55
+ var listEl = (
56
+ // eslint-disable-next-line jsx-a11y/role-supports-aria-props -- aria-disabled required for disabled button list items
57
+ _jsxs(Root, __assign({ "data-spaceweb": "list-item", role: "listitem", ref: combinedRef, tabIndex: tabIndex, "$as": $as, "aria-disabled": disabled, onClick: disabled ? _noop : onClick, onKeyDown: handleKeyDown, "data-highlighted": highlighted }, sharedProps, restProps, rootProps, useFocusVisibleProps, { style: [style, rootProps === null || rootProps === void 0 ? void 0 : rootProps.style], className: [className, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className] }, { children: [startEnhancer && (_jsx(StartEnhancer, __assign({}, sharedProps, startEnhancerProps, { children: renderEnhancer(startEnhancer) }))), _jsx(ChildContainer, __assign({}, sharedProps, childContainerProps, { children: children })), endEnhancer && (_jsx(EndEnhancer, __assign({}, sharedProps, endEnhancerProps, { children: renderEnhancer(endEnhancer) })))] })));
58
+ return tooltipContent ? (_jsx(Tooltip, __assign({ placement: "bottom", showArrow: true, content: tooltipContent, viewportAsBoundary: true }, tooltipProps, tooltipControlProps, { children: listEl }))) : (listEl);
52
59
  });
53
60
  ListItem.displayName = 'ListItem';
54
61
  ListItem.__standard = 'Component';
@@ -1,7 +1,7 @@
1
1
  import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
2
  import type { Override } from '../overrides/types';
3
3
  import type { SpacewebComponentProps } from '../types';
4
- import type { StatefulTooltipProps } from '../tooltip';
4
+ import type { TooltipProps } from '../tooltip/types';
5
5
  export type AlignItems = 'start' | 'center';
6
6
  export type Enhancer<SharedProps> = ReactNode | ((props: SharedProps) => ReactNode);
7
7
  export type ListItemSharedProps = {
@@ -31,7 +31,7 @@ export type ListItemProps = SpacewebComponentProps & {
31
31
  };
32
32
  selected?: boolean;
33
33
  startEnhancer?: Enhancer<ListItemSharedProps>;
34
- tooltipContent?: StatefulTooltipProps['content'];
34
+ tooltipContent?: TooltipProps['content'];
35
35
  };
36
36
  export type ListProps = SpacewebComponentProps & {
37
37
  children?: ReactNode;
@@ -0,0 +1,10 @@
1
+ import type { TooltipProps } from '../tooltip/types';
2
+ export type ListItemTooltipHandlerProps = Pick<TooltipProps, 'onMouseEnter' | 'onMouseLeave' | 'onFocus' | 'onBlur'>;
3
+ export declare const getListItemTooltipHandlers: (tooltipProps: Record<string, unknown>) => Partial<ListItemTooltipHandlerProps>;
4
+ type ListItemTooltipControlProps = Required<Pick<TooltipProps, 'isOpen'>> & ListItemTooltipHandlerProps;
5
+ type Params = {
6
+ highlighted: boolean;
7
+ tooltipHandlers?: Partial<ListItemTooltipHandlerProps>;
8
+ };
9
+ declare const useListItemTooltip: ({ highlighted, tooltipHandlers }: Params) => ListItemTooltipControlProps;
10
+ export default useListItemTooltip;
@@ -0,0 +1,38 @@
1
+ import { __read } from "tslib";
2
+ import { useCallback, useState } from 'react';
3
+ import useCombinedHandler from '../hooks/useCombinedHandler';
4
+ import { isFocusVisible } from '../baseui/utils/focusVisible';
5
+ import { useMenuContext } from '../menu/MenuContext';
6
+ export var getListItemTooltipHandlers = function (tooltipProps) {
7
+ return ({
8
+ onMouseEnter: tooltipProps.onMouseEnter,
9
+ onMouseLeave: tooltipProps.onMouseLeave,
10
+ onFocus: tooltipProps.onFocus,
11
+ onBlur: tooltipProps.onBlur,
12
+ });
13
+ };
14
+ var useListItemTooltip = function (_a) {
15
+ var highlighted = _a.highlighted, _b = _a.tooltipHandlers, tooltipHandlers = _b === void 0 ? {} : _b;
16
+ var listItemFocusVisible = useMenuContext().listItemFocusVisible;
17
+ var _c = __read(useState(false), 2), hoverOpen = _c[0], setHoverOpen = _c[1];
18
+ var onMouseEnter = tooltipHandlers.onMouseEnter, onMouseLeave = tooltipHandlers.onMouseLeave, onFocus = tooltipHandlers.onFocus, onBlur = tooltipHandlers.onBlur;
19
+ var openHoverTooltip = useCallback(function () { return setHoverOpen(true); }, []);
20
+ var closeHoverTooltip = useCallback(function () { return setHoverOpen(false); }, []);
21
+ var openOnFocusVisible = useCallback(function (event) {
22
+ if (isFocusVisible(event)) {
23
+ setHoverOpen(true);
24
+ }
25
+ }, []);
26
+ var onMouseEnterHandler = useCombinedHandler(openHoverTooltip, onMouseEnter);
27
+ var onMouseLeaveHandler = useCombinedHandler(closeHoverTooltip, onMouseLeave);
28
+ var onBlurHandler = useCombinedHandler(closeHoverTooltip, onBlur);
29
+ var onFocusHandler = useCombinedHandler(onFocus, openOnFocusVisible);
30
+ return {
31
+ isOpen: hoverOpen || (highlighted && listItemFocusVisible),
32
+ onMouseEnter: onMouseEnterHandler,
33
+ onMouseLeave: onMouseLeaveHandler,
34
+ onFocus: onFocusHandler,
35
+ onBlur: onBlurHandler,
36
+ };
37
+ };
38
+ export default useListItemTooltip;
@@ -23,6 +23,7 @@ export var DEFAULT_LOCALE = {
23
23
  selectPlaceholder: 'Select...',
24
24
  clearOptionLabel: 'Unassign',
25
25
  selectedValuesPrefix: 'Selected ${values}',
26
+ selectedMultiValuesPrefix: 'Selected ${count} ${countLabel} ${values}',
26
27
  item: 'item',
27
28
  items: 'items',
28
29
  multiValueNavigationDescription: 'Use Left and Right arrow keys to navigate between selected values. Enter BackSpace to remove currently focused value',
@@ -81,7 +81,7 @@ declare const StatefulSubMenu: import("react").ForwardRefExoticComponent<Omit<Me
81
81
  } | undefined;
82
82
  selected?: boolean | undefined;
83
83
  startEnhancer?: import("../list/types").Enhancer<import("../list").ListItemSharedProps>;
84
- tooltipContent?: ReactNode | import("../baseui/popover").StatefulContentRenderProp;
84
+ tooltipContent?: ReactNode | import("../baseui/popover").ContentRenderProp;
85
85
  } & Record<string, any>> | undefined;
86
86
  Popover?: Override<Omit<import("../baseui/popover").PopoverProps, "children" | "overrides" | "placement" | "triggerType"> & {
87
87
  overrides?: ({
@@ -82,7 +82,7 @@ declare const SubMenu: import("react").ForwardRefExoticComponent<Omit<MenuProps,
82
82
  } | undefined;
83
83
  selected?: boolean | undefined;
84
84
  startEnhancer?: import("../list/types").Enhancer<import("../list").ListItemSharedProps>;
85
- tooltipContent?: ReactNode | import("../baseui/popover").StatefulContentRenderProp;
85
+ tooltipContent?: ReactNode | import("../baseui/popover").ContentRenderProp;
86
86
  } & Record<string, any>> | undefined;
87
87
  Popover?: Override<Omit<import("../baseui/popover").PopoverProps, "children" | "overrides" | "placement" | "triggerType"> & {
88
88
  overrides?: ({
@@ -30,7 +30,7 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
30
30
  } | undefined;
31
31
  selected?: boolean | undefined;
32
32
  startEnhancer?: import("../list/types").Enhancer<ListItemSharedProps>;
33
- tooltipContent?: React.ReactNode | import("../baseui/popover").StatefulContentRenderProp;
33
+ tooltipContent?: React.ReactNode | import("../baseui/popover").ContentRenderProp;
34
34
  } & Record<string, any>> | undefined;
35
35
  Popover?: import("../overrides").Override<Omit<import("../baseui/popover").PopoverProps, "children" | "overrides" | "placement" | "triggerType"> & {
36
36
  overrides?: ({
@@ -87,7 +87,7 @@ function MenuActionContainer(_a) {
87
87
  }
88
88
  function buildListItemAriaProps(itemRole, selected, ChildMenu) {
89
89
  var props = {};
90
- if (selected !== undefined) {
90
+ if (selected !== undefined && itemRole !== 'checkbox') {
91
91
  props['aria-selected'] = Boolean(selected);
92
92
  }
93
93
  if (ChildMenu) {
@@ -140,7 +140,7 @@ var MenuItem = React.forwardRef(function MenuItem(_a, ref) {
140
140
  var _a, _b;
141
141
  setMenuContainerRef((_b = (_a = ownRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) !== null && _b !== void 0 ? _b : null);
142
142
  }, [setMenuContainerRef]);
143
- var isItemHighlighted = highlighted || (highlightedItem !== null && highlightedItem === ownRef.current);
143
+ var isItemHighlighted = highlighted !== null && highlighted !== void 0 ? highlighted : (highlightedItem !== null && highlightedItem === ownRef.current);
144
144
  var resolvedItemActions = useMemo(function () { return resolveMenuActions(getActionsElement, $item); }, [getActionsElement, $item]);
145
145
  var shouldRenderActions = ((_b = resolvedItemActions === null || resolvedItemActions === void 0 ? void 0 : resolvedItemActions.length) !== null && _b !== void 0 ? _b : 0) > 0 && !ChildMenu && !hideInlineActions;
146
146
  var resolvedEndEnhancer = useResolvedMenuEndEnhancer(resolvedItemActions, shouldRenderActions, endEnhancer, ChildMenu);
@@ -19,4 +19,4 @@ export { CollapsibleSelectMenu } from './selectMenuAdapter/CollapsibleSelectMenu
19
19
  export { NestedSelect } from './nested-select';
20
20
  export { OverridenPopover } from './mobileSelect/overrides';
21
21
  export { filterOptions as defaultFilterOptions } from './utils/default-filter-options';
22
- export { getOptionLabel, getValueLabel } from '../baseui/select/select-component';
22
+ export { getOptionLabel, getValueLabel, getValueAriaLabel } from '../baseui/select/select-component';
@@ -17,4 +17,4 @@ export { NestedSelect } from './nested-select';
17
17
  export { OverridenPopover } from './mobileSelect/overrides';
18
18
  // Utils
19
19
  export { filterOptions as defaultFilterOptions } from './utils/default-filter-options';
20
- export { getOptionLabel, getValueLabel } from '../baseui/select/select-component';
20
+ export { getOptionLabel, getValueLabel, getValueAriaLabel } from '../baseui/select/select-component';
@@ -5,6 +5,7 @@ export type SelectLocale = {
5
5
  selectPlaceholder: string;
6
6
  clearOptionLabel: string;
7
7
  selectedValuesPrefix: string;
8
+ selectedMultiValuesPrefix: string;
8
9
  item: string;
9
10
  items: string;
10
11
  collapsibleMenuDescription: string;
@@ -18,6 +18,7 @@ declare const MultiValue: React.ForwardRefExoticComponent<Omit<TagProps, "overri
18
18
  __groupSelectAll?: boolean | undefined;
19
19
  }>>;
20
20
  $valueKey: string;
21
+ ariaLabel?: string | undefined;
21
22
  value: Readonly<{
22
23
  [x: string]: any;
23
24
  id?: import("./types").Id | undefined;
@@ -11,7 +11,7 @@ import { CLEARABLE_KEY, LOADING_KEY } from './constants';
11
11
  import useCombinedRefs from '../hooks/useCombinedRef';
12
12
  var MultiValue = React.forwardRef(function (props, ref) {
13
13
  var _a, _b, _c;
14
- var _d = props.overrides, overrides = _d === void 0 ? {} : _d, onActionClick = props.onActionClick, value = props.value, selectSize = props.selectSize, $disabled = props.$disabled, $valueByIdMap = props.$valueByIdMap, $valueKey = props.$valueKey, _$size = props.$size, _$isContainerFocused = props.$isContainerFocused, restProps = __rest(props, ["overrides", "onActionClick", "value", "selectSize", "$disabled", "$valueByIdMap", "$valueKey", "$size", "$isContainerFocused"]);
14
+ var _d = props.overrides, overrides = _d === void 0 ? {} : _d, onActionClick = props.onActionClick, value = props.value, selectSize = props.selectSize, $disabled = props.$disabled, $valueByIdMap = props.$valueByIdMap, $valueKey = props.$valueKey, _$size = props.$size, _$isContainerFocused = props.$isContainerFocused, ariaLabel = props.ariaLabel, children = props.children, restProps = __rest(props, ["overrides", "onActionClick", "value", "selectSize", "$disabled", "$valueByIdMap", "$valueKey", "$size", "$isContainerFocused", "ariaLabel", "children"]);
15
15
  var _e = __read(useOverrides(overrides.Tag, Tag), 2), TagComponent = _e[0], tagProps = _e[1];
16
16
  var theme = useStyle().theme;
17
17
  var tagRef = useRef();
@@ -49,6 +49,7 @@ var MultiValue = React.forwardRef(function (props, ref) {
49
49
  break;
50
50
  }
51
51
  var closeable = (_b = tagProps.closeable) !== null && _b !== void 0 ? _b : !disabled;
52
+ var resolvedAriaLabel = ariaLabel || (typeof children === 'string' ? children : undefined);
52
53
  var tagSpacingClasses;
53
54
  switch (selectSize) {
54
55
  case 'xxxs':
@@ -64,7 +65,7 @@ var MultiValue = React.forwardRef(function (props, ref) {
64
65
  tagSpacingClasses = 'mr-1 my-0.5';
65
66
  break;
66
67
  }
67
- return (_jsx(TagComponent, __assign({ ref: combinedRef, variant: "light", intent: "default", "aria-label": typeof restProps.children === 'string' ? restProps.children : '', tabIndex: -1, onActionClick: onActionClickHandler, "$item": value, "$disabled": disabled, size: tagSize }, restProps, tagProps, { closeable: closeable, overrides: mergeOverrides({
68
+ return (_jsx(TagComponent, __assign({ ref: combinedRef, variant: "light", intent: "default" }, (resolvedAriaLabel ? { 'aria-label': resolvedAriaLabel } : {}), { tabIndex: -1, onActionClick: onActionClickHandler, "$item": value, "$disabled": disabled, size: tagSize }, restProps, tagProps, { closeable: closeable, overrides: mergeOverrides({
68
69
  Root: {
69
70
  className: [
70
71
  'box-border max-w-[--sw-max-width]',
@@ -85,6 +86,6 @@ var MultiValue = React.forwardRef(function (props, ref) {
85
86
  },
86
87
  },
87
88
  Action: { props: { tabIndex: -1 } },
88
- }, tagProps.overrides) }, { children: isLoading ? (_jsx(StyledTombstone, { "data-testid": "multi-value-tombstone", className: "w-20 h-4 rounded-8" })) : (props.children) })));
89
+ }, tagProps.overrides) }, { children: isLoading ? _jsx(StyledTombstone, { "data-testid": "multi-value-tombstone", className: "w-20 h-4 rounded-8" }) : children })));
89
90
  });
90
91
  export default MultiValue;
@@ -67,7 +67,7 @@ export declare const CollapsibleSelectMenu: ({ overrides, value, items: groupedI
67
67
  } | undefined;
68
68
  selected?: boolean | undefined;
69
69
  startEnhancer?: import("../../list/types").Enhancer<import("../../list").ListItemSharedProps>;
70
- tooltipContent?: ReactNode | import("../../baseui/popover").StatefulContentRenderProp;
70
+ tooltipContent?: ReactNode | import("../../baseui/popover").ContentRenderProp;
71
71
  } & Record<string, any>> | undefined;
72
72
  Popover?: import("../../overrides").Override<Omit<import("../../baseui/popover").PopoverProps, "children" | "overrides" | "placement" | "triggerType"> & {
73
73
  overrides?: ({
@@ -1,8 +1,9 @@
1
1
  import { __assign, __read } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import _isNumber from 'lodash/isNumber';
4
- import { useEffect, useMemo, useRef, useCallback } from 'react';
4
+ import { useCallback, useEffect, useMemo, useRef } from 'react';
5
5
  import { useGetExpandedGroup } from './hooks/useGetExpandedGroup';
6
+ import { useRootSelectAllKeyboardNav } from './hooks/useRootSelectAllKeyboardNav';
6
7
  import { Box } from '../../box';
7
8
  import { Menu } from '../../menu';
8
9
  import { Typography } from '../../typography';
@@ -46,6 +47,7 @@ export var CollapsibleSelectMenu = function (_a) {
46
47
  var isFirstItemHighlighted = useRef(false);
47
48
  var isLastItemHighlighted = useRef(false);
48
49
  var menuRef = useRef(null);
50
+ var selectAllItem = shouldDisplaySelectAll ? groupedItems[UNGROUPED_ID][0] : null;
49
51
  var ownerDocument = useDocument();
50
52
  var _l = useSelectIds(), listboxId = _l.listboxId, menuDescriptionId = _l.menuDescriptionId;
51
53
  var selectedValuesSet = useMemo(function () {
@@ -72,6 +74,17 @@ export var CollapsibleSelectMenu = function (_a) {
72
74
  var mergedOverrides = useMemo(function () { return mergeOverrides(selectMenuOverrides, overrides); }, [overrides]);
73
75
  var _m = __read(useOverrides(mergedOverrides.Menu, Menu), 2), MenuComponent = _m[0], menuProps = _m[1];
74
76
  var _o = __read(useOverrides(mergedOverrides.NoResults, NoResults), 2), NoResultsOverriden = _o[0], noResultsProps = _o[1];
77
+ var _p = useRootSelectAllKeyboardNav({
78
+ menuRef: menuRef,
79
+ selectAllItem: selectAllItem,
80
+ ownerDocument: ownerDocument,
81
+ expandedGroupId: expandedGroupId,
82
+ setExpandedGroupId: setExpandedGroupId,
83
+ groupConfig: groupConfig,
84
+ onItemSelect: onItemSelect,
85
+ inputElement: inputElement,
86
+ isFirstItemHighlighted: isFirstItemHighlighted,
87
+ }), selectAllItemRef = _p.selectAllItemRef, isRootSelectAllHighlighted = _p.isRootSelectAllHighlighted, leaveRootSelectAllHighlight = _p.leaveRootSelectAllHighlight;
75
88
  var menuItemOverrides = useMemo(function () { return ({
76
89
  MenuItem: mergedOverrides.MenuItem,
77
90
  ListItemText: mergedOverrides.ListItemText,
@@ -104,6 +117,9 @@ export var CollapsibleSelectMenu = function (_a) {
104
117
  }, [expandedGroupId, groupedItems]);
105
118
  var handleOnHighlightedItemChange = function (item) {
106
119
  var _a;
120
+ if (item) {
121
+ leaveRootSelectAllHighlight();
122
+ }
107
123
  var nextHighlightableElement = getNextItemIndexToHighlight(item !== null && item !== void 0 ? item : null, menuRef.current, nextItem);
108
124
  var prevHighlightableElement = getNextItemIndexToHighlight(item !== null && item !== void 0 ? item : null, menuRef.current, prevItem);
109
125
  isFirstItemHighlighted.current = !!(item && (!item.previousSibling || item === prevHighlightableElement));
@@ -111,13 +127,18 @@ export var CollapsibleSelectMenu = function (_a) {
111
127
  (_a = menuProps === null || menuProps === void 0 ? void 0 : menuProps.onHighlightedItemChange) === null || _a === void 0 ? void 0 : _a.call(menuProps, item);
112
128
  };
113
129
  var handleOnClick = useCallback(function (newGroupId) {
130
+ leaveRootSelectAllHighlight();
114
131
  setExpandedGroupId(function (prev) { return (prev === newGroupId ? undefined : newGroupId); });
115
132
  inputElement === null || inputElement === void 0 ? void 0 : inputElement.focus();
116
- }, [inputElement, setExpandedGroupId]);
117
- var selectAllItem = shouldDisplaySelectAll ? groupedItems[UNGROUPED_ID][0] : null;
133
+ }, [inputElement, setExpandedGroupId, leaveRootSelectAllHighlight]);
118
134
  var clearAsOptionItem = !multi && clearAsOption ? groupedItems[UNGROUPED_ID][0] : null;
119
135
  var locale = useLocale().select;
120
- return (_jsxs(Box, __assign({ className: "rounded-inherit" }, { children: [selectAllItem ? (_jsx(SelectMenuItem, __assign({ overrides: menuItemOverrides, item: selectAllItem, selected: globalSelectAllSelected, multi: multi, getItemLabel: getItemLabel, labelKey: labelKey, valueKey: valueKey, onItemSelect: onItemSelect, "$item": selectAllItem, button: true, "data-testid": "universal-select-all" }, baseuiMenuItemProps, { className: ['m-2', baseuiMenuItemProps === null || baseuiMenuItemProps === void 0 ? void 0 : baseuiMenuItemProps.className] }), "select-all-option")) : null, groupConfig.map(function (_group, index) {
136
+ var isMenuItemHighlighted = isRootSelectAllHighlighted ? false : undefined;
137
+ return (_jsxs(Box, __assign({ className: "rounded-inherit" }, { children: [selectAllItem ? (_jsx(SelectMenuItem, __assign({ ref: selectAllItemRef, overrides: menuItemOverrides, item: selectAllItem, selected: globalSelectAllSelected, highlighted: isRootSelectAllHighlighted, multi: multi, getItemLabel: getItemLabel, labelKey: labelKey, valueKey: valueKey, onItemSelect: onItemSelect, "$item": selectAllItem, "$as": "div", button: true, "data-testid": "universal-select-all" }, baseuiMenuItemProps, {
138
+ // Root Select All sits outside the options listbox, so it must be role="checkbox" (not role="option" )
139
+ // See SAP UI5 MultiComboBox Select All:
140
+ // https://ui5.sap.com/#/entity/sap.m.MultiComboBox/sample/sap.m.sample.MultiComboBoxSelectAll
141
+ role: "checkbox", className: ['m-2', baseuiMenuItemProps === null || baseuiMenuItemProps === void 0 ? void 0 : baseuiMenuItemProps.className] }), "select-all-option")) : null, groupConfig.map(function (_group, index) {
121
142
  var _a;
122
143
  var _b, _c;
123
144
  var groupId = _group.id, groupLabel = _group.label;
@@ -137,11 +158,11 @@ export var CollapsibleSelectMenu = function (_a) {
137
158
  _a[GROUP_SELECT_ALL_ID] = true,
138
159
  _a.selected = groupSelectAllSelected,
139
160
  _a);
140
- return (_jsxs(Collapsible, __assign({ className: index === 0 && selectAllItem ? 'border-t-1 border-solid spr-border-primary' : '', group: group, expanded: disableWhenSelectAllChecked && globalSelectAllSelected ? false : groupId === expandedGroupId, disabled: disableWhenSelectAllChecked && globalSelectAllSelected, onClick: handleOnClick }, { children: [_jsx(HiddenElement, __assign({ id: menuDescriptionId !== null && menuDescriptionId !== void 0 ? menuDescriptionId : '' }, { children: "".concat(groupLabel, " ").concat(locale.groupExpandedSuffix) })), _isEmpty(itemsInGroup) ? (_jsx(NoResultsOverriden, __assign({ "aria-live": "polite", "aria-atomic": true, msg: noResultsMsg, noResultsConfig: noResultsConfig, "aria-disabled": true, "$groupId": groupId }, noResultsProps))) : (_jsxs(MenuComponent, __assign({ resetMenuHighlightOnMouseLeave: true, focusWhenNavigationEnabled: false, keyboardFocusRestoreTarget: inputElement, tabIndex: -1, selectOnTab: selectOnTab, getActionsElement: getActionsElement }, menuProps, { role: "listbox", id: listboxId, virtual: virtual, className: ['overflow-auto max-h-50 pt-0', menuProps === null || menuProps === void 0 ? void 0 : menuProps.className], onScroll: function (e) {
161
+ return (_jsxs(Collapsible, __assign({ className: index === 0 && selectAllItem ? 'border-t-1 border-solid spr-border-primary' : '', group: group, expanded: disableWhenSelectAllChecked && globalSelectAllSelected ? false : groupId === expandedGroupId, disabled: disableWhenSelectAllChecked && globalSelectAllSelected, onClick: handleOnClick }, { children: [_jsx(HiddenElement, __assign({ id: menuDescriptionId !== null && menuDescriptionId !== void 0 ? menuDescriptionId : '' }, { children: "".concat(groupLabel, " ").concat(locale.groupExpandedSuffix) })), _isEmpty(itemsInGroup) ? (_jsx(NoResultsOverriden, __assign({ "aria-live": "polite", "aria-atomic": true, msg: noResultsMsg, noResultsConfig: noResultsConfig, "aria-disabled": true, "$groupId": groupId }, noResultsProps))) : (_jsxs(MenuComponent, __assign({ resetMenuHighlightOnMouseLeave: true, focusWhenNavigationEnabled: false, disableAutoHighlight: isRootSelectAllHighlighted, keyboardFocusRestoreTarget: inputElement, tabIndex: -1, selectOnTab: selectOnTab, getActionsElement: getActionsElement }, menuProps, { role: "listbox", id: listboxId, virtual: virtual, className: ['overflow-auto max-h-50 pt-0', menuProps === null || menuProps === void 0 ? void 0 : menuProps.className], onScroll: function (e) {
141
162
  $onPaginate === null || $onPaginate === void 0 ? void 0 : $onPaginate(e, groupId);
142
- }, onHighlightedItemChange: handleOnHighlightedItemChange, ref: menuRef }, { children: [shouldDisplayGroupSelectAll ? (_jsx(SelectMenuItem, __assign({ overrides: menuItemOverrides, item: groupSelectAllItem, "data-testid": "".concat(group.label, "-group-select-all"), selected: groupSelectAllSelected, multi: multi, getItemLabel: getItemLabel, labelKey: labelKey, valueKey: valueKey, onItemSelect: onItemSelect, "$item": groupSelectAllItem, button: true, disabled: group.count <= countDisabledOptions }, baseuiMenuItemProps), "select-all-option")) : null, clearAsOptionItem ? (_jsx(SelectMenuItem, __assign({ overrides: menuItemOverrides, item: clearAsOptionItem, selected: false, multi: multi, getItemLabel: getItemLabel, labelKey: labelKey, valueKey: valueKey, onItemSelect: onItemSelect, "$item": clearAsOptionItem, button: true }, baseuiMenuItemProps), "clear-option")) : null, itemsInGroup.map(function (item) {
163
+ }, onHighlightedItemChange: handleOnHighlightedItemChange, ref: menuRef }, { children: [shouldDisplayGroupSelectAll ? (_jsx(SelectMenuItem, __assign({ overrides: menuItemOverrides, item: groupSelectAllItem, "data-testid": "".concat(group.label, "-group-select-all"), selected: groupSelectAllSelected, multi: multi, getItemLabel: getItemLabel, labelKey: labelKey, valueKey: valueKey, onItemSelect: onItemSelect, "$item": groupSelectAllItem, button: true, disabled: group.count <= countDisabledOptions, highlighted: isMenuItemHighlighted }, baseuiMenuItemProps), "select-all-option")) : null, clearAsOptionItem ? (_jsx(SelectMenuItem, __assign({ overrides: menuItemOverrides, item: clearAsOptionItem, selected: false, multi: multi, getItemLabel: getItemLabel, labelKey: labelKey, valueKey: valueKey, onItemSelect: onItemSelect, "$item": clearAsOptionItem, button: true, highlighted: isMenuItemHighlighted }, baseuiMenuItemProps), "clear-option")) : null, itemsInGroup.map(function (item) {
143
164
  var selected = selectedValuesSet.has(item[valueKey]);
144
- return (_jsx(SelectMenuItem, __assign({ overrides: menuItemOverrides, item: item, selected: selected, multi: multi, getItemLabel: getItemLabel, labelKey: labelKey, valueKey: valueKey, onItemSelect: onItemSelect, "$item": item, button: true }, baseuiMenuItemProps), item.isCreatable ? 'creatable-option' : item[valueKey]));
165
+ return (_jsx(SelectMenuItem, __assign({ overrides: menuItemOverrides, item: item, selected: selected, multi: multi, getItemLabel: getItemLabel, labelKey: labelKey, valueKey: valueKey, onItemSelect: onItemSelect, "$item": item, button: true, highlighted: isMenuItemHighlighted }, baseuiMenuItemProps), item.isCreatable ? 'creatable-option' : item[valueKey]));
145
166
  })] })))] }), groupId));
146
167
  })] })));
147
168
  };
@@ -3,7 +3,7 @@ import { type ListItemTextProps } from '../../list';
3
3
  import { type Override } from '../../overrides';
4
4
  import type { MenuItemProps } from '../../menu';
5
5
  import type { SelectProps } from '../types';
6
- declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<MenuItemProps, "selected"> & Pick<SelectProps, "labelKey" | "multi" | "valueKey"> & {
6
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<MenuItemProps, "selected" | "role"> & Pick<SelectProps, "labelKey" | "multi" | "valueKey"> & {
7
7
  item: Record<string, any>;
8
8
  getItemLabel: (item: Record<string, any>) => React.ReactNode;
9
9
  onItemSelect: (item: Record<string, any>) => void;
@@ -38,7 +38,7 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
38
38
  } | undefined;
39
39
  selected?: boolean | undefined;
40
40
  startEnhancer?: import("../../list/types").Enhancer<import("../../list").ListItemSharedProps>;
41
- tooltipContent?: React.ReactNode | import("../../baseui/popover").StatefulContentRenderProp;
41
+ tooltipContent?: React.ReactNode | import("../../baseui/popover").ContentRenderProp;
42
42
  } & Record<string, any>> | undefined;
43
43
  Popover?: Override<Omit<import("../../baseui/popover").PopoverProps, "children" | "overrides" | "placement" | "triggerType"> & {
44
44
  overrides?: ({
@@ -16,10 +16,11 @@ var shouldHideSelectItemActions = function (item) {
16
16
  return Boolean(item[SELECT_ALL_ID] || item[GROUP_SELECT_ALL_ID] || item[CLEAR_OPTION_ID] || item.isCreatable);
17
17
  };
18
18
  var SelectMenuItem = React.forwardRef(function (_a, ref) {
19
- var item = _a.item, valueKey = _a.valueKey, overrides = _a.overrides, labelKey = _a.labelKey, multi = _a.multi, selected = _a.selected, getItemLabel = _a.getItemLabel, onItemSelect = _a.onItemSelect, restProps = __rest(_a, ["item", "valueKey", "overrides", "labelKey", "multi", "selected", "getItemLabel", "onItemSelect"]);
20
- var _b = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.MenuItem, MenuItem), 2), MenuItemOverriden = _b[0], menuItemProps = _b[1];
21
- var _c = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.Checkbox, Checkbox), 2), CheckboxOverriden = _c[0], checkboxProps = _c[1];
22
- var _d = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.ListItemText, ListItemText), 2), ListItemTextOverriden = _d[0], listItemTextProps = _d[1];
19
+ var item = _a.item, valueKey = _a.valueKey, overrides = _a.overrides, labelKey = _a.labelKey, multi = _a.multi, selected = _a.selected, getItemLabel = _a.getItemLabel, onItemSelect = _a.onItemSelect, _b = _a.role, role = _b === void 0 ? 'option' : _b, restProps = __rest(_a, ["item", "valueKey", "overrides", "labelKey", "multi", "selected", "getItemLabel", "onItemSelect", "role"]);
20
+ var isCheckboxRole = role === 'checkbox';
21
+ var _c = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.MenuItem, MenuItem), 2), MenuItemOverriden = _c[0], menuItemProps = _c[1];
22
+ var _d = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.Checkbox, Checkbox), 2), CheckboxOverriden = _d[0], checkboxProps = _d[1];
23
+ var _e = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.ListItemText, ListItemText), 2), ListItemTextOverriden = _e[0], listItemTextProps = _e[1];
23
24
  var handleItemSelect = useCallback(function (event) { return onItemSelect({ item: item, event: event }); }, [item, onItemSelect]);
24
25
  var textOverrides = listItemTextProps === null || listItemTextProps === void 0 ? void 0 : listItemTextProps.overrides;
25
26
  var listItemTextOverrides = useMemo(function () {
@@ -32,14 +33,20 @@ var SelectMenuItem = React.forwardRef(function (_a, ref) {
32
33
  var id = useUniqueId();
33
34
  var checkboxPropsOverrides = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.overrides;
34
35
  var checkboxOverrides = useMemo(function () {
35
- return mergeOverrides({ Input: { props: { 'aria-labelledby': id, tabIndex: -1 } }, Label: { className: 'hidden' } }, checkboxPropsOverrides);
36
+ return mergeOverrides({
37
+ Input: {
38
+ props: { 'aria-labelledby': id, tabIndex: -1 },
39
+ className: 'invisible',
40
+ },
41
+ Label: { className: 'hidden' },
42
+ }, checkboxPropsOverrides);
36
43
  }, [id, checkboxPropsOverrides]);
37
44
  // Passes intent to override intent from useContextualFormProps,
38
45
  // see: https://prod-gitlab.sprinklr.com/sprinklr/frontend/spaceweb/-/issues/282
39
46
  var startEnhancer = useMemo(function () {
40
47
  return multi && (_jsx(CheckboxOverriden, __assign({ checked: selected, size: "medium", disabled: item.disabled, intent: "default" }, checkboxProps, { overrides: checkboxOverrides })));
41
48
  }, [multi, CheckboxOverriden, selected, item.disabled, checkboxProps, checkboxOverrides]);
42
- var menuItemEl = (_jsx(MenuItemOverriden, __assign({ role: "option", "aria-selected": selected,
49
+ var menuItemEl = (_jsx(MenuItemOverriden, __assign({ role: role }, (isCheckboxRole ? { 'aria-checked': selected } : { 'aria-selected': selected }), {
43
50
  // for Multi Select variant do not show selected styles
44
51
  selected: multi ? false : selected, onClick: handleItemSelect, startEnhancer: startEnhancer, disabled: item.disabled, "$multi": multi, tabIndex: -1, "$item": item, "$valueKey": valueKey, "$labelKey": labelKey, ref: ref, id: id, tooltipContent: item.tooltipContent, hideInlineActions: shouldHideSelectItemActions(item) }, restProps, menuItemProps, { children: _jsx(ListItemTextOverriden, __assign({ "$multi": multi, "$item": item, "$labelKey": labelKey }, listItemTextProps, { overrides: listItemTextOverrides }, { children: getItemLabel(item) })) })));
45
52
  return item.disabled && item.disabledTooltipConfig ? (_jsx(ActionableTooltip, __assign({}, item.disabledTooltipConfig, { children: menuItemEl }))) : (menuItemEl);