@servicetitan/navigation 8.2.0 → 9.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 +2 -4
- package/dist/components/counter-tag.d.ts.map +1 -1
- package/dist/components/counter-tag.js +3 -4
- package/dist/components/counter-tag.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.d.ts +2 -2
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.js +4 -4
- 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.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.js +4 -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.module.less +2 -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/layout.stories.d.ts.map +1 -1
- package/dist/components/layout.stories.js +2 -1
- package/dist/components/layout.stories.js.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts +1 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.js +6 -6
- 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/side-navigation.d.ts +8 -4
- package/dist/components/left-navigation/side-navigation.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation.js +33 -20
- package/dist/components/left-navigation/side-navigation.js.map +1 -1
- package/dist/components/left-navigation/side-navigation.module.less +25 -13
- package/dist/components/left-navigation/side-navigation.stories.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation.stories.js +6 -5
- package/dist/components/left-navigation/side-navigation.stories.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +3 -3
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/test/data.d.ts +1 -0
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +23 -7
- package/dist/test/data.js.map +1 -1
- package/dist/utils/navigation.d.ts +9 -5
- package/dist/utils/navigation.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/counter-tag.tsx +12 -9
- package/src/components/header-navigation/header-navigation-content.tsx +7 -7
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +3 -3
- package/src/components/header-navigation/header-navigation-links.tsx +6 -4
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +2 -2
- package/src/components/header-navigation/header-navigation.module.less +2 -1
- package/src/components/header-navigation/header-navigation.stories.tsx +2 -2
- package/src/components/layout.stories.tsx +5 -2
- package/src/components/left-navigation/header-navigation-tiny-links.tsx +8 -8
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +3 -3
- package/src/components/left-navigation/side-navigation.module.less +25 -13
- package/src/components/left-navigation/side-navigation.module.less.d.ts +2 -0
- package/src/components/left-navigation/side-navigation.stories.tsx +10 -7
- package/src/components/left-navigation/side-navigation.tsx +71 -42
- package/src/components/profile-dropdown/profile-dropdown.tsx +6 -9
- package/src/test/data.tsx +27 -11
- package/src/utils/navigation.ts +10 -5
|
@@ -192,7 +192,7 @@ export interface ProfileDropdownLinkPropsStrict {
|
|
|
192
192
|
external?: boolean;
|
|
193
193
|
target?: HTMLAttributeAnchorTarget;
|
|
194
194
|
to?: string;
|
|
195
|
-
|
|
195
|
+
tag?: CounterTagPropsType;
|
|
196
196
|
onClick?: () => void;
|
|
197
197
|
}
|
|
198
198
|
|
|
@@ -203,9 +203,9 @@ export interface ProfileDropdownLinkProps extends ProfileDropdownLinkPropsStrict
|
|
|
203
203
|
export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
204
204
|
children,
|
|
205
205
|
className,
|
|
206
|
-
counter,
|
|
207
206
|
external,
|
|
208
207
|
id,
|
|
208
|
+
tag,
|
|
209
209
|
target,
|
|
210
210
|
to,
|
|
211
211
|
onClick,
|
|
@@ -220,10 +220,7 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
220
220
|
|
|
221
221
|
const isExternalLink = external ?? to?.startsWith('http');
|
|
222
222
|
|
|
223
|
-
const
|
|
224
|
-
() => <CounterTag data={counter} className={Styles.counter} />,
|
|
225
|
-
[counter]
|
|
226
|
-
);
|
|
223
|
+
const tagElement = useMemo(() => <CounterTag data={tag} className={Styles.counter} />, [tag]);
|
|
227
224
|
|
|
228
225
|
return isExternalLink ? (
|
|
229
226
|
<a
|
|
@@ -235,7 +232,7 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
235
232
|
{...rest}
|
|
236
233
|
>
|
|
237
234
|
{children}
|
|
238
|
-
{
|
|
235
|
+
{tagElement}
|
|
239
236
|
</a>
|
|
240
237
|
) : to ? (
|
|
241
238
|
<NavigationComponent
|
|
@@ -247,7 +244,7 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
247
244
|
{...rest}
|
|
248
245
|
>
|
|
249
246
|
{children}
|
|
250
|
-
{
|
|
247
|
+
{tagElement}
|
|
251
248
|
</NavigationComponent>
|
|
252
249
|
) : (
|
|
253
250
|
<a
|
|
@@ -258,7 +255,7 @@ export const ProfileDropdownLink: FC<ProfileDropdownLinkProps> = ({
|
|
|
258
255
|
{...rest}
|
|
259
256
|
>
|
|
260
257
|
{children}
|
|
261
|
-
{
|
|
258
|
+
{tagElement}
|
|
262
259
|
</a>
|
|
263
260
|
);
|
|
264
261
|
};
|
package/src/test/data.tsx
CHANGED
|
@@ -40,8 +40,8 @@ import { MemoryRouter, useHistory, useLocation } from 'react-router-dom';
|
|
|
40
40
|
import { HeaderNavigationTrigger } from '../components/links';
|
|
41
41
|
import {
|
|
42
42
|
HeaderNavigationItemData,
|
|
43
|
-
HeaderNavigationItemLinkProps,
|
|
44
43
|
HeaderNavigationItemSubmenuGroup,
|
|
44
|
+
HeaderNavigationItemSubmenuLink,
|
|
45
45
|
NavLinkComponentProps,
|
|
46
46
|
} from '../utils/navigation';
|
|
47
47
|
import { NavigationComponentContext } from '../utils/navigation-context';
|
|
@@ -145,8 +145,8 @@ const getItem = (
|
|
|
145
145
|
|
|
146
146
|
const getSubItem = (
|
|
147
147
|
id: string,
|
|
148
|
-
data: Partial<
|
|
149
|
-
):
|
|
148
|
+
data: Partial<HeaderNavigationItemSubmenuLink>
|
|
149
|
+
): HeaderNavigationItemSubmenuLink => ({
|
|
150
150
|
id,
|
|
151
151
|
to: id,
|
|
152
152
|
title: id[0].toUpperCase() + id.substring(1),
|
|
@@ -155,7 +155,7 @@ const getSubItem = (
|
|
|
155
155
|
|
|
156
156
|
const getGroup = (
|
|
157
157
|
title: string,
|
|
158
|
-
links:
|
|
158
|
+
links: HeaderNavigationItemSubmenuLink[]
|
|
159
159
|
): HeaderNavigationItemSubmenuGroup => ({
|
|
160
160
|
title,
|
|
161
161
|
links,
|
|
@@ -176,7 +176,7 @@ export const items = {
|
|
|
176
176
|
iconName: 'local_phone',
|
|
177
177
|
icon: SvgCalls,
|
|
178
178
|
iconActive: SvgCallsActive,
|
|
179
|
-
|
|
179
|
+
tag: 12,
|
|
180
180
|
}),
|
|
181
181
|
dashboard: getItem('dashboard', {
|
|
182
182
|
iconName: 'odometer',
|
|
@@ -187,7 +187,7 @@ export const items = {
|
|
|
187
187
|
iconName: 'location_disabled',
|
|
188
188
|
icon: SvgDispatch,
|
|
189
189
|
iconActive: SvgDispatchActive,
|
|
190
|
-
|
|
190
|
+
tag: 1,
|
|
191
191
|
}),
|
|
192
192
|
fleet: getItem('fleet', {
|
|
193
193
|
iconName: 'fleet-pro',
|
|
@@ -201,6 +201,21 @@ export const items = {
|
|
|
201
201
|
iconActive: SvgFollowUpActive,
|
|
202
202
|
title: 'Follow Up',
|
|
203
203
|
}),
|
|
204
|
+
followUpsWithSubmenu: getItem('followUps', {
|
|
205
|
+
iconName: 'flag',
|
|
206
|
+
icon: SvgFollowUp,
|
|
207
|
+
iconActive: SvgFollowUpActive,
|
|
208
|
+
title: 'Follow Up',
|
|
209
|
+
submenu: {
|
|
210
|
+
groups: [
|
|
211
|
+
getGroup('', [
|
|
212
|
+
getSubItem('estimates', { title: 'Unsold Estimates' }),
|
|
213
|
+
getSubItem('sold', { title: 'Sold Estimates' }),
|
|
214
|
+
getSubItem('surveys', { title: 'Surveys' }),
|
|
215
|
+
]),
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
}),
|
|
204
219
|
inventory: getItem('inventory', {
|
|
205
220
|
iconName: 'toys',
|
|
206
221
|
icon: SvgInventory,
|
|
@@ -226,6 +241,7 @@ export const items = {
|
|
|
226
241
|
iconName: 'assignment',
|
|
227
242
|
icon: SvgAccounting,
|
|
228
243
|
iconActive: SvgAccountingActive,
|
|
244
|
+
tag: true,
|
|
229
245
|
}),
|
|
230
246
|
accountingWithSubmenu: getItem('accounting', {
|
|
231
247
|
iconName: 'assignment',
|
|
@@ -235,9 +251,9 @@ export const items = {
|
|
|
235
251
|
groups: [
|
|
236
252
|
getGroup('Accounts Receivable', [
|
|
237
253
|
getSubItem('ar', { title: 'AR Management' }),
|
|
238
|
-
getSubItem('export', { title: 'Batch/Export Transactions' }),
|
|
239
|
-
getSubItem('invoices', { title: 'Invoices' }),
|
|
240
|
-
getSubItem('payments', { title: 'Customer Payments' }),
|
|
254
|
+
getSubItem('export', { title: 'Batch/Export Transactions', tag: true }),
|
|
255
|
+
getSubItem('invoices', { title: 'Invoices', tag: 3 }),
|
|
256
|
+
getSubItem('payments', { title: 'Customer Payments', tag: 2 }),
|
|
241
257
|
getSubItem('deposits', { title: 'Bank Deposits' }),
|
|
242
258
|
]),
|
|
243
259
|
getGroup('Accounts Payable', [getSubItem('bills', { title: 'Bills' })]),
|
|
@@ -251,7 +267,7 @@ export const items = {
|
|
|
251
267
|
icon: SvgMarketing,
|
|
252
268
|
iconActive: SvgMarketingActive,
|
|
253
269
|
}),
|
|
254
|
-
priceBook: getItem('
|
|
270
|
+
priceBook: getItem('pricebook', {
|
|
255
271
|
iconName: 'book',
|
|
256
272
|
icon: SvgPriceBook,
|
|
257
273
|
iconActive: SvgPriceBookActive,
|
|
@@ -291,7 +307,7 @@ export const CallsNavigationTrigger = () => {
|
|
|
291
307
|
<HeaderNavigationTrigger
|
|
292
308
|
id="dialpad"
|
|
293
309
|
iconName="phone"
|
|
294
|
-
|
|
310
|
+
tag={2}
|
|
295
311
|
icon={SvgPhone}
|
|
296
312
|
iconActive={SvgPhoneActive}
|
|
297
313
|
onClick={() => setOpen(!open)}
|
package/src/utils/navigation.ts
CHANGED
|
@@ -25,8 +25,8 @@ export interface HeaderNavigationItemData extends HeaderNavigationItemLinkProps
|
|
|
25
25
|
/** icon component of item (<svg />) */
|
|
26
26
|
iconComponent?: FC;
|
|
27
27
|
|
|
28
|
-
/** item
|
|
29
|
-
|
|
28
|
+
/** item tag (optional). shown if it is set and true or greater than 0 */
|
|
29
|
+
tag?: CounterTagPropsType;
|
|
30
30
|
|
|
31
31
|
/** class name of link item */
|
|
32
32
|
className?: string;
|
|
@@ -54,12 +54,17 @@ export interface HeaderNavigationItemSubmenu {
|
|
|
54
54
|
groups: HeaderNavigationItemSubmenuGroup[];
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
export interface HeaderNavigationItemSubmenuLink extends HeaderNavigationItemLinkProps {
|
|
58
|
+
/** item tag (optional). shown if it is set and true or greater than 0 */
|
|
59
|
+
tag?: CounterTagPropsType;
|
|
60
|
+
}
|
|
61
|
+
|
|
57
62
|
export interface HeaderNavigationItemSubmenuGroup {
|
|
58
63
|
/** submenu group title */
|
|
59
64
|
title: string;
|
|
60
65
|
|
|
61
66
|
/** submenu group links */
|
|
62
|
-
links:
|
|
67
|
+
links: HeaderNavigationItemSubmenuLink[];
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
export interface NavLinkComponentPropsStrict {
|
|
@@ -91,8 +96,8 @@ export interface HeaderNavigationTriggerPropsStrict {
|
|
|
91
96
|
labelClassName?: string;
|
|
92
97
|
/** isActive */
|
|
93
98
|
isActive?: boolean;
|
|
94
|
-
/** counter shown for item */
|
|
95
|
-
|
|
99
|
+
/** counter tag shown for item */
|
|
100
|
+
tag?: CounterTagPropsType;
|
|
96
101
|
/** counter component class name */
|
|
97
102
|
counterClassName?: string;
|
|
98
103
|
/** icon component class name */
|