gov-layout 1.2.5 → 1.2.6
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 +8 -0
- package/dist/index.d.mts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +386 -188
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +386 -188
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,6 +144,7 @@ const menuItems: MenuItem[] = [
|
|
|
144
144
|
currentPath="/services/water"
|
|
145
145
|
onNavigate={(path) => router.push(path)}
|
|
146
146
|
onLogout={() => signOut()}
|
|
147
|
+
onProfile={() => router.push('/profile')}
|
|
147
148
|
collapsible
|
|
148
149
|
/>
|
|
149
150
|
```
|
|
@@ -204,6 +205,7 @@ const menuItems: MenuItem[] = [
|
|
|
204
205
|
| `roleLabel` | `string` | **required** | ป้ายตำแหน่ง เช่น "เจ้าหน้าที่" |
|
|
205
206
|
| `onNavigate` | `(path) => void` | **required** | callback เมื่อคลิกเมนู |
|
|
206
207
|
| `onLogout` | `() => void` | **required** | callback ออกจากระบบ |
|
|
208
|
+
| `onProfile` | `() => void?` | - | callback เมื่อกดโปรไฟล์ผู้ใช้ |
|
|
207
209
|
| `currentPath` | `string?` | - | path ปัจจุบัน (highlight active) |
|
|
208
210
|
| `width` | `string?` | `'280px'` | ความกว้าง sidebar |
|
|
209
211
|
| `collapsible` | `boolean?` | `false` | เปิดโหมดพับ/กาง |
|
|
@@ -245,6 +247,7 @@ import { UserHeader } from 'gov-layout';
|
|
|
245
247
|
onToggleSidebar={() => setOpen(true)}
|
|
246
248
|
onMarkAllRead={() => markAllRead()}
|
|
247
249
|
onViewAll={() => router.push('/notifications')}
|
|
250
|
+
onProfile={() => router.push('/profile')}
|
|
248
251
|
/>
|
|
249
252
|
```
|
|
250
253
|
|
|
@@ -254,6 +257,7 @@ import { UserHeader } from 'gov-layout';
|
|
|
254
257
|
- ✅ ไม่มีแจ้งเตือน → ไม่แสดง badge
|
|
255
258
|
- ✅ Notification dropdown แบบ scroll
|
|
256
259
|
- ✅ ปุ่มเปิด sidebar (☰)
|
|
260
|
+
- ✅ กดโปรไฟล์ผู้ใช้ (avatar + ชื่อ) → `onProfile`
|
|
257
261
|
|
|
258
262
|
---
|
|
259
263
|
|
|
@@ -276,6 +280,7 @@ import { UserSidebar } from 'gov-layout';
|
|
|
276
280
|
]}
|
|
277
281
|
onNavigate={(path) => router.push(path)}
|
|
278
282
|
onLogout={() => signOut()}
|
|
283
|
+
onProfile={() => router.push('/profile')}
|
|
279
284
|
/>
|
|
280
285
|
```
|
|
281
286
|
|
|
@@ -443,6 +448,7 @@ export default function AdminLayout({ children }) {
|
|
|
443
448
|
currentPath={currentPath}
|
|
444
449
|
onNavigate={(path) => setCurrentPath(path)}
|
|
445
450
|
onLogout={() => signOut()}
|
|
451
|
+
onProfile={() => setCurrentPath('/profile')}
|
|
446
452
|
collapsible
|
|
447
453
|
/>
|
|
448
454
|
<main style={{ marginLeft: 280, flex: 1, padding: 32 }}>
|
|
@@ -473,6 +479,7 @@ export default function UserLayout({ children }) {
|
|
|
473
479
|
user={user}
|
|
474
480
|
notifications={notifications}
|
|
475
481
|
onToggleSidebar={() => setOpen(true)}
|
|
482
|
+
onProfile={() => setCurrentPath('/profile')}
|
|
476
483
|
/>
|
|
477
484
|
<UserSidebar
|
|
478
485
|
isOpen={open}
|
|
@@ -482,6 +489,7 @@ export default function UserLayout({ children }) {
|
|
|
482
489
|
menuItems={menuItems}
|
|
483
490
|
onNavigate={(path) => setCurrentPath(path)}
|
|
484
491
|
onLogout={() => signOut()}
|
|
492
|
+
onProfile={() => setCurrentPath('/profile')}
|
|
485
493
|
/>
|
|
486
494
|
<main style={{ padding: 32 }}>
|
|
487
495
|
{currentPath === '/settings' ? (
|
package/dist/index.d.mts
CHANGED
|
@@ -35,6 +35,8 @@ interface StaffSidebarProps {
|
|
|
35
35
|
onNavigate: (path: string) => void;
|
|
36
36
|
/** callback เมื่อกดออกจากระบบ */
|
|
37
37
|
onLogout: () => void;
|
|
38
|
+
/** callback เมื่อกดโปรไฟล์ผู้ใช้ */
|
|
39
|
+
onProfile?: () => void;
|
|
38
40
|
/** path ปัจจุบันเพื่อ highlight active menu */
|
|
39
41
|
currentPath?: string;
|
|
40
42
|
/** ความกว้าง sidebar */
|
|
@@ -51,7 +53,7 @@ interface StaffSidebarProps {
|
|
|
51
53
|
onExpandRequest?: () => void;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
declare function StaffSidebar({ orgLogo, orgName, orgSubtitle, menuItems, bottomMenuItems, user, roleLabel, onNavigate, onLogout, currentPath, width, className, collapsible, isOpen: controlledIsOpen, onToggle, onExpandRequest, }: StaffSidebarProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare function StaffSidebar({ orgLogo, orgName, orgSubtitle, menuItems, bottomMenuItems, user, roleLabel, onNavigate, onLogout, onProfile, currentPath, width, className, collapsible, isOpen: controlledIsOpen, onToggle, onExpandRequest, }: StaffSidebarProps): react_jsx_runtime.JSX.Element;
|
|
55
57
|
|
|
56
58
|
interface SidebarHeaderProps {
|
|
57
59
|
orgLogo?: string;
|
|
@@ -75,8 +77,10 @@ interface SidebarUserProfileProps {
|
|
|
75
77
|
roleLabel: string;
|
|
76
78
|
onLogout: () => void;
|
|
77
79
|
collapsed?: boolean;
|
|
80
|
+
/** Callback เมื่อกดโปรไฟล์ผู้ใช้ */
|
|
81
|
+
onProfile?: () => void;
|
|
78
82
|
}
|
|
79
|
-
declare function SidebarUserProfile({ user, roleLabel, onLogout, collapsed, }: SidebarUserProfileProps): react_jsx_runtime.JSX.Element | null;
|
|
83
|
+
declare function SidebarUserProfile({ user, roleLabel, onLogout, collapsed, onProfile, }: SidebarUserProfileProps): react_jsx_runtime.JSX.Element | null;
|
|
80
84
|
|
|
81
85
|
interface NotificationItem {
|
|
82
86
|
id: string | number;
|
|
@@ -98,9 +102,11 @@ interface UserHeaderProps {
|
|
|
98
102
|
notificationBell?: React.ReactNode;
|
|
99
103
|
onMarkAllRead?: () => void;
|
|
100
104
|
onViewAll?: () => void;
|
|
105
|
+
/** Callback เมื่อกดโปรไฟล์ผู้ใช้ */
|
|
106
|
+
onProfile?: () => void;
|
|
101
107
|
className?: string;
|
|
102
108
|
}
|
|
103
|
-
declare function UserHeader({ user, notifications, onToggleSidebar, notificationBell, onMarkAllRead, onViewAll, className, }: UserHeaderProps): react_jsx_runtime.JSX.Element;
|
|
109
|
+
declare function UserHeader({ user, notifications, onToggleSidebar, notificationBell, onMarkAllRead, onViewAll, onProfile, className, }: UserHeaderProps): react_jsx_runtime.JSX.Element;
|
|
104
110
|
|
|
105
111
|
interface UserSidebarProps {
|
|
106
112
|
user: User | null;
|
|
@@ -111,8 +117,10 @@ interface UserSidebarProps {
|
|
|
111
117
|
isOpen: boolean;
|
|
112
118
|
onClose: () => void;
|
|
113
119
|
roleColor?: string;
|
|
120
|
+
/** Callback เมื่อกดโปรไฟล์ผู้ใช้ */
|
|
121
|
+
onProfile?: () => void;
|
|
114
122
|
}
|
|
115
|
-
declare function UserSidebar({ user, roleLabel, menuItems, onNavigate, onLogout, isOpen, onClose, roleColor, }: UserSidebarProps): react_jsx_runtime.JSX.Element;
|
|
123
|
+
declare function UserSidebar({ user, roleLabel, menuItems, onNavigate, onLogout, isOpen, onClose, roleColor, onProfile, }: UserSidebarProps): react_jsx_runtime.JSX.Element;
|
|
116
124
|
|
|
117
125
|
type Theme = 'light' | 'dark';
|
|
118
126
|
type FontSizeKey = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ interface StaffSidebarProps {
|
|
|
35
35
|
onNavigate: (path: string) => void;
|
|
36
36
|
/** callback เมื่อกดออกจากระบบ */
|
|
37
37
|
onLogout: () => void;
|
|
38
|
+
/** callback เมื่อกดโปรไฟล์ผู้ใช้ */
|
|
39
|
+
onProfile?: () => void;
|
|
38
40
|
/** path ปัจจุบันเพื่อ highlight active menu */
|
|
39
41
|
currentPath?: string;
|
|
40
42
|
/** ความกว้าง sidebar */
|
|
@@ -51,7 +53,7 @@ interface StaffSidebarProps {
|
|
|
51
53
|
onExpandRequest?: () => void;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
declare function StaffSidebar({ orgLogo, orgName, orgSubtitle, menuItems, bottomMenuItems, user, roleLabel, onNavigate, onLogout, currentPath, width, className, collapsible, isOpen: controlledIsOpen, onToggle, onExpandRequest, }: StaffSidebarProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare function StaffSidebar({ orgLogo, orgName, orgSubtitle, menuItems, bottomMenuItems, user, roleLabel, onNavigate, onLogout, onProfile, currentPath, width, className, collapsible, isOpen: controlledIsOpen, onToggle, onExpandRequest, }: StaffSidebarProps): react_jsx_runtime.JSX.Element;
|
|
55
57
|
|
|
56
58
|
interface SidebarHeaderProps {
|
|
57
59
|
orgLogo?: string;
|
|
@@ -75,8 +77,10 @@ interface SidebarUserProfileProps {
|
|
|
75
77
|
roleLabel: string;
|
|
76
78
|
onLogout: () => void;
|
|
77
79
|
collapsed?: boolean;
|
|
80
|
+
/** Callback เมื่อกดโปรไฟล์ผู้ใช้ */
|
|
81
|
+
onProfile?: () => void;
|
|
78
82
|
}
|
|
79
|
-
declare function SidebarUserProfile({ user, roleLabel, onLogout, collapsed, }: SidebarUserProfileProps): react_jsx_runtime.JSX.Element | null;
|
|
83
|
+
declare function SidebarUserProfile({ user, roleLabel, onLogout, collapsed, onProfile, }: SidebarUserProfileProps): react_jsx_runtime.JSX.Element | null;
|
|
80
84
|
|
|
81
85
|
interface NotificationItem {
|
|
82
86
|
id: string | number;
|
|
@@ -98,9 +102,11 @@ interface UserHeaderProps {
|
|
|
98
102
|
notificationBell?: React.ReactNode;
|
|
99
103
|
onMarkAllRead?: () => void;
|
|
100
104
|
onViewAll?: () => void;
|
|
105
|
+
/** Callback เมื่อกดโปรไฟล์ผู้ใช้ */
|
|
106
|
+
onProfile?: () => void;
|
|
101
107
|
className?: string;
|
|
102
108
|
}
|
|
103
|
-
declare function UserHeader({ user, notifications, onToggleSidebar, notificationBell, onMarkAllRead, onViewAll, className, }: UserHeaderProps): react_jsx_runtime.JSX.Element;
|
|
109
|
+
declare function UserHeader({ user, notifications, onToggleSidebar, notificationBell, onMarkAllRead, onViewAll, onProfile, className, }: UserHeaderProps): react_jsx_runtime.JSX.Element;
|
|
104
110
|
|
|
105
111
|
interface UserSidebarProps {
|
|
106
112
|
user: User | null;
|
|
@@ -111,8 +117,10 @@ interface UserSidebarProps {
|
|
|
111
117
|
isOpen: boolean;
|
|
112
118
|
onClose: () => void;
|
|
113
119
|
roleColor?: string;
|
|
120
|
+
/** Callback เมื่อกดโปรไฟล์ผู้ใช้ */
|
|
121
|
+
onProfile?: () => void;
|
|
114
122
|
}
|
|
115
|
-
declare function UserSidebar({ user, roleLabel, menuItems, onNavigate, onLogout, isOpen, onClose, roleColor, }: UserSidebarProps): react_jsx_runtime.JSX.Element;
|
|
123
|
+
declare function UserSidebar({ user, roleLabel, menuItems, onNavigate, onLogout, isOpen, onClose, roleColor, onProfile, }: UserSidebarProps): react_jsx_runtime.JSX.Element;
|
|
116
124
|
|
|
117
125
|
type Theme = 'light' | 'dark';
|
|
118
126
|
type FontSizeKey = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|