@shellui/core 0.7.0-alpha.9 → 0.7.0-beta.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/README.md +1 -1
- package/package.json +23 -6
- package/src/components/ui/drawer.tsx +47 -30
- package/src/components/ui/sheet.tsx +18 -12
- package/src/components/ui/shell-divider.spec.tsx +63 -0
- package/src/components/ui/shell-divider.tsx +20 -0
- package/src/components/ui/sidebar.tsx +26 -12
- package/src/components/ui/tooltip.tsx +4 -2
- package/src/features/admin/AdminView.tsx +9 -6
- package/src/features/auth/components/LoginButton.spec.tsx +203 -0
- package/src/features/auth/components/LoginButton.tsx +77 -28
- package/src/features/auth/components/LoginButtonIcons.tsx +4 -8
- package/src/features/chromeActions/ChromeActionsHost.tsx +5 -1
- package/src/features/chromeActions/computeActionInsets.ts +7 -4
- package/src/features/layouts/OverlayShell.tsx +58 -40
- package/src/features/layouts/appbar/AppBarItemIcon.spec.tsx +45 -0
- package/src/features/layouts/appbar/AppBarItemIcon.tsx +19 -0
- package/src/features/layouts/appbar/AppBarLayout.tsx +115 -110
- package/src/features/layouts/appbar/appBarOverflow.spec.ts +27 -0
- package/src/features/layouts/appbar/appBarOverflow.ts +42 -0
- package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +13 -24
- package/src/features/layouts/chrome/ContentDragOverlay.tsx +5 -6
- package/src/features/layouts/chrome/DesktopChrome.tsx +37 -0
- package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +15 -4
- package/src/features/layouts/chrome/MacStrip.tsx +33 -0
- package/src/features/layouts/chrome/constants.ts +36 -8
- package/src/features/layouts/chrome/index.ts +8 -0
- package/src/features/layouts/chrome/stripDragMap.ts +35 -0
- package/src/features/layouts/chrome/stripNoDrag.spec.tsx +103 -0
- package/src/features/layouts/chrome/useScrollHideChrome.ts +3 -8
- package/src/features/layouts/chrome/viewport.ts +11 -4
- package/src/features/layouts/floating/FloatingBottomDock.tsx +263 -43
- package/src/features/layouts/floating/FloatingLayout.tsx +14 -8
- package/src/features/layouts/floating/FloatingSidebar.tsx +178 -81
- package/src/features/layouts/floating/computeFloatingInsets.ts +22 -4
- package/src/features/layouts/floating/moreSections.spec.ts +28 -0
- package/src/features/layouts/floating/moreSections.ts +31 -0
- package/src/features/layouts/floating/useFloatingChrome.ts +3 -1
- package/src/features/layouts/floating/useSoftKeyboard.spec.ts +39 -0
- package/src/features/layouts/floating/useSoftKeyboard.ts +82 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.spec.tsx +68 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.tsx +47 -10
- package/src/features/layouts/sidebar/NavigationContent.tsx +17 -9
- package/src/features/layouts/sidebar/SidebarIcons.tsx +70 -9
- package/src/features/layouts/sidebar/SidebarInner.spec.tsx +149 -0
- package/src/features/layouts/sidebar/SidebarInner.tsx +103 -43
- package/src/features/layouts/sidebar/SidebarLayout.tsx +24 -17
- package/src/features/layouts/windows/DesktopDots.tsx +76 -0
- package/src/features/layouts/windows/WindowsLayout.tsx +265 -160
- package/src/features/layouts/windows/deskDots.spec.ts +54 -0
- package/src/features/layouts/windows/deskDots.ts +314 -0
- package/src/features/overlays/ResponsiveModal.tsx +5 -3
- package/src/features/overlays/overlaySize.spec.ts +56 -16
- package/src/features/overlays/overlaySize.ts +114 -31
- package/src/features/overlays/phoneDrawerAnchoring.spec.ts +187 -0
- package/src/features/overlays/useOverlayReportedSize.ts +8 -3
- package/src/features/theme/applyTheme.ts +8 -0
- package/src/features/theme/navContrast.spec.ts +49 -0
- package/src/features/theme/navContrast.ts +108 -0
- package/src/i18n/translations/en/common.json +26 -0
- package/src/i18n/translations/fr/common.json +26 -0
- package/src/index.css +1156 -77
- package/src/service-worker/devCaches.spec.ts +32 -0
- package/src/service-worker/devCaches.ts +27 -0
- package/src/service-worker/sw-dev.ts +23 -23
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
1
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react';
|
|
2
|
+
import { Drawer as VaulDrawer } from 'vaul';
|
|
2
3
|
import { useLocation, useNavigate } from 'react-router';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { shellui } from '@shellui/sdk';
|
|
5
|
-
import type { NavigationItem } from '../../config/types';
|
|
6
|
+
import type { NavigationGroup, NavigationItem } from '../../config/types';
|
|
7
|
+
import { groupMoreItems, type MoreSection } from './moreSections';
|
|
6
8
|
import {
|
|
7
9
|
flattenNavigationItems,
|
|
8
10
|
getActivePathPrefix,
|
|
@@ -18,6 +20,7 @@ import {
|
|
|
18
20
|
DropdownMenu,
|
|
19
21
|
DropdownMenuContent,
|
|
20
22
|
DropdownMenuItem,
|
|
23
|
+
DropdownMenuLabel,
|
|
21
24
|
DropdownMenuSeparator,
|
|
22
25
|
DropdownMenuTrigger,
|
|
23
26
|
} from '../../../components/ui/dropdown-menu';
|
|
@@ -37,6 +40,7 @@ import { useChromeActionsSnapshot } from '../../chromeActions/ChromeActionsProvi
|
|
|
37
40
|
import { SHELL_DEVELOP_CHROME_ACTIONS_FRAME } from '../../chromeActions/chromeActionsStore';
|
|
38
41
|
import { CHROME_ACTIONS_FAB_SIZE_FLOATING } from '../../chromeActions/computeActionInsets';
|
|
39
42
|
import { MoreHorizontalIcon } from '../../chromeActions/ChromeActionIcons';
|
|
43
|
+
import { Z_INDEX } from '../../../lib/z-index';
|
|
40
44
|
|
|
41
45
|
const MORE_TAB_KEY = '__more__';
|
|
42
46
|
|
|
@@ -52,12 +56,12 @@ function TabGlyph({ item, label }: { item: NavigationItem; label: string }) {
|
|
|
52
56
|
return (
|
|
53
57
|
<NavIcon
|
|
54
58
|
src={iconSrc}
|
|
55
|
-
className="size-5"
|
|
59
|
+
className="shellui-dock-glyph size-5"
|
|
56
60
|
/>
|
|
57
61
|
);
|
|
58
62
|
}
|
|
59
63
|
return (
|
|
60
|
-
<span className="flex size-5 items-center justify-center text-xs font-semibold leading-none">
|
|
64
|
+
<span className="shellui-dock-glyph flex size-5 items-center justify-center text-xs font-semibold leading-none">
|
|
61
65
|
{label.charAt(0).toUpperCase() || '?'}
|
|
62
66
|
</span>
|
|
63
67
|
);
|
|
@@ -85,10 +89,36 @@ function useMainHasPrimaryFab(): boolean {
|
|
|
85
89
|
}, [all]);
|
|
86
90
|
}
|
|
87
91
|
|
|
92
|
+
// Colours, the active capsule and press feedback live in index.css (`.shellui-dock-tab`).
|
|
88
93
|
const tabTriggerClass =
|
|
89
|
-
'h-auto min-w-0 flex-1 basis-0 flex-col gap-0.5 px-
|
|
94
|
+
'shellui-dock-tab h-auto min-w-0 flex-1 basis-0 flex-col gap-0.5 px-1 py-1 text-[11px] font-medium leading-tight data-[state=active]:bg-transparent data-[state=active]:shadow-none';
|
|
90
95
|
const tabTriggerClassTablet =
|
|
91
|
-
'h-auto min-w-0 flex-1 basis-0 flex-col gap-1 px-3.5 py-
|
|
96
|
+
'shellui-dock-tab h-auto min-w-0 flex-1 basis-0 flex-col gap-1 px-3.5 py-1.5 text-xs font-medium leading-tight data-[state=active]:bg-transparent data-[state=active]:shadow-none';
|
|
97
|
+
|
|
98
|
+
/** Icon inside the capsule that marks the active tab and scales on press. */
|
|
99
|
+
function DockCapsule({ children }: { children: ReactNode }) {
|
|
100
|
+
return (
|
|
101
|
+
<span
|
|
102
|
+
aria-hidden
|
|
103
|
+
data-shellui-dock-capsule=""
|
|
104
|
+
className="shellui-dock-capsule flex items-center justify-center"
|
|
105
|
+
>
|
|
106
|
+
{children}
|
|
107
|
+
</span>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Short tap feedback on Android web; iOS web has no vibration API (the scale is the cue). */
|
|
112
|
+
function tabChangeHaptic() {
|
|
113
|
+
if (typeof navigator === 'undefined' || typeof navigator.vibrate !== 'function') return;
|
|
114
|
+
if (typeof window === 'undefined' || !window.matchMedia?.('(pointer: coarse)').matches) return;
|
|
115
|
+
if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return;
|
|
116
|
+
try {
|
|
117
|
+
navigator.vibrate(8);
|
|
118
|
+
} catch {
|
|
119
|
+
// Blocked before the first user gesture in some browsers.
|
|
120
|
+
}
|
|
121
|
+
}
|
|
92
122
|
|
|
93
123
|
/**
|
|
94
124
|
* Floating phone/tablet bottom nav: shadcn Tabs with equal slots.
|
|
@@ -97,12 +127,15 @@ const tabTriggerClassTablet =
|
|
|
97
127
|
*/
|
|
98
128
|
export function FloatingBottomDock({
|
|
99
129
|
items,
|
|
130
|
+
navigation = [],
|
|
100
131
|
endItems = [],
|
|
101
132
|
showAuthButton = false,
|
|
102
133
|
chromeVisible,
|
|
103
134
|
viewport,
|
|
104
135
|
}: {
|
|
105
136
|
items: NavigationItem[];
|
|
137
|
+
/** Start navigation tree, so More can label items by their group. */
|
|
138
|
+
navigation?: (NavigationItem | NavigationGroup)[];
|
|
106
139
|
endItems?: NavigationItem[];
|
|
107
140
|
showAuthButton?: boolean;
|
|
108
141
|
chromeVisible: boolean;
|
|
@@ -110,7 +143,8 @@ export function FloatingBottomDock({
|
|
|
110
143
|
}) {
|
|
111
144
|
const location = useLocation();
|
|
112
145
|
const navigate = useNavigate();
|
|
113
|
-
const { i18n
|
|
146
|
+
const { i18n } = useTranslation('settings');
|
|
147
|
+
const { t: tc } = useTranslation('common');
|
|
114
148
|
const lang = i18n.language || 'en';
|
|
115
149
|
const [moreOpen, setMoreOpen] = useState(false);
|
|
116
150
|
const listRef = useRef<HTMLDivElement>(null);
|
|
@@ -159,6 +193,10 @@ export function FloatingBottomDock({
|
|
|
159
193
|
const primaryCap = showMoreFinal ? Math.max(1, maxSlots - 1) : maxSlots;
|
|
160
194
|
const primary = useMemo(() => flat.slice(0, primaryCap), [flat, primaryCap]);
|
|
161
195
|
const moreOverflowItems = useMemo(() => flat.slice(primaryCap), [flat, primaryCap]);
|
|
196
|
+
const moreSections = useMemo(
|
|
197
|
+
() => groupMoreItems(moreOverflowItems, navigation),
|
|
198
|
+
[moreOverflowItems, navigation],
|
|
199
|
+
);
|
|
162
200
|
const moreEndItems = endItems;
|
|
163
201
|
const moreItems = useMemo(
|
|
164
202
|
() => [...moreOverflowItems, ...moreEndItems],
|
|
@@ -223,7 +261,10 @@ export function FloatingBottomDock({
|
|
|
223
261
|
const onTabChange = (value: string) => {
|
|
224
262
|
setMoreOpen(false);
|
|
225
263
|
const navItem = primary.find((item) => itemKey(item) === value);
|
|
226
|
-
if (navItem)
|
|
264
|
+
if (navItem) {
|
|
265
|
+
if (value !== activeTabKey) tabChangeHaptic();
|
|
266
|
+
activateItem(navItem);
|
|
267
|
+
}
|
|
227
268
|
};
|
|
228
269
|
|
|
229
270
|
const bottomPad = floatingTabBarBottomPadCss(viewport);
|
|
@@ -275,11 +316,11 @@ export function FloatingBottomDock({
|
|
|
275
316
|
<TabsList
|
|
276
317
|
ref={listRef}
|
|
277
318
|
data-shellui-floating-dock-list=""
|
|
278
|
-
aria-label={
|
|
319
|
+
aria-label={tc('shellChrome.mainNav')}
|
|
279
320
|
className={cn(
|
|
280
|
-
'flex h-full min-w-0 gap-
|
|
321
|
+
'shellui-glass flex h-full min-w-0 gap-0.5 p-1 text-sidebar-foreground',
|
|
281
322
|
// Override TabsList default `h-10` so height matches the FAB.
|
|
282
|
-
isTablet ? 'h-16 gap-1
|
|
323
|
+
isTablet ? 'h-16 gap-1 p-1.5' : 'h-14',
|
|
283
324
|
isPhone ? 'w-full' : 'w-auto',
|
|
284
325
|
)}
|
|
285
326
|
style={{
|
|
@@ -303,11 +344,13 @@ export function FloatingBottomDock({
|
|
|
303
344
|
className={triggerClass}
|
|
304
345
|
aria-current={isActive ? 'page' : undefined}
|
|
305
346
|
>
|
|
306
|
-
<
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
347
|
+
<DockCapsule>
|
|
348
|
+
<TabGlyph
|
|
349
|
+
item={navItem}
|
|
350
|
+
label={label}
|
|
351
|
+
/>
|
|
352
|
+
</DockCapsule>
|
|
353
|
+
<span className="shellui-dock-label w-full truncate text-center">{label}</span>
|
|
311
354
|
</TabsTrigger>
|
|
312
355
|
);
|
|
313
356
|
})}
|
|
@@ -319,7 +362,7 @@ export function FloatingBottomDock({
|
|
|
319
362
|
aria-hidden
|
|
320
363
|
/>
|
|
321
364
|
) : null}
|
|
322
|
-
{showMoreFinal ? (
|
|
365
|
+
{showMoreFinal && !isPhone ? (
|
|
323
366
|
<DropdownMenu
|
|
324
367
|
open={moreOpen}
|
|
325
368
|
onOpenChange={setMoreOpen}
|
|
@@ -330,16 +373,20 @@ export function FloatingBottomDock({
|
|
|
330
373
|
role="tab"
|
|
331
374
|
aria-selected={activeTabKey === MORE_TAB_KEY}
|
|
332
375
|
aria-current={activeTabKey === MORE_TAB_KEY ? 'page' : undefined}
|
|
376
|
+
aria-haspopup={isPhone ? 'dialog' : 'menu'}
|
|
377
|
+
aria-expanded={moreOpen}
|
|
333
378
|
data-state={activeTabKey === MORE_TAB_KEY ? 'active' : 'inactive'}
|
|
334
379
|
data-shellui-floating-dock-tab=""
|
|
335
380
|
className={cn(
|
|
336
|
-
'inline-flex items-center justify-center whitespace-nowrap
|
|
381
|
+
'inline-flex items-center justify-center whitespace-nowrap focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50',
|
|
337
382
|
triggerClass,
|
|
338
383
|
)}
|
|
339
384
|
>
|
|
340
|
-
<
|
|
341
|
-
|
|
342
|
-
|
|
385
|
+
<DockCapsule>
|
|
386
|
+
<MoreHorizontalIcon className="shellui-dock-glyph size-5" />
|
|
387
|
+
</DockCapsule>
|
|
388
|
+
<span className="shellui-dock-label w-full truncate text-center">
|
|
389
|
+
{tc('desktopChrome.more')}
|
|
343
390
|
</span>
|
|
344
391
|
</button>
|
|
345
392
|
</DropdownMenuTrigger>
|
|
@@ -349,28 +396,39 @@ export function FloatingBottomDock({
|
|
|
349
396
|
sideOffset={10}
|
|
350
397
|
className="min-w-[12rem]"
|
|
351
398
|
>
|
|
352
|
-
{
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
399
|
+
{moreSections.map((section, sectionIndex) => (
|
|
400
|
+
<div key={`more-section-${sectionIndex}`}>
|
|
401
|
+
{sectionIndex > 0 ? <DropdownMenuSeparator /> : null}
|
|
402
|
+
{section.group ? (
|
|
403
|
+
<DropdownMenuLabel className="text-xs font-semibold text-muted-foreground">
|
|
404
|
+
{resolveLocalizedString(section.group.title, lang)}
|
|
405
|
+
</DropdownMenuLabel>
|
|
406
|
+
) : null}
|
|
407
|
+
{section.items.map((item) => {
|
|
408
|
+
const label = resolveLocalizedString(item.label, lang);
|
|
409
|
+
const pathPrefix = getNavPathPrefix(item);
|
|
410
|
+
const isActive =
|
|
411
|
+
item.openIn !== 'modal' &&
|
|
412
|
+
item.openIn !== 'drawer' &&
|
|
413
|
+
item.openIn !== 'external' &&
|
|
414
|
+
pathPrefix === activePathPrefix;
|
|
415
|
+
return (
|
|
416
|
+
<DropdownMenuItem
|
|
417
|
+
key={itemKey(item)}
|
|
418
|
+
className={cn(isActive && 'bg-accent font-medium')}
|
|
419
|
+
aria-current={isActive ? 'page' : undefined}
|
|
420
|
+
onSelect={() => activateItem(item)}
|
|
421
|
+
>
|
|
422
|
+
<TabGlyph
|
|
423
|
+
item={item}
|
|
424
|
+
label={label}
|
|
425
|
+
/>
|
|
426
|
+
<span className="min-w-0 flex-1 truncate">{label}</span>
|
|
427
|
+
</DropdownMenuItem>
|
|
428
|
+
);
|
|
429
|
+
})}
|
|
430
|
+
</div>
|
|
431
|
+
))}
|
|
374
432
|
{moreOverflowItems.length > 0 && (moreEndItems.length > 0 || showAuthButton) ? (
|
|
375
433
|
<DropdownMenuSeparator />
|
|
376
434
|
) : null}
|
|
@@ -402,9 +460,171 @@ export function FloatingBottomDock({
|
|
|
402
460
|
</DropdownMenuContent>
|
|
403
461
|
</DropdownMenu>
|
|
404
462
|
) : null}
|
|
463
|
+
{showMoreFinal && isPhone ? (
|
|
464
|
+
<>
|
|
465
|
+
<button
|
|
466
|
+
type="button"
|
|
467
|
+
onClick={() => setMoreOpen((open) => !open)}
|
|
468
|
+
role="tab"
|
|
469
|
+
aria-selected={activeTabKey === MORE_TAB_KEY}
|
|
470
|
+
aria-current={activeTabKey === MORE_TAB_KEY ? 'page' : undefined}
|
|
471
|
+
aria-haspopup={isPhone ? 'dialog' : 'menu'}
|
|
472
|
+
aria-expanded={moreOpen}
|
|
473
|
+
data-state={activeTabKey === MORE_TAB_KEY ? 'active' : 'inactive'}
|
|
474
|
+
data-shellui-floating-dock-tab=""
|
|
475
|
+
className={cn(
|
|
476
|
+
'inline-flex items-center justify-center whitespace-nowrap focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50',
|
|
477
|
+
triggerClass,
|
|
478
|
+
)}
|
|
479
|
+
>
|
|
480
|
+
<DockCapsule>
|
|
481
|
+
<MoreHorizontalIcon className="shellui-dock-glyph size-5" />
|
|
482
|
+
</DockCapsule>
|
|
483
|
+
<span className="shellui-dock-label w-full truncate text-center">
|
|
484
|
+
{tc('desktopChrome.more')}
|
|
485
|
+
</span>
|
|
486
|
+
</button>
|
|
487
|
+
<FloatingMoreSheet
|
|
488
|
+
open={moreOpen}
|
|
489
|
+
onOpenChange={setMoreOpen}
|
|
490
|
+
title={tc('desktopChrome.more')}
|
|
491
|
+
closeLabel={tc('shellChrome.closeMenu')}
|
|
492
|
+
externalLabel={tc('shellChrome.externalLink')}
|
|
493
|
+
lang={lang}
|
|
494
|
+
overflowItems={moreOverflowItems}
|
|
495
|
+
sections={moreSections}
|
|
496
|
+
endItems={moreEndItems}
|
|
497
|
+
showAuthButton={showAuthButton}
|
|
498
|
+
activePathPrefix={activePathPrefix}
|
|
499
|
+
onActivate={activateItem}
|
|
500
|
+
/>
|
|
501
|
+
</>
|
|
502
|
+
) : null}
|
|
405
503
|
</TabsList>
|
|
406
504
|
</Tabs>
|
|
407
505
|
</div>
|
|
408
506
|
</div>
|
|
409
507
|
);
|
|
410
508
|
}
|
|
509
|
+
|
|
510
|
+
/** Phone More: bottom sheet (vaul) for one-hand reach. Tablet keeps the dropdown. */
|
|
511
|
+
function FloatingMoreSheet({
|
|
512
|
+
open,
|
|
513
|
+
onOpenChange,
|
|
514
|
+
title,
|
|
515
|
+
closeLabel,
|
|
516
|
+
externalLabel,
|
|
517
|
+
lang,
|
|
518
|
+
overflowItems,
|
|
519
|
+
sections,
|
|
520
|
+
endItems,
|
|
521
|
+
showAuthButton,
|
|
522
|
+
activePathPrefix,
|
|
523
|
+
onActivate,
|
|
524
|
+
}: {
|
|
525
|
+
open: boolean;
|
|
526
|
+
onOpenChange: (open: boolean) => void;
|
|
527
|
+
title: string;
|
|
528
|
+
closeLabel: string;
|
|
529
|
+
externalLabel: string;
|
|
530
|
+
lang: string;
|
|
531
|
+
overflowItems: NavigationItem[];
|
|
532
|
+
sections: MoreSection[];
|
|
533
|
+
endItems: NavigationItem[];
|
|
534
|
+
showAuthButton: boolean;
|
|
535
|
+
activePathPrefix: string | null;
|
|
536
|
+
onActivate: (item: NavigationItem) => void;
|
|
537
|
+
}) {
|
|
538
|
+
const renderRow = (item: NavigationItem) => {
|
|
539
|
+
const label = resolveLocalizedString(item.label, lang);
|
|
540
|
+
const isActive =
|
|
541
|
+
item.openIn !== 'modal' &&
|
|
542
|
+
item.openIn !== 'drawer' &&
|
|
543
|
+
item.openIn !== 'external' &&
|
|
544
|
+
getNavPathPrefix(item) === activePathPrefix;
|
|
545
|
+
return (
|
|
546
|
+
<button
|
|
547
|
+
key={itemKey(item)}
|
|
548
|
+
type="button"
|
|
549
|
+
data-shellui-more-sheet-row=""
|
|
550
|
+
data-active={isActive ? 'true' : undefined}
|
|
551
|
+
aria-current={isActive ? 'page' : undefined}
|
|
552
|
+
className="shellui-more-sheet-row flex w-full items-center gap-3 text-left"
|
|
553
|
+
onClick={() => onActivate(item)}
|
|
554
|
+
>
|
|
555
|
+
<TabGlyph
|
|
556
|
+
item={item}
|
|
557
|
+
label={label}
|
|
558
|
+
/>
|
|
559
|
+
<span className="min-w-0 flex-1 truncate">{label}</span>
|
|
560
|
+
{item.openIn === 'external' ? <span className="sr-only">{externalLabel}</span> : null}
|
|
561
|
+
</button>
|
|
562
|
+
);
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
return (
|
|
566
|
+
<VaulDrawer.Root
|
|
567
|
+
open={open}
|
|
568
|
+
onOpenChange={onOpenChange}
|
|
569
|
+
direction="bottom"
|
|
570
|
+
>
|
|
571
|
+
<VaulDrawer.Portal>
|
|
572
|
+
<VaulDrawer.Overlay
|
|
573
|
+
data-shellui-more-sheet-overlay=""
|
|
574
|
+
className="fixed inset-0"
|
|
575
|
+
style={{ zIndex: Z_INDEX.SIDEBAR_SHEET_OVERLAY, background: 'var(--shellui-scrim)' }}
|
|
576
|
+
/>
|
|
577
|
+
<VaulDrawer.Content
|
|
578
|
+
data-shellui-more-sheet=""
|
|
579
|
+
aria-describedby={undefined}
|
|
580
|
+
className="shellui-more-sheet fixed flex max-h-[80dvh] flex-col text-sidebar-foreground outline-none"
|
|
581
|
+
style={{ zIndex: Z_INDEX.SIDEBAR_SHEET_CONTENT }}
|
|
582
|
+
>
|
|
583
|
+
<div
|
|
584
|
+
aria-hidden
|
|
585
|
+
className="shellui-more-sheet-handle mx-auto shrink-0"
|
|
586
|
+
/>
|
|
587
|
+
<VaulDrawer.Title className="sr-only">{title}</VaulDrawer.Title>
|
|
588
|
+
<nav
|
|
589
|
+
aria-label={title}
|
|
590
|
+
className="min-h-0 flex-1 overflow-y-auto px-2 pb-2"
|
|
591
|
+
>
|
|
592
|
+
{sections.map((section, sectionIndex) => (
|
|
593
|
+
<div
|
|
594
|
+
key={`more-sheet-section-${sectionIndex}`}
|
|
595
|
+
role={section.group ? 'group' : undefined}
|
|
596
|
+
aria-label={
|
|
597
|
+
section.group ? resolveLocalizedString(section.group.title, lang) : undefined
|
|
598
|
+
}
|
|
599
|
+
>
|
|
600
|
+
{section.group ? (
|
|
601
|
+
<div
|
|
602
|
+
aria-hidden
|
|
603
|
+
data-shellui-more-sheet-label=""
|
|
604
|
+
className="shellui-more-sheet-label"
|
|
605
|
+
>
|
|
606
|
+
{resolveLocalizedString(section.group.title, lang)}
|
|
607
|
+
</div>
|
|
608
|
+
) : null}
|
|
609
|
+
{section.items.map(renderRow)}
|
|
610
|
+
</div>
|
|
611
|
+
))}
|
|
612
|
+
{overflowItems.length > 0 && (endItems.length > 0 || showAuthButton) ? (
|
|
613
|
+
<div
|
|
614
|
+
aria-hidden
|
|
615
|
+
className="h-2"
|
|
616
|
+
/>
|
|
617
|
+
) : null}
|
|
618
|
+
{endItems.map(renderRow)}
|
|
619
|
+
{showAuthButton ? (
|
|
620
|
+
<div className="shellui-more-sheet-account px-1 py-1">
|
|
621
|
+
<LoginButton variant="sidebar" />
|
|
622
|
+
</div>
|
|
623
|
+
) : null}
|
|
624
|
+
</nav>
|
|
625
|
+
<VaulDrawer.Close className="sr-only">{closeLabel}</VaulDrawer.Close>
|
|
626
|
+
</VaulDrawer.Content>
|
|
627
|
+
</VaulDrawer.Portal>
|
|
628
|
+
</VaulDrawer.Root>
|
|
629
|
+
);
|
|
630
|
+
}
|
|
@@ -16,16 +16,17 @@ import { useAuth } from '../../auth/hooks/useAuth';
|
|
|
16
16
|
import { useSettings } from '../../settings/hooks/useSettings';
|
|
17
17
|
import { useViewport } from '../../../hooks/use-viewport';
|
|
18
18
|
import { DesktopHistoryButtons } from '../chrome/DesktopHistoryButtons';
|
|
19
|
-
import { useIsTauriClient, useMacTrafficLights } from '../chrome/runtime';
|
|
19
|
+
import { useIsTauriClient, useMacOverlayChrome, useMacTrafficLights } from '../chrome/runtime';
|
|
20
20
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
MAC_LIGHTS_SAFE_PX,
|
|
22
|
+
SHELL_HEADER_HEIGHT_PX,
|
|
23
|
+
SHELL_HEADER_PAD_TOP_PX,
|
|
24
24
|
} from '../chrome/constants';
|
|
25
25
|
import { FloatingBottomDock } from './FloatingBottomDock';
|
|
26
26
|
import { FloatingSidebar } from './FloatingSidebar';
|
|
27
27
|
import { FloatingStatusScrim } from './FloatingStatusScrim';
|
|
28
28
|
import { useFloatingChrome } from './useFloatingChrome';
|
|
29
|
+
import { useSoftKeyboard } from './useSoftKeyboard';
|
|
29
30
|
import { SafeAreaTopbarOffset, isShellUiRootWindow } from '../chrome/SafeAreaTopbar';
|
|
30
31
|
import { useChromeActionsSnapshot } from '../../chromeActions/ChromeActionsProvider';
|
|
31
32
|
import { actionChromeFlags } from '../../chromeActions/computeActionInsets';
|
|
@@ -46,8 +47,11 @@ export function FloatingLayout({ title, appIcon, navigation = [] }: FloatingLayo
|
|
|
46
47
|
const { navigationItem } = useNavigationItems();
|
|
47
48
|
const viewport = useViewport();
|
|
48
49
|
const { chromeVisible, sidebarCollapsed, toggleSidebarCollapsed } = useFloatingChrome(viewport);
|
|
50
|
+
// Phones and tablets: hide the dock and FAB while the soft keyboard is up.
|
|
51
|
+
useSoftKeyboard(viewport !== 'desktop');
|
|
49
52
|
const isTauriEnv = useIsTauriClient();
|
|
50
53
|
const trafficLights = useMacTrafficLights();
|
|
54
|
+
const macStrip = useMacOverlayChrome();
|
|
51
55
|
const currentLanguage = i18n.language || 'en';
|
|
52
56
|
|
|
53
57
|
const hasCustomLoginNav = useMemo(() => hasLoginNavigationItem(navigation), [navigation]);
|
|
@@ -114,13 +118,14 @@ export function FloatingLayout({ title, appIcon, navigation = [] }: FloatingLayo
|
|
|
114
118
|
<SafeAreaTopbarOffset enabled={showSafeAreaTopbar} />
|
|
115
119
|
<FloatingStatusScrim enabled={showStatusScrim} />
|
|
116
120
|
|
|
117
|
-
{
|
|
121
|
+
{/* macOS desktop: FloatingSidebar owns the strip, expanded or collapsed. */}
|
|
122
|
+
{isTauriEnv && !(showSidebar && !sidebarCollapsed) && !(showSidebar && macStrip) ? (
|
|
118
123
|
<div
|
|
119
124
|
className="pointer-events-auto absolute top-0 left-0 z-[46] flex items-center"
|
|
120
125
|
style={{
|
|
121
|
-
height:
|
|
122
|
-
paddingTop:
|
|
123
|
-
paddingLeft: trafficLights ?
|
|
126
|
+
height: SHELL_HEADER_HEIGHT_PX,
|
|
127
|
+
paddingTop: SHELL_HEADER_PAD_TOP_PX,
|
|
128
|
+
paddingLeft: trafficLights ? MAC_LIGHTS_SAFE_PX : 8,
|
|
124
129
|
}}
|
|
125
130
|
{...(trafficLights
|
|
126
131
|
? { 'data-shellui-drag-region': '', 'data-tauri-drag-region': '' }
|
|
@@ -137,6 +142,7 @@ export function FloatingLayout({ title, appIcon, navigation = [] }: FloatingLayo
|
|
|
137
142
|
{showTabBar ? (
|
|
138
143
|
<FloatingBottomDock
|
|
139
144
|
items={tabItems}
|
|
145
|
+
navigation={startNav}
|
|
140
146
|
endItems={endItems}
|
|
141
147
|
showAuthButton={showAuthButton}
|
|
142
148
|
chromeVisible={chromeVisible}
|