@servicetitan/navigation 13.0.0-canary.256.6f02f8b.0 → 13.0.0-canary.256.b93dc10.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/titan-layout/layout-header-dark.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-dark.js +3 -1
- package/dist/components/titan-layout/layout-header-dark.js.map +1 -1
- package/dist/components/titan-layout/layout-header.d.ts +2 -0
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header.js +25 -16
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +6 -1
- package/dist/components/titan-layout/layout-header.module.less.d.ts +1 -0
- package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js +4 -1
- package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.js +42 -86
- package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar.module.less +18 -10
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +16 -3
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/package.json +4 -4
- package/src/components/titan-layout/layout-header-dark.tsx +4 -1
- package/src/components/titan-layout/layout-header.module.less +6 -1
- package/src/components/titan-layout/layout-header.module.less.d.ts +1 -0
- package/src/components/titan-layout/layout-header.tsx +26 -13
- package/src/components/titan-layout/layout-sidebar-links-internal.tsx +14 -9
- package/src/components/titan-layout/layout-sidebar.module.less +18 -10
- package/src/components/titan-layout/layout-sidebar.tsx +0 -49
- package/src/components/titan-layout/titan-layout.tsx +24 -5
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Icon, Popover, Text, ThemeProvider } from '@servicetitan/anvil2';
|
|
2
2
|
import SvgClose from '@servicetitan/anvil2/assets/icons/material/round/close.svg';
|
|
3
|
-
import SvgCollapse from '@servicetitan/anvil2/assets/icons/st/gnav_menu_collapse.svg';
|
|
4
|
-
import SvgExpand from '@servicetitan/anvil2/assets/icons/st/gnav_menu_expand.svg';
|
|
5
3
|
import classNames from 'classnames';
|
|
6
4
|
import {
|
|
7
5
|
Children,
|
|
@@ -24,8 +22,6 @@ import {
|
|
|
24
22
|
} from './layout-sidebar-links-internal';
|
|
25
23
|
import * as Styles from './layout-sidebar.module.less';
|
|
26
24
|
|
|
27
|
-
import { withTooltip } from './with-tooltip';
|
|
28
|
-
|
|
29
25
|
export interface LayoutSidebarProps {
|
|
30
26
|
className?: string;
|
|
31
27
|
top?: ReactElement[];
|
|
@@ -125,57 +121,12 @@ export const LayoutSidebar: FC<LayoutSidebarProps> = ({
|
|
|
125
121
|
|
|
126
122
|
{!!bottom && <SidebarBottom>{bottom}</SidebarBottom>}
|
|
127
123
|
</ThemeProvider>
|
|
128
|
-
|
|
129
|
-
{!mobile && (
|
|
130
|
-
<div className={Styles.navFooter}>
|
|
131
|
-
<div className={Styles.divider} />
|
|
132
|
-
<div className={Styles.toggleWrapper}>
|
|
133
|
-
<SideNavigationOptionsToggle
|
|
134
|
-
appearance={barExpanded ? 'collapse-button' : 'expand'}
|
|
135
|
-
onExpandedChange={() => onBarExpandChange(!barExpanded)}
|
|
136
|
-
/>
|
|
137
|
-
</div>
|
|
138
|
-
</div>
|
|
139
|
-
)}
|
|
140
124
|
</div>
|
|
141
125
|
</LayoutPlacementContext.Provider>
|
|
142
126
|
);
|
|
143
127
|
};
|
|
144
128
|
LayoutSidebar.displayName = 'LayoutSidebar';
|
|
145
129
|
|
|
146
|
-
/** Side Navigation options toggle */
|
|
147
|
-
const SideNavigationOptionsToggle: FC<{
|
|
148
|
-
appearance: 'expand' | 'collapse' | 'collapse-button';
|
|
149
|
-
onExpandedChange?(expanded: boolean): void;
|
|
150
|
-
}> = ({ appearance, onExpandedChange }) =>
|
|
151
|
-
withTooltip(
|
|
152
|
-
<div
|
|
153
|
-
data-cy="navigation-left-options"
|
|
154
|
-
data-pendo="navigation-left-options"
|
|
155
|
-
className={classNames(Styles.toggle)}
|
|
156
|
-
onClick={() => onExpandedChange?.(appearance === 'expand')}
|
|
157
|
-
>
|
|
158
|
-
<div className={Styles.toggleContent}>
|
|
159
|
-
<div className={Styles.toggleIconWrapper}>
|
|
160
|
-
<Icon
|
|
161
|
-
className={Styles.toggleIcon}
|
|
162
|
-
svg={appearance === 'expand' ? SvgExpand : SvgCollapse}
|
|
163
|
-
/>
|
|
164
|
-
</div>
|
|
165
|
-
|
|
166
|
-
{appearance === 'collapse-button' && (
|
|
167
|
-
<span className={Styles.toggleText}>Collapse Menu</span>
|
|
168
|
-
)}
|
|
169
|
-
</div>
|
|
170
|
-
</div>,
|
|
171
|
-
appearance === 'expand'
|
|
172
|
-
? 'Expand Menu'
|
|
173
|
-
: appearance === 'collapse'
|
|
174
|
-
? 'Collapse Menu'
|
|
175
|
-
: undefined,
|
|
176
|
-
{ placement: 'right' }
|
|
177
|
-
);
|
|
178
|
-
|
|
179
130
|
/** Side Navigation menu item */
|
|
180
131
|
const SideNavigationGroupItem: FC<{
|
|
181
132
|
item: NavigationItemData;
|
|
@@ -149,10 +149,18 @@ function TitanLayoutComponent({
|
|
|
149
149
|
}
|
|
150
150
|
}, [view.isAnvil1]);
|
|
151
151
|
|
|
152
|
-
const onBurgerClick = useCallback(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
const onBurgerClick = useCallback(
|
|
153
|
+
(e: MouseEvent<never>) => {
|
|
154
|
+
if (isMobile) {
|
|
155
|
+
setMobileDrawerOpened(true);
|
|
156
|
+
} else {
|
|
157
|
+
onStateChange?.({ navCollapsed: !state?.navCollapsed });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
e.stopPropagation();
|
|
161
|
+
},
|
|
162
|
+
[isMobile, state?.navCollapsed, onStateChange]
|
|
163
|
+
);
|
|
156
164
|
|
|
157
165
|
const onBarExpandChange = useCallback(
|
|
158
166
|
(expanded: boolean) => {
|
|
@@ -275,7 +283,17 @@ function TitanLayoutComponent({
|
|
|
275
283
|
</Fragment>
|
|
276
284
|
}
|
|
277
285
|
isMobile={isMobile}
|
|
278
|
-
hasNotifications={
|
|
286
|
+
hasNotifications={
|
|
287
|
+
isMobile && (hasNotifications || hasMenuNotifications)
|
|
288
|
+
}
|
|
289
|
+
hasBurger={hasSideBar}
|
|
290
|
+
burgerTooltip={
|
|
291
|
+
isMobile
|
|
292
|
+
? undefined
|
|
293
|
+
: state?.navCollapsed
|
|
294
|
+
? 'Expand'
|
|
295
|
+
: 'Collapse'
|
|
296
|
+
}
|
|
279
297
|
onBurgerClick={onBurgerClick}
|
|
280
298
|
/>
|
|
281
299
|
) : (
|
|
@@ -294,6 +312,7 @@ function TitanLayoutComponent({
|
|
|
294
312
|
isMobile={isMobile}
|
|
295
313
|
hasNotifications={hasNotifications || hasMenuNotifications}
|
|
296
314
|
onBurgerClick={onBurgerClick}
|
|
315
|
+
hasBurger={isMobile}
|
|
297
316
|
navigationMainItems={navigationMainItems}
|
|
298
317
|
navigationOverflowItems={navigationOverflowItems}
|
|
299
318
|
/>
|