@servicetitan/navigation 9.2.1 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/counter-tag.d.ts +4 -4
- package/dist/components/counter-tag.d.ts.map +1 -1
- package/dist/components/counter-tag.js +2 -8
- package/dist/components/counter-tag.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.d.ts +3 -3
- package/dist/components/header-navigation/header-navigation-content.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.js +3 -2
- package/dist/components/header-navigation/header-navigation-content.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.js +3 -3
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.js +5 -4
- package/dist/components/header-navigation/header-navigation-links.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.d.ts +1 -1
- package/dist/components/header-navigation/header-navigation.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
- package/dist/components/header-navigation/with-tooltip.d.ts +1 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts +3 -3
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.js +5 -4
- package/dist/components/left-navigation/header-navigation-tiny-links.js.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny.stories.js +2 -2
- package/dist/components/left-navigation/header-navigation-tiny.stories.js.map +1 -1
- package/dist/components/left-navigation/interface-internal.d.ts +1 -1
- package/dist/components/left-navigation/interface-internal.d.ts.map +1 -1
- package/dist/components/left-navigation/interface.d.ts +2 -2
- package/dist/components/left-navigation/interface.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts +7 -4
- package/dist/components/left-navigation/side-navigation-links-internal.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation-links-internal.js.map +1 -1
- package/dist/components/left-navigation/side-navigation-links.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation-links.js +3 -2
- package/dist/components/left-navigation/side-navigation-links.js.map +1 -1
- package/dist/components/left-navigation/side-navigation.d.ts +2 -2
- package/dist/components/left-navigation/side-navigation.d.ts.map +1 -1
- package/dist/components/left-navigation/side-navigation.js +9 -8
- package/dist/components/left-navigation/side-navigation.js.map +1 -1
- package/dist/components/links.d.ts +1 -1
- package/dist/components/links.d.ts.map +1 -1
- package/dist/components/links.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +3 -2
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +3 -2
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.js +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/test/data.d.ts +2 -1
- package/dist/test/data.d.ts.map +1 -1
- package/dist/test/data.js +10 -7
- package/dist/test/data.js.map +1 -1
- package/dist/utils/counter-tag.d.ts +3 -6
- package/dist/utils/counter-tag.d.ts.map +1 -1
- package/dist/utils/counter-tag.js +1 -1
- package/dist/utils/counter-tag.js.map +1 -1
- package/dist/utils/navigation-context.d.ts +13 -2
- package/dist/utils/navigation-context.d.ts.map +1 -1
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation-legacy.d.ts +86 -0
- package/dist/utils/navigation-legacy.d.ts.map +1 -0
- package/dist/utils/navigation-legacy.js +2 -0
- package/dist/utils/navigation-legacy.js.map +1 -0
- package/dist/utils/navigation.d.ts +15 -76
- package/dist/utils/navigation.d.ts.map +1 -1
- package/dist/utils/side-nav.d.ts +5 -2
- package/dist/utils/side-nav.d.ts.map +1 -1
- package/dist/utils/side-nav.js +6 -5
- package/dist/utils/side-nav.js.map +1 -1
- package/package.json +2 -2
- package/src/components/counter-tag.tsx +10 -21
- package/src/components/header-navigation/header-navigation-content.tsx +6 -4
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +3 -3
- package/src/components/header-navigation/header-navigation-links.tsx +9 -3
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +2 -2
- package/src/components/header-navigation/header-navigation.stories.tsx +2 -2
- package/src/components/header-navigation/header-navigation.tsx +1 -1
- package/src/components/left-navigation/header-navigation-tiny-links.tsx +12 -5
- package/src/components/left-navigation/header-navigation-tiny.stories.tsx +2 -2
- package/src/components/left-navigation/interface-internal.ts +1 -1
- package/src/components/left-navigation/interface.ts +2 -3
- package/src/components/left-navigation/side-navigation-links-internal.tsx +7 -5
- package/src/components/left-navigation/side-navigation-links.tsx +7 -1
- package/src/components/left-navigation/side-navigation.tsx +22 -15
- package/src/components/links.tsx +4 -1
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +4 -1
- package/src/components/profile-dropdown/profile-dropdown.tsx +10 -3
- package/src/index.ts +6 -1
- package/src/test/data.tsx +17 -18
- package/src/utils/counter-tag.ts +3 -9
- package/src/utils/navigation-context.tsx +15 -2
- package/src/utils/navigation-legacy.ts +104 -0
- package/src/utils/navigation.ts +15 -85
- package/src/utils/side-nav.ts +17 -9
package/src/utils/side-nav.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CounterTagProps } from '../components/counter-tag';
|
|
2
|
+
import { CounterTagData, CounterTagValue } from './counter-tag';
|
|
3
|
+
import { NavigationSubmenuData } from './navigation';
|
|
3
4
|
|
|
4
5
|
export function getSubmenuGroupTag(
|
|
5
|
-
submenu:
|
|
6
|
-
defaultTag:
|
|
7
|
-
):
|
|
6
|
+
submenu: NavigationSubmenuData | undefined,
|
|
7
|
+
defaultTag: CounterTagProps | undefined
|
|
8
|
+
): CounterTagProps | undefined {
|
|
8
9
|
if (!submenu) {
|
|
9
10
|
return defaultTag;
|
|
10
11
|
}
|
|
@@ -13,9 +14,7 @@ export function getSubmenuGroupTag(
|
|
|
13
14
|
|
|
14
15
|
for (const group of submenu.groups) {
|
|
15
16
|
for (const link of group.links) {
|
|
16
|
-
const ltv: number | boolean | undefined =
|
|
17
|
-
? link.tag.value
|
|
18
|
-
: link.tag;
|
|
17
|
+
const ltv: number | boolean | undefined = link.counter;
|
|
19
18
|
|
|
20
19
|
if (ltv) {
|
|
21
20
|
if (typeof ltv === 'number') {
|
|
@@ -30,5 +29,14 @@ export function getSubmenuGroupTag(
|
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
return tagValue
|
|
32
|
+
return tagValue ? getCounterTag(tagValue) : defaultTag;
|
|
34
33
|
}
|
|
34
|
+
|
|
35
|
+
export const getCounterTag = (
|
|
36
|
+
counter: CounterTagValue | undefined,
|
|
37
|
+
tag?: CounterTagData | undefined
|
|
38
|
+
): CounterTagProps | undefined => {
|
|
39
|
+
const value = counter ?? tag?.value;
|
|
40
|
+
|
|
41
|
+
return value ? { value, className: '' } : undefined;
|
|
42
|
+
};
|