@ssa-ui-kit/core 3.8.0 → 3.9.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.
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 +26 -0
  20. package/dist/components/NotificationComponents/Toast/toastObserver.d.ts +30 -0
  21. package/dist/components/NotificationComponents/Toast/types.d.ts +102 -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 +22 -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 +1772 -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,102 @@
1
+ import { JSX } from 'react';
2
+ import { GlobalSharedProps, DynamicProps } from '../types';
3
+ import { ColorsKeys } from '../../../types/emotion';
4
+ export declare enum ToastVariants {
5
+ secondary = "secondary",
6
+ neutral = "neutral",
7
+ dark = "dark"
8
+ }
9
+ /**
10
+ * Component-level props for the `<Toast>` portal container.
11
+ *
12
+ * Mount once near the app root; call `showToast(...)` from anywhere.
13
+ */
14
+ export interface ToastProps extends GlobalSharedProps {
15
+ /**
16
+ * Show an animated progress bar that drains over the toast's lifetime.
17
+ * Has no effect when `timeout` is `undefined`.
18
+ * @default false
19
+ */
20
+ withProgress?: boolean;
21
+ /**
22
+ * Default auto-dismiss duration in ms for all toasts in this stack.
23
+ * Pass `undefined` to disable auto-dismiss entirely.
24
+ * Individual toasts can override this via `showToast`.
25
+ * @default 4000
26
+ */
27
+ timeout?: number;
28
+ /**
29
+ * Default color of the progress bar for all toasts in this stack.
30
+ * Accepts a theme color key (`ColorsKeys`) or any valid CSS color string.
31
+ * Individual toasts can override this via `showToast({ progressColor })`.
32
+ * When a toast uses the `color` prop the progress bar automatically uses
33
+ * the darkened shade of that color instead of this default.
34
+ * @default theme `blueNotification`
35
+ */
36
+ progressColor?: ColorsKeys | string;
37
+ }
38
+ /**
39
+ * Parameters for an individual toast triggered via `showToast(params)`.
40
+ *
41
+ * Only `variant` is required. Everything else is optional.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * // Minimal
46
+ * showToast({ variant: ToastVariants.default, title: 'Saved!' });
47
+ *
48
+ * // With color, custom timeout, and progress bar
49
+ * showToast({
50
+ * variant: ToastVariants.default,
51
+ * title: 'Uploading…',
52
+ * color: 'purple',
53
+ * timeout: 8000,
54
+ * withProgress: true,
55
+ * });
56
+ *
57
+ * // Fully custom content
58
+ * showToast({
59
+ * variant: ToastVariants.default,
60
+ * renderProp: (close) => <MyCustomCard onDismiss={close} />,
61
+ * });
62
+ * ```
63
+ */
64
+ export interface DynamicToastParams extends DynamicProps {
65
+ variant: ToastVariants;
66
+ /**
67
+ * Theme color key (e.g. `'blue'`, `'green'`) or any valid CSS color string.
68
+ * When provided:
69
+ * - Background = resolved color value
70
+ * - Text = auto-contrast (white on dark, `greyDarker` on light)
71
+ * - Icon = same as text on dark bg, or a 35%-darkened shade on light bg
72
+ * - Border (when `withBorder`) = 35%-darkened shade
73
+ * - Progress bar = 35%-darkened shade
74
+ */
75
+ color?: ColorsKeys | string;
76
+ /**
77
+ * Fully replaces the inner content of the toast card.
78
+ * The outer wrapper (background, shadow, border, rounded corners) and the
79
+ * progress bar still render. Receives a `close` callback to allow the custom
80
+ * content to dismiss the toast programmatically.
81
+ */
82
+ renderProp?: (close: () => void) => JSX.Element;
83
+ /**
84
+ * Show progress bar for this specific toast.
85
+ * Overrides the component-level `withProgress`.
86
+ * Has no effect when the effective `timeout` is `undefined`.
87
+ */
88
+ withProgress?: boolean;
89
+ /**
90
+ * Auto-dismiss duration in ms for this specific toast.
91
+ * Overrides the component-level `timeout`.
92
+ * Pass `undefined` explicitly to disable auto-dismiss for this toast only.
93
+ */
94
+ timeout?: number;
95
+ /**
96
+ * Color of the progress bar for this specific toast.
97
+ * Overrides both the component-level `progressColor` default and the
98
+ * automatic darkened-`color` shade.
99
+ * Accepts a theme color key (`ColorsKeys`) or any valid CSS color string.
100
+ */
101
+ progressColor?: ColorsKeys | string;
102
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Manages an auto-dismiss timer with hover-pause support.
3
+ *
4
+ * When `timeout` is `undefined` no timer is set and the item stays visible
5
+ * until the consumer removes it manually.
6
+ *
7
+ * When the user hovers over the card the timer pauses and resumes from where
8
+ * it left off when they move away — `remainingRef` tracks the elapsed time so
9
+ * the full `timeout` is never restarted from scratch after a hover.
10
+ *
11
+ * @param timeout Auto-dismiss duration in ms. `undefined` = no auto-dismiss.
12
+ * @param onDismiss Called once when the timer fires naturally (not on manual close).
13
+ *
14
+ * @returns
15
+ * - `isPaused` — whether the timer is currently paused (hover active).
16
+ * `ToastItem` uses this to pause the CSS progress bar animation.
17
+ * - `handleMouseEnter` — attach to the card's `onMouseEnter`.
18
+ * - `handleMouseLeave` — attach to the card's `onMouseLeave`.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * const { isPaused, handleMouseEnter, handleMouseLeave } = useAutoDismiss(
23
+ * timeout,
24
+ * () => { onRemove(id); onClose?.(); },
25
+ * );
26
+ * ```
27
+ */
28
+ export declare const useAutoDismiss: (timeout: number | undefined, onDismiss: () => void) => {
29
+ isPaused: boolean;
30
+ handleMouseEnter: () => void;
31
+ handleMouseLeave: () => void;
32
+ };
@@ -0,0 +1,8 @@
1
+ export { default as Alert, showAlert, AlertVariants } from './Alert';
2
+ export type { AlertProps, AlertStyleOverrides, DynamicAlertParams, } from './Alert';
3
+ export { default as Toast, showToast, ToastVariants } from './Toast';
4
+ export type { ToastProps, DynamicToastParams } from './Toast';
5
+ export { default as Notification, showNotification, NotificationVariants, } from './Notification';
6
+ export type { NotificationProps, NotificationStyleOverrides, DynamicNotificationParams, } from './Notification';
7
+ export { NotificationPositions, NotificationSizes } from './types';
8
+ export type { SharedProps as NotificationSharedProps, DynamicProps as NotificationDynamicProps, GlobalSharedProps as NotificationGlobalSharedProps, } from './types';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Shared structural styles for notification components (Alert, Toast, …).
3
+ *
4
+ * Everything here is purely layout / animation with no semantic color
5
+ * meaning — safe to import from any notification component.
6
+ *
7
+ * Component-specific styles (variant tokens, item wrapper, text colors)
8
+ * live in each component's own `styles.ts`.
9
+ */
10
+ import { SerializedStyles, Theme } from '@emotion/react';
11
+ import { NotificationPositions, NotificationSizes } from './types';
12
+ export declare const containerStyles: (position: NotificationPositions) => SerializedStyles;
13
+ export declare const itemSizeStyles: Record<NotificationSizes, SerializedStyles>;
14
+ export declare const itemAnimationStyles: (position: NotificationPositions, duration: number) => SerializedStyles;
15
+ export declare const shadowStyles: (theme: Theme) => SerializedStyles;
16
+ export declare const borderStyles: (borderColor: string) => SerializedStyles;
17
+ export declare const iconColStyles: SerializedStyles;
18
+ export declare const contentColStyles: SerializedStyles;
19
+ export declare const expandedHeaderRowStyles: SerializedStyles;
20
+ export declare const collapsedTitleStyles: SerializedStyles;
21
+ export declare const actionsRowStyles: SerializedStyles;
22
+ export declare const closeBtnStyles: SerializedStyles;
@@ -0,0 +1,38 @@
1
+ export declare enum NotificationPositions {
2
+ centerTop = "center-top",
3
+ centerBottom = "center-bottom",
4
+ leftTop = "left-top",
5
+ leftBottom = "left-bottom",
6
+ rightTop = "right-top",
7
+ rightBottom = "right-bottom"
8
+ }
9
+ export declare enum NotificationSizes {
10
+ small = "small",
11
+ large = "large"
12
+ }
13
+ export interface SharedProps {
14
+ size?: NotificationSizes;
15
+ cancelText?: string;
16
+ submitText?: string;
17
+ }
18
+ export interface DynamicProps extends SharedProps {
19
+ title?: string;
20
+ description?: string;
21
+ onClose?: () => void;
22
+ onSubmit?: () => void;
23
+ }
24
+ export interface GlobalSharedProps extends SharedProps {
25
+ animationDuration?: number;
26
+ withShadow?: boolean;
27
+ withBorder?: boolean;
28
+ containerSelector?: string;
29
+ position?: NotificationPositions;
30
+ /**
31
+ * Maximum number of notifications visible at once.
32
+ * When a new notification arrives and the stack is already at the limit,
33
+ * the oldest one is removed to make room — top positions drop from the
34
+ * bottom of the stack, bottom positions drop from the top.
35
+ * No limit when omitted.
36
+ */
37
+ maxAmount?: number;
38
+ }
@@ -139,6 +139,7 @@ export { default as TooltipTrigger } from './TooltipTrigger';
139
139
  export * from './Popover';
140
140
  export * from './NotificationCard';
141
141
  export * from './NotificationMenu';
142
+ export * from './NotificationComponents';
142
143
  export * from './AccordionGroup';
143
144
  export * from './AddNewAccountCard';
144
145
  export * from './PersonInfo';