@true-tech-team/react-components 0.0.4 → 0.0.5
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/README.md +138 -0
- package/index.css +1 -1
- package/index.d.ts +10 -0
- package/index.js +1 -1
- package/index.mjs +10539 -6746
- package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroup.d.ts +79 -0
- package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupContext.d.ts +38 -0
- package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupItem.d.ts +37 -0
- package/lib/components/buttons/ButtonToggleGroup/index.d.ts +7 -0
- package/lib/components/buttons/ToggleButton/ToggleButton.d.ts +96 -0
- package/lib/components/buttons/ToggleButton/index.d.ts +3 -0
- package/lib/components/display/Icon/icons/BookmarkFilled.d.ts +3 -0
- package/lib/components/display/Icon/icons/ChevronsLeft.d.ts +3 -0
- package/lib/components/display/Icon/icons/ChevronsRight.d.ts +3 -0
- package/lib/components/display/Icon/icons/HeartFilled.d.ts +3 -0
- package/lib/components/display/Icon/icons/More.d.ts +3 -0
- package/lib/components/display/Icon/icons/StarFilled.d.ts +3 -0
- package/lib/components/display/Icon/icons/ThumbsUpFilled.d.ts +3 -0
- package/lib/components/display/Icon/icons/index.d.ts +15 -1
- package/lib/components/display/OverflowText/OverflowText.d.ts +81 -0
- package/lib/components/display/OverflowText/index.d.ts +2 -0
- package/lib/components/display/ScrollArea/ScrollArea.d.ts +112 -0
- package/lib/components/display/ScrollArea/index.d.ts +3 -0
- package/lib/components/display/Tabs/Tab.d.ts +41 -0
- package/lib/components/display/Tabs/TabList.d.ts +27 -0
- package/lib/components/display/Tabs/TabPanel.d.ts +31 -0
- package/lib/components/display/Tabs/Tabs.d.ts +90 -0
- package/lib/components/display/Tabs/TabsContext.d.ts +63 -0
- package/lib/components/display/Tabs/index.d.ts +11 -0
- package/lib/components/display/TruncatedList/TruncatedList.d.ts +69 -0
- package/lib/components/display/TruncatedList/index.d.ts +2 -0
- package/lib/components/display/index.d.ts +3 -0
- package/lib/components/index.d.ts +44 -0
- package/lib/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +122 -0
- package/lib/components/inputs/CheckboxGroup/CheckboxGroupContext.d.ts +42 -0
- package/lib/components/inputs/CheckboxGroup/CheckboxGroupItem.d.ts +50 -0
- package/lib/components/inputs/CheckboxGroup/index.d.ts +7 -0
- package/lib/components/layout/AdaptiveGrid/AdaptiveGrid.d.ts +100 -0
- package/lib/components/layout/AdaptiveGrid/index.d.ts +2 -0
- package/lib/components/layout/MasonryLayout/MasonryLayout.d.ts +74 -0
- package/lib/components/layout/MasonryLayout/index.d.ts +2 -0
- package/lib/components/layout/Panes/Pane.d.ts +72 -0
- package/lib/components/layout/Panes/Panes.d.ts +75 -0
- package/lib/components/layout/Panes/PanesContext.d.ts +60 -0
- package/lib/components/layout/Panes/index.d.ts +6 -0
- package/lib/components/layout/ResponsiveStack/ResponsiveStack.d.ts +99 -0
- package/lib/components/layout/ResponsiveStack/index.d.ts +2 -0
- package/lib/components/layout/index.d.ts +4 -0
- package/lib/components/navigation/BottomNavigation/BottomNavigation.d.ts +53 -0
- package/lib/components/navigation/BottomNavigation/BottomNavigationContext.d.ts +27 -0
- package/lib/components/navigation/BottomNavigation/BottomNavigationItem.d.ts +59 -0
- package/lib/components/navigation/BottomNavigation/index.d.ts +7 -0
- package/lib/components/navigation/Breadcrumbs/BreadcrumbItem.d.ts +37 -0
- package/lib/components/navigation/Breadcrumbs/BreadcrumbSeparator.d.ts +22 -0
- package/lib/components/navigation/Breadcrumbs/Breadcrumbs.d.ts +96 -0
- package/lib/components/navigation/Breadcrumbs/index.d.ts +9 -0
- package/lib/components/navigation/Breadcrumbs/useBreadcrumbsFromPath.d.ts +73 -0
- package/lib/components/navigation/CollapsibleSidebar/CollapsibleSidebar.d.ts +113 -0
- package/lib/components/navigation/CollapsibleSidebar/index.d.ts +2 -0
- package/lib/components/navigation/NavLink/NavLink.d.ts +74 -0
- package/lib/components/navigation/NavLink/index.d.ts +3 -0
- package/lib/components/navigation/Navbar/Navbar.d.ts +81 -0
- package/lib/components/navigation/Navbar/NavbarActions.d.ts +21 -0
- package/lib/components/navigation/Navbar/NavbarBrand.d.ts +29 -0
- package/lib/components/navigation/Navbar/NavbarCollapse.d.ts +26 -0
- package/lib/components/navigation/Navbar/NavbarContext.d.ts +50 -0
- package/lib/components/navigation/Navbar/NavbarNav.d.ts +22 -0
- package/lib/components/navigation/Navbar/NavbarToggle.d.ts +21 -0
- package/lib/components/navigation/Navbar/index.d.ts +15 -0
- package/lib/components/navigation/Pagination/Pagination.d.ts +99 -0
- package/lib/components/navigation/Pagination/index.d.ts +3 -0
- package/lib/components/navigation/SideNav/SideNav.d.ts +89 -0
- package/lib/components/navigation/SideNav/SideNavContext.d.ts +43 -0
- package/lib/components/navigation/SideNav/SideNavDivider.d.ts +22 -0
- package/lib/components/navigation/SideNav/SideNavGroup.d.ts +44 -0
- package/lib/components/navigation/SideNav/SideNavItem.d.ts +71 -0
- package/lib/components/navigation/SideNav/index.d.ts +11 -0
- package/lib/components/navigation/Stepper/Step.d.ts +57 -0
- package/lib/components/navigation/Stepper/Stepper.d.ts +80 -0
- package/lib/components/navigation/Stepper/StepperContext.d.ts +58 -0
- package/lib/components/navigation/Stepper/index.d.ts +7 -0
- package/lib/components/navigation/index.d.ts +16 -0
- package/lib/components/overlays/Alert/Alert.d.ts +102 -0
- package/lib/components/overlays/Alert/AlertContext.d.ts +94 -0
- package/lib/components/overlays/Alert/AlertPresets.d.ts +42 -0
- package/lib/components/overlays/Alert/AlertProvider.d.ts +40 -0
- package/lib/components/overlays/Alert/index.d.ts +11 -0
- package/lib/components/overlays/Dialog/Dialog.d.ts +197 -0
- package/lib/components/overlays/Dialog/DialogContext.d.ts +75 -0
- package/lib/components/overlays/Dialog/DialogProvider.d.ts +30 -0
- package/lib/components/overlays/Dialog/index.d.ts +9 -0
- package/lib/components/overlays/Toast/Toast.d.ts +103 -0
- package/lib/components/overlays/Toast/ToastContainer.d.ts +37 -0
- package/lib/components/overlays/Toast/ToastContext.d.ts +126 -0
- package/lib/components/overlays/Toast/ToastProvider.d.ts +71 -0
- package/lib/components/overlays/Toast/index.d.ts +11 -0
- package/lib/hooks/index.d.ts +10 -0
- package/lib/hooks/useAlert/index.d.ts +2 -0
- package/lib/hooks/useAlert/useAlert.d.ts +99 -0
- package/lib/hooks/useAsyncToast/index.d.ts +2 -0
- package/lib/hooks/useAsyncToast/useAsyncToast.d.ts +93 -0
- package/lib/hooks/useDialog/index.d.ts +2 -0
- package/lib/hooks/useDialog/useDialog.d.ts +58 -0
- package/lib/hooks/useResizeObserver/index.d.ts +2 -0
- package/lib/hooks/useResizeObserver/useResizeObserver.d.ts +69 -0
- package/lib/hooks/useToast/index.d.ts +2 -0
- package/lib/hooks/useToast/useToast.d.ts +97 -0
- package/lib/providers/GlobalProvider/GlobalProvider.d.ts +16 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
export interface BreadcrumbSeparatorProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom separator content
|
|
6
|
+
* @default "/"
|
|
7
|
+
*/
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* BreadcrumbSeparator - Separator between breadcrumb items
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <BreadcrumbSeparator>/</BreadcrumbSeparator>
|
|
16
|
+
* <BreadcrumbSeparator>
|
|
17
|
+
* <ChevronRight />
|
|
18
|
+
* </BreadcrumbSeparator>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const BreadcrumbSeparator: React.ForwardRefExoticComponent<BreadcrumbSeparatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
22
|
+
export default BreadcrumbSeparator;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
import { IconName } from '../../display/Icon';
|
|
4
|
+
export interface BreadcrumbItemConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Display label
|
|
7
|
+
*/
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* Link href
|
|
11
|
+
*/
|
|
12
|
+
href?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Icon to display
|
|
15
|
+
*/
|
|
16
|
+
icon?: React.ReactNode | IconName;
|
|
17
|
+
/**
|
|
18
|
+
* Whether this is the current/active page
|
|
19
|
+
*/
|
|
20
|
+
current?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Click handler
|
|
23
|
+
*/
|
|
24
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface BreadcrumbsProps extends BaseComponentProps {
|
|
27
|
+
/**
|
|
28
|
+
* Custom separator element
|
|
29
|
+
* @default "/"
|
|
30
|
+
*/
|
|
31
|
+
separator?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum items before collapsing
|
|
34
|
+
*/
|
|
35
|
+
maxItems?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Number of items to show at start when collapsed
|
|
38
|
+
* @default 1
|
|
39
|
+
*/
|
|
40
|
+
itemsBeforeCollapse?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Number of items to show at end when collapsed
|
|
43
|
+
* @default 2
|
|
44
|
+
*/
|
|
45
|
+
itemsAfterCollapse?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Show home icon for first item
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
showHomeIcon?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Size variant
|
|
53
|
+
* @default 'md'
|
|
54
|
+
*/
|
|
55
|
+
size?: ComponentSize;
|
|
56
|
+
/**
|
|
57
|
+
* Breadcrumb items (declarative API)
|
|
58
|
+
*/
|
|
59
|
+
items?: BreadcrumbItemConfig[];
|
|
60
|
+
/**
|
|
61
|
+
* Children (compound API - BreadcrumbItem components)
|
|
62
|
+
*/
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Breadcrumbs - Show current location in navigation hierarchy
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* // Declarative API with items prop
|
|
71
|
+
* <Breadcrumbs
|
|
72
|
+
* items={[
|
|
73
|
+
* { label: 'Home', href: '/' },
|
|
74
|
+
* { label: 'Products', href: '/products' },
|
|
75
|
+
* { label: 'Electronics', current: true },
|
|
76
|
+
* ]}
|
|
77
|
+
* />
|
|
78
|
+
*
|
|
79
|
+
* // Compound API with children
|
|
80
|
+
* <Breadcrumbs>
|
|
81
|
+
* <BreadcrumbItem href="/">Home</BreadcrumbItem>
|
|
82
|
+
* <BreadcrumbItem href="/products">Products</BreadcrumbItem>
|
|
83
|
+
* <BreadcrumbItem current>Electronics</BreadcrumbItem>
|
|
84
|
+
* </Breadcrumbs>
|
|
85
|
+
*
|
|
86
|
+
* // With collapse
|
|
87
|
+
* <Breadcrumbs
|
|
88
|
+
* items={items}
|
|
89
|
+
* maxItems={4}
|
|
90
|
+
* itemsBeforeCollapse={1}
|
|
91
|
+
* itemsAfterCollapse={2}
|
|
92
|
+
* />
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare const Breadcrumbs: React.ForwardRefExoticComponent<BreadcrumbsProps & React.RefAttributes<HTMLElement>>;
|
|
96
|
+
export default Breadcrumbs;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Breadcrumbs } from './Breadcrumbs';
|
|
2
|
+
export type { BreadcrumbsProps, BreadcrumbItemConfig } from './Breadcrumbs';
|
|
3
|
+
export { default } from './Breadcrumbs';
|
|
4
|
+
export { BreadcrumbItem } from './BreadcrumbItem';
|
|
5
|
+
export type { BreadcrumbItemProps } from './BreadcrumbItem';
|
|
6
|
+
export { BreadcrumbSeparator } from './BreadcrumbSeparator';
|
|
7
|
+
export type { BreadcrumbSeparatorProps } from './BreadcrumbSeparator';
|
|
8
|
+
export { useBreadcrumbsFromPath } from './useBreadcrumbsFromPath';
|
|
9
|
+
export type { UseBreadcrumbsFromPathOptions } from './useBreadcrumbsFromPath';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { BreadcrumbItemConfig } from './Breadcrumbs';
|
|
2
|
+
export interface UseBreadcrumbsFromPathOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Current path (e.g., from useLocation or window.location.pathname)
|
|
5
|
+
*/
|
|
6
|
+
path: string;
|
|
7
|
+
/**
|
|
8
|
+
* Custom label mapping for path segments
|
|
9
|
+
* @example { 'users': 'All Users', 'settings': 'Account Settings' }
|
|
10
|
+
*/
|
|
11
|
+
labels?: Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Base path to start from (segments before this are ignored)
|
|
14
|
+
* @default '/'
|
|
15
|
+
*/
|
|
16
|
+
basePath?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Label for the home/root breadcrumb
|
|
19
|
+
* @default 'Home'
|
|
20
|
+
*/
|
|
21
|
+
homeLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Include home as the first breadcrumb
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
includeHome?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Transform function for labels (applied after labels lookup)
|
|
29
|
+
* @default Capitalizes first letter and replaces hyphens/underscores with spaces
|
|
30
|
+
*/
|
|
31
|
+
labelTransform?: (segment: string) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Segments to exclude from breadcrumbs (e.g., route groups like '(auth)')
|
|
34
|
+
*/
|
|
35
|
+
excludeSegments?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Hook to auto-generate breadcrumbs from a URL path
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Basic usage
|
|
43
|
+
* const breadcrumbs = useBreadcrumbsFromPath({
|
|
44
|
+
* path: '/products/electronics/phones',
|
|
45
|
+
* });
|
|
46
|
+
* // Result: [
|
|
47
|
+
* // { label: 'Home', href: '/' },
|
|
48
|
+
* // { label: 'Products', href: '/products' },
|
|
49
|
+
* // { label: 'Electronics', href: '/products/electronics' },
|
|
50
|
+
* // { label: 'Phones', href: '/products/electronics/phones', current: true },
|
|
51
|
+
* // ]
|
|
52
|
+
*
|
|
53
|
+
* // With custom labels
|
|
54
|
+
* const breadcrumbs = useBreadcrumbsFromPath({
|
|
55
|
+
* path: '/users/123/settings',
|
|
56
|
+
* labels: {
|
|
57
|
+
* 'users': 'All Users',
|
|
58
|
+
* 'settings': 'Account Settings',
|
|
59
|
+
* },
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* // With Next.js App Router (excluding route groups)
|
|
63
|
+
* const breadcrumbs = useBreadcrumbsFromPath({
|
|
64
|
+
* path: '/(dashboard)/projects/123',
|
|
65
|
+
* excludeSegments: ['(dashboard)', '(auth)'],
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* // Usage in component
|
|
69
|
+
* <Breadcrumbs items={breadcrumbs} />
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function useBreadcrumbsFromPath(options: UseBreadcrumbsFromPathOptions): BreadcrumbItemConfig[];
|
|
73
|
+
export default useBreadcrumbsFromPath;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the CollapsibleSidebar component
|
|
5
|
+
*/
|
|
6
|
+
export interface CollapsibleSidebarProps extends BaseComponentProps {
|
|
7
|
+
/**
|
|
8
|
+
* Controlled collapsed state
|
|
9
|
+
*/
|
|
10
|
+
collapsed?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Default collapsed state (uncontrolled)
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
defaultCollapsed?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Width when expanded (px)
|
|
18
|
+
* @default 240
|
|
19
|
+
*/
|
|
20
|
+
expandedWidth?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Width when collapsed (px)
|
|
23
|
+
* @default 64
|
|
24
|
+
*/
|
|
25
|
+
collapsedWidth?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Auto-collapse below this container width (px)
|
|
28
|
+
* Uses parent container width, not viewport
|
|
29
|
+
*/
|
|
30
|
+
collapseBreakpoint?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Auto-hide below this container width (px)
|
|
33
|
+
* Uses parent container width, not viewport
|
|
34
|
+
*/
|
|
35
|
+
hideBreakpoint?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Position of the sidebar
|
|
38
|
+
* @default 'left'
|
|
39
|
+
*/
|
|
40
|
+
position?: 'left' | 'right';
|
|
41
|
+
/**
|
|
42
|
+
* Callback when collapsed state changes
|
|
43
|
+
*/
|
|
44
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Callback when hidden state changes (due to hideBreakpoint)
|
|
47
|
+
*/
|
|
48
|
+
onHiddenChange?: (hidden: boolean) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Animation duration (ms)
|
|
51
|
+
* @default 250
|
|
52
|
+
*/
|
|
53
|
+
animationDuration?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Animation easing
|
|
56
|
+
* @default 'ease-in-out'
|
|
57
|
+
*/
|
|
58
|
+
animationEasing?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Header content (always visible, above scrollable content)
|
|
61
|
+
*/
|
|
62
|
+
header?: React.ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Footer content (always visible, below scrollable content)
|
|
65
|
+
*/
|
|
66
|
+
footer?: React.ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* Main content of the sidebar
|
|
69
|
+
*/
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* CollapsibleSidebar - A sidebar that collapses based on container width or user interaction
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* Basic usage:
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <CollapsibleSidebar
|
|
79
|
+
* header={<Logo />}
|
|
80
|
+
* footer={<UserProfile />}
|
|
81
|
+
* >
|
|
82
|
+
* <NavItem icon={<HomeIcon />}>Home</NavItem>
|
|
83
|
+
* <NavItem icon={<SettingsIcon />}>Settings</NavItem>
|
|
84
|
+
* </CollapsibleSidebar>
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* Controlled collapsed state:
|
|
89
|
+
* ```tsx
|
|
90
|
+
* const [collapsed, setCollapsed] = useState(false);
|
|
91
|
+
*
|
|
92
|
+
* <CollapsibleSidebar
|
|
93
|
+
* collapsed={collapsed}
|
|
94
|
+
* onCollapsedChange={setCollapsed}
|
|
95
|
+
* collapseBreakpoint={768}
|
|
96
|
+
* >
|
|
97
|
+
* {navItems}
|
|
98
|
+
* </CollapsibleSidebar>
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* Auto-hide on small screens:
|
|
103
|
+
* ```tsx
|
|
104
|
+
* <CollapsibleSidebar
|
|
105
|
+
* collapseBreakpoint={1024}
|
|
106
|
+
* hideBreakpoint={768}
|
|
107
|
+
* >
|
|
108
|
+
* {navItems}
|
|
109
|
+
* </CollapsibleSidebar>
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare const CollapsibleSidebar: React.ForwardRefExoticComponent<CollapsibleSidebarProps & React.RefAttributes<HTMLDivElement>>;
|
|
113
|
+
export default CollapsibleSidebar;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
import { IconName } from '../../display/Icon';
|
|
4
|
+
export type NavLinkVariant = 'default' | 'underline' | 'pill' | 'ghost';
|
|
5
|
+
export interface NavLinkProps extends BaseComponentProps {
|
|
6
|
+
/**
|
|
7
|
+
* Link destination
|
|
8
|
+
*/
|
|
9
|
+
href: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether link is active
|
|
12
|
+
*/
|
|
13
|
+
active?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Icon to display
|
|
16
|
+
*/
|
|
17
|
+
icon?: React.ReactNode | IconName;
|
|
18
|
+
/**
|
|
19
|
+
* Icon position
|
|
20
|
+
* @default 'start'
|
|
21
|
+
*/
|
|
22
|
+
iconPosition?: 'start' | 'end';
|
|
23
|
+
/**
|
|
24
|
+
* Visual variant
|
|
25
|
+
* @default 'default'
|
|
26
|
+
*/
|
|
27
|
+
variant?: NavLinkVariant;
|
|
28
|
+
/**
|
|
29
|
+
* Size
|
|
30
|
+
* @default 'md'
|
|
31
|
+
*/
|
|
32
|
+
size?: ComponentSize;
|
|
33
|
+
/**
|
|
34
|
+
* Whether link is disabled
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Click handler
|
|
39
|
+
*/
|
|
40
|
+
onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Link content
|
|
43
|
+
*/
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Target attribute
|
|
47
|
+
*/
|
|
48
|
+
target?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Rel attribute (defaults to 'noopener noreferrer' when target='_blank')
|
|
51
|
+
*/
|
|
52
|
+
rel?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* NavLink - Reusable navigation link with active state support
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* // Basic usage
|
|
60
|
+
* <NavLink href="/home">Home</NavLink>
|
|
61
|
+
*
|
|
62
|
+
* // With icon
|
|
63
|
+
* <NavLink href="/settings" icon="settings">Settings</NavLink>
|
|
64
|
+
*
|
|
65
|
+
* // Active state
|
|
66
|
+
* <NavLink href="/dashboard" active>Dashboard</NavLink>
|
|
67
|
+
*
|
|
68
|
+
* // Different variants
|
|
69
|
+
* <NavLink href="/about" variant="underline">About</NavLink>
|
|
70
|
+
* <NavLink href="/profile" variant="pill" active>Profile</NavLink>
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
74
|
+
export default NavLink;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
import { NavbarVariant, NavbarPosition } from './NavbarContext';
|
|
4
|
+
export interface NavbarProps extends BaseComponentProps {
|
|
5
|
+
/**
|
|
6
|
+
* Visual variant
|
|
7
|
+
* @default 'solid'
|
|
8
|
+
*/
|
|
9
|
+
variant?: NavbarVariant;
|
|
10
|
+
/**
|
|
11
|
+
* Position behavior
|
|
12
|
+
* @default 'sticky'
|
|
13
|
+
*/
|
|
14
|
+
position?: NavbarPosition;
|
|
15
|
+
/**
|
|
16
|
+
* Size (height)
|
|
17
|
+
* @default 'md'
|
|
18
|
+
*/
|
|
19
|
+
size?: ComponentSize;
|
|
20
|
+
/**
|
|
21
|
+
* Alignment of nav items
|
|
22
|
+
* @default 'left'
|
|
23
|
+
*/
|
|
24
|
+
alignment?: 'left' | 'center';
|
|
25
|
+
/**
|
|
26
|
+
* Controlled expanded state (mobile menu)
|
|
27
|
+
*/
|
|
28
|
+
expanded?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Default expanded state
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
defaultExpanded?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Callback when mobile menu toggles
|
|
36
|
+
*/
|
|
37
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Breakpoint for mobile collapse (px)
|
|
40
|
+
* @default 768
|
|
41
|
+
*/
|
|
42
|
+
collapseBreakpoint?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Children (NavbarBrand, NavbarNav, NavbarActions)
|
|
45
|
+
*/
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Navbar - Top navigation bar for branding and primary navigation
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* // Basic usage
|
|
54
|
+
* <Navbar>
|
|
55
|
+
* <NavbarBrand href="/">
|
|
56
|
+
* <Logo />
|
|
57
|
+
* <span>My App</span>
|
|
58
|
+
* </NavbarBrand>
|
|
59
|
+
* <NavbarNav>
|
|
60
|
+
* <NavLink href="/home">Home</NavLink>
|
|
61
|
+
* <NavLink href="/about">About</NavLink>
|
|
62
|
+
* </NavbarNav>
|
|
63
|
+
* <NavbarActions>
|
|
64
|
+
* <Button>Sign In</Button>
|
|
65
|
+
* </NavbarActions>
|
|
66
|
+
* </Navbar>
|
|
67
|
+
*
|
|
68
|
+
* // With mobile menu
|
|
69
|
+
* <Navbar>
|
|
70
|
+
* <NavbarBrand href="/">Logo</NavbarBrand>
|
|
71
|
+
* <NavbarToggle />
|
|
72
|
+
* <NavbarCollapse>
|
|
73
|
+
* <NavbarNav>
|
|
74
|
+
* <NavLink href="/home">Home</NavLink>
|
|
75
|
+
* </NavbarNav>
|
|
76
|
+
* </NavbarCollapse>
|
|
77
|
+
* </Navbar>
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare const Navbar: React.ForwardRefExoticComponent<NavbarProps & React.RefAttributes<HTMLElement>>;
|
|
81
|
+
export default Navbar;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
export interface NavbarActionsProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Action elements (buttons, menu, etc.)
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* NavbarActions - Actions slot for buttons, user menu, etc.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <NavbarActions>
|
|
15
|
+
* <Button variant="ghost">Sign In</Button>
|
|
16
|
+
* <Button variant="primary">Sign Up</Button>
|
|
17
|
+
* </NavbarActions>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const NavbarActions: React.ForwardRefExoticComponent<NavbarActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export default NavbarActions;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
export interface NavbarBrandProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Brand content (logo, text, etc.)
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Link href
|
|
10
|
+
*/
|
|
11
|
+
href?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Click handler
|
|
14
|
+
*/
|
|
15
|
+
onClick?: (e: React.MouseEvent<HTMLAnchorElement | HTMLDivElement>) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* NavbarBrand - Logo/branding slot for the Navbar
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <NavbarBrand href="/">
|
|
23
|
+
* <Logo />
|
|
24
|
+
* <span>My App</span>
|
|
25
|
+
* </NavbarBrand>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const NavbarBrand: React.ForwardRefExoticComponent<NavbarBrandProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export default NavbarBrand;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
export interface NavbarCollapseProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Content to show in collapsed mobile menu
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* NavbarCollapse - Collapsible container for mobile menu content
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <NavbarCollapse>
|
|
15
|
+
* <NavbarNav>
|
|
16
|
+
* <NavLink href="/home">Home</NavLink>
|
|
17
|
+
* <NavLink href="/about">About</NavLink>
|
|
18
|
+
* </NavbarNav>
|
|
19
|
+
* <NavbarActions>
|
|
20
|
+
* <Button>Sign In</Button>
|
|
21
|
+
* </NavbarActions>
|
|
22
|
+
* </NavbarCollapse>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const NavbarCollapse: React.ForwardRefExoticComponent<NavbarCollapseProps & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
export default NavbarCollapse;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ComponentSize } from '../../../types';
|
|
2
|
+
export type NavbarVariant = 'solid' | 'transparent' | 'blur';
|
|
3
|
+
export type NavbarPosition = 'fixed' | 'sticky' | 'static';
|
|
4
|
+
export interface NavbarContextValue {
|
|
5
|
+
/**
|
|
6
|
+
* Unique ID for this navbar instance
|
|
7
|
+
*/
|
|
8
|
+
navbarId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Visual variant
|
|
11
|
+
*/
|
|
12
|
+
variant: NavbarVariant;
|
|
13
|
+
/**
|
|
14
|
+
* Size (height)
|
|
15
|
+
*/
|
|
16
|
+
size: ComponentSize;
|
|
17
|
+
/**
|
|
18
|
+
* Position behavior
|
|
19
|
+
*/
|
|
20
|
+
position: NavbarPosition;
|
|
21
|
+
/**
|
|
22
|
+
* Whether mobile menu is expanded
|
|
23
|
+
*/
|
|
24
|
+
isExpanded: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Toggle mobile menu
|
|
27
|
+
*/
|
|
28
|
+
setExpanded: (expanded: boolean) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Toggle function for convenience
|
|
31
|
+
*/
|
|
32
|
+
toggle: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Alignment of nav items
|
|
35
|
+
*/
|
|
36
|
+
alignment: 'left' | 'center';
|
|
37
|
+
/**
|
|
38
|
+
* Whether navbar is in mobile mode
|
|
39
|
+
*/
|
|
40
|
+
isMobile: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const NavbarContext: import('react').Context<NavbarContextValue | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Hook to access navbar context (returns null if outside Navbar)
|
|
45
|
+
*/
|
|
46
|
+
export declare function useNavbarContext(): NavbarContextValue | null;
|
|
47
|
+
/**
|
|
48
|
+
* Hook to access navbar context (throws if outside Navbar)
|
|
49
|
+
*/
|
|
50
|
+
export declare function useNavbarContextStrict(): NavbarContextValue;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
export interface NavbarNavProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Navigation items
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* NavbarNav - Navigation links container for the Navbar
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <NavbarNav>
|
|
15
|
+
* <NavLink href="/home">Home</NavLink>
|
|
16
|
+
* <NavLink href="/about">About</NavLink>
|
|
17
|
+
* <NavLink href="/contact">Contact</NavLink>
|
|
18
|
+
* </NavbarNav>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const NavbarNav: React.ForwardRefExoticComponent<NavbarNavProps & React.RefAttributes<HTMLElement>>;
|
|
22
|
+
export default NavbarNav;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
export interface NavbarToggleProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Custom toggle icon
|
|
6
|
+
*/
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* NavbarToggle - Mobile hamburger menu button
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <NavbarToggle />
|
|
15
|
+
*
|
|
16
|
+
* // With custom icon
|
|
17
|
+
* <NavbarToggle icon={<CustomIcon />} />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const NavbarToggle: React.ForwardRefExoticComponent<NavbarToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
21
|
+
export default NavbarToggle;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { Navbar } from './Navbar';
|
|
2
|
+
export type { NavbarProps } from './Navbar';
|
|
3
|
+
export { default } from './Navbar';
|
|
4
|
+
export { NavbarBrand } from './NavbarBrand';
|
|
5
|
+
export type { NavbarBrandProps } from './NavbarBrand';
|
|
6
|
+
export { NavbarNav } from './NavbarNav';
|
|
7
|
+
export type { NavbarNavProps } from './NavbarNav';
|
|
8
|
+
export { NavbarActions } from './NavbarActions';
|
|
9
|
+
export type { NavbarActionsProps } from './NavbarActions';
|
|
10
|
+
export { NavbarToggle } from './NavbarToggle';
|
|
11
|
+
export type { NavbarToggleProps } from './NavbarToggle';
|
|
12
|
+
export { NavbarCollapse } from './NavbarCollapse';
|
|
13
|
+
export type { NavbarCollapseProps } from './NavbarCollapse';
|
|
14
|
+
export { NavbarContext, useNavbarContext, useNavbarContextStrict } from './NavbarContext';
|
|
15
|
+
export type { NavbarContextValue, NavbarVariant, NavbarPosition } from './NavbarContext';
|