@ssa-ui-kit/core 3.8.0 → 3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/components/Icon/icons/AttentionCircle.d.ts +3 -0
  2. package/dist/components/Icon/icons/all.d.ts +1 -0
  3. package/dist/components/Icon/icons/iconsList.d.ts +1 -1
  4. package/dist/components/NotificationComponents/Alert/Alert.d.ts +58 -0
  5. package/dist/components/NotificationComponents/Alert/AlertItem.d.ts +48 -0
  6. package/dist/components/NotificationComponents/Alert/alertObserver.d.ts +18 -0
  7. package/dist/components/NotificationComponents/Alert/index.d.ts +4 -0
  8. package/dist/components/NotificationComponents/Alert/styles.d.ts +18 -0
  9. package/dist/components/NotificationComponents/Alert/types.d.ts +80 -0
  10. package/dist/components/NotificationComponents/Notification/Notification.d.ts +4 -0
  11. package/dist/components/NotificationComponents/Notification/NotificationItem.d.ts +60 -0
  12. package/dist/components/NotificationComponents/Notification/index.d.ts +4 -0
  13. package/dist/components/NotificationComponents/Notification/notificationObserver.d.ts +23 -0
  14. package/dist/components/NotificationComponents/Notification/styles.d.ts +18 -0
  15. package/dist/components/NotificationComponents/Notification/types.d.ts +119 -0
  16. package/dist/components/NotificationComponents/Toast/Toast.d.ts +4 -0
  17. package/dist/components/NotificationComponents/Toast/ToastItem.d.ts +53 -0
  18. package/dist/components/NotificationComponents/Toast/index.d.ts +4 -0
  19. package/dist/components/NotificationComponents/Toast/styles.d.ts +35 -0
  20. package/dist/components/NotificationComponents/Toast/toastObserver.d.ts +30 -0
  21. package/dist/components/NotificationComponents/Toast/types.d.ts +113 -0
  22. package/dist/components/NotificationComponents/hooks/useAutoDismiss.d.ts +32 -0
  23. package/dist/components/NotificationComponents/index.d.ts +8 -0
  24. package/dist/components/NotificationComponents/styles.d.ts +24 -0
  25. package/dist/components/NotificationComponents/types.d.ts +38 -0
  26. package/dist/components/index.d.ts +1 -0
  27. package/dist/index.js +1832 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/types/emotion.d.ts +4 -0
  30. package/dist/utils/colorUtils.d.ts +45 -0
  31. package/dist/utils/createObserver.d.ts +21 -0
  32. package/package.json +3 -3
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from '../types';
2
+ export declare const AttentionCircle: ({ fill, size, tooltip, ...props }: SVGProps) => import("@emotion/react/jsx-runtime").JSX.Element;
3
+ export declare const ICON_NAME = "attention-circle";
@@ -125,3 +125,4 @@ export * as EmailOutlined from './EmailOutlined';
125
125
  export * as LockOutlined from './LockOutlined';
126
126
  export * as AddFolder from './AddFolder';
127
127
  export * as MoveFolder from './MoveFolder';
128
+ export * as AttentionCircle from './AttentionCircle';
@@ -1 +1 @@
1
- export declare const iconsList: ("visible" | "warning" | "archive" | "document" | "link" | "search" | "arrow-down" | "arrow-up" | "clipboard-assessment" | "attention" | "award" | "ban-user" | "bench" | "bin" | "calendar" | "calendar-schedule" | "carrot-down" | "carrot-left" | "carrot-right" | "carrot-up" | "card-text" | "case" | "certification" | "certification-expiring" | "camera" | "change" | "chart" | "check" | "check-circle" | "check-circle-inverted" | "children" | "circle" | "circular" | "clock" | "cogwheel" | "comments" | "briefcase" | "building" | "compensation" | "confirm-email" | "contacts" | "copy" | "copy-link" | "cross" | "delete" | "diamond-ring" | "diet" | "documents" | "edit" | "education" | "email" | "employee" | "employee-profile" | "employee-terminated" | "employee-blackboard" | "excel-download" | "export" | "file-mark" | "file-pdf" | "file-word" | "filter" | "filter-funnel" | "follow-link" | "fte" | "clipboard-form" | "geography" | "gender" | "gift" | "home" | "import" | "information" | "inventory" | "invisible" | "language" | "lock" | "log-in" | "log-out" | "maximize" | "measurements" | "message" | "minus" | "minus-circle" | "minus-circle-inverted" | "more" | "more-vertical" | "notification" | "office-chair" | "open-book" | "pages" | "party" | "plus" | "plus-circle" | "plus-circle-inverted" | "probation-period" | "profiles-changes" | "radio-on" | "clipboard-report" | "clipboard-result" | "robot" | "roles" | "seniority" | "settings" | "setting-clock" | "signature" | "sleep" | "staff-growth-coefficient" | "staff-turnover-coefficient" | "stats" | "clipboard-summary" | "team" | "clipboard-star" | "time-tracking" | "timeline" | "tennis-ball" | "trainings" | "unarchive" | "union" | "union-circle" | "unlock" | "url" | "user" | "panelLeft" | "panelRight" | "emailOutlined" | "lockOutlined" | "addFolder" | "moveFolder")[];
1
+ export declare const iconsList: ("visible" | "warning" | "archive" | "document" | "link" | "search" | "arrow-down" | "arrow-up" | "clipboard-assessment" | "attention" | "award" | "ban-user" | "bench" | "bin" | "calendar" | "calendar-schedule" | "carrot-down" | "carrot-left" | "carrot-right" | "carrot-up" | "card-text" | "case" | "certification" | "certification-expiring" | "camera" | "change" | "chart" | "check" | "check-circle" | "check-circle-inverted" | "children" | "circle" | "circular" | "clock" | "cogwheel" | "comments" | "briefcase" | "building" | "compensation" | "confirm-email" | "contacts" | "copy" | "copy-link" | "cross" | "delete" | "diamond-ring" | "diet" | "documents" | "edit" | "education" | "email" | "employee" | "employee-profile" | "employee-terminated" | "employee-blackboard" | "excel-download" | "export" | "file-mark" | "file-pdf" | "file-word" | "filter" | "filter-funnel" | "follow-link" | "fte" | "clipboard-form" | "geography" | "gender" | "gift" | "home" | "import" | "information" | "inventory" | "invisible" | "language" | "lock" | "log-in" | "log-out" | "maximize" | "measurements" | "message" | "minus" | "minus-circle" | "minus-circle-inverted" | "more" | "more-vertical" | "notification" | "office-chair" | "open-book" | "pages" | "party" | "plus" | "plus-circle" | "plus-circle-inverted" | "probation-period" | "profiles-changes" | "radio-on" | "clipboard-report" | "clipboard-result" | "robot" | "roles" | "seniority" | "settings" | "setting-clock" | "signature" | "sleep" | "staff-growth-coefficient" | "staff-turnover-coefficient" | "stats" | "clipboard-summary" | "team" | "clipboard-star" | "time-tracking" | "timeline" | "tennis-ball" | "trainings" | "unarchive" | "union" | "union-circle" | "unlock" | "url" | "user" | "panelLeft" | "panelRight" | "emailOutlined" | "lockOutlined" | "addFolder" | "moveFolder" | "attention-circle")[];
@@ -0,0 +1,58 @@
1
+ import { FC } from 'react';
2
+ import { AlertProps } from './types';
3
+ /**
4
+ * Alert — portal-based notification container driven by the Observer pattern.
5
+ *
6
+ * ## Usage pattern (two steps)
7
+ *
8
+ * **Step 1 — mount once** near the app root (layout, shell, etc.).
9
+ * The component renders nothing until `showAlert` is called.
10
+ *
11
+ * ```tsx
12
+ * // app-root.tsx
13
+ * import { Alert, NotificationPositions } from '@ssa-ui-kit/core';
14
+ *
15
+ * <Alert position={NotificationPositions.rightTop} withShadow maxAmount={5} />
16
+ * ```
17
+ *
18
+ * **Step 2 — trigger from anywhere** via `showAlert`.
19
+ * No refs, no prop drilling, no context required.
20
+ *
21
+ * ```tsx
22
+ * import { showAlert, AlertVariants } from '@ssa-ui-kit/core';
23
+ *
24
+ * showAlert({ variant: AlertVariants.success, title: 'Saved!' });
25
+ *
26
+ * showAlert({
27
+ * variant: AlertVariants.error,
28
+ * title: 'Upload failed',
29
+ * description: 'File exceeds 10 MB.',
30
+ * cancelText: 'Dismiss',
31
+ * onClose: () => {}, // required for the cancel button to appear
32
+ * submitText: 'Retry',
33
+ * onSubmit: () => retryFn(), // required for the submit button to appear
34
+ * });
35
+ * ```
36
+ *
37
+ * ## Key props
38
+ * - `position` — one of `NotificationPositions` (default: `rightTop`)
39
+ * - `maxAmount` — cap on simultaneous alerts; oldest is dropped when exceeded
40
+ * - `withShadow` — drop shadow (default: `true`)
41
+ * - `withBorder` — 1 px accent-color border (default: `false`)
42
+ * - `inheritMainColor`— close icon matches the variant accent color
43
+ * - `containerSelector` — CSS selector for a custom portal target; falls back to `document.body`
44
+ * - `styles` — `AlertStyleOverrides` object for per-slot CSS customization without touching the theme
45
+ *
46
+ * ## Stacking order
47
+ * - `*-top` positions → newest alert prepended (appears at the top of the stack)
48
+ * - `*-bottom` positions → newest alert appended (appears at the bottom of the stack)
49
+ *
50
+ * When `maxAmount` is set and the stack is full, the oldest alert is dropped:
51
+ * - `*-top`: drops from the **end** of the array (bottom of the stack)
52
+ * - `*-bottom`: drops from the **start** of the array (top of the stack)
53
+ *
54
+ * @category Components
55
+ * @subcategory Notification
56
+ */
57
+ declare const Alert: FC<AlertProps>;
58
+ export default Alert;
@@ -0,0 +1,48 @@
1
+ import { FC } from 'react';
2
+ import { NotificationPositions, NotificationSizes } from '../types';
3
+ import { ColorsKeys } from '../../../types/emotion';
4
+ import { AlertStyleOverrides, AlertVariants } from './types';
5
+ /**
6
+ * @internal
7
+ *
8
+ * Renders a single alert card inside the `<Alert>` portal container.
9
+ * This component is **not part of the public API** — consumers should call
10
+ * `showAlert(params)` to trigger alerts and configure appearance via the
11
+ * `<Alert>` component's props (`withShadow`, `withBorder`, `styles`, etc.).
12
+ *
13
+ * Direct use of `AlertItem` is only intended for static previews in Storybook
14
+ * stories or tests where portal/observer overhead is unwanted.
15
+ *
16
+ * Layout modes:
17
+ * - **Expanded** — when `description` is provided: title + description + action row + close button in header
18
+ * - **Collapsed** — no description: title + action row + close button all on one line
19
+ *
20
+ * Action buttons are **opt-in**: a button only renders when its label text
21
+ * AND its callback are both present (`cancelText + onClose`, `submitText + onSubmit`).
22
+ */
23
+ export interface AlertItemProps {
24
+ id: string;
25
+ variant: AlertVariants;
26
+ /**
27
+ * Solid background color. When provided, the variant tokens are ignored and
28
+ * text/icon/border colors are auto-derived for contrast via `colorUtils`.
29
+ * Accepts a theme color key or any CSS color string.
30
+ */
31
+ color?: ColorsKeys | string;
32
+ title?: string;
33
+ description?: string;
34
+ cancelText: string;
35
+ submitText: string;
36
+ size: NotificationSizes;
37
+ withShadow?: boolean;
38
+ withBorder?: boolean;
39
+ /** Ignored when `color` is set — color fully drives all derived colors. */
40
+ inheritMainColor?: boolean;
41
+ animationDuration: number;
42
+ position: NotificationPositions;
43
+ onClose?: () => void;
44
+ onSubmit?: () => void;
45
+ onRemove: (id: string) => void;
46
+ styleOverrides?: AlertStyleOverrides;
47
+ }
48
+ export declare const AlertItem: FC<AlertItemProps>;
@@ -0,0 +1,18 @@
1
+ import { DynamicAlertParams } from './types';
2
+ export declare const alertObserver: {
3
+ subscribe: (key: string, fn: (data: DynamicAlertParams) => void) => void;
4
+ unsubscribe: (key: string) => void;
5
+ dispatch: (data: DynamicAlertParams) => void;
6
+ };
7
+ /**
8
+ * Imperatively triggers a new alert inside the mounted `<Alert>` component.
9
+ *
10
+ * The `<Alert>` component must be mounted somewhere in the tree (typically near
11
+ * the app root) to receive dispatched alerts.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * showAlert({ variant: AlertVariants.success, title: 'Saved!', description: 'Your changes have been saved.' });
16
+ * ```
17
+ */
18
+ export declare const showAlert: (params: DynamicAlertParams) => void;
@@ -0,0 +1,4 @@
1
+ export { default } from './Alert';
2
+ export { showAlert } from './alertObserver';
3
+ export { AlertVariants } from './types';
4
+ export type { AlertProps, AlertStyleOverrides, DynamicAlertParams, } from './types';
@@ -0,0 +1,18 @@
1
+ import { Theme } from '@emotion/react';
2
+ import { MapIconsType } from '../../index';
3
+ import { AlertVariants } from './types';
4
+ export { containerStyles, itemSizeStyles, itemAnimationStyles, shadowStyles, borderStyles, iconColStyles, contentColStyles, expandedHeaderRowStyles, collapsedTitleStyles, actionsRowStyles, closeBtnStyles, semanticVariantIcons, } from '../styles';
5
+ export interface VariantTokens {
6
+ /** Color of the status icon */
7
+ iconColor: string;
8
+ /** Accent color used for border and close icon when inheritMainColor is true */
9
+ accentColor: string;
10
+ /** Solid background color for the card */
11
+ tintBg: string;
12
+ }
13
+ export declare const getVariantTokens: (theme: Theme, variant: AlertVariants) => VariantTokens;
14
+ export declare const variantIcons: Record<AlertVariants, keyof MapIconsType>;
15
+ export declare const itemWrapperStyles: (background: string, hasDescription: boolean) => import("@emotion/react").SerializedStyles;
16
+ export declare const titleTextStyles: (theme: Theme, textColor?: string) => import("@emotion/react").SerializedStyles;
17
+ export declare const descriptionStyles: (theme: Theme, textColor?: string) => import("@emotion/react").SerializedStyles;
18
+ export declare const actionBtnStyles: (theme: Theme, textColor?: string) => import("@emotion/react").SerializedStyles;
@@ -0,0 +1,80 @@
1
+ import { CSSObject } from '@emotion/react';
2
+ import { GlobalSharedProps, DynamicProps } from '../types';
3
+ import { ColorsKeys } from '../../../types/emotion';
4
+ export declare enum AlertVariants {
5
+ success = "success",
6
+ warning = "warning",
7
+ error = "error",
8
+ primary = "primary",
9
+ neutral = "neutral",
10
+ secondary = "secondary"
11
+ }
12
+ /**
13
+ * Per-slot style overrides for `<Alert>`.
14
+ *
15
+ * Because the alert cards are rendered inside a portal, a top-level `css` prop
16
+ * cannot reach the inner elements. Use this object instead to customize any
17
+ * part of the card without touching the global theme.
18
+ *
19
+ * CSS slots accept any `CSSObject` and are merged **after** the default styles,
20
+ * so they always win. The two `*Color` fields exist because `<Icon>` receives
21
+ * its fill via a prop rather than CSS inheritance.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * <Alert
26
+ * styles={{
27
+ * root: { background: '#1a1a2e', borderRadius: 4 },
28
+ * title: { color: '#ffffff', fontSize: 15 },
29
+ * description: { color: 'rgba(255,255,255,0.65)' },
30
+ * actionButton: { color: '#a78bfa' },
31
+ * iconColor: '#a78bfa',
32
+ * closeIconColor: 'rgba(255,255,255,0.5)',
33
+ * }}
34
+ * />
35
+ * ```
36
+ */
37
+ export interface AlertStyleOverrides {
38
+ /** Card wrapper — background, border-radius, padding, box-shadow, border, etc. */
39
+ root?: CSSObject;
40
+ /** Status icon wrapper div */
41
+ icon?: CSSObject;
42
+ /** Fill color for the status icon (overrides the variant's default icon color) */
43
+ iconColor?: string;
44
+ /** Title element */
45
+ title?: CSSObject;
46
+ /** Description element */
47
+ description?: CSSObject;
48
+ /** Actions row wrapper */
49
+ actions?: CSSObject;
50
+ /** Cancel and submit action buttons */
51
+ actionButton?: CSSObject;
52
+ /** Close (×) button wrapper */
53
+ closeButton?: CSSObject;
54
+ /** Fill color for the close (×) icon (overrides theme default / inheritMainColor value) */
55
+ closeIconColor?: string;
56
+ }
57
+ export interface AlertProps extends GlobalSharedProps {
58
+ /**
59
+ * When set, overrides the variant's background with a solid color and
60
+ * auto-derives text, icon, and border colors for contrast.
61
+ * Accepts a theme color key (e.g. `'purple'`) or any CSS color string
62
+ * (e.g. `'#1e293b'`, `'rgba(30,41,59,1)'`).
63
+ * When provided, `inheritMainColor` is ignored.
64
+ */
65
+ color?: ColorsKeys | string;
66
+ /** When true, border and close icon use the variant accent color. Ignored when `color` is set. */
67
+ inheritMainColor?: boolean;
68
+ /** Per-slot style overrides. Applied after all default styles. */
69
+ styles?: AlertStyleOverrides;
70
+ }
71
+ export interface DynamicAlertParams extends DynamicProps {
72
+ variant: AlertVariants;
73
+ /**
74
+ * Solid background color for this specific alert.
75
+ * Auto-derives text, icon, and border colors for contrast.
76
+ * Accepts a theme color key or any CSS color string.
77
+ * When provided, `inheritMainColor` is ignored.
78
+ */
79
+ color?: ColorsKeys | string;
80
+ }
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { NotificationProps } from './types';
3
+ declare const Notification: FC<NotificationProps>;
4
+ export default Notification;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @internal
3
+ *
4
+ * Renders a single notification card inside the `<Notification>` portal container.
5
+ * Not part of the public API — consumers call `showNotification(params)` to trigger
6
+ * notifications and configure appearance via `<Notification>` component props.
7
+ *
8
+ * Layout:
9
+ * ```
10
+ * [icon] Title date [×]
11
+ * Description text here.
12
+ * Cancel Submit
13
+ * ```
14
+ *
15
+ * The icon column accepts:
16
+ * - A named icon string → rendered via `<Icon>`
17
+ * - Any ReactNode (img, Avatar, etc.) → rendered as-is
18
+ * - Omitted → falls back to `"user"` icon
19
+ *
20
+ * Action buttons are opt-in: a button only renders when both its label text
21
+ * AND its callback are present (`cancelText + onClose`, `submitText + onSubmit`).
22
+ */
23
+ import { FC, ReactNode } from 'react';
24
+ import { NotificationPositions, NotificationSizes } from '../types';
25
+ import { ColorsKeys } from '../../../types/emotion';
26
+ import { NotificationStyleOverrides, NotificationVariants } from './types';
27
+ export interface NotificationItemProps {
28
+ id: string;
29
+ variant: NotificationVariants;
30
+ /**
31
+ * Solid background color. When provided, variant token colors are ignored and
32
+ * text/icon/border colors are auto-derived for contrast.
33
+ */
34
+ color?: ColorsKeys | string;
35
+ /** Pre-formatted timestamp string (e.g. `"11 days ago"`). */
36
+ date?: string;
37
+ /**
38
+ * Icon for the left column.
39
+ * - `string` → rendered as a named `<Icon>`
40
+ * - `ReactNode` → rendered as-is
41
+ * - omitted → falls back to `"user"` icon
42
+ */
43
+ icon?: string | ReactNode;
44
+ title?: string;
45
+ description?: string;
46
+ cancelText: string;
47
+ submitText: string;
48
+ size: NotificationSizes;
49
+ withShadow?: boolean;
50
+ withBorder?: boolean;
51
+ animationDuration: number;
52
+ position: NotificationPositions;
53
+ /** `undefined` = no auto-dismiss */
54
+ timeout?: number;
55
+ onClose?: () => void;
56
+ onSubmit?: () => void;
57
+ onRemove: (id: string) => void;
58
+ styleOverrides?: NotificationStyleOverrides;
59
+ }
60
+ export declare const NotificationItem: FC<NotificationItemProps>;
@@ -0,0 +1,4 @@
1
+ export { default } from './Notification';
2
+ export { showNotification } from './notificationObserver';
3
+ export { NotificationVariants } from './types';
4
+ export type { NotificationProps, NotificationStyleOverrides, DynamicNotificationParams, } from './types';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Module-level singleton connecting imperative `showNotification()` calls to
3
+ * whichever `<Notification>` components are currently mounted in the document.
4
+ *
5
+ * Architecture:
6
+ *
7
+ * showNotification(params)
8
+ * └─▶ notificationObserver.dispatch(params)
9
+ * └─▶ forEach subscriber (one per mounted <Notification>):
10
+ * subscriber(params) ← registered in useEffect on mount
11
+ * └─▶ setNotifications(prev => [...prev, newItem])
12
+ * └─▶ React re-renders → NotificationItem appears in portal
13
+ *
14
+ * Multiple `<Notification>` instances can coexist (e.g. Storybook Docs view).
15
+ * Each subscribes under a unique `useId()` key so dispatches reach all of them.
16
+ */
17
+ import { DynamicNotificationParams } from './types';
18
+ export declare const notificationObserver: {
19
+ subscribe: (key: string, fn: (data: DynamicNotificationParams) => void) => void;
20
+ unsubscribe: (key: string) => void;
21
+ dispatch: (data: DynamicNotificationParams) => void;
22
+ };
23
+ export declare const showNotification: (params: DynamicNotificationParams) => void;
@@ -0,0 +1,18 @@
1
+ import { Theme } from '@emotion/react';
2
+ export { containerStyles, itemSizeStyles, itemAnimationStyles, shadowStyles, borderStyles, actionsRowStyles, closeBtnStyles, collapsedTitleStyles, } from '../styles';
3
+ import { NotificationVariants } from './types';
4
+ export interface NotificationVariantTokens {
5
+ bg: string;
6
+ iconColor: string;
7
+ borderColor: string;
8
+ textColor: string;
9
+ }
10
+ export declare const getVariantTokens: (theme: Theme, variant: NotificationVariants) => NotificationVariantTokens;
11
+ export declare const itemWrapperStyles: (background: string, hasDescription: boolean) => import("@emotion/react").SerializedStyles;
12
+ export declare const iconColStyles: import("@emotion/react").SerializedStyles;
13
+ export declare const contentColStyles: import("@emotion/react").SerializedStyles;
14
+ export declare const headerRowStyles: import("@emotion/react").SerializedStyles;
15
+ export declare const titleTextStyles: (textColor: string) => import("@emotion/react").SerializedStyles;
16
+ export declare const dateTextStyles: (theme: Theme, textColor?: string) => import("@emotion/react").SerializedStyles;
17
+ export declare const descriptionStyles: (textColor: string) => import("@emotion/react").SerializedStyles;
18
+ export declare const actionBtnStyles: (textColor: string) => import("@emotion/react").SerializedStyles;
@@ -0,0 +1,119 @@
1
+ import { CSSObject } from '@emotion/react';
2
+ import { ReactNode } from 'react';
3
+ import { DynamicProps, GlobalSharedProps } from '../types';
4
+ import { ColorsKeys } from '../../../types/emotion';
5
+ export declare enum NotificationVariants {
6
+ secondary = "secondary",
7
+ neutral = "neutral",
8
+ dark = "dark"
9
+ }
10
+ /**
11
+ * Per-slot style overrides for `<Notification>`.
12
+ *
13
+ * Cards render inside a portal, so a top-level `css` prop cannot reach inner
14
+ * elements. Use this object to customize any part of the card without touching
15
+ * the global theme.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <Notification
20
+ * styles={{
21
+ * root: { borderRadius: 4 },
22
+ * title: { fontWeight: 700 },
23
+ * date: { color: '#9ca3af' },
24
+ * }}
25
+ * />
26
+ * ```
27
+ */
28
+ export interface NotificationStyleOverrides {
29
+ /** Card wrapper — background, border-radius, padding, box-shadow, border */
30
+ root?: CSSObject;
31
+ /** Icon column wrapper div */
32
+ icon?: CSSObject;
33
+ /** Fill color for a named icon (has no effect on custom ReactNode icons) */
34
+ iconColor?: string;
35
+ /** Title element */
36
+ title?: CSSObject;
37
+ /** Date / timestamp element */
38
+ date?: CSSObject;
39
+ /** Description paragraph */
40
+ description?: CSSObject;
41
+ /** Actions row wrapper */
42
+ actions?: CSSObject;
43
+ /** Cancel and submit action buttons */
44
+ actionButton?: CSSObject;
45
+ /** Close (×) button wrapper */
46
+ closeButton?: CSSObject;
47
+ /** Fill color for the close (×) icon */
48
+ closeIconColor?: string;
49
+ }
50
+ /**
51
+ * Component-level props for the `<Notification>` portal container.
52
+ *
53
+ * Mount once near the app root; call `showNotification(...)` from anywhere.
54
+ */
55
+ export interface NotificationProps extends GlobalSharedProps {
56
+ /**
57
+ * Default auto-dismiss duration in ms for all notifications in this stack.
58
+ * Defaults to `undefined` — notifications persist until the user closes them.
59
+ * Individual notifications can override this via `showNotification`.
60
+ */
61
+ timeout?: number;
62
+ /** Per-slot style overrides applied after all default styles. */
63
+ styles?: NotificationStyleOverrides;
64
+ }
65
+ /**
66
+ * Parameters for an individual notification triggered via `showNotification(params)`.
67
+ *
68
+ * Only `variant` is required. Everything else is optional.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * // Minimal
73
+ * showNotification({ variant: NotificationVariants.default, title: 'John Doe' });
74
+ *
75
+ * // With avatar and timestamp
76
+ * showNotification({
77
+ * variant: NotificationVariants.neutral,
78
+ * title: 'Jane Smith',
79
+ * date: '5 minutes ago',
80
+ * description: 'Left a comment on your post.',
81
+ * icon: <img src={avatarUrl} alt="Jane" />,
82
+ * });
83
+ *
84
+ * // With custom color
85
+ * showNotification({
86
+ * variant: NotificationVariants.default,
87
+ * title: 'System',
88
+ * color: 'purple',
89
+ * date: 'Just now',
90
+ * });
91
+ * ```
92
+ */
93
+ export interface DynamicNotificationParams extends DynamicProps {
94
+ variant: NotificationVariants;
95
+ /**
96
+ * Pre-formatted timestamp string displayed next to the title (e.g. `"11 days ago"`).
97
+ * The component renders it as-is — no internal date formatting is applied.
98
+ */
99
+ date?: string;
100
+ /**
101
+ * Icon for the left column. Accepts:
102
+ * - A named icon string (e.g. `"user"`, `"check-circle"`) — rendered via `<Icon>`
103
+ * - Any `ReactNode` (e.g. `<img>`, `<Avatar>`) — rendered as-is
104
+ * - Omitted → falls back to the `"user"` icon
105
+ */
106
+ icon?: string | ReactNode;
107
+ /**
108
+ * Solid background color. Auto-derives text, icon, and border colors for contrast.
109
+ * Accepts a theme color key (e.g. `'purple'`) or any CSS color string.
110
+ * When provided, the variant token colors are fully ignored.
111
+ */
112
+ color?: ColorsKeys | string;
113
+ /**
114
+ * Auto-dismiss duration in ms for this specific notification.
115
+ * Overrides the component-level `timeout`.
116
+ * Pass `undefined` explicitly to keep this notification persistent.
117
+ */
118
+ timeout?: number;
119
+ }
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { ToastProps } from './types';
3
+ declare const Toast: FC<ToastProps>;
4
+ export default Toast;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @internal
3
+ *
4
+ * Renders a single toast card inside the `<Toast>` portal container.
5
+ * Not part of the public API — consumers call `showToast(params)` to trigger
6
+ * toasts and configure appearance via `<Toast>` component props.
7
+ *
8
+ * Compared to `AlertItem`, `ToastItem` adds:
9
+ * - **Auto-dismiss timer** with hover-pause support
10
+ * - **Progress bar** (`withProgress`) that drains over the toast lifetime
11
+ * - **`color` prop** driving background, text, icon, and border colors
12
+ * - **`renderProp`** for fully custom inner content
13
+ */
14
+ import { FC, JSX } from 'react';
15
+ import { NotificationPositions, NotificationSizes } from '../types';
16
+ import { ColorsKeys } from '../../../types/emotion';
17
+ import { ToastVariants } from './types';
18
+ export interface ToastItemProps {
19
+ id: string;
20
+ variant: ToastVariants;
21
+ /**
22
+ * Theme color key or arbitrary CSS color. When provided:
23
+ * - Background = resolved color
24
+ * - Text/close icon = auto-contrast (white on dark, greyDarker on light)
25
+ * - Status icon = contrast on dark bg, 35%-darkened shade on light bg
26
+ * - Border + progress bar = 35%-darkened shade
27
+ */
28
+ color?: ColorsKeys | string;
29
+ title?: string;
30
+ description?: string;
31
+ cancelText?: string;
32
+ submitText?: string;
33
+ size: NotificationSizes;
34
+ withShadow?: boolean;
35
+ withBorder?: boolean;
36
+ animationDuration: number;
37
+ position: NotificationPositions;
38
+ /** `undefined` = no auto-dismiss */
39
+ timeout?: number;
40
+ withProgress?: boolean;
41
+ /**
42
+ * Progress bar color. When provided, takes priority over the automatic
43
+ * darkened-`color` shade and the component-level `progressColor` default.
44
+ * Accepts a theme color key or any CSS color string.
45
+ */
46
+ progressColor?: string;
47
+ onClose?: () => void;
48
+ onSubmit?: () => void;
49
+ onRemove: (id: string) => void;
50
+ /** Fully replaces inner content. Outer card + progress bar still render. */
51
+ renderProp?: (close: () => void) => JSX.Element;
52
+ }
53
+ export declare const ToastItem: FC<ToastItemProps>;
@@ -0,0 +1,4 @@
1
+ export { default } from './Toast';
2
+ export { showToast } from './toastObserver';
3
+ export { ToastVariants } from './types';
4
+ export type { ToastProps, DynamicToastParams } from './types';
@@ -0,0 +1,35 @@
1
+ import { Theme } from '@emotion/react';
2
+ import type { MapIconsType } from '../../index';
3
+ import { ToastVariants } from './types';
4
+ import { ColorsKeys } from '../../../types/emotion';
5
+ export { containerStyles, itemSizeStyles, itemAnimationStyles, shadowStyles, borderStyles, iconColStyles, contentColStyles, expandedHeaderRowStyles, collapsedTitleStyles, actionsRowStyles, closeBtnStyles, } from '../styles';
6
+ export interface ToastVariantTokens {
7
+ /** Card background color */
8
+ bg: string;
9
+ /** Status icon fill */
10
+ iconColor: string;
11
+ /** Border color (used when `withBorder` is true and no custom `color` prop) */
12
+ borderColor: string;
13
+ /** Text color for title / description */
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;
22
+ }
23
+ export declare const getVariantTokens: (theme: Theme, variant: ToastVariants) => ToastVariantTokens;
24
+ export declare const variantIcons: Record<ToastVariants, keyof MapIconsType>;
25
+ export declare const itemWrapperStyles: (background: string, hasDescription: boolean) => import("@emotion/react").SerializedStyles;
26
+ export declare const titleTextStyles: (textColor: string) => import("@emotion/react").SerializedStyles;
27
+ export declare const descriptionStyles: (textColor: string) => import("@emotion/react").SerializedStyles;
28
+ export declare const actionBtnStyles: (textColor: string) => import("@emotion/react").SerializedStyles;
29
+ export declare const progressBarContainerStyles: import("@emotion/react").SerializedStyles;
30
+ /**
31
+ * Returns the base progress-bar styles including the drain animation.
32
+ * Pass `animation-play-state` separately via an inline `style` prop so the
33
+ * animation can be paused/resumed without resetting.
34
+ */
35
+ export declare const progressBarStyles: (theme: Theme, timeout: number, color: ColorsKeys) => import("@emotion/react").SerializedStyles;
@@ -0,0 +1,30 @@
1
+ import { DynamicToastParams } from './types';
2
+ export declare const toastObserver: {
3
+ subscribe: (key: string, fn: (data: DynamicToastParams) => void) => void;
4
+ unsubscribe: (key: string) => void;
5
+ dispatch: (data: DynamicToastParams) => void;
6
+ };
7
+ /**
8
+ * Imperatively triggers a new toast inside every mounted `<Toast>` component.
9
+ *
10
+ * The `<Toast>` component must be mounted somewhere in the tree (typically near
11
+ * the app root) for dispatched toasts to be displayed.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { showToast, ToastVariants } from '@ssa-ui-kit/core';
16
+ *
17
+ * // Simple
18
+ * showToast({ variant: ToastVariants.secondary, title: 'File saved' });
19
+ *
20
+ * // Semantic variant with progress bar
21
+ * showToast({ variant: ToastVariants.success, title: 'Uploading…', withProgress: true });
22
+ *
23
+ * // Fully custom content (outer card + progress bar still render)
24
+ * showToast({
25
+ * variant: ToastVariants.secondary,
26
+ * renderProp: (close) => <MyCard onDismiss={close} />,
27
+ * });
28
+ * ```
29
+ */
30
+ export declare const showToast: (params: DynamicToastParams) => void;