refactor(tasks-ui): align the page with the latest shadcn/ui defaults
The previous round kept a hand-trimmed, shadow-less, 11-13px variant of the
component set. This replaces it with the registry's own defaults and the
registry's own composition primitives, keeping only the adaptations this host
actually requires.
Registry refresh (npx shadcn@latest add --overwrite): the whole vendored set is
back to upstream sources, plus label, field, input-group, item and button-group.
Re-applied adaptations (documented in the design doc):
- cn from ./utils and explicit ./x.tsx specifiers (the registry writes virtual
aliases this repo has no resolver for);
- host IconXxx instead of lucide (skin contract);
- no dark: variants (the DSH tokens already flip) and no palette literals;
- React.forwardRef on Button (the host is React 18, so radix Slot needs it);
- tw-animate-css animation utilities stripped: installing that dependency would
inject generic keyframes into a page we do not own.
Restored to stock: the full Button variant/size set, shadow-xs on outline,
transition-all, badge ghost/link.
Recomposition on the newest primitives (per-file, verified here):
- board: full Card composition, Item rows, ToggleGroup filter, dropdown items
grouped, Empty for the empty state;
- task window: Card composition, FieldGroup/Field with data-invalid validation,
ToggleGroup owner (default variant: the outline variant's hover and pressed
states measured identically, hiding the selection), destructive-armed delete,
FieldError for conflicts;
- popovers: both portal cards use the same Card composition, rows are Item;
- drawer/header: Item rows with ItemActions, Separator bands, Spinner, Empty;
- graph/tree: stock node recipe, outline buttons, cn() for conditional classes.
Two no-preflight traps found by rendering, not by types:
- stock Empty ships border-dashed without a width, so the UA's 3px medium dashed
frame wrapped the whole page: border-0 on that Empty;
- <Spinner size={12}/> stayed type-clean after the refresh (size is a valid span
attribute) while the glyph silently rendered at size-4: className="size-3".
Verified: typecheck/lint clean; 136 files / 1515 tests; build with the core and
chunk bundle guards (core 836.3 KiB, chunk 734.7 KiB); mount e2e 7/7; and the
real-host-stylesheet mirror page re-shot for graph, tree, board, task window and
the 77-node stress fixture at 360 and 720.
This commit is contained in:
1 parent
d1a9d520ae
commit
5deb5285da
30 files changed
+2107
-1097
No files matched your search
@@ -364,17 +364,36 @@ npx -y shadcn@latest add button card badge separator input textarea tooltip popo
|
|||||||
|
|
||||||
**4. 模型去重(重复 React key 的根因)。** 可视化 harness 在压力 fixture 上抓到 `sub-live-011` 等三个重复 key:根因在 `tasks-model.ts` —— workflow member 的 `childId` 若**不在 run 发起者的 catalog 里**(但存在于树中别处),代码会走"合成节点"分支,生成一个与真实节点**同 id** 的第二张卡片。修法:先按整棵树收集 `knownAgentIds`,只对 catalog 完全不知道的 id 合成节点;并在返回前加一条"每个 session id 只出现一次"的兜底去重。新增两条单测(已知 member 不重复 / 未知 member 仍合成)。
|
**4. 模型去重(重复 React key 的根因)。** 可视化 harness 在压力 fixture 上抓到 `sub-live-011` 等三个重复 key:根因在 `tasks-model.ts` —— workflow member 的 `childId` 若**不在 run 发起者的 catalog 里**(但存在于树中别处),代码会走"合成节点"分支,生成一个与真实节点**同 id** 的第二张卡片。修法:先按整棵树收集 `knownAgentIds`,只对 catalog 完全不知道的 id 合成节点;并在返回前加一条"每个 session id 只出现一次"的兜底去重。新增两条单测(已知 member 不重复 / 未知 member 仍合成)。
|
||||||
|
|
||||||
### 升级路径(未来用 shadcn CLI `--diff` 跟进上游)
|
### 升级路径与本地适配清单(stock 优先)
|
||||||
|
|
||||||
`components.json` 已把 CLI 上下文钉在这个仓库上,`npx -y shadcn@latest info` 能正确列出 16 个已装组件(`base: radix`、`tailwindVersion: v4`、`tailwindCss: src/client/ui/theme.css`),所以**不要手动从 GitHub 抄文件**,走 CLI:
|
**政策(2026-09-20 起):与上游 stock 保持一致优先,本地改动只保留"不这样就得坏"的那几条。** 早先那版"裁剪变体、去阴影、压字号"的本地取向已被真机反馈否掉(用户要求"改为 shadcn/ui 最新的默认样式对齐"),因此 `src/client/ui/**` 用 `npx shadcn@latest add … --overwrite` 整批刷成了最新 registry(new-york v4 / radix base),并**重新施加**下面这份最小适配清单:
|
||||||
|
|
||||||
```bash
|
| # | 本地适配 | 为什么必须 |
|
||||||
npx -y shadcn@latest info # 当前上下文与已装组件清单
|
|---|---|---|
|
||||||
npx -y shadcn@latest add <component> --dry-run # 先看会动哪些文件
|
| 1 | `cn` 从 `./utils` 导入;跨组件 import 写显式 `./x.tsx` | registry 写的是虚拟别名 `cn` 与裸 `src/client/ui/...` 说明符,本项目没有那些解析规则 |
|
||||||
npx -y shadcn@latest add <component> --diff # 逐文件看上游 vs 本地差异
|
| 2 | 图标一律用宿主 `@deepseek-ai/dsh-client-ui-primitives` 的 `IconXxx` | 皮肤契约禁 lucide;宿主图标随主题变色。`spinner.tsx` 的 `Loader2Icon` → `IconLoadingOutline16`(外层 span 承接 props),`dropdown-menu.tsx` 的勾/箭头 → `IconCheckOutline16`/`IconChevronRightOutline14`,单选圆点用 `span.bg-current` |
|
||||||
npx -y shadcn@latest add <component> # 确认后再落盘
|
| 3 | 删除所有 `dark:` 变体 | 令牌本身随宿主深浅主题翻转,`dark:` 是多余且会改写宿主主题语义(技能规则也禁手写 dark 覆盖) |
|
||||||
```
|
| 4 | `text-white` → `text-destructive-foreground` | 无颜色字面量是皮肤契约的硬线 |
|
||||||
|
| 5 | `Button` 保留 `React.forwardRef` | 宿主是 **React 18**,`asChild` 触发器要 ref 才能量到锚点(registry 面向 React 19,不写 forwardRef) |
|
||||||
|
| 6 | 删除 `tw-animate-css` 的动画工具类(`animate-in`/`fade-in-*`/`zoom-in-*`/`slide-in-from-*`) | 该依赖未安装;装了它会向**我们不拥有的宿主页面**注入通用 `@keyframes` 名字,有与宿主动画撞名的风险。缺省即"立即出现",与 reduced-motion 行为一致 |
|
||||||
|
|
||||||
**实测**(`npx -y shadcn@latest add button --diff`,本次迁移后执行):上游会把 `cn` 的 import 写回裸包名 `"cn"`、带回 `dark:bg-destructive/60` 与 `dark:focus-visible:ring-destructive/40`、把 `text-destructive-foreground` 换回 `text-white`、给 `outline` 加回 `shadow-xs`、并恢复被删的 `link` 变体与 `xs` / `lg` / `icon-xs` / `icon-sm` / `icon-lg` 五个尺寸——正是本文件记录的六类统一改动。所以升级的流程是**逐文件判断**:没有本地改动的文件可被覆盖,有本地改动的(几乎全部)读 diff 后**只取上游的结构性更新,重新施加本仓库的六类改动**——尤其 `input.tsx` 的 `file:` 类一旦回来,`tests/ui-bundle.spec.ts` 的 preflight 守卫会开始误报。落盘后必须复跑三个守卫 spec(`ui-foundation` / `ui-bundle` / `ui-shadows`)与 `pnpm build`(体积测量是 `ui-bundle` 的一部分),再跑 `pnpm vitest run tests/theme.spec.ts` 确认皮肤契约未被上游带回的颜色字面量破坏。
|
**已恢复为 stock(此前被本地裁掉的)**:Button 的完整变体/尺寸集(`link`/`xs`/`lg`/`icon-xs|sm|lg`)、`outline` 的 `shadow-xs`、`transition-all`、Badge 的 `ghost`/`link` 变体。它们只是运行时字符串,未使用的工具类不会进 CSS。
|
||||||
|
|
||||||
`--overwrite` 与本仓库不兼容:它会一次性抹掉上面全部改动。真要用,先 `git stash` 出可对比的基线。
|
**升级流程**:`npx shadcn@latest add <component> --dry-run` → `--diff` 逐文件看上游改动 → 有本地改动的按上表重新施加(`--overwrite` 后必须重跑下面四条)。落盘后必跑:`pnpm typecheck`、`pnpm vitest run tests/theme.spec.ts tests/ui-shadows.spec.ts tests/ui-foundation.spec.ts tests/ui-bundle.spec.ts`、`pnpm build`(体积与产物断言),以及**镜像页视觉复核**(真实宿主样式表 + 真实组件,见上一节)。
|
||||||
|
|
||||||
|
### 页面重组:用最新 stock 组件,而不是手搓 div(2026-09-20)
|
||||||
|
|
||||||
|
按 shadcn 技能的硬规则把任务页的组成方式整体换成最新 registry 的构件(4 个并行代理按文件分区改,主线程统一验收):
|
||||||
|
|
||||||
|
- **团队任务板**:`Card` 全组合(`CardHeader`/`CardTitle` + `Separator` 分带 + `CardContent` + `CardFooter`),任务行 = `Item asChild`(`ItemMedia` StateDot / `ItemContent`/`ItemTitle`/`ItemActions`),筛选 = `ToggleGroup`(radix radiogroup + roving tabindex),行内菜单 = `DropdownMenuGroup` 包住每个 `DropdownMenuItem`,空态 = `Empty`。
|
||||||
|
- **任务窗口**:`Card` 全组合 + `FieldGroup`/`Field`/`FieldLabel`/`FieldDescription`/`FieldError`;标题空值走 `Field data-invalid` + `Input aria-invalid`(不新增 i18n key);负责人 = `ToggleGroup`(**default 变体**:实测 `outline` 变体的 hover 与 pressed 同色,选中态不可辨);删除 armed 用 `Button variant="destructive"`,冲突提示用 `FieldError(role=alert)`。
|
||||||
|
- **浮窗**:两张 portal 卡同样 `Card` 全组合(`CardTitle` 放身份、`CardDescription` 放种类、`CardAction` 放状态 Badge、`CardFooter` 放跳转),行 = `Item`(可点击行 `asChild` 真按钮)。
|
||||||
|
- **抽屉/页头**:行 = `Item`(终止按钮在 `ItemActions`),分隔全用 `Separator`,加载 = `Spinner`,目录失败横幅 = `Item variant="outline"`,空态 = `Empty`。
|
||||||
|
- **图/树**:节点卡配方 `rounded-lg border bg-card p-2.5 shadow-xs`(不再重复声明 stock `Card` 已有的墨色),控制条全部 stock `Button variant="outline" size="sm|icon"`,`z-[6]` → `z-10`;树行的条件类名改走 `cn()`。
|
||||||
|
|
||||||
|
**本轮在真实浏览器里抓到的两个"无 preflight"陷阱**(都已修,且在测试/文档里留痕):
|
||||||
|
|
||||||
|
1. **stock `Empty` 只有 `border-dashed` 没有宽度** → 没有 preflight 时露出 UA 的 `3px medium` 虚线框,整页像套了个粗虚线相框;`Empty` 上加 `border-0` 修掉(截图证实)。
|
||||||
|
2. **`<Spinner size={12} />` 类型合法但静默失效**:刷新后的 Spinner 变成 `React.ComponentProps<"span">`,`size` 是合法 HTML 属性 → typecheck 全绿而图标按默认 `size-4` 渲染。改用 `className="size-3"`。**教训:组件 API 变更中"仍然类型合法但语义丢失"的那类最危险,只有看渲染结果才能发现。**
|
||||||
|
|
||||||
|
**已知未修(记录在案)**:抽屉行在 ~420px 以下的窄宽度里会横向溢出(Radix ScrollArea 的 table 视口按 min-content 计算 + 行内 `nowrap` 的 mono 标题),修复需要重新决定 ScrollArea/行的最小宽度策略;宽面板(用户实机)不受影响。
|
||||||
+113
-77
@@ -11,17 +11,21 @@
|
|||||||
* cursor), with a copy action, a follow-latest switch, the two-click kill,
|
* cursor), with a copy action, a follow-latest switch, the two-click kill,
|
||||||
* and a terminal-style tail while the job runs.
|
* and a terminal-style tail while the job runs.
|
||||||
*
|
*
|
||||||
* Visual language: Tailwind utilities over the shadcn tokens
|
* Composition: the vendored shadcn set carries every surface. The drawer is a
|
||||||
* (src/client/ui/theme.css) with the vendored Collapsible / ScrollArea /
|
* `Collapsible` whose rows are `Item`s (`ItemGroup` → `Item` + `ItemActions`,
|
||||||
* Button for the interactive shells. Hierarchy comes from a 1px `border-border`
|
* the row whose output is open taking the `muted` variant); the popover's
|
||||||
* hairline plus the surface ladder (`bg-background` → `bg-muted` on hover) —
|
* identity block is an `Item` (media / content / actions) and its footer an
|
||||||
|
* `Item` holding the host `Switch` and the kill `Button`; hairlines are
|
||||||
|
* `Separator`s, status ink rides the stock `Badge` variants, and the loading
|
||||||
|
* line is the vendored `Spinner`. Hierarchy comes from the 1px `border-border`
|
||||||
|
* hairline plus the surface ladder (`bg-background` → `bg-muted` on hover) —
|
||||||
* the static drawer carries no shadow; the only float is the popover card,
|
* the static drawer carries no shadow; the only float is the popover card,
|
||||||
* whose surface/shadow belong to AnchoredPopover. Body copy is text-sm, meta
|
* whose surface/shadow belong to AnchoredPopover. Body copy is text-sm, meta
|
||||||
* text-xs, identifiers/durations `font-mono tabular-nums`.
|
* text-xs, identifiers/durations `font-mono tabular-nums`.
|
||||||
*
|
*
|
||||||
* Every non-shadcn control is a host primitive (Switch / StateDot), and every
|
* `className` is used for layout only (the components own their color and
|
||||||
* icon is a host `IconXxx` glyph — the badges are the vendored shadcn `Badge`
|
* type), every icon is a host `IconXxx` glyph, and every other control is a
|
||||||
* on its stock variants.
|
* host primitive (`Switch` / `StateDot`).
|
||||||
*/
|
*/
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||||
import {
|
import {
|
||||||
@@ -40,7 +44,10 @@ import { t } from './locales.ts'
|
|||||||
import { Badge } from './ui/badge.tsx'
|
import { Badge } from './ui/badge.tsx'
|
||||||
import { Button } from './ui/button.tsx'
|
import { Button } from './ui/button.tsx'
|
||||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './ui/collapsible.tsx'
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './ui/collapsible.tsx'
|
||||||
|
import { Item, ItemActions, ItemContent, ItemGroup, ItemMedia, ItemTitle } from './ui/item.tsx'
|
||||||
import { ScrollArea } from './ui/scroll-area.tsx'
|
import { ScrollArea } from './ui/scroll-area.tsx'
|
||||||
|
import { Separator } from './ui/separator.tsx'
|
||||||
|
import { Spinner } from './ui/spinner.tsx'
|
||||||
import { cn } from './ui/utils.ts'
|
import { cn } from './ui/utils.ts'
|
||||||
|
|
||||||
/** Refresh cadence of an open job-output popover while its job runs. */
|
/** Refresh cadence of an open job-output popover while its job runs. */
|
||||||
@@ -60,6 +67,15 @@ function statusVariant(job: SidebarJobView): 'default' | 'secondary' | 'destruct
|
|||||||
return 'secondary'
|
return 'secondary'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The meta chip of one job kind: the stock `outline` variant, mono figures. */
|
||||||
|
function KindBadge(props: { kind: string }): ReactNode {
|
||||||
|
return (
|
||||||
|
<Badge variant="outline" className="flex-none font-mono font-normal text-muted-foreground">
|
||||||
|
{props.kind}
|
||||||
|
</Badge>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export interface JobsDrawerProps {
|
export interface JobsDrawerProps {
|
||||||
rows: readonly TreeJob[]
|
rows: readonly TreeJob[]
|
||||||
/** Agent count of the tree (root included) — the auto-collapse signal. */
|
/** Agent count of the tree (root included) — the auto-collapse signal. */
|
||||||
@@ -129,8 +145,11 @@ export function JobsDrawer(props: JobsDrawerProps): ReactNode {
|
|||||||
onOpenChange={(next: boolean) => { setManualOpen(next) }}
|
onOpenChange={(next: boolean) => { setManualOpen(next) }}
|
||||||
role="region"
|
role="region"
|
||||||
aria-label={t('jobs')}
|
aria-label={t('jobs')}
|
||||||
className="z-[5] flex-none border-t border-border bg-background"
|
className="z-[5] flex-none bg-background"
|
||||||
>
|
>
|
||||||
|
{/* The drawer's top edge: the stock hairline (the bar itself carries the
|
||||||
|
surface, the rows own their own rhythm). */}
|
||||||
|
<Separator />
|
||||||
{/* The bar keeps the drawer's whole toggle affordance (title, running
|
{/* The bar keeps the drawer's whole toggle affordance (title, running
|
||||||
tally, count line) and Radix owns aria-expanded / aria-controls. */}
|
tally, count line) and Radix owns aria-expanded / aria-controls. */}
|
||||||
<CollapsibleTrigger
|
<CollapsibleTrigger
|
||||||
@@ -155,13 +174,14 @@ export function JobsDrawer(props: JobsDrawerProps): ReactNode {
|
|||||||
<div className="px-3 pb-2 font-mono text-xs text-foreground-3">{t('jobsAutoCollapsed')}</div>
|
<div className="px-3 pb-2 font-mono text-xs text-foreground-3">{t('jobsAutoCollapsed')}</div>
|
||||||
)}
|
)}
|
||||||
<CollapsibleContent>
|
<CollapsibleContent>
|
||||||
{/* Bounded log surface: one row per job, hairline-separated by the
|
<Separator />
|
||||||
|
{/* Bounded log surface: one `Item` row per job, separated by the
|
||||||
rows' own 4px rhythm rather than per-row borders. The height is
|
rows' own 4px rhythm rather than per-row borders. The height is
|
||||||
definite (not `max-h`) because ScrollArea's viewport is `size-full`:
|
definite (not `max-h`) because ScrollArea's viewport is `size-full`:
|
||||||
a bare max-height leaves the viewport content-sized, so the rows
|
a bare max-height leaves the viewport content-sized, so the rows
|
||||||
would spill out of the drawer instead of scrolling. */}
|
would spill out of the drawer instead of scrolling. */}
|
||||||
<ScrollArea className="h-[156px] w-full min-w-0 border-t border-dashed border-border">
|
<ScrollArea className="h-[156px] w-full min-w-0">
|
||||||
<div className="flex min-w-0 flex-col gap-0.5 px-2 pt-1 pb-2">
|
<ItemGroup className="min-w-0 gap-0.5 px-2 pt-1 pb-2">
|
||||||
{rows.map((row) => {
|
{rows.map((row) => {
|
||||||
const { job } = row
|
const { job } = row
|
||||||
const live = isJobLive(job)
|
const live = isJobLive(job)
|
||||||
@@ -181,23 +201,25 @@ export function JobsDrawer(props: JobsDrawerProps): ReactNode {
|
|||||||
].join(' · ')
|
].join(' · ')
|
||||||
const secondary = [context, duration].filter(Boolean).join(' · ')
|
const secondary = [context, duration].filter(Boolean).join(' · ')
|
||||||
return (
|
return (
|
||||||
<div
|
<Item
|
||||||
key={job.id}
|
key={job.id}
|
||||||
|
size="sm"
|
||||||
|
// The row whose output is open wears the muted surface (the
|
||||||
|
// stock Item variant) instead of a one-off background class.
|
||||||
|
variant={openJobId === job.id ? 'muted' : 'default'}
|
||||||
|
data-settled={live ? 'false' : 'true'}
|
||||||
|
data-open={openJobId === job.id ? 'true' : 'false'}
|
||||||
className={cn(
|
className={cn(
|
||||||
'group flex items-center gap-[7px] rounded-md px-1.5 py-1 transition-colors',
|
'min-w-0 flex-nowrap gap-2 rounded-md px-1.5 py-1 transition-colors hover:bg-muted',
|
||||||
'hover:bg-muted',
|
|
||||||
openJobId === job.id && 'bg-muted',
|
|
||||||
// A settled job recedes by ink (the label line drops to the
|
// A settled job recedes by ink (the label line drops to the
|
||||||
// secondary level), not by opacity.
|
// secondary level), not by opacity.
|
||||||
!live && 'text-muted-foreground',
|
!live && 'text-muted-foreground',
|
||||||
)}
|
)}
|
||||||
data-settled={live ? 'false' : 'true'}
|
|
||||||
data-open={openJobId === job.id ? 'true' : 'false'}
|
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
className="h-auto min-w-0 flex-1 justify-start gap-[7px] px-0 py-0 text-left text-sm font-normal tracking-normal normal-case"
|
className="h-auto min-w-0 flex-1 justify-start gap-2 px-0 py-0 text-left"
|
||||||
aria-label={`${job.label} ${jobStatusLabel(job.status, t)} ${secondary}`}
|
aria-label={`${job.label} ${jobStatusLabel(job.status, t)} ${secondary}`}
|
||||||
title={t('jobViewOutput')}
|
title={t('jobViewOutput')}
|
||||||
onClick={(event) => { onOpenOutput(row, event.currentTarget) }}
|
onClick={(event) => { onOpenOutput(row, event.currentTarget) }}
|
||||||
@@ -207,9 +229,7 @@ export function JobsDrawer(props: JobsDrawerProps): ReactNode {
|
|||||||
running state draws an svg, the others a span), so the
|
running state draws an svg, the others a span), so the
|
||||||
indicator keeps its 6px. */}
|
indicator keeps its 6px. */}
|
||||||
<StateDot state={jobDotState(job.status)} size={6} className="size-1.5" />
|
<StateDot state={jobDotState(job.status)} size={6} className="size-1.5" />
|
||||||
<Badge variant="outline" className="flex-none font-mono font-normal text-muted-foreground">
|
<KindBadge kind={job.kind} />
|
||||||
{job.kind}
|
|
||||||
</Badge>
|
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
'min-w-0 flex-1 truncate font-mono text-sm',
|
'min-w-0 flex-1 truncate font-mono text-sm',
|
||||||
@@ -232,36 +252,36 @@ export function JobsDrawer(props: JobsDrawerProps): ReactNode {
|
|||||||
</span>
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
{job.status === 'running' && (
|
{job.status === 'running' && (
|
||||||
<Button
|
<ItemActions className="gap-1">
|
||||||
variant="outline"
|
<Button
|
||||||
size="sm"
|
// The armed confirm is the stock `destructive` variant;
|
||||||
// Inline row action: quiet until the row is hovered, but
|
// unarmed stays a quiet outline chip.
|
||||||
// keyboard focus brings it back (focus-visible below).
|
variant={armed ? 'destructive' : 'outline'}
|
||||||
className={cn(
|
size="xs"
|
||||||
'h-auto shrink-0 font-mono text-xs font-normal text-muted-foreground',
|
// Inline row action: quiet until the row is hovered, but
|
||||||
'opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100',
|
// keyboard focus brings it back (focus-visible below).
|
||||||
armed && 'border-destructive text-destructive',
|
className="opacity-0 transition-opacity group-hover/item:opacity-100 focus-visible:opacity-100"
|
||||||
)}
|
data-armed={armed ? 'true' : 'false'}
|
||||||
data-armed={armed ? 'true' : 'false'}
|
aria-label={armed ? t('jobKillConfirm') : t('jobKill')}
|
||||||
aria-label={armed ? t('jobKillConfirm') : t('jobKill')}
|
title={armed ? t('jobKillConfirm') : t('jobKill')}
|
||||||
title={armed ? t('jobKillConfirm') : t('jobKill')}
|
disabled={killing}
|
||||||
disabled={killing}
|
onClick={() => {
|
||||||
onClick={() => {
|
if (armed) void kill(row)
|
||||||
if (armed) void kill(row)
|
else setArmedId(job.id)
|
||||||
else setArmedId(job.id)
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<IconStopFill16 />
|
||||||
<IconStopFill16 size={11} className="size-[11px]" />
|
{armed ? t('jobKillConfirm') : undefined}
|
||||||
{armed ? t('jobKillConfirm') : undefined}
|
</Button>
|
||||||
</Button>
|
</ItemActions>
|
||||||
)}
|
)}
|
||||||
{killFailed && (
|
{killFailed && (
|
||||||
<span className="shrink-0 font-mono text-xs text-destructive">{t('jobKillError')}</span>
|
<span className="shrink-0 font-mono text-xs text-destructive">{t('jobKillError')}</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Item>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</ItemGroup>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</CollapsibleContent>
|
</CollapsibleContent>
|
||||||
</Collapsible>
|
</Collapsible>
|
||||||
@@ -277,9 +297,9 @@ export function JobsDrawer(props: JobsDrawerProps): ReactNode {
|
|||||||
*
|
*
|
||||||
* The card fills the AnchoredPopover surface (rounded-lg + border + shadow
|
* The card fills the AnchoredPopover surface (rounded-lg + border + shadow
|
||||||
* live there, since that host owns the float) and only places its content
|
* live there, since that host owns the float) and only places its content
|
||||||
* inside it: header, title line, meta line, the terminal tail, and the action
|
* inside it: header, the `Item` identity block, the terminal tail, and the
|
||||||
* footer. `data-popover-handle` / `data-popover-no-drag` keep the drag
|
* `Item` action footer. `data-popover-handle` / `data-popover-no-drag` keep
|
||||||
* contract unchanged — the body drags, the controls do not.
|
* the drag contract unchanged — the body drags, the controls do not.
|
||||||
*/
|
*/
|
||||||
export function JobOutputPopoverContent(props: {
|
export function JobOutputPopoverContent(props: {
|
||||||
ownerSessionId: string
|
ownerSessionId: string
|
||||||
@@ -361,13 +381,13 @@ export function JobOutputPopoverContent(props: {
|
|||||||
// `dsw-tasks`: this card renders inside AnchoredPopover's portal at
|
// `dsw-tasks`: this card renders inside AnchoredPopover's portal at
|
||||||
// document.body — OUTSIDE the page root — so it re-declares the page root
|
// document.body — OUTSIDE the page root — so it re-declares the page root
|
||||||
// class for the scoped base reset (see TaskWindow.tsx).
|
// class for the scoped base reset (see TaskWindow.tsx).
|
||||||
<div className="dsw-tasks box-border flex flex-col gap-1 p-2.5 text-sm text-popover-foreground" data-popover-handle>
|
<div className="dsw-tasks box-border flex flex-col gap-2 p-2.5 text-sm text-popover-foreground" data-popover-handle>
|
||||||
<div className="mb-1 flex items-baseline justify-between gap-2 font-mono text-xs tracking-[0.14em] text-foreground-3 uppercase">
|
<div className="flex items-center justify-between gap-2">
|
||||||
<span>{t('jobs')}</span>
|
<span className="font-mono text-xs tracking-[0.14em] text-foreground-3 uppercase">{t('jobs')}</span>
|
||||||
<span className="inline-flex items-center gap-0.5 tracking-normal normal-case" data-popover-no-drag>
|
<span className="inline-flex items-center" data-popover-no-drag>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon-xs"
|
||||||
aria-label={copied ? t('jobCopied') : t('jobCopyOutput')}
|
aria-label={copied ? t('jobCopied') : t('jobCopyOutput')}
|
||||||
title={copied ? t('jobCopied') : t('jobCopyOutput')}
|
title={copied ? t('jobCopied') : t('jobCopyOutput')}
|
||||||
disabled={text === ''}
|
disabled={text === ''}
|
||||||
@@ -378,27 +398,41 @@ export function JobOutputPopoverContent(props: {
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconCopyOutline16 size={12} className="size-3" />
|
<IconCopyOutline16 />
|
||||||
</Button>
|
</Button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex min-w-0 items-center gap-1.5">
|
{/* The job's identity: the stock `Item` composition (media / content /
|
||||||
<StateDot state={jobDotState(job.status)} size={6} />
|
actions) rather than a hand-rolled row. */}
|
||||||
<span className="min-w-0 flex-1 truncate text-sm font-semibold text-foreground" title={job.label}>
|
<Item size="sm" variant="muted" className="min-w-0 flex-nowrap gap-2 rounded-md px-2 py-1.5">
|
||||||
{job.label}
|
<ItemMedia>
|
||||||
</span>
|
<StateDot state={jobDotState(job.status)} size={8} />
|
||||||
<Badge variant={statusVariant(job)} className="flex-none">
|
</ItemMedia>
|
||||||
{jobStatusLabel(job.status, t)}
|
<ItemContent className="min-w-0 gap-0.5">
|
||||||
</Badge>
|
<ItemTitle className="w-full min-w-0">
|
||||||
</div>
|
<span className="min-w-0 flex-1 truncate" title={job.label}>{job.label}</span>
|
||||||
<div className="flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground">
|
</ItemTitle>
|
||||||
<Badge variant="outline" className="flex-none font-mono font-normal text-muted-foreground">
|
<span className="flex min-w-0 items-center gap-1.5 font-mono text-xs text-muted-foreground">
|
||||||
{job.kind}
|
<KindBadge kind={job.kind} />
|
||||||
</Badge>
|
{job.detail !== undefined && job.detail !== '' && (
|
||||||
{job.detail !== undefined && job.detail !== '' && <span>{job.detail}</span>}
|
<span className="min-w-0 truncate">{job.detail}</span>
|
||||||
<span className="font-mono text-xs text-foreground-3">{t('jobDragHint')}</span>
|
)}
|
||||||
</div>
|
<span className="flex-none text-foreground-3">{t('jobDragHint')}</span>
|
||||||
{state === 'loading' && <div className="text-xs text-foreground-3">{t('loading')}</div>}
|
</span>
|
||||||
|
</ItemContent>
|
||||||
|
<ItemActions>
|
||||||
|
<Badge variant={statusVariant(job)}>{jobStatusLabel(job.status, t)}</Badge>
|
||||||
|
</ItemActions>
|
||||||
|
</Item>
|
||||||
|
{state === 'loading' && (
|
||||||
|
<div className="flex items-center gap-1.5 text-xs text-foreground-3">
|
||||||
|
{/* The visible line carries the copy; the glyph is decoration. */}
|
||||||
|
<span className="flex flex-none items-center" aria-hidden="true">
|
||||||
|
<Spinner className="size-3" />
|
||||||
|
</span>
|
||||||
|
{t('loading')}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{state === 'error' && <div className="text-xs text-destructive">{t('jobOutputError')}</div>}
|
{state === 'error' && <div className="text-xs text-destructive">{t('jobOutputError')}</div>}
|
||||||
{typeof state === 'object' && (
|
{typeof state === 'object' && (
|
||||||
<>
|
<>
|
||||||
@@ -406,7 +440,7 @@ export function JobOutputPopoverContent(props: {
|
|||||||
? (
|
? (
|
||||||
<pre
|
<pre
|
||||||
ref={preRef}
|
ref={preRef}
|
||||||
className="mt-1.5 max-h-[168px] overflow-auto rounded-md border border-border bg-background p-2 font-mono text-xs leading-[1.55] break-words whitespace-pre-wrap text-muted-foreground"
|
className="max-h-[168px] overflow-auto rounded-md border border-border bg-background p-2 font-mono text-xs leading-[1.55] break-words whitespace-pre-wrap text-muted-foreground"
|
||||||
data-popover-no-drag
|
data-popover-no-drag
|
||||||
>
|
>
|
||||||
{state.text}
|
{state.text}
|
||||||
@@ -418,8 +452,11 @@ export function JobOutputPopoverContent(props: {
|
|||||||
{state.truncated && <div className="text-xs text-foreground-3">{t('jobOutputTruncated')}</div>}
|
{state.truncated && <div className="text-xs text-foreground-3">{t('jobOutputTruncated')}</div>}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<div
|
<Separator />
|
||||||
className="mt-2 flex items-center justify-between gap-2 border-t border-border pt-2"
|
{/* The action footer: the follow-latest switch and the kill confirm. */}
|
||||||
|
<Item
|
||||||
|
size="sm"
|
||||||
|
className="min-w-0 flex-nowrap justify-between gap-2 rounded-md px-0 py-0"
|
||||||
data-popover-no-drag
|
data-popover-no-drag
|
||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
@@ -432,18 +469,17 @@ export function JobOutputPopoverContent(props: {
|
|||||||
<Button
|
<Button
|
||||||
variant={armed ? 'destructive' : 'outline'}
|
variant={armed ? 'destructive' : 'outline'}
|
||||||
size="sm"
|
size="sm"
|
||||||
className="font-mono text-xs"
|
|
||||||
disabled={killing}
|
disabled={killing}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (armed) void kill()
|
if (armed) void kill()
|
||||||
else setArmed(true)
|
else setArmed(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconStopFill16 size={11} className="size-[11px]" />
|
<IconStopFill16 />
|
||||||
{armed ? t('jobKillConfirm') : t('jobKill')}
|
{armed ? t('jobKillConfirm') : t('jobKill')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Item>
|
||||||
{killFailed && <div className="text-xs text-destructive">{t('jobKillError')}</div>}
|
{killFailed && <div className="text-xs text-destructive">{t('jobKillError')}</div>}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
+50
-24
@@ -21,11 +21,17 @@
|
|||||||
* ⓘ button opens the detail popover. Completed leaf agents fold into one
|
* ⓘ button opens the detail popover. Completed leaf agents fold into one
|
||||||
* aggregate node per parent (click it or the control-cluster toggle to
|
* aggregate node per parent (click it or the control-cluster toggle to
|
||||||
* expand/collapse).
|
* expand/collapse).
|
||||||
|
*
|
||||||
|
* The shell itself is the vendored shadcn set: the header is a toolbar closed
|
||||||
|
* by a `Separator`, the catalog-failure banner is an `Item` (media / content /
|
||||||
|
* actions), the empty state is the stock `Empty` composition, and the page's
|
||||||
|
* only controls are the vendored `Button` + `Tooltip` — `className` carries
|
||||||
|
* layout only, and every glyph is a host `IconXxx` primitive.
|
||||||
*/
|
*/
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||||
import { useSyncExternalStore } from 'react'
|
import { useSyncExternalStore } from 'react'
|
||||||
import {
|
import {
|
||||||
IconAgentPresetOutline16, IconRefreshOutline14,
|
IconAgentPresetOutline16, IconRefreshOutline14, IconWarningOutline16,
|
||||||
} from '@deepseek-ai/dsh-client-ui-primitives'
|
} from '@deepseek-ai/dsh-client-ui-primitives'
|
||||||
import type {
|
import type {
|
||||||
Context,
|
Context,
|
||||||
@@ -54,6 +60,8 @@ import type { SidebarStore } from './state.ts'
|
|||||||
import type { WorkflowRunView } from '../workflow-runs.ts'
|
import type { WorkflowRunView } from '../workflow-runs.ts'
|
||||||
import { Button as UiButton } from './ui/button.tsx'
|
import { Button as UiButton } from './ui/button.tsx'
|
||||||
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from './ui/empty.tsx'
|
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from './ui/empty.tsx'
|
||||||
|
import { Item, ItemActions, ItemContent, ItemMedia, ItemTitle } from './ui/item.tsx'
|
||||||
|
import { Separator } from './ui/separator.tsx'
|
||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './ui/tooltip.tsx'
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './ui/tooltip.tsx'
|
||||||
import legacy from './SubagentView.module.css'
|
import legacy from './SubagentView.module.css'
|
||||||
|
|
||||||
@@ -416,11 +424,11 @@ export function SubagentView(props: {
|
|||||||
return (
|
return (
|
||||||
<div className={`dsw-tasks ${legacy.subagent} relative`}>
|
<div className={`dsw-tasks ${legacy.subagent} relative`}>
|
||||||
{/*
|
{/*
|
||||||
Page header: title + mono descendant count + refresh, closed by a 1px
|
Page header: title + mono descendant count + refresh, closed by the
|
||||||
hairline. The control cluster (view toggle / fold / zoom) stays on the
|
stock hairline `Separator`. The control cluster (view toggle / fold /
|
||||||
canvas itself, so it is visible in BOTH modes.
|
zoom) stays on the canvas itself, so it is visible in BOTH modes.
|
||||||
*/}
|
*/}
|
||||||
<div className="flex flex-none items-center gap-2 border-b border-border px-3 py-2">
|
<div className="flex flex-none items-center gap-2 px-3 py-2">
|
||||||
<span className="min-w-0 flex-1 truncate text-sm font-medium">
|
<span className="min-w-0 flex-1 truncate text-sm font-medium">
|
||||||
{t('subagent')}
|
{t('subagent')}
|
||||||
{rootSummary?.displayTitle !== undefined && rootSummary.displayTitle !== ''
|
{rootSummary?.displayTitle !== undefined && rootSummary.displayTitle !== ''
|
||||||
@@ -448,13 +456,14 @@ export function SubagentView(props: {
|
|||||||
team.refresh()
|
team.refresh()
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconRefreshOutline14 size={13} />
|
<IconRefreshOutline14 />
|
||||||
</UiButton>
|
</UiButton>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="bottom" className="text-xs">{t('refresh')}</TooltipContent>
|
<TooltipContent side="bottom" className="text-xs">{t('refresh')}</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
</div>
|
</div>
|
||||||
|
<Separator />
|
||||||
{rootId !== undefined && teamView?.available === true && teamView.team !== null && (
|
{rootId !== undefined && teamView?.available === true && teamView.team !== null && (
|
||||||
<TeamBoard
|
<TeamBoard
|
||||||
rootId={rootId}
|
rootId={rootId}
|
||||||
@@ -466,27 +475,44 @@ export function SubagentView(props: {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{failedParents.length > 0 && (
|
{failedParents.length > 0 && (
|
||||||
<div className="flex flex-none items-center justify-between gap-2 px-3 py-2 text-xs text-destructive">
|
<Item
|
||||||
<span>{t('catalogLoadFailed', { count: failedParents.length })}</span>
|
variant="outline"
|
||||||
<UiButton
|
size="sm"
|
||||||
variant="ghost"
|
className="mx-3 my-2 min-w-0 flex-nowrap gap-2 rounded-md px-2 py-1.5"
|
||||||
size="sm"
|
>
|
||||||
className="flex-none"
|
<ItemMedia variant="icon" className="text-destructive">
|
||||||
onClick={() => { for (const parent of failedParents) refresh(parent) }}
|
<IconWarningOutline16 />
|
||||||
>
|
</ItemMedia>
|
||||||
<IconRefreshOutline14 size={12} />
|
<ItemContent className="min-w-0 gap-0">
|
||||||
{t('retry')}
|
<ItemTitle className="text-destructive">
|
||||||
</UiButton>
|
{t('catalogLoadFailed', { count: failedParents.length })}
|
||||||
</div>
|
</ItemTitle>
|
||||||
|
</ItemContent>
|
||||||
|
<ItemActions>
|
||||||
|
<UiButton
|
||||||
|
variant="outline"
|
||||||
|
size="xs"
|
||||||
|
className="flex-none"
|
||||||
|
onClick={() => { for (const parent of failedParents) refresh(parent) }}
|
||||||
|
>
|
||||||
|
<IconRefreshOutline14 />
|
||||||
|
{t('retry')}
|
||||||
|
</UiButton>
|
||||||
|
</ItemActions>
|
||||||
|
</Item>
|
||||||
)}
|
)}
|
||||||
{readyEmpty && (
|
{readyEmpty && (
|
||||||
<Empty className="flex-1 gap-4 border-0 p-4">
|
// `border-0` is the no-preflight fix, not a style override: the stock
|
||||||
<EmptyHeader className="gap-2">
|
// `Empty` declares only `border-dashed`, and with preflight never
|
||||||
<EmptyMedia variant="icon" className="size-8 rounded-md">
|
// shipped (see ui/theme.css) a bare `border-style: dashed` keeps the
|
||||||
<IconAgentPresetOutline16 size={16} />
|
// UA's 3px medium width — a thick dashed frame around the page.
|
||||||
|
<Empty className="flex-1 border-0">
|
||||||
|
<EmptyHeader>
|
||||||
|
<EmptyMedia variant="icon">
|
||||||
|
<IconAgentPresetOutline16 />
|
||||||
</EmptyMedia>
|
</EmptyMedia>
|
||||||
<EmptyTitle className="text-sm font-medium">{t('subagentEmpty')}</EmptyTitle>
|
<EmptyTitle>{t('subagentEmpty')}</EmptyTitle>
|
||||||
<EmptyDescription className="text-xs">{t('subagentEmptyDesc')}</EmptyDescription>
|
<EmptyDescription>{t('subagentEmptyDesc')}</EmptyDescription>
|
||||||
</EmptyHeader>
|
</EmptyHeader>
|
||||||
</Empty>
|
</Empty>
|
||||||
)}
|
)}
|
||||||
|
|||||||
+130
-83
@@ -10,13 +10,20 @@
|
|||||||
* Actions: owner reassignment (CAS-immediate), edit/save, reopen or complete,
|
* Actions: owner reassignment (CAS-immediate), edit/save, reopen or complete,
|
||||||
* and a two-step delete.
|
* and a two-step delete.
|
||||||
*
|
*
|
||||||
* Visual base: the vendored shadcn/ui set — `Card` shell, `Badge` status,
|
* Visual base: the vendored shadcn/ui set, composed the way the registry
|
||||||
* `Input` / `Textarea` fields, a `ToggleGroup` owner picker and `Button`
|
* intends — the full `Card` (header + title + action slot + content + footer),
|
||||||
* actions — over the token bridge in src/client/ui/theme.css, plus the shared
|
* the task itself as an `Item` slab, the editable half as a `FieldGroup` of
|
||||||
* `MarkdownText` renderer with the plugin's copy labels. The shell paints no
|
* `Field` rows (`FieldLabel` + control + `FieldDescription`), the owner picker
|
||||||
* surface of its own: the window is portaled to `document.body`, where
|
* as a `ToggleGroup`, status as a stock `Badge` variant and every action a
|
||||||
* `AnchoredPopover` owns the floating border/radius/shadow, so this card is
|
* stock `Button` variant (the armed delete takes the `destructive` variant
|
||||||
* layout and content only (the page's "static panels cast no shadow" rule).
|
* instead of a hand-painted red outline). Colours and type therefore come from
|
||||||
|
* the components and the semantic tokens; `className` stays layout.
|
||||||
|
*
|
||||||
|
* Three resets ride the card root on purpose: the window paints NO surface of
|
||||||
|
* its own. It is portaled to `document.body`, where `AnchoredPopover` owns the
|
||||||
|
* floating border/radius/shadow, so `border-0 bg-transparent shadow-none` let
|
||||||
|
* that shell's surface show through instead of nesting a second, shadowed card
|
||||||
|
* inside it (the page's "static panels cast no shadow" rule).
|
||||||
*
|
*
|
||||||
* That portal also sits OUTSIDE the task page root, so the card re-declares
|
* That portal also sits OUTSIDE the task page root, so the card re-declares
|
||||||
* the page root class (`dsw-tasks`) to pick up the scoped base reset the
|
* the page root class (`dsw-tasks`) to pick up the scoped base reset the
|
||||||
@@ -24,7 +31,7 @@
|
|||||||
* inheritance; without preflight a bare `<button>`/`<textarea>` would render
|
* inheritance; without preflight a bare `<button>`/`<textarea>` would render
|
||||||
* in the UA's own font.
|
* in the UA's own font.
|
||||||
*/
|
*/
|
||||||
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
import { useEffect, useId, useRef, useState, type ReactNode } from 'react'
|
||||||
import {
|
import {
|
||||||
IconCheckOutline14, IconCloseOutline16, IconEditOutline16, IconPlusOutline16,
|
IconCheckOutline14, IconCloseOutline16, IconEditOutline16, IconPlusOutline16,
|
||||||
IconRefreshOutline14, IconTrashOutline16, MarkdownText, StateDot,
|
IconRefreshOutline14, IconTrashOutline16, MarkdownText, StateDot,
|
||||||
@@ -36,12 +43,14 @@ import { AnchoredPopover } from './AnchoredPopover.tsx'
|
|||||||
import { t, type CopyKey } from './locales.ts'
|
import { t, type CopyKey } from './locales.ts'
|
||||||
import { Badge } from './ui/badge.tsx'
|
import { Badge } from './ui/badge.tsx'
|
||||||
import { Button } from './ui/button.tsx'
|
import { Button } from './ui/button.tsx'
|
||||||
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from './ui/card.tsx'
|
import { Card, CardAction, CardContent, CardFooter, CardHeader, CardTitle } from './ui/card.tsx'
|
||||||
|
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldTitle } from './ui/field.tsx'
|
||||||
import { Input } from './ui/input.tsx'
|
import { Input } from './ui/input.tsx'
|
||||||
|
import { Item, ItemActions, ItemContent, ItemMedia, ItemTitle } from './ui/item.tsx'
|
||||||
import { Separator } from './ui/separator.tsx'
|
import { Separator } from './ui/separator.tsx'
|
||||||
import { cn } from './ui/utils.ts'
|
|
||||||
import { Textarea } from './ui/textarea.tsx'
|
import { Textarea } from './ui/textarea.tsx'
|
||||||
import { ToggleGroup, ToggleGroupItem } from './ui/toggle-group.tsx'
|
import { ToggleGroup, ToggleGroupItem } from './ui/toggle-group.tsx'
|
||||||
|
import { cn } from './ui/utils.ts'
|
||||||
|
|
||||||
/** One mutation outcome (the host route's own union). */
|
/** One mutation outcome (the host route's own union). */
|
||||||
type MutationResult = { ok: true } | { ok: false; error: { code: string; message: string } }
|
type MutationResult = { ok: true } | { ok: false; error: { code: string; message: string } }
|
||||||
@@ -59,12 +68,13 @@ function taskStatusKey(status: SidebarTeamTaskView['status']): CopyKey {
|
|||||||
/**
|
/**
|
||||||
* The status badge's stock variant: in progress takes `default` (the accent),
|
* The status badge's stock variant: in progress takes `default` (the accent),
|
||||||
* everything else settles on `secondary`; a BLOCKED task wears `outline` with
|
* everything else settles on `secondary`; a BLOCKED task wears `outline` with
|
||||||
* warning ink — hue carries meaning only.
|
* warning ink — hue carries meaning only, and readiness outranks the status
|
||||||
|
* word (the board row maps it the same way).
|
||||||
*/
|
*/
|
||||||
function statusVariant(task: SidebarTeamTaskView): 'default' | 'secondary' | 'outline' {
|
function statusVariant(task: SidebarTeamTaskView): 'default' | 'secondary' | 'outline' {
|
||||||
if (task.status === 'in_progress') return 'default'
|
if (task.status === 'in_progress' && task.ready) return 'default'
|
||||||
if (task.ready) return 'secondary'
|
if (!task.ready) return 'outline'
|
||||||
return 'outline'
|
return 'secondary'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The blocked badge's warning ink (the `outline` variant is otherwise neutral). */
|
/** The blocked badge's warning ink (the `outline` variant is otherwise neutral). */
|
||||||
@@ -88,7 +98,7 @@ export function MultilineField(props: {
|
|||||||
}): ReactNode {
|
}): ReactNode {
|
||||||
return (
|
return (
|
||||||
<Textarea
|
<Textarea
|
||||||
className="max-h-[45vh] min-h-[120px] resize-y leading-relaxed"
|
className="max-h-[45vh] min-h-[120px] resize-y"
|
||||||
value={props.value}
|
value={props.value}
|
||||||
rows={props.rows ?? 7}
|
rows={props.rows ?? 7}
|
||||||
placeholder={props.placeholder}
|
placeholder={props.placeholder}
|
||||||
@@ -107,15 +117,13 @@ export function MultilineField(props: {
|
|||||||
const UNOWNED = '__unowned__'
|
const UNOWNED = '__unowned__'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The owner chips' ink: an unselected owner is meta ink, the picked one is
|
* The owner picker (single-select toggles; CAS-immediate, so never a draft
|
||||||
* full ink, and the vendored toggle adds its accent tint on top — the tint
|
* field). The chips are the toggle's DEFAULT variant, the same one the board's
|
||||||
* alone would read exactly like hover. (Weight cannot carry the selection
|
* owner filter uses: its own state pair separates hover (accent tint, meta ink)
|
||||||
* here: the page's scoped base reset gives every form control `font: inherit`,
|
* from pressed (accent tint, full ink) without help. That is not true of the
|
||||||
* which outranks a font-weight utility.)
|
* `outline` variant — its hover rules outrank the base ones, so hover and
|
||||||
|
* pressed would look exactly alike and the picked owner would be invisible.
|
||||||
*/
|
*/
|
||||||
const OWNER_CHIP = 'text-muted-foreground data-[state=on]:text-foreground'
|
|
||||||
|
|
||||||
/** The owner picker (single-select toggles; CAS-immediate, so never a draft field). */
|
|
||||||
export function OwnerPicker(props: {
|
export function OwnerPicker(props: {
|
||||||
members: readonly SidebarTeamMemberView[]
|
members: readonly SidebarTeamMemberView[]
|
||||||
owner: string | undefined
|
owner: string | undefined
|
||||||
@@ -138,11 +146,11 @@ export function OwnerPicker(props: {
|
|||||||
props.onPick(next === UNOWNED ? '' : next)
|
props.onPick(next === UNOWNED ? '' : next)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ToggleGroupItem value={UNOWNED} variant="outline" size="sm" className={OWNER_CHIP}>
|
<ToggleGroupItem value={UNOWNED} size="sm">
|
||||||
{t('teamTaskUnowned')}
|
{t('teamTaskUnowned')}
|
||||||
</ToggleGroupItem>
|
</ToggleGroupItem>
|
||||||
{props.members.map(member => (
|
{props.members.map(member => (
|
||||||
<ToggleGroupItem key={member.id} value={member.name} variant="outline" size="sm" className={OWNER_CHIP}>
|
<ToggleGroupItem key={member.id} value={member.name} size="sm">
|
||||||
{member.name}
|
{member.name}
|
||||||
</ToggleGroupItem>
|
</ToggleGroupItem>
|
||||||
))}
|
))}
|
||||||
@@ -150,7 +158,7 @@ export function OwnerPicker(props: {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The read-only body: markdown description, meta, owner picker. */
|
/** The read-only body: the task slab, the markdown description, the owner picker. */
|
||||||
function TaskViewBody(props: {
|
function TaskViewBody(props: {
|
||||||
task: SidebarTeamTaskView
|
task: SidebarTeamTaskView
|
||||||
teammates: readonly SidebarTeamMemberView[]
|
teammates: readonly SidebarTeamMemberView[]
|
||||||
@@ -160,81 +168,113 @@ function TaskViewBody(props: {
|
|||||||
const { task } = props
|
const { task } = props
|
||||||
const body = task.description.trim()
|
const body = task.description.trim()
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 flex-col gap-2.5">
|
<FieldGroup className="gap-4">
|
||||||
<div className="flex min-w-0 items-center gap-1.5">
|
{/* The task's own slab: an `Item` is the registry's row primitive, so the
|
||||||
<StateDot
|
subject leads, the owner / blocker meta follows as its description and
|
||||||
size={6}
|
the status rides the trailing action slot. */}
|
||||||
state={task.status === 'completed' ? 'done' : task.ready ? 'ongoing' : 'warning'}
|
<Item variant="muted" size="sm" className="min-w-0 flex-nowrap gap-2 px-2 py-1.5">
|
||||||
/>
|
<ItemMedia>
|
||||||
<span className="min-w-0 flex-1 truncate font-medium" title={task.subject}>{task.subject}</span>
|
<StateDot
|
||||||
<Badge
|
size={6}
|
||||||
variant={statusVariant(task)}
|
state={task.status === 'completed' ? 'done' : task.ready ? 'ongoing' : 'warning'}
|
||||||
className={cn('flex-none', statusTone(task))}
|
/>
|
||||||
>
|
</ItemMedia>
|
||||||
{t(task.ready ? taskStatusKey(task.status) : 'teamTaskBlocked')}
|
<ItemContent className="min-w-0 gap-0.5">
|
||||||
</Badge>
|
<ItemTitle className="w-full min-w-0">
|
||||||
</div>
|
<span className="min-w-0 flex-1 truncate" title={task.subject}>{task.subject}</span>
|
||||||
<div className="flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground">
|
</ItemTitle>
|
||||||
<span className="text-foreground-3">{t('teamTaskOwner')}</span>
|
{/* The meta line keeps the page's three ink levels: the labels are a
|
||||||
<span>{task.ownerName ?? t('teamTaskUnowned')}</span>
|
step quieter than the values, and ids stay mono. */}
|
||||||
{task.blockedBy.length > 0 && (
|
<span className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground">
|
||||||
<>
|
<span className="text-foreground-3">{t('teamTaskOwner')}</span>
|
||||||
<span className="text-foreground-3">{t('teamTaskBlockedBy')}</span>
|
<span>{task.ownerName ?? t('teamTaskUnowned')}</span>
|
||||||
<span className="font-mono tabular-nums">{task.blockedBy.join(' · ')}</span>
|
{task.blockedBy.length > 0 && (
|
||||||
</>
|
<>
|
||||||
)}
|
<span className="text-foreground-3">{t('teamTaskBlockedBy')}</span>
|
||||||
</div>
|
<span className="font-mono tabular-nums">{task.blockedBy.join(' · ')}</span>
|
||||||
<div className="max-h-[260px] overflow-y-auto leading-[1.55] text-foreground">
|
</>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</ItemContent>
|
||||||
|
<ItemActions>
|
||||||
|
<Badge variant={statusVariant(task)} className={cn('flex-none', statusTone(task))}>
|
||||||
|
{t(task.ready ? taskStatusKey(task.status) : 'teamTaskBlocked')}
|
||||||
|
</Badge>
|
||||||
|
</ItemActions>
|
||||||
|
</Item>
|
||||||
|
|
||||||
|
{/* The description is READ-ONLY here (the markdown preview is the point of
|
||||||
|
the view mode); 编辑 is what turns it into the multi-line editor. */}
|
||||||
|
<Field>
|
||||||
|
<FieldTitle>{t('teamTaskDescription')}</FieldTitle>
|
||||||
{body === ''
|
{body === ''
|
||||||
? <div className="text-xs leading-snug text-muted-foreground">{t('teamTaskNoDescription')}</div>
|
? <FieldDescription>{t('teamTaskNoDescription')}</FieldDescription>
|
||||||
: (
|
: (
|
||||||
<MarkdownText
|
<div className="max-h-[260px] overflow-y-auto">
|
||||||
{...markdownTextProps(body, { copyLabel: t('copy'), copiedLabel: t('copied') })}
|
<MarkdownText
|
||||||
/>
|
{...markdownTextProps(body, { copyLabel: t('copy'), copiedLabel: t('copied') })}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Field>
|
||||||
<div className="flex flex-col gap-1.5">
|
|
||||||
<span className="text-xs text-muted-foreground">{t('teamTaskOwner')}</span>
|
<Field data-disabled={props.busy ? true : undefined}>
|
||||||
|
<FieldLabel>{t('teamTaskOwner')}</FieldLabel>
|
||||||
<OwnerPicker
|
<OwnerPicker
|
||||||
members={props.teammates}
|
members={props.teammates}
|
||||||
owner={task.ownerName}
|
owner={task.ownerName}
|
||||||
disabled={props.busy}
|
disabled={props.busy}
|
||||||
onPick={props.onReassign}
|
onPick={props.onReassign}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Field>
|
||||||
</div>
|
</FieldGroup>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The editing body: subject (shadcn Input) + description (our multi-line field). */
|
/**
|
||||||
|
* The editing body: subject (a stock `Input`) and description (our multi-line
|
||||||
|
* field) as two `Field` rows. A BLANK subject is the form's only invalid state
|
||||||
|
* — it is reported on the `Field` (`data-invalid`) and the control
|
||||||
|
* (`aria-invalid`) once the reader has been in the field, and Save stays
|
||||||
|
* disabled until it is filled.
|
||||||
|
*
|
||||||
|
* The one-line input carries its hint as a `FieldDescription` (a placeholder
|
||||||
|
* would vanish the moment the reader focuses it); the tall textarea keeps its
|
||||||
|
* hint inside the field, where there is room for it.
|
||||||
|
*/
|
||||||
function TaskEditBody(props: {
|
function TaskEditBody(props: {
|
||||||
subject: string
|
subject: string
|
||||||
description: string
|
description: string
|
||||||
|
invalid: boolean
|
||||||
onSubject(next: string): void
|
onSubject(next: string): void
|
||||||
onDescription(next: string): void
|
onDescription(next: string): void
|
||||||
}): ReactNode {
|
}): ReactNode {
|
||||||
|
const subjectId = useId()
|
||||||
|
const subjectHintId = useId()
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2.5" data-popover-no-drag>
|
<FieldGroup className="gap-4" data-popover-no-drag>
|
||||||
<label className="flex flex-col gap-1">
|
<Field data-invalid={props.invalid ? true : undefined}>
|
||||||
<span className="text-xs text-muted-foreground">{t('teamTaskSubject')}</span>
|
<FieldLabel htmlFor={subjectId}>{t('teamTaskSubject')}</FieldLabel>
|
||||||
<Input
|
<Input
|
||||||
className="h-8"
|
id={subjectId}
|
||||||
value={props.subject}
|
value={props.subject}
|
||||||
placeholder={t('teamTaskSubjectPlaceholder')}
|
|
||||||
aria-label={t('teamTaskSubject')}
|
aria-label={t('teamTaskSubject')}
|
||||||
|
aria-invalid={props.invalid ? true : undefined}
|
||||||
|
aria-describedby={subjectHintId}
|
||||||
onChange={(event) => { props.onSubject(event.target.value) }}
|
onChange={(event) => { props.onSubject(event.target.value) }}
|
||||||
/>
|
/>
|
||||||
</label>
|
<FieldDescription id={subjectHintId}>{t('teamTaskSubjectPlaceholder')}</FieldDescription>
|
||||||
<label className="flex flex-col gap-1">
|
</Field>
|
||||||
<span className="text-xs text-muted-foreground">{t('teamTaskDescription')}</span>
|
<Field>
|
||||||
|
<FieldLabel>{t('teamTaskDescription')}</FieldLabel>
|
||||||
<MultilineField
|
<MultilineField
|
||||||
value={props.description}
|
value={props.description}
|
||||||
label={t('teamTaskDescription')}
|
label={t('teamTaskDescription')}
|
||||||
placeholder={t('teamTaskDescriptionPlaceholder')}
|
placeholder={t('teamTaskDescriptionPlaceholder')}
|
||||||
onChange={props.onDescription}
|
onChange={props.onDescription}
|
||||||
/>
|
/>
|
||||||
</label>
|
</Field>
|
||||||
</div>
|
</FieldGroup>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,6 +296,8 @@ export function TaskWindow(props: TaskWindowProps): ReactNode {
|
|||||||
const [editing, setEditing] = useState(creating)
|
const [editing, setEditing] = useState(creating)
|
||||||
const [subject, setSubject] = useState(task?.subject ?? '')
|
const [subject, setSubject] = useState(task?.subject ?? '')
|
||||||
const [description, setDescription] = useState(task?.description ?? '')
|
const [description, setDescription] = useState(task?.description ?? '')
|
||||||
|
/** The reader has been in the subject field (see TaskEditBody's contract). */
|
||||||
|
const [subjectTouched, setSubjectTouched] = useState(false)
|
||||||
const [busy, setBusy] = useState(false)
|
const [busy, setBusy] = useState(false)
|
||||||
const [note, setNote] = useState<string | undefined>(undefined)
|
const [note, setNote] = useState<string | undefined>(undefined)
|
||||||
const [armedDelete, setArmedDelete] = useState(false)
|
const [armedDelete, setArmedDelete] = useState(false)
|
||||||
@@ -279,6 +321,7 @@ export function TaskWindow(props: TaskWindowProps): ReactNode {
|
|||||||
const seed = seedRef.current
|
const seed = seedRef.current
|
||||||
setSubject(seed.subject)
|
setSubject(seed.subject)
|
||||||
setDescription(seed.description)
|
setDescription(seed.description)
|
||||||
|
setSubjectTouched(false)
|
||||||
setEditing(seed.creating)
|
setEditing(seed.creating)
|
||||||
}, [task?.id])
|
}, [task?.id])
|
||||||
|
|
||||||
@@ -338,14 +381,14 @@ export function TaskWindow(props: TaskWindowProps): ReactNode {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
className="dsw-tasks box-border gap-0 rounded-lg border-0 bg-transparent py-0 text-sm"
|
className="dsw-tasks box-border gap-0 rounded-lg border-0 bg-transparent py-0 shadow-none"
|
||||||
data-popover-handle
|
data-popover-handle
|
||||||
>
|
>
|
||||||
<CardHeader className="flex flex-row items-center justify-between gap-2 px-4 py-3">
|
<CardHeader className="items-center px-4 py-3">
|
||||||
<CardTitle className="min-w-0 flex-1 truncate text-sm font-medium text-muted-foreground">
|
<CardTitle className="min-w-0 truncate">
|
||||||
{creating ? t('teamTaskCreate') : editing ? t('teamTaskEdit') : t('teamTaskDetail')}
|
{creating ? t('teamTaskCreate') : editing ? t('teamTaskEdit') : t('teamTaskDetail')}
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<div className="flex flex-none items-center gap-1" data-popover-no-drag>
|
<CardAction data-popover-no-drag>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
@@ -355,7 +398,7 @@ export function TaskWindow(props: TaskWindowProps): ReactNode {
|
|||||||
>
|
>
|
||||||
<IconCloseOutline16 />
|
<IconCloseOutline16 />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</CardAction>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<Separator />
|
<Separator />
|
||||||
|
|
||||||
@@ -365,7 +408,8 @@ export function TaskWindow(props: TaskWindowProps): ReactNode {
|
|||||||
<TaskEditBody
|
<TaskEditBody
|
||||||
subject={subject}
|
subject={subject}
|
||||||
description={description}
|
description={description}
|
||||||
onSubject={setSubject}
|
invalid={subjectTouched && subject.trim() === ''}
|
||||||
|
onSubject={(next) => { setSubjectTouched(true); setSubject(next) }}
|
||||||
onDescription={setDescription}
|
onDescription={setDescription}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -377,7 +421,9 @@ export function TaskWindow(props: TaskWindowProps): ReactNode {
|
|||||||
onReassign={reassign}
|
onReassign={reassign}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{note !== undefined && <div className="mt-2 text-xs leading-snug text-warning">{note}</div>}
|
{/* The mutation outcome (CAS conflict / failure) is the form's own
|
||||||
|
alert: FieldError carries the role and the destructive ink. */}
|
||||||
|
{note !== undefined && <FieldError className="mt-2">{note}</FieldError>}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
||||||
<Separator />
|
<Separator />
|
||||||
@@ -402,6 +448,7 @@ export function TaskWindow(props: TaskWindowProps): ReactNode {
|
|||||||
else if (task !== undefined) {
|
else if (task !== undefined) {
|
||||||
setSubject(task.subject)
|
setSubject(task.subject)
|
||||||
setDescription(task.description)
|
setDescription(task.description)
|
||||||
|
setSubjectTouched(false)
|
||||||
setEditing(false)
|
setEditing(false)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -444,12 +491,12 @@ export function TaskWindow(props: TaskWindowProps): ReactNode {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
// Two-step confirm: the ARMED click takes the `destructive`
|
||||||
|
// variant (its copy already says 确认删除) — danger is a
|
||||||
|
// component variant, never a permanently red button and never a
|
||||||
|
// hand-painted outline.
|
||||||
|
variant={armedDelete ? 'destructive' : 'outline'}
|
||||||
size="sm"
|
size="sm"
|
||||||
// Two-step confirm, danger only on the armed click: outline +
|
|
||||||
// destructive ink beats a permanently red button (and keeps the
|
|
||||||
// variant's own 1px border).
|
|
||||||
className={armedDelete ? 'border-destructive/40 text-destructive' : undefined}
|
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!armedDelete) { setArmedDelete(true); return }
|
if (!armedDelete) { setArmedDelete(true); return }
|
||||||
|
|||||||
@@ -78,8 +78,14 @@ const CLICK_TOLERANCE_PX = 4
|
|||||||
* The shared shell of every node card: absolute (the layout owns left/top),
|
* The shared shell of every node card: absolute (the layout owns left/top),
|
||||||
* the compact stock node recipe — `rounded-lg border bg-card p-2.5 shadow-xs`
|
* the compact stock node recipe — `rounded-lg border bg-card p-2.5 shadow-xs`
|
||||||
* — with `hover:bg-muted` as the only hover change. No tint.
|
* — with `hover:bg-muted` as the only hover change. No tint.
|
||||||
|
*
|
||||||
|
* Every class here is stock: `Card` already carries `border` (hairline in
|
||||||
|
* `--border`) and `text-card-foreground`, so this only tightens the padding,
|
||||||
|
* drops the stock `gap-6` (the graph's three lines have their own `mt-0.5`)
|
||||||
|
* and sets the canvas elevation. The border ink is never re-declared — the
|
||||||
|
* lead node's stronger rung is the one exception, below.
|
||||||
*/
|
*/
|
||||||
const NODE_CARD = 'absolute cursor-pointer gap-0 overflow-hidden rounded-lg border border-border bg-card p-2.5 shadow-xs transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-1 focus-visible:outline-ring'
|
const NODE_CARD = 'absolute cursor-pointer gap-0 overflow-hidden rounded-lg bg-card p-2.5 shadow-xs transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-1 focus-visible:outline-ring'
|
||||||
/** The on-screen session: a 2px accent bar, never a tinted card. */
|
/** The on-screen session: a 2px accent bar, never a tinted card. */
|
||||||
const NODE_ACCENT = 'border-l-2 border-l-primary'
|
const NODE_ACCENT = 'border-l-2 border-l-primary'
|
||||||
/** Settled nodes recede by INK, not by opacity: the whole card drops to the
|
/** Settled nodes recede by INK, not by opacity: the whole card drops to the
|
||||||
@@ -387,11 +393,11 @@ export function TasksGraph(props: TasksGraphProps): ReactNode {
|
|||||||
same `loading` copy key). `pointer-events-none` keeps the
|
same `loading` copy key). `pointer-events-none` keeps the
|
||||||
canvas's pan/zoom/node clicks fully live underneath. */}
|
canvas's pan/zoom/node clicks fully live underneath. */}
|
||||||
{loading === true && nodes.length === 0 && (
|
{loading === true && nodes.length === 0 && (
|
||||||
<div className="pointer-events-none absolute inset-0 z-[6] flex items-center justify-center">
|
<div className="pointer-events-none absolute inset-0 z-10 flex items-center justify-center">
|
||||||
<span className="flex items-center gap-1.5 px-6 py-3 text-xs text-muted-foreground">
|
<span className="flex items-center gap-1.5 px-6 py-3 text-xs text-muted-foreground">
|
||||||
{/* The visible line carries the copy; the glyph is decoration. */}
|
{/* The visible line carries the copy; the glyph is decoration. */}
|
||||||
<span aria-hidden="true" className="flex flex-none items-center">
|
<span aria-hidden="true" className="flex flex-none items-center">
|
||||||
<Spinner size={12} />
|
<Spinner className="size-3" />
|
||||||
</span>
|
</span>
|
||||||
{t('loading')}
|
{t('loading')}
|
||||||
</span>
|
</span>
|
||||||
@@ -458,7 +464,7 @@ export function TasksGraph(props: TasksGraphProps): ReactNode {
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
<div className="absolute right-2.5 bottom-2.5 z-[6] flex flex-row items-center gap-0.5" data-graph-controls>
|
<div className="absolute right-2.5 bottom-2.5 z-10 flex flex-row items-center gap-0.5" data-graph-controls>
|
||||||
<ViewModeToggle mode={mode} onModeChange={onModeChange} />
|
<ViewModeToggle mode={mode} onModeChange={onModeChange} />
|
||||||
<FoldToggleButton folded={folded} onToggleFold={onToggleFold} />
|
<FoldToggleButton folded={folded} onToggleFold={onToggleFold} />
|
||||||
<ControlButton label={t('tasksZoomOut')} onClick={() => { zoomBy(1 / 1.2) }}>−</ControlButton>
|
<ControlButton label={t('tasksZoomOut')} onClick={() => { zoomBy(1 / 1.2) }}>−</ControlButton>
|
||||||
|
|||||||
+151
-82
@@ -3,14 +3,20 @@
|
|||||||
* live in AnchoredPopover): the agent node detail with a transcript jump and
|
* live in AnchoredPopover): the agent node detail with a transcript jump and
|
||||||
* the workflow run detail with clickable member rows.
|
* the workflow run detail with clickable member rows.
|
||||||
*
|
*
|
||||||
* Visual language: the vendored shadcn/ui pieces (Card + Separator + Badge +
|
* Visual base: the vendored shadcn/ui set composed the registry's way — the
|
||||||
* Button) over Tailwind utilities bound to the `--dsw-*` tokens. The surface
|
* full `Card` (header + title + description + action slot + content + footer),
|
||||||
* is flat — a 1px hairline plus the popover surface ladder carries the
|
* the node / run and every list row as an `Item` (`ItemMedia` + `ItemTitle` +
|
||||||
* layering; the only shadow is the one AnchoredPopover itself puts on the
|
* `ItemActions`) inside an `ItemGroup`, status as a stock `Badge` variant
|
||||||
* floating card. Ink stays on three levels (foreground / muted-foreground /
|
* (running = `default`, settled = `secondary`, failed = `destructive`) and the
|
||||||
* foreground-3), mono meta is `font-mono tabular-nums`, and hue is semantic
|
* jump as a stock `Button` — so colours and type come from those components
|
||||||
* only: success = settled, warning = blocked, destructive = failed, primary =
|
* and the semantic tokens. The surface is flat and owned by the shell: like
|
||||||
* the one main action per popover.
|
* the task window, the card paints no surface of its own (`border-0
|
||||||
|
* bg-transparent shadow-none`) because AnchoredPopover already draws the
|
||||||
|
* floating border/radius/shadow — nesting a second bordered card inside it
|
||||||
|
* would double the hairline. The only shadow is the shell's; ink stays on
|
||||||
|
* three levels (foreground / muted-foreground / foreground-3) and mono meta is
|
||||||
|
* `font-mono tabular-nums`; hue is semantic only — success = settled, warning =
|
||||||
|
* blocked, destructive = failed, primary = the one main action per popover.
|
||||||
*
|
*
|
||||||
* The team board is NOT here: it is always visible as a strip above the
|
* The team board is NOT here: it is always visible as a strip above the
|
||||||
* canvas (TeamBoard.tsx).
|
* canvas (TeamBoard.tsx).
|
||||||
@@ -22,12 +28,13 @@ import {
|
|||||||
import type { SidebarSubagentAddress } from '../context-types.ts'
|
import type { SidebarSubagentAddress } from '../context-types.ts'
|
||||||
import type { TasksAgentNode, TasksWorkflowNode } from './tasks-model.ts'
|
import type { TasksAgentNode, TasksWorkflowNode } from './tasks-model.ts'
|
||||||
import {
|
import {
|
||||||
flatten, nodeDotState, taskDotState, taskStatusKey, workflowStatusKey,
|
flatten, taskDotState, taskStatusKey, workflowStatusKey,
|
||||||
} from './tasks-shared.tsx'
|
} from './tasks-shared.tsx'
|
||||||
import { t, type CopyKey } from './locales.ts'
|
import { t, type CopyKey } from './locales.ts'
|
||||||
import { Badge } from './ui/badge.tsx'
|
import { Badge } from './ui/badge.tsx'
|
||||||
import { Button as UiButton } from './ui/button.tsx'
|
import { Button } from './ui/button.tsx'
|
||||||
import { Card } from './ui/card.tsx'
|
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './ui/card.tsx'
|
||||||
|
import { Item, ItemActions, ItemContent, ItemGroup, ItemMedia, ItemTitle } from './ui/item.tsx'
|
||||||
import { Separator } from './ui/separator.tsx'
|
import { Separator } from './ui/separator.tsx'
|
||||||
|
|
||||||
/** The workflow run status (the badge's semantic ink selector). */
|
/** The workflow run status (the badge's semantic ink selector). */
|
||||||
@@ -54,9 +61,21 @@ function statusVariant(status: WorkflowStatus | 'pending' | 'in_progress' | 'com
|
|||||||
return 'secondary'
|
return 'secondary'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The popover's key/value grid (label left, value right, mono on request).
|
/** The node display state on the same stock variant set. */
|
||||||
* The label column is a fixed 64px so every row's value starts on one axis —
|
function stateVariant(state: TasksAgentNode['state']): 'default' | 'secondary' | 'destructive' {
|
||||||
* an `auto` column makes the labels ragged across rows. */
|
if (state === 'running') return 'default'
|
||||||
|
if (state === 'error') return 'destructive'
|
||||||
|
return 'secondary'
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The popover's key/value grid (label left, value right, mono on request).
|
||||||
|
* The read-only meta stays a definition list rather than a `FieldGroup`: the
|
||||||
|
* three ink levels ARE the design language here, and a `FieldLabel` would have
|
||||||
|
* to be repainted (or would shout) to say the same thing. The label column is
|
||||||
|
* a fixed 64px so every row's value starts on one axis — an `auto` column
|
||||||
|
* makes the labels ragged across rows.
|
||||||
|
*/
|
||||||
function PopRows(props: { children: ReactNode }): ReactNode {
|
function PopRows(props: { children: ReactNode }): ReactNode {
|
||||||
return <dl className="grid grid-cols-[64px_1fr] items-baseline gap-x-3 gap-y-1">{props.children}</dl>
|
return <dl className="grid grid-cols-[64px_1fr] items-baseline gap-x-3 gap-y-1">{props.children}</dl>
|
||||||
}
|
}
|
||||||
@@ -79,7 +98,7 @@ function PopRow(props: { label: string; mono?: boolean; children: ReactNode }):
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The mono kicker above a popover list ("任务" / a phase title). */
|
/** The mono kicker above a popover list ("共享任务" / a phase title). */
|
||||||
function GroupLabel(props: { children: ReactNode }): ReactNode {
|
function GroupLabel(props: { children: ReactNode }): ReactNode {
|
||||||
return (
|
return (
|
||||||
<div className="px-1 pt-0.5 font-mono text-xs tracking-wide text-foreground-3 uppercase">
|
<div className="px-1 pt-0.5 font-mono text-xs tracking-wide text-foreground-3 uppercase">
|
||||||
@@ -111,16 +130,21 @@ export function AgentNodePopover(props: {
|
|||||||
// document.body — OUTSIDE the page root — so it must re-declare the page
|
// document.body — OUTSIDE the page root — so it must re-declare the page
|
||||||
// root class to pick up the scoped base reset the plugin ships instead of
|
// root class to pick up the scoped base reset the plugin ships instead of
|
||||||
// preflight (see TaskWindow.tsx for the same pattern).
|
// preflight (see TaskWindow.tsx for the same pattern).
|
||||||
<Card className="dsw-tasks gap-2 rounded-lg border-border bg-popover p-0 py-2.5">
|
<Card className="dsw-tasks box-border gap-0 rounded-lg border-0 bg-transparent py-0 shadow-none">
|
||||||
<div className="px-3 font-mono text-xs text-foreground-3">{t('tasksNodeDetail')}</div>
|
{/* The node leads (title) over the card's kind (description), and its
|
||||||
|
display state rides the header's action slot as a stock badge. */}
|
||||||
|
<CardHeader className="items-center px-3 py-2">
|
||||||
|
<CardTitle className="min-w-0">
|
||||||
|
<span className="min-w-0 truncate" title={node.label}>{node.label}</span>
|
||||||
|
</CardTitle>
|
||||||
|
<CardDescription>{t('tasksNodeDetail')}</CardDescription>
|
||||||
|
<CardAction>
|
||||||
|
<StatusBadge variant={stateVariant(node.state)}>{t(stateKey(node.state))}</StatusBadge>
|
||||||
|
</CardAction>
|
||||||
|
</CardHeader>
|
||||||
<Separator />
|
<Separator />
|
||||||
<div className="flex flex-col gap-1.5 px-3">
|
<CardContent className="flex min-w-0 flex-col gap-2 px-3 py-2.5">
|
||||||
<span className="truncate text-sm font-medium" title={node.label}>{node.label}</span>
|
|
||||||
<PopRows>
|
<PopRows>
|
||||||
<PopRow label={t('tasksNodeState')}>
|
|
||||||
<StateDot state={nodeDotState(node.state)} size={6} />
|
|
||||||
<span className="text-muted-foreground">{t(stateKey(node.state))}</span>
|
|
||||||
</PopRow>
|
|
||||||
{node.mode !== undefined && (
|
{node.mode !== undefined && (
|
||||||
<PopRow label={t('tasksNodeMode')}>
|
<PopRow label={t('tasksNodeMode')}>
|
||||||
{node.mode === 'one-shot' ? t('subagentModeOneShot') : t('subagentModeContinuable')}
|
{node.mode === 'one-shot' ? t('subagentModeOneShot') : t('subagentModeContinuable')}
|
||||||
@@ -141,38 +165,59 @@ export function AgentNodePopover(props: {
|
|||||||
{liveText !== undefined && liveTool !== undefined && (
|
{liveText !== undefined && liveTool !== undefined && (
|
||||||
<div className="line-clamp-2 text-xs text-muted-foreground" title={liveText}>{liveText}</div>
|
<div className="line-clamp-2 text-xs text-muted-foreground" title={liveText}>{liveText}</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</CardContent>
|
||||||
{tasks.length > 0 && (
|
{tasks.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<Separator />
|
<Separator />
|
||||||
<div className="flex flex-col gap-1 px-3">
|
<CardContent className="flex flex-col gap-1 px-3 py-2.5">
|
||||||
<GroupLabel>{t('tasksNodeTasks')}</GroupLabel>
|
<GroupLabel>{t('tasksNodeTasks')}</GroupLabel>
|
||||||
<div className="-mx-1 flex max-h-[190px] flex-col gap-0.5 overflow-y-auto">
|
{/* Each row opens the shared task window, so the whole row is the
|
||||||
|
button (`Item asChild` puts the stock row geometry on it, and
|
||||||
|
the trailing status badge on the actions slot). */}
|
||||||
|
<ItemGroup className="max-h-[190px] overflow-y-auto">
|
||||||
{tasks.map(task => (
|
{tasks.map(task => (
|
||||||
<UiButton
|
<Item
|
||||||
key={task.id}
|
key={task.id}
|
||||||
variant="ghost"
|
asChild
|
||||||
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
className="h-auto w-full justify-start gap-1.5 rounded-sm px-1 py-1 text-left text-xs font-normal"
|
className="min-w-0 flex-nowrap gap-2 px-2 py-1.5 hover:bg-muted"
|
||||||
title={task.subject}
|
|
||||||
onClick={(event) => { onOpenTask(task.id, event.currentTarget) }}
|
|
||||||
>
|
>
|
||||||
<StateDot state={taskDotState(task)} size={6} />
|
<button
|
||||||
<span className="min-w-0 flex-1 truncate text-xs font-medium">{task.subject}</span>
|
type="button"
|
||||||
<StatusBadge variant={statusVariant(task.status)}>{t(taskStatusKey(task.status))}</StatusBadge>
|
className="text-left"
|
||||||
</UiButton>
|
title={task.subject}
|
||||||
|
onClick={(event) => { onOpenTask(task.id, event.currentTarget) }}
|
||||||
|
>
|
||||||
|
<ItemMedia>
|
||||||
|
<StateDot state={taskDotState(task)} size={6} />
|
||||||
|
</ItemMedia>
|
||||||
|
<ItemContent className="min-w-0">
|
||||||
|
<ItemTitle className="w-full min-w-0">
|
||||||
|
<span className="min-w-0 flex-1 truncate">{task.subject}</span>
|
||||||
|
</ItemTitle>
|
||||||
|
</ItemContent>
|
||||||
|
<ItemActions>
|
||||||
|
<StatusBadge variant={statusVariant(task.status)}>
|
||||||
|
{t(taskStatusKey(task.status))}
|
||||||
|
</StatusBadge>
|
||||||
|
</ItemActions>
|
||||||
|
</button>
|
||||||
|
</Item>
|
||||||
))}
|
))}
|
||||||
</div>
|
</ItemGroup>
|
||||||
</div>
|
</CardContent>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{(node.childAddress !== undefined || node.parentId === undefined) && (
|
{(node.childAddress !== undefined || node.parentId === undefined) && (
|
||||||
<>
|
<>
|
||||||
{tasks.length > 0 && <Separator />}
|
<Separator />
|
||||||
<UiButton size="sm" className="mx-3 w-auto" onClick={() => { onJump(node) }}>
|
<CardFooter className="justify-end px-3 py-2">
|
||||||
<IconRightUpOutline14 size={12} />
|
<Button size="sm" onClick={() => { onJump(node) }}>
|
||||||
{t('tasksNodeJump')}
|
<IconRightUpOutline14 />
|
||||||
</UiButton>
|
{t('tasksNodeJump')}
|
||||||
|
</Button>
|
||||||
|
</CardFooter>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
@@ -195,58 +240,82 @@ export function WorkflowNodePopover(props: {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
// `dsw-tasks`: same portal-scope reset as AgentNodePopover above.
|
// `dsw-tasks`: same portal-scope reset as AgentNodePopover above.
|
||||||
<Card className="dsw-tasks gap-2 rounded-lg border-border bg-popover p-0 py-2.5">
|
<Card className="dsw-tasks box-border gap-0 rounded-lg border-0 bg-transparent py-0 shadow-none">
|
||||||
<div className="px-3 font-mono text-xs text-foreground-3">{t('workflowRun')}</div>
|
{/* The run's identity leads and keeps its branch glyph; the run status
|
||||||
<Separator />
|
rides the header's action slot as a stock badge. */}
|
||||||
<div className="flex flex-col gap-1.5 px-3">
|
<CardHeader className="items-center px-3 py-2">
|
||||||
<div className="flex min-w-0 items-center gap-1.5" title={run.name}>
|
<CardTitle className="flex min-w-0 items-center gap-1.5">
|
||||||
<span className="flex-none text-muted-foreground" aria-hidden="true">
|
{/* The visible line carries the copy; the glyph is decoration. */}
|
||||||
<IconBranchOutline16 size={12} />
|
<span className="flex flex-none items-center" aria-hidden="true">
|
||||||
|
<IconBranchOutline16 />
|
||||||
</span>
|
</span>
|
||||||
<span className="truncate text-sm font-medium">{run.name}</span>
|
<span className="min-w-0 truncate" title={run.name}>{run.name}</span>
|
||||||
</div>
|
</CardTitle>
|
||||||
<PopRows>
|
<CardDescription>{t('workflowRun')}</CardDescription>
|
||||||
<PopRow label={t('tasksNodeState')}>
|
<CardAction>
|
||||||
<StatusBadge variant={statusVariant(run.status)}>{t(workflowStatusKey(run.status))}</StatusBadge>
|
<StatusBadge variant={statusVariant(run.status)}>{t(workflowStatusKey(run.status))}</StatusBadge>
|
||||||
</PopRow>
|
</CardAction>
|
||||||
</PopRows>
|
</CardHeader>
|
||||||
</div>
|
|
||||||
{run.phases.length > 0 && (
|
{run.phases.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<Separator />
|
<Separator />
|
||||||
<div className="flex max-h-[220px] flex-col gap-1 overflow-y-auto px-3">
|
<CardContent className="flex max-h-[220px] flex-col gap-2 overflow-y-auto px-3 py-2.5">
|
||||||
{run.phases.map((phase, phaseIndex) => (
|
{run.phases.map((phase, phaseIndex) => (
|
||||||
<div key={`${phase.title ?? 'phase'}-${phaseIndex}`} className="flex flex-col gap-0.5">
|
<div key={`${phase.title ?? 'phase'}-${phaseIndex}`} className="flex flex-col gap-0.5">
|
||||||
<GroupLabel>{phase.title ?? t('workflowPhaseUnnamed')}</GroupLabel>
|
<GroupLabel>{phase.title ?? t('workflowPhaseUnnamed')}</GroupLabel>
|
||||||
{phase.members.length === 0 && (
|
{phase.members.length === 0 && (
|
||||||
<div className="px-1 py-1 text-xs text-foreground-3">{t('subagentEmpty')}</div>
|
<div className="px-1 py-1 text-xs text-foreground-3">{t('subagentEmpty')}</div>
|
||||||
)}
|
)}
|
||||||
{phase.members.map(member => (
|
<ItemGroup>
|
||||||
<div
|
{phase.members.map(member => {
|
||||||
key={member.seq}
|
const body = (
|
||||||
role={member.childId === '' ? undefined : 'button'}
|
<>
|
||||||
className={
|
<ItemMedia>
|
||||||
member.childId === ''
|
<StateDot size={6} state={memberDot(member.outcome)} />
|
||||||
? 'flex items-center gap-1.5 rounded-sm px-1 py-1'
|
</ItemMedia>
|
||||||
: 'flex cursor-pointer items-center gap-1.5 rounded-sm px-1 py-1 transition-colors hover:bg-muted'
|
<ItemContent className="min-w-0">
|
||||||
}
|
<ItemTitle className="w-full min-w-0">
|
||||||
title={member.label}
|
<span className="min-w-0 flex-1 truncate" title={member.label}>{member.label}</span>
|
||||||
onClick={() => {
|
</ItemTitle>
|
||||||
if (member.childId === '') return
|
</ItemContent>
|
||||||
onJumpMember({
|
</>
|
||||||
parentSessionId: run.originSessionId,
|
)
|
||||||
childSessionId: member.childId,
|
// A member row IS a jump affordance when it has a child
|
||||||
mode: 'one-shot',
|
// session; without one it stays a plain tally line.
|
||||||
})
|
return member.childId === ''
|
||||||
}}
|
? (
|
||||||
>
|
<Item key={member.seq} size="sm" className="min-w-0 flex-nowrap gap-2 px-1.5 py-1">
|
||||||
<StateDot size={6} state={memberDot(member.outcome)} />
|
{body}
|
||||||
<span className="min-w-0 flex-1 truncate text-xs">{member.label}</span>
|
</Item>
|
||||||
</div>
|
)
|
||||||
))}
|
: (
|
||||||
|
<Item
|
||||||
|
key={member.seq}
|
||||||
|
asChild
|
||||||
|
size="sm"
|
||||||
|
className="min-w-0 flex-nowrap gap-2 px-1.5 py-1 hover:bg-muted"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="text-left"
|
||||||
|
title={member.label}
|
||||||
|
onClick={() => {
|
||||||
|
onJumpMember({
|
||||||
|
parentSessionId: run.originSessionId,
|
||||||
|
childSessionId: member.childId,
|
||||||
|
mode: 'one-shot',
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{body}
|
||||||
|
</button>
|
||||||
|
</Item>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ItemGroup>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</CardContent>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
+12
-11
@@ -35,6 +35,7 @@ import { FoldToggleButton, ViewModeToggle } from './TasksGraph.tsx'
|
|||||||
import { Collapsible, CollapsibleContent } from './ui/collapsible.tsx'
|
import { Collapsible, CollapsibleContent } from './ui/collapsible.tsx'
|
||||||
import { ScrollArea } from './ui/scroll-area.tsx'
|
import { ScrollArea } from './ui/scroll-area.tsx'
|
||||||
import { Spinner } from './ui/spinner.tsx'
|
import { Spinner } from './ui/spinner.tsx'
|
||||||
|
import { cn } from './ui/utils.ts'
|
||||||
import { t } from './locales.ts'
|
import { t } from './locales.ts'
|
||||||
|
|
||||||
/** The row slab: one shared box, so every row kind lines up on the same grid. */
|
/** The row slab: one shared box, so every row kind lines up on the same grid. */
|
||||||
@@ -136,13 +137,13 @@ export function TasksTree(props: TasksTreeProps): ReactNode {
|
|||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
aria-level={depth + 1}
|
aria-level={depth + 1}
|
||||||
aria-label={`${t('tasksFoldCompleted', { count: node.count })} · ${t('tasksFoldExpand')}`}
|
aria-label={`${t('tasksFoldCompleted', { count: node.count })} · ${t('tasksFoldExpand')}`}
|
||||||
className={`${ROW} ${ROW_FOLD} ${ROW_HOVER}`}
|
className={cn(ROW, ROW_FOLD, ROW_HOVER)}
|
||||||
onClick={onToggleFold}
|
onClick={onToggleFold}
|
||||||
onKeyDown={(event) => { activateOnKey(event, onToggleFold) }}
|
onKeyDown={(event) => { activateOnKey(event, onToggleFold) }}
|
||||||
>
|
>
|
||||||
<span className={GLYPH} aria-hidden="true"><FoldGlyph /></span>
|
<span className={GLYPH} aria-hidden="true"><FoldGlyph /></span>
|
||||||
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
||||||
<span className={`flex items-center gap-1.5 font-medium ${LINE}`}>
|
<span className={cn('flex items-center gap-1.5 font-medium', LINE)}>
|
||||||
{t('tasksFoldCompleted', { count: node.count })}
|
{t('tasksFoldCompleted', { count: node.count })}
|
||||||
<span className={META}>
|
<span className={META}>
|
||||||
{t(folded ? 'tasksFoldExpand' : 'tasksFoldCollapse')}
|
{t(folded ? 'tasksFoldExpand' : 'tasksFoldCollapse')}
|
||||||
@@ -162,7 +163,7 @@ export function TasksTree(props: TasksTreeProps): ReactNode {
|
|||||||
aria-level={depth + 1}
|
aria-level={depth + 1}
|
||||||
aria-expanded="true"
|
aria-expanded="true"
|
||||||
aria-label={`${node.run.name} ${workflowMeta(node)}`}
|
aria-label={`${node.run.name} ${workflowMeta(node)}`}
|
||||||
className={`${ROW} ${ROW_HOVER} ${node.run.status !== 'running' ? ROW_SETTLED : ''}`}
|
className={cn(ROW, ROW_HOVER, node.run.status !== 'running' && ROW_SETTLED)}
|
||||||
onClick={(event) => { onWorkflowInfo(node, event.currentTarget) }}
|
onClick={(event) => { onWorkflowInfo(node, event.currentTarget) }}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
activateOnKey(event, () => { onWorkflowInfo(node, event.currentTarget as HTMLElement) })
|
activateOnKey(event, () => { onWorkflowInfo(node, event.currentTarget as HTMLElement) })
|
||||||
@@ -173,7 +174,7 @@ export function TasksTree(props: TasksTreeProps): ReactNode {
|
|||||||
</span>
|
</span>
|
||||||
<span className={GLYPH} aria-hidden="true"><WorkflowGlyph /></span>
|
<span className={GLYPH} aria-hidden="true"><WorkflowGlyph /></span>
|
||||||
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
||||||
<span className={`font-medium ${LINE}`}>{node.run.name}</span>
|
<span className={cn('font-medium', LINE)}>{node.run.name}</span>
|
||||||
<span className={META}>{workflowMeta(node)}</span>
|
<span className={META}>{workflowMeta(node)}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -187,12 +188,12 @@ export function TasksTree(props: TasksTreeProps): ReactNode {
|
|||||||
aria-level={depth + 1}
|
aria-level={depth + 1}
|
||||||
aria-label={`${node.label} ${agentMeta(node)}`}
|
aria-label={`${node.label} ${agentMeta(node)}`}
|
||||||
aria-current={node.current ? 'true' : undefined}
|
aria-current={node.current ? 'true' : undefined}
|
||||||
className={[
|
className={cn(
|
||||||
ROW,
|
ROW,
|
||||||
ROW_HOVER,
|
ROW_HOVER,
|
||||||
node.current ? ROW_CURRENT : '',
|
node.current && ROW_CURRENT,
|
||||||
(node.state === 'done' || node.state === 'error') && !node.current ? ROW_SETTLED : '',
|
(node.state === 'done' || node.state === 'error') && !node.current && ROW_SETTLED,
|
||||||
].join(' ')}
|
)}
|
||||||
onClick={(event) => { onNodeInfo(node, event.currentTarget) }}
|
onClick={(event) => { onNodeInfo(node, event.currentTarget) }}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
activateOnKey(event, () => { onNodeInfo(node, event.currentTarget as HTMLElement) })
|
activateOnKey(event, () => { onNodeInfo(node, event.currentTarget as HTMLElement) })
|
||||||
@@ -207,7 +208,7 @@ export function TasksTree(props: TasksTreeProps): ReactNode {
|
|||||||
</span>
|
</span>
|
||||||
<span className={GLYPH} aria-hidden="true"><AgentGlyph node={node} /></span>
|
<span className={GLYPH} aria-hidden="true"><AgentGlyph node={node} /></span>
|
||||||
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
<span className="flex min-w-0 flex-1 flex-col gap-0.5">
|
||||||
<span className={`font-medium ${LINE}`}>{node.label}</span>
|
<span className={cn('font-medium', LINE)}>{node.label}</span>
|
||||||
<span className={META}>{agentMeta(node)}</span>
|
<span className={META}>{agentMeta(node)}</span>
|
||||||
{node.state === 'running' && <LiveLine live={node.live} />}
|
{node.state === 'running' && <LiveLine live={node.live} />}
|
||||||
<TaskLine tasks={node.tasks} onOpenTask={onOpenTask} />
|
<TaskLine tasks={node.tasks} onOpenTask={onOpenTask} />
|
||||||
@@ -243,7 +244,7 @@ export function TasksTree(props: TasksTreeProps): ReactNode {
|
|||||||
<div className="flex items-center justify-center gap-1.5 px-6 py-3 text-xs text-muted-foreground">
|
<div className="flex items-center justify-center gap-1.5 px-6 py-3 text-xs text-muted-foreground">
|
||||||
{/* The visible line carries the copy; the glyph is decoration. */}
|
{/* The visible line carries the copy; the glyph is decoration. */}
|
||||||
<span aria-hidden="true" className="flex flex-none items-center">
|
<span aria-hidden="true" className="flex flex-none items-center">
|
||||||
<Spinner size={12} />
|
<Spinner className="size-3" />
|
||||||
</span>
|
</span>
|
||||||
{t('loading')}
|
{t('loading')}
|
||||||
</div>
|
</div>
|
||||||
@@ -252,7 +253,7 @@ export function TasksTree(props: TasksTreeProps): ReactNode {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
<div className="absolute right-2.5 bottom-2.5 z-[6] flex flex-row items-center" data-graph-controls>
|
<div className="absolute right-2.5 bottom-2.5 z-10 flex flex-row items-center" data-graph-controls>
|
||||||
<ViewModeToggle mode={mode} onModeChange={onModeChange} />
|
<ViewModeToggle mode={mode} onModeChange={onModeChange} />
|
||||||
<FoldToggleButton folded={folded} onToggleFold={onToggleFold} />
|
<FoldToggleButton folded={folded} onToggleFold={onToggleFold} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+163
-138
@@ -4,12 +4,16 @@
|
|||||||
* the native sidebar is narrow: members wrap as a segmented filter and the
|
* the native sidebar is narrow: members wrap as a segmented filter and the
|
||||||
* task list scrolls inside a bounded height, so the canvas keeps its room.
|
* task list scrolls inside a bounded height, so the canvas keeps its room.
|
||||||
*
|
*
|
||||||
* Visual language: shadcn/ui over the task page's Tailwind tokens
|
* Visual language: the vendored shadcn/ui set over the task page's Tailwind
|
||||||
* (src/client/ui/theme.css) — the strip is a stock Card (`rounded-xl border
|
* tokens (src/client/ui/theme.css) — one full `Card` whose bands (header,
|
||||||
* bg-card shadow-sm`), members are a ToggleGroup whose selected chip carries
|
* filter, `CardContent` list, `CardFooter`) are separated by hairlines, task
|
||||||
* the accent, and every task row ends in one DropdownMenu. Ink stays on the
|
* rows are `Item`s, members are a `ToggleGroup` whose picked chip carries the
|
||||||
* three token levels (text-sm body / text-xs mono meta, `font-mono
|
* component's own accent, and every task row ends in one `DropdownMenu`.
|
||||||
* tabular-nums`), and status color is the stock Badge variant set only.
|
* Type and color come from the components' variants and the semantic tokens
|
||||||
|
* (the count keeps the page's mono-meta convention); status color is the stock
|
||||||
|
* `Badge` variant set only. The strip's compact band padding is its one
|
||||||
|
* deliberate departure — it is a permanently visible strip, so it stays thin
|
||||||
|
* and lets the canvas below it keep its height.
|
||||||
*
|
*
|
||||||
* Behaviour is unchanged, and deliberately so: the row and EVERY menu entry
|
* Behaviour is unchanged, and deliberately so: the row and EVERY menu entry
|
||||||
* open the shared task window, which is the ONE surface owning view / edit /
|
* open the shared task window, which is the ONE surface owning view / edit /
|
||||||
@@ -19,21 +23,21 @@
|
|||||||
* before.
|
* before.
|
||||||
*/
|
*/
|
||||||
import { useMemo, useRef, useState, type ReactNode } from 'react'
|
import { useMemo, useRef, useState, type ReactNode } from 'react'
|
||||||
import {
|
import { IconChecklistOutline14, IconChevronUpOutline14, IconPlusOutline16, StateDot } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||||
Button, IconChecklistOutline14, IconChevronUpOutline14, IconPlusOutline16, StateDot,
|
|
||||||
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
||||||
import type { SidebarTeamMemberView, SidebarTeamTaskView } from '../context-types.ts'
|
import type { SidebarTeamMemberView, SidebarTeamTaskView } from '../context-types.ts'
|
||||||
import { t, type CopyKey } from './locales.ts'
|
import { t, type CopyKey } from './locales.ts'
|
||||||
import { cn } from './ui/utils.ts'
|
|
||||||
import { Badge } from './ui/badge.tsx'
|
import { Badge } from './ui/badge.tsx'
|
||||||
import { Card } from './ui/card.tsx'
|
import { Button } from './ui/button.tsx'
|
||||||
import { Empty } from './ui/empty.tsx'
|
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from './ui/card.tsx'
|
||||||
import { Separator } from './ui/separator.tsx'
|
|
||||||
import { ToggleGroup, ToggleGroupItem } from './ui/toggle-group.tsx'
|
|
||||||
import {
|
import {
|
||||||
DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator,
|
DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator,
|
||||||
DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger,
|
DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger,
|
||||||
} from './ui/dropdown-menu.tsx'
|
} from './ui/dropdown-menu.tsx'
|
||||||
|
import { Empty, EmptyDescription } from './ui/empty.tsx'
|
||||||
|
import { Item, ItemContent, ItemGroup, ItemMedia, ItemTitle } from './ui/item.tsx'
|
||||||
|
import { Separator } from './ui/separator.tsx'
|
||||||
|
import { ToggleGroup, ToggleGroupItem } from './ui/toggle-group.tsx'
|
||||||
|
import { cn } from './ui/utils.ts'
|
||||||
|
|
||||||
/** The task status label key. */
|
/** The task status label key. */
|
||||||
function taskStatusKey(status: SidebarTeamTaskView['status']): CopyKey {
|
function taskStatusKey(status: SidebarTeamTaskView['status']): CopyKey {
|
||||||
@@ -81,22 +85,20 @@ function memberDotState(member: SidebarTeamMemberView): 'ongoing' | 'error' | 'i
|
|||||||
*/
|
*/
|
||||||
const FILTER_ALL = '__all__'
|
const FILTER_ALL = '__all__'
|
||||||
|
|
||||||
/** The shared slab: a filled rounded row whose only hover change is its background. */
|
/**
|
||||||
const ROW_CLASS =
|
* The row menu's trigger: revealed on hover / focus (the board stays quiet
|
||||||
'flex min-w-0 cursor-pointer items-center gap-2 rounded-md bg-transparent px-2 py-2 text-left transition-colors outline-none hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50'
|
* until the reader reaches for it) but never removed from the tab order.
|
||||||
/** The shared filter chip: sm toggle geometry, accent when picked (stock). */
|
*/
|
||||||
const CHIP_CLASS =
|
const TRIGGER_CLASS = 'opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100'
|
||||||
'h-6 w-auto min-w-0 gap-1 px-2 text-xs font-normal text-muted-foreground data-[state=on]:text-foreground'
|
|
||||||
/** The row menu's rows: body size, no icon column (the label is the affordance). */
|
|
||||||
const ITEM_CLASS = 'text-sm'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One board row: state dot, subject, owner, status Badge, and the row menu.
|
* One board row: state dot, subject, owner, status Badge, and the row menu.
|
||||||
*
|
*
|
||||||
* The clickable surface is a real `<button>` (the whole row except the menu),
|
* The clickable surface is a real `<button>` (the whole row except the menu),
|
||||||
* and the menu is its SIBLING inside a grid row — a control may not nest
|
* and the menu is its SIBLING — a control may not nest inside another, and the
|
||||||
* inside another, and the row's own press target must stay one element. The
|
* row's own press target must stay one element. `Item asChild` puts the stock
|
||||||
* node is held in a ref so the menu can hand a MOUNTED anchor to the task
|
* row geometry on that button itself instead of wrapping it in a second box.
|
||||||
|
* The node is held in a ref so the menu can hand a MOUNTED anchor to the task
|
||||||
* window: the menu content is portaled and unmounts the moment an entry is
|
* window: the menu content is portaled and unmounts the moment an entry is
|
||||||
* picked, while the window measures its anchor on mount.
|
* picked, while the window measures its anchor on mount.
|
||||||
*/
|
*/
|
||||||
@@ -112,68 +114,79 @@ function TeamTaskRow(props: {
|
|||||||
const row = rowRef.current
|
const row = rowRef.current
|
||||||
if (row !== null) onOpenTask(task, row)
|
if (row !== null) onOpenTask(task, row)
|
||||||
}
|
}
|
||||||
|
const badge = taskBadge(task)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={rowRef} className="group grid grid-cols-[1fr_auto] items-center gap-1">
|
<div ref={rowRef} className="group flex min-w-0 items-center gap-1">
|
||||||
<button
|
<Item asChild size="sm" className="min-w-0 flex-1 flex-nowrap gap-2 px-2 py-1.5 hover:bg-muted">
|
||||||
type="button"
|
<button
|
||||||
className={ROW_CLASS}
|
type="button"
|
||||||
aria-label={`${t('teamTaskDetail')} ${task.subject}`}
|
aria-label={`${t('teamTaskDetail')} ${task.subject}`}
|
||||||
title={t('teamTaskDetail')}
|
title={t('teamTaskDetail')}
|
||||||
onClick={(event) => { onOpenTask(task, event.currentTarget) }}
|
onClick={(event) => { onOpenTask(task, event.currentTarget) }}
|
||||||
>
|
|
||||||
<StateDot size={6} state={taskDotState(task)} />
|
|
||||||
<span className="min-w-0 flex-1 truncate text-sm text-foreground">{task.subject}</span>
|
|
||||||
{task.ownerName !== undefined && (
|
|
||||||
<span className="max-w-[72px] flex-none truncate font-mono text-xs tabular-nums text-foreground-3">
|
|
||||||
{task.ownerName}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
{(() => {
|
|
||||||
const badge = taskBadge(task)
|
|
||||||
return (
|
|
||||||
<Badge variant={badge.variant} className={cn('flex-none', badge.className)}>
|
|
||||||
{taskStatusLabel(task)}
|
|
||||||
</Badge>
|
|
||||||
)
|
|
||||||
})()}
|
|
||||||
</button>
|
|
||||||
<DropdownMenu>
|
|
||||||
<DropdownMenuTrigger
|
|
||||||
aria-label={t('teamTaskActions')}
|
|
||||||
title={t('teamTaskActions')}
|
|
||||||
className="flex size-6 flex-none cursor-pointer items-center justify-center rounded-md bg-transparent text-muted-foreground opacity-0 outline-none transition-colors group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
|
||||||
>
|
>
|
||||||
<IconChevronUpOutline14 size={12} className="rotate-90" />
|
<ItemMedia><StateDot size={6} state={taskDotState(task)} /></ItemMedia>
|
||||||
|
<ItemContent className="min-w-0">
|
||||||
|
<ItemTitle className="w-full min-w-0">
|
||||||
|
<span className="min-w-0 truncate">{task.subject}</span>
|
||||||
|
</ItemTitle>
|
||||||
|
</ItemContent>
|
||||||
|
{task.ownerName !== undefined && (
|
||||||
|
<span className="max-w-18 flex-none truncate font-mono text-xs tabular-nums text-foreground-3">
|
||||||
|
{task.ownerName}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
<Badge variant={badge.variant} className={cn('flex-none', badge.className)}>
|
||||||
|
{taskStatusLabel(task)}
|
||||||
|
</Badge>
|
||||||
|
</button>
|
||||||
|
</Item>
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon-xs"
|
||||||
|
className={TRIGGER_CLASS}
|
||||||
|
aria-label={t('teamTaskActions')}
|
||||||
|
title={t('teamTaskActions')}
|
||||||
|
>
|
||||||
|
<IconChevronUpOutline14 className="rotate-90" />
|
||||||
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end" className="w-44">
|
<DropdownMenuContent align="end" className="w-44">
|
||||||
<DropdownMenuItem className={ITEM_CLASS} onClick={openWindow}>
|
<DropdownMenuGroup>
|
||||||
{task.status === 'completed' ? t('teamTaskReopen') : t('teamTaskComplete')}
|
<DropdownMenuItem onClick={openWindow}>
|
||||||
</DropdownMenuItem>
|
{task.status === 'completed' ? t('teamTaskReopen') : t('teamTaskComplete')}
|
||||||
<DropdownMenuItem className={ITEM_CLASS} onClick={openWindow}>
|
</DropdownMenuItem>
|
||||||
{t('teamTaskEdit')}
|
<DropdownMenuItem onClick={openWindow}>
|
||||||
</DropdownMenuItem>
|
{t('teamTaskEdit')}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuGroup>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuSub>
|
<DropdownMenuSub>
|
||||||
<DropdownMenuSubTrigger className={ITEM_CLASS}>{t('teamTaskOwner')}</DropdownMenuSubTrigger>
|
<DropdownMenuSubTrigger>{t('teamTaskOwner')}</DropdownMenuSubTrigger>
|
||||||
<DropdownMenuSubContent className="w-40">
|
<DropdownMenuSubContent className="w-40">
|
||||||
<DropdownMenuItem className={ITEM_CLASS} onClick={openWindow}>
|
<DropdownMenuGroup>
|
||||||
{t('teamTaskUnowned')}
|
<DropdownMenuItem onClick={openWindow}>
|
||||||
</DropdownMenuItem>
|
{t('teamTaskUnowned')}
|
||||||
{teammates.map(member => (
|
|
||||||
<DropdownMenuItem key={member.id} className={ITEM_CLASS} onClick={openWindow}>
|
|
||||||
{member.name}
|
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
))}
|
{teammates.map(member => (
|
||||||
|
<DropdownMenuItem key={member.id} onClick={openWindow}>
|
||||||
|
{member.name}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
))}
|
||||||
|
</DropdownMenuGroup>
|
||||||
</DropdownMenuSubContent>
|
</DropdownMenuSubContent>
|
||||||
</DropdownMenuSub>
|
</DropdownMenuSub>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
{/* Neutral on purpose: this entry only OPENS the shared task window
|
<DropdownMenuGroup>
|
||||||
(the danger lives in the window's two-click delete confirm), so a
|
{/* Neutral on purpose: this entry only OPENS the shared task window
|
||||||
permanently red menu item would over-signal — see TaskWindow. */}
|
(the danger lives in the window's two-click delete confirm), so a
|
||||||
<DropdownMenuItem className={ITEM_CLASS} onClick={openWindow}>
|
permanently red menu item would over-signal — see TaskWindow. */}
|
||||||
{t('teamTaskDelete')}
|
<DropdownMenuItem onClick={openWindow}>
|
||||||
</DropdownMenuItem>
|
{t('teamTaskDelete')}
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuGroup>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</div>
|
</div>
|
||||||
@@ -208,86 +221,98 @@ export function TeamBoard(props: TeamBoardProps): ReactNode {
|
|||||||
// card rhythm; `py-0` because each band owns its own padding. The rest is
|
// card rhythm; `py-0` because each band owns its own padding. The rest is
|
||||||
// the stock card surface (`rounded-xl border bg-card shadow-sm`); the
|
// the stock card surface (`rounded-xl border bg-card shadow-sm`); the
|
||||||
// landmark role keeps the labelled region the old `<section>` provided.
|
// landmark role keeps the labelled region the old `<section>` provided.
|
||||||
className="mb-2 shrink-0 gap-0 overflow-hidden rounded-xl py-0 shadow-sm"
|
className="mb-2 shrink-0 gap-0 overflow-hidden py-0"
|
||||||
role="region"
|
role="region"
|
||||||
aria-label={t('teamBoard')}
|
aria-label={t('teamBoard')}
|
||||||
>
|
>
|
||||||
{/* Header: the disclosure, and the only control that collapses the board. */}
|
{/* Header: the disclosure, and the only control that collapses the board.
|
||||||
<div className="flex items-center py-0.5 pr-2 pl-3">
|
It owns the WHOLE band (one press target, as before) and carries the
|
||||||
<button
|
board's accessible name and expanded state. */}
|
||||||
type="button"
|
<CardHeader className="flex flex-row items-center gap-1 p-1">
|
||||||
className={cn(ROW_CLASS, 'flex-1 py-1.5')}
|
<CardTitle className="min-w-0 flex-1">
|
||||||
aria-expanded={!collapsed}
|
<Button
|
||||||
aria-label={t('teamBoard')}
|
variant="ghost"
|
||||||
onClick={onToggleCollapsed}
|
size="sm"
|
||||||
>
|
className="w-full justify-start"
|
||||||
<span className="flex-none text-muted-foreground" aria-hidden="true">
|
aria-expanded={!collapsed}
|
||||||
<IconChecklistOutline14 size={12} />
|
aria-label={t('teamBoard')}
|
||||||
</span>
|
onClick={onToggleCollapsed}
|
||||||
<span className="min-w-0 truncate text-sm font-medium text-foreground">{t('teamBoard')}</span>
|
|
||||||
<span className="min-w-0 truncate font-mono text-xs tabular-nums text-foreground-3">
|
|
||||||
{t('teamChip', { members: members.length, tasks: live.length })}
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
className={cn('ml-auto flex-none text-muted-foreground', collapsed ? '' : 'rotate-180')}
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
>
|
||||||
<IconChevronUpOutline14 size={12} />
|
<IconChecklistOutline14 />
|
||||||
</span>
|
<span className="min-w-0 truncate">{t('teamBoard')}</span>
|
||||||
</button>
|
<span className="ml-auto min-w-0 truncate font-mono text-xs tabular-nums text-foreground-3">
|
||||||
</div>
|
{t('teamChip', { members: members.length, tasks: live.length })}
|
||||||
|
</span>
|
||||||
|
<span className={cn('flex-none', collapsed ? '' : 'rotate-180')} aria-hidden="true">
|
||||||
|
<IconChevronUpOutline14 />
|
||||||
|
</span>
|
||||||
|
</Button>
|
||||||
|
</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
{!collapsed && (
|
{!collapsed && (
|
||||||
<>
|
<>
|
||||||
<Separator />
|
<Separator />
|
||||||
{/* The owner filter: one chip per member, plus "all". */}
|
{/* The owner filter: one chip per member, plus "all". */}
|
||||||
<ToggleGroup
|
<div className="px-2 py-1.5">
|
||||||
type="single"
|
<ToggleGroup
|
||||||
variant="default"
|
type="single"
|
||||||
size="sm"
|
variant="default"
|
||||||
value={ownerFilter ?? FILTER_ALL}
|
size="sm"
|
||||||
aria-label={t('teamMembers')}
|
spacing={1}
|
||||||
className="flex-wrap justify-start gap-1 px-2 py-1"
|
value={ownerFilter ?? FILTER_ALL}
|
||||||
onValueChange={(next) => {
|
aria-label={t('teamMembers')}
|
||||||
// "all" is a sentinel, never a real member name — and re-clicking
|
className="flex-wrap justify-start"
|
||||||
// the active member clears the filter (the toggle's own off state,
|
onValueChange={(next) => {
|
||||||
// which Radix reports as an empty value).
|
// "all" is a sentinel, never a real member name — and re-clicking
|
||||||
setOwnerFilter(next === '' ? undefined : next)
|
// the active member clears the filter (the toggle's own off state,
|
||||||
}}
|
// which Radix reports as an empty value).
|
||||||
>
|
setOwnerFilter(next === '' ? undefined : next)
|
||||||
<ToggleGroupItem value={FILTER_ALL} className={CHIP_CLASS}>{t('teamFilterAll')}</ToggleGroupItem>
|
}}
|
||||||
{members.map(member => (
|
>
|
||||||
<ToggleGroupItem
|
<ToggleGroupItem value={FILTER_ALL}>{t('teamFilterAll')}</ToggleGroupItem>
|
||||||
key={member.id}
|
{members.map(member => (
|
||||||
value={member.name}
|
<ToggleGroupItem
|
||||||
title={`${member.name} · ${member.role}`}
|
key={member.id}
|
||||||
className={CHIP_CLASS}
|
value={member.name}
|
||||||
>
|
title={`${member.name} · ${member.role}`}
|
||||||
<StateDot size={6} state={memberDotState(member)} />
|
>
|
||||||
<span className="min-w-0 truncate">{member.name}</span>
|
<StateDot size={6} state={memberDotState(member)} />
|
||||||
</ToggleGroupItem>
|
<span className="min-w-0 truncate">{member.name}</span>
|
||||||
))}
|
</ToggleGroupItem>
|
||||||
</ToggleGroup>
|
|
||||||
<Separator />
|
|
||||||
<div className="max-h-40 overflow-y-auto p-1">
|
|
||||||
{shown.length === 0
|
|
||||||
// `Empty` is the design language's empty state; the stock card
|
|
||||||
// rhythm is overridden so an empty board stays a thin band.
|
|
||||||
? <Empty className="gap-0 rounded-md p-2 text-xs">{t('teamTasksEmpty')}</Empty>
|
|
||||||
: shown.map(task => (
|
|
||||||
<TeamTaskRow key={task.id} task={task} teammates={teammates} onOpenTask={onOpenTask} />
|
|
||||||
))}
|
))}
|
||||||
|
</ToggleGroup>
|
||||||
</div>
|
</div>
|
||||||
<Separator />
|
<Separator />
|
||||||
<div className="px-2 py-1.5">
|
<CardContent className="p-1">
|
||||||
|
{shown.length === 0
|
||||||
|
// `Empty` is the design language's empty state; its stock card
|
||||||
|
// rhythm is overridden — including the `md:` step, which would
|
||||||
|
// otherwise re-inflate the band to 48px of padding above 768px —
|
||||||
|
// so an empty board stays a thin band.
|
||||||
|
? (
|
||||||
|
<Empty className="gap-0 p-3 md:p-3">
|
||||||
|
<EmptyDescription>{t('teamTasksEmpty')}</EmptyDescription>
|
||||||
|
</Empty>
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
<ItemGroup className="max-h-40 overflow-y-auto">
|
||||||
|
{shown.map(task => (
|
||||||
|
<TeamTaskRow key={task.id} task={task} teammates={teammates} onOpenTask={onOpenTask} />
|
||||||
|
))}
|
||||||
|
</ItemGroup>
|
||||||
|
)}
|
||||||
|
</CardContent>
|
||||||
|
<Separator />
|
||||||
|
<CardFooter className="px-2 py-1.5">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
icon={<IconPlusOutline16 size={13} />}
|
|
||||||
onClick={(event) => { onOpenTask(undefined, event.currentTarget) }}
|
onClick={(event) => { onOpenTask(undefined, event.currentTarget) }}
|
||||||
>
|
>
|
||||||
|
<IconPlusOutline16 />
|
||||||
{t('teamTaskCreate')}
|
{t('teamTaskCreate')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</CardFooter>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
+33
-39
@@ -3,51 +3,45 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
import { Slot } from "radix-ui"
|
import { Slot } from "radix-ui"
|
||||||
|
|
||||||
/**
|
|
||||||
* Vendored shadcn/ui badge, trimmed to the task page's real inventory.
|
|
||||||
*
|
|
||||||
* Removed from upstream (`new-york`): the `ghost` and `link` variants (dead
|
|
||||||
* class strings in a runtime object, so they would ship). `text-white` became
|
|
||||||
* the `--destructive-foreground` token, which is what the theme bridge defines
|
|
||||||
* that role for — no color literal lives in this directory.
|
|
||||||
*/
|
|
||||||
const badgeVariants = cva(
|
const badgeVariants = cva(
|
||||||
"inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3",
|
"inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3",
|
||||||
{
|
{
|
||||||
variants: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
||||||
secondary:
|
secondary:
|
||||||
"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
||||||
destructive:
|
destructive:
|
||||||
"bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90",
|
"bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90",
|
||||||
outline:
|
outline:
|
||||||
"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
||||||
},
|
ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
||||||
},
|
link: "text-primary underline-offset-4 [a&]:hover:underline",
|
||||||
defaultVariants: {
|
},
|
||||||
variant: "default",
|
},
|
||||||
},
|
defaultVariants: {
|
||||||
}
|
variant: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
function Badge({
|
function Badge({
|
||||||
className,
|
className,
|
||||||
variant = "default",
|
variant = "default",
|
||||||
asChild = false,
|
asChild = false,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<"span"> &
|
}: React.ComponentProps<"span"> &
|
||||||
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
||||||
const Comp = asChild ? Slot.Root : "span"
|
const Comp = asChild ? Slot.Root : "span"
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Comp
|
<Comp
|
||||||
data-slot="badge"
|
data-slot="badge"
|
||||||
data-variant={variant}
|
data-variant={variant}
|
||||||
className={cn(badgeVariants({ variant }), className)}
|
className={cn(badgeVariants({ variant }), className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Badge, badgeVariants }
|
export { Badge, badgeVariants }
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
import { cn } from "./utils"
|
||||||
|
import { Slot } from "radix-ui"
|
||||||
|
|
||||||
|
import { Separator } from "./separator.tsx"
|
||||||
|
|
||||||
|
const buttonGroupVariants = cva(
|
||||||
|
"flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
orientation: {
|
||||||
|
horizontal:
|
||||||
|
"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
||||||
|
vertical:
|
||||||
|
"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
orientation: "horizontal",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function ButtonGroup({
|
||||||
|
className,
|
||||||
|
orientation,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
role="group"
|
||||||
|
data-slot="button-group"
|
||||||
|
data-orientation={orientation}
|
||||||
|
className={cn(buttonGroupVariants({ orientation }), className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ButtonGroupText({
|
||||||
|
className,
|
||||||
|
asChild = false,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"div"> & {
|
||||||
|
asChild?: boolean
|
||||||
|
}) {
|
||||||
|
const Comp = asChild ? Slot.Root : "div"
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Comp
|
||||||
|
className={cn(
|
||||||
|
"flex items-center gap-2 rounded-md border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ButtonGroupSeparator({
|
||||||
|
className,
|
||||||
|
orientation = "vertical",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof Separator>) {
|
||||||
|
return (
|
||||||
|
<Separator
|
||||||
|
data-slot="button-group-separator"
|
||||||
|
orientation={orientation}
|
||||||
|
className={cn(
|
||||||
|
"relative m-0! self-stretch bg-input data-[orientation=vertical]:h-auto",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
ButtonGroup,
|
||||||
|
ButtonGroupSeparator,
|
||||||
|
ButtonGroupText,
|
||||||
|
buttonGroupVariants,
|
||||||
|
}
|
||||||
+54
-61
@@ -3,74 +3,67 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
import { Slot } from "radix-ui"
|
import { Slot } from "radix-ui"
|
||||||
|
|
||||||
/**
|
|
||||||
* Vendored shadcn/ui button, trimmed to the task page's real inventory.
|
|
||||||
*
|
|
||||||
* Removed from upstream (`new-york`): the `link` variant and the `xs` / `lg` /
|
|
||||||
* `icon-xs` / `icon-sm` / `icon-lg` sizes. The page's control heights are 28 px
|
|
||||||
* (`sm`), 36 px (`default`) and the square 36 px icon button; every removed
|
|
||||||
* class still lived in this runtime object and would have shipped in the bundle.
|
|
||||||
*/
|
|
||||||
const buttonVariants = cva(
|
const buttonVariants = cva(
|
||||||
// LOCAL ADAPTATION: `transition-all` narrowed to the same property list the
|
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
// page's other vendored controls use (see ui/toggle.tsx) — `all` also
|
{
|
||||||
// animates layout/size changes, which makes resizes and mount transitions
|
variants: {
|
||||||
// laggy on a dense task page.
|
variant: {
|
||||||
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
||||||
{
|
destructive:
|
||||||
variants: {
|
"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 ",
|
||||||
variant: {
|
outline:
|
||||||
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground ",
|
||||||
destructive:
|
secondary:
|
||||||
"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20",
|
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||||
outline:
|
ghost:
|
||||||
"border bg-background hover:bg-accent hover:text-accent-foreground",
|
"hover:bg-accent hover:text-accent-foreground ",
|
||||||
secondary:
|
link: "text-primary underline-offset-4 hover:underline",
|
||||||
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
},
|
||||||
ghost: "hover:bg-accent hover:text-accent-foreground",
|
size: {
|
||||||
},
|
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
||||||
size: {
|
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
||||||
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
||||||
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
||||||
icon: "size-9",
|
icon: "size-9",
|
||||||
},
|
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
||||||
},
|
"icon-sm": "size-8",
|
||||||
defaultVariants: {
|
"icon-lg": "size-10",
|
||||||
variant: "default",
|
},
|
||||||
size: "default",
|
},
|
||||||
},
|
defaultVariants: {
|
||||||
}
|
variant: "default",
|
||||||
|
size: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LOCAL ADAPTATION (dsh-better-sidebar): `React.forwardRef`, because this
|
* LOCAL ADAPTATION: `React.forwardRef`, because this plugin runs on the DSH
|
||||||
* plugin runs on the DSH host's React 18 (react@^18.2.0 — ref-as-prop is a
|
* host's React 18 (ref-as-prop is a React 19 feature). Without it
|
||||||
* React 19 feature). Without it, `<TooltipTrigger asChild><Button/></…>`
|
* `<TooltipTrigger asChild><Button/></TooltipTrigger>` cannot measure its
|
||||||
* cannot measure its anchor: radix's `Slot` hands the child a ref and a plain
|
* anchor: radix's `Slot` hands the child a ref and a plain function component
|
||||||
* function component drops it (dev builds warn, production silently
|
* drops it (dev builds warn, production silently mis-positions the floating
|
||||||
* mis-positions the floating layer). Upstream ships no forwardRef because the
|
* layer). The registry targets React 19 and ships no forwardRef, so a
|
||||||
* registry targets React 19; the shadcn CLI `--diff` flow will try to remove
|
* `shadcn add --overwrite` refresh must re-apply this.
|
||||||
* it — re-apply this adaptation when updating the file.
|
|
||||||
*/
|
*/
|
||||||
const Button = React.forwardRef<
|
const Button = React.forwardRef<
|
||||||
HTMLButtonElement,
|
HTMLButtonElement,
|
||||||
React.ComponentProps<"button"> &
|
React.ComponentProps<"button"> &
|
||||||
VariantProps<typeof buttonVariants> & {
|
VariantProps<typeof buttonVariants> & {
|
||||||
asChild?: boolean
|
asChild?: boolean
|
||||||
}
|
}
|
||||||
>(function Button({ className, variant = "default", size = "default", asChild = false, ...props }, ref) {
|
>(function Button({ className, variant = "default", size = "default", asChild = false, ...props }, ref) {
|
||||||
const Comp = asChild ? Slot.Root : "button"
|
const Comp = asChild ? Slot.Root : "button"
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Comp
|
<Comp
|
||||||
ref={ref}
|
ref={ref}
|
||||||
data-slot="button"
|
data-slot="button"
|
||||||
data-variant={variant}
|
data-variant={variant}
|
||||||
data-size={size}
|
data-size={size}
|
||||||
className={cn(buttonVariants({ variant, size, className }))}
|
className={cn(buttonVariants({ variant, size, className }))}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export { Button, buttonVariants }
|
export { Button, buttonVariants }
|
||||||
+65
-65
@@ -2,90 +2,90 @@ import * as React from "react"
|
|||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
|
|
||||||
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="card"
|
data-slot="card"
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground",
|
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="card-header"
|
data-slot="card-header"
|
||||||
className={cn(
|
className={cn(
|
||||||
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="card-title"
|
data-slot="card-title"
|
||||||
className={cn("leading-none font-semibold", className)}
|
className={cn("leading-none font-semibold", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="card-description"
|
data-slot="card-description"
|
||||||
className={cn("text-sm text-muted-foreground", className)}
|
className={cn("text-sm text-muted-foreground", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="card-action"
|
data-slot="card-action"
|
||||||
className={cn(
|
className={cn(
|
||||||
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="card-content"
|
data-slot="card-content"
|
||||||
className={cn("px-6", className)}
|
className={cn("px-6", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="card-footer"
|
data-slot="card-footer"
|
||||||
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Card,
|
Card,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardFooter,
|
CardFooter,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
CardAction,
|
CardAction,
|
||||||
CardDescription,
|
CardDescription,
|
||||||
CardContent,
|
CardContent,
|
||||||
}
|
}
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
import { Collapsible as CollapsiblePrimitive } from "radix-ui"
|
import { Collapsible as CollapsiblePrimitive } from "radix-ui"
|
||||||
|
|
||||||
function Collapsible({
|
function Collapsible({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
||||||
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
function CollapsibleTrigger({
|
function CollapsibleTrigger({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
||||||
return (
|
return (
|
||||||
<CollapsiblePrimitive.CollapsibleTrigger
|
<CollapsiblePrimitive.CollapsibleTrigger
|
||||||
data-slot="collapsible-trigger"
|
data-slot="collapsible-trigger"
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function CollapsibleContent({
|
function CollapsibleContent({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
||||||
return (
|
return (
|
||||||
<CollapsiblePrimitive.CollapsibleContent
|
<CollapsiblePrimitive.CollapsibleContent
|
||||||
data-slot="collapsible-content"
|
data-slot="collapsible-content"
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
||||||
+201
-131
@@ -1,184 +1,254 @@
|
|||||||
/**
|
|
||||||
* Vendored shadcn/ui dropdown menu, trimmed to the task page's real inventory.
|
|
||||||
*
|
|
||||||
* Removed from upstream (`new-york`): `DropdownMenuCheckboxItem`,
|
|
||||||
* `DropdownMenuRadioGroup`, `DropdownMenuRadioItem` and `DropdownMenuShortcut`
|
|
||||||
* (no checkbox/radio/shortcut rows exist on the page). `DropdownMenuSub` and its
|
|
||||||
* trigger/content stay — the node menu's "reassign owner" is a submenu.
|
|
||||||
*
|
|
||||||
* The submenu arrow is the host's `IconChevronRightOutline14`, so the file
|
|
||||||
* imports no icon library of its own.
|
|
||||||
*/
|
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import { IconChevronRightOutline14 } from "@deepseek-ai/dsh-client-ui-primitives"
|
|
||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
|
||||||
|
import { IconCheckOutline16, IconChevronRightOutline14 } from "@deepseek-ai/dsh-client-ui-primitives"
|
||||||
|
|
||||||
function DropdownMenu({
|
function DropdownMenu({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
||||||
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuPortal({
|
function DropdownMenuPortal({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuTrigger({
|
function DropdownMenuTrigger({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuPrimitive.Trigger
|
<DropdownMenuPrimitive.Trigger
|
||||||
data-slot="dropdown-menu-trigger"
|
data-slot="dropdown-menu-trigger"
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuContent({
|
function DropdownMenuContent({
|
||||||
className,
|
className,
|
||||||
sideOffset = 4,
|
sideOffset = 4,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuPrimitive.Portal>
|
<DropdownMenuPrimitive.Portal>
|
||||||
<DropdownMenuPrimitive.Content
|
<DropdownMenuPrimitive.Content
|
||||||
data-slot="dropdown-menu-content"
|
data-slot="dropdown-menu-content"
|
||||||
sideOffset={sideOffset}
|
sideOffset={sideOffset}
|
||||||
className={cn(
|
className={cn(
|
||||||
"z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
"z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]: data-[side=left]: data-[side=right]: data-[side=top]: data-[state=closed]: data-[state=closed]: data-[state=closed]: data-[state=open]: data-[state=open]: data-[state=open]:",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
</DropdownMenuPrimitive.Portal>
|
</DropdownMenuPrimitive.Portal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuGroup({
|
function DropdownMenuGroup({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuItem({
|
function DropdownMenuItem({
|
||||||
className,
|
className,
|
||||||
inset,
|
inset,
|
||||||
variant = "default",
|
variant = "default",
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
||||||
inset?: boolean
|
inset?: boolean
|
||||||
variant?: "default" | "destructive"
|
variant?: "default" | "destructive"
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuPrimitive.Item
|
<DropdownMenuPrimitive.Item
|
||||||
data-slot="dropdown-menu-item"
|
data-slot="dropdown-menu-item"
|
||||||
data-inset={inset}
|
data-inset={inset}
|
||||||
data-variant={variant}
|
data-variant={variant}
|
||||||
className={cn(
|
className={cn(
|
||||||
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
|
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function DropdownMenuCheckboxItem({
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
checked,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
||||||
|
return (
|
||||||
|
<DropdownMenuPrimitive.CheckboxItem
|
||||||
|
data-slot="dropdown-menu-checkbox-item"
|
||||||
|
className={cn(
|
||||||
|
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
checked={checked}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
||||||
|
<DropdownMenuPrimitive.ItemIndicator>
|
||||||
|
<IconCheckOutline16 className="size-4" />
|
||||||
|
</DropdownMenuPrimitive.ItemIndicator>
|
||||||
|
</span>
|
||||||
|
{children}
|
||||||
|
</DropdownMenuPrimitive.CheckboxItem>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function DropdownMenuRadioGroup({
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
||||||
|
return (
|
||||||
|
<DropdownMenuPrimitive.RadioGroup
|
||||||
|
data-slot="dropdown-menu-radio-group"
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function DropdownMenuRadioItem({
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
||||||
|
return (
|
||||||
|
<DropdownMenuPrimitive.RadioItem
|
||||||
|
data-slot="dropdown-menu-radio-item"
|
||||||
|
className={cn(
|
||||||
|
"relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
||||||
|
<DropdownMenuPrimitive.ItemIndicator>
|
||||||
|
<span className="size-2 rounded-full bg-current" />
|
||||||
|
</DropdownMenuPrimitive.ItemIndicator>
|
||||||
|
</span>
|
||||||
|
{children}
|
||||||
|
</DropdownMenuPrimitive.RadioItem>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuLabel({
|
function DropdownMenuLabel({
|
||||||
className,
|
className,
|
||||||
inset,
|
inset,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
||||||
inset?: boolean
|
inset?: boolean
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuPrimitive.Label
|
<DropdownMenuPrimitive.Label
|
||||||
data-slot="dropdown-menu-label"
|
data-slot="dropdown-menu-label"
|
||||||
data-inset={inset}
|
data-inset={inset}
|
||||||
className={cn(
|
className={cn(
|
||||||
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuSeparator({
|
function DropdownMenuSeparator({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuPrimitive.Separator
|
<DropdownMenuPrimitive.Separator
|
||||||
data-slot="dropdown-menu-separator"
|
data-slot="dropdown-menu-separator"
|
||||||
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function DropdownMenuShortcut({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"span">) {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
data-slot="dropdown-menu-shortcut"
|
||||||
|
className={cn(
|
||||||
|
"ml-auto text-xs tracking-widest text-muted-foreground",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuSub({
|
function DropdownMenuSub({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
||||||
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
|
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuSubTrigger({
|
function DropdownMenuSubTrigger({
|
||||||
className,
|
className,
|
||||||
inset,
|
inset,
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
||||||
inset?: boolean
|
inset?: boolean
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuPrimitive.SubTrigger
|
<DropdownMenuPrimitive.SubTrigger
|
||||||
data-slot="dropdown-menu-sub-trigger"
|
data-slot="dropdown-menu-sub-trigger"
|
||||||
data-inset={inset}
|
data-inset={inset}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
<IconChevronRightOutline14 size={16} className="ml-auto" />
|
<IconChevronRightOutline14 className="ml-auto size-4" />
|
||||||
</DropdownMenuPrimitive.SubTrigger>
|
</DropdownMenuPrimitive.SubTrigger>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DropdownMenuSubContent({
|
function DropdownMenuSubContent({
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
||||||
return (
|
return (
|
||||||
<DropdownMenuPrimitive.SubContent
|
<DropdownMenuPrimitive.SubContent
|
||||||
data-slot="dropdown-menu-sub-content"
|
data-slot="dropdown-menu-sub-content"
|
||||||
className={cn(
|
className={cn(
|
||||||
"z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
"z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]: data-[side=left]: data-[side=right]: data-[side=top]: data-[state=closed]: data-[state=closed]: data-[state=closed]: data-[state=open]: data-[state=open]: data-[state=open]:",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuPortal,
|
DropdownMenuPortal,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
DropdownMenuGroup,
|
DropdownMenuGroup,
|
||||||
DropdownMenuLabel,
|
DropdownMenuLabel,
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuSeparator,
|
DropdownMenuCheckboxItem,
|
||||||
DropdownMenuSub,
|
DropdownMenuRadioGroup,
|
||||||
DropdownMenuSubTrigger,
|
DropdownMenuRadioItem,
|
||||||
DropdownMenuSubContent,
|
DropdownMenuSeparator,
|
||||||
|
DropdownMenuShortcut,
|
||||||
|
DropdownMenuSub,
|
||||||
|
DropdownMenuSubTrigger,
|
||||||
|
DropdownMenuSubContent,
|
||||||
}
|
}
|
||||||
+76
-76
@@ -2,102 +2,102 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
|
|
||||||
function Empty({ className, ...props }: React.ComponentProps<"div">) {
|
function Empty({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="empty"
|
data-slot="empty"
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",
|
"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
|
function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="empty-header"
|
data-slot="empty-header"
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex max-w-sm flex-col items-center gap-2 text-center",
|
"flex max-w-sm flex-col items-center gap-2 text-center",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const emptyMediaVariants = cva(
|
const emptyMediaVariants = cva(
|
||||||
"mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
"mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||||
{
|
{
|
||||||
variants: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
default: "bg-transparent",
|
default: "bg-transparent",
|
||||||
icon: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6",
|
icon: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
variant: "default",
|
variant: "default",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
function EmptyMedia({
|
function EmptyMedia({
|
||||||
className,
|
className,
|
||||||
variant = "default",
|
variant = "default",
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {
|
}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="empty-icon"
|
data-slot="empty-icon"
|
||||||
data-variant={variant}
|
data-variant={variant}
|
||||||
className={cn(emptyMediaVariants({ variant, className }))}
|
className={cn(emptyMediaVariants({ variant, className }))}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
|
function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="empty-title"
|
data-slot="empty-title"
|
||||||
className={cn("text-lg font-medium tracking-tight", className)}
|
className={cn("text-lg font-medium tracking-tight", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
|
function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="empty-description"
|
data-slot="empty-description"
|
||||||
className={cn(
|
className={cn(
|
||||||
"text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
"text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
|
function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="empty-content"
|
data-slot="empty-content"
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",
|
"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Empty,
|
Empty,
|
||||||
EmptyHeader,
|
EmptyHeader,
|
||||||
EmptyTitle,
|
EmptyTitle,
|
||||||
EmptyDescription,
|
EmptyDescription,
|
||||||
EmptyContent,
|
EmptyContent,
|
||||||
EmptyMedia,
|
EmptyMedia,
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
import { useMemo } from "react"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
import { cn } from "./utils"
|
||||||
|
|
||||||
|
import { Label } from "./label.tsx"
|
||||||
|
import { Separator } from "./separator.tsx"
|
||||||
|
|
||||||
|
function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
|
||||||
|
return (
|
||||||
|
<fieldset
|
||||||
|
data-slot="field-set"
|
||||||
|
className={cn(
|
||||||
|
"flex flex-col gap-6",
|
||||||
|
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function FieldLegend({
|
||||||
|
className,
|
||||||
|
variant = "legend",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
|
||||||
|
return (
|
||||||
|
<legend
|
||||||
|
data-slot="field-legend"
|
||||||
|
data-variant={variant}
|
||||||
|
className={cn(
|
||||||
|
"mb-3 font-medium",
|
||||||
|
"data-[variant=legend]:text-base",
|
||||||
|
"data-[variant=label]:text-sm",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="field-group"
|
||||||
|
className={cn(
|
||||||
|
"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldVariants = cva(
|
||||||
|
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
orientation: {
|
||||||
|
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
||||||
|
horizontal: [
|
||||||
|
"flex-row items-center",
|
||||||
|
"[&>[data-slot=field-label]]:flex-auto",
|
||||||
|
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
||||||
|
],
|
||||||
|
responsive: [
|
||||||
|
"flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto",
|
||||||
|
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
||||||
|
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
orientation: "vertical",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function Field({
|
||||||
|
className,
|
||||||
|
orientation = "vertical",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
role="group"
|
||||||
|
data-slot="field"
|
||||||
|
data-orientation={orientation}
|
||||||
|
className={cn(fieldVariants({ orientation }), className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="field-content"
|
||||||
|
className={cn(
|
||||||
|
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function FieldLabel({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof Label>) {
|
||||||
|
return (
|
||||||
|
<Label
|
||||||
|
data-slot="field-label"
|
||||||
|
className={cn(
|
||||||
|
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
||||||
|
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4",
|
||||||
|
"has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 ",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="field-label"
|
||||||
|
className={cn(
|
||||||
|
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
|
||||||
|
return (
|
||||||
|
<p
|
||||||
|
data-slot="field-description"
|
||||||
|
className={cn(
|
||||||
|
"text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance",
|
||||||
|
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
||||||
|
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function FieldSeparator({
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"div"> & {
|
||||||
|
children?: React.ReactNode
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="field-separator"
|
||||||
|
data-content={!!children}
|
||||||
|
className={cn(
|
||||||
|
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<Separator className="absolute inset-0 top-1/2" />
|
||||||
|
{children && (
|
||||||
|
<span
|
||||||
|
className="relative mx-auto block w-fit bg-background px-2 text-muted-foreground"
|
||||||
|
data-slot="field-separator-content"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function FieldError({
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
errors,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"div"> & {
|
||||||
|
errors?: Array<{ message?: string } | undefined>
|
||||||
|
}) {
|
||||||
|
const content = useMemo(() => {
|
||||||
|
if (children) {
|
||||||
|
return children
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!errors?.length) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const uniqueErrors = [
|
||||||
|
...new Map(errors.map((error) => [error?.message, error])).values(),
|
||||||
|
]
|
||||||
|
|
||||||
|
if (uniqueErrors?.length == 1) {
|
||||||
|
return uniqueErrors[0]?.message
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ul className="ml-4 flex list-disc flex-col gap-1">
|
||||||
|
{uniqueErrors.map(
|
||||||
|
(error, index) =>
|
||||||
|
error?.message && <li key={index}>{error.message}</li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
)
|
||||||
|
}, [children, errors])
|
||||||
|
|
||||||
|
if (!content) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
role="alert"
|
||||||
|
data-slot="field-error"
|
||||||
|
className={cn("text-sm font-normal text-destructive", className)}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
Field,
|
||||||
|
FieldLabel,
|
||||||
|
FieldDescription,
|
||||||
|
FieldError,
|
||||||
|
FieldGroup,
|
||||||
|
FieldLegend,
|
||||||
|
FieldSeparator,
|
||||||
|
FieldSet,
|
||||||
|
FieldContent,
|
||||||
|
FieldTitle,
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
import { cn } from "./utils"
|
||||||
|
|
||||||
|
import { Button } from "./button.tsx"
|
||||||
|
import { Input } from "./input.tsx"
|
||||||
|
import { Textarea } from "./textarea.tsx"
|
||||||
|
|
||||||
|
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="input-group"
|
||||||
|
role="group"
|
||||||
|
className={cn(
|
||||||
|
"group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none ",
|
||||||
|
"h-9 min-w-0 has-[>textarea]:h-auto",
|
||||||
|
|
||||||
|
// Variants based on alignment.
|
||||||
|
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
||||||
|
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
||||||
|
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
|
||||||
|
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
||||||
|
|
||||||
|
// Focus state.
|
||||||
|
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50",
|
||||||
|
|
||||||
|
// Error state.
|
||||||
|
"has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 ",
|
||||||
|
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const inputGroupAddonVariants = cva(
|
||||||
|
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
align: {
|
||||||
|
"inline-start":
|
||||||
|
"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
||||||
|
"inline-end":
|
||||||
|
"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
||||||
|
"block-start":
|
||||||
|
"order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3",
|
||||||
|
"block-end":
|
||||||
|
"order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
align: "inline-start",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function InputGroupAddon({
|
||||||
|
className,
|
||||||
|
align = "inline-start",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
role="group"
|
||||||
|
data-slot="input-group-addon"
|
||||||
|
data-align={align}
|
||||||
|
className={cn(inputGroupAddonVariants({ align }), className)}
|
||||||
|
onClick={(e) => {
|
||||||
|
if ((e.target as HTMLElement).closest("button")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
e.currentTarget.parentElement?.querySelector("input")?.focus()
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const inputGroupButtonVariants = cva(
|
||||||
|
"flex items-center gap-2 text-sm shadow-none",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
size: {
|
||||||
|
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
|
||||||
|
sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
|
||||||
|
"icon-xs":
|
||||||
|
"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
||||||
|
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
size: "xs",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function InputGroupButton({
|
||||||
|
className,
|
||||||
|
type = "button",
|
||||||
|
variant = "ghost",
|
||||||
|
size = "xs",
|
||||||
|
...props
|
||||||
|
}: Omit<React.ComponentProps<typeof Button>, "size"> &
|
||||||
|
VariantProps<typeof inputGroupButtonVariants>) {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
type={type}
|
||||||
|
data-size={size}
|
||||||
|
variant={variant}
|
||||||
|
className={cn(inputGroupButtonVariants({ size }), className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function InputGroupInput({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"input">) {
|
||||||
|
return (
|
||||||
|
<Input
|
||||||
|
data-slot="input-group-control"
|
||||||
|
className={cn(
|
||||||
|
"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 ",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function InputGroupTextarea({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"textarea">) {
|
||||||
|
return (
|
||||||
|
<Textarea
|
||||||
|
data-slot="input-group-control"
|
||||||
|
className={cn(
|
||||||
|
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 ",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
InputGroup,
|
||||||
|
InputGroupAddon,
|
||||||
|
InputGroupButton,
|
||||||
|
InputGroupText,
|
||||||
|
InputGroupInput,
|
||||||
|
InputGroupTextarea,
|
||||||
|
}
|
||||||
+13
-26
@@ -1,33 +1,20 @@
|
|||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
|
|
||||||
/**
|
|
||||||
* Vendored shadcn/ui input, minus upstream's `file:` variant utilities
|
|
||||||
* (`file:inline-flex` `file:h-7` `file:border-0` `file:bg-transparent`
|
|
||||||
* `file:text-sm` `file:font-medium` `file:text-foreground`).
|
|
||||||
*
|
|
||||||
* Two reasons, and both are load-bearing: the plugin has no `<input
|
|
||||||
* type="file">` surface, so they are dead class strings in a runtime object;
|
|
||||||
* and they compile to `::file-selector-button` selectors, which is also
|
|
||||||
* Tailwind preflight's signature — `tests/ui-foundation.spec.ts` uses that
|
|
||||||
* string to prove the reset never ships (plugin CSS is a global `<style>`, so a
|
|
||||||
* reset would repaint the whole DSH page), and the file-input variant would
|
|
||||||
* trip that guard forever. Nothing else on the element changes.
|
|
||||||
*/
|
|
||||||
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
type={type}
|
type={type}
|
||||||
data-slot="input"
|
data-slot="input"
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm ",
|
||||||
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
||||||
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 ",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Input }
|
export { Input }
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority"
|
||||||
|
import { cn } from "./utils"
|
||||||
|
import { Slot } from "radix-ui"
|
||||||
|
|
||||||
|
import { Separator } from "./separator.tsx"
|
||||||
|
|
||||||
|
function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
role="list"
|
||||||
|
data-slot="item-group"
|
||||||
|
className={cn("group/item-group flex flex-col", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ItemSeparator({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof Separator>) {
|
||||||
|
return (
|
||||||
|
<Separator
|
||||||
|
data-slot="item-separator"
|
||||||
|
orientation="horizontal"
|
||||||
|
className={cn("my-0", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemVariants = cva(
|
||||||
|
"group/item flex flex-wrap items-center rounded-md border border-transparent text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-accent/50",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default: "bg-transparent",
|
||||||
|
outline: "border-border",
|
||||||
|
muted: "bg-muted/50",
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
default: "gap-4 p-4",
|
||||||
|
sm: "gap-2.5 px-4 py-3",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
size: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function Item({
|
||||||
|
className,
|
||||||
|
variant = "default",
|
||||||
|
size = "default",
|
||||||
|
asChild = false,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"div"> &
|
||||||
|
VariantProps<typeof itemVariants> & { asChild?: boolean }) {
|
||||||
|
const Comp = asChild ? Slot.Root : "div"
|
||||||
|
return (
|
||||||
|
<Comp
|
||||||
|
data-slot="item"
|
||||||
|
data-variant={variant}
|
||||||
|
data-size={size}
|
||||||
|
className={cn(itemVariants({ variant, size, className }))}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemMediaVariants = cva(
|
||||||
|
"flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default: "bg-transparent",
|
||||||
|
icon: "size-8 rounded-sm border bg-muted [&_svg:not([class*='size-'])]:size-4",
|
||||||
|
image:
|
||||||
|
"size-10 overflow-hidden rounded-sm [&_img]:size-full [&_img]:object-cover",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function ItemMedia({
|
||||||
|
className,
|
||||||
|
variant = "default",
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="item-media"
|
||||||
|
data-variant={variant}
|
||||||
|
className={cn(itemMediaVariants({ variant, className }))}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="item-content"
|
||||||
|
className={cn(
|
||||||
|
"flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="item-title"
|
||||||
|
className={cn(
|
||||||
|
"flex w-fit items-center gap-2 text-sm leading-snug font-medium",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
|
||||||
|
return (
|
||||||
|
<p
|
||||||
|
data-slot="item-description"
|
||||||
|
className={cn(
|
||||||
|
"line-clamp-2 text-sm leading-normal font-normal text-balance text-muted-foreground",
|
||||||
|
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="item-actions"
|
||||||
|
className={cn("flex items-center gap-2", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="item-header"
|
||||||
|
className={cn(
|
||||||
|
"flex basis-full items-center justify-between gap-2",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="item-footer"
|
||||||
|
className={cn(
|
||||||
|
"flex basis-full items-center justify-between gap-2",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
Item,
|
||||||
|
ItemMedia,
|
||||||
|
ItemContent,
|
||||||
|
ItemActions,
|
||||||
|
ItemGroup,
|
||||||
|
ItemSeparator,
|
||||||
|
ItemTitle,
|
||||||
|
ItemDescription,
|
||||||
|
ItemHeader,
|
||||||
|
ItemFooter,
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cn } from "./utils"
|
||||||
|
import { Label as LabelPrimitive } from "radix-ui"
|
||||||
|
|
||||||
|
function Label({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
||||||
|
return (
|
||||||
|
<LabelPrimitive.Root
|
||||||
|
data-slot="label"
|
||||||
|
className={cn(
|
||||||
|
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Label }
|
||||||
+66
-25
@@ -3,43 +3,84 @@ import { cn } from "./utils"
|
|||||||
import { Popover as PopoverPrimitive } from "radix-ui"
|
import { Popover as PopoverPrimitive } from "radix-ui"
|
||||||
|
|
||||||
function Popover({
|
function Popover({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
||||||
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
function PopoverTrigger({
|
function PopoverTrigger({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
||||||
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
function PopoverContent({
|
function PopoverContent({
|
||||||
className,
|
className,
|
||||||
align = "center",
|
align = "center",
|
||||||
sideOffset = 4,
|
sideOffset = 4,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
||||||
return (
|
return (
|
||||||
<PopoverPrimitive.Portal>
|
<PopoverPrimitive.Portal>
|
||||||
<PopoverPrimitive.Content
|
<PopoverPrimitive.Content
|
||||||
data-slot="popover-content"
|
data-slot="popover-content"
|
||||||
align={align}
|
align={align}
|
||||||
sideOffset={sideOffset}
|
sideOffset={sideOffset}
|
||||||
className={cn(
|
className={cn(
|
||||||
"z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
"z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]: data-[side=left]: data-[side=right]: data-[side=top]: data-[state=closed]: data-[state=closed]: data-[state=closed]: data-[state=open]: data-[state=open]: data-[state=open]:",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
</PopoverPrimitive.Portal>
|
</PopoverPrimitive.Portal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function PopoverAnchor({
|
function PopoverAnchor({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
||||||
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
|
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
|
function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="popover-header"
|
||||||
|
className={cn("flex flex-col gap-1 text-sm", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="popover-title"
|
||||||
|
className={cn("font-medium", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function PopoverDescription({
|
||||||
|
className,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<"p">) {
|
||||||
|
return (
|
||||||
|
<p
|
||||||
|
data-slot="popover-description"
|
||||||
|
className={cn("text-muted-foreground", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
Popover,
|
||||||
|
PopoverTrigger,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverAnchor,
|
||||||
|
PopoverHeader,
|
||||||
|
PopoverTitle,
|
||||||
|
PopoverDescription,
|
||||||
|
}
|
||||||
@@ -3,53 +3,53 @@ import { cn } from "./utils"
|
|||||||
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
|
import { ScrollArea as ScrollAreaPrimitive } from "radix-ui"
|
||||||
|
|
||||||
function ScrollArea({
|
function ScrollArea({
|
||||||
className,
|
className,
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
||||||
return (
|
return (
|
||||||
<ScrollAreaPrimitive.Root
|
<ScrollAreaPrimitive.Root
|
||||||
data-slot="scroll-area"
|
data-slot="scroll-area"
|
||||||
className={cn("relative", className)}
|
className={cn("relative", className)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<ScrollAreaPrimitive.Viewport
|
<ScrollAreaPrimitive.Viewport
|
||||||
data-slot="scroll-area-viewport"
|
data-slot="scroll-area-viewport"
|
||||||
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
|
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</ScrollAreaPrimitive.Viewport>
|
</ScrollAreaPrimitive.Viewport>
|
||||||
<ScrollBar />
|
<ScrollBar />
|
||||||
<ScrollAreaPrimitive.Corner />
|
<ScrollAreaPrimitive.Corner />
|
||||||
</ScrollAreaPrimitive.Root>
|
</ScrollAreaPrimitive.Root>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScrollBar({
|
function ScrollBar({
|
||||||
className,
|
className,
|
||||||
orientation = "vertical",
|
orientation = "vertical",
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
||||||
return (
|
return (
|
||||||
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
||||||
data-slot="scroll-area-scrollbar"
|
data-slot="scroll-area-scrollbar"
|
||||||
orientation={orientation}
|
orientation={orientation}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex touch-none p-px transition-colors select-none",
|
"flex touch-none p-px transition-colors select-none",
|
||||||
orientation === "vertical" &&
|
orientation === "vertical" &&
|
||||||
"h-full w-2.5 border-l border-l-transparent",
|
"h-full w-2.5 border-l border-l-transparent",
|
||||||
orientation === "horizontal" &&
|
orientation === "horizontal" &&
|
||||||
"h-2.5 flex-col border-t border-t-transparent",
|
"h-2.5 flex-col border-t border-t-transparent",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<ScrollAreaPrimitive.ScrollAreaThumb
|
<ScrollAreaPrimitive.ScrollAreaThumb
|
||||||
data-slot="scroll-area-thumb"
|
data-slot="scroll-area-thumb"
|
||||||
className="relative flex-1 rounded-full bg-border"
|
className="relative flex-1 rounded-full bg-border"
|
||||||
/>
|
/>
|
||||||
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { ScrollArea, ScrollBar }
|
export { ScrollArea, ScrollBar }
|
||||||
+16
-16
@@ -3,23 +3,23 @@ import { cn } from "./utils"
|
|||||||
import { Separator as SeparatorPrimitive } from "radix-ui"
|
import { Separator as SeparatorPrimitive } from "radix-ui"
|
||||||
|
|
||||||
function Separator({
|
function Separator({
|
||||||
className,
|
className,
|
||||||
orientation = "horizontal",
|
orientation = "horizontal",
|
||||||
decorative = true,
|
decorative = true,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
||||||
return (
|
return (
|
||||||
<SeparatorPrimitive.Root
|
<SeparatorPrimitive.Root
|
||||||
data-slot="separator"
|
data-slot="separator"
|
||||||
decorative={decorative}
|
decorative={decorative}
|
||||||
orientation={orientation}
|
orientation={orientation}
|
||||||
className={cn(
|
className={cn(
|
||||||
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Separator }
|
export { Separator }
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
|
|
||||||
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-slot="skeleton"
|
data-slot="skeleton"
|
||||||
className={cn("animate-pulse rounded-md bg-accent", className)}
|
className={cn("animate-pulse rounded-md bg-accent", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Skeleton }
|
export { Skeleton }
|
||||||
@@ -2,28 +2,16 @@ import { IconLoadingOutline16 } from "@deepseek-ai/dsh-client-ui-primitives"
|
|||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loading indicator. The host supplies the glyph (`IconLoadingOutline16`), and
|
* Vendored shadcn `Spinner` with the icon swapped to the host's primitive set
|
||||||
* the rotation rides `animate-spin` on it — the host icons render an `svg`, so
|
* (the plugin never ships lucide). The host icons render their own `<svg>`, so
|
||||||
* the utility applies to the glyph box the same way it did upstream.
|
* the props land on a wrapping span instead of the svg element.
|
||||||
*
|
|
||||||
* Upstream took `React.ComponentProps<"svg">`; host icons expose exactly
|
|
||||||
* `size` / `className`, so the accessible status wrapper moved out one level
|
|
||||||
* instead of being spread onto the glyph.
|
|
||||||
*/
|
*/
|
||||||
function Spinner({
|
function Spinner({ className, ...props }: React.ComponentProps<"span">) {
|
||||||
className,
|
return (
|
||||||
size = 16,
|
<span role="status" aria-label="Loading" className={cn("inline-flex", className)} {...props}>
|
||||||
label = "Loading",
|
<IconLoadingOutline16 className="size-4 animate-spin" />
|
||||||
}: {
|
</span>
|
||||||
className?: string
|
)
|
||||||
size?: number
|
|
||||||
label?: string
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<span role="status" aria-label={label} className="inline-flex">
|
|
||||||
<IconLoadingOutline16 size={size} className={cn("animate-spin", className)} />
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Spinner }
|
export { Spinner }
|
||||||
+10
-10
@@ -2,16 +2,16 @@ import * as React from "react"
|
|||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
|
|
||||||
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
||||||
return (
|
return (
|
||||||
<textarea
|
<textarea
|
||||||
data-slot="textarea"
|
data-slot="textarea"
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm",
|
"flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm ",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Textarea }
|
export { Textarea }
|
||||||
@@ -3,79 +3,79 @@ import { type VariantProps } from "class-variance-authority"
|
|||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui"
|
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui"
|
||||||
|
|
||||||
import { toggleVariants } from "./toggle"
|
import { toggleVariants } from "./toggle.tsx"
|
||||||
|
|
||||||
const ToggleGroupContext = React.createContext<
|
const ToggleGroupContext = React.createContext<
|
||||||
VariantProps<typeof toggleVariants> & {
|
VariantProps<typeof toggleVariants> & {
|
||||||
spacing?: number
|
spacing?: number
|
||||||
}
|
}
|
||||||
>({
|
>({
|
||||||
size: "default",
|
size: "default",
|
||||||
variant: "default",
|
variant: "default",
|
||||||
spacing: 0,
|
spacing: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
function ToggleGroup({
|
function ToggleGroup({
|
||||||
className,
|
className,
|
||||||
variant,
|
variant,
|
||||||
size,
|
size,
|
||||||
spacing = 0,
|
spacing = 0,
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &
|
||||||
VariantProps<typeof toggleVariants> & {
|
VariantProps<typeof toggleVariants> & {
|
||||||
spacing?: number
|
spacing?: number
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<ToggleGroupPrimitive.Root
|
<ToggleGroupPrimitive.Root
|
||||||
data-slot="toggle-group"
|
data-slot="toggle-group"
|
||||||
data-variant={variant}
|
data-variant={variant}
|
||||||
data-size={size}
|
data-size={size}
|
||||||
data-spacing={spacing}
|
data-spacing={spacing}
|
||||||
style={{ "--gap": spacing } as React.CSSProperties}
|
style={{ "--gap": spacing } as React.CSSProperties}
|
||||||
className={cn(
|
className={cn(
|
||||||
"group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md",
|
"group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<ToggleGroupContext.Provider value={{ variant, size, spacing }}>
|
<ToggleGroupContext.Provider value={{ variant, size, spacing }}>
|
||||||
{children}
|
{children}
|
||||||
</ToggleGroupContext.Provider>
|
</ToggleGroupContext.Provider>
|
||||||
</ToggleGroupPrimitive.Root>
|
</ToggleGroupPrimitive.Root>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function ToggleGroupItem({
|
function ToggleGroupItem({
|
||||||
className,
|
className,
|
||||||
children,
|
children,
|
||||||
variant,
|
variant,
|
||||||
size,
|
size,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
|
}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &
|
||||||
VariantProps<typeof toggleVariants>) {
|
VariantProps<typeof toggleVariants>) {
|
||||||
const context = React.useContext(ToggleGroupContext)
|
const context = React.useContext(ToggleGroupContext)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ToggleGroupPrimitive.Item
|
<ToggleGroupPrimitive.Item
|
||||||
data-slot="toggle-group-item"
|
data-slot="toggle-group-item"
|
||||||
data-variant={context.variant || variant}
|
data-variant={context.variant || variant}
|
||||||
data-size={context.size || size}
|
data-size={context.size || size}
|
||||||
data-spacing={context.spacing}
|
data-spacing={context.spacing}
|
||||||
className={cn(
|
className={cn(
|
||||||
toggleVariants({
|
toggleVariants({
|
||||||
variant: context.variant || variant,
|
variant: context.variant || variant,
|
||||||
size: context.size || size,
|
size: context.size || size,
|
||||||
}),
|
}),
|
||||||
"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10",
|
"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10",
|
||||||
"data-[spacing=0]:rounded-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",
|
"data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</ToggleGroupPrimitive.Item>
|
</ToggleGroupPrimitive.Item>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { ToggleGroup, ToggleGroupItem }
|
export { ToggleGroup, ToggleGroupItem }
|
||||||
+31
-37
@@ -3,48 +3,42 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|||||||
import { cn } from "./utils"
|
import { cn } from "./utils"
|
||||||
import { Toggle as TogglePrimitive } from "radix-ui"
|
import { Toggle as TogglePrimitive } from "radix-ui"
|
||||||
|
|
||||||
/**
|
|
||||||
* Vendored shadcn/ui toggle, trimmed to the task page's real inventory.
|
|
||||||
*
|
|
||||||
* Removed from upstream (`new-york`): the `lg` size (the page's toggle heights
|
|
||||||
* top out at 36 px). `Toggle` itself stays — the view switcher's segmented
|
|
||||||
* control is built from it via `ToggleGroup`.
|
|
||||||
*/
|
|
||||||
const toggleVariants = cva(
|
const toggleVariants = cva(
|
||||||
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||||
{
|
{
|
||||||
variants: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
default: "bg-transparent",
|
default: "bg-transparent",
|
||||||
outline:
|
outline:
|
||||||
"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
|
"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
|
||||||
},
|
},
|
||||||
size: {
|
size: {
|
||||||
default: "h-9 min-w-9 px-2",
|
default: "h-9 min-w-9 px-2",
|
||||||
sm: "h-8 min-w-8 px-1.5",
|
sm: "h-8 min-w-8 px-1.5",
|
||||||
},
|
lg: "h-10 min-w-10 px-2.5",
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
},
|
||||||
variant: "default",
|
defaultVariants: {
|
||||||
size: "default",
|
variant: "default",
|
||||||
},
|
size: "default",
|
||||||
}
|
},
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
function Toggle({
|
function Toggle({
|
||||||
className,
|
className,
|
||||||
variant,
|
variant,
|
||||||
size,
|
size,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof TogglePrimitive.Root> &
|
}: React.ComponentProps<typeof TogglePrimitive.Root> &
|
||||||
VariantProps<typeof toggleVariants>) {
|
VariantProps<typeof toggleVariants>) {
|
||||||
return (
|
return (
|
||||||
<TogglePrimitive.Root
|
<TogglePrimitive.Root
|
||||||
data-slot="toggle"
|
data-slot="toggle"
|
||||||
className={cn(toggleVariants({ variant, size, className }))}
|
className={cn(toggleVariants({ variant, size, className }))}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Toggle, toggleVariants }
|
export { Toggle, toggleVariants }
|
||||||
+33
-33
@@ -3,52 +3,52 @@ import { cn } from "./utils"
|
|||||||
import { Tooltip as TooltipPrimitive } from "radix-ui"
|
import { Tooltip as TooltipPrimitive } from "radix-ui"
|
||||||
|
|
||||||
function TooltipProvider({
|
function TooltipProvider({
|
||||||
delayDuration = 0,
|
delayDuration = 0,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
||||||
return (
|
return (
|
||||||
<TooltipPrimitive.Provider
|
<TooltipPrimitive.Provider
|
||||||
data-slot="tooltip-provider"
|
data-slot="tooltip-provider"
|
||||||
delayDuration={delayDuration}
|
delayDuration={delayDuration}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Tooltip({
|
function Tooltip({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
||||||
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
function TooltipTrigger({
|
function TooltipTrigger({
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
||||||
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
function TooltipContent({
|
function TooltipContent({
|
||||||
className,
|
className,
|
||||||
sideOffset = 0,
|
sideOffset = 0,
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
||||||
return (
|
return (
|
||||||
<TooltipPrimitive.Portal>
|
<TooltipPrimitive.Portal>
|
||||||
<TooltipPrimitive.Content
|
<TooltipPrimitive.Content
|
||||||
data-slot="tooltip-content"
|
data-slot="tooltip-content"
|
||||||
sideOffset={sideOffset}
|
sideOffset={sideOffset}
|
||||||
className={cn(
|
className={cn(
|
||||||
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background data-[side=bottom]: data-[side=left]: data-[side=right]: data-[side=top]: data-[state=closed]: data-[state=closed]: data-[state=closed]:",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
||||||
</TooltipPrimitive.Content>
|
</TooltipPrimitive.Content>
|
||||||
</TooltipPrimitive.Portal>
|
</TooltipPrimitive.Portal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Static panels (cards, rows, the drawer) may carry the stock LIGHT shadows
|
* Static panels (cards, rows, the drawer) may carry the stock LIGHT shadows
|
||||||
* only — `shadow-xs` (button-like compact surfaces such as graph node cards)
|
* only — `shadow-xs` (button-like compact surfaces such as graph node cards)
|
||||||
* and `shadow-sm` (cards / panels). Anything heavier (`shadow-md|lg|xl|2xl`,
|
* and `shadow-sm` (cards / panels); `shadow-none` (a reset) is fine. Anything heavier (`shadow-md|lg|xl|2xl`,
|
||||||
* bare `shadow`, `shadow-inner`, arbitrary `shadow-[…]`) on a static panel is
|
* bare `shadow`, `shadow-inner`, arbitrary `shadow-[…]`) on a static panel is
|
||||||
* the regression: elevation beyond the stock pair reads as a floating layer
|
* the regression: elevation beyond the stock pair reads as a floating layer
|
||||||
* that nothing anchors.
|
* that nothing anchors.
|
||||||
@@ -54,7 +54,10 @@ const FLOATING_FILES = [
|
|||||||
const SHADOW_UTILITY = /(?<![-\w])shadow(?:-(?:2xs|xs|sm|md|lg|xl|2xl|inner|none)|\[|\()?/g
|
const SHADOW_UTILITY = /(?<![-\w])shadow(?:-(?:2xs|xs|sm|md|lg|xl|2xl|inner|none)|\[|\()?/g
|
||||||
|
|
||||||
/** The stock pair a static panel may paint. */
|
/** The stock pair a static panel may paint. */
|
||||||
const STATIC_ALLOWED = new Set(['shadow-xs', 'shadow-sm'])
|
// `shadow-none` is not an elevation at all (it clears the ring plumbing), so it
|
||||||
|
// is allowed anywhere a light shadow is; upstream's input-group uses it to keep
|
||||||
|
// nested controls flat inside the group's own surface.
|
||||||
|
const STATIC_ALLOWED = new Set(['shadow-xs', 'shadow-sm', 'shadow-none'])
|
||||||
|
|
||||||
/** Every non-allowed shadow utility in the source, for a readable failure. */
|
/** Every non-allowed shadow utility in the source, for a readable failure. */
|
||||||
function offendingShadows(source: string): string[] {
|
function offendingShadows(source: string): string[] {
|
||||||
|
|||||||
Reference in new issue
Block a user