@servicetitan/navigation 13.0.0-canary.256.b93dc10.0 → 13.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/titan-layout/interface.d.ts +5 -0
- 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.module.less +18 -0
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.js +2 -3
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +36 -27
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +3 -14
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.module.less +18 -29
- package/dist/components/titan-layout/titan-layout-default.stories.d.ts +1 -0
- package/dist/components/titan-layout/titan-layout-default.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.d.ts +25 -0
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +2 -2
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/utils/navigation.d.ts +1 -2
- 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/titan-layout/interface.ts +5 -0
- package/src/components/titan-layout/layout-header.module.less +18 -0
- package/src/components/titan-layout/layout-profile.tsx +3 -4
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +43 -33
- package/src/components/titan-layout/layout-sidebar.module.less +18 -29
- package/src/components/titan-layout/layout-sidebar.tsx +5 -24
- package/src/components/titan-layout/titan-layout-default.stories.tsx +17 -1
- package/src/components/titan-layout/titan-layout.tsx +34 -2
- package/src/utils/navigation.ts +1 -3
|
@@ -57,16 +57,48 @@ export type TitanLayoutProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'
|
|
|
57
57
|
/** logo props */
|
|
58
58
|
logo?: TitanLayoutLogoProps;
|
|
59
59
|
|
|
60
|
+
/** layout state */
|
|
60
61
|
state?: TitanLayoutState;
|
|
62
|
+
/** layout state change handler */
|
|
61
63
|
onStateChange?: (state: TitanLayoutState) => void;
|
|
62
64
|
|
|
65
|
+
/** content header content */
|
|
63
66
|
header?: ReactElement;
|
|
67
|
+
|
|
68
|
+
/** layout header content (center) */
|
|
64
69
|
top?: ReactElement;
|
|
70
|
+
|
|
71
|
+
/** top links for side navigation */
|
|
65
72
|
sideTop?: ReactElement[];
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* profile element for layout
|
|
76
|
+
* @see ProfileDropdown
|
|
77
|
+
*/
|
|
66
78
|
profile?: ReactElement;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* extra links for layout header
|
|
82
|
+
* shown in side nav footer on mobile
|
|
83
|
+
*/
|
|
67
84
|
extraLinks?: ReactElement;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* fixed extra links for layout header
|
|
88
|
+
* shown in header on mobile as well
|
|
89
|
+
*/
|
|
68
90
|
extraLinksTop?: ReactElement;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* text shown in layout's header
|
|
94
|
+
* shown in side nav footer on mobile
|
|
95
|
+
*/
|
|
69
96
|
extraText?: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* minimal width set for content area
|
|
100
|
+
* used for pages that aren't adopted to mobile
|
|
101
|
+
*/
|
|
70
102
|
minContentWidth?: number;
|
|
71
103
|
};
|
|
72
104
|
|
|
@@ -173,11 +205,11 @@ function TitanLayoutComponent({
|
|
|
173
205
|
[onStateChange, isMobile]
|
|
174
206
|
);
|
|
175
207
|
const onSubmenuExpandChange = useCallback(
|
|
176
|
-
(id: string, expanded: boolean) => {
|
|
208
|
+
(id: string, expanded: boolean, force: boolean) => {
|
|
177
209
|
onStateChange?.({
|
|
178
210
|
navCollapsed: state?.navCollapsed ?? false,
|
|
179
211
|
submenusExpanded: [
|
|
180
|
-
...(state?.submenusExpanded ?? []).filter(i => i !== id),
|
|
212
|
+
...(force ? [] : (state?.submenusExpanded ?? []).filter(i => i !== id)),
|
|
181
213
|
...(expanded ? [id] : []),
|
|
182
214
|
],
|
|
183
215
|
});
|
package/src/utils/navigation.ts
CHANGED
|
@@ -17,9 +17,6 @@ export interface NavigationItemData extends NavigationLinkData {
|
|
|
17
17
|
|
|
18
18
|
/** optional submenu of link item */
|
|
19
19
|
submenu?: NavigationSubmenuData;
|
|
20
|
-
|
|
21
|
-
iconClassName?: never;
|
|
22
|
-
iconComponent?: never;
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
export interface NavigationLinkData {
|
|
@@ -44,6 +41,7 @@ export interface NavigationSubmenuData {
|
|
|
44
41
|
export interface NavigationSubmenuItemData extends NavigationLinkData {
|
|
45
42
|
/** item tag (optional) value. shown if it is set and true or greater than 0 */
|
|
46
43
|
counter?: CounterTagValue;
|
|
44
|
+
/** item tag (optional) value. shown if value is true or greater than 0 */
|
|
47
45
|
tag?: CounterTagData;
|
|
48
46
|
}
|
|
49
47
|
|