@admin-layout/tailwind-design-pro 10.0.4-alpha.19
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/LICENSE +21 -0
- package/README.md +1 -0
- package/lib/cdm-locales/en/common.json +30 -0
- package/lib/cdm-locales/en/menu.json +115 -0
- package/lib/cdm-locales/en/pages.json +56 -0
- package/lib/cdm-locales/en/settings.json +19 -0
- package/lib/cdm-locales/es/common.json +30 -0
- package/lib/cdm-locales/es/menu.json +115 -0
- package/lib/cdm-locales/es/pages.json +56 -0
- package/lib/cdm-locales/es/settings.json +19 -0
- package/lib/components/LanguageMenu/LanguageMenu.d.ts +2 -0
- package/lib/components/LanguageMenu/LanguageMenu.d.ts.map +1 -0
- package/lib/components/LanguageMenu/LanguageMenu.js +95 -0
- package/lib/components/LanguageMenu/LanguageMenu.js.map +1 -0
- package/lib/components/LanguageMenu/index.d.ts +2 -0
- package/lib/components/LanguageMenu/index.d.ts.map +1 -0
- package/lib/components/Layout/BasicLayout/index.d.ts +19 -0
- package/lib/components/Layout/BasicLayout/index.d.ts.map +1 -0
- package/lib/components/Layout/BasicLayout/index.js +203 -0
- package/lib/components/Layout/BasicLayout/index.js.map +1 -0
- package/lib/components/Layout/BasicLayout/utils.d.ts +14 -0
- package/lib/components/Layout/BasicLayout/utils.d.ts.map +1 -0
- package/lib/components/Layout/BasicLayout/utils.js +130 -0
- package/lib/components/Layout/BasicLayout/utils.js.map +1 -0
- package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.d.ts +12 -0
- package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.d.ts.map +1 -0
- package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.js +72 -0
- package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.js.map +1 -0
- package/lib/components/Layout/GlobalFooter/Copyright.d.ts +5 -0
- package/lib/components/Layout/GlobalFooter/Copyright.d.ts.map +1 -0
- package/lib/components/Layout/GlobalFooter/Copyright.js +8 -0
- package/lib/components/Layout/GlobalFooter/Copyright.js.map +1 -0
- package/lib/components/Layout/GlobalFooter/Footer.d.ts +5 -0
- package/lib/components/Layout/GlobalFooter/Footer.d.ts.map +1 -0
- package/lib/components/Layout/GlobalFooter/Footer.js +22 -0
- package/lib/components/Layout/GlobalFooter/Footer.js.map +1 -0
- package/lib/components/Layout/GlobalHeader/Header.d.ts +18 -0
- package/lib/components/Layout/GlobalHeader/Header.d.ts.map +1 -0
- package/lib/components/Layout/GlobalHeader/Header.js +74 -0
- package/lib/components/Layout/GlobalHeader/Header.js.map +1 -0
- package/lib/components/Layout/GlobalHeader/OrganizationDropdown.d.ts +16 -0
- package/lib/components/Layout/GlobalHeader/OrganizationDropdown.d.ts.map +1 -0
- package/lib/components/Layout/GlobalHeader/OrganizationDropdown.js +73 -0
- package/lib/components/Layout/GlobalHeader/OrganizationDropdown.js.map +1 -0
- package/lib/components/Layout/GlobalHeader/RightContent.d.ts +18 -0
- package/lib/components/Layout/GlobalHeader/RightContent.d.ts.map +1 -0
- package/lib/components/Layout/GlobalHeader/styles.d.ts +2 -0
- package/lib/components/Layout/GlobalHeader/styles.d.ts.map +1 -0
- package/lib/components/Layout/ProTailwindLayout.d.ts +23 -0
- package/lib/components/Layout/ProTailwindLayout.d.ts.map +1 -0
- package/lib/components/Layout/ProTailwindLayout.js +95 -0
- package/lib/components/Layout/ProTailwindLayout.js.map +1 -0
- package/lib/components/Layout/Sidebar/Divider.d.ts +33 -0
- package/lib/components/Layout/Sidebar/Divider.d.ts.map +1 -0
- package/lib/components/Layout/Sidebar/Divider.js +47 -0
- package/lib/components/Layout/Sidebar/Divider.js.map +1 -0
- package/lib/components/Layout/Sidebar/Sidebar.d.ts +15 -0
- package/lib/components/Layout/Sidebar/Sidebar.d.ts.map +1 -0
- package/lib/components/Layout/Sidebar/Sidebar.js +139 -0
- package/lib/components/Layout/Sidebar/Sidebar.js.map +1 -0
- package/lib/components/Layout/Sidebar/SidebarMenu.d.ts +6 -0
- package/lib/components/Layout/Sidebar/SidebarMenu.d.ts.map +1 -0
- package/lib/components/Layout/Sidebar/SidebarMenu.js +89 -0
- package/lib/components/Layout/Sidebar/SidebarMenu.js.map +1 -0
- package/lib/components/Layout/TailwindLayout.d.ts +12 -0
- package/lib/components/Layout/TailwindLayout.d.ts.map +1 -0
- package/lib/components/Layout/TailwindLayout.js +42 -0
- package/lib/components/Layout/TailwindLayout.js.map +1 -0
- package/lib/components/Layout/getPageTitle.d.ts +26 -0
- package/lib/components/Layout/getPageTitle.d.ts.map +1 -0
- package/lib/components/Layout/getPageTitle.js +56 -0
- package/lib/components/Layout/getPageTitle.js.map +1 -0
- package/lib/components/Layout/slot-fill/Footer.d.ts +4 -0
- package/lib/components/Layout/slot-fill/Footer.d.ts.map +1 -0
- package/lib/components/Layout/slot-fill/Footer.js +7 -0
- package/lib/components/Layout/slot-fill/Footer.js.map +1 -0
- package/lib/components/Layout/slot-fill/HeaderNotice.d.ts +4 -0
- package/lib/components/Layout/slot-fill/HeaderNotice.d.ts.map +1 -0
- package/lib/components/Layout/slot-fill/index.d.ts +3 -0
- package/lib/components/Layout/slot-fill/index.d.ts.map +1 -0
- package/lib/components/Layout/util.d.ts +6 -0
- package/lib/components/Layout/util.d.ts.map +1 -0
- package/lib/components/SettingDrawer/CheckBoxTheme.d.ts +8 -0
- package/lib/components/SettingDrawer/CheckBoxTheme.d.ts.map +1 -0
- package/lib/components/SettingDrawer/CheckBoxTheme.js +48 -0
- package/lib/components/SettingDrawer/CheckBoxTheme.js.map +1 -0
- package/lib/components/SettingDrawer/LayoutChange.d.ts +7 -0
- package/lib/components/SettingDrawer/LayoutChange.d.ts.map +1 -0
- package/lib/components/SettingDrawer/LayoutChange.js +69 -0
- package/lib/components/SettingDrawer/LayoutChange.js.map +1 -0
- package/lib/components/SettingDrawer/RegionalSettings.d.ts +8 -0
- package/lib/components/SettingDrawer/RegionalSettings.d.ts.map +1 -0
- package/lib/components/SettingDrawer/RegionalSettings.js +95 -0
- package/lib/components/SettingDrawer/RegionalSettings.js.map +1 -0
- package/lib/components/SettingDrawer/SettingDrawer.d.ts +27 -0
- package/lib/components/SettingDrawer/SettingDrawer.d.ts.map +1 -0
- package/lib/components/SettingDrawer/SettingDrawer.js +392 -0
- package/lib/components/SettingDrawer/SettingDrawer.js.map +1 -0
- package/lib/components/SettingDrawer/Switch/index.d.ts +9 -0
- package/lib/components/SettingDrawer/Switch/index.d.ts.map +1 -0
- package/lib/components/SettingDrawer/Switch/index.js +39 -0
- package/lib/components/SettingDrawer/Switch/index.js.map +1 -0
- package/lib/components/SettingDrawer/ThemeColor.d.ts +8 -0
- package/lib/components/SettingDrawer/ThemeColor.d.ts.map +1 -0
- package/lib/components/SettingDrawer/ThemeColor.js +32 -0
- package/lib/components/SettingDrawer/ThemeColor.js.map +1 -0
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.d.ts +2 -0
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.d.ts.map +1 -0
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.js +1 -0
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.js.map +1 -0
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.d.ts +6 -0
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.d.ts.map +1 -0
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.js +4 -0
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.js.map +1 -0
- package/lib/components/defaultSettings.d.ts +4 -0
- package/lib/components/defaultSettings.d.ts.map +1 -0
- package/lib/components/defaultSettings.js +14 -0
- package/lib/components/defaultSettings.js.map +1 -0
- package/lib/components/typings.d.ts +73 -0
- package/lib/components/typings.d.ts.map +1 -0
- package/lib/compute.d.ts +4 -0
- package/lib/compute.d.ts.map +1 -0
- package/lib/compute.js +36 -0
- package/lib/compute.js.map +1 -0
- package/lib/config/env-config.d.ts +4 -0
- package/lib/config/env-config.d.ts.map +1 -0
- package/lib/config/env-config.js +7 -0
- package/lib/config/env-config.js.map +1 -0
- package/lib/helpers/DynamicIcon.d.ts +12 -0
- package/lib/helpers/DynamicIcon.d.ts.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/index.server.d.ts +2 -0
- package/lib/index.server.d.ts.map +1 -0
- package/lib/index.server.js +1 -0
- package/lib/index.server.js.map +1 -0
- package/lib/module.d.ts +6 -0
- package/lib/module.d.ts.map +1 -0
- package/lib/module.js +22 -0
- package/lib/module.js.map +1 -0
- package/lib/routes.json +41 -0
- package/lib/styles/index.css +51 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/isBrowser/index.d.ts +3 -0
- package/lib/utils/isBrowser/index.d.ts.map +1 -0
- package/lib/utils/isBrowser/index.js +7 -0
- package/lib/utils/isBrowser/index.js.map +1 -0
- package/lib/utils/menu.d.ts +4 -0
- package/lib/utils/menu.d.ts.map +1 -0
- package/lib/utils/test-utils.d.ts +12 -0
- package/lib/utils/test-utils.d.ts.map +1 -0
- package/lib/utils/utils/index.d.ts +14 -0
- package/lib/utils/utils/index.d.ts.map +1 -0
- package/lib/utils/utils/index.js +3 -0
- package/lib/utils/utils/index.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {useState,useRef,useEffect}from'react';import {Link}from'react-router-dom';import {useTranslation}from'react-i18next';import {generateMenuPath}from'@admin-layout/client';const OrganizationDropDown = props => {
|
|
2
|
+
const {
|
|
3
|
+
theme,
|
|
4
|
+
layout,
|
|
5
|
+
upperMenus,
|
|
6
|
+
routeParams,
|
|
7
|
+
collapsed,
|
|
8
|
+
settings
|
|
9
|
+
} = props;
|
|
10
|
+
const [isNotificationsMenuOpen, setIsNotificationsMenuOpen] = useState(false);
|
|
11
|
+
const [isProfileMenuOpen, setIsProfileMenuOpen] = useState(false);
|
|
12
|
+
const dropdownRef = useRef(null);
|
|
13
|
+
const {
|
|
14
|
+
t,
|
|
15
|
+
i18n
|
|
16
|
+
} = useTranslation('menu');
|
|
17
|
+
// Toggle profile menu
|
|
18
|
+
const toggleProfileMenu = () => {
|
|
19
|
+
setIsProfileMenuOpen(!isProfileMenuOpen);
|
|
20
|
+
setIsNotificationsMenuOpen(false);
|
|
21
|
+
};
|
|
22
|
+
// Handle click outside to close the dropdown
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const handleClickOutside = event => {
|
|
25
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
26
|
+
setIsProfileMenuOpen(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
30
|
+
return () => {
|
|
31
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
// Handle hover events
|
|
35
|
+
const handleMouseEnter = () => {
|
|
36
|
+
setIsProfileMenuOpen(true);
|
|
37
|
+
};
|
|
38
|
+
const handleMouseLeave = () => {
|
|
39
|
+
setIsProfileMenuOpen(false);
|
|
40
|
+
};
|
|
41
|
+
return jsxs("div", {
|
|
42
|
+
ref: dropdownRef,
|
|
43
|
+
className: "relative",
|
|
44
|
+
onMouseEnter: handleMouseEnter,
|
|
45
|
+
onMouseLeave: handleMouseLeave,
|
|
46
|
+
children: [jsxs("button", {
|
|
47
|
+
className: "align-middle rounded-full flex items-center focus:shadow-outline-purple focus:outline-none",
|
|
48
|
+
onClick: toggleProfileMenu,
|
|
49
|
+
"aria-label": "Account",
|
|
50
|
+
"aria-haspopup": "true",
|
|
51
|
+
children: [jsx("img", {
|
|
52
|
+
className: "object-cover w-8 h-8 rounded-full",
|
|
53
|
+
src: "https://e7.pngegg.com/pngimages/241/832/png-clipart-business-management-computer-software-apartment-organization-user-avatar-blue-angle.png",
|
|
54
|
+
alt: "",
|
|
55
|
+
"aria-hidden": "true"
|
|
56
|
+
}), jsx("span", {
|
|
57
|
+
className: "ml-2",
|
|
58
|
+
children: routeParams?.orgName
|
|
59
|
+
})]
|
|
60
|
+
}), isProfileMenuOpen && jsx("ul", {
|
|
61
|
+
className: "absolute right-0 w-56 p-2 space-y-2 text-gray-600 bg-white border border-gray-100 rounded-md shadow-md dark:border-gray-700 dark:text-gray-300 dark:bg-gray-700",
|
|
62
|
+
"aria-label": "submenu",
|
|
63
|
+
children: upperMenus && upperMenus[0]?.children?.map(menu => jsx("li", {
|
|
64
|
+
className: "flex",
|
|
65
|
+
children: jsx(Link, {
|
|
66
|
+
to: generateMenuPath(menu?.path, routeParams),
|
|
67
|
+
className: "w-full px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors duration-150",
|
|
68
|
+
children: t(menu?.name)
|
|
69
|
+
}, menu?.key || menu?.name)
|
|
70
|
+
}, menu?.key || menu?.name))
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
};export{OrganizationDropDown as default};//# sourceMappingURL=OrganizationDropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrganizationDropdown.js","sources":["../../../../src/components/Layout/GlobalHeader/OrganizationDropdown.tsx"],"sourcesContent":[null],"names":[],"mappings":"0NAkBA,MAAM,oBAAoB,GAAqC,KAAC,IAAS;AACrE,EAAA,MAAA;IACA,KAAM;IACN,MAAM;AACN,IAAA;IACA,WAAW;IAEX,SAAsB;IACtB;AACI,GAAA,GAAA,KAAA;QACA,CAA0B,uBAAA,EAAA,0BAAQ,CAAA,GAAA,QAAA,CAAA,KAAA,CAAA;AACtC,EAAA,MAAE,CAAA,iBAAA,EAAA,oBAAA,CAAA,GAAA,QAAA,CAAA,KAAA,CAAA;QAE2C,WAAA,GAAA,MAAA,CAAA,IAAA,CAAA;QACpC;AACL,IAAA,CAAA;AACI,IAAA;oBACwB,CAAA,MAAA,CAAA;;AAE5B,EAAA,MAAA,iBAAE,GAAA,MAAA;AAEF,IAAA,oBAAyB,CAAA,CAAA;AACzB,IAAA,0BAAY,CAAA,KAAA,CAAA;AACR,GAAA;AACJ;WACG,CAAA,MAAA;IAEP,MAAsB,kBAAA,GAAA,KAAA,IAAA;MAChB,IAAA,WAAA,CAAA,OAAmB,IAAK,CAAA,WAAA,CAAA,OAAA,CAAA,QAAA,CAAA,KAAA,CAAA,MAAA,CAAA,EAAA;QAC1B,oBAAoB,CAAC,KAAK,CAAC;AAC/B;KAEM;YACkB,CAAA,gBAAC,CAAK,WAAE,EAAA,kBAAA,CAAA;AAChC,IAAA,OAAE,MAAA;AAEF,MAAA,QACI,CAAA,+BAAuB,EAAA,kBAAoB,CAAC;AAsB5B,KAAA;AAexB,GAAE,EAAA,EAAA,CAAA;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ProSettings } from '@admin-layout/client';
|
|
3
|
+
export interface GlobalHeaderRightProps {
|
|
4
|
+
theme?: string;
|
|
5
|
+
layout?: any;
|
|
6
|
+
upperMenus: any;
|
|
7
|
+
routeParams: {
|
|
8
|
+
orgName?: string;
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
formatMessage?: any;
|
|
12
|
+
collapsed?: boolean;
|
|
13
|
+
settings?: ProSettings;
|
|
14
|
+
}
|
|
15
|
+
export declare const useHorizontalScroll: () => React.MutableRefObject<undefined>;
|
|
16
|
+
declare const GlobalHeaderRight: React.FC<GlobalHeaderRightProps>;
|
|
17
|
+
export default GlobalHeaderRight;
|
|
18
|
+
//# sourceMappingURL=RightContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RightContent.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/GlobalHeader/RightContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,MAAM,WAAW,sBAAsB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,EAAE,GAAG,CAAC;IAChB,WAAW,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACzB,CAAC;IACF,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC;CAC1B;AAED,eAAO,MAAM,mBAAmB,yCAsB/B,CAAC;AAEF,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAkEvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/GlobalHeader/styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,EAAE,GAuGxB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BasicLayoutProps } from '@admin-layout/client';
|
|
3
|
+
declare const ProTailwindLayout: React.FC<BasicLayoutProps & {
|
|
4
|
+
loaderData?: any;
|
|
5
|
+
}>;
|
|
6
|
+
export default ProTailwindLayout;
|
|
7
|
+
export declare const handle: {
|
|
8
|
+
i18n: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const loader: (params: any) => Promise<{
|
|
11
|
+
newMenuData: IMenuDataItem[];
|
|
12
|
+
apolloState: any;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function clientLoader({ request, params, serverLoader }: {
|
|
15
|
+
request: any;
|
|
16
|
+
params: any;
|
|
17
|
+
serverLoader: any;
|
|
18
|
+
}): Promise<any>;
|
|
19
|
+
export declare const shouldRevalidate: ({ currentParams, nextParams }: {
|
|
20
|
+
currentParams: any;
|
|
21
|
+
nextParams: any;
|
|
22
|
+
}) => boolean;
|
|
23
|
+
//# sourceMappingURL=ProTailwindLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProTailwindLayout.d.ts","sourceRoot":"","sources":["../../../src/components/Layout/ProTailwindLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAOH,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAY9B,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,GAAG;IAAE,UAAU,CAAC,EAAE,GAAG,CAAA;CAAE,CASxE,CAAC;AACF,eAAe,iBAAiB,CAAC;AAEjC,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,eAAO,MAAM,MAAM;;;EA2BlB,CAAC;AAEF,wBAAsB,YAAY,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE;;;;CAAA,gBAkBnE;AAED,eAAO,MAAM,gBAAgB;;;aAE5B,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import { filterRoutesWithLocale, transformData, addProLayoutParentKeys, removeUnnecessaryProperties, menuDataRender } from '@admin-layout/client';
|
|
4
|
+
import { matchParentRoute } from '@admin-layout/client/lib/utils/parentRoute.js';
|
|
5
|
+
import { ClientContainerService } from 'common';
|
|
6
|
+
import { ClientTypes } from '@common-stack/client-core';
|
|
7
|
+
import { createSelector } from 'reselect';
|
|
8
|
+
import BasicLayoutEnhanced from './TailwindLayout.js';
|
|
9
|
+
import { config } from '../../config/env-config.js';
|
|
10
|
+
const selectOrgName = state => state.platform.orgName;
|
|
11
|
+
const selector = createSelector([selectOrgName], orgName => ({
|
|
12
|
+
orgName
|
|
13
|
+
}));
|
|
14
|
+
const ProTailwindLayout = props => {
|
|
15
|
+
const {
|
|
16
|
+
loaderData: {
|
|
17
|
+
permissions,
|
|
18
|
+
newMenuData
|
|
19
|
+
}
|
|
20
|
+
} = props;
|
|
21
|
+
const {
|
|
22
|
+
orgName
|
|
23
|
+
} = useSelector(state => selector(state));
|
|
24
|
+
const params = {
|
|
25
|
+
orgName: orgName
|
|
26
|
+
};
|
|
27
|
+
return jsx(BasicLayoutEnhanced, {
|
|
28
|
+
routeParams: params,
|
|
29
|
+
permissions: permissions,
|
|
30
|
+
menuData: newMenuData
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const handle = {
|
|
34
|
+
i18n: 'menu'
|
|
35
|
+
};
|
|
36
|
+
const loader = async params => {
|
|
37
|
+
const {
|
|
38
|
+
routeConfig
|
|
39
|
+
} = params.context;
|
|
40
|
+
let parentRoute = {};
|
|
41
|
+
try {
|
|
42
|
+
parentRoute = matchParentRoute(routeConfig, config.LAYOUT_ROOT);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
console.log(e);
|
|
45
|
+
}
|
|
46
|
+
const routeWithLocale = filterRoutesWithLocale(parentRoute['routes']);
|
|
47
|
+
const routeWithChildren = transformData(routeWithLocale);
|
|
48
|
+
const menuDataWithParentKeys = addProLayoutParentKeys(routeWithChildren);
|
|
49
|
+
menuDataWithParentKeys.forEach(item => removeUnnecessaryProperties(item));
|
|
50
|
+
let permissions = params?._dataContext?.permissions;
|
|
51
|
+
let apolloState = params?._dataContext?.apolloState;
|
|
52
|
+
if (!permissions) {
|
|
53
|
+
throw new Error('Permissions not found');
|
|
54
|
+
}
|
|
55
|
+
if (!apolloState) {
|
|
56
|
+
throw new Error('ApolloState not found');
|
|
57
|
+
}
|
|
58
|
+
// TODO: Remove reolveConfiguration from permissions
|
|
59
|
+
const newMenuData = menuDataRender(menuDataWithParentKeys, permissions?.resolveConfiguration ?? permissions);
|
|
60
|
+
// returnInfo: {"returnType":"json","keys":["newMenuData","apolloState"],"hasOptions":false}
|
|
61
|
+
return {
|
|
62
|
+
data: [newMenuData, apolloState]
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
async function clientLoader({
|
|
66
|
+
request,
|
|
67
|
+
params,
|
|
68
|
+
serverLoader
|
|
69
|
+
}) {
|
|
70
|
+
// During client-side navigations, we hit our exposed API endpoints directly
|
|
71
|
+
const loaderData = await serverLoader();
|
|
72
|
+
const {
|
|
73
|
+
apolloState
|
|
74
|
+
} = loaderData;
|
|
75
|
+
try {
|
|
76
|
+
const {
|
|
77
|
+
container
|
|
78
|
+
} = window.__CLIENT_SERVICE__;
|
|
79
|
+
const apolloCache = container.get(ClientTypes.InMemoryCache);
|
|
80
|
+
apolloCache.restore(apolloState);
|
|
81
|
+
const organizationContext = container.get(ClientContainerService.IOrganizationContextService);
|
|
82
|
+
organizationContext.hydrate(apolloState);
|
|
83
|
+
} catch (e) {
|
|
84
|
+
console.error('Error in client hydrate');
|
|
85
|
+
console.error(e);
|
|
86
|
+
}
|
|
87
|
+
return loaderData;
|
|
88
|
+
}
|
|
89
|
+
const shouldRevalidate = ({
|
|
90
|
+
currentParams,
|
|
91
|
+
nextParams
|
|
92
|
+
}) => {
|
|
93
|
+
return currentParams.orgName !== nextParams.orgName;
|
|
94
|
+
};
|
|
95
|
+
export { clientLoader, ProTailwindLayout as default, handle, loader, shouldRevalidate }; //# sourceMappingURL=ProTailwindLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProTailwindLayout.js","sources":["../../../src/components/Layout/ProTailwindLayout.tsx"],"sourcesContent":[null],"names":["_jsx","TailwindLayout"],"mappings":"4gBAkBA,MAAM,aAAa,GAAG,KAAC,IAAO,KAAG,CAAA,QAAM,CAAA,OAAS;AAEhD,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,aAAa,CAAC,EAAE,YAAY;AAE7D,EAAA;;AAII,MAAA,iBAAoB,GAAA,KAAA,IAAW;AAG/B,EAAA,MAAA;AACA,IAAA,UAAQ,EAAA;AACZ,MAAE,WAAA;AACF,MAAA;AAEA;AACI,GAAA,GAAA,KAAY;EACd,MAAA;AAEF,IAAM;AACF,GAAA,GAAA,WAAmB,CAAA,KAAA,YAAY,OAAO,CAAC;QACnC,MAAA,GAAA;AACJ,IAAA,OAAK,EAAA;;SAEJA,GAAA,CAAAC,mBAAA,EAAA;IAAC,WAAgB,EAAA,MAAA;AACd,IAAA,WAAO,EAAC,WAAO;IACnB,QAAC,EAAA;IAED;AACA;AAEA,MAAA,MAAA,GAAA;AACA,EAAA,IAAA,EAAI;AACJ;AACgB,MAAA,MAAA,GAAE,MAAC,MAAA,IAAA;AACf,EAAA,MAAA;IACJ;MACI,MAAY,CAAA,OAAA;AACZ,EAAA,IAAA,WAAU,GAAA,EAAA;MACb;IACD,WAAoD,GAAA,gBAAA,CAAA,WAAA,EAAA,MAAA,CAAA,WAAA,CAAA;AACpD,GAAA,CAAA,OAAiB,CAAA,EAAA;IACjB,OAAO,CAAA,GAAA,CAAA,CAAA,CAAA;;QAEH,eAAW,GAAA,sBAAA,CAAA,WAAA,CAAA,QAAA,CAAA,CAAA;QACb,iBAAA,GAAA,aAAA,CAAA,eAAA,CAAA;AACN,EAAE,MAAA,sBAAA,GAAA,sBAAA,CAAA,iBAAA,CAAA;AAEF,EAAM,sBAA4B,CAAA,OAAA,CAAA,IAAG,IAAA,2BAA+B,CAAA,IAAA,CAAA,CAAA;MACY,WAAA,GAAA,MAAA,EAAA,YAAA,EAAA,WAAA;AAC5E,EAAA,IAAA,WAAgB,GAAA,MAAS,EAAA,YAAA,aAAe;AACxC,EAAA,IAAA,CAAA,WAAQ,EAAA;AAER,IAAA,MAAK,IAAA,KAAA,CAAA,uBAAA,CAAA;AACD;kBAEM,EAAA;AACN,IAAA,MAAA,IAAA,KAAW,CAAC,uBAAqB,CAAA;;AAGjC;QACH,WAAA,GAAA,cAAA,CAAA,sBAAA,EAAA,WAAA,EAAA,oBAAA,IAAA,WAAA,CAAA;SAAQ;AACL,IAAA,WAAO;AACP,IAAA;;AAEJ;AACH,eAAA,YAAA,CAAA;AAED,EAAM,OAAO;AACT,EAAA,MAAA;AACJ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DividerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Text to display in the middle of the divider
|
|
5
|
+
*/
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Direction of the divider
|
|
9
|
+
* @default "horizontal"
|
|
10
|
+
*/
|
|
11
|
+
orientation?: 'horizontal' | 'vertical';
|
|
12
|
+
/**
|
|
13
|
+
* Whether the divider text is less emphasized
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
plain?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Custom className for the divider
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Custom style for the divider
|
|
23
|
+
*/
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
/**
|
|
26
|
+
* Text alignment
|
|
27
|
+
* @default "center"
|
|
28
|
+
*/
|
|
29
|
+
align?: 'left' | 'right' | 'center';
|
|
30
|
+
}
|
|
31
|
+
export declare function Divider({ children, orientation, plain, className, style, align, ...props }: DividerProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Sidebar/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;CACvC;AAED,wBAAgB,OAAO,CAAC,EACpB,QAAQ,EACR,WAA0B,EAC1B,KAAa,EACb,SAAS,EACT,KAAK,EACL,KAAgB,EAChB,GAAG,KAAK,EACX,EAAE,YAAY,2CAgEd"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';import {cn}from'../../../utils/utils/index.js';function Divider({
|
|
2
|
+
children,
|
|
3
|
+
orientation = 'horizontal',
|
|
4
|
+
plain = false,
|
|
5
|
+
className,
|
|
6
|
+
style,
|
|
7
|
+
align = 'center',
|
|
8
|
+
...props
|
|
9
|
+
}) {
|
|
10
|
+
// If there's no children, render a simple divider
|
|
11
|
+
if (!children) {
|
|
12
|
+
return jsx("div", {
|
|
13
|
+
className: cn(orientation === 'horizontal' ? 'w-full border-t' : 'h-full border-l', 'border-gray-200 dark:border-gray-700', className),
|
|
14
|
+
style: style,
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
// With children, render a divider with text
|
|
19
|
+
return jsxs("div", {
|
|
20
|
+
className: cn('flex items-center w-full', orientation === 'vertical' && 'flex-col h-full', className),
|
|
21
|
+
style: style,
|
|
22
|
+
...props,
|
|
23
|
+
children: [jsx("div", {
|
|
24
|
+
className: cn('border-gray-200 dark:border-gray-700', orientation === 'horizontal' ? 'border-t flex-grow' : 'border-l h-full', {
|
|
25
|
+
'flex-[30%]': align === 'left' && orientation === 'horizontal',
|
|
26
|
+
'flex-[70%]': align === 'right' && orientation === 'horizontal'
|
|
27
|
+
}),
|
|
28
|
+
style: {
|
|
29
|
+
borderColor: style?.borderColor
|
|
30
|
+
}
|
|
31
|
+
}), jsx("div", {
|
|
32
|
+
className: cn('px-4', orientation === 'vertical' && 'py-4', plain ? 'text-gray-500 font-normal' : 'text-gray-900 font-medium', 'dark:text-gray-300'),
|
|
33
|
+
style: {
|
|
34
|
+
color: style?.color
|
|
35
|
+
},
|
|
36
|
+
children: children
|
|
37
|
+
}), jsx("div", {
|
|
38
|
+
className: cn('border-gray-200 dark:border-gray-700', orientation === 'horizontal' ? 'border-t flex-grow' : 'border-l h-full', {
|
|
39
|
+
'flex-[70%]': align === 'left' && orientation === 'horizontal',
|
|
40
|
+
'flex-[30%]': align === 'right' && orientation === 'horizontal'
|
|
41
|
+
}),
|
|
42
|
+
style: {
|
|
43
|
+
borderColor: style?.borderColor
|
|
44
|
+
}
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
}export{Divider};//# sourceMappingURL=Divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.js","sources":["../../../../src/components/Layout/Sidebar/Divider.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"wFAiCM,SAAU,OAAO,CAAC;UAS8B;aACrC,GAAA,YAAG;AACZ,EAAA,KAAA,GAAA,KAAO;WAWV;OAE2C;AAC5C,EAAA,KAAA,GAAA,QAEQ;AASY,EAAA,GAAA;AACA,CAAA,EAAA;;;AAKP,IAAA,OAAAA,GAAA,CAAA,KAEL,EAAA;oBAQQ,WAAY,KAAO,YAAA,GAAA,iBAAA,GAAA,iBAAA,EAAA,sCAAA,EAAA,SAAA,CAAA;kBAGtB;AAOO,MAAA,GAAA;AACA,KAAA,CAAA;;;mBAMV,EAAA;AAGd,IAAC,SAAA,EAAA,EAAA,CAAA,0BAAA,EAAA,WAAA,KAAA,UAAA,IAAA,iBAAA,EAAA,SAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SidebarProps {
|
|
3
|
+
isSideMenuOpen: boolean;
|
|
4
|
+
closeSideMenu: () => void;
|
|
5
|
+
menuData: any;
|
|
6
|
+
collapsed: boolean;
|
|
7
|
+
routeParams: {
|
|
8
|
+
orgName?: string;
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
settings?: any;
|
|
12
|
+
}
|
|
13
|
+
export declare const Sidebar: React.FC<SidebarProps>;
|
|
14
|
+
export default Sidebar;
|
|
15
|
+
//# sourceMappingURL=Sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Sidebar/Sidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,UAAU,YAAY;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACzB,CAAC;IACF,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAqJ1C,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import React__default,{useState,useEffect}from'react';import {Link}from'@remix-run/react';import {useTranslation}from'react-i18next';import {AiOutlineDash}from'@react-icons/all-files/ai/AiOutlineDash.js';import {useTheme}from'../BasicLayout/index.js';import BottomMenuDropDown from'../GlobalFooter/BottomMenuDropdown.js';import {getMenuSeparation}from'@admin-layout/client';import {Divider}from'./Divider.js';import {SidebarMenu}from'./SidebarMenu.js';const Sidebar = props => {
|
|
2
|
+
const {
|
|
3
|
+
isSideMenuOpen,
|
|
4
|
+
closeSideMenu,
|
|
5
|
+
menuData,
|
|
6
|
+
collapsed,
|
|
7
|
+
routeParams,
|
|
8
|
+
settings
|
|
9
|
+
} = props;
|
|
10
|
+
useState(false);
|
|
11
|
+
const [iconModule, setIconModule] = React__default.useState(null);
|
|
12
|
+
useTheme();
|
|
13
|
+
const {
|
|
14
|
+
t,
|
|
15
|
+
i18n
|
|
16
|
+
} = useTranslation('menu');
|
|
17
|
+
// Close sidebar when clicking outside on mobile
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const handleClickOutside = event => {
|
|
20
|
+
const sidebar = document.getElementById('mobile-sidebar');
|
|
21
|
+
if (sidebar && !sidebar.contains(event.target) && isSideMenuOpen) {
|
|
22
|
+
closeSideMenu();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
26
|
+
return () => {
|
|
27
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
28
|
+
};
|
|
29
|
+
}, [isSideMenuOpen, closeSideMenu]);
|
|
30
|
+
// Close sidebar when pressing escape
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const handleEscape = event => {
|
|
33
|
+
if (event.key === 'Escape' && isSideMenuOpen) {
|
|
34
|
+
closeSideMenu();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
document.addEventListener('keydown', handleEscape);
|
|
38
|
+
return () => {
|
|
39
|
+
document.removeEventListener('keydown', handleEscape);
|
|
40
|
+
};
|
|
41
|
+
}, [isSideMenuOpen, closeSideMenu]);
|
|
42
|
+
const bottomMenu = getMenuSeparation(menuData).bottomMenus;
|
|
43
|
+
const updateMenuIcons = menuItems => {
|
|
44
|
+
return menuItems.map(item => {
|
|
45
|
+
const updatedItem = {
|
|
46
|
+
...item,
|
|
47
|
+
name: t(item.name),
|
|
48
|
+
icon: iconModule && item.icon ? iconModule.renderDynamicIcon(item.icon) : null
|
|
49
|
+
};
|
|
50
|
+
if (updatedItem.children) {
|
|
51
|
+
updatedItem.children = updateMenuIcons(updatedItem.children);
|
|
52
|
+
}
|
|
53
|
+
return updatedItem;
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const bottomMenus = {
|
|
57
|
+
menuData: updateMenuIcons(bottomMenu)
|
|
58
|
+
};
|
|
59
|
+
const middleMenu = getMenuSeparation(menuData).middleMenus;
|
|
60
|
+
const lowerMenus = getMenuSeparation(menuData).lowerMenus;
|
|
61
|
+
const renderSidebarContent = () => jsxs("div", {
|
|
62
|
+
className: "py-4 text-gray-500 dark:text-gray-400",
|
|
63
|
+
children: [jsxs(Link, {
|
|
64
|
+
to: "/",
|
|
65
|
+
className: "ml-6 flex items-center gap-2.5 text-lg font-bold text-gray-800 dark:text-gray-200",
|
|
66
|
+
children: [jsx("img", {
|
|
67
|
+
src: settings?.logo,
|
|
68
|
+
className: "w-[28px]"
|
|
69
|
+
}), "Cdebase"]
|
|
70
|
+
}), jsxs("div", {
|
|
71
|
+
children: [jsxs("div", {
|
|
72
|
+
style: {
|
|
73
|
+
flex: 1,
|
|
74
|
+
overflowY: 'auto',
|
|
75
|
+
overflowX: 'hidden',
|
|
76
|
+
display: 'flex',
|
|
77
|
+
flexDirection: 'column'
|
|
78
|
+
},
|
|
79
|
+
className: "removeBoxShadow",
|
|
80
|
+
children: [jsx(SidebarMenu, {
|
|
81
|
+
menuData: updateMenuIcons(middleMenu),
|
|
82
|
+
routeParams: routeParams,
|
|
83
|
+
settings: settings
|
|
84
|
+
}), collapsed && true ? jsx(AiOutlineDash, {
|
|
85
|
+
className: "ant-divider",
|
|
86
|
+
style: {
|
|
87
|
+
marginLeft: '17px',
|
|
88
|
+
borderTop: '0px',
|
|
89
|
+
fontSize: 'large',
|
|
90
|
+
margin: 0
|
|
91
|
+
}
|
|
92
|
+
}) : jsx(Divider, {
|
|
93
|
+
style: {
|
|
94
|
+
color: '#6b6767',
|
|
95
|
+
borderColor: '#6b6767',
|
|
96
|
+
margin: 0,
|
|
97
|
+
padding: 0
|
|
98
|
+
},
|
|
99
|
+
plain: true,
|
|
100
|
+
children: "Admin"
|
|
101
|
+
})]
|
|
102
|
+
}), jsx("div", {
|
|
103
|
+
style: {
|
|
104
|
+
flex: 1,
|
|
105
|
+
overflowY: 'auto',
|
|
106
|
+
overflowX: 'hidden',
|
|
107
|
+
display: 'flex',
|
|
108
|
+
flexDirection: 'column'
|
|
109
|
+
},
|
|
110
|
+
className: "removeBoxShadow",
|
|
111
|
+
children: jsx(SidebarMenu, {
|
|
112
|
+
menuData: updateMenuIcons(lowerMenus),
|
|
113
|
+
routeParams: routeParams,
|
|
114
|
+
settings: settings
|
|
115
|
+
})
|
|
116
|
+
})]
|
|
117
|
+
}), jsx("div", {
|
|
118
|
+
className: "absolute bottom-0 left-0 p-4 dark:border-gray-700",
|
|
119
|
+
children: jsx(BottomMenuDropDown, {
|
|
120
|
+
menus: bottomMenus,
|
|
121
|
+
collapsed: collapsed,
|
|
122
|
+
routeParams: routeParams
|
|
123
|
+
})
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
126
|
+
return jsxs("div", {
|
|
127
|
+
children: [jsx("aside", {
|
|
128
|
+
className: "z-20 hidden h-full w-64 overflow-y-auto bg-white dark:bg-gray-800 md:block flex-shrink-0",
|
|
129
|
+
children: renderSidebarContent()
|
|
130
|
+
}), isSideMenuOpen && jsx("div", {
|
|
131
|
+
className: "fixed inset-0 z-10 flex items-end bg-black bg-opacity-50 sm:items-center sm:justify-center",
|
|
132
|
+
onClick: closeSideMenu
|
|
133
|
+
}), isSideMenuOpen && jsx("aside", {
|
|
134
|
+
id: "mobile-sidebar",
|
|
135
|
+
className: "fixed inset-y-0 z-20 flex-shrink-0 w-64 mt-16 overflow-y-auto bg-white dark:bg-gray-800 md:hidden",
|
|
136
|
+
children: renderSidebarContent()
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
};export{Sidebar,Sidebar as default};//# sourceMappingURL=Sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.js","sources":["../../../../src/components/Layout/Sidebar/Sidebar.tsx"],"sourcesContent":[null],"names":["React","_jsxs","_jsx"],"mappings":"6eAwBa,MAAA,OAAO,GAA2B,KAAC,IAAS;AACrD,EAAA,MAAA;IACA,cAAsB;AAEtB,IAAA,aAAO;AACP,IAAA,QAAQ;IACR,SAAS;IAET,WAAM;AACF,IAAA;AACJ,GAAA,GAAE,KAAA;EAE8C,QAAA,CAAA,KAAA;QACvC,CAAA,UAAM,EAAA,aAAA,CAAA,GAAAA,cAAA,CAAA,QAAA,CAAA,IAAA,CAAA;AACX,EAEI,QAAA;AACI,EAAA,MAAA;;AAER,IAAA;AAEA,GAAA,GAAA,cAAyB,CAAA,MAAA,CAAA;AAI7B;WAEqC,CAAA,MAAA;IACrC,MAAS,kBAAM,GAAA,KAAA,IAAA;AACX,MAAA,MAAA,OAAkB,GAAA,QAAI,CAAA,cAAwB,CAAA,gBAAA,CAAA;iBACtC,IAAK,CAAC,OAAG,CAAK,QAAQ,CAAI,KAAA,CAAA,MAAA,CAAA,IAAc,cAAG,EAAA;AAC3C,QAAA,aAAA,EAAA;;AAER,KAAA;AAEA,IAAA,QAAA,CAAA,gBAAyB,CAAA,aAAU,kBAAgB,CAAA;AACnD,IAAA,OAAA;AACI,MAAA,QAAA,CAAA,mBAA4B,CAAA,+BAA0B,CAAA;AAC1D,KAAA;AACJ,GAAA,EAAC,eAAG,EAAc,aAAe,CAAA,CAAA;;AAGjC,EAAA,SAAqB,CAAA,MAAA;AACjB,IAAA,MAAA,eAAiB,KAAK,IAAI;AACtB,MAAA,IAAA,KAAA,CAAA,gBAAoB,IAAA,cAAA,EAAA;AAChB,QAAA,aAAO,EAAA;AACP;;aAEH,gBAAC,CAAA,SAAA,EAAA,YAAA,CAAA;AACF,IAAA,OAAA,MAAe;4CACY,EAAA,YAA2B,CAAA;;AAGtD,GAAA,EAAA,CAAA,6BAAmB,CAAA,CAAA;AACvB,EAAA,MAAA,UAAG,GAAA,iBAAA,CAAA,QAAA,CAAA,CAAA,WAAA;AACP,EAAA,MAAE,eAAA,GAAA,SAAA,IAAA;IACF,OAAM,SAAA,CAAW,GAAG,CAAA,IAAU,IAAA;MAExB,MAAA,WAAa,GAAiB;QAC9B,GAAA,IAAA;AAEN,QAAA;AASoB,QAAA,IAAA,EAAA,UAAA,IAAA,IAAI,KAAG,GAAA,UAAA,CAAA,iBAAA,CAAA,IAAA,CAAA,IAAA,CAAA,GAAA;AACP,OAAA;AACA,MAAA,IAAA,WAAA,CAAA,QAAA,EAAA;AACA,QAAA,WAAA,CAAA,QAAA,GAAA,eAAe,CAAA,WAAA,CAAA,QAAA,CAAA;AACf;AACH,MAAA,OAAA,WAAA;AAQW,KAAA,CAAA;AACA,GAAA;AACA,EAAA,MAAA,WAAA,GAAA;AACA,IAAA,QAAA,EAAA,eAAA,CAAA,UAAA;;AAMA,EAAA,MAAA,UAAA,GAAA,iBAAA,CAAA,QAAgB,CAAA,CAAA,WAAA;AAChB,EAAA,MAAA,UAAA,GAAA,iBAAA,CAAA,QAAW,EAAE,UAAS;AACtB,EAAA,MAAA,oBAAA,GAAA,MAAAC,IAAM,MAAG,EAAA;AACT,IAAA,SAAA,EAAA,uCAAU;AACb,IAAA,QAAA,EAAA,CAAAA,IAAA,CAAA,IAAA,EAAA;AASL,MAAA,EAAA,EAAA,GAAA;AACA,MAAA,SAAA,EAAA,mFAAiB;AACjB,MAAA,QAAA,EAAA,CAAAC,GAAA,CAAA,KAAA,EAAA;AACA,QAAA,GAAA,EAAA,QAAA,EAAA,IAAA;AACA,QAAA,SAAA,EAAA;;AAcpB,KAAA,CAAA,EAAAD,IAGQ,CAAA,KAAA,EAAA;AAuBZ,MAAE,QAAA,EAAA,CAAAA,IAAA,CAAA,KAAA,EAAA;AAEF,QAAA,KAAA,EAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Sidebar/SidebarMenu.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW;;;;6CAgFvB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';import {useState}from'react';import {ChevronDown,ChevronRight}from'lucide-react';import {Link}from'@remix-run/react';import {generateMenuPath}from'@admin-layout/client';import {generateLightShade}from'../BasicLayout/utils.js';const SidebarMenu = ({
|
|
2
|
+
menuData,
|
|
3
|
+
routeParams,
|
|
4
|
+
settings
|
|
5
|
+
}) => {
|
|
6
|
+
// Track open menus by their depth level
|
|
7
|
+
const [openMenusByLevel, setOpenMenusByLevel] = useState({});
|
|
8
|
+
// Track the currently active menu item
|
|
9
|
+
const [activePath, setActivePath] = useState('/dashboard');
|
|
10
|
+
const toggleMenu = (path, depth, e) => {
|
|
11
|
+
// Prevent link navigation when clicking on a parent menu with children
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
setOpenMenusByLevel(prev => {
|
|
14
|
+
const newState = {
|
|
15
|
+
...prev
|
|
16
|
+
};
|
|
17
|
+
// If this menu is already open, close it
|
|
18
|
+
if (newState[depth] === path) {
|
|
19
|
+
newState[depth] = null;
|
|
20
|
+
}
|
|
21
|
+
// Otherwise, close any other menu at this depth level and open this one
|
|
22
|
+
else {
|
|
23
|
+
newState[depth] = path;
|
|
24
|
+
}
|
|
25
|
+
return newState;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const handleMenuClick = (path, hasChildren, depth, e) => {
|
|
29
|
+
if (hasChildren) {
|
|
30
|
+
toggleMenu(path, depth, e);
|
|
31
|
+
} else {
|
|
32
|
+
// For leaf items, set as active and allow navigation
|
|
33
|
+
setActivePath(path);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const renderMenuItem = (item, depth = 0) => {
|
|
37
|
+
const hasChildren = item.children && item.children.length > 0;
|
|
38
|
+
const isOpen = openMenusByLevel[depth] === item.path;
|
|
39
|
+
const isActive = activePath === item.path;
|
|
40
|
+
const paddingLeft = `${depth * 1}rem`;
|
|
41
|
+
// Determine the background color based on state
|
|
42
|
+
let bgColor = generateLightShade(settings?.primaryColor, 0.89);
|
|
43
|
+
return jsxs("div", {
|
|
44
|
+
className: "w-full",
|
|
45
|
+
children: [jsxs(Link, {
|
|
46
|
+
to: generateMenuPath(item?.path, routeParams),
|
|
47
|
+
className: `flex items-center justify-between w-full px-4 py-2 hover:bg-gray-100 text-sm cursor-pointer transition-colors rounded-md mx-1 my-0.5`,
|
|
48
|
+
style: {
|
|
49
|
+
paddingLeft: `calc(1rem + ${paddingLeft})`,
|
|
50
|
+
backgroundColor: isActive ? bgColor : ''
|
|
51
|
+
},
|
|
52
|
+
onClick: e => handleMenuClick(item.path, hasChildren, depth, e),
|
|
53
|
+
children: [jsxs("div", {
|
|
54
|
+
className: "flex items-center gap-3",
|
|
55
|
+
children: [item.icon && jsx("span", {
|
|
56
|
+
style: {
|
|
57
|
+
color: isActive ? settings?.primaryColor : ''
|
|
58
|
+
},
|
|
59
|
+
children: item.icon
|
|
60
|
+
}), jsx("span", {
|
|
61
|
+
className: `font-medium`,
|
|
62
|
+
style: {
|
|
63
|
+
color: isActive ? settings?.primaryColor : ''
|
|
64
|
+
},
|
|
65
|
+
children: item.name
|
|
66
|
+
})]
|
|
67
|
+
}), hasChildren && jsx("span", {
|
|
68
|
+
style: {
|
|
69
|
+
color: isActive ? settings?.primaryColor : ''
|
|
70
|
+
},
|
|
71
|
+
children: isOpen ? jsx(ChevronDown, {
|
|
72
|
+
className: "h-4 w-4"
|
|
73
|
+
}) : jsx(ChevronRight, {
|
|
74
|
+
className: "h-4 w-4"
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
77
|
+
}), hasChildren && isOpen && jsx("div", {
|
|
78
|
+
className: "transition-all duration-200 ease-in-out",
|
|
79
|
+
children: item.children.map(child => renderMenuItem(child, depth + 1))
|
|
80
|
+
})]
|
|
81
|
+
}, item.path);
|
|
82
|
+
};
|
|
83
|
+
return jsx("div", {
|
|
84
|
+
children: jsx("nav", {
|
|
85
|
+
className: "mt-2 px-2",
|
|
86
|
+
children: menuData.map(item => renderMenuItem(item))
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
};export{SidebarMenu};//# sourceMappingURL=SidebarMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarMenu.js","sources":["../../../../src/components/Layout/Sidebar/SidebarMenu.tsx"],"sourcesContent":[null],"names":[],"mappings":"2QAOO,MAAM,WAAW,GAAG,CAAC;UACgB;aACjB;;MAEjB;;QAGF,CAAuE,gBAAA,EAAA,mBAAA,CAAA,GAAA,QAAA,CAAA,EAAA,CAAA;;AAGvE,EAAA,MAAA,CAAA,UAAA,EAAA,aAAyB,CAAE,GAAE,QAAA,CAAA,YAAA,CAAA;AACzB,EAAA,MAAA,UAAM,QAAQ,EAAG,KAAK,EAAA,CAAA,KAAO;;AAG7B,IAAA,CAAA,CAAA;AACI,IAAA,mBAAA,CAAQ,IAAC,IAAM;YACnB,QAAC,GAAA;;;AAGG;kBACH,CAAA,KAAA,CAAA,KAAA,IAAA,EAAA;AAED,QAAA,QAAA,CAAA,aAAgB;AACpB;AACJ;WAEM;QACF,QAAI,CAAA,KAAA,CAAW,GAAG,IAAA;AACd;aACH,QAAA;;;uBAEgB,GAAC,CAAI,IAAC,EAAC,WAAA,EAAA,KAAA,EAAA,CAAA,KAAA;QACxB,WAAC,EAAA;AACL,MAAE,UAAA,CAAA,IAAA,EAAA,KAAA,EAAA,CAAA,CAAA;KAEI,MAAA;AACF;mBACM,CAAM,IAAG,CAAA;AACf;AACA,GAAA;QAEA,cAAgD,GAAA,CAAA,IAAA,EAAA,KAAA,GAAA,CAAA,KAAA;UAC5C,WAAU,GAAA,IAAA,CAAA,QAAA,IAAmB,IAAA,CAAA,QAAsB,CAAA,MAAA,GAAA,CAAE;UAElD,MACH,mBAA8B,CAAA,KAAA,CAAC,SAC3B,CAAA,IAAA;AA2BZ,IAAA,MAAE,QAAA,GAAA,UAAA,KAAA,IAAA,CAAA,IAAA;IAEF,MAAO,WAEC,GAAA,CAAA,EAAA,KAAA,GAAA,CAAA,CAAA,GAAA,CAAA;AAGZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BasicLayoutProps } from '@admin-layout/client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ConnectedComponent, ConnectedProps } from 'react-redux';
|
|
4
|
+
type PropsFromRedux = ConnectedProps<typeof connector>;
|
|
5
|
+
declare const connector: import("react-redux").InferableComponentEnhancerWithProps<{
|
|
6
|
+
settings: any;
|
|
7
|
+
location: any;
|
|
8
|
+
} & import("react-redux").DispatchProp<import("redux").UnknownAction>, {}>;
|
|
9
|
+
type BasicLayoutWithAuthoritiesProps = BasicLayoutProps & PropsFromRedux;
|
|
10
|
+
declare const BasicLayoutEnhanced: ConnectedComponent<React.MemoExoticComponent<(props: BasicLayoutWithAuthoritiesProps) => JSX.Element>, any>;
|
|
11
|
+
export default BasicLayoutEnhanced;
|
|
12
|
+
//# sourceMappingURL=TailwindLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TailwindLayout.d.ts","sourceRoot":"","sources":["../../../src/components/Layout/TailwindLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAqC,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAqC,MAAM,aAAa,CAAC;AA0CpG,KAAK,cAAc,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAC;AAEvD,QAAA,MAAM,SAAS;;;0EAAoB,CAAC;AAEpC,KAAK,+BAA+B,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAEzE,QAAA,MAAM,mBAAmB,EAAE,kBAAkB,CACzC,KAAK,CAAC,mBAAmB,CAAC,CAAC,KAAK,EAAE,+BAA+B,KAAK,GAAG,CAAC,OAAO,CAAC,EAClF,GAAG,CAC8C,CAAC;AAEtD,eAAe,mBAAmB,CAAC"}
|