@arbidocs/react 0.5.164 → 0.5.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/MessageArtifactCard.js +16 -0
- package/dist/ai/MessageArtifactCard.js.map +2 -2
- package/dist/artifacts/artifact-kind.js +12 -1
- package/dist/artifacts/artifact-kind.js.map +2 -2
- package/dist/artifacts/index.cjs +26 -15
- package/dist/artifacts/index.cjs.map +1 -1
- package/dist/artifacts/index.d.ts +3 -20
- package/dist/artifacts/index.js +3 -1
- package/dist/artifacts/index.js.map +2 -2
- package/dist/calls/livekit/index.cjs +48 -48
- package/dist/chat/ChatBubble.js +56 -65
- package/dist/chat/ChatBubble.js.map +2 -2
- package/dist/chat/open-document.js +4 -1
- package/dist/chat/open-document.js.map +2 -2
- package/dist/{chunk-6HJZCIND.cjs → chunk-3DPOR5IR.cjs} +6 -3
- package/dist/chunk-3DPOR5IR.cjs.map +1 -0
- package/dist/{chunk-42X5ZO7Y.cjs → chunk-4TWXQFHU.cjs} +69 -69
- package/dist/{chunk-42X5ZO7Y.cjs.map → chunk-4TWXQFHU.cjs.map} +1 -1
- package/dist/{chunk-ZZBCZRA5.cjs → chunk-5QOZLKAY.cjs} +5 -2
- package/dist/chunk-5QOZLKAY.cjs.map +1 -0
- package/dist/{chunk-SUMXDNYG.cjs → chunk-BI4SYRLX.cjs} +70 -63
- package/dist/chunk-BI4SYRLX.cjs.map +1 -0
- package/dist/{chunk-ZBI5AMZC.cjs → chunk-HRQS27DO.cjs} +37 -37
- package/dist/{chunk-ZBI5AMZC.cjs.map → chunk-HRQS27DO.cjs.map} +1 -1
- package/dist/{chunk-V5WCKJEH.cjs → chunk-Q7BGWKHP.cjs} +44 -44
- package/dist/{chunk-V5WCKJEH.cjs.map → chunk-Q7BGWKHP.cjs.map} +1 -1
- package/dist/{chunk-6TJL4Z2F.cjs → chunk-TX7UCN73.cjs} +10 -10
- package/dist/{chunk-6TJL4Z2F.cjs.map → chunk-TX7UCN73.cjs.map} +1 -1
- package/dist/{chunk-WJIRX5MS.cjs → chunk-W4W75MSO.cjs} +134 -25
- package/dist/chunk-W4W75MSO.cjs.map +1 -0
- package/dist/chunk-WABJGKVA.cjs +246 -0
- package/dist/chunk-WABJGKVA.cjs.map +1 -0
- package/dist/databases.js.map +2 -2
- package/dist/directmessages/DmComposer.js +26 -10
- package/dist/directmessages/DmComposer.js.map +2 -2
- package/dist/directmessages/index.js +2 -0
- package/dist/directmessages/index.js.map +2 -2
- package/dist/directmessages/useChats.js +11 -0
- package/dist/directmessages/useChats.js.map +2 -2
- package/dist/document-tools/core.cjs +100 -100
- package/dist/document-tools/core.d.ts +2 -2
- package/dist/document-tools/index.cjs +102 -102
- package/dist/document-tools/index.d.ts +2 -2
- package/dist/entities/DocumentEntity.js +8 -3
- package/dist/entities/DocumentEntity.js.map +2 -2
- package/dist/entities/EntityActionsMenu.js +53 -0
- package/dist/entities/EntityActionsMenu.js.map +7 -0
- package/dist/entities/EntityPill.js +50 -16
- package/dist/entities/EntityPill.js.map +2 -2
- package/dist/entities/ProjectEntity.js +4 -0
- package/dist/entities/ProjectEntity.js.map +2 -2
- package/dist/entities/TagEntity.js +1 -0
- package/dist/entities/TagEntity.js.map +2 -2
- package/dist/entities/UserEntity.js +25 -3
- package/dist/entities/UserEntity.js.map +2 -2
- package/dist/entities/links.js +9 -0
- package/dist/entities/links.js.map +7 -0
- package/dist/entities/reference-data.js +56 -0
- package/dist/entities/reference-data.js.map +7 -0
- package/dist/{file-shares.d-Bwy9k3Db.d.ts → file-shares.d-Dlt7pKRi.d.ts} +3 -0
- package/dist/host/config.js.map +2 -2
- package/dist/index.cjs +1836 -1748
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-Dy_Pz6Vl.d.ts → index.d-BaZUctD1.d.ts} +34 -10
- package/dist/index.d.ts +164 -20
- package/dist/index.js +5 -0
- package/dist/index.js.map +2 -2
- package/dist/query-keys.js +3 -0
- package/dist/query-keys.js.map +2 -2
- package/dist/session/conversation-panels.js +5 -3
- package/dist/session/conversation-panels.js.map +2 -2
- package/dist/session/layout.js +5 -0
- package/dist/session/layout.js.map +2 -2
- package/dist/shell/index.cjs +37 -37
- package/dist/{stored-markdown.d-Bp18vrbr.d.ts → stored-markdown.d-BLQPny3e.d.ts} +21 -1
- package/dist/ui/index.cjs +155 -151
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +2 -0
- package/dist/ui/index.js.map +2 -2
- package/dist/viewers/AudioViewer.js +13 -3
- package/dist/viewers/AudioViewer.js.map +2 -2
- package/dist/viewers/MediaTranscriptPlayer.js +171 -0
- package/dist/viewers/MediaTranscriptPlayer.js.map +7 -0
- package/dist/viewers/VideoViewer.js +4 -11
- package/dist/viewers/VideoViewer.js.map +2 -2
- package/dist/viewers/index.cjs +8 -4
- package/dist/viewers/index.d.ts +17 -3
- package/dist/viewers/index.js +2 -0
- package/dist/viewers/index.js.map +2 -2
- package/package.json +3 -3
- package/dist/chunk-6HJZCIND.cjs.map +0 -1
- package/dist/chunk-SUMXDNYG.cjs.map +0 -1
- package/dist/chunk-TMPDW7J5.cjs +0 -79
- package/dist/chunk-TMPDW7J5.cjs.map +0 -1
- package/dist/chunk-WJIRX5MS.cjs.map +0 -1
- package/dist/chunk-ZZBCZRA5.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/entities/DocumentEntity.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * DocumentEntity Component\n *\n * Displays a document as a compact entity pill with file-type icon and name.\n * Promoted from the ARBI app and DECOUPLED from the app store/API: it renders\n * purely from the `doc` prop and optional `onClick`/`onIconClick` callbacks.\n */\n\nimport React from 'react'\nimport { Eye, FolderOpen } from 'lucide-react'\nimport { EntityPill, type EntitySize } from './EntityPill'\nimport { AudIcon } from '../icons/AudIcon'\nimport { DocIcon } from '../icons/DocIcon'\nimport { EmlIcon } from '../icons/EmlIcon'\nimport { HtmlIcon } from '../icons/HtmlIcon'\nimport { ImgIcon } from '../icons/ImgIcon'\nimport { PdfIcon } from '../icons/PdfIcon'\nimport { PresIcon } from '../icons/PresIcon'\nimport { TxtIcon } from '../icons/TxtIcon'\nimport { VidIcon } from '../icons/VidIcon'\nimport { XlsIcon } from '../icons/XlsIcon'\nimport { cn } from '../lib/utils'\nimport { isPresentationFileName } from './file-type'\n\n/** Minimal, decoupled document shape the pill needs. Structurally compatible\n * with the SDK's `DocResponse` (from `useDocuments`), but no dependency on it \u2014\n * a consumer can pass any object with these fields. */\nexport interface DocumentLike {\n file_name?: string | null\n folder?: string | null\n doc_metadata?: { title?: string | null } | null\n}\n\n/** Title of a document: `doc_metadata.title`, falling back to `file_name`. */\nexport function getDocumentTitle(\n document: DocumentLike | null | undefined,\n defaultValue = ''\n): string {\n if (!document) return defaultValue\n return document.doc_metadata?.title || document.file_name || defaultValue\n}\n\nconst IMAGE_FILE_TYPES = new Set(['png', 'jpg', 'jpeg', 'gif', 'bmp', 'tiff', 'webp'])\n\n/**\n * Whether a document is an image (upload or AI-generated): pages and tokens are text-document\n * concepts, never meaningful for an image, whatever the stored value.\n */\nexport function isImageDocument(\n document: { file_type?: string | null } | null | undefined\n): boolean {\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * DocumentEntity Component\n *\n * Displays a document as a compact entity pill with file-type icon and name.\n * Promoted from the ARBI app and DECOUPLED from the app store/API: it renders\n * purely from the `doc` prop and optional `onClick`/`onIconClick` callbacks.\n */\n\nimport React from 'react'\nimport { Eye, FolderOpen } from 'lucide-react'\nimport { EntityPill, type EntitySize } from './EntityPill'\nimport { AudIcon } from '../icons/AudIcon'\nimport { DocIcon } from '../icons/DocIcon'\nimport { EmlIcon } from '../icons/EmlIcon'\nimport { HtmlIcon } from '../icons/HtmlIcon'\nimport { ImgIcon } from '../icons/ImgIcon'\nimport { PdfIcon } from '../icons/PdfIcon'\nimport { PresIcon } from '../icons/PresIcon'\nimport { TxtIcon } from '../icons/TxtIcon'\nimport { VidIcon } from '../icons/VidIcon'\nimport { XlsIcon } from '../icons/XlsIcon'\nimport { cn } from '../lib/utils'\nimport { isPresentationFileName } from './file-type'\n\n/** Minimal, decoupled document shape the pill needs. Structurally compatible\n * with the SDK's `DocResponse` (from `useDocuments`), but no dependency on it \u2014\n * a consumer can pass any object with these fields. */\nexport interface DocumentLike {\n external_id?: string\n file_name?: string | null\n folder?: string | null\n doc_metadata?: { title?: string | null } | null\n}\n\n/** Title of a document: `doc_metadata.title`, falling back to `file_name`. */\nexport function getDocumentTitle(\n document: DocumentLike | null | undefined,\n defaultValue = ''\n): string {\n if (!document) return defaultValue\n return document.doc_metadata?.title || document.file_name || defaultValue\n}\n\nconst IMAGE_FILE_TYPES = new Set(['png', 'jpg', 'jpeg', 'gif', 'bmp', 'tif', 'tiff', 'webp'])\n\n/**\n * Whether a document is an image (upload or AI-generated): pages and tokens are text-document\n * concepts, never meaningful for an image, whatever the stored value.\n */\nexport function isImageDocument(\n document: { file_type?: string | null; file_name?: string | null } | null | undefined\n): boolean {\n const fileType = document?.file_type?.toLowerCase().split(';')[0].trim()\n const extension = document?.file_name?.split('.').pop()?.toLowerCase()\n return !!(\n (fileType && (fileType.startsWith('image/') || IMAGE_FILE_TYPES.has(fileType))) ||\n (extension && IMAGE_FILE_TYPES.has(extension))\n )\n}\n\n/** Hard cap on the pill's visible label. The full name still shows in the hover\n * tooltip; the pill stays compact so the trailing \u22EE menu never gets pushed. */\nconst MAX_LABEL_CHARS = 30\n\nfunction clampLabel(text: string): string {\n return text.length > MAX_LABEL_CHARS ? `${text.slice(0, MAX_LABEL_CHARS).trimEnd()}\u2026` : text\n}\n\nconst IMAGE_EXTENSIONS = new Set(['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'tif', 'webp'])\nconst VIDEO_EXTENSIONS = new Set(['mp4', 'mpeg', 'mpg', 'webm', 'mov', 'avi', 'mkv'])\nconst AUDIO_EXTENSIONS = new Set(['mp3', 'wav', 'm4a', 'aac', 'ogg', 'flac'])\nconst EMAIL_EXTENSIONS = new Set(['eml', 'msg'])\nconst DOCX_EXTENSIONS = new Set(['doc', 'docx', 'odt', 'rtf'])\nconst XLSX_EXTENSIONS = new Set(['xls', 'xlsx', 'csv', 'ods'])\nconst HTML_EXTENSIONS = new Set(['html', 'htm', 'mhtml'])\nconst TEXT_EXTENSIONS = new Set([\n 'txt',\n 'text',\n 'md',\n 'markdown',\n 'log',\n 'json',\n 'xml',\n 'yaml',\n 'yml',\n])\n\n/**\n * The file-type glyph for a document, by extension.\n *\n * Exported because a document is recognisable by its icon before its name \u2014 any\n * surface that lists documents (the entity pill here, the workspace home's\n * Documents card) has to draw the same PDF/image/audio/video/email glyph, or\n * the same file looks like two different things in two places.\n */\nexport function getDocIcon(\n fileName?: string | null,\n iconSize = 14,\n /** The document's folder: a PDF in Presentations is a presentation. */\n folder?: string | null\n): React.ReactNode {\n if (isPresentationFileName(fileName, folder)) {\n return <PresIcon size={iconSize} className=\"flex-shrink-0\" />\n }\n const ext = fileName?.split('.').pop()?.toLowerCase()\n if (ext && VIDEO_EXTENSIONS.has(ext)) return <VidIcon size={iconSize} className=\"flex-shrink-0\" />\n if (ext && AUDIO_EXTENSIONS.has(ext)) return <AudIcon size={iconSize} className=\"flex-shrink-0\" />\n if (ext && IMAGE_EXTENSIONS.has(ext)) return <ImgIcon size={iconSize} className=\"flex-shrink-0\" />\n if (ext && EMAIL_EXTENSIONS.has(ext)) return <EmlIcon size={iconSize} className=\"flex-shrink-0\" />\n if (ext && DOCX_EXTENSIONS.has(ext)) return <DocIcon size={iconSize} className=\"flex-shrink-0\" />\n if (ext && XLSX_EXTENSIONS.has(ext)) return <XlsIcon size={iconSize} className=\"flex-shrink-0\" />\n if (ext && HTML_EXTENSIONS.has(ext)) return <HtmlIcon size={iconSize} className=\"flex-shrink-0\" />\n if (ext && TEXT_EXTENSIONS.has(ext)) return <TxtIcon size={iconSize} className=\"flex-shrink-0\" />\n // Unrecognised or missing extension (e.g. a display title): most uploads are PDFs.\n return <PdfIcon size={iconSize} className=\"flex-shrink-0\" />\n}\n\nexport interface DocumentEntityProps {\n doc: DocumentLike\n /** Override the default file-type icon */\n icon?: React.ReactNode\n /** `sm` (default) for inline/compact contexts, `md` for a larger pill (e.g. the documents\n * grid's primary name column). */\n size?: Extract<EntitySize, 'sm' | 'md'>\n /** Override default label max width */\n labelMaxWidth?: string\n /** Extra classes on the label text (e.g. a heavier weight on a card face). */\n labelClassName?: string\n /** Click handler for the whole pill */\n onClick?: (e: React.MouseEvent) => void\n /** Click handler for the icon only */\n onIconClick?: (e: React.MouseEvent) => void\n /** When true, the file-type icon is replaced by a pinned Eye \u2014 marks the\n * document that is currently open/being viewed. */\n viewing?: boolean\n /** Small overlay pinned to the icon's corner (e.g. an \"available offline\" pip). */\n iconBadge?: React.ReactNode\n /** Small content right after the name, inside the click area (e.g. a status glyph). */\n status?: React.ReactNode\n /** Trailing control rendered outside the click area (e.g. a \u22EF actions menu). */\n actions?: React.ReactNode\n copyHref?: string\n /** When true, the pill fills the available width and the name truncates via\n * CSS so the trailing \u22EF menu pins to the right edge. */\n fullWidth?: boolean\n /** Render the WHOLE title (skip the 30-char `clampLabel` string cut) while\n * keeping the normal content-width layout \u2014 for callers that want the full\n * name to show/wrap (via a `labelClassName`) without `fullWidth`'s w-full.\n * `fullWidth` already implies this. */\n noClamp?: boolean\n /** Override the default folder/title hover tooltip. */\n tooltipContent?: React.ReactNode\n className?: string\n /** Forwarded to the pill so a surface can address this document's chip. */\n 'data-testid'?: string\n}\n\nexport function DocumentEntity({\n doc,\n icon,\n size = 'sm',\n labelMaxWidth,\n labelClassName,\n onClick,\n onIconClick,\n viewing,\n iconBadge,\n status,\n actions,\n copyHref,\n tooltipContent,\n className,\n fullWidth,\n noClamp,\n 'data-testid': testId,\n}: DocumentEntityProps) {\n const title = getDocumentTitle(doc)\n const ext = doc.file_name?.split('.').pop()?.toLowerCase()\n const iconSize = size === 'md' ? 16 : 14\n const eyeSizeClass = size === 'md' ? 'h-4 w-4' : 'h-3.5 w-3.5'\n\n const baseIcon = icon ?? getDocIcon(doc.file_name, iconSize, doc.folder)\n const displayIcon =\n viewing || iconBadge ? (\n <span className=\"relative inline-flex flex-shrink-0 items-center justify-center\">\n {viewing ? <Eye className={cn('text-primary', eyeSizeClass)} /> : baseIcon}\n {iconBadge}\n </span>\n ) : (\n baseIcon\n )\n\n const defaultTooltip = (\n <div className=\"flex flex-col gap-1 text-xs max-w-[440px]\">\n {doc.folder && (\n // `flex-wrap` so a deep folder path wraps WITHIN the balloon instead of\n // spilling out of it (each path segment is atomic and wraps as a unit;\n // `min-w-0` + `break-all` lets a single over-long segment break too).\n <span className=\"flex flex-wrap items-center gap-0.5 text-muted-foreground\">\n <FolderOpen className=\"h-3 w-3 text-yellow-600 shrink-0\" />\n {doc.folder.split('/').map((part, i, arr) => (\n <span key={i} className=\"flex min-w-0 items-center gap-0.5\">\n {i > 0 && <span className=\"text-muted-foreground/50 mx-0.5\">/</span>}\n <span className={`break-all ${i < arr.length - 1 ? 'text-muted-foreground/70' : ''}`}>\n {part}\n </span>\n </span>\n ))}\n </span>\n )}\n <span className=\"font-medium break-words\">\n {title}\n {ext ? `.${ext}` : ''}\n </span>\n </div>\n )\n\n return (\n <EntityPill\n icon={displayIcon}\n entityId={onClick ? doc.external_id : undefined}\n size={size}\n label={fullWidth || noClamp ? title : clampLabel(title)}\n labelMaxWidth={labelMaxWidth ?? 'max-w-[140px]'}\n labelClassName={labelClassName}\n secondaryText={status}\n fullWidth={fullWidth}\n onClick={onClick}\n onIconClick={onIconClick}\n moreContent={actions}\n copyHref={copyHref}\n className={className}\n highlight={viewing}\n data-testid={testId}\n tooltipContent={tooltipContent ?? defaultTooltip}\n />\n )\n}\n"],
|
|
5
|
+
"mappings": "AAsGW,cAkFL,YAlFK;AA7FX,SAAS,KAAK,kBAAkB;AAChC,SAAS,kBAAmC;AAC5C,SAAS,eAA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;AAAA,MACN,UAAU,UAAU,IAAI,cAAc;AAAA,MACtC;AAAA,MACA,OAAO,aAAa,UAAU,QAAQ,WAAW,KAAK;AAAA,MACtD,eAAe,iBAAiB;AAAA,MAChC;AAAA,MACA,eAAe;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACX,eAAa;AAAA,MACb,gBAAgB,kBAAkB;AAAA;AAAA,EACpC;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Copy, MoreVertical } from "lucide-react";
|
|
4
|
+
import {
|
|
5
|
+
DropdownMenu,
|
|
6
|
+
DropdownMenuTrigger,
|
|
7
|
+
DropdownMenuContent,
|
|
8
|
+
DropdownMenuItem
|
|
9
|
+
} from "../ui/dropdown-menu.js";
|
|
10
|
+
function EntityActionsMenu({
|
|
11
|
+
label,
|
|
12
|
+
href,
|
|
13
|
+
actions = []
|
|
14
|
+
}) {
|
|
15
|
+
const [copyError, setCopyError] = useState(false);
|
|
16
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { onOpenChange: () => setCopyError(false), children: [
|
|
17
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
18
|
+
"button",
|
|
19
|
+
{
|
|
20
|
+
type: "button",
|
|
21
|
+
"aria-label": `Actions for ${label}`,
|
|
22
|
+
className: "relative inline-flex h-5 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
23
|
+
onClick: (e) => e.stopPropagation(),
|
|
24
|
+
children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-3.5 w-3.5" })
|
|
25
|
+
}
|
|
26
|
+
) }),
|
|
27
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", onClick: (e) => e.stopPropagation(), children: [
|
|
28
|
+
actions.map((action) => /* @__PURE__ */ jsxs(DropdownMenuItem, { disabled: action.disabled, onSelect: action.onSelect, children: [
|
|
29
|
+
action.icon,
|
|
30
|
+
action.label
|
|
31
|
+
] }, action.id)),
|
|
32
|
+
/* @__PURE__ */ jsxs(
|
|
33
|
+
DropdownMenuItem,
|
|
34
|
+
{
|
|
35
|
+
onSelect: (event) => {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
setCopyError(false);
|
|
38
|
+
void Promise.resolve().then(() => navigator.clipboard.writeText(new URL(href, window.location.href).href)).catch(() => setCopyError(true));
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Copy, { className: "mr-2 h-4 w-4" }),
|
|
42
|
+
"Copy link"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
copyError && /* @__PURE__ */ jsx("p", { role: "alert", className: "px-2 py-1 text-xs text-destructive", children: "Could not copy link. Please try again." })
|
|
47
|
+
] })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
EntityActionsMenu
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=EntityActionsMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/entities/EntityActionsMenu.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useState, type ReactNode } from 'react'\nimport { Copy, MoreVertical } from 'lucide-react'\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n} from '../ui/dropdown-menu'\n\nexport interface EntityAction {\n id: string\n label: string\n icon?: ReactNode\n onSelect: () => void\n disabled?: boolean\n}\n\n/** The shared trailing menu for entity references. Copy always uses the entity's address. */\nexport function EntityActionsMenu({\n label,\n href,\n actions = [],\n}: {\n label: string\n href: string\n actions?: EntityAction[]\n}) {\n const [copyError, setCopyError] = useState(false)\n return (\n <DropdownMenu onOpenChange={() => setCopyError(false)}>\n <DropdownMenuTrigger asChild>\n <button\n type=\"button\"\n aria-label={`Actions for ${label}`}\n className=\"relative inline-flex h-5 w-4 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n onClick={(e) => e.stopPropagation()}\n >\n <MoreVertical className=\"h-3.5 w-3.5\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" onClick={(e) => e.stopPropagation()}>\n {actions.map((action) => (\n <DropdownMenuItem key={action.id} disabled={action.disabled} onSelect={action.onSelect}>\n {action.icon}\n {action.label}\n </DropdownMenuItem>\n ))}\n <DropdownMenuItem\n onSelect={(event) => {\n event.preventDefault()\n setCopyError(false)\n void Promise.resolve()\n .then(() => navigator.clipboard.writeText(new URL(href, window.location.href).href))\n .catch(() => setCopyError(true))\n }}\n >\n <Copy className=\"mr-2 h-4 w-4\" />\n Copy link\n </DropdownMenuItem>\n {copyError && (\n <p role=\"alert\" className=\"px-2 py-1 text-xs text-destructive\">\n Could not copy link. Please try again.\n </p>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAqCU,cAKA,YALA;AArCV,SAAS,gBAAgC;AACzC,SAAS,MAAM,oBAAoB;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAWA,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AACb,GAIG;AACD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,SACE,qBAAC,gBAAa,cAAc,MAAM,aAAa,KAAK,GAClD;AAAA,wBAAC,uBAAoB,SAAO,MAC1B;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAY,eAAe,KAAK;AAAA,QAChC,WAAU;AAAA,QACV,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,QAElC,8BAAC,gBAAa,WAAU,eAAc;AAAA;AAAA,IACxC,GACF;AAAA,IACA,qBAAC,uBAAoB,OAAM,OAAM,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAChE;AAAA,cAAQ,IAAI,CAAC,WACZ,qBAAC,oBAAiC,UAAU,OAAO,UAAU,UAAU,OAAO,UAC3E;AAAA,eAAO;AAAA,QACP,OAAO;AAAA,WAFa,OAAO,EAG9B,CACD;AAAA,MACD;AAAA,QAAC;AAAA;AAAA,UACC,UAAU,CAAC,UAAU;AACnB,kBAAM,eAAe;AACrB,yBAAa,KAAK;AAClB,iBAAK,QAAQ,QAAQ,EAClB,KAAK,MAAM,UAAU,UAAU,UAAU,IAAI,IAAI,MAAM,OAAO,SAAS,IAAI,EAAE,IAAI,CAAC,EAClF,MAAM,MAAM,aAAa,IAAI,CAAC;AAAA,UACnC;AAAA,UAEA;AAAA,gCAAC,QAAK,WAAU,gBAAe;AAAA,YAAE;AAAA;AAAA;AAAA,MAEnC;AAAA,MACC,aACC,oBAAC,OAAE,MAAK,SAAQ,WAAU,sCAAqC,oDAE/D;AAAA,OAEJ;AAAA,KACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useEntityHref } from "./links.js";
|
|
3
|
+
import React, { forwardRef } from "react";
|
|
4
|
+
import { EntityActionsMenu } from "./EntityActionsMenu.js";
|
|
3
5
|
import { MoreVertical } from "lucide-react";
|
|
4
6
|
import { cn } from "../lib/utils.js";
|
|
5
7
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
|
|
@@ -22,11 +24,16 @@ const EntityPill = forwardRef(function EntityPill2({
|
|
|
22
24
|
onMoreClick,
|
|
23
25
|
moreContent,
|
|
24
26
|
href,
|
|
27
|
+
copyHref,
|
|
28
|
+
entityId,
|
|
29
|
+
actions,
|
|
25
30
|
disabled = false,
|
|
26
31
|
pressed,
|
|
27
32
|
tooltipContent,
|
|
28
33
|
"data-testid": testId
|
|
29
34
|
}, ref) {
|
|
35
|
+
const hostHref = useEntityHref(entityId);
|
|
36
|
+
const primaryRef = React.useRef(null);
|
|
30
37
|
const shapeClass = shape === "pill" ? "rounded-full" : "rounded-md";
|
|
31
38
|
const sizeClasses = size === "md" ? "gap-1.5 px-1.5 py-0.5" : "gap-1 px-1";
|
|
32
39
|
const textSizeClass = size === "md" ? "text-base" : "text-sm";
|
|
@@ -35,13 +42,13 @@ const EntityPill = forwardRef(function EntityPill2({
|
|
|
35
42
|
fullWidth ? "flex w-full" : "inline-flex",
|
|
36
43
|
sizeClasses,
|
|
37
44
|
shapeClass,
|
|
38
|
-
"
|
|
45
|
+
"min-w-0 max-w-full align-middle",
|
|
39
46
|
"transition-colors",
|
|
40
47
|
className
|
|
41
48
|
);
|
|
42
|
-
const interactiveClasses = cn("relative cursor-pointer
|
|
49
|
+
const interactiveClasses = cn("relative cursor-pointer", PILL_TOUCH_HIT);
|
|
43
50
|
const disabledClasses = "cursor-default opacity-60";
|
|
44
|
-
const highlightClasses = "
|
|
51
|
+
const highlightClasses = "text-primary font-semibold";
|
|
45
52
|
const mainContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
53
|
onIconClick ? /* @__PURE__ */ jsx(
|
|
47
54
|
"span",
|
|
@@ -61,7 +68,7 @@ const EntityPill = forwardRef(function EntityPill2({
|
|
|
61
68
|
{
|
|
62
69
|
className: cn(
|
|
63
70
|
textSizeClass,
|
|
64
|
-
"font-medium truncate leading-tight min-w-0",
|
|
71
|
+
"font-medium tracking-[0.01em] truncate leading-tight min-w-0 underline decoration-dotted decoration-current/35 underline-offset-4",
|
|
65
72
|
labelMaxWidth,
|
|
66
73
|
labelClassName
|
|
67
74
|
),
|
|
@@ -82,20 +89,45 @@ const EntityPill = forwardRef(function EntityPill2({
|
|
|
82
89
|
),
|
|
83
90
|
/* @__PURE__ */ jsx(TooltipContent, { side, className: "p-2", children: tip })
|
|
84
91
|
] });
|
|
85
|
-
const mainAreaClass = cn("inline-flex items-center gap-1", fullWidth && "
|
|
92
|
+
const mainAreaClass = cn("inline-flex min-w-0 items-center gap-1", fullWidth && "flex-1");
|
|
86
93
|
const mainAreaTouchClass = cn(
|
|
87
94
|
mainAreaClass,
|
|
88
95
|
(onClick || href) && !disabled && MAIN_AREA_TOUCH_HIT
|
|
89
96
|
);
|
|
90
|
-
|
|
97
|
+
const entityHref = copyHref ?? href ?? hostHref;
|
|
98
|
+
const defaultMenu = entityHref && !disabled ? /* @__PURE__ */ jsx(
|
|
99
|
+
EntityActionsMenu,
|
|
100
|
+
{
|
|
101
|
+
label,
|
|
102
|
+
href: entityHref,
|
|
103
|
+
actions: [
|
|
104
|
+
...onClick || href ? [
|
|
105
|
+
{
|
|
106
|
+
id: "open",
|
|
107
|
+
label: "Open",
|
|
108
|
+
onSelect: () => {
|
|
109
|
+
if (onClick) primaryRef.current?.click();
|
|
110
|
+
else if (href) window.open(href, "_blank", "noopener,noreferrer");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
] : [],
|
|
114
|
+
...actions ?? []
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
) : null;
|
|
118
|
+
const trailing = moreContent ?? (onMoreClick ? null : defaultMenu);
|
|
119
|
+
if (onMoreClick || trailing) {
|
|
91
120
|
let mainArea;
|
|
92
|
-
if (tooltipContent) {
|
|
121
|
+
if (tooltipContent && !href) {
|
|
93
122
|
mainArea = tooltipWrap(
|
|
94
123
|
mainContent,
|
|
95
124
|
tooltipContent,
|
|
96
125
|
"bottom",
|
|
97
126
|
cn(mainAreaTouchClass, disabled && "opacity-60"),
|
|
98
127
|
{
|
|
128
|
+
ref: (el) => {
|
|
129
|
+
primaryRef.current = el;
|
|
130
|
+
},
|
|
99
131
|
type: "button",
|
|
100
132
|
onClick: href ? onClick : disabled ? void 0 : onClick,
|
|
101
133
|
disabled: disabled || void 0,
|
|
@@ -106,6 +138,9 @@ const EntityPill = forwardRef(function EntityPill2({
|
|
|
106
138
|
mainArea = /* @__PURE__ */ jsx(
|
|
107
139
|
"a",
|
|
108
140
|
{
|
|
141
|
+
ref: (el) => {
|
|
142
|
+
primaryRef.current = el;
|
|
143
|
+
},
|
|
109
144
|
href,
|
|
110
145
|
target: "_blank",
|
|
111
146
|
rel: "noopener noreferrer",
|
|
@@ -118,26 +153,25 @@ const EntityPill = forwardRef(function EntityPill2({
|
|
|
118
153
|
mainArea = /* @__PURE__ */ jsx(
|
|
119
154
|
"button",
|
|
120
155
|
{
|
|
156
|
+
ref: (el) => {
|
|
157
|
+
primaryRef.current = el;
|
|
158
|
+
},
|
|
121
159
|
type: "button",
|
|
122
160
|
onClick: disabled ? void 0 : onClick,
|
|
123
161
|
disabled,
|
|
124
162
|
"aria-pressed": pressed,
|
|
125
|
-
className: cn(
|
|
126
|
-
"inline-flex items-center gap-1",
|
|
127
|
-
MAIN_AREA_TOUCH_HIT,
|
|
128
|
-
disabled && "opacity-60"
|
|
129
|
-
),
|
|
163
|
+
className: cn(mainAreaClass, MAIN_AREA_TOUCH_HIT, disabled && "opacity-60"),
|
|
130
164
|
children: mainContent
|
|
131
165
|
}
|
|
132
166
|
);
|
|
133
167
|
} else {
|
|
134
168
|
mainArea = /* @__PURE__ */ jsx("span", { className: mainAreaTouchClass, children: mainContent });
|
|
135
169
|
}
|
|
136
|
-
const moreArea =
|
|
170
|
+
const moreArea = trailing ? /* @__PURE__ */ jsx("span", { className: "flex-shrink-0 leading-none opacity-0 transition-opacity group-hover/pill:opacity-100 group-focus-within/pill:opacity-100 has-[[data-state=open]]:opacity-100 pointer-coarse:opacity-100", children: trailing }) : tooltipWrap(
|
|
137
171
|
/* @__PURE__ */ jsx(MoreVertical, { className: "w-3.5 h-3.5" }),
|
|
138
172
|
"Click for more",
|
|
139
173
|
"bottom",
|
|
140
|
-
"flex-shrink-0 leading-none text-muted-foreground hover:text-foreground",
|
|
174
|
+
"flex-shrink-0 leading-none text-muted-foreground hover:text-foreground opacity-0 group-hover/pill:opacity-100 group-focus-within/pill:opacity-100 pointer-coarse:opacity-100",
|
|
141
175
|
{
|
|
142
176
|
type: "button",
|
|
143
177
|
onClick: (e) => {
|
|
@@ -152,7 +186,7 @@ const EntityPill = forwardRef(function EntityPill2({
|
|
|
152
186
|
ref,
|
|
153
187
|
className: cn(
|
|
154
188
|
baseClasses,
|
|
155
|
-
(onClick || href) && !disabled && "cursor-pointer
|
|
189
|
+
(onClick || href) && !disabled && "cursor-pointer",
|
|
156
190
|
highlight && highlightClasses
|
|
157
191
|
),
|
|
158
192
|
style,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/entities/EntityPill.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * EntityPill Component\n *\n * Base component for pill-style entity displays. Provides consistent styling and\n * interaction patterns. At rest it is plain icon + text (no fill, no border); the\n * fill appears on hover, so a row of entities does not read as a row of buttons. Promoted verbatim from the ARBI app (import paths only\n * changed to resolve within the SDK).\n *\n * Pattern: [Icon] [Label] [Optional: secondary text] [MoreVertical when interactive]\n */\n\nimport React, { forwardRef } from 'react'\nimport { MoreVertical } from 'lucide-react'\nimport { cn } from '../lib/utils'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip'\n\n/**\n * The one size scale of the entity pills and avatars (`UserEntity`, `TagEntity`, `EntityPill`,\n * `DocumentEntity`, the call tiles...). Each takes the steps it draws: the pill itself has two,\n * `sm` for compact rows and `md` for a primary column or a tab header.\n */\nexport type EntitySize = 'xs' | 'sm' | 'md' | 'lg'\n\ninterface EntityPillProps {\n /** The icon element (Avatar, ShieldIcon, FileIcon, etc.) */\n icon: React.ReactNode\n /** Primary label text */\n label: string\n /** Optional secondary text (e.g., page notation \"p.1\") */\n secondaryText?: React.ReactNode\n\n // Styling\n /** `sm` (default) for compact rows, `md` for a primary column or a tab header. */\n size?: Extract<EntitySize, 'sm' | 'md'>\n /** Shape variant: 'pill' for rounded-full, 'rounded' for rounded-md */\n shape?: 'pill' | 'rounded'\n /** Additional CSS classes */\n className?: string\n style?: React.CSSProperties\n /** Max width for label truncation */\n labelMaxWidth?: string\n /** Extra classes on the label text (e.g. a heavier weight on a card face). */\n labelClassName?: string\n /** When true, the pill fills its container width (`flex w-full`) and the main\n * area flexes + truncates so the trailing control (\u22EF menu) pins to the right\n * edge \u2014 used by the documents table's Document column. Default: shrink-to-fit. */\n fullWidth?: boolean\n /** When true, render the pill with the active/\"viewing\" highlight \u2014 a solid\n * dark-navy background with light text, applied LAST so it wins over both the\n * default background and the interactive hover. */\n highlight?: boolean\n\n // Behavior\n /** Click handler for main area (icon + label) - primary action */\n onClick?: (e: React.MouseEvent) => void\n /** Click handler for icon only \u2014 when set, only the icon is clickable (not the label) */\n onIconClick?: (e: React.MouseEvent) => void\n /** Click handler for MoreVertical - opens popover/menu. When provided, shows MoreVertical icon */\n onMoreClick?: (e: React.MouseEvent) => void\n /** Custom trailing element (e.g. a \u22EF dropdown menu). Rendered in the same\n * trailing zone as MoreVertical, but as-is \u2014 so it stays outside the pill's\n * primary click area. Takes precedence over `onMoreClick`. */\n moreContent?: React.ReactNode\n /** Link URL - makes the main area an anchor tag */\n href?: string\n /** Whether the pill is disabled */\n disabled?: boolean\n /** For a pill that toggles a state on click: that state, exposed as `aria-pressed`. */\n pressed?: boolean\n\n // Tooltip\n /** Tooltip for main area (describes primary action, e.g., \"View document\") */\n tooltipContent?: React.ReactNode\n\n /** Test ID for testing */\n 'data-testid'?: string\n}\n\n/** Coarse pointers: a 44x44 (or wider, as wide as the pill) hit area centred on the pill. */\nconst PILL_TOUCH_HIT =\n \"pointer-coarse:after:absolute pointer-coarse:after:left-1/2 pointer-coarse:after:top-1/2 pointer-coarse:after:h-11 pointer-coarse:after:w-[max(100%,2.75rem)] pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:content-['']\"\n\n/**\n * The main area of a pill with a separate \"more\" control: 44px tall but only as wide as the area,\n * so it never reaches over the \"more\" control and swallows its taps.\n */\nconst MAIN_AREA_TOUCH_HIT =\n \"relative pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:top-1/2 pointer-coarse:after:h-11 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:content-['']\"\n\nexport const EntityPill = forwardRef<HTMLElement, EntityPillProps>(function EntityPill(\n {\n icon,\n label,\n secondaryText,\n size = 'sm',\n shape = 'rounded',\n className,\n style,\n labelMaxWidth = 'max-w-[320px]',\n labelClassName,\n fullWidth = false,\n highlight = false,\n onClick,\n onIconClick,\n onMoreClick,\n moreContent,\n href,\n disabled = false,\n pressed,\n tooltipContent,\n 'data-testid': testId,\n },\n ref\n) {\n const shapeClass = shape === 'pill' ? 'rounded-full' : 'rounded-md'\n\n // Size-based classes\n const sizeClasses = size === 'md' ? 'gap-1.5 px-1.5 py-0.5' : 'gap-1 px-1'\n const textSizeClass = size === 'md' ? 'text-base' : 'text-sm'\n\n const baseClasses = cn(\n 'group/pill items-center',\n fullWidth ? 'flex w-full' : 'inline-flex',\n sizeClasses,\n shapeClass,\n 'border border-transparent',\n 'transition-colors',\n className\n )\n\n // Coarse pointers: an invisible hit area of at least 44x44 centred on the pill (the pill itself\n // stays compact). Centred and sized, not inset: an absolute box is laid out against the padding\n // box, so `-inset-y-3` on a bordered 20px pill gave 42px, and an icon-only pill stayed 22px wide.\n const interactiveClasses = cn('relative cursor-pointer hover:bg-muted', PILL_TOUCH_HIT)\n const disabledClasses = 'cursor-default opacity-60'\n const highlightClasses =\n 'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground'\n\n // Main content (icon + label + secondary text)\n const mainContent = (\n <>\n {onIconClick ? (\n <span\n role=\"button\"\n tabIndex={0}\n className=\"flex-shrink-0 cursor-pointer hover:opacity-70 transition-opacity\"\n onClick={(e) => {\n e.stopPropagation()\n onIconClick(e)\n }}\n >\n {icon}\n </span>\n ) : (\n icon\n )}\n <span\n className={cn(\n textSizeClass,\n 'font-medium truncate leading-tight min-w-0',\n labelMaxWidth,\n labelClassName\n )}\n >\n {label}\n </span>\n {secondaryText && (\n <span className=\"text-xs text-muted-foreground flex-shrink-0 leading-none\">\n {secondaryText}\n </span>\n )}\n </>\n )\n\n // Helper: wrap any content in a Tooltip (no asChild \u2014 TooltipTrigger renders its own button)\n const tooltipWrap = (\n content: React.ReactNode,\n tip: React.ReactNode,\n side: 'top' | 'bottom' | 'left' | 'right' = 'bottom',\n triggerClassName?: string,\n triggerProps?: Record<string, unknown>\n ) => (\n <Tooltip>\n <TooltipTrigger\n onFocusCapture={(e) => e.stopPropagation()}\n className={triggerClassName}\n {...triggerProps}\n >\n {content}\n </TooltipTrigger>\n <TooltipContent side={side} className=\"p-2\">\n {tip}\n </TooltipContent>\n </Tooltip>\n )\n\n // With a separate \"more\" control the touch hit area must grow on the MAIN area only: an overlay on\n // the whole pill would sit above both inner buttons and swallow their taps.\n const mainAreaClass = cn('inline-flex items-center gap-1', fullWidth && 'min-w-0 flex-1')\n const mainAreaTouchClass = cn(\n mainAreaClass,\n (onClick || href) && !disabled && MAIN_AREA_TOUCH_HIT\n )\n\n if (onMoreClick || moreContent) {\n let mainArea: React.ReactNode\n if (tooltipContent) {\n mainArea = tooltipWrap(\n mainContent,\n tooltipContent,\n 'bottom',\n cn(mainAreaTouchClass, disabled && 'opacity-60'),\n {\n type: 'button',\n onClick: href ? onClick : disabled ? undefined : onClick,\n disabled: disabled || undefined,\n 'aria-pressed': href ? undefined : pressed,\n }\n )\n } else if (href) {\n mainArea = (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={mainAreaTouchClass}\n onClick={onClick}\n >\n {mainContent}\n </a>\n )\n } else if (onClick) {\n mainArea = (\n <button\n type=\"button\"\n onClick={disabled ? undefined : onClick}\n disabled={disabled}\n aria-pressed={pressed}\n className={cn(\n 'inline-flex items-center gap-1',\n MAIN_AREA_TOUCH_HIT,\n disabled && 'opacity-60'\n )}\n >\n {mainContent}\n </button>\n )\n } else {\n mainArea = <span className={mainAreaTouchClass}>{mainContent}</span>\n }\n\n const moreArea = moreContent ? (\n <span className=\"flex-shrink-0 leading-none\">{moreContent}</span>\n ) : (\n tooltipWrap(\n <MoreVertical className=\"w-3.5 h-3.5\" />,\n 'Click for more',\n 'bottom',\n 'flex-shrink-0 leading-none text-muted-foreground hover:text-foreground',\n {\n type: 'button',\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation()\n onMoreClick?.(e)\n },\n }\n )\n )\n\n return (\n <span\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(\n baseClasses,\n (onClick || href) && !disabled && 'cursor-pointer hover:bg-muted',\n highlight && highlightClasses\n )}\n style={style}\n data-testid={testId}\n >\n {mainArea}\n {moreArea}\n </span>\n )\n }\n\n if (tooltipContent) {\n if (href) {\n return tooltipWrap(\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={mainAreaClass}\n onClick={onClick}\n >\n {mainContent}\n </a>,\n tooltipContent,\n 'bottom',\n cn(baseClasses, interactiveClasses),\n { 'data-testid': testId, style }\n )\n }\n\n return tooltipWrap(\n mainContent,\n tooltipContent,\n 'bottom',\n cn(\n baseClasses,\n onClick && !disabled ? interactiveClasses : '',\n disabled ? disabledClasses : '',\n highlight && highlightClasses\n ),\n {\n type: 'button',\n ref: ref as React.Ref<HTMLButtonElement>,\n onClick: onClick && !disabled ? onClick : undefined,\n disabled: disabled || undefined,\n 'aria-pressed': pressed,\n 'data-testid': testId,\n style,\n }\n )\n }\n\n if (href) {\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(baseClasses, interactiveClasses)}\n style={style}\n data-testid={testId}\n onClick={onClick}\n >\n {mainContent}\n </a>\n )\n }\n\n if (onClick) {\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n onClick={disabled ? undefined : onClick}\n disabled={disabled}\n aria-pressed={pressed}\n className={cn(\n baseClasses,\n disabled ? disabledClasses : interactiveClasses,\n highlight && highlightClasses\n )}\n style={style}\n data-testid={testId}\n >\n {mainContent}\n </button>\n )\n }\n\n return (\n <span\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(baseClasses, highlight && highlightClasses)}\n style={style}\n data-testid={testId}\n >\n {mainContent}\n </span>\n )\n})\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * EntityPill Component\n *\n * Base component for pill-style entity displays. Provides consistent styling and\n * interaction patterns. It is plain icon + text (no fill, no border); a\n * dotted underline identifies an in-platform content link; hover reveals extra actions.\n *\n * Pattern: [Icon] [Label] [Optional: secondary text] [MoreVertical when interactive]\n */\n\nimport { useEntityHref } from './links'\nimport React, { forwardRef } from 'react'\nimport { EntityActionsMenu, type EntityAction } from './EntityActionsMenu'\nimport { MoreVertical } from 'lucide-react'\nimport { cn } from '../lib/utils'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip'\n\n/**\n * The one size scale of the entity pills and avatars (`UserEntity`, `TagEntity`, `EntityPill`,\n * `DocumentEntity`, the call tiles...). Each takes the steps it draws: the pill itself has two,\n * `sm` for compact rows and `md` for a primary column or a tab header.\n */\nexport type EntitySize = 'xs' | 'sm' | 'md' | 'lg'\n\ninterface EntityPillProps {\n /** The icon element (Avatar, ShieldIcon, FileIcon, etc.) */\n icon: React.ReactNode\n /** Primary label text */\n label: string\n /** Optional secondary text (e.g., page notation \"p.1\") */\n secondaryText?: React.ReactNode\n\n // Styling\n /** `sm` (default) for compact rows, `md` for a primary column or a tab header. */\n size?: Extract<EntitySize, 'sm' | 'md'>\n /** Shape variant: 'pill' for rounded-full, 'rounded' for rounded-md */\n shape?: 'pill' | 'rounded'\n /** Additional CSS classes */\n className?: string\n style?: React.CSSProperties\n /** Max width for label truncation */\n labelMaxWidth?: string\n /** Extra classes on the label text (e.g. a heavier weight on a card face). */\n labelClassName?: string\n /** When true, the pill fills its container width (`flex w-full`) and the main\n * area flexes + truncates so the trailing control (\u22EF menu) pins to the right\n * edge \u2014 used by the documents table's Document column. Default: shrink-to-fit. */\n fullWidth?: boolean\n /** Emphasise the active reference with text colour and weight. */\n highlight?: boolean\n\n // Behavior\n /** Click handler for main area (icon + label) - primary action */\n onClick?: (e: React.MouseEvent) => void\n /** Click handler for icon only \u2014 when set, only the icon is clickable (not the label) */\n onIconClick?: (e: React.MouseEvent) => void\n /** Click handler for MoreVertical - opens popover/menu. When provided, shows MoreVertical icon */\n onMoreClick?: (e: React.MouseEvent) => void\n /** Custom trailing element (e.g. a \u22EF dropdown menu). Rendered in the same\n * trailing zone as MoreVertical, but as-is \u2014 so it stays outside the pill's\n * primary click area. Takes precedence over `onMoreClick`. */\n moreContent?: React.ReactNode\n /** Link URL - makes the main area an anchor tag */\n href?: string\n /** Copyable entity address when navigation is handled in place. */\n copyHref?: string\n /** A reference whose canonical URL comes from the host entities domain. */\n entityId?: string\n /** Additional contextual operations, alongside the standard Copy link. */\n actions?: EntityAction[]\n /** Whether the pill is disabled */\n disabled?: boolean\n /** For a pill that toggles a state on click: that state, exposed as `aria-pressed`. */\n pressed?: boolean\n\n // Tooltip\n /** Tooltip for main area (describes primary action, e.g., \"View document\") */\n tooltipContent?: React.ReactNode\n\n /** Test ID for testing */\n 'data-testid'?: string\n}\n\n/** Coarse pointers: a 44x44 (or wider, as wide as the pill) hit area centred on the pill. */\nconst PILL_TOUCH_HIT =\n \"pointer-coarse:after:absolute pointer-coarse:after:left-1/2 pointer-coarse:after:top-1/2 pointer-coarse:after:h-11 pointer-coarse:after:w-[max(100%,2.75rem)] pointer-coarse:after:-translate-x-1/2 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:content-['']\"\n\n/**\n * The main area of a pill with a separate \"more\" control: 44px tall but only as wide as the area,\n * so it never reaches over the \"more\" control and swallows its taps.\n */\nconst MAIN_AREA_TOUCH_HIT =\n \"relative pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:top-1/2 pointer-coarse:after:h-11 pointer-coarse:after:-translate-y-1/2 pointer-coarse:after:content-['']\"\n\nexport const EntityPill = forwardRef<HTMLElement, EntityPillProps>(function EntityPill(\n {\n icon,\n label,\n secondaryText,\n size = 'sm',\n shape = 'rounded',\n className,\n style,\n labelMaxWidth = 'max-w-[320px]',\n labelClassName,\n fullWidth = false,\n highlight = false,\n onClick,\n onIconClick,\n onMoreClick,\n moreContent,\n href,\n copyHref,\n entityId,\n actions,\n disabled = false,\n pressed,\n tooltipContent,\n 'data-testid': testId,\n },\n ref\n) {\n const hostHref = useEntityHref(entityId)\n const primaryRef = React.useRef<HTMLElement | null>(null)\n const shapeClass = shape === 'pill' ? 'rounded-full' : 'rounded-md'\n\n // Size-based classes\n const sizeClasses = size === 'md' ? 'gap-1.5 px-1.5 py-0.5' : 'gap-1 px-1'\n const textSizeClass = size === 'md' ? 'text-base' : 'text-sm'\n\n const baseClasses = cn(\n 'group/pill items-center',\n fullWidth ? 'flex w-full' : 'inline-flex',\n sizeClasses,\n shapeClass,\n 'min-w-0 max-w-full align-middle',\n 'transition-colors',\n className\n )\n\n // Coarse pointers: an invisible hit area of at least 44x44 centred on the pill (the pill itself\n // stays compact). Centred and sized, not inset: an absolute box is laid out against the padding\n // box, so `-inset-y-3` on a bordered 20px pill gave 42px, and an icon-only pill stayed 22px wide.\n const interactiveClasses = cn('relative cursor-pointer', PILL_TOUCH_HIT)\n const disabledClasses = 'cursor-default opacity-60'\n const highlightClasses = 'text-primary font-semibold'\n\n // Main content (icon + label + secondary text)\n const mainContent = (\n <>\n {onIconClick ? (\n <span\n role=\"button\"\n tabIndex={0}\n className=\"flex-shrink-0 cursor-pointer hover:opacity-70 transition-opacity\"\n onClick={(e) => {\n e.stopPropagation()\n onIconClick(e)\n }}\n >\n {icon}\n </span>\n ) : (\n icon\n )}\n <span\n className={cn(\n textSizeClass,\n 'font-medium tracking-[0.01em] truncate leading-tight min-w-0 underline decoration-dotted decoration-current/35 underline-offset-4',\n labelMaxWidth,\n labelClassName\n )}\n >\n {label}\n </span>\n {secondaryText && (\n <span className=\"text-xs text-muted-foreground flex-shrink-0 leading-none\">\n {secondaryText}\n </span>\n )}\n </>\n )\n\n // Helper: wrap any content in a Tooltip (no asChild \u2014 TooltipTrigger renders its own button)\n const tooltipWrap = (\n content: React.ReactNode,\n tip: React.ReactNode,\n side: 'top' | 'bottom' | 'left' | 'right' = 'bottom',\n triggerClassName?: string,\n triggerProps?: Record<string, unknown>\n ) => (\n <Tooltip>\n <TooltipTrigger\n onFocusCapture={(e) => e.stopPropagation()}\n className={triggerClassName}\n {...triggerProps}\n >\n {content}\n </TooltipTrigger>\n <TooltipContent side={side} className=\"p-2\">\n {tip}\n </TooltipContent>\n </Tooltip>\n )\n\n // With a separate \"more\" control the touch hit area must grow on the MAIN area only: an overlay on\n // the whole pill would sit above both inner buttons and swallow their taps.\n const mainAreaClass = cn('inline-flex min-w-0 items-center gap-1', fullWidth && 'flex-1')\n const mainAreaTouchClass = cn(\n mainAreaClass,\n (onClick || href) && !disabled && MAIN_AREA_TOUCH_HIT\n )\n\n const entityHref = copyHref ?? href ?? hostHref\n const defaultMenu =\n entityHref && !disabled ? (\n <EntityActionsMenu\n label={label}\n href={entityHref}\n actions={[\n ...(onClick || href\n ? [\n {\n id: 'open',\n label: 'Open',\n onSelect: () => {\n if (onClick) primaryRef.current?.click()\n else if (href) window.open(href, '_blank', 'noopener,noreferrer')\n },\n },\n ]\n : []),\n ...(actions ?? []),\n ]}\n />\n ) : null\n const trailing = moreContent ?? (onMoreClick ? null : defaultMenu)\n if (onMoreClick || trailing) {\n let mainArea: React.ReactNode\n if (tooltipContent && !href) {\n mainArea = tooltipWrap(\n mainContent,\n tooltipContent,\n 'bottom',\n cn(mainAreaTouchClass, disabled && 'opacity-60'),\n {\n ref: (el: HTMLElement | null) => {\n primaryRef.current = el\n },\n type: 'button',\n onClick: href ? onClick : disabled ? undefined : onClick,\n disabled: disabled || undefined,\n 'aria-pressed': href ? undefined : pressed,\n }\n )\n } else if (href) {\n mainArea = (\n <a\n ref={(el) => {\n primaryRef.current = el\n }}\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={mainAreaTouchClass}\n onClick={onClick}\n >\n {mainContent}\n </a>\n )\n } else if (onClick) {\n mainArea = (\n <button\n ref={(el) => {\n primaryRef.current = el\n }}\n type=\"button\"\n onClick={disabled ? undefined : onClick}\n disabled={disabled}\n aria-pressed={pressed}\n className={cn(mainAreaClass, MAIN_AREA_TOUCH_HIT, disabled && 'opacity-60')}\n >\n {mainContent}\n </button>\n )\n } else {\n mainArea = <span className={mainAreaTouchClass}>{mainContent}</span>\n }\n\n const moreArea = trailing ? (\n <span className=\"flex-shrink-0 leading-none opacity-0 transition-opacity group-hover/pill:opacity-100 group-focus-within/pill:opacity-100 has-[[data-state=open]]:opacity-100 pointer-coarse:opacity-100\">\n {trailing}\n </span>\n ) : (\n tooltipWrap(\n <MoreVertical className=\"w-3.5 h-3.5\" />,\n 'Click for more',\n 'bottom',\n 'flex-shrink-0 leading-none text-muted-foreground hover:text-foreground opacity-0 group-hover/pill:opacity-100 group-focus-within/pill:opacity-100 pointer-coarse:opacity-100',\n {\n type: 'button',\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation()\n onMoreClick?.(e)\n },\n }\n )\n )\n\n return (\n <span\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(\n baseClasses,\n (onClick || href) && !disabled && 'cursor-pointer',\n highlight && highlightClasses\n )}\n style={style}\n data-testid={testId}\n >\n {mainArea}\n {moreArea}\n </span>\n )\n }\n\n if (tooltipContent) {\n if (href) {\n return tooltipWrap(\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={mainAreaClass}\n onClick={onClick}\n >\n {mainContent}\n </a>,\n tooltipContent,\n 'bottom',\n cn(baseClasses, interactiveClasses),\n { 'data-testid': testId, style }\n )\n }\n\n return tooltipWrap(\n mainContent,\n tooltipContent,\n 'bottom',\n cn(\n baseClasses,\n onClick && !disabled ? interactiveClasses : '',\n disabled ? disabledClasses : '',\n highlight && highlightClasses\n ),\n {\n type: 'button',\n ref: ref as React.Ref<HTMLButtonElement>,\n onClick: onClick && !disabled ? onClick : undefined,\n disabled: disabled || undefined,\n 'aria-pressed': pressed,\n 'data-testid': testId,\n style,\n }\n )\n }\n\n if (href) {\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(baseClasses, interactiveClasses)}\n style={style}\n data-testid={testId}\n onClick={onClick}\n >\n {mainContent}\n </a>\n )\n }\n\n if (onClick) {\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n onClick={disabled ? undefined : onClick}\n disabled={disabled}\n aria-pressed={pressed}\n className={cn(\n baseClasses,\n disabled ? disabledClasses : interactiveClasses,\n highlight && highlightClasses\n )}\n style={style}\n data-testid={testId}\n >\n {mainContent}\n </button>\n )\n }\n\n return (\n <span\n ref={ref as React.Ref<HTMLSpanElement>}\n className={cn(baseClasses, highlight && highlightClasses)}\n style={style}\n data-testid={testId}\n >\n {mainContent}\n </span>\n )\n})\n"],
|
|
5
|
+
"mappings": "AAqJI,mBAEI,KAFJ;AA3IJ,SAAS,qBAAqB;AAC9B,OAAO,SAAS,kBAAkB;AAClC,SAAS,yBAA4C;AACrD,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,SAAS,gBAAgB,sBAAsB;AAqExD,MAAM,iBACJ;AAMF,MAAM,sBACJ;AAEK,MAAM,aAAa,WAAyC,SAASA,YAC1E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,QA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,CAAC,WAAW,qBAAqB;AAAA,QAC5C,WAAW,kBAAkB;AAAA,QAC7B,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN;AAAA,QACA,SAAS,WAAW,CAAC,WAAW,UAAU;AAAA,QAC1C,UAAU,YAAY;AAAA,QACtB,gBAAgB;AAAA,QAChB,eAAe;AAAA,QACf;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,MAAM;AACR,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,QAAO;AAAA,QACP,KAAI;AAAA,QACJ,WAAW,GAAG,aAAa,kBAAkB;AAAA,QAC7C;AAAA,QACA,eAAa;AAAA,QACb;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,MAAI,SAAS;AACX,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,SAAS,WAAW,SAAY;AAAA,QAChC;AAAA,QACA,gBAAc;AAAA,QACd,WAAW;AAAA,UACT;AAAA,UACA,WAAW,kBAAkB;AAAA,UAC7B,aAAa;AAAA,QACf;AAAA,QACA;AAAA,QACA,eAAa;AAAA,QAEZ;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,aAAa,aAAa,gBAAgB;AAAA,MACxD;AAAA,MACA,eAAa;AAAA,MAEZ;AAAA;AAAA,EACH;AAEJ,CAAC;",
|
|
6
6
|
"names": ["EntityPill"]
|
|
7
7
|
}
|
|
@@ -29,6 +29,8 @@ function resolveVariant(relation, paid, hasCollaborators) {
|
|
|
29
29
|
}
|
|
30
30
|
function ProjectEntity({
|
|
31
31
|
name,
|
|
32
|
+
copyHref,
|
|
33
|
+
projectId,
|
|
32
34
|
label,
|
|
33
35
|
icon,
|
|
34
36
|
subscription = "none",
|
|
@@ -48,6 +50,8 @@ function ProjectEntity({
|
|
|
48
50
|
{
|
|
49
51
|
icon: iconNode,
|
|
50
52
|
label: label ?? name,
|
|
53
|
+
copyHref,
|
|
54
|
+
entityId: projectId,
|
|
51
55
|
shape: "rounded",
|
|
52
56
|
className: cn(pill, className),
|
|
53
57
|
onClick,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/entities/ProjectEntity.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * ProjectEntity Component\n *\n * Fully-rounded pill for a \"project\" (a.k.a. a \"matter\" in some consumer apps).\n * The viewer's relationship to the project drives a TINTED (soft-fill) colour\n * so the kinds read at a glance without shouting:\n * - your paid project \u2192 primary tint\n * - someone else's \u2192 secondary tint\n * - your free project \u2192 grey tint\n * \"Common\" keeps the neutral muted pill.\n *\n * Promoted from the ARBI app and DECOUPLED: no store/stripe deps. The icon\n * defaults to the `CreditCard` glyph and can be overridden via `icon`, and\n * the display text via `label` (falls back to `name`) so consumers can relabel\n * a \"project\" as a \"matter\", \"case\", etc.\n */\n\nimport React from 'react'\nimport { CreditCard } from 'lucide-react'\nimport { EntityPill } from './EntityPill'\nimport { cn } from '../lib/utils'\n\nexport type ProjectRelation = 'mine' | 'other' | 'common'\n\nexport interface ProjectEntityProps {\n name: string\n /** Display text override (defaults to `name`) \u2014 lets a consumer relabel. */\n label?: string\n /** Icon override (defaults to the CreditCard glyph). */\n icon?: React.ReactNode\n subscription?: string\n hasCollaborators?: boolean\n className?: string\n onClick?: (e: React.MouseEvent) => void\n /** Viewer's relationship to the project \u2014 drives the inverted pill colour. */\n relation?: ProjectRelation\n /** Whether the given `subscription` should be treated as paid. When omitted,\n * it's inferred from the `subscription` value ('active' | 'past_due' | 'dev'). */\n isPaid?: boolean\n /** Hover tooltip. */\n tooltipContent?: React.ReactNode\n}\n\ntype PillVariant = 'mine-paid' | 'mine-free' | 'other' | 'common'\n\n// Colour lives in the text and icon only (paid / shared / free); there is no fill or\n// border
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * ProjectEntity Component\n *\n * Fully-rounded pill for a \"project\" (a.k.a. a \"matter\" in some consumer apps).\n * The viewer's relationship to the project drives a TINTED (soft-fill) colour\n * so the kinds read at a glance without shouting:\n * - your paid project \u2192 primary tint\n * - someone else's \u2192 secondary tint\n * - your free project \u2192 grey tint\n * \"Common\" keeps the neutral muted pill.\n *\n * Promoted from the ARBI app and DECOUPLED: no store/stripe deps. The icon\n * defaults to the `CreditCard` glyph and can be overridden via `icon`, and\n * the display text via `label` (falls back to `name`) so consumers can relabel\n * a \"project\" as a \"matter\", \"case\", etc.\n */\n\nimport React from 'react'\nimport { CreditCard } from 'lucide-react'\nimport { EntityPill } from './EntityPill'\nimport { cn } from '../lib/utils'\n\nexport type ProjectRelation = 'mine' | 'other' | 'common'\n\nexport interface ProjectEntityProps {\n name: string\n copyHref?: string\n projectId?: string\n /** Display text override (defaults to `name`) \u2014 lets a consumer relabel. */\n label?: string\n /** Icon override (defaults to the CreditCard glyph). */\n icon?: React.ReactNode\n subscription?: string\n hasCollaborators?: boolean\n className?: string\n onClick?: (e: React.MouseEvent) => void\n /** Viewer's relationship to the project \u2014 drives the inverted pill colour. */\n relation?: ProjectRelation\n /** Whether the given `subscription` should be treated as paid. When omitted,\n * it's inferred from the `subscription` value ('active' | 'past_due' | 'dev'). */\n isPaid?: boolean\n /** Hover tooltip. */\n tooltipContent?: React.ReactNode\n}\n\ntype PillVariant = 'mine-paid' | 'mine-free' | 'other' | 'common'\n\n// Colour lives in the text and icon only (paid / shared / free); there is no fill or\n// border, so the label reads as a quiet content link.\nconst VARIANT_STYLES: Record<PillVariant, { pill: string; icon: string }> = {\n 'mine-paid': {\n pill: 'text-primary',\n icon: 'text-primary',\n },\n other: {\n pill: 'text-secondary',\n icon: 'text-secondary',\n },\n 'mine-free': {\n pill: 'text-muted-foreground',\n icon: 'text-muted-foreground',\n },\n common: {\n pill: '',\n icon: 'text-muted-foreground',\n },\n}\n\nfunction resolveVariant(\n relation: ProjectRelation | undefined,\n paid: boolean,\n hasCollaborators: boolean\n): PillVariant {\n if (relation === 'common') return 'common'\n if (relation === 'other') return 'other'\n if (relation === 'mine') return paid ? 'mine-paid' : 'mine-free'\n // Legacy, subscription-driven callers (no relation given).\n if (paid) return hasCollaborators ? 'other' : 'mine-paid'\n return 'mine-free'\n}\n\nexport function ProjectEntity({\n name,\n copyHref,\n projectId,\n label,\n icon,\n subscription = 'none',\n hasCollaborators = false,\n className,\n onClick,\n relation,\n isPaid,\n tooltipContent,\n}: ProjectEntityProps) {\n const paid =\n isPaid ?? (subscription === 'active' || subscription === 'past_due' || subscription === 'dev')\n const variant = resolveVariant(relation, paid, hasCollaborators)\n const { pill, icon: iconClass } = VARIANT_STYLES[variant]\n\n const iconNode = icon ?? <CreditCard className={cn('h-3.5 w-3.5', iconClass)} />\n\n return (\n <EntityPill\n icon={iconNode}\n label={label ?? name}\n copyHref={copyHref}\n entityId={projectId}\n shape=\"rounded\"\n className={cn(pill, className)}\n onClick={onClick}\n tooltipContent={tooltipContent}\n />\n )\n}\n"],
|
|
5
|
+
"mappings": "AAoG2B;AAlF3B,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AA6BnB,MAAM,iBAAsE;AAAA,EAC1E,aAAa;AAAA,IACX,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AAEA,SAAS,eACP,UACA,MACA,kBACa;AACb,MAAI,aAAa,SAAU,QAAO;AAClC,MAAI,aAAa,QAAS,QAAO;AACjC,MAAI,aAAa,OAAQ,QAAO,OAAO,cAAc;AAErD,MAAI,KAAM,QAAO,mBAAmB,UAAU;AAC9C,SAAO;AACT;AAEO,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;AACrB,QAAM,OACJ,WAAW,iBAAiB,YAAY,iBAAiB,cAAc,iBAAiB;AAC1F,QAAM,UAAU,eAAe,UAAU,MAAM,gBAAgB;AAC/D,QAAM,EAAE,MAAM,MAAM,UAAU,IAAI,eAAe,OAAO;AAExD,QAAM,WAAW,QAAQ,oBAAC,cAAW,WAAW,GAAG,eAAe,SAAS,GAAG;AAE9E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,OAAO,SAAS;AAAA,MAChB;AAAA,MACA,UAAU;AAAA,MACV,OAAM;AAAA,MACN,WAAW,GAAG,MAAM,SAAS;AAAA,MAC7B;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/entities/TagEntity.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * TagEntity Component\n *\n * All tag identity displays use this component: a fully rounded, outlined label from the\n * shared sixteen-color entity-ID palette. Never substitute a plain-text name.\n * Single source of truth for tag visual appearance, promoted from the ARBI app\n * and DECOUPLED from the app store/API. It renders purely from the `tag` prop \u2014\n * the app-only bits (creator/updater lookup, visibility toggle, live doctag\n * count from the query cache) are dropped; pass `doctagCount`/`shared` if you\n * want them shown in the built-in tooltip, or inject a fully custom `tooltipContent`.\n */\n\nimport React from 'react'\nimport { EntityPill, type EntitySize } from './EntityPill'\nimport { getEntityColor } from './colors'\nimport { Badge } from '../ui/badge'\nimport { Check } from 'lucide-react'\nimport { getTagTypeLabel } from './tag-types'\n\n/** Minimal, decoupled tag shape the pill needs. */\nexport interface TagLike {\n external_id: string\n name: string\n /** Field value type, shown in the tooltip; the label identity icon stays consistent. */\n tag_type?: { type: string } | null\n /** Optional explicit color; when omitted it's derived from `external_id`. */\n color?: string\n /** Optional document count shown in the tooltip. */\n doctag_count?: number | null\n /** Optional shared/private flag shown in the tooltip. */\n shared?: boolean | null\n}\n\nexport interface TagEntityProps {\n tag: TagLike\n size?: Exclude<EntitySize, 'xs'>\n checked?: boolean\n onCheckedChange?: (checked: boolean) => void\n className?: string\n /** Wrap long tag names inside a table cell while retaining the pill. */\n wrap?: boolean\n onClick?: (e: React.MouseEvent) => void\n /** Whether to show a tooltip (default: true) */\n showTooltip?: boolean\n /** Injected tooltip override. When provided (and `showTooltip` is not false) it\n * replaces the built-in tooltip \u2014 used by the monolith to render its rich,\n * store-coupled tooltip (fresh count, creator/updater, visibility toggle). */\n tooltipContent?: React.ReactNode\n}\n\nexport function TagEntity({\n tag,\n size = 'md',\n checked = true,\n onCheckedChange,\n className = '',\n wrap = false,\n onClick,\n showTooltip = true,\n tooltipContent,\n}: TagEntityProps) {\n const tagType = tag.tag_type?.type ?? 'text'\n const iconSize = size === 'sm' ? 12 : size === 'md' ? 14 : 16\n\n const tagColor = tag.color ?? getEntityColor(tag.external_id, 'medium')\n const iconElement = onCheckedChange ? (\n <input\n type=\"checkbox\"\n aria-label={tag.name}\n checked={checked}\n onClick={(e) => e.stopPropagation()}\n onChange={(e) => onCheckedChange(e.target.checked)}\n className=\"shrink-0 cursor-pointer\"\n style={{ accentColor: tagColor, width: iconSize, height: iconSize }}\n />\n ) : (\n <span\n className=\"flex shrink-0 items-center justify-center rounded-sm border\"\n style={{\n width: iconSize,\n height: iconSize,\n borderColor: tagColor,\n backgroundColor: checked ? tagColor : undefined,\n }}\n aria-hidden=\"true\"\n >\n {checked && <Check size={iconSize - 2} color=\"#ffffff\" strokeWidth={3} />}\n </span>\n )\n\n const pillSize = size === 'lg' ? 'md' : 'sm'\n\n const defaultTooltip = (\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex flex-col gap-1.5 text-sm\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Type:</span>\n <span>{getTagTypeLabel(tagType)}</span>\n </div>\n\n {tag.doctag_count != null && (\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Documents:</span>\n <Badge variant=\"secondary\" className=\"h-5 min-w-[20px] justify-center\">\n {tag.doctag_count ?? 0}\n </Badge>\n </div>\n )}\n\n {tag.shared != null && (\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">{tag.shared ? 'Shared' : 'Private'}</span>\n </div>\n )}\n </div>\n </div>\n )\n\n const resolvedTooltip = showTooltip ? (tooltipContent ?? defaultTooltip) : undefined\n\n return (\n <EntityPill\n icon={iconElement}\n label={tag.name}\n size={pillSize}\n shape=\"pill\"\n style={{ borderColor: tagColor }}\n labelMaxWidth={wrap ? 'max-w-full' : 'max-w-[180px]'}\n labelClassName={wrap ? 'whitespace-normal! line-clamp-3 break-words text-left' : undefined}\n tooltipContent={onCheckedChange ? undefined : resolvedTooltip}\n onClick={onCheckedChange ? undefined : onClick}\n className={`max-w-full px-2! py-0.5! ${className}`}\n data-testid={`tag-entity-${tag.external_id}`}\n />\n )\n}\n"],
|
|
5
|
-
"mappings": "AAkEI,cA6BI,YA7BJ;AArDJ,SAAS,kBAAmC;AAC5C,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAiCzB,SAAS,UAAU;AAAA,EACxB;AAAA,EACA,OAAO;AAAA,EACP,UAAU;AAAA,EACV;AAAA,EACA,YAAY;AAAA,EACZ,OAAO;AAAA,EACP;AAAA,EACA,cAAc;AAAA,EACd;AACF,GAAmB;AACjB,QAAM,UAAU,IAAI,UAAU,QAAQ;AACtC,QAAM,WAAW,SAAS,OAAO,KAAK,SAAS,OAAO,KAAK;AAE3D,QAAM,WAAW,IAAI,SAAS,eAAe,IAAI,aAAa,QAAQ;AACtE,QAAM,cAA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M;AAAA,MACN,OAAO,EAAE,aAAa,SAAS;AAAA,MAC/B,eAAe,OAAO,eAAe;AAAA,MACrC,gBAAgB,OAAO,0DAA0D;AAAA,MACjF,gBAAgB,kBAAkB,SAAY;AAAA,MAC9C,SAAS,kBAAkB,SAAY;AAAA,MACvC,WAAW,4BAA4B,SAAS;AAAA,MAChD,eAAa,cAAc,IAAI,WAAW;AAAA;AAAA,EAC5C;AAEJ;",
|
|
4
|
+
"sourcesContent": ["/**\n * TagEntity Component\n *\n * All tag identity displays use this component: a fully rounded, outlined label from the\n * shared sixteen-color entity-ID palette. Never substitute a plain-text name.\n * Single source of truth for tag visual appearance, promoted from the ARBI app\n * and DECOUPLED from the app store/API. It renders purely from the `tag` prop \u2014\n * the app-only bits (creator/updater lookup, visibility toggle, live doctag\n * count from the query cache) are dropped; pass `doctagCount`/`shared` if you\n * want them shown in the built-in tooltip, or inject a fully custom `tooltipContent`.\n */\n\nimport React from 'react'\nimport { EntityPill, type EntitySize } from './EntityPill'\nimport { getEntityColor } from './colors'\nimport { Badge } from '../ui/badge'\nimport { Check } from 'lucide-react'\nimport { getTagTypeLabel } from './tag-types'\n\n/** Minimal, decoupled tag shape the pill needs. */\nexport interface TagLike {\n external_id: string\n name: string\n /** Field value type, shown in the tooltip; the label identity icon stays consistent. */\n tag_type?: { type: string } | null\n /** Optional explicit color; when omitted it's derived from `external_id`. */\n color?: string\n /** Optional document count shown in the tooltip. */\n doctag_count?: number | null\n /** Optional shared/private flag shown in the tooltip. */\n shared?: boolean | null\n}\n\nexport interface TagEntityProps {\n tag: TagLike\n size?: Exclude<EntitySize, 'xs'>\n checked?: boolean\n onCheckedChange?: (checked: boolean) => void\n className?: string\n /** Wrap long tag names inside a table cell while retaining the pill. */\n wrap?: boolean\n onClick?: (e: React.MouseEvent) => void\n /** Whether to show a tooltip (default: true) */\n showTooltip?: boolean\n /** Injected tooltip override. When provided (and `showTooltip` is not false) it\n * replaces the built-in tooltip \u2014 used by the monolith to render its rich,\n * store-coupled tooltip (fresh count, creator/updater, visibility toggle). */\n tooltipContent?: React.ReactNode\n}\n\nexport function TagEntity({\n tag,\n size = 'md',\n checked = true,\n onCheckedChange,\n className = '',\n wrap = false,\n onClick,\n showTooltip = true,\n tooltipContent,\n}: TagEntityProps) {\n const tagType = tag.tag_type?.type ?? 'text'\n const iconSize = size === 'sm' ? 12 : size === 'md' ? 14 : 16\n\n const tagColor = tag.color ?? getEntityColor(tag.external_id, 'medium')\n const iconElement = onCheckedChange ? (\n <input\n type=\"checkbox\"\n aria-label={tag.name}\n checked={checked}\n onClick={(e) => e.stopPropagation()}\n onChange={(e) => onCheckedChange(e.target.checked)}\n className=\"shrink-0 cursor-pointer\"\n style={{ accentColor: tagColor, width: iconSize, height: iconSize }}\n />\n ) : (\n <span\n className=\"flex shrink-0 items-center justify-center rounded-sm border\"\n style={{\n width: iconSize,\n height: iconSize,\n borderColor: tagColor,\n backgroundColor: checked ? tagColor : undefined,\n }}\n aria-hidden=\"true\"\n >\n {checked && <Check size={iconSize - 2} color=\"#ffffff\" strokeWidth={3} />}\n </span>\n )\n\n const pillSize = size === 'lg' ? 'md' : 'sm'\n\n const defaultTooltip = (\n <div className=\"flex flex-col gap-2\">\n <div className=\"flex flex-col gap-1.5 text-sm\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Type:</span>\n <span>{getTagTypeLabel(tagType)}</span>\n </div>\n\n {tag.doctag_count != null && (\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">Documents:</span>\n <Badge variant=\"secondary\" className=\"h-5 min-w-[20px] justify-center\">\n {tag.doctag_count ?? 0}\n </Badge>\n </div>\n )}\n\n {tag.shared != null && (\n <div className=\"flex items-center gap-2\">\n <span className=\"text-muted-foreground\">{tag.shared ? 'Shared' : 'Private'}</span>\n </div>\n )}\n </div>\n </div>\n )\n\n const resolvedTooltip = showTooltip ? (tooltipContent ?? defaultTooltip) : undefined\n\n return (\n <EntityPill\n icon={iconElement}\n label={tag.name}\n entityId={!onCheckedChange && onClick ? tag.external_id : undefined}\n size={pillSize}\n shape=\"pill\"\n style={{ borderColor: tagColor }}\n labelMaxWidth={wrap ? 'max-w-full' : 'max-w-[180px]'}\n labelClassName={wrap ? 'whitespace-normal! line-clamp-3 break-words text-left' : undefined}\n tooltipContent={onCheckedChange ? undefined : resolvedTooltip}\n onClick={onCheckedChange ? undefined : onClick}\n className={`max-w-full px-2! py-0.5! ${className}`}\n data-testid={`tag-entity-${tag.external_id}`}\n />\n )\n}\n"],
|
|
5
|
+
"mappings": "AAkEI,cA6BI,YA7BJ;AArDJ,SAAS,kBAAmC;AAC5C,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAiCzB,SAAS,UAAU;AAAA,EACxB;AAAA,EACA,OAAO;AAAA,EACP,UAAU;AAAA,EACV;AAAA,EACA,YAAY;AAAA,EACZ,OAAO;AAAA,EACP;AAAA,EACA,cAAc;AAAA,EACd;AACF,GAAmB;AACjB,QAAM,UAAU,IAAI,UAAU,QAAQ;AACtC,QAAM,WAAW,SAAS,OAAO,KAAK,SAAS,OAAO,KAAK;AAE3D,QAAM,WAAW,IAAI,SAAS,eAAe,IAAI,aAAa,QAAQ;AACtE,QAAM,cAAc,kBAClB;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAY,IAAI;AAAA,MAChB;AAAA,MACA,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,MAClC,UAAU,CAAC,MAAM,gBAAgB,EAAE,OAAO,OAAO;AAAA,MACjD,WAAU;AAAA,MACV,OAAO,EAAE,aAAa,UAAU,OAAO,UAAU,QAAQ,SAAS;AAAA;AAAA,EACpE,IAEA;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,aAAa;AAAA,QACb,iBAAiB,UAAU,WAAW;AAAA,MACxC;AAAA,MACA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{ VerifiedBadge } from "./VerifiedBadge.js";
|
|
7
7
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
|
|
8
8
|
import { cn } from "../lib/utils.js";
|
|
9
|
+
import { useEntityHref } from "./links.js";
|
|
10
|
+
import { EntityPill } from "./EntityPill.js";
|
|
9
11
|
const sizeClasses = {
|
|
10
12
|
xs: "h-5 w-5",
|
|
11
13
|
sm: "h-6 w-6",
|
|
@@ -63,8 +65,11 @@ const UserEntity = memo(function UserEntity2({
|
|
|
63
65
|
displayStatus,
|
|
64
66
|
onClick,
|
|
65
67
|
tooltipContent,
|
|
66
|
-
empty = false
|
|
68
|
+
empty = false,
|
|
69
|
+
copyHref,
|
|
70
|
+
entityId
|
|
67
71
|
}) {
|
|
72
|
+
const entityHref = useEntityHref(entityId);
|
|
68
73
|
if (empty) {
|
|
69
74
|
return /* @__PURE__ */ jsx(
|
|
70
75
|
Avatar,
|
|
@@ -150,16 +155,33 @@ const UserEntity = memo(function UserEntity2({
|
|
|
150
155
|
] })
|
|
151
156
|
);
|
|
152
157
|
const resolvedTooltip = showTooltip ? tooltipContent : void 0;
|
|
158
|
+
if (variant === "pill" && (copyHref || entityHref))
|
|
159
|
+
return /* @__PURE__ */ jsx("span", { "data-variant": "pill", children: /* @__PURE__ */ jsx(
|
|
160
|
+
EntityPill,
|
|
161
|
+
{
|
|
162
|
+
icon: pillAvatar,
|
|
163
|
+
label: displayName || "Person",
|
|
164
|
+
secondaryText: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
165
|
+
isVerified && !isAgent && /* @__PURE__ */ jsx(VerifiedBadge, {}),
|
|
166
|
+
agentBadge
|
|
167
|
+
] }),
|
|
168
|
+
copyHref: copyHref || entityHref,
|
|
169
|
+
onClick: interactive ? onClick : void 0,
|
|
170
|
+
tooltipContent: resolvedTooltip,
|
|
171
|
+
className,
|
|
172
|
+
"data-testid": "user-entity-pill"
|
|
173
|
+
}
|
|
174
|
+
) });
|
|
153
175
|
if (variant === "pill") {
|
|
154
176
|
const row = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
155
177
|
pillAvatar,
|
|
156
|
-
displayName && /* @__PURE__ */ jsx("span", { className: "min-w-0 max-w-[320px] truncate text-sm leading-tight", children: displayName }),
|
|
178
|
+
displayName && /* @__PURE__ */ jsx("span", { className: "min-w-0 max-w-[320px] truncate text-sm font-medium tracking-[0.01em] underline decoration-dotted decoration-current/35 underline-offset-4 leading-tight", children: displayName }),
|
|
157
179
|
isVerified && !isAgent && /* @__PURE__ */ jsx(VerifiedBadge, {}),
|
|
158
180
|
agentBadge
|
|
159
181
|
] });
|
|
160
182
|
const rowClass = "group/pill inline-flex min-w-0 items-center gap-2";
|
|
161
183
|
const clickable = interactive && !!onClick;
|
|
162
|
-
const clickableClass = "relative cursor-pointer rounded-md px-1 py-0.5 -mx-1 transition-colors
|
|
184
|
+
const clickableClass = "relative cursor-pointer rounded-md px-1 py-0.5 -mx-1 transition-colors pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:-inset-y-3 pointer-coarse:after:content-['']";
|
|
163
185
|
if (resolvedTooltip) {
|
|
164
186
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
165
187
|
/* @__PURE__ */ jsx(
|