"use client";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { cn } from "@stigmer/theme";
/**
 * Renders a horizontal list of workspace file-reference chips.
 *
 * Each chip shows the workspace-relative path (truncated) with a remove
 * button. Unlike attachment chips, file references have no upload
 * lifecycle — they are instant, lightweight "attention" signals.
 *
 * Designed to sit alongside {@link AttachmentChipList} in the composer's
 * attachments zone. Usable standalone by platform builders who compose
 * their own file-reference UI (headless-first, DD-003).
 *
 * All visual properties flow through `--stgm-*` tokens (DD-005).
 *
 * @example
 * ```tsx
 * function CustomComposer() {
 *   const fileRefs = useFileReferences();
 *
 *   return (
 *     <FileReferenceChipList
 *       refs={fileRefs.refs}
 *       onRemove={fileRefs.remove}
 *     />
 *   );
 * }
 * ```
 */
export function FileReferenceChipList({ refs, onRemove, disabled, className, }) {
    if (refs.length === 0)
        return null;
    return (_jsx("div", { className: cn("flex flex-wrap gap-1.5", className), role: "list", "aria-label": "Referenced workspace files", children: refs.map((path) => (_jsx(FileReferenceChip, { path: path, onRemove: () => onRemove(path), disabled: disabled }, path))) }));
}
// ---------------------------------------------------------------------------
// Individual chip
// ---------------------------------------------------------------------------
function FileReferenceChip({ path, onRemove, disabled, }) {
    const filename = path.split("/").pop() ?? path;
    return (_jsxs("span", { role: "listitem", "aria-label": `Referenced file: ${path}`, title: path, className: "inline-flex max-w-[200px] items-center gap-1 rounded-md bg-muted-subtle px-2 py-0.5 text-xs text-foreground", children: [_jsx(FileRefIcon, {}), _jsx("span", { className: "truncate", children: filename }), _jsx("button", { type: "button", onClick: onRemove, disabled: disabled, className: "ml-0.5 shrink-0 text-muted-foreground hover:text-destructive disabled:pointer-events-none", "aria-label": `Remove reference to ${path}`, children: _jsx(XIcon, {}) })] }));
}
// ---------------------------------------------------------------------------
// Inline SVG icons
// ---------------------------------------------------------------------------
function FileRefIcon() {
    return (_jsxs("svg", { width: "10", height: "10", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", className: "shrink-0 text-accent-foreground", "aria-hidden": "true", children: [_jsx("path", { d: "M8 1H4C3.45 1 3 1.45 3 2V12C3 12.55 3.45 13 4 13H10C10.55 13 11 12.55 11 12V4L8 1Z" }), _jsx("path", { d: "M8 1V4H11" }), _jsx("path", { d: "M5 8H9M5 10H8" })] }));
}
function XIcon() {
    return (_jsx("svg", { width: "10", height: "10", viewBox: "0 0 14 14", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M4 4L10 10M10 4L4 10" }) }));
}
//# sourceMappingURL=FileReferenceChipList.js.map