@servicetitan/navigation 11.0.0-canary.237.ff793b3.0 → 11.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/profile-dropdown/profile-dropdown.d.ts +2 -0
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +9 -6
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +20 -8
- package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header-links.js +1 -1
- package/dist/components/titan-layout/layout-header-links.js.map +1 -1
- package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-header.js +1 -1
- package/dist/components/titan-layout/layout-header.js.map +1 -1
- package/dist/components/titan-layout/layout-header.module.less +47 -55
- package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-profile.js +20 -16
- package/dist/components/titan-layout/layout-profile.js.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js +1 -1
- package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.js +14 -14
- package/dist/components/titan-layout/titan-layout.js.map +1 -1
- package/dist/components/titan-layout/titan-layout.module.less +2 -0
- package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
- package/dist/components/titan-layout/titan-layout.stories.js +3 -3
- package/dist/components/titan-layout/titan-layout.stories.js.map +1 -1
- package/dist/utils/use-breakpoint.js +1 -1
- package/dist/utils/use-breakpoint.js.map +1 -1
- package/package.json +2 -2
- package/src/components/profile-dropdown/profile-dropdown.module.less +20 -8
- package/src/components/profile-dropdown/profile-dropdown.module.less.d.ts +2 -0
- package/src/components/profile-dropdown/profile-dropdown.tsx +37 -9
- package/src/components/titan-layout/layout-header-links.tsx +2 -1
- package/src/components/titan-layout/layout-header.module.less +47 -55
- package/src/components/titan-layout/layout-header.module.less.d.ts +2 -0
- package/src/components/titan-layout/layout-header.tsx +5 -1
- package/src/components/titan-layout/layout-profile.tsx +46 -17
- package/src/components/titan-layout/layout-sidebar-links.tsx +5 -1
- package/src/components/titan-layout/titan-layout.module.less +2 -0
- package/src/components/titan-layout/titan-layout.stories.tsx +6 -1
- package/src/components/titan-layout/titan-layout.tsx +22 -43
- package/src/utils/use-breakpoint.ts +1 -1
|
@@ -147,9 +147,11 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
|
|
|
147
147
|
const [mobileDrawerOpened, setMobileDrawerOpened] = useState(false);
|
|
148
148
|
const { content, logo } = useLayoutChildren(children);
|
|
149
149
|
const { hasNotifications, NotificationsContextProvider } = useNotificationsState();
|
|
150
|
-
const [
|
|
150
|
+
const [offsetTopStyles, setOffsetTopStyles] = useState<object>({});
|
|
151
151
|
const updateIndicatorsHeight = useCallback((offset: number) => {
|
|
152
|
-
|
|
152
|
+
setOffsetTopStyles({
|
|
153
|
+
'--content-offset-top': `calc(var(--nav-offset-top) + ${offset}px)`,
|
|
154
|
+
});
|
|
153
155
|
}, []);
|
|
154
156
|
|
|
155
157
|
const isMobile = breakpoint.isMobile;
|
|
@@ -219,17 +221,18 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
|
|
|
219
221
|
|
|
220
222
|
const contentStyles = useMemo(() => {
|
|
221
223
|
if (variant.isAnvil2) {
|
|
222
|
-
return
|
|
224
|
+
return offsetTopStyles;
|
|
223
225
|
}
|
|
224
226
|
|
|
225
|
-
if (variant.isLegacy
|
|
227
|
+
if (variant.isLegacy) {
|
|
226
228
|
return {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
229
|
+
...(limitContentWidth
|
|
230
|
+
? { display: 'flex', flexDirection: 'column', minHeight: '100vh' }
|
|
231
|
+
: {}),
|
|
232
|
+
...offsetTopStyles,
|
|
230
233
|
};
|
|
231
234
|
}
|
|
232
|
-
}, [variant,
|
|
235
|
+
}, [variant, offsetTopStyles, limitContentWidth]);
|
|
233
236
|
|
|
234
237
|
const layoutClass = variant.isLegacy
|
|
235
238
|
? Styles.layoutLegacy
|
|
@@ -311,21 +314,21 @@ const TitanLayoutComponent: FC<TitanLayoutProps> = ({
|
|
|
311
314
|
</NotificationsContextProvider>
|
|
312
315
|
)}
|
|
313
316
|
|
|
317
|
+
{variant.isSequent && (
|
|
318
|
+
<TitanLayoutHeaderObserved heightChange={updateIndicatorsHeight}>
|
|
319
|
+
{header}
|
|
320
|
+
</TitanLayoutHeaderObserved>
|
|
321
|
+
)}
|
|
314
322
|
{variant.isAnvil1 ? (
|
|
315
323
|
<LayoutContentAnvil1 header={header} minWidth={limitContentWidth}>
|
|
316
324
|
{content}
|
|
317
325
|
</LayoutContentAnvil1>
|
|
318
326
|
) : variant.isLegacy ? (
|
|
319
|
-
<LayoutContentLegacy
|
|
327
|
+
<LayoutContentLegacy minWidth={limitContentWidth}>
|
|
320
328
|
{content}
|
|
321
329
|
</LayoutContentLegacy>
|
|
322
330
|
) : (
|
|
323
|
-
|
|
324
|
-
header={header}
|
|
325
|
-
onHeaderHeightChange={updateIndicatorsHeight}
|
|
326
|
-
>
|
|
327
|
-
{content}
|
|
328
|
-
</LayoutContentAnvil2>
|
|
331
|
+
children
|
|
329
332
|
)}
|
|
330
333
|
</div>
|
|
331
334
|
</LayoutPlacementContext.Provider>
|
|
@@ -380,21 +383,6 @@ export interface TitanLayoutContentProps {
|
|
|
380
383
|
}
|
|
381
384
|
const TitanLayoutContent: FC<TitanLayoutContentProps> = ({ children }) => children;
|
|
382
385
|
|
|
383
|
-
const LayoutContentAnvil2: FC<{
|
|
384
|
-
children: ReactNode;
|
|
385
|
-
header?: ReactNode;
|
|
386
|
-
onHeaderHeightChange?: (height: number) => void;
|
|
387
|
-
}> = ({ children, header, onHeaderHeightChange }) => {
|
|
388
|
-
return (
|
|
389
|
-
<Fragment>
|
|
390
|
-
<TitanLayoutHeaderObserved heightChange={onHeaderHeightChange}>
|
|
391
|
-
{header}
|
|
392
|
-
</TitanLayoutHeaderObserved>
|
|
393
|
-
{children}
|
|
394
|
-
</Fragment>
|
|
395
|
-
);
|
|
396
|
-
};
|
|
397
|
-
|
|
398
386
|
const LayoutContentAnvil1: FC<{
|
|
399
387
|
children: ReactNode;
|
|
400
388
|
header?: ReactNode;
|
|
@@ -427,9 +415,8 @@ const LayoutContentAnvil1: FC<{
|
|
|
427
415
|
|
|
428
416
|
const LayoutContentLegacy: FC<{
|
|
429
417
|
children: ReactNode;
|
|
430
|
-
header?: ReactNode;
|
|
431
418
|
minWidth: number | undefined;
|
|
432
|
-
}> = ({ children,
|
|
419
|
+
}> = ({ children, minWidth }) => {
|
|
433
420
|
const innerContentStyles: CSSProperties = useMemo(
|
|
434
421
|
() => ({
|
|
435
422
|
position: 'relative',
|
|
@@ -439,17 +426,9 @@ const LayoutContentLegacy: FC<{
|
|
|
439
426
|
);
|
|
440
427
|
|
|
441
428
|
return (
|
|
442
|
-
<
|
|
443
|
-
<
|
|
444
|
-
|
|
445
|
-
{minWidth ? (
|
|
446
|
-
<div className="of-x-auto flex-basis-0 flex-grow-1">
|
|
447
|
-
<div style={innerContentStyles}>{children}</div>
|
|
448
|
-
</div>
|
|
449
|
-
) : (
|
|
450
|
-
children
|
|
451
|
-
)}
|
|
452
|
-
</Fragment>
|
|
429
|
+
<div className={minWidth ? 'of-x-auto flex-basis-0 flex-grow-1' : undefined}>
|
|
430
|
+
<div style={minWidth ? innerContentStyles : undefined}>{children}</div>
|
|
431
|
+
</div>
|
|
453
432
|
);
|
|
454
433
|
};
|
|
455
434
|
|
|
@@ -13,7 +13,7 @@ export const useTitanBreakpoint = (): TitanBreakpoint => {
|
|
|
13
13
|
return useMemo(
|
|
14
14
|
() => ({
|
|
15
15
|
name: breakpoint?.name ?? 'xl',
|
|
16
|
-
isMobile: breakpoint ? breakpoint.innerWidth
|
|
16
|
+
isMobile: breakpoint ? breakpoint.innerWidth < 768 : false,
|
|
17
17
|
width: breakpoint?.innerWidth ?? 0,
|
|
18
18
|
}),
|
|
19
19
|
[breakpoint]
|