@alfadocs/ui-kit-debug 0.99.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/_chunks/{clinical-note-card-C7F_24IC.js → clinical-note-card-D63x_AkK.js} +5 -2
- package/dist/_chunks/clinical-note-card-D63x_AkK.js.map +1 -0
- package/dist/_chunks/{notes-panel-BKwd-bOV.js → notes-panel-CTcOLLVo.js} +3 -3
- package/dist/_chunks/{notes-panel-BKwd-bOV.js.map → notes-panel-CTcOLLVo.js.map} +1 -1
- package/dist/_chunks/{rich-text-editor-DHpV2q6d.js → rich-text-editor-CfeXPPWs.js} +10 -2
- package/dist/_chunks/rich-text-editor-CfeXPPWs.js.map +1 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/clinical-note-card/clinical-note-card.d.ts.map +1 -1
- package/dist/components/clinical-note-card/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/rich-text-editor/help-me-write-overlay.d.ts.map +1 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/index.js +3 -3
- package/dist/tokens.css +1 -1
- package/package.json +4 -2
- package/dist/_chunks/clinical-note-card-C7F_24IC.js.map +0 -1
- package/dist/_chunks/rich-text-editor-DHpV2q6d.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
The AlfaDocs design system — React components, tokens, and translations.
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> Released. Breaking changes land in majors and are called out in
|
|
6
|
+
> [CHANGELOG.md](./CHANGELOG.md).
|
|
6
7
|
|
|
7
8
|
## Install
|
|
8
9
|
|
|
@@ -100,7 +100,10 @@ const te = [
|
|
|
100
100
|
"[&_a]:ds:underline [&_a]:ds:underline-offset-2",
|
|
101
101
|
"[&_code]:ds:rounded-[var(--radius-sm)] [&_code]:ds:bg-muted/30 [&_code]:ds:ps-[var(--spacing-xs)] [&_code]:ds:pe-[var(--spacing-xs)] [&_code]:ds:font-[family-name:var(--font-mono)]",
|
|
102
102
|
"[&_p]:ds:m-0 [&_p+p]:ds:mt-[var(--spacing-sm)]",
|
|
103
|
-
|
|
103
|
+
// `list-disc` / `list-decimal` are load-bearing: the card renders host
|
|
104
|
+
// HTML inside `[data-component]`, where preflight's `list-style: none`
|
|
105
|
+
// still applies. Without them the indent lands but the markers do not.
|
|
106
|
+
"ds:[&_ul]:m-0 ds:[&_ul]:ps-[var(--spacing-md)] ds:[&_ul]:list-disc ds:[&_ol]:m-0 ds:[&_ol]:ps-[var(--spacing-md)] ds:[&_ol]:list-decimal",
|
|
104
107
|
// Rich-text (Redactor) extras — harmless on markdown notes, which carry
|
|
105
108
|
// none of these tags. Headings, inline images and tables stay readable.
|
|
106
109
|
"[&_h2]:type-title-item [&_h3]:type-title-item [&_h2]:ds:m-0 [&_h3]:ds:m-0",
|
|
@@ -433,4 +436,4 @@ export {
|
|
|
433
436
|
pe as C,
|
|
434
437
|
ne as c
|
|
435
438
|
};
|
|
436
|
-
//# sourceMappingURL=clinical-note-card-
|
|
439
|
+
//# sourceMappingURL=clinical-note-card-D63x_AkK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clinical-note-card-D63x_AkK.js","sources":["../../node_modules/lucide-react/dist/esm/icons/flag.mjs","../../node_modules/lucide-react/dist/esm/icons/pin.mjs","../../src/components/clinical-note-card/clinical-note-card.agent.ts","../../src/components/clinical-note-card/clinical-note-card.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528\",\n key: \"1jaruq\"\n }\n ]\n];\nconst Flag = createLucideIcon(\"flag\", __iconNode);\n\nexport { __iconNode, Flag as default };\n//# sourceMappingURL=flag.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M12 17v5\", key: \"bb1du9\" }],\n [\n \"path\",\n {\n d: \"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z\",\n key: \"1nkz8b\"\n }\n ]\n];\nconst Pin = createLucideIcon(\"pin\", __iconNode);\n\nexport { __iconNode, Pin as default };\n//# sourceMappingURL=pin.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — ClinicalNoteCard. */\n/* */\n/* Read-only presentation surface. Exposes the note's id + structural */\n/* flags (pinned / flagged / attachment kind) so a future MCP UI bridge */\n/* can locate and describe a rendered note. NEVER reads the note body or */\n/* any author identity — those are PHI and stay out of the agent layer. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ClinicalNoteCardHandle } from './clinical-note-card';\n\nexport const clinicalNoteCardAgent: AgentAdapter<ClinicalNoteCardHandle> = {\n id: 'clinical-note-card',\n capabilities: [],\n state: {\n noteId: {\n type: 'string | undefined',\n descriptionKey: 'ui.agent.clinicalNoteCard.state.noteId',\n description: 'Stable identifier of the rendered note, when supplied.',\n read: (handle) => handle.getNoteId(),\n },\n pinned: {\n type: 'boolean',\n descriptionKey: 'ui.agent.clinicalNoteCard.state.pinned',\n description: 'Whether the note is pinned to the top of the timeline.',\n read: (handle) => handle.isPinned(),\n },\n flagged: {\n type: 'boolean',\n descriptionKey: 'ui.agent.clinicalNoteCard.state.flagged',\n description: 'Whether the note is flagged for follow-up.',\n read: (handle) => handle.isFlagged(),\n },\n attachmentKind: {\n type: \"'patient' | 'carePlan' | 'carePlanEntry' | 'phase' | 'xray' | undefined\",\n descriptionKey: 'ui.agent.clinicalNoteCard.state.attachmentKind',\n description:\n 'Structural kind the note is attached to. Never the attachment identity or content.',\n read: (handle) => handle.getAttachmentKind(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'clinical-note-card',\n description:\n 'Marks the ClinicalNoteCard root. Also emits data-pinned / data-flagged / data-attached-to structural hooks.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop — addresses a specific note.',\n },\n },\n};\n","import {\n forwardRef,\n useId,\n useMemo,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Flag, Pin, FileText, Layers, ScanLine, User } from 'lucide-react';\nimport { Avatar } from '../avatar/avatar';\nimport { Badge } from '../badge/badge';\nimport { Card } from '../card/card';\nimport { Link } from '../link/link';\nimport { Timestamp } from '../timestamp';\nimport { SafeHtml } from '../_shared/safe-html';\nimport { isSafeEntityUrl } from '../_shared/is-safe-url';\nimport { useClampOverflow } from '../../hooks/use-clamp-overflow';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { clinicalNoteCardAgent } from './clinical-note-card.agent';\n\n/* -------------------------------------------------------------------- */\n/* ClinicalNoteCard */\n/* */\n/* A single clinical note — the free-text annotation an operator writes */\n/* against a patient, care plan, treatment phase, or x-ray. Replaces the */\n/* bespoke \"nota clinica\" rows scattered across the platform patient */\n/* timeline. Composes Card + Avatar (author) + Timestamp + Badge/Tag */\n/* (clinical / pinned / flagged) + Link (attachment) and renders the */\n/* markdown body through the shared SafeHtml helper — the only sanctioned */\n/* carrier of dangerouslySetInnerHTML (constraint §8). */\n/* */\n/* All visible text flows through useTranslation('ui') against the */\n/* `clinicalNoteCard.*` namespace. No PHI is read by the agent adapter — */\n/* only the note id and structural flags are exposed. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\n/** Author identity — drives the avatar + visible byline. */\nexport interface ClinicalNoteAuthor {\n /** Display name. */\n name: string;\n /** Optional avatar image URL. */\n avatarUrl?: string;\n}\n\n/**\n * What the note is attached to. Discriminated by `kind`:\n * - `patient` — a free-standing note on the patient record.\n * - `carePlan` — attached to a care plan (estimate / treatment plan),\n * identified by its number, with an optional deep link.\n * - `carePlanEntry` — attached to one entry inside a care plan, naming the\n * care and (optionally) the listed elements.\n * - `phase` — attached to a treatment phase, labelled.\n * - `xray` — attached to an x-ray / radiograph, optionally labelled.\n */\nexport type NoteAttachment =\n | { kind: 'patient' }\n | { kind: 'carePlan'; number: string; url?: string }\n | { kind: 'carePlanEntry'; careName: string; elements?: string[] }\n | { kind: 'phase'; label: string }\n | { kind: 'xray'; label?: string };\n\n/** Imperative handle exposed to the agent runtime — identifiers / flags only. */\nexport interface ClinicalNoteCardHandle {\n /** The note's stable id, when supplied. */\n getNoteId: () => string | undefined;\n /** Whether the note is currently pinned. */\n isPinned: () => boolean;\n /** Whether the note is currently flagged. */\n isFlagged: () => boolean;\n /** The attachment kind the note is bound to. */\n getAttachmentKind: () => NoteAttachment['kind'] | undefined;\n}\n\nexport interface ClinicalNoteCardProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'aria-label' | 'children' | 'content' | 'title'\n> {\n /** Agent-readiness consumer id, surfaced as `data-component-id`. */\n id?: string;\n /**\n * ISO-8601 timestamp the note refers to (the clinical date). Drives the\n * primary `<Timestamp>`.\n */\n dateIso: string;\n /**\n * ISO-8601 timestamp the note was authored, when it differs from\n * `dateIso`. Rendered as a secondary \"added\" line.\n */\n createdAtIso?: string;\n /** Author identity — avatar + byline. Optional for system notes. */\n author?: ClinicalNoteAuthor;\n /**\n * Whether this is a clinical note (vs. an administrative one). When true a\n * \"Clinical\" badge is shown so the note's nature is unambiguous at a glance.\n */\n clinical?: boolean;\n /** What the note is attached to — drives a contextual chip + optional link. */\n attachedTo?: NoteAttachment;\n /**\n * The note body, authored in a small, safe subset of Markdown (bold,\n * italic, inline code, links, line breaks, simple lists). Rendered through\n * the shared `SafeHtml` helper with the `markdown` sanitiser profile —\n * raw HTML and unsafe link schemes are stripped.\n */\n content: string;\n /**\n * How `content` is authored. `'markdown'` (default) runs the small Markdown\n * subset through the converter; `'html'` treats `content` as rich HTML\n * (e.g. Redactor output) and renders it through SafeHtml's `rich-text`\n * profile, so colours, sizes, tables and images survive sanitisation.\n */\n contentFormat?: 'markdown' | 'html';\n /** Pin the note to the top of a timeline — shows a \"Pinned\" chip. */\n pinned?: boolean;\n /** Flag the note for follow-up / attention — shows a \"Flagged\" chip. */\n flagged?: boolean;\n /**\n * When provided, the pinned chip becomes an `aria-pressed` toggle button so\n * the note can be (un)pinned in place — the pin glyph fills and tints to the\n * accent when pinned (no button fill). Omit for a static, display-only card.\n */\n onTogglePin?: () => void;\n /** As `onTogglePin`, for the flagged state (warning-tinted when flagged). */\n onToggleFlag?: () => void;\n /**\n * Clamp the rendered body to five lines. When the body is taller than the\n * clamp, a \"Read more\" / \"Read less\" disclosure toggles the full text in\n * place — the note stays a read-only display surface, so this is the\n * sighted-user escape hatch (assistive tech reads the full body regardless).\n */\n truncate?: boolean;\n /**\n * `'elevated'` (default) wraps the note in `<Card variant=\"elevated\">`.\n * `'flat'` drops the chrome for use inside an existing Card / timeline rail.\n */\n surface?: 'flat' | 'elevated';\n /** Override the default region aria-label. */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva('ds:w-full ds:text-[color:var(--foreground)]', {\n variants: {\n surface: { flat: '', elevated: '' },\n },\n defaultVariants: { surface: 'elevated' },\n});\n\n/* Body clamp — applied only when `truncate` is set. Logical-safe. */\nconst bodyVariants = cva(\n [\n 'type-body-sm ds:text-[color:var(--foreground)]',\n 'ds:break-words',\n '[&_a]:ds:underline [&_a]:ds:underline-offset-2',\n '[&_code]:ds:rounded-[var(--radius-sm)] [&_code]:ds:bg-muted/30 [&_code]:ds:ps-[var(--spacing-xs)] [&_code]:ds:pe-[var(--spacing-xs)] [&_code]:ds:font-[family-name:var(--font-mono)]',\n '[&_p]:ds:m-0 [&_p+p]:ds:mt-[var(--spacing-sm)]',\n // `list-disc` / `list-decimal` are load-bearing: the card renders host\n // HTML inside `[data-component]`, where preflight's `list-style: none`\n // still applies. Without them the indent lands but the markers do not.\n 'ds:[&_ul]:m-0 ds:[&_ul]:ps-[var(--spacing-md)] ds:[&_ul]:list-disc ds:[&_ol]:m-0 ds:[&_ol]:ps-[var(--spacing-md)] ds:[&_ol]:list-decimal',\n // Rich-text (Redactor) extras — harmless on markdown notes, which carry\n // none of these tags. Headings, inline images and tables stay readable.\n '[&_h2]:type-title-item [&_h3]:type-title-item [&_h2]:ds:m-0 [&_h3]:ds:m-0',\n '[&_img]:ds:max-w-full [&_img]:ds:h-auto [&_img]:ds:rounded-[var(--radius-sm)]',\n '[&_table]:ds:my-[var(--spacing-sm)] [&_table]:ds:w-full [&_table]:ds:border-collapse',\n '[&_th]:ds:border [&_th]:ds:border-[color:var(--border)] [&_th]:ds:ps-[var(--spacing-xs)] [&_th]:ds:pe-[var(--spacing-xs)] [&_th]:ds:py-[var(--spacing-2xs)] [&_th]:ds:text-start',\n '[&_td]:ds:border [&_td]:ds:border-[color:var(--border)] [&_td]:ds:ps-[var(--spacing-xs)] [&_td]:ds:pe-[var(--spacing-xs)] [&_td]:ds:py-[var(--spacing-2xs)]',\n ].join(' '),\n {\n variants: {\n truncate: {\n true: 'ds:[overflow:hidden] ds:[display:-webkit-box] ds:[-webkit-box-orient:vertical] ds:[-webkit-line-clamp:5]',\n false: '',\n },\n },\n defaultVariants: { truncate: false },\n },\n);\n\n/* -------------------------------------------------------------------- */\n/* Inline affordances — pin / flag toggle + read-more disclosure */\n/* -------------------------------------------------------------------- */\n\n/* Pin / flag toggle. A raw button (not IconButton) so the pressed state\n reads as a FILLED glyph + colour tint rather than a filled button — the\n same treatment as the Sidebar favourite star. The compact box keeps a\n --min-target-size hit area on touch via the ::before expansion. */\nconst noteToggleBase = [\n 'ds:relative ds:inline-flex ds:items-center ds:justify-center ds:shrink-0',\n 'ds:size-7 ds:rounded-[var(--radius-sm)]',\n 'ds:before:absolute ds:before:inset-x-[calc((var(--min-target-size)-100%)/-2)] ds:before:inset-y-[calc((var(--min-target-size)-100%)/-2)] ds:before:content-[\"\"] ds:sm:before:hidden',\n 'ds:hover:bg-[color:var(--muted)]/20',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:transition-[color,background-color] ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n].join(' ');\n\n/* Read-more / read-less disclosure — an inline text toggle in the flow of\n the body copy (exempt from target-size the same way an inline link is). */\nconst readMoreClasses = [\n 'ds:mt-[var(--spacing-2xs)] ds:inline-flex ds:items-center ds:self-start',\n 'ds:text-[length:var(--font-size-xs)] ds:font-semibold',\n 'ds:underline ds:underline-offset-2 ds:text-[color:var(--primary)] ds:hover:no-underline',\n 'ds:rounded-[var(--radius-sm)]',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n].join(' ');\n\ninterface NoteToggleProps {\n /** The lucide glyph, pre-configured with `fill` + size by the caller. */\n icon: ReactNode;\n /** Current pressed state. */\n pressed: boolean;\n /** Accessible label (flips between the on / off verb). */\n label: string;\n /** Colour class applied while pressed (accent for pin, warning for flag). */\n activeClassName: string;\n onToggle: () => void;\n}\n\nfunction NoteToggle({\n icon,\n pressed,\n label,\n activeClassName,\n onToggle,\n}: NoteToggleProps) {\n return (\n <button\n type=\"button\"\n aria-pressed={pressed}\n aria-label={label}\n onClick={onToggle}\n className={[\n noteToggleBase,\n pressed\n ? activeClassName\n : 'ds:text-[color:var(--muted-foreground)] ds:hover:text-[color:var(--foreground)]',\n ].join(' ')}\n >\n {icon}\n </button>\n );\n}\n\n/* -------------------------------------------------------------------- */\n/* Markdown → safe HTML */\n/* */\n/* A dependency-free converter for the small Markdown subset the note */\n/* body supports. The output is then passed to `SafeHtml` (markdown */\n/* profile) which strips everything outside the allow-list — so even a */\n/* hostile note can only ever emit the sanitised tag set. We never call */\n/* dangerouslySetInnerHTML ourselves; SafeHtml is the single carrier. */\n/* -------------------------------------------------------------------- */\n\n/** HTML-escape a raw text run before re-inserting our own safe markup. */\nfunction escapeHtml(input: string): string {\n return input\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\n/** Apply inline markdown (bold, italic, code, links) to an escaped run. */\nfunction renderInlineHtml(escaped: string): string {\n let out = escaped;\n // Inline code first so its contents aren't re-processed.\n out = out.replace(/`([^`]+)`/g, '<code>$1</code>');\n out = out.replace(/\\*\\*([^*]+)\\*\\*/g, '<strong>$1</strong>');\n out = out.replace(/\\*([^*]+)\\*/g, '<em>$1</em>');\n // Links — the href is left as-authored; SafeHtml's markdown profile\n // rejects any scheme outside http(s)/mailto/tel at sanitise time.\n out = out.replace(\n /\\[([^\\]]+)\\]\\(([^)\\s]+)\\)/g,\n '<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>',\n );\n return out;\n}\n\n/** Convert the supported Markdown subset into an HTML string. */\nfunction markdownToHtml(input: string): string {\n const blocks = input.split(/\\n{2,}/);\n return blocks\n .map((block) => {\n const lines = block.split('\\n');\n const isUnordered = lines.every((l) => /^\\s*[-*]\\s+/.test(l));\n const isOrdered = lines.every((l) => /^\\s*\\d+\\.\\s+/.test(l));\n if (isUnordered && lines.length > 0) {\n const items = lines\n .map((l) => l.replace(/^\\s*[-*]\\s+/, ''))\n .map((l) => `<li>${renderInlineHtml(escapeHtml(l))}</li>`)\n .join('');\n return `<ul>${items}</ul>`;\n }\n if (isOrdered && lines.length > 0) {\n const items = lines\n .map((l) => l.replace(/^\\s*\\d+\\.\\s+/, ''))\n .map((l) => `<li>${renderInlineHtml(escapeHtml(l))}</li>`)\n .join('');\n return `<ol>${items}</ol>`;\n }\n const paragraph = renderInlineHtml(escapeHtml(block)).replace(\n /\\n/g,\n '<br />',\n );\n return `<p>${paragraph}</p>`;\n })\n .join('');\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const ClinicalNoteCard = forwardRef<\n HTMLDivElement,\n ClinicalNoteCardProps\n>(\n (\n {\n id,\n dateIso,\n createdAtIso,\n author,\n clinical,\n attachedTo,\n content,\n contentFormat = 'markdown',\n pinned,\n flagged,\n onTogglePin,\n onToggleFlag,\n truncate = false,\n surface = 'elevated',\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const headingId = useId();\n const bodyId = useId();\n const [expanded, setExpanded] = useState(false);\n\n // Only measure while clamped — once expanded there's nothing to clip.\n const { ref: clampRef, isOverflowing } = useClampOverflow<HTMLDivElement>(\n truncate && !expanded,\n );\n // Show the disclosure once the body overflows; keep it while expanded so\n // the user can collapse again.\n const showReadMore = truncate && (isOverflowing || expanded);\n\n // Markdown notes are converted to a safe HTML subset; rich-text (Redactor)\n // notes are passed through verbatim and sanitised by SafeHtml's broader\n // `rich-text` profile at render. Either way SafeHtml is the only carrier.\n const bodyHtml = useMemo(\n () => (contentFormat === 'html' ? content : markdownToHtml(content)),\n [content, contentFormat],\n );\n\n const resolvedAriaLabel = ariaLabel ?? t('clinicalNoteCard.regionLabel');\n\n useAgentRegistration(\n clinicalNoteCardAgent,\n {\n getNoteId: () => id,\n isPinned: () => !!pinned,\n isFlagged: () => !!flagged,\n getAttachmentKind: () => attachedTo?.kind,\n },\n id,\n );\n\n /* ----- Attachment chip / link ----- */\n let attachmentNode: ReactNode = null;\n if (attachedTo) {\n switch (attachedTo.kind) {\n case 'patient':\n attachmentNode = (\n <Badge\n variant=\"neutral\"\n size=\"sm\"\n leading={<User aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.attachment.patient')}\n </Badge>\n );\n break;\n case 'carePlan': {\n const label = t('clinicalNoteCard.attachment.carePlan', {\n number: attachedTo.number,\n });\n attachmentNode =\n attachedTo.url && isSafeEntityUrl(attachedTo.url) ? (\n <Link\n href={attachedTo.url}\n intent=\"default\"\n startIcon={<FileText aria-hidden=\"true\" />}\n >\n {label}\n </Link>\n ) : (\n <Badge\n variant=\"info\"\n size=\"sm\"\n leading={<FileText aria-hidden=\"true\" />}\n >\n {label}\n </Badge>\n );\n break;\n }\n case 'carePlanEntry': {\n const label =\n attachedTo.elements && attachedTo.elements.length > 0\n ? t('clinicalNoteCard.attachment.carePlanEntryWithElements', {\n care: attachedTo.careName,\n elements: attachedTo.elements.join(', '),\n })\n : t('clinicalNoteCard.attachment.carePlanEntry', {\n care: attachedTo.careName,\n });\n attachmentNode = (\n <Badge\n variant=\"info\"\n size=\"sm\"\n leading={<FileText aria-hidden=\"true\" />}\n >\n {label}\n </Badge>\n );\n break;\n }\n case 'phase':\n attachmentNode = (\n <Badge\n variant=\"neutral\"\n size=\"sm\"\n leading={<Layers aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.attachment.phase', {\n label: attachedTo.label,\n })}\n </Badge>\n );\n break;\n case 'xray':\n attachmentNode = (\n <Badge\n variant=\"neutral\"\n size=\"sm\"\n leading={<ScanLine aria-hidden=\"true\" />}\n >\n {attachedTo.label\n ? t('clinicalNoteCard.attachment.xrayWithLabel', {\n label: attachedTo.label,\n })\n : t('clinicalNoteCard.attachment.xray')}\n </Badge>\n );\n break;\n }\n }\n\n const inner = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {/* Header: author + date + status chips */}\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-sm)]\">\n {author ? (\n <Avatar\n name={author.name}\n src={author.avatarUrl}\n size=\"sm\"\n className=\"ds:shrink-0\"\n aria-hidden=\"true\"\n role=\"presentation\"\n aria-label={undefined}\n />\n ) : null}\n <div className=\"ds:flex-1 ds:min-w-0 ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n {author ? (\n <span\n id={headingId}\n className=\"type-title-item ds:text-[color:var(--foreground)] ds:truncate\"\n >\n {author.name}\n </span>\n ) : (\n <span id={headingId} className=\"ds:sr-only\">\n {resolvedAriaLabel}\n </span>\n )}\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-2xs)]\">\n <Timestamp value={dateIso} shape=\"bare\" size=\"sm\" />\n {createdAtIso && createdAtIso !== dateIso ? (\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)]\">\n {t('clinicalNoteCard.added')}{' '}\n <Timestamp value={createdAtIso} shape=\"bare\" size=\"sm\" />\n </span>\n ) : null}\n </span>\n </div>\n {clinical || onTogglePin || onToggleFlag || pinned || flagged ? (\n <span className=\"ds:ms-auto ds:flex ds:shrink-0 ds:flex-wrap ds:items-center ds:justify-end ds:gap-[var(--spacing-xs)]\">\n {clinical ? (\n <Badge variant=\"brand\" size=\"sm\">\n {t('clinicalNoteCard.clinical')}\n </Badge>\n ) : null}\n {/* Pin + flag — grouped tightly together, kept clear of the\n clinical badge by the cluster's larger gap. Each is an\n interactive toggle when a handler is supplied (filled glyph +\n tint when active, no button fill), else a static chip. */}\n {onTogglePin || onToggleFlag || pinned || flagged ? (\n <span className=\"ds:flex ds:items-center ds:gap-[var(--spacing-2xs)]\">\n {onTogglePin ? (\n <NoteToggle\n pressed={!!pinned}\n onToggle={onTogglePin}\n label={\n pinned\n ? t('clinicalNoteCard.unpin')\n : t('clinicalNoteCard.pin')\n }\n activeClassName=\"ds:text-[color:var(--accent)]\"\n icon={\n <Pin\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n fill={pinned ? 'currentColor' : 'none'}\n />\n }\n />\n ) : pinned ? (\n <Badge\n variant=\"accent\"\n size=\"sm\"\n leading={<Pin aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.pinned')}\n </Badge>\n ) : null}\n {onToggleFlag ? (\n <NoteToggle\n pressed={!!flagged}\n onToggle={onToggleFlag}\n label={\n flagged\n ? t('clinicalNoteCard.unflag')\n : t('clinicalNoteCard.flag')\n }\n activeClassName=\"ds:text-[color:var(--warning-readable)]\"\n icon={\n <Flag\n aria-hidden=\"true\"\n className=\"ds:size-4\"\n fill={flagged ? 'currentColor' : 'none'}\n />\n }\n />\n ) : flagged ? (\n <Badge\n variant=\"warning\"\n size=\"sm\"\n leading={<Flag aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.flagged')}\n </Badge>\n ) : null}\n </span>\n ) : null}\n </span>\n ) : null}\n </div>\n\n {/* Body — rendered via the sanctioned SafeHtml carrier. Markdown notes\n use the tight markdown profile; rich-text notes the broader one.\n When `truncate`, the body clamps to five lines with a read-more\n disclosure once it overflows. */}\n <SafeHtml\n ref={clampRef}\n id={truncate ? bodyId : undefined}\n html={bodyHtml}\n profile={contentFormat === 'html' ? 'rich-text' : 'markdown'}\n className={bodyVariants({ truncate: truncate && !expanded })}\n />\n {showReadMore ? (\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-controls={bodyId}\n onClick={() => setExpanded((prev) => !prev)}\n className={readMoreClasses}\n >\n {expanded\n ? t('clinicalNoteCard.readLess')\n : t('clinicalNoteCard.readMore')}\n </button>\n ) : null}\n\n {/* Attachment context */}\n {attachmentNode ? (\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {attachmentNode}\n </div>\n ) : null}\n </div>\n );\n\n return (\n <div\n ref={ref}\n role=\"article\"\n aria-label={resolvedAriaLabel}\n aria-labelledby={headingId}\n data-component=\"clinical-note-card\"\n data-component-id={id}\n data-pinned={pinned ? 'true' : undefined}\n data-flagged={flagged ? 'true' : undefined}\n data-attached-to={attachedTo?.kind}\n id={id}\n className={rootVariants({ surface, className })}\n {...rest}\n >\n {surface === 'elevated' ? (\n <Card variant=\"elevated\">\n <Card.Body>{inner}</Card.Body>\n </Card>\n ) : (\n inner\n )}\n </div>\n );\n },\n);\n\nClinicalNoteCard.displayName = 'ClinicalNoteCard';\n\n/** Re-export of the surface variant union for downstream typing. */\nexport type ClinicalNoteCardSurface = NonNullable<\n VariantProps<typeof rootVariants>['surface']\n>;\n"],"names":["__iconNode","Flag","createLucideIcon","Pin","clinicalNoteCardAgent","handle","rootVariants","cva","bodyVariants","noteToggleBase","readMoreClasses","NoteToggle","icon","pressed","label","activeClassName","onToggle","jsx","escapeHtml","input","renderInlineHtml","escaped","out","markdownToHtml","block","lines","isUnordered","isOrdered","l","ClinicalNoteCard","forwardRef","id","dateIso","createdAtIso","author","clinical","attachedTo","content","contentFormat","pinned","flagged","onTogglePin","onToggleFlag","truncate","surface","ariaLabel","className","rest","ref","t","useTranslation","headingId","useId","bodyId","expanded","setExpanded","useState","clampRef","isOverflowing","useClampOverflow","showReadMore","bodyHtml","useMemo","resolvedAriaLabel","useAgentRegistration","attachmentNode","Badge","User","isSafeEntityUrl","Link","FileText","Layers","ScanLine","inner","jsxs","Avatar","Timestamp","SafeHtml","prev","Card"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA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,YACZ,UAAA,gBAAA9D,EAAC8D,EAAK,MAAL,EAAW,UAAAN,EAAA,CAAM,EAAA,CACpB,IAEAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA5C,GAAiB,cAAc;","x_google_ignoreList":[0,1]}
|
|
@@ -2,8 +2,8 @@ import { jsxs as y, jsx as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as ne, useRef as o, useState as V, useId as ie, useCallback as ae, useImperativeHandle as re, useMemo as se } from "react";
|
|
3
3
|
import { useTranslation as oe } from "react-i18next";
|
|
4
4
|
import { u as le } from "./registry-DvAUVLHh.js";
|
|
5
|
-
import { C as ce } from "./clinical-note-card-
|
|
6
|
-
import { R as de } from "./rich-text-editor-
|
|
5
|
+
import { C as ce } from "./clinical-note-card-D63x_AkK.js";
|
|
6
|
+
import { R as de } from "./rich-text-editor-CfeXPPWs.js";
|
|
7
7
|
import { T as pe } from "./text-area-Bt3p7Pt0.js";
|
|
8
8
|
import { B as ue } from "./button-CPGiR_bH.js";
|
|
9
9
|
import { C as me } from "./checkbox-BuZ1u__2.js";
|
|
@@ -321,4 +321,4 @@ const _e = ne(
|
|
|
321
321
|
export {
|
|
322
322
|
_e as N
|
|
323
323
|
};
|
|
324
|
-
//# sourceMappingURL=notes-panel-
|
|
324
|
+
//# sourceMappingURL=notes-panel-CTcOLLVo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notes-panel-BKwd-bOV.js","sources":["../../node_modules/lucide-react/dist/esm/icons/notebook-pen.mjs","../../src/components/notes-panel/notes-panel.agent.ts","../../src/components/notes-panel/notes-panel.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4\", key: \"re6nr2\" }],\n [\"path\", { d: \"M2 6h4\", key: \"aawbzj\" }],\n [\"path\", { d: \"M2 10h4\", key: \"l0bgd4\" }],\n [\"path\", { d: \"M2 14h4\", key: \"1gsvsf\" }],\n [\"path\", { d: \"M2 18h4\", key: \"1bu2t1\" }],\n [\n \"path\",\n {\n d: \"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z\",\n key: \"pqwjuv\"\n }\n ]\n];\nconst NotebookPen = createLucideIcon(\"notebook-pen\", __iconNode);\n\nexport { __iconNode, NotebookPen as default };\n//# sourceMappingURL=notebook-pen.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — NotesPanel. */\n/* */\n/* The Notes tool: a composer over a note timeline. The agent reads the */\n/* timeline STRUCTURE (note ids + pinned / flagged / clinical flags — */\n/* never the note body or author, both PHI), composes and commits a new */\n/* note, and toggles a note's pinned / flagged state. `add_note` carries */\n/* the `phi` safety class: a note body is patient-identifiable clinical */\n/* content, so the host gates it behind the same confirm-before-act as a */\n/* destructive write and never auto-confirms. A clinical submission also */\n/* requires the host's `practice_add_clinical_note` permission (the */\n/* handle drops it when the gate is closed). */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { NotesPanelHandle } from './notes-panel';\n\nexport const notesPanelAgent: AgentAdapter<NotesPanelHandle> = {\n id: 'notes-panel',\n // 'submit' backs add_note (compose + commit a note). pin / flag are toggles\n // with no dedicated capability in the closed vocabulary.\n capabilities: ['submit'],\n state: {\n notes: {\n type: 'Array<{ id?: string; pinned: boolean; flagged: boolean; clinical: boolean }>',\n descriptionKey: 'ui.agent.notesPanel.state.notes',\n description:\n 'Timeline note ids + pinned / flagged / clinical flags. Never the note body or author (both PHI).',\n read: (handle) => handle.getNotes(),\n },\n canAddClinical: {\n type: 'boolean',\n descriptionKey: 'ui.agent.notesPanel.state.canAddClinical',\n description:\n 'Whether the current user may write clinical notes (the practice_add_clinical_note permission gate).',\n read: (handle) => handle.canAddClinical(),\n },\n },\n actions: {\n add_note: {\n // Writes a clinical/admin note body — patient-identifiable content. PHI.\n safety: 'phi',\n argsType: '{ content: string; clinical: boolean }',\n argsSchema: {\n type: 'object',\n properties: {\n content: {\n type: 'string',\n description:\n 'Note body. Rich HTML for the rich composer, else plain text.',\n },\n clinical: {\n type: 'boolean',\n description:\n 'Whether the note is clinical. Requires the clinical-note permission; the submission is dropped when the gate is closed.',\n },\n },\n required: ['content', 'clinical'],\n },\n openWorld: true,\n descriptionKey: 'ui.agent.notesPanel.actions.addNote',\n description:\n 'Compose and commit a new note. A clinical note requires the clinical-note permission (read canAddClinical first).',\n examples: [\n {\n args: { content: 'Patient reported improvement.', clinical: true },\n note: 'Add a clinical note.',\n },\n ],\n invoke: (handle, args: { content: string; clinical: boolean }) => {\n handle.addNote(args);\n },\n },\n toggle_pin: {\n // Re-orders the timeline (pinned notes lead) — reversible view write.\n safety: 'write',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: false,\n descriptionKey: 'ui.agent.notesPanel.actions.togglePin',\n description: 'Toggle the pinned state of the note with the given id.',\n invoke: (handle, args: { id: string }) => {\n handle.togglePin(args.id);\n },\n },\n toggle_flag: {\n safety: 'write',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: false,\n descriptionKey: 'ui.agent.notesPanel.actions.toggleFlag',\n description: 'Toggle the flagged state of the note with the given id.',\n invoke: (handle, args: { id: string }) => {\n handle.toggleFlag(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'notes-panel',\n description: 'Marks the NotesPanel region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific notes panel from the agent.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { notesPanelAgent } from './notes-panel.agent';\nimport { ClinicalNoteCard } from '../clinical-note-card';\nimport type { ClinicalNoteCardProps } from '../clinical-note-card';\nimport { RichTextEditor } from '../rich-text-editor';\nimport type {\n RichTextEditorHandle,\n RichTextEditorProps,\n RichTextEditorToolbar,\n RedactorFactory,\n} from '../rich-text-editor';\nimport { TextArea } from '../text-area';\nimport { Button } from '../button';\nimport { Checkbox } from '../checkbox';\nimport { NotebookPen } from 'lucide-react';\nimport { PanelHeader } from '../panel-header';\n\n/* ------------------------------------------------------------------ */\n/* NotesPanel — the Notes tool for the Control Room rail. */\n/* */\n/* A composer over an elevated ClinicalNoteCard timeline. Drops */\n/* into a ControlRoomRail tool `panel`, the patient profile, or the */\n/* care-plan editor — anywhere notes about the open entity belong. */\n/* The composer is the kit RichTextEditor by default (degrades to a */\n/* textarea where Redactor is absent), carries a permission-gated */\n/* \"clinical note\" toggle, and forwards the editor's AI affordances. */\n/* The note attaches to whatever entity the host is showing — the */\n/* host owns the attachment; the panel only emits content + clinical. */\n/* Pinned notes lead; pin / flag are inline per-note toggles. */\n/* ------------------------------------------------------------------ */\n\n/** One note in the panel — the data subset of `ClinicalNoteCard`. */\nexport type NotesPanelNote = Pick<\n ClinicalNoteCardProps,\n | 'id'\n | 'dateIso'\n | 'createdAtIso'\n | 'author'\n | 'clinical'\n | 'attachedTo'\n | 'content'\n | 'contentFormat'\n | 'pinned'\n | 'flagged'\n>;\n\n/**\n * Curated agent handle for NotesPanel. Reads the note timeline's STRUCTURE\n * (ids + pinned / flagged / clinical flags — never the note body or author,\n * both PHI) and drives the composer + per-note toggles. See\n * `notes-panel.agent.ts`.\n */\nexport interface NotesPanelHandle {\n /** Timeline snapshot — ids + flags only, never note content (PHI). */\n getNotes: () => Array<{\n id?: string;\n pinned: boolean;\n flagged: boolean;\n clinical: boolean;\n }>;\n /** Whether the composer is mounted (onAddNote is wired). */\n canAddNote: () => boolean;\n /** Whether clinical notes may be written (the permission gate). */\n canAddClinical: () => boolean;\n /** Commit a new note with explicit content (mirrors the composer's submit). */\n addNote: (submission: NotesPanelSubmission) => void;\n /** Toggle a note's pinned state (mirrors onTogglePin). */\n togglePin: (id: string) => void;\n /** Toggle a note's flagged state (mirrors onToggleFlag). */\n toggleFlag: (id: string) => void;\n}\n\n/** Payload handed to `onAddNote` when the composer commits. */\nexport interface NotesPanelSubmission {\n /** The note body — rich HTML (`composer='rich'`) or plain text. */\n content: string;\n /** Whether the \"clinical note\" toggle was set. */\n clinical: boolean;\n}\n\nexport interface NotesPanelProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title' | 'children'\n> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so an\n * agent / MCP UI bridge can address this specific notes panel.\n */\n id?: string;\n /** Notes to render, newest-first by convention. Pinned notes lead. */\n notes: NotesPanelNote[];\n /** Commit a new note. Omit to hide the composer (read-only timeline). */\n onAddNote?: (submission: NotesPanelSubmission) => void;\n\n /* ----- Composer ----- */\n /**\n * `'rich'` (default) mounts the kit `RichTextEditor` (Redactor; degrades to a\n * textarea where Redactor is absent). `'plain'` keeps a simple `TextArea` for\n * lightweight surfaces / deterministic tests.\n */\n composer?: 'rich' | 'plain';\n /** Toolbar preset for the rich composer. Defaults to `'standard'`. */\n editorToolbar?: RichTextEditorToolbar;\n /** Inject the Redactor factory for the rich composer (else `window.$R`). */\n redactor?: RedactorFactory;\n /** Consumer image-upload endpoint for the rich composer. */\n imageUploadUrl?: string;\n\n /* ----- Clinical flag (permission-gated) ----- */\n /** Show the \"clinical note\" toggle in the composer. Default `true`. */\n showClinicalToggle?: boolean;\n /**\n * Permission gate — when `false` the clinical toggle is disabled and shows\n * `clinicalGatedReason` on hover/focus. Mirrors platform's\n * `practice_add_clinical_note` permission. Default `true`.\n */\n canAddClinicalNote?: boolean;\n /** Tooltip shown when the clinical toggle is gated off. */\n clinicalGatedReason?: string;\n /** Initial state of the clinical toggle. Default `false`. */\n defaultClinical?: boolean;\n\n /* ----- AI assistance (forwarded to RichTextEditor) ----- */\n onRequestAiDraft?: RichTextEditorProps['onRequestAiDraft'];\n aiDraftFormat?: RichTextEditorProps['aiDraftFormat'];\n aiPrivacyNotice?: RichTextEditorProps['aiPrivacyNotice'];\n onDictate?: RichTextEditorProps['onDictate'];\n onProofread?: RichTextEditorProps['onProofread'];\n onAutoFormat?: RichTextEditorProps['onAutoFormat'];\n\n /* ----- Per-note actions ----- */\n /** Toggle a note's pinned state — renders an inline pin button per note. */\n onTogglePin?: (id: string) => void;\n /** Toggle a note's flagged state — renders an inline flag button per note. */\n onToggleFlag?: (id: string) => void;\n\n /* ----- Labels / chrome ----- */\n /** Panel heading. Defaults to the localised \"Notes\". */\n title?: string;\n /** Composer placeholder. */\n composerPlaceholder?: string;\n /** Save-button label. */\n addNoteLabel?: string;\n /** Rendered when there are no notes. */\n emptyState?: ReactNode;\n /** Accessible name for the panel region (defaults to `title`). */\n 'aria-label'?: string;\n}\n\n/** Strip tags / entities to test whether a rich draft holds real content. */\nfunction hasRichContent(html: string): boolean {\n if (!html) return false;\n if (/<img\\b/i.test(html)) return true;\n return (\n html\n .replace(/<[^>]*>/g, '')\n .replace(/ /gi, ' ')\n .trim().length > 0\n );\n}\n\nexport const NotesPanel = forwardRef<HTMLElement, NotesPanelProps>(\n function NotesPanel(\n {\n id,\n notes,\n onAddNote,\n composer = 'rich',\n editorToolbar = 'standard',\n redactor,\n imageUploadUrl,\n showClinicalToggle = true,\n canAddClinicalNote = true,\n clinicalGatedReason,\n defaultClinical = false,\n onRequestAiDraft,\n aiDraftFormat,\n aiPrivacyNotice,\n onDictate,\n onProofread,\n onAutoFormat,\n onTogglePin,\n onToggleFlag,\n title,\n composerPlaceholder,\n addNoteLabel,\n emptyState,\n className,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation();\n const editorRef = useRef<RichTextEditorHandle>(null);\n const [draft, setDraft] = useState('');\n const [clinical, setClinical] = useState(defaultClinical);\n\n const heading = title ?? t('notesPanel.title', { defaultValue: 'Notes' });\n const headingId = useId();\n const placeholder =\n composerPlaceholder ??\n t('notesPanel.placeholder', { defaultValue: 'Add a note…' });\n const composerLabel = t('notesPanel.composerLabel', {\n defaultValue: 'New note',\n });\n\n // Live content check: plain reads the draft directly; rich strips the draft\n // (debounced) for the disabled state but commits from the editor handle.\n const hasContent =\n composer === 'rich' ? hasRichContent(draft) : draft.trim().length > 0;\n\n const commit = useCallback(() => {\n if (!onAddNote) return;\n if (composer === 'rich') {\n const html = editorRef.current?.getHTML() ?? draft;\n if (!hasRichContent(html)) return;\n onAddNote({ content: html, clinical });\n editorRef.current?.clear();\n } else {\n const text = draft.trim();\n if (!text) return;\n onAddNote({ content: text, clinical });\n }\n setDraft('');\n setClinical(defaultClinical);\n }, [composer, draft, clinical, defaultClinical, onAddNote]);\n\n // Pinned notes lead; order within each group is preserved.\n const ordered = [...notes].sort(\n (a, b) => Number(b.pinned ?? false) - Number(a.pinned ?? false),\n );\n\n /* ----- Agent handle (structural reads + composer / toggles) ----- */\n const notesRef = useRef(notes);\n notesRef.current = notes;\n const onAddNoteRef = useRef(onAddNote);\n onAddNoteRef.current = onAddNote;\n const onTogglePinRef = useRef(onTogglePin);\n onTogglePinRef.current = onTogglePin;\n const onToggleFlagRef = useRef(onToggleFlag);\n onToggleFlagRef.current = onToggleFlag;\n const canAddClinicalRef = useRef(canAddClinicalNote);\n canAddClinicalRef.current = canAddClinicalNote;\n\n const rootRef = useRef<HTMLElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLElement, []);\n\n const handle = useMemo<NotesPanelHandle>(\n () => ({\n // Ids + flags only — never the note body or author (both PHI).\n getNotes: () =>\n notesRef.current.map((n) => ({\n id: n.id,\n pinned: !!n.pinned,\n flagged: !!n.flagged,\n clinical: !!n.clinical,\n })),\n canAddNote: () => !!onAddNoteRef.current,\n canAddClinical: () => canAddClinicalRef.current,\n addNote: (submission) => {\n // A clinical submission requires the permission gate to be open.\n if (submission.clinical && !canAddClinicalRef.current) return;\n onAddNoteRef.current?.(submission);\n },\n togglePin: (noteId) => onTogglePinRef.current?.(noteId),\n toggleFlag: (noteId) => onToggleFlagRef.current?.(noteId),\n }),\n [],\n );\n useAgentRegistration(notesPanelAgent, handle, id);\n\n return (\n <section\n ref={rootRef}\n data-component=\"notes-panel\"\n data-component-id={id}\n aria-labelledby={ariaLabel ? undefined : headingId}\n aria-label={ariaLabel}\n className={['ds:flex ds:flex-col', className].filter(Boolean).join(' ')}\n {...rest}\n >\n {/* Shared rail header — pins to the top of the panel's scroll region\n while the composer + note timeline scroll beneath it. The rail\n injects the favourite / close actions via PanelHeaderActionsProvider. */}\n <PanelHeader\n title={heading}\n icon={<NotebookPen aria-hidden=\"true\" />}\n headingId={ariaLabel ? undefined : headingId}\n sticky\n divider\n />\n\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]\">\n {onAddNote ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {composer === 'rich' ? (\n <RichTextEditor\n ref={editorRef}\n ariaLabel={composerLabel}\n placeholder={placeholder}\n toolbar={editorToolbar}\n minHeight=\"sm\"\n redactor={redactor}\n imageUploadUrl={imageUploadUrl}\n onChange={({ html }) => setDraft(html)}\n onRequestAiDraft={onRequestAiDraft}\n aiDraftFormat={aiDraftFormat}\n aiPrivacyNotice={aiPrivacyNotice}\n onDictate={onDictate}\n onProofread={onProofread}\n onAutoFormat={onAutoFormat}\n />\n ) : (\n <TextArea\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n placeholder={placeholder}\n autoResize\n minRows={2}\n maxRows={6}\n aria-label={composerLabel}\n />\n )}\n <div\n className={[\n 'ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]',\n showClinicalToggle ? 'ds:justify-between' : 'ds:justify-end',\n ].join(' ')}\n >\n {showClinicalToggle ? (\n <Checkbox\n size=\"sm\"\n label={t('notesPanel.clinicalToggle', {\n defaultValue: 'Clinical note',\n })}\n checked={clinical}\n onCheckedChange={(next) => setClinical(next === true)}\n disabled={!canAddClinicalNote}\n disabledReason={\n canAddClinicalNote\n ? undefined\n : (clinicalGatedReason ??\n t('notesPanel.clinicalGated', {\n defaultValue:\n 'You do not have permission to write clinical notes.',\n }))\n }\n />\n ) : null}\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={commit}\n disabled={!hasContent}\n >\n {addNoteLabel ??\n t('notesPanel.add', { defaultValue: 'Add note' })}\n </Button>\n </div>\n </div>\n ) : null}\n\n {ordered.length > 0 ? (\n <ul className=\"ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0\">\n {ordered.map((note, index) => (\n <li key={note.id ?? index} className=\"ds:flex ds:flex-col\">\n {/* Elevated card per note; the list gap (not a separator)\n spaces them. Bodies clamp to five lines with read-more —\n the timeline is a read-only display surface. */}\n <ClinicalNoteCard\n surface=\"elevated\"\n truncate\n {...note}\n onTogglePin={\n onTogglePin && note.id\n ? () => onTogglePin(note.id as string)\n : undefined\n }\n onToggleFlag={\n onToggleFlag && note.id\n ? () => onToggleFlag(note.id as string)\n : undefined\n }\n />\n </li>\n ))}\n </ul>\n ) : (\n (emptyState ?? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('notesPanel.empty', { defaultValue: 'No notes yet.' })}\n </p>\n ))\n )}\n </div>\n </section>\n );\n },\n);\n"],"names":["__iconNode","NotebookPen","createLucideIcon","notesPanelAgent","handle","args","hasRichContent","html","NotesPanel","forwardRef","id","notes","onAddNote","composer","editorToolbar","redactor","imageUploadUrl","showClinicalToggle","canAddClinicalNote","clinicalGatedReason","defaultClinical","onRequestAiDraft","aiDraftFormat","aiPrivacyNotice","onDictate","onProofread","onAutoFormat","onTogglePin","onToggleFlag","title","composerPlaceholder","addNoteLabel","emptyState","className","ariaLabel","rest","ref","t","useTranslation","editorRef","useRef","draft","setDraft","useState","clinical","setClinical","heading","headingId","useId","placeholder","composerLabel","hasContent","commit","useCallback","_a","_b","text","ordered","a","b","notesRef","onAddNoteRef","onTogglePinRef","onToggleFlagRef","canAddClinicalRef","rootRef","useImperativeHandle","useMemo","n","submission","noteId","useAgentRegistration","jsxs","jsx","PanelHeader","RichTextEditor","TextArea","event","Checkbox","next","Button","note","index","ClinicalNoteCard"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,kEAAkE,KAAK,SAAQ,CAAE;AAAA,EAC/F,CAAC,QAAQ,EAAE,GAAG,UAAU,KAAK,SAAQ,CAAE;AAAA,EACvC,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,KAAcC,GAAiB,gBAAgBF,EAAU,GCNlDG,KAAkD;AAAA,EAC7D,IAAI;AAAA;AAAA;AAAA,EAGJ,cAAc,CAAC,QAAQ;AAAA,EACvB,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAA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,iBAAiB,CAACmC,MAASlC,EAAYkC,MAAS,EAAI;AAAA,wBACpD,UAAU,CAAC7D;AAAA,wBACX,gBACEA,IACI,SACCC,KACDkB,EAAE,4BAA4B;AAAA,0BAC5B,cACE;AAAA,wBAAA,CACH;AAAA,sBAAA;AAAA,oBAAA,IAGP;AAAA,oBACJ,gBAAAoC;AAAA,sBAACO;AAAA,sBAAA;AAAA,wBACC,MAAK;AAAA,wBACL,MAAK;AAAA,wBACL,SAAS5B;AAAA,wBACT,UAAU,CAACD;AAAA,wBAEV,eACCd,EAAE,kBAAkB,EAAE,cAAc,YAAY;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACpD;AAAA,gBAAA;AAAA,cAAA;AAAA,YACF,EAAA,CACF,IACE;AAAA,YAEHoB,EAAQ,SAAS,IAChB,gBAAAgB,EAAC,QAAG,WAAU,6EACX,UAAAhB,EAAQ,IAAI,CAACwB,GAAMC,MAClB,gBAAAT,EAAC,MAAA,EAA0B,WAAU,uBAInC,UAAA,gBAAAA;AAAA,cAACU;AAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,UAAQ;AAAA,gBACP,GAAGF;AAAA,gBACJ,aACEtD,KAAesD,EAAK,KAChB,MAAMtD,EAAYsD,EAAK,EAAY,IACnC;AAAA,gBAEN,cACErD,KAAgBqD,EAAK,KACjB,MAAMrD,EAAaqD,EAAK,EAAY,IACpC;AAAA,cAAA;AAAA,YAAA,KAhBDA,EAAK,MAAMC,CAmBpB,CACD,GACH,IAEClD,KACC,gBAAAyC,EAAC,KAAA,EAAE,WAAU,+DACV,UAAApC,EAAE,oBAAoB,EAAE,cAAc,gBAAA,CAAiB,EAAA,CAC1D;AAAA,UAAA,EAAA,CAGN;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"notes-panel-CTcOLLVo.js","sources":["../../node_modules/lucide-react/dist/esm/icons/notebook-pen.mjs","../../src/components/notes-panel/notes-panel.agent.ts","../../src/components/notes-panel/notes-panel.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4\", key: \"re6nr2\" }],\n [\"path\", { d: \"M2 6h4\", key: \"aawbzj\" }],\n [\"path\", { d: \"M2 10h4\", key: \"l0bgd4\" }],\n [\"path\", { d: \"M2 14h4\", key: \"1gsvsf\" }],\n [\"path\", { d: \"M2 18h4\", key: \"1bu2t1\" }],\n [\n \"path\",\n {\n d: \"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z\",\n key: \"pqwjuv\"\n }\n ]\n];\nconst NotebookPen = createLucideIcon(\"notebook-pen\", __iconNode);\n\nexport { __iconNode, NotebookPen as default };\n//# sourceMappingURL=notebook-pen.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — NotesPanel. */\n/* */\n/* The Notes tool: a composer over a note timeline. The agent reads the */\n/* timeline STRUCTURE (note ids + pinned / flagged / clinical flags — */\n/* never the note body or author, both PHI), composes and commits a new */\n/* note, and toggles a note's pinned / flagged state. `add_note` carries */\n/* the `phi` safety class: a note body is patient-identifiable clinical */\n/* content, so the host gates it behind the same confirm-before-act as a */\n/* destructive write and never auto-confirms. A clinical submission also */\n/* requires the host's `practice_add_clinical_note` permission (the */\n/* handle drops it when the gate is closed). */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { NotesPanelHandle } from './notes-panel';\n\nexport const notesPanelAgent: AgentAdapter<NotesPanelHandle> = {\n id: 'notes-panel',\n // 'submit' backs add_note (compose + commit a note). pin / flag are toggles\n // with no dedicated capability in the closed vocabulary.\n capabilities: ['submit'],\n state: {\n notes: {\n type: 'Array<{ id?: string; pinned: boolean; flagged: boolean; clinical: boolean }>',\n descriptionKey: 'ui.agent.notesPanel.state.notes',\n description:\n 'Timeline note ids + pinned / flagged / clinical flags. Never the note body or author (both PHI).',\n read: (handle) => handle.getNotes(),\n },\n canAddClinical: {\n type: 'boolean',\n descriptionKey: 'ui.agent.notesPanel.state.canAddClinical',\n description:\n 'Whether the current user may write clinical notes (the practice_add_clinical_note permission gate).',\n read: (handle) => handle.canAddClinical(),\n },\n },\n actions: {\n add_note: {\n // Writes a clinical/admin note body — patient-identifiable content. PHI.\n safety: 'phi',\n argsType: '{ content: string; clinical: boolean }',\n argsSchema: {\n type: 'object',\n properties: {\n content: {\n type: 'string',\n description:\n 'Note body. Rich HTML for the rich composer, else plain text.',\n },\n clinical: {\n type: 'boolean',\n description:\n 'Whether the note is clinical. Requires the clinical-note permission; the submission is dropped when the gate is closed.',\n },\n },\n required: ['content', 'clinical'],\n },\n openWorld: true,\n descriptionKey: 'ui.agent.notesPanel.actions.addNote',\n description:\n 'Compose and commit a new note. A clinical note requires the clinical-note permission (read canAddClinical first).',\n examples: [\n {\n args: { content: 'Patient reported improvement.', clinical: true },\n note: 'Add a clinical note.',\n },\n ],\n invoke: (handle, args: { content: string; clinical: boolean }) => {\n handle.addNote(args);\n },\n },\n toggle_pin: {\n // Re-orders the timeline (pinned notes lead) — reversible view write.\n safety: 'write',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: false,\n descriptionKey: 'ui.agent.notesPanel.actions.togglePin',\n description: 'Toggle the pinned state of the note with the given id.',\n invoke: (handle, args: { id: string }) => {\n handle.togglePin(args.id);\n },\n },\n toggle_flag: {\n safety: 'write',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: false,\n descriptionKey: 'ui.agent.notesPanel.actions.toggleFlag',\n description: 'Toggle the flagged state of the note with the given id.',\n invoke: (handle, args: { id: string }) => {\n handle.toggleFlag(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'notes-panel',\n description: 'Marks the NotesPanel region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific notes panel from the agent.',\n },\n },\n};\n","import {\n forwardRef,\n useCallback,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { notesPanelAgent } from './notes-panel.agent';\nimport { ClinicalNoteCard } from '../clinical-note-card';\nimport type { ClinicalNoteCardProps } from '../clinical-note-card';\nimport { RichTextEditor } from '../rich-text-editor';\nimport type {\n RichTextEditorHandle,\n RichTextEditorProps,\n RichTextEditorToolbar,\n RedactorFactory,\n} from '../rich-text-editor';\nimport { TextArea } from '../text-area';\nimport { Button } from '../button';\nimport { Checkbox } from '../checkbox';\nimport { NotebookPen } from 'lucide-react';\nimport { PanelHeader } from '../panel-header';\n\n/* ------------------------------------------------------------------ */\n/* NotesPanel — the Notes tool for the Control Room rail. */\n/* */\n/* A composer over an elevated ClinicalNoteCard timeline. Drops */\n/* into a ControlRoomRail tool `panel`, the patient profile, or the */\n/* care-plan editor — anywhere notes about the open entity belong. */\n/* The composer is the kit RichTextEditor by default (degrades to a */\n/* textarea where Redactor is absent), carries a permission-gated */\n/* \"clinical note\" toggle, and forwards the editor's AI affordances. */\n/* The note attaches to whatever entity the host is showing — the */\n/* host owns the attachment; the panel only emits content + clinical. */\n/* Pinned notes lead; pin / flag are inline per-note toggles. */\n/* ------------------------------------------------------------------ */\n\n/** One note in the panel — the data subset of `ClinicalNoteCard`. */\nexport type NotesPanelNote = Pick<\n ClinicalNoteCardProps,\n | 'id'\n | 'dateIso'\n | 'createdAtIso'\n | 'author'\n | 'clinical'\n | 'attachedTo'\n | 'content'\n | 'contentFormat'\n | 'pinned'\n | 'flagged'\n>;\n\n/**\n * Curated agent handle for NotesPanel. Reads the note timeline's STRUCTURE\n * (ids + pinned / flagged / clinical flags — never the note body or author,\n * both PHI) and drives the composer + per-note toggles. See\n * `notes-panel.agent.ts`.\n */\nexport interface NotesPanelHandle {\n /** Timeline snapshot — ids + flags only, never note content (PHI). */\n getNotes: () => Array<{\n id?: string;\n pinned: boolean;\n flagged: boolean;\n clinical: boolean;\n }>;\n /** Whether the composer is mounted (onAddNote is wired). */\n canAddNote: () => boolean;\n /** Whether clinical notes may be written (the permission gate). */\n canAddClinical: () => boolean;\n /** Commit a new note with explicit content (mirrors the composer's submit). */\n addNote: (submission: NotesPanelSubmission) => void;\n /** Toggle a note's pinned state (mirrors onTogglePin). */\n togglePin: (id: string) => void;\n /** Toggle a note's flagged state (mirrors onToggleFlag). */\n toggleFlag: (id: string) => void;\n}\n\n/** Payload handed to `onAddNote` when the composer commits. */\nexport interface NotesPanelSubmission {\n /** The note body — rich HTML (`composer='rich'`) or plain text. */\n content: string;\n /** Whether the \"clinical note\" toggle was set. */\n clinical: boolean;\n}\n\nexport interface NotesPanelProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title' | 'children'\n> {\n /**\n * Stable instance id. Surfaced on the root as `data-component-id` so an\n * agent / MCP UI bridge can address this specific notes panel.\n */\n id?: string;\n /** Notes to render, newest-first by convention. Pinned notes lead. */\n notes: NotesPanelNote[];\n /** Commit a new note. Omit to hide the composer (read-only timeline). */\n onAddNote?: (submission: NotesPanelSubmission) => void;\n\n /* ----- Composer ----- */\n /**\n * `'rich'` (default) mounts the kit `RichTextEditor` (Redactor; degrades to a\n * textarea where Redactor is absent). `'plain'` keeps a simple `TextArea` for\n * lightweight surfaces / deterministic tests.\n */\n composer?: 'rich' | 'plain';\n /** Toolbar preset for the rich composer. Defaults to `'standard'`. */\n editorToolbar?: RichTextEditorToolbar;\n /** Inject the Redactor factory for the rich composer (else `window.$R`). */\n redactor?: RedactorFactory;\n /** Consumer image-upload endpoint for the rich composer. */\n imageUploadUrl?: string;\n\n /* ----- Clinical flag (permission-gated) ----- */\n /** Show the \"clinical note\" toggle in the composer. Default `true`. */\n showClinicalToggle?: boolean;\n /**\n * Permission gate — when `false` the clinical toggle is disabled and shows\n * `clinicalGatedReason` on hover/focus. Mirrors platform's\n * `practice_add_clinical_note` permission. Default `true`.\n */\n canAddClinicalNote?: boolean;\n /** Tooltip shown when the clinical toggle is gated off. */\n clinicalGatedReason?: string;\n /** Initial state of the clinical toggle. Default `false`. */\n defaultClinical?: boolean;\n\n /* ----- AI assistance (forwarded to RichTextEditor) ----- */\n onRequestAiDraft?: RichTextEditorProps['onRequestAiDraft'];\n aiDraftFormat?: RichTextEditorProps['aiDraftFormat'];\n aiPrivacyNotice?: RichTextEditorProps['aiPrivacyNotice'];\n onDictate?: RichTextEditorProps['onDictate'];\n onProofread?: RichTextEditorProps['onProofread'];\n onAutoFormat?: RichTextEditorProps['onAutoFormat'];\n\n /* ----- Per-note actions ----- */\n /** Toggle a note's pinned state — renders an inline pin button per note. */\n onTogglePin?: (id: string) => void;\n /** Toggle a note's flagged state — renders an inline flag button per note. */\n onToggleFlag?: (id: string) => void;\n\n /* ----- Labels / chrome ----- */\n /** Panel heading. Defaults to the localised \"Notes\". */\n title?: string;\n /** Composer placeholder. */\n composerPlaceholder?: string;\n /** Save-button label. */\n addNoteLabel?: string;\n /** Rendered when there are no notes. */\n emptyState?: ReactNode;\n /** Accessible name for the panel region (defaults to `title`). */\n 'aria-label'?: string;\n}\n\n/** Strip tags / entities to test whether a rich draft holds real content. */\nfunction hasRichContent(html: string): boolean {\n if (!html) return false;\n if (/<img\\b/i.test(html)) return true;\n return (\n html\n .replace(/<[^>]*>/g, '')\n .replace(/ /gi, ' ')\n .trim().length > 0\n );\n}\n\nexport const NotesPanel = forwardRef<HTMLElement, NotesPanelProps>(\n function NotesPanel(\n {\n id,\n notes,\n onAddNote,\n composer = 'rich',\n editorToolbar = 'standard',\n redactor,\n imageUploadUrl,\n showClinicalToggle = true,\n canAddClinicalNote = true,\n clinicalGatedReason,\n defaultClinical = false,\n onRequestAiDraft,\n aiDraftFormat,\n aiPrivacyNotice,\n onDictate,\n onProofread,\n onAutoFormat,\n onTogglePin,\n onToggleFlag,\n title,\n composerPlaceholder,\n addNoteLabel,\n emptyState,\n className,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref,\n ) {\n const { t } = useTranslation();\n const editorRef = useRef<RichTextEditorHandle>(null);\n const [draft, setDraft] = useState('');\n const [clinical, setClinical] = useState(defaultClinical);\n\n const heading = title ?? t('notesPanel.title', { defaultValue: 'Notes' });\n const headingId = useId();\n const placeholder =\n composerPlaceholder ??\n t('notesPanel.placeholder', { defaultValue: 'Add a note…' });\n const composerLabel = t('notesPanel.composerLabel', {\n defaultValue: 'New note',\n });\n\n // Live content check: plain reads the draft directly; rich strips the draft\n // (debounced) for the disabled state but commits from the editor handle.\n const hasContent =\n composer === 'rich' ? hasRichContent(draft) : draft.trim().length > 0;\n\n const commit = useCallback(() => {\n if (!onAddNote) return;\n if (composer === 'rich') {\n const html = editorRef.current?.getHTML() ?? draft;\n if (!hasRichContent(html)) return;\n onAddNote({ content: html, clinical });\n editorRef.current?.clear();\n } else {\n const text = draft.trim();\n if (!text) return;\n onAddNote({ content: text, clinical });\n }\n setDraft('');\n setClinical(defaultClinical);\n }, [composer, draft, clinical, defaultClinical, onAddNote]);\n\n // Pinned notes lead; order within each group is preserved.\n const ordered = [...notes].sort(\n (a, b) => Number(b.pinned ?? false) - Number(a.pinned ?? false),\n );\n\n /* ----- Agent handle (structural reads + composer / toggles) ----- */\n const notesRef = useRef(notes);\n notesRef.current = notes;\n const onAddNoteRef = useRef(onAddNote);\n onAddNoteRef.current = onAddNote;\n const onTogglePinRef = useRef(onTogglePin);\n onTogglePinRef.current = onTogglePin;\n const onToggleFlagRef = useRef(onToggleFlag);\n onToggleFlagRef.current = onToggleFlag;\n const canAddClinicalRef = useRef(canAddClinicalNote);\n canAddClinicalRef.current = canAddClinicalNote;\n\n const rootRef = useRef<HTMLElement>(null);\n useImperativeHandle(ref, () => rootRef.current as HTMLElement, []);\n\n const handle = useMemo<NotesPanelHandle>(\n () => ({\n // Ids + flags only — never the note body or author (both PHI).\n getNotes: () =>\n notesRef.current.map((n) => ({\n id: n.id,\n pinned: !!n.pinned,\n flagged: !!n.flagged,\n clinical: !!n.clinical,\n })),\n canAddNote: () => !!onAddNoteRef.current,\n canAddClinical: () => canAddClinicalRef.current,\n addNote: (submission) => {\n // A clinical submission requires the permission gate to be open.\n if (submission.clinical && !canAddClinicalRef.current) return;\n onAddNoteRef.current?.(submission);\n },\n togglePin: (noteId) => onTogglePinRef.current?.(noteId),\n toggleFlag: (noteId) => onToggleFlagRef.current?.(noteId),\n }),\n [],\n );\n useAgentRegistration(notesPanelAgent, handle, id);\n\n return (\n <section\n ref={rootRef}\n data-component=\"notes-panel\"\n data-component-id={id}\n aria-labelledby={ariaLabel ? undefined : headingId}\n aria-label={ariaLabel}\n className={['ds:flex ds:flex-col', className].filter(Boolean).join(' ')}\n {...rest}\n >\n {/* Shared rail header — pins to the top of the panel's scroll region\n while the composer + note timeline scroll beneath it. The rail\n injects the favourite / close actions via PanelHeaderActionsProvider. */}\n <PanelHeader\n title={heading}\n icon={<NotebookPen aria-hidden=\"true\" />}\n headingId={ariaLabel ? undefined : headingId}\n sticky\n divider\n />\n\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]\">\n {onAddNote ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]\">\n {composer === 'rich' ? (\n <RichTextEditor\n ref={editorRef}\n ariaLabel={composerLabel}\n placeholder={placeholder}\n toolbar={editorToolbar}\n minHeight=\"sm\"\n redactor={redactor}\n imageUploadUrl={imageUploadUrl}\n onChange={({ html }) => setDraft(html)}\n onRequestAiDraft={onRequestAiDraft}\n aiDraftFormat={aiDraftFormat}\n aiPrivacyNotice={aiPrivacyNotice}\n onDictate={onDictate}\n onProofread={onProofread}\n onAutoFormat={onAutoFormat}\n />\n ) : (\n <TextArea\n value={draft}\n onChange={(event) => setDraft(event.target.value)}\n placeholder={placeholder}\n autoResize\n minRows={2}\n maxRows={6}\n aria-label={composerLabel}\n />\n )}\n <div\n className={[\n 'ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]',\n showClinicalToggle ? 'ds:justify-between' : 'ds:justify-end',\n ].join(' ')}\n >\n {showClinicalToggle ? (\n <Checkbox\n size=\"sm\"\n label={t('notesPanel.clinicalToggle', {\n defaultValue: 'Clinical note',\n })}\n checked={clinical}\n onCheckedChange={(next) => setClinical(next === true)}\n disabled={!canAddClinicalNote}\n disabledReason={\n canAddClinicalNote\n ? undefined\n : (clinicalGatedReason ??\n t('notesPanel.clinicalGated', {\n defaultValue:\n 'You do not have permission to write clinical notes.',\n }))\n }\n />\n ) : null}\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={commit}\n disabled={!hasContent}\n >\n {addNoteLabel ??\n t('notesPanel.add', { defaultValue: 'Add note' })}\n </Button>\n </div>\n </div>\n ) : null}\n\n {ordered.length > 0 ? (\n <ul className=\"ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-0\">\n {ordered.map((note, index) => (\n <li key={note.id ?? index} className=\"ds:flex ds:flex-col\">\n {/* Elevated card per note; the list gap (not a separator)\n spaces them. Bodies clamp to five lines with read-more —\n the timeline is a read-only display surface. */}\n <ClinicalNoteCard\n surface=\"elevated\"\n truncate\n {...note}\n onTogglePin={\n onTogglePin && note.id\n ? () => onTogglePin(note.id as string)\n : undefined\n }\n onToggleFlag={\n onToggleFlag && note.id\n ? () => onToggleFlag(note.id as string)\n : undefined\n }\n />\n </li>\n ))}\n </ul>\n ) : (\n (emptyState ?? (\n <p className=\"ds:m-0 type-body-sm ds:text-[color:var(--muted-foreground)]\">\n {t('notesPanel.empty', { defaultValue: 'No notes yet.' })}\n </p>\n ))\n )}\n </div>\n </section>\n );\n },\n);\n"],"names":["__iconNode","NotebookPen","createLucideIcon","notesPanelAgent","handle","args","hasRichContent","html","NotesPanel","forwardRef","id","notes","onAddNote","composer","editorToolbar","redactor","imageUploadUrl","showClinicalToggle","canAddClinicalNote","clinicalGatedReason","defaultClinical","onRequestAiDraft","aiDraftFormat","aiPrivacyNotice","onDictate","onProofread","onAutoFormat","onTogglePin","onToggleFlag","title","composerPlaceholder","addNoteLabel","emptyState","className","ariaLabel","rest","ref","t","useTranslation","editorRef","useRef","draft","setDraft","useState","clinical","setClinical","heading","headingId","useId","placeholder","composerLabel","hasContent","commit","useCallback","_a","_b","text","ordered","a","b","notesRef","onAddNoteRef","onTogglePinRef","onToggleFlagRef","canAddClinicalRef","rootRef","useImperativeHandle","useMemo","n","submission","noteId","useAgentRegistration","jsxs","jsx","PanelHeader","RichTextEditor","TextArea","event","Checkbox","next","Button","note","index","ClinicalNoteCard"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,kEAAkE,KAAK,SAAQ,CAAE;AAAA,EAC/F,CAAC,QAAQ,EAAE,GAAG,UAAU,KAAK,SAAQ,CAAE;AAAA,EACvC,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,KAAcC,GAAiB,gBAAgBF,EAAU,GCNlDG,KAAkD;AAAA,EAC7D,IAAI;AAAA;AAAA;AAAA,EAGJ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AAU,+DACV,UAAApC,EAAE,oBAAoB,EAAE,cAAc,gBAAA,CAAiB,EAAA,CAC1D;AAAA,UAAA,EAAA,CAGN;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;","x_google_ignoreList":[0]}
|
|
@@ -575,7 +575,15 @@ const un = [
|
|
|
575
575
|
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
|
|
576
576
|
"ds:bg-[color-mix(in_srgb,var(--background)_70%,transparent)]",
|
|
577
577
|
"ds:p-[var(--spacing-sm)] ds:[max-block-size:10rem] ds:overflow-y-auto",
|
|
578
|
-
"ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]"
|
|
578
|
+
"ds:text-[length:var(--font-size-sm)] ds:text-[color:var(--foreground)]",
|
|
579
|
+
// The preview renders arbitrary model-generated rich text, and the
|
|
580
|
+
// `rich-text` SafeHtml profile allows ul/ol/li. Inside a
|
|
581
|
+
// [data-component] preflight's list reset still applies and the host
|
|
582
|
+
// undo deliberately does not reach, so markers and indent have to be
|
|
583
|
+
// asked for explicitly — otherwise a generated bullet list previews as
|
|
584
|
+
// flush, marker-less lines.
|
|
585
|
+
"ds:[&_ul]:list-disc ds:[&_ol]:list-decimal",
|
|
586
|
+
"ds:[&_ul]:ps-[var(--spacing-md)] ds:[&_ol]:ps-[var(--spacing-md)]"
|
|
579
587
|
].join(" ");
|
|
580
588
|
function dt(o, i) {
|
|
581
589
|
return i ? o ? /\s$/.test(o) ? `${o}${i}` : `${o} ${i}` : i : o;
|
|
@@ -2618,4 +2626,4 @@ export {
|
|
|
2618
2626
|
hn as r,
|
|
2619
2627
|
Qn as w
|
|
2620
2628
|
};
|
|
2621
|
-
//# sourceMappingURL=rich-text-editor-
|
|
2629
|
+
//# sourceMappingURL=rich-text-editor-CfeXPPWs.js.map
|