@abpjs/theme-shared 1.0.0 → 2.0.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/dist/components/confirmation/Confirmation.d.ts +2 -0
- package/dist/components/loader-bar/LoaderBar.d.ts +13 -1
- package/dist/components/toast/Toast.d.ts +11 -1
- package/dist/constants/styles.d.ts +6 -1
- package/dist/contexts/confirmation.context.d.ts +79 -25
- package/dist/contexts/toaster.context.d.ts +89 -18
- package/dist/index.d.ts +20 -1
- package/dist/index.js +246 -77
- package/dist/index.mjs +264 -91
- package/dist/models/common.d.ts +42 -0
- package/dist/models/confirmation.d.ts +40 -7
- package/dist/models/index.d.ts +1 -0
- package/dist/models/toaster.d.ts +56 -10
- package/package.json +6 -5
|
@@ -8,6 +8,18 @@ export interface LoaderBarProps {
|
|
|
8
8
|
url?: string;
|
|
9
9
|
method?: string;
|
|
10
10
|
}) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Interval period in milliseconds for progress bar animation.
|
|
13
|
+
* @default 300
|
|
14
|
+
* @since 1.1.0
|
|
15
|
+
*/
|
|
16
|
+
intervalPeriod?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Delay in milliseconds before hiding the progress bar after loading completes.
|
|
19
|
+
* @default 400
|
|
20
|
+
* @since 1.1.0
|
|
21
|
+
*/
|
|
22
|
+
stopDelay?: number;
|
|
11
23
|
}
|
|
12
24
|
/**
|
|
13
25
|
* A loading progress bar component that automatically shows/hides
|
|
@@ -30,5 +42,5 @@ export interface LoaderBarProps {
|
|
|
30
42
|
* />
|
|
31
43
|
* ```
|
|
32
44
|
*/
|
|
33
|
-
export declare function LoaderBar({ containerClass, progressClass, filter, }: LoaderBarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
45
|
+
export declare function LoaderBar({ containerClass, progressClass, filter, intervalPeriod, stopDelay, }: LoaderBarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
34
46
|
export default LoaderBar;
|
|
@@ -2,19 +2,27 @@ import React from 'react';
|
|
|
2
2
|
import { Toaster } from '../../models';
|
|
3
3
|
/**
|
|
4
4
|
* Get Chakra color palette for severity.
|
|
5
|
+
* @since 2.0.0 - Added 'neutral' and 'warning' support
|
|
5
6
|
*/
|
|
6
7
|
declare function getSeverityColorPalette(severity: Toaster.Severity): string;
|
|
7
8
|
/**
|
|
8
9
|
* Get background color for severity.
|
|
10
|
+
* @since 2.0.0 - Added 'neutral' and 'warning' support
|
|
9
11
|
*/
|
|
10
12
|
declare function getSeverityBg(severity: Toaster.Severity): string;
|
|
11
13
|
/**
|
|
12
14
|
* Get border color for severity.
|
|
15
|
+
* @since 2.0.0 - Added 'neutral' and 'warning' support
|
|
13
16
|
*/
|
|
14
17
|
declare function getSeverityBorderColor(severity: Toaster.Severity): string;
|
|
15
18
|
export interface ToastContainerProps {
|
|
16
19
|
/** Position of toasts */
|
|
17
20
|
position?: 'top' | 'top-right' | 'top-left' | 'bottom' | 'bottom-right' | 'bottom-left';
|
|
21
|
+
/**
|
|
22
|
+
* Container key for filtering toasts to this container
|
|
23
|
+
* @since 2.0.0
|
|
24
|
+
*/
|
|
25
|
+
containerKey?: string;
|
|
18
26
|
}
|
|
19
27
|
/**
|
|
20
28
|
* ToastContainer - Syncs toaster state with Chakra v3's toast system.
|
|
@@ -26,6 +34,8 @@ export interface ToastContainerProps {
|
|
|
26
34
|
* handle RTL languages - toasts will appear on the correct side based on
|
|
27
35
|
* the current text direction.
|
|
28
36
|
*
|
|
37
|
+
* @since 2.0.0 - Added containerKey prop for filtering toasts
|
|
38
|
+
*
|
|
29
39
|
* @example
|
|
30
40
|
* ```tsx
|
|
31
41
|
* function App() {
|
|
@@ -38,6 +48,6 @@ export interface ToastContainerProps {
|
|
|
38
48
|
* }
|
|
39
49
|
* ```
|
|
40
50
|
*/
|
|
41
|
-
export declare function ToastContainer({ position }: ToastContainerProps): React.ReactElement;
|
|
51
|
+
export declare function ToastContainer({ position, containerKey }: ToastContainerProps): React.ReactElement;
|
|
42
52
|
export { getSeverityColorPalette as getSeverityColorScheme, getSeverityBg, getSeverityBorderColor };
|
|
43
53
|
export default ToastContainer;
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* Default global styles for ABP theme shared components.
|
|
3
3
|
* These styles can be injected into your app's global CSS or used with a style tag.
|
|
4
4
|
*
|
|
5
|
+
* @since 2.0.0 - Updated styles:
|
|
6
|
+
* - Removed modal-specific styles (now handled by components)
|
|
7
|
+
* - Added sorting icon styles
|
|
8
|
+
* - Added table scrollbar width styling
|
|
9
|
+
*
|
|
5
10
|
* @example
|
|
6
11
|
* ```tsx
|
|
7
12
|
* // Option 1: Use with a style tag in your app
|
|
@@ -20,5 +25,5 @@
|
|
|
20
25
|
* // Copy the content of DEFAULT_STYLES to your styles.css
|
|
21
26
|
* ```
|
|
22
27
|
*/
|
|
23
|
-
export declare const DEFAULT_STYLES = "\n.is-invalid .form-control {\n border-color: #dc3545;\n border-style: solid !important;\n}\n\n.is-invalid .invalid-feedback,\n.is-invalid + * .invalid-feedback {\n display: block;\n}\n\n.data-tables-filter {\n text-align: right;\n}\n\n.pointer {\n cursor: pointer;\n}\n\n.navbar .dropdown-submenu a::after {\n transform: rotate(-90deg);\n position: absolute;\n right: 16px;\n top: 18px;\n}\n\n.
|
|
28
|
+
export declare const DEFAULT_STYLES = "\n.is-invalid .form-control {\n border-color: #dc3545;\n border-style: solid !important;\n}\n\n.is-invalid .invalid-feedback,\n.is-invalid + * .invalid-feedback {\n display: block;\n}\n\n.data-tables-filter {\n text-align: right;\n}\n\n.pointer {\n cursor: pointer;\n}\n\n.navbar .dropdown-submenu a::after {\n transform: rotate(-90deg);\n position: absolute;\n right: 16px;\n top: 18px;\n}\n\n.navbar .dropdown-menu {\n min-width: 215px;\n}\n\n.ui-table-scrollable-body::-webkit-scrollbar {\n height: 5px !important;\n width: 5px !important;\n}\n\n.ui-table-scrollable-body::-webkit-scrollbar-track {\n background: #ddd;\n}\n\n.ui-table-scrollable-body::-webkit-scrollbar-thumb {\n background: #8a8686;\n}\n\n.abp-ellipsis-inline {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.abp-ellipsis {\n overflow: hidden !important;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ui-widget-overlay {\n z-index: 1000;\n}\n\n.color-white {\n color: #FFF !important;\n}\n\n.custom-checkbox > label {\n cursor: pointer;\n}\n\n/* <animations */\n\n.fade-in-top {\n animation: fadeInTop 0.2s ease-in-out;\n}\n\n.fade-out-top {\n animation: fadeOutTop 0.2s ease-in-out;\n}\n\n.abp-collapsed-height {\n -moz-transition: max-height linear 0.35s;\n -ms-transition: max-height linear 0.35s;\n -o-transition: max-height linear 0.35s;\n -webkit-transition: max-height linear 0.35s;\n overflow:hidden;\n transition:max-height 0.35s linear;\n height:auto;\n max-height: 0;\n}\n\n.abp-mh-25 {\n max-height: 25vh;\n}\n\n.abp-mh-50 {\n transition:max-height 0.65s linear;\n max-height: 50vh;\n}\n\n.abp-mh-75 {\n transition:max-height 0.85s linear;\n max-height: 75vh;\n}\n\n.abp-mh-100 {\n transition:max-height 1s linear;\n max-height: 100vh;\n}\n\n/* Sorting icon styles - @since 2.0.0 */\n[class^=\"sorting\"] {\n opacity: .3;\n cursor: pointer;\n}\n[class^=\"sorting\"]:before {\n right: 0.5rem;\n content: \"\u2191\";\n}\n[class^=\"sorting\"]:after {\n right: 0.5rem;\n content: \"\u2193\";\n}\n\n.sorting_desc {\n opacity: 1;\n}\n.sorting_desc:before {\n opacity: .3;\n}\n\n.sorting_asc {\n opacity: 1;\n}\n.sorting_asc:after {\n opacity: .3;\n}\n\n@keyframes fadeInTop {\n from {\n transform: translateY(-5px);\n opacity: 0;\n }\n\n to {\n transform: translateY(0px);\n opacity: 1;\n }\n}\n\n@keyframes fadeOutTop {\n to {\n transform: translateY(-5px);\n opacity: 0;\n }\n}\n\n/* </animations */\n\n/* Loader bar styles */\n.abp-loader-bar {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: 3px;\n z-index: 9999;\n background-color: rgba(0, 0, 0, 0.1);\n overflow: hidden;\n}\n\n.abp-progress {\n height: 100%;\n background-color: #3182ce;\n transition: width 0.3s ease-out;\n}\n";
|
|
24
29
|
export default DEFAULT_STYLES;
|
|
@@ -1,41 +1,86 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { Config } from '@abpjs/core';
|
|
2
3
|
import { Confirmation, Toaster } from '../models';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Subscriber callback type for confirmation$ observable pattern
|
|
6
|
+
* @since 2.0.0
|
|
5
7
|
*/
|
|
6
|
-
|
|
7
|
-
/** Unique ID for this confirmation */
|
|
8
|
-
id: string;
|
|
9
|
-
/** Message content (can be localization key) */
|
|
10
|
-
message: string;
|
|
11
|
-
/** Title (can be localization key) */
|
|
12
|
-
title?: string;
|
|
13
|
-
/** Severity level affects the styling */
|
|
14
|
-
severity: Toaster.Severity;
|
|
15
|
-
/** Options for the confirmation */
|
|
16
|
-
options: Confirmation.Options;
|
|
17
|
-
}
|
|
8
|
+
type ConfirmationSubscriber = (data: Confirmation.DialogData | null) => void;
|
|
18
9
|
/**
|
|
19
10
|
* ConfirmationService interface - matches the Angular service API.
|
|
11
|
+
* @since 2.0.0 - Major changes:
|
|
12
|
+
* - No longer extends AbstractToaster
|
|
13
|
+
* - Added confirmation$ ReplaySubject pattern via subscribe method
|
|
14
|
+
* - Now accepts Config.LocalizationParam for message and title
|
|
20
15
|
*/
|
|
21
16
|
export interface ConfirmationService {
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Show an info confirmation
|
|
19
|
+
* @param message Message content (supports localization)
|
|
20
|
+
* @param title Title (supports localization)
|
|
21
|
+
* @param options Confirmation options
|
|
22
|
+
* @returns Promise resolving to user's response status
|
|
23
|
+
*/
|
|
24
|
+
info(message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Confirmation.Options>): Promise<Toaster.Status>;
|
|
25
|
+
/**
|
|
26
|
+
* Show a success confirmation
|
|
27
|
+
* @param message Message content (supports localization)
|
|
28
|
+
* @param title Title (supports localization)
|
|
29
|
+
* @param options Confirmation options
|
|
30
|
+
* @returns Promise resolving to user's response status
|
|
31
|
+
*/
|
|
32
|
+
success(message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Confirmation.Options>): Promise<Toaster.Status>;
|
|
33
|
+
/**
|
|
34
|
+
* Show a warning confirmation
|
|
35
|
+
* @param message Message content (supports localization)
|
|
36
|
+
* @param title Title (supports localization)
|
|
37
|
+
* @param options Confirmation options
|
|
38
|
+
* @returns Promise resolving to user's response status
|
|
39
|
+
*/
|
|
40
|
+
warn(message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Confirmation.Options>): Promise<Toaster.Status>;
|
|
41
|
+
/**
|
|
42
|
+
* Show an error confirmation
|
|
43
|
+
* @param message Message content (supports localization)
|
|
44
|
+
* @param title Title (supports localization)
|
|
45
|
+
* @param options Confirmation options
|
|
46
|
+
* @returns Promise resolving to user's response status
|
|
47
|
+
*/
|
|
48
|
+
error(message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Confirmation.Options>): Promise<Toaster.Status>;
|
|
49
|
+
/**
|
|
50
|
+
* Show a confirmation with specified severity
|
|
51
|
+
* @param message Message content (supports localization)
|
|
52
|
+
* @param title Title (supports localization)
|
|
53
|
+
* @param severity Severity level for styling
|
|
54
|
+
* @param options Confirmation options
|
|
55
|
+
* @returns Promise resolving to user's response status
|
|
56
|
+
* @since 2.0.0
|
|
57
|
+
*/
|
|
58
|
+
show(message: Config.LocalizationParam, title?: Config.LocalizationParam, severity?: Confirmation.Severity, options?: Partial<Confirmation.Options>): Promise<Toaster.Status>;
|
|
59
|
+
/**
|
|
60
|
+
* Clear the current confirmation
|
|
61
|
+
* @param status Optional status to resolve with (default: dismiss)
|
|
62
|
+
*/
|
|
31
63
|
clear(status?: Toaster.Status): void;
|
|
64
|
+
/**
|
|
65
|
+
* Listen for escape key to dismiss confirmation
|
|
66
|
+
* @since 2.0.0
|
|
67
|
+
*/
|
|
68
|
+
listenToEscape(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Subscribe to confirmation updates (mimics RxJS ReplaySubject pattern).
|
|
71
|
+
* @param subscriber Callback function called with current confirmation data
|
|
72
|
+
* @returns Unsubscribe function
|
|
73
|
+
* @since 2.0.0
|
|
74
|
+
*/
|
|
75
|
+
subscribe(subscriber: ConfirmationSubscriber): () => void;
|
|
32
76
|
}
|
|
33
77
|
/**
|
|
34
78
|
* Context value containing the service and current confirmation.
|
|
35
79
|
*/
|
|
36
80
|
export interface ConfirmationContextValue {
|
|
37
81
|
service: ConfirmationService;
|
|
38
|
-
confirmation
|
|
82
|
+
/** Current confirmation dialog data */
|
|
83
|
+
confirmation: Confirmation.DialogData | null;
|
|
39
84
|
/** Respond to the current confirmation */
|
|
40
85
|
respond: (status: Toaster.Status) => void;
|
|
41
86
|
}
|
|
@@ -48,6 +93,12 @@ export interface ConfirmationProviderProps {
|
|
|
48
93
|
* This is the React equivalent of Angular's ConfirmationService.
|
|
49
94
|
* Wrap your app with this provider to enable confirmation dialogs.
|
|
50
95
|
*
|
|
96
|
+
* @since 2.0.0 - Major changes:
|
|
97
|
+
* - Now accepts Config.LocalizationParam for message and title
|
|
98
|
+
* - Added subscribe method for observable pattern
|
|
99
|
+
* - Added listenToEscape method
|
|
100
|
+
* - Uses Confirmation.DialogData structure
|
|
101
|
+
*
|
|
51
102
|
* @example
|
|
52
103
|
* ```tsx
|
|
53
104
|
* <ConfirmationProvider>
|
|
@@ -63,6 +114,8 @@ export declare function ConfirmationProvider({ children }: ConfirmationProviderP
|
|
|
63
114
|
* @returns ConfirmationService with methods to show confirmation dialogs
|
|
64
115
|
* @throws Error if used outside of ConfirmationProvider
|
|
65
116
|
*
|
|
117
|
+
* @since 2.0.0 - Service now accepts Config.LocalizationParam
|
|
118
|
+
*
|
|
66
119
|
* @example
|
|
67
120
|
* ```tsx
|
|
68
121
|
* function MyComponent() {
|
|
@@ -72,7 +125,7 @@ export declare function ConfirmationProvider({ children }: ConfirmationProviderP
|
|
|
72
125
|
* const status = await confirmation.warn(
|
|
73
126
|
* 'Are you sure you want to delete this item?',
|
|
74
127
|
* 'Confirm Delete',
|
|
75
|
-
* {
|
|
128
|
+
* { yesText: 'Delete', cancelText: 'Cancel' }
|
|
76
129
|
* );
|
|
77
130
|
*
|
|
78
131
|
* if (status === Toaster.Status.confirm) {
|
|
@@ -89,7 +142,7 @@ export declare function useConfirmation(): ConfirmationService;
|
|
|
89
142
|
* Hook to access the current confirmation state.
|
|
90
143
|
* This is typically used by the ConfirmationDialog component.
|
|
91
144
|
*
|
|
92
|
-
* @returns Current confirmation
|
|
145
|
+
* @returns Current confirmation data and respond function
|
|
93
146
|
*/
|
|
94
147
|
export declare function useConfirmationState(): Pick<ConfirmationContextValue, 'confirmation' | 'respond'>;
|
|
95
148
|
/**
|
|
@@ -98,3 +151,4 @@ export declare function useConfirmationState(): Pick<ConfirmationContextValue, '
|
|
|
98
151
|
* @returns ConfirmationContextValue with service, confirmation, and respond
|
|
99
152
|
*/
|
|
100
153
|
export declare function useConfirmationContext(): ConfirmationContextValue;
|
|
154
|
+
export {};
|
|
@@ -1,29 +1,92 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { Config } from '@abpjs/core';
|
|
2
3
|
import { Toaster } from '../models';
|
|
3
4
|
/**
|
|
4
|
-
* Internal toast
|
|
5
|
+
* Internal toast with numeric ID for tracking.
|
|
6
|
+
* @since 2.0.0 - Uses Toaster.Toast structure with numeric ID
|
|
5
7
|
*/
|
|
6
|
-
interface InternalToast extends Toaster.
|
|
7
|
-
|
|
8
|
+
interface InternalToast extends Toaster.Toast {
|
|
9
|
+
/** Numeric ID assigned by the service */
|
|
10
|
+
id: number;
|
|
8
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Subscriber callback type for toasts$ observable pattern
|
|
14
|
+
* @since 2.0.0
|
|
15
|
+
*/
|
|
16
|
+
type ToastsSubscriber = (toasts: Toaster.Toast[]) => void;
|
|
9
17
|
/**
|
|
10
18
|
* ToasterService interface - matches the Angular service API.
|
|
19
|
+
* @since 2.0.0 - Major changes:
|
|
20
|
+
* - Methods now return number (toast ID) instead of Observable<Status>
|
|
21
|
+
* - Added toasts$ ReplaySubject pattern via subscribe method
|
|
22
|
+
* - Removed addAll method (use show directly)
|
|
11
23
|
*/
|
|
12
24
|
export interface ToasterService {
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Creates an info toast with given parameters.
|
|
27
|
+
* @param message Content of the toast
|
|
28
|
+
* @param title Title of the toast
|
|
29
|
+
* @param options Specific style or structural options for individual toast
|
|
30
|
+
* @returns Toast ID
|
|
31
|
+
* @since 2.0.0 - Now returns number instead of Promise<Status>
|
|
32
|
+
*/
|
|
33
|
+
info(message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Toaster.ToastOptions>): number;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a success toast with given parameters.
|
|
36
|
+
* @param message Content of the toast
|
|
37
|
+
* @param title Title of the toast
|
|
38
|
+
* @param options Specific style or structural options for individual toast
|
|
39
|
+
* @returns Toast ID
|
|
40
|
+
* @since 2.0.0 - Now returns number instead of Promise<Status>
|
|
41
|
+
*/
|
|
42
|
+
success(message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Toaster.ToastOptions>): number;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a warning toast with given parameters.
|
|
45
|
+
* @param message Content of the toast
|
|
46
|
+
* @param title Title of the toast
|
|
47
|
+
* @param options Specific style or structural options for individual toast
|
|
48
|
+
* @returns Toast ID
|
|
49
|
+
* @since 2.0.0 - Now returns number instead of Promise<Status>
|
|
50
|
+
*/
|
|
51
|
+
warn(message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Toaster.ToastOptions>): number;
|
|
52
|
+
/**
|
|
53
|
+
* Creates an error toast with given parameters.
|
|
54
|
+
* @param message Content of the toast
|
|
55
|
+
* @param title Title of the toast
|
|
56
|
+
* @param options Specific style or structural options for individual toast
|
|
57
|
+
* @returns Toast ID
|
|
58
|
+
* @since 2.0.0 - Now returns number instead of Promise<Status>
|
|
59
|
+
*/
|
|
60
|
+
error(message: Config.LocalizationParam, title?: Config.LocalizationParam, options?: Partial<Toaster.ToastOptions>): number;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a toast with given parameters.
|
|
63
|
+
* @param message Content of the toast
|
|
64
|
+
* @param title Title of the toast
|
|
65
|
+
* @param severity Sets color of the toast. "success", "warning" etc.
|
|
66
|
+
* @param options Specific style or structural options for individual toast
|
|
67
|
+
* @returns Toast ID
|
|
68
|
+
* @since 2.0.0
|
|
69
|
+
*/
|
|
70
|
+
show(message: Config.LocalizationParam, title?: Config.LocalizationParam, severity?: Toaster.Severity, options?: Partial<Toaster.ToastOptions>): number;
|
|
71
|
+
/**
|
|
72
|
+
* Removes the toast with given id.
|
|
73
|
+
* @param id ID of the toast to be removed.
|
|
74
|
+
* @since 2.0.0
|
|
75
|
+
*/
|
|
76
|
+
remove(id: number): void;
|
|
77
|
+
/**
|
|
78
|
+
* Removes all open toasts at once.
|
|
79
|
+
* @param key Optional container key to clear toasts from specific container
|
|
80
|
+
* @since 2.0.0
|
|
81
|
+
*/
|
|
82
|
+
clear(key?: string): void;
|
|
83
|
+
/**
|
|
84
|
+
* Subscribe to toast updates (mimics RxJS ReplaySubject pattern).
|
|
85
|
+
* @param subscriber Callback function called with current toasts
|
|
86
|
+
* @returns Unsubscribe function
|
|
87
|
+
* @since 2.0.0
|
|
88
|
+
*/
|
|
89
|
+
subscribe(subscriber: ToastsSubscriber): () => void;
|
|
27
90
|
}
|
|
28
91
|
/**
|
|
29
92
|
* Context value containing the service and current toasts.
|
|
@@ -41,6 +104,11 @@ export interface ToasterProviderProps {
|
|
|
41
104
|
* This is the React equivalent of Angular's ToasterService.
|
|
42
105
|
* Wrap your app with this provider to enable toast notifications.
|
|
43
106
|
*
|
|
107
|
+
* @since 2.0.0 - Major changes:
|
|
108
|
+
* - Methods now return number (toast ID) instead of Promise<Status>
|
|
109
|
+
* - Added subscribe method for observable pattern
|
|
110
|
+
* - Severity 'warn' changed to 'warning'
|
|
111
|
+
*
|
|
44
112
|
* @example
|
|
45
113
|
* ```tsx
|
|
46
114
|
* <ToasterProvider>
|
|
@@ -56,6 +124,8 @@ export declare function ToasterProvider({ children }: ToasterProviderProps): Rea
|
|
|
56
124
|
* @returns ToasterService with methods to show toast notifications
|
|
57
125
|
* @throws Error if used outside of ToasterProvider
|
|
58
126
|
*
|
|
127
|
+
* @since 2.0.0 - Service methods now return number (toast ID)
|
|
128
|
+
*
|
|
59
129
|
* @example
|
|
60
130
|
* ```tsx
|
|
61
131
|
* function MyComponent() {
|
|
@@ -64,7 +134,8 @@ export declare function ToasterProvider({ children }: ToasterProviderProps): Rea
|
|
|
64
134
|
* const handleSave = async () => {
|
|
65
135
|
* try {
|
|
66
136
|
* await saveData();
|
|
67
|
-
* toaster.success('Data saved successfully!', 'Success');
|
|
137
|
+
* const toastId = toaster.success('Data saved successfully!', 'Success');
|
|
138
|
+
* // Can later remove: toaster.remove(toastId);
|
|
68
139
|
* } catch (error) {
|
|
69
140
|
* toaster.error('Failed to save data', 'Error');
|
|
70
141
|
* }
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,30 @@
|
|
|
2
2
|
* @abpjs/theme-shared
|
|
3
3
|
*
|
|
4
4
|
* ABP Framework Theme Shared components for React.
|
|
5
|
-
* Translated from @abp/ng.theme.shared
|
|
5
|
+
* Translated from @abp/ng.theme.shared v2.0.0
|
|
6
6
|
*
|
|
7
7
|
* This package provides shared UI components, services, and utilities
|
|
8
8
|
* for theme/modal management in ABP Framework React applications.
|
|
9
9
|
*
|
|
10
|
+
* New in v2.0.0:
|
|
11
|
+
* - ToasterService: Methods now return number (toast ID) instead of Promise<Status>
|
|
12
|
+
* - ToasterService: Added subscribe() method for observable pattern
|
|
13
|
+
* - ToasterService: Removed addAll method (use show directly)
|
|
14
|
+
* - Toaster.Options renamed to Toaster.ToastOptions
|
|
15
|
+
* - New Toaster.Toast interface
|
|
16
|
+
* - Toaster.Severity: Changed 'warn' to 'warning', added 'neutral'
|
|
17
|
+
* - Confirmation.Options: No longer extends Toaster.Options
|
|
18
|
+
* - Confirmation: Added DialogData interface and Severity type
|
|
19
|
+
* - Confirmation.Options: Removed deprecated cancelCopy/yesCopy
|
|
20
|
+
* - ConfirmationService: Added show(), listenToEscape(), subscribe() methods
|
|
21
|
+
* - Updated styles with sorting icon classes
|
|
22
|
+
*
|
|
23
|
+
* New in v1.1.0:
|
|
24
|
+
* - ToasterService now accepts Config.LocalizationParam for message and title
|
|
25
|
+
* - Confirmation.Options: Added cancelText/yesText (deprecated cancelCopy/yesCopy)
|
|
26
|
+
* - New HttpErrorConfig types for custom error screen configuration
|
|
27
|
+
* - LoaderBar: Added intervalPeriod and stopDelay props
|
|
28
|
+
*
|
|
10
29
|
* New in v0.9.0:
|
|
11
30
|
* - ChangePassword component (moved from theme-basic)
|
|
12
31
|
* - Profile component (moved from theme-basic)
|