@wso2/oxygen-ui 0.0.1-alpha.9 → 0.2.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 +5189 -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,318 @@
|
|
|
1
|
+
# Oxygen UI Theming Guide
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
- [Available Themes](#available-themes)
|
|
5
|
+
- [Theme Provider](#theme-provider)
|
|
6
|
+
- [Theme Properties](#theme-properties)
|
|
7
|
+
- [Dark Mode](#dark-mode)
|
|
8
|
+
- [CSS Variables](#css-variables)
|
|
9
|
+
- [Custom Themes](#custom-themes)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Available Themes
|
|
14
|
+
|
|
15
|
+
| Theme | Import | Description |
|
|
16
|
+
|-------|--------|-------------|
|
|
17
|
+
| OxygenTheme | `OxygenTheme` | Default theme (Acrylic Base) |
|
|
18
|
+
| Acrylic Orange | `AcrylicOrangeTheme` | Glass-morphism effects, orange primary |
|
|
19
|
+
| Acrylic Purple | `AcrylicPurpleTheme` | Glass-morphism with purple accents |
|
|
20
|
+
| Classic | `ClassicTheme` | Standard flat design |
|
|
21
|
+
| High Contrast | `HighContrastTheme` | Accessibility-focused with high contrast colors |
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import {
|
|
25
|
+
OxygenTheme,
|
|
26
|
+
AcrylicOrangeTheme,
|
|
27
|
+
AcrylicPurpleTheme,
|
|
28
|
+
ClassicTheme,
|
|
29
|
+
HighContrastTheme
|
|
30
|
+
} from '@wso2/oxygen-ui';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Theme Provider
|
|
36
|
+
|
|
37
|
+
### Single Theme (Default)
|
|
38
|
+
```tsx
|
|
39
|
+
import { OxygenUIThemeProvider } from '@wso2/oxygen-ui';
|
|
40
|
+
|
|
41
|
+
<OxygenUIThemeProvider>
|
|
42
|
+
<App />
|
|
43
|
+
</OxygenUIThemeProvider>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Single Custom Theme
|
|
47
|
+
```tsx
|
|
48
|
+
import { OxygenUIThemeProvider, ClassicTheme } from '@wso2/oxygen-ui';
|
|
49
|
+
|
|
50
|
+
<OxygenUIThemeProvider theme={ClassicTheme}>
|
|
51
|
+
<App />
|
|
52
|
+
</OxygenUIThemeProvider>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Multiple Themes with Switching
|
|
56
|
+
```tsx
|
|
57
|
+
import {
|
|
58
|
+
OxygenUIThemeProvider,
|
|
59
|
+
OxygenTheme,
|
|
60
|
+
AcrylicOrangeTheme,
|
|
61
|
+
AcrylicPurpleTheme,
|
|
62
|
+
ClassicTheme,
|
|
63
|
+
HighContrastTheme
|
|
64
|
+
} from '@wso2/oxygen-ui';
|
|
65
|
+
|
|
66
|
+
<OxygenUIThemeProvider
|
|
67
|
+
themes={[
|
|
68
|
+
{ key: 'default', label: 'Default', theme: OxygenTheme },
|
|
69
|
+
{ key: 'orange', label: 'Acrylic Orange', theme: AcrylicOrangeTheme },
|
|
70
|
+
{ key: 'purple', label: 'Acrylic Purple', theme: AcrylicPurpleTheme },
|
|
71
|
+
{ key: 'classic', label: 'Classic', theme: ClassicTheme },
|
|
72
|
+
{ key: 'highContrast', label: 'High Contrast', theme: HighContrastTheme },
|
|
73
|
+
]}
|
|
74
|
+
initialTheme="default"
|
|
75
|
+
>
|
|
76
|
+
<App />
|
|
77
|
+
</OxygenUIThemeProvider>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Provider Props
|
|
81
|
+
| Prop | Type | Description |
|
|
82
|
+
|------|------|-------------|
|
|
83
|
+
| `theme` | `Theme` | Single theme object |
|
|
84
|
+
| `themes` | `ThemeOption[]` | Array of theme options for switching |
|
|
85
|
+
| `initialTheme` | `string` | Initial theme key (when using `themes`) |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Theme Properties
|
|
90
|
+
|
|
91
|
+
### Color Palette
|
|
92
|
+
```tsx
|
|
93
|
+
// Primary colors (orange gradient)
|
|
94
|
+
theme.palette.primary.main // #fa7b3f
|
|
95
|
+
theme.palette.primary.light
|
|
96
|
+
theme.palette.primary.dark
|
|
97
|
+
|
|
98
|
+
// Secondary, error, warning, info, success
|
|
99
|
+
theme.palette.secondary.main
|
|
100
|
+
theme.palette.error.main
|
|
101
|
+
theme.palette.warning.main
|
|
102
|
+
theme.palette.info.main
|
|
103
|
+
theme.palette.success.main
|
|
104
|
+
|
|
105
|
+
// Background
|
|
106
|
+
theme.palette.background.default
|
|
107
|
+
theme.palette.background.paper
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Typography
|
|
111
|
+
Font: **Inter Variable** (auto-bundled, no setup required)
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
theme.typography.fontFamily // 'Inter Variable', sans-serif
|
|
115
|
+
theme.typography.fontSize // 14 (base)
|
|
116
|
+
|
|
117
|
+
// Heading variants
|
|
118
|
+
theme.typography.h1 // 36px, bold
|
|
119
|
+
theme.typography.h2 // 30px
|
|
120
|
+
theme.typography.h3 // 24px
|
|
121
|
+
theme.typography.h4 // 20px
|
|
122
|
+
theme.typography.h5 // 16px
|
|
123
|
+
theme.typography.h6 // 14px
|
|
124
|
+
|
|
125
|
+
// Body variants
|
|
126
|
+
theme.typography.body1 // 14px
|
|
127
|
+
theme.typography.body2 // 12px
|
|
128
|
+
theme.typography.caption // 12px
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Custom Oxygen Properties
|
|
132
|
+
```tsx
|
|
133
|
+
// Glass-morphism blur effects
|
|
134
|
+
theme.oxygen.blur.light // 4px
|
|
135
|
+
theme.oxygen.blur.medium // 8px
|
|
136
|
+
theme.oxygen.blur.heavy // 16px
|
|
137
|
+
|
|
138
|
+
// Border settings
|
|
139
|
+
theme.oxygen.border.width // '1px'
|
|
140
|
+
theme.oxygen.border.style // 'solid'
|
|
141
|
+
|
|
142
|
+
// Gradient
|
|
143
|
+
theme.oxygen.gradient.primary // linear-gradient(135deg, #e74420 0%, #fa7b3f 100%)
|
|
144
|
+
|
|
145
|
+
// Transparent paper (for glass effects)
|
|
146
|
+
theme.oxygen.paperTransparent.light // rgba(255,255,255,0.7)
|
|
147
|
+
theme.oxygen.paperTransparent.dark // rgba(0,0,0,0.5)
|
|
148
|
+
|
|
149
|
+
// Syntax highlighting colors
|
|
150
|
+
theme.oxygen.syntax.light.keyword
|
|
151
|
+
theme.oxygen.syntax.dark.keyword
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Dark Mode
|
|
157
|
+
|
|
158
|
+
### Color Scheme Toggle
|
|
159
|
+
```tsx
|
|
160
|
+
import { ColorSchemeToggle } from '@wso2/oxygen-ui';
|
|
161
|
+
|
|
162
|
+
// Cycles through: light → dark → system
|
|
163
|
+
<ColorSchemeToggle />
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Adaptive Images
|
|
167
|
+
```tsx
|
|
168
|
+
import { ColorSchemeImage } from '@wso2/oxygen-ui';
|
|
169
|
+
|
|
170
|
+
<ColorSchemeImage
|
|
171
|
+
light="/images/logo.svg"
|
|
172
|
+
dark="/images/logo-dark.svg"
|
|
173
|
+
alt="Company Logo"
|
|
174
|
+
/>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Programmatic Mode Access
|
|
178
|
+
```tsx
|
|
179
|
+
import { useTheme } from '@wso2/oxygen-ui';
|
|
180
|
+
|
|
181
|
+
const theme = useTheme();
|
|
182
|
+
const isDark = theme.palette.mode === 'dark';
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### useThemeContent Hook
|
|
186
|
+
```tsx
|
|
187
|
+
import { useThemeContent } from '@wso2/oxygen-ui';
|
|
188
|
+
|
|
189
|
+
const content = useThemeContent({
|
|
190
|
+
light: 'Show this in light mode',
|
|
191
|
+
dark: 'Show this in dark mode'
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## CSS Variables
|
|
198
|
+
|
|
199
|
+
Oxygen UI uses CSS variables with the `--oxygen` prefix.
|
|
200
|
+
|
|
201
|
+
### Key Variables
|
|
202
|
+
```css
|
|
203
|
+
/* Colors */
|
|
204
|
+
--oxygen-palette-primary-main
|
|
205
|
+
--oxygen-palette-background-default
|
|
206
|
+
--oxygen-palette-background-paper
|
|
207
|
+
--oxygen-palette-text-primary
|
|
208
|
+
|
|
209
|
+
/* Typography */
|
|
210
|
+
--oxygen-typography-fontFamily
|
|
211
|
+
--oxygen-typography-fontSize
|
|
212
|
+
|
|
213
|
+
/* Shadows (disabled by default) */
|
|
214
|
+
--oxygen-shadows-0
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Accessing in Styles
|
|
218
|
+
```tsx
|
|
219
|
+
<Box
|
|
220
|
+
sx={{
|
|
221
|
+
backgroundColor: 'var(--oxygen-palette-background-paper)',
|
|
222
|
+
color: 'var(--oxygen-palette-text-primary)',
|
|
223
|
+
}}
|
|
224
|
+
/>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Color Scheme Selector
|
|
228
|
+
The theme uses `data-color-scheme` attribute for mode switching:
|
|
229
|
+
|
|
230
|
+
```css
|
|
231
|
+
[data-color-scheme="light"] {
|
|
232
|
+
--oxygen-palette-background-default: #ffffff;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
[data-color-scheme="dark"] {
|
|
236
|
+
--oxygen-palette-background-default: #121212;
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Custom Themes
|
|
243
|
+
|
|
244
|
+
### Extending Base Theme
|
|
245
|
+
```tsx
|
|
246
|
+
import { extendTheme } from '@mui/material/styles';
|
|
247
|
+
import { OxygenThemeBase } from '@wso2/oxygen-ui';
|
|
248
|
+
|
|
249
|
+
const customTheme = extendTheme({
|
|
250
|
+
...OxygenThemeBase,
|
|
251
|
+
colorSchemes: {
|
|
252
|
+
light: {
|
|
253
|
+
palette: {
|
|
254
|
+
primary: {
|
|
255
|
+
main: '#1976d2', // Custom blue
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
dark: {
|
|
260
|
+
palette: {
|
|
261
|
+
primary: {
|
|
262
|
+
main: '#90caf9',
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
<OxygenUIThemeProvider theme={customTheme}>
|
|
270
|
+
<App />
|
|
271
|
+
</OxygenUIThemeProvider>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Component Overrides
|
|
275
|
+
```tsx
|
|
276
|
+
const customTheme = extendTheme({
|
|
277
|
+
...OxygenThemeBase,
|
|
278
|
+
components: {
|
|
279
|
+
MuiButton: {
|
|
280
|
+
styleOverrides: {
|
|
281
|
+
root: {
|
|
282
|
+
borderRadius: 8,
|
|
283
|
+
textTransform: 'none',
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
MuiCard: {
|
|
288
|
+
styleOverrides: {
|
|
289
|
+
root: {
|
|
290
|
+
backdropFilter: 'blur(8px)',
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Theme Switching in Components
|
|
299
|
+
```tsx
|
|
300
|
+
import { useThemeSwitcher } from '@wso2/oxygen-ui';
|
|
301
|
+
|
|
302
|
+
function ThemeSelector() {
|
|
303
|
+
const { currentTheme, setTheme, themes } = useThemeSwitcher();
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
<Select value={currentTheme} onChange={(e) => setTheme(e.target.value)}>
|
|
307
|
+
{themes.map((t) => (
|
|
308
|
+
<MenuItem key={t.key} value={t.key}>
|
|
309
|
+
{t.label}
|
|
310
|
+
</MenuItem>
|
|
311
|
+
))}
|
|
312
|
+
</Select>
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### LocalStorage Persistence
|
|
318
|
+
Theme selection is automatically persisted to localStorage with the key `oxygen-theme`. The provider reads the saved theme on mount and applies it.
|
package/README.md
CHANGED
|
@@ -181,15 +181,147 @@ function MyTreeView() {
|
|
|
181
181
|
}
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
+
## Theme Switching
|
|
185
|
+
|
|
186
|
+
Oxygen UI provides built-in theme switching capabilities through `OxygenUIThemeProvider` and UI components for easy theme selection.
|
|
187
|
+
|
|
188
|
+
### Basic Setup
|
|
189
|
+
|
|
190
|
+
Pass a `themes` array to `OxygenUIThemeProvider`:
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import {
|
|
194
|
+
OxygenUIThemeProvider,
|
|
195
|
+
OxygenTheme,
|
|
196
|
+
OxygenThemeWithRadialBackground
|
|
197
|
+
} from '@wso2/oxygen-ui';
|
|
198
|
+
|
|
199
|
+
function App() {
|
|
200
|
+
return (
|
|
201
|
+
<OxygenUIThemeProvider
|
|
202
|
+
themes={[
|
|
203
|
+
{ key: 'default', label: 'Default', theme: OxygenTheme },
|
|
204
|
+
{ key: 'radial', label: 'Radial Background', theme: OxygenThemeWithRadialBackground },
|
|
205
|
+
]}
|
|
206
|
+
initialTheme="default"
|
|
207
|
+
>
|
|
208
|
+
<YourApp />
|
|
209
|
+
</OxygenUIThemeProvider>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Using ThemeSwitcher Component
|
|
215
|
+
|
|
216
|
+
Add the `ThemeSwitcher` component to provide a select dropdown:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
import {
|
|
220
|
+
OxygenUIThemeProvider,
|
|
221
|
+
ThemeSwitcher,
|
|
222
|
+
OxygenTheme,
|
|
223
|
+
OxygenThemeWithRadialBackground
|
|
224
|
+
} from '@wso2/oxygen-ui';
|
|
225
|
+
|
|
226
|
+
function App() {
|
|
227
|
+
return (
|
|
228
|
+
<OxygenUIThemeProvider
|
|
229
|
+
themes={[
|
|
230
|
+
{ key: 'default', label: 'Default', theme: OxygenTheme },
|
|
231
|
+
{ key: 'radial', label: 'Radial Background', theme: OxygenThemeWithRadialBackground },
|
|
232
|
+
]}
|
|
233
|
+
>
|
|
234
|
+
<header>
|
|
235
|
+
<ThemeSwitcher /> {/* Default select dropdown */}
|
|
236
|
+
</header>
|
|
237
|
+
<YourApp />
|
|
238
|
+
</OxygenUIThemeProvider>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Custom Theme Switcher UI
|
|
244
|
+
|
|
245
|
+
Use render props for custom UI:
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
<ThemeSwitcher>
|
|
249
|
+
{({ currentTheme, themes, setTheme, isActive }) => (
|
|
250
|
+
<ButtonGroup>
|
|
251
|
+
{themes.map(theme => (
|
|
252
|
+
<Button
|
|
253
|
+
key={theme.key}
|
|
254
|
+
variant={isActive(theme.key) ? 'contained' : 'outlined'}
|
|
255
|
+
onClick={() => setTheme(theme.key)}
|
|
256
|
+
>
|
|
257
|
+
{theme.label}
|
|
258
|
+
</Button>
|
|
259
|
+
))}
|
|
260
|
+
</ButtonGroup>
|
|
261
|
+
)}
|
|
262
|
+
</ThemeSwitcher>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Custom Themes
|
|
266
|
+
|
|
267
|
+
Add your own custom themes:
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
import { extendTheme } from '@mui/material/styles';
|
|
271
|
+
|
|
272
|
+
const customTheme = extendTheme({
|
|
273
|
+
palette: {
|
|
274
|
+
primary: { main: '#ff0000' },
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
function App() {
|
|
279
|
+
return (
|
|
280
|
+
<OxygenUIThemeProvider
|
|
281
|
+
themes={[
|
|
282
|
+
{ key: 'default', label: 'Default', theme: OxygenTheme },
|
|
283
|
+
{ key: 'custom', label: 'Custom Theme', theme: customTheme },
|
|
284
|
+
]}
|
|
285
|
+
>
|
|
286
|
+
<ThemeSwitcher showLabel label="Select Theme" />
|
|
287
|
+
<YourApp />
|
|
288
|
+
</OxygenUIThemeProvider>
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### Programmatic Access
|
|
294
|
+
|
|
295
|
+
Use the `useThemeSwitcher` hook to access theme state:
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
import { useThemeSwitcher } from '@wso2/oxygen-ui';
|
|
299
|
+
|
|
300
|
+
function MyComponent() {
|
|
301
|
+
const { currentTheme, themes, setTheme, isActive } = useThemeSwitcher();
|
|
302
|
+
|
|
303
|
+
return (
|
|
304
|
+
<div>
|
|
305
|
+
<p>Current theme: {currentTheme}</p>
|
|
306
|
+
<button onClick={() => setTheme('radial')}>Switch to Radial</button>
|
|
307
|
+
</div>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
184
312
|
## Available Exports
|
|
185
313
|
|
|
186
314
|
### Custom Oxygen UI Components
|
|
187
315
|
|
|
188
|
-
- `OxygenTheme` -
|
|
189
|
-
- `
|
|
316
|
+
- `OxygenTheme` - Default theme configuration
|
|
317
|
+
- `OxygenThemeWithRadialBackground` - Theme variant with radial gradient backgrounds
|
|
318
|
+
- `OxygenUIThemeProvider` - Theme provider component with theme switching support
|
|
319
|
+
- `ThemeSwitcher` - Theme selection component (default select dropdown or render props)
|
|
320
|
+
- `ThemeSelect` - Standalone theme select dropdown component
|
|
190
321
|
- `ColorSchemeImage` - Image component that adapts to color scheme
|
|
191
322
|
- `ColorSchemeToggle` - Toggle for light/dark mode
|
|
192
323
|
- `Layout` - Layout components
|
|
324
|
+
- `useThemeSwitcher` - Hook to access theme switcher context
|
|
193
325
|
|
|
194
326
|
### Material-UI Components
|
|
195
327
|
|
|
@@ -214,6 +346,54 @@ const { GridColDef } = DataGrid;
|
|
|
214
346
|
type MyGridColDef = typeof GridColDef;
|
|
215
347
|
```
|
|
216
348
|
|
|
349
|
+
## AI-Assisted Development
|
|
350
|
+
|
|
351
|
+
Oxygen UI includes built-in documentation for AI assistants.
|
|
352
|
+
|
|
353
|
+
### Universal Setup (Works with any AI)
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
npx @wso2/oxygen-ui init
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Creates:
|
|
360
|
+
- `AGENTS.md` - Streamlined AI guide at project root
|
|
361
|
+
- `.ai/oxygen-ui/` - Detailed documentation:
|
|
362
|
+
- `components.md` - Component API reference
|
|
363
|
+
- `patterns.md` - Common UI patterns
|
|
364
|
+
- `theming.md` - Theme customization
|
|
365
|
+
- `migration.md` - Migration guide
|
|
366
|
+
|
|
367
|
+
### Claude Code Setup (Recommended for Claude)
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
npx @wso2/oxygen-ui init --claude
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Creates:
|
|
374
|
+
- `.claude/oxygen-ui/` - Claude-optimized documentation
|
|
375
|
+
- `.claude/skills/` - Invokable skills:
|
|
376
|
+
- `/oxygen-component` - Generate Oxygen UI components
|
|
377
|
+
- `/oxygen-layout` - Generate app layouts
|
|
378
|
+
- `/oxygen-form` - Generate forms with validation
|
|
379
|
+
- `/oxygen-migrate` - Migrate MUI code
|
|
380
|
+
- Updates root `CLAUDE.md` with reference
|
|
381
|
+
|
|
382
|
+
### Updating After Upgrade
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
npx @wso2/oxygen-ui update # Universal
|
|
386
|
+
npx @wso2/oxygen-ui update --claude # Claude-specific
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### AI Documentation
|
|
390
|
+
|
|
391
|
+
For detailed information, see the generated files:
|
|
392
|
+
- Components: `.ai/oxygen-ui/components.md` or `.claude/oxygen-ui/components.md`
|
|
393
|
+
- Patterns: `.ai/oxygen-ui/patterns.md` or `.claude/oxygen-ui/patterns.md`
|
|
394
|
+
- Theming: `.ai/oxygen-ui/theming.md` or `.claude/oxygen-ui/theming.md`
|
|
395
|
+
- Migration: `.ai/oxygen-ui/migration.md` or `.claude/oxygen-ui/migration.md`
|
|
396
|
+
|
|
217
397
|
## License
|
|
218
398
|
|
|
219
399
|
Apache-2.0 © WSO2 LLC
|