@servicetitan/navigation 12.0.3 → 13.0.0-canary.256.5761ed1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/counter-tag.d.ts +1 -1
- package/dist/components/counter-tag.d.ts.map +1 -1
- package/dist/components/counter-tag.js.map +1 -1
- package/dist/components/profile-dropdown/interface.d.ts +55 -0
- package/dist/components/profile-dropdown/interface.d.ts.map +1 -0
- package/dist/components/profile-dropdown/interface.js.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts +13 -0
- package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts +5 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +9 -79
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +22 -22
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts +5 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/interface-internal.d.ts +12 -0
- package/dist/components/titan-layout/interface-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/interface-internal.js.map +1 -1
- package/dist/components/titan-layout/interface.d.ts +66 -13
- package/dist/components/titan-layout/interface.d.ts.map +1 -1
- package/dist/components/titan-layout/interface.js.map +1 -1
- package/dist/components/titan-layout/layout-header-dark.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-dark.js +21 -11
- package/dist/components/titan-layout/layout-header-dark.js.map +1 -1
- package/dist/components/titan-layout/layout-header-links-internal.d.ts +22 -3
- package/dist/components/titan-layout/layout-header-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links-internal.js +15 -18
- package/dist/components/titan-layout/layout-header-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-header-links.d.ts +3 -4
- package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links.js +25 -5
- package/dist/components/titan-layout/layout-header-links.js.map +1 -1
- package/dist/components/titan-layout/layout-header.d.ts +2 -2
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +31 -0
- package/dist/components/titan-layout/layout-header.module.less.d.ts +2 -0
- package/dist/components/titan-layout/layout-profile.d.ts +8 -5
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.js +30 -28
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +48 -25
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +56 -52
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.d.ts +3 -3
- package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js +33 -18
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +49 -24
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/titan-layout-default.stories.d.ts +16 -0
- package/dist/components/titan-layout/titan-layout-default.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout-legacy.stories.d.ts +10 -0
- package/dist/components/titan-layout/titan-layout-legacy.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout-links.d.ts +5 -0
- package/dist/components/titan-layout/titan-layout-links.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout-links.js +34 -0
- package/dist/components/titan-layout/titan-layout-links.js.map +1 -0
- package/dist/components/titan-layout/titan-layout-stacked.stories.d.ts +10 -0
- package/dist/components/titan-layout/titan-layout-stacked.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout.d.ts +5 -4
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +10 -8
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/test/data.d.ts +26 -23
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +26 -69
- package/dist/test/data.js.map +1 -1
- package/dist/test/titan-layout.d.ts +16 -0
- package/dist/test/titan-layout.d.ts.map +1 -0
- package/dist/test/titan-layout.js +21 -0
- package/dist/test/titan-layout.js.map +1 -0
- package/dist/utils/navigation-context.d.ts +3 -22
- package/dist/utils/navigation-context.d.ts.map +1 -1
- package/dist/utils/navigation-context.js +2 -10
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation.d.ts +2 -7
- package/dist/utils/navigation.d.ts.map +1 -1
- package/dist/utils/navigation.js.map +1 -1
- package/package.json +2 -2
- package/src/components/counter-tag.tsx +1 -1
- package/src/components/profile-dropdown/interface.ts +47 -0
- package/src/components/profile-dropdown/profile-dropdown-legacy.stories.tsx +25 -0
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +15 -7
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +50 -43
- package/src/components/profile-dropdown/profile-dropdown.tsx +39 -115
- package/src/components/titan-layout/interface-internal.ts +13 -0
- package/src/components/titan-layout/interface.ts +72 -16
- package/src/components/titan-layout/layout-header-dark.tsx +17 -4
- package/src/components/titan-layout/layout-header-links-internal.tsx +41 -54
- package/src/components/titan-layout/layout-header-links.tsx +65 -12
- package/src/components/titan-layout/layout-header.module.less +31 -0
- package/src/components/titan-layout/layout-header.module.less.d.ts +2 -0
- package/src/components/titan-layout/layout-header.tsx +2 -2
- package/src/components/titan-layout/layout-profile.tsx +53 -34
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +169 -116
- package/src/components/titan-layout/layout-sidebar-links.tsx +73 -24
- package/src/components/titan-layout/layout-sidebar.tsx +52 -28
- package/src/components/titan-layout/{titan-layout.stories.tsx → titan-layout-default.stories.tsx} +125 -113
- package/src/components/titan-layout/titan-layout-legacy.stories.tsx +24 -0
- package/src/components/titan-layout/titan-layout-links.tsx +34 -0
- package/src/components/titan-layout/titan-layout-stacked.stories.tsx +30 -0
- package/src/components/titan-layout/titan-layout.tsx +12 -9
- package/src/index.ts +1 -12
- package/src/test/data.tsx +31 -83
- package/src/test/titan-layout.tsx +34 -0
- package/src/utils/navigation-context.tsx +9 -35
- package/src/utils/navigation.ts +3 -10
- package/dist/components/header-navigation/header-navigation-content.d.ts +0 -30
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-content.js +0 -58
- package/dist/components/header-navigation/header-navigation-content.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts +0 -9
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +0 -11
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-links.js +0 -62
- package/dist/components/header-navigation/header-navigation-links.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-stories.module.less +0 -6
- package/dist/components/header-navigation/header-navigation-stories.module.less.d.ts +0 -3
- package/dist/components/header-navigation/header-navigation.d.ts +0 -59
- package/dist/components/header-navigation/header-navigation.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation.js +0 -228
- package/dist/components/header-navigation/header-navigation.js.map +0 -1
- package/dist/components/header-navigation/header-navigation.module.less +0 -260
- package/dist/components/header-navigation/header-navigation.module.less.d.ts +0 -22
- package/dist/components/header-navigation/header-navigation.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/index.d.ts +0 -2
- package/dist/components/header-navigation/index.d.ts.map +0 -1
- package/dist/components/header-navigation/index.js +0 -3
- package/dist/components/header-navigation/index.js.map +0 -1
- package/dist/components/header-navigation/with-tooltip.d.ts +0 -4
- package/dist/components/header-navigation/with-tooltip.d.ts.map +0 -1
- package/dist/components/header-navigation/with-tooltip.js +0 -10
- package/dist/components/header-navigation/with-tooltip.js.map +0 -1
- package/dist/components/layout.stories.d.ts +0 -13
- package/dist/components/layout.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts +0 -9
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts +0 -18
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.js +0 -79
- package/dist/components/left-navigation/header-navigation-tiny-links.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.d.ts +0 -23
- package/dist/components/left-navigation/header-navigation-tiny.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.js +0 -32
- package/dist/components/left-navigation/header-navigation-tiny.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.module.less +0 -117
- package/dist/components/left-navigation/header-navigation-tiny.module.less.d.ts +0 -15
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts +0 -12
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/index.d.ts +0 -5
- package/dist/components/left-navigation/index.d.ts.map +0 -1
- package/dist/components/left-navigation/index.js +0 -5
- package/dist/components/left-navigation/index.js.map +0 -1
- package/dist/components/left-navigation/interface-internal.d.ts +0 -10
- package/dist/components/left-navigation/interface-internal.d.ts.map +0 -1
- package/dist/components/left-navigation/interface-internal.js +0 -3
- package/dist/components/left-navigation/interface-internal.js.map +0 -1
- package/dist/components/left-navigation/interface.d.ts +0 -20
- package/dist/components/left-navigation/interface.d.ts.map +0 -1
- package/dist/components/left-navigation/interface.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-context.d.ts +0 -8
- package/dist/components/left-navigation/side-navigation-context.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-context.js +0 -8
- package/dist/components/left-navigation/side-navigation-context.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts +0 -28
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-links-internal.js +0 -89
- package/dist/components/left-navigation/side-navigation-links-internal.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-links.d.ts +0 -6
- package/dist/components/left-navigation/side-navigation-links.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-links.js +0 -48
- package/dist/components/left-navigation/side-navigation-links.js.map +0 -1
- package/dist/components/left-navigation/side-navigation.d.ts +0 -29
- package/dist/components/left-navigation/side-navigation.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation.js +0 -411
- package/dist/components/left-navigation/side-navigation.js.map +0 -1
- package/dist/components/left-navigation/side-navigation.module.less +0 -530
- package/dist/components/left-navigation/side-navigation.module.less.d.ts +0 -48
- package/dist/components/left-navigation/side-navigation.stories.d.ts +0 -17
- package/dist/components/left-navigation/side-navigation.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/with-tooltip.d.ts +0 -4
- package/dist/components/left-navigation/with-tooltip.d.ts.map +0 -1
- package/dist/components/left-navigation/with-tooltip.js +0 -15
- package/dist/components/left-navigation/with-tooltip.js.map +0 -1
- package/dist/components/links.d.ts +0 -5
- package/dist/components/links.d.ts.map +0 -1
- package/dist/components/links.js +0 -35
- package/dist/components/links.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts +0 -9
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts.map +0 -1
- package/dist/components/titan-layout/layout-profile.stories.d.ts +0 -13
- package/dist/components/titan-layout/layout-profile.stories.d.ts.map +0 -1
- package/dist/components/titan-layout/titan-layout.stories.d.ts +0 -29
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +0 -1
- package/dist/utils/navigation-legacy.d.ts +0 -88
- package/dist/utils/navigation-legacy.d.ts.map +0 -1
- package/dist/utils/navigation-legacy.js +0 -3
- package/dist/utils/navigation-legacy.js.map +0 -1
- package/src/components/header-navigation/header-navigation-content.tsx +0 -120
- package/src/components/header-navigation/header-navigation-extra-stacked.stories.tsx +0 -19
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +0 -142
- package/src/components/header-navigation/header-navigation-links.tsx +0 -141
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +0 -146
- package/src/components/header-navigation/header-navigation-stories.module.less +0 -6
- package/src/components/header-navigation/header-navigation-stories.module.less.d.ts +0 -3
- package/src/components/header-navigation/header-navigation.module.less +0 -260
- package/src/components/header-navigation/header-navigation.module.less.d.ts +0 -22
- package/src/components/header-navigation/header-navigation.stories.tsx +0 -165
- package/src/components/header-navigation/header-navigation.tsx +0 -327
- package/src/components/header-navigation/index.ts +0 -1
- package/src/components/header-navigation/with-tooltip.tsx +0 -15
- package/src/components/layout.stories.tsx +0 -103
- package/src/components/left-navigation/header-navigation-extra-tiny.stories.tsx +0 -21
- package/src/components/left-navigation/header-navigation-tiny-links.tsx +0 -145
- package/src/components/left-navigation/header-navigation-tiny.module.less +0 -117
- package/src/components/left-navigation/header-navigation-tiny.module.less.d.ts +0 -15
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +0 -178
- package/src/components/left-navigation/header-navigation-tiny.tsx +0 -65
- package/src/components/left-navigation/index.ts +0 -4
- package/src/components/left-navigation/interface-internal.ts +0 -11
- package/src/components/left-navigation/interface.ts +0 -26
- package/src/components/left-navigation/side-navigation-context.tsx +0 -13
- package/src/components/left-navigation/side-navigation-links-internal.tsx +0 -151
- package/src/components/left-navigation/side-navigation-links.tsx +0 -57
- package/src/components/left-navigation/side-navigation.module.less +0 -530
- package/src/components/left-navigation/side-navigation.module.less.d.ts +0 -48
- package/src/components/left-navigation/side-navigation.stories.tsx +0 -226
- package/src/components/left-navigation/side-navigation.tsx +0 -543
- package/src/components/left-navigation/with-tooltip.tsx +0 -16
- package/src/components/links.tsx +0 -54
- package/src/components/profile-dropdown/profile-dropdown-tiny.stories.tsx +0 -25
- package/src/components/titan-layout/layout-profile.stories.tsx +0 -46
- package/src/utils/navigation-legacy.ts +0 -106
- /package/dist/components/{left-navigation → profile-dropdown}/interface.js +0 -0
|
@@ -3,57 +3,41 @@ import SvgExpandLess from '@servicetitan/anvil2/assets/icons/material/round/expa
|
|
|
3
3
|
import SvgExpandMore from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';
|
|
4
4
|
import SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';
|
|
5
5
|
import SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';
|
|
6
|
-
import { BodyText, Popover
|
|
6
|
+
import { BodyText, Popover } from '@servicetitan/design-system';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import {
|
|
9
9
|
ComponentPropsWithoutRef,
|
|
10
10
|
FC,
|
|
11
|
-
HTMLAttributeAnchorTarget,
|
|
12
11
|
MouseEvent,
|
|
13
12
|
MouseEventHandler,
|
|
14
|
-
ReactNode,
|
|
15
13
|
useCallback,
|
|
16
|
-
useContext,
|
|
17
14
|
useEffect,
|
|
18
15
|
useMemo,
|
|
19
16
|
useState,
|
|
20
17
|
} from 'react';
|
|
21
18
|
|
|
22
19
|
import { CounterTagData, CounterTagValue } from '../../utils/counter-tag';
|
|
23
|
-
import {
|
|
24
|
-
NavigationComponentContext,
|
|
25
|
-
NavigationLegacyContext,
|
|
26
|
-
} from '../../utils/navigation-context';
|
|
27
20
|
import { getCounterTag } from '../../utils/side-nav';
|
|
28
21
|
import { CounterTag } from '../counter-tag';
|
|
22
|
+
import { useTitanLayoutContext } from '../titan-layout';
|
|
29
23
|
import { withTooltip } from '../titan-layout/with-tooltip';
|
|
24
|
+
import {
|
|
25
|
+
ProfileDropdownLinkProps,
|
|
26
|
+
ProfileDropdownProps,
|
|
27
|
+
ProfileDropdownSectionProps,
|
|
28
|
+
ProfileDropdownTriggerProps,
|
|
29
|
+
} from './interface';
|
|
30
30
|
import * as Styles from './profile-dropdown.module.less';
|
|
31
|
-
import { ProfileLogo } from './profile-icon';
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
open: boolean;
|
|
41
|
-
onClick?(e: MouseEvent): void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const ProfileDropdownTrigger: FC<ProfileDropdownTriggerProps> = ({
|
|
45
|
-
avatarBadge,
|
|
46
|
-
badge,
|
|
47
|
-
className,
|
|
48
|
-
hintArrow,
|
|
49
|
-
imageSrc,
|
|
50
|
-
info,
|
|
51
|
-
onClick,
|
|
52
|
-
open,
|
|
53
|
-
}) => {
|
|
32
|
+
const ProfileDropdownTrigger: FC<
|
|
33
|
+
ProfileDropdownTriggerProps & {
|
|
34
|
+
hintArrow?: boolean;
|
|
35
|
+
open: boolean;
|
|
36
|
+
onClick: ComponentPropsWithoutRef<'div'>['onClick'];
|
|
37
|
+
}
|
|
38
|
+
> = ({ info, imageSrc, avatarBadge, badge, className, hintArrow, open, onClick, ...rest }) => {
|
|
54
39
|
const [avatarSource, setAvatarSource] = useState(imageSrc ?? '');
|
|
55
40
|
const [avatarSourceError, setAvatarSourceError] = useState(false);
|
|
56
|
-
const isLegacy = useContext(NavigationLegacyContext);
|
|
57
41
|
|
|
58
42
|
useEffect(() => {
|
|
59
43
|
const src = imageSrc ?? '';
|
|
@@ -72,19 +56,19 @@ const ProfileDropdownTrigger: FC<ProfileDropdownTriggerProps> = ({
|
|
|
72
56
|
|
|
73
57
|
return (
|
|
74
58
|
<div
|
|
59
|
+
data-cy="profile-dropdown-trigger"
|
|
60
|
+
data-pendo="profile-dropdown-trigger"
|
|
61
|
+
{...rest}
|
|
75
62
|
className={classNames(
|
|
76
63
|
'd-f align-items-center cursor-pointer position-relative p-x-1 p-y-half',
|
|
77
64
|
'profile-dropdown-trigger',
|
|
78
65
|
Styles.triggerContainer,
|
|
79
66
|
{
|
|
80
67
|
[Styles.triggerContainerHintArrow]: hintArrow,
|
|
81
|
-
[Styles.triggerContainerLegacy]: isLegacy,
|
|
82
68
|
},
|
|
83
69
|
className
|
|
84
70
|
)}
|
|
85
71
|
onClick={onClick}
|
|
86
|
-
data-cy="profile-dropdown-trigger"
|
|
87
|
-
data-pendo="profile-dropdown-trigger"
|
|
88
72
|
>
|
|
89
73
|
{avatarSource && !avatarSourceError ? (
|
|
90
74
|
<img
|
|
@@ -93,8 +77,6 @@ const ProfileDropdownTrigger: FC<ProfileDropdownTriggerProps> = ({
|
|
|
93
77
|
onError={onAvatarError}
|
|
94
78
|
alt="user dropdown menu"
|
|
95
79
|
/>
|
|
96
|
-
) : isLegacy ? (
|
|
97
|
-
<ProfileLogo />
|
|
98
80
|
) : (
|
|
99
81
|
<Icon
|
|
100
82
|
className="c-inherit-i"
|
|
@@ -163,25 +145,7 @@ const useTag = (counter?: CounterTagValue, tag?: CounterTagData) =>
|
|
|
163
145
|
) : undefined;
|
|
164
146
|
}, [counter, tag]);
|
|
165
147
|
|
|
166
|
-
|
|
167
|
-
| { children: string; text?: string }
|
|
168
|
-
| { children: ReactNode; text: string };
|
|
169
|
-
|
|
170
|
-
export interface ProfileDropdownSectionPropsStrict {
|
|
171
|
-
children: ReactNode;
|
|
172
|
-
id: string;
|
|
173
|
-
tooltip?: string;
|
|
174
|
-
className?: string;
|
|
175
|
-
tag?: CounterTagData;
|
|
176
|
-
counter?: CounterTagValue;
|
|
177
|
-
onClick?(e: MouseEvent): void;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export type ProfileDropdownSectionProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> &
|
|
181
|
-
ProfileDropdownSectionPropsStrict &
|
|
182
|
-
ProfileItemContent;
|
|
183
|
-
|
|
184
|
-
export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
148
|
+
function DesktopProfileDropdownSection({
|
|
185
149
|
children,
|
|
186
150
|
className,
|
|
187
151
|
counter,
|
|
@@ -191,7 +155,7 @@ export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
|
191
155
|
tooltip,
|
|
192
156
|
onClick,
|
|
193
157
|
...rest
|
|
194
|
-
})
|
|
158
|
+
}: ProfileDropdownSectionProps) {
|
|
195
159
|
const clickHandler: MouseEventHandler<never> = e => {
|
|
196
160
|
if (onClick) {
|
|
197
161
|
onClick(e);
|
|
@@ -221,27 +185,11 @@ export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
|
221
185
|
tooltip,
|
|
222
186
|
{ placement: 'left' }
|
|
223
187
|
);
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
export const ProfileDropdownDivider: FC = Popover.Divider;
|
|
227
|
-
|
|
228
|
-
export interface ProfileDropdownLinkPropsStrict {
|
|
229
|
-
id: string;
|
|
230
|
-
children: ReactNode;
|
|
231
|
-
className?: string;
|
|
232
|
-
external?: boolean;
|
|
233
|
-
target?: HTMLAttributeAnchorTarget;
|
|
234
|
-
tooltip?: string;
|
|
235
|
-
to: string;
|
|
236
|
-
tag?: CounterTagData;
|
|
237
|
-
counter?: CounterTagValue;
|
|
238
188
|
}
|
|
239
189
|
|
|
240
|
-
|
|
241
|
-
ProfileDropdownLinkPropsStrict &
|
|
242
|
-
ProfileItemContent;
|
|
190
|
+
const DesktopProfileDropdownDivider: FC = Popover.Divider;
|
|
243
191
|
|
|
244
|
-
|
|
192
|
+
function DesktopProfileDropdownLink({
|
|
245
193
|
children,
|
|
246
194
|
className,
|
|
247
195
|
external,
|
|
@@ -254,8 +202,8 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
254
202
|
tooltip,
|
|
255
203
|
onClick,
|
|
256
204
|
...rest
|
|
257
|
-
}: ProfileDropdownLinkProps)
|
|
258
|
-
const NavigationComponent =
|
|
205
|
+
}: ProfileDropdownLinkProps) {
|
|
206
|
+
const { NavigationComponent } = useTitanLayoutContext();
|
|
259
207
|
|
|
260
208
|
const isExternalLink = external ?? to?.startsWith('http');
|
|
261
209
|
|
|
@@ -300,47 +248,21 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
300
248
|
tooltip,
|
|
301
249
|
{ placement: 'left' }
|
|
302
250
|
);
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
export interface ProfileDropdownPropsStrict {
|
|
306
|
-
children?: ReactNode;
|
|
307
|
-
className?: string;
|
|
308
|
-
direction?: PopoverPropsStrict['direction'];
|
|
309
|
-
trigger?: Omit<ProfileDropdownTriggerProps, 'onClick' | 'open' | 'hintArrow'>;
|
|
310
|
-
hintPopup?: {
|
|
311
|
-
className?: string;
|
|
312
|
-
content: FC<{ openProfile(): void }>;
|
|
313
|
-
width?: PopoverPropsStrict['width'];
|
|
314
|
-
onClose?: () => void;
|
|
315
|
-
};
|
|
316
|
-
portal?: boolean;
|
|
317
|
-
width?: PopoverPropsStrict['width'];
|
|
318
|
-
onClose?(): void;
|
|
319
|
-
onOpen?(): void;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export interface ProfileDropdownProps extends ProfileDropdownPropsStrict {
|
|
323
|
-
[key: string]: any;
|
|
324
251
|
}
|
|
325
252
|
|
|
326
|
-
|
|
327
|
-
Divider: typeof ProfileDropdownDivider;
|
|
328
|
-
Link: typeof ProfileDropdownLink;
|
|
329
|
-
Trigger: typeof ProfileDropdownTrigger;
|
|
330
|
-
Section: typeof ProfileDropdownSection;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
export const ProfileDropdown: ProfileDropdownType = (({
|
|
253
|
+
function DesktopProfileDropdownComponent({
|
|
334
254
|
children,
|
|
335
|
-
|
|
255
|
+
|
|
336
256
|
direction,
|
|
257
|
+
trigger,
|
|
337
258
|
hintPopup,
|
|
338
|
-
onClose,
|
|
339
|
-
onOpen,
|
|
340
259
|
portal,
|
|
341
|
-
trigger,
|
|
342
260
|
width,
|
|
343
|
-
|
|
261
|
+
onClose,
|
|
262
|
+
onOpen,
|
|
263
|
+
|
|
264
|
+
...rest
|
|
265
|
+
}: ProfileDropdownProps) {
|
|
344
266
|
const [open, setOpen] = useState(false);
|
|
345
267
|
const handleClose = useCallback(() => {
|
|
346
268
|
setOpen(false);
|
|
@@ -376,7 +298,7 @@ export const ProfileDropdown: ProfileDropdownType = (({
|
|
|
376
298
|
);
|
|
377
299
|
|
|
378
300
|
return (
|
|
379
|
-
<div
|
|
301
|
+
<div data-cy="profile-dropdown" {...rest}>
|
|
380
302
|
{!!hintPopup && hintShown && HintComponent ? (
|
|
381
303
|
<Popover
|
|
382
304
|
direction={direction ?? 'bl'}
|
|
@@ -415,8 +337,10 @@ export const ProfileDropdown: ProfileDropdownType = (({
|
|
|
415
337
|
)}
|
|
416
338
|
</div>
|
|
417
339
|
);
|
|
418
|
-
}
|
|
340
|
+
}
|
|
419
341
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
342
|
+
export const DesktopProfileDropdown = Object.assign(DesktopProfileDropdownComponent, {
|
|
343
|
+
Divider: DesktopProfileDropdownDivider,
|
|
344
|
+
Link: DesktopProfileDropdownLink,
|
|
345
|
+
Section: DesktopProfileDropdownSection,
|
|
346
|
+
});
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
import { IconProps } from '@servicetitan/anvil2';
|
|
1
2
|
import { FC } from 'react';
|
|
3
|
+
import { CounterTagData } from '../../utils/counter-tag';
|
|
2
4
|
import { NavLinkComponentProps } from '../../utils/navigation-context';
|
|
3
5
|
|
|
4
6
|
export interface NavigationComponentProps {
|
|
5
7
|
navigationComponent: FC<NavLinkComponentProps>;
|
|
6
8
|
}
|
|
9
|
+
export interface NavigationItemPropsStrict {
|
|
10
|
+
id: string;
|
|
11
|
+
to: string;
|
|
12
|
+
title: string;
|
|
13
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
14
|
+
icon: IconProps['svg'] | undefined;
|
|
15
|
+
iconActive: IconProps['svg'] | undefined;
|
|
16
|
+
|
|
17
|
+
tag: CounterTagData | undefined;
|
|
18
|
+
className: string | undefined;
|
|
19
|
+
}
|
|
@@ -1,26 +1,82 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IconProps } from '@servicetitan/anvil2';
|
|
2
|
+
import { ComponentPropsWithoutRef, FC, ReactNode } from 'react';
|
|
3
|
+
import { CounterTagData, CounterTagValue } from '../../utils/counter-tag';
|
|
3
4
|
import { TitanLayoutSidebarContextType } from './layout-context';
|
|
4
5
|
|
|
5
|
-
export interface
|
|
6
|
-
children:
|
|
7
|
-
| ReactElement<TitanLayoutSidebarLinkProps>
|
|
8
|
-
| ReactElement<TitanLayoutSidebarTriggerProps>;
|
|
6
|
+
export interface TitanLayoutLinkWrapperProps {
|
|
7
|
+
children: ReactNode;
|
|
9
8
|
context: TitanLayoutSidebarContextType;
|
|
9
|
+
isMobile: boolean;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export
|
|
13
|
-
wrapper?: FC<TitanLayoutSidebarLinkWrapperProps>;
|
|
14
|
-
}
|
|
15
|
-
export interface TitanLayoutSidebarTriggerProps
|
|
16
|
-
extends Omit<TitanLayoutSidebarLinkProps, 'to' | 'isActive'> {
|
|
17
|
-
isActive?: boolean;
|
|
18
|
-
wrapper?: FC<TitanLayoutSidebarLinkWrapperProps>;
|
|
19
|
-
onClick?: () => void;
|
|
20
|
-
onMobileClick?: () => void;
|
|
21
|
-
}
|
|
12
|
+
export type TitanLayoutLinkWrapper = FC<TitanLayoutLinkWrapperProps>;
|
|
22
13
|
|
|
23
14
|
export interface TitanLayoutState {
|
|
24
15
|
navCollapsed: boolean;
|
|
25
16
|
submenuExpanded?: string;
|
|
26
17
|
}
|
|
18
|
+
|
|
19
|
+
export interface TitanLayoutLinkExtraProps {
|
|
20
|
+
showTitle?: boolean;
|
|
21
|
+
flashing?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TitanLayoutLinkSideProps {
|
|
25
|
+
counter: CounterTagValue;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type TitanLayoutLinkProps = {
|
|
29
|
+
/** link id */
|
|
30
|
+
id: string;
|
|
31
|
+
/** link href */
|
|
32
|
+
to: string;
|
|
33
|
+
/** link title */
|
|
34
|
+
title: string;
|
|
35
|
+
/** callback to return active state. By default, it compares link href with current pathname */
|
|
36
|
+
isActive?: boolean | ((pathname: string) => boolean);
|
|
37
|
+
/** svg icon (anvil2) of inactive item */
|
|
38
|
+
icon: IconProps['svg'] | undefined;
|
|
39
|
+
/** svg icon (anvil2) of active item */
|
|
40
|
+
iconActive: IconProps['svg'] | undefined;
|
|
41
|
+
/** item tag (optional). shown if it is set and value is true or greater than 0 */
|
|
42
|
+
tag?: CounterTagData;
|
|
43
|
+
counter?: CounterTagValue;
|
|
44
|
+
/** class name of link item */
|
|
45
|
+
className?: string;
|
|
46
|
+
|
|
47
|
+
/** tooltip text (for extra links) */
|
|
48
|
+
tooltip?: string;
|
|
49
|
+
/** wrapper component for link element (used for side links) */
|
|
50
|
+
wrapper?: TitanLayoutLinkWrapper;
|
|
51
|
+
/** props for extra link element */
|
|
52
|
+
extra?: TitanLayoutLinkExtraProps;
|
|
53
|
+
/** props for side nav link element (mobile version) */
|
|
54
|
+
side?: TitanLayoutLinkSideProps;
|
|
55
|
+
} & Omit<ComponentPropsWithoutRef<'a'>, 'children' | 'title'>;
|
|
56
|
+
|
|
57
|
+
export type TitanLayoutTriggerProps = {
|
|
58
|
+
/** link id */
|
|
59
|
+
id: string;
|
|
60
|
+
/** link title */
|
|
61
|
+
title: string;
|
|
62
|
+
/** active state */
|
|
63
|
+
isActive?: boolean;
|
|
64
|
+
/** svg icon (anvil2) of inactive item */
|
|
65
|
+
icon: IconProps['svg'] | undefined;
|
|
66
|
+
/** svg icon (anvil2) of active item */
|
|
67
|
+
iconActive: IconProps['svg'] | undefined;
|
|
68
|
+
/** item tag (optional). shown if it is set and value is true or greater than 0 */
|
|
69
|
+
tag?: CounterTagData;
|
|
70
|
+
counter?: CounterTagValue;
|
|
71
|
+
/** class name of link item */
|
|
72
|
+
className?: string;
|
|
73
|
+
|
|
74
|
+
/** tooltip text (for extra links) */
|
|
75
|
+
tooltip?: string;
|
|
76
|
+
/** wrapper component for link element (used for side links) */
|
|
77
|
+
wrapper?: TitanLayoutLinkWrapper;
|
|
78
|
+
/** props for extra link element */
|
|
79
|
+
extra?: TitanLayoutLinkExtraProps;
|
|
80
|
+
/** props for nav link element (mobile version) */
|
|
81
|
+
side?: TitanLayoutLinkSideProps;
|
|
82
|
+
} & Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'title'>;
|
|
@@ -3,6 +3,7 @@ import SvgMoreVert from '@servicetitan/anvil2/assets/icons/material/round/more_v
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { NavigationItemData } from '../../utils/navigation';
|
|
6
|
+
import { getCounterTag } from '../../utils/side-nav';
|
|
6
7
|
import { NavigationComponentProps } from './interface-internal';
|
|
7
8
|
import { useTitanLayoutContext } from './layout-context';
|
|
8
9
|
import { LayoutHeader, LayoutHeaderProps } from './layout-header';
|
|
@@ -155,8 +156,14 @@ const LayoutHeaderNav: FC<LayoutHeaderNavProps> = ({ className, mainItems, overf
|
|
|
155
156
|
{mainItems?.map(item =>
|
|
156
157
|
withTooltip(
|
|
157
158
|
<InternalLayoutHeaderNavigationLink
|
|
158
|
-
{
|
|
159
|
-
|
|
159
|
+
id={item.id}
|
|
160
|
+
to={item.to}
|
|
161
|
+
title={isMinimized ? undefined : item.title}
|
|
162
|
+
isActive={item.isActive}
|
|
163
|
+
icon={item.icon}
|
|
164
|
+
iconActive={item.iconActive}
|
|
165
|
+
tag={getCounterTag(item.counter, item.tag)}
|
|
166
|
+
className={item.className}
|
|
160
167
|
key={item.id}
|
|
161
168
|
navigationComponent={NavigationComponent}
|
|
162
169
|
/>,
|
|
@@ -195,8 +202,14 @@ const LayoutHeaderNavOverflow: FC<
|
|
|
195
202
|
<div data-cy="navigation-overflow-content" className={Styles.headerNavigationOverflow}>
|
|
196
203
|
{items.map(item => (
|
|
197
204
|
<InternalLayoutHeaderNavigationLink
|
|
198
|
-
{
|
|
199
|
-
|
|
205
|
+
id={item.id}
|
|
206
|
+
to={item.to}
|
|
207
|
+
title={item.title}
|
|
208
|
+
isActive={item.isActive}
|
|
209
|
+
icon={item.icon}
|
|
210
|
+
iconActive={item.iconActive}
|
|
211
|
+
tag={getCounterTag(item.counter, item.tag)}
|
|
212
|
+
className={item.className}
|
|
200
213
|
key={item.id}
|
|
201
214
|
navigationComponent={navigationComponent}
|
|
202
215
|
isOverflow
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { Icon, IconProps } from '@servicetitan/anvil2';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { FC, Fragment } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
HeaderNavigationLinkProps,
|
|
6
|
-
HeaderNavigationTriggerProps,
|
|
7
|
-
} from '../../utils/navigation-legacy';
|
|
8
|
-
import { getCounterTag } from '../../utils/side-nav';
|
|
4
|
+
import { CounterTagData } from '../../utils/counter-tag';
|
|
9
5
|
import { CounterTag, CounterTagProps } from '../counter-tag';
|
|
10
|
-
// use v1 tooltips due to bug with v2 in monolith
|
|
11
6
|
import { NavigationComponentProps } from './interface-internal';
|
|
12
7
|
import * as Styles from './layout-header.module.less';
|
|
13
8
|
|
|
@@ -17,9 +12,8 @@ const InternalHeaderNavigationItemContent: FC<{
|
|
|
17
12
|
counterClassName?: string;
|
|
18
13
|
icon: IconProps['svg'] | undefined;
|
|
19
14
|
iconActive?: IconProps['svg'];
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}> = ({ counterClassName, icon, iconActive, label, labelClassName, tag }) => {
|
|
15
|
+
title?: string;
|
|
16
|
+
}> = ({ counterClassName, icon, iconActive, title, tag }) => {
|
|
23
17
|
return (
|
|
24
18
|
<Fragment>
|
|
25
19
|
{!!icon && <Icon svg={icon} className={Styles.navigationIcon} />}
|
|
@@ -30,12 +24,9 @@ const InternalHeaderNavigationItemContent: FC<{
|
|
|
30
24
|
/>
|
|
31
25
|
)}
|
|
32
26
|
|
|
33
|
-
{!!
|
|
34
|
-
<span
|
|
35
|
-
|
|
36
|
-
data-cy="nav-item-label"
|
|
37
|
-
>
|
|
38
|
-
{label}
|
|
27
|
+
{!!title && (
|
|
28
|
+
<span className={Styles.navigationItemLabel} data-cy="nav-item-label">
|
|
29
|
+
{title}
|
|
39
30
|
</span>
|
|
40
31
|
)}
|
|
41
32
|
|
|
@@ -52,26 +43,30 @@ const InternalHeaderNavigationItemContent: FC<{
|
|
|
52
43
|
|
|
53
44
|
/** Navigation extra item with link */
|
|
54
45
|
export const InternalLayoutHeaderNavigationLink: FC<
|
|
55
|
-
|
|
46
|
+
NavigationComponentProps & {
|
|
47
|
+
id: string;
|
|
48
|
+
to: string;
|
|
49
|
+
title: string | undefined;
|
|
50
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
51
|
+
icon: IconProps['svg'] | undefined;
|
|
52
|
+
iconActive: IconProps['svg'] | undefined;
|
|
53
|
+
tag: CounterTagData | undefined;
|
|
54
|
+
className: string | undefined;
|
|
55
|
+
|
|
56
|
+
isOverflow?: boolean;
|
|
57
|
+
flashing?: boolean;
|
|
58
|
+
}
|
|
56
59
|
> = ({
|
|
57
60
|
id,
|
|
58
61
|
to,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
className,
|
|
62
|
-
counter,
|
|
62
|
+
title,
|
|
63
|
+
isActive,
|
|
63
64
|
icon,
|
|
64
65
|
iconActive,
|
|
65
|
-
iconClassName,
|
|
66
|
-
iconName,
|
|
67
|
-
iconComponent,
|
|
68
|
-
isActive,
|
|
69
|
-
isOverflow,
|
|
70
|
-
label,
|
|
71
|
-
labelClassName,
|
|
72
66
|
tag,
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
className,
|
|
68
|
+
isOverflow,
|
|
69
|
+
flashing,
|
|
75
70
|
navigationComponent: NavigationComponent,
|
|
76
71
|
...rest
|
|
77
72
|
}) => {
|
|
@@ -88,63 +83,55 @@ export const InternalLayoutHeaderNavigationLink: FC<
|
|
|
88
83
|
{
|
|
89
84
|
[Styles.navigationItemActive]: isActive === true,
|
|
90
85
|
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
86
|
+
[Styles.navigationItemFlashing]: flashing,
|
|
91
87
|
}
|
|
92
88
|
)}
|
|
93
89
|
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
94
90
|
activeClassName={Styles.navigationItemActive}
|
|
95
|
-
target={target}
|
|
96
91
|
>
|
|
97
92
|
<InternalHeaderNavigationItemContent
|
|
98
|
-
tag={
|
|
93
|
+
tag={tag}
|
|
99
94
|
icon={icon}
|
|
100
95
|
iconActive={iconActive}
|
|
101
|
-
|
|
102
|
-
labelClassName={labelClassName}
|
|
96
|
+
title={title}
|
|
103
97
|
/>
|
|
104
98
|
</NavigationComponent>
|
|
105
99
|
);
|
|
106
100
|
};
|
|
107
101
|
|
|
108
102
|
/** Navigation extra item with icon button */
|
|
109
|
-
export const InternalLayoutHeaderNavigationTrigger: FC<
|
|
110
|
-
id
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
icon
|
|
114
|
-
iconActive
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
tag,
|
|
121
|
-
tooltip,
|
|
122
|
-
title,
|
|
123
|
-
titleClassName,
|
|
124
|
-
...rest
|
|
125
|
-
}) => {
|
|
103
|
+
export const InternalLayoutHeaderNavigationTrigger: FC<{
|
|
104
|
+
id: string;
|
|
105
|
+
title: string | undefined;
|
|
106
|
+
isActive: boolean | undefined;
|
|
107
|
+
icon: IconProps['svg'] | undefined;
|
|
108
|
+
iconActive: IconProps['svg'] | undefined;
|
|
109
|
+
tag: CounterTagData | undefined;
|
|
110
|
+
className: string | undefined;
|
|
111
|
+
|
|
112
|
+
flashing?: boolean;
|
|
113
|
+
}> = ({ id, className, flashing, icon, iconActive, isActive, tag, title, ...rest }) => {
|
|
126
114
|
return (
|
|
127
115
|
<div
|
|
128
116
|
data-cy={`navigation-trigger-${id}`}
|
|
129
117
|
data-pendo={`navigation-trigger-${id}`}
|
|
130
118
|
{...rest}
|
|
131
|
-
title={hint}
|
|
132
119
|
className={classNames(
|
|
133
120
|
Styles.navigationLink,
|
|
134
121
|
{
|
|
135
122
|
[Styles.navigationItemActive]: isActive === true,
|
|
136
123
|
[Styles.navigationItemIconState]: !!icon && !!iconActive,
|
|
124
|
+
[Styles.navigationItemFlashing]: flashing,
|
|
137
125
|
},
|
|
138
126
|
'cursor-pointer',
|
|
139
127
|
className
|
|
140
128
|
)}
|
|
141
129
|
>
|
|
142
130
|
<InternalHeaderNavigationItemContent
|
|
143
|
-
tag={
|
|
131
|
+
tag={tag}
|
|
144
132
|
icon={icon}
|
|
145
133
|
iconActive={iconActive}
|
|
146
|
-
|
|
147
|
-
labelClassName={labelClassName}
|
|
134
|
+
title={title}
|
|
148
135
|
/>
|
|
149
136
|
</div>
|
|
150
137
|
);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
HeaderNavigationLinkProps,
|
|
4
|
-
HeaderNavigationTriggerProps,
|
|
5
|
-
} from '../../utils/navigation-legacy';
|
|
1
|
+
import { getCounterTag } from '../../utils/side-nav';
|
|
2
|
+
import { TitanLayoutLinkProps, TitanLayoutTriggerProps } from './interface';
|
|
6
3
|
import { useTitanLayoutContext } from './layout-context';
|
|
7
4
|
import {
|
|
8
5
|
InternalLayoutHeaderNavigationLink,
|
|
@@ -11,19 +8,75 @@ import {
|
|
|
11
8
|
import { withTooltip } from './with-tooltip';
|
|
12
9
|
|
|
13
10
|
/** Navigation extra item with link */
|
|
14
|
-
export
|
|
11
|
+
export function LayoutHeaderNavigationLink({
|
|
12
|
+
id,
|
|
13
|
+
to,
|
|
14
|
+
title,
|
|
15
|
+
isActive,
|
|
16
|
+
icon,
|
|
17
|
+
iconActive,
|
|
18
|
+
counter,
|
|
19
|
+
tag,
|
|
20
|
+
className,
|
|
21
|
+
|
|
22
|
+
tooltip,
|
|
23
|
+
extra,
|
|
24
|
+
side,
|
|
25
|
+
wrapper,
|
|
26
|
+
...rest
|
|
27
|
+
}: TitanLayoutLinkProps) {
|
|
15
28
|
const { NavigationComponent } = useTitanLayoutContext();
|
|
29
|
+
const { showTitle, flashing } = extra ?? {};
|
|
16
30
|
|
|
17
31
|
return withTooltip(
|
|
18
|
-
<InternalLayoutHeaderNavigationLink
|
|
32
|
+
<InternalLayoutHeaderNavigationLink
|
|
33
|
+
id={id}
|
|
34
|
+
to={to}
|
|
35
|
+
title={showTitle ? title : undefined}
|
|
36
|
+
isActive={isActive}
|
|
37
|
+
icon={icon}
|
|
38
|
+
iconActive={iconActive}
|
|
39
|
+
tag={getCounterTag(counter, tag)}
|
|
40
|
+
className={className}
|
|
41
|
+
{...rest}
|
|
42
|
+
flashing={flashing}
|
|
43
|
+
navigationComponent={NavigationComponent}
|
|
44
|
+
/>,
|
|
19
45
|
tooltip
|
|
20
46
|
);
|
|
21
|
-
}
|
|
47
|
+
}
|
|
22
48
|
|
|
23
49
|
/** Navigation extra item with icon button */
|
|
24
|
-
export
|
|
50
|
+
export function LayoutHeaderNavigationTrigger({
|
|
51
|
+
id,
|
|
52
|
+
title,
|
|
53
|
+
isActive,
|
|
54
|
+
icon,
|
|
55
|
+
iconActive,
|
|
56
|
+
counter,
|
|
57
|
+
tag,
|
|
58
|
+
className,
|
|
59
|
+
|
|
25
60
|
tooltip,
|
|
61
|
+
extra,
|
|
62
|
+
side,
|
|
63
|
+
wrapper,
|
|
26
64
|
...rest
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
|
|
65
|
+
}: TitanLayoutTriggerProps) {
|
|
66
|
+
const { showTitle, flashing } = extra ?? {};
|
|
67
|
+
|
|
68
|
+
return withTooltip(
|
|
69
|
+
<InternalLayoutHeaderNavigationTrigger
|
|
70
|
+
id={id}
|
|
71
|
+
title={showTitle ? title : undefined}
|
|
72
|
+
isActive={isActive}
|
|
73
|
+
icon={icon}
|
|
74
|
+
iconActive={iconActive}
|
|
75
|
+
tag={getCounterTag(counter, tag)}
|
|
76
|
+
className={className}
|
|
77
|
+
{...rest}
|
|
78
|
+
flashing={flashing}
|
|
79
|
+
/>,
|
|
80
|
+
tooltip
|
|
81
|
+
);
|
|
82
|
+
}
|