@wso2/oxygen-ui 0.5.0 → 0.7.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 +17 -15
- package/.ai/components.md +706 -73
- package/.ai/migration.md +4 -2
- package/.ai/patterns.md +20 -8
- package/.ai/theming.md +15 -2
- package/.claude/components.md +706 -73
- package/.claude/migration.md +4 -2
- package/.claude/patterns.md +20 -8
- package/.claude/skills/oxygen-component/SKILL.md +12 -6
- package/.claude/skills/oxygen-migrate/SKILL.md +5 -2
- package/.claude/skills/oxygen-sync/SKILL.md +157 -0
- package/.claude/theming.md +15 -2
- package/bin/cli.js +32 -19
- package/dist/components/AppShell/AppShell.d.ts +8 -6
- package/dist/components/AppShell/context.d.ts +64 -0
- package/dist/components/AppShell/index.d.ts +1 -0
- package/dist/components/Header/HeaderToggle.d.ts +4 -4
- package/dist/components/NotificationPanel/NotificationPanel.d.ts +4 -4
- package/dist/components/Sidebar/SidebarItem.d.ts +10 -0
- package/dist/hooks/useAppShell/useAppShell.d.ts +43 -8
- package/dist/index.js +544 -409
- package/dist/index.js.map +4 -4
- package/dist/utils/pxToRem.d.ts +1 -1
- package/package.json +2 -2
|
@@ -27,12 +27,19 @@ export interface AppShellState {
|
|
|
27
27
|
activeMenuItem: string;
|
|
28
28
|
/** Map of expanded menu IDs */
|
|
29
29
|
expandedMenus: Record<string, boolean>;
|
|
30
|
+
/** Expanded sidebar width in pixels */
|
|
31
|
+
sidebarWidth: number;
|
|
32
|
+
/** Collapsed sidebar width in pixels */
|
|
33
|
+
sidebarCollapsedWidth: number;
|
|
30
34
|
}
|
|
31
35
|
/**
|
|
32
36
|
* App Shell actions interface.
|
|
33
37
|
*/
|
|
34
38
|
export interface AppShellActions {
|
|
35
39
|
toggleSidebar: () => void;
|
|
40
|
+
setSidebarCollapsed: (collapsed: boolean) => void;
|
|
41
|
+
collapseSidebar: () => void;
|
|
42
|
+
expandSidebar: () => void;
|
|
36
43
|
toggleNotificationPanel: () => void;
|
|
37
44
|
setActiveMenuItem: (id: string) => void;
|
|
38
45
|
toggleMenu: (id: string) => void;
|
|
@@ -45,6 +52,14 @@ export interface UseAppShellOptions {
|
|
|
45
52
|
initialCollapsed?: boolean;
|
|
46
53
|
/** Initial active menu item */
|
|
47
54
|
initialActiveItem?: string;
|
|
55
|
+
/** Auto-collapse sidebar on menu item selection in mobile view (default: true) */
|
|
56
|
+
collapseOnSelectOnMobile?: boolean;
|
|
57
|
+
/** Auto-collapse sidebar on page load when in mobile view (default: false) */
|
|
58
|
+
collapseOnMobile?: boolean;
|
|
59
|
+
/** Expanded sidebar width in pixels (default: 250) */
|
|
60
|
+
sidebarWidth?: number;
|
|
61
|
+
/** Collapsed sidebar width in pixels (default: 64) */
|
|
62
|
+
sidebarCollapsedWidth?: number;
|
|
48
63
|
}
|
|
49
64
|
/**
|
|
50
65
|
* Return type for useAppShell hook.
|
|
@@ -61,20 +76,40 @@ export interface UseAppShellReturn {
|
|
|
61
76
|
* - Notification panel visibility
|
|
62
77
|
* - Active menu item and expanded menus
|
|
63
78
|
*
|
|
79
|
+
* Can be used in two modes:
|
|
80
|
+
* 1. **Create mode** (with options): Creates a new shell state instance
|
|
81
|
+
* 2. **Consume mode** (without options): Consumes shared state from AppShellProvider
|
|
82
|
+
*
|
|
64
83
|
* For notification data management, use the `useNotifications` hook separately.
|
|
65
84
|
*
|
|
66
85
|
* @example
|
|
67
86
|
* ```tsx
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
87
|
+
* // Create mode - in layout component
|
|
88
|
+
* function AppLayout() {
|
|
89
|
+
* const shell = useAppShell({
|
|
90
|
+
* initialCollapsed: false,
|
|
91
|
+
* collapseOnSelectOnMobile: true,
|
|
92
|
+
* sidebarWidth: 280,
|
|
93
|
+
* });
|
|
94
|
+
*
|
|
95
|
+
* return (
|
|
96
|
+
* <AppShellProvider value={shell}>
|
|
97
|
+
* <AppShell>
|
|
98
|
+
* <Sidebar collapsed={shell.state.sidebarCollapsed} />
|
|
99
|
+
* <Outlet />
|
|
100
|
+
* </AppShell>
|
|
101
|
+
* </AppShellProvider>
|
|
102
|
+
* );
|
|
103
|
+
* }
|
|
71
104
|
*
|
|
72
|
-
* //
|
|
73
|
-
*
|
|
74
|
-
*
|
|
105
|
+
* // Consume mode - in child page component
|
|
106
|
+
* function MyPage() {
|
|
107
|
+
* const { state, actions } = useAppShell(); // No options = consume from context
|
|
75
108
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
109
|
+
* useEffect(() => {
|
|
110
|
+
* actions.toggleSidebar(); // Control shared sidebar state
|
|
111
|
+
* }, []);
|
|
112
|
+
* }
|
|
78
113
|
* ```
|
|
79
114
|
*/
|
|
80
115
|
export declare const useAppShell: (options?: UseAppShellOptions) => UseAppShellReturn;
|