@alfadocs/ui-kit-debug 0.94.0 → 0.96.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 (134) hide show
  1. package/dist/_chunks/{apexcharts-theme-fAQXLIMW.js → apexcharts-theme-B_AxGC_h.js} +25 -20
  2. package/dist/_chunks/apexcharts-theme-B_AxGC_h.js.map +1 -0
  3. package/dist/_chunks/chart-DR68TJD5.js +705 -0
  4. package/dist/_chunks/chart-DR68TJD5.js.map +1 -0
  5. package/dist/_chunks/{date-range-picker-Cfv4Sr63.js → date-range-picker-pEG3Ln3i.js} +314 -297
  6. package/dist/_chunks/date-range-picker-pEG3Ln3i.js.map +1 -0
  7. package/dist/_chunks/{link-cell-renderer-_LDZhY4r.js → link-cell-renderer-flfZh2qY.js} +2 -2
  8. package/dist/_chunks/{link-cell-renderer-_LDZhY4r.js.map → link-cell-renderer-flfZh2qY.js.map} +1 -1
  9. package/dist/_chunks/{patient-table-CFM92QqU.js → patient-table-CvZTIM2R.js} +2 -2
  10. package/dist/_chunks/{patient-table-CFM92QqU.js.map → patient-table-CvZTIM2R.js.map} +1 -1
  11. package/dist/_chunks/{radiograph-panel.agent-DDnDGVpN.js → radiograph-panel.agent-AsXJBr1p.js} +2 -2
  12. package/dist/_chunks/{radiograph-panel.agent-DDnDGVpN.js.map → radiograph-panel.agent-AsXJBr1p.js.map} +1 -1
  13. package/dist/_chunks/signature-request-BzXTV_RH.js +403 -0
  14. package/dist/_chunks/signature-request-BzXTV_RH.js.map +1 -0
  15. package/dist/_chunks/{sparkline-o6JH4O66.js → sparkline-DcXqRZoq.js} +2 -2
  16. package/dist/_chunks/{sparkline-o6JH4O66.js.map → sparkline-DcXqRZoq.js.map} +1 -1
  17. package/dist/agent-catalog.json +10 -6
  18. package/dist/agent-i18n/en.json +1 -1
  19. package/dist/components/chart/chart.d.ts +12 -5
  20. package/dist/components/chart/chart.d.ts.map +1 -1
  21. package/dist/components/chart/index.js +1 -1
  22. package/dist/components/data-table/index.js +1 -1
  23. package/dist/components/date-range-picker/date-range-picker.d.ts +10 -1
  24. package/dist/components/date-range-picker/date-range-picker.d.ts.map +1 -1
  25. package/dist/components/date-range-picker/index.js +1 -1
  26. package/dist/components/patient-table/index.js +1 -1
  27. package/dist/components/radiograph-panel/index.js +1 -1
  28. package/dist/components/sparkline/index.js +1 -1
  29. package/dist/i18n/locales/ar.d.ts +3 -1
  30. package/dist/i18n/locales/ar.d.ts.map +1 -1
  31. package/dist/i18n/locales/ar.js +3 -1
  32. package/dist/i18n/locales/ar.js.map +1 -1
  33. package/dist/i18n/locales/de.d.ts +3 -1
  34. package/dist/i18n/locales/de.d.ts.map +1 -1
  35. package/dist/i18n/locales/de.js +3 -1
  36. package/dist/i18n/locales/de.js.map +1 -1
  37. package/dist/i18n/locales/el.d.ts +3 -1
  38. package/dist/i18n/locales/el.d.ts.map +1 -1
  39. package/dist/i18n/locales/el.js +3 -1
  40. package/dist/i18n/locales/el.js.map +1 -1
  41. package/dist/i18n/locales/en.d.ts +3 -1
  42. package/dist/i18n/locales/en.d.ts.map +1 -1
  43. package/dist/i18n/locales/en.js +3 -1
  44. package/dist/i18n/locales/en.js.map +1 -1
  45. package/dist/i18n/locales/es.d.ts +3 -1
  46. package/dist/i18n/locales/es.d.ts.map +1 -1
  47. package/dist/i18n/locales/es.js +3 -1
  48. package/dist/i18n/locales/es.js.map +1 -1
  49. package/dist/i18n/locales/fr.d.ts +3 -1
  50. package/dist/i18n/locales/fr.d.ts.map +1 -1
  51. package/dist/i18n/locales/fr.js +3 -1
  52. package/dist/i18n/locales/fr.js.map +1 -1
  53. package/dist/i18n/locales/hi.d.ts +3 -1
  54. package/dist/i18n/locales/hi.d.ts.map +1 -1
  55. package/dist/i18n/locales/hi.js +3 -1
  56. package/dist/i18n/locales/hi.js.map +1 -1
  57. package/dist/i18n/locales/it.d.ts +3 -1
  58. package/dist/i18n/locales/it.d.ts.map +1 -1
  59. package/dist/i18n/locales/it.js +3 -1
  60. package/dist/i18n/locales/it.js.map +1 -1
  61. package/dist/i18n/locales/ja.d.ts +3 -1
  62. package/dist/i18n/locales/ja.d.ts.map +1 -1
  63. package/dist/i18n/locales/ja.js +3 -1
  64. package/dist/i18n/locales/ja.js.map +1 -1
  65. package/dist/i18n/locales/nl.d.ts +3 -1
  66. package/dist/i18n/locales/nl.d.ts.map +1 -1
  67. package/dist/i18n/locales/nl.js +3 -1
  68. package/dist/i18n/locales/nl.js.map +1 -1
  69. package/dist/i18n/locales/pl.d.ts +3 -1
  70. package/dist/i18n/locales/pl.d.ts.map +1 -1
  71. package/dist/i18n/locales/pl.js +3 -1
  72. package/dist/i18n/locales/pl.js.map +1 -1
  73. package/dist/i18n/locales/pt.d.ts +3 -1
  74. package/dist/i18n/locales/pt.d.ts.map +1 -1
  75. package/dist/i18n/locales/pt.js +3 -1
  76. package/dist/i18n/locales/pt.js.map +1 -1
  77. package/dist/i18n/locales/ro.d.ts +3 -1
  78. package/dist/i18n/locales/ro.d.ts.map +1 -1
  79. package/dist/i18n/locales/ro.js +3 -1
  80. package/dist/i18n/locales/ro.js.map +1 -1
  81. package/dist/i18n/locales/ru.d.ts +3 -1
  82. package/dist/i18n/locales/ru.d.ts.map +1 -1
  83. package/dist/i18n/locales/ru.js +3 -1
  84. package/dist/i18n/locales/ru.js.map +1 -1
  85. package/dist/i18n/locales/sq.d.ts +3 -1
  86. package/dist/i18n/locales/sq.d.ts.map +1 -1
  87. package/dist/i18n/locales/sq.js +3 -1
  88. package/dist/i18n/locales/sq.js.map +1 -1
  89. package/dist/i18n/locales/sv.d.ts +3 -1
  90. package/dist/i18n/locales/sv.d.ts.map +1 -1
  91. package/dist/i18n/locales/sv.js +3 -1
  92. package/dist/i18n/locales/sv.js.map +1 -1
  93. package/dist/i18n/locales/tr.d.ts +3 -1
  94. package/dist/i18n/locales/tr.d.ts.map +1 -1
  95. package/dist/i18n/locales/tr.js +3 -1
  96. package/dist/i18n/locales/tr.js.map +1 -1
  97. package/dist/i18n/locales/zh.d.ts +3 -1
  98. package/dist/i18n/locales/zh.d.ts.map +1 -1
  99. package/dist/i18n/locales/zh.js +3 -1
  100. package/dist/i18n/locales/zh.js.map +1 -1
  101. package/dist/index.js +7 -7
  102. package/dist/locales/ar.json +3 -1
  103. package/dist/locales/de.json +3 -1
  104. package/dist/locales/el.json +3 -1
  105. package/dist/locales/en.json +3 -1
  106. package/dist/locales/es.json +3 -1
  107. package/dist/locales/fr.json +3 -1
  108. package/dist/locales/hi.json +3 -1
  109. package/dist/locales/it.json +3 -1
  110. package/dist/locales/ja.json +3 -1
  111. package/dist/locales/nl.json +3 -1
  112. package/dist/locales/pl.json +3 -1
  113. package/dist/locales/pt.json +3 -1
  114. package/dist/locales/ro.json +3 -1
  115. package/dist/locales/ru.json +3 -1
  116. package/dist/locales/sq.json +3 -1
  117. package/dist/locales/sv.json +3 -1
  118. package/dist/locales/tr.json +3 -1
  119. package/dist/locales/zh.json +3 -1
  120. package/dist/patterns/signature-request/index.d.ts +1 -1
  121. package/dist/patterns/signature-request/index.d.ts.map +1 -1
  122. package/dist/patterns/signature-request/index.js +1 -1
  123. package/dist/patterns/signature-request/signature-request.d.ts +30 -3
  124. package/dist/patterns/signature-request/signature-request.d.ts.map +1 -1
  125. package/dist/tokens/apexcharts-theme.d.ts +19 -33
  126. package/dist/tokens/apexcharts-theme.d.ts.map +1 -1
  127. package/dist/tokens.css +1 -1
  128. package/package.json +1 -1
  129. package/dist/_chunks/apexcharts-theme-fAQXLIMW.js.map +0 -1
  130. package/dist/_chunks/chart-DqxVCm1I.js +0 -664
  131. package/dist/_chunks/chart-DqxVCm1I.js.map +0 -1
  132. package/dist/_chunks/date-range-picker-Cfv4Sr63.js.map +0 -1
  133. package/dist/_chunks/signature-request-D_6jgDZd.js +0 -324
  134. package/dist/_chunks/signature-request-D_6jgDZd.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit-debug",
3
- "version": "0.94.0",
3
+ "version": "0.96.0",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe. (debug build — identical runtime to @alfadocs/ui-kit, ships source maps for symbolication).",
6
6
  "license": "BUSL-1.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"apexcharts-theme-fAQXLIMW.js","sources":["../../src/components/_shared/use-neutralize-hidden-focus.ts","../../src/tokens/apexcharts-theme.ts"],"sourcesContent":["import { useEffect, type RefObject } from 'react';\n\n/* -------------------------------------------------------------------- */\n/* useNeutraliseHiddenFocus */\n/* */\n/* axe's `aria-hidden-focus` rule (correctly) flags focusable */\n/* descendants of `aria-hidden=\"true\"` subtrees. Several DS components */\n/* embed third-party renders (ApexCharts, FullCalendar) that inject */\n/* focusable elements (canvases with tabindex, anchor wrappers) inside */\n/* a wrapper that we deliberately mark `aria-hidden` because the outer */\n/* element carries the accessible name (`role=\"img\"` + `aria-label`). */\n/* */\n/* This hook walks the ref tree on mount and on subtree mutation, and */\n/* sets `tabindex=\"-1\"` on focusable descendants of any aria-hidden */\n/* ancestor. Cheaper than forking the third-party render and keeps the */\n/* fix scoped to the component using it. */\n/* -------------------------------------------------------------------- */\n\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button',\n 'input',\n 'select',\n 'textarea',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(',');\n\nexport function useNeutraliseHiddenFocus<T extends HTMLElement>(\n containerRef: RefObject<T | null>,\n): void {\n useEffect(() => {\n const root = containerRef.current;\n if (!root) return undefined;\n\n const neutralise = () => {\n root\n .querySelectorAll<HTMLElement>('[aria-hidden=\"true\"]')\n .forEach((hidden) => {\n hidden\n .querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)\n .forEach((el) => {\n el.setAttribute('tabindex', '-1');\n });\n });\n };\n\n neutralise();\n const observer = new MutationObserver(neutralise);\n observer.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['aria-hidden', 'tabindex'],\n });\n return () => observer.disconnect();\n }, [containerRef]);\n}\n","import type ApexCharts from 'apexcharts';\n\n/**\n * Resolved colours for a `ChartSeries` `role: 'compare'` overlay (see\n * `src/components/chart/chart.tsx`). ApexCharts cannot read `var(--…)` or a\n * `color-mix()` string, so both are resolved to a usable colour value here —\n * the same native way the ramp resolves `--primary` — and re-read on the\n * chart's existing theme MutationObserver, so they retint per theme with no\n * new observer and no hex literal in component code.\n */\nexport interface ApexCompareColors {\n /**\n * Load-bearing solid neutral grey — the compare line stroke, the compare bar\n * fill base, the area gradient source, and the greyed legend swatch. Sourced\n * from `--muted-foreground` (a plain `var(--color-blue-*)` chain), which\n * `getPropertyValue` already returns as a usable colour. Solid so it clears\n * WCAG 1.4.11 3:1 as a graphical object — which the 55% `--calendar-compare-edge`\n * mix does not.\n */\n mark: string;\n /**\n * Decorative faint grey wash for the compare area gradient tint only.\n * Sourced from `--calendar-compare-fill`, which is a `color-mix()` string\n * that `getPropertyValue` returns UNRESOLVED, so it is resolved via a\n * detached probe (see `resolveColour`).\n */\n wash: string;\n}\n\n/** The theme-bridge output, plus resolved compare-overlay colours. */\nexport interface ApexChartsTheme extends ApexCharts.ApexOptions {\n /**\n * Resolved compare-overlay colours. Read ONLY inside the chart's\n * `hasCompare` branches and never spread into the ApexCharts options object,\n * so a chart with no compare series emits byte-identical options.\n */\n compare?: ApexCompareColors;\n}\n\n/**\n * Resolve a colour-accepting token value the ApexCharts way: set it on a real\n * colour property of a detached probe appended to `document.documentElement`\n * (which carries the active `theme-*` class, so a per-theme `color-mix()`\n * resolves to the correct grey), read the computed value back, then remove the\n * probe. Returns the input untouched when there is no DOM (SSR) or when the\n * browser rejected the value.\n *\n * The probe mutates only `documentElement`'s child list, never its `class`\n * attribute, so it does not trip the chart's class-only MutationObserver.\n */\nfunction resolveColour(value: string): string {\n if (typeof document === 'undefined' || !value) return value;\n const probe = document.createElement('span');\n probe.style.backgroundColor = value;\n document.documentElement.appendChild(probe);\n const resolved = getComputedStyle(probe).backgroundColor;\n probe.remove();\n return resolved || value;\n}\n\nexport function getApexChartsTheme(): ApexChartsTheme {\n const styles = getComputedStyle(document.documentElement);\n const get = (v: string) => styles.getPropertyValue(v).trim();\n const isDark = document.documentElement.classList.contains('theme-dark');\n return {\n theme: { mode: isDark ? 'dark' : 'light' },\n colors: [\n get('--primary'),\n get('--accent'),\n get('--success'),\n get('--warning'),\n ],\n chart: {\n background: get('--background'),\n foreColor: get('--foreground'),\n fontFamily: get('--font-sans'),\n },\n grid: { borderColor: get('--border') },\n compare: {\n // `--muted-foreground` is a plain `var(--color-blue-*)` chain — already a\n // usable colour, so no probe is needed.\n mark: get('--muted-foreground'),\n // `--calendar-compare-fill` is a `color-mix()` string — resolve it.\n wash: resolveColour(get('--calendar-compare-fill')),\n },\n };\n}\n"],"names":["FOCUSABLE_SELECTOR","useNeutraliseHiddenFocus","containerRef","useEffect","root","neutralise","hidden","el","observer","resolveColour","value","probe","resolved","getApexChartsTheme","styles","get","v"],"mappings":";AAkBA,MAAMA,IAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,GAAG;AAEH,SAASC,EACdC,GACM;AACN,EAAAC,EAAU,MAAM;AACd,UAAMC,IAAOF,EAAa;AAC1B,QAAI,CAACE,EAAM;AAEX,UAAMC,IAAa,MAAM;AACvB,MAAAD,EACG,iBAA8B,sBAAsB,EACpD,QAAQ,CAACE,MAAW;AACnB,QAAAA,EACG,iBAA8BN,CAAkB,EAChD,QAAQ,CAACO,MAAO;AACf,UAAAA,EAAG,aAAa,YAAY,IAAI;AAAA,QAClC,CAAC;AAAA,MACL,CAAC;AAAA,IACL;AAEA,IAAAF,EAAA;AACA,UAAMG,IAAW,IAAI,iBAAiBH,CAAU;AAChD,WAAAG,EAAS,QAAQJ,GAAM;AAAA,MACrB,WAAW;AAAA,MACX,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,iBAAiB,CAAC,eAAe,UAAU;AAAA,IAAA,CAC5C,GACM,MAAMI,EAAS,WAAA;AAAA,EACxB,GAAG,CAACN,CAAY,CAAC;AACnB;ACNA,SAASO,EAAcC,GAAuB;AAC5C,MAAI,OAAO,WAAa,OAAe,CAACA,EAAO,QAAOA;AACtD,QAAMC,IAAQ,SAAS,cAAc,MAAM;AAC3C,EAAAA,EAAM,MAAM,kBAAkBD,GAC9B,SAAS,gBAAgB,YAAYC,CAAK;AAC1C,QAAMC,IAAW,iBAAiBD,CAAK,EAAE;AACzC,SAAAA,EAAM,OAAA,GACCC,KAAYF;AACrB;AAEO,SAASG,IAAsC;AACpD,QAAMC,IAAS,iBAAiB,SAAS,eAAe,GAClDC,IAAM,CAACC,MAAcF,EAAO,iBAAiBE,CAAC,EAAE,KAAA;AAEtD,SAAO;AAAA,IACL,OAAO,EAAE,MAFI,SAAS,gBAAgB,UAAU,SAAS,YAAY,IAE7C,SAAS,QAAA;AAAA,IACjC,QAAQ;AAAA,MACND,EAAI,WAAW;AAAA,MACfA,EAAI,UAAU;AAAA,MACdA,EAAI,WAAW;AAAA,MACfA,EAAI,WAAW;AAAA,IAAA;AAAA,IAEjB,OAAO;AAAA,MACL,YAAYA,EAAI,cAAc;AAAA,MAC9B,WAAWA,EAAI,cAAc;AAAA,MAC7B,YAAYA,EAAI,aAAa;AAAA,IAAA;AAAA,IAE/B,MAAM,EAAE,aAAaA,EAAI,UAAU,EAAA;AAAA,IACnC,SAAS;AAAA;AAAA;AAAA,MAGP,MAAMA,EAAI,oBAAoB;AAAA;AAAA,MAE9B,MAAMN,EAAcM,EAAI,yBAAyB,CAAC;AAAA,IAAA;AAAA,EACpD;AAEJ;"}
@@ -1,664 +0,0 @@
1
- import { jsxs as R, jsx as c } from "react/jsx-runtime";
2
- import { forwardRef as _e, useId as xe, useMemo as h, useRef as ze, useState as D, useEffect as he, useImperativeHandle as Ee } from "react";
3
- import { c as Ne } from "./index-D2ZczOXr.js";
4
- import { useTranslation as Ae } from "react-i18next";
5
- import Oe from "react-apexcharts";
6
- import ue from "apexcharts";
7
- import { u as Be, g as me } from "./apexcharts-theme-fAQXLIMW.js";
8
- import { u as Pe } from "./use-prefers-reduced-motion-BMwIQRjB.js";
9
- import { u as Me } from "./registry-DvAUVLHh.js";
10
- import { I as $e } from "./icon-button-C_kbcd7I.js";
11
- import { I as He } from "./icon-button-group-BLHPN6jg.js";
12
- import { c as L } from "./createLucideIcon-DhHxpK9K.js";
13
- /**
14
- * @license lucide-react v1.22.0 - ISC
15
- *
16
- * This source code is licensed under the ISC license.
17
- * See the LICENSE file in the root directory of this source tree.
18
- */
19
- const We = [
20
- ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
21
- [
22
- "path",
23
- {
24
- d: "M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",
25
- key: "q0gr47"
26
- }
27
- ]
28
- ], Ge = L("chart-area", We);
29
- /**
30
- * @license lucide-react v1.22.0 - ISC
31
- *
32
- * This source code is licensed under the ISC license.
33
- * See the LICENSE file in the root directory of this source tree.
34
- */
35
- const je = [
36
- ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
37
- ["path", { d: "M18 17V9", key: "2bz60n" }],
38
- ["path", { d: "M13 17V5", key: "1frdt8" }],
39
- ["path", { d: "M8 17v-3", key: "17ska0" }]
40
- ], De = L("chart-column", je);
41
- /**
42
- * @license lucide-react v1.22.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */
47
- const Ke = [
48
- ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
49
- ["path", { d: "m19 9-5 5-4-4-3 3", key: "2osh9i" }]
50
- ], Ue = L("chart-line", Ke);
51
- /**
52
- * @license lucide-react v1.22.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */
57
- const Ve = [
58
- [
59
- "path",
60
- {
61
- d: "M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",
62
- key: "pzmjnu"
63
- }
64
- ],
65
- ["path", { d: "M21.21 15.89A10 10 0 1 1 8 2.83", key: "k2fpak" }]
66
- ], Ye = L("chart-pie", Ve);
67
- /**
68
- * @license lucide-react v1.22.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */
73
- const qe = [
74
- [
75
- "path",
76
- {
77
- d: "M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3",
78
- key: "19sr3x"
79
- }
80
- ],
81
- ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
82
- ], Ze = L("donut", qe), Fe = {
83
- id: "chart",
84
- // view_change backs the opt-in type switcher (`switchableTypes` prop):
85
- // the same chart re-presented as line / bar / area / pie / donut.
86
- capabilities: ["view_change"],
87
- state: {
88
- declaredType: {
89
- type: "'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'",
90
- descriptionKey: "ui.agent.chart.state.declaredType",
91
- description: "The consumer-declared chart type — the shape `update_series` expects.",
92
- read: (o) => o.getTypeState().declaredType
93
- },
94
- effectiveType: {
95
- type: "'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'",
96
- descriptionKey: "ui.agent.chart.state.effectiveType",
97
- description: "The type currently rendered — differs from declaredType after a type-switcher pick.",
98
- read: (o) => o.getTypeState().effectiveType
99
- },
100
- availableTypes: {
101
- type: "ChartType[]",
102
- descriptionKey: "ui.agent.chart.state.availableTypes",
103
- description: "Types the switcher offers. Empty when the chart has no type switcher.",
104
- read: (o) => o.getTypeState().availableTypes
105
- }
106
- },
107
- actions: {
108
- change_view: {
109
- // Switching the presentation is a write (it changes what the user
110
- // sees) but is trivially reversible by switching back.
111
- safety: "write",
112
- argsType: "type",
113
- argsSchema: {
114
- type: "object",
115
- properties: {
116
- type: {
117
- type: "string",
118
- enum: ["line", "bar", "area", "pie", "donut"],
119
- description: "The chart type to render."
120
- }
121
- },
122
- required: ["type"]
123
- },
124
- returns: "boolean (accepted)",
125
- returnsSchema: {
126
- type: "boolean",
127
- description: "True when the switch was applied; false when the chart has no type switcher or the type is not offered (check availableTypes first)."
128
- },
129
- idempotent: !0,
130
- descriptionKey: "ui.agent.chart.actions.changeView",
131
- description: "Switch the rendered chart type via the type switcher. No-op (returns false) when the chart has no switcher or the type is not offered.",
132
- invoke: (o, f) => o.setType(f.type)
133
- },
134
- update_series: {
135
- // Replacing the rendered series mutates what the chart displays — it
136
- // is a write, reversible by pushing the prior series back.
137
- safety: "write",
138
- argsType: "series",
139
- // `series` is `ChartSeries[]` (line/bar/area) OR `number[]`
140
- // (pie/donut/radialBar). Both shapes are accepted; the handle routes
141
- // by chart type internally.
142
- argsSchema: {
143
- type: "object",
144
- properties: {
145
- series: {
146
- oneOf: [
147
- {
148
- type: "array",
149
- description: "Categorical series for line / bar / area charts.",
150
- items: {
151
- type: "object",
152
- properties: {
153
- name: { type: "string" },
154
- data: { type: "array", items: { type: "number" } },
155
- role: {
156
- type: "string",
157
- enum: ["primary", "compare"],
158
- description: "Optional. 'compare' renders this series as a secondary, colour-blind-safe overlay (e.g. the previous period) — dashed grey for line/area, hatched grey for bar. Omit for a normal primary series."
159
- }
160
- },
161
- required: ["name", "data"]
162
- }
163
- },
164
- {
165
- type: "array",
166
- description: "Flat values for pie / donut / radialBar charts.",
167
- items: { type: "number" }
168
- }
169
- ]
170
- }
171
- },
172
- required: ["series"]
173
- },
174
- idempotent: !0,
175
- descriptionKey: "ui.agent.chart.actions.updateSeries",
176
- description: "Replace the chart series without remounting. Pass the DECLARED type’s shape (see declaredType state) — when the user has switched the view cross-shape the values are converted to the rendered shape. The write targets the live instance only: a later type switch re-reads the original props and discards it.",
177
- invoke: (o, f) => {
178
- o.updateSeries(f.series);
179
- }
180
- },
181
- export_png: {
182
- safety: "read",
183
- returns: "string (PNG data URI)",
184
- returnsSchema: {
185
- type: "string",
186
- description: "A `data:image/png;base64,…` URI of the rendered chart."
187
- },
188
- idempotent: !0,
189
- descriptionKey: "ui.agent.chart.actions.exportPng",
190
- description: "Return a PNG data URI of the chart for export or screenshotting.",
191
- invoke: (o) => o.dataURI()
192
- }
193
- },
194
- domHooks: {
195
- root: { attr: "data-component", value: "chart" },
196
- instanceId: {
197
- attr: "data-component-id",
198
- sourceProp: "id",
199
- description: "Sourced from the id prop."
200
- }
201
- }
202
- }, Je = Ne("ds:relative ds:block ds:w-full", {
203
- variants: {
204
- density: {
205
- compact: "ds:min-h-[var(--chart-min-height-compact)]",
206
- comfortable: "ds:min-h-[var(--chart-min-height-comfortable)]",
207
- // Applied when an explicit `height` prop is given and no density was
208
- // requested: the wrapper must not exceed the caller's height (a 96px
209
- // KPI chart inside a card must not reserve 320px).
210
- none: ""
211
- }
212
- },
213
- defaultVariants: { density: "comfortable" }
214
- }), K = [
215
- "verticalLines",
216
- "horizontalLines",
217
- "slantedLines",
218
- "squares",
219
- "circles"
220
- ], Qe = ["line", "bar", "area"], Xe = ["pie", "donut", "radialBar"], fe = [
221
- "line",
222
- "bar",
223
- "area",
224
- "pie",
225
- "donut"
226
- ], et = {
227
- line: "chart.typeSwitcher.line",
228
- bar: "chart.typeSwitcher.bar",
229
- area: "chart.typeSwitcher.area",
230
- pie: "chart.typeSwitcher.pie",
231
- donut: "chart.typeSwitcher.donut"
232
- }, tt = {
233
- line: /* @__PURE__ */ c(Ue, {}),
234
- bar: /* @__PURE__ */ c(De, {}),
235
- area: /* @__PURE__ */ c(Ge, {}),
236
- pie: /* @__PURE__ */ c(Ye, {}),
237
- donut: /* @__PURE__ */ c(Ze, {})
238
- };
239
- function v(o) {
240
- return Xe.includes(o);
241
- }
242
- function U(o) {
243
- return Qe.includes(o);
244
- }
245
- function at(o, f) {
246
- return v(f) ? [
247
- {
248
- name: "",
249
- data: o
250
- }
251
- ] : o;
252
- }
253
- const rt = _e(
254
- ({
255
- title: o,
256
- id: f,
257
- type: u,
258
- series: _,
259
- categories: V,
260
- labels: N,
261
- height: Y,
262
- width: ye,
263
- patterns: q = !1,
264
- stacked: Z = !1,
265
- orientation: A = "vertical",
266
- curve: F = "smooth",
267
- colors: x,
268
- toolbar: O = !1,
269
- locale: be,
270
- radialValueFormatter: g,
271
- valueFormatter: J,
272
- switchableTypes: z,
273
- onTypeChange: B,
274
- density: ve,
275
- className: Q
276
- }, ge) => {
277
- const { t: i, i18n: Te } = Ae(), X = xe(), T = h(
278
- () => `chart-${X.replace(/[^a-zA-Z0-9-_]/g, "")}`,
279
- [X]
280
- ), P = `${T}-summary`, M = ze(null), [ee, Se] = D(0);
281
- Be(M);
282
- const S = be ?? Te.language ?? "en", [te, we] = D(() => {
283
- try {
284
- return me();
285
- } catch {
286
- return {};
287
- }
288
- });
289
- he(() => {
290
- if (typeof document > "u") return;
291
- let e;
292
- const t = new MutationObserver(() => {
293
- clearTimeout(e), e = setTimeout(() => {
294
- try {
295
- we(me());
296
- } catch {
297
- }
298
- }, 50);
299
- });
300
- return t.observe(document.documentElement, {
301
- attributes: !0,
302
- attributeFilter: ["class"]
303
- }), () => {
304
- clearTimeout(e), t.disconnect();
305
- };
306
- }, []), he(() => {
307
- const e = M.current;
308
- if (!e || typeof ResizeObserver > "u") return;
309
- const t = new ResizeObserver((n) => {
310
- const p = n[0];
311
- p && Se(Math.floor(p.contentRect.width));
312
- });
313
- return t.observe(e), () => t.disconnect();
314
- }, []);
315
- const w = h(() => {
316
- if (!z || z.length === 0) return [];
317
- const e = z.filter(
318
- (n) => fe.includes(n)
319
- );
320
- if (!fe.includes(u))
321
- return [];
322
- const t = e.includes(u) ? e : [u, ...e];
323
- return [...new Set(t)];
324
- }, [z, u]), b = w.length >= 2, [$, ae] = D(null), a = b && $ && w.includes($) ? $ : u, H = v(u), re = v(a), { effectiveSeries: y, effectiveCategories: E, effectiveLabels: I } = h(() => {
325
- if (H === re)
326
- return {
327
- effectiveSeries: _,
328
- effectiveCategories: V,
329
- effectiveLabels: N
330
- };
331
- if (!H) {
332
- const n = _.filter((s) => s.role !== "compare");
333
- return {
334
- effectiveSeries: n.map(
335
- (s) => s.data.reduce((d, C) => d + C, 0)
336
- ),
337
- effectiveCategories: void 0,
338
- effectiveLabels: n.map((s) => s.name)
339
- };
340
- }
341
- const e = _;
342
- return {
343
- effectiveSeries: [
344
- { name: i("chart.table.value"), data: e }
345
- ],
346
- effectiveCategories: N ?? [],
347
- effectiveLabels: void 0
348
- };
349
- }, [_, V, N, H, re, i]), W = h(
350
- () => ({
351
- async dataURI() {
352
- const e = ue.getChartByID(T);
353
- return e ? (await e.dataURI()).imgURI : "";
354
- },
355
- updateSeries(e) {
356
- const t = ue.getChartByID(T);
357
- if (!t) return;
358
- const n = v(u), p = v(a);
359
- if (n === p) {
360
- t.updateSeries(e);
361
- return;
362
- }
363
- if (!n) {
364
- const s = e.filter(
365
- (d) => d.role !== "compare"
366
- );
367
- t.updateOptions(
368
- { labels: s.map((d) => d.name) },
369
- !1,
370
- !0
371
- ), t.updateSeries(
372
- s.map((d) => d.data.reduce((C, l) => C + l, 0))
373
- );
374
- return;
375
- }
376
- t.updateSeries([
377
- { name: i("chart.table.value"), data: e }
378
- ]);
379
- },
380
- setType(e) {
381
- return !b || !w.includes(e) ? !1 : (ae(e), !0);
382
- },
383
- getTypeState() {
384
- return {
385
- declaredType: u,
386
- effectiveType: a,
387
- availableTypes: b ? [...w] : []
388
- };
389
- }
390
- }),
391
- [T, u, a, i, b, w]
392
- );
393
- Ee(ge, () => W, [W]), Me(Fe, W, f);
394
- const G = typeof document < "u" && document.documentElement.dir === "rtl", oe = h(
395
- () => at(y, a),
396
- [y, a]
397
- ), ie = h(
398
- () => new Intl.NumberFormat(S),
399
- [S]
400
- ), k = h(
401
- () => J ?? ((e) => ie.format(e)),
402
- [J, ie]
403
- ), se = h(
404
- () => ({
405
- name: S,
406
- options: {
407
- toolbar: {
408
- download: i("chart.toolbar.download"),
409
- selection: i("chart.toolbar.selection"),
410
- selectionZoom: i("chart.toolbar.selectionZoom"),
411
- zoomIn: i("chart.toolbar.zoomIn"),
412
- zoomOut: i("chart.toolbar.zoomOut"),
413
- pan: i("chart.toolbar.pan"),
414
- reset: i("chart.toolbar.reset"),
415
- exportToSVG: i("chart.toolbar.exportToSVG"),
416
- exportToPNG: i("chart.toolbar.exportToPNG"),
417
- exportToCSV: i("chart.toolbar.exportToCSV")
418
- }
419
- }
420
- }),
421
- [S, i]
422
- ), j = Pe(), ke = h(() => {
423
- var ce, de, le;
424
- const { compare: e, ...t } = te, n = (e == null ? void 0 : e.mark) ?? "", p = (e == null ? void 0 : e.wash) ?? "", s = U(a) && Array.isArray(y) ? y.map((r) => r.role === "compare") : [], d = s.some(Boolean), C = d && a === "bar", l = {
425
- ...t,
426
- chart: {
427
- ...t.chart,
428
- id: T,
429
- toolbar: { show: O },
430
- zoom: { enabled: O },
431
- animations: {
432
- enabled: !j,
433
- dynamicAnimation: { enabled: !j }
434
- },
435
- locales: [se],
436
- defaultLocale: S,
437
- parentHeightOffset: 0,
438
- // Stacking is an axis-only concept — gate on the categorical types
439
- // so a slice/radial chart never receives it, and omit the key
440
- // entirely when unstacked so the default output is byte-identical.
441
- ...Z && U(a) ? { stacked: !0 } : {}
442
- },
443
- // Only set `labels` when the effective type actually has them (slice
444
- // charts). Emitting `labels: undefined` crashes ApexCharts' bar
445
- // renderer — `parseDataAxisCharts` reads `labels.length` and throws
446
- // "Cannot read properties of undefined (reading 'length')", which
447
- // aborts the render and leaves a blank chart. Absent is safe; area /
448
- // line tolerate the undefined but bar does not, so never pass it.
449
- ...I ? { labels: I } : {},
450
- legend: {
451
- ...t.legend,
452
- position: "bottom",
453
- // ApexCharts legend.horizontalAlign is a physical prop mapped internally
454
- // to the chart's own text flow. For RTL we flip via `yaxis.opposite`
455
- // and ApexCharts' own `direction: 'rtl'` handling; legend stays anchored
456
- // to the inline-start by asking for 'left' on LTR and 'right' on RTL.
457
- horizontalAlign: G ? "right" : "left",
458
- fontFamily: "inherit"
459
- },
460
- tooltip: {
461
- ...t.tooltip,
462
- y: {
463
- formatter: (r) => k(r)
464
- }
465
- },
466
- noData: {
467
- text: i("chart.noData")
468
- }
469
- };
470
- if (x && x.length > 0 && (l.colors = x), d) {
471
- const r = l.colors ?? t.colors ?? [];
472
- l.colors = y.map(
473
- (m, pe) => s[pe] ? n : r[pe % Math.max(r.length, 1)]
474
- );
475
- }
476
- if (U(a)) {
477
- const r = a === "bar" && A === "horizontal";
478
- l.xaxis = {
479
- ...t.xaxis,
480
- categories: E ?? [],
481
- ...r ? {
482
- labels: {
483
- formatter: (m) => k(Number(m))
484
- }
485
- } : {}
486
- }, l.yaxis = {
487
- ...t.yaxis,
488
- opposite: G,
489
- ...r ? {} : { labels: { formatter: (m) => k(m) } }
490
- }, l.stroke = {
491
- curve: F,
492
- width: a === "bar" ? 0 : 2,
493
- ...d && a !== "bar" ? { dashArray: s.map((m) => m ? 6 : 0) } : {}
494
- }, l.dataLabels = { enabled: !1 };
495
- }
496
- if (a === "radialBar" && g) {
497
- const r = t.plotOptions ?? {};
498
- l.plotOptions = {
499
- ...r,
500
- radialBar: {
501
- ...r.radialBar ?? {},
502
- dataLabels: {
503
- ...((ce = r.radialBar) == null ? void 0 : ce.dataLabels) ?? {},
504
- value: {
505
- ...((le = (de = r.radialBar) == null ? void 0 : de.dataLabels) == null ? void 0 : le.value) ?? {},
506
- formatter: (m) => g(Number(m))
507
- }
508
- }
509
- }
510
- };
511
- }
512
- if (a === "bar" && A === "horizontal") {
513
- const r = t.plotOptions ?? {};
514
- l.plotOptions = {
515
- ...r,
516
- bar: { ...r.bar ?? {}, horizontal: !0 }
517
- };
518
- }
519
- return q ? l.fill = {
520
- type: "pattern",
521
- opacity: a === "area" ? 0.3 : 1,
522
- pattern: {
523
- style: d ? s.map(
524
- (r, m) => r ? "slantedLines" : K[m % K.length]
525
- ) : [...K],
526
- strokeWidth: 2
527
- }
528
- } : C ? l.fill = {
529
- type: s.map((r) => r ? "pattern" : "solid"),
530
- pattern: {
531
- style: s.map(
532
- (r) => r ? "slantedLines" : "horizontalLines"
533
- ),
534
- strokeWidth: 2
535
- }
536
- } : a === "area" && (l.fill = d ? {
537
- type: "gradient",
538
- opacity: s.map((r) => r ? 0.15 : 0.3),
539
- gradient: {
540
- gradientToColors: s.map(
541
- (r) => r ? p : void 0
542
- )
543
- }
544
- } : {
545
- type: "gradient",
546
- opacity: 0.3
547
- }), l;
548
- }, [
549
- te,
550
- T,
551
- O,
552
- j,
553
- se,
554
- S,
555
- I,
556
- k,
557
- i,
558
- a,
559
- y,
560
- E,
561
- G,
562
- q,
563
- Z,
564
- A,
565
- F,
566
- x,
567
- g
568
- ]), Ie = ye ?? (ee > 0 ? ee : "100%"), Ce = Y ?? 320, Re = h(() => {
569
- const e = v(a) ? I ?? [] : E ?? [], t = oe;
570
- return /* @__PURE__ */ R("table", { id: P, className: "ds:sr-only", children: [
571
- /* @__PURE__ */ c("caption", { children: o }),
572
- /* @__PURE__ */ c("thead", { children: /* @__PURE__ */ R("tr", { children: [
573
- /* @__PURE__ */ c("th", { scope: "col", children: i("chart.table.series") }),
574
- e.map((n, p) => /* @__PURE__ */ c("th", { scope: "col", children: n }, `${n}-${p}`))
575
- ] }) }),
576
- /* @__PURE__ */ c("tbody", { children: t.map((n, p) => /* @__PURE__ */ R("tr", { children: [
577
- /* @__PURE__ */ c("th", { scope: "row", children: n.name || i("chart.table.value") }),
578
- n.data.map((s, d) => /* @__PURE__ */ c("td", { children: a === "radialBar" && g ? g(s) : k(s) }, `${p}-${d}`))
579
- ] }, `${n.name}-${p}`)) })
580
- ] });
581
- }, [
582
- a,
583
- oe,
584
- I,
585
- E,
586
- P,
587
- o,
588
- i,
589
- k,
590
- g
591
- ]), Le = h(() => (v(a), y), [y, a]), ne = /* @__PURE__ */ R(
592
- "div",
593
- {
594
- ref: M,
595
- role: "img",
596
- "aria-label": o,
597
- "aria-describedby": P,
598
- className: Je({
599
- // Explicit height wins over the density min-height unless the
600
- // caller also asked for a density explicitly.
601
- density: ve ?? (Y !== void 0 ? "none" : void 0),
602
- className: b ? void 0 : Q
603
- }),
604
- ...b ? {} : { "data-component": "chart", "data-component-id": f },
605
- children: [
606
- Re,
607
- /* @__PURE__ */ c(
608
- Oe,
609
- {
610
- type: a,
611
- series: Le,
612
- options: ke,
613
- width: Ie,
614
- height: Ce,
615
- "aria-hidden": "true"
616
- },
617
- a
618
- )
619
- ]
620
- }
621
- );
622
- return b ? /* @__PURE__ */ R(
623
- "div",
624
- {
625
- "data-component": "chart",
626
- "data-component-id": f,
627
- className: `ds:block ds:w-full ${Q ?? ""}`.trim(),
628
- children: [
629
- /* @__PURE__ */ c("div", { className: "ds:mb-[var(--spacing-xs)] ds:flex ds:justify-end", children: /* @__PURE__ */ c(
630
- He,
631
- {
632
- role: "radiogroup",
633
- mode: "toggle-single",
634
- size: "sm",
635
- "aria-label": i("chart.typeSwitcher.label"),
636
- value: a,
637
- onValueChange: (e) => {
638
- e !== a && (ae(e), B == null || B(e));
639
- },
640
- children: w.map((e) => /* @__PURE__ */ c(
641
- $e,
642
- {
643
- value: e,
644
- type: "button",
645
- icon: tt[e],
646
- "aria-label": i(et[e])
647
- },
648
- e
649
- ))
650
- }
651
- ) }),
652
- ne
653
- ]
654
- }
655
- ) : ne;
656
- }
657
- );
658
- rt.displayName = "Chart";
659
- export {
660
- rt as C,
661
- Je as a,
662
- Fe as c
663
- };
664
- //# sourceMappingURL=chart-DqxVCm1I.js.map