@mdxui/tremor 6.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/README.md +255 -0
- package/dist/dashboard/components/index.d.ts +355 -0
- package/dist/dashboard/components/index.js +549 -0
- package/dist/dashboard/components/index.js.map +1 -0
- package/dist/dashboard/index.d.ts +275 -0
- package/dist/dashboard/index.js +1062 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/database/index.d.ts +334 -0
- package/dist/database/index.js +474 -0
- package/dist/database/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1089 -0
- package/dist/index.js.map +1 -0
- package/dist/insights/components/index.d.ts +362 -0
- package/dist/insights/components/index.js +1397 -0
- package/dist/insights/components/index.js.map +1 -0
- package/dist/insights/index.d.ts +360 -0
- package/dist/insights/index.js +1815 -0
- package/dist/insights/index.js.map +1 -0
- package/dist/overview/components/index.d.ts +86 -0
- package/dist/overview/components/index.js +775 -0
- package/dist/overview/components/index.js.map +1 -0
- package/dist/overview/index.d.ts +301 -0
- package/dist/overview/index.js +1077 -0
- package/dist/overview/index.js.map +1 -0
- package/dist/shared/index.d.ts +296 -0
- package/dist/shared/index.js +395 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/solar/components/index.d.ts +341 -0
- package/dist/solar/components/index.js +831 -0
- package/dist/solar/components/index.js.map +1 -0
- package/dist/solar/index.d.ts +301 -0
- package/dist/solar/index.js +1130 -0
- package/dist/solar/index.js.map +1 -0
- package/package.json +135 -0
package/README.md
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# @mdxui/tremor
|
|
2
|
+
|
|
3
|
+
Tremor template wrappers implementing the mdxui interface. This package provides adapters that wrap [Tremor](https://www.tremor.so/) template components to conform to the `SiteComponents` and `AppComponents` interfaces defined by mdxui.
|
|
4
|
+
|
|
5
|
+
## What's Included
|
|
6
|
+
|
|
7
|
+
This package exports five template modules, each implementing specific use cases:
|
|
8
|
+
|
|
9
|
+
### Dashboard Template (`@mdxui/tremor/dashboard`)
|
|
10
|
+
|
|
11
|
+
A general-purpose SaaS dashboard implementing the `AppComponents` interface. Features flexible shell layouts with sidebar navigation, workspace switchers, and settings pages.
|
|
12
|
+
|
|
13
|
+
**Use for:** Admin dashboards, internal tools, SaaS applications
|
|
14
|
+
|
|
15
|
+
**Key Components:**
|
|
16
|
+
- `Shell` - Main layout container
|
|
17
|
+
- `ShellSidebarLeft` - Left sidebar navigation variant
|
|
18
|
+
- `ShellTopNav` - Top navigation variant
|
|
19
|
+
- `Sidebar` - Navigation sidebar with workspace/user management
|
|
20
|
+
- `Settings` - Settings page layout
|
|
21
|
+
- `AppComponents` - Pre-configured interface object
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { AppComponents, Shell, Sidebar } from '@mdxui/tremor/dashboard'
|
|
25
|
+
|
|
26
|
+
// Use AppComponents interface with MDX
|
|
27
|
+
<MDXProvider components={AppComponents}>
|
|
28
|
+
<App>
|
|
29
|
+
<Shell>
|
|
30
|
+
<Dashboard title="Analytics">
|
|
31
|
+
{content}
|
|
32
|
+
</Dashboard>
|
|
33
|
+
</Shell>
|
|
34
|
+
</App>
|
|
35
|
+
</MDXProvider>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Insights Template (`@mdxui/tremor/insights`)
|
|
39
|
+
|
|
40
|
+
Analytics dashboard with charts, KPIs, and data tables. Optimized for displaying metrics, trends, and transaction data.
|
|
41
|
+
|
|
42
|
+
**Use for:** Analytics dashboards, reporting, business intelligence
|
|
43
|
+
|
|
44
|
+
**Key Components:**
|
|
45
|
+
- `Shell` - Analytics dashboard container
|
|
46
|
+
- `Sidebar` - Navigation for analytics sections
|
|
47
|
+
- `KPICard` - Metric/KPI display
|
|
48
|
+
- `AreaChart`, `BarChart`, `DonutChart`, `BarChartVariant`, `TransactionChart` - Data visualization
|
|
49
|
+
- `TransactionsTable` - Data table with sorting/filtering
|
|
50
|
+
- `components` - Pre-configured interface object
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { components, Shell, Sidebar, KPICard } from '@mdxui/tremor/insights'
|
|
54
|
+
|
|
55
|
+
// Use with MDX
|
|
56
|
+
<MDXProvider components={components}>
|
|
57
|
+
<Shell sidebar={<Sidebar items={navItems} />}>
|
|
58
|
+
<KPICard title="Revenue" value="$25.5M" />
|
|
59
|
+
<AreaChart data={chartData} />
|
|
60
|
+
<TransactionsTable transactions={data} />
|
|
61
|
+
</Shell>
|
|
62
|
+
</MDXProvider>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Overview Template (`@mdxui/tremor/overview`)
|
|
66
|
+
|
|
67
|
+
Multi-section dashboard for cross-functional views like Support, Retention, Workflow, and Agents. Implementing the `AppComponents` interface with specialized section components.
|
|
68
|
+
|
|
69
|
+
**Use for:** Multi-team dashboards, operational overview, support platforms
|
|
70
|
+
|
|
71
|
+
**Key Components:**
|
|
72
|
+
- `Shell` - Top navigation shell layout
|
|
73
|
+
- `Sidebar` - Secondary navigation
|
|
74
|
+
- `Header` - Header bar
|
|
75
|
+
- `Dashboard` - Dashboard page layout
|
|
76
|
+
- `Settings` - Settings page
|
|
77
|
+
- `AgentsSection`, `RetentionSection`, `SupportSection`, `WorkflowSection` - Specialized dashboard sections
|
|
78
|
+
- `AppComponents` - Pre-configured interface object
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import { AppComponents } from '@mdxui/tremor/overview'
|
|
82
|
+
|
|
83
|
+
// Use with mdxui
|
|
84
|
+
<MDXProvider components={AppComponents}>
|
|
85
|
+
<App>
|
|
86
|
+
<Shell>
|
|
87
|
+
<Dashboard title="Support">
|
|
88
|
+
<SupportSection tickets={data} />
|
|
89
|
+
</Dashboard>
|
|
90
|
+
</Shell>
|
|
91
|
+
</App>
|
|
92
|
+
</MDXProvider>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Solar Template (`@mdxui/tremor/solar`)
|
|
96
|
+
|
|
97
|
+
Minimal landing page template implementing the `SiteComponents` interface. Focused on marketing sites and landing pages with hero sections, features, and CTA components.
|
|
98
|
+
|
|
99
|
+
**Use for:** Marketing sites, landing pages, product pages
|
|
100
|
+
|
|
101
|
+
**Key Components:**
|
|
102
|
+
- `Site` - Root site wrapper
|
|
103
|
+
- `Header` - Navigation header
|
|
104
|
+
- `Footer` - Site footer
|
|
105
|
+
- `LandingPage` - Landing page layout
|
|
106
|
+
- `Hero`, `HeroMinimal`, `HeroGradient` - Hero section variants
|
|
107
|
+
- `Features` - Features section
|
|
108
|
+
- `CTA` - Call-to-action section
|
|
109
|
+
- `components` - Pre-configured interface object
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { components, Site, Hero, Features } from '@mdxui/tremor/solar'
|
|
113
|
+
|
|
114
|
+
// Use with mdxui
|
|
115
|
+
<MDXProvider components={components}>
|
|
116
|
+
<Site name="My Product">
|
|
117
|
+
<Hero
|
|
118
|
+
headline="Build faster"
|
|
119
|
+
subheadline="Ship with confidence"
|
|
120
|
+
cta={{ primary: 'Get Started', primaryAction: '/signup' }}
|
|
121
|
+
/>
|
|
122
|
+
<Features features={featureList} />
|
|
123
|
+
</Site>
|
|
124
|
+
</MDXProvider>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Database Template (`@mdxui/tremor/database`)
|
|
128
|
+
|
|
129
|
+
Marketing site template implementing the `SiteComponents` interface. Provides core layout components for content-heavy marketing sites.
|
|
130
|
+
|
|
131
|
+
**Use for:** Marketing sites, documentation, content sites, product homepages
|
|
132
|
+
|
|
133
|
+
**Key Components:**
|
|
134
|
+
- `Site` - Root site wrapper
|
|
135
|
+
- `Header` - Navigation header
|
|
136
|
+
- `Footer` - Site footer
|
|
137
|
+
- `LandingPage` - Landing page layout
|
|
138
|
+
- `Page` - Generic page layout
|
|
139
|
+
- `components` - Pre-configured interface object
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
import { components, Site, Page } from '@mdxui/tremor/database'
|
|
143
|
+
|
|
144
|
+
// Use with mdxui
|
|
145
|
+
<MDXProvider components={components}>
|
|
146
|
+
<Site name="My Product">
|
|
147
|
+
<Page title="About Us">
|
|
148
|
+
{content}
|
|
149
|
+
</Page>
|
|
150
|
+
</Site>
|
|
151
|
+
</MDXProvider>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Installation
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npm install @mdxui/tremor @mdxui/primitives @tremor/react
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Usage
|
|
161
|
+
|
|
162
|
+
### Basic Setup
|
|
163
|
+
|
|
164
|
+
Import the template you need and use it with MDX:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { AppComponents } from '@mdxui/tremor/dashboard'
|
|
168
|
+
import { MDXProvider } from '@mdx-js/react'
|
|
169
|
+
|
|
170
|
+
export function App() {
|
|
171
|
+
return (
|
|
172
|
+
<MDXProvider components={AppComponents}>
|
|
173
|
+
{/* Your content */}
|
|
174
|
+
</MDXProvider>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Per-Template Imports
|
|
180
|
+
|
|
181
|
+
Each template is exported as a separate entry point to avoid conflicts:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
// App templates (AppComponents interface)
|
|
185
|
+
import { AppComponents as DashboardComponents } from '@mdxui/tremor/dashboard'
|
|
186
|
+
import { AppComponents as OverviewComponents } from '@mdxui/tremor/overview'
|
|
187
|
+
|
|
188
|
+
// Site templates (SiteComponents interface)
|
|
189
|
+
import { components as SolarComponents } from '@mdxui/tremor/solar'
|
|
190
|
+
import { components as DatabaseComponents } from '@mdxui/tremor/database'
|
|
191
|
+
|
|
192
|
+
// Analytics template
|
|
193
|
+
import { components as InsightsComponents } from '@mdxui/tremor/insights'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Shared Utilities
|
|
197
|
+
|
|
198
|
+
The `shared` export provides utilities available across all templates:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
import { /* shared utilities */ } from '@mdxui/tremor/shared'
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Component Variants
|
|
205
|
+
|
|
206
|
+
Many components offer multiple visual variants. Check individual component stories in the package for variant examples and usage patterns.
|
|
207
|
+
|
|
208
|
+
## Testing
|
|
209
|
+
|
|
210
|
+
This package uses test-driven development (TDD) with:
|
|
211
|
+
- **Unit tests** - Component behavior validation
|
|
212
|
+
- **Visual tests** - Playwright snapshot testing
|
|
213
|
+
- **Type checking** - TypeScript for prop validation
|
|
214
|
+
|
|
215
|
+
Run tests with:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
pnpm --filter @mdxui/tremor test # Unit tests
|
|
219
|
+
pnpm --filter @mdxui/tremor test:watch # Watch mode
|
|
220
|
+
pnpm --filter @mdxui/tremor test:visual # Visual tests
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Architecture
|
|
224
|
+
|
|
225
|
+
All templates in this package:
|
|
226
|
+
|
|
227
|
+
1. **Wrap Tremor components** - Use Tremor's pre-built template patterns as the foundation
|
|
228
|
+
2. **Implement mdxui interfaces** - Conform to `AppComponents` (for dashboards) or `SiteComponents` (for sites)
|
|
229
|
+
3. **Provide type-safe props** - Use TypeScript for IDE autocomplete and compile-time validation
|
|
230
|
+
4. **Support variant patterns** - Offer multiple visual and behavioral configurations
|
|
231
|
+
5. **Maintain Tremor compatibility** - Work seamlessly with Tremor's ecosystem and styling
|
|
232
|
+
|
|
233
|
+
## Type Safety
|
|
234
|
+
|
|
235
|
+
The package provides full TypeScript support with exported prop types:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
import type {
|
|
239
|
+
ShellProps as DashboardShellProps,
|
|
240
|
+
SidebarProps as DashboardSidebarProps,
|
|
241
|
+
DashboardComponents
|
|
242
|
+
} from '@mdxui/tremor/dashboard'
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Related Packages
|
|
246
|
+
|
|
247
|
+
- [`mdxui`](https://github.com/dot-do/ui/tree/main/packages/mdxui) - Core interfaces and type contracts
|
|
248
|
+
- [`@mdxui/primitives`](https://github.com/dot-do/ui/tree/main/packages/primitives) - Low-level UI components
|
|
249
|
+
- [`@mdxui/widgets`](https://github.com/dot-do/ui/tree/main/packages/widgets) - Complex interactive widgets
|
|
250
|
+
- [`@mdxui/beacon`](https://github.com/dot-do/ui/tree/main/packages/beacon) - Marketing site templates
|
|
251
|
+
- [`@mdxui/cockpit`](https://github.com/dot-do/ui/tree/main/packages/cockpit) - Developer dashboard templates
|
|
252
|
+
|
|
253
|
+
## License
|
|
254
|
+
|
|
255
|
+
MIT
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ComponentType, SVGProps, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type ShellVariant = "sidebar-left" | "sidebar-right" | "top-nav" | "minimal";
|
|
5
|
+
/**
|
|
6
|
+
* Navigation item configuration for the shell
|
|
7
|
+
*/
|
|
8
|
+
interface ShellNavItem {
|
|
9
|
+
/** Unique identifier */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Display label */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Link href */
|
|
14
|
+
href?: string;
|
|
15
|
+
/** Icon component */
|
|
16
|
+
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
17
|
+
/** Is currently active */
|
|
18
|
+
active?: boolean;
|
|
19
|
+
/** Is disabled */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Click handler */
|
|
22
|
+
onClick?: () => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Workspace configuration for workspace switcher
|
|
26
|
+
*/
|
|
27
|
+
interface ShellWorkspace {
|
|
28
|
+
/** Workspace identifier */
|
|
29
|
+
id: string;
|
|
30
|
+
/** Workspace name */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Initials for avatar */
|
|
33
|
+
initials: string;
|
|
34
|
+
/** User role in workspace */
|
|
35
|
+
role: string;
|
|
36
|
+
/** Background color class */
|
|
37
|
+
color?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* User profile configuration
|
|
41
|
+
*/
|
|
42
|
+
interface ShellUser {
|
|
43
|
+
/** User display name */
|
|
44
|
+
name: string;
|
|
45
|
+
/** User email */
|
|
46
|
+
email?: string;
|
|
47
|
+
/** User initials for avatar */
|
|
48
|
+
initials: string;
|
|
49
|
+
}
|
|
50
|
+
interface ShellProps {
|
|
51
|
+
/** Shell variant determines layout structure */
|
|
52
|
+
variant?: ShellVariant;
|
|
53
|
+
/** Main content area */
|
|
54
|
+
children?: any;
|
|
55
|
+
/** Navigation items for sidebar */
|
|
56
|
+
navigation?: ShellNavItem[];
|
|
57
|
+
/** Shortcut items for sidebar */
|
|
58
|
+
shortcuts?: ShellNavItem[];
|
|
59
|
+
/** Current workspace */
|
|
60
|
+
workspace?: ShellWorkspace;
|
|
61
|
+
/** Available workspaces */
|
|
62
|
+
workspaces?: ShellWorkspace[];
|
|
63
|
+
/** Current user */
|
|
64
|
+
user?: ShellUser;
|
|
65
|
+
/** Is sidebar collapsed */
|
|
66
|
+
sidebarCollapsed?: boolean;
|
|
67
|
+
/** Sidebar collapse handler */
|
|
68
|
+
onSidebarCollapse?: (collapsed: boolean) => void;
|
|
69
|
+
/** Current pathname for active navigation state */
|
|
70
|
+
pathname?: string;
|
|
71
|
+
/** Link component for routing (e.g., Next.js Link) */
|
|
72
|
+
LinkComponent?: ComponentType<{
|
|
73
|
+
href: string;
|
|
74
|
+
className?: string;
|
|
75
|
+
children: ReactNode;
|
|
76
|
+
}>;
|
|
77
|
+
/** Custom sidebar content or boolean to show/hide default sidebar */
|
|
78
|
+
sidebar?: ReactNode | boolean;
|
|
79
|
+
/** Custom header content or boolean to show/hide default header */
|
|
80
|
+
header?: ReactNode | boolean;
|
|
81
|
+
/** Theme mode */
|
|
82
|
+
theme?: "light" | "dark" | "system";
|
|
83
|
+
/** Loading state */
|
|
84
|
+
loading?: boolean;
|
|
85
|
+
/** Additional className for the main content area */
|
|
86
|
+
className?: string;
|
|
87
|
+
/** Additional className for the shell container */
|
|
88
|
+
containerClassName?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Shell - Flexible dashboard shell component with variant support
|
|
92
|
+
*
|
|
93
|
+
* A polymorphic shell component that renders different layouts based on the variant prop.
|
|
94
|
+
* Use the named exports (ShellSidebarLeft, ShellTopNav) for full control over layout props.
|
|
95
|
+
*
|
|
96
|
+
* Based on Tremor dashboard template layout patterns:
|
|
97
|
+
* - Fixed sidebar with workspace switcher and user profile
|
|
98
|
+
* - Mobile-responsive with drawer navigation
|
|
99
|
+
* - Support for collapsed sidebar state
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* // Basic usage with default variant (sidebar-left)
|
|
104
|
+
* <Shell navigation={navItems} user={currentUser}>
|
|
105
|
+
* <Dashboard />
|
|
106
|
+
* </Shell>
|
|
107
|
+
*
|
|
108
|
+
* // With top-nav variant
|
|
109
|
+
* <Shell variant="top-nav" header={<TopNav />}>
|
|
110
|
+
* <Dashboard />
|
|
111
|
+
* </Shell>
|
|
112
|
+
*
|
|
113
|
+
* // With collapsed sidebar
|
|
114
|
+
* <Shell sidebarCollapsed={true}>
|
|
115
|
+
* <Dashboard />
|
|
116
|
+
* </Shell>
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
declare function Shell({ variant, children, navigation: _navigation, shortcuts: _shortcuts, workspace: _workspace, workspaces: _workspaces, user: _user, sidebarCollapsed, onSidebarCollapse: _onSidebarCollapse, pathname: _pathname, LinkComponent: _LinkComponent, sidebar, header, theme: _theme, loading, className, containerClassName, }: ShellProps): react_jsx_runtime.JSX.Element;
|
|
120
|
+
|
|
121
|
+
interface ShellSidebarLeftProps {
|
|
122
|
+
/** Content to render in the sidebar (left side) - if not provided, uses built-in sidebar */
|
|
123
|
+
sidebar?: ReactNode;
|
|
124
|
+
/** Content to render in the mobile header (optional) */
|
|
125
|
+
mobileHeader?: ReactNode;
|
|
126
|
+
/** Main content area */
|
|
127
|
+
children: ReactNode;
|
|
128
|
+
/** Navigation items for built-in sidebar */
|
|
129
|
+
navigation?: ShellNavItem[];
|
|
130
|
+
/** Shortcut items for built-in sidebar */
|
|
131
|
+
shortcuts?: ShellNavItem[];
|
|
132
|
+
/** Current workspace */
|
|
133
|
+
workspace?: ShellWorkspace;
|
|
134
|
+
/** Available workspaces */
|
|
135
|
+
workspaces?: ShellWorkspace[];
|
|
136
|
+
/** Current user */
|
|
137
|
+
user?: ShellUser;
|
|
138
|
+
/** Is sidebar collapsed */
|
|
139
|
+
collapsed?: boolean;
|
|
140
|
+
/** Sidebar collapse handler */
|
|
141
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
142
|
+
/** Current pathname for active navigation state */
|
|
143
|
+
pathname?: string;
|
|
144
|
+
/** Link component for routing (e.g., Next.js Link) */
|
|
145
|
+
LinkComponent?: ComponentType<{
|
|
146
|
+
href: string;
|
|
147
|
+
className?: string;
|
|
148
|
+
children: ReactNode;
|
|
149
|
+
}>;
|
|
150
|
+
/** Additional className for the main content area */
|
|
151
|
+
className?: string;
|
|
152
|
+
/** Additional className for the container */
|
|
153
|
+
containerClassName?: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* ShellSidebarLeft - Dashboard shell with sidebar on the left
|
|
157
|
+
*
|
|
158
|
+
* A layout component that provides a sidebar-left dashboard shell structure
|
|
159
|
+
* based on the Tremor dashboard template:
|
|
160
|
+
* - Fixed sidebar (72px wide, or 16px when collapsed) on the left
|
|
161
|
+
* - Sticky mobile header with workspace switcher and user profile
|
|
162
|
+
* - Responsive layout with drawer navigation on mobile
|
|
163
|
+
* - Main content area with proper padding for sidebar
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```tsx
|
|
167
|
+
* <ShellSidebarLeft
|
|
168
|
+
* navigation={[
|
|
169
|
+
* { id: 'overview', label: 'Overview', href: '/overview', icon: HomeIcon },
|
|
170
|
+
* { id: 'details', label: 'Details', href: '/details', icon: ListIcon },
|
|
171
|
+
* ]}
|
|
172
|
+
* workspace={{ id: '1', name: 'Retail Analytics', initials: 'RA', role: 'Member' }}
|
|
173
|
+
* user={{ name: 'Emma Stone', initials: 'ES' }}
|
|
174
|
+
* pathname="/overview"
|
|
175
|
+
* >
|
|
176
|
+
* <DashboardContent />
|
|
177
|
+
* </ShellSidebarLeft>
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
declare function ShellSidebarLeft({ sidebar, mobileHeader, children, navigation: _navigation, shortcuts: _shortcuts, workspace: _workspace, workspaces: _workspaces, user: _user, collapsed, onCollapse: _onCollapse, pathname: _pathname, LinkComponent: _LinkComponent, className, containerClassName, }: ShellSidebarLeftProps): react_jsx_runtime.JSX.Element;
|
|
181
|
+
|
|
182
|
+
interface ShellTopNavProps {
|
|
183
|
+
/** Content to render in the header/top nav */
|
|
184
|
+
header: ReactNode;
|
|
185
|
+
/** Content to render in the sidebar (optional) */
|
|
186
|
+
sidebar?: ReactNode;
|
|
187
|
+
/** Main content area */
|
|
188
|
+
children: ReactNode;
|
|
189
|
+
/** Additional className for the main content area */
|
|
190
|
+
className?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* ShellTopNav - Dashboard shell with top navigation
|
|
194
|
+
*
|
|
195
|
+
* A layout component that provides a top-nav dashboard shell structure:
|
|
196
|
+
* - Header/navigation at the top
|
|
197
|
+
* - Optional sidebar below header
|
|
198
|
+
* - Main content area
|
|
199
|
+
*/
|
|
200
|
+
declare function ShellTopNav({ header, sidebar, children, className, }: ShellTopNavProps): react_jsx_runtime.JSX.Element;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Navigation item configuration for the sidebar
|
|
204
|
+
*/
|
|
205
|
+
interface SidebarNavItem {
|
|
206
|
+
/** Unique identifier */
|
|
207
|
+
id: string;
|
|
208
|
+
/** Display label */
|
|
209
|
+
label: string;
|
|
210
|
+
/** Link href */
|
|
211
|
+
href?: string;
|
|
212
|
+
/** Icon component */
|
|
213
|
+
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
214
|
+
/** Is currently active */
|
|
215
|
+
active?: boolean;
|
|
216
|
+
/** Is disabled */
|
|
217
|
+
disabled?: boolean;
|
|
218
|
+
/** Click handler */
|
|
219
|
+
onClick?: () => void;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Shortcut item configuration
|
|
223
|
+
*/
|
|
224
|
+
interface SidebarShortcutItem {
|
|
225
|
+
/** Display name */
|
|
226
|
+
name: string;
|
|
227
|
+
/** Link href */
|
|
228
|
+
href: string;
|
|
229
|
+
/** Icon component */
|
|
230
|
+
icon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Workspace configuration for the workspace switcher
|
|
234
|
+
*/
|
|
235
|
+
interface SidebarWorkspace {
|
|
236
|
+
/** Workspace identifier */
|
|
237
|
+
id: string;
|
|
238
|
+
/** Workspace name */
|
|
239
|
+
name: string;
|
|
240
|
+
/** Initials for avatar */
|
|
241
|
+
initials: string;
|
|
242
|
+
/** User role in workspace */
|
|
243
|
+
role: string;
|
|
244
|
+
/** Background color class */
|
|
245
|
+
color?: string;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* User profile configuration for the sidebar footer
|
|
249
|
+
*/
|
|
250
|
+
interface SidebarUser {
|
|
251
|
+
/** User display name */
|
|
252
|
+
name: string;
|
|
253
|
+
/** User email */
|
|
254
|
+
email?: string;
|
|
255
|
+
/** User initials for avatar */
|
|
256
|
+
initials: string;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Props for the Sidebar adapter component
|
|
260
|
+
*/
|
|
261
|
+
interface SidebarProps {
|
|
262
|
+
/** Navigation items */
|
|
263
|
+
items?: SidebarNavItem[];
|
|
264
|
+
/** Shortcut items */
|
|
265
|
+
shortcuts?: SidebarShortcutItem[];
|
|
266
|
+
/** Current workspace */
|
|
267
|
+
workspace?: SidebarWorkspace;
|
|
268
|
+
/** Available workspaces for switching */
|
|
269
|
+
workspaces?: SidebarWorkspace[];
|
|
270
|
+
/** Current user */
|
|
271
|
+
user?: SidebarUser;
|
|
272
|
+
/** Is sidebar collapsed */
|
|
273
|
+
collapsed?: boolean;
|
|
274
|
+
/** Collapse toggle handler */
|
|
275
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
276
|
+
/** Custom header content */
|
|
277
|
+
header?: ReactNode;
|
|
278
|
+
/** Custom footer content */
|
|
279
|
+
footer?: ReactNode;
|
|
280
|
+
/** Additional className */
|
|
281
|
+
className?: string;
|
|
282
|
+
/** Current pathname for active state detection */
|
|
283
|
+
pathname?: string;
|
|
284
|
+
/** Link component for routing (e.g., Next.js Link) */
|
|
285
|
+
LinkComponent?: ComponentType<{
|
|
286
|
+
href: string;
|
|
287
|
+
className?: string;
|
|
288
|
+
children: ReactNode;
|
|
289
|
+
}>;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Sidebar - Navigation sidebar with workspace switcher and user profile
|
|
293
|
+
*
|
|
294
|
+
* A vertical navigation bar featuring:
|
|
295
|
+
* - Workspace dropdown at the top
|
|
296
|
+
* - Primary navigation links
|
|
297
|
+
* - Shortcuts section
|
|
298
|
+
* - User profile at the bottom
|
|
299
|
+
*
|
|
300
|
+
* Based on Tremor dashboard template sidebar design.
|
|
301
|
+
*/
|
|
302
|
+
declare function Sidebar({ items, shortcuts, workspace, workspaces, user, collapsed, onCollapse: _onCollapse, header, footer, className, pathname, LinkComponent, }: SidebarProps): react_jsx_runtime.JSX.Element;
|
|
303
|
+
/**
|
|
304
|
+
* Workspace Switcher component
|
|
305
|
+
*/
|
|
306
|
+
interface WorkspaceSwitcherProps {
|
|
307
|
+
workspace: SidebarWorkspace;
|
|
308
|
+
workspaces?: SidebarWorkspace[];
|
|
309
|
+
collapsed?: boolean;
|
|
310
|
+
}
|
|
311
|
+
declare function WorkspaceSwitcher({ workspace, workspaces: _workspaces, collapsed, }: WorkspaceSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
312
|
+
/**
|
|
313
|
+
* User Profile component for sidebar footer
|
|
314
|
+
*/
|
|
315
|
+
interface UserProfileProps {
|
|
316
|
+
user: SidebarUser;
|
|
317
|
+
collapsed?: boolean;
|
|
318
|
+
}
|
|
319
|
+
declare function UserProfile({ user, collapsed }: UserProfileProps): react_jsx_runtime.JSX.Element;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Link component props
|
|
323
|
+
*/
|
|
324
|
+
interface LinkProps {
|
|
325
|
+
href: string;
|
|
326
|
+
className?: string;
|
|
327
|
+
children: ReactNode;
|
|
328
|
+
onClick?: () => void;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Props for the MobileSidebar component
|
|
332
|
+
*/
|
|
333
|
+
interface MobileSidebarProps {
|
|
334
|
+
/** Navigation items */
|
|
335
|
+
items?: SidebarNavItem[];
|
|
336
|
+
/** Shortcut items */
|
|
337
|
+
shortcuts?: SidebarShortcutItem[];
|
|
338
|
+
/** Title for the mobile drawer */
|
|
339
|
+
title?: string;
|
|
340
|
+
/** Current pathname for active state detection */
|
|
341
|
+
pathname?: string;
|
|
342
|
+
/** Link component for routing (e.g., Next.js Link) */
|
|
343
|
+
LinkComponent?: ComponentType<LinkProps>;
|
|
344
|
+
/** Additional className */
|
|
345
|
+
className?: string;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Mobile Sidebar - Drawer-based navigation for smaller screens
|
|
349
|
+
*
|
|
350
|
+
* A slide-out drawer that displays navigation on mobile devices.
|
|
351
|
+
* Features a hamburger menu button and animated drawer transition.
|
|
352
|
+
*/
|
|
353
|
+
declare function MobileSidebar({ items, shortcuts, title, pathname, LinkComponent, className, }: MobileSidebarProps): react_jsx_runtime.JSX.Element;
|
|
354
|
+
|
|
355
|
+
export { MobileSidebar, type MobileSidebarProps, Shell, type ShellNavItem, type ShellProps, ShellSidebarLeft, type ShellSidebarLeftProps, ShellTopNav, type ShellTopNavProps, type ShellUser, type ShellVariant, type ShellWorkspace, Sidebar, type SidebarNavItem, type SidebarProps, type SidebarShortcutItem, type SidebarUser, type SidebarWorkspace, UserProfile, WorkspaceSwitcher };
|