@shellui/core 0.7.0-alpha.10 → 0.7.0-alpha.12

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.
Files changed (46) hide show
  1. package/package.json +2 -2
  2. package/src/components/ui/drawer.tsx +47 -30
  3. package/src/components/ui/sheet.tsx +18 -12
  4. package/src/components/ui/shell-divider.spec.tsx +63 -0
  5. package/src/components/ui/shell-divider.tsx +20 -0
  6. package/src/components/ui/sidebar.tsx +15 -7
  7. package/src/components/ui/tooltip.tsx +4 -2
  8. package/src/features/auth/components/LoginButton.spec.tsx +203 -0
  9. package/src/features/auth/components/LoginButton.tsx +77 -28
  10. package/src/features/auth/components/LoginButtonIcons.tsx +4 -8
  11. package/src/features/chromeActions/ChromeActionsHost.tsx +5 -1
  12. package/src/features/layouts/OverlayShell.tsx +58 -40
  13. package/src/features/layouts/appbar/AppBarItemIcon.spec.tsx +45 -0
  14. package/src/features/layouts/appbar/AppBarItemIcon.tsx +19 -0
  15. package/src/features/layouts/appbar/AppBarLayout.tsx +53 -81
  16. package/src/features/layouts/appbar/appBarOverflow.spec.ts +27 -0
  17. package/src/features/layouts/appbar/appBarOverflow.ts +42 -0
  18. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +1 -1
  19. package/src/features/layouts/chrome/constants.ts +3 -0
  20. package/src/features/layouts/chrome/viewport.ts +11 -4
  21. package/src/features/layouts/floating/FloatingBottomDock.tsx +67 -26
  22. package/src/features/layouts/floating/FloatingLayout.tsx +1 -0
  23. package/src/features/layouts/floating/FloatingSidebar.tsx +43 -20
  24. package/src/features/layouts/floating/moreSections.spec.ts +28 -0
  25. package/src/features/layouts/floating/moreSections.ts +31 -0
  26. package/src/features/layouts/fullscreen/FullscreenLayout.spec.tsx +68 -0
  27. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +10 -1
  28. package/src/features/layouts/sidebar/NavigationContent.tsx +4 -4
  29. package/src/features/layouts/sidebar/SidebarIcons.tsx +67 -0
  30. package/src/features/layouts/sidebar/SidebarInner.spec.tsx +149 -0
  31. package/src/features/layouts/sidebar/SidebarInner.tsx +60 -11
  32. package/src/features/layouts/sidebar/SidebarLayout.tsx +23 -13
  33. package/src/features/layouts/windows/WindowsLayout.tsx +93 -47
  34. package/src/features/layouts/windows/deskDots.spec.ts +6 -4
  35. package/src/features/layouts/windows/deskDots.ts +8 -8
  36. package/src/features/overlays/ResponsiveModal.tsx +5 -3
  37. package/src/features/overlays/overlaySize.spec.ts +56 -16
  38. package/src/features/overlays/overlaySize.ts +114 -31
  39. package/src/features/overlays/phoneDrawerAnchoring.spec.ts +187 -0
  40. package/src/features/overlays/useOverlayReportedSize.ts +8 -3
  41. package/src/i18n/translations/en/common.json +1 -0
  42. package/src/i18n/translations/fr/common.json +1 -0
  43. package/src/index.css +232 -42
  44. package/src/service-worker/devCaches.spec.ts +32 -0
  45. package/src/service-worker/devCaches.ts +27 -0
  46. package/src/service-worker/sw-dev.ts +23 -23
@@ -5,13 +5,14 @@ import { Link, useLocation, useNavigate } from 'react-router';
5
5
  import urls from '../../../constants/urls';
6
6
  import { cn } from '../../../lib/utils';
7
7
  import { useIsMobile } from '../../../hooks/use-mobile';
8
+ import { ShellDivider } from '../../../components/ui/shell-divider';
8
9
  import { useAuth } from '../hooks/useAuth';
9
10
  import { UserIcon } from '../../settings/components/UserIcon';
10
11
  import { useConfig } from '../../config/useConfig';
11
12
  import { getAdminPath } from '../../admin/config';
12
13
  import { isAdminPath } from '../../admin/utils';
13
14
  import { flattenNavigationItems, getNavPathPrefix } from '../../layouts/utils';
14
- import { LogoutIcon, SidebarCaretIcon } from './LoginButtonIcons';
15
+ import { ChevronsUpDownIcon, LogoutIcon } from './LoginButtonIcons';
15
16
  import {
16
17
  DropdownMenu,
17
18
  DropdownMenuContent,
@@ -24,6 +25,17 @@ import { Skeleton } from '../../../components/ui/skeleton';
24
25
 
25
26
  type LoginButtonVariant = 'sidebar' | 'appbar' | 'windows';
26
27
 
28
+ /** Up to two initials from the name, else the first letter of the email. */
29
+ export function getAccountInitials(name?: string | null, email?: string | null): string {
30
+ const words = (name ?? '').trim().split(/\s+/).filter(Boolean);
31
+ if (words.length > 0) {
32
+ const first = Array.from(words[0])[0] ?? '';
33
+ const last = words.length > 1 ? (Array.from(words[words.length - 1])[0] ?? '') : '';
34
+ return (first + last).toUpperCase();
35
+ }
36
+ return (Array.from((email ?? '').trim())[0] ?? '').toUpperCase();
37
+ }
38
+
27
39
  const AdministrationIcon = ({ className }: { className?: string }) => (
28
40
  <svg
29
41
  xmlns="http://www.w3.org/2000/svg"
@@ -79,13 +91,13 @@ const variantConfig: Record<
79
91
  sidebar: {
80
92
  button: {
81
93
  authenticated:
82
- 'w-full h-8 rounded-md px-2 text-sm text-left text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:p-2!',
94
+ 'shellui-account-row w-full h-10 gap-2.5 rounded-[var(--shellui-r-row)] px-2 text-[13.5px] text-left text-sidebar-foreground hover:bg-[var(--shellui-nav-hover)] hover:text-sidebar-foreground data-[state=open]:bg-[var(--shellui-nav-hover)] group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:p-0!',
83
95
  loggedOut:
84
96
  'w-full h-8 rounded-md px-2 text-sm text-left text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:p-2!',
85
97
  loading:
86
- 'w-full h-8 px-2 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:p-2!',
98
+ 'shellui-account-row w-full h-10 gap-2.5 px-2 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:p-0!',
87
99
  },
88
- avatar: 'size-4',
100
+ avatar: 'size-6 text-[10.5px]',
89
101
  menu: { width: 'w-[min(16rem,calc(100vw-1.5rem))]', side: 'right', align: 'start' },
90
102
  showDisplayName: true,
91
103
  showCaret: true,
@@ -98,7 +110,7 @@ const variantConfig: Record<
98
110
  'h-7 max-w-[220px] rounded-md px-2.5 text-xs text-muted-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground',
99
111
  loading: 'size-7 justify-center',
100
112
  },
101
- avatar: 'size-4',
113
+ avatar: 'size-4 text-[10px]',
102
114
  menu: { width: 'w-[min(16rem,calc(100vw-1.5rem))]', side: 'bottom', align: 'end' },
103
115
  showDisplayName: false,
104
116
  showCaret: false,
@@ -111,7 +123,7 @@ const variantConfig: Record<
111
123
  'h-8 max-w-[180px] rounded-md px-2 text-xs text-sidebar-foreground hover:bg-sidebar-accent/50 hover:text-sidebar-foreground',
112
124
  loading: 'h-8 w-8 justify-center',
113
125
  },
114
- avatar: 'h-4 w-4',
126
+ avatar: 'h-4 w-4 text-[10px]',
115
127
  menu: { width: 'w-[min(15rem,calc(100vw-1.5rem))]', side: 'top', align: 'end' },
116
128
  showDisplayName: false,
117
129
  showCaret: false,
@@ -122,10 +134,19 @@ export const LoginButton = ({
122
134
  variant,
123
135
  hideWhenLoggedOut = false,
124
136
  logoutOnly = false,
137
+ dividerAbove = false,
125
138
  }: {
126
139
  variant: LoginButtonVariant;
127
140
  hideWhenLoggedOut?: boolean;
128
141
  logoutOnly?: boolean;
142
+ /**
143
+ * Full-width hairline above the signed-in account block, separating it from
144
+ * the footer items above, plus 4px of top padding above the account row.
145
+ * Signed out and loading states never render it. Pass false when the account
146
+ * block is the first footer item (the footer divider already separates it).
147
+ * The parent must inset the block by 8px (sidebar group, floating footer).
148
+ */
149
+ dividerAbove?: boolean;
129
150
  }) => {
130
151
  const currentVariantConfig = variantConfig[variant];
131
152
  const isMobile = useIsMobile();
@@ -144,14 +165,22 @@ export const LoginButton = ({
144
165
  return name || email || t('authMenu.userFallback');
145
166
  }, [t, user?.email, user?.name]);
146
167
 
147
- const fallbackInitial = displayName.charAt(0).toUpperCase();
168
+ const name = user?.name?.trim() || '';
169
+ const email = user?.email?.trim() || '';
170
+ const initials = getAccountInitials(name, email) || displayName.charAt(0).toUpperCase();
171
+ // Small avatars (app bar, taskbar) only fit one letter.
172
+ const avatarText = variant === 'sidebar' ? initials : initials.charAt(0);
173
+ const accountAriaLabel =
174
+ name && email
175
+ ? t('authMenu.openAccountMenuWithEmailAriaLabel', { name, email })
176
+ : t('authMenu.openAccountMenuAriaLabel', { name: displayName });
148
177
  const { showDisplayName, showCaret } = currentVariantConfig;
149
178
  const menuSide = variant === 'sidebar' && isMobile ? 'top' : currentVariantConfig.menu.side;
150
179
  const menuAlign = variant === 'sidebar' && isMobile ? 'start' : currentVariantConfig.menu.align;
151
180
  const menuCollisionPadding = isMobile ? 12 : 8;
152
181
 
153
182
  const baseButtonClasses = cn(
154
- 'inline-flex items-center gap-2 min-w-0 shrink-0 transition-colors cursor-pointer',
183
+ 'inline-flex items-center gap-2 min-w-0 shrink-0 transition-colors motion-reduce:transition-none cursor-pointer',
155
184
  'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
156
185
  'disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed',
157
186
  isAuthenticated
@@ -250,7 +279,10 @@ export const LoginButton = ({
250
279
  >
251
280
  <Skeleton className={cn('shrink-0 rounded-full', currentVariantConfig.avatar)} />
252
281
  {showDisplayName && (
253
- <Skeleton className="h-3 w-24 max-w-full group-data-[collapsible=icon]:hidden" />
282
+ <span className="flex min-w-0 flex-1 flex-col gap-1.5 group-data-[collapsible=icon]:hidden">
283
+ <Skeleton className="h-3 w-24 max-w-full" />
284
+ <Skeleton className="h-2.5 w-32 max-w-full" />
285
+ </span>
254
286
  )}
255
287
  </div>
256
288
  );
@@ -278,7 +310,7 @@ export const LoginButton = ({
278
310
  return null;
279
311
  }
280
312
 
281
- return (
313
+ const accountMenu = (
282
314
  <DropdownMenu
283
315
  open={isMenuOpen}
284
316
  onOpenChange={setIsMenuOpen}
@@ -289,13 +321,16 @@ export const LoginButton = ({
289
321
  ref={triggerRef}
290
322
  type="button"
291
323
  className={baseButtonClasses}
292
- title={displayName}
293
- aria-label={t('authMenu.openAccountMenuAriaLabel', { name: displayName })}
324
+ title={name && email ? `${name}\n${email}` : displayName}
325
+ aria-label={accountAriaLabel}
326
+ data-shellui-account-trigger=""
327
+ data-shellui-no-drag=""
294
328
  >
295
329
  {user.profilePicture ? (
296
330
  <img
297
331
  src={user.profilePicture}
298
- alt={displayName}
332
+ alt=""
333
+ aria-hidden
299
334
  className={cn(
300
335
  'shrink-0 overflow-hidden rounded-full border border-sidebar-border object-cover aspect-square',
301
336
  currentVariantConfig.avatar,
@@ -305,30 +340,30 @@ export const LoginButton = ({
305
340
  ) : (
306
341
  <span
307
342
  className={cn(
308
- 'flex shrink-0 aspect-square items-center justify-center overflow-hidden rounded-full border border-sidebar-border bg-muted text-[10px] font-semibold leading-none',
343
+ 'flex shrink-0 aspect-square items-center justify-center overflow-hidden rounded-full border border-sidebar-border bg-sidebar-accent text-sidebar-foreground font-semibold leading-none',
309
344
  currentVariantConfig.avatar,
310
345
  )}
311
346
  aria-hidden
347
+ data-shellui-account-initials=""
312
348
  >
313
- {fallbackInitial}
349
+ {avatarText}
314
350
  </span>
315
351
  )}
316
352
  {showDisplayName && (
317
- <span className="truncate group-data-[collapsible=icon]:hidden">{displayName}</span>
353
+ <span className="flex min-w-0 flex-1 flex-col group-data-[collapsible=icon]:hidden">
354
+ <span className="truncate leading-tight">{displayName}</span>
355
+ {name && email ? (
356
+ <span
357
+ className="truncate text-[11.5px] leading-tight text-[var(--shellui-nav-label)]"
358
+ data-shellui-account-email=""
359
+ >
360
+ {email}
361
+ </span>
362
+ ) : null}
363
+ </span>
318
364
  )}
319
365
  {showCaret && (
320
- <span
321
- aria-hidden
322
- className={cn(
323
- 'ml-auto shrink-0 text-[10px] group-data-[collapsible=icon]:hidden',
324
- isMenuOpen ? 'text-foreground' : 'text-muted-foreground',
325
- )}
326
- >
327
- <SidebarCaretIcon
328
- isOpen={isMenuOpen}
329
- className="h-3 w-3"
330
- />
331
- </span>
366
+ <ChevronsUpDownIcon className="ml-auto size-4 shrink-0 text-[var(--shellui-nav-icon)] group-data-[collapsible=icon]:hidden" />
332
367
  )}
333
368
  </button>
334
369
  </DropdownMenuTrigger>
@@ -383,4 +418,18 @@ export const LoginButton = ({
383
418
  </DropdownMenuContent>
384
419
  </DropdownMenu>
385
420
  );
421
+
422
+ if (!dividerAbove) return accountMenu;
423
+
424
+ // Full-width hairline (cancels the 8px row inset), then 4px so the account
425
+ // row breathes below it.
426
+ return (
427
+ <>
428
+ <ShellDivider
429
+ data-shellui-account-divider=""
430
+ className="-mx-2 mt-1"
431
+ />
432
+ <div className="pt-1">{accountMenu}</div>
433
+ </>
434
+ );
386
435
  };
@@ -1,10 +1,5 @@
1
- export const SidebarCaretIcon = ({
2
- className,
3
- isOpen,
4
- }: {
5
- className?: string;
6
- isOpen: boolean;
7
- }) => (
1
+ /** lucide chevrons-up-down */
2
+ export const ChevronsUpDownIcon = ({ className }: { className?: string }) => (
8
3
  <svg
9
4
  xmlns="http://www.w3.org/2000/svg"
10
5
  width="24"
@@ -18,7 +13,8 @@ export const SidebarCaretIcon = ({
18
13
  className={className}
19
14
  aria-hidden
20
15
  >
21
- {isOpen ? <path d="m15 6-6 6 6 6" /> : <path d="m9 6 6 6-6 6" />}
16
+ <path d="m7 15 5 5 5-5" />
17
+ <path d="m7 9 5-5 5 5" />
22
18
  </svg>
23
19
  );
24
20
 
@@ -1464,9 +1464,12 @@ export function ChromeActionsHost() {
1464
1464
  export function WindowTitleBarActions({
1465
1465
  frameUuid,
1466
1466
  fallbackTitle,
1467
+ centerTitle = false,
1467
1468
  }: {
1468
1469
  frameUuid: string | null;
1469
1470
  fallbackTitle?: string;
1471
+ /** Phone header: centred 15px / 600 page title. */
1472
+ centerTitle?: boolean;
1470
1473
  }) {
1471
1474
  const all = useChromeActionsSnapshot();
1472
1475
  const actions = useMemo(
@@ -1502,7 +1505,8 @@ export function WindowTitleBarActions({
1502
1505
  return (
1503
1506
  <span
1504
1507
  className={cn(
1505
- 'min-w-0 flex-1 truncate text-sm font-medium',
1508
+ 'min-w-0 flex-1 truncate',
1509
+ centerTitle ? 'text-center text-[15px] font-semibold' : 'text-sm font-medium',
1506
1510
  chromeActionsFadeClass,
1507
1511
  'opacity-100',
1508
1512
  )}
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
4
4
  import { shellui } from '@shellui/sdk';
5
5
  import type { NavigationItem } from '../config/types';
6
6
  import { Drawer, DrawerContent, DrawerTitle, DrawerDescription } from '../../components/ui/drawer';
7
+ import type { WithFadeFromProps, WithoutFadeFromProps } from 'vaul';
7
8
  import { ContentView } from '../../components/ContentView';
8
9
  import { useModal } from '../modal/ModalContext';
9
10
  import { useDrawer } from '../drawer/DrawerContext';
@@ -23,6 +24,7 @@ import {
23
24
  resolveDrawerSize,
24
25
  resolveDrawerSizeForViewport,
25
26
  resolveEffectiveDrawerPosition,
27
+ resolveDrawerChrome,
26
28
  isDynamicSizing,
27
29
  SHEET_EXPANDED_HEIGHT_CSS,
28
30
  } from '../overlays/overlaySize';
@@ -33,6 +35,8 @@ import { OverlayDrawerPendingBar } from '../overlays/OverlayDrawerPendingBar';
33
35
 
34
36
  /** Matches --shellui-overlay-max-height in index.css */
35
37
  const OVERLAY_MAX_H = 'var(--shellui-overlay-max-height)';
38
+ /** Matches --shellui-drawer-max-height: the viewport minus the floating offsets. */
39
+ const DRAWER_MAX_H = 'var(--shellui-drawer-max-height)';
36
40
 
37
41
  interface OverlayShellProps {
38
42
  children: ReactNode;
@@ -228,11 +232,16 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
228
232
  usedFallback: modalSizeFallback,
229
233
  wasClamped: modalWasClamped,
230
234
  } = useOverlayReportedSize(modalContentSized, isOpen && !isDrawerOpen);
235
+ // Phone sheets grow up to the drawer max height (CSS), so the report is not cut at 92%.
231
236
  const {
232
237
  reported: drawerReported,
233
238
  usedFallback: drawerSizeFallback,
234
239
  wasClamped: drawerWasClamped,
235
- } = useOverlayReportedSize(drawerSize.contentSized || drawerDynamic, isDrawerOpen);
240
+ } = useOverlayReportedSize(
241
+ drawerSize.contentSized || drawerDynamic,
242
+ isDrawerOpen,
243
+ isMobile ? 1 : undefined,
244
+ );
236
245
 
237
246
  const modalPending = isOpen && modalContentSized && !modalReported;
238
247
  const drawerPending =
@@ -351,6 +360,10 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
351
360
  }),
352
361
  };
353
362
 
363
+ // Phone sheet from an app that never reports its size: use the requested preset.
364
+ const drawerPhoneFallback =
365
+ drawerSizeFallback && drawerSize.fallbackHeight ? drawerSize.fallbackHeight : null;
366
+
354
367
  const drawerContentStyle: CSSProperties = {
355
368
  ...drawerSize.style,
356
369
  ...(drawerSize.contentSized || drawerDynamic ? { transition: 'none' } : {}),
@@ -366,17 +379,19 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
366
379
  maxWidth: drawerPendingPx,
367
380
  minWidth: drawerPendingPx,
368
381
  }
369
- : drawerReported
370
- ? drawerIsVertical
371
- ? {
372
- height: drawerReported.height,
373
- maxHeight: `min(${drawerReported.height}px, ${overlayMaxH})`,
374
- }
375
- : {
376
- width: drawerReported.width ?? drawerReported.height,
377
- maxWidth: `min(${drawerReported.width ?? drawerReported.height}px, 92vw)`,
378
- }
379
- : {}),
382
+ : drawerPhoneFallback
383
+ ? { height: drawerPhoneFallback, maxHeight: DRAWER_MAX_H }
384
+ : drawerReported
385
+ ? drawerIsVertical
386
+ ? {
387
+ height: drawerReported.height,
388
+ maxHeight: `min(${drawerReported.height}px, ${DRAWER_MAX_H})`,
389
+ }
390
+ : {
391
+ width: drawerReported.width ?? drawerReported.height,
392
+ maxWidth: `min(${drawerReported.width ?? drawerReported.height}px, 92vw)`,
393
+ }
394
+ : {}),
380
395
  };
381
396
 
382
397
  const handleModalOpenChange = (open: boolean) => {
@@ -397,22 +412,28 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
397
412
  const drawerDesktopResizable =
398
413
  !drawerPending && !isMobile && !drawerDynamic && drawerOptions?.resizable !== false;
399
414
 
400
- // Bottom sheets: snap between the configured height and near-full so drag-up expands.
401
- // Skip when desktop free-edge resize is active (those compete with Vaul snaps).
415
+ // Phones: always a bottom sheet with a drag handle. Desktop: requested edge and options.
416
+ const drawerChrome = resolveDrawerChrome({
417
+ position: drawerPosition,
418
+ isMobile,
419
+ dismiss: drawerDismiss,
420
+ pending: drawerPending,
421
+ desktopResizable: drawerDesktopResizable,
422
+ contentSized: drawerSize.contentSized || drawerDynamic,
423
+ });
424
+
425
+ // Desktop bottom sheets: snap between the configured height and near-full so drag-up
426
+ // expands. Phones never snap (content-height sheets). Skip when desktop free-edge
427
+ // resize is active (those compete with Vaul snaps).
402
428
  const drawerSnapPoints = useMemo(() => {
403
- if (effectiveDrawerPosition !== 'bottom') return undefined;
404
- if (!drawerDismiss.showDragHandle || !drawerDismiss.dismissible) return undefined;
405
- if (drawerPending || drawerDesktopResizable) return undefined;
429
+ if (!drawerChrome.allowSnapPoints) return undefined;
406
430
  return resolveBottomSheetSnapPoints(drawerOptions, drawerReported?.height ?? null) ?? undefined;
407
- }, [
408
- effectiveDrawerPosition,
409
- drawerDismiss.showDragHandle,
410
- drawerDismiss.dismissible,
411
- drawerPending,
412
- drawerDesktopResizable,
413
- drawerOptions,
414
- drawerReported?.height,
415
- ]);
431
+ }, [drawerChrome.allowSnapPoints, drawerOptions, drawerReported?.height]);
432
+
433
+ // Floating sheet: show the scrim from the first snap, not only when expanded.
434
+ const drawerSnapProps: WithFadeFromProps | WithoutFadeFromProps = drawerSnapPoints
435
+ ? { snapPoints: drawerSnapPoints, fadeFromIndex: 0 }
436
+ : {};
416
437
 
417
438
  const [drawerActiveSnap, setDrawerActiveSnap] = useState<number | string | null>(null);
418
439
 
@@ -482,7 +503,7 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
482
503
  onOpenChange={handleDrawerOpenChange}
483
504
  direction={effectiveDrawerPosition}
484
505
  dismissible={drawerDismiss.dismissible}
485
- snapPoints={drawerSnapPoints}
506
+ {...drawerSnapProps}
486
507
  activeSnapPoint={drawerSnapPoints ? drawerActiveSnap : undefined}
487
508
  setActiveSnapPoint={drawerSnapPoints ? setDrawerActiveSnap : undefined}
488
509
  >
@@ -492,13 +513,15 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
492
513
  size={
493
514
  drawerSnapPoints
494
515
  ? SHEET_EXPANDED_HEIGHT_CSS
495
- : drawerReported
496
- ? drawerIsVertical
497
- ? `${drawerReported.height}px`
498
- : `${drawerReported.width ?? drawerReported.height}px`
499
- : drawerPending
500
- ? `${drawerPendingPx}px`
501
- : drawerSize.drawerSize
516
+ : drawerPhoneFallback
517
+ ? drawerPhoneFallback
518
+ : drawerReported
519
+ ? drawerIsVertical
520
+ ? `${drawerReported.height}px`
521
+ : `${drawerReported.width ?? drawerReported.height}px`
522
+ : drawerPending
523
+ ? `${drawerPendingPx}px`
524
+ : drawerSize.drawerSize
502
525
  }
503
526
  style={
504
527
  drawerSnapPoints
@@ -511,12 +534,7 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
511
534
  }
512
535
  className={drawerSize.className}
513
536
  showCloseButton={!drawerPending && drawerDismiss.showCloseButton}
514
- showDragHandle={
515
- !drawerPending &&
516
- drawerIsVertical &&
517
- drawerDismiss.showDragHandle &&
518
- drawerDismiss.dismissible
519
- }
537
+ showDragHandle={drawerChrome.showDragHandle}
520
538
  closeOnOverlayClick={drawerDismiss.closeOnOverlayClick}
521
539
  resizable={drawerDesktopResizable}
522
540
  >
@@ -0,0 +1,45 @@
1
+ // @vitest-environment happy-dom
2
+ import { act } from 'react';
3
+ import { createRoot, type Root } from 'react-dom/client';
4
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
5
+ import type { NavigationItem } from '../../config/types';
6
+ import { AppBarItemIcon } from './AppBarItemIcon';
7
+
8
+ (globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
9
+
10
+ let container: HTMLDivElement;
11
+ let root: Root;
12
+
13
+ beforeEach(() => {
14
+ container = document.createElement('div');
15
+ document.body.appendChild(container);
16
+ root = createRoot(container);
17
+ });
18
+
19
+ afterEach(() => {
20
+ act(() => root.unmount());
21
+ container.remove();
22
+ });
23
+
24
+ function render(item: Partial<NavigationItem>) {
25
+ act(() =>
26
+ root.render(<AppBarItemIcon item={{ path: 'x', url: '/x', label: 'Docs', ...item }} />),
27
+ );
28
+ return container.firstElementChild as HTMLElement;
29
+ }
30
+
31
+ describe('AppBarItemIcon', () => {
32
+ it('renders a plain 16px icon with no muted tile', () => {
33
+ const el = render({ icon: '/icons/book.svg' });
34
+ expect(el.className).toContain('size-4');
35
+ expect(el.className).not.toContain('bg-muted');
36
+ expect(el.className).not.toContain('rounded-md');
37
+ });
38
+
39
+ it('falls back to the default 16px glyph instead of a letter tile', () => {
40
+ const el = render({});
41
+ expect(el.tagName.toLowerCase()).toBe('svg');
42
+ expect(el.getAttribute('class')).toContain('size-4');
43
+ expect(container.textContent).toBe('');
44
+ });
45
+ });
@@ -0,0 +1,19 @@
1
+ import type { NavigationItem } from '../../config/types';
2
+ import { NavIcon } from '../sidebar/SidebarIcons';
3
+ import { getExternalFaviconUrl } from '../sidebar/sidebarUtils';
4
+
5
+ function itemIconSrc(item: NavigationItem): string | null {
6
+ if (item.icon) return item.icon;
7
+ if (item.openIn === 'external') return getExternalFaviconUrl(item.url);
8
+ return null;
9
+ }
10
+
11
+ /** Plain 16px icon for start-nav links and their menus (no tile, like the mock). */
12
+ export function AppBarItemIcon({ item }: { item: NavigationItem }) {
13
+ return (
14
+ <NavIcon
15
+ src={itemIconSrc(item)}
16
+ className="size-4"
17
+ />
18
+ );
19
+ }