@ssa-ui-kit/core 3.9.0 → 3.10.5
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/dist/components/NotificationComponents/Alert/styles.d.ts +1 -1
- package/dist/components/NotificationComponents/Toast/styles.d.ts +9 -0
- package/dist/components/NotificationComponents/Toast/toastObserver.d.ts +4 -4
- package/dist/components/NotificationComponents/Toast/types.d.ts +17 -6
- package/dist/components/NotificationComponents/styles.d.ts +2 -0
- package/dist/index.js +146 -86
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Theme } from '@emotion/react';
|
|
2
2
|
import { MapIconsType } from '../../index';
|
|
3
3
|
import { AlertVariants } from './types';
|
|
4
|
-
export { containerStyles, itemSizeStyles, itemAnimationStyles, shadowStyles, borderStyles, iconColStyles, contentColStyles, expandedHeaderRowStyles, collapsedTitleStyles, actionsRowStyles, closeBtnStyles, } from '../styles';
|
|
4
|
+
export { containerStyles, itemSizeStyles, itemAnimationStyles, shadowStyles, borderStyles, iconColStyles, contentColStyles, expandedHeaderRowStyles, collapsedTitleStyles, actionsRowStyles, closeBtnStyles, semanticVariantIcons, } from '../styles';
|
|
5
5
|
export interface VariantTokens {
|
|
6
6
|
/** Color of the status icon */
|
|
7
7
|
iconColor: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Theme } from '@emotion/react';
|
|
2
|
+
import type { MapIconsType } from '../../index';
|
|
2
3
|
import { ToastVariants } from './types';
|
|
3
4
|
import { ColorsKeys } from '../../../types/emotion';
|
|
4
5
|
export { containerStyles, itemSizeStyles, itemAnimationStyles, shadowStyles, borderStyles, iconColStyles, contentColStyles, expandedHeaderRowStyles, collapsedTitleStyles, actionsRowStyles, closeBtnStyles, } from '../styles';
|
|
@@ -11,8 +12,16 @@ export interface ToastVariantTokens {
|
|
|
11
12
|
borderColor: string;
|
|
12
13
|
/** Text color for title / description */
|
|
13
14
|
textColor: string;
|
|
15
|
+
/**
|
|
16
|
+
* Progress bar color for this variant.
|
|
17
|
+
* Semantic variants (success, warning, error, primary) use their accent color
|
|
18
|
+
* to keep the bar visually consistent with the icon. Surface variants fall
|
|
19
|
+
* back to the theme's `blueNotification`.
|
|
20
|
+
*/
|
|
21
|
+
progressColor: string;
|
|
14
22
|
}
|
|
15
23
|
export declare const getVariantTokens: (theme: Theme, variant: ToastVariants) => ToastVariantTokens;
|
|
24
|
+
export declare const variantIcons: Record<ToastVariants, keyof MapIconsType>;
|
|
16
25
|
export declare const itemWrapperStyles: (background: string, hasDescription: boolean) => import("@emotion/react").SerializedStyles;
|
|
17
26
|
export declare const titleTextStyles: (textColor: string) => import("@emotion/react").SerializedStyles;
|
|
18
27
|
export declare const descriptionStyles: (textColor: string) => import("@emotion/react").SerializedStyles;
|
|
@@ -15,14 +15,14 @@ export declare const toastObserver: {
|
|
|
15
15
|
* import { showToast, ToastVariants } from '@ssa-ui-kit/core';
|
|
16
16
|
*
|
|
17
17
|
* // Simple
|
|
18
|
-
* showToast({ variant: ToastVariants.
|
|
18
|
+
* showToast({ variant: ToastVariants.secondary, title: 'File saved' });
|
|
19
19
|
*
|
|
20
|
-
* //
|
|
21
|
-
* showToast({ variant: ToastVariants.
|
|
20
|
+
* // Semantic variant with progress bar
|
|
21
|
+
* showToast({ variant: ToastVariants.success, title: 'Uploading…', withProgress: true });
|
|
22
22
|
*
|
|
23
23
|
* // Fully custom content (outer card + progress bar still render)
|
|
24
24
|
* showToast({
|
|
25
|
-
* variant: ToastVariants.
|
|
25
|
+
* variant: ToastVariants.secondary,
|
|
26
26
|
* renderProp: (close) => <MyCard onDismiss={close} />,
|
|
27
27
|
* });
|
|
28
28
|
* ```
|
|
@@ -2,6 +2,10 @@ import { JSX } from 'react';
|
|
|
2
2
|
import { GlobalSharedProps, DynamicProps } from '../types';
|
|
3
3
|
import { ColorsKeys } from '../../../types/emotion';
|
|
4
4
|
export declare enum ToastVariants {
|
|
5
|
+
success = "success",
|
|
6
|
+
warning = "warning",
|
|
7
|
+
error = "error",
|
|
8
|
+
primary = "primary",
|
|
5
9
|
secondary = "secondary",
|
|
6
10
|
neutral = "neutral",
|
|
7
11
|
dark = "dark"
|
|
@@ -42,21 +46,28 @@ export interface ToastProps extends GlobalSharedProps {
|
|
|
42
46
|
*
|
|
43
47
|
* @example
|
|
44
48
|
* ```ts
|
|
45
|
-
* // Minimal
|
|
46
|
-
* showToast({ variant: ToastVariants.
|
|
49
|
+
* // Minimal — surface variant
|
|
50
|
+
* showToast({ variant: ToastVariants.secondary, title: 'Saved!' });
|
|
47
51
|
*
|
|
48
|
-
* //
|
|
52
|
+
* // Semantic variant with progress bar
|
|
49
53
|
* showToast({
|
|
50
|
-
* variant: ToastVariants.
|
|
54
|
+
* variant: ToastVariants.success,
|
|
51
55
|
* title: 'Uploading…',
|
|
52
|
-
* color: 'purple',
|
|
53
56
|
* timeout: 8000,
|
|
54
57
|
* withProgress: true,
|
|
55
58
|
* });
|
|
56
59
|
*
|
|
60
|
+
* // With custom color override
|
|
61
|
+
* showToast({
|
|
62
|
+
* variant: ToastVariants.secondary,
|
|
63
|
+
* title: 'Deploying…',
|
|
64
|
+
* color: 'purple',
|
|
65
|
+
* withProgress: true,
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
57
68
|
* // Fully custom content
|
|
58
69
|
* showToast({
|
|
59
|
-
* variant: ToastVariants.
|
|
70
|
+
* variant: ToastVariants.secondary,
|
|
60
71
|
* renderProp: (close) => <MyCustomCard onDismiss={close} />,
|
|
61
72
|
* });
|
|
62
73
|
* ```
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* live in each component's own `styles.ts`.
|
|
9
9
|
*/
|
|
10
10
|
import { SerializedStyles, Theme } from '@emotion/react';
|
|
11
|
+
import type { MapIconsType } from '../index';
|
|
11
12
|
import { NotificationPositions, NotificationSizes } from './types';
|
|
12
13
|
export declare const containerStyles: (position: NotificationPositions) => SerializedStyles;
|
|
13
14
|
export declare const itemSizeStyles: Record<NotificationSizes, SerializedStyles>;
|
|
@@ -20,3 +21,4 @@ export declare const expandedHeaderRowStyles: SerializedStyles;
|
|
|
20
21
|
export declare const collapsedTitleStyles: SerializedStyles;
|
|
21
22
|
export declare const actionsRowStyles: SerializedStyles;
|
|
22
23
|
export declare const closeBtnStyles: SerializedStyles;
|
|
24
|
+
export declare const semanticVariantIcons: Record<'success' | 'warning' | 'error' | 'primary', keyof MapIconsType>;
|
package/dist/index.js
CHANGED
|
@@ -51777,73 +51777,6 @@ let AlertVariants = /*#__PURE__*/function (AlertVariants) {
|
|
|
51777
51777
|
* />
|
|
51778
51778
|
* ```
|
|
51779
51779
|
*/
|
|
51780
|
-
;// ./src/components/NotificationComponents/Alert/styles.ts
|
|
51781
|
-
|
|
51782
|
-
|
|
51783
|
-
|
|
51784
|
-
// ─── Re-export shared structural styles ──────────────────────────────────────
|
|
51785
|
-
// Consuming components (`AlertItem`, `Alert`) import `* as styles from './styles'`
|
|
51786
|
-
// so all shared exports need to be reachable from this file.
|
|
51787
|
-
|
|
51788
|
-
|
|
51789
|
-
|
|
51790
|
-
// ─── Variant color tokens ────────────────────────────────────────────────────
|
|
51791
|
-
|
|
51792
|
-
const getVariantTokens = (theme, variant) => {
|
|
51793
|
-
const map = {
|
|
51794
|
-
[AlertVariants.success]: {
|
|
51795
|
-
iconColor: theme.palette.success.main,
|
|
51796
|
-
accentColor: theme.palette.success.main,
|
|
51797
|
-
tintBg: `color-mix(in srgb, ${theme.palette.success.light} 8%, white)`
|
|
51798
|
-
},
|
|
51799
|
-
[AlertVariants.warning]: {
|
|
51800
|
-
iconColor: theme.palette.warning.main,
|
|
51801
|
-
accentColor: theme.palette.warning.main,
|
|
51802
|
-
tintBg: `color-mix(in srgb, ${theme.palette.warning.main} 8%, white)`
|
|
51803
|
-
},
|
|
51804
|
-
[AlertVariants.error]: {
|
|
51805
|
-
iconColor: theme.palette.error.main,
|
|
51806
|
-
accentColor: theme.palette.error.main,
|
|
51807
|
-
tintBg: `color-mix(in srgb, ${theme.palette.error.light} 8%, white)`
|
|
51808
|
-
},
|
|
51809
|
-
[AlertVariants.primary]: {
|
|
51810
|
-
iconColor: theme.palette.primary.main,
|
|
51811
|
-
accentColor: theme.palette.primary.main,
|
|
51812
|
-
tintBg: `color-mix(in srgb, ${theme.palette.primary.light} 8%, white)`
|
|
51813
|
-
},
|
|
51814
|
-
[AlertVariants.neutral]: {
|
|
51815
|
-
iconColor: theme.colors.greyDarker60,
|
|
51816
|
-
accentColor: theme.colors.grey,
|
|
51817
|
-
tintBg: theme.colors.white
|
|
51818
|
-
},
|
|
51819
|
-
[AlertVariants.secondary]: {
|
|
51820
|
-
iconColor: theme.colors.greyDarker60,
|
|
51821
|
-
accentColor: theme.colors.grey,
|
|
51822
|
-
tintBg: theme.palette.secondary.light
|
|
51823
|
-
}
|
|
51824
|
-
};
|
|
51825
|
-
return map[variant];
|
|
51826
|
-
};
|
|
51827
|
-
const variantIcons = {
|
|
51828
|
-
[AlertVariants.success]: 'check-circle',
|
|
51829
|
-
[AlertVariants.warning]: 'attention-circle',
|
|
51830
|
-
[AlertVariants.error]: 'attention-circle',
|
|
51831
|
-
[AlertVariants.primary]: 'information',
|
|
51832
|
-
[AlertVariants.neutral]: 'check-circle',
|
|
51833
|
-
[AlertVariants.secondary]: 'check-circle'
|
|
51834
|
-
};
|
|
51835
|
-
|
|
51836
|
-
// ─── Item wrapper ─────────────────────────────────────────────────────────────
|
|
51837
|
-
|
|
51838
|
-
const itemWrapperStyles = (background, hasDescription) => /*#__PURE__*/(0,react_namespaceObject.css)("position:relative;border-radius:8px;padding:12px 16px;display:flex;gap:10px;box-sizing:border-box;background:", background, ";align-items:", hasDescription ? 'flex-start' : 'center', ";" + ( true ? "" : 0), true ? "" : 0);
|
|
51839
|
-
|
|
51840
|
-
// ─── Text & action styles ─────────────────────────────────────────────────────
|
|
51841
|
-
// Accept an optional `textColor` so the `color` prop can override theme defaults
|
|
51842
|
-
// without a separate styleOverrides entry.
|
|
51843
|
-
|
|
51844
|
-
const titleTextStyles = (theme, textColor) => /*#__PURE__*/(0,react_namespaceObject.css)("font-size:14px;font-weight:600;line-height:20px;color:", textColor ?? theme.colors.greyDarker, ";word-break:break-word;" + ( true ? "" : 0), true ? "" : 0);
|
|
51845
|
-
const descriptionStyles = (theme, textColor) => /*#__PURE__*/(0,react_namespaceObject.css)("font-size:13px;font-weight:400;line-height:18px;color:", textColor ?? theme.colors.greyDarker80, ";margin:0;word-break:break-word;" + ( true ? "" : 0), true ? "" : 0);
|
|
51846
|
-
const actionBtnStyles = (theme, textColor) => /*#__PURE__*/(0,react_namespaceObject.css)("background:none;border:none;padding:0;cursor:pointer;font-size:13px;height:max-content;font-weight:500;line-height:18px;letter-spacing:0.2px;color:", textColor ?? theme.colors.greyDarker80, ";&:hover{color:", textColor ?? theme.colors.greyDarker, ";}" + ( true ? "" : 0), true ? "" : 0);
|
|
51847
51780
|
;// ./src/components/NotificationComponents/styles.ts
|
|
51848
51781
|
function NotificationComponents_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
51849
51782
|
/**
|
|
@@ -51973,6 +51906,82 @@ const closeBtnStyles = true ? {
|
|
|
51973
51906
|
name: "13odyj7",
|
|
51974
51907
|
styles: "background:none;border:none;padding:2px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-left:auto;line-height:0;opacity:0.7;&:hover{opacity:1;}"
|
|
51975
51908
|
} : 0;
|
|
51909
|
+
|
|
51910
|
+
// ─── Semantic variant icons ───────────────────────────────────────────────────
|
|
51911
|
+
// Shared icon mapping for the four semantic variants used by both Alert and Toast.
|
|
51912
|
+
// Each component spreads this map and adds its own surface-level variants on top.
|
|
51913
|
+
|
|
51914
|
+
const semanticVariantIcons = {
|
|
51915
|
+
success: 'check-circle',
|
|
51916
|
+
warning: 'attention-circle',
|
|
51917
|
+
error: 'attention-circle',
|
|
51918
|
+
primary: 'information'
|
|
51919
|
+
};
|
|
51920
|
+
;// ./src/components/NotificationComponents/Alert/styles.ts
|
|
51921
|
+
|
|
51922
|
+
|
|
51923
|
+
|
|
51924
|
+
|
|
51925
|
+
// ─── Re-export shared structural styles ──────────────────────────────────────
|
|
51926
|
+
// Consuming components (`AlertItem`, `Alert`) import `* as styles from './styles'`
|
|
51927
|
+
// so all shared exports need to be reachable from this file.
|
|
51928
|
+
|
|
51929
|
+
|
|
51930
|
+
|
|
51931
|
+
// ─── Variant color tokens ────────────────────────────────────────────────────
|
|
51932
|
+
|
|
51933
|
+
const getVariantTokens = (theme, variant) => {
|
|
51934
|
+
const map = {
|
|
51935
|
+
[AlertVariants.success]: {
|
|
51936
|
+
iconColor: theme.palette.success.main,
|
|
51937
|
+
accentColor: theme.palette.success.main,
|
|
51938
|
+
tintBg: `color-mix(in srgb, ${theme.palette.success.light} 8%, white)`
|
|
51939
|
+
},
|
|
51940
|
+
[AlertVariants.warning]: {
|
|
51941
|
+
iconColor: theme.palette.warning.main,
|
|
51942
|
+
accentColor: theme.palette.warning.main,
|
|
51943
|
+
tintBg: `color-mix(in srgb, ${theme.palette.warning.main} 8%, white)`
|
|
51944
|
+
},
|
|
51945
|
+
[AlertVariants.error]: {
|
|
51946
|
+
iconColor: theme.palette.error.main,
|
|
51947
|
+
accentColor: theme.palette.error.main,
|
|
51948
|
+
tintBg: `color-mix(in srgb, ${theme.palette.error.light} 8%, white)`
|
|
51949
|
+
},
|
|
51950
|
+
[AlertVariants.primary]: {
|
|
51951
|
+
iconColor: theme.palette.primary.main,
|
|
51952
|
+
accentColor: theme.palette.primary.main,
|
|
51953
|
+
tintBg: `color-mix(in srgb, ${theme.palette.primary.light} 8%, white)`
|
|
51954
|
+
},
|
|
51955
|
+
[AlertVariants.neutral]: {
|
|
51956
|
+
iconColor: theme.colors.greyDarker60,
|
|
51957
|
+
accentColor: theme.colors.grey,
|
|
51958
|
+
tintBg: theme.colors.white
|
|
51959
|
+
},
|
|
51960
|
+
[AlertVariants.secondary]: {
|
|
51961
|
+
iconColor: theme.colors.greyDarker60,
|
|
51962
|
+
accentColor: theme.colors.grey,
|
|
51963
|
+
tintBg: theme.palette.secondary.light
|
|
51964
|
+
}
|
|
51965
|
+
};
|
|
51966
|
+
return map[variant];
|
|
51967
|
+
};
|
|
51968
|
+
const variantIcons = {
|
|
51969
|
+
...semanticVariantIcons,
|
|
51970
|
+
[AlertVariants.neutral]: 'check-circle',
|
|
51971
|
+
[AlertVariants.secondary]: 'check-circle'
|
|
51972
|
+
};
|
|
51973
|
+
|
|
51974
|
+
// ─── Item wrapper ─────────────────────────────────────────────────────────────
|
|
51975
|
+
|
|
51976
|
+
const itemWrapperStyles = (background, hasDescription) => /*#__PURE__*/(0,react_namespaceObject.css)("position:relative;border-radius:8px;padding:12px 16px;display:flex;gap:10px;box-sizing:border-box;background:", background, ";align-items:", hasDescription ? 'flex-start' : 'center', ";" + ( true ? "" : 0), true ? "" : 0);
|
|
51977
|
+
|
|
51978
|
+
// ─── Text & action styles ─────────────────────────────────────────────────────
|
|
51979
|
+
// Accept an optional `textColor` so the `color` prop can override theme defaults
|
|
51980
|
+
// without a separate styleOverrides entry.
|
|
51981
|
+
|
|
51982
|
+
const titleTextStyles = (theme, textColor) => /*#__PURE__*/(0,react_namespaceObject.css)("font-size:14px;font-weight:600;line-height:20px;color:", textColor ?? theme.colors.greyDarker, ";word-break:break-word;" + ( true ? "" : 0), true ? "" : 0);
|
|
51983
|
+
const descriptionStyles = (theme, textColor) => /*#__PURE__*/(0,react_namespaceObject.css)("font-size:13px;font-weight:400;line-height:18px;color:", textColor ?? theme.colors.greyDarker80, ";margin:0;word-break:break-word;" + ( true ? "" : 0), true ? "" : 0);
|
|
51984
|
+
const actionBtnStyles = (theme, textColor) => /*#__PURE__*/(0,react_namespaceObject.css)("background:none;border:none;padding:0;cursor:pointer;font-size:13px;height:max-content;font-weight:500;line-height:18px;letter-spacing:0.2px;color:", textColor ?? theme.colors.greyDarker80, ";&:hover{color:", textColor ?? theme.colors.greyDarker, ";}" + ( true ? "" : 0), true ? "" : 0);
|
|
51976
51985
|
;// ./src/components/NotificationComponents/Alert/AlertItem.tsx
|
|
51977
51986
|
|
|
51978
51987
|
|
|
@@ -52293,14 +52302,14 @@ const toastObserver = createObserver();
|
|
|
52293
52302
|
* import { showToast, ToastVariants } from '@ssa-ui-kit/core';
|
|
52294
52303
|
*
|
|
52295
52304
|
* // Simple
|
|
52296
|
-
* showToast({ variant: ToastVariants.
|
|
52305
|
+
* showToast({ variant: ToastVariants.secondary, title: 'File saved' });
|
|
52297
52306
|
*
|
|
52298
|
-
* //
|
|
52299
|
-
* showToast({ variant: ToastVariants.
|
|
52307
|
+
* // Semantic variant with progress bar
|
|
52308
|
+
* showToast({ variant: ToastVariants.success, title: 'Uploading…', withProgress: true });
|
|
52300
52309
|
*
|
|
52301
52310
|
* // Fully custom content (outer card + progress bar still render)
|
|
52302
52311
|
* showToast({
|
|
52303
|
-
* variant: ToastVariants.
|
|
52312
|
+
* variant: ToastVariants.secondary,
|
|
52304
52313
|
* renderProp: (close) => <MyCard onDismiss={close} />,
|
|
52305
52314
|
* });
|
|
52306
52315
|
* ```
|
|
@@ -52364,6 +52373,10 @@ const useAutoDismiss = (timeout, onDismiss) => {
|
|
|
52364
52373
|
};
|
|
52365
52374
|
;// ./src/components/NotificationComponents/Toast/types.ts
|
|
52366
52375
|
let ToastVariants = /*#__PURE__*/function (ToastVariants) {
|
|
52376
|
+
ToastVariants["success"] = "success";
|
|
52377
|
+
ToastVariants["warning"] = "warning";
|
|
52378
|
+
ToastVariants["error"] = "error";
|
|
52379
|
+
ToastVariants["primary"] = "primary";
|
|
52367
52380
|
ToastVariants["secondary"] = "secondary";
|
|
52368
52381
|
ToastVariants["neutral"] = "neutral";
|
|
52369
52382
|
ToastVariants["dark"] = "dark";
|
|
@@ -52383,21 +52396,28 @@ let ToastVariants = /*#__PURE__*/function (ToastVariants) {
|
|
|
52383
52396
|
*
|
|
52384
52397
|
* @example
|
|
52385
52398
|
* ```ts
|
|
52386
|
-
* // Minimal
|
|
52387
|
-
* showToast({ variant: ToastVariants.
|
|
52399
|
+
* // Minimal — surface variant
|
|
52400
|
+
* showToast({ variant: ToastVariants.secondary, title: 'Saved!' });
|
|
52388
52401
|
*
|
|
52389
|
-
* //
|
|
52402
|
+
* // Semantic variant with progress bar
|
|
52390
52403
|
* showToast({
|
|
52391
|
-
* variant: ToastVariants.
|
|
52404
|
+
* variant: ToastVariants.success,
|
|
52392
52405
|
* title: 'Uploading…',
|
|
52393
|
-
* color: 'purple',
|
|
52394
52406
|
* timeout: 8000,
|
|
52395
52407
|
* withProgress: true,
|
|
52396
52408
|
* });
|
|
52397
52409
|
*
|
|
52410
|
+
* // With custom color override
|
|
52411
|
+
* showToast({
|
|
52412
|
+
* variant: ToastVariants.secondary,
|
|
52413
|
+
* title: 'Deploying…',
|
|
52414
|
+
* color: 'purple',
|
|
52415
|
+
* withProgress: true,
|
|
52416
|
+
* });
|
|
52417
|
+
*
|
|
52398
52418
|
* // Fully custom content
|
|
52399
52419
|
* showToast({
|
|
52400
|
-
* variant: ToastVariants.
|
|
52420
|
+
* variant: ToastVariants.secondary,
|
|
52401
52421
|
* renderProp: (close) => <MyCustomCard onDismiss={close} />,
|
|
52402
52422
|
* });
|
|
52403
52423
|
* ```
|
|
@@ -52406,6 +52426,8 @@ let ToastVariants = /*#__PURE__*/function (ToastVariants) {
|
|
|
52406
52426
|
function Toast_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
52407
52427
|
|
|
52408
52428
|
|
|
52429
|
+
|
|
52430
|
+
|
|
52409
52431
|
// ─── Re-export shared structural styles ──────────────────────────────────────
|
|
52410
52432
|
|
|
52411
52433
|
|
|
@@ -52414,27 +52436,64 @@ function Toast_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried
|
|
|
52414
52436
|
|
|
52415
52437
|
const styles_getVariantTokens = (theme, variant) => {
|
|
52416
52438
|
const map = {
|
|
52439
|
+
[ToastVariants.success]: {
|
|
52440
|
+
bg: `color-mix(in srgb, ${theme.palette.success.light} 8%, white)`,
|
|
52441
|
+
iconColor: theme.palette.success.main,
|
|
52442
|
+
borderColor: theme.palette.success.main,
|
|
52443
|
+
textColor: theme.colors.greyDarker,
|
|
52444
|
+
progressColor: theme.palette.success.main
|
|
52445
|
+
},
|
|
52446
|
+
[ToastVariants.warning]: {
|
|
52447
|
+
bg: `color-mix(in srgb, ${theme.palette.warning.main} 8%, white)`,
|
|
52448
|
+
iconColor: theme.palette.warning.main,
|
|
52449
|
+
borderColor: theme.palette.warning.main,
|
|
52450
|
+
textColor: theme.colors.greyDarker,
|
|
52451
|
+
progressColor: theme.palette.warning.main
|
|
52452
|
+
},
|
|
52453
|
+
[ToastVariants.error]: {
|
|
52454
|
+
bg: `color-mix(in srgb, ${theme.palette.error.light} 8%, white)`,
|
|
52455
|
+
iconColor: theme.palette.error.main,
|
|
52456
|
+
borderColor: theme.palette.error.main,
|
|
52457
|
+
textColor: theme.colors.greyDarker,
|
|
52458
|
+
progressColor: theme.palette.error.main
|
|
52459
|
+
},
|
|
52460
|
+
[ToastVariants.primary]: {
|
|
52461
|
+
bg: `color-mix(in srgb, ${theme.palette.primary.light} 8%, white)`,
|
|
52462
|
+
iconColor: theme.palette.primary.main,
|
|
52463
|
+
borderColor: theme.palette.primary.main,
|
|
52464
|
+
textColor: theme.colors.greyDarker,
|
|
52465
|
+
progressColor: theme.palette.primary.main
|
|
52466
|
+
},
|
|
52417
52467
|
[ToastVariants.secondary]: {
|
|
52418
52468
|
bg: theme.palette.secondary.light,
|
|
52419
52469
|
iconColor: theme.colors.greyDarker60,
|
|
52420
52470
|
borderColor: theme.colors.greyFocused,
|
|
52421
|
-
textColor: theme.colors.greyDarker
|
|
52471
|
+
textColor: theme.colors.greyDarker,
|
|
52472
|
+
progressColor: theme.colors.blueNotification
|
|
52422
52473
|
},
|
|
52423
52474
|
[ToastVariants.neutral]: {
|
|
52424
52475
|
bg: theme.colors.white,
|
|
52425
52476
|
iconColor: theme.colors.greyDarker60,
|
|
52426
52477
|
borderColor: theme.colors.greyOutline,
|
|
52427
|
-
textColor: theme.colors.greyDarker
|
|
52478
|
+
textColor: theme.colors.greyDarker,
|
|
52479
|
+
progressColor: theme.colors.blueNotification
|
|
52428
52480
|
},
|
|
52429
52481
|
[ToastVariants.dark]: {
|
|
52430
52482
|
bg: theme.colors.greyBackground,
|
|
52431
52483
|
iconColor: theme.colors.white,
|
|
52432
52484
|
borderColor: theme.colors.greyBackground,
|
|
52433
|
-
textColor: theme.colors.white
|
|
52485
|
+
textColor: theme.colors.white,
|
|
52486
|
+
progressColor: theme.colors.blueNotification
|
|
52434
52487
|
}
|
|
52435
52488
|
};
|
|
52436
52489
|
return map[variant];
|
|
52437
52490
|
};
|
|
52491
|
+
const styles_variantIcons = {
|
|
52492
|
+
...semanticVariantIcons,
|
|
52493
|
+
[ToastVariants.neutral]: 'check-circle',
|
|
52494
|
+
[ToastVariants.secondary]: 'check-circle',
|
|
52495
|
+
[ToastVariants.dark]: 'check-circle'
|
|
52496
|
+
};
|
|
52438
52497
|
|
|
52439
52498
|
// ─── Toast item wrapper ───────────────────────────────────────────────────────
|
|
52440
52499
|
// Unlike Alert (which layers a rgba tint over white via backgroundImage),
|
|
@@ -52535,8 +52594,10 @@ const ToastItem = ({
|
|
|
52535
52594
|
const accentColor = resolvedColor ? dark ? theme.colors.white : darkenColor(resolvedColor) : tokens.iconColor;
|
|
52536
52595
|
const borderColor = resolvedColor ? darkenColor(resolvedColor) : tokens.borderColor;
|
|
52537
52596
|
|
|
52538
|
-
// Precedence: explicit progressColor prop → auto darkened `color` →
|
|
52539
|
-
|
|
52597
|
+
// Precedence: explicit progressColor prop → auto darkened `color` → variant token
|
|
52598
|
+
// Semantic variants (success/warning/error/primary) use their accent color so
|
|
52599
|
+
// the bar matches the status icon; surface variants fall back to blueNotification.
|
|
52600
|
+
const resolvedProgressColor = progressColor ?? (resolvedColor ? darkenColor(resolvedColor) : tokens.progressColor);
|
|
52540
52601
|
const resolvedCloseIconColor = dark ? theme.colors.white : theme.colors.greyDarker60;
|
|
52541
52602
|
|
|
52542
52603
|
// ─── Auto-dismiss with hover-pause ──────────────────────────────────────────
|
|
@@ -52576,7 +52637,7 @@ const ToastItem = ({
|
|
|
52576
52637
|
children: [(0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
52577
52638
|
css: iconColStyles,
|
|
52578
52639
|
children: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
52579
|
-
name:
|
|
52640
|
+
name: styles_variantIcons[variant],
|
|
52580
52641
|
color: accentColor,
|
|
52581
52642
|
size: 24
|
|
52582
52643
|
})
|
|
@@ -52678,12 +52739,11 @@ const ToastItem = ({
|
|
|
52678
52739
|
* ```tsx
|
|
52679
52740
|
* import { showToast, ToastVariants } from '@ssa-ui-kit/core';
|
|
52680
52741
|
*
|
|
52681
|
-
* showToast({ variant: ToastVariants.
|
|
52742
|
+
* showToast({ variant: ToastVariants.success, title: 'File saved!' });
|
|
52682
52743
|
*
|
|
52683
52744
|
* showToast({
|
|
52684
|
-
* variant: ToastVariants.
|
|
52745
|
+
* variant: ToastVariants.warning,
|
|
52685
52746
|
* title: 'Uploading…',
|
|
52686
|
-
* color: 'blue',
|
|
52687
52747
|
* timeout: 8000,
|
|
52688
52748
|
* withProgress: true,
|
|
52689
52749
|
* });
|