@carto/ps-react-ui 4.4.1 → 4.4.3

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 (225) hide show
  1. package/dist/components.js.map +1 -1
  2. package/dist/download-config-Dqu78h2a.js +57 -0
  3. package/dist/download-config-Dqu78h2a.js.map +1 -0
  4. package/dist/error-CEkRPccv.js.map +1 -1
  5. package/dist/exports-Cr43OCul.js.map +1 -1
  6. package/dist/formatter-B9Bxn1k7.js +6 -0
  7. package/dist/formatter-B9Bxn1k7.js.map +1 -0
  8. package/dist/lasso-tool-BYbxrJ-7.js.map +1 -1
  9. package/dist/note-t51drNe0.js.map +1 -1
  10. package/dist/options-D9wflre6.js.map +1 -1
  11. package/dist/row-DTCV0Ocm.js.map +1 -1
  12. package/dist/series-CYNOu2Ju.js.map +1 -1
  13. package/dist/smart-tooltip-D4vwQpFf.js.map +1 -1
  14. package/dist/styles-Y8q7Jff3.js +118 -0
  15. package/dist/styles-Y8q7Jff3.js.map +1 -0
  16. package/dist/tooltip-BDnrRKrp.js.map +1 -1
  17. package/dist/types/components/basemaps/basemaps.d.ts +20 -0
  18. package/dist/types/components/geolocation-controls/geolocation-controls.d.ts +11 -0
  19. package/dist/types/components/lasso-tool/lasso-tool-inline.d.ts +17 -0
  20. package/dist/types/components/lasso-tool/lasso-tool.d.ts +21 -0
  21. package/dist/types/components/list-data/list-data.d.ts +16 -0
  22. package/dist/types/components/measurement-tools/measurement-tools.d.ts +20 -0
  23. package/dist/types/components/smart-tooltip/smart-tooltip.d.ts +17 -0
  24. package/dist/types/components/tooltip/tooltip.d.ts +13 -0
  25. package/dist/types/components/zoom-controls/zoom-controls.d.ts +16 -0
  26. package/dist/types/hooks/use-widget-ref.d.ts +4 -4
  27. package/dist/types/widgets/actions/brush-toggle/types.d.ts +8 -2
  28. package/dist/types/widgets/actions/download/download.d.ts +11 -0
  29. package/dist/types/widgets/actions/download/exports.d.ts +15 -0
  30. package/dist/types/widgets/actions/fullscreen/fullscreen.d.ts +13 -0
  31. package/dist/types/widgets/actions/index.d.ts +1 -1
  32. package/dist/types/widgets/actions/relative-data/relative-data.d.ts +1 -0
  33. package/dist/types/widgets/bar/config.d.ts +8 -4
  34. package/dist/types/widgets/category/category-ui.d.ts +3 -0
  35. package/dist/types/widgets/category/components/category-bar.d.ts +3 -0
  36. package/dist/types/widgets/category/components/category-legend.d.ts +3 -0
  37. package/dist/types/widgets/category/components/category-row-multi.d.ts +5 -1
  38. package/dist/types/widgets/category/components/category-row-other.d.ts +3 -0
  39. package/dist/types/widgets/category/components/category-row-single.d.ts +5 -1
  40. package/dist/types/widgets/category/config.d.ts +11 -0
  41. package/dist/types/widgets/category/types.d.ts +1 -0
  42. package/dist/types/widgets/echart/echart-ui.d.ts +7 -0
  43. package/dist/types/widgets/echart/echart.d.ts +6 -0
  44. package/dist/types/widgets/echart/options.d.ts +7 -0
  45. package/dist/types/widgets/echart/types.d.ts +3 -0
  46. package/dist/types/widgets/echart/utils.d.ts +41 -0
  47. package/dist/types/widgets/error/error.d.ts +10 -0
  48. package/dist/types/widgets/formula/components/item.d.ts +3 -0
  49. package/dist/types/widgets/formula/components/prefix.d.ts +3 -0
  50. package/dist/types/widgets/formula/components/row.d.ts +3 -0
  51. package/dist/types/widgets/formula/components/series.d.ts +3 -0
  52. package/dist/types/widgets/formula/components/suffix.d.ts +3 -0
  53. package/dist/types/widgets/formula/components/value.d.ts +3 -0
  54. package/dist/types/widgets/formula/config.d.ts +11 -0
  55. package/dist/types/widgets/formula/formula-ui.d.ts +3 -0
  56. package/dist/types/widgets/histogram/config.d.ts +18 -2
  57. package/dist/types/widgets/histogram/index.d.ts +2 -1
  58. package/dist/types/widgets/histogram/types.d.ts +6 -3
  59. package/dist/types/widgets/loader/loader.d.ts +22 -0
  60. package/dist/types/widgets/loader/utils.d.ts +26 -3
  61. package/dist/types/widgets/markdown/config.d.ts +10 -0
  62. package/dist/types/widgets/markdown/markdown-ui.d.ts +7 -0
  63. package/dist/types/widgets/markdown/markdown.d.ts +3 -0
  64. package/dist/types/widgets/note/note.d.ts +10 -0
  65. package/dist/types/widgets/pie/config.d.ts +8 -4
  66. package/dist/types/widgets/range/components/range-item.d.ts +3 -0
  67. package/dist/types/widgets/range/config.d.ts +5 -0
  68. package/dist/types/widgets/range/range-ui.d.ts +3 -0
  69. package/dist/types/widgets/scatterplot/config.d.ts +7 -3
  70. package/dist/types/widgets/selection-summary/selection-summary.d.ts +11 -0
  71. package/dist/types/widgets/skeleton-loader/skeleton-loader.d.ts +10 -0
  72. package/dist/types/widgets/spread/components/max-value.d.ts +3 -0
  73. package/dist/types/widgets/spread/components/min-value.d.ts +3 -0
  74. package/dist/types/widgets/spread/components/separator.d.ts +3 -0
  75. package/dist/types/widgets/spread/config.d.ts +11 -0
  76. package/dist/types/widgets/spread/spread-ui.d.ts +3 -0
  77. package/dist/types/widgets/stores/types.d.ts +2 -0
  78. package/dist/types/widgets/subheader/subheader.d.ts +11 -0
  79. package/dist/types/widgets/table/config.d.ts +8 -3
  80. package/dist/types/widgets/table/hooks/use-pagination.d.ts +11 -3
  81. package/dist/types/widgets/table/hooks/use-selection.d.ts +11 -2
  82. package/dist/types/widgets/table/hooks/use-sort.d.ts +11 -3
  83. package/dist/types/widgets/timeseries/config.d.ts +8 -4
  84. package/dist/types/widgets/utils/chart-config/download-config.d.ts +3 -0
  85. package/dist/types/widgets/{_shared → utils}/chart-config/index.d.ts +2 -0
  86. package/dist/types/widgets/{_shared → utils}/chart-config/option-builders.d.ts +14 -9
  87. package/dist/types/widgets/utils/formatter.d.ts +2 -0
  88. package/dist/types/widgets/utils/index.d.ts +7 -0
  89. package/dist/types/widgets/wrapper/components/actions.d.ts +3 -0
  90. package/dist/types/widgets/wrapper/components/options.d.ts +3 -0
  91. package/dist/types/widgets/wrapper/components/title.d.ts +3 -0
  92. package/dist/types/widgets/wrapper/wrapper-ui.d.ts +14 -0
  93. package/dist/types/widgets/wrapper/wrapper.d.ts +14 -0
  94. package/dist/use-widget-ref-wtFLDFCD.js.map +1 -1
  95. package/dist/utils-BOhInag6.js.map +1 -1
  96. package/dist/widgets/actions.js +720 -681
  97. package/dist/widgets/actions.js.map +1 -1
  98. package/dist/widgets/bar.js +78 -92
  99. package/dist/widgets/bar.js.map +1 -1
  100. package/dist/widgets/category.js +206 -197
  101. package/dist/widgets/category.js.map +1 -1
  102. package/dist/widgets/echart.js.map +1 -1
  103. package/dist/widgets/formula.js +54 -54
  104. package/dist/widgets/formula.js.map +1 -1
  105. package/dist/widgets/histogram.js +106 -86
  106. package/dist/widgets/histogram.js.map +1 -1
  107. package/dist/widgets/loader.js.map +1 -1
  108. package/dist/widgets/markdown.js.map +1 -1
  109. package/dist/widgets/pie.js +147 -112
  110. package/dist/widgets/pie.js.map +1 -1
  111. package/dist/widgets/range.js +23 -22
  112. package/dist/widgets/range.js.map +1 -1
  113. package/dist/widgets/scatterplot.js +46 -60
  114. package/dist/widgets/scatterplot.js.map +1 -1
  115. package/dist/widgets/selection-summary.js.map +1 -1
  116. package/dist/widgets/skeleton-loader.js.map +1 -1
  117. package/dist/widgets/spread.js +40 -41
  118. package/dist/widgets/spread.js.map +1 -1
  119. package/dist/widgets/subheader.js.map +1 -1
  120. package/dist/widgets/table.js.map +1 -1
  121. package/dist/widgets/timeseries.js +51 -65
  122. package/dist/widgets/timeseries.js.map +1 -1
  123. package/dist/widgets/toolbar-actions.js +101 -6693
  124. package/dist/widgets/toolbar-actions.js.map +1 -1
  125. package/dist/widgets/utils.js +33 -0
  126. package/dist/widgets/utils.js.map +1 -0
  127. package/dist/widgets/wrapper.js.map +1 -1
  128. package/package.json +9 -4
  129. package/src/components/basemaps/basemaps.tsx +20 -0
  130. package/src/components/geolocation-controls/geolocation-controls.tsx +11 -0
  131. package/src/components/lasso-tool/lasso-tool-inline.tsx +17 -0
  132. package/src/components/lasso-tool/lasso-tool.tsx +21 -0
  133. package/src/components/list-data/list-data.tsx +16 -0
  134. package/src/components/measurement-tools/measurement-tools.tsx +20 -0
  135. package/src/components/smart-tooltip/smart-tooltip.tsx +17 -0
  136. package/src/components/tooltip/tooltip.tsx +13 -0
  137. package/src/components/zoom-controls/zoom-controls.tsx +16 -0
  138. package/src/hooks/use-widget-ref.ts +4 -4
  139. package/src/widgets/README.md +13 -13
  140. package/src/widgets/actions/brush-toggle/brush-toggle.tsx +42 -47
  141. package/src/widgets/actions/brush-toggle/types.ts +8 -2
  142. package/src/widgets/actions/download/download.tsx +11 -0
  143. package/src/widgets/actions/download/exports.tsx +15 -0
  144. package/src/widgets/actions/fullscreen/fullscreen.tsx +13 -0
  145. package/src/widgets/actions/index.ts +1 -0
  146. package/src/widgets/actions/relative-data/relative-data.test.tsx +62 -1
  147. package/src/widgets/actions/relative-data/relative-data.tsx +62 -39
  148. package/src/widgets/bar/config.ts +34 -34
  149. package/src/widgets/bar/style.ts +1 -1
  150. package/src/widgets/category/category-ui.tsx +12 -2
  151. package/src/widgets/category/components/category-bar.tsx +3 -0
  152. package/src/widgets/category/components/category-legend.tsx +3 -0
  153. package/src/widgets/category/components/category-row-multi.tsx +9 -2
  154. package/src/widgets/category/components/category-row-other.tsx +3 -0
  155. package/src/widgets/category/components/category-row-single.tsx +8 -1
  156. package/src/widgets/category/config.ts +11 -0
  157. package/src/widgets/category/types.ts +1 -0
  158. package/src/widgets/echart/echart-ui.tsx +7 -0
  159. package/src/widgets/echart/echart.tsx +6 -0
  160. package/src/widgets/echart/options.ts +7 -0
  161. package/src/widgets/echart/types.ts +3 -0
  162. package/src/widgets/echart/utils.ts +41 -0
  163. package/src/widgets/error/error.tsx +10 -0
  164. package/src/widgets/formula/components/item.tsx +3 -0
  165. package/src/widgets/formula/components/prefix.tsx +3 -0
  166. package/src/widgets/formula/components/row.tsx +3 -0
  167. package/src/widgets/formula/components/series.tsx +3 -0
  168. package/src/widgets/formula/components/suffix.tsx +3 -0
  169. package/src/widgets/formula/components/value.tsx +4 -2
  170. package/src/widgets/formula/config.ts +11 -0
  171. package/src/widgets/formula/formula-ui.tsx +3 -0
  172. package/src/widgets/histogram/config.ts +93 -21
  173. package/src/widgets/histogram/index.ts +6 -1
  174. package/src/widgets/histogram/style.ts +1 -1
  175. package/src/widgets/histogram/types.ts +9 -3
  176. package/src/widgets/loader/loader.tsx +22 -0
  177. package/src/widgets/loader/utils.ts +26 -3
  178. package/src/widgets/markdown/config.ts +10 -0
  179. package/src/widgets/markdown/markdown-ui.tsx +7 -0
  180. package/src/widgets/markdown/markdown.tsx +3 -0
  181. package/src/widgets/note/note.tsx +10 -0
  182. package/src/widgets/pie/config.ts +100 -33
  183. package/src/widgets/pie/style.ts +1 -1
  184. package/src/widgets/range/components/range-item.tsx +5 -2
  185. package/src/widgets/range/config.ts +5 -0
  186. package/src/widgets/range/range-ui.tsx +3 -0
  187. package/src/widgets/scatterplot/config.ts +19 -23
  188. package/src/widgets/scatterplot/style.ts +1 -1
  189. package/src/widgets/selection-summary/selection-summary.tsx +11 -0
  190. package/src/widgets/skeleton-loader/skeleton-loader.tsx +10 -0
  191. package/src/widgets/spread/components/max-value.tsx +4 -2
  192. package/src/widgets/spread/components/min-value.tsx +4 -2
  193. package/src/widgets/spread/components/separator.tsx +3 -0
  194. package/src/widgets/spread/config.ts +11 -0
  195. package/src/widgets/spread/spread-ui.tsx +3 -0
  196. package/src/widgets/stores/types.ts +2 -0
  197. package/src/widgets/subheader/subheader.tsx +11 -0
  198. package/src/widgets/table/config.ts +8 -3
  199. package/src/widgets/table/hooks/use-pagination.ts +11 -3
  200. package/src/widgets/table/hooks/use-selection.ts +11 -2
  201. package/src/widgets/table/hooks/use-sort.ts +11 -3
  202. package/src/widgets/timeseries/config.ts +32 -33
  203. package/src/widgets/timeseries/style.ts +1 -1
  204. package/src/widgets/utils/chart-config/download-config.ts +22 -0
  205. package/src/widgets/{_shared → utils}/chart-config/index.ts +4 -0
  206. package/src/widgets/{_shared → utils}/chart-config/option-builders.ts +23 -13
  207. package/src/widgets/utils/formatter.ts +2 -0
  208. package/src/widgets/utils/index.ts +26 -0
  209. package/src/widgets/wrapper/components/actions.tsx +3 -0
  210. package/src/widgets/wrapper/components/options.tsx +3 -0
  211. package/src/widgets/wrapper/components/title.tsx +3 -0
  212. package/src/widgets/wrapper/wrapper-ui.tsx +14 -0
  213. package/src/widgets/wrapper/wrapper.tsx +14 -0
  214. package/dist/styles-CAroD5Rc.js +0 -123
  215. package/dist/styles-CAroD5Rc.js.map +0 -1
  216. /package/dist/types/widgets/{_shared → utils}/chart-config/config-factory.d.ts +0 -0
  217. /package/dist/types/widgets/{_shared → utils}/chart-config/csv-modifiers.d.ts +0 -0
  218. /package/dist/types/widgets/{_shared → utils}/chart-config/option-builders.test.d.ts +0 -0
  219. /package/dist/types/widgets/{_shared → utils}/skeleton/index.d.ts +0 -0
  220. /package/dist/types/widgets/{_shared → utils}/skeleton/styles.d.ts +0 -0
  221. /package/src/widgets/{_shared → utils}/chart-config/config-factory.ts +0 -0
  222. /package/src/widgets/{_shared → utils}/chart-config/csv-modifiers.ts +0 -0
  223. /package/src/widgets/{_shared → utils}/chart-config/option-builders.test.ts +0 -0
  224. /package/src/widgets/{_shared → utils}/skeleton/index.ts +0 -0
  225. /package/src/widgets/{_shared → utils}/skeleton/styles.ts +0 -0
@@ -1,6 +1,35 @@
1
1
  import { EchartOptionsProps } from './types';
2
2
  import { Theme } from '@mui/material';
3
+ /**
4
+ * Deep-merges two ECharts option objects with smart handling for `color`, `axisLabel`, and `series` keys.
5
+ *
6
+ * @param optionA - Base ECharts options.
7
+ * @param optionB - Override ECharts options to merge on top.
8
+ * @param customMergeFn - Optional function returning a custom merge strategy per key.
9
+ * @returns The merged ECharts options object.
10
+ *
11
+ * @remarks
12
+ * - `color` arrays are replaced entirely (not concatenated).
13
+ * - `axisLabel` formatters are composed so the base formatter can suppress values by returning `''`.
14
+ * - `series` arrays are merged element-by-element rather than concatenated.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const option = mergeEchartWidgetConfig(props.option, {
19
+ * series: [{ barWidth: '60%', itemStyle: { borderRadius: [4, 4, 0, 0] } }],
20
+ * tooltip: { trigger: 'axis' },
21
+ * })
22
+ * ```
23
+ */
3
24
  export declare function mergeEchartWidgetConfig<T extends EchartOptionsProps>(optionA: T | undefined, optionB: T | undefined, customMergeFn?: (key: string) => ((a: unknown, b: unknown) => unknown) | undefined): T;
25
+ /**
26
+ * Generates ECharts `dataZoom` configuration for interactive zoom and pan on chart axes.
27
+ *
28
+ * @param range - Initial visible range as `{ start, end }` percentages (0-100). Defaults to full range.
29
+ * @param options - Zoom behavior options including axis sliders, inside zoom, and formatter.
30
+ * @param theme - Optional MUI theme for styled slider handles and backgrounds.
31
+ * @returns An object containing the `dataZoom` array configuration.
32
+ */
4
33
  export declare function getEChartZoomConfig({ start, end }?: {
5
34
  start: number;
6
35
  end: number;
@@ -68,6 +97,12 @@ export declare function getEChartZoomConfig({ start, end }?: {
68
97
  orientation?: undefined;
69
98
  })[];
70
99
  };
100
+ /**
101
+ * Generates ECharts `brush` configuration for interactive data selection on charts.
102
+ *
103
+ * @param options - Brush options including type, mode, and target axis index.
104
+ * @returns An object containing the `brush` configuration.
105
+ */
71
106
  export declare function getEChartBrushConfig({ brushType, brushMode, xAxisIndex }?: {
72
107
  brushType?: string;
73
108
  brushMode?: string;
@@ -82,6 +117,12 @@ export declare function getEChartBrushConfig({ brushType, brushMode, xAxisIndex
82
117
  xAxisIndex: number;
83
118
  };
84
119
  };
120
+ /**
121
+ * Returns an ECharts `stack` configuration to group series into a stacked layout.
122
+ *
123
+ * @param stackGroup - The stack group identifier. Defaults to the library's default group.
124
+ * @returns An object with the `stack` property set to the group name.
125
+ */
85
126
  export declare function getEChartStackConfig(stackGroup?: string): {
86
127
  stack: string;
87
128
  };
@@ -1,2 +1,12 @@
1
1
  import { WidgetErrorProps } from './types';
2
+ /**
3
+ * 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.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <WidgetError id="my-widget">
8
+ * <WidgetContent />
9
+ * </WidgetError>
10
+ * ```
11
+ */
2
12
  export declare function WidgetError({ id, children, title: titleProp, description, }: WidgetErrorProps): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
@@ -1,2 +1,5 @@
1
1
  import { ItemProps } from '../types';
2
+ /**
3
+ * Base typography wrapper used by formula sub-components (Value, Prefix, Suffix) to render styled text.
4
+ */
2
5
  export declare function Item(props: ItemProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,5 @@
1
1
  import { ValueProps } from '../types';
2
+ /**
3
+ * Renders the prefix content (e.g., currency symbol) before a formula value, if defined in the data item.
4
+ */
2
5
  export declare function Prefix({ id, index, ...props }: ValueProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,2 +1,5 @@
1
1
  import { RowProps } from '../types';
2
+ /**
3
+ * Iterates over the widget's data items and renders a row for each one using render props.
4
+ */
2
5
  export declare function Row(props: RowProps): import("react/jsx-runtime").JSX.Element[] | undefined;
@@ -1,2 +1,5 @@
1
1
  import { ValueProps } from '../types';
2
+ /**
3
+ * Renders a colored avatar badge showing the first letter of the series name for multi-value formula widgets.
4
+ */
2
5
  export declare function Series({ id, index }: Pick<ValueProps, 'id' | 'index'>): import("react/jsx-runtime").JSX.Element | null;
@@ -1,2 +1,5 @@
1
1
  import { ValueProps } from '../types';
2
+ /**
3
+ * Renders the suffix content (e.g., unit label) after a formula value, if defined in the data item.
4
+ */
2
5
  export declare function Suffix({ id, index, ...props }: ValueProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,2 +1,5 @@
1
1
  import { ValueProps } from '../types';
2
+ /**
3
+ * Displays the formatted numeric value for a formula widget data item, applying the widget's formatter and color.
4
+ */
2
5
  export declare function Value({ id, index, ...props }: ValueProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,15 @@
1
1
  import { ConfigProps } from '../loader/types';
2
2
  import { FormulaDownloadConfig, FormulaWidgetConfig } from './types';
3
+ /**
4
+ * Creates download configuration for formula widgets, supporting PNG (screenshot) and CSV (data) exports.
5
+ *
6
+ * @param props - Configuration with `refUI` reference for PNG export.
7
+ * @returns Array of download items for use with the Download action.
8
+ */
3
9
  export declare function formulaDownloadConfig({ refUI, }: ConfigProps): FormulaDownloadConfig;
10
+ /**
11
+ * Returns the default configuration for formula (single or multiple numeric value) widgets.
12
+ *
13
+ * @returns Default formula widget config with empty series.
14
+ */
4
15
  export declare function formulaConfig(): FormulaWidgetConfig;
@@ -1,2 +1,5 @@
1
1
  import { FormulaUIProps } from './types';
2
+ /**
3
+ * Renders a formula widget displaying one or more KPI values with optional prefixes, suffixes, and series indicators.
4
+ */
2
5
  export declare function FormulaUI(props: FormulaUIProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,21 @@
1
- import { HistogramConfig, HistogramWidgetConfig, HistogramWidgetData } from './types';
1
+ import { HistogramConfig, HistogramWidgetConfig } from './types';
2
2
  import { DownloadItem } from '../actions';
3
3
  import { ConfigProps } from '../loader/types';
4
- export declare function histogramDownloadConfig({ refUI, }: ConfigProps): DownloadItem<HistogramWidgetData>[];
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[][]>[];
10
+ /**
11
+ * Generates ECharts configuration for distribution histogram widgets with
12
+ * adjacent bars (minimal gap) and axis formatting styled with the CARTO theme.
13
+ *
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.
19
+ * @returns Widget config with ECharts option object.
20
+ */
5
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,24 @@
1
1
  import { WidgetLoaderProps } from './types';
2
+ /**
3
+ * Foundation component for all widgets that manages state initialization, synchronization with the widget store, and data transformation pipeline execution.
4
+ *
5
+ * @remarks
6
+ * The WidgetLoader is stateless -- it manages data flow but does not render any UI. Always wrap it with WidgetWrapper for consistent widget appearance.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * <WidgetLoader
11
+ * id="sales-chart"
12
+ * type="bar"
13
+ * data={data}
14
+ * isLoading={false}
15
+ * isFetching={false}
16
+ * config={barConfig({ data })}
17
+ * >
18
+ * <WidgetWrapper id="sales-chart" title="Sales">
19
+ * <Echart id="sales-chart" />
20
+ * </WidgetWrapper>
21
+ * </WidgetLoader>
22
+ * ```
23
+ */
2
24
  export declare function WidgetLoader<T extends object = Record<string, unknown>>(props: WidgetLoaderProps<T>): import('react').ReactNode;
@@ -4,9 +4,32 @@
4
4
  */
5
5
  export type ConfigOrFn<TConfig, TData = unknown> = Partial<TConfig> | ((baseConfig: TConfig, data: TData) => Partial<TConfig>);
6
6
  /**
7
- * Resolves a config that may be either an object or a function.
8
- * If it's a function, calls it with baseConfig and data.
9
- * If it's an object (or undefined), returns it as-is.
7
+ * Resolves a widget config that may be either a partial object or a function receiving the computed base config and data. If it is a function, calls it with `baseConfig` and `data`; otherwise returns the value as-is.
8
+ *
9
+ * @param config - The config object or function to resolve.
10
+ * @param baseConfig - The computed base configuration.
11
+ * @param data - The widget data.
12
+ * @returns Resolved partial config, or undefined.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * const resolved = resolveConfig(
17
+ * (base, data) => ({ maxItems: base.maxItems + 5 }),
18
+ * baseConfig,
19
+ * widgetData,
20
+ * )
21
+ * ```
10
22
  */
11
23
  export declare function resolveConfig<TConfig, TData>(config: ConfigOrFn<TConfig, TData> | undefined, baseConfig: TConfig, data: TData): Partial<TConfig> | undefined;
24
+ /**
25
+ * Deep-merges two partial widget config objects using `deepmerge`, with arrays replaced rather than concatenated.
26
+ *
27
+ * @param options - A tuple of two partial configs to merge (base and override).
28
+ * @returns The merged config object.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * const finalConfig = mergeWidgetConfig(baseConfig, resolvedConfig)
33
+ * ```
34
+ */
12
35
  export declare function mergeWidgetConfig<T>(...options: [Partial<T> | undefined, Partial<T> | undefined]): T;
@@ -1,4 +1,14 @@
1
1
  import { DownloadItem } from '../actions';
2
2
  import { MarkdownWidgetConfig, MarkdownWidgetData } from './types';
3
+ /**
4
+ * Creates download configuration for markdown widgets, supporting CSV export of text content. Does not require `refUI` since it only exports text.
5
+ *
6
+ * @returns Array of download items for use with the Download action.
7
+ */
3
8
  export declare function markdownDownloadConfig(): DownloadItem<MarkdownWidgetData>[];
9
+ /**
10
+ * Returns the default configuration for markdown content display widgets.
11
+ *
12
+ * @returns Default markdown widget config (empty object).
13
+ */
4
14
  export declare function markdownConfig(): MarkdownWidgetConfig;
@@ -1,2 +1,9 @@
1
1
  import { MarkdownComponentProps } from './types';
2
+ /**
3
+ * Presentational component that renders a Markdown string as MUI-styled HTML using react-markdown.
4
+ *
5
+ * @remarks
6
+ * Maps Markdown elements (headings, paragraphs, links, lists) to MUI Typography and Link components.
7
+ * Custom component overrides can be passed via the `overrides` prop.
8
+ */
2
9
  export declare function MarkdownUI({ children, overrides }: MarkdownComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,5 @@
1
1
  import { MarkdownUIProps } from './types';
2
+ /**
3
+ * Stateful markdown widget component that reads content from the widget store and renders it as formatted rich text.
4
+ */
2
5
  export declare function Markdown({ id }: MarkdownUIProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,2 +1,12 @@
1
1
  import { WidgetNoteProps } from './types';
2
+ /**
3
+ * Displays text content with markdown support and automatic show more/less functionality for long content. Automatically detects content exceeding 3 lines and shows an expand/collapse button.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <WidgetNote>
8
+ * {"**Important:** This data is from Q4 2024."}
9
+ * </WidgetNote>
10
+ * ```
11
+ */
2
12
  export declare function WidgetNote({ children, labels, }: WidgetNoteProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,9 @@
1
- import { PieConfig, PieWidgetConfig, PieWidgetData } from './types';
2
- import { DownloadItem } from '../actions';
3
- import { ConfigProps } from '../loader/types';
4
- export declare function pieDownloadConfig({ refUI, }: ConfigProps): DownloadItem<PieWidgetData>[];
1
+ import { PieConfig, PieWidgetConfig } from './types';
2
+ export declare const pieDownloadConfig: ({ refUI }: import('../loader').ConfigProps) => import('../actions').DownloadItem<import('../echart').EchartWidgetData>[];
3
+ /**
4
+ * Generates ECharts configuration for pie and donut chart widgets. Falls back to a horizontal bar layout when multiple data series are provided.
5
+ *
6
+ * @param props - Pie chart configuration including data and theme.
7
+ * @returns Widget config with ECharts option object.
8
+ */
5
9
  export declare function pieConfig(props: PieConfig): PieWidgetConfig;
@@ -1,2 +1,5 @@
1
1
  import { RangeItemProps } from '../types';
2
+ /**
3
+ * Renders a single range slider with editable min/max text inputs, reading its configuration from the widget store.
4
+ */
2
5
  export declare function RangeItem({ id, index }: RangeItemProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,2 +1,7 @@
1
1
  import { RangeWidgetConfig } from './types';
2
+ /**
3
+ * Returns the default configuration for range (value range with labels) widgets.
4
+ *
5
+ * @returns Default range widget config.
6
+ */
2
7
  export declare function rangeConfig(): RangeWidgetConfig;
@@ -1,2 +1,5 @@
1
1
  import { RangeUIProps } from './types';
2
+ /**
3
+ * Renders a range widget with one or more interactive dual-slider controls for selecting value ranges.
4
+ */
2
5
  export declare function RangeUI(props: RangeUIProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,9 @@
1
1
  import { ScatterplotConfig, ScatterplotWidgetConfig, ScatterplotWidgetData } from './types';
2
- import { DownloadItem } from '../actions';
3
- import { ConfigProps } from '../loader/types';
4
- export declare function scatterplotDownloadConfig({ refUI, }: ConfigProps): DownloadItem<ScatterplotWidgetData>[];
2
+ export declare const scatterplotDownloadConfig: ({ refUI }: import('../loader').ConfigProps) => import('../actions').DownloadItem<ScatterplotWidgetData>[];
3
+ /**
4
+ * Generates ECharts configuration for X-Y scatter plot widgets with value axes, legend support, and CARTO qualitative color palette.
5
+ *
6
+ * @param props - Scatterplot configuration including data points and theme.
7
+ * @returns Widget config with ECharts option object.
8
+ */
5
9
  export declare function scatterplotConfig(props: ScatterplotConfig): ScatterplotWidgetConfig;
@@ -1,2 +1,13 @@
1
1
  import { WidgetSelectionSummaryProps } from './types';
2
+ /**
3
+ * Displays the count of selected items with an optional clear button. Commonly used with the LockSelection action to show selection state in widgets.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <WidgetSelectionSummary
8
+ * selections={selectedItems.length}
9
+ * onClear={() => setSelectedItems([])}
10
+ * />
11
+ * ```
12
+ */
2
13
  export declare function WidgetSelectionSummary({ selections, onClear, labels, }: WidgetSelectionSummaryProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,12 @@
1
1
  import { SkeletonLoaderProps } from './types';
2
+ /**
3
+ * Displays a skeleton loading placeholder while widget data is loading. Subscribes to widget loading state in the store and renders the provided Skeleton component or children accordingly.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <SkeletonLoader id="sales-chart" Skeleton={BarSkeleton}>
8
+ * <Bar id="sales-chart" />
9
+ * </SkeletonLoader>
10
+ * ```
11
+ */
2
12
  export declare function SkeletonLoader({ id, children, Skeleton, }: SkeletonLoaderProps): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
@@ -1,2 +1,5 @@
1
1
  import { ValueProps } from '../types';
2
+ /**
3
+ * Displays the formatted maximum value for a spread widget data item.
4
+ */
2
5
  export declare function MaxValue({ id, index, ...props }: ValueProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,5 @@
1
1
  import { ValueProps } from '../types';
2
+ /**
3
+ * Displays the formatted minimum value for a spread widget data item.
4
+ */
2
5
  export declare function MinValue({ id, index, ...props }: ValueProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,5 @@
1
1
  import { ItemProps } from '../../formula/types';
2
+ /**
3
+ * Renders a dash separator between the min and max values in a spread widget.
4
+ */
2
5
  export declare function Separator(props: Omit<ItemProps, 'children'>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,16 @@
1
1
  import { DownloadItem } from '../actions';
2
2
  import { ConfigProps } from '../loader/types';
3
3
  import { SpreadWidgetConfig, SpreadWidgetData } from './types';
4
+ /**
5
+ * Creates download configuration for spread widgets, supporting PNG (screenshot) and CSV (min/max data) exports.
6
+ *
7
+ * @param props - Configuration with `refUI` reference for PNG export.
8
+ * @returns Array of download items for use with the Download action.
9
+ */
4
10
  export declare function spreadDownloadConfig({ refUI, }: ConfigProps): DownloadItem<SpreadWidgetData>[];
11
+ /**
12
+ * Returns the default configuration for spread (min/max value range) widgets.
13
+ *
14
+ * @returns Default spread widget config with empty series.
15
+ */
5
16
  export declare function spreadConfig(): SpreadWidgetConfig;
@@ -1,2 +1,5 @@
1
1
  import { SpreadUIProps } from './types';
2
+ /**
3
+ * Renders a spread widget displaying min-max value pairs with optional prefixes, suffixes, and series indicators.
4
+ */
2
5
  export declare function SpreadUI(props: SpreadUIProps): import("react/jsx-runtime").JSX.Element;
@@ -29,6 +29,8 @@ export interface WidgetsStoreProps {
29
29
  registeredTools?: ToolRegistration[];
30
30
  /** Formatter function for widget values */
31
31
  formatter?: (value: number) => string;
32
+ /** Formatter function for widget label/category values */
33
+ labelFormatter?: (value: string | number) => string | number;
32
34
  /** Locale for number formatting (e.g., 'en-US', 'es-ES', 'fr-FR') */
33
35
  locale?: string;
34
36
  }
@@ -1,2 +1,13 @@
1
1
  import { WidgetSubHeaderProps } from './types';
2
+ /**
3
+ * Flexible two-slot layout for displaying supplementary widget information such as totals, timestamps, or controls. Uses flexbox with space-between justification.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * <WidgetSubHeader
8
+ * slotLeft={<Typography variant="caption">Total: 1,234</Typography>}
9
+ * slotRight={<Typography variant="caption">Updated: 2m ago</Typography>}
10
+ * />
11
+ * ```
12
+ */
2
13
  export declare function WidgetSubHeader({ slotLeft, slotRight, sx, }: WidgetSubHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -6,11 +6,16 @@ export declare const DEFAULT_ROWS_PER_PAGE_OPTIONS: number[];
6
6
  export declare const DEFAULT_COLUMN_ID: null;
7
7
  export declare const DEFAULT_DIRECTION: SortDirection;
8
8
  /**
9
- * Default table download configuration
10
- * Supports PNG export (screenshot) and CSV export (data)
9
+ * Creates download configuration for table widgets, supporting PNG (screenshot) and CSV (data) exports. CSV output uses column keys as headers and filters out `id` fields.
10
+ *
11
+ * @param props - Configuration with `refUI` reference for PNG export.
12
+ * @returns Array of download items for use with the Download action.
11
13
  */
12
14
  export declare function tableDownloadConfig({ refUI, }: ConfigProps): TableDownloadConfig;
13
15
  /**
14
- * Default table widget configuration
16
+ * Returns the default configuration for table widgets with pagination and sorting, including column definitions and local data mode.
17
+ *
18
+ * @param columns - Array of column definitions for the table.
19
+ * @returns Default table widget config.
15
20
  */
16
21
  export declare function tableConfig(columns?: TableColumn[]): TableWidgetConfig;
@@ -26,8 +26,16 @@ export interface UsePaginationResult<T> {
26
26
  goToPreviousPage: () => void;
27
27
  }
28
28
  /**
29
- * Hook for managing table pagination
30
- * Supports both local (client-side) and remote (server-side) pagination
31
- * State is persisted in the widget store for the given widgetId
29
+ * Hook for managing table pagination with support for both local (client-side) and remote (server-side) modes.
30
+ * State is persisted in the widget store for the given widget ID.
31
+ *
32
+ * @param widgetId - The widget ID to persist pagination state under.
33
+ * @param data - The full data array (used for local pagination and total count fallback).
34
+ * @returns Pagination state and navigation helpers.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * const { page, setPage, paginatedData, totalPages } = usePagination(widgetId, data)
39
+ * ```
32
40
  */
33
41
  export declare function usePagination<T extends TableRow>(widgetId: string, data: T[]): UsePaginationResult<T>;
@@ -24,7 +24,16 @@ export interface UseSelectionResult {
24
24
  clearSelection: () => void;
25
25
  }
26
26
  /**
27
- * Hook for managing table row selection
28
- * Selection persists across pagination and is stored in the widget store
27
+ * Hook for managing table row selection with persistence across pagination.
28
+ * Selection state is stored in the widget store for the given widget ID.
29
+ *
30
+ * @param widgetId - The widget ID to persist selection state under.
31
+ * @param options - Optional configuration including an `onSelectionChange` callback.
32
+ * @returns Selection state and control functions (toggle, select, deselect, clear).
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * const { selectedIds, isAllSelected, handleSelectRow, clearSelection } = useSelection(widgetId)
37
+ * ```
29
38
  */
30
39
  export declare function useSelection(widgetId: string, options?: UseSelectionOptions): UseSelectionResult;
@@ -15,8 +15,16 @@ export interface UseSortResult<T> extends SortState {
15
15
  clearSort: () => void;
16
16
  }
17
17
  /**
18
- * Hook for managing table sorting
19
- * Supports both local (client-side) and remote (server-side) sorting
20
- * State is persisted in the widget store for the given widgetId
18
+ * Hook for managing table sorting with support for both local (client-side) and remote (server-side) modes.
19
+ * State is persisted in the widget store for the given widget ID.
20
+ *
21
+ * @param widgetId - The widget ID to persist sort state under.
22
+ * @param data - The data array to sort (for local mode).
23
+ * @returns Sort state, sorted data, and sort control functions.
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * const { sortedData, sortField, sortDirection, handleSort } = useSort(widgetId, data)
28
+ * ```
21
29
  */
22
30
  export declare function useSort<T extends TableRow>(widgetId: string, data: T[]): UseSortResult<T>;
@@ -1,5 +1,9 @@
1
- import { TimeseriesConfig, TimeseriesWidgetConfig, TimeseriesWidgetData } from './types';
2
- import { DownloadItem } from '../actions';
3
- import { ConfigProps } from '../loader/types';
4
- export declare function timeseriesDownloadConfig({ refUI, }: ConfigProps): DownloadItem<TimeseriesWidgetData>[];
1
+ import { TimeseriesConfig, TimeseriesWidgetConfig } from './types';
2
+ export declare const timeseriesDownloadConfig: ({ refUI }: import('../loader').ConfigProps) => import('../actions').DownloadItem<import('../echart').EchartWidgetData>[];
3
+ /**
4
+ * Generates ECharts configuration for line and area chart widgets over time, with smooth curves, rotated axis labels, and CARTO qualitative color palette.
5
+ *
6
+ * @param props - Timeseries configuration including data and theme.
7
+ * @returns Widget config with ECharts option object.
8
+ */
5
9
  export declare function timeseriesConfig(props: TimeseriesConfig): TimeseriesWidgetConfig;
@@ -0,0 +1,3 @@
1
+ import { DownloadItem } from '../../actions';
2
+ import { ConfigProps } from '../../loader/types';
3
+ export declare function createChartDownloadConfig<TData>(csvModifier: (data: TData) => string[][]): ({ refUI }: ConfigProps) => DownloadItem<TData>[];
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Shared utilities for chart widget configuration
3
3
  */
4
+ export { defaultFormatter, defaultLabelFormatter } from '../formatter';
4
5
  export { createChartWidgetConfig } from './config-factory';
5
6
  export type { ChartWidgetBaseConfig, CreateChartWidgetConfigParams, } from './config-factory';
6
7
  export { flattenObjectArrayToCSV, scatterplotDataToCSV } from './csv-modifiers';
7
8
  export { buildLegendConfig, buildGridConfig, createTooltipPositioner, createAxisLabelFormatter, createTooltipFormatter, applyXAxisFormatter, applyYAxisFormatter, niceNum, } from './option-builders';
9
+ export { createChartDownloadConfig } from './download-config';
@@ -1,6 +1,6 @@
1
1
  import { Theme } from '@mui/material';
2
2
  import { LegendComponentOption } from 'echarts';
3
- import { CallbackDataParams, TopLevelFormatterParams } from '../../../../node_modules/echarts/types/dist/shared';
3
+ import { CallbackDataParams, TopLevelFormatterParams } from 'echarts/types/dist/shared';
4
4
  /**
5
5
  * Shared EChart configuration builders for chart widgets
6
6
  */
@@ -14,10 +14,15 @@ export declare function niceNum(value: number): number;
14
14
  /**
15
15
  * Builds standard legend configuration for chart widgets
16
16
  *
17
- * @param hasLegend - Whether to show the legend
17
+ * @param params - Legend configuration parameters
18
+ * @param params.hasLegend - Whether to show the legend
19
+ * @param params.labelFormatter - Optional formatter for legend item names
18
20
  * @returns Legend configuration object
19
21
  */
20
- export declare function buildLegendConfig(hasLegend: boolean): LegendComponentOption;
22
+ export declare function buildLegendConfig({ hasLegend, labelFormatter, }: {
23
+ hasLegend: boolean;
24
+ labelFormatter?: (value: string | number) => string | number;
25
+ }): LegendComponentOption;
21
26
  /**
22
27
  * Builds standard grid configuration with legend-aware spacing
23
28
  *
@@ -49,16 +54,16 @@ export declare function createTooltipPositioner(theme: Theme): (point: [number,
49
54
  */
50
55
  export declare function createAxisLabelFormatter(formatter?: (value: number) => string): ((value: number) => string) | undefined;
51
56
  /**
52
- * Applies formatter to xAxis configuration
53
- * Only applies to single axis objects (not arrays) with type 'value'
57
+ * Applies labelFormatter to xAxis configuration
58
+ * Applies to any xAxis regardless of axis type (category, value, etc.)
54
59
  *
55
60
  * @param xAxis - Existing xAxis configuration
56
- * @param formatter - Optional formatter function from widget config
57
- * @returns Updated xAxis configuration or undefined if no changes needed
61
+ * @param labelFormatter - Optional labelFormatter function from widget config
62
+ * @returns Updated xAxis configuration
58
63
  */
59
- export declare function applyXAxisFormatter(xAxis: unknown, formatter?: (value: number) => string): {
64
+ export declare function applyXAxisFormatter(xAxis: unknown, formatter?: (value: string | number) => string | number): {
60
65
  axisLabel: {
61
- formatter: ((value: number) => string) | undefined;
66
+ formatter: ((value: string | number) => string) | undefined;
62
67
  };
63
68
  type?: string;
64
69
  };
@@ -0,0 +1,2 @@
1
+ export declare const defaultFormatter: (value: number) => string;
2
+ export declare const defaultLabelFormatter: (value: string | number) => string | number;