@servicetitan/navigation 10.6.1 → 11.0.0-canary.237.4cefc6a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +7 -0
- package/src/components/header-navigation/header-navigation-links.tsx +2 -0
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +4 -0
- package/src/components/header-navigation/header-navigation.stories.tsx +5 -0
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +6 -0
- package/src/components/left-navigation/interface.ts +2 -2
- package/src/components/left-navigation/side-navigation-links-internal.tsx +21 -6
- package/src/components/left-navigation/side-navigation.module.less +21 -19
- package/src/components/left-navigation/side-navigation.tsx +15 -8
- package/src/components/links.tsx +33 -13
- package/src/components/logo/logo-company-title.tsx +8 -6
- package/src/components/profile-dropdown/profile-dropdown.module.less +4 -0
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +4 -4
- package/src/components/profile-dropdown/profile-dropdown.tsx +43 -46
- package/src/components/titan-layout/index.ts +5 -0
- package/src/components/titan-layout/interface-internal.ts +6 -0
- package/src/components/titan-layout/interface.ts +26 -0
- package/src/components/titan-layout/layout-context.tsx +30 -0
- package/src/components/titan-layout/layout-header-links.tsx +144 -0
- package/{dist/components/left-navigation/header-navigation-tiny.module.less → src/components/titan-layout/layout-header.module.less} +41 -5
- package/src/components/titan-layout/layout-header.tsx +86 -0
- package/src/components/titan-layout/layout-logo.stories.tsx +31 -0
- package/src/components/titan-layout/layout-logo.tsx +57 -0
- package/src/components/titan-layout/layout-profile.stories.tsx +37 -0
- package/src/components/titan-layout/layout-profile.tsx +116 -0
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +265 -0
- package/src/components/titan-layout/layout-sidebar-links.tsx +56 -0
- package/src/components/titan-layout/layout-sidebar.module.less +528 -0
- package/src/components/titan-layout/layout-sidebar.tsx +298 -0
- package/src/components/titan-layout/titan-layout.module.less +53 -0
- package/src/components/titan-layout/titan-layout.stories.tsx +194 -0
- package/src/components/titan-layout/titan-layout.tsx +270 -0
- package/src/components/titan-layout/with-tooltip.tsx +16 -0
- package/src/index.ts +2 -1
- package/src/test/data.tsx +3 -2
- package/src/utils/navigation-legacy.ts +3 -1
- package/src/utils/use-breakpoint.ts +19 -0
- package/dist/components/badge-tag.d.ts +0 -12
- package/dist/components/badge-tag.d.ts.map +0 -1
- package/dist/components/badge-tag.js +0 -8
- package/dist/components/badge-tag.js.map +0 -1
- package/dist/components/counter-tag.d.ts +0 -12
- package/dist/components/counter-tag.d.ts.map +0 -1
- package/dist/components/counter-tag.js +0 -8
- package/dist/components/counter-tag.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-content.d.ts +0 -30
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-content.js +0 -22
- package/dist/components/header-navigation/header-navigation-content.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts +0 -9
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.js +0 -13
- package/dist/components/header-navigation/header-navigation-extra-stacked.stories.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.js +0 -29
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +0 -11
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-links.js +0 -26
- package/dist/components/header-navigation/header-navigation-links.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js +0 -50
- package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +0 -1
- package/dist/components/header-navigation/header-navigation-stories.module.less +0 -6
- package/dist/components/header-navigation/header-navigation.d.ts +0 -59
- package/dist/components/header-navigation/header-navigation.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation.js +0 -96
- package/dist/components/header-navigation/header-navigation.js.map +0 -1
- package/dist/components/header-navigation/header-navigation.module.less +0 -260
- package/dist/components/header-navigation/header-navigation.stories.d.ts +0 -12
- package/dist/components/header-navigation/header-navigation.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation.stories.js +0 -54
- package/dist/components/header-navigation/header-navigation.stories.js.map +0 -1
- package/dist/components/header-navigation/index.d.ts +0 -2
- package/dist/components/header-navigation/index.d.ts.map +0 -1
- package/dist/components/header-navigation/index.js +0 -2
- package/dist/components/header-navigation/index.js.map +0 -1
- package/dist/components/header-navigation/with-tooltip.d.ts +0 -4
- package/dist/components/header-navigation/with-tooltip.d.ts.map +0 -1
- package/dist/components/header-navigation/with-tooltip.js +0 -4
- package/dist/components/header-navigation/with-tooltip.js.map +0 -1
- package/dist/components/layout.stories.d.ts +0 -13
- package/dist/components/layout.stories.d.ts.map +0 -1
- package/dist/components/layout.stories.js +0 -29
- package/dist/components/layout.stories.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts +0 -9
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.js +0 -13
- package/dist/components/left-navigation/header-navigation-extra-tiny.stories.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts +0 -18
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.js +0 -32
- package/dist/components/left-navigation/header-navigation-tiny-links.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.d.ts +0 -23
- package/dist/components/left-navigation/header-navigation-tiny.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.js +0 -7
- package/dist/components/left-navigation/header-navigation-tiny.js.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts +0 -12
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/header-navigation-tiny.stories.js +0 -30
- package/dist/components/left-navigation/header-navigation-tiny.stories.js.map +0 -1
- package/dist/components/left-navigation/index.d.ts +0 -5
- package/dist/components/left-navigation/index.d.ts.map +0 -1
- package/dist/components/left-navigation/index.js +0 -5
- package/dist/components/left-navigation/index.js.map +0 -1
- package/dist/components/left-navigation/interface-internal.d.ts +0 -10
- package/dist/components/left-navigation/interface-internal.d.ts.map +0 -1
- package/dist/components/left-navigation/interface-internal.js +0 -2
- package/dist/components/left-navigation/interface-internal.js.map +0 -1
- package/dist/components/left-navigation/interface.d.ts +0 -20
- package/dist/components/left-navigation/interface.d.ts.map +0 -1
- package/dist/components/left-navigation/interface.js +0 -2
- package/dist/components/left-navigation/interface.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-context.d.ts +0 -8
- package/dist/components/left-navigation/side-navigation-context.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-context.js +0 -7
- package/dist/components/left-navigation/side-navigation-context.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts +0 -26
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-links-internal.js +0 -29
- package/dist/components/left-navigation/side-navigation-links-internal.js.map +0 -1
- package/dist/components/left-navigation/side-navigation-links.d.ts +0 -6
- package/dist/components/left-navigation/side-navigation-links.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation-links.js +0 -27
- package/dist/components/left-navigation/side-navigation-links.js.map +0 -1
- package/dist/components/left-navigation/side-navigation.d.ts +0 -29
- package/dist/components/left-navigation/side-navigation.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation.js +0 -181
- package/dist/components/left-navigation/side-navigation.js.map +0 -1
- package/dist/components/left-navigation/side-navigation.module.less +0 -528
- package/dist/components/left-navigation/side-navigation.stories.d.ts +0 -17
- package/dist/components/left-navigation/side-navigation.stories.d.ts.map +0 -1
- package/dist/components/left-navigation/side-navigation.stories.js +0 -115
- package/dist/components/left-navigation/side-navigation.stories.js.map +0 -1
- package/dist/components/left-navigation/with-tooltip.d.ts +0 -4
- package/dist/components/left-navigation/with-tooltip.d.ts.map +0 -1
- package/dist/components/left-navigation/with-tooltip.js +0 -4
- package/dist/components/left-navigation/with-tooltip.js.map +0 -1
- package/dist/components/links.d.ts +0 -5
- package/dist/components/links.d.ts.map +0 -1
- package/dist/components/links.js +0 -14
- package/dist/components/links.js.map +0 -1
- package/dist/components/logo/logo-company-title.d.ts +0 -7
- package/dist/components/logo/logo-company-title.d.ts.map +0 -1
- package/dist/components/logo/logo-company-title.js +0 -6
- package/dist/components/logo/logo-company-title.js.map +0 -1
- package/dist/components/logo/logo-titan-text.d.ts +0 -29
- package/dist/components/logo/logo-titan-text.d.ts.map +0 -1
- package/dist/components/logo/logo-titan-text.js +0 -13
- package/dist/components/logo/logo-titan-text.js.map +0 -1
- package/dist/components/logo/logo-titan-text.module.less +0 -31
- package/dist/components/logo/logo-titan.d.ts +0 -9
- package/dist/components/logo/logo-titan.d.ts.map +0 -1
- package/dist/components/logo/logo-titan.js +0 -13
- package/dist/components/logo/logo-titan.js.map +0 -1
- package/dist/components/logo/logo.stories.d.ts +0 -14
- package/dist/components/logo/logo.stories.d.ts.map +0 -1
- package/dist/components/logo/logo.stories.js +0 -20
- package/dist/components/logo/logo.stories.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts +0 -9
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js +0 -13
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts +0 -9
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js +0 -13
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +0 -74
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +0 -86
- package/dist/components/profile-dropdown/profile-dropdown.js.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +0 -167
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts +0 -16
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.map +0 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.js +0 -51
- package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +0 -1
- package/dist/components/profile-dropdown/profile-icon.d.ts +0 -3
- package/dist/components/profile-dropdown/profile-icon.d.ts.map +0 -1
- package/dist/components/profile-dropdown/profile-icon.js +0 -5
- package/dist/components/profile-dropdown/profile-icon.js.map +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/test/data-stories.module.less +0 -8
- package/dist/test/data.d.ts +0 -32
- package/dist/test/data.d.ts.map +0 -1
- package/dist/test/data.js +0 -244
- package/dist/test/data.js.map +0 -1
- package/dist/utils/counter-tag.d.ts +0 -5
- package/dist/utils/counter-tag.d.ts.map +0 -1
- package/dist/utils/counter-tag.js +0 -2
- package/dist/utils/counter-tag.js.map +0 -1
- package/dist/utils/navigation-context.d.ts +0 -27
- package/dist/utils/navigation-context.d.ts.map +0 -1
- package/dist/utils/navigation-context.js +0 -10
- package/dist/utils/navigation-context.js.map +0 -1
- package/dist/utils/navigation-legacy.d.ts +0 -86
- package/dist/utils/navigation-legacy.d.ts.map +0 -1
- package/dist/utils/navigation-legacy.js +0 -2
- package/dist/utils/navigation-legacy.js.map +0 -1
- package/dist/utils/navigation.d.ts +0 -48
- package/dist/utils/navigation.d.ts.map +0 -1
- package/dist/utils/navigation.js +0 -2
- package/dist/utils/navigation.js.map +0 -1
- package/dist/utils/side-nav.d.ts +0 -6
- package/dist/utils/side-nav.d.ts.map +0 -1
- package/dist/utils/side-nav.js +0 -28
- package/dist/utils/side-nav.js.map +0 -1
- package/src/components/header-navigation/header-navigation-stories.module.less.d.ts +0 -3
- package/src/components/header-navigation/header-navigation.module.less.d.ts +0 -22
- package/src/components/left-navigation/header-navigation-tiny.module.less.d.ts +0 -15
- package/src/components/left-navigation/side-navigation.module.less.d.ts +0 -47
- package/src/components/logo/logo-titan-text.module.less.d.ts +0 -6
- package/src/components/profile-dropdown/profile-dropdown.module.less.d.ts +0 -21
- package/src/test/data-stories.module.less.d.ts +0 -3
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import {
|
|
3
|
+
CSSProperties,
|
|
4
|
+
Children,
|
|
5
|
+
ComponentPropsWithoutRef,
|
|
6
|
+
FC,
|
|
7
|
+
Fragment,
|
|
8
|
+
ReactElement,
|
|
9
|
+
ReactNode,
|
|
10
|
+
isValidElement,
|
|
11
|
+
useCallback,
|
|
12
|
+
useEffect,
|
|
13
|
+
useMemo,
|
|
14
|
+
useState,
|
|
15
|
+
} from 'react';
|
|
16
|
+
import { NavigationItemData } from '../../utils/navigation';
|
|
17
|
+
import { DefaultNavLinkComponent, NavLinkComponentProps } from '../../utils/navigation-context';
|
|
18
|
+
import { useTitanBreakpoint } from '../../utils/use-breakpoint';
|
|
19
|
+
import { TitanLayoutState } from './interface';
|
|
20
|
+
import {
|
|
21
|
+
LayoutContext,
|
|
22
|
+
LayoutPlacementContext,
|
|
23
|
+
TitanLayoutContextType,
|
|
24
|
+
TitanLayoutSidebarContextType,
|
|
25
|
+
} from './layout-context';
|
|
26
|
+
import { LayoutHeader } from './layout-header';
|
|
27
|
+
import { TitanLayoutLogo, TitanLayoutLogoProps } from './layout-logo';
|
|
28
|
+
import { LayoutSidebar } from './layout-sidebar';
|
|
29
|
+
import { TitanLayoutSidebarLink, TitanLayoutSidebarTrigger } from './layout-sidebar-links';
|
|
30
|
+
import { InternalSideNavigationTrigger } from './layout-sidebar-links-internal';
|
|
31
|
+
import * as Styles from './titan-layout.module.less';
|
|
32
|
+
|
|
33
|
+
type TitanLayoutChild = ReactElement<TitanLayoutContentProps> | ReactElement<TitanLayoutLogoProps>;
|
|
34
|
+
|
|
35
|
+
export type TitanLayoutProps = Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'style'> & {
|
|
36
|
+
empty?: boolean;
|
|
37
|
+
|
|
38
|
+
appearance?: 'legacy' | 'anvil1' | 'anvil2';
|
|
39
|
+
|
|
40
|
+
/** component used for navigation */
|
|
41
|
+
navigationComponent?: FC<NavLinkComponentProps>;
|
|
42
|
+
|
|
43
|
+
/** data for main navigation links */
|
|
44
|
+
navigationMainItems?: NavigationItemData[];
|
|
45
|
+
|
|
46
|
+
/** layout's content */
|
|
47
|
+
children?: TitanLayoutChild | TitanLayoutChild[];
|
|
48
|
+
|
|
49
|
+
state?: TitanLayoutState;
|
|
50
|
+
onStateChange?: (state: TitanLayoutState) => void;
|
|
51
|
+
|
|
52
|
+
header?: ReactElement;
|
|
53
|
+
profile?: ReactElement;
|
|
54
|
+
extraLinks?: ReactElement;
|
|
55
|
+
extraLinksTop?: ReactElement;
|
|
56
|
+
extraText?: string;
|
|
57
|
+
sidebarTop?: ReactElement[];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const defaultSidebarContext: TitanLayoutSidebarContextType = {
|
|
61
|
+
styles: {
|
|
62
|
+
popoverContent: {
|
|
63
|
+
'--background-color-strong': '#24323C',
|
|
64
|
+
'color': 'var(--color-white)',
|
|
65
|
+
} as CSSProperties,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const useVariant = (appearance: TitanLayoutProps['appearance']) =>
|
|
70
|
+
useMemo(() => {
|
|
71
|
+
const isLegacy = appearance === 'legacy';
|
|
72
|
+
const isAnvil1 = appearance === 'anvil1';
|
|
73
|
+
const isAnvil2 = appearance === 'anvil2';
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
isLegacy,
|
|
77
|
+
isAnvil1,
|
|
78
|
+
isAnvil2,
|
|
79
|
+
isSequent: isLegacy || isAnvil1,
|
|
80
|
+
};
|
|
81
|
+
}, [appearance]);
|
|
82
|
+
|
|
83
|
+
const useLayoutChildren = (children: TitanLayoutProps['children']) =>
|
|
84
|
+
useMemo(
|
|
85
|
+
() =>
|
|
86
|
+
Children.toArray(children).reduce(
|
|
87
|
+
(out, item) => {
|
|
88
|
+
if (
|
|
89
|
+
item &&
|
|
90
|
+
isValidElement(item) &&
|
|
91
|
+
item.type &&
|
|
92
|
+
typeof item.type !== 'string'
|
|
93
|
+
) {
|
|
94
|
+
if (item.type.name === TitanLayoutContent.name) {
|
|
95
|
+
out.content = item as any;
|
|
96
|
+
} else if (item.type.name === TitanLayoutLogo.name) {
|
|
97
|
+
out.logo = item as any;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
logo: <TitanLayoutLogo />,
|
|
104
|
+
} as {
|
|
105
|
+
content?: ReactElement<TitanLayoutContentProps>;
|
|
106
|
+
logo: ReactElement<TitanLayoutLogoProps>;
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
[children]
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const TitanLayoutComponent: FC<TitanLayoutProps> = ({
|
|
113
|
+
appearance = 'anvil2',
|
|
114
|
+
id,
|
|
115
|
+
children,
|
|
116
|
+
navigationComponent,
|
|
117
|
+
header,
|
|
118
|
+
profile,
|
|
119
|
+
state,
|
|
120
|
+
onStateChange,
|
|
121
|
+
navigationMainItems,
|
|
122
|
+
extraLinks,
|
|
123
|
+
extraLinksTop,
|
|
124
|
+
extraText,
|
|
125
|
+
sidebarTop,
|
|
126
|
+
}) => {
|
|
127
|
+
const breakpoint = useTitanBreakpoint();
|
|
128
|
+
const isMobile = breakpoint.isMobile;
|
|
129
|
+
const context: TitanLayoutContextType = useMemo(
|
|
130
|
+
() => ({
|
|
131
|
+
NavigationComponent: navigationComponent ?? DefaultNavLinkComponent,
|
|
132
|
+
breakpoint,
|
|
133
|
+
isTitanLayout: true,
|
|
134
|
+
sidebar: defaultSidebarContext,
|
|
135
|
+
}),
|
|
136
|
+
[navigationComponent, breakpoint]
|
|
137
|
+
);
|
|
138
|
+
const variant = useVariant(appearance);
|
|
139
|
+
const [mobileDrawerOpened, setMobileDrawerOpened] = useState(false);
|
|
140
|
+
const { content, logo } = useLayoutChildren(children);
|
|
141
|
+
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (!isMobile) {
|
|
144
|
+
setMobileDrawerOpened(false);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const listener = () => {
|
|
149
|
+
setMobileDrawerOpened(false);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
document.addEventListener('click', listener);
|
|
153
|
+
|
|
154
|
+
return () => document.removeEventListener('click', listener);
|
|
155
|
+
}, [isMobile]);
|
|
156
|
+
|
|
157
|
+
const onBurgerClick = useCallback((e: MouseEvent) => {
|
|
158
|
+
setMobileDrawerOpened(true);
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
}, []);
|
|
161
|
+
|
|
162
|
+
const onBarExpandChange = useCallback(
|
|
163
|
+
(expanded: boolean) => {
|
|
164
|
+
if (isMobile) {
|
|
165
|
+
setMobileDrawerOpened(false);
|
|
166
|
+
} else {
|
|
167
|
+
onStateChange?.({ navCollapsed: !expanded });
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
[onStateChange, isMobile]
|
|
171
|
+
);
|
|
172
|
+
const onSubmenuExpandChange = useCallback(
|
|
173
|
+
(id: string, expanded: boolean) => {
|
|
174
|
+
onStateChange?.({
|
|
175
|
+
navCollapsed: state?.navCollapsed ?? false,
|
|
176
|
+
submenuExpanded: expanded ? id : undefined,
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
[state, onStateChange]
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
const [layoutStyles] = useState<object>({});
|
|
183
|
+
|
|
184
|
+
const layoutClass = variant.isLegacy
|
|
185
|
+
? Styles.layoutLegacy
|
|
186
|
+
: variant.isAnvil1
|
|
187
|
+
? Styles.layoutAnvil1
|
|
188
|
+
: Styles.layoutAnvil2;
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<LayoutContext.Provider value={context}>
|
|
192
|
+
<LayoutPlacementContext.Provider value="unset">
|
|
193
|
+
<div
|
|
194
|
+
id={id}
|
|
195
|
+
className={classNames(
|
|
196
|
+
Styles.layout,
|
|
197
|
+
isMobile
|
|
198
|
+
? Styles.layoutMobile
|
|
199
|
+
: state?.navCollapsed
|
|
200
|
+
? Styles.layoutNavSlim
|
|
201
|
+
: Styles.layoutNavWide,
|
|
202
|
+
layoutClass
|
|
203
|
+
)}
|
|
204
|
+
style={layoutStyles}
|
|
205
|
+
>
|
|
206
|
+
{variant.isSequent && <div className={Styles.topPlaceholder} />}
|
|
207
|
+
<LayoutHeader
|
|
208
|
+
className={Styles.top}
|
|
209
|
+
logo={logo}
|
|
210
|
+
profile={isMobile ? undefined : profile}
|
|
211
|
+
center={header}
|
|
212
|
+
rightText={isMobile ? undefined : extraText}
|
|
213
|
+
right={
|
|
214
|
+
<Fragment>
|
|
215
|
+
{extraLinksTop}
|
|
216
|
+
{!isMobile && extraLinks}
|
|
217
|
+
</Fragment>
|
|
218
|
+
}
|
|
219
|
+
onBurgerClick={onBurgerClick}
|
|
220
|
+
/>
|
|
221
|
+
|
|
222
|
+
<LayoutSidebar
|
|
223
|
+
flex={!variant.isSequent}
|
|
224
|
+
mobile={breakpoint.isMobile}
|
|
225
|
+
barExpanded={isMobile ? mobileDrawerOpened : !state?.navCollapsed}
|
|
226
|
+
submenuExpanded={state?.submenuExpanded}
|
|
227
|
+
onBarExpandChange={onBarExpandChange}
|
|
228
|
+
onSubmenuExpandChange={onSubmenuExpandChange}
|
|
229
|
+
top={sidebarTop}
|
|
230
|
+
mainItems={navigationMainItems}
|
|
231
|
+
navigationComponent={context.NavigationComponent}
|
|
232
|
+
bottom={
|
|
233
|
+
isMobile ? (
|
|
234
|
+
<Fragment>
|
|
235
|
+
{profile}
|
|
236
|
+
{extraLinks}
|
|
237
|
+
{!!extraText && (
|
|
238
|
+
<InternalSideNavigationTrigger
|
|
239
|
+
id="__extra_text"
|
|
240
|
+
title={extraText}
|
|
241
|
+
submenuExpanded={undefined}
|
|
242
|
+
dataPrefix="navigation-extra-text"
|
|
243
|
+
tag={undefined}
|
|
244
|
+
icon={undefined}
|
|
245
|
+
iconActive={undefined}
|
|
246
|
+
/>
|
|
247
|
+
)}
|
|
248
|
+
</Fragment>
|
|
249
|
+
) : undefined
|
|
250
|
+
}
|
|
251
|
+
/>
|
|
252
|
+
|
|
253
|
+
{content}
|
|
254
|
+
</div>
|
|
255
|
+
</LayoutPlacementContext.Provider>
|
|
256
|
+
</LayoutContext.Provider>
|
|
257
|
+
);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export interface TitanLayoutContentProps {
|
|
261
|
+
children: ReactNode;
|
|
262
|
+
}
|
|
263
|
+
const TitanLayoutContent: FC<TitanLayoutContentProps> = ({ children }) => children;
|
|
264
|
+
|
|
265
|
+
export const TitanLayout = Object.assign(TitanLayoutComponent, {
|
|
266
|
+
Content: TitanLayoutContent,
|
|
267
|
+
Logo: TitanLayoutLogo,
|
|
268
|
+
SidebarLink: TitanLayoutSidebarLink,
|
|
269
|
+
SidebarTrigger: TitanLayoutSidebarTrigger,
|
|
270
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Tooltip, TooltipProps } from '@servicetitan/anvil2';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
export const withTooltip = (
|
|
5
|
+
element: ReactElement,
|
|
6
|
+
tooltip: string | undefined,
|
|
7
|
+
placement: TooltipProps['placement'] = 'bottom'
|
|
8
|
+
) =>
|
|
9
|
+
tooltip ? (
|
|
10
|
+
<Tooltip placement={placement}>
|
|
11
|
+
<Tooltip.Content>{tooltip}</Tooltip.Content>
|
|
12
|
+
<Tooltip.Trigger>{element}</Tooltip.Trigger>
|
|
13
|
+
</Tooltip>
|
|
14
|
+
) : (
|
|
15
|
+
element
|
|
16
|
+
);
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from './components/header-navigation';
|
|
2
|
-
export * from './components/profile-dropdown/profile-dropdown';
|
|
3
2
|
export * from './components/logo/logo-company-title';
|
|
4
3
|
export * from './components/logo/logo-titan';
|
|
5
4
|
export * from './components/logo/logo-titan-text';
|
|
6
5
|
export * from './components/counter-tag';
|
|
7
6
|
export * from './components/left-navigation';
|
|
7
|
+
export * from './components/titan-layout';
|
|
8
8
|
export * from './components/links';
|
|
9
9
|
export * from './utils/navigation';
|
|
10
10
|
export {
|
|
@@ -17,3 +17,4 @@ export {
|
|
|
17
17
|
NavigationActiveLinkMatcher,
|
|
18
18
|
} from './utils/navigation-context';
|
|
19
19
|
export * from './utils/navigation-legacy';
|
|
20
|
+
export * from './utils/use-breakpoint';
|
package/src/test/data.tsx
CHANGED
|
@@ -154,7 +154,7 @@ const getItem = (
|
|
|
154
154
|
hint: id,
|
|
155
155
|
icon: undefined,
|
|
156
156
|
iconActive: undefined,
|
|
157
|
-
...
|
|
157
|
+
...data,
|
|
158
158
|
submenu: data.submenu
|
|
159
159
|
? {
|
|
160
160
|
...data.submenu,
|
|
@@ -176,7 +176,7 @@ const getSubItem = (
|
|
|
176
176
|
id,
|
|
177
177
|
to: id,
|
|
178
178
|
title: id[0].toUpperCase() + id.substring(1),
|
|
179
|
-
...
|
|
179
|
+
...data,
|
|
180
180
|
});
|
|
181
181
|
|
|
182
182
|
const getGroup = (
|
|
@@ -339,6 +339,7 @@ export const CallsNavigationTrigger = () => {
|
|
|
339
339
|
id="dialpad"
|
|
340
340
|
iconName="phone"
|
|
341
341
|
counter={2}
|
|
342
|
+
title="Calls"
|
|
342
343
|
icon={SvgPhone}
|
|
343
344
|
iconActive={SvgPhoneActive}
|
|
344
345
|
onClick={() => setOpen(!open)}
|
|
@@ -54,6 +54,8 @@ export interface HeaderNavigationItemLinkProps {
|
|
|
54
54
|
export interface HeaderNavigationTriggerPropsStrict {
|
|
55
55
|
/** unique identifier */
|
|
56
56
|
id: string;
|
|
57
|
+
/** item title (used for mobile) */
|
|
58
|
+
title: string;
|
|
57
59
|
/** tooltip text */
|
|
58
60
|
tooltip?: string;
|
|
59
61
|
/** item description */
|
|
@@ -80,7 +82,7 @@ export interface HeaderNavigationTriggerPropsStrict {
|
|
|
80
82
|
/** svg icon (anvil2) of inactive item */
|
|
81
83
|
icon: IconProps['svg'] | undefined;
|
|
82
84
|
/** svg icon (anvil2) of active item */
|
|
83
|
-
iconActive
|
|
85
|
+
iconActive?: IconProps['svg'];
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
export interface HeaderNavigationTriggerProps extends HeaderNavigationTriggerPropsStrict {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BreakpointReturnProps, useBreakpoint } from '@servicetitan/anvil2';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface TitanBreakpoint {
|
|
5
|
+
name: BreakpointReturnProps['name'];
|
|
6
|
+
isMobile: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const useTitanBreakpoint = (): TitanBreakpoint => {
|
|
10
|
+
const breakpoint = useBreakpoint();
|
|
11
|
+
|
|
12
|
+
return useMemo(
|
|
13
|
+
() => ({
|
|
14
|
+
name: breakpoint?.name ?? 'xl',
|
|
15
|
+
isMobile: breakpoint ? breakpoint.innerWidth <= 768 : false,
|
|
16
|
+
}),
|
|
17
|
+
[breakpoint]
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { CounterTagData } from '../utils/counter-tag';
|
|
3
|
-
export interface BadgeTagProps extends CounterTagData {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
className: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const BadgeTag: FC<{
|
|
8
|
-
className?: string;
|
|
9
|
-
longClassName?: string;
|
|
10
|
-
data: BadgeTagProps | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=badge-tag.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"badge-tag.d.ts","sourceRoot":"","sources":["../../src/components/badge-tag.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,aAAc,SAAQ,cAAc;IACjD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC;CACnC,CAeA,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Badge } from '@servicetitan/anvil2';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
export const BadgeTag = ({ className, data, longClassName }) => {
|
|
5
|
-
const { value, className: dataClassName, ...rest } = data !== null && data !== void 0 ? data : {};
|
|
6
|
-
return value ? (_jsx(Badge, { ...rest, className: classNames(className, dataClassName, typeof value === 'number' && value >= 100 && longClassName), children: typeof value === 'number' ? (value >= 100 ? '99+' : value) : undefined })) : null;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=badge-tag.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"badge-tag.js","sourceRoot":"","sources":["../../src/components/badge-tag.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,UAAU,MAAM,YAAY,CAAC;AASpC,MAAM,CAAC,MAAM,QAAQ,GAIhB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE;IACxC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;IAEhE,OAAO,KAAK,CAAC,CAAC,CAAC,CACX,KAAC,KAAK,OACE,IAAI,EACR,SAAS,EAAE,UAAU,CACjB,SAAS,EACT,aAAa,EACb,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,GAAG,IAAI,aAAa,CAC7D,YAEA,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,GACnE,CACX,CAAC,CAAC,CAAC,IAAI,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { CounterTagData } from '../utils/counter-tag';
|
|
3
|
-
export interface CounterTagProps extends CounterTagData {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
className: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const CounterTag: FC<{
|
|
8
|
-
className?: string;
|
|
9
|
-
longClassName?: string;
|
|
10
|
-
data: CounterTagProps | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
//# sourceMappingURL=counter-tag.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"counter-tag.d.ts","sourceRoot":"","sources":["../../src/components/counter-tag.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACnD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,eAAe,GAAG,SAAS,CAAC;CACrC,CAkBA,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Tag } from '@servicetitan/design-system';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
export const CounterTag = ({ className, data, longClassName }) => {
|
|
5
|
-
const { value, className: dataClassName, ...rest } = data !== null && data !== void 0 ? data : {};
|
|
6
|
-
return value ? (_jsx(Tag, { color: "critical", ...rest, className: classNames(className, dataClassName, typeof value === 'number' && value > 10 && longClassName), compact: true, badge: true, children: value })) : null;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=counter-tag.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"counter-tag.js","sourceRoot":"","sources":["../../src/components/counter-tag.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAClD,OAAO,UAAU,MAAM,YAAY,CAAC;AASpC,MAAM,CAAC,MAAM,UAAU,GAIlB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE;IACxC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;IAEhE,OAAO,KAAK,CAAC,CAAC,CAAC,CACX,KAAC,GAAG,IACA,KAAK,EAAC,UAAU,KACZ,IAAI,EACR,SAAS,EAAE,UAAU,CACjB,SAAS,EACT,aAAa,EACb,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,EAAE,IAAI,aAAa,CAC3D,EACD,OAAO,QACP,KAAK,kBAEJ,KAAK,GACJ,CACT,CAAC,CAAC,CAAC,IAAI,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { IconPropsStrict } from '@servicetitan/design-system';
|
|
2
|
-
import { FC } from 'react';
|
|
3
|
-
import { HeaderNavigationItemData } from '../../utils/navigation-legacy';
|
|
4
|
-
import { CounterTagProps } from '../counter-tag';
|
|
5
|
-
export interface HeaderNavigationItemContentPropsStrict {
|
|
6
|
-
/** item text */
|
|
7
|
-
title?: string;
|
|
8
|
-
/** text component class name */
|
|
9
|
-
titleClassName?: string;
|
|
10
|
-
/** counter tag shown for item */
|
|
11
|
-
tag: CounterTagProps | undefined;
|
|
12
|
-
/** counter component class name */
|
|
13
|
-
counterClassName?: string;
|
|
14
|
-
/** icon component class name */
|
|
15
|
-
iconClassName?: string;
|
|
16
|
-
/** IconComponent custom icon component */
|
|
17
|
-
iconComponent?: FC;
|
|
18
|
-
/** iconName name of anvil icon */
|
|
19
|
-
iconName?: IconPropsStrict['name'];
|
|
20
|
-
}
|
|
21
|
-
/** Content for navigation items */
|
|
22
|
-
export declare const HeaderNavigationItemContent: FC<HeaderNavigationItemContentPropsStrict>;
|
|
23
|
-
interface HeaderNavigationItemPropsStrict extends HeaderNavigationItemData {
|
|
24
|
-
minimized: boolean;
|
|
25
|
-
main: boolean;
|
|
26
|
-
}
|
|
27
|
-
/** Navigation main menu item */
|
|
28
|
-
export declare const HeaderNavigationItem: FC<HeaderNavigationItemPropsStrict>;
|
|
29
|
-
export {};
|
|
30
|
-
//# sourceMappingURL=header-navigation-content.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header-navigation-content.d.ts","sourceRoot":"","sources":["../../../src/components/header-navigation/header-navigation-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,EAAE,EAAE,EAAwB,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAc,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAI7D,MAAM,WAAW,sCAAsC;IACnD,gBAAgB;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,GAAG,EAAE,eAAe,GAAG,SAAS,CAAC;IACjC,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gCAAgC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,EAAE,CAAC;IACnB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;CACtC;AAED,mCAAmC;AACnC,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAAC,sCAAsC,CAqClF,CAAC;AAEF,UAAU,+BAAgC,SAAQ,wBAAwB;IACtE,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,gCAAgC;AAChC,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,+BAA+B,CA8CpE,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Icon } from '@servicetitan/design-system';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import { Fragment, useContext } from 'react';
|
|
5
|
-
import { NavigationComponentContext } from '../../utils/navigation-context';
|
|
6
|
-
import { getCounterTag } from '../../utils/side-nav';
|
|
7
|
-
import { CounterTag } from '../counter-tag';
|
|
8
|
-
import * as Styles from './header-navigation.module.less';
|
|
9
|
-
import { withTooltip } from './with-tooltip';
|
|
10
|
-
/** Content for navigation items */
|
|
11
|
-
export const HeaderNavigationItemContent = ({ title, titleClassName, counterClassName, iconClassName, iconComponent: IconComponent, iconName, tag, }) => {
|
|
12
|
-
const iconClass = classNames(Styles.navigationIcon, iconClassName);
|
|
13
|
-
return (_jsxs(Fragment, { children: [IconComponent ? (_jsx("i", { className: iconClass, children: _jsx(IconComponent, {}) })) : iconName ? (_jsx(Icon, { name: iconName, className: iconClass })) : (_jsx("i", { className: iconClass })), !!title && (_jsx("span", { className: classNames(Styles.navigationItemTitle, titleClassName), children: title })), !!tag && (_jsx(CounterTag, { data: tag, className: classNames(Styles.navigationItemCounter, counterClassName), longClassName: Styles.navigationItemCounterLong }))] }));
|
|
14
|
-
};
|
|
15
|
-
/** Navigation main menu item */
|
|
16
|
-
export const HeaderNavigationItem = ({ id, to, counter, title, hint, className, iconClassName, iconComponent, iconName, isActive, main, minimized, tag, }) => {
|
|
17
|
-
const NavigationComponent = useContext(NavigationComponentContext);
|
|
18
|
-
return withTooltip(_jsx(NavigationComponent, { "data-cy": `navigation-item-${id}`, "data-pendo": `navigation-item-${id}`, to: to, title: hint, className: classNames(Styles.navigationItem, main ? Styles.navigationItemMain : Styles.navigationItemOverflow, className, {
|
|
19
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
20
|
-
}), isActive: typeof isActive === 'function' ? isActive : undefined, activeClassName: Styles.navigationItemActive, children: _jsx(HeaderNavigationItemContent, { title: minimized ? undefined : title, titleClassName: main ? '' : 'm-l-half', tag: getCounterTag(counter, tag), iconComponent: iconComponent, iconClassName: iconClassName, iconName: iconName }) }, id), minimized ? title : undefined);
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=header-navigation-content.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header-navigation-content.js","sourceRoot":"","sources":["../../../src/components/header-navigation/header-navigation-content.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
title: string;
|
|
3
|
-
component: import("react").FC<import("../..").HeaderNavigationLinkProps>;
|
|
4
|
-
decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
|
|
5
|
-
parameters: {};
|
|
6
|
-
};
|
|
7
|
-
export default _default;
|
|
8
|
-
export { ExtraWithTooltip, ExtraLink, ExtraTrigger, ExtraWithLabel, } from './header-navigation-extra.stories';
|
|
9
|
-
//# sourceMappingURL=header-navigation-extra-stacked.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header-navigation-extra-stacked.stories.d.ts","sourceRoot":"","sources":["../../../src/components/header-navigation/header-navigation-extra-stacked.stories.tsx"],"names":[],"mappings":";;;;;;AAMA,wBAKE;AAEF,OAAO,EACH,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,cAAc,GACjB,MAAM,mCAAmC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { withAnvil, withMemoryRouter } from '../../test/data';
|
|
3
|
-
import { HeaderNavigationLink } from '../links';
|
|
4
|
-
import { HeaderNavigationStacked } from './header-navigation';
|
|
5
|
-
const withHeaderNavigationStacked = (Story) => _jsx(HeaderNavigationStacked, { right: _jsx(Story, {}) });
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Navigation/Extra/Stacked',
|
|
8
|
-
component: HeaderNavigationLink,
|
|
9
|
-
decorators: [withHeaderNavigationStacked, withMemoryRouter, withAnvil],
|
|
10
|
-
parameters: {},
|
|
11
|
-
};
|
|
12
|
-
export { ExtraWithTooltip, ExtraLink, ExtraTrigger, ExtraWithLabel, } from './header-navigation-extra.stories';
|
|
13
|
-
//# sourceMappingURL=header-navigation-extra-stacked.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header-navigation-extra-stacked.stories.js","sourceRoot":"","sources":["../../../src/components/header-navigation/header-navigation-extra-stacked.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,2BAA2B,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,KAAC,uBAAuB,IAAC,KAAK,EAAE,KAAC,KAAK,KAAG,GAAI,CAAC;AAElG,eAAe;IACX,KAAK,EAAE,0BAA0B;IACjC,SAAS,EAAE,oBAAoB;IAC/B,UAAU,EAAE,CAAC,2BAA2B,EAAE,gBAAgB,EAAE,SAAS,CAAC;IACtE,UAAU,EAAE,EAAE;CACjB,CAAC;AAEF,OAAO,EACH,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,cAAc,GACjB,MAAM,mCAAmC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
title: string;
|
|
3
|
-
component: import("react").FC<import("../..").HeaderNavigationLinkProps>;
|
|
4
|
-
decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
|
|
5
|
-
parameters: {};
|
|
6
|
-
};
|
|
7
|
-
export default _default;
|
|
8
|
-
export declare const ExtraLink: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare const ExtraTrigger: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare const ExtraWithTooltip: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare const ExtraWithLabel: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
//# sourceMappingURL=header-navigation-extra.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header-navigation-extra.stories.d.ts","sourceRoot":"","sources":["../../../src/components/header-navigation/header-navigation-extra.stories.tsx"],"names":[],"mappings":";;;;;;AAeA,wBAKE;AAEF,eAAO,MAAM,SAAS,+CAUrB,CAAC;AAEF,eAAO,MAAM,YAAY,+CASxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+CAwB5B,CAAC;AA0CF,eAAO,MAAM,cAAc,+CAuB1B,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import SvgHelp from '@servicetitan/anvil2/assets/icons/material/round/help_outline.svg';
|
|
3
|
-
import SvgPhone from '@servicetitan/anvil2/assets/icons/material/round/phone.svg';
|
|
4
|
-
import SvgSearch from '@servicetitan/anvil2/assets/icons/material/round/search.svg';
|
|
5
|
-
import { Button, Popover } from '@servicetitan/design-system';
|
|
6
|
-
import { Fragment, useState } from 'react';
|
|
7
|
-
import { withAnvil, withMemoryRouter } from '../../test/data';
|
|
8
|
-
import { HeaderNavigationLink, HeaderNavigationTrigger } from '../links';
|
|
9
|
-
import { HeaderNavigation } from './';
|
|
10
|
-
const withHeaderNavigation = (Story) => (_jsx(HeaderNavigation, { rightClassName: "m-r-1", children: _jsx(Story, {}) }));
|
|
11
|
-
export default {
|
|
12
|
-
title: 'Navigation/Extra/Legacy',
|
|
13
|
-
component: HeaderNavigationLink,
|
|
14
|
-
decorators: [withHeaderNavigation, withMemoryRouter, withAnvil],
|
|
15
|
-
parameters: {},
|
|
16
|
-
};
|
|
17
|
-
export const ExtraLink = () => (_jsx(HeaderNavigationLink, { id: "search", to: "https://google.com", target: "_blank", iconName: "search", icon: SvgSearch, iconActive: undefined, hint: "Search: for all the questions" }));
|
|
18
|
-
export const ExtraTrigger = () => (_jsx(HeaderNavigationTrigger, { id: "dialpad", iconName: "phone", counter: 2, tooltip: "Phones pro", icon: SvgPhone, iconActive: undefined }));
|
|
19
|
-
export const ExtraWithTooltip = () => (_jsxs(Fragment, { children: [_jsx(HeaderNavigationLink, { id: "search", to: "https://google.com", target: "_blank", iconName: "search", icon: SvgSearch, iconActive: undefined, tooltip: "Search: for all the questions", hint: "Google" }), _jsx(HeaderNavigationTrigger, { id: "dialpad", iconName: "phone", hint: "Dialpad", counter: 2, icon: SvgPhone, iconActive: undefined }), _jsx(HelpCenterButton, {})] }));
|
|
20
|
-
const HelpCenterButton = () => {
|
|
21
|
-
const [open, setOpen] = useState(false);
|
|
22
|
-
return (_jsx(Popover, { onClickOutside: () => setOpen(false), open: open, direction: "bl", width: "xs", trigger: _jsx(Button, { className: "c-inherit", iconName: "help_outline", fill: "subtle", onClick: () => setOpen(true) }), portal: true, children: "help center" }));
|
|
23
|
-
};
|
|
24
|
-
const HelpTrigger = () => {
|
|
25
|
-
const [active, setActive] = useState(true);
|
|
26
|
-
return (_jsx(HeaderNavigationTrigger, { id: "help", iconName: "help_outline", hint: "Help", icon: SvgHelp, iconActive: undefined, label: "Live Chat", onClick: () => setActive(!active), isActive: active }));
|
|
27
|
-
};
|
|
28
|
-
export const ExtraWithLabel = () => (_jsxs(Fragment, { children: [_jsx(HeaderNavigationLink, { id: "search", to: "https://google.com", target: "_blank", iconName: "search", icon: SvgSearch, iconActive: undefined, tooltip: "Search: for all the questions", hint: "Google" }), _jsx(HelpTrigger, {}), _jsx(HeaderNavigationTrigger, { id: "dialpad", iconName: "phone", hint: "Dialpad", tag: { value: 2 }, icon: SvgPhone, iconActive: undefined })] }));
|
|
29
|
-
//# sourceMappingURL=header-navigation-extra.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header-navigation-extra.stories.js","sourceRoot":"","sources":["../../../src/components/header-navigation/header-navigation-extra.stories.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
2
|
-
import { HeaderNavigationLinkProps, HeaderNavigationTriggerProps } from '../../utils/navigation-legacy';
|
|
3
|
-
/** Navigation extra item with link */
|
|
4
|
-
export declare const HeaderNavigationLink: FC<HeaderNavigationLinkProps>;
|
|
5
|
-
/** Navigation extra item with icon button */
|
|
6
|
-
export declare const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps>;
|
|
7
|
-
/** Navigation extra item with custom content */
|
|
8
|
-
export declare const HeaderNavigationTriggerCustom: FC<Omit<HeaderNavigationTriggerProps, 'counter' | 'iconSize' | 'iconName' | 'iconComponent' | 'iconClassName' | 'icon' | 'iconActive'> & {
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}>;
|
|
11
|
-
//# sourceMappingURL=header-navigation-links.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header-navigation-links.d.ts","sourceRoot":"","sources":["../../../src/components/header-navigation/header-navigation-links.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAElD,OAAO,EACH,yBAAyB,EACzB,4BAA4B,EAC/B,MAAM,+BAA+B,CAAC;AAMvC,sCAAsC;AACtC,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA+C9D,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CA4CpE,CAAC;AAEF,gDAAgD;AAChD,eAAO,MAAM,6BAA6B,EAAE,EAAE,CAC1C,IAAI,CACA,4BAA4B,EAC1B,SAAS,GACT,UAAU,GACV,UAAU,GACV,eAAe,GACf,eAAe,GACf,MAAM,GACN,YAAY,CACjB,GAAG;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CAkB1B,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createElement as _createElement } from "react";
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import { useContext } from 'react';
|
|
5
|
-
import { NavigationComponentContext } from '../../utils/navigation-context';
|
|
6
|
-
import { getCounterTag } from '../../utils/side-nav';
|
|
7
|
-
import { HeaderNavigationItemContent } from './header-navigation-content';
|
|
8
|
-
import * as Styles from './header-navigation.module.less';
|
|
9
|
-
import { withTooltip } from './with-tooltip';
|
|
10
|
-
/** Navigation extra item with link */
|
|
11
|
-
export const HeaderNavigationLink = ({ id, to, counter, hint, tooltip, className, icon, iconActive, iconClassName, iconComponent, iconName, isActive, label, labelClassName, tag, target, ...rest }) => {
|
|
12
|
-
const NavigationComponent = useContext(NavigationComponentContext);
|
|
13
|
-
return withTooltip(_createElement(NavigationComponent, { "data-cy": `navigation-link-${id}`, "data-pendo": `navigation-link-${id}`, ...rest, key: id, to: to, title: hint, className: classNames(Styles.navigationLink, Styles.navigationItem, className, {
|
|
14
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
15
|
-
}), isActive: typeof isActive === 'function' ? isActive : undefined, activeClassName: Styles.navigationItemActive, target: target },
|
|
16
|
-
_jsx(HeaderNavigationItemContent, { tag: getCounterTag(counter, tag), iconComponent: iconComponent, iconClassName: iconClassName, iconName: iconName, title: label, titleClassName: labelClassName })), tooltip);
|
|
17
|
-
};
|
|
18
|
-
/** Navigation extra item with icon button */
|
|
19
|
-
export const HeaderNavigationTrigger = ({ id, className, counter, icon, iconActive, iconClassName, iconComponent, iconName, isActive, label, labelClassName, hint, tag, tooltip, ...rest }) => {
|
|
20
|
-
return withTooltip(_jsx("div", { "data-cy": `navigation-trigger-${id}`, "data-pendo": `navigation-trigger-${id}`, ...rest, title: hint, className: classNames(Styles.navigationItem, Styles.navigationLink, {
|
|
21
|
-
[Styles.navigationItemActive]: isActive === true,
|
|
22
|
-
}, 'cursor-pointer', className), children: _jsx(HeaderNavigationItemContent, { tag: getCounterTag(counter, tag), iconComponent: iconComponent, iconClassName: iconClassName, iconName: iconName, title: label, titleClassName: labelClassName }) }), tooltip);
|
|
23
|
-
};
|
|
24
|
-
/** Navigation extra item with custom content */
|
|
25
|
-
export const HeaderNavigationTriggerCustom = ({ children, id, className, tooltip, title, ...rest }) => withTooltip(_jsx("div", { "data-cy": `navigation-custom-${id}`, "data-pendo": `navigation-custom-${id}`, ...rest, title: title, className: classNames(Styles.navigationItem, Styles.navigationLink, 'cursor-pointer', className), children: children }), tooltip);
|
|
26
|
-
//# sourceMappingURL=header-navigation-links.js.map
|