@sprinklrjs/spaceweb 14.11.0 → 14.11.3

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 (54) hide show
  1. package/baseui/datepicker/styled-components.js +2 -2
  2. package/color-picker/CustomColorSelector.d.ts +1 -1
  3. package/color-picker/CustomColorSelector.js +25 -8
  4. package/date-picker/DatePickerInput.d.ts +2 -2
  5. package/date-picker/DatePickerInput.js +1 -0
  6. package/esm/baseui/datepicker/styled-components.js +2 -2
  7. package/esm/color-picker/CustomColorSelector.d.ts +1 -1
  8. package/esm/color-picker/CustomColorSelector.js +26 -9
  9. package/esm/date-picker/DatePickerInput.d.ts +2 -2
  10. package/esm/date-picker/DatePickerInput.js +1 -0
  11. package/esm/helpers/colors.d.ts +1 -0
  12. package/esm/helpers/colors.js +14 -5
  13. package/esm/list/list.d.ts +1 -0
  14. package/esm/list/list.js +5 -4
  15. package/esm/list/types.d.ts +8 -4
  16. package/esm/list/utils.d.ts +5 -1
  17. package/esm/list/utils.js +15 -0
  18. package/esm/menu/ActionsIconButton.d.ts +5 -2
  19. package/esm/menu/StatefulSubMenu.d.ts +1 -0
  20. package/esm/menu/SubMenu.d.ts +1 -0
  21. package/esm/menu/SubMenu.js +2 -1
  22. package/esm/menu/menu-item.js +17 -7
  23. package/esm/menu/menu.d.ts +1 -0
  24. package/esm/progress/circular/CircularProgress.d.ts +3 -3
  25. package/esm/progress/circular/CircularProgress.js +3 -3
  26. package/esm/progress/linear/LinearProgress.d.ts +3 -3
  27. package/esm/progress/linear/LinearProgress.js +3 -3
  28. package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.js +21 -6
  29. package/esm/select/selectMenuAdapter/SelectMenuItem.d.ts +0 -1
  30. package/esm/time-range-picker/RangeSelectorContainer.d.ts +2 -2
  31. package/esm/time-range-picker/RangeSelectorContainer.js +13 -3
  32. package/helpers/colors.d.ts +1 -0
  33. package/helpers/colors.js +16 -6
  34. package/list/list.d.ts +1 -0
  35. package/list/list.js +3 -2
  36. package/list/types.d.ts +8 -4
  37. package/list/utils.d.ts +5 -1
  38. package/list/utils.js +17 -1
  39. package/menu/ActionsIconButton.d.ts +5 -2
  40. package/menu/StatefulSubMenu.d.ts +1 -0
  41. package/menu/SubMenu.d.ts +1 -0
  42. package/menu/SubMenu.js +2 -1
  43. package/menu/menu-item.js +16 -6
  44. package/menu/menu.d.ts +1 -0
  45. package/package.json +4 -4
  46. package/progress/circular/CircularProgress.d.ts +3 -3
  47. package/progress/circular/CircularProgress.js +2 -2
  48. package/progress/linear/LinearProgress.d.ts +3 -3
  49. package/progress/linear/LinearProgress.js +2 -2
  50. package/select/selectMenuAdapter/CollapsibleSelectMenu.js +21 -6
  51. package/select/selectMenuAdapter/SelectMenuItem.d.ts +0 -1
  52. package/time-range-picker/RangeSelectorContainer.d.ts +2 -2
  53. package/time-range-picker/RangeSelectorContainer.js +12 -2
  54. package/tsconfig.build.tsbuildinfo +1 -1
@@ -22,8 +22,13 @@ import { useLocale } from '../../locale';
22
22
  import { useDocument } from '../../spacewebProvider/DocumentProvider';
23
23
  import { HiddenElement } from '../utils/hidden-element';
24
24
  import { useSelectIds } from '../SelectIdsContext';
25
+ import { useNumber } from '../../number';
25
26
  var Collapsible = function (_a) {
27
+ var _b;
26
28
  var children = _a.children, group = _a.group, expanded = _a.expanded, onClick = _a.onClick, disabled = _a.disabled, className = _a.className;
29
+ var formattedCount = useNumber({
30
+ value: (_b = group.count) !== null && _b !== void 0 ? _b : 0,
31
+ });
27
32
  return (_jsxs(Box, __assign({ className: "rounded-inherit" }, { children: [_jsxs(BaseButton, __assign({ tabIndex: -1, disabled: disabled, onClick: function () { return onClick(group.id); },
28
33
  // @ts-ignore -- css variable declaration in style props
29
34
  style: { '--sw-padding-block-start': '0.55rem', '--sw-padding-block-end': '0.55rem' }, className: [
@@ -31,7 +36,7 @@ var Collapsible = function (_a) {
31
36
  'pt-[--sw-padding-block-start] pb-[--sw-padding-block-end] pl-2 pr-2.5',
32
37
  'disabled:opacity-60 disabled:cursor-not-allowed focus-visible:outline-none',
33
38
  className,
34
- ], type: "button" }, { children: [_jsxs(Typography, __assign({ className: "block text-left", variant: "body-sm", weight: "bold", maxLines: 2 }, { children: [_jsx(Box, __assign({ "$as": "span" }, { children: group.label })), _isNumber(group.count) ? _jsx(Box, __assign({ "$as": "span" }, { children: " (".concat(group.count, ")") })) : null] })), _jsx(ChevronDown, { size: 12, className: "transition-transform duration-200 ml-1 cursor-pointer spr-icon-primary ".concat(expanded ? 'rotate-180' : ''), "data-testid": expanded ? "".concat(group.id, "-expanded") : "".concat(group.id, "-collapsed") })] })), _jsx(Collapse, __assign({ unmountOnExit: true, mountOnEnter: true, visible: expanded }, { children: children }))] })));
39
+ ], type: "button" }, { children: [_jsxs(Typography, __assign({ className: "block text-left", variant: "body-sm", weight: "bold", maxLines: 2 }, { children: [_jsx(Box, __assign({ "$as": "span" }, { children: group.label })), _isNumber(group.count) ? _jsx(Box, __assign({ "$as": "span" }, { children: " (".concat(formattedCount, ")") })) : null] })), _jsx(ChevronDown, { size: 12, className: "transition-transform duration-200 ml-1 cursor-pointer spr-icon-primary ".concat(expanded ? 'rotate-180' : ''), "data-testid": expanded ? "".concat(group.id, "-expanded") : "".concat(group.id, "-collapsed") })] })), _jsx(Collapse, __assign({ unmountOnExit: true, mountOnEnter: true, visible: expanded }, { children: children }))] })));
35
40
  };
36
41
  export var CollapsibleSelectMenu = function (_a) {
37
42
  var _b, _c, _d, _e;
@@ -73,13 +78,16 @@ export var CollapsibleSelectMenu = function (_a) {
73
78
  }); }, [mergedOverrides.ListItemText, mergedOverrides.MenuItem]);
74
79
  useEffect(function () {
75
80
  var keydownHandler = function (event) {
76
- var expandedGroupIndex = Math.max(groupConfig.findIndex(function (group) { return group.id === expandedGroupId; }), 0);
77
- if (event.key === 'ArrowDown' && (event.shiftKey || isLastItemHighlighted.current)) {
78
- setExpandedGroupId(groupConfig[Math.min(expandedGroupIndex + 1, groupConfig.length - 1)].id);
81
+ var expandedGroupIndex = groupConfig.findIndex(function (group) { return group.id === expandedGroupId; });
82
+ var noGroupExpanded = expandedGroupIndex === -1;
83
+ if (event.key === 'ArrowDown' && (event.shiftKey || noGroupExpanded || isLastItemHighlighted.current)) {
84
+ var nextGroupIndex = noGroupExpanded ? 0 : Math.min(expandedGroupIndex + 1, groupConfig.length - 1);
85
+ setExpandedGroupId(groupConfig[nextGroupIndex].id);
79
86
  event.stopPropagation(); // prevents the menu to move to the second item of the next group
80
87
  }
81
- else if (event.key === 'ArrowUp' && (event.shiftKey || isFirstItemHighlighted.current)) {
82
- setExpandedGroupId(groupConfig[Math.max(expandedGroupIndex - 1, 0)].id);
88
+ else if (event.key === 'ArrowUp' && (event.shiftKey || noGroupExpanded || isFirstItemHighlighted.current)) {
89
+ var prevGroupIndex = noGroupExpanded ? groupConfig.length - 1 : Math.max(expandedGroupIndex - 1, 0);
90
+ setExpandedGroupId(groupConfig[prevGroupIndex].id);
83
91
  }
84
92
  };
85
93
  ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.addEventListener('keydown', keydownHandler);
@@ -87,6 +95,13 @@ export var CollapsibleSelectMenu = function (_a) {
87
95
  ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.removeEventListener('keydown', keydownHandler);
88
96
  };
89
97
  }, [ownerDocument, expandedGroupId, groupConfig, setExpandedGroupId]);
98
+ // when the NoResults component is rendered, handleOnHighlightedItemChange is not triggered
99
+ useEffect(function () {
100
+ if (expandedGroupId && _isEmpty(groupedItems[expandedGroupId])) {
101
+ isFirstItemHighlighted.current = true;
102
+ isLastItemHighlighted.current = true;
103
+ }
104
+ }, [expandedGroupId, groupedItems]);
90
105
  var handleOnHighlightedItemChange = function (item) {
91
106
  var _a;
92
107
  var nextHighlightableElement = getNextItemIndexToHighlight(item !== null && item !== void 0 ? item : null, menuRef.current, nextItem);
@@ -23,7 +23,6 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
23
23
  } & {
24
24
  alignItems?: import("../../list").AlignItems | undefined;
25
25
  autoFocus?: boolean | undefined;
26
- /** Select-all, group-select-all, clear, and creatable rows do not show `getActionsElement` by default. */
27
26
  button?: boolean | undefined;
28
27
  children?: React.ReactNode;
29
28
  disabled?: boolean | undefined;
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import { RangeSelectorContainerProps } from './types';
1
+ import type { ReactElement } from 'react';
2
+ import type { RangeSelectorContainerProps } from './types';
3
3
  declare const RangeSelectorContainer: {
4
4
  ({ adapter, timeRangePresets, onChange, onSubmit, timezone: selectedTimezone, value: selectedValue, timeRange: selectedTimeRange, preset: selectedPreset, minDate: _minDate, maxDate: _maxDate, monthsShown, disableTimezone, timezoneOptions, hidePresetSearch, ...props }: RangeSelectorContainerProps): ReactElement;
5
5
  displayName: string;
@@ -13,7 +13,7 @@ import DefaultTimezonePicker from './TimezonePicker';
13
13
  import ErrorIcon from '../icon/components/error';
14
14
  import { StyledFooter, StyledFooterBeforeEnhancer } from '../date-picker/styled-components';
15
15
  import { useLocale } from '../locale';
16
- import { getRangeError, getSelectedTimeRange, getValidRange, getMinMaxDateInTimezone } from './utils';
16
+ import { getRangeError, getSelectedTimeRange, getValidRange, getMinMaxDateInTimezone, convertDateFromSystemTzToTargetTz, } from './utils';
17
17
  import { useOverrides } from '../overrides';
18
18
  var getPresetId = function (selectedPreset, selectedValue) {
19
19
  if (selectedPreset) {
@@ -74,7 +74,7 @@ var RangeSelectorContainer = function (_a) {
74
74
  dateHelpers: dateHelpers,
75
75
  maxDate: maxDate,
76
76
  minDate: minDate,
77
- });
77
+ }).map(function (time) { return new Date(convertDateFromSystemTzToTargetTz(time, timezone, timezoneOptions)); });
78
78
  setPreset(_preset);
79
79
  setTimeRange(nextDate);
80
80
  onChange === null || onChange === void 0 ? void 0 : onChange(__assign({ value: _preset, date: nextDate, preset: _preset }, (disableTimezone ? {} : { timezone: timezone })));
@@ -92,7 +92,17 @@ var RangeSelectorContainer = function (_a) {
92
92
  setPreset('CUSTOM');
93
93
  onChange === null || onChange === void 0 ? void 0 : onChange(__assign({ value: nextDate, date: nextDate, preset: 'CUSTOM' }, (disableTimezone ? {} : { timezone: timezone })));
94
94
  }
95
- }, [setTimeRange, dateHelpers, timeRangePresets, onChange, timezone, disableTimezone, minDate, maxDate]);
95
+ }, [
96
+ setTimeRange,
97
+ dateHelpers,
98
+ timeRangePresets,
99
+ onChange,
100
+ timezone,
101
+ disableTimezone,
102
+ minDate,
103
+ maxDate,
104
+ timezoneOptions,
105
+ ]);
96
106
  var handleSubmit = useCallback(function () {
97
107
  return onSubmit(__assign({ timeRange: timeRange, preset: preset }, (disableTimezone ? {} : { timezone: timezone })));
98
108
  }, [timeRange, preset, timezone, onSubmit, disableTimezone]);
@@ -16,3 +16,4 @@ export declare function getContrastRatio(color1: string, color2: string): number
16
16
  export declare function RgbToHsl({ r, g, b, a }: RGBColor): HSLA;
17
17
  export declare function HslToRgb(hsl: HSLA): RGBColor;
18
18
  export declare function noAlphaHex(inputHex?: string): string | undefined;
19
+ export declare function normalizeHexWithAlpha<T extends string | undefined>(hex: T, alpha: number | undefined): T;
package/helpers/colors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.noAlphaHex = exports.HslToRgb = exports.RgbToHsl = exports.getContrastRatio = exports.getRelativeLuminance = exports.RgbToHex = exports.hexToRgb = exports.isValidHex = void 0;
3
+ exports.normalizeHexWithAlpha = exports.noAlphaHex = exports.HslToRgb = exports.RgbToHsl = exports.getContrastRatio = exports.getRelativeLuminance = exports.RgbToHex = exports.hexToRgb = exports.isValidHex = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var memoize_1 = tslib_1.__importDefault(require("lodash/memoize"));
6
6
  var isValidHex = function (hex) {
@@ -18,19 +18,20 @@ exports.isValidHex = isValidHex;
18
18
  * @return {{r, g, b, a}} an object with rgba
19
19
  */
20
20
  function hexToRgb(_hex) {
21
- var hex = _hex.replace(/^#?/, '#');
21
+ var hex = _hex.replace(/^#?/, '');
22
22
  if (!(0, exports.isValidHex)(hex))
23
23
  return { r: 0, g: 0, b: 0 };
24
24
  var isShortHand = hex.length === 3 || hex.length === 4;
25
- var r = parseInt(isShortHand ? hex.substring(1, 2).repeat(2) : hex.substring(1, 3), 16);
26
- var g = parseInt(isShortHand ? hex.substring(2, 3).repeat(2) : hex.substring(3, 5), 16);
27
- var b = parseInt(isShortHand ? hex.substring(3, 4).repeat(2) : hex.substring(5, 7), 16);
28
- var a = parseInt(isShortHand ? hex.substring(4, 5).repeat(2) : hex.substring(7, 9), 16);
25
+ var r = parseInt(isShortHand ? hex.substring(0, 1).repeat(2) : hex.substring(0, 2), 16);
26
+ var g = parseInt(isShortHand ? hex.substring(1, 2).repeat(2) : hex.substring(2, 4), 16);
27
+ var b = parseInt(isShortHand ? hex.substring(2, 3).repeat(2) : hex.substring(4, 6), 16);
28
+ var a = parseInt(isShortHand ? hex.substring(3, 4).repeat(2) : hex.substring(6, 8), 16);
29
29
  return tslib_1.__assign({ r: r, g: g, b: b }, (a < 255 ? { a: a / 255 } : undefined));
30
30
  }
31
31
  exports.hexToRgb = hexToRgb;
32
32
  function RgbToHex(_a) {
33
33
  var r = _a.r, g = _a.g, b = _a.b, a = _a.a;
34
+ // eslint-disable-next-line react-google-translate/no-return-text-nodes -- This isn't a React Element
34
35
  return "#".concat(tslib_1.__spreadArray([r, g, b], tslib_1.__read((a < 1 ? [Math.round(a * 255)] : [])), false).map(function (n) { return (Number.isNaN(n) ? 10 : Math.round(Math.min(Math.max(n, 0), 255))).toString(16).padStart(2, '0'); })
35
36
  .join(''));
36
37
  }
@@ -94,3 +95,12 @@ function noAlphaHex(inputHex) {
94
95
  return inputHex;
95
96
  }
96
97
  exports.noAlphaHex = noAlphaHex;
98
+ function normalizeHexWithAlpha(hex, alpha) {
99
+ if (typeof alpha !== 'number' || alpha === 1 || !hex)
100
+ return hex;
101
+ return (hex +
102
+ Math.floor(alpha * 255)
103
+ .toString(16)
104
+ .padStart(2, '0'));
105
+ }
106
+ exports.normalizeHexWithAlpha = normalizeHexWithAlpha;
package/list/list.d.ts CHANGED
@@ -6,6 +6,7 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
6
6
  } & {
7
7
  children?: React.ReactNode;
8
8
  virtual?: boolean | undefined;
9
+ keepFirstItemMounted?: boolean | undefined;
9
10
  overrides?: {
10
11
  Root?: import("../overrides").Override<Record<string, any>> | undefined;
11
12
  } | undefined;
package/list/list.js CHANGED
@@ -23,8 +23,8 @@ var getCloneElement = function (item, virtualRow, totalCount) {
23
23
  });
24
24
  };
25
25
  var List = React.forwardRef(function (_a, forwardedRef) {
26
- var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, children = _a.children, virtual = _a.virtual, scrollElement = _a.scrollElement, _c = _a.overscanCount, overscanCount = _c === void 0 ? constants_1.DEFAULT_OVER_SCAN_COUNT : _c, _d = _a.estimateItemSize, estimateItemSize = _d === void 0 ? constants_1.DEFAULT_LIST_ITEM_HEIGHT : _d, _e = _a.role, role = _e === void 0 ? 'list' : _e, autoScrollToSelectedItem = _a.autoScrollToSelectedItem, style = _a.style, className = _a.className, restProps = tslib_1.__rest(_a, ["overrides", "children", "virtual", "scrollElement", "overscanCount", "estimateItemSize", "role", "autoScrollToSelectedItem", "style", "className"]);
27
- var _f = tslib_1.__read((0, overrides_1.useOverrides)(overrides.Root, styled_component_1.StyledList), 2), Root = _f[0], rootProps = _f[1];
26
+ var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, children = _a.children, virtual = _a.virtual, scrollElement = _a.scrollElement, _c = _a.overscanCount, overscanCount = _c === void 0 ? constants_1.DEFAULT_OVER_SCAN_COUNT : _c, _d = _a.estimateItemSize, estimateItemSize = _d === void 0 ? constants_1.DEFAULT_LIST_ITEM_HEIGHT : _d, _e = _a.role, role = _e === void 0 ? 'list' : _e, autoScrollToSelectedItem = _a.autoScrollToSelectedItem, style = _a.style, className = _a.className, _f = _a.keepFirstItemMounted, keepFirstItemMounted = _f === void 0 ? false : _f, restProps = tslib_1.__rest(_a, ["overrides", "children", "virtual", "scrollElement", "overscanCount", "estimateItemSize", "role", "autoScrollToSelectedItem", "style", "className", "keepFirstItemMounted"]);
27
+ var _g = tslib_1.__read((0, overrides_1.useOverrides)(overrides.Root, styled_component_1.StyledList), 2), Root = _g[0], rootProps = _g[1];
28
28
  var parentRef = React.useRef(null);
29
29
  var combinedRef = (0, useCombinedRef_1.default)(parentRef, forwardedRef);
30
30
  var childrenArr = React.Children.toArray(children);
@@ -35,6 +35,7 @@ var List = React.forwardRef(function (_a, forwardedRef) {
35
35
  estimateSize: function () { return estimateItemSize; },
36
36
  overscan: overscanCount,
37
37
  measureElement: utils_1.measureElement,
38
+ rangeExtractor: keepFirstItemMounted ? utils_1.customRangeExtractor : react_virtual_1.defaultRangeExtractor,
38
39
  });
39
40
  React.useEffect(function () {
40
41
  if (!autoScrollToSelectedItem) {
package/list/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
- import { Override } from '../overrides/types';
3
- import { SpacewebComponentProps } from '../types';
4
- import { StatefulTooltipProps } from '../tooltip';
1
+ import type { KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
+ import type { Override } from '../overrides/types';
3
+ import type { SpacewebComponentProps } from '../types';
4
+ import type { StatefulTooltipProps } from '../tooltip';
5
5
  export type AlignItems = 'start' | 'center';
6
6
  export type Enhancer<SharedProps> = ReactNode | ((props: SharedProps) => ReactNode);
7
7
  export type ListItemSharedProps = {
@@ -36,6 +36,10 @@ export type ListItemProps = SpacewebComponentProps & {
36
36
  export type ListProps = SpacewebComponentProps & {
37
37
  children?: ReactNode;
38
38
  virtual?: boolean;
39
+ /**
40
+ * Forces the first item to stay mounted even when out of overscan range in virtualized list
41
+ */
42
+ keepFirstItemMounted?: boolean;
39
43
  overrides?: {
40
44
  Root?: Override<Record<string, any>>;
41
45
  };
package/list/utils.d.ts CHANGED
@@ -1,2 +1,6 @@
1
- import type { measureElement as measureElementType } from '@tanstack/react-virtual';
1
+ import type { measureElement as measureElementType, Range } from '@tanstack/react-virtual';
2
2
  export declare const measureElement: typeof measureElementType;
3
+ /**
4
+ * Keeps the first item mounted even when it falls outside the range.
5
+ */
6
+ export declare const customRangeExtractor: (range: Range) => number[];
package/list/utils.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.measureElement = void 0;
3
+ exports.customRangeExtractor = exports.measureElement = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var react_virtual_1 = require("@tanstack/react-virtual");
4
6
  var parseMeasurement = function (str) { return parseFloat(str) || 0; };
5
7
  // by default react-virtual uses getBoundingClientRect to calculate dimensions.
6
8
  // overriding it to use height + margin, so that we do not have to wrap each ListItem with another element
@@ -12,3 +14,17 @@ var measureElement = function (element, instance) {
12
14
  return instance.options.horizontal ? boundingRect.width + marginX : boundingRect.height + marginY;
13
15
  };
14
16
  exports.measureElement = measureElement;
17
+ /**
18
+ * Keeps the first item mounted even when it falls outside the range.
19
+ */
20
+ var customRangeExtractor = function (range) {
21
+ var defaultIndices = (0, react_virtual_1.defaultRangeExtractor)(range);
22
+ // Find the actual start index of the range including overscan
23
+ var virtualRangeStart = Math.max(range.startIndex - range.overscan, 0);
24
+ // If the first item is already in the virtual range, return the default indices.
25
+ if (virtualRangeStart === 0)
26
+ return defaultIndices;
27
+ // Otherwise, prepend the first item to the default indices.
28
+ return tslib_1.__spreadArray([0], tslib_1.__read(defaultIndices), false);
29
+ };
30
+ exports.customRangeExtractor = customRangeExtractor;
@@ -1,5 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { type IconButtonProps } from '../button';
3
- export type ActionsIconButtonProps = IconButtonProps;
4
- declare const ActionsIconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
3
+ export type ActionsIconButtonProps = IconButtonProps & {
4
+ /** When true, the action stays visible even when the row is not hovered or keyboard-highlighted. */
5
+ alwaysVisible?: boolean;
6
+ };
7
+ declare const ActionsIconButton: import("react").ForwardRefExoticComponent<ActionsIconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
5
8
  export default ActionsIconButton;
@@ -31,6 +31,7 @@ declare const StatefulSubMenu: import("react").ForwardRefExoticComponent<Omit<Me
31
31
  } & {
32
32
  children?: ReactNode;
33
33
  virtual?: boolean | undefined;
34
+ keepFirstItemMounted?: boolean | undefined;
34
35
  overrides?: {
35
36
  Root?: Override<Record<string, any>> | undefined;
36
37
  } | undefined;
package/menu/SubMenu.d.ts CHANGED
@@ -32,6 +32,7 @@ declare const SubMenu: import("react").ForwardRefExoticComponent<Omit<MenuProps,
32
32
  } & {
33
33
  children?: ReactNode;
34
34
  virtual?: boolean | undefined;
35
+ keepFirstItemMounted?: boolean | undefined;
35
36
  overrides?: {
36
37
  Root?: Override<Record<string, any>> | undefined;
37
38
  } | undefined;
package/menu/SubMenu.js CHANGED
@@ -37,7 +37,8 @@ var SubMenu = (0, react_1.forwardRef)(function (_a, ref) {
37
37
  var itemsToRender = items.length
38
38
  ? (0, flatten_1.default)(items.map(function (item) { var _a; return (_a = itemRenderer === null || itemRenderer === void 0 ? void 0 : itemRenderer(item, onItemSelect)) !== null && _a !== void 0 ? _a : defaultItemRenderer(item, onItemSelect); }))
39
39
  : (_c = emptyStateRenderer === null || emptyStateRenderer === void 0 ? void 0 : emptyStateRenderer(currentHeaderItem)) !== null && _c !== void 0 ? _c : null;
40
- return ((0, jsx_runtime_1.jsxs)(MenuOverriden, tslib_1.__assign({ "aria-label": "Menu" }, props, menuProps, { ref: ref }, { children: [currentHeaderItem && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(box_1.Box, { ref: setStickySentinelRef }), (0, jsx_runtime_1.jsx)(HeaderMenuItem, tslib_1.__assign({ startEnhancer: (0, jsx_runtime_1.jsx)(chevron_left_1.default, {}), "aria-label": locale.menu.subMenuBackButtonAriaLabel }, (_b = {}, _b[helpers_1.SUBMENU_BACK_ROW_ATTR] = '', _b), menuItemProps, { className: [
40
+ var shouldPinHeader = !!(props.virtual && currentHeaderItem !== undefined);
41
+ return ((0, jsx_runtime_1.jsxs)(MenuOverriden, tslib_1.__assign({ "aria-label": "Menu" }, props, menuProps, { keepFirstItemMounted: shouldPinHeader, ref: ref }, { children: [currentHeaderItem && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(box_1.Box, { ref: setStickySentinelRef }), (0, jsx_runtime_1.jsx)(HeaderMenuItem, tslib_1.__assign({ startEnhancer: (0, jsx_runtime_1.jsx)(chevron_left_1.default, {}), "aria-label": locale.menu.subMenuBackButtonAriaLabel }, (_b = {}, _b[helpers_1.SUBMENU_BACK_ROW_ATTR] = '', _b), menuItemProps, { className: [
41
42
  'sticky top-0 w-full z-1 mb-1',
42
43
  function (_, _a) {
43
44
  var $highlighted = _a.$highlighted;
package/menu/menu-item.js CHANGED
@@ -64,7 +64,9 @@ var ACTION_CONTAINER_HANDLER_PROPS = {
64
64
  };
65
65
  function MenuActionContainer(_a) {
66
66
  var sharedProps = _a.sharedProps, endEnhancer = _a.endEnhancer, renderedActions = _a.renderedActions;
67
- return ((0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: (0, classNames_1.default)('flex items-center gap-1 opacity-0 pointer-events-none', 'group-hover:opacity-100 group-hover:pointer-events-auto', 'group-focus-within:opacity-100 group-focus-within:pointer-events-auto', sharedProps.$highlighted ? 'opacity-100 pointer-events-auto' : ''), "data-menu-action-container": "true", role: "group" }, ACTION_CONTAINER_HANDLER_PROPS, { children: [renderedActions, typeof endEnhancer === 'function' ? endEnhancer(sharedProps) : endEnhancer !== null && endEnhancer !== void 0 ? endEnhancer : null] })));
67
+ return ((0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: (0, classNames_1.default)('flex items-center gap-1 pointer-events-none', 'group-hover:visible group-hover:pointer-events-auto', 'group-focus-within:visible group-focus-within:pointer-events-auto',
68
+ // Use visibility (not opacity) so alwaysVisible children can override with `visible`.
69
+ sharedProps.$highlighted ? 'visible pointer-events-auto' : 'invisible'), "data-menu-action-container": "true", role: "group" }, ACTION_CONTAINER_HANDLER_PROPS, { children: [renderedActions.map(function (action) { return ((0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ className: action.props.alwaysVisible ? 'visible opacity-100 pointer-events-auto' : undefined }, { children: action }), action.key)); }), typeof endEnhancer === 'function' ? endEnhancer(sharedProps) : endEnhancer !== null && endEnhancer !== void 0 ? endEnhancer : null] })));
68
70
  }
69
71
  function buildListItemAriaProps(itemRole, selected, ChildMenu) {
70
72
  var props = {};
@@ -76,20 +78,28 @@ function buildListItemAriaProps(itemRole, selected, ChildMenu) {
76
78
  }
77
79
  return props;
78
80
  }
81
+ function flattenActionElements(actions) {
82
+ return React.Children.toArray(actions).flatMap(function (node) {
83
+ if (React.isValidElement(node)) {
84
+ return node.type === React.Fragment ? flattenActionElements(node.props.children) : [node];
85
+ }
86
+ return [];
87
+ });
88
+ }
79
89
  function useResolvedMenuEndEnhancer(resolvedItemActions, shouldRenderActions, endEnhancer, ChildMenu) {
80
90
  var renderedActions = (0, react_1.useMemo)(function () {
81
91
  return shouldRenderActions
82
- ? React.Children.map(resolvedItemActions, function (action, index) {
92
+ ? flattenActionElements(resolvedItemActions).map(function (action, index) {
83
93
  var _a;
84
- if (!React.isValidElement(action))
85
- return action;
86
- return React.cloneElement(action, { key: (_a = action.key) !== null && _a !== void 0 ? _a : "menu-action-".concat(index) });
94
+ return React.cloneElement(action, {
95
+ key: (_a = action.key) !== null && _a !== void 0 ? _a : "menu-action-".concat(index),
96
+ });
87
97
  })
88
98
  : null;
89
99
  }, [resolvedItemActions, shouldRenderActions]);
90
100
  return (0, react_1.useMemo)(function () {
91
101
  if (shouldRenderActions) {
92
- return function (sharedProps) { return ((0, jsx_runtime_1.jsx)(MenuActionContainer, { sharedProps: sharedProps, endEnhancer: endEnhancer, renderedActions: renderedActions })); };
102
+ return function (sharedProps) { return ((0, jsx_runtime_1.jsx)(MenuActionContainer, { sharedProps: sharedProps, endEnhancer: endEnhancer, renderedActions: renderedActions !== null && renderedActions !== void 0 ? renderedActions : [] })); };
93
103
  }
94
104
  if (endEnhancer)
95
105
  return endEnhancer;
package/menu/menu.d.ts CHANGED
@@ -14,6 +14,7 @@ declare const _default: import("react").MemoExoticComponent<import("react").Forw
14
14
  } & {
15
15
  children?: import("react").ReactNode;
16
16
  virtual?: boolean | undefined;
17
+ keepFirstItemMounted?: boolean | undefined;
17
18
  overrides?: {
18
19
  Root?: import("../overrides").Override<Record<string, any>> | undefined;
19
20
  } | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprinklrjs/spaceweb",
3
- "version": "14.11.0",
3
+ "version": "14.11.3",
4
4
  "description": "Components for SpaceWeb",
5
5
  "main": "index.js",
6
6
  "module": "./esm/index.js",
@@ -18,7 +18,7 @@
18
18
  "test:watch": "jest --watch",
19
19
  "//": "COLLECT_COVERAGE needs to be true to include VRT in the tests run during coverage",
20
20
  "test:coverage": "COLLECT_COVERAGE=true jest --coverage",
21
- "tsc": "../../scripts/tsbuild.sh",
21
+ "tsc": "tsc",
22
22
  "validateCoverageReport": "ts-node ./scripts/validateCoverageReport.ts"
23
23
  },
24
24
  "author": "",
@@ -33,7 +33,7 @@
33
33
  "@types/react-color": "^3.0.12",
34
34
  "@types/styletron-engine-atomic": "^1.1.0",
35
35
  "@types/styletron-react": "^5.0.2",
36
- "any-date-parser": "2.2.0",
36
+ "any-date-parser": "2.2.3",
37
37
  "body-scroll-lock": "3.1.5",
38
38
  "card-validator": "^6.2.0",
39
39
  "class-variance-authority": "^0.7.0",
@@ -99,7 +99,7 @@
99
99
  "ts-node": "^10.4.0"
100
100
  },
101
101
  "peerDependencies": {
102
- "@sprinklrjs/spaceweb-themes": "14.11.0",
102
+ "@sprinklrjs/spaceweb-themes": "14.11.3",
103
103
  "react": ">=17.0.2 <19.0.0",
104
104
  "react-dom": ">=17.0.2 <19.0.0"
105
105
  }
@@ -1,7 +1,7 @@
1
- import { ReactElement } from 'react';
2
- import { CircularProgressProps } from './types';
1
+ import type { ReactElement } from 'react';
2
+ import type { CircularProgressProps } from './types';
3
3
  declare const CircularProgress: {
4
- ({ intent, infinite, label, backgroundColor, value, className, style, color, size, thickness, overrides, }: CircularProgressProps): ReactElement;
4
+ ({ intent, infinite, label, backgroundColor, value, className, style, color, size, thickness, overrides, ...restProps }: CircularProgressProps): ReactElement;
5
5
  __standard: string;
6
6
  };
7
7
  export default CircularProgress;
@@ -8,7 +8,7 @@ var styled_component_1 = require("./styled-component");
8
8
  var style_1 = require("../../style");
9
9
  var helper_1 = require("../helper");
10
10
  var CircularProgress = function (_a) {
11
- var _b = _a.intent, intent = _b === void 0 ? 'default' : _b, _c = _a.infinite, infinite = _c === void 0 ? false : _c, label = _a.label, backgroundColor = _a.backgroundColor, _d = _a.value, value = _d === void 0 ? 0 : _d, className = _a.className, style = _a.style, color = _a.color, _e = _a.size, size = _e === void 0 ? 50 : _e, _f = _a.thickness, thickness = _f === void 0 ? 3 : _f, overrides = _a.overrides;
11
+ var _b = _a.intent, intent = _b === void 0 ? 'default' : _b, _c = _a.infinite, infinite = _c === void 0 ? false : _c, label = _a.label, backgroundColor = _a.backgroundColor, _d = _a.value, value = _d === void 0 ? 0 : _d, className = _a.className, style = _a.style, color = _a.color, _e = _a.size, size = _e === void 0 ? 50 : _e, _f = _a.thickness, thickness = _f === void 0 ? 3 : _f, overrides = _a.overrides, restProps = tslib_1.__rest(_a, ["intent", "infinite", "label", "backgroundColor", "value", "className", "style", "color", "size", "thickness", "overrides"]);
12
12
  var strokeWidth = (styled_component_1.VIEWBOX_SIZE / size) * thickness;
13
13
  var _g = (0, style_1.useStyle)(), px2rem = _g.px2rem, theme = _g.theme;
14
14
  var sharedProps = tslib_1.__assign(tslib_1.__assign({}, (0, helpers_1.add$props)({ intent: intent, infinite: infinite, backgroundColor: backgroundColor, value: value, color: color, size: size, thickness: thickness, strokeWidth: strokeWidth })), { $withLabel: !!label });
@@ -19,7 +19,7 @@ var CircularProgress = function (_a) {
19
19
  var _m = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Progress, styled_component_1.StyledProgress), 2), Progress = _m[0], progressProps = _m[1];
20
20
  var _o = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.LabelContainer, styled_component_1.StyledLabelContainer), 2), LabelContainer = _o[0], labelContainerProps = _o[1];
21
21
  var _p = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Label, styled_component_1.StyledLabel), 2), Label = _p[0], labelProps = _p[1];
22
- return ((0, jsx_runtime_1.jsxs)(Root, tslib_1.__assign({ role: "progressbar", "aria-valuenow": !infinite ? Math.round(value) : undefined, "aria-valuemin": !infinite ? 0 : undefined, "aria-valuemax": !infinite ? 100 : undefined }, sharedProps, rootProps, { style: [
22
+ return ((0, jsx_runtime_1.jsxs)(Root, tslib_1.__assign({ role: "progressbar", "aria-valuenow": !infinite ? Math.round(value) : undefined, "aria-valuemin": !infinite ? 0 : undefined, "aria-valuemax": !infinite ? 100 : undefined }, sharedProps, restProps, rootProps, { style: [
23
23
  {
24
24
  '--sw-height': px2rem(size),
25
25
  '--sw-width': px2rem(size),
@@ -1,7 +1,7 @@
1
- import { ReactElement, PropsWithChildren } from 'react';
2
- import { LinearProgressProps } from './types';
1
+ import type { ReactElement, PropsWithChildren } from 'react';
2
+ import type { LinearProgressProps } from './types';
3
3
  declare const LinearProgress: {
4
- ({ intent, value, backgroundColor, color, label, style, className, infinite, overrides, children, }: PropsWithChildren<LinearProgressProps>): ReactElement;
4
+ ({ intent, value, backgroundColor, color, label, style, className, infinite, overrides, children, ...restProps }: PropsWithChildren<LinearProgressProps>): ReactElement;
5
5
  __standard: string;
6
6
  };
7
7
  export default LinearProgress;
@@ -8,14 +8,14 @@ var styled_component_1 = require("./styled-component");
8
8
  var helper_1 = require("../helper");
9
9
  var style_1 = require("../../style");
10
10
  var LinearProgress = function (_a) {
11
- var _b = _a.intent, intent = _b === void 0 ? 'default' : _b, _c = _a.value, value = _c === void 0 ? 0 : _c, backgroundColor = _a.backgroundColor, color = _a.color, label = _a.label, style = _a.style, className = _a.className, _d = _a.infinite, infinite = _d === void 0 ? false : _d, overrides = _a.overrides, children = _a.children;
11
+ var _b = _a.intent, intent = _b === void 0 ? 'default' : _b, _c = _a.value, value = _c === void 0 ? 0 : _c, backgroundColor = _a.backgroundColor, color = _a.color, label = _a.label, style = _a.style, className = _a.className, _d = _a.infinite, infinite = _d === void 0 ? false : _d, overrides = _a.overrides, children = _a.children, restProps = tslib_1.__rest(_a, ["intent", "value", "backgroundColor", "color", "label", "style", "className", "infinite", "overrides", "children"]);
12
12
  var sharedProps = tslib_1.__assign(tslib_1.__assign({}, (0, helpers_1.add$props)({ intent: intent, value: value, backgroundColor: backgroundColor, color: color, infinite: infinite })), { $withLabel: !!label });
13
13
  var theme = (0, style_1.useStyle)().theme;
14
14
  var _e = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Root, styled_component_1.StyledRoot), 2), Root = _e[0], rootProps = _e[1];
15
15
  var _f = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Bar, styled_component_1.StyledBar), 2), Bar = _f[0], barProps = _f[1];
16
16
  var _g = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Progress, styled_component_1.StyledProgress), 2), Progress = _g[0], progressProps = _g[1];
17
17
  var _h = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Label, styled_component_1.StyledLabel), 2), Label = _h[0], labelProps = _h[1];
18
- return ((0, jsx_runtime_1.jsxs)(Root, tslib_1.__assign({ "data-spaceweb": "linear-progress", role: "progressbar", "aria-valuenow": !infinite ? Math.round(value) : undefined, "aria-valuemin": !infinite ? 0 : undefined, "aria-valuemax": !infinite ? 100 : undefined }, sharedProps, rootProps, { style: [style, rootProps === null || rootProps === void 0 ? void 0 : rootProps.style], className: [className, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className] }, { children: [(0, jsx_runtime_1.jsx)(Bar, tslib_1.__assign({ "data-testid": "track" }, sharedProps, barProps, { style: [{ '--sw-bg-color': backgroundColor || theme.spr.tag02 }, barProps === null || barProps === void 0 ? void 0 : barProps.style] }, { children: children || ((0, jsx_runtime_1.jsx)(Progress, tslib_1.__assign({ "data-testid": "filled-track" }, sharedProps, progressProps, { style: [
18
+ return ((0, jsx_runtime_1.jsxs)(Root, tslib_1.__assign({ "data-spaceweb": "linear-progress", role: "progressbar", "aria-valuenow": !infinite ? Math.round(value) : undefined, "aria-valuemin": !infinite ? 0 : undefined, "aria-valuemax": !infinite ? 100 : undefined }, sharedProps, restProps, rootProps, { style: [style, rootProps === null || rootProps === void 0 ? void 0 : rootProps.style], className: [className, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className] }, { children: [(0, jsx_runtime_1.jsx)(Bar, tslib_1.__assign({ "data-testid": "track" }, sharedProps, barProps, { style: [{ '--sw-bg-color': backgroundColor || theme.spr.tag02 }, barProps === null || barProps === void 0 ? void 0 : barProps.style] }, { children: children || ((0, jsx_runtime_1.jsx)(Progress, tslib_1.__assign({ "data-testid": "filled-track" }, sharedProps, progressProps, { style: [
19
19
  tslib_1.__assign({ '--sw-bg-color': color || (0, helper_1.getIntentColor)(intent, theme) }, (!infinite ? { '--sw-width': "".concat(value, "%") } : {})),
20
20
  progressProps === null || progressProps === void 0 ? void 0 : progressProps.style,
21
21
  ] }))) })), label ? ((0, jsx_runtime_1.jsx)(Label, tslib_1.__assign({}, sharedProps, labelProps, { children: typeof label === 'function' ? label(sharedProps) : label }))) : null] })));
@@ -25,8 +25,13 @@ var locale_1 = require("../../locale");
25
25
  var DocumentProvider_1 = require("../../spacewebProvider/DocumentProvider");
26
26
  var hidden_element_1 = require("../utils/hidden-element");
27
27
  var SelectIdsContext_1 = require("../SelectIdsContext");
28
+ var number_1 = require("../../number");
28
29
  var Collapsible = function (_a) {
30
+ var _b;
29
31
  var children = _a.children, group = _a.group, expanded = _a.expanded, onClick = _a.onClick, disabled = _a.disabled, className = _a.className;
32
+ var formattedCount = (0, number_1.useNumber)({
33
+ value: (_b = group.count) !== null && _b !== void 0 ? _b : 0,
34
+ });
30
35
  return ((0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "rounded-inherit" }, { children: [(0, jsx_runtime_1.jsxs)(base_button_1.BaseButton, tslib_1.__assign({ tabIndex: -1, disabled: disabled, onClick: function () { return onClick(group.id); },
31
36
  // @ts-ignore -- css variable declaration in style props
32
37
  style: { '--sw-padding-block-start': '0.55rem', '--sw-padding-block-end': '0.55rem' }, className: [
@@ -34,7 +39,7 @@ var Collapsible = function (_a) {
34
39
  'pt-[--sw-padding-block-start] pb-[--sw-padding-block-end] pl-2 pr-2.5',
35
40
  'disabled:opacity-60 disabled:cursor-not-allowed focus-visible:outline-none',
36
41
  className,
37
- ], type: "button" }, { children: [(0, jsx_runtime_1.jsxs)(typography_1.Typography, tslib_1.__assign({ className: "block text-left", variant: "body-sm", weight: "bold", maxLines: 2 }, { children: [(0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ "$as": "span" }, { children: group.label })), (0, isNumber_1.default)(group.count) ? (0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ "$as": "span" }, { children: " (".concat(group.count, ")") })) : null] })), (0, jsx_runtime_1.jsx)(chevron_down_1.default, { size: 12, className: "transition-transform duration-200 ml-1 cursor-pointer spr-icon-primary ".concat(expanded ? 'rotate-180' : ''), "data-testid": expanded ? "".concat(group.id, "-expanded") : "".concat(group.id, "-collapsed") })] })), (0, jsx_runtime_1.jsx)(collapse_1.Collapse, tslib_1.__assign({ unmountOnExit: true, mountOnEnter: true, visible: expanded }, { children: children }))] })));
42
+ ], type: "button" }, { children: [(0, jsx_runtime_1.jsxs)(typography_1.Typography, tslib_1.__assign({ className: "block text-left", variant: "body-sm", weight: "bold", maxLines: 2 }, { children: [(0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ "$as": "span" }, { children: group.label })), (0, isNumber_1.default)(group.count) ? (0, jsx_runtime_1.jsx)(box_1.Box, tslib_1.__assign({ "$as": "span" }, { children: " (".concat(formattedCount, ")") })) : null] })), (0, jsx_runtime_1.jsx)(chevron_down_1.default, { size: 12, className: "transition-transform duration-200 ml-1 cursor-pointer spr-icon-primary ".concat(expanded ? 'rotate-180' : ''), "data-testid": expanded ? "".concat(group.id, "-expanded") : "".concat(group.id, "-collapsed") })] })), (0, jsx_runtime_1.jsx)(collapse_1.Collapse, tslib_1.__assign({ unmountOnExit: true, mountOnEnter: true, visible: expanded }, { children: children }))] })));
38
43
  };
39
44
  var CollapsibleSelectMenu = function (_a) {
40
45
  var _b, _c, _d, _e;
@@ -76,13 +81,16 @@ var CollapsibleSelectMenu = function (_a) {
76
81
  }); }, [mergedOverrides.ListItemText, mergedOverrides.MenuItem]);
77
82
  (0, react_1.useEffect)(function () {
78
83
  var keydownHandler = function (event) {
79
- var expandedGroupIndex = Math.max(groupConfig.findIndex(function (group) { return group.id === expandedGroupId; }), 0);
80
- if (event.key === 'ArrowDown' && (event.shiftKey || isLastItemHighlighted.current)) {
81
- setExpandedGroupId(groupConfig[Math.min(expandedGroupIndex + 1, groupConfig.length - 1)].id);
84
+ var expandedGroupIndex = groupConfig.findIndex(function (group) { return group.id === expandedGroupId; });
85
+ var noGroupExpanded = expandedGroupIndex === -1;
86
+ if (event.key === 'ArrowDown' && (event.shiftKey || noGroupExpanded || isLastItemHighlighted.current)) {
87
+ var nextGroupIndex = noGroupExpanded ? 0 : Math.min(expandedGroupIndex + 1, groupConfig.length - 1);
88
+ setExpandedGroupId(groupConfig[nextGroupIndex].id);
82
89
  event.stopPropagation(); // prevents the menu to move to the second item of the next group
83
90
  }
84
- else if (event.key === 'ArrowUp' && (event.shiftKey || isFirstItemHighlighted.current)) {
85
- setExpandedGroupId(groupConfig[Math.max(expandedGroupIndex - 1, 0)].id);
91
+ else if (event.key === 'ArrowUp' && (event.shiftKey || noGroupExpanded || isFirstItemHighlighted.current)) {
92
+ var prevGroupIndex = noGroupExpanded ? groupConfig.length - 1 : Math.max(expandedGroupIndex - 1, 0);
93
+ setExpandedGroupId(groupConfig[prevGroupIndex].id);
86
94
  }
87
95
  };
88
96
  ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.addEventListener('keydown', keydownHandler);
@@ -90,6 +98,13 @@ var CollapsibleSelectMenu = function (_a) {
90
98
  ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.removeEventListener('keydown', keydownHandler);
91
99
  };
92
100
  }, [ownerDocument, expandedGroupId, groupConfig, setExpandedGroupId]);
101
+ // when the NoResults component is rendered, handleOnHighlightedItemChange is not triggered
102
+ (0, react_1.useEffect)(function () {
103
+ if (expandedGroupId && (0, isEmpty_1.default)(groupedItems[expandedGroupId])) {
104
+ isFirstItemHighlighted.current = true;
105
+ isLastItemHighlighted.current = true;
106
+ }
107
+ }, [expandedGroupId, groupedItems]);
93
108
  var handleOnHighlightedItemChange = function (item) {
94
109
  var _a;
95
110
  var nextHighlightableElement = (0, helpers_1.getNextItemIndexToHighlight)(item !== null && item !== void 0 ? item : null, menuRef.current, helpers_1.nextItem);
@@ -23,7 +23,6 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
23
23
  } & {
24
24
  alignItems?: import("../../list").AlignItems | undefined;
25
25
  autoFocus?: boolean | undefined;
26
- /** Select-all, group-select-all, clear, and creatable rows do not show `getActionsElement` by default. */
27
26
  button?: boolean | undefined;
28
27
  children?: React.ReactNode;
29
28
  disabled?: boolean | undefined;
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import { RangeSelectorContainerProps } from './types';
1
+ import type { ReactElement } from 'react';
2
+ import type { RangeSelectorContainerProps } from './types';
3
3
  declare const RangeSelectorContainer: {
4
4
  ({ adapter, timeRangePresets, onChange, onSubmit, timezone: selectedTimezone, value: selectedValue, timeRange: selectedTimeRange, preset: selectedPreset, minDate: _minDate, maxDate: _maxDate, monthsShown, disableTimezone, timezoneOptions, hidePresetSearch, ...props }: RangeSelectorContainerProps): ReactElement;
5
5
  displayName: string;
@@ -76,7 +76,7 @@ var RangeSelectorContainer = function (_a) {
76
76
  dateHelpers: dateHelpers,
77
77
  maxDate: maxDate,
78
78
  minDate: minDate,
79
- });
79
+ }).map(function (time) { return new Date((0, utils_1.convertDateFromSystemTzToTargetTz)(time, timezone, timezoneOptions)); });
80
80
  setPreset(_preset);
81
81
  setTimeRange(nextDate);
82
82
  onChange === null || onChange === void 0 ? void 0 : onChange(tslib_1.__assign({ value: _preset, date: nextDate, preset: _preset }, (disableTimezone ? {} : { timezone: timezone })));
@@ -94,7 +94,17 @@ var RangeSelectorContainer = function (_a) {
94
94
  setPreset('CUSTOM');
95
95
  onChange === null || onChange === void 0 ? void 0 : onChange(tslib_1.__assign({ value: nextDate, date: nextDate, preset: 'CUSTOM' }, (disableTimezone ? {} : { timezone: timezone })));
96
96
  }
97
- }, [setTimeRange, dateHelpers, timeRangePresets, onChange, timezone, disableTimezone, minDate, maxDate]);
97
+ }, [
98
+ setTimeRange,
99
+ dateHelpers,
100
+ timeRangePresets,
101
+ onChange,
102
+ timezone,
103
+ disableTimezone,
104
+ minDate,
105
+ maxDate,
106
+ timezoneOptions,
107
+ ]);
98
108
  var handleSubmit = (0, react_1.useCallback)(function () {
99
109
  return onSubmit(tslib_1.__assign({ timeRange: timeRange, preset: preset }, (disableTimezone ? {} : { timezone: timezone })));
100
110
  }, [timeRange, preset, timezone, onSubmit, disableTimezone]);