@servicetitan/navigation 13.0.0-canary.256.b43c6d7.0 → 13.0.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/dist/components/counter-tag.d.ts +1 -1
- package/dist/components/counter-tag.d.ts.map +1 -1
- package/dist/components/counter-tag.js.map +1 -1
- package/dist/components/profile-dropdown/interface.d.ts +55 -0
- package/dist/components/profile-dropdown/interface.d.ts.map +1 -0
- package/dist/components/profile-dropdown/interface.js +3 -0
- package/dist/components/profile-dropdown/interface.js.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts +5 -1
- package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts +5 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +9 -79
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +17 -14
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts +5 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/interface-internal.d.ts +12 -0
- package/dist/components/titan-layout/interface-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/interface-internal.js.map +1 -1
- package/dist/components/titan-layout/interface.d.ts +60 -4
- package/dist/components/titan-layout/interface.d.ts.map +1 -1
- package/dist/components/titan-layout/interface.js.map +1 -1
- package/dist/components/titan-layout/layout-header-dark.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-dark.js +24 -12
- package/dist/components/titan-layout/layout-header-dark.js.map +1 -1
- package/dist/components/titan-layout/layout-header-links-internal.d.ts +22 -3
- package/dist/components/titan-layout/layout-header-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links-internal.js +15 -18
- package/dist/components/titan-layout/layout-header-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-header-links.d.ts +2 -3
- package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links.js +25 -5
- package/dist/components/titan-layout/layout-header-links.js.map +1 -1
- package/dist/components/titan-layout/layout-header.d.ts +2 -0
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header.js +25 -16
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +37 -1
- package/dist/components/titan-layout/layout-header.module.less.d.ts +3 -0
- package/dist/components/titan-layout/layout-profile.d.ts +8 -5
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.js +29 -21
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +48 -24
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +62 -51
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.d.ts +2 -2
- package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js +27 -14
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +81 -104
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.module.less +74 -22
- package/dist/components/titan-layout/titan-layout-default.stories.d.ts +16 -0
- package/dist/components/titan-layout/titan-layout-default.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout-legacy.stories.d.ts +10 -0
- package/dist/components/titan-layout/titan-layout-legacy.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout-stacked.stories.d.ts +10 -0
- package/dist/components/titan-layout/titan-layout-stacked.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout.d.ts +28 -1
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +30 -11
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/test/data.d.ts +0 -22
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +0 -197
- package/dist/test/data.js.map +1 -1
- package/dist/test/titan-layout.d.ts +16 -0
- package/dist/test/titan-layout.d.ts.map +1 -0
- package/dist/test/titan-layout.js +21 -0
- package/dist/test/titan-layout.js.map +1 -0
- package/dist/utils/navigation.d.ts +1 -4
- package/dist/utils/navigation.d.ts.map +1 -1
- package/dist/utils/navigation.js.map +1 -1
- package/package.json +4 -4
- package/src/components/counter-tag.tsx +1 -1
- package/src/components/profile-dropdown/interface.ts +47 -0
- package/src/components/profile-dropdown/profile-dropdown-legacy.stories.tsx +3 -3
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +3 -3
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +39 -39
- package/src/components/profile-dropdown/profile-dropdown.tsx +37 -104
- package/src/components/titan-layout/interface-internal.ts +13 -0
- package/src/components/titan-layout/interface.ts +64 -7
- package/src/components/titan-layout/layout-header-dark.tsx +21 -5
- package/src/components/titan-layout/layout-header-links-internal.tsx +41 -54
- package/src/components/titan-layout/layout-header-links.tsx +64 -8
- package/src/components/titan-layout/layout-header.module.less +37 -1
- package/src/components/titan-layout/layout-header.module.less.d.ts +3 -0
- package/src/components/titan-layout/layout-header.tsx +26 -13
- package/src/components/titan-layout/layout-profile.tsx +51 -28
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +155 -102
- package/src/components/titan-layout/layout-sidebar-links.tsx +45 -12
- package/src/components/titan-layout/layout-sidebar.module.less +74 -22
- package/src/components/titan-layout/layout-sidebar.tsx +55 -80
- package/src/components/titan-layout/{titan-layout.stories.tsx → titan-layout-default.stories.tsx} +100 -84
- package/src/components/titan-layout/titan-layout-legacy.stories.tsx +24 -0
- package/src/components/titan-layout/titan-layout-stacked.stories.tsx +30 -0
- package/src/components/titan-layout/titan-layout.tsx +67 -12
- package/src/index.ts +0 -1
- package/src/test/data.tsx +0 -165
- package/src/test/titan-layout.tsx +34 -0
- package/src/utils/navigation.ts +1 -6
- package/dist/components/titan-layout/titan-layout.stories.d.ts +0 -29
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +0 -1
- package/dist/utils/navigation-legacy.d.ts +0 -88
- package/dist/utils/navigation-legacy.d.ts.map +0 -1
- package/dist/utils/navigation-legacy.js +0 -3
- package/dist/utils/navigation-legacy.js.map +0 -1
- package/src/utils/navigation-legacy.ts +0 -106
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-profile.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-profile.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAmC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"layout-profile.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-profile.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAmC,MAAM,OAAO,CAAC;AAG5D,OAAO,EACH,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC9B,MAAM,+BAA+B,CAAC;AAYvC,YAAY,EACR,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,GAC3B,MAAM,+BAA+B,CAAC;AAcvC,iBAAS,wBAAwB,CAAC,KAAK,EAAE,oBAAoB,2CAO5D;AAsED,iBAAS,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,2CAOjE;AA6BD,iBAAS,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,2CAO3D;AAmCD,eAAO,MAAM,eAAe;;;;CAI1B,CAAC"}
|
|
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';
|
|
3
3
|
import SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { getCounterTag } from '../../utils/side-nav';
|
|
6
|
+
import { DesktopProfileDropdown } from '../profile-dropdown/profile-dropdown';
|
|
6
7
|
import { useTitanLayoutContext } from './layout-context';
|
|
7
8
|
import { InternalSideNavigationGroup, InternalSideNavigationGroupDivider, InternalSideNavigationGroupLink, InternalSideNavigationGroupTrigger } from './layout-sidebar-links-internal';
|
|
8
9
|
import { useNotificationsContext, useNotificationsState } from './notifications-context';
|
|
@@ -11,7 +12,7 @@ const ExternalNavComponent = ({ children, isActive, to, activeClassName, ...prop
|
|
|
11
12
|
href: to,
|
|
12
13
|
children: children
|
|
13
14
|
});
|
|
14
|
-
|
|
15
|
+
function ProfileDropdownComponent(props) {
|
|
15
16
|
const { breakpoint, NavigationComponent } = useTitanLayoutContext();
|
|
16
17
|
return breakpoint.isMobile ? /*#__PURE__*/ _jsx(MobileProfileDropdown, {
|
|
17
18
|
...props,
|
|
@@ -19,10 +20,9 @@ const ProfileDropdownContent = (props)=>{
|
|
|
19
20
|
}) : /*#__PURE__*/ _jsx(DesktopProfileDropdown, {
|
|
20
21
|
...props
|
|
21
22
|
});
|
|
22
|
-
}
|
|
23
|
-
ProfileDropdownContent.displayName = 'ProfileDropdown';
|
|
23
|
+
}
|
|
24
24
|
const profileId = '--profile';
|
|
25
|
-
const MobileProfileDropdown = ({ children, ...
|
|
25
|
+
const MobileProfileDropdown = ({ direction, trigger, hintPopup, portal, width, onClose, onOpen, className, children, ...rest })=>{
|
|
26
26
|
const [expanded, setExpanded] = useState(false);
|
|
27
27
|
const { hasNotifications, NotificationsContextProvider } = useNotificationsState();
|
|
28
28
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
@@ -44,7 +44,8 @@ const MobileProfileDropdown = ({ children, ...props })=>{
|
|
|
44
44
|
icon: SvgAccountInactive,
|
|
45
45
|
iconActive: SvgAccountActive,
|
|
46
46
|
isActive: expanded,
|
|
47
|
-
|
|
47
|
+
className: className,
|
|
48
|
+
...rest,
|
|
48
49
|
submenuExpanded: expanded,
|
|
49
50
|
onExpandToggle: onExpandToggle,
|
|
50
51
|
onClick: onExpandToggle,
|
|
@@ -68,27 +69,29 @@ const getText = (children, text)=>{
|
|
|
68
69
|
}
|
|
69
70
|
return undefined;
|
|
70
71
|
};
|
|
71
|
-
|
|
72
|
-
return !!(tag === null || tag === void 0 ? void 0 : tag.value) || !!counter;
|
|
73
|
-
};
|
|
74
|
-
const ProfileDropdownSection = (props)=>{
|
|
72
|
+
function ProfileDropdownSection(props) {
|
|
75
73
|
const { breakpoint } = useTitanLayoutContext();
|
|
76
74
|
return breakpoint.isMobile ? /*#__PURE__*/ _jsx(MobileProfileDropdownSection, {
|
|
77
75
|
...props
|
|
78
76
|
}) : /*#__PURE__*/ _jsx(DesktopProfileDropdown.Section, {
|
|
79
77
|
...props
|
|
80
78
|
});
|
|
81
|
-
}
|
|
82
|
-
const MobileProfileDropdownSection = ({
|
|
79
|
+
}
|
|
80
|
+
const MobileProfileDropdownSection = ({ id, tooltip, tag, counter, className, children, text, ...rest })=>{
|
|
83
81
|
const sectionText = getText(children, text);
|
|
84
82
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
85
|
-
|
|
83
|
+
const tagData = getCounterTag(counter, tag);
|
|
84
|
+
onNotificationsUpdate(id, !!tagData);
|
|
86
85
|
return sectionText ? /*#__PURE__*/ _jsx(InternalSideNavigationGroupTrigger, {
|
|
87
|
-
...
|
|
88
|
-
|
|
86
|
+
...rest,
|
|
87
|
+
id: id,
|
|
88
|
+
title: sectionText,
|
|
89
|
+
isActive: undefined,
|
|
90
|
+
tag: tagData,
|
|
91
|
+
className: className
|
|
89
92
|
}) : null;
|
|
90
93
|
};
|
|
91
|
-
|
|
94
|
+
function ProfileDropdownLink(props) {
|
|
92
95
|
const { breakpoint, NavigationComponent } = useTitanLayoutContext();
|
|
93
96
|
return breakpoint.isMobile ? /*#__PURE__*/ _jsx(MobileProfileDropdownLink, {
|
|
94
97
|
...props,
|
|
@@ -96,21 +99,26 @@ const ProfileDropdownLink = (props)=>{
|
|
|
96
99
|
}) : /*#__PURE__*/ _jsx(DesktopProfileDropdown.Link, {
|
|
97
100
|
...props
|
|
98
101
|
});
|
|
99
|
-
}
|
|
100
|
-
const MobileProfileDropdownLink = ({ external, to, tooltip, text, children, navigationComponent, ...
|
|
102
|
+
}
|
|
103
|
+
const MobileProfileDropdownLink = ({ id, external, to, tooltip, text, children, className, navigationComponent, tag, counter, ...rest })=>{
|
|
101
104
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
102
105
|
const linkText = getText(children, text);
|
|
103
106
|
const isExternalLink = external !== null && external !== void 0 ? external : to === null || to === void 0 ? void 0 : to.startsWith('http');
|
|
104
|
-
|
|
107
|
+
const tagData = getCounterTag(counter, tag);
|
|
108
|
+
onNotificationsUpdate(id, !!tagData);
|
|
105
109
|
return linkText ? /*#__PURE__*/ _jsx(InternalSideNavigationGroupLink, {
|
|
106
|
-
...
|
|
110
|
+
...rest,
|
|
111
|
+
id: id,
|
|
107
112
|
to: to,
|
|
108
113
|
title: linkText,
|
|
114
|
+
isActive: undefined,
|
|
115
|
+
className: className,
|
|
116
|
+
tag: tagData,
|
|
109
117
|
parentId: profileId,
|
|
110
118
|
navigationComponent: isExternalLink ? ExternalNavComponent : navigationComponent
|
|
111
119
|
}) : null;
|
|
112
120
|
};
|
|
113
|
-
export const ProfileDropdown = Object.assign(
|
|
121
|
+
export const ProfileDropdown = Object.assign(ProfileDropdownComponent, {
|
|
114
122
|
Divider: ProfileDropdownDivider,
|
|
115
123
|
Link: ProfileDropdownLink,
|
|
116
124
|
Section: ProfileDropdownSection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/titan-layout/layout-profile.tsx"],"sourcesContent":["import SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';\nimport SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';\n\nimport { FC, MouseEvent, useEffect, useState } from 'react';\nimport { NavLinkComponentProps } from '../../utils/navigation-context';\nimport {\n ProfileDropdown as DesktopProfileDropdown,\n ProfileDropdownLinkProps,\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n} from '../profile-dropdown/profile-dropdown';\nimport { NavigationComponentProps } from './interface-internal';\nimport { useTitanLayoutContext } from './layout-context';\nimport {\n InternalSideNavigationGroup,\n InternalSideNavigationGroupDivider,\n InternalSideNavigationGroupLink,\n InternalSideNavigationGroupTrigger,\n} from './layout-sidebar-links-internal';\nimport { useNotificationsContext, useNotificationsState } from './notifications-context';\n\nexport type {\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n ProfileDropdownLinkProps,\n} from '../profile-dropdown/profile-dropdown';\n\nconst ExternalNavComponent: FC<NavLinkComponentProps> = ({\n children,\n isActive,\n to,\n activeClassName,\n ...props\n}) => (\n <a {...props} href={to}>\n {children}\n </a>\n);\n\nconst ProfileDropdownContent: FC<ProfileDropdownProps> = props => {\n const { breakpoint, NavigationComponent } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdown {...props} navigationComponent={NavigationComponent} />\n ) : (\n <DesktopProfileDropdown {...props} />\n );\n};\nProfileDropdownContent.displayName = 'ProfileDropdown';\nconst profileId = '--profile';\n\nconst MobileProfileDropdown: FC<ProfileDropdownProps & NavigationComponentProps> = ({\n children,\n ...props\n}) => {\n const [expanded, setExpanded] = useState(false);\n const { hasNotifications, NotificationsContextProvider } = useNotificationsState();\n const { onNotificationsUpdate } = useNotificationsContext();\n const onExpandToggle = (e: MouseEvent<never>) => {\n e.stopPropagation();\n setExpanded(!expanded);\n };\n\n useEffect(() => {\n onNotificationsUpdate(profileId, hasNotifications);\n }, [hasNotifications, onNotificationsUpdate]);\n\n return (\n <NotificationsContextProvider>\n <InternalSideNavigationGroup\n id={profileId}\n to={undefined}\n title=\"Profile\"\n icon={SvgAccountInactive}\n iconActive={SvgAccountActive}\n isActive={expanded}\n {...props}\n submenuExpanded={expanded}\n onExpandToggle={onExpandToggle}\n onClick={onExpandToggle}\n tag={{ value: hasNotifications }}\n >\n {children}\n </InternalSideNavigationGroup>\n </NotificationsContextProvider>\n );\n};\n\nconst ProfileDropdownDivider: FC = () => {\n const { breakpoint } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <InternalSideNavigationGroupDivider />\n ) : (\n <DesktopProfileDropdown.Divider />\n );\n};\n\nconst getText = (children: any, text: any): string | undefined => {\n if (typeof children === 'string') {\n return children;\n }\n\n if (typeof text === 'string') {\n return text;\n }\n\n return undefined;\n};\n\nconst getTag = (\n tag: ProfileDropdownLinkProps['tag'],\n counter: ProfileDropdownLinkProps['counter']\n): boolean => {\n return !!tag?.value || !!counter;\n};\n\nconst ProfileDropdownSection: FC<ProfileDropdownSectionProps> = props => {\n const { breakpoint } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdownSection {...props} />\n ) : (\n <DesktopProfileDropdown.Section {...props} />\n );\n};\nconst MobileProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({\n children,\n text,\n tooltip,\n title,\n ...props\n}) => {\n const sectionText = getText(children, text);\n const { onNotificationsUpdate } = useNotificationsContext();\n onNotificationsUpdate(props.id, getTag(props.tag, props.counter));\n\n return sectionText ? (\n <InternalSideNavigationGroupTrigger {...props} title={sectionText} />\n ) : null;\n};\n\nconst ProfileDropdownLink: FC<ProfileDropdownLinkProps> = props => {\n const { breakpoint, NavigationComponent } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdownLink {...props} navigationComponent={NavigationComponent} />\n ) : (\n <DesktopProfileDropdown.Link {...props} />\n );\n};\nconst MobileProfileDropdownLink: FC<ProfileDropdownLinkProps & NavigationComponentProps> = ({\n external,\n to,\n tooltip,\n text,\n children,\n navigationComponent,\n ...props\n}) => {\n const { onNotificationsUpdate } = useNotificationsContext();\n const linkText = getText(children, text);\n const isExternalLink = external ?? to?.startsWith('http');\n onNotificationsUpdate(props.id, getTag(props.tag, props.counter));\n\n return linkText ? (\n <InternalSideNavigationGroupLink\n {...props}\n to={to}\n title={linkText}\n parentId={profileId}\n navigationComponent={isExternalLink ? ExternalNavComponent : navigationComponent}\n />\n ) : null;\n};\n\nexport const ProfileDropdown = Object.assign(ProfileDropdownContent, {\n Divider: ProfileDropdownDivider,\n Link: ProfileDropdownLink,\n Section: ProfileDropdownSection,\n});\n"],"names":["SvgAccountActive","SvgAccountInactive","useEffect","useState","ProfileDropdown","DesktopProfileDropdown","useTitanLayoutContext","InternalSideNavigationGroup","InternalSideNavigationGroupDivider","InternalSideNavigationGroupLink","InternalSideNavigationGroupTrigger","useNotificationsContext","useNotificationsState","ExternalNavComponent","children","isActive","to","activeClassName","props","a","href","ProfileDropdownContent","breakpoint","NavigationComponent","isMobile","MobileProfileDropdown","navigationComponent","displayName","profileId","expanded","setExpanded","hasNotifications","NotificationsContextProvider","onNotificationsUpdate","onExpandToggle","e","stopPropagation","id","undefined","title","icon","iconActive","submenuExpanded","onClick","tag","value","ProfileDropdownDivider","Divider","getText","text","getTag","counter","ProfileDropdownSection","MobileProfileDropdownSection","Section","tooltip","sectionText","ProfileDropdownLink","MobileProfileDropdownLink","Link","external","linkText","isExternalLink","startsWith","parentId","Object","assign"],"mappings":";AAAA,OAAOA,sBAAsB,+DAA+D;AAC5F,OAAOC,wBAAwB,iEAAiE;AAEhG,SAAyBC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAE5D,SACIC,mBAAmBC,sBAAsB,QAItC,uCAAuC;AAE9C,SAASC,q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EACnB,GAAGR,OACN;IACG,MAAM,EAAEe,qBAAqB,EAAE,GAAGtB;IAClC,MAAMkD,WAAWb,QAAQlC,UAAUmC;IACnC,MAAMa,iBAAiBF,qBAAAA,sBAAAA,WAAY5C,eAAAA,yBAAAA,GAAI+C,UAAU,CAAC;IAClD9B,sBAAsBf,MAAMmB,EAAE,EAAEa,OAAOhC,MAAM0B,GAAG,EAAE1B,MAAMiC,OAAO;IAE/D,OAAOU,yBACH,KAACpD;QACI,GAAGS,KAAK;QACTF,IAAIA;QACJuB,OAAOsB;QACPG,UAAUpC;QACVF,qBAAqBoC,iBAAiBjD,uBAAuBa;SAEjE;AACR;AAEA,OAAO,MAAMtB,kBAAkB6D,OAAOC,MAAM,CAAC7C,wBAAwB;IACjE0B,SAASD;IACTa,MAAMF;IACNH,SAASF;AACb,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/titan-layout/layout-profile.tsx"],"sourcesContent":["import SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';\nimport SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';\n\nimport { FC, MouseEvent, useEffect, useState } from 'react';\nimport { NavLinkComponentProps } from '../../utils/navigation-context';\nimport { getCounterTag } from '../../utils/side-nav';\nimport {\n ProfileDropdownLinkProps,\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n} from '../profile-dropdown/interface';\nimport { DesktopProfileDropdown } from '../profile-dropdown/profile-dropdown';\nimport { NavigationComponentProps } from './interface-internal';\nimport { useTitanLayoutContext } from './layout-context';\nimport {\n InternalSideNavigationGroup,\n InternalSideNavigationGroupDivider,\n InternalSideNavigationGroupLink,\n InternalSideNavigationGroupTrigger,\n} from './layout-sidebar-links-internal';\nimport { useNotificationsContext, useNotificationsState } from './notifications-context';\n\nexport type {\n ProfileDropdownProps,\n ProfileDropdownSectionProps,\n ProfileDropdownLinkProps,\n} from '../profile-dropdown/interface';\n\nconst ExternalNavComponent: FC<NavLinkComponentProps> = ({\n children,\n isActive,\n to,\n activeClassName,\n ...props\n}) => (\n <a {...props} href={to}>\n {children}\n </a>\n);\n\nfunction ProfileDropdownComponent(props: ProfileDropdownProps) {\n const { breakpoint, NavigationComponent } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdown {...props} navigationComponent={NavigationComponent} />\n ) : (\n <DesktopProfileDropdown {...props} />\n );\n}\nconst profileId = '--profile';\n\nconst MobileProfileDropdown: FC<ProfileDropdownProps & NavigationComponentProps> = ({\n direction,\n trigger,\n hintPopup,\n portal,\n width,\n onClose,\n onOpen,\n className,\n children,\n ...rest\n}) => {\n const [expanded, setExpanded] = useState(false);\n const { hasNotifications, NotificationsContextProvider } = useNotificationsState();\n const { onNotificationsUpdate } = useNotificationsContext();\n const onExpandToggle = (e: MouseEvent<never>) => {\n e.stopPropagation();\n setExpanded(!expanded);\n };\n\n useEffect(() => {\n onNotificationsUpdate(profileId, hasNotifications);\n }, [hasNotifications, onNotificationsUpdate]);\n\n return (\n <NotificationsContextProvider>\n <InternalSideNavigationGroup\n id={profileId}\n to={undefined}\n title=\"Profile\"\n icon={SvgAccountInactive}\n iconActive={SvgAccountActive}\n isActive={expanded}\n className={className}\n {...rest}\n submenuExpanded={expanded}\n onExpandToggle={onExpandToggle}\n onClick={onExpandToggle}\n tag={{ value: hasNotifications }}\n >\n {children}\n </InternalSideNavigationGroup>\n </NotificationsContextProvider>\n );\n};\n\nconst ProfileDropdownDivider: FC = () => {\n const { breakpoint } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <InternalSideNavigationGroupDivider />\n ) : (\n <DesktopProfileDropdown.Divider />\n );\n};\n\nconst getText = (children: any, text: any): string | undefined => {\n if (typeof children === 'string') {\n return children;\n }\n\n if (typeof text === 'string') {\n return text;\n }\n\n return undefined;\n};\n\nfunction ProfileDropdownSection(props: ProfileDropdownSectionProps) {\n const { breakpoint } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdownSection {...props} />\n ) : (\n <DesktopProfileDropdown.Section {...props} />\n );\n}\nconst MobileProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({\n id,\n tooltip,\n tag,\n counter,\n\n className,\n children,\n text,\n ...rest\n}) => {\n const sectionText = getText(children, text);\n const { onNotificationsUpdate } = useNotificationsContext();\n const tagData = getCounterTag(counter, tag);\n onNotificationsUpdate(id, !!tagData);\n\n return sectionText ? (\n <InternalSideNavigationGroupTrigger\n {...rest}\n id={id}\n title={sectionText}\n isActive={undefined}\n tag={tagData}\n className={className}\n />\n ) : null;\n};\n\nfunction ProfileDropdownLink(props: ProfileDropdownLinkProps) {\n const { breakpoint, NavigationComponent } = useTitanLayoutContext();\n return breakpoint.isMobile ? (\n <MobileProfileDropdownLink {...props} navigationComponent={NavigationComponent} />\n ) : (\n <DesktopProfileDropdown.Link {...props} />\n );\n}\nconst MobileProfileDropdownLink: FC<ProfileDropdownLinkProps & NavigationComponentProps> = ({\n id,\n external,\n to,\n tooltip,\n text,\n children,\n className,\n navigationComponent,\n tag,\n counter,\n ...rest\n}) => {\n const { onNotificationsUpdate } = useNotificationsContext();\n const linkText = getText(children, text);\n const isExternalLink = external ?? to?.startsWith('http');\n const tagData = getCounterTag(counter, tag);\n onNotificationsUpdate(id, !!tagData);\n\n return linkText ? (\n <InternalSideNavigationGroupLink\n {...rest}\n id={id}\n to={to}\n title={linkText}\n isActive={undefined}\n className={className}\n tag={tagData}\n parentId={profileId}\n navigationComponent={isExternalLink ? ExternalNavComponent : navigationComponent}\n />\n ) : null;\n};\n\nexport const ProfileDropdown = Object.assign(ProfileDropdownComponent, {\n Divider: ProfileDropdownDivider,\n Link: ProfileDropdownLink,\n Section: ProfileDropdownSection,\n});\n"],"names":["SvgAccountActive","SvgAccountInactive","useEffect","useState","getCounterTag","DesktopProfileDropdown","useTitanLayoutContext","InternalSideNavigationGroup","InternalSideNavigationGroupDivider","InternalSideNavigationGroupLink","InternalSideNavigationGroupTrigger","useNotificationsContext","useNotificationsState","ExternalNavComponent","children","isActive","to","activeClassName","props","a","href","ProfileDropdownComponent","breakpoint","NavigationComponent","isMobile","MobileProfileDropdown","navigationComponent","profileId","direction","trigger","hintPopup","portal","width","onClose","onOpen","className","rest","expanded","setExpanded","hasNotifications","NotificationsContextProvider","onNotificationsUpdate","onExpandToggle","e","stopPropagation","id","undefined","title","icon","iconActive","submenuExpanded","onClick","tag","value","ProfileDropdownDivider","Divider","getText","text","ProfileDropdownSection","MobileProfileDropdownSection","Section","tooltip","counter","sectionText","tagData","ProfileDropdownLink","MobileProfileDropdownLink","Link","external","linkText","isExternalLink","startsWith","parentId","ProfileDropdown","Object","assign"],"mappings":";AAAA,OAAOA,sBAAsB,+DAA+D;AAC5F,OAAOC,wBAAwB,iEAAiE;AAEhG,SAAyBC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAE5D,SAASC,aAAa,QAAQ,uBAAuB;AAMrD,SAASC,sBAAsB,QAAQ,uCAAuC;AAE9E,SAASC,qBAAqB,QAAQ,mBAAmB;AACzD,SACIC,2BAA2B,EAC3BC,kCAAkC,EAClCC,+BAA+B,EAC/BC,kCAAkC,QAC/B,kCAAkC;AACzC,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,0BAA0B;AAQzF,MAAMC,uBAAkD,CAAC,EACrDC,QAAQ,EACRC,QAAQ,EACRC,EAAE,EACFC,eAAe,EACf,GAAGC,OACN,iBACG,KAACC;QAAG,GAAGD,KAAK;QAAEE,MAAMJ;kBACfF;;AAIT,SAASO,yBAAyBH,KAA2B;IACzD,MAAM,EAAEI,UAAU,EAAEC,mBAAmB,EAAE,GAAGjB;IAC5C,OAAOgB,WAAWE,QAAQ,iBACtB,KAACC;QAAuB,GAAGP,KAAK;QAAEQ,qBAAqBH;uBAEvD,KAAClB;QAAwB,GAAGa,KAAK;;AAEzC;AACA,MAAMS,YAAY;AAElB,MAAMF,wBAA6E,CAAC,EAChFG,SAAS,EACTC,OAAO,EACPC,SAAS,EACTC,MAAM,EACN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A0B;IACnEkC,SAASD;IACTa,MAAMF;IACNL,SAASF;AACb,GAAG"}
|
|
@@ -1,41 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IconProps } from '@servicetitan/anvil2';
|
|
2
|
+
import { ComponentPropsWithoutRef, FC, MouseEvent, ReactNode } from 'react';
|
|
3
3
|
import { BadgeTagProps } from '../badge-tag';
|
|
4
|
-
import { TitanLayoutLinkProps, TitanLayoutTriggerProps } from './interface';
|
|
5
4
|
import { NavigationComponentProps } from './interface-internal';
|
|
6
5
|
export interface InternalSideNavigationItemContentProps {
|
|
7
|
-
icon:
|
|
8
|
-
iconActive:
|
|
9
|
-
title:
|
|
10
|
-
submenuExpanded: boolean | undefined;
|
|
6
|
+
icon: IconProps['svg'] | undefined;
|
|
7
|
+
iconActive: IconProps['svg'] | undefined;
|
|
8
|
+
title: string;
|
|
11
9
|
tag: BadgeTagProps | undefined;
|
|
12
|
-
onExpandToggle?: (e: MouseEvent<never>) => void;
|
|
13
10
|
}
|
|
14
|
-
interface InternalLinkProps {
|
|
15
|
-
submenuExpanded: boolean | undefined;
|
|
16
|
-
tag: BadgeTagProps | undefined;
|
|
17
|
-
onExpandToggle?: (e: MouseEvent<never>) => void;
|
|
18
|
-
}
|
|
19
|
-
export type InternalSideNavigationLinkProps = Omit<TitanLayoutLinkProps, 'wrapper' | 'counter' | 'tag'> & NavigationComponentProps & InternalLinkProps;
|
|
20
11
|
/** Side Navigation menu item (for internal usage) */
|
|
21
|
-
export declare const InternalSideNavigationLink: FC<
|
|
22
|
-
|
|
12
|
+
export declare const InternalSideNavigationLink: FC<NavigationComponentProps & {
|
|
13
|
+
id: string;
|
|
14
|
+
to: string;
|
|
15
|
+
title: string;
|
|
16
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
17
|
+
icon: IconProps['svg'] | undefined;
|
|
18
|
+
iconActive: IconProps['svg'] | undefined;
|
|
19
|
+
className: string | undefined;
|
|
20
|
+
tag: BadgeTagProps | undefined;
|
|
21
|
+
} & Omit<ComponentPropsWithoutRef<'a'>, 'children' | 'title'>>;
|
|
23
22
|
/** Side Navigation menu trigger (for internal usage) */
|
|
24
|
-
export declare const InternalSideNavigationTrigger: FC<
|
|
25
|
-
|
|
23
|
+
export declare const InternalSideNavigationTrigger: FC<{
|
|
24
|
+
id: string;
|
|
25
|
+
title: string;
|
|
26
|
+
isActive: boolean | undefined;
|
|
27
|
+
icon: IconProps['svg'] | undefined;
|
|
28
|
+
iconActive: IconProps['svg'] | undefined;
|
|
29
|
+
className: string | undefined;
|
|
30
|
+
tag: BadgeTagProps | undefined;
|
|
31
|
+
onClick?: (e: MouseEvent<never>) => void;
|
|
32
|
+
} & Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'title'>>;
|
|
33
|
+
export declare const InternalSideNavigationGroupLink: FC<NavigationComponentProps & {
|
|
34
|
+
id: string;
|
|
35
|
+
to: string;
|
|
36
|
+
title: string;
|
|
37
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
38
|
+
className: string | undefined;
|
|
39
|
+
tag: BadgeTagProps | undefined;
|
|
26
40
|
parentId: string;
|
|
27
41
|
}>;
|
|
28
|
-
export declare const InternalSideNavigationGroupTrigger: FC<
|
|
42
|
+
export declare const InternalSideNavigationGroupTrigger: FC<{
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
46
|
+
className: string | undefined;
|
|
47
|
+
tag: BadgeTagProps | undefined;
|
|
29
48
|
onClick?: (e: MouseEvent<any>) => void;
|
|
30
49
|
}>;
|
|
31
50
|
export declare const InternalSideNavigationGroupDivider: () => import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
export declare const InternalSideNavigationGroup: FC<
|
|
51
|
+
export declare const InternalSideNavigationGroup: FC<NavigationComponentProps & {
|
|
52
|
+
id: string;
|
|
53
|
+
to: string | undefined;
|
|
54
|
+
title: string;
|
|
55
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
56
|
+
icon: IconProps['svg'] | undefined;
|
|
57
|
+
iconActive: IconProps['svg'] | undefined;
|
|
58
|
+
className: string | undefined;
|
|
59
|
+
tag: BadgeTagProps | undefined;
|
|
33
60
|
children: ReactNode;
|
|
34
61
|
submenuExpanded: boolean;
|
|
35
|
-
onExpandToggle?: (e: MouseEvent<never>) => void;
|
|
36
|
-
tag: BadgeTagProps | undefined;
|
|
37
|
-
to: NavigationItemData['to'] | undefined;
|
|
38
62
|
onClick?: (e: MouseEvent<never>) => void;
|
|
63
|
+
onExpandToggle(e: MouseEvent<never>): void;
|
|
39
64
|
}>;
|
|
40
|
-
export {};
|
|
41
65
|
//# sourceMappingURL=layout-sidebar-links-internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-sidebar-links-internal.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-sidebar-links-internal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout-sidebar-links-internal.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-sidebar-links-internal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAI/D,OAAO,EAAE,wBAAwB,EAAE,EAAE,EAAY,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtF,OAAO,EAAY,aAAa,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAIhE,MAAM,WAAW,sCAAsC;IACnD,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IACnC,UAAU,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,aAAa,GAAG,SAAS,CAAC;CAClC;AA2CD,qDAAqD;AACrD,eAAO,MAAM,0BAA0B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KAAK,CAAC,KAAK,IAAI,CAAC;IACzC,cAAc,CAAC,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CAC9C,CAgFJ,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Icon } from '@servicetitan/anvil2';
|
|
2
|
+
import { Button, Icon } from '@servicetitan/anvil2';
|
|
3
3
|
import SvgGroupCollapse from '@servicetitan/anvil2/assets/icons/material/round/expand_less.svg';
|
|
4
4
|
import SvgGroupExpand from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { Fragment } from 'react';
|
|
7
|
-
import { getCounterTag } from '../../utils/side-nav';
|
|
8
7
|
import { BadgeTag } from '../badge-tag';
|
|
9
8
|
import * as Styles from './layout-sidebar.module.less';
|
|
10
|
-
|
|
9
|
+
import { withTooltip } from './with-tooltip';
|
|
10
|
+
const InternalSideNavigationItemContent = ({ icon, iconActive, tag, title })=>/*#__PURE__*/ _jsxs(Fragment, {
|
|
11
11
|
children: [
|
|
12
12
|
/*#__PURE__*/ _jsxs("div", {
|
|
13
13
|
className: Styles.navItemIconWrapper,
|
|
@@ -29,21 +29,6 @@ const InternalSideNavigationItemContent = ({ icon, iconActive, tag, title, subme
|
|
|
29
29
|
data: tag,
|
|
30
30
|
className: Styles.navItemCounter,
|
|
31
31
|
longClassName: Styles.navItemCounterLong
|
|
32
|
-
}),
|
|
33
|
-
typeof submenuExpanded === 'boolean' && /*#__PURE__*/ _jsxs("div", {
|
|
34
|
-
className: Styles.navItemGroupToggleWrapper,
|
|
35
|
-
children: [
|
|
36
|
-
/*#__PURE__*/ _jsx(Icon, {
|
|
37
|
-
svg: submenuExpanded ? SvgGroupCollapse : SvgGroupExpand,
|
|
38
|
-
className: Styles.navItemGroupToggle,
|
|
39
|
-
onClick: onExpandToggle
|
|
40
|
-
}),
|
|
41
|
-
/*#__PURE__*/ _jsx("div", {
|
|
42
|
-
className: Styles.navItemGroupToggleClick,
|
|
43
|
-
"data-cy": "nav-item-group-expand",
|
|
44
|
-
onClick: onExpandToggle
|
|
45
|
-
})
|
|
46
|
-
]
|
|
47
32
|
})
|
|
48
33
|
]
|
|
49
34
|
}),
|
|
@@ -56,11 +41,11 @@ const InternalSideNavigationItemContent = ({ icon, iconActive, tag, title, subme
|
|
|
56
41
|
})
|
|
57
42
|
]
|
|
58
43
|
});
|
|
59
|
-
/** Side Navigation menu item (for internal usage) */ export const InternalSideNavigationLink = ({ id, to,
|
|
44
|
+
/** Side Navigation menu item (for internal usage) */ export const InternalSideNavigationLink = ({ id, to, title, isActive, icon, iconActive, className, tag, navigationComponent: NavigationComponent, ...rest })=>{
|
|
60
45
|
return /*#__PURE__*/ _jsx(NavigationComponent, {
|
|
61
46
|
"data-cy": `navigation-item-${id}`,
|
|
62
47
|
"data-pendo": `navigation-item-${id}`,
|
|
63
|
-
...
|
|
48
|
+
...rest,
|
|
64
49
|
className: classNames(Styles.navItem, Styles.navLink, className, {
|
|
65
50
|
[Styles.navItemActive]: isActive === true,
|
|
66
51
|
[Styles.navItemIconSwitch]: !!icon && !!iconActive
|
|
@@ -71,27 +56,22 @@ const InternalSideNavigationItemContent = ({ icon, iconActive, tag, title, subme
|
|
|
71
56
|
children: /*#__PURE__*/ _jsx(InternalSideNavigationItemContent, {
|
|
72
57
|
icon: icon,
|
|
73
58
|
iconActive: iconActive,
|
|
74
|
-
submenuExpanded: submenuExpanded,
|
|
75
|
-
onExpandToggle: onExpandToggle,
|
|
76
59
|
title: title,
|
|
77
60
|
tag: tag
|
|
78
61
|
})
|
|
79
62
|
});
|
|
80
63
|
};
|
|
81
|
-
/** Side Navigation menu trigger (for internal usage) */ export const InternalSideNavigationTrigger = ({
|
|
64
|
+
/** Side Navigation menu trigger (for internal usage) */ export const InternalSideNavigationTrigger = ({ id, title, isActive, icon, iconActive, className, tag, ...rest })=>{
|
|
82
65
|
return /*#__PURE__*/ _jsx("div", {
|
|
83
66
|
"data-cy": `navigation-item-${id}`,
|
|
84
67
|
"data-pendo": `navigation-item-${id}`,
|
|
85
|
-
...
|
|
68
|
+
...rest,
|
|
86
69
|
className: classNames(Styles.navItem, className, {
|
|
87
|
-
[Styles.navLink]: !!onClick,
|
|
70
|
+
[Styles.navLink]: !!rest.onClick,
|
|
88
71
|
[Styles.navItemActive]: isActive === true,
|
|
89
72
|
[Styles.navItemIconSwitch]: !!icon && !!iconActive
|
|
90
73
|
}),
|
|
91
|
-
onClick: onClick,
|
|
92
74
|
children: /*#__PURE__*/ _jsx(InternalSideNavigationItemContent, {
|
|
93
|
-
submenuExpanded: submenuExpanded,
|
|
94
|
-
onExpandToggle: onExpandToggle,
|
|
95
75
|
icon: icon,
|
|
96
76
|
iconActive: iconActive,
|
|
97
77
|
title: title,
|
|
@@ -99,13 +79,13 @@ const InternalSideNavigationItemContent = ({ icon, iconActive, tag, title, subme
|
|
|
99
79
|
})
|
|
100
80
|
});
|
|
101
81
|
};
|
|
102
|
-
export const InternalSideNavigationGroupLink = ({ id,
|
|
82
|
+
export const InternalSideNavigationGroupLink = ({ id, to, title, isActive, className, tag, parentId, navigationComponent: NavigationComponent, ...rest })=>{
|
|
103
83
|
return /*#__PURE__*/ _jsxs(NavigationComponent, {
|
|
104
84
|
"data-cy": `navigation-item-${parentId}--${id}`,
|
|
105
85
|
"data-pendo": `navigation-item-${parentId}--${id}`,
|
|
106
86
|
...rest,
|
|
107
87
|
to: to,
|
|
108
|
-
className: classNames(Styles.submenuItem, Styles.submenuLink, {
|
|
88
|
+
className: classNames(Styles.submenuItem, Styles.submenuLink, className, {
|
|
109
89
|
[Styles.submenuLinkActive]: isActive === true
|
|
110
90
|
}),
|
|
111
91
|
isActive: typeof isActive === 'function' ? isActive : undefined,
|
|
@@ -115,28 +95,27 @@ export const InternalSideNavigationGroupLink = ({ id, counter, parentId, tag, ti
|
|
|
115
95
|
children: title
|
|
116
96
|
}),
|
|
117
97
|
/*#__PURE__*/ _jsx(BadgeTag, {
|
|
118
|
-
data:
|
|
98
|
+
data: tag,
|
|
119
99
|
className: Styles.submenuLinkCounter
|
|
120
100
|
})
|
|
121
101
|
]
|
|
122
102
|
}, id);
|
|
123
103
|
};
|
|
124
|
-
export const InternalSideNavigationGroupTrigger = ({ id,
|
|
104
|
+
export const InternalSideNavigationGroupTrigger = ({ id, title, isActive, className, tag, ...rest })=>{
|
|
125
105
|
return /*#__PURE__*/ _jsxs("div", {
|
|
126
106
|
"data-cy": `navigation-item-${id}`,
|
|
127
107
|
"data-pendo": `navigation-item-${id}`,
|
|
128
108
|
...rest,
|
|
129
109
|
className: classNames(Styles.submenuItem, {
|
|
130
|
-
[Styles.submenuLink]: !!onClick,
|
|
110
|
+
[Styles.submenuLink]: !!rest.onClick,
|
|
131
111
|
[Styles.submenuLinkActive]: isActive === true
|
|
132
112
|
}),
|
|
133
|
-
onClick: onClick,
|
|
134
113
|
children: [
|
|
135
114
|
/*#__PURE__*/ _jsx("span", {
|
|
136
115
|
children: title
|
|
137
116
|
}),
|
|
138
117
|
/*#__PURE__*/ _jsx(BadgeTag, {
|
|
139
|
-
data:
|
|
118
|
+
data: tag,
|
|
140
119
|
className: Styles.submenuLinkCounter
|
|
141
120
|
})
|
|
142
121
|
]
|
|
@@ -147,31 +126,63 @@ export const InternalSideNavigationGroupDivider = ()=>{
|
|
|
147
126
|
className: Styles.divider
|
|
148
127
|
});
|
|
149
128
|
};
|
|
150
|
-
export const InternalSideNavigationGroup = ({ children, submenuExpanded,
|
|
129
|
+
export const InternalSideNavigationGroup = ({ id, to, title, isActive, icon, iconActive, className, tag, children, submenuExpanded, onExpandToggle, onClick, navigationComponent, ...rest })=>{
|
|
130
|
+
const onRootClickCapture = (e)=>{
|
|
131
|
+
if (!submenuExpanded) {
|
|
132
|
+
onExpandToggle === null || onExpandToggle === void 0 ? void 0 : onExpandToggle(e);
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
e.stopPropagation();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
151
137
|
return /*#__PURE__*/ _jsxs("div", {
|
|
152
138
|
className: classNames(Styles.navGroupWrapper),
|
|
153
139
|
children: [
|
|
154
|
-
/*#__PURE__*/
|
|
140
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
155
141
|
className: Styles.navGroupItem,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
142
|
+
onClickCapture: onRootClickCapture,
|
|
143
|
+
children: [
|
|
144
|
+
to ? /*#__PURE__*/ _jsx(InternalSideNavigationLink, {
|
|
145
|
+
id: id,
|
|
146
|
+
to: to,
|
|
147
|
+
title: title,
|
|
148
|
+
isActive: isActive,
|
|
149
|
+
icon: icon,
|
|
150
|
+
iconActive: iconActive,
|
|
151
|
+
tag: tag,
|
|
152
|
+
className: className,
|
|
153
|
+
...rest,
|
|
154
|
+
navigationComponent: navigationComponent
|
|
155
|
+
}) : /*#__PURE__*/ _jsx(InternalSideNavigationTrigger, {
|
|
156
|
+
id: id,
|
|
157
|
+
title: title,
|
|
158
|
+
isActive: isActive === true || undefined,
|
|
159
|
+
icon: icon,
|
|
160
|
+
iconActive: iconActive,
|
|
161
|
+
tag: tag,
|
|
162
|
+
className: className,
|
|
163
|
+
...rest
|
|
164
|
+
}),
|
|
165
|
+
/*#__PURE__*/ _jsx("div", {
|
|
166
|
+
className: Styles.navItemGroupToggleWrapper,
|
|
167
|
+
children: withTooltip(/*#__PURE__*/ _jsx(Button, {
|
|
168
|
+
appearance: "secondary",
|
|
169
|
+
size: "small",
|
|
170
|
+
icon: submenuExpanded ? SvgGroupCollapse : SvgGroupExpand,
|
|
171
|
+
className: Styles.navItemGroupToggle,
|
|
172
|
+
onClick: onExpandToggle,
|
|
173
|
+
"aria-label": "Toggle submenu",
|
|
174
|
+
"data-cy": "nav-item-group-expand"
|
|
175
|
+
}), submenuExpanded ? 'Hide Submenu' : 'View Submenu', {
|
|
176
|
+
placement: 'top-end'
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
]
|
|
169
180
|
}),
|
|
170
181
|
/*#__PURE__*/ _jsx("div", {
|
|
171
182
|
className: classNames(Styles.submenuWrapper, {
|
|
172
183
|
[Styles.submenuWrapperCollapsed]: !submenuExpanded
|
|
173
184
|
}),
|
|
174
|
-
"data-cy": `navigation-submenu-${
|
|
185
|
+
"data-cy": `navigation-submenu-${id}`,
|
|
175
186
|
children: /*#__PURE__*/ _jsx("div", {
|
|
176
187
|
className: Styles.submenu,
|
|
177
188
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/titan-layout/layout-sidebar-links-internal.tsx"],"sourcesContent":["import { Icon } from '@servicetitan/anvil2';\nimport SvgGroupCollapse from '@servicetitan/anvil2/assets/icons/material/round/expand_less.svg';\nimport SvgGroupExpand from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';\n\nimport classNames from 'classnames';\nimport { FC, Fragment, MouseEvent, ReactNode } from 'react';\nimport { NavigationItemData, NavigationSubmenuItemData } from '../../utils/navigation';\nimport { getCounterTag } from '../../utils/side-nav';\nimport { BadgeTag, BadgeTagProps } from '../badge-tag';\nimport { TitanLayoutLinkProps, TitanLayoutTriggerProps } from './interface';\nimport { NavigationComponentProps } from './interface-internal';\nimport * as Styles from './layout-sidebar.module.less';\n\nexport interface InternalSideNavigationItemContentProps {\n icon: TitanLayoutLinkProps['icon'];\n iconActive: TitanLayoutLinkProps['iconActive'];\n title: TitanLayoutLinkProps['title'];\n submenuExpanded: boolean | undefined;\n tag: BadgeTagProps | undefined;\n onExpandToggle?: (e: MouseEvent<never>) => void;\n}\n\nconst InternalSideNavigationItemContent: FC<InternalSideNavigationItemContentProps> = ({\n icon,\n iconActive,\n tag,\n title,\n submenuExpanded,\n onExpandToggle,\n}) => (\n <Fragment>\n <div className={Styles.navItemIconWrapper}>\n {icon && (\n <Icon svg={icon} className={classNames(Styles.navIcon, Styles.navIconInactive)} />\n )}\n {iconActive && (\n <Icon\n svg={iconActive}\n className={classNames(Styles.navIcon, Styles.navIconActive)}\n />\n )}\n\n <div className={Styles.navItemTextExpanded} data-cy=\"nav-item-label\">\n {title}\n </div>\n {!!tag && (\n <BadgeTag\n data={tag}\n className={Styles.navItemCounter}\n longClassName={Styles.navItemCounterLong}\n />\n )}\n {typeof submenuExpanded === 'boolean' && (\n <div className={Styles.navItemGroupToggleWrapper}>\n <Icon\n svg={submenuExpanded ? SvgGroupCollapse : SvgGroupExpand}\n className={Styles.navItemGroupToggle}\n onClick={onExpandToggle}\n />\n <div\n className={Styles.navItemGroupToggleClick}\n data-cy=\"nav-item-group-expand\"\n onClick={onExpandToggle}\n />\n </div>\n )}\n </div>\n\n <div\n className={classNames(Styles.navItemTextCollapsed, {\n [Styles.navItemTextSmall]: !!title && title.length >= 10,\n })}\n data-cy=\"nav-item-label\"\n >\n {title}\n </div>\n </Fragment>\n);\ninterface InternalLinkProps {\n submenuExpanded: boolean | undefined;\n tag: BadgeTagProps | undefined;\n onExpandToggle?: (e: MouseEvent<never>) => void;\n}\n\nexport type InternalSideNavigationLinkProps = Omit<\n TitanLayoutLinkProps,\n 'wrapper' | 'counter' | 'tag'\n> &\n NavigationComponentProps &\n InternalLinkProps;\n\n/** Side Navigation menu item (for internal usage) */\nexport const InternalSideNavigationLink: FC<InternalSideNavigationLinkProps> = ({\n id,\n to,\n className,\n icon,\n iconActive,\n isActive,\n navigationComponent: NavigationComponent,\n tag,\n title,\n submenuExpanded,\n onExpandToggle,\n ...props\n}) => {\n return (\n <NavigationComponent\n data-cy={`navigation-item-${id}`}\n data-pendo={`navigation-item-${id}`}\n {...props}\n className={classNames(Styles.navItem, Styles.navLink, className, {\n [Styles.navItemActive]: isActive === true,\n [Styles.navItemIconSwitch]: !!icon && !!iconActive,\n })}\n to={to}\n isActive={typeof isActive === 'function' ? isActive : undefined}\n activeClassName={Styles.navItemActive}\n >\n <InternalSideNavigationItemContent\n icon={icon}\n iconActive={iconActive}\n submenuExpanded={submenuExpanded}\n onExpandToggle={onExpandToggle}\n title={title}\n tag={tag}\n />\n </NavigationComponent>\n );\n};\n\nexport type InternalSideNavigationTriggerProps = Omit<\n TitanLayoutTriggerProps,\n 'wrapper' | 'counter' | 'tag'\n> &\n InternalLinkProps;\n\n/** Side Navigation menu trigger (for internal usage) */\nexport const InternalSideNavigationTrigger: FC<InternalSideNavigationTriggerProps> = ({\n className,\n icon,\n iconActive,\n id,\n isActive,\n submenuExpanded,\n onExpandToggle,\n onClick,\n title,\n tag,\n ...props\n}) => {\n return (\n <div\n data-cy={`navigation-item-${id}`}\n data-pendo={`navigation-item-${id}`}\n {...props}\n className={classNames(Styles.navItem, className, {\n [Styles.navLink]: !!onClick,\n [Styles.navItemActive]: isActive === true,\n [Styles.navItemIconSwitch]: !!icon && !!iconActive,\n })}\n onClick={onClick}\n >\n <InternalSideNavigationItemContent\n submenuExpanded={submenuExpanded}\n onExpandToggle={onExpandToggle}\n icon={icon}\n iconActive={iconActive}\n title={title}\n tag={tag}\n />\n </div>\n );\n};\n\nexport const InternalSideNavigationGroupLink: FC<\n NavigationSubmenuItemData & NavigationComponentProps & { parentId: string }\n> = ({\n id,\n counter,\n parentId,\n tag,\n title,\n to,\n isActive,\n navigationComponent: NavigationComponent,\n ...rest\n}) => {\n return (\n <NavigationComponent\n key={id}\n data-cy={`navigation-item-${parentId}--${id}`}\n data-pendo={`navigation-item-${parentId}--${id}`}\n {...rest}\n to={to}\n className={classNames(Styles.submenuItem, Styles.submenuLink, {\n [Styles.submenuLinkActive]: isActive === true,\n })}\n isActive={typeof isActive === 'function' ? isActive : undefined}\n activeClassName={Styles.submenuLinkActive}\n >\n <span>{title}</span>\n <BadgeTag data={getCounterTag(counter, tag)} className={Styles.submenuLinkCounter} />\n </NavigationComponent>\n );\n};\n\nexport const InternalSideNavigationGroupTrigger: FC<\n Omit<NavigationSubmenuItemData, 'to'> & { onClick?: (e: MouseEvent<any>) => void }\n> = ({ id, counter, onClick, tag, title, isActive, ...rest }) => {\n return (\n <div\n data-cy={`navigation-item-${id}`}\n data-pendo={`navigation-item-${id}`}\n key={id}\n {...rest}\n className={classNames(Styles.submenuItem, {\n [Styles.submenuLink]: !!onClick,\n [Styles.submenuLinkActive]: isActive === true,\n })}\n onClick={onClick}\n >\n <span>{title}</span>\n <BadgeTag data={getCounterTag(counter, tag)} className={Styles.submenuLinkCounter} />\n </div>\n );\n};\n\nexport const InternalSideNavigationGroupDivider = () => {\n return <div className={Styles.divider} />;\n};\n\nexport const InternalSideNavigationGroup: FC<\n Omit<NavigationItemData, 'tag' | 'counter' | 'to'> &\n NavigationComponentProps & {\n children: ReactNode;\n submenuExpanded: boolean;\n onExpandToggle?: (e: MouseEvent<never>) => void;\n tag: BadgeTagProps | undefined;\n to: NavigationItemData['to'] | undefined;\n onClick?: (e: MouseEvent<never>) => void;\n }\n> = ({ children, submenuExpanded, to, onExpandToggle, onClick, isActive, ...props }) => {\n return (\n <div className={classNames(Styles.navGroupWrapper)}>\n <div className={Styles.navGroupItem}>\n {to ? (\n <InternalSideNavigationLink\n {...props}\n isActive={isActive}\n to={to}\n submenuExpanded={submenuExpanded}\n onExpandToggle={onExpandToggle}\n />\n ) : (\n <InternalSideNavigationTrigger\n {...props}\n isActive={isActive === true || undefined}\n submenuExpanded={submenuExpanded}\n onExpandToggle={onExpandToggle}\n onClick={onClick}\n />\n )}\n </div>\n <div\n className={classNames(Styles.submenuWrapper, {\n [Styles.submenuWrapperCollapsed]: !submenuExpanded,\n })}\n data-cy={`navigation-submenu-${props.id}`}\n >\n <div className={Styles.submenu}>{children}</div>\n </div>\n </div>\n );\n};\n"],"names":["Icon","SvgGroupCollapse","SvgGroupExpand","classNames","Fragment","getCounterTag","BadgeTag","Styles","InternalSideNavigationItemContent","icon","iconActive","tag","title","submenuExpanded","onExpandToggle","div","className","navItemIconWrapper","svg","navIcon","navIconInactive","navIconActive","navItemTextExpanded","data-cy","data","navItemCounter","longClassName","navItemCounterLong","navItemGroupToggleWrapper","navItemGroupToggle","onClick","navItemGroupToggleClick","navItemTextCollapsed","navItemTextSmall","length","InternalSideNavigationLink","id","to","isActive","navigationComponent","NavigationComponent","props","data-pendo","navItem","navLink","navItemActive","navItemIconSwitch","undefined","activeClassName","InternalSideNavigationTrigger","InternalSideNavigationGroupLink","counter","parentId","rest","submenuItem","submenuLink","submenuLinkActive","span","submenuLinkCounter","InternalSideNavigationGroupTrigger","InternalSideNavigationGroupDivider","divider","InternalSideNavigationGroup","children","navGroupWrapper","navGroupItem","submenuWrapper","submenuWrapperCollapsed","submenu"],"mappings":";AAAA,SAASA,IAAI,QAAQ,uBAAuB;AAC5C,OAAOC,sBAAsB,mEAAmE;AAChG,OAAOC,oBAAoB,mEAAmE;AAE9F,OAAOC,gBAAgB,aAAa;AACpC,SAAaC,QAAQ,QAA+B,QAAQ;AAE5D,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,QAAQ,QAAuB,eAAe;AAGvD,YAAYC,YAAY,+BAA+B;AAWvD,MAAMC,oCAAgF,CAAC,EACnFC,IAAI,EACJC,UAAU,EACVC,GAAG,EACHC,KAAK,EACLC,eAAe,EACfC,cAAc,EACjB,iBACG,MAACV;;0BACG,MAACW;gBAAIC,WAAWT,OAAOU,kBAAkB;;oBACpCR,sBACG,KAACT;wBAAKkB,KAAKT;wBAAMO,WAAWb,WAAWI,OAAOY,OAAO,EAAEZ,OAAOa,eAAe;;oBAEhFV,4BACG,KAACV;wBACGkB,KAAKR;wBACLM,WAAWb,WAAWI,OAAOY,OAAO,EAAEZ,OAAOc,aAAa;;kCAIlE,KAACN;wBAAIC,WAAWT,OAAOe,mBAAmB;wBAAEC,WAAQ;kCAC/CX;;oBAEJ,CAAC,CAACD,qBACC,KAACL;wBACGkB,MAAMb;wBACNK,WAAWT,OAAOk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BAIrB,KAACf;gBACGC,WAAWb,WAAWI,OAAO2D,cAAc,EAAE;oBACzC,CAAC3D,OAAO4D,uBAAuB,CAAC,EAAE,CAACtD;gBACvC;gBACAU,WAAS,CAAC,mBAAmB,EAAEkB,MAAML,EAAE,EAAE;0BAEzC,cAAA,KAACrB;oBAAIC,WAAWT,OAAO6D,OAAO;8BAAGL;;;;;AAIjD,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/titan-layout/layout-sidebar-links-internal.tsx"],"sourcesContent":["import { Button, Icon, IconProps } from '@servicetitan/anvil2';\nimport SvgGroupCollapse from '@servicetitan/anvil2/assets/icons/material/round/expand_less.svg';\nimport SvgGroupExpand from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';\nimport classNames from 'classnames';\nimport { ComponentPropsWithoutRef, FC, Fragment, MouseEvent, ReactNode } from 'react';\n\nimport { BadgeTag, BadgeTagProps } from '../badge-tag';\nimport { NavigationComponentProps } from './interface-internal';\nimport * as Styles from './layout-sidebar.module.less';\nimport { withTooltip } from './with-tooltip';\n\nexport interface InternalSideNavigationItemContentProps {\n icon: IconProps['svg'] | undefined;\n iconActive: IconProps['svg'] | undefined;\n title: string;\n tag: BadgeTagProps | undefined;\n}\n\nconst InternalSideNavigationItemContent: FC<InternalSideNavigationItemContentProps> = ({\n icon,\n iconActive,\n tag,\n title,\n}) => (\n <Fragment>\n <div className={Styles.navItemIconWrapper}>\n {icon && (\n <Icon svg={icon} className={classNames(Styles.navIcon, Styles.navIconInactive)} />\n )}\n {iconActive && (\n <Icon\n svg={iconActive}\n className={classNames(Styles.navIcon, Styles.navIconActive)}\n />\n )}\n\n <div className={Styles.navItemTextExpanded} data-cy=\"nav-item-label\">\n {title}\n </div>\n {!!tag && (\n <BadgeTag\n data={tag}\n className={Styles.navItemCounter}\n longClassName={Styles.navItemCounterLong}\n />\n )}\n </div>\n\n <div\n className={classNames(Styles.navItemTextCollapsed, {\n [Styles.navItemTextSmall]: !!title && title.length >= 10,\n })}\n data-cy=\"nav-item-label\"\n >\n {title}\n </div>\n </Fragment>\n);\n\n/** Side Navigation menu item (for internal usage) */\nexport const InternalSideNavigationLink: FC<\n NavigationComponentProps & {\n id: string;\n to: string;\n title: string;\n isActive: boolean | ((pathname: string) => boolean) | undefined;\n icon: IconProps['svg'] | undefined;\n iconActive: IconProps['svg'] | undefined;\n className: string | undefined;\n tag: BadgeTagProps | undefined;\n } & Omit<ComponentPropsWithoutRef<'a'>, 'children' | 'title'>\n> = ({\n id,\n to,\n title,\n isActive,\n icon,\n iconActive,\n className,\n tag,\n\n navigationComponent: NavigationComponent,\n ...rest\n}) => {\n return (\n <NavigationComponent\n data-cy={`navigation-item-${id}`}\n data-pendo={`navigation-item-${id}`}\n {...rest}\n className={classNames(Styles.navItem, Styles.navLink, className, {\n [Styles.navItemActive]: isActive === true,\n [Styles.navItemIconSwitch]: !!icon && !!iconActive,\n })}\n to={to}\n isActive={typeof isActive === 'function' ? isActive : undefined}\n activeClassName={Styles.navItemActive}\n >\n <InternalSideNavigationItemContent\n icon={icon}\n iconActive={iconActive}\n title={title}\n tag={tag}\n />\n </NavigationComponent>\n );\n};\n\n/** Side Navigation menu trigger (for internal usage) */\nexport const InternalSideNavigationTrigger: FC<\n {\n id: string;\n title: string;\n isActive: boolean | undefined;\n icon: IconProps['svg'] | undefined;\n iconActive: IconProps['svg'] | undefined;\n className: string | undefined;\n\n tag: BadgeTagProps | undefined;\n onClick?: (e: MouseEvent<never>) => void;\n } & Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'title'>\n> = ({\n id,\n title,\n isActive,\n icon,\n iconActive,\n className,\n\n tag,\n ...rest\n}) => {\n return (\n <div\n data-cy={`navigation-item-${id}`}\n data-pendo={`navigation-item-${id}`}\n {...rest}\n className={classNames(Styles.navItem, className, {\n [Styles.navLink]: !!rest.onClick,\n [Styles.navItemActive]: isActive === true,\n [Styles.navItemIconSwitch]: !!icon && !!iconActive,\n })}\n >\n <InternalSideNavigationItemContent\n icon={icon}\n iconActive={iconActive}\n title={title}\n tag={tag}\n />\n </div>\n );\n};\n\nexport const InternalSideNavigationGroupLink: FC<\n NavigationComponentProps & {\n id: string;\n to: string;\n title: string;\n isActive: boolean | ((pathname: string) => boolean) | undefined;\n className: string | undefined;\n tag: BadgeTagProps | undefined;\n\n parentId: string;\n }\n> = ({\n id,\n to,\n title,\n isActive,\n className,\n tag,\n\n parentId,\n navigationComponent: NavigationComponent,\n ...rest\n}) => {\n return (\n <NavigationComponent\n key={id}\n data-cy={`navigation-item-${parentId}--${id}`}\n data-pendo={`navigation-item-${parentId}--${id}`}\n {...rest}\n to={to}\n className={classNames(Styles.submenuItem, Styles.submenuLink, className, {\n [Styles.submenuLinkActive]: isActive === true,\n })}\n isActive={typeof isActive === 'function' ? isActive : undefined}\n activeClassName={Styles.submenuLinkActive}\n >\n <span>{title}</span>\n <BadgeTag data={tag} className={Styles.submenuLinkCounter} />\n </NavigationComponent>\n );\n};\n\nexport const InternalSideNavigationGroupTrigger: FC<{\n id: string;\n title: string;\n isActive: boolean | ((pathname: string) => boolean) | undefined;\n className: string | undefined;\n tag: BadgeTagProps | undefined;\n\n onClick?: (e: MouseEvent<any>) => void;\n}> = ({\n id,\n title,\n isActive,\n className,\n tag,\n\n ...rest\n}) => {\n return (\n <div\n data-cy={`navigation-item-${id}`}\n data-pendo={`navigation-item-${id}`}\n key={id}\n {...rest}\n className={classNames(Styles.submenuItem, {\n [Styles.submenuLink]: !!rest.onClick,\n [Styles.submenuLinkActive]: isActive === true,\n })}\n >\n <span>{title}</span>\n <BadgeTag data={tag} className={Styles.submenuLinkCounter} />\n </div>\n );\n};\n\nexport const InternalSideNavigationGroupDivider = () => {\n return <div className={Styles.divider} />;\n};\n\nexport const InternalSideNavigationGroup: FC<\n NavigationComponentProps & {\n id: string;\n to: string | undefined;\n title: string;\n isActive: boolean | ((pathname: string) => boolean) | undefined;\n icon: IconProps['svg'] | undefined;\n iconActive: IconProps['svg'] | undefined;\n className: string | undefined;\n tag: BadgeTagProps | undefined;\n\n children: ReactNode;\n submenuExpanded: boolean;\n onClick?: (e: MouseEvent<never>) => void;\n onExpandToggle(e: MouseEvent<never>): void;\n }\n> = ({\n id,\n to,\n title,\n isActive,\n icon,\n iconActive,\n className,\n tag,\n\n children,\n submenuExpanded,\n onExpandToggle,\n onClick,\n navigationComponent,\n ...rest\n}) => {\n const onRootClickCapture = (e: MouseEvent<never>) => {\n if (!submenuExpanded) {\n onExpandToggle?.(e);\n e.preventDefault();\n e.stopPropagation();\n }\n };\n return (\n <div className={classNames(Styles.navGroupWrapper)}>\n <div className={Styles.navGroupItem} onClickCapture={onRootClickCapture}>\n {to ? (\n <InternalSideNavigationLink\n id={id}\n to={to}\n title={title}\n isActive={isActive}\n icon={icon}\n iconActive={iconActive}\n tag={tag}\n className={className}\n {...rest}\n navigationComponent={navigationComponent}\n />\n ) : (\n <InternalSideNavigationTrigger\n id={id}\n title={title}\n isActive={isActive === true || undefined}\n icon={icon}\n iconActive={iconActive}\n tag={tag}\n className={className}\n {...rest}\n />\n )}\n\n <div className={Styles.navItemGroupToggleWrapper}>\n {withTooltip(\n <Button\n appearance=\"secondary\"\n size=\"small\"\n icon={submenuExpanded ? SvgGroupCollapse : SvgGroupExpand}\n className={Styles.navItemGroupToggle}\n onClick={onExpandToggle}\n aria-label=\"Toggle submenu\"\n data-cy=\"nav-item-group-expand\"\n />,\n submenuExpanded ? 'Hide Submenu' : 'View Submenu',\n { placement: 'top-end' }\n )}\n </div>\n </div>\n <div\n className={classNames(Styles.submenuWrapper, {\n [Styles.submenuWrapperCollapsed]: !submenuExpanded,\n })}\n data-cy={`navigation-submenu-${id}`}\n >\n <div className={Styles.submenu}>{children}</div>\n </div>\n </div>\n );\n};\n"],"names":["Button","Icon","SvgGroupCollapse","SvgGroupExpand","classNames","Fragment","BadgeTag","Styles","withTooltip","InternalSideNavigationItemContent","icon","iconActive","tag","title","div","className","navItemIconWrapper","svg","navIcon","navIconInactive","navIconActive","navItemTextExpanded","data-cy","data","navItemCounter","longClassName","navItemCounterLong","navItemTextCollapsed","navItemTextSmall","length","InternalSideNavigationLink","id","to","isActive","navigationComponent","NavigationComponent","rest","data-pendo","navItem","navLink","navItemActive","navItemIconSwitch","undefined","activeClassName","InternalSideNavigationTrigger","onClick","InternalSideNavigationGroupLink","parentId","submenuItem","submenuLink","submenuLinkActive","span","submenuLinkCounter","InternalSideNavigationGroupTrigger","InternalSideNavigationGroupDivider","divider","InternalSideNavigationGroup","children","submenuExpanded","onExpandToggle","onRootClickCapture","e","preventDefault","stopPropagation","navGroupWrapper","navGroupItem","onClickCapture","navItemGroupToggleWrapper","appearance","size","navItemGroupToggle","aria-label","placement","submenuWrapper","submenuWrapperCollapsed","submenu"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAAmB,uBAAuB;AAC/D,OAAOC,sBAAsB,mEAAmE;AAChG,OAAOC,oBAAoB,mEAAmE;AAC9F,OAAOC,gBAAgB,aAAa;AACpC,SAAuCC,QAAQ,QAA+B,QAAQ;AAEtF,SAASC,QAAQ,QAAuB,eAAe;AAEvD,YAAYC,YAAY,+BAA+B;AACvD,SAASC,WAAW,QAAQ,iBAAiB;AAS7C,MAAMC,oCAAgF,CAAC,EACnFC,IAAI,EACJC,UAAU,EACVC,GAAG,EACHC,KAAK,EACR,iBACG,MAACR;;0BACG,MAACS;gBAAIC,WAAWR,OAAOS,kBAAkB;;oBACpCN,sBACG,KAACT;wBAAKgB,KAAKP;wBAAMK,WAAWX,WAAWG,OAAOW,OAAO,EAAEX,OAAOY,eAAe;;oBAEhFR,4BACG,KAACV;wBACGgB,KAAKN;wBACLI,WAAWX,WAAWG,OAAOW,OAAO,EAAEX,OAAOa,aAAa;;kCAIlE,KAACN;wBAAIC,WAAWR,OAAOc,mBAAmB;wBAAEC,WAAQ;kCAC/CT;;oBAEJ,CAAC,CAACD,qBACC,KAACN;wBACGiB,MAAMX;wBACNG,WAAWR,OAAOiB,cAAc;wBAChCC,eAAelB,OAAOmB,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AmBC;4BAC3CY,WAAWR,OAAO+D,kBAAkB;4BACpCzB,SAASc;4BACTY,cAAW;4BACXjD,WAAQ;4BAEZoC,kBAAkB,iBAAiB,gBACnC;4BAAEc,WAAW;wBAAU;;;;0BAInC,KAAC1D;gBACGC,WAAWX,WAAWG,OAAOkE,cAAc,EAAE;oBACzC,CAAClE,OAAOmE,uBAAuB,CAAC,EAAE,CAAChB;gBACvC;gBACApC,WAAS,CAAC,mBAAmB,EAAES,IAAI;0BAEnC,cAAA,KAACjB;oBAAIC,WAAWR,OAAOoE,OAAO;8BAAGlB;;;;;AAIjD,EAAE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TitanLayoutLinkProps, TitanLayoutTriggerProps } from './interface';
|
|
2
2
|
/** Side Navigation menu link */
|
|
3
|
-
export declare function LayoutSidebarLink({ counter, tag, tooltip, wrapper, ...
|
|
3
|
+
export declare function LayoutSidebarLink({ id, to, title, isActive, icon, iconActive, counter, tag, className, tooltip, wrapper, extra, side, ...rest }: TitanLayoutLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
/** Side Navigation menu trigger */
|
|
5
|
-
export declare function LayoutSidebarTrigger({ counter, tag, tooltip, wrapper,
|
|
5
|
+
export declare function LayoutSidebarTrigger({ id, title, isActive, icon, iconActive, counter, tag, className, tooltip, wrapper, extra, side, ...rest }: TitanLayoutTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
//# sourceMappingURL=layout-sidebar-links.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-sidebar-links.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-sidebar-links.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAqB5E,gCAAgC;AAChC,wBAAgB,iBAAiB,CAAC,EAC9B,OAAO,EACP,GAAG,EACH,OAAO,EACP,OAAO,EACP,GAAG,
|
|
1
|
+
{"version":3,"file":"layout-sidebar-links.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-sidebar-links.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAqB5E,gCAAgC;AAChC,wBAAgB,iBAAiB,CAAC,EAC9B,EAAE,EACF,EAAE,EACF,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,OAAO,EACP,GAAG,EACH,SAAS,EAET,OAAO,EACP,OAAO,EACP,KAAK,EACL,IAAI,EACJ,GAAG,IAAI,EACV,EAAE,oBAAoB,2CAgCtB;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,CAAC,EACjC,EAAE,EACF,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,OAAO,EACP,GAAG,EACH,SAAS,EAET,OAAO,EACP,OAAO,EACP,KAAK,EACL,IAAI,EACJ,GAAG,IAAI,EACV,EAAE,uBAAuB,2CA4BzB"}
|