@abpjs/theme-shared 2.4.0 → 2.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.
- package/dist/components/errors/ErrorComponent.d.ts +27 -1
- package/dist/constants/styles.d.ts +9 -1
- package/dist/contexts/index.d.ts +1 -0
- package/dist/contexts/modal.context.d.ts +139 -0
- package/dist/handlers/index.d.ts +1 -0
- package/dist/handlers/lazy-style.handler.d.ts +96 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +657 -271
- package/dist/index.mjs +554 -189
- package/dist/models/common.d.ts +16 -1
- package/dist/models/confirmation.d.ts +12 -2
- package/dist/tokens/append-content.token.d.ts +7 -0
- package/dist/tokens/http-error.token.d.ts +70 -0
- package/dist/tokens/index.d.ts +10 -0
- package/dist/tokens/lazy-styles.token.d.ts +38 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/nav-items.d.ts +110 -0
- package/dist/utils/validation-utils.d.ts +125 -0
- package/package.json +3 -3
|
@@ -9,11 +9,29 @@ export interface ErrorComponentProps {
|
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
10
|
/** Custom close button text */
|
|
11
11
|
closeButtonText?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether to show the home button.
|
|
14
|
+
* When true, shows a "Go Home" button alongside or instead of the close button.
|
|
15
|
+
* @since 2.7.0
|
|
16
|
+
*/
|
|
17
|
+
isHomeShow?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Callback when user clicks the home button.
|
|
20
|
+
* @since 2.7.0
|
|
21
|
+
*/
|
|
22
|
+
onHomeClick?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Custom home button text.
|
|
25
|
+
* @since 2.7.0
|
|
26
|
+
*/
|
|
27
|
+
homeButtonText?: string;
|
|
12
28
|
}
|
|
13
29
|
/**
|
|
14
30
|
* A component for displaying error pages/messages.
|
|
15
31
|
* Can be used for HTTP errors (404, 500, etc.) or general error states.
|
|
16
32
|
*
|
|
33
|
+
* @since 2.7.0 - Added isHomeShow, onHomeClick, homeButtonText props
|
|
34
|
+
*
|
|
17
35
|
* @example
|
|
18
36
|
* ```tsx
|
|
19
37
|
* // Basic error display
|
|
@@ -29,7 +47,15 @@ export interface ErrorComponentProps {
|
|
|
29
47
|
* showCloseButton
|
|
30
48
|
* onDestroy={() => navigate('/')}
|
|
31
49
|
* />
|
|
50
|
+
*
|
|
51
|
+
* // With home button (v2.7.0)
|
|
52
|
+
* <ErrorComponent
|
|
53
|
+
* title="404"
|
|
54
|
+
* details="Page not found."
|
|
55
|
+
* isHomeShow
|
|
56
|
+
* onHomeClick={() => navigate('/')}
|
|
57
|
+
* />
|
|
32
58
|
* ```
|
|
33
59
|
*/
|
|
34
|
-
export declare function ErrorComponent({ title, details, onDestroy, showCloseButton, closeButtonText, }: ErrorComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
export declare function ErrorComponent({ title, details, onDestroy, showCloseButton, closeButtonText, isHomeShow, onHomeClick, homeButtonText, }: ErrorComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
35
61
|
export default ErrorComponent;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* - Added sorting icon styles
|
|
8
8
|
* - Added table scrollbar width styling
|
|
9
9
|
*
|
|
10
|
+
* @since 2.9.0 - Added RTL support for data-tables-filter
|
|
11
|
+
*
|
|
10
12
|
* @example
|
|
11
13
|
* ```tsx
|
|
12
14
|
* // Option 1: Use with a style tag in your app
|
|
@@ -25,5 +27,11 @@
|
|
|
25
27
|
* // Copy the content of DEFAULT_STYLES to your styles.css
|
|
26
28
|
* ```
|
|
27
29
|
*/
|
|
28
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Bootstrap CSS file pattern with direction placeholder.
|
|
32
|
+
* Use with createLazyStyleHref to get the correct bootstrap CSS for RTL/LTR.
|
|
33
|
+
* @since 2.9.0
|
|
34
|
+
*/
|
|
35
|
+
export declare const BOOTSTRAP = "bootstrap-{{dir}}.min.css";
|
|
36
|
+
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/* RTL support - @since 2.9.0 */\n[dir=rtl] .data-tables-filter {\n text-align: left;\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";
|
|
29
37
|
export default DEFAULT_STYLES;
|
package/dist/contexts/index.d.ts
CHANGED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React, { type ReactNode, type ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Modal template render function type.
|
|
4
|
+
* @since 2.7.0
|
|
5
|
+
*/
|
|
6
|
+
export type ModalTemplateRender<T = unknown> = (context?: T) => ReactElement | null;
|
|
7
|
+
/**
|
|
8
|
+
* Modal state containing the current template and context.
|
|
9
|
+
* @since 2.7.0
|
|
10
|
+
*/
|
|
11
|
+
export interface ModalState<T = unknown> {
|
|
12
|
+
/** The render function for the modal content */
|
|
13
|
+
render: ModalTemplateRender<T>;
|
|
14
|
+
/** Context passed to the render function */
|
|
15
|
+
context?: T;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ModalService interface - matches the Angular service API.
|
|
19
|
+
*
|
|
20
|
+
* In Angular, ModalService uses ContentProjectionService to render templates
|
|
21
|
+
* in a container. In React, we use context and state to manage modal content.
|
|
22
|
+
*
|
|
23
|
+
* @since 2.7.0
|
|
24
|
+
*/
|
|
25
|
+
export interface ModalService {
|
|
26
|
+
/**
|
|
27
|
+
* Render a template in the modal container.
|
|
28
|
+
* @param render - Function that returns the modal content
|
|
29
|
+
* @param context - Optional context to pass to the render function
|
|
30
|
+
* @since 2.7.0
|
|
31
|
+
*/
|
|
32
|
+
renderTemplate<T = unknown>(render: ModalTemplateRender<T>, context?: T): void;
|
|
33
|
+
/**
|
|
34
|
+
* Clear the current modal.
|
|
35
|
+
* @since 2.7.0
|
|
36
|
+
*/
|
|
37
|
+
clearModal(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get the container ref for the modal.
|
|
40
|
+
* In React, this returns a ref to the container element.
|
|
41
|
+
* @since 2.7.0
|
|
42
|
+
*/
|
|
43
|
+
getContainer(): React.RefObject<HTMLDivElement | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Trigger a re-render of the modal content.
|
|
46
|
+
* In React, this forces a state update.
|
|
47
|
+
* @since 2.7.0
|
|
48
|
+
*/
|
|
49
|
+
detectChanges(): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Context value containing the service and current modal state.
|
|
53
|
+
* @since 2.7.0
|
|
54
|
+
*/
|
|
55
|
+
export interface ModalContextValue {
|
|
56
|
+
service: ModalService;
|
|
57
|
+
/** Current modal state */
|
|
58
|
+
modalState: ModalState | null;
|
|
59
|
+
}
|
|
60
|
+
export interface ModalProviderProps {
|
|
61
|
+
children: ReactNode;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* ModalProvider - Provides modal service functionality.
|
|
65
|
+
*
|
|
66
|
+
* This is the React equivalent of Angular's ModalService.
|
|
67
|
+
* Wrap your app with this provider to enable modal service functionality.
|
|
68
|
+
*
|
|
69
|
+
* @since 2.7.0
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <ModalProvider>
|
|
74
|
+
* <App />
|
|
75
|
+
* <ModalContainer />
|
|
76
|
+
* </ModalProvider>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function ModalProvider({ children }: ModalProviderProps): ReactElement;
|
|
80
|
+
/**
|
|
81
|
+
* Hook to access the modal service.
|
|
82
|
+
*
|
|
83
|
+
* @returns ModalService with methods to manage modal content
|
|
84
|
+
* @throws Error if used outside of ModalProvider
|
|
85
|
+
*
|
|
86
|
+
* @since 2.7.0
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* function MyComponent() {
|
|
91
|
+
* const modal = useModal();
|
|
92
|
+
*
|
|
93
|
+
* const openModal = () => {
|
|
94
|
+
* modal.renderTemplate((context) => (
|
|
95
|
+
* <Dialog open onClose={() => modal.clearModal()}>
|
|
96
|
+
* <DialogContent>Hello {context?.name}</DialogContent>
|
|
97
|
+
* </Dialog>
|
|
98
|
+
* ), { name: 'World' });
|
|
99
|
+
* };
|
|
100
|
+
*
|
|
101
|
+
* return <button onClick={openModal}>Open Modal</button>;
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function useModal(): ModalService;
|
|
106
|
+
/**
|
|
107
|
+
* Hook to access the current modal state.
|
|
108
|
+
* This is typically used by the ModalContainer component.
|
|
109
|
+
*
|
|
110
|
+
* @returns Current modal state or null
|
|
111
|
+
* @since 2.7.0
|
|
112
|
+
*/
|
|
113
|
+
export declare function useModalState(): ModalState | null;
|
|
114
|
+
/**
|
|
115
|
+
* Hook to access the full modal context.
|
|
116
|
+
*
|
|
117
|
+
* @returns ModalContextValue with service and modal state
|
|
118
|
+
* @since 2.7.0
|
|
119
|
+
*/
|
|
120
|
+
export declare function useModalContext(): ModalContextValue;
|
|
121
|
+
/**
|
|
122
|
+
* ModalContainer component - renders the current modal content.
|
|
123
|
+
* Place this component once in your app to display modal content.
|
|
124
|
+
*
|
|
125
|
+
* @since 2.7.0
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```tsx
|
|
129
|
+
* function App() {
|
|
130
|
+
* return (
|
|
131
|
+
* <ModalProvider>
|
|
132
|
+
* <MainContent />
|
|
133
|
+
* <ModalContainer />
|
|
134
|
+
* </ModalProvider>
|
|
135
|
+
* );
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export declare function ModalContainer(): ReactElement | null;
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy Style Handler
|
|
3
|
+
* Translated from @abp/ng.theme.shared/lib/handlers/lazy-style.handler.ts
|
|
4
|
+
*
|
|
5
|
+
* Handles RTL/LTR style switching based on locale direction.
|
|
6
|
+
*
|
|
7
|
+
* @since 2.9.0
|
|
8
|
+
*/
|
|
9
|
+
import type { LocaleDirection } from '../models/common';
|
|
10
|
+
/**
|
|
11
|
+
* Creates a lazy style href by replacing the direction placeholder.
|
|
12
|
+
* @param style - The style pattern with {{dir}} placeholder
|
|
13
|
+
* @param dir - The direction ('ltr' or 'rtl')
|
|
14
|
+
* @returns The resolved style href
|
|
15
|
+
* @since 2.9.0
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const href = createLazyStyleHref('bootstrap-{{dir}}.min.css', 'rtl');
|
|
20
|
+
* // Returns: 'bootstrap-rtl.min.css'
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function createLazyStyleHref(style: string, dir: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Options for the LazyStyleHandler hook.
|
|
26
|
+
* @since 2.9.0
|
|
27
|
+
*/
|
|
28
|
+
export interface LazyStyleHandlerOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Array of style patterns with {{dir}} placeholder.
|
|
31
|
+
* Defaults to [BOOTSTRAP] if not provided.
|
|
32
|
+
*/
|
|
33
|
+
styles?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Initial direction. Defaults to 'ltr'.
|
|
36
|
+
*/
|
|
37
|
+
initialDirection?: LocaleDirection;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Hook for managing RTL/LTR style switching.
|
|
41
|
+
* Automatically switches Bootstrap and other stylesheets based on locale direction.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Configuration options
|
|
44
|
+
* @returns Object with current direction and setDirection function
|
|
45
|
+
* @since 2.9.0
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* function App() {
|
|
50
|
+
* const { direction, setDirection } = useLazyStyleHandler({
|
|
51
|
+
* styles: [BOOTSTRAP],
|
|
52
|
+
* initialDirection: 'ltr',
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // Switch to RTL when needed
|
|
56
|
+
* const handleLanguageChange = (lang: string) => {
|
|
57
|
+
* if (lang === 'ar' || lang === 'he') {
|
|
58
|
+
* setDirection('rtl');
|
|
59
|
+
* } else {
|
|
60
|
+
* setDirection('ltr');
|
|
61
|
+
* }
|
|
62
|
+
* };
|
|
63
|
+
*
|
|
64
|
+
* return <div dir={direction}>...</div>;
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function useLazyStyleHandler(options?: LazyStyleHandlerOptions): {
|
|
69
|
+
direction: LocaleDirection;
|
|
70
|
+
setDirection: import("react").Dispatch<import("react").SetStateAction<LocaleDirection>>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Gets the currently loaded Bootstrap stylesheet direction.
|
|
74
|
+
* @param styles - Array of style patterns to check
|
|
75
|
+
* @returns The current direction or undefined if not loaded
|
|
76
|
+
* @since 2.9.0
|
|
77
|
+
*/
|
|
78
|
+
export declare function getLoadedBootstrapDirection(styles?: string[]): LocaleDirection | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Initialize lazy style handler for use in providers.
|
|
81
|
+
* Returns a function that creates the handler.
|
|
82
|
+
*
|
|
83
|
+
* @param options - Configuration options
|
|
84
|
+
* @returns Function that initializes the handler
|
|
85
|
+
* @since 2.9.0
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```tsx
|
|
89
|
+
* // In your provider setup
|
|
90
|
+
* const initHandler = initLazyStyleHandler({ styles: [BOOTSTRAP] });
|
|
91
|
+
* const handler = initHandler();
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare function initLazyStyleHandler(options?: LazyStyleHandlerOptions): () => {
|
|
95
|
+
direction: LocaleDirection;
|
|
96
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,29 @@
|
|
|
2
2
|
* @abpjs/theme-shared
|
|
3
3
|
*
|
|
4
4
|
* ABP Framework Theme Shared components for React.
|
|
5
|
-
* Translated from @abp/ng.theme.shared v2.
|
|
5
|
+
* Translated from @abp/ng.theme.shared v2.9.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
|
+
* Changes in v2.9.0:
|
|
11
|
+
* - Added LocaleDirection type for RTL/LTR support
|
|
12
|
+
* - Added LazyStyleHandler for RTL/LTR style switching
|
|
13
|
+
* - Added NavItem interface and functions (addNavItem, getNavItems, etc.)
|
|
14
|
+
* - Added LAZY_STYLES token and LazyStylesContext
|
|
15
|
+
* - Added BOOTSTRAP constant for bootstrap CSS pattern
|
|
16
|
+
* - Confirmation.Options: Added dismissible property, deprecated closable
|
|
17
|
+
* - Updated styles with RTL support for data-tables-filter
|
|
18
|
+
* - Dependency updates to @abp/ng.core v2.9.0
|
|
19
|
+
*
|
|
20
|
+
* Changes in v2.7.0:
|
|
21
|
+
* - Added ModalService with renderTemplate, clearModal, getContainer, detectChanges
|
|
22
|
+
* - HttpErrorConfig: Added skipHandledErrorCodes, simplified forWhichErrors to array
|
|
23
|
+
* - HttpErrorWrapperComponent: Added isHomeShow property
|
|
24
|
+
* - Added validation-utils with getPasswordValidators function
|
|
25
|
+
* - Added tokens exports (HTTP_ERROR_CONFIG, httpErrorConfigFactory)
|
|
26
|
+
* - Dependency updates to @abp/ng.core v2.7.0
|
|
27
|
+
*
|
|
10
28
|
* Changes in v2.4.0:
|
|
11
29
|
* - Added THEME_SHARED_APPEND_CONTENT token for content appending
|
|
12
30
|
* - Updated Toaster.Status deprecation notice (removal now in v3.0 instead of v2.2)
|
|
@@ -52,6 +70,7 @@
|
|
|
52
70
|
*/
|
|
53
71
|
export * from './models';
|
|
54
72
|
export * from './constants';
|
|
73
|
+
export * from './tokens';
|
|
55
74
|
export * from './contexts';
|
|
56
75
|
export * from './hooks';
|
|
57
76
|
export * from './components';
|