@alfadocs/ui-kit-debug 1.0.0 → 1.1.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/{actions-cell-renderer-DaL80uqL.js → actions-cell-renderer-ClGCSQnA.js} +600 -565
- package/dist/_chunks/actions-cell-renderer-ClGCSQnA.js.map +1 -0
- package/dist/_chunks/{ai-consent-banner-BXD7W6FI.js → ai-consent-banner-DKgFfSzc.js} +2 -2
- package/dist/_chunks/{ai-consent-banner-BXD7W6FI.js.map → ai-consent-banner-DKgFfSzc.js.map} +1 -1
- package/dist/_chunks/{alert-Cxaqd-QO.js → alert-DS22ha1n.js} +103 -98
- package/dist/_chunks/alert-DS22ha1n.js.map +1 -0
- package/dist/_chunks/{annotation-marker-qt5R9WZX.js → annotation-marker-CsUJGZjQ.js} +7 -5
- package/dist/_chunks/annotation-marker-CsUJGZjQ.js.map +1 -0
- package/dist/_chunks/{audio-recorder-BjnB7V8n.js → audio-recorder-sRsGS-0V.js} +2 -2
- package/dist/_chunks/{audio-recorder-BjnB7V8n.js.map → audio-recorder-sRsGS-0V.js.map} +1 -1
- package/dist/_chunks/{booking-DSOK-bnR.js → booking-D8fCzcUd.js} +2 -2
- package/dist/_chunks/{booking-DSOK-bnR.js.map → booking-D8fCzcUd.js.map} +1 -1
- package/dist/_chunks/{care-plan-card-BrwhyIJI.js → care-plan-card-DjjVnBYz.js} +2 -2
- package/dist/_chunks/{care-plan-card-BrwhyIJI.js.map → care-plan-card-DjjVnBYz.js.map} +1 -1
- package/dist/_chunks/{care-plan-entry-card-DWEdCQM3.js → care-plan-entry-card-BVhpvd-P.js} +2 -2
- package/dist/_chunks/{care-plan-entry-card-DWEdCQM3.js.map → care-plan-entry-card-BVhpvd-P.js.map} +1 -1
- package/dist/_chunks/{collapsible-BrnRiCC6.js → collapsible-CGL9ontS.js} +65 -61
- package/dist/_chunks/collapsible-CGL9ontS.js.map +1 -0
- package/dist/_chunks/{document-preview-DXsCEj4U.js → document-preview-DAczwybt.js} +2 -2
- package/dist/_chunks/{document-preview-DXsCEj4U.js.map → document-preview-DAczwybt.js.map} +1 -1
- package/dist/_chunks/{document-scanner-cS_ispQs.js → document-scanner-BRYIc3A-.js} +2 -2
- package/dist/_chunks/{document-scanner-cS_ispQs.js.map → document-scanner-BRYIc3A-.js.map} +1 -1
- package/dist/_chunks/{entity-summary-BILN4wEG.js → entity-summary-BS6n7Iah.js} +2 -2
- package/dist/_chunks/{entity-summary-BILN4wEG.js.map → entity-summary-BS6n7Iah.js.map} +1 -1
- package/dist/_chunks/{face-scheme-CjQAHvSP.js → face-scheme-Cou2efl7.js} +2 -2
- package/dist/_chunks/{face-scheme-CjQAHvSP.js.map → face-scheme-Cou2efl7.js.map} +1 -1
- package/dist/_chunks/{file-manager-B9LZzT5E.js → file-manager-CNSLiuLo.js} +2 -2
- package/dist/_chunks/{file-manager-B9LZzT5E.js.map → file-manager-CNSLiuLo.js.map} +1 -1
- package/dist/_chunks/{freemium-paywall-Dr2342_S.js → freemium-paywall-DsT7MaLd.js} +2 -2
- package/dist/_chunks/{freemium-paywall-Dr2342_S.js.map → freemium-paywall-DsT7MaLd.js.map} +1 -1
- package/dist/_chunks/link-cell-renderer-_DlEZHLI.js +772 -0
- package/dist/_chunks/link-cell-renderer-_DlEZHLI.js.map +1 -0
- package/dist/_chunks/{marketplace-app-shell-pCHBp8bo.js → marketplace-app-shell-DQC9Gpm0.js} +2 -2
- package/dist/_chunks/{marketplace-app-shell-pCHBp8bo.js.map → marketplace-app-shell-DQC9Gpm0.js.map} +1 -1
- package/dist/_chunks/{muscle-scheme-kgCX5qfO.js → muscle-scheme-yfzP_xoJ.js} +2 -2
- package/dist/_chunks/{muscle-scheme-kgCX5qfO.js.map → muscle-scheme-yfzP_xoJ.js.map} +1 -1
- package/dist/_chunks/{patient-details-UmNcxL0c.js → patient-details-l7pnsUq9.js} +2 -2
- package/dist/_chunks/{patient-details-UmNcxL0c.js.map → patient-details-l7pnsUq9.js.map} +1 -1
- package/dist/_chunks/{patient-search-vtRTSdf6.js → patient-search-H54Utav2.js} +2 -2
- package/dist/_chunks/{patient-search-vtRTSdf6.js.map → patient-search-H54Utav2.js.map} +1 -1
- package/dist/_chunks/{patient-table-QEVsFvwq.js → patient-table-DXk0wW8Q.js} +243 -239
- package/dist/_chunks/patient-table-DXk0wW8Q.js.map +1 -0
- package/dist/_chunks/payment-automation-upsell-C4LIw1iQ.js +305 -0
- package/dist/_chunks/payment-automation-upsell-C4LIw1iQ.js.map +1 -0
- package/dist/_chunks/{payment-form-BoGxEmGn.js → payment-form-CyKT20xZ.js} +2 -2
- package/dist/_chunks/{payment-form-BoGxEmGn.js.map → payment-form-CyKT20xZ.js.map} +1 -1
- package/dist/_chunks/{payment-request-card-CygO1anM.js → payment-request-card-CN30J6yM.js} +107 -138
- package/dist/_chunks/payment-request-card-CN30J6yM.js.map +1 -0
- package/dist/_chunks/{pdf-viewer-CcOuR2wj.js → pdf-viewer-DHg8SfUI.js} +2 -2
- package/dist/_chunks/{pdf-viewer-CcOuR2wj.js.map → pdf-viewer-DHg8SfUI.js.map} +1 -1
- package/dist/_chunks/{practice-results-yKbwIxqa.js → practice-results-qvJRkvLn.js} +2 -2
- package/dist/_chunks/{practice-results-yKbwIxqa.js.map → practice-results-qvJRkvLn.js.map} +1 -1
- package/dist/_chunks/receipt-euro-C6k4Gzhr.js +36 -0
- package/dist/_chunks/receipt-euro-C6k4Gzhr.js.map +1 -0
- package/dist/_chunks/{reviews-panel-DmOjvmyH.js → reviews-panel-BfUJhx3m.js} +2 -2
- package/dist/_chunks/{reviews-panel-DmOjvmyH.js.map → reviews-panel-BfUJhx3m.js.map} +1 -1
- package/dist/_chunks/{sign-document-cH9CboWB.js → sign-document-D70TEUw9.js} +2 -2
- package/dist/_chunks/{sign-document-cH9CboWB.js.map → sign-document-D70TEUw9.js.map} +1 -1
- package/dist/_chunks/{signature-request-BzXTV_RH.js → signature-request-BlNCXpRN.js} +2 -2
- package/dist/_chunks/{signature-request-BzXTV_RH.js.map → signature-request-BlNCXpRN.js.map} +1 -1
- package/dist/_chunks/sparkline-DLq7xwic.js +394 -0
- package/dist/_chunks/sparkline-DLq7xwic.js.map +1 -0
- package/dist/_chunks/{warning-stack-DKeAfj5M.js → warning-stack-IVf0oxh2.js} +2 -2
- package/dist/_chunks/{warning-stack-DKeAfj5M.js.map → warning-stack-IVf0oxh2.js.map} +1 -1
- package/dist/_chunks/{workflow-map-SIfAhmWz.js → workflow-map-ByyBYj6Y.js} +2 -2
- package/dist/_chunks/{workflow-map-SIfAhmWz.js.map → workflow-map-ByyBYj6Y.js.map} +1 -1
- package/dist/agent-catalog.json +211 -7
- package/dist/agent-i18n/en.json +13 -3
- package/dist/components/ai-consent-banner/index.js +1 -1
- package/dist/components/alert/alert.d.ts +20 -0
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.d.ts +1 -1
- package/dist/components/alert/index.d.ts.map +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/annotation-marker/annotation-marker.d.ts.map +1 -1
- package/dist/components/annotation-marker/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/care-plan-card/index.js +1 -1
- package/dist/components/care-plan-entry-card/index.js +1 -1
- package/dist/components/collapsible/collapsible.d.ts.map +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/filters/select-filter.d.ts +6 -0
- package/dist/components/data-table/filters/select-filter.d.ts.map +1 -1
- package/dist/components/data-table/hooks/use-presentational-aria-fix.d.ts +19 -0
- package/dist/components/data-table/hooks/use-presentational-aria-fix.d.ts.map +1 -0
- package/dist/components/data-table/index.js +2 -2
- package/dist/components/document-preview/index.js +1 -1
- package/dist/components/document-scanner/index.js +1 -1
- package/dist/components/entity-summary/index.js +1 -1
- package/dist/components/face-scheme/index.js +1 -1
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/muscle-scheme/index.js +1 -1
- package/dist/components/patient-details/index.js +1 -1
- package/dist/components/patient-search/index.js +1 -1
- package/dist/components/patient-table/columns.d.ts.map +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/payment-card/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/reviews-panel/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/skeleton-scheme/index.js +1 -1
- package/dist/components/sparkline/index.d.ts +1 -1
- package/dist/components/sparkline/index.d.ts.map +1 -1
- package/dist/components/sparkline/index.js +1 -1
- package/dist/components/sparkline/sparkline.d.ts +36 -3
- package/dist/components/sparkline/sparkline.d.ts.map +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/host-compat.css +10 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +1 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +1 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +1 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +1 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +1 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +1 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +1 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +1 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +1 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +1 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +1 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +1 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +1 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +1 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +1 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +1 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +1 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +974 -1268
- package/dist/index.js.map +1 -1
- package/dist/locales/ar.json +1 -0
- package/dist/locales/de.json +1 -0
- package/dist/locales/el.json +1 -0
- package/dist/locales/en.json +1 -0
- package/dist/locales/es.json +1 -0
- package/dist/locales/fr.json +1 -0
- package/dist/locales/hi.json +1 -0
- package/dist/locales/it.json +1 -0
- package/dist/locales/ja.json +1 -0
- package/dist/locales/nl.json +1 -0
- package/dist/locales/pl.json +1 -0
- package/dist/locales/pt.json +1 -0
- package/dist/locales/ro.json +1 -0
- package/dist/locales/ru.json +1 -0
- package/dist/locales/sq.json +1 -0
- package/dist/locales/sv.json +1 -0
- package/dist/locales/tr.json +1 -0
- package/dist/locales/zh.json +1 -0
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/payment-automation-upsell/index.js +5 -0
- package/dist/patterns/payment-automation-upsell/index.js.map +1 -0
- package/dist/patterns/signature-request/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +5 -1
- package/dist/_chunks/actions-cell-renderer-DaL80uqL.js.map +0 -1
- package/dist/_chunks/alert-Cxaqd-QO.js.map +0 -1
- package/dist/_chunks/annotation-marker-qt5R9WZX.js.map +0 -1
- package/dist/_chunks/collapsible-BrnRiCC6.js.map +0 -1
- package/dist/_chunks/link-cell-renderer-Bt-mXeQY.js +0 -728
- package/dist/_chunks/link-cell-renderer-Bt-mXeQY.js.map +0 -1
- package/dist/_chunks/patient-table-QEVsFvwq.js.map +0 -1
- package/dist/_chunks/payment-request-card-CygO1anM.js.map +0 -1
- package/dist/_chunks/sparkline-DcXqRZoq.js +0 -283
- package/dist/_chunks/sparkline-DcXqRZoq.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payment-request-card-CygO1anM.js","sources":["../../node_modules/lucide-react/dist/esm/icons/credit-card.mjs","../../node_modules/lucide-react/dist/esm/icons/receipt-euro.mjs","../../src/components/payment-card/payment-card.agent.ts","../../src/components/payment-card/payment-card.tsx","../../src/components/payment-card/payment-request-card.agent.ts","../../src/components/payment-card/payment-request-card.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.22.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"rect\", { width: \"20\", height: \"14\", x: \"2\", y: \"5\", rx: \"2\", key: \"ynyp8z\" }],\n [\"line\", { x1: \"2\", x2: \"22\", y1: \"10\", y2: \"10\", key: \"1b3vmo\" }]\n];\nconst CreditCard = createLucideIcon(\"credit-card\", __iconNode);\n\nexport { __iconNode, CreditCard as default };\n//# sourceMappingURL=credit-card.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 [\n \"path\",\n { d: \"M15.828 14.829a4 4 0 0 1-5.656 0 4 4 0 0 1 0-5.657 4 4 0 0 1 5.656 0\", key: \"16zdw4\" }\n ],\n [\n \"path\",\n {\n d: \"M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z\",\n key: \"ycz6yz\"\n }\n ],\n [\"path\", { d: \"M8 12h5\", key: \"1g6qi8\" }]\n];\nconst ReceiptEuro = createLucideIcon(\"receipt-euro\", __iconNode);\n\nexport { __iconNode, ReceiptEuro as default };\n//# sourceMappingURL=receipt-euro.mjs.map\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — PaymentCard. */\n/* */\n/* Read-only financial-record surface. Exposes the payment number */\n/* (identifier) and the resolved headline state (structural) — never */\n/* patient / operator names or any other PHI. No actions: the card is a */\n/* passive presentation surface. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { PaymentCardHandle } from './payment-card';\n\nexport const paymentCardAgent: AgentAdapter<PaymentCardHandle> = {\n id: 'payment-card',\n capabilities: [],\n state: {\n number: {\n type: 'string',\n descriptionKey: 'ui.agent.paymentCard.state.number',\n description: 'Payment number / reference currently rendered.',\n read: (handle) => handle.getNumber(),\n },\n state: {\n type: \"'debt' | 'to-invoice' | 'settled'\",\n descriptionKey: 'ui.agent.paymentCard.state.state',\n description:\n 'Resolved headline financial state. Structural state only — never patient identity.',\n read: (handle) => handle.getState(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'payment-card',\n description: 'Marks the PaymentCard root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop. Addresses a specific card.',\n },\n },\n};\n","import {\n forwardRef,\n useId,\n useMemo,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport {\n ArrowDownLeft,\n ArrowUpRight,\n CalendarDays,\n FileText,\n Hash,\n ReceiptEuro,\n User,\n UserCog,\n} from 'lucide-react';\nimport { Badge } from '../badge/badge';\nimport { Card } from '../card/card';\nimport { DescriptionList } from '../description-list/description-list';\nimport { KeyValueList, KeyValuePair } from '../key-value-pair/key-value-pair';\nimport { TransactionChip } from '../transaction-chip/transaction-chip';\nimport { entitySurfaceVariants } from '../_shared/entity-card';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { paymentCardAgent } from './payment-card.agent';\n\n/* -------------------------------------------------------------------- */\n/* PaymentCard */\n/* */\n/* Financial-record card for a single payment / receipt. Replaces the */\n/* hand-rolled \"Pagamento\" / payment-row cards that the platform's */\n/* care-plan and patient-ledger surfaces compose today. Composes */\n/* TransactionChip (the settled/debt/to-invoice headline) + KeyValueList */\n/* (number, date, type, direction, relations) + DescriptionList (line */\n/* items) + Badge (the payment type). */\n/* */\n/* The component owns the ORDER, ICONS, and LABELS; the consumer passes */\n/* the data. Every visible string flows through `useTranslation('ui')` */\n/* against the `paymentCard.*` namespace. The agent state slot exposes */\n/* identifiers + structural state only — never patient names. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* Vocabulary */\n/* -------------------------------------------------------------------- */\n\n/** Payment type → translation-key segment + Badge variant. */\nexport type PaymentType = 'full' | 'partial' | 'credit' | 'proforma' | 'other';\n\nexport type PaymentDirection = 'incoming' | 'outgoing';\n\ntype BadgeVariant = NonNullable<\n ComponentPropsWithoutRef<typeof Badge>['variant']\n>;\n\nconst PAYMENT_TYPE_BADGE = {\n full: 'success',\n partial: 'warning',\n credit: 'info',\n proforma: 'neutral',\n other: 'neutral',\n} as const satisfies Record<PaymentType, BadgeVariant>;\n\nconst DEFAULT_CURRENCY = 'EUR';\n\n// Inline English fallbacks — belt-and-braces only. The canonical keys\n// live in the locale bundle (`ui.paymentCard.*`); these guard against a\n// stale / not-yet-wired bundle so the card never renders a raw key.\nconst TYPE_DEFAULTS: Record<PaymentType, string> = {\n full: 'Full payment',\n partial: 'Partial payment',\n credit: 'Credit note',\n proforma: 'Proforma',\n other: 'Other',\n};\n\nconst DIRECTION_DEFAULTS: Record<PaymentDirection, string> = {\n incoming: 'Incoming',\n outgoing: 'Outgoing',\n};\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva('ds:w-full ds:text-[color:var(--foreground)]', {\n variants: {\n surface: {\n flat: '',\n elevated: '',\n },\n },\n defaultVariants: { surface: 'elevated' },\n});\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\nexport interface PaymentLineItem {\n /** Human-readable description of the line. */\n description: string;\n /** Amount in the smallest currency unit (cents / centesimi). */\n amountCents: number;\n /** Optional VAT percentage (e.g. `22` for 22%). */\n vatPercentage?: number;\n}\n\nexport interface PaymentCardRelations {\n /** Care-plan / treatment-plan number this payment belongs to. */\n carePlanNumber?: string;\n /** Patient display name — rendered, but never exposed to the agent. */\n patientName?: string;\n /** Operator display name — rendered, but never exposed to the agent. */\n operatorName?: string;\n}\n\nexport interface PaymentCardHandle {\n /** Stable payment number currently rendered. Identifier only — no PHI. */\n getNumber: () => string;\n /** Resolved headline financial state. Structural state only. */\n getState: () => TransactionStateValue;\n}\n\n/** The TransactionChip state this card resolves the payment to. */\ntype TransactionStateValue = 'debt' | 'to-invoice' | 'settled';\n\nexport interface PaymentCardProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'aria-label' | 'children'\n> {\n /** Agent-readiness consumer id, surfaced as `data-component-id`. */\n id?: string;\n /** Human-readable payment number / reference. Rendered as the heading. */\n number: string;\n /** ISO-8601 date string for the payment date. */\n dateIso?: string;\n /** Payment type — drives the type Badge + label. */\n type: PaymentType;\n /** Money flow direction — incoming (patient → practice) or outgoing. */\n direction: PaymentDirection;\n /** Gross total in the smallest currency unit (cents). */\n grossCents?: number;\n /** Amount already paid, in cents. */\n paidCents?: number;\n /** Amount still outstanding, in cents. */\n unpaidCents?: number;\n /** Marks the record as written-off — renders a neutral chip. */\n writtenOff?: boolean;\n /** Linked entities (care plan / patient / operator). */\n relations?: PaymentCardRelations;\n /** Itemised breakdown rendered as a DescriptionList. */\n lineItems?: PaymentLineItem[];\n /** BCP-47 locale override. Falls back to the active i18next language. */\n locale?: string;\n /** ISO-4217 currency code. Defaults to `EUR`. */\n currency?: string;\n\n /* ----- Styling ----- */\n\n /**\n * `'elevated'` (default) wraps in `<Card variant=\"elevated\">`. `'flat'`\n * drops the Card — use inside an existing card / sheet.\n */\n surface?: 'flat' | 'elevated';\n\n /* ----- a11y ----- */\n\n /** Override the default region aria-label. */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Helpers */\n/* -------------------------------------------------------------------- */\n\n/** Format cents → currency string for the consumer's locale. */\nfunction formatMoney(cents: number, currency: string, locale: string): string {\n try {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n }).format(cents / 100);\n } catch {\n return (cents / 100).toFixed(2);\n }\n}\n\n/** Format an ISO date for the consumer's locale, gracefully degrading. */\nfunction formatDate(iso: string, locale: string): string {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return iso;\n try {\n return new Intl.DateTimeFormat(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n }).format(date);\n } catch {\n return iso;\n }\n}\n\n/**\n * Resolve the headline TransactionChip state from the paid / unpaid /\n * written-off inputs. Written-off → settled chip; an outstanding balance\n * → debt; a proforma with nothing paid → to-invoice; otherwise settled.\n */\nfunction resolveState(\n type: PaymentType,\n paidCents: number | undefined,\n unpaidCents: number | undefined,\n writtenOff: boolean | undefined,\n): TransactionStateValue {\n if (writtenOff) return 'settled';\n if (unpaidCents != null && unpaidCents > 0) return 'debt';\n if (type === 'proforma' && (paidCents == null || paidCents === 0)) {\n return 'to-invoice';\n }\n return 'settled';\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const PaymentCard = forwardRef<HTMLDivElement, PaymentCardProps>(\n (\n {\n id,\n number,\n dateIso,\n type,\n direction,\n grossCents,\n paidCents,\n unpaidCents,\n writtenOff = false,\n relations,\n lineItems,\n locale,\n currency = DEFAULT_CURRENCY,\n surface = 'elevated',\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const headingId = useId();\n const activeLocale = locale ?? i18n.language ?? 'en';\n\n const resolvedAriaLabel =\n ariaLabel ??\n t('paymentCard.regionLabel', {\n number,\n defaultValue: 'Payment {{number}}',\n });\n\n const state = resolveState(type, paidCents, unpaidCents, writtenOff);\n\n // The chip headline reflects the most informative figure: the\n // outstanding balance when there's a debt, otherwise the gross total.\n const chipAmountCents =\n state === 'debt' && unpaidCents != null\n ? unpaidCents\n : (grossCents ?? paidCents ?? unpaidCents ?? 0);\n\n useAgentRegistration(\n paymentCardAgent,\n {\n getNumber: () => number,\n getState: () => state,\n },\n id,\n );\n\n const typeLabel = t(`paymentCard.type.${type}`, {\n defaultValue: TYPE_DEFAULTS[type],\n });\n const directionIcon =\n direction === 'incoming' ? (\n <ArrowDownLeft aria-hidden=\"true\" />\n ) : (\n <ArrowUpRight aria-hidden=\"true\" />\n );\n const directionLabel = t(`paymentCard.direction.${direction}`, {\n defaultValue: DIRECTION_DEFAULTS[direction],\n });\n\n // Compose the metadata rows in display order. Omitting a field omits\n // the row — KeyValueList collapses the subgrid cleanly.\n const rows: Array<{\n key: string;\n icon: ReactNode;\n label: string;\n value: ReactNode;\n }> = [];\n\n rows.push({\n key: 'number',\n icon: <Hash aria-hidden=\"true\" />,\n label: t('paymentCard.label.number', 'Number'),\n value: number,\n });\n\n if (dateIso) {\n rows.push({\n key: 'date',\n icon: <CalendarDays aria-hidden=\"true\" />,\n label: t('paymentCard.label.date', 'Date'),\n value: formatDate(dateIso, activeLocale),\n });\n }\n\n rows.push({\n key: 'type',\n icon: <ReceiptEuro aria-hidden=\"true\" />,\n label: t('paymentCard.label.type', 'Type'),\n value: <Badge variant={PAYMENT_TYPE_BADGE[type]}>{typeLabel}</Badge>,\n });\n\n rows.push({\n key: 'direction',\n icon: directionIcon,\n label: t('paymentCard.label.direction', 'Direction'),\n value: directionLabel,\n });\n\n if (relations?.carePlanNumber) {\n rows.push({\n key: 'carePlan',\n icon: <FileText aria-hidden=\"true\" />,\n label: t('paymentCard.label.carePlan', 'Care plan'),\n value: relations.carePlanNumber,\n });\n }\n\n if (relations?.patientName) {\n rows.push({\n key: 'patient',\n icon: <User aria-hidden=\"true\" />,\n label: t('paymentCard.label.patient', 'Patient'),\n value: relations.patientName,\n });\n }\n\n if (relations?.operatorName) {\n rows.push({\n key: 'operator',\n icon: <UserCog aria-hidden=\"true\" />,\n label: t('paymentCard.label.operator', 'Operator'),\n value: relations.operatorName,\n });\n }\n\n const formattedGross = useMemo(\n () =>\n grossCents != null\n ? formatMoney(grossCents, currency, activeLocale)\n : undefined,\n [grossCents, currency, activeLocale],\n );\n const formattedPaid = useMemo(\n () =>\n paidCents != null\n ? formatMoney(paidCents, currency, activeLocale)\n : undefined,\n [paidCents, currency, activeLocale],\n );\n const formattedUnpaid = useMemo(\n () =>\n unpaidCents != null\n ? formatMoney(unpaidCents, currency, activeLocale)\n : undefined,\n [unpaidCents, currency, activeLocale],\n );\n\n const hasAmounts =\n formattedGross != null ||\n formattedPaid != null ||\n formattedUnpaid != null;\n\n const hasLineItems = !!lineItems && lineItems.length > 0;\n\n const inner = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Heading row — payment number + headline TransactionChip. */}\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-md)] ds:flex-wrap\">\n <h3\n id={headingId}\n className=\"type-title-card ds:m-0 ds:text-[color:var(--foreground)]\"\n >\n {t('paymentCard.heading', {\n number,\n defaultValue: 'Payment {{number}}',\n })}\n </h3>\n <span className=\"ds:ms-auto ds:shrink-0\">\n <TransactionChip\n state={state}\n amount={chipAmountCents / 100}\n currency={currency}\n locale={activeLocale}\n size=\"lg\"\n />\n </span>\n </div>\n\n {/* Metadata rows. */}\n <KeyValueList rowGap=\"sm\">\n {rows.map((row) => (\n <KeyValuePair\n key={row.key}\n icon={row.icon as React.ReactElement}\n label={row.label}\n value={row.value}\n />\n ))}\n </KeyValueList>\n\n {/* Amount summary — gross / paid / outstanding. */}\n {hasAmounts ? (\n <DescriptionList layout=\"inline\" density=\"compact\" labelWidth=\"fixed\">\n {formattedGross != null ? (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('paymentCard.label.gross', 'Gross total')}\n </DescriptionList.Term>\n <DescriptionList.Detail numeric>\n {formattedGross}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n ) : null}\n {formattedPaid != null ? (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('paymentCard.label.paid', 'Paid')}\n </DescriptionList.Term>\n <DescriptionList.Detail numeric>\n {formattedPaid}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n ) : null}\n {formattedUnpaid != null ? (\n <DescriptionList.Row>\n <DescriptionList.Term>\n {t('paymentCard.label.unpaid', 'Outstanding')}\n </DescriptionList.Term>\n <DescriptionList.Detail numeric>\n {formattedUnpaid}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n ) : null}\n </DescriptionList>\n ) : null}\n\n {/* Line items. */}\n {hasLineItems ? (\n <section\n aria-label={t('paymentCard.lineItems.heading', 'Line items')}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <h4 className=\"type-eyebrow ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {t('paymentCard.lineItems.heading', 'Line items')}\n </h4>\n <DescriptionList\n layout=\"inline\"\n density=\"compact\"\n labelWidth=\"auto\"\n >\n {lineItems!.map((item, index) => (\n <DescriptionList.Row key={`${item.description}-${index}`}>\n <DescriptionList.Term>\n {item.vatPercentage != null\n ? t('paymentCard.lineItems.withVat', {\n description: item.description,\n vat: item.vatPercentage,\n defaultValue: '{{description}} (VAT {{vat}}%)',\n })\n : item.description}\n </DescriptionList.Term>\n <DescriptionList.Detail numeric>\n {formatMoney(item.amountCents, currency, activeLocale)}\n </DescriptionList.Detail>\n </DescriptionList.Row>\n ))}\n </DescriptionList>\n </section>\n ) : null}\n </div>\n );\n\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={resolvedAriaLabel}\n aria-labelledby={headingId}\n data-component=\"payment-card\"\n data-component-id={id}\n data-state={state}\n data-type={type}\n data-direction={direction}\n id={id}\n className={rootVariants({ surface, className })}\n {...rest}\n >\n {surface === 'elevated' ? (\n <Card variant=\"elevated\">\n <Card.Body>{inner}</Card.Body>\n </Card>\n ) : (\n <div className={entitySurfaceVariants({ surface: 'flat' })}>\n {inner}\n </div>\n )}\n </div>\n );\n },\n);\n\nPaymentCard.displayName = 'PaymentCard';\n\nexport type PaymentCardSurface = NonNullable<\n VariantProps<typeof rootVariants>['surface']\n>;\n","/* -------------------------------------------------------------------- */\n/* Agent adapter — PaymentRequestCard. */\n/* */\n/* Read-only payment-request surface. Exposes the lifecycle status */\n/* (structural state) only — never any patient identity or the hosted */\n/* payment URL. No actions: navigation to the pay link is a user-driven */\n/* affordance, not an agent operation. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { PaymentRequestCardHandle } from './payment-request-card';\n\nexport const paymentRequestCardAgent: AgentAdapter<PaymentRequestCardHandle> = {\n id: 'payment-request-card',\n capabilities: [],\n state: {\n status: {\n type: \"'new' | 'authorization_requested' | 'authorized' | 'paid' | 'failed' | 'cancelled'\",\n descriptionKey: 'ui.agent.paymentRequestCard.state.status',\n description:\n 'Current lifecycle status of the payment request. Structural state only.',\n read: (handle) => handle.getStatus(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'payment-request-card',\n description: 'Marks the PaymentRequestCard root region.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Addresses a specific request card.',\n },\n },\n};\n","import {\n forwardRef,\n useId,\n type ComponentPropsWithoutRef,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { CalendarClock, CreditCard, FileText } from 'lucide-react';\nimport { Badge } from '../badge/badge';\nimport { Card } from '../card/card';\nimport { KeyValueList, KeyValuePair } from '../key-value-pair/key-value-pair';\nimport { Link } from '../link/link';\nimport { TransactionChip } from '../transaction-chip/transaction-chip';\nimport { entitySurfaceVariants, isSafeEntityUrl } from '../_shared/entity-card';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { paymentRequestCardAgent } from './payment-request-card.agent';\n\n/* -------------------------------------------------------------------- */\n/* PaymentRequestCard */\n/* */\n/* Companion to PaymentCard: a card for an *outstanding* payment request */\n/* (a Stripe / online-payment ask) rather than a recorded payment. Shows */\n/* the amount as a TransactionChip, the lifecycle status as a Badge, and */\n/* — when a safe `paymentUrl` is supplied — a \"Pay now\" Link. */\n/* */\n/* Every visible string flows through `useTranslation('ui')` against the */\n/* `paymentRequestCard.*` namespace. The agent state exposes the request */\n/* status (structural state) and never any patient identity. */\n/* -------------------------------------------------------------------- */\n\n/* -------------------------------------------------------------------- */\n/* Vocabulary */\n/* -------------------------------------------------------------------- */\n\nexport type PaymentRequestStatus =\n | 'new'\n | 'authorization_requested'\n | 'authorized'\n | 'paid'\n | 'failed'\n | 'cancelled';\n\ntype BadgeVariant = NonNullable<\n ComponentPropsWithoutRef<typeof Badge>['variant']\n>;\n\nconst STATUS_BADGE = {\n new: 'info',\n authorization_requested: 'warning',\n authorized: 'info',\n paid: 'success',\n failed: 'error',\n cancelled: 'neutral',\n} as const satisfies Record<PaymentRequestStatus, BadgeVariant>;\n\nconst DEFAULT_CURRENCY = 'EUR';\n\n// Inline English fallbacks — belt-and-braces only. The canonical keys\n// live in the locale bundle (`ui.paymentRequestCard.*`); these guard\n// against a stale / not-yet-wired bundle so the card never shows a key.\nconst STATUS_DEFAULTS: Record<PaymentRequestStatus, string> = {\n new: 'New',\n authorization_requested: 'Authorization requested',\n authorized: 'Authorized',\n paid: 'Paid',\n failed: 'Failed',\n cancelled: 'Cancelled',\n};\n\n/* -------------------------------------------------------------------- */\n/* CVA — root */\n/* -------------------------------------------------------------------- */\n\nconst rootVariants = cva('ds:w-full ds:text-[color:var(--foreground)]', {\n variants: {\n surface: {\n flat: '',\n elevated: '',\n },\n },\n defaultVariants: { surface: 'elevated' },\n});\n\n/* -------------------------------------------------------------------- */\n/* Public types */\n/* -------------------------------------------------------------------- */\n\nexport interface PaymentRequestCardHandle {\n /** Current lifecycle status. Structural state only — no PHI. */\n getStatus: () => PaymentRequestStatus;\n}\n\nexport interface PaymentRequestCardProps extends Omit<\n ComponentPropsWithoutRef<'div'>,\n 'aria-label' | 'children' | 'title'\n> {\n /** Agent-readiness consumer id, surfaced as `data-component-id`. */\n id?: string;\n /** Heading for the request. Falls back to a localised default. */\n title?: string;\n /** Optional supporting copy rendered beneath the heading. */\n description?: string;\n /** Requested amount in the smallest currency unit (cents). */\n amountCents: number;\n /** ISO-8601 due date. */\n dueDateIso?: string;\n /** Lifecycle status — drives the status Badge and pay-link gating. */\n status: PaymentRequestStatus;\n /** Hosted payment URL. Only rendered when it passes the URL allow-list. */\n paymentUrl?: string;\n /** Care-plan / treatment-plan number this request relates to. */\n carePlanNumber?: string;\n /** BCP-47 locale override. Falls back to the active i18next language. */\n locale?: string;\n /** ISO-4217 currency code. Defaults to `EUR`. */\n currency?: string;\n\n /* ----- Styling ----- */\n\n /**\n * `'elevated'` (default) wraps in `<Card variant=\"elevated\">`. `'flat'`\n * drops the Card — use inside an existing card / sheet.\n */\n surface?: 'flat' | 'elevated';\n\n /* ----- a11y ----- */\n\n /** Override the default region aria-label. */\n 'aria-label'?: string;\n}\n\n/* -------------------------------------------------------------------- */\n/* Helpers */\n/* -------------------------------------------------------------------- */\n\nfunction formatDate(iso: string, locale: string): string {\n const date = new Date(iso);\n if (Number.isNaN(date.getTime())) return iso;\n try {\n return new Intl.DateTimeFormat(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n }).format(date);\n } catch {\n return iso;\n }\n}\n\n/* -------------------------------------------------------------------- */\n/* Component */\n/* -------------------------------------------------------------------- */\n\nexport const PaymentRequestCard = forwardRef<\n HTMLDivElement,\n PaymentRequestCardProps\n>(\n (\n {\n id,\n title,\n description,\n amountCents,\n dueDateIso,\n status,\n paymentUrl,\n carePlanNumber,\n locale,\n currency = DEFAULT_CURRENCY,\n surface = 'elevated',\n 'aria-label': ariaLabel,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const headingId = useId();\n const activeLocale = locale ?? i18n.language ?? 'en';\n\n const resolvedTitle =\n title ?? t('paymentRequestCard.heading', 'Payment request');\n const resolvedAriaLabel = ariaLabel ?? resolvedTitle;\n\n useAgentRegistration(\n paymentRequestCardAgent,\n { getStatus: () => status },\n id,\n );\n\n const statusLabel = t(`paymentRequestCard.status.${status}`, {\n defaultValue: STATUS_DEFAULTS[status],\n });\n\n // A paid request settles; an open one is \"to-invoice\" (awaiting money);\n // anything terminal-but-unpaid renders as a debt.\n const chipState: 'to-invoice' | 'settled' | 'debt' =\n status === 'paid'\n ? 'settled'\n : status === 'failed' || status === 'cancelled'\n ? 'debt'\n : 'to-invoice';\n\n // The pay link only renders when the request is still actionable AND\n // the URL passes the shared card-family allow-list (no javascript:,\n // data:, protocol-relative). Otherwise the affordance is suppressed.\n const isActionable =\n status === 'new' ||\n status === 'authorization_requested' ||\n status === 'authorized';\n const showPayLink =\n isActionable && !!paymentUrl && isSafeEntityUrl(paymentUrl);\n\n const rows: Array<{\n key: string;\n icon: ReactNode;\n label: string;\n value: ReactNode;\n }> = [];\n\n rows.push({\n key: 'status',\n icon: <CreditCard aria-hidden=\"true\" />,\n label: t('paymentRequestCard.label.status', 'Status'),\n value: <Badge variant={STATUS_BADGE[status]}>{statusLabel}</Badge>,\n });\n\n if (dueDateIso) {\n rows.push({\n key: 'dueDate',\n icon: <CalendarClock aria-hidden=\"true\" />,\n label: t('paymentRequestCard.label.dueDate', 'Due date'),\n value: formatDate(dueDateIso, activeLocale),\n });\n }\n\n if (carePlanNumber) {\n rows.push({\n key: 'carePlan',\n icon: <FileText aria-hidden=\"true\" />,\n label: t('paymentRequestCard.label.carePlan', 'Care plan'),\n value: carePlanNumber,\n });\n }\n\n const inner = (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-md)]\">\n {/* Heading row — title + amount TransactionChip. */}\n <div className=\"ds:flex ds:items-start ds:gap-[var(--spacing-md)] ds:flex-wrap\">\n <div className=\"ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <h3\n id={headingId}\n className=\"type-title-card ds:m-0 ds:text-[color:var(--foreground)]\"\n >\n {resolvedTitle}\n </h3>\n {description ? (\n <p className=\"type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]\">\n {description}\n </p>\n ) : null}\n </div>\n <span className=\"ds:ms-auto ds:shrink-0\">\n <TransactionChip\n state={chipState}\n amount={amountCents / 100}\n currency={currency}\n locale={activeLocale}\n size=\"lg\"\n />\n </span>\n </div>\n\n {/* Metadata rows. */}\n <KeyValueList rowGap=\"sm\">\n {rows.map((row) => (\n <KeyValuePair\n key={row.key}\n icon={row.icon as React.ReactElement}\n label={row.label}\n value={row.value}\n />\n ))}\n </KeyValueList>\n\n {/* Pay affordance — only when actionable + the URL is safe. */}\n {showPayLink ? (\n <div className=\"ds:flex\">\n <Link href={paymentUrl!} external startIcon={<CreditCard />}>\n {t('paymentRequestCard.pay', 'Pay now')}\n </Link>\n </div>\n ) : null}\n </div>\n );\n\n return (\n <div\n ref={ref}\n role=\"region\"\n aria-label={resolvedAriaLabel}\n aria-labelledby={headingId}\n data-component=\"payment-request-card\"\n data-component-id={id}\n data-status={status}\n id={id}\n className={rootVariants({ surface, className })}\n {...rest}\n >\n {surface === 'elevated' ? (\n <Card variant=\"elevated\">\n <Card.Body>{inner}</Card.Body>\n </Card>\n ) : (\n <div className={entitySurfaceVariants({ surface: 'flat' })}>\n {inner}\n </div>\n )}\n </div>\n );\n },\n);\n\nPaymentRequestCard.displayName = 'PaymentRequestCard';\n\nexport type PaymentRequestCardSurface = NonNullable<\n VariantProps<typeof rootVariants>['surface']\n>;\n"],"names":["__iconNode","CreditCard","createLucideIcon","ReceiptEuro","paymentCardAgent","handle","PAYMENT_TYPE_BADGE","DEFAULT_CURRENCY","TYPE_DEFAULTS","DIRECTION_DEFAULTS","rootVariants","cva","formatMoney","cents","currency","locale","formatDate","iso","date","resolveState","type","paidCents","unpaidCents","writtenOff","PaymentCard","forwardRef","id","number","dateIso","direction","grossCents","relations","lineItems","surface","ariaLabel","className","rest","ref","i18n","useTranslation","headingId","useId","activeLocale","resolvedAriaLabel","state","chipAmountCents","useAgentRegistration","typeLabel","directionIcon","jsx","ArrowDownLeft","ArrowUpRight","directionLabel","rows","Hash","CalendarDays","Badge","FileText","User","UserCog","formattedGross","useMemo","formattedPaid","formattedUnpaid","hasAmounts","hasLineItems","inner","jsxs","TransactionChip","KeyValueList","row","KeyValuePair","DescriptionList","item","index","Card","entitySurfaceVariants","paymentRequestCardAgent","STATUS_BADGE","STATUS_DEFAULTS","PaymentRequestCard","title","description","amountCents","dueDateIso","status","paymentUrl","carePlanNumber","t","resolvedTitle","statusLabel","chipState","showPayLink","isSafeEntityUrl","CalendarClock","Link"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,OAAO,MAAM,QAAQ,MAAM,GAAG,KAAK,GAAG,KAAK,IAAI,KAAK,KAAK,SAAQ,CAAE;AAAA,EAC9E,CAAC,QAAQ,EAAE,IAAI,KAAK,IAAI,MAAM,IAA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A,QACb,IAAA3D;AAAA,QACA,WAAWhB,GAAa,EAAE,SAAAuB,GAAS,WAAAE,GAAW;AAAA,QAC7C,GAAGC;AAAA,QAEH,UAAAH,MAAY,aACX,gBAAAgB,EAAC0B,GAAA,EAAK,SAAQ,YACZ,UAAA,gBAAA1B,EAAC0B,EAAK,MAAL,EAAW,UAAAT,EAAA,CAAM,GACpB,IAEA,gBAAAjB,EAAC,SAAI,WAAW2B,EAAsB,EAAE,SAAS,OAAA,CAAQ,GACtD,UAAAV,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAc,GAAmB,cAAc;","x_google_ignoreList":[0,1]}
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { jsx as w, jsxs as F } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as G, useId as L, useMemo as v, useRef as K, useState as A, useEffect as H, useImperativeHandle as V } from "react";
|
|
3
|
-
import { c as Z } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { useTranslation as $ } from "react-i18next";
|
|
5
|
-
import q from "react-apexcharts";
|
|
6
|
-
import R from "apexcharts";
|
|
7
|
-
import { g as U, u as J } from "./apexcharts-theme-B_AxGC_h.js";
|
|
8
|
-
import { u as Q } from "./registry-DvAUVLHh.js";
|
|
9
|
-
function X(n) {
|
|
10
|
-
if (n.length < 2)
|
|
11
|
-
return { slope: 0, direction: "steady" };
|
|
12
|
-
const t = n.length, a = (t - 1) / 2, c = n.reduce((s, o) => s + o, 0) / t;
|
|
13
|
-
let i = 0, l = 0;
|
|
14
|
-
for (let s = 0; s < t; s++) {
|
|
15
|
-
const o = s - a;
|
|
16
|
-
i += o * (n[s] - c), l += o * o;
|
|
17
|
-
}
|
|
18
|
-
const d = l === 0 ? 0 : i / l, b = 0.01 * (Math.max(...n) - Math.min(...n) || 1), u = Math.abs(d) < b ? "steady" : d > 0 ? "increasing" : "decreasing";
|
|
19
|
-
return { slope: d, direction: u };
|
|
20
|
-
}
|
|
21
|
-
const Y = {
|
|
22
|
-
id: "sparkline",
|
|
23
|
-
capabilities: [],
|
|
24
|
-
state: {},
|
|
25
|
-
actions: {
|
|
26
|
-
update_series: {
|
|
27
|
-
// Replacing the rendered series mutates what the chart displays — write,
|
|
28
|
-
// not read.
|
|
29
|
-
safety: "write",
|
|
30
|
-
argsType: "{ data: number[] }",
|
|
31
|
-
argsSchema: {
|
|
32
|
-
type: "object",
|
|
33
|
-
properties: {
|
|
34
|
-
data: {
|
|
35
|
-
type: "array",
|
|
36
|
-
items: { type: "number" },
|
|
37
|
-
description: "The new data points to render."
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
required: ["data"]
|
|
41
|
-
},
|
|
42
|
-
idempotent: !0,
|
|
43
|
-
descriptionKey: "ui.agent.sparkline.actions.updateSeries",
|
|
44
|
-
description: "Replace the sparkline data without remounting.",
|
|
45
|
-
invoke: (n, t) => {
|
|
46
|
-
n.updateSeries(t.data);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
export_png: {
|
|
50
|
-
// Pure getter — returns an image of the current chart, no state change.
|
|
51
|
-
safety: "read",
|
|
52
|
-
returns: "string",
|
|
53
|
-
returnsSchema: {
|
|
54
|
-
type: "string",
|
|
55
|
-
description: "A PNG image of the sparkline encoded as a data URI."
|
|
56
|
-
},
|
|
57
|
-
descriptionKey: "ui.agent.sparkline.actions.exportPng",
|
|
58
|
-
description: "Return a PNG data URI of the sparkline.",
|
|
59
|
-
invoke: (n) => n.dataURI()
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
domHooks: {
|
|
63
|
-
root: { attr: "data-component", value: "sparkline" },
|
|
64
|
-
instanceId: {
|
|
65
|
-
attr: "data-component-id",
|
|
66
|
-
sourceProp: "id",
|
|
67
|
-
description: "Sourced from the id prop."
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}, D = Z("ds:relative ds:inline-block ds:w-full", {
|
|
71
|
-
variants: {
|
|
72
|
-
size: {
|
|
73
|
-
xs: "ds:h-6",
|
|
74
|
-
sm: "ds:h-8",
|
|
75
|
-
md: "ds:h-10",
|
|
76
|
-
// Applied when an explicit `height` prop is given: the wrapper
|
|
77
|
-
// grows with the svg instead of clipping at the size's fixed height.
|
|
78
|
-
auto: ""
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
defaultVariants: { size: "md" }
|
|
82
|
-
}), ee = {
|
|
83
|
-
increasing: "↑",
|
|
84
|
-
decreasing: "↓",
|
|
85
|
-
steady: "→"
|
|
86
|
-
}, te = {
|
|
87
|
-
xs: 24,
|
|
88
|
-
sm: 32,
|
|
89
|
-
md: 40
|
|
90
|
-
};
|
|
91
|
-
function re() {
|
|
92
|
-
return typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
93
|
-
}
|
|
94
|
-
const ne = G(
|
|
95
|
-
({
|
|
96
|
-
id: n,
|
|
97
|
-
data: t,
|
|
98
|
-
variant: a = "line",
|
|
99
|
-
size: c = "md",
|
|
100
|
-
label: i,
|
|
101
|
-
color: l,
|
|
102
|
-
showEndpoint: d = !1,
|
|
103
|
-
showTooltip: M = !1,
|
|
104
|
-
width: b,
|
|
105
|
-
height: u,
|
|
106
|
-
className: s,
|
|
107
|
-
...o
|
|
108
|
-
}, P) => {
|
|
109
|
-
var z;
|
|
110
|
-
const { t: p, i18n: C } = $(), S = L(), m = v(
|
|
111
|
-
() => `sparkline-${S.replace(/[^a-zA-Z0-9-_]/g, "")}`,
|
|
112
|
-
[S]
|
|
113
|
-
), h = K(null), [T, _] = A(0), { direction: k } = X(t), N = v(() => {
|
|
114
|
-
if (t.length === 0)
|
|
115
|
-
return p("sparkline.noData", "No data");
|
|
116
|
-
const e = (y) => new Intl.NumberFormat(C.language).format(y), r = p(`sparkline.direction.${k}`), g = {
|
|
117
|
-
min: e(Math.min(...t)),
|
|
118
|
-
max: e(Math.max(...t)),
|
|
119
|
-
current: e(t[t.length - 1]),
|
|
120
|
-
direction: r
|
|
121
|
-
};
|
|
122
|
-
return i ? p("sparkline.summary", { label: i, ...g }) : p("sparkline.summaryNoLabel", g);
|
|
123
|
-
}, [t, i, k, C.language, p]), [f, E] = A(
|
|
124
|
-
() => {
|
|
125
|
-
try {
|
|
126
|
-
return U();
|
|
127
|
-
} catch {
|
|
128
|
-
return {};
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
H(() => {
|
|
133
|
-
let e;
|
|
134
|
-
const r = new MutationObserver(() => {
|
|
135
|
-
clearTimeout(e), e = setTimeout(() => {
|
|
136
|
-
try {
|
|
137
|
-
E(U());
|
|
138
|
-
} catch {
|
|
139
|
-
}
|
|
140
|
-
}, 50);
|
|
141
|
-
});
|
|
142
|
-
return r.observe(document.documentElement, {
|
|
143
|
-
attributes: !0,
|
|
144
|
-
attributeFilter: ["class"]
|
|
145
|
-
}), () => {
|
|
146
|
-
clearTimeout(e), r.disconnect();
|
|
147
|
-
};
|
|
148
|
-
}, []), H(() => {
|
|
149
|
-
const e = h.current;
|
|
150
|
-
if (!e) return;
|
|
151
|
-
const r = new ResizeObserver((g) => {
|
|
152
|
-
const y = g[0];
|
|
153
|
-
y && _(Math.floor(y.contentRect.width));
|
|
154
|
-
});
|
|
155
|
-
return r.observe(e), () => r.disconnect();
|
|
156
|
-
}, []), J(h);
|
|
157
|
-
const x = v(
|
|
158
|
-
() => ({
|
|
159
|
-
updateSeries(e) {
|
|
160
|
-
var r;
|
|
161
|
-
(r = R.getChartByID(m)) == null || r.updateSeries([{ data: e }]);
|
|
162
|
-
},
|
|
163
|
-
updateOptions(e) {
|
|
164
|
-
var r;
|
|
165
|
-
(r = R.getChartByID(m)) == null || r.updateOptions(e);
|
|
166
|
-
},
|
|
167
|
-
async dataURI() {
|
|
168
|
-
const e = R.getChartByID(m);
|
|
169
|
-
return e ? (await e.dataURI()).imgURI : "";
|
|
170
|
-
}
|
|
171
|
-
}),
|
|
172
|
-
[m]
|
|
173
|
-
);
|
|
174
|
-
V(P, () => x, [x]), Q(Y, x, n);
|
|
175
|
-
const I = l ?? ((z = f.colors) == null ? void 0 : z[0]) ?? "currentColor";
|
|
176
|
-
if (t.length === 0)
|
|
177
|
-
return /* @__PURE__ */ w(
|
|
178
|
-
"div",
|
|
179
|
-
{
|
|
180
|
-
ref: h,
|
|
181
|
-
role: "img",
|
|
182
|
-
"aria-label": N,
|
|
183
|
-
dir: "ltr",
|
|
184
|
-
className: D({
|
|
185
|
-
size: u !== void 0 ? "auto" : c,
|
|
186
|
-
className: s
|
|
187
|
-
}),
|
|
188
|
-
...o
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
const O = re(), W = {
|
|
192
|
-
...f,
|
|
193
|
-
chart: {
|
|
194
|
-
...f.chart,
|
|
195
|
-
id: m,
|
|
196
|
-
type: a,
|
|
197
|
-
sparkline: { enabled: !0 },
|
|
198
|
-
toolbar: { show: !1 },
|
|
199
|
-
animations: {
|
|
200
|
-
enabled: !O,
|
|
201
|
-
dynamicAnimation: { enabled: !O }
|
|
202
|
-
},
|
|
203
|
-
zoom: { enabled: !1 },
|
|
204
|
-
parentHeightOffset: 0
|
|
205
|
-
},
|
|
206
|
-
colors: [I],
|
|
207
|
-
stroke: {
|
|
208
|
-
curve: "smooth",
|
|
209
|
-
width: a === "bar" ? 0 : 2
|
|
210
|
-
},
|
|
211
|
-
fill: {
|
|
212
|
-
opacity: a === "area" ? 0.15 : 1
|
|
213
|
-
},
|
|
214
|
-
xaxis: {
|
|
215
|
-
crosshairs: { show: !1 }
|
|
216
|
-
},
|
|
217
|
-
tooltip: { enabled: M },
|
|
218
|
-
markers: d ? {
|
|
219
|
-
size: [0],
|
|
220
|
-
discrete: [
|
|
221
|
-
{
|
|
222
|
-
seriesIndex: 0,
|
|
223
|
-
dataPointIndex: t.length - 1,
|
|
224
|
-
fillColor: I,
|
|
225
|
-
strokeColor: I,
|
|
226
|
-
size: 4
|
|
227
|
-
}
|
|
228
|
-
]
|
|
229
|
-
} : { size: 0 },
|
|
230
|
-
grid: {
|
|
231
|
-
...f.grid,
|
|
232
|
-
show: !1,
|
|
233
|
-
// ApexCharts grid.padding uses physical keys (not CSS logical properties).
|
|
234
|
-
// The chart wrapper enforces dir="ltr" so these always resolve correctly.
|
|
235
|
-
padding: { top: 2, right: 2, bottom: 2, left: 2 }
|
|
236
|
-
}
|
|
237
|
-
}, j = b ?? (T > 0 ? T : "100%"), B = u ?? te[c ?? "md"];
|
|
238
|
-
return /* @__PURE__ */ F(
|
|
239
|
-
"div",
|
|
240
|
-
{
|
|
241
|
-
ref: h,
|
|
242
|
-
role: "img",
|
|
243
|
-
"aria-label": N,
|
|
244
|
-
dir: "ltr",
|
|
245
|
-
className: D({
|
|
246
|
-
size: u !== void 0 ? "auto" : c,
|
|
247
|
-
className: s
|
|
248
|
-
}),
|
|
249
|
-
"data-component": "sparkline",
|
|
250
|
-
"data-component-id": n,
|
|
251
|
-
...o,
|
|
252
|
-
children: [
|
|
253
|
-
/* @__PURE__ */ w(
|
|
254
|
-
q,
|
|
255
|
-
{
|
|
256
|
-
type: a,
|
|
257
|
-
series: [{ data: t }],
|
|
258
|
-
options: W,
|
|
259
|
-
width: j,
|
|
260
|
-
height: B,
|
|
261
|
-
"aria-hidden": "true"
|
|
262
|
-
}
|
|
263
|
-
),
|
|
264
|
-
d && /* @__PURE__ */ w(
|
|
265
|
-
"span",
|
|
266
|
-
{
|
|
267
|
-
"aria-hidden": "true",
|
|
268
|
-
className: "ds:pointer-events-none ds:absolute ds:end-0 ds:top-0 ds:text-[length:var(--font-size-xs)] ds:leading-none",
|
|
269
|
-
children: ee[k]
|
|
270
|
-
}
|
|
271
|
-
)
|
|
272
|
-
]
|
|
273
|
-
}
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
);
|
|
277
|
-
ne.displayName = "Sparkline";
|
|
278
|
-
export {
|
|
279
|
-
ne as S,
|
|
280
|
-
Y as s,
|
|
281
|
-
X as u
|
|
282
|
-
};
|
|
283
|
-
//# sourceMappingURL=sparkline-DcXqRZoq.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sparkline-DcXqRZoq.js","sources":["../../src/components/sparkline/use-linear-trend.ts","../../src/components/sparkline/sparkline.agent.ts","../../src/components/sparkline/sparkline.tsx"],"sourcesContent":["export type TrendDirection = 'increasing' | 'decreasing' | 'steady';\n\nexport interface LinearTrendResult {\n slope: number;\n direction: TrendDirection;\n}\n\nexport function useLinearTrend(data: number[]): LinearTrendResult {\n if (data.length < 2) {\n return { slope: 0, direction: 'steady' };\n }\n\n const n = data.length;\n const xMean = (n - 1) / 2;\n const yMean = data.reduce((sum, y) => sum + y, 0) / n;\n\n let numerator = 0;\n let denominator = 0;\n\n for (let i = 0; i < n; i++) {\n const dx = i - xMean;\n numerator += dx * (data[i] - yMean);\n denominator += dx * dx;\n }\n\n const slope = denominator === 0 ? 0 : numerator / denominator;\n const range = Math.max(...data) - Math.min(...data);\n const threshold = 0.01 * (range || 1);\n\n const direction: TrendDirection =\n Math.abs(slope) < threshold\n ? 'steady'\n : slope > 0\n ? 'increasing'\n : 'decreasing';\n\n return { slope, direction };\n}\n","import type { AgentAdapter } from '../../agent/types';\nimport type { SparklineHandle } from './sparkline';\n\nexport const sparklineAgent: AgentAdapter<SparklineHandle> = {\n id: 'sparkline',\n capabilities: [],\n state: {},\n actions: {\n update_series: {\n // Replacing the rendered series mutates what the chart displays — write,\n // not read.\n safety: 'write',\n argsType: '{ data: number[] }',\n argsSchema: {\n type: 'object',\n properties: {\n data: {\n type: 'array',\n items: { type: 'number' },\n description: 'The new data points to render.',\n },\n },\n required: ['data'],\n },\n idempotent: true,\n descriptionKey: 'ui.agent.sparkline.actions.updateSeries',\n description: 'Replace the sparkline data without remounting.',\n invoke: (handle, args: { data: number[] }) => {\n handle.updateSeries(args.data);\n },\n },\n export_png: {\n // Pure getter — returns an image of the current chart, no state change.\n safety: 'read',\n returns: 'string',\n returnsSchema: {\n type: 'string',\n description: 'A PNG image of the sparkline encoded as a data URI.',\n },\n descriptionKey: 'ui.agent.sparkline.actions.exportPng',\n description: 'Return a PNG data URI of the sparkline.',\n invoke: (handle) => handle.dataURI(),\n },\n },\n domHooks: {\n root: { attr: 'data-component', value: 'sparkline' },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n },\n};\n","import {\n forwardRef,\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport ReactApexChart from 'react-apexcharts';\nimport ApexCharts from 'apexcharts';\nimport { getApexChartsTheme } from '../../tokens/apexcharts-theme';\nimport { useNeutraliseHiddenFocus } from '../_shared/use-neutralize-hidden-focus';\nimport { useLinearTrend } from './use-linear-trend';\nimport { useAgentRegistration } from '../../agent/registry';\nimport { sparklineAgent } from './sparkline.agent';\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\nconst sparklineVariants = cva('ds:relative ds:inline-block ds:w-full', {\n variants: {\n size: {\n xs: 'ds:h-6',\n sm: 'ds:h-8',\n md: 'ds:h-10',\n // Applied when an explicit `height` prop is given: the wrapper\n // grows with the svg instead of clipping at the size's fixed height.\n auto: '',\n },\n },\n defaultVariants: { size: 'md' },\n});\n\n/* ------------------------------------------------------------------ */\n/* Constants */\n/* ------------------------------------------------------------------ */\n\nconst DIRECTION_ARROW = {\n increasing: '↑',\n decreasing: '↓',\n steady: '→',\n} as const;\n\nconst SIZE_HEIGHT: Record<'xs' | 'sm' | 'md', number> = {\n xs: 24,\n sm: 32,\n md: 40,\n};\n\nfunction prefersReducedMotion(): boolean {\n return (\n typeof window !== 'undefined' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface SparklineHandle {\n updateSeries: (data: number[]) => void;\n updateOptions: (opts: ApexCharts.ApexOptions) => void;\n dataURI: () => Promise<string>;\n}\n\nexport interface SparklineProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'children'>,\n VariantProps<typeof sparklineVariants> {\n /** Array of numeric data points */\n data: number[];\n /** Chart visual style */\n variant?: 'line' | 'bar' | 'area';\n /** Size preset */\n size?: 'xs' | 'sm' | 'md';\n /** Accessible label prefix, e.g. \"Revenue, 30 days\" */\n label?: string;\n /** Stroke / bar colour override — defaults to var(--primary) via bridge */\n color?: string;\n /** Show end-point dot with trend direction arrow */\n showEndpoint?: boolean;\n /**\n * Show Apex's hover tooltip with the data point value. Defaults to\n * `false` — sparklines are intentionally minimal — opt in when the\n * sparkline is large enough to be a primary metric surface (e.g.\n * dashboard widgets) and the user benefits from per-point readout.\n */\n showTooltip?: boolean;\n /** Width override — defaults to 100% of container */\n width?: string | number;\n /** Height override — defaults to the size variant height */\n height?: string | number;\n}\n\n/* ------------------------------------------------------------------ */\n/* Sparkline component */\n/* ------------------------------------------------------------------ */\n\nexport const Sparkline = forwardRef<SparklineHandle, SparklineProps>(\n (\n {\n id,\n data,\n variant = 'line',\n size = 'md',\n label,\n color,\n showEndpoint = false,\n showTooltip = false,\n width,\n height,\n className,\n ...props\n },\n ref,\n ) => {\n const { t, i18n } = useTranslation();\n const rawId = useId();\n const chartId = useMemo(\n () => `sparkline-${rawId.replace(/[^a-zA-Z0-9-_]/g, '')}`,\n [rawId],\n );\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [containerWidth, setContainerWidth] = useState(0);\n\n const { direction } = useLinearTrend(data);\n\n /* ---- accessible summary ---------------------------------------- */\n const ariaLabel = useMemo(() => {\n if (data.length === 0) {\n return t('sparkline.noData', 'No data');\n }\n const fmt = (n: number) => new Intl.NumberFormat(i18n.language).format(n);\n const dirText = t(`sparkline.direction.${direction}`);\n const nums = {\n min: fmt(Math.min(...data)),\n max: fmt(Math.max(...data)),\n current: fmt(data[data.length - 1]),\n direction: dirText,\n };\n if (label) {\n return t('sparkline.summary', { label, ...nums });\n }\n return t('sparkline.summaryNoLabel', nums);\n }, [data, label, direction, i18n.language, t]);\n\n /* ---- theme-reactive state -------------------------------------- */\n const [themeOptions, setThemeOptions] = useState<ApexCharts.ApexOptions>(\n () => {\n try {\n return getApexChartsTheme();\n } catch {\n return {};\n }\n },\n );\n\n /* ---- MutationObserver: re-read theme on class change ----------- */\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout>;\n const observer = new MutationObserver(() => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n try {\n setThemeOptions(getApexChartsTheme());\n } catch {\n /* no-op in non-browser environments */\n }\n }, 50);\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class'],\n });\n return () => {\n clearTimeout(timer);\n observer.disconnect();\n };\n }, []);\n\n /* ---- ResizeObserver: track container width -------------------- */\n useEffect(() => {\n const el = wrapperRef.current;\n if (!el) return;\n const ro = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (entry) setContainerWidth(Math.floor(entry.contentRect.width));\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n /* ApexCharts injects focusable canvases inside the `aria-hidden` */\n /* chart wrapper. Neutralise their tabindex so axe's */\n /* `aria-hidden-focus` rule passes. Shared hook — same fix in */\n /* `Chart` (full apex) and the calendar's mirror events. */\n useNeutraliseHiddenFocus(wrapperRef);\n\n /* ---- imperative handle ---------------------------------------- */\n const agentHandle = useMemo<SparklineHandle>(\n () => ({\n updateSeries(newData: number[]) {\n ApexCharts.getChartByID(chartId)?.updateSeries([{ data: newData }]);\n },\n updateOptions(opts: ApexCharts.ApexOptions) {\n ApexCharts.getChartByID(chartId)?.updateOptions(opts);\n },\n async dataURI(): Promise<string> {\n const instance = ApexCharts.getChartByID(chartId);\n if (!instance) return '';\n const result = await instance.dataURI();\n return (result as { imgURI: string }).imgURI;\n },\n }),\n [chartId],\n );\n useImperativeHandle(ref, () => agentHandle, [agentHandle]);\n useAgentRegistration(sparklineAgent, agentHandle, id);\n\n /* ---- resolve color -------------------------------------------- */\n const resolvedColor = color ?? themeOptions.colors?.[0] ?? 'currentColor';\n\n /* ---- empty state ---------------------------------------------- */\n if (data.length === 0) {\n return (\n <div\n ref={wrapperRef}\n role=\"img\"\n aria-label={ariaLabel}\n dir=\"ltr\"\n className={sparklineVariants({\n size: height !== undefined ? 'auto' : size,\n className,\n })}\n {...props}\n />\n );\n }\n\n /* ---- chart config ---------------------------------------------- */\n const reducedMotion = prefersReducedMotion();\n\n const chartOptions: ApexCharts.ApexOptions = {\n ...themeOptions,\n chart: {\n ...themeOptions.chart,\n id: chartId,\n type: variant,\n sparkline: { enabled: true },\n toolbar: { show: false },\n animations: {\n enabled: !reducedMotion,\n dynamicAnimation: { enabled: !reducedMotion },\n },\n zoom: { enabled: false },\n parentHeightOffset: 0,\n },\n colors: [resolvedColor],\n stroke: {\n curve: 'smooth',\n width: variant === 'bar' ? 0 : 2,\n },\n fill: {\n opacity: variant === 'area' ? 0.15 : 1,\n },\n xaxis: {\n crosshairs: { show: false },\n },\n tooltip: { enabled: showTooltip },\n markers: showEndpoint\n ? {\n size: [0],\n discrete: [\n {\n seriesIndex: 0,\n dataPointIndex: data.length - 1,\n fillColor: resolvedColor,\n strokeColor: resolvedColor,\n size: 4,\n },\n ],\n }\n : { size: 0 },\n grid: {\n ...themeOptions.grid,\n show: false,\n // ApexCharts grid.padding uses physical keys (not CSS logical properties).\n // The chart wrapper enforces dir=\"ltr\" so these always resolve correctly.\n padding: { top: 2, right: 2, bottom: 2, left: 2 },\n },\n };\n\n const resolvedWidth =\n width ?? (containerWidth > 0 ? containerWidth : '100%');\n const resolvedHeight = height ?? SIZE_HEIGHT[size ?? 'md'];\n\n return (\n <div\n ref={wrapperRef}\n role=\"img\"\n aria-label={ariaLabel}\n dir=\"ltr\"\n className={sparklineVariants({\n size: height !== undefined ? 'auto' : size,\n className,\n })}\n data-component=\"sparkline\"\n data-component-id={id}\n {...props}\n >\n <ReactApexChart\n type={variant}\n series={[{ data }]}\n options={chartOptions}\n width={resolvedWidth}\n height={resolvedHeight}\n aria-hidden=\"true\"\n />\n {showEndpoint && (\n <span\n aria-hidden=\"true\"\n className=\"ds:pointer-events-none ds:absolute ds:end-0 ds:top-0 ds:text-[length:var(--font-size-xs)] ds:leading-none\"\n >\n {DIRECTION_ARROW[direction]}\n </span>\n )}\n </div>\n );\n },\n);\n\nSparkline.displayName = 'Sparkline';\n"],"names":["useLinearTrend","data","n","xMean","yMean","sum","y","numerator","denominator","i","dx","slope","threshold","direction","sparklineAgent","handle","args","sparklineVariants","cva","DIRECTION_ARROW","SIZE_HEIGHT","prefersReducedMotion","Sparkline","forwardRef","id","variant","size","label","color","showEndpoint","showTooltip","width","height","className","props","ref","t","i18n","useTranslation","rawId","useId","chartId","useMemo","wrapperRef","useRef","containerWidth","setContainerWidth","useState","ariaLabel","fmt","dirText","nums","themeOptions","setThemeOptions","getApexChartsTheme","useEffect","timer","observer","el","ro","entries","entry","useNeutraliseHiddenFocus","agentHandle","newData","_a","ApexCharts","opts","instance","useImperativeHandle","useAgentRegistration","resolvedColor","jsx","reducedMotion","chartOptions","resolvedWidth","resolvedHeight","jsxs","ReactApexChart"],"mappings":";;;;;;;;AAOO,SAASA,EAAeC,GAAmC;AAChE,MAAIA,EAAK,SAAS;AAChB,WAAO,EAAE,OAAO,GAAG,WAAW,SAAA;AAGhC,QAAMC,IAAID,EAAK,QACTE,KAASD,IAAI,KAAK,GAClBE,IAAQH,EAAK,OAAO,CAACI,GAAKC,MAAMD,IAAMC,GAAG,CAAC,IAAIJ;AAEpD,MAAIK,IAAY,GACZC,IAAc;AAElB,WAASC,IAAI,GAAGA,IAAIP,GAAGO,KAAK;AAC1B,UAAMC,IAAKD,IAAIN;AACf,IAAAI,KAAaG,KAAMT,EAAKQ,CAAC,IAAIL,IAC7BI,KAAeE,IAAKA;AAAA,EACtB;AAEA,QAAMC,IAAQH,MAAgB,IAAI,IAAID,IAAYC,GAE5CI,IAAY,QADJ,KA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