@tc96/cli 0.0.0-stage → 0.27.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 (200) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +213 -2
  3. package/cli.js +1395 -0
  4. package/package.json +35 -4
  5. package/registry/agent-builder.json +503 -0
  6. package/registry/aggregate.json +4 -0
  7. package/registry/app-shell-1.json +81 -0
  8. package/registry/app-shell-2.json +89 -0
  9. package/registry/app-shell-3.json +109 -0
  10. package/registry/app-shell-4.json +104 -0
  11. package/registry/app-shell-5.json +106 -0
  12. package/registry/bulk-import-1.json +151 -0
  13. package/registry/card-1.json +104 -0
  14. package/registry/card-2.json +97 -0
  15. package/registry/card-3.json +104 -0
  16. package/registry/card-4.json +98 -0
  17. package/registry/card-5.json +85 -0
  18. package/registry/card-6.json +98 -0
  19. package/registry/card-7.json +104 -0
  20. package/registry/card-8.json +106 -0
  21. package/registry/card-9.json +92 -0
  22. package/registry/charts.json +30 -0
  23. package/registry/chat-assistant.json +110 -0
  24. package/registry/chats-panel.json +97 -0
  25. package/registry/checklist.json +307 -0
  26. package/registry/collection-layouts.json +836 -0
  27. package/registry/collection-views.json +836 -0
  28. package/registry/collection.json +831 -0
  29. package/registry/dashboard-1.json +160 -0
  30. package/registry/dashboard-2.json +153 -0
  31. package/registry/dashboard-3.json +154 -0
  32. package/registry/dashboard-4.json +168 -0
  33. package/registry/detail-sheet.json +54 -0
  34. package/registry/editable.json +36 -0
  35. package/registry/empty-state-1.json +40 -0
  36. package/registry/empty-state-2.json +39 -0
  37. package/registry/empty-state-3.json +61 -0
  38. package/registry/empty-state-4.json +39 -0
  39. package/registry/empty-state-5.json +47 -0
  40. package/registry/empty-state-6.json +40 -0
  41. package/registry/flow-canvas.json +198 -0
  42. package/registry/flow-inspector.json +151 -0
  43. package/registry/flow-step-library.json +112 -0
  44. package/registry/forgot-password-1.json +73 -0
  45. package/registry/forgot-password-2.json +73 -0
  46. package/registry/icon-row.json +52 -0
  47. package/registry/impact-map.json +75 -0
  48. package/registry/list-1.json +129 -0
  49. package/registry/list-2.json +117 -0
  50. package/registry/list-3.json +129 -0
  51. package/registry/list-4.json +105 -0
  52. package/registry/list-5.json +98 -0
  53. package/registry/list-6.json +92 -0
  54. package/registry/list.json +52 -0
  55. package/registry/login-1.json +89 -0
  56. package/registry/login-10.json +88 -0
  57. package/registry/login-2.json +81 -0
  58. package/registry/login-3.json +90 -0
  59. package/registry/login-4.json +81 -0
  60. package/registry/login-5.json +82 -0
  61. package/registry/login-6.json +88 -0
  62. package/registry/login-7.json +83 -0
  63. package/registry/login-8.json +81 -0
  64. package/registry/login-9.json +88 -0
  65. package/registry/lookup-create-1.json +157 -0
  66. package/registry/magic-link-6.json +79 -0
  67. package/registry/navbar-1.json +66 -0
  68. package/registry/navbar-2.json +48 -0
  69. package/registry/navbar-3.json +50 -0
  70. package/registry/navbar-4.json +39 -0
  71. package/registry/navbar-5.json +50 -0
  72. package/registry/next-steps-1.json +147 -0
  73. package/registry/onboarding-1.json +114 -0
  74. package/registry/onboarding-2.json +78 -0
  75. package/registry/onboarding-3.json +71 -0
  76. package/registry/otp-1.json +73 -0
  77. package/registry/properties.json +523 -0
  78. package/registry/record-dialog.json +88 -0
  79. package/registry/record-group.json +190 -0
  80. package/registry/record-preview.json +70 -0
  81. package/registry/record-status-list.json +70 -0
  82. package/registry/reset-password-1.json +92 -0
  83. package/registry/reset-password-2.json +98 -0
  84. package/registry/reset-password-6.json +91 -0
  85. package/registry/rich-text-editor.json +93 -0
  86. package/registry/run-monitor.json +198 -0
  87. package/registry/settings-1.json +119 -0
  88. package/registry/settings-10.json +218 -0
  89. package/registry/settings-11.json +129 -0
  90. package/registry/settings-12.json +130 -0
  91. package/registry/settings-13.json +130 -0
  92. package/registry/settings-14.json +173 -0
  93. package/registry/settings-15.json +149 -0
  94. package/registry/settings-16.json +129 -0
  95. package/registry/settings-17.json +117 -0
  96. package/registry/settings-18.json +117 -0
  97. package/registry/settings-19.json +125 -0
  98. package/registry/settings-2.json +123 -0
  99. package/registry/settings-20.json +112 -0
  100. package/registry/settings-21.json +116 -0
  101. package/registry/settings-22.json +118 -0
  102. package/registry/settings-23.json +118 -0
  103. package/registry/settings-3.json +123 -0
  104. package/registry/settings-4.json +116 -0
  105. package/registry/settings-5.json +119 -0
  106. package/registry/settings-6.json +125 -0
  107. package/registry/settings-7.json +128 -0
  108. package/registry/settings-8.json +116 -0
  109. package/registry/settings-9.json +118 -0
  110. package/registry/settings-shell.json +60 -0
  111. package/registry/settings.json +82 -0
  112. package/registry/signup-1.json +100 -0
  113. package/registry/signup-2.json +93 -0
  114. package/registry/signup-3.json +83 -0
  115. package/registry/signup-6.json +99 -0
  116. package/registry/state-surface.json +58 -0
  117. package/registry/stats-1.json +116 -0
  118. package/registry/stats-2.json +115 -0
  119. package/registry/stats-3.json +97 -0
  120. package/registry/stats-4.json +92 -0
  121. package/registry/stats-5.json +103 -0
  122. package/registry/stats-6.json +105 -0
  123. package/registry/stats-7.json +103 -0
  124. package/registry/stats.json +64 -0
  125. package/registry/timeline-1.json +97 -0
  126. package/registry/timeline-2.json +102 -0
  127. package/registry/timeline-3.json +68 -0
  128. package/registry/timeline-4.json +86 -0
  129. package/registry/ui/accordion.json +15 -0
  130. package/registry/ui/alert-dialog.json +14 -0
  131. package/registry/ui/alert.json +50 -0
  132. package/registry/ui/autocomplete.json +18 -0
  133. package/registry/ui/avatar.json +14 -0
  134. package/registry/ui/badge.json +51 -0
  135. package/registry/ui/breadcrumb.json +15 -0
  136. package/registry/ui/button.json +25 -0
  137. package/registry/ui/calendar.json +15 -0
  138. package/registry/ui/card.json +14 -0
  139. package/registry/ui/chat.json +115 -0
  140. package/registry/ui/checkbox-group.json +14 -0
  141. package/registry/ui/checkbox.json +14 -0
  142. package/registry/ui/collapsible.json +14 -0
  143. package/registry/ui/combobox.json +18 -0
  144. package/registry/ui/command.json +17 -0
  145. package/registry/ui/composer-clipboard.json +14 -0
  146. package/registry/ui/composer-document.json +14 -0
  147. package/registry/ui/composer-editor.json +16 -0
  148. package/registry/ui/composer-query.json +12 -0
  149. package/registry/ui/composer.json +17 -0
  150. package/registry/ui/context-menu.json +23 -0
  151. package/registry/ui/dialog.json +18 -0
  152. package/registry/ui/drawer.json +18 -0
  153. package/registry/ui/empty.json +14 -0
  154. package/registry/ui/field.json +22 -0
  155. package/registry/ui/fieldset.json +14 -0
  156. package/registry/ui/form.json +14 -0
  157. package/registry/ui/frame.json +12 -0
  158. package/registry/ui/gauge.json +31 -0
  159. package/registry/ui/group.json +17 -0
  160. package/registry/ui/icon-frame.json +31 -0
  161. package/registry/ui/input-group.json +17 -0
  162. package/registry/ui/input.json +14 -0
  163. package/registry/ui/kbd.json +12 -0
  164. package/registry/ui/label.json +14 -0
  165. package/registry/ui/menu.json +39 -0
  166. package/registry/ui/meter.json +14 -0
  167. package/registry/ui/number-field.json +17 -0
  168. package/registry/ui/otp-field.json +31 -0
  169. package/registry/ui/pagination.json +17 -0
  170. package/registry/ui/popover.json +14 -0
  171. package/registry/ui/preview-card.json +14 -0
  172. package/registry/ui/progress.json +14 -0
  173. package/registry/ui/radio-group.json +14 -0
  174. package/registry/ui/render-anchor.json +12 -0
  175. package/registry/ui/scroll-area.json +14 -0
  176. package/registry/ui/segmented-control.json +14 -0
  177. package/registry/ui/select.json +16 -0
  178. package/registry/ui/separator.json +14 -0
  179. package/registry/ui/sheet.json +18 -0
  180. package/registry/ui/sidebar.json +25 -0
  181. package/registry/ui/skeleton.json +24 -0
  182. package/registry/ui/slider.json +14 -0
  183. package/registry/ui/spinner.json +14 -0
  184. package/registry/ui/switch.json +14 -0
  185. package/registry/ui/table.json +14 -0
  186. package/registry/ui/tabs.json +16 -0
  187. package/registry/ui/text.json +31 -0
  188. package/registry/ui/textarea.json +14 -0
  189. package/registry/ui/toast.json +89 -0
  190. package/registry/ui/toggle-group.json +18 -0
  191. package/registry/ui/toggle.json +15 -0
  192. package/registry/ui/toolbar.json +14 -0
  193. package/registry/ui/tooltip.json +14 -0
  194. package/registry/ui/use-composer-editor.json +17 -0
  195. package/registry/ui/use-copy-to-clipboard.json +12 -0
  196. package/registry/ui/use-media-query.json +12 -0
  197. package/registry/view.json +831 -0
  198. package/registry/widgets.json +319 -0
  199. package/registry/wizard.json +89 -0
  200. package/registry/workflow-editor.json +460 -0
@@ -0,0 +1,112 @@
1
+ {
2
+ "name": "flow-step-library",
3
+ "type": "registry:block",
4
+ "files": [
5
+ {
6
+ "path": "patterns/flow/canvas/core.ts",
7
+ "type": "registry:file",
8
+ "content": "import { hierarchy, tree } from 'd3-hierarchy'\n\nexport type FlowDirection = 'horizontal' | 'vertical'\nexport type FlowRunStatus =\n | 'idle'\n | 'running'\n | 'success'\n | 'failed'\n | 'skipped'\n | 'not-run'\nexport type FlowStepKind = 'trigger' | 'action' | 'condition'\n\nexport interface FlowStepType {\n id: string\n label: string\n group: string\n kind?: FlowStepKind\n description?: string\n}\n\nexport interface FlowStepRun {\n status: FlowRunStatus\n durationMs?: number\n metrics?: readonly string[]\n note?: string\n}\n\nexport interface FlowStep {\n id: string\n type: string\n name: string\n description?: string\n kind?: FlowStepKind\n owner?: { name: string; avatarUrl?: string }\n position: { x: number; y: number }\n run?: FlowStepRun\n}\n\nexport interface FlowConnection {\n id: string\n source: string\n target: string\n label?: string\n sourceHandle?: string\n taken?: boolean\n}\n\nexport interface FlowRunSummary {\n status: FlowRunStatus\n id?: string\n note?: string\n completed: number\n total: number\n}\n\nexport type FlowStepAction =\n | 'add-after'\n | 'add-branch'\n | 'view'\n | 'edit'\n | 'duplicate'\n | 'delete'\n\nexport interface TidyTreeOptions {\n direction: FlowDirection\n nodeSize: readonly [number, number]\n gap: readonly [number, number]\n}\n\nexport const flowStepNodeSize = [256, 100] as const\n\nexport const FLOW_STEP_TRANSFER_TYPE = 'application/x-tc96-flow-step'\n\nconst stepKinds: readonly string[] = ['trigger', 'action', 'condition']\n\nexport function serializeStepTransfer(type: FlowStepType) {\n return JSON.stringify(type)\n}\n\nexport function parseStepTransfer(\n raw: string | null | undefined,\n): FlowStepType | null {\n if (!raw) return null\n let value: unknown\n try {\n value = JSON.parse(raw)\n } catch {\n return null\n }\n if (typeof value !== 'object' || value === null) return null\n const { id, label, group, kind, description } = value as Record<\n string,\n unknown\n >\n if (\n typeof id !== 'string' ||\n typeof label !== 'string' ||\n typeof group !== 'string'\n )\n return null\n if (\n kind !== undefined &&\n !(typeof kind === 'string' && stepKinds.includes(kind))\n )\n return null\n if (description !== undefined && typeof description !== 'string') return null\n return {\n id,\n label,\n group,\n ...(kind !== undefined && { kind: kind as FlowStepKind }),\n ...(description !== undefined && { description }),\n }\n}\n\nexport function incomingOf(\n stepId: string,\n connections: readonly FlowConnection[],\n) {\n return connections.filter((connection) => connection.target === stepId)\n}\n\nexport function outgoingOf(\n stepId: string,\n connections: readonly FlowConnection[],\n) {\n return connections.filter((connection) => connection.source === stepId)\n}\n\ninterface TreeNode {\n id: string | null\n children: TreeNode[]\n}\n\nexport function tidyTree(\n steps: readonly FlowStep[],\n connections: readonly FlowConnection[],\n options: TidyTreeOptions,\n): FlowStep[] {\n const { direction, nodeSize, gap } = options\n const ids = new Set(steps.map((step) => step.id))\n const nodes = new Map<string, TreeNode>(\n steps.map((step) => [step.id, { id: step.id, children: [] }]),\n )\n const placed = new Set<string>()\n const roots = steps.filter(\n (step) =>\n !connections.some(\n (connection) =>\n connection.target === step.id &&\n connection.source !== step.id &&\n ids.has(connection.source),\n ),\n )\n const rootNodes: TreeNode[] = []\n const stack: TreeNode[] = []\n const expand = (pending: TreeNode[]) => {\n while (pending.length) {\n const current = pending.pop()\n if (!current?.id) continue\n for (const connection of outgoingOf(current.id, connections)) {\n const child = nodes.get(connection.target)\n if (!child || placed.has(connection.target)) continue\n placed.add(connection.target)\n current.children.push(child)\n pending.push(child)\n }\n }\n }\n for (const root of roots) {\n const node = nodes.get(root.id)\n if (!node) continue\n rootNodes.push(node)\n placed.add(root.id)\n stack.push(node)\n expand(stack)\n }\n for (const step of steps) {\n if (placed.has(step.id)) continue\n const node = nodes.get(step.id)\n if (!node) continue\n rootNodes.push(node)\n placed.add(step.id)\n stack.push(node)\n expand(stack)\n }\n if (!rootNodes.length) return steps.map((step) => ({ ...step }))\n\n const virtualRoot: TreeNode = { id: null, children: rootNodes }\n const [width, height] = nodeSize\n const [gapX, gapY] = gap\n const horizontal = direction === 'horizontal'\n const breadth = horizontal ? height + gapY : width + gapX\n const depth = horizontal ? width + gapX : height + gapY\n const layout = tree<TreeNode>()\n .nodeSize([breadth, depth])\n .separation(() => 1)(hierarchy(virtualRoot, (node) => node.children))\n\n const positions = new Map<string, { x: number; y: number }>()\n for (const node of layout.descendants()) {\n if (node.data.id === null) continue\n const across = node.x - (horizontal ? height : width) / 2\n const along = node.y - depth\n positions.set(\n node.data.id,\n horizontal ? { x: along, y: across } : { x: across, y: along },\n )\n }\n const values = [...positions.values()]\n const minX = Math.min(...values.map((position) => position.x))\n const minY = Math.min(...values.map((position) => position.y))\n\n return steps.map((step) => {\n const position = positions.get(step.id)\n if (!position) return { ...step }\n return {\n ...step,\n position: { x: position.x - minX, y: position.y - minY },\n }\n })\n}\n\nexport function flowRunSummary(\n steps: readonly FlowStep[],\n options: { id?: string } = {},\n): FlowRunSummary {\n const total = steps.length\n const completed = steps.filter(\n (step) => step.run?.status === 'success',\n ).length\n const failed = steps.find((step) => step.run?.status === 'failed')\n const summary = { id: options.id, completed, total }\n if (failed) return { ...summary, status: 'failed', note: failed.run?.note }\n if (steps.some((step) => step.run?.status === 'running'))\n return { ...summary, status: 'running' }\n if (total > 0 && steps.every((step) => step.run?.status === 'skipped'))\n return { ...summary, status: 'skipped' }\n if (\n completed > 0 &&\n steps.every(\n (step) =>\n step.run?.status === 'success' || step.run?.status === 'skipped',\n )\n )\n return { ...summary, status: 'success' }\n if (\n steps.every(\n (step) =>\n !step.run ||\n step.run.status === 'not-run' ||\n step.run.status === 'idle',\n )\n )\n return { ...summary, status: 'not-run' }\n return { ...summary, status: 'idle' }\n}\n",
9
+ "target": "~/packages/ui/src/patterns/flow/canvas/core.ts"
10
+ },
11
+ {
12
+ "path": "patterns/flow/step-library/components/step-library-skeleton.tsx",
13
+ "type": "registry:file",
14
+ "content": "'use client'\n\nimport { Skeleton } from '@tc96/ui/skeleton'\nimport type { ReactElement } from 'react'\nimport {\n flowStepGroupClassName,\n flowStepLibraryGroupsClassName,\n} from '../lib/variants'\n\nconst groups = [0, 1]\nconst items = [0, 1, 2]\n\nexport function FlowStepLibrarySkeleton(): ReactElement {\n return (\n <div\n className={flowStepLibraryGroupsClassName}\n data-slot=\"flow-step-library-skeleton\"\n >\n {groups.map((group) => (\n <div className={flowStepGroupClassName} key={group}>\n <Skeleton className=\"mx-2 h-3 w-24\" />\n {items.map((item) => (\n <Skeleton className=\"h-10 w-full\" key={item} />\n ))}\n </div>\n ))}\n </div>\n )\n}\n",
15
+ "target": "~/packages/ui/src/patterns/flow/step-library/components/step-library-skeleton.tsx"
16
+ },
17
+ {
18
+ "path": "patterns/flow/step-library/composition/flow-run-card/flow-run-card.tsx",
19
+ "type": "registry:file",
20
+ "content": "'use client'\n\nimport { ClockCounterClockwiseIcon } from '@phosphor-icons/react'\nimport { Badge, type BadgeProps } from '@tc96/ui/badge'\nimport { Card, CardPanel } from '@tc96/ui/card'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { Progress } from '@tc96/ui/progress'\nimport { cn } from '@tc96/utils'\nimport { type ReactElement, useId } from 'react'\nimport type { FlowRunStatus } from '../../../canvas/core'\nimport { defaultFlowRunCardLabels } from '../../core'\nimport {\n flowRunCardBodyClassName,\n flowRunCardDescriptionClassName,\n flowRunCardTextClassName,\n} from '../../lib/variants'\nimport type { FlowRunCardProps } from '../../types'\n\nconst statusBadges: Record<FlowRunStatus, BadgeProps['variant']> = {\n failed: 'destructive',\n idle: 'outline',\n 'not-run': 'outline',\n running: 'outline',\n skipped: 'outline',\n success: 'outline',\n}\n\nexport function FlowRunCard({\n className,\n icon,\n labels,\n run,\n}: Readonly<FlowRunCardProps>): ReactElement {\n const text = {\n ...defaultFlowRunCardLabels,\n ...labels,\n statuses: { ...defaultFlowRunCardLabels.statuses, ...labels?.statuses },\n }\n const titleId = useId()\n const percent = run.total ? Math.round((run.completed / run.total) * 100) : 0\n const summary = text.summary\n .replace('{completed}', String(run.completed))\n .replace('{total}', String(run.total))\n\n return (\n <Card\n aria-labelledby={titleId}\n className={cn('shrink-0', className)}\n data-slot=\"flow-run-card\"\n data-status={run.status}\n role=\"region\"\n >\n <CardPanel className={flowRunCardBodyClassName}>\n <div className=\"flex items-start gap-3\">\n <IconFrame>\n {icon ?? <ClockCounterClockwiseIcon aria-hidden=\"true\" />}\n </IconFrame>\n <div className={flowRunCardTextClassName}>\n <h3 className=\"font-medium text-sm\" id={titleId}>\n {text.title}\n </h3>\n <p className={flowRunCardDescriptionClassName}>\n {run.note ?? summary}\n </p>\n </div>\n <Badge variant={statusBadges[run.status]}>\n {text.statuses[run.status]}\n </Badge>\n </div>\n <Progress aria-label={`${text.title}: ${percent}%`} value={percent} />\n </CardPanel>\n </Card>\n )\n}\n",
21
+ "target": "~/packages/ui/src/patterns/flow/step-library/composition/flow-run-card/flow-run-card.tsx"
22
+ },
23
+ {
24
+ "path": "patterns/flow/step-library/composition/flow-run-card/index.ts",
25
+ "type": "registry:file",
26
+ "content": "export { FlowRunCard } from './flow-run-card'\n",
27
+ "target": "~/packages/ui/src/patterns/flow/step-library/composition/flow-run-card/index.ts"
28
+ },
29
+ {
30
+ "path": "patterns/flow/step-library/composition/index.ts",
31
+ "type": "registry:file",
32
+ "content": "export { FlowRunCard } from './flow-run-card/index'\nexport { FlowStepLibrary } from './step-library/index'\nexport { FlowStepLibraryGroup } from './step-library-group/index'\nexport { FlowStepLibraryItem } from './step-library-item/index'\n",
33
+ "target": "~/packages/ui/src/patterns/flow/step-library/composition/index.ts"
34
+ },
35
+ {
36
+ "path": "patterns/flow/step-library/composition/step-library-group/index.ts",
37
+ "type": "registry:file",
38
+ "content": "export { FlowStepLibraryGroup } from './step-library-group'\n",
39
+ "target": "~/packages/ui/src/patterns/flow/step-library/composition/step-library-group/index.ts"
40
+ },
41
+ {
42
+ "path": "patterns/flow/step-library/composition/step-library-group/step-library-group.tsx",
43
+ "type": "registry:file",
44
+ "content": "'use client'\n\nimport { cn } from '@tc96/utils'\nimport type { ReactElement } from 'react'\nimport {\n flowStepGroupClassName,\n flowStepGroupLabelClassName,\n} from '../../lib/variants'\nimport type { FlowStepLibraryGroupProps } from '../../types'\nimport { FlowStepLibraryItem } from '../step-library-item/step-library-item'\n\nexport function FlowStepLibraryGroup({\n collapsed = false,\n disabled = false,\n group,\n icons,\n onAdd,\n}: Readonly<FlowStepLibraryGroupProps>): ReactElement {\n return (\n <fieldset\n className={flowStepGroupClassName}\n data-slot=\"flow-step-library-group\"\n >\n <legend\n className={cn(flowStepGroupLabelClassName, collapsed && 'sr-only')}\n >\n {group.label}\n </legend>\n {group.types.map((type) => (\n <FlowStepLibraryItem\n collapsed={collapsed}\n disabled={disabled}\n icon={icons?.[type.id]}\n key={type.id}\n onAdd={onAdd}\n type={type}\n />\n ))}\n </fieldset>\n )\n}\n",
45
+ "target": "~/packages/ui/src/patterns/flow/step-library/composition/step-library-group/step-library-group.tsx"
46
+ },
47
+ {
48
+ "path": "patterns/flow/step-library/composition/step-library-item/index.ts",
49
+ "type": "registry:file",
50
+ "content": "export { FlowStepLibraryItem } from './step-library-item'\n",
51
+ "target": "~/packages/ui/src/patterns/flow/step-library/composition/step-library-item/index.ts"
52
+ },
53
+ {
54
+ "path": "patterns/flow/step-library/composition/step-library-item/step-library-item.tsx",
55
+ "type": "registry:file",
56
+ "content": "'use client'\n\nimport { CubeIcon, GitBranchIcon, LightningIcon } from '@phosphor-icons/react'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { cn } from '@tc96/utils'\nimport { type ReactElement, useId } from 'react'\nimport {\n FLOW_STEP_TRANSFER_TYPE,\n serializeStepTransfer,\n} from '../../../canvas/core'\nimport {\n flowStepLibraryItemDescriptionClassName,\n flowStepLibraryItemTextClassName,\n flowStepLibraryItemVariants,\n} from '../../lib/variants'\nimport type { FlowStepLibraryItemProps } from '../../types'\n\nconst kindIcons = {\n action: CubeIcon,\n condition: GitBranchIcon,\n trigger: LightningIcon,\n} as const\n\nexport function FlowStepLibraryItem({\n collapsed = false,\n disabled = false,\n icon,\n onAdd,\n type,\n}: Readonly<FlowStepLibraryItemProps>): ReactElement {\n const descriptionId = useId()\n const kind = type.kind ?? 'action'\n const KindIcon = kindIcons[kind]\n const describes = Boolean(type.description) && !collapsed\n\n return (\n <button\n aria-describedby={describes ? descriptionId : undefined}\n aria-label={type.label}\n className={cn(flowStepLibraryItemVariants({ collapsed }))}\n data-kind={kind}\n disabled={disabled}\n data-slot=\"flow-step-library-item\"\n draggable={!disabled}\n onClick={() => onAdd(type)}\n onDragStart={(event) => {\n event.dataTransfer.setData(\n FLOW_STEP_TRANSFER_TYPE,\n serializeStepTransfer(type),\n )\n event.dataTransfer.setData('text/plain', type.label)\n event.dataTransfer.effectAllowed = 'copy'\n }}\n type=\"button\"\n >\n <IconFrame>{icon ?? <KindIcon aria-hidden=\"true\" />}</IconFrame>\n {collapsed ? null : (\n <span className={flowStepLibraryItemTextClassName}>\n <span className=\"truncate font-medium\">{type.label}</span>\n {type.description ? (\n <span\n className={flowStepLibraryItemDescriptionClassName}\n id={descriptionId}\n >\n {type.description}\n </span>\n ) : null}\n </span>\n )}\n </button>\n )\n}\n",
57
+ "target": "~/packages/ui/src/patterns/flow/step-library/composition/step-library-item/step-library-item.tsx"
58
+ },
59
+ {
60
+ "path": "patterns/flow/step-library/composition/step-library/index.ts",
61
+ "type": "registry:file",
62
+ "content": "export { FlowStepLibrary } from './step-library'\n",
63
+ "target": "~/packages/ui/src/patterns/flow/step-library/composition/step-library/index.ts"
64
+ },
65
+ {
66
+ "path": "patterns/flow/step-library/composition/step-library/step-library.tsx",
67
+ "type": "registry:file",
68
+ "content": "'use client'\n\nimport { Empty, EmptyDescription } from '@tc96/ui/empty'\nimport { ScrollArea } from '@tc96/ui/scroll-area'\nimport { cn } from '@tc96/utils'\nimport { type ReactElement, useId } from 'react'\nimport { FlowStepLibrarySkeleton } from '../../components/step-library-skeleton'\nimport { defaultFlowStepLibraryLabels } from '../../core'\nimport {\n flowStepLibraryClassName,\n flowStepLibraryFooterClassName,\n flowStepLibraryGroupsClassName,\n flowStepLibraryHeaderClassName,\n} from '../../lib/variants'\nimport type { FlowStepLibraryProps } from '../../types'\nimport { FlowStepLibraryGroup } from '../step-library-group/step-library-group'\n\nexport function FlowStepLibrary({\n children,\n className,\n collapsed = false,\n disabled = false,\n groups,\n icons,\n labels,\n loading = false,\n onAdd,\n}: Readonly<FlowStepLibraryProps>): ReactElement {\n const text = { ...defaultFlowStepLibraryLabels, ...labels }\n const titleId = useId()\n const hintId = useId()\n\n return (\n <section\n aria-busy={loading || undefined}\n aria-describedby={collapsed ? undefined : hintId}\n aria-labelledby={titleId}\n className={cn(flowStepLibraryClassName, className)}\n data-collapsed={collapsed || undefined}\n data-slot=\"flow-step-library\"\n >\n <header className={flowStepLibraryHeaderClassName}>\n <h2\n className={cn('font-semibold text-sm', collapsed && 'sr-only')}\n id={titleId}\n >\n {text.title}\n </h2>\n {collapsed ? null : (\n <p className=\"text-muted-foreground text-xs\" id={hintId}>\n {text.hint}\n </p>\n )}\n </header>\n <ScrollArea className=\"min-h-0 flex-1\">\n {loading ? (\n <FlowStepLibrarySkeleton />\n ) : groups.length ? (\n <div\n className={flowStepLibraryGroupsClassName}\n data-slot=\"flow-step-library-groups\"\n >\n {groups.map((group) => (\n <FlowStepLibraryGroup\n collapsed={collapsed}\n disabled={disabled}\n group={group}\n icons={icons}\n key={group.label}\n onAdd={onAdd}\n />\n ))}\n </div>\n ) : (\n <Empty className=\"py-8\">\n <EmptyDescription>{text.empty}</EmptyDescription>\n </Empty>\n )}\n </ScrollArea>\n {children ? (\n <div\n className={flowStepLibraryFooterClassName}\n data-slot=\"flow-step-library-footer\"\n >\n {children}\n </div>\n ) : null}\n </section>\n )\n}\n",
69
+ "target": "~/packages/ui/src/patterns/flow/step-library/composition/step-library/step-library.tsx"
70
+ },
71
+ {
72
+ "path": "patterns/flow/step-library/core.ts",
73
+ "type": "registry:file",
74
+ "content": "import type { FlowRunStatus, FlowStepType } from '../canvas/core'\n\nexport interface FlowStepGroup {\n label: string\n types: FlowStepType[]\n}\n\nexport interface FlowStepLibraryLabels {\n title: string\n hint: string\n empty: string\n}\n\nexport interface FlowRunCardLabels {\n statuses: Record<FlowRunStatus, string>\n summary: string\n title: string\n}\n\nexport const defaultFlowStepLibraryLabels: FlowStepLibraryLabels = {\n empty: 'Nenhum passo disponível',\n hint: 'Arraste um passo para o canvas ou clique para adicionar',\n title: 'Passos',\n}\n\nexport const defaultFlowRunCardLabels: FlowRunCardLabels = {\n statuses: {\n failed: 'Falhou',\n idle: 'Pronta',\n 'not-run': 'Não executada',\n running: 'Executando',\n skipped: 'Ignorada',\n success: 'Concluída',\n },\n summary: '{completed} de {total} passos concluídos',\n title: 'Última execução',\n}\n\nexport function groupStepTypes(\n types: readonly FlowStepType[],\n): FlowStepGroup[] {\n const groups = new Map<string, FlowStepType[]>()\n for (const type of types) {\n const bucket = groups.get(type.group)\n if (bucket) bucket.push(type)\n else groups.set(type.group, [type])\n }\n return [...groups].map(([label, grouped]) => ({ label, types: grouped }))\n}\n",
75
+ "target": "~/packages/ui/src/patterns/flow/step-library/core.ts"
76
+ },
77
+ {
78
+ "path": "patterns/flow/step-library/index.ts",
79
+ "type": "registry:file",
80
+ "content": "export * from './composition/index'\nexport type {\n FlowRunCardLabels,\n FlowStepGroup,\n FlowStepLibraryLabels,\n} from './core'\nexport {\n defaultFlowRunCardLabels,\n defaultFlowStepLibraryLabels,\n groupStepTypes,\n} from './core'\nexport type {\n FlowRunCardProps,\n FlowStepLibraryGroupProps,\n FlowStepLibraryItemProps,\n FlowStepLibraryProps,\n} from './types'\n",
81
+ "target": "~/packages/ui/src/patterns/flow/step-library/index.ts"
82
+ },
83
+ {
84
+ "path": "patterns/flow/step-library/lib/variants.ts",
85
+ "type": "registry:file",
86
+ "content": "import { cva } from 'class-variance-authority'\n\nexport const flowStepLibraryClassName =\n 'flex h-full min-h-0 w-80 shrink-0 flex-col border-e bg-background data-[collapsed]:w-17 data-[collapsed]:items-center'\n\nexport const flowStepLibraryHeaderClassName =\n 'flex w-full min-w-0 flex-col gap-1 p-3'\n\nexport const flowStepLibraryGroupsClassName = 'flex flex-col gap-3 px-1 pb-3'\n\nexport const flowStepLibraryFooterClassName =\n 'flex w-full flex-col gap-3 border-t p-3'\n\nexport const flowStepGroupClassName =\n 'm-0 flex min-w-0 flex-col gap-0.5 border-0 p-0'\n\nexport const flowStepGroupLabelClassName =\n 'float-left w-full px-2 pb-1.5 font-medium text-muted-foreground text-xs'\n\nexport const flowStepLibraryItemVariants = cva(\n 'flex w-full min-w-0 cursor-grab items-center gap-3 rounded-lg p-2 text-start text-sm outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing disabled:pointer-events-none disabled:opacity-64',\n {\n defaultVariants: { collapsed: false },\n variants: {\n collapsed: {\n false: '',\n true: 'w-auto justify-center',\n },\n },\n },\n)\n\nexport const flowStepLibraryItemTextClassName = 'flex min-w-0 flex-col'\n\nexport const flowStepLibraryItemDescriptionClassName =\n 'truncate text-muted-foreground text-xs'\n\nexport const flowRunCardBodyClassName = 'flex flex-col gap-3 p-3'\n\nexport const flowRunCardTextClassName = 'flex min-w-0 flex-1 flex-col gap-0.5'\n\nexport const flowRunCardDescriptionClassName =\n 'truncate text-muted-foreground text-xs'\n",
87
+ "target": "~/packages/ui/src/patterns/flow/step-library/lib/variants.ts"
88
+ },
89
+ {
90
+ "path": "patterns/flow/step-library/types/index.ts",
91
+ "type": "registry:file",
92
+ "content": "import type { ReactNode } from 'react'\nimport type { FlowRunSummary, FlowStepType } from '../../canvas/core'\nimport type {\n FlowRunCardLabels,\n FlowStepGroup,\n FlowStepLibraryLabels,\n} from '../core'\n\nexport interface FlowStepLibraryProps {\n children?: ReactNode\n className?: string\n collapsed?: boolean\n disabled?: boolean\n groups: readonly FlowStepGroup[]\n icons?: Record<string, ReactNode>\n labels?: Partial<FlowStepLibraryLabels>\n loading?: boolean\n onAdd: (type: FlowStepType) => void\n}\n\nexport interface FlowStepLibraryGroupProps {\n collapsed?: boolean\n disabled?: boolean\n group: FlowStepGroup\n icons?: Record<string, ReactNode>\n onAdd: (type: FlowStepType) => void\n}\n\nexport interface FlowStepLibraryItemProps {\n collapsed?: boolean\n disabled?: boolean\n icon?: ReactNode\n onAdd: (type: FlowStepType) => void\n type: FlowStepType\n}\n\nexport interface FlowRunCardProps {\n className?: string\n icon?: ReactNode\n labels?: Partial<FlowRunCardLabels>\n run: FlowRunSummary\n}\n",
93
+ "target": "~/packages/ui/src/patterns/flow/step-library/types/index.ts"
94
+ }
95
+ ],
96
+ "dependencies": [
97
+ "@phosphor-icons/react@2.1.10",
98
+ "class-variance-authority@0.7.1",
99
+ "d3-hierarchy@3.1.2",
100
+ "react@19.1.1"
101
+ ],
102
+ "registryDependencies": [
103
+ "@ui/badge",
104
+ "@ui/card",
105
+ "@ui/empty",
106
+ "@ui/icon-frame",
107
+ "@ui/progress",
108
+ "@ui/scroll-area",
109
+ "@ui/skeleton"
110
+ ],
111
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json"
112
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "forgot-password-1",
3
+ "type": "registry:block",
4
+ "files": [
5
+ {
6
+ "path": "blocks/application/auth/forgot-password-1/forgot-password-1.tsx",
7
+ "type": "registry:file",
8
+ "content": "'use client'\n\nimport { Button } from '@tc96/ui/button'\nimport { Field, FieldError, FieldLabel } from '@tc96/ui/field'\nimport { Form } from '@tc96/ui/form'\nimport { Input } from '@tc96/ui/input'\nimport { renderAnchor } from '@tc96/ui/render-anchor'\nimport { type ReactElement, useEffect, useMemo, useRef } from 'react'\nimport { AuthCard } from '../shared/auth-card'\nimport { resolveAuthLabels } from '../shared/labels'\nimport { toFormErrors } from '../shared/to-form-errors'\nimport { useFocusFirstInvalid } from '../shared/use-focus-first-invalid'\nimport { defaultForgotPasswordLabels } from './labels'\nimport type { ForgotPasswordProps, ForgotPasswordValues } from './types'\n\nfunction toForgotPasswordValues(\n values: Readonly<Record<string, unknown>>,\n): ForgotPasswordValues {\n return { email: String(values.email ?? '') }\n}\n\nexport function ForgotPassword1({\n destination,\n error,\n fieldErrors,\n labels: labelsProp,\n loginHref,\n logo,\n onResend,\n onSubmit,\n pending = false,\n renderLink = renderAnchor,\n resendIn = 0,\n sent = false,\n}: Readonly<ForgotPasswordProps>): ReactElement {\n const labels = resolveAuthLabels(defaultForgotPasswordLabels, labelsProp)\n const formRef = useRef<HTMLFormElement>(null)\n const alertRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLDivElement>(null)\n const errors = useMemo(() => toFormErrors(fieldErrors), [fieldErrors])\n const wasSent = useRef(sent)\n const counting = resendIn > 0\n\n useFocusFirstInvalid({ alertRef, error, fieldErrors, formRef })\n\n useEffect(() => {\n if (sent && !wasSent.current) titleRef.current?.focus()\n wasSent.current = sent\n }, [sent])\n\n const footer = loginHref ? (\n <Button\n className=\"underline\"\n render={renderLink(loginHref)}\n size=\"sm\"\n variant=\"link\"\n >\n {labels.backToLogin}\n </Button>\n ) : undefined\n\n if (sent) {\n return (\n <AuthCard\n alertRef={alertRef}\n description={labels.sentDescription(destination)}\n error={error}\n errorTitle={labels.errorTitle}\n footer={footer}\n logo={logo}\n title={labels.sentTitle}\n titleRef={titleRef}\n >\n {onResend ? (\n <div className=\"flex items-center justify-center gap-1 text-sm\">\n <span>{labels.didNotReceive}</span>\n <Button\n className=\"underline\"\n disabled={counting || pending}\n onClick={() => {\n if (counting || pending) return\n onResend()\n }}\n size=\"sm\"\n type=\"button\"\n variant=\"link\"\n >\n {counting ? labels.resendIn(resendIn) : labels.resend}\n </Button>\n </div>\n ) : null}\n </AuthCard>\n )\n }\n\n return (\n <AuthCard\n alertRef={alertRef}\n description={labels.description}\n error={error}\n errorTitle={labels.errorTitle}\n footer={footer}\n logo={logo}\n title={labels.title}\n >\n <Form\n aria-busy={pending}\n className=\"flex flex-col gap-4\"\n errors={errors}\n onFormSubmit={(values) => {\n if (pending) return\n onSubmit(toForgotPasswordValues(values))\n }}\n ref={formRef}\n >\n <Field name=\"email\">\n <FieldLabel>{labels.email}</FieldLabel>\n <Input autoComplete=\"email\" required type=\"email\" />\n <FieldError />\n </Field>\n <Button className=\"w-full\" loading={pending} type=\"submit\">\n {labels.submit}\n </Button>\n </Form>\n </AuthCard>\n )\n}\n",
9
+ "target": "~/packages/ui/src/blocks/application/auth/forgot-password-1/forgot-password-1.tsx"
10
+ },
11
+ {
12
+ "path": "blocks/application/auth/forgot-password-1/index.ts",
13
+ "type": "registry:file",
14
+ "content": "export type {\n AuthBaseProps,\n AuthCommonLabels,\n AuthFieldErrors,\n AuthRenderLink,\n} from '../shared/types'\nexport { ForgotPassword1 } from './forgot-password-1'\nexport type {\n ForgotPasswordLabels,\n ForgotPasswordProps,\n ForgotPasswordValues,\n} from './types'\n",
15
+ "target": "~/packages/ui/src/blocks/application/auth/forgot-password-1/index.ts"
16
+ },
17
+ {
18
+ "path": "blocks/application/auth/forgot-password-1/labels.ts",
19
+ "type": "registry:file",
20
+ "content": "import { defaultAuthCommonLabels } from '../shared/labels'\nimport type { ForgotPasswordLabels } from './types'\n\nexport const defaultForgotPasswordLabels: ForgotPasswordLabels = {\n backToLogin: 'Voltar para entrar',\n description:\n 'Informe seu e-mail e enviaremos um link para redefinir a senha.',\n didNotReceive: 'Não recebeu o e-mail?',\n email: defaultAuthCommonLabels.email,\n errorTitle: defaultAuthCommonLabels.errorTitle,\n resend: 'Reenviar e-mail',\n resendIn: (seconds) => `Reenviar em ${seconds}s`,\n sentDescription: (destination) =>\n destination\n ? `Enviamos um link para redefinir a senha para ${destination}.`\n : 'Enviamos um link para redefinir a senha para o seu e-mail.',\n sentTitle: 'Verifique seu e-mail',\n submit: 'Enviar link',\n title: 'Esqueceu a senha?',\n}\n",
21
+ "target": "~/packages/ui/src/blocks/application/auth/forgot-password-1/labels.ts"
22
+ },
23
+ {
24
+ "path": "blocks/application/auth/forgot-password-1/types.ts",
25
+ "type": "registry:file",
26
+ "content": "import type {\n AuthBaseProps,\n AuthCommonLabels,\n AuthFieldErrors,\n} from '../shared/types'\n\nexport interface ForgotPasswordValues {\n email: string\n}\n\nexport interface ForgotPasswordLabels\n extends Pick<AuthCommonLabels, 'email' | 'errorTitle'> {\n backToLogin: string\n description: string\n didNotReceive: string\n resend: string\n resendIn: (seconds: number) => string\n sentDescription: (destination?: string) => string\n sentTitle: string\n submit: string\n title: string\n}\n\nexport interface ForgotPasswordProps\n extends AuthBaseProps<ForgotPasswordLabels> {\n destination?: string\n fieldErrors?: AuthFieldErrors<ForgotPasswordValues>\n loginHref?: string\n onResend?: () => void\n onSubmit: (values: ForgotPasswordValues) => void\n resendIn?: number\n sent?: boolean\n}\n",
27
+ "target": "~/packages/ui/src/blocks/application/auth/forgot-password-1/types.ts"
28
+ },
29
+ {
30
+ "path": "blocks/application/auth/shared/auth-card.tsx",
31
+ "type": "registry:file",
32
+ "content": "'use client'\n\nimport { Alert, AlertDescription, AlertTitle } from '@tc96/ui/alert'\nimport {\n Card,\n CardDescription,\n CardHeader,\n CardPanel,\n CardTitle,\n} from '@tc96/ui/card'\nimport type { ReactElement, ReactNode, Ref } from 'react'\n\nexport interface AuthCardProps {\n alertRef?: Ref<HTMLDivElement>\n children?: ReactNode\n description?: ReactNode\n error?: string\n errorTitle: string\n footer?: ReactNode\n logo?: ReactNode\n notice?: ReactNode\n title: ReactNode\n titleRef?: Ref<HTMLDivElement>\n}\n\nexport function AuthCard({\n alertRef,\n children,\n description,\n error,\n errorTitle,\n footer,\n logo,\n notice,\n title,\n titleRef,\n}: Readonly<AuthCardProps>): ReactElement {\n return (\n <main className=\"flex min-h-svh items-center justify-center p-4 sm:p-6\">\n <div className=\"flex w-full max-w-sm flex-col gap-6\">\n <Card>\n <CardHeader className=\"justify-items-center text-center\">\n {logo ? (\n <div className=\"mb-2 flex justify-center\">{logo}</div>\n ) : null}\n <CardTitle\n ref={titleRef}\n render={(props) => <h1 {...props} />}\n tabIndex={titleRef ? -1 : undefined}\n >\n {title}\n </CardTitle>\n {description ? (\n <CardDescription>{description}</CardDescription>\n ) : null}\n </CardHeader>\n <CardPanel className=\"flex flex-col gap-4\">\n {error ? (\n <Alert ref={alertRef} tabIndex={-1} variant=\"error\">\n <AlertTitle>{errorTitle}</AlertTitle>\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n ) : null}\n {children}\n </CardPanel>\n </Card>\n {footer ? (\n <div\n className=\"flex flex-wrap items-center justify-center gap-1 text-muted-foreground text-sm\"\n data-slot=\"auth-footer\"\n >\n {footer}\n </div>\n ) : null}\n {notice}\n </div>\n </main>\n )\n}\n",
33
+ "target": "~/packages/ui/src/blocks/application/auth/shared/auth-card.tsx"
34
+ },
35
+ {
36
+ "path": "blocks/application/auth/shared/labels.ts",
37
+ "type": "registry:file",
38
+ "content": "import type { AuthCommonLabels, AuthNewPasswordLabels } from './types'\n\nexport const defaultAuthCommonLabels: AuthCommonLabels = {\n email: 'E-mail',\n errorTitle: 'Não foi possível continuar',\n hidePassword: 'Ocultar senha',\n password: 'Senha',\n providerContinue: (label) => `Continuar com ${label}`,\n providersGroup: 'Entrar com outro serviço',\n providersSeparator: 'ou continue com e-mail',\n showPassword: 'Mostrar senha',\n}\n\nexport const defaultAuthNewPasswordLabels: AuthNewPasswordLabels = {\n confirmPassword: 'Confirmar senha',\n passwordMismatch: 'As senhas não coincidem.',\n suggestionLowercase: 'minúscula',\n suggestionMet: 'atendida',\n suggestionMissing: 'faltando',\n suggestionNumber: 'número',\n suggestionSymbol: 'símbolo',\n suggestionUppercase: 'maiúscula',\n}\n\nexport function resolveAuthLabels<TLabels>(\n defaults: TLabels,\n labels?: Partial<TLabels>,\n): TLabels {\n return { ...defaults, ...labels }\n}\n",
39
+ "target": "~/packages/ui/src/blocks/application/auth/shared/labels.ts"
40
+ },
41
+ {
42
+ "path": "blocks/application/auth/shared/to-form-errors.ts",
43
+ "type": "registry:file",
44
+ "content": "export function toFormErrors(\n fieldErrors?: Readonly<Partial<Record<string, string>>>,\n): Record<string, string> {\n const errors: Record<string, string> = {}\n for (const [name, message] of Object.entries(fieldErrors ?? {}))\n if (message) errors[name] = message\n return errors\n}\n",
45
+ "target": "~/packages/ui/src/blocks/application/auth/shared/to-form-errors.ts"
46
+ },
47
+ {
48
+ "path": "blocks/application/auth/shared/types.ts",
49
+ "type": "registry:file",
50
+ "content": "import type { RenderLink } from '@tc96/ui/render-anchor'\nimport type { ReactNode } from 'react'\n\nexport type AuthRenderLink = RenderLink\n\nexport interface AuthProvider {\n icon?: ReactNode\n id: string\n label: string\n}\n\nexport type AuthFieldErrors<TValues> = Partial<Record<keyof TValues, string>>\n\nexport type AuthPasswordSuggestion =\n | 'lowercase'\n | 'uppercase'\n | 'number'\n | 'symbol'\n\nexport interface AuthCommonLabels {\n email: string\n errorTitle: string\n hidePassword: string\n password: string\n providerContinue: (label: string) => string\n providersGroup: string\n providersSeparator: string\n showPassword: string\n}\n\nexport interface AuthNewPasswordLabels {\n confirmPassword: string\n passwordMismatch: string\n suggestionLowercase: string\n suggestionMet: string\n suggestionMissing: string\n suggestionNumber: string\n suggestionSymbol: string\n suggestionUppercase: string\n}\n\nexport interface AuthBaseProps<TLabels> {\n error?: string\n labels?: Partial<TLabels>\n logo?: ReactNode\n pending?: boolean\n renderLink?: AuthRenderLink\n}\n",
51
+ "target": "~/packages/ui/src/blocks/application/auth/shared/types.ts"
52
+ },
53
+ {
54
+ "path": "blocks/application/auth/shared/use-focus-first-invalid.ts",
55
+ "type": "registry:file",
56
+ "content": "'use client'\n\nimport { type RefObject, useEffect, useRef } from 'react'\nimport { toFormErrors } from './to-form-errors'\n\nexport interface UseFocusFirstInvalidOptions {\n alertRef: RefObject<HTMLElement | null>\n error?: string\n fieldErrors?: Readonly<Partial<Record<string, string>>>\n formRef: RefObject<HTMLFormElement | null>\n}\n\nfunction findFirstNamedControl(\n form: HTMLFormElement | null,\n names: readonly string[],\n): HTMLElement | undefined {\n return Array.from(form?.elements ?? []).find(\n (element): element is HTMLElement =>\n element instanceof HTMLElement &&\n !(element instanceof HTMLInputElement && element.type === 'hidden') &&\n names.includes(element.getAttribute('name') ?? ''),\n )\n}\n\nexport function useFocusFirstInvalid({\n alertRef,\n error,\n fieldErrors,\n formRef,\n}: UseFocusFirstInvalidOptions): void {\n const invalidNames = Object.keys(toFormErrors(fieldErrors)).join('\\n')\n const hasError = Boolean(error)\n const previous = useRef({ hasError, invalidNames })\n\n useEffect(() => {\n const before = previous.current\n previous.current = { hasError, invalidNames }\n const hasFieldErrors = invalidNames !== ''\n const filled =\n (hasFieldErrors && before.invalidNames === '') ||\n (hasError && !before.hasError)\n if (!filled) return\n const field = hasFieldErrors\n ? findFirstNamedControl(formRef.current, invalidNames.split('\\n'))\n : undefined\n if (field) field.focus()\n else if (hasError) alertRef.current?.focus()\n }, [alertRef, formRef, hasError, invalidNames])\n}\n",
57
+ "target": "~/packages/ui/src/blocks/application/auth/shared/use-focus-first-invalid.ts"
58
+ }
59
+ ],
60
+ "dependencies": [
61
+ "react@19.1.1"
62
+ ],
63
+ "registryDependencies": [
64
+ "@ui/alert",
65
+ "@ui/button",
66
+ "@ui/card",
67
+ "@ui/field",
68
+ "@ui/form",
69
+ "@ui/input",
70
+ "@ui/render-anchor"
71
+ ],
72
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json"
73
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "forgot-password-2",
3
+ "type": "registry:block",
4
+ "files": [
5
+ {
6
+ "path": "blocks/application/auth/forgot-password-2/forgot-password-2.tsx",
7
+ "type": "registry:file",
8
+ "content": "'use client'\n\nimport { Button } from '@tc96/ui/button'\nimport { Field, FieldError, FieldLabel } from '@tc96/ui/field'\nimport { Form } from '@tc96/ui/form'\nimport { Input } from '@tc96/ui/input'\nimport { type ReactElement, useEffect, useMemo, useRef } from 'react'\nimport { AuthCard } from '../shared/auth-card'\nimport { resolveAuthLabels } from '../shared/labels'\nimport { toFormErrors } from '../shared/to-form-errors'\nimport { useFocusFirstInvalid } from '../shared/use-focus-first-invalid'\nimport { defaultForgotPassword2Labels } from './labels'\nimport type { ForgotPassword2Props, ForgotPassword2Values } from './types'\n\nfunction toForgotPassword2Values(\n values: Readonly<Record<string, unknown>>,\n): ForgotPassword2Values {\n return { email: String(values.email ?? '') }\n}\n\nexport function ForgotPassword2({\n destination,\n error,\n fieldErrors,\n labels: labelsProp,\n onSubmit,\n pending = false,\n sent = false,\n}: Readonly<ForgotPassword2Props>): ReactElement {\n const labels = resolveAuthLabels(defaultForgotPassword2Labels, labelsProp)\n const formRef = useRef<HTMLFormElement>(null)\n const alertRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLDivElement>(null)\n const errors = useMemo(() => toFormErrors(fieldErrors), [fieldErrors])\n const wasSent = useRef(sent)\n\n useFocusFirstInvalid({ alertRef, error, fieldErrors, formRef })\n\n useEffect(() => {\n if (sent && !wasSent.current) titleRef.current?.focus()\n wasSent.current = sent\n }, [sent])\n\n if (sent) {\n return (\n <AuthCard\n alertRef={alertRef}\n description={labels.sentDescription(destination)}\n error={error}\n errorTitle={labels.errorTitle}\n title={labels.sentTitle}\n titleRef={titleRef}\n />\n )\n }\n\n return (\n <AuthCard\n alertRef={alertRef}\n description={labels.description}\n error={error}\n errorTitle={labels.errorTitle}\n title={labels.title}\n >\n <Form\n aria-busy={pending}\n className=\"flex flex-col gap-4\"\n errors={errors}\n onFormSubmit={(values) => {\n if (pending) return\n onSubmit(toForgotPassword2Values(values))\n }}\n ref={formRef}\n >\n <Field name=\"email\">\n <FieldLabel>{labels.email}</FieldLabel>\n <Input autoComplete=\"email\" required type=\"email\" />\n <FieldError />\n </Field>\n <Button className=\"w-full\" loading={pending} type=\"submit\">\n {labels.submit}\n </Button>\n </Form>\n </AuthCard>\n )\n}\n",
9
+ "target": "~/packages/ui/src/blocks/application/auth/forgot-password-2/forgot-password-2.tsx"
10
+ },
11
+ {
12
+ "path": "blocks/application/auth/forgot-password-2/index.ts",
13
+ "type": "registry:file",
14
+ "content": "export type { AuthFieldErrors } from '../shared/types'\nexport { ForgotPassword2 } from './forgot-password-2'\nexport type {\n ForgotPassword2Labels,\n ForgotPassword2Props,\n ForgotPassword2Values,\n} from './types'\n",
15
+ "target": "~/packages/ui/src/blocks/application/auth/forgot-password-2/index.ts"
16
+ },
17
+ {
18
+ "path": "blocks/application/auth/forgot-password-2/labels.ts",
19
+ "type": "registry:file",
20
+ "content": "import { defaultAuthCommonLabels } from '../shared/labels'\nimport type { ForgotPassword2Labels } from './types'\n\nexport const defaultForgotPassword2Labels: ForgotPassword2Labels = {\n description:\n 'Informe seu e-mail e enviaremos um link para redefinir a senha.',\n email: defaultAuthCommonLabels.email,\n errorTitle: defaultAuthCommonLabels.errorTitle,\n sentDescription: (destination) =>\n destination\n ? `Enviamos um link para redefinir a senha para ${destination}.`\n : 'Enviamos um link para redefinir a senha para o seu e-mail.',\n sentTitle: 'Verifique seu e-mail',\n submit: 'Enviar link',\n title: 'Esqueceu a senha?',\n}\n",
21
+ "target": "~/packages/ui/src/blocks/application/auth/forgot-password-2/labels.ts"
22
+ },
23
+ {
24
+ "path": "blocks/application/auth/forgot-password-2/types.ts",
25
+ "type": "registry:file",
26
+ "content": "import type { AuthCommonLabels, AuthFieldErrors } from '../shared/types'\n\nexport interface ForgotPassword2Values {\n email: string\n}\n\nexport interface ForgotPassword2Labels\n extends Pick<AuthCommonLabels, 'email' | 'errorTitle'> {\n description: string\n sentDescription: (destination?: string) => string\n sentTitle: string\n submit: string\n title: string\n}\n\nexport interface ForgotPassword2Props {\n destination?: string\n error?: string\n fieldErrors?: AuthFieldErrors<ForgotPassword2Values>\n labels?: Partial<ForgotPassword2Labels>\n onSubmit: (values: ForgotPassword2Values) => void\n pending?: boolean\n sent?: boolean\n}\n",
27
+ "target": "~/packages/ui/src/blocks/application/auth/forgot-password-2/types.ts"
28
+ },
29
+ {
30
+ "path": "blocks/application/auth/shared/auth-card.tsx",
31
+ "type": "registry:file",
32
+ "content": "'use client'\n\nimport { Alert, AlertDescription, AlertTitle } from '@tc96/ui/alert'\nimport {\n Card,\n CardDescription,\n CardHeader,\n CardPanel,\n CardTitle,\n} from '@tc96/ui/card'\nimport type { ReactElement, ReactNode, Ref } from 'react'\n\nexport interface AuthCardProps {\n alertRef?: Ref<HTMLDivElement>\n children?: ReactNode\n description?: ReactNode\n error?: string\n errorTitle: string\n footer?: ReactNode\n logo?: ReactNode\n notice?: ReactNode\n title: ReactNode\n titleRef?: Ref<HTMLDivElement>\n}\n\nexport function AuthCard({\n alertRef,\n children,\n description,\n error,\n errorTitle,\n footer,\n logo,\n notice,\n title,\n titleRef,\n}: Readonly<AuthCardProps>): ReactElement {\n return (\n <main className=\"flex min-h-svh items-center justify-center p-4 sm:p-6\">\n <div className=\"flex w-full max-w-sm flex-col gap-6\">\n <Card>\n <CardHeader className=\"justify-items-center text-center\">\n {logo ? (\n <div className=\"mb-2 flex justify-center\">{logo}</div>\n ) : null}\n <CardTitle\n ref={titleRef}\n render={(props) => <h1 {...props} />}\n tabIndex={titleRef ? -1 : undefined}\n >\n {title}\n </CardTitle>\n {description ? (\n <CardDescription>{description}</CardDescription>\n ) : null}\n </CardHeader>\n <CardPanel className=\"flex flex-col gap-4\">\n {error ? (\n <Alert ref={alertRef} tabIndex={-1} variant=\"error\">\n <AlertTitle>{errorTitle}</AlertTitle>\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n ) : null}\n {children}\n </CardPanel>\n </Card>\n {footer ? (\n <div\n className=\"flex flex-wrap items-center justify-center gap-1 text-muted-foreground text-sm\"\n data-slot=\"auth-footer\"\n >\n {footer}\n </div>\n ) : null}\n {notice}\n </div>\n </main>\n )\n}\n",
33
+ "target": "~/packages/ui/src/blocks/application/auth/shared/auth-card.tsx"
34
+ },
35
+ {
36
+ "path": "blocks/application/auth/shared/labels.ts",
37
+ "type": "registry:file",
38
+ "content": "import type { AuthCommonLabels, AuthNewPasswordLabels } from './types'\n\nexport const defaultAuthCommonLabels: AuthCommonLabels = {\n email: 'E-mail',\n errorTitle: 'Não foi possível continuar',\n hidePassword: 'Ocultar senha',\n password: 'Senha',\n providerContinue: (label) => `Continuar com ${label}`,\n providersGroup: 'Entrar com outro serviço',\n providersSeparator: 'ou continue com e-mail',\n showPassword: 'Mostrar senha',\n}\n\nexport const defaultAuthNewPasswordLabels: AuthNewPasswordLabels = {\n confirmPassword: 'Confirmar senha',\n passwordMismatch: 'As senhas não coincidem.',\n suggestionLowercase: 'minúscula',\n suggestionMet: 'atendida',\n suggestionMissing: 'faltando',\n suggestionNumber: 'número',\n suggestionSymbol: 'símbolo',\n suggestionUppercase: 'maiúscula',\n}\n\nexport function resolveAuthLabels<TLabels>(\n defaults: TLabels,\n labels?: Partial<TLabels>,\n): TLabels {\n return { ...defaults, ...labels }\n}\n",
39
+ "target": "~/packages/ui/src/blocks/application/auth/shared/labels.ts"
40
+ },
41
+ {
42
+ "path": "blocks/application/auth/shared/to-form-errors.ts",
43
+ "type": "registry:file",
44
+ "content": "export function toFormErrors(\n fieldErrors?: Readonly<Partial<Record<string, string>>>,\n): Record<string, string> {\n const errors: Record<string, string> = {}\n for (const [name, message] of Object.entries(fieldErrors ?? {}))\n if (message) errors[name] = message\n return errors\n}\n",
45
+ "target": "~/packages/ui/src/blocks/application/auth/shared/to-form-errors.ts"
46
+ },
47
+ {
48
+ "path": "blocks/application/auth/shared/types.ts",
49
+ "type": "registry:file",
50
+ "content": "import type { RenderLink } from '@tc96/ui/render-anchor'\nimport type { ReactNode } from 'react'\n\nexport type AuthRenderLink = RenderLink\n\nexport interface AuthProvider {\n icon?: ReactNode\n id: string\n label: string\n}\n\nexport type AuthFieldErrors<TValues> = Partial<Record<keyof TValues, string>>\n\nexport type AuthPasswordSuggestion =\n | 'lowercase'\n | 'uppercase'\n | 'number'\n | 'symbol'\n\nexport interface AuthCommonLabels {\n email: string\n errorTitle: string\n hidePassword: string\n password: string\n providerContinue: (label: string) => string\n providersGroup: string\n providersSeparator: string\n showPassword: string\n}\n\nexport interface AuthNewPasswordLabels {\n confirmPassword: string\n passwordMismatch: string\n suggestionLowercase: string\n suggestionMet: string\n suggestionMissing: string\n suggestionNumber: string\n suggestionSymbol: string\n suggestionUppercase: string\n}\n\nexport interface AuthBaseProps<TLabels> {\n error?: string\n labels?: Partial<TLabels>\n logo?: ReactNode\n pending?: boolean\n renderLink?: AuthRenderLink\n}\n",
51
+ "target": "~/packages/ui/src/blocks/application/auth/shared/types.ts"
52
+ },
53
+ {
54
+ "path": "blocks/application/auth/shared/use-focus-first-invalid.ts",
55
+ "type": "registry:file",
56
+ "content": "'use client'\n\nimport { type RefObject, useEffect, useRef } from 'react'\nimport { toFormErrors } from './to-form-errors'\n\nexport interface UseFocusFirstInvalidOptions {\n alertRef: RefObject<HTMLElement | null>\n error?: string\n fieldErrors?: Readonly<Partial<Record<string, string>>>\n formRef: RefObject<HTMLFormElement | null>\n}\n\nfunction findFirstNamedControl(\n form: HTMLFormElement | null,\n names: readonly string[],\n): HTMLElement | undefined {\n return Array.from(form?.elements ?? []).find(\n (element): element is HTMLElement =>\n element instanceof HTMLElement &&\n !(element instanceof HTMLInputElement && element.type === 'hidden') &&\n names.includes(element.getAttribute('name') ?? ''),\n )\n}\n\nexport function useFocusFirstInvalid({\n alertRef,\n error,\n fieldErrors,\n formRef,\n}: UseFocusFirstInvalidOptions): void {\n const invalidNames = Object.keys(toFormErrors(fieldErrors)).join('\\n')\n const hasError = Boolean(error)\n const previous = useRef({ hasError, invalidNames })\n\n useEffect(() => {\n const before = previous.current\n previous.current = { hasError, invalidNames }\n const hasFieldErrors = invalidNames !== ''\n const filled =\n (hasFieldErrors && before.invalidNames === '') ||\n (hasError && !before.hasError)\n if (!filled) return\n const field = hasFieldErrors\n ? findFirstNamedControl(formRef.current, invalidNames.split('\\n'))\n : undefined\n if (field) field.focus()\n else if (hasError) alertRef.current?.focus()\n }, [alertRef, formRef, hasError, invalidNames])\n}\n",
57
+ "target": "~/packages/ui/src/blocks/application/auth/shared/use-focus-first-invalid.ts"
58
+ }
59
+ ],
60
+ "dependencies": [
61
+ "react@19.1.1"
62
+ ],
63
+ "registryDependencies": [
64
+ "@ui/alert",
65
+ "@ui/button",
66
+ "@ui/card",
67
+ "@ui/field",
68
+ "@ui/form",
69
+ "@ui/input",
70
+ "@ui/render-anchor"
71
+ ],
72
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json"
73
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "icon-row",
3
+ "type": "registry:block",
4
+ "files": [
5
+ {
6
+ "path": "parttens/src/icon-row/composition/icon-row/icon-row.tsx",
7
+ "type": "registry:file",
8
+ "content": "'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { Text } from '@tc96/ui/text'\nimport { cn } from '@tc96/utils'\nimport type { ReactElement } from 'react'\nimport type { IconRowProps } from '../../core'\nimport {\n iconRowActionsClassName,\n iconRowContentClassName,\n iconRowDescriptionClassName,\n iconRowRootVariants,\n} from '../../lib/variants'\n\nexport function IconRow({\n actions,\n className,\n description,\n icon,\n iconColor,\n render,\n title,\n variant = 'outline',\n}: Readonly<IconRowProps>): ReactElement {\n return useRender({\n defaultTagName: 'div',\n props: {\n children: (\n <>\n <IconFrame color={iconColor} shape=\"rounded\" size=\"sm\">\n {icon}\n </IconFrame>\n <span\n className={iconRowContentClassName}\n data-slot=\"icon-row-content\"\n >\n <Text data-slot=\"icon-row-title\" size=\"sm\" truncate weight=\"medium\">\n {title}\n </Text>\n {description ? (\n <Text\n className={iconRowDescriptionClassName}\n data-slot=\"icon-row-description\"\n foreground=\"muted\"\n size=\"sm\"\n >\n {description}\n </Text>\n ) : null}\n </span>\n {actions ? (\n <span\n className={iconRowActionsClassName}\n data-slot=\"icon-row-actions\"\n >\n {actions}\n </span>\n ) : null}\n </>\n ),\n className: cn(iconRowRootVariants({ variant }), className),\n 'data-slot': 'icon-row',\n 'data-variant': variant,\n },\n render,\n })\n}\n",
9
+ "target": "~/packages/patterns/src/icon-row/composition/icon-row/icon-row.tsx"
10
+ },
11
+ {
12
+ "path": "parttens/src/icon-row/composition/icon-row/index.ts",
13
+ "type": "registry:file",
14
+ "content": "export { IconRow } from './icon-row'\n",
15
+ "target": "~/packages/patterns/src/icon-row/composition/icon-row/index.ts"
16
+ },
17
+ {
18
+ "path": "parttens/src/icon-row/composition/index.ts",
19
+ "type": "registry:file",
20
+ "content": "export * from './icon-row/index'\n",
21
+ "target": "~/packages/patterns/src/icon-row/composition/index.ts"
22
+ },
23
+ {
24
+ "path": "parttens/src/icon-row/core.ts",
25
+ "type": "registry:file",
26
+ "content": "import type { useRender } from '@base-ui/react/use-render'\nimport type { ReactNode } from 'react'\n\nexport const iconRowVariants = ['outline', 'plain'] as const\n\nexport type IconRowVariant = (typeof iconRowVariants)[number]\n\nexport interface IconRowProps {\n actions?: ReactNode\n className?: string\n description?: ReactNode\n icon: ReactNode\n iconColor?: string\n render?: useRender.ComponentProps<'div'>['render']\n title: ReactNode\n variant?: IconRowVariant\n}\n",
27
+ "target": "~/packages/patterns/src/icon-row/core.ts"
28
+ },
29
+ {
30
+ "path": "parttens/src/icon-row/index.ts",
31
+ "type": "registry:file",
32
+ "content": "export * from './composition/index'\nexport {\n type IconRowProps,\n type IconRowVariant,\n iconRowVariants,\n} from './core'\n",
33
+ "target": "~/packages/patterns/src/icon-row/index.ts"
34
+ },
35
+ {
36
+ "path": "parttens/src/icon-row/lib/variants.ts",
37
+ "type": "registry:file",
38
+ "content": "import { cva } from 'class-variance-authority'\n\nexport const iconRowRootVariants = cva(\n 'flex w-full min-w-0 items-center gap-3 px-3 py-3 text-start outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring [:is(a,button,label)&]:cursor-pointer [:is(a,button,label)&]:hover:bg-muted/50',\n {\n defaultVariants: { variant: 'outline' },\n variants: {\n variant: {\n outline: 'rounded-lg border [label&]:has-data-checked:border-primary',\n plain: '',\n },\n },\n },\n)\n\nexport const iconRowContentClassName = 'flex min-w-0 flex-1 flex-col'\n\nexport const iconRowDescriptionClassName = 'line-clamp-2'\n\nexport const iconRowActionsClassName = 'flex shrink-0 items-center gap-1'\n",
39
+ "target": "~/packages/patterns/src/icon-row/lib/variants.ts"
40
+ }
41
+ ],
42
+ "dependencies": [
43
+ "@base-ui/react@1.8.0",
44
+ "class-variance-authority@0.7.1",
45
+ "react@19.1.1"
46
+ ],
47
+ "registryDependencies": [
48
+ "@ui/icon-frame",
49
+ "@ui/text"
50
+ ],
51
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json"
52
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "impact-map",
3
+ "type": "registry:block",
4
+ "files": [
5
+ {
6
+ "path": "blocks/ai-agents/flow/impact-map/impact-map-skeleton.tsx",
7
+ "type": "registry:file",
8
+ "content": "import { Skeleton } from '@tc96/ui/skeleton'\nimport { cn } from '@tc96/utils'\n\nexport function ImpactMapSkeleton({\n className,\n label,\n title,\n}: Readonly<{ className?: string; label: string; title: string }>) {\n return (\n <section\n aria-busy=\"true\"\n aria-label={label}\n className={cn('grid gap-4', className)}\n >\n <h3 className=\"font-medium text-base\">{title}</h3>\n <div className=\"grid justify-items-center gap-10 rounded-xl border p-6\">\n <Skeleton className=\"h-24 w-56 rounded-xl\" />\n <div className=\"flex gap-6\">\n <Skeleton className=\"h-24 w-56 rounded-xl\" />\n <Skeleton className=\"h-24 w-56 rounded-xl\" />\n </div>\n <div className=\"flex gap-6\">\n <Skeleton className=\"h-24 w-56 rounded-xl\" />\n <Skeleton className=\"h-24 w-56 rounded-xl\" />\n <Skeleton className=\"h-24 w-56 rounded-xl\" />\n </div>\n </div>\n </section>\n )\n}\n",
9
+ "target": "~/packages/ui/src/blocks/ai-agents/flow/impact-map/impact-map-skeleton.tsx"
10
+ },
11
+ {
12
+ "path": "blocks/ai-agents/flow/impact-map/impact-map.tsx",
13
+ "type": "registry:file",
14
+ "content": "'use client'\n\nimport { Avatar, AvatarFallback } from '@tc96/ui/avatar'\nimport { Badge } from '@tc96/ui/badge'\nimport { Button } from '@tc96/ui/button'\nimport { getInitials } from '@tc96/ui/helpers/initials'\nimport { type FlowStep, tidyTree } from '@tc96/ui/patterns/flow/canvas/core'\nimport { StateSurface } from '@tc96/ui/patterns/surfaces/state/composition/state-surface/state-surface'\nimport { Progress } from '@tc96/ui/progress'\nimport { cn } from '@tc96/utils'\nimport { type ReactElement, useMemo } from 'react'\nimport { ImpactMapSkeleton } from './impact-map-skeleton'\nimport { defaultImpactMapLabels } from './labels'\nimport type { ImpactMapNode, ImpactMapProps } from './types'\n\nconst nodeSize = [224, 112] as const\nconst gap = [32, 64] as const\nconst padding = 24\n\nfunction clampProgress(value: number): number {\n return Math.min(100, Math.max(0, Math.round(value)))\n}\n\nfunction layout(nodes: ImpactMapNode[], links: ImpactMapProps['links']) {\n const steps: FlowStep[] = nodes.map((node) => ({\n id: node.id,\n name: node.title,\n position: { x: 0, y: 0 },\n type: node.kind,\n }))\n const placed = tidyTree(\n steps,\n links.map((link) => ({\n id: link.id,\n source: link.target,\n target: link.source,\n })),\n { direction: 'vertical', gap, nodeSize },\n )\n const positions = new Map(placed.map((step) => [step.id, step.position]))\n const width =\n Math.max(0, ...placed.map((step) => step.position.x)) + nodeSize[0]\n const height =\n Math.max(0, ...placed.map((step) => step.position.y)) + nodeSize[1]\n return { height, positions, width }\n}\n\nexport function ImpactMap({\n className,\n error = false,\n labels: labelsProp,\n links,\n nodes,\n onNodeSelect,\n onRetry,\n pending = false,\n selectedId = null,\n}: Readonly<ImpactMapProps>): ReactElement {\n const labels = { ...defaultImpactMapLabels, ...labelsProp }\n const tree = useMemo(() => layout(nodes, links), [nodes, links])\n\n if (pending) {\n return (\n <ImpactMapSkeleton\n className={className}\n label={labels.loading}\n title={labels.title}\n />\n )\n }\n\n const edges = links.flatMap((link) => {\n const from = tree.positions.get(link.source)\n const to = tree.positions.get(link.target)\n if (!from || !to) return []\n const x1 = from.x + nodeSize[0] / 2\n const y1 = from.y\n const x2 = to.x + nodeSize[0] / 2\n const y2 = to.y + nodeSize[1]\n const middle = (y1 + y2) / 2\n return [\n {\n d: `M ${x1} ${y1} C ${x1} ${middle}, ${x2} ${middle}, ${x2} ${y2}`,\n id: link.id,\n },\n ]\n })\n\n return (\n <section\n aria-label={labels.title}\n className={cn('grid gap-4', className)}\n data-slot=\"impact-map\"\n >\n <h3 className=\"font-medium text-base\">{labels.title}</h3>\n {error ? (\n <StateSurface\n actions={\n onRetry ? (\n <Button onClick={onRetry} size=\"sm\" variant=\"outline\">\n {labels.retry}\n </Button>\n ) : undefined\n }\n description={labels.errorDescription}\n kind=\"error\"\n title={labels.errorTitle}\n />\n ) : nodes.length === 0 ? (\n <StateSurface\n description={labels.emptyDescription}\n kind=\"empty\"\n title={labels.emptyTitle}\n />\n ) : (\n <div className=\"overflow-auto rounded-xl border bg-background\">\n <div\n className=\"relative mx-auto\"\n style={{\n height: tree.height + padding * 2,\n width: tree.width + padding * 2,\n }}\n >\n <svg\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-0 size-full\"\n data-slot=\"impact-map-edges\"\n >\n <g transform={`translate(${padding} ${padding})`}>\n {edges.map((edge) => (\n <path\n className=\"fill-none stroke-2 stroke-border\"\n d={edge.d}\n key={edge.id}\n />\n ))}\n </g>\n </svg>\n <ul aria-label={labels.map} className=\"m-0 list-none p-0\">\n {nodes.map((node) => {\n const position = tree.positions.get(node.id)\n if (!position) return null\n const selected = node.id === selectedId\n const progress = clampProgress(node.progress)\n return (\n <li\n className=\"absolute\"\n key={node.id}\n style={{\n height: nodeSize[1],\n left: position.x + padding,\n top: position.y + padding,\n width: nodeSize[0],\n }}\n >\n <button\n aria-pressed={selected}\n className={cn(\n 'grid size-full content-between gap-2 rounded-xl border bg-card p-3 text-start text-card-foreground outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring',\n selected &&\n 'border-primary bg-accent ring-2 ring-primary',\n )}\n data-kind={node.kind}\n data-node={node.id}\n data-selected={selected || undefined}\n onClick={() => onNodeSelect?.(node.id)}\n type=\"button\"\n >\n <span className=\"flex items-start gap-2\">\n <span className=\"grid min-w-0 flex-1 gap-1\">\n <span className=\"text-muted-foreground text-xs\">\n {labels.kinds[node.kind]}\n </span>\n <span className=\"truncate font-medium text-sm\">\n {node.title}\n </span>\n </span>\n {node.owner ? (\n <Avatar\n aria-label={labels.owner(node.owner)}\n className=\"[--avatar-size:--spacing(6)]\"\n role=\"img\"\n >\n <AvatarFallback>\n {getInitials(node.owner)}\n </AvatarFallback>\n </Avatar>\n ) : null}\n </span>\n <span className=\"grid gap-1.5\">\n <Progress\n aria-label={labels.progress(node.title, progress)}\n value={progress}\n />\n <span className=\"flex items-center justify-between text-muted-foreground text-xs tabular-nums\">\n <span>{progress}%</span>\n {node.valueText ? (\n <Badge variant=\"outline\">{node.valueText}</Badge>\n ) : null}\n </span>\n </span>\n </button>\n </li>\n )\n })}\n </ul>\n </div>\n </div>\n )}\n </section>\n )\n}\n",
15
+ "target": "~/packages/ui/src/blocks/ai-agents/flow/impact-map/impact-map.tsx"
16
+ },
17
+ {
18
+ "path": "blocks/ai-agents/flow/impact-map/index.ts",
19
+ "type": "registry:file",
20
+ "content": "export { ImpactMap } from './impact-map'\nexport type {\n ImpactMapKind,\n ImpactMapLabels,\n ImpactMapLink,\n ImpactMapNode,\n ImpactMapProps,\n} from './types'\n",
21
+ "target": "~/packages/ui/src/blocks/ai-agents/flow/impact-map/index.ts"
22
+ },
23
+ {
24
+ "path": "blocks/ai-agents/flow/impact-map/labels.ts",
25
+ "type": "registry:file",
26
+ "content": "import type { ImpactMapLabels } from './types'\n\nexport const defaultImpactMapLabels: ImpactMapLabels = {\n emptyDescription:\n 'Os nós aparecem aqui assim que houver iniciativas e métricas.',\n emptyTitle: 'Nenhum nó no mapa',\n errorDescription: 'Tente novamente em instantes.',\n errorTitle: 'Não foi possível carregar o mapa de impacto',\n kinds: {\n initiative: 'Iniciativa',\n metric: 'Métrica',\n 'north-star': 'North star',\n },\n loading: 'Carregando mapa de impacto',\n map: 'Árvore de impacto',\n owner: (name) => `Responsável: ${name}`,\n progress: (title, value) => `Progresso de ${title}: ${value}%`,\n retry: 'Tentar novamente',\n title: 'Mapa de impacto de crescimento',\n}\n",
27
+ "target": "~/packages/ui/src/blocks/ai-agents/flow/impact-map/labels.ts"
28
+ },
29
+ {
30
+ "path": "blocks/ai-agents/flow/impact-map/types.ts",
31
+ "type": "registry:file",
32
+ "content": "export type ImpactMapKind = 'initiative' | 'metric' | 'north-star'\n\nexport interface ImpactMapNode {\n id: string\n kind: ImpactMapKind\n owner?: string\n progress: number\n title: string\n valueText?: string\n}\n\nexport interface ImpactMapLink {\n id: string\n source: string\n target: string\n}\n\nexport interface ImpactMapLabels {\n emptyDescription: string\n emptyTitle: string\n errorDescription: string\n errorTitle: string\n kinds: Record<ImpactMapKind, string>\n loading: string\n map: string\n owner: (name: string) => string\n progress: (title: string, value: number) => string\n retry: string\n title: string\n}\n\nexport interface ImpactMapProps {\n className?: string\n error?: boolean\n labels?: Partial<ImpactMapLabels>\n links: ImpactMapLink[]\n nodes: ImpactMapNode[]\n onNodeSelect?: (id: string) => void\n onRetry?: () => void\n pending?: boolean\n selectedId?: string | null\n}\n",
33
+ "target": "~/packages/ui/src/blocks/ai-agents/flow/impact-map/types.ts"
34
+ },
35
+ {
36
+ "path": "helpers/initials.ts",
37
+ "type": "registry:file",
38
+ "content": "/**\n * Builds the initials shown in an avatar fallback: the first letter of the\n * first words of a label, upper-cased.\n *\n * @param label - A person or entity name; surrounding and repeated whitespace is ignored.\n * @param size - How many words contribute a letter. Defaults to two.\n * @returns The initials, or an empty string for a blank label.\n */\nexport function getInitials(label: string, size = 2): string {\n return label\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, size)\n .map((part) => part[0])\n .join('')\n .toUpperCase()\n}\n\n/**\n * Picks the text of an avatar fallback: the explicit fallback a person carries,\n * or the initials of its label when there is none.\n *\n * @param person - Anything with a `label` and an optional `fallback`.\n * @param size - How many words contribute a letter when the label is used. Defaults to two.\n * @returns The fallback as given (only `undefined` falls through, so an empty\n * string is kept), otherwise the initials of the label.\n */\nexport function resolveInitials(\n person: { label: string; fallback?: string },\n size = 2,\n): string {\n return person.fallback ?? getInitials(person.label, size)\n}\n",
39
+ "target": "~/packages/ui/src/helpers/initials.ts"
40
+ },
41
+ {
42
+ "path": "patterns/flow/canvas/core.ts",
43
+ "type": "registry:file",
44
+ "content": "import { hierarchy, tree } from 'd3-hierarchy'\n\nexport type FlowDirection = 'horizontal' | 'vertical'\nexport type FlowRunStatus =\n | 'idle'\n | 'running'\n | 'success'\n | 'failed'\n | 'skipped'\n | 'not-run'\nexport type FlowStepKind = 'trigger' | 'action' | 'condition'\n\nexport interface FlowStepType {\n id: string\n label: string\n group: string\n kind?: FlowStepKind\n description?: string\n}\n\nexport interface FlowStepRun {\n status: FlowRunStatus\n durationMs?: number\n metrics?: readonly string[]\n note?: string\n}\n\nexport interface FlowStep {\n id: string\n type: string\n name: string\n description?: string\n kind?: FlowStepKind\n owner?: { name: string; avatarUrl?: string }\n position: { x: number; y: number }\n run?: FlowStepRun\n}\n\nexport interface FlowConnection {\n id: string\n source: string\n target: string\n label?: string\n sourceHandle?: string\n taken?: boolean\n}\n\nexport interface FlowRunSummary {\n status: FlowRunStatus\n id?: string\n note?: string\n completed: number\n total: number\n}\n\nexport type FlowStepAction =\n | 'add-after'\n | 'add-branch'\n | 'view'\n | 'edit'\n | 'duplicate'\n | 'delete'\n\nexport interface TidyTreeOptions {\n direction: FlowDirection\n nodeSize: readonly [number, number]\n gap: readonly [number, number]\n}\n\nexport const flowStepNodeSize = [256, 100] as const\n\nexport const FLOW_STEP_TRANSFER_TYPE = 'application/x-tc96-flow-step'\n\nconst stepKinds: readonly string[] = ['trigger', 'action', 'condition']\n\nexport function serializeStepTransfer(type: FlowStepType) {\n return JSON.stringify(type)\n}\n\nexport function parseStepTransfer(\n raw: string | null | undefined,\n): FlowStepType | null {\n if (!raw) return null\n let value: unknown\n try {\n value = JSON.parse(raw)\n } catch {\n return null\n }\n if (typeof value !== 'object' || value === null) return null\n const { id, label, group, kind, description } = value as Record<\n string,\n unknown\n >\n if (\n typeof id !== 'string' ||\n typeof label !== 'string' ||\n typeof group !== 'string'\n )\n return null\n if (\n kind !== undefined &&\n !(typeof kind === 'string' && stepKinds.includes(kind))\n )\n return null\n if (description !== undefined && typeof description !== 'string') return null\n return {\n id,\n label,\n group,\n ...(kind !== undefined && { kind: kind as FlowStepKind }),\n ...(description !== undefined && { description }),\n }\n}\n\nexport function incomingOf(\n stepId: string,\n connections: readonly FlowConnection[],\n) {\n return connections.filter((connection) => connection.target === stepId)\n}\n\nexport function outgoingOf(\n stepId: string,\n connections: readonly FlowConnection[],\n) {\n return connections.filter((connection) => connection.source === stepId)\n}\n\ninterface TreeNode {\n id: string | null\n children: TreeNode[]\n}\n\nexport function tidyTree(\n steps: readonly FlowStep[],\n connections: readonly FlowConnection[],\n options: TidyTreeOptions,\n): FlowStep[] {\n const { direction, nodeSize, gap } = options\n const ids = new Set(steps.map((step) => step.id))\n const nodes = new Map<string, TreeNode>(\n steps.map((step) => [step.id, { id: step.id, children: [] }]),\n )\n const placed = new Set<string>()\n const roots = steps.filter(\n (step) =>\n !connections.some(\n (connection) =>\n connection.target === step.id &&\n connection.source !== step.id &&\n ids.has(connection.source),\n ),\n )\n const rootNodes: TreeNode[] = []\n const stack: TreeNode[] = []\n const expand = (pending: TreeNode[]) => {\n while (pending.length) {\n const current = pending.pop()\n if (!current?.id) continue\n for (const connection of outgoingOf(current.id, connections)) {\n const child = nodes.get(connection.target)\n if (!child || placed.has(connection.target)) continue\n placed.add(connection.target)\n current.children.push(child)\n pending.push(child)\n }\n }\n }\n for (const root of roots) {\n const node = nodes.get(root.id)\n if (!node) continue\n rootNodes.push(node)\n placed.add(root.id)\n stack.push(node)\n expand(stack)\n }\n for (const step of steps) {\n if (placed.has(step.id)) continue\n const node = nodes.get(step.id)\n if (!node) continue\n rootNodes.push(node)\n placed.add(step.id)\n stack.push(node)\n expand(stack)\n }\n if (!rootNodes.length) return steps.map((step) => ({ ...step }))\n\n const virtualRoot: TreeNode = { id: null, children: rootNodes }\n const [width, height] = nodeSize\n const [gapX, gapY] = gap\n const horizontal = direction === 'horizontal'\n const breadth = horizontal ? height + gapY : width + gapX\n const depth = horizontal ? width + gapX : height + gapY\n const layout = tree<TreeNode>()\n .nodeSize([breadth, depth])\n .separation(() => 1)(hierarchy(virtualRoot, (node) => node.children))\n\n const positions = new Map<string, { x: number; y: number }>()\n for (const node of layout.descendants()) {\n if (node.data.id === null) continue\n const across = node.x - (horizontal ? height : width) / 2\n const along = node.y - depth\n positions.set(\n node.data.id,\n horizontal ? { x: along, y: across } : { x: across, y: along },\n )\n }\n const values = [...positions.values()]\n const minX = Math.min(...values.map((position) => position.x))\n const minY = Math.min(...values.map((position) => position.y))\n\n return steps.map((step) => {\n const position = positions.get(step.id)\n if (!position) return { ...step }\n return {\n ...step,\n position: { x: position.x - minX, y: position.y - minY },\n }\n })\n}\n\nexport function flowRunSummary(\n steps: readonly FlowStep[],\n options: { id?: string } = {},\n): FlowRunSummary {\n const total = steps.length\n const completed = steps.filter(\n (step) => step.run?.status === 'success',\n ).length\n const failed = steps.find((step) => step.run?.status === 'failed')\n const summary = { id: options.id, completed, total }\n if (failed) return { ...summary, status: 'failed', note: failed.run?.note }\n if (steps.some((step) => step.run?.status === 'running'))\n return { ...summary, status: 'running' }\n if (total > 0 && steps.every((step) => step.run?.status === 'skipped'))\n return { ...summary, status: 'skipped' }\n if (\n completed > 0 &&\n steps.every(\n (step) =>\n step.run?.status === 'success' || step.run?.status === 'skipped',\n )\n )\n return { ...summary, status: 'success' }\n if (\n steps.every(\n (step) =>\n !step.run ||\n step.run.status === 'not-run' ||\n step.run.status === 'idle',\n )\n )\n return { ...summary, status: 'not-run' }\n return { ...summary, status: 'idle' }\n}\n",
45
+ "target": "~/packages/ui/src/patterns/flow/canvas/core.ts"
46
+ },
47
+ {
48
+ "path": "patterns/surfaces/state/composition/state-surface/state-surface.tsx",
49
+ "type": "registry:file",
50
+ "content": "import {\n FileMagnifyingGlassIcon,\n LockIcon,\n MagnifyingGlassIcon,\n TrayIcon,\n WarningIcon,\n} from '@phosphor-icons/react'\nimport {\n Empty,\n EmptyContent,\n EmptyDescription,\n EmptyHeader,\n EmptyMedia,\n EmptyTitle,\n} from '@tc96/ui/empty'\nimport { IconFrame } from '@tc96/ui/icon-frame'\nimport { cn } from '@tc96/utils'\nimport type { ReactNode } from 'react'\nimport {\n STATE_SURFACE_ICON_COLORS,\n STATE_SURFACE_ROLES,\n type StateSurfaceKind,\n type StateSurfaceProps,\n} from '../../core'\n\nconst KIND_ICONS = {\n empty: TrayIcon,\n error: WarningIcon,\n 'no-result': MagnifyingGlassIcon,\n 'not-found': FileMagnifyingGlassIcon,\n permission: LockIcon,\n} as const satisfies Record<StateSurfaceKind, typeof TrayIcon>\n\nexport function StateSurface({\n actions,\n className,\n description,\n icon,\n kind,\n title,\n}: StateSurfaceProps): ReactNode {\n const Icon = KIND_ICONS[kind]\n const iconColor = STATE_SURFACE_ICON_COLORS[kind]\n\n return (\n <Empty\n className={className}\n data-kind={kind}\n role={STATE_SURFACE_ROLES[kind]}\n >\n <EmptyHeader>\n {icon === null ? null : (\n <EmptyMedia>\n <IconFrame\n className={cn(!iconColor && 'bg-muted/60')}\n color={iconColor}\n shape=\"rounded\"\n size=\"xl\"\n >\n {icon === undefined ? <Icon aria-hidden=\"true\" /> : icon}\n </IconFrame>\n </EmptyMedia>\n )}\n <EmptyTitle>{title}</EmptyTitle>\n <EmptyDescription>{description}</EmptyDescription>\n </EmptyHeader>\n {actions ? (\n <EmptyContent className=\"flex-row flex-wrap justify-center gap-2\">\n {actions}\n </EmptyContent>\n ) : null}\n </Empty>\n )\n}\n",
51
+ "target": "~/packages/ui/src/patterns/surfaces/state/composition/state-surface/state-surface.tsx"
52
+ },
53
+ {
54
+ "path": "patterns/surfaces/state/core.ts",
55
+ "type": "registry:file",
56
+ "content": "import type { ReactNode } from 'react'\n\nexport const STATE_SURFACE_KINDS = [\n 'empty',\n 'no-result',\n 'error',\n 'permission',\n 'not-found',\n] as const\n\nexport type StateSurfaceKind = (typeof STATE_SURFACE_KINDS)[number]\n\nexport type StateGuardState = 'data' | 'loading' | StateSurfaceKind\n\nexport type StateSurfaceRole = 'alert' | 'status'\n\nexport const STATE_SURFACE_ROLES = {\n empty: 'status',\n error: 'alert',\n 'no-result': 'status',\n 'not-found': 'status',\n permission: 'alert',\n} as const satisfies Record<StateSurfaceKind, StateSurfaceRole>\n\nexport const STATE_SURFACE_ICON_COLORS: Partial<\n Record<StateSurfaceKind, string>\n> = {\n error: 'var(--destructive)',\n permission: 'var(--destructive)',\n}\n\nexport interface StateSurfaceProps {\n actions?: ReactNode\n className?: string\n description: ReactNode\n icon?: ReactNode\n kind: StateSurfaceKind\n title: ReactNode\n}\n\nexport type StateGuardProps = {\n children: ReactNode\n} & (\n | { state: 'data'; surface?: Omit<StateSurfaceProps, 'kind'> }\n | {\n state: 'loading'\n surface: Pick<StateSurfaceProps, 'className' | 'title'> & {\n description?: ReactNode\n }\n }\n | { state: StateSurfaceKind; surface: Omit<StateSurfaceProps, 'kind'> }\n)\n",
57
+ "target": "~/packages/ui/src/patterns/surfaces/state/core.ts"
58
+ }
59
+ ],
60
+ "dependencies": [
61
+ "@phosphor-icons/react@2.1.10",
62
+ "d3-hierarchy@3.1.2",
63
+ "react@19.1.1"
64
+ ],
65
+ "registryDependencies": [
66
+ "@ui/avatar",
67
+ "@ui/badge",
68
+ "@ui/button",
69
+ "@ui/empty",
70
+ "@ui/icon-frame",
71
+ "@ui/progress",
72
+ "@ui/skeleton"
73
+ ],
74
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json"
75
+ }