The Open Standard for Generative UI
feat(react-ui): add new components to openuiChatLibrary (#1173)
abhithesys8e0d1c81bdbb
diff --git a/.changeset/react-ui-chat-library-components.md b/.changeset/react-ui-chat-library-components.mdnew file mode 100644index 000000000..0b764a68c--- /dev/null+++ b/.changeset/react-ui-chat-library-components.md@@ -0,0 +1,17 @@+---+"@openuidev/react-ui": minor+---++Add new components to `openuiChatLibrary`.++New chat components: `InlineHeader`, `EditableTable`, `Chips`/`ChipItem`, `OptionCards`/`OptionCard`, `Icon`, `IconButton`, `EntityList`, `Text`, `BoldText`, `IconText`, `ImageText`, `ImageTextLarge`, `MetricIndicatorInline`, `MetricIndicatorWithStrikethrough`, and the `Snippet`/`Overview`/`Context`/`Composite`/`Visual` card blocks with their items. Each ships as a react-ui primitive under `components/` plus a genui-lib wrapper.++Citations: the chat `Card` accepts `sources`, renders a Sources strip, and `[n]` markers in `TextContent` become citation chips. New `TextContentWrapper`, `Citation`, `Sources`, `SourceFaviconImage`, `InlineMarkdownRenderer` and `TooltipWrapper` primitives.++Card block clicks attach per-item context (`itemIndex`, `itemId`, `itemTitle`, ...) to the block action. Chat-only variants of `Form`, `FormControl`, `Tabs`, `Accordion`, `Carousel` and `SectionBlock` accept the new blocks as nested content.++Prompt: chat examples and rules rewritten to cover cards, forms, citations and actions. The action prop schema now carries the `open_url` / `continue_conversation` / custom object contract in the generated JSON schema.++Breaking: `Tag.icon` is now an `Icon` reference instead of a string. `TagBlock` gains `size`, `ListBlock` gains `size`, condensed charts gain `height`. Typography map gains `number/title` and `number/title-medium`; several components that referenced a non-existent `primary` font family now use `body`.++Dependencies: adds `@tanstack/react-table` and `unist-util-visit`.diff --git a/packages/react-ui/package.json b/packages/react-ui/package.jsonindex b33efc613..adcc1604c 100644--- a/packages/react-ui/package.json+++ b/packages/react-ui/package.json@@ -133,6 +133,7 @@"@radix-ui/react-tabs": "^1.1.2","@radix-ui/react-toggle-group": "^1.1.2","@radix-ui/react-tooltip": "^1.2.7",+ "@tanstack/react-table": "^8.21.3","clsx": "^2.1.1","date-fns": "^4.1.0","lodash-es": "^4.17.21",@@ -146,7 +147,8 @@"remark-emoji": "^5.0.1","remark-gfm": "^4.0.1","remark-math": "^6.0.0",- "tiny-invariant": "^1.3.3"+ "tiny-invariant": "^1.3.3",+ "unist-util-visit": "^5.1.0"},"devDependencies": {"@chromatic-com/storybook": "^3.2.4",diff --git a/packages/react-ui/src/components/Calendar/utils/calendarBaseStyle.scss b/packages/react-ui/src/components/Calendar/utils/calendarBaseStyle.scssindex 867919812..a7ba53f6b 100644--- a/packages/react-ui/src/components/Calendar/utils/calendarBaseStyle.scss+++ b/packages/react-ui/src/components/Calendar/utils/calendarBaseStyle.scss@@ -5,7 +5,7 @@--openui-calendar-day-size: calc(#{cssUtils.$space-2xl} + #{cssUtils.$space-2xs});--openui-calendar-cell-radius: #{cssUtils.$radius-m};- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);width: fit-content;max-width: 100%;box-sizing: border-box;@@ -181,6 +181,6 @@}.openui-calendar-footer {- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);color: cssUtils.$text-neutral-primary;}diff --git a/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scss b/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scssindex 6447789ce..3f700848e 100644--- a/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scss+++ b/packages/react-ui/src/components/CheckBoxItem/checkBoxItem.scss@@ -59,7 +59,7 @@.openui-checkbox-item-label {flex: 1;- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);color: cssUtils.$text-neutral-primary;cursor: pointer;overflow-wrap: anywhere;diff --git a/packages/react-ui/src/components/Chips/Chips.tsx b/packages/react-ui/src/components/Chips/Chips.tsxnew file mode 100644index 000000000..8be902d8b--- /dev/null+++ b/packages/react-ui/src/components/Chips/Chips.tsx@@ -0,0 +1,75 @@+import clsx from "clsx";+import { forwardRef, type HTMLAttributes, type ReactNode } from "react";++export type ChipsSelectionType = "single" | "multiple";++export interface ChipsItem {+ value: string;+ label: string;+ icon?: ReactNode;+ disabled?: boolean;+}++export interface ChipsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onToggle"> {+ items: ChipsItem[];+ /** Currently selected item values. */+ selected?: string[];+ type?: ChipsSelectionType;+ /** Disables every chip (e.g. while streaming). */+ disabled?: boolean;+ onToggle?: (value: string) => void;+ className?: string;+}++const Chips = forwardRef<HTMLDivElement, ChipsProps>((props, ref) => {+ const {+ items,+ selected = [],+ type = "multiple",+ disabled = false,+ onToggle,+ className,+ ...rest+ } = props;++ // Items without a value have no stable identity to select or toggle by.+ const renderableItems = (items ?? []).filter((item) => Boolean(item?.value));++ return (+ <div+ ref={ref}+ className={clsx("openui-chips", className)}+ role="listbox"+ aria-multiselectable={type === "multiple"}+ {...rest}+ >+ {renderableItems.map((item) => {+ const isSelected = selected.includes(item.value);+ const isDisabled = disabled || item.disabled === true;++ return (+ <button+ key={item.value}+ type="button"+ role="option"+ aria-selected={isSelected}+ disabled={isDisabled}+ className={clsx(+ "openui-chip-item",+ isSelected && "openui-chip-item--selected",+ isDisabled && "openui-chip-item--disabled",+ )}+ onClick={() => onToggle?.(item.value)}+ >+ {item.icon ? <span className="openui-chip-item__icon">{item.icon}</span> : null}+ <span className="openui-chip-item__text">{item.label}</span>+ </button>+ );+ })}+ </div>+ );+});++Chips.displayName = "Chips";++export { Chips };diff --git a/packages/react-ui/src/components/Chips/chips.scss b/packages/react-ui/src/components/Chips/chips.scssnew file mode 100644index 000000000..8955ac5fd--- /dev/null+++ b/packages/react-ui/src/components/Chips/chips.scss@@ -0,0 +1,65 @@+@use "../../cssUtils" as cssUtils;++.openui-chips {+ display: flex;+ flex-wrap: wrap;+ gap: cssUtils.$space-s;+ width: 100%;+ box-sizing: border-box;+}++.openui-chip-item {+ @include cssUtils.button-reset;+ display: inline-flex;+ align-items: center;+ gap: cssUtils.$space-xs;+ padding: cssUtils.$space-xs cssUtils.$space-s;+ border: 1px solid cssUtils.$border-interactive;+ border-radius: cssUtils.$radius-m;+ box-sizing: border-box;+ cursor: pointer;+ background: transparent;+ color: cssUtils.$text-neutral-primary;+ transition:+ border-color 0.15s ease,+ background-color 0.15s ease,+ opacity 0.15s ease;+ @include cssUtils.typography(label, default);++ &:not(:disabled):not(.openui-chip-item--selected):hover {+ border-color: cssUtils.$border-default;+ background-color: cssUtils.$sunk-light;+ }++ &:focus-visible {+ outline: 2px solid cssUtils.$border-accent;+ outline-offset: 2px;+ }++ &--selected {+ border-color: cssUtils.$border-interactive-selected;+ background-color: cssUtils.$highlight-strong;+ }++ &:disabled,+ &--disabled {+ opacity: 0.6;+ cursor: not-allowed;+ }+}++.openui-chip-item__icon {+ display: flex;+ align-items: center;++ & > * {+ width: 14px;+ height: 14px;+ }+}++.openui-chip-item__text {+ overflow: hidden;+ white-space: nowrap;+ text-overflow: ellipsis;+}diff --git a/packages/react-ui/src/components/Chips/index.ts b/packages/react-ui/src/components/Chips/index.tsnew file mode 100644index 000000000..cd5e9516c--- /dev/null+++ b/packages/react-ui/src/components/Chips/index.ts@@ -0,0 +1 @@+export * from "./Chips";diff --git a/packages/react-ui/src/components/Citation/Citation.tsx b/packages/react-ui/src/components/Citation/Citation.tsxnew file mode 100644index 000000000..8f2a78ba1--- /dev/null+++ b/packages/react-ui/src/components/Citation/Citation.tsx@@ -0,0 +1,89 @@+import * as Tooltip from "@radix-ui/react-tooltip";+import clsx from "clsx";+import { Key, memo } from "react";+import { usePinnableTooltip } from "../_shared/hooks";+import { IconWrapper } from "../_shared/icons";+import { SourceWithFavicon } from "../Sources/SourceContext";+import { useTheme } from "../ThemeProvider";+import { CitationItem } from "./CitationItem";++export interface CitationProps {+ onClick?: () => void;+ sources: SourceWithFavicon[];+}++const MultiCitation = memo((props: CitationProps) => {+ const { sources } = props;+ const { portalThemeClassName } = useTheme();++ const {+ isOpen,+ handleMouseEnter,+ handleMouseLeave,+ handleTriggerClick,+ handleContentClick,+ closeTooltip,+ getPointerDownOutsideHandler,+ } = usePinnableTooltip();++ return (+ <span className="openui-citation-container">+ <Tooltip.Provider>+ <Tooltip.Root open={isOpen}>+ <Tooltip.Trigger asChild>+ <button+ type="button"+ className="openui-citation"+ aria-label="Citations"+ onClick={handleTriggerClick}+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}+ >+ <IconWrapper name="globe" size={12} />+ </button>+ </Tooltip.Trigger>+ <Tooltip.Portal>+ <Tooltip.Content+ side="bottom"+ align="start"+ sideOffset={4}+ alignOffset={-8}+ className={clsx("openui-citation-tooltip", portalThemeClassName)}+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}+ onClick={handleContentClick}+ onPointerDownOutside={getPointerDownOutsideHandler(".openui-citation")}+ >+ <div className="openui-citation-tooltip__content">+ {sources.map((itemProps, index: number) => {+ const { key: _key, ...rest } = itemProps as SourceWithFavicon & {+ key?: Key;+ };+ return <CitationItem key={index} {...rest} onClick={closeTooltip} />;+ })}+ </div>+ </Tooltip.Content>+ </Tooltip.Portal>+ </Tooltip.Root>+ </Tooltip.Provider>+ </span>+ );+});++MultiCitation.displayName = "MultiCitation";++/**+ * Inline citation trigger: a small globe button that opens a pinnable tooltip+ * listing the cited sources.+ */+export const Citation = memo((props: CitationProps) => {+ const { sources } = props;++ if (!sources || sources.length === 0) {+ return null;+ }++ return <MultiCitation {...props} />;+});++Citation.displayName = "Citation";diff --git a/packages/react-ui/src/components/Citation/CitationItem.tsx b/packages/react-ui/src/components/Citation/CitationItem.tsxnew file mode 100644index 000000000..98c89d99e--- /dev/null+++ b/packages/react-ui/src/components/Citation/CitationItem.tsx@@ -0,0 +1,36 @@+import clsx from "clsx";+import { memo } from "react";+import { SourceFaviconImage } from "../SourceFaviconImage";+import { openSourceInNewTab, SourceWithFavicon } from "../Sources/SourceContext";++export interface CitationItemProps extends SourceWithFavicon {+ onClick?: () => void;+}++export const CitationItem = memo((props: CitationItemProps) => {+ const { title, sourceName, onClick, faviconUrl, url } = props;+ const handleClick = () => {+ openSourceInNewTab(url);+ onClick?.();+ };+ const hasUrl = url && url.trim() !== "";+ return (+ <button+ className={clsx("openui-citation-item", {+ "openui-citation-item--has-url": hasUrl,+ })}+ onClick={handleClick}+ type="button"+ >+ <div className="openui-citation-item__logo">+ <SourceFaviconImage url={faviconUrl} alt={sourceName} width={24} height={24} />+ </div>+ <div className="openui-citation-item__content">+ <div className="openui-citation-item__title">{title}</div>+ <div className="openui-citation-item__source">{sourceName}</div>+ </div>+ </button>+ );+});++CitationItem.displayName = "CitationItem";diff --git a/packages/react-ui/src/components/Citation/TextContentCitation.tsx b/packages/react-ui/src/components/Citation/TextContentCitation.tsxnew file mode 100644index 000000000..aa59dcaa6--- /dev/null+++ b/packages/react-ui/src/components/Citation/TextContentCitation.tsx@@ -0,0 +1,57 @@+/**+ * # TextContentCitation+ *+ * Renders inline citations in markdown text. Converts citation markers like [1][2]+ * into interactive Citation components that link to source URLs.+ *+ * **How it works:**+ * 1. Detects spans with `data-component-type="citation"` and `data-citation-indices="1,2"`+ * 2. Looks up sources from CardSourceContext using citation indices (converts 1-indexed to 0-indexed)+ * 3. Filters to only include sources with valid titles/names+ * 4. Renders Citation component, or returns null if no valid sources+ *+ * Wired in as the `span` component of markdown renderers together with the+ * `remarkCitations` plugin - typically not called directly.+ */++import { HTMLAttributes, ReactNode } from "react";+import { SourceWithFavicon, useCardSourceContext } from "../Sources/SourceContext";+import { Citation } from "./Citation";++export type TextContentCitationProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {+ node?: { properties?: Record<string, unknown> };+ children?: ReactNode;+};++export const TextContentCitation = ({ node, children, ...rest }: TextContentCitationProps) => {+ const sources = useCardSourceContext();+ const properties = node?.properties ?? {};+ const componentType = properties["data-component-type"];+ const indicesString = properties["data-citation-indices"] as string | undefined;++ if (componentType !== "citation" || !indicesString) {+ return <span {...rest}>{children}</span>;+ }++ if (!sources.length) {+ return null;+ }++ const indices = indicesString.split(",").map(Number);+ const relevantSources = indices+ .map((idx) => sources[idx - 1])+ .filter((source): source is SourceWithFavicon => source !== undefined)+ .filter(+ (source) =>+ source.sourceName &&+ source.title &&+ source.sourceName.trim() !== "" &&+ source.title.trim() !== "",+ );++ if (relevantSources.length === 0) {+ return null;+ }++ return <Citation sources={relevantSources} />;+};diff --git a/packages/react-ui/src/components/Citation/citation.scss b/packages/react-ui/src/components/Citation/citation.scssnew file mode 100644index 000000000..4695cdebd--- /dev/null+++ b/packages/react-ui/src/components/Citation/citation.scss@@ -0,0 +1,143 @@+@use "../../cssUtils" as cssUtils;+@use "../_shared/chatUtils" as chatUtils;++.openui-citation-container {+ position: relative;+ display: inline-flex;+}++.openui-citation {+ height: 20px;+ width: 20px;+ flex-shrink: 0;+ display: flex;+ align-items: center;+ justify-content: center;+ padding: cssUtils.$space-3xs;+ background-color: cssUtils.$highlight-strong;+ margin-left: cssUtils.$space-3xs;+ border: none;+ border-radius: cssUtils.$radius-xs;+ cursor: pointer;+ transition: all 0.2s ease-in-out;+ svg {+ color: cssUtils.$text-neutral-tertiary;+ }++ &:hover,+ &[data-state="delayed-open"],+ &[data-state="instant-open"] {+ svg {+ color: cssUtils.$text-neutral-primary;+ }+ }++ &:active {+ background-color: cssUtils.$highlight-strong;+ }++ &:focus-visible {+ outline: 2px solid cssUtils.$border-interactive;+ outline-offset: 2px;+ }+}++.openui-citation-tooltip {+ background-color: cssUtils.$foreground;+ border: 1px solid cssUtils.$border-default;+ border-radius: cssUtils.$radius-xl;+ box-shadow: cssUtils.$shadow-s;+ white-space: nowrap;+ color: cssUtils.$text-neutral-primary;+ z-index: chatUtils.$z-popover;+ pointer-events: all;+ overflow: hidden;++ &[data-state="delayed-open"] {+ &[data-side="top"] {+ animation: openui-slide-down-and-fade 0.2s ease-in-out;+ }++ &[data-side="bottom"] {+ animation: openui-slide-up-and-fade 0.2s ease-in-out;+ }++ &[data-side="right"] {+ animation: openui-slide-left-and-fade 0.2s ease-in-out;+ }++ &[data-side="left"] {+ animation: openui-slide-right-and-fade 0.2s ease-in-out;+ }+ }+}++.openui-citation-tooltip__content {+ padding: cssUtils.$space-xs;+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-2xs;+ overflow-y: auto;+ max-height: min(50vh);+ @include chatUtils.scrollbar;+}++.openui-citation-item {+ display: flex;+ align-items: center;+ gap: cssUtils.$space-s;+ border: none;+ padding: cssUtils.$space-xs cssUtils.$space-s cssUtils.$space-xs cssUtils.$space-xs;+ border-radius: cssUtils.$radius-m;+ background-color: transparent;+ transition: background-color 0.2s ease-in-out;+ text-align: left;+ width: 100%;+ max-width: 348px;+ @include cssUtils.typography(label, small);++ @media (max-width: 800px) {+ max-width: 320px;+ }++ &--has-url {+ cursor: pointer;+ &:hover {+ background-color: cssUtils.$sunk;+ }+ }+ &__logo {+ flex-shrink: 0;+ width: 24px;+ height: 24px;+ display: flex;+ align-items: center;+ justify-content: center;+ border: 1px solid cssUtils.$border-default;+ border-radius: cssUtils.$radius-s;+ color: cssUtils.$text-neutral-secondary;+ overflow: hidden;+ }++ &__content {+ display: flex;+ flex-grow: 1;+ align-items: baseline;+ gap: cssUtils.$space-s;+ min-width: 0;+ }++ &__title {+ color: cssUtils.$text-neutral-primary;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }++ &__source {+ color: cssUtils.$text-neutral-secondary;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }+}diff --git a/packages/react-ui/src/components/Citation/index.ts b/packages/react-ui/src/components/Citation/index.tsnew file mode 100644index 000000000..ae2a3c257--- /dev/null+++ b/packages/react-ui/src/components/Citation/index.ts@@ -0,0 +1,6 @@+export { Citation } from "./Citation";+export type { CitationProps } from "./Citation";+export { CitationItem } from "./CitationItem";+export type { CitationItemProps } from "./CitationItem";+export { TextContentCitation } from "./TextContentCitation";+export type { TextContentCitationProps } from "./TextContentCitation";diff --git a/packages/react-ui/src/components/CompositeCardBlock/CompositeCardBlock.tsx b/packages/react-ui/src/components/CompositeCardBlock/CompositeCardBlock.tsxnew file mode 100644index 000000000..fd4272f46--- /dev/null+++ b/packages/react-ui/src/components/CompositeCardBlock/CompositeCardBlock.tsx@@ -0,0 +1,103 @@+import clsx from "clsx";+import { forwardRef, type ReactNode } from "react";+import { CardBlockLayout, cardKeyDownHandler } from "../_shared/cards/CardBlockLayout";++export interface CompositeCardBlockItem {+ id?: string;+ header?: ReactNode;+ body?: ReactNode[];+ footer?: {+ price?: ReactNode;+ button?: ReactNode;+ };+}++export interface CompositeCardProps {+ item: CompositeCardBlockItem;+ clickable?: boolean;+ onClick?: () => void;+ className?: string;+}++/** A bordered card with header, stacked body content and a price/button footer. */+export const CompositeCard = forwardRef<HTMLDivElement, CompositeCardProps>((props, ref) => {+ const { item, clickable = false, onClick, className } = props;+ const { header, body, footer } = item;+ const bodyItems = body ?? [];+ const hasFooter = Boolean(footer?.price || footer?.button);++ return (+ <div className="openui-composite-card__wrapper">+ <div+ ref={ref}+ className={clsx(+ "openui-composite-card",+ clickable ? "openui-composite-card--clickable" : "openui-composite-card--static",+ className,+ )}+ role={clickable ? "button" : undefined}+ tabIndex={clickable ? 0 : undefined}+ onClick={clickable ? onClick : undefined}+ onKeyDown={clickable && onClick ? cardKeyDownHandler(onClick) : undefined}+ >+ {header && <div className="openui-composite-card__header">{header}</div>}++ {bodyItems.length > 0 && <div className="openui-composite-card__body">{bodyItems}</div>}++ {hasFooter && (+ <div className="openui-composite-card__footer">+ <div className="openui-composite-card__footer-content">+ {footer?.price ?? null}+ {footer?.button ?? null}+ </div>+ </div>+ )}+ </div>+ </div>+ );+});++CompositeCard.displayName = "CompositeCard";++export interface CompositeCardBlockProps {+ items: CompositeCardBlockItem[];+ layout?: "grid" | "carousel";+ responsive?: boolean;+ /** Overrides the CSS gap variable (numbers are treated as px). */+ gap?: number | string;+ /** Makes every card focusable/clickable; `onItemClick` receives the item index. */+ clickable?: boolean;+ onItemClick?: (index: number) => void;+ className?: string;+}++/** A two-per-row grid or carousel of CompositeCards. */+export const CompositeCardBlock = forwardRef<HTMLDivElement, CompositeCardBlockProps>(+ (props, ref) => {+ const { items, layout, responsive, gap, clickable = false, onItemClick, className } = props;++ return (+ <CardBlockLayout+ ref={ref}+ size="medium"+ cardType="composite-card"+ data-card-type="CompositeCard"+ items={items}+ layout={layout}+ responsive={responsive}+ maxPerRow={2}+ gap={gap}+ className={className}+ itemKey={(item, index) => {+ const itemId = item.id?.trim();+ return itemId ? `composite-card-${itemId}-${index}` : `composite-card-${index}`;+ }}+ renderItem={(item, index) => (+ <CompositeCard item={item} clickable={clickable} onClick={() => onItemClick?.(index)} />+ )}+ />+ );+ },+);++CompositeCardBlock.displayName = "CompositeCardBlock";diff --git a/packages/react-ui/src/components/CompositeCardBlock/compositeCardBlock.scss b/packages/react-ui/src/components/CompositeCardBlock/compositeCardBlock.scssnew file mode 100644index 000000000..b41830248--- /dev/null+++ b/packages/react-ui/src/components/CompositeCardBlock/compositeCardBlock.scss@@ -0,0 +1,102 @@+@use "../../cssUtils" as cssUtils;++.openui-composite-card__wrapper {+ height: 100%;+}++.openui-composite-card {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-m;+ min-width: 15rem;+ height: 100%;+ padding: cssUtils.$space-m;+ border: 1px solid cssUtils.$border-default;+ border-radius: cssUtils.$radius-3xl;+ box-sizing: border-box;+ background: cssUtils.$sunk-light;++ &--clickable {+ background: cssUtils.$foreground;+ border-color: cssUtils.$border-interactive;+ box-shadow: cssUtils.$shadow-m;+ cursor: pointer;+ transition:+ transform 0.2s ease,+ box-shadow 0.2s ease;++ &:hover {+ transform: scale(0.995);+ box-shadow: none;+ }++ &:focus-visible {+ outline: 2px solid cssUtils.$border-accent;+ outline-offset: 2px;+ }+ }+}++.openui-composite-card__header {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-m;+ flex-shrink: 0;+}++.openui-composite-card__body {+ display: flex;+ flex: 1;+ flex-direction: column;+ gap: cssUtils.$space-m;+ min-height: 0;+}++// Markdown emphasis must follow the surrounding slot's text sizing — the+// markdown renderer pins <strong>/<code> to default-size typography, which+// renders oversized against the cards' small text. font: inherit tracks each+// slot; the medium weight bump keeps bold visibly bold in regular slots.+.openui-composite-card .openui-inline-markdown-renderer {+ strong,+ em {+ font: inherit;+ letter-spacing: inherit;+ }++ strong,+ strong em,+ em strong {+ font-weight: cssUtils.$font-weight-medium;+ }++ em,+ strong em,+ em strong {+ font-style: italic;+ }++ code {+ // Canonical code-sm typography, one step below the cards' body-sm slots.+ // line-height hugs the text so the padded chip box nests inside the+ // surrounding line instead of towering over it.+ @include cssUtils.typography(code, small);+ line-height: 1;+ }+}++.openui-composite-card__footer {+ display: flex;+ flex-shrink: 0;+ margin-top: auto;++ & > * {+ width: 100%;+ }+}++.openui-composite-card__footer-content {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-s;+ width: 100%;+}diff --git a/packages/react-ui/src/components/CompositeCardBlock/index.ts b/packages/react-ui/src/components/CompositeCardBlock/index.tsnew file mode 100644index 000000000..cb881eeea--- /dev/null+++ b/packages/react-ui/src/components/CompositeCardBlock/index.ts@@ -0,0 +1 @@+export * from "./CompositeCardBlock";diff --git a/packages/react-ui/src/components/ContextCardBlock/ContextCardBlock.tsx b/packages/react-ui/src/components/ContextCardBlock/ContextCardBlock.tsxnew file mode 100644index 000000000..1a3bf516f--- /dev/null+++ b/packages/react-ui/src/components/ContextCardBlock/ContextCardBlock.tsx@@ -0,0 +1,120 @@+import clsx from "clsx";+import { ChevronRight } from "lucide-react";+import { forwardRef, type ReactNode } from "react";+import { InlineMarkdownRenderer } from "../InlineMarkdownRenderer";+import { CardBlockLayout, cardKeyDownHandler } from "../_shared/cards/CardBlockLayout";+import { toCssUrl } from "../_shared/utils";++export type ContextCardBgColor = "gray" | "info" | "success" | "warning" | "danger";++export interface ContextCardBlockItem {+ id?: string;+ /** Plain string renders as small title text; any other node (e.g. a Tag) renders in the tag slot. */+ title?: ReactNode;+ /** Inline markdown supported. */+ body?: string;+ bgColor?: ContextCardBgColor;+ bgImageSrc?: string;+ /** Alt text for the background image. */+ bgImageAlt?: string;+}++export interface ContextCardProps {+ item: ContextCardBlockItem;+ clickable?: boolean;+ onClick?: () => void;+ className?: string;+}++/** A compact tinted card with a title (text or tag) and a bold markdown body. */+export const ContextCard = forwardRef<HTMLDivElement, ContextCardProps>((props, ref) => {+ const { item, clickable = false, onClick, className } = props;+ const { title, body, bgColor, bgImageSrc, bgImageAlt } = item;+ const backgroundImage = toCssUrl(bgImageSrc);+ const variant = backgroundImage ? "image" : bgColor;++ const titleContent =+ title == null || title === "" ? null : typeof title === "string" ? (+ <span className="openui-context-card__title-text">{title}</span>+ ) : (+ <div className="openui-context-card__tag-wrapper">+ <div className="openui-context-card__tag">{title}</div>+ </div>+ );++ return (+ <div+ ref={ref}+ className={clsx(+ "openui-context-card",+ clickable ? "openui-context-card--clickable" : "openui-context-card--static",+ variant && `openui-context-card--variant-${variant}`,+ className,+ )}+ style={backgroundImage ? { backgroundImage } : undefined}+ aria-label={backgroundImage ? bgImageAlt : undefined}+ role={clickable ? "button" : undefined}+ tabIndex={clickable ? 0 : undefined}+ onClick={clickable ? onClick : undefined}+ onKeyDown={clickable && onClick ? cardKeyDownHandler(onClick) : undefined}+ >+ <div className="openui-context-card__vertical">+ <div className="openui-context-card__slot openui-context-card__slot--top">+ {titleContent}+ {clickable && (+ <div className="openui-context-card__chevron" aria-hidden="true">+ <ChevronRight size={16} />+ </div>+ )}+ </div>+ {body && (+ <div className="openui-context-card__slot openui-context-card__slot--bottom">+ <div className="openui-context-card__body-text">+ <InlineMarkdownRenderer content={body} />+ </div>+ </div>+ )}+ </div>+ </div>+ );+});++ContextCard.displayName = "ContextCard";++export interface ContextCardBlockProps {+ items: ContextCardBlockItem[];+ layout?: "grid" | "carousel";+ responsive?: boolean;+ /** Overrides the CSS gap variable (numbers are treated as px). */+ gap?: number | string;+ /** Makes every card focusable/clickable; `onItemClick` receives the item index. */+ clickable?: boolean;+ onItemClick?: (index: number) => void;+ className?: string;+}++/** A grid or carousel of ContextCards (uses the small card block layout). */+export const ContextCardBlock = forwardRef<HTMLDivElement, ContextCardBlockProps>((props, ref) => {+ const { items, layout, responsive, gap, clickable = false, onItemClick, className } = props;++ return (+ <CardBlockLayout+ ref={ref}+ size="small"+ cardType="context-card"+ data-card-type="ContextCard"+ items={items}+ layout={layout}+ responsive={responsive}+ maxPerRow={3}+ gap={gap}+ className={className}+ itemKey={(item, index) => item.id ?? `context-card-${index}`}+ renderItem={(item, index) => (+ <ContextCard item={item} clickable={clickable} onClick={() => onItemClick?.(index)} />+ )}+ />+ );+});++ContextCardBlock.displayName = "ContextCardBlock";diff --git a/packages/react-ui/src/components/ContextCardBlock/contextCardBlock.scss b/packages/react-ui/src/components/ContextCardBlock/contextCardBlock.scssnew file mode 100644index 000000000..0ebc21c61--- /dev/null+++ b/packages/react-ui/src/components/ContextCardBlock/contextCardBlock.scss@@ -0,0 +1,205 @@+@use "../../cssUtils" as cssUtils;+@use "../_shared/chatUtils" as chatUtils;++.openui-context-card {+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ width: 100%;+ min-width: 196px;+ padding: cssUtils.$space-m;+ border: none;+ border-radius: cssUtils.$radius-xl;+ box-sizing: border-box;+ overflow: hidden;+ position: relative;+ transition:+ background-color 0.2s ease,+ box-shadow 0.2s ease,+ transform 0.2s ease;++ &--clickable {+ background-color: cssUtils.$highlight;+ cursor: pointer;++ &:hover {+ transform: scale(0.995);+ }++ &:focus-visible {+ outline: 2px solid cssUtils.$border-accent;+ outline-offset: 2px;+ }+ }++ &--static {+ background-color: cssUtils.$highlight-subtle;+ box-shadow: none;+ }++ &--variant-gray {+ background-color: cssUtils.$highlight;+ color: cssUtils.$text-neutral-primary;+ }++ &--variant-info {+ background-color: cssUtils.$info-background;+ color: cssUtils.$text-info-primary;++ .openui-context-card__title-text {+ color: cssUtils.$text-info-primary;+ opacity: 0.8;+ }++ .openui-context-card__body-text {+ color: cssUtils.$text-info-primary;+ }++ .openui-context-card__tag {+ background-color: cssUtils.$elevated;+ }+ }++ &--variant-success {+ background-color: cssUtils.$success-background;+ color: cssUtils.$text-success-primary;++ .openui-context-card__title-text {+ color: cssUtils.$text-success-primary;+ opacity: 0.8;+ }++ .openui-context-card__body-text {+ color: cssUtils.$text-success-primary;+ }++ .openui-context-card__tag {+ background-color: cssUtils.$elevated;+ }+ }++ &--variant-warning {+ background-color: cssUtils.$alert-background;+ color: cssUtils.$text-alert-primary;++ .openui-context-card__title-text {+ color: cssUtils.$text-alert-primary;+ opacity: 0.8;+ }++ .openui-context-card__body-text {+ color: cssUtils.$text-alert-primary;+ }++ .openui-context-card__tag {+ background-color: cssUtils.$elevated;+ }+ }++ &--variant-danger {+ background-color: cssUtils.$danger-background;+ color: cssUtils.$text-danger-primary;++ .openui-context-card__title-text {+ color: cssUtils.$text-danger-primary;+ opacity: 0.8;+ }++ .openui-context-card__body-text {+ color: cssUtils.$text-danger-primary;+ }++ .openui-context-card__tag {+ background-color: cssUtils.$elevated;+ }+ }++ &--variant-image {+ background-position: center;+ background-size: cover;+ color: cssUtils.$text-white;++ .openui-context-card__title-text {+ color: cssUtils.$text-white;+ opacity: 0.6;+ }++ .openui-context-card__tag .openui-tag {+ background-color: rgb(0 0 0 / 40%);+ color: cssUtils.$text-white;+ backdrop-filter: blur(2px);+ -webkit-backdrop-filter: blur(2px);+ }++ &::before {+ content: "";+ position: absolute;+ inset: 0;+ background: cssUtils.$overlay;+ z-index: chatUtils.$z-content;+ }++ & > * {+ position: relative;+ z-index: chatUtils.$z-content-elevated;+ }+ }+}++.openui-context-card__vertical {+ display: flex;+ flex: 1;+ flex-direction: column;+ justify-content: space-between;+ min-width: 0;+ height: 100%;+ gap: cssUtils.$space-l;+}++.openui-context-card__slot {+ width: 100%;+ border-radius: cssUtils.$radius-m;+}++.openui-context-card__slot--top {+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ gap: cssUtils.$space-s;+ min-height: cssUtils.$space-xl;+}++.openui-context-card__slot--bottom {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-2xs;+}++.openui-context-card__title-text {+ @include cssUtils.typography(body, small);+ color: cssUtils.$text-neutral-secondary;+}++.openui-context-card__body-text {+ @include cssUtils.typography(body, heavy);+}++.openui-context-card__chevron {+ display: flex;+ align-items: center;+ justify-content: center;+ flex-shrink: 0;+ color: currentColor;+ opacity: 0.7;+}++.openui-context-card__tag-wrapper {+ display: flex;+ align-items: center;+ width: 100%;+ pointer-events: none;+}++.openui-context-card__tag {+ border: none;+}diff --git a/packages/react-ui/src/components/ContextCardBlock/index.ts b/packages/react-ui/src/components/ContextCardBlock/index.tsnew file mode 100644index 000000000..befb5db3c--- /dev/null+++ b/packages/react-ui/src/components/ContextCardBlock/index.ts@@ -0,0 +1 @@+export * from "./ContextCardBlock";diff --git a/packages/react-ui/src/components/DatePicker/helpers/components/floatingDatePickerRenderer.scss b/packages/react-ui/src/components/DatePicker/helpers/components/floatingDatePickerRenderer.scssindex ca62c4734..88476d80a 100644--- a/packages/react-ui/src/components/DatePicker/helpers/components/floatingDatePickerRenderer.scss+++ b/packages/react-ui/src/components/DatePicker/helpers/components/floatingDatePickerRenderer.scss@@ -23,7 +23,7 @@border-radius: cssUtils.$radius-m;background: cssUtils.$sunk;padding: cssUtils.$space-s cssUtils.$space-m;- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);color: cssUtils.$text-neutral-primary;cursor: pointer;box-shadow: cssUtils.$shadow-s;diff --git a/packages/react-ui/src/components/DatePicker/helpers/utils/datePickerBaseStyle.scss b/packages/react-ui/src/components/DatePicker/helpers/utils/datePickerBaseStyle.scssindex ffa91dfcf..f5482642a 100644--- a/packages/react-ui/src/components/DatePicker/helpers/utils/datePickerBaseStyle.scss+++ b/packages/react-ui/src/components/DatePicker/helpers/utils/datePickerBaseStyle.scss@@ -4,7 +4,7 @@--openui-date-picker-day-size: calc(#{cssUtils.$space-2xl} + #{cssUtils.$space-2xs});--openui-date-picker-cell-radius: #{cssUtils.$radius-m};- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);width: fit-content;max-width: 100%;box-sizing: border-box;diff --git a/packages/react-ui/src/components/EditableTable/EditableTable.tsx b/packages/react-ui/src/components/EditableTable/EditableTable.tsxnew file mode 100644index 000000000..d7e9baabf--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/EditableTable.tsx@@ -0,0 +1,493 @@+import {+ Column,+ ColumnDef,+ createColumnHelper,+ flexRender,+ getCoreRowModel,+ Row,+ Table,+ useReactTable,+} from "@tanstack/react-table";+import clsx from "clsx";+import {+ CalendarDays,+ Check,+ ChevronLeft,+ ChevronRight,+ Link,+ List,+ RotateCcw,+ Type,+} from "lucide-react";+import React, { useCallback, useEffect, useRef, useState } from "react";+import { Button } from "../Button";+import { IconButton } from "../IconButton";+import { getCellRenderer } from "./base/components/cellRegistry";+import type {+ EditableCellNavigateDirection,+ EditableCellType,+ EditableColumnMeta,+ EditableTableMeta,+} from "./base/components/CellTypes";++export type { EditableCellType } from "./base/components/CellTypes";++export interface EditableTableRow {+ id: string;+ [key: string]: any;+}++export interface EditableTableColumn {+ key: string;+ header: string;+ type?: EditableCellType;+ width?: number;+ /** Options for `select` type cells */+ options?: Array<{ value: string; label: string }>;+}++export interface EditableTableProps {+ data: EditableTableRow[];+ columns: EditableTableColumn[];+ onDataChange?: (data: EditableTableRow[]) => void;+ className?: string;+}++interface CellPosition {+ row: number;+ column: string;+}++interface CellRendererProps {+ row: Row<EditableTableRow>;+ column: Column<EditableTableRow>;+ columns: EditableTableColumn[];+ selectedPosition: CellPosition | null;+ editingPosition: CellPosition | null;+ handleCellSelect: (rowIndex: number, columnId: string) => void;+ handleStartEdit: (rowIndex: number, columnId: string) => void;+ handleFinishEdit: (save: boolean) => void;+ handleNavigate: (direction: EditableCellNavigateDirection) => void;+ table: Table<EditableTableRow>;+ getValue: () => any;+}++const CellRenderer = (info: CellRendererProps) => {+ const colKey = info.column.id;+ const colConfig = info.columns.find((c) => c.key === colKey);+ const type = (colConfig?.type || "text") as EditableCellType;+ const CellCmp = getCellRenderer(type);+ const rowIndex = info.row.index;+ const columnId = colKey;+ const isSelected =+ info.selectedPosition?.row === rowIndex && info.selectedPosition?.column === columnId;+ const isEditing =+ info.editingPosition?.row === rowIndex && info.editingPosition?.column === columnId;++ return (+ <CellCmp+ value={info.getValue()}+ rowIndex={rowIndex}+ columnId={columnId}+ isSelected={isSelected}+ isEditing={isEditing}+ onSelect={info.handleCellSelect}+ onStartEdit={info.handleStartEdit}+ onFinishEdit={info.handleFinishEdit}+ onNavigate={info.handleNavigate}+ table={info.table}+ />+ );+};++const headerIcon = (type: EditableCellType) => {+ switch (type) {+ case "url":+ return <Link size={16} />;+ case "date-single":+ return <CalendarDays size={16} />;+ case "select":+ return <List size={16} />;+ case "text":+ case "number":+ default:+ return <Type size={16} />;+ }+};++const PORTAL_CELL_TYPES: EditableCellType[] = ["date-single", "select"];++/**+ * Spreadsheet-like editable grid built on @tanstack/react-table. Cells are+ * selected with a click / keyboard and edited inline according to the column+ * `type` (text, number, url, date-single, select).+ */+export const EditableTable = React.forwardRef<HTMLDivElement, EditableTableProps>(+ ({ data, columns, onDataChange, className }, ref) => {+ const [selectedPosition, setSelectedPosition] = useState<CellPosition | null>(null);+ const [editingPosition, setEditingPosition] = useState<+ (CellPosition & { cellType: EditableCellType }) | null+ >(null);+ const tableRef = useRef<HTMLDivElement>(null);+ const scrollContainerRef = useRef<HTMLDivElement>(null);+ /**+ * Horizontal scroll controls state+ * - isScrollable: whether content overflows horizontally+ * - canScrollLeft/canScrollRight: whether there is hidden content in that direction+ * - columnLefts: cumulative left offsets of header cells relative to the scroll container+ * Used to snap scrolling by exactly one column at a time.+ */+ const [isScrollable, setIsScrollable] = useState(false);+ const [canScrollLeft, setCanScrollLeft] = useState(false);+ const [canScrollRight, setCanScrollRight] = useState(false);+ const [columnLefts, setColumnLefts] = useState<number[]>([]);++ React.useImperativeHandle(ref, () => tableRef.current as HTMLDivElement);++ const updateData = useCallback(+ (rowIndex: number, columnId: string, value: unknown) => {+ const oldRow = data[rowIndex];+ if (!oldRow) return;+ const newData = [...data];+ newData[rowIndex] = { ...oldRow, [columnId]: value };+ onDataChange?.(newData);+ },+ [data, onDataChange],+ );++ const handleCellSelect = useCallback((rowIndex: number, columnId: string) => {+ setSelectedPosition({ row: rowIndex, column: columnId });+ setEditingPosition(null);+ }, []);++ const handleStartEdit = useCallback(+ (rowIndex: number, columnId: string) => {+ const cellType = columns.find((col) => col.key === columnId)?.type ?? "text";++ setSelectedPosition({ row: rowIndex, column: columnId });+ setEditingPosition({ row: rowIndex, column: columnId, cellType });+ },+ [columns],+ );++ const handleFinishEdit = useCallback((_save: boolean) => {+ // Keep the cell selected after editing+ setEditingPosition(null);+ }, []);++ const handleNavigate = useCallback(+ (direction: EditableCellNavigateDirection) => {+ if (!selectedPosition) return;++ const { row, column } = selectedPosition;+ const columnIndex = columns.findIndex((col) => col.key === column);++ let newRow = row;+ let newColumnIndex = columnIndex;++ switch (direction) {+ case "up":+ newRow = Math.max(0, row - 1);+ break;+ case "down":+ newRow = Math.min(data.length - 1, row + 1);+ break;+ case "left":+ newColumnIndex = Math.max(0, columnIndex - 1);+ break;+ case "right":+ newColumnIndex = Math.min(columns.length - 1, columnIndex + 1);+ break;+ }++ const newColumn = columns[newColumnIndex]?.key || column;+ setSelectedPosition({ row: newRow, column: newColumn });+ setEditingPosition(null);+ },+ [selectedPosition, columns, data.length],+ );++ // Handle table-level keyboard events+ useEffect(() => {+ const handleTableKeyDown = (e: KeyboardEvent) => {+ // Only handle if no cell is focused and we're not editing+ if (!editingPosition && document.activeElement === tableRef.current) {+ if (e.key === "Tab") {+ e.preventDefault();+ // Focus first cell if nothing is selected+ if (!selectedPosition && data.length > 0 && columns.length > 0) {+ const firstColumn = columns[0];+ if (firstColumn) {+ setSelectedPosition({ row: 0, column: firstColumn.key });+ }+ }+ }+ }+ };++ const tableElement = tableRef.current;+ if (tableElement) {+ tableElement.addEventListener("keydown", handleTableKeyDown);+ return () => {+ tableElement.removeEventListener("keydown", handleTableKeyDown);+ };+ }++ return undefined;+ }, [editingPosition, selectedPosition, data.length, columns]);++ // Handle click outside table to deselect+ useEffect(() => {+ const handleClickOutside = (event: MouseEvent) => {+ const isPortalCellEditing =+ editingPosition?.cellType && PORTAL_CELL_TYPES.includes(editingPosition.cellType);++ if (+ tableRef.current &&+ !tableRef.current.contains(event.target as Node) &&+ !isPortalCellEditing+ ) {+ // Clear selections - the blur event will handle saving any active edits+ setSelectedPosition(null);+ setEditingPosition(null);+ }+ };+ document.addEventListener("click", handleClickOutside);+ return () => {+ document.removeEventListener("click", handleClickOutside);+ };+ }, [editingPosition?.cellType]);++ const columnHelper = createColumnHelper<EditableTableRow>();++ const tableColumns: ColumnDef<EditableTableRow>[] = columns.map((col) =>+ columnHelper.accessor(col.key, {+ header: col.header,+ minSize: 0,+ size: col.width || 120,+ meta: (col.options+ ? { options: col.options, type: col.type }+ : { type: col.type }) satisfies EditableColumnMeta,+ }),+ );++ const table = useReactTable({+ data,+ columns: tableColumns,+ getCoreRowModel: getCoreRowModel(),+ meta: { updateData } satisfies EditableTableMeta,+ });++ const headerIconForColumn = useCallback((column: Column<EditableTableRow>) => {+ const type = (column.columnDef.meta as EditableColumnMeta | undefined)?.type;+ return type ? headerIcon(type) : null;+ }, []);++ /**+ * Measure scrollability and header column positions.+ * - Recomputes on container resize via ResizeObserver+ * - Updates button enabled/disabled state on scroll+ * - Computes `columnLefts` by reading each <th> left position relative to the scroll container+ */+ useEffect(() => {+ const container = scrollContainerRef.current;+ const wrapper = tableRef.current;+ if (!container || !wrapper) return;++ const updateScrollButtons = () => {+ setCanScrollLeft(container.scrollLeft > 0);+ setCanScrollRight(container.scrollLeft < container.scrollWidth - container.clientWidth - 1);+ };++ const compute = () => {+ setIsScrollable(container.scrollWidth > container.clientWidth);+ updateScrollButtons();++ // Measure header cell left positions relative to the scroll container+ const ths = wrapper.querySelectorAll<HTMLTableCellElement>("thead th");+ if (!ths || ths.length === 0) {+ setColumnLefts([]);+ return;+ }+ const containerRect = container.getBoundingClientRect();+ const lefts: number[] = [];+ ths.forEach((th) => {+ const rect = th.getBoundingClientRect();+ const left = rect.left - containerRect.left + container.scrollLeft;+ lefts.push(Math.max(0, Math.round(left)));+ });+ // Ensure unique and sorted+ setColumnLefts(Array.from(new Set(lefts)).sort((a, b) => a - b));+ };++ compute();++ const ro = new ResizeObserver(() => compute());+ ro.observe(container);+ container.addEventListener("scroll", updateScrollButtons);++ return () => {+ ro.disconnect();+ container.removeEventListener("scroll", updateScrollButtons);+ };+ }, [columns, data]);++ /**+ * Scroll right to the start of the next column that is not fully visible.+ * If no next column is found, scrolls to the maximum possible scroll position.+ */+ const scrollToNextColumn = useCallback(() => {+ const container = scrollContainerRef.current;+ if (!container || columnLefts.length === 0) return;+ const current = container.scrollLeft;+ const target = columnLefts.find((l) => l > current + 1);+ const maxScroll = container.scrollWidth - container.clientWidth;+ const next = typeof target === "number" ? target : maxScroll;+ container.scrollTo({ left: Math.min(next, maxScroll), behavior: "smooth" });+ }, [columnLefts]);++ /**+ * Scroll left to the start of the previous column.+ * Picks the nearest stored left offset smaller than current scrollLeft.+ */+ const scrollToPrevColumn = useCallback(() => {+ const container = scrollContainerRef.current;+ if (!container || columnLefts.length === 0) return;+ const current = container.scrollLeft;+ const prevs = columnLefts.filter((l) => l < current - 1);+ const prev = prevs.at(-1) ?? 0;+ container.scrollTo({ left: Math.max(0, prev), behavior: "smooth" });+ }, [columnLefts]);++ return (+ <div className={clsx("openui-editable-table-wrapper", className)} ref={tableRef} tabIndex={0}>+ {isScrollable && (+ <>+ <div+ className={clsx(+ "openui-editable-table-scroll-control",+ "openui-editable-table-scroll-control--left",+ !canScrollLeft && "openui-editable-table-scroll-control--disabled",+ )}+ >+ <IconButton+ aria-label="Scroll left"+ size="small"+ variant="secondary"+ onClick={scrollToPrevColumn}+ disabled={!canScrollLeft}+ icon={<ChevronLeft size={16} />}+ />+ </div>+ <div+ className={clsx(+ "openui-editable-table-scroll-control",+ "openui-editable-table-scroll-control--right",+ !canScrollRight && "openui-editable-table-scroll-control--disabled",+ )}+ >+ <IconButton+ aria-label="Scroll right"+ size="small"+ variant="secondary"+ onClick={scrollToNextColumn}+ disabled={!canScrollRight}+ icon={<ChevronRight size={16} />}+ />+ </div>+ </>+ )}+ <div className="openui-editable-table-scroll-container" ref={scrollContainerRef}>+ <table+ className="openui-editable-table-table"+ style={{ width: isScrollable ? "max-content" : "100%" }}+ >+ <thead>+ {table.getHeaderGroups().map((headerGroup) => (+ <tr key={headerGroup.id}>+ {headerGroup.headers.map((header) => (+ <th key={header.id} style={{ width: header.getSize() }}>+ <div className="openui-editable-table-header-container">+ {header.isPlaceholder+ ? null+ : flexRender(header.column.columnDef.header, header.getContext())}+ <div className="openui-editable-table-header-icon">+ {headerIconForColumn(header.column)}+ </div>+ </div>+ </th>+ ))}+ </tr>+ ))}+ </thead>+ <tbody>+ {table.getRowModel().rows.map((row) => (+ <tr key={row.id}>+ {row.getVisibleCells().map((cell) => (+ <td key={cell.id} style={{ width: cell.column.getSize() }}>+ {flexRender(CellRenderer, {+ ...cell.getContext(),+ columns,+ selectedPosition,+ editingPosition,+ handleCellSelect,+ handleStartEdit,+ handleFinishEdit,+ handleNavigate,+ })}+ </td>+ ))}+ </tr>+ ))}+ </tbody>+ </table>+ </div>+ </div>+ );+ },+);++EditableTable.displayName = "EditableTable";++export interface EditableTableChangesBarProps {+ /** Number of cells changed since the last save/reset */+ changedCellCount: number;+ onReset?: () => void;+ onSave?: () => void;+ resetLabel?: string;+ saveLabel?: string;+ className?: string;+}++/**+ * Pending-changes summary bar shown beneath an EditableTable, with reset / save actions.+ * Renders nothing when `changedCellCount` is 0.+ */+export const EditableTableChangesBar = ({+ changedCellCount,+ onReset,+ onSave,+ resetLabel = "Reset",+ saveLabel = "Save Changes",+ className,+}: EditableTableChangesBarProps) => {+ if (changedCellCount <= 0) return null;+ return (+ <div className={clsx("openui-editable-table-changes-container", className)}>+ <div className="openui-editable-table-changes-count">{changedCellCount} changes made</div>+ <div className="openui-editable-table-changes-buttons">+ <Button+ onClick={onReset}+ variant="secondary"+ size="small"+ iconLeft={<RotateCcw size={16} />}+ >+ {resetLabel}+ </Button>+ <Button onClick={onSave} variant="primary" size="small" iconLeft={<Check size={16} />}>+ {saveLabel}+ </Button>+ </div>+ </div>+ );+};diff --git a/packages/react-ui/src/components/EditableTable/base/components/CellOutline.tsx b/packages/react-ui/src/components/EditableTable/base/components/CellOutline.tsxnew file mode 100644index 000000000..f17459ad4--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/CellOutline.tsx@@ -0,0 +1,28 @@+import clsx from "clsx";+import React from "react";++export interface CellOutlineProps {+ isSelected: boolean;+ isEditing: boolean;+}++const SIDES = ["top", "bottom", "left", "right"] as const;++export const CellOutline: React.FC<CellOutlineProps> = ({ isSelected, isEditing }) => {+ return (+ <>+ {SIDES.map((side) => (+ <div+ key={side}+ className={clsx(+ `openui-editable-table-cell-outline-${side}`,+ isSelected && `openui-editable-table-cell-outline-${side}-selected`,+ isEditing && `openui-editable-table-cell-outline-${side}-editing`,+ )}+ />+ ))}+ </>+ );+};++export default CellOutline;diff --git a/packages/react-ui/src/components/EditableTable/base/components/CellTypes.ts b/packages/react-ui/src/components/EditableTable/base/components/CellTypes.tsnew file mode 100644index 000000000..df137c1b0--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/CellTypes.ts@@ -0,0 +1,27 @@+import type { Table } from "@tanstack/react-table";++export type EditableCellType = "text" | "number" | "date-single" | "select" | "url";++export interface EditableTableMeta {+ updateData: (rowIndex: number, columnId: string, value: unknown) => void;+}++export interface EditableColumnMeta {+ type?: EditableCellType;+ options?: Array<{ value: string; label: string }>;+}++export type EditableCellNavigateDirection = "up" | "down" | "left" | "right";++export interface CellRendererProps {+ value: any;+ rowIndex: number;+ columnId: string;+ isSelected: boolean;+ isEditing: boolean;+ onSelect: (rowIndex: number, columnId: string) => void;+ onStartEdit: (rowIndex: number, columnId: string) => void;+ onFinishEdit: (save: boolean) => void;+ onNavigate: (direction: EditableCellNavigateDirection) => void;+ table: Table<any>;+}diff --git a/packages/react-ui/src/components/EditableTable/base/components/EditableDateCell.tsx b/packages/react-ui/src/components/EditableTable/base/components/EditableDateCell.tsxnew file mode 100644index 000000000..c40f7b92c--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/EditableDateCell.tsx@@ -0,0 +1,131 @@+import React, { useCallback, useEffect, useRef, useState } from "react";+import { DatePicker } from "../../../DatePicker";+import { useEditableCellKeyboard } from "../hooks/useEditableCellKeyboard";+import { CellOutline } from "./CellOutline";+import type { CellRendererProps, EditableTableMeta } from "./CellTypes";++/** Table cells store dates as ISO strings; parse them back for the picker. */+function toDate(value: unknown): Date | undefined {+ if (value instanceof Date) return value;+ if (typeof value !== "string" && typeof value !== "number") return undefined;+ const d = new Date(value);+ return Number.isNaN(d.getTime()) ? undefined : d;+}++export const EditableDateCell: React.FC<CellRendererProps> = (props) => {+ const {+ value,+ rowIndex,+ columnId,+ isSelected,+ isEditing,+ onSelect,+ onStartEdit,+ onFinishEdit,+ onNavigate,+ table,+ } = props;++ const [editDate, setEditDate] = useState<Date | undefined>(toDate(value));+ const cellRef = useRef<HTMLDivElement>(null);+ const updateTableData = (table.options.meta as EditableTableMeta | undefined)?.updateData;++ useEffect(() => {+ if (!isEditing) setEditDate(toDate(value));+ }, [value, isEditing]);++ useEffect(() => {+ if (isSelected && !isEditing && cellRef.current) {+ cellRef.current.focus();+ }+ }, [isSelected, isEditing]);++ const handleCancel = useCallback(() => {+ setEditDate(toDate(value));+ onFinishEdit(false);+ }, [value, onFinishEdit]);++ const { handleKeyDown } = useEditableCellKeyboard({+ isEditing,+ isSelected,+ rowIndex,+ columnId,+ onNavigate,+ onStartEdit,+ // DatePicker handles saving itself+ onSave: () => {},+ onCancel: handleCancel,+ });++ // When DatePicker is open, intercept Tab/Enter/Escape similar to the Select cell+ const handleKeyDownWithPicker = useCallback(+ (e: React.KeyboardEvent) => {+ if (isEditing) {+ switch (e.key) {+ case "Tab":+ e.preventDefault();+ e.stopPropagation();+ onNavigate(e.shiftKey ? "left" : "right");+ return;+ case "Enter":+ e.preventDefault();+ e.stopPropagation();+ onNavigate("down");+ return;+ case "Escape":+ e.preventDefault();+ e.stopPropagation();+ handleCancel();+ return;+ }+ }+ handleKeyDown(e);+ },+ [isEditing, handleCancel, onNavigate, handleKeyDown],+ );++ const handleClick = (e: React.MouseEvent) => {+ if (isEditing) {+ return;+ }+ e.stopPropagation();+ if (!isSelected) {+ onSelect(rowIndex, columnId);+ } else {+ onStartEdit(rowIndex, columnId);+ }+ };++ const handleDateChange = (date: Date | undefined) => {+ setEditDate(date);+ // Auto-save on date selection+ updateTableData?.(rowIndex, columnId, date?.toISOString());+ onFinishEdit(true);+ };++ return (+ <div+ ref={cellRef}+ className="openui-editable-table-cell-base"+ onClickCapture={handleClick}+ onKeyDown={handleKeyDownWithPicker}+ tabIndex={0}+ style={{ outline: "none" }}+ >+ <CellOutline isSelected={isSelected} isEditing={isEditing} />+ <DatePicker+ selectedSingleDate={editDate}+ setSelectedSingleDate={handleDateChange}+ mode="single"+ isOpen={isEditing}+ setIsOpen={(isOpen) => {+ if (!isOpen) {+ onFinishEdit(true);+ }+ }}+ />+ </div>+ );+};++export default EditableDateCell;diff --git a/packages/react-ui/src/components/EditableTable/base/components/EditableNumberCell.tsx b/packages/react-ui/src/components/EditableTable/base/components/EditableNumberCell.tsxnew file mode 100644index 000000000..2e5c239df--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/EditableNumberCell.tsx@@ -0,0 +1,17 @@+import React from "react";+import type { CellRendererProps } from "./CellTypes";+import { TextBaseEditableCell } from "./TextBaseEditableCell";++export const EditableNumberCell: React.FC<CellRendererProps> = (props) => (+ <TextBaseEditableCell+ {...props}+ inputType="number"+ parseOnSave={(raw) => {+ const parsed = parseFloat(raw);+ return Number.isFinite(parsed) ? parsed : 0;+ }}+ renderDisplay={(value) => (value === undefined || value === null ? "" : String(value))}+ />+);++export default EditableNumberCell;diff --git a/packages/react-ui/src/components/EditableTable/base/components/EditableSelectCell.tsx b/packages/react-ui/src/components/EditableTable/base/components/EditableSelectCell.tsxnew file mode 100644index 000000000..7d3fdfc2d--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/EditableSelectCell.tsx@@ -0,0 +1,140 @@+import React, { useCallback, useEffect, useRef, useState } from "react";+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../Select";+import { useEditableCellKeyboard } from "../hooks/useEditableCellKeyboard";+import { CellOutline } from "./CellOutline";+import type { CellRendererProps, EditableColumnMeta, EditableTableMeta } from "./CellTypes";++export const EditableSelectCell: React.FC<CellRendererProps> = (props) => {+ const {+ value,+ rowIndex,+ columnId,+ isSelected,+ isEditing,+ onSelect,+ onStartEdit,+ onFinishEdit,+ onNavigate,+ table,+ } = props;++ const [editValue, setEditValue] = useState<string>((value as string) || "");+ const cellRef = useRef<HTMLDivElement>(null);++ // Get options from column definition through table instance+ const column = table.getColumn(columnId);+ const options = (column?.columnDef?.meta as EditableColumnMeta | undefined)?.options ?? [];+ const updateTableData = (table.options.meta as EditableTableMeta | undefined)?.updateData;++ useEffect(() => {+ if (!isEditing) setEditValue((value as string) || "");+ }, [value, isEditing]);++ useEffect(() => {+ if (isSelected && !isEditing && cellRef.current) {+ cellRef.current.focus();+ }+ }, [isSelected, isEditing]);++ const handleSave = useCallback(() => {+ updateTableData?.(rowIndex, columnId, editValue);+ onFinishEdit(true);+ }, [editValue, rowIndex, columnId, updateTableData, onFinishEdit]);++ const handleCancel = useCallback(() => {+ setEditValue((value as string) || "");+ onFinishEdit(false);+ }, [value, onFinishEdit]);++ const { handleKeyDown } = useEditableCellKeyboard({+ isEditing,+ isSelected,+ rowIndex,+ columnId,+ onNavigate,+ onStartEdit,+ onSave: handleSave,+ onCancel: handleCancel,+ });++ // When Select is open and in editing mode, intercept certain keys+ const handleKeyDownWithSelect = useCallback(+ (e: React.KeyboardEvent) => {+ if (isEditing) {+ switch (e.key) {+ case "Tab":+ e.preventDefault();+ e.stopPropagation();+ handleSave();+ onNavigate(e.shiftKey ? "left" : "right");+ return;+ case "Escape":+ e.preventDefault();+ e.stopPropagation();+ handleCancel();+ return;+ }+ }+ handleKeyDown(e);+ },+ [isEditing, handleSave, handleCancel, onNavigate, handleKeyDown],+ );++ const handleClick = () => {+ if (!isSelected && !isEditing) {+ onSelect(rowIndex, columnId);+ } else if (isSelected && !isEditing) {+ onStartEdit(rowIndex, columnId);+ }+ };++ const handleValueChange = (newValue: string) => {+ setEditValue(newValue);+ // Save and finish editing on selection+ updateTableData?.(rowIndex, columnId, newValue);+ onFinishEdit(true);+ };++ // Handle when Select closes without selecting+ const handleOpenChange = (open: boolean) => {+ if (!open && isEditing) {+ onFinishEdit(false);+ }+ };++ return (+ <div+ ref={cellRef}+ className="openui-editable-table-cell-base"+ onClick={handleClick}+ onKeyDown={handleKeyDownWithSelect}+ tabIndex={0}+ style={{ outline: "none" }}+ >+ <CellOutline isSelected={isSelected} isEditing={isEditing} />+ <Select+ value={editValue}+ onValueChange={handleValueChange}+ open={isEditing}+ onOpenChange={handleOpenChange}+ >+ <SelectTrigger className="openui-editable-table-select-trigger">+ <SelectValue placeholder="Select an option" />+ </SelectTrigger>+ <SelectContent>+ {options.map((option) => (+ <SelectItem+ key={option.value}+ value={option.value}+ className="openui-editable-table-select-item"+ >+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>+ );+};++export default EditableSelectCell;diff --git a/packages/react-ui/src/components/EditableTable/base/components/EditableTextCell.tsx b/packages/react-ui/src/components/EditableTable/base/components/EditableTextCell.tsxnew file mode 100644index 000000000..8464638de--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/EditableTextCell.tsx@@ -0,0 +1,9 @@+import React from "react";+import type { CellRendererProps } from "./CellTypes";+import { TextBaseEditableCell } from "./TextBaseEditableCell";++export const EditableTextCell: React.FC<CellRendererProps> = (props) => (+ <TextBaseEditableCell {...props} inputType="text" parseOnSave={(raw) => raw} />+);++export default EditableTextCell;diff --git a/packages/react-ui/src/components/EditableTable/base/components/EditableUrlCell.tsx b/packages/react-ui/src/components/EditableTable/base/components/EditableUrlCell.tsxnew file mode 100644index 000000000..bb693ac26--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/EditableUrlCell.tsx@@ -0,0 +1,14 @@+import React from "react";+import type { CellRendererProps } from "./CellTypes";+import { TextBaseEditableCell } from "./TextBaseEditableCell";++export const EditableUrlCell: React.FC<CellRendererProps> = (props) => (+ <TextBaseEditableCell+ {...props}+ inputType="url"+ parseOnSave={(raw) => raw}+ renderDisplay={(value) => (value === undefined || value === null ? "" : String(value))}+ />+);++export default EditableUrlCell;diff --git a/packages/react-ui/src/components/EditableTable/base/components/TextBaseEditableCell.tsx b/packages/react-ui/src/components/EditableTable/base/components/TextBaseEditableCell.tsxnew file mode 100644index 000000000..7921cbd61--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/TextBaseEditableCell.tsx@@ -0,0 +1,188 @@+import clsx from "clsx";+import { Info, Link } from "lucide-react";+import React, { useCallback, useEffect, useRef, useState } from "react";+import { safeUrl } from "../../../_shared/utils";+import { TooltipWrapper } from "../../../TooltipWrapper";+import { useEditableCellKeyboard } from "../hooks/useEditableCellKeyboard";+import { isValidUrl } from "../utils/utilsFn";+import { CellOutline } from "./CellOutline";+import type { CellRendererProps, EditableTableMeta } from "./CellTypes";++export interface TextBaseEditableCellProps extends CellRendererProps {+ inputType: "text" | "number" | "url";+ parseOnSave: (raw: string) => any;+ renderDisplay?: (value: any) => React.ReactNode;+}++const toDisplayString = (value: unknown) =>+ value === undefined || value === null ? "" : String(value);++export const TextBaseEditableCell: React.FC<TextBaseEditableCellProps> = ({+ value,+ rowIndex,+ columnId,+ isSelected,+ isEditing,+ onSelect,+ onStartEdit,+ onFinishEdit,+ onNavigate,+ table,+ inputType,+ parseOnSave,+ renderDisplay,+}) => {+ const [editValue, setEditValue] = useState<string>(toDisplayString(value));+ const inputRef = useRef<HTMLInputElement>(null);+ const cellRef = useRef<HTMLDivElement>(null);+ const updateTableData = (table.options.meta as EditableTableMeta | undefined)?.updateData;++ // Sync the edit buffer from the table only while not editing, so a re-render+ // caused by another cell's save cannot clobber in-progress typing.+ useEffect(() => {+ if (!isEditing) setEditValue(toDisplayString(value));+ }, [value, isEditing]);++ // Set when the user cancels; the blur that follows must not commit the value.+ const justCancelledRef = useRef(false);++ useEffect(() => {+ if (isEditing && inputRef.current) {+ inputRef.current.focus();+ inputRef.current.select();+ }+ }, [isEditing]);++ useEffect(() => {+ if (isSelected && !isEditing && cellRef.current) {+ cellRef.current.focus();+ }+ }, [isSelected, isEditing]);++ const handleSave = useCallback(() => {+ const processedValue = parseOnSave(editValue);+ updateTableData?.(rowIndex, columnId, processedValue);+ onFinishEdit(true);+ }, [editValue, parseOnSave, rowIndex, columnId, updateTableData, onFinishEdit]);++ const handleCancel = useCallback(() => {+ justCancelledRef.current = true;+ setEditValue(toDisplayString(value));+ onFinishEdit(false);+ }, [value, onFinishEdit]);++ const { handleKeyDown } = useEditableCellKeyboard({+ isEditing,+ isSelected,+ rowIndex,+ columnId,+ onNavigate,+ onStartEdit,+ onSave: handleSave,+ onCancel: handleCancel,+ onStartEditWithChar: (char) => setEditValue(char),+ });++ const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {+ // Let the url cell's anchor handle its own click.+ if ((e.target as HTMLElement).closest("a")) return;+ e.stopPropagation();+ if (!isSelected && !isEditing) {+ onSelect(rowIndex, columnId);+ } else {+ onStartEdit(rowIndex, columnId);+ }+ };++ const handleContainerBlur = (e: React.FocusEvent<HTMLDivElement>) => {+ if (justCancelledRef.current) {+ justCancelledRef.current = false;+ return;+ }+ if (!isEditing) return;+ const currentTarget = e.currentTarget;+ const nextFocusedElement = e.relatedTarget as Node | null;+ if (nextFocusedElement && currentTarget.contains(nextFocusedElement)) {+ return;+ }+ handleSave();+ };++ const renderContent = () => {+ if (isEditing) {+ return (+ <input+ ref={inputRef}+ type={inputType}+ value={editValue}+ onChange={(e) => setEditValue(e.target.value)}+ onKeyDown={handleKeyDown}+ className="openui-editable-table-cell-input"+ />+ );+ }+ const display = renderDisplay ? renderDisplay(value) : (value ?? "");+ if (inputType === "url") {+ const rawHref = toDisplayString(value);+ const safeHref = safeUrl(rawHref);+ const isValid = isValidUrl(rawHref) && safeHref !== undefined;+ return (+ <div className="openui-editable-table-display-url-container">+ <Link size={16} className="openui-editable-table-display-url-icon" />+ {safeHref ? (+ <a+ href={safeHref}+ target="_blank"+ rel="noopener noreferrer"+ className="openui-editable-table-display-url"+ onClick={(e) => e.stopPropagation()}+ >+ {display}+ </a>+ ) : (+ <span+ className="openui-editable-table-display-url"+ onClick={(e) => e.stopPropagation()}+ >+ {display}+ </span>+ )}+ {!isValid && (+ <TooltipWrapper tooltipContent="This might not be a valid URL" side="right">+ <div>+ <Info size={16} className="openui-editable-table-display-url-warning-icon" />+ </div>+ </TooltipWrapper>+ )}+ </div>+ );+ }+ return (+ <span+ className={clsx({+ "openui-editable-table-display-text": inputType === "text",+ "openui-editable-table-display-number": inputType === "number",+ })}+ >+ {display}+ </span>+ );+ };++ return (+ <div+ ref={cellRef}+ className="openui-editable-table-cell-base"+ onClick={handleClick}+ onKeyDown={handleKeyDown}+ onBlur={handleContainerBlur}+ tabIndex={0}+ style={{ outline: "none" }}+ >+ <CellOutline isSelected={isSelected} isEditing={isEditing} />+ {renderContent()}+ </div>+ );+};++export default TextBaseEditableCell;diff --git a/packages/react-ui/src/components/EditableTable/base/components/cellRegistry.ts b/packages/react-ui/src/components/EditableTable/base/components/cellRegistry.tsnew file mode 100644index 000000000..3bfc4673d--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/cellRegistry.ts@@ -0,0 +1,19 @@+import type React from "react";+import type { CellRendererProps, EditableCellType } from "./CellTypes";+import { EditableDateCell } from "./EditableDateCell";+import { EditableNumberCell } from "./EditableNumberCell";+import { EditableSelectCell } from "./EditableSelectCell";+import { EditableTextCell } from "./EditableTextCell";+import { EditableUrlCell } from "./EditableUrlCell";++const registry: Record<EditableCellType, React.FC<CellRendererProps>> = {+ text: EditableTextCell,+ number: EditableNumberCell,+ "date-single": EditableDateCell,+ select: EditableSelectCell,+ url: EditableUrlCell,+};++export function getCellRenderer(type: EditableCellType | undefined) {+ return registry[type ?? "text"];+}diff --git a/packages/react-ui/src/components/EditableTable/base/components/editableCellBase.scss b/packages/react-ui/src/components/EditableTable/base/components/editableCellBase.scssnew file mode 100644index 000000000..104449619--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/components/editableCellBase.scss@@ -0,0 +1,148 @@+@use "../../../../cssUtils" as cssUtils;++.openui-editable-table-cell-base {+ position: relative;+ width: 100%;+ height: 100%;+ padding: cssUtils.$space-s cssUtils.$space-m;+ color: cssUtils.$text-neutral-primary;+ @include cssUtils.typography(body, small);+}++.openui-editable-table-cell-input {+ height: 100%;+ width: 100%;+ padding: 0;+ background-color: transparent;+ outline: none;+ appearance: textfield;+ &::-webkit-inner-spin-button,+ &::-webkit-outer-spin-button {+ appearance: none;+ }+}++.openui-editable-table-display {+ &-text {+ position: absolute;+ width: calc(100% - cssUtils.$space-m * 2);+ left: cssUtils.$space-m;+ top: 50%;+ transform: translateY(-50%);+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ @include cssUtils.typography(body, small);+ }++ &-number {+ position: absolute;+ width: calc(100% - cssUtils.$space-m * 2);+ left: cssUtils.$space-m;+ top: 50%;+ transform: translateY(-50%);+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ text-align: right;+ @include cssUtils.typography(number, small);+ }++ &-url {+ display: block;+ flex: 1 1 auto;+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ @include cssUtils.typography(body, small);++ &-container {+ display: flex;+ align-items: center;+ gap: cssUtils.$space-s;+ // Mirror non-URL display positioning for vertical centering inside the cell+ position: absolute;+ width: calc(100% - cssUtils.$space-m * 2);+ left: cssUtils.$space-m;+ top: 50%;+ transform: translateY(-50%);+ }++ &-icon {+ flex-shrink: 0;+ color: cssUtils.$text-neutral-secondary;+ }++ &-warning-icon {+ flex-shrink: 0;+ color: cssUtils.$text-danger-primary;+ // TODO: Make this visible when the URL validation is implemented+ display: none;+ }++ &:hover {+ text-decoration: underline;+ }+ }+}++.openui-editable-table-cell-outline {+ &-top,+ &-bottom {+ position: absolute;+ left: 0;+ width: 100%;+ height: 0px;+ background-color: cssUtils.$border-interactive-selected;++ &-selected {+ height: 1px;+ }++ &-editing {+ height: 1.5px;+ }+ }++ &-top {+ top: 0;+ }++ &-bottom {+ bottom: 0;+ }++ &-left,+ &-right {+ position: absolute;+ top: 0;+ width: 0px;+ height: 100%;+ background-color: cssUtils.$border-interactive-selected;++ &-selected {+ width: 1px;+ }++ &-editing {+ width: 1.5px;+ }+ }++ &-left {+ left: 0;+ }++ &-right {+ right: 0;+ }+}++.openui-editable-table-select-trigger {+ width: 100%;+}++.openui-editable-table-select-item {+ @include cssUtils.typography(body, small);+}diff --git a/packages/react-ui/src/components/EditableTable/base/editableTableBase.scss b/packages/react-ui/src/components/EditableTable/base/editableTableBase.scssnew file mode 100644index 000000000..e11dc1e92--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/editableTableBase.scss@@ -0,0 +1,108 @@+@use "../../../cssUtils" as cssUtils;+@use "../../_shared/chatUtils" as chatUtils;++.openui-editable-table-wrapper {+ border: 1px solid cssUtils.$border-default;+ border-radius: cssUtils.$radius-xl cssUtils.$radius-xl 0 0;+ overflow: hidden;+ position: relative;+}++// Horizontal scroll container for the table. When content width exceeds the+// container, the scroll controls will become visible and enable snapping by column.+.openui-editable-table-scroll-container {+ overflow: auto;+ // Hide scrollbar while preserving scroll functionality+ scrollbar-width: none; // Firefox+ -ms-overflow-style: none; // IE/Edge+ &::-webkit-scrollbar {+ display: none; // Chrome/Safari/Opera+ }+}++// Scroll control button containers; they host IconButtons.+// Visibility is toggled via the `--disabled` modifier from component state.+.openui-editable-table-scroll-control {+ position: absolute;+ top: cssUtils.$space-s;+ z-index: chatUtils.$z-content;+ width: fit-content;+ height: fit-content;+ border-radius: cssUtils.$radius-s;+ background-color: cssUtils.$elevated;+ cursor: pointer;++ &.openui-editable-table-scroll-control--disabled {+ cursor: not-allowed;+ display: none;+ }++ &.openui-editable-table-scroll-control--left {+ left: cssUtils.$space-s;+ }++ &.openui-editable-table-scroll-control--right {+ right: cssUtils.$space-s;+ }+}++.openui-editable-table-table {+ border-collapse: collapse;++ & .openui-select-trigger {+ @include cssUtils.typography(body, small);+ width: 100%;+ }++ thead {+ th {+ text-align: left;+ padding: cssUtils.$space-s cssUtils.$space-m;+ border-right: 1px solid cssUtils.$border-default;+ background-color: cssUtils.$highlight-subtle;+ color: cssUtils.$text-neutral-secondary;+ @include cssUtils.typography(body, small);+ height: 48px;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ th:last-child {+ border-right: 0;+ }+ }++ tbody {+ tr {+ border-bottom: 1px solid cssUtils.$border-default;+ }++ tr:last-child {+ border-bottom: 0;+ }++ td {+ height: 48px;+ padding: 0;+ border-right: 1px solid cssUtils.$border-default;+ vertical-align: middle;+ white-space: nowrap;+ }++ td:last-child {+ border-right: 0;+ }+ }+}++.openui-editable-table-header-container {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: cssUtils.$space-s;+}++.openui-editable-table-header-icon {+ flex-shrink: 0;+}diff --git a/packages/react-ui/src/components/EditableTable/base/hooks/useEditableCellKeyboard.ts b/packages/react-ui/src/components/EditableTable/base/hooks/useEditableCellKeyboard.tsnew file mode 100644index 000000000..168b644e4--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/hooks/useEditableCellKeyboard.ts@@ -0,0 +1,105 @@+import React, { useCallback } from "react";+import type { EditableCellNavigateDirection } from "../components/CellTypes";++export interface UseEditableCellKeyboardProps {+ isEditing: boolean;+ isSelected: boolean;+ rowIndex: number;+ columnId: string;+ onNavigate: (direction: EditableCellNavigateDirection) => void;+ onStartEdit: (rowIndex: number, columnId: string) => void;+ onSave: () => void;+ onCancel: () => void;+ onStartEditWithChar?: (char: string) => void;+}++export const useEditableCellKeyboard = ({+ isEditing,+ isSelected,+ rowIndex,+ columnId,+ onNavigate,+ onStartEdit,+ onSave,+ onCancel,+ onStartEditWithChar,+}: UseEditableCellKeyboardProps) => {+ const handleKeyDown = useCallback(+ (e: React.KeyboardEvent) => {+ if (isEditing) {+ switch (e.key) {+ case "Enter":+ e.preventDefault();+ onSave();+ onNavigate("down");+ break;+ case "Tab":+ e.preventDefault();+ onSave();+ if (e.shiftKey) {+ onNavigate("left");+ } else {+ onNavigate("right");+ }+ break;+ case "Escape":+ e.preventDefault();+ onCancel();+ break;+ }+ } else if (isSelected) {+ switch (e.key) {+ case "Enter":+ case "F2":+ e.preventDefault();+ onStartEdit(rowIndex, columnId);+ break;+ case "Tab":+ e.preventDefault();+ if (e.shiftKey) {+ onNavigate("left");+ } else {+ onNavigate("right");+ }+ break;+ case "ArrowUp":+ e.preventDefault();+ onNavigate("up");+ break;+ case "ArrowDown":+ e.preventDefault();+ onNavigate("down");+ break;+ case "ArrowLeft":+ e.preventDefault();+ onNavigate("left");+ break;+ case "ArrowRight":+ e.preventDefault();+ onNavigate("right");+ break;+ default:+ if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {+ e.preventDefault();+ onStartEdit(rowIndex, columnId);+ onStartEditWithChar?.(e.key);+ }+ break;+ }+ }+ },+ [+ isEditing,+ isSelected,+ rowIndex,+ columnId,+ onNavigate,+ onStartEdit,+ onSave,+ onCancel,+ onStartEditWithChar,+ ],+ );++ return { handleKeyDown };+};diff --git a/packages/react-ui/src/components/EditableTable/base/utils/utilsFn.ts b/packages/react-ui/src/components/EditableTable/base/utils/utilsFn.tsnew file mode 100644index 000000000..5394aa62b--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/base/utils/utilsFn.ts@@ -0,0 +1,17 @@+export const isValidUrl = (value: unknown): boolean => {+ if (typeof value !== "string") return false;+ const str = value.trim();+ if (!str) return false;++ const pattern = new RegExp(+ "^(https?:\\/\\/)?" + // protocol+ "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|" + // domain name+ "((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address+ "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path+ "(\\?[;&a-z\\d%_.~+=-]*)?" + // query string+ "(\\#[-a-z\\d_]*)?$", // fragment locator+ "i",+ );++ return pattern.test(str);+};diff --git a/packages/react-ui/src/components/EditableTable/editableTable.scss b/packages/react-ui/src/components/EditableTable/editableTable.scssnew file mode 100644index 000000000..03b8aa891--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/editableTable.scss@@ -0,0 +1,26 @@+@use "../../cssUtils" as cssUtils;+@use "./base/editableTableBase";+@use "./base/components/editableCellBase";++.openui-editable-table-changes-container {+ display: flex;+ flex-direction: row;+ gap: cssUtils.$space-s;+ padding: cssUtils.$space-s cssUtils.$space-s cssUtils.$space-s cssUtils.$space-m;+ justify-content: space-between;+ align-items: center;+ background-color: cssUtils.$elevated;+ border-radius: cssUtils.$radius-xl;+ border: 1px solid cssUtils.$border-default;+ box-shadow: cssUtils.$shadow-s;+}++.openui-editable-table-changes-count {+ @include cssUtils.typography(body, default);+}++.openui-editable-table-changes-buttons {+ display: flex;+ flex-direction: row;+ gap: cssUtils.$space-s;+}diff --git a/packages/react-ui/src/components/EditableTable/index.ts b/packages/react-ui/src/components/EditableTable/index.tsnew file mode 100644index 000000000..b36e51df7--- /dev/null+++ b/packages/react-ui/src/components/EditableTable/index.ts@@ -0,0 +1 @@+export * from "./EditableTable";diff --git a/packages/react-ui/src/components/EntityList/EntityList.tsx b/packages/react-ui/src/components/EntityList/EntityList.tsxnew file mode 100644index 000000000..a42bb1632--- /dev/null+++ b/packages/react-ui/src/components/EntityList/EntityList.tsx@@ -0,0 +1,70 @@+import clsx from "clsx";+import { forwardRef } from "react";+import { InlineMarkdownRenderer } from "../InlineMarkdownRenderer";++export interface EntityListRow {+ left: string;+ right: string;+ rightVariant?: "text" | "number";+}++export type EntityListSize = "small" | "default";++export interface EntityListProps {+ rows?: EntityListRow[];+ size?: EntityListSize;+ /** Only rendered when `size` is "default". */+ header?: EntityListRow;+ /** Only rendered when `size` is "default". */+ footer?: EntityListRow;+ className?: string;+}++type RowType = "header" | "body" | "footer";++function EntityListRowView({ row, rowType }: { row: EntityListRow; rowType: RowType }) {+ const rightVariant = row.rightVariant ?? "text";+ return (+ <div className={clsx("openui-entity-list__row", `openui-entity-list__row--${rowType}`)}>+ <span+ className={clsx(+ "openui-entity-list__cell-left",+ `openui-entity-list__cell-left--${rowType}`,+ )}+ >+ <InlineMarkdownRenderer content={row.left} />+ </span>+ <span+ className={clsx(+ "openui-entity-list__cell-right",+ `openui-entity-list__cell-right--${rightVariant}`,+ `openui-entity-list__cell-right--${rowType}`,+ )}+ >+ <InlineMarkdownRenderer content={row.right} />+ </span>+ </div>+ );+}++/** A two-column key/value list with optional header and footer rows. */+export const EntityList = forwardRef<HTMLDivElement, EntityListProps>(+ ({ rows = [], size = "default", header, footer, className }, ref) => {+ const showHeaderFooter = size === "default";++ return (+ <div+ ref={ref}+ className={clsx("openui-entity-list", `openui-entity-list--${size}`, className)}+ >+ {showHeaderFooter && header && <EntityListRowView row={header} rowType="header" />}+ {rows.map((row, index) => (+ <EntityListRowView key={index} row={row} rowType="body" />+ ))}+ {showHeaderFooter && footer && <EntityListRowView row={footer} rowType="footer" />}+ </div>+ );+ },+);++EntityList.displayName = "EntityList";diff --git a/packages/react-ui/src/components/EntityList/entityList.scss b/packages/react-ui/src/components/EntityList/entityList.scssnew file mode 100644index 000000000..415941c2a--- /dev/null+++ b/packages/react-ui/src/components/EntityList/entityList.scss@@ -0,0 +1,84 @@+@use "../../cssUtils" as cssUtils;++.openui-entity-list {+ display: flex;+ flex-direction: column;+ width: 100%;+ box-sizing: border-box;+}++.openui-entity-list__row {+ display: flex;+ justify-content: space-between;+ align-items: flex-start;+ gap: cssUtils.$space-m;+ padding: cssUtils.$space-m 0;+ border-bottom: 1px solid cssUtils.$border-default;+ color: cssUtils.$text-neutral-primary;++ &:last-child {+ border-bottom: none;+ }+}++.openui-entity-list__cell-left,+.openui-entity-list__cell-right {+ flex: 1;+ min-width: 0;+ max-width: 50%;+ overflow-wrap: break-word;+ word-wrap: break-word;+}++.openui-entity-list__cell-right {+ text-align: right;+}++.openui-entity-list--default {+ .openui-entity-list__cell-left {+ @include cssUtils.typography(body, default);+ }++ .openui-entity-list__cell-right {+ @include cssUtils.typography(body, heavy);+ }++ .openui-entity-list__row--header {+ .openui-entity-list__cell-left,+ .openui-entity-list__cell-right {+ color: cssUtils.$text-neutral-secondary;+ }+ }++ .openui-entity-list__cell-right--number {+ @include cssUtils.typography(number, heavy);+ }++ .openui-entity-list__cell-left--footer {+ @include cssUtils.typography(body, default);+ }++ .openui-entity-list__cell-right--footer {+ &.openui-entity-list__cell-right--text {+ @include cssUtils.typography(body, large-heavy);+ }++ &.openui-entity-list__cell-right--number {+ @include cssUtils.typography(number, large-heavy);+ }+ }+}++.openui-entity-list--small {+ .openui-entity-list__cell-left {+ @include cssUtils.typography(body, small);+ }++ .openui-entity-list__cell-right--text {+ @include cssUtils.typography(body, small-heavy);+ }++ .openui-entity-list__cell-right--number {+ @include cssUtils.typography(number, small-heavy);+ }+}diff --git a/packages/react-ui/src/components/EntityList/index.ts b/packages/react-ui/src/components/EntityList/index.tsnew file mode 100644index 000000000..cea00c42a--- /dev/null+++ b/packages/react-ui/src/components/EntityList/index.ts@@ -0,0 +1 @@+export * from "./EntityList";diff --git a/packages/react-ui/src/components/FollowUpItem/followUpItem.scss b/packages/react-ui/src/components/FollowUpItem/followUpItem.scssindex 3bc3cde21..b4fbc3848 100644--- a/packages/react-ui/src/components/FollowUpItem/followUpItem.scss+++ b/packages/react-ui/src/components/FollowUpItem/followUpItem.scss@@ -2,7 +2,7 @@.openui-follow-up-item {@include cssUtils.button-reset;- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);box-sizing: border-box;padding: cssUtils.$space-s cssUtils.$space-000;border-bottom: 1px solid cssUtils.$border-default;diff --git a/packages/react-ui/src/components/IconTag/IconTag.tsx b/packages/react-ui/src/components/IconTag/IconTag.tsxnew file mode 100644index 000000000..611ae99e3--- /dev/null+++ b/packages/react-ui/src/components/IconTag/IconTag.tsx@@ -0,0 +1,38 @@+import clsx from "clsx";+import { forwardRef } from "react";+import { IconWrapper, type IconProps } from "../_shared/icons";++export type IconTagSize = "xs" | "s" | "m" | "l" | "xl";+export type IconTagVariant = "neutral" | "info" | "success" | "warning" | "danger" | "inverted";++export interface IconTagProps {+ icon: IconProps;+ size?: IconTagSize;+ variant?: IconTagVariant;+ className?: string;+}++/** Small icon badge used inside card primitives. */+export const IconTag = forwardRef<HTMLDivElement, IconTagProps>(+ ({ icon, size = "m", variant = "neutral", className }, ref) => {+ if (!icon?.name) {+ return null;+ }++ return (+ <div+ ref={ref}+ className={clsx(+ "openui-icon-tag",+ `openui-icon-tag--${size}`,+ `openui-icon-tag--${variant}`,+ className,+ )}+ >+ <IconWrapper name={icon.name} category={icon.category} />+ </div>+ );+ },+);++IconTag.displayName = "IconTag";diff --git a/packages/react-ui/src/components/IconTag/iconTag.scss b/packages/react-ui/src/components/IconTag/iconTag.scssnew file mode 100644index 000000000..5c5e78a3b--- /dev/null+++ b/packages/react-ui/src/components/IconTag/iconTag.scss@@ -0,0 +1,94 @@+@use "../../cssUtils" as cssUtils;++.openui-icon-tag {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ box-sizing: border-box;+ flex-shrink: 0;+}++.openui-icon-tag--xs {+ width: 20px;+ height: 20px;+ border-radius: cssUtils.$radius-xs;++ & svg {+ width: 12px;+ height: 12px;+ }+}++.openui-icon-tag--s {+ width: 24px;+ height: 24px;+ border-radius: cssUtils.$radius-s;++ & svg {+ width: 14px;+ height: 14px;+ }+}++.openui-icon-tag--m {+ width: 32px;+ height: 32px;+ border-radius: cssUtils.$radius-s;++ & svg {+ width: 14px;+ height: 14px;+ }+}++.openui-icon-tag--l {+ width: 36px;+ height: 36px;+ border-radius: cssUtils.$radius-m;++ & svg {+ width: 16px;+ height: 16px;+ }+}++.openui-icon-tag--xl {+ width: 40px;+ height: 40px;+ border-radius: cssUtils.$radius-m;++ & svg {+ width: 16px;+ height: 16px;+ }+}++.openui-icon-tag--neutral {+ background-color: cssUtils.$highlight;+ color: cssUtils.$text-neutral-primary;+}++.openui-icon-tag--info {+ background-color: cssUtils.$info-background;+ color: cssUtils.$text-info-primary;+}++.openui-icon-tag--success {+ background-color: cssUtils.$success-background;+ color: cssUtils.$text-success-primary;+}++.openui-icon-tag--warning {+ background-color: cssUtils.$alert-background;+ color: cssUtils.$text-alert-primary;+}++.openui-icon-tag--danger {+ background-color: cssUtils.$danger-background;+ color: cssUtils.$text-danger-primary;+}++.openui-icon-tag--inverted {+ background-color: cssUtils.$inverted-background;+ color: cssUtils.$background;+}diff --git a/packages/react-ui/src/components/IconTag/index.ts b/packages/react-ui/src/components/IconTag/index.tsnew file mode 100644index 000000000..bb0306398--- /dev/null+++ b/packages/react-ui/src/components/IconTag/index.ts@@ -0,0 +1 @@+export * from "./IconTag";diff --git a/packages/react-ui/src/components/IconText/IconText.tsx b/packages/react-ui/src/components/IconText/IconText.tsxnew file mode 100644index 000000000..dce1c7724--- /dev/null+++ b/packages/react-ui/src/components/IconText/IconText.tsx@@ -0,0 +1,60 @@+import clsx from "clsx";+import { forwardRef } from "react";+import { IconTag, type IconTagVariant } from "../IconTag";+import { TextBlockView } from "../TextBlock";+import type { IconProps } from "../_shared/icons";++export type IconTextIconVariant = IconTagVariant | "filled" | "soft";+export type IconTextLayout = "horizontal" | "vertical";++export interface IconTextProps {+ icon: IconProps;+ title: string;+ subtitle?: string;+ iconVariant?: IconTextIconVariant;+ bold?: boolean;+ layout?: IconTextLayout;+ className?: string;+}++function normalizeIconVariant(variant: IconTextIconVariant): IconTagVariant {+ switch (variant) {+ case "filled":+ case "soft":+ return "neutral";+ default:+ return variant;+ }+}++/** An icon badge beside (or above) a title with an optional subtitle. */+export const IconText = forwardRef<HTMLDivElement, IconTextProps>(+ (+ {+ icon,+ title,+ subtitle,+ iconVariant = "neutral",+ bold = false,+ layout = "horizontal",+ className,+ },+ ref,+ ) => (+ <div ref={ref} className={clsx("openui-icon-text", `openui-icon-text--${layout}`, className)}>+ <IconTag icon={icon} variant={normalizeIconVariant(iconVariant)} size="l" />+ <div className="openui-icon-text__content">+ <TextBlockView+ variant={bold ? "highlight-text-number-subtext" : "text-subtext"}+ primary={title}+ secondary={subtitle}+ type="text"+ size={layout === "horizontal" ? "xs" : "sm"}+ align="left"+ />+ </div>+ </div>+ ),+);++IconText.displayName = "IconText";diff --git a/packages/react-ui/src/components/IconText/iconText.scss b/packages/react-ui/src/components/IconText/iconText.scssnew file mode 100644index 000000000..88c24d86f--- /dev/null+++ b/packages/react-ui/src/components/IconText/iconText.scss@@ -0,0 +1,30 @@+@use "../../cssUtils" as cssUtils;++.openui-icon-text {+ display: flex;+ gap: cssUtils.$space-m;+}++.openui-icon-text--vertical {+ flex-direction: column;+ align-items: flex-start;+}++.openui-icon-text--horizontal {+ flex-direction: row;+ align-items: flex-start;++ .openui-icon-tag {+ margin-top: cssUtils.$space-3xs;+ }++ .openui-text-block__primary {+ @include cssUtils.typography(body, small-heavy);+ }+}++.openui-icon-text__content {+ display: flex;+ flex-direction: column;+ min-width: 0;+}diff --git a/packages/react-ui/src/components/IconText/index.ts b/packages/react-ui/src/components/IconText/index.tsnew file mode 100644index 000000000..cf799d9a5--- /dev/null+++ b/packages/react-ui/src/components/IconText/index.ts@@ -0,0 +1 @@+export * from "./IconText";diff --git a/packages/react-ui/src/components/ImageText/ImageText.tsx b/packages/react-ui/src/components/ImageText/ImageText.tsxnew file mode 100644index 000000000..6226c0bec--- /dev/null+++ b/packages/react-ui/src/components/ImageText/ImageText.tsx@@ -0,0 +1,54 @@+import clsx from "clsx";+import { forwardRef } from "react";+import { TextBlockView } from "../TextBlock";++export type ImageTextLayout = "horizontal" | "vertical";++export interface ImageTextProps {+ title: string;+ subtitle?: string;+ src: string;+ alt?: string;+ bold?: boolean;+ layout?: ImageTextLayout;+ /** Square image size in px. Defaults to 40 for horizontal layout. */+ imageSize?: number;+ className?: string;+}++/** A small square image beside (or above) a title with an optional subtitle. */+export const ImageText = forwardRef<HTMLDivElement, ImageTextProps>(+ (+ { title, subtitle, src, alt, bold = false, layout = "horizontal", imageSize, className },+ ref,+ ) => {+ const altText = alt ?? title;+ const size = imageSize ?? (layout === "horizontal" ? 40 : undefined);++ return (+ <div+ ref={ref}+ className={clsx("openui-image-text", `openui-image-text--${layout}`, className)}+ >+ <div+ className="openui-image-text__image-container"+ style={size ? { width: size, height: size } : undefined}+ >+ <img className="openui-image-text__image" src={src} alt={altText} />+ </div>+ <div className="openui-image-text__content">+ <TextBlockView+ variant={bold ? "highlight-text-number-subtext" : "text-subtext"}+ primary={title}+ secondary={subtitle}+ type="text"+ size={layout === "horizontal" ? "xs" : "sm"}+ align="left"+ />+ </div>+ </div>+ );+ },+);++ImageText.displayName = "ImageText";diff --git a/packages/react-ui/src/components/ImageText/imageText.scss b/packages/react-ui/src/components/ImageText/imageText.scssnew file mode 100644index 000000000..4611fd72e--- /dev/null+++ b/packages/react-ui/src/components/ImageText/imageText.scss@@ -0,0 +1,49 @@+@use "../../cssUtils" as cssUtils;++.openui-image-text {+ display: flex;+ gap: cssUtils.$space-m;+}++.openui-image-text__image-container {+ position: relative;+ width: calc(#{cssUtils.$space-2xl} + #{cssUtils.$space-2xs});+ height: calc(#{cssUtils.$space-2xl} + #{cssUtils.$space-2xs});+ border-radius: cssUtils.$radius-m;+ overflow: hidden;+ flex-shrink: 0;+ display: flex;+ align-items: center;+ justify-content: center;+ background-color: cssUtils.$sunk;+}++.openui-image-text__image {+ width: 100%;+ height: 100%;+ object-fit: cover;+}++.openui-image-text--vertical {+ flex-direction: column;+ align-items: flex-start;+}++.openui-image-text--horizontal {+ flex-direction: row;+ align-items: center;++ .openui-text-block__primary {+ @include cssUtils.typography(body, small-heavy);+ }+}++.openui-image-text--horizontal .openui-image-text__content {+ padding-top: cssUtils.$space-3xs;+}++.openui-image-text__content {+ display: flex;+ flex-direction: column;+ min-width: 0;+}diff --git a/packages/react-ui/src/components/ImageText/index.ts b/packages/react-ui/src/components/ImageText/index.tsnew file mode 100644index 000000000..5b3eacb2e--- /dev/null+++ b/packages/react-ui/src/components/ImageText/index.ts@@ -0,0 +1 @@+export * from "./ImageText";diff --git a/packages/react-ui/src/components/ImageTextLarge/ImageTextLarge.tsx b/packages/react-ui/src/components/ImageTextLarge/ImageTextLarge.tsxnew file mode 100644index 000000000..ea607c6b1--- /dev/null+++ b/packages/react-ui/src/components/ImageTextLarge/ImageTextLarge.tsx@@ -0,0 +1,38 @@+import clsx from "clsx";+import { forwardRef } from "react";+import { TextBlockView } from "../TextBlock";++export interface ImageTextLargeProps {+ title: string;+ subtitle?: string;+ src: string;+ alt?: string;+ className?: string;+}++/** A full-width banner image above a bold title with an optional subtitle. */+export const ImageTextLarge = forwardRef<HTMLDivElement, ImageTextLargeProps>(+ ({ title, subtitle, src, alt, className }, ref) => {+ const altText = alt ?? title;++ return (+ <div ref={ref} className={clsx("openui-image-text-large", className)}>+ <div className="openui-image-text-large__image-wrap">+ <img className="openui-image-text-large__image" src={src} alt={altText} />+ </div>+ <div className="openui-image-text-large__content">+ <TextBlockView+ variant="highlight-text"+ primary={title}+ secondary={subtitle}+ type="text"+ size="sm"+ align="left"+ />+ </div>+ </div>+ );+ },+);++ImageTextLarge.displayName = "ImageTextLarge";diff --git a/packages/react-ui/src/components/ImageTextLarge/imageTextLarge.scss b/packages/react-ui/src/components/ImageTextLarge/imageTextLarge.scssnew file mode 100644index 000000000..f315087f9--- /dev/null+++ b/packages/react-ui/src/components/ImageTextLarge/imageTextLarge.scss@@ -0,0 +1,28 @@+@use "../../cssUtils" as cssUtils;++.openui-image-text-large {+ display: flex;+ width: 100%;+ min-width: 0;+ flex-direction: column;+ gap: cssUtils.$space-m;+}++.openui-image-text-large__image-wrap {+ position: relative;+ width: 100%;+ min-height: 60px;+ max-height: 180px;+ border-radius: cssUtils.$radius-m;+ overflow: hidden;+ background-color: cssUtils.$sunk;+ line-height: 0;+}++.openui-image-text-large__image {+ display: block;+ width: 100%;+ height: 180px;+ max-height: 180px;+ object-fit: cover;+}diff --git a/packages/react-ui/src/components/ImageTextLarge/index.ts b/packages/react-ui/src/components/ImageTextLarge/index.tsnew file mode 100644index 000000000..9e88d5bf0--- /dev/null+++ b/packages/react-ui/src/components/ImageTextLarge/index.ts@@ -0,0 +1 @@+export * from "./ImageTextLarge";diff --git a/packages/react-ui/src/components/InlineHeader/InlineHeader.tsx b/packages/react-ui/src/components/InlineHeader/InlineHeader.tsxnew file mode 100644index 000000000..063a6c526--- /dev/null+++ b/packages/react-ui/src/components/InlineHeader/InlineHeader.tsx@@ -0,0 +1,27 @@+import clsx from "clsx";+import { InlineMarkdownRenderer } from "../InlineMarkdownRenderer";++export interface InlineHeaderProps {+ heading?: string;+ description?: string;+ className?: string;+}++export const InlineHeader = ({ heading, description, className }: InlineHeaderProps) => {+ if (!heading && !description) return null;++ return (+ <div className={clsx("openui-inline-header", className)}>+ {heading && (+ <div className="openui-inline-header-heading">+ <InlineMarkdownRenderer content={heading} />+ </div>+ )}+ {description && (+ <div className="openui-inline-header-description">+ <InlineMarkdownRenderer content={description} />+ </div>+ )}+ </div>+ );+};diff --git a/packages/react-ui/src/components/InlineHeader/index.ts b/packages/react-ui/src/components/InlineHeader/index.tsnew file mode 100644index 000000000..a7099a740--- /dev/null+++ b/packages/react-ui/src/components/InlineHeader/index.ts@@ -0,0 +1 @@+export * from "./InlineHeader";diff --git a/packages/react-ui/src/components/InlineHeader/inlineHeader.scss b/packages/react-ui/src/components/InlineHeader/inlineHeader.scssnew file mode 100644index 000000000..3c58755b6--- /dev/null+++ b/packages/react-ui/src/components/InlineHeader/inlineHeader.scss@@ -0,0 +1,21 @@+@use "../../cssUtils" as cssUtils;++.openui-inline-header {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-3xs;+ align-items: flex-start;++ &-heading {+ display: flex;+ align-items: center;+ gap: cssUtils.$space-xs;+ color: cssUtils.$text-neutral-primary;+ @include cssUtils.typography(body, heavy);+ }++ &-description {+ color: cssUtils.$text-neutral-secondary;+ @include cssUtils.typography(body, default);+ }+}diff --git a/packages/react-ui/src/components/InlineMarkdownRenderer/InlineMarkdownRenderer.tsx b/packages/react-ui/src/components/InlineMarkdownRenderer/InlineMarkdownRenderer.tsxnew file mode 100644index 000000000..e13b89e8b--- /dev/null+++ b/packages/react-ui/src/components/InlineMarkdownRenderer/InlineMarkdownRenderer.tsx@@ -0,0 +1,64 @@+import clsx from "clsx";+import { memo, ReactNode } from "react";+import remarkBreaks from "remark-breaks";+import remarkGfm from "remark-gfm";+import { remarkCitations } from "../_shared/remark/remarkCitations";+import { TextContentCitation } from "../Citation";+import { MarkDownRenderer } from "../MarkDownRenderer";+import { useTheme } from "../ThemeProvider";++const Fragment = ({ children }: { children?: ReactNode }) => children;++export interface InlineMarkdownRendererProps {+ content: string;+ className?: string;+}++/**+ * Lightweight markdown renderer for inline text (bold, italic, links, code).+ * Block-level elements (paragraphs, headings, lists) are flattened so the+ * output stays inline.+ */+export const InlineMarkdownRenderer = memo(+ ({ content, className }: InlineMarkdownRendererProps) => {+ const { mode } = useTheme();++ if (!content) {+ return null;+ }++ return (+ <span+ className={clsx("openui-inline-markdown-renderer", className, {+ "openui-inline-markdown-renderer--dark": mode === "dark",+ })}+ >+ <MarkDownRenderer+ textMarkdown={content}+ options={{+ remarkPlugins: [+ remarkCitations,+ [remarkBreaks, { breaks: false }],+ [remarkGfm, { singleTilde: false }],+ ],+ components: {+ p: Fragment,+ h1: Fragment,+ h2: Fragment,+ h3: Fragment,+ h4: Fragment,+ h5: Fragment,+ h6: Fragment,+ ul: Fragment,+ ol: Fragment,+ li: Fragment,+ span: TextContentCitation,+ },+ }}+ />+ </span>+ );+ },+);++InlineMarkdownRenderer.displayName = "InlineMarkdownRenderer";diff --git a/packages/react-ui/src/components/InlineMarkdownRenderer/index.ts b/packages/react-ui/src/components/InlineMarkdownRenderer/index.tsnew file mode 100644index 000000000..bc9b8d691--- /dev/null+++ b/packages/react-ui/src/components/InlineMarkdownRenderer/index.ts@@ -0,0 +1 @@+export * from "./InlineMarkdownRenderer";diff --git a/packages/react-ui/src/components/InlineMarkdownRenderer/inlineMarkdownRenderer.scss b/packages/react-ui/src/components/InlineMarkdownRenderer/inlineMarkdownRenderer.scssnew file mode 100644index 000000000..ad0dcd539--- /dev/null+++ b/packages/react-ui/src/components/InlineMarkdownRenderer/inlineMarkdownRenderer.scss@@ -0,0 +1,28 @@+.openui-inline-markdown-renderer {+ display: inline;+ text-align: inherit;++ .openui-markdown-renderer {+ all: unset;+ display: inline;+ color: inherit;+ font: inherit;+ letter-spacing: inherit;+ text-align: inherit;+ }++ p,+ .openui-markdown-renderer p {+ display: inline;+ margin: 0;+ padding: 0;+ text-align: inherit;+ }++ > * {+ display: inline;+ margin: 0;+ padding: 0;+ text-align: inherit;+ }+}diff --git a/packages/react-ui/src/components/Label/label.scss b/packages/react-ui/src/components/Label/label.scssindex a629d4c34..27d1174c7 100644--- a/packages/react-ui/src/components/Label/label.scss+++ b/packages/react-ui/src/components/Label/label.scss@@ -2,7 +2,7 @@.openui-label {box-sizing: border-box;- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);color: cssUtils.$text-neutral-primary;&-disabled {diff --git a/packages/react-ui/src/components/ListBlock/ListBlock.tsx b/packages/react-ui/src/components/ListBlock/ListBlock.tsxindex 29ec73048..629998d74 100644--- a/packages/react-ui/src/components/ListBlock/ListBlock.tsx+++ b/packages/react-ui/src/components/ListBlock/ListBlock.tsx@@ -7,18 +7,20 @@ import {isValidElement,ReactElement,} from "react";-import { ListItemProps, ListItemVariant } from "../ListItem";+import { ListItemProps, ListItemSize, ListItemVariant } from "../ListItem";export interface ListBlockProps {/** Controls the indicator shown on every ListItem. Defaults to "number". */variant?: ListItemVariant;+ /** "small" tightens spacing and typography (used inside cards). Defaults to "default". */+ size?: ListItemSize;children: ReactElement<ListItemProps> | ReactElement<ListItemProps>[];className?: string;style?: CSSProperties;}const ListBlock = forwardRef<HTMLDivElement, ListBlockProps>((props, ref) => {- const { children, variant = "number", className, style } = props;+ const { children, variant = "number", size = "default", className, style } = props;const childArray = Children.toArray(children);const listHasSubtitle = childArray.some(@@ -29,6 +31,7 @@ const ListBlock = forwardRef<HTMLDivElement, ListBlockProps>((props, ref) => {if (isValidElement(child)) {return cloneElement(child as ReactElement<ListItemProps>, {variant,+ size,listHasSubtitle,index,});@@ -37,7 +40,15 @@ const ListBlock = forwardRef<HTMLDivElement, ListBlockProps>((props, ref) => {});return (- <div ref={ref} className={clsx("openui-list-block", className)} style={style}>+ <div+ ref={ref}+ className={clsx(+ "openui-list-block",+ size === "small" && "openui-list-block--small",+ className,+ )}+ style={style}+ >{enhancedChildren}</div>);diff --git a/packages/react-ui/src/components/ListBlock/listBlock.scss b/packages/react-ui/src/components/ListBlock/listBlock.scssindex 6731aa590..202a91b16 100644--- a/packages/react-ui/src/components/ListBlock/listBlock.scss+++ b/packages/react-ui/src/components/ListBlock/listBlock.scss@@ -8,3 +8,7 @@width: 100%;gap: cssUtils.$space-l;}++.openui-list-block--small {+ gap: cssUtils.$space-m;+}diff --git a/packages/react-ui/src/components/ListItem/ListItem.tsx b/packages/react-ui/src/components/ListItem/ListItem.tsxindex f1f007b57..41d96db18 100644--- a/packages/react-ui/src/components/ListItem/ListItem.tsx+++ b/packages/react-ui/src/components/ListItem/ListItem.tsx@@ -2,6 +2,7 @@ import clsx from "clsx";import React, { CSSProperties, ReactNode } from "react";export type ListItemVariant = "icon" | "image" | "number";+export type ListItemSize = "default" | "small";export interface ListItemProps {className?: string;@@ -9,6 +10,7 @@ export interface ListItemProps {title?: ReactNode;subtitle?: ReactNode;variant?: ListItemVariant;+ size?: ListItemSize;icon?: ReactNode;image?: { src?: string; alt: string };index?: number;@@ -23,6 +25,7 @@ const ListItem = React.forwardRef<HTMLDivElement, ListItemProps>((props, ref) =>className,style,variant = "number",+ size = "default",icon,image,index = 0,@@ -42,6 +45,7 @@ const ListItem = React.forwardRef<HTMLDivElement, ListItemProps>((props, ref) =>ref={ref}className={clsx("openui-list-item-wrapper",+ size === "small" && "openui-list-item-wrapper--small",hasAction && "openui-list-item-wrapper-with-action",className,)}diff --git a/packages/react-ui/src/components/ListItem/listItem.scss b/packages/react-ui/src/components/ListItem/listItem.scssindex ba5d20c55..35fcc3b6b 100644--- a/packages/react-ui/src/components/ListItem/listItem.scss+++ b/packages/react-ui/src/components/ListItem/listItem.scss@@ -145,3 +145,33 @@}}}++// Compact variant (ListBlock size="small") — used inside card blocks.+.openui-list-item-wrapper--small {+ gap: cssUtils.$space-s;++ .openui-list-item {+ gap: cssUtils.$space-s-m;+ }++ .openui-list-item-indicator {+ width: 36px;+ height: 36px;++ &-no-subtitle {+ width: 20px;+ height: 20px;+ }++ &-number {+ @include cssUtils.typography(number, small);+ }+ }++ .openui-list-item-title,+ .openui-list-item-subtitle,+ .openui-list-item-action-label,+ .openui-list-item-action-icon {+ @include cssUtils.typography(body, small);+ }+}diff --git a/packages/react-ui/src/components/MetricIndicator/MetricIndicator.tsx b/packages/react-ui/src/components/MetricIndicator/MetricIndicator.tsxnew file mode 100644index 000000000..762a140ff--- /dev/null+++ b/packages/react-ui/src/components/MetricIndicator/MetricIndicator.tsx@@ -0,0 +1,84 @@+import clsx from "clsx";+import { forwardRef } from "react";++export interface MetricIndicatorTrend {+ direction: "up" | "down";+ value: number;+}++export interface MetricIndicatorWithStrikethroughProps {+ value: string;+ subtext?: string;+ previousValue?: string;+ trend?: MetricIndicatorTrend;+ className?: string;+}++export interface MetricIndicatorInlineProps {+ value: string;+ subtext?: string;+ trend?: MetricIndicatorTrend;+ className?: string;+}++interface MetricIndicatorBaseProps extends MetricIndicatorWithStrikethroughProps {+ variant: "with-strikethrough" | "inline";+}++const MetricIndicatorBase = forwardRef<HTMLDivElement, MetricIndicatorBaseProps>(+ ({ value, subtext, previousValue, trend, variant, className }, ref) => {+ const isPositive = trend?.direction === "up";+ const isInline = variant === "inline";++ return (+ <div+ ref={ref}+ className={clsx(+ "openui-metric-indicator",+ `openui-metric-indicator--variant-${variant}`,+ subtext && "openui-metric-indicator--has-subtext",+ className,+ )}+ >+ <div className="openui-metric-indicator__row">+ <div className="openui-metric-indicator__main-value">{value}</div>+ {!isInline && previousValue && (+ <div className="openui-metric-indicator__previous-value">{previousValue}</div>+ )}+ {trend && (+ <div+ className={clsx(+ "openui-metric-indicator__trend",+ isPositive+ ? "openui-metric-indicator__trend--success"+ : "openui-metric-indicator__trend--danger",+ )}+ >+ {isPositive ? "+" : "-"}+ {trend.value}%+ </div>+ )}+ {isInline && subtext && <div className="openui-metric-indicator__subtext">{subtext}</div>}+ </div>+ {!isInline && subtext && <div className="openui-metric-indicator__subtext">{subtext}</div>}+ </div>+ );+ },+);++MetricIndicatorBase.displayName = "MetricIndicatorBase";++/** A headline metric with an optional struck-through previous value, trend and subtext. */+export const MetricIndicatorWithStrikethrough = forwardRef<+ HTMLDivElement,+ MetricIndicatorWithStrikethroughProps+>((props, ref) => <MetricIndicatorBase ref={ref} {...props} variant="with-strikethrough" />);++MetricIndicatorWithStrikethrough.displayName = "MetricIndicatorWithStrikethrough";++/** A headline metric with trend and subtext rendered on a single line. */+export const MetricIndicatorInline = forwardRef<HTMLDivElement, MetricIndicatorInlineProps>(+ (props, ref) => <MetricIndicatorBase ref={ref} {...props} variant="inline" />,+);++MetricIndicatorInline.displayName = "MetricIndicatorInline";diff --git a/packages/react-ui/src/components/MetricIndicator/index.ts b/packages/react-ui/src/components/MetricIndicator/index.tsnew file mode 100644index 000000000..1b1f9687f--- /dev/null+++ b/packages/react-ui/src/components/MetricIndicator/index.ts@@ -0,0 +1 @@+export * from "./MetricIndicator";diff --git a/packages/react-ui/src/components/MetricIndicator/metricIndicator.scss b/packages/react-ui/src/components/MetricIndicator/metricIndicator.scssnew file mode 100644index 000000000..79d02a98e--- /dev/null+++ b/packages/react-ui/src/components/MetricIndicator/metricIndicator.scss@@ -0,0 +1,65 @@+@use "../../cssUtils" as cssUtils;++.openui-metric-indicator {+ display: flex;+ flex-direction: column;+ align-items: stretch;+ gap: cssUtils.$space-3xs;++ &--variant-inline {+ gap: 0;+ }++ &--has-subtext {+ gap: cssUtils.$space-3xs;+ }++ &__row {+ display: flex;+ flex-direction: row;+ flex-wrap: wrap;+ align-items: flex-end;+ gap: cssUtils.$space-xs;+ min-width: 0;+ }++ &--variant-inline &__row {+ align-items: baseline;+ gap: cssUtils.$space-2xs;+ }++ &__main-value {+ color: cssUtils.$text-neutral-primary;+ @include cssUtils.typography(number, heavy);+ }++ &__previous-value {+ color: cssUtils.$text-neutral-secondary;+ text-decoration: line-through;+ @include cssUtils.typography(number, small);+ margin-bottom: 1px;+ }++ &__subtext {+ color: cssUtils.$text-neutral-secondary;+ min-width: 0;+ @include cssUtils.typography(body, small);+ }++ &--variant-inline &__subtext {+ margin-top: 0;+ }++ &__trend {+ &--success {+ color: cssUtils.$text-success-primary;+ }++ &--danger {+ color: cssUtils.$text-danger-primary;+ }++ @include cssUtils.typography(number, small);+ margin-bottom: 1px;+ }+}diff --git a/packages/react-ui/src/components/OpenUIChat/assistantMessage.scss b/packages/react-ui/src/components/OpenUIChat/assistantMessage.scssindex b794db2cd..87bc0e887 100644--- a/packages/react-ui/src/components/OpenUIChat/assistantMessage.scss+++ b/packages/react-ui/src/components/OpenUIChat/assistantMessage.scss@@ -29,7 +29,7 @@}&__text {- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);color: cssUtils.$text-neutral-primary;&:first-child {margin-top: cssUtils.$space-xs;@@ -57,7 +57,7 @@padding: 0;&__content {- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);padding: cssUtils.$space-s cssUtils.$space-m;background-color: cssUtils.$chat-user-response-bg;color: cssUtils.$chat-user-response-text;diff --git a/packages/react-ui/src/components/OptionCards/OptionCards.tsx b/packages/react-ui/src/components/OptionCards/OptionCards.tsxnew file mode 100644index 000000000..c2798deb6--- /dev/null+++ b/packages/react-ui/src/components/OptionCards/OptionCards.tsx@@ -0,0 +1,129 @@+import clsx from "clsx";+import { forwardRef, type HTMLAttributes, type ReactNode } from "react";+import { InlineMarkdownRenderer } from "../InlineMarkdownRenderer";+import { getRowConfiguration } from "../_shared/cards/smallCardBlockUtils";++export type OptionCardsSelectionType = "single" | "multiple";++export interface OptionCardsItem {+ value: string;+ /** Inline markdown supported. */+ title: string;+ /** Inline markdown supported. */+ subtitle?: string;+ topContent?: ReactNode;+ /** Controls the top slot sizing: a small icon tile or a larger image tile. */+ topContentVariant?: "icon" | "image";+ disabled?: boolean;+}++export interface OptionCardsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onToggle"> {+ items: OptionCardsItem[];+ /** Currently selected item values. */+ selected?: string[];+ type?: OptionCardsSelectionType;+ /** Disables every card (e.g. while streaming). */+ disabled?: boolean;+ onToggle?: (value: string) => void;+ className?: string;+}++const OptionCards = forwardRef<HTMLDivElement, OptionCardsProps>((props, ref) => {+ const {+ items,+ selected = [],+ type = "single",+ disabled = false,+ onToggle,+ className,+ ...rest+ } = props;++ // Items without a value have no stable identity to select or toggle by.+ const renderableItems = (items ?? []).filter((item) => Boolean(item?.value));+ const rowConfiguration = getRowConfiguration(renderableItems.length, 3);+ let cardIndex = 0;++ return (+ <div+ ref={ref}+ className={clsx("openui-option-cards", className)}+ role={type === "single" ? "radiogroup" : "group"}+ {...rest}+ >+ <div+ className={clsx(+ "openui-option-cards__grid",+ "openui-option-cards__grid--responsive",+ renderableItems.length % 2 === 1 && "openui-option-cards__grid--odd-count",+ )}+ >+ {rowConfiguration.map((itemsInRow, rowIndex) => {+ const rowItems = renderableItems.slice(cardIndex, cardIndex + itemsInRow);+ cardIndex += itemsInRow;++ return (+ <div+ key={`option-cards-row-${rowIndex}`}+ className={clsx(+ "openui-option-cards__row",+ `openui-option-cards__row--${itemsInRow}`,+ )}+ >+ {rowItems.map((item) => {+ const isSelected = selected.includes(item.value);+ const isDisabled = disabled || item.disabled === true;+ const hasTopContent = item.topContent != null;+ const topVariant = item.topContentVariant ?? "icon";++ return (+ <div key={item.value} className="openui-option-cards__item">+ <button+ type="button"+ role={type === "single" ? "radio" : "checkbox"}+ aria-checked={isSelected}+ disabled={isDisabled}+ className={clsx(+ "openui-option-card",+ isSelected && "openui-option-card--selected",+ isDisabled && "openui-option-card--disabled",+ )}+ onClick={() => onToggle?.(item.value)}+ >+ <div className="openui-option-card__content">+ {hasTopContent ? (+ <div+ className={clsx(+ "openui-option-card__top",+ `openui-option-card__top--${topVariant}`,+ )}+ >+ {item.topContent}+ </div>+ ) : null}+ <div className="openui-option-card__text">+ <div className="openui-option-card__title">+ <InlineMarkdownRenderer content={item.title} />+ </div>+ {item.subtitle ? (+ <div className="openui-option-card__subtitle">+ <InlineMarkdownRenderer content={item.subtitle} />+ </div>+ ) : null}+ </div>+ </div>+ </button>+ </div>+ );+ })}+ </div>+ );+ })}+ </div>+ </div>+ );+});++OptionCards.displayName = "OptionCards";++export { OptionCards };diff --git a/packages/react-ui/src/components/OptionCards/index.ts b/packages/react-ui/src/components/OptionCards/index.tsnew file mode 100644index 000000000..131b983fd--- /dev/null+++ b/packages/react-ui/src/components/OptionCards/index.ts@@ -0,0 +1 @@+export * from "./OptionCards";diff --git a/packages/react-ui/src/components/OptionCards/optionCards.scss b/packages/react-ui/src/components/OptionCards/optionCards.scssnew file mode 100644index 000000000..8003deb87--- /dev/null+++ b/packages/react-ui/src/components/OptionCards/optionCards.scss@@ -0,0 +1,165 @@+@use "../../cssUtils" as cssUtils;++.openui-option-cards {+ width: 100%;+ container-type: inline-size;+}++.openui-option-cards__grid {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-m;+ width: 100%;+}++.openui-option-cards__row {+ display: grid;+ gap: cssUtils.$space-m;+ width: 100%;+ align-items: stretch;++ &--1 {+ grid-template-columns: 1fr;+ }++ &--2 {+ grid-template-columns: repeat(2, 1fr);+ }++ &--3 {+ grid-template-columns: repeat(3, 1fr);+ }+}++.openui-option-cards__item {+ width: 100%;+ min-width: 0;+}++.openui-option-cards__grid--responsive {+ @container (max-width: 768px) {+ display: grid;+ grid-template-columns: repeat(2, 1fr);++ .openui-option-cards__row {+ display: contents;+ }+ }++ @container (max-width: 480px) {+ grid-template-columns: 1fr;+ }+}++.openui-option-cards__grid--odd-count {+ @container (max-width: 768px) {+ .openui-option-cards__row:last-child > .openui-option-cards__item:last-child {+ grid-column: 1 / -1;+ }+ }+}++.openui-option-card {+ @include cssUtils.button-reset;+ display: flex;+ align-items: flex-start;+ justify-content: flex-start;+ width: 100%;+ height: 100%;+ box-sizing: border-box;+ padding: cssUtils.$space-s-m;+ border: 1px solid cssUtils.$border-interactive;+ border-radius: cssUtils.$radius-2xl;+ background: transparent;+ cursor: pointer;+ text-align: left;+ transition:+ opacity 0.16s ease-out,+ border-color 0.16s ease-out,+ background-color 0.16s ease-out;++ &:hover:not(:disabled):not(.openui-option-card--selected) {+ border-color: cssUtils.$border-interactive-emphasis;+ }++ &:focus-visible {+ outline: 2px solid cssUtils.$border-accent;+ outline-offset: 2px;+ }++ &--selected {+ background: cssUtils.$sunk;+ border-color: cssUtils.$border-interactive-selected;+ }++ &--disabled {+ opacity: 0.5;+ cursor: not-allowed;+ }+}++.openui-option-card__content {+ display: flex;+ flex-direction: column;+ align-items: flex-start;+ justify-content: flex-start;+ gap: cssUtils.$space-m;+ width: 100%;+}++.openui-option-card__top {+ align-self: flex-start;+ flex-shrink: 0;++ &--icon {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 2rem;+ height: 2rem;+ border-radius: cssUtils.$radius-s;+ background: cssUtils.$sunk;+ color: cssUtils.$text-neutral-primary;+ }++ &--image {+ width: 4.5rem;+ height: 4.5rem;+ border-radius: cssUtils.$radius-m;+ overflow: hidden;++ img {+ width: 100%;+ height: 100%;+ object-fit: cover;+ }+ }+}++.openui-option-card__text {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-3xs;+ min-width: 0;+}++.openui-option-card__title {+ color: cssUtils.$text-neutral-primary;+ word-wrap: break-word;+ overflow-wrap: break-word;+ @include cssUtils.typography(body, heavy);+}++.openui-option-card__subtitle {+ color: cssUtils.$text-neutral-secondary;+ word-wrap: break-word;+ overflow-wrap: break-word;+ @include cssUtils.typography(body, small);+}++.openui-option-card--disabled {+ .openui-option-card__title,+ .openui-option-card__subtitle {+ color: cssUtils.$text-neutral-tertiary;+ }+}diff --git a/packages/react-ui/src/components/OverviewCardBlock/OverviewCardBlock.tsx b/packages/react-ui/src/components/OverviewCardBlock/OverviewCardBlock.tsxnew file mode 100644index 000000000..56f4ea3e2--- /dev/null+++ b/packages/react-ui/src/components/OverviewCardBlock/OverviewCardBlock.tsx@@ -0,0 +1,93 @@+import clsx from "clsx";+import { ChevronRight } from "lucide-react";+import { forwardRef, type HTMLAttributes, type ReactNode } from "react";+import { CardBlockLayout, cardKeyDownHandler } from "../_shared/cards/CardBlockLayout";+import { MetricIndicatorInline, type MetricIndicatorInlineProps } from "../MetricIndicator";++export type OverviewCardBlockLayout = "grid" | "carousel";++export interface OverviewCardBlockItem {+ id?: string;+ /** Top slot content (typically an IconText / ImageText / Text). */+ top?: ReactNode;+ /** Bottom metric rendered with MetricIndicatorInline. */+ bottom?: Omit<MetricIndicatorInlineProps, "className">;+}++export interface OverviewCardBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, "onClick"> {+ items: OverviewCardBlockItem[];+ layout?: OverviewCardBlockLayout;+ /** Collapses the grid / shrinks carousel cards on narrow containers. */+ responsive?: boolean;+ /** Overrides the gap between cards (px number or any CSS length). */+ gap?: number | string;+ /** Renders the cards as buttons and fires `onItemClick`. */+ clickable?: boolean;+ onItemClick?: (item: OverviewCardBlockItem, index: number) => void;+ className?: string;+}++const OverviewCardBlock = forwardRef<HTMLDivElement, OverviewCardBlockProps>((props, ref) => {+ const {+ items,+ layout = "grid",+ responsive = true,+ gap,+ clickable = false,+ onItemClick,+ className,+ ...rest+ } = props;++ const isClickable = clickable && Boolean(onItemClick);++ return (+ <CardBlockLayout+ ref={ref}+ size="small"+ cardType="overview-card"+ data-card-type="OverviewCard"+ items={items ?? []}+ layout={layout}+ responsive={responsive}+ maxPerRow={3}+ gap={gap}+ className={className}+ itemKey={(item, index) => item.id ?? `overview-card-${index}`}+ renderItem={(item, index) => (+ <div+ className={clsx("openui-overview-card", isClickable && "openui-overview-card--clickable")}+ role={isClickable ? "button" : undefined}+ tabIndex={isClickable ? 0 : undefined}+ onClick={isClickable ? () => onItemClick?.(item, index) : undefined}+ onKeyDown={isClickable ? cardKeyDownHandler(() => onItemClick?.(item, index)) : undefined}+ >+ <div className="openui-overview-card__vertical">+ <div className="openui-overview-card__top-row">+ {item.top != null && (+ <div className="openui-overview-card__slot openui-overview-card__slot--top">+ {item.top}+ </div>+ )}+ {isClickable && (+ <div className="openui-overview-card__chevron" aria-hidden="true">+ <ChevronRight size={14} />+ </div>+ )}+ </div>+ {item.bottom && (+ <div className="openui-overview-card__slot openui-overview-card__slot--bottom">+ <MetricIndicatorInline {...item.bottom} />+ </div>+ )}+ </div>+ </div>+ )}+ {...rest}+ />+ );+});++OverviewCardBlock.displayName = "OverviewCardBlock";++export { OverviewCardBlock };diff --git a/packages/react-ui/src/components/OverviewCardBlock/index.ts b/packages/react-ui/src/components/OverviewCardBlock/index.tsnew file mode 100644index 000000000..c3bfa3598--- /dev/null+++ b/packages/react-ui/src/components/OverviewCardBlock/index.ts@@ -0,0 +1 @@+export * from "./OverviewCardBlock";diff --git a/packages/react-ui/src/components/OverviewCardBlock/overviewCardBlock.scss b/packages/react-ui/src/components/OverviewCardBlock/overviewCardBlock.scssnew file mode 100644index 000000000..5f91d1012--- /dev/null+++ b/packages/react-ui/src/components/OverviewCardBlock/overviewCardBlock.scss@@ -0,0 +1,84 @@+@use "../../cssUtils" as cssUtils;++.openui-overview-card {+ display: flex;+ flex-direction: column;+ width: 100%;+ min-width: 158px;+ padding: cssUtils.$space-s-m;+ border: 1px solid cssUtils.$border-default;+ border-radius: cssUtils.$radius-2xl;+ background-color: cssUtils.$sunk-light;+ transition:+ background-color 0.2s ease,+ border-color 0.2s ease,+ box-shadow 0.2s ease,+ transform 0.2s ease;++ &--clickable {+ background-color: cssUtils.$foreground;+ border-color: cssUtils.$border-interactive;+ box-shadow: cssUtils.$shadow-m;+ cursor: pointer;++ &:hover {+ box-shadow: none;+ transform: scale(0.995);+ }++ &:focus-visible {+ outline: 2px solid cssUtils.$border-accent;+ outline-offset: 2px;+ }+ }+}++.openui-overview-card__vertical {+ display: flex;+ flex: 1;+ flex-direction: column;+ justify-content: space-between;+ gap: cssUtils.$space-l;+ min-width: 0;+ min-height: 0;+}++.openui-overview-card__top-row {+ display: flex;+ flex-direction: row;+ align-items: flex-start;+ justify-content: space-between;+ gap: cssUtils.$space-s;+ width: 100%;+ min-width: 0;+}++.openui-overview-card__chevron {+ flex-shrink: 0;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ color: cssUtils.$text-neutral-secondary;+}++.openui-overview-card__slot {+ width: 100%;+ min-width: 0;+}++.openui-overview-card__slot--top {+ flex: 1;+ min-width: 0;+ width: auto;+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ gap: cssUtils.$space-s;+ min-height: cssUtils.$space-xl;+}++.openui-overview-card__slot--bottom {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-2xs;+}diff --git a/packages/react-ui/src/components/RadioItem/radioItem.scss b/packages/react-ui/src/components/RadioItem/radioItem.scssindex b4d062605..3a29db177 100644--- a/packages/react-ui/src/components/RadioItem/radioItem.scss+++ b/packages/react-ui/src/components/RadioItem/radioItem.scss@@ -92,7 +92,7 @@.openui-radio-item-label {flex: 1;- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);color: cssUtils.$text-neutral-primary;cursor: pointer;overflow-wrap: anywhere;diff --git a/packages/react-ui/src/components/SnippetCardBlock/SnippetCardBlock.tsx b/packages/react-ui/src/components/SnippetCardBlock/SnippetCardBlock.tsxnew file mode 100644index 000000000..0f3a9fc85--- /dev/null+++ b/packages/react-ui/src/components/SnippetCardBlock/SnippetCardBlock.tsx@@ -0,0 +1,116 @@+import clsx from "clsx";+import { ChevronRight } from "lucide-react";+import { forwardRef, type HTMLAttributes, type ReactNode } from "react";+import { CardBlockLayout, cardKeyDownHandler } from "../_shared/cards/CardBlockLayout";+import { TooltipWrapper } from "../TooltipWrapper";++export interface SnippetCardTooltip {+ heading?: string;+ content?: string;+}++export interface SnippetCardBlockItem {+ id?: string;+ /** Left-hand content (typically an IconText / ImageText). */+ lhs: ReactNode;+ /** Right-hand value content (typically a Text / BoldText). Chevron is shown instead when clickable and absent. */+ rhs?: ReactNode;+ /** Tooltip shown when the lhs text is truncated. */+ lhsTooltip?: SnippetCardTooltip;+ /** Tooltip shown when the rhs text is truncated. */+ rhsTooltip?: SnippetCardTooltip;+}++export interface SnippetCardBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, "onClick"> {+ items: SnippetCardBlockItem[];+ /** Collapses the grid to 2 / 1 columns on narrow containers. */+ responsive?: boolean;+ /** Overrides the gap between cards (px number or any CSS length). */+ gap?: number | string;+ /** Renders the cards as buttons and fires `onItemClick`. */+ clickable?: boolean;+ onItemClick?: (item: SnippetCardBlockItem, index: number) => void;+ className?: string;+}++const TEXT_BLOCK_HEADING_SELECTOR = ".openui-text-block__primary";+const TEXT_BLOCK_CONTENT_SELECTOR = ".openui-text-block__secondary";++const SnippetCardBlock = forwardRef<HTMLDivElement, SnippetCardBlockProps>((props, ref) => {+ const {+ items,+ responsive = true,+ gap,+ clickable = false,+ onItemClick,+ className,+ ...rest+ } = props;++ const isClickable = clickable && Boolean(onItemClick);++ return (+ <CardBlockLayout+ ref={ref}+ size="small"+ cardType="value-card"+ data-card-type="SnippetCard"+ items={items ?? []}+ layout="grid"+ responsive={responsive}+ maxPerRow={2}+ gap={gap}+ className={className}+ itemKey={(item, index) => item.id ?? `snippet-card-${index}`}+ renderItem={(item, index) => (+ <div+ className={clsx(+ "openui-value-card",+ !isClickable && "openui-value-card--static",+ isClickable && "openui-value-card--clickable",+ )}+ role={isClickable ? "button" : undefined}+ tabIndex={isClickable ? 0 : undefined}+ onClick={isClickable ? () => onItemClick?.(item, index) : undefined}+ onKeyDown={isClickable ? cardKeyDownHandler(() => onItemClick?.(item, index)) : undefined}+ >+ {item.lhs != null && (+ <TooltipWrapper+ tooltipHeading={item.lhsTooltip?.heading}+ tooltipContent={item.lhsTooltip?.content}+ showOnlyWhenTruncated+ headingSelector={TEXT_BLOCK_HEADING_SELECTOR}+ contentSelector={TEXT_BLOCK_CONTENT_SELECTOR}+ >+ <div className="openui-value-card__lhs">{item.lhs}</div>+ </TooltipWrapper>+ )}+ <div className="openui-value-card__rhs">+ {item.rhs != null ? (+ <TooltipWrapper+ tooltipHeading={item.rhsTooltip?.heading}+ tooltipContent={item.rhsTooltip?.content}+ showOnlyWhenTruncated+ headingSelector={TEXT_BLOCK_HEADING_SELECTOR}+ contentSelector={TEXT_BLOCK_CONTENT_SELECTOR}+ >+ <div className="openui-value-card__rhs-content">{item.rhs}</div>+ </TooltipWrapper>+ ) : (+ isClickable && (+ <div className="openui-value-card__chevron" aria-hidden="true">+ <ChevronRight size={14} />+ </div>+ )+ )}+ </div>+ </div>+ )}+ {...rest}+ />+ );+});++SnippetCardBlock.displayName = "SnippetCardBlock";++export { SnippetCardBlock };diff --git a/packages/react-ui/src/components/SnippetCardBlock/index.ts b/packages/react-ui/src/components/SnippetCardBlock/index.tsnew file mode 100644index 000000000..16d6ec6ab--- /dev/null+++ b/packages/react-ui/src/components/SnippetCardBlock/index.ts@@ -0,0 +1 @@+export * from "./SnippetCardBlock";diff --git a/packages/react-ui/src/components/SnippetCardBlock/snippetCardBlock.scss b/packages/react-ui/src/components/SnippetCardBlock/snippetCardBlock.scssnew file mode 100644index 000000000..410269ff9--- /dev/null+++ b/packages/react-ui/src/components/SnippetCardBlock/snippetCardBlock.scss@@ -0,0 +1,123 @@+@use "../../cssUtils" as cssUtils;++.openui-value-card {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: cssUtils.$space-m;+ width: 100%;+ min-width: 0;+ padding: cssUtils.$space-s-m;+ box-sizing: border-box;+ border: 1px solid cssUtils.$border-default;+ border-radius: cssUtils.$radius-2xl;+ background-color: cssUtils.$sunk-light;+ position: relative;+ overflow: hidden;+ transition:+ background-color 0.2s ease,+ border-color 0.2s ease,+ box-shadow 0.2s ease,+ transform 0.2s ease;++ &--static {+ background-color: cssUtils.$sunk-light;+ border-color: cssUtils.$border-default;+ box-shadow: none;+ }++ &--clickable {+ background-color: cssUtils.$foreground;+ border-color: cssUtils.$border-interactive;+ box-shadow: cssUtils.$shadow-s;+ cursor: pointer;++ &:hover {+ box-shadow: none;+ transform: scale(0.995);+ }++ &:focus-visible {+ outline: 2px solid cssUtils.$border-accent;+ outline-offset: 2px;+ }+ }+}++.openui-value-card__lhs {+ display: flex;+ align-items: center;+ min-width: 0;+ flex: 1;+}++.openui-value-card__lhs > * {+ min-width: 0;+}++.openui-value-card__rhs {+ flex-shrink: 1;+ display: flex;+ align-items: center;+ justify-content: flex-end;+ min-width: 0;+ margin-left: cssUtils.$space-m;+ color: cssUtils.$text-neutral-primary;+ @include cssUtils.typography(number, large-heavy);+}++.openui-value-card__rhs-content {+ display: flex;+ justify-content: flex-end;+ min-width: 0;+ max-width: 100%;+}++.openui-value-card__lhs .openui-icon-text,+.openui-value-card__lhs .openui-image-text,+.openui-value-card__lhs .openui-icon-text__content,+.openui-value-card__lhs .openui-image-text__content,+.openui-value-card__lhs .openui-text-block,+.openui-value-card__rhs-content,+.openui-value-card__rhs-content > *,+.openui-value-card__rhs .openui-text-block {+ min-width: 0;+}++.openui-value-card__lhs .openui-icon-text,+.openui-value-card__lhs .openui-image-text,+.openui-value-card__lhs .openui-text-block,+.openui-value-card__rhs-content {+ width: 100%;+ overflow: hidden;+}++.openui-value-card__rhs .openui-text-block {+ align-items: flex-end;+ width: auto;+ max-width: 100%;+ overflow: hidden;+ text-align: right;+}++.openui-value-card__lhs .openui-text-block__primary,+.openui-value-card__lhs .openui-text-block__secondary,+.openui-value-card__rhs .openui-text-block__primary,+.openui-value-card__rhs .openui-text-block__secondary {+ max-width: 100%;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}++.openui-value-card__rhs .openui-text-block--align-left {+ align-items: flex-end;+ text-align: right;+}++.openui-value-card__chevron {+ color: cssUtils.$text-neutral-secondary;+ display: inline-flex;+ align-items: center;+ justify-content: center;+}diff --git a/packages/react-ui/src/components/SourceFaviconImage/SourceFaviconImage.tsx b/packages/react-ui/src/components/SourceFaviconImage/SourceFaviconImage.tsxnew file mode 100644index 000000000..cc092a189--- /dev/null+++ b/packages/react-ui/src/components/SourceFaviconImage/SourceFaviconImage.tsx@@ -0,0 +1,57 @@+import { memo, useEffect, useRef, useState } from "react";+import { IconWrapper } from "../_shared/icons";++export interface SourceFaviconImageProps {+ height: number;+ width: number;+ url: string;+ alt: string;+}++/**+ * Favicon image with a globe-icon fallback. Google's favicon service returns a+ * 16x16 placeholder when it has nothing better, which is treated as a miss.+ */+export const SourceFaviconImage = memo(({ height, width, url, alt }: SourceFaviconImageProps) => {+ const ref = useRef<HTMLImageElement>(null);+ const [imageError, setImageError] = useState(false);++ // A new url gets a fresh chance to load; without this the previous url's+ // failure would keep the globe fallback pinned.+ useEffect(() => {+ setImageError(false);+ }, [url]);++ const onSuccess = () => {+ const img = ref.current;+ // Google's default favicon is 16x16. If we get that, it's likely a fallback.+ if (img && img.naturalWidth <= 16 && img.naturalHeight <= 16) {+ setImageError(true);+ } else {+ setImageError(false);+ }+ };++ const onError = () => {+ setImageError(true);+ };++ if (imageError || !url) {+ return <IconWrapper name="globe" size={Math.max(height, width)} />;+ }++ return (+ <img+ ref={ref}+ src={url}+ alt={alt}+ height={height}+ width={width}+ onLoad={onSuccess}+ onError={onError}+ className="openui-source-favicon-image"+ />+ );+});++SourceFaviconImage.displayName = "SourceFaviconImage";diff --git a/packages/react-ui/src/components/SourceFaviconImage/index.ts b/packages/react-ui/src/components/SourceFaviconImage/index.tsnew file mode 100644index 000000000..52f5643dd--- /dev/null+++ b/packages/react-ui/src/components/SourceFaviconImage/index.ts@@ -0,0 +1,2 @@+export { SourceFaviconImage } from "./SourceFaviconImage";+export type { SourceFaviconImageProps } from "./SourceFaviconImage";diff --git a/packages/react-ui/src/components/SourceFaviconImage/sourceFaviconImage.scss b/packages/react-ui/src/components/SourceFaviconImage/sourceFaviconImage.scssnew file mode 100644index 000000000..848b65699--- /dev/null+++ b/packages/react-ui/src/components/SourceFaviconImage/sourceFaviconImage.scss@@ -0,0 +1,4 @@+.openui-source-favicon-image {+ object-fit: cover;+ display: flex;+}diff --git a/packages/react-ui/src/components/Sources/ListedSources.tsx b/packages/react-ui/src/components/Sources/ListedSources.tsxnew file mode 100644index 000000000..712acabc4--- /dev/null+++ b/packages/react-ui/src/components/Sources/ListedSources.tsx@@ -0,0 +1,84 @@+import clsx from "clsx";+import { ChevronLeft, ChevronRight } from "lucide-react";+import { Key, memo, useCallback, useRef, useState } from "react";+import { Carousel, CarouselContent, CarouselItem, CarouselRef } from "../Carousel";+import { IconButton } from "../IconButton";+import { SourceWithFavicon } from "./SourceContext";+import { ListedSourceItem } from "./SourcesItem";++export interface ListedSourcesProps {+ sources: SourceWithFavicon[];+}++export const ListedSources = memo((props: ListedSourcesProps) => {+ const sources = props.sources ?? [];++ const ref = useRef<CarouselRef | null>(null);+ const [scroll, setScroll] = useState({ left: false, right: false });++ const handleScrollLeftEnabled = useCallback((enabled: boolean) => {+ setScroll((prev) => ({ ...prev, left: enabled }));+ }, []);++ const handleScrollRightEnabled = useCallback((enabled: boolean) => {+ setScroll((prev) => ({ ...prev, right: enabled }));+ }, []);++ if (!sources.length) return null;++ // Show buttons only if there's overflow (can scroll left or right)+ const hasOverflow = scroll.left || scroll.right;++ return (+ <div className="openui-listed-sources">+ <div className="openui-listed-sources-header">+ <span className="openui-listed-sources-header__title">Sources</span>+ {hasOverflow && (+ <div className="openui-listed-sources-header__buttons">+ <IconButton+ variant="secondary"+ size="small"+ onClick={() => ref.current?.scroll("left")}+ disabled={!scroll.left}+ icon={<ChevronLeft />}+ />+ <IconButton+ variant="secondary"+ size="small"+ onClick={() => ref.current?.scroll("right")}+ disabled={!scroll.right}+ icon={<ChevronRight />}+ />+ </div>+ )}+ </div>+ <Carousel+ variant="sunk"+ ref={ref}+ showButtons={false}+ onScrollLeftEnabled={handleScrollLeftEnabled}+ onScrollRightEnabled={handleScrollRightEnabled}+ >+ <CarouselContent>+ {sources.map((item: SourceWithFavicon, index: number) => {+ const { key: _key, ...rest } = item as SourceWithFavicon & {+ key?: Key;+ };+ return (+ <CarouselItem+ key={item.url ?? index}+ className={clsx("openui-listed-sources-item-container", {+ "openui-listed-sources-item-container--has-url": item.url,+ })}+ >+ <ListedSourceItem {...rest} sourceId={index} />+ </CarouselItem>+ );+ })}+ </CarouselContent>+ </Carousel>+ </div>+ );+});++ListedSources.displayName = "ListedSources";diff --git a/packages/react-ui/src/components/Sources/SourceContext.tsx b/packages/react-ui/src/components/Sources/SourceContext.tsxnew file mode 100644index 000000000..2b26589d0--- /dev/null+++ b/packages/react-ui/src/components/Sources/SourceContext.tsx@@ -0,0 +1,80 @@+import { createContext, Key, ReactNode, useContext, useMemo } from "react";+import { z } from "zod/v4";+import { safeOpenUrl } from "../_shared/utils";++export const CardSourceSchema = z.object({+ url: z.string().optional(),+ title: z.string(),+ sourceName: z.string(),+});++export type CardSource = z.infer<typeof CardSourceSchema>;++export interface SourceWithFavicon extends CardSource {+ faviconUrl: string;+ key?: Key;+}++export const openSourceInNewTab = (url?: string) => {+ safeOpenUrl(url);+};++/**+ * React context that provides enriched source data to child components.+ * Contains sources with favicon URLs, source IDs, and validation status.+ */+export const CardSourceContext = createContext<SourceWithFavicon[] | undefined>(undefined);++/**+ * Returns the favicon URL for a given website using Google's favicon service.+ *+ * Attempts to parse the provided URL string and extract the hostname (domain).+ * If parsing succeeds, returns a URL (with size 128) from Google's s2/favicons API.+ * If the URL is invalid or parsing fails, returns an empty string.+ */+export const getFaviconUrl = (url?: string) => {+ try {+ if (!url) {+ return "";+ }+ const parsedUrl = new URL(url);+ const domain = parsedUrl.hostname;+ return `https://www.google.com/s2/favicons?sz=128&domain=${domain}`;+ } catch {+ return "";+ }+};++/**+ * Context provider that enriches sources with favicon URLs.+ * Generates favicon URLs from Google's service for each source.+ */+export const CardSourceProvider = ({+ sources,+ children,+}: {+ sources: CardSource[] | undefined;+ children: ReactNode;+}) => {+ const enrichedSources = useMemo<SourceWithFavicon[]>(() => {+ return (+ sources?.map((source) => ({+ ...source,+ faviconUrl: getFaviconUrl(source.url),+ })) ?? []+ );+ }, [sources]);++ return (+ <CardSourceContext.Provider value={enrichedSources}>{children}</CardSourceContext.Provider>+ );+};++/**+ * Hook to access all enriched sources from CardSourceContext.+ * Returns array of SourceWithFavicon objects, or empty array if context unavailable.+ */+export const useCardSourceContext = (): SourceWithFavicon[] => {+ const context = useContext(CardSourceContext);+ return context ?? [];+};diff --git a/packages/react-ui/src/components/Sources/Sources.tsx b/packages/react-ui/src/components/Sources/Sources.tsxnew file mode 100644index 000000000..e1dd135b9--- /dev/null+++ b/packages/react-ui/src/components/Sources/Sources.tsx@@ -0,0 +1,18 @@+import { memo } from "react";+import { ListedSources } from "./ListedSources";+import { useCardSourceContext } from "./SourceContext";++/**+ * Renders the sources strip for the enclosing `CardSourceProvider`.+ * Returns null when there are no sources.+ */+export const Sources = memo(() => {+ const sources = useCardSourceContext();++ if (!sources.length) {+ return null;+ }+ return <ListedSources sources={sources} />;+});++Sources.displayName = "Sources";diff --git a/packages/react-ui/src/components/Sources/SourcesItem.tsx b/packages/react-ui/src/components/Sources/SourcesItem.tsxnew file mode 100644index 000000000..2f90ea0de--- /dev/null+++ b/packages/react-ui/src/components/Sources/SourcesItem.tsx@@ -0,0 +1,45 @@+import clsx from "clsx";+import { memo } from "react";+import { SourceFaviconImage } from "../SourceFaviconImage";+import { openSourceInNewTab, SourceWithFavicon } from "./SourceContext";++export interface SourcesItemComponentProps extends SourceWithFavicon {+ onClick?: () => void;+ sourceId: number;+}++export const ListedSourceItem = memo((props: SourcesItemComponentProps) => {+ const { title, sourceName, onClick, faviconUrl, url, sourceId } = props;+ const handleClick = () => {+ openSourceInNewTab(url);+ onClick?.();+ };+ const hasUrl = url && url.trim() !== "";+ return (+ <div+ className={clsx("openui-listed-source-item", {+ "openui-listed-source-item--has-url": hasUrl,+ })}+ onClick={handleClick}+ role="button"+ tabIndex={0}+ data-source-id={sourceId}+ onKeyDown={(event) => {+ if (event.key === "Enter" || event.key === " ") {+ event.preventDefault();+ handleClick();+ }+ }}+ >+ <div className="openui-listed-source-item__header">+ <div className="openui-listed-source-item__logo">+ <SourceFaviconImage url={faviconUrl} alt={sourceName} width={20} height={20} />+ </div>+ <span className="openui-listed-source-item__source-name">{sourceName}</span>+ </div>+ <div className="openui-listed-source-item__title">{title}</div>+ </div>+ );+});++ListedSourceItem.displayName = "ListedSourceItem";diff --git a/packages/react-ui/src/components/Sources/index.ts b/packages/react-ui/src/components/Sources/index.tsnew file mode 100644index 000000000..75c82cb05--- /dev/null+++ b/packages/react-ui/src/components/Sources/index.ts@@ -0,0 +1,14 @@+export { ListedSources } from "./ListedSources";+export type { ListedSourcesProps } from "./ListedSources";+export {+ CardSourceContext,+ CardSourceProvider,+ CardSourceSchema,+ getFaviconUrl,+ openSourceInNewTab,+ useCardSourceContext,+} from "./SourceContext";+export type { CardSource, SourceWithFavicon } from "./SourceContext";+export { Sources } from "./Sources";+export { ListedSourceItem } from "./SourcesItem";+export type { SourcesItemComponentProps } from "./SourcesItem";diff --git a/packages/react-ui/src/components/Sources/sources.scss b/packages/react-ui/src/components/Sources/sources.scssnew file mode 100644index 000000000..22ce91506--- /dev/null+++ b/packages/react-ui/src/components/Sources/sources.scss@@ -0,0 +1,135 @@+@use "../../cssUtils" as cssUtils;++.openui-listed-sources-item-container {+ width: 180px !important;+ padding: cssUtils.$space-000 !important;+ border-radius: cssUtils.$radius-l !important;+ overflow: hidden;+ background-color: transparent !important;+ &--has-url {+ &:hover {+ background-color: cssUtils.$highlight-subtle !important;+ border-color: cssUtils.$border-interactive !important;+ }+ }+}++.openui-listed-source-item {+ display: flex;+ flex-direction: column;+ align-items: flex-start;+ gap: cssUtils.$space-2xs;+ padding: cssUtils.$space-s;+ height: 100%;+ &--has-url {+ cursor: pointer;+ }+ &__header {+ display: flex;+ align-items: flex-start;+ gap: cssUtils.$space-s;+ }++ &__source-name {+ color: cssUtils.$text-neutral-primary;+ @include cssUtils.typography(label, small);+ }+ &__title {+ color: cssUtils.$text-neutral-secondary;+ @include cssUtils.typography(body, small);+ }+ &__logo {+ flex-shrink: 0;+ width: 20px;+ height: 20px;+ display: flex;+ align-items: center;+ justify-content: center;+ border: 1px solid cssUtils.$border-default;+ border-radius: cssUtils.$radius-s;+ box-sizing: border-box;+ overflow: hidden;+ }+}++.openui-listed-sources {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-m;++ &-header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: cssUtils.$space-s;++ &__title {+ color: cssUtils.$text-neutral-secondary;+ @include cssUtils.typography(label, heavy);+ }++ &__buttons {+ display: flex;+ align-items: center;+ justify-content: center;+ gap: cssUtils.$space-s;+ }+ }++ &-item {+ display: flex;+ flex-direction: column;+ align-items: flex-start;+ padding: cssUtils.$space-s;+ border-radius: cssUtils.$radius-m;+ border: 1px solid cssUtils.$border-default;+ cursor: pointer;+ text-align: left;+ width: 180px;++ &__header {+ display: flex;+ align-items: center;+ gap: cssUtils.$space-s;+ }++ &__source-name {+ color: cssUtils.$text-neutral-secondary;+ @include cssUtils.typography(label, small);+ white-space: nowrap;+ flex-shrink: 0;+ }+ &__title {+ color: cssUtils.$text-neutral-secondary;+ @include cssUtils.typography(body, small);+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }+ &__date-range {+ color: cssUtils.$text-neutral-secondary;+ @include cssUtils.typography(body, small);+ white-space: nowrap;+ flex-shrink: 0;+ }+ &__logo {+ flex-shrink: 0;+ width: 24px;+ height: 24px;+ display: flex;+ align-items: center;+ justify-content: center;+ border: 1px solid cssUtils.$border-default;+ border-radius: cssUtils.$radius-s;+ overflow: hidden;++ &-image {+ border-radius: cssUtils.$radius-s;+ overflow: hidden;+ display: flex;+ align-items: center;+ justify-content: center;+ }+ }+ }+}diff --git a/packages/react-ui/src/components/SwitchItem/switchItem.scss b/packages/react-ui/src/components/SwitchItem/switchItem.scssindex 8f3243678..d931d3ab2 100644--- a/packages/react-ui/src/components/SwitchItem/switchItem.scss+++ b/packages/react-ui/src/components/SwitchItem/switchItem.scss@@ -64,7 +64,7 @@.openui-switch-item-label {flex: 1;- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);color: cssUtils.$text-neutral-primary;&:disabled {color: cssUtils.$text-neutral-tertiary;diff --git a/packages/react-ui/src/components/TextBlock/TextBlock.tsx b/packages/react-ui/src/components/TextBlock/TextBlock.tsxnew file mode 100644index 000000000..42edeb120--- /dev/null+++ b/packages/react-ui/src/components/TextBlock/TextBlock.tsx@@ -0,0 +1,100 @@+import clsx from "clsx";+import { forwardRef } from "react";+import { InlineMarkdownRenderer } from "../InlineMarkdownRenderer";++export type TextBlockVariant =+ | "title-text"+ | "number-title-text"+ | "text-subtext"+ | "highlight-text-number-subtext"+ | "text"+ | "highlight-text"+ | "number"+ | "highlight-number";++export type TextBlockType = "text" | "number" | "textOnly";+export type TextBlockSize = "xs" | "sm" | "md" | "lg";+export type TextBlockAlign = "left" | "center" | "right";+export type TextBlockSecondaryTone = "positive" | "negative";++export interface TextBlockViewProps {+ primary: string;+ secondary?: string;+ tertiary?: string;+ variant?: TextBlockVariant;+ type?: TextBlockType;+ size?: TextBlockSize;+ align?: TextBlockAlign;+ secondaryMaxLines?: number;+ secondaryTone?: TextBlockSecondaryTone;+ className?: string;+}++/**+ * Low-level text primitive for card content: a primary line with optional+ * secondary/tertiary lines. `variant`, `size`, `type` and `align` control+ * emphasis, spacing and number styling.+ */+export const TextBlockView = forwardRef<HTMLDivElement, TextBlockViewProps>(+ (+ {+ primary,+ secondary,+ tertiary,+ variant = "title-text",+ type = "text",+ size = "sm",+ align = "left",+ secondaryMaxLines,+ secondaryTone,+ className,+ },+ ref,+ ) => {+ const secondaryClassName = clsx(+ "openui-text-block__secondary",+ secondaryTone && `openui-text-block__secondary--${secondaryTone}`,+ );+ const secondaryStyle =+ secondaryMaxLines !== undefined+ ? {+ display: "-webkit-box",+ WebkitLineClamp: secondaryMaxLines,+ WebkitBoxOrient: "vertical" as const,+ overflow: "hidden",+ textOverflow: "ellipsis",+ }+ : undefined;++ return (+ <div+ ref={ref}+ className={clsx(+ "openui-text-block",+ `openui-text-block--${variant}`,+ `openui-text-block--size-${size}`,+ `openui-text-block--align-${align}`,+ `openui-text-block--type-${type}`,+ className,+ )}+ >+ <InlineMarkdownRenderer content={primary} className="openui-text-block__primary" />+ {secondary &&+ (secondaryStyle ? (+ // The line-clamp style needs its own block element — the markdown+ // renderer has no style passthrough.+ <div className={secondaryClassName} style={secondaryStyle}>+ <InlineMarkdownRenderer content={secondary} />+ </div>+ ) : (+ <InlineMarkdownRenderer content={secondary} className={secondaryClassName} />+ ))}+ {tertiary && (+ <InlineMarkdownRenderer content={tertiary} className="openui-text-block__tertiary" />+ )}+ </div>+ );+ },+);++TextBlockView.displayName = "TextBlockView";diff --git a/packages/react-ui/src/components/TextBlock/index.ts b/packages/react-ui/src/components/TextBlock/index.tsnew file mode 100644index 000000000..bdc491760--- /dev/null+++ b/packages/react-ui/src/components/TextBlock/index.ts@@ -0,0 +1 @@+export * from "./TextBlock";diff --git a/packages/react-ui/src/components/TextBlock/textBlock.scss b/packages/react-ui/src/components/TextBlock/textBlock.scssnew file mode 100644index 000000000..23808f042--- /dev/null+++ b/packages/react-ui/src/components/TextBlock/textBlock.scss@@ -0,0 +1,428 @@+@use "../../cssUtils" as cssUtils;++.openui-text-block {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-3xs;+ align-items: flex-start;+ text-align: left;+}++.openui-text-block__primary {+ color: cssUtils.$text-neutral-primary;+}++.openui-text-block__secondary {+ color: cssUtils.$text-neutral-secondary;+}++.openui-text-block__secondary--positive {+ color: cssUtils.$text-success-primary;+}++.openui-text-block__secondary--negative {+ color: cssUtils.$text-danger-primary;+}++.openui-text-block__tertiary {+ display: none;+}++.openui-text-block--title-text .openui-text-block__primary {+ @include cssUtils.typography(heading, medium);+}++.openui-text-block--title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--number-title-text .openui-text-block__primary {+ @include cssUtils.typography(number, title-medium);+}++.openui-text-block--number-title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--text-subtext .openui-text-block__primary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--text-subtext .openui-text-block__secondary {+ @include cssUtils.typography(body, small);+}++.openui-text-block--highlight-text-number-subtext {+ gap: 0;+}++.openui-text-block--highlight-text-number-subtext .openui-text-block__primary {+ @include cssUtils.typography(body, heavy);+}++.openui-text-block--highlight-text-number-subtext .openui-text-block__secondary {+ @include cssUtils.typography(body, small);+}++.openui-text-block--text .openui-text-block__primary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--highlight-text .openui-text-block__primary {+ @include cssUtils.typography(body, heavy);+}++.openui-text-block--number .openui-text-block__primary {+ @include cssUtils.typography(number, heavy);+}++.openui-text-block--highlight-number .openui-text-block__primary {+ @include cssUtils.typography(number, large-heavy);+}++.openui-text-block--size-xs.openui-text-block--title-text,+.openui-text-block--size-xs.openui-text-block--number-title-text {+ gap: 0;+}++.openui-text-block--size-xs.openui-text-block--title-text .openui-text-block__primary {+ @include cssUtils.typography(heading, extra-small);+}++.openui-text-block--size-xs.openui-text-block--title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, small);+}++.openui-text-block--size-xs.openui-text-block--number-title-text .openui-text-block__primary {+ @include cssUtils.typography(number, heavy);+}++.openui-text-block--size-xs.openui-text-block--number-title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, small);+}++.openui-text-block--size-xs.openui-text-block--text .openui-text-block__primary {+ @include cssUtils.typography(body, small);+}++.openui-text-block--size-xs.openui-text-block--text.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, small);+}++.openui-text-block--size-xs.openui-text-block--text-subtext,+.openui-text-block--size-xs.openui-text-block--highlight-text-number-subtext {+ gap: 0;+}++.openui-text-block--size-xs.openui-text-block--text-subtext .openui-text-block__primary {+ @include cssUtils.typography(body, small);+}++.openui-text-block--size-xs.openui-text-block--text-subtext.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, small);+}++.openui-text-block--size-xs.openui-text-block--highlight-text-number-subtext+ .openui-text-block__primary {+ @include cssUtils.typography(body, small-heavy);+}++.openui-text-block--size-xs.openui-text-block--highlight-text-number-subtext.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, small-heavy);+}++.openui-text-block--size-xs.openui-text-block--text-subtext .openui-text-block__secondary,+.openui-text-block--size-xs.openui-text-block--highlight-text-number-subtext+ .openui-text-block__secondary {+ @include cssUtils.typography(body, small);+}++.openui-text-block--size-xs.openui-text-block--highlight-text-number-subtext.openui-text-block--type-number+ .openui-text-block__secondary {+ @include cssUtils.typography(number, small);+}++.openui-text-block--size-xs.openui-text-block--number .openui-text-block__primary {+ @include cssUtils.typography(number, small);+}++.openui-text-block--size-xs.openui-text-block--highlight-number .openui-text-block__primary {+ @include cssUtils.typography(number, small-heavy);+}++.openui-text-block--size-xs.openui-text-block--highlight-text .openui-text-block__primary {+ @include cssUtils.typography(body, small-heavy);+}++.openui-text-block--size-sm.openui-text-block--title-text,+.openui-text-block--size-sm.openui-text-block--number-title-text {+ gap: cssUtils.$space-3xs;+}++.openui-text-block--size-sm.openui-text-block--title-text .openui-text-block__primary {+ @include cssUtils.typography(heading, small);+}++.openui-text-block--size-sm.openui-text-block--title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-sm.openui-text-block--number-title-text .openui-text-block__primary {+ @include cssUtils.typography(number, large-heavy);+}++.openui-text-block--size-sm.openui-text-block--number-title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-sm.openui-text-block--text .openui-text-block__primary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-sm.openui-text-block--text.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, default);+}++.openui-text-block--size-sm.openui-text-block--text-subtext,+.openui-text-block--size-sm.openui-text-block--highlight-text-number-subtext {+ gap: 0;+}++.openui-text-block--size-sm.openui-text-block--text-subtext .openui-text-block__primary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-sm.openui-text-block--text-subtext.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, default);+}++.openui-text-block--size-sm.openui-text-block--highlight-text-number-subtext+ .openui-text-block__primary {+ @include cssUtils.typography(body, heavy);+}++.openui-text-block--size-sm.openui-text-block--highlight-text-number-subtext.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, heavy);+}++.openui-text-block--size-sm.openui-text-block--text-subtext .openui-text-block__secondary,+.openui-text-block--size-sm.openui-text-block--highlight-text-number-subtext+ .openui-text-block__secondary {+ @include cssUtils.typography(body, small);+}++.openui-text-block--size-sm.openui-text-block--highlight-text-number-subtext.openui-text-block--type-number+ .openui-text-block__secondary {+ @include cssUtils.typography(number, small);+}++.openui-text-block--size-sm.openui-text-block--number .openui-text-block__primary {+ @include cssUtils.typography(number, small);+}++.openui-text-block--size-sm.openui-text-block--highlight-number .openui-text-block__primary {+ @include cssUtils.typography(number, heavy);+}++.openui-text-block--size-sm.openui-text-block--highlight-text {+ gap: 0;+}++.openui-text-block--size-sm.openui-text-block--highlight-text .openui-text-block__secondary {+ @include cssUtils.typography(body, small);+}++.openui-text-block--size-sm.openui-text-block--highlight-text .openui-text-block__primary {+ @include cssUtils.typography(body, heavy);+}++.openui-text-block--size-md.openui-text-block--title-text,+.openui-text-block--size-md.openui-text-block--number-title-text {+ gap: cssUtils.$space-xs;+}++.openui-text-block--size-md.openui-text-block--title-text .openui-text-block__primary {+ @include cssUtils.typography(heading, medium);+}++.openui-text-block--size-md.openui-text-block--title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-md.openui-text-block--number-title-text .openui-text-block__primary {+ @include cssUtils.typography(number, title-medium);+}++.openui-text-block--size-md.openui-text-block--number-title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-md.openui-text-block--text-subtext,+.openui-text-block--size-md.openui-text-block--highlight-text,+.openui-text-block--size-md.openui-text-block--highlight-text-number-subtext {+ gap: 0;+}++.openui-text-block--size-md.openui-text-block--highlight-text .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-md.openui-text-block--highlight-text .openui-text-block__primary {+ @include cssUtils.typography(body, heavy);+}++.openui-text-block--size-md.openui-text-block--text-subtext .openui-text-block__primary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-md.openui-text-block--text-subtext.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, default);+}++.openui-text-block--size-md.openui-text-block--highlight-text-number-subtext+ .openui-text-block__primary {+ @include cssUtils.typography(body, heavy);+}++.openui-text-block--size-md.openui-text-block--highlight-text-number-subtext.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, heavy);+}++.openui-text-block--size-md.openui-text-block--text-subtext .openui-text-block__secondary,+.openui-text-block--size-md.openui-text-block--highlight-text-number-subtext+ .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-md.openui-text-block--text-subtext.openui-text-block--type-number+ .openui-text-block__secondary {+ @include cssUtils.typography(number, default);+}++.openui-text-block--size-md.openui-text-block--highlight-text-number-subtext.openui-text-block--type-number+ .openui-text-block__secondary {+ @include cssUtils.typography(number, default);+}++.openui-text-block--size-md.openui-text-block--text.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, default);+}++.openui-text-block--size-md.openui-text-block--number .openui-text-block__primary {+ @include cssUtils.typography(number, default);+}++.openui-text-block--size-md.openui-text-block--highlight-number .openui-text-block__primary {+ @include cssUtils.typography(number, heavy);+}++.openui-text-block--size-lg.openui-text-block--text .openui-text-block__primary {+ @include cssUtils.typography(body, large);+}++.openui-text-block--size-lg.openui-text-block--text.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, large);+}++.openui-text-block--size-lg.openui-text-block--text-subtext,+.openui-text-block--size-lg.openui-text-block--highlight-text,+.openui-text-block--size-lg.openui-text-block--highlight-text-number-subtext {+ gap: 0;+}++.openui-text-block--size-lg.openui-text-block--highlight-text .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-lg.openui-text-block--highlight-text .openui-text-block__primary {+ @include cssUtils.typography(body, large-heavy);+}++.openui-text-block--size-lg.openui-text-block--text-subtext .openui-text-block__primary {+ @include cssUtils.typography(body, large);+}++.openui-text-block--size-lg.openui-text-block--text-subtext.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, large);+}++.openui-text-block--size-lg.openui-text-block--highlight-text-number-subtext+ .openui-text-block__primary {+ @include cssUtils.typography(body, large-heavy);+}++.openui-text-block--size-lg.openui-text-block--highlight-text-number-subtext.openui-text-block--type-number+ .openui-text-block__primary {+ @include cssUtils.typography(number, large-heavy);+}++.openui-text-block--size-lg.openui-text-block--text-subtext .openui-text-block__secondary,+.openui-text-block--size-lg.openui-text-block--highlight-text-number-subtext+ .openui-text-block__secondary {+ @include cssUtils.typography(body, default);+}++.openui-text-block--size-lg.openui-text-block--text-subtext.openui-text-block--type-number+ .openui-text-block__secondary {+ @include cssUtils.typography(number, default);+}++.openui-text-block--size-lg.openui-text-block--highlight-text-number-subtext.openui-text-block--type-number+ .openui-text-block__secondary {+ @include cssUtils.typography(number, default);+}++.openui-text-block--size-lg.openui-text-block--number .openui-text-block__primary {+ @include cssUtils.typography(number, large);+}++.openui-text-block--size-lg.openui-text-block--highlight-number .openui-text-block__primary {+ @include cssUtils.typography(number, large-heavy);+}++.openui-text-block--size-lg.openui-text-block--title-text,+.openui-text-block--size-lg.openui-text-block--number-title-text {+ gap: cssUtils.$space-xs;+}++.openui-text-block--size-lg.openui-text-block--title-text .openui-text-block__primary {+ @include cssUtils.typography(heading, large);+}++.openui-text-block--size-lg.openui-text-block--title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, large);+}++.openui-text-block--size-lg.openui-text-block--number-title-text .openui-text-block__primary {+ @include cssUtils.typography(number, title);+}++.openui-text-block--size-lg.openui-text-block--number-title-text .openui-text-block__secondary {+ @include cssUtils.typography(body, large);+}++.openui-text-block--align-left {+ align-items: flex-start;+ text-align: left;+}++.openui-text-block--align-center {+ align-items: center;+ text-align: center;+}++.openui-text-block--align-right {+ align-items: flex-end;+ text-align: right;+}diff --git a/packages/react-ui/src/components/TextContent/textContent.scss b/packages/react-ui/src/components/TextContent/textContent.scssindex 9d33566d5..1295f98a9 100644--- a/packages/react-ui/src/components/TextContent/textContent.scss+++ b/packages/react-ui/src/components/TextContent/textContent.scss@@ -18,7 +18,7 @@.text-content {box-sizing: border-box;color: cssUtils.$text-neutral-primary;- @include cssUtils.typography(primary, default);+ @include cssUtils.typography(body, default);border: 1px solid;&-sunk {diff --git a/packages/react-ui/src/components/TextContentWrapper/TextContentWrapper.tsx b/packages/react-ui/src/components/TextContentWrapper/TextContentWrapper.tsxnew file mode 100644index 000000000..4b599142a--- /dev/null+++ b/packages/react-ui/src/components/TextContentWrapper/TextContentWrapper.tsx@@ -0,0 +1,83 @@+import clsx from "clsx";+import { memo, useEffect, useState } from "react";+import remarkBreaks from "remark-breaks";+import remarkGfm from "remark-gfm";+import remarkMath from "remark-math";+import { remarkCitations } from "../_shared/remark/remarkCitations";+import { TextContentCitation } from "../Citation";+import { InlineHeader } from "../InlineHeader";+import { MarkDownRenderer } from "../MarkDownRenderer";+import { useTheme } from "../ThemeProvider";++export interface TextContentWrapperProps {+ textMarkdown: string;+ header?: { heading: string; description?: string };+ variant?: "clear" | "card" | "sunk";+ className?: string;+}++// rehype-katex is loaded dynamically (and only on the client) because it+// transitively pulls in `hast-util-from-html-isomorphic`, which calls+// `new DOMParser()` at module load. On Node (Next.js SSR, build-time+// prerender) DOMParser is undefined and the page 500s before any of our+// own code runs. Initial SSR pass renders math as raw `$…$` text; after+// hydration the plugin loads and the next render replaces it with the+// rendered KaTeX. Acceptable trade-off vs. switching markdown stacks.+type RehypePlugin = NonNullable<+ Parameters<typeof MarkDownRenderer>[0]["options"]+>["rehypePlugins"] extends Array<infer T> | undefined+ ? T+ : never;++/**+ * Full-featured markdown block for chat responses: GFM, math (KaTeX),+ * line breaks, and inline `[n]` citations resolved against the enclosing+ * `CardSourceProvider`.+ */+export const TextContentWrapper = memo((props: TextContentWrapperProps) => {+ const { mode } = useTheme();+ const [rehypeKatex, setRehypeKatex] = useState<RehypePlugin | null>(null);++ useEffect(() => {+ let cancelled = false;+ import("rehype-katex").then((m) => {+ if (!cancelled) setRehypeKatex(() => m.default as RehypePlugin);+ });+ return () => {+ cancelled = true;+ };+ }, []);++ return (+ <div className={clsx("openui-text-content", props.className)}>+ {props.header && (+ <InlineHeader heading={props.header.heading} description={props.header.description} />+ )}+ <MarkDownRenderer+ textMarkdown={props.textMarkdown}+ variant={props.variant}+ options={{+ remarkPlugins: [+ // singleTilde: false → only ~~double tildes~~ render as strikethrough.+ // A lone ~ (e.g. "~$886K" meaning "approximately") stays literal instead+ // of being parsed as a strikethrough delimiter, which otherwise strikes+ // through everything between two such tildes in a sentence.+ [remarkGfm, { singleTilde: false }],+ [remarkMath, { singleDollarTextMath: false }],+ [remarkBreaks, { breaks: true }],+ remarkCitations,+ ],+ rehypePlugins: rehypeKatex ? [rehypeKatex] : [],+ components: {+ span: TextContentCitation,+ },+ }}+ className={clsx("openui-text-content-markdown", {+ "openui-text-content-markdown-dark-mode": mode === "dark",+ })}+ />+ </div>+ );+});++TextContentWrapper.displayName = "TextContentWrapper";diff --git a/packages/react-ui/src/components/TextContentWrapper/index.ts b/packages/react-ui/src/components/TextContentWrapper/index.tsnew file mode 100644index 000000000..76abdb6a2--- /dev/null+++ b/packages/react-ui/src/components/TextContentWrapper/index.ts@@ -0,0 +1 @@+export * from "./TextContentWrapper";diff --git a/packages/react-ui/src/components/TextContentWrapper/textContentWrapper.scss b/packages/react-ui/src/components/TextContentWrapper/textContentWrapper.scssnew file mode 100644index 000000000..3666a1840--- /dev/null+++ b/packages/react-ui/src/components/TextContentWrapper/textContentWrapper.scss@@ -0,0 +1,185 @@+@use "../../cssUtils" as cssUtils;++.openui-text-content-markdown {+ color: cssUtils.$text-neutral-primary;+ @include cssUtils.typography(body, default);+ max-width: none;++ /* Heading Styles */+ & h1,+ & h2,+ & h3,+ & h4,+ & h5,+ & h6 {+ @include cssUtils.typography(heading, extra-small);+ color: cssUtils.$text-neutral-primary;+ margin-bottom: 18px;+ &:has(+ p) {+ margin-bottom: 8px;+ }+ + strong {+ @include cssUtils.typography(heading, extra-small);+ }+ }+ /* Paragraph Styles */+ & p {+ color: cssUtils.$text-neutral-primary;+ @include cssUtils.typography(body, default);+ margin-bottom: 0;+ &:has(+ p) {+ margin-bottom: 18px;+ }+ &:has(+ ol) {+ margin-bottom: 8px;+ }+ &:has(+ ul) {+ margin-bottom: 8px;+ }+ }++ & strong {+ color: cssUtils.$text-neutral-primary;+ @include cssUtils.typography(body, heavy);+ }++ & li {+ margin-bottom: 8px;+ @include cssUtils.typography(body, default);+ :last-child {+ margin-bottom: 0;+ }+ &::marker {+ @include cssUtils.typography(body, default);+ color: cssUtils.$text-neutral-secondary;+ }+ }+ & li ul {+ margin-top: 8px;+ }++ & li li {+ margin-top: 8px;+ }+ & li ol {+ margin-top: 8px;+ }+ & ol {+ list-style-type: decimal;+ padding-left: 20px;+ margin-bottom: 20px;+ @include cssUtils.typography(body, default);+ color: cssUtils.$text-neutral-primary;+ :last-child {+ margin-bottom: 0;+ }+ }++ & ul {+ list-style-type: disc;+ padding-left: 20px;+ margin-bottom: 24px;+ @include cssUtils.typography(body, default);+ color: cssUtils.$text-neutral-primary;+ :last-child {+ margin-bottom: 0;+ }+ }++ & .openui-code-block-syntax-highlighter {+ padding: 25px !important;+ margin-top: 8px !important;+ margin-bottom: 8px !important;++ &:first-child {+ margin-top: 0 !important;+ }++ &:last-child {+ margin-bottom: 0 !important;+ }+ }++ & hr {+ margin-top: 48px;+ margin-bottom: 48px;+ + * {+ margin-top: 0;+ }+ }++ /* Blockquote Styles */+ & blockquote {+ color: cssUtils.$text-neutral-primary;+ border-left: 4px solid color-mix(in oklab, cssUtils.$text-neutral-primary 70%, transparent);+ padding: 0px 0 0px 8px;+ font-style: italic;+ margin-left: 0;+ margin-top: 25px;+ margin-bottom: 25px;+ padding-left: 16px;+ quotes: "\201C" "\201D" "\2018" "\2019";+ line-height: 1.625;+ }++ & blockquote strong {+ @include cssUtils.typography(body, heavy);+ }++ & blockquote > *:first-child::before {+ content: open-quote;+ font-size: 1em;+ line-height: 1;+ vertical-align: top;+ margin-right: 0.2em;+ }++ & blockquote > *:last-child::after {+ content: close-quote;+ font-size: 1em;+ line-height: 1.5;+ vertical-align: top;+ margin-left: 0.2em;+ }++ & blockquote * {+ font-style: inherit;+ color: inherit;+ line-height: inherit;+ }++ & .openui-table-container {+ margin-bottom: 20px;+ }++ > *:first-child {+ margin-top: 0;+ }++ > *:last-child {+ margin-bottom: 0;+ }+}++.openui-text-content-markdown-dark-mode {+ & p,+ & h1,+ & h2,+ & h3,+ & h4,+ & h5,+ & h6 {+ color: cssUtils.$text-neutral-primary;+ }++ .katex {+ margin-top: cssUtils.$space-xs;+ display: inline-block;+ }+}++.openui-text-content {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-xl;+}diff --git a/packages/react-ui/src/components/TooltipWrapper/TooltipWrapper.tsx b/packages/react-ui/src/components/TooltipWrapper/TooltipWrapper.tsxnew file mode 100644index 000000000..fc1b790cc--- /dev/null+++ b/packages/react-ui/src/components/TooltipWrapper/TooltipWrapper.tsx@@ -0,0 +1,155 @@+import * as Tooltip from "@radix-ui/react-tooltip";+import clsx from "clsx";+import React, { cloneElement, isValidElement, useLayoutEffect, useRef, useState } from "react";+import { useTheme } from "../ThemeProvider";++export interface TooltipWrapperProps {+ tooltipHeading?: string;+ tooltipContent?: string;+ side?: "top" | "right" | "bottom" | "left";+ align?: "start" | "center" | "end";+ sideOffset?: number;+ alignOffset?: number;+ className?: string;+ delayDuration?: number;+ showOnlyWhenTruncated?: boolean;+ headingSelector?: string;+ contentSelector?: string;+}++export const TooltipWrapper = ({+ tooltipHeading,+ tooltipContent,+ children,+ className,+ side = "bottom",+ align = "start",+ sideOffset = 5,+ alignOffset = 0,+ delayDuration = 100,+ showOnlyWhenTruncated = false,+ headingSelector,+ contentSelector,+}: React.PropsWithChildren<TooltipWrapperProps>) => {+ const { portalThemeClassName } = useTheme();+ const triggerRef = useRef<HTMLElement>(null);+ const [isHeadingTruncated, setIsHeadingTruncated] = useState(false);+ const [isContentTruncated, setIsContentTruncated] = useState(false);++ const child = React.Children.only(children);+ const triggerWithRef =+ isValidElement(child) && showOnlyWhenTruncated+ ? cloneElement(child as React.ReactElement, { ref: triggerRef } as any)+ : children;++ useLayoutEffect(() => {+ const measure = () => {+ if (triggerRef.current) {+ const { children: childNodes } = triggerRef.current;+ const elements = Array.from(childNodes);++ const headingEl = headingSelector+ ? (triggerRef.current.querySelector(headingSelector) ?? undefined)+ : tooltipHeading+ ? elements[0]+ : undefined;+ const contentEl = contentSelector+ ? (triggerRef.current.querySelector(contentSelector) ?? undefined)+ : tooltipContent+ ? tooltipHeading+ ? elements[1]+ : elements[elements.length - 1]+ : undefined;++ if (headingEl) {+ const isNowTruncated =+ headingEl.scrollWidth > headingEl.clientWidth ||+ headingEl.scrollHeight > headingEl.clientHeight;+ if (isNowTruncated !== isHeadingTruncated) {+ setIsHeadingTruncated(isNowTruncated);+ }+ } else if (isHeadingTruncated) {+ setIsHeadingTruncated(false);+ }++ if (contentEl) {+ const isNowTruncated =+ contentEl.scrollWidth > contentEl.clientWidth ||+ contentEl.scrollHeight > contentEl.clientHeight;+ if (isNowTruncated !== isContentTruncated) {+ setIsContentTruncated(isNowTruncated);+ }+ } else if (isContentTruncated) {+ setIsContentTruncated(false);+ }+ }+ };++ if (showOnlyWhenTruncated) {+ measure();+ const resizeObserver = new ResizeObserver(measure);+ const trigger = triggerRef.current;+ if (trigger) {+ resizeObserver.observe(trigger);+ }+ return () => {+ if (trigger) {+ resizeObserver.unobserve(trigger);+ }+ };+ }++ return undefined;+ }, [+ children,+ showOnlyWhenTruncated,+ isHeadingTruncated,+ isContentTruncated,+ tooltipHeading,+ tooltipContent,+ headingSelector,+ contentSelector,+ ]);++ const displayTooltipHeading = showOnlyWhenTruncated+ ? isHeadingTruncated+ ? tooltipHeading+ : undefined+ : tooltipHeading;+ const displayTooltipContent = showOnlyWhenTruncated+ ? isContentTruncated+ ? tooltipContent+ : undefined+ : tooltipContent;++ const hasContent = displayTooltipHeading || displayTooltipContent;+ if (!hasContent) {+ return <>{triggerWithRef}</>;+ }++ return (+ <Tooltip.Provider>+ <Tooltip.Root delayDuration={delayDuration}>+ <Tooltip.Trigger asChild>{triggerWithRef}</Tooltip.Trigger>+ <Tooltip.Portal>+ <Tooltip.Content+ className={clsx("openui-tooltip-content", portalThemeClassName, className)}+ side={side}+ align={align}+ sideOffset={sideOffset}+ alignOffset={alignOffset}+ >+ <div className={"openui-tooltip-body"}>+ {displayTooltipHeading && (+ <span className={"openui-tooltip-heading"}>{displayTooltipHeading}</span>+ )}+ {displayTooltipContent && (+ <span className={"openui-tooltip-text-content"}>{displayTooltipContent}</span>+ )}+ </div>+ </Tooltip.Content>+ </Tooltip.Portal>+ </Tooltip.Root>+ </Tooltip.Provider>+ );+};diff --git a/packages/react-ui/src/components/TooltipWrapper/index.ts b/packages/react-ui/src/components/TooltipWrapper/index.tsnew file mode 100644index 000000000..a1f6c3875--- /dev/null+++ b/packages/react-ui/src/components/TooltipWrapper/index.ts@@ -0,0 +1 @@+export * from "./TooltipWrapper";diff --git a/packages/react-ui/src/components/TooltipWrapper/tooltipWrapper.scss b/packages/react-ui/src/components/TooltipWrapper/tooltipWrapper.scssnew file mode 100644index 000000000..88fe8df63--- /dev/null+++ b/packages/react-ui/src/components/TooltipWrapper/tooltipWrapper.scss@@ -0,0 +1,50 @@+@use "../../cssUtils" as cssUtils;+@use "../_shared/chatUtils" as chatUtils;++.openui-tooltip-body {+ display: flex;+ flex-direction: column;+ gap: cssUtils.$space-2xs;+ width: 100%;+ max-width: 248px;+}++.openui-tooltip-heading {+ @include cssUtils.typography(body, small);+ color: cssUtils.$text-neutral-primary;+ width: 100%;+}++.openui-tooltip-text-content {+ @include cssUtils.typography(body, small);+ color: cssUtils.$text-neutral-secondary;+ width: 100%;+}++.openui-tooltip-content {+ box-sizing: border-box;+ background-color: cssUtils.$elevated;+ padding: cssUtils.$space-xs cssUtils.$space-s;+ outline: 1px solid cssUtils.$border-default;+ z-index: chatUtils.$z-overlay;+ border-radius: cssUtils.$radius-s;+ user-select: none;+ animation-duration: 400ms;+ animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);+ will-change: transform, opacity;++ &[data-state="delayed-open"] {+ &[data-side="top"] {+ animation-name: openui-slide-down-and-fade;+ }+ &[data-side="right"] {+ animation-name: openui-slide-left-and-fade;+ }+ &[data-side="bottom"] {+ animation-name: openui-slide-up-and-fade;+ }+ &[data-side="left"] {+ animation-name: openui-slide-right-and-fade;+ }+ }+}diff --git a/packages/react-ui/src/components/VisualCardBlock/VisualCardBlock.tsx b/packages/react-ui/src/components/VisualCardBlock/VisualCardBlock.tsxnew file mode 100644index 000000000..74195755c--- /dev/null+++ b/packages/react-ui/src/components/VisualCardBlock/VisualCardBlock.tsx@@ -0,0 +1,100 @@+import clsx from "clsx";+import { ChevronRight } from "lucide-react";+import { forwardRef, type CSSProperties, type ReactNode } from "react";+import { CardBlockLayout, cardKeyDownHandler } from "../_shared/cards/CardBlockLayout";+import { toCssUrl } from "../_shared/utils";++export interface VisualCardBlockItem {+ id?: string;+ /** Rendered in the top-left slot (typically a Tag). */+ tag?: ReactNode;+ /** Rendered inside the bottom panel (typically bold text). */+ body?: ReactNode;+ bgImageSrc?: string;+ /** Alt text for the background image. */+ bgImageAlt?: string;+}++export interface VisualCardProps {+ item: VisualCardBlockItem;+ clickable?: boolean;+ onClick?: () => void;+ className?: string;+}++/** A photo-first card: background image with gradient, a tag on top and a body panel at the bottom. */+export const VisualCard = forwardRef<HTMLDivElement, VisualCardProps>((props, ref) => {+ const { item, clickable = false, onClick, className } = props;+ const { tag, body, bgImageSrc, bgImageAlt } = item;+ const backgroundImage = toCssUrl(bgImageSrc);+ const cardImageStyle = backgroundImage+ ? ({ "--openui-visual-card-image": backgroundImage } as CSSProperties)+ : undefined;++ return (+ <div+ ref={ref}+ className={clsx(+ "openui-visual-first-card",+ clickable ? "openui-visual-first-card--clickable" : "openui-visual-first-card--static",+ className,+ )}+ style={cardImageStyle}+ aria-label={cardImageStyle ? bgImageAlt : undefined}+ role={clickable ? "button" : undefined}+ tabIndex={clickable ? 0 : undefined}+ onClick={clickable ? onClick : undefined}+ onKeyDown={clickable && onClick ? cardKeyDownHandler(onClick) : undefined}+ >+ <div className="openui-visual-first-card__top">+ <div className="openui-visual-first-card__tag">{tag ?? null}</div>+ {clickable && (+ <div className="openui-visual-first-card__action" aria-hidden="true">+ <ChevronRight size={16} />+ </div>+ )}+ </div>+ {body ? <div className="openui-visual-first-card__bottom">{body}</div> : null}+ </div>+ );+});++VisualCard.displayName = "VisualCard";++export interface VisualCardBlockProps {+ items: VisualCardBlockItem[];+ layout?: "grid" | "carousel";+ responsive?: boolean;+ /** Overrides the CSS gap variable (numbers are treated as px). */+ gap?: number | string;+ /** Makes every card focusable/clickable; `onItemClick` receives the item index. */+ clickable?: boolean;+ onItemClick?: (index: number) => void;+ className?: string;+}++/** A three-per-row grid or carousel of VisualCards. */+export const VisualCardBlock = forwardRef<HTMLDivElement, VisualCardBlockProps>((props, ref) => {+ const { items, layout, responsive, gap, clickable = false, onItemClick, className } = props;++ return (+ <CardBlockLayout+ ref={ref}+ size="medium"+ cardType="visual-first-card"+ data-card-type="VisualCard"+ items={items}+ layout={layout}+ responsive={responsive}+ maxPerRow={3}+ gap={gap}+ className={className}+ itemKey={(item, index) => item.id ?? `visual-card-${index}`}+ renderItem={(item, index) => (+ <VisualCard item={item} clickable={clickable} onClick={() => onItemClick?.(index)} />+ )}+ />+ );+});++VisualCardBlock.displayName = "VisualCardBlock";diff --git a/packages/react-ui/src/components/VisualCardBlock/index.ts b/packages/react-ui/src/components/VisualCardBlock/index.tsnew file mode 100644index 000000000..341126423--- /dev/null+++ b/packages/react-ui/src/components/VisualCardBlock/index.ts@@ -0,0 +1 @@+export * from "./VisualCardBlock";diff --git a/packages/react-ui/src/components/VisualCardBlock/visualCardBlock.scss b/packages/react-ui/src/components/VisualCardBlock/visualCardBlock.scssnew file mode 100644index 000000000..ad8eecab4--- /dev/null+++ b/packages/react-ui/src/components/VisualCardBlock/visualCardBlock.scss@@ -0,0 +1,105 @@+@use "../../cssUtils" as cssUtils;+@use "../_shared/chatUtils" as chatUtils;++// Photo + gradient sit behind content via pseudo-elements; no extra DOM for the image.+.openui-visual-first-card {+ position: relative;+ isolation: isolate;+ display: flex;+ flex-direction: column;+ justify-content: flex-start;+ min-height: 280px;+ height: 100%;+ border-radius: cssUtils.$radius-3xl;+ overflow: hidden;+ background-color: cssUtils.$highlight-subtle;+ border: 1px solid cssUtils.$border-default;+ transition:+ box-shadow 0.2s ease,+ transform 0.2s ease;++ &::before {+ content: "";+ position: absolute;+ inset: 0;+ z-index: chatUtils.$z-background;+ background-image: var(--openui-visual-card-image, none);+ background-size: cover;+ background-position: center;+ transition: transform 0.25s ease;+ }++ &::after {+ content: "";+ position: absolute;+ inset: 0;+ z-index: chatUtils.$z-content;+ pointer-events: none;+ background: linear-gradient(180deg, rgb(0 0 0 / 12%) 0%, rgb(0 0 0 / 56%) 100%);+ }++ &--clickable:hover::before {+ transform: scale(1.04);+ }++ &--clickable {+ cursor: pointer;+ box-shadow: cssUtils.$shadow-s;+ border-color: cssUtils.$border-interactive;++ &:hover {+ box-shadow: none;+ transform: scale(0.995);+ }++ &:focus-visible {+ outline: 2px solid cssUtils.$border-accent;+ outline-offset: 2px;+ }+ }+}++.openui-visual-first-card__top {+ position: relative;+ z-index: chatUtils.$z-content-elevated;+ display: flex;+ align-items: flex-start;+ justify-content: space-between;+ min-height: 24px;+ padding: cssUtils.$space-m;+}++.openui-visual-first-card__tag {+ min-width: 0;+}++.openui-visual-first-card__tag .openui-tag {+ background-color: rgb(0 0 0 / 40%);+ color: cssUtils.$text-white;+ backdrop-filter: blur(2px);+ -webkit-backdrop-filter: blur(2px);+}++.openui-visual-first-card__action {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ flex-shrink: 0;+ background-color: rgb(0 0 0 / 40%);+ color: cssUtils.$text-white;+ backdrop-filter: blur(2px);+ -webkit-backdrop-filter: blur(2px);+ border-radius: cssUtils.$radius-s;+ padding: cssUtils.$space-2xs;+}++.openui-visual-first-card__bottom {+ position: relative;+ z-index: chatUtils.$z-content-elevated;+ box-sizing: border-box;+ margin: auto cssUtils.$space-m cssUtils.$space-m cssUtils.$space-m;+ padding: cssUtils.$space-s cssUtils.$space-s-m;+ background-color: cssUtils.$foreground;+ border: 1px solid cssUtils.$border-default;+ border-radius: cssUtils.$radius-l;+}diff --git a/packages/react-ui/src/components/_shared/cards/CardBlockLayout.tsx b/packages/react-ui/src/components/_shared/cards/CardBlockLayout.tsxnew file mode 100644index 000000000..117b21574--- /dev/null+++ b/packages/react-ui/src/components/_shared/cards/CardBlockLayout.tsx@@ -0,0 +1,136 @@+import clsx from "clsx";+import {+ forwardRef,+ type CSSProperties,+ type ForwardedRef,+ type HTMLAttributes,+ type KeyboardEvent,+ type ReactNode,+} from "react";+import { getRowConfiguration, useCarouselMask } from "./smallCardBlockUtils";++export type CardBlockLayoutVariant = "grid" | "carousel";+export type CardBlockSize = "small" | "medium";++export interface CardBlockLayoutProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {+ /** Picks the `openui-small-card-block` / `openui-medium-card-block` class family. */+ size: CardBlockSize;+ /** Appended as `openui-<size>-card-block--<cardType>` and exposed as `data-card-type`. */+ cardType: string;+ items: T[];+ layout?: CardBlockLayoutVariant;+ responsive?: boolean;+ maxPerRow: 2 | 3;+ /** Overrides the CSS gap variable (numbers are treated as px). */+ gap?: number | string;+ /** Renders one card; the layout wraps it in the item/carousel-item cell. */+ renderItem: (item: T, index: number) => ReactNode;+ itemKey?: (item: T, index: number) => string;+}++/** Shared grid/carousel scaffolding for the small and medium card blocks. */+function CardBlockLayoutInner<T>(+ props: CardBlockLayoutProps<T>,+ ref: ForwardedRef<HTMLDivElement>,+) {+ const {+ size,+ cardType,+ items,+ layout = "grid",+ responsive = true,+ maxPerRow,+ gap,+ renderItem,+ itemKey,+ className,+ style,+ ...rest+ } = props;+ const { scrollRef, maskLeft, maskRight } = useCarouselMask();+ const safeItems = items ?? [];+ const base = `openui-${size}-card-block`;+ const count = safeItems.length;++ const gapStyle = gap+ ? ({+ [`--openui-${size}-card-gap`]: typeof gap === "number" ? `${gap}px` : gap,+ } as CSSProperties)+ : undefined;++ const renderCell = (item: T, index: number) => (+ <div+ key={itemKey?.(item, index) ?? `${cardType}-${index}`}+ className={layout === "carousel" ? `${base}__carousel-item` : `${base}__item`}+ >+ {renderItem(item, index)}+ </div>+ );++ let rowStartIndex = 0;++ return (+ <div+ ref={ref}+ className={clsx(base, `${base}--${cardType}`, `${base}--${layout}`, className)}+ data-card-type={cardType}+ data-layout={layout}+ data-count={count}+ style={{ ...gapStyle, ...style }}+ {...rest}+ >+ {layout === "carousel" ? (+ <div+ ref={scrollRef}+ className={clsx(+ `${base}__carousel`,+ responsive && `${base}__carousel--responsive`,+ maskLeft && `${base}__carousel--mask-left`,+ maskRight && `${base}__carousel--mask-right`,+ )}+ >+ <div className={`${base}__carousel-track`}>+ {safeItems.map((item, index) => renderCell(item, index))}+ </div>+ </div>+ ) : (+ <div+ className={clsx(+ `${base}__grid`,+ responsive && `${base}__grid--responsive`,+ responsive && count % 2 === 1 && `${base}__grid--odd-count`,+ )}+ >+ {getRowConfiguration(count, maxPerRow).map((itemsInRow, rowIndex) => {+ const currentRowStartIndex = rowStartIndex;+ rowStartIndex += itemsInRow;++ return (+ <div+ key={`${cardType}-row-${rowIndex}`}+ className={clsx(`${base}__row`, `${base}__row--${itemsInRow}`)}+ >+ {safeItems+ .slice(currentRowStartIndex, currentRowStartIndex + itemsInRow)+ .map((item, columnIndex) => renderCell(item, currentRowStartIndex + columnIndex))}+ </div>+ );+ })}+ </div>+ )}+ </div>+ );+}++export const CardBlockLayout = forwardRef(CardBlockLayoutInner) as <T>(+ props: CardBlockLayoutProps<T> & { ref?: ForwardedRef<HTMLDivElement> },+) => ReactNode;++/** Enter/Space keyboard activation for card-like `role="button"` divs. */+export function cardKeyDownHandler(onActivate: () => void) {+ return (event: KeyboardEvent<HTMLDivElement>) => {+ if (event.key !== "Enter" && event.key !== " ") return;+ event.preventDefault();+ onActivate();+ };+}diff --git a/packages/react-ui/src/components/_shared/cards/mediumCardBlock.scss b/packages/react-ui/src/components/_shared/cards/mediumCardBlock.scssnew file mode 100644index 000000000..63a5560bd--- /dev/null+++ b/packages/react-ui/src/components/_shared/cards/mediumCardBlock.scss@@ -0,0 +1,125 @@+@use "../../../cssUtils" as cssUtils;++// Shared layout for medium-sized card blocks (CompositeCardBlock, VisualCardBlock).+.openui-medium-card-block {+ --openui-medium-card-gap: #{cssUtils.$space-m};+ width: 100%;+ container-type: inline-size;++ &[data-layout="carousel"] {+ padding: 0;+ }+}++.openui-medium-card-block__grid {+ display: flex;+ flex-direction: column;+ gap: var(--openui-medium-card-gap);+ width: 100%;+}++.openui-medium-card-block__row {+ display: grid;+ gap: var(--openui-medium-card-gap);+ width: 100%;+ align-items: stretch;+}++.openui-medium-card-block__row--1 {+ grid-template-columns: 1fr;+}++.openui-medium-card-block__row--2 {+ grid-template-columns: repeat(2, minmax(0, 1fr));+}++.openui-medium-card-block__row--3 {+ grid-template-columns: repeat(3, minmax(0, 1fr));+}++.openui-medium-card-block__item {+ width: 100%;+ min-width: 0;+}++.openui-medium-card-block__carousel {+ width: 100%;+ overflow-x: auto;+ overflow-y: visible;+ scrollbar-width: none;+ -ms-overflow-style: none;++ &::-webkit-scrollbar {+ display: none;+ }++ &--mask-left.openui-medium-card-block__carousel--mask-right {+ mask-image: linear-gradient(+ to right,+ #0000,+ #000 #{cssUtils.$space-3xl},+ #000 calc(100% - #{cssUtils.$space-3xl}),+ #0000+ );+ -webkit-mask-image: linear-gradient(+ to right,+ #0000,+ #000 #{cssUtils.$space-3xl},+ #000 calc(100% - #{cssUtils.$space-3xl}),+ #0000+ );+ }++ &--mask-left:not(.openui-medium-card-block__carousel--mask-right) {+ mask-image: linear-gradient(to right, #0000, #000 #{cssUtils.$space-3xl}, #000);+ -webkit-mask-image: linear-gradient(to right, #0000, #000 #{cssUtils.$space-3xl}, #000);+ }++ &--mask-right:not(.openui-medium-card-block__carousel--mask-left) {+ mask-image: linear-gradient(to left, #0000, #000 #{cssUtils.$space-3xl}, #000);+ -webkit-mask-image: linear-gradient(to left, #0000, #000 #{cssUtils.$space-3xl}, #000);+ }+}++.openui-medium-card-block__carousel-track {+ display: flex;+ gap: var(--openui-medium-card-gap);+ padding: cssUtils.$space-2xs 0;+ width: max-content;+}++.openui-medium-card-block__carousel-item {+ flex-shrink: 0;+ width: 20rem;+}++.openui-medium-card-block__grid--responsive {+ @container (max-width: 48rem) {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));++ .openui-medium-card-block__row {+ display: contents;+ }+ }++ @container (max-width: 30rem) {+ grid-template-columns: 1fr;+ }+}++.openui-medium-card-block__grid--odd-count {+ @container (max-width: 48rem) {+ .openui-medium-card-block__row:last-child > .openui-medium-card-block__item:last-child {+ grid-column: 1 / -1;+ }+ }+}++.openui-medium-card-block__carousel--responsive {+ @container (max-width: 30rem) {+ .openui-medium-card-block__carousel-item {+ width: 17.5rem;+ }+ }+}diff --git a/packages/react-ui/src/components/_shared/cards/smallCardBlock.scss b/packages/react-ui/src/components/_shared/cards/smallCardBlock.scssnew file mode 100644index 000000000..ca652abeb--- /dev/null+++ b/packages/react-ui/src/components/_shared/cards/smallCardBlock.scss@@ -0,0 +1,139 @@+@use "../../../cssUtils" as cssUtils;++.openui-small-card-block {+ --openui-small-card-gap: #{cssUtils.$space-m};+ width: 100%;+ container-type: inline-size;++ &[data-layout="carousel"] {+ padding: 0;+ }+}++.openui-small-card-block__grid {+ display: flex;+ flex-direction: column;+ gap: var(--openui-small-card-gap);+ width: 100%;+}++.openui-small-card-block__row {+ display: grid;+ gap: var(--openui-small-card-gap);+ width: 100%;+ align-items: stretch;+}++.openui-small-card-block__row--1 {+ grid-template-columns: 1fr;+}++.openui-small-card-block__row--2 {+ grid-template-columns: repeat(2, minmax(0, 1fr));+}++.openui-small-card-block__row--3 {+ grid-template-columns: repeat(3, minmax(0, 1fr));+}++.openui-small-card-block__item {+ display: grid;+ width: 100%;+ min-width: 0;+}++.openui-small-card-block__carousel {+ width: 100%;+ overflow-x: auto;+ overflow-y: visible;+ scrollbar-width: none;+ -ms-overflow-style: none;++ &::-webkit-scrollbar {+ display: none;+ }++ &--mask-left.openui-small-card-block__carousel--mask-right {+ mask-image: linear-gradient(+ to right,+ #0000,+ #000 #{cssUtils.$space-3xl},+ #000 calc(100% - #{cssUtils.$space-3xl}),+ #0000+ );+ -webkit-mask-image: linear-gradient(+ to right,+ #0000,+ #000 #{cssUtils.$space-3xl},+ #000 calc(100% - #{cssUtils.$space-3xl}),+ #0000+ );+ }++ &--mask-left:not(.openui-small-card-block__carousel--mask-right) {+ mask-image: linear-gradient(to right, #0000, #000 #{cssUtils.$space-3xl}, #000);+ -webkit-mask-image: linear-gradient(to right, #0000, #000 #{cssUtils.$space-3xl}, #000);+ }++ &--mask-right:not(.openui-small-card-block__carousel--mask-left) {+ mask-image: linear-gradient(to left, #0000, #000 #{cssUtils.$space-3xl}, #000);+ -webkit-mask-image: linear-gradient(to left, #0000, #000 #{cssUtils.$space-3xl}, #000);+ }+}++.openui-small-card-block__carousel-track {+ display: flex;+ gap: var(--openui-small-card-gap);+ padding: cssUtils.$space-2xs 0;+ width: max-content;+}++.openui-small-card-block__carousel-item {+ display: grid;+ flex-shrink: 0;+ width: 17.5rem;+}++.openui-small-card-block__grid--responsive {+ @container (max-width: 48rem) {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: var(--openui-small-card-gap);++ .openui-small-card-block__row {+ display: contents;+ }+ }++ @container (max-width: 30rem) {+ grid-template-columns: 1fr;+ }+}++.openui-small-card-block__grid--odd-count {+ @container (max-width: 48rem) {+ .openui-small-card-block__row:last-child > .openui-small-card-block__item:last-child {+ grid-column: 1 / -1;+ }+ }+}++.openui-small-card-block__carousel--responsive {+ @container (max-width: 30rem) {+ .openui-small-card-block__carousel-item {+ width: 15rem;+ }+ }+}++.openui-small-card-block--overview-card.openui-small-card-block--carousel {+ .openui-small-card-block__carousel-item {+ width: 15rem;+ }++ @container (max-width: 30rem) {+ .openui-small-card-block__carousel-item {+ width: 12.5rem;+ }+ }+}diff --git a/packages/react-ui/src/components/_shared/cards/smallCardBlockUtils.ts b/packages/react-ui/src/components/_shared/cards/smallCardBlockUtils.tsnew file mode 100644index 000000000..bde1d6dbb--- /dev/null+++ b/packages/react-ui/src/components/_shared/cards/smallCardBlockUtils.ts@@ -0,0 +1,80 @@+import { useCallback, useEffect, useState } from "react";++/**+ * Splits `n` items into rows of at most `maxPerRow` (2 or 3) so the grid never+ * ends with a lonely single card when it can be avoided.+ */+export function getRowConfiguration(n: number, maxPerRow: number): number[] {+ if (n <= 0) return [];+ if (n === 1) return [1];++ if (maxPerRow === 2) {+ const fullRows = Math.floor(n / 2);+ const remainder = n % 2;+ const result: number[] = Array(fullRows).fill(2);+ if (remainder) result.push(1);+ return result;+ }++ if (n % 3 === 0) {+ return Array(n / 3).fill(3);+ }++ if (n % 3 === 2) {+ const threes = Math.floor(n / 3);+ const result: number[] = Array(threes).fill(3);+ result.splice(Math.ceil(result.length / 2), 0, 2);+ return result;+ }++ const threes = Math.floor((n - 4) / 3);+ const result: number[] = Array(threes).fill(3);+ return [...result, 2, 2];+}++export interface CarouselMask {+ /** Attach to the scrolling element (callback ref, so late mounts are observed). */+ scrollRef: (element: HTMLDivElement | null) => void;+ maskLeft: boolean;+ maskRight: boolean;+}++/** Tracks a horizontally scrolling element and reports whether either edge is overflowing. */+export function useCarouselMask(): CarouselMask {+ const [element, setElement] = useState<HTMLDivElement | null>(null);+ const [maskLeft, setMaskLeft] = useState(false);+ const [maskRight, setMaskRight] = useState(false);++ const updateMask = useCallback(() => {+ if (!element) {+ return;+ }++ setMaskLeft(element.scrollLeft > 0);+ setMaskRight(Math.ceil(element.scrollLeft) + element.offsetWidth < element.scrollWidth);+ }, [element]);++ useEffect(() => {+ if (!element) {+ return;+ }++ updateMask();++ const resizeObserver = new ResizeObserver(updateMask);+ resizeObserver.observe(element);++ const mutationObserver = new MutationObserver(updateMask);+ mutationObserver.observe(element, { childList: true, subtree: true });++ element.addEventListener("scroll", updateMask, { passive: true });++ return () => {+ element.removeEventListener("scroll", updateMask);+ resizeObserver.disconnect();+ mutationObserver.disconnect();+ };+ }, [element, updateMask]);++ return { scrollRef: setElement, maskLeft, maskRight };+}diff --git a/packages/react-ui/src/components/_shared/chatUtils.scss b/packages/react-ui/src/components/_shared/chatUtils.scssnew file mode 100644index 000000000..f887ffb42--- /dev/null+++ b/packages/react-ui/src/components/_shared/chatUtils.scss@@ -0,0 +1,30 @@+// Shared scss helpers for the chat (genui-lib) primitives.+// Import with: @use "../_shared/chatUtils" as chatUtils;+@use "../../cssUtils" as cssUtils;++// ── z-index scale (low → high) ──+$z-background: 0;+$z-content: 1;+$z-content-elevated: 2;+$z-toolbar: 20;+$z-popover: 1000;+$z-overlay: 9999;+$z-overlay-tooltip: 10001;++@mixin scrollbar {+ scrollbar-width: thin;+ scrollbar-color: cssUtils.$border-default transparent;++ &::-webkit-scrollbar {+ width: 6px;+ }++ &::-webkit-scrollbar-track {+ background: transparent;+ }++ &::-webkit-scrollbar-thumb {+ background: cssUtils.$border-default;+ border-radius: cssUtils.$radius-full;+ }+}diff --git a/packages/react-ui/src/components/_shared/hooks/index.ts b/packages/react-ui/src/components/_shared/hooks/index.tsnew file mode 100644index 000000000..f901d3ec5--- /dev/null+++ b/packages/react-ui/src/components/_shared/hooks/index.ts@@ -0,0 +1,2 @@+export { useId } from "./useId";+export { usePinnableTooltip } from "./usePinnableTooltip";diff --git a/packages/react-ui/src/components/_shared/hooks/useId.ts b/packages/react-ui/src/components/_shared/hooks/useId.tsnew file mode 100644index 000000000..f977cd918--- /dev/null+++ b/packages/react-ui/src/components/_shared/hooks/useId.ts@@ -0,0 +1,5 @@+import { useMemo } from "react";++export const useId = () => {+ return useMemo(() => crypto.randomUUID(), []);+};diff --git a/packages/react-ui/src/components/_shared/hooks/usePinnableTooltip.ts b/packages/react-ui/src/components/_shared/hooks/usePinnableTooltip.tsnew file mode 100644index 000000000..32018535f--- /dev/null+++ b/packages/react-ui/src/components/_shared/hooks/usePinnableTooltip.ts@@ -0,0 +1,214 @@+import { useCallback, useEffect, useRef, useState } from "react";++import { useId } from "./useId";++const PINNABLE_TOOLTIP_OPEN_EVENT = `openui-pinnable-tooltip-open`;+const DEFAULT_GROUP_ID = `openui-pinnable-tooltip-global`;++export interface UsePinnableTooltipOptions {+ /**+ * Group ID for coordinating multiple tooltips (only one open at a time per group).+ * If not provided, uses a global group so only one tooltip is open at a time across the app.+ */+ groupId?: string;+ /** Delay in ms before closing on mouse leave (default: 200) */+ closeDelay?: number;+ /** Callback when open state changes */+ onOpenChange?: (isOpen: boolean) => void;+}++export interface UsePinnableTooltipReturn {+ /** Whether the tooltip is currently open */+ isOpen: boolean;+ /** Whether the tooltip is pinned (clicked open) */+ isPinned: boolean;+ /** Handler for mouse entering trigger or content */+ handleMouseEnter: () => void;+ /** Handler for mouse leaving trigger or content */+ handleMouseLeave: () => void;+ /** Handler for clicking the trigger (toggles pin state) */+ handleTriggerClick: () => void;+ /** Handler for clicking content (closes tooltip) */+ handleContentClick: () => void;+ /** Close the tooltip programmatically */+ closeTooltip: () => void;+ /** Handler for pointer down outside (use with onPointerDownOutside) */+ getPointerDownOutsideHandler: (+ triggerSelector: string,+ ) => (event: { target: EventTarget | null }) => void;+}++/**+ * Hook for managing pinnable tooltip state with hover, click-to-pin,+ * and group coordination functionality.+ *+ * @example+ * ```tsx+ * const {+ * isOpen,+ * handleMouseEnter,+ * handleMouseLeave,+ * handleTriggerClick,+ * handleContentClick,+ * getPointerDownOutsideHandler,+ * } = usePinnableTooltip({ groupId: 'my-tooltip-group' })+ *+ * <Tooltip.Root open={isOpen}>+ * <Tooltip.Trigger+ * onClick={handleTriggerClick}+ * onMouseEnter={handleMouseEnter}+ * onMouseLeave={handleMouseLeave}+ * >+ * Trigger+ * </Tooltip.Trigger>+ * <Tooltip.Content+ * onMouseEnter={handleMouseEnter}+ * onMouseLeave={handleMouseLeave}+ * onClick={handleContentClick}+ * onPointerDownOutside={getPointerDownOutsideHandler('.my-trigger')}+ * >+ * Content+ * </Tooltip.Content>+ * </Tooltip.Root>+ * ```+ */+export function usePinnableTooltip(+ options: UsePinnableTooltipOptions = {},+): UsePinnableTooltipReturn {+ const { groupId = DEFAULT_GROUP_ID, closeDelay = 200, onOpenChange } = options;++ const [isOpen, setIsOpen] = useState(false);+ const [isPinned, setIsPinned] = useState(false);+ const [suppressHoverUntilLeave, setSuppressHoverUntilLeave] = useState(false);+ const leaveTimeoutRef = useRef<number | null>(null);+ const tooltipId = useId();++ const clearLeaveTimeout = useCallback(() => {+ if (leaveTimeoutRef.current !== null) {+ window.clearTimeout(leaveTimeoutRef.current);+ leaveTimeoutRef.current = null;+ }+ }, []);++ const handleMouseEnter = useCallback(() => {+ clearLeaveTimeout();++ if (isPinned) {+ return;+ }++ if (suppressHoverUntilLeave) {+ setSuppressHoverUntilLeave(false);+ }++ setIsOpen(true);+ }, [clearLeaveTimeout, isPinned, suppressHoverUntilLeave]);++ const handleMouseLeave = useCallback(() => {+ if (suppressHoverUntilLeave) {+ setSuppressHoverUntilLeave(false);+ }++ if (isPinned) {+ return;+ }++ leaveTimeoutRef.current = window.setTimeout(() => {+ setIsOpen(false);+ leaveTimeoutRef.current = null;+ }, closeDelay);+ }, [isPinned, suppressHoverUntilLeave, closeDelay]);++ const handleTriggerClick = useCallback(() => {+ clearLeaveTimeout();+ setIsPinned((prevPinned) => {+ const nextPinned = !prevPinned;+ setIsOpen(nextPinned);++ if (!nextPinned) {+ setSuppressHoverUntilLeave(true);+ }++ return nextPinned;+ });+ }, [clearLeaveTimeout]);++ const closeTooltip = useCallback(() => {+ clearLeaveTimeout();+ setIsPinned(false);+ setSuppressHoverUntilLeave(true);+ setIsOpen(false);+ }, [clearLeaveTimeout]);++ const handleContentClick = useCallback(() => {+ closeTooltip();+ }, [closeTooltip]);++ const getPointerDownOutsideHandler = useCallback(+ (triggerSelector: string) => {+ return (event: { target: EventTarget | null }) => {+ if ((event.target as HTMLElement)?.closest(triggerSelector)) {+ return;+ }+ closeTooltip();+ };+ },+ [closeTooltip],+ );++ // Cleanup timeout on unmount+ useEffect(() => {+ return () => {+ clearLeaveTimeout();+ };+ }, [clearLeaveTimeout]);++ // Notify parent of open state changes+ useEffect(() => {+ onOpenChange?.(isOpen);+ }, [isOpen, onOpenChange]);++ // Broadcast open event for coordination with other tooltips in the same group+ useEffect(() => {+ if (!isOpen) {+ return;+ }++ window.dispatchEvent(+ new CustomEvent<{ id: string; groupId: string }>(PINNABLE_TOOLTIP_OPEN_EVENT, {+ detail: { id: tooltipId, groupId },+ }),+ );+ }, [tooltipId, isOpen, groupId]);++ // Listen for other tooltips opening in the same group+ useEffect(() => {+ const handleExternalOpen = (event: Event) => {+ const detail = (event as CustomEvent<{ id: string; groupId: string }>).detail;++ // Only close if same group and different tooltip+ if (detail?.groupId !== groupId || detail?.id === tooltipId) {+ return;+ }++ closeTooltip();+ };++ window.addEventListener(PINNABLE_TOOLTIP_OPEN_EVENT, handleExternalOpen as EventListener);++ return () => {+ window.removeEventListener(PINNABLE_TOOLTIP_OPEN_EVENT, handleExternalOpen as EventListener);+ };+ }, [tooltipId, groupId, closeTooltip]);++ return {+ isOpen,+ isPinned,+ handleMouseEnter,+ handleMouseLeave,+ handleTriggerClick,+ handleContentClick,+ closeTooltip,+ getPointerDownOutsideHandler,+ };+}diff --git a/packages/react-ui/src/components/_shared/icons/IconWrapper.tsx b/packages/react-ui/src/components/_shared/icons/IconWrapper.tsxnew file mode 100644index 000000000..4f0bf0c09--- /dev/null+++ b/packages/react-ui/src/components/_shared/icons/IconWrapper.tsx@@ -0,0 +1,75 @@+import type { LucideIcon } from "lucide-react";+import { useEffect, useState } from "react";+import { getFallbackIconName } from "./categoryFallbacks";+import { getIconImport } from "./dynamicIconImports";++const cachedIcons = new Map<string, LucideIcon>();++export type IconWrapperProps = {+ name: string;+ category?: string;+ size?: number;+ className?: string;+};++export const IconWrapper = ({ name, category, ...props }: IconWrapperProps) => {+ const [IconComponent, setIconComponent] = useState<LucideIcon | null>(+ () => cachedIcons.get(name) || null,+ );++ useEffect(() => {+ // Cancellation guard: streamed openui-lang can change `name` mid-load;+ // without it a slower stale load (e.g. the previous name's fallback) can+ // settle last and clobber the correct icon.+ let cancelled = false;++ const loadIcon = async (iconName: string) => {+ const iconImport = getIconImport(iconName);+ if (!iconImport) {+ return false;+ }++ try {+ const module = await iconImport();+ if (module?.default) {+ cachedIcons.set(iconName, module.default);+ if (!cancelled) {+ setIconComponent(() => module.default);+ }+ return true;+ }+ } catch {+ return false;+ }+ return false;+ };++ const loadIconWithFallback = async () => {+ if (cachedIcons.has(name)) {+ setIconComponent(cachedIcons.get(name) as LucideIcon);+ return;+ }++ const loaded = await loadIcon(name);+ if (!loaded && !cancelled) {+ const fallbackName = getFallbackIconName(category);+ if (cachedIcons.has(fallbackName)) {+ setIconComponent(cachedIcons.get(fallbackName) as LucideIcon);+ } else {+ await loadIcon(fallbackName);+ }+ }+ };++ loadIconWithFallback();+ return () => {+ cancelled = true;+ };+ }, [name, category]);++ if (!IconComponent) {+ return null;+ }++ return <IconComponent size={14} {...props} />;+};diff --git a/packages/react-ui/src/components/_shared/icons/categoryFallbacks.ts b/packages/react-ui/src/components/_shared/icons/categoryFallbacks.tsnew file mode 100644index 000000000..6054c15c8--- /dev/null+++ b/packages/react-ui/src/components/_shared/icons/categoryFallbacks.ts@@ -0,0 +1,59 @@+/**+ * Semantic icon-category → representative lucide icon name (kebab-case).+ *+ * When an icon name doesn't resolve, surfaces fall back to the category's+ * representative icon before their own generic fallback, so a miss still+ * renders something topical (`finance` → dollar sign, not a bare circle).+ */+export const categoryFallbacks: Record<string, string> = {+ accessibility: "accessibility",+ account: "user",+ animals: "cat",+ arrows: "arrow-right",+ brands: "box",+ buildings: "building",+ charts: "chart-line",+ communication: "message-square",+ connectivity: "wifi",+ cursors: "mouse-pointer",+ design: "palette",+ development: "code",+ devices: "smartphone",+ emoji: "smile",+ files: "file",+ finance: "dollar-sign",+ "food-beverage": "cooking-pot",+ gaming: "gamepad",+ home: "house",+ layout: "layout",+ mail: "mail",+ math: "calculator",+ medical: "heart-pulse",+ multimedia: "music",+ nature: "tree-pine",+ navigation: "map-pin",+ notifications: "bell",+ people: "users",+ photography: "camera",+ science: "microscope",+ seasons: "sun",+ security: "shield",+ shapes: "circle",+ shopping: "shopping-cart",+ social: "share-2",+ sports: "trophy",+ sustainability: "leaf",+ text: "type",+ time: "clock",+ tools: "wrench",+ transportation: "car",+ travel: "plane",+ weather: "cloud",+};++/** Rendered when neither the icon name nor its category resolves. */+export const defaultFallbackIconName = "circle-dot";++/** The icon name to load when a requested icon name misses the catalog. */+export const getFallbackIconName = (category?: string): string =>+ categoryFallbacks[category?.trim().toLowerCase() ?? ""] ?? defaultFallbackIconName;diff --git a/packages/react-ui/src/components/_shared/icons/dynamicIconImports.ts b/packages/react-ui/src/components/_shared/icons/dynamicIconImports.tsnew file mode 100644index 000000000..f9d136850--- /dev/null+++ b/packages/react-ui/src/components/_shared/icons/dynamicIconImports.ts@@ -0,0 +1,133 @@+import type { LucideIcon } from "lucide-react";+import { toKebabIconCandidates } from "./iconNames";+// .mjs import (extension needed for strict-ESM consumers); types come from+// the sibling .d.mts declaration.+import lucideDynamicIconImports from "./lucide/lucideDynamicImports.mjs";++type IconImport = () => Promise<{ default: LucideIcon }>;++/**+ * CJS interop: this package ships both CJS and ESM builds. When the CJS+ * build loads the `.mjs` icon map, the import hands back a namespace object+ * (`{ __esModule, default: map }`) instead of the map itself, and bundler+ * interop helpers can stack a second `default` layer on top. Unwrap until we+ * reach the actual key → import-thunk map (`circle` is a stable lucide key),+ * else every icon silently resolves null for CJS consumers.+ */+export const unwrapModuleDefault = (mod: unknown): Record<string, IconImport> => {+ let candidate = mod as Record<string, unknown>;+ while (+ candidate != null &&+ typeof candidate === "object" &&+ typeof candidate["circle"] !== "function" &&+ "default" in candidate+ ) {+ candidate = candidate["default"] as Record<string, unknown>;+ }+ return (candidate ?? {}) as Record<string, IconImport>;+};++const exactDynamicIconImports = unwrapModuleDefault(lucideDynamicIconImports);++const getArrayPermutations = <T>(arr: T[]): T[][] => {+ if (arr.length === 0) {+ return [[]];+ }++ const firstElement = arr[0];+ const rest = arr.slice(1);++ const permsWithoutFirst = getArrayPermutations(rest);++ const allPermutations: T[][] = [];++ permsWithoutFirst.forEach((perm) => {+ for (let i = 0; i <= perm.length; i++) {+ const permWithFirst = [+ ...perm.slice(0, i), // Elements before insertion point+ firstElement,+ ...perm.slice(i), // Elements after insertion point+ ].filter((item) => item !== undefined) as T[];++ allPermutations.push(permWithFirst);+ }+ });++ return allPermutations;+};++const getIconNamePermutations = (inputString: string): string[] => {+ const words = inputString+ .trim()+ .split(/-/)+ .filter((word) => word.length > 0);++ if (words.length === 0) {+ return [""];+ }++ const wordPermutations = getArrayPermutations(words);++ const stringPermutations = wordPermutations.map((perm) => perm.join("-"));++ return stringPermutations;+};++const permutationIconImports = Object.entries(exactDynamicIconImports).reduce(+ (acc, [key, value]) => {+ const iconNamePermutations = getIconNamePermutations(key);+ iconNamePermutations.forEach((iconName) => {+ acc[iconName] = value;+ });+ return acc;+ },+ {} as Record<string, IconImport>,+);++// Permutation aliases are fuzzy matches and can collide with real Lucide keys+// (`arrow-down-up` is also a permutation of `arrow-up-down`). Overlay the raw+// catalog last so an exact key always keeps its upstream icon mapping.+export const dynamicIconImports: Record<string, IconImport> = Object.assign(+ permutationIconImports,+ exactDynamicIconImports,+);++const getIconNameMatchVariations = (iconName: string) => {+ const iconNameParts = iconName.split("-");+ const iconNameVariations: string[] = [iconNameParts[0]!];++ let lastVariation: string = iconNameVariations[0]!;++ for (const part of iconNameParts.slice(1)) {+ const newVariation = `${lastVariation}-${part}`;+ lastVariation = newVariation;+ iconNameVariations.push(newVariation);+ }++ return iconNameVariations.reverse();+};++export const getIconImport = (iconName: string) => {+ // The map is keyed kebab-case (the canonical wire format); tolerate+ // PascalCase/camelCase input by also trying the kebab normalizations.+ const kebabCandidates = toKebabIconCandidates(iconName);+ for (const candidate of [iconName, ...kebabCandidates]) {+ const iconImport = dynamicIconImports[candidate as keyof typeof dynamicIconImports];++ if (iconImport) {+ return iconImport;+ }+ }++ const iconNameImportVariations = getIconNameMatchVariations(kebabCandidates[0] ?? iconName);++ for (const variation of iconNameImportVariations) {+ const iconImport = dynamicIconImports[variation as keyof typeof dynamicIconImports];++ if (iconImport) {+ return iconImport;+ }+ }++ return null;+};diff --git a/packages/react-ui/src/components/_shared/icons/iconNames.ts b/packages/react-ui/src/components/_shared/icons/iconNames.tsnew file mode 100644index 000000000..258144e84--- /dev/null+++ b/packages/react-ui/src/components/_shared/icons/iconNames.ts@@ -0,0 +1,21 @@+/**+ * Normalize PascalCase/camelCase input to kebab-case candidates for+ * `lucide-react/dynamicIconImports` map keys. Unlike kebab → Pascal, this+ * direction is ambiguous around digits (`ArrowUp10` is `arrow-up-1-0`+ * upstream, but `Axis3d` is `axis-3d`). Dimension-shaped names add another+ * ambiguity (`Grid2x2` is exported as both `grid-2x2` and `grid-2-x-2`), so+ * callers try each deterministic candidate in priority order.+ */+export const toKebabIconCandidates = (name: string): string[] => {+ const base = name+ .trim()+ .replace(/[\s_]+/g, "-")+ .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2")+ .replace(/([a-z0-9])([A-Z])/g, "$1-$2")+ .replace(/([A-Za-z])(\d)/g, "$1-$2")+ .toLowerCase();+ const digitSplit = base.replace(/(\d)(?=\d)/g, "$1-");+ const compactDimension = base.replace(/(\d)x-(\d)/g, "$1x$2");+ const splitDimension = base.replace(/(\d)x-(\d)/g, "$1-x-$2");+ return [...new Set([base, digitSplit, compactDimension, splitDimension])];+};diff --git a/packages/react-ui/src/components/_shared/icons/index.ts b/packages/react-ui/src/components/_shared/icons/index.tsnew file mode 100644index 000000000..582327e95--- /dev/null+++ b/packages/react-ui/src/components/_shared/icons/index.ts@@ -0,0 +1,2 @@+export { IconWrapper, type IconWrapperProps } from "./IconWrapper";+export { iconPropsSchema, type IconProps } from "./schema";diff --git a/packages/react-ui/src/components/_shared/icons/lucide/lucideDynamicImports.d.mts b/packages/react-ui/src/components/_shared/icons/lucide/lucideDynamicImports.d.mtsnew file mode 100644index 000000000..e161bb323--- /dev/null+++ b/packages/react-ui/src/components/_shared/icons/lucide/lucideDynamicImports.d.mts@@ -0,0 +1,2 @@+import dynamicIconImports from "lucide-react/dynamicIconImports";+export default dynamicIconImports;diff --git a/packages/react-ui/src/components/_shared/icons/lucide/lucideDynamicImports.mjs b/packages/react-ui/src/components/_shared/icons/lucide/lucideDynamicImports.mjsnew file mode 100644index 000000000..843ce40bd--- /dev/null+++ b/packages/react-ui/src/components/_shared/icons/lucide/lucideDynamicImports.mjs@@ -0,0 +1,4 @@+// This version is for strict ESM/Next.js environments.+// We explicitly use the .mjs extension to satisfy resolution.+import dynamicIconImports from "lucide-react/dynamicIconImports.mjs";+export default dynamicIconImports;diff --git a/packages/react-ui/src/components/_shared/icons/schema.ts b/packages/react-ui/src/components/_shared/icons/schema.tsnew file mode 100644index 000000000..167546b2e--- /dev/null+++ b/packages/react-ui/src/components/_shared/icons/schema.ts@@ -0,0 +1,24 @@+import { z } from "zod/v4";++/**+ * The icon wire contract shared by every surface that embeds an `Icon`+ * (chat + dashboard `Icon` components). Field order is wire-load-bearing+ * (openui-lang binds positionally): `name` first, `category` second — never+ * reorder.+ *+ * Report/presentation blocks intentionally use a flat `iconName` field+ * instead (it shipped positionally before this schema existed here).+ */+export const iconPropsSchema = z.object({+ name: z+ .string()+ .describe("lucide-react icon name in kebab-case (e.g. 'circle-check', 'rocket')."),+ category: z+ .string()+ .optional()+ .describe(+ "Optional icon category (e.g. 'finance', 'charts', 'security', 'travel', 'people', 'time') used to pick a topical fallback icon when `name` doesn't resolve.",+ ),+});++export type IconProps = z.infer<typeof iconPropsSchema>;diff --git a/packages/react-ui/src/components/_shared/index.ts b/packages/react-ui/src/components/_shared/index.tsindex 187e7f6d0..53c72b611 100644--- a/packages/react-ui/src/components/_shared/index.ts+++ b/packages/react-ui/src/components/_shared/index.ts@@ -1,3 +1,5 @@+export * from "./hooks";+export * from "./icons";export * from "./store";export * from "./tool-renderer";export * from "./types";diff --git a/packages/react-ui/src/components/_shared/remark/remarkCitations.ts b/packages/react-ui/src/components/_shared/remark/remarkCitations.tsnew file mode 100644index 000000000..76347796d--- /dev/null+++ b/packages/react-ui/src/components/_shared/remark/remarkCitations.ts@@ -0,0 +1,94 @@+/**+ * # remarkCitations+ *+ * Remark plugin that transforms citation patterns like [1][2] into custom React components.+ * Scans markdown text nodes, splits them into text and citation parts, and converts+ * citations to span elements with data attributes for TextContentCitation to render.+ *+ * **How it works:**+ * 1. Uses regex `/(\[\d+\]\s*)+/g` to find citation patterns+ * 2. Splits text nodes: text before → citation component → text after+ * 3. Creates span nodes with `data-component-type="citation"` and `data-citation-indices="1,2"`+ * 4. Replaces original text node with split parts in the AST+ *+ * **Example:**+ * Input: "Statement [1][2] text" → Output: [Text, Citation(1,2), Text]+ */++import { visit } from "unist-util-visit";++/**+ * Regex to match citation patterns like [1], [1][2], [1] [2]+ * Matches one or more [number] patterns with optional whitespace+ */+const customComponentRegex = /(\[\d+\]\s*)+/g;++/**+ * Regex to extract individual numbers from citation brackets+ * Example: "[1][2]" → ["1", "2"]+ */+const numberExtractorRegex = /\[(\d+)\]/g;++/**+ * Remark plugin that transforms citation patterns into custom component nodes.+ * Returns a function that processes the markdown AST tree.+ */+export const remarkCitations = () => {+ return (tree: any) => {+ visit(tree, "text", (node, index, parent) => {+ if (typeof node.value !== "string") {+ return;+ }++ const parts = [];+ let lastIndex = 0;+ let match;++ while ((match = customComponentRegex.exec(node.value)) !== null) {+ if (match.index > lastIndex) {+ parts.push({+ type: "text",+ value: node.value.slice(lastIndex, match.index),+ });+ }++ const fullMatch = match[0];+ const numbers: string[] = [];+ let numberMatch;++ while ((numberMatch = numberExtractorRegex.exec(fullMatch)) !== null) {+ numbers.push(numberMatch[1] ?? "");+ }+ numberExtractorRegex.lastIndex = 0;++ if (numbers.length > 0) {+ parts.push({+ type: "customComponent",+ data: {+ hName: "span",+ hProperties: {+ "data-component-type": "citation",+ "data-citation-indices": numbers.join(","),+ },+ },+ children: [{ type: "text", value: fullMatch.trim() }],+ });+ }++ lastIndex = match.index + fullMatch.length;+ }+ customComponentRegex.lastIndex = 0;++ if (lastIndex < node.value.length) {+ parts.push({ type: "text", value: node.value.slice(lastIndex) });+ }++ if (parts.length > 0 && parent && typeof index === "number") {+ parent.children.splice(index, 1, ...parts);+ return index + parts.length;+ }++ return undefined;+ });+ };+};diff --git a/packages/react-ui/src/components/_shared/shared.scss b/packages/react-ui/src/components/_shared/shared.scssindex e69de29bb..657ab7e69 100644--- a/packages/react-ui/src/components/_shared/shared.scss+++ b/packages/react-ui/src/components/_shared/shared.scss@@ -0,0 +1,77 @@+@use "../../cssUtils" as cssUtils;+@use "./cards/smallCardBlock";+@use "./cards/mediumCardBlock";++// ── Keyframes shared by chat primitives ──+@keyframes openui-spin {+ from {+ transform: rotate(0deg);+ }+ to {+ transform: rotate(360deg);+ }+}++@keyframes openui-fade-in-from-left {+ 0% {+ opacity: 0;+ clip-path: inset(0 100% 0 0);+ }+ 100% {+ opacity: 1;+ clip-path: inset(0 0 0 0);+ }+}++@keyframes openui-shimmer {+ 0% {+ background-position: 200% 0;+ }+ 100% {+ background-position: -200% 0;+ }+}++@keyframes openui-slide-up-and-fade {+ from {+ opacity: 0;+ transform: translateY(2px);+ }+ to {+ opacity: 1;+ transform: translateY(0);+ }+}++@keyframes openui-slide-right-and-fade {+ from {+ opacity: 0;+ transform: translateX(-2px);+ }+ to {+ opacity: 1;+ transform: translateX(0);+ }+}++@keyframes openui-slide-down-and-fade {+ from {+ opacity: 0;+ transform: translateY(-2px);+ }+ to {+ opacity: 1;+ transform: translateY(0);+ }+}++@keyframes openui-slide-left-and-fade {+ from {+ opacity: 0;+ transform: translateX(2px);+ }+ to {+ opacity: 1;+ transform: translateX(0);+ }+}diff --git a/packages/react-ui/src/components/_shared/utils/index.ts b/packages/react-ui/src/components/_shared/utils/index.tsindex 9a588ec6c..25ae4dda1 100644--- a/packages/react-ui/src/components/_shared/utils/index.ts+++ b/packages/react-ui/src/components/_shared/utils/index.ts@@ -9,3 +9,5 @@ export const isChatEmpty = ({}) => {return !isLoadingMessages && messages.length === 0;};++export { safeOpenUrl, safeUrl, toCssUrl } from "./safeUrl";diff --git a/packages/react-ui/src/components/_shared/utils/safeUrl.ts b/packages/react-ui/src/components/_shared/utils/safeUrl.tsnew file mode 100644index 000000000..41fa0a24a--- /dev/null+++ b/packages/react-ui/src/components/_shared/utils/safeUrl.ts@@ -0,0 +1,58 @@+/**+ * Reject URLs whose scheme can execute JS in the host origin+ * (`javascript:`, `data:`, `vbscript:`, `file:`). Mirrors the regex used by+ * `sanitizeSvg` in MermaidDiagram/utils so the policy is consistent across+ * every LLM-controlled URL sink (anchor `href`, `window.open`, etc.).+ *+ * Returns the trimmed URL when safe, otherwise `undefined`.+ */+const DANGEROUS_URI_RE = /^\s*(?:javascript|data|vbscript|file)\s*:/i;++// Browsers strip ASCII control characters (and NBSP via String.trim) when+// parsing URL schemes, so `java\tscript:` resolves to `javascript:`.+// Strip them before the scheme check to defeat the classic obfuscation.+const SCHEME_OBFUSCATION_RE = /[\u0000-\u001F\u007F]/g;++export const safeUrl = (url: string | null | undefined): string | undefined => {+ if (typeof url !== "string") return undefined;+ const trimmed = url.trim();+ if (!trimmed) return undefined;+ const normalized = trimmed.replace(SCHEME_OBFUSCATION_RE, "");+ if (DANGEROUS_URI_RE.test(normalized)) return undefined;+ return trimmed;+};++/**+ * The single allowed entry point for `window.open` in this package.+ *+ * - Validates the URL through `safeUrl` (rejects `javascript:`/`data:`/+ * `vbscript:`/`file:` schemes, including control-char obfuscation).+ * - Defaults `target` to `_blank` and `features` to `noopener,noreferrer`+ * to prevent reverse-tabnabbing.+ * - Returns the opened `Window`, or `null` if the URL was rejected or+ * `window` is unavailable (SSR).+ *+ * Route every `window.open` call site through this util.+ */+export const safeOpenUrl = (+ url: string | null | undefined,+ target = "_blank",+ features = "noopener,noreferrer",+): Window | null => {+ if (typeof window === "undefined") return null;+ const safe = safeUrl(url);+ if (!safe) return null;+ return window.open(safe, target, features);+};++/**+ * Turn an LLM-controlled image URL into a `url("...")` CSS value, or `undefined`+ * when the URL is unsafe. Quotes, backslashes and newlines are escaped so the+ * value cannot break out of the declaration.+ */+export const toCssUrl = (url: string | null | undefined): string | undefined => {+ const safe = safeUrl(url);+ if (!safe) return undefined;+ const escaped = safe.replace(/[\\"\n\r]/g, (c) => `\\${c.charCodeAt(0).toString(16)} `);+ return `url("${escaped}")`;+};diff --git a/packages/react-ui/src/components/index.scss b/packages/react-ui/src/components/index.scssindex 4e9b231e0..c8986403f 100644--- a/packages/react-ui/src/components/index.scss+++ b/packages/react-ui/src/components/index.scss@@ -17,23 +17,39 @@@forward "./Charts/charts.scss";@forward "./CheckBoxGroup/checkBoxGroup.scss";@forward "./CheckBoxItem/checkBoxItem.scss";+@forward "./Chips/chips.scss";+@forward "./Citation/citation.scss";@forward "./CodeBlock/codeBlock.scss";+@forward "./CompositeCardBlock/compositeCardBlock.scss";+@forward "./ContextCardBlock/contextCardBlock.scss";@forward "./DatePicker/datePicker.scss";@forward "./DotMatrixLoader/dotMatrixLoader.scss";+@forward "./EditableTable/editableTable.scss";+@forward "./EntityList/entityList.scss";@forward "./FollowUpBlock/followUpBlock.scss";@forward "./FollowUpItem/followUpItem.scss";@forward "./FormControl/formControl.scss";@forward "./IconButton/iconButton.scss";+@forward "./IconTag/iconTag.scss";+@forward "./IconText/iconText.scss";@forward "./Image/image.scss";@forward "./ImageBlock/imageBlock.scss";@forward "./ImageGallery/imageGallery.scss";+@forward "./ImageText/imageText.scss";+@forward "./ImageTextLarge/imageTextLarge.scss";+@forward "./InlineHeader/inlineHeader.scss";+@forward "./InlineMarkdownRenderer/inlineMarkdownRenderer.scss";@forward "./Input/input.scss";@forward "./Label/label.scss";@forward "./ListBlock/listBlock.scss";@forward "./ListItem/listItem.scss";@forward "./MarkDownRenderer/markDownRenderer.scss";+@forward "./MetricIndicator/metricIndicator.scss";@forward "./Modal/Modal.scss";+@forward "./ModelSwitcher/modelSwitcher.scss";@forward "./OpenUIChat/openUIChat.scss";+@forward "./OptionCards/optionCards.scss";+@forward "./OverviewCardBlock/overviewCardBlock.scss";@forward "./RadioGroup/radioGroup.scss";@forward "./RadioItem/radioItem.scss";@forward "./SectionBlock/sectionBlock.scss";@@ -41,6 +57,9 @@@forward "./Separator/separator.scss";@forward "./Skeleton/skeleton.scss";@forward "./Slider/slider.scss";+@forward "./SnippetCardBlock/snippetCardBlock.scss";+@forward "./SourceFaviconImage/sourceFaviconImage.scss";+@forward "./Sources/sources.scss";@forward "./Steps/steps.scss";@forward "./SwitchGroup/switchGroup.scss";@forward "./SwitchItem/switchItem.scss";@@ -49,11 +68,14 @@@forward "./Tag/tag.scss";@forward "./TagBlock/tagBlock.scss";@forward "./TextArea/textArea.scss";+@forward "./TextBlock/textBlock.scss";@forward "./TextCallout/textCallout.scss";@forward "./TextContent/textContent.scss";+@forward "./TextContentWrapper/textContentWrapper.scss";@forward "./ToggleGroup/toggleGroup.scss";@forward "./ToggleItem/toggleItem.scss";@forward "./ToolCall/toolCall.scss";@forward "./ToolResult/toolResult.scss";+@forward "./TooltipWrapper/tooltipWrapper.scss";+@forward "./VisualCardBlock/visualCardBlock.scss";@forward "./_shared/shared.scss";-@forward "./ModelSwitcher/modelSwitcher.scss";diff --git a/packages/react-ui/src/cssUtils.scss b/packages/react-ui/src/cssUtils.scssindex eed2417f2..d7f0c5759 100644--- a/packages/react-ui/src/cssUtils.scss+++ b/packages/react-ui/src/cssUtils.scss@@ -291,6 +291,8 @@ $typography: (heading: typography(openui-text-numbers-heading-lg),heading-small: typography(openui-text-numbers-heading-sm),heading-medium: typography(openui-text-numbers-heading-md),+ title: typography(openui-text-numbers-heading-lg),+ title-medium: typography(openui-text-numbers-heading-md),heading-large: typography(openui-text-numbers-heading-lg),heading-xl: typography(openui-text-numbers-heading-xl),),diff --git a/packages/react-ui/src/genui-lib/Accordion/index.tsx b/packages/react-ui/src/genui-lib/Accordion/index.tsxindex 7b7a8ee72..12a95d3cf 100644--- a/packages/react-ui/src/genui-lib/Accordion/index.tsx+++ b/packages/react-ui/src/genui-lib/Accordion/index.tsx@@ -1,6 +1,6 @@"use client";-import { defineComponent } from "@openuidev/react-lang";+import { ComponentRenderProps, defineComponent, type SubComponentOf } from "@openuidev/react-lang";import React from "react";import { z } from "zod/v4";import {@@ -20,41 +20,48 @@ export const AccordionItem = defineComponent({component: () => null,});+type AccordionRenderProps = ComponentRenderProps<{+ items: SubComponentOf<{ value: string; trigger: string; content: unknown[] }>[];+}>;++/** Shared renderer — also used by the chat library's Accordion variant (wider content union). */+export const AccordionRenderer = ({ props, renderNode }: AccordionRenderProps) => {+ const items = props.items ?? [];+ const [openItem, setOpenItem] = React.useState<string>("");+ const userHasInteracted = React.useRef(false);+ const prevItemCount = React.useRef(0);++ // Auto-open: only when a NEW item arrives during streaming+ if (!userHasInteracted.current && items.length > prevItemCount.current) {+ const newest = items[items.length - 1];+ if (newest) setOpenItem(newest.props.value);+ }+ prevItemCount.current = items.length;++ const handleValueChange = (value: string) => {+ userHasInteracted.current = true;+ setOpenItem(value);+ };++ if (!items.length) return null;++ return (+ <OpenUIAccordion type="single" collapsible value={openItem} onValueChange={handleValueChange}>+ {items.map((item) => (+ <OpenUIAccordionItem key={item.props.value} value={item.props.value}>+ <OpenUIAccordionTrigger text={item.props.trigger} />+ <OpenUIAccordionContent>{renderNode(item.props.content)}</OpenUIAccordionContent>+ </OpenUIAccordionItem>+ ))}+ </OpenUIAccordion>+ );+};+export const Accordion = defineComponent({name: "Accordion",props: z.object({items: z.array(AccordionItem.ref),}),description: "Collapsible sections",- component: ({ props, renderNode }) => {- const items = props.items ?? [];- const [openItem, setOpenItem] = React.useState<string>("");- const userHasInteracted = React.useRef(false);- const prevItemCount = React.useRef(0);-- // Auto-open: only when a NEW item arrives during streaming- if (!userHasInteracted.current && items.length > prevItemCount.current) {- const newest = items[items.length - 1];- if (newest) setOpenItem(newest.props.value);- }- prevItemCount.current = items.length;-- const handleValueChange = (value: string) => {- userHasInteracted.current = true;- setOpenItem(value);- };-- if (!items.length) return null;-- return (- <OpenUIAccordion type="single" collapsible value={openItem} onValueChange={handleValueChange}>- {items.map((item) => (- <OpenUIAccordionItem key={item.props.value} value={item.props.value}>- <OpenUIAccordionTrigger text={item.props.trigger} />- <OpenUIAccordionContent>{renderNode(item.props.content)}</OpenUIAccordionContent>- </OpenUIAccordionItem>- ))}- </OpenUIAccordion>- );- },+ component: AccordionRenderer,});diff --git a/packages/react-ui/src/genui-lib/Action/schema.ts b/packages/react-ui/src/genui-lib/Action/schema.tsindex 4217b28ce..ded0c83de 100644--- a/packages/react-ui/src/genui-lib/Action/schema.ts+++ b/packages/react-ui/src/genui-lib/Action/schema.ts@@ -1,6 +1,17 @@import { tagSchemaId } from "@openuidev/react-lang";import { z } from "zod/v4";-/** Shared action prop schema — shows as `ActionExpression` in prompt signatures. */-export const actionPropSchema = z.any();+/**+ * Shared action prop schema.+ *+ * Tagged as `ActionExpression` so the local react-lang prompt renders the v0.5+ * `Action([@steps...])` expression syntax. The JSON schema (used by `openui+ * generate` and cloud/muse prompt rendering) carries the legacy object+ * contract, which react-lang also accepts at runtime (legacy action path).+ */+export const actionPropSchema = z.union([+ z.object({ type: z.literal("open_url"), url: z.string() }),+ z.object({ type: z.literal("continue_conversation"), context: z.string().optional() }),+ z.object({ type: z.string(), params: z.record(z.string(), z.any()).optional() }),+]);tagSchemaId(actionPropSchema, "ActionExpression");diff --git a/packages/react-ui/src/genui-lib/BoldText/index.tsx b/packages/react-ui/src/genui-lib/BoldText/index.tsxnew file mode 100644index 000000000..b53fee1f9--- /dev/null+++ b/packages/react-ui/src/genui-lib/BoldText/index.tsx@@ -0,0 +1,36 @@+"use client";++import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";+import { TextBlockView } from "../../components/TextBlock";+import { getMetricSubtextTone } from "../Text";+import { BoldTextSchema, type BoldTextProps } from "./schema";++export * from "./schema";++function BoldTextRenderer({ props }: ComponentRenderProps<BoldTextProps>) {+ const blockVariant = props.subtext+ ? "highlight-text-number-subtext"+ : props.variant === "number"+ ? "highlight-number"+ : "highlight-text";++ return (+ <TextBlockView+ variant={blockVariant}+ primary={props.value}+ secondary={props.subtext}+ type={props.variant}+ size={props.size}+ align="left"+ secondaryTone={getMetricSubtextTone(props.subtextVariant, props.subtext)}+ />+ );+}++export const BoldText = defineComponent({+ name: "BoldText",+ props: BoldTextSchema,+ description:+ "Emphasized (bold) text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.",+ component: BoldTextRenderer,+});diff --git a/packages/react-ui/src/genui-lib/BoldText/schema.ts b/packages/react-ui/src/genui-lib/BoldText/schema.tsnew file mode 100644index 000000000..3a9c26ee1--- /dev/null+++ b/packages/react-ui/src/genui-lib/BoldText/schema.ts@@ -0,0 +1,10 @@+import { z } from "zod/v4";++export const BoldTextSchema = z.object({+ variant: z.enum(["text", "number"]).default("text"),+ value: z.string(),+ subtext: z.string().optional(),+ subtextVariant: z.enum(["text", "number", "metric"]).default("text"),+ size: z.enum(["xs", "sm", "md", "lg"]).default("sm"),+});+export type BoldTextProps = z.infer<typeof BoldTextSchema>;diff --git a/packages/react-ui/src/genui-lib/Carousel/index.tsx b/packages/react-ui/src/genui-lib/Carousel/index.tsxindex 6ae73ae60..6bfc74d0d 100644--- a/packages/react-ui/src/genui-lib/Carousel/index.tsx+++ b/packages/react-ui/src/genui-lib/Carousel/index.tsx@@ -1,6 +1,6 @@"use client";-import { defineComponent } from "@openuidev/react-lang";+import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";import { ChevronLeft, ChevronRight } from "lucide-react";import { z } from "zod/v4";import {@@ -12,6 +12,27 @@ import {} from "../../components/Carousel";import { ContentChildUnion } from "../unions";+type CarouselRenderProps = ComponentRenderProps<{+ children: unknown[][];+ variant?: "card" | "sunk";+}>;++/** Shared renderer — also used by the chat library's Carousel variant (wider content union). */+export const CarouselRenderer = ({ props, renderNode }: CarouselRenderProps) => {+ const items = props.children ?? [];+ return (+ <OpenUICarousel showButtons={true} variant={props.variant}>+ <OpenUICarouselContent>+ {items.map((item, i) => (+ <OpenUICarouselItem key={i}>{renderNode(item)}</OpenUICarouselItem>+ ))}+ </OpenUICarouselContent>+ <OpenUICarouselPrevious icon={<ChevronLeft />} />+ <OpenUICarouselNext icon={<ChevronRight />} />+ </OpenUICarousel>+ );+};+export const Carousel = defineComponent({name: "Carousel",props: z.object({@@ -19,18 +40,5 @@ export const Carousel = defineComponent({variant: z.enum(["card", "sunk"]).optional(),}),description: "Horizontal scrollable carousel",- component: ({ props, renderNode }) => {- const items = props.children ?? [];- return (- <OpenUICarousel showButtons={true} variant={props.variant}>- <OpenUICarouselContent>- {items.map((item, i) => (- <OpenUICarouselItem key={i}>{renderNode(item)}</OpenUICarouselItem>- ))}- </OpenUICarouselContent>- <OpenUICarouselPrevious icon={<ChevronLeft />} />- <OpenUICarouselNext icon={<ChevronRight />} />- </OpenUICarousel>- );- },+ component: CarouselRenderer,});diff --git a/packages/react-ui/src/genui-lib/Charts/AreaChartCondensed.ts b/packages/react-ui/src/genui-lib/Charts/AreaChartCondensed.tsindex 93fba7703..0f5ca83e5 100644--- a/packages/react-ui/src/genui-lib/Charts/AreaChartCondensed.ts+++ b/packages/react-ui/src/genui-lib/Charts/AreaChartCondensed.ts@@ -13,6 +13,7 @@ export const AreaChartCondensedSchema = z.object({variant: z.enum(["linear", "natural", "step"]).optional(),xLabel: z.string().optional(),yLabel: z.string().optional(),+ height: z.number().optional(),});export const AreaChartCondensed = defineComponent({@@ -29,6 +30,7 @@ export const AreaChartCondensed = defineComponent({variant: props.variant as "linear" | "natural" | "step" | undefined,xAxisLabel: props.xLabel,yAxisLabel: props.yLabel,+ height: props.height as number | undefined,isAnimationActive: false,});},diff --git a/packages/react-ui/src/genui-lib/Charts/BarChartCondensed.ts b/packages/react-ui/src/genui-lib/Charts/BarChartCondensed.tsindex 803ac48ee..a30e946d2 100644--- a/packages/react-ui/src/genui-lib/Charts/BarChartCondensed.ts+++ b/packages/react-ui/src/genui-lib/Charts/BarChartCondensed.ts@@ -13,6 +13,7 @@ export const BarChartCondensedSchema = z.object({variant: z.enum(["grouped", "stacked"]).optional(),xLabel: z.string().optional(),yLabel: z.string().optional(),+ height: z.number().optional(),});export const BarChartCondensed = defineComponent({@@ -29,6 +30,7 @@ export const BarChartCondensed = defineComponent({variant: props.variant as "grouped" | "stacked" | undefined,xAxisLabel: props.xLabel,yAxisLabel: props.yLabel,+ height: props.height as number | undefined,isAnimationActive: false,});},diff --git a/packages/react-ui/src/genui-lib/Charts/LineChartCondensed.ts b/packages/react-ui/src/genui-lib/Charts/LineChartCondensed.tsindex f1c578ba9..13cecc245 100644--- a/packages/react-ui/src/genui-lib/Charts/LineChartCondensed.ts+++ b/packages/react-ui/src/genui-lib/Charts/LineChartCondensed.ts@@ -13,6 +13,7 @@ export const LineChartCondensedSchema = z.object({variant: z.enum(["linear", "natural", "step"]).optional(),xLabel: z.string().optional(),yLabel: z.string().optional(),+ height: z.number().optional(),});export const LineChartCondensed = defineComponent({@@ -29,6 +30,7 @@ export const LineChartCondensed = defineComponent({variant: props.variant as "linear" | "natural" | "step" | undefined,xAxisLabel: props.xLabel,yAxisLabel: props.yLabel,+ height: props.height as number | undefined,isAnimationActive: false,});},diff --git a/packages/react-ui/src/genui-lib/Chips/index.tsx b/packages/react-ui/src/genui-lib/Chips/index.tsxnew file mode 100644index 000000000..d51ce43ed--- /dev/null+++ b/packages/react-ui/src/genui-lib/Chips/index.tsx@@ -0,0 +1,117 @@+"use client";++import {+ ComponentRenderProps,+ defineComponent,+ parseStructuredRules,+ useFormName,+ useFormValidation,+ useGetFieldValue,+ useIsStreaming,+ useSetFieldValue,+ type SubComponentOf,+} from "@openuidev/react-lang";+import React from "react";+import { Chips as OpenUIChips } from "../../components/Chips";+import { useHydrateDefaultFieldValue } from "../formDefaultValueUtils";+import { getStoredDefaultValue, normalizeSelection, toggleSelection } from "../selectionFieldUtils";+import { ChipsSchema, type ChipItemProps, type ChipsProps } from "./schema";++export * from "./schema";++function ChipsRenderer({ props, renderNode }: ComponentRenderProps<ChipsProps>) {+ const formName = useFormName();+ const getFieldValue = useGetFieldValue();+ const setFieldValue = useSetFieldValue();+ const isStreaming = useIsStreaming();+ const formValidation = useFormValidation();++ const fieldName = props.name;+ const type = props.type ?? "multiple";+ const rules = React.useMemo(() => parseStructuredRules(props.rules), [props.rules]);+ const hasRules = rules.length > 0;++ const items = ((props.items ?? []) as Array<SubComponentOf<ChipItemProps>>).filter(+ (item) => item.props.value,+ );+ const existingValue = getFieldValue(formName, fieldName);+ const selection = normalizeSelection(type, existingValue, props.defaultValue);+ const storedDefaultValue = React.useMemo(+ () => getStoredDefaultValue(type, props.defaultValue),+ [type, props.defaultValue],+ );++ useHydrateDefaultFieldValue({+ formName,+ componentType: "Chips",+ name: fieldName,+ existingValue,+ defaultValue: storedDefaultValue,+ });++ React.useEffect(() => {+ if (!isStreaming && hasRules && formValidation) {+ formValidation.registerField(fieldName, rules, () => {+ const value = getFieldValue(formName, fieldName) ?? storedDefaultValue;+ if (type === "single") {+ return typeof value === "string" && value ? value : undefined;+ }+ return Array.isArray(value) && value.length > 0 ? value : undefined;+ });+ return () => formValidation.unregisterField(fieldName);+ }+ return undefined;+ }, [+ fieldName,+ formName,+ formValidation,+ getFieldValue,+ hasRules,+ isStreaming,+ rules,+ storedDefaultValue,+ type,+ ]);++ const handleToggle = (itemValue: string) => {+ if (isStreaming) return;++ const nextSelection = toggleSelection(type, selection, itemValue);+ const storedValue = type === "single" ? (nextSelection[0] ?? undefined) : nextSelection;+ const validationValue =+ type === "single"+ ? (nextSelection[0] ?? undefined)+ : nextSelection.length > 0+ ? nextSelection+ : undefined;++ setFieldValue(formName, "Chips", fieldName, storedValue, true);++ if (hasRules) {+ formValidation?.validateField(fieldName, validationValue, rules);+ }+ };++ return (+ <OpenUIChips+ type={type}+ selected={selection}+ disabled={isStreaming}+ onToggle={handleToggle}+ items={items.map((item) => ({+ value: item.props.value,+ label: item.props.label,+ icon: item.props.icon ? renderNode(item.props.icon) : undefined,+ disabled: item.props.disabled,+ }))}+ />+ );+}++export const Chips = defineComponent({+ name: "Chips",+ props: ChipsSchema,+ description:+ "A form field of compact selectable chips for choosing one or many short options; the selection is stored under `name`.",+ component: ChipsRenderer,+});diff --git a/packages/react-ui/src/genui-lib/Chips/schema.ts b/packages/react-ui/src/genui-lib/Chips/schema.tsnew file mode 100644index 000000000..d8297b747--- /dev/null+++ b/packages/react-ui/src/genui-lib/Chips/schema.ts@@ -0,0 +1,31 @@+import { defineComponent } from "@openuidev/react-lang";+import { z } from "zod/v4";+import { Icon } from "../Icon";+import { rulesSchema } from "../rules";++export const ChipItemSchema = z.object({+ value: z.string(),+ label: z.string(),+ icon: z.optional(Icon.ref),+ disabled: z.boolean().optional(),+});++export type ChipItemProps = z.infer<typeof ChipItemSchema>;++export const ChipItem = defineComponent({+ name: "ChipItem",+ props: ChipItemSchema,+ description:+ "A single selectable chip inside a Chips group, with a value, label and optional icon.",+ component: () => null,+});++export const ChipsSchema = z.object({+ name: z.string(),+ type: z.enum(["single", "multiple"]).default("multiple"),+ items: z.array(ChipItem.ref).default([]),+ rules: rulesSchema,+ defaultValue: z.union([z.string(), z.array(z.string())]).optional(),+});++export type ChipsProps = z.infer<typeof ChipsSchema>;diff --git a/packages/react-ui/src/genui-lib/CompositeCardBlock/index.tsx b/packages/react-ui/src/genui-lib/CompositeCardBlock/index.tsxnew file mode 100644index 000000000..7b3b90d86--- /dev/null+++ b/packages/react-ui/src/genui-lib/CompositeCardBlock/index.tsx@@ -0,0 +1,187 @@+"use client";++import type { SubComponentOf } from "@openuidev/react-lang";+import {+ ComponentRenderProps,+ defineComponent,+ useFormName,+ useIsStreaming,+ useTriggerAction,+} from "@openuidev/react-lang";+import { Fragment, type ReactNode } from "react";+import { CompositeCardBlock as OpenUICompositeCardBlock } from "../../components/CompositeCardBlock";+import { BoldText } from "../BoldText";+import { Button } from "../Button";+import { withItemContext } from "../cardActionUtils";+import { AreaChartCondensed, BarChartCondensed, LineChartCondensed } from "../Charts";+import { EntityList } from "../EntityList";+import { ListBlock } from "../ListBlock";+import { MetricIndicatorInline, MetricIndicatorWithStrikethrough } from "../MetricIndicator";+import { TagBlock } from "../TagBlock";+import { Text } from "../Text";+import {+ CompositeCardBlockSchema,+ type CompositeCardBlockProps,+ type CompositeCardItemProps,+} from "./schema";++export * from "./schema";++type CompositeCardItemElement = SubComponentOf<CompositeCardItemProps>;+type ElementNode = SubComponentOf<Record<string, unknown>>;++const COMPOSITE_CARD_CHART_HEIGHT = 180;++function isElementOf(node: unknown, typeNames: string[]): node is ElementNode {+ return (+ typeof node === "object" &&+ node !== null &&+ (node as { type?: string }).type === "element" &&+ typeNames.includes((node as { typeName?: string }).typeName ?? "")+ );+}++function withProps(node: ElementNode, overrides: Record<string, unknown>): ElementNode {+ return { ...node, props: { ...node.props, ...overrides } };+}++/** Composite cards keep text size, metric size and chart height visually consistent. */+function renderCompositeCardNode(+ node: unknown,+ renderNode: (value: unknown) => ReactNode,+ key: string,+ location: "body" | "footer",+) {+ let value = node;++ if (location === "body" && isElementOf(node, [Text.name, BoldText.name])) {+ value = withProps(node, { size: "xs" });+ } else if (+ isElementOf(node, [AreaChartCondensed.name, BarChartCondensed.name, LineChartCondensed.name])+ ) {+ value = withProps(node, { height: COMPOSITE_CARD_CHART_HEIGHT });+ } else if (isElementOf(node, [ListBlock.name])) {+ value = withProps(node, { size: "small" });+ } else if (isElementOf(node, [EntityList.name])) {+ value = withProps(node, { size: "small", header: undefined, footer: undefined });+ } else if (isElementOf(node, [TagBlock.name])) {+ value = withProps(node, { size: "sm" });+ } else if (isElementOf(node, [Button.name])) {+ value = withProps(node, { size: "small" });+ } else if (+ location === "body" &&+ isElementOf(node, [MetricIndicatorInline.name, MetricIndicatorWithStrikethrough.name])+ ) {+ value = node;+ }++ return <Fragment key={key}>{renderNode(value)}</Fragment>;+}++function getCompositeHeaderText(item: CompositeCardItemElement) {+ const headerProps = item.props.header?.props as Record<string, unknown> | undefined;+ if (!headerProps) return {};++ const pick = (...keys: string[]) => {+ for (const key of keys) {+ const value = headerProps[key];+ if (typeof value === "string") return value;+ }+ return undefined;+ };++ return {+ title: pick("title", "value"),+ subtitle: pick("subtitle", "subtext"),+ imageAlt: pick("alt"),+ };+}++function CompositeCardBlockRenderer({+ props,+ renderNode,+}: ComponentRenderProps<CompositeCardBlockProps>) {+ const triggerAction = useTriggerAction();+ const formName = useFormName();+ const isStreaming = useIsStreaming();++ const items = (props.items ?? []) as CompositeCardItemElement[];+ const isClickable = Boolean(props.action) && !isStreaming;++ const handleItemClick = (index: number) => {+ const item = items[index];+ if (!item || !props.action || isStreaming) return;++ const { title, subtitle, imageAlt } = getCompositeHeaderText(item);+ const { id, body, footer } = item.props;+ const bodyItems = Array.isArray(body) ? body : [];+ const priceProps = footer?.price?.props as Record<string, unknown> | undefined;+ triggerAction(+ title || imageAlt || id || `Composite card ${index + 1}`,+ formName,+ withItemContext(props.action, {+ itemIndex: index,+ itemId: id,+ itemHeaderTitle: title,+ itemHeaderSubtitle: subtitle,+ itemHeaderAlt: imageAlt,+ itemBodyCount: bodyItems.length,+ itemFooterPrice: priceProps && "value" in priceProps ? priceProps["value"] : undefined,+ itemFooterButtonLabel: footer?.button?.props.label,+ }),+ );+ };++ return (+ <OpenUICompositeCardBlock+ layout={props.layout ?? "grid"}+ responsive={props.responsive !== false}+ gap={props.gap}+ clickable={isClickable}+ onItemClick={handleItemClick}+ items={items.map((item, index) => {+ const { id, header, body, footer } = item.props;+ const itemKey = id?.trim()+ ? `composite-card-${id.trim()}-${index}`+ : `composite-card-${index}`;+ const bodyItems = Array.isArray(body) ? body : [];++ return {+ id,+ header: header ? renderNode(header) : undefined,+ body: bodyItems.map((node, bodyIndex) =>+ renderCompositeCardNode(node, renderNode, `${itemKey}-body-${bodyIndex}`, "body"),+ ),+ footer: footer+ ? {+ price: footer.price+ ? renderCompositeCardNode(+ footer.price,+ renderNode,+ `${itemKey}-footer-price`,+ "footer",+ )+ : undefined,+ button: footer.button+ ? renderCompositeCardNode(+ footer.button,+ renderNode,+ `${itemKey}-footer-button`,+ "footer",+ )+ : undefined,+ }+ : undefined,+ };+ })}+ />+ );+}++export const CompositeCardBlock = defineComponent({+ name: "CompositeCardBlock",+ props: CompositeCardBlockSchema,+ description:+ "A two-per-row grid or carousel of rich cards, each with an optional header, stacked body content (text, metrics, charts, lists, tags) and a price/button footer; an optional action makes every card clickable.",+ component: CompositeCardBlockRenderer,+});diff --git a/packages/react-ui/src/genui-lib/CompositeCardBlock/schema.ts b/packages/react-ui/src/genui-lib/CompositeCardBlock/schema.tsnew file mode 100644index 000000000..793527792--- /dev/null+++ b/packages/react-ui/src/genui-lib/CompositeCardBlock/schema.ts@@ -0,0 +1,63 @@+import { defineComponent } from "@openuidev/react-lang";+import { z } from "zod/v4";+import { actionPropSchema } from "../Action/schema";+import { BoldText } from "../BoldText";+import { Button } from "../Button";+import { AreaChartCondensed, BarChartCondensed, LineChartCondensed } from "../Charts";+import { EntityList } from "../EntityList";+import { IconText } from "../IconText";+import { Image } from "../Image";+import { ImageText } from "../ImageText";+import { ImageTextLarge } from "../ImageTextLarge";+import { ListBlock } from "../ListBlock";+import { MetricIndicatorInline, MetricIndicatorWithStrikethrough } from "../MetricIndicator";+import { TagBlock } from "../TagBlock";+import { Text } from "../Text";++export const CompositeCardBodyItemSchema = z.union([+ Text.ref,+ BoldText.ref,+ MetricIndicatorInline.ref,+ IconText.ref,+ Image.ref,+ AreaChartCondensed.ref,+ BarChartCondensed.ref,+ LineChartCondensed.ref,+ ListBlock.ref,+ TagBlock.ref,+ EntityList.ref,+]);++export const CompositeCardFooterSchema = z.object({+ price: z.union([BoldText.ref, MetricIndicatorWithStrikethrough.ref]).optional(),+ button: z.optional(Button.ref),+});++export const CompositeCardItemSchema = z.object({+ id: z.string().optional(),+ header: z+ .union([IconText.ref, ImageText.ref, ImageTextLarge.ref, Text.ref, Image.ref])+ .optional(),+ body: z.array(CompositeCardBodyItemSchema).default([]),+ footer: CompositeCardFooterSchema.optional(),+});++export type CompositeCardItemProps = z.infer<typeof CompositeCardItemSchema>;++export const CompositeCardItem = defineComponent({+ name: "CompositeCardItem",+ props: CompositeCardItemSchema,+ description:+ "A single card inside a CompositeCardBlock: an optional header (icon/image/text), a stack of body elements (text, metrics, charts, lists, tags), and an optional price/button footer.",+ component: () => null,+});++export const CompositeCardBlockSchema = z.object({+ items: z.array(CompositeCardItem.ref).min(2),+ layout: z.enum(["grid", "carousel"]).default("grid"),+ responsive: z.boolean().default(true),+ action: actionPropSchema.optional(),+ gap: z.union([z.number(), z.string()]).optional(),+});++export type CompositeCardBlockProps = z.infer<typeof CompositeCardBlockSchema>;diff --git a/packages/react-ui/src/genui-lib/ContextCardBlock/index.tsx b/packages/react-ui/src/genui-lib/ContextCardBlock/index.tsxnew file mode 100644index 000000000..18a32fef6--- /dev/null+++ b/packages/react-ui/src/genui-lib/ContextCardBlock/index.tsx@@ -0,0 +1,87 @@+"use client";++import type { SubComponentOf } from "@openuidev/react-lang";+import {+ ComponentRenderProps,+ defineComponent,+ useFormName,+ useIsStreaming,+ useTriggerAction,+} from "@openuidev/react-lang";+import { ContextCardBlock as OpenUIContextCardBlock } from "../../components/ContextCardBlock";+import { withItemContext } from "../cardActionUtils";+import { renderCardTag } from "../cardTagUtils";+import {+ ContextCardBlockSchema,+ type ContextCardBlockProps,+ type ContextCardItemProps,+} from "./schema";++export * from "./schema";++type ContextCardItemElement = SubComponentOf<ContextCardItemProps>;++function getContextTitleText(item: ContextCardItemElement) {+ const { title } = item.props;+ if (!title) return "";+ return typeof title === "string" ? title : (title.props?.text ?? "");+}++function ContextCardBlockRenderer({ props }: ComponentRenderProps<ContextCardBlockProps>) {+ const triggerAction = useTriggerAction();+ const formName = useFormName();+ const isStreaming = useIsStreaming();++ const items = (props.items ?? []) as ContextCardItemElement[];+ const isClickable = Boolean(props.action) && !isStreaming;++ const handleItemClick = (index: number) => {+ const item = items[index];+ if (!item || !props.action || isStreaming) return;++ const { id, body, bgColor, bgImageSrc, bgImageAlt } = item.props;+ triggerAction(+ getContextTitleText(item) || id || `Context card ${index + 1}`,+ formName,+ withItemContext(props.action, {+ itemIndex: index,+ itemId: id,+ itemTitle: getContextTitleText(item),+ itemBody: body,+ itemBgColor: bgColor,+ itemBgImageSrc: bgImageSrc,+ itemBgImageAlt: bgImageAlt,+ }),+ );+ };++ return (+ <OpenUIContextCardBlock+ layout={props.layout ?? "grid"}+ responsive={props.responsive !== false}+ gap={props.gap}+ clickable={isClickable}+ onItemClick={handleItemClick}+ items={items.map((item, index) => {+ const { id, title, body, bgColor, bgImageSrc, bgImageAlt } = item.props;+ return {+ id,+ title:+ typeof title === "string" ? title : renderCardTag(title, `context-card-tag-${index}`),+ body,+ bgColor,+ bgImageSrc,+ bgImageAlt,+ };+ })}+ />+ );+}++export const ContextCardBlock = defineComponent({+ name: "ContextCardBlock",+ props: ContextCardBlockSchema,+ description:+ "A grid or carousel of compact tinted context cards (title or tag plus a short bold body); an optional action makes every card clickable.",+ component: ContextCardBlockRenderer,+});diff --git a/packages/react-ui/src/genui-lib/ContextCardBlock/schema.ts b/packages/react-ui/src/genui-lib/ContextCardBlock/schema.tsnew file mode 100644index 000000000..fa6632f48--- /dev/null+++ b/packages/react-ui/src/genui-lib/ContextCardBlock/schema.ts@@ -0,0 +1,35 @@+import { defineComponent } from "@openuidev/react-lang";+import { z } from "zod/v4";+import { actionPropSchema } from "../Action/schema";+import { Tag } from "../Tag";++const contextCardBgColorSchema = z.enum(["gray"]);++export const ContextCardItemSchema = z.object({+ id: z.string().optional(),+ title: z.union([z.string(), Tag.ref]),+ body: z.string().optional(),+ bgColor: contextCardBgColorSchema.optional(),+ bgImageSrc: z.string().optional(),+ bgImageAlt: z.string().optional(),+});++export type ContextCardItemProps = z.infer<typeof ContextCardItemSchema>;++export const ContextCardItem = defineComponent({+ name: "ContextCardItem",+ props: ContextCardItemSchema,+ description:+ "A single card inside a ContextCardBlock: a title (plain string or Tag), an optional markdown body, and an optional gray tint or background image.",+ component: () => null,+});++export const ContextCardBlockSchema = z.object({+ items: z.array(ContextCardItem.ref).min(2),+ layout: z.enum(["grid", "carousel"]).default("grid"),+ responsive: z.boolean().default(true),+ action: actionPropSchema.optional(),+ gap: z.union([z.number(), z.string()]).optional(),+});++export type ContextCardBlockProps = z.infer<typeof ContextCardBlockSchema>;diff --git a/packages/react-ui/src/genui-lib/EditableTable/index.tsx b/packages/react-ui/src/genui-lib/EditableTable/index.tsxnew file mode 100644index 000000000..b11525811--- /dev/null+++ b/packages/react-ui/src/genui-lib/EditableTable/index.tsx@@ -0,0 +1,133 @@+"use client";++import {+ defineComponent,+ useGetFieldValue,+ useIsStreaming,+ useSetFieldValue,+ useTriggerAction,+ type ComponentRenderProps,+} from "@openuidev/react-lang";+import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import {+ EditableTableChangesBar,+ EditableTable as OpenUIEditableTable,+ type EditableTableRow,+} from "../../components/EditableTable";+import { EditableTableSchema, type EditableTableData, type EditableTableProps } from "./schema";++export * from "./schema";++function EditableTableRenderer({ props }: ComponentRenderProps<EditableTableProps>) {+ const triggerAction = useTriggerAction();+ const setFieldValue = useSetFieldValue();+ const getFieldValue = useGetFieldValue();+ const isStreaming = useIsStreaming();++ const tableName = props.name;+ const columns = props.columns;+ const initialData = props.data;++ const columnKeys = useMemo(() => columns.map((c) => c.key), [columns]);++ // Positional `values` (LLM-friendly) → keyed row objects for the grid+ const toRows = useCallback(+ (data: EditableTableData): EditableTableRow[] =>+ data.map((row) => {+ const valuesMap = columnKeys.reduce((acc: Record<string, any>, key, index) => {+ acc[key] = row.values[index];+ return acc;+ }, {});+ return { ...valuesMap, id: row.id };+ }),+ [columnKeys],+ );++ const fromRows = useCallback(+ (rows: EditableTableRow[]): EditableTableData =>+ rows.map((row) => ({ id: row.id, values: columnKeys.map((key) => row[key]) })),+ [columnKeys],+ );++ const existingValue = getFieldValue(tableName, tableName);++ const baselineDataMapRef = useRef<Map<string, EditableTableRow> | undefined>(undefined);+ const [tableData, setTableData] = useState<EditableTableRow[]>(() =>+ toRows(existingValue || initialData),+ );+ const [changedCellCount, setChangedCellCount] = useState(0);++ useEffect(() => {+ setTableData(toRows(existingValue || initialData));+ }, [existingValue, initialData, toRows]);++ // Establish baseline once streaming ends so we can count changed cells+ useEffect(() => {+ if (!isStreaming && baselineDataMapRef.current === undefined) {+ baselineDataMapRef.current = new Map(+ toRows(existingValue || initialData).map((row) => [row.id, row]),+ );+ }+ }, [isStreaming, existingValue, initialData, toRows]);++ const calculateChangedCellCount = useCallback(+ (changedData: EditableTableRow[], baseline: Map<string, EditableTableRow> | undefined) => {+ if (!baseline) {+ setChangedCellCount(0);+ return;+ }+ let count = 0;+ const changedMap = new Map(changedData.map(({ id, ...values }) => [id, values]));+ baseline.forEach((baseValues, id) => {+ const changedValues = changedMap.get(id);+ if (!changedValues) return;+ for (const key of columnKeys) {+ if (changedValues[key] !== baseValues[key]) count++;+ }+ });+ setChangedCellCount(count);+ },+ [columnKeys],+ );++ const handleDataChange = useCallback(+ (changedData: EditableTableRow[]) => {+ calculateChangedCellCount(changedData, baselineDataMapRef.current);+ setTableData(changedData);+ },+ [calculateChangedCellCount],+ );++ const handleReset = useCallback(() => {+ setChangedCellCount(0);+ if (baselineDataMapRef.current) {+ setTableData(Array.from(baselineDataMapRef.current.values()));+ }+ }, []);++ const handleSubmit = useCallback(() => {+ setFieldValue(tableName, "EditableTable", tableName, fromRows(tableData));+ triggerAction("Save Changes", tableName);+ setChangedCellCount(0);+ baselineDataMapRef.current = new Map(tableData.map((row) => [row.id, row]));+ }, [tableName, tableData, fromRows, setFieldValue, triggerAction]);++ return (+ <>+ <OpenUIEditableTable data={tableData} columns={columns} onDataChange={handleDataChange} />+ <EditableTableChangesBar+ changedCellCount={changedCellCount}+ onReset={handleReset}+ onSave={handleSubmit}+ />+ </>+ );+}++export const EditableTable = defineComponent({+ name: "EditableTable",+ props: EditableTableSchema,+ description:+ "Spreadsheet-like table whose cells the user can edit inline (text, number, url, date, select columns); edits are saved back as a form field",+ component: EditableTableRenderer,+});diff --git a/packages/react-ui/src/genui-lib/EditableTable/schema.ts b/packages/react-ui/src/genui-lib/EditableTable/schema.tsnew file mode 100644index 000000000..2335b94de--- /dev/null+++ b/packages/react-ui/src/genui-lib/EditableTable/schema.ts@@ -0,0 +1,31 @@+import { z } from "zod/v4";++export const EditableTableSchema = z.object({+ /** Unique name of the table; used as the form field name for the edited data */+ name: z.string().default(""),+ /** Column definitions; `options` is only used by `select` columns */+ columns: z+ .array(+ z.object({+ type: z.enum(["text", "number", "date-single", "select", "url"]),+ key: z.string().default("default"),+ header: z.string().default(""),+ width: z.number().optional(),+ options: z.array(z.object({ value: z.string(), label: z.string() })).optional(),+ }),+ )+ .default([]),+ /** Rows; `values` are ordered positionally to match `columns` */+ data: z+ .array(+ z.object({+ id: z.string(),+ values: z.array(z.union([z.string(), z.number()])),+ }),+ )+ .default([]),+});++export type EditableTableProps = z.infer<typeof EditableTableSchema>;+export type EditableTableDataRow = { id: string; values: (string | number)[] };+export type EditableTableData = EditableTableDataRow[];diff --git a/packages/react-ui/src/genui-lib/EntityList/index.tsx b/packages/react-ui/src/genui-lib/EntityList/index.tsxnew file mode 100644index 000000000..cfb01d5b3--- /dev/null+++ b/packages/react-ui/src/genui-lib/EntityList/index.tsx@@ -0,0 +1,27 @@+"use client";++import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";+import { EntityList as OpenUIEntityList } from "../../components/EntityList";+import { asArray } from "../helpers";+import { EntityListSchema, type EntityListProps, type EntityListRow } from "./schema";++export * from "./schema";++function EntityListRenderer({ props }: ComponentRenderProps<EntityListProps>) {+ return (+ <OpenUIEntityList+ rows={asArray(props.rows) as EntityListRow[]}+ size={props.size}+ header={props.header}+ footer={props.footer}+ />+ );+}++export const EntityList = defineComponent({+ name: "EntityList",+ props: EntityListSchema,+ description:+ "Two-column key/value rows (left label, right value). size 'default' supports optional header and footer rows; rightVariant 'number' uses tabular numbers.",+ component: EntityListRenderer,+});diff --git a/packages/react-ui/src/genui-lib/EntityList/schema.ts b/packages/react-ui/src/genui-lib/EntityList/schema.tsnew file mode 100644index 000000000..6107bdb1b--- /dev/null+++ b/packages/react-ui/src/genui-lib/EntityList/schema.ts@@ -0,0 +1,22 @@+import { z } from "zod/v4";++export const EntityListRowSchema = z.object({+ left: z.string(),+ right: z.string(),+ rightVariant: z.enum(["text", "number"]).default("text"),+});++export const EntityListSchema = z+ .object({+ rows: z.array(EntityListRowSchema).default([]),+ size: z.enum(["small", "default"]).default("default"),+ header: EntityListRowSchema.optional(),+ footer: EntityListRowSchema.optional(),+ })+ .refine(({ size, header, footer }) => size === "default" || (!header && !footer), {+ message: 'EntityList size="small" does not support header or footer.',+ path: ["size"],+ });++export type EntityListRow = z.infer<typeof EntityListRowSchema>;+export type EntityListProps = z.infer<typeof EntityListSchema>;diff --git a/packages/react-ui/src/genui-lib/Form/index.tsx b/packages/react-ui/src/genui-lib/Form/index.tsxindex 25dca5064..36e3d04b5 100644--- a/packages/react-ui/src/genui-lib/Form/index.tsx+++ b/packages/react-ui/src/genui-lib/Form/index.tsx@@ -1,6 +1,7 @@"use client";import {+ ComponentRenderProps,defineComponent,FormNameContext,FormValidationContext,@@ -10,23 +11,28 @@ import { FormSchema } from "./schema";export { FormSchema } from "./schema";+type FormRenderProps = ComponentRenderProps<{ name: string; buttons: unknown; fields: unknown }>;++/** Shared renderer — also used by the chat library's Form variant (wider FormControl). */+export const FormRenderer = ({ props, renderNode }: FormRenderProps) => {+ const formValidation = useCreateFormValidation();+ const formName = props.name as string;++ return (+ <FormValidationContext.Provider value={formValidation}>+ <FormNameContext.Provider value={formName}>+ <div role="form" style={{ display: "flex", flexDirection: "column", gap: "16px" }}>+ {renderNode(props.fields)}+ {renderNode(props.buttons)}+ </div>+ </FormNameContext.Provider>+ </FormValidationContext.Provider>+ );+};+export const Form = defineComponent({name: "Form",props: FormSchema,description: "Form container with fields and explicit action buttons",- component: ({ props, renderNode }) => {- const formValidation = useCreateFormValidation();- const formName = props.name as string;-- return (- <FormValidationContext.Provider value={formValidation}>- <FormNameContext.Provider value={formName}>- <div role="form" style={{ display: "flex", flexDirection: "column", gap: "16px" }}>- {renderNode(props.fields)}- {renderNode(props.buttons)}- </div>- </FormNameContext.Provider>- </FormValidationContext.Provider>- );- },+ component: FormRenderer,});diff --git a/packages/react-ui/src/genui-lib/FormControl/index.tsx b/packages/react-ui/src/genui-lib/FormControl/index.tsxindex f18aaa82d..f0969a258 100644--- a/packages/react-ui/src/genui-lib/FormControl/index.tsx+++ b/packages/react-ui/src/genui-lib/FormControl/index.tsx@@ -1,6 +1,6 @@"use client";-import { defineComponent, useFormValidation } from "@openuidev/react-lang";+import { ComponentRenderProps, defineComponent, useFormValidation } from "@openuidev/react-lang";import { AlertCircle } from "lucide-react";import { FormControl as OpenUIFormControl } from "../../components/FormControl";import { Hint as OpenUIHint } from "../../components/FormControl/Hint";@@ -9,35 +9,47 @@ import { FormControlSchema } from "./schema";export { FormControlSchema } from "./schema";+/**+ * Shared renderer — also used by the chat library's FormControl variant, which+ * accepts a wider set of input components (Chips, OptionCards).+ */+type FormControlRenderProps = ComponentRenderProps<{+ label: string;+ input: unknown;+ hint?: string;+}>;++export const FormControlRenderer = ({ props, renderNode }: FormControlRenderProps) => {+ const formValidation = useFormValidation();+ const inputObj = props.input as any;+ // Extract the field name from the rendered input element props.+ const rawName = inputObj?.type === "element" ? inputObj.props?.name : undefined;+ const fieldName =+ typeof rawName === "object" && rawName?.name ? rawName.name : (rawName as string | undefined);+ const error = fieldName ? formValidation?.errors[fieldName] : undefined;+ const isRequired = inputObj?.type === "element" && inputObj.props?.rules?.required === true;++ return (+ <OpenUIFormControl>+ <OpenUILabel className="text-sm font-medium" required={isRequired} htmlFor={fieldName}>+ {props.label as string}+ </OpenUILabel>+ {renderNode(props.input)}+ {error ? (+ <OpenUIHint hasError={true}>+ <AlertCircle size={14} />+ {error}+ </OpenUIHint>+ ) : props.hint ? (+ <OpenUIHint>{props.hint as string}</OpenUIHint>+ ) : null}+ </OpenUIFormControl>+ );+};+export const FormControl = defineComponent({name: "FormControl",props: FormControlSchema,description: "Field with label, input component, and optional hint text",- component: ({ props, renderNode }) => {- const formValidation = useFormValidation();- const inputObj = props.input as any;- // Extract the field name from the rendered input element props.- const rawName = inputObj?.type === "element" ? inputObj.props?.name : undefined;- const fieldName =- typeof rawName === "object" && rawName?.name ? rawName.name : (rawName as string | undefined);- const error = fieldName ? formValidation?.errors[fieldName] : undefined;- const isRequired = inputObj?.type === "element" && inputObj.props?.rules?.required === true;-- return (- <OpenUIFormControl>- <OpenUILabel className="text-sm font-medium" required={isRequired} htmlFor={fieldName}>- {props.label as string}- </OpenUILabel>- {renderNode(props.input)}- {error ? (- <OpenUIHint hasError={true}>- <AlertCircle size={14} />- {error}- </OpenUIHint>- ) : props.hint ? (- <OpenUIHint>{props.hint as string}</OpenUIHint>- ) : null}- </OpenUIFormControl>- );- },+ component: FormControlRenderer,});diff --git a/packages/react-ui/src/genui-lib/Icon/index.tsx b/packages/react-ui/src/genui-lib/Icon/index.tsxnew file mode 100644index 000000000..4555ed02e--- /dev/null+++ b/packages/react-ui/src/genui-lib/Icon/index.tsx@@ -0,0 +1,20 @@+"use client";++import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";+import { IconWrapper } from "../../components/_shared/icons";+import { IconSchema, type IconProps } from "./schema";++export * from "./schema";++function IconRenderer({ props }: ComponentRenderProps<IconProps>) {+ if (!props.name) return null;+ return <IconWrapper name={props.name} category={props.category} />;+}++export const Icon = defineComponent({+ name: "Icon",+ props: IconSchema,+ description:+ "A lucide icon by kebab-case name (e.g. 'circle-check'). Optional category picks a topical fallback when the name doesn't resolve.",+ component: IconRenderer,+});diff --git a/packages/react-ui/src/genui-lib/Icon/schema.ts b/packages/react-ui/src/genui-lib/Icon/schema.tsnew file mode 100644index 000000000..a42f65887--- /dev/null+++ b/packages/react-ui/src/genui-lib/Icon/schema.ts@@ -0,0 +1,3 @@+// Canonical icon schema lives in components/_shared/icons — one wire contract+// for every surface that embeds an Icon.+export { iconPropsSchema as IconSchema, type IconProps } from "../../components/_shared/icons";diff --git a/packages/react-ui/src/genui-lib/IconButton/index.tsx b/packages/react-ui/src/genui-lib/IconButton/index.tsxnew file mode 100644index 000000000..55604567d--- /dev/null+++ b/packages/react-ui/src/genui-lib/IconButton/index.tsx@@ -0,0 +1,41 @@+"use client";++import type { ActionPlan } from "@openuidev/react-lang";+import {+ ComponentRenderProps,+ defineComponent,+ useFormName,+ useIsStreaming,+ useTriggerAction,+} from "@openuidev/react-lang";+import { IconButton as OpenUIIconButton } from "../../components/IconButton";+import { IconWrapper } from "../../components/_shared/icons";+import { IconButtonSchema, type IconButtonProps } from "./schema";++export * from "./schema";++function IconButtonRenderer({ props }: ComponentRenderProps<IconButtonProps>) {+ const triggerAction = useTriggerAction();+ const formName = useFormName();+ const isStreaming = useIsStreaming();++ return (+ <OpenUIIconButton+ icon={<IconWrapper name={props.icon.props.name} category={props.icon.props.category} />}+ variant={props.variant ?? "secondary"}+ size={props.size ?? "medium"}+ shape={props.shape ?? "square"}+ disabled={isStreaming}+ aria-label={props.name}+ onClick={() => triggerAction(props.name, formName, props.action as ActionPlan | undefined)}+ />+ );+}++export const IconButton = defineComponent({+ name: "IconButton",+ props: IconButtonSchema,+ description:+ "Icon-only button. name is the accessible label and the action label; icon is an Icon; action fires on click.",+ component: IconButtonRenderer,+});diff --git a/packages/react-ui/src/genui-lib/IconButton/schema.ts b/packages/react-ui/src/genui-lib/IconButton/schema.tsnew file mode 100644index 000000000..92b5dd4b9--- /dev/null+++ b/packages/react-ui/src/genui-lib/IconButton/schema.ts@@ -0,0 +1,13 @@+import { z } from "zod/v4";+import { actionPropSchema } from "../Action/schema";+import { Icon } from "../Icon";++export const IconButtonSchema = z.object({+ name: z.string(),+ icon: Icon.ref,+ action: actionPropSchema.optional(),+ variant: z.enum(["primary", "secondary", "tertiary"]).optional(),+ size: z.enum(["extra-small", "small", "medium", "large"]).optional(),+ shape: z.enum(["square", "circle"]).optional(),+});+export type IconButtonProps = z.infer<typeof IconButtonSchema>;diff --git a/packages/react-ui/src/genui-lib/IconText/index.tsx b/packages/react-ui/src/genui-lib/IconText/index.tsxnew file mode 100644index 000000000..cace3fcda--- /dev/null+++ b/packages/react-ui/src/genui-lib/IconText/index.tsx@@ -0,0 +1,28 @@+"use client";++import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";+import { IconText as OpenUIIconText } from "../../components/IconText";+import { IconTextSchema, type IconTextProps } from "./schema";++export * from "./schema";++function IconTextRenderer({ props }: ComponentRenderProps<IconTextProps>) {+ return (+ <OpenUIIconText+ icon={props.icon.props}+ iconVariant={props.iconVariant}+ title={props.title}+ subtitle={props.subtitle}+ bold={props.bold}+ layout={props.layout}+ />+ );+}++export const IconText = defineComponent({+ name: "IconText",+ props: IconTextSchema,+ description:+ "An icon badge with a title and optional subtitle, laid out horizontally or vertically. iconVariant sets the badge color.",+ component: IconTextRenderer,+});diff --git a/packages/react-ui/src/genui-lib/IconText/schema.ts b/packages/react-ui/src/genui-lib/IconText/schema.tsnew file mode 100644index 000000000..74c7e576c--- /dev/null+++ b/packages/react-ui/src/genui-lib/IconText/schema.ts@@ -0,0 +1,15 @@+import { z } from "zod/v4";+import { Icon } from "../Icon";++export const IconTextSchema = z.object({+ icon: Icon.ref,+ iconVariant: z+ .enum(["neutral", "info", "success", "warning", "danger", "inverted", "filled", "soft"])+ .default("neutral"),+ iconSize: z.enum(["xs", "s", "m", "l", "xl", "sm", "md", "lg"]).default("m"),+ title: z.string(),+ subtitle: z.string().optional(),+ bold: z.boolean().default(false),+ layout: z.enum(["horizontal", "vertical"]).default("horizontal"),+});+export type IconTextProps = z.infer<typeof IconTextSchema>;diff --git a/packages/react-ui/src/genui-lib/ImageText/index.tsx b/packages/react-ui/src/genui-lib/ImageText/index.tsxnew file mode 100644index 000000000..a11e8059e--- /dev/null+++ b/packages/react-ui/src/genui-lib/ImageText/index.tsx@@ -0,0 +1,29 @@+"use client";++import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";+import { ImageText as OpenUIImageText } from "../../components/ImageText";+import { ImageTextSchema, type ImageTextProps } from "./schema";++export * from "./schema";++function ImageTextRenderer({ props }: ComponentRenderProps<ImageTextProps>) {+ return (+ <OpenUIImageText+ src={props.src}+ alt={props.alt}+ title={props.title}+ subtitle={props.subtitle}+ bold={props.bold}+ layout={props.layout}+ imageSize={props.imageSize}+ />+ );+}++export const ImageText = defineComponent({+ name: "ImageText",+ props: ImageTextSchema,+ description:+ "A small square image (thumbnail/avatar) with a title and optional subtitle. src must be a real image URL.",+ component: ImageTextRenderer,+});diff --git a/packages/react-ui/src/genui-lib/ImageText/schema.ts b/packages/react-ui/src/genui-lib/ImageText/schema.tsnew file mode 100644index 000000000..8874f50a8--- /dev/null+++ b/packages/react-ui/src/genui-lib/ImageText/schema.ts@@ -0,0 +1,12 @@+import { z } from "zod/v4";++export const ImageTextSchema = z.object({+ src: z.string(),+ alt: z.string().optional(),+ title: z.string(),+ subtitle: z.string().optional(),+ bold: z.boolean().default(false),+ layout: z.enum(["horizontal", "vertical"]).default("horizontal"),+ imageSize: z.number().optional(),+});+export type ImageTextProps = z.infer<typeof ImageTextSchema>;diff --git a/packages/react-ui/src/genui-lib/ImageTextLarge/index.tsx b/packages/react-ui/src/genui-lib/ImageTextLarge/index.tsxnew file mode 100644index 000000000..832fcf6f0--- /dev/null+++ b/packages/react-ui/src/genui-lib/ImageTextLarge/index.tsx@@ -0,0 +1,26 @@+"use client";++import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";+import { ImageTextLarge as OpenUIImageTextLarge } from "../../components/ImageTextLarge";+import { ImageTextLargeSchema, type ImageTextLargeProps } from "./schema";++export * from "./schema";++function ImageTextLargeRenderer({ props }: ComponentRenderProps<ImageTextLargeProps>) {+ return (+ <OpenUIImageTextLarge+ src={props.src}+ alt={props.alt}+ title={props.title}+ subtitle={props.subtitle}+ />+ );+}++export const ImageTextLarge = defineComponent({+ name: "ImageTextLarge",+ props: ImageTextLargeSchema,+ description:+ "A full-width banner image above a bold title and optional subtitle. src must be a real image URL.",+ component: ImageTextLargeRenderer,+});diff --git a/packages/react-ui/src/genui-lib/ImageTextLarge/schema.ts b/packages/react-ui/src/genui-lib/ImageTextLarge/schema.tsnew file mode 100644index 000000000..e82282b32--- /dev/null+++ b/packages/react-ui/src/genui-lib/ImageTextLarge/schema.ts@@ -0,0 +1,10 @@+import { z } from "zod/v4";++export const ImageTextLargeSchema = z.object({+ src: z.string(),+ alt: z.string().optional(),+ title: z.string(),+ subtitle: z.string().optional(),+ bold: z.boolean().default(false),+});+export type ImageTextLargeProps = z.infer<typeof ImageTextLargeSchema>;diff --git a/packages/react-ui/src/genui-lib/InlineHeader/index.tsx b/packages/react-ui/src/genui-lib/InlineHeader/index.tsxnew file mode 100644index 000000000..e421de9fb--- /dev/null+++ b/packages/react-ui/src/genui-lib/InlineHeader/index.tsx@@ -0,0 +1,19 @@+"use client";++import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";+import { InlineHeader as OpenUIInlineHeader } from "../../components/InlineHeader";+import { InlineHeaderSchema, type InlineHeaderProps } from "./schema";++export * from "./schema";++function InlineHeaderRenderer({ props }: ComponentRenderProps<InlineHeaderProps>) {+ return <OpenUIInlineHeader heading={props.heading} description={props.description} />;+}++export const InlineHeader = defineComponent({+ name: "InlineHeader",+ props: InlineHeaderSchema,+ description:+ "Compact section heading with an optional one-line description, for use inside cards.",+ component: InlineHeaderRenderer,+});diff --git a/packages/react-ui/src/genui-lib/InlineHeader/schema.ts b/packages/react-ui/src/genui-lib/InlineHeader/schema.tsnew file mode 100644index 000000000..58eb38a5d--- /dev/null+++ b/packages/react-ui/src/genui-lib/InlineHeader/schema.ts@@ -0,0 +1,7 @@+import { z } from "zod/v4";++export const InlineHeaderSchema = z.object({+ heading: z.string(),+ description: z.string().optional(),+});+export type InlineHeaderProps = z.infer<typeof InlineHeaderSchema>;diff --git a/packages/react-ui/src/genui-lib/ListBlock/index.tsx b/packages/react-ui/src/genui-lib/ListBlock/index.tsxindex e24b33fdd..693f953e6 100644--- a/packages/react-ui/src/genui-lib/ListBlock/index.tsx+++ b/packages/react-ui/src/genui-lib/ListBlock/index.tsx@@ -13,17 +13,19 @@ export const ListBlock = defineComponent({props: z.object({items: z.array(ListItem.ref),variant: z.enum(["number", "image"]).optional(),+ size: z.enum(["default", "small"]).optional(),}),description:- "A list of items with number or image indicators. Each item can optionally have an action.",+ "A list of items with number or image indicators. Each item can optionally have an action. size small renders a compact list.",component: ({ props }) => {const triggerAction = useTriggerAction();const items = (props.items ?? []) as any[];const variant = (props.variant as "number" | "image") ?? "number";+ const size = (props.size as "default" | "small") ?? "default";const listHasSubtitle = items.some((item) => !!item?.props?.subtitle);return (- <OpenUIListBlock variant={variant}>+ <OpenUIListBlock variant={variant} size={size}>{items.map((item, index) => {const title = String(item?.props?.title ?? "");const subtitle = item?.props?.subtitle ? String(item.props.subtitle) : undefined;diff --git a/packages/react-ui/src/genui-lib/MetricIndicator/index.tsx b/packages/react-ui/src/genui-lib/MetricIndicator/index.tsxnew file mode 100644index 000000000..0a2f6668e--- /dev/null+++ b/packages/react-ui/src/genui-lib/MetricIndicator/index.tsx@@ -0,0 +1,52 @@+"use client";++import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";+import {+ MetricIndicatorInline as OpenUIMetricIndicatorInline,+ MetricIndicatorWithStrikethrough as OpenUIMetricIndicatorWithStrikethrough,+} from "../../components/MetricIndicator";+import {+ MetricIndicatorInlineSchema,+ MetricIndicatorWithStrikethroughSchema,+ type MetricIndicatorInlineProps,+ type MetricIndicatorWithStrikethroughProps,+} from "./schema";++export * from "./schema";++function MetricIndicatorWithStrikethroughRenderer({+ props,+}: ComponentRenderProps<MetricIndicatorWithStrikethroughProps>) {+ return (+ <OpenUIMetricIndicatorWithStrikethrough+ value={props.value}+ subtext={props.subtext}+ previousValue={props.previousValue}+ trend={props.trend}+ />+ );+}++function MetricIndicatorInlineRenderer({+ props,+}: ComponentRenderProps<MetricIndicatorInlineProps>) {+ return (+ <OpenUIMetricIndicatorInline value={props.value} subtext={props.subtext} trend={props.trend} />+ );+}++export const MetricIndicatorWithStrikethrough = defineComponent({+ name: "MetricIndicatorWithStrikethrough",+ props: MetricIndicatorWithStrikethroughSchema,+ description:+ "Headline metric value with an optional struck-through previousValue, a +/- percentage trend, and subtext below.",+ component: MetricIndicatorWithStrikethroughRenderer,+});++export const MetricIndicatorInline = defineComponent({+ name: "MetricIndicatorInline",+ props: MetricIndicatorInlineSchema,+ description:+ "Headline metric value with an optional +/- percentage trend and subtext, all on one line.",+ component: MetricIndicatorInlineRenderer,+});diff --git a/packages/react-ui/src/genui-lib/MetricIndicator/schema.ts b/packages/react-ui/src/genui-lib/MetricIndicator/schema.tsnew file mode 100644index 000000000..ca058a619--- /dev/null+++ b/packages/react-ui/src/genui-lib/MetricIndicator/schema.ts@@ -0,0 +1,25 @@+import { z } from "zod/v4";++export const MetricIndicatorTrendSchema = z.object({+ direction: z.enum(["up", "down"]),+ value: z.number(),+});++export const MetricIndicatorWithStrikethroughSchema = z.object({+ value: z.string(),+ subtext: z.string().optional(),+ previousValue: z.string().optional(),+ trend: MetricIndicatorTrendSchema.optional(),+});++export const MetricIndicatorInlineSchema = z.object({+ value: z.string(),+ subtext: z.string().optional(),+ trend: MetricIndicatorTrendSchema.optional(),+});++export type MetricIndicatorTrend = z.infer<typeof MetricIndicatorTrendSchema>;+export type MetricIndicatorWithStrikethroughProps = z.infer<+ typeof MetricIndicatorWithStrikethroughSchema+>;+export type MetricIndicatorInlineProps = z.infer<typeof MetricIndicatorInlineSchema>;diff --git a/packages/react-ui/src/genui-lib/OptionCards/index.tsx b/packages/react-ui/src/genui-lib/OptionCards/index.tsxnew file mode 100644index 000000000..c63525bc1--- /dev/null+++ b/packages/react-ui/src/genui-lib/OptionCards/index.tsx@@ -0,0 +1,133 @@+"use client";++import {+ ComponentRenderProps,+ defineComponent,+ parseStructuredRules,+ useFormName,+ useFormValidation,+ useGetFieldValue,+ useIsStreaming,+ useSetFieldValue,+ type SubComponentOf,+} from "@openuidev/react-lang";+import React from "react";+import { OptionCards as OpenUIOptionCards } from "../../components/OptionCards";+import { useHydrateDefaultFieldValue } from "../formDefaultValueUtils";+import { getStoredDefaultValue, normalizeSelection, toggleSelection } from "../selectionFieldUtils";+import { OptionCardsSchema, type OptionCardProps, type OptionCardsProps } from "./schema";++export * from "./schema";++function isImageTopContent(topContent: unknown): boolean {+ const candidate = topContent as { type?: unknown; props?: { src?: unknown } } | null | undefined;++ return (+ typeof candidate === "object" &&+ candidate !== null &&+ candidate.type === "element" &&+ typeof candidate.props?.src === "string"+ );+}++function OptionCardsRenderer({ props, renderNode }: ComponentRenderProps<OptionCardsProps>) {+ const formName = useFormName();+ const getFieldValue = useGetFieldValue();+ const setFieldValue = useSetFieldValue();+ const isStreaming = useIsStreaming();+ const formValidation = useFormValidation();++ const fieldName = props.name;+ const type = props.type ?? "single";+ const rules = React.useMemo(() => parseStructuredRules(props.rules), [props.rules]);+ const hasRules = rules.length > 0;++ const items = ((props.items ?? []) as Array<SubComponentOf<OptionCardProps>>).filter(+ (item) => item.props.value,+ );+ const existingValue = getFieldValue(formName, fieldName);+ const selection = normalizeSelection(type, existingValue, props.defaultValue);+ const storedDefaultValue = React.useMemo(+ () => getStoredDefaultValue(type, props.defaultValue),+ [type, props.defaultValue],+ );++ useHydrateDefaultFieldValue({+ formName,+ componentType: "OptionCards",+ name: fieldName,+ existingValue,+ defaultValue: storedDefaultValue,+ });++ React.useEffect(() => {+ if (!isStreaming && hasRules && formValidation) {+ formValidation.registerField(fieldName, rules, () => {+ const value = getFieldValue(formName, fieldName) ?? storedDefaultValue;+ if (type === "single") {+ return typeof value === "string" && value ? value : undefined;+ }+ return Array.isArray(value) && value.length > 0 ? value : undefined;+ });+ return () => formValidation.unregisterField(fieldName);+ }+ return undefined;+ }, [+ fieldName,+ formName,+ formValidation,+ getFieldValue,+ hasRules,+ isStreaming,+ rules,+ storedDefaultValue,+ type,+ ]);++ const handleToggle = (itemValue: string) => {+ if (isStreaming) return;++ const nextSelection = toggleSelection(type, selection, itemValue);+ const storedValue = type === "single" ? (nextSelection[0] ?? undefined) : nextSelection;+ const validationValue =+ type === "single"+ ? (nextSelection[0] ?? undefined)+ : nextSelection.length > 0+ ? nextSelection+ : undefined;++ setFieldValue(formName, "OptionCards", fieldName, storedValue, true);++ if (hasRules) {+ formValidation?.validateField(fieldName, validationValue, rules);+ }+ };++ return (+ <OpenUIOptionCards+ type={type}+ selected={selection}+ disabled={isStreaming}+ onToggle={handleToggle}+ items={items.map((item) => {+ const topContent = item.props.topContent;+ return {+ value: item.props.value,+ title: item.props.title,+ subtitle: item.props.subtitle,+ topContent: topContent != null ? renderNode(topContent) : undefined,+ topContentVariant: isImageTopContent(topContent) ? "image" : "icon",+ disabled: item.props.disabled,+ };+ })}+ />+ );+}++export const OptionCards = defineComponent({+ name: "OptionCards",+ props: OptionCardsSchema,+ description:+ "A form field of selectable cards (title, optional subtitle, optional icon or image) laid out in a responsive grid for choosing one or many options; the selection is stored under `name`.",+ component: OptionCardsRenderer,+});diff --git a/packages/react-ui/src/genui-lib/OptionCards/schema.ts b/packages/react-ui/src/genui-lib/OptionCards/schema.tsnew file mode 100644index 000000000..6ad70ba19--- /dev/null+++ b/packages/react-ui/src/genui-lib/OptionCards/schema.ts@@ -0,0 +1,35 @@+import { defineComponent } from "@openuidev/react-lang";+import { z } from "zod/v4";+import { Icon } from "../Icon";+import { Image } from "../Image";+import { rulesSchema } from "../rules";++export const OptionCardSchema = z.object({+ value: z.string(),+ title: z.string(),+ subtitle: z.string().optional(),+ topContent: z.union([Icon.ref, Image.ref]).optional(),+ disabled: z.boolean().optional(),+});++export type OptionCardProps = z.infer<typeof OptionCardSchema>;++export type OptionCardTopContent = NonNullable<OptionCardProps["topContent"]>;++export const OptionCard = defineComponent({+ name: "OptionCard",+ props: OptionCardSchema,+ description:+ "A single selectable card inside an OptionCards group, with a value, title, optional subtitle and an optional Icon or Image on top.",+ component: () => null,+});++export const OptionCardsSchema = z.object({+ name: z.string(),+ type: z.enum(["single", "multiple"]).default("single"),+ items: z.array(OptionCard.ref).default([]),+ rules: rulesSchema,+ defaultValue: z.union([z.string(), z.array(z.string())]).optional(),+});++export type OptionCardsProps = z.infer<typeof OptionCardsSchema>;diff --git a/packages/react-ui/src/genui-lib/OverviewCardBlock/index.tsx b/packages/react-ui/src/genui-lib/OverviewCardBlock/index.tsxnew file mode 100644index 000000000..84078d943--- /dev/null+++ b/packages/react-ui/src/genui-lib/OverviewCardBlock/index.tsx@@ -0,0 +1,100 @@+"use client";++import {+ ComponentRenderProps,+ defineComponent,+ useFormName,+ useIsStreaming,+ useTriggerAction,+} from "@openuidev/react-lang";+import { OverviewCardBlock as OpenUIOverviewCardBlock } from "../../components/OverviewCardBlock";+import { withItemContext } from "../cardActionUtils";+import {+ OverviewCardBlockSchema,+ type OverviewCardBlockProps,+ type OverviewCardItemNode,+} from "./schema";++export * from "./schema";++function getStringProp(node: unknown, key: string): string | undefined {+ const props =+ typeof node === "object" && node !== null && "props" in node+ ? (node as { props?: Record<string, unknown> }).props+ : undefined;+ const value = props?.[key];+ return typeof value === "string" ? value : undefined;+}++function getOverviewTitle(item: OverviewCardItemNode): string | undefined {+ return getStringProp(item.props.top, "title") ?? getStringProp(item.props.top, "value");+}++function OverviewCardBlockRenderer({+ props,+ renderNode,+}: ComponentRenderProps<OverviewCardBlockProps>) {+ const triggerAction = useTriggerAction();+ const formName = useFormName();+ const isStreaming = useIsStreaming();++ const items = (props.items ?? []) as OverviewCardItemNode[];+ const isClickable = Boolean(props.action) && !isStreaming;++ const handleItemClick = (item: OverviewCardItemNode, index: number) => {+ if (!props.action || isStreaming) return;+ const { id, top, bottom } = item.props;+ const title = getOverviewTitle(item);+ const label = title ?? id ?? `Overview card ${index + 1}`;+ triggerAction(+ label,+ formName,+ withItemContext(props.action, {+ itemIndex: index,+ itemId: id,+ itemTitle: title,+ itemSubtitle: getStringProp(top, "subtitle") ?? getStringProp(top, "subtext"),+ itemMetricValue: bottom?.props.value,+ }),+ );+ };++ return (+ <OpenUIOverviewCardBlock+ layout={props.layout ?? "grid"}+ responsive={props.responsive !== false}+ gap={props.gap}+ clickable={isClickable}+ onItemClick={+ isClickable+ ? (_item, index) => {+ const item = items[index];+ if (item) handleItemClick(item, index);+ }+ : undefined+ }+ items={items.map((item) => {+ const { id, top, bottom } = item.props;+ return {+ id,+ top: top ? renderNode(top) : undefined,+ bottom: bottom+ ? {+ value: bottom.props.value,+ subtext: bottom.props.subtext,+ trend: bottom.props.trend,+ }+ : undefined,+ };+ })}+ />+ );+}++export const OverviewCardBlock = defineComponent({+ name: "OverviewCardBlock",+ props: OverviewCardBlockSchema,+ description:+ "A grid or horizontal carousel of compact overview cards, each with a heading (icon/image/text) on top and an inline metric below; optionally clickable with a shared action.",+ component: OverviewCardBlockRenderer,+});diff --git a/packages/react-ui/src/genui-lib/OverviewCardBlock/schema.ts b/packages/react-ui/src/genui-lib/OverviewCardBlock/schema.tsnew file mode 100644index 000000000..506132628--- /dev/null+++ b/packages/react-ui/src/genui-lib/OverviewCardBlock/schema.ts@@ -0,0 +1,33 @@+import { defineComponent } from "@openuidev/react-lang";+import { z } from "zod/v4";+import { actionPropSchema } from "../Action/schema";+import { IconText } from "../IconText";+import { ImageText } from "../ImageText";+import { MetricIndicatorInline } from "../MetricIndicator";+import { Text } from "../Text";++export const OverviewCardItemSchema = z.object({+ id: z.string().optional(),+ top: z.union([IconText.ref, ImageText.ref, Text.ref]),+ bottom: z.optional(MetricIndicatorInline.ref),+});++export const OverviewCardItem = defineComponent({+ name: "OverviewCardItem",+ props: OverviewCardItemSchema,+ description:+ "One overview card: a heading slot at the top (IconText, ImageText or Text) and an optional MetricIndicatorInline at the bottom.",+ component: () => null,+});++export const OverviewCardBlockSchema = z.object({+ items: z.array(OverviewCardItem.ref).min(2),+ layout: z.enum(["grid", "carousel"]).default("grid"),+ responsive: z.boolean().default(true),+ action: actionPropSchema.optional(),+ gap: z.union([z.number(), z.string()]).optional(),+});++export type OverviewCardItemProps = z.infer<typeof OverviewCardItemSchema>;+export type OverviewCardBlockProps = z.infer<typeof OverviewCardBlockSchema>;+export type OverviewCardItemNode = OverviewCardBlockProps["items"][number];diff --git a/packages/react-ui/src/genui-lib/SectionBlock/index.tsx b/packages/react-ui/src/genui-lib/SectionBlock/index.tsxindex e38f22e06..2daa2b713 100644--- a/packages/react-ui/src/genui-lib/SectionBlock/index.tsx+++ b/packages/react-ui/src/genui-lib/SectionBlock/index.tsx@@ -1,6 +1,6 @@"use client";-import { defineComponent, useIsStreaming } from "@openuidev/react-lang";+import { ComponentRenderProps, defineComponent, useIsStreaming } from "@openuidev/react-lang";import React from "react";import { z } from "zod/v4";import {@@ -12,77 +12,82 @@ import {import { SectionV2 } from "../../components/SectionBlock/SectionV2";import { SectionItem } from "../SectionItem";-export const SectionBlock = defineComponent({- name: "SectionBlock",- props: z.object({- sections: z.array(SectionItem.ref),- isFoldable: z.boolean().optional(),- }),- description:- "Collapsible accordion sections. Auto-opens sections as they stream in. Use SectionItem for each section.",- component: ({ props, renderNode }) => {- const items = (props.sections ?? []) as any[];- const isFoldable = props.isFoldable !== false;- const isStreaming = useIsStreaming();+type SectionBlockRenderProps = ComponentRenderProps<{ sections: unknown[]; isFoldable?: boolean }>;- const firstItemValue = items[0]?.props?.value as string | undefined;+/** Shared renderer — also used by the chat library's SectionBlock variant (wider SectionItem). */+export const SectionBlockRenderer = ({ props, renderNode }: SectionBlockRenderProps) => {+ const items = (props.sections ?? []) as any[];+ const isFoldable = props.isFoldable !== false;+ const isStreaming = useIsStreaming();- const [openItems, setOpenItems] = React.useState<string[]>([]);- const userSelected = React.useRef(false);- const prevLengthRef = React.useRef(0);- const prevIsStreaming = React.useRef(isStreaming);+ const firstItemValue = items[0]?.props?.value as string | undefined;- // During streaming: auto-open each new section as it arrives- React.useEffect(() => {- if (items.length === 0) return;+ const [openItems, setOpenItems] = React.useState<string[]>([]);+ const userSelected = React.useRef(false);+ const prevLengthRef = React.useRef(0);+ const prevIsStreaming = React.useRef(isStreaming);- if (isStreaming && items.length > prevLengthRef.current && !userSelected.current) {- const last = items[items.length - 1];- const lastValue = last?.props?.value as string | undefined;- if (lastValue) {- setOpenItems((prev) => (prev.includes(lastValue) ? prev : [...prev, lastValue]));- }- } else {- setOpenItems((prev) => (prev.length === 0 && firstItemValue ? [firstItemValue] : prev));- }+ // During streaming: auto-open each new section as it arrives+ React.useEffect(() => {+ if (items.length === 0) return;- prevLengthRef.current = items.length;- }, [items.length, isStreaming, firstItemValue]);-- // When streaming ends: collapse back to first item (unless user interacted)- React.useEffect(() => {- if (prevIsStreaming.current && !isStreaming && !userSelected.current && items.length > 0) {- setOpenItems(firstItemValue ? [firstItemValue] : []);+ if (isStreaming && items.length > prevLengthRef.current && !userSelected.current) {+ const last = items[items.length - 1];+ const lastValue = last?.props?.value as string | undefined;+ if (lastValue) {+ setOpenItems((prev) => (prev.includes(lastValue) ? prev : [...prev, lastValue]));}- prevIsStreaming.current = isStreaming;- }, [isStreaming]);+ } else {+ setOpenItems((prev) => (prev.length === 0 && firstItemValue ? [firstItemValue] : prev));+ }- const handleValueChange = React.useCallback((value: string[] | undefined) => {- userSelected.current = true;- setOpenItems(value ?? []);- }, []);+ prevLengthRef.current = items.length;+ }, [items.length, isStreaming, firstItemValue]);- if (!isFoldable) {- return (- <>- {items.map((item, index) => (- <SectionV2 key={index} trigger={String(item?.props?.trigger ?? "")}>- {renderNode(item?.props?.content)}- </SectionV2>- ))}- </>- );+ // When streaming ends: collapse back to first item (unless user interacted)+ React.useEffect(() => {+ if (prevIsStreaming.current && !isStreaming && !userSelected.current && items.length > 0) {+ setOpenItems(firstItemValue ? [firstItemValue] : []);}+ prevIsStreaming.current = isStreaming;+ }, [isStreaming]);+ const handleValueChange = React.useCallback((value: string[] | undefined) => {+ userSelected.current = true;+ setOpenItems(value ?? []);+ }, []);++ if (!isFoldable) {return (- <FoldableSectionRoot type="multiple" value={openItems} onValueChange={handleValueChange}>+ <>{items.map((item, index) => (- <FoldableSectionItem key={index} value={String(item?.props?.value ?? index)}>- <FoldableSectionTrigger text={String(item?.props?.trigger ?? "")} />- <FoldableSectionContent>{renderNode(item?.props?.content)}</FoldableSectionContent>- </FoldableSectionItem>+ <SectionV2 key={index} trigger={String(item?.props?.trigger ?? "")}>+ {renderNode(item?.props?.content)}+ </SectionV2>))}- </FoldableSectionRoot>+ </>);- },+ }++ return (+ <FoldableSectionRoot type="multiple" value={openItems} onValueChange={handleValueChange}>+ {items.map((item, index) => (+ <FoldableSectionItem key={index} value={String(item?.props?.value ?? index)}>+ <FoldableSectionTrigger text={String(item?.props?.trigger ?? "")} />+ <FoldableSectionContent>{renderNode(item?.props?.content)}</FoldableSectionContent>+ </FoldableSectionItem>+ ))}+ </FoldableSectionRoot>+ );+};++export const SectionBlock = defineComponent({+ name: "SectionBlock",+ props: z.object({+ sections: z.array(SectionItem.ref),+ isFoldable: z.boolean().optional(),+ }),+ description:+ "Collapsible accordion sections. Auto-opens sections as they stream in. Use SectionItem for each section.",+ component: SectionBlockRenderer,});diff --git a/packages/react-ui/src/genui-lib/SnippetCardBlock/index.tsx b/packages/react-ui/src/genui-lib/SnippetCardBlock/index.tsxnew file mode 100644index 000000000..ba33c1c8a--- /dev/null+++ b/packages/react-ui/src/genui-lib/SnippetCardBlock/index.tsx@@ -0,0 +1,96 @@+"use client";++import {+ ComponentRenderProps,+ defineComponent,+ useFormName,+ useIsStreaming,+ useTriggerAction,+} from "@openuidev/react-lang";+import { SnippetCardBlock as OpenUISnippetCardBlock } from "../../components/SnippetCardBlock";+import { withItemContext } from "../cardActionUtils";+import {+ SnippetCardBlockSchema,+ type SnippetCardBlockProps,+ type SnippetCardItemNode,+} from "./schema";++export * from "./schema";++function getStringProp(node: unknown, key: string): string | undefined {+ const props =+ typeof node === "object" && node !== null && "props" in node+ ? (node as { props?: Record<string, unknown> }).props+ : undefined;+ const value = props?.[key];+ return typeof value === "string" ? value : undefined;+}++function SnippetCardBlockRenderer({+ props,+ renderNode,+}: ComponentRenderProps<SnippetCardBlockProps>) {+ const triggerAction = useTriggerAction();+ const formName = useFormName();+ const isStreaming = useIsStreaming();++ const items = (props.items ?? []) as SnippetCardItemNode[];+ const isClickable = Boolean(props.action) && !isStreaming;++ const handleItemClick = (item: SnippetCardItemNode, index: number) => {+ if (!props.action || isStreaming) return;+ const { id, lhs, rhs } = item.props;+ const label = getStringProp(lhs, "title") ?? id ?? `Snippet card ${index + 1}`;+ triggerAction(+ label,+ formName,+ withItemContext(props.action, {+ itemIndex: index,+ itemId: id,+ itemTitle: getStringProp(lhs, "title"),+ itemSubtitle: getStringProp(lhs, "subtitle"),+ itemValue: getStringProp(rhs, "value"),+ }),+ );+ };++ return (+ <OpenUISnippetCardBlock+ responsive={props.responsive !== false}+ gap={props.gap}+ clickable={isClickable}+ onItemClick={+ isClickable+ ? (_item, index) => {+ const item = items[index];+ if (item) handleItemClick(item, index);+ }+ : undefined+ }+ items={items.map((item) => {+ const { id, lhs, rhs } = item.props;+ return {+ id,+ lhs: renderNode(lhs),+ rhs: rhs ? renderNode({ ...rhs, props: { ...rhs.props, size: "xs" } }) : undefined,+ lhsTooltip: {+ heading: getStringProp(lhs, "title"),+ content: getStringProp(lhs, "subtitle"),+ },+ rhsTooltip: {+ heading: getStringProp(rhs, "value"),+ content: getStringProp(rhs, "subtext"),+ },+ };+ })}+ />+ );+}++export const SnippetCardBlock = defineComponent({+ name: "SnippetCardBlock",+ props: SnippetCardBlockSchema,+ description:+ "A responsive grid of compact label/value cards (2 per row) for showing several short facts side by side; optionally clickable with a shared action.",+ component: SnippetCardBlockRenderer,+});diff --git a/packages/react-ui/src/genui-lib/SnippetCardBlock/schema.ts b/packages/react-ui/src/genui-lib/SnippetCardBlock/schema.tsnew file mode 100644index 000000000..8e30ab29e--- /dev/null+++ b/packages/react-ui/src/genui-lib/SnippetCardBlock/schema.ts@@ -0,0 +1,33 @@+import { defineComponent } from "@openuidev/react-lang";+import { z } from "zod/v4";+import { actionPropSchema } from "../Action/schema";+import { BoldText } from "../BoldText";+import { IconText } from "../IconText";+import { ImageText } from "../ImageText";+import { Text } from "../Text";++export const SnippetCardItemSchema = z.object({+ id: z.string().optional(),+ lhs: z.union([IconText.ref, ImageText.ref]),+ rhs: z.union([Text.ref, BoldText.ref]).optional(),+});++export const SnippetCardItem = defineComponent({+ name: "SnippetCardItem",+ props: SnippetCardItemSchema,+ description:+ "One row-style snippet card: a label on the left (IconText or ImageText) and an optional value on the right (Text or BoldText).",+ component: () => null,+});++export const SnippetCardBlockSchema = z.object({+ items: z.array(SnippetCardItem.ref).min(2),+ layout: z.enum(["grid"]).default("grid"),+ responsive: z.boolean().default(true),+ action: actionPropSchema.optional(),+ gap: z.union([z.number(), z.string()]).optional(),+});++export type SnippetCardItemProps = z.infer<typeof SnippetCardItemSchema>;+export type SnippetCardBlockProps = z.infer<typeof SnippetCardBlockSchema>;+export type SnippetCardItemNode = SnippetCardBlockProps["items"][number];diff --git a/packages/react-ui/src/genui-lib/Tabs/index.tsx b/packages/react-ui/src/genui-lib/Tabs/index.tsxindex ac50f2c02..cb6255906 100644--- a/packages/react-ui/src/genui-lib/Tabs/index.tsx+++ b/packages/react-ui/src/genui-lib/Tabs/index.tsx@@ -1,6 +1,6 @@"use client";-import { defineComponent } from "@openuidev/react-lang";+import { ComponentRenderProps, defineComponent, type SubComponentOf } from "@openuidev/react-lang";import React from "react";import { z } from "zod/v4";import {@@ -20,71 +20,78 @@ export const TabItem = defineComponent({component: () => null,});-export const Tabs = defineComponent({- name: "Tabs",- props: z.object({- items: z.array(TabItem.ref),- }),- description: "Tabbed container",- component: ({ props, renderNode }) => {- const items = (props.items ?? []).filter((item) => item?.props?.value != null);- const [activeTab, setActiveTab] = React.useState("");- const userHasInteracted = React.useRef(false);- const prevContentSizes = React.useRef<Record<string, number>>({});+type TabsRenderProps = ComponentRenderProps<{+ items: SubComponentOf<{ value: string; trigger: string; content: unknown[] }>[];+}>;- React.useEffect(() => {- const first = items[0];- if (items.length && !activeTab && first) {- setActiveTab(first.props.value);- }- }, [items.length, activeTab]);+/** Shared renderer — also used by the chat library's Tabs variant (wider content union). */+export const TabsRenderer = ({ props, renderNode }: TabsRenderProps) => {+ const items = (props.items ?? []).filter((item) => item?.props?.value != null);+ const [activeTab, setActiveTab] = React.useState("");+ const userHasInteracted = React.useRef(false);+ const prevContentSizes = React.useRef<Record<string, number>>({});++ React.useEffect(() => {+ const first = items[0];+ if (items.length && !activeTab && first) {+ setActiveTab(first.props.value);+ }+ }, [items.length, activeTab]);- React.useEffect(() => {- if (userHasInteracted.current) return;+ React.useEffect(() => {+ if (userHasInteracted.current) return;- let candidate: string | null = null;- const nextSizes: Record<string, number> = {};+ let candidate: string | null = null;+ const nextSizes: Record<string, number> = {};- for (const item of items) {- const size = JSON.stringify(item.props.content).length;- const prevSize = prevContentSizes.current[item.props.value] ?? 0;- nextSizes[item.props.value] = size;- if (size > prevSize) {- candidate = item.props.value;- }+ for (const item of items) {+ const size = JSON.stringify(item.props.content).length;+ const prevSize = prevContentSizes.current[item.props.value] ?? 0;+ nextSizes[item.props.value] = size;+ if (size > prevSize) {+ candidate = item.props.value;}+ }- prevContentSizes.current = nextSizes;+ prevContentSizes.current = nextSizes;- if (candidate && candidate !== activeTab) {- setActiveTab(candidate);- }- });+ if (candidate && candidate !== activeTab) {+ setActiveTab(candidate);+ }+ });- const handleValueChange = (value: string) => {- userHasInteracted.current = true;- setActiveTab(value);- };+ const handleValueChange = (value: string) => {+ userHasInteracted.current = true;+ setActiveTab(value);+ };- if (!items.length) return null;+ if (!items.length) return null;- return (- <OpenUITabs value={activeTab} onValueChange={handleValueChange}>- <OpenUITabsList>- {items.map((item) => (- <OpenUITabsTrigger- key={item.props.value}- value={item.props.value}- text={item.props.trigger}- />- ))}- </OpenUITabsList>+ return (+ <OpenUITabs value={activeTab} onValueChange={handleValueChange}>+ <OpenUITabsList>{items.map((item) => (- <OpenUITabsContent key={item.props.value} value={item.props.value}>- {renderNode(item.props.content)}- </OpenUITabsContent>+ <OpenUITabsTrigger+ key={item.props.value}+ value={item.props.value}+ text={item.props.trigger}+ />))}- </OpenUITabs>- );- },+ </OpenUITabsList>+ {items.map((item) => (+ <OpenUITabsContent key={item.props.value} value={item.props.value}>+ {renderNode(item.props.content)}+ </OpenUITabsContent>+ ))}+ </OpenUITabs>+ );+};++export const Tabs = defineComponent({+ name: "Tabs",+ props: z.object({+ items: z.array(TabItem.ref),+ }),+ description: "Tabbed container",+ component: TabsRenderer,});diff --git a/packages/react-ui/src/genui-lib/Tag/index.tsx b/packages/react-ui/src/genui-lib/Tag/index.tsxindex 9d05e9c31..54c73a27a 100644--- a/packages/react-ui/src/genui-lib/Tag/index.tsx+++ b/packages/react-ui/src/genui-lib/Tag/index.tsx@@ -1,6 +1,7 @@"use client";import { defineComponent } from "@openuidev/react-lang";+import { IconWrapper } from "../../components/_shared/icons";import { Tag as OpenUITag } from "../../components/Tag";import { TagSchema } from "./schema";@@ -9,12 +10,20 @@ export * from "./schema";export const Tag = defineComponent({name: "Tag",props: TagSchema,- description: "Styled tag/badge with optional icon and variant",- component: ({ props }) => (- <OpenUITag- text={props.text as string}- size={props.size as "sm" | "md" | "lg" | undefined}- variant={props.variant as "neutral" | "info" | "success" | "warning" | "danger" | undefined}- />- ),+ description: "Styled tag/badge with optional Icon and variant",+ component: ({ props }) => {+ const icon = props["icon"] as { props?: { name?: string; category?: string } } | undefined;+ return (+ <OpenUITag+ text={props.text as string}+ icon={+ icon?.props?.name ? (+ <IconWrapper name={icon.props.name} category={icon.props.category} />+ ) : undefined+ }+ size={props.size as "sm" | "md" | "lg" | undefined}+ variant={props.variant as "neutral" | "info" | "success" | "warning" | "danger" | undefined}+ />+ );+ },});diff --git a/packages/react-ui/src/genui-lib/Tag/schema.ts b/packages/react-ui/src/genui-lib/Tag/schema.tsindex 81c4af2ae..3ec5912c5 100644--- a/packages/react-ui/src/genui-lib/Tag/schema.ts+++ b/packages/react-ui/src/genui-lib/Tag/schema.ts@@ -1,8 +1,9 @@import { z } from "zod/v4";+import { Icon } from "../Icon";export const TagSchema = z.object({text: z.string(),- icon: z.string().optional(),+ icon: z.optional(Icon.ref),size: z.enum(["sm", "md", "lg"]).optional(),variant: z.enum(["neutral", "info", "success", "warning", "danger"]).optional(),});diff --git a/packages/react-ui/src/genui-lib/TagBlock/index.tsx b/packages/react-ui/src/genui-lib/TagBlock/index.tsxindex 57e4ca418..facf016a2 100644--- a/packages/react-ui/src/genui-lib/TagBlock/index.tsx+++ b/packages/react-ui/src/genui-lib/TagBlock/index.tsx@@ -11,13 +11,14 @@ export * from "./schema";export const TagBlock = defineComponent({name: "TagBlock",props: TagBlockSchema,- description: "tags is an array of strings",+ description: "tags is an array of strings; optional size sm | md | lg",component: ({ props }) => {const tags = asArray(props.tags) as string[];+ const size = props.size as "sm" | "md" | "lg" | undefined;return (<OpenUITagBlock>{tags.map((tag, i) => (- <OpenUITag key={i} text={tag} />+ <OpenUITag key={i} text={tag} size={size} />))}</OpenUITagBlock>);diff --git a/packages/react-ui/src/genui-lib/TagBlock/schema.ts b/packages/react-ui/src/genui-lib/TagBlock/schema.tsindex 11dce5d99..7da73fd00 100644--- a/packages/react-ui/src/genui-lib/TagBlock/schema.ts+++ b/packages/react-ui/src/genui-lib/TagBlock/schema.ts@@ -2,4 +2,5 @@ import { z } from "zod/v4";export const TagBlockSchema = z.object({tags: z.array(z.string()),+ size: z.enum(["sm", "md", "lg"]).optional(),});diff --git a/packages/react-ui/src/genui-lib/Text/index.tsx b/packages/react-ui/src/genui-lib/Text/index.tsxnew file mode 100644index 000000000..cabb31d71--- /dev/null+++ b/packages/react-ui/src/genui-lib/Text/index.tsx@@ -0,0 +1,39 @@+"use client";++import { ComponentRenderProps, defineComponent } from "@openuidev/react-lang";+import { TextBlockView } from "../../components/TextBlock";+import { TextSchema, type TextProps } from "./schema";++export * from "./schema";++export function getMetricSubtextTone(+ subtextVariant: "text" | "number" | "metric",+ subtext?: string,+): "positive" | "negative" | undefined {+ if (subtextVariant !== "metric" || !subtext) return undefined;+ if (subtext.startsWith("+")) return "positive";+ if (subtext.startsWith("-")) return "negative";+ return undefined;+}++function TextRenderer({ props }: ComponentRenderProps<TextProps>) {+ return (+ <TextBlockView+ variant={props.subtext ? "text-subtext" : "text"}+ primary={props.value}+ secondary={props.subtext}+ type={props.variant}+ size={props.size}+ align="left"+ secondaryTone={getMetricSubtextTone(props.subtextVariant, props.subtext)}+ />+ );+}++export const Text = defineComponent({+ name: "Text",+ props: TextSchema,+ description:+ "Plain text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.",+ component: TextRenderer,+});diff --git a/packages/react-ui/src/genui-lib/Text/schema.ts b/packages/react-ui/src/genui-lib/Text/schema.tsnew file mode 100644index 000000000..40cfc0e4e--- /dev/null+++ b/packages/react-ui/src/genui-lib/Text/schema.ts@@ -0,0 +1,10 @@+import { z } from "zod/v4";++export const TextSchema = z.object({+ variant: z.enum(["text", "number"]).default("text"),+ value: z.string(),+ subtext: z.string().optional(),+ subtextVariant: z.enum(["text", "number", "metric"]).default("text"),+ size: z.enum(["xs", "sm", "md", "lg"]).default("sm"),+});+export type TextProps = z.infer<typeof TextSchema>;diff --git a/packages/react-ui/src/genui-lib/TextContent/index.tsx b/packages/react-ui/src/genui-lib/TextContent/index.tsxindex cfbf2683e..1c3385dde 100644--- a/packages/react-ui/src/genui-lib/TextContent/index.tsx+++ b/packages/react-ui/src/genui-lib/TextContent/index.tsx@@ -2,7 +2,7 @@import { defineComponent } from "@openuidev/react-lang";import React from "react";-import { MarkDownRenderer } from "../../components/MarkDownRenderer";+import { TextContentWrapper } from "../../components/TextContentWrapper";import { TextContentSchema } from "./schema";const BODY_SIZE_VARS: Record<string, string> = {small: "--openui-text-body-sm",@@ -32,7 +32,7 @@ export const TextContent = defineComponent({const text = props.text == null ? "" : String(props.text);return (<div style={style}>- <MarkDownRenderer textMarkdown={text} />+ <TextContentWrapper textMarkdown={text} /></div>);},diff --git a/packages/react-ui/src/genui-lib/VisualCardBlock/index.tsx b/packages/react-ui/src/genui-lib/VisualCardBlock/index.tsxnew file mode 100644index 000000000..558730927--- /dev/null+++ b/packages/react-ui/src/genui-lib/VisualCardBlock/index.tsx@@ -0,0 +1,84 @@+"use client";++import type { SubComponentOf } from "@openuidev/react-lang";+import {+ ComponentRenderProps,+ defineComponent,+ useFormName,+ useIsStreaming,+ useTriggerAction,+} from "@openuidev/react-lang";+import { VisualCardBlock as OpenUIVisualCardBlock } from "../../components/VisualCardBlock";+import { withItemContext } from "../cardActionUtils";+import { renderCardTag } from "../cardTagUtils";+import {+ VisualCardBlockSchema,+ type VisualCardBlockProps,+ type VisualCardItemProps,+} from "./schema";++export * from "./schema";++type VisualCardItemElement = SubComponentOf<VisualCardItemProps>;++function VisualCardBlockRenderer({+ props,+ renderNode,+}: ComponentRenderProps<VisualCardBlockProps>) {+ const triggerAction = useTriggerAction();+ const formName = useFormName();+ const isStreaming = useIsStreaming();++ const items = (props.items ?? []) as VisualCardItemElement[];+ const isClickable = Boolean(props.action) && !isStreaming;++ const handleItemClick = (index: number) => {+ const item = items[index];+ if (!item || !props.action || isStreaming) return;++ const { id, body, tag, bgImageSrc, bgImageAlt } = item.props;+ const bodyValue = body?.props?.value;+ const tagText = tag?.props?.text;+ triggerAction(+ bodyValue || tagText || id || `Visual card ${index + 1}`,+ formName,+ withItemContext(props.action, {+ itemIndex: index,+ itemId: id,+ itemTag: tagText,+ itemBody: bodyValue,+ itemBodySubtext: body?.props?.subtext,+ itemBgImageSrc: bgImageSrc,+ itemBgImageAlt: bgImageAlt,+ }),+ );+ };++ return (+ <OpenUIVisualCardBlock+ layout={props.layout ?? "grid"}+ responsive={props.responsive !== false}+ gap={props.gap}+ clickable={isClickable}+ onItemClick={handleItemClick}+ items={items.map((item, index) => {+ const { id, body, tag, bgImageSrc, bgImageAlt } = item.props;+ return {+ id,+ tag: renderCardTag(tag, `visual-card-tag-${index}`),+ body: body ? renderNode(body) : null,+ bgImageSrc,+ bgImageAlt,+ };+ })}+ />+ );+}++export const VisualCardBlock = defineComponent({+ name: "VisualCardBlock",+ props: VisualCardBlockSchema,+ description:+ "A grid or carousel of photo-first cards: a full-bleed background image with a tag on top and a bold text panel at the bottom; an optional action makes every card clickable.",+ component: VisualCardBlockRenderer,+});diff --git a/packages/react-ui/src/genui-lib/VisualCardBlock/schema.ts b/packages/react-ui/src/genui-lib/VisualCardBlock/schema.tsnew file mode 100644index 000000000..2cf0a314a--- /dev/null+++ b/packages/react-ui/src/genui-lib/VisualCardBlock/schema.ts@@ -0,0 +1,33 @@+import { defineComponent } from "@openuidev/react-lang";+import { z } from "zod/v4";+import { actionPropSchema } from "../Action/schema";+import { BoldText } from "../BoldText";+import { Tag } from "../Tag";++export const VisualCardItemSchema = z.object({+ body: BoldText.ref,+ id: z.string().optional(),+ bgImageSrc: z.string().optional(),+ tag: z.optional(Tag.ref),+ bgImageAlt: z.string().optional(),+});++export type VisualCardItemProps = z.infer<typeof VisualCardItemSchema>;++export const VisualCardItem = defineComponent({+ name: "VisualCardItem",+ props: VisualCardItemSchema,+ description:+ "A single photo-first card inside a VisualCardBlock: a BoldText body panel, an optional Tag, and a background image (bgImageSrc must be a real URL; bgImageAlt is its alt text).",+ component: () => null,+});++export const VisualCardBlockSchema = z.object({+ items: z.array(VisualCardItem.ref).min(2),+ layout: z.enum(["grid", "carousel"]).default("grid"),+ responsive: z.boolean().default(true),+ action: actionPropSchema.optional(),+ gap: z.union([z.number(), z.string()]).optional(),+});++export type VisualCardBlockProps = z.infer<typeof VisualCardBlockSchema>;diff --git a/packages/react-ui/src/genui-lib/__tests__/cardActionUtils.test.ts b/packages/react-ui/src/genui-lib/__tests__/cardActionUtils.test.tsnew file mode 100644index 000000000..cd1e489ce--- /dev/null+++ b/packages/react-ui/src/genui-lib/__tests__/cardActionUtils.test.ts@@ -0,0 +1,73 @@+import { ACTION_STEPS, BuiltinActionType, type ActionPlan } from "@openuidev/react-lang";+import { describe, expect, it } from "vitest";+import { withItemContext } from "../cardActionUtils";++const itemContext = { itemIndex: 1, itemId: "b", itemTitle: "Beta", itemValue: undefined };++describe("withItemContext", () => {+ it("returns a ContinueConversation action carrying the item context when action is undefined", () => {+ expect(withItemContext(undefined, itemContext)).toEqual({+ type: BuiltinActionType.ContinueConversation,+ params: { itemIndex: 1, itemId: "b", itemTitle: "Beta" },+ });+ });++ it("merges legacy { type, params } with item context winning on clash", () => {+ const result = withItemContext(+ { type: "custom", params: { source: "cards", itemId: "stale" } },+ itemContext,+ );+ expect(result).toEqual({+ type: "custom",+ params: { source: "cards", itemIndex: 1, itemId: "b", itemTitle: "Beta" },+ });+ });++ it("defaults a legacy action without a type to ContinueConversation", () => {+ expect(withItemContext({ params: { a: 1 } }, { itemIndex: 0 })).toEqual({+ type: BuiltinActionType.ContinueConversation,+ params: { a: 1, itemIndex: 0 },+ });+ });++ it("lifts legacy open_url / continue_conversation shapes into params", () => {+ expect(withItemContext({ type: "open_url", url: "https://x.test" }, { itemIndex: 2 })).toEqual({+ type: "open_url",+ params: { url: "https://x.test", itemIndex: 2 },+ });+ expect(+ withItemContext({ type: "continue_conversation", context: "more" }, { itemIndex: 2 }),+ ).toEqual({+ type: "continue_conversation",+ params: { context: "more", itemIndex: 2 },+ });+ });++ it("appends item context to ToAssistant step context in an ActionPlan and leaves other steps untouched", () => {+ const plan = {+ steps: [+ { type: ACTION_STEPS.ToAssistant, message: "Tell me more", context: "cards" },+ { type: ACTION_STEPS.ToAssistant, message: "No context" },+ { type: ACTION_STEPS.Run, statementId: "fetch", refType: "query" },+ { type: ACTION_STEPS.OpenUrl, url: "https://x.test" },+ ],+ } as unknown as ActionPlan;++ const result = withItemContext(plan, itemContext) as ActionPlan;+ const serialized = 'Selected item: {"itemIndex":1,"itemId":"b","itemTitle":"Beta"}';++ expect(result).not.toBe(plan);+ expect(result.steps).toEqual([+ { type: ACTION_STEPS.ToAssistant, message: "Tell me more", context: `cards\n${serialized}` },+ { type: ACTION_STEPS.ToAssistant, message: "No context", context: serialized },+ { type: ACTION_STEPS.Run, statementId: "fetch", refType: "query" },+ { type: ACTION_STEPS.OpenUrl, url: "https://x.test" },+ ]);+ expect((plan.steps[0] as { context?: string }).context).toBe("cards");+ });++ it("returns the same ActionPlan when there is no item context", () => {+ const plan = { steps: [{ type: ACTION_STEPS.OpenUrl, url: "https://x.test" }] } as ActionPlan;+ expect(withItemContext(plan, { itemId: undefined })).toBe(plan);+ });+});diff --git a/packages/react-ui/src/genui-lib/cardActionUtils.ts b/packages/react-ui/src/genui-lib/cardActionUtils.tsnew file mode 100644index 000000000..da2ab342f--- /dev/null+++ b/packages/react-ui/src/genui-lib/cardActionUtils.ts@@ -0,0 +1,75 @@+import type { ActionPlan } from "@openuidev/react-lang";+import { ACTION_STEPS, BuiltinActionType } from "@openuidev/react-lang";++export type LegacyCardAction = { type: string; params: Record<string, unknown> };++/** Legacy action objects: `{ type?, params? }`, `{ type: "open_url", url }`, `{ type: "continue_conversation", context }`. */+type LegacyActionInput = {+ type?: string;+ params?: Record<string, unknown>;+ url?: string;+ context?: string;+};++/** Serialize item context for the ToAssistant `context` string (the only ActionPlan channel the executor forwards). */+function formatItemContext(context: Record<string, unknown>): string {+ return `Selected item: ${JSON.stringify(context)}`;+}++function isActionPlan(action: unknown): action is ActionPlan {+ return (+ typeof action === "object" &&+ action !== null &&+ Array.isArray((action as { steps?: unknown }).steps)+ );+}++function dropUndefined(context: Record<string, unknown>): Record<string, unknown> {+ return Object.fromEntries(Object.entries(context).filter(([, value]) => value !== undefined));+}++/**+ * Merge per-item click context (itemIndex, itemId, itemTitle, ...) into a card+ * block's `action` prop. Item context wins on+ * key clash.+ *+ * - Legacy `{ type?, params? }` (and the bare `{ url }` / `{ context }` shapes):+ * returns `{ type, params }` with url/context/params and item context merged.+ * - `ActionPlan` (`{ steps }`): returns a copy whose ToAssistant steps get the+ * item context appended to their `context` string (react-lang forwards only+ * `step.context` to the host for that step type); other steps untouched.+ * - `undefined`: returns a ContinueConversation action carrying the item context.+ */+export function withItemContext(+ action: unknown,+ itemContext: Record<string, unknown>,+): ActionPlan | LegacyCardAction {+ const context = dropUndefined(itemContext);++ if (action === undefined || action === null) {+ return { type: BuiltinActionType.ContinueConversation, params: context };+ }++ if (isActionPlan(action)) {+ if (Object.keys(context).length === 0) return action;+ const suffix = formatItemContext(context);+ return {+ ...action,+ steps: action.steps.map((step) => {+ if (step.type !== ACTION_STEPS.ToAssistant) return step;+ return { ...step, context: step.context ? `${step.context}\n${suffix}` : suffix };+ }),+ };+ }++ const legacy = action as LegacyActionInput;+ return {+ type: legacy.type ?? BuiltinActionType.ContinueConversation,+ params: {+ ...(legacy.params ?? {}),+ ...(legacy.url !== undefined ? { url: legacy.url } : {}),+ ...(legacy.context ? { context: legacy.context } : {}),+ ...context,+ },+ };+}diff --git a/packages/react-ui/src/genui-lib/cardTagUtils.tsx b/packages/react-ui/src/genui-lib/cardTagUtils.tsxnew file mode 100644index 000000000..26a115452--- /dev/null+++ b/packages/react-ui/src/genui-lib/cardTagUtils.tsx@@ -0,0 +1,27 @@+import type { SubComponentOf } from "@openuidev/react-lang";+import { z } from "zod/v4";+import { Tag as OpenUITag } from "../components/Tag";+import { IconWrapper } from "../components/_shared/icons";+import type { TagSchema } from "./Tag";++type TagProps = z.infer<typeof TagSchema>;++/** Renders a `Tag` element ref (as used inside card blocks) at the small size. */+export function renderCardTag(tag: SubComponentOf<TagProps> | undefined, key?: string) {+ if (!tag) return null;+ const { text, variant, icon } = tag.props;++ return (+ <OpenUITag+ key={key}+ text={text}+ variant={variant ?? "neutral"}+ size="sm"+ icon={+ icon?.props?.name ? (+ <IconWrapper name={icon.props.name} category={icon.props.category} />+ ) : undefined+ }+ />+ );+}diff --git a/packages/react-ui/src/genui-lib/formDefaultValueUtils.ts b/packages/react-ui/src/genui-lib/formDefaultValueUtils.tsnew file mode 100644index 000000000..6e30e685a--- /dev/null+++ b/packages/react-ui/src/genui-lib/formDefaultValueUtils.ts@@ -0,0 +1,55 @@+"use client";++import { useIsStreaming, useSetFieldValue } from "@openuidev/react-lang";+import React from "react";++type DefaultFieldConfig = {+ componentType: string;+ name: string;+ existingValue: unknown;+ defaultValue: unknown;+};++export function useHydrateDefaultFieldValue({+ formName,+ componentType,+ name,+ existingValue,+ defaultValue,+}: {+ formName?: string;+ componentType: string;+ name: string;+ existingValue: unknown;+ defaultValue: unknown;+}) {+ const fields = React.useMemo(+ () => [{ componentType, name, existingValue, defaultValue }],+ [componentType, name, existingValue, defaultValue],+ );++ useHydrateDefaultFieldValues({ formName, fields });+}++export function useHydrateDefaultFieldValues({+ formName,+ fields,+}: {+ formName?: string;+ fields: DefaultFieldConfig[];+}) {+ const setFieldValue = useSetFieldValue();+ const isStreaming = useIsStreaming();++ React.useEffect(() => {+ if (isStreaming) {+ return;+ }++ fields.forEach(({ componentType, name, existingValue, defaultValue }) => {+ if (existingValue === undefined && defaultValue !== undefined) {+ setFieldValue(formName, componentType, name, defaultValue, false);+ }+ });+ }, [fields, formName, isStreaming, setFieldValue]);+}diff --git a/packages/react-ui/src/genui-lib/openuiChatLibrary.tsx b/packages/react-ui/src/genui-lib/openuiChatLibrary.tsxindex af83877d0..70fb01311 100644--- a/packages/react-ui/src/genui-lib/openuiChatLibrary.tsx+++ b/packages/react-ui/src/genui-lib/openuiChatLibrary.tsx@@ -4,6 +4,7 @@ import type { ComponentGroup } from "@openuidev/react-lang";import { createLibrary, defineComponent } from "@openuidev/react-lang";import { z } from "zod/v4";import { Card as OpenUICard } from "../components/Card";+import { CardSourceProvider, CardSourceSchema, Sources } from "../components/Sources";// Contentimport { Callout } from "./Callout";@@ -37,8 +38,8 @@ import {// Formsimport { CheckBoxGroup, CheckBoxItem } from "./CheckBoxGroup";import { DatePicker } from "./DatePicker";-import { Form } from "./Form";-import { FormControl } from "./FormControl";+import { Form, FormRenderer } from "./Form";+import { FormControlRenderer } from "./FormControl";import { Input } from "./Input";import { Label } from "./Label";import { RadioGroup, RadioItem } from "./RadioGroup";@@ -52,10 +53,10 @@ import { Button } from "./Button";import { Buttons } from "./Buttons";// Layout (no Stack)-import { Accordion, AccordionItem } from "./Accordion";-import { Carousel } from "./Carousel";+import { AccordionRenderer } from "./Accordion";+import { CarouselRenderer } from "./Carousel";import { Steps, StepsItem } from "./Steps";-import { TabItem, Tabs } from "./Tabs";+import { TabsRenderer } from "./Tabs";// Data Displayimport { Col, Table } from "./Table";@@ -67,14 +68,165 @@ import { FollowUpBlock } from "./FollowUpBlock";import { FollowUpItem } from "./FollowUpItem";import { ListBlock } from "./ListBlock";import { ListItem } from "./ListItem";-import { SectionBlock } from "./SectionBlock";-import { SectionItem } from "./SectionItem";+import { SectionBlock, SectionBlockRenderer } from "./SectionBlock";++// Content & inline composites+import { BoldText } from "./BoldText";+import { EntityList } from "./EntityList";+import { Icon } from "./Icon";+import { IconButton } from "./IconButton";+import { IconText } from "./IconText";+import { ImageText } from "./ImageText";+import { ImageTextLarge } from "./ImageTextLarge";+import { InlineHeader } from "./InlineHeader";+import { MetricIndicatorInline, MetricIndicatorWithStrikethrough } from "./MetricIndicator";+import { Text } from "./Text";++// Editable table+import { EditableTable } from "./EditableTable";++// Selection inputs+import { ChipItem, Chips } from "./Chips";+import { OptionCard, OptionCards } from "./OptionCards";++// Card blocks+import { CompositeCardBlock, CompositeCardItem } from "./CompositeCardBlock";+import { ContextCardBlock, ContextCardItem } from "./ContextCardBlock";+import { OverviewCardBlock, OverviewCardItem } from "./OverviewCardBlock";+import { SnippetCardBlock, SnippetCardItem } from "./SnippetCardBlock";+import { VisualCardBlock, VisualCardItem } from "./VisualCardBlock";import { ChatContentChildUnion } from "./unions";-// Tabs and Carousel are added here (not in unions.ts) to avoid the circular dep:-// Tabs/schema.ts imports ContentChildUnion from unions.ts.-const ChatCardChildUnion = z.union([...ChatContentChildUnion.options, Tabs.ref, Carousel.ref]);+// ── Chat FormControl — same renderer as the base FormControl, wider input union ──+// (Chips / OptionCards are chat-only inputs, so the base FormControlSchema is left untouched.)++const ChatFormControl = defineComponent({+ name: "FormControl",+ props: z.object({+ label: z.string(),+ input: z.union([+ Input.ref,+ TextArea.ref,+ Select.ref,+ DatePicker.ref,+ Slider.ref,+ CheckBoxGroup.ref,+ RadioGroup.ref,+ Chips.ref,+ OptionCards.ref,+ ]),+ hint: z.string().optional(),+ }),+ description: "Field with label, input component, and optional hint text",+ component: FormControlRenderer,+});++// ── Chat Form — same renderer, but its fields reference the chat FormControl above ──++const ChatForm = defineComponent({+ name: "Form",+ props: z.object({+ name: z.string(),+ buttons: Buttons.ref,+ fields: z.array(ChatFormControl.ref).default([]),+ }),+ description: "Form container with fields and explicit action buttons",+ component: FormRenderer,+});++// ── Chat containers — same renderers as the base Tabs / Accordion / Carousel / SectionItem,+// but their content unions accept every chat block (card blocks, EntityList, EditableTable,+// InlineHeader, ...). Defined here, not in unions.ts, to avoid circular imports; registered+// under the base names so SectionBlock's `SectionItem.ref` resolves to the chat variant.++// Everything a nested container may hold — no SectionBlock nesting.+// Base `Form.ref` is swapped for the chat Form so the JSON schema emits a $ref to the+// registered component instead of inlining the base Form's shape.+const ChatNestedContentUnion = z.union(+ ChatContentChildUnion.options+ .filter((o) => o !== SectionBlock.ref)+ .map((o) => (o === Form.ref ? ChatForm.ref : o)) as [+ z.ZodTypeAny,+ z.ZodTypeAny,+ ...z.ZodTypeAny[],+ ],+);++const ChatAccordionItem = defineComponent({+ name: "AccordionItem",+ props: z.object({+ value: z.string(),+ trigger: z.string(),+ content: z.array(ChatNestedContentUnion),+ }),+ description: "value is unique id, trigger is section title",+ component: () => null,+});++const ChatAccordion = defineComponent({+ name: "Accordion",+ props: z.object({ items: z.array(ChatAccordionItem.ref) }),+ description: "Collapsible sections",+ component: AccordionRenderer,+});++const ChatTabItem = defineComponent({+ name: "TabItem",+ props: z.object({+ value: z.string(),+ trigger: z.string(),+ content: z.array(z.union([...ChatNestedContentUnion.options, ChatAccordion.ref])),+ }),+ description: "value is unique id, trigger is tab label, content is array of components",+ component: () => null,+});++const ChatTabs = defineComponent({+ name: "Tabs",+ props: z.object({ items: z.array(ChatTabItem.ref) }),+ description: "Tabbed container",+ component: TabsRenderer,+});++const ChatCarousel = defineComponent({+ name: "Carousel",+ props: z.object({+ children: z.array(z.array(ChatNestedContentUnion)),+ variant: z.enum(["card", "sunk"]).optional(),+ }),+ description: "Horizontal scrollable carousel",+ component: CarouselRenderer,+});++const ChatSectionItem = defineComponent({+ name: "SectionItem",+ props: z.object({+ value: z.string(),+ trigger: z.string(),+ content: z.array(z.union([...ChatNestedContentUnion.options, ChatTabs.ref, ChatAccordion.ref])),+ }),+ description: "Section with a label and collapsible content — used inside SectionBlock",+ component: () => null,+});++const ChatSectionBlock = defineComponent({+ name: "SectionBlock",+ props: z.object({+ sections: z.array(ChatSectionItem.ref),+ isFoldable: z.boolean().optional(),+ }),+ description:+ "Collapsible accordion sections. Auto-opens sections as they stream in. Use SectionItem for each section.",+ component: SectionBlockRenderer,+});++const ChatCardChildUnion = z.union([+ ...ChatNestedContentUnion.options,+ ChatSectionBlock.ref,+ ChatTabs.ref,+ ChatCarousel.ref,+]);// ── Locked Chat Card — no design params, always vertical ──@@ -82,20 +234,24 @@ const ChatCard = defineComponent({name: "Card",props: z.object({children: z.array(ChatCardChildUnion),+ sources: z.array(CardSourceSchema).optional(),}),description:- "Vertical container for all content in a chat response. Children stack top to bottom automatically.",+ "Vertical container for all content in a chat response. Children stack top to bottom automatically. Optional sources ([{ title, sourceName, url }]) render as a Sources strip at the bottom and back inline [n] citations in TextContent.",component: ({ props, renderNode }) => (- <OpenUICard- width="full"- style={{- display: "flex",- flexDirection: "column",- gap: "var(--openui-space-m)",- }}- >- {renderNode(props.children)}- </OpenUICard>+ <CardSourceProvider sources={props.sources}>+ <OpenUICard+ width="full"+ style={{+ display: "flex",+ flexDirection: "column",+ gap: "var(--openui-space-m)",+ }}+ >+ {renderNode(props.children)}+ <Sources />+ </OpenUICard>+ </CardSourceProvider>),});@@ -115,11 +271,20 @@ export const openuiChatComponentGroups: ComponentGroup[] = ["ImageGallery","CodeBlock","Separator",+ "InlineHeader",+ ],+ notes: [+ "- InlineHeader is a compact heading + description pair for labelling a block inside the response (lighter than CardHeader).",+ "- Pass sources on Card ([{ title, sourceName, url }]) when the answer relies on references, and cite them inline in TextContent as [1], [2] (1-based index into sources). A Sources strip renders at the bottom of the card.",],},{name: "Tables",- components: ["Table", "Col"],+ components: ["Table", "Col", "EditableTable"],+ notes: [+ "- EditableTable lets the user edit cells inline. Give it a unique name, columns of { type, key, header } with type one of text | number | date-single | select | url (select also needs options: [{ value, label }]).",+ "- data is an array of { id, values } rows where values are ordered positionally to match columns. Edited data is submitted when the user clicks Save Changes.",+ ],},{name: "Charts (2D)",@@ -158,27 +323,37 @@ export const openuiChatComponentGroups: ComponentGroup[] = ["RadioItem","SwitchGroup","SwitchItem",+ "Chips",+ "ChipItem",+ "OptionCards",+ "OptionCard",],notes: [+ "- Chips: compact single/multiple selection pills. Use ChipItem references for each option.",+ "- OptionCards: larger selectable cards with title, subtitle and an optional Icon or Image on top. Use OptionCard references for each option.","- Define EACH FormControl as its own reference — do NOT inline all controls in one array.","- NEVER nest Form inside Form.",- "- Form requires explicit buttons. Always pass a Buttons(...) reference as the third Form argument.",+ "- Form requires explicit buttons. Always pass a Buttons(...) reference as the second Form argument: Form(name, buttons, fields).","- rules is an optional object: { required: true, email: true, min: 8, maxLength: 100 }","- The renderer shows error messages automatically — do NOT generate error text in the UI",],},{name: "Buttons",- components: ["Button", "Buttons"],+ components: ["Button", "Buttons", "Icon", "IconButton"],+ notes: [+ "- Icon renders a lucide icon by kebab-case name; it is also used as the icon of IconButton, IconText and OptionCard.",+ ],},{name: "Lists & Follow-ups",components: ["ListBlock", "ListItem", "FollowUpBlock", "FollowUpItem"],notes: [- "- Use ListBlock with ListItem references for numbered, clickable lists.",+ "- Use ListBlock with ListItem references for numbered lists.","- Use FollowUpBlock with FollowUpItem references at the end of a response to suggest next actions.",- "- Clicking a ListItem or FollowUpItem sends its text to the LLM as a user message.",- '- Example: list = ListBlock([item1, item2]) item1 = ListItem("Option A", "Details about A")',+ "- A ListItem is clickable ONLY when given an action (5th argument); without one it is plain text.",+ "- Clicking a FollowUpItem, or a ListItem with a continue_conversation action, sends text to the LLM as a user message.",+ '- Example: list = ListBlock([item1, item2]) item1 = ListItem("Option A", "Details about A", null, null, { type: "continue_conversation", context: "Option A" })',],},{@@ -204,7 +379,41 @@ export const openuiChatComponentGroups: ComponentGroup[] = [},{name: "Data Display",- components: ["TagBlock", "Tag"],+ components: ["TagBlock", "Tag", "EntityList"],+ notes: [+ "- EntityList is a compact two-column list of { left, right } rows (e.g. name / value). size='default' also supports a header and footer row; size='small' does not.",+ ],+ },+ {+ name: "Cards",+ components: [+ "SnippetCardBlock",+ "SnippetCardItem",+ "OverviewCardBlock",+ "OverviewCardItem",+ "ContextCardBlock",+ "ContextCardItem",+ "CompositeCardBlock",+ "CompositeCardItem",+ "VisualCardBlock",+ "VisualCardItem",+ "Text",+ "BoldText",+ "IconText",+ "ImageText",+ "ImageTextLarge",+ "MetricIndicatorInline",+ "MetricIndicatorWithStrikethrough",+ ],+ notes: [+ "- Card blocks lay out 2+ items in a responsive grid (or carousel where supported). Every item in a block must have the same structure.",+ "- SnippetCardItem: small card with lhs (IconText | ImageText) and optional rhs (Text | BoldText) — good for key/value facts.",+ "- OverviewCardItem: small card with top (IconText | ImageText | Text) and optional bottom MetricIndicatorInline — good for KPIs.",+ "- ContextCardItem: medium card with a title (string or Tag), body text and optional background image — good for summaries.",+ "- CompositeCardItem: rich card with header, body array (Text, BoldText, MetricIndicatorInline, IconText, Image, charts, ListBlock, TagBlock, EntityList) and footer (price + Button) — good for products/offers.",+ "- VisualCardItem: image-first card with a BoldText body and optional Tag.",+ "- Text / BoldText / IconText / ImageText / ImageTextLarge / MetricIndicator* are the inline building blocks used INSIDE card items; do not place them directly in the root Card.",+ ],},];@@ -254,8 +463,8 @@ export const openuiChatLibrary = createLibrary({ScatterSeries,Point,// Forms- Form,- FormControl,+ ChatForm,+ ChatFormControl,Label,Input,TextArea,@@ -278,18 +487,49 @@ export const openuiChatLibrary = createLibrary({FollowUpBlock,FollowUpItem,// Sections- SectionBlock,- SectionItem,+ ChatSectionBlock,+ ChatSectionItem,// Layout (no Stack)- Tabs,- TabItem,- Accordion,- AccordionItem,+ ChatTabs,+ ChatTabItem,+ ChatAccordion,+ ChatAccordionItem,Steps,StepsItem,- Carousel,+ ChatCarousel,// Data DisplayTagBlock,Tag,+ EntityList,+ // Content (chat-only)+ InlineHeader,+ Icon,+ IconButton,+ // Tables (editable)+ EditableTable,+ // Selection inputs+ ChipItem,+ Chips,+ OptionCard,+ OptionCards,+ // Card building blocks+ Text,+ BoldText,+ IconText,+ ImageText,+ ImageTextLarge,+ MetricIndicatorInline,+ MetricIndicatorWithStrikethrough,+ // Card blocks+ SnippetCardItem,+ SnippetCardBlock,+ OverviewCardItem,+ OverviewCardBlock,+ ContextCardItem,+ ContextCardBlock,+ CompositeCardItem,+ CompositeCardBlock,+ VisualCardItem,+ VisualCardBlock,],});diff --git a/packages/react-ui/src/genui-lib/openuiLibrary.tsx b/packages/react-ui/src/genui-lib/openuiLibrary.tsxindex 0277f8878..79b4c9b2f 100644--- a/packages/react-ui/src/genui-lib/openuiLibrary.tsx+++ b/packages/react-ui/src/genui-lib/openuiLibrary.tsx@@ -58,6 +58,7 @@ import { Steps, StepsItem } from "./Steps";import { TabItem, Tabs } from "./Tabs";// Data Display+import { Icon } from "./Icon";import { Col, Table } from "./Table";import { Tag } from "./Tag";import { TagBlock } from "./TagBlock";@@ -194,7 +195,7 @@ export const openuiComponentGroups: ComponentGroup[] = [},{name: "Data Display",- components: ["TagBlock", "Tag"],+ components: ["TagBlock", "Tag", "Icon"],notes: ['- Color-mapped Tag: Tag(value, null, "sm", value == "high" ? "danger" : value == "medium" ? "warning" : "neutral")',],@@ -273,6 +274,7 @@ export const openuiLibrary = createLibrary({// Data DisplayTagBlock,Tag,+ Icon,// ModalModal,],diff --git a/packages/react-ui/src/genui-lib/prompt-options/index.ts b/packages/react-ui/src/genui-lib/prompt-options/index.tsindex e7241ecb4..d9185bce7 100644--- a/packages/react-ui/src/genui-lib/prompt-options/index.ts+++ b/packages/react-ui/src/genui-lib/prompt-options/index.ts@@ -66,7 +66,234 @@ export const openuiPromptOptions: PromptOptions = {// OpenUI Chat Libraryexport const openuiChatExamples: string[] = [- `Example 1 — Table with follow-ups:+ `Example 1 — Informational response (the shape for "tell me about X" / explainer asks):++root = Card([header, intro, highlights, statsHeader, statsCards, sectionsBlock, actionBtns], [src1, src2])+header = CardHeader("Paris", "The City of Light · France's Eternal Capital")+intro = TextContent("Paris is one of the world's most visited cities — a timeless blend of iconic landmarks, world-class cuisine, art, and romance [1]. In 2026 the city is buzzing with new energy: the **Grand Palais** has reopened after a €466M renovation, and you can now **swim in the Seine** for the first time in over a century [2].")+highlights = ContextCardBlock([h1, h2, h3], "grid", true, { type: "continue_conversation", context: "Tell me more about this aspect of Paris" })+h1 = ContextCardItem("art-museums", "Art & Museums", "143 museums including the Louvre & newly reopened Grand Palais.", "gray", "https://cdn.britannica.com/03/121003-050-2544BD4E/Interior-Louvre-Museum-Paris.jpg")+h2 = ContextCardItem("gastronomy", "Gastronomy", "9,000+ restaurants, 130+ Michelin stars, and the world's best baguettes.", "gray")+h3 = ContextCardItem("fashion-capital", "Fashion Capital", "Home to Chanel, Dior, Louis Vuitton & Hermès — the global luxury hub.", "gray", "https://thumbs.dreamstime.com/z/dior-storefront-facade-chanel-store-lvmh-s-french-designer-modehouse-christian-adjacent-to-luxury-fashion-beauty-brand-327161553.jpg")+statsHeader = InlineHeader("Paris by the Numbers", "Key visitor statistics")+statsCards = OverviewCardBlock([ov1, ov2, ov3], "grid", true)+ov1 = OverviewCardItem("annual-visitors", ov1top, ov1metric)+ov1top = IconText(ov1icon, "neutral", "m", "Annual Visitors", "2024 arrivals", false, "vertical")+ov1icon = Icon("users", "people")+ov1metric = MetricIndicatorInline("48.7M", "tourists", { direction: "up", value: 2.5 })+ov2 = OverviewCardItem("museums-monuments", ov2top, ov2metric)+ov2top = IconText(ov2icon, "neutral", "m", "Museums & Monuments", "Cultural sites", false, "vertical")+ov2icon = Icon("landmark", "buildings")+ov2metric = MetricIndicatorInline("2,370+", "across the city")+ov3 = OverviewCardItem("tourism-revenue", ov3top, ov3metric)+ov3top = IconText(ov3icon, "neutral", "m", "Tourism Revenue", "2024 estimate", false, "vertical")+ov3icon = Icon("circle-dollar-sign", "finance")+ov3metric = MetricIndicatorInline("€23.4B", "generated")+sectionsBlock = SectionBlock([secLandmarks, secFood, secWhen], false)+secLandmarks = SectionItem("landmarks", "Iconic Landmarks", [landmarksCarousel])+landmarksCarousel = VisualCardBlock([lm1, lm2, lm3, lm4], "carousel", true, { type: "continue_conversation", context: "Tell me more about this Paris landmark" })+lm1 = VisualCardItem(lm1body, "eiffel-tower", "https://c8.alamy.com/comp/RYEB13/aerial-view-of-the-eiffel-tower-with-the-park-champ-de-mars-and-the-river-seine-paris-france-RYEB13.jpg", lm1tag, "Aerial view of the Eiffel Tower")+lm1body = BoldText("text", "Eiffel Tower", "Open daily 9am–midnight")+lm1tag = Tag("Must-See", lm1tagIcon, "sm", "info")+lm1tagIcon = Icon("star", "shapes")+lm2 = VisualCardItem(lm2body, "the-louvre", "https://images.fineartamerica.com/images/artworkimages/mediumlarge/3/1-exterior-of-musee-du-louvre-museum-paris-france-bernard-jaubert.jpg", lm2tag, "Exterior of the Louvre museum")+lm2body = BoldText("text", "The Louvre", "World's largest art museum")+lm2tag = Tag("8.9M visits/yr", lm2tagIcon, "sm", "success")+lm2tagIcon = Icon("trending-up", "charts")+lm3 = VisualCardItem(lm3body, "notre-dame", "https://cdn.britannica.com/29/255529-050-63A22A3C/notre-dame-de-paris-cathedral-paris-france.jpg", lm3tag, "Notre-Dame cathedral facade")+lm3body = BoldText("text", "Notre-Dame", "Fully restored cathedral")+lm3tag = Tag("Reopened 2024", lm3tagIcon, "sm", "warning")+lm3tagIcon = Icon("hammer", "tools")+lm4 = VisualCardItem(lm4body, "versailles", "https://cdn.britannica.com/76/130076-050-31128A3D/Latona-Fountain-Balthazard-Marsy-Gaspard-Andre-Le.jpg", lm4tag, "Latona Fountain at Versailles")+lm4body = BoldText("text", "Palace of Versailles", "Royal gardens & grand halls")+lm4tag = Tag("Day Trip", lm4tagIcon, "sm", "neutral")+lm4tagIcon = Icon("train-front", "travel")+secFood = SectionItem("food", "Food & Drink", [foodCards])+foodCards = ContextCardBlock([f1, f2, f3], "grid", true, { type: "continue_conversation", context: "Tell me more about eating and drinking in Paris" })+f1 = ContextCardItem("bistros", "Bistros", "Classic French fare — try Les Arlots for confit beef cheeks.", "gray", "https://everydayparisian.com/wp-content/uploads/2023/01/IMG_0221-768x1024.webp")+f2 = ContextCardItem("fine-dining", "Fine Dining", "Septime leads a new wave of creative Michelin-starred cuisine.", "gray", "https://production-data.worldofmouth.app/images/72b2e6db-97ea-49c4-aa5d-3b7c8121c812.jpg")+f3 = ContextCardItem("bakeries", "Bakeries", "Shinya Pain for sourdough. Grand Prix-winning baguettes citywide.", "gray", "https://www.davidlebovitz.com/wp-content/uploads/2018/09/Le-petit-grain-paris-bakery-boulangerie-patisserie-pastry-shop-8-640x895.jpg")+secWhen = SectionItem("when", "Best Time to Visit", [whenTabs])+whenTabs = Tabs([tabSpring, tabSummer])+tabSpring = TabItem("spring", "Spring", [springList])+springList = ListBlock([sp1, sp2, sp3], "number")+sp1 = ListItem("Cherry blossoms at Parc de Sceaux", "March – May", null, null, { type: "continue_conversation", context: "Tell me about cherry blossom season in Paris" })+sp2 = ListItem("Picnics along the Seine & in city parks", "Warm, lively atmosphere", null, null, { type: "continue_conversation", context: "Where are the best picnic spots in Paris?" })+sp3 = ListItem("Fewer crowds than summer", "Ideal for sightseeing", null, null, { type: "continue_conversation", context: "How busy is Paris in spring?" })+tabSummer = TabItem("summer", "Summer", [summerList])+summerList = ListBlock([su1, su2, su3], "number")+su1 = ListItem("Swim in the Seine — open July & August 2026", "First time in 102 years", null, null, { type: "continue_conversation", context: "Tell me about swimming in the Seine" })+su2 = ListItem("Open-air cinema at Parc de la Villette", "Free films under the stars", null, null, { type: "continue_conversation", context: "Tell me about the open-air cinema at Parc de la Villette" })+su3 = ListItem("Bastille Day celebrations on July 14", "Fireworks at the Eiffel Tower", null, null, { type: "continue_conversation", context: "What happens in Paris on Bastille Day?" })+actionBtns = Buttons([btn1, btn2, btn3], "row")+btn1 = Button("Plan a Trip to Paris", { type: "continue_conversation", context: "Help me plan a trip to Paris" }, "primary")+btn2 = Button("Best Hotels in Paris", { type: "continue_conversation", context: "Show me the best hotels in Paris" }, "secondary")+btn3 = Button("Build a Paris Itinerary", { type: "continue_conversation", context: "Build a 5-day Paris itinerary for me" }, "secondary")+src1 = { title: "Paris Travel Guide 2025", sourceName: "Travel and Tour World", url: "https://www.travelandtourworld.com/news/article/from-iconic-landmarks-to-hidden-gems-the-ultimate-paris-travel-guide-for-2025-you-need-to-read-now/" }+src2 = { title: "Best Things to Do in Paris 2026", sourceName: "Time Out Paris", url: "http://www.timeout.fr/paris/en/for-tourists" }`,++ `Example 2 — Data and analytics response (quantitative asks lead with KPIs and charts):++root = Card([pageHeader, kpiBlock, sections, deepDiveHeader, compositeCards, actionButtons])+pageHeader = CardHeader("Analytics Dashboard", "April 2026 · Business Performance Overview")+kpiBlock = SnippetCardBlock([kpi1, kpi2, kpi3, kpi4], "grid", true)+kpi1 = SnippetCardItem("total-revenue", kpi1lhs, kpi1rhs)+kpi1lhs = IconText(kpi1icon, "neutral", "m", "Total Revenue", "Month to date", false, "horizontal")+kpi1icon = Icon("circle-dollar-sign", "finance")+kpi1rhs = BoldText("number", "$284,500", "+12.4%", "metric")+kpi2 = SnippetCardItem("active-users", kpi2lhs, kpi2rhs)+kpi2lhs = IconText(kpi2icon, "neutral", "m", "Active Users", "Monthly active users", false, "horizontal")+kpi2icon = Icon("users", "people")+kpi2rhs = BoldText("number", "47,320", "+6.8%", "metric")+kpi3 = SnippetCardItem("conversion-rate", kpi3lhs, kpi3rhs)+kpi3lhs = IconText(kpi3icon, "neutral", "m", "Conversion Rate", "Avg. this month", false, "horizontal")+kpi3icon = Icon("trending-up", "charts")+kpi3rhs = BoldText("number", "5.7%", "+0.9%", "metric")+kpi4 = SnippetCardItem("churn-rate", kpi4lhs, kpi4rhs)+kpi4lhs = IconText(kpi4icon, "neutral", "m", "Churn Rate", "Monthly customer churn", false, "horizontal")+kpi4icon = Icon("user-minus", "people")+kpi4rhs = BoldText("number", "2.1%", "-0.4%", "metric")+sections = SectionBlock([secUsers, secChannels], false)+secUsers = SectionItem("users", "User Activity", [userTabs])+userTabs = Tabs([tabGrowth, tabRetention])+tabGrowth = TabItem("growth", "User Growth", [growthChart])+growthChart = LineChart(months, [dauSeries, mauSeries], "natural", "Month", "Users (k)")+months = ["May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb", "Mar", "Apr"]+dauSeries = Series("DAU", [5.1, 5.4, 5.8, 6.2, 6.7, 7.1, 7.6, 8.0, 8.4, 8.9, 9.3, 9.8])+mauSeries = Series("MAU", [28.4, 30.1, 31.8, 33.5, 35.2, 37.1, 38.8, 40.4, 42.1, 43.9, 45.6, 47.3])+tabRetention = TabItem("retention", "Cohort Retention", [retentionChart])+retentionChart = LineChart(cohortMonths, [cohortJan, cohortFeb, cohortMar], "natural", "Month Since Signup", "Retention (%)")+cohortMonths = ["Month 0", "Month 1", "Month 2", "Month 3", "Month 4", "Month 5", "Month 6"]+cohortJan = Series("Jan Cohort", [100, 80, 70, 62, 56, 51, 47])+cohortFeb = Series("Feb Cohort", [100, 83, 73, 65, 59, 54, 50])+cohortMar = Series("Mar Cohort", [100, 86, 76, 68, 62, 0, 0])+secChannels = SectionItem("channels", "Acquisition Channels", [channelTabs])+channelTabs = Tabs([tabChannelBar, tabChannelTable])+tabChannelBar = TabItem("channel-bar", "Revenue by Channel", [channelBarChart])+channelBarChart = HorizontalBarChart(channels, [channelSeries], "grouped", "Revenue ($k)", "Channel")+channels = ["Organic Search", "Paid Ads", "Referral Program", "Partner Network", "Direct / Brand", "Email Campaigns"]+channelSeries = Series("Revenue ($k)", [82.4, 68.1, 54.6, 38.2, 26.8, 14.4])+tabChannelTable = TabItem("channel-table", "Full Breakdown", [channelTable])+channelTable = Table([colChannel, colLeads, colConv, colCac, colRevenue, colStatus])+colChannel = Col("Channel", channels, "string")+colLeads = Col("Leads", [4210, 3180, 2050, 1120, 1290, 820], "number")+colConv = Col("Conv. Rate", ["6.4%", "5.1%", "9.4%", "11.8%", "5.8%", "8.1%"], "string")+colCac = Col("CAC ($)", [188, 395, 132, 109, 218, 154], "number")+colRevenue = Col("Revenue ($k)", [82.4, 68.1, 54.6, 38.2, 26.8, 14.4], "number")+colStatus = Col("Status", ["Scaling", "Optimizing", "Scaling", "Growing", "Stable", "Stable"], "string")+deepDiveHeader = InlineHeader("Support Health & Marketing ROI", "Click a card to explore deeper insights")+compositeCards = CompositeCardBlock([cardSupport, cardMarketing], "grid", true, { type: "continue_conversation", context: "Explore this deep-dive area in more detail" })+cardSupport = CompositeCardItem("support-health", supportHeader, [supportMetric, supportChart, supportList])+supportHeader = IconText(supportIcon, "neutral", "m", "Support Health", "Ticket volume & resolution trends", false, "horizontal")+supportIcon = Icon("headphones", "communication")+supportMetric = MetricIndicatorInline("94.2% CSAT", "Customer Satisfaction Score", { direction: "up", value: 2.1 })+supportChart = BarChart(["Jan", "Feb", "Mar", "Apr"], [openSeries, resolvedSeries], "grouped", "Month", "Tickets")+openSeries = Series("Opened", [341, 327, 308, 289])+resolvedSeries = Series("Resolved", [319, 318, 301, 283])+supportList = EntityList([sup1, sup2, sup3], "small")+sup1 = { left: "Avg. Resolution Time", right: "4h 12m", rightVariant: "text" }+sup2 = { left: "First Contact Resolution", right: "78.4%", rightVariant: "number" }+sup3 = { left: "Escalation Rate", right: "6.2%", rightVariant: "number" }+cardMarketing = CompositeCardItem("marketing-roi", marketingHeader, [marketingMetric, marketingChart, marketingList])+marketingHeader = IconText(marketingIcon, "neutral", "m", "Marketing ROI", "Spend vs. pipeline generated", false, "horizontal")+marketingIcon = Icon("megaphone", "communication")+marketingMetric = MetricIndicatorInline("3.8x Blended ROI", "Return on Ad Spend", { direction: "up", value: 0.4 })+marketingChart = AreaChart(["Jan", "Feb", "Mar", "Apr"], [spendSeries, pipelineSeries], "natural", "Month", "Value ($k)")+spendSeries = Series("Ad Spend", [44.0, 46.8, 49.2, 51.6])+pipelineSeries = Series("Pipeline Generated", [158.2, 171.5, 184.9, 196.1])+marketingList = EntityList([mkt1, mkt2, mkt3], "small")+mkt1 = { left: "Total Ad Spend (Apr)", right: "$51,600", rightVariant: "number" }+mkt2 = { left: "Cost per Lead", right: "$48.20", rightVariant: "number" }+mkt3 = { left: "Top Channel", right: "Organic Search", rightVariant: "text" }+actionButtons = Buttons([btnChannels, btnForecast], "row")+btnChannels = Button("Break Down by Channel", { type: "continue_conversation", context: "Break down this month's revenue by acquisition channel" }, "primary")+btnForecast = Button("Forecast Next Quarter", { type: "continue_conversation", context: "Forecast revenue and active users for next quarter" }, "secondary")`,++ `Example 3 — Form response (help-me-choose/plan asks: inspiration cards FIRST, then a compact form). The inspiration-card images below came from an image tool call — include such cards ONLY when you have real URLs; with no real URLs, start directly with the form:++root = Card([header, intro, inspoCards, form])+header = CardHeader("Plan Your Trip", "A few ideas to spark inspiration — then tell me your preferences")+intro = TextContent("Tap a style to jump straight in, or fill the quick form below for a tailored plan.")+inspoCards = VisualCardBlock([insp1, insp2], "grid", true, { type: "continue_conversation", context: "Plan me a trip in this style with destinations, itinerary, and costs" })+insp1 = VisualCardItem(insp1body, "inspo-beach", "https://www.travelandleisure.com/thmb/cuAB7XMQ6s_Gji-no956KNopT7M=/1500x0/filters:no_upscale():max_bytes(150000):strip_icc()/TAL-maldives-TROPVACAY0325-1b5047d5931d4850b47d082966f9f563.jpg", insp1tag, "Maldives overwater villas")+insp1body = BoldText("text", "Tropical Beach Escape", "Overwater villas & snorkeling")+insp1tag = Tag("Relaxation", insp1icon, "sm", "info")+insp1icon = Icon("umbrella", "travel")+insp2 = VisualCardItem(insp2body, "inspo-mountain", "https://www.salkantaytrekmachu.com/img/adventure-travel-peru-032.jpg", insp2tag, "Trekking in the Peruvian Andes")+insp2body = BoldText("text", "Mountain Adventure", "Trekking & epic views")+insp2tag = Tag("Active", insp2icon, "sm", "warning")+insp2icon = Icon("mountain", "nature")+form = Form("trip-planner", formButtons, [fcDestination, fcDates, fcTravellers, fcTripType, fcBudget, fcStay, fcNotes])+formButtons = Buttons([btnSubmit, btnSkip], "row")+btnSubmit = Button("Plan My Trip", { type: "continue_conversation", context: "Help me plan a trip based on my form submission" }, "primary")+btnSkip = Button("Just Surprise Me", { type: "continue_conversation", context: "Skip the form and surprise me with a destination and itinerary" }, "secondary")+fcDestination = FormControl("Destination", destinationInput, "Leave blank if you'd like suggestions")+destinationInput = Input("destination", "e.g. Tokyo, Japan — or leave blank", "text")+fcDates = FormControl("Travel Dates", datesPicker, "Select your start and end dates")+datesPicker = DatePicker("travel-dates", "range", { required: true })+fcTravellers = FormControl("Number of Travellers", travellersSelect, "How many people are travelling?")+travellersSelect = Select("num-travellers", [tr1, tr2, tr3, tr4], "Select number of travellers", { required: true })+tr1 = SelectItem("1", "1 — Solo")+tr2 = SelectItem("2", "2 — Couple")+tr3 = SelectItem("3-4", "3–4 People")+tr4 = SelectItem("5+", "5+ People")+fcTripType = FormControl("Trip Type", tripTypeCards, "What kind of trip are you planning?")+tripTypeCards = OptionCards("trip-type", "single", [oc1, oc2, oc3, oc4], { required: true })+oc1 = OptionCard("adventure", "Adventure", "Hiking, trekking & outdoor activities", oc1icon)+oc1icon = Icon("mountain", "nature")+oc2 = OptionCard("beach", "Beach & Relaxation", "Sun, sand & leisure", oc2icon)+oc2icon = Icon("waves", "nature")+oc3 = OptionCard("cultural", "Cultural & Historical", "Museums, heritage & local experiences", oc3icon)+oc3icon = Icon("landmark", "buildings")+oc4 = OptionCard("city", "City Break", "Urban exploration & nightlife", oc4icon)+oc4icon = Icon("building-2", "buildings")+fcBudget = FormControl("Estimated Budget (per person)", budgetSlider, "Drag to set your per-person budget in USD")+budgetSlider = Slider("budget", "discrete", 500, 10000, 500, [2500], "Budget (USD)")+fcStay = FormControl("Accommodation Preference", stayChips, "Select all that apply")+stayChips = Chips("accommodation", "multiple", [ch1, ch2, ch3, ch4], {}, ["hotel"])+ch1 = ChipItem("hotel", "Hotel", ch1icon)+ch1icon = Icon("building", "buildings")+ch2 = ChipItem("resort", "Resort", ch2icon)+ch2icon = Icon("umbrella", "travel")+ch3 = ChipItem("airbnb", "Vacation Rental", ch3icon)+ch3icon = Icon("home", "home")+ch4 = ChipItem("camping", "Camping / Glamping", ch4icon)+ch4icon = Icon("tent", "nature")+fcNotes = FormControl("Special Requests or Notes", notesArea, "Any dietary needs, accessibility requirements, or specific interests?")+notesArea = TextArea("special-requests", "e.g. vegetarian meals, wheelchair access, honeymoon surprise...", 4)`,++ `Example 4 — Recommendations with images and links (same pattern for products, movies, restaurants, articles):++root = Card([header, intro, posters, linksHeader, trackCards], [src1, src2])+header = CardHeader("Retro-Energetic Indian Tracks", "New Hindi releases with 80s/90s dance DNA")+intro = TextContent("These recent tracks channel retro synths and 90s party percussion [1][2]. Tap a poster to explore a track, or use its button to watch the exact official video.")+posters = VisualCardBlock([v1, v2], "grid", true, { type: "continue_conversation", context: "Tell me more about this track and its retro influences" })+v1 = VisualCardItem(v1body, "tamma", "https://i.ytimg.com/vi/PQHeOb0Q9oo/hq720.jpg", v1tag, "Tamma Tamma video poster")+v1body = BoldText("text", "Tamma Tamma", "Dhurandhar · Ranveer Singh")+v1tag = Tag("80s Electro-Disco", v1icon, "sm", "success")+v1icon = Icon("disc-3", "multimedia")+v2 = VisualCardItem(v2body, "sajan", "https://i.ytimg.com/vi/mLz-qBiRnl8/hq720.jpg", v2tag, "Sajan Re video poster")+v2body = BoldText("text", "Sajan Re", "Nora Fatehi · Badshah")+v2tag = Tag("Synthwave Electro", v2icon, "sm", "info")+v2icon = Icon("music", "multimedia")+linksHeader = InlineHeader("Watch the Exact Videos", "Each button opens that track's official video")+trackCards = CompositeCardBlock([t1, t2], "grid", true)+t1 = CompositeCardItem("t-tamma", t1h, [t1body, t1tags], { button: t1btn })+t1h = IconText(t1icon, "neutral", "m", "Tamma Tamma", "Bappi Lahiri classic, electro-funk rework", true, "horizontal")+t1icon = Icon("disc-3", "multimedia")+t1body = Text("text", "Heavy analog synths and brass over a fast disco groove.", "Retro Electro-Disco")+t1tags = TagBlock(["2026 Film Hit", "Peak Party"])+t1btn = Button("Watch on YouTube", { type: "open_url", url: "https://www.youtube.com/watch?v=PQHeOb0Q9oo" }, "primary")+t2 = CompositeCardItem("t-sajan", t2h, [t2body, t2tags], { button: t2btn })+t2h = IconText(t2icon, "neutral", "m", "Sajan Re", "Nora Fatehi · Badshah · Sanjoy", true, "horizontal")+t2icon = Icon("music", "multimedia")+t2body = Text("text", "Synthwave melody hooks over a modern club beat.", "Retro-Fusion Electro")+t2tags = TagBlock(["Club Anthem", "Nora x Badshah"])+t2btn = Button("Watch on YouTube", { type: "open_url", url: "https://www.youtube.com/watch?v=COUSCnFazzc" }, "primary")+src1 = { title: "Tamma Tamma (Full Video) - Dhurandhar", sourceName: "YouTube (T-Series)", url: "https://www.youtube.com/watch?v=PQHeOb0Q9oo" }+src2 = { title: "Sajan Re (Official Music Video)", sourceName: "YouTube (T-Series)", url: "https://www.youtube.com/watch?v=COUSCnFazzc" }`,++ `Example 5 — Table with follow-ups:root = Card([title, tbl, followUps])title = TextContent("Top Languages", "large-heavy")@@ -77,46 +304,6 @@ years = [1991, 1995, 1995]followUps = FollowUpBlock([fu1, fu2])fu1 = FollowUpItem("Tell me more about Python")fu2 = FollowUpItem("Show me a JavaScript comparison")`,-- `Example 2 — Clickable list:--root = Card([title, list])-title = TextContent("Choose a topic", "large-heavy")-list = ListBlock([item1, item2, item3])-item1 = ListItem("Getting started", "New to the platform? Start here.")-item2 = ListItem("Advanced features", "Deep dives into powerful capabilities.")-item3 = ListItem("Troubleshooting", "Common issues and how to fix them.")`,-- `Example 3 — Image carousel with consistent slides + follow-ups:--root = Card([header, carousel, followups])-header = CardHeader("Featured Destinations", "Discover highlights and best time to visit")-carousel = Carousel([[t1, img1, d1, tags1], [t2, img2, d2, tags2], [t3, img3, d3, tags3]], "card")-t1 = TextContent("Paris, France", "large-heavy")-img1 = ImageBlock("https://picsum.photos/seed/paris/800/500", "Eiffel Tower at night")-d1 = TextContent("City of light — best Apr–Jun and Sep–Oct.", "default")-tags1 = TagBlock(["Landmark", "City Break", "Culture"])-t2 = TextContent("Kyoto, Japan", "large-heavy")-img2 = ImageBlock("https://picsum.photos/seed/kyoto/800/500", "Bamboo grove in Arashiyama")-d2 = TextContent("Temples and bamboo groves — best Mar–Apr and Nov.", "default")-tags2 = TagBlock(["Temples", "Autumn", "Culture"])-t3 = TextContent("Machu Picchu, Peru", "large-heavy")-img3 = ImageBlock("https://picsum.photos/seed/machupicchu/800/500", "Inca citadel in the clouds")-d3 = TextContent("High-altitude Inca citadel — best May–Sep.", "default")-tags3 = TagBlock(["Andes", "Hike", "UNESCO"])-followups = FollowUpBlock([fu1, fu2])-fu1 = FollowUpItem("Show me only beach destinations")-fu2 = FollowUpItem("Turn this into a comparison table")`,-- `Example 4 — Form with validation:--root = Card([title, form])-title = TextContent("Contact Us", "large-heavy")-form = Form("contact", btns, [nameField, emailField, msgField])-nameField = FormControl("Name", Input("name", "Your name", "text", { required: true, minLength: 2 }))-emailField = FormControl("Email", Input("email", "[email protected]", "email", { required: true, email: true }))-msgField = FormControl("Message", TextArea("message", "Tell us more...", 4, { required: true, minLength: 10 }))-btns = Buttons([Button("Submit", Action([@ToAssistant("Submit")]), "primary")])`,];export const openuiChatAdditionalRules: string[] = [@@ -124,15 +311,42 @@ export const openuiChatAdditionalRules: string[] = ["Every response is a single Card(children) — children stack vertically automatically. No layout params are needed on Card.","Card is the only layout container. Do NOT use Stack. Use Tabs to switch between sections, Carousel for horizontal scroll.","Use FollowUpBlock at the END of a Card to suggest what the user can do or ask next.",- "Use ListBlock when presenting a set of options or steps the user can click to select.",+ "Use ListBlock when presenting a set of options or steps; give each ListItem an action (5th argument) to make it clickable — without one the item is plain text.","Use SectionBlock to group long responses into collapsible sections — good for reports, FAQs, and structured content.","Use SectionItem inside SectionBlock: each item needs a unique value id, a trigger (header label), and a content array.","Carousel takes an array of slides, where each slide is an array of content: carousel = Carousel([[t1, img1], [t2, img2]])","IMPORTANT: Every slide in a Carousel must use the same component structure in the same order — e.g. all slides: [title, image, description, tags].",- "For image carousels, always use real accessible URLs like https://picsum.photos/seed/KEYWORD/800/500. Never hallucinate or invent image URLs.","For forms, define one FormControl reference per field so controls can stream progressively.","For forms, always provide the second Form argument with Buttons(...) actions: Form(name, buttons, fields).","Never nest Form inside Form.",+ "CardHeader is the page-level heading — place it as the first child of Card; InlineHeader is a lighter subsection label for a block inside the response, and is redundant when the following component already has a heading.",+ "Never use Callout or TextCallout to justify why you did what you did or for any meta-information.",+ "Every image slot (Image, ImageBlock, ImageGallery, VisualCardItem/ContextCardItem bgImageSrc, ImageText, ImageTextLarge, ListItem image) requires a REAL URL from a tool result, the conversation, or the user — NEVER invent, guess, or template a URL.",+ "If no image URL is in context, compose without image components — icons, gray ContextCardItems, and charts still make rich layouts.",+ "Argument-order trap: Image takes alt FIRST, while ImageBlock, ImageText, and ImageTextLarge take src FIRST — alt text in a src slot ships a broken image.",+ 'Card blocks (SnippetCardBlock, OverviewCardBlock, ContextCardBlock, CompositeCardBlock, VisualCardBlock) need at least 2 items, all with the same structure; use layout "grid" for primary side-by-side comparison and "carousel" for secondary browsing.',+ 'The card-block action is BLOCK-LEVEL: one action shared by every card, with the clicked card\'s details attached automatically — keep continue_conversation context generic (e.g. "Tell me more about this destination"), and never use a block-level open_url since it would send every card to the same URL.',+ 'Card items have NO per-item action: to give each item its own external link, use CompositeCardItem with footer { button: Button(label, { type: "open_url", url }) } — never claim a card opens a link it cannot.',+ "Text, BoldText, IconText, ImageText, ImageTextLarge and MetricIndicator* are inline building blocks used INSIDE card items — do not place them directly in the root Card.",+ 'EntityList size "small" is reserved for CompositeCardItem body content (no header/footer); use size "default" elsewhere.',+ "Tag variant must be semantically correct (success=positive, danger=negative, warning=cautionary, info=informational, neutral=label); Tag takes an optional Icon second, so use Tag(text, icon, size, variant) when a variant is needed.",+ "TagBlock takes plain strings — keep it to at most 3 tags.",+ 'ListBlock variant "number" is for ordered sequences and rankings, "image" for products/profiles with a real image; Steps is for ordered sequential processes only.',+ "Use SectionBlock to divide a long response into independent, equally prominent topics; use Tabs when the items are alternative views of the same thing; set isFoldable=false unless a section has 4+ distinct blocks; never make SectionBlock the first Card child.",+ "Accordion is for supplementary or FAQ content only — never primary information, 3-5 items max, and always the last component in its section or card.",+ 'Charts: LineChart/AreaChart variant "natural" for smooth trends and "linear" for precise point-to-point data; BarChart "grouped" for side-by-side comparison and "stacked" for part-to-whole; prefer HorizontalBarChart when category labels are long or numerous.',+ 'For large chart values, scale the data and put the unit in the axis label (e.g. yLabel "Revenue ($k)") instead of passing raw thousands or millions.',+ "Quantitative asks get a chart (plus KPI cards where useful) in the FIRST response — do not answer numbers with prose or a table alone.",+ "Table is column-oriented: each Col holds its own data array of plain strings or numbers (never components), and every column's array must have the same length.",+ "Use EditableTable ONLY when the user or app explicitly asks for an editable table; default to Table for read-only data.",+ 'Every Form MUST have EXACTLY ONE submit Button with variant "primary" — that button validates the form; other buttons (secondary/tertiary escape hatches like "Just Surprise Me") skip validation, and there is never a reset button.',+ "Prefer structured inputs (Select, Chips, OptionCards, DatePicker, Slider) over free-text Input, give every FormControl a clear label (and a hint where it prevents mistakes), and keep each field name unique within the response.",+ "Validation rules ({ required: true, email: true, minLength: 8, ... }) are enforced with inline errors — use them for genuinely essential fields, but never require a free-text field where leaving it blank is meaningful.",+ "Form inputs work ONLY inside a FormControl within a Form; for tappable suggestion choices OUTSIDE a form, use Buttons of continue_conversation Buttons — never a bare OptionCards or Chips.",+ "Only add Buttons for real actions: form submit, open_url with a URL from a tool or the user (never fabricated), or a continue_conversation follow-up — never a button for an app action (open, download, export, edit) you cannot perform.",+ 'Every Button label must accurately describe what clicking it does; use "primary" for the main action and "secondary"/"tertiary" only for lower-emphasis supporting actions.',+ "Icon: always include the category argument — it enables fallback matching when the exact lucide name is unavailable.",+ "Pass sources on Card ONLY when the answer relies on real references you actually have, and cite them inline in TextContent as [1], [2] (1-based index into sources).",];export const openuiChatPromptOptions: PromptOptions = {diff --git a/packages/react-ui/src/genui-lib/selectionFieldUtils.ts b/packages/react-ui/src/genui-lib/selectionFieldUtils.tsnew file mode 100644index 000000000..e4b5127f5--- /dev/null+++ b/packages/react-ui/src/genui-lib/selectionFieldUtils.ts@@ -0,0 +1,82 @@+export type SelectionType = "single" | "multiple";+export type SelectionDefaultValue = string | string[] | undefined;++const onlyStrings = (values: unknown[]) =>+ values.filter((value): value is string => typeof value === "string");++/** Resolves the stored form value (falling back to defaultValue) into a list of selected values. */+export function normalizeSelection(+ type: SelectionType,+ storedValue: unknown,+ defaultValue: SelectionDefaultValue,+): string[] {+ if (type === "single") {+ if (typeof storedValue === "string") {+ return storedValue ? [storedValue] : [];+ }+ if (Array.isArray(storedValue) && typeof storedValue[0] === "string") {+ return storedValue[0] ? [storedValue[0]] : [];+ }+ if (typeof defaultValue === "string") {+ return defaultValue ? [defaultValue] : [];+ }+ if (Array.isArray(defaultValue) && typeof defaultValue[0] === "string") {+ return defaultValue[0] ? [defaultValue[0]] : [];+ }+ return [];+ }++ if (Array.isArray(storedValue)) {+ return onlyStrings(storedValue);+ }+ if (typeof storedValue === "string") {+ return storedValue ? [storedValue] : [];+ }+ if (Array.isArray(defaultValue)) {+ return onlyStrings(defaultValue);+ }+ if (typeof defaultValue === "string") {+ return defaultValue ? [defaultValue] : [];+ }++ return [];+}++/** Shape of defaultValue as it should be written into form state (string for single, string[] for multiple). */+export function getStoredDefaultValue(+ type: SelectionType,+ defaultValue: SelectionDefaultValue,+): string | string[] | undefined {+ if (type === "single") {+ if (typeof defaultValue === "string") {+ return defaultValue || undefined;+ }+ if (Array.isArray(defaultValue) && typeof defaultValue[0] === "string") {+ return defaultValue[0] || undefined;+ }+ return undefined;+ }++ if (Array.isArray(defaultValue)) {+ return onlyStrings(defaultValue);+ }+ if (typeof defaultValue === "string") {+ return defaultValue ? [defaultValue] : [];+ }++ return undefined;+}++/** Toggles `itemValue` in `selection` according to the selection type. */+export function toggleSelection(+ type: SelectionType,+ selection: string[],+ itemValue: string,+): string[] {+ if (type === "single") {+ return selection[0] === itemValue ? [] : [itemValue];+ }+ return selection.includes(itemValue)+ ? selection.filter((value) => value !== itemValue)+ : [...selection, itemValue];+}diff --git a/packages/react-ui/src/genui-lib/unions.ts b/packages/react-ui/src/genui-lib/unions.tsindex 79dcb60d9..7eab30506 100644--- a/packages/react-ui/src/genui-lib/unions.ts+++ b/packages/react-ui/src/genui-lib/unions.ts@@ -35,6 +35,15 @@ import { FollowUpBlock } from "./FollowUpBlock";import { ListBlock } from "./ListBlock";import { SectionBlock } from "./SectionBlock";+import { CompositeCardBlock } from "./CompositeCardBlock";+import { ContextCardBlock } from "./ContextCardBlock";+import { EditableTable } from "./EditableTable";+import { EntityList } from "./EntityList";+import { InlineHeader } from "./InlineHeader";+import { OverviewCardBlock } from "./OverviewCardBlock";+import { SnippetCardBlock } from "./SnippetCardBlock";+import { VisualCardBlock } from "./VisualCardBlock";+export const ContentChildUnion = z.union([TextContent.ref,MarkDownRenderer.ref,@@ -62,7 +71,8 @@ export const ContentChildUnion = z.union([Steps.ref,]);-// Chat-specific content union — no Stack, adds ListBlock / FollowUpBlock / SectionBlock+// Chat-specific content union — no Stack, adds ListBlock / FollowUpBlock / SectionBlock,+// plus the chat-only blocks (InlineHeader, EntityList, EditableTable, card blocks).// Note: Tabs and Carousel are NOT included here to avoid circular deps (Tabs/schema.ts imports ContentChildUnion).// ChatCardChildUnion (which adds Tabs + Carousel) is defined in openuiChatLibrary.tsx.export const ChatContentChildUnion = z.union([@@ -70,4 +80,12 @@ export const ChatContentChildUnion = z.union([ListBlock.ref,FollowUpBlock.ref,SectionBlock.ref,+ InlineHeader.ref,+ EntityList.ref,+ EditableTable.ref,+ SnippetCardBlock.ref,+ OverviewCardBlock.ref,+ ContextCardBlock.ref,+ CompositeCardBlock.ref,+ VisualCardBlock.ref,]);diff --git a/packages/react-ui/src/index.ts b/packages/react-ui/src/index.tsindex c2ab7616f..90625ed22 100644--- a/packages/react-ui/src/index.ts+++ b/packages/react-ui/src/index.ts@@ -74,23 +74,38 @@ export * from "./components/Charts";export type { ExportChartData } from "./components/Charts/Charts";export * from "./components/CheckBoxGroup";export * from "./components/CheckBoxItem";+export * from "./components/Chips";+export * from "./components/Citation";export * from "./components/CodeBlock";+export * from "./components/CompositeCardBlock";+export * from "./components/ContextCardBlock";export * from "./components/DatePicker";export * from "./components/DotMatrixLoader";+export * from "./components/EditableTable";+export * from "./components/EntityList";export * from "./components/FollowUpBlock";export * from "./components/FollowUpItem";export * from "./components/FormControl";export * from "./components/IconButton";+export * from "./components/IconTag";+export * from "./components/IconText";export * from "./components/Image";export * from "./components/ImageBlock";export * from "./components/ImageGallery";+export * from "./components/ImageText";+export * from "./components/ImageTextLarge";+export * from "./components/InlineHeader";+export * from "./components/InlineMarkdownRenderer";export * from "./components/Input";export * from "./components/Label";export * from "./components/ListBlock";export * from "./components/ListItem";export * from "./components/MarkDownRenderer";+export * from "./components/MetricIndicator";export * from "./components/ModelSwitcher";export * from "./components/OpenUIChat";+export * from "./components/OptionCards";+export * from "./components/OverviewCardBlock";export * from "./components/RadioGroup";export * from "./components/RadioItem";export * from "./components/SectionBlock";@@ -98,6 +113,9 @@ export * from "./components/Select";export * from "./components/Separator";export * from "./components/Skeleton";export * from "./components/Slider";+export * from "./components/SnippetCardBlock";+export * from "./components/SourceFaviconImage";+export * from "./components/Sources";export * from "./components/Steps";export * from "./components/SwitchGroup";export * from "./components/SwitchItem";@@ -106,12 +124,20 @@ export * from "./components/Tabs";export * from "./components/Tag";export * from "./components/TagBlock";export * from "./components/TextArea";+export * from "./components/TextBlock";export * from "./components/TextCallout";export * from "./components/TextContent";+export * from "./components/TextContentWrapper";export * from "./components/ThemeProvider";export * from "./components/ToolCall";export * from "./components/ToolResult";+export * from "./components/TooltipWrapper";+export * from "./components/VisualCardBlock";++// Shared chat helpers+export { IconWrapper, type IconWrapperProps } from "./components/_shared/icons";+export { safeOpenUrl, safeUrl } from "./components/_shared/utils";// Genui-lib standard libraryexport {diff --git a/packages/react-ui/src/scripts/generate-css-utils.ts b/packages/react-ui/src/scripts/generate-css-utils.tsindex b4d6d2a1b..ecf144be0 100644--- a/packages/react-ui/src/scripts/generate-css-utils.ts+++ b/packages/react-ui/src/scripts/generate-css-utils.ts@@ -94,6 +94,8 @@ $typography: (heading: typography(openui-text-numbers-heading-lg),heading-small: typography(openui-text-numbers-heading-sm),heading-medium: typography(openui-text-numbers-heading-md),+ title: typography(openui-text-numbers-heading-lg),+ title-medium: typography(openui-text-numbers-heading-md),heading-large: typography(openui-text-numbers-heading-lg),heading-xl: typography(openui-text-numbers-heading-xl),),diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex a8000500e..5b181d8bb 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -161,13 +161,13 @@ importers:version: 4.25.11(@babel/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])([email protected])([email protected]([email protected]))([email protected])fumadocs-core:specifier: 16.9.1- version: 16.9.1(@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])+ version: 16.9.1(@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])fumadocs-mdx:specifier: 14.3.2- version: 14.3.2(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 14.3.2(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))fumadocs-ui:specifier: 16.9.1- version: 16.9.1(@emotion/[email protected])(@tailwindcss/[email protected])(@takumi-rs/[email protected])(@types/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])+ version: 16.9.1(@emotion/[email protected])(@tailwindcss/[email protected])(@takumi-rs/[email protected])(@types/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])gpt-tokenizer:specifier: ^3.4.0version: 3.4.0@@ -182,7 +182,7 @@ importers:version: 12.42.2(@emotion/[email protected])([email protected]([email protected]))([email protected])next:specifier: 16.2.6- version: 16.2.6(@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])+ version: 16.2.6(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])next-themes:specifier: ^0.4.6@@ -504,7 +504,7 @@ importers:version: 6.0.236([email protected])eve:specifier: ^0.11.7- version: 0.11.10(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected])([email protected](@typescript-eslint/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))+ version: 0.11.10(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected])([email protected](@typescript-eslint/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))openai:specifier: ^6.22.0version: 6.49.0(@aws-sdk/[email protected])(@smithy/[email protected])([email protected])([email protected])@@ -602,6 +602,9 @@ importers:'@radix-ui/react-tooltip':specifier: ^1.2.7version: 1.2.7(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])+ '@tanstack/react-table':+ specifier: ^8.21.3clsx:specifier: ^2.1.1version: 2.1.1@@ -650,6 +653,9 @@ importers:tiny-invariant:specifier: ^1.3.3version: 1.3.3+ unist-util-visit:+ specifier: ^5.1.0+ version: 5.1.0zod:specifier: 'catalog:'version: 4.4.3@@ -16632,13 +16638,13 @@ snapshots:- [email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected])([email protected](@typescript-eslint/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected])):+ [email protected](@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected])([email protected](@typescript-eslint/[email protected]))([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected])):dependencies:ai: 6.0.236([email protected])nitro: 3.0.260610-beta([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))optionalDependencies:'@opentelemetry/api': 1.9.1- next: 16.2.6(@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])+ next: 16.2.6(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])react: 19.2.4svelte: 5.56.8(@typescript-eslint/[email protected])vite: 7.3.6(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])@@ -16866,7 +16872,7 @@ snapshots:optional: true- [email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]):+ [email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]):dependencies:'@orama/orama': 3.1.18estree-util-value-to-estree: 3.5.0@@ -16892,21 +16898,21 @@ snapshots:'@types/mdast': 4.0.4'@types/react': 19.2.17lucide-react: 0.570.0([email protected])- next: 16.2.6(@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])+ next: 16.2.6(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])react: 19.2.4react-dom: 19.2.4([email protected])zod: 4.4.3transitivePeerDependencies:- supports-color- [email protected](@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):+ [email protected](@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):dependencies:'@mdx-js/mdx': 3.1.1'@standard-schema/spec': 1.1.0chokidar: 5.0.0esbuild: 0.28.1estree-util-value-to-estree: 3.5.0- fumadocs-core: 16.9.1(@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])+ fumadocs-core: 16.9.1(@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])js-yaml: 4.3.0mdast-util-mdx: 3.0.0mdast-util-to-markdown: 2.1.2@@ -16923,13 +16929,13 @@ snapshots:'@types/mdast': 4.0.4'@types/mdx': 2.0.14'@types/react': 19.2.17- next: 16.2.6(@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])+ next: 16.2.6(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])react: 19.2.4vite: 7.3.6(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])transitivePeerDependencies:- supports-color- [email protected](@emotion/[email protected])(@tailwindcss/[email protected])(@takumi-rs/[email protected])(@types/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]):+ [email protected](@emotion/[email protected])(@tailwindcss/[email protected])(@takumi-rs/[email protected])(@types/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected](@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]):dependencies:'@fumadocs/tailwind': 0.0.5(@tailwindcss/[email protected])([email protected])'@radix-ui/react-accordion': 1.2.20(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])@@ -16943,7 +16949,7 @@ snapshots:'@radix-ui/react-slot': 1.3.3(@types/[email protected])([email protected])'@radix-ui/react-tabs': 1.1.21(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])class-variance-authority: 0.7.1- fumadocs-core: 16.9.1(@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])+ fumadocs-core: 16.9.1(@mdx-js/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])lucide-react: 1.27.0([email protected])motion: 12.42.2(@emotion/[email protected])([email protected]([email protected]))([email protected])@@ -16959,7 +16965,7 @@ snapshots:'@takumi-rs/image-response': 0.68.17'@types/mdx': 2.0.14'@types/react': 19.2.17- next: 16.2.6(@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])+ next: 16.2.6(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])transitivePeerDependencies:- '@emotion/is-prop-valid'- '@tailwindcss/oxide'@@ -18475,7 +18481,7 @@ snapshots:react: 19.2.4react-dom: 19.2.4([email protected])- [email protected](@babel/[email protected])(@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]):+ [email protected](@opentelemetry/[email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]):dependencies:'@next/env': 16.2.6'@swc/helpers': 0.5.15@@ -18484,7 +18490,7 @@ snapshots:postcss: 8.5.24react: 19.2.4react-dom: 19.2.4([email protected])- styled-jsx: 5.1.6(@babel/[email protected])([email protected])+ styled-jsx: 5.1.6([email protected])optionalDependencies:'@next/swc-darwin-arm64': 16.2.6'@next/swc-darwin-x64': 16.2.6@@ -20060,12 +20066,10 @@ snapshots:dependencies:inline-style-parser: 0.2.7dependencies:client-only: 0.0.1react: 19.2.4- optionalDependencies:- '@babel/core': 7.29.7