@alfadocs/ui-kit-debug 1.62.0 → 1.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{balance-badge-cell-F7p_ZKEg.js → balance-badge-cell-ejODZU7R.js} +2 -2
- package/dist/_chunks/{balance-badge-cell-F7p_ZKEg.js.map → balance-badge-cell-ejODZU7R.js.map} +1 -1
- package/dist/_chunks/{calendar-workspace-Dvfl9Vf6.js → calendar-workspace-BArq9vkD.js} +5 -5
- package/dist/_chunks/{calendar-workspace-Dvfl9Vf6.js.map → calendar-workspace-BArq9vkD.js.map} +1 -1
- package/dist/_chunks/{care-plan-card-BU3p5cLr.js → care-plan-card-DJzbwJLl.js} +2 -2
- package/dist/_chunks/{care-plan-card-BU3p5cLr.js.map → care-plan-card-DJzbwJLl.js.map} +1 -1
- package/dist/_chunks/{care-plan-header-CgFjQLBd.js → care-plan-header-1HzbkYcR.js} +2 -2
- package/dist/_chunks/{care-plan-header-CgFjQLBd.js.map → care-plan-header-1HzbkYcR.js.map} +1 -1
- package/dist/_chunks/chart-CzTF8yhH.js +1123 -0
- package/dist/_chunks/chart-CzTF8yhH.js.map +1 -0
- package/dist/_chunks/{clinical-note-card-BgURrgL5.js → clinical-note-card-D2bbWksq.js} +2 -2
- package/dist/_chunks/{clinical-note-card-BgURrgL5.js.map → clinical-note-card-D2bbWksq.js.map} +1 -1
- package/dist/_chunks/{contact-card-C8rEsC4Q.js → contact-card-Czu60UvU.js} +2 -2
- package/dist/_chunks/{contact-card-C8rEsC4Q.js.map → contact-card-Czu60UvU.js.map} +1 -1
- package/dist/_chunks/{contact-profile-card-VTCAmQqj.js → contact-profile-card-B4sjoIqf.js} +2 -2
- package/dist/_chunks/{contact-profile-card-VTCAmQqj.js.map → contact-profile-card-B4sjoIqf.js.map} +1 -1
- package/dist/_chunks/{data-table-m7GbLJZy.js → data-table-C6ft3fSd.js} +2 -2
- package/dist/_chunks/{data-table-m7GbLJZy.js.map → data-table-C6ft3fSd.js.map} +1 -1
- package/dist/_chunks/{entity-summary-DXIr5_x2.js → entity-summary-BQ9_KA8S.js} +2 -2
- package/dist/_chunks/{entity-summary-DXIr5_x2.js.map → entity-summary-BQ9_KA8S.js.map} +1 -1
- package/dist/_chunks/{file-manager-G0t8MWbE.js → file-manager-w1UEprw8.js} +2 -2
- package/dist/_chunks/{file-manager-G0t8MWbE.js.map → file-manager-w1UEprw8.js.map} +1 -1
- package/dist/_chunks/{heatmap-Bb0-M88T.js → heatmap-DuDfTIII.js} +2 -2
- package/dist/_chunks/{heatmap-Bb0-M88T.js.map → heatmap-DuDfTIII.js.map} +1 -1
- package/dist/_chunks/{link-gRw3NtOt.js → link-N5_YpLtm.js} +7 -6
- package/dist/_chunks/link-N5_YpLtm.js.map +1 -0
- package/dist/_chunks/{nav-grid-Byx8PxuB.js → nav-grid-Oc4aCPrg.js} +2 -2
- package/dist/_chunks/{nav-grid-Byx8PxuB.js.map → nav-grid-Oc4aCPrg.js.map} +1 -1
- package/dist/_chunks/{note-attachment-DoVWvjWR.js → note-attachment-D8V7PUiR.js} +2 -2
- package/dist/_chunks/{note-attachment-DoVWvjWR.js.map → note-attachment-D8V7PUiR.js.map} +1 -1
- package/dist/_chunks/{note-timeline-B7l3t5DZ.js → note-timeline-CwxPQ2Ak.js} +2 -2
- package/dist/_chunks/{note-timeline-B7l3t5DZ.js.map → note-timeline-CwxPQ2Ak.js.map} +1 -1
- package/dist/_chunks/{notes-panel-CTmvrqQn.js → notes-panel-BRLc2ozF.js} +2 -2
- package/dist/_chunks/{notes-panel-CTmvrqQn.js.map → notes-panel-BRLc2ozF.js.map} +1 -1
- package/dist/_chunks/{patient-details-BNDS69Zx.js → patient-details-BY8Rwwpi.js} +2 -2
- package/dist/_chunks/{patient-details-BNDS69Zx.js.map → patient-details-BY8Rwwpi.js.map} +1 -1
- package/dist/_chunks/{patient-field-row-BLBi-PjO.js → patient-field-row-C8ymfffP.js} +2 -2
- package/dist/_chunks/{patient-field-row-BLBi-PjO.js.map → patient-field-row-C8ymfffP.js.map} +1 -1
- package/dist/_chunks/{patient-summary-card-T9umuZJF.js → patient-summary-card-cmqjIXMk.js} +3 -3
- package/dist/_chunks/{patient-summary-card-T9umuZJF.js.map → patient-summary-card-cmqjIXMk.js.map} +1 -1
- package/dist/_chunks/{payment-request-card-BmzNMY2a.js → payment-request-card-0DjQgVgX.js} +2 -2
- package/dist/_chunks/{payment-request-card-BmzNMY2a.js.map → payment-request-card-0DjQgVgX.js.map} +1 -1
- package/dist/_chunks/{product-hub-panel-D-UELdo0.js → product-hub-panel-C_ZosrBt.js} +2 -2
- package/dist/_chunks/{product-hub-panel-D-UELdo0.js.map → product-hub-panel-C_ZosrBt.js.map} +1 -1
- package/dist/_chunks/{public-footer-ZWTEG1Rq.js → public-footer-CXOrdAaS.js} +2 -2
- package/dist/_chunks/{public-footer-ZWTEG1Rq.js.map → public-footer-CXOrdAaS.js.map} +1 -1
- package/dist/_chunks/{signed-out-frame-D5DzqATh.js → signed-out-frame-Rg_GVDnl.js} +2 -2
- package/dist/_chunks/{signed-out-frame-D5DzqATh.js.map → signed-out-frame-Rg_GVDnl.js.map} +1 -1
- package/dist/_chunks/{use-appointment-details-read-Gu0ehyxj.js → use-appointment-details-read-D6Gb_OuN.js} +4 -4
- package/dist/_chunks/{use-appointment-details-read-Gu0ehyxj.js.map → use-appointment-details-read-D6Gb_OuN.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/use-apex-legend-scroll.d.ts +7 -3
- package/dist/components/_shared/use-apex-legend-scroll.d.ts.map +1 -1
- package/dist/components/_shared/use-apex-x-label-spacing.d.ts +11 -0
- package/dist/components/_shared/use-apex-x-label-spacing.d.ts.map +1 -0
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-header/index.js +1 -1
- package/dist/components/chart/chart.d.ts.map +1 -1
- package/dist/components/chart/index.js +1 -1
- package/dist/components/clinical-note-card/index.js +1 -1
- package/dist/components/contact-card/index.js +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/entity-summary/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/heatmap/index.js +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/link/link.d.ts.map +1 -1
- package/dist/components/nav-grid/index.js +1 -1
- package/dist/components/note-timeline/index.js +1 -1
- package/dist/components/notes-panel/index.js +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/product-hub-tray/index.js +1 -1
- package/dist/components/public-footer/index.js +1 -1
- package/dist/index.js +23 -23
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/patterns/signed-out-frame/index.js +1 -1
- package/dist/tokens.css +7 -4
- package/package.json +1 -1
- package/dist/_chunks/chart-DgYHN8Xq.js +0 -991
- package/dist/_chunks/chart-DgYHN8Xq.js.map +0 -1
- package/dist/_chunks/link-gRw3NtOt.js.map +0 -1
|
@@ -19,11 +19,12 @@ const E = i(
|
|
|
19
19
|
{
|
|
20
20
|
variants: {
|
|
21
21
|
intent: {
|
|
22
|
-
// `--primary`
|
|
23
|
-
// re-points it (and its hover step) at
|
|
24
|
-
// differs
|
|
25
|
-
//
|
|
26
|
-
//
|
|
22
|
+
// `--primary` falls below 4.5:1 as text on the dark page and on the
|
|
23
|
+
// light app shell, so the link re-points it (and its hover step) at
|
|
24
|
+
// `--primary-readable`, which differs in light and dark but not in
|
|
25
|
+
// the accessible themes. The colour classes stay as they were: a
|
|
26
|
+
// host still on an older token sheet keeps today's look, and a
|
|
27
|
+
// consumer `className` wins or loses exactly as before.
|
|
27
28
|
default: "ds:[--primary:var(--primary-readable)] ds:[--primary-hover:var(--primary-readable-hover)] ds:text-primary ds:underline ds:hover:text-primary-hover ds:active:opacity-80",
|
|
28
29
|
subtle: "ds:text-muted-foreground ds:no-underline ds:hover:text-foreground ds:hover:underline ds:active:opacity-80",
|
|
29
30
|
inverted: "ds:text-primary-foreground ds:underline ds:hover:opacity-90 ds:active:opacity-80"
|
|
@@ -134,4 +135,4 @@ z.displayName = "Link";
|
|
|
134
135
|
export {
|
|
135
136
|
z as L
|
|
136
137
|
};
|
|
137
|
-
//# sourceMappingURL=link-
|
|
138
|
+
//# sourceMappingURL=link-N5_YpLtm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-N5_YpLtm.js","sources":["../../src/components/link/link.tsx"],"sourcesContent":["import { forwardRef, type AnchorHTMLAttributes, type ReactNode } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { ExternalLink } from 'lucide-react';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\n/**\n * Link is the semantic anchor primitive for inline navigation —\n * privacy / terms in form copy, external \"remote support\" links in\n * sidebars, in-paragraph references inside info-tip body copy.\n *\n * For action affordances that *look* like a link but trigger UI rather\n * than navigation, use `<Button intent=\"link\">` instead — the semantic\n * boundary matters for screen readers and keyboard users.\n */\nconst linkVariants = cva(\n [\n // Always inline text, icons included, so a long label wraps like any\n // other text and the trailing glyph follows its last word.\n 'ds:inline',\n 'ds:underline-offset-4',\n 'ds:rounded-[var(--radius-xs)]',\n 'ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n 'ds:aria-disabled:cursor-not-allowed ds:aria-disabled:opacity-50 ds:aria-disabled:no-underline',\n ].join(' '),\n {\n variants: {\n intent: {\n // `--primary` falls below 4.5:1 as text on the dark page and on the\n // light app shell, so the link re-points it (and its hover step) at\n // `--primary-readable`, which differs in light and dark but not in\n // the accessible themes. The colour classes stay as they were: a\n // host still on an older token sheet keeps today's look, and a\n // consumer `className` wins or loses exactly as before.\n default:\n 'ds:[--primary:var(--primary-readable)] ds:[--primary-hover:var(--primary-readable-hover)] ds:text-primary ds:underline ds:hover:text-primary-hover ds:active:opacity-80',\n subtle:\n 'ds:text-muted-foreground ds:no-underline ds:hover:text-foreground ds:hover:underline ds:active:opacity-80',\n inverted:\n 'ds:text-primary-foreground ds:underline ds:hover:opacity-90 ds:active:opacity-80',\n },\n weight: {\n normal: 'ds:font-normal',\n strong: 'ds:font-semibold',\n },\n },\n defaultVariants: {\n intent: 'default',\n weight: 'normal',\n },\n },\n);\n\n/*\n * An icon slot is a no-wrap span holding a word joiner (U+2060, as CSS\n * content so it never reaches textContent) and the glyph box, so the\n * glyph cannot break away from the word beside it.\n */\nconst iconSlotVariants = cva('ds:whitespace-nowrap', {\n variants: {\n edge: {\n start: String.raw`ds:after:content-['\\2060']`,\n end: String.raw`ds:before:content-['\\2060']`,\n },\n },\n});\n\n/*\n * The glyph box. Its own word joiner is a line-tall text item that gives\n * the box the text's baseline, so the 1em glyph centres on the line just\n * as the old flex anchor did, with no font-metric guesswork.\n */\nconst iconBoxVariants = cva(\n [\n 'ds:inline-flex ds:items-center',\n String.raw`ds:before:content-['\\2060']`,\n 'ds:[&_svg]:size-[1em] ds:[&_svg]:shrink-0',\n ].join(' '),\n {\n variants: {\n edge: {\n start: 'ds:me-[var(--spacing-xs)]',\n end: 'ds:ms-[var(--spacing-xs)]',\n },\n },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface LinkProps\n extends\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>,\n VariantProps<typeof linkVariants> {\n /** Anchor target. Required — the whole point of the component. */\n href: string;\n /**\n * Flag the link as opening in a new browsing context. Automatically\n * adds `target=\"_blank\"` + `rel=\"noopener noreferrer\"` and renders a\n * decorative trailing `ExternalLink` icon plus an i18n'd \"Opens in a\n * new tab\" label for assistive tech.\n */\n external?: boolean;\n /**\n * Render the trailing external-link glyph. Default `true` — set to\n * `false` for surfaces (footer, social rows, dense nav) where the\n * indicator adds visual noise. The `target` / `rel` / \"opens in new\n * tab\" screen-reader text are still applied.\n */\n externalIcon?: boolean;\n /**\n * Render the link in a non-interactive disabled state. Strips `href`,\n * adds `aria-disabled` + `role=\"link\"`, suppresses the underline.\n * Prefer hiding the link entirely when possible — disabled links are\n * a usability anti-pattern outside of state-machine flows.\n */\n disabled?: boolean;\n /** Optional leading icon (inline-start). */\n startIcon?: ReactNode;\n /** Optional trailing icon (inline-end). Ignored when `external`. */\n endIcon?: ReactNode;\n /** @deprecated No effect: the icon layout follows the icon props. Kept so existing callers compile. */\n hasIcon?: 'yes' | 'no' | null;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n (\n {\n href,\n external = false,\n externalIcon = true,\n disabled = false,\n startIcon,\n endIcon,\n hasIcon: _hasIcon,\n intent,\n weight,\n className,\n children,\n target,\n rel,\n onClick,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation('ui');\n\n const effectiveTarget = external ? '_blank' : target;\n const effectiveRel = external\n ? [rel, 'noopener', 'noreferrer'].filter(Boolean).join(' ')\n : rel;\n\n const externalLabel = t('link.opensInNewTab', 'Opens in a new tab');\n\n const handleClick: AnchorHTMLAttributes<HTMLAnchorElement>['onClick'] = (\n event,\n ) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onClick?.(event);\n };\n\n const showExternalIcon = external && externalIcon;\n\n return (\n <a\n ref={ref}\n // When disabled, drop href so the link is not actionable; pair\n // with aria-disabled + role=\"link\" so AT still announces the\n // role (the implicit role disappears once href is removed).\n href={disabled ? undefined : href}\n role={disabled ? 'link' : undefined}\n aria-disabled={disabled || undefined}\n target={effectiveTarget}\n rel={effectiveRel || undefined}\n onClick={handleClick}\n data-component=\"link\"\n data-intent={intent ?? 'default'}\n className={linkVariants({ intent, weight, className })}\n {...rest}\n >\n {startIcon ? (\n <span\n aria-hidden=\"true\"\n className={iconSlotVariants({ edge: 'start' })}\n >\n <span className={iconBoxVariants({ edge: 'start' })}>\n {startIcon}\n </span>\n </span>\n ) : null}\n {children}\n {showExternalIcon || (!external && endIcon) ? (\n <span\n aria-hidden=\"true\"\n className={iconSlotVariants({ edge: 'end' })}\n >\n <span className={iconBoxVariants({ edge: 'end' })}>\n {showExternalIcon ? (\n <ExternalLink className=\"ds:size-[1em]\" />\n ) : (\n endIcon\n )}\n </span>\n </span>\n ) : null}\n {showExternalIcon ? (\n // Labelled, empty and out of flow: name algorithms add the label\n // after a space, and textContent stays the caller's text.\n <span aria-label={externalLabel} className=\"ds:sr-only\" />\n ) : external ? (\n // External wiring without the glyph — keep the SR-only\n // \"opens in new tab\" announcement so the affordance reads.\n <span className=\"ds:sr-only\">{externalLabel}</span>\n ) : null}\n </a>\n );\n },\n);\n\nLink.displayName = 'Link';\n"],"names":["linkVariants","cva","iconSlotVariants","iconBoxVariants","Link","forwardRef","href","external","externalIcon","disabled","startIcon","endIcon","_hasIcon","intent","weight","className","children","target","rel","onClick","rest","ref","t","useTranslation","effectiveTarget","effectiveRel","externalLabel","handleClick","event","showExternalIcon","jsxs","jsx","ExternalLink"],"mappings":";;;;;AAkBA,MAAMA,IAAeC;AAAA,EACnB;AAAA;AAAA;AAAA,IAGE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA,MACR,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAON,SACE;AAAA,QACF,QACE;AAAA,QACF,UACE;AAAA,MA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;AACF;AAEAtB,EAAK,cAAc;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as s, jsxs as w, Fragment as x } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as N, useMemo as l } from "react";
|
|
3
3
|
import { c as p } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { L as C } from "./link-
|
|
4
|
+
import { L as C } from "./link-N5_YpLtm.js";
|
|
5
5
|
import { u as G } from "./registry-DvAUVLHh.js";
|
|
6
6
|
const I = {
|
|
7
7
|
id: "nav-grid",
|
|
@@ -165,4 +165,4 @@ export {
|
|
|
165
165
|
I as n,
|
|
166
166
|
c as t
|
|
167
167
|
};
|
|
168
|
-
//# sourceMappingURL=nav-grid-
|
|
168
|
+
//# sourceMappingURL=nav-grid-Oc4aCPrg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-grid-Byx8PxuB.js","sources":["../../src/components/nav-grid/nav-grid.agent.ts","../../src/components/nav-grid/nav-grid.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — NavGrid. */\n/* */\n/* A responsive grid of navigable tiles (the composition primitive behind */\n/* a settings hub). It exposes the live tile count and lets an agent */\n/* activate a tile by id — which either follows the tile's href or fires */\n/* its select handler. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the full contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { NavGridHandle } from './nav-grid';\n\nexport const navGridAgent: AgentAdapter<NavGridHandle> = {\n id: 'nav-grid',\n capabilities: ['navigate'],\n state: {\n itemCount: {\n type: 'number',\n descriptionKey: 'ui.agent.navGrid.state.itemCount',\n description: 'Number of navigable tiles currently rendered in the grid.',\n read: (handle) => handle.getItemCount(),\n },\n },\n actions: {\n open_item: {\n safety: 'write',\n openWorld: false,\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description:\n 'Stable opaque tile id (emitted as data-nav-item-id on each tile).',\n },\n },\n required: ['id'],\n },\n descriptionKey: 'ui.agent.navGrid.actions.openItem',\n description:\n 'Activate the tile with the given id (navigates or fires its select handler).',\n examples: [\n {\n args: { id: 'billing' },\n note: 'Open the \"billing\" settings section.',\n },\n ],\n invoke: (handle, args: { id: string }) => {\n handle.openItem(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'nav-grid',\n description: 'Marks the NavGrid nav landmark.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific grid from the agent.',\n },\n item: {\n attr: 'data-nav-item-id',\n sourceProp: 'item id',\n description:\n 'Stable opaque id of a tile, sourced from each item.id. open_item targets this attribute.',\n },\n },\n};\n","import { forwardRef, useMemo, type ReactNode } from 'react';\nimport { cva } from 'class-variance-authority';\nimport { Link } from '../link/link';\nimport { useAgentRegistration } from '../../agent';\nimport { navGridAgent } from './nav-grid.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface NavGridItem {\n /** Stable, opaque id. Emitted as `data-nav-item-id`; agents target it. */\n id: string;\n /** Localised tile label — supplied by the consumer (never bundled here). */\n label: string;\n /** Optional localised supporting text shown under the label. */\n description?: string;\n /** Decorative leading glyph. Rendered `aria-hidden`. */\n icon?: ReactNode;\n /** When set, the tile is a navigating anchor (kit Link). */\n href?: string;\n /** When `href` is absent, the tile is a button firing this handler. */\n onSelect?: () => void;\n /** Render the tile non-interactive and visually muted. */\n disabled?: boolean;\n}\n\n/** Agent-readiness curated handle for NavGrid. */\nexport interface NavGridHandle {\n getItemCount: () => number;\n /** Activate the tile with the given id (navigate, or fire its onSelect). */\n openItem: (id: string) => void;\n}\n\nexport interface NavGridProps {\n /** Tiles to render. label / description / icon are consumer-supplied props. */\n items: NavGridItem[];\n /** REQUIRED — the nav landmark's accessible name (e.g. \"Settings sections\"). */\n ariaLabel: string;\n /** Column count. Omit for the responsive default (1 → 2 → 3 at sm / lg). */\n columns?: 1 | 2 | 3 | 4;\n /** `label` sorts tiles by `label.localeCompare`; `none` (default) preserves order. */\n sort?: 'label' | 'none';\n id?: string;\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst gridVariants = cva(\n 'ds:grid ds:list-none ds:m-0 ds:p-0 ds:gap-[var(--spacing-md)]',\n {\n variants: {\n columns: {\n // Responsive default: one column on mobile, two from sm, three from lg.\n responsive: 'ds:grid-cols-1 ds:sm:grid-cols-2 ds:lg:grid-cols-3',\n '1': 'ds:grid-cols-1',\n '2': 'ds:grid-cols-1 ds:sm:grid-cols-2',\n '3': 'ds:grid-cols-1 ds:sm:grid-cols-2 ds:lg:grid-cols-3',\n '4': 'ds:grid-cols-1 ds:sm:grid-cols-2 ds:lg:grid-cols-4',\n },\n },\n defaultVariants: { columns: 'responsive' },\n },\n);\n\n// Shared tile look applied to BOTH the Link (href) and the button (onSelect)\n// so the two render identically. Focus ring is included here so the native\n// button gets a visible ring too (Link also carries its own — same tokens).\nconst tileVariants = cva(\n [\n 'ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)] ds:text-start',\n 'ds:h-full ds:w-full ds:min-h-[var(--min-target-size)] ds:p-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-lg)] ds:[:where(&)]:border-[length:var(--surface-border-width,var(--border-width-sm))] ds:border-[color:var(--card-border)]',\n 'ds:bg-[var(--card)] ds:text-[var(--card-foreground)] ds:no-underline',\n 'ds:transition-shadow ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:outline-none',\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 {\n variants: {\n disabled: {\n true: 'ds:opacity-50 ds:cursor-not-allowed ds:pointer-events-none',\n false: 'ds:cursor-pointer ds:hover:shadow-[var(--shadow-hover)]',\n },\n },\n defaultVariants: { disabled: false },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Tile content */\n/* ------------------------------------------------------------------ */\n\nfunction TileContent({ item }: { item: NavGridItem }) {\n return (\n <>\n {item.icon ? (\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-flex ds:items-center ds:text-[var(--muted-foreground)] ds:[&_svg]:size-6\"\n >\n {item.icon}\n </span>\n ) : null}\n {/* `no-underline` on the span reliably suppresses the Link's underline\n across this text regardless of stylesheet order (own decoration box). */}\n <span className=\"type-body ds:font-medium ds:text-[var(--card-foreground)] ds:no-underline\">\n {item.label}\n </span>\n {item.description ? (\n <span className=\"type-body-sm ds:text-[var(--muted-foreground)] ds:no-underline\">\n {item.description}\n </span>\n ) : null}\n </>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const NavGrid = forwardRef<HTMLElement, NavGridProps>(function NavGrid(\n { items, ariaLabel, columns, sort = 'none', id, className },\n ref,\n) {\n // Locale-aware sort is the consumer's opt-in; otherwise render as given.\n const resolvedItems = useMemo(\n () =>\n sort === 'label'\n ? [...items].sort((a, b) => a.label.localeCompare(b.label))\n : items,\n [items, sort],\n );\n\n const handle = useMemo<NavGridHandle>(\n () => ({\n getItemCount: () => items.length,\n openItem: (itemId) => {\n const target = items.find((it) => it.id === itemId);\n if (!target || target.disabled) return;\n if (target.href) {\n if (typeof window !== 'undefined') window.location.href = target.href;\n } else {\n target.onSelect?.();\n }\n },\n }),\n [items],\n );\n useAgentRegistration(navGridAgent, handle, id);\n\n const columnKey =\n columns === undefined\n ? ('responsive' as const)\n : (String(columns) as '1' | '2' | '3' | '4');\n\n return (\n <nav\n ref={ref}\n id={id}\n aria-label={ariaLabel}\n data-component=\"nav-grid\"\n data-component-id={id}\n className={className}\n >\n <ul className={gridVariants({ columns: columnKey })}>\n {resolvedItems.map((item) => (\n <li key={item.id} data-nav-item-id={item.id}>\n {item.href !== undefined ? (\n <Link\n href={item.href}\n intent=\"subtle\"\n disabled={item.disabled}\n className={tileVariants({ disabled: Boolean(item.disabled) })}\n >\n <TileContent item={item} />\n </Link>\n ) : (\n <button\n type=\"button\"\n onClick={item.disabled ? undefined : item.onSelect}\n disabled={item.disabled}\n aria-disabled={item.disabled || undefined}\n className={tileVariants({ disabled: Boolean(item.disabled) })}\n >\n <TileContent item={item} />\n </button>\n )}\n </li>\n ))}\n </ul>\n </nav>\n );\n});\n\nNavGrid.displayName = 'NavGrid';\n\nexport { tileVariants as navGridTileVariants };\n"],"names":["navGridAgent","handle","args","gridVariants","cva","tileVariants","TileContent","item","jsxs","Fragment","jsx","NavGrid","forwardRef","items","ariaLabel","columns","sort","id","className","ref","resolvedItems","useMemo","a","b","itemId","target","it","_a","useAgentRegistration","columnKey","Link"],"mappings":";;;;;AAcO,MAAMA,IAA4C;AAAA,EACvD,IAAI;AAAA,EACJ,cAAc,CAAC,UAAU;AAAA,EACzB,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,aAAA;AAAA,IAAa;AAAA,EACxC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,IAAI;AAAA,YACF,MAAM;AAAA,YACN,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,IAAI;AAAA,MAAA;AAAA,MAEjB,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,UAAU;AAAA,QACR;AAAA,UACE,MAAM,EAAE,IAAI,UAAA;AAAA,UACZ,MAAM;AAAA,QAAA;AAAA,MACR;AAAA,MAEF,QAAQ,CAACA,GAAQC,MAAyB;AAC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,UACC,MAAMvB,EAAK;AAAA,UACX,QAAO;AAAA,UACP,UAAUA,EAAK;AAAA,UACf,WAAWF,EAAa,EAAE,UAAU,EAAQE,EAAK,UAAW;AAAA,UAE5D,UAAA,gBAAAG,EAACJ,KAAY,MAAAC,EAAA,CAAY;AAAA,QAAA;AAAA,MAAA,IAG3B,gBAAAG;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAASH,EAAK,WAAW,SAAYA,EAAK;AAAA,UAC1C,UAAUA,EAAK;AAAA,UACf,iBAAeA,EAAK,YAAY;AAAA,UAChC,WAAWF,EAAa,EAAE,UAAU,EAAQE,EAAK,UAAW;AAAA,UAE5D,UAAA,gBAAAG,EAACJ,KAAY,MAAAC,EAAA,CAAY;AAAA,QAAA;AAAA,MAAA,KAlBtBA,EAAK,EAqBd,CACD,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AAEDI,EAAQ,cAAc;"}
|
|
1
|
+
{"version":3,"file":"nav-grid-Oc4aCPrg.js","sources":["../../src/components/nav-grid/nav-grid.agent.ts","../../src/components/nav-grid/nav-grid.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — NavGrid. */\n/* */\n/* A responsive grid of navigable tiles (the composition primitive behind */\n/* a settings hub). It exposes the live tile count and lets an agent */\n/* activate a tile by id — which either follows the tile's href or fires */\n/* its select handler. */\n/* */\n/* See `src/docs/26-agent-readiness.mdx` for the full contract. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { NavGridHandle } from './nav-grid';\n\nexport const navGridAgent: AgentAdapter<NavGridHandle> = {\n id: 'nav-grid',\n capabilities: ['navigate'],\n state: {\n itemCount: {\n type: 'number',\n descriptionKey: 'ui.agent.navGrid.state.itemCount',\n description: 'Number of navigable tiles currently rendered in the grid.',\n read: (handle) => handle.getItemCount(),\n },\n },\n actions: {\n open_item: {\n safety: 'write',\n openWorld: false,\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: {\n id: {\n type: 'string',\n description:\n 'Stable opaque tile id (emitted as data-nav-item-id on each tile).',\n },\n },\n required: ['id'],\n },\n descriptionKey: 'ui.agent.navGrid.actions.openItem',\n description:\n 'Activate the tile with the given id (navigates or fires its select handler).',\n examples: [\n {\n args: { id: 'billing' },\n note: 'Open the \"billing\" settings section.',\n },\n ],\n invoke: (handle, args: { id: string }) => {\n handle.openItem(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'nav-grid',\n description: 'Marks the NavGrid nav landmark.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific grid from the agent.',\n },\n item: {\n attr: 'data-nav-item-id',\n sourceProp: 'item id',\n description:\n 'Stable opaque id of a tile, sourced from each item.id. open_item targets this attribute.',\n },\n },\n};\n","import { forwardRef, useMemo, type ReactNode } from 'react';\nimport { cva } from 'class-variance-authority';\nimport { Link } from '../link/link';\nimport { useAgentRegistration } from '../../agent';\nimport { navGridAgent } from './nav-grid.agent';\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface NavGridItem {\n /** Stable, opaque id. Emitted as `data-nav-item-id`; agents target it. */\n id: string;\n /** Localised tile label — supplied by the consumer (never bundled here). */\n label: string;\n /** Optional localised supporting text shown under the label. */\n description?: string;\n /** Decorative leading glyph. Rendered `aria-hidden`. */\n icon?: ReactNode;\n /** When set, the tile is a navigating anchor (kit Link). */\n href?: string;\n /** When `href` is absent, the tile is a button firing this handler. */\n onSelect?: () => void;\n /** Render the tile non-interactive and visually muted. */\n disabled?: boolean;\n}\n\n/** Agent-readiness curated handle for NavGrid. */\nexport interface NavGridHandle {\n getItemCount: () => number;\n /** Activate the tile with the given id (navigate, or fire its onSelect). */\n openItem: (id: string) => void;\n}\n\nexport interface NavGridProps {\n /** Tiles to render. label / description / icon are consumer-supplied props. */\n items: NavGridItem[];\n /** REQUIRED — the nav landmark's accessible name (e.g. \"Settings sections\"). */\n ariaLabel: string;\n /** Column count. Omit for the responsive default (1 → 2 → 3 at sm / lg). */\n columns?: 1 | 2 | 3 | 4;\n /** `label` sorts tiles by `label.localeCompare`; `none` (default) preserves order. */\n sort?: 'label' | 'none';\n id?: string;\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst gridVariants = cva(\n 'ds:grid ds:list-none ds:m-0 ds:p-0 ds:gap-[var(--spacing-md)]',\n {\n variants: {\n columns: {\n // Responsive default: one column on mobile, two from sm, three from lg.\n responsive: 'ds:grid-cols-1 ds:sm:grid-cols-2 ds:lg:grid-cols-3',\n '1': 'ds:grid-cols-1',\n '2': 'ds:grid-cols-1 ds:sm:grid-cols-2',\n '3': 'ds:grid-cols-1 ds:sm:grid-cols-2 ds:lg:grid-cols-3',\n '4': 'ds:grid-cols-1 ds:sm:grid-cols-2 ds:lg:grid-cols-4',\n },\n },\n defaultVariants: { columns: 'responsive' },\n },\n);\n\n// Shared tile look applied to BOTH the Link (href) and the button (onSelect)\n// so the two render identically. Focus ring is included here so the native\n// button gets a visible ring too (Link also carries its own — same tokens).\nconst tileVariants = cva(\n [\n 'ds:flex ds:flex-col ds:items-start ds:gap-[var(--spacing-xs)] ds:text-start',\n 'ds:h-full ds:w-full ds:min-h-[var(--min-target-size)] ds:p-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-lg)] ds:[:where(&)]:border-[length:var(--surface-border-width,var(--border-width-sm))] ds:border-[color:var(--card-border)]',\n 'ds:bg-[var(--card)] ds:text-[var(--card-foreground)] ds:no-underline',\n 'ds:transition-shadow ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n 'ds:outline-none',\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 {\n variants: {\n disabled: {\n true: 'ds:opacity-50 ds:cursor-not-allowed ds:pointer-events-none',\n false: 'ds:cursor-pointer ds:hover:shadow-[var(--shadow-hover)]',\n },\n },\n defaultVariants: { disabled: false },\n },\n);\n\n/* ------------------------------------------------------------------ */\n/* Tile content */\n/* ------------------------------------------------------------------ */\n\nfunction TileContent({ item }: { item: NavGridItem }) {\n return (\n <>\n {item.icon ? (\n <span\n aria-hidden=\"true\"\n className=\"ds:inline-flex ds:items-center ds:text-[var(--muted-foreground)] ds:[&_svg]:size-6\"\n >\n {item.icon}\n </span>\n ) : null}\n {/* `no-underline` on the span reliably suppresses the Link's underline\n across this text regardless of stylesheet order (own decoration box). */}\n <span className=\"type-body ds:font-medium ds:text-[var(--card-foreground)] ds:no-underline\">\n {item.label}\n </span>\n {item.description ? (\n <span className=\"type-body-sm ds:text-[var(--muted-foreground)] ds:no-underline\">\n {item.description}\n </span>\n ) : null}\n </>\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const NavGrid = forwardRef<HTMLElement, NavGridProps>(function NavGrid(\n { items, ariaLabel, columns, sort = 'none', id, className },\n ref,\n) {\n // Locale-aware sort is the consumer's opt-in; otherwise render as given.\n const resolvedItems = useMemo(\n () =>\n sort === 'label'\n ? [...items].sort((a, b) => a.label.localeCompare(b.label))\n : items,\n [items, sort],\n );\n\n const handle = useMemo<NavGridHandle>(\n () => ({\n getItemCount: () => items.length,\n openItem: (itemId) => {\n const target = items.find((it) => it.id === itemId);\n if (!target || target.disabled) return;\n if (target.href) {\n if (typeof window !== 'undefined') window.location.href = target.href;\n } else {\n target.onSelect?.();\n }\n },\n }),\n [items],\n );\n useAgentRegistration(navGridAgent, handle, id);\n\n const columnKey =\n columns === undefined\n ? ('responsive' as const)\n : (String(columns) as '1' | '2' | '3' | '4');\n\n return (\n <nav\n ref={ref}\n id={id}\n aria-label={ariaLabel}\n data-component=\"nav-grid\"\n data-component-id={id}\n className={className}\n >\n <ul className={gridVariants({ columns: columnKey })}>\n {resolvedItems.map((item) => (\n <li key={item.id} data-nav-item-id={item.id}>\n {item.href !== undefined ? (\n <Link\n href={item.href}\n intent=\"subtle\"\n disabled={item.disabled}\n className={tileVariants({ disabled: Boolean(item.disabled) })}\n >\n <TileContent item={item} />\n </Link>\n ) : (\n <button\n type=\"button\"\n onClick={item.disabled ? undefined : item.onSelect}\n disabled={item.disabled}\n aria-disabled={item.disabled || undefined}\n className={tileVariants({ disabled: Boolean(item.disabled) })}\n >\n <TileContent item={item} />\n </button>\n )}\n </li>\n ))}\n </ul>\n </nav>\n );\n});\n\nNavGrid.displayName = 'NavGrid';\n\nexport { tileVariants as navGridTileVariants };\n"],"names":["navGridAgent","handle","args","gridVariants","cva","tileVariants","TileContent","item","jsxs","Fragment","jsx","NavGrid","forwardRef","items","ariaLabel","columns","sort","id","className","ref","resolvedItems","useMemo","a","b","itemId","target","it","_a","useAgentRegistration","columnKey","Link"],"mappings":";;;;;AAcO,MAAMA,IAA4C;AAAA,EACvD,IAAI;AAAA,EACJ,cAAc,CAAC,UAAU;AAAA,EACzB,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,MAAM,CAACC,MAAWA,EAAO,aAAA;AAAA,IAAa;AAAA,EACxC;AAAA,EAEF,SAAS;AAAA,IACP,WAAW;AAAA,MACT,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,UACV,IAAI;AAAA,YACF,MAAM;AAAA,YACN,aACE;AAAA,UAAA;AAAA,QACJ;AAAA,QAEF,UAAU,CAAC,IAAI;AAAA,MAAA;AAAA,MAEjB,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,UAAU;AAAA,QACR;AAAA,UACE,MAAM,EAAE,IAAI,UAAA;AAAA,U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,EAAK,IACtC,UAAAA,EAAK,SAAS,SACb,gBAAAG;AAAA,QAACoB;AAAA,QAAA;AAAA,UACC,MAAMvB,EAAK;AAAA,UACX,QAAO;AAAA,UACP,UAAUA,EAAK;AAAA,UACf,WAAWF,EAAa,EAAE,UAAU,EAAQE,EAAK,UAAW;AAAA,UAE5D,UAAA,gBAAAG,EAACJ,KAAY,MAAAC,EAAA,CAAY;AAAA,QAAA;AAAA,MAAA,IAG3B,gBAAAG;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAASH,EAAK,WAAW,SAAYA,EAAK;AAAA,UAC1C,UAAUA,EAAK;AAAA,UACf,iBAAeA,EAAK,YAAY;AAAA,UAChC,WAAWF,EAAa,EAAE,UAAU,EAAQE,EAAK,UAAW;AAAA,UAE5D,UAAA,gBAAAG,EAACJ,KAAY,MAAAC,EAAA,CAAY;AAAA,QAAA;AAAA,MAAA,KAlBtBA,EAAK,EAqBd,CACD,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AAEDI,EAAQ,cAAc;"}
|
|
@@ -2,7 +2,7 @@ import { c as f } from "./createLucideIcon-DhHxpK9K.js";
|
|
|
2
2
|
import { jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import { useTranslation as g } from "react-i18next";
|
|
4
4
|
import { B as u } from "./badge-BUk4RjTS.js";
|
|
5
|
-
import { L as h } from "./link-
|
|
5
|
+
import { L as h } from "./link-N5_YpLtm.js";
|
|
6
6
|
import { i as b } from "./is-safe-url-DkETxeHz.js";
|
|
7
7
|
import { S as y } from "./scan-line-CNseIHQ0.js";
|
|
8
8
|
import { L as N } from "./layers-DcAENmsZ.js";
|
|
@@ -121,4 +121,4 @@ export {
|
|
|
121
121
|
M as P,
|
|
122
122
|
U as n
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=note-attachment-
|
|
124
|
+
//# sourceMappingURL=note-attachment-D8V7PUiR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note-attachment-DoVWvjWR.js","sources":["../../node_modules/lucide-react/dist/esm/icons/flag.mjs","../../node_modules/lucide-react/dist/esm/icons/pin.mjs","../../src/components/_shared/note-markdown.ts","../../src/components/_shared/note-attachment.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528\",\n key: \"1jaruq\"\n }\n ]\n];\nconst Flag = createLucideIcon(\"flag\", __iconNode);\n\nexport { __iconNode, Flag as default };\n//# sourceMappingURL=flag.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M12 17v5\", key: \"bb1du9\" }],\n [\n \"path\",\n {\n d: \"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z\",\n key: \"1nkz8b\"\n }\n ]\n];\nconst Pin = createLucideIcon(\"pin\", __iconNode);\n\nexport { __iconNode, Pin as default };\n//# sourceMappingURL=pin.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Note markdown → safe HTML */\n/* */\n/* Shared by every surface that renders a note body — ClinicalNoteCard */\n/* and NoteTimeline today. One implementation, so the small Markdown */\n/* subset a note supports cannot drift between the card and the timeline. */\n/* */\n/* The output is always handed to `SafeHtml` (markdown profile), which */\n/* strips everything outside the allow-list, so even a hostile note can */\n/* only ever emit the sanitised tag set. Nothing here calls */\n/* dangerouslySetInnerHTML — SafeHtml is the single carrier. */\n/* -------------------------------------------------------------------- */\n\n/** HTML-escape a raw text run before re-inserting our own safe markup. */\nfunction escapeHtml(input: string): string {\n return input\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\n/** Apply inline markdown (bold, italic, code, links) to an escaped run. */\nfunction renderInlineHtml(escaped: string): string {\n let out = escaped;\n // Inline code first so its contents aren't re-processed.\n out = out.replace(/`([^`]+)`/g, '<code>$1</code>');\n out = out.replace(/\\*\\*([^*]+)\\*\\*/g, '<strong>$1</strong>');\n out = out.replace(/\\*([^*]+)\\*/g, '<em>$1</em>');\n // Links — the href is left as-authored; SafeHtml's markdown profile\n // rejects any scheme outside http(s)/mailto/tel at sanitise time.\n out = out.replace(\n /\\[([^\\]]+)\\]\\(([^)\\s]+)\\)/g,\n '<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>',\n );\n return out;\n}\n\n/** Convert the supported Markdown subset into an HTML string. */\nexport function noteMarkdownToHtml(input: string): string {\n const blocks = input.split(/\\n{2,}/);\n return blocks\n .map((block) => {\n const lines = block.split('\\n');\n const isUnordered = lines.every((l) => /^\\s*[-*]\\s+/.test(l));\n const isOrdered = lines.every((l) => /^\\s*\\d+\\.\\s+/.test(l));\n if (isUnordered && lines.length > 0) {\n const items = lines\n .map((l) => l.replace(/^\\s*[-*]\\s+/, ''))\n .map((l) => `<li>${renderInlineHtml(escapeHtml(l))}</li>`)\n .join('');\n return `<ul>${items}</ul>`;\n }\n if (isOrdered && lines.length > 0) {\n const items = lines\n .map((l) => l.replace(/^\\s*\\d+\\.\\s+/, ''))\n .map((l) => `<li>${renderInlineHtml(escapeHtml(l))}</li>`)\n .join('');\n return `<ol>${items}</ol>`;\n }\n const paragraph = renderInlineHtml(escapeHtml(block)).replace(\n /\\n/g,\n '<br />',\n );\n return `<p>${paragraph}</p>`;\n })\n .join('');\n}\n","/* -------------------------------------------------------------------- */\n/* Note attachment chip */\n/* */\n/* The entity a note is bound to, rendered as one chip — or as a link */\n/* when the host supplies a safe url. Shared by every surface that shows */\n/* a note (ClinicalNoteCard and NoteTimeline today) so the wording, the */\n/* glyph and the link-vs-chip rule cannot drift between them. */\n/* */\n/* The strings stay under `clinicalNoteCard.attachment.*`: they name the */\n/* ATTACHED ENTITY, not the surface showing it, so they are already the */\n/* right words wherever a note is rendered. */\n/* -------------------------------------------------------------------- */\n\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { FileText, Layers, ScanLine, User } from 'lucide-react';\nimport { Badge } from '../badge/badge';\nimport { Link } from '../link/link';\nimport { isSafeEntityUrl } from './is-safe-url';\n\n/**\n * What a note is attached to.\n *\n * - `patient` — the patient record itself.\n * - `carePlan` — a numbered care plan.\n * - `carePlanEntry`— one treatment in a plan, optionally with tooth elements.\n * - `phase` — a scheduled phase.\n * - `xray` — an x-ray / radiograph, optionally labelled.\n *\n * Every non-patient kind takes an optional `url`: a safe one turns the chip\n * into a link, an unsafe one keeps the chip.\n */\nexport type NoteAttachment =\n | { kind: 'patient' }\n | { kind: 'carePlan'; number: string; url?: string }\n | {\n kind: 'carePlanEntry';\n careName: string;\n elements?: string[];\n url?: string;\n }\n | { kind: 'phase'; label: string; url?: string }\n | { kind: 'xray'; label?: string; url?: string };\n\n/**\n * Renders the attachment as a chip, or a link when `url` is safe. Returns\n * `null` for an unattached note, so a caller can render it unconditionally.\n */\nexport function NoteAttachmentChip({\n attachedTo,\n}: {\n attachedTo?: NoteAttachment;\n}): ReactNode {\n const { t } = useTranslation('ui');\n\n if (!attachedTo) return null;\n\n // A safe host url turns the chip into a link; otherwise it stays a chip.\n const linkOrChip = (\n label: string,\n icon: ReactNode,\n variant: 'info' | 'neutral',\n url: string | undefined,\n ): ReactNode =>\n url && isSafeEntityUrl(url) ? (\n <Link href={url} intent=\"default\" startIcon={icon}>\n {label}\n </Link>\n ) : (\n <Badge variant={variant} size=\"sm\" leading={icon}>\n {label}\n </Badge>\n );\n\n switch (attachedTo.kind) {\n case 'patient':\n return (\n <Badge\n variant=\"neutral\"\n size=\"sm\"\n leading={<User aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.attachment.patient')}\n </Badge>\n );\n case 'carePlan':\n return linkOrChip(\n t('clinicalNoteCard.attachment.carePlan', {\n number: attachedTo.number,\n }),\n <FileText aria-hidden=\"true\" />,\n 'info',\n attachedTo.url,\n );\n case 'carePlanEntry':\n return linkOrChip(\n attachedTo.elements && attachedTo.elements.length > 0\n ? t('clinicalNoteCard.attachment.carePlanEntryWithElements', {\n care: attachedTo.careName,\n elements: attachedTo.elements.join(', '),\n })\n : t('clinicalNoteCard.attachment.carePlanEntry', {\n care: attachedTo.careName,\n }),\n <FileText aria-hidden=\"true\" />,\n 'info',\n attachedTo.url,\n );\n case 'phase':\n return linkOrChip(\n t('clinicalNoteCard.attachment.phase', { label: attachedTo.label }),\n <Layers aria-hidden=\"true\" />,\n 'neutral',\n attachedTo.url,\n );\n case 'xray':\n return linkOrChip(\n attachedTo.label\n ? t('clinicalNoteCard.attachment.xrayWithLabel', {\n label: attachedTo.label,\n })\n : t('clinicalNoteCard.attachment.xray'),\n <ScanLine aria-hidden=\"true\" />,\n 'neutral',\n attachedTo.url,\n );\n }\n}\n"],"names":["__iconNode","Flag","createLucideIcon","Pin","escapeHtml","input","renderInlineHtml","escaped","out","noteMarkdownToHtml","block","lines","isUnordered","isOrdered","l","NoteAttachmentChip","attachedTo","t","useTranslation","linkOrChip","label","icon","variant","url","isSafeEntityUrl","jsx","Link","Badge","User","FileText","Layers","ScanLine"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,E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,MAAMD,EAAW;AAAA,UACjB,UAAUA,EAAW,SAAS,KAAK,IAAI;AAAA,QAAA,CACxC,IACDC,EAAE,6CAA6C;AAAA,UAC7C,MAAMD,EAAW;AAAA,QAAA,CAClB;AAAA,QACL,gBAAAS,EAACI,GAAA,EAAS,eAAY,OAAA,CAAO;AAAA,QAC7B;AAAA,QACAb,EAAW;AAAA,MAAA;AAAA,IAEf,KAAK;AACH,aAAOG;AAAA,QACLF,EAAE,qCAAqC,EAAE,OAAOD,EAAW,OAAO;AAAA,QAClE,gBAAAS,EAACK,GAAA,EAAO,eAAY,OAAA,CAAO;AAAA,QAC3B;AAAA,QACAd,EAAW;AAAA,MAAA;AAAA,IAEf,KAAK;AACH,aAAOG;AAAA,QACLH,EAAW,QACPC,EAAE,6CAA6C;AAAA,UAC7C,OAAOD,EAAW;AAAA,QAAA,CACnB,IACDC,EAAE,kCAAkC;AAAA,QACxC,gBAAAQ,EAACM,GAAA,EAAS,eAAY,OAAA,CAAO;AAAA,QAC7B;AAAA,QACAf,EAAW;AAAA,MAAA;AAAA,EACb;AAEN;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"note-attachment-D8V7PUiR.js","sources":["../../node_modules/lucide-react/dist/esm/icons/flag.mjs","../../node_modules/lucide-react/dist/esm/icons/pin.mjs","../../src/components/_shared/note-markdown.ts","../../src/components/_shared/note-attachment.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n {\n d: \"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528\",\n key: \"1jaruq\"\n }\n ]\n];\nconst Flag = createLucideIcon(\"flag\", __iconNode);\n\nexport { __iconNode, Flag as default };\n//# sourceMappingURL=flag.mjs.map\n","/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M12 17v5\", key: \"bb1du9\" }],\n [\n \"path\",\n {\n d: \"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z\",\n key: \"1nkz8b\"\n }\n ]\n];\nconst Pin = createLucideIcon(\"pin\", __iconNode);\n\nexport { __iconNode, Pin as default };\n//# sourceMappingURL=pin.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Note markdown → safe HTML */\n/* */\n/* Shared by every surface that renders a note body — ClinicalNoteCard */\n/* and NoteTimeline today. One implementation, so the small Markdown */\n/* subset a note supports cannot drift between the card and the timeline. */\n/* */\n/* The output is always handed to `SafeHtml` (markdown profile), which */\n/* strips everything outside the allow-list, so even a hostile note can */\n/* only ever emit the sanitised tag set. Nothing here calls */\n/* dangerouslySetInnerHTML — SafeHtml is the single carrier. */\n/* -------------------------------------------------------------------- */\n\n/** HTML-escape a raw text run before re-inserting our own safe markup. */\nfunction escapeHtml(input: string): string {\n return input\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\n/** Apply inline markdown (bold, italic, code, links) to an escaped run. */\nfunction renderInlineHtml(escaped: string): string {\n let out = escaped;\n // Inline code first so its contents aren't re-processed.\n out = out.replace(/`([^`]+)`/g, '<code>$1</code>');\n out = out.replace(/\\*\\*([^*]+)\\*\\*/g, '<strong>$1</strong>');\n out = out.replace(/\\*([^*]+)\\*/g, '<em>$1</em>');\n // Links — the href is left as-authored; SafeHtml's markdown profile\n // rejects any scheme outside http(s)/mailto/tel at sanitise time.\n out = out.replace(\n /\\[([^\\]]+)\\]\\(([^)\\s]+)\\)/g,\n '<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>',\n );\n return out;\n}\n\n/** Convert the supported Markdown subset into an HTML string. */\nexport function noteMarkdownToHtml(input: string): string {\n const blocks = input.split(/\\n{2,}/);\n return blocks\n .map((block) => {\n const lines = block.split('\\n');\n const isUnordered = lines.every((l) => /^\\s*[-*]\\s+/.test(l));\n const isOrdered = lines.every((l) => /^\\s*\\d+\\.\\s+/.test(l));\n if (isUnordered && lines.length > 0) {\n const items = lines\n .map((l) => l.replace(/^\\s*[-*]\\s+/, ''))\n .map((l) => `<li>${renderInlineHtml(escapeHtml(l))}</li>`)\n .join('');\n return `<ul>${items}</ul>`;\n }\n if (isOrdered && lines.length > 0) {\n const items = lines\n .map((l) => l.replace(/^\\s*\\d+\\.\\s+/, ''))\n .map((l) => `<li>${renderInlineHtml(escapeHtml(l))}</li>`)\n .join('');\n return `<ol>${items}</ol>`;\n }\n const paragraph = renderInlineHtml(escapeHtml(block)).replace(\n /\\n/g,\n '<br />',\n );\n return `<p>${paragraph}</p>`;\n })\n .join('');\n}\n","/* -------------------------------------------------------------------- */\n/* Note attachment chip */\n/* */\n/* The entity a note is bound to, rendered as one chip — or as a link */\n/* when the host supplies a safe url. Shared by every surface that shows */\n/* a note (ClinicalNoteCard and NoteTimeline today) so the wording, the */\n/* glyph and the link-vs-chip rule cannot drift between them. */\n/* */\n/* The strings stay under `clinicalNoteCard.attachment.*`: they name the */\n/* ATTACHED ENTITY, not the surface showing it, so they are already the */\n/* right words wherever a note is rendered. */\n/* -------------------------------------------------------------------- */\n\nimport type { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { FileText, Layers, ScanLine, User } from 'lucide-react';\nimport { Badge } from '../badge/badge';\nimport { Link } from '../link/link';\nimport { isSafeEntityUrl } from './is-safe-url';\n\n/**\n * What a note is attached to.\n *\n * - `patient` — the patient record itself.\n * - `carePlan` — a numbered care plan.\n * - `carePlanEntry`— one treatment in a plan, optionally with tooth elements.\n * - `phase` — a scheduled phase.\n * - `xray` — an x-ray / radiograph, optionally labelled.\n *\n * Every non-patient kind takes an optional `url`: a safe one turns the chip\n * into a link, an unsafe one keeps the chip.\n */\nexport type NoteAttachment =\n | { kind: 'patient' }\n | { kind: 'carePlan'; number: string; url?: string }\n | {\n kind: 'carePlanEntry';\n careName: string;\n elements?: string[];\n url?: string;\n }\n | { kind: 'phase'; label: string; url?: string }\n | { kind: 'xray'; label?: string; url?: string };\n\n/**\n * Renders the attachment as a chip, or a link when `url` is safe. Returns\n * `null` for an unattached note, so a caller can render it unconditionally.\n */\nexport function NoteAttachmentChip({\n attachedTo,\n}: {\n attachedTo?: NoteAttachment;\n}): ReactNode {\n const { t } = useTranslation('ui');\n\n if (!attachedTo) return null;\n\n // A safe host url turns the chip into a link; otherwise it stays a chip.\n const linkOrChip = (\n label: string,\n icon: ReactNode,\n variant: 'info' | 'neutral',\n url: string | undefined,\n ): ReactNode =>\n url && isSafeEntityUrl(url) ? (\n <Link href={url} intent=\"default\" startIcon={icon}>\n {label}\n </Link>\n ) : (\n <Badge variant={variant} size=\"sm\" leading={icon}>\n {label}\n </Badge>\n );\n\n switch (attachedTo.kind) {\n case 'patient':\n return (\n <Badge\n variant=\"neutral\"\n size=\"sm\"\n leading={<User aria-hidden=\"true\" />}\n >\n {t('clinicalNoteCard.attachment.patient')}\n </Badge>\n );\n case 'carePlan':\n return linkOrChip(\n t('clinicalNoteCard.attachment.carePlan', {\n number: attachedTo.number,\n }),\n <FileText aria-hidden=\"true\" />,\n 'info',\n attachedTo.url,\n );\n case 'carePlanEntry':\n return linkOrChip(\n attachedTo.elements && attachedTo.elements.length > 0\n ? t('clinicalNoteCard.attachment.carePlanEntryWithElements', {\n care: attachedTo.careName,\n elements: attachedTo.elements.join(', '),\n })\n : t('clinicalNoteCard.attachment.carePlanEntry', {\n care: attachedTo.careName,\n }),\n <FileText aria-hidden=\"true\" />,\n 'info',\n attachedTo.url,\n );\n case 'phase':\n return linkOrChip(\n t('clinicalNoteCard.attachment.phase', { label: attachedTo.label }),\n <Layers aria-hidden=\"true\" />,\n 'neutral',\n attachedTo.url,\n );\n case 'xray':\n return linkOrChip(\n attachedTo.label\n ? t('clinicalNoteCard.attachment.xrayWithLabel', {\n label: attachedTo.label,\n })\n : t('clinicalNoteCard.attachment.xray'),\n <ScanLine aria-hidden=\"true\" />,\n 'neutral',\n attachedTo.url,\n );\n }\n}\n"],"names":["__iconNode","Flag","createLucideIcon","Pin","escapeHtml","input","renderInlineHtml","escaped","out","noteMarkdownToHtml","block","lines","isUnordered","isOrdered","l","NoteAttachmentChip","attachedTo","t","useTranslation","linkOrChip","label","icon","variant","url","isSafeEntityUrl","jsx","Link","Badge","User","FileText","Layers","ScanLine"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMC,IAAOC,EAAiB,QAAQF,CAAU;AClBhD;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,IAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC;AAAA,IACE;AAAA,IACA;AAAA,MACE,GAAG;AAAA,MACH,KAAK;AAAA,IACX;AAAA,EACA;AACA,GACMG,IAAMD,EAAiB,OAAOF,CAAU;ACL9C,SAASI,EAAWC,GAAuB;AACzC,SAAOA,EACJ,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,QAAQ;AAC3B;AAGA,SAASC,EA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nB,IACDC,EAAE,kCAAkC;AAAA,QACxC,gBAAAQ,EAACM,GAAA,EAAS,eAAY,OAAA,CAAO;AAAA,QAC7B;AAAA,QACAf,EAAW;AAAA,MAAA;AAAA,EACb;AAEN;","x_google_ignoreList":[0,1]}
|
|
@@ -4,7 +4,7 @@ import { c as h } from "./index-D2ZczOXr.js";
|
|
|
4
4
|
import { useTranslation as L } from "react-i18next";
|
|
5
5
|
import { SafeHtml as A } from "../safe-html/index.js";
|
|
6
6
|
import { C as P, S as b } from "./skeleton-B1KTdJ4N.js";
|
|
7
|
-
import { n as B, P as K, F as O, N as q } from "./note-attachment-
|
|
7
|
+
import { n as B, P as K, F as O, N as q } from "./note-attachment-D8V7PUiR.js";
|
|
8
8
|
import { u as G } from "./registry-DvAUVLHh.js";
|
|
9
9
|
const J = {
|
|
10
10
|
id: "note-timeline",
|
|
@@ -330,4 +330,4 @@ export {
|
|
|
330
330
|
X as N,
|
|
331
331
|
J as n
|
|
332
332
|
};
|
|
333
|
-
//# sourceMappingURL=note-timeline-
|
|
333
|
+
//# sourceMappingURL=note-timeline-CwxPQ2Ak.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note-timeline-B7l3t5DZ.js","sources":["../../src/components/note-timeline/note-timeline.agent.ts","../../src/components/note-timeline/note-timeline.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — NoteTimeline. */\n/* */\n/* Read-only presentation surface. Exposes the STRUCTURE of the rendered */\n/* rows — ids plus pinned / flagged / clinical flags — and how many rows */\n/* survived `maxItems`, so a future MCP UI bridge can locate and describe */\n/* what is on screen. It NEVER reads a note body, an author or a date: */\n/* all three are PHI and stay out of the agent layer, exactly as the */\n/* ClinicalNoteCard adapter does. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { NoteTimelineHandle } from './note-timeline';\n\nexport const noteTimelineAgent: AgentAdapter<NoteTimelineHandle> = {\n id: 'note-timeline',\n capabilities: [],\n state: {\n notes: {\n type: 'Array<{ id?: string; pinned: boolean; flagged: boolean; clinical: boolean }>',\n descriptionKey: 'ui.agent.noteTimeline.state.notes',\n description:\n 'Structural snapshot of the rendered rows: ids and flags only, never note content or author.',\n read: (handle) => handle.getNotes(),\n },\n visibleCount: {\n type: 'number',\n descriptionKey: 'ui.agent.noteTimeline.state.visibleCount',\n description:\n 'How many notes are rendered, after the maxItems cap is applied.',\n read: (handle) => handle.getVisibleCount(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'note-timeline',\n description:\n 'Marks the NoteTimeline root. Emits data-empty when there is nothing to show.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop — addresses a specific timeline.',\n },\n },\n};\n","import {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\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 { SafeHtml } from '../_shared/safe-html';\nimport { CONTENT_ENTER_CLASS, Skeleton } from '../skeleton/skeleton';\nimport { noteMarkdownToHtml } from '../_shared/note-markdown';\nimport {\n NoteAttachmentChip,\n type NoteAttachment,\n} from '../_shared/note-attachment';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { noteTimelineAgent } from './note-timeline.agent';\n\n/* -------------------------------------------------------------------- */\n/* NoteTimeline */\n/* */\n/* A compact dated list of notes — the reading surface for a handful of */\n/* recent notes beside something else (an appointment, a care plan), */\n/* where a full ClinicalNoteCard per note would swamp the panel. */\n/* */\n/* It takes the SAME note objects a host already gives NotesPanel, so a */\n/* page can show a preview here and the full panel elsewhere without */\n/* reshaping its data. */\n/* */\n/* Deliberately READ-ONLY and deliberately without a \"+N more\" footer: */\n/* it shows the first `maxItems` and stops. The host owns the affordance */\n/* that opens the rest, because only the host knows where the rest live. */\n/* */\n/* Pinned and flagged are never colour-only: each carries a glyph and an */\n/* `sr-only` label, so the state survives greyscale, forced colours and */\n/* a screen reader (05-accessibility.mdx §Colour is not the only cue). */\n/* -------------------------------------------------------------------- */\n\n/** The note author — name, plus an optional avatar the timeline never shows. */\nexport interface NoteTimelineAuthor {\n /** Display name. */\n name: string;\n /** Optional avatar image URL. Unused here; kept so a `NotesPanelNote`\n * passes straight through without reshaping. */\n avatarUrl?: string;\n}\n\n/**\n * One note. Structurally a subset of `NotesPanelNote` / `ClinicalNoteCardProps`\n * so a host can pass the very objects it already gives `NotesPanel`.\n */\nexport interface NoteTimelineNote {\n /** Stable identifier. Surfaced as `data-note-id` — the ONLY note field that\n * ever reaches an attribute, because it is the only one that is not PHI. */\n id?: string;\n /** ISO-8601 timestamp the note refers to (the clinical date). Drives the\n * date gutter and the sort. */\n dateIso: string;\n /** ISO-8601 timestamp the note was written, when it differs from `dateIso`. */\n createdAtIso?: string;\n /** Who wrote it. Omit for a system-generated note — the byline is then\n * dropped entirely rather than rendered empty. */\n author?: NoteTimelineAuthor;\n /** The note body. */\n content: string;\n /** How `content` is authored. `'markdown'` (default) runs the small Markdown\n * subset through the shared converter; `'html'` treats it as rich HTML.\n * Either way `SafeHtml` is the only carrier. */\n contentFormat?: 'markdown' | 'html';\n /** Pinned notes sort to the top and take an accent dot. */\n pinned?: boolean;\n /** Flagged for follow-up — a warning dot and a Flag glyph. */\n flagged?: boolean;\n /** The entity the note is bound to; renders the shared attachment chip. */\n attachedTo?: NoteAttachment;\n /** Whether the note is clinical. Structural only — it drives no styling\n * here, but it is carried so the same objects serve both surfaces. */\n clinical?: boolean;\n}\n\n/** Imperative handle for the agent runtime — identifiers / flags only. */\nexport interface NoteTimelineHandle {\n /** Structural snapshot of the RENDERED rows: ids + flags, never a body or\n * an author (both PHI). */\n getNotes: () => Array<{\n id?: string;\n pinned: boolean;\n flagged: boolean;\n clinical: boolean;\n }>;\n /** How many rows are rendered, after `maxItems` is applied. */\n getVisibleCount: () => number;\n}\n\nconst rowVariants = cva(\n [\n // Named group so the rail's connector can ask \"is my ROW the last one?\".\n // A bare `last:` on the rail asks \"am I the last child of my row?\", which\n // is never true — it is the middle of three — so the line ran on past the\n // final dot and read as more content below.\n 'ds:group/note-row ds:relative ds:flex ds:gap-[var(--spacing-sm)]',\n 'ds:pb-3 ds:last:pb-0',\n ].join(' '),\n);\n\nconst bodyVariants = cva(\n [\n 'type-body-sm ds:[overflow-wrap:break-word]',\n // `[&_p]:m-0` — the converter wraps each block in <p>; the timeline\n // controls its own rhythm, so the paragraph margins are dropped.\n 'ds:[&_p]:m-0',\n ].join(' '),\n {\n variants: {\n // Literal classes, one per supported value: Tailwind generates what it\n // can see in the source, so an interpolated arbitrary value emits\n // nothing and the body would silently never clamp.\n lines: {\n 1: 'ds:line-clamp-1',\n 2: 'ds:line-clamp-2',\n 3: 'ds:line-clamp-3',\n 4: 'ds:line-clamp-4',\n 5: 'ds:line-clamp-5',\n },\n },\n defaultVariants: { lines: 3 },\n },\n);\n\nconst dotVariants = cva(\n [\n 'ds:absolute ds:top-1 ds:start-0 ds:size-[9px]',\n 'ds:rounded-[var(--radius-full)] ds:border-2',\n 'ds:bg-[color:var(--background)]',\n 'ds:forced-colors:border-[CanvasText]',\n ].join(' '),\n {\n variants: {\n tone: {\n default: 'ds:border-[color:var(--border)]',\n pinned: [\n 'ds:border-[color:var(--accent)]',\n 'ds:bg-[color:color-mix(in_srgb,var(--accent)_20%,var(--background))]',\n ].join(' '),\n flagged: [\n 'ds:border-[color:var(--warning-readable)]',\n 'ds:bg-[color:color-mix(in_srgb,var(--warning-readable)_20%,var(--background))]',\n ].join(' '),\n },\n },\n defaultVariants: { tone: 'default' },\n },\n);\n\nexport interface NoteTimelineProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof rowVariants> {\n /** Agent-readiness consumer id, surfaced as `data-component-id`. */\n id?: string;\n /** The notes. Sorted pinned-first, then `dateIso` descending. */\n notes: readonly NoteTimelineNote[];\n /** How many rows to render after sorting. Default 3. The remainder is NOT\n * counted or footered here — the host owns that affordance. */\n maxItems?: number;\n /**\n * Makes every note (with an `id`) a single keyboard-reachable control that\n * calls back with that note's id — a real button stretched over the row,\n * so Tab/Enter reach the same place a pointer click already does. Any link\n * inside the note body loses its own tab stop while this is set, so each\n * note stays exactly one focus stop. Omit it to keep today's read-only,\n * pointer-only row.\n */\n onNoteActivate?: (id: string) => void;\n /** Lines each note body clamps to. Default 3. */\n lines?: 1 | 2 | 3 | 4 | 5;\n /** Locale for the date gutter. Defaults to the active i18n language. */\n locale?: string;\n /**\n * The notes are being read. With no notes yet it shows placeholder rows in\n * the timeline's own shape, never the empty state. With notes already on\n * screen (a refresh) it keeps them and only sets `aria-busy`.\n */\n loading?: boolean;\n /** Placeholder rows shown while `loading`. Default `2`. */\n loadingRows?: number;\n /** Rendered in place of the list when `notes` is empty. */\n emptyState?: ReactNode;\n /** Accessible name for the list region. Defaults to `ui.noteTimeline.regionLabel`. */\n 'aria-label'?: string;\n}\n\n/** Pinned first, then newest by `dateIso`. Stable for equal dates. */\nfunction sortNotes(\n notes: readonly NoteTimelineNote[],\n): readonly NoteTimelineNote[] {\n return [...notes].sort((a, b) => {\n if (!!a.pinned !== !!b.pinned) return a.pinned ? -1 : 1;\n return b.dateIso.localeCompare(a.dateIso);\n });\n}\n\nconst overlayButtonClass = [\n 'ds:absolute ds:inset-0 ds:z-1 ds:m-0 ds:cursor-pointer',\n 'ds:rounded-[var(--radius-sm)] ds:border-0 ds:bg-transparent ds:p-0',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n].join(' ');\n\nexport const NoteTimeline = forwardRef<HTMLDivElement, NoteTimelineProps>(\n (\n {\n id,\n notes,\n maxItems = 3,\n lines = 3,\n locale,\n emptyState,\n 'aria-label': ariaLabel,\n loading = false,\n loadingRows = 2,\n className,\n onNoteActivate,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation('ui');\n const resolvedLocale = locale ?? i18n.language;\n // Date + time, distinct from the gutter's day/month + year split — this\n // one names a specific note in an accessible name, the way NotesPanel's\n // \"Edit note · {{date}}\" does.\n const stamp = useMemo(\n () =>\n (isoDate: string): string => {\n try {\n return new Intl.DateTimeFormat(resolvedLocale, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n }).format(new Date(isoDate));\n } catch {\n return isoDate;\n }\n },\n [resolvedLocale],\n );\n /* Settle in only when this content REPLACES a skeleton. Content that was\n simply there from the start must not fade: it would read as invisible\n for one animation to any test or reader that looks at once. */\n const followedLoading = useRef(false);\n if (loading) followedLoading.current = true;\n const enterClass = followedLoading.current ? CONTENT_ENTER_CLASS : '';\n\n const visible = useMemo(\n () => sortNotes(notes).slice(0, Math.max(0, maxItems)),\n [notes, maxItems],\n );\n\n // The overlay button is the row's one focus stop once activation is\n // wired up; a live link SafeHtml rendered inside the body would\n // otherwise add a second, so it is neutralised on the live DOM (a\n // sanitiser strips a hand-authored `tabindex` from the HTML string).\n const rootRef = useRef<HTMLDivElement | null>(null);\n const setRef = (node: HTMLDivElement | null): void => {\n rootRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n };\n useEffect(() => {\n if (!onNoteActivate) return;\n rootRef.current\n ?.querySelectorAll('a[href]')\n .forEach((a) => a.setAttribute('tabindex', '-1'));\n });\n\n // Two formatters, not one: the gutter stacks \"20 JUN\" over \"2026\", so the\n // day/month and the year are formatted apart and both stay locale-aware.\n const fmt = useMemo(\n () => ({\n dayMonth: new Intl.DateTimeFormat(resolvedLocale, {\n day: 'numeric',\n month: 'short',\n }),\n year: new Intl.DateTimeFormat(resolvedLocale, { year: 'numeric' }),\n }),\n [resolvedLocale],\n );\n\n useAgentRegistration(\n noteTimelineAgent,\n {\n getNotes: () =>\n visible.map((note) => ({\n id: note.id,\n pinned: !!note.pinned,\n flagged: !!note.flagged,\n clinical: !!note.clinical,\n })),\n getVisibleCount: () => visible.length,\n },\n id,\n );\n\n // First read only: a refresh keeps the notes it has and marks them busy.\n if (loading && visible.length === 0) {\n return (\n <div\n ref={ref}\n data-component=\"note-timeline\"\n data-component-id={id}\n data-loading=\"\"\n aria-busy=\"true\"\n className={['ds:flex ds:flex-col', className ?? ''].join(' ').trim()}\n {...rest}\n >\n {Array.from({ length: Math.max(1, loadingRows) }, (_, index) => (\n <div key={index} aria-hidden=\"true\" className={rowVariants()}>\n <div className=\"ds:flex ds:w-12 ds:shrink-0 ds:flex-col ds:items-end ds:gap-[var(--spacing-2xs)] ds:pt-px\">\n <Skeleton\n variant=\"text\"\n size=\"sm\"\n stagger={index * 2}\n width=\"80%\"\n />\n <Skeleton\n variant=\"text\"\n size=\"sm\"\n stagger={index * 2}\n width=\"50%\"\n />\n </div>\n <div\n className={[\n 'ds:relative ds:w-[9px] ds:shrink-0',\n 'ds:before:absolute ds:before:start-[4px] ds:before:top-[14px]',\n 'ds:before:bottom-[-12px] ds:before:w-px',\n 'ds:before:bg-[color:var(--border)] ds:before:content-[\"\"]',\n 'ds:group-last/note-row:before:hidden',\n ].join(' ')}\n >\n <span className={dotVariants({ tone: 'default' })} />\n </div>\n <div className=\"ds:min-w-0 ds:flex-1\">\n <Skeleton\n variant=\"text\"\n size=\"sm\"\n lines={index % 2 === 0 ? 3 : 2}\n stagger={index * 2 + 1}\n />\n </div>\n </div>\n ))}\n </div>\n );\n }\n\n if (visible.length === 0) {\n return (\n <div\n ref={ref}\n data-component=\"note-timeline\"\n data-component-id={id}\n data-empty=\"\"\n className={className}\n {...rest}\n >\n {emptyState}\n </div>\n );\n }\n\n return (\n <div\n ref={setRef}\n data-component=\"note-timeline\"\n data-component-id={id}\n role=\"list\"\n aria-busy={loading || undefined}\n aria-label={ariaLabel ?? t('noteTimeline.regionLabel')}\n className={['ds:flex ds:flex-col', enterClass, className ?? '']\n .join(' ')\n .trim()}\n {...rest}\n >\n {visible.map((note) => {\n const date = new Date(note.dateIso);\n const tone = note.pinned\n ? ('pinned' as const)\n : note.flagged\n ? ('flagged' as const)\n : ('default' as const);\n const html =\n note.contentFormat === 'html'\n ? note.content\n : noteMarkdownToHtml(note.content);\n const canActivate = Boolean(onNoteActivate && note.id);\n\n return (\n <div\n key={note.id ?? note.dateIso}\n role=\"listitem\"\n /* id ONLY. Body, author and dates are PHI and never reach an\n attribute, where a DOM scrape or a screenshot would carry\n them out of the component. */\n data-note-id={note.id}\n data-pinned={note.pinned ? '' : undefined}\n data-flagged={note.flagged ? '' : undefined}\n className={rowVariants()}\n >\n {canActivate ? (\n <button\n type=\"button\"\n className={overlayButtonClass}\n aria-label={t('noteTimeline.openNote', {\n date: stamp(note.dateIso),\n defaultValue: 'Open note · {{date}}',\n })}\n onClick={() => onNoteActivate?.(note.id as string)}\n />\n ) : null}\n {/* 1 — date gutter */}\n {/* Sized from the --type-meta-size ROLE token, not the raw\n --font-size-2xs ramp step: `.theme-accessible` scales type by\n re-pointing the role aliases (meta xs → sm), so a raw ramp\n value would stay 10px for exactly the readers who asked for\n bigger text. The token rather than the `type-meta` CLASS,\n because that class also sets transform / weight / tracking\n and would quietly flatten the gutter's own treatment. */}\n <div className=\"ds:w-12 ds:shrink-0 ds:pt-px ds:text-end ds:text-[length:var(--type-meta-size)] ds:leading-[1.3]\">\n <div className=\"ds:font-semibold ds:tracking-[0.03em] ds:uppercase\">\n {fmt.dayMonth.format(date)}\n </div>\n <div className=\"ds:text-[color:var(--muted-foreground)]\">\n {fmt.year.format(date)}\n </div>\n </div>\n\n {/* 2 — rail: dot over the connector. The connector is a\n pseudo-element so it never lands in the a11y tree, and it is\n hidden on the last row rather than dangling into nothing. */}\n <div\n aria-hidden=\"true\"\n className={[\n 'ds:relative ds:w-[9px] ds:shrink-0',\n 'ds:before:absolute ds:before:start-[4px] ds:before:top-[14px]',\n 'ds:before:bottom-[-12px] ds:before:w-px',\n 'ds:before:bg-[color:var(--border)] ds:before:content-[\"\"]',\n 'ds:group-last/note-row:before:hidden',\n ].join(' ')}\n >\n <span className={dotVariants({ tone })} />\n </div>\n\n {/* 3 — body + byline */}\n <div className=\"ds:min-w-0 ds:flex-1\">\n <SafeHtml\n html={html}\n profile={\n note.contentFormat === 'html' ? 'rich-text' : 'markdown'\n }\n className={bodyVariants({ lines })}\n />\n {note.author ||\n note.pinned ||\n note.flagged ||\n note.attachedTo ? (\n <div className=\"ds:mt-[var(--spacing-2xs)] ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-2xs)] type-meta ds:text-[color:var(--muted-foreground)]\">\n {note.author ? <span>{note.author.name}</span> : null}\n {note.pinned ? (\n <span className=\"ds:inline-flex ds:items-center\">\n <Pin\n aria-hidden=\"true\"\n className=\"ds:size-3 ds:text-[color:var(--accent)]\"\n />\n <span className=\"ds:sr-only\">\n {t('noteTimeline.pinned')}\n </span>\n </span>\n ) : null}\n {note.flagged ? (\n <span className=\"ds:inline-flex ds:items-center\">\n <Flag\n aria-hidden=\"true\"\n className=\"ds:size-3 ds:text-[color:var(--warning-readable)]\"\n />\n <span className=\"ds:sr-only\">\n {t('noteTimeline.flagged')}\n </span>\n </span>\n ) : null}\n <NoteAttachmentChip attachedTo={note.attachedTo} />\n </div>\n ) : null}\n </div>\n </div>\n );\n })}\n </div>\n );\n },\n);\n\nNoteTimeline.displayName = 'NoteTimeline';\n"],"names":["noteTimelineAgent","handle","rowVariants","cva","bodyVariants","dotVariants","sortNotes","notes","a","b","overlayButtonClass","NoteTimeline","forwardRef","id","maxItems","lines","locale","emptyState","ariaLabel","loading","loadingRows","className","onNoteActivate","rest","ref","t","i18n","useTranslation","resolvedLocale","stamp","useMemo","isoDate","followedLoading","useRef","enterClass","CONTENT_ENTER_CLASS","visible","rootRef","setRef","node","useEffect","_a","fmt","useAgentRegistration","note","jsx","_","index","jsxs","Skeleton","date","tone","html","noteMarkdownToHtml","canActivate","SafeHtml","P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ACF,IACE;AAAA,oBACHmB,EAAK,UACJ,gBAAAI,EAAC,QAAA,EAAK,WAAU,kCACd,UAAA;AAAA,sBAAA,gBAAAH;AAAA,wBAACY;AAAA,wBAAA;AAAA,0BACC,eAAY;AAAA,0BACZ,WAAU;AAAA,wBAAA;AAAA,sBAAA;AAAA,wCAEX,QAAA,EAAK,WAAU,cACb,UAAAhC,EAAE,sBAAsB,EAAA,CAC3B;AAAA,oBAAA,EAAA,CACF,IACE;AAAA,oBACJ,gBAAAoB,EAACa,GAAA,EAAmB,YAAYd,EAAK,WAAA,CAAY;AAAA,kBAAA,EAAA,CACnD,IACE;AAAA,gBAAA,EAAA,CACN;AAAA,cAAA;AAAA,YAAA;AAAA,YA9FKA,EAAK,MAAMA,EAAK;AAAA,UAAA;AAAA,QAiG3B,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAjC,EAAa,cAAc;"}
|
|
1
|
+
{"version":3,"file":"note-timeline-CwxPQ2Ak.js","sources":["../../src/components/note-timeline/note-timeline.agent.ts","../../src/components/note-timeline/note-timeline.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — NoteTimeline. */\n/* */\n/* Read-only presentation surface. Exposes the STRUCTURE of the rendered */\n/* rows — ids plus pinned / flagged / clinical flags — and how many rows */\n/* survived `maxItems`, so a future MCP UI bridge can locate and describe */\n/* what is on screen. It NEVER reads a note body, an author or a date: */\n/* all three are PHI and stay out of the agent layer, exactly as the */\n/* ClinicalNoteCard adapter does. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { NoteTimelineHandle } from './note-timeline';\n\nexport const noteTimelineAgent: AgentAdapter<NoteTimelineHandle> = {\n id: 'note-timeline',\n capabilities: [],\n state: {\n notes: {\n type: 'Array<{ id?: string; pinned: boolean; flagged: boolean; clinical: boolean }>',\n descriptionKey: 'ui.agent.noteTimeline.state.notes',\n description:\n 'Structural snapshot of the rendered rows: ids and flags only, never note content or author.',\n read: (handle) => handle.getNotes(),\n },\n visibleCount: {\n type: 'number',\n descriptionKey: 'ui.agent.noteTimeline.state.visibleCount',\n description:\n 'How many notes are rendered, after the maxItems cap is applied.',\n read: (handle) => handle.getVisibleCount(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'note-timeline',\n description:\n 'Marks the NoteTimeline root. Emits data-empty when there is nothing to show.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop — addresses a specific timeline.',\n },\n },\n};\n","import {\n forwardRef,\n useEffect,\n useMemo,\n useRef,\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 { SafeHtml } from '../_shared/safe-html';\nimport { CONTENT_ENTER_CLASS, Skeleton } from '../skeleton/skeleton';\nimport { noteMarkdownToHtml } from '../_shared/note-markdown';\nimport {\n NoteAttachmentChip,\n type NoteAttachment,\n} from '../_shared/note-attachment';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { noteTimelineAgent } from './note-timeline.agent';\n\n/* -------------------------------------------------------------------- */\n/* NoteTimeline */\n/* */\n/* A compact dated list of notes — the reading surface for a handful of */\n/* recent notes beside something else (an appointment, a care plan), */\n/* where a full ClinicalNoteCard per note would swamp the panel. */\n/* */\n/* It takes the SAME note objects a host already gives NotesPanel, so a */\n/* page can show a preview here and the full panel elsewhere without */\n/* reshaping its data. */\n/* */\n/* Deliberately READ-ONLY and deliberately without a \"+N more\" footer: */\n/* it shows the first `maxItems` and stops. The host owns the affordance */\n/* that opens the rest, because only the host knows where the rest live. */\n/* */\n/* Pinned and flagged are never colour-only: each carries a glyph and an */\n/* `sr-only` label, so the state survives greyscale, forced colours and */\n/* a screen reader (05-accessibility.mdx §Colour is not the only cue). */\n/* -------------------------------------------------------------------- */\n\n/** The note author — name, plus an optional avatar the timeline never shows. */\nexport interface NoteTimelineAuthor {\n /** Display name. */\n name: string;\n /** Optional avatar image URL. Unused here; kept so a `NotesPanelNote`\n * passes straight through without reshaping. */\n avatarUrl?: string;\n}\n\n/**\n * One note. Structurally a subset of `NotesPanelNote` / `ClinicalNoteCardProps`\n * so a host can pass the very objects it already gives `NotesPanel`.\n */\nexport interface NoteTimelineNote {\n /** Stable identifier. Surfaced as `data-note-id` — the ONLY note field that\n * ever reaches an attribute, because it is the only one that is not PHI. */\n id?: string;\n /** ISO-8601 timestamp the note refers to (the clinical date). Drives the\n * date gutter and the sort. */\n dateIso: string;\n /** ISO-8601 timestamp the note was written, when it differs from `dateIso`. */\n createdAtIso?: string;\n /** Who wrote it. Omit for a system-generated note — the byline is then\n * dropped entirely rather than rendered empty. */\n author?: NoteTimelineAuthor;\n /** The note body. */\n content: string;\n /** How `content` is authored. `'markdown'` (default) runs the small Markdown\n * subset through the shared converter; `'html'` treats it as rich HTML.\n * Either way `SafeHtml` is the only carrier. */\n contentFormat?: 'markdown' | 'html';\n /** Pinned notes sort to the top and take an accent dot. */\n pinned?: boolean;\n /** Flagged for follow-up — a warning dot and a Flag glyph. */\n flagged?: boolean;\n /** The entity the note is bound to; renders the shared attachment chip. */\n attachedTo?: NoteAttachment;\n /** Whether the note is clinical. Structural only — it drives no styling\n * here, but it is carried so the same objects serve both surfaces. */\n clinical?: boolean;\n}\n\n/** Imperative handle for the agent runtime — identifiers / flags only. */\nexport interface NoteTimelineHandle {\n /** Structural snapshot of the RENDERED rows: ids + flags, never a body or\n * an author (both PHI). */\n getNotes: () => Array<{\n id?: string;\n pinned: boolean;\n flagged: boolean;\n clinical: boolean;\n }>;\n /** How many rows are rendered, after `maxItems` is applied. */\n getVisibleCount: () => number;\n}\n\nconst rowVariants = cva(\n [\n // Named group so the rail's connector can ask \"is my ROW the last one?\".\n // A bare `last:` on the rail asks \"am I the last child of my row?\", which\n // is never true — it is the middle of three — so the line ran on past the\n // final dot and read as more content below.\n 'ds:group/note-row ds:relative ds:flex ds:gap-[var(--spacing-sm)]',\n 'ds:pb-3 ds:last:pb-0',\n ].join(' '),\n);\n\nconst bodyVariants = cva(\n [\n 'type-body-sm ds:[overflow-wrap:break-word]',\n // `[&_p]:m-0` — the converter wraps each block in <p>; the timeline\n // controls its own rhythm, so the paragraph margins are dropped.\n 'ds:[&_p]:m-0',\n ].join(' '),\n {\n variants: {\n // Literal classes, one per supported value: Tailwind generates what it\n // can see in the source, so an interpolated arbitrary value emits\n // nothing and the body would silently never clamp.\n lines: {\n 1: 'ds:line-clamp-1',\n 2: 'ds:line-clamp-2',\n 3: 'ds:line-clamp-3',\n 4: 'ds:line-clamp-4',\n 5: 'ds:line-clamp-5',\n },\n },\n defaultVariants: { lines: 3 },\n },\n);\n\nconst dotVariants = cva(\n [\n 'ds:absolute ds:top-1 ds:start-0 ds:size-[9px]',\n 'ds:rounded-[var(--radius-full)] ds:border-2',\n 'ds:bg-[color:var(--background)]',\n 'ds:forced-colors:border-[CanvasText]',\n ].join(' '),\n {\n variants: {\n tone: {\n default: 'ds:border-[color:var(--border)]',\n pinned: [\n 'ds:border-[color:var(--accent)]',\n 'ds:bg-[color:color-mix(in_srgb,var(--accent)_20%,var(--background))]',\n ].join(' '),\n flagged: [\n 'ds:border-[color:var(--warning-readable)]',\n 'ds:bg-[color:color-mix(in_srgb,var(--warning-readable)_20%,var(--background))]',\n ].join(' '),\n },\n },\n defaultVariants: { tone: 'default' },\n },\n);\n\nexport interface NoteTimelineProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof rowVariants> {\n /** Agent-readiness consumer id, surfaced as `data-component-id`. */\n id?: string;\n /** The notes. Sorted pinned-first, then `dateIso` descending. */\n notes: readonly NoteTimelineNote[];\n /** How many rows to render after sorting. Default 3. The remainder is NOT\n * counted or footered here — the host owns that affordance. */\n maxItems?: number;\n /**\n * Makes every note (with an `id`) a single keyboard-reachable control that\n * calls back with that note's id — a real button stretched over the row,\n * so Tab/Enter reach the same place a pointer click already does. Any link\n * inside the note body loses its own tab stop while this is set, so each\n * note stays exactly one focus stop. Omit it to keep today's read-only,\n * pointer-only row.\n */\n onNoteActivate?: (id: string) => void;\n /** Lines each note body clamps to. Default 3. */\n lines?: 1 | 2 | 3 | 4 | 5;\n /** Locale for the date gutter. Defaults to the active i18n language. */\n locale?: string;\n /**\n * The notes are being read. With no notes yet it shows placeholder rows in\n * the timeline's own shape, never the empty state. With notes already on\n * screen (a refresh) it keeps them and only sets `aria-busy`.\n */\n loading?: boolean;\n /** Placeholder rows shown while `loading`. Default `2`. */\n loadingRows?: number;\n /** Rendered in place of the list when `notes` is empty. */\n emptyState?: ReactNode;\n /** Accessible name for the list region. Defaults to `ui.noteTimeline.regionLabel`. */\n 'aria-label'?: string;\n}\n\n/** Pinned first, then newest by `dateIso`. Stable for equal dates. */\nfunction sortNotes(\n notes: readonly NoteTimelineNote[],\n): readonly NoteTimelineNote[] {\n return [...notes].sort((a, b) => {\n if (!!a.pinned !== !!b.pinned) return a.pinned ? -1 : 1;\n return b.dateIso.localeCompare(a.dateIso);\n });\n}\n\nconst overlayButtonClass = [\n 'ds:absolute ds:inset-0 ds:z-1 ds:m-0 ds:cursor-pointer',\n 'ds:rounded-[var(--radius-sm)] ds:border-0 ds:bg-transparent ds:p-0',\n 'ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid',\n 'ds:focus-visible:outline-ring ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]',\n 'ds:forced-colors:focus-visible:outline-[CanvasText]',\n].join(' ');\n\nexport const NoteTimeline = forwardRef<HTMLDivElement, NoteTimelineProps>(\n (\n {\n id,\n notes,\n maxItems = 3,\n lines = 3,\n locale,\n emptyState,\n 'aria-label': ariaLabel,\n loading = false,\n loadingRows = 2,\n className,\n onNoteActivate,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation('ui');\n const resolvedLocale = locale ?? i18n.language;\n // Date + time, distinct from the gutter's day/month + year split — this\n // one names a specific note in an accessible name, the way NotesPanel's\n // \"Edit note · {{date}}\" does.\n const stamp = useMemo(\n () =>\n (isoDate: string): string => {\n try {\n return new Intl.DateTimeFormat(resolvedLocale, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n }).format(new Date(isoDate));\n } catch {\n return isoDate;\n }\n },\n [resolvedLocale],\n );\n /* Settle in only when this content REPLACES a skeleton. Content that was\n simply there from the start must not fade: it would read as invisible\n for one animation to any test or reader that looks at once. */\n const followedLoading = useRef(false);\n if (loading) followedLoading.current = true;\n const enterClass = followedLoading.current ? CONTENT_ENTER_CLASS : '';\n\n const visible = useMemo(\n () => sortNotes(notes).slice(0, Math.max(0, maxItems)),\n [notes, maxItems],\n );\n\n // The overlay button is the row's one focus stop once activation is\n // wired up; a live link SafeHtml rendered inside the body would\n // otherwise add a second, so it is neutralised on the live DOM (a\n // sanitiser strips a hand-authored `tabindex` from the HTML string).\n const rootRef = useRef<HTMLDivElement | null>(null);\n const setRef = (node: HTMLDivElement | null): void => {\n rootRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n };\n useEffect(() => {\n if (!onNoteActivate) return;\n rootRef.current\n ?.querySelectorAll('a[href]')\n .forEach((a) => a.setAttribute('tabindex', '-1'));\n });\n\n // Two formatters, not one: the gutter stacks \"20 JUN\" over \"2026\", so the\n // day/month and the year are formatted apart and both stay locale-aware.\n const fmt = useMemo(\n () => ({\n dayMonth: new Intl.DateTimeFormat(resolvedLocale, {\n day: 'numeric',\n month: 'short',\n }),\n year: new Intl.DateTimeFormat(resolvedLocale, { year: 'numeric' }),\n }),\n [resolvedLocale],\n );\n\n useAgentRegistration(\n noteTimelineAgent,\n {\n getNotes: () =>\n visible.map((note) => ({\n id: note.id,\n pinned: !!note.pinned,\n flagged: !!note.flagged,\n clinical: !!note.clinical,\n })),\n getVisibleCount: () => visible.length,\n },\n id,\n );\n\n // First read only: a refresh keeps the notes it has and marks them busy.\n if (loading && visible.length === 0) {\n return (\n <div\n ref={ref}\n data-component=\"note-timeline\"\n data-component-id={id}\n data-loading=\"\"\n aria-busy=\"true\"\n className={['ds:flex ds:flex-col', className ?? ''].join(' ').trim()}\n {...rest}\n >\n {Array.from({ length: Math.max(1, loadingRows) }, (_, index) => (\n <div key={index} aria-hidden=\"true\" className={rowVariants()}>\n <div className=\"ds:flex ds:w-12 ds:shrink-0 ds:flex-col ds:items-end ds:gap-[var(--spacing-2xs)] ds:pt-px\">\n <Skeleton\n variant=\"text\"\n size=\"sm\"\n stagger={index * 2}\n width=\"80%\"\n />\n <Skeleton\n variant=\"text\"\n size=\"sm\"\n stagger={index * 2}\n width=\"50%\"\n />\n </div>\n <div\n className={[\n 'ds:relative ds:w-[9px] ds:shrink-0',\n 'ds:before:absolute ds:before:start-[4px] ds:before:top-[14px]',\n 'ds:before:bottom-[-12px] ds:before:w-px',\n 'ds:before:bg-[color:var(--border)] ds:before:content-[\"\"]',\n 'ds:group-last/note-row:before:hidden',\n ].join(' ')}\n >\n <span className={dotVariants({ tone: 'default' })} />\n </div>\n <div className=\"ds:min-w-0 ds:flex-1\">\n <Skeleton\n variant=\"text\"\n size=\"sm\"\n lines={index % 2 === 0 ? 3 : 2}\n stagger={index * 2 + 1}\n />\n </div>\n </div>\n ))}\n </div>\n );\n }\n\n if (visible.length === 0) {\n return (\n <div\n ref={ref}\n data-component=\"note-timeline\"\n data-component-id={id}\n data-empty=\"\"\n className={className}\n {...rest}\n >\n {emptyState}\n </div>\n );\n }\n\n return (\n <div\n ref={setRef}\n data-component=\"note-timeline\"\n data-component-id={id}\n role=\"list\"\n aria-busy={loading || undefined}\n aria-label={ariaLabel ?? t('noteTimeline.regionLabel')}\n className={['ds:flex ds:flex-col', enterClass, className ?? '']\n .join(' ')\n .trim()}\n {...rest}\n >\n {visible.map((note) => {\n const date = new Date(note.dateIso);\n const tone = note.pinned\n ? ('pinned' as const)\n : note.flagged\n ? ('flagged' as const)\n : ('default' as const);\n const html =\n note.contentFormat === 'html'\n ? note.content\n : noteMarkdownToHtml(note.content);\n const canActivate = Boolean(onNoteActivate && note.id);\n\n return (\n <div\n key={note.id ?? note.dateIso}\n role=\"listitem\"\n /* id ONLY. Body, author and dates are PHI and never reach an\n attribute, where a DOM scrape or a screenshot would carry\n them out of the component. */\n data-note-id={note.id}\n data-pinned={note.pinned ? '' : undefined}\n data-flagged={note.flagged ? '' : undefined}\n className={rowVariants()}\n >\n {canActivate ? (\n <button\n type=\"button\"\n className={overlayButtonClass}\n aria-label={t('noteTimeline.openNote', {\n date: stamp(note.dateIso),\n defaultValue: 'Open note · {{date}}',\n })}\n onClick={() => onNoteActivate?.(note.id as string)}\n />\n ) : null}\n {/* 1 — date gutter */}\n {/* Sized from the --type-meta-size ROLE token, not the raw\n --font-size-2xs ramp step: `.theme-accessible` scales type by\n re-pointing the role aliases (meta xs → sm), so a raw ramp\n value would stay 10px for exactly the readers who asked for\n bigger text. The token rather than the `type-meta` CLASS,\n because that class also sets transform / weight / tracking\n and would quietly flatten the gutter's own treatment. */}\n <div className=\"ds:w-12 ds:shrink-0 ds:pt-px ds:text-end ds:text-[length:var(--type-meta-size)] ds:leading-[1.3]\">\n <div className=\"ds:font-semibold ds:tracking-[0.03em] ds:uppercase\">\n {fmt.dayMonth.format(date)}\n </div>\n <div className=\"ds:text-[color:var(--muted-foreground)]\">\n {fmt.year.format(date)}\n </div>\n </div>\n\n {/* 2 — rail: dot over the connector. The connector is a\n pseudo-element so it never lands in the a11y tree, and it is\n hidden on the last row rather than dangling into nothing. */}\n <div\n aria-hidden=\"true\"\n className={[\n 'ds:relative ds:w-[9px] ds:shrink-0',\n 'ds:before:absolute ds:before:start-[4px] ds:before:top-[14px]',\n 'ds:before:bottom-[-12px] ds:before:w-px',\n 'ds:before:bg-[color:var(--border)] ds:before:content-[\"\"]',\n 'ds:group-last/note-row:before:hidden',\n ].join(' ')}\n >\n <span className={dotVariants({ tone })} />\n </div>\n\n {/* 3 — body + byline */}\n <div className=\"ds:min-w-0 ds:flex-1\">\n <SafeHtml\n html={html}\n profile={\n note.contentFormat === 'html' ? 'rich-text' : 'markdown'\n }\n className={bodyVariants({ lines })}\n />\n {note.author ||\n note.pinned ||\n note.flagged ||\n note.attachedTo ? (\n <div className=\"ds:mt-[var(--spacing-2xs)] ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-2xs)] type-meta ds:text-[color:var(--muted-foreground)]\">\n {note.author ? <span>{note.author.name}</span> : null}\n {note.pinned ? (\n <span className=\"ds:inline-flex ds:items-center\">\n <Pin\n aria-hidden=\"true\"\n className=\"ds:size-3 ds:text-[color:var(--accent)]\"\n />\n <span className=\"ds:sr-only\">\n {t('noteTimeline.pinned')}\n </span>\n </span>\n ) : null}\n {note.flagged ? (\n <span className=\"ds:inline-flex ds:items-center\">\n <Flag\n aria-hidden=\"true\"\n className=\"ds:size-3 ds:text-[color:var(--warning-readable)]\"\n />\n <span className=\"ds:sr-only\">\n {t('noteTimeline.flagged')}\n </span>\n </span>\n ) : null}\n <NoteAttachmentChip attachedTo={note.attachedTo} />\n </div>\n ) : null}\n </div>\n </div>\n );\n })}\n </div>\n );\n },\n);\n\nNoteTimeline.displayName = 'NoteTimeline';\n"],"names":["noteTimelineAgent","handle","rowVariants","cva","bodyVariants","dotVariants","sortNotes","notes","a","b","overlayButtonClass","NoteTimeline","forwardRef","id","maxItems","lines","locale","emptyState","ariaLabel","loading","loadingRows","className","onNoteActivate","rest","ref","t","i18n","useTranslation","resolvedLocale","stamp","useMemo","isoDate","followedLoading","useRef","enterClass","CONTENT_ENTER_CLASS","visible","rootRef","setRef","node","useEffect","_a","fmt","useAgentRegistration","note","jsx","_","index","jsxs","Skeleton","date","tone","html","noteMarkdownToHtml","canActivate","SafeHtml","Pin","Flag","NoteAttachmentChip"],"mappings":";;;;;;;;AAcO,MAAMA,IAAsD;AAAA,EACjE,IAAI;AAAA,EACJ,cAAc,CAAA;AAAA,EACd,OAAO;AAAA,IACL,OAAO;AAAA,MACL,M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AAAA,0BACZ,WAAU;AAAA,wBAAA;AAAA,sBAAA;AAAA,wCAEX,QAAA,EAAK,WAAU,cACb,UAAAhC,EAAE,sBAAsB,EAAA,CAC3B;AAAA,oBAAA,EAAA,CACF,IACE;AAAA,oBACJ,gBAAAoB,EAACa,GAAA,EAAmB,YAAYd,EAAK,WAAA,CAAY;AAAA,kBAAA,EAAA,CACnD,IACE;AAAA,gBAAA,EAAA,CACN;AAAA,cAAA;AAAA,YAAA;AAAA,YA9FKA,EAAK,MAAMA,EAAK;AAAA,UAAA;AAAA,QAiG3B,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAjC,EAAa,cAAc;"}
|
|
@@ -4,7 +4,7 @@ import { c as Et } from "./index-D2ZczOXr.js";
|
|
|
4
4
|
import { useTranslation as kn } from "react-i18next";
|
|
5
5
|
import { g as mt, h as Rt } from "./handled-rejection-6gqCf5vt.js";
|
|
6
6
|
import { u as zn } from "./registry-DvAUVLHh.js";
|
|
7
|
-
import { C as Hn } from "./clinical-note-card-
|
|
7
|
+
import { C as Hn } from "./clinical-note-card-D2bbWksq.js";
|
|
8
8
|
import { R as Mn } from "./rich-text-editor-M2gT_E7f.js";
|
|
9
9
|
import { T as Wn } from "./text-area-COMVJ1yE.js";
|
|
10
10
|
import { A as j } from "./alert-DdDpOi-P.js";
|
|
@@ -1109,4 +1109,4 @@ const jr = qn(
|
|
|
1109
1109
|
export {
|
|
1110
1110
|
jr as N
|
|
1111
1111
|
};
|
|
1112
|
-
//# sourceMappingURL=notes-panel-
|
|
1112
|
+
//# sourceMappingURL=notes-panel-BRLc2ozF.js.map
|