@chayns-components/navigation 5.0.64 → 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,67 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { motion } from 'motion/react';
|
|
3
|
+
export const StyledNavigationLayout = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
height: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
min-height: 0;
|
|
9
|
+
position: relative;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
`;
|
|
12
|
+
export const StyledMotionNavigationLayoutContentWrapper = styled(motion.div)`
|
|
13
|
+
display: flex;
|
|
14
|
+
flex: 1;
|
|
15
|
+
width: 100%;
|
|
16
|
+
min-height: 0;
|
|
17
|
+
`;
|
|
18
|
+
export const StyledNavigationLayoutContent = styled.div`
|
|
19
|
+
${({
|
|
20
|
+
$isCornerContent
|
|
21
|
+
}) => $isCornerContent && css`
|
|
22
|
+
border-top-left-radius: 10px;
|
|
23
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0 0 20px 16px;
|
|
24
|
+
`}
|
|
25
|
+
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
|
|
28
|
+
flex: 1;
|
|
29
|
+
width: ${({
|
|
30
|
+
$isMobile
|
|
31
|
+
}) => $isMobile ? '100vw' : '100%'};
|
|
32
|
+
min-width: ${({
|
|
33
|
+
$isMobile
|
|
34
|
+
}) => $isMobile ? '100vw' : 0};
|
|
35
|
+
min-height: 0;
|
|
36
|
+
|
|
37
|
+
position: relative;
|
|
38
|
+
`;
|
|
39
|
+
export const StyledMotionNavigationLayoutContentOverlay = styled(motion.div)`
|
|
40
|
+
position: absolute;
|
|
41
|
+
top: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
right: 0;
|
|
44
|
+
bottom: 0;
|
|
45
|
+
|
|
46
|
+
z-index: 3;
|
|
47
|
+
|
|
48
|
+
background-color: rgb(0, 0, 0);
|
|
49
|
+
`;
|
|
50
|
+
export const StyledNavigationLayoutBackground = styled.div`
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 0;
|
|
53
|
+
bottom: 0;
|
|
54
|
+
left: 0;
|
|
55
|
+
right: 0;
|
|
56
|
+
z-index: -100;
|
|
57
|
+
|
|
58
|
+
background-color: ${({
|
|
59
|
+
$backgroundColor
|
|
60
|
+
}) => $backgroundColor};
|
|
61
|
+
`;
|
|
62
|
+
export const StyledNavigationLayoutBackgroundImage = styled.img`
|
|
63
|
+
object-fit: cover;
|
|
64
|
+
height: 100%;
|
|
65
|
+
width: 100%;
|
|
66
|
+
`;
|
|
67
|
+
//# sourceMappingURL=NavigationLayout.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationLayout.styles.js","names":["styled","css","motion","StyledNavigationLayout","div","StyledMotionNavigationLayoutContentWrapper","StyledNavigationLayoutContent","$isCornerContent","$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,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,MAAM,QAAQ,cAAc;AAErC,OAAO,MAAMC,sBAAsB,GAAGH,MAAM,CAACI,GAAG;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,0CAA0C,GAAGL,MAAM,CAACE,MAAM,CAACE,GAAG,CAAC;AAC5E;AACA;AACA;AACA;AACA,CAAC;AAOD,OAAO,MAAME,6BAA6B,GAAGN,MAAM,CAACI,GAAuC;AAC3F,MAAM,CAAC;EAAEG;AAAiB,CAAC,KACnBA,gBAAgB,IAChBN,GAAG;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa,CAAC;EAAEO;AAAU,CAAC,KAAMA,SAAS,GAAG,OAAO,GAAG,MAAO;AAC9D,iBAAiB,CAAC;EAAEA;AAAU,CAAC,KAAMA,SAAS,GAAG,OAAO,GAAG,CAAE;AAC7D;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,0CAA0C,GAAGT,MAAM,CAACE,MAAM,CAACE,GAAG,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAMM,gCAAgC,GAAGV,MAAM,CAACI,GAA0C;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEO;AAAiB,CAAC,KAAKA,gBAAgB;AAClE,CAAC;AAED,OAAO,MAAMC,qCAAqC,GAAGZ,MAAM,CAACa,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,251 @@
|
|
|
1
|
+
// noinspection JSUnusedGlobalSymbols
|
|
2
|
+
|
|
3
|
+
const areNavigationLayoutParentIdsEqual = ({
|
|
4
|
+
parentIdsA,
|
|
5
|
+
parentIdsB
|
|
6
|
+
}) => {
|
|
7
|
+
if (parentIdsA.length !== parentIdsB.length) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return parentIdsA.every((parentId, index) => parentId === parentIdsB[index]);
|
|
11
|
+
};
|
|
12
|
+
const cloneNavigationLayoutItems = ({
|
|
13
|
+
items
|
|
14
|
+
}) => items.map(item => ({
|
|
15
|
+
...item,
|
|
16
|
+
children: item.children ? cloneNavigationLayoutItems({
|
|
17
|
+
items: item.children
|
|
18
|
+
}) : undefined
|
|
19
|
+
}));
|
|
20
|
+
const findNavigationLayoutItemById = ({
|
|
21
|
+
items,
|
|
22
|
+
itemId
|
|
23
|
+
}) => {
|
|
24
|
+
for (const item of items) {
|
|
25
|
+
if (item.id === itemId) {
|
|
26
|
+
return item;
|
|
27
|
+
}
|
|
28
|
+
if (item.children?.length) {
|
|
29
|
+
const nestedItem = findNavigationLayoutItemById({
|
|
30
|
+
items: item.children,
|
|
31
|
+
itemId
|
|
32
|
+
});
|
|
33
|
+
if (nestedItem) {
|
|
34
|
+
return nestedItem;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
const getNavigationLayoutItemsByParentIds = ({
|
|
41
|
+
items,
|
|
42
|
+
parentIds,
|
|
43
|
+
shouldCreateMissingChildren = false,
|
|
44
|
+
shouldReturnEmptyChildrenAtLeaf = false
|
|
45
|
+
}) => {
|
|
46
|
+
if (parentIds.length === 0) {
|
|
47
|
+
return items;
|
|
48
|
+
}
|
|
49
|
+
const [parentId, ...remainingParentIds] = parentIds;
|
|
50
|
+
const parentItem = items.find(({
|
|
51
|
+
id
|
|
52
|
+
}) => id === parentId);
|
|
53
|
+
if (!parentItem) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
if (!parentItem.children) {
|
|
57
|
+
if (remainingParentIds.length > 0) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
if (!shouldCreateMissingChildren) {
|
|
61
|
+
return shouldReturnEmptyChildrenAtLeaf ? [] : null;
|
|
62
|
+
}
|
|
63
|
+
parentItem.children = [];
|
|
64
|
+
}
|
|
65
|
+
return getNavigationLayoutItemsByParentIds({
|
|
66
|
+
items: parentItem.children,
|
|
67
|
+
parentIds: remainingParentIds,
|
|
68
|
+
shouldCreateMissingChildren,
|
|
69
|
+
shouldReturnEmptyChildrenAtLeaf
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const removeNavigationLayoutItemAtLocation = ({
|
|
73
|
+
items,
|
|
74
|
+
location
|
|
75
|
+
}) => {
|
|
76
|
+
const parentItems = getNavigationLayoutItemsByParentIds({
|
|
77
|
+
items,
|
|
78
|
+
parentIds: location.parentIds,
|
|
79
|
+
shouldCreateMissingChildren: true
|
|
80
|
+
});
|
|
81
|
+
if (!parentItems || location.index < 0 || location.index >= parentItems.length) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
const [item] = parentItems.splice(location.index, 1);
|
|
85
|
+
if (!item) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
item,
|
|
90
|
+
items
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
const insertNavigationLayoutItemAtLocation = ({
|
|
94
|
+
items,
|
|
95
|
+
location,
|
|
96
|
+
item
|
|
97
|
+
}) => {
|
|
98
|
+
const parentItems = getNavigationLayoutItemsByParentIds({
|
|
99
|
+
items,
|
|
100
|
+
parentIds: location.parentIds,
|
|
101
|
+
shouldCreateMissingChildren: true
|
|
102
|
+
});
|
|
103
|
+
if (!parentItems) {
|
|
104
|
+
return items;
|
|
105
|
+
}
|
|
106
|
+
const nextIndex = Math.max(0, Math.min(location.index, parentItems.length));
|
|
107
|
+
parentItems.splice(nextIndex, 0, item);
|
|
108
|
+
return items;
|
|
109
|
+
};
|
|
110
|
+
const normalizeNavigationLayoutReorderTarget = ({
|
|
111
|
+
source,
|
|
112
|
+
target
|
|
113
|
+
}) => {
|
|
114
|
+
if (areNavigationLayoutParentIdsEqual({
|
|
115
|
+
parentIdsA: source.parentIds,
|
|
116
|
+
parentIdsB: target.parentIds
|
|
117
|
+
}) && source.index < target.index) {
|
|
118
|
+
return {
|
|
119
|
+
...target,
|
|
120
|
+
index: target.index - 1
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return target;
|
|
124
|
+
};
|
|
125
|
+
export function isNavigationLayoutReorderTargetEqual({
|
|
126
|
+
targetA,
|
|
127
|
+
targetB
|
|
128
|
+
}) {
|
|
129
|
+
if (!targetA || !targetB) {
|
|
130
|
+
return targetA === targetB;
|
|
131
|
+
}
|
|
132
|
+
return targetA.itemId === targetB.itemId && targetA.index === targetB.index && targetA.placement === targetB.placement && areNavigationLayoutParentIdsEqual({
|
|
133
|
+
parentIdsA: targetA.parentIds,
|
|
134
|
+
parentIdsB: targetB.parentIds
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export function isNavigationLayoutItemReorderEventValid({
|
|
138
|
+
items,
|
|
139
|
+
event
|
|
140
|
+
}) {
|
|
141
|
+
const {
|
|
142
|
+
itemId,
|
|
143
|
+
source,
|
|
144
|
+
target
|
|
145
|
+
} = event;
|
|
146
|
+
const sourceParentItems = getNavigationLayoutItemsByParentIds({
|
|
147
|
+
items,
|
|
148
|
+
parentIds: source.parentIds
|
|
149
|
+
});
|
|
150
|
+
const sourceItem = sourceParentItems?.[source.index];
|
|
151
|
+
if (!sourceParentItems || sourceItem?.id !== itemId || source.itemId !== itemId) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
if (sourceItem.isDisabled) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
if (target.itemId === itemId || target.parentIds.includes(itemId)) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
if (target.placement === 'inside' && !target.itemId) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
const targetParentItems = getNavigationLayoutItemsByParentIds({
|
|
164
|
+
items,
|
|
165
|
+
parentIds: target.parentIds,
|
|
166
|
+
shouldReturnEmptyChildrenAtLeaf: true
|
|
167
|
+
});
|
|
168
|
+
if (!targetParentItems) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
if (target.index < 0 || target.index > targetParentItems.length) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
if (target.placement === 'inside' && target.itemId) {
|
|
175
|
+
const targetItem = findNavigationLayoutItemById({
|
|
176
|
+
items,
|
|
177
|
+
itemId: target.itemId
|
|
178
|
+
});
|
|
179
|
+
if (!targetItem || targetItem.isDisabled) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const normalizedTarget = normalizeNavigationLayoutReorderTarget({
|
|
184
|
+
source,
|
|
185
|
+
target
|
|
186
|
+
});
|
|
187
|
+
return !(areNavigationLayoutParentIdsEqual({
|
|
188
|
+
parentIdsA: source.parentIds,
|
|
189
|
+
parentIdsB: normalizedTarget.parentIds
|
|
190
|
+
}) && source.index === normalizedTarget.index);
|
|
191
|
+
}
|
|
192
|
+
export function reorderNavigationLayoutGroupItems({
|
|
193
|
+
items,
|
|
194
|
+
event
|
|
195
|
+
}) {
|
|
196
|
+
if (!isNavigationLayoutItemReorderEventValid({
|
|
197
|
+
items,
|
|
198
|
+
event
|
|
199
|
+
})) {
|
|
200
|
+
return items;
|
|
201
|
+
}
|
|
202
|
+
const nextItems = cloneNavigationLayoutItems({
|
|
203
|
+
items
|
|
204
|
+
});
|
|
205
|
+
const sourceResult = removeNavigationLayoutItemAtLocation({
|
|
206
|
+
items: nextItems,
|
|
207
|
+
location: event.source
|
|
208
|
+
});
|
|
209
|
+
if (!sourceResult) {
|
|
210
|
+
return items;
|
|
211
|
+
}
|
|
212
|
+
const target = normalizeNavigationLayoutReorderTarget({
|
|
213
|
+
source: event.source,
|
|
214
|
+
target: event.target
|
|
215
|
+
});
|
|
216
|
+
return insertNavigationLayoutItemAtLocation({
|
|
217
|
+
items: sourceResult.items,
|
|
218
|
+
location: target,
|
|
219
|
+
item: sourceResult.item
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
export function reorderNavigationLayoutGroups({
|
|
223
|
+
groups,
|
|
224
|
+
event
|
|
225
|
+
}) {
|
|
226
|
+
const group = groups.find(({
|
|
227
|
+
id
|
|
228
|
+
}) => id === event.groupId);
|
|
229
|
+
if (!group) {
|
|
230
|
+
return groups;
|
|
231
|
+
}
|
|
232
|
+
if (!isNavigationLayoutItemReorderEventValid({
|
|
233
|
+
items: group.items,
|
|
234
|
+
event
|
|
235
|
+
})) {
|
|
236
|
+
return groups;
|
|
237
|
+
}
|
|
238
|
+
return groups.map(currentGroup => {
|
|
239
|
+
if (currentGroup.id !== event.groupId) {
|
|
240
|
+
return currentGroup;
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
...currentGroup,
|
|
244
|
+
items: reorderNavigationLayoutGroupItems({
|
|
245
|
+
items: currentGroup.items,
|
|
246
|
+
event
|
|
247
|
+
})
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
//# 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","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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,CAAC,KAAKA,EAAE,KAAK0B,KAAK,CAACc,OAAO,CAAC;EAE3D,IAAI,CAACD,KAAK,EAAE;IACR,OAAOD,MAAM;EACjB;EAEA,IACI,CAACb,uCAAuC,CAAC;IACrChC,KAAK,EAAE8C,KAAK,CAAC9C,KAAK;IAClBiC;EACJ,CAAC,CAAC,EACJ;IACE,OAAOY,MAAM;EACjB;EAEA,OAAOA,MAAM,CAAC5C,GAAG,CAAE+C,YAAY,IAAK;IAChC,IAAIA,YAAY,CAACzC,EAAE,KAAK0B,KAAK,CAACc,OAAO,EAAE;MACnC,OAAOC,YAAY;IACvB;IAEA,OAAO;MACH,GAAGA,YAAY;MACfhD,KAAK,EAAEyC,iCAAiC,CAAC;QACrCzC,KAAK,EAAEgD,YAAY,CAAChD,KAAK;QACzBiC;MACJ,CAAC;IACL,CAAC;EACL,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyledNavigationHeader } from './NavigationHeader.styles';
|
|
3
|
+
import MenuToggle from './menu-toggle/MenuToggle';
|
|
4
|
+
const NavigationHeader = ({
|
|
5
|
+
color,
|
|
6
|
+
height,
|
|
7
|
+
safeAreas,
|
|
8
|
+
headerContent,
|
|
9
|
+
onMenuClick,
|
|
10
|
+
isMobileOpen,
|
|
11
|
+
isMobile
|
|
12
|
+
}) => /*#__PURE__*/React.createElement(StyledNavigationHeader, {
|
|
13
|
+
$color: color,
|
|
14
|
+
$height: height,
|
|
15
|
+
$safeAreas: safeAreas,
|
|
16
|
+
className: "navigation-layout-header"
|
|
17
|
+
}, isMobile && /*#__PURE__*/React.createElement(MenuToggle, {
|
|
18
|
+
color: color,
|
|
19
|
+
isOpen: isMobileOpen,
|
|
20
|
+
onClick: onMenuClick
|
|
21
|
+
}), headerContent);
|
|
22
|
+
NavigationHeader.displayName = 'NavigationHeader';
|
|
23
|
+
export default NavigationHeader;
|
|
24
|
+
//# sourceMappingURL=NavigationHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationHeader.js","names":["React","StyledNavigationHeader","MenuToggle","NavigationHeader","color","height","safeAreas","headerContent","onMenuClick","isMobileOpen","isMobile","createElement","$color","$height","$safeAreas","className","isOpen","onClick","displayName"],"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,OAAOA,KAAK,MAAc,OAAO;AACjC,SAASC,sBAAsB,QAAQ,2BAA2B;AAElE,OAAOC,UAAU,MAAM,0BAA0B;AAEjD,MAAMC,gBAA2C,GAAGA,CAAC;EACjDC,KAAK;EACLC,MAAM;EACNC,SAAS;EACTC,aAAa;EACbC,WAAW;EACXC,YAAY;EACZC;AACJ,CAAC,kBACGV,KAAA,CAAAW,aAAA,CAACV,sBAAsB;EACnBW,MAAM,EAAER,KAAM;EACdS,OAAO,EAAER,MAAO;EAChBS,UAAU,EAAER,SAAU;EACtBS,SAAS,EAAC;AAA0B,GAEnCL,QAAQ,iBAAIV,KAAA,CAAAW,aAAA,CAACT,UAAU;EAACE,KAAK,EAAEA,KAAM;EAACY,MAAM,EAAEP,YAAa;EAACQ,OAAO,EAAET;AAAY,CAAE,CAAC,EACpFD,aACmB,CAC3B;AACDJ,gBAAgB,CAACe,WAAW,GAAG,kBAAkB;AAEjD,eAAef,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const StyledNavigationHeader = styled.div`
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: ${({
|
|
5
|
+
$height
|
|
6
|
+
}) => $height}px;
|
|
7
|
+
color: ${({
|
|
8
|
+
$color
|
|
9
|
+
}) => $color};
|
|
10
|
+
|
|
11
|
+
padding: ${({
|
|
12
|
+
$safeAreas
|
|
13
|
+
}) => `${$safeAreas?.top || 0}px ${$safeAreas?.right || 16}px 0
|
|
14
|
+
${$safeAreas?.left || 16}px`};
|
|
15
|
+
|
|
16
|
+
// Need for electron dragging
|
|
17
|
+
-webkit-app-region: drag;
|
|
18
|
+
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 8px;
|
|
22
|
+
`;
|
|
23
|
+
//# sourceMappingURL=NavigationHeader.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationHeader.styles.js","names":["styled","StyledNavigationHeader","div","$height","$color","$safeAreas","top","right","left"],"sources":["../../../../../src/components/navigation-layout/navigation-header/NavigationHeader.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '@chayns-components/core';\nimport { NavigationLayoutConfig } from '../NavigationLayout.types';\n\ntype StyledNavigationHeaderProps = WithTheme<{\n $height: number;\n $color: string;\n $safeAreas: NavigationLayoutConfig['safeAreas'];\n}>;\n\nexport const StyledNavigationHeader = styled.div<StyledNavigationHeaderProps>`\n width: 100%;\n height: ${({ $height }) => $height}px;\n color: ${({ $color }) => $color};\n\n padding: ${({ $safeAreas }) => `${$safeAreas?.top || 0}px ${$safeAreas?.right || 16}px 0\n ${$safeAreas?.left || 16}px`};\n\n // Need for electron dragging\n -webkit-app-region: drag;\n\n display: flex;\n align-items: center;\n gap: 8px;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAUtC,OAAO,MAAMC,sBAAsB,GAAGD,MAAM,CAACE,GAAgC;AAC7E;AACA,cAAc,CAAC;EAAEC;AAAQ,CAAC,KAAKA,OAAO;AACtC,aAAa,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AACnC;AACA,eAAe,CAAC;EAAEC;AAAW,CAAC,KAAK,GAAGA,UAAU,EAAEC,GAAG,IAAI,CAAC,MAAMD,UAAU,EAAEE,KAAK,IAAI,EAAE;AACvF,UAAUF,UAAU,EAAEG,IAAI,IAAI,EAAE,IAAI;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationHeader.types.js","names":[],"sources":["../../../../../src/components/navigation-layout/navigation-header/NavigationHeader.types.ts"],"sourcesContent":["import { NavigationLayoutConfig, NavigationLayoutProps } from '../NavigationLayout.types';\n\nexport interface NavigationHeaderProps {\n height: number;\n color: string;\n safeAreas?: NavigationLayoutConfig['safeAreas'];\n headerContent: NavigationLayoutProps['headerContent'];\n isMobile: NavigationLayoutProps['isMobile'];\n isMobileOpen: boolean;\n onMenuClick: () => void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { motion, MotionConfig } from 'motion/react';
|
|
3
|
+
import { StyledMotionMenuToggle } from './MenuToggle.styles';
|
|
4
|
+
const Path = ({
|
|
5
|
+
d,
|
|
6
|
+
variants
|
|
7
|
+
}) => /*#__PURE__*/React.createElement(motion.path, {
|
|
8
|
+
d: d,
|
|
9
|
+
strokeLinecap: "round",
|
|
10
|
+
strokeWidth: "3",
|
|
11
|
+
variants: variants
|
|
12
|
+
});
|
|
13
|
+
const MenuToggle = ({
|
|
14
|
+
isOpen,
|
|
15
|
+
onClick,
|
|
16
|
+
color
|
|
17
|
+
}) => /*#__PURE__*/React.createElement(StyledMotionMenuToggle, {
|
|
18
|
+
animate: isOpen ? 'open' : 'closed',
|
|
19
|
+
onClick: onClick,
|
|
20
|
+
type: "button"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(MotionConfig, {
|
|
22
|
+
transition: {
|
|
23
|
+
duration: 0.3,
|
|
24
|
+
type: 'tween'
|
|
25
|
+
}
|
|
26
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
27
|
+
width: "22",
|
|
28
|
+
height: "22",
|
|
29
|
+
viewBox: "0 0 23 23",
|
|
30
|
+
stroke: color
|
|
31
|
+
}, /*#__PURE__*/React.createElement(Path, {
|
|
32
|
+
variants: {
|
|
33
|
+
closed: {
|
|
34
|
+
d: 'M 2 2.5 L 20 2.5'
|
|
35
|
+
},
|
|
36
|
+
open: {
|
|
37
|
+
d: 'M 3 16.5 L 17 2.5'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}), /*#__PURE__*/React.createElement(Path, {
|
|
41
|
+
d: "M 2 9.423 L 20 9.423",
|
|
42
|
+
variants: {
|
|
43
|
+
closed: {
|
|
44
|
+
opacity: 1,
|
|
45
|
+
scale: 1
|
|
46
|
+
},
|
|
47
|
+
open: {
|
|
48
|
+
opacity: 0,
|
|
49
|
+
scale: 0
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}), /*#__PURE__*/React.createElement(Path, {
|
|
53
|
+
variants: {
|
|
54
|
+
closed: {
|
|
55
|
+
d: 'M 2 16.346 L 20 16.346'
|
|
56
|
+
},
|
|
57
|
+
open: {
|
|
58
|
+
d: 'M 3 2.5 L 17 16.346'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}))));
|
|
62
|
+
MenuToggle.displayName = 'MenuToggle';
|
|
63
|
+
export default MenuToggle;
|
|
64
|
+
//# sourceMappingURL=MenuToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuToggle.js","names":["React","motion","MotionConfig","StyledMotionMenuToggle","Path","d","variants","createElement","path","strokeLinecap","strokeWidth","MenuToggle","isOpen","onClick","color","animate","type","transition","duration","width","height","viewBox","stroke","closed","open","opacity","scale","displayName"],"sources":["../../../../../../src/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.tsx"],"sourcesContent":["import React, { FC, SVGAttributes } from 'react';\nimport { motion, MotionConfig, Variants } from 'motion/react';\nimport { StyledMotionMenuToggle } from './MenuToggle.styles';\n\ninterface PathProps {\n d?: SVGAttributes<unknown>['d'];\n variants: Variants;\n}\n\nconst Path: FC<PathProps> = ({ d, variants }) => (\n <motion.path d={d} strokeLinecap=\"round\" strokeWidth=\"3\" variants={variants} />\n);\n\ninterface MenuToggleProps {\n isOpen: boolean;\n onClick: () => void;\n color: string;\n}\n\nconst MenuToggle: FC<MenuToggleProps> = ({ isOpen, onClick, color }) => (\n <StyledMotionMenuToggle animate={isOpen ? 'open' : 'closed'} onClick={onClick} type=\"button\">\n <MotionConfig transition={{ duration: 0.3, type: 'tween' }}>\n <svg width=\"22\" height=\"22\" viewBox=\"0 0 23 23\" stroke={color}>\n <Path\n variants={{\n closed: { d: 'M 2 2.5 L 20 2.5' },\n open: { d: 'M 3 16.5 L 17 2.5' },\n }}\n />\n <Path\n d=\"M 2 9.423 L 20 9.423\"\n variants={{\n closed: { opacity: 1, scale: 1 },\n open: { opacity: 0, scale: 0 },\n }}\n />\n <Path\n variants={{\n closed: { d: 'M 2 16.346 L 20 16.346' },\n open: { d: 'M 3 2.5 L 17 16.346' },\n }}\n />\n </svg>\n </MotionConfig>\n </StyledMotionMenuToggle>\n);\n\nMenuToggle.displayName = 'MenuToggle';\n\nexport default MenuToggle;\n"],"mappings":"AAAA,OAAOA,KAAK,MAA6B,OAAO;AAChD,SAASC,MAAM,EAAEC,YAAY,QAAkB,cAAc;AAC7D,SAASC,sBAAsB,QAAQ,qBAAqB;AAO5D,MAAMC,IAAmB,GAAGA,CAAC;EAAEC,CAAC;EAAEC;AAAS,CAAC,kBACxCN,KAAA,CAAAO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ACK,CACM,CAC3B;AAEDM,UAAU,CAACgB,WAAW,GAAG,YAAY;AAErC,eAAehB,UAAU","ignoreList":[]}
|
package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { motion } from 'motion/react';
|
|
3
|
+
export const StyledMotionMenuToggle = styled(motion.button)`
|
|
4
|
+
background: transparent;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex: 0 0 auto;
|
|
8
|
+
margin-top: 4px;
|
|
9
|
+
padding: 0;
|
|
10
|
+
user-select: none;
|
|
11
|
+
`;
|
|
12
|
+
//# sourceMappingURL=MenuToggle.styles.js.map
|
package/lib/esm/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuToggle.styles.js","names":["styled","motion","StyledMotionMenuToggle","button"],"sources":["../../../../../../src/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { motion } from 'motion/react';\n\nexport const StyledMotionMenuToggle = styled(motion.button)`\n background: transparent;\n cursor: pointer;\n display: flex;\n flex: 0 0 auto;\n margin-top: 4px;\n padding: 0;\n user-select: none;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,MAAM,QAAQ,cAAc;AAErC,OAAO,MAAMC,sBAAsB,GAAGF,MAAM,CAACC,MAAM,CAACE,MAAM,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
const NavigationSidebarContext = /*#__PURE__*/createContext(null);
|
|
3
|
+
export const NavigationSidebarProvider = ({
|
|
4
|
+
children,
|
|
5
|
+
value
|
|
6
|
+
}) => /*#__PURE__*/React.createElement(NavigationSidebarContext.Provider, {
|
|
7
|
+
value: value
|
|
8
|
+
}, children);
|
|
9
|
+
NavigationSidebarProvider.displayName = 'NavigationSidebarProvider';
|
|
10
|
+
export const useNavigationSidebarContext = () => {
|
|
11
|
+
const context = useContext(NavigationSidebarContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error('useNavigationSidebarContext must be used within NavigationSidebarProvider.');
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=NavigationSidebar.context.js.map
|
package/lib/esm/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationSidebar.context.js","names":["React","createContext","useContext","NavigationSidebarContext","NavigationSidebarProvider","children","value","createElement","Provider","displayName","useNavigationSidebarContext","context","Error"],"sources":["../../../../../src/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.tsx"],"sourcesContent":["import React, { ReactNode, createContext, useContext } from 'react';\nimport { NavigationLayoutProps } from '../NavigationLayout.types';\n\ninterface NavigationSidebarContextValue {\n color: string;\n isCompact: boolean;\n selectedItemId?: NavigationLayoutProps['selectedItemId'];\n onItemClick?: NavigationLayoutProps['onItemClick'];\n shouldShowCollapsedLabel?: NavigationLayoutProps['shouldShowCollapsedLabel'];\n}\n\ninterface NavigationSidebarProviderProps {\n children: ReactNode;\n value: NavigationSidebarContextValue;\n}\n\nconst NavigationSidebarContext = createContext<NavigationSidebarContextValue | null>(null);\n\nexport const NavigationSidebarProvider = ({ children, value }: NavigationSidebarProviderProps) => (\n <NavigationSidebarContext.Provider value={value}>{children}</NavigationSidebarContext.Provider>\n);\n\nNavigationSidebarProvider.displayName = 'NavigationSidebarProvider';\n\nexport const useNavigationSidebarContext = (): NavigationSidebarContextValue => {\n const context = useContext(NavigationSidebarContext);\n\n if (!context) {\n throw new Error(\n 'useNavigationSidebarContext must be used within NavigationSidebarProvider.',\n );\n }\n\n return context;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAeC,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAgBnE,MAAMC,wBAAwB,gBAAGF,aAAa,CAAuC,IAAI,CAAC;AAE1F,OAAO,MAAMG,yBAAyB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAsC,CAAC,kBACzFN,KAAA,CAAAO,aAAA,CAACJ,wBAAwB,CAACK,QAAQ;EAACF,KAAK,EAAEA;AAAM,GAAED,QAA4C,CACjG;AAEDD,yBAAyB,CAACK,WAAW,GAAG,2BAA2B;AAEnE,OAAO,MAAMC,2BAA2B,GAAGA,CAAA,KAAqC;EAC5E,MAAMC,OAAO,GAAGT,UAAU,CAACC,wBAAwB,CAAC;EAEpD,IAAI,CAACQ,OAAO,EAAE;IACV,MAAM,IAAIC,KAAK,CACX,4EACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB,CAAC","ignoreList":[]}
|