@servicetitan/navigation 13.0.0-canary.256.b43c6d7.0 → 13.0.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 +3 -0
- package/dist/components/profile-dropdown/interface.js.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts +5 -1
- package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts.map +1 -1
- 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 +17 -14
- 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 +60 -4
- 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 +24 -12
- 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 +2 -3
- 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 -0
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header.js +25 -16
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +37 -1
- package/dist/components/titan-layout/layout-header.module.less.d.ts +3 -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 +29 -21
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +48 -24
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +62 -51
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.d.ts +2 -2
- package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js +27 -14
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +81 -104
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.module.less +74 -22
- 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-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 +28 -1
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +30 -11
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/test/data.d.ts +0 -22
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +0 -197
- 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.d.ts +1 -4
- package/dist/utils/navigation.d.ts.map +1 -1
- package/dist/utils/navigation.js.map +1 -1
- package/package.json +4 -4
- 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 +3 -3
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +3 -3
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +39 -39
- package/src/components/profile-dropdown/profile-dropdown.tsx +37 -104
- package/src/components/titan-layout/interface-internal.ts +13 -0
- package/src/components/titan-layout/interface.ts +64 -7
- package/src/components/titan-layout/layout-header-dark.tsx +21 -5
- package/src/components/titan-layout/layout-header-links-internal.tsx +41 -54
- package/src/components/titan-layout/layout-header-links.tsx +64 -8
- package/src/components/titan-layout/layout-header.module.less +37 -1
- package/src/components/titan-layout/layout-header.module.less.d.ts +3 -0
- package/src/components/titan-layout/layout-header.tsx +26 -13
- package/src/components/titan-layout/layout-profile.tsx +51 -28
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +155 -102
- package/src/components/titan-layout/layout-sidebar-links.tsx +45 -12
- package/src/components/titan-layout/layout-sidebar.module.less +74 -22
- package/src/components/titan-layout/layout-sidebar.tsx +55 -80
- package/src/components/titan-layout/{titan-layout.stories.tsx → titan-layout-default.stories.tsx} +100 -84
- package/src/components/titan-layout/titan-layout-legacy.stories.tsx +24 -0
- package/src/components/titan-layout/titan-layout-stacked.stories.tsx +30 -0
- package/src/components/titan-layout/titan-layout.tsx +67 -12
- package/src/index.ts +0 -1
- package/src/test/data.tsx +0 -165
- package/src/test/titan-layout.tsx +34 -0
- package/src/utils/navigation.ts +1 -6
- 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/utils/navigation-legacy.ts +0 -106
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import { Icon } from '@servicetitan/anvil2';
|
|
1
|
+
import { Button, Icon, IconProps } from '@servicetitan/anvil2';
|
|
2
2
|
import SvgGroupCollapse from '@servicetitan/anvil2/assets/icons/material/round/expand_less.svg';
|
|
3
3
|
import SvgGroupExpand from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';
|
|
4
|
-
|
|
5
4
|
import classNames from 'classnames';
|
|
6
|
-
import { FC, Fragment, MouseEvent, ReactNode } from 'react';
|
|
7
|
-
|
|
8
|
-
import { getCounterTag } from '../../utils/side-nav';
|
|
5
|
+
import { ComponentPropsWithoutRef, FC, Fragment, MouseEvent, ReactNode } from 'react';
|
|
6
|
+
|
|
9
7
|
import { BadgeTag, BadgeTagProps } from '../badge-tag';
|
|
10
|
-
import { TitanLayoutLinkProps, TitanLayoutTriggerProps } from './interface';
|
|
11
8
|
import { NavigationComponentProps } from './interface-internal';
|
|
12
9
|
import * as Styles from './layout-sidebar.module.less';
|
|
10
|
+
import { withTooltip } from './with-tooltip';
|
|
13
11
|
|
|
14
12
|
export interface InternalSideNavigationItemContentProps {
|
|
15
|
-
icon:
|
|
16
|
-
iconActive:
|
|
17
|
-
title:
|
|
18
|
-
submenuExpanded: boolean | undefined;
|
|
13
|
+
icon: IconProps['svg'] | undefined;
|
|
14
|
+
iconActive: IconProps['svg'] | undefined;
|
|
15
|
+
title: string;
|
|
19
16
|
tag: BadgeTagProps | undefined;
|
|
20
|
-
onExpandToggle?: (e: MouseEvent<never>) => void;
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
const InternalSideNavigationItemContent: FC<InternalSideNavigationItemContentProps> = ({
|
|
@@ -25,8 +21,6 @@ const InternalSideNavigationItemContent: FC<InternalSideNavigationItemContentPro
|
|
|
25
21
|
iconActive,
|
|
26
22
|
tag,
|
|
27
23
|
title,
|
|
28
|
-
submenuExpanded,
|
|
29
|
-
onExpandToggle,
|
|
30
24
|
}) => (
|
|
31
25
|
<Fragment>
|
|
32
26
|
<div className={Styles.navItemIconWrapper}>
|
|
@@ -50,20 +44,6 @@ const InternalSideNavigationItemContent: FC<InternalSideNavigationItemContentPro
|
|
|
50
44
|
longClassName={Styles.navItemCounterLong}
|
|
51
45
|
/>
|
|
52
46
|
)}
|
|
53
|
-
{typeof submenuExpanded === 'boolean' && (
|
|
54
|
-
<div className={Styles.navItemGroupToggleWrapper}>
|
|
55
|
-
<Icon
|
|
56
|
-
svg={submenuExpanded ? SvgGroupCollapse : SvgGroupExpand}
|
|
57
|
-
className={Styles.navItemGroupToggle}
|
|
58
|
-
onClick={onExpandToggle}
|
|
59
|
-
/>
|
|
60
|
-
<div
|
|
61
|
-
className={Styles.navItemGroupToggleClick}
|
|
62
|
-
data-cy="nav-item-group-expand"
|
|
63
|
-
onClick={onExpandToggle}
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
)}
|
|
67
47
|
</div>
|
|
68
48
|
|
|
69
49
|
<div
|
|
@@ -76,39 +56,37 @@ const InternalSideNavigationItemContent: FC<InternalSideNavigationItemContentPro
|
|
|
76
56
|
</div>
|
|
77
57
|
</Fragment>
|
|
78
58
|
);
|
|
79
|
-
interface InternalLinkProps {
|
|
80
|
-
submenuExpanded: boolean | undefined;
|
|
81
|
-
tag: BadgeTagProps | undefined;
|
|
82
|
-
onExpandToggle?: (e: MouseEvent<never>) => void;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export type InternalSideNavigationLinkProps = Omit<
|
|
86
|
-
TitanLayoutLinkProps,
|
|
87
|
-
'wrapper' | 'counter' | 'tag'
|
|
88
|
-
> &
|
|
89
|
-
NavigationComponentProps &
|
|
90
|
-
InternalLinkProps;
|
|
91
59
|
|
|
92
60
|
/** Side Navigation menu item (for internal usage) */
|
|
93
|
-
export const InternalSideNavigationLink: FC<
|
|
61
|
+
export const InternalSideNavigationLink: FC<
|
|
62
|
+
NavigationComponentProps & {
|
|
63
|
+
id: string;
|
|
64
|
+
to: string;
|
|
65
|
+
title: string;
|
|
66
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
67
|
+
icon: IconProps['svg'] | undefined;
|
|
68
|
+
iconActive: IconProps['svg'] | undefined;
|
|
69
|
+
className: string | undefined;
|
|
70
|
+
tag: BadgeTagProps | undefined;
|
|
71
|
+
} & Omit<ComponentPropsWithoutRef<'a'>, 'children' | 'title'>
|
|
72
|
+
> = ({
|
|
94
73
|
id,
|
|
95
74
|
to,
|
|
96
|
-
|
|
75
|
+
title,
|
|
76
|
+
isActive,
|
|
97
77
|
icon,
|
|
98
78
|
iconActive,
|
|
99
|
-
|
|
100
|
-
navigationComponent: NavigationComponent,
|
|
79
|
+
className,
|
|
101
80
|
tag,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
...props
|
|
81
|
+
|
|
82
|
+
navigationComponent: NavigationComponent,
|
|
83
|
+
...rest
|
|
106
84
|
}) => {
|
|
107
85
|
return (
|
|
108
86
|
<NavigationComponent
|
|
109
87
|
data-cy={`navigation-item-${id}`}
|
|
110
88
|
data-pendo={`navigation-item-${id}`}
|
|
111
|
-
{...
|
|
89
|
+
{...rest}
|
|
112
90
|
className={classNames(Styles.navItem, Styles.navLink, className, {
|
|
113
91
|
[Styles.navItemActive]: isActive === true,
|
|
114
92
|
[Styles.navItemIconSwitch]: !!icon && !!iconActive,
|
|
@@ -120,8 +98,6 @@ export const InternalSideNavigationLink: FC<InternalSideNavigationLinkProps> = (
|
|
|
120
98
|
<InternalSideNavigationItemContent
|
|
121
99
|
icon={icon}
|
|
122
100
|
iconActive={iconActive}
|
|
123
|
-
submenuExpanded={submenuExpanded}
|
|
124
|
-
onExpandToggle={onExpandToggle}
|
|
125
101
|
title={title}
|
|
126
102
|
tag={tag}
|
|
127
103
|
/>
|
|
@@ -129,41 +105,42 @@ export const InternalSideNavigationLink: FC<InternalSideNavigationLinkProps> = (
|
|
|
129
105
|
);
|
|
130
106
|
};
|
|
131
107
|
|
|
132
|
-
export type InternalSideNavigationTriggerProps = Omit<
|
|
133
|
-
TitanLayoutTriggerProps,
|
|
134
|
-
'wrapper' | 'counter' | 'tag'
|
|
135
|
-
> &
|
|
136
|
-
InternalLinkProps;
|
|
137
|
-
|
|
138
108
|
/** Side Navigation menu trigger (for internal usage) */
|
|
139
|
-
export const InternalSideNavigationTrigger: FC<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
109
|
+
export const InternalSideNavigationTrigger: FC<
|
|
110
|
+
{
|
|
111
|
+
id: string;
|
|
112
|
+
title: string;
|
|
113
|
+
isActive: boolean | undefined;
|
|
114
|
+
icon: IconProps['svg'] | undefined;
|
|
115
|
+
iconActive: IconProps['svg'] | undefined;
|
|
116
|
+
className: string | undefined;
|
|
117
|
+
|
|
118
|
+
tag: BadgeTagProps | undefined;
|
|
119
|
+
onClick?: (e: MouseEvent<never>) => void;
|
|
120
|
+
} & Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'title'>
|
|
121
|
+
> = ({
|
|
143
122
|
id,
|
|
144
|
-
isActive,
|
|
145
|
-
submenuExpanded,
|
|
146
|
-
onExpandToggle,
|
|
147
|
-
onClick,
|
|
148
123
|
title,
|
|
124
|
+
isActive,
|
|
125
|
+
icon,
|
|
126
|
+
iconActive,
|
|
127
|
+
className,
|
|
128
|
+
|
|
149
129
|
tag,
|
|
150
|
-
...
|
|
130
|
+
...rest
|
|
151
131
|
}) => {
|
|
152
132
|
return (
|
|
153
133
|
<div
|
|
154
134
|
data-cy={`navigation-item-${id}`}
|
|
155
135
|
data-pendo={`navigation-item-${id}`}
|
|
156
|
-
{...
|
|
136
|
+
{...rest}
|
|
157
137
|
className={classNames(Styles.navItem, className, {
|
|
158
|
-
[Styles.navLink]: !!onClick,
|
|
138
|
+
[Styles.navLink]: !!rest.onClick,
|
|
159
139
|
[Styles.navItemActive]: isActive === true,
|
|
160
140
|
[Styles.navItemIconSwitch]: !!icon && !!iconActive,
|
|
161
141
|
})}
|
|
162
|
-
onClick={onClick}
|
|
163
142
|
>
|
|
164
143
|
<InternalSideNavigationItemContent
|
|
165
|
-
submenuExpanded={submenuExpanded}
|
|
166
|
-
onExpandToggle={onExpandToggle}
|
|
167
144
|
icon={icon}
|
|
168
145
|
iconActive={iconActive}
|
|
169
146
|
title={title}
|
|
@@ -174,15 +151,25 @@ export const InternalSideNavigationTrigger: FC<InternalSideNavigationTriggerProp
|
|
|
174
151
|
};
|
|
175
152
|
|
|
176
153
|
export const InternalSideNavigationGroupLink: FC<
|
|
177
|
-
|
|
154
|
+
NavigationComponentProps & {
|
|
155
|
+
id: string;
|
|
156
|
+
to: string;
|
|
157
|
+
title: string;
|
|
158
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
159
|
+
className: string | undefined;
|
|
160
|
+
tag: BadgeTagProps | undefined;
|
|
161
|
+
|
|
162
|
+
parentId: string;
|
|
163
|
+
}
|
|
178
164
|
> = ({
|
|
179
165
|
id,
|
|
180
|
-
counter,
|
|
181
|
-
parentId,
|
|
182
|
-
tag,
|
|
183
|
-
title,
|
|
184
166
|
to,
|
|
167
|
+
title,
|
|
185
168
|
isActive,
|
|
169
|
+
className,
|
|
170
|
+
tag,
|
|
171
|
+
|
|
172
|
+
parentId,
|
|
186
173
|
navigationComponent: NavigationComponent,
|
|
187
174
|
...rest
|
|
188
175
|
}) => {
|
|
@@ -193,21 +180,35 @@ export const InternalSideNavigationGroupLink: FC<
|
|
|
193
180
|
data-pendo={`navigation-item-${parentId}--${id}`}
|
|
194
181
|
{...rest}
|
|
195
182
|
to={to}
|
|
196
|
-
className={classNames(Styles.submenuItem, Styles.submenuLink, {
|
|
183
|
+
className={classNames(Styles.submenuItem, Styles.submenuLink, className, {
|
|
197
184
|
[Styles.submenuLinkActive]: isActive === true,
|
|
198
185
|
})}
|
|
199
186
|
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
200
187
|
activeClassName={Styles.submenuLinkActive}
|
|
201
188
|
>
|
|
202
189
|
<span>{title}</span>
|
|
203
|
-
<BadgeTag data={
|
|
190
|
+
<BadgeTag data={tag} className={Styles.submenuLinkCounter} />
|
|
204
191
|
</NavigationComponent>
|
|
205
192
|
);
|
|
206
193
|
};
|
|
207
194
|
|
|
208
|
-
export const InternalSideNavigationGroupTrigger: FC<
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
export const InternalSideNavigationGroupTrigger: FC<{
|
|
196
|
+
id: string;
|
|
197
|
+
title: string;
|
|
198
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
199
|
+
className: string | undefined;
|
|
200
|
+
tag: BadgeTagProps | undefined;
|
|
201
|
+
|
|
202
|
+
onClick?: (e: MouseEvent<any>) => void;
|
|
203
|
+
}> = ({
|
|
204
|
+
id,
|
|
205
|
+
title,
|
|
206
|
+
isActive,
|
|
207
|
+
className,
|
|
208
|
+
tag,
|
|
209
|
+
|
|
210
|
+
...rest
|
|
211
|
+
}) => {
|
|
211
212
|
return (
|
|
212
213
|
<div
|
|
213
214
|
data-cy={`navigation-item-${id}`}
|
|
@@ -215,13 +216,12 @@ export const InternalSideNavigationGroupTrigger: FC<
|
|
|
215
216
|
key={id}
|
|
216
217
|
{...rest}
|
|
217
218
|
className={classNames(Styles.submenuItem, {
|
|
218
|
-
[Styles.submenuLink]: !!onClick,
|
|
219
|
+
[Styles.submenuLink]: !!rest.onClick,
|
|
219
220
|
[Styles.submenuLinkActive]: isActive === true,
|
|
220
221
|
})}
|
|
221
|
-
onClick={onClick}
|
|
222
222
|
>
|
|
223
223
|
<span>{title}</span>
|
|
224
|
-
<BadgeTag data={
|
|
224
|
+
<BadgeTag data={tag} className={Styles.submenuLinkCounter} />
|
|
225
225
|
</div>
|
|
226
226
|
);
|
|
227
227
|
};
|
|
@@ -231,42 +231,95 @@ export const InternalSideNavigationGroupDivider = () => {
|
|
|
231
231
|
};
|
|
232
232
|
|
|
233
233
|
export const InternalSideNavigationGroup: FC<
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
234
|
+
NavigationComponentProps & {
|
|
235
|
+
id: string;
|
|
236
|
+
to: string | undefined;
|
|
237
|
+
title: string;
|
|
238
|
+
isActive: boolean | ((pathname: string) => boolean) | undefined;
|
|
239
|
+
icon: IconProps['svg'] | undefined;
|
|
240
|
+
iconActive: IconProps['svg'] | undefined;
|
|
241
|
+
className: string | undefined;
|
|
242
|
+
tag: BadgeTagProps | undefined;
|
|
243
|
+
|
|
244
|
+
children: ReactNode;
|
|
245
|
+
submenuExpanded: boolean;
|
|
246
|
+
onClick?: (e: MouseEvent<never>) => void;
|
|
247
|
+
onExpandToggle(e: MouseEvent<never>): void;
|
|
248
|
+
}
|
|
249
|
+
> = ({
|
|
250
|
+
id,
|
|
251
|
+
to,
|
|
252
|
+
title,
|
|
253
|
+
isActive,
|
|
254
|
+
icon,
|
|
255
|
+
iconActive,
|
|
256
|
+
className,
|
|
257
|
+
tag,
|
|
258
|
+
|
|
259
|
+
children,
|
|
260
|
+
submenuExpanded,
|
|
261
|
+
onExpandToggle,
|
|
262
|
+
onClick,
|
|
263
|
+
navigationComponent,
|
|
264
|
+
...rest
|
|
265
|
+
}) => {
|
|
266
|
+
const onRootClickCapture = (e: MouseEvent<never>) => {
|
|
267
|
+
if (!submenuExpanded) {
|
|
268
|
+
onExpandToggle?.(e);
|
|
269
|
+
e.preventDefault();
|
|
270
|
+
e.stopPropagation();
|
|
242
271
|
}
|
|
243
|
-
|
|
272
|
+
};
|
|
244
273
|
return (
|
|
245
274
|
<div className={classNames(Styles.navGroupWrapper)}>
|
|
246
|
-
<div className={Styles.navGroupItem}>
|
|
275
|
+
<div className={Styles.navGroupItem} onClickCapture={onRootClickCapture}>
|
|
247
276
|
{to ? (
|
|
248
277
|
<InternalSideNavigationLink
|
|
249
|
-
{
|
|
250
|
-
isActive={isActive}
|
|
278
|
+
id={id}
|
|
251
279
|
to={to}
|
|
252
|
-
|
|
253
|
-
|
|
280
|
+
title={title}
|
|
281
|
+
isActive={isActive}
|
|
282
|
+
icon={icon}
|
|
283
|
+
iconActive={iconActive}
|
|
284
|
+
tag={tag}
|
|
285
|
+
className={className}
|
|
286
|
+
{...rest}
|
|
287
|
+
navigationComponent={navigationComponent}
|
|
254
288
|
/>
|
|
255
289
|
) : (
|
|
256
290
|
<InternalSideNavigationTrigger
|
|
257
|
-
{
|
|
291
|
+
id={id}
|
|
292
|
+
title={title}
|
|
258
293
|
isActive={isActive === true || undefined}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
294
|
+
icon={icon}
|
|
295
|
+
iconActive={iconActive}
|
|
296
|
+
tag={tag}
|
|
297
|
+
className={className}
|
|
298
|
+
{...rest}
|
|
262
299
|
/>
|
|
263
300
|
)}
|
|
301
|
+
|
|
302
|
+
<div className={Styles.navItemGroupToggleWrapper}>
|
|
303
|
+
{withTooltip(
|
|
304
|
+
<Button
|
|
305
|
+
appearance="secondary"
|
|
306
|
+
size="small"
|
|
307
|
+
icon={submenuExpanded ? SvgGroupCollapse : SvgGroupExpand}
|
|
308
|
+
className={Styles.navItemGroupToggle}
|
|
309
|
+
onClick={onExpandToggle}
|
|
310
|
+
aria-label="Toggle submenu"
|
|
311
|
+
data-cy="nav-item-group-expand"
|
|
312
|
+
/>,
|
|
313
|
+
submenuExpanded ? 'Hide Submenu' : 'View Submenu',
|
|
314
|
+
{ placement: 'top-end' }
|
|
315
|
+
)}
|
|
316
|
+
</div>
|
|
264
317
|
</div>
|
|
265
318
|
<div
|
|
266
319
|
className={classNames(Styles.submenuWrapper, {
|
|
267
320
|
[Styles.submenuWrapperCollapsed]: !submenuExpanded,
|
|
268
321
|
})}
|
|
269
|
-
data-cy={`navigation-submenu-${
|
|
322
|
+
data-cy={`navigation-submenu-${id}`}
|
|
270
323
|
>
|
|
271
324
|
<div className={Styles.submenu}>{children}</div>
|
|
272
325
|
</div>
|
|
@@ -23,31 +23,47 @@ const WrappedLink: FC<{
|
|
|
23
23
|
|
|
24
24
|
/** Side Navigation menu link */
|
|
25
25
|
export function LayoutSidebarLink({
|
|
26
|
+
id,
|
|
27
|
+
to,
|
|
28
|
+
title,
|
|
29
|
+
isActive,
|
|
30
|
+
icon,
|
|
31
|
+
iconActive,
|
|
26
32
|
counter,
|
|
27
33
|
tag,
|
|
34
|
+
className,
|
|
35
|
+
|
|
28
36
|
tooltip,
|
|
29
37
|
wrapper,
|
|
30
|
-
|
|
38
|
+
extra,
|
|
39
|
+
side,
|
|
40
|
+
...rest
|
|
31
41
|
}: TitanLayoutLinkProps) {
|
|
32
42
|
const {
|
|
33
43
|
NavigationComponent,
|
|
34
44
|
breakpoint: { isMobile },
|
|
35
45
|
} = useTitanLayoutContext();
|
|
36
46
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
37
|
-
const tagData = getCounterTag(counter, tag);
|
|
47
|
+
const tagData = getCounterTag(side?.counter ?? counter, tag);
|
|
38
48
|
|
|
39
|
-
onNotificationsUpdate(
|
|
49
|
+
onNotificationsUpdate(id, !!tagData);
|
|
40
50
|
|
|
41
51
|
const element = (
|
|
42
52
|
<InternalSideNavigationLink
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
id={id}
|
|
54
|
+
to={to}
|
|
55
|
+
title={title}
|
|
56
|
+
isActive={isActive}
|
|
57
|
+
icon={icon}
|
|
58
|
+
iconActive={iconActive}
|
|
46
59
|
tag={tagData}
|
|
60
|
+
className={className}
|
|
61
|
+
{...rest}
|
|
62
|
+
navigationComponent={NavigationComponent}
|
|
47
63
|
/>
|
|
48
64
|
);
|
|
49
65
|
|
|
50
|
-
return wrapper
|
|
66
|
+
return wrapper ? (
|
|
51
67
|
<WrappedLink isMobile={isMobile} wrapper={wrapper}>
|
|
52
68
|
{element}
|
|
53
69
|
</WrappedLink>
|
|
@@ -58,23 +74,40 @@ export function LayoutSidebarLink({
|
|
|
58
74
|
|
|
59
75
|
/** Side Navigation menu trigger */
|
|
60
76
|
export function LayoutSidebarTrigger({
|
|
77
|
+
id,
|
|
78
|
+
title,
|
|
79
|
+
isActive,
|
|
80
|
+
icon,
|
|
81
|
+
iconActive,
|
|
61
82
|
counter,
|
|
62
83
|
tag,
|
|
84
|
+
className,
|
|
85
|
+
|
|
63
86
|
tooltip,
|
|
64
87
|
wrapper,
|
|
65
|
-
|
|
66
|
-
|
|
88
|
+
extra,
|
|
89
|
+
side,
|
|
90
|
+
...rest
|
|
67
91
|
}: TitanLayoutTriggerProps) {
|
|
68
92
|
const {
|
|
69
93
|
breakpoint: { isMobile },
|
|
70
94
|
} = useTitanLayoutContext();
|
|
71
95
|
const { onNotificationsUpdate } = useNotificationsContext();
|
|
72
|
-
const tagData = getCounterTag(counter, tag);
|
|
96
|
+
const tagData = getCounterTag(side?.counter ?? counter, tag);
|
|
73
97
|
|
|
74
|
-
onNotificationsUpdate(
|
|
98
|
+
onNotificationsUpdate(id, !!tagData);
|
|
75
99
|
|
|
76
100
|
const element = (
|
|
77
|
-
<InternalSideNavigationTrigger
|
|
101
|
+
<InternalSideNavigationTrigger
|
|
102
|
+
id={id}
|
|
103
|
+
title={title}
|
|
104
|
+
isActive={isActive}
|
|
105
|
+
icon={icon}
|
|
106
|
+
iconActive={iconActive}
|
|
107
|
+
tag={tagData}
|
|
108
|
+
className={className}
|
|
109
|
+
{...rest}
|
|
110
|
+
/>
|
|
78
111
|
);
|
|
79
112
|
return wrapper ? (
|
|
80
113
|
<WrappedLink isMobile={isMobile} wrapper={wrapper}>
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
|
|
18
18
|
// mobile version
|
|
19
19
|
.nav-drawer {
|
|
20
|
-
// display: none;
|
|
21
20
|
position: fixed;
|
|
22
21
|
max-width: 400px;
|
|
23
22
|
width: 0;
|
|
@@ -65,6 +64,24 @@
|
|
|
65
64
|
margin-bottom: @spacing-half;
|
|
66
65
|
}
|
|
67
66
|
}
|
|
67
|
+
|
|
68
|
+
.nav-group-item {
|
|
69
|
+
.nav-item {
|
|
70
|
+
margin-right: 36px;
|
|
71
|
+
|
|
72
|
+
&.nav-item-active {
|
|
73
|
+
margin-right: @spacing-0;
|
|
74
|
+
|
|
75
|
+
.nav-item-icon-wrapper {
|
|
76
|
+
padding-right: 40px;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.nav-item-group-toggle-wrapper {
|
|
82
|
+
right: @spacing-0;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
68
85
|
}
|
|
69
86
|
|
|
70
87
|
.nav-drawer-backdrop {
|
|
@@ -184,19 +201,38 @@
|
|
|
184
201
|
}
|
|
185
202
|
|
|
186
203
|
.nav-top .divider {
|
|
187
|
-
margin-top: @spacing-
|
|
204
|
+
margin-top: @spacing-half;
|
|
188
205
|
margin-bottom: @spacing-1;
|
|
189
206
|
}
|
|
190
207
|
|
|
191
208
|
.nav-main {
|
|
192
209
|
padding-top: @spacing-1;
|
|
193
210
|
}
|
|
211
|
+
|
|
212
|
+
.nav-group-item {
|
|
213
|
+
.nav-item {
|
|
214
|
+
margin-right: 44px;
|
|
215
|
+
|
|
216
|
+
&.nav-item-active {
|
|
217
|
+
margin-right: @spacing-1;
|
|
218
|
+
|
|
219
|
+
.nav-item-icon-wrapper {
|
|
220
|
+
padding-right: 40px;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.nav-item-group-toggle-wrapper {
|
|
226
|
+
right: @spacing-1;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
194
229
|
}
|
|
195
230
|
|
|
196
231
|
.nav-drawer,
|
|
197
232
|
.nav-wide {
|
|
198
233
|
.nav-item {
|
|
199
234
|
flex-direction: row;
|
|
235
|
+
margin-bottom: @spacing-half;
|
|
200
236
|
|
|
201
237
|
.nav-item-icon-wrapper {
|
|
202
238
|
flex: 1;
|
|
@@ -355,26 +391,6 @@
|
|
|
355
391
|
min-height: 12px !important;
|
|
356
392
|
}
|
|
357
393
|
|
|
358
|
-
.nav-item-group-toggle-wrapper {
|
|
359
|
-
position: relative;
|
|
360
|
-
display: flex;
|
|
361
|
-
justify-content: center;
|
|
362
|
-
align-items: center;
|
|
363
|
-
|
|
364
|
-
.nav-item-group-toggle[data-anv][data-anv] {
|
|
365
|
-
color: inherit;
|
|
366
|
-
font-weight: @font-weight-semibold;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
.nav-item-group-toggle-click {
|
|
370
|
-
position: absolute;
|
|
371
|
-
left: -@spacing-2;
|
|
372
|
-
right: -@spacing-half;
|
|
373
|
-
top: -@spacing-1;
|
|
374
|
-
bottom: -@spacing-1;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
394
|
.nav-icon[data-anv][data-anv] {
|
|
379
395
|
height: 24px;
|
|
380
396
|
width: 24px;
|
|
@@ -397,6 +413,42 @@
|
|
|
397
413
|
.nav-group-wrapper {
|
|
398
414
|
.nav-group-item {
|
|
399
415
|
position: relative;
|
|
416
|
+
|
|
417
|
+
.nav-item {
|
|
418
|
+
.nav-item-counter[data-anv][data-anv] {
|
|
419
|
+
margin-right: @spacing-0;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
&:has(.nav-item-active) {
|
|
424
|
+
.nav-item-group-toggle-wrapper {
|
|
425
|
+
color: @text-color-active;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.nav-item-group-toggle-wrapper {
|
|
431
|
+
position: absolute;
|
|
432
|
+
top: 0;
|
|
433
|
+
bottom: 0;
|
|
434
|
+
right: @spacing-0;
|
|
435
|
+
color: @text-color;
|
|
436
|
+
display: flex;
|
|
437
|
+
justify-content: center;
|
|
438
|
+
align-items: center;
|
|
439
|
+
|
|
440
|
+
.nav-item-group-toggle[data-anv][data-anv] {
|
|
441
|
+
color: inherit;
|
|
442
|
+
font-weight: @font-weight-semibold;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.nav-item-group-toggle-click {
|
|
446
|
+
position: absolute;
|
|
447
|
+
left: -@spacing-2;
|
|
448
|
+
right: -@spacing-half;
|
|
449
|
+
top: -@spacing-1;
|
|
450
|
+
bottom: -@spacing-1;
|
|
451
|
+
}
|
|
400
452
|
}
|
|
401
453
|
|
|
402
454
|
.submenu-wrapper:not(.submenu-wrapper-collapsed) {
|