@uibot/registry 0.15.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -9
- package/dist/public-resources.d.ts +4 -0
- package/dist/resource-index.d.ts +2 -0
- package/dist/resource-query.d.ts +3 -0
- package/dist/resources.d.ts +3 -0
- package/dist/resources.js +4 -0
- package/dist/shadcn/r/admin-shell.json +7 -1
- package/dist/shadcn/r/collection-cell-editor.json +1 -1
- package/dist/shadcn/r/collection-panel-drawer.json +1 -1
- package/dist/shadcn/r/collection-record-menu.json +1 -1
- package/dist/shadcn/r/collection-shared.json +1 -1
- package/dist/shadcn/r/creation-html-generation.json +2 -2
- package/dist/shadcn/r/creation-reference-generation.json +2 -2
- package/dist/shadcn/r/creation-revision-export.json +2 -2
- package/dist/shadcn/r/creation-shared.json +2 -2
- package/dist/shadcn/r/creation-variant-compare.json +3 -3
- package/dist/shadcn/r/creation-workspace.json +3 -3
- package/dist/shadcn/r/data.json +10 -2
- package/dist/shadcn/r/feedback.json +35 -4
- package/dist/shadcn/r/form.json +5 -1
- package/dist/shadcn/r/layout.json +78 -16
- package/dist/shadcn/r/shadcn-admin-shell.json +1 -1
- package/dist/shadcn/r/shadcn-admin.json +1 -1
- package/dist/shadcn/registry.json +18 -18
- package/package.json +7 -3
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Right-click record actions (expand, duplicate, copy cells, delete) for renderRecordContextMenu.",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"react",
|
|
8
|
-
"@uibot/renderer-react@^0.
|
|
8
|
+
"@uibot/renderer-react@^0.17.0"
|
|
9
9
|
],
|
|
10
10
|
"registryDependencies": [
|
|
11
11
|
"context-menu",
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"description": "Generate a new HTML artifact or rewrite the current revision, with at-most-once dispatch and reconcile from @uibot/creation-kit.",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"react",
|
|
8
|
-
"@uibot/contracts@^0.
|
|
9
|
-
"@uibot/creation-kit@^0.
|
|
8
|
+
"@uibot/contracts@^0.17.0",
|
|
9
|
+
"@uibot/creation-kit@^0.17.0"
|
|
10
10
|
],
|
|
11
11
|
"registryDependencies": [
|
|
12
12
|
"button",
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"description": "Generate a presentation from an explicitly chosen saved HTML revision.",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"react",
|
|
8
|
-
"@uibot/contracts@^0.
|
|
9
|
-
"@uibot/creation-kit@^0.
|
|
8
|
+
"@uibot/contracts@^0.17.0",
|
|
9
|
+
"@uibot/creation-kit@^0.17.0"
|
|
10
10
|
],
|
|
11
11
|
"registryDependencies": [
|
|
12
12
|
"button",
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"description": "Download a saved HTML revision (PPTX for presentations) once no model request is open; the host supplies the export transport.",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"react",
|
|
8
|
-
"@uibot/contracts@^0.
|
|
9
|
-
"@uibot/creation-kit@^0.
|
|
8
|
+
"@uibot/contracts@^0.17.0",
|
|
9
|
+
"@uibot/creation-kit@^0.17.0"
|
|
10
10
|
],
|
|
11
11
|
"registryDependencies": [
|
|
12
12
|
"button",
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"description": "Copy (zh/en), domain filters and run checks shared by the UIBot creation blocks.",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"react",
|
|
8
|
-
"@uibot/contracts@^0.
|
|
9
|
-
"@uibot/creation-kit@^0.
|
|
8
|
+
"@uibot/contracts@^0.17.0",
|
|
9
|
+
"@uibot/creation-kit@^0.17.0"
|
|
10
10
|
],
|
|
11
11
|
"registryDependencies": [],
|
|
12
12
|
"files": [
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"description": "Generate two or three HTML candidates side by side (project design, design guides or custom directions) and adopt one as the next revision, over useCreationVariants.",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"react",
|
|
8
|
-
"@uibot/contracts@^0.
|
|
9
|
-
"@uibot/creation-kit@^0.
|
|
10
|
-
"@uibot/web-preview@^0.
|
|
8
|
+
"@uibot/contracts@^0.17.0",
|
|
9
|
+
"@uibot/creation-kit@^0.17.0",
|
|
10
|
+
"@uibot/web-preview@^0.17.0"
|
|
11
11
|
],
|
|
12
12
|
"registryDependencies": [
|
|
13
13
|
"button",
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"description": "Manual HTML creation workspace (projects, artifacts, CAS saves with a conflict step, generation, export) over useCreationWorkspace; the host renders the editor.",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"react",
|
|
8
|
-
"@uibot/contracts@^0.
|
|
9
|
-
"@uibot/creation-kit@^0.
|
|
10
|
-
"@uibot/web-preview@^0.
|
|
8
|
+
"@uibot/contracts@^0.17.0",
|
|
9
|
+
"@uibot/creation-kit@^0.17.0",
|
|
10
|
+
"@uibot/web-preview@^0.17.0"
|
|
11
11
|
],
|
|
12
12
|
"registryDependencies": [
|
|
13
13
|
"button",
|
package/dist/shadcn/r/data.json
CHANGED
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
{
|
|
14
14
|
"path": "components/uibot/data.tsx",
|
|
15
15
|
"target": "components/uibot/data.tsx",
|
|
16
|
-
"content": "import type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/** Repeated list of items */\nexport const List: RendererComponent = (props, ctx) => {\n const divided = props[\"divided\"] === true;\n const compact = props[\"compact\"] === true;\n\n return (\n <ul\n className={cn(\n \"uibot-list\",\n divided ? \"divide-y divide-border\" : compact ? \"space-y-1\" : \"space-y-2\",\n )}\n data-uibot-type=\"List\"\n aria-label={typeof props[\"label\"] === \"string\" ? props[\"label\"] : undefined}\n >\n {ctx.children as ReactNode[]}\n </ul>\n );\n};\n\n/** Data table with columns and rows */\nexport const Table: RendererComponent = (props) => {\n const columns = Array.isArray(props[\"columns\"])\n ? (props[\"columns\"] as Array<{ key: string; label: string; align?: string }>)\n : [];\n const rows = Array.isArray(props[\"rows\"])\n ? (props[\"rows\"] as Array<Record<string, unknown>>)\n : [];\n const striped = props[\"striped\"] !== false;\n const caption = typeof props[\"caption\"] === \"string\" ? props[\"caption\"] : null;\n\n return (\n <div className=\"uibot-table w-full overflow-auto rounded-lg border\" data-uibot-type=\"Table\">\n <table className=\"w-full text-sm\">\n {caption && (\n <caption className=\"mb-1 py-2 text-sm text-muted-foreground\">{caption}</caption>\n )}\n <thead>\n <tr className=\"border-b bg-muted/50\">\n {columns.map((col) => (\n <th\n key={col.key}\n scope=\"col\"\n className={cn(\n \"px-4 py-3 text-xs font-medium uppercase tracking-wide text-muted-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n )}\n >\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b transition-colors last:border-0 hover:bg-muted/30\",\n striped && i % 2 === 1 ? \"bg-muted/10\" : \"\",\n )}\n >\n {columns.map((col) => (\n <td\n key={col.key}\n className={cn(\n \"px-4 py-3 text-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"\",\n )}\n >\n {String(row[col.key] ?? \"\")}\n </td>\n ))}\n </tr>\n ))}\n {rows.length === 0 && (\n <tr>\n <td\n colSpan={columns.length || 1}\n className=\"px-4 py-10 text-center text-sm text-muted-foreground\"\n >\n {typeof props[\"emptyText\"] === \"string\" ? props[\"emptyText\"] : \"No data\"}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </div>\n );\n};\n\nconst TREND_UP = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 10 7 4 12 10\" />\n </svg>\n);\nconst TREND_DOWN = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 4 7 10 12 4\" />\n </svg>\n);\n\n/** Single statistic display (number + label) */\nexport const Stat: RendererComponent = (props) => {\n const trend = props[\"trend\"] as \"up\" | \"down\" | undefined;\n const change =\n typeof props[\"change\"] === \"string\" || typeof props[\"change\"] === \"number\"\n ? String(props[\"change\"])\n : null;\n\n return (\n <div\n className=\"uibot-stat bg-card text-card-foreground rounded-xl border p-5 shadow-sm\"\n data-uibot-type=\"Stat\"\n >\n <p className=\"text-sm font-medium text-muted-foreground\">\n {typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"Stat\"}\n </p>\n <p className=\"mt-1.5 text-3xl font-bold tracking-tight\">\n {props[\"value\"] !== undefined ? String(props[\"value\"]) : \"—\"}\n </p>\n {(change !== null || typeof props[\"description\"] === \"string\") && (\n <div className=\"mt-1.5 flex items-center gap-1.5\">\n {trend && (\n <span\n className={cn(\n \"flex items-center\",\n trend === \"up\" ? \"text-green-600\" : \"text-destructive\",\n )}\n >\n {trend === \"up\" ? TREND_UP : TREND_DOWN}\n </span>\n )}\n {change !== null && (\n <span\n className={cn(\n \"text-xs font-medium\",\n trend === \"up\"\n ? \"text-green-600\"\n : trend === \"down\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {change}\n </span>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <span className=\"text-xs text-muted-foreground\">{props[\"description\"]}</span>\n )}\n </div>\n )}\n </div>\n );\n};\n\n/** Simple inline Markdown renderer */\nfunction renderMarkdown(text: string): ReactNode[] {\n const lines = text.split(\"\\n\");\n const nodes: ReactNode[] = [];\n let listItems: ReactNode[] = [];\n\n const flushList = () => {\n if (listItems.length > 0) {\n nodes.push(\n <ul key={`ul-${nodes.length}`} className=\"my-2 ml-4 list-disc space-y-1 text-sm\">\n {listItems}\n </ul>,\n );\n listItems = [];\n }\n };\n\n const inlineFormat = (raw: string, key: string): ReactNode => {\n // Very small inline parser: **bold**, *italic*, `code`\n const parts = raw.split(/(\\*\\*[^*]+\\*\\*|\\*[^*]+\\*|`[^`]+`)/g);\n if (parts.length === 1) return raw;\n return (\n <span key={key}>\n {parts.map((p, i) => {\n if (p.startsWith(\"**\") && p.endsWith(\"**\"))\n return (\n <strong key={i} className=\"font-semibold\">\n {p.slice(2, -2)}\n </strong>\n );\n if (p.startsWith(\"*\") && p.endsWith(\"*\")) return <em key={i}>{p.slice(1, -1)}</em>;\n if (p.startsWith(\"`\") && p.endsWith(\"`\"))\n return (\n <code key={i} className=\"rounded bg-muted px-1 py-0.5 font-mono text-[0.8em]\">\n {p.slice(1, -1)}\n </code>\n );\n return p;\n })}\n </span>\n );\n };\n\n lines.forEach((line, i) => {\n const hm = /^(#{1,6})\\s+(.+)$/.exec(line);\n if (hm) {\n flushList();\n const level = hm[1]!.length;\n const sizeMap = [\"text-2xl\", \"text-xl\", \"text-lg\", \"text-base\", \"text-sm\", \"text-xs\"];\n const cls = cn(\"font-semibold leading-tight my-2\", sizeMap[level - 1] ?? \"text-base\");\n const Tag = `h${level}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n nodes.push(\n <Tag key={i} className={cls}>\n {inlineFormat(hm[2]!, `h-${i}`)}\n </Tag>,\n );\n return;\n }\n\n const lm = /^[-*]\\s+(.+)$/.exec(line);\n if (lm) {\n listItems.push(<li key={i}>{inlineFormat(lm[1]!, `li-${i}`)}</li>);\n return;\n }\n\n flushList();\n if (line.trim() === \"\") {\n nodes.push(<br key={i} />);\n } else {\n nodes.push(\n <p key={i} className=\"my-1 text-sm leading-relaxed\">\n {inlineFormat(line, `p-${i}`)}\n </p>,\n );\n }\n });\n\n flushList();\n return nodes;\n}\n\n/** Markdown text content renderer */\nexport const Markdown: RendererComponent = (props) => {\n const content = typeof props[\"content\"] === \"string\" ? props[\"content\"] : \"\";\n return (\n <div className=\"uibot-markdown text-foreground\" data-uibot-type=\"Markdown\">\n {renderMarkdown(content)}\n </div>\n );\n};\n\nconst HEADING_SIZE: Record<number, string> = {\n 1: \"text-4xl\",\n 2: \"text-3xl\",\n 3: \"text-2xl\",\n 4: \"text-xl\",\n 5: \"text-lg\",\n 6: \"text-base\",\n};\n\n/** Section heading (h1–h6) */\nexport const Heading: RendererComponent = (props) => {\n const lvl = typeof props[\"level\"] === \"number\" ? Math.min(6, Math.max(1, props[\"level\"])) : 2;\n const size = HEADING_SIZE[lvl] ?? \"text-3xl\";\n const weight = lvl <= 2 ? \"font-bold\" : \"font-semibold\";\n const text = typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\";\n const muted = props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\";\n const cls = cn(\n \"uibot-heading tracking-tight leading-tight\",\n size,\n weight,\n muted,\n typeof props.className === \"string\" ? props.className : \"\",\n );\n const Tag = `h${lvl}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n return (\n <Tag className={cls} data-uibot-type=\"Heading\">\n {text}\n </Tag>\n );\n};\n\n/** Body paragraph text */\nexport const Paragraph: RendererComponent = (props) => (\n <p\n className={cn(\n \"uibot-paragraph leading-relaxed\",\n props[\"size\"] === \"sm\" ? \"text-sm\" : props[\"size\"] === \"lg\" ? \"text-lg\" : \"text-sm\",\n props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\",\n )}\n data-uibot-type=\"Paragraph\"\n >\n {typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\"}\n </p>\n);\n",
|
|
16
|
+
"content": "import type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/** Repeated list of items */\nexport const List: RendererComponent = (props, ctx) => {\n const divided = props[\"divided\"] === true;\n const compact = props[\"compact\"] === true;\n\n return (\n <ul\n className={cn(\n \"uibot-list\",\n divided ? \"divide-y divide-border\" : compact ? \"space-y-1\" : \"space-y-2\",\n )}\n data-uibot-type=\"List\"\n aria-label={typeof props[\"label\"] === \"string\" ? props[\"label\"] : undefined}\n >\n {ctx.children as ReactNode[]}\n </ul>\n );\n};\n\n/** Data table with columns and rows */\nexport const Table: RendererComponent = (props) => {\n const columns = Array.isArray(props[\"columns\"])\n ? (props[\"columns\"] as Array<{ key: string; label: string; align?: string }>)\n : [];\n const rows = Array.isArray(props[\"rows\"])\n ? (props[\"rows\"] as Array<Record<string, unknown>>)\n : [];\n const striped = props[\"striped\"] !== false;\n const caption = typeof props[\"caption\"] === \"string\" ? props[\"caption\"] : null;\n\n return (\n <div className=\"uibot-table w-full overflow-auto rounded-lg border\" data-uibot-type=\"Table\">\n <table className=\"w-full text-sm\">\n {caption && (\n <caption className=\"mb-1 py-2 text-sm text-muted-foreground\">{caption}</caption>\n )}\n <thead>\n <tr className=\"border-b bg-muted/50\">\n {columns.map((col) => (\n <th\n key={col.key}\n scope=\"col\"\n className={cn(\n \"px-4 py-3 text-xs font-medium uppercase tracking-wide text-muted-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"text-left\",\n )}\n >\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, i) => (\n <tr\n key={i}\n className={cn(\n \"border-b transition-colors last:border-0 hover:bg-muted/30\",\n striped && i % 2 === 1 ? \"bg-muted/10\" : \"\",\n )}\n >\n {columns.map((col) => (\n <td\n key={col.key}\n className={cn(\n \"px-4 py-3 text-foreground\",\n col.align === \"right\"\n ? \"text-right\"\n : col.align === \"center\"\n ? \"text-center\"\n : \"\",\n )}\n >\n {String(row[col.key] ?? \"\")}\n </td>\n ))}\n </tr>\n ))}\n {rows.length === 0 && (\n <tr>\n <td\n colSpan={columns.length || 1}\n className=\"px-4 py-10 text-center text-sm text-muted-foreground\"\n >\n {typeof props[\"emptyText\"] === \"string\" ? props[\"emptyText\"] : \"No data\"}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </div>\n );\n};\n\nconst TREND_UP = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 10 7 4 12 10\" />\n </svg>\n);\nconst TREND_DOWN = (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"2 4 7 10 12 4\" />\n </svg>\n);\n\n/** Single statistic display (number + label) */\nexport const Stat: RendererComponent = (props) => {\n const trend = props[\"trend\"] as \"up\" | \"down\" | undefined;\n const change =\n typeof props[\"change\"] === \"string\" || typeof props[\"change\"] === \"number\"\n ? String(props[\"change\"])\n : null;\n\n return (\n <div\n className=\"uibot-stat bg-card text-card-foreground rounded-xl border p-5 shadow-sm\"\n data-uibot-type=\"Stat\"\n >\n <p className=\"text-sm font-medium text-muted-foreground\">\n {typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"Stat\"}\n </p>\n <p className=\"mt-1.5 text-3xl font-bold tracking-tight\">\n {props[\"value\"] !== undefined ? String(props[\"value\"]) : \"—\"}\n </p>\n {(change !== null || typeof props[\"description\"] === \"string\") && (\n <div className=\"mt-1.5 flex items-center gap-1.5\">\n {trend && (\n <span\n className={cn(\n \"flex items-center\",\n trend === \"up\" ? \"text-green-600\" : \"text-destructive\",\n )}\n >\n {trend === \"up\" ? TREND_UP : TREND_DOWN}\n </span>\n )}\n {change !== null && (\n <span\n className={cn(\n \"text-xs font-medium\",\n trend === \"up\"\n ? \"text-green-600\"\n : trend === \"down\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {change}\n </span>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <span className=\"text-xs text-muted-foreground\">{props[\"description\"]}</span>\n )}\n </div>\n )}\n </div>\n );\n};\n\n/** Simple inline Markdown renderer */\nfunction renderMarkdown(text: string): ReactNode[] {\n const lines = text.split(\"\\n\");\n const nodes: ReactNode[] = [];\n let listItems: ReactNode[] = [];\n\n const flushList = () => {\n if (listItems.length > 0) {\n nodes.push(\n <ul key={`ul-${nodes.length}`} className=\"my-2 ml-4 list-disc space-y-1 text-sm\">\n {listItems}\n </ul>,\n );\n listItems = [];\n }\n };\n\n const inlineFormat = (raw: string, key: string): ReactNode => {\n // Very small inline parser: **bold**, *italic*, `code`\n const parts = raw.split(/(\\*\\*[^*]+\\*\\*|\\*[^*]+\\*|`[^`]+`)/g);\n if (parts.length === 1) return raw;\n return (\n <span key={key}>\n {parts.map((p, i) => {\n if (p.startsWith(\"**\") && p.endsWith(\"**\"))\n return (\n <strong key={i} className=\"font-semibold\">\n {p.slice(2, -2)}\n </strong>\n );\n if (p.startsWith(\"*\") && p.endsWith(\"*\")) return <em key={i}>{p.slice(1, -1)}</em>;\n if (p.startsWith(\"`\") && p.endsWith(\"`\"))\n return (\n <code key={i} className=\"rounded bg-muted px-1 py-0.5 font-mono text-[0.8em]\">\n {p.slice(1, -1)}\n </code>\n );\n return p;\n })}\n </span>\n );\n };\n\n lines.forEach((line, i) => {\n const hm = /^(#{1,6})\\s+(.+)$/.exec(line);\n if (hm) {\n flushList();\n const level = hm[1]!.length;\n const sizeMap = [\"text-2xl\", \"text-xl\", \"text-lg\", \"text-base\", \"text-sm\", \"text-xs\"];\n const cls = cn(\"font-semibold leading-tight my-2\", sizeMap[level - 1] ?? \"text-base\");\n const Tag = `h${level}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n nodes.push(\n <Tag key={i} className={cls}>\n {inlineFormat(hm[2]!, `h-${i}`)}\n </Tag>,\n );\n return;\n }\n\n const lm = /^[-*]\\s+(.+)$/.exec(line);\n if (lm) {\n listItems.push(<li key={i}>{inlineFormat(lm[1]!, `li-${i}`)}</li>);\n return;\n }\n\n flushList();\n if (line.trim() === \"\") {\n nodes.push(<br key={i} />);\n } else {\n nodes.push(\n <p key={i} className=\"my-1 text-sm leading-relaxed\">\n {inlineFormat(line, `p-${i}`)}\n </p>,\n );\n }\n });\n\n flushList();\n return nodes;\n}\n\n/** Markdown text content renderer */\nexport const Markdown: RendererComponent = (props) => {\n const content = typeof props[\"content\"] === \"string\" ? props[\"content\"] : \"\";\n return (\n <div className=\"uibot-markdown text-foreground\" data-uibot-type=\"Markdown\">\n {renderMarkdown(content)}\n </div>\n );\n};\n\nconst HEADING_SIZE: Record<number, string> = {\n 1: \"text-4xl\",\n 2: \"text-3xl\",\n 3: \"text-2xl\",\n 4: \"text-xl\",\n 5: \"text-lg\",\n 6: \"text-base\",\n};\n\n/** Section heading (h1–h6) */\nexport const Heading: RendererComponent = (props) => {\n const lvl = typeof props[\"level\"] === \"number\" ? Math.min(6, Math.max(1, props[\"level\"])) : 2;\n const size = HEADING_SIZE[lvl] ?? \"text-3xl\";\n const weight = lvl <= 2 ? \"font-bold\" : \"font-semibold\";\n const text = typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\";\n const muted = props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\";\n const cls = cn(\n \"uibot-heading tracking-tight leading-tight\",\n size,\n weight,\n muted,\n typeof props.className === \"string\" ? props.className : \"\",\n );\n const Tag = `h${lvl}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n return (\n <Tag className={cls} data-uibot-type=\"Heading\">\n {text}\n </Tag>\n );\n};\n\n/** Body paragraph text */\nexport const Paragraph: RendererComponent = (props) => (\n <p\n className={cn(\n \"uibot-paragraph leading-relaxed\",\n props[\"size\"] === \"sm\" ? \"text-sm\" : props[\"size\"] === \"lg\" ? \"text-lg\" : \"text-sm\",\n props[\"muted\"] === true ? \"text-muted-foreground\" : \"text-foreground\",\n typeof props.className === \"string\" ? props.className : \"\",\n )}\n data-uibot-type=\"Paragraph\"\n >\n {typeof props[\"text\"] === \"string\" ? props[\"text\"] : \"\"}\n </p>\n);\n",
|
|
17
17
|
"type": "registry:ui"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
"path": "components/uibot/data.uibot.json",
|
|
21
21
|
"target": "components/uibot/data.uibot.json",
|
|
22
|
-
"content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"data\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Heading\",\n \"export\": \"Heading\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Heading\",\n \"description\": \"Semantic heading tag h1–h6 with size automatically mapped to the level.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"heading\",\n \"typography\"\n ],\n \"props\": {\n \"text\": {\n \"type\": \"string\"\n },\n \"level\": {\n \"type\": \"integer\",\n \"default\": 2,\n \"description\": \"1=largest, 6=smallest\"\n },\n \"muted\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Render in muted-foreground\"\n }\n },\n \"usageScenarios\": [\n \"Section title above a Table or Card\",\n \"Hero headline on a landing page\"\n ],\n \"constraints\": [\n \"Use only one h1 per page\"\n ]\n }\n },\n {\n \"name\": \"List\",\n \"export\": \"List\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"List\",\n \"description\": \"Unordered list of child blocks. Use with divided or compact for different visual densities.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"list\"\n ],\n \"props\": {\n \"divided\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Add hairline dividers between items\"\n },\n \"compact\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"label\": {\n \"type\": \"string\",\n \"description\": \"ARIA label\"\n }\n },\n \"usageScenarios\": [\n \"Recent activity feed\",\n \"Search result list\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Markdown\",\n \"export\": \"Markdown\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Markdown\",\n \"description\": \"Renders Markdown source into HTML. Supports # headings, **bold**, *italic*, `code`, and - lists.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"markdown\",\n \"content\"\n ],\n \"props\": {\n \"content\": {\n \"type\": \"string\",\n \"description\": \"Markdown source text\"\n }\n },\n \"usageScenarios\": [\n \"Documentation sections\",\n \"Feature descriptions on a landing page\",\n \"Release notes\"\n ],\n \"constraints\": [\n \"No HTML injection; only Markdown syntax is parsed\"\n ]\n }\n },\n {\n \"name\": \"Paragraph\",\n \"export\": \"Paragraph\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Paragraph\",\n \"description\": \"Body text block. Use size='lg' for lead copy, size='sm' for captions.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"typography\"\n ],\n \"props\": {\n \"text\": {\n \"type\": \"string\"\n },\n \"size\": {\n \"type\": \"string\",\n \"enum\": [\n \"sm\",\n \"md\",\n \"lg\"\n ],\n \"default\": \"md\"\n },\n \"muted\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"usageScenarios\": [\n \"Feature description below a Heading\",\n \"Helper caption below a form field\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Stat\",\n \"export\": \"Stat\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Stat\",\n \"description\": \"KPI metric card: large value, label, optional trend arrow, and change string.\",\n \"category\": \"primitive\",\n \"level\": \"L2\",\n \"tags\": [\n \"stat\",\n \"kpi\",\n \"metric\"\n ],\n \"props\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Main metric value, e.g. 1,234 or $12k\"\n },\n \"change\": {\n \"type\": \"string\",\n \"description\": \"Change label, e.g. \\\"+12% vs last month\\\"\"\n },\n \"trend\": {\n \"type\": \"string\",\n \"enum\": [\n \"up\",\n \"down\"\n ]\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Secondary helper text\"\n }\n },\n \"usageScenarios\": [\n \"Dashboard KPI row (4 Stat blocks side-by-side in a Box[direction=row])\",\n \"Single revenue metric in a Card\"\n ],\n \"constraints\": [\n \"Do not put detailed charts inside a Stat; use Stat only for a single number + context\"\n ]\n }\n },\n {\n \"name\": \"Table\",\n \"export\": \"Table\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Table\",\n \"description\": \"Data grid with typed columns and row data. Columns define keys and display labels.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"table\",\n \"grid\",\n \"data\"\n ],\n \"props\": {\n \"columns\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"key\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"align\": {\n \"type\": \"string\",\n \"enum\": [\n \"left\",\n \"center\",\n \"right\"\n ]\n }\n }\n },\n \"description\": \"[{key, label, align?}]\"\n },\n \"rows\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n },\n \"description\": \"Array of data objects keyed to column.key\"\n },\n \"emptyText\": {\n \"type\": \"string\",\n \"default\": \"No data\"\n },\n \"striped\": {\n \"type\": \"boolean\",\n \"default\": true\n },\n \"caption\": {\n \"type\": \"string\"\n }\n },\n \"usageScenarios\": [\n \"User management list\",\n \"Order history table\",\n \"API endpoint catalog\"\n ],\n \"constraints\": [\n \"rows entries must have keys matching column.key; missing keys render empty string\",\n \"Avoid more than 8 columns\"\n ]\n }\n }\n ]\n}\n",
|
|
22
|
+
"content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"data\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Heading\",\n \"export\": \"Heading\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Heading\",\n \"description\": \"Semantic heading tag h1–h6 with size automatically mapped to the level.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"heading\",\n \"typography\"\n ],\n \"props\": {\n \"className\": {\n \"type\": \"string\",\n \"description\": \"Additional Tailwind utility classes\"\n },\n \"text\": {\n \"type\": \"string\"\n },\n \"level\": {\n \"type\": \"integer\",\n \"default\": 2,\n \"description\": \"1=largest, 6=smallest\"\n },\n \"muted\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Render in muted-foreground\"\n }\n },\n \"usageScenarios\": [\n \"Section title above a Table or Card\",\n \"Hero headline on a landing page\"\n ],\n \"constraints\": [\n \"Use only one h1 per page\"\n ]\n }\n },\n {\n \"name\": \"List\",\n \"export\": \"List\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"List\",\n \"description\": \"Unordered list of child blocks. Use with divided or compact for different visual densities.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"list\"\n ],\n \"props\": {\n \"divided\": {\n \"type\": \"boolean\",\n \"default\": false,\n \"description\": \"Add hairline dividers between items\"\n },\n \"compact\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"label\": {\n \"type\": \"string\",\n \"description\": \"ARIA label\"\n }\n },\n \"usageScenarios\": [\n \"Recent activity feed\",\n \"Search result list\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Markdown\",\n \"export\": \"Markdown\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Markdown\",\n \"description\": \"Renders Markdown source into HTML. Supports # headings, **bold**, *italic*, `code`, and - lists.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"markdown\",\n \"content\"\n ],\n \"props\": {\n \"content\": {\n \"type\": \"string\",\n \"description\": \"Markdown source text\"\n }\n },\n \"usageScenarios\": [\n \"Documentation sections\",\n \"Feature descriptions on a landing page\",\n \"Release notes\"\n ],\n \"constraints\": [\n \"No HTML injection; only Markdown syntax is parsed\"\n ]\n }\n },\n {\n \"name\": \"Paragraph\",\n \"export\": \"Paragraph\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Paragraph\",\n \"description\": \"Body text block. Use size='lg' for lead copy, size='sm' for captions.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"text\",\n \"typography\"\n ],\n \"props\": {\n \"className\": {\n \"type\": \"string\",\n \"description\": \"Additional Tailwind utility classes\"\n },\n \"text\": {\n \"type\": \"string\"\n },\n \"size\": {\n \"type\": \"string\",\n \"enum\": [\n \"sm\",\n \"md\",\n \"lg\"\n ],\n \"default\": \"md\"\n },\n \"muted\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"usageScenarios\": [\n \"Feature description below a Heading\",\n \"Helper caption below a form field\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Stat\",\n \"export\": \"Stat\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Stat\",\n \"description\": \"KPI metric card: large value, label, optional trend arrow, and change string.\",\n \"category\": \"primitive\",\n \"level\": \"L2\",\n \"tags\": [\n \"stat\",\n \"kpi\",\n \"metric\"\n ],\n \"props\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Main metric value, e.g. 1,234 or $12k\"\n },\n \"change\": {\n \"type\": \"string\",\n \"description\": \"Change label, e.g. \\\"+12% vs last month\\\"\"\n },\n \"trend\": {\n \"type\": \"string\",\n \"enum\": [\n \"up\",\n \"down\"\n ]\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Secondary helper text\"\n }\n },\n \"usageScenarios\": [\n \"Dashboard KPI row (4 Stat blocks side-by-side in a Box[direction=row])\",\n \"Single revenue metric in a Card\"\n ],\n \"constraints\": [\n \"Do not put detailed charts inside a Stat; use Stat only for a single number + context\"\n ]\n }\n },\n {\n \"name\": \"Table\",\n \"export\": \"Table\",\n \"module\": \"data.tsx\",\n \"catalog\": {\n \"name\": \"Table\",\n \"description\": \"Data grid with typed columns and row data. Columns define keys and display labels.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"table\",\n \"grid\",\n \"data\"\n ],\n \"props\": {\n \"columns\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"key\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"align\": {\n \"type\": \"string\",\n \"enum\": [\n \"left\",\n \"center\",\n \"right\"\n ]\n }\n }\n },\n \"description\": \"[{key, label, align?}]\"\n },\n \"rows\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\"\n },\n \"description\": \"Array of data objects keyed to column.key\"\n },\n \"emptyText\": {\n \"type\": \"string\",\n \"default\": \"No data\"\n },\n \"striped\": {\n \"type\": \"boolean\",\n \"default\": true\n },\n \"caption\": {\n \"type\": \"string\"\n }\n },\n \"usageScenarios\": [\n \"User management list\",\n \"Order history table\",\n \"API endpoint catalog\"\n ],\n \"constraints\": [\n \"rows entries must have keys matching column.key; missing keys render empty string\",\n \"Avoid more than 8 columns\"\n ]\n }\n }\n ]\n}\n",
|
|
23
23
|
"type": "registry:ui"
|
|
24
24
|
}
|
|
25
25
|
],
|
|
@@ -74,6 +74,10 @@
|
|
|
74
74
|
"typography"
|
|
75
75
|
],
|
|
76
76
|
"props": {
|
|
77
|
+
"className": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"description": "Additional Tailwind utility classes"
|
|
80
|
+
},
|
|
77
81
|
"text": {
|
|
78
82
|
"type": "string"
|
|
79
83
|
},
|
|
@@ -175,6 +179,10 @@
|
|
|
175
179
|
"typography"
|
|
176
180
|
],
|
|
177
181
|
"props": {
|
|
182
|
+
"className": {
|
|
183
|
+
"type": "string",
|
|
184
|
+
"description": "Additional Tailwind utility classes"
|
|
185
|
+
},
|
|
178
186
|
"text": {
|
|
179
187
|
"type": "string"
|
|
180
188
|
},
|
|
@@ -13,13 +13,25 @@
|
|
|
13
13
|
{
|
|
14
14
|
"path": "components/uibot/feedback.tsx",
|
|
15
15
|
"target": "components/uibot/feedback.tsx",
|
|
16
|
-
"content": "import { useCallback, useEffect, useId, useState, useSyncExternalStore } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\n\nconst BTN_BASE =\n \"uibot-button inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\";\n\nconst BTN_VARIANTS: Record<string, string> = {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-white shadow hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-muted text-foreground shadow-sm hover:bg-muted/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n};\n\nconst BTN_SIZES: Record<string, string> = {\n xs: \"h-6 px-2 text-xs rounded\",\n sm: \"h-8 px-3\",\n default: \"h-9 px-4 py-2\",\n lg: \"h-10 px-6 text-base\",\n icon: \"size-9\",\n};\n\n/** Action button */\nexport const Button: RendererComponent = (props, ctx) => {\n const variant = typeof props[\"variant\"] === \"string\" ? props[\"variant\"] : \"default\";\n const size = typeof props[\"size\"] === \"string\" ? props[\"size\"] : \"default\";\n const full = props[\"full\"] === true ? \"w-full\" : \"\";\n const children = ctx.children as ReactNode[];\n type ActionChain = Parameters<NonNullable<typeof ctx.dispatch>>[0];\n const onClick =\n (ctx.element as { events?: Record<string, ActionChain> }).events?.[\"onClick\"] ?? [];\n\n return (\n <button\n type={props[\"type\"] === \"submit\" ? \"submit\" : \"button\"}\n disabled={props[\"disabled\"] === true}\n aria-label={typeof props[\"ariaLabel\"] === \"string\" ? props[\"ariaLabel\"] : undefined}\n className={cn(\n BTN_BASE,\n BTN_VARIANTS[variant] ?? BTN_VARIANTS[\"default\"]!,\n BTN_SIZES[size] ?? BTN_SIZES[\"default\"]!,\n full,\n )}\n data-uibot-type=\"Button\"\n data-variant={variant}\n onClick={\n onClick.length > 0\n ? (event) =>\n void ctx.dispatch?.(onClick, {\n event: {\n type: \"click\",\n ...(event.currentTarget.name ? { name: event.currentTarget.name } : {}),\n },\n })\n : undefined\n }\n >\n {children.length > 0 ? children : typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"\"}\n </button>\n );\n};\n\nconst TOAST_VARIANTS: Record<string, { bar: string; icon: string; label: string }> = {\n info: { bar: \"bg-blue-500\", icon: \"ℹ\", label: \"Info\" },\n success: { bar: \"bg-green-500\", icon: \"✓\", label: \"Success\" },\n warning: { bar: \"bg-yellow-500\", icon: \"⚠\", label: \"Warning\" },\n error: { bar: \"bg-destructive\", icon: \"✕\", label: \"Error\" },\n};\n\n/** Floating toasts share the top-right corner; each takes the next slot below the previous one. */\nconst floatingToasts = { ids: [] as string[], listeners: new Set<() => void>() };\n\nfunction notifyFloatingToasts() {\n for (const listener of floatingToasts.listeners) listener();\n}\n\nfunction useFloatingSlot(id: string, active: boolean): number {\n useEffect(() => {\n if (!active) return;\n floatingToasts.ids.push(id);\n notifyFloatingToasts();\n return () => {\n floatingToasts.ids = floatingToasts.ids.filter((candidate) => candidate !== id);\n notifyFloatingToasts();\n };\n }, [id, active]);\n const subscribe = useCallback((listener: () => void) => {\n floatingToasts.listeners.add(listener);\n return () => {\n floatingToasts.listeners.delete(listener);\n };\n }, []);\n return useSyncExternalStore(\n subscribe,\n () => Math.max(0, floatingToasts.ids.indexOf(id)),\n () => 0,\n );\n}\n\n/** Slot height for stacked floating toasts: a short notice (title plus up to two lines). */\nconst FLOATING_SLOT_REM = 5.5;\n\nfunction ToastView({ props }: { props: Record<string, unknown> }) {\n const level = typeof props[\"level\"] === \"string\" ? props[\"level\"] : \"info\";\n const v = TOAST_VARIANTS[level] ?? TOAST_VARIANTS[\"info\"]!;\n const title = typeof props[\"title\"] === \"string\" ? props[\"title\"] : v.label;\n const message = typeof props[\"message\"] === \"string\" ? props[\"message\"] : \"\";\n const closeable = props[\"closeable\"] !== false;\n const floating = props[\"placement\"] === \"top-right\";\n const duration =\n typeof props[\"duration\"] === \"number\" && props[\"duration\"] > 0 ? props[\"duration\"] : 0;\n const [open, setOpen] = useState(true);\n const id = useId();\n const slot = useFloatingSlot(id, floating && open);\n\n useEffect(() => {\n if (!open || duration === 0) return;\n const timer = setTimeout(() => setOpen(false), duration);\n return () => clearTimeout(timer);\n }, [open, duration]);\n\n if (!open) return null;\n return (\n <div\n role={floating && level !== \"error\" ? \"status\" : \"alert\"}\n aria-live={floating && level === \"error\" ? \"assertive\" : \"polite\"}\n className={cn(\n \"uibot-toast flex items-start gap-3 overflow-hidden rounded-lg border bg-background p-4\",\n floating\n ? \"uibot-toast-floating fixed right-4 z-50 w-[min(24rem,calc(100vw-2rem))] shadow-lg\"\n : \"relative shadow-sm\",\n )}\n style={floating ? { top: `${1 + slot * FLOATING_SLOT_REM}rem` } : undefined}\n data-uibot-type=\"Toast\"\n data-placement={floating ? \"top-right\" : \"inline\"}\n >\n <div className={cn(\"absolute left-0 top-0 h-full w-1\", v.bar)} aria-hidden=\"true\" />\n <span className=\"mt-0.5 shrink-0 text-sm leading-none\" aria-hidden=\"true\">\n {v.icon}\n </span>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <p className=\"text-sm font-semibold\">{title}</p>\n {message && (\n <p className={cn(\"text-sm text-muted-foreground\", floating && \"line-clamp-2\")}>\n {message}\n </p>\n )}\n </div>\n {closeable && (\n <button\n type=\"button\"\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\"\n aria-label=\"Dismiss\"\n onClick={() => setOpen(false)}\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"2\" y1=\"2\" x2=\"12\" y2=\"12\" />\n <line x1=\"12\" y1=\"2\" x2=\"2\" y2=\"12\" />\n </svg>\n </button>\n )}\n </div>\n );\n}\n\n/**\n * Alert banner. `placement: \"top-right\"` makes it a floating, dismissible notice (optionally\n * auto-dismissed after `duration` ms) instead of an inline banner.\n */\nexport const Toast: RendererComponent = (props) => <ToastView props={props} />;\n\n/** Confirmation dialog — rendered inline in preview */\nexport const Dialog: RendererComponent = (props, ctx) => {\n const confirmVariant =\n typeof props[\"confirmVariant\"] === \"string\" ? props[\"confirmVariant\"] : \"default\";\n\n return (\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={typeof props[\"title\"] === \"string\" ? props[\"title\"] : \"Dialog\"}\n className=\"uibot-dialog\"\n data-uibot-type=\"Dialog\"\n >\n <div className=\"bg-background text-foreground mx-auto w-full max-w-sm rounded-xl border p-6 shadow-xl\">\n {typeof props[\"title\"] === \"string\" && (\n <h2 className=\"text-lg font-semibold tracking-tight\">{props[\"title\"]}</h2>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{props[\"description\"]}</p>\n )}\n {ctx.children && (ctx.children as ReactNode[]).length > 0 && (\n <div className=\"mt-4\">{ctx.children as ReactNode[]}</div>\n )}\n {(typeof props[\"cancelLabel\"] === \"string\" ||\n typeof props[\"confirmLabel\"] === \"string\") && (\n <div className=\"mt-5 flex items-center justify-end gap-2\">\n {typeof props[\"cancelLabel\"] === \"string\" && (\n <button\n type=\"button\"\n className={cn(BTN_BASE, BTN_VARIANTS[\"outline\"]!, BTN_SIZES[\"sm\"]!)}\n >\n {props[\"cancelLabel\"]}\n </button>\n )}\n {typeof props[\"confirmLabel\"] === \"string\" && (\n <button\n type=\"button\"\n className={cn(\n BTN_BASE,\n BTN_VARIANTS[confirmVariant] ?? BTN_VARIANTS[\"default\"]!,\n BTN_SIZES[\"sm\"]!,\n )}\n >\n {props[\"confirmLabel\"]}\n </button>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n\n/** Loading skeleton placeholder */\nexport const Skeleton: RendererComponent = (props) => {\n const lines = typeof props[\"lines\"] === \"number\" ? Math.max(1, props[\"lines\"]) : 3;\n const type = typeof props[\"type\"] === \"string\" ? props[\"type\"] : \"lines\";\n\n if (type === \"card\") {\n return (\n <div\n className=\"uibot-skeleton animate-pulse rounded-xl border bg-card p-5\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n <div className=\"flex items-center gap-3\">\n <div className=\"h-10 w-10 rounded-full bg-muted\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-3.5 w-2/3 rounded bg-muted\" />\n <div className=\"h-3 w-1/2 rounded bg-muted\" />\n </div>\n </div>\n <div className=\"mt-4 space-y-2\">\n <div className=\"h-3 w-full rounded bg-muted\" />\n <div className=\"h-3 w-full rounded bg-muted\" />\n <div className=\"h-3 w-3/4 rounded bg-muted\" />\n </div>\n </div>\n );\n }\n\n if (type === \"table\") {\n return (\n <div\n className=\"uibot-skeleton animate-pulse rounded-lg border\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n <div className=\"border-b bg-muted/50 px-4 py-3\">\n <div className=\"h-3 w-1/4 rounded bg-muted\" />\n </div>\n {Array.from({ length: lines }, (_, i) => (\n <div key={i} className=\"flex gap-4 border-b px-4 py-3 last:border-0\">\n <div className=\"h-3 w-1/4 rounded bg-muted\" />\n <div className=\"h-3 w-1/3 rounded bg-muted\" />\n <div className=\"h-3 w-1/5 rounded bg-muted\" />\n </div>\n ))}\n </div>\n );\n }\n\n return (\n <div\n className=\"uibot-skeleton animate-pulse space-y-2.5\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n {Array.from({ length: lines }, (_, i) => (\n <div\n key={i}\n className={cn(\n \"h-3.5 rounded-md bg-muted\",\n i === lines - 1 ? \"w-3/4\" : i % 3 === 1 ? \"w-5/6\" : \"w-full\",\n )}\n />\n ))}\n </div>\n );\n};\n",
|
|
16
|
+
"content": "import { useCallback, useEffect, useId, useState, useSyncExternalStore } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport { emit } from \"./interaction\";\nimport { LiveConfirmationDialog } from \"./overlay\";\n\nconst BTN_BASE =\n \"uibot-button inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50\";\n\nconst BTN_VARIANTS: Record<string, string> = {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-white shadow hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-muted text-foreground shadow-sm hover:bg-muted/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n};\n\nconst BTN_SIZES: Record<string, string> = {\n xs: \"h-6 px-2 text-xs rounded\",\n sm: \"h-8 px-3\",\n default: \"h-9 px-4 py-2\",\n lg: \"h-10 px-6 text-base\",\n icon: \"size-9\",\n};\n\n/** Action button */\nexport const Button: RendererComponent = (props, ctx) => {\n const variant = typeof props[\"variant\"] === \"string\" ? props[\"variant\"] : \"default\";\n const size = typeof props[\"size\"] === \"string\" ? props[\"size\"] : \"default\";\n const full = props[\"full\"] === true ? \"w-full\" : \"\";\n const children = ctx.children as ReactNode[];\n type ActionChain = Parameters<NonNullable<typeof ctx.dispatch>>[0];\n const onClick =\n (ctx.element as { events?: Record<string, ActionChain> }).events?.[\"onClick\"] ?? [];\n\n return (\n <button\n type={props[\"type\"] === \"submit\" ? \"submit\" : \"button\"}\n disabled={props[\"disabled\"] === true}\n aria-label={typeof props[\"ariaLabel\"] === \"string\" ? props[\"ariaLabel\"] : undefined}\n className={cn(\n BTN_BASE,\n BTN_VARIANTS[variant] ?? BTN_VARIANTS[\"default\"]!,\n BTN_SIZES[size] ?? BTN_SIZES[\"default\"]!,\n full,\n )}\n data-uibot-type=\"Button\"\n data-variant={variant}\n onClick={\n onClick.length > 0\n ? (event) =>\n void ctx.dispatch?.(onClick, {\n event: {\n type: \"click\",\n ...(event.currentTarget.name ? { name: event.currentTarget.name } : {}),\n },\n })\n : undefined\n }\n >\n {children.length > 0 ? children : typeof props[\"label\"] === \"string\" ? props[\"label\"] : \"\"}\n </button>\n );\n};\n\nconst TOAST_VARIANTS: Record<string, { bar: string; icon: string; label: string }> = {\n info: { bar: \"bg-blue-500\", icon: \"ℹ\", label: \"Info\" },\n success: { bar: \"bg-green-500\", icon: \"✓\", label: \"Success\" },\n warning: { bar: \"bg-yellow-500\", icon: \"⚠\", label: \"Warning\" },\n error: { bar: \"bg-destructive\", icon: \"✕\", label: \"Error\" },\n};\n\n/** Floating toasts share the top-right corner; each takes the next slot below the previous one. */\nconst floatingToasts = { ids: [] as string[], listeners: new Set<() => void>() };\n\nfunction notifyFloatingToasts() {\n for (const listener of floatingToasts.listeners) listener();\n}\n\nfunction useFloatingSlot(id: string, active: boolean): number {\n useEffect(() => {\n if (!active) return;\n floatingToasts.ids.push(id);\n notifyFloatingToasts();\n return () => {\n floatingToasts.ids = floatingToasts.ids.filter((candidate) => candidate !== id);\n notifyFloatingToasts();\n };\n }, [id, active]);\n const subscribe = useCallback((listener: () => void) => {\n floatingToasts.listeners.add(listener);\n return () => {\n floatingToasts.listeners.delete(listener);\n };\n }, []);\n return useSyncExternalStore(\n subscribe,\n () => Math.max(0, floatingToasts.ids.indexOf(id)),\n () => 0,\n );\n}\n\n/** Slot height for stacked floating toasts: a short notice (title plus up to two lines). */\nconst FLOATING_SLOT_REM = 5.5;\n\nfunction ToastView({ props }: { props: Record<string, unknown> }) {\n const level = typeof props[\"level\"] === \"string\" ? props[\"level\"] : \"info\";\n const v = TOAST_VARIANTS[level] ?? TOAST_VARIANTS[\"info\"]!;\n const title = typeof props[\"title\"] === \"string\" ? props[\"title\"] : v.label;\n const message = typeof props[\"message\"] === \"string\" ? props[\"message\"] : \"\";\n const closeable = props[\"closeable\"] !== false;\n const floating = props[\"placement\"] === \"top-right\";\n const duration =\n typeof props[\"duration\"] === \"number\" && props[\"duration\"] > 0 ? props[\"duration\"] : 0;\n const [open, setOpen] = useState(true);\n const id = useId();\n const slot = useFloatingSlot(id, floating && open);\n\n useEffect(() => {\n if (!open || duration === 0) return;\n const timer = setTimeout(() => setOpen(false), duration);\n return () => clearTimeout(timer);\n }, [open, duration]);\n\n if (!open) return null;\n return (\n <div\n role={floating && level !== \"error\" ? \"status\" : \"alert\"}\n aria-live={floating && level === \"error\" ? \"assertive\" : \"polite\"}\n className={cn(\n \"uibot-toast flex items-start gap-3 overflow-hidden rounded-lg border bg-background p-4\",\n floating\n ? \"uibot-toast-floating fixed right-4 z-50 w-[min(24rem,calc(100vw-2rem))] shadow-lg\"\n : \"relative shadow-sm\",\n )}\n style={floating ? { top: `${1 + slot * FLOATING_SLOT_REM}rem` } : undefined}\n data-uibot-type=\"Toast\"\n data-placement={floating ? \"top-right\" : \"inline\"}\n >\n <div className={cn(\"absolute left-0 top-0 h-full w-1\", v.bar)} aria-hidden=\"true\" />\n <span className=\"mt-0.5 shrink-0 text-sm leading-none\" aria-hidden=\"true\">\n {v.icon}\n </span>\n <div className=\"min-w-0 flex-1 space-y-1\">\n <p className=\"text-sm font-semibold\">{title}</p>\n {message && (\n <p className={cn(\"text-sm text-muted-foreground\", floating && \"line-clamp-2\")}>\n {message}\n </p>\n )}\n </div>\n {closeable && (\n <button\n type=\"button\"\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50\"\n aria-label=\"Dismiss\"\n onClick={() => setOpen(false)}\n >\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 14 14\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n aria-hidden=\"true\"\n >\n <line x1=\"2\" y1=\"2\" x2=\"12\" y2=\"12\" />\n <line x1=\"12\" y1=\"2\" x2=\"2\" y2=\"12\" />\n </svg>\n </button>\n )}\n </div>\n );\n}\n\n/**\n * Alert banner. `placement: \"top-right\"` makes it a floating, dismissible notice (optionally\n * auto-dismissed after `duration` ms) instead of an inline banner.\n */\nexport const Toast: RendererComponent = (props) => <ToastView props={props} />;\n\n/** Controlled confirmation intent; omitted open retains the inline composition. */\nexport const Dialog: RendererComponent = (props, ctx) => {\n const confirmVariant =\n typeof props[\"confirmVariant\"] === \"string\" ? props[\"confirmVariant\"] : \"default\";\n\n const pending = props[\"pending\"] === true;\n const actions = (\n <div key=\"dialog-actions\" className=\"flex items-center justify-end gap-2\">\n {typeof props[\"cancelLabel\"] === \"string\" && (\n <button\n type=\"button\"\n disabled={pending}\n className={cn(BTN_BASE, BTN_VARIANTS[\"outline\"]!, BTN_SIZES[\"sm\"]!)}\n onClick={() => {\n if (!pending) emit(ctx, \"onCancel\", { action: \"cancel\" }, \"cancel\");\n }}\n >\n {props[\"cancelLabel\"]}\n </button>\n )}\n {typeof props[\"confirmLabel\"] === \"string\" && (\n <button\n type=\"button\"\n disabled={pending}\n className={cn(\n BTN_BASE,\n BTN_VARIANTS[confirmVariant] ?? BTN_VARIANTS[\"default\"]!,\n BTN_SIZES[\"sm\"]!,\n )}\n onClick={() => {\n if (!pending) emit(ctx, \"onConfirm\", { action: \"confirm\" }, \"confirm\");\n }}\n >\n {props[\"confirmLabel\"]}\n </button>\n )}\n </div>\n );\n const hasActions =\n typeof props[\"cancelLabel\"] === \"string\" || typeof props[\"confirmLabel\"] === \"string\";\n if (typeof props[\"open\"] === \"boolean\")\n return LiveConfirmationDialog(props, {\n ...ctx,\n slots: { ...ctx.slots, ...(hasActions ? { footer: [actions] } : {}) },\n });\n return (\n <div\n role=\"group\"\n aria-busy={pending || undefined}\n aria-label={typeof props[\"title\"] === \"string\" ? props[\"title\"] : \"Dialog\"}\n className=\"uibot-dialog\"\n data-uibot-type=\"Dialog\"\n >\n <div className=\"bg-background text-foreground mx-auto w-full max-w-sm rounded-xl border p-6 shadow-xl\">\n {typeof props[\"title\"] === \"string\" && (\n <h2 className=\"text-lg font-semibold tracking-tight\">{props[\"title\"]}</h2>\n )}\n {typeof props[\"description\"] === \"string\" && (\n <p className=\"mt-2 text-sm text-muted-foreground\">{props[\"description\"]}</p>\n )}\n {ctx.children && (ctx.children as ReactNode[]).length > 0 && (\n <div className=\"mt-4\">{ctx.children as ReactNode[]}</div>\n )}\n {hasActions && <div className=\"mt-5\">{actions}</div>}\n </div>\n </div>\n );\n};\n\n/** Loading skeleton placeholder */\nexport const Skeleton: RendererComponent = (props) => {\n const lines = typeof props[\"lines\"] === \"number\" ? Math.max(1, props[\"lines\"]) : 3;\n const type = typeof props[\"type\"] === \"string\" ? props[\"type\"] : \"lines\";\n\n if (type === \"card\") {\n return (\n <div\n className=\"uibot-skeleton animate-pulse rounded-xl border bg-card p-5\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n <div className=\"flex items-center gap-3\">\n <div className=\"h-10 w-10 rounded-full bg-muted\" />\n <div className=\"flex-1 space-y-2\">\n <div className=\"h-3.5 w-2/3 rounded bg-muted\" />\n <div className=\"h-3 w-1/2 rounded bg-muted\" />\n </div>\n </div>\n <div className=\"mt-4 space-y-2\">\n <div className=\"h-3 w-full rounded bg-muted\" />\n <div className=\"h-3 w-full rounded bg-muted\" />\n <div className=\"h-3 w-3/4 rounded bg-muted\" />\n </div>\n </div>\n );\n }\n\n if (type === \"table\") {\n return (\n <div\n className=\"uibot-skeleton animate-pulse rounded-lg border\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n <div className=\"border-b bg-muted/50 px-4 py-3\">\n <div className=\"h-3 w-1/4 rounded bg-muted\" />\n </div>\n {Array.from({ length: lines }, (_, i) => (\n <div key={i} className=\"flex gap-4 border-b px-4 py-3 last:border-0\">\n <div className=\"h-3 w-1/4 rounded bg-muted\" />\n <div className=\"h-3 w-1/3 rounded bg-muted\" />\n <div className=\"h-3 w-1/5 rounded bg-muted\" />\n </div>\n ))}\n </div>\n );\n }\n\n return (\n <div\n className=\"uibot-skeleton animate-pulse space-y-2.5\"\n data-uibot-type=\"Skeleton\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n >\n {Array.from({ length: lines }, (_, i) => (\n <div\n key={i}\n className={cn(\n \"h-3.5 rounded-md bg-muted\",\n i === lines - 1 ? \"w-3/4\" : i % 3 === 1 ? \"w-5/6\" : \"w-full\",\n )}\n />\n ))}\n </div>\n );\n};\n",
|
|
17
|
+
"type": "registry:ui"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"path": "components/uibot/interaction.ts",
|
|
21
|
+
"target": "components/uibot/interaction.ts",
|
|
22
|
+
"content": "import type { RendererComponent } from \"@/lib/uibot-renderer\";\nexport type BlockContext = Parameters<RendererComponent>[1];\nexport type Chain = Parameters<NonNullable<BlockContext[\"dispatch\"]>>[0];\nexport type EventValue = string | number | boolean | null;\nexport function emit(\n ctx: BlockContext,\n name: string,\n values: Record<string, EventValue | EventValue[]> = {},\n value?: EventValue,\n): void {\n const element = ctx.element as { events?: Record<string, Chain> };\n const chain = element.events?.[name];\n if (chain?.length)\n void ctx.dispatch?.(chain, {\n event: { type: name, values, ...(value !== undefined ? { value } : {}) },\n });\n}\nexport function text(value: unknown, fallback = \"\"): string {\n return value == null ? fallback : String(value);\n}\nexport function records(value: unknown): Record<string, unknown>[] {\n return Array.isArray(value)\n ? value.filter(\n (v): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v),\n )\n : [];\n}\n\nconst submissions = new WeakMap<object, { payload: string; key: string }>();\n/** A new owner represents a new user intent; an unchanged failed submission keeps its key. */\nexport function submissionKey(owner: object, values: unknown): string {\n const payload = JSON.stringify(values);\n const previous = submissions.get(owner);\n if (previous?.payload === payload) return previous.key;\n const key = crypto.randomUUID();\n submissions.set(owner, { payload, key });\n return key;\n}\n",
|
|
23
|
+
"type": "registry:ui"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"path": "components/uibot/overlay.tsx",
|
|
27
|
+
"target": "components/uibot/overlay.tsx",
|
|
28
|
+
"content": "import { useEffect, useId, useRef, type ReactNode } from \"react\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport { emit, text, type BlockContext } from \"./interaction\";\n\nfunction useNativeDialogLifecycle(\n ref: { current: HTMLDialogElement | null },\n open: boolean,\n triggerRef?: { current: HTMLElement | null },\n) {\n useEffect(() => {\n const dialog = ref.current;\n if (!dialog || !open) return;\n const trigger = triggerRef\n ? triggerRef.current\n : document.activeElement instanceof HTMLElement\n ? document.activeElement\n : null;\n dialog.showModal();\n return () => {\n if (dialog.open) dialog.close();\n if (trigger?.isConnected) trigger.focus();\n };\n }, [open, ref, triggerRef]);\n}\n\nfunction Overlay({\n props,\n ctx,\n drawer,\n blockType,\n}: {\n props: Record<string, unknown>;\n ctx: BlockContext;\n drawer: boolean;\n blockType?: \"Dialog\";\n}) {\n const ref = useRef<HTMLDialogElement>(null);\n const titleId = useId(),\n descriptionId = useId();\n const open = props.open === true;\n const close = () => emit(ctx, \"onClose\", { open: false }, false);\n useNativeDialogLifecycle(ref, open);\n if (!open) return null;\n return (\n <dialog\n ref={ref}\n aria-labelledby={titleId}\n aria-describedby={props.description ? descriptionId : undefined}\n aria-busy={props.pending === true || undefined}\n data-uibot-type={blockType ?? (drawer ? \"Drawer\" : \"Modal\")}\n className={`uibot-overlay bg-background text-foreground p-0 shadow-xl backdrop:bg-black/50 ${drawer ? \"fixed inset-y-0 start-auto end-0 m-0 h-dvh max-h-dvh w-full max-w-md border-s\" : \"m-auto w-[calc(100%-2rem)] max-w-lg rounded-xl border\"}`}\n onCancel={(e) => {\n e.preventDefault();\n if (props.pending !== true) close();\n }}\n onClick={(e) => {\n if (e.target === e.currentTarget && props.pending !== true) {\n const r = e.currentTarget.getBoundingClientRect();\n if (\n e.clientX < r.left ||\n e.clientX > r.right ||\n e.clientY < r.top ||\n e.clientY > r.bottom\n )\n close();\n }\n }}\n >\n <div className=\"flex h-full max-h-dvh flex-col\">\n <header className=\"flex items-start justify-between gap-4 border-b p-6\">\n <div>\n <h2 id={titleId} className=\"text-lg font-semibold\">\n {text(props.title, drawer ? \"Edit record\" : \"Confirm\")}\n </h2>\n {Boolean(props.description) && (\n <p id={descriptionId} className=\"mt-1 text-sm text-muted-foreground\">\n {text(props.description)}\n </p>\n )}\n </div>\n <button\n type=\"button\"\n disabled={props.pending === true}\n className=\"rounded px-2 py-1 text-sm hover:bg-muted focus-visible:ring-2\"\n aria-label=\"Close dialog\"\n onClick={close}\n >\n Close\n </button>\n </header>\n <div className=\"min-h-0 flex-1 overflow-auto p-6\">{ctx.children as ReactNode[]}</div>\n {ctx.slots.footer && (\n <footer className=\"flex justify-end gap-2 border-t p-6\">\n {ctx.slots.footer as ReactNode[]}\n </footer>\n )}\n </div>\n </dialog>\n );\n}\nexport const LiveDrawer: RendererComponent = (props, ctx) => (\n <Overlay props={props} ctx={ctx} drawer />\n);\nexport const LiveModal: RendererComponent = (props, ctx) => (\n <Overlay props={props} ctx={ctx} drawer={false} />\n);\nexport const LiveConfirmationDialog: RendererComponent = (props, ctx) => (\n <Overlay props={props} ctx={ctx} drawer={false} blockType=\"Dialog\" />\n);\n\n/** Internal mobile navigation drawer shared by renderer blocks, not a Spec component. */\nexport function SidebarDrawer({\n id,\n open,\n onClose,\n triggerRef,\n children,\n}: {\n id: string;\n open: boolean;\n onClose: () => void;\n triggerRef: { current: HTMLButtonElement | null };\n children: ReactNode;\n}) {\n const ref = useRef<HTMLDialogElement>(null);\n useNativeDialogLifecycle(ref, open, triggerRef);\n\n if (!open) return null;\n return (\n <dialog\n id={id}\n ref={ref}\n aria-label=\"Navigation\"\n className=\"fixed inset-y-0 start-0 z-50 m-0 h-dvh max-h-dvh w-72 max-w-[85vw] border-r bg-background p-0 text-foreground shadow-xl backdrop:bg-black/50\"\n onCancel={(event) => {\n event.preventDefault();\n onClose();\n }}\n onClick={(event) => {\n if (event.target === event.currentTarget) {\n const bounds = event.currentTarget.getBoundingClientRect();\n if (\n event.clientX < bounds.left ||\n event.clientX > bounds.right ||\n event.clientY < bounds.top ||\n event.clientY > bounds.bottom\n )\n onClose();\n }\n if (event.target instanceof Element && event.target.closest(\"a\")) onClose();\n }}\n >\n <button\n type=\"button\"\n className=\"m-3 rounded border px-3 py-2 text-sm focus-visible:ring-2\"\n aria-label=\"Close navigation\"\n onClick={onClose}\n >\n Close\n </button>\n <div className=\"max-h-[calc(100dvh-4rem)] overflow-y-auto\">{children}</div>\n </dialog>\n );\n}\n",
|
|
17
29
|
"type": "registry:ui"
|
|
18
30
|
},
|
|
19
31
|
{
|
|
20
32
|
"path": "components/uibot/feedback.uibot.json",
|
|
21
33
|
"target": "components/uibot/feedback.uibot.json",
|
|
22
|
-
"content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"feedback\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Button\",\n \"export\": \"Button\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Button\",\n \"description\": \"Standalone action button. Six visual variants and five sizes. Does not submit forms — use Form.Submit for that.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"button\",\n \"action\"\n ],\n \"props\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"variant\": {\n \"type\": \"string\",\n \"enum\": [\n \"default\",\n \"destructive\",\n \"outline\",\n \"secondary\",\n \"ghost\",\n \"link\"\n ],\n \"default\": \"default\"\n },\n \"size\": {\n \"type\": \"string\",\n \"enum\": [\n \"xs\",\n \"sm\",\n \"default\",\n \"lg\",\n \"icon\"\n ],\n \"default\": \"default\"\n },\n \"full\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"disabled\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"events\": {\n \"onClick\": {\n \"description\": \"Runs with a plain click payload.\"\n }\n },\n \"usageScenarios\": [\n \"Primary CTA on a hero section\",\n \"Row of outline action buttons in a Card actions slot\",\n \"Ghost icon button in a toolbar\"\n ],\n \"constraints\": [\n \"Use Form.Submit, not Button[type=submit], inside a Form\",\n \"Do not place more than 3 primary (default) buttons on the same view\"\n ]\n }\n },\n {\n \"name\": \"Dialog\",\n \"export\": \"Dialog\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Dialog\",\n \"description\": \"Confirmation
|
|
34
|
+
"content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"feedback\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Button\",\n \"export\": \"Button\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Button\",\n \"description\": \"Standalone action button. Six visual variants and five sizes. Does not submit forms — use Form.Submit for that.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"button\",\n \"action\"\n ],\n \"props\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"variant\": {\n \"type\": \"string\",\n \"enum\": [\n \"default\",\n \"destructive\",\n \"outline\",\n \"secondary\",\n \"ghost\",\n \"link\"\n ],\n \"default\": \"default\"\n },\n \"size\": {\n \"type\": \"string\",\n \"enum\": [\n \"xs\",\n \"sm\",\n \"default\",\n \"lg\",\n \"icon\"\n ],\n \"default\": \"default\"\n },\n \"full\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"disabled\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"events\": {\n \"onClick\": {\n \"description\": \"Runs with a plain click payload.\"\n }\n },\n \"usageScenarios\": [\n \"Primary CTA on a hero section\",\n \"Row of outline action buttons in a Card actions slot\",\n \"Ghost icon button in a toolbar\"\n ],\n \"constraints\": [\n \"Use Form.Submit, not Button[type=submit], inside a Form\",\n \"Do not place more than 3 primary (default) buttons on the same view\"\n ]\n }\n },\n {\n \"name\": \"Dialog\",\n \"export\": \"Dialog\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Dialog\",\n \"description\": \"Confirmation with explicit action intents. Boolean open uses a native modal; omitted open keeps an inline composition.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"dialog\",\n \"modal\",\n \"confirm\"\n ],\n \"props\": {\n \"open\": {\n \"type\": \"boolean\",\n \"description\": \"Omit for inline.\"\n },\n \"pending\": {\n \"type\": \"boolean\",\n \"description\": \"Lock actions/dismissal.\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"cancelLabel\": {\n \"type\": \"string\"\n },\n \"confirmLabel\": {\n \"type\": \"string\"\n },\n \"confirmVariant\": {\n \"type\": \"string\",\n \"enum\": [\n \"default\",\n \"destructive\",\n \"outline\"\n ],\n \"default\": \"default\"\n }\n },\n \"events\": {\n \"onConfirm\": {\n \"description\": \"value=values.action=confirm.\"\n },\n \"onCancel\": {\n \"description\": \"value=values.action=cancel.\"\n },\n \"onClose\": {\n \"description\": \"Dismiss: value=values.open=false.\"\n }\n },\n \"usageScenarios\": [\n \"Delete confirmation prompt\",\n \"Unsaved changes warning before navigation\"\n ],\n \"constraints\": [\n \"Host owns open/pending and persistence; no automatic close/write/retry.\"\n ]\n }\n },\n {\n \"name\": \"Skeleton\",\n \"export\": \"Skeleton\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Skeleton\",\n \"description\": \"Animated loading placeholder. Three presets: lines (text), card (avatar + lines), table (header + rows).\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"skeleton\",\n \"loading\",\n \"placeholder\"\n ],\n \"props\": {\n \"lines\": {\n \"type\": \"integer\",\n \"default\": 3,\n \"description\": \"Number of skeleton rows (for lines and table types)\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"lines\",\n \"card\",\n \"table\"\n ],\n \"default\": \"lines\"\n }\n },\n \"usageScenarios\": [\n \"Loading state while fetching table data\",\n \"Card placeholder during profile load\"\n ],\n \"constraints\": [\n \"Replace with real content once data loads; do not keep Skeleton visible indefinitely\"\n ]\n }\n },\n {\n \"name\": \"Toast\",\n \"export\": \"Toast\",\n \"module\": \"feedback.tsx\",\n \"catalog\": {\n \"name\": \"Toast\",\n \"description\": \"Alert banner (info, success, warning, error); placement top-right floats it as a dismissible corner notice.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"toast\",\n \"alert\",\n \"notification\"\n ],\n \"props\": {\n \"message\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"level\": {\n \"type\": \"string\",\n \"enum\": [\n \"info\",\n \"success\",\n \"warning\",\n \"error\"\n ],\n \"default\": \"info\"\n },\n \"closeable\": {\n \"type\": \"boolean\",\n \"default\": true\n },\n \"placement\": {\n \"type\": \"string\",\n \"enum\": [\n \"inline\",\n \"top-right\"\n ],\n \"default\": \"inline\"\n },\n \"duration\": {\n \"type\": \"number\",\n \"description\": \"Auto-dismiss after ms\"\n }\n },\n \"usageScenarios\": [\n \"Success message after form submit\",\n \"Sample-data notice (top-right)\"\n ],\n \"constraints\": [\n \"Keep floating notices to a title and one or two short lines\"\n ]\n }\n }\n ]\n}\n",
|
|
23
35
|
"type": "registry:ui"
|
|
24
36
|
}
|
|
25
37
|
],
|
|
@@ -158,7 +170,7 @@
|
|
|
158
170
|
"module": "feedback.tsx",
|
|
159
171
|
"catalog": {
|
|
160
172
|
"name": "Dialog",
|
|
161
|
-
"description": "Confirmation
|
|
173
|
+
"description": "Confirmation with explicit action intents. Boolean open uses a native modal; omitted open keeps an inline composition.",
|
|
162
174
|
"category": "composite",
|
|
163
175
|
"level": "L2",
|
|
164
176
|
"tags": [
|
|
@@ -167,6 +179,14 @@
|
|
|
167
179
|
"confirm"
|
|
168
180
|
],
|
|
169
181
|
"props": {
|
|
182
|
+
"open": {
|
|
183
|
+
"type": "boolean",
|
|
184
|
+
"description": "Omit for inline."
|
|
185
|
+
},
|
|
186
|
+
"pending": {
|
|
187
|
+
"type": "boolean",
|
|
188
|
+
"description": "Lock actions/dismissal."
|
|
189
|
+
},
|
|
170
190
|
"title": {
|
|
171
191
|
"type": "string"
|
|
172
192
|
},
|
|
@@ -189,12 +209,23 @@
|
|
|
189
209
|
"default": "default"
|
|
190
210
|
}
|
|
191
211
|
},
|
|
212
|
+
"events": {
|
|
213
|
+
"onConfirm": {
|
|
214
|
+
"description": "value=values.action=confirm."
|
|
215
|
+
},
|
|
216
|
+
"onCancel": {
|
|
217
|
+
"description": "value=values.action=cancel."
|
|
218
|
+
},
|
|
219
|
+
"onClose": {
|
|
220
|
+
"description": "Dismiss: value=values.open=false."
|
|
221
|
+
}
|
|
222
|
+
},
|
|
192
223
|
"usageScenarios": [
|
|
193
224
|
"Delete confirmation prompt",
|
|
194
225
|
"Unsaved changes warning before navigation"
|
|
195
226
|
],
|
|
196
227
|
"constraints": [
|
|
197
|
-
"
|
|
228
|
+
"Host owns open/pending and persistence; no automatic close/write/retry."
|
|
198
229
|
]
|
|
199
230
|
}
|
|
200
231
|
},
|
package/dist/shadcn/r/form.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
{
|
|
34
34
|
"path": "components/uibot/form.uibot.json",
|
|
35
35
|
"target": "components/uibot/form.uibot.json",
|
|
36
|
-
"content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"form\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Form\",\n \"export\": \"Form\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form\",\n \"description\": \"Form wrapper that prevents default submission. Place Form.Input, Form.Select, etc. as children and end with Form.Submit.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"form\",\n \"input\"\n ],\n \"props\": {\n \"idempotent\": {\n \"type\": \"boolean\",\n \"description\": \"Emit a stable event.value idempotency key while retrying unchanged form values\"\n },\n \"pending\": {\n \"type\": \"boolean\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"layout\": {\n \"type\": \"string\",\n \"enum\": [\n \"vertical\",\n \"horizontal\"\n ],\n \"default\": \"vertical\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Bubbled native field changes with { type, name, value, checked }.\"\n },\n \"onSubmit\": {\n \"description\": \"Runs after native submission is prevented.\",\n \"payload\": {\n \"type\": \"object\",\n \"description\": \"{ type: 'submit', values: Record<string, value> }\"\n }\n }\n },\n \"usageScenarios\": [\n \"Create / edit entity form\",\n \"Login form\",\n \"Search filter form\"\n ],\n \"constraints\": [\n \"Always include exactly one Form.Submit as the last child\",\n \"Do not nest forms inside forms\"\n ]\n }\n },\n {\n \"name\": \"Form.Checkbox\",\n \"export\": \"FormCheckbox\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.Checkbox\",\n \"description\": \"Single boolean checkbox with optional description beneath the label.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"checkbox\"\n ],\n \"props\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"checked\": {\n \"type\": \"boolean\",\n \"description\": \"Supports {_bindState: 'path'} for two-way state.\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Runs with { type, name, value, checked }.\"\n }\n },\n \"usageScenarios\": [\n \"Terms & conditions consent\",\n \"Opt-in notification preference\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Form.Input\",\n \"export\": \"FormInput\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.Input\",\n \"description\": \"Single-line text field. Supports text, email, password, number, tel, url, date types.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"input\"\n ],\n \"props\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"Field identifier (must be unique in the form)\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"text\",\n \"email\",\n \"password\",\n \"number\",\n \"tel\",\n \"url\",\n \"date\",\n \"search\"\n ],\n \"default\": \"text\"\n },\n \"placeholder\": {\n \"type\": \"string\"\n },\n \"helpText\": {\n \"type\": \"string\"\n },\n \"error\": {\n \"type\": \"string\"\n },\n \"required\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"disabled\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Supports {_bindState: 'path'} for two-way state.\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Runs with { type, name, value }.\"\n }\n },\n \"usageScenarios\": [\n \"Email address field in a login form\",\n \"Search bar with type=search\",\n \"Price input with type=number\"\n ],\n \"constraints\": [\n \"name prop is required and must be unique within the parent Form\"\n ]\n }\n },\n {\n \"name\": \"Form.Select\",\n \"export\": \"FormSelect\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.Select\",\n \"description\": \"Dropdown select field with an options array [{value, label}].\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"select\"\n ],\n \"props\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"options\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"value\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n }\n }\n },\n \"description\": \"[{value, label}]\"\n },\n \"placeholder\": {\n \"type\": \"string\"\n },\n \"required\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Supports {_bindState: 'path'} for two-way state.\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Runs with { type, name, value }.\"\n }\n },\n \"usageScenarios\": [\n \"Role selector (Admin/Editor/Viewer)\",\n \"Status filter dropdown\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Form.Submit\",\n \"export\": \"FormSubmit\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.Submit\",\n \"description\": \"Form submit button. Use variant=destructive for irreversible actions.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"button\"\n ],\n \"props\": {\n \"label\": {\n \"type\": \"string\",\n \"default\": \"Submit\"\n },\n \"variant\": {\n \"type\": \"string\",\n \"enum\": [\n \"default\",\n \"destructive\",\n \"outline\",\n \"ghost\"\n ],\n \"default\": \"default\"\n },\n \"full\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"events\": {\n \"onClick\": {\n \"description\": \"Runs with a plain click payload before the parent form submits.\"\n }\n },\n \"usageScenarios\": [\n \"Save button at the bottom of a form\",\n \"Delete action with variant=destructive\"\n ],\n \"constraints\": [\n \"Must be inside a Form block\"\n ]\n }\n },\n {\n \"name\": \"Form.TextArea\",\n \"export\": \"FormTextArea\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.TextArea\",\n \"description\": \"Multi-line text input. Use for descriptions, messages, or any free-form long text.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"textarea\"\n ],\n \"props\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"placeholder\": {\n \"type\": \"string\"\n },\n \"rows\": {\n \"type\": \"integer\",\n \"default\": 4\n },\n \"helpText\": {\n \"type\": \"string\"\n },\n \"required\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Supports {_bindState: 'path'} for two-way state.\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Runs with { type, name, value }.\"\n }\n },\n \"usageScenarios\": [\n \"Bio / description field on a profile form\",\n \"Message body in a contact form\"\n ],\n \"constraints\": []\n }\n }\n ]\n}\n",
|
|
36
|
+
"content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"form\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"Form\",\n \"export\": \"Form\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form\",\n \"description\": \"Form wrapper that prevents default submission. Place Form.Input, Form.Select, etc. as children and end with Form.Submit.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"form\",\n \"input\"\n ],\n \"props\": {\n \"idempotent\": {\n \"type\": \"boolean\",\n \"description\": \"Emit a stable event.value idempotency key while retrying unchanged form values\"\n },\n \"pending\": {\n \"type\": \"boolean\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"layout\": {\n \"type\": \"string\",\n \"enum\": [\n \"vertical\",\n \"horizontal\"\n ],\n \"default\": \"vertical\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Bubbled native field changes with { type, name, value, checked }.\"\n },\n \"onSubmit\": {\n \"description\": \"Runs after native submission is prevented.\",\n \"payload\": {\n \"type\": \"object\",\n \"description\": \"{ type: 'submit', values: Record<string, value> }\"\n }\n }\n },\n \"usageScenarios\": [\n \"Create / edit entity form\",\n \"Login form\",\n \"Search filter form\"\n ],\n \"constraints\": [\n \"Always include exactly one Form.Submit as the last child\",\n \"Do not nest forms inside forms\"\n ]\n }\n },\n {\n \"name\": \"Form.Checkbox\",\n \"export\": \"FormCheckbox\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.Checkbox\",\n \"description\": \"Single boolean checkbox with optional description beneath the label.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"checkbox\"\n ],\n \"props\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"checked\": {\n \"type\": \"boolean\",\n \"description\": \"Supports {_bindState: 'path'} for two-way state.\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Runs with { type, name, value, checked }.\"\n }\n },\n \"usageScenarios\": [\n \"Terms & conditions consent\",\n \"Opt-in notification preference\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Form.Input\",\n \"export\": \"FormInput\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.Input\",\n \"description\": \"Single-line text field. Supports text, email, password, number, tel, url, date types.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"input\"\n ],\n \"props\": {\n \"name\": {\n \"type\": \"string\",\n \"description\": \"Field identifier (must be unique in the form)\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"text\",\n \"email\",\n \"password\",\n \"number\",\n \"tel\",\n \"url\",\n \"date\",\n \"search\"\n ],\n \"default\": \"text\"\n },\n \"placeholder\": {\n \"type\": \"string\"\n },\n \"helpText\": {\n \"type\": \"string\"\n },\n \"error\": {\n \"type\": \"string\"\n },\n \"required\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"disabled\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Supports {_bindState: 'path'} for two-way state.\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Runs with { type, name, value }.\"\n }\n },\n \"usageScenarios\": [\n \"Email address field in a login form\",\n \"Search bar with type=search\",\n \"Price input with type=number\"\n ],\n \"constraints\": [\n \"name prop is required and must be unique within the parent Form\"\n ]\n }\n },\n {\n \"name\": \"Form.Select\",\n \"export\": \"FormSelect\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.Select\",\n \"description\": \"Dropdown select field with an options array [{value, label}].\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"select\"\n ],\n \"props\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"options\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"value\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n }\n }\n },\n \"description\": \"[{value, label}]\"\n },\n \"placeholder\": {\n \"type\": \"string\"\n },\n \"required\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Supports {_bindState: 'path'} for two-way state.\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Runs with { type, name, value }.\"\n }\n },\n \"usageScenarios\": [\n \"Role selector (Admin/Editor/Viewer)\",\n \"Status filter dropdown\"\n ],\n \"constraints\": []\n }\n },\n {\n \"name\": \"Form.Submit\",\n \"export\": \"FormSubmit\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.Submit\",\n \"description\": \"Form submit button. Use variant=destructive for irreversible actions.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"button\"\n ],\n \"props\": {\n \"disabled\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"label\": {\n \"type\": \"string\",\n \"default\": \"Submit\"\n },\n \"variant\": {\n \"type\": \"string\",\n \"enum\": [\n \"default\",\n \"destructive\",\n \"outline\",\n \"ghost\"\n ],\n \"default\": \"default\"\n },\n \"full\": {\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"events\": {\n \"onClick\": {\n \"description\": \"Runs with a plain click payload before the parent form submits.\"\n }\n },\n \"usageScenarios\": [\n \"Save button at the bottom of a form\",\n \"Delete action with variant=destructive\"\n ],\n \"constraints\": [\n \"Must be inside a Form block\"\n ]\n }\n },\n {\n \"name\": \"Form.TextArea\",\n \"export\": \"FormTextArea\",\n \"module\": \"form.tsx\",\n \"catalog\": {\n \"name\": \"Form.TextArea\",\n \"description\": \"Multi-line text input. Use for descriptions, messages, or any free-form long text.\",\n \"category\": \"primitive\",\n \"level\": \"L1\",\n \"tags\": [\n \"form\",\n \"textarea\"\n ],\n \"props\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"placeholder\": {\n \"type\": \"string\"\n },\n \"rows\": {\n \"type\": \"integer\",\n \"default\": 4\n },\n \"helpText\": {\n \"type\": \"string\"\n },\n \"required\": {\n \"type\": \"boolean\",\n \"default\": false\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"Supports {_bindState: 'path'} for two-way state.\"\n }\n },\n \"events\": {\n \"onChange\": {\n \"description\": \"Runs with { type, name, value }.\"\n }\n },\n \"usageScenarios\": [\n \"Bio / description field on a profile form\",\n \"Message body in a contact form\"\n ],\n \"constraints\": []\n }\n }\n ]\n}\n",
|
|
37
37
|
"type": "registry:ui"
|
|
38
38
|
}
|
|
39
39
|
],
|
|
@@ -335,6 +335,10 @@
|
|
|
335
335
|
"button"
|
|
336
336
|
],
|
|
337
337
|
"props": {
|
|
338
|
+
"disabled": {
|
|
339
|
+
"type": "boolean",
|
|
340
|
+
"default": false
|
|
341
|
+
},
|
|
338
342
|
"label": {
|
|
339
343
|
"type": "string",
|
|
340
344
|
"default": "Submit"
|