@servicetitan/navigation 11.0.0-canary.237.ff793b3.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/badge-tag.js +7 -2
- package/dist/components/badge-tag.js.map +1 -1
- package/dist/components/counter-tag.js +10 -2
- package/dist/components/counter-tag.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.js +44 -8
- package/dist/components/header-navigation/header-navigation-content.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.js +49 -13
- package/dist/components/header-navigation/header-navigation-links.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-stories.module.less.d.ts +3 -0
- package/dist/components/header-navigation/header-navigation.js +178 -46
- package/dist/components/header-navigation/header-navigation.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.module.less.d.ts +22 -0
- package/dist/components/header-navigation/index.js +1 -0
- package/dist/components/header-navigation/index.js.map +1 -1
- package/dist/components/header-navigation/with-tooltip.js +7 -1
- package/dist/components/header-navigation/with-tooltip.js.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.js +62 -15
- package/dist/components/left-navigation/header-navigation-tiny-links.js.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny.js +27 -2
- package/dist/components/left-navigation/header-navigation-tiny.js.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny.module.less.d.ts +15 -0
- package/dist/components/left-navigation/index.d.ts +1 -1
- package/dist/components/left-navigation/index.d.ts.map +1 -1
- package/dist/components/left-navigation/index.js +1 -1
- package/dist/components/left-navigation/index.js.map +1 -1
- package/dist/components/left-navigation/interface-internal.js +2 -1
- package/dist/components/left-navigation/interface-internal.js.map +1 -1
- package/dist/components/left-navigation/interface.js +2 -1
- package/dist/components/left-navigation/interface.js.map +1 -1
- package/dist/components/left-navigation/side-navigation-context.js +4 -3
- package/dist/components/left-navigation/side-navigation-context.js.map +1 -1
- package/dist/components/left-navigation/side-navigation-links-internal.js +76 -16
- package/dist/components/left-navigation/side-navigation-links-internal.js.map +1 -1
- package/dist/components/left-navigation/side-navigation-links.js +34 -13
- package/dist/components/left-navigation/side-navigation-links.js.map +1 -1
- package/dist/components/left-navigation/side-navigation.js +314 -85
- package/dist/components/left-navigation/side-navigation.js.map +1 -1
- package/dist/components/left-navigation/side-navigation.module.less.d.ts +48 -0
- package/dist/components/left-navigation/with-tooltip.js +12 -1
- package/dist/components/left-navigation/with-tooltip.js.map +1 -1
- package/dist/components/links.js +28 -7
- package/dist/components/links.js.map +1 -1
- package/dist/components/logo/logo-company-title.js +19 -3
- package/dist/components/logo/logo-company-title.js.map +1 -1
- package/dist/components/logo/logo-titan-text.js +50 -6
- package/dist/components/logo/logo-titan-text.js.map +1 -1
- package/dist/components/logo/logo-titan-text.module.less.d.ts +6 -0
- package/dist/components/logo/logo-titan.d.ts +1 -0
- package/dist/components/logo/logo-titan.d.ts.map +1 -1
- package/dist/components/logo/logo-titan.js +53 -8
- package/dist/components/logo/logo-titan.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +2 -0
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +176 -32
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +20 -8
- package/dist/components/profile-dropdown/profile-dropdown.module.less.d.ts +23 -0
- package/dist/components/profile-dropdown/profile-icon.js +49 -3
- package/dist/components/profile-dropdown/profile-icon.js.map +1 -1
- package/dist/components/titan-layout/index.d.ts +2 -2
- package/dist/components/titan-layout/index.d.ts.map +1 -1
- package/dist/components/titan-layout/index.js +1 -2
- package/dist/components/titan-layout/index.js.map +1 -1
- package/dist/components/titan-layout/interface-internal.js +2 -1
- package/dist/components/titan-layout/interface-internal.js.map +1 -1
- package/dist/components/titan-layout/interface.js +2 -1
- package/dist/components/titan-layout/interface.js.map +1 -1
- package/dist/components/titan-layout/layout-context.js +15 -6
- package/dist/components/titan-layout/layout-context.js.map +1 -1
- package/dist/components/titan-layout/layout-header-dark.d.ts +10 -0
- package/dist/components/titan-layout/layout-header-dark.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-header-dark.js +146 -0
- package/dist/components/titan-layout/layout-header-dark.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 +61 -15
- package/dist/components/titan-layout/layout-header-links.js.map +1 -1
- package/dist/components/titan-layout/layout-header.d.ts +2 -6
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header.js +46 -2
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +320 -90
- package/dist/components/titan-layout/layout-header.module.less.d.ts +34 -0
- package/dist/components/titan-layout/layout-logo.d.ts +5 -3
- package/dist/components/titan-layout/layout-logo.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-logo.js +45 -9
- package/dist/components/titan-layout/layout-logo.js.map +1 -1
- package/dist/components/titan-layout/layout-logo.stories.d.ts +15 -4
- package/dist/components/titan-layout/layout-logo.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.js +87 -31
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +162 -36
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js +33 -13
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +198 -34
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.module.less +6 -2
- package/dist/components/titan-layout/layout-sidebar.module.less.d.ts +49 -0
- package/dist/components/titan-layout/notifications-context.js +20 -10
- package/dist/components/titan-layout/notifications-context.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.d.ts +7 -8
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +275 -121
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.module.less +9 -2
- package/dist/components/titan-layout/titan-layout.module.less.d.ts +17 -0
- package/dist/components/titan-layout/titan-layout.stories.d.ts +6 -0
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/with-tooltip.d.ts +4 -1
- package/dist/components/titan-layout/with-tooltip.d.ts.map +1 -1
- package/dist/components/titan-layout/with-tooltip.js +13 -1
- package/dist/components/titan-layout/with-tooltip.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/test/data-stories.module.less.d.ts +3 -0
- package/dist/test/data.js +223 -90
- package/dist/test/data.js.map +1 -1
- package/dist/utils/counter-tag.js +2 -1
- package/dist/utils/counter-tag.js.map +1 -1
- package/dist/utils/navigation-context.js +12 -6
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation-legacy.js +2 -1
- package/dist/utils/navigation-legacy.js.map +1 -1
- package/dist/utils/navigation.js +2 -1
- package/dist/utils/navigation.js.map +1 -1
- package/dist/utils/side-nav.js +9 -6
- package/dist/utils/side-nav.js.map +1 -1
- package/dist/utils/use-breakpoint.js +12 -9
- package/dist/utils/use-breakpoint.js.map +1 -1
- package/package.json +4 -4
- package/src/components/left-navigation/index.ts +1 -1
- package/src/components/logo/logo-titan.tsx +3 -1
- package/src/components/profile-dropdown/profile-dropdown.module.less +20 -8
- package/src/components/profile-dropdown/profile-dropdown.module.less.d.ts +2 -0
- package/src/components/profile-dropdown/profile-dropdown.tsx +45 -13
- package/src/components/titan-layout/index.ts +2 -2
- package/src/components/titan-layout/layout-header-dark.tsx +186 -0
- package/src/components/titan-layout/layout-header-links.tsx +3 -2
- package/src/components/titan-layout/layout-header.module.less +320 -90
- package/src/components/titan-layout/layout-header.module.less.d.ts +20 -2
- package/src/components/titan-layout/layout-header.tsx +18 -17
- package/src/components/titan-layout/layout-logo.stories.tsx +103 -15
- package/src/components/titan-layout/layout-logo.tsx +33 -36
- package/src/components/titan-layout/layout-profile.stories.tsx +1 -1
- package/src/components/titan-layout/layout-profile.tsx +46 -17
- package/src/components/titan-layout/layout-sidebar-links.tsx +5 -1
- package/src/components/titan-layout/layout-sidebar.module.less +6 -2
- package/src/components/titan-layout/layout-sidebar.tsx +1 -1
- package/src/components/titan-layout/titan-layout.module.less +9 -2
- package/src/components/titan-layout/titan-layout.module.less.d.ts +2 -1
- package/src/components/titan-layout/titan-layout.stories.tsx +82 -20
- package/src/components/titan-layout/titan-layout.tsx +115 -125
- package/src/components/titan-layout/with-tooltip.tsx +5 -2
- package/src/index.ts +4 -5
- package/src/utils/use-breakpoint.ts +1 -1
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.js +0 -13
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.js +0 -29
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js +0 -50
- package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +0 -1
- package/dist/components/header-navigation/header-navigation.stories.js +0 -54
- package/dist/components/header-navigation/header-navigation.stories.js.map +0 -1
- package/dist/components/layout.stories.js +0 -29
- package/dist/components/layout.stories.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.js +0 -13
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.stories.js +0 -30
- package/dist/components/left-navigation/header-navigation-tiny.stories.js.map +0 -1
- package/dist/components/left-navigation/side-navigation.stories.js +0 -115
- package/dist/components/left-navigation/side-navigation.stories.js.map +0 -1
- package/dist/components/logo/logo.stories.js +0 -20
- package/dist/components/logo/logo.stories.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js +0 -13
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js +0 -13
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.js +0 -51
- package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +0 -1
- package/dist/components/titan-layout/layout-logo.stories.js +0 -17
- package/dist/components/titan-layout/layout-logo.stories.js.map +0 -1
- package/dist/components/titan-layout/layout-profile.stories.js +0 -13
- package/dist/components/titan-layout/layout-profile.stories.js.map +0 -1
- package/dist/components/titan-layout/titan-layout.stories.js +0 -83
- package/dist/components/titan-layout/titan-layout.stories.js.map +0 -1
|
@@ -1,31 +1,119 @@
|
|
|
1
1
|
import { Chip } from '@servicetitan/anvil2';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
2
|
import { withAnvil, withDefaultRedirects, withMemoryRouter } from '../../test/data';
|
|
4
|
-
import {
|
|
5
|
-
import { TitanLayout } from './titan-layout';
|
|
3
|
+
import { LayoutLogo, TitanLayoutLogoProps } from './layout-logo';
|
|
4
|
+
import { TitanLayout, TitanLayoutProps } from './titan-layout';
|
|
6
5
|
|
|
7
|
-
const withTitanLayout = (
|
|
8
|
-
<TitanLayout navigationMainItems={[]}
|
|
9
|
-
{element}
|
|
10
|
-
<TitanLayout.Content>logo</TitanLayout.Content>
|
|
11
|
-
</TitanLayout>
|
|
6
|
+
const withTitanLayout = (logo: TitanLayoutLogoProps, layoutProps?: TitanLayoutProps) => () => (
|
|
7
|
+
<TitanLayout navigationMainItems={[]} {...layoutProps} logo={logo} />
|
|
12
8
|
);
|
|
13
9
|
|
|
14
10
|
export default {
|
|
15
11
|
title: 'Navigation/TitanLayoutLogo',
|
|
16
|
-
component:
|
|
12
|
+
component: LayoutLogo,
|
|
17
13
|
decorators: [withDefaultRedirects, withMemoryRouter, withAnvil],
|
|
18
14
|
parameters: {},
|
|
19
15
|
};
|
|
20
16
|
|
|
21
|
-
export const
|
|
17
|
+
export const LogoTinyDefault = withTitanLayout({});
|
|
22
18
|
|
|
23
|
-
export const
|
|
19
|
+
export const LogoTinyCompanyTitle = withTitanLayout({ title: true });
|
|
24
20
|
|
|
25
|
-
export const
|
|
26
|
-
|
|
21
|
+
export const LogoTinyCommercial = withTitanLayout({ title: 'Commercial', mantleFill: '#2270EE' });
|
|
22
|
+
|
|
23
|
+
export const LogoTinyWithPostfix = withTitanLayout({
|
|
24
|
+
title: true,
|
|
25
|
+
postfix: <Chip size="small" label="demo" />,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const LogoTinyCommercialWithPostfix = withTitanLayout({
|
|
29
|
+
title: 'Commercial',
|
|
30
|
+
mantleFill: '#2270EE',
|
|
31
|
+
postfix: <Chip size="small" label="demo" />,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const LogoStackedDefault = withTitanLayout(
|
|
35
|
+
{},
|
|
36
|
+
{
|
|
37
|
+
navVariant: 'top',
|
|
38
|
+
top: <div />,
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
export const LogoStackedCompanyTitle = withTitanLayout(
|
|
42
|
+
{ title: true },
|
|
43
|
+
{
|
|
44
|
+
navVariant: 'top',
|
|
45
|
+
top: <div />,
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
export const LogoStackedCommercial = withTitanLayout(
|
|
50
|
+
{ title: 'Commercial', mantleFill: '#2270EE' },
|
|
51
|
+
{
|
|
52
|
+
navVariant: 'top',
|
|
53
|
+
top: <div />,
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
export const LogoStackedWithPostfix = withTitanLayout(
|
|
58
|
+
{
|
|
59
|
+
title: true,
|
|
60
|
+
postfix: <Chip size="small" label="demo" />,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
navVariant: 'top',
|
|
64
|
+
top: <div />,
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export const LogoStackedCommercialWithPostfix = withTitanLayout(
|
|
69
|
+
{
|
|
70
|
+
title: 'Commercial',
|
|
71
|
+
mantleFill: '#2270EE',
|
|
72
|
+
postfix: <Chip size="small" label="demo" />,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
navVariant: 'top',
|
|
76
|
+
top: <div />,
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export const LogoDarkDefault = withTitanLayout(
|
|
81
|
+
{},
|
|
82
|
+
{
|
|
83
|
+
navVariant: 'top',
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
export const LogoDarkCompanyTitle = withTitanLayout(
|
|
87
|
+
{ title: true },
|
|
88
|
+
{
|
|
89
|
+
navVariant: 'top',
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
export const LogoDarkCommercial = withTitanLayout(
|
|
94
|
+
{ title: 'Commercial', mantleFill: '#2270EE' },
|
|
95
|
+
{
|
|
96
|
+
navVariant: 'top',
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
export const LogoDarkWithPostfix = withTitanLayout(
|
|
101
|
+
{
|
|
102
|
+
title: true,
|
|
103
|
+
postfix: <Chip size="small" label="demo" />,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
navVariant: 'top',
|
|
107
|
+
}
|
|
27
108
|
);
|
|
28
109
|
|
|
29
|
-
export const
|
|
30
|
-
|
|
110
|
+
export const LogoDarkCommercialWithPostfix = withTitanLayout(
|
|
111
|
+
{
|
|
112
|
+
title: 'Commercial',
|
|
113
|
+
mantleFill: '#2270EE',
|
|
114
|
+
postfix: <Chip size="small" label="demo" />,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
navVariant: 'top',
|
|
118
|
+
}
|
|
31
119
|
);
|
|
@@ -1,64 +1,61 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { FC, Fragment, ReactNode } from 'react';
|
|
3
3
|
import { LogoCompanyTitle } from '../logo/logo-company-title';
|
|
4
|
-
import {
|
|
4
|
+
import { LogoTitanSvg } from '../logo/logo-titan';
|
|
5
|
+
import { LogoTitanTitle, WrapperProps } from '../logo/logo-titan-text';
|
|
5
6
|
import { useTitanLayoutContext } from './layout-context';
|
|
7
|
+
import * as Styles from './layout-header.module.less';
|
|
6
8
|
|
|
7
9
|
export interface TitanLayoutLogoProps {
|
|
8
|
-
/** container class name */
|
|
9
|
-
className?: string;
|
|
10
|
-
|
|
11
10
|
title?: string | boolean;
|
|
12
|
-
|
|
13
11
|
postfix?: ReactNode;
|
|
14
|
-
|
|
15
12
|
logoWrapper?: WrapperProps;
|
|
16
|
-
|
|
17
13
|
mantleFill?: string;
|
|
14
|
+
to?: string;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
const EmptyWrapper: FC<any> = ({ children }) => children;
|
|
21
18
|
|
|
22
|
-
export const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
export const isLogoCompany = (props: TitanLayoutLogoProps | undefined, isMobile: boolean) =>
|
|
20
|
+
props?.title === true && !isMobile;
|
|
21
|
+
export const isLogoCustom = (props: TitanLayoutLogoProps | undefined, isMobile: boolean) =>
|
|
22
|
+
!isLogoCompany(props, isMobile) && !!props?.mantleFill;
|
|
23
|
+
export const isLogoText = (props: TitanLayoutLogoProps | undefined, isMobile: boolean) =>
|
|
24
|
+
typeof props?.title === 'string' && !isMobile;
|
|
25
|
+
|
|
26
|
+
export const LayoutLogo: FC<TitanLayoutLogoProps> = props => {
|
|
29
27
|
const {
|
|
28
|
+
NavigationComponent,
|
|
30
29
|
breakpoint: { isMobile },
|
|
31
30
|
} = useTitanLayoutContext();
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const logoSize = isMobile ? 44 : 56;
|
|
35
|
-
const logoCompanySize = 48;
|
|
36
|
-
const showCompanyTitle = title === true && !isMobile;
|
|
31
|
+
const Wrapper: FC<any> = props.to ? NavigationComponent : EmptyWrapper;
|
|
32
|
+
const showCompanyTitle = isLogoCompany(props, isMobile);
|
|
37
33
|
|
|
38
34
|
return (
|
|
39
|
-
<div
|
|
40
|
-
className={classNames(
|
|
41
|
-
'd-f align-items-center',
|
|
42
|
-
{ 'p-t-half': showCompanyTitle },
|
|
43
|
-
className
|
|
44
|
-
)}
|
|
45
|
-
>
|
|
35
|
+
<div className={classNames(Styles.logo)} data-cy="navigation-left">
|
|
46
36
|
{showCompanyTitle ? (
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
<div className={Styles.logoCompanyWrapper}>
|
|
38
|
+
<Wrapper to={props.to}>
|
|
39
|
+
<LogoCompanyTitle />
|
|
40
|
+
</Wrapper>
|
|
41
|
+
</div>
|
|
42
|
+
) : (
|
|
51
43
|
<Fragment>
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
<div className={Styles.logoShortWrapper}>
|
|
45
|
+
<Wrapper to={props.to}>
|
|
46
|
+
<LogoTitanSvg mantleFill={props.mantleFill} />
|
|
47
|
+
</Wrapper>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
{isLogoText(props, isMobile) && (
|
|
51
|
+
<LogoTitanTitle className={Styles.logoTitle}>{props.title}</LogoTitanTitle>
|
|
55
52
|
)}
|
|
56
53
|
</Fragment>
|
|
57
|
-
) : (
|
|
58
|
-
<LogoTitan size={logoSize} mantleFill={mantleFill} logoWrapper={Wrapper} />
|
|
59
54
|
)}
|
|
60
55
|
|
|
61
|
-
{!isMobile && postfix
|
|
56
|
+
{!isMobile && props.postfix && (
|
|
57
|
+
<div className={Styles.logoPostfix}>{props.postfix}</div>
|
|
58
|
+
)}
|
|
62
59
|
</div>
|
|
63
60
|
);
|
|
64
61
|
};
|
|
@@ -25,18 +25,28 @@ export type {
|
|
|
25
25
|
ProfileDropdownLinkProps,
|
|
26
26
|
} from '../profile-dropdown/profile-dropdown';
|
|
27
27
|
|
|
28
|
-
const ExternalNavComponent: FC<NavLinkComponentProps> = ({
|
|
29
|
-
|
|
28
|
+
const ExternalNavComponent: FC<NavLinkComponentProps> = ({
|
|
29
|
+
children,
|
|
30
|
+
isActive,
|
|
31
|
+
to,
|
|
32
|
+
activeClassName,
|
|
33
|
+
...props
|
|
34
|
+
}) => (
|
|
35
|
+
<a {...props} href={to}>
|
|
36
|
+
{children}
|
|
37
|
+
</a>
|
|
30
38
|
);
|
|
31
39
|
|
|
32
40
|
const ProfileDropdownContent: FC<ProfileDropdownProps> = props => {
|
|
33
|
-
const { breakpoint, NavigationComponent } = useTitanLayoutContext();
|
|
41
|
+
const { isTitanLayout, breakpoint, NavigationComponent } = useTitanLayoutContext();
|
|
34
42
|
return breakpoint.isMobile ? (
|
|
35
43
|
<MobileProfileDropdown {...props} navigationComponent={NavigationComponent} />
|
|
36
|
-
) : (
|
|
44
|
+
) : isTitanLayout ? (
|
|
37
45
|
<NavigationComponentContext.Provider value={NavigationComponent}>
|
|
38
46
|
<DesktopProfileDropdown {...props} />
|
|
39
47
|
</NavigationComponentContext.Provider>
|
|
48
|
+
) : (
|
|
49
|
+
<DesktopProfileDropdown {...props} />
|
|
40
50
|
);
|
|
41
51
|
};
|
|
42
52
|
ProfileDropdownContent.displayName = 'ProfileDropdown';
|
|
@@ -88,18 +98,25 @@ const ProfileDropdownDivider: FC = () => {
|
|
|
88
98
|
);
|
|
89
99
|
};
|
|
90
100
|
|
|
91
|
-
const getText = (
|
|
92
|
-
if (typeof
|
|
93
|
-
return
|
|
101
|
+
const getText = (children: any, text: any): string | undefined => {
|
|
102
|
+
if (typeof children === 'string') {
|
|
103
|
+
return children;
|
|
94
104
|
}
|
|
95
105
|
|
|
96
|
-
if (typeof
|
|
97
|
-
return
|
|
106
|
+
if (typeof text === 'string') {
|
|
107
|
+
return text;
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
return undefined;
|
|
101
111
|
};
|
|
102
112
|
|
|
113
|
+
const getTag = (
|
|
114
|
+
tag: ProfileDropdownLinkProps['tag'],
|
|
115
|
+
counter: ProfileDropdownLinkProps['counter']
|
|
116
|
+
): boolean => {
|
|
117
|
+
return !!tag?.value || !!counter;
|
|
118
|
+
};
|
|
119
|
+
|
|
103
120
|
const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = props => {
|
|
104
121
|
const { breakpoint } = useTitanLayoutContext();
|
|
105
122
|
return breakpoint.isMobile ? (
|
|
@@ -108,10 +125,19 @@ const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = props => {
|
|
|
108
125
|
<DesktopProfileDropdown.Section {...props} />
|
|
109
126
|
);
|
|
110
127
|
};
|
|
111
|
-
const MobileProfileDropdownSection: FC<ProfileDropdownSectionProps> =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
128
|
+
const MobileProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
129
|
+
children,
|
|
130
|
+
text,
|
|
131
|
+
tooltip,
|
|
132
|
+
title,
|
|
133
|
+
...props
|
|
134
|
+
}) => {
|
|
135
|
+
const sectionText = getText(children, text);
|
|
136
|
+
const { onNotificationsUpdate } = useNotificationsContext();
|
|
137
|
+
onNotificationsUpdate(props.id, getTag(props.tag, props.counter));
|
|
138
|
+
|
|
139
|
+
return sectionText ? (
|
|
140
|
+
<InternalSideNavigationGroupTrigger {...props} title={sectionText} />
|
|
115
141
|
) : null;
|
|
116
142
|
};
|
|
117
143
|
|
|
@@ -126,19 +152,22 @@ const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = props => {
|
|
|
126
152
|
const MobileProfileDropdownLink: FC<ProfileDropdownLinkProps & NavigationComponentProps> = ({
|
|
127
153
|
external,
|
|
128
154
|
to,
|
|
155
|
+
tooltip,
|
|
156
|
+
text,
|
|
157
|
+
children,
|
|
129
158
|
navigationComponent,
|
|
130
159
|
...props
|
|
131
160
|
}) => {
|
|
132
161
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
133
|
-
const
|
|
162
|
+
const linkText = getText(children, text);
|
|
134
163
|
const isExternalLink = external ?? to?.startsWith('http');
|
|
135
|
-
onNotificationsUpdate(props.id,
|
|
164
|
+
onNotificationsUpdate(props.id, getTag(props.tag, props.counter));
|
|
136
165
|
|
|
137
|
-
return
|
|
166
|
+
return linkText ? (
|
|
138
167
|
<InternalSideNavigationGroupLink
|
|
139
168
|
{...props}
|
|
140
169
|
to={to}
|
|
141
|
-
title={
|
|
170
|
+
title={linkText}
|
|
142
171
|
navigationComponent={isExternalLink ? ExternalNavComponent : navigationComponent}
|
|
143
172
|
/>
|
|
144
173
|
) : null;
|
|
@@ -64,5 +64,9 @@ export function TitanLayoutSidebarTrigger({
|
|
|
64
64
|
onClick={isMobile && !!onMobileClick ? onMobileClick : onClick}
|
|
65
65
|
/>
|
|
66
66
|
);
|
|
67
|
-
return wrapper && !isMobile
|
|
67
|
+
return wrapper && (!isMobile || !onMobileClick) ? (
|
|
68
|
+
<WrappedLink wrapper={wrapper}>{element}</WrappedLink>
|
|
69
|
+
) : (
|
|
70
|
+
element
|
|
71
|
+
);
|
|
68
72
|
}
|
|
@@ -85,10 +85,14 @@
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
@media only screen and (min-width: 361px) {
|
|
88
|
-
|
|
88
|
+
.nav-drawer-opened {
|
|
89
|
+
width: 85vw;
|
|
90
|
+
}
|
|
89
91
|
}
|
|
90
92
|
@media only screen and (min-width: 481px) {
|
|
91
|
-
|
|
93
|
+
.nav-drawer-opened {
|
|
94
|
+
width: 80vw;
|
|
95
|
+
}
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
// desktop version collapsed
|
|
@@ -61,12 +61,19 @@
|
|
|
61
61
|
.layout {
|
|
62
62
|
--nav-offset-top: 0px;
|
|
63
63
|
--nav-offset-left: 0px;
|
|
64
|
+
--content-offset-top: var(--nav-offset-top);
|
|
65
|
+
--offset: var(--content-offset-top);
|
|
64
66
|
|
|
65
|
-
&.layout-desktop.layout-top {
|
|
67
|
+
&.layout-desktop.layout-top-light {
|
|
66
68
|
--nav-offset-top: 48px;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
&.layout-
|
|
71
|
+
&.layout-desktop.layout-top-nav {
|
|
72
|
+
--nav-offset-top: 80px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.layout-mobile.layout-top-light,
|
|
76
|
+
&.layout-mobile.layout-top-nav {
|
|
70
77
|
--nav-offset-top: 72px;
|
|
71
78
|
}
|
|
72
79
|
|
|
@@ -9,7 +9,8 @@ export const layoutLegacy: string;
|
|
|
9
9
|
export const layoutMobile: string;
|
|
10
10
|
export const layoutNavSlim: string;
|
|
11
11
|
export const layoutNavWide: string;
|
|
12
|
-
export const
|
|
12
|
+
export const layoutTopLight: string;
|
|
13
|
+
export const layoutTopNav: string;
|
|
13
14
|
export const side: string;
|
|
14
15
|
export const top: string;
|
|
15
16
|
export const topPlaceholder: string;
|
|
@@ -65,6 +65,11 @@ const mainNavItems = [
|
|
|
65
65
|
items.reports,
|
|
66
66
|
];
|
|
67
67
|
|
|
68
|
+
const overflowNavItems = [
|
|
69
|
+
{ ...items.accounting, id: 'accounting-overflow', title: 'Other Accounting' },
|
|
70
|
+
{ ...items.reports, id: 'reports-overflow', title: 'Other Reports' },
|
|
71
|
+
];
|
|
72
|
+
|
|
68
73
|
const profile = (
|
|
69
74
|
<ProfileDropdown>
|
|
70
75
|
<ProfileDropdown.Link
|
|
@@ -80,6 +85,7 @@ const profile = (
|
|
|
80
85
|
id="second"
|
|
81
86
|
onClick={() => alert('second click')}
|
|
82
87
|
tooltip="Second hint"
|
|
88
|
+
counter
|
|
83
89
|
>
|
|
84
90
|
second link
|
|
85
91
|
</ProfileDropdown.Section>
|
|
@@ -198,11 +204,14 @@ const useLayoutProps = (args: LayoutContentArgs): TitanLayoutProps => {
|
|
|
198
204
|
|
|
199
205
|
navigationComponent: NavLinkMock,
|
|
200
206
|
navigationMainItems: args.emptyNav ? [] : mainNavItems,
|
|
207
|
+
navigationOverflowItems: args.emptyNav ? [] : overflowNavItems,
|
|
201
208
|
|
|
202
209
|
profile,
|
|
203
210
|
top: args.search ? <SearchBar /> : undefined,
|
|
204
211
|
header: args.header ? <ContentHeader /> : undefined,
|
|
205
212
|
|
|
213
|
+
logo: { title: true },
|
|
214
|
+
|
|
206
215
|
extraLinks,
|
|
207
216
|
extraLinksTop,
|
|
208
217
|
extraText: args.extraText ? 'EST (-8 hrs)' : undefined,
|
|
@@ -217,6 +226,7 @@ const Content = (args: LayoutContentArgs) => {
|
|
|
217
226
|
return (
|
|
218
227
|
<Fragment>
|
|
219
228
|
<LocationInfo className="m-b-3" />
|
|
229
|
+
<div className="m-b-3">rendered - {new Date().toLocaleTimeString()}</div>
|
|
220
230
|
{args.wideContent && (
|
|
221
231
|
<div style={{ width: '1200px' }}>
|
|
222
232
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
|
|
@@ -307,35 +317,87 @@ const Content = (args: LayoutContentArgs) => {
|
|
|
307
317
|
|
|
308
318
|
export const TitanLayoutLegacy = (args: LayoutContentArgs) => (
|
|
309
319
|
<TitanLayout {...useLayoutProps(args)} appearance="legacy">
|
|
310
|
-
<
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
</
|
|
320
|
+
<div
|
|
321
|
+
className="p-3"
|
|
322
|
+
style={{ position: 'absolute', width: 'calc(100% - var(--nav-offset-left))' }}
|
|
323
|
+
>
|
|
324
|
+
<Content {...args} />
|
|
325
|
+
</div>
|
|
326
|
+
</TitanLayout>
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
export const TitanLayoutLegacyTopNav = (args: LayoutContentArgs) => (
|
|
330
|
+
<TitanLayout {...useLayoutProps(args)} appearance="legacy" navVariant="top">
|
|
331
|
+
<div
|
|
332
|
+
className="p-3"
|
|
333
|
+
style={{ position: 'absolute', width: 'calc(100% - var(--nav-offset-left))' }}
|
|
334
|
+
>
|
|
335
|
+
<Content {...args} />
|
|
336
|
+
</div>
|
|
337
|
+
</TitanLayout>
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
export const TitanLayoutLegacyTop = (args: LayoutContentArgs) => (
|
|
341
|
+
<TitanLayout {...useLayoutProps(args)} appearance="legacy" navVariant="top" top={undefined}>
|
|
342
|
+
<div
|
|
343
|
+
className="p-3"
|
|
344
|
+
style={{ position: 'absolute', width: 'calc(100% - var(--nav-offset-left))' }}
|
|
345
|
+
>
|
|
346
|
+
<Content {...args} />
|
|
347
|
+
</div>
|
|
316
348
|
</TitanLayout>
|
|
317
349
|
);
|
|
318
350
|
|
|
319
351
|
export const TitanLayoutAnvil1 = (args: LayoutContentArgs) => (
|
|
320
352
|
<TitanLayout {...useLayoutProps(args)} appearance="anvil1">
|
|
321
|
-
<
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
353
|
+
<Anvil1Page>
|
|
354
|
+
<Content {...args} />
|
|
355
|
+
</Anvil1Page>
|
|
356
|
+
</TitanLayout>
|
|
357
|
+
);
|
|
358
|
+
|
|
359
|
+
export const TitanLayoutAnvil1TopNav = (args: LayoutContentArgs) => (
|
|
360
|
+
<TitanLayout {...useLayoutProps(args)} appearance="anvil1" navVariant="top">
|
|
361
|
+
<Anvil1Page>
|
|
362
|
+
<Content {...args} />
|
|
363
|
+
</Anvil1Page>
|
|
364
|
+
</TitanLayout>
|
|
365
|
+
);
|
|
366
|
+
|
|
367
|
+
export const TitanLayoutAnvil1Top = (args: LayoutContentArgs) => (
|
|
368
|
+
<TitanLayout {...useLayoutProps(args)} appearance="anvil1" navVariant="top" top={undefined}>
|
|
369
|
+
<Anvil1Page>
|
|
370
|
+
<Content {...args} />
|
|
371
|
+
</Anvil1Page>
|
|
327
372
|
</TitanLayout>
|
|
328
373
|
);
|
|
329
374
|
|
|
330
375
|
export const TitanLayoutAnvil2 = (args: LayoutContentArgs) => (
|
|
331
376
|
<TitanLayout {...useLayoutProps(args)} appearance="anvil2">
|
|
332
|
-
<
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
377
|
+
<Anvil2Page>
|
|
378
|
+
<Anvil2Page.Content>
|
|
379
|
+
<Content {...args} />
|
|
380
|
+
</Anvil2Page.Content>
|
|
381
|
+
</Anvil2Page>
|
|
382
|
+
</TitanLayout>
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
export const TitanLayoutAnvil2TopNav = (args: LayoutContentArgs) => (
|
|
386
|
+
<TitanLayout {...useLayoutProps(args)} appearance="anvil2" navVariant="top">
|
|
387
|
+
<Anvil2Page>
|
|
388
|
+
<Anvil2Page.Content>
|
|
389
|
+
<Content {...args} />
|
|
390
|
+
</Anvil2Page.Content>
|
|
391
|
+
</Anvil2Page>
|
|
392
|
+
</TitanLayout>
|
|
393
|
+
);
|
|
394
|
+
|
|
395
|
+
export const TitanLayoutAnvil2Top = (args: LayoutContentArgs) => (
|
|
396
|
+
<TitanLayout {...useLayoutProps(args)} appearance="anvil2" navVariant="top" top={undefined}>
|
|
397
|
+
<Anvil2Page>
|
|
398
|
+
<Anvil2Page.Content>
|
|
399
|
+
<Content {...args} />
|
|
400
|
+
</Anvil2Page.Content>
|
|
401
|
+
</Anvil2Page>
|
|
340
402
|
</TitanLayout>
|
|
341
403
|
);
|