@servicetitan/navigation 10.7.0 → 11.0.0-canary.237.4cefc6a.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/package.json +4 -4
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +7 -0
- package/src/components/header-navigation/header-navigation-links.tsx +2 -0
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +4 -0
- package/src/components/header-navigation/header-navigation.stories.tsx +5 -0
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +6 -0
- package/src/components/links.tsx +33 -13
- package/src/components/logo/logo-company-title.tsx +8 -6
- package/src/components/profile-dropdown/profile-dropdown.module.less +4 -0
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +4 -4
- package/src/components/profile-dropdown/profile-dropdown.tsx +43 -46
- package/src/components/titan-layout/index.ts +5 -0
- package/src/components/titan-layout/interface-internal.ts +6 -0
- package/src/components/titan-layout/interface.ts +26 -0
- package/src/components/titan-layout/layout-context.tsx +30 -0
- package/src/components/titan-layout/layout-header-links.tsx +144 -0
- package/{dist/components/left-navigation/header-navigation-tiny.module.less → src/components/titan-layout/layout-header.module.less} +41 -5
- package/src/components/titan-layout/layout-header.tsx +86 -0
- package/src/components/titan-layout/layout-logo.stories.tsx +31 -0
- package/src/components/titan-layout/layout-logo.tsx +57 -0
- package/src/components/titan-layout/layout-profile.stories.tsx +37 -0
- package/src/components/titan-layout/layout-profile.tsx +116 -0
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +265 -0
- package/src/components/titan-layout/layout-sidebar-links.tsx +56 -0
- package/src/components/titan-layout/layout-sidebar.module.less +528 -0
- package/src/components/titan-layout/layout-sidebar.tsx +298 -0
- package/src/components/titan-layout/titan-layout.module.less +53 -0
- package/src/components/titan-layout/titan-layout.stories.tsx +194 -0
- package/src/components/titan-layout/titan-layout.tsx +270 -0
- package/src/components/titan-layout/with-tooltip.tsx +16 -0
- package/src/index.ts +2 -1
- package/src/test/data.tsx +3 -2
- package/src/utils/navigation-legacy.ts +3 -1
- package/src/utils/use-breakpoint.ts +19 -0
- package/dist/components/badge-tag.d.ts +0 -12
- package/dist/components/badge-tag.d.ts.map +0 -1
- package/dist/components/badge-tag.js +0 -8
- package/dist/components/badge-tag.js.map +0 -1
- package/dist/components/counter-tag.d.ts +0 -12
- package/dist/components/counter-tag.d.ts.map +0 -1
- package/dist/components/counter-tag.js +0 -8
- package/dist/components/counter-tag.js.map +0 -1
- 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 -22
- 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-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.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-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-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 -26
- 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-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.module.less +0 -6
- 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 -96
- 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.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation.stories.d.ts.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/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 -2
- 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 -4
- 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/layout.stories.js +0 -29
- package/dist/components/layout.stories.js.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-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-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 -32
- 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 -7
- package/dist/components/left-navigation/header-navigation-tiny.js.map +0 -1
- 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/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/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 -2
- 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 +0 -2
- 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 -7
- 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 -29
- 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 -27
- 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 -182
- 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.stories.d.ts +0 -17
- package/dist/components/left-navigation/side-navigation.stories.d.ts.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/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 -4
- 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 -14
- package/dist/components/links.js.map +0 -1
- package/dist/components/logo/logo-company-title.d.ts +0 -7
- package/dist/components/logo/logo-company-title.d.ts.map +0 -1
- package/dist/components/logo/logo-company-title.js +0 -6
- package/dist/components/logo/logo-company-title.js.map +0 -1
- package/dist/components/logo/logo-titan-text.d.ts +0 -29
- package/dist/components/logo/logo-titan-text.d.ts.map +0 -1
- package/dist/components/logo/logo-titan-text.js +0 -13
- package/dist/components/logo/logo-titan-text.js.map +0 -1
- package/dist/components/logo/logo-titan-text.module.less +0 -31
- package/dist/components/logo/logo-titan.d.ts +0 -9
- package/dist/components/logo/logo-titan.d.ts.map +0 -1
- package/dist/components/logo/logo-titan.js +0 -13
- package/dist/components/logo/logo-titan.js.map +0 -1
- package/dist/components/logo/logo.stories.d.ts +0 -14
- package/dist/components/logo/logo.stories.d.ts.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.d.ts +0 -9
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.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.d.ts +0 -9
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts.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.d.ts +0 -74
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +0 -86
- package/dist/components/profile-dropdown/profile-dropdown.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +0 -167
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts +0 -16
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.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/profile-dropdown/profile-icon.d.ts +0 -3
- package/dist/components/profile-dropdown/profile-icon.d.ts.map +0 -1
- package/dist/components/profile-dropdown/profile-icon.js +0 -5
- package/dist/components/profile-dropdown/profile-icon.js.map +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/test/data-stories.module.less +0 -8
- package/dist/test/data.d.ts +0 -32
- package/dist/test/data.d.ts.map +0 -1
- package/dist/test/data.js +0 -244
- package/dist/test/data.js.map +0 -1
- package/dist/utils/counter-tag.d.ts +0 -5
- package/dist/utils/counter-tag.d.ts.map +0 -1
- package/dist/utils/counter-tag.js +0 -2
- package/dist/utils/counter-tag.js.map +0 -1
- package/dist/utils/navigation-context.d.ts +0 -27
- package/dist/utils/navigation-context.d.ts.map +0 -1
- package/dist/utils/navigation-context.js +0 -10
- package/dist/utils/navigation-context.js.map +0 -1
- package/dist/utils/navigation-legacy.d.ts +0 -86
- package/dist/utils/navigation-legacy.d.ts.map +0 -1
- package/dist/utils/navigation-legacy.js +0 -2
- package/dist/utils/navigation-legacy.js.map +0 -1
- package/dist/utils/navigation.d.ts +0 -48
- package/dist/utils/navigation.d.ts.map +0 -1
- package/dist/utils/navigation.js +0 -2
- package/dist/utils/navigation.js.map +0 -1
- package/dist/utils/side-nav.d.ts +0 -6
- package/dist/utils/side-nav.d.ts.map +0 -1
- package/dist/utils/side-nav.js +0 -28
- package/dist/utils/side-nav.js.map +0 -1
- package/src/components/header-navigation/header-navigation-stories.module.less.d.ts +0 -3
- package/src/components/header-navigation/header-navigation.module.less.d.ts +0 -22
- package/src/components/left-navigation/header-navigation-tiny.module.less.d.ts +0 -15
- package/src/components/left-navigation/side-navigation.module.less.d.ts +0 -48
- package/src/components/logo/logo-titan-text.module.less.d.ts +0 -6
- package/src/components/profile-dropdown/profile-dropdown.module.less.d.ts +0 -21
- package/src/test/data-stories.module.less.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/navigation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-canary.237.4cefc6a.0",
|
|
4
4
|
"description": "Navigation components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"classnames": "~2.3.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@servicetitan/anvil2": ">=1.
|
|
20
|
+
"@servicetitan/anvil2": ">=1.47.1",
|
|
21
21
|
"@servicetitan/design-system": ">=14.0.0",
|
|
22
22
|
"@servicetitan/react-ioc": ">=14.1.1",
|
|
23
23
|
"@servicetitan/tokens": ">=12.0.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react": ">=18.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@servicetitan/anvil2": "~1.
|
|
29
|
+
"@servicetitan/anvil2": "~1.47.1",
|
|
30
30
|
"@servicetitan/design-system": "~14.5.1",
|
|
31
31
|
"@servicetitan/react-ioc": "^30.2.1",
|
|
32
32
|
"@servicetitan/tokens": ">=12.1.11",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"less": true,
|
|
44
44
|
"webpack": false
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "4cefc6a6c7aa880897f643ee1e90e3b30f6f2421"
|
|
47
47
|
}
|
|
@@ -23,6 +23,7 @@ export default {
|
|
|
23
23
|
export const ExtraLink = () => (
|
|
24
24
|
<HeaderNavigationLink
|
|
25
25
|
id="search"
|
|
26
|
+
title="Search"
|
|
26
27
|
to="https://google.com"
|
|
27
28
|
target="_blank"
|
|
28
29
|
iconName="search"
|
|
@@ -35,6 +36,7 @@ export const ExtraLink = () => (
|
|
|
35
36
|
export const ExtraTrigger = () => (
|
|
36
37
|
<HeaderNavigationTrigger
|
|
37
38
|
id="dialpad"
|
|
39
|
+
title="Dialpad"
|
|
38
40
|
iconName="phone"
|
|
39
41
|
counter={2}
|
|
40
42
|
tooltip="Phones pro"
|
|
@@ -47,6 +49,7 @@ export const ExtraWithTooltip = () => (
|
|
|
47
49
|
<Fragment>
|
|
48
50
|
<HeaderNavigationLink
|
|
49
51
|
id="search"
|
|
52
|
+
title="Search"
|
|
50
53
|
to="https://google.com"
|
|
51
54
|
target="_blank"
|
|
52
55
|
iconName="search"
|
|
@@ -58,6 +61,7 @@ export const ExtraWithTooltip = () => (
|
|
|
58
61
|
|
|
59
62
|
<HeaderNavigationTrigger
|
|
60
63
|
id="dialpad"
|
|
64
|
+
title="Dialpad"
|
|
61
65
|
iconName="phone"
|
|
62
66
|
hint="Dialpad"
|
|
63
67
|
counter={2}
|
|
@@ -99,6 +103,7 @@ const HelpTrigger = () => {
|
|
|
99
103
|
return (
|
|
100
104
|
<HeaderNavigationTrigger
|
|
101
105
|
id="help"
|
|
106
|
+
title="Help"
|
|
102
107
|
iconName="help_outline"
|
|
103
108
|
hint="Help"
|
|
104
109
|
icon={SvgHelp}
|
|
@@ -113,6 +118,7 @@ export const ExtraWithLabel = () => (
|
|
|
113
118
|
<Fragment>
|
|
114
119
|
<HeaderNavigationLink
|
|
115
120
|
id="search"
|
|
121
|
+
title="Search"
|
|
116
122
|
to="https://google.com"
|
|
117
123
|
target="_blank"
|
|
118
124
|
iconName="search"
|
|
@@ -125,6 +131,7 @@ export const ExtraWithLabel = () => (
|
|
|
125
131
|
<HelpTrigger />
|
|
126
132
|
<HeaderNavigationTrigger
|
|
127
133
|
id="dialpad"
|
|
134
|
+
title="Dialpad"
|
|
128
135
|
iconName="phone"
|
|
129
136
|
hint="Dialpad"
|
|
130
137
|
tag={{ value: 2 }}
|
|
@@ -28,6 +28,7 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
28
28
|
labelClassName,
|
|
29
29
|
tag,
|
|
30
30
|
target,
|
|
31
|
+
title,
|
|
31
32
|
...rest
|
|
32
33
|
}) => {
|
|
33
34
|
const NavigationComponent = useContext(NavigationComponentContext);
|
|
@@ -76,6 +77,7 @@ export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
|
76
77
|
hint,
|
|
77
78
|
tag,
|
|
78
79
|
tooltip,
|
|
80
|
+
title,
|
|
79
81
|
...rest
|
|
80
82
|
}) => {
|
|
81
83
|
return withTooltip(
|
|
@@ -85,6 +85,7 @@ export const WithAllMonolithData = () => (
|
|
|
85
85
|
|
|
86
86
|
<HeaderNavigationLink
|
|
87
87
|
id="search"
|
|
88
|
+
title="Search"
|
|
88
89
|
to="https://google.com"
|
|
89
90
|
target="_blank"
|
|
90
91
|
iconComponent={SearchIcon}
|
|
@@ -95,6 +96,7 @@ export const WithAllMonolithData = () => (
|
|
|
95
96
|
|
|
96
97
|
<HeaderNavigationTrigger
|
|
97
98
|
id="dialpad"
|
|
99
|
+
title="Dialpad"
|
|
98
100
|
iconName="phone"
|
|
99
101
|
tag={{ value: 2 }}
|
|
100
102
|
icon={SvgIcon}
|
|
@@ -103,6 +105,7 @@ export const WithAllMonolithData = () => (
|
|
|
103
105
|
|
|
104
106
|
<HeaderNavigationTrigger
|
|
105
107
|
id="titanAdvisor"
|
|
108
|
+
title="Titan Advisor"
|
|
106
109
|
iconName="rocket"
|
|
107
110
|
iconClassName={Styles.rocketIcon}
|
|
108
111
|
icon={SvgIcon}
|
|
@@ -111,6 +114,7 @@ export const WithAllMonolithData = () => (
|
|
|
111
114
|
|
|
112
115
|
<HeaderNavigationLink
|
|
113
116
|
id="settings"
|
|
117
|
+
title="Settings"
|
|
114
118
|
to="https://google.com"
|
|
115
119
|
target="_blank"
|
|
116
120
|
iconName="settings"
|
|
@@ -64,6 +64,7 @@ const HelpCenterButton = () => {
|
|
|
64
64
|
trigger={
|
|
65
65
|
<HeaderNavigationTrigger
|
|
66
66
|
id="help"
|
|
67
|
+
title="Help"
|
|
67
68
|
iconName="help_outline"
|
|
68
69
|
onClick={() => setOpen(true)}
|
|
69
70
|
icon={SvgIcon}
|
|
@@ -107,6 +108,7 @@ export const WithAllMonolithData = () => (
|
|
|
107
108
|
|
|
108
109
|
<HeaderNavigationTrigger
|
|
109
110
|
id="dialpad"
|
|
111
|
+
title="Dialpad"
|
|
110
112
|
iconName="phone"
|
|
111
113
|
counter={2}
|
|
112
114
|
icon={SvgIcon}
|
|
@@ -115,6 +117,7 @@ export const WithAllMonolithData = () => (
|
|
|
115
117
|
|
|
116
118
|
<HeaderNavigationLink
|
|
117
119
|
id="search"
|
|
120
|
+
title="Search"
|
|
118
121
|
to="https://google.com"
|
|
119
122
|
target="_blank"
|
|
120
123
|
iconComponent={SearchIcon}
|
|
@@ -126,6 +129,7 @@ export const WithAllMonolithData = () => (
|
|
|
126
129
|
<HelpCenterButton />
|
|
127
130
|
<HeaderNavigationTrigger
|
|
128
131
|
id="titanAdvisor"
|
|
132
|
+
title="Titan Advisor"
|
|
129
133
|
iconName="rocket"
|
|
130
134
|
iconClassName={Styles.rocketIcon}
|
|
131
135
|
icon={SvgIcon}
|
|
@@ -134,6 +138,7 @@ export const WithAllMonolithData = () => (
|
|
|
134
138
|
|
|
135
139
|
<HeaderNavigationLink
|
|
136
140
|
id="settings"
|
|
141
|
+
title="Settings"
|
|
137
142
|
to="https://google.com"
|
|
138
143
|
target="_blank"
|
|
139
144
|
iconName="settings"
|
|
@@ -54,6 +54,7 @@ export const WithAllMonolithData = () => (
|
|
|
54
54
|
|
|
55
55
|
<HeaderNavigationLink
|
|
56
56
|
id="search"
|
|
57
|
+
title="Search"
|
|
57
58
|
to="https://google.com"
|
|
58
59
|
target="_blank"
|
|
59
60
|
iconComponent={SearchIcon}
|
|
@@ -67,6 +68,7 @@ export const WithAllMonolithData = () => (
|
|
|
67
68
|
|
|
68
69
|
<HeaderNavigationLink
|
|
69
70
|
id="titanAdvisor"
|
|
71
|
+
title="Titan Advisor"
|
|
70
72
|
to="titanAdvisor"
|
|
71
73
|
iconName="rocket"
|
|
72
74
|
iconClassName={Styles.rocketIcon}
|
|
@@ -76,6 +78,7 @@ export const WithAllMonolithData = () => (
|
|
|
76
78
|
|
|
77
79
|
<HeaderNavigationLink
|
|
78
80
|
id="settings"
|
|
81
|
+
title="Settings"
|
|
79
82
|
to="settings"
|
|
80
83
|
target="_blank"
|
|
81
84
|
iconName="settings"
|
|
@@ -121,6 +124,7 @@ export const WithAllMonolithDataCommercial = () => (
|
|
|
121
124
|
|
|
122
125
|
<HeaderNavigationLink
|
|
123
126
|
id="search"
|
|
127
|
+
title="Search"
|
|
124
128
|
to="https://google.com"
|
|
125
129
|
target="_blank"
|
|
126
130
|
iconComponent={SearchIcon}
|
|
@@ -133,6 +137,7 @@ export const WithAllMonolithDataCommercial = () => (
|
|
|
133
137
|
|
|
134
138
|
<HeaderNavigationLink
|
|
135
139
|
id="titanAdvisor"
|
|
140
|
+
title="Titan Advisor"
|
|
136
141
|
to="titanAdvisor"
|
|
137
142
|
iconName="rocket"
|
|
138
143
|
iconClassName={Styles.rocketIcon}
|
|
@@ -142,6 +147,7 @@ export const WithAllMonolithDataCommercial = () => (
|
|
|
142
147
|
|
|
143
148
|
<HeaderNavigationLink
|
|
144
149
|
id="settings"
|
|
150
|
+
title="Settings"
|
|
145
151
|
to="settings"
|
|
146
152
|
iconName="settings"
|
|
147
153
|
aria-label="search"
|
package/src/components/links.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { FC
|
|
2
|
-
import { NavigationLegacyContext } from '../utils/navigation-context';
|
|
1
|
+
import { FC } from 'react';
|
|
3
2
|
import {
|
|
4
3
|
HeaderNavigationLinkProps,
|
|
5
4
|
HeaderNavigationTriggerProps,
|
|
@@ -8,27 +7,48 @@ import {
|
|
|
8
7
|
HeaderNavigationLink as HeaderNavigationLinkLegacy,
|
|
9
8
|
HeaderNavigationTrigger as HeaderNavigationTriggerLegacy,
|
|
10
9
|
} from './header-navigation/header-navigation-links';
|
|
10
|
+
import { useTitanLayoutPlacementContext } from './titan-layout';
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from './
|
|
12
|
+
LayoutHeaderNavigationLink,
|
|
13
|
+
LayoutHeaderNavigationTrigger,
|
|
14
|
+
} from './titan-layout/layout-header-links';
|
|
15
|
+
import {
|
|
16
|
+
TitanLayoutSidebarLink,
|
|
17
|
+
TitanLayoutSidebarTrigger,
|
|
18
|
+
} from './titan-layout/layout-sidebar-links';
|
|
15
19
|
|
|
16
20
|
export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = props => {
|
|
17
|
-
const
|
|
21
|
+
const placement = useTitanLayoutPlacementContext();
|
|
18
22
|
|
|
19
|
-
return
|
|
20
|
-
<
|
|
23
|
+
return placement === 'top' ? (
|
|
24
|
+
<LayoutHeaderNavigationLink {...props} />
|
|
25
|
+
) : placement === 'side' ? (
|
|
26
|
+
<TitanLayoutSidebarLink
|
|
27
|
+
id={props.id}
|
|
28
|
+
icon={props.icon}
|
|
29
|
+
iconActive={props.iconActive}
|
|
30
|
+
to={props.to}
|
|
31
|
+
title={props.title}
|
|
32
|
+
counter={props.counter}
|
|
33
|
+
/>
|
|
21
34
|
) : (
|
|
22
|
-
<
|
|
35
|
+
<HeaderNavigationLinkLegacy {...props} />
|
|
23
36
|
);
|
|
24
37
|
};
|
|
25
38
|
|
|
26
39
|
export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = props => {
|
|
27
|
-
const
|
|
40
|
+
const placement = useTitanLayoutPlacementContext();
|
|
28
41
|
|
|
29
|
-
return
|
|
30
|
-
<
|
|
42
|
+
return placement === 'top' ? (
|
|
43
|
+
<LayoutHeaderNavigationTrigger {...props} />
|
|
44
|
+
) : placement === 'side' ? (
|
|
45
|
+
<TitanLayoutSidebarTrigger
|
|
46
|
+
id={props.id}
|
|
47
|
+
title={props.title}
|
|
48
|
+
icon={props.icon}
|
|
49
|
+
iconActive={props.iconActive}
|
|
50
|
+
/>
|
|
31
51
|
) : (
|
|
32
|
-
<
|
|
52
|
+
<HeaderNavigationTriggerLegacy {...props} />
|
|
33
53
|
);
|
|
34
54
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
|
|
3
3
|
/* tslint:disable: max-line-length */
|
|
4
|
-
export const LogoCompanyTitle: FC<{
|
|
5
|
-
className
|
|
6
|
-
fill
|
|
7
|
-
size
|
|
8
|
-
|
|
4
|
+
export const LogoCompanyTitle: FC<{
|
|
5
|
+
className?: string;
|
|
6
|
+
fill?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
height?: string | number;
|
|
9
|
+
}> = ({ className, fill = 'currentColor', size = '162', height }) => {
|
|
9
10
|
return (
|
|
10
11
|
<svg
|
|
11
12
|
className={className}
|
|
12
|
-
width={size}
|
|
13
|
+
width={height ? undefined : size}
|
|
14
|
+
height={height}
|
|
13
15
|
viewBox="0 0 322 80"
|
|
14
16
|
xmlns="http://www.w3.org/2000/svg"
|
|
15
17
|
>
|
|
@@ -21,9 +21,9 @@ export const ProfileDropdownDefault = () => (
|
|
|
21
21
|
<ProfileDropdown.Link id="first" to="https://google.com">
|
|
22
22
|
first link
|
|
23
23
|
</ProfileDropdown.Link>
|
|
24
|
-
<ProfileDropdown.
|
|
24
|
+
<ProfileDropdown.Section id="second" onClick={() => alert('second click')}>
|
|
25
25
|
second link
|
|
26
|
-
</ProfileDropdown.
|
|
26
|
+
</ProfileDropdown.Section>
|
|
27
27
|
<ProfileDropdown.Divider />
|
|
28
28
|
<ProfileDropdown.Section id="content">some content</ProfileDropdown.Section>
|
|
29
29
|
<ProfileDropdown.Divider />
|
|
@@ -45,9 +45,9 @@ export const ProfileDropdownWithLogo = () => (
|
|
|
45
45
|
<ProfileDropdown.Link id="first" to="https://google.com">
|
|
46
46
|
first link
|
|
47
47
|
</ProfileDropdown.Link>
|
|
48
|
-
<ProfileDropdown.
|
|
48
|
+
<ProfileDropdown.Section id="second" onClick={() => alert('second click')}>
|
|
49
49
|
second link
|
|
50
|
-
</ProfileDropdown.
|
|
50
|
+
</ProfileDropdown.Section>
|
|
51
51
|
</ProfileDropdown>
|
|
52
52
|
);
|
|
53
53
|
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
} from '../../utils/navigation-context';
|
|
26
26
|
import { getCounterTag } from '../../utils/side-nav';
|
|
27
27
|
import { CounterTag } from '../counter-tag';
|
|
28
|
+
import { withTooltip } from '../titan-layout/with-tooltip';
|
|
28
29
|
import * as Styles from './profile-dropdown.module.less';
|
|
29
30
|
import { ProfileLogo } from './profile-icon';
|
|
30
31
|
|
|
@@ -149,11 +150,12 @@ const ProfileDropdownTrigger: FC<ProfileDropdownTriggerProps> = ({
|
|
|
149
150
|
export interface ProfileDropdownSectionPropsStrict {
|
|
150
151
|
children: ReactNode;
|
|
151
152
|
id: string;
|
|
153
|
+
tooltip?: string;
|
|
152
154
|
className?: string;
|
|
153
155
|
onClick?(e: MouseEvent): void;
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
interface ProfileDropdownSectionProps extends ProfileDropdownSectionPropsStrict {
|
|
158
|
+
export interface ProfileDropdownSectionProps extends ProfileDropdownSectionPropsStrict {
|
|
157
159
|
[key: string]: any;
|
|
158
160
|
}
|
|
159
161
|
|
|
@@ -161,6 +163,7 @@ export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
|
161
163
|
children,
|
|
162
164
|
className,
|
|
163
165
|
id,
|
|
166
|
+
tooltip,
|
|
164
167
|
onClick,
|
|
165
168
|
...rest
|
|
166
169
|
}) => {
|
|
@@ -172,16 +175,20 @@ export const ProfileDropdownSection: FC<ProfileDropdownSectionProps> = ({
|
|
|
172
175
|
}
|
|
173
176
|
};
|
|
174
177
|
|
|
175
|
-
return (
|
|
178
|
+
return withTooltip(
|
|
176
179
|
<div
|
|
177
|
-
className={classNames(Styles.dropdownSection, className
|
|
180
|
+
className={classNames(Styles.dropdownSection, className, {
|
|
181
|
+
'cursor-pointer': !!onClick,
|
|
182
|
+
})}
|
|
178
183
|
onClick={clickHandler}
|
|
179
184
|
data-cy={`profile-dropdown-section-${id}`}
|
|
180
185
|
data-pendo={`profile-dropdown-section-${id}`}
|
|
181
186
|
{...rest}
|
|
182
187
|
>
|
|
183
188
|
{children}
|
|
184
|
-
</div
|
|
189
|
+
</div>,
|
|
190
|
+
tooltip,
|
|
191
|
+
'left'
|
|
185
192
|
);
|
|
186
193
|
};
|
|
187
194
|
|
|
@@ -193,10 +200,10 @@ export interface ProfileDropdownLinkPropsStrict {
|
|
|
193
200
|
className?: string;
|
|
194
201
|
external?: boolean;
|
|
195
202
|
target?: HTMLAttributeAnchorTarget;
|
|
196
|
-
|
|
203
|
+
tooltip?: string;
|
|
204
|
+
to: string;
|
|
197
205
|
tag?: CounterTagData;
|
|
198
206
|
counter?: CounterTagValue;
|
|
199
|
-
onClick?: () => void;
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
export interface ProfileDropdownLinkProps extends ProfileDropdownLinkPropsStrict {
|
|
@@ -212,16 +219,12 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
212
219
|
tag,
|
|
213
220
|
target,
|
|
214
221
|
to,
|
|
222
|
+
tooltip,
|
|
215
223
|
onClick,
|
|
216
224
|
...rest
|
|
217
225
|
}: ProfileDropdownLinkProps) => {
|
|
218
226
|
const NavigationComponent = useContext(NavigationComponentContext);
|
|
219
227
|
|
|
220
|
-
const clickHandler = (e: MouseEvent<any>) => {
|
|
221
|
-
e.preventDefault();
|
|
222
|
-
onClick?.();
|
|
223
|
-
};
|
|
224
|
-
|
|
225
228
|
const isExternalLink = external ?? to?.startsWith('http');
|
|
226
229
|
|
|
227
230
|
const tagElement = useMemo(
|
|
@@ -229,41 +232,34 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
229
232
|
[counter, tag]
|
|
230
233
|
);
|
|
231
234
|
|
|
232
|
-
return
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
data-cy={`profile-dropdown-link-${id}`}
|
|
261
|
-
data-pendo={`profile-dropdown-link-${id}`}
|
|
262
|
-
{...rest}
|
|
263
|
-
>
|
|
264
|
-
{children}
|
|
265
|
-
{tagElement}
|
|
266
|
-
</a>
|
|
235
|
+
return withTooltip(
|
|
236
|
+
isExternalLink ? (
|
|
237
|
+
<a
|
|
238
|
+
className={classNames(Styles.dropdownSection, Styles.dropdownLink, className)}
|
|
239
|
+
href={to}
|
|
240
|
+
target={target}
|
|
241
|
+
data-cy={`profile-dropdown-link-${id}`}
|
|
242
|
+
data-pendo={`profile-dropdown-link-${id}`}
|
|
243
|
+
{...rest}
|
|
244
|
+
>
|
|
245
|
+
{children}
|
|
246
|
+
{tagElement}
|
|
247
|
+
</a>
|
|
248
|
+
) : (
|
|
249
|
+
<NavigationComponent
|
|
250
|
+
className={classNames(Styles.dropdownSection, Styles.dropdownLink, className)}
|
|
251
|
+
target={target}
|
|
252
|
+
to={to}
|
|
253
|
+
data-cy={`profile-dropdown-link-${id}`}
|
|
254
|
+
data-pendo={`profile-dropdown-link-${id}`}
|
|
255
|
+
{...rest}
|
|
256
|
+
>
|
|
257
|
+
{children}
|
|
258
|
+
{tagElement}
|
|
259
|
+
</NavigationComponent>
|
|
260
|
+
),
|
|
261
|
+
tooltip,
|
|
262
|
+
'left'
|
|
267
263
|
);
|
|
268
264
|
};
|
|
269
265
|
|
|
@@ -291,6 +287,7 @@ export interface ProfileDropdownProps extends ProfileDropdownPropsStrict {
|
|
|
291
287
|
export interface ProfileDropdownType extends FC<ProfileDropdownProps> {
|
|
292
288
|
Divider: typeof ProfileDropdownDivider;
|
|
293
289
|
Link: typeof ProfileDropdownLink;
|
|
290
|
+
Trigger: typeof ProfileDropdownTrigger;
|
|
294
291
|
Section: typeof ProfileDropdownSection;
|
|
295
292
|
}
|
|
296
293
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC, ReactElement } from 'react';
|
|
2
|
+
import { NavigationItemData } from '../../utils/navigation';
|
|
3
|
+
import { TitanLayoutSidebarContextType } from './layout-context';
|
|
4
|
+
|
|
5
|
+
export interface TitanLayoutSidebarLinkWrapperProps {
|
|
6
|
+
children:
|
|
7
|
+
| ReactElement<TitanLayoutSidebarLinkProps>
|
|
8
|
+
| ReactElement<TitanLayoutSidebarTriggerProps>;
|
|
9
|
+
context: TitanLayoutSidebarContextType;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface TitanLayoutSidebarLinkProps extends Omit<NavigationItemData, 'submenu'> {
|
|
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
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface TitanLayoutState {
|
|
24
|
+
navCollapsed: boolean;
|
|
25
|
+
submenuExpanded?: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CSSProperties, FC, createContext, useContext } from 'react';
|
|
2
|
+
import { DefaultNavLinkComponent, NavLinkComponentProps } from '../../utils/navigation-context';
|
|
3
|
+
import { TitanBreakpoint } from '../../utils/use-breakpoint';
|
|
4
|
+
|
|
5
|
+
export interface TitanLayoutSidebarContextType {
|
|
6
|
+
styles: {
|
|
7
|
+
popoverContent: CSSProperties;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type TitanLayoutPlacement = 'top' | 'side' | 'unset';
|
|
12
|
+
|
|
13
|
+
export interface TitanLayoutContextType {
|
|
14
|
+
NavigationComponent: FC<NavLinkComponentProps>;
|
|
15
|
+
breakpoint: TitanBreakpoint;
|
|
16
|
+
isTitanLayout: boolean;
|
|
17
|
+
sidebar: TitanLayoutSidebarContextType;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const LayoutContext = createContext<TitanLayoutContextType>({
|
|
21
|
+
NavigationComponent: DefaultNavLinkComponent,
|
|
22
|
+
breakpoint: { name: 'lg', isMobile: false },
|
|
23
|
+
isTitanLayout: false,
|
|
24
|
+
sidebar: { styles: { popoverContent: {} } },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const useTitanLayoutContext = () => useContext(LayoutContext);
|
|
28
|
+
|
|
29
|
+
export const LayoutPlacementContext = createContext<TitanLayoutPlacement | undefined>(undefined);
|
|
30
|
+
export const useTitanLayoutPlacementContext = () => useContext(LayoutPlacementContext);
|