@sprinklrjs/spaceweb 14.12.2 → 14.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/StatusMessage.d.ts +1 -1
- package/a11y/StatusMessage.js +2 -2
- package/a11y/types.d.ts +5 -0
- package/classNames/index.d.ts +11 -1
- package/classNames/index.js +12 -6
- package/esm/a11y/StatusMessage.d.ts +1 -1
- package/esm/a11y/StatusMessage.js +2 -2
- package/esm/a11y/types.d.ts +5 -0
- package/esm/classNames/index.d.ts +11 -1
- package/esm/classNames/index.js +11 -1
- package/esm/menu/menu-item.js +1 -1
- package/esm/select/overrides.d.ts +3 -5
- package/esm/select/overrides.js +4 -3
- package/esm/snackbar/Snackbar.d.ts +1 -1
- package/esm/snackbar/Snackbar.js +5 -10
- package/esm/snackbar/snackbarContext.d.ts +1 -1
- package/esm/snackbar/snackbarContext.js +7 -2
- package/esm/snackbar/types.d.ts +6 -0
- package/esm/snackbar/useSnackbar.d.ts +2 -1
- package/esm/snackbar/useSnackbar.js +12 -5
- package/esm/style/_parseStyleProp.js +2 -2
- package/esm/tabs/styled-components.d.ts +3 -3
- package/esm/tabs/styled-components.js +4 -1
- package/esm/tabs/tab.js +2 -0
- package/esm/time-range-picker/RangeSelectorContainer.js +3 -1
- package/esm/types.d.ts +1 -1
- package/menu/menu-item.js +1 -1
- package/package.json +3 -3
- package/select/overrides.d.ts +3 -5
- package/select/overrides.js +4 -4
- package/snackbar/Snackbar.d.ts +1 -1
- package/snackbar/Snackbar.js +5 -10
- package/snackbar/snackbarContext.d.ts +1 -1
- package/snackbar/snackbarContext.js +7 -2
- package/snackbar/types.d.ts +6 -0
- package/snackbar/useSnackbar.d.ts +2 -1
- package/snackbar/useSnackbar.js +12 -5
- package/style/_parseStyleProp.js +2 -2
- package/tabs/styled-components.d.ts +3 -3
- package/tabs/styled-components.js +4 -1
- package/tabs/tab.js +2 -0
- package/time-range-picker/RangeSelectorContainer.js +3 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types.d.ts +1 -1
|
@@ -14,15 +14,20 @@ var SnackbarProvider = function (_a) {
|
|
|
14
14
|
var children = _a.children;
|
|
15
15
|
var _b = tslib_1.__read((0, react_1.useState)(''), 2), message = _b[0], setMessage = _b[1];
|
|
16
16
|
var _c = tslib_1.__read((0, react_1.useState)('success'), 2), intent = _c[0], setIntent = _c[1];
|
|
17
|
+
var _d = tslib_1.__read((0, react_1.useState)(0), 2), id = _d[0], setId = _d[1];
|
|
17
18
|
var notify = (0, react_1.useCallback)(function (_a) {
|
|
18
19
|
var _b = _a.intent, _intent = _b === void 0 ? 'success' : _b, _message = _a.message;
|
|
20
|
+
setId(function (prev) { return prev + 1; });
|
|
19
21
|
setMessage(_message);
|
|
20
22
|
setIntent(_intent);
|
|
21
23
|
}, []);
|
|
22
|
-
var onClose = (0, react_1.useCallback)(function () {
|
|
24
|
+
var onClose = (0, react_1.useCallback)(function (reason) {
|
|
25
|
+
// Keep content when swapping instances; only clear on real dismiss.
|
|
26
|
+
if (reason === 'messageChange')
|
|
27
|
+
return;
|
|
23
28
|
setMessage('');
|
|
24
29
|
setIntent('success');
|
|
25
30
|
}, []);
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SnackbarContext.Provider, tslib_1.__assign({ value: notify }, { children: children })), message && intent ? (0, jsx_runtime_1.jsx)(_1.Snackbar, { message: message, intent: intent, onClose: onClose }) : null] }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SnackbarContext.Provider, tslib_1.__assign({ value: notify }, { children: children })), message && intent ? (0, jsx_runtime_1.jsx)(_1.Snackbar, { id: id, message: message, intent: intent, onClose: onClose }) : null] }));
|
|
27
32
|
};
|
|
28
33
|
exports.SnackbarProvider = SnackbarProvider;
|
package/snackbar/types.d.ts
CHANGED
|
@@ -26,6 +26,12 @@ export type SnackbarOverrides = {
|
|
|
26
26
|
};
|
|
27
27
|
export type SnackbarProps = {
|
|
28
28
|
message?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Opaque instance identity. Bump this (e.g. increment a counter) when re-showing
|
|
31
|
+
* the same `message` so the snackbar re-opens and re-announces for screen readers.
|
|
32
|
+
* `SnackbarProvider` / `useNotification` set this automatically on every `notify()`.
|
|
33
|
+
*/
|
|
34
|
+
id?: string | number;
|
|
29
35
|
intent?: Intent;
|
|
30
36
|
hideOnClickAway?: boolean;
|
|
31
37
|
disableManualClose?: boolean;
|
|
@@ -5,6 +5,7 @@ type UseSnackbarParams = {
|
|
|
5
5
|
autoHideDuration: number;
|
|
6
6
|
hideOnClickAway: boolean;
|
|
7
7
|
intent: Intent;
|
|
8
|
+
id?: string | number;
|
|
8
9
|
message?: React.ReactNode;
|
|
9
10
|
onClose?: (reason: HideReason) => void;
|
|
10
11
|
overrides?: SnackbarOverrides;
|
|
@@ -23,5 +24,5 @@ type UseSnackbarReturnValue = {
|
|
|
23
24
|
intent: Intent;
|
|
24
25
|
overrides?: SnackbarOverrides;
|
|
25
26
|
};
|
|
26
|
-
declare const useSnackbar: ({ autoHide, autoHideDuration, hideOnClickAway, intent: nextIntent, message: nextMessage, onClose, overrides: nextOverrides, }: UseSnackbarParams) => UseSnackbarReturnValue;
|
|
27
|
+
declare const useSnackbar: ({ autoHide, autoHideDuration, hideOnClickAway, intent: nextIntent, id, message: nextMessage, onClose, overrides: nextOverrides, }: UseSnackbarParams) => UseSnackbarReturnValue;
|
|
27
28
|
export default useSnackbar;
|
package/snackbar/useSnackbar.js
CHANGED
|
@@ -35,10 +35,10 @@ var useAutoHide = function (_a) {
|
|
|
35
35
|
}, [open, autoHide, autoHideDuration, autoHideTimeoutRef]);
|
|
36
36
|
};
|
|
37
37
|
var useDomVisibility = function (_a) {
|
|
38
|
-
var message = _a.message, open = _a.open, enter = _a.enter, handleClose = _a.handleClose, intent = _a.intent;
|
|
38
|
+
var message = _a.message, open = _a.open, enter = _a.enter, handleClose = _a.handleClose, intent = _a.intent, id = _a.id;
|
|
39
39
|
var _b = tslib_1.__read((0, react_1.useState)(false), 2), domVisibility = _b[0], setDomVisibility = _b[1];
|
|
40
40
|
var removeFromDomTimeoutRef = (0, react_1.useRef)();
|
|
41
|
-
// handle exit, enter on message change
|
|
41
|
+
// handle exit, enter on message / intent / id change
|
|
42
42
|
(0, react_1.useEffect)(function () {
|
|
43
43
|
if (!message)
|
|
44
44
|
return undefined;
|
|
@@ -53,7 +53,7 @@ var useDomVisibility = function (_a) {
|
|
|
53
53
|
open && handleClose('messageChange');
|
|
54
54
|
return function () { return window.clearTimeout(timeoutId); };
|
|
55
55
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- handleClose not required
|
|
56
|
-
}, [message, intent]);
|
|
56
|
+
}, [message, intent, id]);
|
|
57
57
|
// remove from DOM, once transition is over
|
|
58
58
|
(0, useUpdateEffect_1.default)(function () {
|
|
59
59
|
if (open)
|
|
@@ -66,7 +66,7 @@ var useDomVisibility = function (_a) {
|
|
|
66
66
|
return domVisibility;
|
|
67
67
|
};
|
|
68
68
|
var useSnackbar = function (_a) {
|
|
69
|
-
var autoHide = _a.autoHide, autoHideDuration = _a.autoHideDuration, hideOnClickAway = _a.hideOnClickAway, nextIntent = _a.intent, nextMessage = _a.message, onClose = _a.onClose, nextOverrides = _a.overrides;
|
|
69
|
+
var autoHide = _a.autoHide, autoHideDuration = _a.autoHideDuration, hideOnClickAway = _a.hideOnClickAway, nextIntent = _a.intent, id = _a.id, nextMessage = _a.message, onClose = _a.onClose, nextOverrides = _a.overrides;
|
|
70
70
|
var _b = tslib_1.__read((0, react_1.useState)(false), 2), open = _b[0], setOpen = _b[1];
|
|
71
71
|
var _c = tslib_1.__read((0, react_1.useState)({
|
|
72
72
|
intent: nextIntent,
|
|
@@ -91,7 +91,14 @@ var useSnackbar = function (_a) {
|
|
|
91
91
|
};
|
|
92
92
|
useAutoHide({ open: open, handleClose: handleClose, autoHideTimeoutRef: autoHideTimeoutRef, autoHideDuration: autoHideDuration, autoHide: autoHide });
|
|
93
93
|
var snackbarContainerRef = useHideOnClickAway({ hideOnClickAway: hideOnClickAway, handleClose: handleClose, open: open });
|
|
94
|
-
var shouldRender = useDomVisibility({
|
|
94
|
+
var shouldRender = useDomVisibility({
|
|
95
|
+
handleClose: handleClose,
|
|
96
|
+
open: open,
|
|
97
|
+
intent: nextIntent,
|
|
98
|
+
id: id,
|
|
99
|
+
message: nextMessage,
|
|
100
|
+
enter: enter,
|
|
101
|
+
});
|
|
95
102
|
var handleMouseEnter = function () {
|
|
96
103
|
window.clearTimeout(autoHideTimeoutRef.current);
|
|
97
104
|
};
|
package/style/_parseStyleProp.js
CHANGED
|
@@ -22,10 +22,10 @@ var resolveStyleObjects = function (flattenStyles, _a) {
|
|
|
22
22
|
utils: utils,
|
|
23
23
|
styletronCss: styletronCss,
|
|
24
24
|
props: props,
|
|
25
|
-
}), 2),
|
|
25
|
+
}), 2), classNames_1 = _c[0], styletronClassNames_1 = _c[1];
|
|
26
26
|
// save computation if `debugCssInJs` is not enabled
|
|
27
27
|
return [
|
|
28
|
-
"".concat(mergedClassnames, " ").concat(
|
|
28
|
+
"".concat(mergedClassnames, " ").concat(classNames_1),
|
|
29
29
|
utils.debugCssInJs ? "".concat(cssInJsClassNames, " ").concat(styletronClassNames_1) : cssInJsClassNames,
|
|
30
30
|
];
|
|
31
31
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { SharedPropsTabs } from './types';
|
|
2
|
-
import type { ClassName,
|
|
1
|
+
import type { SharedPropsTab, SharedPropsTabs } from './types';
|
|
2
|
+
import type { ClassName, StyleFn } from '../types';
|
|
3
3
|
export declare const tabsStyles: (_: any, { $variant, $position }: SharedPropsTabs) => string;
|
|
4
4
|
export declare const tabStyle: ClassName;
|
|
5
|
-
export declare const tabUnderlineStyles:
|
|
5
|
+
export declare const tabUnderlineStyles: StyleFn<SharedPropsTab>;
|
|
6
6
|
export declare const StyledTabsPanel: import("../style").StyledComponent;
|
|
7
7
|
export declare const StyledRoot: import("../style").StyledComponent;
|
|
8
8
|
export declare const StyledIconContainer: import("../style").StyledComponent;
|
|
@@ -39,6 +39,7 @@ var tabStyle = function (_, _a) {
|
|
|
39
39
|
$position === 'top' ? 'mx-4' : '',
|
|
40
40
|
$position === 'left' ? 'mt-3 mb-3' : '',
|
|
41
41
|
$position === 'right' ? 'mt-3 mb-3' : '',
|
|
42
|
+
// @ts-ignore -- theme overrides
|
|
42
43
|
getTabStyleOverride,
|
|
43
44
|
];
|
|
44
45
|
}
|
|
@@ -52,6 +53,7 @@ var tabStyle = function (_, _a) {
|
|
|
52
53
|
$position === 'top' ? 'mx-4' : '',
|
|
53
54
|
$position === 'left' ? 'mt-3 mb-3' : '',
|
|
54
55
|
$position === 'right' ? 'mt-3 mb-3' : '',
|
|
56
|
+
// @ts-ignore -- theme overrides
|
|
55
57
|
getTabStyleOverride,
|
|
56
58
|
];
|
|
57
59
|
}
|
|
@@ -66,7 +68,6 @@ var tabStyle = function (_, _a) {
|
|
|
66
68
|
};
|
|
67
69
|
exports.tabStyle = tabStyle;
|
|
68
70
|
// Adds an underline element for selected tab
|
|
69
|
-
// @ts-ignore -- '::after' pseudo-element is not in type CSSProperties but is valid here
|
|
70
71
|
var tabUnderlineStyles = function (_a, _b) {
|
|
71
72
|
var theme = _a.theme;
|
|
72
73
|
var $variant = _b.$variant, $position = _b.$position, $selected = _b.$selected, $disabled = _b.$disabled;
|
|
@@ -84,8 +85,10 @@ var tabUnderlineStyles = function (_a, _b) {
|
|
|
84
85
|
},
|
|
85
86
|
}); };
|
|
86
87
|
if ($variant === 'default' && $position === 'top') {
|
|
88
|
+
// eslint-disable-next-line @sprinklrjs/hds-no-use-css-in-js -- No current alternatives
|
|
87
89
|
if ($selected)
|
|
88
90
|
return tslib_1.__assign(tslib_1.__assign({}, underlineStyle(theme.spr.borderQuinary)), { __useCssInJs: 1 });
|
|
91
|
+
// eslint-disable-next-line @sprinklrjs/hds-no-use-css-in-js -- No current alternatives
|
|
89
92
|
if (!$disabled)
|
|
90
93
|
return { ':hover': underlineStyle(theme.spr.borderQuaternary), __useCssInJs: 1 };
|
|
91
94
|
}
|
package/tabs/tab.js
CHANGED
|
@@ -28,6 +28,8 @@ var Tab = function (props) {
|
|
|
28
28
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
29
29
|
}, [onChange, onClick, tabId]);
|
|
30
30
|
var _className = (0, react_1.useMemo)(function () { return [helpers_2.resetStyles, styled_components_1.tabStyle, className]; }, [className]);
|
|
31
|
+
// eslint-disable-next-line @sprinklrjs/no-ts-ignores -- No current alternatives
|
|
32
|
+
// @ts-ignore -- CSS-in-JS -- Styletron styles used for the underline
|
|
31
33
|
var _style = (0, react_1.useMemo)(function () { return [styled_components_1.tabUnderlineStyles, style]; }, [style]);
|
|
32
34
|
return ((0, jsx_runtime_1.jsx)(TabComp, tslib_1.__assign({ "data-spaceweb": "tab", role: "tab", "aria-selected": _selected,
|
|
33
35
|
// id should not be passed to DOM.
|
|
@@ -116,7 +116,9 @@ 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,
|
|
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,
|
|
120
|
+
// @ts-ignore -- CSS-in-JS
|
|
121
|
+
className: [(0, classNames_1.default)({ 'items-center': monthsShown !== 1 }), { 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
122
|
};
|
|
121
123
|
RangeSelectorContainer.displayName = 'RangeSelectorContainer';
|
|
122
124
|
exports.default = RangeSelectorContainer;
|