@admin-layout/tailwind-design-pro 12.0.16-alpha.7 → 12.0.16-alpha.71

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 (182) hide show
  1. package/README.md +20 -0
  2. package/lib/cdm-locales/en/menu.json +2 -1
  3. package/lib/cdm-locales/es/menu.json +2 -1
  4. package/lib/cdm-locales/index.d.ts +2 -0
  5. package/lib/cdm-locales/index.d.ts.map +1 -0
  6. package/lib/cdm-locales/index.ts +1 -0
  7. package/lib/components/LanguageMenu/LanguageMenu.js.map +1 -1
  8. package/lib/components/Layout/BasicLayout/index.d.ts +2 -1
  9. package/lib/components/Layout/BasicLayout/index.d.ts.map +1 -1
  10. package/lib/components/Layout/BasicLayout/index.js +134 -44
  11. package/lib/components/Layout/BasicLayout/index.js.map +1 -1
  12. package/lib/components/Layout/BasicLayout/utils.d.ts +2 -0
  13. package/lib/components/Layout/BasicLayout/utils.d.ts.map +1 -1
  14. package/lib/components/Layout/BasicLayout/utils.js +16 -13
  15. package/lib/components/Layout/BasicLayout/utils.js.map +1 -1
  16. package/lib/components/Layout/GlobalFooter/Account.d.ts +4 -0
  17. package/lib/components/Layout/GlobalFooter/Account.d.ts.map +1 -0
  18. package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.d.ts.map +1 -1
  19. package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.js +7 -12
  20. package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.js.map +1 -1
  21. package/lib/components/Layout/GlobalHeader/Header.d.ts.map +1 -1
  22. package/lib/components/Layout/GlobalHeader/Header.js +31 -8
  23. package/lib/components/Layout/GlobalHeader/Header.js.map +1 -1
  24. package/lib/components/Layout/GlobalHeader/MainHeader.d.ts +0 -2
  25. package/lib/components/Layout/GlobalHeader/MainHeader.d.ts.map +1 -1
  26. package/lib/components/Layout/GlobalHeader/MainHeader.js +54 -85
  27. package/lib/components/Layout/GlobalHeader/MainHeader.js.map +1 -1
  28. package/lib/components/Layout/GlobalHeader/OrganizationDropdown.js +1 -1
  29. package/lib/components/Layout/GlobalHeader/OrganizationDropdown.js.map +1 -1
  30. package/lib/components/Layout/GlobalHeader/RightContent.d.ts +1 -0
  31. package/lib/components/Layout/GlobalHeader/RightContent.d.ts.map +1 -1
  32. package/lib/components/Layout/GlobalHeader/RightContent.js +73 -6
  33. package/lib/components/Layout/GlobalHeader/RightContent.js.map +1 -1
  34. package/lib/components/Layout/GlobalHeader/RightMenu.d.ts.map +1 -1
  35. package/lib/components/Layout/GlobalHeader/RightMenu.js +2 -4
  36. package/lib/components/Layout/GlobalHeader/RightMenu.js.map +1 -1
  37. package/lib/components/Layout/GlobalHeader/SearchBar.js.map +1 -1
  38. package/lib/components/Layout/GlobalHeader/index.d.ts +0 -1
  39. package/lib/components/Layout/GlobalHeader/index.d.ts.map +1 -1
  40. package/lib/components/Layout/ProTailwindLayout.d.ts +2 -2
  41. package/lib/components/Layout/ProTailwindLayout.d.ts.map +1 -1
  42. package/lib/components/Layout/ProTailwindLayout.js +69 -7
  43. package/lib/components/Layout/ProTailwindLayout.js.map +1 -1
  44. package/lib/components/Layout/Sidebar/BottomMenu.d.ts +4 -0
  45. package/lib/components/Layout/Sidebar/BottomMenu.d.ts.map +1 -0
  46. package/lib/components/Layout/Sidebar/BottomMenu.js +330 -0
  47. package/lib/components/Layout/Sidebar/BottomMenu.js.map +1 -0
  48. package/lib/components/Layout/Sidebar/Divider.js.map +1 -1
  49. package/lib/components/Layout/Sidebar/DynamicIcon.js.map +1 -1
  50. package/lib/components/Layout/Sidebar/MainSidebar.d.ts +5 -0
  51. package/lib/components/Layout/Sidebar/MainSidebar.d.ts.map +1 -0
  52. package/lib/components/Layout/Sidebar/{Sidebar.js → MainSidebar.js} +94 -34
  53. package/lib/components/Layout/Sidebar/MainSidebar.js.map +1 -0
  54. package/lib/components/Layout/Sidebar/MainSidebarMenu.d.ts +4 -0
  55. package/lib/components/Layout/Sidebar/MainSidebarMenu.d.ts.map +1 -0
  56. package/lib/components/Layout/Sidebar/MainSidebarMenu.js +291 -0
  57. package/lib/components/Layout/Sidebar/MainSidebarMenu.js.map +1 -0
  58. package/lib/components/Layout/Sidebar/PerplexSidebar.d.ts +5 -0
  59. package/lib/components/Layout/Sidebar/PerplexSidebar.d.ts.map +1 -0
  60. package/lib/components/Layout/Sidebar/PerplexSidebar.js +277 -0
  61. package/lib/components/Layout/Sidebar/PerplexSidebar.js.map +1 -0
  62. package/lib/components/Layout/Sidebar/PerplexSidebarMenu.d.ts +4 -0
  63. package/lib/components/Layout/Sidebar/PerplexSidebarMenu.d.ts.map +1 -0
  64. package/lib/components/Layout/Sidebar/PerplexSidebarMenu.js +330 -0
  65. package/lib/components/Layout/Sidebar/PerplexSidebarMenu.js.map +1 -0
  66. package/lib/components/Layout/TailwindLayout.d.ts.map +1 -1
  67. package/lib/components/Layout/TailwindLayout.js +37 -10
  68. package/lib/components/Layout/TailwindLayout.js.map +1 -1
  69. package/lib/components/Layout/getPageTitle.js.map +1 -1
  70. package/lib/components/Layout/slot-fill/AdditionalSettings.js.map +1 -1
  71. package/lib/components/Layout/slot-fill/Footer.js.map +1 -1
  72. package/lib/components/Layout/slot-fill/HeaderSearchBar.js.map +1 -1
  73. package/lib/components/Layout/slot-fill/HeaderSearchButton.js.map +1 -1
  74. package/lib/components/Layout/slot-fill/Logo.d.ts +4 -0
  75. package/lib/components/Layout/slot-fill/Logo.d.ts.map +1 -0
  76. package/lib/components/Layout/slot-fill/Logo.js +7 -0
  77. package/lib/components/Layout/slot-fill/Logo.js.map +1 -0
  78. package/lib/components/Layout/slot-fill/RightContent.js.map +1 -1
  79. package/lib/components/Layout/slot-fill/SideMenuLogo.d.ts +4 -0
  80. package/lib/components/Layout/slot-fill/SideMenuLogo.d.ts.map +1 -0
  81. package/lib/components/Layout/slot-fill/SideMenuLogo.js +7 -0
  82. package/lib/components/Layout/slot-fill/SideMenuLogo.js.map +1 -0
  83. package/lib/components/Layout/slot-fill/index.d.ts +2 -0
  84. package/lib/components/Layout/slot-fill/index.d.ts.map +1 -1
  85. package/lib/components/Layout/util.js +1 -1
  86. package/lib/components/Layout/util.js.map +1 -1
  87. package/lib/components/SettingDrawer/CheckBoxTheme.d.ts.map +1 -1
  88. package/lib/components/SettingDrawer/CheckBoxTheme.js +13 -3
  89. package/lib/components/SettingDrawer/CheckBoxTheme.js.map +1 -1
  90. package/lib/components/SettingDrawer/InvitationSettings.d.ts.map +1 -1
  91. package/lib/components/SettingDrawer/InvitationSettings.js +10 -6
  92. package/lib/components/SettingDrawer/InvitationSettings.js.map +1 -1
  93. package/lib/components/SettingDrawer/LayoutChange.d.ts.map +1 -1
  94. package/lib/components/SettingDrawer/LayoutChange.js +23 -16
  95. package/lib/components/SettingDrawer/LayoutChange.js.map +1 -1
  96. package/lib/components/SettingDrawer/MenuVisibilitySettings.d.ts +20 -0
  97. package/lib/components/SettingDrawer/MenuVisibilitySettings.d.ts.map +1 -0
  98. package/lib/components/SettingDrawer/MenuVisibilitySettings.js +120 -0
  99. package/lib/components/SettingDrawer/MenuVisibilitySettings.js.map +1 -0
  100. package/lib/components/SettingDrawer/NavigationsModes.d.ts +1 -1
  101. package/lib/components/SettingDrawer/NavigationsModes.d.ts.map +1 -1
  102. package/lib/components/SettingDrawer/NavigationsModes.js +90 -39
  103. package/lib/components/SettingDrawer/NavigationsModes.js.map +1 -1
  104. package/lib/components/SettingDrawer/RegionalSettings.d.ts.map +1 -1
  105. package/lib/components/SettingDrawer/RegionalSettings.js +54 -177
  106. package/lib/components/SettingDrawer/RegionalSettings.js.map +1 -1
  107. package/lib/components/SettingDrawer/SettingDrawer.d.ts.map +1 -1
  108. package/lib/components/SettingDrawer/SettingDrawer.js +404 -66
  109. package/lib/components/SettingDrawer/SettingDrawer.js.map +1 -1
  110. package/lib/components/SettingDrawer/Switch/index.js.map +1 -1
  111. package/lib/components/SettingDrawer/ThemeColor.d.ts.map +1 -1
  112. package/lib/components/SettingDrawer/ThemeColor.js +15 -3
  113. package/lib/components/SettingDrawer/ThemeColor.js.map +1 -1
  114. package/lib/components/SettingDrawer/types.d.ts +12 -0
  115. package/lib/components/SettingDrawer/types.d.ts.map +1 -1
  116. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.d.ts +10 -5
  117. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.d.ts.map +1 -1
  118. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.js +97 -4
  119. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.js.map +1 -1
  120. package/lib/components/index.js +1 -1
  121. package/lib/components/typings.d.ts +20 -1
  122. package/lib/components/typings.d.ts.map +1 -1
  123. package/lib/compute.d.ts.map +1 -1
  124. package/lib/compute.js +10 -2
  125. package/lib/compute.js.map +1 -1
  126. package/lib/config/constants.js.map +1 -1
  127. package/lib/config/env-config.d.ts +3 -0
  128. package/lib/config/env-config.d.ts.map +1 -1
  129. package/lib/config/env-config.js +10 -0
  130. package/lib/config/env-config.js.map +1 -1
  131. package/lib/helpers/DynamicIcon.js.map +1 -1
  132. package/lib/hooks/useMediaQuery.js.map +1 -1
  133. package/lib/hooks/useScrollThreshold.js.map +1 -1
  134. package/lib/hooks/useTailwindTheme.js +82 -0
  135. package/lib/hooks/useTailwindTheme.js.map +1 -0
  136. package/lib/icons.d.ts +2 -0
  137. package/lib/icons.d.ts.map +1 -1
  138. package/lib/icons.js +4 -2
  139. package/lib/icons.js.map +1 -1
  140. package/lib/index.d.ts +1 -0
  141. package/lib/index.d.ts.map +1 -1
  142. package/lib/index.js +1 -1
  143. package/lib/index.js.map +1 -1
  144. package/lib/machines/selectors.d.ts +118 -0
  145. package/lib/machines/selectors.d.ts.map +1 -0
  146. package/lib/machines/settingsMachine.d.ts +25 -2
  147. package/lib/machines/settingsMachine.d.ts.map +1 -1
  148. package/lib/machines/settingsMachine.js +174 -163
  149. package/lib/machines/settingsMachine.js.map +1 -1
  150. package/lib/machines/settingsMachine.test.d.ts +2 -0
  151. package/lib/machines/settingsMachine.test.d.ts.map +1 -0
  152. package/lib/machines/types.d.ts +106 -9
  153. package/lib/machines/types.d.ts.map +1 -1
  154. package/lib/machines/types.js.map +1 -1
  155. package/lib/module.js.map +1 -1
  156. package/lib/redux/searchReducer.js.map +1 -1
  157. package/lib/routes.json +9 -1
  158. package/lib/tailwindConfig.js.map +1 -1
  159. package/lib/utils/__tests__/configOverrides.test.d.ts +2 -0
  160. package/lib/utils/__tests__/configOverrides.test.d.ts.map +1 -0
  161. package/lib/utils/configOverrides.d.ts +213 -0
  162. package/lib/utils/configOverrides.d.ts.map +1 -0
  163. package/lib/utils/configOverrides.js +91 -0
  164. package/lib/utils/configOverrides.js.map +1 -0
  165. package/lib/utils/isBrowser/index.js.map +1 -1
  166. package/lib/utils/settingsUtils.d.ts +20 -0
  167. package/lib/utils/settingsUtils.d.ts.map +1 -0
  168. package/lib/utils/settingsUtils.js +74 -0
  169. package/lib/utils/settingsUtils.js.map +1 -0
  170. package/lib/utils/utils/index.js.map +1 -1
  171. package/package.json +6 -6
  172. package/lib/components/Layout/GlobalHeader/Logo.d.ts +0 -4
  173. package/lib/components/Layout/GlobalHeader/Logo.d.ts.map +0 -1
  174. package/lib/components/Layout/GlobalHeader/Logo.js +0 -141
  175. package/lib/components/Layout/GlobalHeader/Logo.js.map +0 -1
  176. package/lib/components/Layout/Sidebar/Sidebar.d.ts +0 -5
  177. package/lib/components/Layout/Sidebar/Sidebar.d.ts.map +0 -1
  178. package/lib/components/Layout/Sidebar/Sidebar.js.map +0 -1
  179. package/lib/components/Layout/Sidebar/SidebarMenu.d.ts +0 -4
  180. package/lib/components/Layout/Sidebar/SidebarMenu.d.ts.map +0 -1
  181. package/lib/components/Layout/Sidebar/SidebarMenu.js +0 -176
  182. package/lib/components/Layout/Sidebar/SidebarMenu.js.map +0 -1
@@ -0,0 +1,291 @@
1
+ import {jsx,jsxs}from'react/jsx-runtime';import {generateMenuPath}from'@admin-layout/client';import {useLocation,Link}from'@remix-run/react';import React__default,{useState,useCallback}from'react';import {icons}from'../../../icons.js';// Constants moved outside component
2
+ const SIDEBAR_WIDTHS = {
3
+ COLLAPSED: 64,
4
+ EXPANDED: 256
5
+ };
6
+ const POPUP_CONFIG = {
7
+ MAX_HEIGHT: 400,
8
+ MIN_WIDTH: 220};
9
+ // Pure function moved outside component
10
+ const getFirstLetter = name => name.charAt(0).toUpperCase();
11
+ // Utility for determining active menu item
12
+ const isMenuItemActive = (itemPath, currentPath, routeParams) => {
13
+ const menuPath = generateMenuPath(itemPath, routeParams);
14
+ // Exact match
15
+ if (currentPath === menuPath) {
16
+ return true;
17
+ }
18
+ // Check if current path is a child of the menu item path
19
+ if (menuPath && currentPath.startsWith(menuPath + '/')) {
20
+ return true;
21
+ }
22
+ return false;
23
+ };
24
+ // CSS keyframes definition moved outside component
25
+ const POPUP_ANIMATION_CSS = `
26
+ @keyframes fadeIn {
27
+ from { opacity: 0; transform: translateX(-10px); }
28
+ to { opacity: 1; transform: translateX(0); }
29
+ }
30
+ `;
31
+ const getTextColor = (active, navTheme) => {
32
+ if (active) return 'text-primary';
33
+ if (navTheme === 'realDark') return 'text-white';
34
+ return 'text-foreground';
35
+ };
36
+ const getIconColor = (active, navTheme) => {
37
+ if (active) return 'text-primary';
38
+ if (navTheme === 'realDark') return 'text-white';
39
+ return 'text-muted-foreground';
40
+ };
41
+ // Custom comparison function for React.memo
42
+ // Update the areMenuItemPropsEqual function to be more precise about location changes
43
+ const areMenuItemPropsEqual = (prevProps, nextProps) => {
44
+ // Always re-render if the item itself changed
45
+ if (prevProps.item !== nextProps.item) {
46
+ return false;
47
+ }
48
+ // Check only if active state changes instead of checking entire pathname
49
+ const prevIsActive = isMenuItemActive(prevProps.item.path, prevProps.locationPathname, prevProps.routeParams);
50
+ const nextIsActive = isMenuItemActive(nextProps.item.path, nextProps.locationPathname, nextProps.routeParams);
51
+ if (prevIsActive !== nextIsActive) {
52
+ return false;
53
+ }
54
+ // Rest of your existing checks...
55
+ if (prevProps.depth !== nextProps.depth || prevProps.isHoverMenu !== nextProps.isHoverMenu || prevProps.collapsed !== nextProps.collapsed || prevProps.navTheme !== nextProps.navTheme) {
56
+ return false;
57
+ }
58
+ // Check routeParams (shallow object comparison)
59
+ const prevRouteParamsKeys = Object.keys(prevProps.routeParams);
60
+ const nextRouteParamsKeys = Object.keys(nextProps.routeParams);
61
+ if (prevRouteParamsKeys.length !== nextRouteParamsKeys.length) {
62
+ return false;
63
+ }
64
+ for (const key of prevRouteParamsKeys) {
65
+ if (prevProps.routeParams[key] !== nextProps.routeParams[key]) {
66
+ return false;
67
+ }
68
+ }
69
+ // Check popupPosition
70
+ if (prevProps.popupPosition.top !== nextProps.popupPosition.top || prevProps.popupPosition.height !== nextProps.popupPosition.height) {
71
+ return false;
72
+ }
73
+ // Check if this specific item's open state changed
74
+ const prevIsOpen = prevProps.openMenus.includes(prevProps.item.path);
75
+ const nextIsOpen = nextProps.openMenus.includes(nextProps.item.path);
76
+ if (prevIsOpen !== nextIsOpen) {
77
+ return false;
78
+ }
79
+ // Check if this specific item's hover state changed
80
+ const prevIsHovered = prevProps.hoveredMenu === prevProps.item.path;
81
+ const nextIsHovered = nextProps.hoveredMenu === nextProps.item.path;
82
+ if (prevIsHovered !== nextIsHovered) {
83
+ return false;
84
+ }
85
+ // If none of the relevant props changed, don't re-render
86
+ return true;
87
+ };
88
+ const MenuItem = React__default.memo(({
89
+ item,
90
+ depth,
91
+ isHoverMenu,
92
+ openMenus,
93
+ hoveredMenu,
94
+ collapsed,
95
+ navTheme,
96
+ locationPathname,
97
+ routeParams,
98
+ popupPosition,
99
+ onToggleMenu,
100
+ onMenuHover,
101
+ onMenuLeave,
102
+ ChevronUpIcon,
103
+ ChevronDownIcon
104
+ }) => {
105
+ // Only log when actually rendering (not on every navigation)
106
+ const hasChildren = item.children && item.children.length > 0;
107
+ const isOpen = openMenus.includes(item.path);
108
+ const isActive = isMenuItemActive(item.path, locationPathname, routeParams);
109
+ const isHovered = hoveredMenu === item.path;
110
+ const menuItemPaddingLeft = `${depth * 1}rem`;
111
+ const subMenuItemPaddingLeft = `${depth * 2}rem`;
112
+ // Determine styling based on whether it's a parent or child item
113
+ const isParentWithChildren = hasChildren && depth === 0;
114
+ const shouldApplyBackground = isActive && !isParentWithChildren || isHovered;
115
+ const handleMenuClick = useCallback(e => {
116
+ if (hasChildren && !collapsed) {
117
+ onToggleMenu(item.path, depth, e);
118
+ }
119
+ }, [hasChildren, collapsed, item.path, depth, onToggleMenu]);
120
+ const renderPopupMenu = useCallback(() => {
121
+ if (!item.children || item.children.length === 0) return null;
122
+ return jsxs("div", {
123
+ className: "fixed shadow-themed-xl rounded-themed-lg border border-border z-[999] overflow-hidden themed-dropdown",
124
+ style: {
125
+ left: `${SIDEBAR_WIDTHS[collapsed ? 'COLLAPSED' : 'EXPANDED']}px`,
126
+ top: `${popupPosition.top}px`,
127
+ animation: 'fadeIn 0.2s ease-out forwards',
128
+ maxWidth: 'calc(100vw - 100px)',
129
+ width: 'max-content',
130
+ minWidth: POPUP_CONFIG.MIN_WIDTH
131
+ },
132
+ children: [jsx("style", {
133
+ dangerouslySetInnerHTML: {
134
+ __html: POPUP_ANIMATION_CSS
135
+ }
136
+ }), jsx("div", {
137
+ className: "font-medium text-sm px-4 py-3 border-b border-border whitespace-nowrap bg-muted",
138
+ children: jsx("span", {
139
+ className: "text-primary",
140
+ children: item.name
141
+ })
142
+ }), jsx("div", {
143
+ className: `max-h-[${POPUP_CONFIG.MAX_HEIGHT}px] overflow-y-auto overflow-x-hidden py-1`,
144
+ children: item.children.map(child => jsx(MenuItem, {
145
+ item: child,
146
+ depth: depth + 1,
147
+ isHoverMenu: true,
148
+ openMenus: openMenus,
149
+ hoveredMenu: hoveredMenu,
150
+ collapsed: collapsed,
151
+ navTheme: navTheme,
152
+ locationPathname: locationPathname,
153
+ routeParams: routeParams,
154
+ popupPosition: popupPosition,
155
+ onToggleMenu: onToggleMenu,
156
+ onMenuHover: onMenuHover,
157
+ onMenuLeave: onMenuLeave,
158
+ ChevronUpIcon: ChevronUpIcon,
159
+ ChevronDownIcon: ChevronDownIcon
160
+ }, child.path))
161
+ })]
162
+ });
163
+ }, [item, depth, collapsed, popupPosition.top, openMenus, hoveredMenu, navTheme, locationPathname, routeParams, onToggleMenu, onMenuHover, onMenuLeave, ChevronUpIcon, ChevronDownIcon]);
164
+ return jsxs("div", {
165
+ className: `w-full relative group ${isHovered && collapsed && !isHoverMenu ? 'rounded-themed' : ''} ${isHovered && !isHoverMenu ? 'bg-muted' : ''}`,
166
+ onMouseEnter: e => onMenuHover(e, item, isHoverMenu),
167
+ onMouseLeave: () => onMenuLeave(item, isHoverMenu),
168
+ children: [jsxs(Link, {
169
+ to: hasChildren && collapsed && !isHoverMenu ? '#' : generateMenuPath(item?.path, routeParams),
170
+ className: `flex items-center justify-between w-full px-1 py-2 hover:bg-muted text-sm cursor-pointer transition-colors rounded-themed mx-1 my-0.5 whitespace-nowrap overflow-hidden text-ellipsis ${shouldApplyBackground ? 'bg-muted' : ''}`,
171
+ style: {
172
+ paddingLeft: `calc(1rem + ${depth > 0 ? subMenuItemPaddingLeft : menuItemPaddingLeft})`
173
+ },
174
+ onClick: handleMenuClick,
175
+ children: [jsxs("div", {
176
+ className: `flex items-center ${collapsed && !isHoverMenu ? 'justify-center w-full' : 'gap-3'}`,
177
+ children: [item.icon ? jsx("span", {
178
+ className: `flex-shrink-0 ${getIconColor(isActive, navTheme)}`,
179
+ children: item.icon
180
+ }) : collapsed && !isHoverMenu ? jsx("span", {
181
+ className: `flex items-center justify-center flex-shrink-0 ${getIconColor(isActive, navTheme)}`,
182
+ children: getFirstLetter(item.name)
183
+ }) : null, (!collapsed || isHoverMenu) && jsx("span", {
184
+ className: `font-medium whitespace-nowrap overflow-hidden text-ellipsis ${getTextColor(isActive, navTheme)} ${depth > 0 ? `text-xs` : ''}`,
185
+ children: item.name
186
+ })]
187
+ }), hasChildren && (!collapsed || isHoverMenu) && jsx("span", {
188
+ className: `flex-shrink-0 ml-1 ${getIconColor(isActive, navTheme)}`,
189
+ children: isOpen ? jsx(ChevronUpIcon, {
190
+ className: "h-4 w-4"
191
+ }) : jsx(ChevronDownIcon, {
192
+ className: "h-4 w-4"
193
+ })
194
+ })]
195
+ }), collapsed && hasChildren && isHovered && !isHoverMenu && item.children.length > 0 && renderPopupMenu(), hasChildren && isOpen && !collapsed && jsx("div", {
196
+ className: "transition-all duration-200 ease-in-out",
197
+ children: item.children.map(child => jsx(MenuItem, {
198
+ item: child,
199
+ depth: depth + 1,
200
+ isHoverMenu: false,
201
+ openMenus: openMenus,
202
+ hoveredMenu: hoveredMenu,
203
+ collapsed: collapsed,
204
+ navTheme: navTheme,
205
+ locationPathname: locationPathname,
206
+ routeParams: routeParams,
207
+ popupPosition: popupPosition,
208
+ onToggleMenu: onToggleMenu,
209
+ onMenuHover: onMenuHover,
210
+ onMenuLeave: onMenuLeave,
211
+ ChevronUpIcon: ChevronUpIcon,
212
+ ChevronDownIcon: ChevronDownIcon
213
+ }, child.path))
214
+ })]
215
+ });
216
+ }, areMenuItemPropsEqual);
217
+ MenuItem.displayName = 'MenuItem';
218
+ const MainSidebarMenuComponent = ({
219
+ menuData,
220
+ routeParams,
221
+ settings,
222
+ collapsed
223
+ }) => {
224
+ const [openMenus, setOpenMenus] = useState([]);
225
+ const [hoveredMenu, setHoveredMenu] = useState(null);
226
+ const [popupPosition, setPopupPosition] = useState({
227
+ top: 0,
228
+ height: 0
229
+ });
230
+ const {
231
+ ChevronDownIcon,
232
+ ChevronUpIcon
233
+ } = icons;
234
+ const location = useLocation();
235
+ const navTheme = settings?.navTheme;
236
+ // Event handler for toggling menu open/closed
237
+ const toggleMenu = useCallback((path, depth, e) => {
238
+ e.preventDefault();
239
+ if (collapsed) return;
240
+ setOpenMenus(prev => {
241
+ if (prev.includes(path)) {
242
+ return prev.filter(item => item !== path);
243
+ } else {
244
+ return [...prev, path];
245
+ }
246
+ });
247
+ }, [collapsed]);
248
+ // Event handlers for hover effects
249
+ const handleMenuHover = useCallback((e, item, isHoverMenu) => {
250
+ // Only set hover state if the menu has children
251
+ if (collapsed && !isHoverMenu && item.children && item.children.length > 0) {
252
+ const element = e.currentTarget;
253
+ const rect = element.getBoundingClientRect();
254
+ setPopupPosition({
255
+ top: rect.top,
256
+ height: rect.height
257
+ });
258
+ setHoveredMenu(item.path);
259
+ }
260
+ }, [collapsed]);
261
+ const handleMenuLeave = useCallback((item, isHoverMenu) => {
262
+ if (collapsed && !isHoverMenu) {
263
+ setHoveredMenu(null);
264
+ }
265
+ }, [collapsed]);
266
+ return jsx("div", {
267
+ className: "overflow-hidden",
268
+ children: jsx("nav", {
269
+ className: `mt-2 ${collapsed ? 'px-1' : 'px-2'} overflow-x-hidden`,
270
+ children: menuData.map(item => jsx(MenuItem, {
271
+ item: item,
272
+ depth: 0,
273
+ isHoverMenu: false,
274
+ openMenus: openMenus,
275
+ hoveredMenu: hoveredMenu,
276
+ collapsed: collapsed,
277
+ navTheme: navTheme,
278
+ locationPathname: location.pathname,
279
+ routeParams: routeParams,
280
+ popupPosition: popupPosition,
281
+ onToggleMenu: toggleMenu,
282
+ onMenuHover: handleMenuHover,
283
+ onMenuLeave: handleMenuLeave,
284
+ ChevronUpIcon: ChevronUpIcon,
285
+ ChevronDownIcon: ChevronDownIcon
286
+ }, item.path))
287
+ })
288
+ });
289
+ };
290
+ // Export the memoized version to prevent unnecessary re-renders
291
+ const MainSidebarMenu = React__default.memo(MainSidebarMenuComponent);export{MainSidebarMenu};//# sourceMappingURL=MainSidebarMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MainSidebarMenu.js","sources":["../../../../src/components/Layout/Sidebar/MainSidebarMenu.tsx"],"sourcesContent":[null],"names":["React","_jsx","_jsxs"],"mappings":"2OAMA;AACA,MAAM,cAAc,GAAG;AACnB,EAAA,SAAA,EAAS,EAAE;AACX,EAAA,QAAA,EAAQ;CACF;AAEV,MAAM,YAAY,GAAG;AACjB,EAAA,UAAA,EAAU,GAAE;AACZ,EAAA,S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AA,CAAA;AACL,QACC,QAAA,EAAU,CACd,IAAC,CAAA,IAAA,GAAAD,GAAA,CAAA,MAAA,EAAA;UAEI,SAAA,EAAA,CAAA,cAAkB,EAAA,YACC,CAAA,QAAoB,EAAE,QAAE,CAAA,CAAA,CAAA;AACzC,UAAA,QAAI,EAAA,IAAS,CAAI;aACb,SAAA,IAAc,CAAC,WAAM,GAAAA,GAAA,CAAA,MAAA,EAAA;UACxB,SAAA,EAAA,CAAA,+CAAA,EAAA,YAAA,CAAA,QAAA,EAAA,QAAA,CAAA,CAAA,CAAA;AACL,UACC,QAAU,EACb,cAAA,CAAA,IAAA,CAAA,IAAA;SAEF,CAAA,oBACS,IAAA,mBAA2B,CAAA,MAAA,EAAA;AAyBxC,UAAE,SAAA,EAAA,CAAA,4DAAA,EAAA,YAAA,CAAA,QAAA,EAAA,QAAA,CAAA,CAAA,CAAA,EAAA,KAAA,GAAA,CAAA,GAAA,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,CAAA;AAEF,UAAA,QAAA,EAAA,IAAA,CAAA;AACA,SAAO,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { SidebarProps } from '../../typings';
3
+ export declare const PerplexSidebar: React.FC<SidebarProps>;
4
+ export default PerplexSidebar;
5
+ //# sourceMappingURL=PerplexSidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PerplexSidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Sidebar/PerplexSidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAQ7C,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAsTjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,277 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';import React__default,{useEffect}from'react';import {useTranslation}from'react-i18next';import {getMenuSeparation}from'@admin-layout/client';import {Divider}from'./Divider.js';import {PerplexSidebarMenu}from'./PerplexSidebarMenu.js';import'@react-icons/all-files/fa/FaMoon.js';import'@react-icons/all-files/fa/FaSun.js';import {useMediaQuery}from'../../../hooks/useMediaQuery.js';import'@common-stack/components-pro';import'reflect-metadata';import'@admin-layout/client/lib/constants/layout.js';import {SideMenuLogoSlot}from'../slot-fill/SideMenuLogo.js';import {BottomMenu}from'./BottomMenu.js';import {icons}from'../../../icons.js';import {MainSidebarMenu}from'./MainSidebarMenu.js';const PerplexSidebar = props => {
2
+ const {
3
+ isSideMenuOpen,
4
+ closeSideMenu,
5
+ menuData,
6
+ collapsed,
7
+ routeParams,
8
+ settings,
9
+ location,
10
+ siderPinned,
11
+ setSiderPinned,
12
+ layoutSettings,
13
+ deviceSettings,
14
+ actor,
15
+ sideBarMarginTop,
16
+ showHeader,
17
+ menuHeaderRender,
18
+ isSideMenuLayout,
19
+ authorities,
20
+ picture
21
+ } = props;
22
+ const [iconModule, setIconModule] = React__default.useState(null);
23
+ const {
24
+ t,
25
+ i18n
26
+ } = useTranslation('menu');
27
+ const {
28
+ isMobile
29
+ } = useMediaQuery();
30
+ const currentRoute = location?.pathname || '/';
31
+ const deviceType = isMobile ? 'mobile' : 'desktop';
32
+ const {
33
+ ChevronLeftIcon,
34
+ ChevronRightIcon
35
+ } = icons;
36
+ // Helper function to get value from settings with route/device override support
37
+ const getUILayoutValue = path => {
38
+ // Check for route/device-specific override first
39
+ const routeDeviceKey = `[${currentRoute}][${deviceType}]`;
40
+ const uiOverride = settings?.uiSettings?.[routeDeviceKey];
41
+ if (uiOverride) {
42
+ const value = path.split('.').reduce((obj, key) => obj?.[key], uiOverride);
43
+ if (value !== undefined) return value;
44
+ }
45
+ // Fallback to settings (flattened uilayout from configuration-registries)
46
+ return path.split('.').reduce((obj, key) => obj?.[key], settings);
47
+ };
48
+ // Get layout settings from the new flat structure
49
+ const deviceLayout = {
50
+ navigationMode: getUILayoutValue('navigationMode'),
51
+ sideMenuType: getUILayoutValue('sideMenuType'),
52
+ contentWidth: getUILayoutValue('contentWidth'),
53
+ fixedHeader: getUILayoutValue('fixedHeader'),
54
+ fixedSidebar: getUILayoutValue('fixedSidebar'),
55
+ splitMenus: getUILayoutValue('splitMenus'),
56
+ upperMenuDividerName: getUILayoutValue('upperMenuDividerName'),
57
+ middleMenuDividerName: getUILayoutValue('middleMenuDividerName'),
58
+ lowerMenuDividerName: getUILayoutValue('lowerMenuDividerName')
59
+ };
60
+ useEffect(() => {
61
+ if (!iconModule) {
62
+ import('./DynamicIcon.js').then(module => {
63
+ setIconModule(module);
64
+ });
65
+ }
66
+ }, []);
67
+ // Close sidebar when clicking outside on mobile
68
+ useEffect(() => {
69
+ const handleClickOutside = event => {
70
+ const sidebar = document.getElementById('mobile-sidebar');
71
+ if (sidebar && !sidebar.contains(event.target) && isSideMenuOpen) {
72
+ closeSideMenu();
73
+ }
74
+ };
75
+ document.addEventListener('mousedown', handleClickOutside);
76
+ return () => {
77
+ document.removeEventListener('mousedown', handleClickOutside);
78
+ };
79
+ }, [isSideMenuOpen, closeSideMenu]);
80
+ // Close sidebar when pressing escape
81
+ useEffect(() => {
82
+ const handleEscape = event => {
83
+ if (event.key === 'Escape' && isSideMenuOpen) {
84
+ closeSideMenu();
85
+ }
86
+ };
87
+ document.addEventListener('keydown', handleEscape);
88
+ return () => {
89
+ document.removeEventListener('keydown', handleEscape);
90
+ };
91
+ }, [isSideMenuOpen, closeSideMenu]);
92
+ const {
93
+ middleMenus,
94
+ lowerMenus,
95
+ bottomMenus
96
+ } = getMenuSeparation(menuData || []);
97
+ const updateMenuIcons = (menuItems = []) => {
98
+ if (!menuItems || !Array.isArray(menuItems)) return [];
99
+ return menuItems.map(item => {
100
+ const updatedItem = {
101
+ ...item,
102
+ name: t(item.name),
103
+ icon: iconModule && item.icon ? iconModule.renderDynamicIcon(item.icon) : null
104
+ };
105
+ if (updatedItem.children) {
106
+ updatedItem.children = updateMenuIcons(updatedItem.children);
107
+ }
108
+ return updatedItem;
109
+ });
110
+ };
111
+ ({
112
+ menuData: updateMenuIcons(bottomMenus)
113
+ });
114
+ // Use CSS classes instead of theme-based styling
115
+ const getSidebarClasses = () => {
116
+ let classes = `text-gray-500 dark:text-gray-400 h-full flex flex-col`;
117
+ if (settings?.navTheme === 'realDark') {
118
+ classes += ' themed-sidebar';
119
+ }
120
+ if (showHeader) {
121
+ classes += ' md:h-[82vh]';
122
+ }
123
+ if (!showHeader) {
124
+ classes += ' md:h-[84vh]';
125
+ }
126
+ if (!showHeader && !menuHeaderRender) {
127
+ classes += ' md:h-[91vh]';
128
+ }
129
+ return classes;
130
+ };
131
+ const SidebarStyles = React__default.useMemo(() => ({
132
+ backgroundColor: settings?.navTheme === 'realDark' ? '#222' : '',
133
+ color: settings?.navTheme === 'realDark' ? '#fff !important' : ''
134
+ }), [settings]);
135
+ // Helper function to render a separator with a name
136
+ const renderSeparator = name => {
137
+ if (!deviceLayout?.splitMenus) return null;
138
+ return collapsed ? jsx("hr", {
139
+ className: "border-t border-border"
140
+ }) : jsx(Divider, {
141
+ className: "text-muted-foreground border-border my-2 p-0",
142
+ plain: true,
143
+ children: name
144
+ });
145
+ };
146
+ const renderSidebarContent = () => {
147
+ return jsxs("div", {
148
+ className: getSidebarClasses(),
149
+ style: SidebarStyles,
150
+ children: [jsx("div", {
151
+ className: "relative"
152
+ }), jsxs("div", {
153
+ className: "flex-grow overflow-y-auto",
154
+ children: [middleMenus?.length > 0 && jsxs("div", {
155
+ className: "removeBoxShadow",
156
+ children: [renderSeparator(deviceLayout?.middleMenuDividerName), jsx(PerplexSidebarMenu, {
157
+ menuData: updateMenuIcons(middleMenus),
158
+ routeParams: routeParams,
159
+ settings: settings,
160
+ collapsed: collapsed,
161
+ siderPinned: siderPinned,
162
+ setSiderPinned: setSiderPinned,
163
+ actor: actor,
164
+ deviceSettings: deviceSettings
165
+ })]
166
+ }), lowerMenus?.length > 0 && jsxs("div", {
167
+ className: "removeBoxShadow",
168
+ children: [renderSeparator(deviceLayout?.lowerMenuDividerName), jsx(PerplexSidebarMenu, {
169
+ menuData: updateMenuIcons(lowerMenus),
170
+ routeParams: routeParams,
171
+ settings: settings,
172
+ collapsed: collapsed,
173
+ siderPinned: siderPinned,
174
+ setSiderPinned: setSiderPinned,
175
+ actor: actor,
176
+ deviceSettings: deviceSettings
177
+ })]
178
+ })]
179
+ })]
180
+ });
181
+ };
182
+ const renderMobileSidebarContent = () => {
183
+ return jsxs("div", {
184
+ className: getSidebarClasses(),
185
+ style: SidebarStyles,
186
+ children: [jsx("div", {
187
+ className: "relative",
188
+ children: jsx("button", {
189
+ onClick: closeSideMenu,
190
+ className: "w-6 h-6 text-center bg-card text-muted-foreground flex items-center justify-center rounded-full shadow-themed-sm hover:text-foreground hover:shadow-themed-md transition-colors text-[22px] absolute right-[-13px] top-[20px]",
191
+ "aria-label": collapsed ? 'Expand sidebar' : 'Collapse sidebar',
192
+ children: collapsed ? jsx(ChevronRightIcon, {
193
+ fontSize: '11px'
194
+ }) : jsx(ChevronLeftIcon, {
195
+ fontSize: '11px'
196
+ })
197
+ })
198
+ }), jsx("div", {
199
+ className: "flex-grow overflow-y-auto",
200
+ children: jsxs("div", {
201
+ children: [middleMenus?.length > 0 && jsxs("div", {
202
+ className: "removeBoxShadow",
203
+ children: [renderSeparator(deviceLayout?.middleMenuDividerName), jsx(MainSidebarMenu, {
204
+ menuData: updateMenuIcons(middleMenus),
205
+ routeParams: routeParams,
206
+ settings: settings,
207
+ collapsed: collapsed
208
+ })]
209
+ }), lowerMenus?.length > 0 && jsxs("div", {
210
+ className: "removeBoxShadow",
211
+ children: [renderSeparator(deviceLayout?.lowerMenuDividerName), jsx(MainSidebarMenu, {
212
+ menuData: updateMenuIcons(lowerMenus),
213
+ routeParams: routeParams,
214
+ settings: settings,
215
+ collapsed: collapsed
216
+ })]
217
+ })]
218
+ })
219
+ })]
220
+ });
221
+ };
222
+ return jsxs("div", {
223
+ children: [!isMobile && jsxs("aside", {
224
+ className: `${deviceLayout?.fixedSidebar ? 'fixed' : 'relative'} border-r border-border z-20 h-screen bg-card text-card-foreground md:block flex-shrink-0 transition-all duration-300 ease-in-out w-[92px]`,
225
+ children: [menuHeaderRender && isSideMenuLayout && jsx("div", {
226
+ className: "border-b border-border py-1 flex items-center justify-center",
227
+ children: jsx(SideMenuLogoSlot, {
228
+ settings: settings,
229
+ location: location
230
+ })
231
+ }), jsx("div", {
232
+ children: renderSidebarContent()
233
+ }), jsx("div", {
234
+ className: "flex-shrink-0 p-4 border-t border-border",
235
+ children: jsx(BottomMenu, {
236
+ match: null,
237
+ menuData: menuData,
238
+ settings: settings,
239
+ routeParams: routeParams,
240
+ getMenuSeparation: getMenuSeparation,
241
+ scrolled: undefined,
242
+ authorities: authorities,
243
+ picture: picture
244
+ })
245
+ })]
246
+ }), isSideMenuOpen && isMobile && jsx("div", {
247
+ className: "fixed mt-16 inset-0 z-40 bg-black bg-opacity-50 transition-opacity duration-300 ease-in-out",
248
+ onClick: closeSideMenu
249
+ }), jsx("aside", {
250
+ id: "mobile-sidebar",
251
+ className: `fixed mt-16 top-0 left-0 z-50 h-full w-[280px] bg-white dark:bg-gray-900 shadow-xl transform transition-transform duration-300 ease-in-out md:hidden ${isSideMenuOpen ? 'translate-x-0' : '-translate-x-full'}`,
252
+ children: jsxs("div", {
253
+ className: "flex flex-col h-[calc(100vh-64px)]",
254
+ children: [jsx("div", {
255
+ className: "flex-1 overflow-y-auto py-2 px-4",
256
+ children: jsx("div", {
257
+ className: "space-y-1",
258
+ children: renderMobileSidebarContent()
259
+ })
260
+ }), jsx("div", {
261
+ className: "flex-shrink-0 p-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800",
262
+ children: jsx(BottomMenu, {
263
+ match: null,
264
+ menuData: menuData,
265
+ settings: settings,
266
+ routeParams: routeParams,
267
+ getMenuSeparation: getMenuSeparation,
268
+ scrolled: undefined,
269
+ authorities: authorities,
270
+ picture: picture,
271
+ isMobile: isMobile
272
+ })
273
+ })]
274
+ })
275
+ })]
276
+ });
277
+ };export{PerplexSidebar,PerplexSidebar as default};//# sourceMappingURL=PerplexSidebar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PerplexSidebar.js","sources":["../../../../src/components/Layout/Sidebar/PerplexSidebar.tsx"],"sourcesContent":[null],"names":["React"],"mappings":"stBAcO,MAAM,cAAc,GAA2B,KAAC,IAAO;AAC1D,EAAA,MAAA;AAoBA,IAAA,cAAO;IACP,aAAW;AACX,IAAA,QAAQ;AACR,IAAA;IACA,WAAM;AACN,IAAA,QAAQ;IAER,QAAA;AACA,IAAA,WAAM;kBACF;AACA,IAAA;kBACM;SAEN;oBACU;cACN;AAAyB,IAAA,gBAAA;oBAC5B;eAED;;AAEJ,GAAA,GAAE,KAAA;QAEF,CAAA,UAAA,EAAA,aAAA,CAAA,GAAAA,cAAA,CAAA,QAAA,CAAA,IAAkD,CAAA;AAClD,EAAA,MAAA;AACI,IAAA,CAAA;AACA,IAAA;AACA,GAAA,GAAA,cAAY,CAAA,MAAE,CAAA;AACd,EAAA,MAAA;AACA,IAAA;AACA,GAAA,GAAA,aAAU,EAAE;AACZ,EAAA,MAAA,YAAA,GAAA,QAAsB,EAAA,QAAA,IAAA,GAAiB;AACvC,EAAA,MAAA,UAAA,GAAA,QAAqB,GAAE,QAAA,GAAA,SAAiB;AACxC,EAAA,MAAA;mBACF;IAEF;WACI;;wBAEQ,GAAA,IAAc,IAAA;AAClB;UACH,cAAA,GAAA,CAAA,CAAA,EAAA,YAAA,CAAA,EAAA,EAAA,UAAA,CAAA,CAAA,CAAA;IACL,MAAM,UAAC,GAAA,QAAA,EAAA,UAAA,GAAA,cAAA,CAAA;IAEP,IAAA,UAAA,EAAA;MACA,MAAA,KAAa,GAAE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AAA,EAAA,QAAA,KAAA,UAAA,EAAA;AAEF,MAAA,OAAA,qBAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SidebarMenuProps } from '../../typings';
3
+ export declare const PerplexSidebarMenu: React.FC<SidebarMenuProps>;
4
+ //# sourceMappingURL=PerplexSidebarMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PerplexSidebarMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Sidebar/PerplexSidebarMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAM3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAgazD,CAAC"}