@servicetitan/navigation 10.6.1 → 11.0.0-canary.237.0c461af.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/header-navigation/header-navigation-extra.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.js +5 -5
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.js +2 -2
- package/dist/components/header-navigation/header-navigation-links.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js +2 -2
- package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
- package/dist/components/header-navigation/with-tooltip.d.ts +1 -1
- package/dist/components/header-navigation/with-tooltip.d.ts.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny.stories.js +2 -2
- package/dist/components/left-navigation/header-navigation-tiny.stories.js.map +1 -1
- package/dist/components/left-navigation/interface.d.ts +1 -1
- package/dist/components/left-navigation/interface.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts +3 -1
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation-links-internal.js +3 -3
- package/dist/components/left-navigation/side-navigation-links-internal.js.map +1 -1
- package/dist/components/left-navigation/side-navigation.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation.js +8 -7
- package/dist/components/left-navigation/side-navigation.js.map +1 -1
- package/dist/components/left-navigation/side-navigation.module.less +21 -19
- package/dist/components/links.d.ts.map +1 -1
- package/dist/components/links.js +7 -7
- package/dist/components/links.js.map +1 -1
- package/dist/components/logo/logo-company-title.d.ts +1 -0
- package/dist/components/logo/logo-company-title.d.ts.map +1 -1
- package/dist/components/logo/logo-company-title.js +2 -2
- package/dist/components/logo/logo-company-title.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +15 -9
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +7 -8
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +4 -0
- package/dist/components/profile-dropdown/profile-dropdown.stories.js +2 -2
- package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +1 -1
- package/dist/components/titan-layout/index.d.ts +6 -0
- package/dist/components/titan-layout/index.d.ts.map +1 -0
- package/dist/components/titan-layout/index.js +6 -0
- package/dist/components/titan-layout/index.js.map +1 -0
- package/dist/components/titan-layout/interface-internal.d.ts +6 -0
- package/dist/components/titan-layout/interface-internal.d.ts.map +1 -0
- package/dist/components/titan-layout/interface-internal.js +2 -0
- package/dist/components/titan-layout/interface-internal.js.map +1 -0
- package/dist/components/titan-layout/interface.d.ts +21 -0
- package/dist/components/titan-layout/interface.d.ts.map +1 -0
- package/dist/components/titan-layout/interface.js +2 -0
- package/dist/components/titan-layout/interface.js.map +1 -0
- package/dist/components/titan-layout/layout-context.d.ts +20 -0
- package/dist/components/titan-layout/layout-context.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-context.js +12 -0
- package/dist/components/titan-layout/layout-context.js.map +1 -0
- package/dist/components/titan-layout/layout-header-links.d.ts +7 -0
- package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-header-links.js +32 -0
- package/dist/components/titan-layout/layout-header-links.js.map +1 -0
- package/dist/components/titan-layout/layout-header.d.ts +20 -0
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-header.js +11 -0
- package/dist/components/titan-layout/layout-header.js.map +1 -0
- package/dist/components/titan-layout/layout-header.module.less +174 -0
- package/dist/components/titan-layout/layout-logo.d.ts +12 -0
- package/dist/components/titan-layout/layout-logo.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-logo.js +15 -0
- package/dist/components/titan-layout/layout-logo.js.map +1 -0
- package/dist/components/titan-layout/layout-logo.stories.d.ts +13 -0
- package/dist/components/titan-layout/layout-logo.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-logo.stories.js +17 -0
- package/dist/components/titan-layout/layout-logo.stories.js.map +1 -0
- package/dist/components/titan-layout/layout-profile.d.ts +9 -0
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-profile.js +54 -0
- package/dist/components/titan-layout/layout-profile.js.map +1 -0
- package/dist/components/titan-layout/layout-profile.stories.d.ts +13 -0
- package/dist/components/titan-layout/layout-profile.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-profile.stories.js +13 -0
- package/dist/components/titan-layout/layout-profile.stories.js.map +1 -0
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +46 -0
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +61 -0
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -0
- package/dist/components/titan-layout/layout-sidebar-links.d.ts +6 -0
- package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-sidebar-links.js +21 -0
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -0
- package/dist/components/titan-layout/layout-sidebar.d.ts +17 -0
- package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -0
- package/dist/components/titan-layout/layout-sidebar.js +65 -0
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -0
- package/dist/components/titan-layout/layout-sidebar.module.less +516 -0
- package/dist/components/titan-layout/titan-layout.d.ts +38 -0
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout.js +147 -0
- package/dist/components/titan-layout/titan-layout.js.map +1 -0
- package/dist/components/titan-layout/titan-layout.module.less +103 -0
- package/dist/components/titan-layout/titan-layout.stories.d.ts +20 -0
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout.stories.js +80 -0
- package/dist/components/titan-layout/titan-layout.stories.js.map +1 -0
- package/dist/components/titan-layout/with-tooltip.d.ts +4 -0
- package/dist/components/titan-layout/with-tooltip.d.ts.map +1 -0
- package/dist/components/titan-layout/with-tooltip.js +4 -0
- package/dist/components/titan-layout/with-tooltip.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +3 -3
- package/dist/test/data.js.map +1 -1
- package/dist/utils/navigation-legacy.d.ts +3 -1
- package/dist/utils/navigation-legacy.d.ts.map +1 -1
- package/dist/utils/use-breakpoint.d.ts +7 -0
- package/dist/utils/use-breakpoint.d.ts.map +1 -0
- package/dist/utils/use-breakpoint.js +13 -0
- package/dist/utils/use-breakpoint.js.map +1 -0
- package/package.json +5 -6
- 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 +5 -1
- package/src/components/header-navigation/header-navigation.stories.tsx +6 -1
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +8 -2
- package/src/components/left-navigation/interface.ts +2 -2
- package/src/components/left-navigation/side-navigation-links-internal.tsx +21 -6
- package/src/components/left-navigation/side-navigation-links.tsx +1 -1
- package/src/components/left-navigation/side-navigation.module.less +21 -19
- package/src/components/left-navigation/side-navigation.module.less.d.ts +2 -1
- package/src/components/left-navigation/side-navigation.tsx +15 -8
- 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 +55 -51
- 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/src/components/titan-layout/layout-header.module.less +174 -0
- package/src/components/titan-layout/layout-header.module.less.d.ts +16 -0
- package/src/components/titan-layout/layout-header.tsx +90 -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 +46 -0
- package/src/components/titan-layout/layout-profile.tsx +132 -0
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +275 -0
- package/src/components/titan-layout/layout-sidebar-links.tsx +59 -0
- package/src/components/titan-layout/layout-sidebar.module.less +516 -0
- package/src/components/titan-layout/layout-sidebar.module.less.d.ts +48 -0
- package/src/components/titan-layout/layout-sidebar.tsx +295 -0
- package/src/components/titan-layout/titan-layout.module.less +103 -0
- package/src/components/titan-layout/titan-layout.module.less.d.ts +15 -0
- package/src/components/titan-layout/titan-layout.stories.tsx +332 -0
- package/src/components/titan-layout/titan-layout.tsx +365 -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/navigation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-canary.237.0c461af.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,12 +26,11 @@
|
|
|
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
|
-
"@servicetitan/react-ioc": "^30.
|
|
31
|
+
"@servicetitan/react-ioc": "^30.3.1",
|
|
32
32
|
"@servicetitan/tokens": ">=12.1.11",
|
|
33
33
|
"@testing-library/react": "^16.2.0",
|
|
34
|
-
"@types/react": "~18.2.55",
|
|
35
34
|
"mobx": "~6.10.2",
|
|
36
35
|
"mobx-react": "~9.0.2",
|
|
37
36
|
"react": "~18.2.0"
|
|
@@ -43,5 +42,5 @@
|
|
|
43
42
|
"less": true,
|
|
44
43
|
"webpack": false
|
|
45
44
|
},
|
|
46
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "0c461af2db0a2263b60cdaaf440cee693e3d4097"
|
|
47
46
|
}
|
|
@@ -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"
|
|
@@ -126,7 +130,7 @@ export const WithAllMonolithData = () => (
|
|
|
126
130
|
Task Management
|
|
127
131
|
</ProfileDropdown.Link>
|
|
128
132
|
<ProfileDropdown.Divider />
|
|
129
|
-
<ProfileDropdown.Link id="sign-out" to="https://googgle.com">
|
|
133
|
+
<ProfileDropdown.Link id="sign-out" to="https://googgle.com" text="Sign Out">
|
|
130
134
|
Sign Out{' '}
|
|
131
135
|
<span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
132
136
|
</ProfileDropdown.Link>
|
|
@@ -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"
|
|
@@ -149,7 +154,7 @@ export const WithAllMonolithData = () => (
|
|
|
149
154
|
Task Management
|
|
150
155
|
</ProfileDropdown.Link>
|
|
151
156
|
<ProfileDropdown.Divider />
|
|
152
|
-
<ProfileDropdown.Link id="sign-out" to="https://googgle.com">
|
|
157
|
+
<ProfileDropdown.Link id="sign-out" to="https://googgle.com" text="Sign Out">
|
|
153
158
|
Sign Out <span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
154
159
|
</ProfileDropdown.Link>
|
|
155
160
|
<ProfileDropdown.Section id="userid" className="c-neutral-100 fs-1">
|
|
@@ -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"
|
|
@@ -90,7 +93,7 @@ export const WithAllMonolithData = () => (
|
|
|
90
93
|
Task Management
|
|
91
94
|
</ProfileDropdown.Link>
|
|
92
95
|
<ProfileDropdown.Divider />
|
|
93
|
-
<ProfileDropdown.Link id="sign-out" to="https://googgle.com">
|
|
96
|
+
<ProfileDropdown.Link id="sign-out" to="https://googgle.com" text="Sign Out">
|
|
94
97
|
Sign Out{' '}
|
|
95
98
|
<span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
96
99
|
</ProfileDropdown.Link>
|
|
@@ -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"
|
|
@@ -156,7 +162,7 @@ export const WithAllMonolithDataCommercial = () => (
|
|
|
156
162
|
Task Management
|
|
157
163
|
</ProfileDropdown.Link>
|
|
158
164
|
<ProfileDropdown.Divider />
|
|
159
|
-
<ProfileDropdown.Link id="sign-out" to="https://googgle.com">
|
|
165
|
+
<ProfileDropdown.Link id="sign-out" to="https://googgle.com" text="Sign Out">
|
|
160
166
|
Sign Out{' '}
|
|
161
167
|
<span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
162
168
|
</ProfileDropdown.Link>
|
|
@@ -5,8 +5,8 @@ import { SideNavigationContextType } from './side-navigation-context';
|
|
|
5
5
|
export interface SideNavigationExpandedState {
|
|
6
6
|
// expanded bar (classic)
|
|
7
7
|
bar: boolean;
|
|
8
|
-
//
|
|
9
|
-
|
|
8
|
+
// expanded submenu item (classic)
|
|
9
|
+
expandedSubmenu?: string;
|
|
10
10
|
// collapsed bar (experimental submenu bar)
|
|
11
11
|
collapsedBar?: boolean;
|
|
12
12
|
}
|
|
@@ -3,7 +3,7 @@ import SvgGroupCollapse from '@servicetitan/anvil2/assets/icons/material/round/e
|
|
|
3
3
|
import SvgGroupExpand from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';
|
|
4
4
|
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
-
import { FC, Fragment } from 'react';
|
|
6
|
+
import { FC, Fragment, MouseEvent } from 'react';
|
|
7
7
|
import { NavigationItemData } from '../../utils/navigation';
|
|
8
8
|
import { BadgeTag, BadgeTagProps } from '../badge-tag';
|
|
9
9
|
import { SideNavigationTriggerProps } from './interface';
|
|
@@ -14,6 +14,7 @@ export interface InternalSideNavigationItemContentProps
|
|
|
14
14
|
extends Omit<NavigationItemData, 'iconName' | 'to' | 'counter' | 'tag'> {
|
|
15
15
|
submenuExpanded: boolean | undefined;
|
|
16
16
|
tag: BadgeTagProps | undefined;
|
|
17
|
+
onExpandToggle?: (e: MouseEvent<never>) => void;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export const InternalSideNavigationItemContent: FC<InternalSideNavigationItemContentProps> = ({
|
|
@@ -24,6 +25,7 @@ export const InternalSideNavigationItemContent: FC<InternalSideNavigationItemCon
|
|
|
24
25
|
tag,
|
|
25
26
|
title,
|
|
26
27
|
submenuExpanded,
|
|
28
|
+
onExpandToggle,
|
|
27
29
|
}) => (
|
|
28
30
|
<Fragment>
|
|
29
31
|
<div className={Styles.navigationItemIconWrapper}>
|
|
@@ -65,10 +67,17 @@ export const InternalSideNavigationItemContent: FC<InternalSideNavigationItemCon
|
|
|
65
67
|
/>
|
|
66
68
|
)}
|
|
67
69
|
{typeof submenuExpanded === 'boolean' && (
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
<div className={Styles.navigationItemGroupToggleWrapper}>
|
|
71
|
+
<Icon
|
|
72
|
+
svg={submenuExpanded ? SvgGroupCollapse : SvgGroupExpand}
|
|
73
|
+
className={Styles.navigationItemGroupToggle}
|
|
74
|
+
onClick={onExpandToggle}
|
|
75
|
+
/>
|
|
76
|
+
<div
|
|
77
|
+
className={Styles.navigationItemGroupToggleClick}
|
|
78
|
+
onClick={onExpandToggle}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
72
81
|
)}
|
|
73
82
|
</div>
|
|
74
83
|
|
|
@@ -89,6 +98,7 @@ export interface InternalSideNavigationLinkProps
|
|
|
89
98
|
submenuExpanded: boolean | undefined;
|
|
90
99
|
dataPrefix?: string;
|
|
91
100
|
tag: BadgeTagProps | undefined;
|
|
101
|
+
onExpandToggle?: (e: MouseEvent<never>) => void;
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
export const internalNavigationContentContainerProps = ({
|
|
@@ -116,6 +126,7 @@ export const InternalSideNavigationLink: FC<InternalSideNavigationLinkProps> = (
|
|
|
116
126
|
isActive,
|
|
117
127
|
navigationComponent: NavigationComponent,
|
|
118
128
|
submenuExpanded,
|
|
129
|
+
onExpandToggle,
|
|
119
130
|
...props
|
|
120
131
|
}) => {
|
|
121
132
|
return (
|
|
@@ -130,7 +141,11 @@ export const InternalSideNavigationLink: FC<InternalSideNavigationLinkProps> = (
|
|
|
130
141
|
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
131
142
|
activeClassName={Styles.navigationItemActive}
|
|
132
143
|
>
|
|
133
|
-
<InternalSideNavigationItemContent
|
|
144
|
+
<InternalSideNavigationItemContent
|
|
145
|
+
submenuExpanded={submenuExpanded}
|
|
146
|
+
onExpandToggle={onExpandToggle}
|
|
147
|
+
{...props}
|
|
148
|
+
/>
|
|
134
149
|
</NavigationComponent>
|
|
135
150
|
);
|
|
136
151
|
};
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from './side-navigation-links-internal';
|
|
12
12
|
|
|
13
13
|
const WrappedLink: FC<{
|
|
14
|
-
children: ReactElement
|
|
14
|
+
children: ReactElement<any>;
|
|
15
15
|
wrapper: NonNullable<SideNavigationLinkProps['wrapper']>;
|
|
16
16
|
}> = ({ children, wrapper: WrapperComponent }) => {
|
|
17
17
|
return (
|
|
@@ -246,9 +246,24 @@
|
|
|
246
246
|
min-height: 12px !important;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
.navigation-item-group-toggle
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
.navigation-item-group-toggle-wrapper {
|
|
250
|
+
position: relative;
|
|
251
|
+
display: flex;
|
|
252
|
+
justify-content: center;
|
|
253
|
+
align-items: center;
|
|
254
|
+
|
|
255
|
+
.navigation-item-group-toggle[data-anv][data-anv] {
|
|
256
|
+
color: inherit;
|
|
257
|
+
font-weight: @font-weight-semibold;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.navigation-item-group-toggle-click {
|
|
261
|
+
position: absolute;
|
|
262
|
+
left: -@spacing-2;
|
|
263
|
+
right: -@spacing-half;
|
|
264
|
+
top: -@spacing-1;
|
|
265
|
+
bottom: -@spacing-1;
|
|
266
|
+
}
|
|
252
267
|
}
|
|
253
268
|
|
|
254
269
|
.navigation-icon[data-anv][data-anv] {
|
|
@@ -266,24 +281,11 @@
|
|
|
266
281
|
.navigation-group-wrapper {
|
|
267
282
|
.navigation-group-item {
|
|
268
283
|
position: relative;
|
|
269
|
-
|
|
270
|
-
.navigation-group-item-collapse {
|
|
271
|
-
display: none;
|
|
272
|
-
position: absolute;
|
|
273
|
-
inset: 0;
|
|
274
|
-
cursor: pointer;
|
|
275
|
-
}
|
|
276
284
|
}
|
|
277
285
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.submenu-wrapper:not(.submenu-wrapper-collapsed) {
|
|
284
|
-
max-height: 2000px;
|
|
285
|
-
transition: max-height 0.7s ease-in-out;
|
|
286
|
-
}
|
|
286
|
+
.submenu-wrapper:not(.submenu-wrapper-collapsed) {
|
|
287
|
+
max-height: 2000px;
|
|
288
|
+
transition: max-height 0.7s ease-in-out;
|
|
287
289
|
}
|
|
288
290
|
}
|
|
289
291
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export const __esModule: true;
|
|
2
2
|
export const divider: string;
|
|
3
3
|
export const navigationGroupItem: string;
|
|
4
|
-
export const navigationGroupItemCollapse: string;
|
|
5
4
|
export const navigationGroupWrapper: string;
|
|
6
5
|
export const navigationIcon: string;
|
|
7
6
|
export const navigationIconActive: string;
|
|
@@ -11,6 +10,8 @@ export const navigationItemActive: string;
|
|
|
11
10
|
export const navigationItemCounter: string;
|
|
12
11
|
export const navigationItemCounterLong: string;
|
|
13
12
|
export const navigationItemGroupToggle: string;
|
|
13
|
+
export const navigationItemGroupToggleClick: string;
|
|
14
|
+
export const navigationItemGroupToggleWrapper: string;
|
|
14
15
|
export const navigationItemIconSwitch: string;
|
|
15
16
|
export const navigationItemIconWrapper: string;
|
|
16
17
|
export const navigationItemTextCollapsed: string;
|
|
@@ -371,13 +371,20 @@ const SideNavigationGroupItem: FC<
|
|
|
371
371
|
onExpandedChange: undefined | ((expanded: SideNavigationExpandedState) => void);
|
|
372
372
|
}
|
|
373
373
|
> = ({ onExpandedChange, isGroupActive, ...props }) => {
|
|
374
|
-
const isSubmenuExpanded = !!props.id &&
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
374
|
+
const isSubmenuExpanded = !!props.id && props.expanded?.expandedSubmenu === props.id;
|
|
375
|
+
const onExpandToggle = useCallback(
|
|
376
|
+
(e: MouseEvent<never>) => {
|
|
377
|
+
e.preventDefault();
|
|
378
|
+
e.stopPropagation();
|
|
379
|
+
|
|
380
|
+
onExpandedChange?.({
|
|
381
|
+
bar: true,
|
|
382
|
+
expandedSubmenu: isSubmenuExpanded ? undefined : props.id,
|
|
383
|
+
});
|
|
384
|
+
},
|
|
385
|
+
[props.id, isSubmenuExpanded, onExpandedChange]
|
|
386
|
+
);
|
|
387
|
+
|
|
381
388
|
const tag = getSubmenuGroupTag(props.submenu, getCounterTag(props.counter, props.tag));
|
|
382
389
|
const context = useContext(SideNavigationContext);
|
|
383
390
|
|
|
@@ -387,9 +394,9 @@ const SideNavigationGroupItem: FC<
|
|
|
387
394
|
<InternalSideNavigationLink
|
|
388
395
|
{...props}
|
|
389
396
|
submenuExpanded={isSubmenuExpanded}
|
|
397
|
+
onExpandToggle={onExpandToggle}
|
|
390
398
|
tag={tag}
|
|
391
399
|
/>
|
|
392
|
-
<div className={Styles.navigationGroupItemCollapse} onClick={triggerClick} />
|
|
393
400
|
</div>
|
|
394
401
|
<div
|
|
395
402
|
className={classNames(Styles.submenuWrapper, {
|
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
|
|