@sprinklrjs/spaceweb 14.15.2 → 14.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/baseui/timepicker/timepicker.js +5 -5
- package/baseui/timepicker/types.d.ts +5 -0
- package/color-picker/ColorPalette.js +20 -3
- package/color-picker/GradientColorPicker.js +4 -1
- package/color-picker/Swatch.d.ts +3 -1
- package/color-picker/Swatch.js +8 -5
- package/color-picker/handleSwatchGroupKeyDown.d.ts +7 -0
- package/color-picker/handleSwatchGroupKeyDown.js +43 -0
- package/date-picker/DateInput.d.ts +4 -1
- package/date-picker/DateInput.js +7 -5
- package/date-picker/TimeInput.d.ts +6 -1
- package/date-picker/TimeInput.js +2 -2
- package/esm/baseui/timepicker/timepicker.js +5 -5
- package/esm/baseui/timepicker/types.d.ts +5 -0
- package/esm/color-picker/ColorPalette.js +20 -3
- package/esm/color-picker/GradientColorPicker.js +4 -1
- package/esm/color-picker/Swatch.d.ts +3 -1
- package/esm/color-picker/Swatch.js +8 -5
- package/esm/color-picker/handleSwatchGroupKeyDown.d.ts +7 -0
- package/esm/color-picker/handleSwatchGroupKeyDown.js +39 -0
- package/esm/date-picker/DateInput.d.ts +4 -1
- package/esm/date-picker/DateInput.js +7 -5
- package/esm/date-picker/TimeInput.d.ts +6 -1
- package/esm/date-picker/TimeInput.js +2 -2
- package/esm/list/divider.js +1 -1
- package/esm/list/list-item.js +14 -9
- package/esm/locale/en_US.js +3 -0
- package/esm/locale/types.d.ts +3 -0
- package/esm/menu/useKeyboardNavigation.js +10 -3
- package/esm/menu/useStatefulMenu.js +14 -8
- package/esm/modal/modal.js +2 -2
- package/esm/select/overlaySelect/hooks/useOverlaySelectOverrides.js +3 -0
- package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.js +15 -7
- package/esm/select/selectMenuAdapter/NestedSelectMenuAdapter.js +1 -1
- package/esm/select/selectMenuAdapter/SelectMenuAdapter.js +8 -6
- package/esm/select/styled-component.js +4 -6
- package/esm/slider/slider.d.ts +1 -1
- package/esm/slider/slider.js +12 -2
- package/esm/slider/types.d.ts +3 -0
- package/esm/time-range-picker/RangeSelector.js +2 -2
- package/esm/time-range-picker/RangeSelectorContainer.js +1 -1
- package/esm/time-range-picker/types.d.ts +1 -0
- package/esm/time-zone-picker/types.d.ts +1 -0
- package/esm/tooltip/actionable-tooltip.js +2 -1
- package/list/divider.js +1 -1
- package/list/list-item.js +14 -9
- package/locale/en_US.js +3 -0
- package/locale/types.d.ts +3 -0
- package/menu/useKeyboardNavigation.js +10 -3
- package/menu/useStatefulMenu.js +14 -8
- package/modal/modal.js +2 -2
- package/package.json +2 -4
- package/select/overlaySelect/hooks/useOverlaySelectOverrides.js +3 -0
- package/select/selectMenuAdapter/CollapsibleSelectMenu.js +14 -6
- package/select/selectMenuAdapter/NestedSelectMenuAdapter.js +1 -1
- package/select/selectMenuAdapter/SelectMenuAdapter.js +8 -6
- package/select/styled-component.js +4 -6
- package/slider/slider.d.ts +1 -1
- package/slider/slider.js +12 -2
- package/slider/types.d.ts +3 -0
- package/time-range-picker/RangeSelector.js +2 -2
- package/time-range-picker/RangeSelectorContainer.js +1 -1
- package/time-range-picker/types.d.ts +1 -0
- package/time-zone-picker/types.d.ts +1 -0
- package/tooltip/actionable-tooltip.js +2 -1
- package/tsconfig.build.tsbuildinfo +1 -1
package/list/list-item.js
CHANGED
|
@@ -11,8 +11,10 @@ var styled_component_1 = require("./styled-component");
|
|
|
11
11
|
var useFocusVisible_1 = require("../hooks/useFocusVisible");
|
|
12
12
|
var tooltip_1 = require("../tooltip");
|
|
13
13
|
var useListItemTooltip_1 = tslib_1.__importStar(require("./useListItemTooltip"));
|
|
14
|
+
var utils_1 = require("./utils");
|
|
14
15
|
var ListItem = React.forwardRef(function (_a, ref) {
|
|
15
|
-
var
|
|
16
|
+
var _b, _c;
|
|
17
|
+
var startEnhancer = _a.startEnhancer, children = _a.children, className = _a.className, style = _a.style, _d = _a.alignItems, alignItems = _d === void 0 ? 'center' : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, endEnhancer = _a.endEnhancer, _f = _a.selected, selected = _f === void 0 ? false : _f, _g = _a.highlighted, highlighted = _g === void 0 ? false : _g, _h = _a.autoFocus, autoFocus = _h === void 0 ? false : _h, _j = _a.button, button = _j === void 0 ? false : _j, _k = _a.overrides, overrides = _k === void 0 ? {} : _k, _l = _a.tabIndex, tabIndex = _l === void 0 ? button ? 0 : undefined : _l, _m = _a.role, roleProp = _m === void 0 ? 'listitem' : _m, _o = _a.$as, $as = _o === void 0 ? 'li' : _o, onClick = _a.onClick, onKeyDown = _a.onKeyDown, onFocus = _a.onFocus, onBlur = _a.onBlur, _p = _a.tooltipContent, tooltipContent = _p === void 0 ? '' : _p, restProps = tslib_1.__rest(_a, ["startEnhancer", "children", "className", "style", "alignItems", "disabled", "endEnhancer", "selected", "highlighted", "autoFocus", "button", "overrides", "tabIndex", "role", "$as", "onClick", "onKeyDown", "onFocus", "onBlur", "tooltipContent"]);
|
|
16
18
|
var ownRef = (0, react_1.useRef)(null);
|
|
17
19
|
var combinedRef = (0, useCombinedRef_1.default)(ref, ownRef);
|
|
18
20
|
React.useEffect(function () {
|
|
@@ -33,10 +35,10 @@ var ListItem = React.forwardRef(function (_a, ref) {
|
|
|
33
35
|
onKeyDown(event);
|
|
34
36
|
}
|
|
35
37
|
}, [button, disabled, onClick, onKeyDown]);
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
38
|
+
var _q = tslib_1.__read((0, overrides_1.useOverrides)(overrides.Root, styled_component_1.StyledListItem), 2), Root = _q[0], rootProps = _q[1];
|
|
39
|
+
var _r = tslib_1.__read((0, overrides_1.useOverrides)(overrides.ChildContainer, styled_component_1.StyledChildContainer), 2), ChildContainer = _r[0], childContainerProps = _r[1];
|
|
40
|
+
var _s = tslib_1.__read((0, overrides_1.useOverrides)(overrides.StartEnhancer, styled_component_1.StyledStartEnhancer), 2), StartEnhancer = _s[0], startEnhancerProps = _s[1];
|
|
41
|
+
var _t = tslib_1.__read((0, overrides_1.useOverrides)(overrides.EndEnhancer, styled_component_1.StyledEndEnhancer), 2), EndEnhancer = _t[0], endEnhancerProps = _t[1];
|
|
40
42
|
var sharedProps = {
|
|
41
43
|
$withStartEnhancer: !!startEnhancer,
|
|
42
44
|
$withEndEnhancer: !!endEnhancer,
|
|
@@ -49,14 +51,17 @@ var ListItem = React.forwardRef(function (_a, ref) {
|
|
|
49
51
|
var renderEnhancer = function (enhancer) {
|
|
50
52
|
return typeof enhancer === 'function' ? enhancer(sharedProps) : enhancer;
|
|
51
53
|
};
|
|
52
|
-
var
|
|
54
|
+
var _u = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.StatefulTooltip, tooltip_1.Tooltip), 2), Tooltip = _u[0], tooltipProps = _u[1];
|
|
53
55
|
var tooltipControlProps = (0, useListItemTooltip_1.default)({
|
|
54
56
|
highlighted: highlighted,
|
|
55
57
|
tooltipHandlers: (0, useListItemTooltip_1.getListItemTooltipHandlers)(tooltipProps),
|
|
56
58
|
});
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
var roleCandidate = (_b = rootProps === null || rootProps === void 0 ? void 0 : rootProps.role) !== null && _b !== void 0 ? _b : roleProp;
|
|
60
|
+
var role = typeof roleCandidate === 'string' ? roleCandidate : 'listitem';
|
|
61
|
+
var presentational = (0, utils_1.isPresentationalRole)(role);
|
|
62
|
+
var explicitAriaDisabled = (_c = rootProps === null || rootProps === void 0 ? void 0 : rootProps['aria-disabled']) !== null && _c !== void 0 ? _c : restProps['aria-disabled'];
|
|
63
|
+
var ariaDisabled = presentational ? undefined : explicitAriaDisabled !== null && explicitAriaDisabled !== void 0 ? explicitAriaDisabled : (disabled ? true : undefined);
|
|
64
|
+
var listEl = ((0, jsx_runtime_1.jsxs)(Root, tslib_1.__assign({ "data-spaceweb": "list-item", ref: combinedRef, tabIndex: tabIndex, "$as": $as, onClick: disabled ? noop_1.default : onClick, onKeyDown: handleKeyDown, "data-highlighted": highlighted }, sharedProps, restProps, rootProps, useFocusVisibleProps, { "aria-disabled": ariaDisabled, role: role, style: [style, rootProps === null || rootProps === void 0 ? void 0 : rootProps.style], className: [className, rootProps === null || rootProps === void 0 ? void 0 : rootProps.className] }, { children: [startEnhancer && ((0, jsx_runtime_1.jsx)(StartEnhancer, tslib_1.__assign({}, sharedProps, startEnhancerProps, { children: renderEnhancer(startEnhancer) }))), (0, jsx_runtime_1.jsx)(ChildContainer, tslib_1.__assign({}, sharedProps, childContainerProps, { children: children })), endEnhancer && ((0, jsx_runtime_1.jsx)(EndEnhancer, tslib_1.__assign({}, sharedProps, endEnhancerProps, { children: renderEnhancer(endEnhancer) })))] })));
|
|
60
65
|
return tooltipContent ? ((0, jsx_runtime_1.jsx)(Tooltip, tslib_1.__assign({ placement: "bottom", showArrow: true, content: tooltipContent, viewportAsBoundary: true }, tooltipProps, tooltipControlProps, { children: listEl }))) : (listEl);
|
|
61
66
|
});
|
|
62
67
|
ListItem.displayName = 'ListItem';
|
package/locale/en_US.js
CHANGED
|
@@ -46,6 +46,9 @@ exports.DEFAULT_LOCALE = {
|
|
|
46
46
|
dateInputLabel: 'Date',
|
|
47
47
|
timePickerLabel: 'Time',
|
|
48
48
|
calendarButtonAriaLabel: 'Open Calendar',
|
|
49
|
+
dateInputDayAriaLabel: 'Day',
|
|
50
|
+
dateInputMonthAriaLabel: 'Month',
|
|
51
|
+
dateInputYearAriaLabel: 'Year',
|
|
49
52
|
},
|
|
50
53
|
datePicker: {
|
|
51
54
|
ariaLabelCalendar: 'Calendar.',
|
package/locale/types.d.ts
CHANGED
|
@@ -23,6 +23,9 @@ export type Locale = {
|
|
|
23
23
|
dateInputLabel: string;
|
|
24
24
|
timePickerLabel: string;
|
|
25
25
|
calendarButtonAriaLabel: string;
|
|
26
|
+
dateInputDayAriaLabel: string;
|
|
27
|
+
dateInputMonthAriaLabel: string;
|
|
28
|
+
dateInputYearAriaLabel: string;
|
|
26
29
|
};
|
|
27
30
|
menu: {
|
|
28
31
|
nestedMenuItemAriaDescription: string;
|
|
@@ -42,10 +42,14 @@ var useKeyboardNavigation = function (_a) {
|
|
|
42
42
|
_setHighlightedItem(item);
|
|
43
43
|
setListItemFocusVisible(showFocusVisibleStyles);
|
|
44
44
|
}, []);
|
|
45
|
-
// highlight
|
|
45
|
+
// Re-target highlight when the previous item has left the DOM or is no longer highlightable
|
|
46
|
+
// (filter, unmount, disabled). If nothing is highlightable, clear so aria-activedescendant
|
|
47
|
+
// is not left pointing at a detached or disabled id.
|
|
46
48
|
(0, react_1.useLayoutEffect)(function () {
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
+
var shouldKeepHighlight = Boolean(highlightedItem) &&
|
|
50
|
+
Boolean(ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.contains(highlightedItem)) &&
|
|
51
|
+
(0, helpers_1.canHighlightItem)(highlightedItem);
|
|
52
|
+
if (disableAutoHighlight || shouldKeepHighlight || !navigationEnabled || !listItemsContainerRef) {
|
|
49
53
|
return;
|
|
50
54
|
}
|
|
51
55
|
var firstHighlightableItem = (0, helpers_1.getFirstHighlightableElement)(listItemsContainerRef).firstHighlightableItem;
|
|
@@ -56,6 +60,9 @@ var useKeyboardNavigation = function (_a) {
|
|
|
56
60
|
}
|
|
57
61
|
setHighlightedItem(firstHighlightableItem, showFocusRing);
|
|
58
62
|
}
|
|
63
|
+
else {
|
|
64
|
+
setHighlightedItem(null);
|
|
65
|
+
}
|
|
59
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- run this hook only when children changes
|
|
60
67
|
}, [children]);
|
|
61
68
|
(0, react_1.useEffect)(function () {
|
package/menu/useStatefulMenu.js
CHANGED
|
@@ -51,18 +51,24 @@ var useStatefulMenu = function (_a) {
|
|
|
51
51
|
(_a = onHighlightedItemChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onHighlightedItemChangeRef, highlightedItem);
|
|
52
52
|
}, [highlightedItem, onHighlightedItemChangeRef]);
|
|
53
53
|
(0, react_1.useEffect)(function () {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
if (!navigationEnabled || !(highlightedItem === null || highlightedItem === void 0 ? void 0 : highlightedItem.id) || !highlightedItem.isConnected) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
var ownerDocument = highlightedItem.ownerDocument;
|
|
58
|
+
// menus keep focus on the list, so fall back to the focused element. Never use body.
|
|
59
|
+
var activeElement = ownerDocument.activeElement instanceof HTMLElement ? ownerDocument.activeElement : null;
|
|
60
|
+
var host = keyboardFocusRestoreTarget !== null && keyboardFocusRestoreTarget !== void 0 ? keyboardFocusRestoreTarget : activeElement;
|
|
61
|
+
if (!host || host === ownerDocument.body) {
|
|
62
|
+
return undefined;
|
|
59
63
|
}
|
|
64
|
+
var highlightedItemId = highlightedItem.id;
|
|
65
|
+
host.setAttribute('aria-activedescendant', highlightedItemId);
|
|
60
66
|
return function () {
|
|
61
|
-
if (
|
|
62
|
-
|
|
67
|
+
if (host.getAttribute('aria-activedescendant') === highlightedItemId) {
|
|
68
|
+
host.removeAttribute('aria-activedescendant');
|
|
63
69
|
}
|
|
64
70
|
};
|
|
65
|
-
}, [navigationEnabled, highlightedItem]);
|
|
71
|
+
}, [navigationEnabled, highlightedItem, keyboardFocusRestoreTarget]);
|
|
66
72
|
return {
|
|
67
73
|
highlightedItem: highlightedItem,
|
|
68
74
|
setHighlightedItem: setHighlightedItem,
|
package/modal/modal.js
CHANGED
|
@@ -70,8 +70,8 @@ var Modal = function (_a) {
|
|
|
70
70
|
return {};
|
|
71
71
|
}, [size, px2rem]);
|
|
72
72
|
var dialogA11yProps = (0, react_1.useMemo)(function () { return ({
|
|
73
|
-
'aria-label': ariaLabel,
|
|
74
|
-
'aria-labelledby': ariaLabelledBy || headerTitleId,
|
|
73
|
+
'aria-label': ariaLabelledBy ? undefined : ariaLabel,
|
|
74
|
+
'aria-labelledby': ariaLabelledBy || (ariaLabel ? undefined : headerTitleId),
|
|
75
75
|
}); }, [ariaLabel, ariaLabelledBy, headerTitleId]);
|
|
76
76
|
var _overrides = (0, react_1.useMemo)(function () {
|
|
77
77
|
return (0, overrides_2.mergeOverrides)({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprinklrjs/spaceweb",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.16.1",
|
|
4
4
|
"description": "Components for SpaceWeb",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
"@testing-library/react-hooks": "^7.0.1",
|
|
82
82
|
"@testing-library/user-event": "^13.2.1",
|
|
83
83
|
"@types/jest": "^26.0.24",
|
|
84
|
-
"@types/jest-axe": "^3.5.9",
|
|
85
84
|
"@types/lodash": "^4.14.149",
|
|
86
85
|
"@types/react-is": "^17.0.2",
|
|
87
86
|
"@vvo/tzdb": "^6.158.0",
|
|
@@ -93,7 +92,6 @@
|
|
|
93
92
|
"enzyme-adapter-react-16": "^1.15.2",
|
|
94
93
|
"glob": "^7.1.6",
|
|
95
94
|
"jest": "^26.5.2",
|
|
96
|
-
"jest-axe": "^5.0.1",
|
|
97
95
|
"mq-polyfill": "^1.1.8",
|
|
98
96
|
"postcss": "^7.0.27",
|
|
99
97
|
"postcss-js": "^2.0.3",
|
|
@@ -102,7 +100,7 @@
|
|
|
102
100
|
"typescript": "~5.0.0"
|
|
103
101
|
},
|
|
104
102
|
"peerDependencies": {
|
|
105
|
-
"@sprinklrjs/spaceweb-themes": "14.
|
|
103
|
+
"@sprinklrjs/spaceweb-themes": "14.16.1",
|
|
106
104
|
"react": ">=17.0.2 <19.0.0",
|
|
107
105
|
"react-dom": ">=17.0.2 <19.0.0"
|
|
108
106
|
}
|
|
@@ -129,6 +129,7 @@ var useOverlaySelectOverrides = function (props) {
|
|
|
129
129
|
}, [closePopover, onChange, closeOnSelect]);
|
|
130
130
|
var _h = (0, useStickyElement_1.default)(), isSticky = _h.isSticky, setStickySentinelRef = _h.setStickySentinelRef;
|
|
131
131
|
var _j = useSearchContainerHeight(), containerHeight = _j.containerHeight, setContainerElement = _j.setContainerElement;
|
|
132
|
+
var ariaLabel = props['aria-label'];
|
|
132
133
|
var memoizedOverrides = (0, react_1.useMemo)(function () { return ({
|
|
133
134
|
// BaseSelect wil render this Popover component with DropdownContainer as content and ControlContainer as children/target
|
|
134
135
|
Popover: {
|
|
@@ -155,6 +156,7 @@ var useOverlaySelectOverrides = function (props) {
|
|
|
155
156
|
'aria-expanded': popoverOpen,
|
|
156
157
|
'aria-autocomplete': 'list',
|
|
157
158
|
'aria-haspopup': 'listbox',
|
|
159
|
+
'aria-label': ariaLabel,
|
|
158
160
|
overrides: {
|
|
159
161
|
After: isLoading ? SelectLoader : function () { return null; },
|
|
160
162
|
ClearIcon: {
|
|
@@ -244,6 +246,7 @@ var useOverlaySelectOverrides = function (props) {
|
|
|
244
246
|
scrollContainer,
|
|
245
247
|
scrollElement,
|
|
246
248
|
popoverOpen,
|
|
249
|
+
ariaLabel,
|
|
247
250
|
]);
|
|
248
251
|
var overrides = (0, react_1.useMemo)(function () { return (0, overrides_1.mergeOverrides)(memoizedOverrides, (0, omit_1.default)(props.overrides, overridesToOmit)); }, [memoizedOverrides, props.overrides]);
|
|
249
252
|
return {
|
|
@@ -143,7 +143,7 @@ var CollapsibleSelectMenu = function (_a) {
|
|
|
143
143
|
// https://ui5.sap.com/#/entity/sap.m.MultiComboBox/sample/sap.m.sample.MultiComboBoxSelectAll
|
|
144
144
|
role: "checkbox", className: ['m-2', baseuiMenuItemProps === null || baseuiMenuItemProps === void 0 ? void 0 : baseuiMenuItemProps.className] }), "select-all-option")) : null, groupConfig.map(function (_group, index) {
|
|
145
145
|
var _a;
|
|
146
|
-
var _b, _c;
|
|
146
|
+
var _b, _c, _d;
|
|
147
147
|
var groupId = _group.id, groupLabel = _group.label;
|
|
148
148
|
var itemsInGroup = groupedItems[groupId];
|
|
149
149
|
var group = _group;
|
|
@@ -161,12 +161,20 @@ var CollapsibleSelectMenu = function (_a) {
|
|
|
161
161
|
_a[constants_2.GROUP_SELECT_ALL_ID] = true,
|
|
162
162
|
_a.selected = groupSelectAllSelected,
|
|
163
163
|
_a);
|
|
164
|
-
|
|
164
|
+
var menuChildren = (0, isEmpty_1.default)(itemsInGroup)
|
|
165
|
+
? [
|
|
166
|
+
(0, jsx_runtime_1.jsx)(NoResultsOverriden, tslib_1.__assign({ msg: noResultsMsg, noResultsConfig: noResultsConfig, "$groupId": groupId }, noResultsProps), "no-results"),
|
|
167
|
+
]
|
|
168
|
+
: tslib_1.__spreadArray([
|
|
169
|
+
shouldDisplayGroupSelectAll ? ((0, jsx_runtime_1.jsx)(SelectMenuItem_1.default, tslib_1.__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,
|
|
170
|
+
clearAsOptionItem ? ((0, jsx_runtime_1.jsx)(SelectMenuItem_1.default, tslib_1.__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
|
|
171
|
+
], tslib_1.__read(itemsInGroup.map(function (item) {
|
|
172
|
+
var selected = selectedValuesSet.has(item[valueKey]);
|
|
173
|
+
return ((0, jsx_runtime_1.jsx)(SelectMenuItem_1.default, tslib_1.__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]));
|
|
174
|
+
})), false).filter(Boolean);
|
|
175
|
+
return ((0, jsx_runtime_1.jsxs)(Collapsible, tslib_1.__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: [(0, jsx_runtime_1.jsx)(hidden_element_1.HiddenElement, tslib_1.__assign({ id: menuDescriptionId !== null && menuDescriptionId !== void 0 ? menuDescriptionId : '' }, { children: "".concat(groupLabel, " ").concat(locale.groupExpandedSuffix) })), (0, jsx_runtime_1.jsx)(MenuComponent, tslib_1.__assign({ resetMenuHighlightOnMouseLeave: true, focusWhenNavigationEnabled: false, disableAutoHighlight: isRootSelectAllHighlighted, keyboardFocusRestoreTarget: inputElement, tabIndex: -1, selectOnTab: selectOnTab, getActionsElement: getActionsElement }, menuProps, { role: "listbox", id: listboxId, "aria-label": (_d = menuProps === null || menuProps === void 0 ? void 0 : menuProps['aria-label']) !== null && _d !== void 0 ? _d : groupLabel, virtual: virtual && !(0, isEmpty_1.default)(itemsInGroup), className: ['overflow-auto max-h-50 pt-0', menuProps === null || menuProps === void 0 ? void 0 : menuProps.className], onScroll: function (e) {
|
|
165
176
|
$onPaginate === null || $onPaginate === void 0 ? void 0 : $onPaginate(e, groupId);
|
|
166
|
-
}, onHighlightedItemChange: handleOnHighlightedItemChange, ref: menuRef }, { children:
|
|
167
|
-
var selected = selectedValuesSet.has(item[valueKey]);
|
|
168
|
-
return ((0, jsx_runtime_1.jsx)(SelectMenuItem_1.default, tslib_1.__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]));
|
|
169
|
-
})] })))] }), groupId));
|
|
177
|
+
}, onHighlightedItemChange: handleOnHighlightedItemChange, ref: menuRef }, { children: menuChildren }))] }), groupId));
|
|
170
178
|
})] })));
|
|
171
179
|
};
|
|
172
180
|
exports.CollapsibleSelectMenu = CollapsibleSelectMenu;
|
|
@@ -81,6 +81,6 @@ var NestedSelectMenuAdapter = function (props) {
|
|
|
81
81
|
}
|
|
82
82
|
return null;
|
|
83
83
|
};
|
|
84
|
-
return totalCount ? ((0, jsx_runtime_1.jsx)(MenuOverriden, tslib_1.__assign({ resetMenuHighlightOnMouseLeave: true, focusWhenNavigationEnabled: false, keyboardFocusRestoreTarget: inputElement, "$multi": multi, captureScroll: captureScroll, tabIndex: -1, "aria-label": "Menu", role: "listbox", getActionsElement: getActionsElement }, baseuiMenuListProps, { id: listboxId, virtual: virtual, overscanCount: overscanCount, items: props.items.__ungrouped, itemRenderer: itemRenderer }, menuProps, { getItemLabel: getItemLabel !== null && getItemLabel !== void 0 ? getItemLabel : defaultItemLabel }))) : ((0, jsx_runtime_1.jsx)(menu_1.Menu, tslib_1.__assign({ resetMenuHighlightOnMouseLeave: true, focusWhenNavigationEnabled: false, keyboardFocusRestoreTarget: inputElement, tabIndex: -1, "aria-label": "Menu", role: "listbox", getActionsElement: getActionsElement, id: listboxId }, { children: (0, jsx_runtime_1.jsx)(NoResultsOverriden, tslib_1.__assign({
|
|
84
|
+
return totalCount ? ((0, jsx_runtime_1.jsx)(MenuOverriden, tslib_1.__assign({ resetMenuHighlightOnMouseLeave: true, focusWhenNavigationEnabled: false, keyboardFocusRestoreTarget: inputElement, "$multi": multi, captureScroll: captureScroll, tabIndex: -1, "aria-label": "Menu", role: "listbox", getActionsElement: getActionsElement }, baseuiMenuListProps, { id: listboxId, virtual: virtual, overscanCount: overscanCount, items: props.items.__ungrouped, itemRenderer: itemRenderer }, menuProps, { getItemLabel: getItemLabel !== null && getItemLabel !== void 0 ? getItemLabel : defaultItemLabel }))) : ((0, jsx_runtime_1.jsx)(menu_1.Menu, tslib_1.__assign({ resetMenuHighlightOnMouseLeave: true, focusWhenNavigationEnabled: false, keyboardFocusRestoreTarget: inputElement, tabIndex: -1, "aria-label": "Menu", role: "listbox", getActionsElement: getActionsElement, id: listboxId }, { children: (0, jsx_runtime_1.jsx)(NoResultsOverriden, tslib_1.__assign({ msg: noResultsMsg, noResultsConfig: noResultsConfig }, noResultsProps)) })));
|
|
85
85
|
};
|
|
86
86
|
exports.default = NestedSelectMenuAdapter;
|
|
@@ -61,24 +61,26 @@ var SelectMenuAdapter = function (props) {
|
|
|
61
61
|
}); }, [mergedOverrides.ListItemText, mergedOverrides.MenuItem, mergedOverrides.Checkbox]);
|
|
62
62
|
var currentCount = 0;
|
|
63
63
|
var totalCount = (0, utils_1.normalizeOptions)(groupedItems).length;
|
|
64
|
-
var
|
|
64
|
+
var optionItems = (0, flatten_1.default)(Object.keys(removeUngroupedIfEmpty(groupedItems)).map(function (itemGroup, index) {
|
|
65
65
|
var itemsInGroup = groupedItems[itemGroup];
|
|
66
66
|
var menuItems = itemsInGroup.flatMap(function (item) {
|
|
67
67
|
currentCount += 1;
|
|
68
68
|
var selected = selectedValuesSet.has(item[valueKey]) || (item[types_1.SELECT_ALL_ID] && selectAllSelected);
|
|
69
69
|
var selectMenuItem = ((0, jsx_runtime_1.jsx)(SelectMenuItem_1.default, tslib_1.__assign({ overrides: menuItemOverrides, item: item, selected: selected, multi: multi, getItemLabel: getItemLabel, labelKey: labelKey, valueKey: valueKey, onItemSelect: onItemSelect, "$item": item, "aria-posinset": currentCount, "aria-setsize": totalCount }, baseuiMenuItemProps), item.isCreatable ? 'creatable-option' : "".concat(item[valueKey], "-").concat(item.__optgroup)));
|
|
70
70
|
return item[types_1.SELECT_ALL_ID]
|
|
71
|
-
? [
|
|
71
|
+
? [
|
|
72
|
+
selectMenuItem,
|
|
73
|
+
(0, jsx_runtime_1.jsx)(DividerOverriden, tslib_1.__assign({ "$item": item }, dividerProps, { role: "presentation" }), "divider-select-all"),
|
|
74
|
+
]
|
|
72
75
|
: selectMenuItem;
|
|
73
76
|
});
|
|
74
77
|
if (itemGroup !== constants_1.UNGROUPED_ID) {
|
|
75
|
-
menuItems.unshift((0, jsx_runtime_1.jsx)(DividerOverriden, tslib_1.__assign({ first: index === 0 }, dividerProps, { children: (0, jsx_runtime_1.jsx)(typography_1.Typography, tslib_1.__assign({ variant: "body-xs", weight: "semibold", className: "spr-text-tertiary" }, { children: itemGroup })) }), "divider-".concat(itemGroup)));
|
|
78
|
+
menuItems.unshift((0, jsx_runtime_1.jsx)(DividerOverriden, tslib_1.__assign({ first: index === 0 }, dividerProps, { role: "presentation" }, { children: (0, jsx_runtime_1.jsx)(typography_1.Typography, tslib_1.__assign({ variant: "body-xs", weight: "semibold", className: "spr-text-tertiary" }, { children: itemGroup })) }), "divider-".concat(itemGroup)));
|
|
76
79
|
}
|
|
77
80
|
return menuItems;
|
|
78
81
|
}));
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
+
var hasOptions = !(0, isEmpty_1.default)(optionItems);
|
|
83
|
+
var itemsToRender = hasOptions ? (optionItems) : ((0, jsx_runtime_1.jsx)(NoResultsOverriden, tslib_1.__assign({ msg: noResultsMsg, noResultsConfig: noResultsConfig }, noResultsProps)));
|
|
82
84
|
return (
|
|
83
85
|
// focusWhenNavigationEnabled false, or else it will remove focus from select input
|
|
84
86
|
(0, jsx_runtime_1.jsx)(MenuOverriden, tslib_1.__assign({ resetMenuHighlightOnMouseLeave: true, focusWhenNavigationEnabled: false, keyboardFocusRestoreTarget: inputElement, "$multi": multi, captureScroll: captureScroll, tabIndex: -1, "aria-label": "Menu", role: "listbox", getActionsElement: getActionsElement }, baseuiMenuListProps, { id: listboxId, virtual: virtual, overscanCount: overscanCount, selectOnTab: selectOnTab }, menuProps, { children: itemsToRender })));
|
|
@@ -5,8 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
var react_1 = require("react");
|
|
7
7
|
var locale_1 = require("../locale");
|
|
8
|
-
var
|
|
9
|
-
var menu_item_1 = tslib_1.__importDefault(require("../menu/menu-item"));
|
|
8
|
+
var list_item_1 = tslib_1.__importDefault(require("../list/list-item"));
|
|
10
9
|
var style_1 = require("../style");
|
|
11
10
|
var themeHelpers_1 = require("../helpers/themeHelpers");
|
|
12
11
|
var hidden_element_1 = require("./utils/hidden-element");
|
|
@@ -20,7 +19,8 @@ var NoResults = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
20
19
|
var msg = _a.msg, noResultsConfig = _a.noResultsConfig, props = tslib_1.__rest(_a, ["msg", "noResultsConfig"]);
|
|
21
20
|
var locale = (0, locale_1.useLocale)();
|
|
22
21
|
var noResultsId = (0, SelectIdsContext_1.useSelectIds)().noResultsId;
|
|
23
|
-
|
|
22
|
+
var message = msg || locale.select.noResultsMsg;
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(list_item_1.default, tslib_1.__assign({ ref: ref, button: false, id: noResultsId, role: "option", "aria-live": "polite", "aria-atomic": true, "aria-selected": false, "aria-disabled": !(noResultsConfig === null || noResultsConfig === void 0 ? void 0 : noResultsConfig.onButtonClick) }, props, { children: noResultsConfig ? (0, jsx_runtime_1.jsx)(no_results_message_1.NoResultsMessage, tslib_1.__assign({}, noResultsConfig)) : message })));
|
|
24
24
|
});
|
|
25
25
|
exports.NoResults = NoResults;
|
|
26
26
|
exports.StyledInputContainer = (0, style_1.styled)('div', cvaConfigs_1.inputContainerCVA,
|
|
@@ -79,9 +79,7 @@ var InputContainer = function (_a) {
|
|
|
79
79
|
var ariaDescribedBy = commaSeparatedValues ? "".concat(selectedValuesId, " ").concat(baseAriaDescribedBy) : baseAriaDescribedBy;
|
|
80
80
|
var containerRef = (0, react_1.useRef)(null);
|
|
81
81
|
if (!props.$searchable) {
|
|
82
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [commaSeparatedValues ? ((0, jsx_runtime_1.jsx)(hidden_element_1.HiddenElement, tslib_1.__assign({ id: selectedValuesId }, { children: "".concat(commaSeparatedValues, " ").concat(props.$multi ? locale.select.multiValueNavigationDescription : '') }))) : null, (0, jsx_runtime_1.jsx)(exports.StyledInputContainer, tslib_1.__assign({}, props, { "$selectSize": size, "aria-controls": props.$isOpen ? listboxId : undefined, "aria-owns": props.$isOpen ? listboxId : null, "aria-describedby": ariaDescribedBy, "aria-expanded": props.$isOpen, "aria-autocomplete": "list", role: "combobox", ref: containerRef },
|
|
83
|
-
? {}
|
|
84
|
-
: { 'aria-placeholder': placeholder !== null && placeholder !== void 0 ? placeholder : locale.select.selectPlaceholder }), { "aria-haspopup": "listbox" }, { children: props.children
|
|
82
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [commaSeparatedValues ? ((0, jsx_runtime_1.jsx)(hidden_element_1.HiddenElement, tslib_1.__assign({ id: selectedValuesId }, { children: "".concat(commaSeparatedValues, " ").concat(props.$multi ? locale.select.multiValueNavigationDescription : '') }))) : null, (0, jsx_runtime_1.jsx)(exports.StyledInputContainer, tslib_1.__assign({}, props, { "$selectSize": size, "aria-controls": props.$isOpen ? listboxId : undefined, "aria-owns": props.$isOpen ? listboxId : null, "aria-describedby": ariaDescribedBy, "aria-expanded": props.$isOpen, "aria-autocomplete": "list", role: "combobox", ref: containerRef, "aria-haspopup": "listbox" }, { children: props.children
|
|
85
83
|
? (0, react_1.cloneElement)(react_1.Children.only(props.children), tslib_1.__assign({ onFocus: function () { var _a; return (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.focus(); } }, ($value && $value.length > 0 ? {} : { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : locale.select.selectPlaceholder })))
|
|
86
84
|
: null }))] }));
|
|
87
85
|
}
|
package/slider/slider.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { SliderProps } from './types';
|
|
3
3
|
declare const Slider: {
|
|
4
|
-
({ overrides, disabled, marks, onChange, onFinalChange, min: propMin, max: propMax, step, persistentThumb, valueToLabel, value: propProvidedValue, intent, className, style, getMarkLabel, markLabel, primaryIntentColor, secondaryIntentColor, trackColors, thumbColors, }: SliderProps): ReactElement;
|
|
4
|
+
({ overrides, disabled, marks, onChange, onFinalChange, min: propMin, max: propMax, step, persistentThumb, valueToLabel, value: propProvidedValue, intent, className, style, getMarkLabel, markLabel, primaryIntentColor, secondaryIntentColor, trackColors, thumbColors, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, }: SliderProps): ReactElement;
|
|
5
5
|
__standard: string;
|
|
6
6
|
};
|
|
7
7
|
export default Slider;
|
package/slider/slider.js
CHANGED
|
@@ -24,7 +24,7 @@ var defaultMarkLabel = function (_a) {
|
|
|
24
24
|
return "".concat(($min || 0) + $markIndex * $step);
|
|
25
25
|
};
|
|
26
26
|
var Slider = function (_a) {
|
|
27
|
-
var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.marks, marks = _d === void 0 ? false : _d, _e = _a.onChange, onChange = _e === void 0 ? noop_1.default : _e, _f = _a.onFinalChange, onFinalChange = _f === void 0 ? noop_1.default : _f, _g = _a.min, propMin = _g === void 0 ? 0 : _g, _h = _a.max, propMax = _h === void 0 ? 100 : _h, _j = _a.step, step = _j === void 0 ? 1 : _j, _k = _a.persistentThumb, persistentThumb = _k === void 0 ? false : _k, _l = _a.valueToLabel, valueToLabel = _l === void 0 ? function (label) { return label; } : _l, propProvidedValue = _a.value, _m = _a.intent, intent = _m === void 0 ? 'default' : _m, className = _a.className, style = _a.style, _o = _a.getMarkLabel, getMarkLabel = _o === void 0 ? defaultMarkLabel : _o, markLabel = _a.markLabel, primaryIntentColor = _a.primaryIntentColor, secondaryIntentColor = _a.secondaryIntentColor, trackColors = _a.trackColors, thumbColors = _a.thumbColors;
|
|
27
|
+
var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.marks, marks = _d === void 0 ? false : _d, _e = _a.onChange, onChange = _e === void 0 ? noop_1.default : _e, _f = _a.onFinalChange, onFinalChange = _f === void 0 ? noop_1.default : _f, _g = _a.min, propMin = _g === void 0 ? 0 : _g, _h = _a.max, propMax = _h === void 0 ? 100 : _h, _j = _a.step, step = _j === void 0 ? 1 : _j, _k = _a.persistentThumb, persistentThumb = _k === void 0 ? false : _k, _l = _a.valueToLabel, valueToLabel = _l === void 0 ? function (label) { return label; } : _l, propProvidedValue = _a.value, _m = _a.intent, intent = _m === void 0 ? 'default' : _m, className = _a.className, style = _a.style, _o = _a.getMarkLabel, getMarkLabel = _o === void 0 ? defaultMarkLabel : _o, markLabel = _a.markLabel, primaryIntentColor = _a.primaryIntentColor, secondaryIntentColor = _a.secondaryIntentColor, trackColors = _a.trackColors, thumbColors = _a.thumbColors, ariaLabel = _a["aria-label"], ariaLabelledBy = _a["aria-labelledby"], ariaDescribedBy = _a["aria-describedby"];
|
|
28
28
|
var _p = tslib_1.__read((0, react_1.useState)(-1), 2), hoveredThumbIndex = _p[0], setHoveredThumbIndex = _p[1];
|
|
29
29
|
var hasMounted = (0, useHasMounted_1.useHasMounted)();
|
|
30
30
|
var _q = tslib_1.__read((0, react_1.useState)(false), 2), isFocusVisible = _q[0], setIsFocusVisible = _q[1];
|
|
@@ -98,7 +98,17 @@ var Slider = function (_a) {
|
|
|
98
98
|
// In SSR, Thumbs are not properly positioned, hence hiding thumbs on server render.
|
|
99
99
|
// Refer https://github.com/tajo/react-range/issues/67#issuecomment-591703422
|
|
100
100
|
// Thumb is made ClientOnly to avoid Hydration mismatch error
|
|
101
|
-
|
|
101
|
+
var thumbLabel;
|
|
102
|
+
if (ariaLabel == null) {
|
|
103
|
+
thumbLabel = undefined;
|
|
104
|
+
}
|
|
105
|
+
else if (value.length > 1) {
|
|
106
|
+
thumbLabel = "".concat(ariaLabel, " ").concat(index + 1);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
thumbLabel = ariaLabel;
|
|
110
|
+
}
|
|
111
|
+
return ((0, jsx_runtime_1.jsxs)(Thumb, tslib_1.__assign({}, props, (thumbLabel ? { 'aria-label': thumbLabel } : {}), (ariaLabelledBy ? { 'aria-labelledby': ariaLabelledBy } : {}), (ariaDescribedBy ? { 'aria-describedby': ariaDescribedBy } : {}), { "data-thumbIndex": index, onMouseEnter: function () { return setHoveredThumbIndex(index); }, onMouseLeave: function () { return setHoveredThumbIndex(-1); }, "$thumbIndex": index, "$isDragged": isDragged, style: tslib_1.__assign(tslib_1.__assign({ '--sw-bg-color': value.length > 2 ? thumbColors[index] : primaryIntentColor !== null && primaryIntentColor !== void 0 ? primaryIntentColor : (0, intentHelper_1.intentColor)(styleUtils, sharedProps), '--sw-bg-color-hover': value.length > 2
|
|
102
112
|
? thumbColors[index]
|
|
103
113
|
: primaryIntentColor !== null && primaryIntentColor !== void 0 ? primaryIntentColor : (0, intentHelper_1.intentColor)(styleUtils, sharedProps, theme.spr.interactiveHover), '--sw-shadow': isFocusVisible && focusedThumbIndex === index
|
|
104
114
|
? "0 0 0 3px ".concat(theme.spr.focus01)
|
package/slider/types.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ type GetMarkLabelFn = (props: SharedProps & {
|
|
|
14
14
|
$markIndex: number;
|
|
15
15
|
}) => React.ReactNode;
|
|
16
16
|
type CommonSliderProps = {
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
'aria-labelledby'?: string;
|
|
19
|
+
'aria-describedby'?: string;
|
|
17
20
|
/** @deprecated */
|
|
18
21
|
intent?: Intent;
|
|
19
22
|
markLabel?: boolean;
|
|
@@ -16,8 +16,8 @@ var RangeSelector = function (_a) {
|
|
|
16
16
|
var TIME_RANGE_LIST_OVERRIDES = (0, react_1.useMemo)(function () {
|
|
17
17
|
return (0, overrides_1.mergeOverrides)({ Menu: { props: { overrides: { List: { props: { overrides: { Root: { className: 'h-0' } } } } } } } }, overrides);
|
|
18
18
|
}, [overrides]);
|
|
19
|
-
return ((0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "flex border-0 border-t-1 border-solid spr-border-01" }, { children: [props.timeRangePresets.length !== 1 ? ((0, jsx_runtime_1.jsx)(TimeRangeList, tslib_1.__assign({ onChange: onChange, timeRange: timeRange, preset: preset, timeRangePresets: props.timeRangePresets, overrides: TIME_RANGE_LIST_OVERRIDES, hidePresetSearch: hidePresetSearch }, restTimeRangeListProps))) : null, (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "overflow-y-auto" }, { children: [(0, jsx_runtime_1.jsx)(Calendar, tslib_1.__assign({ timeSelectEnd: props.timeSelect, timeSelectStart: props.timeSelect, value: timeRange, onChange: onChange, peekNextMonth: props.peekNextMonth, excludeDates: props.excludeDates, filterDate: props.filterDate, minDate: props.minDate, maxDate: props.maxDate, range: true, monthsShown: props.monthsShown, locale: props.locale, formatString: formatString,
|
|
20
|
-
// @ts-
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "flex flex-1 min-h-0 overflow-y-auto border-0 border-t-1 border-solid spr-border-01", "data-testid": "time-range-selector-scroll" }, { children: [props.timeRangePresets.length !== 1 ? ((0, jsx_runtime_1.jsx)(TimeRangeList, tslib_1.__assign({ onChange: onChange, timeRange: timeRange, preset: preset, timeRangePresets: props.timeRangePresets, overrides: TIME_RANGE_LIST_OVERRIDES, hidePresetSearch: hidePresetSearch }, restTimeRangeListProps))) : null, (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "overflow-y-auto" }, { children: [(0, jsx_runtime_1.jsx)(Calendar, tslib_1.__assign({ timeSelectEnd: props.timeSelect, timeSelectStart: props.timeSelect, value: timeRange, onChange: onChange, peekNextMonth: props.peekNextMonth, excludeDates: props.excludeDates, filterDate: props.filterDate, minDate: props.minDate, maxDate: props.maxDate, range: true, monthsShown: props.monthsShown, locale: props.locale, formatString: formatString,
|
|
20
|
+
// @ts-expect-error Calendar overrides type does not include date-picker overrides shape
|
|
21
21
|
overrides: props.overrides, fixedHeight: props.fixedHeight }, calendarProps)), footerContent] }))] })));
|
|
22
22
|
};
|
|
23
23
|
RangeSelector.displayName = 'RangeSelector';
|
|
@@ -116,7 +116,7 @@ var RangeSelectorContainer = function (_a) {
|
|
|
116
116
|
fill: theme.spr.clrRed,
|
|
117
117
|
});
|
|
118
118
|
} }), (0, jsx_runtime_1.jsx)(typography_1.Typography, tslib_1.__assign({ className: "my-0", variant: "bs3" }, { children: errMsg }))] }))) : null;
|
|
119
|
-
return ((0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "spr-ui-01 rounded-8" }, { children: [(0, jsx_runtime_1.jsxs)(Header, tslib_1.__assign({ "$setTimezone": setTimezone, "$onClose": props.onClose }, headerProps, { children: [(0, jsx_runtime_1.jsx)(HeaderBeforeEnhancer, tslib_1.__assign({ variant: "heading-7", "$as": "span", className: "flex items-center" }, headerBeforeEnhancerProps, { children: locale.timeRangePicker.headerLabel })), disableTimezone ? null : ((0, jsx_runtime_1.jsx)(TimezonePicker, tslib_1.__assign({ setTimezone: setTimezone, timezone: timezone, timezoneOptions: timezoneOptions }, timezonePickerProps, { className: ['w-0 grow max-w-md', timezonePickerProps === null || timezonePickerProps === void 0 ? void 0 : timezonePickerProps.className] })))] })), (0, jsx_runtime_1.jsx)(RangeSelector, tslib_1.__assign({ overrides: props.overrides, timeSelect: props.timeSelect, timeRangePresets: timeRangePresets, timezone: timezone, timeRange: timeRange, preset: preset, onChange: onDateChange, adapter: adapter, peekNextMonth: props.peekNextMonth, excludeDates: props.excludeDates, filterDate: props.filterDate, minDate: minDate, maxDate: maxDate, formatString: props.formatString, locale: props.locale, fixedHeight: props.fixedHeight, monthsShown: monthsShown, hidePresetSearch: hidePresetSearch, footerContent: (0, jsx_runtime_1.jsx)(Footer, tslib_1.__assign({ "$hasError": hasError, "$onSubmit": handleSubmit, "$onClose": props.onClose }, footerProps, { className: ['px-6 py-3 mt-2', footerProps.className] }, { children: (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "justify-between w-0 grow flex" }, { children: [(0, jsx_runtime_1.jsx)(FooterBeforeEnhancer, tslib_1.__assign({}, footerBeforeEnhancerProps)), (0, jsx_runtime_1.jsxs)(stack_1.Stack, tslib_1.__assign({ direction: monthsShown === 1 ? 'vertical' : 'horizontal', gap: 3, className: monthsShown !== 1 ? 'items-center' : undefined, style: { maxWidth: 'fit-content' } }, { children: [monthsShown === 1 ? null : errorEl, (0, jsx_runtime_1.jsxs)(stack_1.StackItem, tslib_1.__assign({ className: "flex self-end" }, { children: [(footerProps === null || footerProps === void 0 ? void 0 : footerProps.showClearButton) ? ((0, jsx_runtime_1.jsx)(button_1.Button, tslib_1.__assign({ size: "xs", onClick: footerProps.handleClearBtnClick, variant: "secondary", "data-testid": "clear", disabled: timeRange.length === 0 }, { children: locale.timeRangePicker.clearBtnLabel }))) : ((0, jsx_runtime_1.jsx)(button_1.Button, tslib_1.__assign({ size: "xs", onClick: props.onClose, variant: "secondary", "data-testid": "cancel" }, { children: locale.timeRangePicker.cancelBtnLabel }))), (0, jsx_runtime_1.jsx)(button_1.Button, tslib_1.__assign({ size: "xs", className: "ml-3", onClick: handleSubmit, disabled: hasError, "data-testid": "save" }, { children: locale.timeRangePicker.saveBtnLabel }))] })), monthsShown === 1 ? errorEl : null] }))] })) })) }, rangeSelectorProps))] })));
|
|
119
|
+
return ((0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "spr-ui-01 rounded-8 flex flex-col", style: { maxHeight: '100vh' }, "data-testid": "time-range-selector-panel" }, { children: [(0, jsx_runtime_1.jsxs)(Header, tslib_1.__assign({ "$setTimezone": setTimezone, "$onClose": props.onClose }, headerProps, { children: [(0, jsx_runtime_1.jsx)(HeaderBeforeEnhancer, tslib_1.__assign({ variant: "heading-7", "$as": "span", className: "flex items-center" }, headerBeforeEnhancerProps, { children: locale.timeRangePicker.headerLabel })), disableTimezone ? null : ((0, jsx_runtime_1.jsx)(TimezonePicker, tslib_1.__assign({ setTimezone: setTimezone, timezone: timezone, timezoneOptions: timezoneOptions }, timezonePickerProps, { "aria-label": locale.timeRangePicker.timezoneLabel, className: ['w-0 grow max-w-md', timezonePickerProps === null || timezonePickerProps === void 0 ? void 0 : timezonePickerProps.className] })))] })), (0, jsx_runtime_1.jsx)(RangeSelector, tslib_1.__assign({ overrides: props.overrides, timeSelect: props.timeSelect, timeRangePresets: timeRangePresets, timezone: timezone, timeRange: timeRange, preset: preset, onChange: onDateChange, adapter: adapter, peekNextMonth: props.peekNextMonth, excludeDates: props.excludeDates, filterDate: props.filterDate, minDate: minDate, maxDate: maxDate, formatString: props.formatString, locale: props.locale, fixedHeight: props.fixedHeight, monthsShown: monthsShown, hidePresetSearch: hidePresetSearch, footerContent: (0, jsx_runtime_1.jsx)(Footer, tslib_1.__assign({ "$hasError": hasError, "$onSubmit": handleSubmit, "$onClose": props.onClose }, footerProps, { className: ['px-6 py-3 mt-2', footerProps.className] }, { children: (0, jsx_runtime_1.jsxs)(box_1.Box, tslib_1.__assign({ className: "justify-between w-0 grow flex" }, { children: [(0, jsx_runtime_1.jsx)(FooterBeforeEnhancer, tslib_1.__assign({}, footerBeforeEnhancerProps)), (0, jsx_runtime_1.jsxs)(stack_1.Stack, tslib_1.__assign({ direction: monthsShown === 1 ? 'vertical' : 'horizontal', gap: 3, className: monthsShown !== 1 ? 'items-center' : undefined, style: { maxWidth: 'fit-content' } }, { children: [monthsShown === 1 ? null : errorEl, (0, jsx_runtime_1.jsxs)(stack_1.StackItem, tslib_1.__assign({ className: "flex self-end" }, { children: [(footerProps === null || footerProps === void 0 ? void 0 : footerProps.showClearButton) ? ((0, jsx_runtime_1.jsx)(button_1.Button, tslib_1.__assign({ size: "xs", onClick: footerProps.handleClearBtnClick, variant: "secondary", "data-testid": "clear", disabled: timeRange.length === 0 }, { children: locale.timeRangePicker.clearBtnLabel }))) : ((0, jsx_runtime_1.jsx)(button_1.Button, tslib_1.__assign({ size: "xs", onClick: props.onClose, variant: "secondary", "data-testid": "cancel" }, { children: locale.timeRangePicker.cancelBtnLabel }))), (0, jsx_runtime_1.jsx)(button_1.Button, tslib_1.__assign({ size: "xs", className: "ml-3", onClick: handleSubmit, disabled: hasError, "data-testid": "save" }, { children: locale.timeRangePicker.saveBtnLabel }))] })), monthsShown === 1 ? errorEl : null] }))] })) })) }, rangeSelectorProps))] })));
|
|
120
120
|
};
|
|
121
121
|
RangeSelectorContainer.displayName = 'RangeSelectorContainer';
|
|
122
122
|
exports.default = RangeSelectorContainer;
|
|
@@ -24,6 +24,7 @@ export type TimezonePickerProps = {
|
|
|
24
24
|
size?: Size;
|
|
25
25
|
clearable?: boolean;
|
|
26
26
|
placeholder?: string;
|
|
27
|
+
'aria-label'?: string;
|
|
27
28
|
/**
|
|
28
29
|
* When true, filters out deprecated timezone abbreviations (e.g., EST, PST, CET)
|
|
29
30
|
* and shows only modern IANA timezone identifiers (e.g., America/New_York).
|
|
@@ -7,6 +7,7 @@ var button_1 = require("../button");
|
|
|
7
7
|
var stack_1 = require("../stack");
|
|
8
8
|
var typography_1 = require("../typography");
|
|
9
9
|
var popover_1 = require("../popover");
|
|
10
|
+
var popover_2 = require("../baseui/popover");
|
|
10
11
|
/** @deprecated */
|
|
11
12
|
var ActionableTooltip = function (_a) {
|
|
12
13
|
var action = _a.action, renderFooter = _a.renderFooter, content = _a.content, children = _a.children, restProps = tslib_1.__rest(_a, ["action", "renderFooter", "content", "children"]);
|
|
@@ -18,6 +19,6 @@ var ActionableTooltip = function (_a) {
|
|
|
18
19
|
return renderPopoverContent(content({ close: close }));
|
|
19
20
|
}
|
|
20
21
|
: renderPopoverContent(content);
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(popover_1.StatefulPopover, tslib_1.__assign({ content: el, showArrow: true, autoFocus: false, triggerType: "hover" }, restProps, { children: children })));
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(popover_1.StatefulPopover, tslib_1.__assign({ content: el, showArrow: true, autoFocus: false, triggerType: "hover", accessibilityType: popover_2.ACCESSIBILITY_TYPE.tooltip }, restProps, { children: children })));
|
|
22
23
|
};
|
|
23
24
|
exports.default = ActionableTooltip;
|