@abpjs/theme-shared 0.7.6 → 0.8.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/errors/ErrorComponent.d.ts +35 -0
- package/dist/components/errors/index.d.ts +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/loader-bar/LoaderBar.d.ts +34 -0
- package/dist/components/loader-bar/index.d.ts +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/styles.d.ts +24 -0
- package/dist/handlers/error.handler.d.ts +14 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +320 -83
- package/dist/index.mjs +294 -60
- package/package.json +3 -3
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface ErrorComponentProps {
|
|
2
|
+
/** Error title (e.g., "404", "500", "Error") */
|
|
3
|
+
title?: string;
|
|
4
|
+
/** Error details/message */
|
|
5
|
+
details?: string;
|
|
6
|
+
/** Callback when user wants to dismiss/destroy the error display */
|
|
7
|
+
onDestroy?: () => void;
|
|
8
|
+
/** Whether to show a close/back button */
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
/** Custom close button text */
|
|
11
|
+
closeButtonText?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A component for displaying error pages/messages.
|
|
15
|
+
* Can be used for HTTP errors (404, 500, etc.) or general error states.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* // Basic error display
|
|
20
|
+
* <ErrorComponent
|
|
21
|
+
* title="404"
|
|
22
|
+
* details="The page you are looking for was not found."
|
|
23
|
+
* />
|
|
24
|
+
*
|
|
25
|
+
* // With close button
|
|
26
|
+
* <ErrorComponent
|
|
27
|
+
* title="Error"
|
|
28
|
+
* details="Something went wrong."
|
|
29
|
+
* showCloseButton
|
|
30
|
+
* onDestroy={() => navigate('/')}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function ErrorComponent({ title, details, onDestroy, showCloseButton, closeButtonText, }: ErrorComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export default ErrorComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ErrorComponent';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface LoaderBarProps {
|
|
2
|
+
/** CSS class for the container element */
|
|
3
|
+
containerClass?: string;
|
|
4
|
+
/** CSS class for the progress bar element */
|
|
5
|
+
progressClass?: string;
|
|
6
|
+
/** Custom filter function to determine if loading should be shown */
|
|
7
|
+
filter?: (request: {
|
|
8
|
+
url?: string;
|
|
9
|
+
method?: string;
|
|
10
|
+
}) => boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A loading progress bar component that automatically shows/hides
|
|
14
|
+
* based on HTTP request activity tracked by the loader state.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Basic usage - place in your layout
|
|
19
|
+
* <LoaderBar />
|
|
20
|
+
*
|
|
21
|
+
* // With custom classes
|
|
22
|
+
* <LoaderBar
|
|
23
|
+
* containerClass="my-loader-container"
|
|
24
|
+
* progressClass="my-progress-bar"
|
|
25
|
+
* />
|
|
26
|
+
*
|
|
27
|
+
* // With filter to only show for specific requests
|
|
28
|
+
* <LoaderBar
|
|
29
|
+
* filter={(req) => !req.url?.includes('/api/silent')}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function LoaderBar({ containerClass, progressClass, filter, }: LoaderBarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
34
|
+
export default LoaderBar;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LoaderBar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './styles';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default global styles for ABP theme shared components.
|
|
3
|
+
* These styles can be injected into your app's global CSS or used with a style tag.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* // Option 1: Use with a style tag in your app
|
|
8
|
+
* import { DEFAULT_STYLES } from '@abpjs/theme-shared';
|
|
9
|
+
*
|
|
10
|
+
* function App() {
|
|
11
|
+
* return (
|
|
12
|
+
* <>
|
|
13
|
+
* <style>{DEFAULT_STYLES}</style>
|
|
14
|
+
* <YourApp />
|
|
15
|
+
* </>
|
|
16
|
+
* );
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* // Option 2: Add to your global CSS file
|
|
20
|
+
* // Copy the content of DEFAULT_STYLES to your styles.css
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
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.modal {\n background-color: rgba(0, 0, 0, .6);\n}\n\n.abp-ellipsis {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* <animations */\n\n.fade-in-top {\n animation: fadeInTop 0.4s ease-in-out;\n}\n\n.fade-out-top {\n animation: fadeOutTop 0.4s ease-in-out;\n}\n\n@keyframes fadeInTop {\n from {\n transform: translateY(-5px);\n opacity: 0;\n }\n\n to {\n transform: translateY(5px);\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
|
+
export default DEFAULT_STYLES;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Toaster } from '../models';
|
|
2
|
+
import { ErrorComponentProps } from '../components/errors/ErrorComponent';
|
|
2
3
|
type NavigateFunction = (to: string) => void;
|
|
3
4
|
/**
|
|
4
5
|
* HTTP error response structure (matching ABP error format).
|
|
@@ -18,6 +19,13 @@ export interface HttpErrorResponse {
|
|
|
18
19
|
};
|
|
19
20
|
};
|
|
20
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Error component instance configuration.
|
|
24
|
+
*/
|
|
25
|
+
export interface ErrorComponentInstance {
|
|
26
|
+
title: string;
|
|
27
|
+
details: string;
|
|
28
|
+
}
|
|
21
29
|
/**
|
|
22
30
|
* Error handler interface.
|
|
23
31
|
*/
|
|
@@ -28,6 +36,12 @@ export interface ErrorHandler {
|
|
|
28
36
|
showError: (message: string, title?: string) => Promise<Toaster.Status>;
|
|
29
37
|
/** Navigate to the login page */
|
|
30
38
|
navigateToLogin: () => void;
|
|
39
|
+
/** Create error component props for full-page error display */
|
|
40
|
+
createErrorComponent: (instance: Partial<ErrorComponentInstance>) => ErrorComponentProps;
|
|
41
|
+
/** Current error component props (null if no error) */
|
|
42
|
+
errorComponentProps: ErrorComponentProps | null;
|
|
43
|
+
/** Clear the current error component */
|
|
44
|
+
clearErrorComponent: () => void;
|
|
31
45
|
}
|
|
32
46
|
export interface UseErrorHandlerOptions {
|
|
33
47
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* @abpjs/theme-shared
|
|
3
3
|
*
|
|
4
4
|
* ABP Framework Theme Shared components for React.
|
|
5
|
-
* Translated from @abp/ng.theme.shared v0.
|
|
5
|
+
* Translated from @abp/ng.theme.shared v0.8.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
10
|
export * from './models';
|
|
11
|
+
export * from './constants';
|
|
11
12
|
export * from './contexts';
|
|
12
13
|
export * from './hooks';
|
|
13
14
|
export * from './components';
|