@umituz/web-dashboard 2.0.0 → 2.0.1
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/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +502 -0
- package/dist/components/index.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +57 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +756 -0
- package/dist/index.js.map +1 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +184 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +44 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +19 -51
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/domains/layouts/hooks/dashboard.ts
|
|
4
|
+
import { useState, useCallback } from "react";
|
|
5
|
+
function useNotifications(initialNotifications = []) {
|
|
6
|
+
const [notifications, setNotifications] = useState(initialNotifications);
|
|
7
|
+
const markAllRead = useCallback(() => {
|
|
8
|
+
setNotifications(
|
|
9
|
+
(prev) => prev.map((n) => ({ ...n, read: true }))
|
|
10
|
+
);
|
|
11
|
+
}, []);
|
|
12
|
+
const dismiss = useCallback((id) => {
|
|
13
|
+
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
14
|
+
}, []);
|
|
15
|
+
const add = useCallback((notification) => {
|
|
16
|
+
const newNotification = {
|
|
17
|
+
...notification,
|
|
18
|
+
id: crypto.randomUUID(),
|
|
19
|
+
read: false,
|
|
20
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
21
|
+
};
|
|
22
|
+
setNotifications((prev) => [newNotification, ...prev]);
|
|
23
|
+
}, []);
|
|
24
|
+
return {
|
|
25
|
+
notifications,
|
|
26
|
+
markAllRead,
|
|
27
|
+
dismiss,
|
|
28
|
+
add
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function useSidebar(initialCollapsed = false) {
|
|
32
|
+
const [collapsed, setCollapsed] = useState(initialCollapsed);
|
|
33
|
+
const [mobileOpen, setMobileOpen] = useState(false);
|
|
34
|
+
const toggle = useCallback(() => {
|
|
35
|
+
setCollapsed((prev) => !prev);
|
|
36
|
+
}, []);
|
|
37
|
+
const openMobile = useCallback(() => {
|
|
38
|
+
setMobileOpen(true);
|
|
39
|
+
}, []);
|
|
40
|
+
const closeMobile = useCallback(() => {
|
|
41
|
+
setMobileOpen(false);
|
|
42
|
+
}, []);
|
|
43
|
+
return {
|
|
44
|
+
collapsed,
|
|
45
|
+
setCollapsed,
|
|
46
|
+
toggle,
|
|
47
|
+
mobileOpen,
|
|
48
|
+
setMobileOpen,
|
|
49
|
+
openMobile,
|
|
50
|
+
closeMobile
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
useNotifications,
|
|
55
|
+
useSidebar
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/domains/layouts/hooks/dashboard.ts"],"sourcesContent":["/**\n * Dashboard Hooks\n *\n * Custom React hooks for dashboard functionality\n */\n\nimport { useState, useCallback } from \"react\";\nimport type { DashboardNotification } from \"../types/notification\";\n\n/**\n * Use Notifications Hook\n *\n * Manages notification state and actions\n *\n * @param initialNotifications - Initial notification list\n * @returns Notification state and actions\n */\nexport function useNotifications(initialNotifications: DashboardNotification[] = []) {\n const [notifications, setNotifications] = useState<DashboardNotification[]>(initialNotifications);\n\n const markAllRead = useCallback(() => {\n setNotifications((prev) =>\n prev.map((n) => ({ ...n, read: true }))\n );\n }, []);\n\n const dismiss = useCallback((id: string) => {\n setNotifications((prev) => prev.filter((n) => n.id !== id));\n }, []);\n\n const add = useCallback((notification: Omit<DashboardNotification, \"id\">) => {\n const newNotification: DashboardNotification = {\n ...notification,\n id: crypto.randomUUID(),\n read: false,\n createdAt: new Date(),\n };\n setNotifications((prev) => [newNotification, ...prev]);\n }, []);\n\n return {\n notifications,\n markAllRead,\n dismiss,\n add,\n };\n}\n\n/**\n * Use Sidebar Hook\n *\n * Manages sidebar state\n *\n * @returns Sidebar state and actions\n */\nexport function useSidebar(initialCollapsed = false) {\n const [collapsed, setCollapsed] = useState(initialCollapsed);\n const [mobileOpen, setMobileOpen] = useState(false);\n\n const toggle = useCallback(() => {\n setCollapsed((prev) => !prev);\n }, []);\n\n const openMobile = useCallback(() => {\n setMobileOpen(true);\n }, []);\n\n const closeMobile = useCallback(() => {\n setMobileOpen(false);\n }, []);\n\n return {\n collapsed,\n setCollapsed,\n toggle,\n mobileOpen,\n setMobileOpen: setMobileOpen,\n openMobile,\n closeMobile,\n };\n}\n"],"mappings":";;;AAMA,SAAS,UAAU,mBAAmB;AAW/B,SAAS,iBAAiB,uBAAgD,CAAC,GAAG;AACnF,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAkC,oBAAoB;AAEhG,QAAM,cAAc,YAAY,MAAM;AACpC;AAAA,MAAiB,CAAC,SAChB,KAAK,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,MAAM,KAAK,EAAE;AAAA,IACxC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,UAAU,YAAY,CAAC,OAAe;AAC1C,qBAAiB,CAAC,SAAS,KAAK,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;AAAA,EAC5D,GAAG,CAAC,CAAC;AAEL,QAAM,MAAM,YAAY,CAAC,iBAAoD;AAC3E,UAAM,kBAAyC;AAAA,MAC7C,GAAG;AAAA,MACH,IAAI,OAAO,WAAW;AAAA,MACtB,MAAM;AAAA,MACN,WAAW,oBAAI,KAAK;AAAA,IACtB;AACA,qBAAiB,CAAC,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC;AAAA,EACvD,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AASO,SAAS,WAAW,mBAAmB,OAAO;AACnD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,gBAAgB;AAC3D,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,QAAM,SAAS,YAAY,MAAM;AAC/B,iBAAa,CAAC,SAAS,CAAC,IAAI;AAAA,EAC9B,GAAG,CAAC,CAAC;AAEL,QAAM,aAAa,YAAY,MAAM;AACnC,kBAAc,IAAI;AAAA,EACpB,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc,YAAY,MAAM;AACpC,kBAAc,KAAK;AAAA,EACrB,GAAG,CAAC,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { DashboardLayout } from './components/DashboardLayout.js';
|
|
2
|
+
export { DashboardHeader } from './components/DashboardHeader.js';
|
|
3
|
+
export { DashboardSidebar } from './components/DashboardSidebar.js';
|
|
4
|
+
export { BrandLogo } from './components/BrandLogo.js';
|
|
5
|
+
export { useNotifications, useSidebar } from './hooks/dashboard.js';
|
|
6
|
+
export { filterSidebarItems, formatNotificationTime, generateNotificationId, getPageTitle, isPathActive } from './utils/dashboard.js';
|
|
7
|
+
export { SidebarGroup, SidebarItem } from './types/sidebar.js';
|
|
8
|
+
export { DashboardHeaderProps, DashboardLayoutConfig, DashboardSidebarProps } from './types/layout.js';
|
|
9
|
+
export { DashboardTheme, DashboardThemePreset } from './types/theme.js';
|
|
10
|
+
export { DashboardNotification } from './types/notification.js';
|
|
11
|
+
export { DashboardUser, UserNavMenuItem } from './types/user.js';
|
|
12
|
+
export { DEFAULT_DASHBOARD_THEME, DEFAULT_DASHBOARD_THEME_DARK } from './theme/default.js';
|
|
13
|
+
export { DASHBOARD_THEME_PRESETS } from './theme/presets.js';
|
|
14
|
+
export { applyDashboardTheme, getDashboardThemePreset, mergeDashboardTheme } from './theme/utils.js';
|
|
15
|
+
import 'react/jsx-runtime';
|
|
16
|
+
import 'react';
|
|
17
|
+
import 'lucide-react';
|