@abpjs/theme-basic 0.7.6

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 (38) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +680 -0
  3. package/dist/components/blocks/sidebars/sidebar-with-collapsible/block.d.ts +1 -0
  4. package/dist/components/blocks/sidebars/sidebar-with-collapsible/index.d.ts +10 -0
  5. package/dist/components/blocks/sidebars/sidebar-with-collapsible/language-selector.d.ts +8 -0
  6. package/dist/components/blocks/sidebars/sidebar-with-collapsible/logo.d.ts +15 -0
  7. package/dist/components/blocks/sidebars/sidebar-with-collapsible/nav-links.d.ts +12 -0
  8. package/dist/components/blocks/sidebars/sidebar-with-collapsible/navbar.d.ts +7 -0
  9. package/dist/components/blocks/sidebars/sidebar-with-collapsible/search-context.d.ts +20 -0
  10. package/dist/components/blocks/sidebars/sidebar-with-collapsible/search-field.d.ts +1 -0
  11. package/dist/components/blocks/sidebars/sidebar-with-collapsible/sidebar-link.d.ts +16 -0
  12. package/dist/components/blocks/sidebars/sidebar-with-collapsible/sidebar.d.ts +26 -0
  13. package/dist/components/blocks/sidebars/sidebar-with-collapsible/user-profile.d.ts +8 -0
  14. package/dist/components/change-password/ChangePassword.d.ts +26 -0
  15. package/dist/components/change-password/index.d.ts +1 -0
  16. package/dist/components/index.d.ts +7 -0
  17. package/dist/components/layout/Layout.d.ts +30 -0
  18. package/dist/components/layout/index.d.ts +1 -0
  19. package/dist/components/layout-account/LayoutAccount.d.ts +45 -0
  20. package/dist/components/layout-account/index.d.ts +1 -0
  21. package/dist/components/layout-application/LayoutApplication.d.ts +60 -0
  22. package/dist/components/layout-application/index.d.ts +1 -0
  23. package/dist/components/layout-empty/LayoutEmpty.d.ts +23 -0
  24. package/dist/components/layout-empty/index.d.ts +1 -0
  25. package/dist/components/profile/Profile.d.ts +28 -0
  26. package/dist/components/profile/index.d.ts +1 -0
  27. package/dist/contexts/branding.context.d.ts +67 -0
  28. package/dist/contexts/index.d.ts +2 -0
  29. package/dist/contexts/layout.context.d.ts +60 -0
  30. package/dist/hooks/index.d.ts +1 -0
  31. package/dist/index.d.ts +20 -0
  32. package/dist/index.js +1466 -0
  33. package/dist/index.mjs +1435 -0
  34. package/dist/models/index.d.ts +1 -0
  35. package/dist/models/layout.d.ts +26 -0
  36. package/dist/providers/ThemeBasicProvider.d.ts +92 -0
  37. package/dist/providers/index.d.ts +1 -0
  38. package/package.json +59 -0
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ interface NavLinksProps {
3
+ /** Default icon for routes without specific icons */
4
+ defaultIcon?: ReactNode;
5
+ }
6
+ /**
7
+ * Navigation links component that renders routes from ABP config.
8
+ * Icons are taken from the route's `icon` property.
9
+ * Routes are filtered based on sidebar search query.
10
+ */
11
+ export declare const NavLinks: ({ defaultIcon }: NavLinksProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ContainerProps } from '@chakra-ui/react';
2
+ import { SidebarProps } from './sidebar';
3
+ export interface NavbarProps extends ContainerProps {
4
+ /** Props to pass to the Sidebar component in the drawer */
5
+ sidebarProps?: Omit<SidebarProps, 'hideBelow' | 'hideFrom'>;
6
+ }
7
+ export declare const Navbar: ({ sidebarProps, ...props }: NavbarProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ interface SearchContextValue {
3
+ /** Current search query */
4
+ searchQuery: string;
5
+ /** Update search query */
6
+ setSearchQuery: (query: string) => void;
7
+ }
8
+ interface SearchProviderProps {
9
+ children: ReactNode;
10
+ }
11
+ /**
12
+ * Provider for sidebar search functionality.
13
+ * Allows SearchField to update the query and NavLinks to filter based on it.
14
+ */
15
+ export declare const SearchProvider: ({ children }: SearchProviderProps) => import("react/jsx-runtime").JSX.Element;
16
+ /**
17
+ * Hook to access search context
18
+ */
19
+ export declare const useSearch: () => SearchContextValue;
20
+ export {};
@@ -0,0 +1 @@
1
+ export declare const SearchField: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { type ButtonProps } from '@chakra-ui/react';
2
+ import { ReactNode } from 'react';
3
+ interface SidebarLinkProps extends Omit<ButtonProps, 'children'> {
4
+ /** Link destination path */
5
+ href?: string;
6
+ /** Whether to use exact path matching for active state */
7
+ exact?: boolean;
8
+ /** Content to display */
9
+ children?: ReactNode;
10
+ /** Badge content (number or text) to display at end of link */
11
+ badge?: ReactNode;
12
+ /** Badge color palette (default: 'gray') */
13
+ badgeColorPalette?: string;
14
+ }
15
+ export declare const SidebarLink: (props: SidebarLinkProps) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,26 @@
1
+ import { type StackProps } from '@chakra-ui/react';
2
+ import { ReactNode } from 'react';
3
+ import { UserProfileProps } from './user-profile';
4
+ export interface SidebarProps extends StackProps {
5
+ /** Show search field */
6
+ showSearch?: boolean;
7
+ /** Show language selector */
8
+ showLanguageSelector?: boolean;
9
+ /** Show help center link */
10
+ showHelpCenter?: boolean;
11
+ /** Help center URL */
12
+ helpCenterUrl?: string;
13
+ /** Show settings link */
14
+ showSettings?: boolean;
15
+ /** Settings URL */
16
+ settingsUrl?: string;
17
+ /** Default icon for routes without specific icons (icons are defined on routes via the `icon` property) */
18
+ defaultIcon?: ReactNode;
19
+ /** User profile callbacks */
20
+ userProfileProps?: UserProfileProps;
21
+ /** Additional content to render at the top of the sidebar (after logo) */
22
+ headerContent?: ReactNode;
23
+ /** Additional content to render before the user profile */
24
+ footerContent?: ReactNode;
25
+ }
26
+ export declare const Sidebar: ({ showSearch, showLanguageSelector, showHelpCenter, helpCenterUrl, showSettings, settingsUrl, defaultIcon, userProfileProps, headerContent, footerContent, ...props }: SidebarProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ export interface UserProfileProps {
2
+ onChangePassword?: () => void;
3
+ onProfile?: () => void;
4
+ onLogout?: () => void;
5
+ /** URL to redirect to for login (default: /account/login) */
6
+ loginUrl?: string;
7
+ }
8
+ export declare const UserProfile: ({ onChangePassword, onProfile, onLogout, loginUrl }: UserProfileProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ export interface ChangePasswordProps {
3
+ /** Whether the modal is visible */
4
+ visible: boolean;
5
+ /** Callback when visibility changes */
6
+ onVisibleChange: (visible: boolean) => void;
7
+ }
8
+ /**
9
+ * Change password modal component.
10
+ * Translated from Angular ChangePasswordComponent.
11
+ *
12
+ * Provides a modal dialog for changing the user's password with:
13
+ * - Current password input
14
+ * - New password input with validation
15
+ * - Confirm new password with match validation
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <ChangePassword
20
+ * visible={isOpen}
21
+ * onVisibleChange={setIsOpen}
22
+ * />
23
+ * ```
24
+ */
25
+ export declare function ChangePassword({ visible, onVisibleChange, }: ChangePasswordProps): React.ReactElement;
26
+ export default ChangePassword;
@@ -0,0 +1 @@
1
+ export * from './ChangePassword';
@@ -0,0 +1,7 @@
1
+ export * from './layout';
2
+ export * from './layout-application';
3
+ export * from './layout-account';
4
+ export * from './layout-empty';
5
+ export * from './change-password';
6
+ export * from './profile';
7
+ export * from './blocks/sidebars/sidebar-with-collapsible';
@@ -0,0 +1,30 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface LayoutProps {
3
+ /** Brand name or logo to display in navbar */
4
+ brandName?: string;
5
+ /** Link destination for brand (defaults to "/") */
6
+ brandLink?: string;
7
+ /** Content to render in the navbar (typically navigation items) */
8
+ children?: ReactNode;
9
+ /** Whether to render the router outlet inside the layout */
10
+ renderOutlet?: boolean;
11
+ }
12
+ /**
13
+ * Base layout component providing navbar structure.
14
+ * Translated from Angular LayoutComponent.
15
+ *
16
+ * Provides a responsive Bootstrap-style navbar with:
17
+ * - Brand/logo area
18
+ * - Collapsible navigation for mobile
19
+ * - Slot for navigation content via children
20
+ * - Container with router outlet
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * <Layout brandName="MyApp">
25
+ * <NavItems />
26
+ * </Layout>
27
+ * ```
28
+ */
29
+ export declare function LayoutBase({ brandName, brandLink, children, renderOutlet, }: LayoutProps): React.ReactElement;
30
+ export default LayoutBase;
@@ -0,0 +1 @@
1
+ export * from './Layout';
@@ -0,0 +1,45 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { eLayoutType } from '@abpjs/core';
3
+ export interface LayoutAccountProps {
4
+ /** Whether to show the language selector */
5
+ showLanguageSelector?: boolean;
6
+ /** Whether to show search field in sidebar */
7
+ showSearch?: boolean;
8
+ /** Whether to show help center link */
9
+ showHelpCenter?: boolean;
10
+ /** Help center URL */
11
+ helpCenterUrl?: string;
12
+ /** Whether to show settings link */
13
+ showSettings?: boolean;
14
+ /** Settings URL */
15
+ settingsUrl?: string;
16
+ /** Default icon for routes without specific icons */
17
+ defaultIcon?: ReactNode;
18
+ /** Additional content to render at the top of the sidebar (after logo) */
19
+ headerContent?: ReactNode;
20
+ /** Additional content to render before the user profile */
21
+ footerContent?: ReactNode;
22
+ /** Custom children to render in content area (overrides Outlet) */
23
+ children?: ReactNode;
24
+ }
25
+ /**
26
+ * Account layout component for authentication pages (login, register, etc.).
27
+ * Uses a sidebar-based layout similar to LayoutApplication but without
28
+ * user-specific features (no profile, no change password, no logout).
29
+ *
30
+ * Features:
31
+ * - Responsive sidebar (drawer on mobile, fixed on desktop)
32
+ * - Navigation menu from routes
33
+ * - Language switcher
34
+ * - RTL support for Arabic, Hebrew, Persian, and other RTL languages
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * <LayoutAccount showLanguageSelector={true} />
39
+ * ```
40
+ */
41
+ export declare function LayoutAccount({ showLanguageSelector, showSearch, showHelpCenter, helpCenterUrl, showSettings, settingsUrl, defaultIcon, headerContent, footerContent, children, }: LayoutAccountProps): React.ReactElement;
42
+ export declare namespace LayoutAccount {
43
+ var type: eLayoutType;
44
+ }
45
+ export default LayoutAccount;
@@ -0,0 +1 @@
1
+ export * from './LayoutAccount';
@@ -0,0 +1,60 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { eLayoutType } from '@abpjs/core';
3
+ /** Z-index for sidebar/navbar - exported so menus can layer above it */
4
+ export declare const SIDEBAR_Z_INDEX = 1100;
5
+ export interface LayoutApplicationProps {
6
+ /** @deprecated Use logo prop on ThemeBasicProvider instead */
7
+ brandName?: string;
8
+ /** @deprecated Use logoLink prop on ThemeBasicProvider instead */
9
+ brandLink?: string;
10
+ /** Whether to show the language selector */
11
+ showLanguageSelector?: boolean;
12
+ /** Whether to show the current user menu */
13
+ showCurrentUser?: boolean;
14
+ /** Whether to show search field in sidebar */
15
+ showSearch?: boolean;
16
+ /** Whether to show help center link */
17
+ showHelpCenter?: boolean;
18
+ /** Help center URL */
19
+ helpCenterUrl?: string;
20
+ /** Whether to show settings link */
21
+ showSettings?: boolean;
22
+ /** Settings URL */
23
+ settingsUrl?: string;
24
+ /** Default icon for routes without specific icons (icons are defined on routes via the `icon` property) */
25
+ defaultIcon?: ReactNode;
26
+ /** Additional content to render at the top of the sidebar (after logo) */
27
+ headerContent?: ReactNode;
28
+ /** Additional content to render before the user profile */
29
+ footerContent?: ReactNode;
30
+ /** Custom children to render in content area (overrides Outlet) */
31
+ children?: ReactNode;
32
+ }
33
+ /**
34
+ * Application layout component for authenticated pages.
35
+ * Uses a sidebar-based layout with Chakra UI Pro blocks.
36
+ *
37
+ * Features:
38
+ * - Responsive sidebar (drawer on mobile, fixed on desktop)
39
+ * - Navigation menu from routes (icons defined via route's `icon` property)
40
+ * - Language switcher
41
+ * - Current user menu with logout, change password, profile
42
+ * - Customizable logo via ThemeBasicProvider
43
+ * - RTL support for Arabic, Hebrew, Persian, and other RTL languages
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * // Basic usage - icons are defined on routes
48
+ * const routes = [
49
+ * { name: 'Home', path: '', icon: <LuHome /> },
50
+ * { name: 'Settings', path: 'settings', icon: <LuSettings /> },
51
+ * ];
52
+ *
53
+ * <LayoutApplication />
54
+ * ```
55
+ */
56
+ export declare function LayoutApplication({ showLanguageSelector, showCurrentUser, showSearch, showHelpCenter, helpCenterUrl, showSettings, settingsUrl, defaultIcon, headerContent, footerContent, children, }: LayoutApplicationProps): React.ReactElement;
57
+ export declare namespace LayoutApplication {
58
+ var type: eLayoutType;
59
+ }
60
+ export default LayoutApplication;
@@ -0,0 +1 @@
1
+ export * from './LayoutApplication';
@@ -0,0 +1,23 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { eLayoutType } from '@abpjs/core';
3
+ export interface LayoutEmptyProps {
4
+ /** Custom children to render instead of Outlet */
5
+ children?: ReactNode;
6
+ }
7
+ /**
8
+ * Empty layout component for pages that don't need a navbar.
9
+ * Translated from Angular LayoutEmptyComponent.
10
+ *
11
+ * Provides a minimal layout with just the router outlet.
12
+ * Useful for error pages, landing pages, or custom layouts.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * <LayoutEmpty />
17
+ * ```
18
+ */
19
+ export declare function LayoutEmpty({ children }: LayoutEmptyProps): React.ReactElement;
20
+ export declare namespace LayoutEmpty {
21
+ var type: eLayoutType;
22
+ }
23
+ export default LayoutEmpty;
@@ -0,0 +1 @@
1
+ export * from './LayoutEmpty';
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ export interface ProfileProps {
3
+ /** Whether the modal is visible */
4
+ visible: boolean;
5
+ /** Callback when visibility changes */
6
+ onVisibleChange: (visible: boolean) => void;
7
+ }
8
+ /**
9
+ * Profile modal component for editing user profile.
10
+ * Translated from Angular ProfileComponent.
11
+ *
12
+ * Provides a modal dialog for editing user profile with:
13
+ * - Username (required)
14
+ * - Email (required)
15
+ * - Name
16
+ * - Surname
17
+ * - Phone number
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <Profile
22
+ * visible={isOpen}
23
+ * onVisibleChange={setIsOpen}
24
+ * />
25
+ * ```
26
+ */
27
+ export declare function Profile({ visible, onVisibleChange, }: ProfileProps): React.ReactElement;
28
+ export default Profile;
@@ -0,0 +1 @@
1
+ export * from './Profile';
@@ -0,0 +1,67 @@
1
+ import React, { ReactNode } from 'react';
2
+ /**
3
+ * Branding configuration for the application.
4
+ * Allows customization of logo, brand name, and related visual elements.
5
+ */
6
+ export interface BrandingConfig {
7
+ /** Full logo component (used in expanded sidebar) */
8
+ logo?: ReactNode;
9
+ /** Icon-only logo (used in mobile navbar or collapsed sidebar) */
10
+ logoIcon?: ReactNode;
11
+ /** Brand/application name (fallback when no logo provided) */
12
+ appName?: string;
13
+ /** Link destination when clicking the logo */
14
+ logoLink?: string;
15
+ }
16
+ /**
17
+ * Context value for branding configuration.
18
+ */
19
+ export interface BrandingContextValue {
20
+ /** Current branding configuration */
21
+ config: BrandingConfig;
22
+ }
23
+ export interface BrandingProviderProps {
24
+ children: ReactNode;
25
+ /** Custom logo component for the sidebar */
26
+ logo?: ReactNode;
27
+ /** Icon-only logo for mobile/collapsed views */
28
+ logoIcon?: ReactNode;
29
+ /** Application name (used as fallback if no logo provided) */
30
+ appName?: string;
31
+ /** Link destination when clicking the logo (default: '/') */
32
+ logoLink?: string;
33
+ }
34
+ /**
35
+ * Provider component for branding configuration.
36
+ * Allows setting logo and brand name at the application level.
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * // With custom logo component
41
+ * <BrandingProvider logo={<MyCustomLogo />} appName="My App">
42
+ * <App />
43
+ * </BrandingProvider>
44
+ * ```
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * // With separate full and icon logos
49
+ * <BrandingProvider
50
+ * logo={<FullLogo />}
51
+ * logoIcon={<IconOnlyLogo />}
52
+ * appName="My App"
53
+ * >
54
+ * <App />
55
+ * </BrandingProvider>
56
+ * ```
57
+ */
58
+ export declare function BrandingProvider({ children, logo, logoIcon, appName, logoLink, }: BrandingProviderProps): React.ReactElement;
59
+ /**
60
+ * Hook to access the branding configuration.
61
+ */
62
+ export declare function useBranding(): BrandingConfig;
63
+ /**
64
+ * Hook to get the appropriate logo based on context.
65
+ * @param preferIcon - If true, returns iconLogo when available
66
+ */
67
+ export declare function useLogo(preferIcon?: boolean): ReactNode;
@@ -0,0 +1,2 @@
1
+ export * from './layout.context';
2
+ export * from './branding.context';
@@ -0,0 +1,60 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Layout } from '../models';
3
+ /**
4
+ * Service interface for managing layout navigation elements.
5
+ * Translated from NGXS LayoutState actions.
6
+ */
7
+ export interface LayoutService {
8
+ /**
9
+ * Add one or more navigation elements to the layout.
10
+ * Duplicate names are ignored.
11
+ * @param elements - Single element or array of elements to add
12
+ */
13
+ addNavigationElement: (elements: Layout.NavigationElement | Layout.NavigationElement[]) => void;
14
+ /**
15
+ * Remove a navigation element by name.
16
+ * @param name - Name of the element to remove
17
+ */
18
+ removeNavigationElement: (name: string) => void;
19
+ /**
20
+ * Clear all navigation elements.
21
+ */
22
+ clearNavigationElements: () => void;
23
+ }
24
+ /**
25
+ * Context value containing both the state and service.
26
+ */
27
+ export interface LayoutContextValue {
28
+ /** Current layout state */
29
+ state: Layout.State;
30
+ /** Service for modifying layout state */
31
+ service: LayoutService;
32
+ }
33
+ export interface LayoutProviderProps {
34
+ children: ReactNode;
35
+ }
36
+ /**
37
+ * Provider component for layout state management.
38
+ * Replaces NGXS LayoutState from Angular.
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * <LayoutProvider>
43
+ * <App />
44
+ * </LayoutProvider>
45
+ * ```
46
+ */
47
+ export declare function LayoutProvider({ children }: LayoutProviderProps): React.ReactElement;
48
+ /**
49
+ * Hook to access the full layout context (state and service).
50
+ * @throws Error if used outside of LayoutProvider
51
+ */
52
+ export declare function useLayoutContext(): LayoutContextValue;
53
+ /**
54
+ * Hook to access just the layout service for modifying state.
55
+ */
56
+ export declare function useLayoutService(): LayoutService;
57
+ /**
58
+ * Hook to access the current navigation elements.
59
+ */
60
+ export declare function useNavigationElements(): Layout.NavigationElement[];
@@ -0,0 +1 @@
1
+ export { useLayoutContext, useLayoutService, useNavigationElements, } from '../contexts/layout.context';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @abpjs/theme-basic
3
+ *
4
+ * ABP Framework Theme Basic components for React.
5
+ * Translated from @abp/ng.theme.basic v0.7.6
6
+ *
7
+ * This package provides the basic theme layout components for ABP React applications.
8
+ */
9
+ export * from './models';
10
+ export { LayoutProvider, useLayoutContext, useLayoutService, useNavigationElements, BrandingProvider, useBranding, useLogo, } from './contexts';
11
+ export type { LayoutService, LayoutContextValue, LayoutProviderProps, BrandingConfig, BrandingContextValue, BrandingProviderProps, } from './contexts';
12
+ export * from './hooks';
13
+ export * from './components';
14
+ export * from './providers';
15
+ import { LayoutApplication } from './components/layout-application';
16
+ /**
17
+ * Array of layout components for use with ABP's dynamic layout system.
18
+ * Matches the Angular LAYOUTS constant.
19
+ */
20
+ export declare const LAYOUTS: (typeof LayoutApplication)[];