@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,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledNavigationHeader = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const StyledNavigationHeader = exports.StyledNavigationHeader = _styledComponents.default.div`
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: ${({
|
|
12
|
+
$height
|
|
13
|
+
}) => $height}px;
|
|
14
|
+
color: ${({
|
|
15
|
+
$color
|
|
16
|
+
}) => $color};
|
|
17
|
+
|
|
18
|
+
padding: ${({
|
|
19
|
+
$safeAreas
|
|
20
|
+
}) => `${($safeAreas === null || $safeAreas === void 0 ? void 0 : $safeAreas.top) || 0}px ${($safeAreas === null || $safeAreas === void 0 ? void 0 : $safeAreas.right) || 16}px 0
|
|
21
|
+
${($safeAreas === null || $safeAreas === void 0 ? void 0 : $safeAreas.left) || 16}px`};
|
|
22
|
+
|
|
23
|
+
// Need for electron dragging
|
|
24
|
+
-webkit-app-region: drag;
|
|
25
|
+
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 8px;
|
|
29
|
+
`;
|
|
30
|
+
//# sourceMappingURL=NavigationHeader.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationHeader.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledNavigationHeader","exports","styled","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,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAUhC,MAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAGE,yBAAM,CAACC,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,GAAG,CAAAA,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEC,GAAG,KAAI,CAAC,MAAM,CAAAD,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEE,KAAK,KAAI,EAAE;AACvF,UAAU,CAAAF,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEG,IAAI,KAAI,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,71 @@
|
|
|
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 _react2 = require("motion/react");
|
|
9
|
+
var _MenuToggle = require("./MenuToggle.styles");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const Path = ({
|
|
12
|
+
d,
|
|
13
|
+
variants
|
|
14
|
+
}) => /*#__PURE__*/_react.default.createElement(_react2.motion.path, {
|
|
15
|
+
d: d,
|
|
16
|
+
strokeLinecap: "round",
|
|
17
|
+
strokeWidth: "3",
|
|
18
|
+
variants: variants
|
|
19
|
+
});
|
|
20
|
+
const MenuToggle = ({
|
|
21
|
+
isOpen,
|
|
22
|
+
onClick,
|
|
23
|
+
color
|
|
24
|
+
}) => /*#__PURE__*/_react.default.createElement(_MenuToggle.StyledMotionMenuToggle, {
|
|
25
|
+
animate: isOpen ? 'open' : 'closed',
|
|
26
|
+
onClick: onClick,
|
|
27
|
+
type: "button"
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement(_react2.MotionConfig, {
|
|
29
|
+
transition: {
|
|
30
|
+
duration: 0.3,
|
|
31
|
+
type: 'tween'
|
|
32
|
+
}
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
34
|
+
width: "22",
|
|
35
|
+
height: "22",
|
|
36
|
+
viewBox: "0 0 23 23",
|
|
37
|
+
stroke: color
|
|
38
|
+
}, /*#__PURE__*/_react.default.createElement(Path, {
|
|
39
|
+
variants: {
|
|
40
|
+
closed: {
|
|
41
|
+
d: 'M 2 2.5 L 20 2.5'
|
|
42
|
+
},
|
|
43
|
+
open: {
|
|
44
|
+
d: 'M 3 16.5 L 17 2.5'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}), /*#__PURE__*/_react.default.createElement(Path, {
|
|
48
|
+
d: "M 2 9.423 L 20 9.423",
|
|
49
|
+
variants: {
|
|
50
|
+
closed: {
|
|
51
|
+
opacity: 1,
|
|
52
|
+
scale: 1
|
|
53
|
+
},
|
|
54
|
+
open: {
|
|
55
|
+
opacity: 0,
|
|
56
|
+
scale: 0
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}), /*#__PURE__*/_react.default.createElement(Path, {
|
|
60
|
+
variants: {
|
|
61
|
+
closed: {
|
|
62
|
+
d: 'M 2 16.346 L 20 16.346'
|
|
63
|
+
},
|
|
64
|
+
open: {
|
|
65
|
+
d: 'M 3 2.5 L 17 16.346'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}))));
|
|
69
|
+
MenuToggle.displayName = 'MenuToggle';
|
|
70
|
+
var _default = exports.default = MenuToggle;
|
|
71
|
+
//# sourceMappingURL=MenuToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuToggle.js","names":["_react","_interopRequireDefault","require","_react2","_MenuToggle","e","__esModule","default","Path","d","variants","createElement","motion","path","strokeLinecap","strokeWidth","MenuToggle","isOpen","onClick","color","StyledMotionMenuToggle","animate","type","MotionConfig","transition","duration","width","height","viewBox","stroke","closed","open","opacity","scale","displayName","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAA6D,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAO7D,MAAMG,IAAmB,GAAGA,CAAC;EAAEC,CAAC;EAAEC;AAAS,CAAC,kBACxCV,MAAA,CAAAO,OAAA,CAAAI,aAAA,CAACR,OAAA,CAAAS,MAAM,CAACC,IAAI;EAACJ,CAAC,EAAEA,CAAE;EAACK,aAAa,EAAC,OAAO;EAACC,WAAW,EAAC,GAAG;EAACL,QAAQ,EAAEA;AAAS,CAAE,CACjF;AAQD,MAAMM,UAA+B,GAAGA,CAAC;EAAEC,MAAM;EAAEC,OAAO;EAAEC;AAAM,CAAC,kBAC/DnB,MAAA,CAAAO,OAAA,CAAAI,aAAA,CAACP,WAAA,CAAAgB,sBAAsB;EAACC,OAAO,EAAEJ,MAAM,GAAG,MAAM,GAAG,QAAS;EAACC,OAAO,EAAEA,OAAQ;EAACI,IAAI,EAAC;AAAQ,gBACxFtB,MAAA,CAAAO,OAAA,CAAAI,aAAA,CAACR,OAAA,CAAAoB,YAAY;EAACC,UAAU,EAAE;IAAEC,QAAQ,EAAE,GAAG;IAAEH,IAAI,EAAE;EAAQ;AAAE,gBACvDtB,MAAA,CAAAO,OAAA,CAAAI,aAAA;EAAKe,KAAK,EAAC,IAAI;EAACC,MAAM,EAAC,IAAI;EAACC,OAAO,EAAC,WAAW;EAACC,MAAM,EAAEV;AAAM,gBAC1DnB,MAAA,CAAAO,OAAA,CAAAI,aAAA,CAACH,IAAI;EACDE,QAAQ,EAAE;IACNoB,MAAM,EAAE;MAAErB,CAAC,EAAE;IAAmB,CAAC;IACjCsB,IAAI,EAAE;MAAEtB,CAAC,EAAE;IAAoB;EACnC;AAAE,CACL,CAAC,eACFT,MAAA,CAAAO,OAAA,CAAAI,aAAA,CAACH,IAAI;EACDC,CAAC,EAAC,sBAAsB;EACxBC,QAAQ,EAAE;IACNoB,MAAM,EAAE;MAAEE,OAAO,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAE,CAAC;IAChCF,IAAI,EAAE;MAAEC,OAAO,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAE;EACjC;AAAE,CACL,CAAC,eACFjC,MAAA,CAAAO,OAAA,CAAAI,aAAA,CAACH,IAAI;EACDE,QAAQ,EAAE;IACNoB,MAAM,EAAE;MAAErB,CAAC,EAAE;IAAyB,CAAC;IACvCsB,IAAI,EAAE;MAAEtB,CAAC,EAAE;IAAsB;EACrC;AAAE,CACL,CACA,CACK,CACM,CAC3B;AAEDO,UAAU,CAACkB,WAAW,GAAG,YAAY;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7B,OAAA,GAEvBS,UAAU","ignoreList":[]}
|
package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledMotionMenuToggle = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _react = require("motion/react");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const StyledMotionMenuToggle = exports.StyledMotionMenuToggle = (0, _styledComponents.default)(_react.motion.button)`
|
|
11
|
+
background: transparent;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex: 0 0 auto;
|
|
15
|
+
margin-top: 4px;
|
|
16
|
+
padding: 0;
|
|
17
|
+
user-select: none;
|
|
18
|
+
`;
|
|
19
|
+
//# sourceMappingURL=MenuToggle.styles.js.map
|
package/lib/cjs/components/navigation-layout/navigation-header/menu-toggle/MenuToggle.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuToggle.styles.js","names":["_styledComponents","_interopRequireDefault","require","_react","e","__esModule","default","StyledMotionMenuToggle","exports","styled","motion","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,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAsC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE/B,MAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,IAAAE,yBAAM,EAACC,aAAM,CAACC,MAAM,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useNavigationSidebarContext = exports.NavigationSidebarProvider = 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 NavigationSidebarContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
10
|
+
const NavigationSidebarProvider = ({
|
|
11
|
+
children,
|
|
12
|
+
value
|
|
13
|
+
}) => /*#__PURE__*/_react.default.createElement(NavigationSidebarContext.Provider, {
|
|
14
|
+
value: value
|
|
15
|
+
}, children);
|
|
16
|
+
exports.NavigationSidebarProvider = NavigationSidebarProvider;
|
|
17
|
+
NavigationSidebarProvider.displayName = 'NavigationSidebarProvider';
|
|
18
|
+
const useNavigationSidebarContext = () => {
|
|
19
|
+
const context = (0, _react.useContext)(NavigationSidebarContext);
|
|
20
|
+
if (!context) {
|
|
21
|
+
throw new Error('useNavigationSidebarContext must be used within NavigationSidebarProvider.');
|
|
22
|
+
}
|
|
23
|
+
return context;
|
|
24
|
+
};
|
|
25
|
+
exports.useNavigationSidebarContext = useNavigationSidebarContext;
|
|
26
|
+
//# sourceMappingURL=NavigationSidebar.context.js.map
|
package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.context.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationSidebar.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","NavigationSidebarContext","createContext","NavigationSidebarProvider","children","value","createElement","Provider","exports","displayName","useNavigationSidebarContext","context","useContext","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,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,CAA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AAM,IAAIE,KAAK,CACX,4EACJ,CAAC;EACL;EAEA,OAAOF,OAAO;AAClB,CAAC;AAACH,OAAA,CAAAE,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,140 @@
|
|
|
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 _NavigationSidebar = require("./NavigationSidebar.styles");
|
|
9
|
+
var _NavigationSidebar2 = require("./NavigationSidebar.utils");
|
|
10
|
+
var _SidebarGroup = _interopRequireDefault(require("./sidebar-group/SidebarGroup"));
|
|
11
|
+
var _SidebarDivider = _interopRequireDefault(require("./sidebar-divider/SidebarDivider"));
|
|
12
|
+
var _NavigationSidebar3 = require("./NavigationSidebar.context");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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); }
|
|
15
|
+
const NavigationSidebar = ({
|
|
16
|
+
color,
|
|
17
|
+
minWidth,
|
|
18
|
+
maxWidth,
|
|
19
|
+
topContent,
|
|
20
|
+
bottomContent,
|
|
21
|
+
groups,
|
|
22
|
+
selectedItemId,
|
|
23
|
+
onItemClick,
|
|
24
|
+
onSidebarOpen,
|
|
25
|
+
onSidebarClose,
|
|
26
|
+
shouldShowCollapsedLabel,
|
|
27
|
+
isMobile
|
|
28
|
+
}) => {
|
|
29
|
+
const [width, setWidth] = (0, _react.useState)(minWidth);
|
|
30
|
+
const [isDragging, setIsDragging] = (0, _react.useState)(false);
|
|
31
|
+
const dragStartWidthRef = (0, _react.useRef)(minWidth);
|
|
32
|
+
(0, _NavigationSidebar2.useGlobalUserSelect)({
|
|
33
|
+
isDisabled: isDragging
|
|
34
|
+
});
|
|
35
|
+
const isCompact = (0, _react.useMemo)(() => isMobile ? false : width < (0, _NavigationSidebar2.getSideBarCompactBreakpoint)({
|
|
36
|
+
minWidth,
|
|
37
|
+
maxWidth
|
|
38
|
+
}), [isMobile, maxWidth, minWidth, width]);
|
|
39
|
+
const handlePanStart = (0, _react.useCallback)(() => {
|
|
40
|
+
dragStartWidthRef.current = width;
|
|
41
|
+
setIsDragging(true);
|
|
42
|
+
}, [width]);
|
|
43
|
+
const handlePointerDown = (0, _react.useCallback)(event => {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
}, []);
|
|
47
|
+
const handlePan = (0, _react.useCallback)((_, info) => {
|
|
48
|
+
setWidth((0, _NavigationSidebar2.clampSideBarWidth)({
|
|
49
|
+
width: dragStartWidthRef.current + info.offset.x,
|
|
50
|
+
minWidth,
|
|
51
|
+
maxWidth
|
|
52
|
+
}));
|
|
53
|
+
}, [maxWidth, minWidth]);
|
|
54
|
+
const handlePanEnd = (0, _react.useCallback)((_, info) => {
|
|
55
|
+
const nextWidth = (0, _NavigationSidebar2.clampSideBarWidth)({
|
|
56
|
+
width: dragStartWidthRef.current + info.offset.x,
|
|
57
|
+
minWidth,
|
|
58
|
+
maxWidth
|
|
59
|
+
});
|
|
60
|
+
const nearestWidth = (0, _NavigationSidebar2.getNearestSideBarWidth)({
|
|
61
|
+
width: nextWidth,
|
|
62
|
+
minWidth,
|
|
63
|
+
maxWidth
|
|
64
|
+
});
|
|
65
|
+
setIsDragging(false);
|
|
66
|
+
setWidth(nearestWidth);
|
|
67
|
+
dragStartWidthRef.current = nearestWidth;
|
|
68
|
+
if (typeof onSidebarOpen === 'function' && nearestWidth === maxWidth) {
|
|
69
|
+
onSidebarOpen();
|
|
70
|
+
}
|
|
71
|
+
if (typeof onSidebarClose === 'function' && nearestWidth === minWidth) {
|
|
72
|
+
onSidebarClose();
|
|
73
|
+
}
|
|
74
|
+
}, [maxWidth, minWidth, onSidebarClose, onSidebarOpen]);
|
|
75
|
+
const {
|
|
76
|
+
pinnedGroups,
|
|
77
|
+
scrollableGroups
|
|
78
|
+
} = (0, _react.useMemo)(() => ({
|
|
79
|
+
pinnedGroups: groups.filter(({
|
|
80
|
+
isPinned
|
|
81
|
+
}) => isPinned),
|
|
82
|
+
scrollableGroups: groups.filter(({
|
|
83
|
+
isPinned
|
|
84
|
+
}) => !isPinned)
|
|
85
|
+
}), [groups]);
|
|
86
|
+
const hasPinnedGroups = pinnedGroups.length > 0;
|
|
87
|
+
const hasScrollableGroups = scrollableGroups.length > 0;
|
|
88
|
+
const shouldShowCollapsedSidebarLabel = shouldShowCollapsedLabel && width === minWidth;
|
|
89
|
+
const contextValue = (0, _react.useMemo)(() => ({
|
|
90
|
+
color,
|
|
91
|
+
isCompact,
|
|
92
|
+
onItemClick,
|
|
93
|
+
selectedItemId,
|
|
94
|
+
shouldShowCollapsedLabel: shouldShowCollapsedSidebarLabel
|
|
95
|
+
}), [color, isCompact, onItemClick, selectedItemId, shouldShowCollapsedSidebarLabel]);
|
|
96
|
+
const renderGroups = (0, _react.useCallback)(groupsToRender => groupsToRender.map(({
|
|
97
|
+
items,
|
|
98
|
+
id,
|
|
99
|
+
isReorderable
|
|
100
|
+
}, index) => /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
101
|
+
key: id
|
|
102
|
+
}, /*#__PURE__*/_react.default.createElement(_SidebarGroup.default, {
|
|
103
|
+
groupId: id,
|
|
104
|
+
items: items,
|
|
105
|
+
isReorderable: isReorderable
|
|
106
|
+
}), index < groupsToRender.length - 1 && /*#__PURE__*/_react.default.createElement(_SidebarDivider.default, {
|
|
107
|
+
color: color
|
|
108
|
+
}))), [color]);
|
|
109
|
+
return /*#__PURE__*/_react.default.createElement(_NavigationSidebar.StyledMotionNavigationSidebar, {
|
|
110
|
+
$color: color,
|
|
111
|
+
$isMobile: isMobile,
|
|
112
|
+
initial: false,
|
|
113
|
+
animate: !isMobile ? {
|
|
114
|
+
width
|
|
115
|
+
} : {},
|
|
116
|
+
transition: isDragging ? {
|
|
117
|
+
duration: 0
|
|
118
|
+
} : {
|
|
119
|
+
type: 'spring',
|
|
120
|
+
stiffness: 320,
|
|
121
|
+
damping: 30
|
|
122
|
+
},
|
|
123
|
+
id: "sidebar",
|
|
124
|
+
"data-navigation-sidebar-root": "true"
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement(_NavigationSidebar3.NavigationSidebarProvider, {
|
|
126
|
+
value: contextValue
|
|
127
|
+
}, /*#__PURE__*/_react.default.createElement(_NavigationSidebar.StyledMotionNavigationSidebarContent, null, !!topContent && /*#__PURE__*/_react.default.createElement(_NavigationSidebar.StyledMotionNavigationSidebarExternalContent, null, topContent), /*#__PURE__*/_react.default.createElement(_NavigationSidebar.StyledMotionNavigationSidebarContentWrapper, null, hasPinnedGroups && /*#__PURE__*/_react.default.createElement(_NavigationSidebar.StyledMotionNavigationSidebarContentList, {
|
|
128
|
+
$isPinned: true
|
|
129
|
+
}, renderGroups(pinnedGroups)), hasPinnedGroups && hasScrollableGroups && /*#__PURE__*/_react.default.createElement(_SidebarDivider.default, {
|
|
130
|
+
color: color
|
|
131
|
+
}), hasScrollableGroups && /*#__PURE__*/_react.default.createElement(_NavigationSidebar.StyledMotionNavigationSidebarContentList, null, renderGroups(scrollableGroups))), !!bottomContent && /*#__PURE__*/_react.default.createElement(_NavigationSidebar.StyledMotionNavigationSidebarExternalContent, null, bottomContent))), !isMobile && /*#__PURE__*/_react.default.createElement(_NavigationSidebar.StyledNavigationSidebarResizeHandle, {
|
|
132
|
+
onPointerDown: handlePointerDown,
|
|
133
|
+
onPanStart: handlePanStart,
|
|
134
|
+
onPan: handlePan,
|
|
135
|
+
onPanEnd: handlePanEnd
|
|
136
|
+
}));
|
|
137
|
+
};
|
|
138
|
+
NavigationSidebar.displayName = 'NavigationSidebar';
|
|
139
|
+
var _default = exports.default = NavigationSidebar;
|
|
140
|
+
//# sourceMappingURL=NavigationSidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationSidebar.js","names":["_react","_interopRequireWildcard","require","_NavigationSidebar","_NavigationSidebar2","_SidebarGroup","_interopRequireDefault","_SidebarDivider","_NavigationSidebar3","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NavigationSidebar","color","minWidth","maxWidth","topContent","bottomContent","groups","selectedItemId","onItemClick","onSidebarOpen","onSidebarClose","shouldShowCollapsedLabel","isMobile","width","setWidth","useState","isDragging","setIsDragging","dragStartWidthRef","useRef","useGlobalUserSelect","isDisabled","isCompact","useMemo","getSideBarCompactBreakpoint","handlePanStart","useCallback","current","handlePointerDown","event","preventDefault","stopPropagation","handlePan","_","info","clampSideBarWidth","offset","x","handlePanEnd","nextWidth","nearestWidth","getNearestSideBarWidth","pinnedGroups","scrollableGroups","filter","isPinned","hasPinnedGroups","length","hasScrollableGroups","shouldShowCollapsedSidebarLabel","contextValue","renderGroups","groupsToRender","map","items","id","isReorderable","index","createElement","Fragment","key","groupId","StyledMotionNavigationSidebar","$color","$isMobile","initial","animate","transition","duration","type","stiffness","damping","NavigationSidebarProvider","value","StyledMotionNavigationSidebarContent","StyledMotionNavigationSidebarExternalContent","StyledMotionNavigationSidebarContentWrapper","StyledMotionNavigationSidebarContentList","$isPinned","StyledNavigationSidebarResizeHandle","onPointerDown","onPanStart","onPan","onPanEnd","displayName","_default","exports"],"sources":["../../../../../src/components/navigation-layout/navigation-sidebar/NavigationSidebar.tsx"],"sourcesContent":["import React, {\n FC,\n useCallback,\n useMemo,\n useRef,\n useState,\n PointerEvent as ReactPointerEvent,\n Fragment,\n} from 'react';\nimport {\n StyledMotionNavigationSidebar,\n StyledMotionNavigationSidebarContentList,\n StyledMotionNavigationSidebarContent,\n StyledNavigationSidebarResizeHandle,\n StyledMotionNavigationSidebarContentWrapper,\n StyledMotionNavigationSidebarExternalContent,\n} from './NavigationSidebar.styles';\nimport { NavigationSidebarProps } from './NavigationSidebar.types';\nimport {\n clampSideBarWidth,\n getNearestSideBarWidth,\n getSideBarCompactBreakpoint,\n useGlobalUserSelect,\n} from './NavigationSidebar.utils';\nimport { PanInfo } from 'motion';\nimport SidebarGroup from './sidebar-group/SidebarGroup';\nimport SidebarDivider from './sidebar-divider/SidebarDivider';\nimport { NavigationLayoutGroup } from '../NavigationLayout.types';\nimport { NavigationSidebarProvider } from './NavigationSidebar.context';\n\nconst NavigationSidebar: FC<NavigationSidebarProps> = ({\n color,\n minWidth,\n maxWidth,\n topContent,\n bottomContent,\n groups,\n selectedItemId,\n onItemClick,\n onSidebarOpen,\n onSidebarClose,\n shouldShowCollapsedLabel,\n isMobile,\n}) => {\n const [width, setWidth] = useState<number>(minWidth);\n const [isDragging, setIsDragging] = useState<boolean>(false);\n const dragStartWidthRef = useRef<number>(minWidth);\n\n useGlobalUserSelect({ isDisabled: isDragging });\n\n const isCompact = useMemo(\n () => (isMobile ? false : width < getSideBarCompactBreakpoint({ minWidth, maxWidth })),\n [isMobile, maxWidth, minWidth, width],\n );\n\n const handlePanStart = useCallback((): void => {\n dragStartWidthRef.current = width;\n setIsDragging(true);\n }, [width]);\n\n const handlePointerDown = useCallback((event: ReactPointerEvent<HTMLDivElement>): void => {\n event.preventDefault();\n event.stopPropagation();\n }, []);\n\n const handlePan = useCallback(\n (_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void => {\n setWidth(\n clampSideBarWidth({\n width: dragStartWidthRef.current + info.offset.x,\n minWidth,\n maxWidth,\n }),\n );\n },\n [maxWidth, minWidth],\n );\n\n const handlePanEnd = useCallback(\n (_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo): void => {\n const nextWidth = clampSideBarWidth({\n width: dragStartWidthRef.current + info.offset.x,\n minWidth,\n maxWidth,\n });\n\n const nearestWidth = getNearestSideBarWidth({\n width: nextWidth,\n minWidth,\n maxWidth,\n });\n\n setIsDragging(false);\n setWidth(nearestWidth);\n\n dragStartWidthRef.current = nearestWidth;\n\n if (typeof onSidebarOpen === 'function' && nearestWidth === maxWidth) {\n onSidebarOpen();\n }\n\n if (typeof onSidebarClose === 'function' && nearestWidth === minWidth) {\n onSidebarClose();\n }\n },\n [maxWidth, minWidth, onSidebarClose, onSidebarOpen],\n );\n\n const { pinnedGroups, scrollableGroups } = useMemo(\n () => ({\n pinnedGroups: groups.filter(({ isPinned }) => isPinned),\n scrollableGroups: groups.filter(({ isPinned }) => !isPinned),\n }),\n [groups],\n );\n\n const hasPinnedGroups = pinnedGroups.length > 0;\n const hasScrollableGroups = scrollableGroups.length > 0;\n const shouldShowCollapsedSidebarLabel = shouldShowCollapsedLabel && width === minWidth;\n\n const contextValue = useMemo(\n () => ({\n color,\n isCompact,\n onItemClick,\n selectedItemId,\n shouldShowCollapsedLabel: shouldShowCollapsedSidebarLabel,\n }),\n [color, isCompact, onItemClick, selectedItemId, shouldShowCollapsedSidebarLabel],\n );\n\n const renderGroups = useCallback(\n (groupsToRender: NavigationLayoutGroup[]) =>\n groupsToRender.map(({ items, id, isReorderable }, index) => (\n <Fragment key={id}>\n <SidebarGroup groupId={id} items={items} isReorderable={isReorderable} />\n\n {index < groupsToRender.length - 1 && <SidebarDivider color={color} />}\n </Fragment>\n )),\n [color],\n );\n\n return (\n <StyledMotionNavigationSidebar\n $color={color}\n $isMobile={isMobile}\n initial={false}\n animate={!isMobile ? { width } : {}}\n transition={\n isDragging\n ? {\n duration: 0,\n }\n : {\n type: 'spring',\n stiffness: 320,\n damping: 30,\n }\n }\n id=\"sidebar\"\n data-navigation-sidebar-root=\"true\"\n >\n <NavigationSidebarProvider value={contextValue}>\n <StyledMotionNavigationSidebarContent>\n {!!topContent && (\n <StyledMotionNavigationSidebarExternalContent>\n {topContent}\n </StyledMotionNavigationSidebarExternalContent>\n )}\n <StyledMotionNavigationSidebarContentWrapper>\n {hasPinnedGroups && (\n <StyledMotionNavigationSidebarContentList $isPinned>\n {renderGroups(pinnedGroups)}\n </StyledMotionNavigationSidebarContentList>\n )}\n {hasPinnedGroups && hasScrollableGroups && <SidebarDivider color={color} />}\n {hasScrollableGroups && (\n <StyledMotionNavigationSidebarContentList>\n {renderGroups(scrollableGroups)}\n </StyledMotionNavigationSidebarContentList>\n )}\n </StyledMotionNavigationSidebarContentWrapper>\n {!!bottomContent && (\n <StyledMotionNavigationSidebarExternalContent>\n {bottomContent}\n </StyledMotionNavigationSidebarExternalContent>\n )}\n </StyledMotionNavigationSidebarContent>\n </NavigationSidebarProvider>\n {!isMobile && (\n <StyledNavigationSidebarResizeHandle\n onPointerDown={handlePointerDown}\n onPanStart={handlePanStart}\n onPan={handlePan}\n onPanEnd={handlePanEnd}\n />\n )}\n </StyledMotionNavigationSidebar>\n );\n};\n\nNavigationSidebar.displayName = 'NavigationSidebar';\n\nexport default NavigationSidebar;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,kBAAA,GAAAD,OAAA;AASA,IAAAE,mBAAA,GAAAF,OAAA;AAOA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAEA,IAAAM,mBAAA,GAAAN,OAAA;AAAwE,SAAAI,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,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|
|
6
|
+
exports.StyledNavigationSidebarResizeHandle = exports.StyledMotionNavigationSidebarExternalContent = exports.StyledMotionNavigationSidebarContentWrapper = exports.StyledMotionNavigationSidebarContentList = exports.StyledMotionNavigationSidebarContent = exports.StyledMotionNavigationSidebar = 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 SCROLLABLE_GROUPS_MIN_HEIGHT = 120;
|
|
11
|
+
const StyledMotionNavigationSidebar = exports.StyledMotionNavigationSidebar = (0, _styledComponents.default)(_react.motion.div)`
|
|
12
|
+
height: 100%;
|
|
13
|
+
color: ${({
|
|
14
|
+
$color
|
|
15
|
+
}) => $color};
|
|
16
|
+
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
min-height: 0;
|
|
21
|
+
overflow: visible;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
padding: 10px;
|
|
24
|
+
|
|
25
|
+
${({
|
|
26
|
+
$isMobile
|
|
27
|
+
}) => $isMobile && (0, _styledComponents.css)`
|
|
28
|
+
width: 70vw;
|
|
29
|
+
min-width: 70vw;
|
|
30
|
+
max-width: 70vw;
|
|
31
|
+
`}
|
|
32
|
+
`;
|
|
33
|
+
const StyledMotionNavigationSidebarContent = exports.StyledMotionNavigationSidebarContent = (0, _styledComponents.default)(_react.motion.div)`
|
|
34
|
+
width: 100%;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex: 1 1 auto;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: 2px;
|
|
39
|
+
min-height: 0;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
`;
|
|
42
|
+
const StyledMotionNavigationSidebarContentWrapper = exports.StyledMotionNavigationSidebarContentWrapper = (0, _styledComponents.default)(_react.motion.div)`
|
|
43
|
+
display: flex;
|
|
44
|
+
flex: 1 1 auto;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
min-height: 0;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
`;
|
|
49
|
+
const StyledMotionNavigationSidebarExternalContent = exports.StyledMotionNavigationSidebarExternalContent = (0, _styledComponents.default)(_react.motion.div)`
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
margin: 4px 0;
|
|
52
|
+
`;
|
|
53
|
+
const StyledMotionNavigationSidebarContentList = exports.StyledMotionNavigationSidebarContentList = (0, _styledComponents.default)(_react.motion.div)`
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
min-height: 0;
|
|
57
|
+
overflow-x: hidden;
|
|
58
|
+
|
|
59
|
+
${({
|
|
60
|
+
$isPinned
|
|
61
|
+
}) => $isPinned ? (0, _styledComponents.css)`
|
|
62
|
+
flex: 0 0 auto;
|
|
63
|
+
overflow-y: auto;
|
|
64
|
+
` : (0, _styledComponents.css)`
|
|
65
|
+
flex: 1 1 auto;
|
|
66
|
+
min-height: min(${SCROLLABLE_GROUPS_MIN_HEIGHT}px, 100%);
|
|
67
|
+
overflow-y: auto;
|
|
68
|
+
`}
|
|
69
|
+
|
|
70
|
+
&::-webkit-scrollbar {
|
|
71
|
+
width: 0;
|
|
72
|
+
height: 0;
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
const StyledNavigationSidebarResizeHandle = exports.StyledNavigationSidebarResizeHandle = (0, _styledComponents.default)(_react.motion.div)`
|
|
76
|
+
position: absolute;
|
|
77
|
+
right: -10px;
|
|
78
|
+
top: 0;
|
|
79
|
+
width: 20px;
|
|
80
|
+
height: 100%;
|
|
81
|
+
cursor: col-resize;
|
|
82
|
+
opacity: 0;
|
|
83
|
+
z-index: 20;
|
|
84
|
+
pointer-events: auto;
|
|
85
|
+
touch-action: none;
|
|
86
|
+
user-select: none;
|
|
87
|
+
-webkit-user-select: none;
|
|
88
|
+
`;
|
|
89
|
+
//# sourceMappingURL=NavigationSidebar.styles.js.map
|
package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationSidebar.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","SCROLLABLE_GROUPS_MIN_HEIGHT","StyledMotionNavigationSidebar","exports","styled","motion","div","$color","$isMobile","css","StyledMotionNavigationSidebarContent","StyledMotionNavigationSidebarContentWrapper","StyledMotionNavigationSidebarExternalContent","StyledMotionNavigationSidebarContentList","$isPinned","StyledNavigationSidebarResizeHandle"],"sources":["../../../../../src/components/navigation-layout/navigation-sidebar/NavigationSidebar.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { WithTheme } from '@chayns-components/core';\nimport { motion } from 'motion/react';\n\nconst SCROLLABLE_GROUPS_MIN_HEIGHT = 120;\n\ntype StyledNavigationSidebarProps = WithTheme<{ $color: string; $isMobile?: boolean }>;\n\nexport const StyledMotionNavigationSidebar = styled(motion.div)<StyledNavigationSidebarProps>`\n height: 100%;\n color: ${({ $color }) => $color};\n\n position: relative;\n display: flex;\n flex-shrink: 0;\n min-height: 0;\n overflow: visible;\n z-index: 1;\n padding: 10px;\n\n ${({ $isMobile }) =>\n $isMobile &&\n css`\n width: 70vw;\n min-width: 70vw;\n max-width: 70vw;\n `}\n`;\n\nexport const StyledMotionNavigationSidebarContent = styled(motion.div)`\n width: 100%;\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n gap: 2px;\n min-height: 0;\n overflow: hidden;\n`;\n\nexport const StyledMotionNavigationSidebarContentWrapper = styled(motion.div)`\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n min-height: 0;\n overflow: hidden;\n`;\n\nexport const StyledMotionNavigationSidebarExternalContent = styled(motion.div)`\n flex-shrink: 0;\n margin: 4px 0;\n`;\n\ntype StyledMotionNavigationSidebarContentListProps = WithTheme<{ $isPinned?: boolean }>;\n\nexport const StyledMotionNavigationSidebarContentList = styled(\n motion.div,\n)<StyledMotionNavigationSidebarContentListProps>`\n display: flex;\n flex-direction: column;\n min-height: 0;\n overflow-x: hidden;\n\n ${({ $isPinned }) =>\n $isPinned\n ? css`\n flex: 0 0 auto;\n overflow-y: auto;\n `\n : css`\n flex: 1 1 auto;\n min-height: min(${SCROLLABLE_GROUPS_MIN_HEIGHT}px, 100%);\n overflow-y: auto;\n `}\n\n &::-webkit-scrollbar {\n width: 0;\n height: 0;\n }\n`;\n\nexport const StyledNavigationSidebarResizeHandle = styled(motion.div)`\n position: absolute;\n right: -10px;\n top: 0;\n width: 20px;\n height: 100%;\n cursor: col-resize;\n opacity: 0;\n z-index: 20;\n pointer-events: auto;\n touch-action: none;\n user-select: none;\n -webkit-user-select: none;\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,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,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yBAAM,EAACC,aAAM,CAACC,GAAG,CAAC;AAC7E;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMM,4CAA4C,GAAAT,OAAA,CAAAS,4CAAA,GAAG,IAAAR,yBAAM,EAACC,aAAM,CAACC,GAAG,CAAC;AAC9E;AACA;AACA,CAAC;AAIM,MAAMO,wCAAwC,GAAAV,OAAA,CAAAU,wCAAA,GAAG,IAAAT,yBAAM,EAC1DC,aAAM,CAACC,GACX,CAAgD;AAChD;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEQ;AAAU,CAAC,KACZA,SAAS,GACH,IAAAL,qBAAG;AACjB;AACA;AACA,eAAe,GACD,IAAAA,qBAAG;AACjB;AACA,oCAAoCR,4BAA4B;AAChE;AACA,eAAe;AACf;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMc,mCAAmC,GAAAZ,OAAA,CAAAY,mCAAA,GAAG,IAAAX,yBAAM,EAACC,aAAM,CAACC,GAAG,CAAC;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationSidebar.types.js","names":[],"sources":["../../../../../src/components/navigation-layout/navigation-sidebar/NavigationSidebar.types.ts"],"sourcesContent":["import { NavigationLayoutProps } from '../NavigationLayout.types';\n\n/**\n * Internal props used to render the navigation sidebar.\n */\nexport interface NavigationSidebarProps {\n /**\n * Color used for icons, text highlights and separators.\n */\n color: string;\n /**\n * Optional content rendered above the item groups.\n */\n topContent: NavigationLayoutProps['sidebarTopContent'];\n /**\n * Optional content rendered below the item groups.\n */\n bottomContent: NavigationLayoutProps['sidebarBottomContent'];\n /**\n * Collapsed sidebar width.\n */\n minWidth: number;\n /**\n * Expanded sidebar width.\n */\n maxWidth: number;\n /**\n * Grouped navigation items shown in the sidebar.\n */\n groups: NavigationLayoutProps['groups'];\n /**\n * Currently selected item id.\n */\n selectedItemId?: NavigationLayoutProps['selectedItemId'];\n /**\n * Called when an item is clicked.\n */\n onItemClick?: NavigationLayoutProps['onItemClick'];\n /**\n * Called when the sidebar snaps open.\n */\n onSidebarOpen?: NavigationLayoutProps['onSidebarOpen'];\n /**\n * Called when the sidebar snaps closed.\n */\n onSidebarClose?: NavigationLayoutProps['onSidebarClose'];\n /**\n * Enables collapsed labels for top-level items.\n */\n shouldShowCollapsedLabel?: NavigationLayoutProps['shouldShowCollapsedLabel'];\n /**\n * Enables the mobile layout behaviour.\n */\n isMobile?: NavigationLayoutProps['isMobile'];\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useGlobalUserSelect = exports.getSideBarCompactBreakpoint = exports.getNearestSideBarWidth = exports.clampSideBarWidth = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
const useGlobalUserSelect = ({
|
|
9
|
+
isDisabled
|
|
10
|
+
}) => {
|
|
11
|
+
(0, _react.useEffect)(() => {
|
|
12
|
+
if (!isDisabled || typeof document === 'undefined') {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const elements = [document.documentElement, document.body];
|
|
16
|
+
const previousStyles = elements.map(element => ({
|
|
17
|
+
element,
|
|
18
|
+
userSelect: element.style.userSelect,
|
|
19
|
+
webkitUserSelect: element.style.getPropertyValue('-webkit-user-select')
|
|
20
|
+
}));
|
|
21
|
+
previousStyles.forEach(({
|
|
22
|
+
element
|
|
23
|
+
}) => {
|
|
24
|
+
const {
|
|
25
|
+
style
|
|
26
|
+
} = element;
|
|
27
|
+
style.userSelect = 'none';
|
|
28
|
+
style.setProperty('-webkit-user-select', 'none');
|
|
29
|
+
});
|
|
30
|
+
return () => {
|
|
31
|
+
previousStyles.forEach(({
|
|
32
|
+
element,
|
|
33
|
+
userSelect,
|
|
34
|
+
webkitUserSelect
|
|
35
|
+
}) => {
|
|
36
|
+
const {
|
|
37
|
+
style
|
|
38
|
+
} = element;
|
|
39
|
+
style.userSelect = userSelect;
|
|
40
|
+
if (webkitUserSelect) {
|
|
41
|
+
style.setProperty('-webkit-user-select', webkitUserSelect);
|
|
42
|
+
} else {
|
|
43
|
+
style.removeProperty('-webkit-user-select');
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}, [isDisabled]);
|
|
48
|
+
};
|
|
49
|
+
exports.useGlobalUserSelect = useGlobalUserSelect;
|
|
50
|
+
const clampSideBarWidth = ({
|
|
51
|
+
width,
|
|
52
|
+
minWidth,
|
|
53
|
+
maxWidth
|
|
54
|
+
}) => {
|
|
55
|
+
const normalizedMinWidth = Math.min(minWidth, maxWidth);
|
|
56
|
+
const normalizedMaxWidth = Math.max(minWidth, maxWidth);
|
|
57
|
+
return Math.min(Math.max(width, normalizedMinWidth), normalizedMaxWidth);
|
|
58
|
+
};
|
|
59
|
+
exports.clampSideBarWidth = clampSideBarWidth;
|
|
60
|
+
const getNearestSideBarWidth = ({
|
|
61
|
+
width,
|
|
62
|
+
minWidth,
|
|
63
|
+
maxWidth
|
|
64
|
+
}) => {
|
|
65
|
+
const normalizedMinWidth = Math.min(minWidth, maxWidth);
|
|
66
|
+
const normalizedMaxWidth = Math.max(minWidth, maxWidth);
|
|
67
|
+
const halfWidth = getSideBarCompactBreakpoint({
|
|
68
|
+
minWidth,
|
|
69
|
+
maxWidth
|
|
70
|
+
});
|
|
71
|
+
return width < halfWidth ? normalizedMinWidth : normalizedMaxWidth;
|
|
72
|
+
};
|
|
73
|
+
exports.getNearestSideBarWidth = getNearestSideBarWidth;
|
|
74
|
+
const getSideBarCompactBreakpoint = ({
|
|
75
|
+
minWidth,
|
|
76
|
+
maxWidth
|
|
77
|
+
}) => {
|
|
78
|
+
const normalizedMinWidth = Math.min(minWidth, maxWidth);
|
|
79
|
+
const normalizedMaxWidth = Math.max(minWidth, maxWidth);
|
|
80
|
+
return normalizedMinWidth + (normalizedMaxWidth - normalizedMinWidth) / 2;
|
|
81
|
+
};
|
|
82
|
+
exports.getSideBarCompactBreakpoint = getSideBarCompactBreakpoint;
|
|
83
|
+
//# sourceMappingURL=NavigationSidebar.utils.js.map
|
package/lib/cjs/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationSidebar.utils.js","names":["_react","require","useGlobalUserSelect","isDisabled","useEffect","document","undefined","elements","documentElement","body","previousStyles","map","element","userSelect","style","webkitUserSelect","getPropertyValue","forEach","setProperty","removeProperty","exports","clampSideBarWidth","width","minWidth","maxWidth","normalizedMinWidth","Math","min","normalizedMaxWidth","max","getNearestSideBarWidth","halfWidth","getSideBarCompactBreakpoint"],"sources":["../../../../../src/components/navigation-layout/navigation-sidebar/NavigationSidebar.utils.ts"],"sourcesContent":["import { useEffect } from 'react';\n\nexport interface UseGlobalUserSelectOptions {\n isDisabled: boolean;\n}\n\nexport const useGlobalUserSelect = ({ isDisabled }: UseGlobalUserSelectOptions): void => {\n useEffect(() => {\n if (!isDisabled || typeof document === 'undefined') {\n return undefined;\n }\n\n const elements = [document.documentElement, document.body];\n const previousStyles = elements.map((element) => ({\n element,\n userSelect: element.style.userSelect,\n webkitUserSelect: element.style.getPropertyValue('-webkit-user-select'),\n }));\n\n previousStyles.forEach(({ element }) => {\n const { style } = element;\n\n style.userSelect = 'none';\n style.setProperty('-webkit-user-select', 'none');\n });\n\n return () => {\n previousStyles.forEach(({ element, userSelect, webkitUserSelect }) => {\n const { style } = element;\n\n style.userSelect = userSelect;\n\n if (webkitUserSelect) {\n style.setProperty('-webkit-user-select', webkitUserSelect);\n } else {\n style.removeProperty('-webkit-user-select');\n }\n });\n };\n }, [isDisabled]);\n};\n\ninterface ClampSideBarWidthOptions {\n width: number;\n minWidth: number;\n maxWidth: number;\n}\n\nexport const clampSideBarWidth = ({\n width,\n minWidth,\n maxWidth,\n}: ClampSideBarWidthOptions): number => {\n const normalizedMinWidth = Math.min(minWidth, maxWidth);\n const normalizedMaxWidth = Math.max(minWidth, maxWidth);\n\n return Math.min(Math.max(width, normalizedMinWidth), normalizedMaxWidth);\n};\n\ninterface GetNearestSideBarWidthOptions {\n width: number;\n minWidth: number;\n maxWidth: number;\n}\n\ninterface GetSideBarCompactBreakpointOptions {\n minWidth: number;\n maxWidth: number;\n}\n\nexport const getNearestSideBarWidth = ({\n width,\n minWidth,\n maxWidth,\n}: GetNearestSideBarWidthOptions): number => {\n const normalizedMinWidth = Math.min(minWidth, maxWidth);\n const normalizedMaxWidth = Math.max(minWidth, maxWidth);\n const halfWidth = getSideBarCompactBreakpoint({ minWidth, maxWidth });\n\n return width < halfWidth ? normalizedMinWidth : normalizedMaxWidth;\n};\n\nexport const getSideBarCompactBreakpoint = ({\n minWidth,\n maxWidth,\n}: GetSideBarCompactBreakpointOptions): number => {\n const normalizedMinWidth = Math.min(minWidth, maxWidth);\n const normalizedMaxWidth = Math.max(minWidth, maxWidth);\n\n return normalizedMinWidth + (normalizedMaxWidth - normalizedMinWidth) / 2;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMO,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC;AAAuC,CAAC,KAAW;EACrF,IAAAC,gBAAS,EAAC,MAAM;IACZ,IAAI,CAACD,UAAU,IAAI,OAAOE,QAAQ,KAAK,WAAW,EAAE;MAChD,OAAOC,SAAS;IACpB;IAEA,MAAMC,QAAQ,GAAG,CAACF,QAAQ,CAACG,eAAe,EAAEH,QAAQ,CAACI,IAAI,CAAC;IAC1D,MAAMC,cAAc,GAAGH,QAAQ,CAACI,GAAG,CAAEC,OAAO,KAAM;MAC9CA,OAAO;MACPC,UAAU,EAAED,OAAO,CAACE,KAAK,CAACD,U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AAsB,GAAGA,CAAC;EACnCR,KAAK;EACLC,QAAQ;EACRC;AAC2B,CAAC,KAAa;EACzC,MAAMC,kBAAkB,GAAGC,IAAI,CAACC,GAAG,CAACJ,QAAQ,EAAEC,QAAQ,CAAC;EACvD,MAAMI,kBAAkB,GAAGF,IAAI,CAACG,GAAG,CAACN,QAAQ,EAAEC,QAAQ,CAAC;EACvD,MAAMO,SAAS,GAAGC,2BAA2B,CAAC;IAAET,QAAQ;IAAEC;EAAS,CAAC,CAAC;EAErE,OAAOF,KAAK,GAAGS,SAAS,GAAGN,kBAAkB,GAAGG,kBAAkB;AACtE,CAAC;AAACR,OAAA,CAAAU,sBAAA,GAAAA,sBAAA;AAEK,MAAME,2BAA2B,GAAGA,CAAC;EACxCT,QAAQ;EACRC;AACgC,CAAC,KAAa;EAC9C,MAAMC,kBAAkB,GAAGC,IAAI,CAACC,GAAG,CAACJ,QAAQ,EAAEC,QAAQ,CAAC;EACvD,MAAMI,kBAAkB,GAAGF,IAAI,CAACG,GAAG,CAACN,QAAQ,EAAEC,QAAQ,CAAC;EAEvD,OAAOC,kBAAkB,GAAG,CAACG,kBAAkB,GAAGH,kBAAkB,IAAI,CAAC;AAC7E,CAAC;AAACL,OAAA,CAAAY,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
package/lib/cjs/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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 _SidebarDivider = require("./SidebarDivider.styles");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const SidebarDivider = ({
|
|
11
|
+
color
|
|
12
|
+
}) => /*#__PURE__*/_react.default.createElement(_SidebarDivider.StyledSidebarDivider, {
|
|
13
|
+
$color: color
|
|
14
|
+
});
|
|
15
|
+
SidebarDivider.displayName = 'SidebarDivider';
|
|
16
|
+
var _default = exports.default = SidebarDivider;
|
|
17
|
+
//# sourceMappingURL=SidebarDivider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarDivider.js","names":["_react","_interopRequireDefault","require","_SidebarDivider","e","__esModule","default","SidebarDivider","color","createElement","StyledSidebarDivider","$color","displayName","_default","exports"],"sources":["../../../../../../src/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { StyledSidebarDivider } from './SidebarDivider.styles';\n\ninterface SidebarDividerProps {\n color: string;\n}\n\nconst SidebarDivider: FC<SidebarDividerProps> = ({ color }) => (\n <StyledSidebarDivider $color={color} />\n);\n\nSidebarDivider.displayName = 'SidebarDivider';\n\nexport default SidebarDivider;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAA+D,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAM/D,MAAMG,cAAuC,GAAGA,CAAC;EAAEC;AAAM,CAAC,kBACtDR,MAAA,CAAAM,OAAA,CAAAG,aAAA,CAACN,eAAA,CAAAO,oBAAoB;EAACC,MAAM,EAAEH;AAAM,CAAE,CACzC;AAEDD,cAAc,CAACK,WAAW,GAAG,gBAAgB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAE/BC,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledSidebarDivider = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const StyledSidebarDivider = exports.StyledSidebarDivider = _styledComponents.default.div`
|
|
10
|
+
background-color: ${({
|
|
11
|
+
$color
|
|
12
|
+
}) => $color};
|
|
13
|
+
opacity: 0.35;
|
|
14
|
+
flex: none;
|
|
15
|
+
height: 1px;
|
|
16
|
+
margin: 4px 0;
|
|
17
|
+
width: 100%;
|
|
18
|
+
`;
|
|
19
|
+
//# sourceMappingURL=SidebarDivider.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarDivider.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledSidebarDivider","exports","styled","div","$color"],"sources":["../../../../../../src/components/navigation-layout/navigation-sidebar/sidebar-divider/SidebarDivider.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '@chayns-components/core';\n\ntype StyledSidebarDividerProps = WithTheme<{ $color: string }>;\n\nexport const StyledSidebarDivider = styled.div<StyledSidebarDividerProps>`\n background-color: ${({ $color }) => $color};\n opacity: 0.35;\n flex: none;\n height: 1px;\n margin: 4px 0;\n width: 100%;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKhC,MAAMG,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGE,yBAAM,CAACC,GAA8B;AACzE,wBAAwB,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AAC9C;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|