@servicetitan/navigation 11.1.2 → 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.
Files changed (52) hide show
  1. package/dist/components/titan-layout/layout-header-dark.d.ts.map +1 -1
  2. package/dist/components/titan-layout/layout-header-dark.js +32 -20
  3. package/dist/components/titan-layout/layout-header-dark.js.map +1 -1
  4. package/dist/components/titan-layout/layout-header-links-internal.d.ts +10 -0
  5. package/dist/components/titan-layout/layout-header-links-internal.d.ts.map +1 -0
  6. package/dist/components/titan-layout/layout-header-links-internal.js +75 -0
  7. package/dist/components/titan-layout/layout-header-links-internal.js.map +1 -0
  8. package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -1
  9. package/dist/components/titan-layout/layout-header-links.js +10 -70
  10. package/dist/components/titan-layout/layout-header-links.js.map +1 -1
  11. package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
  12. package/dist/components/titan-layout/layout-header.js +1 -0
  13. package/dist/components/titan-layout/layout-header.js.map +1 -1
  14. package/dist/components/titan-layout/layout-header.module.less +76 -63
  15. package/dist/components/titan-layout/layout-header.module.less.d.ts +1 -0
  16. package/dist/components/titan-layout/layout-logo.d.ts.map +1 -1
  17. package/dist/components/titan-layout/layout-logo.js +5 -2
  18. package/dist/components/titan-layout/layout-logo.js.map +1 -1
  19. package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
  20. package/dist/components/titan-layout/layout-profile.js +4 -3
  21. package/dist/components/titan-layout/layout-profile.js.map +1 -1
  22. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +3 -1
  23. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
  24. package/dist/components/titan-layout/layout-sidebar-links-internal.js +7 -3
  25. package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
  26. package/dist/components/titan-layout/layout-sidebar-links.js +1 -1
  27. package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
  28. package/dist/components/titan-layout/layout-sidebar.js +6 -3
  29. package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
  30. package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
  31. package/dist/components/titan-layout/titan-layout.js +1 -2
  32. package/dist/components/titan-layout/titan-layout.js.map +1 -1
  33. package/dist/components/titan-layout/titan-layout.stories.d.ts +1 -0
  34. package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
  35. package/dist/components/titan-layout/with-tooltip.d.ts +1 -1
  36. package/dist/components/titan-layout/with-tooltip.d.ts.map +1 -1
  37. package/dist/components/titan-layout/with-tooltip.js.map +1 -1
  38. package/package.json +2 -2
  39. package/src/components/titan-layout/layout-header-dark.tsx +42 -20
  40. package/src/components/titan-layout/layout-header-links-internal.tsx +151 -0
  41. package/src/components/titan-layout/layout-header-links.tsx +9 -125
  42. package/src/components/titan-layout/layout-header.module.less +76 -63
  43. package/src/components/titan-layout/layout-header.module.less.d.ts +1 -0
  44. package/src/components/titan-layout/layout-header.tsx +5 -1
  45. package/src/components/titan-layout/layout-logo.tsx +10 -5
  46. package/src/components/titan-layout/layout-profile.tsx +4 -3
  47. package/src/components/titan-layout/layout-sidebar-links-internal.tsx +14 -5
  48. package/src/components/titan-layout/layout-sidebar-links.tsx +1 -1
  49. package/src/components/titan-layout/layout-sidebar.tsx +8 -6
  50. package/src/components/titan-layout/titan-layout.stories.tsx +14 -0
  51. package/src/components/titan-layout/titan-layout.tsx +1 -2
  52. 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;AAC5D,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"}
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 { LayoutHeaderNavigationLink } from './layout-header-links';
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
- if (navigationRef.current.clientWidth + 16 > containerRef.current.clientWidth) {
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(LayoutHeaderNavigationLink, {
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 LayoutHeaderNavOverflow = ({ items })=>{
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: (props)=>/*#__PURE__*/ _jsx(ButtonCompound, {
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: items.map((item)=>/*#__PURE__*/ _createElement(LayoutHeaderNavigationLink, {
139
- ...item,
140
- label: item.title,
141
- key: item.id
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,EACbC,IAAI,EACJC,OAAO,EACPC,KAAK,EACLC,SAAS,EACTC,cAAc,EACdC,MAAM,EACNC,eAAe,EACf,GAAGC,MACN;IACG,OAAOF,uBACH,MAACG;QACGd,WAAWd,WAAWO,OAAOsB,aAAa,EAAEf;QAC5CgB,WAAQ;QACP,GAAGH,IAAI;;0BAER,KAACtB;gBACG0B,SAAQ;gBACRT,OAAOA;gBACPC,WAAWA;gB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IAEpB,qBACI,MAACb;QACGuB,KAAKb;QACLxB,WAAWd,WAAWO,OAAO6C,uBAAuB,EAAEtC,WAAW;YAC7D,CAACP,OAAO8C,WAAW,CAAC,EAAEZ;QAC1B;QACAX,WAAQ;;0BAER,KAACF;gBAAIuB,KAAKZ;gBAAezB,WAAWd,WAAWO,OAAO+C,gBAAgB;0BACjEpB,sBAAAA,gCAAAA,UAAWqB,GAAG,CAACC,CAAAA,OACZhD,0BACI,eAACF;wBACI,GAAGkD,IAAI;wBACRC,OAAOP,cAAcb,YAAYmB,KAAKE,KAAK;wBAC3CC,KAAKH,KAAKI,EAAE;wBAEhBV,cAAcM,KAAKE,KAAK,GAAGrB,WAC3B;wBAAEsB,KAAKH,KAAKI,EAAE;oBAAC;;YAI1B,CAAC,EAACzB,0BAAAA,oCAAAA,cAAe0B,MAAM,mBAAI,KAACC;gBAAwBC,OAAO5B;;;;AAGxE;AAEA,MAAM2B,0BAED,CAAC,EAAEC,KAAK,EAAE;IACX,qBACI,KAACjE;QACGkE,SAASC,CAAAA,sBACL,KAACrE;gBAAgB,GAAGqE,KAAK;gBAAEnD,WAAWP,OAAO2D,+BAA+B;0BACxE,cAAA,KAACrE;oBAAKsE,KAAKpE;oBAAaqE,MAAK;;;QAGrCC,kBAAkB9D,OAAO+D,wBAAwB;QACjDC,WAAU;kBAETR,MAAMR,GAAG,CAACC,CAAAA,qBACP,eAAClD;gBAA4B,GAAGkD,IAAI;gBAAEC,OAAOD,KAAKE,KAAK;gBAAEC,KAAKH,KAAKI,EAAE;;;AAIrF"}
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","headerNavigationOverflow","isOverflow"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,IAAI,EAAEC,IAAI,QAAmB,uBAAuB;AAC7E,OAAOC,iBAAiB,iEAAiE;AACzF,OAAOC,gBAAgB,aAAa;AACpC,SAAaC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAGrE,SAASC,qBAAqB,QAAQ,mBAAmB;AACzD,SAASC,YAAY,Q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cM,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,YA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,QAAQ,CAAC,CAACC;QAClD;QAEJwB,UAAU,OAAOA,aAAa,aAAaA,WAAWa;QACtDC,iBAAiB1C,OAAOuC,oBAAoB;QAC5CT,QAAQA;qBAER,KAAC7B;QACGM,KAAKT,cAAc0B,SAASjB;QAC5BJ,MAAMA;QACNC,YAAYA;QACZC,OAAOA;QACPC,gBAAgBA;;AAIhC,EAAE;AAEF,2CAA2C,GAC3C,OAAO,MAAMqC,wCAA0E,CAAC,EACpFvB,EAAE,EACFX,SAAS,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":"AAEA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,EACH,yBAAyB,EACzB,4BAA4B,EAC/B,MAAM,+BAA+B,CAAC;AA4CvC,sCAAsC;AACtC,eAAO,MAAM,0BAA0B,EAAE,EAAE,CAAC,yBAAyB,CA+CpE,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,6BAA6B,EAAE,EAAE,CAAC,4BAA4B,CA2C1E,CAAC"}
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,77 +1,17 @@
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
- // 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 * as Styles from './layout-header.module.less';
12
- /** Content for navigation items */ const HeaderNavigationItemContent = ({ counterClassName, icon, iconActive, label, labelClassName, tag })=>{
13
- return /*#__PURE__*/ _jsxs(Fragment, {
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
- children: label
26
- }),
27
- !!tag && /*#__PURE__*/ _jsx(CounterTag, {
28
- data: tag,
29
- className: classNames(Styles.navigationItemCounter, counterClassName),
30
- longClassName: Styles.navigationItemCounterLong
31
- })
32
- ]
33
- });
34
- };
35
- /** 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 })=>{
36
6
  const { NavigationComponent } = useTitanLayoutContext();
37
- return withTooltip(/*#__PURE__*/ _createElement(NavigationComponent, {
38
- "data-cy": `navigation-link-${id}`,
39
- "data-pendo": `navigation-link-${id}`,
7
+ return withTooltip(/*#__PURE__*/ _jsx(InternalLayoutHeaderNavigationLink, {
40
8
  ...rest,
41
- key: id,
42
- to: to,
43
- className: classNames(Styles.navigationLink, className, {
44
- [Styles.navigationItemActive]: isActive === true,
45
- [Styles.navigationItemIconState]: !!icon && !!iconActive
46
- }),
47
- isActive: typeof isActive === 'function' ? isActive : undefined,
48
- activeClassName: Styles.navigationItemActive,
49
- target: target
50
- }, /*#__PURE__*/ _jsx(HeaderNavigationItemContent, {
51
- tag: getCounterTag(counter, tag),
52
- icon: icon,
53
- iconActive: iconActive,
54
- label: label,
55
- labelClassName: labelClassName
56
- })), tooltip);
9
+ navigationComponent: NavigationComponent
10
+ }), tooltip);
57
11
  };
58
- /** Navigation extra item with icon button */ export const LayoutHeaderNavigationTrigger = ({ id, className, counter, icon, iconActive, iconName, isActive, hint, label, labelClassName, tag, tooltip, title, titleClassName, ...rest })=>{
59
- return withTooltip(/*#__PURE__*/ _jsx("div", {
60
- "data-cy": `navigation-trigger-${id}`,
61
- "data-pendo": `navigation-trigger-${id}`,
62
- ...rest,
63
- title: hint,
64
- className: classNames(Styles.navigationLink, {
65
- [Styles.navigationItemActive]: isActive === true,
66
- [Styles.navigationItemIconState]: !!icon && !!iconActive
67
- }, 'cursor-pointer', className),
68
- children: /*#__PURE__*/ _jsx(HeaderNavigationItemContent, {
69
- tag: getCounterTag(counter, tag),
70
- icon: icon,
71
- iconActive: iconActive,
72
- label: label,
73
- labelClassName: labelClassName
74
- })
12
+ /** Navigation extra item with icon button */ export const LayoutHeaderNavigationTrigger = ({ tooltip, ...rest })=>{
13
+ return withTooltip(/*#__PURE__*/ _jsx(InternalLayoutHeaderNavigationTrigger, {
14
+ ...rest
75
15
  }), tooltip);
76
16
  };
77
17
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/titan-layout/layout-header-links.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 { withTooltip } from '../header-navigation/with-tooltip';\nimport { useTitanLayoutContext } from './layout-context';\nimport * as Styles from './layout-header.module.less';\n\n/** Content for navigation items */\nconst HeaderNavigationItemContent: 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 className={classNames(Styles.navigationItemLabel, labelClassName)}>\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 LayoutHeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({\n id,\n to,\n hint,\n tooltip,\n className,\n counter,\n icon,\n iconActive,\n iconClassName,\n iconComponent,\n iconName,\n isActive,\n label,\n labelClassName,\n tag,\n target,\n title,\n ...rest\n}) => {\n const { NavigationComponent } = useTitanLayoutContext();\n\n return withTooltip(\n <NavigationComponent\n data-cy={`navigation-link-${id}`}\n data-pendo={`navigation-link-${id}`}\n {...rest}\n key={id}\n to={to}\n className={classNames(Styles.navigationLink, className, {\n [Styles.navigationItemActive]: isActive === true,\n [Styles.navigationItemIconState]: !!icon && !!iconActive,\n })}\n isActive={typeof isActive === 'function' ? isActive : undefined}\n activeClassName={Styles.navigationItemActive}\n target={target}\n >\n <HeaderNavigationItemContent\n tag={getCounterTag(counter, tag)}\n icon={icon}\n iconActive={iconActive}\n label={label}\n labelClassName={labelClassName}\n />\n </NavigationComponent>,\n tooltip\n );\n};\n\n/** Navigation extra item with icon button */\nexport const LayoutHeaderNavigationTrigger: 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 withTooltip(\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 <HeaderNavigationItemContent\n tag={getCounterTag(counter, tag)}\n icon={icon}\n iconActive={iconActive}\n label={label}\n labelClassName={labelClassName}\n />\n </div>,\n tooltip\n );\n};\n"],"names":["Icon","classNames","Fragment","getCounterTag","CounterTag","withTooltip","useTitanLayoutContext","Styles","HeaderNavigationItemContent","counterClassName","icon","iconActive","label","labelClassName","tag","svg","className","navigationIcon","navigationIconActive","span","navigationItemLabel","data","navigationItemCounter","longClassName","navigationItemCounterLong","LayoutHeaderNavigationLink","id","to","hint","tooltip","counter","iconClassName","iconComponent","iconName","isActive","target","title","rest","NavigationComponent","data-cy","data-pendo","key","navigationLink","navigationItemActive","navigationItemIconState","undefined","activeClassName","LayoutHeaderNavigationTrigger","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;AAC7D,iDAAiD;AACjD,SAASC,WAAW,QAAQ,oCAAoC;AAChE,SAASC,qBAAqB,QAAQ,mBAAmB;AACzD,YAAYC,YAAY,8BAA8B;AAEtD,iCAAiC,GACjC,MAAMC,8BAOD,CAAC,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAEC,cAAc,EAAEC,GAAG,EAAE;IACpE,qBACI,MAACZ;;YACI,CAAC,CAACQ,sBAAQ,KAACV;gBAAKe,KAAKL;gBAAMM,WAAWT,OAAOU,cAAc;;YAC3D,CAAC,CAACN,4BACC,KAACX;gBACGe,KAAKJ;gBACLK,WAAWf,WAAWM,OAAOU,cAAc,EAAEV,OAAOW,oBAAoB;;YAI/E,CAAC,CAACN,uBACC,KAACO;gBAAKH,WAAWf,WAAWM,OAAOa,mBAAmB,EAAEP;0BACnDD;;YAIR,CAAC,CAACE,qBACC,KAACV;gBACGiB,MAAMP;gBACNE,WAAWf,WAAWM,OAAOe,qBAAqB,EAAEb;gBACpDc,eAAehB,OAAOiB,yBAAyB;;;;AAKnE;AAEA,oCAAoC,GACpC,OAAO,MAAMC,6BAA4D,CAAC,EACtEC,EAAE,EACFC,EAAE,EACFC,IAAI,EACJC,OAAO,EACPb,SAAS,EACTc,OAAO,EACPpB,IAAI,EACJC,UAAU,EACVoB,aAAa,EACbC,aAA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Q,CAAC,CAACC;QAClD,GACA,kBACAK;kBAGJ,cAAA,KAACR;YACGM,KAAKX,cAAc2B,SAAShB;YAC5BJ,MAAMA;YACNC,YAAYA;YACZC,OAAOA;YACPC,gBAAgBA;;QAGxBgB;AAER,EAAE"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"layout-header.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9E,OAAO,EAAc,oBAAoB,EAAgB,MAAM,eAAe,CAAC;AAE/E,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAChF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAkE9C,CAAC"}
1
+ {"version":3,"file":"layout-header.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9E,OAAO,EAAc,oBAAoB,EAAgB,MAAM,eAAe,CAAC;AAE/E,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IAChF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAsE9C,CAAC"}
@@ -40,6 +40,7 @@ export const LayoutHeader = ({ className, right, rightText, rightClassName, cent
40
40
  children: [
41
41
  !!rightText && /*#__PURE__*/ _jsx("div", {
42
42
  className: Styles.heTopRightText,
43
+ "data-cy": "navigation-right-text",
43
44
  children: rightText
44
45
  }),
45
46
  right,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/titan-layout/layout-header.tsx"],"sourcesContent":["import SvgBurgerMenu from '@servicetitan/anvil2/assets/icons/material/round/menu.svg';\nimport classNames from 'classnames';\nimport { ComponentPropsWithoutRef, FC, ReactElement, ReactNode } from 'react';\nimport { LayoutPlacementContext } from './layout-context';\nimport { LayoutHeaderNavigationTrigger } from './layout-header-links';\nimport * as Styles from './layout-header.module.less';\nimport { LayoutLogo, TitanLayoutLogoProps, isLogoCustom } from './layout-logo';\n\nexport type LayoutHeaderProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> & {\n right?: ReactNode;\n rightText?: string;\n rightClassName?: string;\n\n id?: string;\n\n center?: ReactElement;\n centerClassName?: string;\n\n logo?: TitanLayoutLogoProps;\n profile?: ReactElement;\n\n isMobile: boolean;\n variant: 'light' | 'dark';\n hasNotifications: boolean;\n onBurgerClick?: (e: MouseEvent) => void;\n};\n\nexport const LayoutHeader: FC<LayoutHeaderProps> = ({\n className,\n right,\n rightText,\n rightClassName,\n center,\n centerClassName,\n isMobile,\n hasNotifications,\n logo,\n profile,\n variant,\n onBurgerClick,\n ...rest\n}) => {\n return (\n <LayoutPlacementContext.Provider value=\"top\">\n <div\n className={classNames(\n Styles.header,\n variant === 'light' ? Styles.headerLight : Styles.headerDark,\n isMobile ? Styles.headerMobile : Styles.headerDesktop,\n isLogoCustom(logo, isMobile) && Styles.headerLogoCustom,\n className\n )}\n data-cy=\"header-navigation\"\n {...rest}\n >\n {isMobile && (\n <div className={Styles.burger}>\n <LayoutHeaderNavigationTrigger\n id=\"burger\"\n title=\"\"\n icon={SvgBurgerMenu}\n iconActive={undefined}\n onClick={onBurgerClick}\n tag={{ value: hasNotifications }}\n />\n </div>\n )}\n <LayoutLogo {...logo} />\n <div\n className={classNames(\n Styles.heTopCenter,\n 'd-f align-items-center justify-content-center',\n centerClassName\n )}\n data-cy=\"navigation-center\"\n >\n {center}\n </div>\n <div\n className={classNames(\n 'd-f flex-row justify-content-end align-items-center',\n Styles.heTopRight,\n rightClassName\n )}\n data-cy=\"navigation-right\"\n >\n {!!rightText && <div className={Styles.heTopRightText}>{rightText}</div>}\n {right}\n {profile}\n </div>\n </div>\n </LayoutPlacementContext.Provider>\n );\n};\n"],"names":["SvgBurgerMenu","classNames","LayoutPlacementContext","LayoutHeaderNavigationTrigger","Styles","LayoutLogo","isLogoCustom","LayoutHeader","className","right","rightText","rightClassName","center","centerClassName","isMobile","hasNotifications","logo","profile","variant","onBurgerClick","rest","Provider","value","div","header","headerLight","headerDark","headerMobile","headerDesktop","headerLogoCustom","data-cy","burger","id","title","icon","iconActive","undefined","onClick","tag","heTopCenter","heTopRight","heTopRightText"],"mappings":";AAAA,OAAOA,mBAAmB,4DAA4D;AACtF,OAAOC,gBAAgB,aAAa;AAEpC,SAASC,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,YAAYC,YAAY,8BAA8B;AACtD,SAASC,UAAU,EAAwBC,YAAY,QAAQ,gBAAgB;AAqB/E,OAAO,MAAMC,eAAsC,CAAC,EAChDC,SAAS,EACTC,KAAK,EACLC,SAAS,EACTC,cAAc,EACdC,MAAM,EACNC,eAAe,EACfC,QAAQ,EACRC,gBAAgB,EAChBC,IAAI,EACJC,OAAO,EACPC,OAAO,EACPC,aAAa,EACb,GAAGC,MACN;IACG,qBACI,KAAClB,uBAAuBmB,QAAQ;QAACC,OAAM;kBACnC,cAAA,MAACC;YACGf,WAAWP,WACPG,OAAOoB,MAAM,EACbN,YAAY,UAAUd,OAAOqB,WAAW,GAAGrB,OAAOsB,UAAU,EAC5DZ,WAAWV,OAAOuB,YAAY,GAAGvB,OAAOwB,aAAa,EACrDtB,aAAaU,MAAMF,aAAaV,OAAOyB,gBAAgB,EACvDrB;YAEJsB,WAAQ;YACP,GAAGV,IAAI;;gBAEPN,0BACG,KAACS;oBAAIf,WAAWJ,OAAO2B,MAAM;8BACzB,cAAA,KAAC5B;wBACG6B,IAAG;wBACHC,OAAM;wBACNC,MAAMlC;wBACNmC,YAAYC;wBACZC,SAASlB;wBACTmB,KAAK;4BAAEhB,OAAOP;wBAAiB;;;8BAI3C,KAACV;oBAAY,GAAGW,IAAI;;8BACpB,KAACO;oBACGf,WAAWP,WACPG,OAAOmC,WAAW,EAClB,iDACA1B;oBAEJiB,WAAQ;8BAEPlB;;8BAEL,MAACW;oBACGf,WAAWP,WACP,uDACAG,OAAOoC,UAAU,EACjB7B;oBAEJmB,WAAQ;;wBAEP,CAAC,CAACpB,2BAAa,KAACa;4BAAIf,WAAWJ,OAAOqC,cAAc;sCAAG/B;;wBACvDD;wBACAQ;;;;;;AAKrB,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/titan-layout/layout-header.tsx"],"sourcesContent":["import SvgBurgerMenu from '@servicetitan/anvil2/assets/icons/material/round/menu.svg';\nimport classNames from 'classnames';\nimport { ComponentPropsWithoutRef, FC, ReactElement, ReactNode } from 'react';\nimport { LayoutPlacementContext } from './layout-context';\nimport { LayoutHeaderNavigationTrigger } from './layout-header-links';\nimport * as Styles from './layout-header.module.less';\nimport { LayoutLogo, TitanLayoutLogoProps, isLogoCustom } from './layout-logo';\n\nexport type LayoutHeaderProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> & {\n right?: ReactNode;\n rightText?: string;\n rightClassName?: string;\n\n id?: string;\n\n center?: ReactElement;\n centerClassName?: string;\n\n logo?: TitanLayoutLogoProps;\n profile?: ReactElement;\n\n isMobile: boolean;\n variant: 'light' | 'dark';\n hasNotifications: boolean;\n onBurgerClick?: (e: MouseEvent) => void;\n};\n\nexport const LayoutHeader: FC<LayoutHeaderProps> = ({\n className,\n right,\n rightText,\n rightClassName,\n center,\n centerClassName,\n isMobile,\n hasNotifications,\n logo,\n profile,\n variant,\n onBurgerClick,\n ...rest\n}) => {\n return (\n <LayoutPlacementContext.Provider value=\"top\">\n <div\n className={classNames(\n Styles.header,\n variant === 'light' ? Styles.headerLight : Styles.headerDark,\n isMobile ? Styles.headerMobile : Styles.headerDesktop,\n isLogoCustom(logo, isMobile) && Styles.headerLogoCustom,\n className\n )}\n data-cy=\"header-navigation\"\n {...rest}\n >\n {isMobile && (\n <div className={Styles.burger}>\n <LayoutHeaderNavigationTrigger\n id=\"burger\"\n title=\"\"\n icon={SvgBurgerMenu}\n iconActive={undefined}\n onClick={onBurgerClick}\n tag={{ value: hasNotifications }}\n />\n </div>\n )}\n <LayoutLogo {...logo} />\n <div\n className={classNames(\n Styles.heTopCenter,\n 'd-f align-items-center justify-content-center',\n centerClassName\n )}\n data-cy=\"navigation-center\"\n >\n {center}\n </div>\n <div\n className={classNames(\n 'd-f flex-row justify-content-end align-items-center',\n Styles.heTopRight,\n rightClassName\n )}\n data-cy=\"navigation-right\"\n >\n {!!rightText && (\n <div className={Styles.heTopRightText} data-cy=\"navigation-right-text\">\n {rightText}\n </div>\n )}\n {right}\n {profile}\n </div>\n </div>\n </LayoutPlacementContext.Provider>\n );\n};\n"],"names":["SvgBurgerMenu","classNames","LayoutPlacementContext","LayoutHeaderNavigationTrigger","Styles","LayoutLogo","isLogoCustom","LayoutHeader","className","right","rightText","rightClassName","center","centerClassName","isMobile","hasNotifications","logo","profile","variant","onBurgerClick","rest","Provider","value","div","header","headerLight","headerDark","headerMobile","headerDesktop","headerLogoCustom","data-cy","burger","id","title","icon","iconActive","undefined","onClick","tag","heTopCenter","heTopRight","heTopRightText"],"mappings":";AAAA,OAAOA,mBAAmB,4DAA4D;AACtF,OAAOC,gBAAgB,aAAa;AAEpC,SAASC,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,YAAYC,YAAY,8BAA8B;AACtD,SAASC,UAAU,EAAwBC,YAAY,QAAQ,gBAAgB;AAqB/E,OAAO,MAAMC,eAAsC,CAAC,EAChDC,SAAS,EACTC,KAAK,EACLC,SAAS,EACTC,cAAc,EACdC,MAAM,EACNC,eAAe,EACfC,QAAQ,EACRC,gBAAgB,EAChBC,IAAI,EACJC,OAAO,EACPC,OAAO,EACPC,aAAa,EACb,GAAGC,MACN;IACG,qBACI,KAAClB,uBAAuBmB,QAAQ;QAACC,OAAM;kBACnC,cAAA,MAACC;YACGf,WAAWP,WACPG,OAAOoB,MAAM,EACbN,YAAY,UAAUd,OAAOqB,WAAW,GAAGrB,OAAOsB,UAAU,EAC5DZ,WAAWV,OAAOuB,YAAY,GAAGvB,OAAOwB,aAAa,EACrDtB,aAAaU,MAAMF,aAAaV,OAAOyB,gBAAgB,EACvDrB;YAEJsB,WAAQ;YACP,GAAGV,IAAI;;gBAEPN,0BACG,KAACS;oBAAIf,WAAWJ,OAAO2B,MAAM;8BACzB,cAAA,KAAC5B;wBACG6B,IAAG;wBACHC,OAAM;wBACNC,MAAMlC;wBACNmC,YAAYC;wBACZC,SAASlB;wBACTmB,KAAK;4BAAEhB,OAAOP;wBAAiB;;;8BAI3C,KAACV;oBAAY,GAAGW,IAAI;;8BACpB,KAACO;oBACGf,WAAWP,WACPG,OAAOmC,WAAW,EAClB,iDACA1B;oBAEJiB,WAAQ;8BAEPlB;;8BAEL,MAACW;oBACGf,WAAWP,WACP,uDACAG,OAAOoC,UAAU,EACjB7B;oBAEJmB,WAAQ;;wBAEP,CAAC,CAACpB,2BACC,KAACa;4BAAIf,WAAWJ,OAAOqC,cAAc;4BAAEX,WAAQ;sCAC1CpB;;wBAGRD;wBACAQ;;;;;;AAKrB,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
- .header-navigation {
132
- opacity: 0;
132
+ > * {
133
+ opacity: 0 !important;
133
134
  }
134
135
  }
135
136
 
@@ -202,6 +203,12 @@
202
203
  text-decoration: none;
203
204
  }
204
205
  }
206
+ .logo-title {
207
+ font-family: @display-font-family;
208
+ font-weight: @font-weight-semibold;
209
+ font-size: 21px;
210
+ line-height: 24px;
211
+ }
205
212
  }
206
213
 
207
214
  .header-desktop {
@@ -231,7 +238,8 @@
231
238
  }
232
239
 
233
240
  //!!!!!!!!!!!!!!! nav links styles !!!!!!!!!!!!!!!//
234
- .navigation-link {
241
+ .navigation-link,
242
+ .navigation-link-overflow {
235
243
  &.navigation-item-icon-state.navigation-item-active {
236
244
  .navigation-icon[data-anv][data-anv]:not(.navigation-icon-active) {
237
245
  display: none;
@@ -270,34 +278,34 @@
270
278
 
271
279
  border-radius: 12px;
272
280
  font-size: @size-links-tiny;
273
- }
274
-
275
- .navigation-item-counter {
276
- color: @color-white;
277
- font-weight: @font-weight-semibold;
278
- font-size: 8px !important;
279
- min-width: 16px !important;
280
- height: 16px !important;
281
- position: absolute;
282
- top: 4px;
283
- right: -2px;
284
281
 
285
- &.navigation-item-counter-long {
286
- right: -8px;
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
+ }
287
295
  }
288
- }
289
296
 
290
- .navigation-item-label {
291
- color: inherit;
292
- font-size: @typescale-1;
293
- font-family: @base-font-family;
294
- font-weight: @font-weight-semibold;
295
- margin-left: @spacing-half;
296
- }
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
+ }
297
304
 
298
- .navigation-icon[data-anv][data-anv] {
299
- height: 24px;
300
- width: 24px;
305
+ .navigation-icon[data-anv][data-anv] {
306
+ height: 24px;
307
+ width: 24px;
308
+ }
301
309
  }
302
310
 
303
311
  &.header-desktop {
@@ -333,7 +341,7 @@
333
341
  }
334
342
 
335
343
  .header-dark .navigation-link,
336
- .header-navigation > .navigation-link {
344
+ .header-navigation .navigation-link {
337
345
  &.navigation-item-active {
338
346
  color: @color-blue-200 !important;
339
347
  }
@@ -395,47 +403,52 @@
395
403
  }
396
404
  }
397
405
 
398
- .header-navigation-overflow .navigation-link {
399
- display: inline-flex;
400
- color: @color-black;
401
- padding: @spacing-1 12px;
402
- cursor: pointer;
403
-
404
- font-family: @base-font-family;
405
- font-size: @typescale-4;
406
- position: relative;
407
- align-items: center;
408
- flex-wrap: nowrap;
409
- text-wrap: nowrap;
406
+ .header-navigation-overflow {
407
+ display: flex;
408
+ flex-direction: column;
410
409
 
411
410
  margin-left: -0.5rem;
412
411
  margin-right: -0.5rem;
413
412
 
414
- &:hover {
415
- background-color: @color-blue-500;
416
- color: @color-white;
417
- }
418
-
419
- &.navigation-item-active:not(:hover) {
420
- color: @color-blue;
421
- }
413
+ .navigation-link-overflow {
414
+ display: inline-flex;
415
+ color: @color-black;
416
+ padding: @spacing-1 12px;
417
+ cursor: pointer;
422
418
 
423
- .navigation-item-label {
424
419
  font-family: @base-font-family;
425
- font-size: @typescale-2;
426
- margin-left: @spacing-half;
427
- }
428
- .navigation-item-counter {
429
- color: @color-white;
430
- font-weight: @font-weight-semibold;
431
- font-size: 8px !important;
420
+ font-size: @typescale-4;
421
+ position: relative;
422
+ align-items: center;
423
+ flex-wrap: nowrap;
424
+ text-wrap: nowrap;
432
425
 
433
- min-width: 12px !important;
434
- height: 12px !important;
435
- margin-left: @spacing-half;
436
- margin-top: -@spacing-1;
437
- }
438
- .navigation-icon[data-anv][data-anv] {
439
- height: 20px;
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
+ }
440
453
  }
441
454
  }