@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.
@@ -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
- * const { state, actions } = useAppShell({
69
- * initialCollapsed: false,
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
- * // Use state
73
- * <Sidebar collapsed={state.sidebarCollapsed} />
74
- * <NotificationPanel open={state.notificationPanelOpen} />
105
+ * // Consume mode - in child page component
106
+ * function MyPage() {
107
+ * const { state, actions } = useAppShell(); // No options = consume from context
75
108
  *
76
- * // Use actions
77
- * <Button onClick={actions.toggleSidebar}>Toggle</Button>
109
+ * useEffect(() => {
110
+ * actions.toggleSidebar(); // Control shared sidebar state
111
+ * }, []);
112
+ * }
78
113
  * ```
79
114
  */
80
115
  export declare const useAppShell: (options?: UseAppShellOptions) => UseAppShellReturn;