@servicetitan/navigation 12.0.0 → 12.0.1
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/titan-layout/layout-header-dark.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-dark.js +32 -20
- package/dist/components/titan-layout/layout-header-dark.js.map +1 -1
- package/dist/components/titan-layout/layout-header-links-internal.d.ts +10 -0
- package/dist/components/titan-layout/layout-header-links-internal.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-header-links-internal.js +75 -0
- package/dist/components/titan-layout/layout-header-links-internal.js.map +1 -0
- package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links.js +10 -71
- package/dist/components/titan-layout/layout-header-links.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +70 -63
- package/dist/components/titan-layout/layout-header.module.less.d.ts +1 -0
- package/dist/components/titan-layout/titan-layout.stories.d.ts +1 -0
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/with-tooltip.d.ts +1 -1
- package/dist/components/titan-layout/with-tooltip.d.ts.map +1 -1
- package/dist/components/titan-layout/with-tooltip.js.map +1 -1
- package/package.json +2 -2
- package/src/components/titan-layout/layout-header-dark.tsx +42 -20
- package/src/components/titan-layout/layout-header-links-internal.tsx +151 -0
- package/src/components/titan-layout/layout-header-links.tsx +9 -128
- package/src/components/titan-layout/layout-header.module.less +70 -63
- package/src/components/titan-layout/layout-header.module.less.d.ts +1 -0
- package/src/components/titan-layout/titan-layout.stories.tsx +14 -0
- package/src/components/titan-layout/with-tooltip.tsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-header-dark.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-header-dark.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAA4C,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"layout-header-dark.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-header-dark.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAA4C,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAgB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAkBlE,UAAU,wBAAyB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC;IACzE,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC3C,uBAAuB,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAClD;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,wBAAwB,CAqEzD,CAAC"}
|
|
@@ -4,8 +4,9 @@ import { ButtonCompound, Icon, Menu } from '@servicetitan/anvil2';
|
|
|
4
4
|
import SvgMoreVert from '@servicetitan/anvil2/assets/icons/material/round/more_vert.svg';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
|
+
import { useTitanLayoutContext } from './layout-context';
|
|
7
8
|
import { LayoutHeader } from './layout-header';
|
|
8
|
-
import {
|
|
9
|
+
import { InternalLayoutHeaderNavigationLink } from './layout-header-links-internal';
|
|
9
10
|
import * as Styles from './layout-header.module.less';
|
|
10
11
|
import { withTooltip } from './with-tooltip';
|
|
11
12
|
function useForceUpdate() {
|
|
@@ -70,6 +71,7 @@ const LayoutHeaderNav = ({ className, mainItems, overflowItems })=>{
|
|
|
70
71
|
const navigationRef = useRef(null);
|
|
71
72
|
const forceUpdate = useForceUpdate();
|
|
72
73
|
const [minimized, setMinimized] = useState(0);
|
|
74
|
+
const { NavigationComponent } = useTitanLayoutContext();
|
|
73
75
|
useEffect(()=>{
|
|
74
76
|
const handleResize = ()=>{
|
|
75
77
|
setMinimized(0);
|
|
@@ -82,7 +84,8 @@ const LayoutHeaderNav = ({ className, mainItems, overflowItems })=>{
|
|
|
82
84
|
]);
|
|
83
85
|
const updateIsMinimized = ()=>{
|
|
84
86
|
if (containerRef.current && navigationRef.current) {
|
|
85
|
-
|
|
87
|
+
const widthGap = 16 + ((overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length) ? 32 : 0);
|
|
88
|
+
if (navigationRef.current.clientWidth + widthGap > containerRef.current.clientWidth) {
|
|
86
89
|
setMinimized(1);
|
|
87
90
|
} else if (minimized === 0) {
|
|
88
91
|
setMinimized(2);
|
|
@@ -109,37 +112,46 @@ const LayoutHeaderNav = ({ className, mainItems, overflowItems })=>{
|
|
|
109
112
|
/*#__PURE__*/ _jsx("div", {
|
|
110
113
|
ref: navigationRef,
|
|
111
114
|
className: classNames(Styles.headerNavigation),
|
|
112
|
-
children: mainItems === null || mainItems === void 0 ? void 0 : mainItems.map((item)=>withTooltip(/*#__PURE__*/ _createElement(
|
|
115
|
+
children: mainItems === null || mainItems === void 0 ? void 0 : mainItems.map((item)=>withTooltip(/*#__PURE__*/ _createElement(InternalLayoutHeaderNavigationLink, {
|
|
113
116
|
...item,
|
|
114
117
|
label: isMinimized ? undefined : item.title,
|
|
115
|
-
key: item.id
|
|
118
|
+
key: item.id,
|
|
119
|
+
navigationComponent: NavigationComponent
|
|
116
120
|
}), isMinimized ? item.title : undefined, {
|
|
117
121
|
key: item.id
|
|
118
122
|
}))
|
|
119
123
|
}),
|
|
120
124
|
!!(overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length) && /*#__PURE__*/ _jsx(LayoutHeaderNavOverflow, {
|
|
121
|
-
items: overflowItems
|
|
125
|
+
items: overflowItems,
|
|
126
|
+
navigationComponent: NavigationComponent
|
|
122
127
|
})
|
|
123
128
|
]
|
|
124
129
|
});
|
|
125
130
|
};
|
|
126
|
-
const
|
|
131
|
+
const LayoutHeaderNavOverflowTrigger = (props)=>/*#__PURE__*/ _jsx(ButtonCompound, {
|
|
132
|
+
...props,
|
|
133
|
+
className: Styles.headerNavigationOverflowTrigger,
|
|
134
|
+
"data-cy": "navigation-overflow-trigger",
|
|
135
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
136
|
+
svg: SvgMoreVert,
|
|
137
|
+
size: "medium"
|
|
138
|
+
})
|
|
139
|
+
});
|
|
140
|
+
const LayoutHeaderNavOverflow = ({ items, navigationComponent })=>{
|
|
127
141
|
return /*#__PURE__*/ _jsx(Menu, {
|
|
128
|
-
trigger:
|
|
129
|
-
...props,
|
|
130
|
-
className: Styles.headerNavigationOverflowTrigger,
|
|
131
|
-
children: /*#__PURE__*/ _jsx(Icon, {
|
|
132
|
-
svg: SvgMoreVert,
|
|
133
|
-
size: "medium"
|
|
134
|
-
})
|
|
135
|
-
}),
|
|
136
|
-
contentClassName: Styles.headerNavigationOverflow,
|
|
142
|
+
trigger: LayoutHeaderNavOverflowTrigger,
|
|
137
143
|
placement: "bottom-end",
|
|
138
|
-
children:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
145
|
+
"data-cy": "navigation-overflow-content",
|
|
146
|
+
className: Styles.headerNavigationOverflow,
|
|
147
|
+
children: items.map((item)=>/*#__PURE__*/ _createElement(InternalLayoutHeaderNavigationLink, {
|
|
148
|
+
...item,
|
|
149
|
+
label: item.title,
|
|
150
|
+
key: item.id,
|
|
151
|
+
navigationComponent: navigationComponent,
|
|
152
|
+
isOverflow: true
|
|
153
|
+
}))
|
|
154
|
+
})
|
|
143
155
|
});
|
|
144
156
|
};
|
|
145
157
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/titan-layout/layout-header-dark.tsx"],"sourcesContent":["import { ButtonCompound, Icon, Menu } from '@servicetitan/anvil2';\nimport SvgMoreVert from '@servicetitan/anvil2/assets/icons/material/round/more_vert.svg';\nimport classNames from 'classnames';\nimport { FC, useCallback, useEffect, useRef, useState } from 'react';\nimport { NavigationItemData } from '../../utils/navigation';\nimport { LayoutHeader, LayoutHeaderProps } from './layout-header';\nimport { LayoutHeaderNavigationLink } from './layout-header-links';\nimport * as Styles from './layout-header.module.less';\nimport { withTooltip } from './with-tooltip';\n\nfunction useForceUpdate() {\n const [, setTick] = useState(0);\n return useCallback(() => {\n setTick(tick => tick + 1);\n }, []);\n}\n\nenum MinimizedState {\n Calculating,\n Minimized,\n Full,\n}\n\ninterface LayoutHeaderStackedProps extends Omit<LayoutHeaderProps, 'variant'> {\n navigationMainItems?: NavigationItemData[];\n navigationOverflowItems?: NavigationItemData[];\n}\n\nexport const LayoutHeaderDark: FC<LayoutHeaderStackedProps> = ({\n className,\n isMobile,\n navigationMainItems,\n navigationOverflowItems,\n hasNotifications,\n onBurgerClick,\n logo,\n profile,\n right,\n rightText,\n rightClassName,\n center,\n centerClassName,\n ...rest\n}) => {\n return center ? (\n <div\n className={classNames(Styles.headerStacked, className)}\n data-cy=\"header-navigation\"\n {...rest}\n >\n <LayoutHeader\n variant=\"dark\"\n right={right}\n rightText={rightText}\n rightClassName={rightClassName}\n center={center}\n centerClassName={centerClassName}\n isMobile={isMobile}\n hasNotifications={hasNotifications}\n logo={logo}\n profile={profile}\n onBurgerClick={onBurgerClick}\n data-cy=\"header-navigation-top\"\n />\n\n {!isMobile && (\n <LayoutHeaderNav\n className={Styles.headerStackedNav}\n mainItems={navigationMainItems}\n overflowItems={navigationOverflowItems}\n />\n )}\n </div>\n ) : (\n <LayoutHeader\n variant=\"dark\"\n className={classNames(className, !isMobile && Styles.headerDesktopNav)}\n right={right}\n rightText={rightText}\n rightClassName={rightClassName}\n center={\n isMobile ? undefined : (\n <LayoutHeaderNav\n mainItems={navigationMainItems}\n overflowItems={navigationOverflowItems}\n />\n )\n }\n centerClassName={centerClassName}\n isMobile={isMobile}\n hasNotifications={hasNotifications}\n logo={logo}\n profile={profile}\n onBurgerClick={onBurgerClick}\n {...rest}\n />\n );\n};\n\ninterface LayoutHeaderNavProps {\n className?: string;\n mainItems?: NavigationItemData[];\n overflowItems?: NavigationItemData[];\n}\nconst LayoutHeaderNav: FC<LayoutHeaderNavProps> = ({ className, mainItems, overflowItems }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const navigationRef = useRef<HTMLDivElement>(null);\n const forceUpdate = useForceUpdate();\n const [minimized, setMinimized] = useState(MinimizedState.Calculating);\n\n useEffect(() => {\n const handleResize = () => {\n setMinimized(MinimizedState.Calculating);\n forceUpdate();\n };\n\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [forceUpdate]);\n\n const updateIsMinimized = () => {\n if (containerRef.current && navigationRef.current) {\n if (navigationRef.current.clientWidth + 16 > containerRef.current.clientWidth) {\n setMinimized(MinimizedState.Minimized);\n } else if (minimized === MinimizedState.Calculating) {\n setMinimized(MinimizedState.Full);\n }\n }\n };\n\n useEffect(() => {\n updateIsMinimized();\n });\n\n useEffect(() => {\n setMinimized(MinimizedState.Calculating);\n forceUpdate();\n }, [forceUpdate]);\n\n const isMinimized = minimized === MinimizedState.Minimized;\n\n return (\n <div\n ref={containerRef}\n className={classNames(Styles.headerNavigationWrapper, className, {\n [Styles.calculating]: minimized === MinimizedState.Calculating,\n })}\n data-cy=\"navigation-items\"\n >\n <div ref={navigationRef} className={classNames(Styles.headerNavigation)}>\n {mainItems?.map(item =>\n withTooltip(\n <LayoutHeaderNavigationLink\n {...item}\n label={isMinimized ? undefined : item.title}\n key={item.id}\n />,\n isMinimized ? item.title : undefined,\n { key: item.id }\n )\n )}\n </div>\n {!!overflowItems?.length && <LayoutHeaderNavOverflow items={overflowItems} />}\n </div>\n );\n};\n\nconst LayoutHeaderNavOverflow: FC<{\n items: NavigationItemData[];\n}> = ({ items }) => {\n return (\n <Menu\n trigger={props => (\n <ButtonCompound {...props} className={Styles.headerNavigationOverflowTrigger}>\n <Icon svg={SvgMoreVert} size=\"medium\" />\n </ButtonCompound>\n )}\n contentClassName={Styles.headerNavigationOverflow}\n placement=\"bottom-end\"\n >\n {items.map(item => (\n <LayoutHeaderNavigationLink {...item} label={item.title} key={item.id} />\n ))}\n </Menu>\n );\n};\n"],"names":["ButtonCompound","Icon","Menu","SvgMoreVert","classNames","useCallback","useEffect","useRef","useState","LayoutHeader","LayoutHeaderNavigationLink","Styles","withTooltip","useForceUpdate","setTick","tick","MinimizedState","LayoutHeaderDark","className","isMobile","navigationMainItems","navigationOverflowItems","hasNotifications","onBurgerClick","logo","profile","right","rightText","rightClassName","center","centerClassName","rest","div","headerStacked","data-cy","variant","LayoutHeaderNav","headerStackedNav","mainItems","overflowItems","headerDesktopNav","undefined","containerRef","navigationRef","forceUpdate","minimized","setMinimized","handleResize","window","addEventListener","removeEventListener","updateIsMinimized","current","clientWidth","isMinimized","ref","headerNavigationWrapper","calculating","headerNavigation","map","item","label","title","key","id","length","LayoutHeaderNavOverflow","items","trigger","props","headerNavigationOverflowTrigger","svg","size","contentClassName","headerNavigationOverflow","placement"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,IAAI,EAAEC,IAAI,QAAQ,uBAAuB;AAClE,OAAOC,iBAAiB,iEAAiE;AACzF,OAAOC,gBAAgB,aAAa;AACpC,SAAaC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAErE,SAASC,YAAY,QAA2B,kBAAkB;AAClE,SAASC,0BAA0B,QAAQ,wBAAwB;AACnE,YAAYC,YAAY,8BAA8B;AACtD,SAASC,WAAW,QAAQ,iBAAiB;AAE7C,SAASC;IACL,MAAM,GAAGC,QAAQ,GAAGN,SAAS;IAC7B,OAAOH,YAAY;QACfS,QAAQC,CAAAA,OAAQA,OAAO;IAC3B,GAAG,EAAE;AACT;AAEA,IAAA,AAAKC,wCAAAA;;;;WAAAA;EAAAA;AAWL,OAAO,MAAMC,mBAAiD,CAAC,EAC3DC,SAAS,EACTC,QAAQ,EACRC,mBAAmB,EACnBC,uBAAuB,EACvBC,gBAAgB,EAChBC,aAAa,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
1
|
+
{"version":3,"sources":["../../../src/components/titan-layout/layout-header-dark.tsx"],"sourcesContent":["import { ButtonCompound, Icon, Menu, MenuProps } from '@servicetitan/anvil2';\nimport SvgMoreVert from '@servicetitan/anvil2/assets/icons/material/round/more_vert.svg';\nimport classNames from 'classnames';\nimport { FC, useCallback, useEffect, useRef, useState } from 'react';\nimport { NavigationItemData } from '../../utils/navigation';\nimport { NavigationComponentProps } from './interface-internal';\nimport { useTitanLayoutContext } from './layout-context';\nimport { LayoutHeader, LayoutHeaderProps } from './layout-header';\nimport { InternalLayoutHeaderNavigationLink } from './layout-header-links-internal';\nimport * as Styles from './layout-header.module.less';\nimport { withTooltip } from './with-tooltip';\n\nfunction useForceUpdate() {\n const [, setTick] = useState(0);\n return useCallback(() => {\n setTick(tick => tick + 1);\n }, []);\n}\n\nenum MinimizedState {\n Calculating,\n Minimized,\n Full,\n}\n\ninterface LayoutHeaderStackedProps extends Omit<LayoutHeaderProps, 'variant'> {\n navigationMainItems?: NavigationItemData[];\n navigationOverflowItems?: NavigationItemData[];\n}\n\nexport const LayoutHeaderDark: FC<LayoutHeaderStackedProps> = ({\n className,\n isMobile,\n navigationMainItems,\n navigationOverflowItems,\n hasNotifications,\n onBurgerClick,\n logo,\n profile,\n right,\n rightText,\n rightClassName,\n center,\n centerClassName,\n ...rest\n}) => {\n return center ? (\n <div\n className={classNames(Styles.headerStacked, className)}\n data-cy=\"header-navigation\"\n {...rest}\n >\n <LayoutHeader\n variant=\"dark\"\n right={right}\n rightText={rightText}\n rightClassName={rightClassName}\n center={center}\n centerClassName={centerClassName}\n isMobile={isMobile}\n hasNotifications={hasNotifications}\n logo={logo}\n profile={profile}\n onBurgerClick={onBurgerClick}\n data-cy=\"header-navigation-top\"\n />\n\n {!isMobile && (\n <LayoutHeaderNav\n className={Styles.headerStackedNav}\n mainItems={navigationMainItems}\n overflowItems={navigationOverflowItems}\n />\n )}\n </div>\n ) : (\n <LayoutHeader\n variant=\"dark\"\n className={classNames(className, !isMobile && Styles.headerDesktopNav)}\n right={right}\n rightText={rightText}\n rightClassName={rightClassName}\n center={\n isMobile ? undefined : (\n <LayoutHeaderNav\n mainItems={navigationMainItems}\n overflowItems={navigationOverflowItems}\n />\n )\n }\n centerClassName={centerClassName}\n isMobile={isMobile}\n hasNotifications={hasNotifications}\n logo={logo}\n profile={profile}\n onBurgerClick={onBurgerClick}\n {...rest}\n />\n );\n};\n\ninterface LayoutHeaderNavProps {\n className?: string;\n mainItems?: NavigationItemData[];\n overflowItems?: NavigationItemData[];\n}\nconst LayoutHeaderNav: FC<LayoutHeaderNavProps> = ({ className, mainItems, overflowItems }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const navigationRef = useRef<HTMLDivElement>(null);\n const forceUpdate = useForceUpdate();\n const [minimized, setMinimized] = useState(MinimizedState.Calculating);\n const { NavigationComponent } = useTitanLayoutContext();\n\n useEffect(() => {\n const handleResize = () => {\n setMinimized(MinimizedState.Calculating);\n forceUpdate();\n };\n\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [forceUpdate]);\n\n const updateIsMinimized = () => {\n if (containerRef.current && navigationRef.current) {\n const widthGap = 16 + (overflowItems?.length ? 32 : 0);\n if (navigationRef.current.clientWidth + widthGap > containerRef.current.clientWidth) {\n setMinimized(MinimizedState.Minimized);\n } else if (minimized === MinimizedState.Calculating) {\n setMinimized(MinimizedState.Full);\n }\n }\n };\n\n useEffect(() => {\n updateIsMinimized();\n });\n\n useEffect(() => {\n setMinimized(MinimizedState.Calculating);\n forceUpdate();\n }, [forceUpdate]);\n\n const isMinimized = minimized === MinimizedState.Minimized;\n\n return (\n <div\n ref={containerRef}\n className={classNames(Styles.headerNavigationWrapper, className, {\n [Styles.calculating]: minimized === MinimizedState.Calculating,\n })}\n data-cy=\"navigation-items\"\n >\n <div ref={navigationRef} className={classNames(Styles.headerNavigation)}>\n {mainItems?.map(item =>\n withTooltip(\n <InternalLayoutHeaderNavigationLink\n {...item}\n label={isMinimized ? undefined : item.title}\n key={item.id}\n navigationComponent={NavigationComponent}\n />,\n isMinimized ? item.title : undefined,\n { key: item.id }\n )\n )}\n </div>\n {!!overflowItems?.length && (\n <LayoutHeaderNavOverflow\n items={overflowItems}\n navigationComponent={NavigationComponent}\n />\n )}\n </div>\n );\n};\n\nconst LayoutHeaderNavOverflowTrigger: MenuProps['trigger'] = props => (\n <ButtonCompound\n {...props}\n className={Styles.headerNavigationOverflowTrigger}\n data-cy=\"navigation-overflow-trigger\"\n >\n <Icon svg={SvgMoreVert} size=\"medium\" />\n </ButtonCompound>\n);\n\nconst LayoutHeaderNavOverflow: FC<\n {\n items: NavigationItemData[];\n } & NavigationComponentProps\n> = ({ items, navigationComponent }) => {\n return (\n <Menu trigger={LayoutHeaderNavOverflowTrigger} placement=\"bottom-end\">\n <div data-cy=\"navigation-overflow-content\" className={Styles.headerNavigationOverflow}>\n {items.map(item => (\n <InternalLayoutHeaderNavigationLink\n {...item}\n label={item.title}\n key={item.id}\n navigationComponent={navigationComponent}\n isOverflow\n />\n ))}\n </div>\n </Menu>\n );\n};\n"],"names":["ButtonCompound","Icon","Menu","SvgMoreVert","classNames","useCallback","useEffect","useRef","useState","useTitanLayoutContext","LayoutHeader","InternalLayoutHeaderNavigationLink","Styles","withTooltip","useForceUpdate","setTick","tick","MinimizedState","LayoutHeaderDark","className","isMobile","navigationMainItems","navigationOverflowItems","hasNotifications","onBurgerClick","logo","profile","right","rightText","rightClassName","center","centerClassName","rest","div","headerStacked","data-cy","variant","LayoutHeaderNav","headerStackedNav","mainItems","overflowItems","headerDesktopNav","undefined","containerRef","navigationRef","forceUpdate","minimized","setMinimized","NavigationComponent","handleResize","window","addEventListener","removeEventListener","updateIsMinimized","current","widthGap","length","clientWidth","isMinimized","ref","headerNavigationWrapper","calculating","headerNavigation","map","item","label","title","key","id","navigationComponent","LayoutHeaderNavOverflow","items","LayoutHeaderNavOverflowTrigger","props","headerNavigationOverflowTrigger","svg","size","trigger","placement","headerNavigationOver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;;0BAER,KAACF;gBAAI0B,KAAKf;gBAAezB,WAAWf,WAAWQ,OAAOkD,gBAAgB;0BACjEvB,sBAAAA,gCAAAA,UAAWwB,GAAG,CAACC,CAAAA,OACZnD,0BACI,eAACF;wBACI,GAAGqD,IAAI;wBACRC,OAAOP,cAAchB,YAAYsB,KAAKE,KAAK;wBAC3CC,KAAKH,KAAKI,EAAE;wBACZC,qBAAqBrB;wBAEzBU,cAAcM,KAAKE,KAAK,GAAGxB,WAC3B;wBAAEyB,KAAKH,KAAKI,EAAE;oBAAC;;YAI1B,CAAC,EAAC5B,0BAAAA,oCAAAA,cAAegB,MAAM,mBACpB,KAACc;gBACGC,OAAO/B;gBACP6B,qBAAqBrB;;;;AAKzC;AAEA,MAAMwB,iCAAuDC,CAAAA,sBACzD,KAACzE;QACI,GAAGyE,KAAK;QACTtD,WAAWP,OAAO8D,+BAA+B;QACjDvC,WAAQ;kBAER,cAAA,KAAClC;YAAK0E,KAAKxE;YAAayE,MAAK;;;AAIrC,MAAMN,0BAIF,CAAC,EAAEC,KAAK,EAAEF,mBAAmB,EAAE;IAC/B,qBACI,KAACnE;QAAK2E,SAASL;QAAgCM,WAAU;kBACrD,cAAA,KAAC7C;YAAIE,WAAQ;YAA8BhB,WAAWP,OAAOmE,wBAAwB;sBAChFR,MAAMR,GAAG,CAACC,CAAAA,qBACP,eAACrD;oBACI,GAAGqD,IAAI;oBACRC,OAAOD,KAAKE,KAAK;oBACjBC,KAAKH,KAAKI,EAAE;oBACZC,qBAAqBA;oBACrBW,UAAU;;;;AAMlC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { HeaderNavigationLinkProps, HeaderNavigationTriggerProps } from '../../utils/navigation-legacy';
|
|
3
|
+
import { NavigationComponentProps } from './interface-internal';
|
|
4
|
+
/** Navigation extra item with link */
|
|
5
|
+
export declare const InternalLayoutHeaderNavigationLink: FC<HeaderNavigationLinkProps & NavigationComponentProps & {
|
|
6
|
+
isOverflow?: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
/** Navigation extra item with icon button */
|
|
9
|
+
export declare const InternalLayoutHeaderNavigationTrigger: FC<HeaderNavigationTriggerProps>;
|
|
10
|
+
//# sourceMappingURL=layout-header-links-internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-header-links-internal.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-header-links-internal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,EACH,yBAAyB,EACzB,4BAA4B,EAC/B,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AA0ChE,sCAAsC;AACtC,eAAO,MAAM,kCAAkC,EAAE,EAAE,CAC/C,yBAAyB,GAAG,wBAAwB,GAAG;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,CAmDlF,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,qCAAqC,EAAE,EAAE,CAAC,4BAA4B,CA0ClF,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { Icon } from '@servicetitan/anvil2';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { Fragment } from 'react';
|
|
6
|
+
import { getCounterTag } from '../../utils/side-nav';
|
|
7
|
+
import { CounterTag } from '../counter-tag';
|
|
8
|
+
import * as Styles from './layout-header.module.less';
|
|
9
|
+
/** Content for navigation items */ const InternalHeaderNavigationItemContent = ({ counterClassName, icon, iconActive, label, labelClassName, tag })=>{
|
|
10
|
+
return /*#__PURE__*/ _jsxs(Fragment, {
|
|
11
|
+
children: [
|
|
12
|
+
!!icon && /*#__PURE__*/ _jsx(Icon, {
|
|
13
|
+
svg: icon,
|
|
14
|
+
className: Styles.navigationIcon
|
|
15
|
+
}),
|
|
16
|
+
!!iconActive && /*#__PURE__*/ _jsx(Icon, {
|
|
17
|
+
svg: iconActive,
|
|
18
|
+
className: classNames(Styles.navigationIcon, Styles.navigationIconActive)
|
|
19
|
+
}),
|
|
20
|
+
!!label && /*#__PURE__*/ _jsx("span", {
|
|
21
|
+
className: classNames(Styles.navigationItemLabel, labelClassName),
|
|
22
|
+
"data-cy": "nav-item-label",
|
|
23
|
+
children: label
|
|
24
|
+
}),
|
|
25
|
+
!!tag && /*#__PURE__*/ _jsx(CounterTag, {
|
|
26
|
+
data: tag,
|
|
27
|
+
className: classNames(Styles.navigationItemCounter, counterClassName),
|
|
28
|
+
longClassName: Styles.navigationItemCounterLong
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
/** Navigation extra item with link */ export const InternalLayoutHeaderNavigationLink = ({ id, to, hint, tooltip, className, counter, icon, iconActive, iconClassName, iconName, iconComponent, isActive, isOverflow, label, labelClassName, tag, target, title, navigationComponent: NavigationComponent, ...rest })=>{
|
|
34
|
+
return /*#__PURE__*/ _createElement(NavigationComponent, {
|
|
35
|
+
"data-cy": `navigation-item-${id}`,
|
|
36
|
+
"data-pendo": `navigation-item-${id}`,
|
|
37
|
+
...rest,
|
|
38
|
+
key: id,
|
|
39
|
+
to: to,
|
|
40
|
+
className: classNames(isOverflow ? Styles.navigationLinkOverflow : Styles.navigationLink, className, {
|
|
41
|
+
[Styles.navigationItemActive]: isActive === true,
|
|
42
|
+
[Styles.navigationItemIconState]: !!icon && !!iconActive
|
|
43
|
+
}),
|
|
44
|
+
isActive: typeof isActive === 'function' ? isActive : undefined,
|
|
45
|
+
activeClassName: Styles.navigationItemActive,
|
|
46
|
+
target: target
|
|
47
|
+
}, /*#__PURE__*/ _jsx(InternalHeaderNavigationItemContent, {
|
|
48
|
+
tag: getCounterTag(counter, tag),
|
|
49
|
+
icon: icon,
|
|
50
|
+
iconActive: iconActive,
|
|
51
|
+
label: label,
|
|
52
|
+
labelClassName: labelClassName
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
/** Navigation extra item with icon button */ export const InternalLayoutHeaderNavigationTrigger = ({ id, className, counter, icon, iconActive, iconName, isActive, hint, label, labelClassName, tag, tooltip, title, titleClassName, ...rest })=>{
|
|
56
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
57
|
+
"data-cy": `navigation-trigger-${id}`,
|
|
58
|
+
"data-pendo": `navigation-trigger-${id}`,
|
|
59
|
+
...rest,
|
|
60
|
+
title: hint,
|
|
61
|
+
className: classNames(Styles.navigationLink, {
|
|
62
|
+
[Styles.navigationItemActive]: isActive === true,
|
|
63
|
+
[Styles.navigationItemIconState]: !!icon && !!iconActive
|
|
64
|
+
}, 'cursor-pointer', className),
|
|
65
|
+
children: /*#__PURE__*/ _jsx(InternalHeaderNavigationItemContent, {
|
|
66
|
+
tag: getCounterTag(counter, tag),
|
|
67
|
+
icon: icon,
|
|
68
|
+
iconActive: iconActive,
|
|
69
|
+
label: label,
|
|
70
|
+
labelClassName: labelClassName
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=layout-header-links-internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/titan-layout/layout-header-links-internal.tsx"],"sourcesContent":["import { Icon, IconProps } from '@servicetitan/anvil2';\nimport classNames from 'classnames';\nimport { FC, Fragment } from 'react';\nimport {\n HeaderNavigationLinkProps,\n HeaderNavigationTriggerProps,\n} from '../../utils/navigation-legacy';\nimport { getCounterTag } from '../../utils/side-nav';\nimport { CounterTag, CounterTagProps } from '../counter-tag';\n// use v1 tooltips due to bug with v2 in monolith\nimport { NavigationComponentProps } from './interface-internal';\nimport * as Styles from './layout-header.module.less';\n\n/** Content for navigation items */\nconst InternalHeaderNavigationItemContent: FC<{\n tag?: CounterTagProps;\n counterClassName?: string;\n icon: IconProps['svg'] | undefined;\n iconActive?: IconProps['svg'];\n label?: string;\n labelClassName?: string;\n}> = ({ counterClassName, icon, iconActive, label, labelClassName, tag }) => {\n return (\n <Fragment>\n {!!icon && <Icon svg={icon} className={Styles.navigationIcon} />}\n {!!iconActive && (\n <Icon\n svg={iconActive}\n className={classNames(Styles.navigationIcon, Styles.navigationIconActive)}\n />\n )}\n\n {!!label && (\n <span\n className={classNames(Styles.navigationItemLabel, labelClassName)}\n data-cy=\"nav-item-label\"\n >\n {label}\n </span>\n )}\n\n {!!tag && (\n <CounterTag\n data={tag}\n className={classNames(Styles.navigationItemCounter, counterClassName)}\n longClassName={Styles.navigationItemCounterLong}\n />\n )}\n </Fragment>\n );\n};\n\n/** Navigation extra item with link */\nexport const InternalLayoutHeaderNavigationLink: FC<\n HeaderNavigationLinkProps & NavigationComponentProps & { isOverflow?: boolean }\n> = ({\n id,\n to,\n hint,\n tooltip,\n className,\n counter,\n icon,\n iconActive,\n iconClassName,\n iconName,\n iconComponent,\n isActive,\n isOverflow,\n label,\n labelClassName,\n tag,\n target,\n title,\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 key={id}\n to={to}\n className={classNames(\n isOverflow ? Styles.navigationLinkOverflow : Styles.navigationLink,\n className,\n {\n [Styles.navigationItemActive]: isActive === true,\n [Styles.navigationItemIconState]: !!icon && !!iconActive,\n }\n )}\n isActive={typeof isActive === 'function' ? isActive : undefined}\n activeClassName={Styles.navigationItemActive}\n target={target}\n >\n <InternalHeaderNavigationItemContent\n tag={getCounterTag(counter, tag)}\n icon={icon}\n iconActive={iconActive}\n label={label}\n labelClassName={labelClassName}\n />\n </NavigationComponent>\n );\n};\n\n/** Navigation extra item with icon button */\nexport const InternalLayoutHeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({\n id,\n className,\n counter,\n icon,\n iconActive,\n iconName,\n isActive,\n hint,\n label,\n labelClassName,\n tag,\n tooltip,\n title,\n titleClassName,\n ...rest\n}) => {\n return (\n <div\n data-cy={`navigation-trigger-${id}`}\n data-pendo={`navigation-trigger-${id}`}\n {...rest}\n title={hint}\n className={classNames(\n Styles.navigationLink,\n {\n [Styles.navigationItemActive]: isActive === true,\n [Styles.navigationItemIconState]: !!icon && !!iconActive,\n },\n 'cursor-pointer',\n className\n )}\n >\n <InternalHeaderNavigationItemContent\n tag={getCounterTag(counter, tag)}\n icon={icon}\n iconActive={iconActive}\n label={label}\n labelClassName={labelClassName}\n />\n </div>\n );\n};\n"],"names":["Icon","classNames","Fragment","getCounterTag","CounterTag","Styles","InternalHeaderNavigationItemContent","counterClassName","icon","iconActive","label","labelClassName","tag","svg","className","navigationIcon","navigationIconActive","span","navigationItemLabel","data-cy","data","navigationItemCounter","longClassName","navigationItemCounterLong","InternalLayoutHeaderNavigationLink","id","to","hint","tooltip","counter","iconClassName","iconName","iconComponent","isActive","isOverflow","target","title","navigationComponent","NavigationComponent","rest","data-pendo","key","navigationLinkOverflow","navigationLink","navigationItemActive","navigationItemIconState","undefined","activeClassName","InternalLayoutHeaderNavigationTrigger","titleClassName","div"],"mappings":";;AAAA,SAASA,IAAI,QAAmB,uBAAuB;AACvD,OAAOC,gBAAgB,aAAa;AACpC,SAAaC,QAAQ,QAAQ,QAAQ;AAKrC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,UAAU,QAAyB,iBAAiB;AAG7D,YAAYC,YAAY,8BAA8B;AAEtD,iCAAiC,GACjC,MAAMC,sCAOD,CAAC,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAEC,cAAc,EAAEC,GAAG,EAAE;IACpE,qBACI,MAACV;;YACI,CAAC,CAACM,sBAAQ,KAACR;gBAAKa,KAAKL;gBAAMM,WAAWT,OAAOU,cAAc;;YAC3D,CAAC,CAACN,4BACC,KAACT;gBACGa,KAAKJ;gBACLK,WAAWb,W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AAS,EACTe,OAAO,EACPrB,IAAI,EACJC,UAAU,EACVsB,QAAQ,EACRE,QAAQ,EACRN,IAAI,EACJjB,KAAK,EACLC,cAAc,EACdC,GAAG,EACHgB,OAAO,EACPQ,KAAK,EACLa,cAAc,EACd,GAAGV,MACN;IACG,qBACI,KAACW;QACG/B,WAAS,CAAC,mBAAmB,EAAEM,IAAI;QACnCe,cAAY,CAAC,mBAAmB,EAAEf,IAAI;QACrC,GAAGc,IAAI;QACRH,OAAOT;QACPb,WAAWb,WACPI,OAAOsC,cAAc,EACrB;YACI,CAACtC,OAAOuC,oBAAoB,CAAC,EAAEX,aAAa;YAC5C,CAAC5B,OAAOwC,uBAAuB,CAAC,EAAE,CAAC,CAACrC,QAAQ,CAAC,CAACC;QAClD,GACA,kBACAK;kBAGJ,cAAA,KAACR;YACGM,KAAKT,cAAc0B,SAASjB;YAC5BJ,MAAMA;YACNC,YAAYA;YACZC,OAAOA;YACPC,gBAAgBA;;;AAIhC,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-header-links.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-header-links.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout-header-links.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-header-links.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EACH,yBAAyB,EACzB,4BAA4B,EAC/B,MAAM,+BAA+B,CAAC;AAQvC,sCAAsC;AACtC,eAAO,MAAM,0BAA0B,EAAE,EAAE,CAAC,yBAAyB,CAOpE,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,6BAA6B,EAAE,EAAE,CAAC,4BAA4B,CAK1E,CAAC"}
|
|
@@ -1,78 +1,17 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { createElement as _createElement } from "react";
|
|
3
|
-
import { Icon } from '@servicetitan/anvil2';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { Fragment } from 'react';
|
|
6
|
-
import { getCounterTag } from '../../utils/side-nav';
|
|
7
|
-
import { CounterTag } from '../counter-tag';
|
|
8
|
-
// use v1 tooltips due to bug with v2 in monolith
|
|
9
|
-
import { withTooltip } from '../header-navigation/with-tooltip';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
2
|
import { useTitanLayoutContext } from './layout-context';
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
children: [
|
|
15
|
-
!!icon && /*#__PURE__*/ _jsx(Icon, {
|
|
16
|
-
svg: icon,
|
|
17
|
-
className: Styles.navigationIcon
|
|
18
|
-
}),
|
|
19
|
-
!!iconActive && /*#__PURE__*/ _jsx(Icon, {
|
|
20
|
-
svg: iconActive,
|
|
21
|
-
className: classNames(Styles.navigationIcon, Styles.navigationIconActive)
|
|
22
|
-
}),
|
|
23
|
-
!!label && /*#__PURE__*/ _jsx("span", {
|
|
24
|
-
className: classNames(Styles.navigationItemLabel, labelClassName),
|
|
25
|
-
"data-cy": "nav-item-label",
|
|
26
|
-
children: label
|
|
27
|
-
}),
|
|
28
|
-
!!tag && /*#__PURE__*/ _jsx(CounterTag, {
|
|
29
|
-
data: tag,
|
|
30
|
-
className: classNames(Styles.navigationItemCounter, counterClassName),
|
|
31
|
-
longClassName: Styles.navigationItemCounterLong
|
|
32
|
-
})
|
|
33
|
-
]
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
/** Navigation extra item with link */ export const LayoutHeaderNavigationLink = ({ id, to, hint, tooltip, className, counter, icon, iconActive, iconClassName, iconComponent, iconName, isActive, label, labelClassName, tag, target, title, ...rest })=>{
|
|
3
|
+
import { InternalLayoutHeaderNavigationLink, InternalLayoutHeaderNavigationTrigger } from './layout-header-links-internal';
|
|
4
|
+
import { withTooltip } from './with-tooltip';
|
|
5
|
+
/** Navigation extra item with link */ export const LayoutHeaderNavigationLink = ({ tooltip, ...rest })=>{
|
|
37
6
|
const { NavigationComponent } = useTitanLayoutContext();
|
|
38
|
-
return withTooltip(/*#__PURE__*/
|
|
39
|
-
"data-cy": `navigation-item-${id}`,
|
|
40
|
-
"data-pendo": `navigation-item-${id}`,
|
|
7
|
+
return withTooltip(/*#__PURE__*/ _jsx(InternalLayoutHeaderNavigationLink, {
|
|
41
8
|
...rest,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
className: classNames(Styles.navigationLink, className, {
|
|
45
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
46
|
-
[Styles.navigationItemIconState]: !!icon && !!iconActive
|
|
47
|
-
}),
|
|
48
|
-
isActive: typeof isActive === 'function' ? isActive : undefined,
|
|
49
|
-
activeClassName: Styles.navigationItemActive,
|
|
50
|
-
target: target
|
|
51
|
-
}, /*#__PURE__*/ _jsx(HeaderNavigationItemContent, {
|
|
52
|
-
tag: getCounterTag(counter, tag),
|
|
53
|
-
icon: icon,
|
|
54
|
-
iconActive: iconActive,
|
|
55
|
-
label: label,
|
|
56
|
-
labelClassName: labelClassName
|
|
57
|
-
})), tooltip);
|
|
9
|
+
navigationComponent: NavigationComponent
|
|
10
|
+
}), tooltip);
|
|
58
11
|
};
|
|
59
|
-
/** Navigation extra item with icon button */ export const LayoutHeaderNavigationTrigger = ({
|
|
60
|
-
return withTooltip(/*#__PURE__*/ _jsx(
|
|
61
|
-
|
|
62
|
-
"data-pendo": `navigation-trigger-${id}`,
|
|
63
|
-
...rest,
|
|
64
|
-
title: hint,
|
|
65
|
-
className: classNames(Styles.navigationLink, {
|
|
66
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
67
|
-
[Styles.navigationItemIconState]: !!icon && !!iconActive
|
|
68
|
-
}, 'cursor-pointer', className),
|
|
69
|
-
children: /*#__PURE__*/ _jsx(HeaderNavigationItemContent, {
|
|
70
|
-
tag: getCounterTag(counter, tag),
|
|
71
|
-
icon: icon,
|
|
72
|
-
iconActive: iconActive,
|
|
73
|
-
label: label,
|
|
74
|
-
labelClassName: labelClassName
|
|
75
|
-
})
|
|
12
|
+
/** Navigation extra item with icon button */ export const LayoutHeaderNavigationTrigger = ({ tooltip, ...rest })=>{
|
|
13
|
+
return withTooltip(/*#__PURE__*/ _jsx(InternalLayoutHeaderNavigationTrigger, {
|
|
14
|
+
...rest
|
|
76
15
|
}), tooltip);
|
|
77
16
|
};
|
|
78
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/titan-layout/layout-header-links.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../src/components/titan-layout/layout-header-links.tsx"],"sourcesContent":["import { FC } from 'react';\nimport {\n HeaderNavigationLinkProps,\n HeaderNavigationTriggerProps,\n} from '../../utils/navigation-legacy';\nimport { useTitanLayoutContext } from './layout-context';\nimport {\n InternalLayoutHeaderNavigationLink,\n InternalLayoutHeaderNavigationTrigger,\n} from './layout-header-links-internal';\nimport { withTooltip } from './with-tooltip';\n\n/** Navigation extra item with link */\nexport const LayoutHeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({ tooltip, ...rest }) => {\n const { NavigationComponent } = useTitanLayoutContext();\n\n return withTooltip(\n <InternalLayoutHeaderNavigationLink {...rest} navigationComponent={NavigationComponent} />,\n tooltip\n );\n};\n\n/** Navigation extra item with icon button */\nexport const LayoutHeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({\n tooltip,\n ...rest\n}) => {\n return withTooltip(<InternalLayoutHeaderNavigationTrigger {...rest} />, tooltip);\n};\n"],"names":["useTitanLayoutContext","InternalLayoutHeaderNavigationLink","InternalLayoutHeaderNavigationTrigger","withTooltip","LayoutHeaderNavigationLink","tooltip","rest","NavigationComponent","navigationComponent","LayoutHeaderNavigationTrigger"],"mappings":";AAKA,SAASA,qBAAqB,QAAQ,mBAAmB;AACzD,SACIC,kCAAkC,EAClCC,qCAAqC,QAClC,iCAAiC;AACxC,SAASC,WAAW,QAAQ,iBAAiB;AAE7C,oCAAoC,GACpC,OAAO,MAAMC,6BAA4D,CAAC,EAAEC,OAAO,EAAE,GAAGC,MAAM;IAC1F,MAAM,EAAEC,mBAAmB,EAAE,GAAGP;IAEhC,OAAOG,0BACH,KAACF;QAAoC,GAAGK,IAAI;QAAEE,qBAAqBD;QACnEF;AAER,EAAE;AAEF,2CAA2C,GAC3C,OAAO,MAAMI,gCAAkE,CAAC,EAC5EJ,OAAO,EACP,GAAGC,MACN;IACG,OAAOH,0BAAY,KAACD;QAAuC,GAAGI,IAAI;QAAMD;AAC5E,EAAE"}
|
|
@@ -122,14 +122,15 @@
|
|
|
122
122
|
min-width: 0;
|
|
123
123
|
overflow-x: auto;
|
|
124
124
|
overflow-y: hidden;
|
|
125
|
+
flex: 1;
|
|
125
126
|
|
|
126
127
|
display: flex;
|
|
127
128
|
justify-content: center;
|
|
128
129
|
align-items: center;
|
|
129
130
|
|
|
130
131
|
&.calculating {
|
|
131
|
-
|
|
132
|
-
opacity: 0;
|
|
132
|
+
> * {
|
|
133
|
+
opacity: 0 !important;
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
|
|
@@ -237,7 +238,8 @@
|
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
//!!!!!!!!!!!!!!! nav links styles !!!!!!!!!!!!!!!//
|
|
240
|
-
.navigation-link
|
|
241
|
+
.navigation-link,
|
|
242
|
+
.navigation-link-overflow {
|
|
241
243
|
&.navigation-item-icon-state.navigation-item-active {
|
|
242
244
|
.navigation-icon[data-anv][data-anv]:not(.navigation-icon-active) {
|
|
243
245
|
display: none;
|
|
@@ -276,34 +278,34 @@
|
|
|
276
278
|
|
|
277
279
|
border-radius: 12px;
|
|
278
280
|
font-size: @size-links-tiny;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.navigation-item-counter {
|
|
282
|
-
color: @color-white;
|
|
283
|
-
font-weight: @font-weight-semibold;
|
|
284
|
-
font-size: 8px !important;
|
|
285
|
-
min-width: 16px !important;
|
|
286
|
-
height: 16px !important;
|
|
287
|
-
position: absolute;
|
|
288
|
-
top: 4px;
|
|
289
|
-
right: -2px;
|
|
290
281
|
|
|
291
|
-
|
|
292
|
-
|
|
282
|
+
.navigation-item-counter {
|
|
283
|
+
color: @color-white;
|
|
284
|
+
font-weight: @font-weight-semibold;
|
|
285
|
+
font-size: 8px !important;
|
|
286
|
+
min-width: 16px !important;
|
|
287
|
+
height: 16px !important;
|
|
288
|
+
position: absolute;
|
|
289
|
+
top: 4px;
|
|
290
|
+
right: -2px;
|
|
291
|
+
|
|
292
|
+
&.navigation-item-counter-long {
|
|
293
|
+
right: -8px;
|
|
294
|
+
}
|
|
293
295
|
}
|
|
294
|
-
}
|
|
295
296
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
297
|
+
.navigation-item-label {
|
|
298
|
+
color: inherit;
|
|
299
|
+
font-size: @typescale-1;
|
|
300
|
+
font-family: @base-font-family;
|
|
301
|
+
font-weight: @font-weight-semibold;
|
|
302
|
+
margin-left: @spacing-half;
|
|
303
|
+
}
|
|
303
304
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
.navigation-icon[data-anv][data-anv] {
|
|
306
|
+
height: 24px;
|
|
307
|
+
width: 24px;
|
|
308
|
+
}
|
|
307
309
|
}
|
|
308
310
|
|
|
309
311
|
&.header-desktop {
|
|
@@ -339,7 +341,7 @@
|
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
.header-dark .navigation-link,
|
|
342
|
-
.header-navigation
|
|
344
|
+
.header-navigation .navigation-link {
|
|
343
345
|
&.navigation-item-active {
|
|
344
346
|
color: @color-blue-200 !important;
|
|
345
347
|
}
|
|
@@ -401,47 +403,52 @@
|
|
|
401
403
|
}
|
|
402
404
|
}
|
|
403
405
|
|
|
404
|
-
.header-navigation-overflow
|
|
405
|
-
display:
|
|
406
|
-
|
|
407
|
-
padding: @spacing-1 12px;
|
|
408
|
-
cursor: pointer;
|
|
409
|
-
|
|
410
|
-
font-family: @base-font-family;
|
|
411
|
-
font-size: @typescale-4;
|
|
412
|
-
position: relative;
|
|
413
|
-
align-items: center;
|
|
414
|
-
flex-wrap: nowrap;
|
|
415
|
-
text-wrap: nowrap;
|
|
406
|
+
.header-navigation-overflow {
|
|
407
|
+
display: flex;
|
|
408
|
+
flex-direction: column;
|
|
416
409
|
|
|
417
410
|
margin-left: -0.5rem;
|
|
418
411
|
margin-right: -0.5rem;
|
|
419
412
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
color: @color-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
&.navigation-item-active:not(:hover) {
|
|
426
|
-
color: @color-blue;
|
|
427
|
-
}
|
|
413
|
+
.navigation-link-overflow {
|
|
414
|
+
display: inline-flex;
|
|
415
|
+
color: @color-black;
|
|
416
|
+
padding: @spacing-1 12px;
|
|
417
|
+
cursor: pointer;
|
|
428
418
|
|
|
429
|
-
.navigation-item-label {
|
|
430
419
|
font-family: @base-font-family;
|
|
431
|
-
font-size: @typescale-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
font-weight: @font-weight-semibold;
|
|
437
|
-
font-size: 8px !important;
|
|
420
|
+
font-size: @typescale-4;
|
|
421
|
+
position: relative;
|
|
422
|
+
align-items: center;
|
|
423
|
+
flex-wrap: nowrap;
|
|
424
|
+
text-wrap: nowrap;
|
|
438
425
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
426
|
+
&:hover {
|
|
427
|
+
background-color: @color-blue-500;
|
|
428
|
+
color: @color-white;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
&.navigation-item-active:not(:hover) {
|
|
432
|
+
color: @color-blue;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.navigation-item-label {
|
|
436
|
+
font-family: @base-font-family;
|
|
437
|
+
font-size: @typescale-2;
|
|
438
|
+
margin-left: @spacing-half;
|
|
439
|
+
}
|
|
440
|
+
.navigation-item-counter {
|
|
441
|
+
color: @color-white;
|
|
442
|
+
font-weight: @font-weight-semibold;
|
|
443
|
+
font-size: 8px !important;
|
|
444
|
+
margin-right: @spacing-half;
|
|
445
|
+
margin-left: @spacing-half;
|
|
446
|
+
|
|
447
|
+
min-width: 12px !important;
|
|
448
|
+
height: 12px !important;
|
|
449
|
+
}
|
|
450
|
+
.navigation-icon[data-anv][data-anv] {
|
|
451
|
+
height: 20px;
|
|
452
|
+
}
|
|
446
453
|
}
|
|
447
454
|
}
|
|
@@ -22,6 +22,7 @@ export declare const TitanLayoutLegacyTop: (args: LayoutContentArgs) => import("
|
|
|
22
22
|
export declare const TitanLayoutAnvil1: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
export declare const TitanLayoutAnvil1TopNav: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
export declare const TitanLayoutAnvil1Top: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare const TitanLayoutAnvil1TopOverflow: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export declare const TitanLayoutAnvil2: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
|
|
26
27
|
export declare const TitanLayoutAnvil2TopNav: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
|
|
27
28
|
export declare const TitanLayoutAnvil2Top: (args: LayoutContentArgs) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"titan-layout.stories.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/titan-layout.stories.tsx"],"names":[],"mappings":"AAsBA,UAAU,iBAAiB;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,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,uBAAuB,GAAI,MAAM,iBAAiB,4CAM9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,iBAAiB,4CAY3D,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,MAAM,iBAAiB,4CAMnE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,iBAAiB,4CAQxD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,MAAM,iBAAiB,4CAQ9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,iBAAiB,4CAQ3D,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TooltipProps } from '@servicetitan/anvil2';
|
|
2
2
|
import { ReactElement } from 'react';
|
|
3
|
-
export declare const withTooltip: (element: ReactElement, tooltip: string | undefined, props
|
|
3
|
+
export declare const withTooltip: (element: ReactElement, tooltip: string | undefined, props?: {
|
|
4
4
|
placement?: TooltipProps["placement"];
|
|
5
5
|
key?: string;
|
|
6
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/with-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,eAAO,MAAM,WAAW,GACpB,SAAS,YAAY,EACrB,SAAS,MAAM,GAAG,SAAS,EAC3B,
|
|
1
|
+
{"version":3,"file":"with-tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/with-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,eAAO,MAAM,WAAW,GACpB,SAAS,YAAY,EACrB,SAAS,MAAM,GAAG,SAAS,EAC3B,QAAQ;IACJ,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB,4CASA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/titan-layout/with-tooltip.tsx"],"sourcesContent":["import { Tooltip, TooltipProps } from '@servicetitan/anvil2';\nimport { ReactElement } from 'react';\n\nexport const withTooltip = (\n element: ReactElement,\n tooltip: string | undefined,\n props
|
|
1
|
+
{"version":3,"sources":["../../../src/components/titan-layout/with-tooltip.tsx"],"sourcesContent":["import { Tooltip, TooltipProps } from '@servicetitan/anvil2';\nimport { ReactElement } from 'react';\n\nexport const withTooltip = (\n element: ReactElement,\n tooltip: string | undefined,\n props?: {\n placement?: TooltipProps['placement'];\n key?: string;\n }\n) =>\n tooltip ? (\n <Tooltip placement=\"bottom\" {...props}>\n <Tooltip.Content>{tooltip}</Tooltip.Content>\n <Tooltip.Trigger>{element}</Tooltip.Trigger>\n </Tooltip>\n ) : (\n element\n );\n"],"names":["Tooltip","withTooltip","element","tooltip","props","placement","Content","Trigger"],"mappings":";AAAA,SAASA,OAAO,QAAsB,uBAAuB;AAG7D,OAAO,MAAMC,cAAc,CACvBC,SACAC,SACAC,QAKAD,wBACI,MAACH;QAAQK,WAAU;QAAU,GAAGD,KAAK;;0BACjC,KAACJ,QAAQM,OAAO;0BAAEH;;0BAClB,KAACH,QAAQO,OAAO;0BAAEL;;;SAGtBA,QACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/navigation",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.1",
|
|
4
4
|
"description": "Navigation components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"less": true,
|
|
43
43
|
"webpack": false
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "e2203627fce8344ea7b26536a80d70bca4065620"
|
|
46
46
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { ButtonCompound, Icon, Menu } from '@servicetitan/anvil2';
|
|
1
|
+
import { ButtonCompound, Icon, Menu, MenuProps } from '@servicetitan/anvil2';
|
|
2
2
|
import SvgMoreVert from '@servicetitan/anvil2/assets/icons/material/round/more_vert.svg';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { NavigationItemData } from '../../utils/navigation';
|
|
6
|
+
import { NavigationComponentProps } from './interface-internal';
|
|
7
|
+
import { useTitanLayoutContext } from './layout-context';
|
|
6
8
|
import { LayoutHeader, LayoutHeaderProps } from './layout-header';
|
|
7
|
-
import {
|
|
9
|
+
import { InternalLayoutHeaderNavigationLink } from './layout-header-links-internal';
|
|
8
10
|
import * as Styles from './layout-header.module.less';
|
|
9
11
|
import { withTooltip } from './with-tooltip';
|
|
10
12
|
|
|
@@ -107,6 +109,7 @@ const LayoutHeaderNav: FC<LayoutHeaderNavProps> = ({ className, mainItems, overf
|
|
|
107
109
|
const navigationRef = useRef<HTMLDivElement>(null);
|
|
108
110
|
const forceUpdate = useForceUpdate();
|
|
109
111
|
const [minimized, setMinimized] = useState(MinimizedState.Calculating);
|
|
112
|
+
const { NavigationComponent } = useTitanLayoutContext();
|
|
110
113
|
|
|
111
114
|
useEffect(() => {
|
|
112
115
|
const handleResize = () => {
|
|
@@ -120,7 +123,8 @@ const LayoutHeaderNav: FC<LayoutHeaderNavProps> = ({ className, mainItems, overf
|
|
|
120
123
|
|
|
121
124
|
const updateIsMinimized = () => {
|
|
122
125
|
if (containerRef.current && navigationRef.current) {
|
|
123
|
-
|
|
126
|
+
const widthGap = 16 + (overflowItems?.length ? 32 : 0);
|
|
127
|
+
if (navigationRef.current.clientWidth + widthGap > containerRef.current.clientWidth) {
|
|
124
128
|
setMinimized(MinimizedState.Minimized);
|
|
125
129
|
} else if (minimized === MinimizedState.Calculating) {
|
|
126
130
|
setMinimized(MinimizedState.Full);
|
|
@@ -150,37 +154,55 @@ const LayoutHeaderNav: FC<LayoutHeaderNavProps> = ({ className, mainItems, overf
|
|
|
150
154
|
<div ref={navigationRef} className={classNames(Styles.headerNavigation)}>
|
|
151
155
|
{mainItems?.map(item =>
|
|
152
156
|
withTooltip(
|
|
153
|
-
<
|
|
157
|
+
<InternalLayoutHeaderNavigationLink
|
|
154
158
|
{...item}
|
|
155
159
|
label={isMinimized ? undefined : item.title}
|
|
156
160
|
key={item.id}
|
|
161
|
+
navigationComponent={NavigationComponent}
|
|
157
162
|
/>,
|
|
158
163
|
isMinimized ? item.title : undefined,
|
|
159
164
|
{ key: item.id }
|
|
160
165
|
)
|
|
161
166
|
)}
|
|
162
167
|
</div>
|
|
163
|
-
{!!overflowItems?.length &&
|
|
168
|
+
{!!overflowItems?.length && (
|
|
169
|
+
<LayoutHeaderNavOverflow
|
|
170
|
+
items={overflowItems}
|
|
171
|
+
navigationComponent={NavigationComponent}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
164
174
|
</div>
|
|
165
175
|
);
|
|
166
176
|
};
|
|
167
177
|
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
178
|
+
const LayoutHeaderNavOverflowTrigger: MenuProps['trigger'] = props => (
|
|
179
|
+
<ButtonCompound
|
|
180
|
+
{...props}
|
|
181
|
+
className={Styles.headerNavigationOverflowTrigger}
|
|
182
|
+
data-cy="navigation-overflow-trigger"
|
|
183
|
+
>
|
|
184
|
+
<Icon svg={SvgMoreVert} size="medium" />
|
|
185
|
+
</ButtonCompound>
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
const LayoutHeaderNavOverflow: FC<
|
|
189
|
+
{
|
|
190
|
+
items: NavigationItemData[];
|
|
191
|
+
} & NavigationComponentProps
|
|
192
|
+
> = ({ items, navigationComponent }) => {
|
|
171
193
|
return (
|
|
172
|
-
<Menu
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
194
|
+
<Menu trigger={LayoutHeaderNavOverflowTrigger} placement="bottom-end">
|
|
195
|
+
<div data-cy="navigation-overflow-content" className={Styles.headerNavigationOverflow}>
|
|
196
|
+
{items.map(item => (
|
|
197
|
+
<InternalLayoutHeaderNavigationLink
|
|
198
|
+
{...item}
|
|
199
|
+
label={item.title}
|
|
200
|
+
key={item.id}
|
|
201
|
+
navigationComponent={navigationComponent}
|
|
202
|
+
isOverflow
|
|
203
|
+
/>
|
|
204
|
+
))}
|
|
205
|
+
</div>
|
|
184
206
|
</Menu>
|
|
185
207
|
);
|
|
186
208
|
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Icon, IconProps } from '@servicetitan/anvil2';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { FC, Fragment } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
HeaderNavigationLinkProps,
|
|
6
|
+
HeaderNavigationTriggerProps,
|
|
7
|
+
} from '../../utils/navigation-legacy';
|
|
8
|
+
import { getCounterTag } from '../../utils/side-nav';
|
|
9
|
+
import { CounterTag, CounterTagProps } from '../counter-tag';
|
|
10
|
+
// use v1 tooltips due to bug with v2 in monolith
|
|
11
|
+
import { NavigationComponentProps } from './interface-internal';
|
|
12
|
+
import * as Styles from './layout-header.module.less';
|
|
13
|
+
|
|
14
|
+
/** Content for navigation items */
|
|
15
|
+
const InternalHeaderNavigationItemContent: FC<{
|
|
16
|
+
tag?: CounterTagProps;
|
|
17
|
+
counterClassName?: string;
|
|
18
|
+
icon: IconProps['svg'] | undefined;
|
|
19
|
+
iconActive?: IconProps['svg'];
|
|
20
|
+
label?: string;
|
|
21
|
+
labelClassName?: string;
|
|
22
|
+
}> = ({ counterClassName, icon, iconActive, label, labelClassName, tag }) => {
|
|
23
|
+
return (
|
|
24
|
+
<Fragment>
|
|
25
|
+
{!!icon && <Icon svg={icon} className={Styles.navigationIcon} />}
|
|
26
|
+
{!!iconActive && (
|
|
27
|
+
<Icon
|
|
28
|
+
svg={iconActive}
|
|
29
|
+
className={classNames(Styles.navigationIcon, Styles.navigationIconActive)}
|
|
30
|
+
/>
|
|
31
|
+
)}
|
|
32
|
+
|
|
33
|
+
{!!label && (
|
|
34
|
+
<span
|
|
35
|
+
className={classNames(Styles.navigationItemLabel, labelClassName)}
|
|
36
|
+
data-cy="nav-item-label"
|
|
37
|
+
>
|
|
38
|
+
{label}
|
|
39
|
+
</span>
|
|
40
|
+
)}
|
|
41
|
+
|
|
42
|
+
{!!tag && (
|
|
43
|
+
<CounterTag
|
|
44
|
+
data={tag}
|
|
45
|
+
className={classNames(Styles.navigationItemCounter, counterClassName)}
|
|
46
|
+
longClassName={Styles.navigationItemCounterLong}
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
49
|
+
</Fragment>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** Navigation extra item with link */
|
|
54
|
+
export const InternalLayoutHeaderNavigationLink: FC<
|
|
55
|
+
HeaderNavigationLinkProps & NavigationComponentProps & { isOverflow?: boolean }
|
|
56
|
+
> = ({
|
|
57
|
+
id,
|
|
58
|
+
to,
|
|
59
|
+
hint,
|
|
60
|
+
tooltip,
|
|
61
|
+
className,
|
|
62
|
+
counter,
|
|
63
|
+
icon,
|
|
64
|
+
iconActive,
|
|
65
|
+
iconClassName,
|
|
66
|
+
iconName,
|
|
67
|
+
iconComponent,
|
|
68
|
+
isActive,
|
|
69
|
+
isOverflow,
|
|
70
|
+
label,
|
|
71
|
+
labelClassName,
|
|
72
|
+
tag,
|
|
73
|
+
target,
|
|
74
|
+
title,
|
|
75
|
+
navigationComponent: NavigationComponent,
|
|
76
|
+
...rest
|
|
77
|
+
}) => {
|
|
78
|
+
return (
|
|
79
|
+
<NavigationComponent
|
|
80
|
+
data-cy={`navigation-item-${id}`}
|
|
81
|
+
data-pendo={`navigation-item-${id}`}
|
|
82
|
+
{...rest}
|
|
83
|
+
key={id}
|
|
84
|
+
to={to}
|
|
85
|
+
className={classNames(
|
|
86
|
+
isOverflow ? Styles.navigationLinkOverflow : Styles.navigationLink,
|
|
87
|
+
className,
|
|
88
|
+
{
|
|
89
|
+
[Styles.navigationItemActive]: isActive === true,
|
|
90
|
+
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
91
|
+
}
|
|
92
|
+
)}
|
|
93
|
+
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
94
|
+
activeClassName={Styles.navigationItemActive}
|
|
95
|
+
target={target}
|
|
96
|
+
>
|
|
97
|
+
<InternalHeaderNavigationItemContent
|
|
98
|
+
tag={getCounterTag(counter, tag)}
|
|
99
|
+
icon={icon}
|
|
100
|
+
iconActive={iconActive}
|
|
101
|
+
label={label}
|
|
102
|
+
labelClassName={labelClassName}
|
|
103
|
+
/>
|
|
104
|
+
</NavigationComponent>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/** Navigation extra item with icon button */
|
|
109
|
+
export const InternalLayoutHeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
110
|
+
id,
|
|
111
|
+
className,
|
|
112
|
+
counter,
|
|
113
|
+
icon,
|
|
114
|
+
iconActive,
|
|
115
|
+
iconName,
|
|
116
|
+
isActive,
|
|
117
|
+
hint,
|
|
118
|
+
label,
|
|
119
|
+
labelClassName,
|
|
120
|
+
tag,
|
|
121
|
+
tooltip,
|
|
122
|
+
title,
|
|
123
|
+
titleClassName,
|
|
124
|
+
...rest
|
|
125
|
+
}) => {
|
|
126
|
+
return (
|
|
127
|
+
<div
|
|
128
|
+
data-cy={`navigation-trigger-${id}`}
|
|
129
|
+
data-pendo={`navigation-trigger-${id}`}
|
|
130
|
+
{...rest}
|
|
131
|
+
title={hint}
|
|
132
|
+
className={classNames(
|
|
133
|
+
Styles.navigationLink,
|
|
134
|
+
{
|
|
135
|
+
[Styles.navigationItemActive]: isActive === true,
|
|
136
|
+
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
137
|
+
},
|
|
138
|
+
'cursor-pointer',
|
|
139
|
+
className
|
|
140
|
+
)}
|
|
141
|
+
>
|
|
142
|
+
<InternalHeaderNavigationItemContent
|
|
143
|
+
tag={getCounterTag(counter, tag)}
|
|
144
|
+
icon={icon}
|
|
145
|
+
iconActive={iconActive}
|
|
146
|
+
label={label}
|
|
147
|
+
labelClassName={labelClassName}
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
@@ -1,148 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { FC, Fragment } from 'react';
|
|
1
|
+
import { FC } from 'react';
|
|
4
2
|
import {
|
|
5
3
|
HeaderNavigationLinkProps,
|
|
6
4
|
HeaderNavigationTriggerProps,
|
|
7
5
|
} from '../../utils/navigation-legacy';
|
|
8
|
-
import { getCounterTag } from '../../utils/side-nav';
|
|
9
|
-
import { CounterTag, CounterTagProps } from '../counter-tag';
|
|
10
|
-
// use v1 tooltips due to bug with v2 in monolith
|
|
11
|
-
import { withTooltip } from '../header-navigation/with-tooltip';
|
|
12
6
|
import { useTitanLayoutContext } from './layout-context';
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
counterClassName?: string;
|
|
19
|
-
icon: IconProps['svg'] | undefined;
|
|
20
|
-
iconActive?: IconProps['svg'];
|
|
21
|
-
label?: string;
|
|
22
|
-
labelClassName?: string;
|
|
23
|
-
}> = ({ counterClassName, icon, iconActive, label, labelClassName, tag }) => {
|
|
24
|
-
return (
|
|
25
|
-
<Fragment>
|
|
26
|
-
{!!icon && <Icon svg={icon} className={Styles.navigationIcon} />}
|
|
27
|
-
{!!iconActive && (
|
|
28
|
-
<Icon
|
|
29
|
-
svg={iconActive}
|
|
30
|
-
className={classNames(Styles.navigationIcon, Styles.navigationIconActive)}
|
|
31
|
-
/>
|
|
32
|
-
)}
|
|
33
|
-
|
|
34
|
-
{!!label && (
|
|
35
|
-
<span
|
|
36
|
-
className={classNames(Styles.navigationItemLabel, labelClassName)}
|
|
37
|
-
data-cy="nav-item-label"
|
|
38
|
-
>
|
|
39
|
-
{label}
|
|
40
|
-
</span>
|
|
41
|
-
)}
|
|
42
|
-
|
|
43
|
-
{!!tag && (
|
|
44
|
-
<CounterTag
|
|
45
|
-
data={tag}
|
|
46
|
-
className={classNames(Styles.navigationItemCounter, counterClassName)}
|
|
47
|
-
longClassName={Styles.navigationItemCounterLong}
|
|
48
|
-
/>
|
|
49
|
-
)}
|
|
50
|
-
</Fragment>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
7
|
+
import {
|
|
8
|
+
InternalLayoutHeaderNavigationLink,
|
|
9
|
+
InternalLayoutHeaderNavigationTrigger,
|
|
10
|
+
} from './layout-header-links-internal';
|
|
11
|
+
import { withTooltip } from './with-tooltip';
|
|
53
12
|
|
|
54
13
|
/** Navigation extra item with link */
|
|
55
|
-
export const LayoutHeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
56
|
-
id,
|
|
57
|
-
to,
|
|
58
|
-
hint,
|
|
59
|
-
tooltip,
|
|
60
|
-
className,
|
|
61
|
-
counter,
|
|
62
|
-
icon,
|
|
63
|
-
iconActive,
|
|
64
|
-
iconClassName,
|
|
65
|
-
iconComponent,
|
|
66
|
-
iconName,
|
|
67
|
-
isActive,
|
|
68
|
-
label,
|
|
69
|
-
labelClassName,
|
|
70
|
-
tag,
|
|
71
|
-
target,
|
|
72
|
-
title,
|
|
73
|
-
...rest
|
|
74
|
-
}) => {
|
|
14
|
+
export const LayoutHeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({ tooltip, ...rest }) => {
|
|
75
15
|
const { NavigationComponent } = useTitanLayoutContext();
|
|
76
16
|
|
|
77
17
|
return withTooltip(
|
|
78
|
-
<NavigationComponent
|
|
79
|
-
data-cy={`navigation-item-${id}`}
|
|
80
|
-
data-pendo={`navigation-item-${id}`}
|
|
81
|
-
{...rest}
|
|
82
|
-
key={id}
|
|
83
|
-
to={to}
|
|
84
|
-
className={classNames(Styles.navigationLink, className, {
|
|
85
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
86
|
-
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
87
|
-
})}
|
|
88
|
-
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
89
|
-
activeClassName={Styles.navigationItemActive}
|
|
90
|
-
target={target}
|
|
91
|
-
>
|
|
92
|
-
<HeaderNavigationItemContent
|
|
93
|
-
tag={getCounterTag(counter, tag)}
|
|
94
|
-
icon={icon}
|
|
95
|
-
iconActive={iconActive}
|
|
96
|
-
label={label}
|
|
97
|
-
labelClassName={labelClassName}
|
|
98
|
-
/>
|
|
99
|
-
</NavigationComponent>,
|
|
18
|
+
<InternalLayoutHeaderNavigationLink {...rest} navigationComponent={NavigationComponent} />,
|
|
100
19
|
tooltip
|
|
101
20
|
);
|
|
102
21
|
};
|
|
103
22
|
|
|
104
23
|
/** Navigation extra item with icon button */
|
|
105
24
|
export const LayoutHeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
106
|
-
id,
|
|
107
|
-
className,
|
|
108
|
-
counter,
|
|
109
|
-
icon,
|
|
110
|
-
iconActive,
|
|
111
|
-
iconName,
|
|
112
|
-
isActive,
|
|
113
|
-
hint,
|
|
114
|
-
label,
|
|
115
|
-
labelClassName,
|
|
116
|
-
tag,
|
|
117
25
|
tooltip,
|
|
118
|
-
title,
|
|
119
|
-
titleClassName,
|
|
120
26
|
...rest
|
|
121
27
|
}) => {
|
|
122
|
-
return withTooltip(
|
|
123
|
-
<div
|
|
124
|
-
data-cy={`navigation-trigger-${id}`}
|
|
125
|
-
data-pendo={`navigation-trigger-${id}`}
|
|
126
|
-
{...rest}
|
|
127
|
-
title={hint}
|
|
128
|
-
className={classNames(
|
|
129
|
-
Styles.navigationLink,
|
|
130
|
-
{
|
|
131
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
132
|
-
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
133
|
-
},
|
|
134
|
-
'cursor-pointer',
|
|
135
|
-
className
|
|
136
|
-
)}
|
|
137
|
-
>
|
|
138
|
-
<HeaderNavigationItemContent
|
|
139
|
-
tag={getCounterTag(counter, tag)}
|
|
140
|
-
icon={icon}
|
|
141
|
-
iconActive={iconActive}
|
|
142
|
-
label={label}
|
|
143
|
-
labelClassName={labelClassName}
|
|
144
|
-
/>
|
|
145
|
-
</div>,
|
|
146
|
-
tooltip
|
|
147
|
-
);
|
|
28
|
+
return withTooltip(<InternalLayoutHeaderNavigationTrigger {...rest} />, tooltip);
|
|
148
29
|
};
|
|
@@ -122,14 +122,15 @@
|
|
|
122
122
|
min-width: 0;
|
|
123
123
|
overflow-x: auto;
|
|
124
124
|
overflow-y: hidden;
|
|
125
|
+
flex: 1;
|
|
125
126
|
|
|
126
127
|
display: flex;
|
|
127
128
|
justify-content: center;
|
|
128
129
|
align-items: center;
|
|
129
130
|
|
|
130
131
|
&.calculating {
|
|
131
|
-
|
|
132
|
-
opacity: 0;
|
|
132
|
+
> * {
|
|
133
|
+
opacity: 0 !important;
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
|
|
@@ -237,7 +238,8 @@
|
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
//!!!!!!!!!!!!!!! nav links styles !!!!!!!!!!!!!!!//
|
|
240
|
-
.navigation-link
|
|
241
|
+
.navigation-link,
|
|
242
|
+
.navigation-link-overflow {
|
|
241
243
|
&.navigation-item-icon-state.navigation-item-active {
|
|
242
244
|
.navigation-icon[data-anv][data-anv]:not(.navigation-icon-active) {
|
|
243
245
|
display: none;
|
|
@@ -276,34 +278,34 @@
|
|
|
276
278
|
|
|
277
279
|
border-radius: 12px;
|
|
278
280
|
font-size: @size-links-tiny;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.navigation-item-counter {
|
|
282
|
-
color: @color-white;
|
|
283
|
-
font-weight: @font-weight-semibold;
|
|
284
|
-
font-size: 8px !important;
|
|
285
|
-
min-width: 16px !important;
|
|
286
|
-
height: 16px !important;
|
|
287
|
-
position: absolute;
|
|
288
|
-
top: 4px;
|
|
289
|
-
right: -2px;
|
|
290
281
|
|
|
291
|
-
|
|
292
|
-
|
|
282
|
+
.navigation-item-counter {
|
|
283
|
+
color: @color-white;
|
|
284
|
+
font-weight: @font-weight-semibold;
|
|
285
|
+
font-size: 8px !important;
|
|
286
|
+
min-width: 16px !important;
|
|
287
|
+
height: 16px !important;
|
|
288
|
+
position: absolute;
|
|
289
|
+
top: 4px;
|
|
290
|
+
right: -2px;
|
|
291
|
+
|
|
292
|
+
&.navigation-item-counter-long {
|
|
293
|
+
right: -8px;
|
|
294
|
+
}
|
|
293
295
|
}
|
|
294
|
-
}
|
|
295
296
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
297
|
+
.navigation-item-label {
|
|
298
|
+
color: inherit;
|
|
299
|
+
font-size: @typescale-1;
|
|
300
|
+
font-family: @base-font-family;
|
|
301
|
+
font-weight: @font-weight-semibold;
|
|
302
|
+
margin-left: @spacing-half;
|
|
303
|
+
}
|
|
303
304
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
.navigation-icon[data-anv][data-anv] {
|
|
306
|
+
height: 24px;
|
|
307
|
+
width: 24px;
|
|
308
|
+
}
|
|
307
309
|
}
|
|
308
310
|
|
|
309
311
|
&.header-desktop {
|
|
@@ -339,7 +341,7 @@
|
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
.header-dark .navigation-link,
|
|
342
|
-
.header-navigation
|
|
344
|
+
.header-navigation .navigation-link {
|
|
343
345
|
&.navigation-item-active {
|
|
344
346
|
color: @color-blue-200 !important;
|
|
345
347
|
}
|
|
@@ -401,47 +403,52 @@
|
|
|
401
403
|
}
|
|
402
404
|
}
|
|
403
405
|
|
|
404
|
-
.header-navigation-overflow
|
|
405
|
-
display:
|
|
406
|
-
|
|
407
|
-
padding: @spacing-1 12px;
|
|
408
|
-
cursor: pointer;
|
|
409
|
-
|
|
410
|
-
font-family: @base-font-family;
|
|
411
|
-
font-size: @typescale-4;
|
|
412
|
-
position: relative;
|
|
413
|
-
align-items: center;
|
|
414
|
-
flex-wrap: nowrap;
|
|
415
|
-
text-wrap: nowrap;
|
|
406
|
+
.header-navigation-overflow {
|
|
407
|
+
display: flex;
|
|
408
|
+
flex-direction: column;
|
|
416
409
|
|
|
417
410
|
margin-left: -0.5rem;
|
|
418
411
|
margin-right: -0.5rem;
|
|
419
412
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
color: @color-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
&.navigation-item-active:not(:hover) {
|
|
426
|
-
color: @color-blue;
|
|
427
|
-
}
|
|
413
|
+
.navigation-link-overflow {
|
|
414
|
+
display: inline-flex;
|
|
415
|
+
color: @color-black;
|
|
416
|
+
padding: @spacing-1 12px;
|
|
417
|
+
cursor: pointer;
|
|
428
418
|
|
|
429
|
-
.navigation-item-label {
|
|
430
419
|
font-family: @base-font-family;
|
|
431
|
-
font-size: @typescale-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
font-weight: @font-weight-semibold;
|
|
437
|
-
font-size: 8px !important;
|
|
420
|
+
font-size: @typescale-4;
|
|
421
|
+
position: relative;
|
|
422
|
+
align-items: center;
|
|
423
|
+
flex-wrap: nowrap;
|
|
424
|
+
text-wrap: nowrap;
|
|
438
425
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
426
|
+
&:hover {
|
|
427
|
+
background-color: @color-blue-500;
|
|
428
|
+
color: @color-white;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
&.navigation-item-active:not(:hover) {
|
|
432
|
+
color: @color-blue;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.navigation-item-label {
|
|
436
|
+
font-family: @base-font-family;
|
|
437
|
+
font-size: @typescale-2;
|
|
438
|
+
margin-left: @spacing-half;
|
|
439
|
+
}
|
|
440
|
+
.navigation-item-counter {
|
|
441
|
+
color: @color-white;
|
|
442
|
+
font-weight: @font-weight-semibold;
|
|
443
|
+
font-size: 8px !important;
|
|
444
|
+
margin-right: @spacing-half;
|
|
445
|
+
margin-left: @spacing-half;
|
|
446
|
+
|
|
447
|
+
min-width: 12px !important;
|
|
448
|
+
height: 12px !important;
|
|
449
|
+
}
|
|
450
|
+
.navigation-icon[data-anv][data-anv] {
|
|
451
|
+
height: 20px;
|
|
452
|
+
}
|
|
446
453
|
}
|
|
447
454
|
}
|
|
@@ -365,6 +365,20 @@ export const TitanLayoutAnvil1TopNav = (args: LayoutContentArgs) => (
|
|
|
365
365
|
);
|
|
366
366
|
|
|
367
367
|
export const TitanLayoutAnvil1Top = (args: LayoutContentArgs) => (
|
|
368
|
+
<TitanLayout
|
|
369
|
+
{...useLayoutProps(args)}
|
|
370
|
+
appearance="anvil1"
|
|
371
|
+
navVariant="top"
|
|
372
|
+
top={undefined}
|
|
373
|
+
navigationOverflowItems={undefined}
|
|
374
|
+
>
|
|
375
|
+
<Anvil1Page>
|
|
376
|
+
<Content {...args} />
|
|
377
|
+
</Anvil1Page>
|
|
378
|
+
</TitanLayout>
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
export const TitanLayoutAnvil1TopOverflow = (args: LayoutContentArgs) => (
|
|
368
382
|
<TitanLayout {...useLayoutProps(args)} appearance="anvil1" navVariant="top" top={undefined}>
|
|
369
383
|
<Anvil1Page>
|
|
370
384
|
<Content {...args} />
|