diff --git a/app/globals.css b/app/globals.css index f9eb2c995..1bd57121d 100644 --- a/app/globals.css +++ b/app/globals.css @@ -628,6 +628,17 @@ html[data-window-controls] [data-window-row-right] { padding-right: calc(var(--titlebar-right-inset) + 0.5rem) !important; } +/* + * The composer's header runs over its plugin panels. The head above the panel at the + * window's right takes that room inside itself, so it stays as wide as the panel and + * its Hide button stays at the panel's edge, with its window buttons left of the controls. + */ +html[data-window-controls]:not([dir="rtl"]) [data-window-row-right] > [data-composer-panel-head="right"], +html[data-window-controls][dir="rtl"] [data-window-row-right] > [data-composer-panel-head="left"] { + margin-right: calc(-1 * (var(--titlebar-right-inset) + 0.5rem)); + padding-right: calc(var(--titlebar-right-inset) + 0.5rem); +} + /* Something floating at the top end of a page with no row: next to the controls, lined up. */ html[data-window-controls]:not([dir="rtl"]) [data-window-beside-controls] { right: calc(var(--titlebar-right-inset) + 0.5rem); diff --git a/components/email/__tests__/composer-plugin-surfaces.test.tsx b/components/email/__tests__/composer-plugin-surfaces.test.tsx index 66357fe00..3af20e4f5 100644 --- a/components/email/__tests__/composer-plugin-surfaces.test.tsx +++ b/components/email/__tests__/composer-plugin-surfaces.test.tsx @@ -585,6 +585,7 @@ describe('composer-sidebar and composer-sidebar-right', () => { Element.prototype.getBoundingClientRect = function (this: Element) { if (this.matches('[data-testid="email-composer"]')) return rect(100, 800); if (this.matches('[data-composer-header]')) return rect(100, 156); + if (this.matches('[data-composer-panels]')) return rect(156, 800); if (this.matches('[data-composer-footer]')) return rect(740, 800); return original.call(this); }; @@ -593,7 +594,9 @@ describe('composer-sidebar and composer-sidebar-right', () => { render(); fireEvent.click(document.querySelector('[data-composer-panel-toggle="right"]')!); expect(panel('right').dataset.composerSidebarMode).toBe('overlay'); - expect(panel('right').style.top).toBe('56px'); + // The header is above the row the panel is laid over: the panel starts at that row's top. + expect(document.querySelector('[data-composer-panels]')!.contains(document.querySelector('[data-composer-header]'))).toBe(false); + expect(panel('right').style.top).toBe('0px'); expect(panel('right').style.bottom).toBe('60px'); } finally { Element.prototype.getBoundingClientRect = original; @@ -718,7 +721,7 @@ describe('composer-sidebar and composer-sidebar-right', () => { // Opened once: it stays open for the next composer. render(); expect(panel('right').dataset.composerSidebarMode).toBe('docked'); - fireEvent.click(screen.getByRole('button', { name: 'plugin_panel_hide' })); + fireEvent.click(screen.getByRole('button', { name: 'hide_panel' })); expect(panel('right').dataset.composerSidebarMode).toBe('folded'); }); @@ -742,11 +745,134 @@ describe('composer-sidebar and composer-sidebar-right', () => { offerSlots('p1', ['composer-sidebar-right']); render(); - fireEvent.click(screen.getByRole('button', { name: 'plugin_panel_show' })); + fireEvent.click(screen.getByRole('button', { name: 'show_panel' })); expect(panel('right').dataset.composerSidebarMode).toBe('overlay'); expect(panel('right').className).toContain('absolute'); - fireEvent.click(screen.getByRole('button', { name: 'plugin_panel_hide' })); + fireEvent.click(screen.getByRole('button', { name: 'hide_panel' })); expect(panel('right').dataset.composerSidebarMode).toBe('folded'); }); }); + +// With a panel open, the composer's header runs over it: Full screen, Pop out +// and Close end the whole composer, not the message column in the middle of +// it. The panel's head (the header above it) has its own Hide button. +describe('the composer header with a plugin panel open', () => { + function stubWidth(width: number) { + class FixedWidthObserver { + constructor(private cb: ResizeObserverCallback) {} + observe(el: Element) { + if ((el as HTMLElement).dataset.testid !== 'email-composer') return; + this.cb([{ target: el, contentRect: { width, height: 700 } } as unknown as ResizeObserverEntry], this as unknown as ResizeObserver); + } + unobserve() {} + disconnect() {} + } + vi.stubGlobal('ResizeObserver', FixedWidthObserver); + } + const panel = (side: 'left' | 'right') => document.querySelector(`[data-composer-sidebar="${side}"]`)!; + const header = () => document.querySelector('[data-composer-header]')!; + const head = (side: 'left' | 'right') => document.querySelector(`[data-composer-panel-head="${side}"]`); + const buttons = (el: HTMLElement) => Array.from(el.querySelectorAll('button')); + + afterEach(() => { + vi.unstubAllGlobals(); + for (const side of ['left', 'right']) { + localStorage.removeItem(`composerPluginSidebarCollapsed:${side}`); + localStorage.removeItem(`composerPluginSidebarWidth:${side}`); + } + }); + + it('keeps Close the last control, at the end of the row over the open panel', () => { + stubWidth(1400); + offerSlots('p1', ['composer-sidebar-right']); + render(); + expect(panel('right').dataset.composerSidebarMode).toBe('docked'); + + // One row over the message and the panel: the panel is not beside the header. + expect(header().parentElement).toBe(screen.getByTestId('email-composer')); + expect(header().compareDocumentPosition(panel('right')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); + // The part of it above the panel is as wide as the panel... + const right = head('right')!; + expect(header()).toContainElement(right); + expect(right.style.minWidth).toBe('260px'); + // ...and ends with Full screen, Pop out and Close, Close last. + const all = buttons(header()); + expect(all[all.length - 1]).toBe(screen.getByTestId('composer-close')); + expect(right).toContainElement(screen.getByTestId('composer-close')); + expect(right).toContainElement(screen.getByTestId('composer-maximize')); + }); + + it('gives the open panel a Hide button in its head, and the header a Show button while it is folded', () => { + stubWidth(1400); + offerSlots('p1', ['composer-sidebar', 'composer-sidebar-right']); + render(); + + for (const side of ['left', 'right'] as const) { + const hide = head(side)!.querySelector(`[data-composer-panel-hide="${side}"]`)!; + expect(hide).toBeTruthy(); + expect(hide).toHaveAccessibleName('hide_panel'); + expect(hide.getAttribute('title')).toBe('hide_panel'); + expect(hide.getAttribute('aria-expanded')).toBe('true'); + } + // At the panel's inner edge, where it meets the message: last in the left head, first in the right one. + expect(buttons(head('left')!).at(-1)!.dataset.composerPanelHide).toBe('left'); + expect(buttons(head('right')!)[0].dataset.composerPanelHide).toBe('right'); + + fireEvent.click(head('right')!.querySelector('[data-composer-panel-hide]')!); + expect(panel('right').dataset.composerSidebarMode).toBe('folded'); + expect(head('right')).toBeNull(); + // Folded: one Show button in the header, before the window buttons; Close still last. + const show = screen.getByRole('button', { name: 'show_panel' }); + expect(header()).toContainElement(show); + expect(show.getAttribute('aria-expanded')).toBe('false'); + const all = buttons(header()); + expect(all[all.length - 1]).toBe(screen.getByTestId('composer-close')); + expect(all.indexOf(show)).toBeLessThan(all.indexOf(screen.getByTestId('composer-maximize'))); + + fireEvent.click(show); + expect(panel('right').dataset.composerSidebarMode).toBe('docked'); + expect(head('right')).toContainElement(screen.getByTestId('composer-close')); + }); + + it('hides the panel with Hide and closes the composer only with Close', () => { + stubWidth(1400); + offerSlots('p1', ['composer-sidebar-right']); + const onClose = vi.fn(); + render(); + + const hide = head('right')!.querySelector('[data-composer-panel-hide]')!; + const close = screen.getByTestId('composer-close'); + expect(hide).not.toBe(close); + expect(hide).not.toHaveAccessibleName(close.getAttribute('aria-label')!); + + fireEvent.click(hide); + expect(panel('right').dataset.composerSidebarMode).toBe('folded'); + expect(onClose).not.toHaveBeenCalled(); + expect(screen.queryByRole('alertdialog')).toBeNull(); + expect(screen.getByTestId('email-composer')).toBeInTheDocument(); + + fireEvent.click(screen.getByTestId('composer-close')); + expect(onClose.mock.calls.length > 0 || screen.queryByRole('alertdialog') !== null).toBe(true); + }); + + it('gives a panel laid over a narrow composer the same head', () => { + stubWidth(700); + offerSlots('p1', ['composer-sidebar-right']); + render(); + fireEvent.click(screen.getByRole('button', { name: 'show_panel' })); + expect(panel('right').dataset.composerSidebarMode).toBe('overlay'); + expect(head('right')).toContainElement(screen.getByTestId('composer-close')); + fireEvent.click(screen.getByRole('button', { name: 'hide_panel' })); + expect(panel('right').dataset.composerSidebarMode).toBe('folded'); + }); + + it('keeps Close last in a composer that is its own window', () => { + stubWidth(1400); + offerSlots('p1', ['composer-sidebar-right']); + render(); + const all = buttons(header()); + expect(all[all.length - 1]).toBe(screen.getByTestId('composer-close')); + expect(head('right')).toContainElement(screen.getByTestId('composer-close')); + }); +}); diff --git a/components/email/composer-plugin-sidebars.tsx b/components/email/composer-plugin-sidebars.tsx index 5616a099e..1c6adb14d 100644 --- a/components/email/composer-plugin-sidebars.tsx +++ b/components/email/composer-plugin-sidebars.tsx @@ -1,20 +1,25 @@ "use client"; // The composer-sidebar and composer-sidebar-right plugin panels. Each has a -// width the user can drag (kept across composers) and a button in the -// composer's header that shows and hides it (the left panel's at the start, -// the right one's at the end, like the reader's). Folded, a panel takes no -// room at all. When the composer is too narrow for an open panel next to -// it, the panel folds by itself (right first); opening it anyway lays it -// over the composer instead of squeezing the message into a column nobody -// can write in. Laid over, it stays between the composer's header and its -// bottom bar: the panel's own button, Close and Send stay in reach. +// width the user can drag (kept across composers). The composer's header +// runs across the whole composer, panels included, so its window buttons +// (Full screen, Pop out, Close) stay at the far end of it, as Outlook and +// Gmail have them. The part of that row above an open panel is the +// panel's head: it holds "Hide ", at the panel's inner edge. A +// folded panel takes no room at all, and a "Show " button in the +// header brings it back (the left panel's at the start, the right one's +// before the window buttons). When the composer is too narrow for an open +// panel next to it, the panel folds by itself (right first); opening it +// anyway lays it over the composer instead of squeezing the message into a +// column nobody can write in. Laid over, it stays between the header and +// the bottom bar: Hide, Close and Send stay in reach. -import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from "react"; +import { useEffect, useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from "react"; import { useTranslations } from "next-intl"; import { PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen } from "@/components/icons"; import { PluginSlot } from "@/components/plugins/plugin-slot"; import { usePluginSlotOffers } from "@/hooks/use-plugin-slot-offers"; +import { get as getActivePlugin } from "@/lib/plugin-sandbox/registry"; import { onPanelRequest, type PanelRequest } from "@/lib/plugin-sandbox/panel-requests"; import { ResizeHandle } from "@/components/layout/resize-handle"; import { cn } from "@/lib/utils"; @@ -196,40 +201,123 @@ export function useComposerSidebars(root: HTMLElement | null, composerId: string } }; - return { modes, open, close, toggle, focusRequests, widths, setSideWidth }; + // What the panels are called in their Show and Hide buttons: their plugins' names. + const nameOf = (offers: readonly { pluginId: string }[]) => + offers.map((o) => getActivePlugin(o.pluginId)?.plugin.name).filter((n): n is string => !!n).join(", ") || null; + const names: Record = { left: nameOf(leftOffers), right: nameOf(rightOffers) }; + + return { modes, open, close, toggle, focusRequests, widths, setSideWidth, names }; } -/** The button in the composer's header that shows and hides one panel (none on phones). */ -export function ComposerPanelToggle({ - side, - mode, - onToggle, - className, -}: { +/** Open beside the composer or over it: on screen, with a head in the header row. */ +export function isPanelOpen(mode: ComposerSidebarMode | null): boolean { + return mode === "docked" || mode === "overlay"; +} + +/** The Show or Hide button of one panel. */ +function PanelButton({ side, open, name, onToggle, className }: { side: ComposerSidebarSide; - mode: ComposerSidebarMode | null; + open: boolean; + name: string | null; onToggle: () => void; className?: string; }) { - const t = useTranslations("email_viewer"); - if (!mode) return null; - const isOpen = mode !== "folded"; - const Icon = side === "left" ? (isOpen ? PanelLeftClose : PanelLeftOpen) : (isOpen ? PanelRightClose : PanelRightOpen); + const t = useTranslations("composer_panel"); + const tViewer = useTranslations("email_viewer"); + const label = name + ? t(open ? "hide_panel" : "show_panel", { name }) + : tViewer(open ? "plugin_panel_hide" : "plugin_panel_show"); + const Icon = side === "left" ? (open ? PanelLeftClose : PanelLeftOpen) : (open ? PanelRightClose : PanelRightOpen); return ( ); } +/** + * The button in the composer's header that brings a folded panel back (none + * on phones). An open panel's Hide button is in its head instead + * (ComposerPanelHead). + */ +export function ComposerPanelToggle({ + side, + mode, + name = null, + onToggle, + className, +}: { + side: ComposerSidebarSide; + mode: ComposerSidebarMode | null; + name?: string | null; + onToggle: () => void; + className?: string; +}) { + if (mode !== "folded") return null; + return ; +} + +/** + * The part of the composer's header row above an open panel, as wide as the + * panel: its Hide button at the panel's inner edge, and for the right panel + * whatever else ends the row (the window buttons, Close last), so they stay + * at the far end of the composer. On phones there are no panels, and no head. + */ +export function ComposerPanelHead({ + side, + mode, + width = COMPOSER_SIDEBAR_WIDTH, + name = null, + onToggle, + className, + childrenClassName, + children, +}: { + side: ComposerSidebarSide; + mode: ComposerSidebarMode | null; + width?: number; + name?: string | null; + onToggle: () => void; + /** Padding of the row it is part of. */ + className?: string; + /** The gap between what it holds besides Hide, as in the row it is part of. */ + childrenClassName?: string; + children?: ReactNode; +}) { + if (!isPanelOpen(mode)) return null; + const hide = ; + return ( +
+ {side === "right" && hide} +
+ {/* No gap of the head's own around Hide and the space: a 260 px panel in the desktop app has just enough room for the buttons. */} + {children &&
{children}
} + {side === "left" && hide} +
+ ); +} + const COMPOSER_HEADER = "[data-composer-header], [data-mv-compose-titlebar], [data-mv-compose-inline-bar]"; const COMPOSER_FOOTER = "[data-composer-footer]"; diff --git a/components/email/email-composer.tsx b/components/email/email-composer.tsx index a1384e37c..82a3d72eb 100644 --- a/components/email/email-composer.tsx +++ b/components/email/email-composer.tsx @@ -92,7 +92,7 @@ import { useIdentityStore } from "@/stores/identity-store"; import { useProMultiAccountIdentities, stripCrossAccountIdentityPrefix } from "@/hooks/use-pro-multi-account-identities"; import { useAccountStore } from "@/stores/account-store"; import { useSettingsStore } from "@/stores/settings-store"; -import { ComposerPanelToggle, ComposerPluginSidebar, useComposerSidebars } from "./composer-plugin-sidebars"; +import { ComposerPanelHead, ComposerPanelToggle, ComposerPluginSidebar, isPanelOpen, useComposerSidebars } from "./composer-plugin-sidebars"; import { dragKindFromTypes } from "@/components/pro/pro-shell-drop"; import { useIsPaneScoped } from "@/hooks/use-pane-context"; import { ComposerSelectionMenu, useComposerSelectionMenu } from "./composer-selection-menu"; @@ -3621,13 +3621,28 @@ export function EmailComposer({ [pluginDraft, pluginSelection, pluginComposerId, pluginSidebars.focusRequests.right], ); - // The buttons that show and hide the plugin panels, in the header. - const leftPanelToggle = pluginSidebars.modes.left - ? pluginSidebars.toggle('left')} /> + // The plugin panels in the header row: a folded one's Show button, and an + // open one's head with its Hide button (see composer-plugin-sidebars.tsx). + const leftPanelToggle = pluginSidebars.modes.left === 'folded' + ? pluginSidebars.toggle('left')} /> : null; - const rightPanelToggle = pluginSidebars.modes.right - ? pluginSidebars.toggle('right')} /> + const rightPanelToggle = pluginSidebars.modes.right === 'folded' + ? pluginSidebars.toggle('right')} /> : null; + const rightPanelOpen = isPanelOpen(pluginSidebars.modes.right); + const panelHead = (side: 'left' | 'right', className: string, children?: React.ReactNode, childrenClassName?: string) => ( + pluginSidebars.toggle(side)} + className={className} + childrenClassName={childrenClassName} + > + {children} + + ); // The right-click menu on selected text, when a plugin put entries in it. const selectionMenu = useComposerSelectionMenu(); @@ -4737,6 +4752,86 @@ export function EmailComposer({ ); + // What ends the header row: the window buttons, Close last. With the right + // panel open they end its head instead, at the far end of the composer. + const windowButtons = ( + <> + {canMaximize && ( + + )} + {popOutButton(cn(phoneLayout ? "hidden md:grid" : "grid", "h-8 w-8 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"), "w-4 h-4")} + {!closeBesideControls && composerCloseButton} + + ); + const mvInlineButtons = mvWindow && ( + <> + {mvWindow.popOut && ( + + )} + {popOutButton("grid h-8 w-8 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground", "h-4 w-4")} + + + ); + const mvWindowButtons = mvWindow && ( + <> + {mvWindow.state !== "minimized" && popOutButton("grid h-7 w-7 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground", "h-4 w-4")} + + + + + ); + // Files dropped on the header attach, as on the rest of the message. + const headerDropProps = { onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop }; + // `keepDraft`: the bin's discard, which deletes the draft once its Undo is // over, not here. const handleDiscardAndClose = ({ keepDraft = false }: { keepDraft?: boolean } = {}) => { @@ -5019,8 +5114,11 @@ export function EmailComposer({ data-testid="email-composer" // Edits made while the draft moves wouldn't move with it. inert={isPoppingOut || undefined} + // The header row on top, across the plugin panels too, so the window + // buttons and Close end the whole composer; panels and message below. + data-tour="composer" className={cn( - "flex h-full bg-background relative", + "flex flex-col h-full bg-background relative", className, // Over everything but dialogs (z-60) and toasts; below the desktop app's window controls. // At the folder sidebar's z-50 and after it in the page, so over it (compose-p2-5). @@ -5039,112 +5137,57 @@ export function EmailComposer({
{liveMessage && {liveMessage.text}}
- pluginSidebars.setSideWidth('left', w)} /> - {/* Right-side composer sidebar slot is rendered after the main content div below. */} -
- {/* Drag overlay */} - {isDraggingOver && ( -
-
- - {t('drop_files')} -
-
- )} {/* Header - mobile: clean bar with close/send, desktop: title bar. In Mountain View's window it is the window's title bar instead. */} {mvWindow?.variant === "inline" ? ( -
- {mode === 'replyAll' - ? - : mode === 'forward' - ? - : } -

- {mode === 'reply' ? t('reply') : mode === 'replyAll' ? t('reply_all') : mode === 'forward' ? t('forward') : t('new_message')} -

- {saveStatus === 'saving' && } - {leftPanelToggle} - {rightPanelToggle} - {mvWindow.popOut && ( - - )} - {popOutButton("grid h-8 w-8 place-items-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground", "h-4 w-4")} - +
+ {panelHead('left', 'px-1.5')} +
+ {mode === 'replyAll' + ? + : mode === 'forward' + ? + : } +

+ {mode === 'reply' ? t('reply') : mode === 'replyAll' ? t('reply_all') : mode === 'forward' ? t('forward') : t('new_message')} +

+ {saveStatus === 'saving' && } + {leftPanelToggle} + {rightPanelToggle} + {!rightPanelOpen && mvInlineButtons} +
+ {panelHead('right', 'ps-1.5 pe-1.5', mvInlineButtons, 'gap-2')}
) : mvWindow ? (
mvWindow.setState("normal") : undefined} + {...headerDropProps} > -

- {mode === 'reply' || mode === 'replyAll' || mode === 'forward' - ? (subject || t('new_message')) - : t('new_message')} -

- {saveStatus === 'saving' && } - {mvWindow.state !== "minimized" && leftPanelToggle} - {mvWindow.state !== "minimized" && rightPanelToggle} - {mvWindow.state !== "minimized" && popOutButton("grid h-7 w-7 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground", "h-4 w-4")} - - - + {mvWindow.state !== "minimized" && panelHead('left', 'px-1.5')} +
+

+ {mode === 'reply' || mode === 'replyAll' || mode === 'forward' + ? (subject || t('new_message')) + : t('new_message')} +

+ {saveStatus === 'saving' && } + {mvWindow.state !== "minimized" && leftPanelToggle} + {mvWindow.state !== "minimized" && rightPanelToggle} + {(mvWindow.state === "minimized" || !rightPanelOpen) && mvWindowButtons} +
+ {mvWindow.state !== "minimized" && panelHead('right', 'ps-1.5 pe-1.5', mvWindowButtons, 'gap-1')}
) : ( -
+
+ {panelHead('left', 'px-2')} +
{closeBesideControls && composerCloseButton} - {/* The left panel's button at the start, the right one's at the end: where each panel is. */} + {/* A folded panel's Show button where the panel goes: the left one's at the start, the right one's before the window buttons. */} {leftPanelToggle &&
{leftPanelToggle}
}
@@ -5214,23 +5257,31 @@ export function EmailComposer({ ))} {rightPanelToggle} - {canMaximize && ( - - )} - {popOutButton(cn(phoneLayout ? "hidden md:grid" : "grid", "h-8 w-8 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"), "w-4 h-4")} - {!closeBesideControls && composerCloseButton} + {!rightPanelOpen && windowButtons} +
+ {panelHead('right', 'ps-1.5 pe-4', windowButtons, 'gap-3')}
)} + {/* The left panel, the message and the right panel, under the header. */} +
+ pluginSidebars.setSideWidth('left', w)} /> +
+ {/* Drag overlay */} + {isDraggingOver && ( +
+
+ + {t('drop_files')} +
+
+ )} {/* Fields + body. While pinFields holds, the fields sit outside the body's scroll container so From/To/Cc/Bcc/Subject stay reachable while scrolling long bodies, matching the pinned formatting toolbar @@ -6305,6 +6356,7 @@ export function EmailComposer({ )}
pluginSidebars.setSideWidth('right', w)} /> +
); diff --git a/lib/__tests__/plugin-ui-kit.test.tsx b/lib/__tests__/plugin-ui-kit.test.tsx index 81057b238..cdff99ff2 100644 --- a/lib/__tests__/plugin-ui-kit.test.tsx +++ b/lib/__tests__/plugin-ui-kit.test.tsx @@ -22,6 +22,16 @@ const source = (file: string) => readFileSync(path.join(ROOT, file), 'utf8'); const classesOf = (el: Element) => el.getAttribute('class')!.split(/\s+/).filter((c) => c !== 'bk').sort(); describe('plugin UI kit components', () => { + it('starts a long LinkButton\'s lines at its icon, as a paragraph, not centred as a button would', () => { + // The AI assistant's examples in its panel ("Decline the invitation politely and suggest next month instead"). + render(Decline the invitation politely and suggest next month instead); + const link = screen.getByRole('button'); + expect(link.className).toMatch(/(^|\s)text-start(\s|$)/); + // The icon stays beside the first line rather than the middle of the text. + expect(link.className).toMatch(/(^|\s)items-start(\s|$)/); + expect(link.querySelector('svg')!.getAttribute('class')).toContain('mt-'); + }); + it('renders the app\'s own Button and Input', () => { render(<> Cancel diff --git a/lib/plugin-sandbox/ui-kit/components.tsx b/lib/plugin-sandbox/ui-kit/components.tsx index 9eea05bc0..328777195 100644 --- a/lib/plugin-sandbox/ui-kit/components.tsx +++ b/lib/plugin-sandbox/ui-kit/components.tsx @@ -103,11 +103,15 @@ export const Button = React.forwardRef(functi ); }); -/** A text link styled like the app's inline links ("Add condition"). */ +/** + * A text link styled like the app's inline links ("Add condition"). A long one + * wraps like a paragraph: lines start at the icon's side (a button centres its + * text otherwise), with the icon beside the first line. + */ export function LinkButton({ icon, children, className, ...rest }: React.ButtonHTMLAttributes & { icon?: string }) { return ( - ); diff --git a/locales/ar/common.json b/locales/ar/common.json index f5921dc67..0a2286844 100644 --- a/locales/ar/common.json +++ b/locales/ar/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "أنت دون اتصال. الرسالة محفوظة في المسودات.", "offline_send_unsaved": "أنت دون اتصال. تبقى الرسالة هنا وتُحفظ في المسودات عند عودة الاتصال." }, + "composer_panel": { + "show_panel": "إظهار {name}", + "hide_panel": "إخفاء {name}" + }, "desktopDevTools": { "section_title": "استكشاف الأخطاء وإصلاحها", "label": "أدوات المطورين ({shortcut})", diff --git a/locales/ca/common.json b/locales/ca/common.json index 9fde0d888..705591747 100644 --- a/locales/ca/common.json +++ b/locales/ca/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "No teniu connexió. El missatge està desat a Esborranys.", "offline_send_unsaved": "No teniu connexió. El missatge es queda aquí i es desa a Esborranys quan torneu a tenir connexió." }, + "composer_panel": { + "show_panel": "Mostra {name}", + "hide_panel": "Amaga {name}" + }, "desktopDevTools": { "section_title": "Resolució de problemes", "label": "Eines per a desenvolupadors ({shortcut})", diff --git a/locales/cs/common.json b/locales/cs/common.json index e8199be5a..bb545640a 100644 --- a/locales/cs/common.json +++ b/locales/cs/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Jste offline. Zpráva je uložená v Konceptech.", "offline_send_unsaved": "Jste offline. Zpráva tu zůstane a uloží se do Konceptů, až budete znovu online." }, + "composer_panel": { + "show_panel": "Zobrazit {name}", + "hide_panel": "Skrýt {name}" + }, "desktopDevTools": { "section_title": "Řešení potíží", "label": "Nástroje pro vývojáře ({shortcut})", diff --git a/locales/da/common.json b/locales/da/common.json index 4d8c7681a..3b6e82d6f 100644 --- a/locales/da/common.json +++ b/locales/da/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Du er offline. Beskeden er gemt i Kladder.", "offline_send_unsaved": "Du er offline. Beskeden bliver her og gemmes i Kladder, når du er online igen." }, + "composer_panel": { + "show_panel": "Vis {name}", + "hide_panel": "Skjul {name}" + }, "desktopDevTools": { "section_title": "Fejlfinding", "label": "Udviklerværktøjer ({shortcut})", diff --git a/locales/de/common.json b/locales/de/common.json index 9c39c5a69..7c58391bb 100644 --- a/locales/de/common.json +++ b/locales/de/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Sie sind offline. Die Nachricht ist in den Entwürfen gespeichert.", "offline_send_unsaved": "Sie sind offline. Die Nachricht bleibt hier und wird in den Entwürfen gespeichert, sobald Sie wieder online sind." }, + "composer_panel": { + "show_panel": "{name} einblenden", + "hide_panel": "{name} ausblenden" + }, "desktopDevTools": { "section_title": "Fehlerbehebung", "label": "Entwicklertools ({shortcut})", diff --git a/locales/en/common.json b/locales/en/common.json index a2e0f400c..a7e3e248c 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "You're offline. The message is saved in Drafts.", "offline_send_unsaved": "You're offline. The message stays here and is saved in Drafts when you're back online." }, + "composer_panel": { + "show_panel": "Show {name}", + "hide_panel": "Hide {name}" + }, "desktopDevTools": { "section_title": "Troubleshooting", "label": "Developer tools ({shortcut})", diff --git a/locales/es/common.json b/locales/es/common.json index 7b9d02613..db6652b53 100644 --- a/locales/es/common.json +++ b/locales/es/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "No tienes conexión. El mensaje está guardado en Borradores.", "offline_send_unsaved": "No tienes conexión. El mensaje se queda aquí y se guarda en Borradores cuando vuelvas a tener conexión." }, + "composer_panel": { + "show_panel": "Mostrar {name}", + "hide_panel": "Ocultar {name}" + }, "desktopDevTools": { "section_title": "Solución de problemas", "label": "Herramientas para desarrolladores ({shortcut})", diff --git a/locales/et/common.json b/locales/et/common.json index 19ab50447..336b04ed0 100644 --- a/locales/et/common.json +++ b/locales/et/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Oled võrguta. Kiri on salvestatud mustanditesse.", "offline_send_unsaved": "Oled võrguta. Kiri jääb siia ja salvestatakse mustanditesse, kui oled jälle võrgus." }, + "composer_panel": { + "show_panel": "Kuva {name}", + "hide_panel": "Peida {name}" + }, "desktopDevTools": { "section_title": "Tõrkeotsing", "label": "Arendaja tööriistad ({shortcut})", diff --git a/locales/fa/common.json b/locales/fa/common.json index 4e1219635..9253da444 100644 --- a/locales/fa/common.json +++ b/locales/fa/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "آفلاین هستید. پیام در پیش‌نویس‌ها ذخیره شده است.", "offline_send_unsaved": "آفلاین هستید. پیام همین‌جا می‌ماند و وقتی دوباره آنلاین شدید در پیش‌نویس‌ها ذخیره می‌شود." }, + "composer_panel": { + "show_panel": "نمایش {name}", + "hide_panel": "پنهان کردن {name}" + }, "desktopDevTools": { "section_title": "عیب‌یابی", "label": "ابزارهای توسعه‌دهنده ({shortcut})", diff --git a/locales/fr/common.json b/locales/fr/common.json index 83460df07..9d5ac7416 100644 --- a/locales/fr/common.json +++ b/locales/fr/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Vous êtes hors ligne. Le message est enregistré dans les Brouillons.", "offline_send_unsaved": "Vous êtes hors ligne. Le message reste ici et sera enregistré dans les Brouillons dès que vous serez de nouveau en ligne." }, + "composer_panel": { + "show_panel": "Afficher {name}", + "hide_panel": "Masquer {name}" + }, "desktopDevTools": { "section_title": "Dépannage", "label": "Outils de développement ({shortcut})", diff --git a/locales/he/common.json b/locales/he/common.json index 6fd019a89..c8144b369 100644 --- a/locales/he/common.json +++ b/locales/he/common.json @@ -7674,6 +7674,10 @@ "offline_send_saved": "אין חיבור. ההודעה שמורה בטיוטות.", "offline_send_unsaved": "אין חיבור. ההודעה נשארת כאן ותישמר בטיוטות כשתחזרו לרשת." }, + "composer_panel": { + "show_panel": "הצגת {name}", + "hide_panel": "הסתרת {name}" + }, "desktopDevTools": { "section_title": "פתרון בעיות", "label": "כלים למפתחים ({shortcut})", diff --git a/locales/hu/common.json b/locales/hu/common.json index 1cef7c650..d02f4cb08 100644 --- a/locales/hu/common.json +++ b/locales/hu/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Offline állapotban van. Az üzenet a Piszkozatok között van mentve.", "offline_send_unsaved": "Offline állapotban van. Az üzenet itt marad, és a Piszkozatok közé kerül, amint újra online lesz." }, + "composer_panel": { + "show_panel": "{name} megjelenítése", + "hide_panel": "{name} elrejtése" + }, "desktopDevTools": { "section_title": "Hibaelhárítás", "label": "Fejlesztői eszközök ({shortcut})", diff --git a/locales/it/common.json b/locales/it/common.json index cca81e26e..3860e544d 100644 --- a/locales/it/common.json +++ b/locales/it/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Sei offline. Il messaggio è salvato nelle Bozze.", "offline_send_unsaved": "Sei offline. Il messaggio resta qui e viene salvato nelle Bozze quando torni online." }, + "composer_panel": { + "show_panel": "Mostra {name}", + "hide_panel": "Nascondi {name}" + }, "desktopDevTools": { "section_title": "Risoluzione dei problemi", "label": "Strumenti per sviluppatori ({shortcut})", diff --git a/locales/ja/common.json b/locales/ja/common.json index 2c7fe67d6..909f0511c 100644 --- a/locales/ja/common.json +++ b/locales/ja/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "オフラインです。メッセージは下書きに保存されています。", "offline_send_unsaved": "オフラインです。メッセージはここに残り、オンラインに戻ると下書きに保存されます。" }, + "composer_panel": { + "show_panel": "{name}を表示", + "hide_panel": "{name}を非表示" + }, "desktopDevTools": { "section_title": "トラブルシューティング", "label": "デベロッパー ツール ({shortcut})", diff --git a/locales/ko/common.json b/locales/ko/common.json index 4a5501456..68a313526 100644 --- a/locales/ko/common.json +++ b/locales/ko/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "오프라인 상태입니다. 메시지는 임시보관함에 저장되어 있습니다.", "offline_send_unsaved": "오프라인 상태입니다. 메시지는 여기에 남아 있으며 다시 온라인이 되면 임시보관함에 저장됩니다." }, + "composer_panel": { + "show_panel": "{name} 표시", + "hide_panel": "{name} 숨기기" + }, "desktopDevTools": { "section_title": "문제 해결", "label": "개발자 도구 ({shortcut})", diff --git a/locales/lv/common.json b/locales/lv/common.json index f12fb9faf..36c6b4df4 100644 --- a/locales/lv/common.json +++ b/locales/lv/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Jūs esat bezsaistē. Ziņojums ir saglabāts melnrakstos.", "offline_send_unsaved": "Jūs esat bezsaistē. Ziņojums paliek šeit un tiks saglabāts melnrakstos, kad atkal būsiet tiešsaistē." }, + "composer_panel": { + "show_panel": "Rādīt {name}", + "hide_panel": "Paslēpt {name}" + }, "desktopDevTools": { "section_title": "Problēmu novēršana", "label": "Izstrādātāju rīki ({shortcut})", diff --git a/locales/mn/common.json b/locales/mn/common.json index ad1ce7427..81566b789 100644 --- a/locales/mn/common.json +++ b/locales/mn/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Та офлайн байна. Мессеж нооргонд хадгалагдсан.", "offline_send_unsaved": "Та офлайн байна. Мессеж энд үлдэж, онлайн болмогц нооргонд хадгалагдана." }, + "composer_panel": { + "show_panel": "{name} харуулах", + "hide_panel": "{name} нуух" + }, "desktopDevTools": { "section_title": "Алдаа засах", "label": "Хөгжүүлэгчийн хэрэгсэл ({shortcut})", diff --git a/locales/nb/common.json b/locales/nb/common.json index e0c43c990..bc7296b99 100644 --- a/locales/nb/common.json +++ b/locales/nb/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Du er frakoblet. Meldingen er lagret i Utkast.", "offline_send_unsaved": "Du er frakoblet. Meldingen blir her og lagres i Utkast når du er på nett igjen." }, + "composer_panel": { + "show_panel": "Vis {name}", + "hide_panel": "Skjul {name}" + }, "desktopDevTools": { "section_title": "Feilsøking", "label": "Utviklerverktøy ({shortcut})", diff --git a/locales/nl/common.json b/locales/nl/common.json index 4d04e4400..4380cef06 100644 --- a/locales/nl/common.json +++ b/locales/nl/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Je bent offline. Het bericht is opgeslagen in Concepten.", "offline_send_unsaved": "Je bent offline. Het bericht blijft hier en wordt in Concepten opgeslagen zodra je weer online bent." }, + "composer_panel": { + "show_panel": "{name} tonen", + "hide_panel": "{name} verbergen" + }, "desktopDevTools": { "section_title": "Probleemoplossing", "label": "Ontwikkelaarstools ({shortcut})", diff --git a/locales/pl/common.json b/locales/pl/common.json index 3d23c4671..e973b3634 100644 --- a/locales/pl/common.json +++ b/locales/pl/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Jesteś offline. Wiadomość jest zapisana w Szkicach.", "offline_send_unsaved": "Jesteś offline. Wiadomość zostaje tutaj i zostanie zapisana w Szkicach, gdy wrócisz do sieci." }, + "composer_panel": { + "show_panel": "Pokaż: {name}", + "hide_panel": "Ukryj: {name}" + }, "desktopDevTools": { "section_title": "Rozwiązywanie problemów", "label": "Narzędzia dla deweloperów ({shortcut})", diff --git a/locales/pt/common.json b/locales/pt/common.json index 2b39bb565..ace709678 100644 --- a/locales/pt/common.json +++ b/locales/pt/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Está offline. A mensagem está guardada em Rascunhos.", "offline_send_unsaved": "Está offline. A mensagem fica aqui e é guardada em Rascunhos quando voltar a estar online." }, + "composer_panel": { + "show_panel": "Mostrar {name}", + "hide_panel": "Ocultar {name}" + }, "desktopDevTools": { "section_title": "Resolução de problemas", "label": "Ferramentas de programador ({shortcut})", diff --git a/locales/ro/common.json b/locales/ro/common.json index b8b274456..4c66b85fe 100644 --- a/locales/ro/common.json +++ b/locales/ro/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Sunteți offline. Mesajul este salvat în Ciorne.", "offline_send_unsaved": "Sunteți offline. Mesajul rămâne aici și este salvat în Ciorne când sunteți din nou online." }, + "composer_panel": { + "show_panel": "Afișează {name}", + "hide_panel": "Ascunde {name}" + }, "desktopDevTools": { "section_title": "Depanare", "label": "Instrumente pentru dezvoltatori ({shortcut})", diff --git a/locales/ru/common.json b/locales/ru/common.json index 1056ad03b..a15eec34e 100644 --- a/locales/ru/common.json +++ b/locales/ru/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Вы не в сети. Сообщение сохранено в черновиках.", "offline_send_unsaved": "Вы не в сети. Сообщение останется здесь и сохранится в черновиках, когда вы снова будете в сети." }, + "composer_panel": { + "show_panel": "Показать: {name}", + "hide_panel": "Скрыть: {name}" + }, "desktopDevTools": { "section_title": "Устранение неполадок", "label": "Инструменты разработчика ({shortcut})", diff --git a/locales/sk/common.json b/locales/sk/common.json index 16209de6f..6cd0b797b 100644 --- a/locales/sk/common.json +++ b/locales/sk/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Ste offline. Správa je uložená v Konceptoch.", "offline_send_unsaved": "Ste offline. Správa tu zostane a uloží sa do Konceptov, keď budete znova online." }, + "composer_panel": { + "show_panel": "Zobraziť {name}", + "hide_panel": "Skryť {name}" + }, "desktopDevTools": { "section_title": "Riešenie problémov", "label": "Nástroje pre vývojárov ({shortcut})", diff --git a/locales/th/common.json b/locales/th/common.json index 659796f68..297c92761 100644 --- a/locales/th/common.json +++ b/locales/th/common.json @@ -7681,6 +7681,10 @@ "offline_send_saved": "คุณออฟไลน์อยู่ ข้อความถูกบันทึกไว้ในจดหมายร่างแล้ว", "offline_send_unsaved": "คุณออฟไลน์อยู่ ข้อความจะอยู่ที่นี่และถูกบันทึกในจดหมายร่างเมื่อคุณกลับมาออนไลน์" }, + "composer_panel": { + "show_panel": "แสดง {name}", + "hide_panel": "ซ่อน {name}" + }, "desktopDevTools": { "section_title": "การแก้ไขปัญหา", "label": "เครื่องมือสำหรับนักพัฒนาซอฟต์แวร์ ({shortcut})", diff --git a/locales/tr/common.json b/locales/tr/common.json index a4e1787c5..d2e8b9057 100644 --- a/locales/tr/common.json +++ b/locales/tr/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Çevrimdışısınız. İleti Taslaklar'a kaydedildi.", "offline_send_unsaved": "Çevrimdışısınız. İleti burada kalır ve yeniden çevrimiçi olduğunuzda Taslaklar'a kaydedilir." }, + "composer_panel": { + "show_panel": "{name} panelini göster", + "hide_panel": "{name} panelini gizle" + }, "desktopDevTools": { "section_title": "Sorun giderme", "label": "Geliştirici araçları ({shortcut})", diff --git a/locales/uk/common.json b/locales/uk/common.json index 129e93f22..f37d89731 100644 --- a/locales/uk/common.json +++ b/locales/uk/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "Ви не в мережі. Повідомлення збережено в чернетках.", "offline_send_unsaved": "Ви не в мережі. Повідомлення залишиться тут і збережеться в чернетках, коли ви знову будете в мережі." }, + "composer_panel": { + "show_panel": "Показати: {name}", + "hide_panel": "Сховати: {name}" + }, "desktopDevTools": { "section_title": "Усунення несправностей", "label": "Інструменти розробника ({shortcut})", diff --git a/locales/vi/common.json b/locales/vi/common.json index 0cd5746c6..b7bf55de9 100644 --- a/locales/vi/common.json +++ b/locales/vi/common.json @@ -7685,6 +7685,10 @@ "offline_send_saved": "Bạn đang ngoại tuyến. Thư đã được lưu trong Bản nháp.", "offline_send_unsaved": "Bạn đang ngoại tuyến. Thư vẫn ở đây và sẽ được lưu vào Bản nháp khi bạn trực tuyến trở lại." }, + "composer_panel": { + "show_panel": "Hiện {name}", + "hide_panel": "Ẩn {name}" + }, "desktopDevTools": { "section_title": "Khắc phục sự cố", "label": "Công cụ cho nhà phát triển ({shortcut})", diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json index 0f3ae2457..3ddca4003 100644 --- a/locales/zh-TW/common.json +++ b/locales/zh-TW/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "你已離線。郵件已儲存在草稿中。", "offline_send_unsaved": "你已離線。郵件會留在這裡,恢復連線後儲存到草稿。" }, + "composer_panel": { + "show_panel": "顯示{name}", + "hide_panel": "隱藏{name}" + }, "desktopDevTools": { "section_title": "疑難排解", "label": "開發人員工具({shortcut})", diff --git a/locales/zh/common.json b/locales/zh/common.json index e22f4805e..f386804ab 100644 --- a/locales/zh/common.json +++ b/locales/zh/common.json @@ -7673,6 +7673,10 @@ "offline_send_saved": "你已离线。邮件已保存在草稿中。", "offline_send_unsaved": "你已离线。邮件会留在这里,恢复联网后保存到草稿。" }, + "composer_panel": { + "show_panel": "显示{name}", + "hide_panel": "隐藏{name}" + }, "desktopDevTools": { "section_title": "故障排除", "label": "开发者工具({shortcut})",