@servicetitan/navigation 12.0.2 → 13.0.0-canary.256.b43c6d7.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/profile-dropdown/{profile-dropdown-tiny.stories.d.ts → profile-dropdown-legacy.stories.d.ts} +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-legacy.stories.d.ts.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +5 -8
- 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/titan-layout/interface.d.ts +14 -12
- 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.js +1 -1
- package/dist/components/titan-layout/layout-header-dark.js.map +1 -1
- package/dist/components/titan-layout/layout-header-links.d.ts +3 -3
- package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links.js.map +1 -1
- package/dist/components/titan-layout/layout-header.d.ts +2 -2
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +5 -0
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.js +1 -7
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +10 -17
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +34 -41
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.d.ts +3 -3
- package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js +13 -13
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +5 -3
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/titan-layout-links.d.ts +5 -0
- package/dist/components/titan-layout/titan-layout-links.d.ts.map +1 -0
- package/dist/components/titan-layout/titan-layout-links.js +34 -0
- package/dist/components/titan-layout/titan-layout-links.js.map +1 -0
- package/dist/components/titan-layout/titan-layout.d.ts +2 -3
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +3 -3
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/test/data.d.ts +27 -2
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +181 -27
- package/dist/test/data.js.map +1 -1
- package/dist/utils/navigation-context.d.ts +3 -22
- package/dist/utils/navigation-context.d.ts.map +1 -1
- package/dist/utils/navigation-context.js +2 -10
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation.d.ts +2 -5
- package/dist/utils/navigation.d.ts.map +1 -1
- package/dist/utils/navigation.js.map +1 -1
- package/package.json +2 -2
- package/src/components/profile-dropdown/{profile-dropdown-tiny.stories.tsx → profile-dropdown-legacy.stories.tsx} +6 -6
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +12 -4
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +16 -9
- package/src/components/profile-dropdown/profile-dropdown.tsx +2 -11
- package/src/components/titan-layout/interface.ts +19 -15
- package/src/components/titan-layout/layout-header-dark.tsx +1 -1
- package/src/components/titan-layout/layout-header-links.tsx +3 -6
- package/src/components/titan-layout/layout-header.module.less +5 -0
- package/src/components/titan-layout/layout-header.tsx +2 -2
- package/src/components/titan-layout/layout-profile.tsx +2 -6
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +69 -81
- package/src/components/titan-layout/layout-sidebar-links.tsx +38 -24
- package/src/components/titan-layout/layout-sidebar.tsx +1 -1
- package/src/components/titan-layout/titan-layout-links.tsx +34 -0
- package/src/components/titan-layout/titan-layout.stories.tsx +34 -33
- package/src/components/titan-layout/titan-layout.tsx +5 -4
- package/src/index.ts +1 -11
- package/src/test/data.tsx +152 -39
- package/src/utils/navigation-context.tsx +9 -35
- package/src/utils/navigation.ts +3 -7
- package/dist/components/header-navigation/header-navigation-content.d.ts +0 -30
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-content.js +0 -58
- package/dist/components/header-navigation/header-navigation-content.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts +0 -9
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +0 -11
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-links.js +0 -62
- package/dist/components/header-navigation/header-navigation-links.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-stories.module.less +0 -6
- package/dist/components/header-navigation/header-navigation-stories.module.less.d.ts +0 -3
- package/dist/components/header-navigation/header-navigation.d.ts +0 -59
- package/dist/components/header-navigation/header-navigation.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation.js +0 -228
- package/dist/components/header-navigation/header-navigation.js.map +0 -1
- package/dist/components/header-navigation/header-navigation.module.less +0 -260
- package/dist/components/header-navigation/header-navigation.module.less.d.ts +0 -22
- package/dist/components/header-navigation/header-navigation.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/index.d.ts +0 -2
- package/dist/components/header-navigation/index.d.ts.map +0 -1
- package/dist/components/header-navigation/index.js +0 -3
- package/dist/components/header-navigation/index.js.map +0 -1
- package/dist/components/header-navigation/with-tooltip.d.ts +0 -4
- package/dist/components/header-navigation/with-tooltip.d.ts.map +0 -1
- package/dist/components/header-navigation/with-tooltip.js +0 -10
- package/dist/components/header-navigation/with-tooltip.js.map +0 -1
- package/dist/components/layout.stories.d.ts +0 -13
- package/dist/components/layout.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts +0 -9
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts +0 -18
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.js +0 -79
- package/dist/components/left-navigation/header-navigation-tiny-links.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.d.ts +0 -23
- package/dist/components/left-navigation/header-navigation-tiny.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.js +0 -32
- package/dist/components/left-navigation/header-navigation-tiny.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.module.less +0 -117
- package/dist/components/left-navigation/header-navigation-tiny.module.less.d.ts +0 -15
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts +0 -12
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/index.d.ts +0 -5
- package/dist/components/left-navigation/index.d.ts.map +0 -1
- package/dist/components/left-navigation/index.js +0 -5
- package/dist/components/left-navigation/index.js.map +0 -1
- package/dist/components/left-navigation/interface-internal.d.ts +0 -10
- package/dist/components/left-navigation/interface-internal.d.ts.map +0 -1
- package/dist/components/left-navigation/interface-internal.js +0 -3
- package/dist/components/left-navigation/interface-internal.js.map +0 -1
- package/dist/components/left-navigation/interface.d.ts +0 -20
- package/dist/components/left-navigation/interface.d.ts.map +0 -1
- package/dist/components/left-navigation/interface.js +0 -3
- package/dist/components/left-navigation/interface.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-context.d.ts +0 -8
- package/dist/components/left-navigation/side-navigation-context.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-context.js +0 -8
- package/dist/components/left-navigation/side-navigation-context.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts +0 -28
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-links-internal.js +0 -89
- package/dist/components/left-navigation/side-navigation-links-internal.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-links.d.ts +0 -6
- package/dist/components/left-navigation/side-navigation-links.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-links.js +0 -48
- package/dist/components/left-navigation/side-navigation-links.js.map +0 -1
- package/dist/components/left-navigation/side-navigation.d.ts +0 -29
- package/dist/components/left-navigation/side-navigation.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation.js +0 -411
- package/dist/components/left-navigation/side-navigation.js.map +0 -1
- package/dist/components/left-navigation/side-navigation.module.less +0 -530
- package/dist/components/left-navigation/side-navigation.module.less.d.ts +0 -48
- package/dist/components/left-navigation/side-navigation.stories.d.ts +0 -17
- package/dist/components/left-navigation/side-navigation.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/with-tooltip.d.ts +0 -4
- package/dist/components/left-navigation/with-tooltip.d.ts.map +0 -1
- package/dist/components/left-navigation/with-tooltip.js +0 -15
- package/dist/components/left-navigation/with-tooltip.js.map +0 -1
- package/dist/components/links.d.ts +0 -5
- package/dist/components/links.d.ts.map +0 -1
- package/dist/components/links.js +0 -35
- package/dist/components/links.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts.map +0 -1
- package/dist/components/titan-layout/layout-profile.stories.d.ts +0 -13
- package/dist/components/titan-layout/layout-profile.stories.d.ts.map +0 -1
- package/src/components/header-navigation/header-navigation-content.tsx +0 -120
- package/src/components/header-navigation/header-navigation-extra-stacked.stories.tsx +0 -19
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +0 -142
- package/src/components/header-navigation/header-navigation-links.tsx +0 -141
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +0 -146
- package/src/components/header-navigation/header-navigation-stories.module.less +0 -6
- package/src/components/header-navigation/header-navigation-stories.module.less.d.ts +0 -3
- package/src/components/header-navigation/header-navigation.module.less +0 -260
- package/src/components/header-navigation/header-navigation.module.less.d.ts +0 -22
- package/src/components/header-navigation/header-navigation.stories.tsx +0 -165
- package/src/components/header-navigation/header-navigation.tsx +0 -327
- package/src/components/header-navigation/index.ts +0 -1
- package/src/components/header-navigation/with-tooltip.tsx +0 -15
- package/src/components/layout.stories.tsx +0 -103
- package/src/components/left-navigation/header-navigation-extra-tiny.stories.tsx +0 -21
- package/src/components/left-navigation/header-navigation-tiny-links.tsx +0 -145
- package/src/components/left-navigation/header-navigation-tiny.module.less +0 -117
- package/src/components/left-navigation/header-navigation-tiny.module.less.d.ts +0 -15
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +0 -178
- package/src/components/left-navigation/header-navigation-tiny.tsx +0 -65
- package/src/components/left-navigation/index.ts +0 -4
- package/src/components/left-navigation/interface-internal.ts +0 -11
- package/src/components/left-navigation/interface.ts +0 -26
- package/src/components/left-navigation/side-navigation-context.tsx +0 -13
- package/src/components/left-navigation/side-navigation-links-internal.tsx +0 -151
- package/src/components/left-navigation/side-navigation-links.tsx +0 -57
- package/src/components/left-navigation/side-navigation.module.less +0 -530
- package/src/components/left-navigation/side-navigation.module.less.d.ts +0 -48
- package/src/components/left-navigation/side-navigation.stories.tsx +0 -226
- package/src/components/left-navigation/side-navigation.tsx +0 -543
- package/src/components/left-navigation/with-tooltip.tsx +0 -16
- package/src/components/links.tsx +0 -54
- package/src/components/titan-layout/layout-profile.stories.tsx +0 -46
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
title: string;
|
|
3
|
-
component: import("react").FC<import("./layout-profile").ProfileDropdownProps> & {
|
|
4
|
-
Divider: import("react").FC;
|
|
5
|
-
Link: import("react").FC<import("./layout-profile").ProfileDropdownLinkProps>;
|
|
6
|
-
Section: import("react").FC<import("./layout-profile").ProfileDropdownSectionProps>;
|
|
7
|
-
};
|
|
8
|
-
decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
|
|
9
|
-
parameters: {};
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
12
|
-
export declare const ProfileDefault: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
//# sourceMappingURL=layout-profile.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout-profile.stories.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/layout-profile.stories.tsx"],"names":[],"mappings":";;;;;;;;;;AAWA,wBAKE;AAEF,eAAO,MAAM,cAAc,+CA2B1B,CAAC"}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { Icon, IconPropsStrict } from '@servicetitan/design-system';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { FC, Fragment, useContext } from 'react';
|
|
4
|
-
import { NavigationComponentContext } from '../../utils/navigation-context';
|
|
5
|
-
import { HeaderNavigationItemData } from '../../utils/navigation-legacy';
|
|
6
|
-
import { getCounterTag } from '../../utils/side-nav';
|
|
7
|
-
import { CounterTag, CounterTagProps } from '../counter-tag';
|
|
8
|
-
import * as Styles from './header-navigation.module.less';
|
|
9
|
-
import { withTooltip } from './with-tooltip';
|
|
10
|
-
|
|
11
|
-
export interface HeaderNavigationItemContentPropsStrict {
|
|
12
|
-
/** item text */
|
|
13
|
-
title?: string;
|
|
14
|
-
/** text component class name */
|
|
15
|
-
titleClassName?: string;
|
|
16
|
-
/** counter tag shown for item */
|
|
17
|
-
tag: CounterTagProps | undefined;
|
|
18
|
-
/** counter component class name */
|
|
19
|
-
counterClassName?: string;
|
|
20
|
-
/** icon component class name */
|
|
21
|
-
iconClassName?: string;
|
|
22
|
-
/** IconComponent custom icon component */
|
|
23
|
-
iconComponent?: FC;
|
|
24
|
-
/** iconName name of anvil icon */
|
|
25
|
-
iconName?: IconPropsStrict['name'];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** Content for navigation items */
|
|
29
|
-
export const HeaderNavigationItemContent: FC<HeaderNavigationItemContentPropsStrict> = ({
|
|
30
|
-
title,
|
|
31
|
-
titleClassName,
|
|
32
|
-
counterClassName,
|
|
33
|
-
iconClassName,
|
|
34
|
-
iconComponent: IconComponent,
|
|
35
|
-
iconName,
|
|
36
|
-
tag,
|
|
37
|
-
}) => {
|
|
38
|
-
const iconClass = classNames(Styles.navigationIcon, iconClassName);
|
|
39
|
-
return (
|
|
40
|
-
<Fragment>
|
|
41
|
-
{IconComponent ? (
|
|
42
|
-
<i className={iconClass}>
|
|
43
|
-
<IconComponent />
|
|
44
|
-
</i>
|
|
45
|
-
) : iconName ? (
|
|
46
|
-
<Icon name={iconName} className={iconClass} />
|
|
47
|
-
) : (
|
|
48
|
-
<i className={iconClass} />
|
|
49
|
-
)}
|
|
50
|
-
|
|
51
|
-
{!!title && (
|
|
52
|
-
<span className={classNames(Styles.navigationItemTitle, titleClassName)}>
|
|
53
|
-
{title}
|
|
54
|
-
</span>
|
|
55
|
-
)}
|
|
56
|
-
|
|
57
|
-
{!!tag && (
|
|
58
|
-
<CounterTag
|
|
59
|
-
data={tag}
|
|
60
|
-
className={classNames(Styles.navigationItemCounter, counterClassName)}
|
|
61
|
-
longClassName={Styles.navigationItemCounterLong}
|
|
62
|
-
/>
|
|
63
|
-
)}
|
|
64
|
-
</Fragment>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
interface HeaderNavigationItemPropsStrict extends HeaderNavigationItemData {
|
|
69
|
-
minimized: boolean;
|
|
70
|
-
main: boolean;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** Navigation main menu item */
|
|
74
|
-
export const HeaderNavigationItem: FC<HeaderNavigationItemPropsStrict> = ({
|
|
75
|
-
id,
|
|
76
|
-
to,
|
|
77
|
-
counter,
|
|
78
|
-
title,
|
|
79
|
-
hint,
|
|
80
|
-
className,
|
|
81
|
-
iconClassName,
|
|
82
|
-
iconComponent,
|
|
83
|
-
iconName,
|
|
84
|
-
isActive,
|
|
85
|
-
main,
|
|
86
|
-
minimized,
|
|
87
|
-
tag,
|
|
88
|
-
}) => {
|
|
89
|
-
const NavigationComponent = useContext(NavigationComponentContext);
|
|
90
|
-
|
|
91
|
-
return withTooltip(
|
|
92
|
-
<NavigationComponent
|
|
93
|
-
data-cy={`navigation-item-${id}`}
|
|
94
|
-
data-pendo={`navigation-item-${id}`}
|
|
95
|
-
key={id}
|
|
96
|
-
to={to}
|
|
97
|
-
title={hint}
|
|
98
|
-
className={classNames(
|
|
99
|
-
Styles.navigationItem,
|
|
100
|
-
main ? Styles.navigationItemMain : Styles.navigationItemOverflow,
|
|
101
|
-
className,
|
|
102
|
-
{
|
|
103
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
104
|
-
}
|
|
105
|
-
)}
|
|
106
|
-
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
107
|
-
activeClassName={Styles.navigationItemActive}
|
|
108
|
-
>
|
|
109
|
-
<HeaderNavigationItemContent
|
|
110
|
-
title={minimized ? undefined : title}
|
|
111
|
-
titleClassName={main ? '' : 'm-l-half'}
|
|
112
|
-
tag={getCounterTag(counter, tag)}
|
|
113
|
-
iconComponent={iconComponent}
|
|
114
|
-
iconClassName={iconClassName}
|
|
115
|
-
iconName={iconName}
|
|
116
|
-
/>
|
|
117
|
-
</NavigationComponent>,
|
|
118
|
-
minimized ? title : undefined
|
|
119
|
-
);
|
|
120
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { withAnvil, withMemoryRouter } from '../../test/data';
|
|
2
|
-
import { HeaderNavigationLink } from '../links';
|
|
3
|
-
import { HeaderNavigationStacked } from './header-navigation';
|
|
4
|
-
|
|
5
|
-
const withHeaderNavigationStacked = (Story: any) => <HeaderNavigationStacked right={<Story />} />;
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Navigation/Extra/Stacked',
|
|
9
|
-
component: HeaderNavigationLink,
|
|
10
|
-
decorators: [withHeaderNavigationStacked, withMemoryRouter, withAnvil],
|
|
11
|
-
parameters: {},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
ExtraWithTooltip,
|
|
16
|
-
ExtraLink,
|
|
17
|
-
ExtraTrigger,
|
|
18
|
-
ExtraWithLabel,
|
|
19
|
-
} from './header-navigation-extra.stories';
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import SvgHelp from '@servicetitan/anvil2/assets/icons/material/round/help_outline.svg';
|
|
2
|
-
import SvgPhone from '@servicetitan/anvil2/assets/icons/material/round/phone.svg';
|
|
3
|
-
import SvgSearch from '@servicetitan/anvil2/assets/icons/material/round/search.svg';
|
|
4
|
-
import { Button, Popover } from '@servicetitan/design-system';
|
|
5
|
-
import { Fragment, useState } from 'react';
|
|
6
|
-
import { withAnvil, withMemoryRouter } from '../../test/data';
|
|
7
|
-
import { HeaderNavigationLink, HeaderNavigationTrigger } from '../links';
|
|
8
|
-
import { HeaderNavigation } from './';
|
|
9
|
-
|
|
10
|
-
const withHeaderNavigation = (Story: any) => (
|
|
11
|
-
<HeaderNavigation rightClassName="m-r-1">
|
|
12
|
-
<Story />
|
|
13
|
-
</HeaderNavigation>
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
title: 'Navigation/Extra/Legacy',
|
|
18
|
-
component: HeaderNavigationLink,
|
|
19
|
-
decorators: [withHeaderNavigation, withMemoryRouter, withAnvil],
|
|
20
|
-
parameters: {},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const ExtraLink = () => (
|
|
24
|
-
<HeaderNavigationLink
|
|
25
|
-
id="search"
|
|
26
|
-
title="Search"
|
|
27
|
-
to="https://google.com"
|
|
28
|
-
target="_blank"
|
|
29
|
-
iconName="search"
|
|
30
|
-
icon={SvgSearch}
|
|
31
|
-
iconActive={undefined}
|
|
32
|
-
hint="Search: for all the questions"
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
export const ExtraTrigger = () => (
|
|
37
|
-
<HeaderNavigationTrigger
|
|
38
|
-
id="dialpad"
|
|
39
|
-
title="Dialpad"
|
|
40
|
-
iconName="phone"
|
|
41
|
-
counter={2}
|
|
42
|
-
tooltip="Phones pro"
|
|
43
|
-
icon={SvgPhone}
|
|
44
|
-
iconActive={undefined}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
export const ExtraWithTooltip = () => (
|
|
49
|
-
<Fragment>
|
|
50
|
-
<HeaderNavigationLink
|
|
51
|
-
id="search"
|
|
52
|
-
title="Search"
|
|
53
|
-
to="https://google.com"
|
|
54
|
-
target="_blank"
|
|
55
|
-
iconName="search"
|
|
56
|
-
icon={SvgSearch}
|
|
57
|
-
iconActive={undefined}
|
|
58
|
-
tooltip="Search: for all the questions"
|
|
59
|
-
hint="Google"
|
|
60
|
-
/>
|
|
61
|
-
|
|
62
|
-
<HeaderNavigationTrigger
|
|
63
|
-
id="dialpad"
|
|
64
|
-
title="Dialpad"
|
|
65
|
-
iconName="phone"
|
|
66
|
-
hint="Dialpad"
|
|
67
|
-
counter={2}
|
|
68
|
-
icon={SvgPhone}
|
|
69
|
-
iconActive={undefined}
|
|
70
|
-
/>
|
|
71
|
-
|
|
72
|
-
<HelpCenterButton />
|
|
73
|
-
</Fragment>
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const HelpCenterButton = () => {
|
|
77
|
-
const [open, setOpen] = useState(false);
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<Popover
|
|
81
|
-
onClickOutside={() => setOpen(false)}
|
|
82
|
-
open={open}
|
|
83
|
-
direction="bl"
|
|
84
|
-
width="xs"
|
|
85
|
-
trigger={
|
|
86
|
-
<Button
|
|
87
|
-
className="c-inherit"
|
|
88
|
-
iconName="help_outline"
|
|
89
|
-
fill="subtle"
|
|
90
|
-
onClick={() => setOpen(true)}
|
|
91
|
-
/>
|
|
92
|
-
}
|
|
93
|
-
portal
|
|
94
|
-
>
|
|
95
|
-
help center
|
|
96
|
-
</Popover>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const HelpTrigger = () => {
|
|
101
|
-
const [active, setActive] = useState(true);
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<HeaderNavigationTrigger
|
|
105
|
-
id="help"
|
|
106
|
-
title="Help"
|
|
107
|
-
iconName="help_outline"
|
|
108
|
-
hint="Help"
|
|
109
|
-
icon={SvgHelp}
|
|
110
|
-
iconActive={undefined}
|
|
111
|
-
label="Live Chat"
|
|
112
|
-
onClick={() => setActive(!active)}
|
|
113
|
-
isActive={active}
|
|
114
|
-
/>
|
|
115
|
-
);
|
|
116
|
-
};
|
|
117
|
-
export const ExtraWithLabel = () => (
|
|
118
|
-
<Fragment>
|
|
119
|
-
<HeaderNavigationLink
|
|
120
|
-
id="search"
|
|
121
|
-
title="Search"
|
|
122
|
-
to="https://google.com"
|
|
123
|
-
target="_blank"
|
|
124
|
-
iconName="search"
|
|
125
|
-
icon={SvgSearch}
|
|
126
|
-
iconActive={undefined}
|
|
127
|
-
tooltip="Search: for all the questions"
|
|
128
|
-
hint="Google"
|
|
129
|
-
/>
|
|
130
|
-
|
|
131
|
-
<HelpTrigger />
|
|
132
|
-
<HeaderNavigationTrigger
|
|
133
|
-
id="dialpad"
|
|
134
|
-
title="Dialpad"
|
|
135
|
-
iconName="phone"
|
|
136
|
-
hint="Dialpad"
|
|
137
|
-
tag={{ value: 2 }}
|
|
138
|
-
icon={SvgPhone}
|
|
139
|
-
iconActive={undefined}
|
|
140
|
-
/>
|
|
141
|
-
</Fragment>
|
|
142
|
-
);
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import { FC, ReactNode, useContext } from 'react';
|
|
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';
|
|
9
|
-
import { HeaderNavigationItemContent } from './header-navigation-content';
|
|
10
|
-
import * as Styles from './header-navigation.module.less';
|
|
11
|
-
import { withTooltip } from './with-tooltip';
|
|
12
|
-
|
|
13
|
-
/** Navigation extra item with link */
|
|
14
|
-
export const HeaderNavigationLink: FC<HeaderNavigationLinkProps> = ({
|
|
15
|
-
id,
|
|
16
|
-
to,
|
|
17
|
-
counter,
|
|
18
|
-
hint,
|
|
19
|
-
tooltip,
|
|
20
|
-
className,
|
|
21
|
-
icon,
|
|
22
|
-
iconActive,
|
|
23
|
-
iconClassName,
|
|
24
|
-
iconComponent,
|
|
25
|
-
iconName,
|
|
26
|
-
isActive,
|
|
27
|
-
label,
|
|
28
|
-
labelClassName,
|
|
29
|
-
tag,
|
|
30
|
-
target,
|
|
31
|
-
title,
|
|
32
|
-
...rest
|
|
33
|
-
}) => {
|
|
34
|
-
const NavigationComponent = useContext(NavigationComponentContext);
|
|
35
|
-
|
|
36
|
-
return withTooltip(
|
|
37
|
-
<NavigationComponent
|
|
38
|
-
data-cy={`navigation-link-${id}`}
|
|
39
|
-
data-pendo={`navigation-link-${id}`}
|
|
40
|
-
{...rest}
|
|
41
|
-
key={id}
|
|
42
|
-
to={to}
|
|
43
|
-
title={hint}
|
|
44
|
-
className={classNames(Styles.navigationLink, Styles.navigationItem, className, {
|
|
45
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
46
|
-
})}
|
|
47
|
-
isActive={typeof isActive === 'function' ? isActive : undefined}
|
|
48
|
-
activeClassName={Styles.navigationItemActive}
|
|
49
|
-
target={target}
|
|
50
|
-
>
|
|
51
|
-
<HeaderNavigationItemContent
|
|
52
|
-
tag={getCounterTag(counter, tag)}
|
|
53
|
-
iconComponent={iconComponent}
|
|
54
|
-
iconClassName={iconClassName}
|
|
55
|
-
iconName={iconName}
|
|
56
|
-
title={label}
|
|
57
|
-
titleClassName={labelClassName}
|
|
58
|
-
/>
|
|
59
|
-
</NavigationComponent>,
|
|
60
|
-
tooltip
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/** Navigation extra item with icon button */
|
|
65
|
-
export const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps> = ({
|
|
66
|
-
id,
|
|
67
|
-
className,
|
|
68
|
-
counter,
|
|
69
|
-
icon,
|
|
70
|
-
iconActive,
|
|
71
|
-
iconClassName,
|
|
72
|
-
iconComponent,
|
|
73
|
-
iconName,
|
|
74
|
-
isActive,
|
|
75
|
-
label,
|
|
76
|
-
labelClassName,
|
|
77
|
-
hint,
|
|
78
|
-
tag,
|
|
79
|
-
tooltip,
|
|
80
|
-
title,
|
|
81
|
-
...rest
|
|
82
|
-
}) => {
|
|
83
|
-
return withTooltip(
|
|
84
|
-
<div
|
|
85
|
-
data-cy={`navigation-trigger-${id}`}
|
|
86
|
-
data-pendo={`navigation-trigger-${id}`}
|
|
87
|
-
{...rest}
|
|
88
|
-
title={hint}
|
|
89
|
-
className={classNames(
|
|
90
|
-
Styles.navigationItem,
|
|
91
|
-
Styles.navigationLink,
|
|
92
|
-
{
|
|
93
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
94
|
-
},
|
|
95
|
-
'cursor-pointer',
|
|
96
|
-
className
|
|
97
|
-
)}
|
|
98
|
-
>
|
|
99
|
-
<HeaderNavigationItemContent
|
|
100
|
-
tag={getCounterTag(counter, tag)}
|
|
101
|
-
iconComponent={iconComponent}
|
|
102
|
-
iconClassName={iconClassName}
|
|
103
|
-
iconName={iconName}
|
|
104
|
-
title={label}
|
|
105
|
-
titleClassName={labelClassName}
|
|
106
|
-
/>
|
|
107
|
-
</div>,
|
|
108
|
-
tooltip
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/** Navigation extra item with custom content */
|
|
113
|
-
export const HeaderNavigationTriggerCustom: FC<
|
|
114
|
-
Omit<
|
|
115
|
-
HeaderNavigationTriggerProps,
|
|
116
|
-
| 'counter'
|
|
117
|
-
| 'iconSize'
|
|
118
|
-
| 'iconName'
|
|
119
|
-
| 'iconComponent'
|
|
120
|
-
| 'iconClassName'
|
|
121
|
-
| 'icon'
|
|
122
|
-
| 'iconActive'
|
|
123
|
-
> & { children: ReactNode }
|
|
124
|
-
> = ({ children, id, className, tooltip, title, ...rest }) =>
|
|
125
|
-
withTooltip(
|
|
126
|
-
<div
|
|
127
|
-
data-cy={`navigation-custom-${id}`}
|
|
128
|
-
data-pendo={`navigation-custom-${id}`}
|
|
129
|
-
{...rest}
|
|
130
|
-
title={title}
|
|
131
|
-
className={classNames(
|
|
132
|
-
Styles.navigationItem,
|
|
133
|
-
Styles.navigationLink,
|
|
134
|
-
'cursor-pointer',
|
|
135
|
-
className
|
|
136
|
-
)}
|
|
137
|
-
>
|
|
138
|
-
{children}
|
|
139
|
-
</div>,
|
|
140
|
-
tooltip
|
|
141
|
-
);
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Input, Stack } from '@servicetitan/design-system';
|
|
2
|
-
import { FC, Fragment } from 'react';
|
|
3
|
-
import { SearchIcon, items, withMemoryRouter } from '../../test/data';
|
|
4
|
-
import { LogoCompanyTitle } from '../logo/logo-company-title';
|
|
5
|
-
import { LogoTitan, LogoTitanTitle } from '../logo/logo-titan-text';
|
|
6
|
-
import { ProfileDropdown } from '../profile-dropdown/profile-dropdown';
|
|
7
|
-
import { HeaderNavigationLink, HeaderNavigationTrigger } from './header-navigation-links';
|
|
8
|
-
import * as Styles from './header-navigation-stories.module.less';
|
|
9
|
-
import { HeaderNavigationStacked } from './';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'Navigation/HeaderNavigationStacked',
|
|
13
|
-
component: HeaderNavigationStacked,
|
|
14
|
-
parameters: {},
|
|
15
|
-
decorators: [withMemoryRouter],
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const SvgIcon = undefined as any;
|
|
19
|
-
|
|
20
|
-
export const DefaultNavigation = () => (
|
|
21
|
-
<HeaderNavigationStacked
|
|
22
|
-
left={<LogoCompanyTitle className="m-l-1" fill="#fff" size="150" />}
|
|
23
|
-
leftClassName="d-f align-items-center"
|
|
24
|
-
items={[
|
|
25
|
-
items.dashboard,
|
|
26
|
-
items.calendar,
|
|
27
|
-
items.calls,
|
|
28
|
-
items.accounting,
|
|
29
|
-
items.dispatch,
|
|
30
|
-
items.fleet,
|
|
31
|
-
]}
|
|
32
|
-
/>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export const WithLogoTextAndOverflow = () => (
|
|
36
|
-
<HeaderNavigationStacked
|
|
37
|
-
left={
|
|
38
|
-
<Stack alignItems="center">
|
|
39
|
-
<LogoTitan mantleFill="#2270EE" size={44} />
|
|
40
|
-
<LogoTitanTitle className="c-white m-l-1">Commercial</LogoTitanTitle>
|
|
41
|
-
</Stack>
|
|
42
|
-
}
|
|
43
|
-
items={[
|
|
44
|
-
items.dashboard,
|
|
45
|
-
items.calendar,
|
|
46
|
-
items.calls,
|
|
47
|
-
items.accounting,
|
|
48
|
-
items.dispatch,
|
|
49
|
-
items.purchasing,
|
|
50
|
-
items.fleet,
|
|
51
|
-
]}
|
|
52
|
-
itemsOverflow={[items.calls, items.accounting, items.purchasing, items.dispatch]}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const TimeZoneOffset: FC = () => (
|
|
57
|
-
<div className="fs-2 ff-default p-r-2">
|
|
58
|
-
<span>EST (-9 hrs)</span>
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
export const WithAllMonolithData = () => (
|
|
63
|
-
<HeaderNavigationStacked
|
|
64
|
-
left={<LogoCompanyTitle className="m-l-1" fill="#fff" size="150" />}
|
|
65
|
-
leftClassName="d-f align-items-center"
|
|
66
|
-
items={[
|
|
67
|
-
items.dashboard,
|
|
68
|
-
items.calendar,
|
|
69
|
-
items.calls,
|
|
70
|
-
items.accounting,
|
|
71
|
-
items.dispatch,
|
|
72
|
-
|
|
73
|
-
items.fleet,
|
|
74
|
-
items.followUps,
|
|
75
|
-
items.inventory,
|
|
76
|
-
|
|
77
|
-
items.marketing,
|
|
78
|
-
items.priceBook,
|
|
79
|
-
items.pointOfSale,
|
|
80
|
-
items.reports,
|
|
81
|
-
]}
|
|
82
|
-
right={
|
|
83
|
-
<Fragment>
|
|
84
|
-
<TimeZoneOffset />
|
|
85
|
-
|
|
86
|
-
<HeaderNavigationLink
|
|
87
|
-
id="search"
|
|
88
|
-
title="Search"
|
|
89
|
-
to="https://google.com"
|
|
90
|
-
target="_blank"
|
|
91
|
-
iconComponent={SearchIcon}
|
|
92
|
-
hint="Search: for all the questions"
|
|
93
|
-
icon={SvgIcon}
|
|
94
|
-
iconActive={SvgIcon}
|
|
95
|
-
/>
|
|
96
|
-
|
|
97
|
-
<HeaderNavigationTrigger
|
|
98
|
-
id="dialpad"
|
|
99
|
-
title="Dialpad"
|
|
100
|
-
iconName="phone"
|
|
101
|
-
tag={{ value: 2 }}
|
|
102
|
-
icon={SvgIcon}
|
|
103
|
-
iconActive={SvgIcon}
|
|
104
|
-
/>
|
|
105
|
-
|
|
106
|
-
<HeaderNavigationTrigger
|
|
107
|
-
id="titanAdvisor"
|
|
108
|
-
title="Titan Advisor"
|
|
109
|
-
iconName="rocket"
|
|
110
|
-
iconClassName={Styles.rocketIcon}
|
|
111
|
-
icon={SvgIcon}
|
|
112
|
-
iconActive={SvgIcon}
|
|
113
|
-
/>
|
|
114
|
-
|
|
115
|
-
<HeaderNavigationLink
|
|
116
|
-
id="settings"
|
|
117
|
-
title="Settings"
|
|
118
|
-
to="https://google.com"
|
|
119
|
-
target="_blank"
|
|
120
|
-
iconName="settings"
|
|
121
|
-
aria-label="search"
|
|
122
|
-
hint="Settings"
|
|
123
|
-
isActive
|
|
124
|
-
icon={SvgIcon}
|
|
125
|
-
iconActive={SvgIcon}
|
|
126
|
-
/>
|
|
127
|
-
|
|
128
|
-
<ProfileDropdown>
|
|
129
|
-
<ProfileDropdown.Link id="tasks" to="https://googgle.com" counter={10}>
|
|
130
|
-
Task Management
|
|
131
|
-
</ProfileDropdown.Link>
|
|
132
|
-
<ProfileDropdown.Divider />
|
|
133
|
-
<ProfileDropdown.Link id="sign-out" to="https://googgle.com" text="Sign Out">
|
|
134
|
-
Sign Out{' '}
|
|
135
|
-
<span className="c-neutral-100 m-l-half t-truncate">James Bond</span>
|
|
136
|
-
</ProfileDropdown.Link>
|
|
137
|
-
<ProfileDropdown.Section id="userid" className="c-neutral-100 fs-1">
|
|
138
|
-
User ID: 007
|
|
139
|
-
</ProfileDropdown.Section>
|
|
140
|
-
</ProfileDropdown>
|
|
141
|
-
</Fragment>
|
|
142
|
-
}
|
|
143
|
-
center={<Input placeholder="Search smth" size="xsmall" className="w-100" />}
|
|
144
|
-
centerClassName="d-f align-items-center"
|
|
145
|
-
/>
|
|
146
|
-
);
|