@chayns-components/navigation 5.0.65 → 5.1.0
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/lib/cjs/components/navigation-layout/NavigationLayout.constants.js +14 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.constants.js.map +1 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.context.js +26 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.context.js.map +1 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.js +105 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.js.map +1 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.styles.js +74 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.styles.js.map +1 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.types.js +6 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.types.js.map +1 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.utils.js +261 -0
- package/lib/cjs/components/navigation-layout/NavigationLayout.utils.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.js +31 -0
- package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.styles.js +30 -0
- package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.styles.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.types.js +6 -0
- package/lib/cjs/components/navigation-layout/navigation-header/NavigationHeader.types.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.js +71 -0
- package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js +19 -0
- package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js +26 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.js +140 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.js +89 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.js +6 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.js +83 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.js +17 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.js +19 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.js +26 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.js +129 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.js +79 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.js +69 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.js +265 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.js +193 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.js +132 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.js.map +1 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.js +78 -0
- package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.js.map +1 -0
- package/lib/cjs/components/split-layout/SplitLayout.js +90 -0
- package/lib/cjs/components/split-layout/SplitLayout.js.map +1 -0
- package/lib/cjs/components/split-layout/SplitLayout.styles.js +44 -0
- package/lib/cjs/components/split-layout/SplitLayout.styles.js.map +1 -0
- package/lib/cjs/components/split-layout/SplitLayout.types.js +12 -0
- package/lib/cjs/components/split-layout/SplitLayout.types.js.map +1 -0
- package/lib/cjs/components/split-layout/SplitLayout.utils.js +25 -0
- package/lib/cjs/components/split-layout/SplitLayout.utils.js.map +1 -0
- package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.hooks.js +63 -0
- package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.hooks.js.map +1 -0
- package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.js +34 -0
- package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.js.map +1 -0
- package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.styles.js +58 -0
- package/lib/cjs/components/split-layout/resize-handle/ResizeHandle.styles.js.map +1 -0
- package/lib/cjs/components/user-image/UserImage.js +38 -0
- package/lib/cjs/components/user-image/UserImage.js.map +1 -0
- package/lib/cjs/components/user-image/UserImage.types.js +6 -0
- package/lib/cjs/components/user-image/UserImage.types.js.map +1 -0
- package/lib/cjs/components/user-image/userImage.styles.js +27 -0
- package/lib/cjs/components/user-image/userImage.styles.js.map +1 -0
- package/lib/cjs/index.js +49 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/components/navigation-layout/NavigationLayout.constants.js +8 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.constants.js.map +1 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.context.js +17 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.context.js.map +1 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.js +97 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.js.map +1 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.styles.js +67 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.styles.js.map +1 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.types.js +2 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.types.js.map +1 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.utils.js +251 -0
- package/lib/esm/components/navigation-layout/NavigationLayout.utils.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.js +24 -0
- package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.styles.js +23 -0
- package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.styles.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.types.js +2 -0
- package/lib/esm/components/navigation-layout/navigation-header/NavigationHeader.types.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.js +64 -0
- package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js +12 -0
- package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js +17 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.js +132 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.js +82 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.js +2 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.js +73 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.js +10 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.js +12 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.js +17 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.js +119 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.js +71 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.js +62 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.js +257 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.js +186 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.js +126 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.js.map +1 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.js +67 -0
- package/lib/esm/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.js.map +1 -0
- package/lib/esm/components/split-layout/SplitLayout.js +80 -0
- package/lib/esm/components/split-layout/SplitLayout.js.map +1 -0
- package/lib/esm/components/split-layout/SplitLayout.styles.js +37 -0
- package/lib/esm/components/split-layout/SplitLayout.styles.js.map +1 -0
- package/lib/esm/components/split-layout/SplitLayout.types.js +6 -0
- package/lib/esm/components/split-layout/SplitLayout.types.js.map +1 -0
- package/lib/esm/components/split-layout/SplitLayout.utils.js +17 -0
- package/lib/esm/components/split-layout/SplitLayout.utils.js.map +1 -0
- package/lib/esm/components/split-layout/resize-handle/ResizeHandle.hooks.js +54 -0
- package/lib/esm/components/split-layout/resize-handle/ResizeHandle.hooks.js.map +1 -0
- package/lib/esm/components/split-layout/resize-handle/ResizeHandle.js +27 -0
- package/lib/esm/components/split-layout/resize-handle/ResizeHandle.js.map +1 -0
- package/lib/esm/components/split-layout/resize-handle/ResizeHandle.styles.js +52 -0
- package/lib/esm/components/split-layout/resize-handle/ResizeHandle.styles.js.map +1 -0
- package/lib/esm/components/user-image/UserImage.js +31 -0
- package/lib/esm/components/user-image/UserImage.js.map +1 -0
- package/lib/esm/components/user-image/UserImage.types.js +2 -0
- package/lib/esm/components/user-image/UserImage.types.js.map +1 -0
- package/lib/esm/components/user-image/userImage.styles.js +20 -0
- package/lib/esm/components/user-image/userImage.styles.js.map +1 -0
- package/lib/esm/index.js +15 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/types/components/navigation-layout/NavigationLayout.constants.d.ts +7 -0
- package/lib/types/components/navigation-layout/NavigationLayout.context.d.ts +15 -0
- package/lib/types/components/navigation-layout/NavigationLayout.d.ts +4 -0
- package/lib/types/components/navigation-layout/NavigationLayout.styles.d.ts +19 -0
- package/lib/types/components/navigation-layout/NavigationLayout.types.d.ts +125 -0
- package/lib/types/components/navigation-layout/NavigationLayout.utils.d.ts +22 -0
- package/lib/types/components/navigation-layout/navigation-header/NavigationHeader.d.ts +4 -0
- package/lib/types/components/navigation-layout/navigation-header/NavigationHeader.styles.d.ts +9 -0
- package/lib/types/components/navigation-layout/navigation-header/NavigationHeader.types.d.ts +10 -0
- package/lib/types/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.d.ts +8 -0
- package/lib/types/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.d.ts +3 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.d.ts +19 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.d.ts +4 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.d.ts +27 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.d.ts +54 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.d.ts +22 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.d.ts +6 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.d.ts +6 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.context.d.ts +22 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.d.ts +9 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.hooks.d.ts +26 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/SidebarGroup.styles.d.ts +9 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.d.ts +10 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.hooks.d.ts +51 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.styles.d.ts +24 -0
- package/lib/types/components/navigation-layout/navigation-sidebar/sidebar-group/sidebar-item/SidebarItem.utils.d.ts +23 -0
- package/lib/types/components/split-layout/SplitLayout.d.ts +4 -0
- package/lib/types/components/split-layout/SplitLayout.styles.d.ts +12 -0
- package/lib/types/components/split-layout/SplitLayout.types.d.ts +19 -0
- package/lib/types/components/split-layout/SplitLayout.utils.d.ts +8 -0
- package/lib/types/components/split-layout/resize-handle/ResizeHandle.d.ts +11 -0
- package/lib/types/components/split-layout/resize-handle/ResizeHandle.hooks.d.ts +9 -0
- package/lib/types/components/split-layout/resize-handle/ResizeHandle.styles.d.ts +15 -0
- package/lib/types/components/user-image/UserImage.d.ts +4 -0
- package/lib/types/components/user-image/UserImage.types.d.ts +8 -0
- package/lib/types/components/user-image/userImage.styles.d.ts +10 -0
- package/lib/types/index.d.ts +10 -2
- package/package.json +3 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_NAVIGATION_LAYOUT_CONFIG = void 0;
|
|
7
|
+
const DEFAULT_NAVIGATION_LAYOUT_CONFIG = exports.DEFAULT_NAVIGATION_LAYOUT_CONFIG = {
|
|
8
|
+
headerHeight: 64,
|
|
9
|
+
backgroundColor: 'var(--chayns-color--primary)',
|
|
10
|
+
color: 'var(--chayns-color--text)',
|
|
11
|
+
sidebarMinWidth: 62,
|
|
12
|
+
sidebarMaxWidth: 170
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=NavigationLayout.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationLayout.constants.js","names":["DEFAULT_NAVIGATION_LAYOUT_CONFIG","exports","headerHeight","backgroundColor","color","sidebarMinWidth","sidebarMaxWidth"],"sources":["../../../../src/components/navigation-layout/NavigationLayout.constants.ts"],"sourcesContent":["export const DEFAULT_NAVIGATION_LAYOUT_CONFIG = {\n headerHeight: 64,\n backgroundColor: 'var(--chayns-color--primary)',\n color: 'var(--chayns-color--text)',\n sidebarMinWidth: 62,\n sidebarMaxWidth: 170,\n};\n"],"mappings":";;;;;;AAAO,MAAMA,gCAAgC,GAAAC,OAAA,CAAAD,gCAAA,GAAG;EAC5CE,YAAY,EAAE,EAAE;EAChBC,eAAe,EAAE,8BAA8B;EAC/CC,KAAK,EAAE,2BAA2B;EAClCC,eAAe,EAAE,EAAE;EACnBC,eAAe,EAAE;AACrB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useNavigationLayoutContext = exports.NavigationLayoutProvider = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
+
const NavigationLayoutContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
10
|
+
const NavigationLayoutProvider = ({
|
|
11
|
+
children,
|
|
12
|
+
value
|
|
13
|
+
}) => /*#__PURE__*/_react.default.createElement(NavigationLayoutContext.Provider, {
|
|
14
|
+
value: value
|
|
15
|
+
}, children);
|
|
16
|
+
exports.NavigationLayoutProvider = NavigationLayoutProvider;
|
|
17
|
+
NavigationLayoutProvider.displayName = 'NavigationLayoutProvider';
|
|
18
|
+
const useNavigationLayoutContext = () => {
|
|
19
|
+
const context = (0, _react.useContext)(NavigationLayoutContext);
|
|
20
|
+
if (!context) {
|
|
21
|
+
throw new Error('useNavigationLayoutContext must be used within NavigationLayoutProvider.');
|
|
22
|
+
}
|
|
23
|
+
return context;
|
|
24
|
+
};
|
|
25
|
+
exports.useNavigationLayoutContext = useNavigationLayoutContext;
|
|
26
|
+
//# sourceMappingURL=NavigationLayout.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationLayout.context.js","names":["_react","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NavigationLayoutContext","createContext","NavigationLayoutProvider","children","value","createElement","Provider","exports","displayName","useNavigationLayoutContext","context","useContext","Error"],"sources":["../../../../src/components/navigation-layout/NavigationLayout.context.tsx"],"sourcesContent":["import React, { ReactNode, createContext, useContext } from 'react';\nimport { NavigationLayoutProps } from './NavigationLayout.types';\n\ninterface NavigationLayoutContextValue {\n onItemReorder?: NavigationLayoutProps['onItemReorder'];\n}\n\ninterface NavigationLayoutProviderProps {\n children: ReactNode;\n value: NavigationLayoutContextValue;\n}\n\nconst NavigationLayoutContext = createContext<NavigationLayoutContextValue | null>(null);\n\nexport const NavigationLayoutProvider = ({ children, value }: NavigationLayoutProviderProps) => (\n <NavigationLayoutContext.Provider value={value}>{children}</NavigationLayoutContext.Provider>\n);\n\nNavigationLayoutProvider.displayName = 'NavigationLayoutProvider';\n\nexport const useNavigationLayoutContext = (): NavigationLayoutContextValue => {\n const context = useContext(NavigationLayoutContext);\n\n if (!context) {\n throw new Error('useNavigationLayoutContext must be used within NavigationLayoutProvider.');\n }\n\n return context;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAoE,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAYpE,MAAMkB,uBAAuB,gBAAG,IAAAC,oBAAa,EAAsC,IAAI,CAAC;AAEjF,MAAMC,wBAAwB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAqC,CAAC,kBACvF1B,MAAA,CAAAa,OAAA,CAAAc,aAAA,CAACL,uBAAuB,CAACM,QAAQ;EAACF,KAAK,EAAEA;AAAM,GAAED,QAA2C,CAC/F;AAACI,OAAA,CAAAL,wBAAA,GAAAA,wBAAA;AAEFA,wBAAwB,CAACM,WAAW,GAAG,0BAA0B;AAE1D,MAAMC,0BAA0B,GAAGA,CAAA,KAAoC;EAC1E,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACX,uBAAuB,CAAC;EAEnD,IAAI,CAACU,OAAO,EAAE;IACV,MAAM,IAAIE,KAAK,CAAC,0EAA0E,CAAC;EAC/F;EAEA,OAAOF,OAAO;AAClB,CAAC;AAACH,OAAA,CAAAE,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _NavigationLayout = require("./NavigationLayout.styles");
|
|
9
|
+
var _NavigationHeader = _interopRequireDefault(require("./navigation-header/NavigationHeader"));
|
|
10
|
+
var _NavigationSidebar = _interopRequireDefault(require("./navigation-sidebar/NavigationSidebar"));
|
|
11
|
+
var _NavigationLayout2 = require("./NavigationLayout.constants");
|
|
12
|
+
var _react2 = require("motion/react");
|
|
13
|
+
var _NavigationLayout3 = require("./NavigationLayout.context");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
const NavigationLayout = ({
|
|
17
|
+
children,
|
|
18
|
+
config: configProp,
|
|
19
|
+
sidebarTopContent,
|
|
20
|
+
sidebarBottomContent,
|
|
21
|
+
groups,
|
|
22
|
+
headerContent,
|
|
23
|
+
selectedItemId,
|
|
24
|
+
isMobile = false,
|
|
25
|
+
shouldShowCollapsedLabel = false,
|
|
26
|
+
onItemClick,
|
|
27
|
+
onItemReorder,
|
|
28
|
+
onSidebarOpen,
|
|
29
|
+
onSidebarClose
|
|
30
|
+
}) => {
|
|
31
|
+
const [isMobileOpen, setIsMobileOpen] = (0, _react.useState)(false);
|
|
32
|
+
const mergedConfig = (0, _react.useMemo)(() => ({
|
|
33
|
+
..._NavigationLayout2.DEFAULT_NAVIGATION_LAYOUT_CONFIG,
|
|
34
|
+
...configProp
|
|
35
|
+
}), [configProp]);
|
|
36
|
+
const shouldShowCollapsedSidebarLabel = shouldShowCollapsedLabel && !isMobile;
|
|
37
|
+
const handleToggleMobileMenu = (0, _react.useCallback)(() => {
|
|
38
|
+
if (!isMobile) {
|
|
39
|
+
setIsMobileOpen(false);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
setIsMobileOpen(prev => !prev);
|
|
43
|
+
}, [isMobile]);
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_NavigationLayout3.NavigationLayoutProvider, {
|
|
45
|
+
value: {
|
|
46
|
+
onItemReorder
|
|
47
|
+
}
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement(_NavigationLayout.StyledNavigationLayout, null, /*#__PURE__*/_react.default.createElement(_NavigationHeader.default, {
|
|
49
|
+
height: mergedConfig.headerHeight,
|
|
50
|
+
color: mergedConfig.color,
|
|
51
|
+
headerContent: headerContent,
|
|
52
|
+
safeAreas: mergedConfig.safeAreas,
|
|
53
|
+
isMobile: isMobile,
|
|
54
|
+
isMobileOpen: isMobileOpen,
|
|
55
|
+
onMenuClick: handleToggleMobileMenu
|
|
56
|
+
}), /*#__PURE__*/_react.default.createElement(_NavigationLayout.StyledMotionNavigationLayoutContentWrapper, {
|
|
57
|
+
initial: false,
|
|
58
|
+
animate: isMobile ? {
|
|
59
|
+
x: isMobileOpen ? 0 : '-70vw'
|
|
60
|
+
} : {},
|
|
61
|
+
transition: {
|
|
62
|
+
type: 'tween'
|
|
63
|
+
}
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement(_NavigationSidebar.default, {
|
|
65
|
+
color: mergedConfig.color,
|
|
66
|
+
groups: groups,
|
|
67
|
+
topContent: sidebarTopContent,
|
|
68
|
+
bottomContent: sidebarBottomContent,
|
|
69
|
+
minWidth: mergedConfig.sidebarMinWidth,
|
|
70
|
+
maxWidth: mergedConfig.sidebarMaxWidth,
|
|
71
|
+
isMobile: isMobile,
|
|
72
|
+
selectedItemId: selectedItemId,
|
|
73
|
+
onItemClick: onItemClick,
|
|
74
|
+
onSidebarOpen: onSidebarOpen,
|
|
75
|
+
onSidebarClose: onSidebarClose,
|
|
76
|
+
shouldShowCollapsedLabel: shouldShowCollapsedSidebarLabel
|
|
77
|
+
}), /*#__PURE__*/_react.default.createElement(_NavigationLayout.StyledNavigationLayoutContent, {
|
|
78
|
+
$isMobile: isMobile,
|
|
79
|
+
$isCornerContent: !isMobile || isMobileOpen
|
|
80
|
+
}, children, /*#__PURE__*/_react.default.createElement(_react2.AnimatePresence, {
|
|
81
|
+
initial: false
|
|
82
|
+
}, isMobileOpen && /*#__PURE__*/_react.default.createElement(_NavigationLayout.StyledMotionNavigationLayoutContentOverlay, {
|
|
83
|
+
initial: {
|
|
84
|
+
opacity: 0
|
|
85
|
+
},
|
|
86
|
+
animate: {
|
|
87
|
+
opacity: 0.28
|
|
88
|
+
},
|
|
89
|
+
exit: {
|
|
90
|
+
opacity: 0
|
|
91
|
+
},
|
|
92
|
+
transition: {
|
|
93
|
+
duration: 0.3,
|
|
94
|
+
type: 'tween'
|
|
95
|
+
},
|
|
96
|
+
onClick: handleToggleMobileMenu
|
|
97
|
+
})))), /*#__PURE__*/_react.default.createElement(_NavigationLayout.StyledNavigationLayoutBackground, {
|
|
98
|
+
$backgroundColor: mergedConfig.backgroundColor
|
|
99
|
+
}, mergedConfig.backgroundImage && /*#__PURE__*/_react.default.createElement(_NavigationLayout.StyledNavigationLayoutBackgroundImage, {
|
|
100
|
+
src: mergedConfig.backgroundImage
|
|
101
|
+
}))));
|
|
102
|
+
};
|
|
103
|
+
NavigationLayout.displayName = 'NavigationLayout';
|
|
104
|
+
var _default = exports.default = NavigationLayout;
|
|
105
|
+
//# sourceMappingURL=NavigationLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationLayout.js","names":["_react","_interopRequireWildcard","require","_NavigationLayout","_NavigationHeader","_interopRequireDefault","_NavigationSidebar","_NavigationLayout2","_react2","_NavigationLayout3","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NavigationLayout","children","config","configProp","sidebarTopContent","sidebarBottomContent","groups","headerContent","selectedItemId","isMobile","shouldShowCollapsedLabel","onItemClick","onItemReorder","onSidebarOpen","onSidebarClose","isMobileOpen","setIsMobileOpen","useState","mergedConfig","useMemo","DEFAULT_NAVIGATION_LAYOUT_CONFIG","shouldShowCollapsedSidebarLabel","handleToggleMobileMenu","useCallback","prev","createElement","NavigationLayoutProvider","value","StyledNavigationLayout","height","headerHeight","color","safeAreas","onMenuClick","StyledMotionNavigationLayoutContentWrapper","initial","animate","x","transition","type","topContent","bottomContent","minWidth","sidebarMinWidth","maxWidth","sidebarMaxWidth","StyledNavigationLayoutContent","$isMobile","$isCornerContent","AnimatePresence","StyledMotionNavigationLayoutContentOverlay","opacity","exit","duration","onClick","StyledNavigationLayoutBackground","$backgroundColor","backgroundColor","backgroundImage","StyledNavigationLayoutBackgroundImage","src","displayName","_default","exports"],"sources":["../../../../src/components/navigation-layout/NavigationLayout.tsx"],"sourcesContent":["import React, { FC, useCallback, useMemo, useState } from 'react';\nimport { NavigationLayoutProps } from './NavigationLayout.types';\nimport {\n StyledMotionNavigationLayoutContentWrapper,\n StyledNavigationLayout,\n StyledNavigationLayoutBackground,\n StyledNavigationLayoutBackgroundImage,\n StyledNavigationLayoutContent,\n StyledMotionNavigationLayoutContentOverlay,\n} from './NavigationLayout.styles';\nimport NavigationHeader from './navigation-header/NavigationHeader';\nimport NavigationSidebar from './navigation-sidebar/NavigationSidebar';\nimport { DEFAULT_NAVIGATION_LAYOUT_CONFIG } from './NavigationLayout.constants';\nimport { AnimatePresence } from 'motion/react';\nimport { NavigationLayoutProvider } from './NavigationLayout.context';\n\nconst NavigationLayout: FC<NavigationLayoutProps> = ({\n children,\n config: configProp,\n sidebarTopContent,\n sidebarBottomContent,\n groups,\n headerContent,\n selectedItemId,\n isMobile = false,\n shouldShowCollapsedLabel = false,\n onItemClick,\n onItemReorder,\n onSidebarOpen,\n onSidebarClose,\n}) => {\n const [isMobileOpen, setIsMobileOpen] = useState(false);\n\n const mergedConfig = useMemo(\n () => ({\n ...DEFAULT_NAVIGATION_LAYOUT_CONFIG,\n ...configProp,\n }),\n [configProp],\n );\n\n const shouldShowCollapsedSidebarLabel = shouldShowCollapsedLabel && !isMobile;\n\n const handleToggleMobileMenu = useCallback(() => {\n if (!isMobile) {\n setIsMobileOpen(false);\n\n return;\n }\n\n setIsMobileOpen((prev) => !prev);\n }, [isMobile]);\n\n return (\n <NavigationLayoutProvider value={{ onItemReorder }}>\n <StyledNavigationLayout>\n <NavigationHeader\n height={mergedConfig.headerHeight}\n color={mergedConfig.color}\n headerContent={headerContent}\n safeAreas={mergedConfig.safeAreas}\n isMobile={isMobile}\n isMobileOpen={isMobileOpen}\n onMenuClick={handleToggleMobileMenu}\n />\n <StyledMotionNavigationLayoutContentWrapper\n initial={false}\n animate={isMobile ? { x: isMobileOpen ? 0 : '-70vw' } : {}}\n transition={{\n type: 'tween',\n }}\n >\n <NavigationSidebar\n color={mergedConfig.color}\n groups={groups}\n topContent={sidebarTopContent}\n bottomContent={sidebarBottomContent}\n minWidth={mergedConfig.sidebarMinWidth}\n maxWidth={mergedConfig.sidebarMaxWidth}\n isMobile={isMobile}\n selectedItemId={selectedItemId}\n onItemClick={onItemClick}\n onSidebarOpen={onSidebarOpen}\n onSidebarClose={onSidebarClose}\n shouldShowCollapsedLabel={shouldShowCollapsedSidebarLabel}\n />\n <StyledNavigationLayoutContent\n $isMobile={isMobile}\n $isCornerContent={!isMobile || isMobileOpen}\n >\n {children}\n <AnimatePresence initial={false}>\n {isMobileOpen && (\n <StyledMotionNavigationLayoutContentOverlay\n initial={{ opacity: 0 }}\n animate={{ opacity: 0.28 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3, type: 'tween' }}\n onClick={handleToggleMobileMenu}\n />\n )}\n </AnimatePresence>\n </StyledNavigationLayoutContent>\n </StyledMotionNavigationLayoutContentWrapper>\n <StyledNavigationLayoutBackground $backgroundColor={mergedConfig.backgroundColor}>\n {mergedConfig.backgroundImage && (\n <StyledNavigationLayoutBackgroundImage src={mergedConfig.backgroundImage} />\n )}\n </StyledNavigationLayoutBackground>\n </StyledNavigationLayout>\n </NavigationLayoutProvider>\n );\n};\n\nNavigationLayout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AAA,CAACnD,iBAAA,CAAA4E,0CAA0C;IACvCf,OAAO,EAAE;MAAEgB,OAAO,EAAE;IAAE,CAAE;IACxBf,OAAO,EAAE;MAAEe,OAAO,EAAE;IAAK,CAAE;IAC3BC,IAAI,EAAE;MAAED,OAAO,EAAE;IAAE,CAAE;IACrBb,UAAU,EAAE;MAAEe,QAAQ,EAAE,GAAG;MAAEd,IAAI,EAAE;IAAQ,CAAE;IAC7Ce,OAAO,EAAEhC;EAAuB,CACnC,CAEQ,CACU,CACS,CAAC,eAC7CnD,MAAA,CAAAY,OAAA,CAAA0C,aAAA,CAACnD,iBAAA,CAAAiF,gCAAgC;IAACC,gBAAgB,EAAEtC,YAAY,CAACuC;EAAgB,GAC5EvC,YAAY,CAACwC,eAAe,iBACzBvF,MAAA,CAAAY,OAAA,CAAA0C,aAAA,CAACnD,iBAAA,CAAAqF,qCAAqC;IAACC,GAAG,EAAE1C,YAAY,CAACwC;EAAgB,CAAE,CAEjD,CACd,CACF,CAAC;AAEnC,CAAC;AAED1D,gBAAgB,CAAC6D,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhF,OAAA,GAEnCiB,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledNavigationLayoutContent = exports.StyledNavigationLayoutBackgroundImage = exports.StyledNavigationLayoutBackground = exports.StyledNavigationLayout = exports.StyledMotionNavigationLayoutContentWrapper = exports.StyledMotionNavigationLayoutContentOverlay = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
var _react = require("motion/react");
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
+
const StyledNavigationLayout = exports.StyledNavigationLayout = _styledComponents.default.div`
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
height: 100%;
|
|
14
|
+
width: 100%;
|
|
15
|
+
min-height: 0;
|
|
16
|
+
position: relative;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
`;
|
|
19
|
+
const StyledMotionNavigationLayoutContentWrapper = exports.StyledMotionNavigationLayoutContentWrapper = (0, _styledComponents.default)(_react.motion.div)`
|
|
20
|
+
display: flex;
|
|
21
|
+
flex: 1;
|
|
22
|
+
width: 100%;
|
|
23
|
+
min-height: 0;
|
|
24
|
+
`;
|
|
25
|
+
const StyledNavigationLayoutContent = exports.StyledNavigationLayoutContent = _styledComponents.default.div`
|
|
26
|
+
${({
|
|
27
|
+
$isCornerContent
|
|
28
|
+
}) => $isCornerContent && (0, _styledComponents.css)`
|
|
29
|
+
border-top-left-radius: 10px;
|
|
30
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0 0 20px 16px;
|
|
31
|
+
`}
|
|
32
|
+
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
|
|
35
|
+
flex: 1;
|
|
36
|
+
width: ${({
|
|
37
|
+
$isMobile
|
|
38
|
+
}) => $isMobile ? '100vw' : '100%'};
|
|
39
|
+
min-width: ${({
|
|
40
|
+
$isMobile
|
|
41
|
+
}) => $isMobile ? '100vw' : 0};
|
|
42
|
+
min-height: 0;
|
|
43
|
+
|
|
44
|
+
position: relative;
|
|
45
|
+
`;
|
|
46
|
+
const StyledMotionNavigationLayoutContentOverlay = exports.StyledMotionNavigationLayoutContentOverlay = (0, _styledComponents.default)(_react.motion.div)`
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0;
|
|
49
|
+
left: 0;
|
|
50
|
+
right: 0;
|
|
51
|
+
bottom: 0;
|
|
52
|
+
|
|
53
|
+
z-index: 3;
|
|
54
|
+
|
|
55
|
+
background-color: rgb(0, 0, 0);
|
|
56
|
+
`;
|
|
57
|
+
const StyledNavigationLayoutBackground = exports.StyledNavigationLayoutBackground = _styledComponents.default.div`
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: 0;
|
|
60
|
+
bottom: 0;
|
|
61
|
+
left: 0;
|
|
62
|
+
right: 0;
|
|
63
|
+
z-index: -100;
|
|
64
|
+
|
|
65
|
+
background-color: ${({
|
|
66
|
+
$backgroundColor
|
|
67
|
+
}) => $backgroundColor};
|
|
68
|
+
`;
|
|
69
|
+
const StyledNavigationLayoutBackgroundImage = exports.StyledNavigationLayoutBackgroundImage = _styledComponents.default.img`
|
|
70
|
+
object-fit: cover;
|
|
71
|
+
height: 100%;
|
|
72
|
+
width: 100%;
|
|
73
|
+
`;
|
|
74
|
+
//# sourceMappingURL=NavigationLayout.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationLayout.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_react","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledNavigationLayout","exports","styled","div","StyledMotionNavigationLayoutContentWrapper","motion","StyledNavigationLayoutContent","$isCornerContent","css","$isMobile","StyledMotionNavigationLayoutContentOverlay","StyledNavigationLayoutBackground","$backgroundColor","StyledNavigationLayoutBackgroundImage","img"],"sources":["../../../../src/components/navigation-layout/NavigationLayout.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { WithTheme } from '@chayns-components/core';\nimport { motion } from 'motion/react';\n\nexport const StyledNavigationLayout = styled.div`\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n min-height: 0;\n position: relative;\n overflow: hidden;\n`;\n\nexport const StyledMotionNavigationLayoutContentWrapper = styled(motion.div)`\n display: flex;\n flex: 1;\n width: 100%;\n min-height: 0;\n`;\n\ntype StyledNavigationLayoutContentProps = WithTheme<{\n $isCornerContent: boolean;\n $isMobile: boolean;\n}>;\n\nexport const StyledNavigationLayoutContent = styled.div<StyledNavigationLayoutContentProps>`\n ${({ $isCornerContent }) =>\n $isCornerContent &&\n css`\n border-top-left-radius: 10px;\n box-shadow: rgba(0, 0, 0, 0.2) 0 0 20px 16px;\n `}\n\n overflow: hidden;\n\n flex: 1;\n width: ${({ $isMobile }) => ($isMobile ? '100vw' : '100%')};\n min-width: ${({ $isMobile }) => ($isMobile ? '100vw' : 0)};\n min-height: 0;\n\n position: relative;\n`;\n\nexport const StyledMotionNavigationLayoutContentOverlay = styled(motion.div)`\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n\n z-index: 3;\n\n background-color: rgb(0, 0, 0);\n`;\n\ntype StyledNavigationLayoutBackgroundProps = WithTheme<{ $backgroundColor: string }>;\n\nexport const StyledNavigationLayoutBackground = styled.div<StyledNavigationLayoutBackgroundProps>`\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: -100;\n\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n`;\n\nexport const StyledNavigationLayoutBackgroundImage = styled.img`\n object-fit: cover;\n height: 100%;\n width: 100%;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAAsC,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAA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AC,KAAMA,SAAS,GAAG,OAAO,GAAG,MAAO;AAC9D,iBAAiB,CAAC;EAAEA;AAAU,CAAC,KAAMA,SAAS,GAAG,OAAO,GAAG,CAAE;AAC7D;AACA;AACA;AACA,CAAC;AAEM,MAAMC,0CAA0C,GAAAT,OAAA,CAAAS,0CAAA,GAAG,IAAAR,yBAAM,EAACG,aAAM,CAACF,GAAG,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAIM,MAAMQ,gCAAgC,GAAAV,OAAA,CAAAU,gCAAA,GAAGT,yBAAM,CAACC,GAA0C;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAES;AAAiB,CAAC,KAAKA,gBAAgB;AAClE,CAAC;AAEM,MAAMC,qCAAqC,GAAAZ,OAAA,CAAAY,qCAAA,GAAGX,yBAAM,CAACY,GAAG;AAC/D;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationLayout.types.js","names":[],"sources":["../../../../src/components/navigation-layout/NavigationLayout.types.ts"],"sourcesContent":["import { ReactNode } from 'react';\n\nexport type NavigationLayoutItemReorderPlacement = 'before' | 'after' | 'inside';\n\n/**\n * Describes a location inside the item tree of a single navigation group.\n */\nexport interface NavigationLayoutItemLocation {\n /**\n * Ordered parent chain from root level to the direct parent.\n */\n parentIds: NavigationLayoutItem['id'][];\n /**\n * Zero-based index within the resolved level.\n */\n index: number;\n}\n\n/**\n * Describes the dragged item and its original position.\n */\nexport interface NavigationLayoutItemReorderSource extends NavigationLayoutItemLocation {\n itemId: NavigationLayoutItem['id'];\n}\n\n/**\n * Describes the resolved drop target inside the current group.\n */\nexport interface NavigationLayoutItemReorderTarget extends NavigationLayoutItemLocation {\n itemId?: NavigationLayoutItem['id'];\n placement: NavigationLayoutItemReorderPlacement;\n}\n\n/**\n * Payload emitted after a valid reorder interaction within a single group.\n */\nexport interface NavigationLayoutItemReorderEvent {\n groupId: NavigationLayoutGroup['id'];\n itemId: NavigationLayoutItem['id'];\n source: NavigationLayoutItemReorderSource;\n target: NavigationLayoutItemReorderTarget;\n}\n\n/**\n * Public props for the navigation layout shell.\n */\nexport interface NavigationLayoutProps {\n /**\n * Main content rendered next to the navigation sidebar.\n */\n children: ReactNode;\n /**\n * Visual configuration for header, sidebar and background.\n */\n config?: NavigationLayoutConfig;\n /**\n * Grouped navigation data rendered in the sidebar.\n */\n groups: NavigationLayoutGroup[];\n /**\n * Optional content rendered above the navigation items.\n */\n sidebarTopContent?: ReactNode;\n /**\n * Optional content rendered below the navigation items.\n */\n sidebarBottomContent?: ReactNode;\n /**\n * Currently selected item id.\n */\n selectedItemId?: NavigationLayoutItem['id'];\n /**\n * Called when a navigation item is clicked.\n */\n onItemClick?: (\n id: NavigationLayoutItem['id'],\n parentIds?: NavigationLayoutItem['id'][],\n ) => void;\n /**\n * Called after a successful reorder inside a single group.\n */\n onItemReorder?: (event: NavigationLayoutItemReorderEvent) => void;\n /**\n * Content rendered inside the fixed header.\n */\n headerContent: ReactNode;\n /**\n * Called when the sidebar snaps open.\n */\n onSidebarOpen?: VoidFunction;\n /**\n * Called when the sidebar snaps closed.\n */\n onSidebarClose?: VoidFunction;\n /**\n * Shows labels in collapsed mode via tooltip-like popups.\n */\n shouldShowCollapsedLabel?: boolean;\n /**\n * Enables the mobile layout variant.\n */\n isMobile?: boolean;\n}\n\nexport interface SafeAreas {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\nexport interface NavigationLayoutConfig {\n headerHeight?: number;\n backgroundColor?: string;\n backgroundImage?: string;\n color?: string;\n sidebarMinWidth?: number;\n sidebarMaxWidth?: number;\n safeAreas?: SafeAreas;\n}\n\nexport interface NavigationLayoutItem {\n id: string;\n label: string;\n icons?: string[];\n imageUrl?: string;\n imageElement?: ReactNode;\n isDisabled?: boolean;\n disabledReason?: string;\n children?: NavigationLayoutItem[];\n}\n\nexport interface NavigationLayoutGroup {\n id: string;\n isReorderable?: boolean;\n isPinned?: boolean;\n items: NavigationLayoutItem[];\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isNavigationLayoutItemReorderEventValid = isNavigationLayoutItemReorderEventValid;
|
|
7
|
+
exports.isNavigationLayoutReorderTargetEqual = isNavigationLayoutReorderTargetEqual;
|
|
8
|
+
exports.reorderNavigationLayoutGroupItems = reorderNavigationLayoutGroupItems;
|
|
9
|
+
exports.reorderNavigationLayoutGroups = reorderNavigationLayoutGroups;
|
|
10
|
+
// noinspection JSUnusedGlobalSymbols
|
|
11
|
+
|
|
12
|
+
const areNavigationLayoutParentIdsEqual = ({
|
|
13
|
+
parentIdsA,
|
|
14
|
+
parentIdsB
|
|
15
|
+
}) => {
|
|
16
|
+
if (parentIdsA.length !== parentIdsB.length) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return parentIdsA.every((parentId, index) => parentId === parentIdsB[index]);
|
|
20
|
+
};
|
|
21
|
+
const cloneNavigationLayoutItems = ({
|
|
22
|
+
items
|
|
23
|
+
}) => items.map(item => ({
|
|
24
|
+
...item,
|
|
25
|
+
children: item.children ? cloneNavigationLayoutItems({
|
|
26
|
+
items: item.children
|
|
27
|
+
}) : undefined
|
|
28
|
+
}));
|
|
29
|
+
const findNavigationLayoutItemById = ({
|
|
30
|
+
items,
|
|
31
|
+
itemId
|
|
32
|
+
}) => {
|
|
33
|
+
for (const item of items) {
|
|
34
|
+
var _item$children;
|
|
35
|
+
if (item.id === itemId) {
|
|
36
|
+
return item;
|
|
37
|
+
}
|
|
38
|
+
if ((_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
|
|
39
|
+
const nestedItem = findNavigationLayoutItemById({
|
|
40
|
+
items: item.children,
|
|
41
|
+
itemId
|
|
42
|
+
});
|
|
43
|
+
if (nestedItem) {
|
|
44
|
+
return nestedItem;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
};
|
|
50
|
+
const getNavigationLayoutItemsByParentIds = ({
|
|
51
|
+
items,
|
|
52
|
+
parentIds,
|
|
53
|
+
shouldCreateMissingChildren = false,
|
|
54
|
+
shouldReturnEmptyChildrenAtLeaf = false
|
|
55
|
+
}) => {
|
|
56
|
+
if (parentIds.length === 0) {
|
|
57
|
+
return items;
|
|
58
|
+
}
|
|
59
|
+
const [parentId, ...remainingParentIds] = parentIds;
|
|
60
|
+
const parentItem = items.find(({
|
|
61
|
+
id
|
|
62
|
+
}) => id === parentId);
|
|
63
|
+
if (!parentItem) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
if (!parentItem.children) {
|
|
67
|
+
if (remainingParentIds.length > 0) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
if (!shouldCreateMissingChildren) {
|
|
71
|
+
return shouldReturnEmptyChildrenAtLeaf ? [] : null;
|
|
72
|
+
}
|
|
73
|
+
parentItem.children = [];
|
|
74
|
+
}
|
|
75
|
+
return getNavigationLayoutItemsByParentIds({
|
|
76
|
+
items: parentItem.children,
|
|
77
|
+
parentIds: remainingParentIds,
|
|
78
|
+
shouldCreateMissingChildren,
|
|
79
|
+
shouldReturnEmptyChildrenAtLeaf
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const removeNavigationLayoutItemAtLocation = ({
|
|
83
|
+
items,
|
|
84
|
+
location
|
|
85
|
+
}) => {
|
|
86
|
+
const parentItems = getNavigationLayoutItemsByParentIds({
|
|
87
|
+
items,
|
|
88
|
+
parentIds: location.parentIds,
|
|
89
|
+
shouldCreateMissingChildren: true
|
|
90
|
+
});
|
|
91
|
+
if (!parentItems || location.index < 0 || location.index >= parentItems.length) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const [item] = parentItems.splice(location.index, 1);
|
|
95
|
+
if (!item) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
item,
|
|
100
|
+
items
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
const insertNavigationLayoutItemAtLocation = ({
|
|
104
|
+
items,
|
|
105
|
+
location,
|
|
106
|
+
item
|
|
107
|
+
}) => {
|
|
108
|
+
const parentItems = getNavigationLayoutItemsByParentIds({
|
|
109
|
+
items,
|
|
110
|
+
parentIds: location.parentIds,
|
|
111
|
+
shouldCreateMissingChildren: true
|
|
112
|
+
});
|
|
113
|
+
if (!parentItems) {
|
|
114
|
+
return items;
|
|
115
|
+
}
|
|
116
|
+
const nextIndex = Math.max(0, Math.min(location.index, parentItems.length));
|
|
117
|
+
parentItems.splice(nextIndex, 0, item);
|
|
118
|
+
return items;
|
|
119
|
+
};
|
|
120
|
+
const normalizeNavigationLayoutReorderTarget = ({
|
|
121
|
+
source,
|
|
122
|
+
target
|
|
123
|
+
}) => {
|
|
124
|
+
if (areNavigationLayoutParentIdsEqual({
|
|
125
|
+
parentIdsA: source.parentIds,
|
|
126
|
+
parentIdsB: target.parentIds
|
|
127
|
+
}) && source.index < target.index) {
|
|
128
|
+
return {
|
|
129
|
+
...target,
|
|
130
|
+
index: target.index - 1
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return target;
|
|
134
|
+
};
|
|
135
|
+
function isNavigationLayoutReorderTargetEqual({
|
|
136
|
+
targetA,
|
|
137
|
+
targetB
|
|
138
|
+
}) {
|
|
139
|
+
if (!targetA || !targetB) {
|
|
140
|
+
return targetA === targetB;
|
|
141
|
+
}
|
|
142
|
+
return targetA.itemId === targetB.itemId && targetA.index === targetB.index && targetA.placement === targetB.placement && areNavigationLayoutParentIdsEqual({
|
|
143
|
+
parentIdsA: targetA.parentIds,
|
|
144
|
+
parentIdsB: targetB.parentIds
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function isNavigationLayoutItemReorderEventValid({
|
|
148
|
+
items,
|
|
149
|
+
event
|
|
150
|
+
}) {
|
|
151
|
+
const {
|
|
152
|
+
itemId,
|
|
153
|
+
source,
|
|
154
|
+
target
|
|
155
|
+
} = event;
|
|
156
|
+
const sourceParentItems = getNavigationLayoutItemsByParentIds({
|
|
157
|
+
items,
|
|
158
|
+
parentIds: source.parentIds
|
|
159
|
+
});
|
|
160
|
+
const sourceItem = sourceParentItems === null || sourceParentItems === void 0 ? void 0 : sourceParentItems[source.index];
|
|
161
|
+
if (!sourceParentItems || (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.id) !== itemId || source.itemId !== itemId) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
if (sourceItem.isDisabled) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
if (target.itemId === itemId || target.parentIds.includes(itemId)) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
if (target.placement === 'inside' && !target.itemId) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
const targetParentItems = getNavigationLayoutItemsByParentIds({
|
|
174
|
+
items,
|
|
175
|
+
parentIds: target.parentIds,
|
|
176
|
+
shouldReturnEmptyChildrenAtLeaf: true
|
|
177
|
+
});
|
|
178
|
+
if (!targetParentItems) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
if (target.index < 0 || target.index > targetParentItems.length) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
if (target.placement === 'inside' && target.itemId) {
|
|
185
|
+
const targetItem = findNavigationLayoutItemById({
|
|
186
|
+
items,
|
|
187
|
+
itemId: target.itemId
|
|
188
|
+
});
|
|
189
|
+
if (!targetItem || targetItem.isDisabled) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const normalizedTarget = normalizeNavigationLayoutReorderTarget({
|
|
194
|
+
source,
|
|
195
|
+
target
|
|
196
|
+
});
|
|
197
|
+
return !(areNavigationLayoutParentIdsEqual({
|
|
198
|
+
parentIdsA: source.parentIds,
|
|
199
|
+
parentIdsB: normalizedTarget.parentIds
|
|
200
|
+
}) && source.index === normalizedTarget.index);
|
|
201
|
+
}
|
|
202
|
+
function reorderNavigationLayoutGroupItems({
|
|
203
|
+
items,
|
|
204
|
+
event
|
|
205
|
+
}) {
|
|
206
|
+
if (!isNavigationLayoutItemReorderEventValid({
|
|
207
|
+
items,
|
|
208
|
+
event
|
|
209
|
+
})) {
|
|
210
|
+
return items;
|
|
211
|
+
}
|
|
212
|
+
const nextItems = cloneNavigationLayoutItems({
|
|
213
|
+
items
|
|
214
|
+
});
|
|
215
|
+
const sourceResult = removeNavigationLayoutItemAtLocation({
|
|
216
|
+
items: nextItems,
|
|
217
|
+
location: event.source
|
|
218
|
+
});
|
|
219
|
+
if (!sourceResult) {
|
|
220
|
+
return items;
|
|
221
|
+
}
|
|
222
|
+
const target = normalizeNavigationLayoutReorderTarget({
|
|
223
|
+
source: event.source,
|
|
224
|
+
target: event.target
|
|
225
|
+
});
|
|
226
|
+
return insertNavigationLayoutItemAtLocation({
|
|
227
|
+
items: sourceResult.items,
|
|
228
|
+
location: target,
|
|
229
|
+
item: sourceResult.item
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function reorderNavigationLayoutGroups({
|
|
233
|
+
groups,
|
|
234
|
+
event
|
|
235
|
+
}) {
|
|
236
|
+
const group = groups.find(({
|
|
237
|
+
id
|
|
238
|
+
}) => id === event.groupId);
|
|
239
|
+
if (!group) {
|
|
240
|
+
return groups;
|
|
241
|
+
}
|
|
242
|
+
if (!isNavigationLayoutItemReorderEventValid({
|
|
243
|
+
items: group.items,
|
|
244
|
+
event
|
|
245
|
+
})) {
|
|
246
|
+
return groups;
|
|
247
|
+
}
|
|
248
|
+
return groups.map(currentGroup => {
|
|
249
|
+
if (currentGroup.id !== event.groupId) {
|
|
250
|
+
return currentGroup;
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
...currentGroup,
|
|
254
|
+
items: reorderNavigationLayoutGroupItems({
|
|
255
|
+
items: currentGroup.items,
|
|
256
|
+
event
|
|
257
|
+
})
|
|
258
|
+
};
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=NavigationLayout.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationLayout.utils.js","names":["areNavigationLayoutParentIdsEqual","parentIdsA","parentIdsB","length","every","parentId","index","cloneNavigationLayoutItems","items","map","item","children","undefined","findNavigationLayoutItemById","itemId","_item$children","id","nestedItem","getNavigationLayoutItemsByParentIds","parentIds","shouldCreateMissingChildren","shouldReturnEmptyChildrenAtLeaf","remainingParentIds","parentItem","find","removeNavigationLayoutItemAtLocation","location","parentItems","splice","insertNavigationLayoutItemAtLocation","nextIndex","Math","max","min","normalizeNavigationLayoutReorderTarget","source","target","isNavigationLayoutReorderTargetEqual","targetA","targetB","placement","isNavigationLayoutItemReorderEventValid","event","sourceParentItems","sourceItem","isDisabled","includes","targetParentItems","targetItem","normalizedTarget","reorderNavigationLayoutGroupItems","nextItems","sourceResult","reorderNavigationLayoutGroups","groups","group","groupId","currentGroup"],"sources":["../../../../src/components/navigation-layout/NavigationLayout.utils.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nimport {\n NavigationLayoutGroup,\n NavigationLayoutItem,\n NavigationLayoutItemLocation,\n NavigationLayoutItemReorderEvent,\n NavigationLayoutItemReorderTarget,\n} from './NavigationLayout.types';\n\ninterface CloneNavigationLayoutItemsOptions {\n items: NavigationLayoutItem[];\n}\n\ninterface AreNavigationLayoutParentIdsEqualOptions {\n parentIdsA: NavigationLayoutItem['id'][];\n parentIdsB: NavigationLayoutItem['id'][];\n}\n\ninterface FindNavigationLayoutItemByIdOptions {\n items: NavigationLayoutItem[];\n itemId: NavigationLayoutItem['id'];\n}\n\ninterface GetNavigationLayoutItemsByParentIdsOptions {\n items: NavigationLayoutItem[];\n parentIds: NavigationLayoutItem['id'][];\n shouldCreateMissingChildren?: boolean;\n shouldReturnEmptyChildrenAtLeaf?: boolean;\n}\n\ninterface RemoveNavigationLayoutItemAtLocationOptions {\n items: NavigationLayoutItem[];\n location: NavigationLayoutItemLocation;\n}\n\ninterface RemoveNavigationLayoutItemAtLocationResult {\n item: NavigationLayoutItem;\n items: NavigationLayoutItem[];\n}\n\ninterface InsertNavigationLayoutItemAtLocationOptions {\n items: NavigationLayoutItem[];\n location: NavigationLayoutItemLocation;\n item: NavigationLayoutItem;\n}\n\ninterface NormalizeNavigationLayoutReorderTargetOptions {\n source: NavigationLayoutItemReorderEvent['source'];\n target: NavigationLayoutItemReorderEvent['target'];\n}\n\ninterface IsNavigationLayoutItemReorderEventValidOptions {\n items: NavigationLayoutItem[];\n event: NavigationLayoutItemReorderEvent;\n}\n\ninterface ReorderNavigationLayoutGroupItemsOptions {\n items: NavigationLayoutItem[];\n event: NavigationLayoutItemReorderEvent;\n}\n\ninterface ReorderNavigationLayoutGroupsOptions {\n groups: NavigationLayoutGroup[];\n event: NavigationLayoutItemReorderEvent;\n}\n\ninterface IsNavigationLayoutReorderTargetEqualOptions {\n targetA: NavigationLayoutItemReorderTarget | null;\n targetB: NavigationLayoutItemReorderTarget | null;\n}\n\nconst areNavigationLayoutParentIdsEqual = ({\n parentIdsA,\n parentIdsB,\n}: AreNavigationLayoutParentIdsEqualOptions): boolean => {\n if (parentIdsA.length !== parentIdsB.length) {\n return false;\n }\n\n return parentIdsA.every((parentId, index) => parentId === parentIdsB[index]);\n};\n\nconst cloneNavigationLayoutItems = ({\n items,\n}: CloneNavigationLayoutItemsOptions): NavigationLayoutItem[] =>\n items.map((item) => ({\n ...item,\n children: item.children ? cloneNavigationLayoutItems({ items: item.children }) : undefined,\n }));\n\nconst findNavigationLayoutItemById = ({\n items,\n itemId,\n}: FindNavigationLayoutItemByIdOptions): NavigationLayoutItem | null => {\n for (const item of items) {\n if (item.id === itemId) {\n return item;\n }\n\n if (item.children?.length) {\n const nestedItem = findNavigationLayoutItemById({\n items: item.children,\n itemId,\n });\n\n if (nestedItem) {\n return nestedItem;\n }\n }\n }\n\n return null;\n};\n\nconst getNavigationLayoutItemsByParentIds = ({\n items,\n parentIds,\n shouldCreateMissingChildren = false,\n shouldReturnEmptyChildrenAtLeaf = false,\n}: GetNavigationLayoutItemsByParentIdsOptions): NavigationLayoutItem[] | null => {\n if (parentIds.length === 0) {\n return items;\n }\n\n const [parentId, ...remainingParentIds] = parentIds;\n const parentItem = items.find(({ id }) => id === parentId);\n\n if (!parentItem) {\n return null;\n }\n\n if (!parentItem.children) {\n if (remainingParentIds.length > 0) {\n return null;\n }\n\n if (!shouldCreateMissingChildren) {\n return shouldReturnEmptyChildrenAtLeaf ? [] : null;\n }\n\n parentItem.children = [];\n }\n\n return getNavigationLayoutItemsByParentIds({\n items: parentItem.children,\n parentIds: remainingParentIds,\n shouldCreateMissingChildren,\n shouldReturnEmptyChildrenAtLeaf,\n });\n};\n\nconst removeNavigationLayoutItemAtLocation = ({\n items,\n location,\n}: RemoveNavigationLayoutItemAtLocationOptions): RemoveNavigationLayoutItemAtLocationResult | null => {\n const parentItems = getNavigationLayoutItemsByParentIds({\n items,\n parentIds: location.parentIds,\n shouldCreateMissingChildren: true,\n });\n\n if (!parentItems || location.index < 0 || location.index >= parentItems.length) {\n return null;\n }\n\n const [item] = parentItems.splice(location.index, 1);\n\n if (!item) {\n return null;\n }\n\n return {\n item,\n items,\n };\n};\n\nconst insertNavigationLayoutItemAtLocation = ({\n items,\n location,\n item,\n}: InsertNavigationLayoutItemAtLocationOptions): NavigationLayoutItem[] => {\n const parentItems = getNavigationLayoutItemsByParentIds({\n items,\n parentIds: location.parentIds,\n shouldCreateMissingChildren: true,\n });\n\n if (!parentItems) {\n return items;\n }\n\n const nextIndex = Math.max(0, Math.min(location.index, parentItems.length));\n\n parentItems.splice(nextIndex, 0, item);\n\n return items;\n};\n\nconst normalizeNavigationLayoutReorderTarget = ({\n source,\n target,\n}: NormalizeNavigationLayoutReorderTargetOptions): NavigationLayoutItemReorderTarget => {\n if (\n areNavigationLayoutParentIdsEqual({\n parentIdsA: source.parentIds,\n parentIdsB: target.parentIds,\n }) &&\n source.index < target.index\n ) {\n return {\n ...target,\n index: target.index - 1,\n };\n }\n\n return target;\n};\n\nexport function isNavigationLayoutReorderTargetEqual({\n targetA,\n targetB,\n}: IsNavigationLayoutReorderTargetEqualOptions): boolean {\n if (!targetA || !targetB) {\n return targetA === targetB;\n }\n\n return (\n targetA.itemId === targetB.itemId &&\n targetA.index === targetB.index &&\n targetA.placement === targetB.placement &&\n areNavigationLayoutParentIdsEqual({\n parentIdsA: targetA.parentIds,\n parentIdsB: targetB.parentIds,\n })\n );\n}\n\nexport function isNavigationLayoutItemReorderEventValid({\n items,\n event,\n}: IsNavigationLayoutItemReorderEventValidOptions): boolean {\n const { itemId, source, target } = event;\n const sourceParentItems = getNavigationLayoutItemsByParentIds({\n items,\n parentIds: source.parentIds,\n });\n const sourceItem = sourceParentItems?.[source.index];\n\n if (!sourceParentItems || sourceItem?.id !== itemId || source.itemId !== itemId) {\n return false;\n }\n\n if (sourceItem.isDisabled) {\n return false;\n }\n\n if (target.itemId === itemId || target.parentIds.includes(itemId)) {\n return false;\n }\n\n if (target.placement === 'inside' && !target.itemId) {\n return false;\n }\n\n const targetParentItems = getNavigationLayoutItemsByParentIds({\n items,\n parentIds: target.parentIds,\n shouldReturnEmptyChildrenAtLeaf: true,\n });\n\n if (!targetParentItems) {\n return false;\n }\n\n if (target.index < 0 || target.index > targetParentItems.length) {\n return false;\n }\n\n if (target.placement === 'inside' && target.itemId) {\n const targetItem = findNavigationLayoutItemById({\n items,\n itemId: target.itemId,\n });\n\n if (!targetItem || targetItem.isDisabled) {\n return false;\n }\n }\n\n const normalizedTarget = normalizeNavigationLayoutReorderTarget({\n source,\n target,\n });\n\n return !(\n areNavigationLayoutParentIdsEqual({\n parentIdsA: source.parentIds,\n parentIdsB: normalizedTarget.parentIds,\n }) && source.index === normalizedTarget.index\n );\n}\n\nexport function reorderNavigationLayoutGroupItems({\n items,\n event,\n}: ReorderNavigationLayoutGroupItemsOptions): NavigationLayoutItem[] {\n if (!isNavigationLayoutItemReorderEventValid({ items, event })) {\n return items;\n }\n\n const nextItems = cloneNavigationLayoutItems({ items });\n const sourceResult = removeNavigationLayoutItemAtLocation({\n items: nextItems,\n location: event.source,\n });\n\n if (!sourceResult) {\n return items;\n }\n\n const target = normalizeNavigationLayoutReorderTarget({\n source: event.source,\n target: event.target,\n });\n\n return insertNavigationLayoutItemAtLocation({\n items: sourceResult.items,\n location: target,\n item: sourceResult.item,\n });\n}\n\nexport function reorderNavigationLayoutGroups({\n groups,\n event,\n}: ReorderNavigationLayoutGroupsOptions): NavigationLayoutGroup[] {\n const group = groups.find(({ id }) => id === event.groupId);\n\n if (!group) {\n return groups;\n }\n\n if (\n !isNavigationLayoutItemReorderEventValid({\n items: group.items,\n event,\n })\n ) {\n return groups;\n }\n\n return groups.map((currentGroup) => {\n if (currentGroup.id !== event.groupId) {\n return currentGroup;\n }\n\n return {\n ...currentGroup,\n items: reorderNavigationLayoutGroupItems({\n items: currentGroup.items,\n event,\n }),\n };\n });\n}\n"],"mappings":";;;;;;;;;AAAA;;AAuEA,MAAMA,iCAAiC,GAAGA,CAAC;EACvCC,UAAU;EACVC;AACsC,CAAC,KAAc;EACrD,IAAID,UAAU,CAACE,MAAM,KAAKD,UAAU,CAACC,MAAM,EAAE;IACzC,OAAO,KAAK;EAChB;EAEA,OAAOF,UAAU,CAACG,KAAK,CAAC,CAACC,QAAQ,EAAEC,KAAK,KAAKD,QAAQ,KAAKH,UAAU,CAACI,KAAK,CAAC,CAAC;AAChF,CAAC;AAED,MAAMC,0BAA0B,GAAGA,CAAC;EAChCC;AAC+B,CAAC,KAChCA,KAAK,CAACC,GAAG,CAAEC,IAAI,KAAM;EACjB,GAAGA,IAAI;EACPC,QAAQ,EAAED,IAAI,CAACC,QAAQ,G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KAAK,CAAC/C,KAAK;IAClBkC;EACJ,CAAC,CAAC,EACJ;IACE,OAAOY,MAAM;EACjB;EAEA,OAAOA,MAAM,CAAC7C,GAAG,CAAEgD,YAAY,IAAK;IAChC,IAAIA,YAAY,CAACzC,EAAE,KAAK0B,KAAK,CAACc,OAAO,EAAE;MACnC,OAAOC,YAAY;IACvB;IAEA,OAAO;MACH,GAAGA,YAAY;MACfjD,KAAK,EAAE0C,iCAAiC,CAAC;QACrC1C,KAAK,EAAEiD,YAAY,CAACjD,KAAK;QACzBkC;MACJ,CAAC;IACL,CAAC;EACL,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _NavigationHeader = require("./NavigationHeader.styles");
|
|
9
|
+
var _MenuToggle = _interopRequireDefault(require("./menu-toggle/MenuToggle"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const NavigationHeader = ({
|
|
12
|
+
color,
|
|
13
|
+
height,
|
|
14
|
+
safeAreas,
|
|
15
|
+
headerContent,
|
|
16
|
+
onMenuClick,
|
|
17
|
+
isMobileOpen,
|
|
18
|
+
isMobile
|
|
19
|
+
}) => /*#__PURE__*/_react.default.createElement(_NavigationHeader.StyledNavigationHeader, {
|
|
20
|
+
$color: color,
|
|
21
|
+
$height: height,
|
|
22
|
+
$safeAreas: safeAreas,
|
|
23
|
+
className: "navigation-layout-header"
|
|
24
|
+
}, isMobile && /*#__PURE__*/_react.default.createElement(_MenuToggle.default, {
|
|
25
|
+
color: color,
|
|
26
|
+
isOpen: isMobileOpen,
|
|
27
|
+
onClick: onMenuClick
|
|
28
|
+
}), headerContent);
|
|
29
|
+
NavigationHeader.displayName = 'NavigationHeader';
|
|
30
|
+
var _default = exports.default = NavigationHeader;
|
|
31
|
+
//# sourceMappingURL=NavigationHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationHeader.js","names":["_react","_interopRequireDefault","require","_NavigationHeader","_MenuToggle","e","__esModule","default","NavigationHeader","color","height","safeAreas","headerContent","onMenuClick","isMobileOpen","isMobile","createElement","StyledNavigationHeader","$color","$height","$safeAreas","className","isOpen","onClick","displayName","_default","exports"],"sources":["../../../../../src/components/navigation-layout/navigation-header/NavigationHeader.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { StyledNavigationHeader } from './NavigationHeader.styles';\nimport { NavigationHeaderProps } from './NavigationHeader.types';\nimport MenuToggle from './menu-toggle/MenuToggle';\n\nconst NavigationHeader: FC<NavigationHeaderProps> = ({\n color,\n height,\n safeAreas,\n headerContent,\n onMenuClick,\n isMobileOpen,\n isMobile,\n}) => (\n <StyledNavigationHeader\n $color={color}\n $height={height}\n $safeAreas={safeAreas}\n className=\"navigation-layout-header\"\n >\n {isMobile && <MenuToggle color={color} isOpen={isMobileOpen} onClick={onMenuClick} />}\n {headerContent}\n </StyledNavigationHeader>\n);\nNavigationHeader.displayName = 'NavigationHeader';\n\nexport default NavigationHeader;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAkD,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElD,MAAMG,gBAA2C,GAAGA,CAAC;EACjDC,KAAK;EACLC,MAAM;EACNC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,YAAY;EACZC;AACJ,CAAC,kBACGf,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACb,iBAAA,CAAAc,sBAAsB;EACnBC,MAAM,EAAET,KAAM;EACdU,OAAO,EAAET,MAAO;EAChBU,UAAU,EAAET,SAAU;EACtBU,SAAS,EAAC;AAA0B,GAEnCN,QAAQ,iBAAIf,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACZ,WAAA,CAAAG,OAAU;EAACE,KAAK,EAAEA,KAAM;EAACa,MAAM,EAAER,YAAa;EAACS,OAAO,EAAEV;AAAY,CAAE,CAAC,EACpFD,aACmB,CAC3B;AACDJ,gBAAgB,CAACgB,WAAW,GAAG,kBAAkB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAEnCC,gBAAgB","ignoreList":[]}
|