@alfadocs/ui-kit-debug 1.102.0 → 1.103.1
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/_chunks/{agenda-card-bRQ4j6U6.js → agenda-card-B8hV3dZV.js} +2 -2
- package/dist/_chunks/{agenda-card-bRQ4j6U6.js.map → agenda-card-B8hV3dZV.js.map} +1 -1
- package/dist/_chunks/{agenda-tray-CzE3E8GU.js → agenda-tray-Bu46s3dI.js} +2 -2
- package/dist/_chunks/{agenda-tray-CzE3E8GU.js.map → agenda-tray-Bu46s3dI.js.map} +1 -1
- package/dist/_chunks/{alia-sidebar-B5mu44g2.js → alia-sidebar-CKkg3gc8.js} +3 -3
- package/dist/_chunks/{alia-sidebar-B5mu44g2.js.map → alia-sidebar-CKkg3gc8.js.map} +1 -1
- package/dist/_chunks/{appointment-card-zPr0brha.js → appointment-card-FKOnH1uJ.js} +2 -2
- package/dist/_chunks/{appointment-card-zPr0brha.js.map → appointment-card-FKOnH1uJ.js.map} +1 -1
- package/dist/_chunks/{appointment-peek-xFTBany4.js → appointment-peek-DWfcpoGy.js} +2 -2
- package/dist/_chunks/{appointment-peek-xFTBany4.js.map → appointment-peek-DWfcpoGy.js.map} +1 -1
- package/dist/_chunks/{appointment-timeline-AKkVx9AN.js → appointment-timeline-eOi-y8m3.js} +2 -2
- package/dist/_chunks/{appointment-timeline-AKkVx9AN.js.map → appointment-timeline-eOi-y8m3.js.map} +1 -1
- package/dist/_chunks/{appointment-tray-B8qQBW65.js → appointment-tray-C6oBvsG5.js} +2 -2
- package/dist/_chunks/{appointment-tray-B8qQBW65.js.map → appointment-tray-C6oBvsG5.js.map} +1 -1
- package/dist/_chunks/{avatar-BoqdWsNe.js → avatar-Dp5apm1d.js} +61 -47
- package/dist/_chunks/{avatar-BoqdWsNe.js.map → avatar-Dp5apm1d.js.map} +1 -1
- package/dist/_chunks/{balance-badge-cell-C-Rz616n.js → balance-badge-cell-DGFm2jfP.js} +2 -2
- package/dist/_chunks/{balance-badge-cell-C-Rz616n.js.map → balance-badge-cell-DGFm2jfP.js.map} +1 -1
- package/dist/_chunks/{calendar-DVe5eArk.js → calendar-_sgjuH3L.js} +2 -2
- package/dist/_chunks/{calendar-DVe5eArk.js.map → calendar-_sgjuH3L.js.map} +1 -1
- package/dist/_chunks/{calendar-appointment-editor-dialog-EYyVorFR.js → calendar-appointment-editor-dialog-DqyATSh3.js} +8 -8
- package/dist/_chunks/{calendar-appointment-editor-dialog-EYyVorFR.js.map → calendar-appointment-editor-dialog-DqyATSh3.js.map} +1 -1
- package/dist/_chunks/{care-plan-header-lROoTjYn.js → care-plan-header-k8FslxsU.js} +2 -2
- package/dist/_chunks/{care-plan-header-lROoTjYn.js.map → care-plan-header-k8FslxsU.js.map} +1 -1
- package/dist/_chunks/{chat-message-CkBCAcwn.js → chat-message-CfIyXrxA.js} +2 -2
- package/dist/_chunks/{chat-message-CkBCAcwn.js.map → chat-message-CfIyXrxA.js.map} +1 -1
- package/dist/_chunks/{clinical-note-card--juv_ELr.js → clinical-note-card-BVkxGiGl.js} +2 -2
- package/dist/_chunks/{clinical-note-card--juv_ELr.js.map → clinical-note-card-BVkxGiGl.js.map} +1 -1
- package/dist/_chunks/{contact-profile-card-D0KqxoE5.js → contact-profile-card-uExd3pKC.js} +131 -133
- package/dist/_chunks/contact-profile-card-uExd3pKC.js.map +1 -0
- package/dist/_chunks/{dependent-selector-DRN0P0Kr.js → dependent-selector-D6y4Kjg5.js} +2 -2
- package/dist/_chunks/{dependent-selector-DRN0P0Kr.js.map → dependent-selector-D6y4Kjg5.js.map} +1 -1
- package/dist/_chunks/{entity-summary-B4p8zP1J.js → entity-summary-BKfR4Vws.js} +2 -2
- package/dist/_chunks/{entity-summary-B4p8zP1J.js.map → entity-summary-BKfR4Vws.js.map} +1 -1
- package/dist/_chunks/key-value-pair-DOTl68_U.js +287 -0
- package/dist/_chunks/key-value-pair-DOTl68_U.js.map +1 -0
- package/dist/_chunks/{link-cell-renderer-DKMgD-2v.js → link-cell-renderer-BRek9kz7.js} +2 -2
- package/dist/_chunks/{link-cell-renderer-DKMgD-2v.js.map → link-cell-renderer-BRek9kz7.js.map} +1 -1
- package/dist/_chunks/{marketplace-app-shell-D2qgIuXX.js → marketplace-app-shell-BsctSegT.js} +2 -2
- package/dist/_chunks/{marketplace-app-shell-D2qgIuXX.js.map → marketplace-app-shell-BsctSegT.js.map} +1 -1
- package/dist/_chunks/{message-card-BzJEITml.js → message-card-BG3_3nN1.js} +2 -2
- package/dist/_chunks/{message-card-BzJEITml.js.map → message-card-BG3_3nN1.js.map} +1 -1
- package/dist/_chunks/{message-tray-DiPgJbOb.js → message-tray-BjZv0Fsk.js} +2 -2
- package/dist/_chunks/{message-tray-DiPgJbOb.js.map → message-tray-BjZv0Fsk.js.map} +1 -1
- package/dist/_chunks/{notes-panel-BbNLYcdv.js → notes-panel-BjTpaz8d.js} +2 -2
- package/dist/_chunks/{notes-panel-BbNLYcdv.js.map → notes-panel-BjTpaz8d.js.map} +1 -1
- package/dist/_chunks/{operator-hero-BcuPTzS_.js → operator-hero-BELhrv9o.js} +37 -35
- package/dist/_chunks/{operator-hero-BcuPTzS_.js.map → operator-hero-BELhrv9o.js.map} +1 -1
- package/dist/_chunks/{patient-details-DoIOWP6j.js → patient-details-BXM3dRKb.js} +2 -2
- package/dist/_chunks/{patient-details-DoIOWP6j.js.map → patient-details-BXM3dRKb.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-B1jvxdY8.js → patient-summary-card-DB7fv-Tr.js} +3 -3
- package/dist/_chunks/{patient-summary-card-B1jvxdY8.js.map → patient-summary-card-DB7fv-Tr.js.map} +1 -1
- package/dist/_chunks/{payment-request-card-DPN5yklX.js → payment-request-card-IR83TJax.js} +2 -2
- package/dist/_chunks/{payment-request-card-DPN5yklX.js.map → payment-request-card-IR83TJax.js.map} +1 -1
- package/dist/_chunks/{periodontal-chart-X4_4WPK8.js → periodontal-chart-DqdUEFxK.js} +2 -2
- package/dist/_chunks/{periodontal-chart-X4_4WPK8.js.map → periodontal-chart-DqdUEFxK.js.map} +1 -1
- package/dist/_chunks/{periodontal-chart-card-BzL3YkEW.js → periodontal-chart-card-CCkzStlm.js} +2 -2
- package/dist/_chunks/{periodontal-chart-card-BzL3YkEW.js.map → periodontal-chart-card-CCkzStlm.js.map} +1 -1
- package/dist/_chunks/{practice-profile-hero-B8vykoci.js → practice-profile-hero-BAvGdQmt.js} +24 -20
- package/dist/_chunks/{practice-profile-hero-B8vykoci.js.map → practice-profile-hero-BAvGdQmt.js.map} +1 -1
- package/dist/_chunks/{practice-results-U-5kpnJa.js → practice-results-ChBP9x2r.js} +8 -4
- package/dist/_chunks/practice-results-ChBP9x2r.js.map +1 -0
- package/dist/_chunks/{public-footer-t6gx6sjn.js → public-footer-3Jy1zHSs.js} +248 -204
- package/dist/_chunks/public-footer-3Jy1zHSs.js.map +1 -0
- package/dist/_chunks/{signature-request-CQ0torGq.js → signature-request-DB6kePIm.js} +2 -2
- package/dist/_chunks/{signature-request-CQ0torGq.js.map → signature-request-DB6kePIm.js.map} +1 -1
- package/dist/_chunks/{signed-out-frame-BcQE00H1.js → signed-out-frame-Bs_LSPWe.js} +2 -2
- package/dist/_chunks/{signed-out-frame-BcQE00H1.js.map → signed-out-frame-Bs_LSPWe.js.map} +1 -1
- package/dist/_chunks/{timeline-tn5QQJdS.js → timeline-CKUaBZOx.js} +2 -2
- package/dist/_chunks/{timeline-tn5QQJdS.js.map → timeline-CKUaBZOx.js.map} +1 -1
- package/dist/_chunks/{use-appointment-details-read-BNtTap_B.js → use-appointment-details-read-CmqGGYCy.js} +4 -4
- package/dist/_chunks/{use-appointment-details-read-BNtTap_B.js.map → use-appointment-details-read-CmqGGYCy.js.map} +1 -1
- package/dist/_chunks/{workflow-map-Dm27iPKB.js → workflow-map-B1jf6QaB.js} +2 -2
- package/dist/_chunks/{workflow-map-Dm27iPKB.js.map → workflow-map-B1jf6QaB.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/agenda-card/index.js +1 -1
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/appointment-card/index.js +2 -2
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/appointment-peek/index.js +1 -1
- package/dist/components/appointment-timeline/index.js +1 -1
- package/dist/components/avatar/avatar.d.ts +10 -0
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/calendar/index.js +1 -1
- package/dist/components/care-plan-header/index.js +1 -1
- package/dist/components/chat-message/index.js +1 -1
- package/dist/components/clinical-note-card/index.js +1 -1
- package/dist/components/contact-profile-card/contact-profile-card.d.ts +9 -0
- package/dist/components/contact-profile-card/contact-profile-card.d.ts.map +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/dependent-selector/index.js +1 -1
- package/dist/components/entity-summary/index.js +1 -1
- package/dist/components/key-value-pair/index.d.ts +1 -1
- package/dist/components/key-value-pair/index.d.ts.map +1 -1
- package/dist/components/key-value-pair/index.js +3 -2
- package/dist/components/key-value-pair/key-value-pair.d.ts +20 -0
- package/dist/components/key-value-pair/key-value-pair.d.ts.map +1 -1
- package/dist/components/message-card/index.js +1 -1
- package/dist/components/message-tray/index.js +1 -1
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/operator-hero/index.js +1 -1
- package/dist/components/operator-hero/operator-hero.d.ts.map +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-summary-card/index.js +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/periodontal-chart/index.js +1 -1
- package/dist/components/periodontal-chart-card/index.js +1 -1
- package/dist/components/practice-profile-hero/index.js +1 -1
- package/dist/components/practice-profile-hero/practice-profile-hero.d.ts.map +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/practice-results/practice-results.d.ts.map +1 -1
- package/dist/components/public-footer/index.d.ts +1 -1
- package/dist/components/public-footer/index.d.ts.map +1 -1
- package/dist/components/public-footer/index.js +1 -1
- package/dist/components/public-footer/public-footer.d.ts +29 -0
- package/dist/components/public-footer/public-footer.d.ts.map +1 -1
- package/dist/components/timeline/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/core.css +1 -1
- package/dist/host-compat.css +7 -1
- package/dist/index.js +865 -864
- package/dist/patterns/alia-assistant/index.js +1 -1
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/signature-request/index.js +1 -1
- package/dist/patterns/signed-out-frame/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/contact-profile-card-D0KqxoE5.js.map +0 -1
- package/dist/_chunks/key-value-pair-CB37UXsz.js +0 -210
- package/dist/_chunks/key-value-pair-CB37UXsz.js.map +0 -1
- package/dist/_chunks/practice-results-U-5kpnJa.js.map +0 -1
- package/dist/_chunks/public-footer-t6gx6sjn.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { jsx as r, jsxs as n, Fragment as N } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as F, useId as M } from "react";
|
|
3
3
|
import { useTranslation as U } from "react-i18next";
|
|
4
4
|
import { B as P } from "./badge-BUk4RjTS.js";
|
|
5
|
-
import { a as G } from "./key-value-pair-
|
|
5
|
+
import { a as G } from "./key-value-pair-DOTl68_U.js";
|
|
6
6
|
import { L as O } from "./link-DtCfnLnF.js";
|
|
7
7
|
import { S as $ } from "./separator-Bdc9bqoJ.js";
|
|
8
8
|
import { T as A } from "./timestamp-DPLDWdxA.js";
|
|
@@ -195,4 +195,4 @@ export {
|
|
|
195
195
|
ee as C,
|
|
196
196
|
X as c
|
|
197
197
|
};
|
|
198
|
-
//# sourceMappingURL=care-plan-header-
|
|
198
|
+
//# sourceMappingURL=care-plan-header-k8FslxsU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"care-plan-header-lROoTjYn.js","sources":["../../src/components/care-plan-header/care-plan-header.agent.ts","../../src/components/care-plan-header/care-plan-header.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — CarePlanHeader. */\n/* */\n/* Read-only surface: expose the plan's lifecycle state and the count of */\n/* attention alerts so an agent can introspect a plan header's status. */\n/* Enum + count only — never the plan name, the meta values (operator, */\n/* price list, …), or any patient identity. The actions slot is */\n/* consumer-provided, so no backing action is registered. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { CarePlanHeaderHandle } from './care-plan-header';\n\nexport const carePlanHeaderAgent: AgentAdapter<CarePlanHeaderHandle> = {\n id: 'care-plan-header',\n capabilities: [],\n state: {\n state: {\n type: \"'estimate' | 'accepted' | 'discarded' | 'closed'\",\n descriptionKey: 'ui.agent.carePlanHeader.state.state',\n description:\n 'The plan lifecycle state. Enum value only — never the localised label or any PHI.',\n read: (handle) => handle.getState(),\n },\n alertCount: {\n type: 'number',\n descriptionKey: 'ui.agent.carePlanHeader.state.alertCount',\n description:\n 'How many attention alerts (e.g. missing signature) are showing. Count only — never the alert labels.',\n read: (handle) => handle.getAlertCount(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'care-plan-header',\n description: 'Marks the CarePlanHeader root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Addresses a specific plan header.',\n },\n },\n};\n","import {\n forwardRef,\n useId,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Badge, type BadgeProps } from '../badge/badge';\nimport { KeyValuePair } from '../key-value-pair/key-value-pair';\nimport { Link } from '../link/link';\nimport { Separator } from '../separator/separator';\nimport { Timestamp } from '../timestamp/timestamp';\nimport {\n entitySurfaceVariants,\n CARE_PLAN_STATE_BADGE,\n isSafeEntityUrl,\n type CarePlanState,\n} from '../_shared/entity-card';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { carePlanHeaderAgent } from './care-plan-header.agent';\n\n/* -------------------------------------------------------------------- */\n/* CarePlanHeader */\n/* */\n/* The identity + meta BANNER for a care plan / estimate — the header */\n/* that crowns an editor or a detail view. The lighter sibling of */\n/* `CarePlanCard`: where that card is the read-only WHOLE-plan summary */\n/* (financials + a phase-progress bar + an entries accordion), */\n/* CarePlanHeader is just the plan's identity (number, name, lifecycle */\n/* badge), its attention alerts (e.g. a missing signature), a consumer- */\n/* labelled meta strip (operator, price list, …), lifecycle dates, and an */\n/* actions slot. It carries NO entries / financials, so it sits cleanly */\n/* atop an EDITABLE surface (odontogram + treatments table) without */\n/* duplicating it. */\n/* */\n/* Composes: entitySurfaceVariants (the shared entity-card surface) + */\n/* Badge (lifecycle state + alerts) + Timestamp (dates) + Link (deep */\n/* link) + KeyValuePair (meta). Reuses the `carePlanCard.*` lifecycle / */\n/* number / date vocabulary, so the header and the summary card speak the */\n/* SAME localised plan language. Identifiers + structural state only reach */\n/* the agent layer — never patient identity. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\nexport type { CarePlanState } from '../_shared/entity-card';\n\n/** Heading element the plan name / number renders as. */\nexport type CarePlanHeaderHeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\n/** Tone of an attention alert chip → the Badge variant it paints with. */\nexport type CarePlanHeaderAlertTone = 'warning' | 'error' | 'info';\n\n/**\n * One attention alert shown as a chip beneath the heading — e.g. a missing\n * signature, an expired estimate. The kit owns the chip; the consumer owns the\n * (already-localised) label and the meaning.\n */\nexport interface CarePlanHeaderAlert {\n /** Stable key — identifier only, never PHI. Keys the chip + agent count. */\n id: string;\n /** Already-localised label (consumer-provided). */\n label: ReactNode;\n /** Severity tone. Defaults to `warning`. */\n tone?: CarePlanHeaderAlertTone;\n /** Optional leading glyph (a single lucide element). */\n icon?: ReactElement;\n}\n\n/**\n * One meta fact in the footer strip — operator, price list, referrer, …. The\n * label is consumer-localised; the value is any node (text, an Avatar + name,\n * a Link). Rendered through the shared `KeyValuePair`.\n */\nexport interface CarePlanHeaderMetaItem {\n /** Stable key — identifier only, never PHI. */\n id: string;\n /** Already-localised label (consumer-provided). */\n label: string;\n /** Value node. */\n value: ReactNode;\n /** Optional leading glyph for the pair (a single lucide element). */\n icon?: ReactElement | null;\n}\n\n/** Lifecycle dates — each an ISO-8601 string, rendered via `Timestamp`. */\nexport interface CarePlanHeaderDates {\n /** Acceptance date. */\n acceptedIso?: string;\n /** Closure date. */\n closedIso?: string;\n /** Discard date. */\n discardedIso?: string;\n}\n\n/**\n * Imperative handle the agent adapter drives. Reads only structural state —\n * the lifecycle enum and the count of alerts. Never the plan name, the meta\n * values, or any patient identity.\n */\nexport interface CarePlanHeaderHandle {\n /** The plan lifecycle state (enum, never the localised label). */\n getState: () => CarePlanState;\n /** How many attention alerts are showing. */\n getAlertCount: () => number;\n}\n\nexport interface CarePlanHeaderProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title'\n> {\n /** Agent-readiness instance id, surfaced as `data-component-id`. */\n id?: string;\n /**\n * Plan number — used as the heading when no `name` is given (matching\n * platform's `getPresentationName()`, which falls back to `Piano #{number}`)\n * and as the plan's structural identity for the agent layer.\n */\n number: string | number;\n /**\n * Override the number-as-heading label (e.g. a consumer's own `Plan #15`),\n * used ONLY when no `name` is given. Defaults to the localised\n * `Care plan {{number}}` shared with `CarePlanCard`, so the two surfaces read\n * alike unless a consumer opts out. With a `name` present the number is not\n * shown — platform draws no separate plan-number eyebrow.\n */\n numberLabel?: ReactNode;\n /** Plan name — the title heading. Omit for a number-only header. */\n name?: ReactNode;\n /** Lifecycle state — drives the badge variant + localised label. */\n state: CarePlanState;\n /** Deep link for the heading. Rendered only when it passes the safe-URL gate. */\n url?: string;\n /** Attention alerts (e.g. signature missing) shown as chips under the heading. */\n alerts?: CarePlanHeaderAlert[];\n /** Consumer-labelled meta facts (operator, price list, …) in the footer. */\n meta?: CarePlanHeaderMetaItem[];\n /**\n * Lifecycle dates. The date matching the current `state` is folded into the\n * lifecycle badge (e.g. \"Accepted · {date}\"), making the badge self-describing;\n * any other date (e.g. the acceptance date of a now-closed plan) renders as a\n * muted `Timestamp` line beneath the meta.\n */\n dates?: CarePlanHeaderDates;\n /** Inline-end actions slot (e.g. Share / Print). */\n actions?: ReactNode;\n /** Heading element the name / number renders as. Defaults to `h3`. */\n headingTag?: CarePlanHeaderHeadingTag;\n /** `elevated` (default) paints the kit card chrome; `flat` drops it. */\n surface?: 'flat' | 'elevated';\n /** Internal padding density. Defaults to `comfortable`. */\n density?: 'comfortable' | 'compact';\n /** BCP-47 locale override for the dates. Defaults to `i18n.language`. */\n locale?: string;\n /** Fires when the plan deep link / heading is activated. */\n onActivate?: () => void;\n /** Accessible name override for the plan region (defaults to the heading). */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Helpers */\n/* -------------------------------------------------------------------- */\n\n/** English fallbacks for the (reused) lifecycle-state labels. */\nconst STATE_LABEL_FALLBACK: Record<CarePlanState, string> = {\n estimate: 'Estimate',\n accepted: 'Accepted',\n discarded: 'Discarded',\n closed: 'Closed',\n};\n\nconst ALERT_TONE_VARIANT: Record<\n CarePlanHeaderAlertTone,\n NonNullable<BadgeProps['variant']>\n> = {\n warning: 'warning',\n error: 'error',\n info: 'info',\n};\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const CarePlanHeader = forwardRef<HTMLElement, CarePlanHeaderProps>(\n function CarePlanHeader(\n {\n id,\n number,\n numberLabel,\n name,\n state,\n url,\n alerts,\n meta,\n dates,\n actions,\n headingTag = 'h3',\n surface = 'elevated',\n density = 'comfortable',\n locale,\n onActivate,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) {\n const { t, i18n } = useTranslation('ui');\n const headingId = useId();\n const activeLocale = locale ?? i18n.language ?? 'en';\n\n useAgentRegistration(\n carePlanHeaderAgent,\n {\n getState: () => state,\n getAlertCount: () => alerts?.length ?? 0,\n },\n id,\n );\n\n const resolvedNumberLabel =\n numberLabel ??\n t('carePlanCard.number', {\n number,\n defaultValue: 'Care plan {{number}}',\n });\n const stateLabel = t(`carePlanCard.state.${state}`, {\n defaultValue: STATE_LABEL_FALLBACK[state],\n });\n\n const hasName = name != null && name !== '';\n const hasSafeUrl = !!url && isSafeEntityUrl(url);\n const hasAlerts = !!alerts && alerts.length > 0;\n const hasMeta = !!meta && meta.length > 0;\n\n // The date that matches the CURRENT lifecycle state rides INSIDE the state\n // badge (e.g. \"Accepted · {date}\") — the badge becomes self-describing. Any\n // OTHER dates (e.g. the acceptance date of a now-closed plan) remain in the\n // muted footer line below.\n const stateDateIso =\n state === 'accepted'\n ? dates?.acceptedIso\n : state === 'closed'\n ? dates?.closedIso\n : state === 'discarded'\n ? dates?.discardedIso\n : undefined;\n\n const footerDates: Array<{ key: string; label: string; iso: string }> = [];\n if (dates?.acceptedIso && state !== 'accepted') {\n footerDates.push({\n key: 'accepted',\n label: t('carePlanCard.date.accepted', 'Accepted on'),\n iso: dates.acceptedIso,\n });\n }\n if (dates?.closedIso && state !== 'closed') {\n footerDates.push({\n key: 'closed',\n label: t('carePlanCard.date.closed', 'Closed on'),\n iso: dates.closedIso,\n });\n }\n if (dates?.discardedIso && state !== 'discarded') {\n footerDates.push({\n key: 'discarded',\n label: t('carePlanCard.date.discarded', 'Discarded on'),\n iso: dates.discardedIso,\n });\n }\n const hasDates = footerDates.length > 0;\n\n const Heading = headingTag;\n const headingNode = (\n <Heading\n id={headingId}\n className=\"type-title-card ds:m-0 ds:text-[color:var(--foreground)]\"\n >\n {hasName ? name : resolvedNumberLabel}\n </Heading>\n );\n\n const datesLine = hasDates ? (\n <div className=\"type-body-sm ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-2xs)] ds:text-[color:var(--muted-foreground)]\">\n {footerDates.map((d) => (\n <span\n key={d.key}\n className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]\"\n >\n <span>{d.label}</span>\n <Timestamp value={d.iso} format=\"absolute\" locale={activeLocale} />\n </span>\n ))}\n </div>\n ) : null;\n\n return (\n <section\n ref={ref}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabel ? undefined : headingId}\n data-component=\"care-plan-header\"\n data-component-id={id}\n data-state={state}\n id={id}\n className={entitySurfaceVariants({ surface, density, className })}\n {...rest}\n >\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Heading row: the plan's single title (name, or the number label as\n a fallback when unnamed — platform's `getPresentationName()`) on\n the inline-start, the document actions docked inline-end. */}\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:min-w-0 ds:flex-1\">\n {hasSafeUrl ? (\n <Link\n href={url as string}\n weight=\"strong\"\n onClick={(event) => {\n if (\n event.defaultPrevented ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey\n ) {\n return;\n }\n onActivate?.();\n }}\n >\n {headingNode}\n </Link>\n ) : (\n headingNode\n )}\n </div>\n {actions ? (\n <div className=\"ds:flex ds:shrink-0 ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {actions}\n </div>\n ) : null}\n </div>\n\n {/* Lifecycle state + attention alerts — chips beneath the title. The\n state badge always leads the row; consumer alerts (e.g. a missing\n signature) follow. Size + gap match the shared metadata-chip strip\n (Badge `md` default + `gap-xs`) used by PatientSummaryCard and the\n PatientDetails header, so every card on a patient screen reads with\n one chip rhythm. */}\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n <Badge variant={CARE_PLAN_STATE_BADGE[state]} size=\"md\" withDot>\n {stateLabel}\n {stateDateIso ? (\n <>\n {' · '}\n <Timestamp\n value={stateDateIso}\n format=\"absolute\"\n locale={activeLocale}\n shape=\"bare\"\n />\n </>\n ) : null}\n </Badge>\n {hasAlerts\n ? alerts!.map((alert) => (\n <Badge\n key={alert.id}\n variant={ALERT_TONE_VARIANT[alert.tone ?? 'warning']}\n size=\"md\"\n leading={alert.icon}\n >\n {alert.label}\n </Badge>\n ))\n : null}\n </div>\n\n {/* Footer: meta (operator, price list, …) + lifecycle dates. */}\n {hasMeta || hasDates ? (\n <>\n <Separator orientation=\"horizontal\" />\n <div className=\"ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-xs)]\">\n {hasMeta ? (\n <div className=\"ds:flex ds:flex-wrap ds:gap-x-[var(--spacing-lg)] ds:gap-y-[var(--spacing-xs)]\">\n {meta!.map((item) => (\n <KeyValuePair\n key={item.id}\n label={item.label}\n value={item.value}\n icon={item.icon ?? undefined}\n data-field-id={item.id}\n />\n ))}\n </div>\n ) : null}\n {datesLine}\n </div>\n </>\n ) : null}\n </div>\n </section>\n );\n },\n);\n\nCarePlanHeader.displayName = 'CarePlanHeader';\n\n/** Surface variant union re-exported for downstream typing. */\nexport type CarePlanHeaderSurface = NonNullable<\n VariantProps<typeof entitySurfaceVariants>['surface']\n>;\n"],"names":["carePlanHeaderAgent","handle","STATE_LABEL_FALLBACK","ALERT_TONE_VARIANT","CarePlanHeader","forwardRef","id","number","numberLabel","name","state","url","alerts","meta","dates","actions","headingTag","surface","density","locale","onActivate","ariaLabel","className","rest","ref","t","i18n","useTranslation","headingId","useId","activeLocale","useAgentRegistration","resolvedNumberLabel","stateLabel","hasName","hasSafeUrl","isSafeEntityUrl","hasAlerts","hasMeta","stateDateIso","footerDates","hasDates","headingNode","jsx","datesLine","d","jsxs","Timestamp","entitySurfaceVariants","Link","event","Badge","CARE_PLAN_STATE_BADGE","Fragment","alert","Separator","item","KeyValuePair"],"mappings":";;;;;;;;;;;AAaO,MAAMA,IAA0D;AAAA,EACrE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,I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AAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAxC,GAAe,cAAc;"}
|
|
1
|
+
{"version":3,"file":"care-plan-header-k8FslxsU.js","sources":["../../src/components/care-plan-header/care-plan-header.agent.ts","../../src/components/care-plan-header/care-plan-header.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — CarePlanHeader. */\n/* */\n/* Read-only surface: expose the plan's lifecycle state and the count of */\n/* attention alerts so an agent can introspect a plan header's status. */\n/* Enum + count only — never the plan name, the meta values (operator, */\n/* price list, …), or any patient identity. The actions slot is */\n/* consumer-provided, so no backing action is registered. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { CarePlanHeaderHandle } from './care-plan-header';\n\nexport const carePlanHeaderAgent: AgentAdapter<CarePlanHeaderHandle> = {\n id: 'care-plan-header',\n capabilities: [],\n state: {\n state: {\n type: \"'estimate' | 'accepted' | 'discarded' | 'closed'\",\n descriptionKey: 'ui.agent.carePlanHeader.state.state',\n description:\n 'The plan lifecycle state. Enum value only — never the localised label or any PHI.',\n read: (handle) => handle.getState(),\n },\n alertCount: {\n type: 'number',\n descriptionKey: 'ui.agent.carePlanHeader.state.alertCount',\n description:\n 'How many attention alerts (e.g. missing signature) are showing. Count only — never the alert labels.',\n read: (handle) => handle.getAlertCount(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'care-plan-header',\n description: 'Marks the CarePlanHeader root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Addresses a specific plan header.',\n },\n },\n};\n","import {\n forwardRef,\n useId,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { Badge, type BadgeProps } from '../badge/badge';\nimport { KeyValuePair } from '../key-value-pair/key-value-pair';\nimport { Link } from '../link/link';\nimport { Separator } from '../separator/separator';\nimport { Timestamp } from '../timestamp/timestamp';\nimport {\n entitySurfaceVariants,\n CARE_PLAN_STATE_BADGE,\n isSafeEntityUrl,\n type CarePlanState,\n} from '../_shared/entity-card';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { carePlanHeaderAgent } from './care-plan-header.agent';\n\n/* -------------------------------------------------------------------- */\n/* CarePlanHeader */\n/* */\n/* The identity + meta BANNER for a care plan / estimate — the header */\n/* that crowns an editor or a detail view. The lighter sibling of */\n/* `CarePlanCard`: where that card is the read-only WHOLE-plan summary */\n/* (financials + a phase-progress bar + an entries accordion), */\n/* CarePlanHeader is just the plan's identity (number, name, lifecycle */\n/* badge), its attention alerts (e.g. a missing signature), a consumer- */\n/* labelled meta strip (operator, price list, …), lifecycle dates, and an */\n/* actions slot. It carries NO entries / financials, so it sits cleanly */\n/* atop an EDITABLE surface (odontogram + treatments table) without */\n/* duplicating it. */\n/* */\n/* Composes: entitySurfaceVariants (the shared entity-card surface) + */\n/* Badge (lifecycle state + alerts) + Timestamp (dates) + Link (deep */\n/* link) + KeyValuePair (meta). Reuses the `carePlanCard.*` lifecycle / */\n/* number / date vocabulary, so the header and the summary card speak the */\n/* SAME localised plan language. Identifiers + structural state only reach */\n/* the agent layer — never patient identity. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\nexport type { CarePlanState } from '../_shared/entity-card';\n\n/** Heading element the plan name / number renders as. */\nexport type CarePlanHeaderHeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\n/** Tone of an attention alert chip → the Badge variant it paints with. */\nexport type CarePlanHeaderAlertTone = 'warning' | 'error' | 'info';\n\n/**\n * One attention alert shown as a chip beneath the heading — e.g. a missing\n * signature, an expired estimate. The kit owns the chip; the consumer owns the\n * (already-localised) label and the meaning.\n */\nexport interface CarePlanHeaderAlert {\n /** Stable key — identifier only, never PHI. Keys the chip + agent count. */\n id: string;\n /** Already-localised label (consumer-provided). */\n label: ReactNode;\n /** Severity tone. Defaults to `warning`. */\n tone?: CarePlanHeaderAlertTone;\n /** Optional leading glyph (a single lucide element). */\n icon?: ReactElement;\n}\n\n/**\n * One meta fact in the footer strip — operator, price list, referrer, …. The\n * label is consumer-localised; the value is any node (text, an Avatar + name,\n * a Link). Rendered through the shared `KeyValuePair`.\n */\nexport interface CarePlanHeaderMetaItem {\n /** Stable key — identifier only, never PHI. */\n id: string;\n /** Already-localised label (consumer-provided). */\n label: string;\n /** Value node. */\n value: ReactNode;\n /** Optional leading glyph for the pair (a single lucide element). */\n icon?: ReactElement | null;\n}\n\n/** Lifecycle dates — each an ISO-8601 string, rendered via `Timestamp`. */\nexport interface CarePlanHeaderDates {\n /** Acceptance date. */\n acceptedIso?: string;\n /** Closure date. */\n closedIso?: string;\n /** Discard date. */\n discardedIso?: string;\n}\n\n/**\n * Imperative handle the agent adapter drives. Reads only structural state —\n * the lifecycle enum and the count of alerts. Never the plan name, the meta\n * values, or any patient identity.\n */\nexport interface CarePlanHeaderHandle {\n /** The plan lifecycle state (enum, never the localised label). */\n getState: () => CarePlanState;\n /** How many attention alerts are showing. */\n getAlertCount: () => number;\n}\n\nexport interface CarePlanHeaderProps extends Omit<\n HTMLAttributes<HTMLElement>,\n 'title'\n> {\n /** Agent-readiness instance id, surfaced as `data-component-id`. */\n id?: string;\n /**\n * Plan number — used as the heading when no `name` is given (matching\n * platform's `getPresentationName()`, which falls back to `Piano #{number}`)\n * and as the plan's structural identity for the agent layer.\n */\n number: string | number;\n /**\n * Override the number-as-heading label (e.g. a consumer's own `Plan #15`),\n * used ONLY when no `name` is given. Defaults to the localised\n * `Care plan {{number}}` shared with `CarePlanCard`, so the two surfaces read\n * alike unless a consumer opts out. With a `name` present the number is not\n * shown — platform draws no separate plan-number eyebrow.\n */\n numberLabel?: ReactNode;\n /** Plan name — the title heading. Omit for a number-only header. */\n name?: ReactNode;\n /** Lifecycle state — drives the badge variant + localised label. */\n state: CarePlanState;\n /** Deep link for the heading. Rendered only when it passes the safe-URL gate. */\n url?: string;\n /** Attention alerts (e.g. signature missing) shown as chips under the heading. */\n alerts?: CarePlanHeaderAlert[];\n /** Consumer-labelled meta facts (operator, price list, …) in the footer. */\n meta?: CarePlanHeaderMetaItem[];\n /**\n * Lifecycle dates. The date matching the current `state` is folded into the\n * lifecycle badge (e.g. \"Accepted · {date}\"), making the badge self-describing;\n * any other date (e.g. the acceptance date of a now-closed plan) renders as a\n * muted `Timestamp` line beneath the meta.\n */\n dates?: CarePlanHeaderDates;\n /** Inline-end actions slot (e.g. Share / Print). */\n actions?: ReactNode;\n /** Heading element the name / number renders as. Defaults to `h3`. */\n headingTag?: CarePlanHeaderHeadingTag;\n /** `elevated` (default) paints the kit card chrome; `flat` drops it. */\n surface?: 'flat' | 'elevated';\n /** Internal padding density. Defaults to `comfortable`. */\n density?: 'comfortable' | 'compact';\n /** BCP-47 locale override for the dates. Defaults to `i18n.language`. */\n locale?: string;\n /** Fires when the plan deep link / heading is activated. */\n onActivate?: () => void;\n /** Accessible name override for the plan region (defaults to the heading). */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Helpers */\n/* -------------------------------------------------------------------- */\n\n/** English fallbacks for the (reused) lifecycle-state labels. */\nconst STATE_LABEL_FALLBACK: Record<CarePlanState, string> = {\n estimate: 'Estimate',\n accepted: 'Accepted',\n discarded: 'Discarded',\n closed: 'Closed',\n};\n\nconst ALERT_TONE_VARIANT: Record<\n CarePlanHeaderAlertTone,\n NonNullable<BadgeProps['variant']>\n> = {\n warning: 'warning',\n error: 'error',\n info: 'info',\n};\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const CarePlanHeader = forwardRef<HTMLElement, CarePlanHeaderProps>(\n function CarePlanHeader(\n {\n id,\n number,\n numberLabel,\n name,\n state,\n url,\n alerts,\n meta,\n dates,\n actions,\n headingTag = 'h3',\n surface = 'elevated',\n density = 'comfortable',\n locale,\n onActivate,\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) {\n const { t, i18n } = useTranslation('ui');\n const headingId = useId();\n const activeLocale = locale ?? i18n.language ?? 'en';\n\n useAgentRegistration(\n carePlanHeaderAgent,\n {\n getState: () => state,\n getAlertCount: () => alerts?.length ?? 0,\n },\n id,\n );\n\n const resolvedNumberLabel =\n numberLabel ??\n t('carePlanCard.number', {\n number,\n defaultValue: 'Care plan {{number}}',\n });\n const stateLabel = t(`carePlanCard.state.${state}`, {\n defaultValue: STATE_LABEL_FALLBACK[state],\n });\n\n const hasName = name != null && name !== '';\n const hasSafeUrl = !!url && isSafeEntityUrl(url);\n const hasAlerts = !!alerts && alerts.length > 0;\n const hasMeta = !!meta && meta.length > 0;\n\n // The date that matches the CURRENT lifecycle state rides INSIDE the state\n // badge (e.g. \"Accepted · {date}\") — the badge becomes self-describing. Any\n // OTHER dates (e.g. the acceptance date of a now-closed plan) remain in the\n // muted footer line below.\n const stateDateIso =\n state === 'accepted'\n ? dates?.acceptedIso\n : state === 'closed'\n ? dates?.closedIso\n : state === 'discarded'\n ? dates?.discardedIso\n : undefined;\n\n const footerDates: Array<{ key: string; label: string; iso: string }> = [];\n if (dates?.acceptedIso && state !== 'accepted') {\n footerDates.push({\n key: 'accepted',\n label: t('carePlanCard.date.accepted', 'Accepted on'),\n iso: dates.acceptedIso,\n });\n }\n if (dates?.closedIso && state !== 'closed') {\n footerDates.push({\n key: 'closed',\n label: t('carePlanCard.date.closed', 'Closed on'),\n iso: dates.closedIso,\n });\n }\n if (dates?.discardedIso && state !== 'discarded') {\n footerDates.push({\n key: 'discarded',\n label: t('carePlanCard.date.discarded', 'Discarded on'),\n iso: dates.discardedIso,\n });\n }\n const hasDates = footerDates.length > 0;\n\n const Heading = headingTag;\n const headingNode = (\n <Heading\n id={headingId}\n className=\"type-title-card ds:m-0 ds:text-[color:var(--foreground)]\"\n >\n {hasName ? name : resolvedNumberLabel}\n </Heading>\n );\n\n const datesLine = hasDates ? (\n <div className=\"type-body-sm ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-2xs)] ds:text-[color:var(--muted-foreground)]\">\n {footerDates.map((d) => (\n <span\n key={d.key}\n className=\"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]\"\n >\n <span>{d.label}</span>\n <Timestamp value={d.iso} format=\"absolute\" locale={activeLocale} />\n </span>\n ))}\n </div>\n ) : null;\n\n return (\n <section\n ref={ref}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabel ? undefined : headingId}\n data-component=\"care-plan-header\"\n data-component-id={id}\n data-state={state}\n id={id}\n className={entitySurfaceVariants({ surface, density, className })}\n {...rest}\n >\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Heading row: the plan's single title (name, or the number label as\n a fallback when unnamed — platform's `getPresentationName()`) on\n the inline-start, the document actions docked inline-end. */}\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-sm)]\">\n <div className=\"ds:min-w-0 ds:flex-1\">\n {hasSafeUrl ? (\n <Link\n href={url as string}\n weight=\"strong\"\n onClick={(event) => {\n if (\n event.defaultPrevented ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey\n ) {\n return;\n }\n onActivate?.();\n }}\n >\n {headingNode}\n </Link>\n ) : (\n headingNode\n )}\n </div>\n {actions ? (\n <div className=\"ds:flex ds:shrink-0 ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n {actions}\n </div>\n ) : null}\n </div>\n\n {/* Lifecycle state + attention alerts — chips beneath the title. The\n state badge always leads the row; consumer alerts (e.g. a missing\n signature) follow. Size + gap match the shared metadata-chip strip\n (Badge `md` default + `gap-xs`) used by PatientSummaryCard and the\n PatientDetails header, so every card on a patient screen reads with\n one chip rhythm. */}\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]\">\n <Badge variant={CARE_PLAN_STATE_BADGE[state]} size=\"md\" withDot>\n {stateLabel}\n {stateDateIso ? (\n <>\n {' · '}\n <Timestamp\n value={stateDateIso}\n format=\"absolute\"\n locale={activeLocale}\n shape=\"bare\"\n />\n </>\n ) : null}\n </Badge>\n {hasAlerts\n ? alerts!.map((alert) => (\n <Badge\n key={alert.id}\n variant={ALERT_TONE_VARIANT[alert.tone ?? 'warning']}\n size=\"md\"\n leading={alert.icon}\n >\n {alert.label}\n </Badge>\n ))\n : null}\n </div>\n\n {/* Footer: meta (operator, price list, …) + lifecycle dates. */}\n {hasMeta || hasDates ? (\n <>\n <Separator orientation=\"horizontal\" />\n <div className=\"ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-xs)]\">\n {hasMeta ? (\n <div className=\"ds:flex ds:flex-wrap ds:gap-x-[var(--spacing-lg)] ds:gap-y-[var(--spacing-xs)]\">\n {meta!.map((item) => (\n <KeyValuePair\n key={item.id}\n label={item.label}\n value={item.value}\n icon={item.icon ?? undefined}\n data-field-id={item.id}\n />\n ))}\n </div>\n ) : null}\n {datesLine}\n </div>\n </>\n ) : null}\n </div>\n </section>\n );\n },\n);\n\nCarePlanHeader.displayName = 'CarePlanHeader';\n\n/** Surface variant union re-exported for downstream typing. */\nexport type CarePlanHeaderSurface = NonNullable<\n VariantProps<typeof entitySurfaceVariants>['surface']\n>;\n"],"names":["carePlanHeaderAgent","handle","STATE_LABEL_FALLBACK","ALERT_TONE_VARIANT","CarePlanHeader","forwardRef","id","number","numberLabel","name","state","url","alerts","meta","dates","actions","headingTag","surface","density","locale","onActivate","ariaLabel","className","rest","ref","t","i18n","useTranslation","headingId","useId","activeLocale","useAgentRegistration","resolvedNumberLabel","stateLabel","hasName","hasSafeUrl","isSafeEntityUrl","hasAlerts","hasMeta","stateDateIso","footerDates","hasDates","headingNode","jsx","datesLine","d","jsxs","Timestamp","entitySurfaceVariants","Link","event","Badge","CARE_PLAN_STATE_BADGE","Fragment","alert","Separator","item","KeyValuePair"],"mappings":";;;;;;;;;;;AAaO,MAAMA,IAA0D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AAA,CACH;AAAA,UAAA,EAAA,CACF,IACE;AAAA,QAAA,EAAA,CACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAxC,GAAe,cAAc;"}
|
|
@@ -3,7 +3,7 @@ import { forwardRef as T, useMemo as z, Fragment as l } from "react";
|
|
|
3
3
|
import { c as h } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as B } from "react-i18next";
|
|
5
5
|
import { B as F } from "./button-DohK_Ak_.js";
|
|
6
|
-
import { A as I } from "./avatar-
|
|
6
|
+
import { A as I } from "./avatar-Dp5apm1d.js";
|
|
7
7
|
import { T as A } from "./timestamp-DPLDWdxA.js";
|
|
8
8
|
import { s as M, C as S } from "./code-block-BTsCXVGI.js";
|
|
9
9
|
import { s as V } from "./safe-image-src-DstKgCo7.js";
|
|
@@ -236,4 +236,4 @@ J.displayName = "ChatMessage";
|
|
|
236
236
|
export {
|
|
237
237
|
J as C
|
|
238
238
|
};
|
|
239
|
-
//# sourceMappingURL=chat-message-
|
|
239
|
+
//# sourceMappingURL=chat-message-CfIyXrxA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-message-CkBCAcwn.js","sources":["../../src/components/chat-message/chat-message.tsx"],"sourcesContent":["import {\n forwardRef,\n Fragment,\n useMemo,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { CircleAlert, Check, Clock, RotateCcw } from 'lucide-react';\nimport { Button } from '../button';\nimport { Avatar } from '../avatar';\nimport { Timestamp } from '../timestamp';\nimport { safeImageSrc } from '../_shared';\nimport { CodeBlock, splitCodeFences } from '../_shared/code-block';\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\nexport type ChatMessageRole = 'user' | 'assistant' | 'system';\nexport type ChatMessageStatus = 'sending' | 'sent' | 'error' | 'edited';\n\nexport interface ChatMessageAvatar {\n name?: string;\n src?: string;\n /**\n * Optional custom avatar node. When provided, it REPLACES the built-in\n * `<Avatar>` (initials / image) for this message. Used by the Alia\n * pattern to render a Astroid identity tile instead of an avatar, and\n * by consumers that want to swap in a user-icon chip, brand glyph, etc.\n * The caller is responsible for accessible labelling on the custom node\n * — ChatMessage's own `aria-label` already announces the role/time, so\n * purely decorative nodes can be `aria-hidden`.\n */\n slot?: ReactNode;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst rowVariants = cva(\n 'ds:flex ds:w-full ds:items-start ds:gap-[var(--spacing-sm)]',\n {\n variants: {\n role: {\n user: 'ds:flex-row-reverse',\n assistant: 'ds:flex-row',\n system: 'ds:flex-col ds:items-center ds:text-center',\n },\n },\n defaultVariants: { role: 'assistant' },\n },\n);\n\nconst bubbleVariants = cva(\n [\n // Cap at 42rem on wide surfaces; on narrow docks (Alia sidebar ≈22rem)\n // leave room for the avatar column (size-8 = 32px = --spacing-xl) +\n // `gap-sm` (8px = --spacing-sm) so avatars don't clip off the inline\n // edge when the row is width-constrained.\n 'ds:relative ds:max-w-[min(42rem,calc(100%-var(--spacing-xl)-var(--spacing-sm)))]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]',\n 'type-body',\n 'ds:break-words',\n ].join(' '),\n {\n variants: {\n role: {\n user: 'ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:rounded-[var(--radius-md)] ds:rounded-ee-[var(--radius-sm)]',\n assistant:\n 'ds:bg-muted/40 ds:text-foreground ds:rounded-[var(--radius-md)] ds:rounded-es-[var(--radius-sm)]',\n system:\n 'ds:bg-transparent ds:text-[color:var(--muted-foreground)] type-body-sm ds:italic',\n },\n },\n defaultVariants: { role: 'assistant' },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Safe markdown-ish (bold, inline code, line-breaks, links as text) */\n/* No dangerouslySetInnerHTML. */\n/* ------------------------------------------------------------------ */\n\ntype Token =\n | { type: 'text'; value: string }\n | { type: 'bold'; value: string }\n | { type: 'code'; value: string }\n | { type: 'br' }\n | { type: 'link'; label: string; href: string };\n\nconst SAFE_SCHEMES = /^(https?:|mailto:)/i;\n\nfunction tokenize(input: string): Token[] {\n const tokens: Token[] = [];\n let remaining = input;\n const pattern = /\\*\\*([^*]+)\\*\\*|`([^`]+)`|\\[([^\\]]+)\\]\\(([^)]+)\\)|\\n/;\n while (remaining.length > 0) {\n const match = pattern.exec(remaining);\n if (!match) {\n tokens.push({ type: 'text', value: remaining });\n break;\n }\n if (match.index > 0) {\n tokens.push({ type: 'text', value: remaining.slice(0, match.index) });\n }\n if (match[1] !== undefined) {\n tokens.push({ type: 'bold', value: match[1] });\n } else if (match[2] !== undefined) {\n tokens.push({ type: 'code', value: match[2] });\n } else if (match[3] !== undefined && match[4] !== undefined) {\n tokens.push({ type: 'link', label: match[3], href: match[4] });\n } else {\n tokens.push({ type: 'br' });\n }\n remaining = remaining.slice(match.index + match[0].length);\n }\n return tokens;\n}\n\nfunction renderInline(input: string): ReactNode {\n return tokenize(input).map((tok, i) => {\n if (tok.type === 'bold') return <strong key={i}>{tok.value}</strong>;\n if (tok.type === 'code') {\n return (\n <code\n key={i}\n dir=\"ltr\"\n className=\"ds:rounded-[var(--radius-sm)] ds:bg-muted/30 ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)] ds:font-[family-name:var(--font-mono)]\"\n >\n {tok.value}\n </code>\n );\n }\n if (tok.type === 'br') return <br key={i} />;\n if (tok.type === 'link') {\n if (!SAFE_SCHEMES.test(tok.href)) {\n // Unsafe scheme (javascript:, data:) — render as inert text.\n return <Fragment key={i}>{tok.label}</Fragment>;\n }\n return (\n <a\n key={i}\n href={tok.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"ds:underline ds:underline-offset-2 ds:hover:opacity-80\"\n >\n {tok.label}\n </a>\n );\n }\n return <Fragment key={i}>{tok.value}</Fragment>;\n });\n}\n\n/**\n * Render a message body: split fenced code blocks out to `<CodeBlock>` and run\n * the inline tokenizer over the surrounding text runs.\n */\nfunction renderBody(input: string): ReactNode {\n return splitCodeFences(input).map((seg, i) => {\n if (seg.type === 'code') {\n return <CodeBlock key={i} code={seg.value} language={seg.lang} />;\n }\n return <Fragment key={i}>{renderInline(seg.value)}</Fragment>;\n });\n}\n\n/* ------------------------------------------------------------------ */\n/* ChatMessage */\n/* ------------------------------------------------------------------ */\n\ntype NativeProps = Omit<HTMLAttributes<HTMLElement>, 'content' | 'role'>;\n\nexport interface ChatMessageProps\n extends NativeProps, VariantProps<typeof bubbleVariants> {\n role: ChatMessageRole;\n content: string;\n avatar?: ChatMessageAvatar;\n timestamp?: Date | number | string;\n status?: ChatMessageStatus;\n /** Parse a small, safe subset of markdown. Never renders raw HTML. */\n renderMarkdown?: boolean;\n /** Invoked when the retry button is activated (error status only). */\n onRetry?: () => void;\n /**\n * Optional action row rendered beneath the message body + timestamp,\n * aligned with the message (e.g. the Alia pattern's Copy / Download\n * buttons on assistant messages). Default off → renders nothing.\n */\n actions?: ReactNode;\n /**\n * Custom body node rendered verbatim INSTEAD of `content`. When set, the\n * markdown tokenizer (`renderBody`) is skipped and the node is rendered\n * directly inside the bubble. `content` is still required (used for the\n * aria-label context and consumer copy / download). Default off.\n */\n body?: ReactNode;\n}\n\nexport const ChatMessage = forwardRef<HTMLElement, ChatMessageProps>(\n (\n {\n role,\n content,\n avatar,\n timestamp,\n status,\n renderMarkdown = false,\n onRetry,\n actions,\n body,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation('ui');\n\n // Local format — used for the aria-label interpolation only. Visible\n // label is rendered by `<Timestamp>` below, which computes the same\n // locale-aware HH:MM internally.\n const formattedTime = useMemo(() => {\n if (!timestamp) return null;\n const date = timestamp instanceof Date ? timestamp : new Date(timestamp);\n if (Number.isNaN(date.getTime())) return null;\n return new Intl.DateTimeFormat(i18n.language, {\n hour: '2-digit',\n minute: '2-digit',\n }).format(date);\n }, [timestamp, i18n.language]);\n\n const roleLabel = t(`chat.message.role.${role}`);\n const messageLabel = formattedTime\n ? t('chat.message.label', { role: roleLabel, time: formattedTime })\n : t('chat.message.labelNoTime', { role: roleLabel });\n\n const resolvedBody =\n body ?? (renderMarkdown ? renderBody(content) : content);\n\n const statusIcon = (() => {\n if (!status || status === 'edited') return null;\n if (status === 'sending')\n return <Clock aria-hidden=\"true\" className=\"ds:size-3.5\" />;\n if (status === 'sent')\n return <Check aria-hidden=\"true\" className=\"ds:size-3.5\" />;\n return (\n <CircleAlert\n aria-hidden=\"true\"\n className=\"ds:size-3.5 ds:text-[color:var(--destructive)]\"\n />\n );\n })();\n\n const statusText = status ? t(`chat.message.status.${status}`) : null;\n\n return (\n <article\n ref={ref}\n aria-label={messageLabel}\n data-component=\"chat-message\"\n // Structural state surfaced for agent reads (see chat-message.agent.ts).\n // `status` is optional → the attribute is omitted when unset.\n data-role={role}\n data-status={status}\n className={[\n rowVariants({ role, className }),\n // Entrance: fade + slide up on mount. `--animation-duration` is 0ms\n // under `prefers-reduced-motion` and `.theme-accessible`, so both\n // collapse the animation to an instant state change automatically.\n 'ds:motion-safe:animate-in ds:motion-safe:fade-in-0 ds:motion-safe:slide-in-from-bottom-2',\n 'ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n ].join(' ')}\n {...rest}\n >\n {role !== 'system' && avatar ? (\n avatar.slot ? (\n // Consumer-supplied avatar node (e.g. Alia's Astroid tile).\n avatar.slot\n ) : (\n // Allow-list the src: LLM-supplied values can carry\n // `javascript:` / `data:text/html` / `data:image/svg+xml` and so\n // are scrubbed here before reaching <Avatar>. Fallback to initials.\n <Avatar\n name={avatar.name}\n src={safeImageSrc(avatar.src)}\n size=\"sm\"\n />\n )\n ) : null}\n\n <div\n className={[\n // min-w-0 allows this flex item to shrink below its content's\n // natural width — without it, a single unbreakable token (URL,\n // CJK run, hash) can force the bubble wider than the parent\n // and spill outside narrow containers like the Alia sidebar.\n 'ds:flex ds:flex-col ds:min-w-0',\n role === 'user'\n ? 'ds:items-end'\n : role === 'assistant'\n ? 'ds:items-start'\n : 'ds:items-center',\n ].join(' ')}\n >\n <div\n dir=\"auto\"\n className={[\n bubbleVariants({ role }),\n // `break-words` (from bubbleVariants) handles soft hyphens;\n // `overflow-wrap: anywhere` is the last-resort break for\n // URLs, hashes, or CJK runs that would otherwise push the\n // bubble wider than its parent in narrow docks like Alia.\n 'ds:[overflow-wrap:anywhere]',\n ].join(' ')}\n >\n {resolvedBody}\n </div>\n\n {(formattedTime || statusText) && role !== 'system' ? (\n <div\n className={[\n 'ds:mt-[var(--spacing-xs)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'type-meta ds:text-[color:var(--muted-foreground)]',\n ].join(' ')}\n >\n {timestamp ? (\n <Timestamp\n value={timestamp}\n format=\"absolute\"\n absoluteFormat={{ hour: '2-digit', minute: '2-digit' }}\n dir=\"ltr\"\n />\n ) : null}\n {statusIcon ? (\n // `key={status}` re-mounts the span on every status change so\n // `animate-in` re-runs — gives the sending → sent → error\n // swap a subtle cross-fade instead of an abrupt pop.\n <span\n key={status}\n className={[\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:motion-safe:animate-in ds:motion-safe:fade-in-0',\n 'ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n ].join(' ')}\n >\n {statusIcon}\n <span className=\"ds:sr-only\">{statusText}</span>\n </span>\n ) : null}\n {status === 'error' && onRetry ? (\n <Button\n intent=\"ghost\"\n size=\"sm\"\n onClick={onRetry}\n startIcon={<RotateCcw />}\n >\n {t('chat.message.retry')}\n </Button>\n ) : null}\n </div>\n ) : null}\n {actions ? (\n <div className=\"ds:mt-[var(--spacing-xs)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n {actions}\n </div>\n ) : null}\n </div>\n </article>\n );\n },\n);\n\nChatMessage.displayName = 'ChatMessage';\n"],"names":["rowVariants","cva","bubbleVariants","SAFE_SCHEMES","tokenize","input","tokens","remaining","pattern","match","renderInline","tok","i","jsx","Fragment","renderBody","splitCodeFences","seg","CodeBlock","ChatMessage","forwardRef","role","content","avatar","timestamp","status","renderMarkdown","onRetry","actions","body","className","rest","ref","t","i18n","useTranslation","formattedTime","useMemo","date","roleLabel","messageLabel","resolvedBody","statusIcon","Clock","Check","CircleAlert","statusText","jsxs","Avatar","safeImageSrc","Timestamp","Button","RotateCcw"],"mappings":";;;;;;;;;;;;;AA0CA,MAAMA,IAAcC;AAAA,EAClB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,WAAW;AAAA,QACX,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,IAEF,iBAAiB,EAAE,MAAM,YAAA;AAAA,EAAY;AAEzC,GAEMC,IAAiBD;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA,IAKE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,WACE;AAAA,QACF,QACE;AAAA,MAAA;AAAA,IACJ;AAAA,IAEF,iBAAiB,EAAE,MAAM,YAAA;AAAA,EAAY;AAEzC,GAcME,IAAe;AAErB,SAASC,EAASC,GAAwB;AACxC,QAAMC,IAAkB,CAAA;AACxB,MAAIC,IAAYF;AAChB,QAAMG,IAAU;AAChB,SAAOD,EAAU,SAAS,KAAG;AAC3B,UAAME,IAAQD,EAAQ,KAAKD,CAAS;AACpC,QAAI,CAACE,GAAO;AACV,MAAAH,EAAO,KAAK,EAAE,MAAM,QAAQ,OAAOC,GAAW;AAC9C;AAAA,IACF;AACA,IAAIE,EAAM,QAAQ,KAChBH,EAAO,KAAK,EAAE,MAAM,QAAQ,OAAOC,EAAU,MAAM,GAAGE,EAAM,KAAK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AiBU,MAAezB,MAAS,WACzC,gBAAA0B;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,WAAW;AAAA,sBACT;AAAA,sBACA;AAAA,oBAAA,EACA,KAAK,GAAG;AAAA,oBAET,UAAA;AAAA,sBAAAvB,IACC,gBAAAX;AAAA,wBAACqC;AAAA,wBAAA;AAAA,0BACC,OAAO1B;AAAA,0BACP,QAAO;AAAA,0BACP,gBAAgB,EAAE,MAAM,WAAW,QAAQ,UAAA;AAAA,0BAC3C,KAAI;AAAA,wBAAA;AAAA,sBAAA,IAEJ;AAAA,sBACHkB;AAAA;AAAA;AAAA;AAAA,wBAIC,gBAAAK;AAAA,0BAAC;AAAA,0BAAA;AAAA,4BAEC,WAAW;AAAA,8BACT;AAAA,8BACA;AAAA,8BACA;AAAA,4BAAA,EACA,KAAK,GAAG;AAAA,4BAET,UAAA;AAAA,8BAAAL;AAAA,8BACD,gBAAA7B,EAAC,QAAA,EAAK,WAAU,cAAc,UAAAiC,EAAA,CAAW;AAAA,4BAAA;AAAA,0BAAA;AAAA,0BARpCrB;AAAA,wBAAA;AAAA,0BAUL;AAAA,sBACHA,MAAW,WAAWE,IACrB,gBAAAd;AAAA,wBAACsC;AAAA,wBAAA;AAAA,0BACC,QAAO;AAAA,0BACP,MAAK;AAAA,0BACL,SAASxB;AAAA,0BACT,6BAAYyB,GAAA,EAAU;AAAA,0BAErB,YAAE,oBAAoB;AAAA,wBAAA;AAAA,sBAAA,IAEvB;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAAA,IAEJ;AAAA,gBACHxB,IACC,gBAAAf,EAAC,OAAA,EAAI,WAAU,uFACZ,aACH,IACE;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAM,EAAY,cAAc;"}
|
|
1
|
+
{"version":3,"file":"chat-message-CfIyXrxA.js","sources":["../../src/components/chat-message/chat-message.tsx"],"sourcesContent":["import {\n forwardRef,\n Fragment,\n useMemo,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { CircleAlert, Check, Clock, RotateCcw } from 'lucide-react';\nimport { Button } from '../button';\nimport { Avatar } from '../avatar';\nimport { Timestamp } from '../timestamp';\nimport { safeImageSrc } from '../_shared';\nimport { CodeBlock, splitCodeFences } from '../_shared/code-block';\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\nexport type ChatMessageRole = 'user' | 'assistant' | 'system';\nexport type ChatMessageStatus = 'sending' | 'sent' | 'error' | 'edited';\n\nexport interface ChatMessageAvatar {\n name?: string;\n src?: string;\n /**\n * Optional custom avatar node. When provided, it REPLACES the built-in\n * `<Avatar>` (initials / image) for this message. Used by the Alia\n * pattern to render a Astroid identity tile instead of an avatar, and\n * by consumers that want to swap in a user-icon chip, brand glyph, etc.\n * The caller is responsible for accessible labelling on the custom node\n * — ChatMessage's own `aria-label` already announces the role/time, so\n * purely decorative nodes can be `aria-hidden`.\n */\n slot?: ReactNode;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst rowVariants = cva(\n 'ds:flex ds:w-full ds:items-start ds:gap-[var(--spacing-sm)]',\n {\n variants: {\n role: {\n user: 'ds:flex-row-reverse',\n assistant: 'ds:flex-row',\n system: 'ds:flex-col ds:items-center ds:text-center',\n },\n },\n defaultVariants: { role: 'assistant' },\n },\n);\n\nconst bubbleVariants = cva(\n [\n // Cap at 42rem on wide surfaces; on narrow docks (Alia sidebar ≈22rem)\n // leave room for the avatar column (size-8 = 32px = --spacing-xl) +\n // `gap-sm` (8px = --spacing-sm) so avatars don't clip off the inline\n // edge when the row is width-constrained.\n 'ds:relative ds:max-w-[min(42rem,calc(100%-var(--spacing-xl)-var(--spacing-sm)))]',\n 'ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]',\n 'ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]',\n 'type-body',\n 'ds:break-words',\n ].join(' '),\n {\n variants: {\n role: {\n user: 'ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)] ds:rounded-[var(--radius-md)] ds:rounded-ee-[var(--radius-sm)]',\n assistant:\n 'ds:bg-muted/40 ds:text-foreground ds:rounded-[var(--radius-md)] ds:rounded-es-[var(--radius-sm)]',\n system:\n 'ds:bg-transparent ds:text-[color:var(--muted-foreground)] type-body-sm ds:italic',\n },\n },\n defaultVariants: { role: 'assistant' },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Safe markdown-ish (bold, inline code, line-breaks, links as text) */\n/* No dangerouslySetInnerHTML. */\n/* ------------------------------------------------------------------ */\n\ntype Token =\n | { type: 'text'; value: string }\n | { type: 'bold'; value: string }\n | { type: 'code'; value: string }\n | { type: 'br' }\n | { type: 'link'; label: string; href: string };\n\nconst SAFE_SCHEMES = /^(https?:|mailto:)/i;\n\nfunction tokenize(input: string): Token[] {\n const tokens: Token[] = [];\n let remaining = input;\n const pattern = /\\*\\*([^*]+)\\*\\*|`([^`]+)`|\\[([^\\]]+)\\]\\(([^)]+)\\)|\\n/;\n while (remaining.length > 0) {\n const match = pattern.exec(remaining);\n if (!match) {\n tokens.push({ type: 'text', value: remaining });\n break;\n }\n if (match.index > 0) {\n tokens.push({ type: 'text', value: remaining.slice(0, match.index) });\n }\n if (match[1] !== undefined) {\n tokens.push({ type: 'bold', value: match[1] });\n } else if (match[2] !== undefined) {\n tokens.push({ type: 'code', value: match[2] });\n } else if (match[3] !== undefined && match[4] !== undefined) {\n tokens.push({ type: 'link', label: match[3], href: match[4] });\n } else {\n tokens.push({ type: 'br' });\n }\n remaining = remaining.slice(match.index + match[0].length);\n }\n return tokens;\n}\n\nfunction renderInline(input: string): ReactNode {\n return tokenize(input).map((tok, i) => {\n if (tok.type === 'bold') return <strong key={i}>{tok.value}</strong>;\n if (tok.type === 'code') {\n return (\n <code\n key={i}\n dir=\"ltr\"\n className=\"ds:rounded-[var(--radius-sm)] ds:bg-muted/30 ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)] ds:font-[family-name:var(--font-mono)]\"\n >\n {tok.value}\n </code>\n );\n }\n if (tok.type === 'br') return <br key={i} />;\n if (tok.type === 'link') {\n if (!SAFE_SCHEMES.test(tok.href)) {\n // Unsafe scheme (javascript:, data:) — render as inert text.\n return <Fragment key={i}>{tok.label}</Fragment>;\n }\n return (\n <a\n key={i}\n href={tok.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"ds:underline ds:underline-offset-2 ds:hover:opacity-80\"\n >\n {tok.label}\n </a>\n );\n }\n return <Fragment key={i}>{tok.value}</Fragment>;\n });\n}\n\n/**\n * Render a message body: split fenced code blocks out to `<CodeBlock>` and run\n * the inline tokenizer over the surrounding text runs.\n */\nfunction renderBody(input: string): ReactNode {\n return splitCodeFences(input).map((seg, i) => {\n if (seg.type === 'code') {\n return <CodeBlock key={i} code={seg.value} language={seg.lang} />;\n }\n return <Fragment key={i}>{renderInline(seg.value)}</Fragment>;\n });\n}\n\n/* ------------------------------------------------------------------ */\n/* ChatMessage */\n/* ------------------------------------------------------------------ */\n\ntype NativeProps = Omit<HTMLAttributes<HTMLElement>, 'content' | 'role'>;\n\nexport interface ChatMessageProps\n extends NativeProps, VariantProps<typeof bubbleVariants> {\n role: ChatMessageRole;\n content: string;\n avatar?: ChatMessageAvatar;\n timestamp?: Date | number | string;\n status?: ChatMessageStatus;\n /** Parse a small, safe subset of markdown. Never renders raw HTML. */\n renderMarkdown?: boolean;\n /** Invoked when the retry button is activated (error status only). */\n onRetry?: () => void;\n /**\n * Optional action row rendered beneath the message body + timestamp,\n * aligned with the message (e.g. the Alia pattern's Copy / Download\n * buttons on assistant messages). Default off → renders nothing.\n */\n actions?: ReactNode;\n /**\n * Custom body node rendered verbatim INSTEAD of `content`. When set, the\n * markdown tokenizer (`renderBody`) is skipped and the node is rendered\n * directly inside the bubble. `content` is still required (used for the\n * aria-label context and consumer copy / download). Default off.\n */\n body?: ReactNode;\n}\n\nexport const ChatMessage = forwardRef<HTMLElement, ChatMessageProps>(\n (\n {\n role,\n content,\n avatar,\n timestamp,\n status,\n renderMarkdown = false,\n onRetry,\n actions,\n body,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation('ui');\n\n // Local format — used for the aria-label interpolation only. Visible\n // label is rendered by `<Timestamp>` below, which computes the same\n // locale-aware HH:MM internally.\n const formattedTime = useMemo(() => {\n if (!timestamp) return null;\n const date = timestamp instanceof Date ? timestamp : new Date(timestamp);\n if (Number.isNaN(date.getTime())) return null;\n return new Intl.DateTimeFormat(i18n.language, {\n hour: '2-digit',\n minute: '2-digit',\n }).format(date);\n }, [timestamp, i18n.language]);\n\n const roleLabel = t(`chat.message.role.${role}`);\n const messageLabel = formattedTime\n ? t('chat.message.label', { role: roleLabel, time: formattedTime })\n : t('chat.message.labelNoTime', { role: roleLabel });\n\n const resolvedBody =\n body ?? (renderMarkdown ? renderBody(content) : content);\n\n const statusIcon = (() => {\n if (!status || status === 'edited') return null;\n if (status === 'sending')\n return <Clock aria-hidden=\"true\" className=\"ds:size-3.5\" />;\n if (status === 'sent')\n return <Check aria-hidden=\"true\" className=\"ds:size-3.5\" />;\n return (\n <CircleAlert\n aria-hidden=\"true\"\n className=\"ds:size-3.5 ds:text-[color:var(--destructive)]\"\n />\n );\n })();\n\n const statusText = status ? t(`chat.message.status.${status}`) : null;\n\n return (\n <article\n ref={ref}\n aria-label={messageLabel}\n data-component=\"chat-message\"\n // Structural state surfaced for agent reads (see chat-message.agent.ts).\n // `status` is optional → the attribute is omitted when unset.\n data-role={role}\n data-status={status}\n className={[\n rowVariants({ role, className }),\n // Entrance: fade + slide up on mount. `--animation-duration` is 0ms\n // under `prefers-reduced-motion` and `.theme-accessible`, so both\n // collapse the animation to an instant state change automatically.\n 'ds:motion-safe:animate-in ds:motion-safe:fade-in-0 ds:motion-safe:slide-in-from-bottom-2',\n 'ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n ].join(' ')}\n {...rest}\n >\n {role !== 'system' && avatar ? (\n avatar.slot ? (\n // Consumer-supplied avatar node (e.g. Alia's Astroid tile).\n avatar.slot\n ) : (\n // Allow-list the src: LLM-supplied values can carry\n // `javascript:` / `data:text/html` / `data:image/svg+xml` and so\n // are scrubbed here before reaching <Avatar>. Fallback to initials.\n <Avatar\n name={avatar.name}\n src={safeImageSrc(avatar.src)}\n size=\"sm\"\n />\n )\n ) : null}\n\n <div\n className={[\n // min-w-0 allows this flex item to shrink below its content's\n // natural width — without it, a single unbreakable token (URL,\n // CJK run, hash) can force the bubble wider than the parent\n // and spill outside narrow containers like the Alia sidebar.\n 'ds:flex ds:flex-col ds:min-w-0',\n role === 'user'\n ? 'ds:items-end'\n : role === 'assistant'\n ? 'ds:items-start'\n : 'ds:items-center',\n ].join(' ')}\n >\n <div\n dir=\"auto\"\n className={[\n bubbleVariants({ role }),\n // `break-words` (from bubbleVariants) handles soft hyphens;\n // `overflow-wrap: anywhere` is the last-resort break for\n // URLs, hashes, or CJK runs that would otherwise push the\n // bubble wider than its parent in narrow docks like Alia.\n 'ds:[overflow-wrap:anywhere]',\n ].join(' ')}\n >\n {resolvedBody}\n </div>\n\n {(formattedTime || statusText) && role !== 'system' ? (\n <div\n className={[\n 'ds:mt-[var(--spacing-xs)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'type-meta ds:text-[color:var(--muted-foreground)]',\n ].join(' ')}\n >\n {timestamp ? (\n <Timestamp\n value={timestamp}\n format=\"absolute\"\n absoluteFormat={{ hour: '2-digit', minute: '2-digit' }}\n dir=\"ltr\"\n />\n ) : null}\n {statusIcon ? (\n // `key={status}` re-mounts the span on every status change so\n // `animate-in` re-runs — gives the sending → sent → error\n // swap a subtle cross-fade instead of an abrupt pop.\n <span\n key={status}\n className={[\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]',\n 'ds:motion-safe:animate-in ds:motion-safe:fade-in-0',\n 'ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]',\n ].join(' ')}\n >\n {statusIcon}\n <span className=\"ds:sr-only\">{statusText}</span>\n </span>\n ) : null}\n {status === 'error' && onRetry ? (\n <Button\n intent=\"ghost\"\n size=\"sm\"\n onClick={onRetry}\n startIcon={<RotateCcw />}\n >\n {t('chat.message.retry')}\n </Button>\n ) : null}\n </div>\n ) : null}\n {actions ? (\n <div className=\"ds:mt-[var(--spacing-xs)] ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]\">\n {actions}\n </div>\n ) : null}\n </div>\n </article>\n );\n },\n);\n\nChatMessage.displayName = 'ChatMessage';\n"],"names":["rowVariants","cva","bubbleVariants","SAFE_SCHEMES","tokenize","input","tokens","remaining","pattern","match","renderInline","tok","i","jsx","Fragment","renderBody","splitCodeFences","seg","CodeBlock","ChatMessage","forwardRef","role","content","avatar","timestamp","status","renderMarkdown","onRetry","actions","body","className","rest","ref","t","i18n","useTranslation","formattedTime","useMemo","date","roleLabel","messageLabel","resolvedBody","statusIcon","Clock","Check","CircleAlert","statusText","jsxs","Avatar","safeImageSrc","Timestamp","Button","RotateCcw"],"mappings":";;;;;;;;;;;;;AA0CA,MAAMA,IAAcC;AAAA,EAClB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,WAAW;AAAA,QACX,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,IAEF,iBAAiB,EAAE,MAAM,YAAA;AAAA,EAAY;AAEzC,GAEMC,IAAiBD;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA,IAKE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,WACE;AAAA,QACF,QACE;AAAA,MAAA;AAAA,I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K;AAAA,0BACL,SAASxB;AAAA,0BACT,6BAAYyB,GAAA,EAAU;AAAA,0BAErB,YAAE,oBAAoB;AAAA,wBAAA;AAAA,sBAAA,IAEvB;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBAAA,IAEJ;AAAA,gBACHxB,IACC,gBAAAf,EAAC,OAAA,EAAI,WAAU,uFACZ,aACH,IACE;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAM,EAAY,cAAc;"}
|
|
@@ -2,7 +2,7 @@ import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as T, useId as P, useState as k, useMemo as ee } from "react";
|
|
3
3
|
import { c as z } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as se } from "react-i18next";
|
|
5
|
-
import { A as ae } from "./avatar-
|
|
5
|
+
import { A as ae } from "./avatar-Dp5apm1d.js";
|
|
6
6
|
import { B as b } from "./badge-BUk4RjTS.js";
|
|
7
7
|
import { C as S } from "./card-C85_Ndhb.js";
|
|
8
8
|
import { T as B } from "./timestamp-DPLDWdxA.js";
|
|
@@ -337,4 +337,4 @@ export {
|
|
|
337
337
|
ue as C,
|
|
338
338
|
oe as c
|
|
339
339
|
};
|
|
340
|
-
//# sourceMappingURL=clinical-note-card
|
|
340
|
+
//# sourceMappingURL=clinical-note-card-BVkxGiGl.js.map
|
package/dist/_chunks/{clinical-note-card--juv_ELr.js.map → clinical-note-card-BVkxGiGl.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clinical-note-card--juv_ELr.js","sources":["../../src/components/clinical-note-card/clinical-note-card.agent.ts","../../src/components/clinical-note-card/clinical-note-card.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\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; the pin / flag toggles carry data-note-action=\"pin\" | \"flag\".',\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 } from 'lucide-react';\nimport { Avatar } from '../avatar/avatar';\nimport { Badge } from '../badge/badge';\nimport { Card } from '../card/card';\nimport { Timestamp } from '../timestamp';\nimport { SafeHtml } from '../_shared/safe-html';\nimport { noteMarkdownToHtml } from '../_shared/note-markdown';\nimport {\n NoteAttachmentChip,\n type NoteAttachment,\n} from '../_shared/note-attachment';\nimport { useClampOverflow } from '../../hooks/use-clamp-overflow';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { clinicalNoteCardAgent } from './clinical-note-card.agent';\n\n// The attachment type moved to `_shared` when NoteTimeline began rendering the\n// same chip; re-exported here so this component's public API is unchanged.\nexport type { NoteAttachment };\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/** 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>`. An empty string renders no timestamp (an undated\n * imported note).\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 /** The operator the note is credited to: a secondary \"Operator: …\" byline. */\n operatorName?: string;\n /**\n * A deleted note kept for the record. Shows a \"Deleted\" badge and keeps the\n * body out of the DOM until the reader presses \"Show deleted note\". Not an\n * access control: the body is one press away.\n */\n deleted?: boolean;\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 * Host-owned actions for this note (edit, delete, share …), rendered\n * beside the pin and flag. They belong in the same cluster: a reader\n * looking for what they can do to a note should find every affordance\n * in one place, not some in the card and the rest below it.\n */\n headerActions?: ReactNode;\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 * A pin write is in flight. The toggle keeps showing `pinned`, is\n * `aria-disabled`, dims and ignores clicks until the host answers. Only\n * with `onTogglePin`.\n */\n pinPending?: boolean;\n /** As `pinPending`, for the flag toggle. */\n flagPending?: boolean;\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 // A write in flight: the toggle stays focusable, says it is busy and\n // dims as a waiting Button does, so a keyboard reader sees it too.\n 'ds:aria-disabled:cursor-progress ds:aria-disabled:opacity-50',\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\nconst deletedDisclosure = cva([\n readMoreClasses,\n 'ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]',\n]);\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 /** Stable hook for hosts, agents and focus rescue: `pin` or `flag`. */\n action: 'pin' | 'flag';\n /** A write is in flight: aria-disabled, and clicks do nothing. */\n pending: boolean;\n onToggle: () => void;\n}\n\nfunction NoteToggle({\n icon,\n pressed,\n label,\n activeClassName,\n action,\n pending,\n onToggle,\n}: NoteToggleProps) {\n return (\n <button\n type=\"button\"\n aria-pressed={pressed}\n aria-label={label}\n // aria-disabled, not disabled: the toggle keeps its focus while the\n // host answers, so a keyboard reader is not dropped onto the page.\n aria-disabled={pending || undefined}\n data-note-action={action}\n onClick={() => {\n if (!pending) onToggle();\n }}\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/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const ClinicalNoteCard = forwardRef<\n HTMLDivElement,\n ClinicalNoteCardProps\n>(\n (\n {\n id,\n dateIso,\n createdAtIso,\n author,\n operatorName,\n deleted,\n clinical,\n attachedTo,\n content,\n contentFormat = 'markdown',\n pinned,\n flagged,\n headerActions,\n onTogglePin,\n onToggleFlag,\n pinPending = false,\n flagPending = false,\n truncate = false,\n surface = 'elevated',\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const headingId = useId();\n const bodyId = useId();\n const [expanded, setExpanded] = useState(false);\n const [deletedOpen, setDeletedOpen] = useState(false);\n const [previousDeleted, setPreviousDeleted] = useState(!!deleted);\n if (previousDeleted !== !!deleted) {\n setPreviousDeleted(!!deleted);\n setDeletedOpen(false);\n }\n // A deleted note's body stays empty and hidden until the reader reveals it.\n const bodyHidden = !!deleted && !deletedOpen;\n\n // Only measure while clamped — once expanded there's nothing to clip.\n const { ref: clampRef, isOverflowing } = useClampOverflow<HTMLDivElement>(\n truncate && !expanded && !bodyHidden,\n );\n // Show the disclosure once the body overflows; keep it while expanded so\n // the user can collapse again.\n const showReadMore = truncate && !bodyHidden && (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 : noteMarkdownToHtml(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 const attachmentNode = <NoteAttachmentChip attachedTo={attachedTo} />;\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 {operatorName ? (\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)] ds:break-words\">\n {t('clinicalNoteCard.operator', { name: operatorName })}\n </span>\n ) : null}\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-2xs)] ds:empty:hidden\">\n {dateIso ? (\n <Timestamp value={dateIso} shape=\"bare\" size=\"sm\" />\n ) : null}\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 {deleted ||\n clinical ||\n headerActions ||\n onTogglePin ||\n onToggleFlag ||\n pinned ||\n 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 {deleted ? (\n <Badge variant=\"error\" size=\"sm\">\n {t('clinicalNoteCard.deleted')}\n </Badge>\n ) : null}\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 action=\"pin\"\n pending={pinPending}\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 action=\"flag\"\n pending={flagPending}\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 {/* Sibling of the pin/flag cluster, not inside it: a note with\n neither would otherwise drop the host's actions entirely. */}\n {headerActions}\n </span>\n ) : null}\n </div>\n\n {deleted ? (\n <button\n type=\"button\"\n aria-expanded={deletedOpen}\n aria-controls={bodyId}\n onClick={() => setDeletedOpen((prev) => !prev)}\n className={deletedDisclosure()}\n >\n {deletedOpen\n ? t('clinicalNoteCard.hideDeleted')\n : t('clinicalNoteCard.showDeleted')}\n </button>\n ) : null}\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 || deleted ? bodyId : undefined}\n hidden={bodyHidden}\n html={bodyHidden ? '' : 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-deleted={deleted ? '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":["clinicalNoteCardAgent","handle","rootVariants","cva","bodyVariants","noteToggleBase","readMoreClasses","deletedDisclosure","NoteToggle","icon","pressed","label","activeClassName","action","pending","onToggle","jsx","ClinicalNoteCard","forwardRef","id","dateIso","createdAtIso","author","operatorName","deleted","clinical","attachedTo","content","contentFormat","pinned","flagged","headerActions","onTogglePin","onToggleFlag","pinPending","flagPending","truncate","surface","ariaLabel","className","rest","ref","t","useTranslation","headingId","useId","bodyId","expanded","setExpanded","useState","deletedOpen","setDeletedOpen","previousDeleted","setPreviousDeleted","bodyHidden","clampRef","isOverflowing","useClampOverflow","showReadMore","bodyHtml","useMemo","noteMarkdownToHtml","resolvedAriaLabel","useAgentRegistration","attachmentNode","NoteAttachmentChip","inner","jsxs","Avatar","Timestamp","Badge","Pin","Flag","prev","SafeHtml","Card"],"mappings":";;;;;;;;;;;;AAYO,MAAMA,KAA8D;AAAA,EACzE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,SAAS;AAAA,MACP,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,gBAAgB;AAAA,MACd,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACA,MAAWA,EAAO,kBAAA;AAAA,IAAkB;AAAA,EAC7C;AAAA,EAEF,SAAS,CAAA;AAAA,EACT,UAAU;AAAA,IAC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/components/clinical-note-card/clinical-note-card.agent.ts","../../src/components/clinical-note-card/clinical-note-card.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\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; the pin / flag toggles carry data-note-action=\"pin\" | \"flag\".',\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 } from 'lucide-react';\nimport { Avatar } from '../avatar/avatar';\nimport { Badge } from '../badge/badge';\nimport { Card } from '../card/card';\nimport { Timestamp } from '../timestamp';\nimport { SafeHtml } from '../_shared/safe-html';\nimport { noteMarkdownToHtml } from '../_shared/note-markdown';\nimport {\n NoteAttachmentChip,\n type NoteAttachment,\n} from '../_shared/note-attachment';\nimport { useClampOverflow } from '../../hooks/use-clamp-overflow';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { clinicalNoteCardAgent } from './clinical-note-card.agent';\n\n// The attachment type moved to `_shared` when NoteTimeline began rendering the\n// same chip; re-exported here so this component's public API is unchanged.\nexport type { NoteAttachment };\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/** 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>`. An empty string renders no timestamp (an undated\n * imported note).\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 /** The operator the note is credited to: a secondary \"Operator: …\" byline. */\n operatorName?: string;\n /**\n * A deleted note kept for the record. Shows a \"Deleted\" badge and keeps the\n * body out of the DOM until the reader presses \"Show deleted note\". Not an\n * access control: the body is one press away.\n */\n deleted?: boolean;\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 * Host-owned actions for this note (edit, delete, share …), rendered\n * beside the pin and flag. They belong in the same cluster: a reader\n * looking for what they can do to a note should find every affordance\n * in one place, not some in the card and the rest below it.\n */\n headerActions?: ReactNode;\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 * A pin write is in flight. The toggle keeps showing `pinned`, is\n * `aria-disabled`, dims and ignores clicks until the host answers. Only\n * with `onTogglePin`.\n */\n pinPending?: boolean;\n /** As `pinPending`, for the flag toggle. */\n flagPending?: boolean;\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 // A write in flight: the toggle stays focusable, says it is busy and\n // dims as a waiting Button does, so a keyboard reader sees it too.\n 'ds:aria-disabled:cursor-progress ds:aria-disabled:opacity-50',\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\nconst deletedDisclosure = cva([\n readMoreClasses,\n 'ds:[min-block-size:var(--min-target-size)] ds:[min-inline-size:var(--min-target-size)]',\n]);\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 /** Stable hook for hosts, agents and focus rescue: `pin` or `flag`. */\n action: 'pin' | 'flag';\n /** A write is in flight: aria-disabled, and clicks do nothing. */\n pending: boolean;\n onToggle: () => void;\n}\n\nfunction NoteToggle({\n icon,\n pressed,\n label,\n activeClassName,\n action,\n pending,\n onToggle,\n}: NoteToggleProps) {\n return (\n <button\n type=\"button\"\n aria-pressed={pressed}\n aria-label={label}\n // aria-disabled, not disabled: the toggle keeps its focus while the\n // host answers, so a keyboard reader is not dropped onto the page.\n aria-disabled={pending || undefined}\n data-note-action={action}\n onClick={() => {\n if (!pending) onToggle();\n }}\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/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const ClinicalNoteCard = forwardRef<\n HTMLDivElement,\n ClinicalNoteCardProps\n>(\n (\n {\n id,\n dateIso,\n createdAtIso,\n author,\n operatorName,\n deleted,\n clinical,\n attachedTo,\n content,\n contentFormat = 'markdown',\n pinned,\n flagged,\n headerActions,\n onTogglePin,\n onToggleFlag,\n pinPending = false,\n flagPending = false,\n truncate = false,\n surface = 'elevated',\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n const headingId = useId();\n const bodyId = useId();\n const [expanded, setExpanded] = useState(false);\n const [deletedOpen, setDeletedOpen] = useState(false);\n const [previousDeleted, setPreviousDeleted] = useState(!!deleted);\n if (previousDeleted !== !!deleted) {\n setPreviousDeleted(!!deleted);\n setDeletedOpen(false);\n }\n // A deleted note's body stays empty and hidden until the reader reveals it.\n const bodyHidden = !!deleted && !deletedOpen;\n\n // Only measure while clamped — once expanded there's nothing to clip.\n const { ref: clampRef, isOverflowing } = useClampOverflow<HTMLDivElement>(\n truncate && !expanded && !bodyHidden,\n );\n // Show the disclosure once the body overflows; keep it while expanded so\n // the user can collapse again.\n const showReadMore = truncate && !bodyHidden && (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 : noteMarkdownToHtml(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 const attachmentNode = <NoteAttachmentChip attachedTo={attachedTo} />;\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 {operatorName ? (\n <span className=\"type-meta ds:text-[color:var(--muted-foreground)] ds:break-words\">\n {t('clinicalNoteCard.operator', { name: operatorName })}\n </span>\n ) : null}\n <span className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-2xs)] ds:empty:hidden\">\n {dateIso ? (\n <Timestamp value={dateIso} shape=\"bare\" size=\"sm\" />\n ) : null}\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 {deleted ||\n clinical ||\n headerActions ||\n onTogglePin ||\n onToggleFlag ||\n pinned ||\n 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 {deleted ? (\n <Badge variant=\"error\" size=\"sm\">\n {t('clinicalNoteCard.deleted')}\n </Badge>\n ) : null}\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 action=\"pin\"\n pending={pinPending}\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 action=\"flag\"\n pending={flagPending}\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 {/* Sibling of the pin/flag cluster, not inside it: a note with\n neither would otherwise drop the host's actions entirely. */}\n {headerActions}\n </span>\n ) : null}\n </div>\n\n {deleted ? (\n <button\n type=\"button\"\n aria-expanded={deletedOpen}\n aria-controls={bodyId}\n onClick={() => setDeletedOpen((prev) => !prev)}\n className={deletedDisclosure()}\n >\n {deletedOpen\n ? t('clinicalNoteCard.hideDeleted')\n : t('clinicalNoteCard.showDeleted')}\n </button>\n ) : null}\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 || deleted ? bodyId : undefined}\n hidden={bodyHidden}\n html={bodyHidden ? '' : 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-deleted={deleted ? '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":["clinicalNoteCardAgent","handle","rootVariants","cva","bodyVariants","noteToggleBase","readMoreClasses","deletedDisclosure","NoteToggle","icon","pressed","label","activeClassName","action","pending","onToggle","jsx","ClinicalNoteCard","forwardRef","id","dateIso","createdAtIso","author","operatorName","deleted","clinical","attachedTo","content","contentFormat","pinned","flagged","headerActions","onTogglePin","onToggleFlag","pinPending","flagPending","truncate","surface","ariaLabel","className","rest","ref","t","useTranslation","headingId","useId","bodyId","expanded","setExpanded","useState","deletedOpen","setDeletedOpen","previousDeleted","setPreviousDeleted","bodyHidden","clampRef","isOverflowing","useClampOverflow","showReadMore","bodyHtml","useMemo","noteMarkdownToHtml","resolvedAriaLabel","useAgentRegistration","attachmentNode","NoteAttachmentChip","inner","jsxs","Avatar","Timestamp","Badge","Pin","Flag","prev","SafeHtml","Card"],"mappings":";;;;;;;;;;;;AAYO,MAAMA,KAA8D;AAAA,EACzE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,UAAA;AAAA,IAAU;AAAA,IAErC,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,SAAA;AAAA,IAAS;AAAA,IAEpC,SAAS;AAAA,MACP,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACA,MAAWA,EAAO,UAAA;AAAA,IAAU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