@remit/ui 0.0.226 → 0.0.228

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.
@@ -1,5 +1,6 @@
1
1
  export interface AccountMenuProps {
2
2
  email: string | null;
3
+ securityUrl?: string;
3
4
  onSignOut: () => void;
4
5
  }
5
- export declare function AccountMenu({ email, onSignOut }: AccountMenuProps): import("react").JSX.Element;
6
+ export declare function AccountMenu({ email, securityUrl, onSignOut, }: AccountMenuProps): import("react").JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LogOut } from "lucide-react";
2
+ import { LogOut, ShieldCheck } from "lucide-react";
3
3
  import { useEffect, useRef } from "react";
4
4
  import { Avatar } from "./avatar.js";
5
5
  import { PopoverMenuPanel, PopoverMenuPortal, PopoverMenuRow, usePopoverMenuState, } from "./popover-menu.js";
6
- export function AccountMenu({ email, onSignOut }) {
6
+ export function AccountMenu({ email, securityUrl, onSignOut, }) {
7
7
  const triggerRef = useRef(null);
8
8
  const { open, setOpen, containerRef, panelRef, getAnchor } = usePopoverMenuState("account-menu", () => triggerRef.current?.focus());
9
9
  useEffect(() => {
@@ -15,7 +15,10 @@ export function AccountMenu({ email, onSignOut }) {
15
15
  return () => cancelAnimationFrame(frame);
16
16
  }, [open, panelRef]);
17
17
  const displayName = email ?? "Account";
18
- return (_jsxs("div", { ref: containerRef, className: "relative", children: [_jsx("button", { ref: triggerRef, type: "button", "aria-label": "Account", "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen((value) => !value), className: "inline-flex min-h-11 min-w-11 items-center justify-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-raised hover:text-fg", children: _jsx(Avatar, { name: displayName, email: email ?? undefined, size: "sm" }) }), _jsx(PopoverMenuPortal, { open: open, align: "end", panelRef: panelRef, getAnchor: getAnchor, children: _jsxs(PopoverMenuPanel, { ref: panelRef, label: displayName, children: [email && (_jsxs(_Fragment, { children: [_jsx("div", { className: "truncate px-4 py-2 text-xs text-fg-muted", title: email, "data-testid": "account-menu-email", children: email }), _jsx("hr", { className: "my-1 h-px border-0 bg-line" })] })), _jsx(PopoverMenuRow, { label: "Sign out", icon: _jsx(LogOut, { className: "size-4" }), onSelect: () => {
18
+ return (_jsxs("div", { ref: containerRef, className: "relative", children: [_jsx("button", { ref: triggerRef, type: "button", "aria-label": "Account", "aria-haspopup": "menu", "aria-expanded": open, onClick: () => setOpen((value) => !value), className: "inline-flex min-h-11 min-w-11 items-center justify-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-surface-raised hover:text-fg", children: _jsx(Avatar, { name: displayName, email: email ?? undefined, size: "sm" }) }), _jsx(PopoverMenuPortal, { open: open, align: "end", panelRef: panelRef, getAnchor: getAnchor, children: _jsxs(PopoverMenuPanel, { ref: panelRef, label: displayName, children: [email && (_jsxs(_Fragment, { children: [_jsx("div", { className: "truncate px-4 py-2 text-xs text-fg-muted", title: email, "data-testid": "account-menu-email", children: email }), _jsx("hr", { className: "my-1 h-px border-0 bg-line" })] })), securityUrl && (_jsx(PopoverMenuRow, { label: "Security", icon: _jsx(ShieldCheck, { className: "size-4" }), onSelect: () => {
19
+ setOpen(false);
20
+ window.location.assign(securityUrl);
21
+ } })), _jsx(PopoverMenuRow, { label: "Sign out", icon: _jsx(LogOut, { className: "size-4" }), onSelect: () => {
19
22
  setOpen(false);
20
23
  triggerRef.current?.focus();
21
24
  onSignOut();
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from "react";
2
+ export interface AppChromeProps {
3
+ topBar?: ReactNode;
4
+ appBar?: ReactNode;
5
+ children: ReactNode;
6
+ }
7
+ export declare function AppChrome({ topBar, appBar, children }: AppChromeProps): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ export function AppChrome({ topBar, appBar, children }) {
3
+ return (_jsxs(_Fragment, { children: [topBar, _jsxs("div", { className: "flex min-h-0 flex-1", children: [appBar, _jsx("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: children })] })] }));
4
+ }
@@ -55,6 +55,11 @@ export interface AppShellSlottedProps {
55
55
  * read as the app's search rather than the list's.
56
56
  */
57
57
  topBar?: ReactNode;
58
+ /**
59
+ * The app switcher bar. Sits down the left edge beneath `topBar`, so the top
60
+ * bar runs the full width above it.
61
+ */
62
+ appBar?: ReactNode;
58
63
  /**
59
64
  * Content rendered outside the pane group (e.g., the compose FAB). Floats
60
65
  * over the layout regardless of width.
@@ -110,4 +115,4 @@ export interface AppShellLayoutContext {
110
115
  * Returns null outside of an `AppShellSlotted` (tests / Storybook).
111
116
  */
112
117
  export declare function useAppShellLayout(): AppShellLayoutContext | null;
113
- export declare function AppShellSlotted({ nav, list, reading, intelligence, intelligenceOpen, hasThread, density, listBias, header, topBar, overlay, skeleton, isLoading, initialWidth, navOpen: navOpenProp, onOpenNav, onCloseNav, }: AppShellSlottedProps): import("react").JSX.Element;
118
+ export declare function AppShellSlotted({ nav, list, reading, intelligence, intelligenceOpen, hasThread, density, listBias, header, topBar, appBar, overlay, skeleton, isLoading, initialWidth, navOpen: navOpenProp, onOpenNav, onCloseNav, }: AppShellSlottedProps): import("react").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createContext, useContext, useState } from "react";
3
+ import { AppChrome } from "./app-chrome.js";
3
4
  import { resolvePaneLayout, useContainerWidth, } from "./app-shell-types.js";
4
5
  import { Dialog } from "./dialog.js";
5
6
  import { ResizableHandle, ResizablePanel, ResizablePanelGroup, WholePixelWidth, } from "./resizable.js";
@@ -22,7 +23,7 @@ export function useAppShellLayout() {
22
23
  /* ------------------------------------------------------------------ */
23
24
  /* AppShellSlotted */
24
25
  /* ------------------------------------------------------------------ */
25
- export function AppShellSlotted({ nav, list, reading, intelligence, intelligenceOpen = true, hasThread = true, density = "comfortable", listBias = "balanced", header, topBar, overlay, skeleton, isLoading = false, initialWidth, navOpen: navOpenProp, onOpenNav, onCloseNav, }) {
26
+ export function AppShellSlotted({ nav, list, reading, intelligence, intelligenceOpen = true, hasThread = true, density = "comfortable", listBias = "balanced", header, topBar, appBar, overlay, skeleton, isLoading = false, initialWidth, navOpen: navOpenProp, onOpenNav, onCloseNav, }) {
26
27
  const [containerRef, containerWidth] = useContainerWidth(initialWidth);
27
28
  const panes = resolvePaneLayout(containerWidth ?? 0);
28
29
  const [navCollapsed, setNavCollapsed] = useState(false);
@@ -71,5 +72,5 @@ export function AppShellSlotted({ nav, list, reading, intelligence, intelligence
71
72
  const share = listShare(listBias, density);
72
73
  const contentPanes = (_jsxs(ResizablePanelGroup, { direction: "horizontal", className: "min-h-0 flex-1", children: [_jsx(ResizablePanel, { id: "list", order: 1, defaultSize: showReadingPane ? share.size : 100, minSize: 22, maxSize: showReadingPane ? share.max : 100, className: "min-w-0", children: list }), showReadingPane && (_jsxs(_Fragment, { children: [_jsx(ResizableHandle, {}), _jsx(ResizablePanel, { id: "reading", order: 2, minSize: 29, className: "min-w-0", children: _jsx(WholePixelWidth, { className: "h-full", children: reading }) })] })), showIntelligencePanel && (_jsxs(_Fragment, { children: [_jsx(ResizableHandle, {}), _jsx(ResizablePanel, { id: "intelligence", order: 3, defaultSize: 25, minSize: 18, maxSize: 39, className: "min-w-0", children: intelligence })] }))] }, showReadingPane ? "list-reading" : "list-only"));
73
74
  const content = (_jsxs("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [!showNavPane && header && _jsx("div", { className: "shrink-0", children: header }), contentPanes] }));
74
- return (_jsx(AppShellLayoutCtx.Provider, { value: layoutCtx, children: _jsx("div", { ref: containerRef, className: "safe-area-frame @container flex h-full w-full flex-col overflow-hidden bg-canvas font-sans text-fg", children: isLoading && skeleton ? (skeleton) : (_jsxs(_Fragment, { children: [topBar, navPaneVisible ? (_jsxs(ResizablePanelGroup, { direction: "horizontal", className: "min-h-0 flex-1", children: [_jsx(ResizablePanel, { id: "nav", order: 1, defaultSize: 17, minSize: 12, maxSize: 24, className: "min-w-0", children: nav }), _jsx(ResizableHandle, {}), _jsx(ResizablePanel, { id: "content", order: 2, className: "flex min-w-0 flex-col", children: content })] })) : (content), !showNavPane && (_jsx(Dialog, { open: navOpen, onClose: closeNav, title: "Folders", anchor: "left", children: nav })), overlay] })) }) }));
75
+ return (_jsx(AppShellLayoutCtx.Provider, { value: layoutCtx, children: _jsxs("div", { ref: containerRef, className: "safe-area-frame @container flex h-full w-full flex-col overflow-hidden bg-canvas font-sans text-fg", children: [_jsx(AppChrome, { topBar: topBar, appBar: appBar, children: isLoading && skeleton ? (skeleton) : navPaneVisible ? (_jsxs(ResizablePanelGroup, { direction: "horizontal", className: "min-h-0 flex-1", children: [_jsx(ResizablePanel, { id: "nav", order: 1, defaultSize: 17, minSize: 12, maxSize: 24, className: "min-w-0", children: nav }), _jsx(ResizableHandle, {}), _jsx(ResizablePanel, { id: "content", order: 2, className: "flex min-w-0 flex-col", children: content })] })) : (content) }), !(isLoading && skeleton) && (_jsxs(_Fragment, { children: [!showNavPane && (_jsx(Dialog, { open: navOpen, onClose: closeNav, title: "Folders", anchor: "left", children: nav })), overlay] }))] }) }));
75
76
  }
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { AddressDisplay, type AddressDisplayProps, AddressList, type AddressList
9
9
  export { AddressTag, type AddressTagProps } from "./components/address-tag.js";
10
10
  export { type AgendaDensity, AgendaFlow, type AgendaFlowProps, type AgendaScrollTarget, } from "./components/agenda-flow.js";
11
11
  export { NextUpCard, type NextUpCardProps, } from "./components/agenda-panels.js";
12
+ export { AppChrome, type AppChromeProps } from "./components/app-chrome.js";
12
13
  export { AppPasswordHint, type AppPasswordHintProps, } from "./components/app-password-hint.js";
13
14
  export { type AppShellLayoutContext, AppShellSlotted, type AppShellSlottedProps, useAppShellLayout, } from "./components/app-shell-slotted.js";
14
15
  export { type AppShellProps, type Density, INTELLIGENCE_MIN_WIDTH, type MessageListKeyboard, type MessageListSelection, type NarrowView, type NavAccount, type NavAccountStatus, type NavLinkComponent, type NavLinkRenderProps, type NavMailbox, type NavMailboxRole, type PaneLayout, READING_PANE_MIN_WIDTH, resolvePaneLayout, type ThreadData, type ThreadMessageData, type ThreadRowData, type ThreadSection, type TouchSeed, useContainerWidth, } from "./components/app-shell-types.js";
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export { AddressDisplay, AddressList, } from "./components/address-display.js";
9
9
  export { AddressTag } from "./components/address-tag.js";
10
10
  export { AgendaFlow, } from "./components/agenda-flow.js";
11
11
  export { NextUpCard, } from "./components/agenda-panels.js";
12
+ export { AppChrome } from "./components/app-chrome.js";
12
13
  export { AppPasswordHint, } from "./components/app-password-hint.js";
13
14
  export { AppShellSlotted, useAppShellLayout, } from "./components/app-shell-slotted.js";
14
15
  export { INTELLIGENCE_MIN_WIDTH, READING_PANE_MIN_WIDTH, resolvePaneLayout, useContainerWidth, } from "./components/app-shell-types.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/ui",
3
- "version": "0.0.226",
3
+ "version": "0.0.228",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {