@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
package/a11y/StatusMessage.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StatusMessageProps } from './types';
|
|
2
2
|
export declare const StatusMessage: {
|
|
3
|
-
({ children, politeness, timeout }: StatusMessageProps): null;
|
|
3
|
+
({ children, politeness, timeout, id }: StatusMessageProps): null;
|
|
4
4
|
displayName: string;
|
|
5
5
|
__standard: string;
|
|
6
6
|
};
|
package/a11y/StatusMessage.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.StatusMessage = void 0;
|
|
|
4
4
|
var react_1 = require("react");
|
|
5
5
|
var LiveAnnouncer_1 = require("./LiveAnnouncer");
|
|
6
6
|
var StatusMessage = function (_a) {
|
|
7
|
-
var children = _a.children, politeness = _a.politeness, timeout = _a.timeout;
|
|
7
|
+
var children = _a.children, politeness = _a.politeness, timeout = _a.timeout, id = _a.id;
|
|
8
8
|
(0, react_1.useEffect)(function () {
|
|
9
9
|
if (children) {
|
|
10
10
|
(0, LiveAnnouncer_1.announce)(children, { politeness: politeness, timeout: timeout });
|
|
11
11
|
}
|
|
12
|
-
}, [children, politeness, timeout]);
|
|
12
|
+
}, [children, politeness, timeout, id]);
|
|
13
13
|
return null;
|
|
14
14
|
};
|
|
15
15
|
exports.StatusMessage = StatusMessage;
|
package/a11y/types.d.ts
CHANGED
|
@@ -20,4 +20,9 @@ export type StatusMessageProps = AnnounceOptions & {
|
|
|
20
20
|
* visible output and adds nothing to the layout.
|
|
21
21
|
*/
|
|
22
22
|
children?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Opaque instance identity. Bump this when re-announcing the same `children`
|
|
25
|
+
* string (e.g. increment a counter on each copy action).
|
|
26
|
+
*/
|
|
27
|
+
id?: string | number;
|
|
23
28
|
};
|
package/classNames/index.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import baseClassnames from 'classnames';
|
|
2
|
+
/**
|
|
3
|
+
* classNames is a merging utility for class names.
|
|
4
|
+
* When importing, please import as `cx` or `classNames`.
|
|
5
|
+
* @warning This is NOT the same as the `css` themes utility.
|
|
6
|
+
* `css` is provided by the useStyle() hook and can handle CSS-in-JS, functions, and CSSProperties.
|
|
7
|
+
* `cx` **cannot** handle these, and will not work with functions or StyleObjects!
|
|
8
|
+
* @see https://github.com/JedWatson/classnames?tab=readme-ov-file#usage
|
|
9
|
+
*/
|
|
10
|
+
declare const documentedClassnames: typeof baseClassnames;
|
|
11
|
+
export default documentedClassnames;
|
package/classNames/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
var classnames_1 = require("classnames");
|
|
8
|
-
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
5
|
+
/**
|
|
6
|
+
* classNames is a merging utility for class names.
|
|
7
|
+
* When importing, please import as `cx` or `classNames`.
|
|
8
|
+
* @warning This is NOT the same as the `css` themes utility.
|
|
9
|
+
* `css` is provided by the useStyle() hook and can handle CSS-in-JS, functions, and CSSProperties.
|
|
10
|
+
* `cx` **cannot** handle these, and will not work with functions or StyleObjects!
|
|
11
|
+
* @see https://github.com/JedWatson/classnames?tab=readme-ov-file#usage
|
|
12
|
+
*/
|
|
13
|
+
var documentedClassnames = classnames_1.default;
|
|
14
|
+
exports.default = documentedClassnames;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StatusMessageProps } from './types';
|
|
2
2
|
export declare const StatusMessage: {
|
|
3
|
-
({ children, politeness, timeout }: StatusMessageProps): null;
|
|
3
|
+
({ children, politeness, timeout, id }: StatusMessageProps): null;
|
|
4
4
|
displayName: string;
|
|
5
5
|
__standard: string;
|
|
6
6
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { announce } from './LiveAnnouncer';
|
|
3
3
|
export var StatusMessage = function (_a) {
|
|
4
|
-
var children = _a.children, politeness = _a.politeness, timeout = _a.timeout;
|
|
4
|
+
var children = _a.children, politeness = _a.politeness, timeout = _a.timeout, id = _a.id;
|
|
5
5
|
useEffect(function () {
|
|
6
6
|
if (children) {
|
|
7
7
|
announce(children, { politeness: politeness, timeout: timeout });
|
|
8
8
|
}
|
|
9
|
-
}, [children, politeness, timeout]);
|
|
9
|
+
}, [children, politeness, timeout, id]);
|
|
10
10
|
return null;
|
|
11
11
|
};
|
|
12
12
|
StatusMessage.displayName = 'StatusMessage';
|
package/esm/a11y/types.d.ts
CHANGED
|
@@ -20,4 +20,9 @@ export type StatusMessageProps = AnnounceOptions & {
|
|
|
20
20
|
* visible output and adds nothing to the layout.
|
|
21
21
|
*/
|
|
22
22
|
children?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Opaque instance identity. Bump this when re-announcing the same `children`
|
|
25
|
+
* string (e.g. increment a counter on each copy action).
|
|
26
|
+
*/
|
|
27
|
+
id?: string | number;
|
|
23
28
|
};
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import baseClassnames from 'classnames';
|
|
2
|
+
/**
|
|
3
|
+
* classNames is a merging utility for class names.
|
|
4
|
+
* When importing, please import as `cx` or `classNames`.
|
|
5
|
+
* @warning This is NOT the same as the `css` themes utility.
|
|
6
|
+
* `css` is provided by the useStyle() hook and can handle CSS-in-JS, functions, and CSSProperties.
|
|
7
|
+
* `cx` **cannot** handle these, and will not work with functions or StyleObjects!
|
|
8
|
+
* @see https://github.com/JedWatson/classnames?tab=readme-ov-file#usage
|
|
9
|
+
*/
|
|
10
|
+
declare const documentedClassnames: typeof baseClassnames;
|
|
11
|
+
export default documentedClassnames;
|
package/esm/classNames/index.js
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import baseClassnames from 'classnames';
|
|
2
|
+
/**
|
|
3
|
+
* classNames is a merging utility for class names.
|
|
4
|
+
* When importing, please import as `cx` or `classNames`.
|
|
5
|
+
* @warning This is NOT the same as the `css` themes utility.
|
|
6
|
+
* `css` is provided by the useStyle() hook and can handle CSS-in-JS, functions, and CSSProperties.
|
|
7
|
+
* `cx` **cannot** handle these, and will not work with functions or StyleObjects!
|
|
8
|
+
* @see https://github.com/JedWatson/classnames?tab=readme-ov-file#usage
|
|
9
|
+
*/
|
|
10
|
+
var documentedClassnames = baseClassnames;
|
|
11
|
+
export default documentedClassnames;
|
package/esm/menu/menu-item.js
CHANGED
|
@@ -81,7 +81,7 @@ function MenuActionContainer(_a) {
|
|
|
81
81
|
// Only show actions that are always visible or whose parent item is highlighted
|
|
82
82
|
className: [
|
|
83
83
|
index === 0 ? 'ml-0' : 'ml-1',
|
|
84
|
-
alwaysVisible || sharedProps.$highlighted ? 'visible' : 'invisible w-0 ml-0',
|
|
84
|
+
alwaysVisible || sharedProps.$highlighted ? 'visible' : 'invisible w-0 overflow-hidden ml-0',
|
|
85
85
|
] }, { children: React.cloneElement(actionEl, { tabIndex: -1 }) }), (_a = actionEl.key) !== null && _a !== void 0 ? _a : "menu-action-".concat(index)));
|
|
86
86
|
}) })));
|
|
87
87
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
2
|
import type { ClassName, ClassNameStyleFn, Styles } from '../types';
|
|
3
3
|
import type { SharedProps } from './types';
|
|
4
4
|
export declare const SelectArrow: ({ $isOpen, title, overrides: _overrides, ...restProps }: {
|
|
@@ -6,7 +6,7 @@ export declare const SelectArrow: ({ $isOpen, title, overrides: _overrides, ...r
|
|
|
6
6
|
$isOpen: any;
|
|
7
7
|
title: any;
|
|
8
8
|
overrides: any;
|
|
9
|
-
}) =>
|
|
9
|
+
}) => ReactElement;
|
|
10
10
|
export declare const getSearchIconContainerStyles: ClassName;
|
|
11
11
|
export declare const getSearchIconStyles: ClassNameStyleFn<SharedProps>;
|
|
12
12
|
export declare const getControlContainerStyles: ClassName;
|
|
@@ -18,9 +18,7 @@ export declare const OverlaySelectPopoverOverride: ({ content, children: inputCo
|
|
|
18
18
|
closePopover: any;
|
|
19
19
|
setStickySentinelRef: any;
|
|
20
20
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export declare const SingleValueTombstone: (
|
|
22
|
-
$selectSize: any;
|
|
23
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const SingleValueTombstone: import("react").ForwardRefExoticComponent<Pick<SharedProps, "$selectSize"> & import("react").RefAttributes<HTMLElement>>;
|
|
24
22
|
export declare const selectMenuOverrides: {
|
|
25
23
|
readonly Menu: {
|
|
26
24
|
readonly props: {
|
package/esm/select/overrides.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
3
4
|
import { getComponentSizeTheme, getDefaultSize } from '../helpers/themeHelpers';
|
|
4
5
|
import ChevronDown from '../icon/components/chevron-down';
|
|
5
6
|
import { borderRadius as borderRadiusLongHandHelper } from '../helpers/longHandHelpers';
|
|
@@ -159,17 +160,17 @@ export var OverlaySelectPopoverOverride = function (_a) {
|
|
|
159
160
|
var content = _a.content, inputContainer = _a.children, closePopover = _a.closePopover, setStickySentinelRef = _a.setStickySentinelRef;
|
|
160
161
|
return (_jsxs(_Fragment, { children: [_jsx(Box, { ref: setStickySentinelRef }), inputContainer, typeof content === 'function' ? content({ closeMenu: closePopover }) : content] }));
|
|
161
162
|
};
|
|
162
|
-
export var SingleValueTombstone = function (_a) {
|
|
163
|
+
export var SingleValueTombstone = forwardRef(function (_a, ref) {
|
|
163
164
|
var $selectSize = _a.$selectSize;
|
|
164
165
|
var theme = useStyle().theme;
|
|
165
166
|
var defaultHeightClass = $selectSize === 'xxxs' ? 'h-4' : 'h-4.5';
|
|
166
167
|
var inputSizeTheme = getComponentSizeTheme(theme, 'input', $selectSize, getDefaultSize(theme));
|
|
167
|
-
return (_jsx(StyledTombstone, { "data-testid": "single-value-tombstone", className: [
|
|
168
|
+
return (_jsx(StyledTombstone, { ref: ref, "data-testid": "single-value-tombstone", className: [
|
|
168
169
|
"w-24 rounded-8 ".concat(defaultHeightClass),
|
|
169
170
|
//@ts-ignore -- theme override
|
|
170
171
|
(inputSizeTheme === null || inputSizeTheme === void 0 ? void 0 : inputSizeTheme.lineHeight) ? { height: inputSizeTheme === null || inputSizeTheme === void 0 ? void 0 : inputSizeTheme.lineHeight } : {},
|
|
171
172
|
] }));
|
|
172
|
-
};
|
|
173
|
+
});
|
|
173
174
|
export var selectMenuOverrides = {
|
|
174
175
|
Menu: {
|
|
175
176
|
props: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { SnackbarProps } from './types';
|
|
3
3
|
declare const Snackbar: {
|
|
4
|
-
({ intent: _intent, message: _message, disableManualClose, placement, autoHide, autoHideDuration, hideOnClickAway, overrides: _overrides, onClose, }: SnackbarProps): ReactElement | null;
|
|
4
|
+
({ intent: _intent, message: _message, id, disableManualClose, placement, autoHide, autoHideDuration, hideOnClickAway, overrides: _overrides, onClose, }: SnackbarProps): ReactElement | null;
|
|
5
5
|
__standard: string;
|
|
6
6
|
};
|
|
7
7
|
export default Snackbar;
|
package/esm/snackbar/Snackbar.js
CHANGED
|
@@ -19,11 +19,12 @@ import { useLocale } from '../locale';
|
|
|
19
19
|
import { useStyle } from '../style';
|
|
20
20
|
import { ThemeProvider } from '../theme';
|
|
21
21
|
var Snackbar = function (_a) {
|
|
22
|
-
var _b = _a.intent, _intent = _b === void 0 ? 'success' : _b, _message = _a.message, _c = _a.disableManualClose, disableManualClose = _c === void 0 ? false : _c, _d = _a.placement, placement = _d === void 0 ? 'bottom' : _d, _e = _a.autoHide, autoHide = _e === void 0 ? true : _e, _f = _a.autoHideDuration, autoHideDuration = _f === void 0 ? TYPE_TO_HIDE_DURATION[_intent] : _f, _g = _a.hideOnClickAway, hideOnClickAway = _g === void 0 ? true : _g, _overrides = _a.overrides, _h = _a.onClose, onClose = _h === void 0 ? _noop : _h;
|
|
22
|
+
var _b = _a.intent, _intent = _b === void 0 ? 'success' : _b, _message = _a.message, id = _a.id, _c = _a.disableManualClose, disableManualClose = _c === void 0 ? false : _c, _d = _a.placement, placement = _d === void 0 ? 'bottom' : _d, _e = _a.autoHide, autoHide = _e === void 0 ? true : _e, _f = _a.autoHideDuration, autoHideDuration = _f === void 0 ? TYPE_TO_HIDE_DURATION[_intent] : _f, _g = _a.hideOnClickAway, hideOnClickAway = _g === void 0 ? true : _g, _overrides = _a.overrides, _h = _a.onClose, onClose = _h === void 0 ? _noop : _h;
|
|
23
23
|
var outerTheme = useStyle().theme;
|
|
24
24
|
var inverseTheme = useMemo(function () { return (isDarkTheme(outerTheme) ? hyperspaceLight : hyperspaceDark); }, [outerTheme]);
|
|
25
25
|
var _j = useSnackbar({
|
|
26
26
|
intent: _intent,
|
|
27
|
+
id: id,
|
|
27
28
|
message: _message,
|
|
28
29
|
overrides: _overrides,
|
|
29
30
|
autoHide: autoHide,
|
|
@@ -52,18 +53,12 @@ var Snackbar = function (_a) {
|
|
|
52
53
|
var _s = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.CloseIcon, CloseIcon), 2), Close = _s[0], closeProps = _s[1];
|
|
53
54
|
var _t = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.CloseIconButton, IconButton), 2), CloseIconButton = _t[0], closeIconButtonProps = _t[1];
|
|
54
55
|
var locale = useLocale();
|
|
55
|
-
var role = INTENT_TO_ROLE[intent];
|
|
56
|
-
// We don't know if the message contains any interactive elements, so we only
|
|
57
|
-
// delegate to the shared screen-reader announcer when the message is a string.
|
|
58
56
|
var isStringMessage = typeof message === 'string';
|
|
59
|
-
// Announce string messages through the shared global live region instead of
|
|
60
|
-
// hand-rolling sr-only regions here. The announcer keeps a single source of
|
|
61
|
-
// truth for status messages (WCAG 4.1.3) and re-announces repeated text.
|
|
62
57
|
useEffect(function () {
|
|
63
|
-
if (
|
|
64
|
-
announce(
|
|
58
|
+
if (typeof _message === 'string' && _message) {
|
|
59
|
+
announce(_message, { politeness: INTENT_TO_ROLE[_intent] === 'alert' ? 'assertive' : 'polite' });
|
|
65
60
|
}
|
|
66
|
-
}, [
|
|
61
|
+
}, [_message, _intent, id]);
|
|
67
62
|
return (_jsx(_Fragment, { children: shouldRender ? (_jsx(LayersManager, __assign({ zIndex: Z_INDEX.SNACKBAR }, { children: _jsx(Layer, __assign({}, sharedProps, layerProps, { children: _jsx(PlacementContainer, __assign({ "data-spaceweb": "snackbar", "data-testid": "snackbar" }, sharedProps, placementContainerProps, { children: _jsx(SnackbarContainer, __assign({}, snackbarContainerProps, { ref: snackbarContainerRef }, sharedProps, snackbarContainerOverrideProps, { style: [getSnackbarContainerAnimationStyle, snackbarContainerOverrideProps.style] }, { children: _jsx(ThemeProvider, __assign({ theme: inverseTheme }, { children: _jsxs(ContentContainer, __assign({}, sharedProps, contentContainerProps, { children: [_jsx(IconsContainer, __assign({}, sharedProps, iconsContainerProps, { children: _jsx(IntentIcon, __assign({ size: 20, className: getIconStyles }, sharedProps, intentIconProps)) })), _jsx(Message
|
|
68
63
|
// The sr-only region handles screen reader announcements
|
|
69
64
|
// to prevent the message from being read twice
|
|
@@ -10,14 +10,19 @@ export var SnackbarProvider = function (_a) {
|
|
|
10
10
|
var children = _a.children;
|
|
11
11
|
var _b = __read(useState(''), 2), message = _b[0], setMessage = _b[1];
|
|
12
12
|
var _c = __read(useState('success'), 2), intent = _c[0], setIntent = _c[1];
|
|
13
|
+
var _d = __read(useState(0), 2), id = _d[0], setId = _d[1];
|
|
13
14
|
var notify = useCallback(function (_a) {
|
|
14
15
|
var _b = _a.intent, _intent = _b === void 0 ? 'success' : _b, _message = _a.message;
|
|
16
|
+
setId(function (prev) { return prev + 1; });
|
|
15
17
|
setMessage(_message);
|
|
16
18
|
setIntent(_intent);
|
|
17
19
|
}, []);
|
|
18
|
-
var onClose = useCallback(function () {
|
|
20
|
+
var onClose = useCallback(function (reason) {
|
|
21
|
+
// Keep content when swapping instances; only clear on real dismiss.
|
|
22
|
+
if (reason === 'messageChange')
|
|
23
|
+
return;
|
|
19
24
|
setMessage('');
|
|
20
25
|
setIntent('success');
|
|
21
26
|
}, []);
|
|
22
|
-
return (_jsxs(_Fragment, { children: [_jsx(SnackbarContext.Provider, __assign({ value: notify }, { children: children })), message && intent ? _jsx(Snackbar, { message: message, intent: intent, onClose: onClose }) : null] }));
|
|
27
|
+
return (_jsxs(_Fragment, { children: [_jsx(SnackbarContext.Provider, __assign({ value: notify }, { children: children })), message && intent ? _jsx(Snackbar, { id: id, message: message, intent: intent, onClose: onClose }) : null] }));
|
|
23
28
|
};
|
package/esm/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;
|
|
@@ -33,10 +33,10 @@ var useAutoHide = function (_a) {
|
|
|
33
33
|
}, [open, autoHide, autoHideDuration, autoHideTimeoutRef]);
|
|
34
34
|
};
|
|
35
35
|
var useDomVisibility = function (_a) {
|
|
36
|
-
var message = _a.message, open = _a.open, enter = _a.enter, handleClose = _a.handleClose, intent = _a.intent;
|
|
36
|
+
var message = _a.message, open = _a.open, enter = _a.enter, handleClose = _a.handleClose, intent = _a.intent, id = _a.id;
|
|
37
37
|
var _b = __read(useState(false), 2), domVisibility = _b[0], setDomVisibility = _b[1];
|
|
38
38
|
var removeFromDomTimeoutRef = useRef();
|
|
39
|
-
// handle exit, enter on message change
|
|
39
|
+
// handle exit, enter on message / intent / id change
|
|
40
40
|
useEffect(function () {
|
|
41
41
|
if (!message)
|
|
42
42
|
return undefined;
|
|
@@ -51,7 +51,7 @@ var useDomVisibility = function (_a) {
|
|
|
51
51
|
open && handleClose('messageChange');
|
|
52
52
|
return function () { return window.clearTimeout(timeoutId); };
|
|
53
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- handleClose not required
|
|
54
|
-
}, [message, intent]);
|
|
54
|
+
}, [message, intent, id]);
|
|
55
55
|
// remove from DOM, once transition is over
|
|
56
56
|
useUpdateEffect(function () {
|
|
57
57
|
if (open)
|
|
@@ -64,7 +64,7 @@ var useDomVisibility = function (_a) {
|
|
|
64
64
|
return domVisibility;
|
|
65
65
|
};
|
|
66
66
|
var useSnackbar = function (_a) {
|
|
67
|
-
var autoHide = _a.autoHide, autoHideDuration = _a.autoHideDuration, hideOnClickAway = _a.hideOnClickAway, nextIntent = _a.intent, nextMessage = _a.message, onClose = _a.onClose, nextOverrides = _a.overrides;
|
|
67
|
+
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;
|
|
68
68
|
var _b = __read(useState(false), 2), open = _b[0], setOpen = _b[1];
|
|
69
69
|
var _c = __read(useState({
|
|
70
70
|
intent: nextIntent,
|
|
@@ -89,7 +89,14 @@ var useSnackbar = function (_a) {
|
|
|
89
89
|
};
|
|
90
90
|
useAutoHide({ open: open, handleClose: handleClose, autoHideTimeoutRef: autoHideTimeoutRef, autoHideDuration: autoHideDuration, autoHide: autoHide });
|
|
91
91
|
var snackbarContainerRef = useHideOnClickAway({ hideOnClickAway: hideOnClickAway, handleClose: handleClose, open: open });
|
|
92
|
-
var shouldRender = useDomVisibility({
|
|
92
|
+
var shouldRender = useDomVisibility({
|
|
93
|
+
handleClose: handleClose,
|
|
94
|
+
open: open,
|
|
95
|
+
intent: nextIntent,
|
|
96
|
+
id: id,
|
|
97
|
+
message: nextMessage,
|
|
98
|
+
enter: enter,
|
|
99
|
+
});
|
|
93
100
|
var handleMouseEnter = function () {
|
|
94
101
|
window.clearTimeout(autoHideTimeoutRef.current);
|
|
95
102
|
};
|
|
@@ -19,10 +19,10 @@ var resolveStyleObjects = function (flattenStyles, _a) {
|
|
|
19
19
|
utils: utils,
|
|
20
20
|
styletronCss: styletronCss,
|
|
21
21
|
props: props,
|
|
22
|
-
}), 2),
|
|
22
|
+
}), 2), classNames_1 = _c[0], styletronClassNames_1 = _c[1];
|
|
23
23
|
// save computation if `debugCssInJs` is not enabled
|
|
24
24
|
return [
|
|
25
|
-
"".concat(mergedClassnames, " ").concat(
|
|
25
|
+
"".concat(mergedClassnames, " ").concat(classNames_1),
|
|
26
26
|
utils.debugCssInJs ? "".concat(cssInJsClassNames, " ").concat(styletronClassNames_1) : cssInJsClassNames,
|
|
27
27
|
];
|
|
28
28
|
}
|
|
@@ -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;
|
|
@@ -35,6 +35,7 @@ export var tabStyle = function (_, _a) {
|
|
|
35
35
|
$position === 'top' ? 'mx-4' : '',
|
|
36
36
|
$position === 'left' ? 'mt-3 mb-3' : '',
|
|
37
37
|
$position === 'right' ? 'mt-3 mb-3' : '',
|
|
38
|
+
// @ts-ignore -- theme overrides
|
|
38
39
|
getTabStyleOverride,
|
|
39
40
|
];
|
|
40
41
|
}
|
|
@@ -48,6 +49,7 @@ export var tabStyle = function (_, _a) {
|
|
|
48
49
|
$position === 'top' ? 'mx-4' : '',
|
|
49
50
|
$position === 'left' ? 'mt-3 mb-3' : '',
|
|
50
51
|
$position === 'right' ? 'mt-3 mb-3' : '',
|
|
52
|
+
// @ts-ignore -- theme overrides
|
|
51
53
|
getTabStyleOverride,
|
|
52
54
|
];
|
|
53
55
|
}
|
|
@@ -61,7 +63,6 @@ export var tabStyle = function (_, _a) {
|
|
|
61
63
|
});
|
|
62
64
|
};
|
|
63
65
|
// Adds an underline element for selected tab
|
|
64
|
-
// @ts-ignore -- '::after' pseudo-element is not in type CSSProperties but is valid here
|
|
65
66
|
export var tabUnderlineStyles = function (_a, _b) {
|
|
66
67
|
var theme = _a.theme;
|
|
67
68
|
var $variant = _b.$variant, $position = _b.$position, $selected = _b.$selected, $disabled = _b.$disabled;
|
|
@@ -79,8 +80,10 @@ export var tabUnderlineStyles = function (_a, _b) {
|
|
|
79
80
|
},
|
|
80
81
|
}); };
|
|
81
82
|
if ($variant === 'default' && $position === 'top') {
|
|
83
|
+
// eslint-disable-next-line @sprinklrjs/hds-no-use-css-in-js -- No current alternatives
|
|
82
84
|
if ($selected)
|
|
83
85
|
return __assign(__assign({}, underlineStyle(theme.spr.borderQuinary)), { __useCssInJs: 1 });
|
|
86
|
+
// eslint-disable-next-line @sprinklrjs/hds-no-use-css-in-js -- No current alternatives
|
|
84
87
|
if (!$disabled)
|
|
85
88
|
return { ':hover': underlineStyle(theme.spr.borderQuaternary), __useCssInJs: 1 };
|
|
86
89
|
}
|
package/esm/tabs/tab.js
CHANGED
|
@@ -26,6 +26,8 @@ var Tab = function (props) {
|
|
|
26
26
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
27
27
|
}, [onChange, onClick, tabId]);
|
|
28
28
|
var _className = useMemo(function () { return [resetStyles, tabStyle, className]; }, [className]);
|
|
29
|
+
// eslint-disable-next-line @sprinklrjs/no-ts-ignores -- No current alternatives
|
|
30
|
+
// @ts-ignore -- CSS-in-JS -- Styletron styles used for the underline
|
|
29
31
|
var _style = useMemo(function () { return [tabUnderlineStyles, style]; }, [style]);
|
|
30
32
|
return (_jsx(TabComp, __assign({ "data-spaceweb": "tab", role: "tab", "aria-selected": _selected,
|
|
31
33
|
// id should not be passed to DOM.
|
|
@@ -114,7 +114,9 @@ var RangeSelectorContainer = function (_a) {
|
|
|
114
114
|
fill: theme.spr.clrRed,
|
|
115
115
|
});
|
|
116
116
|
} }), _jsx(Typography, __assign({ className: "my-0", variant: "bs3" }, { children: errMsg }))] }))) : null;
|
|
117
|
-
return (_jsxs(Box, __assign({ className: "spr-ui-01 rounded-8" }, { children: [_jsxs(Header, __assign({ "$setTimezone": setTimezone, "$onClose": props.onClose }, headerProps, { children: [_jsx(HeaderBeforeEnhancer, __assign({ variant: "heading-7", "$as": "span", className: "flex items-center" }, headerBeforeEnhancerProps, { children: locale.timeRangePicker.headerLabel })), disableTimezone ? null : (_jsx(TimezonePicker, __assign({ setTimezone: setTimezone, timezone: timezone, timezoneOptions: timezoneOptions }, timezonePickerProps, { className: ['w-0 grow max-w-md', timezonePickerProps === null || timezonePickerProps === void 0 ? void 0 : timezonePickerProps.className] })))] })), _jsx(RangeSelector, __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: _jsx(Footer, __assign({ "$hasError": hasError, "$onSubmit": handleSubmit, "$onClose": props.onClose }, footerProps, { className: ['px-6 py-3 mt-2', footerProps.className] }, { children: _jsxs(Box, __assign({ className: "justify-between w-0 grow flex" }, { children: [_jsx(FooterBeforeEnhancer, __assign({}, footerBeforeEnhancerProps)), _jsxs(Stack, __assign({ direction: monthsShown === 1 ? 'vertical' : 'horizontal', gap: 3,
|
|
117
|
+
return (_jsxs(Box, __assign({ className: "spr-ui-01 rounded-8" }, { children: [_jsxs(Header, __assign({ "$setTimezone": setTimezone, "$onClose": props.onClose }, headerProps, { children: [_jsx(HeaderBeforeEnhancer, __assign({ variant: "heading-7", "$as": "span", className: "flex items-center" }, headerBeforeEnhancerProps, { children: locale.timeRangePicker.headerLabel })), disableTimezone ? null : (_jsx(TimezonePicker, __assign({ setTimezone: setTimezone, timezone: timezone, timezoneOptions: timezoneOptions }, timezonePickerProps, { className: ['w-0 grow max-w-md', timezonePickerProps === null || timezonePickerProps === void 0 ? void 0 : timezonePickerProps.className] })))] })), _jsx(RangeSelector, __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: _jsx(Footer, __assign({ "$hasError": hasError, "$onSubmit": handleSubmit, "$onClose": props.onClose }, footerProps, { className: ['px-6 py-3 mt-2', footerProps.className] }, { children: _jsxs(Box, __assign({ className: "justify-between w-0 grow flex" }, { children: [_jsx(FooterBeforeEnhancer, __assign({}, footerBeforeEnhancerProps)), _jsxs(Stack, __assign({ direction: monthsShown === 1 ? 'vertical' : 'horizontal', gap: 3,
|
|
118
|
+
// @ts-ignore -- CSS-in-JS
|
|
119
|
+
className: [cx({ 'items-center': monthsShown !== 1 }), { maxWidth: 'fit-content' }] }, { children: [monthsShown === 1 ? null : errorEl, _jsxs(StackItem, __assign({ className: "flex self-end" }, { children: [(footerProps === null || footerProps === void 0 ? void 0 : footerProps.showClearButton) ? (_jsx(Button, __assign({ size: "xs", onClick: footerProps.handleClearBtnClick, variant: "secondary", "data-testid": "clear", disabled: timeRange.length === 0 }, { children: locale.timeRangePicker.clearBtnLabel }))) : (_jsx(Button, __assign({ size: "xs", onClick: props.onClose, variant: "secondary", "data-testid": "cancel" }, { children: locale.timeRangePicker.cancelBtnLabel }))), _jsx(Button, __assign({ size: "xs", className: "ml-3", onClick: handleSubmit, disabled: hasError, "data-testid": "save" }, { children: locale.timeRangePicker.saveBtnLabel }))] })), monthsShown === 1 ? errorEl : null] }))] })) })) }, rangeSelectorProps))] })));
|
|
118
120
|
};
|
|
119
121
|
RangeSelectorContainer.displayName = 'RangeSelectorContainer';
|
|
120
122
|
export default RangeSelectorContainer;
|
package/esm/types.d.ts
CHANGED
|
@@ -90,7 +90,7 @@ export type StyleUtils = ThemeContext & {
|
|
|
90
90
|
getStyle: GetStyle;
|
|
91
91
|
px2rem: Px2Rem;
|
|
92
92
|
};
|
|
93
|
-
export type ClassNameStyleFn<P = any> = (utils: StyleUtils, props: P) =>
|
|
93
|
+
export type ClassNameStyleFn<P = any> = (utils: StyleUtils, props: P) => ClassName;
|
|
94
94
|
/**
|
|
95
95
|
* ClassName type for Spaceweb's components
|
|
96
96
|
* See: https://frontend.sprinklr.com/spaceweb/guides/styling#styled
|
package/menu/menu-item.js
CHANGED
|
@@ -83,7 +83,7 @@ function MenuActionContainer(_a) {
|
|
|
83
83
|
// Only show actions that are always visible or whose parent item is highlighted
|
|
84
84
|
className: [
|
|
85
85
|
index === 0 ? 'ml-0' : 'ml-1',
|
|
86
|
-
alwaysVisible || sharedProps.$highlighted ? 'visible' : 'invisible w-0 ml-0',
|
|
86
|
+
alwaysVisible || sharedProps.$highlighted ? 'visible' : 'invisible w-0 overflow-hidden ml-0',
|
|
87
87
|
] }, { children: React.cloneElement(actionEl, { tabIndex: -1 }) }), (_a = actionEl.key) !== null && _a !== void 0 ? _a : "menu-action-".concat(index)));
|
|
88
88
|
}) })));
|
|
89
89
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprinklrjs/spaceweb",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.13.0",
|
|
4
4
|
"description": "Components for SpaceWeb",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"body-scroll-lock": "3.1.5",
|
|
39
39
|
"card-validator": "^6.2.0",
|
|
40
40
|
"class-variance-authority": "^0.7.0",
|
|
41
|
-
"classnames": "2.
|
|
41
|
+
"classnames": "^2.5.1",
|
|
42
42
|
"csstype": "^3.0.2",
|
|
43
43
|
"date-fns": "^2.6.0",
|
|
44
44
|
"date-fns-tz": "^1.2.2",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"ts-node": "^10.4.0"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@sprinklrjs/spaceweb-themes": "14.
|
|
103
|
+
"@sprinklrjs/spaceweb-themes": "14.13.0",
|
|
104
104
|
"react": ">=17.0.2 <19.0.0",
|
|
105
105
|
"react-dom": ">=17.0.2 <19.0.0"
|
|
106
106
|
}
|
package/select/overrides.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
2
|
import type { ClassName, ClassNameStyleFn, Styles } from '../types';
|
|
3
3
|
import type { SharedProps } from './types';
|
|
4
4
|
export declare const SelectArrow: ({ $isOpen, title, overrides: _overrides, ...restProps }: {
|
|
@@ -6,7 +6,7 @@ export declare const SelectArrow: ({ $isOpen, title, overrides: _overrides, ...r
|
|
|
6
6
|
$isOpen: any;
|
|
7
7
|
title: any;
|
|
8
8
|
overrides: any;
|
|
9
|
-
}) =>
|
|
9
|
+
}) => ReactElement;
|
|
10
10
|
export declare const getSearchIconContainerStyles: ClassName;
|
|
11
11
|
export declare const getSearchIconStyles: ClassNameStyleFn<SharedProps>;
|
|
12
12
|
export declare const getControlContainerStyles: ClassName;
|
|
@@ -18,9 +18,7 @@ export declare const OverlaySelectPopoverOverride: ({ content, children: inputCo
|
|
|
18
18
|
closePopover: any;
|
|
19
19
|
setStickySentinelRef: any;
|
|
20
20
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export declare const SingleValueTombstone: (
|
|
22
|
-
$selectSize: any;
|
|
23
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const SingleValueTombstone: import("react").ForwardRefExoticComponent<Pick<SharedProps, "$selectSize"> & import("react").RefAttributes<HTMLElement>>;
|
|
24
22
|
export declare const selectMenuOverrides: {
|
|
25
23
|
readonly Menu: {
|
|
26
24
|
readonly props: {
|
package/select/overrides.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.selectMenuOverrides = exports.SingleValueTombstone = exports.OverlaySelectPopoverOverride = exports.getValueTypography = exports.getValueContainerStyles = exports.getControlContainerStyles = exports.getSearchIconStyles = exports.getSearchIconContainerStyles = exports.SelectArrow = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var react_1 = require("react");
|
|
6
7
|
var themeHelpers_1 = require("../helpers/themeHelpers");
|
|
7
8
|
var chevron_down_1 = tslib_1.__importDefault(require("../icon/components/chevron-down"));
|
|
8
9
|
var longHandHelpers_1 = require("../helpers/longHandHelpers");
|
|
@@ -165,18 +166,17 @@ var OverlaySelectPopoverOverride = function (_a) {
|
|
|
165
166
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(box_1.Box, { ref: setStickySentinelRef }), inputContainer, typeof content === 'function' ? content({ closeMenu: closePopover }) : content] }));
|
|
166
167
|
};
|
|
167
168
|
exports.OverlaySelectPopoverOverride = OverlaySelectPopoverOverride;
|
|
168
|
-
|
|
169
|
+
exports.SingleValueTombstone = (0, react_1.forwardRef)(function (_a, ref) {
|
|
169
170
|
var $selectSize = _a.$selectSize;
|
|
170
171
|
var theme = (0, style_1.useStyle)().theme;
|
|
171
172
|
var defaultHeightClass = $selectSize === 'xxxs' ? 'h-4' : 'h-4.5';
|
|
172
173
|
var inputSizeTheme = (0, themeHelpers_1.getComponentSizeTheme)(theme, 'input', $selectSize, (0, themeHelpers_1.getDefaultSize)(theme));
|
|
173
|
-
return ((0, jsx_runtime_1.jsx)(StyledTombstone_1.StyledTombstone, { "data-testid": "single-value-tombstone", className: [
|
|
174
|
+
return ((0, jsx_runtime_1.jsx)(StyledTombstone_1.StyledTombstone, { ref: ref, "data-testid": "single-value-tombstone", className: [
|
|
174
175
|
"w-24 rounded-8 ".concat(defaultHeightClass),
|
|
175
176
|
//@ts-ignore -- theme override
|
|
176
177
|
(inputSizeTheme === null || inputSizeTheme === void 0 ? void 0 : inputSizeTheme.lineHeight) ? { height: inputSizeTheme === null || inputSizeTheme === void 0 ? void 0 : inputSizeTheme.lineHeight } : {},
|
|
177
178
|
] }));
|
|
178
|
-
};
|
|
179
|
-
exports.SingleValueTombstone = SingleValueTombstone;
|
|
179
|
+
});
|
|
180
180
|
exports.selectMenuOverrides = {
|
|
181
181
|
Menu: {
|
|
182
182
|
props: {
|
package/snackbar/Snackbar.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import type { SnackbarProps } from './types';
|
|
3
3
|
declare const Snackbar: {
|
|
4
|
-
({ intent: _intent, message: _message, disableManualClose, placement, autoHide, autoHideDuration, hideOnClickAway, overrides: _overrides, onClose, }: SnackbarProps): ReactElement | null;
|
|
4
|
+
({ intent: _intent, message: _message, id, disableManualClose, placement, autoHide, autoHideDuration, hideOnClickAway, overrides: _overrides, onClose, }: SnackbarProps): ReactElement | null;
|
|
5
5
|
__standard: string;
|
|
6
6
|
};
|
|
7
7
|
export default Snackbar;
|
package/snackbar/Snackbar.js
CHANGED
|
@@ -21,11 +21,12 @@ var locale_1 = require("../locale");
|
|
|
21
21
|
var style_1 = require("../style");
|
|
22
22
|
var theme_1 = require("../theme");
|
|
23
23
|
var Snackbar = function (_a) {
|
|
24
|
-
var _b = _a.intent, _intent = _b === void 0 ? 'success' : _b, _message = _a.message, _c = _a.disableManualClose, disableManualClose = _c === void 0 ? false : _c, _d = _a.placement, placement = _d === void 0 ? 'bottom' : _d, _e = _a.autoHide, autoHide = _e === void 0 ? true : _e, _f = _a.autoHideDuration, autoHideDuration = _f === void 0 ? constants_1.TYPE_TO_HIDE_DURATION[_intent] : _f, _g = _a.hideOnClickAway, hideOnClickAway = _g === void 0 ? true : _g, _overrides = _a.overrides, _h = _a.onClose, onClose = _h === void 0 ? noop_1.default : _h;
|
|
24
|
+
var _b = _a.intent, _intent = _b === void 0 ? 'success' : _b, _message = _a.message, id = _a.id, _c = _a.disableManualClose, disableManualClose = _c === void 0 ? false : _c, _d = _a.placement, placement = _d === void 0 ? 'bottom' : _d, _e = _a.autoHide, autoHide = _e === void 0 ? true : _e, _f = _a.autoHideDuration, autoHideDuration = _f === void 0 ? constants_1.TYPE_TO_HIDE_DURATION[_intent] : _f, _g = _a.hideOnClickAway, hideOnClickAway = _g === void 0 ? true : _g, _overrides = _a.overrides, _h = _a.onClose, onClose = _h === void 0 ? noop_1.default : _h;
|
|
25
25
|
var outerTheme = (0, style_1.useStyle)().theme;
|
|
26
26
|
var inverseTheme = (0, react_1.useMemo)(function () { return ((0, themeHelpers_1.isDarkTheme)(outerTheme) ? light_1.default : dark_1.default); }, [outerTheme]);
|
|
27
27
|
var _j = (0, useSnackbar_1.default)({
|
|
28
28
|
intent: _intent,
|
|
29
|
+
id: id,
|
|
29
30
|
message: _message,
|
|
30
31
|
overrides: _overrides,
|
|
31
32
|
autoHide: autoHide,
|
|
@@ -54,18 +55,12 @@ var Snackbar = function (_a) {
|
|
|
54
55
|
var _s = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.CloseIcon, close_1.default), 2), Close = _s[0], closeProps = _s[1];
|
|
55
56
|
var _t = tslib_1.__read((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.CloseIconButton, button_1.IconButton), 2), CloseIconButton = _t[0], closeIconButtonProps = _t[1];
|
|
56
57
|
var locale = (0, locale_1.useLocale)();
|
|
57
|
-
var role = constants_1.INTENT_TO_ROLE[intent];
|
|
58
|
-
// We don't know if the message contains any interactive elements, so we only
|
|
59
|
-
// delegate to the shared screen-reader announcer when the message is a string.
|
|
60
58
|
var isStringMessage = typeof message === 'string';
|
|
61
|
-
// Announce string messages through the shared global live region instead of
|
|
62
|
-
// hand-rolling sr-only regions here. The announcer keeps a single source of
|
|
63
|
-
// truth for status messages (WCAG 4.1.3) and re-announces repeated text.
|
|
64
59
|
(0, react_1.useEffect)(function () {
|
|
65
|
-
if (
|
|
66
|
-
(0, a11y_1.announce)(
|
|
60
|
+
if (typeof _message === 'string' && _message) {
|
|
61
|
+
(0, a11y_1.announce)(_message, { politeness: constants_1.INTENT_TO_ROLE[_intent] === 'alert' ? 'assertive' : 'polite' });
|
|
67
62
|
}
|
|
68
|
-
}, [
|
|
63
|
+
}, [_message, _intent, id]);
|
|
69
64
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: shouldRender ? ((0, jsx_runtime_1.jsx)(layer_2.LayersManager, tslib_1.__assign({ zIndex: layer_2.Z_INDEX.SNACKBAR }, { children: (0, jsx_runtime_1.jsx)(Layer, tslib_1.__assign({}, sharedProps, layerProps, { children: (0, jsx_runtime_1.jsx)(PlacementContainer, tslib_1.__assign({ "data-spaceweb": "snackbar", "data-testid": "snackbar" }, sharedProps, placementContainerProps, { children: (0, jsx_runtime_1.jsx)(SnackbarContainer, tslib_1.__assign({}, snackbarContainerProps, { ref: snackbarContainerRef }, sharedProps, snackbarContainerOverrideProps, { style: [styled_component_1.getSnackbarContainerAnimationStyle, snackbarContainerOverrideProps.style] }, { children: (0, jsx_runtime_1.jsx)(theme_1.ThemeProvider, tslib_1.__assign({ theme: inverseTheme }, { children: (0, jsx_runtime_1.jsxs)(ContentContainer, tslib_1.__assign({}, sharedProps, contentContainerProps, { children: [(0, jsx_runtime_1.jsx)(IconsContainer, tslib_1.__assign({}, sharedProps, iconsContainerProps, { children: (0, jsx_runtime_1.jsx)(IntentIcon, tslib_1.__assign({ size: 20, className: styled_component_1.getIconStyles }, sharedProps, intentIconProps)) })), (0, jsx_runtime_1.jsx)(Message
|
|
70
65
|
// The sr-only region handles screen reader announcements
|
|
71
66
|
// to prevent the message from being read twice
|