@uibot/registry 0.16.0 → 0.18.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/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/feedback.json +1 -1
- package/dist/shadcn/registry.json +18 -18
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Design-system cell editors for PagedCollectionGrid's renderCellEditor: text, number, long text, checkbox, single/multiple select, calendar dates (timestamps keep their time) and a searchable relation picker.",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"react",
|
|
8
|
-
"@uibot/renderer-react@^0.
|
|
8
|
+
"@uibot/renderer-react@^0.18.0",
|
|
9
9
|
"cmdk@^1",
|
|
10
10
|
"date-fns@^4",
|
|
11
11
|
"lucide-react",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Right-hand drawer for PagedCollectionWorkspace's renderPanel; a busy panel stays open and unsaved edits ask before closing.",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"react",
|
|
8
|
-
"@uibot/renderer-react@^0.
|
|
8
|
+
"@uibot/renderer-react@^0.18.0"
|
|
9
9
|
],
|
|
10
10
|
"registryDependencies": [
|
|
11
11
|
"button",
|
|
@@ -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.18.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.18.0",
|
|
9
|
+
"@uibot/creation-kit@^0.18.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.18.0",
|
|
9
|
+
"@uibot/creation-kit@^0.18.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.18.0",
|
|
9
|
+
"@uibot/creation-kit@^0.18.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.18.0",
|
|
9
|
+
"@uibot/creation-kit@^0.18.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.18.0",
|
|
9
|
+
"@uibot/creation-kit@^0.18.0",
|
|
10
|
+
"@uibot/web-preview@^0.18.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.18.0",
|
|
9
|
+
"@uibot/creation-kit@^0.18.0",
|
|
10
|
+
"@uibot/web-preview@^0.18.0"
|
|
11
11
|
],
|
|
12
12
|
"registryDependencies": [
|
|
13
13
|
"button",
|
|
@@ -13,7 +13,7 @@
|
|
|
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\";\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 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",
|
|
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
17
|
"type": "registry:ui"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
@@ -541,8 +541,8 @@
|
|
|
541
541
|
"registryDependencies": [],
|
|
542
542
|
"dependencies": [
|
|
543
543
|
"react",
|
|
544
|
-
"@uibot/contracts@^0.
|
|
545
|
-
"@uibot/creation-kit@^0.
|
|
544
|
+
"@uibot/contracts@^0.18.0",
|
|
545
|
+
"@uibot/creation-kit@^0.18.0"
|
|
546
546
|
]
|
|
547
547
|
},
|
|
548
548
|
{
|
|
@@ -557,8 +557,8 @@
|
|
|
557
557
|
],
|
|
558
558
|
"dependencies": [
|
|
559
559
|
"react",
|
|
560
|
-
"@uibot/contracts@^0.
|
|
561
|
-
"@uibot/creation-kit@^0.
|
|
560
|
+
"@uibot/contracts@^0.18.0",
|
|
561
|
+
"@uibot/creation-kit@^0.18.0"
|
|
562
562
|
]
|
|
563
563
|
},
|
|
564
564
|
{
|
|
@@ -573,8 +573,8 @@
|
|
|
573
573
|
],
|
|
574
574
|
"dependencies": [
|
|
575
575
|
"react",
|
|
576
|
-
"@uibot/contracts@^0.
|
|
577
|
-
"@uibot/creation-kit@^0.
|
|
576
|
+
"@uibot/contracts@^0.18.0",
|
|
577
|
+
"@uibot/creation-kit@^0.18.0"
|
|
578
578
|
]
|
|
579
579
|
},
|
|
580
580
|
{
|
|
@@ -587,8 +587,8 @@
|
|
|
587
587
|
],
|
|
588
588
|
"dependencies": [
|
|
589
589
|
"react",
|
|
590
|
-
"@uibot/contracts@^0.
|
|
591
|
-
"@uibot/creation-kit@^0.
|
|
590
|
+
"@uibot/contracts@^0.18.0",
|
|
591
|
+
"@uibot/creation-kit@^0.18.0"
|
|
592
592
|
]
|
|
593
593
|
},
|
|
594
594
|
{
|
|
@@ -604,9 +604,9 @@
|
|
|
604
604
|
],
|
|
605
605
|
"dependencies": [
|
|
606
606
|
"react",
|
|
607
|
-
"@uibot/contracts@^0.
|
|
608
|
-
"@uibot/creation-kit@^0.
|
|
609
|
-
"@uibot/web-preview@^0.
|
|
607
|
+
"@uibot/contracts@^0.18.0",
|
|
608
|
+
"@uibot/creation-kit@^0.18.0",
|
|
609
|
+
"@uibot/web-preview@^0.18.0"
|
|
610
610
|
]
|
|
611
611
|
},
|
|
612
612
|
{
|
|
@@ -626,9 +626,9 @@
|
|
|
626
626
|
],
|
|
627
627
|
"dependencies": [
|
|
628
628
|
"react",
|
|
629
|
-
"@uibot/contracts@^0.
|
|
630
|
-
"@uibot/creation-kit@^0.
|
|
631
|
-
"@uibot/web-preview@^0.
|
|
629
|
+
"@uibot/contracts@^0.18.0",
|
|
630
|
+
"@uibot/creation-kit@^0.18.0",
|
|
631
|
+
"@uibot/web-preview@^0.18.0"
|
|
632
632
|
]
|
|
633
633
|
},
|
|
634
634
|
{
|
|
@@ -638,7 +638,7 @@
|
|
|
638
638
|
"registryDependencies": [],
|
|
639
639
|
"dependencies": [
|
|
640
640
|
"react",
|
|
641
|
-
"@uibot/renderer-react@^0.
|
|
641
|
+
"@uibot/renderer-react@^0.18.0"
|
|
642
642
|
]
|
|
643
643
|
},
|
|
644
644
|
{
|
|
@@ -656,7 +656,7 @@
|
|
|
656
656
|
],
|
|
657
657
|
"dependencies": [
|
|
658
658
|
"react",
|
|
659
|
-
"@uibot/renderer-react@^0.
|
|
659
|
+
"@uibot/renderer-react@^0.18.0",
|
|
660
660
|
"cmdk@^1",
|
|
661
661
|
"date-fns@^4",
|
|
662
662
|
"lucide-react",
|
|
@@ -673,7 +673,7 @@
|
|
|
673
673
|
],
|
|
674
674
|
"dependencies": [
|
|
675
675
|
"react",
|
|
676
|
-
"@uibot/renderer-react@^0.
|
|
676
|
+
"@uibot/renderer-react@^0.18.0"
|
|
677
677
|
]
|
|
678
678
|
},
|
|
679
679
|
{
|
|
@@ -687,7 +687,7 @@
|
|
|
687
687
|
],
|
|
688
688
|
"dependencies": [
|
|
689
689
|
"react",
|
|
690
|
-
"@uibot/renderer-react@^0.
|
|
690
|
+
"@uibot/renderer-react@^0.18.0"
|
|
691
691
|
]
|
|
692
692
|
},
|
|
693
693
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uibot/registry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@uibot/contracts": "^0.
|
|
34
|
+
"@uibot/contracts": "^0.18.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "rm -rf dist tsconfig.tsbuildinfo && bun build --minify ./src/index.ts ./src/resources.ts --outdir ./dist --format esm --target bun && bun x tsc -b",
|