@uibot/registry 0.18.0 → 0.19.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.
Files changed (119) hide show
  1. package/README.md +59 -0
  2. package/dist/distribution-snapshot.d.ts +22 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +11 -11
  5. package/dist/resource-query.d.ts +4 -0
  6. package/dist/resources.d.ts +3 -0
  7. package/dist/resources.js +3 -3
  8. package/dist/shadcn/r/admin-apps.json +61 -0
  9. package/dist/shadcn/r/admin-chats.json +54 -0
  10. package/dist/shadcn/r/admin-error-401.json +54 -0
  11. package/dist/shadcn/r/admin-error-403.json +54 -0
  12. package/dist/shadcn/r/admin-error-404.json +54 -0
  13. package/dist/shadcn/r/admin-error-500.json +54 -0
  14. package/dist/shadcn/r/admin-error-503.json +54 -0
  15. package/dist/shadcn/r/admin-forgot-password.json +59 -0
  16. package/dist/shadcn/r/admin-help.json +53 -0
  17. package/dist/shadcn/r/admin-otp.json +59 -0
  18. package/dist/shadcn/r/admin-overview.json +62 -0
  19. package/dist/shadcn/r/admin-settings-account.json +61 -0
  20. package/dist/shadcn/r/admin-settings-appearance.json +61 -0
  21. package/dist/shadcn/r/admin-settings-display.json +61 -0
  22. package/dist/shadcn/r/admin-settings-notifications.json +61 -0
  23. package/dist/shadcn/r/admin-settings-profile.json +61 -0
  24. package/dist/shadcn/r/admin-settings.json +65 -0
  25. package/dist/shadcn/r/admin-shell.json +11 -5
  26. package/dist/shadcn/r/admin-sign-in-2.json +67 -0
  27. package/dist/shadcn/r/admin-sign-in.json +59 -0
  28. package/dist/shadcn/r/admin-sign-up.json +59 -0
  29. package/dist/shadcn/r/admin-tasks.json +66 -0
  30. package/dist/shadcn/r/admin-users.json +66 -0
  31. package/dist/shadcn/r/auth-01.json +24 -0
  32. package/dist/shadcn/r/auth-02.json +24 -0
  33. package/dist/shadcn/r/auth-03.json +24 -0
  34. package/dist/shadcn/r/auth-04.json +24 -0
  35. package/dist/shadcn/r/auth-05.json +24 -0
  36. package/dist/shadcn/r/auth-centered.json +61 -0
  37. package/dist/shadcn/r/auth-enterprise.json +61 -0
  38. package/dist/shadcn/r/auth-primitives.json +58 -0
  39. package/dist/shadcn/r/auth-recovery.json +64 -0
  40. package/dist/shadcn/r/auth-registration.json +63 -0
  41. package/dist/shadcn/r/auth-split.json +67 -0
  42. package/dist/shadcn/r/auth.json +13 -13
  43. package/dist/shadcn/r/charts.json +1 -1
  44. package/dist/shadcn/r/chat-artifact.json +49 -0
  45. package/dist/shadcn/r/chat-focused.json +49 -0
  46. package/dist/shadcn/r/chat-history.json +49 -0
  47. package/dist/shadcn/r/chat-knowledge.json +49 -0
  48. package/dist/shadcn/r/chat-support.json +49 -0
  49. package/dist/shadcn/r/chat-workspace.json +136 -0
  50. package/dist/shadcn/r/collection-cell-editor.json +6 -6
  51. package/dist/shadcn/r/collection-panel-drawer.json +2 -2
  52. package/dist/shadcn/r/collection-record-menu.json +2 -2
  53. package/dist/shadcn/r/collection-shared.json +2 -2
  54. package/dist/shadcn/r/commerce-workspace.json +69 -0
  55. package/dist/shadcn/r/console-billing.json +68 -0
  56. package/dist/shadcn/r/console-page.json +289 -0
  57. package/dist/shadcn/r/console-shell.json +29 -0
  58. package/dist/shadcn/r/content.json +1 -1
  59. package/dist/shadcn/r/creation-html-generation.json +3 -3
  60. package/dist/shadcn/r/creation-reference-generation.json +3 -3
  61. package/dist/shadcn/r/creation-revision-export.json +3 -3
  62. package/dist/shadcn/r/creation-shared.json +3 -3
  63. package/dist/shadcn/r/creation-variant-compare.json +4 -4
  64. package/dist/shadcn/r/creation-workspace.json +4 -4
  65. package/dist/shadcn/r/crm-workspace.json +73 -0
  66. package/dist/shadcn/r/dashboard.json +1 -1
  67. package/dist/shadcn/r/data-studio.json +1 -1
  68. package/dist/shadcn/r/data-table.json +25 -7
  69. package/dist/shadcn/r/data.json +81 -11
  70. package/dist/shadcn/r/document-assistant.json +54 -0
  71. package/dist/shadcn/r/document-library.json +49 -0
  72. package/dist/shadcn/r/document-reading.json +49 -0
  73. package/dist/shadcn/r/document-workspace.json +164 -0
  74. package/dist/shadcn/r/document-writing.json +49 -0
  75. package/dist/shadcn/r/drilldown-menu.json +233 -0
  76. package/dist/shadcn/r/education-workspace.json +82 -0
  77. package/dist/shadcn/r/feedback.json +6 -6
  78. package/dist/shadcn/r/field.json +1 -1
  79. package/dist/shadcn/r/form.json +11 -11
  80. package/dist/shadcn/r/grid.json +1 -1
  81. package/dist/shadcn/r/interactive.json +1 -1
  82. package/dist/shadcn/r/item-grid.json +219 -0
  83. package/dist/shadcn/r/kanban.json +1 -1
  84. package/dist/shadcn/r/layout.json +196 -16
  85. package/dist/shadcn/r/marketing.json +1 -1
  86. package/dist/shadcn/r/nav.json +3 -3
  87. package/dist/shadcn/r/presentation.json +1 -1
  88. package/dist/shadcn/r/preview-device-frame.json +2 -2
  89. package/dist/shadcn/r/primitives.json +2 -2
  90. package/dist/shadcn/r/sections.json +1 -1
  91. package/dist/shadcn/r/shadcn-admin-shell.json +1 -1
  92. package/dist/shadcn/r/shadcn-admin.json +23 -22
  93. package/dist/shadcn/r/sidebar-01.json +42 -0
  94. package/dist/shadcn/r/sidebar-02.json +42 -0
  95. package/dist/shadcn/r/sidebar-03.json +30 -0
  96. package/dist/shadcn/r/sidebar-04.json +30 -0
  97. package/dist/shadcn/r/sidebar-05.json +36 -0
  98. package/dist/shadcn/r/sidebar-06.json +42 -0
  99. package/dist/shadcn/r/sidebar-07.json +54 -0
  100. package/dist/shadcn/r/sidebar-08.json +54 -0
  101. package/dist/shadcn/r/sidebar-09.json +36 -0
  102. package/dist/shadcn/r/sidebar-10.json +66 -0
  103. package/dist/shadcn/r/sidebar-11.json +30 -0
  104. package/dist/shadcn/r/sidebar-12.json +48 -0
  105. package/dist/shadcn/r/sidebar-13.json +30 -0
  106. package/dist/shadcn/r/sidebar-14.json +30 -0
  107. package/dist/shadcn/r/sidebar-15.json +84 -0
  108. package/dist/shadcn/r/sidebar-16.json +66 -0
  109. package/dist/shadcn/r/sidebar-drilldown.json +29 -0
  110. package/dist/shadcn/r/sidebar-primitives.json +155 -0
  111. package/dist/shadcn/r/uibot-base.json +3 -3
  112. package/dist/shadcn/r/workspace.json +3 -3
  113. package/dist/shadcn/registry.json +987 -175
  114. package/dist/shadcn.d.ts +0 -39
  115. package/dist/solution-composition.d.ts +45 -0
  116. package/dist/solution-regions.d.ts +3 -0
  117. package/dist/solution-spec.d.ts +7 -0
  118. package/dist/template-source.d.ts +2 -0
  119. package/package.json +2 -2
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "console-shell",
4
+ "type": "registry:block",
5
+ "description": "Plain React console shell with host-owned navigation, identity and action slots.",
6
+ "dependencies": [
7
+ "react@19.3.0",
8
+ "radix-ui@1.8.1"
9
+ ],
10
+ "registryDependencies": [],
11
+ "files": [
12
+ {
13
+ "path": "components/uibot/console/shell.tsx",
14
+ "target": "components/uibot/console/shell.tsx",
15
+ "content": "\"use client\";\n\nimport { useState, type ReactNode, type Ref } from \"react\";\nimport { Dialog } from \"radix-ui\";\nimport { CONSOLE_SHELL_CSS } from \"./shell-styles\";\n\nexport interface ConsoleShellProps {\n brand?: ReactNode;\n navigation?: ReactNode;\n workspace?: ReactNode;\n account?: ReactNode;\n search?: ReactNode;\n headerActions?: ReactNode;\n footer?: ReactNode;\n children?: ReactNode;\n className?: string;\n rootRef?: Ref<HTMLDivElement>;\n copy?: Partial<{ openNavigation: string; closeNavigation: string; navigation: string }>;\n}\n\n/** Presentation only. Host-provided slots own routing, identity and all business actions. */\nexport function ConsoleShell({\n brand,\n navigation,\n workspace,\n account,\n search,\n headerActions,\n footer,\n children,\n className = \"\",\n rootRef,\n copy,\n}: ConsoleShellProps) {\n const [open, setOpen] = useState(false);\n const hasSidebar = navigation != null || workspace != null || account != null || footer != null;\n const openLabel = copy?.openNavigation ?? \"Open navigation\";\n const closeLabel = copy?.closeNavigation ?? \"Close\";\n const sidebar = (\n <>\n {workspace != null && <div className=\"csl-shell-workspace\">{workspace}</div>}\n {navigation != null && <div className=\"csl-sidebar-navigation\">{navigation}</div>}\n {footer != null && <div className=\"csl-shell-footer\">{footer}</div>}\n {account != null && <div className=\"csl-sidebar-account\">{account}</div>}\n </>\n );\n return (\n <Dialog.Root open={open && hasSidebar} onOpenChange={setOpen}>\n <div\n ref={rootRef}\n className={`uibot-page-layout uibot-console csl-shell ${className}`}\n data-uibot-type=\"PageLayout\"\n data-appearance=\"console\"\n >\n <style>{CONSOLE_SHELL_CSS}</style>\n <header className=\"csl-topbar\">\n {hasSidebar && (\n <Dialog.Trigger asChild>\n <button\n type=\"button\"\n className=\"csl-icon-button csl-mobile-trigger\"\n aria-label={openLabel}\n title={openLabel}\n >\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n aria-hidden=\"true\"\n >\n <path d=\"M4 6h16M4 12h16M4 18h16\" />\n </svg>\n </button>\n </Dialog.Trigger>\n )}\n {brand}\n {search}\n {headerActions != null && <div className=\"csl-topbar-actions\">{headerActions}</div>}\n </header>\n <div className=\"csl-body\">\n {hasSidebar && <aside className=\"csl-sidebar\">{sidebar}</aside>}\n <main className=\"csl-main\">{children}</main>\n </div>\n {hasSidebar && (\n <Dialog.Portal>\n <Dialog.Overlay className=\"csl-shell-overlay\" />\n <Dialog.Content\n className=\"uibot-console csl-shell-drawer\"\n aria-describedby={undefined}\n onEscapeKeyDown={(event) => {\n // Nested controls opt in while their bubble handler can consume Escape.\n if (\n event.target instanceof Element &&\n event.target.closest(\"[data-uibot-escape-boundary]\")\n )\n event.preventDefault();\n }}\n onClick={(event) => {\n if (\n event.target instanceof Element &&\n event.target.closest(\"a\") &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey &&\n event.button === 0\n )\n setOpen(false);\n }}\n >\n <Dialog.Title className=\"csl-shell-sr-only\">\n {copy?.navigation ?? \"Navigation\"}\n </Dialog.Title>\n <Dialog.Close asChild>\n <button type=\"button\" className=\"csl-shell-close\" aria-label={closeLabel}>\n {closeLabel}\n </button>\n </Dialog.Close>\n <div className=\"csl-mobile-sidebar\">{sidebar}</div>\n </Dialog.Content>\n </Dialog.Portal>\n )}\n </div>\n </Dialog.Root>\n );\n}\n",
16
+ "type": "registry:component"
17
+ },
18
+ {
19
+ "path": "components/uibot/console/shell-styles.ts",
20
+ "target": "components/uibot/console/shell-styles.ts",
21
+ "content": "/** Shared shell rules. Business page styles stay with their author modules. */\nexport const CONSOLE_SHELL_CSS = `\n.uibot-console,.csl-popup{--csl-bg:#fcfcfa;--csl-nav:#fafaf8;--csl-line:#e6e6e2;--csl-muted:#878780;--csl-fg:#242421;--csl-button:#eeeeea;--csl-selected:#e8e8e4;color:var(--csl-fg);background:var(--csl-bg);font:14px/1.45 ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",sans-serif}\n.dark .uibot-console,.dark .csl-popup{--csl-bg:#141414;--csl-nav:#101010;--csl-line:#303030;--csl-muted:#92928b;--csl-fg:#e9e9e4;--csl-button:#303030;--csl-selected:#363636}\n.uibot-console *,.csl-popup *{box-sizing:border-box}.uibot-console button,.uibot-console input,.uibot-console textarea,.csl-popup button,.csl-popup input,.csl-popup textarea{font:inherit}.uibot-console :is(button,a,input,textarea):focus-visible,.csl-popup :is(button,a,input,textarea):focus-visible{outline:2px solid var(--csl-focus,#8a80df);outline-offset:3px}.uibot-console button:not(:disabled),.csl-popup button:not(:disabled){cursor:pointer}.uibot-console button:disabled,.csl-popup button:disabled{opacity:.45;cursor:not-allowed}\n.csl-topbar{height:48px;display:flex;align-items:center;gap:20px;padding:0 16px;border-bottom:1px solid var(--csl-line);background:var(--csl-nav);flex:none}.csl-brand{font:23px Georgia,serif;color:inherit;text-decoration:none;white-space:nowrap}.csl-topbar .csl-search-trigger{position:absolute;left:50%;transform:translateX(-50%);width:min(448px,35vw)}.csl-search-trigger{border:1px solid var(--csl-line);border-radius:8px;height:32px;display:flex;align-items:center;gap:10px;padding:0 10px;background:var(--csl-bg);color:var(--csl-muted)}.csl-search-trigger kbd{margin-left:auto;font:11px inherit;border:1px solid var(--csl-line);border-radius:3px;padding:0 4px}.csl-topbar-actions{margin-left:auto;display:flex;align-items:center;gap:20px}.csl-topbar-actions a{display:flex;align-items:center;gap:7px;color:inherit;text-decoration:none}.csl-topbar svg{width:18px;height:18px}.csl-icon-button{border:0;background:transparent;color:inherit;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:6px}.csl-body{display:flex;flex:1;min-height:0;overflow:hidden}.csl-sidebar{width:256px;flex:none;border-right:1px solid var(--csl-line);background:var(--csl-nav);min-height:0}.csl-main{flex:1;min-width:0;overflow:auto;padding:24px}\n.uibot-console{--background:var(--csl-bg);--foreground:var(--csl-fg);--border:var(--csl-line);--muted:var(--csl-button);--muted-foreground:var(--csl-muted)}\n.csl-sidebar{display:flex;flex-direction:column}.csl-sidebar-navigation{flex:1;min-height:0;overflow:auto}.csl-sidebar-navigation>.uibot-drilldown{height:100%;border:0}.csl-sidebar-account{padding:16px;border-top:1px solid var(--csl-line);flex:none}.csl-mobile-sidebar{height:calc(100dvh - 4rem);display:flex;flex-direction:column}\n.csl-shell{display:flex;flex-direction:column;height:100dvh;min-width:0}.csl-mobile-trigger{display:none}.csl-shell-workspace,.csl-shell-footer{padding:12px 16px}.csl-shell-drawer{position:fixed;inset:0 auto 0 0;margin:0;width:288px;max-width:85vw;height:100dvh;max-height:100dvh;padding:0;border:0;border-right:1px solid var(--csl-line);box-shadow:0 12px 36px #0004}.csl-shell-overlay{position:fixed;inset:0;background:#0008;z-index:49}.csl-shell-drawer{z-index:50}.csl-shell-sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}.csl-shell-close{margin:12px;padding:6px 12px;border:1px solid var(--csl-line);border-radius:6px;color:inherit;background:transparent}.csl-shell .csl-brand{min-width:0;overflow-wrap:anywhere;white-space:normal}.csl-shell .csl-topbar-actions{min-width:0}\n@media(max-width:767px){.csl-sidebar{display:none}.csl-mobile-trigger{display:inline-flex;flex:none}.csl-topbar{padding:0 12px;gap:8px}.csl-brand{font-size:20px}.csl-topbar .csl-search-trigger{position:static;transform:none;width:28px;height:28px;border:0;padding:4px;margin-left:auto}.csl-search-trigger>span,.csl-search-trigger kbd{display:none}.csl-topbar-actions{gap:8px}.csl-main{padding:20px 16px}}\n`;\n",
22
+ "type": "registry:lib"
23
+ }
24
+ ],
25
+ "meta": {
26
+ "composite": true,
27
+ "channel": "public"
28
+ }
29
+ }
@@ -4,7 +4,7 @@
4
4
  "type": "registry:ui",
5
5
  "description": "Editorial accordion FAQ built on native <details>/<summary> — fully functional with zero JS / state wiring. Optional eyebrow/title/lead header; rows carry a mono index numeral, a hairline plus-mark that rotates 45° into a close-mark on open, and a grid-rows expand transition.",
6
6
  "dependencies": [
7
- "react"
7
+ "react@19.3.0"
8
8
  ],
9
9
  "registryDependencies": [
10
10
  "@uibot/uibot-base"
@@ -4,9 +4,9 @@
4
4
  "type": "registry:block",
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
- "react",
8
- "@uibot/contracts@^0.18.0",
9
- "@uibot/creation-kit@^0.18.0"
7
+ "react@19.3.0",
8
+ "@uibot/contracts@0.19.0",
9
+ "@uibot/creation-kit@0.19.0"
10
10
  ],
11
11
  "registryDependencies": [
12
12
  "button",
@@ -4,9 +4,9 @@
4
4
  "type": "registry:block",
5
5
  "description": "Generate a presentation from an explicitly chosen saved HTML revision.",
6
6
  "dependencies": [
7
- "react",
8
- "@uibot/contracts@^0.18.0",
9
- "@uibot/creation-kit@^0.18.0"
7
+ "react@19.3.0",
8
+ "@uibot/contracts@0.19.0",
9
+ "@uibot/creation-kit@0.19.0"
10
10
  ],
11
11
  "registryDependencies": [
12
12
  "button",
@@ -4,9 +4,9 @@
4
4
  "type": "registry:block",
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
- "react",
8
- "@uibot/contracts@^0.18.0",
9
- "@uibot/creation-kit@^0.18.0"
7
+ "react@19.3.0",
8
+ "@uibot/contracts@0.19.0",
9
+ "@uibot/creation-kit@0.19.0"
10
10
  ],
11
11
  "registryDependencies": [
12
12
  "button",
@@ -4,9 +4,9 @@
4
4
  "type": "registry:lib",
5
5
  "description": "Copy (zh/en), domain filters and run checks shared by the UIBot creation blocks.",
6
6
  "dependencies": [
7
- "react",
8
- "@uibot/contracts@^0.18.0",
9
- "@uibot/creation-kit@^0.18.0"
7
+ "react@19.3.0",
8
+ "@uibot/contracts@0.19.0",
9
+ "@uibot/creation-kit@0.19.0"
10
10
  ],
11
11
  "registryDependencies": [],
12
12
  "files": [
@@ -4,10 +4,10 @@
4
4
  "type": "registry:block",
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
- "react",
8
- "@uibot/contracts@^0.18.0",
9
- "@uibot/creation-kit@^0.18.0",
10
- "@uibot/web-preview@^0.18.0"
7
+ "react@19.3.0",
8
+ "@uibot/contracts@0.19.0",
9
+ "@uibot/creation-kit@0.19.0",
10
+ "@uibot/web-preview@0.19.0"
11
11
  ],
12
12
  "registryDependencies": [
13
13
  "button",
@@ -4,10 +4,10 @@
4
4
  "type": "registry:block",
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
- "react",
8
- "@uibot/contracts@^0.18.0",
9
- "@uibot/creation-kit@^0.18.0",
10
- "@uibot/web-preview@^0.18.0"
7
+ "react@19.3.0",
8
+ "@uibot/contracts@0.19.0",
9
+ "@uibot/creation-kit@0.19.0",
10
+ "@uibot/web-preview@0.19.0"
11
11
  ],
12
12
  "registryDependencies": [
13
13
  "button",
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "crm-workspace",
4
+ "type": "registry:block",
5
+ "description": "CRM workspace & assistant: fixed-version pages composed into one exportable Spec.",
6
+ "registryDependencies": [
7
+ "@uibot/chat-workspace",
8
+ "@uibot/data",
9
+ "@uibot/data-studio",
10
+ "@uibot/document-workspace",
11
+ "@uibot/feedback",
12
+ "@uibot/interactive",
13
+ "@uibot/kanban",
14
+ "@uibot/layout",
15
+ "@uibot/nav"
16
+ ],
17
+ "files": [
18
+ {
19
+ "path": "lib/uibot/templates/crm-workspace.uibot.yaml",
20
+ "target": "lib/uibot/templates/crm-workspace.uibot.yaml",
21
+ "content": "version: \"2.0\"\npages:\n - id: crm\n path: /\n title: Pipeline — CRM\n blocks:\n - type: PageLayout\n props:\n title: Relate CRM\n variant: sidebar\n collapsible: none\n slots:\n sidebar:\n - type: PageSiderMenu\n props:\n title: Sales\n children:\n - type: MenuLink\n props:\n label: Pipeline\n href: \"#\"\n icon: ◫\n active: true\n - type: MenuLink\n props:\n label: Contacts\n href: \"#\"\n icon: ◍\n badge: \"5\"\n - type: MenuLink\n props:\n label: Deals\n href: \"#\"\n icon: ◆\n - type: MenuLink\n props:\n label: Reports\n href: \"#\"\n icon: ◔\n badge: n/a\n headerActions:\n - type: Button\n props:\n label: + Add lead\n size: sm\n children:\n - type: Box\n props:\n className: flex items-end justify-between gap-4 mb-3 border-b border-border pb-3\n children:\n - type: Box\n children:\n - type: Heading\n props:\n level: 2\n text: Pipeline\n - type: Paragraph\n props:\n size: sm\n muted: true\n text: Demo workspace · sample deals, not live ARR\n - type: BadgeGroup\n props:\n items:\n - label: 1 hot deal\n tone: warning\n - label: Forecast n/a\n tone: info\n - type: Toast\n props:\n level: warning\n title: Status first\n message: Umbrella Inc is marked hot. Pipeline dollars below are demo labels —\n live forecast stays n/a.\n - type: StatGrid\n props:\n cols: \"3\"\n items:\n - label: Open pipeline (demo)\n value: $1.24M\n change: sample board\n trend: up\n - label: Win rate (demo)\n value: 32%\n change: +3pt sample\n trend: up\n - label: Live forecast\n value: n/a\n description: CRM source offline\n - type: Card\n props:\n title: Pipeline by stage\n description: Five sample cards · hairline board\n className: rounded-none border border-border shadow-none\n children:\n - type: KanbanBoard\n props:\n columns:\n - id: lead\n title: Lead\n - id: qualified\n title: Qualified\n - id: proposal\n title: Proposal\n - id: won\n title: Won\n cards:\n - id: c1\n column: lead\n title: Globex Corp\n subtitle: $22,000 · demo\n badge: New\n - id: c2\n column: lead\n title: Initech\n subtitle: $8,400 · demo\n - id: c3\n column: qualified\n title: Umbrella Inc\n subtitle: $54,000 · demo\n badge: Hot\n - id: c4\n column: proposal\n title: Stark Industries\n subtitle: $140,000 · demo\n - id: c5\n column: won\n title: Wayne Enterprises\n subtitle: $96,000 · demo\n badge: Closed\n - type: Card\n props:\n title: Recent contacts\n description: Empty state is wired if the demo rows are cleared\n className: rounded-none border border-border shadow-none\n children:\n - type: Table\n props:\n emptyText: No contacts in this window.\n striped: true\n columns:\n - key: name\n label: Name\n - key: company\n label: Company\n - key: stage\n label: Stage\n - key: value\n label: Value\n align: right\n rows:\n - name: Marcus Webb\n company: Globex Corp\n stage: Lead\n value: $22,000\n - name: Lena Park\n company: Umbrella Inc\n stage: Qualified\n value: $54,000\n - name: Omar Haddad\n company: Stark Industries\n stage: Proposal\n value: $140,000\n - id: chat-history\n path: /chat-history\n title: Conversation workspace\n blocks:\n - id: chat-history-surface\n type: ChatWorkspace\n props:\n bindingId: chat\n variant: history\n title: Conversation workspace\n showSuggestions: true\n previewState: ready\n - id: document-writing\n path: /document-writing\n title: Focused writing\n blocks:\n - id: document-writing-editor\n type: DocumentWorkspace\n props:\n bindingId: document\n title: Focused writing\n markdown: |-\n # Project notes\n\n Capture the decisions behind your next idea.\n\n ## Overview\n\n Write, select text, and explore the formatting controls.\n\n ## Next steps\n\n - Review the draft\n - Connect your document host\n readOnly: false\n autoSaveMs: 1500\n locale: zh-CN\n previewState: ready\n variant: writing\ncomposition:\n schema: uibot.solution-composition.v1\n pages:\n - resourceId: template:chat-history\n version: 0.19.0\n sourceHash: 0cf2b52c4fe098bbc2412b931b5a37981bb1727a42f2a50067ff4ddab51444eb\n sourcePageId: chat-history\n targetPageId: chat-history\n baseline:\n id: chat-history\n path: /chat-history\n title: Conversation workspace\n blocks:\n - id: chat-history-surface\n type: ChatWorkspace\n props:\n bindingId: chat\n variant: history\n title: Conversation workspace\n showSuggestions: true\n previewState: ready\n bindings:\n paths: {}\n connections: {}\n layout: source\n - resourceId: template:document-writing\n version: 0.19.0\n sourceHash: 574a264ba29e0e4a712896288dca56a3cb67d3ee202da6e0df3532a5507ed9cf\n sourcePageId: document-writing\n targetPageId: document-writing\n baseline:\n id: document-writing\n path: /document-writing\n title: Focused writing\n blocks:\n - id: document-writing-editor\n type: DocumentWorkspace\n props:\n bindingId: document\n title: Focused writing\n markdown: |-\n # Project notes\n\n Capture the decisions behind your next idea.\n\n ## Overview\n\n Write, select text, and explore the formatting controls.\n\n ## Next steps\n\n - Review the draft\n - Connect your document host\n readOnly: false\n autoSaveMs: 1500\n locale: zh-CN\n previewState: ready\n variant: writing\n bindings:\n paths: {}\n connections: {}\n layout: source\nmenus:\n items:\n - key: crm\n label: Pipeline — CRM\n path: /\n - key: chat-history\n label: Conversation workspace\n path: /chat-history\n - key: document-writing\n label: Focused writing\n path: /document-writing\n",
22
+ "type": "registry:lib"
23
+ },
24
+ {
25
+ "path": "lib/uibot/templates/crm-workspace.uibot.json",
26
+ "target": "lib/uibot/templates/crm-workspace.uibot.json",
27
+ "content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"crm-workspace\",\n \"channel\": \"public\",\n \"template\": {\n \"file\": \"crm-workspace.uibot.yaml\",\n \"contract\": {\n \"name\": \"crm-workspace\",\n \"description\": \"CRM workspace & assistant: fixed-version pages composed into one exportable Spec.\",\n \"level\": \"L5\",\n \"category\": \"app\",\n \"keywords\": [\n \"crm-workspace\",\n \"CRM:销售工作台与客户助手\",\n \"CRM workspace & assistant\",\n \"chat\",\n \"documents\",\n \"history\",\n \"writing\"\n ],\n \"composedFrom\": [\n \"PageLayout\",\n \"Box\",\n \"Heading\",\n \"Paragraph\",\n \"BadgeGroup\",\n \"Toast\",\n \"StatGrid\",\n \"Card\",\n \"KanbanBoard\",\n \"Table\",\n \"PageSiderMenu\",\n \"MenuLink\",\n \"Button\",\n \"ChatWorkspace\",\n \"DocumentWorkspace\"\n ]\n }\n }\n}\n",
28
+ "type": "registry:lib"
29
+ }
30
+ ],
31
+ "meta": {
32
+ "uibot": {
33
+ "schema": "uibot.registry.item.v1",
34
+ "item": "crm-workspace",
35
+ "channel": "public",
36
+ "template": {
37
+ "file": "crm-workspace.uibot.yaml",
38
+ "contract": {
39
+ "name": "crm-workspace",
40
+ "description": "CRM workspace & assistant: fixed-version pages composed into one exportable Spec.",
41
+ "level": "L5",
42
+ "category": "app",
43
+ "keywords": [
44
+ "crm-workspace",
45
+ "CRM:销售工作台与客户助手",
46
+ "CRM workspace & assistant",
47
+ "chat",
48
+ "documents",
49
+ "history",
50
+ "writing"
51
+ ],
52
+ "composedFrom": [
53
+ "PageLayout",
54
+ "Box",
55
+ "Heading",
56
+ "Paragraph",
57
+ "BadgeGroup",
58
+ "Toast",
59
+ "StatGrid",
60
+ "Card",
61
+ "KanbanBoard",
62
+ "Table",
63
+ "PageSiderMenu",
64
+ "MenuLink",
65
+ "Button",
66
+ "ChatWorkspace",
67
+ "DocumentWorkspace"
68
+ ]
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
@@ -4,7 +4,7 @@
4
4
  "type": "registry:ui",
5
5
  "description": "Metric with label, value and supporting text",
6
6
  "dependencies": [
7
- "react"
7
+ "react@19.3.0"
8
8
  ],
9
9
  "registryDependencies": [
10
10
  "@uibot/uibot-base"
@@ -4,7 +4,7 @@
4
4
  "type": "registry:ui",
5
5
  "description": "Responsive grid of KPI cards. Prefers child Stat blocks; falls back to inline rendering of an items array when there are no children.",
6
6
  "dependencies": [
7
- "react"
7
+ "react@19.3.0"
8
8
  ],
9
9
  "registryDependencies": [
10
10
  "@uibot/uibot-base"
@@ -4,7 +4,7 @@
4
4
  "type": "registry:ui",
5
5
  "description": "Configurable record table with search, facets, sorting, stable selection and pagination. Server mode emits query intent without filtering current-page rows.",
6
6
  "dependencies": [
7
- "react"
7
+ "react@19.3.0"
8
8
  ],
9
9
  "registryDependencies": [
10
10
  "@uibot/uibot-base"
@@ -13,7 +13,7 @@
13
13
  {
14
14
  "path": "components/uibot/data-table.tsx",
15
15
  "target": "components/uibot/data-table.tsx",
16
- "content": "import { useState } from \"react\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport { Icon } from \"./icons\";\nimport { emit, records, text, type BlockContext } from \"./interaction\";\n\nexport interface TableView {\n search: string;\n filters: Record<string, string[]>;\n sort: string;\n descending: boolean;\n page: number;\n pageSize: number;\n hiddenColumns?: string[];\n}\nexport function projectTableRows(\n rows: Record<string, unknown>[],\n view: TableView,\n searchKeys: string[],\n) {\n const query = view.search.toLocaleLowerCase();\n const filtered = rows.filter(\n (row) =>\n (!query || searchKeys.some((key) => text(row[key]).toLocaleLowerCase().includes(query))) &&\n Object.entries(view.filters).every(\n ([key, values]) => !values.length || values.includes(text(row[key])),\n ),\n );\n if (view.sort)\n filtered.sort((a, b) => {\n const x = a[view.sort],\n y = b[view.sort];\n const cmp =\n typeof x === \"number\" && typeof y === \"number\"\n ? x - y\n : text(x).localeCompare(text(y), undefined, { numeric: true });\n return view.descending ? -cmp : cmp;\n });\n const pageSize = Math.max(1, Math.min(200, Math.floor(view.pageSize) || 10));\n const pageCount = Math.max(1, Math.ceil(filtered.length / pageSize));\n const page = Math.max(0, Math.min(Math.floor(view.page) || 0, pageCount - 1));\n return {\n rows: filtered.slice(page * pageSize, (page + 1) * pageSize),\n total: filtered.length,\n page,\n pageCount,\n };\n}\nconst control =\n \"h-9 rounded-md border bg-background px-3 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40\";\nfunction DataTableView({ props, ctx }: { props: Record<string, unknown>; ctx: BlockContext }) {\n const rows = records(props.rows),\n columns = records(props.columns),\n facets = records(props.filters);\n const rowKey = text(props.rowKey, \"id\");\n const [localView, setView] = useState<TableView>({\n search: \"\",\n filters: {},\n sort: \"\",\n descending: false,\n page: 0,\n pageSize: Number(props.pageSize) || 10,\n hiddenColumns: [],\n });\n let supplied: unknown = props.view;\n if (typeof supplied === \"string\") {\n try {\n supplied = JSON.parse(supplied);\n } catch {\n supplied = {};\n }\n }\n const raw = supplied && typeof supplied === \"object\" ? (supplied as Record<string, unknown>) : {};\n const view: TableView = {\n ...localView,\n hiddenColumns: Array.isArray(raw.hiddenColumns)\n ? raw.hiddenColumns.filter((x): x is string => typeof x === \"string\")\n : (localView.hiddenColumns ?? []),\n search: typeof raw.search === \"string\" ? raw.search : localView.search,\n sort: typeof raw.sort === \"string\" ? raw.sort : localView.sort,\n descending: typeof raw.descending === \"boolean\" ? raw.descending : localView.descending,\n page:\n typeof raw.page === \"number\" && Number.isFinite(raw.page)\n ? Math.max(0, Math.floor(raw.page))\n : localView.page,\n pageSize:\n typeof raw.pageSize === \"number\" && Number.isFinite(raw.pageSize)\n ? Math.max(1, Math.min(200, Math.floor(raw.pageSize)))\n : localView.pageSize,\n filters:\n raw.filters && typeof raw.filters === \"object\"\n ? Object.fromEntries(\n Object.entries(raw.filters)\n .filter(([, v]) => Array.isArray(v))\n .map(([k, v]) => [\n k,\n (v as unknown[]).filter((x): x is string => typeof x === \"string\"),\n ]),\n )\n : localView.filters,\n };\n const [selected, select] = useState<string[]>([]);\n const hidden = view.hiddenColumns ?? [];\n const ids = new Set(rows.map((r) => text(r[rowKey])));\n const selectedIds = (\n Array.isArray(props.selectedIds) ? props.selectedIds.map(String) : selected\n ).filter((id) => props.server === true || ids.has(id));\n const update = (patch: Partial<TableView>) => {\n const next = { ...view, page: 0, ...patch };\n setView(next);\n emit(\n ctx,\n \"onViewChange\",\n {\n search: next.search,\n filters: JSON.stringify(next.filters),\n sort: next.sort,\n descending: next.descending,\n page: next.page,\n pageSize: next.pageSize,\n },\n JSON.stringify(next),\n );\n };\n const selectRows = (next: string[]) => {\n select(next);\n emit(ctx, \"onSelectionChange\", { ids: next });\n };\n const projected = projectTableRows(\n rows,\n view,\n Array.isArray(props.searchKeys)\n ? props.searchKeys.map(String)\n : columns.map((c) => text(c.key)),\n );\n const result =\n props.server === true\n ? {\n ...projected,\n rows,\n total:\n typeof props.total === \"number\" && Number.isFinite(props.total) && props.total >= 0\n ? props.total\n : undefined,\n page: view.page,\n }\n : projected;\n const visible = columns.filter((c) => !hidden.includes(text(c.key)));\n const pageSizes = [...new Set([10, 20, 30, 50, 100, view.pageSize])].sort((a, b) => a - b);\n const pageIds = result.rows.map((row) => text(row[rowKey]));\n const allSelected = pageIds.length > 0 && pageIds.every((id) => selectedIds.includes(id));\n const partlySelected = !allSelected && pageIds.some((id) => selectedIds.includes(id));\n const busy = props.loading === true;\n const error = text(props.error);\n return (\n <section\n data-uibot-type=\"DataTable\"\n className=\"uibot-data-table space-y-4\"\n aria-label={text(props.label, \"Records\")}\n aria-busy={busy}\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n <input\n className={`${control} w-full sm:w-64`}\n aria-label=\"Search records\"\n placeholder={text(props.searchPlaceholder, \"Filter records...\")}\n value={view.search}\n onChange={(e) => update({ search: e.target.value })}\n />\n {facets.map((facet) => (\n <details key={text(facet.key)} className=\"relative\">\n <summary className={`${control} flex cursor-pointer items-center gap-2 border-dashed`}>\n {text(facet.label)}\n {(view.filters[text(facet.key)]?.length ?? 0) > 0 && (\n <span className=\"rounded bg-muted px-1.5\">\n {view.filters[text(facet.key)]?.length}\n </span>\n )}\n </summary>\n <div className=\"absolute start-0 z-20 mt-1 min-w-44 rounded-md border bg-popover p-2 shadow-md\">\n {records(facet.options).map((option) => {\n const values = view.filters[text(facet.key)] ?? [],\n value = text(option.value);\n return (\n <label\n key={value}\n className=\"flex cursor-pointer items-center gap-2 rounded px-2 py-2 text-sm hover:bg-muted\"\n >\n <input\n type=\"checkbox\"\n checked={values.includes(value)}\n onChange={(e) =>\n update({\n filters: {\n ...view.filters,\n [text(facet.key)]: e.target.checked\n ? [...values, value]\n : values.filter((v) => v !== value),\n },\n })\n }\n />\n {text(option.label)}\n </label>\n );\n })}\n </div>\n </details>\n ))}\n {(view.search || Object.values(view.filters).some((v) => v.length)) && (\n <button\n type=\"button\"\n className={control}\n onClick={() => update({ search: \"\", filters: {} })}\n >\n Reset\n </button>\n )}\n <details className=\"relative ms-auto\">\n <summary className={`${control} flex cursor-pointer items-center`}>View</summary>\n <div className=\"absolute end-0 z-20 mt-1 min-w-40 rounded-md border bg-popover p-2 shadow-md\">\n {columns\n .filter((c) => c.hideable !== false)\n .map((c) => (\n <label key={text(c.key)} className=\"flex items-center gap-2 p-2 text-sm\">\n <input\n type=\"checkbox\"\n checked={!hidden.includes(text(c.key))}\n onChange={(e) =>\n update({\n hiddenColumns: e.target.checked\n ? hidden.filter((k) => k !== c.key)\n : [...hidden, text(c.key)],\n })\n }\n />\n {text(c.label)}\n </label>\n ))}\n </div>\n </details>\n </div>\n {error && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {error}\n </p>\n )}\n <div className=\"relative overflow-x-auto rounded-md border\">\n <table\n className=\"w-full text-start text-sm\"\n style={{ minWidth: typeof props.minWidth === \"number\" ? props.minWidth : undefined }}\n >\n <thead className=\"border-b text-muted-foreground\">\n <tr>\n {props.selectable !== false && (\n <th className=\"w-10 px-4 py-3\">\n <input\n ref={(element) => {\n if (element) element.indeterminate = partlySelected;\n }}\n aria-label=\"Select all rows on this page\"\n type=\"checkbox\"\n checked={allSelected}\n disabled={busy || !!error || !pageIds.length}\n onChange={() =>\n selectRows(\n allSelected\n ? selectedIds.filter((id) => !pageIds.includes(id))\n : [...new Set([...selectedIds, ...pageIds])],\n )\n }\n />\n </th>\n )}\n {visible.map((c) => (\n <th\n key={text(c.key)}\n scope=\"col\"\n aria-sort={\n view.sort === c.key ? (view.descending ? \"descending\" : \"ascending\") : \"none\"\n }\n className=\"whitespace-nowrap px-4 py-3 font-medium\"\n >\n <button\n type=\"button\"\n disabled={c.sortable === false}\n className=\"inline-flex items-center gap-2 hover:text-foreground\"\n onClick={() =>\n update({\n sort: text(c.key),\n descending: view.sort === c.key && !view.descending,\n })\n }\n >\n {text(c.label)}\n {view.sort === c.key && (\n <Icon name={view.descending ? \"arrow-down\" : \"arrow-up\"} size={14} />\n )}\n </button>\n </th>\n ))}\n {Array.isArray(props.actions) && (\n <th scope=\"col\">\n <span className=\"sr-only\">Actions</span>\n </th>\n )}\n </tr>\n </thead>\n <tbody>\n {result.rows.map((row) => {\n const id = text(row[rowKey]);\n return (\n <tr\n key={id}\n data-state={selectedIds.includes(id) ? \"selected\" : undefined}\n className=\"border-b last:border-b-0 hover:bg-muted/50 data-[state=selected]:bg-muted/60\"\n >\n {props.selectable !== false && (\n <td className=\"px-4 py-4\">\n <input\n type=\"checkbox\"\n aria-label={`Select row ${id}`}\n checked={selectedIds.includes(id)}\n disabled={busy || !!error}\n onChange={(e) =>\n selectRows(\n e.target.checked\n ? [...selectedIds, id]\n : selectedIds.filter((s) => s !== id),\n )\n }\n />\n </td>\n )}\n {visible.map((column) => (\n <td key={text(column.key)} className=\"max-w-lg whitespace-nowrap px-4 py-3\">\n {typeof column.badgeKey === \"string\" && (\n <span className=\"me-2 inline-flex rounded-md border px-2 py-0.5 text-xs font-medium\">\n {text(row[column.badgeKey])}\n </span>\n )}\n <span\n className={\n column.kind === \"badge\"\n ? \"inline-flex whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium\"\n : column.kind === \"muted\"\n ? \"text-muted-foreground\"\n : \"inline-block max-w-[400px] truncate align-middle font-medium\"\n }\n >\n {Array.isArray(column.displayKeys)\n ? column.displayKeys\n .map((key) => text(row[String(key)]))\n .filter(Boolean)\n .join(\" \") || \"—\"\n : text(row[text(column.key)], \"—\")}\n </span>\n </td>\n ))}\n {Array.isArray(props.actions) && (\n <td className=\"px-3\">\n <details className=\"relative\">\n <summary\n aria-label={`Actions for ${id}`}\n className=\"cursor-pointer list-none rounded px-2 py-1\"\n >\n <Icon name=\"ellipsis\" size={16} />\n </summary>\n <div className=\"absolute end-0 z-20 min-w-36 rounded-md border bg-popover p-1 shadow-md\">\n {records(props.actions).map((action) => (\n <button\n key={text(action.id)}\n type=\"button\"\n disabled={busy || action.disabled === true}\n className=\"block w-full rounded px-3 py-2 text-start text-sm hover:bg-muted disabled:opacity-50\"\n onClick={(e) => {\n e.currentTarget.closest(\"details\")?.removeAttribute(\"open\");\n emit(ctx, \"onRowAction\", {\n ...(Object.fromEntries(\n Object.entries(row).filter(\n ([, v]) =>\n v === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof v),\n ),\n ) as Record<string, string | number | boolean | null>),\n id,\n action: text(action.id),\n });\n }}\n >\n {text(action.label)}\n </button>\n ))}\n </div>\n </details>\n </td>\n )}\n </tr>\n );\n })}\n {!result.rows.length && (\n <tr>\n <td colSpan={visible.length + 2} className=\"h-28 text-center text-muted-foreground\">\n {busy\n ? \"Loading records...\"\n : error\n ? \"Records could not be loaded.\"\n : text(props.emptyText, \"No results.\")}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </div>\n <div className=\"flex flex-wrap items-center justify-between gap-4 px-1 text-sm\">\n <span className=\"text-muted-foreground\">\n {selectedIds.length}\n {result.total === undefined ? \" \" : ` of ${result.total} `}row(s) selected.\n </span>\n <div className=\"flex flex-wrap items-center gap-4\">\n <label className=\"flex items-center gap-2\">\n Rows per page\n <select\n className={control}\n value={view.pageSize}\n onChange={(e) => update({ pageSize: Number(e.target.value) })}\n >\n {pageSizes.map((n) => (\n <option key={n}>{n}</option>\n ))}\n </select>\n </label>\n <span>\n Page {result.page + 1}\n {props.server !== true ? ` of ${result.pageCount}` : \"\"}\n </span>\n <button\n type=\"button\"\n aria-label=\"Previous page\"\n className={control}\n disabled={busy || result.page === 0}\n onClick={() => update({ page: result.page - 1 })}\n >\n Previous\n </button>\n <button\n type=\"button\"\n aria-label=\"Next page\"\n className={control}\n disabled={\n busy ||\n (props.server === true\n ? props.hasNextPage !== true\n : result.page + 1 >= result.pageCount)\n }\n onClick={() => update({ page: result.page + 1 })}\n >\n Next\n </button>\n </div>\n </div>\n {selectedIds.length > 0 && records(props.bulkActions).length > 0 && (\n <div className=\"flex items-center gap-2 rounded-md border bg-muted p-2\">\n <span className=\"px-2 text-sm\">{selectedIds.length} selected</span>\n {records(props.bulkActions).map((action) => (\n <button\n key={text(action.id)}\n type=\"button\"\n className={control}\n disabled={busy || action.disabled === true}\n onClick={() =>\n emit(ctx, \"onBulkAction\", { ids: selectedIds, action: text(action.id) })\n }\n >\n {text(action.label)}\n </button>\n ))}\n <button type=\"button\" className={control} onClick={() => selectRows([])}>\n Clear selection\n </button>\n </div>\n )}\n </section>\n );\n}\nexport const DataTable: RendererComponent = (props, ctx) => (\n <DataTableView props={props} ctx={ctx} />\n);\n",
16
+ "content": "import { useState } from \"react\";\nimport type { RendererComponent } from \"@/lib/uibot-renderer\";\nimport { Icon } from \"./icons\";\nimport { emit, records, text, type BlockContext } from \"./interaction\";\n\nexport interface TableView {\n search: string;\n filters: Record<string, string[]>;\n sort: string;\n descending: boolean;\n page: number;\n pageSize: number;\n hiddenColumns?: string[];\n}\nexport function projectTableRows(\n rows: Record<string, unknown>[],\n view: TableView,\n searchKeys: string[],\n) {\n const query = view.search.toLocaleLowerCase();\n const filtered = rows.filter(\n (row) =>\n (!query || searchKeys.some((key) => text(row[key]).toLocaleLowerCase().includes(query))) &&\n Object.entries(view.filters).every(\n ([key, values]) => !values.length || values.includes(text(row[key])),\n ),\n );\n if (view.sort)\n filtered.sort((a, b) => {\n const x = a[view.sort],\n y = b[view.sort];\n const cmp =\n typeof x === \"number\" && typeof y === \"number\"\n ? x - y\n : text(x).localeCompare(text(y), undefined, { numeric: true });\n return view.descending ? -cmp : cmp;\n });\n const pageSize = Math.max(1, Math.min(200, Math.floor(view.pageSize) || 10));\n const pageCount = Math.max(1, Math.ceil(filtered.length / pageSize));\n const page = Math.max(0, Math.min(Math.floor(view.page) || 0, pageCount - 1));\n return {\n rows: filtered.slice(page * pageSize, (page + 1) * pageSize),\n total: filtered.length,\n page,\n pageCount,\n };\n}\nconst control =\n \"h-9 rounded-md border bg-background px-3 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40\";\nconst tableCopy = {\n en: {\n records: \"Records\",\n search: \"Search records\",\n placeholder: \"Filter records...\",\n reset: \"Reset\",\n view: \"View\",\n selectAll: \"Select all rows on this page\",\n selectRow: (id: string) => `Select row ${id}`,\n actions: \"Actions\",\n rowActions: (id: string) => `Actions for ${id}`,\n loading: \"Loading records...\",\n error: \"Records could not be loaded.\",\n empty: \"No results.\",\n selection: (count: number, total?: number) =>\n `${count}${total === undefined ? \" \" : ` of ${total} `}row(s) selected.`,\n pageSize: \"Rows per page\",\n page: (page: number, total?: number) =>\n `Page ${page}${total === undefined ? \"\" : ` of ${total}`}`,\n previous: \"Previous\",\n previousPage: \"Previous page\",\n next: \"Next\",\n nextPage: \"Next page\",\n selected: (count: number) => `${count} selected`,\n clear: \"Clear selection\",\n },\n \"zh-CN\": {\n records: \"记录\",\n search: \"搜索记录\",\n placeholder: \"筛选记录…\",\n reset: \"重置\",\n view: \"显示列\",\n selectAll: \"选择本页全部记录\",\n selectRow: (id: string) => `选择记录 ${id}`,\n actions: \"操作\",\n rowActions: (id: string) => `记录 ${id} 的操作`,\n loading: \"正在加载记录…\",\n error: \"无法加载记录\",\n empty: \"暂无结果\",\n selection: (count: number, total?: number) =>\n `已选择 ${count} 条${total === undefined ? \"\" : `,共 ${total} 条`}`,\n pageSize: \"每页条数\",\n page: (page: number, total?: number) =>\n `第 ${page} 页${total === undefined ? \"\" : `,共 ${total} 页`}`,\n previous: \"上一页\",\n previousPage: \"上一页\",\n next: \"下一页\",\n nextPage: \"下一页\",\n selected: (count: number) => `已选择 ${count} 条`,\n clear: \"清除选择\",\n },\n};\nfunction DataTableView({ props, ctx }: { props: Record<string, unknown>; ctx: BlockContext }) {\n const copy = tableCopy[props.locale === \"zh-CN\" ? \"zh-CN\" : \"en\"];\n const rows = records(props.rows),\n columns = records(props.columns),\n facets = records(props.filters);\n const rowKey = text(props.rowKey, \"id\");\n const [localView, setView] = useState<TableView>({\n search: \"\",\n filters: {},\n sort: \"\",\n descending: false,\n page: 0,\n pageSize: Number(props.pageSize) || 10,\n hiddenColumns: [],\n });\n let supplied: unknown = props.view;\n if (typeof supplied === \"string\") {\n try {\n supplied = JSON.parse(supplied);\n } catch {\n supplied = {};\n }\n }\n const raw = supplied && typeof supplied === \"object\" ? (supplied as Record<string, unknown>) : {};\n const view: TableView = {\n ...localView,\n hiddenColumns: Array.isArray(raw.hiddenColumns)\n ? raw.hiddenColumns.filter((x): x is string => typeof x === \"string\")\n : (localView.hiddenColumns ?? []),\n search: typeof raw.search === \"string\" ? raw.search : localView.search,\n sort: typeof raw.sort === \"string\" ? raw.sort : localView.sort,\n descending: typeof raw.descending === \"boolean\" ? raw.descending : localView.descending,\n page:\n typeof raw.page === \"number\" && Number.isFinite(raw.page)\n ? Math.max(0, Math.floor(raw.page))\n : localView.page,\n pageSize:\n typeof raw.pageSize === \"number\" && Number.isFinite(raw.pageSize)\n ? Math.max(1, Math.min(200, Math.floor(raw.pageSize)))\n : localView.pageSize,\n filters:\n raw.filters && typeof raw.filters === \"object\"\n ? Object.fromEntries(\n Object.entries(raw.filters)\n .filter(([, v]) => Array.isArray(v))\n .map(([k, v]) => [\n k,\n (v as unknown[]).filter((x): x is string => typeof x === \"string\"),\n ]),\n )\n : localView.filters,\n };\n const [selected, select] = useState<string[]>([]);\n const hidden = view.hiddenColumns ?? [];\n const ids = new Set(rows.map((r) => text(r[rowKey])));\n const selectedIds = (\n Array.isArray(props.selectedIds) ? props.selectedIds.map(String) : selected\n ).filter((id) => props.server === true || ids.has(id));\n const update = (patch: Partial<TableView>) => {\n const next = { ...view, page: 0, ...patch };\n setView(next);\n emit(\n ctx,\n \"onViewChange\",\n {\n search: next.search,\n filters: JSON.stringify(next.filters),\n sort: next.sort,\n descending: next.descending,\n page: next.page,\n pageSize: next.pageSize,\n },\n JSON.stringify(next),\n );\n };\n const selectRows = (next: string[]) => {\n select(next);\n emit(ctx, \"onSelectionChange\", { ids: next });\n };\n const projected = projectTableRows(\n rows,\n view,\n Array.isArray(props.searchKeys)\n ? props.searchKeys.map(String)\n : columns.map((c) => text(c.key)),\n );\n const result =\n props.server === true\n ? {\n ...projected,\n rows,\n total:\n typeof props.total === \"number\" && Number.isFinite(props.total) && props.total >= 0\n ? props.total\n : undefined,\n page: view.page,\n }\n : projected;\n const visible = columns.filter((c) => !hidden.includes(text(c.key)));\n const pageSizes = [...new Set([10, 20, 30, 50, 100, view.pageSize])].sort((a, b) => a - b);\n const pageIds = result.rows.map((row) => text(row[rowKey]));\n const allSelected = pageIds.length > 0 && pageIds.every((id) => selectedIds.includes(id));\n const partlySelected = !allSelected && pageIds.some((id) => selectedIds.includes(id));\n const busy = props.loading === true;\n const error = text(props.error);\n return (\n <section\n data-uibot-type=\"DataTable\"\n className=\"uibot-data-table space-y-4\"\n aria-label={text(props.label, copy.records)}\n aria-busy={busy}\n >\n <div className=\"flex flex-wrap items-center gap-2\">\n <input\n className={`${control} w-full sm:w-64`}\n aria-label={copy.search}\n placeholder={text(props.searchPlaceholder, copy.placeholder)}\n value={view.search}\n onChange={(e) => update({ search: e.target.value })}\n />\n {facets.map((facet) => (\n <details key={text(facet.key)} className=\"relative\">\n <summary className={`${control} flex cursor-pointer items-center gap-2 border-dashed`}>\n {text(facet.label)}\n {(view.filters[text(facet.key)]?.length ?? 0) > 0 && (\n <span className=\"rounded bg-muted px-1.5\">\n {view.filters[text(facet.key)]?.length}\n </span>\n )}\n </summary>\n <div className=\"absolute start-0 z-20 mt-1 min-w-44 rounded-md border bg-popover p-2 shadow-md\">\n {records(facet.options).map((option) => {\n const values = view.filters[text(facet.key)] ?? [],\n value = text(option.value);\n return (\n <label\n key={value}\n className=\"flex cursor-pointer items-center gap-2 rounded px-2 py-2 text-sm hover:bg-muted\"\n >\n <input\n type=\"checkbox\"\n checked={values.includes(value)}\n onChange={(e) =>\n update({\n filters: {\n ...view.filters,\n [text(facet.key)]: e.target.checked\n ? [...values, value]\n : values.filter((v) => v !== value),\n },\n })\n }\n />\n {text(option.label)}\n </label>\n );\n })}\n </div>\n </details>\n ))}\n {(view.search || Object.values(view.filters).some((v) => v.length)) && (\n <button\n type=\"button\"\n className={control}\n onClick={() => update({ search: \"\", filters: {} })}\n >\n {copy.reset}\n </button>\n )}\n <details className=\"relative ms-auto\">\n <summary className={`${control} flex cursor-pointer items-center`}>{copy.view}</summary>\n <div className=\"absolute end-0 z-20 mt-1 min-w-40 rounded-md border bg-popover p-2 shadow-md\">\n {columns\n .filter((c) => c.hideable !== false)\n .map((c) => (\n <label key={text(c.key)} className=\"flex items-center gap-2 p-2 text-sm\">\n <input\n type=\"checkbox\"\n checked={!hidden.includes(text(c.key))}\n onChange={(e) =>\n update({\n hiddenColumns: e.target.checked\n ? hidden.filter((k) => k !== c.key)\n : [...hidden, text(c.key)],\n })\n }\n />\n {text(c.label)}\n </label>\n ))}\n </div>\n </details>\n </div>\n {error && (\n <p role=\"alert\" className=\"text-sm text-destructive\">\n {error}\n </p>\n )}\n <div className=\"relative overflow-x-auto rounded-md border\">\n <table\n className=\"w-full text-start text-sm\"\n style={{ minWidth: typeof props.minWidth === \"number\" ? props.minWidth : undefined }}\n >\n <thead className=\"border-b text-muted-foreground\">\n <tr>\n {props.selectable !== false && (\n <th className=\"w-10 px-4 py-3\">\n <input\n ref={(element) => {\n if (element) element.indeterminate = partlySelected;\n }}\n aria-label={copy.selectAll}\n type=\"checkbox\"\n checked={allSelected}\n disabled={busy || !!error || !pageIds.length}\n onChange={() =>\n selectRows(\n allSelected\n ? selectedIds.filter((id) => !pageIds.includes(id))\n : [...new Set([...selectedIds, ...pageIds])],\n )\n }\n />\n </th>\n )}\n {visible.map((c) => (\n <th\n key={text(c.key)}\n scope=\"col\"\n aria-sort={\n view.sort === c.key ? (view.descending ? \"descending\" : \"ascending\") : \"none\"\n }\n className=\"whitespace-nowrap px-4 py-3 font-medium\"\n >\n <button\n type=\"button\"\n disabled={c.sortable === false}\n className=\"inline-flex items-center gap-2 hover:text-foreground\"\n onClick={() =>\n update({\n sort: text(c.key),\n descending: view.sort === c.key && !view.descending,\n })\n }\n >\n {text(c.label)}\n {view.sort === c.key && (\n <Icon name={view.descending ? \"arrow-down\" : \"arrow-up\"} size={14} />\n )}\n </button>\n </th>\n ))}\n {Array.isArray(props.actions) && (\n <th scope=\"col\">\n <span className=\"sr-only\">{copy.actions}</span>\n </th>\n )}\n </tr>\n </thead>\n <tbody>\n {result.rows.map((row) => {\n const id = text(row[rowKey]);\n return (\n <tr\n key={id}\n data-state={selectedIds.includes(id) ? \"selected\" : undefined}\n className=\"border-b last:border-b-0 hover:bg-muted/50 data-[state=selected]:bg-muted/60\"\n >\n {props.selectable !== false && (\n <td className=\"px-4 py-4\">\n <input\n type=\"checkbox\"\n aria-label={copy.selectRow(id)}\n checked={selectedIds.includes(id)}\n disabled={busy || !!error}\n onChange={(e) =>\n selectRows(\n e.target.checked\n ? [...selectedIds, id]\n : selectedIds.filter((s) => s !== id),\n )\n }\n />\n </td>\n )}\n {visible.map((column) => (\n <td key={text(column.key)} className=\"max-w-lg whitespace-nowrap px-4 py-3\">\n {typeof column.badgeKey === \"string\" && (\n <span className=\"me-2 inline-flex rounded-md border px-2 py-0.5 text-xs font-medium\">\n {text(row[column.badgeKey])}\n </span>\n )}\n <span\n className={\n column.kind === \"badge\"\n ? \"inline-flex whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium\"\n : column.kind === \"muted\"\n ? \"text-muted-foreground\"\n : \"inline-block max-w-[400px] truncate align-middle font-medium\"\n }\n >\n {Array.isArray(column.displayKeys)\n ? column.displayKeys\n .map((key) => text(row[String(key)]))\n .filter(Boolean)\n .join(\" \") || \"—\"\n : text(row[text(column.key)], \"—\")}\n </span>\n </td>\n ))}\n {Array.isArray(props.actions) && (\n <td className=\"px-3\">\n <details className=\"relative\">\n <summary\n aria-label={copy.rowActions(id)}\n className=\"cursor-pointer list-none rounded px-2 py-1\"\n >\n <Icon name=\"ellipsis\" size={16} />\n </summary>\n <div className=\"absolute end-0 z-20 min-w-36 rounded-md border bg-popover p-1 shadow-md\">\n {records(props.actions).map((action) => (\n <button\n key={text(action.id)}\n type=\"button\"\n disabled={busy || action.disabled === true}\n className=\"block w-full rounded px-3 py-2 text-start text-sm hover:bg-muted disabled:opacity-50\"\n onClick={(e) => {\n e.currentTarget.closest(\"details\")?.removeAttribute(\"open\");\n emit(ctx, \"onRowAction\", {\n ...(Object.fromEntries(\n Object.entries(row).filter(\n ([, v]) =>\n v === null ||\n [\"string\", \"number\", \"boolean\"].includes(typeof v),\n ),\n ) as Record<string, string | number | boolean | null>),\n id,\n action: text(action.id),\n });\n }}\n >\n {text(action.label)}\n </button>\n ))}\n </div>\n </details>\n </td>\n )}\n </tr>\n );\n })}\n {!result.rows.length && (\n <tr>\n <td colSpan={visible.length + 2} className=\"h-28 text-center text-muted-foreground\">\n {busy ? copy.loading : error ? copy.error : text(props.emptyText, copy.empty)}\n </td>\n </tr>\n )}\n </tbody>\n </table>\n </div>\n <div className=\"flex flex-wrap items-center justify-between gap-4 px-1 text-sm\">\n <span className=\"text-muted-foreground\">\n {copy.selection(selectedIds.length, result.total)}\n </span>\n <div className=\"flex flex-wrap items-center gap-4\">\n <label className=\"flex items-center gap-2\">\n {copy.pageSize}\n <select\n className={control}\n value={view.pageSize}\n onChange={(e) => update({ pageSize: Number(e.target.value) })}\n >\n {pageSizes.map((n) => (\n <option key={n}>{n}</option>\n ))}\n </select>\n </label>\n <span>\n {copy.page(result.page + 1, props.server !== true ? result.pageCount : undefined)}\n </span>\n <button\n type=\"button\"\n aria-label={copy.previousPage}\n className={control}\n disabled={busy || result.page === 0}\n onClick={() => update({ page: result.page - 1 })}\n >\n {copy.previous}\n </button>\n <button\n type=\"button\"\n aria-label={copy.nextPage}\n className={control}\n disabled={\n busy ||\n (props.server === true\n ? props.hasNextPage !== true\n : result.page + 1 >= result.pageCount)\n }\n onClick={() => update({ page: result.page + 1 })}\n >\n {copy.next}\n </button>\n </div>\n </div>\n {selectedIds.length > 0 && records(props.bulkActions).length > 0 && (\n <div className=\"flex items-center gap-2 rounded-md border bg-muted p-2\">\n <span className=\"px-2 text-sm\">{copy.selected(selectedIds.length)}</span>\n {records(props.bulkActions).map((action) => (\n <button\n key={text(action.id)}\n type=\"button\"\n className={control}\n disabled={busy || action.disabled === true}\n onClick={() =>\n emit(ctx, \"onBulkAction\", { ids: selectedIds, action: text(action.id) })\n }\n >\n {text(action.label)}\n </button>\n ))}\n <button type=\"button\" className={control} onClick={() => selectRows([])}>\n {copy.clear}\n </button>\n </div>\n )}\n </section>\n );\n}\nexport const DataTable: RendererComponent = (props, ctx) => (\n <DataTableView props={props} ctx={ctx} />\n);\n",
17
17
  "type": "registry:ui"
18
18
  },
19
19
  {
@@ -31,7 +31,7 @@
31
31
  {
32
32
  "path": "components/uibot/data-table.uibot.json",
33
33
  "target": "components/uibot/data-table.uibot.json",
34
- "content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"data-table\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"DataTable\",\n \"export\": \"DataTable\",\n \"module\": \"data-table.tsx\",\n \"catalog\": {\n \"name\": \"DataTable\",\n \"description\": \"Configurable record table with search, facets, sorting, stable selection and pagination. Server mode emits query intent without filtering current-page rows.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"table\",\n \"records\",\n \"admin\"\n ],\n \"props\": {\n \"rows\": {\n \"type\": \"array\"\n },\n \"columns\": {\n \"type\": \"array\"\n },\n \"filters\": {\n \"type\": \"array\"\n },\n \"actions\": {\n \"type\": \"array\"\n },\n \"bulkActions\": {\n \"type\": \"array\"\n },\n \"rowKey\": {\n \"type\": \"string\",\n \"default\": \"id\"\n },\n \"searchKeys\": {\n \"type\": \"array\"\n },\n \"selectedIds\": {\n \"type\": \"array\"\n },\n \"view\": {\n \"description\": \"Controlled TableView object or JSON-encoded URL view\"\n },\n \"pageSize\": {\n \"type\": \"number\",\n \"default\": 10\n },\n \"server\": {\n \"type\": \"boolean\"\n },\n \"total\": {\n \"type\": \"number\"\n },\n \"hasNextPage\": {\n \"type\": \"boolean\"\n },\n \"loading\": {\n \"type\": \"boolean\"\n },\n \"error\": {\n \"type\": \"string\"\n },\n \"minWidth\": {\n \"type\": \"number\"\n },\n \"searchPlaceholder\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"selectable\": {\n \"type\": \"boolean\"\n },\n \"emptyText\": {\n \"type\": \"string\"\n }\n },\n \"events\": {\n \"onViewChange\": {\n \"description\": \"Query intent in event.values: search, filters JSON, sort, descending, page, pageSize\"\n },\n \"onSelectionChange\": {\n \"description\": \"Stable ids in event.values.ids\"\n },\n \"onRowAction\": {\n \"description\": \"event.values.id and action\"\n },\n \"onBulkAction\": {\n \"description\": \"event.values.ids and action\"\n }\n }\n }\n }\n ]\n}\n",
34
+ "content": "{\n \"schema\": \"uibot.registry.item.v1\",\n \"item\": \"data-table\",\n \"channel\": \"public\",\n \"components\": [\n {\n \"name\": \"DataTable\",\n \"export\": \"DataTable\",\n \"module\": \"data-table.tsx\",\n \"catalog\": {\n \"name\": \"DataTable\",\n \"description\": \"Configurable record table with search, facets, sorting, stable selection and pagination. Server mode emits query intent without filtering current-page rows.\",\n \"category\": \"composite\",\n \"level\": \"L2\",\n \"tags\": [\n \"table\",\n \"records\",\n \"admin\"\n ],\n \"props\": {\n \"locale\": {\n \"type\": \"string\",\n \"enum\": [\n \"en\",\n \"zh-CN\"\n ],\n \"default\": \"en\",\n \"description\": \"Language for controls, status and accessible labels\"\n },\n \"rows\": {\n \"type\": \"array\"\n },\n \"columns\": {\n \"type\": \"array\"\n },\n \"filters\": {\n \"type\": \"array\"\n },\n \"actions\": {\n \"type\": \"array\"\n },\n \"bulkActions\": {\n \"type\": \"array\"\n },\n \"rowKey\": {\n \"type\": \"string\",\n \"default\": \"id\"\n },\n \"searchKeys\": {\n \"type\": \"array\"\n },\n \"selectedIds\": {\n \"type\": \"array\"\n },\n \"view\": {\n \"description\": \"TableView or URL view JSON\"\n },\n \"pageSize\": {\n \"type\": \"number\",\n \"default\": 10\n },\n \"server\": {\n \"type\": \"boolean\"\n },\n \"total\": {\n \"type\": \"number\"\n },\n \"hasNextPage\": {\n \"type\": \"boolean\"\n },\n \"loading\": {\n \"type\": \"boolean\"\n },\n \"error\": {\n \"type\": \"string\"\n },\n \"minWidth\": {\n \"type\": \"number\"\n },\n \"searchPlaceholder\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"selectable\": {\n \"type\": \"boolean\"\n },\n \"emptyText\": {\n \"type\": \"string\"\n }\n },\n \"events\": {\n \"onViewChange\": {\n \"description\": \"event.values query: search, filters JSON, sort, descending, page, pageSize\"\n },\n \"onSelectionChange\": {\n \"description\": \"Stable ids in event.values.ids\"\n },\n \"onRowAction\": {\n \"description\": \"event.values.id and action\"\n },\n \"onBulkAction\": {\n \"description\": \"event.values.ids and action\"\n }\n }\n }\n }\n ]\n}\n",
35
35
  "type": "registry:ui"
36
36
  }
37
37
  ],
@@ -39,6 +39,15 @@
39
39
  "category": "composite",
40
40
  "level": "L2",
41
41
  "props": {
42
+ "locale": {
43
+ "type": "string",
44
+ "enum": [
45
+ "en",
46
+ "zh-CN"
47
+ ],
48
+ "default": "en",
49
+ "description": "Language for controls, status and accessible labels"
50
+ },
42
51
  "rows": {
43
52
  "type": "array"
44
53
  },
@@ -65,7 +74,7 @@
65
74
  "type": "array"
66
75
  },
67
76
  "view": {
68
- "description": "Controlled TableView object or JSON-encoded URL view"
77
+ "description": "TableView or URL view JSON"
69
78
  },
70
79
  "pageSize": {
71
80
  "type": "number",
@@ -104,7 +113,7 @@
104
113
  },
105
114
  "events": {
106
115
  "onViewChange": {
107
- "description": "Query intent in event.values: search, filters JSON, sort, descending, page, pageSize"
116
+ "description": "event.values query: search, filters JSON, sort, descending, page, pageSize"
108
117
  },
109
118
  "onSelectionChange": {
110
119
  "description": "Stable ids in event.values.ids"
@@ -139,6 +148,15 @@
139
148
  "admin"
140
149
  ],
141
150
  "props": {
151
+ "locale": {
152
+ "type": "string",
153
+ "enum": [
154
+ "en",
155
+ "zh-CN"
156
+ ],
157
+ "default": "en",
158
+ "description": "Language for controls, status and accessible labels"
159
+ },
142
160
  "rows": {
143
161
  "type": "array"
144
162
  },
@@ -165,7 +183,7 @@
165
183
  "type": "array"
166
184
  },
167
185
  "view": {
168
- "description": "Controlled TableView object or JSON-encoded URL view"
186
+ "description": "TableView or URL view JSON"
169
187
  },
170
188
  "pageSize": {
171
189
  "type": "number",
@@ -204,7 +222,7 @@
204
222
  },
205
223
  "events": {
206
224
  "onViewChange": {
207
- "description": "Query intent in event.values: search, filters JSON, sort, descending, page, pageSize"
225
+ "description": "event.values query: search, filters JSON, sort, descending, page, pageSize"
208
226
  },
209
227
  "onSelectionChange": {
210
228
  "description": "Stable ids in event.values.ids"