@umituz/web-dashboard 2.0.7 → 2.0.8

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.
Files changed (171) hide show
  1. package/package.json +35 -77
  2. package/src/domains/layouts/components/BrandLogo.tsx +83 -0
  3. package/src/domains/layouts/components/DashboardHeader.tsx +240 -0
  4. package/src/domains/layouts/components/DashboardLayout.tsx +155 -0
  5. package/src/domains/layouts/components/DashboardSidebar.tsx +152 -0
  6. package/src/domains/layouts/components/index.ts +8 -0
  7. package/src/domains/layouts/hooks/dashboard.ts +81 -0
  8. package/src/domains/layouts/hooks/index.ts +8 -0
  9. package/src/domains/layouts/index.ts +11 -0
  10. package/{dist/layouts/theme/default.js → src/domains/layouts/theme/default.ts} +18 -11
  11. package/src/domains/layouts/theme/index.ts +18 -0
  12. package/src/domains/layouts/theme/presets.ts +96 -0
  13. package/src/domains/layouts/theme/utils.ts +67 -0
  14. package/src/domains/layouts/types/index.ts +9 -0
  15. package/src/domains/layouts/types/layout.ts +43 -0
  16. package/src/domains/layouts/types/notification.ts +19 -0
  17. package/src/domains/layouts/types/sidebar.ts +35 -0
  18. package/src/domains/layouts/types/theme.ts +64 -0
  19. package/src/domains/layouts/types/user.ts +35 -0
  20. package/src/domains/layouts/utils/dashboard.ts +96 -0
  21. package/src/domains/layouts/utils/index.ts +11 -0
  22. package/src/domains/onboarding/components/AppFocusStep.tsx +113 -0
  23. package/src/domains/onboarding/components/OnboardingWizard.tsx +262 -0
  24. package/src/domains/onboarding/components/PlanStep.tsx +208 -0
  25. package/src/domains/onboarding/components/PlatformsStep.tsx +109 -0
  26. package/src/domains/onboarding/components/UserTypeStep.tsx +135 -0
  27. package/src/domains/onboarding/components/index.ts +9 -0
  28. package/src/domains/onboarding/hooks/index.ts +5 -0
  29. package/{dist/onboarding/hooks/index.js → src/domains/onboarding/hooks/useOnboarding.ts} +65 -19
  30. package/src/domains/onboarding/index.ts +35 -0
  31. package/src/domains/onboarding/types/index.ts +16 -0
  32. package/src/domains/onboarding/types/onboarding.ts +214 -0
  33. package/src/domains/onboarding/utils/index.ts +15 -0
  34. package/src/domains/onboarding/utils/onboarding.ts +166 -0
  35. package/src/domains/settings/components/SettingsLayout.tsx +144 -0
  36. package/src/domains/settings/components/SettingsSection.tsx +106 -0
  37. package/src/domains/settings/components/index.ts +6 -0
  38. package/src/domains/settings/hooks/index.ts +7 -0
  39. package/src/domains/settings/hooks/useSettings.ts +80 -0
  40. package/src/domains/settings/index.ts +22 -0
  41. package/src/domains/settings/types/index.ts +11 -0
  42. package/src/domains/settings/types/settings.ts +81 -0
  43. package/src/domains/settings/utils/index.ts +11 -0
  44. package/src/domains/settings/utils/settings.ts +80 -0
  45. package/dist/layouts/components/BrandLogo.d.ts +0 -18
  46. package/dist/layouts/components/BrandLogo.js +0 -88
  47. package/dist/layouts/components/BrandLogo.js.map +0 -1
  48. package/dist/layouts/components/DashboardHeader.d.ts +0 -36
  49. package/dist/layouts/components/DashboardHeader.js +0 -225
  50. package/dist/layouts/components/DashboardHeader.js.map +0 -1
  51. package/dist/layouts/components/DashboardLayout.d.ts +0 -45
  52. package/dist/layouts/components/DashboardLayout.js +0 -501
  53. package/dist/layouts/components/DashboardLayout.js.map +0 -1
  54. package/dist/layouts/components/DashboardSidebar.d.ts +0 -29
  55. package/dist/layouts/components/DashboardSidebar.js +0 -189
  56. package/dist/layouts/components/DashboardSidebar.js.map +0 -1
  57. package/dist/layouts/components/index.d.ts +0 -10
  58. package/dist/layouts/components/index.js +0 -502
  59. package/dist/layouts/components/index.js.map +0 -1
  60. package/dist/layouts/hooks/dashboard.d.ts +0 -35
  61. package/dist/layouts/hooks/dashboard.js +0 -57
  62. package/dist/layouts/hooks/dashboard.js.map +0 -1
  63. package/dist/layouts/hooks/index.d.ts +0 -3
  64. package/dist/layouts/hooks/index.js +0 -57
  65. package/dist/layouts/hooks/index.js.map +0 -1
  66. package/dist/layouts/index.d.ts +0 -17
  67. package/dist/layouts/index.js +0 -756
  68. package/dist/layouts/index.js.map +0 -1
  69. package/dist/layouts/theme/default.d.ts +0 -18
  70. package/dist/layouts/theme/default.js.map +0 -1
  71. package/dist/layouts/theme/index.d.ts +0 -4
  72. package/dist/layouts/theme/index.js +0 -184
  73. package/dist/layouts/theme/index.js.map +0 -1
  74. package/dist/layouts/theme/presets.d.ts +0 -14
  75. package/dist/layouts/theme/presets.js +0 -137
  76. package/dist/layouts/theme/presets.js.map +0 -1
  77. package/dist/layouts/theme/utils.d.ts +0 -22
  78. package/dist/layouts/theme/utils.js +0 -181
  79. package/dist/layouts/theme/utils.js.map +0 -1
  80. package/dist/layouts/types/index.d.ts +0 -6
  81. package/dist/layouts/types/index.js +0 -2
  82. package/dist/layouts/types/index.js.map +0 -1
  83. package/dist/layouts/types/layout.d.ts +0 -45
  84. package/dist/layouts/types/layout.js +0 -2
  85. package/dist/layouts/types/layout.js.map +0 -1
  86. package/dist/layouts/types/notification.d.ts +0 -20
  87. package/dist/layouts/types/notification.js +0 -2
  88. package/dist/layouts/types/notification.js.map +0 -1
  89. package/dist/layouts/types/sidebar.d.ts +0 -36
  90. package/dist/layouts/types/sidebar.js +0 -2
  91. package/dist/layouts/types/sidebar.js.map +0 -1
  92. package/dist/layouts/types/theme.d.ts +0 -64
  93. package/dist/layouts/types/theme.js +0 -2
  94. package/dist/layouts/types/theme.js.map +0 -1
  95. package/dist/layouts/types/user.d.ts +0 -37
  96. package/dist/layouts/types/user.js +0 -2
  97. package/dist/layouts/types/user.js.map +0 -1
  98. package/dist/layouts/utils/dashboard.d.ts +0 -57
  99. package/dist/layouts/utils/dashboard.js +0 -44
  100. package/dist/layouts/utils/dashboard.js.map +0 -1
  101. package/dist/layouts/utils/index.d.ts +0 -1
  102. package/dist/layouts/utils/index.js +0 -44
  103. package/dist/layouts/utils/index.js.map +0 -1
  104. package/dist/onboarding/components/AppFocusStep.d.ts +0 -26
  105. package/dist/onboarding/components/AppFocusStep.js +0 -86
  106. package/dist/onboarding/components/AppFocusStep.js.map +0 -1
  107. package/dist/onboarding/components/OnboardingWizard.d.ts +0 -13
  108. package/dist/onboarding/components/OnboardingWizard.js +0 -332
  109. package/dist/onboarding/components/OnboardingWizard.js.map +0 -1
  110. package/dist/onboarding/components/PlanStep.d.ts +0 -21
  111. package/dist/onboarding/components/PlanStep.js +0 -167
  112. package/dist/onboarding/components/PlanStep.js.map +0 -1
  113. package/dist/onboarding/components/PlatformsStep.d.ts +0 -26
  114. package/dist/onboarding/components/PlatformsStep.js +0 -86
  115. package/dist/onboarding/components/PlatformsStep.js.map +0 -1
  116. package/dist/onboarding/components/UserTypeStep.d.ts +0 -30
  117. package/dist/onboarding/components/UserTypeStep.js +0 -93
  118. package/dist/onboarding/components/UserTypeStep.js.map +0 -1
  119. package/dist/onboarding/components/index.d.ts +0 -9
  120. package/dist/onboarding/components/index.js +0 -738
  121. package/dist/onboarding/components/index.js.map +0 -1
  122. package/dist/onboarding/hooks/index.d.ts +0 -4
  123. package/dist/onboarding/hooks/index.js.map +0 -1
  124. package/dist/onboarding/hooks/useOnboarding.d.ts +0 -50
  125. package/dist/onboarding/hooks/useOnboarding.js +0 -100
  126. package/dist/onboarding/hooks/useOnboarding.js.map +0 -1
  127. package/dist/onboarding/index.d.ts +0 -11
  128. package/dist/onboarding/index.js +0 -913
  129. package/dist/onboarding/index.js.map +0 -1
  130. package/dist/onboarding/types/index.d.ts +0 -3
  131. package/dist/onboarding/types/index.js +0 -2
  132. package/dist/onboarding/types/index.js.map +0 -1
  133. package/dist/onboarding/types/onboarding.d.ts +0 -209
  134. package/dist/onboarding/types/onboarding.js +0 -2
  135. package/dist/onboarding/types/onboarding.js.map +0 -1
  136. package/dist/onboarding/utils/index.d.ts +0 -4
  137. package/dist/onboarding/utils/index.js +0 -83
  138. package/dist/onboarding/utils/index.js.map +0 -1
  139. package/dist/onboarding/utils/onboarding.d.ts +0 -106
  140. package/dist/onboarding/utils/onboarding.js +0 -83
  141. package/dist/onboarding/utils/onboarding.js.map +0 -1
  142. package/dist/settings/components/SettingsLayout.d.ts +0 -19
  143. package/dist/settings/components/SettingsLayout.js +0 -170
  144. package/dist/settings/components/SettingsLayout.js.map +0 -1
  145. package/dist/settings/components/SettingsSection.d.ts +0 -24
  146. package/dist/settings/components/SettingsSection.js +0 -73
  147. package/dist/settings/components/SettingsSection.js.map +0 -1
  148. package/dist/settings/components/index.d.ts +0 -5
  149. package/dist/settings/components/index.js +0 -169
  150. package/dist/settings/components/index.js.map +0 -1
  151. package/dist/settings/hooks/index.d.ts +0 -3
  152. package/dist/settings/hooks/index.js +0 -59
  153. package/dist/settings/hooks/index.js.map +0 -1
  154. package/dist/settings/hooks/useSettings.d.ts +0 -25
  155. package/dist/settings/hooks/useSettings.js +0 -59
  156. package/dist/settings/hooks/useSettings.js.map +0 -1
  157. package/dist/settings/index.d.ts +0 -7
  158. package/dist/settings/index.js +0 -259
  159. package/dist/settings/index.js.map +0 -1
  160. package/dist/settings/types/index.d.ts +0 -2
  161. package/dist/settings/types/index.js +0 -2
  162. package/dist/settings/types/index.js.map +0 -1
  163. package/dist/settings/types/settings.d.ts +0 -79
  164. package/dist/settings/types/settings.js +0 -2
  165. package/dist/settings/types/settings.js.map +0 -1
  166. package/dist/settings/utils/index.d.ts +0 -3
  167. package/dist/settings/utils/index.js +0 -39
  168. package/dist/settings/utils/index.js.map +0 -1
  169. package/dist/settings/utils/settings.d.ts +0 -50
  170. package/dist/settings/utils/settings.js +0 -39
  171. package/dist/settings/utils/settings.js.map +0 -1
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Settings Hooks
3
+ *
4
+ * Custom React hooks for settings functionality
5
+ */
6
+
7
+ import { useState, useCallback } from "react";
8
+ import type { SettingsConfig, SettingsItem } from "../types/settings";
9
+
10
+ /**
11
+ * Use Settings Hook
12
+ *
13
+ * Manages settings state and actions
14
+ *
15
+ * @param initialConfig - Initial settings configuration
16
+ * @returns Settings state and actions
17
+ */
18
+ export function useSettings(initialConfig: SettingsConfig) {
19
+ const [config, setConfig] = useState<SettingsConfig>(initialConfig);
20
+
21
+ const updateItem = useCallback(
22
+ (sectionKey: string, itemKey: string, updates: Partial<SettingsItem>) => {
23
+ setConfig((prev) => ({
24
+ ...prev,
25
+ sections: prev.sections.map((section) =>
26
+ section.key === sectionKey
27
+ ? {
28
+ ...section,
29
+ items: section.items.map((item) =>
30
+ item.key === itemKey ? { ...item, ...updates } : item
31
+ ),
32
+ }
33
+ : section
34
+ ),
35
+ }));
36
+ },
37
+ []
38
+ );
39
+
40
+ const toggleItem = useCallback((sectionKey: string, itemKey: string) => {
41
+ setConfig((prev) => ({
42
+ ...prev,
43
+ sections: prev.sections.map((section) =>
44
+ section.key === sectionKey
45
+ ? {
46
+ ...section,
47
+ items: section.items.map((item) =>
48
+ item.key === itemKey
49
+ ? { ...item, enabled: item.enabled === undefined ? true : !item.enabled }
50
+ : item
51
+ ),
52
+ }
53
+ : section
54
+ ),
55
+ }));
56
+ }, []);
57
+
58
+ const setItemBadge = useCallback((sectionKey: string, itemKey: string, badge: number | undefined) => {
59
+ setConfig((prev) => ({
60
+ ...prev,
61
+ sections: prev.sections.map((section) =>
62
+ section.key === sectionKey
63
+ ? {
64
+ ...section,
65
+ items: section.items.map((item) =>
66
+ item.key === itemKey ? { ...item, badge } : item
67
+ ),
68
+ }
69
+ : section
70
+ ),
71
+ }));
72
+ }, []);
73
+
74
+ return {
75
+ config,
76
+ updateItem,
77
+ toggleItem,
78
+ setItemBadge,
79
+ };
80
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @umituz/web-dashboard - Settings Domain
3
+ *
4
+ * Config-driven Settings System
5
+ */
6
+
7
+ export { SettingsLayout, SettingsSection } from './components';
8
+ export { useSettings } from './hooks';
9
+ export {
10
+ findSettingsItem,
11
+ findSettingsSection,
12
+ filterSettingsByPermission,
13
+ getSettingsDefaultRoute,
14
+ generateSettingsKey,
15
+ } from './utils';
16
+ export type {
17
+ SettingsItem,
18
+ SettingsSection as SettingsSectionType,
19
+ SettingsConfig,
20
+ SettingsLayoutProps,
21
+ SettingsSectionProps,
22
+ } from './types';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Settings Types Export
3
+ */
4
+
5
+ export type {
6
+ SettingsItem,
7
+ SettingsSection,
8
+ SettingsConfig,
9
+ SettingsLayoutProps,
10
+ SettingsSectionProps,
11
+ } from './settings';
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Settings Types
3
+ *
4
+ * Type definitions for settings system
5
+ */
6
+
7
+ import type { LucideIcon } from "lucide-react";
8
+
9
+ /**
10
+ * Settings item configuration
11
+ */
12
+ export interface SettingsItem {
13
+ /** Unique key for the setting */
14
+ key: string;
15
+ /** Display label (can be i18n key) */
16
+ label: string;
17
+ /** Description text (optional) */
18
+ description?: string;
19
+ /** Icon component */
20
+ icon?: LucideIcon;
21
+ /** Route path for this setting */
22
+ path?: string;
23
+ /** Whether this item is enabled */
24
+ enabled?: boolean;
25
+ /** Required permission to access */
26
+ permission?: string;
27
+ /** Badge count (for notifications) */
28
+ badge?: number;
29
+ }
30
+
31
+ /**
32
+ * Settings section configuration
33
+ */
34
+ export interface SettingsSection {
35
+ /** Section title */
36
+ title: string;
37
+ /** Section key */
38
+ key: string;
39
+ /** Items in this section */
40
+ items: SettingsItem[];
41
+ /** Optional: Section icon */
42
+ icon?: LucideIcon;
43
+ }
44
+
45
+ /**
46
+ * Settings layout configuration
47
+ */
48
+ export interface SettingsConfig {
49
+ /** Settings sections */
50
+ sections: SettingsSection[];
51
+ /** Brand name */
52
+ brandName?: string;
53
+ /** Default route */
54
+ defaultRoute?: string;
55
+ }
56
+
57
+ /**
58
+ * Settings layout props
59
+ */
60
+ export interface SettingsLayoutProps {
61
+ /** Settings configuration */
62
+ config: SettingsConfig;
63
+ /** Current path */
64
+ currentPath?: string;
65
+ /** On navigate callback */
66
+ onNavigate?: (path: string) => void;
67
+ }
68
+
69
+ /**
70
+ * Settings section component props
71
+ */
72
+ export interface SettingsSectionProps {
73
+ /** Section configuration */
74
+ section: SettingsSection;
75
+ /** Current path */
76
+ currentPath?: string;
77
+ /** On navigate callback */
78
+ onNavigate?: (path: string) => void;
79
+ /** Collapsed state */
80
+ collapsed?: boolean;
81
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Settings Utils Export
3
+ */
4
+
5
+ export {
6
+ findSettingsItem,
7
+ findSettingsSection,
8
+ filterSettingsByPermission,
9
+ getSettingsDefaultRoute,
10
+ generateSettingsKey,
11
+ } from './settings';
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Settings Utilities
3
+ *
4
+ * Utility functions for settings operations
5
+ */
6
+
7
+ import type { SettingsConfig, SettingsItem, SettingsSection } from "../types/settings";
8
+
9
+ /**
10
+ * Find settings item by key
11
+ *
12
+ * @param config - Settings configuration
13
+ * @param itemKey - Item key to find
14
+ * @returns Item or undefined
15
+ */
16
+ export function findSettingsItem(config: SettingsConfig, itemKey: string): SettingsItem | undefined {
17
+ for (const section of config.sections) {
18
+ const item = section.items.find((i) => i.key === itemKey);
19
+ if (item) return item;
20
+ }
21
+ return undefined;
22
+ }
23
+
24
+ /**
25
+ * Find settings section by key
26
+ *
27
+ * @param config - Settings configuration
28
+ * @param sectionKey - Section key to find
29
+ * @returns Section or undefined
30
+ */
31
+ export function findSettingsSection(config: SettingsConfig, sectionKey: string): SettingsSection | undefined {
32
+ return config.sections.find((s) => s.key === sectionKey);
33
+ }
34
+
35
+ /**
36
+ * Filter settings items by permission
37
+ *
38
+ * @param items - Settings items to filter
39
+ * @param userPermissions - User permissions
40
+ * @returns Filtered items
41
+ */
42
+ export function filterSettingsByPermission<T extends SettingsItem>(
43
+ items: T[],
44
+ userPermissions?: string[]
45
+ ): T[] {
46
+ if (!userPermissions) return items.filter((item) => item.permission === undefined);
47
+
48
+ return items.filter((item) => {
49
+ if (item.permission === undefined) return true;
50
+ return userPermissions.includes(item.permission);
51
+ });
52
+ }
53
+
54
+ /**
55
+ * Get default route from settings config
56
+ *
57
+ * @param config - Settings configuration
58
+ * @returns Default route or first available route
59
+ */
60
+ export function getSettingsDefaultRoute(config: SettingsConfig): string {
61
+ if (config.defaultRoute) return config.defaultRoute;
62
+
63
+ for (const section of config.sections) {
64
+ const firstEnabled = section.items.find((item) => item.enabled !== false && item.path);
65
+ if (firstEnabled?.path) return firstEnabled.path;
66
+ }
67
+
68
+ return "/settings";
69
+ }
70
+
71
+ /**
72
+ * Generate settings item key
73
+ *
74
+ * @param prefix - Key prefix
75
+ * @param identifier - Unique identifier
76
+ * @returns Generated key
77
+ */
78
+ export function generateSettingsKey(prefix: string, identifier: string): string {
79
+ return `${prefix}_${identifier}`;
80
+ }
@@ -1,18 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- interface BrandLogoProps {
4
- className?: string;
5
- size?: number;
6
- }
7
- /**
8
- * BrandLogo Component
9
- *
10
- * Displays the application brand logo as an SVG.
11
- * Supports custom sizing and styling through className.
12
- *
13
- * @param className - Optional CSS classes for styling
14
- * @param size - Width and height in pixels (default: 32)
15
- */
16
- declare const BrandLogo: ({ className, size }: BrandLogoProps) => react_jsx_runtime.JSX.Element;
17
-
18
- export { BrandLogo };
@@ -1,88 +0,0 @@
1
- "use client";
2
-
3
- // src/domains/layouts/components/BrandLogo.tsx
4
- import { cn } from "@umituz/web-design-system/utils";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
- var BrandLogo = ({ className, size = 32 }) => {
7
- return /* @__PURE__ */ jsxs(
8
- "svg",
9
- {
10
- width: size,
11
- height: size,
12
- viewBox: "0 0 100 100",
13
- fill: "none",
14
- xmlns: "http://www.w3.org/2000/svg",
15
- className: cn("shrink-0", className),
16
- children: [
17
- /* @__PURE__ */ jsx(
18
- "rect",
19
- {
20
- x: "15",
21
- y: "65",
22
- width: "70",
23
- height: "15",
24
- rx: "4",
25
- fill: "hsl(var(--primary))"
26
- }
27
- ),
28
- /* @__PURE__ */ jsx(
29
- "rect",
30
- {
31
- x: "25",
32
- y: "25",
33
- width: "12",
34
- height: "40",
35
- rx: "2",
36
- fill: "hsl(var(--primary))"
37
- }
38
- ),
39
- /* @__PURE__ */ jsx(
40
- "rect",
41
- {
42
- x: "44",
43
- y: "35",
44
- width: "12",
45
- height: "30",
46
- rx: "2",
47
- fill: "hsl(var(--primary))"
48
- }
49
- ),
50
- /* @__PURE__ */ jsx(
51
- "rect",
52
- {
53
- x: "63",
54
- y: "20",
55
- width: "12",
56
- height: "45",
57
- rx: "2",
58
- fill: "hsl(var(--primary))"
59
- }
60
- ),
61
- /* @__PURE__ */ jsx(
62
- "rect",
63
- {
64
- x: "20",
65
- y: "45",
66
- width: "60",
67
- height: "10",
68
- rx: "2",
69
- fill: "hsl(var(--secondary))"
70
- }
71
- ),
72
- /* @__PURE__ */ jsx(
73
- "circle",
74
- {
75
- cx: "50",
76
- cy: "20",
77
- r: "5",
78
- fill: "hsl(var(--secondary))"
79
- }
80
- )
81
- ]
82
- }
83
- );
84
- };
85
- export {
86
- BrandLogo
87
- };
88
- //# sourceMappingURL=BrandLogo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/domains/layouts/components/BrandLogo.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn } from \"@umituz/web-design-system/utils\";\n\ninterface BrandLogoProps {\n className?: string;\n size?: number;\n}\n\n/**\n * BrandLogo Component\n *\n * Displays the application brand logo as an SVG.\n * Supports custom sizing and styling through className.\n *\n * @param className - Optional CSS classes for styling\n * @param size - Width and height in pixels (default: 32)\n */\nexport const BrandLogo = ({ className, size = 32 }: BrandLogoProps) => {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 100 100\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={cn(\"shrink-0\", className)}\n >\n {/* Solid Foundation / Platform */}\n <rect\n x=\"15\"\n y=\"65\"\n width=\"70\"\n height=\"15\"\n rx=\"4\"\n fill=\"hsl(var(--primary))\"\n />\n\n {/* Assembly Paths / Structure */}\n <rect\n x=\"25\"\n y=\"25\"\n width=\"12\"\n height=\"40\"\n rx=\"2\"\n fill=\"hsl(var(--primary))\"\n />\n <rect\n x=\"44\"\n y=\"35\"\n width=\"12\"\n height=\"30\"\n rx=\"2\"\n fill=\"hsl(var(--primary))\"\n />\n <rect\n x=\"63\"\n y=\"20\"\n width=\"12\"\n height=\"45\"\n rx=\"2\"\n fill=\"hsl(var(--primary))\"\n />\n\n {/* Modern Accent - The 'Assembly' Bridge */}\n <rect\n x=\"20\"\n y=\"45\"\n width=\"60\"\n height=\"10\"\n rx=\"2\"\n fill=\"hsl(var(--secondary))\"\n />\n\n {/* Connection Point / Beacon */}\n <circle\n cx=\"50\"\n cy=\"20\"\n r=\"5\"\n fill=\"hsl(var(--secondary))\"\n />\n </svg>\n );\n};\n"],"mappings":";;;AACA,SAAS,UAAU;AAkBf,SASE,KATF;AAFG,IAAM,YAAY,CAAC,EAAE,WAAW,OAAO,GAAG,MAAsB;AACrE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,OAAM;AAAA,MACN,WAAW,GAAG,YAAY,SAAS;AAAA,MAGnC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,GAAE;AAAA,YACF,GAAE;AAAA,YACF,OAAM;AAAA,YACN,QAAO;AAAA,YACP,IAAG;AAAA,YACH,MAAK;AAAA;AAAA,QACP;AAAA,QAGA;AAAA,UAAC;AAAA;AAAA,YACC,GAAE;AAAA,YACF,GAAE;AAAA,YACF,OAAM;AAAA,YACN,QAAO;AAAA,YACP,IAAG;AAAA,YACH,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,GAAE;AAAA,YACF,GAAE;AAAA,YACF,OAAM;AAAA,YACN,QAAO;AAAA,YACP,IAAG;AAAA,YACH,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,GAAE;AAAA,YACF,GAAE;AAAA,YACF,OAAM;AAAA,YACN,QAAO;AAAA,YACP,IAAG;AAAA,YACH,MAAK;AAAA;AAAA,QACP;AAAA,QAGA;AAAA,UAAC;AAAA;AAAA,YACC,GAAE;AAAA,YACF,GAAE;AAAA,YACF,OAAM;AAAA,YACN,QAAO;AAAA,YACP,IAAG;AAAA,YACH,MAAK;AAAA;AAAA,QACP;AAAA,QAGA;AAAA,UAAC;AAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAG;AAAA,YACH,GAAE;AAAA,YACF,MAAK;AAAA;AAAA,QACP;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,36 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { DashboardHeaderProps } from '../types/layout.js';
3
- import { DashboardNotification } from '../types/notification.js';
4
- import { DashboardUser } from '../types/user.js';
5
- import '../types/sidebar.js';
6
- import 'lucide-react';
7
-
8
- interface DashboardHeaderPropsExtended extends DashboardHeaderProps {
9
- /** Auth user */
10
- user?: DashboardUser;
11
- /** Notifications */
12
- notifications?: DashboardNotification[];
13
- /** Logout function */
14
- onLogout?: () => Promise<void>;
15
- /** Mark all as read function */
16
- onMarkAllRead?: () => void;
17
- /** Dismiss notification function */
18
- onDismissNotification?: (id: string) => void;
19
- /** Settings route */
20
- settingsRoute?: string;
21
- /** Profile route */
22
- profileRoute?: string;
23
- /** Billing route */
24
- billingRoute?: string;
25
- }
26
- /**
27
- * Dashboard Header Component
28
- *
29
- * Displays top navigation bar with theme toggle, notifications,
30
- * user menu, and organisation selector.
31
- *
32
- * @param props - Dashboard header props
33
- */
34
- declare const DashboardHeader: ({ collapsed, setCollapsed, setMobileOpen, title, user, notifications, onLogout, onMarkAllRead, onDismissNotification, settingsRoute, profileRoute, billingRoute, }: DashboardHeaderPropsExtended) => react_jsx_runtime.JSX.Element;
35
-
36
- export { DashboardHeader };
@@ -1,225 +0,0 @@
1
- "use client";
2
-
3
- // src/domains/layouts/components/DashboardHeader.tsx
4
- import React, { useState } from "react";
5
- import {
6
- Bell,
7
- X,
8
- Sun,
9
- Moon,
10
- Menu,
11
- User,
12
- Settings,
13
- LogOut,
14
- ChevronDown,
15
- CreditCard
16
- } from "lucide-react";
17
- import { Button } from "@umituz/web-design-system/atoms";
18
- import { useNavigate } from "react-router-dom";
19
- import { useTranslation } from "react-i18next";
20
-
21
- // src/domains/layouts/utils/dashboard.ts
22
- function formatNotificationTime(createdAt, t) {
23
- const date = new Date(createdAt);
24
- const secs = Math.floor((Date.now() - date.getTime()) / 1e3);
25
- if (secs < 60) return t("dashboard.activityFeed.times.justNow");
26
- if (secs < 3600) return t("dashboard.activityFeed.times.minutesAgo", { val: Math.floor(secs / 60) });
27
- if (secs < 86400) return t("dashboard.activityFeed.times.hoursAgo", { val: Math.floor(secs / 3600) });
28
- return t("dashboard.activityFeed.times.daysAgo", { val: Math.floor(secs / 86400) });
29
- }
30
-
31
- // src/domains/layouts/components/DashboardHeader.tsx
32
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
33
- var DashboardHeader = ({
34
- collapsed,
35
- setCollapsed,
36
- setMobileOpen,
37
- title,
38
- user,
39
- notifications = [],
40
- onLogout,
41
- onMarkAllRead,
42
- onDismissNotification,
43
- settingsRoute = "/dashboard/settings",
44
- profileRoute = "/dashboard/profile",
45
- billingRoute = "/dashboard/billing"
46
- }) => {
47
- const navigate = useNavigate();
48
- const { t } = useTranslation();
49
- const [notifOpen, setNotifOpen] = useState(false);
50
- const [profileOpen, setProfileOpen] = useState(false);
51
- const unreadCount = notifications.filter((n) => !n.read).length;
52
- const markAllRead = () => {
53
- onMarkAllRead?.();
54
- };
55
- const handleLogout = async () => {
56
- try {
57
- await onLogout?.();
58
- navigate("/login");
59
- } catch {
60
- }
61
- };
62
- const ThemeToggle = () => {
63
- const [resolvedTheme, setResolvedTheme] = React.useState("light");
64
- return /* @__PURE__ */ jsx(
65
- Button,
66
- {
67
- variant: "ghost",
68
- size: "icon",
69
- onClick: () => setResolvedTheme(resolvedTheme === "light" ? "dark" : "light"),
70
- className: "text-muted-foreground h-9 w-9",
71
- title: resolvedTheme === "dark" ? t("common.tooltips.switchLight") : t("common.tooltips.switchDark"),
72
- children: resolvedTheme === "dark" ? /* @__PURE__ */ jsx(Sun, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Moon, { className: "h-4 w-4" })
73
- }
74
- );
75
- };
76
- return /* @__PURE__ */ jsxs("header", { className: "flex h-14 items-center justify-between border-b border-border bg-card/50 backdrop-blur-md px-4 shrink-0 z-30", children: [
77
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
78
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "md:hidden", onClick: () => setMobileOpen(true), children: /* @__PURE__ */ jsx(Menu, { className: "h-5 w-5" }) }),
79
- collapsed && /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "hidden md:inline-flex", onClick: () => setCollapsed(false), children: /* @__PURE__ */ jsx(Menu, { className: "h-5 w-5" }) }),
80
- /* @__PURE__ */ jsx("h2", { className: "text-sm font-semibold text-foreground", children: title })
81
- ] }),
82
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
83
- /* @__PURE__ */ jsx(ThemeToggle, {}),
84
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
85
- /* @__PURE__ */ jsxs(
86
- Button,
87
- {
88
- variant: "ghost",
89
- size: "icon",
90
- className: "text-muted-foreground relative h-9 w-9",
91
- onClick: () => {
92
- setNotifOpen(!notifOpen);
93
- setProfileOpen(false);
94
- },
95
- children: [
96
- /* @__PURE__ */ jsx(Bell, { className: "h-4 w-4" }),
97
- unreadCount > 0 && /* @__PURE__ */ jsxs("span", { className: "absolute top-2 right-2 flex h-2 w-2", children: [
98
- /* @__PURE__ */ jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-destructive opacity-75" }),
99
- /* @__PURE__ */ jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-destructive" })
100
- ] })
101
- ]
102
- }
103
- ),
104
- notifOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
105
- /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-40", onClick: () => setNotifOpen(false) }),
106
- /* @__PURE__ */ jsxs("div", { className: "absolute top-12 right-0 w-80 bg-popover border border-border rounded-xl shadow-xl z-50 overflow-hidden animate-in fade-in zoom-in-95 duration-200", children: [
107
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b border-border bg-muted/50", children: [
108
- /* @__PURE__ */ jsx("h3", { className: "text-xs font-bold uppercase tracking-wider text-foreground", children: t("dashboard.notifications.title") }),
109
- unreadCount > 0 && /* @__PURE__ */ jsx("button", { onClick: markAllRead, className: "text-[10px] font-bold text-primary hover:underline uppercase", children: t("dashboard.notifications.markAllRead") })
110
- ] }),
111
- /* @__PURE__ */ jsxs("div", { className: "max-h-[400px] overflow-y-auto", children: [
112
- notifications.map((n) => /* @__PURE__ */ jsxs("div", { className: `px-4 py-3 border-b border-border last:border-0 flex items-start gap-3 transition-colors hover:bg-muted/30 ${!n.read ? "bg-primary/5" : ""}`, children: [
113
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
114
- /* @__PURE__ */ jsx("p", { className: "text-sm text-foreground leading-snug", children: n.text }),
115
- /* @__PURE__ */ jsxs("p", { className: "text-[10px] text-muted-foreground mt-1 flex items-center gap-1", children: [
116
- /* @__PURE__ */ jsx("span", { className: "inline-block w-1 h-1 rounded-full bg-muted-foreground/30" }),
117
- formatNotificationTime(n.createdAt, t)
118
- ] })
119
- ] }),
120
- /* @__PURE__ */ jsx(
121
- "button",
122
- {
123
- onClick: () => onDismissNotification?.(n.id),
124
- className: "text-muted-foreground/50 hover:text-foreground shrink-0 transition-colors",
125
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
126
- }
127
- )
128
- ] }, n.id)),
129
- notifications.length === 0 && /* @__PURE__ */ jsxs("div", { className: "px-4 py-10 text-center", children: [
130
- /* @__PURE__ */ jsx("div", { className: "mx-auto w-10 h-10 rounded-full bg-muted flex items-center justify-center mb-3", children: /* @__PURE__ */ jsx(Bell, { className: "h-5 w-5 text-muted-foreground/50" }) }),
131
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("dashboard.notifications.none") })
132
- ] })
133
- ] })
134
- ] })
135
- ] })
136
- ] }),
137
- /* @__PURE__ */ jsx("div", { className: "h-6 w-px bg-border mx-1" }),
138
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
139
- /* @__PURE__ */ jsxs(
140
- "button",
141
- {
142
- onClick: () => {
143
- setProfileOpen(!profileOpen);
144
- setNotifOpen(false);
145
- },
146
- className: "flex items-center gap-2 p-1 pl-1 rounded-full hover:bg-muted transition-colors group",
147
- children: [
148
- /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center text-[10px] font-bold text-primary overflow-hidden border border-primary/20 ring-primary/20 group-hover:ring-4 transition-all", children: user?.avatar && /* @__PURE__ */ jsx("img", { src: user.avatar, alt: "User", className: "w-full h-full object-cover" }) }),
149
- /* @__PURE__ */ jsx(ChevronDown, { className: `h-4 w-4 text-muted-foreground transition-transform duration-200 ${profileOpen && "rotate-180"}` })
150
- ]
151
- }
152
- ),
153
- profileOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
154
- /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-40", onClick: () => setProfileOpen(false) }),
155
- /* @__PURE__ */ jsxs("div", { className: "absolute top-12 right-0 w-56 bg-popover border border-border rounded-xl shadow-xl z-50 overflow-hidden animate-in fade-in zoom-in-95 duration-200 p-1.5", children: [
156
- /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 border-b border-border/50 mb-1", children: [
157
- /* @__PURE__ */ jsx("p", { className: "text-sm font-bold text-foreground", children: user?.name || t("common.roles.user") }),
158
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground truncate", children: user?.email })
159
- ] }),
160
- /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
161
- /* @__PURE__ */ jsxs(
162
- "button",
163
- {
164
- onClick: () => {
165
- navigate(profileRoute);
166
- setProfileOpen(false);
167
- },
168
- className: "flex w-full items-center gap-2.5 px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors",
169
- children: [
170
- /* @__PURE__ */ jsx(User, { className: "h-4 w-4 text-muted-foreground" }),
171
- t("common.profile")
172
- ]
173
- }
174
- ),
175
- /* @__PURE__ */ jsxs(
176
- "button",
177
- {
178
- onClick: () => {
179
- navigate(billingRoute);
180
- setProfileOpen(false);
181
- },
182
- className: "flex w-full items-center gap-2.5 px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors",
183
- children: [
184
- /* @__PURE__ */ jsx(CreditCard, { className: "h-4 w-4 text-muted-foreground" }),
185
- t("common.billing")
186
- ]
187
- }
188
- ),
189
- /* @__PURE__ */ jsxs(
190
- "button",
191
- {
192
- onClick: () => {
193
- navigate(settingsRoute);
194
- setProfileOpen(false);
195
- },
196
- className: "flex w-full items-center gap-2.5 px-3 py-2 text-sm text-foreground hover:bg-muted rounded-lg transition-colors",
197
- children: [
198
- /* @__PURE__ */ jsx(Settings, { className: "h-4 w-4 text-muted-foreground" }),
199
- t("common.settings")
200
- ]
201
- }
202
- )
203
- ] }),
204
- /* @__PURE__ */ jsx("div", { className: "h-px bg-border my-1.5" }),
205
- /* @__PURE__ */ jsxs(
206
- "button",
207
- {
208
- onClick: handleLogout,
209
- className: "flex w-full items-center gap-2.5 px-3 py-2 text-sm text-destructive hover:bg-destructive/10 rounded-lg transition-colors font-medium",
210
- children: [
211
- /* @__PURE__ */ jsx(LogOut, { className: "h-4 w-4" }),
212
- t("common.logout")
213
- ]
214
- }
215
- )
216
- ] })
217
- ] })
218
- ] })
219
- ] })
220
- ] });
221
- };
222
- export {
223
- DashboardHeader
224
- };
225
- //# sourceMappingURL=DashboardHeader.js.map