@wso2/oxygen-ui 0.0.1-alpha.9 → 0.1.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/.ai/AGENTS.md +78 -0
- package/.ai/components.md +798 -0
- package/.ai/migration.md +279 -0
- package/.ai/patterns.md +1185 -0
- package/.ai/theming.md +318 -0
- package/.claude/components.md +798 -0
- package/.claude/migration.md +279 -0
- package/.claude/patterns.md +1185 -0
- package/.claude/skills/oxygen-component/SKILL.md +141 -0
- package/.claude/skills/oxygen-form/SKILL.md +410 -0
- package/.claude/skills/oxygen-layout/SKILL.md +233 -0
- package/.claude/skills/oxygen-migrate/SKILL.md +277 -0
- package/.claude/theming.md +318 -0
- package/README.md +182 -2
- package/bin/cli.js +480 -0
- package/dist/animations/ParticleBackground/ParticleBackground.d.ts +66 -0
- package/dist/animations/ParticleBackground/index.d.ts +19 -0
- package/dist/animations/index.d.ts +18 -0
- package/dist/components/AppShell/AppShell.d.ts +69 -0
- package/dist/components/AppShell/AppShellFooter.d.ts +41 -0
- package/dist/components/AppShell/AppShellMain.d.ts +41 -0
- package/dist/components/AppShell/AppShellNavbar.d.ts +41 -0
- package/dist/components/AppShell/AppShellNotificationPanel.d.ts +41 -0
- package/dist/components/AppShell/AppShellSidebar.d.ts +41 -0
- package/dist/components/AppShell/index.d.ts +29 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +47 -0
- package/dist/components/CodeBlock/index.d.ts +19 -0
- package/dist/components/ColorSchemeImage/index.d.ts +19 -0
- package/dist/components/ColorSchemeToggle/index.d.ts +18 -0
- package/dist/components/ComplexSelect/ComplexSelect.d.ts +25 -0
- package/dist/components/ComplexSelect/ComplexSelectDivider.d.ts +4 -0
- package/dist/components/ComplexSelect/ComplexSelectListHeader.d.ts +7 -0
- package/dist/components/ComplexSelect/ComplexSelectMenuItem.d.ts +16 -0
- package/dist/components/ComplexSelect/ComplexSelectMenuItemAvatar.d.ts +7 -0
- package/dist/components/ComplexSelect/ComplexSelectMenuItemIcon.d.ts +7 -0
- package/dist/components/ComplexSelect/ComplexSelectMenuItemText.d.ts +8 -0
- package/dist/components/ComplexSelect/index.d.ts +21 -0
- package/dist/components/Footer/Footer.d.ts +71 -0
- package/dist/components/Footer/index.d.ts +19 -0
- package/dist/components/Form/CardButton.d.ts +30 -0
- package/dist/components/Form/ElementWrapper.d.ts +24 -0
- package/dist/components/Form/Section.d.ts +21 -0
- package/dist/components/Form/Stack.d.ts +19 -0
- package/dist/components/Form/Typography.d.ts +21 -0
- package/dist/components/Form/Wizard.d.ts +27 -0
- package/dist/components/Form/index.d.ts +38 -0
- package/dist/components/Header/Header.d.ts +89 -0
- package/dist/components/Header/HeaderActions.d.ts +42 -0
- package/dist/components/Header/HeaderBrand.d.ts +48 -0
- package/dist/components/Header/HeaderBrandLogo.d.ts +45 -0
- package/dist/components/Header/HeaderBrandTitle.d.ts +45 -0
- package/dist/components/Header/HeaderSwitchers.d.ts +45 -0
- package/dist/components/Header/HeaderToggle.d.ts +52 -0
- package/dist/components/Header/context.d.ts +34 -0
- package/dist/components/Header/index.d.ts +33 -0
- package/dist/components/ListingTable/ListingTable/ListingTable.d.ts +54 -0
- package/dist/components/ListingTable/ListingTable/ListingTableBody.d.ts +6 -0
- package/dist/components/ListingTable/ListingTable/ListingTableCell.d.ts +15 -0
- package/dist/components/ListingTable/ListingTable/ListingTableContainer.d.ts +17 -0
- package/dist/components/ListingTable/ListingTable/ListingTableFooter.d.ts +6 -0
- package/dist/components/ListingTable/ListingTable/ListingTableHead.d.ts +6 -0
- package/dist/components/ListingTable/ListingTable/ListingTableRow.d.ts +18 -0
- package/dist/components/ListingTable/ListingTable/index.d.ts +21 -0
- package/dist/components/ListingTable/ListingTableProvider.d.ts +28 -0
- package/dist/components/ListingTable/context.d.ts +78 -0
- package/dist/components/ListingTable/index.d.ts +22 -0
- package/dist/components/ListingTable/shared/ListingTableCellIcon.d.ts +31 -0
- package/dist/components/ListingTable/shared/ListingTableDensityControl.d.ts +26 -0
- package/dist/components/ListingTable/shared/ListingTableEmptyState.d.ts +32 -0
- package/dist/components/ListingTable/shared/ListingTableRowActions.d.ts +24 -0
- package/dist/components/ListingTable/shared/ListingTableSortLabel.d.ts +37 -0
- package/dist/components/ListingTable/shared/ListingTableToolbar.d.ts +52 -0
- package/dist/components/ListingTable/shared/index.d.ts +14 -0
- package/dist/components/ListingTable/shared/types.d.ts +5 -0
- package/dist/components/NotificationBanner/NotificationBanner.d.ts +69 -0
- package/dist/components/NotificationBanner/index.d.ts +19 -0
- package/dist/components/NotificationPanel/NotificationActions.d.ts +44 -0
- package/dist/components/NotificationPanel/NotificationEmptyState.d.ts +41 -0
- package/dist/components/NotificationPanel/NotificationHeader.d.ts +47 -0
- package/dist/components/NotificationPanel/NotificationHeaderBadge.d.ts +46 -0
- package/dist/components/NotificationPanel/NotificationHeaderClose.d.ts +46 -0
- package/dist/components/NotificationPanel/NotificationHeaderIcon.d.ts +43 -0
- package/dist/components/NotificationPanel/NotificationHeaderTitle.d.ts +43 -0
- package/dist/components/NotificationPanel/NotificationItem.d.ts +64 -0
- package/dist/components/NotificationPanel/NotificationItemAction.d.ts +46 -0
- package/dist/components/NotificationPanel/NotificationItemAvatar.d.ts +44 -0
- package/dist/components/NotificationPanel/NotificationItemContext.d.ts +52 -0
- package/dist/components/NotificationPanel/NotificationItemMessage.d.ts +47 -0
- package/dist/components/NotificationPanel/NotificationItemTimestamp.d.ts +46 -0
- package/dist/components/NotificationPanel/NotificationItemTitle.d.ts +49 -0
- package/dist/components/NotificationPanel/NotificationList.d.ts +37 -0
- package/dist/components/NotificationPanel/NotificationPanel.d.ts +122 -0
- package/dist/components/NotificationPanel/NotificationTabs.d.ts +51 -0
- package/dist/components/NotificationPanel/context.d.ts +34 -0
- package/dist/components/NotificationPanel/index.d.ts +55 -0
- package/dist/components/NotificationPanel/utils.d.ts +46 -0
- package/dist/components/PageContent/PageContent.d.ts +71 -0
- package/dist/components/PageContent/index.d.ts +2 -0
- package/dist/components/PageTitle/PageTitle.d.ts +34 -0
- package/dist/components/PageTitle/PageTitleAvatar.d.ts +16 -0
- package/dist/components/PageTitle/PageTitleHeader.d.ts +16 -0
- package/dist/components/PageTitle/PageTitleLink.d.ts +20 -0
- package/dist/components/PageTitle/PageTitleSubHeader.d.ts +16 -0
- package/dist/components/PageTitle/index.d.ts +27 -0
- package/dist/components/SearchBar/SearchBar.d.ts +5 -0
- package/dist/components/SearchBar/SearchBarWithAdvancedFilter.d.ts +26 -0
- package/dist/components/Sidebar/Sidebar.d.ts +120 -0
- package/dist/components/Sidebar/SidebarCategory.d.ts +47 -0
- package/dist/components/Sidebar/SidebarCategoryLabel.d.ts +47 -0
- package/dist/components/Sidebar/SidebarFooter.d.ts +38 -0
- package/dist/components/Sidebar/SidebarItem.d.ts +61 -0
- package/dist/components/Sidebar/SidebarItemBadge.d.ts +47 -0
- package/dist/components/Sidebar/SidebarItemContext.d.ts +49 -0
- package/dist/components/Sidebar/SidebarItemIcon.d.ts +47 -0
- package/dist/components/Sidebar/SidebarItemLabel.d.ts +44 -0
- package/dist/components/Sidebar/SidebarNav.d.ts +42 -0
- package/dist/components/Sidebar/SidebarUser.d.ts +57 -0
- package/dist/components/Sidebar/SidebarUserAvatar.d.ts +51 -0
- package/dist/components/Sidebar/SidebarUserEmail.d.ts +48 -0
- package/dist/components/Sidebar/SidebarUserName.d.ts +45 -0
- package/dist/components/Sidebar/context.d.ts +42 -0
- package/dist/components/Sidebar/index.d.ts +47 -0
- package/dist/components/StatCard/StatCard.d.ts +48 -0
- package/dist/components/StatCard/index.d.ts +2 -0
- package/dist/components/ThemeSwitcher/ThemeSelect.d.ts +37 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts +65 -0
- package/dist/components/ThemeSwitcher/index.d.ts +4 -0
- package/dist/components/UserMenu/UserMenu.d.ts +74 -0
- package/dist/components/UserMenu/index.d.ts +19 -0
- package/dist/components/index.d.ts +54 -0
- package/dist/contexts/OxygenUIThemeProvider/OxygenUIThemeProvider.d.ts +58 -3
- package/dist/contexts/OxygenUIThemeProvider/index.d.ts +20 -0
- package/dist/contexts/index.d.ts +19 -0
- package/dist/hooks/index.d.ts +22 -0
- package/dist/hooks/useAppShell/index.d.ts +19 -0
- package/dist/hooks/useAppShell/useAppShell.d.ts +81 -0
- package/dist/hooks/useNotifications/index.d.ts +19 -0
- package/dist/hooks/useNotifications/useNotifications.d.ts +105 -0
- package/dist/hooks/useThemeContent/index.d.ts +18 -0
- package/dist/hooks/useThemeContent/useThemeContent.d.ts +57 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.js +5172 -252
- package/dist/index.js.map +4 -4
- package/dist/layouts/Layout.d.ts +3 -0
- package/dist/layouts/LayoutContent.d.ts +3 -0
- package/dist/layouts/LayoutHeader.d.ts +3 -0
- package/dist/layouts/LayoutNavbar.d.ts +3 -0
- package/dist/layouts/LayoutSidebar.d.ts +3 -0
- package/dist/styles/Themes/AcrylicBaseTheme.d.ts +25 -0
- package/dist/styles/Themes/AcrylicOrangeTheme.d.ts +17 -0
- package/dist/styles/Themes/AcrylicPurpleTheme.d.ts +20 -0
- package/dist/styles/Themes/ClassicTheme.d.ts +24 -0
- package/dist/styles/Themes/HighContrastTheme.d.ts +20 -0
- package/dist/styles/Themes/OxygenThemeBase.d.ts +70 -0
- package/dist/styles/Themes/index.d.ts +22 -0
- package/dist/styles/index.d.ts +18 -0
- package/dist/utils/formatRelativeTime.d.ts +34 -0
- package/dist/utils/index.d.ts +19 -0
- package/dist/utils/pxToRem.d.ts +23 -0
- package/package.json +20 -12
- package/dist/components/ColorSchemeImage/ColorSchemeImage.js +0 -57
- package/dist/components/ColorSchemeImage/ColorSchemeImage.js.map +0 -7
- package/dist/components/ColorSchemeToggle/ColorSchemeToggle.js +0 -76
- package/dist/components/ColorSchemeToggle/ColorSchemeToggle.js.map +0 -7
- package/dist/contexts/OxygenUIThemeProvider/OxygenUIThemeProvider.js +0 -378
- package/dist/contexts/OxygenUIThemeProvider/OxygenUIThemeProvider.js.map +0 -7
- package/dist/styles/OxygenTheme/OxygenTheme.d.ts +0 -38
- package/dist/styles/OxygenTheme/OxygenTheme.js +0 -356
- package/dist/styles/OxygenTheme/OxygenTheme.js.map +0 -7
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oxygen-layout
|
|
3
|
+
description: Generate application layouts with AppShell, Header, and Sidebar. Use when creating app shells, navigation structures, or dashboard layouts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Generate Oxygen UI Layout
|
|
7
|
+
|
|
8
|
+
## Instructions
|
|
9
|
+
|
|
10
|
+
1. Read `.claude/oxygen-ui/patterns.md` for layout patterns
|
|
11
|
+
2. Use `AppShell` as the main wrapper
|
|
12
|
+
3. Configure `Header` with navigation
|
|
13
|
+
4. Set up `Sidebar` with menu items
|
|
14
|
+
|
|
15
|
+
## Critical Rules
|
|
16
|
+
|
|
17
|
+
- Always use `OxygenUIThemeProvider` at the root
|
|
18
|
+
- Use compound component pattern for `AppShell`, `Header`, `Sidebar`
|
|
19
|
+
- Import icons from `@wso2/oxygen-ui-icons-react`
|
|
20
|
+
- Use theme tokens for all styling
|
|
21
|
+
|
|
22
|
+
## Complete App Shell Layout
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { useState } from 'react';
|
|
26
|
+
import {
|
|
27
|
+
OxygenUIThemeProvider,
|
|
28
|
+
OxygenTheme,
|
|
29
|
+
AppShell,
|
|
30
|
+
Header,
|
|
31
|
+
Sidebar,
|
|
32
|
+
Footer,
|
|
33
|
+
Box,
|
|
34
|
+
ColorSchemeToggle,
|
|
35
|
+
UserMenu,
|
|
36
|
+
} from '@wso2/oxygen-ui';
|
|
37
|
+
import {
|
|
38
|
+
HomeIcon,
|
|
39
|
+
DashboardIcon,
|
|
40
|
+
SettingsIcon,
|
|
41
|
+
UsersIcon,
|
|
42
|
+
FileIcon,
|
|
43
|
+
} from '@wso2/oxygen-ui-icons-react';
|
|
44
|
+
|
|
45
|
+
function App() {
|
|
46
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
47
|
+
const [activeItem, setActiveItem] = useState('home');
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<OxygenUIThemeProvider theme={OxygenTheme}>
|
|
51
|
+
<AppShell>
|
|
52
|
+
<AppShell.Navbar>
|
|
53
|
+
<Header>
|
|
54
|
+
<Header.Toggle
|
|
55
|
+
collapsed={collapsed}
|
|
56
|
+
onToggle={() => setCollapsed(!collapsed)}
|
|
57
|
+
/>
|
|
58
|
+
<Header.Brand>
|
|
59
|
+
<Header.BrandLogo>
|
|
60
|
+
<img src="/logo.svg" alt="Logo" height={32} />
|
|
61
|
+
</Header.BrandLogo>
|
|
62
|
+
<Header.BrandTitle>My Application</Header.BrandTitle>
|
|
63
|
+
</Header.Brand>
|
|
64
|
+
<Header.Spacer />
|
|
65
|
+
<Header.Actions>
|
|
66
|
+
<ColorSchemeToggle />
|
|
67
|
+
<UserMenu
|
|
68
|
+
user={{ name: 'John Doe', email: 'john@example.com' }}
|
|
69
|
+
onSignOut={() => console.log('Sign out')}
|
|
70
|
+
/>
|
|
71
|
+
</Header.Actions>
|
|
72
|
+
</Header>
|
|
73
|
+
</AppShell.Navbar>
|
|
74
|
+
|
|
75
|
+
<AppShell.Sidebar>
|
|
76
|
+
<Sidebar
|
|
77
|
+
collapsed={collapsed}
|
|
78
|
+
activeItem={activeItem}
|
|
79
|
+
onSelect={setActiveItem}
|
|
80
|
+
>
|
|
81
|
+
<Sidebar.Nav>
|
|
82
|
+
<Sidebar.Category>
|
|
83
|
+
<Sidebar.CategoryLabel>Main</Sidebar.CategoryLabel>
|
|
84
|
+
<Sidebar.Item id="home">
|
|
85
|
+
<Sidebar.ItemIcon><HomeIcon size={20} /></Sidebar.ItemIcon>
|
|
86
|
+
<Sidebar.ItemLabel>Home</Sidebar.ItemLabel>
|
|
87
|
+
</Sidebar.Item>
|
|
88
|
+
<Sidebar.Item id="dashboard">
|
|
89
|
+
<Sidebar.ItemIcon><DashboardIcon size={20} /></Sidebar.ItemIcon>
|
|
90
|
+
<Sidebar.ItemLabel>Dashboard</Sidebar.ItemLabel>
|
|
91
|
+
</Sidebar.Item>
|
|
92
|
+
</Sidebar.Category>
|
|
93
|
+
|
|
94
|
+
<Sidebar.Category>
|
|
95
|
+
<Sidebar.CategoryLabel>Management</Sidebar.CategoryLabel>
|
|
96
|
+
<Sidebar.Item id="users">
|
|
97
|
+
<Sidebar.ItemIcon><UsersIcon size={20} /></Sidebar.ItemIcon>
|
|
98
|
+
<Sidebar.ItemLabel>Users</Sidebar.ItemLabel>
|
|
99
|
+
<Sidebar.ItemBadge>12</Sidebar.ItemBadge>
|
|
100
|
+
</Sidebar.Item>
|
|
101
|
+
<Sidebar.Item id="files">
|
|
102
|
+
<Sidebar.ItemIcon><FileIcon size={20} /></Sidebar.ItemIcon>
|
|
103
|
+
<Sidebar.ItemLabel>Files</Sidebar.ItemLabel>
|
|
104
|
+
</Sidebar.Item>
|
|
105
|
+
</Sidebar.Category>
|
|
106
|
+
</Sidebar.Nav>
|
|
107
|
+
|
|
108
|
+
<Sidebar.Footer>
|
|
109
|
+
<Sidebar.Item id="settings">
|
|
110
|
+
<Sidebar.ItemIcon><SettingsIcon size={20} /></Sidebar.ItemIcon>
|
|
111
|
+
<Sidebar.ItemLabel>Settings</Sidebar.ItemLabel>
|
|
112
|
+
</Sidebar.Item>
|
|
113
|
+
</Sidebar.Footer>
|
|
114
|
+
</Sidebar>
|
|
115
|
+
</AppShell.Sidebar>
|
|
116
|
+
|
|
117
|
+
<AppShell.Main>
|
|
118
|
+
<Box sx={{ p: 3 }}>
|
|
119
|
+
{/* Page content goes here */}
|
|
120
|
+
<h1>Welcome</h1>
|
|
121
|
+
</Box>
|
|
122
|
+
</AppShell.Main>
|
|
123
|
+
|
|
124
|
+
<AppShell.Footer>
|
|
125
|
+
<Footer companyName="WSO2 LLC" />
|
|
126
|
+
</AppShell.Footer>
|
|
127
|
+
</AppShell>
|
|
128
|
+
</OxygenUIThemeProvider>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export default App;
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Header with Context Switchers
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<Header>
|
|
139
|
+
<Header.Toggle collapsed={collapsed} onToggle={toggleSidebar} />
|
|
140
|
+
<Header.Brand>
|
|
141
|
+
<Header.BrandLogo><Logo /></Header.BrandLogo>
|
|
142
|
+
<Header.BrandTitle>App Name</Header.BrandTitle>
|
|
143
|
+
</Header.Brand>
|
|
144
|
+
|
|
145
|
+
<Header.Switchers>
|
|
146
|
+
<OrganizationSwitcher />
|
|
147
|
+
<ProjectSwitcher />
|
|
148
|
+
</Header.Switchers>
|
|
149
|
+
|
|
150
|
+
<Header.Spacer />
|
|
151
|
+
|
|
152
|
+
<Header.Actions>
|
|
153
|
+
<SearchBar />
|
|
154
|
+
<NotificationButton />
|
|
155
|
+
<ColorSchemeToggle />
|
|
156
|
+
<UserMenu user={user} />
|
|
157
|
+
</Header.Actions>
|
|
158
|
+
</Header>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Minimal Header (No Switchers)
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
<Header minimal>
|
|
165
|
+
<Header.Brand>
|
|
166
|
+
<Header.BrandTitle>Simple App</Header.BrandTitle>
|
|
167
|
+
</Header.Brand>
|
|
168
|
+
<Header.Spacer />
|
|
169
|
+
<Header.Actions>
|
|
170
|
+
<ColorSchemeToggle />
|
|
171
|
+
</Header.Actions>
|
|
172
|
+
</Header>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Sidebar with Nested Items
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
<Sidebar
|
|
179
|
+
collapsed={collapsed}
|
|
180
|
+
activeItem={activeItem}
|
|
181
|
+
expandedMenus={expandedMenus}
|
|
182
|
+
onSelect={setActiveItem}
|
|
183
|
+
onToggleExpand={toggleExpand}
|
|
184
|
+
>
|
|
185
|
+
<Sidebar.Nav>
|
|
186
|
+
<Sidebar.Item id="parent" hasChildren>
|
|
187
|
+
<Sidebar.ItemIcon><FolderIcon size={20} /></Sidebar.ItemIcon>
|
|
188
|
+
<Sidebar.ItemLabel>Parent Item</Sidebar.ItemLabel>
|
|
189
|
+
</Sidebar.Item>
|
|
190
|
+
|
|
191
|
+
{expandedMenus['parent'] && (
|
|
192
|
+
<>
|
|
193
|
+
<Sidebar.Item id="child1" nested>
|
|
194
|
+
<Sidebar.ItemLabel>Child 1</Sidebar.ItemLabel>
|
|
195
|
+
</Sidebar.Item>
|
|
196
|
+
<Sidebar.Item id="child2" nested>
|
|
197
|
+
<Sidebar.ItemLabel>Child 2</Sidebar.ItemLabel>
|
|
198
|
+
</Sidebar.Item>
|
|
199
|
+
</>
|
|
200
|
+
)}
|
|
201
|
+
</Sidebar.Nav>
|
|
202
|
+
</Sidebar>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Dashboard Layout with Stats
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
import { Grid, Paper, Typography, Box } from '@wso2/oxygen-ui';
|
|
209
|
+
|
|
210
|
+
function DashboardContent() {
|
|
211
|
+
return (
|
|
212
|
+
<Box sx={{ p: 3 }}>
|
|
213
|
+
<Typography variant="h4" gutterBottom>Dashboard</Typography>
|
|
214
|
+
|
|
215
|
+
<Grid container spacing={3}>
|
|
216
|
+
<Grid item xs={12} sm={6} md={3}>
|
|
217
|
+
<Paper sx={{ p: 3 }}>
|
|
218
|
+
<Typography color="text.secondary" variant="body2">Total Users</Typography>
|
|
219
|
+
<Typography variant="h4" fontWeight="bold">12,345</Typography>
|
|
220
|
+
</Paper>
|
|
221
|
+
</Grid>
|
|
222
|
+
<Grid item xs={12} sm={6} md={3}>
|
|
223
|
+
<Paper sx={{ p: 3 }}>
|
|
224
|
+
<Typography color="text.secondary" variant="body2">Revenue</Typography>
|
|
225
|
+
<Typography variant="h4" fontWeight="bold">$45,678</Typography>
|
|
226
|
+
</Paper>
|
|
227
|
+
</Grid>
|
|
228
|
+
{/* More stats... */}
|
|
229
|
+
</Grid>
|
|
230
|
+
</Box>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
```
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oxygen-migrate
|
|
3
|
+
description: Migrate existing MUI code to Oxygen UI patterns. Use when converting @mui/material imports, replacing MUI components, or updating to Oxygen UI conventions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Migrate to Oxygen UI
|
|
7
|
+
|
|
8
|
+
## Instructions
|
|
9
|
+
|
|
10
|
+
1. Read `.claude/oxygen-ui/migration.md` for full guide
|
|
11
|
+
2. Update imports from `@mui/*` to `@wso2/oxygen-ui`
|
|
12
|
+
3. Replace `lucide-react` icons with `@wso2/oxygen-ui-icons-react`
|
|
13
|
+
4. Add `OxygenUIThemeProvider` wrapper
|
|
14
|
+
|
|
15
|
+
## Migration Checklist
|
|
16
|
+
|
|
17
|
+
- [ ] Replace `@mui/material` imports with `@wso2/oxygen-ui`
|
|
18
|
+
- [ ] Replace `@mui/icons-material` or `lucide-react` with `@wso2/oxygen-ui-icons-react`
|
|
19
|
+
- [ ] Update MUI X imports to use namespaced exports
|
|
20
|
+
- [ ] Wrap root with `OxygenUIThemeProvider`
|
|
21
|
+
- [ ] Replace `ThemeProvider` with `OxygenUIThemeProvider`
|
|
22
|
+
- [ ] Update custom theme to use `OxygenThemeBase`
|
|
23
|
+
|
|
24
|
+
## Import Migration
|
|
25
|
+
|
|
26
|
+
### MUI Components
|
|
27
|
+
|
|
28
|
+
**Before:**
|
|
29
|
+
```tsx
|
|
30
|
+
import { Box, Stack, Button } from '@mui/material';
|
|
31
|
+
import Typography from '@mui/material/Typography';
|
|
32
|
+
import { styled } from '@mui/material/styles';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**After:**
|
|
36
|
+
```tsx
|
|
37
|
+
import { Box, Stack, Button, Typography, styled } from '@wso2/oxygen-ui';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Icons
|
|
41
|
+
|
|
42
|
+
**Before (MUI Icons):**
|
|
43
|
+
```tsx
|
|
44
|
+
import SettingsIcon from '@mui/icons-material/Settings';
|
|
45
|
+
import HomeIcon from '@mui/icons-material/Home';
|
|
46
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Before (Lucide React):**
|
|
50
|
+
```tsx
|
|
51
|
+
import { Settings, Home, Trash2 } from 'lucide-react';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**After:**
|
|
55
|
+
```tsx
|
|
56
|
+
import { SettingsIcon, HomeIcon, TrashIcon } from '@wso2/oxygen-ui-icons-react';
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### MUI X Components
|
|
60
|
+
|
|
61
|
+
**Before:**
|
|
62
|
+
```tsx
|
|
63
|
+
import { DataGrid } from '@mui/x-data-grid';
|
|
64
|
+
import { DatePicker } from '@mui/x-date-pickers';
|
|
65
|
+
import { BarChart } from '@mui/x-charts';
|
|
66
|
+
import { SimpleTreeView } from '@mui/x-tree-view';
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**After:**
|
|
70
|
+
```tsx
|
|
71
|
+
import { DataGrid, DatePickers, Charts, TreeView } from '@wso2/oxygen-ui';
|
|
72
|
+
|
|
73
|
+
// Use as namespaces
|
|
74
|
+
<DataGrid.DataGrid rows={rows} columns={columns} />
|
|
75
|
+
<DatePickers.DatePicker value={date} onChange={setDate} />
|
|
76
|
+
<Charts.BarChart series={series} />
|
|
77
|
+
<TreeView.SimpleTreeView items={items} />
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Theme Provider Migration
|
|
81
|
+
|
|
82
|
+
**Before:**
|
|
83
|
+
```tsx
|
|
84
|
+
import { ThemeProvider, createTheme } from '@mui/material';
|
|
85
|
+
|
|
86
|
+
const theme = createTheme({
|
|
87
|
+
palette: {
|
|
88
|
+
primary: { main: '#1976d2' },
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
<ThemeProvider theme={theme}>
|
|
93
|
+
<App />
|
|
94
|
+
</ThemeProvider>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**After:**
|
|
98
|
+
```tsx
|
|
99
|
+
import { OxygenUIThemeProvider, OxygenTheme } from '@wso2/oxygen-ui';
|
|
100
|
+
|
|
101
|
+
// Use default theme
|
|
102
|
+
<OxygenUIThemeProvider theme={OxygenTheme}>
|
|
103
|
+
<App />
|
|
104
|
+
</OxygenUIThemeProvider>
|
|
105
|
+
|
|
106
|
+
// Or with custom theme
|
|
107
|
+
import { extendTheme } from '@mui/material/styles';
|
|
108
|
+
import { OxygenThemeBase } from '@wso2/oxygen-ui';
|
|
109
|
+
|
|
110
|
+
const customTheme = extendTheme({
|
|
111
|
+
...OxygenThemeBase,
|
|
112
|
+
colorSchemes: {
|
|
113
|
+
light: {
|
|
114
|
+
palette: { primary: { main: '#1976d2' } },
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
<OxygenUIThemeProvider theme={customTheme}>
|
|
120
|
+
<App />
|
|
121
|
+
</OxygenUIThemeProvider>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Layout Migration
|
|
125
|
+
|
|
126
|
+
**Before (Custom Layout):**
|
|
127
|
+
```tsx
|
|
128
|
+
import { AppBar, Toolbar, Drawer, Box } from '@mui/material';
|
|
129
|
+
|
|
130
|
+
<Box sx={{ display: 'flex' }}>
|
|
131
|
+
<AppBar position="fixed">
|
|
132
|
+
<Toolbar>
|
|
133
|
+
<Typography>My App</Typography>
|
|
134
|
+
</Toolbar>
|
|
135
|
+
</AppBar>
|
|
136
|
+
<Drawer variant="permanent">
|
|
137
|
+
{/* Menu items */}
|
|
138
|
+
</Drawer>
|
|
139
|
+
<Box component="main" sx={{ flexGrow: 1, p: 3 }}>
|
|
140
|
+
{/* Content */}
|
|
141
|
+
</Box>
|
|
142
|
+
</Box>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**After (Oxygen AppShell):**
|
|
146
|
+
```tsx
|
|
147
|
+
import { AppShell, Header, Sidebar, Footer } from '@wso2/oxygen-ui';
|
|
148
|
+
|
|
149
|
+
<AppShell>
|
|
150
|
+
<AppShell.Navbar>
|
|
151
|
+
<Header>
|
|
152
|
+
<Header.Brand>
|
|
153
|
+
<Header.BrandTitle>My App</Header.BrandTitle>
|
|
154
|
+
</Header.Brand>
|
|
155
|
+
</Header>
|
|
156
|
+
</AppShell.Navbar>
|
|
157
|
+
|
|
158
|
+
<AppShell.Sidebar>
|
|
159
|
+
<Sidebar>
|
|
160
|
+
<Sidebar.Nav>
|
|
161
|
+
{/* Menu items */}
|
|
162
|
+
</Sidebar.Nav>
|
|
163
|
+
</Sidebar>
|
|
164
|
+
</AppShell.Sidebar>
|
|
165
|
+
|
|
166
|
+
<AppShell.Main>
|
|
167
|
+
{/* Content */}
|
|
168
|
+
</AppShell.Main>
|
|
169
|
+
|
|
170
|
+
<AppShell.Footer>
|
|
171
|
+
<Footer companyName="WSO2 LLC" />
|
|
172
|
+
</AppShell.Footer>
|
|
173
|
+
</AppShell>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Table Migration
|
|
177
|
+
|
|
178
|
+
**Before (MUI Table):**
|
|
179
|
+
```tsx
|
|
180
|
+
import {
|
|
181
|
+
Table,
|
|
182
|
+
TableHead,
|
|
183
|
+
TableBody,
|
|
184
|
+
TableRow,
|
|
185
|
+
TableCell,
|
|
186
|
+
Paper,
|
|
187
|
+
} from '@mui/material';
|
|
188
|
+
|
|
189
|
+
<Paper>
|
|
190
|
+
<Table>
|
|
191
|
+
<TableHead>
|
|
192
|
+
<TableRow>
|
|
193
|
+
<TableCell>Name</TableCell>
|
|
194
|
+
<TableCell>Status</TableCell>
|
|
195
|
+
</TableRow>
|
|
196
|
+
</TableHead>
|
|
197
|
+
<TableBody>
|
|
198
|
+
{data.map((row) => (
|
|
199
|
+
<TableRow key={row.id}>
|
|
200
|
+
<TableCell>{row.name}</TableCell>
|
|
201
|
+
<TableCell>{row.status}</TableCell>
|
|
202
|
+
</TableRow>
|
|
203
|
+
))}
|
|
204
|
+
</TableBody>
|
|
205
|
+
</Table>
|
|
206
|
+
</Paper>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**After (Oxygen ListingTable):**
|
|
210
|
+
```tsx
|
|
211
|
+
import { ListingTable } from '@wso2/oxygen-ui';
|
|
212
|
+
|
|
213
|
+
<ListingTable.Container>
|
|
214
|
+
<ListingTable.Toolbar showSearch />
|
|
215
|
+
<ListingTable>
|
|
216
|
+
<ListingTable.Head>
|
|
217
|
+
<ListingTable.Row>
|
|
218
|
+
<ListingTable.Cell>Name</ListingTable.Cell>
|
|
219
|
+
<ListingTable.Cell>Status</ListingTable.Cell>
|
|
220
|
+
</ListingTable.Row>
|
|
221
|
+
</ListingTable.Head>
|
|
222
|
+
<ListingTable.Body>
|
|
223
|
+
{data.map((row) => (
|
|
224
|
+
<ListingTable.Row key={row.id}>
|
|
225
|
+
<ListingTable.Cell>{row.name}</ListingTable.Cell>
|
|
226
|
+
<ListingTable.Cell>{row.status}</ListingTable.Cell>
|
|
227
|
+
</ListingTable.Row>
|
|
228
|
+
))}
|
|
229
|
+
</ListingTable.Body>
|
|
230
|
+
<ListingTable.Footer />
|
|
231
|
+
</ListingTable>
|
|
232
|
+
</ListingTable.Container>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Color Mode Migration
|
|
236
|
+
|
|
237
|
+
**Before:**
|
|
238
|
+
```tsx
|
|
239
|
+
import { useColorScheme } from '@mui/material';
|
|
240
|
+
|
|
241
|
+
const { mode, setMode } = useColorScheme();
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**After:**
|
|
245
|
+
```tsx
|
|
246
|
+
import { ColorSchemeToggle, useTheme } from '@wso2/oxygen-ui';
|
|
247
|
+
|
|
248
|
+
// Simple toggle component
|
|
249
|
+
<ColorSchemeToggle />
|
|
250
|
+
|
|
251
|
+
// Check current mode
|
|
252
|
+
const theme = useTheme();
|
|
253
|
+
const isDark = theme.palette.mode === 'dark';
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## ESLint Plugin Setup
|
|
257
|
+
|
|
258
|
+
After migration, add the ESLint plugin to prevent regressions:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
pnpm add -D @wso2/eslint-plugin-oxygen-ui
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```js
|
|
265
|
+
// eslint.config.js
|
|
266
|
+
import oxygenUIPlugin from '@wso2/eslint-plugin-oxygen-ui';
|
|
267
|
+
|
|
268
|
+
export default [
|
|
269
|
+
oxygenUIPlugin.configs.recommended,
|
|
270
|
+
// ... other configs
|
|
271
|
+
];
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
This will:
|
|
275
|
+
- Error on direct `@mui/material` imports
|
|
276
|
+
- Error on direct `lucide-react` imports
|
|
277
|
+
- Auto-fix imports with `eslint --fix`
|