@carto/ps-react-ui 4.4.1 → 4.4.2

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 (210) hide show
  1. package/dist/components.js.map +1 -1
  2. package/dist/error-CEkRPccv.js.map +1 -1
  3. package/dist/exports-Cr43OCul.js.map +1 -1
  4. package/dist/formatter-B1Xh8XDH.js +5 -0
  5. package/dist/formatter-B1Xh8XDH.js.map +1 -0
  6. package/dist/lasso-tool-BYbxrJ-7.js.map +1 -1
  7. package/dist/note-t51drNe0.js.map +1 -1
  8. package/dist/options-D9wflre6.js.map +1 -1
  9. package/dist/row-DTCV0Ocm.js.map +1 -1
  10. package/dist/series-CYNOu2Ju.js.map +1 -1
  11. package/dist/smart-tooltip-D4vwQpFf.js.map +1 -1
  12. package/dist/styles-C_8vOEep.js +167 -0
  13. package/dist/styles-C_8vOEep.js.map +1 -0
  14. package/dist/tooltip-BDnrRKrp.js.map +1 -1
  15. package/dist/types/components/basemaps/basemaps.d.ts +20 -0
  16. package/dist/types/components/geolocation-controls/geolocation-controls.d.ts +11 -0
  17. package/dist/types/components/lasso-tool/lasso-tool-inline.d.ts +17 -0
  18. package/dist/types/components/lasso-tool/lasso-tool.d.ts +21 -0
  19. package/dist/types/components/list-data/list-data.d.ts +16 -0
  20. package/dist/types/components/measurement-tools/measurement-tools.d.ts +20 -0
  21. package/dist/types/components/smart-tooltip/smart-tooltip.d.ts +17 -0
  22. package/dist/types/components/tooltip/tooltip.d.ts +13 -0
  23. package/dist/types/components/zoom-controls/zoom-controls.d.ts +16 -0
  24. package/dist/types/hooks/use-widget-ref.d.ts +4 -4
  25. package/dist/types/widgets/actions/download/download.d.ts +11 -0
  26. package/dist/types/widgets/actions/download/exports.d.ts +15 -0
  27. package/dist/types/widgets/actions/fullscreen/fullscreen.d.ts +13 -0
  28. package/dist/types/widgets/actions/index.d.ts +1 -1
  29. package/dist/types/widgets/actions/relative-data/relative-data.d.ts +1 -0
  30. package/dist/types/widgets/bar/config.d.ts +8 -4
  31. package/dist/types/widgets/category/category-ui.d.ts +3 -0
  32. package/dist/types/widgets/category/components/category-bar.d.ts +3 -0
  33. package/dist/types/widgets/category/components/category-legend.d.ts +3 -0
  34. package/dist/types/widgets/category/components/category-row-multi.d.ts +3 -0
  35. package/dist/types/widgets/category/components/category-row-other.d.ts +3 -0
  36. package/dist/types/widgets/category/components/category-row-single.d.ts +3 -0
  37. package/dist/types/widgets/category/config.d.ts +11 -0
  38. package/dist/types/widgets/echart/echart-ui.d.ts +7 -0
  39. package/dist/types/widgets/echart/echart.d.ts +6 -0
  40. package/dist/types/widgets/echart/options.d.ts +7 -0
  41. package/dist/types/widgets/echart/types.d.ts +1 -0
  42. package/dist/types/widgets/echart/utils.d.ts +41 -0
  43. package/dist/types/widgets/error/error.d.ts +10 -0
  44. package/dist/types/widgets/formula/components/item.d.ts +3 -0
  45. package/dist/types/widgets/formula/components/prefix.d.ts +3 -0
  46. package/dist/types/widgets/formula/components/row.d.ts +3 -0
  47. package/dist/types/widgets/formula/components/series.d.ts +3 -0
  48. package/dist/types/widgets/formula/components/suffix.d.ts +3 -0
  49. package/dist/types/widgets/formula/components/value.d.ts +3 -0
  50. package/dist/types/widgets/formula/config.d.ts +11 -0
  51. package/dist/types/widgets/formula/formula-ui.d.ts +3 -0
  52. package/dist/types/widgets/histogram/config.d.ts +8 -4
  53. package/dist/types/widgets/loader/loader.d.ts +22 -0
  54. package/dist/types/widgets/loader/utils.d.ts +26 -3
  55. package/dist/types/widgets/markdown/config.d.ts +10 -0
  56. package/dist/types/widgets/markdown/markdown-ui.d.ts +7 -0
  57. package/dist/types/widgets/markdown/markdown.d.ts +3 -0
  58. package/dist/types/widgets/note/note.d.ts +10 -0
  59. package/dist/types/widgets/pie/config.d.ts +8 -4
  60. package/dist/types/widgets/range/components/range-item.d.ts +3 -0
  61. package/dist/types/widgets/range/config.d.ts +5 -0
  62. package/dist/types/widgets/range/range-ui.d.ts +3 -0
  63. package/dist/types/widgets/scatterplot/config.d.ts +7 -3
  64. package/dist/types/widgets/selection-summary/selection-summary.d.ts +11 -0
  65. package/dist/types/widgets/skeleton-loader/skeleton-loader.d.ts +10 -0
  66. package/dist/types/widgets/spread/components/max-value.d.ts +3 -0
  67. package/dist/types/widgets/spread/components/min-value.d.ts +3 -0
  68. package/dist/types/widgets/spread/components/separator.d.ts +3 -0
  69. package/dist/types/widgets/spread/config.d.ts +11 -0
  70. package/dist/types/widgets/spread/spread-ui.d.ts +3 -0
  71. package/dist/types/widgets/subheader/subheader.d.ts +11 -0
  72. package/dist/types/widgets/table/config.d.ts +8 -3
  73. package/dist/types/widgets/table/hooks/use-pagination.d.ts +11 -3
  74. package/dist/types/widgets/table/hooks/use-selection.d.ts +11 -2
  75. package/dist/types/widgets/table/hooks/use-sort.d.ts +11 -3
  76. package/dist/types/widgets/timeseries/config.d.ts +8 -4
  77. package/dist/types/widgets/utils/chart-config/download-config.d.ts +3 -0
  78. package/dist/types/widgets/{_shared → utils}/chart-config/index.d.ts +2 -0
  79. package/dist/types/widgets/{_shared → utils}/chart-config/option-builders.d.ts +1 -1
  80. package/dist/types/widgets/utils/formatter.d.ts +1 -0
  81. package/dist/types/widgets/utils/index.d.ts +7 -0
  82. package/dist/types/widgets/wrapper/components/actions.d.ts +3 -0
  83. package/dist/types/widgets/wrapper/components/options.d.ts +3 -0
  84. package/dist/types/widgets/wrapper/components/title.d.ts +3 -0
  85. package/dist/types/widgets/wrapper/wrapper-ui.d.ts +14 -0
  86. package/dist/types/widgets/wrapper/wrapper.d.ts +14 -0
  87. package/dist/use-widget-ref-wtFLDFCD.js.map +1 -1
  88. package/dist/utils-BOhInag6.js.map +1 -1
  89. package/dist/widgets/actions.js +651 -628
  90. package/dist/widgets/actions.js.map +1 -1
  91. package/dist/widgets/bar.js +66 -86
  92. package/dist/widgets/bar.js.map +1 -1
  93. package/dist/widgets/category.js +21 -21
  94. package/dist/widgets/category.js.map +1 -1
  95. package/dist/widgets/echart.js.map +1 -1
  96. package/dist/widgets/formula.js +54 -54
  97. package/dist/widgets/formula.js.map +1 -1
  98. package/dist/widgets/histogram.js +45 -65
  99. package/dist/widgets/histogram.js.map +1 -1
  100. package/dist/widgets/loader.js.map +1 -1
  101. package/dist/widgets/markdown.js.map +1 -1
  102. package/dist/widgets/pie.js +122 -99
  103. package/dist/widgets/pie.js.map +1 -1
  104. package/dist/widgets/range.js +23 -22
  105. package/dist/widgets/range.js.map +1 -1
  106. package/dist/widgets/scatterplot.js +39 -59
  107. package/dist/widgets/scatterplot.js.map +1 -1
  108. package/dist/widgets/selection-summary.js.map +1 -1
  109. package/dist/widgets/skeleton-loader.js.map +1 -1
  110. package/dist/widgets/spread.js +40 -41
  111. package/dist/widgets/spread.js.map +1 -1
  112. package/dist/widgets/subheader.js.map +1 -1
  113. package/dist/widgets/table.js.map +1 -1
  114. package/dist/widgets/timeseries.js +39 -59
  115. package/dist/widgets/timeseries.js.map +1 -1
  116. package/dist/widgets/utils.js +31 -0
  117. package/dist/widgets/utils.js.map +1 -0
  118. package/dist/widgets/wrapper.js.map +1 -1
  119. package/package.json +5 -1
  120. package/src/components/basemaps/basemaps.tsx +20 -0
  121. package/src/components/geolocation-controls/geolocation-controls.tsx +11 -0
  122. package/src/components/lasso-tool/lasso-tool-inline.tsx +17 -0
  123. package/src/components/lasso-tool/lasso-tool.tsx +21 -0
  124. package/src/components/list-data/list-data.tsx +16 -0
  125. package/src/components/measurement-tools/measurement-tools.tsx +20 -0
  126. package/src/components/smart-tooltip/smart-tooltip.tsx +17 -0
  127. package/src/components/tooltip/tooltip.tsx +13 -0
  128. package/src/components/zoom-controls/zoom-controls.tsx +16 -0
  129. package/src/hooks/use-widget-ref.ts +4 -4
  130. package/src/widgets/README.md +10 -10
  131. package/src/widgets/actions/download/download.tsx +11 -0
  132. package/src/widgets/actions/download/exports.tsx +15 -0
  133. package/src/widgets/actions/fullscreen/fullscreen.tsx +13 -0
  134. package/src/widgets/actions/index.ts +1 -0
  135. package/src/widgets/actions/relative-data/relative-data.test.tsx +62 -1
  136. package/src/widgets/actions/relative-data/relative-data.tsx +62 -39
  137. package/src/widgets/bar/config.ts +12 -20
  138. package/src/widgets/bar/style.ts +1 -1
  139. package/src/widgets/category/category-ui.tsx +4 -2
  140. package/src/widgets/category/components/category-bar.tsx +3 -0
  141. package/src/widgets/category/components/category-legend.tsx +3 -0
  142. package/src/widgets/category/components/category-row-multi.tsx +3 -0
  143. package/src/widgets/category/components/category-row-other.tsx +3 -0
  144. package/src/widgets/category/components/category-row-single.tsx +3 -0
  145. package/src/widgets/category/config.ts +11 -0
  146. package/src/widgets/echart/echart-ui.tsx +7 -0
  147. package/src/widgets/echart/echart.tsx +6 -0
  148. package/src/widgets/echart/options.ts +7 -0
  149. package/src/widgets/echart/types.ts +1 -0
  150. package/src/widgets/echart/utils.ts +41 -0
  151. package/src/widgets/error/error.tsx +10 -0
  152. package/src/widgets/formula/components/item.tsx +3 -0
  153. package/src/widgets/formula/components/prefix.tsx +3 -0
  154. package/src/widgets/formula/components/row.tsx +3 -0
  155. package/src/widgets/formula/components/series.tsx +3 -0
  156. package/src/widgets/formula/components/suffix.tsx +3 -0
  157. package/src/widgets/formula/components/value.tsx +4 -2
  158. package/src/widgets/formula/config.ts +11 -0
  159. package/src/widgets/formula/formula-ui.tsx +3 -0
  160. package/src/widgets/histogram/config.ts +11 -20
  161. package/src/widgets/histogram/style.ts +1 -1
  162. package/src/widgets/loader/loader.tsx +22 -0
  163. package/src/widgets/loader/utils.ts +26 -3
  164. package/src/widgets/markdown/config.ts +10 -0
  165. package/src/widgets/markdown/markdown-ui.tsx +7 -0
  166. package/src/widgets/markdown/markdown.tsx +3 -0
  167. package/src/widgets/note/note.tsx +10 -0
  168. package/src/widgets/pie/config.ts +85 -30
  169. package/src/widgets/pie/style.ts +1 -1
  170. package/src/widgets/range/components/range-item.tsx +5 -2
  171. package/src/widgets/range/config.ts +5 -0
  172. package/src/widgets/range/range-ui.tsx +3 -0
  173. package/src/widgets/scatterplot/config.ts +11 -20
  174. package/src/widgets/scatterplot/style.ts +1 -1
  175. package/src/widgets/selection-summary/selection-summary.tsx +11 -0
  176. package/src/widgets/skeleton-loader/skeleton-loader.tsx +10 -0
  177. package/src/widgets/spread/components/max-value.tsx +4 -2
  178. package/src/widgets/spread/components/min-value.tsx +4 -2
  179. package/src/widgets/spread/components/separator.tsx +3 -0
  180. package/src/widgets/spread/config.ts +11 -0
  181. package/src/widgets/spread/spread-ui.tsx +3 -0
  182. package/src/widgets/subheader/subheader.tsx +11 -0
  183. package/src/widgets/table/config.ts +8 -3
  184. package/src/widgets/table/hooks/use-pagination.ts +11 -3
  185. package/src/widgets/table/hooks/use-selection.ts +11 -2
  186. package/src/widgets/table/hooks/use-sort.ts +11 -3
  187. package/src/widgets/timeseries/config.ts +11 -20
  188. package/src/widgets/timeseries/style.ts +1 -1
  189. package/src/widgets/utils/chart-config/download-config.ts +22 -0
  190. package/src/widgets/{_shared → utils}/chart-config/index.ts +4 -0
  191. package/src/widgets/{_shared → utils}/chart-config/option-builders.ts +1 -1
  192. package/src/widgets/utils/formatter.ts +1 -0
  193. package/src/widgets/utils/index.ts +26 -0
  194. package/src/widgets/wrapper/components/actions.tsx +3 -0
  195. package/src/widgets/wrapper/components/options.tsx +3 -0
  196. package/src/widgets/wrapper/components/title.tsx +3 -0
  197. package/src/widgets/wrapper/wrapper-ui.tsx +14 -0
  198. package/src/widgets/wrapper/wrapper.tsx +14 -0
  199. package/dist/styles-CAroD5Rc.js +0 -123
  200. package/dist/styles-CAroD5Rc.js.map +0 -1
  201. /package/dist/types/widgets/{_shared → utils}/chart-config/config-factory.d.ts +0 -0
  202. /package/dist/types/widgets/{_shared → utils}/chart-config/csv-modifiers.d.ts +0 -0
  203. /package/dist/types/widgets/{_shared → utils}/chart-config/option-builders.test.d.ts +0 -0
  204. /package/dist/types/widgets/{_shared → utils}/skeleton/index.d.ts +0 -0
  205. /package/dist/types/widgets/{_shared → utils}/skeleton/styles.d.ts +0 -0
  206. /package/src/widgets/{_shared → utils}/chart-config/config-factory.ts +0 -0
  207. /package/src/widgets/{_shared → utils}/chart-config/csv-modifiers.ts +0 -0
  208. /package/src/widgets/{_shared → utils}/chart-config/option-builders.test.ts +0 -0
  209. /package/src/widgets/{_shared → utils}/skeleton/index.ts +0 -0
  210. /package/src/widgets/{_shared → utils}/skeleton/styles.ts +0 -0
@@ -2,6 +2,8 @@
2
2
  * Shared utilities for chart widget configuration
3
3
  */
4
4
 
5
+ export { defaultFormatter } from '../formatter'
6
+
5
7
  export { createChartWidgetConfig } from './config-factory'
6
8
  export type {
7
9
  ChartWidgetBaseConfig,
@@ -20,3 +22,5 @@ export {
20
22
  applyYAxisFormatter,
21
23
  niceNum,
22
24
  } from './option-builders'
25
+
26
+ export { createChartDownloadConfig } from './download-config'
@@ -3,7 +3,7 @@ import type { LegendComponentOption } from 'echarts'
3
3
  import type {
4
4
  CallbackDataParams,
5
5
  TopLevelFormatterParams,
6
- } from 'node_modules/echarts/types/dist/shared'
6
+ } from 'echarts/types/dist/shared'
7
7
 
8
8
  /**
9
9
  * Shared EChart configuration builders for chart widgets
@@ -0,0 +1 @@
1
+ export const defaultFormatter = (value: number) => value.toString()
@@ -0,0 +1,26 @@
1
+ // Formatter
2
+ export { defaultFormatter } from './formatter'
3
+
4
+ // Chart configuration
5
+ export { createChartWidgetConfig } from './chart-config'
6
+ export type {
7
+ ChartWidgetBaseConfig,
8
+ CreateChartWidgetConfigParams,
9
+ } from './chart-config'
10
+ export { flattenObjectArrayToCSV, scatterplotDataToCSV } from './chart-config'
11
+ export {
12
+ buildLegendConfig,
13
+ buildGridConfig,
14
+ createTooltipPositioner,
15
+ createAxisLabelFormatter,
16
+ createTooltipFormatter,
17
+ applyXAxisFormatter,
18
+ applyYAxisFormatter,
19
+ niceNum,
20
+ } from './chart-config'
21
+
22
+ // Skeleton styles
23
+ export { baseSkeletonStyles } from './skeleton'
24
+
25
+ // Download config factory
26
+ export { createChartDownloadConfig } from './chart-config'
@@ -4,6 +4,9 @@ import { styles } from '../styles'
4
4
 
5
5
  const EMPTY_ACTIONS: NonNullable<WrapperActionsProps['actions']> = []
6
6
 
7
+ /**
8
+ * Renders action buttons in the widget wrapper header. Each action click event is stopped from propagating to the accordion.
9
+ */
7
10
  export function Actions({ actions = EMPTY_ACTIONS }: WrapperActionsProps) {
8
11
  return (
9
12
  <Box sx={styles.actions} className='widget-wrapper-actions'>
@@ -12,6 +12,9 @@ import { styles } from '../styles'
12
12
 
13
13
  const EMPTY_OPTIONS: NonNullable<WrapperOptionsProps['options']> = []
14
14
 
15
+ /**
16
+ * Renders a dropdown options menu in the widget wrapper header, triggered by a vertical ellipsis icon button.
17
+ */
15
18
  export function Options({
16
19
  labels,
17
20
  options = EMPTY_OPTIONS,
@@ -4,6 +4,9 @@ import { SmartTooltip } from '../../../components'
4
4
  import type { ReactNode } from 'react'
5
5
  import type { WrapperOptionsProps } from '../types'
6
6
 
7
+ /**
8
+ * Renders the widget title text inside the wrapper header with smart tooltip support for truncated titles.
9
+ */
7
10
  export function Title({
8
11
  label,
9
12
  children,
@@ -15,6 +15,20 @@ import { useShallow } from 'zustand/shallow'
15
15
  const EMPTY_ACTIONS: NonNullable<WrapperUIProps['actions']> = []
16
16
  const EMPTY_OPTIONS: NonNullable<WrapperUIProps['options']> = []
17
17
 
18
+ /**
19
+ * Presentational wrapper component that renders the widget accordion UI with title, actions, options menu, and loading indicator. For uncontrolled usage without automatic widget store synchronization, use this instead of WidgetWrapper.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * <WrapperUI
24
+ * id="my-widget"
25
+ * actions={[<Download key="download" id="my-widget" />]}
26
+ * onChangeCollapsed={(e, collapsed) => console.log(collapsed)}
27
+ * >
28
+ * <div>Content</div>
29
+ * </WrapperUI>
30
+ * ```
31
+ */
18
32
  export function WrapperUI({
19
33
  children,
20
34
  id,
@@ -3,6 +3,20 @@ import { WrapperUI } from './wrapper-ui'
3
3
  import { useWidgetStore } from '../stores/widget-store'
4
4
  import { useLayoutEffect } from 'react'
5
5
 
6
+ /**
7
+ * Container component providing a collapsible header with title, action buttons, and options menu for widgets. Syncs collapse, disabled, and title state with the widget store.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * <WidgetWrapper
12
+ * id="my-widget"
13
+ * title="Sales Overview"
14
+ * actions={[<Download key="download" id="my-widget" items={downloads} />]}
15
+ * >
16
+ * {children}
17
+ * </WidgetWrapper>
18
+ * ```
19
+ */
6
20
  export function WidgetWrapper({
7
21
  id,
8
22
  title,
@@ -1,123 +0,0 @@
1
- function m(t) {
2
- const e = [];
3
- if (t.length > 0 && (t[0]?.length ?? 0) > 0) {
4
- const n = t?.[0]?.[0] ?? {}, i = Object.keys(n);
5
- e.push(i);
6
- }
7
- return t.forEach((n) => {
8
- n.forEach((i) => {
9
- const o = Object.values(i).map((r) => String(r));
10
- e.push(o);
11
- });
12
- }), e;
13
- }
14
- function y(t) {
15
- const e = [];
16
- return e.push(["x", "y"]), t.forEach((n) => {
17
- n.forEach((i) => {
18
- e.push([String(i[0]), String(i[1])]);
19
- });
20
- }), e;
21
- }
22
- function b(t) {
23
- if (t === 0) return 0;
24
- const e = Math.abs(t), n = Math.pow(10, Math.floor(Math.log10(e))), i = Math.ceil(e / n) * n;
25
- return t < 0 ? -i : i;
26
- }
27
- function F(t) {
28
- return {
29
- show: t,
30
- icon: "circle",
31
- left: 0,
32
- bottom: 0,
33
- orient: "horizontal",
34
- type: "scroll"
35
- };
36
- }
37
- function d(t, e) {
38
- return {
39
- ...!t && {
40
- bottom: parseInt(e.spacing(3))
41
- },
42
- ...t && {
43
- bottom: parseInt(e.spacing(7))
44
- }
45
- };
46
- }
47
- function x(t) {
48
- return function(e, n, i, o, r) {
49
- const c = {
50
- top: parseInt(t.spacing(0.5))
51
- };
52
- return r.contentSize[0] < r.viewSize[0] - e[0] ? c.left = e[0] : c.right = r.viewSize[0] - e[0], c;
53
- };
54
- }
55
- function u(t) {
56
- if (t)
57
- return (e) => t(e);
58
- }
59
- function v(t, e) {
60
- let n = u(e);
61
- const i = t && !Array.isArray(t), o = t;
62
- return (!i || o.type !== "value") && (n = void 0), {
63
- ...o,
64
- axisLabel: {
65
- ...typeof o.axisLabel == "object" && o.axisLabel ? o.axisLabel : {},
66
- formatter: n
67
- }
68
- };
69
- }
70
- function w(t) {
71
- return (e) => {
72
- const n = Array.isArray(e) ? e : [e], i = (s, a) => `<div style="margin: 0px 0 0;line-height:1;">${s ? `<div style="font-size:11px;color:#FFFFFF;font-weight:400;line-height:1; margin-bottom: 10px">${s}</div>` : ""}<div style="margin: 0;line-height:1;">${a}</div><div style="clear:both"></div></div>`, o = n.map((s) => {
73
- const {
74
- name: a,
75
- seriesName: l,
76
- marker: g,
77
- value: h
78
- } = t(s, n);
79
- return {
80
- name: a,
81
- seriesName: l,
82
- marker: g,
83
- value: h
84
- };
85
- }), r = o[0]?.name ?? "", p = r || n.length > 1 ? "margin: 10px 0 0;line-height:1;" : "margin: 0;line-height:1;", f = o.map(({
86
- seriesName: s,
87
- marker: a,
88
- value: l
89
- }) => `<div style="${p}"><div style="margin: 0px 0 0;line-height:1;">${a}${s ? `<span style="font-size:11px;color:#FFFFFF;font-weight:400;margin-left:2px;margin-right:10px">${s}</span>` : ""}<span style="float:right;margin-left:10px;font-size:11px;color:#FFFFFF;font-weight:900">${l}</span></div></div>`);
90
- return i(r, f.join(""));
91
- };
92
- }
93
- const S = {
94
- graph: {
95
- /**
96
- * Common container style for chart widget skeletons
97
- */
98
- container: {
99
- display: "flex",
100
- alignItems: "center",
101
- justifyContent: "space-between",
102
- flexDirection: "column",
103
- gap: ({
104
- spacing: t
105
- }) => t(1),
106
- height: ({
107
- spacing: t
108
- }) => t(38)
109
- }
110
- }
111
- };
112
- export {
113
- x as a,
114
- d as b,
115
- w as c,
116
- F as d,
117
- S as e,
118
- m as f,
119
- v as g,
120
- b as n,
121
- y as s
122
- };
123
- //# sourceMappingURL=styles-CAroD5Rc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles-CAroD5Rc.js","sources":["../src/widgets/_shared/chart-config/csv-modifiers.ts","../src/widgets/_shared/chart-config/option-builders.ts","../src/widgets/_shared/skeleton/styles.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 type { Theme } from '@mui/material'\nimport type { LegendComponentOption } from 'echarts'\nimport type {\n CallbackDataParams,\n TopLevelFormatterParams,\n} from 'node_modules/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 hasLegend - Whether to show the legend\n * @returns Legend configuration object\n */\nexport function buildLegendConfig(hasLegend: boolean): LegendComponentOption {\n return {\n show: hasLegend,\n icon: 'circle' as const,\n left: 0,\n bottom: 0,\n orient: 'horizontal',\n type: 'scroll',\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 formatter to xAxis configuration\n * Only applies to single axis objects (not arrays) with type 'value'\n *\n * @param xAxis - Existing xAxis configuration\n * @param formatter - Optional formatter function from widget config\n * @returns Updated xAxis configuration or undefined if no changes needed\n */\nexport function applyXAxisFormatter(\n xAxis: unknown,\n formatter?: (value: number) => string,\n) {\n let axisFormatter = createAxisLabelFormatter(formatter)\n\n const xAxisIsObject = xAxis && !Array.isArray(xAxis)\n const xAxisTyped = xAxis as { type?: string; axisLabel?: unknown }\n\n if (!xAxisIsObject || xAxisTyped.type !== 'value') {\n axisFormatter = undefined\n }\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":["flattenObjectArrayToCSV","data","rows","length","firstDataPoint","headers","Object","keys","push","forEach","series","dataPoint","values","map","v","String","scatterplotDataToCSV","niceNum","value","absValue","Math","abs","base","pow","floor","log10","rounded","ceil","buildLegendConfig","hasLegend","show","icon","left","bottom","orient","type","buildGridConfig","theme","parseInt","spacing","createTooltipPositioner","point","_params","_dom","_rect","size","position","top","contentSize","viewSize","right","createAxisLabelFormatter","formatter","applyYAxisFormatter","yAxis","axisFormatter","yAxisIsObject","Array","isArray","yAxisTyped","undefined","axisLabel","createTooltipFormatter","callback","params","items","tooltip","name","item","seriesName","marker","marginStyle","formattedValues","join","baseSkeletonStyles","graph","container","display","alignItems","justifyContent","flexDirection","gap","height"],"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;ACtCO,SAASe,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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