@cosmicdrift/kumiko-renderer 0.418.0 → 0.419.0

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.
@@ -1116,6 +1116,8 @@ export type ModalProps = {
1116
1116
  readonly title: string;
1117
1117
  readonly children: ReactNode;
1118
1118
  readonly testId?: string;
1119
+ /** "wide" suits content with lists beside actions; web caps it at the viewport. */
1120
+ readonly size?: "default" | "wide";
1119
1121
  };
1120
1122
  /** Side panel for hosting an existing self-contained form/widget (own
1121
1123
  * submit/cancel buttons) without leaving the underlying screen — e.g. a
@@ -1373,6 +1375,8 @@ export type ActionOverflowMenuProps = {
1373
1375
  readonly items: readonly ActionMenuItemSpec[];
1374
1376
  /** aria-label for the three-dots trigger. */
1375
1377
  readonly label: string;
1378
+ /** Renders a labelled button (plus icon, text, chevron) instead of the three-dots icon. */
1379
+ readonly triggerLabel?: string;
1376
1380
  readonly testId?: string;
1377
1381
  };
1378
1382
  import type { CopyButtonProps, PromoPanelProps, SecretRevealProps, ShareButtonProps, StickyActionBarProps } from "./primitives-share-types.ts";
@@ -1,7 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cn } from "../lib/cn.js";
3
3
  export function RailSection({ title, action, testId, children, }) {
4
- return (_jsxs("section", { className: "flex flex-col border-b pb-1", "data-testid": testId, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 px-3.5 pt-2.5 pb-1", children: [_jsx("span", { className: "min-w-0 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: title }), action !== undefined && _jsx("div", { className: "ml-auto", children: action })] }), children] }));
4
+ return (_jsxs("section", { className: "flex flex-col border-b pb-1", "data-testid": testId, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 px-3.5 pt-2.5 pb-1", children: [_jsx("span", { className: "min-w-0 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: title }), action !== undefined && _jsx("div", { className: "ml-auto whitespace-nowrap", children: action })] }), children] }));
5
5
  }
6
6
  export function RailField({ children }) {
7
7
  return _jsx("div", { className: "flex flex-col gap-3 px-3.5 py-2", children: children });
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from "react";
2
+ export declare function EditorToolbarPill({ children }: {
3
+ readonly children: ReactNode;
4
+ }): ReactNode;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // A compact outlined pill for a second toolbar row; a select button inside stays flat and fills the pill.
3
+ export function EditorToolbarPill({ children }) {
4
+ return (_jsx("span", { className: "inline-flex h-7 shrink-0 items-center rounded-md border border-input bg-background [&_button]:h-full [&_button]:min-h-0 [&_button[aria-haspopup=listbox]]:h-full [&_button[aria-haspopup=listbox]]:min-h-0 [&_button[aria-haspopup=listbox]]:w-auto [&_button[aria-haspopup=listbox]]:px-2 [&_button[aria-haspopup=listbox]]:py-0 [&_button[aria-haspopup=listbox]]:text-xs", children: children }));
5
+ }
@@ -2,5 +2,6 @@ export { type EditorActionTestIds, EditorFooter, type FooterTone } from "./edito
2
2
  export { EditorBody, EditorFrame, EditorInfoBar, type InfoBarTone } from "./editor-frame.tsx";
3
3
  export { EditorHeader, type EditorHeaderTestIds, EditorLocaleSwitch, type EditorMode, EditorModeSwitch, type EditorSaveActions, } from "./editor-header.tsx";
4
4
  export { RailField, RailHint, RailRow, RailSection } from "./editor-rail.tsx";
5
+ export { EditorToolbarPill } from "./editor-toolbar-pill.tsx";
5
6
  export { EditorWorkbench, type EditorWorkbenchProps, type WorkbenchSave, } from "./editor-workbench.tsx";
6
7
  export { formatRelativeWhen } from "./relative-when.ts";
@@ -2,5 +2,6 @@ export { EditorFooter } from "./editor-footer.js";
2
2
  export { EditorBody, EditorFrame, EditorInfoBar } from "./editor-frame.js";
3
3
  export { EditorHeader, EditorLocaleSwitch, EditorModeSwitch, } from "./editor-header.js";
4
4
  export { RailField, RailHint, RailRow, RailSection } from "./editor-rail.js";
5
+ export { EditorToolbarPill } from "./editor-toolbar-pill.js";
5
6
  export { EditorWorkbench, } from "./editor-workbench.js";
6
7
  export { formatRelativeWhen } from "./relative-when.js";
@@ -15,7 +15,7 @@ export { useResolvers } from "./app/resolvers-context.tsx";
15
15
  export { clearRememberedListState } from "./app/session-list-state-store.ts";
16
16
  export { DrawnFilter, DrawnPanel, DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand, } from "./drawn-icons.ts";
17
17
  export type { EditorActionTestIds, EditorHeaderTestIds, EditorMode, EditorSaveActions, EditorWorkbenchProps, FooterTone, InfoBarTone, WorkbenchSave, } from "./editor/index.ts";
18
- export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.ts";
18
+ export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorToolbarPill, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.ts";
19
19
  export type { NavIconKey } from "./icons.tsx";
20
20
  export { Icon } from "./icons.tsx";
21
21
  export type { AppLayoutProps } from "./layout/app-layout.tsx";
package/dist/web/index.js CHANGED
@@ -13,7 +13,7 @@ export { PlainContentEditor } from "./app/plain-content-editor.js";
13
13
  export { useResolvers } from "./app/resolvers-context.js";
14
14
  export { clearRememberedListState } from "./app/session-list-state-store.js";
15
15
  export { DrawnFilter, DrawnPanel, DrawnPencil, DrawnSearch, DrawnSparkles, DrawnWand, } from "./drawn-icons.js";
16
- export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.js";
16
+ export { EditorBody, EditorFooter, EditorFrame, EditorHeader, EditorInfoBar, EditorLocaleSwitch, EditorModeSwitch, EditorToolbarPill, EditorWorkbench, formatRelativeWhen, RailField, RailHint, RailRow, RailSection, } from "./editor/index.js";
17
17
  export { Icon } from "./icons.js";
18
18
  export { AppLayout } from "./layout/app-layout.js";
19
19
  export { Avatar } from "./layout/avatar.js";
@@ -3,6 +3,8 @@ export type MenuItemDef = {
3
3
  readonly kind: "item";
4
4
  readonly id: string;
5
5
  readonly label: string;
6
+ readonly description?: string;
7
+ readonly testId?: string;
6
8
  /** Optional icon displayed before the label (16px). */
7
9
  readonly icon?: ReactNode;
8
10
  /** Display-only shortcut hint on the right (monospace, muted).
@@ -26,6 +26,6 @@ export function ActionMenu({ trigger, triggerLabel, items, align = "end", minWid
26
26
  // biome-ignore lint/suspicious/noArrayIndexKey: labels have no ID either, so their position provides identity
27
27
  return _jsx(DropdownMenuLabel, { children: item.label }, `label-${idx}`);
28
28
  }
29
- return (_jsxs(DropdownMenuItem, { onSelect: item.onSelect, disabled: item.disabled === true, "data-testid": `action-menu-item-${item.id}`, className: item.variant === "danger" ? "text-destructive focus:text-destructive" : undefined, children: [item.icon !== undefined && _jsx("span", { className: "size-4 shrink-0", children: item.icon }), _jsx("span", { className: "flex-1", children: item.label }), item.shortcut !== undefined && (_jsx("span", { className: "ml-auto text-xs text-muted-foreground tracking-wider font-mono", children: item.shortcut }))] }, item.id));
29
+ return (_jsxs(DropdownMenuItem, { onSelect: item.onSelect, disabled: item.disabled === true, "data-testid": item.testId ?? `action-menu-item-${item.id}`, className: item.variant === "danger" ? "text-destructive focus:text-destructive" : undefined, children: [item.icon !== undefined && _jsx("span", { className: "size-4 shrink-0", children: item.icon }), _jsxs("span", { className: "flex flex-1 flex-col", children: [item.label, item.description !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", children: item.description }))] }), item.shortcut !== undefined && (_jsx("span", { className: "ml-auto text-xs text-muted-foreground tracking-wider font-mono", children: item.shortcut }))] }, item.id));
30
30
  }) })] }));
31
31
  }
@@ -1,3 +1,3 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { ModalProps } from "../../index.ts";
3
- export declare function DefaultModal({ open, onOpenChange, title, children, testId, }: ModalProps): ReactNode;
3
+ export declare function DefaultModal({ open, onOpenChange, title, children, testId, size, }: ModalProps): ReactNode;
@@ -7,7 +7,7 @@ import { useTranslation } from "../../index.js";
7
7
  import { cn } from "../lib/cn.js";
8
8
  import { BareFormProvider } from "./contexts.js";
9
9
  import { ModalShell } from "./modal-shell.js";
10
- export function DefaultModal({ open, onOpenChange, title, children, testId, }) {
10
+ export function DefaultModal({ open, onOpenChange, title, children, testId, size = "default", }) {
11
11
  const t = useTranslation();
12
- return (_jsxs(ModalShell, { open: open, onOpenChange: onOpenChange, testId: testId, closeLabel: t("kumiko.dialog.close"), noAriaDescription: true, contentClassName: cn("grid w-full max-w-lg gap-4 border bg-card p-6 shadow-lg rounded-lg"), children: [_jsx(DialogPrimitive.Title, { className: "text-lg font-semibold leading-none tracking-tight", children: title }), _jsx("div", { onSubmit: (e) => e.stopPropagation(), children: _jsx(BareFormProvider, { children: children }) })] }));
12
+ return (_jsxs(ModalShell, { open: open, onOpenChange: onOpenChange, testId: testId, closeLabel: t("kumiko.dialog.close"), noAriaDescription: true, contentClassName: cn("grid w-full gap-4 border bg-card p-6 shadow-lg rounded-lg", size === "wide" ? "max-w-[min(830px,calc(100vw-2rem))]" : "max-w-lg"), children: [_jsx(DialogPrimitive.Title, { className: "text-lg font-semibold leading-none tracking-tight", children: title }), _jsx("div", { onSubmit: (e) => e.stopPropagation(), children: _jsx(BareFormProvider, { children: children }) })] }));
13
13
  }
@@ -12,4 +12,4 @@ export declare function RowActionsCell({ row, actions, mode, rowIsLink, compact,
12
12
  /** Small bordered buttons without the phone touch height; for buttons sitting inside a card. */
13
13
  readonly small?: boolean;
14
14
  }): ReactNode;
15
- export declare function ActionOverflowMenu({ items, label, testId }: ActionOverflowMenuProps): ReactNode;
15
+ export declare function ActionOverflowMenu({ items, label, triggerLabel, testId, }: ActionOverflowMenuProps): ReactNode;
@@ -1,5 +1,5 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Loader2, MoreHorizontal } from "lucide-react";
2
+ import { ChevronDown, Loader2, MoreHorizontal, Plus } from "lucide-react";
3
3
  import { useState } from "react";
4
4
  import { COMPACT_TAP_CLASSES } from "../../compact-tap-classes.js";
5
5
  import { needsActionConfirm, shouldRenderActionsIconOnly, useTranslation, WriteFailedError, } from "../../index.js";
@@ -187,9 +187,9 @@ function RowActionsKebab({ row, actions, }) {
187
187
  // secondary icon Button so it matches neighbouring icon buttons, including
188
188
  // the 44 px touch size on phones. Generic ActionMenuItemSpec items instead of
189
189
  // the DataTableRowAction schema (callers own confirm/danger handling per item).
190
- export function ActionOverflowMenu({ items, label, testId }) {
190
+ export function ActionOverflowMenu({ items, label, triggerLabel, testId, }) {
191
191
  const [open, setOpen] = useState(false);
192
- return (_jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(UiButton, { type: "button", variant: "outline", size: "icon", className: SECONDARY_BUTTON_EXTRA_CLASSES, "aria-label": label, "data-testid": testId ?? "action-overflow-menu-trigger", children: _jsx(MoreHorizontal, { className: "size-4", "aria-hidden": "true" }) }) }), _jsx(DropdownMenuContent, { align: "end", children: items.map((item) => {
192
+ return (_jsxs(DropdownMenu, { open: open, onOpenChange: setOpen, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(UiButton, { type: "button", variant: "outline", size: triggerLabel === undefined ? "icon" : "sm", className: SECONDARY_BUTTON_EXTRA_CLASSES, "aria-label": label, "data-testid": testId ?? "action-overflow-menu-trigger", children: triggerLabel === undefined ? (_jsx(MoreHorizontal, { className: "size-4", "aria-hidden": "true" })) : (_jsxs(_Fragment, { children: [_jsx(Plus, { className: "size-4", "aria-hidden": "true" }), triggerLabel, _jsx(ChevronDown, { className: "size-3", "aria-hidden": "true" })] })) }) }), _jsx(DropdownMenuContent, { align: "end", children: items.map((item) => {
193
193
  const resolvedIcon = actionIconFor(item.icon);
194
194
  return (_jsxs(DropdownMenuItem, { "data-testid": item.testId ?? `${testId ?? "action-overflow-menu"}-item-${item.id}`, disabled: item.disabled === true, onSelect: (e) => {
195
195
  e.preventDefault();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-renderer",
3
- "version": "0.418.0",
3
+ "version": "0.419.0",
4
4
  "description": "React renderer for Kumiko screens. The root export holds the platform-agnostic logic (primitives contract, hooks, KumikoScreen, navigation and SSE abstractions); ./headless the DOM-free UI logic, ./live the HTTP dispatcher, ./web the browser bindings (HTML primitives, history navigation, EventSource live events, createKumikoApp).",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -48,8 +48,8 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
- "@cosmicdrift/kumiko-framework": "0.418.0",
52
- "@cosmicdrift/kumiko-types": "0.418.0",
51
+ "@cosmicdrift/kumiko-framework": "0.419.0",
52
+ "@cosmicdrift/kumiko-types": "0.419.0",
53
53
  "@types/qrcode": "^1.5.6",
54
54
  "class-variance-authority": "^0.7.1",
55
55
  "clsx": "^2.1.1",
@@ -79,8 +79,8 @@
79
79
  }
80
80
  },
81
81
  "devDependencies": {
82
- "@cosmicdrift/kumiko-locale-de": "0.418.0",
83
- "@cosmicdrift/kumiko-testing": "0.418.0",
82
+ "@cosmicdrift/kumiko-locale-de": "0.419.0",
83
+ "@cosmicdrift/kumiko-testing": "0.419.0",
84
84
  "@tailwindcss/cli": "^4.3.3",
85
85
  "@testing-library/react": "^16.3.3",
86
86
  "@testing-library/user-event": "^14.6.8",