@usetheo/ui 0.1.0-next.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/CHANGELOG.md +227 -0
- package/LICENSE +201 -0
- package/README.md +347 -0
- package/dist/fonts/LICENSE-GEIST.txt +92 -0
- package/dist/fonts/geist-400.woff2 +0 -0
- package/dist/fonts/geist-500.woff2 +0 -0
- package/dist/fonts/geist-600.woff2 +0 -0
- package/dist/fonts/geist-mono-400.woff2 +0 -0
- package/dist/fonts/geist-mono-500.woff2 +0 -0
- package/dist/fonts/geist-mono-600.woff2 +0 -0
- package/dist/fonts-cdn.css +28 -0
- package/dist/fonts.css +75 -0
- package/dist/index.d.ts +3063 -0
- package/dist/index.js +7746 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +88 -0
- package/dist/tokens.css +230 -0
- package/package.json +520 -0
- package/registry/index.json +700 -0
- package/registry/r/agent-composer.json +22 -0
- package/registry/r/agent-editor.json +27 -0
- package/registry/r/agent-error-card.json +22 -0
- package/registry/r/agent-event.json +24 -0
- package/registry/r/agent-handoff.json +22 -0
- package/registry/r/agent-profile.json +23 -0
- package/registry/r/agent-starting-state.json +22 -0
- package/registry/r/agent-stream.json +27 -0
- package/registry/r/agent-streaming.json +22 -0
- package/registry/r/agent-timeline.json +22 -0
- package/registry/r/agent-types.json +15 -0
- package/registry/r/approval-card.json +25 -0
- package/registry/r/artifact-preview.json +22 -0
- package/registry/r/attachment-chip.json +24 -0
- package/registry/r/audit-log-entry.json +23 -0
- package/registry/r/auto-compact-notice.json +22 -0
- package/registry/r/avatar.json +23 -0
- package/registry/r/badge.json +22 -0
- package/registry/r/browser-controls.json +22 -0
- package/registry/r/build-log-stream.json +19 -0
- package/registry/r/button.json +23 -0
- package/registry/r/capability-indicator.json +23 -0
- package/registry/r/card.json +22 -0
- package/registry/r/chat-composer.json +23 -0
- package/registry/r/chat-message.json +21 -0
- package/registry/r/chat-thread.json +20 -0
- package/registry/r/chat-types.json +15 -0
- package/registry/r/checkbox.json +23 -0
- package/registry/r/cn.json +19 -0
- package/registry/r/command-palette.json +25 -0
- package/registry/r/context-card.json +23 -0
- package/registry/r/context-window-bar.json +20 -0
- package/registry/r/cost-meter.json +22 -0
- package/registry/r/created-files-card.json +23 -0
- package/registry/r/cron-job-card.json +22 -0
- package/registry/r/cron-jobs-list.json +23 -0
- package/registry/r/deployment-row.json +23 -0
- package/registry/r/dialog.json +23 -0
- package/registry/r/diff-viewer.json +20 -0
- package/registry/r/domain-config.json +25 -0
- package/registry/r/empty-state.json +20 -0
- package/registry/r/env-var-editor.json +25 -0
- package/registry/r/folder-context-card.json +23 -0
- package/registry/r/folder-selector.json +22 -0
- package/registry/r/form-field.json +23 -0
- package/registry/r/hook-config.json +22 -0
- package/registry/r/hook-event-log.json +22 -0
- package/registry/r/input.json +19 -0
- package/registry/r/intent-selector.json +24 -0
- package/registry/r/label.json +22 -0
- package/registry/r/lane-board.json +20 -0
- package/registry/r/live-region-context.json +16 -0
- package/registry/r/login-split.json +20 -0
- package/registry/r/mcp-server-card.json +22 -0
- package/registry/r/mcp-server-list.json +23 -0
- package/registry/r/memory-editor.json +23 -0
- package/registry/r/mention-menu.json +23 -0
- package/registry/r/metrics-panel.json +22 -0
- package/registry/r/mode-types.json +15 -0
- package/registry/r/model-card.json +23 -0
- package/registry/r/model-selector.json +23 -0
- package/registry/r/permission-matrix.json +22 -0
- package/registry/r/permission-modal.json +24 -0
- package/registry/r/permission-types.json +15 -0
- package/registry/r/preview-env-card.json +25 -0
- package/registry/r/preview-panel.json +21 -0
- package/registry/r/progress-checklist.json +23 -0
- package/registry/r/project-card.json +25 -0
- package/registry/r/project-switcher.json +22 -0
- package/registry/r/quick-action-chips.json +21 -0
- package/registry/r/radio-group.json +23 -0
- package/registry/r/recent-folders-list.json +22 -0
- package/registry/r/rollback-ui.json +24 -0
- package/registry/r/rule-card.json +23 -0
- package/registry/r/rule-editor.json +28 -0
- package/registry/r/rule-types.json +18 -0
- package/registry/r/run-stats.json +22 -0
- package/registry/r/running-tasks-panel.json +22 -0
- package/registry/r/safe-href.json +16 -0
- package/registry/r/scroll-area.json +22 -0
- package/registry/r/select.json +23 -0
- package/registry/r/session-list-item.json +20 -0
- package/registry/r/session-timeline.json +22 -0
- package/registry/r/sheet.json +24 -0
- package/registry/r/sidebar.json +19 -0
- package/registry/r/skeleton.json +19 -0
- package/registry/r/skill-card.json +24 -0
- package/registry/r/skill-editor.json +28 -0
- package/registry/r/skills-list.json +23 -0
- package/registry/r/social-auth-row.json +21 -0
- package/registry/r/steps-rail.json +20 -0
- package/registry/r/sub-agent-dispatch.json +22 -0
- package/registry/r/switch.json +22 -0
- package/registry/r/system-prompt-editor.json +22 -0
- package/registry/r/tabs.json +22 -0
- package/registry/r/tailwind-preset.json +19 -0
- package/registry/r/task-header.json +24 -0
- package/registry/r/task-plan.json +22 -0
- package/registry/r/task-types.json +15 -0
- package/registry/r/terminal-panel.json +22 -0
- package/registry/r/textarea.json +19 -0
- package/registry/r/theme-provider.json +59 -0
- package/registry/r/theme-script.json +18 -0
- package/registry/r/theo-ui-provider.json +20 -0
- package/registry/r/toast.json +30 -0
- package/registry/r/token-usage-chart.json +20 -0
- package/registry/r/tokens.json +21 -0
- package/registry/r/tool-call-card.json +23 -0
- package/registry/r/tool-call.json +22 -0
- package/registry/r/tool-result.json +20 -0
- package/registry/r/tools-list.json +23 -0
- package/registry/r/tooltip.json +22 -0
- package/registry/r/topnav.json +22 -0
- package/registry/r/types.json +15 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "rule-card",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "RuleCard",
|
|
6
|
+
"description": "Single Rule row in the Rules list.",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
"lucide-react"
|
|
9
|
+
],
|
|
10
|
+
"registryDependencies": [
|
|
11
|
+
"cn",
|
|
12
|
+
"rule-types",
|
|
13
|
+
"tailwind-preset"
|
|
14
|
+
],
|
|
15
|
+
"files": [
|
|
16
|
+
{
|
|
17
|
+
"path": "components/primitives/rule-card/rule-card.tsx",
|
|
18
|
+
"type": "registry:ui",
|
|
19
|
+
"target": "components/ui/rule-card.tsx",
|
|
20
|
+
"content": "import { Globe, Pencil, Trash2 } from \"lucide-react\";\nimport { forwardRef } from \"react\";\nimport type { HTMLAttributes, MouseEvent } from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport type { Rule, RuleScope, RuleState } from \"@/types/rule\";\n\n/**\n * RuleCard — single Rule row in the Rules list. Renders title, scope/state\n * badges, optional tag chips, a truncated body preview, and edit/toggle/delete\n * actions in the corner.\n */\n\nconst SCOPE_LABEL: Record<RuleScope, string> = {\n global: \"Global\",\n project: \"Project\",\n};\n\nconst SCOPE_CLASS: Record<RuleScope, string> = {\n global: \"bg-primary/15 text-primary\",\n project: \"bg-accent/15 text-accent\",\n};\n\ninterface RuleCardProps\n extends Omit<HTMLAttributes<HTMLElement>, \"title\" | \"onSelect\" | \"onToggle\"> {\n rule: Rule;\n /** Click on the card body — typically opens detail/edit view. */\n onSelect?: (id: string) => void;\n /** Click on the edit pencil. Defaults to onSelect if omitted. */\n onEdit?: (id: string) => void;\n /** Click on the trash icon. Renders the icon only when provided. */\n onDelete?: (id: string) => void;\n /** Toggle enabled/disabled. Renders the switch-like dot only when provided. */\n onToggle?: (id: string, next: RuleState) => void;\n}\n\nconst RuleCard = forwardRef<HTMLElement, RuleCardProps>(\n ({ className, rule, onSelect, onEdit, onDelete, onToggle, ...props }, ref) => {\n const handleEdit = (e: MouseEvent) => {\n e.stopPropagation();\n (onEdit ?? onSelect)?.(rule.id);\n };\n const handleDelete = (e: MouseEvent) => {\n e.stopPropagation();\n onDelete?.(rule.id);\n };\n const handleToggle = (e: MouseEvent) => {\n e.stopPropagation();\n onToggle?.(rule.id, rule.state === \"enabled\" ? \"disabled\" : \"enabled\");\n };\n return (\n <article\n ref={ref}\n className={cn(\n \"grid gap-2 rounded-lg border border-border/40 bg-card/40 p-3\",\n \"transition-colors duration-base ease-out-soft\",\n onSelect && \"cursor-pointer hover:border-border hover:bg-card/70\",\n rule.state === \"disabled\" && \"opacity-60\",\n className,\n )}\n onClick={onSelect ? () => onSelect(rule.id) : undefined}\n {...props}\n >\n <header className=\"flex items-start gap-2\">\n <h4 className=\"flex-1 truncate font-display text-foreground text-title-md tracking-tight\">\n {rule.title}\n </h4>\n <span\n className={cn(\n \"inline-flex h-5 shrink-0 items-center gap-1 rounded-md px-2 font-medium font-mono text-label tracking-tight\",\n SCOPE_CLASS[rule.scope],\n )}\n >\n <Globe className=\"size-3\" aria-hidden=\"true\" /> {SCOPE_LABEL[rule.scope]}\n </span>\n </header>\n <p className=\"line-clamp-2 text-body-sm text-muted-foreground\">{rule.body}</p>\n <footer className=\"flex items-center justify-between gap-2\">\n <div className=\"flex flex-wrap items-center gap-1\">\n {rule.tags?.map((t) => (\n <span\n key={t}\n className=\"inline-flex h-4 items-center rounded bg-muted px-1.5 font-mono text-label-caps text-muted-foreground uppercase tracking-wider\"\n >\n {t}\n </span>\n ))}\n {rule.updatedAt ? (\n <span className=\"font-mono text-label text-muted-foreground tabular-nums\">\n · {rule.updatedAt}\n </span>\n ) : null}\n </div>\n <div className=\"flex items-center gap-1\">\n {onToggle ? (\n <button\n type=\"button\"\n onClick={handleToggle}\n aria-label={rule.state === \"enabled\" ? \"Disable rule\" : \"Enable rule\"}\n className={cn(\n \"inline-flex h-6 items-center rounded-full px-2 font-mono text-label\",\n rule.state === \"enabled\"\n ? \"bg-success/15 text-success\"\n : \"bg-muted text-muted-foreground\",\n )}\n >\n {rule.state === \"enabled\" ? \"Enabled\" : \"Disabled\"}\n </button>\n ) : null}\n <button\n type=\"button\"\n onClick={handleEdit}\n aria-label=\"Edit rule\"\n className=\"grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground\"\n >\n <Pencil className=\"size-3.5\" />\n </button>\n {onDelete ? (\n <button\n type=\"button\"\n onClick={handleDelete}\n aria-label=\"Delete rule\"\n className=\"grid size-6 place-items-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive\"\n >\n <Trash2 className=\"size-3.5\" />\n </button>\n ) : null}\n </div>\n </footer>\n </article>\n );\n },\n);\nRuleCard.displayName = \"RuleCard\";\n\nexport { RuleCard };\n"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "rule-editor",
|
|
4
|
+
"type": "registry:block",
|
|
5
|
+
"title": "RuleEditor",
|
|
6
|
+
"description": "Form for creating or editing a Rule (behavior instruction",
|
|
7
|
+
"dependencies": [],
|
|
8
|
+
"registryDependencies": [
|
|
9
|
+
"button",
|
|
10
|
+
"cn",
|
|
11
|
+
"form-field",
|
|
12
|
+
"input",
|
|
13
|
+
"mode-types",
|
|
14
|
+
"rule-types",
|
|
15
|
+
"select",
|
|
16
|
+
"switch",
|
|
17
|
+
"tailwind-preset",
|
|
18
|
+
"textarea"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
{
|
|
22
|
+
"path": "components/composites/rule-editor/rule-editor.tsx",
|
|
23
|
+
"type": "registry:block",
|
|
24
|
+
"target": "components/blocks/rule-editor.tsx",
|
|
25
|
+
"content": "import { useState } from \"react\";\nimport type { FormEvent, HTMLAttributes } from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport { ALL_MODES, MODE_LABEL, type Mode } from \"@/types/mode\";\nimport type { Rule, RuleScope, RuleState } from \"@/types/rule\";\nimport { Button } from \"@/components/ui/button\";\nimport { FormField } from \"@/components/ui/form-field\";\nimport { Input } from \"@/components/ui/input\";\nimport { Select } from \"@/components/ui/select\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { Textarea } from \"@/components/ui/textarea\";\n\n/**\n * RuleEditor — form for creating or editing a Rule (behavior instruction\n * injected into the system prompt).\n */\n\ntype RuleDraft = Omit<Rule, \"id\" | \"updatedAt\"> & {\n id?: string;\n tags?: string[];\n};\n\ninterface RuleEditorProps extends Omit<HTMLAttributes<HTMLFormElement>, \"onSubmit\" | \"onChange\"> {\n initial?: Partial<Rule>;\n onSave: (draft: RuleDraft) => void;\n onCancel?: () => void;\n onDelete?: () => void;\n}\n\nconst SCOPES: Array<{ id: RuleScope; label: string }> = [\n { id: \"global\", label: \"Global — applies to every session\" },\n { id: \"project\", label: \"Project — only this workspace\" },\n];\n\nexport function RuleEditor({\n className,\n initial,\n onSave,\n onCancel,\n onDelete,\n ...formProps\n}: RuleEditorProps) {\n const [title, setTitle] = useState(initial?.title ?? \"\");\n const [body, setBody] = useState(initial?.body ?? \"\");\n const [scope, setScope] = useState<RuleScope>(initial?.scope ?? \"global\");\n const [tagsRaw, setTagsRaw] = useState(initial?.tags?.join(\", \") ?? \"\");\n const [enabled, setEnabled] = useState<RuleState>(initial?.state ?? \"enabled\");\n const [modes, setModes] = useState<Mode[]>(initial?.modes ?? []);\n\n // Note: state is only seeded once on mount. To reset the form when editing\n // a different rule, use the React `key` pattern at the call site:\n // <RuleEditor key={rule.id} initial={rule} ... />\n const toggleMode = (m: Mode) =>\n setModes((prev) => (prev.includes(m) ? prev.filter((x) => x !== m) : [...prev, m]));\n\n const canSave = title.trim().length > 0 && body.trim().length > 0;\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n if (!canSave) return;\n onSave({\n id: initial?.id,\n title: title.trim(),\n body: body.trim(),\n scope,\n state: enabled,\n tags: tagsRaw\n .split(\",\")\n .map((t) => t.trim())\n .filter(Boolean),\n modes: modes.length > 0 ? modes : undefined,\n });\n };\n\n return (\n <form\n onSubmit={handleSubmit}\n className={cn(\"flex h-full flex-col gap-4\", className)}\n {...formProps}\n >\n <FormField>\n <FormField.Label>Title</FormField.Label>\n <FormField.Control>\n <Input\n value={title}\n onChange={(e) => setTitle(e.target.value)}\n placeholder=\"Always write tests before fixes\"\n required\n />\n </FormField.Control>\n <FormField.Hint>Short, imperative summary the agent will keep in memory.</FormField.Hint>\n </FormField>\n\n <FormField className=\"flex-1\">\n <FormField.Label>Body (markdown)</FormField.Label>\n <FormField.Control>\n <Textarea\n value={body}\n onChange={(e) => setBody(e.target.value)}\n rows={8}\n placeholder=\"When fixing a bug, first write a failing regression test, then the fix.\"\n required\n className=\"min-h-[12rem] flex-1 font-mono text-code-sm\"\n />\n </FormField.Control>\n <FormField.Hint>Injected into the system prompt verbatim.</FormField.Hint>\n </FormField>\n\n <div className=\"grid grid-cols-2 gap-3\">\n <FormField>\n <FormField.Label>Scope</FormField.Label>\n <FormField.Control>\n <Select\n value={scope}\n onValueChange={(v) => {\n // Re-audit Issue 7: narrow Select string value against\n // SCOPES.id before casting. Silent no-op for unknown.\n const next = SCOPES.find((s) => s.id === v);\n if (next) setScope(next.id);\n }}\n >\n <Select.Trigger aria-label=\"Select rule scope\">\n <Select.Value />\n </Select.Trigger>\n <Select.Content>\n {SCOPES.map((s) => (\n <Select.Item key={s.id} value={s.id}>\n {s.label}\n </Select.Item>\n ))}\n </Select.Content>\n </Select>\n </FormField.Control>\n </FormField>\n <FormField>\n <FormField.Label>Tags (comma-separated)</FormField.Label>\n <FormField.Control>\n <Input\n value={tagsRaw}\n onChange={(e) => setTagsRaw(e.target.value)}\n placeholder=\"testing, process\"\n />\n </FormField.Control>\n </FormField>\n </div>\n\n <FormField>\n <FormField.Label>Active modes</FormField.Label>\n <div className=\"flex flex-wrap gap-1.5\">\n {ALL_MODES.map((m) => {\n const on = modes.includes(m);\n return (\n <button\n key={m}\n type=\"button\"\n onClick={() => toggleMode(m)}\n aria-pressed={on}\n className={cn(\n \"inline-flex h-7 items-center rounded-full border px-3 font-mono text-body-sm transition-colors\",\n on\n ? \"border-primary bg-primary/15 text-primary\"\n : \"border-border/60 bg-card text-muted-foreground hover:text-foreground\",\n )}\n >\n {MODE_LABEL[m]}\n </button>\n );\n })}\n </div>\n <FormField.Hint>\n {modes.length === 0\n ? \"Empty = global (applies to every mode).\"\n : `Only visible in: ${modes.map((m) => MODE_LABEL[m]).join(\", \")}.`}\n </FormField.Hint>\n </FormField>\n\n <div className=\"flex items-center gap-3\">\n <Switch\n checked={enabled === \"enabled\"}\n onCheckedChange={(v) => setEnabled(v ? \"enabled\" : \"disabled\")}\n aria-label=\"Enabled\"\n />\n <span className=\"text-body-sm text-muted-foreground\">\n {enabled === \"enabled\"\n ? \"Enabled — agent will follow this rule.\"\n : \"Disabled — kept but ignored.\"}\n </span>\n </div>\n\n <footer className=\"flex items-center justify-between gap-2 border-border/40 border-t pt-4\">\n <div>\n {onDelete ? (\n <Button type=\"button\" variant=\"ghost\" onClick={onDelete}>\n Delete\n </Button>\n ) : null}\n </div>\n <div className=\"flex items-center gap-2\">\n {onCancel ? (\n <Button type=\"button\" variant=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n ) : null}\n <Button type=\"submit\" disabled={!canSave}>\n {initial?.id ? \"Save changes\" : \"Create rule\"}\n </Button>\n </div>\n </footer>\n </form>\n );\n}\n"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "rule-types",
|
|
4
|
+
"type": "registry:lib",
|
|
5
|
+
"title": "Theo UI rule types",
|
|
6
|
+
"description": "Shared TypeScript types for Rules — user-authored behavior instructions injected into the system prompt.",
|
|
7
|
+
"files": [
|
|
8
|
+
{
|
|
9
|
+
"path": "types/rule.ts",
|
|
10
|
+
"type": "registry:lib",
|
|
11
|
+
"target": "types/rule.ts",
|
|
12
|
+
"content": "import type { Mode } from \"@/types/mode\";\n\n/**\n * Rule — a user-authored behavior instruction injected into the system prompt.\n *\n * Equivalent to a single markdown file under `.claude/rules/` in Claude Code:\n * short imperative text the user writes once and the agent follows always.\n * Rules can be scoped (`global` = applies to every session; `project` = only\n * inside the current workspace) and toggled on/off without deletion.\n */\n\nexport type RuleScope = \"global\" | \"project\";\nexport type RuleState = \"enabled\" | \"disabled\";\n\nexport interface Rule {\n id: string;\n /** Short title shown in the list. */\n title: string;\n /** Markdown body — the actual instruction injected into the prompt. */\n body: string;\n /** Where this rule applies. */\n scope: RuleScope;\n /** Whether the rule is currently active. */\n state: RuleState;\n /** Optional tags for grouping (\"testing\", \"style\", \"security\"). */\n tags?: string[];\n /** Modes this rule applies to. Omit / empty = global (every mode). */\n modes?: Mode[];\n /** ISO timestamp / friendly label of last edit. */\n updatedAt?: string;\n}\n"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"registryDependencies": [
|
|
16
|
+
"mode-types"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "run-stats",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "RunStats",
|
|
6
|
+
"description": "Inline metric row shown after an agent run.",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
"lucide-react"
|
|
9
|
+
],
|
|
10
|
+
"registryDependencies": [
|
|
11
|
+
"cn",
|
|
12
|
+
"tailwind-preset"
|
|
13
|
+
],
|
|
14
|
+
"files": [
|
|
15
|
+
{
|
|
16
|
+
"path": "components/primitives/run-stats/run-stats.tsx",
|
|
17
|
+
"type": "registry:ui",
|
|
18
|
+
"target": "components/ui/run-stats.tsx",
|
|
19
|
+
"content": "import { Clock, Coins, FileEdit } from \"lucide-react\";\nimport { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\ninterface RunStatsProps extends HTMLAttributes<HTMLDivElement> {\n duration?: string;\n /** Formatted token count, e.g. \"35.7k\". */\n tokens?: string;\n /** Number of files changed in the run. */\n filesChanged?: number;\n}\n\n/**\n * RunStats — inline metric row shown after an agent run.\n *\n * Visual: muted bullet-separated row with clock + tokens + files-changed icons.\n * All optional — the component skips entries that aren't provided.\n */\nconst RunStats = forwardRef<HTMLDivElement, RunStatsProps>(\n ({ className, duration, tokens, filesChanged, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-3 font-mono text-code-sm text-muted-foreground\",\n className,\n )}\n {...props}\n >\n {duration ? (\n <span className=\"inline-flex items-center gap-1.5\">\n <Clock className=\"size-3\" aria-hidden=\"true\" /> {duration}\n </span>\n ) : null}\n {tokens ? (\n <span className=\"inline-flex items-center gap-1.5\">\n <Coins className=\"size-3\" aria-hidden=\"true\" /> {tokens} tokens\n </span>\n ) : null}\n {filesChanged !== undefined ? (\n <span className=\"inline-flex items-center gap-1.5\">\n <FileEdit className=\"size-3\" aria-hidden=\"true\" /> {filesChanged} files\n </span>\n ) : null}\n </div>\n ),\n);\nRunStats.displayName = \"RunStats\";\n\nexport { RunStats };\n"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "running-tasks-panel",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "RunningTasksPanel",
|
|
6
|
+
"description": "Split list of Running vs Completed tasks.",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
"lucide-react"
|
|
9
|
+
],
|
|
10
|
+
"registryDependencies": [
|
|
11
|
+
"cn",
|
|
12
|
+
"tailwind-preset"
|
|
13
|
+
],
|
|
14
|
+
"files": [
|
|
15
|
+
{
|
|
16
|
+
"path": "components/primitives/running-tasks-panel/running-tasks-panel.tsx",
|
|
17
|
+
"type": "registry:ui",
|
|
18
|
+
"target": "components/ui/running-tasks-panel.tsx",
|
|
19
|
+
"content": "import { Bot, CheckCircle2, Loader2, Terminal } from \"lucide-react\";\nimport { forwardRef } from \"react\";\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\nexport type TaskSource = \"agent\" | \"bash\" | \"tool\";\nexport type RunningTaskStatus = \"running\" | \"completed\" | \"failed\";\n\nexport interface RunningTaskItem {\n id: string;\n label: ReactNode;\n source: TaskSource;\n status: RunningTaskStatus;\n}\n\ninterface RunningTasksPanelProps extends HTMLAttributes<HTMLElement> {\n tasks: RunningTaskItem[];\n}\n\nconst sourceIcon = {\n agent: Bot,\n bash: Terminal,\n tool: Bot,\n} as const;\nconst sourceLabel: Record<TaskSource, string> = {\n agent: \"Agent\",\n bash: \"Bash\",\n tool: \"Tool\",\n};\n\n/**\n * RunningTasksPanel — split list of Running vs Completed tasks.\n *\n * Used in the Code workspace right rail to give operational visibility into\n * what the agent is executing (foreground/background) vs what already finished.\n */\nconst RunningTasksPanel = forwardRef<HTMLElement, RunningTasksPanelProps>(\n ({ className, tasks, ...props }, ref) => {\n const running = tasks.filter((t) => t.status === \"running\");\n const completed = tasks.filter((t) => t.status !== \"running\");\n return (\n <section ref={ref} className={cn(\"rounded-xl border bg-card p-4\", className)} {...props}>\n <Group title=\"Running\" empty=\"Nothing running\" items={running} />\n {completed.length > 0 ? (\n <div className=\"mt-4\">\n <Group title=\"Completed\" empty=\"—\" items={completed} />\n </div>\n ) : null}\n </section>\n );\n },\n);\nRunningTasksPanel.displayName = \"RunningTasksPanel\";\n\nfunction Group({\n title,\n empty,\n items,\n}: {\n title: string;\n empty: ReactNode;\n items: RunningTaskItem[];\n}) {\n return (\n <div>\n <h4 className=\"mb-2 font-sans text-label-caps text-muted-foreground uppercase tracking-wider\">\n {title}\n </h4>\n {items.length === 0 ? (\n <p className=\"text-body-sm text-muted-foreground\">{empty}</p>\n ) : (\n <ul className=\"grid gap-1\">\n {items.map((task) => {\n const SourceIcon = sourceIcon[task.source];\n return (\n <li\n key={task.id}\n className=\"flex items-center gap-2 rounded-md px-2 py-1.5 text-body-sm\"\n >\n {task.status === \"running\" ? (\n <Loader2 className=\"size-3.5 animate-spin text-primary\" aria-label=\"running\" />\n ) : task.status === \"completed\" ? (\n <CheckCircle2 className=\"size-3.5 text-success\" aria-label=\"completed\" />\n ) : (\n <span className=\"size-2 rounded-full bg-destructive\" aria-label=\"failed\" />\n )}\n <SourceIcon\n className=\"size-3.5 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <span className=\"flex-1 truncate\">{task.label}</span>\n <span className=\"font-mono text-label text-muted-foreground uppercase\">\n {sourceLabel[task.source]}\n </span>\n </li>\n );\n })}\n </ul>\n )}\n </div>\n );\n}\n\nexport { RunningTasksPanel };\n"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "safe-href",
|
|
4
|
+
"type": "registry:lib",
|
|
5
|
+
"title": "safeHref (XSS-safe URL guard)",
|
|
6
|
+
"description": "Defang javascript:/vbscript:/data:text/html URIs before rendering as <a href>. Returns undefined for dangerous protocols so the caller can render a non-link fallback.",
|
|
7
|
+
"dependencies": [],
|
|
8
|
+
"files": [
|
|
9
|
+
{
|
|
10
|
+
"path": "lib/safe-href.ts",
|
|
11
|
+
"type": "registry:lib",
|
|
12
|
+
"target": "lib/safe-href.ts",
|
|
13
|
+
"content": "/**\n * safeHref — defang `javascript:`, `vbscript:`, and `data:text/html` URIs.\n *\n * T3.3 (Security SEC-003). When a consumer passes user-controlled data as\n * an href to one of our card composites (`ProjectCard.href`, `PreviewEnvCard.url`,\n * etc.), an attacker who controls that data can craft a `javascript:alert(...)`\n * URI that fires in the application's origin on click. This is a standard\n * component-library hardening (mitigation also documented in `SECURITY.md`).\n *\n * Returns `undefined` for dangerous protocols so the consuming component\n * can short-circuit to a non-link rendering. Returns the URL unchanged for\n * safe protocols (`http`, `https`, `mailto`, `tel`, relative paths).\n *\n * Allowed (returns input unchanged):\n * - \"https://example.com/path?query\"\n * - \"/internal/route\"\n * - \"mailto:dev@usetheo.dev\"\n * - \"tel:+15551234567\"\n *\n * Blocked (returns undefined):\n * - \"javascript:alert(1)\" — XSS via JS execution\n * - \" JavaScript:alert(1)\" — case-insensitive, leading whitespace\n * - \"vbscript:msgbox(1)\" — legacy IE XSS surface (still relevant on\n * certain enterprise envs)\n * - \"data:text/html,...\" — inline HTML/script payloads\n */\n\nconst DANGEROUS_PROTOCOL_PATTERNS: readonly RegExp[] = [\n /^javascript:/i,\n /^vbscript:/i,\n /^data:text\\/html/i,\n];\n\nexport function safeHref(url: string | null | undefined): string | undefined {\n if (url === null || url === undefined) return undefined;\n const trimmed = url.trim();\n if (trimmed.length === 0) return undefined;\n for (const pattern of DANGEROUS_PROTOCOL_PATTERNS) {\n if (pattern.test(trimmed)) return undefined;\n }\n return url;\n}\n"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "scroll-area",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "ScrollArea",
|
|
6
|
+
"description": "Custom scroller with Violet Forge styling.",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
"@radix-ui/react-scroll-area"
|
|
9
|
+
],
|
|
10
|
+
"registryDependencies": [
|
|
11
|
+
"cn",
|
|
12
|
+
"tailwind-preset"
|
|
13
|
+
],
|
|
14
|
+
"files": [
|
|
15
|
+
{
|
|
16
|
+
"path": "components/primitives/scroll-area/scroll-area.tsx",
|
|
17
|
+
"type": "registry:ui",
|
|
18
|
+
"target": "components/ui/scroll-area.tsx",
|
|
19
|
+
"content": "import * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\n/**\n * ScrollArea — custom scroller with Violet Forge styling.\n *\n * Built on Radix ScrollArea so the native scrollbar is always hidden and the\n * custom thumb stays consistent across Chrome/Firefox/Safari/macOS-trackpad.\n *\n * Visual:\n * - track is transparent, only the thumb is visible.\n * - thumb is `--primary` at 25% opacity by default; on hover, 45% with violet glow.\n * - active drag bumps to 60%.\n * - the rounded full pill thumb plays well with the brutalist border language\n * but stays subtle (1.5px wide on rest, 3px on hover).\n *\n * Modes (via `type`):\n * - \"hover\" (default) — scrollbar fades in on hover/focus, otherwise hidden.\n * - \"always\" — scrollbar always visible.\n * - \"auto\" — scrollbar visible only when content overflows.\n * - \"scroll\" — Radix-managed: visible only while scrolling.\n */\n\ninterface ScrollAreaProps extends ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {\n /**\n * Optional override for which scrollbar(s) to render.\n * Defaults: vertical only. Set to \"both\" for grids/tables with overflow-x.\n */\n orientation?: \"vertical\" | \"horizontal\" | \"both\";\n /**\n * Thickness of the scrollbar. Default \"thin\" (2.5px → 3.5px on hover).\n * Use \"regular\" (8px) for content where the scrollbar should be a more prominent target.\n */\n size?: \"thin\" | \"regular\";\n}\n\nconst ScrollAreaRoot = forwardRef<ElementRef<typeof ScrollAreaPrimitive.Root>, ScrollAreaProps>(\n (\n { className, children, orientation = \"vertical\", size = \"thin\", type = \"hover\", ...props },\n ref,\n ) => (\n <ScrollAreaPrimitive.Root\n ref={ref}\n type={type}\n className={cn(\"relative overflow-hidden\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n className={cn(\n \"h-full w-full rounded-[inherit]\",\n // Smooth scroll-behavior + masked overflow inheriting any inner radius\n \"[&>div]:!block\",\n )}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n {orientation === \"vertical\" || orientation === \"both\" ? (\n <ScrollBar orientation=\"vertical\" size={size} />\n ) : null}\n {orientation === \"horizontal\" || orientation === \"both\" ? (\n <ScrollBar orientation=\"horizontal\" size={size} />\n ) : null}\n <ScrollAreaPrimitive.Corner className=\"bg-transparent\" />\n </ScrollAreaPrimitive.Root>\n ),\n);\nScrollAreaRoot.displayName = \"ScrollArea\";\n\ninterface ScrollBarProps\n extends ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar> {\n size?: \"thin\" | \"regular\";\n}\n\nconst ScrollBar = forwardRef<\n ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n ScrollBarProps\n>(({ className, orientation = \"vertical\", size = \"thin\", ...props }, ref) => (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n \"z-10 flex touch-none select-none p-0.5 transition-[width,height,background-color] duration-base ease-out-soft\",\n // hover state slightly lifts the track with a near-invisible violet wash\n \"hover:bg-primary/5\",\n orientation === \"vertical\" &&\n (size === \"thin\"\n ? \"h-full w-2.5 border-l border-l-transparent\"\n : \"h-full w-3 border-l border-l-transparent\"),\n orientation === \"horizontal\" &&\n (size === \"thin\"\n ? \"h-2.5 w-full flex-col border-t border-t-transparent\"\n : \"h-3 w-full flex-col border-t border-t-transparent\"),\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n className={cn(\n \"relative flex-1 rounded-full bg-primary/30\",\n \"transition-[background-color,box-shadow] duration-fast ease-out-soft\",\n // Theme-aware: glow uses --primary (recolors when theme switches)\n \"hover:bg-primary/55 hover:shadow-[0_0_8px_hsl(var(--primary)/0.35)]\",\n // Drag state uses Radix data-state=\"visible\" + :active\n \"active:bg-primary/75 data-[state=visible]:bg-primary/45\",\n )}\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n));\nScrollBar.displayName = \"ScrollArea.Bar\";\n\n// Compound assembly. `ScrollArea.Bar` is the only public surface for the\n// scroll bar. The previous standalone `ScrollBar` re-export was deprecated\n// theater in v0.0.0 (no public consumers exist on a pre-published package),\n// so it was removed cleanly in T7.4 (agent-team-audit-fixes plan).\nconst ScrollArea = /*#__PURE__*/ Object.assign(ScrollAreaRoot, { Bar: ScrollBar });\n\nexport { ScrollArea };\n"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "select",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "Select",
|
|
6
|
+
"description": "Styled wrapper around Radix Select.",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
"@radix-ui/react-select",
|
|
9
|
+
"lucide-react"
|
|
10
|
+
],
|
|
11
|
+
"registryDependencies": [
|
|
12
|
+
"cn",
|
|
13
|
+
"tailwind-preset"
|
|
14
|
+
],
|
|
15
|
+
"files": [
|
|
16
|
+
{
|
|
17
|
+
"path": "components/primitives/select/select.tsx",
|
|
18
|
+
"type": "registry:ui",
|
|
19
|
+
"target": "components/ui/select.tsx",
|
|
20
|
+
"content": "import * as SelectPrimitive from \"@radix-ui/react-select\";\nimport { Check, ChevronDown, ChevronUp } from \"lucide-react\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\n/**\n * Select — styled wrapper around Radix Select.\n *\n * Composition:\n * <Select value={value} onValueChange={setValue}>\n * <Select.Trigger>\n * <Select.Value placeholder=\"Pick…\" />\n * </Select.Trigger>\n * <Select.Content>\n * <Select.Group>\n * <Select.Label>Group</Select.Label>\n * <Select.Item value=\"a\">A</Select.Item>\n * </Select.Group>\n * </Select.Content>\n * </Select>\n *\n * Trigger matches Input height + violet focus ring. Content uses popover\n * surface with check on the selected item.\n */\n\nconst SelectTrigger = forwardRef<\n ElementRef<typeof SelectPrimitive.Trigger>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-card px-3 py-2\",\n \"text-body-md text-foreground placeholder:text-muted-foreground\",\n \"transition-[border-color,box-shadow] duration-base ease-out-soft\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"focus-visible:border-primary\",\n \"data-[placeholder]:text-muted-foreground\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n \"[&>span]:line-clamp-1\",\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n));\nSelectTrigger.displayName = \"Select.Trigger\";\n\nconst SelectScrollUpButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1\", className)}\n {...props}\n >\n <ChevronUp className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = \"Select.ScrollUpButton\";\n\nconst SelectScrollDownButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton\n ref={ref}\n className={cn(\"flex cursor-default items-center justify-center py-1\", className)}\n {...props}\n >\n <ChevronDown className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = \"Select.ScrollDownButton\";\n\nconst SelectContent = forwardRef<\n ElementRef<typeof SelectPrimitive.Content>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n className={cn(\n \"relative z-50 min-w-[8rem] overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-md\",\n \"data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out\",\n position === \"popper\" && \"data-[side=top]:-translate-y-1 data-[side=bottom]:translate-y-1\",\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n \"p-1\",\n position === \"popper\" &&\n \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\",\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n));\nSelectContent.displayName = \"Select.Content\";\n\nconst SelectLabel = forwardRef<\n ElementRef<typeof SelectPrimitive.Label>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 font-mono text-label-caps text-muted-foreground uppercase tracking-wider\",\n className,\n )}\n {...props}\n />\n));\nSelectLabel.displayName = \"Select.Label\";\n\nconst SelectItem = forwardRef<\n ElementRef<typeof SelectPrimitive.Item>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center gap-2 rounded-md py-1.5 pr-2 pl-7\",\n \"text-body-sm outline-none\",\n \"focus:bg-muted focus:text-foreground\",\n \"data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-1.5 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"size-3.5 text-primary\" aria-hidden=\"true\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n));\nSelectItem.displayName = \"Select.Item\";\n\nconst SelectSeparator = forwardRef<\n ElementRef<typeof SelectPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-border/40\", className)}\n {...props}\n />\n));\nSelectSeparator.displayName = \"Select.Separator\";\n\nconst Select = SelectPrimitive.Root as typeof SelectPrimitive.Root & {\n Trigger: typeof SelectTrigger;\n Value: typeof SelectPrimitive.Value;\n Content: typeof SelectContent;\n Group: typeof SelectPrimitive.Group;\n Label: typeof SelectLabel;\n Item: typeof SelectItem;\n Separator: typeof SelectSeparator;\n};\nSelect.Trigger = SelectTrigger;\nSelect.Value = SelectPrimitive.Value;\nSelect.Content = SelectContent;\nSelect.Group = SelectPrimitive.Group;\nSelect.Label = SelectLabel;\nSelect.Item = SelectItem;\nSelect.Separator = SelectSeparator;\n\nexport { Select };\n"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "session-list-item",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "SessionListItem",
|
|
6
|
+
"description": "Single row in the sidebar's Sessions list for a code agent",
|
|
7
|
+
"dependencies": [],
|
|
8
|
+
"registryDependencies": [
|
|
9
|
+
"cn",
|
|
10
|
+
"tailwind-preset"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"path": "components/primitives/session-list-item/session-list-item.tsx",
|
|
15
|
+
"type": "registry:ui",
|
|
16
|
+
"target": "components/ui/session-list-item.tsx",
|
|
17
|
+
"content": "import { forwardRef } from \"react\";\nimport type { ButtonHTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\n/**\n * SessionListItem — single row in the sidebar's Sessions list for a code agent\n * app. Richer than the generic `Sidebar.Item`: shows a status dot, the agent\n * mode last used (chat/code/infra), and a relative timestamp.\n *\n * <SessionListItem\n * title=\"Build the alignment grid demo\"\n * status=\"running\"\n * mode=\"code\"\n * timestamp=\"2m ago\"\n * active\n * onClick={() => navigate(`/session/${id}`)}\n * />\n *\n * The status dot maps to the agent run state and animates while running.\n */\n\nexport type SessionRunStatus = \"running\" | \"queued\" | \"completed\" | \"failed\" | \"cancelled\";\nexport type SessionMode = \"chat\" | \"code\" | \"infra\";\n\nconst STATUS_CLASS: Record<SessionRunStatus, string> = {\n running: \"bg-success animate-pulse\",\n queued: \"bg-warning\",\n completed: \"bg-muted-foreground/50\",\n failed: \"bg-destructive\",\n cancelled: \"bg-muted-foreground/30\",\n};\n\nconst STATUS_LABEL: Record<SessionRunStatus, string> = {\n running: \"Running\",\n queued: \"Queued\",\n completed: \"Completed\",\n failed: \"Failed\",\n cancelled: \"Cancelled\",\n};\n\nconst MODE_CLASS: Record<SessionMode, string> = {\n chat: \"bg-primary/15 text-primary\",\n code: \"bg-success/15 text-success\",\n infra: \"bg-accent/15 text-accent\",\n};\n\ninterface SessionListItemProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\" | \"children\" | \"title\"> {\n /** Session title (truncated). */\n title: ReactNode;\n /** Agent run state. Drives the status dot. */\n status: SessionRunStatus;\n /** Last mode the user was viewing this session in. Optional pill. */\n mode?: SessionMode;\n /** Relative timestamp string (\"2m ago\", \"yesterday\"). */\n timestamp?: ReactNode;\n /** Optional unread count (pending agent events, new outputs). */\n unread?: number;\n /** Whether this is the currently selected session. */\n active?: boolean;\n}\n\nconst SessionListItem = forwardRef<HTMLButtonElement, SessionListItemProps>(\n (\n { className, title, status, mode, timestamp, unread, active, onClick, disabled, ...props },\n ref,\n ) => (\n <button\n ref={ref}\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n aria-current={active ? \"true\" : undefined}\n className={cn(\n \"group grid w-full grid-cols-[auto_1fr_auto] items-center gap-2 rounded-md px-2 py-2 text-left\",\n \"transition-colors duration-base ease-out-soft\",\n active\n ? \"bg-muted text-foreground\"\n : \"text-muted-foreground hover:bg-muted/50 hover:text-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n >\n <span\n className={cn(\"size-2 shrink-0 rounded-full\", STATUS_CLASS[status])}\n aria-label={STATUS_LABEL[status]}\n role=\"img\"\n />\n <span className=\"grid min-w-0\">\n <span className=\"truncate font-medium text-body-sm\">{title}</span>\n {(mode || timestamp) && (\n <span className=\"mt-0.5 flex items-center gap-1.5 font-mono text-label text-muted-foreground\">\n {mode ? (\n <span\n className={cn(\n \"inline-flex h-3.5 items-center rounded px-1 font-medium text-label-caps uppercase tracking-wider\",\n MODE_CLASS[mode],\n )}\n >\n {mode}\n </span>\n ) : null}\n {timestamp ? <span className=\"truncate\">{timestamp}</span> : null}\n </span>\n )}\n </span>\n {unread && unread > 0 ? (\n <span className=\"inline-flex min-w-[1.25rem] shrink-0 items-center justify-center rounded-full bg-primary px-1.5 font-mono text-label text-primary-foreground tabular-nums\">\n {unread > 99 ? \"99+\" : unread}\n </span>\n ) : null}\n </button>\n ),\n);\nSessionListItem.displayName = \"SessionListItem\";\n\nexport { SessionListItem };\n"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "session-timeline",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "SessionTimeline",
|
|
6
|
+
"description": "Historical view of past agent sessions with per-row",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
"lucide-react"
|
|
9
|
+
],
|
|
10
|
+
"registryDependencies": [
|
|
11
|
+
"cn",
|
|
12
|
+
"tailwind-preset"
|
|
13
|
+
],
|
|
14
|
+
"files": [
|
|
15
|
+
{
|
|
16
|
+
"path": "components/primitives/session-timeline/session-timeline.tsx",
|
|
17
|
+
"type": "registry:ui",
|
|
18
|
+
"target": "components/ui/session-timeline.tsx",
|
|
19
|
+
"content": "import { ChevronRight, Clock, Coins, MessageSquare, Sparkles } from \"lucide-react\";\nimport { forwardRef } from \"react\";\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\nexport type SessionStatus = \"active\" | \"completed\" | \"failed\" | \"aborted\";\n\nexport interface SessionSummary {\n id: string;\n /** Friendly title (often the first user message). */\n title: string;\n /** ISO timestamp / friendly date label. */\n startedAt: string;\n duration?: string;\n status: SessionStatus;\n /** Agent/model that ran the session. */\n model?: string;\n /** Total tokens consumed (formatted, e.g. \"35.7k\"). */\n tokens?: string;\n /** Total cost (USD). */\n cost?: number;\n /** Number of messages in the session. */\n messageCount?: number;\n}\n\ninterface SessionTimelineProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n sessions: SessionSummary[];\n /** Title above the list. */\n title?: ReactNode;\n /** Fires when a row is clicked. */\n onOpen?: (id: string) => void;\n}\n\nconst STATUS_CLASS: Record<SessionStatus, string> = {\n active: \"border-primary/40 bg-primary/15 text-primary\",\n completed: \"border-success/40 bg-success/15 text-success\",\n failed: \"border-destructive/40 bg-destructive/15 text-destructive\",\n aborted: \"border-border/40 bg-muted text-muted-foreground\",\n};\n\nconst STATUS_LABEL: Record<SessionStatus, string> = {\n active: \"Active\",\n completed: \"Completed\",\n failed: \"Failed\",\n aborted: \"Aborted\",\n};\n\n/**\n * SessionTimeline — historical view of past agent sessions with per-row\n * tokens / cost / duration / status. Click a row to open the full session.\n */\nconst SessionTimeline = forwardRef<HTMLDivElement, SessionTimelineProps>(\n ({ className, sessions, title = \"Recent sessions\", onOpen, ...props }, ref) => (\n <section\n ref={ref}\n className={cn(\"rounded-xl border bg-card\", className)}\n aria-label=\"Session history\"\n {...props}\n >\n {title ? (\n <header className=\"flex items-baseline justify-between border-border/40 border-b px-4 py-3\">\n <h3 className=\"font-display text-title-md tracking-tight\">{title}</h3>\n <span className=\"font-mono text-label text-muted-foreground\">\n {sessions.length} {sessions.length === 1 ? \"session\" : \"sessions\"}\n </span>\n </header>\n ) : null}\n <ul className=\"divide-y divide-border/30\">\n {sessions.map((s) => {\n const RowTag = onOpen ? \"button\" : \"div\";\n return (\n <li key={s.id}>\n <RowTag\n type={onOpen ? \"button\" : undefined}\n onClick={onOpen ? () => onOpen(s.id) : undefined}\n className={cn(\n \"grid w-full grid-cols-[1fr_auto] items-center gap-3 px-4 py-3 text-left\",\n onOpen &&\n \"hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:outline-none\",\n )}\n >\n <div className=\"min-w-0\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <p className=\"truncate font-medium text-body-sm text-foreground\">{s.title}</p>\n <span\n className={cn(\n \"inline-flex shrink-0 items-center rounded-full border px-2 py-0.5\",\n \"font-mono text-label uppercase tracking-wider\",\n STATUS_CLASS[s.status],\n )}\n >\n {STATUS_LABEL[s.status]}\n </span>\n </div>\n <div className=\"mt-1 flex flex-wrap items-center gap-3 font-mono text-label text-muted-foreground\">\n <span className=\"inline-flex items-center gap-1\">\n <Clock className=\"size-3\" aria-hidden=\"true\" /> {s.startedAt}\n {s.duration ? <> · {s.duration}</> : null}\n </span>\n {s.model ? (\n <span className=\"inline-flex items-center gap-1\">\n <Sparkles className=\"size-3\" aria-hidden=\"true\" /> {s.model}\n </span>\n ) : null}\n {s.tokens ? (\n <span className=\"inline-flex items-center gap-1\">\n <Coins className=\"size-3\" aria-hidden=\"true\" /> {s.tokens} tok\n </span>\n ) : null}\n {s.cost !== undefined ? (\n <span className=\"tabular-nums\">${s.cost.toFixed(2)}</span>\n ) : null}\n {s.messageCount !== undefined ? (\n <span className=\"inline-flex items-center gap-1\">\n <MessageSquare className=\"size-3\" aria-hidden=\"true\" /> {s.messageCount}\n </span>\n ) : null}\n </div>\n </div>\n {onOpen ? (\n <ChevronRight\n className=\"size-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n ) : null}\n </RowTag>\n </li>\n );\n })}\n {sessions.length === 0 ? (\n <li className=\"px-4 py-8 text-center font-sans text-body-sm text-muted-foreground\">\n No sessions yet.\n </li>\n ) : null}\n </ul>\n </section>\n ),\n);\nSessionTimeline.displayName = \"SessionTimeline\";\n\nexport { SessionTimeline };\n"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "sheet",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "Sheet",
|
|
6
|
+
"description": "Slide-in side panel built on Radix Dialog.",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
"@radix-ui/react-dialog",
|
|
9
|
+
"class-variance-authority",
|
|
10
|
+
"lucide-react"
|
|
11
|
+
],
|
|
12
|
+
"registryDependencies": [
|
|
13
|
+
"cn",
|
|
14
|
+
"tailwind-preset"
|
|
15
|
+
],
|
|
16
|
+
"files": [
|
|
17
|
+
{
|
|
18
|
+
"path": "components/primitives/sheet/sheet.tsx",
|
|
19
|
+
"type": "registry:ui",
|
|
20
|
+
"target": "components/ui/sheet.tsx",
|
|
21
|
+
"content": "import * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { type VariantProps, cva } from \"class-variance-authority\";\nimport { X } from \"lucide-react\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementRef, HTMLAttributes } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\n/**\n * Sheet — slide-in side panel built on Radix Dialog.\n *\n * Same Radix primitive as Dialog, but Content slides from an edge instead of\n * fading from center. Used for: workspace overlays (Memory, Observability,\n * Sub-agents), Settings, contextual filters.\n *\n * Composition:\n * <Sheet>\n * <Sheet.Trigger>Open</Sheet.Trigger>\n * <Sheet.Content side=\"right\">\n * <Sheet.Header>\n * <Sheet.Title>Memory</Sheet.Title>\n * <Sheet.Description>Episodes and wiki pages</Sheet.Description>\n * </Sheet.Header>\n * <Sheet.Body>…</Sheet.Body>\n * <Sheet.Footer>…</Sheet.Footer>\n * </Sheet.Content>\n * </Sheet>\n */\n\nconst Overlay = forwardRef<\n ElementRef<typeof DialogPrimitive.Overlay>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"fixed inset-0 z-50 bg-background/80\",\n \"data-[state=open]:fade-in-0 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:animate-out\",\n className,\n )}\n {...props}\n />\n));\nOverlay.displayName = \"Sheet.Overlay\";\n\nconst sheetVariants = cva(\n [\n \"fixed z-50 flex flex-col gap-3 border-border/40 bg-card text-card-foreground shadow-lg\",\n \"transition duration-base ease-out-soft\",\n \"data-[state=closed]:animate-out data-[state=open]:animate-in\",\n ],\n {\n variants: {\n side: {\n right:\n \"data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right inset-y-0 right-0 h-full w-3/4 max-w-md border-l\",\n left: \"data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left inset-y-0 left-0 h-full w-3/4 max-w-md border-r\",\n top: \"data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top inset-x-0 top-0 h-auto max-h-[80vh] border-b\",\n bottom:\n \"data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom inset-x-0 bottom-0 h-auto max-h-[80vh] border-t\",\n },\n },\n defaultVariants: { side: \"right\" },\n },\n);\n\ninterface ContentProps\n extends ComponentPropsWithoutRef<typeof DialogPrimitive.Content>,\n VariantProps<typeof sheetVariants> {\n hideCloseButton?: boolean;\n}\n\nconst Content = forwardRef<ElementRef<typeof DialogPrimitive.Content>, ContentProps>(\n ({ className, children, hideCloseButton, side = \"right\", ...props }, ref) => (\n <DialogPrimitive.Portal>\n <Overlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(sheetVariants({ side }), className)}\n {...props}\n >\n {children}\n {!hideCloseButton ? (\n <DialogPrimitive.Close\n className={cn(\n \"absolute top-4 right-4 rounded-md p-1 opacity-70\",\n \"transition-opacity hover:opacity-100\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card\",\n \"disabled:pointer-events-none\",\n )}\n >\n <X className=\"size-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n ) : null}\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n ),\n);\nContent.displayName = \"Sheet.Content\";\n\nconst Header = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\"flex flex-col gap-1.5 border-border/40 border-b px-6 py-5 text-left\", className)}\n {...props}\n />\n);\nHeader.displayName = \"Sheet.Header\";\n\nconst Body = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n <div className={cn(\"flex-1 overflow-y-auto px-6 py-4 text-body-md\", className)} {...props} />\n);\nBody.displayName = \"Sheet.Body\";\n\nconst Footer = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse gap-2 border-border/40 border-t px-6 py-4 sm:flex-row sm:justify-end\",\n className,\n )}\n {...props}\n />\n);\nFooter.displayName = \"Sheet.Footer\";\n\nconst Title = forwardRef<\n ElementRef<typeof DialogPrimitive.Title>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"font-display text-foreground text-title-lg tracking-tight\", className)}\n {...props}\n />\n));\nTitle.displayName = \"Sheet.Title\";\n\nconst Description = forwardRef<\n ElementRef<typeof DialogPrimitive.Description>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"text-body-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDescription.displayName = \"Sheet.Description\";\n\nconst Sheet = DialogPrimitive.Root as typeof DialogPrimitive.Root & {\n Trigger: typeof DialogPrimitive.Trigger;\n Close: typeof DialogPrimitive.Close;\n Content: typeof Content;\n Overlay: typeof Overlay;\n Header: typeof Header;\n Body: typeof Body;\n Footer: typeof Footer;\n Title: typeof Title;\n Description: typeof Description;\n};\nSheet.Trigger = DialogPrimitive.Trigger;\nSheet.Close = DialogPrimitive.Close;\nSheet.Content = Content;\nSheet.Overlay = Overlay;\nSheet.Header = Header;\nSheet.Body = Body;\nSheet.Footer = Footer;\nSheet.Title = Title;\nSheet.Description = Description;\n\nexport { Sheet, sheetVariants };\n"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "sidebar",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "Sidebar",
|
|
6
|
+
"description": "Vertical navigation shell with header, sections, items (active / count), and footer slots.",
|
|
7
|
+
"registryDependencies": [
|
|
8
|
+
"cn",
|
|
9
|
+
"tailwind-preset"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
{
|
|
13
|
+
"path": "components/primitives/sidebar/sidebar.tsx",
|
|
14
|
+
"type": "registry:ui",
|
|
15
|
+
"target": "components/ui/sidebar.tsx",
|
|
16
|
+
"content": "import { forwardRef } from \"react\";\nimport type {\n AnchorHTMLAttributes,\n ButtonHTMLAttributes,\n ElementType,\n HTMLAttributes,\n ReactNode,\n Ref,\n} from \"react\";\nimport { cn } from \"@/lib/cn\";\n\n/**\n * Sidebar — vertical navigation shell.\n *\n * Composition:\n * <Sidebar>\n * <Sidebar.Header>…brand…</Sidebar.Header>\n * <Sidebar.Section title=\"Workspace\">\n * <Sidebar.Item icon={Home} active>Overview</Sidebar.Item>\n * <Sidebar.Item icon={Rocket} count={3}>Deployments</Sidebar.Item>\n * </Sidebar.Section>\n * <Sidebar.Footer>…user…</Sidebar.Footer>\n * </Sidebar>\n *\n * Width is 260px by default (matches the wiremocks). Pass `className` to override.\n * Sidebar root is `<aside>` with a hairline right border.\n */\n\nconst Root = forwardRef<HTMLElement, HTMLAttributes<HTMLElement>>(\n ({ className, ...props }, ref) => (\n <aside\n ref={ref}\n className={cn(\n \"flex h-full w-64 flex-col border-border/40 border-r bg-card text-card-foreground\",\n className,\n )}\n {...props}\n />\n ),\n);\nRoot.displayName = \"Sidebar\";\n\nconst Header = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex h-16 items-center gap-3 border-border/40 border-b px-5\", className)}\n {...props}\n />\n ),\n);\nHeader.displayName = \"Sidebar.Header\";\n\ninterface SectionProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n title?: ReactNode;\n}\n\nconst Section = forwardRef<HTMLDivElement, SectionProps>(\n ({ className, title, children, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex flex-col gap-1 px-3 py-4\", className)} {...props}>\n {title ? (\n <p className=\"px-2 pb-1 font-sans text-label-caps text-muted-foreground uppercase\">\n {title}\n </p>\n ) : null}\n {children}\n </div>\n ),\n);\nSection.displayName = \"Sidebar.Section\";\n\ninterface ItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\"> {\n icon?: ElementType;\n active?: boolean;\n count?: number | string;\n as?: \"button\" | \"a\";\n href?: string;\n}\n\n/**\n * Sidebar.Item — single nav row. Renders as <button> by default; pass `as=\"a\"` + `href`\n * to render an anchor for routing.\n */\nconst Item = forwardRef<HTMLElement, ItemProps>(\n ({ className, icon: Icon, active, count, as = \"button\", href, children, ...props }, ref) => {\n const classes = cn(\n \"group flex w-full items-center gap-3 rounded-lg px-2 py-2\",\n \"font-medium font-sans text-body-sm\",\n \"transition-colors duration-base ease-out-soft\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card\",\n active\n ? \"bg-primary/10 text-primary\"\n : \"text-muted-foreground hover:bg-muted hover:text-foreground\",\n className,\n );\n\n const content = (\n <>\n {Icon ? (\n <Icon\n className={cn(\n \"size-4 shrink-0\",\n active ? \"text-primary\" : \"text-muted-foreground group-hover:text-foreground\",\n )}\n />\n ) : null}\n <span className=\"flex-1 truncate text-left\">{children}</span>\n {count !== undefined ? (\n <span\n className={cn(\n \"ml-auto rounded-full px-1.5 py-0.5 font-mono text-label\",\n active ? \"bg-primary text-primary-foreground\" : \"bg-muted-foreground/15\",\n )}\n >\n {count}\n </span>\n ) : null}\n </>\n );\n\n if (as === \"a\") {\n return (\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n className={classes}\n aria-current={active ? \"page\" : undefined}\n {...(props as AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n {content}\n </a>\n );\n }\n\n return (\n <button\n ref={ref as Ref<HTMLButtonElement>}\n type=\"button\"\n className={classes}\n aria-pressed={active ? \"true\" : undefined}\n {...props}\n >\n {content}\n </button>\n );\n },\n);\nItem.displayName = \"Sidebar.Item\";\n\nconst Footer = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"mt-auto border-border/40 border-t px-5 py-4\", className)}\n {...props}\n />\n ),\n);\nFooter.displayName = \"Sidebar.Footer\";\n\nconst Sidebar = /*#__PURE__*/ Object.assign(Root, {\n Header,\n Section,\n Item,\n Footer,\n});\n\nexport { Sidebar };\n"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "skeleton",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "Skeleton",
|
|
6
|
+
"description": "Placeholder block shown while content is loading.",
|
|
7
|
+
"registryDependencies": [
|
|
8
|
+
"cn",
|
|
9
|
+
"tailwind-preset"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
{
|
|
13
|
+
"path": "components/primitives/skeleton/skeleton.tsx",
|
|
14
|
+
"type": "registry:ui",
|
|
15
|
+
"target": "components/ui/skeleton.tsx",
|
|
16
|
+
"content": "import { forwardRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport { useInLiveRegion } from \"@/lib/live-region-context\";\n\n/**\n * Skeleton — placeholder block shown while content is loading.\n *\n * Uses --muted as base + a subtle shimmer that respects the violet theme.\n * Compose multiple Skeletons to mirror your component layout while loading.\n *\n * Accessibility (LOW-004): the default `role=\"status\"` + `aria-live=\"polite\"`\n * announces \"Loading\" to screen readers. In loops or grids where many\n * Skeletons mount simultaneously, this can be noisy. Override per-instance\n * with `aria-live=\"off\"` and/or `aria-hidden` when only one container-level\n * loading announcement is desired:\n *\n * <div role=\"status\" aria-live=\"polite\" aria-label=\"Loading deployments\">\n * {placeholders.map(id => (\n * <Skeleton key={id} aria-live=\"off\" aria-hidden=\"true\" className=\"h-8\" />\n * ))}\n * </div>\n */\nconst Skeleton = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => {\n // T4.1 (MF-4): when nested inside a container live region (BuildLogStream,\n // ChatThread, etc.), omit role/aria-live so AT doesn't announce every\n // placeholder mount as a separate \"loading\" event.\n const inLiveRegion = useInLiveRegion();\n return (\n <div\n ref={ref}\n role={inLiveRegion ? undefined : \"status\"}\n aria-live={inLiveRegion ? undefined : \"polite\"}\n aria-label={inLiveRegion ? undefined : \"Loading\"}\n className={cn(\"animate-pulse rounded-md bg-muted\", className)}\n {...props}\n />\n );\n },\n);\nSkeleton.displayName = \"Skeleton\";\n\nexport { Skeleton };\n"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "skill-card",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "SkillCard",
|
|
6
|
+
"description": "Single skill entry showing what it does, where it came from,",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
"lucide-react"
|
|
9
|
+
],
|
|
10
|
+
"registryDependencies": [
|
|
11
|
+
"cn",
|
|
12
|
+
"mode-types",
|
|
13
|
+
"tailwind-preset",
|
|
14
|
+
"types"
|
|
15
|
+
],
|
|
16
|
+
"files": [
|
|
17
|
+
{
|
|
18
|
+
"path": "components/primitives/skill-card/skill-card.tsx",
|
|
19
|
+
"type": "registry:ui",
|
|
20
|
+
"target": "components/ui/skill-card.tsx",
|
|
21
|
+
"content": "import { BookOpen, Sparkles, User, Users } from \"lucide-react\";\nimport { forwardRef } from \"react\";\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport type { IconComponent } from \"@/lib/types\";\nimport type { Mode } from \"@/types/mode\";\n\nexport type SkillSource = \"builtin\" | \"project\" | \"user\" | \"plugin\";\nexport type SkillState = \"enabled\" | \"disabled\";\n\nconst SOURCE_CONFIG: Record<SkillSource, { label: string; icon: IconComponent; tone: string }> = {\n builtin: { label: \"Built-in\", icon: Sparkles, tone: \"text-primary\" },\n project: { label: \"Project\", icon: BookOpen, tone: \"text-accent\" },\n user: { label: \"User\", icon: User, tone: \"text-info\" },\n plugin: { label: \"Plugin\", icon: Users, tone: \"text-muted-foreground\" },\n};\n\nexport interface Skill {\n id: string;\n name: string;\n description?: ReactNode;\n /** Where the skill comes from. */\n source: SkillSource;\n /** Optional tools the skill is allowed to use (informational). */\n allowedTools?: string[];\n /** Optional trigger keywords / patterns for discovery. */\n triggers?: string[];\n state?: SkillState;\n /** Modes this skill is visible in. Omit / empty = global (all modes). */\n modes?: Mode[];\n}\n\ninterface SkillCardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onToggle\"> {\n skill: Skill;\n onToggle?: (id: string, next: SkillState) => void;\n}\n\n/**\n * SkillCard — single skill entry showing what it does, where it came from,\n * and which tools it needs. Toggle to enable/disable for the current session.\n */\nconst SkillCard = forwardRef<HTMLDivElement, SkillCardProps>(\n ({ className, skill, onToggle, ...props }, ref) => {\n const config = SOURCE_CONFIG[skill.source];\n const Icon = config.icon;\n const state = skill.state ?? \"enabled\";\n const enabled = state === \"enabled\";\n return (\n <article\n ref={ref}\n className={cn(\n \"grid gap-3 rounded-xl border bg-card p-4\",\n !enabled && \"opacity-60\",\n className,\n )}\n {...props}\n >\n <header className=\"flex items-start justify-between gap-3\">\n <div className=\"flex items-center gap-2\">\n <span className={cn(\"grid size-8 place-items-center rounded-md bg-muted\", config.tone)}>\n <Icon className=\"size-4\" aria-hidden=\"true\" />\n </span>\n <div className=\"grid\">\n <h4 className=\"font-medium font-mono text-body-sm text-foreground\">{skill.name}</h4>\n <span className=\"font-mono text-label-caps text-muted-foreground uppercase tracking-wider\">\n {config.label}\n </span>\n </div>\n </div>\n {onToggle ? (\n <button\n type=\"button\"\n onClick={() => onToggle(skill.id, enabled ? \"disabled\" : \"enabled\")}\n aria-pressed={enabled}\n className={cn(\n \"inline-flex items-center rounded-full border px-2.5 py-0.5\",\n \"font-mono text-label uppercase tracking-wider transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n enabled\n ? \"border-success/40 bg-success/15 text-success\"\n : \"border-border/40 bg-muted text-muted-foreground\",\n )}\n >\n {enabled ? \"Enabled\" : \"Disabled\"}\n </button>\n ) : null}\n </header>\n {skill.description ? (\n <p className=\"text-body-sm text-muted-foreground\">{skill.description}</p>\n ) : null}\n {skill.allowedTools && skill.allowedTools.length > 0 ? (\n <div className=\"flex flex-wrap gap-1.5\">\n <span className=\"font-mono text-label text-muted-foreground uppercase tracking-wider\">\n tools:\n </span>\n {skill.allowedTools.map((tool) => (\n <span\n key={tool}\n className=\"inline-flex items-center rounded-md bg-muted px-2 py-0.5 font-mono text-foreground text-label\"\n >\n {tool}\n </span>\n ))}\n </div>\n ) : null}\n {skill.triggers && skill.triggers.length > 0 ? (\n <div className=\"flex flex-wrap gap-1.5\">\n <span className=\"font-mono text-label text-muted-foreground uppercase tracking-wider\">\n triggers:\n </span>\n {skill.triggers.map((trigger) => (\n <span\n key={trigger}\n className=\"inline-flex items-center rounded-md bg-primary/10 px-2 py-0.5 font-mono text-label text-primary\"\n >\n {trigger}\n </span>\n ))}\n </div>\n ) : null}\n </article>\n );\n },\n);\nSkillCard.displayName = \"SkillCard\";\n\nexport { SkillCard };\n"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "skill-editor",
|
|
4
|
+
"type": "registry:block",
|
|
5
|
+
"title": "SkillEditor",
|
|
6
|
+
"description": "Form for creating or editing a Skill.",
|
|
7
|
+
"dependencies": [],
|
|
8
|
+
"registryDependencies": [
|
|
9
|
+
"button",
|
|
10
|
+
"cn",
|
|
11
|
+
"form-field",
|
|
12
|
+
"input",
|
|
13
|
+
"mode-types",
|
|
14
|
+
"select",
|
|
15
|
+
"skill-card",
|
|
16
|
+
"switch",
|
|
17
|
+
"tailwind-preset",
|
|
18
|
+
"textarea"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
{
|
|
22
|
+
"path": "components/composites/skill-editor/skill-editor.tsx",
|
|
23
|
+
"type": "registry:block",
|
|
24
|
+
"target": "components/blocks/skill-editor.tsx",
|
|
25
|
+
"content": "import { useState } from \"react\";\nimport type { FormEvent, HTMLAttributes } from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport { ALL_MODES, MODE_LABEL, type Mode } from \"@/types/mode\";\nimport { Button } from \"@/components/ui/button\";\nimport { FormField } from \"@/components/ui/form-field\";\nimport { Input } from \"@/components/ui/input\";\nimport { Select } from \"@/components/ui/select\";\nimport type { Skill, SkillSource, SkillState } from \"@/components/ui/skill-card\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { Textarea } from \"@/components/ui/textarea\";\n\n/**\n * SkillEditor — form for creating or editing a Skill.\n */\n\ntype SkillDraft = Omit<Skill, \"id\"> & {\n id?: string;\n instructions?: string;\n};\n\ninterface SkillEditorProps extends Omit<HTMLAttributes<HTMLFormElement>, \"onSubmit\" | \"onChange\"> {\n initial?: Partial<Skill> & { instructions?: string };\n onSave: (draft: SkillDraft) => void;\n onCancel?: () => void;\n onDelete?: () => void;\n}\n\nconst SOURCES: Array<{ id: SkillSource; label: string }> = [\n { id: \"user\", label: \"User — defined by you\" },\n { id: \"project\", label: \"Project — lives in this workspace\" },\n { id: \"plugin\", label: \"Plugin — imported from a package\" },\n { id: \"builtin\", label: \"Built-in — shipped with Theo\" },\n];\n\nexport function SkillEditor({\n className,\n initial,\n onSave,\n onCancel,\n onDelete,\n ...formProps\n}: SkillEditorProps) {\n const [name, setName] = useState(initial?.name ?? \"\");\n const [description, setDescription] = useState(\n typeof initial?.description === \"string\" ? initial.description : \"\",\n );\n const [instructions, setInstructions] = useState(initial?.instructions ?? \"\");\n const [source, setSource] = useState<SkillSource>(initial?.source ?? \"user\");\n const [allowedToolsRaw, setAllowedToolsRaw] = useState(initial?.allowedTools?.join(\", \") ?? \"\");\n const [triggersRaw, setTriggersRaw] = useState(initial?.triggers?.join(\", \") ?? \"\");\n const [enabled, setEnabled] = useState<SkillState>(initial?.state ?? \"enabled\");\n const [modes, setModes] = useState<Mode[]>(initial?.modes ?? []);\n\n // Note: state is only seeded once on mount. To reset the form when editing\n // a different skill, use the React `key` pattern at the call site:\n // <SkillEditor key={skill.id} initial={skill} ... />\n const toggleMode = (m: Mode) =>\n setModes((prev) => (prev.includes(m) ? prev.filter((x) => x !== m) : [...prev, m]));\n\n const canSave = name.trim().length > 0;\n const handleSubmit = (e: FormEvent) => {\n e.preventDefault();\n if (!canSave) return;\n onSave({\n id: initial?.id,\n name: name.trim(),\n description: description.trim() || undefined,\n instructions: instructions.trim() || undefined,\n source,\n state: enabled,\n allowedTools: allowedToolsRaw\n .split(\",\")\n .map((t) => t.trim())\n .filter(Boolean),\n triggers: triggersRaw\n .split(\",\")\n .map((t) => t.trim())\n .filter(Boolean),\n modes: modes.length > 0 ? modes : undefined,\n });\n };\n\n return (\n <form\n onSubmit={handleSubmit}\n className={cn(\"flex h-full flex-col gap-4\", className)}\n {...formProps}\n >\n <FormField>\n <FormField.Label>Name</FormField.Label>\n <FormField.Control>\n <Input\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder=\"diff-explainer\"\n required\n />\n </FormField.Control>\n <FormField.Hint>Kebab-case identifier the agent uses to invoke this skill.</FormField.Hint>\n </FormField>\n\n <FormField>\n <FormField.Label>Description</FormField.Label>\n <FormField.Control>\n <Input\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n placeholder=\"Explain a diff in plain English.\"\n />\n </FormField.Control>\n </FormField>\n\n <FormField className=\"flex-1\">\n <FormField.Label>Instructions</FormField.Label>\n <FormField.Control>\n <Textarea\n value={instructions}\n onChange={(e) => setInstructions(e.target.value)}\n rows={6}\n placeholder=\"When invoked, read the diff via Read or Grep and produce a concise summary of intent + risk.\"\n className=\"min-h-[10rem] flex-1 font-mono text-code-sm\"\n />\n </FormField.Control>\n <FormField.Hint>Sub-prompt loaded when the skill is invoked.</FormField.Hint>\n </FormField>\n\n <div className=\"grid grid-cols-2 gap-3\">\n <FormField>\n <FormField.Label>Source</FormField.Label>\n <FormField.Control>\n <Select\n value={source}\n onValueChange={(v) => {\n // Re-audit Issue 7: narrow Select string value against\n // SOURCES.id before casting. Silent no-op for unknown.\n const next = SOURCES.find((s) => s.id === v);\n if (next) setSource(next.id);\n }}\n >\n <Select.Trigger aria-label=\"Select skill source\">\n <Select.Value />\n </Select.Trigger>\n <Select.Content>\n {SOURCES.map((s) => (\n <Select.Item key={s.id} value={s.id}>\n {s.label}\n </Select.Item>\n ))}\n </Select.Content>\n </Select>\n </FormField.Control>\n </FormField>\n <FormField>\n <FormField.Label>Allowed tools</FormField.Label>\n <FormField.Control>\n <Input\n value={allowedToolsRaw}\n onChange={(e) => setAllowedToolsRaw(e.target.value)}\n placeholder=\"Read, Grep, Bash\"\n />\n </FormField.Control>\n </FormField>\n </div>\n\n <FormField>\n <FormField.Label>Triggers</FormField.Label>\n <FormField.Control>\n <Input\n value={triggersRaw}\n onChange={(e) => setTriggersRaw(e.target.value)}\n placeholder=\"explain diff, summarize change\"\n />\n </FormField.Control>\n <FormField.Hint>Optional keywords / patterns for auto-discovery.</FormField.Hint>\n </FormField>\n\n <FormField>\n <FormField.Label>Active modes</FormField.Label>\n <div className=\"flex flex-wrap gap-1.5\">\n {ALL_MODES.map((m) => {\n const on = modes.includes(m);\n return (\n <button\n key={m}\n type=\"button\"\n onClick={() => toggleMode(m)}\n aria-pressed={on}\n className={cn(\n \"inline-flex h-7 items-center rounded-full border px-3 font-mono text-body-sm transition-colors\",\n on\n ? \"border-primary bg-primary/15 text-primary\"\n : \"border-border/60 bg-card text-muted-foreground hover:text-foreground\",\n )}\n >\n {MODE_LABEL[m]}\n </button>\n );\n })}\n </div>\n <FormField.Hint>\n {modes.length === 0\n ? \"Empty = global (available in every mode).\"\n : `Only visible in: ${modes.map((m) => MODE_LABEL[m]).join(\", \")}.`}\n </FormField.Hint>\n </FormField>\n\n <div className=\"flex items-center gap-3\">\n <Switch\n checked={enabled === \"enabled\"}\n onCheckedChange={(v) => setEnabled(v ? \"enabled\" : \"disabled\")}\n aria-label=\"Enabled\"\n />\n <span className=\"text-body-sm text-muted-foreground\">\n {enabled === \"enabled\"\n ? \"Enabled — available to the agent.\"\n : \"Disabled — kept but hidden from the agent.\"}\n </span>\n </div>\n\n <footer className=\"flex items-center justify-between gap-2 border-border/40 border-t pt-4\">\n <div>\n {onDelete ? (\n <Button type=\"button\" variant=\"ghost\" onClick={onDelete}>\n Delete\n </Button>\n ) : null}\n </div>\n <div className=\"flex items-center gap-2\">\n {onCancel ? (\n <Button type=\"button\" variant=\"secondary\" onClick={onCancel}>\n Cancel\n </Button>\n ) : null}\n <Button type=\"submit\" disabled={!canSave}>\n {initial?.id ? \"Save changes\" : \"Create skill\"}\n </Button>\n </div>\n </footer>\n </form>\n );\n}\n"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "skills-list",
|
|
4
|
+
"type": "registry:block",
|
|
5
|
+
"title": "SkillsList",
|
|
6
|
+
"description": "Grid of SkillCards with optional search + source filter chips.",
|
|
7
|
+
"dependencies": [
|
|
8
|
+
"lucide-react"
|
|
9
|
+
],
|
|
10
|
+
"registryDependencies": [
|
|
11
|
+
"cn",
|
|
12
|
+
"skill-card",
|
|
13
|
+
"tailwind-preset"
|
|
14
|
+
],
|
|
15
|
+
"files": [
|
|
16
|
+
{
|
|
17
|
+
"path": "components/composites/skills-list/skills-list.tsx",
|
|
18
|
+
"type": "registry:block",
|
|
19
|
+
"target": "components/blocks/skills-list.tsx",
|
|
20
|
+
"content": "import { Search } from \"lucide-react\";\nimport { forwardRef, useMemo, useState } from \"react\";\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport { type Skill, SkillCard, type SkillState } from \"@/components/ui/skill-card\";\n\ninterface SkillsListProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\" | \"onToggle\"> {\n skills: Skill[];\n title?: ReactNode;\n /** If true, shows a search input above the grid. */\n searchable?: boolean;\n onToggle?: (id: string, next: SkillState) => void;\n}\n\n/**\n * SkillsList — grid of SkillCards with optional search + source filter chips.\n * Pairs with claw-code's `claw skills` inventory but visual.\n */\nconst SkillsList = forwardRef<HTMLDivElement, SkillsListProps>(\n ({ className, skills, title = \"Skills\", searchable = true, onToggle, ...props }, ref) => {\n const [q, setQ] = useState(\"\");\n const filtered = useMemo(() => {\n if (!q.trim()) return skills;\n const needle = q.toLowerCase();\n return skills.filter((s) => {\n const hay = [\n s.name,\n typeof s.description === \"string\" ? s.description : \"\",\n ...(s.triggers ?? []),\n ]\n .join(\" \")\n .toLowerCase();\n return hay.includes(needle);\n });\n }, [skills, q]);\n\n return (\n <section\n ref={ref}\n className={cn(\"grid gap-3\", className)}\n aria-label=\"Available skills\"\n {...props}\n >\n {title || searchable ? (\n <header className=\"flex flex-wrap items-center justify-between gap-3\">\n {title ? (\n <h3 className=\"font-display text-title-md tracking-tight\">{title}</h3>\n ) : (\n <span />\n )}\n {searchable ? (\n <div className=\"relative\">\n <Search\n className=\"-translate-y-1/2 absolute top-1/2 left-2 size-3.5 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <input\n type=\"search\"\n value={q}\n onChange={(e) => setQ(e.target.value)}\n placeholder=\"Filter skills…\"\n aria-label=\"Filter skills\"\n className=\"h-8 w-56 rounded-md border border-input bg-card pr-2 pl-7 font-mono text-code-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n />\n </div>\n ) : null}\n </header>\n ) : null}\n {filtered.length === 0 ? (\n <p className=\"rounded-xl border border-border/60 border-dashed bg-muted/30 px-4 py-8 text-center font-sans text-body-sm text-muted-foreground\">\n No skills match {q ? `\"${q}\"` : \"the current filter\"}.\n </p>\n ) : (\n <div className=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\n {filtered.map((skill) => (\n <SkillCard key={skill.id} skill={skill} {...(onToggle ? { onToggle } : {})} />\n ))}\n </div>\n )}\n </section>\n );\n },\n);\nSkillsList.displayName = \"SkillsList\";\n\nexport { SkillsList };\n"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "social-auth-row",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "SocialAuthRow",
|
|
6
|
+
"description": "Row of OAuth provider buttons.",
|
|
7
|
+
"dependencies": [],
|
|
8
|
+
"registryDependencies": [
|
|
9
|
+
"cn",
|
|
10
|
+
"tailwind-preset",
|
|
11
|
+
"types"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
{
|
|
15
|
+
"path": "components/primitives/social-auth-row/social-auth-row.tsx",
|
|
16
|
+
"type": "registry:ui",
|
|
17
|
+
"target": "components/ui/social-auth-row.tsx",
|
|
18
|
+
"content": "import { forwardRef } from \"react\";\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport type { IconComponent } from \"@/lib/types\";\n\nexport interface SocialProvider {\n id: string;\n label: ReactNode;\n /** Icon component (e.g. brand-specific SVG). */\n icon: IconComponent;\n}\n\ninterface SocialAuthRowProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n providers: SocialProvider[];\n onSelect?: (id: string) => void;\n /**\n * Stack vertically instead of horizontally (single-column flow).\n */\n vertical?: boolean;\n}\n\n/**\n * SocialAuthRow — row of OAuth provider buttons.\n *\n * Stateless; caller wires the redirect on `onSelect`. Buttons share Theo button\n * styling but with provider icon prominently on the left.\n */\nconst SocialAuthRow = forwardRef<HTMLDivElement, SocialAuthRowProps>(\n ({ className, providers, onSelect, vertical, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"grid gap-2\",\n vertical ? \"grid-cols-1\" : `grid-cols-${Math.min(providers.length, 4)}`,\n className,\n )}\n style={\n !vertical\n ? { gridTemplateColumns: `repeat(${providers.length}, minmax(0, 1fr))` }\n : undefined\n }\n {...props}\n >\n {providers.map((p) => {\n const Icon = p.icon;\n return (\n <button\n key={p.id}\n type=\"button\"\n onClick={() => onSelect?.(p.id)}\n className={cn(\n \"inline-flex h-10 items-center justify-center gap-2 rounded-lg border border-border bg-card\",\n \"px-4 font-medium font-sans text-body-sm text-foreground\",\n \"transition-colors duration-base ease-out-soft\",\n \"hover:bg-muted\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n )}\n >\n <Icon className=\"size-4\" aria-hidden=\"true\" />\n {p.label}\n </button>\n );\n })}\n </div>\n ),\n);\nSocialAuthRow.displayName = \"SocialAuthRow\";\n\nexport { SocialAuthRow };\n"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "steps-rail",
|
|
4
|
+
"type": "registry:ui",
|
|
5
|
+
"title": "StepsRail",
|
|
6
|
+
"description": "Vertical numbered rail with connecting line.",
|
|
7
|
+
"dependencies": [],
|
|
8
|
+
"registryDependencies": [
|
|
9
|
+
"cn",
|
|
10
|
+
"tailwind-preset"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
{
|
|
14
|
+
"path": "components/primitives/steps-rail/steps-rail.tsx",
|
|
15
|
+
"type": "registry:ui",
|
|
16
|
+
"target": "components/ui/steps-rail.tsx",
|
|
17
|
+
"content": "import { forwardRef } from \"react\";\nimport type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/lib/cn\";\n\nexport interface RailStep {\n id: string | number;\n label?: ReactNode;\n /**\n * Visual state: \"complete\", \"current\", \"pending\".\n */\n state?: \"complete\" | \"current\" | \"pending\";\n}\n\ninterface StepsRailProps extends Omit<HTMLAttributes<HTMLElement>, \"title\"> {\n steps: RailStep[];\n /**\n * Optional label rendered at the top of the rail (e.g. \"STEPS\").\n */\n title?: ReactNode;\n}\n\n/**\n * StepsRail — vertical numbered rail with connecting line.\n *\n * Mirrors the file-organisation wiremock right rail: 5 numbered dots, current\n * highlighted, line connecting them.\n */\nconst StepsRail = forwardRef<HTMLElement, StepsRailProps>(\n ({ className, steps, title, ...props }, ref) => (\n <aside\n ref={ref}\n className={cn(\n \"flex w-14 flex-col items-center gap-6 border-border/40 border-l py-6\",\n className,\n )}\n aria-label=\"Task steps\"\n {...props}\n >\n {title ? (\n <span className=\"font-mono text-label-caps text-muted-foreground uppercase tracking-wider\">\n {title}\n </span>\n ) : null}\n <ol className=\"before:-translate-x-1/2 relative grid place-items-center gap-6 before:absolute before:top-3 before:bottom-3 before:left-1/2 before:w-px before:bg-border/60\">\n {steps.map((step, idx) => {\n const state = step.state ?? (idx === 0 ? \"current\" : \"pending\");\n return (\n <li key={step.id} className=\"relative z-10\">\n <span\n className={cn(\n \"grid size-7 place-items-center rounded-full border-2 font-bold font-mono text-code-sm\",\n state === \"complete\" && \"border-primary bg-primary text-primary-foreground\",\n state === \"current\" && \"border-foreground bg-foreground text-background\",\n state === \"pending\" && \"border-border bg-card text-muted-foreground\",\n )}\n aria-current={state === \"current\" ? \"step\" : undefined}\n >\n {step.label ?? idx + 1}\n </span>\n </li>\n );\n })}\n </ol>\n </aside>\n ),\n);\nStepsRail.displayName = \"StepsRail\";\n\nexport { StepsRail };\n"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|