@carto/ps-react-ui 4.4.2 → 4.5.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 (157) hide show
  1. package/dist/download-config-DemuQ3Jm.js +56 -0
  2. package/dist/download-config-DemuQ3Jm.js.map +1 -0
  3. package/dist/error-Cj8eUMrl.js +40 -0
  4. package/dist/error-Cj8eUMrl.js.map +1 -0
  5. package/dist/formatter-B9Bxn1k7.js +6 -0
  6. package/dist/formatter-B9Bxn1k7.js.map +1 -0
  7. package/dist/no-data-DkIt7Qt1.js +61 -0
  8. package/dist/no-data-DkIt7Qt1.js.map +1 -0
  9. package/dist/row-D4VOhcNI.js +34 -0
  10. package/dist/row-D4VOhcNI.js.map +1 -0
  11. package/dist/series-Bola3CmD.js +90 -0
  12. package/dist/series-Bola3CmD.js.map +1 -0
  13. package/dist/styles-Y8q7Jff3.js +118 -0
  14. package/dist/styles-Y8q7Jff3.js.map +1 -0
  15. package/dist/types/widgets/actions/brush-toggle/types.d.ts +8 -2
  16. package/dist/types/widgets/category/components/category-row-multi.d.ts +2 -1
  17. package/dist/types/widgets/category/components/category-row-single.d.ts +2 -1
  18. package/dist/types/widgets/category/types.d.ts +1 -0
  19. package/dist/types/widgets/echart/shared-resize-observer.d.ts +12 -0
  20. package/dist/types/widgets/echart/types.d.ts +2 -0
  21. package/dist/types/widgets/histogram/config.d.ts +15 -3
  22. package/dist/types/widgets/histogram/index.d.ts +2 -1
  23. package/dist/types/widgets/histogram/types.d.ts +6 -3
  24. package/dist/types/widgets/stores/index.d.ts +2 -1
  25. package/dist/types/widgets/stores/types.d.ts +2 -0
  26. package/dist/types/widgets/stores/use-widget-selector.d.ts +35 -0
  27. package/dist/types/widgets/stores/widget-store-performance.test.d.ts +1 -0
  28. package/dist/types/widgets/stores/widget-store.d.ts +49 -27
  29. package/dist/types/widgets/table/types.d.ts +1 -1
  30. package/dist/types/widgets/utils/chart-config/index.d.ts +1 -1
  31. package/dist/types/widgets/utils/chart-config/option-builders.d.ts +13 -8
  32. package/dist/types/widgets/utils/formatter.d.ts +1 -0
  33. package/dist/types/widgets/utils/index.d.ts +1 -1
  34. package/dist/use-widget-ref-BFazQvJK.js +22 -0
  35. package/dist/use-widget-ref-BFazQvJK.js.map +1 -0
  36. package/dist/use-widget-selector-DqRmWQ1K.js +12 -0
  37. package/dist/use-widget-selector-DqRmWQ1K.js.map +1 -0
  38. package/dist/widget-store-CIrb9RKP.js +263 -0
  39. package/dist/widget-store-CIrb9RKP.js.map +1 -0
  40. package/dist/widgets/actions.js +799 -817
  41. package/dist/widgets/actions.js.map +1 -1
  42. package/dist/widgets/bar.js +53 -47
  43. package/dist/widgets/bar.js.map +1 -1
  44. package/dist/widgets/category.js +261 -255
  45. package/dist/widgets/category.js.map +1 -1
  46. package/dist/widgets/echart.js +109 -99
  47. package/dist/widgets/echart.js.map +1 -1
  48. package/dist/widgets/error.js +1 -1
  49. package/dist/widgets/formula.js +71 -63
  50. package/dist/widgets/formula.js.map +1 -1
  51. package/dist/widgets/histogram.js +119 -80
  52. package/dist/widgets/histogram.js.map +1 -1
  53. package/dist/widgets/loader.js +53 -60
  54. package/dist/widgets/loader.js.map +1 -1
  55. package/dist/widgets/markdown.js +51 -50
  56. package/dist/widgets/markdown.js.map +1 -1
  57. package/dist/widgets/no-data.js +1 -1
  58. package/dist/widgets/pie.js +111 -99
  59. package/dist/widgets/pie.js.map +1 -1
  60. package/dist/widgets/range.js +146 -144
  61. package/dist/widgets/range.js.map +1 -1
  62. package/dist/widgets/scatterplot.js +50 -44
  63. package/dist/widgets/scatterplot.js.map +1 -1
  64. package/dist/widgets/skeleton-loader.js +18 -17
  65. package/dist/widgets/skeleton-loader.js.map +1 -1
  66. package/dist/widgets/spread.js +110 -94
  67. package/dist/widgets/spread.js.map +1 -1
  68. package/dist/widgets/stores.js +5 -2
  69. package/dist/widgets/stores.js.map +1 -1
  70. package/dist/widgets/table.js +422 -436
  71. package/dist/widgets/table.js.map +1 -1
  72. package/dist/widgets/timeseries.js +52 -46
  73. package/dist/widgets/timeseries.js.map +1 -1
  74. package/dist/widgets/toolbar-actions.js +101 -6693
  75. package/dist/widgets/toolbar-actions.js.map +1 -1
  76. package/dist/widgets/utils.js +16 -14
  77. package/dist/widgets/utils.js.map +1 -1
  78. package/dist/widgets/wrapper.js +156 -158
  79. package/dist/widgets/wrapper.js.map +1 -1
  80. package/dist/widgets.js +4 -4
  81. package/package.json +5 -4
  82. package/src/hooks/use-widget-ref.ts +3 -4
  83. package/src/widgets/README.md +3 -3
  84. package/src/widgets/actions/brush-toggle/brush-toggle.tsx +60 -79
  85. package/src/widgets/actions/brush-toggle/types.ts +8 -2
  86. package/src/widgets/actions/change-column/change-column.tsx +15 -15
  87. package/src/widgets/actions/change-column/sortable-column-item.tsx +3 -1
  88. package/src/widgets/actions/download/download.tsx +4 -3
  89. package/src/widgets/actions/fullscreen/fullscreen.tsx +7 -11
  90. package/src/widgets/actions/lock-selection/lock-selection.tsx +12 -15
  91. package/src/widgets/actions/relative-data/relative-data.tsx +22 -26
  92. package/src/widgets/actions/searcher/searcher-toggle.tsx +11 -12
  93. package/src/widgets/actions/searcher/searcher.tsx +20 -21
  94. package/src/widgets/actions/stack-toggle/stack-toggle.tsx +15 -21
  95. package/src/widgets/actions/zoom-toggle/zoom-toggle.tsx +27 -43
  96. package/src/widgets/bar/config.ts +22 -14
  97. package/src/widgets/category/category-ui.tsx +31 -27
  98. package/src/widgets/category/components/category-row-multi.tsx +6 -2
  99. package/src/widgets/category/components/category-row-single.tsx +5 -1
  100. package/src/widgets/category/types.ts +1 -0
  101. package/src/widgets/echart/echart-ui.test.tsx +20 -16
  102. package/src/widgets/echart/echart-ui.tsx +6 -12
  103. package/src/widgets/echart/echart.tsx +13 -27
  104. package/src/widgets/echart/shared-resize-observer.ts +45 -0
  105. package/src/widgets/echart/types.ts +2 -0
  106. package/src/widgets/error/error.tsx +7 -9
  107. package/src/widgets/formula/components/prefix.tsx +4 -6
  108. package/src/widgets/formula/components/row.tsx +4 -4
  109. package/src/widgets/formula/components/series.tsx +4 -6
  110. package/src/widgets/formula/components/suffix.tsx +4 -6
  111. package/src/widgets/formula/components/value.tsx +9 -16
  112. package/src/widgets/histogram/config.ts +101 -20
  113. package/src/widgets/histogram/index.ts +6 -1
  114. package/src/widgets/histogram/types.ts +9 -3
  115. package/src/widgets/loader/loader.tsx +31 -44
  116. package/src/widgets/markdown/markdown.tsx +4 -7
  117. package/src/widgets/no-data/no-data.tsx +7 -10
  118. package/src/widgets/pie/config.ts +17 -5
  119. package/src/widgets/range/components/range-item.tsx +20 -18
  120. package/src/widgets/scatterplot/config.ts +8 -3
  121. package/src/widgets/skeleton-loader/skeleton-loader.tsx +2 -5
  122. package/src/widgets/spread/components/max-value.tsx +14 -16
  123. package/src/widgets/spread/components/min-value.tsx +14 -16
  124. package/src/widgets/stores/index.ts +2 -1
  125. package/src/widgets/stores/types.ts +2 -0
  126. package/src/widgets/stores/use-widget-selector.ts +47 -0
  127. package/src/widgets/stores/widget-store-performance.test.ts +750 -0
  128. package/src/widgets/stores/widget-store.test.ts +81 -0
  129. package/src/widgets/stores/widget-store.ts +225 -44
  130. package/src/widgets/table/config.ts +0 -1
  131. package/src/widgets/table/hooks/use-pagination.ts +28 -52
  132. package/src/widgets/table/hooks/use-selection.ts +20 -24
  133. package/src/widgets/table/hooks/use-sort.ts +22 -39
  134. package/src/widgets/table/types.ts +1 -1
  135. package/src/widgets/timeseries/config.ts +21 -13
  136. package/src/widgets/utils/chart-config/index.ts +1 -1
  137. package/src/widgets/utils/chart-config/option-builders.ts +22 -12
  138. package/src/widgets/utils/formatter.ts +2 -1
  139. package/src/widgets/utils/index.ts +1 -1
  140. package/src/widgets/wrapper/wrapper-ui.tsx +12 -13
  141. package/src/widgets/wrapper/wrapper.tsx +4 -6
  142. package/dist/error-CEkRPccv.js +0 -39
  143. package/dist/error-CEkRPccv.js.map +0 -1
  144. package/dist/formatter-B1Xh8XDH.js +0 -5
  145. package/dist/formatter-B1Xh8XDH.js.map +0 -1
  146. package/dist/no-data-hR3KcJ-_.js +0 -60
  147. package/dist/no-data-hR3KcJ-_.js.map +0 -1
  148. package/dist/row-DTCV0Ocm.js +0 -35
  149. package/dist/row-DTCV0Ocm.js.map +0 -1
  150. package/dist/series-CYNOu2Ju.js +0 -91
  151. package/dist/series-CYNOu2Ju.js.map +0 -1
  152. package/dist/styles-C_8vOEep.js +0 -167
  153. package/dist/styles-C_8vOEep.js.map +0 -1
  154. package/dist/use-widget-ref-wtFLDFCD.js +0 -25
  155. package/dist/use-widget-ref-wtFLDFCD.js.map +0 -1
  156. package/dist/widget-store-CzDt8oSK.js +0 -163
  157. package/dist/widget-store-CzDt8oSK.js.map +0 -1
@@ -0,0 +1,56 @@
1
+ import "react/jsx-runtime";
2
+ import "react/compiler-runtime";
3
+ import "@mui/material";
4
+ import "./widget-store-CIrb9RKP.js";
5
+ import "zustand/shallow";
6
+ import "@mui/icons-material";
7
+ import "react";
8
+ import { d as n, a as s } from "./exports-Cr43OCul.js";
9
+ import "./lasso-tool-BYbxrJ-7.js";
10
+ import "./cjs-D4KH3azB.js";
11
+ import "@dnd-kit/core";
12
+ import "@dnd-kit/sortable";
13
+ import "@dnd-kit/utilities";
14
+ function E(r) {
15
+ const o = [];
16
+ if (r.length > 0 && (r[0]?.length ?? 0) > 0) {
17
+ const i = r?.[0]?.[0] ?? {}, t = Object.keys(i);
18
+ o.push(t);
19
+ }
20
+ return r.forEach((i) => {
21
+ i.forEach((t) => {
22
+ const e = Object.values(t).map((c) => String(c));
23
+ o.push(e);
24
+ });
25
+ }), o;
26
+ }
27
+ function T(r) {
28
+ const o = [];
29
+ return o.push(["x", "y"]), r.forEach((i) => {
30
+ i.forEach((t) => {
31
+ o.push([String(t[0]), String(t[1])]);
32
+ });
33
+ }), o;
34
+ }
35
+ function b(r) {
36
+ return function({
37
+ refUI: o
38
+ }) {
39
+ return [{
40
+ ...n,
41
+ modifier: () => n.modifier(o)
42
+ }, {
43
+ ...s,
44
+ modifier: async (i) => {
45
+ const t = r(i);
46
+ return s.modifier(t);
47
+ }
48
+ }];
49
+ };
50
+ }
51
+ export {
52
+ b as c,
53
+ E as f,
54
+ T as s
55
+ };
56
+ //# sourceMappingURL=download-config-DemuQ3Jm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-config-DemuQ3Jm.js","sources":["../src/widgets/utils/chart-config/csv-modifiers.ts","../src/widgets/utils/chart-config/download-config.ts"],"sourcesContent":["/**\n * Shared CSV export modifiers for chart widgets\n */\n\n/**\n * Flattens object array data into CSV-ready rows.\n * Used by bar, pie, histogram, and timeseries widgets.\n *\n * @param data - Array of series, where each series is an array of data objects\n * @returns CSV rows with headers and values\n */\nexport function flattenObjectArrayToCSV<T extends Record<string, unknown>>(\n data: T[][],\n): string[][] {\n const rows: string[][] = []\n\n // Add headers from first data point if available\n if (data.length > 0 && (data[0]?.length ?? 0) > 0) {\n const firstDataPoint = data?.[0]?.[0] ?? {}\n const headers = Object.keys(firstDataPoint)\n rows.push(headers)\n }\n\n // Add data rows from all series\n data.forEach((series) => {\n series.forEach((dataPoint) => {\n const values = Object.values(dataPoint).map((v) => String(v))\n rows.push(values)\n })\n })\n\n return rows\n}\n\n/**\n * Creates CSV rows for scatterplot data.\n * Scatterplot uses array format [x, y] instead of objects.\n *\n * @param data - Array of series, where each series is an array of [x, y] tuples\n * @returns CSV rows with ['x', 'y'] headers\n */\nexport function scatterplotDataToCSV(data: number[][][]): string[][] {\n const rows: string[][] = []\n\n // Add headers\n rows.push(['x', 'y'])\n\n // Add data rows from all series\n data.forEach((series) => {\n series.forEach((dataPoint) => {\n rows.push([String(dataPoint[0]), String(dataPoint[1])])\n })\n })\n\n return rows\n}\n","import { downloadToCSV, downloadToPNG, type DownloadItem } from '../../actions'\nimport type { ConfigProps } from '../../loader/types'\n\nexport function createChartDownloadConfig<TData>(\n csvModifier: (data: TData) => string[][],\n) {\n return function ({ refUI }: ConfigProps): DownloadItem<TData>[] {\n return [\n {\n ...downloadToPNG,\n modifier: () => downloadToPNG.modifier(refUI),\n },\n {\n ...downloadToCSV,\n modifier: async (data) => {\n const rows = csvModifier(data)\n return downloadToCSV.modifier(rows)\n },\n },\n ]\n }\n}\n"],"names":["flattenObjectArrayToCSV","data","rows","length","firstDataPoint","headers","Object","keys","push","forEach","series","dataPoint","values","map","v","String","scatterplotDataToCSV","createChartDownloadConfig","csvModifier","refUI","downloadToPNG","modifier","downloadToCSV"],"mappings":";;;;;;;;;;;;;AAWO,SAASA,EACdC,GACY;AACZ,QAAMC,IAAmB,CAAA;AAGzB,MAAID,EAAKE,SAAS,MAAMF,EAAK,CAAC,GAAGE,UAAU,KAAK,GAAG;AACjD,UAAMC,IAAiBH,IAAO,CAAC,IAAI,CAAC,KAAK,CAAA,GACnCI,IAAUC,OAAOC,KAAKH,CAAc;AAC1CF,IAAAA,EAAKM,KAAKH,CAAO;AAAA,EACnB;AAGAJ,SAAAA,EAAKQ,QAASC,CAAAA,MAAW;AACvBA,IAAAA,EAAOD,QAASE,CAAAA,MAAc;AAC5B,YAAMC,IAASN,OAAOM,OAAOD,CAAS,EAAEE,IAAKC,CAAAA,MAAMC,OAAOD,CAAC,CAAC;AAC5DZ,MAAAA,EAAKM,KAAKI,CAAM;AAAA,IAClB,CAAC;AAAA,EACH,CAAC,GAEMV;AACT;AASO,SAASc,EAAqBf,GAAgC;AACnE,QAAMC,IAAmB,CAAA;AAGzBA,SAAAA,EAAKM,KAAK,CAAC,KAAK,GAAG,CAAC,GAGpBP,EAAKQ,QAASC,CAAAA,MAAW;AACvBA,IAAAA,EAAOD,QAASE,CAAAA,MAAc;AAC5BT,MAAAA,EAAKM,KAAK,CAACO,OAAOJ,EAAU,CAAC,CAAC,GAAGI,OAAOJ,EAAU,CAAC,CAAC,CAAC,CAAC;AAAA,IACxD,CAAC;AAAA,EACH,CAAC,GAEMT;AACT;ACpDO,SAASe,EACdC,GACA;AACA,SAAO,SAAU;AAAA,IAAEC,OAAAA;AAAAA,EAAAA,GAA6C;AAC9D,WAAO,CACL;AAAA,MACE,GAAGC;AAAAA,MACHC,UAAUA,MAAMD,EAAcC,SAASF,CAAK;AAAA,IAAA,GAE9C;AAAA,MACE,GAAGG;AAAAA,MACHD,UAAU,OAAOpB,MAAS;AACxB,cAAMC,IAAOgB,EAAYjB,CAAI;AAC7B,eAAOqB,EAAcD,SAASnB,CAAI;AAAA,MACpC;AAAA,IAAA,CACD;AAAA,EAEL;AACF;"}
@@ -0,0 +1,40 @@
1
+ import { jsx as m, jsxs as u } from "react/jsx-runtime";
2
+ import { c as h } from "react/compiler-runtime";
3
+ import { AlertTitle as p, Alert as x } from "@mui/material";
4
+ import { u as A } from "./use-widget-selector-DqRmWQ1K.js";
5
+ function E(t) {
6
+ const r = h(5), {
7
+ id: l,
8
+ children: c,
9
+ title: d,
10
+ description: g
11
+ } = t, {
12
+ isLoading: a,
13
+ isFetching: f,
14
+ error: o
15
+ } = A(l, F);
16
+ if (a || f)
17
+ return c;
18
+ if (o) {
19
+ const n = d ?? o.title ?? "Error", s = g ?? o.message ?? "An error occurred while loading the widget. Please try again.";
20
+ let e;
21
+ r[0] !== n ? (e = /* @__PURE__ */ m(p, { children: n }), r[0] = n, r[1] = e) : e = r[1];
22
+ let i;
23
+ return r[2] !== s || r[3] !== e ? (i = /* @__PURE__ */ u(x, { severity: "error", children: [
24
+ e,
25
+ s
26
+ ] }), r[2] = s, r[3] = e, r[4] = i) : i = r[4], i;
27
+ }
28
+ return c;
29
+ }
30
+ function F(t) {
31
+ return {
32
+ isLoading: t?.isLoading,
33
+ isFetching: t?.isFetching,
34
+ error: t?.error
35
+ };
36
+ }
37
+ export {
38
+ E as W
39
+ };
40
+ //# sourceMappingURL=error-Cj8eUMrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-Cj8eUMrl.js","sources":["../src/widgets/error/error.tsx"],"sourcesContent":["import { Alert, AlertTitle } from '@mui/material'\nimport { useWidgetSelector } from '../stores/use-widget-selector'\nimport type { WidgetErrorProps } from './types'\n\n/**\n * Displays an error alert when a widget encounters an error during data loading. Reads error state from the widget store and hides errors during loading/fetching to prevent flashing.\n *\n * @example\n * ```tsx\n * <WidgetError id=\"my-widget\">\n * <WidgetContent />\n * </WidgetError>\n * ```\n */\nexport function WidgetError({\n id,\n children,\n title: titleProp,\n description,\n}: WidgetErrorProps) {\n // Single consolidated subscription instead of 3 separate ones.\n const { isLoading, isFetching, error } = useWidgetSelector(id, (w) => ({\n isLoading: w?.isLoading,\n isFetching: w?.isFetching,\n error: w?.error,\n }))\n\n // Don't show error during loading/fetching states\n if (isLoading || isFetching) {\n return children\n }\n\n // Show error UI if error exists\n if (error) {\n const errorTitle = titleProp ?? error.title ?? 'Error'\n const errorMessage =\n description ??\n error.message ??\n 'An error occurred while loading the widget. Please try again.'\n\n return (\n <Alert severity='error'>\n <AlertTitle>{errorTitle}</AlertTitle>\n {errorMessage}\n </Alert>\n )\n }\n\n // No error, render children\n return children\n}\n"],"names":["WidgetError","t0","$","_c","id","children","title","titleProp","description","isLoading","isFetching","error","useWidgetSelector","_temp","errorTitle","errorMessage","message","t1","AlertTitle","t2","jsxs","Alert","w"],"mappings":";;;;AAcO,SAAAA,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAAqB;AAAA,IAAAC,IAAAA;AAAAA,IAAAC,UAAAA;AAAAA,IAAAC,OAAAC;AAAAA,IAAAC,aAAAA;AAAAA,EAAAA,IAAAP,GAO1B;AAAA,IAAAQ,WAAAA;AAAAA,IAAAC,YAAAA;AAAAA,IAAAC,OAAAA;AAAAA,EAAAA,IAAyCC,EAAkBR,GAAIS,CAI7D;AAGF,MAAIJ,KAAAC;AAAuB,WAClBL;AAIT,MAAIM,GAAK;AACP,UAAAG,IAAmBP,KAAaI,EAAKL,SAAlB,SACnBS,IACEP,KACAG,EAAKK,WADL;AAE+D,QAAAC;AAAA,IAAAf,SAAAY,KAI7DG,sBAACC,kBAAuB,GAAahB,OAAAY,GAAAZ,OAAAe,KAAAA,IAAAf,EAAA,CAAA;AAAA,QAAAiB;AAAA,WAAAjB,EAAA,CAAA,MAAAa,KAAAb,SAAAe,KADvCE,IAAA,gBAAAC,EAACC,GAAA,EAAe,UAAA,SACdJ,UAAAA;AAAAA,MAAAA;AAAAA,MACCF;AAAAA,IAAAA,GACH,GAAQb,OAAAa,GAAAb,OAAAe,GAAAf,OAAAiB,KAAAA,IAAAjB,EAAA,CAAA,GAHRiB;AAAAA,EAGQ;AAEX,SAGMd;AAAQ;AAnCV,SAAAQ,EAAAS,GAAA;AAAA,SAOkE;AAAA,IAAAb,WAC1Da,GAACb;AAAAA,IAAWC,YACXY,GAACZ;AAAAA,IAAYC,OAClBW,GAACX;AAAAA,EAAAA;AACT;"}
@@ -0,0 +1,6 @@
1
+ const a = (t) => String(t), e = (t) => t;
2
+ export {
3
+ e as a,
4
+ a as d
5
+ };
6
+ //# sourceMappingURL=formatter-B9Bxn1k7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter-B9Bxn1k7.js","sources":["../src/widgets/utils/formatter.ts"],"sourcesContent":["export const defaultFormatter = (value: number) => String(value)\nexport const defaultLabelFormatter = (value: string | number) => value\n"],"names":["defaultFormatter","value","String","defaultLabelFormatter"],"mappings":"AAAO,MAAMA,IAAmBA,CAACC,MAAkBC,OAAOD,CAAK,GAClDE,IAAwBA,CAACF,MAA2BA;"}
@@ -0,0 +1,61 @@
1
+ import { jsx as f, jsxs as x } from "react/jsx-runtime";
2
+ import { c as v } from "react/compiler-runtime";
3
+ import { Typography as p, Box as b } from "@mui/material";
4
+ import { u as j } from "./use-widget-selector-DqRmWQ1K.js";
5
+ const A = {
6
+ root: {
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ gap: 1,
10
+ // 8px
11
+ paddingTop: 1,
12
+ // 8px
13
+ paddingBottom: 2,
14
+ // 16px
15
+ paddingX: 2,
16
+ // 16px
17
+ width: "100%",
18
+ minHeight: "100%"
19
+ }
20
+ };
21
+ function B(e) {
22
+ const t = v(7), {
23
+ id: u,
24
+ children: a,
25
+ title: l,
26
+ description: c,
27
+ isEmpty: d
28
+ } = e, n = l === void 0 ? "No data available" : l, s = c === void 0 ? "There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust filters" : c, y = d === void 0 ? E : d, {
29
+ isLoading: g,
30
+ isFetching: m,
31
+ data: h
32
+ } = j(u, T);
33
+ if (g || m)
34
+ return a;
35
+ if (y(h)) {
36
+ let r;
37
+ t[0] !== n ? (r = /* @__PURE__ */ f(p, { variant: "body2", color: "text.primary", children: n }), t[0] = n, t[1] = r) : r = t[1];
38
+ let i;
39
+ t[2] !== s ? (i = /* @__PURE__ */ f(p, { variant: "caption", color: "text.secondary", children: s }), t[2] = s, t[3] = i) : i = t[3];
40
+ let o;
41
+ return t[4] !== r || t[5] !== i ? (o = /* @__PURE__ */ x(b, { sx: A.root, children: [
42
+ r,
43
+ i
44
+ ] }), t[4] = r, t[5] = i, t[6] = o) : o = t[6], o;
45
+ }
46
+ return a;
47
+ }
48
+ function T(e) {
49
+ return {
50
+ isLoading: e?.isLoading,
51
+ isFetching: e?.isFetching,
52
+ data: e?.data
53
+ };
54
+ }
55
+ function E(e) {
56
+ return e == null ? !0 : Array.isArray(e) ? !!(e.length === 0 || e.every((t) => Array.isArray(t) && t.length === 0)) : typeof e == "object" ? Object.keys(e).length === 0 : !1;
57
+ }
58
+ export {
59
+ B as W
60
+ };
61
+ //# sourceMappingURL=no-data-DkIt7Qt1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-data-DkIt7Qt1.js","sources":["../src/widgets/no-data/style.ts","../src/widgets/no-data/no-data.tsx"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material'\n\n/**\n * Styles for NoData component matching Figma design specifications\n * Design reference: node 5781-11028\n */\nexport const styles: Record<string, SxProps<Theme>> = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 1, // 8px\n paddingTop: 1, // 8px\n paddingBottom: 2, // 16px\n paddingX: 2, // 16px\n width: '100%',\n minHeight: '100%',\n },\n}\n","import { Box, Typography } from '@mui/material'\nimport { useWidgetSelector } from '../stores/use-widget-selector'\nimport type { WidgetNoDataProps } from './types'\nimport { styles } from './style'\n\n/**\n * NoData wrapper component that displays empty state UI when widget has no data\n *\n * Integrates with widget store to check loading/fetching state and data availability.\n * Works in conjunction with SkeletonLoader for complete loading/empty state handling.\n *\n * @example Basic usage\n * ```tsx\n * <NoData id=\"my-widget\">\n * <WidgetContent id=\"my-widget\" />\n * </NoData>\n * ```\n *\n * @example With SkeletonLoader\n * ```tsx\n * <SkeletonLoader id=\"my-widget\" Skeleton={MySkeleton}>\n * <NoData id=\"my-widget\">\n * <WidgetContent id=\"my-widget\" />\n * </NoData>\n * </SkeletonLoader>\n * ```\n *\n * @example With custom messages\n * ```tsx\n * <NoData\n * id=\"my-widget\"\n * title=\"No results found\"\n * description=\"Try adjusting your filters\"\n * >\n * <WidgetContent id=\"my-widget\" />\n * </NoData>\n * ```\n */\nexport function WidgetNoData({\n id,\n children,\n title = 'No data available',\n description = 'There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust filters',\n isEmpty = defaultIsEmpty,\n}: WidgetNoDataProps) {\n // Single consolidated subscription instead of 3 separate ones.\n const { isLoading, isFetching, data } = useWidgetSelector(id, (w) => ({\n isLoading: w?.isLoading,\n isFetching: w?.isFetching,\n data: w?.data,\n }))\n\n // If loading or fetching, show children\n // SkeletonLoader handles loading state, this allows proper composition\n if (isLoading || isFetching) {\n return children\n }\n\n // Check if data is empty\n if (isEmpty(data)) {\n return (\n <Box sx={styles.root}>\n <Typography variant='body2' color='text.primary'>\n {title}\n </Typography>\n <Typography variant='caption' color='text.secondary'>\n {description}\n </Typography>\n </Box>\n )\n }\n\n // Data exists, render children\n return children\n}\n\n/**\n * Default function to determine if data is empty\n * Handles various data structures commonly used in widgets\n */\nfunction defaultIsEmpty(data: unknown): boolean {\n // Null or undefined\n if (data == null) {\n return true\n }\n\n // Arrays (most common case)\n if (Array.isArray(data)) {\n // Empty array\n if (data.length === 0) {\n return true\n }\n\n // Array of arrays (CategoryWidget pattern: [[],[]])\n // Check if all inner arrays are empty\n if (data.every((item) => Array.isArray(item) && item.length === 0)) {\n return true\n }\n\n return false\n }\n\n // Objects\n if (typeof data === 'object') {\n return Object.keys(data).length === 0\n }\n\n // Primitives (numbers, strings, booleans) are considered valid data\n return false\n}\n"],"names":["styles","root","display","flexDirection","gap","paddingTop","paddingBottom","paddingX","width","minHeight","WidgetNoData","t0","$","_c","id","children","title","t1","description","t2","isEmpty","t3","undefined","defaultIsEmpty","isLoading","isFetching","data","useWidgetSelector","_temp","t4","Typography","t5","t6","Box","w","Array","isArray","length","every","item","Object","keys"],"mappings":";;;;AAMO,MAAMA,IAAyC;AAAA,EACpDC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,eAAe;AAAA,IACfC,KAAK;AAAA;AAAA,IACLC,YAAY;AAAA;AAAA,IACZC,eAAe;AAAA;AAAA,IACfC,UAAU;AAAA;AAAA,IACVC,OAAO;AAAA,IACPC,WAAW;AAAA,EAAA;AAEf;ACqBO,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAAsB;AAAA,IAAAC,IAAAA;AAAAA,IAAAC,UAAAA;AAAAA,IAAAC,OAAAC;AAAAA,IAAAC,aAAAC;AAAAA,IAAAC,SAAAC;AAAAA,EAAAA,IAAAV,GAG3BK,IAAAC,MAAAK,SAAA,sBAAAL,GACAC,IAAAC,MAAAG,SAAA,mJAAAH,GACAC,IAAAC,MAAAC,SAAAC,IAAAF,GAGA;AAAA,IAAAG,WAAAA;AAAAA,IAAAC,YAAAA;AAAAA,IAAAC,MAAAA;AAAAA,EAAAA,IAAwCC,EAAkBb,GAAIc,CAI5D;AAIF,MAAIJ,KAAAC;AAAuB,WAClBV;AAIT,MAAIK,EAAQM,CAAI,GAAC;AAAA,QAAAG;AAAA,IAAAjB,SAAAI,KAGXa,sBAACC,GAAA,EAAmB,SAAA,SAAc,OAAA,gBAC/Bd,UAAAA,GACH,GAAaJ,OAAAI,GAAAJ,OAAAiB,KAAAA,IAAAjB,EAAA,CAAA;AAAA,QAAAmB;AAAA,IAAAnB,SAAAM,KACba,sBAACD,GAAA,EAAmB,SAAA,WAAgB,OAAA,kBACjCZ,UAAAA,GACH,GAAaN,OAAAM,GAAAN,OAAAmB,KAAAA,IAAAnB,EAAA,CAAA;AAAA,QAAAoB;AAAA,WAAApB,EAAA,CAAA,MAAAiB,KAAAjB,SAAAmB,KANfC,sBAACC,GAAA,EAAQ,IAAAjC,EAAMC,MACb4B,UAAAA;AAAAA,MAAAA;AAAAA,MAGAE;AAAAA,IAAAA,GAGF,GAAMnB,OAAAiB,GAAAjB,OAAAmB,GAAAnB,OAAAoB,KAAAA,IAAApB,EAAA,CAAA,GAPNoB;AAAAA,EAOM;AAET,SAGMjB;AAAQ;AAnCV,SAAAa,EAAAM,GAAA;AAAA,SAQiE;AAAA,IAAAV,WACzDU,GAACV;AAAAA,IAAWC,YACXS,GAACT;AAAAA,IAAYC,MACnBQ,GAACR;AAAAA,EAAAA;AACR;AA8BH,SAASH,EAAeG,GAAwB;AAE9C,SAAIA,KAAQ,OACH,KAILS,MAAMC,QAAQV,CAAI,IAEhBA,GAAAA,EAAKW,WAAW,KAMhBX,EAAKY,MAAOC,CAAAA,MAASJ,MAAMC,QAAQG,CAAI,KAAKA,EAAKF,WAAW,CAAC,KAQ/D,OAAOX,KAAS,WACXc,OAAOC,KAAKf,CAAI,EAAEW,WAAW,IAI/B;AACT;"}
@@ -0,0 +1,34 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { c as n } from "react/compiler-runtime";
3
+ import { Box as c } from "@mui/material";
4
+ import { u as l } from "./use-widget-selector-DqRmWQ1K.js";
5
+ const s = {
6
+ item: {
7
+ '&[data-disabled="true"]': {
8
+ color: (t) => t.palette.text.disabled
9
+ }
10
+ },
11
+ row: {
12
+ display: "flex",
13
+ alignItems: "center",
14
+ gap: (t) => t.spacing(1),
15
+ "& + &": {
16
+ marginTop: (t) => t.spacing(1)
17
+ }
18
+ }
19
+ };
20
+ function h(t) {
21
+ const e = n(3), o = l(t.id, d);
22
+ let i;
23
+ return e[0] !== o || e[1] !== t ? (i = o?.map((m, r) => /* @__PURE__ */ a(c, { sx: s.row, children: typeof t.children == "function" ? t.children({
24
+ index: r
25
+ }) : t.children }, `row-${r}`)), e[0] = o, e[1] = t, e[2] = i) : i = e[2], i;
26
+ }
27
+ function d(t) {
28
+ return t?.data;
29
+ }
30
+ export {
31
+ h as R,
32
+ s
33
+ };
34
+ //# sourceMappingURL=row-D4VOhcNI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"row-D4VOhcNI.js","sources":["../src/widgets/formula/style.ts","../src/widgets/formula/components/row.tsx"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material'\n\nexport const styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: (theme: Theme) => theme.spacing(2),\n },\n item: {\n '&[data-disabled=\"true\"]': {\n color: (theme: Theme) => theme.palette.text.disabled,\n },\n },\n row: {\n display: 'flex',\n alignItems: 'center',\n gap: (theme: Theme) => theme.spacing(1),\n\n '& + &': {\n marginTop: (theme: Theme) => theme.spacing(1),\n },\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { Box } from '@mui/material'\nimport { styles } from '../style'\nimport type { FormulaWidgetState, RowProps } from '../types'\nimport { useWidgetSelector } from '../../stores/use-widget-selector'\n\n/**\n * Iterates over the widget's data items and renders a row for each one using render props.\n */\nexport function Row(props: RowProps) {\n const data = useWidgetSelector(\n props.id,\n (w) => (w as FormulaWidgetState | undefined)?.data,\n )\n\n return data?.map((_, index) => {\n return (\n <Box sx={styles.row} key={`row-${index}`}>\n {typeof props.children === 'function'\n ? props.children({ index })\n : props.children}\n </Box>\n )\n })\n}\n"],"names":["styles","item","color","theme","palette","text","disabled","row","display","alignItems","gap","spacing","marginTop","Row","props","$","_c","data","useWidgetSelector","id","_temp","t0","map","_","index","jsx","Box","children","w"],"mappings":";;;;AAEO,MAAMA,IAAS;AAAA,EAMpBC,MAAM;AAAA,IACJ,2BAA2B;AAAA,MACzBC,OAAOA,CAACC,MAAiBA,EAAMC,QAAQC,KAAKC;AAAAA,IAAAA;AAAAA,EAC9C;AAAA,EAEFC,KAAK;AAAA,IACHC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,KAAKA,CAACP,MAAiBA,EAAMQ,QAAQ,CAAC;AAAA,IAEtC,SAAS;AAAA,MACPC,WAAWA,CAACT,MAAiBA,EAAMQ,QAAQ,CAAC;AAAA,IAAA;AAAA,EAC9C;AAEJ;ACdO,SAAAE,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GACLC,IAAaC,EACXJ,EAAKK,IACLC,CACF;AAAC,MAAAC;AAAA,SAAAN,EAAA,CAAA,MAAAE,KAAAF,SAAAD,KAEMO,IAAAJ,GAAIK,IAAM,CAAAC,GAAAC,MAEb,gBAAAC,EAACC,GAAA,EAAQ,IAAA1B,EAAMO,KACZ,UAAA,OAAOO,EAAKa,YAAc,aACvBb,EAAKa,SAAU;AAAA,IAAAH,OAAAA;AAAAA,EAAAA,CACF,IAAbV,EAAKa,YAHe,OAAOH,CAAK,EAItC,CAEH,GAACT,OAAAE,GAAAF,OAAAD,GAAAC,OAAAM,KAAAA,IAAAN,EAAA,CAAA,GARKM;AAQL;AAdG,SAAAD,EAAAQ,GAAA;AAAA,SAGKA,GAA0CX;AAAA;"}
@@ -0,0 +1,90 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { c as h } from "react/compiler-runtime";
3
+ import { u as p } from "./use-widget-selector-DqRmWQ1K.js";
4
+ import { Typography as g, Avatar as b } from "@mui/material";
5
+ import { s as P } from "./row-D4VOhcNI.js";
6
+ function y(t) {
7
+ const e = h(4);
8
+ let l;
9
+ return e[0] !== t.TypographyProps || e[1] !== t.children || e[2] !== t.disabled ? (l = /* @__PURE__ */ m(g, { sx: P.item, variant: "h5", fontWeight: "medium", "data-disabled": t.disabled, color: "default", ...t.TypographyProps, children: t.children }), e[0] = t.TypographyProps, e[1] = t.children, e[2] = t.disabled, e[3] = l) : l = e[3], l;
10
+ }
11
+ function A(t) {
12
+ const e = h(9);
13
+ let l, r, n;
14
+ e[0] !== t ? ({
15
+ id: l,
16
+ index: n,
17
+ ...r
18
+ } = t, e[0] = t, e[1] = l, e[2] = r, e[3] = n) : (l = e[1], r = e[2], n = e[3]);
19
+ const f = n === void 0 ? 0 : n;
20
+ let a;
21
+ e[4] !== f ? (a = (s) => s?.data?.[f]?.prefix, e[4] = f, e[5] = a) : a = e[5];
22
+ const o = p(l, a);
23
+ if (!o)
24
+ return null;
25
+ let i;
26
+ return e[6] !== o || e[7] !== r ? (i = /* @__PURE__ */ m(y, { ...r, children: o }), e[6] = o, e[7] = r, e[8] = i) : i = e[8], i;
27
+ }
28
+ function C(t) {
29
+ const e = h(10);
30
+ let l, r, n;
31
+ e[0] !== t ? ({
32
+ id: l,
33
+ index: n,
34
+ ...r
35
+ } = t, e[0] = t, e[1] = l, e[2] = r, e[3] = n) : (l = e[1], r = e[2], n = e[3]);
36
+ const f = n === void 0 ? 0 : n;
37
+ let a;
38
+ e[4] !== f ? (a = (c) => c?.data?.[f]?.suffix, e[4] = f, e[5] = a) : a = e[5];
39
+ const o = p(l, a);
40
+ if (!o)
41
+ return null;
42
+ let i;
43
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = {
44
+ color: S
45
+ }, e[6] = i) : i = e[6];
46
+ let s;
47
+ return e[7] !== r || e[8] !== o ? (s = /* @__PURE__ */ m(y, { TypographyProps: i, ...r, children: o }), e[7] = r, e[8] = o, e[9] = s) : s = e[9], s;
48
+ }
49
+ function S(t) {
50
+ return t.palette.text.secondary;
51
+ }
52
+ function I(t) {
53
+ const e = h(12), {
54
+ id: l,
55
+ index: r
56
+ } = t, n = r === void 0 ? 0 : r;
57
+ let f;
58
+ e[0] !== n ? (f = (x) => x?.series?.[n], e[0] = n, e[1] = f) : f = e[1];
59
+ const a = p(l, f);
60
+ if (!a)
61
+ return null;
62
+ const {
63
+ name: o,
64
+ color: i
65
+ } = a;
66
+ let s;
67
+ e[2] !== i ? (s = i && {
68
+ color: (x) => x.palette.getContrastText(i)
69
+ }, e[2] = i, e[3] = s) : s = e[3];
70
+ let c;
71
+ e[4] !== i || e[5] !== s ? (c = {
72
+ bgcolor: i,
73
+ width: 32,
74
+ height: 32,
75
+ fontSize: "0.875rem",
76
+ fontWeight: "medium",
77
+ ...s
78
+ }, e[4] = i, e[5] = s, e[6] = c) : c = e[6];
79
+ let d;
80
+ e[7] !== o ? (d = o.charAt(0).toUpperCase(), e[7] = o, e[8] = d) : d = e[8];
81
+ let u;
82
+ return e[9] !== c || e[10] !== d ? (u = /* @__PURE__ */ m(b, { sx: c, children: d }), e[9] = c, e[10] = d, e[11] = u) : u = e[11], u;
83
+ }
84
+ export {
85
+ y as I,
86
+ A as P,
87
+ I as S,
88
+ C as a
89
+ };
90
+ //# sourceMappingURL=series-Bola3CmD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"series-Bola3CmD.js","sources":["../src/widgets/formula/components/item.tsx","../src/widgets/formula/components/prefix.tsx","../src/widgets/formula/components/suffix.tsx","../src/widgets/formula/components/series.tsx"],"sourcesContent":["import { Typography } from '@mui/material'\nimport type { ItemProps } from '../types'\nimport { styles } from '../style'\n\n/**\n * Base typography wrapper used by formula sub-components (Value, Prefix, Suffix) to render styled text.\n */\nexport function Item(props: ItemProps) {\n return (\n <Typography\n sx={styles.item}\n variant='h5'\n fontWeight='medium'\n data-disabled={props.disabled}\n color='default'\n {...props.TypographyProps}\n >\n {props.children}\n </Typography>\n )\n}\n","import { type FormulaWidgetState, type ValueProps } from '../types'\nimport { Item } from './item'\nimport { useWidgetSelector } from '../../stores/use-widget-selector'\n\n/**\n * Renders the prefix content (e.g., currency symbol) before a formula value, if defined in the data item.\n */\nexport function Prefix({ id, index = 0, ...props }: ValueProps) {\n const prefix = useWidgetSelector(\n id,\n (w) => (w as FormulaWidgetState | undefined)?.data?.[index]?.prefix,\n )\n\n if (!prefix) {\n return null\n }\n\n return <Item {...props}>{prefix}</Item>\n}\n","import { type FormulaWidgetState, type ValueProps } from '../types'\nimport { Item } from './item'\nimport type { Theme } from '@mui/material'\nimport { useWidgetSelector } from '../../stores/use-widget-selector'\n\n/**\n * Renders the suffix content (e.g., unit label) after a formula value, if defined in the data item.\n */\nexport function Suffix({ id, index = 0, ...props }: ValueProps) {\n const suffix = useWidgetSelector(\n id,\n (w) => (w as FormulaWidgetState | undefined)?.data?.[index]?.suffix,\n )\n\n if (!suffix) {\n return null\n }\n\n return (\n <Item\n TypographyProps={{\n color: (theme: Theme) => theme.palette.text.secondary,\n }}\n {...props}\n >\n {suffix}\n </Item>\n )\n}\n","import { Avatar } from '@mui/material'\nimport type { FormulaWidgetState, ValueProps } from '../types'\nimport { useWidgetSelector } from '../../stores/use-widget-selector'\n\n/**\n * Renders a colored avatar badge showing the first letter of the series name for multi-value formula widgets.\n */\nexport function Series({ id, index = 0 }: Pick<ValueProps, 'id' | 'index'>) {\n const serie = useWidgetSelector(\n id,\n (w) => (w as FormulaWidgetState | undefined)?.series?.[index],\n )\n if (!serie) {\n return null\n }\n\n const { name, color } = serie\n\n return (\n <Avatar\n sx={{\n bgcolor: color,\n width: 32,\n height: 32,\n fontSize: '0.875rem',\n fontWeight: 'medium',\n ...(color && {\n color: (theme) => theme.palette.getContrastText(color),\n }),\n }}\n >\n {name.charAt(0).toUpperCase()}\n </Avatar>\n )\n}\n"],"names":["Item","props","$","_c","t0","TypographyProps","children","disabled","Typography","styles","item","Prefix","id","t1","index","undefined","t2","w","data","prefix","useWidgetSelector","t3","jsx","Suffix","suffix","Symbol","for","color","_temp","t4","theme","palette","text","secondary","Series","series","serie","name","getContrastText","bgcolor","width","height","fontSize","fontWeight","t5","charAt","toUpperCase","t6","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S;"}
@@ -0,0 +1,118 @@
1
+ function u(t) {
2
+ if (t === 0) return 0;
3
+ const e = Math.abs(t), n = Math.pow(10, Math.floor(Math.log10(e))), i = Math.ceil(e / n) * n;
4
+ return t < 0 ? -i : i;
5
+ }
6
+ function d({
7
+ hasLegend: t,
8
+ labelFormatter: e
9
+ }) {
10
+ return {
11
+ show: t,
12
+ icon: "circle",
13
+ left: 0,
14
+ bottom: 0,
15
+ orient: "horizontal",
16
+ type: "scroll",
17
+ ...e && {
18
+ formatter: (n) => String(e(n))
19
+ }
20
+ };
21
+ }
22
+ function x(t, e) {
23
+ return {
24
+ ...!t && {
25
+ bottom: parseInt(e.spacing(3))
26
+ },
27
+ ...t && {
28
+ bottom: parseInt(e.spacing(7))
29
+ }
30
+ };
31
+ }
32
+ function y(t) {
33
+ return function(e, n, i, o, a) {
34
+ const l = {
35
+ top: parseInt(t.spacing(0.5))
36
+ };
37
+ return a.contentSize[0] < a.viewSize[0] - e[0] ? l.left = e[0] : l.right = a.viewSize[0] - e[0], l;
38
+ };
39
+ }
40
+ function m(t) {
41
+ if (t)
42
+ return (e) => t(e);
43
+ }
44
+ function b(t, e) {
45
+ const n = t && !Array.isArray(t), i = t, o = e && n ? (a) => String(e(a)) : void 0;
46
+ return {
47
+ ...i,
48
+ axisLabel: {
49
+ ...typeof i.axisLabel == "object" && i.axisLabel ? i.axisLabel : {},
50
+ formatter: o
51
+ }
52
+ };
53
+ }
54
+ function F(t, e) {
55
+ let n = m(e);
56
+ const i = t && !Array.isArray(t), o = t;
57
+ return (!i || o.type !== "value") && (n = void 0), {
58
+ ...o,
59
+ axisLabel: {
60
+ ...typeof o.axisLabel == "object" && o.axisLabel ? o.axisLabel : {},
61
+ formatter: n
62
+ }
63
+ };
64
+ }
65
+ function v(t) {
66
+ return (e) => {
67
+ const n = Array.isArray(e) ? e : [e], i = (r, s) => `<div style="margin: 0px 0 0;line-height:1;">${r ? `<div style="font-size:11px;color:#FFFFFF;font-weight:400;line-height:1; margin-bottom: 10px">${r}</div>` : ""}<div style="margin: 0;line-height:1;">${s}</div><div style="clear:both"></div></div>`, o = n.map((r) => {
68
+ const {
69
+ name: s,
70
+ seriesName: c,
71
+ marker: f,
72
+ value: h
73
+ } = t(r, n);
74
+ return {
75
+ name: s,
76
+ seriesName: c,
77
+ marker: f,
78
+ value: h
79
+ };
80
+ }), a = o[0]?.name ?? "", p = a || n.length > 1 ? "margin: 10px 0 0;line-height:1;" : "margin: 0;line-height:1;", g = o.map(({
81
+ seriesName: r,
82
+ marker: s,
83
+ value: c
84
+ }) => `<div style="${p}"><div style="margin: 0px 0 0;line-height:1;">${s}${r ? `<span style="font-size:11px;color:#FFFFFF;font-weight:400;margin-left:2px;margin-right:10px">${r}</span>` : ""}<span style="float:right;margin-left:10px;font-size:11px;color:#FFFFFF;font-weight:900">${c}</span></div></div>`);
85
+ return i(a, g.join(""));
86
+ };
87
+ }
88
+ const w = {
89
+ graph: {
90
+ /**
91
+ * Common container style for chart widget skeletons
92
+ */
93
+ container: {
94
+ display: "flex",
95
+ alignItems: "center",
96
+ justifyContent: "space-between",
97
+ flexDirection: "column",
98
+ gap: ({
99
+ spacing: t
100
+ }) => t(1),
101
+ height: ({
102
+ spacing: t
103
+ }) => t(38)
104
+ }
105
+ }
106
+ };
107
+ export {
108
+ b as a,
109
+ F as b,
110
+ w as c,
111
+ x as d,
112
+ d as e,
113
+ m as f,
114
+ v as g,
115
+ y as h,
116
+ u as n
117
+ };
118
+ //# sourceMappingURL=styles-Y8q7Jff3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles-Y8q7Jff3.js","sources":["../src/widgets/utils/chart-config/option-builders.ts","../src/widgets/utils/skeleton/styles.ts"],"sourcesContent":["import type { Theme } from '@mui/material'\nimport type { LegendComponentOption } from 'echarts'\nimport type {\n CallbackDataParams,\n TopLevelFormatterParams,\n} from 'echarts/types/dist/shared'\n\n/**\n * Shared EChart configuration builders for chart widgets\n */\n\n/**\n * Rounds a value up to the nearest \"nice\" number.\n * A nice number is a multiple of 10^floor(log10(value)).\n *\n * Examples: 547 → 600, 200 → 200, 1200 → 2000, 18 → 20, 5 → 5, -547 → -500\n */\nexport function niceNum(value: number): number {\n if (value === 0) return 0\n const absValue = Math.abs(value)\n const base = Math.pow(10, Math.floor(Math.log10(absValue)))\n const rounded = Math.ceil(absValue / base) * base\n return value < 0 ? -rounded : rounded\n}\n\n/**\n * Builds standard legend configuration for chart widgets\n *\n * @param params - Legend configuration parameters\n * @param params.hasLegend - Whether to show the legend\n * @param params.labelFormatter - Optional formatter for legend item names\n * @returns Legend configuration object\n */\nexport function buildLegendConfig({\n hasLegend,\n labelFormatter,\n}: {\n hasLegend: boolean\n labelFormatter?: (value: string | number) => string | number\n}): LegendComponentOption {\n return {\n show: hasLegend,\n icon: 'circle' as const,\n left: 0,\n bottom: 0,\n orient: 'horizontal',\n type: 'scroll',\n ...(labelFormatter && {\n formatter: (name: string) => String(labelFormatter(name)),\n }),\n }\n}\n\n/**\n * Builds standard grid configuration with legend-aware spacing\n *\n * @param hasLegend - Whether the chart has a legend\n * @param theme - MUI theme for spacing\n * @param additionalConfig - Additional grid configuration to merge\n * @returns Grid configuration object\n */\nexport function buildGridConfig(hasLegend: boolean, theme: Theme) {\n return {\n ...(!hasLegend && { bottom: parseInt(theme.spacing(3)) }),\n ...(hasLegend && { bottom: parseInt(theme.spacing(7)) }),\n }\n}\n\n/**\n * Creates a tooltip position calculator that handles overflow\n * Used by bar, histogram, and scatterplot widgets\n *\n * @param theme - MUI theme for spacing\n * @returns Tooltip position function\n */\nexport function createTooltipPositioner(theme: Theme) {\n return function (\n point: [number, number],\n _params: unknown,\n _dom: unknown,\n _rect: unknown,\n size: { contentSize: [number, number]; viewSize: [number, number] },\n ) {\n const position = { top: parseInt(theme.spacing(0.5)) } as Record<\n string,\n number\n >\n\n // Position tooltip left or right based on available space\n if (size.contentSize[0] < size.viewSize[0] - point[0]) {\n position.left = point[0]\n } else {\n position.right = size.viewSize[0] - point[0]\n }\n\n return position\n }\n}\n\n/**\n * Creates an axis label formatter for ECharts\n * Used to format numeric axis labels with a widget formatter\n *\n * @param formatter - Optional formatter function from widget config\n * @returns Axis label formatter function or undefined\n */\nexport function createAxisLabelFormatter(\n formatter?: (value: number) => string,\n) {\n if (!formatter) return undefined\n return (value: number) => formatter(value)\n}\n\n/**\n * Applies labelFormatter to xAxis configuration\n * Applies to any xAxis regardless of axis type (category, value, etc.)\n *\n * @param xAxis - Existing xAxis configuration\n * @param labelFormatter - Optional labelFormatter function from widget config\n * @returns Updated xAxis configuration\n */\nexport function applyXAxisFormatter(\n xAxis: unknown,\n formatter?: (value: string | number) => string | number,\n) {\n const xAxisIsObject = xAxis && !Array.isArray(xAxis)\n const xAxisTyped = xAxis as { type?: string; axisLabel?: unknown }\n\n const axisFormatter =\n formatter && xAxisIsObject\n ? (value: string | number) => String(formatter(value))\n : undefined\n\n return {\n ...xAxisTyped,\n axisLabel: {\n ...(typeof xAxisTyped.axisLabel === 'object' && xAxisTyped.axisLabel\n ? xAxisTyped.axisLabel\n : {}),\n formatter: axisFormatter,\n },\n }\n}\n\n/**\n * Applies formatter to yAxis configuration\n * Only applies to single axis objects (not arrays) with type 'value'\n *\n * @param yAxis - Existing yAxis configuration\n * @param formatter - Optional formatter function from widget config\n * @returns Updated yAxis configuration or undefined if no changes needed\n */\nexport function applyYAxisFormatter(\n yAxis: unknown,\n formatter?: (value: number) => string,\n) {\n let axisFormatter = createAxisLabelFormatter(formatter)\n\n const yAxisIsObject = yAxis && !Array.isArray(yAxis)\n const yAxisTyped = yAxis as { type?: string; axisLabel?: unknown }\n\n if (!yAxisIsObject || yAxisTyped.type !== 'value') {\n axisFormatter = undefined\n }\n\n return {\n ...yAxisTyped,\n axisLabel: {\n ...(typeof yAxisTyped.axisLabel === 'object' && yAxisTyped.axisLabel\n ? yAxisTyped.axisLabel\n : {}),\n formatter: axisFormatter,\n },\n }\n}\n\n/**\n * Creates a tooltip formatter for ECharts\n * Formats numeric values in tooltip using widget formatter\n * Handles both axis trigger (array) and item trigger (object) modes\n *\n * @param formatter - Optional formatter function from widget config\n * @returns Tooltip formatter function or undefined\n */\nexport function createTooltipFormatter(\n callback: (\n item: CallbackDataParams,\n items: CallbackDataParams[],\n ) => {\n name: string\n seriesName: string\n marker: string\n value: string | number\n },\n) {\n return (params: TopLevelFormatterParams) => {\n // Handle both array (axis trigger) and object (item trigger)\n const items = Array.isArray(params) ? params : [params]\n\n const tooltip = (name: string, callback: string) =>\n `<div style=\"margin: 0px 0 0;line-height:1;\">${name ? `<div style=\"font-size:11px;color:#FFFFFF;font-weight:400;line-height:1; margin-bottom: 10px\">${name}</div>` : ''}<div style=\"margin: 0;line-height:1;\">${callback}</div><div style=\"clear:both\"></div></div>`\n\n const values = items.map((item) => {\n const { name, seriesName, marker, value } = callback(item, items)\n return {\n name,\n seriesName,\n marker,\n value,\n }\n })\n\n const name = values[0]?.name ?? ''\n // Show margin if name exists or there are multiple items\n const showMargin = name || items.length > 1\n const marginStyle = showMargin\n ? 'margin: 10px 0 0;line-height:1;'\n : 'margin: 0;line-height:1;'\n\n const formattedValues = values.map(\n ({ seriesName, marker, value }) =>\n `<div style=\"${marginStyle}\"><div style=\"margin: 0px 0 0;line-height:1;\">${marker}${seriesName ? `<span style=\"font-size:11px;color:#FFFFFF;font-weight:400;margin-left:2px;margin-right:10px\">${seriesName}</span>` : ''}<span style=\"float:right;margin-left:10px;font-size:11px;color:#FFFFFF;font-weight:900\">${value}</span></div></div>`,\n )\n\n return tooltip(name, formattedValues.join(''))\n }\n}\n","import type { Theme } from '@mui/material'\n\n/**\n * Base skeleton styles shared across all chart widgets\n */\nexport const baseSkeletonStyles = {\n graph: {\n /**\n * Common container style for chart widget skeletons\n */\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }: Theme) => spacing(1),\n height: ({ spacing }: Theme) => spacing(38),\n },\n },\n} as const\n"],"names":["niceNum","value","absValue","Math","abs","base","pow","floor","log10","rounded","ceil","buildLegendConfig","hasLegend","labelFormatter","show","icon","left","bottom","orient","type","formatter","name","String","buildGridConfig","theme","parseInt","spacing","createTooltipPositioner","point","_params","_dom","_rect","size","position","top","contentSize","viewSize","right","createAxisLabelFormatter","applyXAxisFormatter","xAxis","xAxisIsObject","Array","isArray","xAxisTyped","axisFormatter","undefined","axisLabel","applyYAxisFormatter","yAxis","yAxisIsObject","yAxisTyped","createTooltipFormatter","callback","params","items","tooltip","values","map","item","seriesName","marker","marginStyle","length","formattedValues","join","baseSkeletonStyles","graph","container","display","alignItems","justifyContent","flexDirection","gap","height"],"mappings":"AAiBO,SAASA,EAAQC,GAAuB;AAC7C,MAAIA,MAAU,EAAG,QAAO;AACxB,QAAMC,IAAWC,KAAKC,IAAIH,CAAK,GACzBI,IAAOF,KAAKG,IAAI,IAAIH,KAAKI,MAAMJ,KAAKK,MAAMN,CAAQ,CAAC,CAAC,GACpDO,IAAUN,KAAKO,KAAKR,IAAWG,CAAI,IAAIA;AAC7C,SAAOJ,IAAQ,IAAI,CAACQ,IAAUA;AAChC;AAUO,SAASE,EAAkB;AAAA,EAChCC,WAAAA;AAAAA,EACAC,gBAAAA;AAIF,GAA0B;AACxB,SAAO;AAAA,IACLC,MAAMF;AAAAA,IACNG,MAAM;AAAA,IACNC,MAAM;AAAA,IACNC,QAAQ;AAAA,IACRC,QAAQ;AAAA,IACRC,MAAM;AAAA,IACN,GAAIN,KAAkB;AAAA,MACpBO,WAAWA,CAACC,MAAiBC,OAAOT,EAAeQ,CAAI,CAAC;AAAA,IAAA;AAAA,EAC1D;AAEJ;AAUO,SAASE,EAAgBX,GAAoBY,GAAc;AAChE,SAAO;AAAA,IACL,GAAI,CAACZ,KAAa;AAAA,MAAEK,QAAQQ,SAASD,EAAME,QAAQ,CAAC,CAAC;AAAA,IAAA;AAAA,IACrD,GAAId,KAAa;AAAA,MAAEK,QAAQQ,SAASD,EAAME,QAAQ,CAAC,CAAC;AAAA,IAAA;AA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,EAC5C;AAEJ;"}
@@ -2,9 +2,15 @@ import { IconButtonProps } from '@mui/material';
2
2
  import { ReactNode } from 'react';
3
3
  import { BaseWidgetState } from '../../stores/types';
4
4
  /**
5
- * Represents a single item selected by the brush
5
+ * Brush selection result emitted by BrushToggle.
6
+ * Contains raw indices so consumers can resolve data according to their widget type.
6
7
  */
7
- export type BrushSelectedItems = (string | number)[];
8
+ export interface BrushSelectedItems {
9
+ /** Data indices of the selected items in the dataset */
10
+ dataIndex: number[];
11
+ /** Series index from the brush event (defaults to 0) */
12
+ seriesIndex: number;
13
+ }
8
14
  /**
9
15
  * State stored in widget store for brush functionality
10
16
  */
@@ -5,10 +5,11 @@ export interface CategoryRowMultiProps {
5
5
  maxValue: number;
6
6
  colors: string[];
7
7
  formatter: NonNullable<CategoryWidgetConfig['formatter']>;
8
+ labelFormatter?: CategoryWidgetConfig['labelFormatter'];
8
9
  onClick?: CategoryWidgetConfig['onRowClick'];
9
10
  selected?: boolean;
10
11
  }
11
12
  /**
12
13
  * Renders a multi-series category row with a label and multiple color-coded bars stacked vertically.
13
14
  */
14
- export declare function CategoryRowMulti({ name, values, maxValue, colors, formatter, onClick, selected, }: CategoryRowMultiProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function CategoryRowMulti({ name, values, maxValue, colors, formatter, labelFormatter, onClick, selected, }: CategoryRowMultiProps): import("react/jsx-runtime").JSX.Element;
@@ -5,10 +5,11 @@ export interface CategoryRowSingleProps {
5
5
  maxValue: number;
6
6
  color: string;
7
7
  formatter: NonNullable<CategoryWidgetConfig['formatter']>;
8
+ labelFormatter?: CategoryWidgetConfig['labelFormatter'];
8
9
  onClick?: CategoryWidgetConfig['onRowClick'];
9
10
  selected?: boolean;
10
11
  }
11
12
  /**
12
13
  * Renders a single-series category row with a label, formatted value, and proportional bar.
13
14
  */
14
- export declare function CategoryRowSingle({ name, value, maxValue, color, formatter, onClick, selected, }: CategoryRowSingleProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function CategoryRowSingle({ name, value, maxValue, color, formatter, labelFormatter, onClick, selected, }: CategoryRowSingleProps): import("react/jsx-runtime").JSX.Element;
@@ -22,6 +22,7 @@ export type CategoryWidgetState = BaseWidgetState<WrapperState<CategoryWidgetCon
22
22
  }>;
23
23
  export interface CategoryWidgetConfig {
24
24
  formatter?: (value: number) => string;
25
+ labelFormatter?: (value: string | number) => string | number;
25
26
  series?: CategorySeriesConfig[];
26
27
  maxItems?: number;
27
28
  labels?: CategoryLabels;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared ResizeObserver singleton for all ECharts instances.
3
+ *
4
+ * Instead of creating 100+ individual ResizeObserver instances (one per chart),
5
+ * this module provides a single shared observer that efficiently handles resize
6
+ * callbacks for all registered elements.
7
+ */
8
+ type ResizeCallback = () => void;
9
+ export declare function observeResize(element: Element, callback: ResizeCallback): () => void;
10
+ /** Reset the shared observer (for testing only). */
11
+ export declare function resetSharedResizeObserver(): void;
12
+ export {};
@@ -27,10 +27,12 @@ export interface EchartWidgetOptionProps<D> {
27
27
  data?: D;
28
28
  theme: typeof CartoTheme;
29
29
  formatter?: (value: number) => string;
30
+ labelFormatter?: (value: string | number) => string | number;
30
31
  }
31
32
  export interface EchartWidgetProps {
32
33
  type: string;
33
34
  option: EchartUIProps['option'];
34
35
  onEvents?: EchartUIProps['onEvents'];
35
36
  formatter?: (value: number) => string;
37
+ labelFormatter?: (value: string | number) => string | number;
36
38
  }
@@ -1,9 +1,21 @@
1
1
  import { HistogramConfig, HistogramWidgetConfig } from './types';
2
- export declare const histogramDownloadConfig: ({ refUI }: import('../loader').ConfigProps) => import('../actions').DownloadItem<import('../echart').EchartWidgetData>[];
2
+ import { DownloadItem } from '../actions';
3
+ import { ConfigProps } from '../loader/types';
4
+ export interface HistogramDownloadConfigProps extends ConfigProps {
5
+ ticks: number[];
6
+ labelFormatter?: (value: string | number) => string | number;
7
+ }
8
+ export declare function histogramDataToCSV(data: number[][], ticks: number[], labelFormatter?: (value: string | number) => string | number): string[][];
9
+ export declare function histogramDownloadConfig({ refUI, ticks, labelFormatter, }: HistogramDownloadConfigProps): DownloadItem<number[][]>[];
3
10
  /**
4
- * Generates ECharts configuration for distribution histogram widgets with adjacent bars (minimal gap) and axis formatting styled with the CARTO theme.
11
+ * Generates ECharts configuration for distribution histogram widgets with
12
+ * adjacent bars (minimal gap) and axis formatting styled with the CARTO theme.
5
13
  *
6
- * @param props - Histogram configuration including bin data and theme.
14
+ * Accepts raw `number[][]` data and `ticks` boundaries. The ticks and
15
+ * `labelFormatter` are used to create the x-axis category labels; the raw
16
+ * numeric data is embedded directly in each series.
17
+ *
18
+ * @param props - Histogram configuration including raw data, ticks, and theme.
7
19
  * @returns Widget config with ECharts option object.
8
20
  */
9
21
  export declare function histogramConfig(props: HistogramConfig): HistogramWidgetConfig;
@@ -1,3 +1,4 @@
1
1
  export type { HistogramConfig, HistogramWidgetConfig, HistogramWidgetData, HistogramWidgetState, } from './types';
2
- export { histogramConfig, histogramDownloadConfig } from './config';
2
+ export type { HistogramDownloadConfigProps } from './config';
3
+ export { histogramConfig, histogramDataToCSV, histogramDownloadConfig, } from './config';
3
4
  export { HistogramSkeleton } from './skeleton';
@@ -1,9 +1,12 @@
1
- import { EchartWidgetData, EchartWidgetState } from '../echart';
1
+ import { EchartWidgetState } from '../echart';
2
2
  import { EchartWidgetOptionProps, EchartWidgetProps } from '../echart/types';
3
3
  import { ConfigProps } from '../loader';
4
- export type HistogramWidgetData = EchartWidgetData;
4
+ export type HistogramWidgetData = number[][];
5
5
  export type HistogramWidgetState = EchartWidgetState;
6
6
  export type HistogramWidgetConfig = EchartWidgetProps & {
7
7
  type: 'histogram';
8
8
  };
9
- export type HistogramConfig = ConfigProps & EchartWidgetOptionProps<HistogramWidgetData>;
9
+ export type HistogramConfig = ConfigProps & Pick<EchartWidgetOptionProps<unknown>, 'theme' | 'formatter' | 'labelFormatter'> & {
10
+ data?: number[][];
11
+ ticks: number[];
12
+ };
@@ -1,2 +1,3 @@
1
- export { useWidgetStore } from './widget-store';
1
+ export { useWidgetStore, widgetStoreActions } from './widget-store';
2
+ export { useWidgetSelector } from './use-widget-selector';
2
3
  export type { BaseWidgetState, ToolType, WidgetsStoreProps, WidgetState, WidgetStore, WidgetStoreActions, WidgetStoreState, } from './types';