Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions design-system/apps/design-lab/src/i18n/previewMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const previewEn = {
"preview.state.construction": "Engineering drawing",
"preview.state.secondary": "Secondary", "preview.state.elevated": "Elevated", "preview.state.floating": "Floating",
"preview.state.floating-footer": "Floating footer", "preview.state.alert": "Alert dialog",
"preview.state.panel": "Panel Dialog",
"preview.state.disabled-option": "Disabled option", "preview.state.instant": "Immediate tooltip", "preview.state.interactive": "Interactive tooltip",
"preview.state.content-only": "Content only", "preview.state.with-heading": "With heading", "preview.state.with-action": "With action",
"preview.state.centered": "Centered", "preview.state.with-subtitle": "With subtitle",
Expand Down Expand Up @@ -74,6 +75,7 @@ export const previewZhCN: Record<keyof typeof previewEn, string> = {
"preview.state.construction": "工程制图",
"preview.state.secondary": "次要", "preview.state.elevated": "浮起表面", "preview.state.floating": "悬浮",
"preview.state.floating-footer": "悬浮页脚", "preview.state.alert": "提醒弹窗",
"preview.state.panel": "面板弹窗",
"preview.state.disabled-option": "禁用选项", "preview.state.instant": "即时提示", "preview.state.interactive": "可交互提示",
"preview.state.content-only": "仅内容", "preview.state.with-heading": "附带标题", "preview.state.with-action": "附带操作",
"preview.state.centered": "居中", "preview.state.with-subtitle": "附带副标题",
Expand Down Expand Up @@ -110,6 +112,7 @@ export const previewZhTW: Record<keyof typeof previewEn, string> = {
"preview.state.counter-rotate": "雙六邊形對轉",
"preview.state.construction": "工程製圖",
"preview.state.floating": "懸浮", "preview.state.floating-footer": "懸浮頁尾", "preview.state.alert": "提醒對話框",
"preview.state.panel": "面板彈窗",
"preview.state.disabled-option": "停用選項", "preview.state.instant": "即時提示", "preview.state.interactive": "可互動提示",
"preview.state.content-only": "僅內容", "preview.state.with-heading": "附帶標題", "preview.state.with-action": "附帶操作",
"preview.state.with-subtitle": "附帶副標題", "preview.state.narrow": "窄螢幕", "preview.state.wide": "寬螢幕", "preview.state.safe-area": "安全區域",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const semanticToolEn = {
"flowChat.builtin.tools.AgentDelete": "Delete agents",
"flowChat.builtin.tools.SessionHistory": "Export history",
"flowChat.builtin.tools.analyze_image": "Analyze image",
"flowChat.builtin.tools.generate_image": "Generate image",
"flowChat.builtin.tools.GetTime": "Read time",
"flowChat.builtin.tools.ListMCPResources": "Discover resources",
"flowChat.builtin.tools.ReadMCPResource": "Read resource",
Expand Down Expand Up @@ -199,6 +200,7 @@ export const semanticToolZhCN = {
"flowChat.builtin.tools.AgentDelete": "删除子代理",
"flowChat.builtin.tools.SessionHistory": "导出会话历史",
"flowChat.builtin.tools.analyze_image": "分析图片",
"flowChat.builtin.tools.generate_image": "生成图片",
"flowChat.builtin.tools.GetTime": "读取时间",
"flowChat.builtin.tools.ListMCPResources": "发现资源",
"flowChat.builtin.tools.ReadMCPResource": "读取资源",
Expand Down Expand Up @@ -392,6 +394,7 @@ export const semanticToolZhTW = {
"flowChat.builtin.tools.AgentDelete": "刪除子代理",
"flowChat.builtin.tools.SessionHistory": "匯出工作階段歷史",
"flowChat.builtin.tools.analyze_image": "分析圖片",
"flowChat.builtin.tools.generate_image": "生成圖片",
"flowChat.builtin.tools.GetTime": "讀取時間",
"flowChat.builtin.tools.ListMCPResources": "探索資源",
"flowChat.builtin.tools.ReadMCPResource": "讀取資源",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ const optionLabelKeys: Readonly<Record<string, MessageKey>> = {
hidden: "detail.option.hidden",
inline: "detail.option.inline",
scrolling: "detail.option.scrolling",
panel: "preview.state.panel",
"focus-within": "detail.option.focus-within",
"with-context": "detail.option.with-context",
"with-center": "detail.option.with-center",
Expand Down Expand Up @@ -647,7 +648,8 @@ export function ComponentDetailPage({
return `import { Icon, Menu, MenuItem, MenuSection, MenuSeparator } from "@openbitfun/ui";\n\n<Menu\n aria-label="${t("components.preview.menuLabel")}"\n scrollbarVisibility="${menuShowScrollbar ? "auto" : "hidden"}"\n>\n <MenuSection title="${t("components.preview.menuSectionTitle")}">\n <MenuItem leading={<Icon name="session" />}>${t("components.preview.menuItemOne")}</MenuItem>\n <MenuItem leading={<Icon name="session" />}>${t("components.preview.menuItemTwo")}</MenuItem>\n </MenuSection>\n <MenuSeparator />\n <MenuSection aria-label="${t("components.preview.menuMoreSection")}">\n <MenuItem disabled>${t("components.preview.menuDisabledItem")}</MenuItem>\n </MenuSection>\n</Menu>`;
}
if (component.name === "Dialog") {
return `import { Button, Dialog, DialogBody, DialogClose, DialogFooter, DialogHeader, DialogHeading, DialogTitle } from "@openbitfun/ui";\n\n<Dialog onOpenChange={() => setOpen(false)} open={open} size="xl">\n <DialogHeader>\n <DialogHeading><DialogTitle>${t("components.preview.modalTitle")}</DialogTitle></DialogHeading>\n <DialogClose />\n </DialogHeader>\n <DialogBody><ProviderConfigurationFields /></DialogBody>\n <DialogFooter appearance="floating">\n <Button onClick={() => setOpen(false)} variant="fill">${t("components.preview.modalCancel")}</Button>\n <Button onClick={() => setOpen(false)} variant="primary">${t("components.preview.modalSave")}</Button>\n </DialogFooter>\n</Dialog>`;
const geometry = previewState === "panel" ? 'preset="panel"' : 'size="xl"';
return `import { Button, Dialog, DialogBody, DialogClose, DialogFooter, DialogHeader, DialogHeading, DialogTitle } from "@openbitfun/ui";\n\n<Dialog onOpenChange={() => setOpen(false)} open={open} ${geometry}>\n <DialogHeader>\n <DialogHeading><DialogTitle>${t("components.preview.modalTitle")}</DialogTitle></DialogHeading>\n <DialogClose />\n </DialogHeader>\n <DialogBody><ProviderConfigurationFields /></DialogBody>\n <DialogFooter appearance="floating">\n <Button onClick={() => setOpen(false)} variant="fill">${t("components.preview.modalCancel")}</Button>\n <Button onClick={() => setOpen(false)} variant="primary">${t("components.preview.modalSave")}</Button>\n </DialogFooter>\n</Dialog>`;
}
if (component.name === "Sheet") {
return `import { Button, DialogBody, DialogClose, DialogFooter, DialogHeader, DialogHeading, DialogTitle, Sheet } from "@openbitfun/ui";\n\n<Sheet onOpenChange={() => setOpen(false)} open={open} placement="right" size="lg">\n <DialogHeader>\n <DialogHeading><DialogTitle>${t("components.preview.modalTitle")}</DialogTitle></DialogHeading>\n <DialogClose />\n </DialogHeader>\n <DialogBody><ProviderConfigurationFields /></DialogBody>\n <DialogFooter>\n <Button onClick={() => setOpen(false)} variant="fill">${t("components.preview.modalCancel")}</Button>\n <Button onClick={() => setOpen(false)} variant="primary">${t("components.preview.modalSave")}</Button>\n </DialogFooter>\n</Sheet>`;
Expand Down Expand Up @@ -872,6 +874,7 @@ export function ComponentDetailPage({
onOpenChange={closePreview}
open={overlayOpen}
role={state === "alert" ? "alertdialog" : "dialog"}
preset={state === "panel" ? "panel" : "default"}
size="xl"
>
<DialogHeader>
Expand All @@ -881,7 +884,7 @@ export function ComponentDetailPage({
<DialogClose />
</DialogHeader>
<DialogBody style={state === "scrolling" ? { maxHeight: "40dvh" } : undefined}>{renderDialogConfigurationContent()}</DialogBody>
<DialogFooter appearance={state === "floating-footer" ? "floating" : "attached"}>
<DialogFooter appearance={state === "floating-footer" || state === "panel" ? "floating" : "attached"}>
<Button onClick={closePreview} variant="fill">
{t("components.preview.modalCancel")}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type MockToolScope = 'all' | ToolGroup;
// Only grouping is Lab-owned. Names and component bindings come from production.
const groupForTool = {
get_goal: 'collaboration', create_goal: 'collaboration', update_goal: 'collaboration', AgentList: 'collaboration',
SessionHistory: 'collaboration', analyze_image: 'files', GetTime: 'execution',
SessionHistory: 'collaboration', analyze_image: 'files', generate_image: 'files', GetTime: 'execution',
ListMCPResources: 'execution', ReadMCPResource: 'execution', ListMCPPrompts: 'execution', GetMCPPrompt: 'execution',
Worktree: 'files', PortForward: 'execution', ReviewPlatform: 'collaboration', FrontendWorkbench: 'web',
FinalizeMiniApp: 'web', PublishMiniApp: 'web', PublishAppearance: 'web', Playbook: 'execution',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ test('conversation bubble geometry and color stay aligned with production', asyn
]);
const preview = block(lab, '.flow-chat-mock__user-bubble');
const actual = block(product, '.user-message-item');
for (const name of ['width', 'max-width', 'padding', 'background', 'border', 'border-radius', 'margin-block', 'margin-inline', 'box-shadow']) {
for (const name of ['width', 'max-width', 'padding', 'border', 'border-radius', 'margin-block', 'margin-inline', 'box-shadow']) {
assert.equal(property(preview, name), property(actual, name), name);
}
// Production paints the fill on its separate submission-motion surface.
assert.equal(property(preview, 'background'), property(block(product, '.user-message-item__surface'), 'background'), 'background');
for (const name of ['--_user-message-radius', '--_user-message-padding-inline', 'margin']) {
assert.equal(property(block(lab, '.flow-chat-mock__user'), name), property(block(product, '.user-message-item-shell'), name), name);
}
Expand Down
4 changes: 4 additions & 0 deletions design-system/packages/design-tokens/src/system.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,10 @@
"$value": "blur(10px)"
},
"footerActionMinWidth": { "$value": "100px" },
"panelBlockSize": {
"$description": "Fixed Panel Dialog height before viewport clamping; width and content measure reuse the existing xlarge and large dialog scales.",
"$value": "640px"
},
"maxInlineSizeSmall": { "$value": "420px" },
"maxInlineSizeMedium": { "$value": "560px" },
"maxInlineSizeLarge": { "$value": "600px" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ test("Dialog tokens preserve the reference surface and chrome contract", async (
assert.equal(tokens["overlay.dialog.footerBlur"], "blur(10px)");
assert.equal(tokens["overlay.dialog.footerFadeExtent"], "24px");
assert.equal(tokens["overlay.dialog.footerContentInset"], "104px");
assert.equal(tokens["overlay.dialog.panelBlockSize"], "640px");
});

test("control heights preserve an eight-pixel size step in every density mode", () => {
Expand Down
40 changes: 39 additions & 1 deletion design-system/packages/ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,15 @@ Leading identity icons stay in their label layout; this contract governs the
independent trailing actions. Product CSS owns placement of capsules, not their
action offsets, backgrounds, or visibility.

`Capsule layout="split"` joins two direct child controls into equal-width halves
with square inner corners, rounded outer ends, and no mismatched child borders.
Set `splitSizing="content"` to fit the leading control to its content and give the
remaining width to the trailing action. Use a `Select variant="pill"` followed by
a `Button`, with the same explicit size; set the Select's `width="content"` for
content sizing or `width="full"` for equal halves. Each control
keeps its own focus, disabled state, and action; the select popup remains portalled.
Use exactly two controls and omit the floating `action` slot for this layout.

For supplemental label annotations, compose `Tooltip trigger="hover-focus"
openOnClick` with `IconButton variant="annotation" size="xs"` and an `info`
icon. The annotation uses `color.content.muted` at rest and
Expand Down Expand Up @@ -838,7 +847,36 @@ Dialog titles use 24px bold type with their own 29px line box and normal trackin

Extra-large (`xl`) dialogs have an 800px maximum width and continue shrinking within the viewport gutter. Provider editing uses the floating footer; small workspace creation retains its attached footer and existing button/input sizes. The Lab workspace pattern uses local sample paths and callbacks only.

Keep `Dialog` and `Sheet` mounted and set `open={false}` to close them. They retain the last committed children, size, placement, classes, and styles during the exit animation, with interaction disabled, so clearing an owner selection does not resize the surface. Reopening uses the latest presentation and cancels the pending exit. Owners that conditionally mount an editor can remove it in `onExitComplete`, which runs once after the surface unmounts.
**Panel Dialog** (`Dialog preset="panel"`) is the fixed management-panel layout:
800px wide, 640px high, with a 600px heading and content measure. The heading and
body form one vertically centered group when content is short. Long content uses
the available body height and scrolls; it does not resize the surface. The minimum
top inset and heading-to-body gap share one measure: the header chrome inset plus
16px. Floating footers reserve only their actual action height at the bottom,
with trailing body space for the fade. Plain headings
use the small control height, while a brand mark can grow naturally. Header
actions or a standalone close button stay in the upper-right corner; use
`DialogHeaderLeading` for a fixed upper-left back action. Width and height shrink
within the viewport gutter. `DialogBody` owns scrolling and responsive horizontal
insets. Use direct `DialogHeader` / `DialogHeading`, `DialogBody`, and optional
`DialogFooter` children; group right-side actions in `DialogHeaderActions`.
The preset selects `xl` regardless of `size`; the default preset retains the
existing content-sized behavior. Keep product copy and account logic in consumers.
The only new geometry token is `overlay.dialog.panelBlockSize`: the existing
width and spacing scales cover the other dimensions, but do not define a fixed
panel height.

```tsx
<Dialog open={open} onOpenChange={setOpen} preset="panel">
<DialogHeader>
<DialogHeading><DialogTitle>Manage accounts</DialogTitle></DialogHeading>
<DialogHeaderActions><DialogClose /></DialogHeaderActions>
</DialogHeader>
<DialogBody>{accountList}</DialogBody>
</Dialog>
```

Keep `Dialog` and `Sheet` mounted and set `open={false}` to close them. They retain the last committed children, preset, size, placement, classes, and styles during the exit animation, with interaction disabled, so clearing an owner selection does not resize the surface. Reopening uses the latest presentation and cancels the pending exit. Owners that conditionally mount an editor can remove it in `onExitComplete`, which runs once after the surface unmounts.

PageHeader `md` uses the settings title with a primary 15px description; `display` uses the welcome heading and medium 17px introduction with a 12px gap. ActionCard uses 12px padding, section-heading typography (15px semibold), and a primary 13px single-line action description. Its inset outline does not inflate the 62px medium minimum height; longer content keeps the independent sibling actions and OverflowText behavior.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import type { ComponentMeta } from "../../registry.types";

export const capsuleMeta = {
category: "action",
description: "A capsule composition with a circular glass action that overlays the label or occupies reserved space inside its Button surface. Reserved content is centered at rest and shifts aside when the action appears, without changing layout; touch keeps the action available.",
description: "A capsule with joined controls or a circular glass action that overlays the label or occupies reserved space inside its Button surface. Split controls support equal widths or a content-sized leading control. Reserved content is centered at rest and shifts aside when the action appears, without changing layout; touch keeps the action available.",
maturity: "stable",
name: "Capsule",
props: [
{ name: "children", type: "ReactNode" },
{ name: "layout", type: "inline | split", defaultValue: "inline" },
{ name: "splitSizing", type: "equal | content", defaultValue: "equal" },
{ name: "action", type: "ReactNode" },
{ name: "actionPlacement", type: "overlay | reserved", defaultValue: "overlay" },
{ name: "size", type: "xs | sm | md | lg", defaultValue: "sm" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,47 @@

.root:dir(rtl) { --_capsule-inline-direction: -1; }

.root[data-layout="split"] {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
inline-size: 100%;
}

.root[data-layout="split"][data-split-sizing="content"] {
grid-template-columns: max-content minmax(0, 1fr);
}

.root[data-layout="split"] > [data-openbitfun-component="select"],
.root[data-layout="split"] > [data-openbitfun-component="button"] {
min-inline-size: 0;
inline-size: 100%;
}

.root[data-layout="split"][data-split-sizing="content"] > :first-child {
inline-size: max-content;
max-inline-size: 100%;
}

/* Match the Select fill to Button's inset fill without changing control size. */
.root[data-layout="split"] > [data-openbitfun-component="select"] > [data-openbitfun-part="trigger"] {
border-color: transparent;
background-clip: padding-box;
}

.root[data-layout="split"] > :first-child,
.root[data-layout="split"] > :first-child > [data-openbitfun-part="trigger"] {
border-start-end-radius: 0;
border-end-end-radius: 0;
border-inline-end-width: 0;
}

.root[data-layout="split"] > :last-child,
.root[data-layout="split"] > :last-child > [data-openbitfun-part="trigger"] {
border-start-start-radius: 0;
border-end-start-radius: 0;
border-inline-start-width: 0;
}

/* Reserve space inside the Button's surface, leaving inter-capsule gaps intact. */
.root[data-action-placement="reserved"] {
--_capsule-action-padding: calc(
Expand Down
11 changes: 9 additions & 2 deletions design-system/packages/ui/src/components/Capsule/Capsule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import actionStyles from "../../internal/FloatingAction.module.css";
import styles from "./Capsule.module.css";

export interface CapsuleProps extends HTMLAttributes<HTMLSpanElement> {
/** Join two independent controls into one capsule. */
layout?: "inline" | "split";
/** Fit the leading split control to its content, or use equal halves. */
splitSizing?: "equal" | "content";
/** One IconButton (optionally wrapped in Tooltip), rendered beside the content. */
action?: ReactNode;
/** Reserve a fixed action slot inside a Button child's trailing padding. */
Expand All @@ -13,18 +17,21 @@ export interface CapsuleProps extends HTMLAttributes<HTMLSpanElement> {
size?: "xs" | "sm" | "md" | "lg";
}

/** Composes content with an independent circular glass action. */
/** Composes content with a floating action, or joins two independent controls. */
export const Capsule = forwardRef<HTMLSpanElement, CapsuleProps>(function Capsule({
action,
actionPlacement = "overlay",
children,
className,
layout = "inline",
size = "sm",
splitSizing = "equal",
...props
}, ref) {
return (
<span {...props} className={classNames(actionStyles.host, styles.root, className)}
data-openbitfun-component="capsule" data-size={size} data-action-placement={action != null ? actionPlacement : undefined} data-overflow-trigger ref={ref}>
data-openbitfun-component="capsule" data-layout={layout} data-size={size} data-split-sizing={layout === "split" ? splitSizing : undefined}
data-action-placement={action != null ? actionPlacement : undefined} data-overflow-trigger ref={ref}>
{children}
{action != null && <FloatingAction data-openbitfun-part="action"
className={actionPlacement === "reserved" ? styles.reservedAction : undefined}>{action}</FloatingAction>}
Expand Down
Loading
Loading