@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.
Files changed (222) hide show
  1. package/dist/_chunks/{actions-cell-renderer-DaL80uqL.js → actions-cell-renderer-ClGCSQnA.js} +600 -565
  2. package/dist/_chunks/actions-cell-renderer-ClGCSQnA.js.map +1 -0
  3. package/dist/_chunks/{ai-consent-banner-BXD7W6FI.js → ai-consent-banner-DKgFfSzc.js} +2 -2
  4. package/dist/_chunks/{ai-consent-banner-BXD7W6FI.js.map → ai-consent-banner-DKgFfSzc.js.map} +1 -1
  5. package/dist/_chunks/{alert-Cxaqd-QO.js → alert-DS22ha1n.js} +103 -98
  6. package/dist/_chunks/alert-DS22ha1n.js.map +1 -0
  7. package/dist/_chunks/{annotation-marker-qt5R9WZX.js → annotation-marker-CsUJGZjQ.js} +7 -5
  8. package/dist/_chunks/annotation-marker-CsUJGZjQ.js.map +1 -0
  9. package/dist/_chunks/{audio-recorder-BjnB7V8n.js → audio-recorder-sRsGS-0V.js} +2 -2
  10. package/dist/_chunks/{audio-recorder-BjnB7V8n.js.map → audio-recorder-sRsGS-0V.js.map} +1 -1
  11. package/dist/_chunks/{booking-DSOK-bnR.js → booking-D8fCzcUd.js} +2 -2
  12. package/dist/_chunks/{booking-DSOK-bnR.js.map → booking-D8fCzcUd.js.map} +1 -1
  13. package/dist/_chunks/{care-plan-card-BrwhyIJI.js → care-plan-card-DjjVnBYz.js} +2 -2
  14. package/dist/_chunks/{care-plan-card-BrwhyIJI.js.map → care-plan-card-DjjVnBYz.js.map} +1 -1
  15. package/dist/_chunks/{care-plan-entry-card-DWEdCQM3.js → care-plan-entry-card-BVhpvd-P.js} +2 -2
  16. package/dist/_chunks/{care-plan-entry-card-DWEdCQM3.js.map → care-plan-entry-card-BVhpvd-P.js.map} +1 -1
  17. package/dist/_chunks/{collapsible-BrnRiCC6.js → collapsible-CGL9ontS.js} +65 -61
  18. package/dist/_chunks/collapsible-CGL9ontS.js.map +1 -0
  19. package/dist/_chunks/{document-preview-DXsCEj4U.js → document-preview-DAczwybt.js} +2 -2
  20. package/dist/_chunks/{document-preview-DXsCEj4U.js.map → document-preview-DAczwybt.js.map} +1 -1
  21. package/dist/_chunks/{document-scanner-cS_ispQs.js → document-scanner-BRYIc3A-.js} +2 -2
  22. package/dist/_chunks/{document-scanner-cS_ispQs.js.map → document-scanner-BRYIc3A-.js.map} +1 -1
  23. package/dist/_chunks/{entity-summary-BILN4wEG.js → entity-summary-BS6n7Iah.js} +2 -2
  24. package/dist/_chunks/{entity-summary-BILN4wEG.js.map → entity-summary-BS6n7Iah.js.map} +1 -1
  25. package/dist/_chunks/{face-scheme-CjQAHvSP.js → face-scheme-Cou2efl7.js} +2 -2
  26. package/dist/_chunks/{face-scheme-CjQAHvSP.js.map → face-scheme-Cou2efl7.js.map} +1 -1
  27. package/dist/_chunks/{file-manager-B9LZzT5E.js → file-manager-CNSLiuLo.js} +2 -2
  28. package/dist/_chunks/{file-manager-B9LZzT5E.js.map → file-manager-CNSLiuLo.js.map} +1 -1
  29. package/dist/_chunks/{freemium-paywall-Dr2342_S.js → freemium-paywall-DsT7MaLd.js} +2 -2
  30. package/dist/_chunks/{freemium-paywall-Dr2342_S.js.map → freemium-paywall-DsT7MaLd.js.map} +1 -1
  31. package/dist/_chunks/link-cell-renderer-_DlEZHLI.js +772 -0
  32. package/dist/_chunks/link-cell-renderer-_DlEZHLI.js.map +1 -0
  33. package/dist/_chunks/{marketplace-app-shell-pCHBp8bo.js → marketplace-app-shell-DQC9Gpm0.js} +2 -2
  34. package/dist/_chunks/{marketplace-app-shell-pCHBp8bo.js.map → marketplace-app-shell-DQC9Gpm0.js.map} +1 -1
  35. package/dist/_chunks/{muscle-scheme-kgCX5qfO.js → muscle-scheme-yfzP_xoJ.js} +2 -2
  36. package/dist/_chunks/{muscle-scheme-kgCX5qfO.js.map → muscle-scheme-yfzP_xoJ.js.map} +1 -1
  37. package/dist/_chunks/{patient-details-UmNcxL0c.js → patient-details-l7pnsUq9.js} +2 -2
  38. package/dist/_chunks/{patient-details-UmNcxL0c.js.map → patient-details-l7pnsUq9.js.map} +1 -1
  39. package/dist/_chunks/{patient-search-vtRTSdf6.js → patient-search-H54Utav2.js} +2 -2
  40. package/dist/_chunks/{patient-search-vtRTSdf6.js.map → patient-search-H54Utav2.js.map} +1 -1
  41. package/dist/_chunks/{patient-table-QEVsFvwq.js → patient-table-DXk0wW8Q.js} +243 -239
  42. package/dist/_chunks/patient-table-DXk0wW8Q.js.map +1 -0
  43. package/dist/_chunks/payment-automation-upsell-C4LIw1iQ.js +305 -0
  44. package/dist/_chunks/payment-automation-upsell-C4LIw1iQ.js.map +1 -0
  45. package/dist/_chunks/{payment-form-BoGxEmGn.js → payment-form-CyKT20xZ.js} +2 -2
  46. package/dist/_chunks/{payment-form-BoGxEmGn.js.map → payment-form-CyKT20xZ.js.map} +1 -1
  47. package/dist/_chunks/{payment-request-card-CygO1anM.js → payment-request-card-CN30J6yM.js} +107 -138
  48. package/dist/_chunks/payment-request-card-CN30J6yM.js.map +1 -0
  49. package/dist/_chunks/{pdf-viewer-CcOuR2wj.js → pdf-viewer-DHg8SfUI.js} +2 -2
  50. package/dist/_chunks/{pdf-viewer-CcOuR2wj.js.map → pdf-viewer-DHg8SfUI.js.map} +1 -1
  51. package/dist/_chunks/{practice-results-yKbwIxqa.js → practice-results-qvJRkvLn.js} +2 -2
  52. package/dist/_chunks/{practice-results-yKbwIxqa.js.map → practice-results-qvJRkvLn.js.map} +1 -1
  53. package/dist/_chunks/receipt-euro-C6k4Gzhr.js +36 -0
  54. package/dist/_chunks/receipt-euro-C6k4Gzhr.js.map +1 -0
  55. package/dist/_chunks/{reviews-panel-DmOjvmyH.js → reviews-panel-BfUJhx3m.js} +2 -2
  56. package/dist/_chunks/{reviews-panel-DmOjvmyH.js.map → reviews-panel-BfUJhx3m.js.map} +1 -1
  57. package/dist/_chunks/{sign-document-cH9CboWB.js → sign-document-D70TEUw9.js} +2 -2
  58. package/dist/_chunks/{sign-document-cH9CboWB.js.map → sign-document-D70TEUw9.js.map} +1 -1
  59. package/dist/_chunks/{signature-request-BzXTV_RH.js → signature-request-BlNCXpRN.js} +2 -2
  60. package/dist/_chunks/{signature-request-BzXTV_RH.js.map → signature-request-BlNCXpRN.js.map} +1 -1
  61. package/dist/_chunks/sparkline-DLq7xwic.js +394 -0
  62. package/dist/_chunks/sparkline-DLq7xwic.js.map +1 -0
  63. package/dist/_chunks/{warning-stack-DKeAfj5M.js → warning-stack-IVf0oxh2.js} +2 -2
  64. package/dist/_chunks/{warning-stack-DKeAfj5M.js.map → warning-stack-IVf0oxh2.js.map} +1 -1
  65. package/dist/_chunks/{workflow-map-SIfAhmWz.js → workflow-map-ByyBYj6Y.js} +2 -2
  66. package/dist/_chunks/{workflow-map-SIfAhmWz.js.map → workflow-map-ByyBYj6Y.js.map} +1 -1
  67. package/dist/agent-catalog.json +211 -7
  68. package/dist/agent-i18n/en.json +13 -3
  69. package/dist/components/ai-consent-banner/index.js +1 -1
  70. package/dist/components/alert/alert.d.ts +20 -0
  71. package/dist/components/alert/alert.d.ts.map +1 -1
  72. package/dist/components/alert/index.d.ts +1 -1
  73. package/dist/components/alert/index.d.ts.map +1 -1
  74. package/dist/components/alert/index.js +1 -1
  75. package/dist/components/annotation-marker/annotation-marker.d.ts.map +1 -1
  76. package/dist/components/annotation-marker/index.js +1 -1
  77. package/dist/components/audio-recorder/index.js +1 -1
  78. package/dist/components/booking/index.js +1 -1
  79. package/dist/components/care-plan-card/index.js +1 -1
  80. package/dist/components/care-plan-entry-card/index.js +1 -1
  81. package/dist/components/collapsible/collapsible.d.ts.map +1 -1
  82. package/dist/components/collapsible/index.js +1 -1
  83. package/dist/components/data-table/data-table.d.ts.map +1 -1
  84. package/dist/components/data-table/filters/select-filter.d.ts +6 -0
  85. package/dist/components/data-table/filters/select-filter.d.ts.map +1 -1
  86. package/dist/components/data-table/hooks/use-presentational-aria-fix.d.ts +19 -0
  87. package/dist/components/data-table/hooks/use-presentational-aria-fix.d.ts.map +1 -0
  88. package/dist/components/data-table/index.js +2 -2
  89. package/dist/components/document-preview/index.js +1 -1
  90. package/dist/components/document-scanner/index.js +1 -1
  91. package/dist/components/entity-summary/index.js +1 -1
  92. package/dist/components/face-scheme/index.js +1 -1
  93. package/dist/components/file-manager/index.js +1 -1
  94. package/dist/components/freemium-paywall/index.js +1 -1
  95. package/dist/components/muscle-scheme/index.js +1 -1
  96. package/dist/components/patient-details/index.js +1 -1
  97. package/dist/components/patient-search/index.js +1 -1
  98. package/dist/components/patient-table/columns.d.ts.map +1 -1
  99. package/dist/components/patient-table/index.js +1 -1
  100. package/dist/components/payment-card/index.js +1 -1
  101. package/dist/components/payment-form/index.js +1 -1
  102. package/dist/components/pdf-viewer/index.js +1 -1
  103. package/dist/components/practice-results/index.js +1 -1
  104. package/dist/components/reviews-panel/index.js +1 -1
  105. package/dist/components/sign-document/index.js +1 -1
  106. package/dist/components/skeleton-scheme/index.js +1 -1
  107. package/dist/components/sparkline/index.d.ts +1 -1
  108. package/dist/components/sparkline/index.d.ts.map +1 -1
  109. package/dist/components/sparkline/index.js +1 -1
  110. package/dist/components/sparkline/sparkline.d.ts +36 -3
  111. package/dist/components/sparkline/sparkline.d.ts.map +1 -1
  112. package/dist/components/warning-stack/index.js +1 -1
  113. package/dist/components/workflow/index.js +1 -1
  114. package/dist/host-compat.css +10 -1
  115. package/dist/i18n/locales/ar.d.ts +1 -0
  116. package/dist/i18n/locales/ar.d.ts.map +1 -1
  117. package/dist/i18n/locales/ar.js +1 -0
  118. package/dist/i18n/locales/ar.js.map +1 -1
  119. package/dist/i18n/locales/de.d.ts +1 -0
  120. package/dist/i18n/locales/de.d.ts.map +1 -1
  121. package/dist/i18n/locales/de.js +1 -0
  122. package/dist/i18n/locales/de.js.map +1 -1
  123. package/dist/i18n/locales/el.d.ts +1 -0
  124. package/dist/i18n/locales/el.d.ts.map +1 -1
  125. package/dist/i18n/locales/el.js +1 -0
  126. package/dist/i18n/locales/el.js.map +1 -1
  127. package/dist/i18n/locales/en.d.ts +1 -0
  128. package/dist/i18n/locales/en.d.ts.map +1 -1
  129. package/dist/i18n/locales/en.js +1 -0
  130. package/dist/i18n/locales/en.js.map +1 -1
  131. package/dist/i18n/locales/es.d.ts +1 -0
  132. package/dist/i18n/locales/es.d.ts.map +1 -1
  133. package/dist/i18n/locales/es.js +1 -0
  134. package/dist/i18n/locales/es.js.map +1 -1
  135. package/dist/i18n/locales/fr.d.ts +1 -0
  136. package/dist/i18n/locales/fr.d.ts.map +1 -1
  137. package/dist/i18n/locales/fr.js +1 -0
  138. package/dist/i18n/locales/fr.js.map +1 -1
  139. package/dist/i18n/locales/hi.d.ts +1 -0
  140. package/dist/i18n/locales/hi.d.ts.map +1 -1
  141. package/dist/i18n/locales/hi.js +1 -0
  142. package/dist/i18n/locales/hi.js.map +1 -1
  143. package/dist/i18n/locales/it.d.ts +1 -0
  144. package/dist/i18n/locales/it.d.ts.map +1 -1
  145. package/dist/i18n/locales/it.js +1 -0
  146. package/dist/i18n/locales/it.js.map +1 -1
  147. package/dist/i18n/locales/ja.d.ts +1 -0
  148. package/dist/i18n/locales/ja.d.ts.map +1 -1
  149. package/dist/i18n/locales/ja.js +1 -0
  150. package/dist/i18n/locales/ja.js.map +1 -1
  151. package/dist/i18n/locales/nl.d.ts +1 -0
  152. package/dist/i18n/locales/nl.d.ts.map +1 -1
  153. package/dist/i18n/locales/nl.js +1 -0
  154. package/dist/i18n/locales/nl.js.map +1 -1
  155. package/dist/i18n/locales/pl.d.ts +1 -0
  156. package/dist/i18n/locales/pl.d.ts.map +1 -1
  157. package/dist/i18n/locales/pl.js +1 -0
  158. package/dist/i18n/locales/pl.js.map +1 -1
  159. package/dist/i18n/locales/pt.d.ts +1 -0
  160. package/dist/i18n/locales/pt.d.ts.map +1 -1
  161. package/dist/i18n/locales/pt.js +1 -0
  162. package/dist/i18n/locales/pt.js.map +1 -1
  163. package/dist/i18n/locales/ro.d.ts +1 -0
  164. package/dist/i18n/locales/ro.d.ts.map +1 -1
  165. package/dist/i18n/locales/ro.js +1 -0
  166. package/dist/i18n/locales/ro.js.map +1 -1
  167. package/dist/i18n/locales/ru.d.ts +1 -0
  168. package/dist/i18n/locales/ru.d.ts.map +1 -1
  169. package/dist/i18n/locales/ru.js +1 -0
  170. package/dist/i18n/locales/ru.js.map +1 -1
  171. package/dist/i18n/locales/sq.d.ts +1 -0
  172. package/dist/i18n/locales/sq.d.ts.map +1 -1
  173. package/dist/i18n/locales/sq.js +1 -0
  174. package/dist/i18n/locales/sq.js.map +1 -1
  175. package/dist/i18n/locales/sv.d.ts +1 -0
  176. package/dist/i18n/locales/sv.d.ts.map +1 -1
  177. package/dist/i18n/locales/sv.js +1 -0
  178. package/dist/i18n/locales/sv.js.map +1 -1
  179. package/dist/i18n/locales/tr.d.ts +1 -0
  180. package/dist/i18n/locales/tr.d.ts.map +1 -1
  181. package/dist/i18n/locales/tr.js +1 -0
  182. package/dist/i18n/locales/tr.js.map +1 -1
  183. package/dist/i18n/locales/zh.d.ts +1 -0
  184. package/dist/i18n/locales/zh.d.ts.map +1 -1
  185. package/dist/i18n/locales/zh.js +1 -0
  186. package/dist/i18n/locales/zh.js.map +1 -1
  187. package/dist/index.js +974 -1268
  188. package/dist/index.js.map +1 -1
  189. package/dist/locales/ar.json +1 -0
  190. package/dist/locales/de.json +1 -0
  191. package/dist/locales/el.json +1 -0
  192. package/dist/locales/en.json +1 -0
  193. package/dist/locales/es.json +1 -0
  194. package/dist/locales/fr.json +1 -0
  195. package/dist/locales/hi.json +1 -0
  196. package/dist/locales/it.json +1 -0
  197. package/dist/locales/ja.json +1 -0
  198. package/dist/locales/nl.json +1 -0
  199. package/dist/locales/pl.json +1 -0
  200. package/dist/locales/pt.json +1 -0
  201. package/dist/locales/ro.json +1 -0
  202. package/dist/locales/ru.json +1 -0
  203. package/dist/locales/sq.json +1 -0
  204. package/dist/locales/sv.json +1 -0
  205. package/dist/locales/tr.json +1 -0
  206. package/dist/locales/zh.json +1 -0
  207. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  208. package/dist/patterns/payment-automation-upsell/index.js +5 -0
  209. package/dist/patterns/payment-automation-upsell/index.js.map +1 -0
  210. package/dist/patterns/signature-request/index.js +1 -1
  211. package/dist/tokens.css +1 -1
  212. package/package.json +5 -1
  213. package/dist/_chunks/actions-cell-renderer-DaL80uqL.js.map +0 -1
  214. package/dist/_chunks/alert-Cxaqd-QO.js.map +0 -1
  215. package/dist/_chunks/annotation-marker-qt5R9WZX.js.map +0 -1
  216. package/dist/_chunks/collapsible-BrnRiCC6.js.map +0 -1
  217. package/dist/_chunks/link-cell-renderer-Bt-mXeQY.js +0 -728
  218. package/dist/_chunks/link-cell-renderer-Bt-mXeQY.js.map +0 -1
  219. package/dist/_chunks/patient-table-QEVsFvwq.js.map +0 -1
  220. package/dist/_chunks/payment-request-card-CygO1anM.js.map +0 -1
  221. package/dist/_chunks/sparkline-DcXqRZoq.js +0 -283
  222. package/dist/_chunks/sparkline-DcXqRZoq.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sparkline-DLq7xwic.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 { markerPath, type MarkerShape } from '../annotation-marker';\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/* Tone only TINTS the annotation — the shape is what distinguishes one\n * event from another (WCAG 1.4.1), matching AnnotationMarker's vocabulary. */\nconst annotationVariants = cva('', {\n variants: {\n tone: {\n neutral: 'ds:[--annotation-color:var(--muted-foreground)]',\n info: 'ds:[--annotation-color:var(--info)]',\n success: 'ds:[--annotation-color:var(--success)]',\n /* `--warning-readable`, not `--warning`: a 1.5px dashed line is a\n * non-text graphic (WCAG 1.4.11, 3:1), and yellow-500 is ~1.6:1 on a\n * light card. The token aliases back to `--warning` in dark. */\n warning: 'ds:[--annotation-color:var(--warning-readable)]',\n error: 'ds:[--annotation-color:var(--destructive)]',\n accent: 'ds:[--annotation-color:var(--accent)]',\n },\n },\n defaultVariants: { tone: 'neutral' },\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\n/** ApexCharts grid padding, in px. The plotted extent is the wrapper inset by\n * this on each edge, so the annotation overlay has to use the same number to\n * land its first/last position on the first/last data point. */\nconst PLOT_EDGE_PADDING = 2;\n\n/** Radius of an annotation's shape cap, in svg user units (= px here). Sized\n * against the SMALLEST sparkline it has to sit on (`xs`, 24px): a 5px cap is\n * ~a fifth of that height, still shape-legible, and no longer competes with\n * the series it annotates. */\nconst ANNOTATION_CAP_RADIUS = 2.5;\n\nfunction clampFraction(value: number): number {\n if (!Number.isFinite(value)) return 0;\n return Math.min(1, Math.max(0, value));\n}\n\n/** The measurements in a series, gaps dropped. A `null` is an unmeasured\n * position, not a zero — it must not reach the min/max/trend maths. */\nfunction measured(data: readonly (number | null)[]): number[] {\n return data.filter((value): value is number => value != null);\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 | null)[]) => void;\n updateOptions: (opts: ApexCharts.ApexOptions) => void;\n dataURI: () => Promise<string>;\n}\n\n/** Semantic tint for an annotation. Decorative reinforcement of `shape` —\n * never the only channel carrying which event this is. */\nexport type SparklineAnnotationTone =\n | 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'error'\n | 'accent';\n\n/**\n * A vertical reference line dropped across the plot — the release-annotation\n * pattern: \"something happened here, look at what the line does around it\".\n *\n * `position` is a FRACTION of the plotted x extent, not an index: `0` is the\n * first data point, `1` the last, `0.5` exactly halfway between them. That is\n * what lets an event that falls BETWEEN two points be placed at all, and what\n * lets the same event land at the same x in a column of stacked sparklines —\n * the caller derives the fraction once, from a domain the whole column shares,\n * rather than per-series from a point count that differs row to row.\n */\nexport interface SparklineAnnotation {\n /** Stable key — also emitted as `data-annotation-id` for test/agent hooks. */\n id: string;\n /** Fraction of the plotted x extent: 0 = first point, 1 = last. Clamped. */\n position: number;\n /** Accessible label, already localised by the caller. Folded into the\n * sparkline's own `aria-label` — the line itself says nothing aloud. */\n label: string;\n /** Shape of the cap drawn at the top of the line. The accessible channel. */\n shape?: MarkerShape;\n tone?: SparklineAnnotationTone;\n}\n\nexport interface SparklineProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'children'>,\n VariantProps<typeof sparklineVariants> {\n /** Data points in plot order. `null` is an unmeasured position — it holds\n * the point's place on the x extent and draws a gap, so a series measured\n * at some positions and not others stays aligned with one that was measured\n * at all of them. */\n data: (number | null)[];\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 /** Vertical reference lines dropped across the plot. Omitted = none, so\n * every existing consumer is unaffected. */\n annotations?: readonly SparklineAnnotation[];\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 annotations,\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 // Gaps are positions, not values: they hold the point's place on the x\n // extent but never reach the trend, the min/max, or the endpoint dot.\n const points = useMemo(() => measured(data), [data]);\n const { direction } = useLinearTrend(points);\n\n /* ---- accessible summary ---------------------------------------- */\n const ariaLabel = useMemo(() => {\n // The annotations are the only thing a vertical line in an SVG can say\n // aloud, so they ride the summary in every branch — including \"no data\",\n // where the marked events are all there is left to report.\n const marks =\n annotations && annotations.length > 0\n ? t('sparkline.annotations', {\n list: annotations.map((a) => a.label).join(', '),\n })\n : '';\n const withMarks = (summary: string) =>\n marks ? `${summary}. ${marks}` : summary;\n\n if (points.length === 0) {\n return withMarks(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(...points)),\n max: fmt(Math.max(...points)),\n current: fmt(points[points.length - 1]),\n direction: dirText,\n };\n if (label) {\n return withMarks(t('sparkline.summary', { label, ...nums }));\n }\n return withMarks(t('sparkline.summaryNoLabel', nums));\n }, [points, annotations, 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 | null)[]) {\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 (points.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 data-component=\"sparkline\"\n data-component-id={id}\n {...props}\n />\n );\n }\n\n /* ---- chart config ---------------------------------------------- */\n const reducedMotion = prefersReducedMotion();\n\n // A gapped series is plotted as {x, y} pairs on a NUMERIC axis pinned to\n // the full slot count, not as an array with holes in it: ApexCharts draws\n // a line only between consecutive non-null points, so a lab measured at\n // slots 0, 4 and 8 would render as three isolated points and no trend at\n // all. Pairs keep each measurement at its own slot, connect across the\n // gap, and leave the extent — and so every annotation — unchanged.\n // Gapless data keeps the plain-array form, so every existing consumer\n // renders byte-identically.\n const gapped = data.length > points.length;\n const seriesData = gapped\n ? data.flatMap((y, x) => (y == null ? [] : [{ x, y }]))\n : points;\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 // A gapped series is re-rendered as {x, y} pairs, and Apex's\n // update tween interpolates between the old and new paths point by\n // point. Across a width change the two have different lengths and\n // the tween emits `d=\"… NaN …\"` for a few frames. The finished\n // render is correct either way; switching the tween off keeps the\n // console clean.\n dynamicAnimation: { enabled: !reducedMotion && !gapped },\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 // Pin the extent to the slot count so a gap at either end still holds\n // its place — otherwise the plot would rescale to the measurements\n // and the annotation fractions would no longer mean the same thing.\n ...(gapped\n ? { type: 'numeric' as const, min: 0, max: data.length - 1 }\n : {}),\n },\n tooltip: { enabled: showTooltip },\n markers: showEndpoint\n ? {\n size: [0],\n discrete: [\n {\n // An index into the SERIES, whose holes have already been\n // removed — so this is the last MEASURED point, never a slot\n // the parameter was not measured at.\n seriesIndex: 0,\n dataPointIndex: seriesData.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: {\n top: PLOT_EDGE_PADDING,\n right: PLOT_EDGE_PADDING,\n bottom: PLOT_EDGE_PADDING,\n left: PLOT_EDGE_PADDING,\n },\n },\n };\n\n const resolvedWidth =\n width ?? (containerWidth > 0 ? containerWidth : '100%');\n const resolvedHeight = height ?? SIZE_HEIGHT[size ?? 'md'];\n\n // Positioned as a percentage of the overlay's own box rather than from a\n // measured width: the overlay is inset to the plot area, so a fraction is\n // exact at any size and cannot lag or disagree with the plot.\n const drawnAnnotations = annotations?.length ? annotations : undefined;\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: seriesData }]}\n options={chartOptions}\n width={resolvedWidth}\n height={resolvedHeight}\n aria-hidden=\"true\"\n />\n {drawnAnnotations && (\n /* Drawn over the plot rather than through ApexCharts' own xaxis\n annotations: a fraction of the measured extent is the one\n positioning rule that survives series of different lengths, which\n is what makes a column of sparklines share an x. */\n /* The inset lives on a div: an <svg> is a replaced element, so\n left+right do not size it and it would fall back to its intrinsic\n 300px. The div is the plot box; the svg fills it. The 2px MUST\n equal PLOT_EDGE_PADDING — Tailwind needs a static literal, so the\n two cannot share one source; change them together or the first and\n last annotation drift off the first and last data point. */\n <div className=\"ds:pointer-events-none ds:absolute ds:inset-y-0 ds:inset-x-[2px]\">\n <svg\n aria-hidden=\"true\"\n focusable=\"false\"\n data-testid=\"sparkline-annotations\"\n className=\"ds:size-full\"\n >\n {drawnAnnotations.map((annotation) => {\n const fraction = clampFraction(annotation.position);\n return (\n /* A nested viewport placed at a percentage of the plot: the\n one positioning rule that needs no measurement, so a column\n of sparklines shares an x whatever their widths. */\n <svg\n key={annotation.id}\n x={`${fraction * 100}%`}\n y=\"0\"\n width=\"1\"\n height=\"100%\"\n overflow=\"visible\"\n data-annotation-id={annotation.id}\n data-annotation-position={fraction}\n className={annotationVariants({ tone: annotation.tone })}\n >\n <line\n x1={0}\n x2={0}\n y1={0}\n y2=\"100%\"\n /* 1px, more gap than dash: the line marks WHERE, the\n series is what is read, and at 1.5px the annotation\n was the louder of the two. */\n className=\"ds:[stroke:var(--annotation-color)] ds:[stroke-dasharray:2_3] ds:[stroke-width:1]\"\n />\n <path\n d={markerPath(\n annotation.shape ?? 'diamond',\n 0,\n ANNOTATION_CAP_RADIUS,\n ANNOTATION_CAP_RADIUS,\n )}\n className=\"ds:[fill:var(--annotation-color)]\"\n />\n </svg>\n );\n })}\n </svg>\n </div>\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","annotationVariants","DIRECTION_ARROW","SIZE_HEIGHT","PLOT_EDGE_PADDING","ANNOTATION_CAP_RADIUS","clampFraction","value","measured","prefersReducedMotion","Sparkline","forwardRef","id","variant","size","label","color","showEndpoint","showTooltip","width","height","annotations","className","props","ref","t","i18n","useTranslation","rawId","useId","chartId","useMemo","wrapperRef","useRef","containerWidth","setContainerWidth","useState","points","ariaLabel","marks","a","withMarks","summary","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","gapped","seriesData","x","chartOptions","resolvedWidth","resolvedHeight","drawnAnnotations","jsxs","ReactApexChart","annotation","fraction","markerPath"],"mappings":";;;;;;;;;AAOO,SAASA,GAAeC,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,KAAK,IAAI,GAAGX,CAAI,IAAI,KAAK,IAAI,GAAGA,CAA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AA;AAAA,sBACZ;AAAA,oBAAA;AAAA,oBA5BKwE,EAAW;AAAA,kBAAA;AAAA;AAAA,cA+BtB,CAAC;AAAA,YAAA;AAAA,UAAA,GAEL;AAAA,UAED5D,KACC,gBAAAiD;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,eAAY;AAAA,cACZ,WAAU;AAAA,cAET,aAAgBvE,CAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QAC5B;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAe,GAAU,cAAc;"}
@@ -3,7 +3,7 @@ import { forwardRef as cn, useId as P, useState as y, useEffect as f, useMemo as
3
3
  import { c as dn } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as ln } from "react-i18next";
5
5
  import { u as un } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
6
- import { A as C } from "./alert-Cxaqd-QO.js";
6
+ import { A as C } from "./alert-DS22ha1n.js";
7
7
  import { B as fn } from "./button-CPGiR_bH.js";
8
8
  import { I as mn } from "./icon-button-C_kbcd7I.js";
9
9
  import { X as gn } from "./x-B5YnXwCz.js";
@@ -265,4 +265,4 @@ Nn.displayName = "WarningStack";
265
265
  export {
266
266
  Nn as W
267
267
  };
268
- //# sourceMappingURL=warning-stack-DKeAfj5M.js.map
268
+ //# sourceMappingURL=warning-stack-IVf0oxh2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"warning-stack-DKeAfj5M.js","sources":["../../src/components/warning-stack/warning-stack.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { ChevronDown, X } from 'lucide-react';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { Alert, type AlertProps } from '../alert/alert';\nimport { Button } from '../button/button';\nimport { IconButton } from '../button/icon-button';\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\nexport interface WarningStackItem {\n id: string;\n variant?: AlertProps['variant'];\n title: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n actions?: ReactNode;\n dismissible?: boolean;\n}\n\n/** Empty-collapse fold phases (no-`emptyState` path only). See the fold\n * state machine in the component body. */\ntype FoldPhase = 'open' | 'settling' | 'closing' | 'closed';\n\nconst stackVariants = cva(\n [\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-lg)]',\n 'ds:bg-[color:var(--card)] ds:text-[color:var(--card-foreground)]',\n 'ds:shadow-[var(--shadow-card)]',\n 'ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2',\n 'ds:p-[var(--spacing-md)]',\n ].join(' '),\n {\n variants: {\n // `stretch: true` fills the parent layout cell — mirrors the `stretch`\n // prop on `Card` so a WarningStack rendered next to a Card in a grid\n // row ends up at matching height.\n stretch: {\n true: 'ds:h-full ds:self-stretch',\n false: '',\n },\n },\n defaultVariants: {\n stretch: false,\n },\n },\n);\n\n// Single column by default; two columns once the stack itself is wide\n// enough (container query — viewport width lies when the stack sits in\n// a narrow grid cell). A trailing odd item spans both columns so the\n// grid never ends on a half-width hole, which also keeps a lone item\n// full-width exactly as before.\n// 768px, not the `@3xl` rem alias: container-query `rem` resolves against the\n// host's root font-size, so a non-16px root silently moves the threshold.\nconst LIST_CLASSES = [\n 'ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)]',\n 'ds:@[768px]/warning-stack:grid-cols-2',\n 'ds:@[768px]/warning-stack:[&>li:nth-child(odd):last-child]:col-span-full',\n].join(' ');\n\nconst TOGGLE_CLASSES = [\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:self-start',\n].join(' ');\n\n/* ------------------------------------------------------------------ */\n/* Empty-collapse animation */\n/* */\n/* When the stack empties (every notice dismissed) and no `emptyState` */\n/* is supplied, the whole region folds away instead of leaving a hole. */\n/* The grid `1fr → 0fr` track is the only CSS-only way to animate to/ */\n/* from `height: auto`; JS-measured `max-height` is barred by the */\n/* no-inline-styles constraint. The outer wrapper owns the height */\n/* track; the inner wrapper owns the cross-fade + overflow clip. */\n/* ------------------------------------------------------------------ */\n\n/** Floor for how long the folding region stays mounted after it empties, so a\n * screen reader can voice the cleared count even when `--animation-duration`\n * is 0ms (accessible themes). The region is already visually collapsed, so\n * this window is imperceptible. */\nconst MIN_FOLD_UNMOUNT_MS = 250;\n\n/** Reads `--animation-duration` (ms) so the unmount timer matches the\n * CSS transition. Falls back to 200ms when it can't be resolved. */\nfunction readAnimationDurationMs(): number {\n if (typeof window === 'undefined') return 200;\n const raw = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue('--animation-duration');\n const trimmed = raw.trim();\n const n = parseFloat(trimmed);\n if (!Number.isFinite(n)) return 200;\n return trimmed.endsWith('ms') ? n : n * 1000;\n}\n\n/** Outer height-collapse track. Always a grid so the `grid-template-rows`\n * transition has a stable from/to; only the row size flips. */\nfunction collapseTrackClass(collapsed: boolean, stretch: boolean): string {\n return [\n 'ds:grid ds:transition-[grid-template-rows]',\n 'ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n collapsed ? 'ds:grid-rows-[0fr]' : 'ds:grid-rows-[1fr]',\n stretch ? 'ds:h-full ds:self-stretch' : '',\n ]\n .filter(Boolean)\n .join(' ');\n}\n\n/** Inner cross-fade layer. `min-h-0` lets the grid item shrink below its\n * content; `overflow-hidden` (only while animating) clips the fold so the\n * card's resting drop-shadow isn't clipped at rest. */\nfunction collapseInnerClass(collapsed: boolean, closing: boolean): string {\n return [\n 'ds:min-h-0',\n 'ds:transition-opacity ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n collapsed ? 'ds:opacity-0 ds:overflow-hidden' : 'ds:opacity-100',\n closing ? 'ds:pointer-events-none' : '',\n ]\n .filter(Boolean)\n .join(' ');\n}\n\nexport interface WarningStackProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role' | 'title'>,\n VariantProps<typeof stackVariants> {\n /** Items rendered inside the stack. */\n items: WarningStackItem[];\n /** Fill the parent layout cell — use in a dashboard grid row so the\n * stack ends up with matching height to sibling Cards. */\n stretch?: boolean;\n /** Visible title rendered as an `<h2>` above the stack. Also labels the\n * region for assistive tech. When omitted, the region is labelled via a\n * visually hidden heading using `ariaLabel` (or the default \"Warnings\"). */\n title?: ReactNode;\n /** Optional short description rendered under the title. */\n description?: ReactNode;\n /** Cap on visible items before a \"Show N more\" toggle appears. Defaults to\n * `2`; pass a larger number (or `Infinity`) to show more before collapsing. */\n maxVisible?: number;\n /** Whether the stack starts collapsed when items exceed `maxVisible`. */\n defaultCollapsed?: boolean;\n /** Fires when a dismissible item's close control is activated. */\n onDismiss?: (item: WarningStackItem) => void;\n /** Whether the whole-stack close control is shown at the header's inline-end.\n * Defaults to `true` — the tray is closable. Set `false` for stacks that\n * carry notices which must not be bulk-cleared (e.g. hard compliance blocks). */\n closable?: boolean;\n /** Fires when the whole-stack close control is activated, after every\n * currently-visible notice has been dismissed (folding the region away).\n * Optional — the fold happens internally regardless; supply this only to\n * mirror the bulk dismissal into the consumer's own store. */\n onDismissAll?: () => void;\n /** Accessible label for the whole-stack close control. Defaults to the\n * localised \"Dismiss all notices\". */\n dismissAllLabel?: string;\n /** Accessible label for the region when `title` is not set. */\n ariaLabel?: string;\n /** Optional node rendered when the stack has zero items. */\n emptyState?: ReactNode;\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport const WarningStack = forwardRef<HTMLDivElement, WarningStackProps>(\n (\n {\n items,\n title,\n description,\n maxVisible = 2,\n defaultCollapsed = true,\n onDismiss,\n closable = true,\n onDismissAll,\n dismissAllLabel,\n stretch = false,\n ariaLabel,\n emptyState,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const labelId = useId();\n const listId = useId();\n\n // Track dismissed ids internally so the <li> unmounts even when the\n // consumer doesn't mirror dismissal into `items` — otherwise the list\n // keeps a ghost entry (and the two-column grid a blank cell). Pruned\n // when an id leaves `items`, so a re-pushed item renders again.\n const [dismissedIds, setDismissedIds] = useState<ReadonlySet<string>>(\n () => new Set(),\n );\n useEffect(() => {\n setDismissedIds((prev) => {\n if (prev.size === 0) return prev;\n const ids = new Set(items.map((item) => item.id));\n const next = new Set([...prev].filter((id) => ids.has(id)));\n return next.size === prev.size ? prev : next;\n });\n }, [items]);\n\n const liveItems = useMemo(\n () => items.filter((item) => !dismissedIds.has(item.id)),\n [items, dismissedIds],\n );\n\n const overflow = maxVisible !== undefined && liveItems.length > maxVisible;\n const [collapsed, setCollapsed] = useState(defaultCollapsed);\n\n // Live-region announces the count when items change.\n const liveRef = useRef<HTMLDivElement>(null);\n const lastCountRef = useRef<number>(liveItems.length);\n\n useEffect(() => {\n if (!liveRef.current) return;\n const prev = lastCountRef.current;\n const next = liveItems.length;\n if (prev !== next) {\n liveRef.current.textContent = t('warningStack.countChanged', {\n count: next,\n defaultValue: '{{count}} warnings to review',\n });\n }\n lastCountRef.current = next;\n }, [liveItems.length, t]);\n\n const visible = useMemo(() => {\n if (!overflow || !collapsed) return liveItems;\n return liveItems.slice(0, maxVisible);\n }, [liveItems, overflow, collapsed, maxVisible]);\n\n const hiddenCount = overflow ? liveItems.length - (maxVisible ?? 0) : 0;\n\n /* ----- Empty-collapse phase ------------------------------------- */\n const hasItems = liveItems.length > 0;\n const hasEmptyState = emptyState != null;\n // There is something to show whenever a live notice remains, or an\n // empty state has been supplied to fill the region in its place.\n const present = hasItems || hasEmptyState;\n\n // Only the no-`emptyState` path animates the fold. It runs in two beats\n // so the height transition has a stable start: a CSS transition can't\n // interpolate when the element's content changes in the same commit as\n // the track flip, so `settling` first re-renders the emptied region at\n // full height (track still open), then `closing` flips the track to 0fr\n // on the next frame — now the browser animates from a real height.\n // open → settling → closing → closed (unmounted, until a notice lands)\n const [phase, setPhase] = useState<FoldPhase>(present ? 'open' : 'closed');\n // Drives the expand-in when a notice lands after the region had folded.\n const [entering, setEntering] = useState(false);\n\n useIsomorphicLayoutEffect(() => {\n if (present) {\n if (phase !== 'open') {\n // Replay the expand only when re-appearing from a collapsed state.\n if (phase === 'closing' || phase === 'closed') setEntering(true);\n setPhase('open');\n }\n } else if (phase === 'open') {\n setPhase('settling');\n }\n }, [present, phase]);\n\n // settling → closing: flip the track shut one frame after the emptied\n // region has painted at full height, so the collapse actually animates.\n useEffect(() => {\n if (phase !== 'settling') return;\n const raf = window.requestAnimationFrame(() => setPhase('closing'));\n return () => window.cancelAnimationFrame(raf);\n }, [phase]);\n\n // closing → closed: unmount once the collapse transition has run. The\n // delay is floored so the polite live region (which lives in this subtree)\n // survives long enough for assistive tech to voice the cleared count\n // before the node is removed — otherwise an accessible theme, where\n // `--animation-duration` is 0ms, would unmount in the same frame and\n // swallow the announcement. The region is already collapsed to zero\n // height by then, so the extra mounted time is invisible.\n useEffect(() => {\n if (phase !== 'closing') return;\n const delay = Math.max(readAnimationDurationMs(), MIN_FOLD_UNMOUNT_MS);\n const id = window.setTimeout(() => setPhase('closed'), delay);\n return () => window.clearTimeout(id);\n }, [phase]);\n\n // Expand-in: clear the collapsed start-state on the next frame so the\n // grid track animates open instead of snapping to full height.\n useEffect(() => {\n if (!entering) return;\n const raf = window.requestAnimationFrame(() => setEntering(false));\n return () => window.cancelAnimationFrame(raf);\n }, [entering]);\n\n const closing = phase === 'closing';\n const animCollapsed = closing || entering;\n const mounted = present || phase === 'settling' || phase === 'closing';\n\n // Focus hand-off: dismissing unmounts the focused close button, which\n // would otherwise drop focus to <body> (WCAG 2.4.3). Aim for the\n // dismiss control now occupying the same list position (the next\n // item), else the last remaining one, else the region itself.\n const sectionRef = useRef<HTMLElement | null>(null);\n const setSectionRef = useCallback(\n (node: HTMLElement | null) => {\n sectionRef.current = node;\n if (typeof ref === 'function') {\n ref(node as HTMLDivElement | null);\n } else if (ref) {\n (ref as MutableRefObject<HTMLDivElement | null>).current =\n node as HTMLDivElement | null;\n }\n },\n [ref],\n );\n const pendingFocusIndexRef = useRef<number | null>(null);\n // No dependency array on purpose: this runs after every render but is\n // gated by `pendingFocusIndexRef`, which is only non-null on the render\n // that immediately follows a dismissal. Don't \"fix\" it to `[liveItems]`.\n useEffect(() => {\n if (pendingFocusIndexRef.current === null) return;\n const index = pendingFocusIndexRef.current;\n pendingFocusIndexRef.current = null;\n const section = sectionRef.current;\n if (!section) return;\n const dismissControls = Array.from(\n section.querySelectorAll<HTMLButtonElement>('[data-alert-dismiss]'),\n );\n const target =\n dismissControls[Math.min(index, dismissControls.length - 1)];\n if (target) target.focus();\n // Last notice gone: only land focus on the region if it survives the\n // dismissal (an emptyState keeps it mounted). When the stack folds\n // away entirely there is no stable target here — the consumer owns\n // re-homing focus (see the dashboard pattern) and the live region\n // announces the cleared count.\n else if (hasEmptyState) section.focus();\n });\n\n const handleDismiss = useCallback(\n (item: WarningStackItem, index: number) => (open: boolean) => {\n if (open) return;\n pendingFocusIndexRef.current = index;\n setDismissedIds((prev) => new Set(prev).add(item.id));\n onDismiss?.(item);\n },\n [onDismiss],\n );\n\n // Whole-stack close: dismiss every currently-visible notice in one go,\n // which empties `liveItems` and folds the region away. Focus re-homing on\n // the fold is the consumer's responsibility (same as the last-item case) —\n // there's no surviving in-component target once the header unmounts.\n const handleDismissAll = useCallback(() => {\n setDismissedIds((prev) => {\n const next = new Set(prev);\n for (const item of liveItems) next.add(item.id);\n return next;\n });\n onDismissAll?.();\n }, [liveItems, onDismissAll]);\n\n const toggle = useCallback(() => setCollapsed((c) => !c), []);\n\n const regionLabel = ariaLabel ?? t('warningStack.regionLabel', 'Warnings');\n\n // Title block: a visible header when `title` is provided; otherwise a\n // visually hidden heading so the region still has a programmatic name.\n // A `<div>` rather than `<header>` wrapper keeps the `<header>` element's\n // implicit banner role from leaking out of the region. The whole-stack\n // close control (when enabled) sits at the inline-end of this row.\n const titleBlock = title ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <h2\n id={labelId}\n className=\"ds:text-start type-title-section ds:text-[var(--foreground)]\"\n >\n {title}\n </h2>\n {description ? (\n <p className=\"ds:text-start type-body-sm ds:text-[var(--muted-foreground)]\">\n {description}\n </p>\n ) : null}\n </div>\n ) : (\n <h2 id={labelId} className=\"ds:sr-only\">\n {regionLabel}\n </h2>\n );\n\n const showStackClose = closable && hasItems;\n const header = showStackClose ? (\n <div className=\"ds:flex ds:items-start ds:justify-between ds:gap-[var(--spacing-sm)]\">\n {titleBlock}\n <IconButton\n type=\"button\"\n icon={<X aria-hidden=\"true\" />}\n intent=\"ghost\"\n size=\"sm\"\n aria-label={\n dismissAllLabel ??\n t('warningStack.dismissAll', 'Dismiss all notices')\n }\n onClick={handleDismissAll}\n // Pull flush to the card's inline-end padding edge, and never let\n // the button compress when the title wraps.\n className=\"ds:-me-[var(--spacing-2xs)] ds:shrink-0\"\n />\n </div>\n ) : (\n titleBlock\n );\n\n // Fully folded away (or cold-start empty with no emptyState): render\n // nothing. Matches the long-standing \"empty + no emptyState → null\"\n // contract, now reached via the fold-out animation rather than instantly.\n if (!mounted) return null;\n\n return (\n // Outer: height-collapse track. Carries the bounding marker so it is\n // the cascade-reset boundary even mid-fold.\n <div\n data-component=\"warning-stack\"\n className={collapseTrackClass(animCollapsed, stretch)}\n >\n {/* Inner: cross-fade + overflow clip while folding. */}\n <div className={collapseInnerClass(animCollapsed, closing)}>\n <section\n ref={setSectionRef}\n aria-labelledby={labelId}\n // Programmatically focusable so a surviving region can take the\n // last dismissal's focus (see the focus hand-off above).\n tabIndex={-1}\n className={[stackVariants({ stretch }), className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {header}\n {/* The live region announces the count as it changes. Omitted in\n emptyState mode, where the empty state itself communicates. */}\n {!hasEmptyState ? (\n <div\n ref={liveRef}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ds:sr-only\"\n />\n ) : null}\n {hasItems ? (\n <>\n {/* Container-type lives on this wrapper (never on the flex\n section itself) so the list can query its own inline size. */}\n <div className=\"ds:@container/warning-stack\">\n <ul\n id={listId}\n className={LIST_CLASSES}\n // Neutral wording — the list mixes warnings with info\n // notices and promo offers.\n aria-label={t('warningStack.listLabel', 'Notices')}\n >\n {visible.map((item, index) => {\n const variant = item.variant ?? 'warning';\n return (\n <li key={item.id}>\n <Alert\n variant={variant}\n dismissible={item.dismissible}\n icon={item.icon}\n onOpenChange={handleDismiss(item, index)}\n // Compact: clamp title/description so a notice stays\n // a predictable height — keeps the tray tight and\n // side-by-side cards even.\n clamp\n // Fill the row so side-by-side alerts equalise height.\n className=\"ds:h-full\"\n >\n {/* `as=\"h3\"` keeps a clean heading ladder — the\n stack's h2 labels the region, then each item's\n h3 rises from it. */}\n <Alert.Title as=\"h3\">{item.title}</Alert.Title>\n {item.description ? (\n <Alert.Description>\n {item.description}\n </Alert.Description>\n ) : null}\n {item.actions ? (\n <Alert.Action>{item.actions}</Alert.Action>\n ) : null}\n </Alert>\n </li>\n );\n })}\n </ul>\n </div>\n\n {overflow ? (\n <Button\n type=\"button\"\n intent=\"link\"\n size=\"sm\"\n aria-expanded={!collapsed}\n aria-controls={listId}\n onClick={toggle}\n className={TOGGLE_CLASSES}\n >\n <ChevronDown\n aria-hidden=\"true\"\n className={[\n 'ds:size-4 ds:transition-transform ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n collapsed ? '' : 'ds:rotate-180',\n ].join(' ')}\n />\n {collapsed\n ? t('warningStack.showMore', {\n count: hiddenCount,\n defaultValue: 'Show {{count}} more warnings',\n })\n : t('warningStack.showLess', 'Show less')}\n </Button>\n ) : null}\n </>\n ) : (\n emptyState\n )}\n </section>\n </div>\n </div>\n );\n },\n);\n\nWarningStack.displayName = 'WarningStack';\n"],"names":["stackVariants","cva","LIST_CLASSES","TOGGLE_CLASSES","MIN_FOLD_UNMOUNT_MS","readAnimationDurationMs","trimmed","n","collapseTrackClass","collapsed","stretch","collapseInnerClass","closing","WarningStack","forwardRef","items","title","description","maxVisible","defaultCollapsed","onDismiss","closable","onDismissAll","dismissAllLabel","ariaLabel","emptyState","className","rest","ref","t","useTranslation","labelId","useId","listId","dismissedIds","setDismissedIds","useState","useEffect","prev","ids","item","next","id","liveItems","useMemo","overflow","setCollapsed","liveRef","useRef","lastCountRef","visible","hiddenCount","hasItems","hasEmptyState","present","phase","setPhase","entering","setEntering","useIsomorphicLayoutEffect","raf","delay","animCollapsed","mounted","sectionRef","setSectionRef","useCallback","node","pendingFocusIndexRef","index","section","dismissControls","target","handleDismiss","open","handleDismissAll","toggle","c","regionLabel","titleBlock","jsxs","jsx","header","IconButton","X","Fragment","variant","Alert","Button","ChevronDown"],"mappings":";;;;;;;;;;AAsCA,MAAMA,KAAgBC;AAAA,EACpB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA;AAAA;AAAA;AAAA,MAIR,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ,GASMC,KAAe;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,GAAG,GAEJC,KAAiB;AAAA,EACrB;AACF,EAAE,KAAK,GAAG,GAiBJC,KAAsB;AAI5B,SAASC,KAAkC;AACzC,MAAI,OAAO,SAAW,IAAa,QAAO;AAI1C,QAAMC,IAHM,OACT,iBAAiB,SAAS,eAAe,EACzC,iBAAiB,sBAAsB,EACtB,KAAA,GACdC,IAAI,WAAWD,CAAO;AAC5B,SAAK,OAAO,SAASC,CAAC,IACfD,EAAQ,SAAS,IAAI,IAAIC,IAAIA,IAAI,MADR;AAElC;AAIA,SAASC,GAAmBC,GAAoBC,GAA0B;AACxE,SAAO;A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","sources":["../../src/components/warning-stack/warning-stack.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type MutableRefObject,\n type ReactNode,\n} from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { useTranslation } from 'react-i18next';\nimport { ChevronDown, X } from 'lucide-react';\nimport { useIsomorphicLayoutEffect } from '../../hooks/use-isomorphic-layout-effect';\nimport { Alert, type AlertProps } from '../alert/alert';\nimport { Button } from '../button/button';\nimport { IconButton } from '../button/icon-button';\n\n/* ------------------------------------------------------------------ */\n/* Types */\n/* ------------------------------------------------------------------ */\n\nexport interface WarningStackItem {\n id: string;\n variant?: AlertProps['variant'];\n title: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n actions?: ReactNode;\n dismissible?: boolean;\n}\n\n/** Empty-collapse fold phases (no-`emptyState` path only). See the fold\n * state machine in the component body. */\ntype FoldPhase = 'open' | 'settling' | 'closing' | 'closed';\n\nconst stackVariants = cva(\n [\n 'ds:flex ds:flex-col ds:gap-[var(--spacing-md)]',\n 'ds:rounded-[var(--radius-lg)]',\n 'ds:bg-[color:var(--card)] ds:text-[color:var(--card-foreground)]',\n 'ds:shadow-[var(--shadow-card)]',\n 'ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2',\n 'ds:p-[var(--spacing-md)]',\n ].join(' '),\n {\n variants: {\n // `stretch: true` fills the parent layout cell — mirrors the `stretch`\n // prop on `Card` so a WarningStack rendered next to a Card in a grid\n // row ends up at matching height.\n stretch: {\n true: 'ds:h-full ds:self-stretch',\n false: '',\n },\n },\n defaultVariants: {\n stretch: false,\n },\n },\n);\n\n// Single column by default; two columns once the stack itself is wide\n// enough (container query — viewport width lies when the stack sits in\n// a narrow grid cell). A trailing odd item spans both columns so the\n// grid never ends on a half-width hole, which also keeps a lone item\n// full-width exactly as before.\n// 768px, not the `@3xl` rem alias: container-query `rem` resolves against the\n// host's root font-size, so a non-16px root silently moves the threshold.\nconst LIST_CLASSES = [\n 'ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)]',\n 'ds:@[768px]/warning-stack:grid-cols-2',\n 'ds:@[768px]/warning-stack:[&>li:nth-child(odd):last-child]:col-span-full',\n].join(' ');\n\nconst TOGGLE_CLASSES = [\n 'ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] ds:self-start',\n].join(' ');\n\n/* ------------------------------------------------------------------ */\n/* Empty-collapse animation */\n/* */\n/* When the stack empties (every notice dismissed) and no `emptyState` */\n/* is supplied, the whole region folds away instead of leaving a hole. */\n/* The grid `1fr → 0fr` track is the only CSS-only way to animate to/ */\n/* from `height: auto`; JS-measured `max-height` is barred by the */\n/* no-inline-styles constraint. The outer wrapper owns the height */\n/* track; the inner wrapper owns the cross-fade + overflow clip. */\n/* ------------------------------------------------------------------ */\n\n/** Floor for how long the folding region stays mounted after it empties, so a\n * screen reader can voice the cleared count even when `--animation-duration`\n * is 0ms (accessible themes). The region is already visually collapsed, so\n * this window is imperceptible. */\nconst MIN_FOLD_UNMOUNT_MS = 250;\n\n/** Reads `--animation-duration` (ms) so the unmount timer matches the\n * CSS transition. Falls back to 200ms when it can't be resolved. */\nfunction readAnimationDurationMs(): number {\n if (typeof window === 'undefined') return 200;\n const raw = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue('--animation-duration');\n const trimmed = raw.trim();\n const n = parseFloat(trimmed);\n if (!Number.isFinite(n)) return 200;\n return trimmed.endsWith('ms') ? n : n * 1000;\n}\n\n/** Outer height-collapse track. Always a grid so the `grid-template-rows`\n * transition has a stable from/to; only the row size flips. */\nfunction collapseTrackClass(collapsed: boolean, stretch: boolean): string {\n return [\n 'ds:grid ds:transition-[grid-template-rows]',\n 'ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n collapsed ? 'ds:grid-rows-[0fr]' : 'ds:grid-rows-[1fr]',\n stretch ? 'ds:h-full ds:self-stretch' : '',\n ]\n .filter(Boolean)\n .join(' ');\n}\n\n/** Inner cross-fade layer. `min-h-0` lets the grid item shrink below its\n * content; `overflow-hidden` (only while animating) clips the fold so the\n * card's resting drop-shadow isn't clipped at rest. */\nfunction collapseInnerClass(collapsed: boolean, closing: boolean): string {\n return [\n 'ds:min-h-0',\n 'ds:transition-opacity ds:duration-[var(--animation-duration)]',\n 'ds:motion-reduce:transition-none',\n collapsed ? 'ds:opacity-0 ds:overflow-hidden' : 'ds:opacity-100',\n closing ? 'ds:pointer-events-none' : '',\n ]\n .filter(Boolean)\n .join(' ');\n}\n\nexport interface WarningStackProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'role' | 'title'>,\n VariantProps<typeof stackVariants> {\n /** Items rendered inside the stack. */\n items: WarningStackItem[];\n /** Fill the parent layout cell — use in a dashboard grid row so the\n * stack ends up with matching height to sibling Cards. */\n stretch?: boolean;\n /** Visible title rendered as an `<h2>` above the stack. Also labels the\n * region for assistive tech. When omitted, the region is labelled via a\n * visually hidden heading using `ariaLabel` (or the default \"Warnings\"). */\n title?: ReactNode;\n /** Optional short description rendered under the title. */\n description?: ReactNode;\n /** Cap on visible items before a \"Show N more\" toggle appears. Defaults to\n * `2`; pass a larger number (or `Infinity`) to show more before collapsing. */\n maxVisible?: number;\n /** Whether the stack starts collapsed when items exceed `maxVisible`. */\n defaultCollapsed?: boolean;\n /** Fires when a dismissible item's close control is activated. */\n onDismiss?: (item: WarningStackItem) => void;\n /** Whether the whole-stack close control is shown at the header's inline-end.\n * Defaults to `true` — the tray is closable. Set `false` for stacks that\n * carry notices which must not be bulk-cleared (e.g. hard compliance blocks). */\n closable?: boolean;\n /** Fires when the whole-stack close control is activated, after every\n * currently-visible notice has been dismissed (folding the region away).\n * Optional — the fold happens internally regardless; supply this only to\n * mirror the bulk dismissal into the consumer's own store. */\n onDismissAll?: () => void;\n /** Accessible label for the whole-stack close control. Defaults to the\n * localised \"Dismiss all notices\". */\n dismissAllLabel?: string;\n /** Accessible label for the region when `title` is not set. */\n ariaLabel?: string;\n /** Optional node rendered when the stack has zero items. */\n emptyState?: ReactNode;\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport const WarningStack = forwardRef<HTMLDivElement, WarningStackProps>(\n (\n {\n items,\n title,\n description,\n maxVisible = 2,\n defaultCollapsed = true,\n onDismiss,\n closable = true,\n onDismissAll,\n dismissAllLabel,\n stretch = false,\n ariaLabel,\n emptyState,\n className,\n ...rest\n },\n ref,\n ) => {\n const { t } = useTranslation();\n const labelId = useId();\n const listId = useId();\n\n // Track dismissed ids internally so the <li> unmounts even when the\n // consumer doesn't mirror dismissal into `items` — otherwise the list\n // keeps a ghost entry (and the two-column grid a blank cell). Pruned\n // when an id leaves `items`, so a re-pushed item renders again.\n const [dismissedIds, setDismissedIds] = useState<ReadonlySet<string>>(\n () => new Set(),\n );\n useEffect(() => {\n setDismissedIds((prev) => {\n if (prev.size === 0) return prev;\n const ids = new Set(items.map((item) => item.id));\n const next = new Set([...prev].filter((id) => ids.has(id)));\n return next.size === prev.size ? prev : next;\n });\n }, [items]);\n\n const liveItems = useMemo(\n () => items.filter((item) => !dismissedIds.has(item.id)),\n [items, dismissedIds],\n );\n\n const overflow = maxVisible !== undefined && liveItems.length > maxVisible;\n const [collapsed, setCollapsed] = useState(defaultCollapsed);\n\n // Live-region announces the count when items change.\n const liveRef = useRef<HTMLDivElement>(null);\n const lastCountRef = useRef<number>(liveItems.length);\n\n useEffect(() => {\n if (!liveRef.current) return;\n const prev = lastCountRef.current;\n const next = liveItems.length;\n if (prev !== next) {\n liveRef.current.textContent = t('warningStack.countChanged', {\n count: next,\n defaultValue: '{{count}} warnings to review',\n });\n }\n lastCountRef.current = next;\n }, [liveItems.length, t]);\n\n const visible = useMemo(() => {\n if (!overflow || !collapsed) return liveItems;\n return liveItems.slice(0, maxVisible);\n }, [liveItems, overflow, collapsed, maxVisible]);\n\n const hiddenCount = overflow ? liveItems.length - (maxVisible ?? 0) : 0;\n\n /* ----- Empty-collapse phase ------------------------------------- */\n const hasItems = liveItems.length > 0;\n const hasEmptyState = emptyState != null;\n // There is something to show whenever a live notice remains, or an\n // empty state has been supplied to fill the region in its place.\n const present = hasItems || hasEmptyState;\n\n // Only the no-`emptyState` path animates the fold. It runs in two beats\n // so the height transition has a stable start: a CSS transition can't\n // interpolate when the element's content changes in the same commit as\n // the track flip, so `settling` first re-renders the emptied region at\n // full height (track still open), then `closing` flips the track to 0fr\n // on the next frame — now the browser animates from a real height.\n // open → settling → closing → closed (unmounted, until a notice lands)\n const [phase, setPhase] = useState<FoldPhase>(present ? 'open' : 'closed');\n // Drives the expand-in when a notice lands after the region had folded.\n const [entering, setEntering] = useState(false);\n\n useIsomorphicLayoutEffect(() => {\n if (present) {\n if (phase !== 'open') {\n // Replay the expand only when re-appearing from a collapsed state.\n if (phase === 'closing' || phase === 'closed') setEntering(true);\n setPhase('open');\n }\n } else if (phase === 'open') {\n setPhase('settling');\n }\n }, [present, phase]);\n\n // settling → closing: flip the track shut one frame after the emptied\n // region has painted at full height, so the collapse actually animates.\n useEffect(() => {\n if (phase !== 'settling') return;\n const raf = window.requestAnimationFrame(() => setPhase('closing'));\n return () => window.cancelAnimationFrame(raf);\n }, [phase]);\n\n // closing → closed: unmount once the collapse transition has run. The\n // delay is floored so the polite live region (which lives in this subtree)\n // survives long enough for assistive tech to voice the cleared count\n // before the node is removed — otherwise an accessible theme, where\n // `--animation-duration` is 0ms, would unmount in the same frame and\n // swallow the announcement. The region is already collapsed to zero\n // height by then, so the extra mounted time is invisible.\n useEffect(() => {\n if (phase !== 'closing') return;\n const delay = Math.max(readAnimationDurationMs(), MIN_FOLD_UNMOUNT_MS);\n const id = window.setTimeout(() => setPhase('closed'), delay);\n return () => window.clearTimeout(id);\n }, [phase]);\n\n // Expand-in: clear the collapsed start-state on the next frame so the\n // grid track animates open instead of snapping to full height.\n useEffect(() => {\n if (!entering) return;\n const raf = window.requestAnimationFrame(() => setEntering(false));\n return () => window.cancelAnimationFrame(raf);\n }, [entering]);\n\n const closing = phase === 'closing';\n const animCollapsed = closing || entering;\n const mounted = present || phase === 'settling' || phase === 'closing';\n\n // Focus hand-off: dismissing unmounts the focused close button, which\n // would otherwise drop focus to <body> (WCAG 2.4.3). Aim for the\n // dismiss control now occupying the same list position (the next\n // item), else the last remaining one, else the region itself.\n const sectionRef = useRef<HTMLElement | null>(null);\n const setSectionRef = useCallback(\n (node: HTMLElement | null) => {\n sectionRef.current = node;\n if (typeof ref === 'function') {\n ref(node as HTMLDivElement | null);\n } else if (ref) {\n (ref as MutableRefObject<HTMLDivElement | null>).current =\n node as HTMLDivElement | null;\n }\n },\n [ref],\n );\n const pendingFocusIndexRef = useRef<number | null>(null);\n // No dependency array on purpose: this runs after every render but is\n // gated by `pendingFocusIndexRef`, which is only non-null on the render\n // that immediately follows a dismissal. Don't \"fix\" it to `[liveItems]`.\n useEffect(() => {\n if (pendingFocusIndexRef.current === null) return;\n const index = pendingFocusIndexRef.current;\n pendingFocusIndexRef.current = null;\n const section = sectionRef.current;\n if (!section) return;\n const dismissControls = Array.from(\n section.querySelectorAll<HTMLButtonElement>('[data-alert-dismiss]'),\n );\n const target =\n dismissControls[Math.min(index, dismissControls.length - 1)];\n if (target) target.focus();\n // Last notice gone: only land focus on the region if it survives the\n // dismissal (an emptyState keeps it mounted). When the stack folds\n // away entirely there is no stable target here — the consumer owns\n // re-homing focus (see the dashboard pattern) and the live region\n // announces the cleared count.\n else if (hasEmptyState) section.focus();\n });\n\n const handleDismiss = useCallback(\n (item: WarningStackItem, index: number) => (open: boolean) => {\n if (open) return;\n pendingFocusIndexRef.current = index;\n setDismissedIds((prev) => new Set(prev).add(item.id));\n onDismiss?.(item);\n },\n [onDismiss],\n );\n\n // Whole-stack close: dismiss every currently-visible notice in one go,\n // which empties `liveItems` and folds the region away. Focus re-homing on\n // the fold is the consumer's responsibility (same as the last-item case) —\n // there's no surviving in-component target once the header unmounts.\n const handleDismissAll = useCallback(() => {\n setDismissedIds((prev) => {\n const next = new Set(prev);\n for (const item of liveItems) next.add(item.id);\n return next;\n });\n onDismissAll?.();\n }, [liveItems, onDismissAll]);\n\n const toggle = useCallback(() => setCollapsed((c) => !c), []);\n\n const regionLabel = ariaLabel ?? t('warningStack.regionLabel', 'Warnings');\n\n // Title block: a visible header when `title` is provided; otherwise a\n // visually hidden heading so the region still has a programmatic name.\n // A `<div>` rather than `<header>` wrapper keeps the `<header>` element's\n // implicit banner role from leaking out of the region. The whole-stack\n // close control (when enabled) sits at the inline-end of this row.\n const titleBlock = title ? (\n <div className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]\">\n <h2\n id={labelId}\n className=\"ds:text-start type-title-section ds:text-[var(--foreground)]\"\n >\n {title}\n </h2>\n {description ? (\n <p className=\"ds:text-start type-body-sm ds:text-[var(--muted-foreground)]\">\n {description}\n </p>\n ) : null}\n </div>\n ) : (\n <h2 id={labelId} className=\"ds:sr-only\">\n {regionLabel}\n </h2>\n );\n\n const showStackClose = closable && hasItems;\n const header = showStackClose ? (\n <div className=\"ds:flex ds:items-start ds:justify-between ds:gap-[var(--spacing-sm)]\">\n {titleBlock}\n <IconButton\n type=\"button\"\n icon={<X aria-hidden=\"true\" />}\n intent=\"ghost\"\n size=\"sm\"\n aria-label={\n dismissAllLabel ??\n t('warningStack.dismissAll', 'Dismiss all notices')\n }\n onClick={handleDismissAll}\n // Pull flush to the card's inline-end padding edge, and never let\n // the button compress when the title wraps.\n className=\"ds:-me-[var(--spacing-2xs)] ds:shrink-0\"\n />\n </div>\n ) : (\n titleBlock\n );\n\n // Fully folded away (or cold-start empty with no emptyState): render\n // nothing. Matches the long-standing \"empty + no emptyState → null\"\n // contract, now reached via the fold-out animation rather than instantly.\n if (!mounted) return null;\n\n return (\n // Outer: height-collapse track. Carries the bounding marker so it is\n // the cascade-reset boundary even mid-fold.\n <div\n data-component=\"warning-stack\"\n className={collapseTrackClass(animCollapsed, stretch)}\n >\n {/* Inner: cross-fade + overflow clip while folding. */}\n <div className={collapseInnerClass(animCollapsed, closing)}>\n <section\n ref={setSectionRef}\n aria-labelledby={labelId}\n // Programmatically focusable so a surviving region can take the\n // last dismissal's focus (see the focus hand-off above).\n tabIndex={-1}\n className={[stackVariants({ stretch }), className]\n .filter(Boolean)\n .join(' ')}\n {...rest}\n >\n {header}\n {/* The live region announces the count as it changes. Omitted in\n emptyState mode, where the empty state itself communicates. */}\n {!hasEmptyState ? (\n <div\n ref={liveRef}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ds:sr-only\"\n />\n ) : null}\n {hasItems ? (\n <>\n {/* Container-type lives on this wrapper (never on the flex\n section itself) so the list can query its own inline size. */}\n <div className=\"ds:@container/warning-stack\">\n <ul\n id={listId}\n className={LIST_CLASSES}\n // Neutral wording — the list mixes warnings with info\n // notices and promo offers.\n aria-label={t('warningStack.listLabel', 'Notices')}\n >\n {visible.map((item, index) => {\n const variant = item.variant ?? 'warning';\n return (\n <li key={item.id}>\n <Alert\n variant={variant}\n dismissible={item.dismissible}\n icon={item.icon}\n onOpenChange={handleDismiss(item, index)}\n // Compact: clamp title/description so a notice stays\n // a predictable height — keeps the tray tight and\n // side-by-side cards even.\n clamp\n // Fill the row so side-by-side alerts equalise height.\n className=\"ds:h-full\"\n >\n {/* `as=\"h3\"` keeps a clean heading ladder — the\n stack's h2 labels the region, then each item's\n h3 rises from it. */}\n <Alert.Title as=\"h3\">{item.title}</Alert.Title>\n {item.description ? (\n <Alert.Description>\n {item.description}\n </Alert.Description>\n ) : null}\n {item.actions ? (\n <Alert.Action>{item.actions}</Alert.Action>\n ) : null}\n </Alert>\n </li>\n );\n })}\n </ul>\n </div>\n\n {overflow ? (\n <Button\n type=\"button\"\n intent=\"link\"\n size=\"sm\"\n aria-expanded={!collapsed}\n aria-controls={listId}\n onClick={toggle}\n className={TOGGLE_CLASSES}\n >\n <ChevronDown\n aria-hidden=\"true\"\n className={[\n 'ds:size-4 ds:transition-transform ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none',\n collapsed ? '' : 'ds:rotate-180',\n ].join(' ')}\n />\n {collapsed\n ? t('warningStack.showMore', {\n count: hiddenCount,\n defaultValue: 'Show {{count}} more warnings',\n })\n : t('warningStack.showLess', 'Show less')}\n </Button>\n ) : null}\n </>\n ) : (\n emptyState\n )}\n </section>\n </div>\n </div>\n );\n },\n);\n\nWarningStack.displayName = 'WarningStack';\n"],"names":["stackVariants","cva","LIST_CLASSES","TOGGLE_CLASSES","MIN_FOLD_UNMOUNT_MS","readAnimationDurationMs","trimmed","n","collapseTrackClass","collapsed","stretch","collapseInnerClass","closing","WarningStack","forwardRef","items","title","description","maxVisible","defaultCollapsed","onDismiss","closable","onDismissAll","dismissAllLabel","ariaLabel","emptyState","className","rest","ref","t","useTranslation","labelId","useId","listId","dismissedIds","setDismissedIds","useState","useEffect","prev","ids","item","next","id","liveItems","useMemo","overflow","setCollapsed","liveRef","useRef","lastCountRef","visible","hiddenCount","hasItems","hasEmptyState","present","phase","setPhase","entering","setEntering","useIsomorphicLayoutEffect","raf","delay","animCollapsed","mounted","sectionRef","setSectionRef","useCallback","node","pendingFocusIndexRef","index","section","dismissControls","target","handleDismiss","open","handleDismissAll","toggle","c","regionLabel","titleBlock","jsxs","jsx","header","IconButton","X","Fragment","variant","Alert","Button","ChevronDown"],"mappings":";;;;;;;;;;AAsCA,MAAMA,KAAgBC;AAAA,EACpB;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EACA,KAAK,GAAG;AAAA,EACV;AAAA,IACE,UAAU;AAAA;AAAA;AAAA;AAAA,MAIR,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA,MAAA;AAAA,IACT;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ,GASMC,KAAe;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,GAAG,GAEJC,KAAiB;AA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B,EAAE,yBAAyB;AAAA,0BACzB,OAAOsB;AAAA,0BACP,cAAc;AAAA,wBAAA,CACf,IACDtB,EAAE,yBAAyB,WAAW;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAAA,IAE1C;AAAA,gBAAA,EAAA,CACN,IAEAJ;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA,EAEJ,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,QA9GiB;AAAA,EAiHvB;AACF;AAEAZ,GAAa,cAAc;"}
@@ -12,7 +12,7 @@ import { c as D } from "./createLucideIcon-DhHxpK9K.js";
12
12
  import { T as ae } from "./trash-2-uumy3fy1.js";
13
13
  import { C as Ne } from "./circle-j7oZoouK.js";
14
14
  import { u as Ce } from "./registry-DvAUVLHh.js";
15
- import { A as $ } from "./alert-Cxaqd-QO.js";
15
+ import { A as $ } from "./alert-DS22ha1n.js";
16
16
  import { B as _e } from "./button-CPGiR_bH.js";
17
17
  import { D as N } from "./dropdown-menu-DU-Hrf33.js";
18
18
  import { E } from "./empty-state-CrLsi0XI.js";
@@ -1353,4 +1353,4 @@ export {
1353
1353
  ee as r,
1354
1354
  L as w
1355
1355
  };
1356
- //# sourceMappingURL=workflow-map-SIfAhmWz.js.map
1356
+ //# sourceMappingURL=workflow-map-ByyBYj6Y.js.map