@servicetitan/navigation 9.2.1 → 10.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 +4 -4
- package/dist/components/counter-tag.d.ts.map +1 -1
- package/dist/components/counter-tag.js +2 -8
- package/dist/components/counter-tag.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.d.ts +3 -3
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.js +3 -2
- package/dist/components/header-navigation/header-navigation-content.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.js +3 -3
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.js +5 -4
- package/dist/components/header-navigation/header-navigation-links.js.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.d.ts +1 -1
- package/dist/components/header-navigation/header-navigation.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js +1 -1
- 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/left-navigation/header-navigation-tiny-links.d.ts +3 -3
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.js +5 -4
- package/dist/components/left-navigation/header-navigation-tiny-links.js.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-internal.d.ts +1 -1
- package/dist/components/left-navigation/interface-internal.d.ts.map +1 -1
- package/dist/components/left-navigation/interface.d.ts +2 -2
- package/dist/components/left-navigation/interface.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts +7 -4
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation-links-internal.js.map +1 -1
- package/dist/components/left-navigation/side-navigation-links.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation-links.js +3 -2
- package/dist/components/left-navigation/side-navigation-links.js.map +1 -1
- package/dist/components/left-navigation/side-navigation.d.ts +2 -2
- package/dist/components/left-navigation/side-navigation.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation.js +5 -5
- package/dist/components/left-navigation/side-navigation.js.map +1 -1
- package/dist/components/links.d.ts +1 -1
- package/dist/components/links.d.ts.map +1 -1
- package/dist/components/links.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +3 -2
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +3 -2
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.js +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +1 -1
- 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 +2 -1
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +10 -7
- package/dist/test/data.js.map +1 -1
- package/dist/utils/counter-tag.d.ts +3 -6
- package/dist/utils/counter-tag.d.ts.map +1 -1
- package/dist/utils/counter-tag.js +1 -1
- package/dist/utils/counter-tag.js.map +1 -1
- package/dist/utils/navigation-context.d.ts +13 -2
- package/dist/utils/navigation-context.d.ts.map +1 -1
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation-legacy.d.ts +86 -0
- package/dist/utils/navigation-legacy.d.ts.map +1 -0
- package/dist/utils/navigation-legacy.js +2 -0
- package/dist/utils/navigation-legacy.js.map +1 -0
- package/dist/utils/navigation.d.ts +15 -76
- package/dist/utils/navigation.d.ts.map +1 -1
- package/dist/utils/side-nav.d.ts +5 -2
- package/dist/utils/side-nav.d.ts.map +1 -1
- package/dist/utils/side-nav.js +6 -5
- package/dist/utils/side-nav.js.map +1 -1
- package/package.json +2 -2
- package/src/components/counter-tag.tsx +10 -21
- package/src/components/header-navigation/header-navigation-content.tsx +6 -4
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +3 -3
- package/src/components/header-navigation/header-navigation-links.tsx +9 -3
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +2 -2
- package/src/components/header-navigation/header-navigation.stories.tsx +2 -2
- package/src/components/header-navigation/header-navigation.tsx +1 -1
- package/src/components/left-navigation/header-navigation-tiny-links.tsx +11 -5
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +2 -2
- package/src/components/left-navigation/interface-internal.ts +1 -1
- package/src/components/left-navigation/interface.ts +2 -3
- package/src/components/left-navigation/side-navigation-links-internal.tsx +7 -5
- package/src/components/left-navigation/side-navigation-links.tsx +7 -1
- package/src/components/left-navigation/side-navigation.tsx +12 -10
- package/src/components/links.tsx +4 -1
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +4 -1
- package/src/components/profile-dropdown/profile-dropdown.tsx +10 -3
- package/src/index.ts +6 -1
- package/src/test/data.tsx +17 -18
- package/src/utils/counter-tag.ts +3 -9
- package/src/utils/navigation-context.tsx +15 -2
- package/src/utils/navigation-legacy.ts +104 -0
- package/src/utils/navigation.ts +15 -85
- package/src/utils/side-nav.ts +17 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-legacy.d.ts","sourceRoot":"","sources":["../../src/utils/navigation-legacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBA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AC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-legacy.js","sourceRoot":"","sources":["../../src/utils/navigation-legacy.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { IconProps } from '@servicetitan/anvil2';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export interface HeaderNavigationItemData extends HeaderNavigationItemLinkProps {
|
|
6
|
-
/** link description */
|
|
7
|
-
hint: string;
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { CounterTagData, CounterTagValue } from './counter-tag';
|
|
4
|
+
export interface NavigationItemData extends NavigationLinkData {
|
|
8
5
|
/** flag if the link is not shown (based on FG and/or user permissions) */
|
|
9
6
|
isHidden?: boolean;
|
|
10
7
|
/** custom className (can be used for mdi icons) */
|
|
11
8
|
iconClassName?: string;
|
|
12
|
-
/** anvil's icon name of item */
|
|
13
|
-
iconName?: IconPropsStrict['name'];
|
|
14
9
|
/** svg icon (anvil2) of inactive item */
|
|
15
10
|
icon: IconProps['svg'] | undefined;
|
|
16
11
|
/** svg icon (anvil2) of active item */
|
|
@@ -18,13 +13,14 @@ export interface HeaderNavigationItemData extends HeaderNavigationItemLinkProps
|
|
|
18
13
|
/** icon component of item (<svg />) */
|
|
19
14
|
iconComponent?: FC;
|
|
20
15
|
/** item tag (optional). shown if it is set and true or greater than 0 */
|
|
21
|
-
|
|
16
|
+
counter?: CounterTagValue;
|
|
17
|
+
tag?: CounterTagData;
|
|
22
18
|
/** class name of link item */
|
|
23
19
|
className?: string;
|
|
24
20
|
/** optional submenu of link item */
|
|
25
|
-
submenu?:
|
|
21
|
+
submenu?: NavigationSubmenuData;
|
|
26
22
|
}
|
|
27
|
-
export interface
|
|
23
|
+
export interface NavigationLinkData {
|
|
28
24
|
/** link id */
|
|
29
25
|
id: string;
|
|
30
26
|
/** link href */
|
|
@@ -34,76 +30,19 @@ export interface HeaderNavigationItemLinkProps {
|
|
|
34
30
|
/** callback to return active state. By default, it compares link href with current pathname */
|
|
35
31
|
isActive?: boolean | ((pathname: string) => boolean);
|
|
36
32
|
}
|
|
37
|
-
export interface
|
|
33
|
+
export interface NavigationSubmenuData {
|
|
38
34
|
/** submenu groups */
|
|
39
|
-
groups:
|
|
35
|
+
groups: NavigationSubmenuGroupData[];
|
|
40
36
|
}
|
|
41
|
-
export interface
|
|
42
|
-
/** item tag (optional). shown if it is set and true or greater than 0 */
|
|
43
|
-
|
|
37
|
+
export interface NavigationSubmenuItemData extends NavigationLinkData {
|
|
38
|
+
/** item tag (optional) value. shown if it is set and true or greater than 0 */
|
|
39
|
+
counter?: CounterTagValue;
|
|
40
|
+
tag?: CounterTagData;
|
|
44
41
|
}
|
|
45
|
-
export interface
|
|
42
|
+
export interface NavigationSubmenuGroupData {
|
|
46
43
|
/** submenu group title */
|
|
47
44
|
title: string;
|
|
48
45
|
/** submenu group links */
|
|
49
|
-
links:
|
|
50
|
-
}
|
|
51
|
-
export interface NavLinkComponentPropsStrict {
|
|
52
|
-
to: string;
|
|
53
|
-
title?: string;
|
|
54
|
-
className?: string;
|
|
55
|
-
activeClassName?: string;
|
|
56
|
-
children: ReactNode;
|
|
57
|
-
isActive?: (pathname: string) => boolean;
|
|
58
|
-
target?: HTMLAttributeAnchorTarget;
|
|
59
|
-
}
|
|
60
|
-
export interface NavLinkComponentProps extends NavLinkComponentPropsStrict {
|
|
61
|
-
[key: string]: any;
|
|
62
|
-
}
|
|
63
|
-
export interface HeaderNavigationTriggerPropsStrict {
|
|
64
|
-
/** unique identifier */
|
|
65
|
-
id: string;
|
|
66
|
-
/** tooltip text */
|
|
67
|
-
tooltip?: string;
|
|
68
|
-
/** item description */
|
|
69
|
-
hint?: string;
|
|
70
|
-
/** container class name */
|
|
71
|
-
className?: string;
|
|
72
|
-
/** item label */
|
|
73
|
-
label?: string;
|
|
74
|
-
/** label class name */
|
|
75
|
-
labelClassName?: string;
|
|
76
|
-
/** isActive */
|
|
77
|
-
isActive?: boolean;
|
|
78
|
-
/** counter tag shown for item */
|
|
79
|
-
tag?: CounterTagPropsType;
|
|
80
|
-
/** counter component class name */
|
|
81
|
-
counterClassName?: string;
|
|
82
|
-
/** icon component class name */
|
|
83
|
-
iconClassName?: string;
|
|
84
|
-
/** IconComponent custom icon component */
|
|
85
|
-
iconComponent?: FC;
|
|
86
|
-
/** iconName name of anvil icon */
|
|
87
|
-
iconName?: IconPropsStrict['name'];
|
|
88
|
-
/** svg icon (anvil2) of inactive item */
|
|
89
|
-
icon: IconProps['svg'] | undefined;
|
|
90
|
-
/** svg icon (anvil2) of active item */
|
|
91
|
-
iconActive: IconProps['svg'] | undefined;
|
|
92
|
-
}
|
|
93
|
-
export interface HeaderNavigationTriggerProps extends HeaderNavigationTriggerPropsStrict {
|
|
94
|
-
/** unstrict props */
|
|
95
|
-
[key: string]: any;
|
|
96
|
-
}
|
|
97
|
-
export interface HeaderNavigationLinkPropsStrict extends Omit<HeaderNavigationTriggerPropsStrict, 'isActive'> {
|
|
98
|
-
/** link href */
|
|
99
|
-
to: string;
|
|
100
|
-
/** isActive */
|
|
101
|
-
isActive?: boolean | ((pathname: string) => boolean);
|
|
102
|
-
/** link html target */
|
|
103
|
-
target?: HTMLAttributeAnchorTarget;
|
|
104
|
-
}
|
|
105
|
-
export interface HeaderNavigationLinkProps extends HeaderNavigationLinkPropsStrict {
|
|
106
|
-
/** unstrict props */
|
|
107
|
-
[key: string]: any;
|
|
46
|
+
links: NavigationSubmenuItemData[];
|
|
108
47
|
}
|
|
109
48
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/utils/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation.d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EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACvC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IAEd,0BAA0B;IAC1B,KAAK,EAAE,yBAAyB,EAAE,CAAC;CACtC"}
|
package/dist/utils/side-nav.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { CounterTagProps } from '../components/counter-tag';
|
|
2
|
+
import { CounterTagData, CounterTagValue } from './counter-tag';
|
|
3
|
+
import { NavigationSubmenuData } from './navigation';
|
|
4
|
+
export declare function getSubmenuGroupTag(submenu: NavigationSubmenuData | undefined, defaultTag: CounterTagProps | undefined): CounterTagProps | undefined;
|
|
5
|
+
export declare const getCounterTag: (counter: CounterTagValue | undefined, tag?: CounterTagData | undefined) => CounterTagProps | undefined;
|
|
3
6
|
//# sourceMappingURL=side-nav.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-nav.d.ts","sourceRoot":"","sources":["../../src/utils/side-nav.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"side-nav.d.ts","sourceRoot":"","sources":["../../src/utils/side-nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,qBAAqB,GAAG,SAAS,EAC1C,UAAU,EAAE,eAAe,GAAG,SAAS,GACxC,eAAe,GAAG,SAAS,CAyB7B;AAED,eAAO,MAAM,aAAa,YACb,eAAe,GAAG,SAAS,QAC9B,cAAc,GAAG,SAAS,KACjC,eAAe,GAAG,SAIpB,CAAC"}
|
package/dist/utils/side-nav.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isCounterPropsObject } from './counter-tag';
|
|
2
1
|
export function getSubmenuGroupTag(submenu, defaultTag) {
|
|
3
2
|
if (!submenu) {
|
|
4
3
|
return defaultTag;
|
|
@@ -6,9 +5,7 @@ export function getSubmenuGroupTag(submenu, defaultTag) {
|
|
|
6
5
|
let tagValue = undefined;
|
|
7
6
|
for (const group of submenu.groups) {
|
|
8
7
|
for (const link of group.links) {
|
|
9
|
-
const ltv =
|
|
10
|
-
? link.tag.value
|
|
11
|
-
: link.tag;
|
|
8
|
+
const ltv = link.counter;
|
|
12
9
|
if (ltv) {
|
|
13
10
|
if (typeof ltv === 'number') {
|
|
14
11
|
if (typeof tagValue !== 'number') {
|
|
@@ -22,6 +19,10 @@ export function getSubmenuGroupTag(submenu, defaultTag) {
|
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
return tagValue
|
|
22
|
+
return tagValue ? getCounterTag(tagValue) : defaultTag;
|
|
26
23
|
}
|
|
24
|
+
export const getCounterTag = (counter, tag) => {
|
|
25
|
+
const value = counter !== null && counter !== void 0 ? counter : tag === null || tag === void 0 ? void 0 : tag.value;
|
|
26
|
+
return value ? { value, className: '' } : undefined;
|
|
27
|
+
};
|
|
27
28
|
//# sourceMappingURL=side-nav.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"side-nav.js","sourceRoot":"","sources":["../../src/utils/side-nav.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"side-nav.js","sourceRoot":"","sources":["../../src/utils/side-nav.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,kBAAkB,CAC9B,OAA0C,EAC1C,UAAuC;IAEvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,IAAI,QAAQ,GAAiC,SAAS,CAAC;IAEvD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACjC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAiC,IAAI,CAAC,OAAO,CAAC;YAEvD,IAAI,GAAG,EAAE,CAAC;gBACN,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;oBAC1B,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;wBAC/B,QAAQ,GAAG,CAAC,CAAC;oBACjB,CAAC;oBACD,QAAQ,IAAI,GAAG,CAAC;gBACpB,CAAC;qBAAM,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;oBACtC,QAAQ,GAAG,IAAI,CAAC;gBACpB,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CACzB,OAAoC,EACpC,GAAgC,EACL,EAAE;IAC7B,MAAM,KAAK,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,KAAK,CAAC;IAEpC,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/navigation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Navigation components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"less": true,
|
|
44
44
|
"webpack": false
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "b5beeed5267bce1f6f6aaf3f725d31bdfab1f011"
|
|
47
47
|
}
|
|
@@ -1,44 +1,33 @@
|
|
|
1
1
|
import { Tag } from '@servicetitan/design-system';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { FC } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { CounterTagData } from '../utils/counter-tag';
|
|
5
5
|
|
|
6
|
-
export interface CounterTagProps extends
|
|
6
|
+
export interface CounterTagProps extends CounterTagData {
|
|
7
7
|
[key: string]: any;
|
|
8
|
+
className: string;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export type CounterTagPropsType = boolean | number | CounterTagProps;
|
|
11
|
-
|
|
12
|
-
const getCounterProps = (
|
|
13
|
-
props: CounterTagPropsType | undefined
|
|
14
|
-
): CounterTagPropsStrict | undefined => {
|
|
15
|
-
if (typeof props === 'number' || typeof props === 'boolean') {
|
|
16
|
-
return { value: props };
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return props;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
11
|
export const CounterTag: FC<{
|
|
23
12
|
className?: string;
|
|
24
13
|
longClassName?: string;
|
|
25
|
-
data:
|
|
14
|
+
data: CounterTagProps | undefined;
|
|
26
15
|
}> = ({ className, data, longClassName }) => {
|
|
27
|
-
const
|
|
16
|
+
const { value, className: dataClassName, ...rest } = data ?? {};
|
|
28
17
|
|
|
29
|
-
return
|
|
18
|
+
return value ? (
|
|
30
19
|
<Tag
|
|
31
20
|
color="critical"
|
|
32
|
-
{...
|
|
21
|
+
{...rest}
|
|
33
22
|
className={classNames(
|
|
34
23
|
className,
|
|
35
|
-
|
|
36
|
-
typeof
|
|
24
|
+
dataClassName,
|
|
25
|
+
typeof value === 'number' && value > 10 && longClassName
|
|
37
26
|
)}
|
|
38
27
|
compact
|
|
39
28
|
badge
|
|
40
29
|
>
|
|
41
|
-
{
|
|
30
|
+
{value}
|
|
42
31
|
</Tag>
|
|
43
32
|
) : null;
|
|
44
33
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Icon, IconPropsStrict } from '@servicetitan/design-system';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { FC, Fragment, useContext } from 'react';
|
|
4
|
-
import { HeaderNavigationItemData } from '../../utils/navigation';
|
|
5
4
|
import { NavigationComponentContext } from '../../utils/navigation-context';
|
|
6
|
-
import {
|
|
5
|
+
import { HeaderNavigationItemData } from '../../utils/navigation-legacy';
|
|
6
|
+
import { getCounterTag } from '../../utils/side-nav';
|
|
7
|
+
import { CounterTag, CounterTagProps } from '../counter-tag';
|
|
7
8
|
import * as Styles from './header-navigation.module.less';
|
|
8
9
|
import { withTooltip } from './with-tooltip';
|
|
9
10
|
|
|
@@ -13,7 +14,7 @@ export interface HeaderNavigationItemContentPropsStrict {
|
|
|
13
14
|
/** text component class name */
|
|
14
15
|
titleClassName?: string;
|
|
15
16
|
/** counter tag shown for item */
|
|
16
|
-
tag
|
|
17
|
+
tag: CounterTagProps | undefined;
|
|
17
18
|
/** counter component class name */
|
|
18
19
|
counterClassName?: string;
|
|
19
20
|
/** icon component class name */
|
|
@@ -73,6 +74,7 @@ interface HeaderNavigationItemPropsStrict extends HeaderNavigationItemData {
|
|
|
73
74
|
export const HeaderNavigationItem: FC<HeaderNavigationItemPropsStrict> = ({
|
|
74
75
|
id,
|
|
75
76
|
to,
|
|
77
|
+
counter,
|
|
76
78
|
title,
|
|
77
79
|
hint,
|
|
78
80
|
className,
|
|
@@ -107,7 +109,7 @@ export const HeaderNavigationItem: FC<HeaderNavigationItemPropsStrict> = ({
|
|
|
107
109
|
<HeaderNavigationItemContent
|
|
108
110
|
title={minimized ? undefined : title}
|
|
109
111
|
titleClassName={main ? '' : 'm-l-half'}
|
|
110
|
-
tag={tag}
|
|
112
|
+
tag={getCounterTag(counter, tag)}
|
|
111
113
|
iconComponent={iconComponent}
|
|
112
114
|
iconClassName={iconClassName}
|
|
113
115
|
iconName={iconName}
|
|
@@ -36,7 +36,7 @@ export const ExtraTrigger = () => (
|
|
|
36
36
|
<HeaderNavigationTrigger
|
|
37
37
|
id="dialpad"
|
|
38
38
|
iconName="phone"
|
|
39
|
-
|
|
39
|
+
counter={2}
|
|
40
40
|
tooltip="Phones pro"
|
|
41
41
|
icon={SvgPhone}
|
|
42
42
|
iconActive={undefined}
|
|
@@ -60,7 +60,7 @@ export const ExtraWithTooltip = () => (
|
|
|
60
60
|
id="dialpad"
|
|
61
61
|
iconName="phone"
|
|
62
62
|
hint="Dialpad"
|
|
63
|
-
|
|
63
|
+
counter={2}
|
|
64
64
|
icon={SvgPhone}
|
|
65
65
|
iconActive={undefined}
|
|
66
66
|
/>
|
|
@@ -127,7 +127,7 @@ export const ExtraWithLabel = () => (
|
|
|
127
127
|
id="dialpad"
|
|
128
128
|
iconName="phone"
|
|
129
129
|
hint="Dialpad"
|
|
130
|
-
tag={2}
|
|
130
|
+
tag={{ value: 2 }}
|
|
131
131
|
icon={SvgPhone}
|
|
132
132
|
iconActive={undefined}
|
|
133
133
|
/>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { FC, ReactNode, useContext } from 'react';
|
|
3
|
-
import { HeaderNavigationLinkProps, HeaderNavigationTriggerProps } from '../../utils/navigation';
|
|
4
3
|
import { NavigationComponentContext } from '../../utils/navigation-context';
|
|
4
|
+
import {
|
|
5
|
+
HeaderNavigationLinkProps,
|
|
6
|
+
HeaderNavigationTriggerProps,
|
|
7
|
+
} from '../../utils/navigation-legacy';
|
|
8
|
+
import { getCounterTag } from '../../utils/side-nav';
|
|
5
9
|
import { HeaderNavigationItemContent } from './header-navigation-content';
|
|
6
10
|
import * as Styles from './header-navigation.module.less';
|
|
7
11
|
import { withTooltip } from './with-tooltip';
|
|
@@ -10,6 +14,7 @@ import { withTooltip } from './with-tooltip';
|
|
|
10
14
|
export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
11
15
|
id,
|
|
12
16
|
to,
|
|
17
|
+
counter,
|
|
13
18
|
hint,
|
|
14
19
|
tooltip,
|
|
15
20
|
className,
|
|
@@ -43,7 +48,7 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
43
48
|
target={target}
|
|
44
49
|
>
|
|
45
50
|
<HeaderNavigationItemContent
|
|
46
|
-
tag={tag}
|
|
51
|
+
tag={getCounterTag(counter, tag)}
|
|
47
52
|
iconComponent={iconComponent}
|
|
48
53
|
iconClassName={iconClassName}
|
|
49
54
|
iconName={iconName}
|
|
@@ -59,6 +64,7 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
59
64
|
export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
60
65
|
id,
|
|
61
66
|
className,
|
|
67
|
+
counter,
|
|
62
68
|
iconClassName,
|
|
63
69
|
iconComponent,
|
|
64
70
|
iconName,
|
|
@@ -87,7 +93,7 @@ export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
|
87
93
|
)}
|
|
88
94
|
>
|
|
89
95
|
<HeaderNavigationItemContent
|
|
90
|
-
tag={tag}
|
|
96
|
+
tag={getCounterTag(counter, tag)}
|
|
91
97
|
iconComponent={iconComponent}
|
|
92
98
|
iconClassName={iconClassName}
|
|
93
99
|
iconName={iconName}
|
|
@@ -96,7 +96,7 @@ export const WithAllMonolithData = () => (
|
|
|
96
96
|
<HeaderNavigationTrigger
|
|
97
97
|
id="dialpad"
|
|
98
98
|
iconName="phone"
|
|
99
|
-
tag={2}
|
|
99
|
+
tag={{ value: 2 }}
|
|
100
100
|
icon={SvgIcon}
|
|
101
101
|
iconActive={SvgIcon}
|
|
102
102
|
/>
|
|
@@ -122,7 +122,7 @@ export const WithAllMonolithData = () => (
|
|
|
122
122
|
/>
|
|
123
123
|
|
|
124
124
|
<ProfileDropdown>
|
|
125
|
-
<ProfileDropdown.Link id="tasks" to="https://googgle.com"
|
|
125
|
+
<ProfileDropdown.Link id="tasks" to="https://googgle.com" counter={10}>
|
|
126
126
|
Task Management
|
|
127
127
|
</ProfileDropdown.Link>
|
|
128
128
|
<ProfileDropdown.Divider />
|
|
@@ -108,7 +108,7 @@ export const WithAllMonolithData = () => (
|
|
|
108
108
|
<HeaderNavigationTrigger
|
|
109
109
|
id="dialpad"
|
|
110
110
|
iconName="phone"
|
|
111
|
-
|
|
111
|
+
counter={2}
|
|
112
112
|
icon={SvgIcon}
|
|
113
113
|
iconActive={SvgIcon}
|
|
114
114
|
/>
|
|
@@ -145,7 +145,7 @@ export const WithAllMonolithData = () => (
|
|
|
145
145
|
/>
|
|
146
146
|
|
|
147
147
|
<ProfileDropdown>
|
|
148
|
-
<ProfileDropdown.Link id="tasks" to="https://googgle.com"
|
|
148
|
+
<ProfileDropdown.Link id="tasks" to="https://googgle.com" counter={10}>
|
|
149
149
|
Task Management
|
|
150
150
|
</ProfileDropdown.Link>
|
|
151
151
|
<ProfileDropdown.Divider />
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Icon, Popover, PopoverPropsStrict } from '@servicetitan/design-system';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { FC, ReactElement, ReactNode, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { HeaderNavigationItemData } from '../../utils/navigation';
|
|
5
4
|
import { NavigationLegacyContext } from '../../utils/navigation-context';
|
|
5
|
+
import { HeaderNavigationItemData } from '../../utils/navigation-legacy';
|
|
6
6
|
import { HeaderNavigationItem } from './header-navigation-content';
|
|
7
7
|
import * as Styles from './header-navigation.module.less';
|
|
8
8
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { Icon, IconProps } from '@servicetitan/anvil2';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { FC, Fragment, useContext } from 'react';
|
|
4
|
-
import { HeaderNavigationLinkProps, HeaderNavigationTriggerProps } from '../../utils/navigation';
|
|
5
4
|
import { NavigationComponentContext } from '../../utils/navigation-context';
|
|
6
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
HeaderNavigationLinkProps,
|
|
7
|
+
HeaderNavigationTriggerProps,
|
|
8
|
+
} from '../../utils/navigation-legacy';
|
|
9
|
+
import { getCounterTag } from '../../utils/side-nav';
|
|
10
|
+
import { CounterTag, CounterTagProps } from '../counter-tag';
|
|
7
11
|
import * as Styles from './header-navigation-tiny.module.less';
|
|
8
12
|
import { withTooltip } from './with-tooltip';
|
|
9
13
|
|
|
10
14
|
/** Content for navigation items */
|
|
11
15
|
export const HeaderNavigationItemContent: FC<{
|
|
12
|
-
tag?:
|
|
16
|
+
tag?: CounterTagProps;
|
|
13
17
|
counterClassName?: string;
|
|
14
18
|
icon: IconProps['svg'] | undefined;
|
|
15
19
|
iconActive: IconProps['svg'] | undefined;
|
|
@@ -50,6 +54,7 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
50
54
|
hint,
|
|
51
55
|
tooltip,
|
|
52
56
|
className,
|
|
57
|
+
counter,
|
|
53
58
|
icon,
|
|
54
59
|
iconActive,
|
|
55
60
|
iconClassName,
|
|
@@ -81,7 +86,7 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
81
86
|
target={target}
|
|
82
87
|
>
|
|
83
88
|
<HeaderNavigationItemContent
|
|
84
|
-
tag={tag}
|
|
89
|
+
tag={getCounterTag(counter, tag)}
|
|
85
90
|
icon={icon}
|
|
86
91
|
iconActive={iconActive}
|
|
87
92
|
label={label}
|
|
@@ -96,6 +101,7 @@ export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
|
96
101
|
export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
97
102
|
id,
|
|
98
103
|
className,
|
|
104
|
+
counter,
|
|
99
105
|
icon,
|
|
100
106
|
iconActive,
|
|
101
107
|
isActive,
|
|
@@ -125,7 +131,7 @@ export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
|
125
131
|
)}
|
|
126
132
|
>
|
|
127
133
|
<HeaderNavigationItemContent
|
|
128
|
-
tag={tag}
|
|
134
|
+
tag={getCounterTag(counter, tag)}
|
|
129
135
|
icon={icon}
|
|
130
136
|
iconActive={iconActive}
|
|
131
137
|
label={label}
|
|
@@ -86,7 +86,7 @@ export const WithAllMonolithData = () => (
|
|
|
86
86
|
/>
|
|
87
87
|
|
|
88
88
|
<ProfileDropdown>
|
|
89
|
-
<ProfileDropdown.Link id="tasks" to="https://googgle.com"
|
|
89
|
+
<ProfileDropdown.Link id="tasks" to="https://googgle.com" counter={10}>
|
|
90
90
|
Task Management
|
|
91
91
|
</ProfileDropdown.Link>
|
|
92
92
|
<ProfileDropdown.Divider />
|
|
@@ -152,7 +152,7 @@ export const WithAllMonolithDataCommercial = () => (
|
|
|
152
152
|
/>
|
|
153
153
|
|
|
154
154
|
<ProfileDropdown>
|
|
155
|
-
<ProfileDropdown.Link id="tasks" to="https://googgle.com"
|
|
155
|
+
<ProfileDropdown.Link id="tasks" to="https://googgle.com" counter={10}>
|
|
156
156
|
Task Management
|
|
157
157
|
</ProfileDropdown.Link>
|
|
158
158
|
<ProfileDropdown.Divider />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { NavLinkComponentProps } from '../../utils/navigation';
|
|
2
|
+
import { NavLinkComponentProps } from '../../utils/navigation-context';
|
|
3
3
|
import { SideNavigationExpandedState } from './interface';
|
|
4
4
|
|
|
5
5
|
export interface NavigationComponentProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC, ReactElement } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NavigationItemData } from '../../utils/navigation';
|
|
3
3
|
import { SideNavigationContextType } from './side-navigation-context';
|
|
4
4
|
|
|
5
5
|
export interface SideNavigationExpandedState {
|
|
@@ -12,8 +12,7 @@ export interface SideNavigationLinkWrapperProps {
|
|
|
12
12
|
context: SideNavigationContextType;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export interface SideNavigationLinkProps
|
|
16
|
-
extends Omit<HeaderNavigationItemData, 'iconName' | 'submenu'> {
|
|
15
|
+
export interface SideNavigationLinkProps extends Omit<NavigationItemData, 'submenu'> {
|
|
17
16
|
wrapper?: FC<SideNavigationLinkWrapperProps>;
|
|
18
17
|
}
|
|
19
18
|
export interface SideNavigationTriggerProps
|
|
@@ -4,15 +4,16 @@ import SvgGroupExpand from '@servicetitan/anvil2/assets/icons/material/round/exp
|
|
|
4
4
|
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { FC, Fragment } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
import { CounterTag } from '../counter-tag';
|
|
7
|
+
import { NavigationItemData } from '../../utils/navigation';
|
|
8
|
+
import { CounterTag, CounterTagProps } from '../counter-tag';
|
|
9
9
|
import { SideNavigationTriggerProps } from './interface';
|
|
10
10
|
import { NavigationComponentProps, SideNavigationExpandedProps } from './interface-internal';
|
|
11
11
|
import * as Styles from './side-navigation.module.less';
|
|
12
12
|
|
|
13
13
|
export interface InternalSideNavigationItemContentProps
|
|
14
|
-
extends Omit<
|
|
14
|
+
extends Omit<NavigationItemData, 'iconName' | 'to' | 'counter' | 'tag'> {
|
|
15
15
|
submenuExpanded: boolean | undefined;
|
|
16
|
+
tag: CounterTagProps | undefined;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export const InternalSideNavigationItemContent: FC<InternalSideNavigationItemContentProps> = ({
|
|
@@ -76,11 +77,12 @@ export const InternalSideNavigationItemContent: FC<InternalSideNavigationItemCon
|
|
|
76
77
|
);
|
|
77
78
|
|
|
78
79
|
export interface InternalSideNavigationLinkProps
|
|
79
|
-
extends Omit<
|
|
80
|
+
extends Omit<NavigationItemData, 'iconName' | 'counter' | 'tag'>,
|
|
80
81
|
NavigationComponentProps,
|
|
81
82
|
SideNavigationExpandedProps {
|
|
82
83
|
submenuExpanded: boolean | undefined;
|
|
83
84
|
dataPrefix?: string;
|
|
85
|
+
tag: CounterTagProps | undefined;
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
export const internalNavigationContentContainerProps = ({
|
|
@@ -91,7 +93,7 @@ export const internalNavigationContentContainerProps = ({
|
|
|
91
93
|
id,
|
|
92
94
|
isActive,
|
|
93
95
|
prefix,
|
|
94
|
-
}: Omit<SideNavigationTriggerProps, 'isActive'> & { prefix: string; isActive?: any }) => ({
|
|
96
|
+
}: Omit<SideNavigationTriggerProps, 'isActive' | 'tag'> & { prefix: string; isActive?: any }) => ({
|
|
95
97
|
'data-cy': `${prefix}-${id}`,
|
|
96
98
|
'data-pendo': `${prefix}-${id}`,
|
|
97
99
|
'className': classNames(Styles.navigationItem, className, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { FC, ReactElement, useContext } from 'react';
|
|
3
3
|
import { NavigationComponentContext } from '../../utils/navigation-context';
|
|
4
|
+
import { getCounterTag } from '../../utils/side-nav';
|
|
4
5
|
import { SideNavigationLinkProps, SideNavigationTriggerProps } from './interface';
|
|
5
6
|
import { SideNavigationContext } from './side-navigation-context';
|
|
6
7
|
import {
|
|
@@ -27,6 +28,7 @@ export function SideNavigationLink({ wrapper, ...props }: SideNavigationLinkProp
|
|
|
27
28
|
navigationComponent={NavigationComponent}
|
|
28
29
|
submenuExpanded={undefined}
|
|
29
30
|
dataPrefix="navigation-link"
|
|
31
|
+
tag={getCounterTag(props.counter, props.tag)}
|
|
30
32
|
/>
|
|
31
33
|
);
|
|
32
34
|
|
|
@@ -44,7 +46,11 @@ export function SideNavigationTrigger({ wrapper, ...props }: SideNavigationTrigg
|
|
|
44
46
|
isActive: props.isActive,
|
|
45
47
|
})}
|
|
46
48
|
>
|
|
47
|
-
<InternalSideNavigationItemContent
|
|
49
|
+
<InternalSideNavigationItemContent
|
|
50
|
+
submenuExpanded={undefined}
|
|
51
|
+
{...props}
|
|
52
|
+
tag={getCounterTag(props.counter, props.tag)}
|
|
53
|
+
/>
|
|
48
54
|
</div>
|
|
49
55
|
);
|
|
50
56
|
return wrapper ? <WrappedLink wrapper={wrapper}>{element}</WrappedLink> : element;
|