@shellui/core 0.5.0-alpha.5 → 0.5.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/package.json +2 -2
- package/src/components/ContentView.tsx +1 -1
- package/src/components/ui/alert-dialog.tsx +51 -34
- package/src/components/ui/drawer.tsx +57 -40
- package/src/components/ui/sidebar.tsx +11 -4
- package/src/components/ui/sonner.tsx +20 -2
- package/src/features/alertDialog/DialogContext.tsx +11 -5
- package/src/features/auth/components/AccessPendingView.tsx +1 -1
- package/src/features/auth/components/LoginButton.tsx +3 -3
- package/src/features/auth/components/LoginView.tsx +5 -4
- package/src/features/layouts/LayoutFallback.tsx +1 -1
- package/src/features/layouts/OverlayShell.tsx +76 -44
- package/src/features/layouts/appbar/AppBarLayout.tsx +473 -291
- package/src/features/layouts/chrome/viewport.ts +66 -0
- package/src/features/layouts/fullscreen/FullscreenLayout.tsx +1 -1
- package/src/features/layouts/sidebar/SidebarInner.tsx +1 -1
- package/src/features/layouts/sidebar/SidebarLayout.tsx +110 -38
- package/src/features/layouts/windows/WindowsLayout.tsx +138 -42
- package/src/features/overlays/ResponsiveModal.tsx +36 -17
- package/src/features/overlays/overlaySize.spec.ts +27 -1
- package/src/features/overlays/overlaySize.ts +73 -18
- package/src/features/overlays/useOverlayReportedSize.ts +5 -4
- package/src/features/settings/SettingsView.tsx +9 -2
- package/src/features/storage/uploads/UploadToastCard.tsx +1 -1
- package/src/features/storage/uploads/UploadToaster.tsx +6 -3
- package/src/features/theme/applyTheme.ts +20 -1
- package/src/i18n/translations/en/common.json +2 -1
- package/src/i18n/translations/fr/common.json +2 -1
- package/src/index.css +168 -12
- package/src/index.html +32 -3
- package/src/routes/components/RouteErrorBoundary.tsx +1 -1
- package/src/routes/components/RouteFallback.tsx +1 -1
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
resolveDialogSize,
|
|
21
21
|
resolveDismissOptions,
|
|
22
22
|
resolveDrawerSize,
|
|
23
|
+
resolveDrawerSizeForViewport,
|
|
24
|
+
resolveEffectiveDrawerPosition,
|
|
23
25
|
isDynamicSizing,
|
|
24
26
|
} from '../overlays/overlaySize';
|
|
25
27
|
import { useOverlayReportedSize } from '../overlays/useOverlayReportedSize';
|
|
@@ -27,6 +29,9 @@ import { ResponsiveModal } from '../overlays/ResponsiveModal';
|
|
|
27
29
|
import { OverlayPendingSpinner } from '../overlays/OverlayPendingSpinner';
|
|
28
30
|
import { OverlayDrawerPendingBar } from '../overlays/OverlayDrawerPendingBar';
|
|
29
31
|
|
|
32
|
+
/** Matches --shellui-overlay-max-height in index.css */
|
|
33
|
+
const OVERLAY_MAX_H = 'var(--shellui-overlay-max-height)';
|
|
34
|
+
|
|
30
35
|
interface OverlayShellProps {
|
|
31
36
|
children: ReactNode;
|
|
32
37
|
}
|
|
@@ -58,6 +63,8 @@ function OverlayIframe({
|
|
|
58
63
|
pending,
|
|
59
64
|
pendingFill,
|
|
60
65
|
pendingChrome = 'spinner',
|
|
66
|
+
/** Mobile sheet: measure and lay out at full viewport width (ignore reported width). */
|
|
67
|
+
forceFullWidth = false,
|
|
61
68
|
}: {
|
|
62
69
|
url: string;
|
|
63
70
|
navItem: NavigationItem;
|
|
@@ -72,26 +79,27 @@ function OverlayIframe({
|
|
|
72
79
|
pendingFill?: boolean;
|
|
73
80
|
/** Modal: centered spinner. Drawer: full-bleed 40px loading bar. */
|
|
74
81
|
pendingChrome?: 'spinner' | 'bar';
|
|
82
|
+
forceFullWidth?: boolean;
|
|
75
83
|
}) {
|
|
76
84
|
// Content-sized: iframe tracks reported content. While pending, chrome is a square/strip
|
|
77
85
|
// but the iframe lays out at a realistic width (opacity 0) so the first report matches
|
|
78
|
-
// final wrap — drawers use viewport width; modals use
|
|
86
|
+
// final wrap — drawers / mobile sheets use viewport width; desktop modals use compact measure.
|
|
79
87
|
const scroll = allowInnerScroll || !contentSized;
|
|
80
88
|
const modalPendingPx = DYNAMIC_OVERLAY_PENDING_PX;
|
|
81
89
|
const drawerPendingPx = DYNAMIC_DRAWER_PENDING_PX;
|
|
82
|
-
const useSquarePending =
|
|
90
|
+
const useSquarePending =
|
|
91
|
+
pending && !pendingFill && pendingChrome === 'spinner' && !forceFullWidth;
|
|
83
92
|
const useDrawerBarPending = pending && pendingChrome === 'bar';
|
|
93
|
+
const useFullWidthPending = pending && forceFullWidth && pendingChrome === 'spinner';
|
|
94
|
+
const viewportW =
|
|
95
|
+
typeof window !== 'undefined' ? window.innerWidth : DYNAMIC_OVERLAY_MEASURE_WIDTH_PX;
|
|
84
96
|
const measureW =
|
|
85
|
-
pendingChrome === 'bar'
|
|
86
|
-
? typeof window !== 'undefined'
|
|
87
|
-
? window.innerWidth
|
|
88
|
-
: DYNAMIC_OVERLAY_MEASURE_WIDTH_PX
|
|
89
|
-
: DYNAMIC_OVERLAY_MEASURE_WIDTH_PX;
|
|
97
|
+
forceFullWidth || pendingChrome === 'bar' ? viewportW : DYNAMIC_OVERLAY_MEASURE_WIDTH_PX;
|
|
90
98
|
|
|
91
99
|
if (!contentSized) {
|
|
92
100
|
// Fill drawer chrome so ContentView's top loading bar is visible (not a 0-height flex quirk).
|
|
93
101
|
return (
|
|
94
|
-
<div className="relative min-h-0 w-full flex-1">
|
|
102
|
+
<div className="relative h-full min-h-0 w-full flex-1">
|
|
95
103
|
<div className="absolute inset-0 overflow-hidden bg-background">
|
|
96
104
|
<ContentView
|
|
97
105
|
url={url}
|
|
@@ -117,23 +125,29 @@ function OverlayIframe({
|
|
|
117
125
|
overflow: 'hidden',
|
|
118
126
|
}
|
|
119
127
|
: {
|
|
120
|
-
height
|
|
121
|
-
|
|
122
|
-
|
|
128
|
+
// Fill the chrome. Do NOT set an absolute pixel height here — the chrome
|
|
129
|
+
// owns height/maxHeight; a taller iframe would paint past the visible sheet.
|
|
130
|
+
height: '100%',
|
|
131
|
+
minHeight: 0,
|
|
132
|
+
width: forceFullWidth ? '100%' : (reportedWidth ?? '100%'),
|
|
123
133
|
overflow: scroll ? 'auto' : 'hidden',
|
|
124
134
|
};
|
|
125
135
|
|
|
126
136
|
return (
|
|
127
137
|
<div
|
|
128
|
-
className={`relative w-full
|
|
138
|
+
className={`relative w-full min-h-0 bg-background${
|
|
139
|
+
pending ? '' : ' h-full'
|
|
140
|
+
}${useDrawerBarPending && pendingFill ? ' h-full min-h-0' : ''}`}
|
|
129
141
|
style={
|
|
130
142
|
useSquarePending
|
|
131
143
|
? { width: modalPendingPx, height: modalPendingPx, overflow: 'hidden' }
|
|
132
|
-
:
|
|
133
|
-
? { width: '100%', height:
|
|
134
|
-
: useDrawerBarPending && pendingFill
|
|
135
|
-
? { width: '100%', height:
|
|
136
|
-
:
|
|
144
|
+
: useFullWidthPending
|
|
145
|
+
? { width: '100%', height: modalPendingPx, overflow: 'hidden' }
|
|
146
|
+
: useDrawerBarPending && !pendingFill
|
|
147
|
+
? { width: '100%', height: drawerPendingPx, overflow: 'hidden' }
|
|
148
|
+
: useDrawerBarPending && pendingFill
|
|
149
|
+
? { width: '100%', height: '100%', minHeight: drawerPendingPx, overflow: 'hidden' }
|
|
150
|
+
: undefined
|
|
137
151
|
}
|
|
138
152
|
aria-busy={pending || undefined}
|
|
139
153
|
aria-live={pending ? 'polite' : undefined}
|
|
@@ -182,9 +196,11 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
|
|
|
182
196
|
const drawerDynamic = isDynamicSizing(drawerOptions);
|
|
183
197
|
|
|
184
198
|
const dialogSize = useMemo(() => resolveDialogSize(modalOptions), [modalOptions]);
|
|
199
|
+
// Mobile: every drawer edge uses bottom-sheet chrome (consistent with openModal).
|
|
200
|
+
const effectiveDrawerPosition = resolveEffectiveDrawerPosition(drawerPosition, isMobile);
|
|
185
201
|
const drawerSize = useMemo(
|
|
186
|
-
() =>
|
|
187
|
-
[drawerOptions, drawerPosition],
|
|
202
|
+
() => resolveDrawerSizeForViewport(drawerOptions, drawerPosition, isMobile),
|
|
203
|
+
[drawerOptions, drawerPosition, isMobile],
|
|
188
204
|
);
|
|
189
205
|
// Sheet presentation for mobile — bottom drawer sizing from the same modal options.
|
|
190
206
|
const sheetSize = useMemo(
|
|
@@ -199,6 +215,8 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
|
|
|
199
215
|
),
|
|
200
216
|
[modalOptions, modalDynamic],
|
|
201
217
|
);
|
|
218
|
+
const drawerIsVertical =
|
|
219
|
+
effectiveDrawerPosition === 'top' || effectiveDrawerPosition === 'bottom';
|
|
202
220
|
|
|
203
221
|
const modalContentSized = dialogSize.contentSized || sheetSize.contentSized || modalDynamic;
|
|
204
222
|
const {
|
|
@@ -268,18 +286,25 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
|
|
|
268
286
|
|
|
269
287
|
const modalChromeClassName = modalPending
|
|
270
288
|
? presentation === 'sheet'
|
|
271
|
-
? 'w-full p-0 overflow-hidden flex flex-col'
|
|
289
|
+
? 'w-full max-w-none p-0 overflow-hidden flex flex-col'
|
|
272
290
|
: 'rounded-lg p-0 overflow-hidden flex flex-col !w-auto !max-w-none'
|
|
273
291
|
: presentation === 'sheet'
|
|
274
|
-
?
|
|
292
|
+
? // Dynamic mobile sheets always fill width; height still follows content reports
|
|
293
|
+
modalContentSized
|
|
294
|
+
? 'w-full max-w-none p-0 overflow-hidden flex flex-col'
|
|
295
|
+
: sheetSize.className
|
|
275
296
|
: dialogSize.className;
|
|
276
297
|
|
|
298
|
+
const overlayMaxH = OVERLAY_MAX_H;
|
|
299
|
+
|
|
277
300
|
const modalChromeStyle: CSSProperties = {
|
|
278
301
|
// Dynamic overlays snap to reported size — no height/width tween (avoids multi-step jumps)
|
|
279
302
|
...(modalContentSized ? { transition: 'none' } : {}),
|
|
280
303
|
...(modalPending
|
|
281
304
|
? presentation === 'sheet'
|
|
282
305
|
? {
|
|
306
|
+
width: '100%',
|
|
307
|
+
maxWidth: '100%',
|
|
283
308
|
height: pendingPx,
|
|
284
309
|
minHeight: pendingPx,
|
|
285
310
|
maxHeight: pendingPx,
|
|
@@ -298,23 +323,27 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
|
|
|
298
323
|
? presentation === 'sheet'
|
|
299
324
|
? {
|
|
300
325
|
height: modalReported.height,
|
|
301
|
-
maxHeight: `min(${modalReported.height}px,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
326
|
+
maxHeight: `min(${modalReported.height}px, ${overlayMaxH})`,
|
|
327
|
+
// Phone sheets: always full width (dynamic sizing only drives height)
|
|
328
|
+
width: '100%',
|
|
329
|
+
maxWidth: '100%',
|
|
305
330
|
}
|
|
306
331
|
: {
|
|
307
332
|
height: modalReported.height,
|
|
308
|
-
maxHeight: `min(${modalReported.height}px,
|
|
333
|
+
maxHeight: `min(${modalReported.height}px, ${overlayMaxH})`,
|
|
309
334
|
width: modalReported.width ?? DYNAMIC_OVERLAY_MEASURE_WIDTH_PX,
|
|
310
335
|
maxWidth: 'min(92vw, 100%)',
|
|
311
336
|
}
|
|
312
337
|
: presentation === 'sheet' && sheetSize.drawerSize
|
|
313
338
|
? {
|
|
314
339
|
height: sheetSize.drawerSize,
|
|
315
|
-
maxHeight: `min(${sheetSize.drawerSize},
|
|
340
|
+
maxHeight: `min(${sheetSize.drawerSize}, ${overlayMaxH})`,
|
|
341
|
+
width: '100%',
|
|
342
|
+
maxWidth: '100%',
|
|
316
343
|
}
|
|
317
|
-
:
|
|
344
|
+
: presentation === 'sheet'
|
|
345
|
+
? { width: '100%', maxWidth: '100%' }
|
|
346
|
+
: {}),
|
|
318
347
|
}),
|
|
319
348
|
};
|
|
320
349
|
|
|
@@ -322,7 +351,7 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
|
|
|
322
351
|
...drawerSize.style,
|
|
323
352
|
...(drawerSize.contentSized || drawerDynamic ? { transition: 'none' } : {}),
|
|
324
353
|
...(drawerPending
|
|
325
|
-
?
|
|
354
|
+
? drawerIsVertical
|
|
326
355
|
? {
|
|
327
356
|
height: drawerPendingPx,
|
|
328
357
|
maxHeight: drawerPendingPx,
|
|
@@ -334,10 +363,10 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
|
|
|
334
363
|
minWidth: drawerPendingPx,
|
|
335
364
|
}
|
|
336
365
|
: drawerReported
|
|
337
|
-
?
|
|
366
|
+
? drawerIsVertical
|
|
338
367
|
? {
|
|
339
368
|
height: drawerReported.height,
|
|
340
|
-
maxHeight: `min(${drawerReported.height}px,
|
|
369
|
+
maxHeight: `min(${drawerReported.height}px, ${overlayMaxH})`,
|
|
341
370
|
}
|
|
342
371
|
: {
|
|
343
372
|
width: drawerReported.width ?? drawerReported.height,
|
|
@@ -395,28 +424,32 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
|
|
|
395
424
|
navItem={modalNavItem}
|
|
396
425
|
contentSized={modalContentSized}
|
|
397
426
|
reportedHeight={modalReported?.height ?? null}
|
|
398
|
-
reportedWidth={modalReported?.width ?? null}
|
|
427
|
+
reportedWidth={presentation === 'sheet' ? null : (modalReported?.width ?? null)}
|
|
399
428
|
allowInnerScroll={modalSizeFallback || modalWasClamped}
|
|
400
429
|
pending={modalPending}
|
|
430
|
+
forceFullWidth={presentation === 'sheet'}
|
|
401
431
|
/>
|
|
402
432
|
) : (
|
|
403
433
|
<OverlayUrlError kind="modal" />
|
|
404
434
|
)}
|
|
405
435
|
</ResponsiveModal>
|
|
406
436
|
|
|
407
|
-
{/*
|
|
437
|
+
{/*
|
|
438
|
+
Explicit drawers — on mobile every edge presents as a bottom sheet
|
|
439
|
+
(same chrome as openModal sheet), so side panels stay usable.
|
|
440
|
+
*/}
|
|
408
441
|
<Drawer
|
|
409
442
|
open={isDrawerOpen}
|
|
410
443
|
onOpenChange={handleDrawerOpenChange}
|
|
411
|
-
direction={
|
|
444
|
+
direction={effectiveDrawerPosition}
|
|
412
445
|
dismissible={drawerDismiss.dismissible}
|
|
413
446
|
>
|
|
414
447
|
<DrawerContent
|
|
415
|
-
direction={
|
|
448
|
+
direction={effectiveDrawerPosition}
|
|
416
449
|
open={isDrawerOpen}
|
|
417
450
|
size={
|
|
418
451
|
drawerReported
|
|
419
|
-
?
|
|
452
|
+
? drawerIsVertical
|
|
420
453
|
? `${drawerReported.height}px`
|
|
421
454
|
: `${drawerReported.width ?? drawerReported.height}px`
|
|
422
455
|
: drawerPending
|
|
@@ -427,7 +460,10 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
|
|
|
427
460
|
className={drawerSize.className}
|
|
428
461
|
showCloseButton={!drawerPending && drawerDismiss.showCloseButton}
|
|
429
462
|
showDragHandle={
|
|
430
|
-
!drawerPending &&
|
|
463
|
+
!drawerPending &&
|
|
464
|
+
drawerIsVertical &&
|
|
465
|
+
drawerDismiss.showDragHandle &&
|
|
466
|
+
drawerDismiss.dismissible
|
|
431
467
|
}
|
|
432
468
|
closeOnOverlayClick={drawerDismiss.closeOnOverlayClick}
|
|
433
469
|
resizable={
|
|
@@ -448,18 +484,14 @@ export const OverlayShell = ({ children }: OverlayShellProps) => {
|
|
|
448
484
|
navItem={drawerNavItem}
|
|
449
485
|
contentSized={drawerSize.contentSized}
|
|
450
486
|
reportedHeight={
|
|
451
|
-
|
|
487
|
+
drawerIsVertical
|
|
452
488
|
? (drawerReported?.height ?? null)
|
|
453
489
|
: (drawerReported?.width ?? drawerReported?.height ?? null)
|
|
454
490
|
}
|
|
455
|
-
reportedWidth={
|
|
456
|
-
drawerPosition === 'left' || drawerPosition === 'right'
|
|
457
|
-
? (drawerReported?.width ?? null)
|
|
458
|
-
: null
|
|
459
|
-
}
|
|
491
|
+
reportedWidth={!drawerIsVertical ? (drawerReported?.width ?? null) : null}
|
|
460
492
|
allowInnerScroll={drawerSizeFallback || drawerWasClamped}
|
|
461
493
|
pending={drawerPending}
|
|
462
|
-
pendingFill={
|
|
494
|
+
pendingFill={!drawerIsVertical}
|
|
463
495
|
pendingChrome="bar"
|
|
464
496
|
/>
|
|
465
497
|
</>
|