@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.
- package/dist/components.js.map +1 -1
- package/dist/download-config-Dqu78h2a.js +57 -0
- package/dist/download-config-Dqu78h2a.js.map +1 -0
- package/dist/error-CEkRPccv.js.map +1 -1
- package/dist/exports-Cr43OCul.js.map +1 -1
- package/dist/formatter-B9Bxn1k7.js +6 -0
- package/dist/formatter-B9Bxn1k7.js.map +1 -0
- package/dist/lasso-tool-BYbxrJ-7.js.map +1 -1
- package/dist/note-t51drNe0.js.map +1 -1
- package/dist/options-D9wflre6.js.map +1 -1
- package/dist/row-DTCV0Ocm.js.map +1 -1
- package/dist/series-CYNOu2Ju.js.map +1 -1
- package/dist/smart-tooltip-D4vwQpFf.js.map +1 -1
- package/dist/styles-Y8q7Jff3.js +118 -0
- package/dist/styles-Y8q7Jff3.js.map +1 -0
- package/dist/tooltip-BDnrRKrp.js.map +1 -1
- package/dist/types/components/basemaps/basemaps.d.ts +20 -0
- package/dist/types/components/geolocation-controls/geolocation-controls.d.ts +11 -0
- package/dist/types/components/lasso-tool/lasso-tool-inline.d.ts +17 -0
- package/dist/types/components/lasso-tool/lasso-tool.d.ts +21 -0
- package/dist/types/components/list-data/list-data.d.ts +16 -0
- package/dist/types/components/measurement-tools/measurement-tools.d.ts +20 -0
- package/dist/types/components/smart-tooltip/smart-tooltip.d.ts +17 -0
- package/dist/types/components/tooltip/tooltip.d.ts +13 -0
- package/dist/types/components/zoom-controls/zoom-controls.d.ts +16 -0
- package/dist/types/hooks/use-widget-ref.d.ts +4 -4
- package/dist/types/widgets/actions/brush-toggle/types.d.ts +8 -2
- package/dist/types/widgets/actions/download/download.d.ts +11 -0
- package/dist/types/widgets/actions/download/exports.d.ts +15 -0
- package/dist/types/widgets/actions/fullscreen/fullscreen.d.ts +13 -0
- package/dist/types/widgets/actions/index.d.ts +1 -1
- package/dist/types/widgets/actions/relative-data/relative-data.d.ts +1 -0
- package/dist/types/widgets/bar/config.d.ts +8 -4
- package/dist/types/widgets/category/category-ui.d.ts +3 -0
- package/dist/types/widgets/category/components/category-bar.d.ts +3 -0
- package/dist/types/widgets/category/components/category-legend.d.ts +3 -0
- package/dist/types/widgets/category/components/category-row-multi.d.ts +5 -1
- package/dist/types/widgets/category/components/category-row-other.d.ts +3 -0
- package/dist/types/widgets/category/components/category-row-single.d.ts +5 -1
- package/dist/types/widgets/category/config.d.ts +11 -0
- package/dist/types/widgets/category/types.d.ts +1 -0
- package/dist/types/widgets/echart/echart-ui.d.ts +7 -0
- package/dist/types/widgets/echart/echart.d.ts +6 -0
- package/dist/types/widgets/echart/options.d.ts +7 -0
- package/dist/types/widgets/echart/types.d.ts +3 -0
- package/dist/types/widgets/echart/utils.d.ts +41 -0
- package/dist/types/widgets/error/error.d.ts +10 -0
- package/dist/types/widgets/formula/components/item.d.ts +3 -0
- package/dist/types/widgets/formula/components/prefix.d.ts +3 -0
- package/dist/types/widgets/formula/components/row.d.ts +3 -0
- package/dist/types/widgets/formula/components/series.d.ts +3 -0
- package/dist/types/widgets/formula/components/suffix.d.ts +3 -0
- package/dist/types/widgets/formula/components/value.d.ts +3 -0
- package/dist/types/widgets/formula/config.d.ts +11 -0
- package/dist/types/widgets/formula/formula-ui.d.ts +3 -0
- package/dist/types/widgets/histogram/config.d.ts +18 -2
- package/dist/types/widgets/histogram/index.d.ts +2 -1
- package/dist/types/widgets/histogram/types.d.ts +6 -3
- package/dist/types/widgets/loader/loader.d.ts +22 -0
- package/dist/types/widgets/loader/utils.d.ts +26 -3
- package/dist/types/widgets/markdown/config.d.ts +10 -0
- package/dist/types/widgets/markdown/markdown-ui.d.ts +7 -0
- package/dist/types/widgets/markdown/markdown.d.ts +3 -0
- package/dist/types/widgets/note/note.d.ts +10 -0
- package/dist/types/widgets/pie/config.d.ts +8 -4
- package/dist/types/widgets/range/components/range-item.d.ts +3 -0
- package/dist/types/widgets/range/config.d.ts +5 -0
- package/dist/types/widgets/range/range-ui.d.ts +3 -0
- package/dist/types/widgets/scatterplot/config.d.ts +7 -3
- package/dist/types/widgets/selection-summary/selection-summary.d.ts +11 -0
- package/dist/types/widgets/skeleton-loader/skeleton-loader.d.ts +10 -0
- package/dist/types/widgets/spread/components/max-value.d.ts +3 -0
- package/dist/types/widgets/spread/components/min-value.d.ts +3 -0
- package/dist/types/widgets/spread/components/separator.d.ts +3 -0
- package/dist/types/widgets/spread/config.d.ts +11 -0
- package/dist/types/widgets/spread/spread-ui.d.ts +3 -0
- package/dist/types/widgets/stores/types.d.ts +2 -0
- package/dist/types/widgets/subheader/subheader.d.ts +11 -0
- package/dist/types/widgets/table/config.d.ts +8 -3
- package/dist/types/widgets/table/hooks/use-pagination.d.ts +11 -3
- package/dist/types/widgets/table/hooks/use-selection.d.ts +11 -2
- package/dist/types/widgets/table/hooks/use-sort.d.ts +11 -3
- package/dist/types/widgets/timeseries/config.d.ts +8 -4
- package/dist/types/widgets/utils/chart-config/download-config.d.ts +3 -0
- package/dist/types/widgets/{_shared → utils}/chart-config/index.d.ts +2 -0
- package/dist/types/widgets/{_shared → utils}/chart-config/option-builders.d.ts +14 -9
- package/dist/types/widgets/utils/formatter.d.ts +2 -0
- package/dist/types/widgets/utils/index.d.ts +7 -0
- package/dist/types/widgets/wrapper/components/actions.d.ts +3 -0
- package/dist/types/widgets/wrapper/components/options.d.ts +3 -0
- package/dist/types/widgets/wrapper/components/title.d.ts +3 -0
- package/dist/types/widgets/wrapper/wrapper-ui.d.ts +14 -0
- package/dist/types/widgets/wrapper/wrapper.d.ts +14 -0
- package/dist/use-widget-ref-wtFLDFCD.js.map +1 -1
- package/dist/utils-BOhInag6.js.map +1 -1
- package/dist/widgets/actions.js +720 -681
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +78 -92
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/category.js +206 -197
- package/dist/widgets/category.js.map +1 -1
- package/dist/widgets/echart.js.map +1 -1
- package/dist/widgets/formula.js +54 -54
- package/dist/widgets/formula.js.map +1 -1
- package/dist/widgets/histogram.js +106 -86
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/loader.js.map +1 -1
- package/dist/widgets/markdown.js.map +1 -1
- package/dist/widgets/pie.js +147 -112
- package/dist/widgets/pie.js.map +1 -1
- package/dist/widgets/range.js +23 -22
- package/dist/widgets/range.js.map +1 -1
- package/dist/widgets/scatterplot.js +46 -60
- package/dist/widgets/scatterplot.js.map +1 -1
- package/dist/widgets/selection-summary.js.map +1 -1
- package/dist/widgets/skeleton-loader.js.map +1 -1
- package/dist/widgets/spread.js +40 -41
- package/dist/widgets/spread.js.map +1 -1
- package/dist/widgets/subheader.js.map +1 -1
- package/dist/widgets/table.js.map +1 -1
- package/dist/widgets/timeseries.js +51 -65
- package/dist/widgets/timeseries.js.map +1 -1
- package/dist/widgets/toolbar-actions.js +101 -6693
- package/dist/widgets/toolbar-actions.js.map +1 -1
- package/dist/widgets/utils.js +33 -0
- package/dist/widgets/utils.js.map +1 -0
- package/dist/widgets/wrapper.js.map +1 -1
- package/package.json +9 -4
- package/src/components/basemaps/basemaps.tsx +20 -0
- package/src/components/geolocation-controls/geolocation-controls.tsx +11 -0
- package/src/components/lasso-tool/lasso-tool-inline.tsx +17 -0
- package/src/components/lasso-tool/lasso-tool.tsx +21 -0
- package/src/components/list-data/list-data.tsx +16 -0
- package/src/components/measurement-tools/measurement-tools.tsx +20 -0
- package/src/components/smart-tooltip/smart-tooltip.tsx +17 -0
- package/src/components/tooltip/tooltip.tsx +13 -0
- package/src/components/zoom-controls/zoom-controls.tsx +16 -0
- package/src/hooks/use-widget-ref.ts +4 -4
- package/src/widgets/README.md +13 -13
- package/src/widgets/actions/brush-toggle/brush-toggle.tsx +42 -47
- package/src/widgets/actions/brush-toggle/types.ts +8 -2
- package/src/widgets/actions/download/download.tsx +11 -0
- package/src/widgets/actions/download/exports.tsx +15 -0
- package/src/widgets/actions/fullscreen/fullscreen.tsx +13 -0
- package/src/widgets/actions/index.ts +1 -0
- package/src/widgets/actions/relative-data/relative-data.test.tsx +62 -1
- package/src/widgets/actions/relative-data/relative-data.tsx +62 -39
- package/src/widgets/bar/config.ts +34 -34
- package/src/widgets/bar/style.ts +1 -1
- package/src/widgets/category/category-ui.tsx +12 -2
- package/src/widgets/category/components/category-bar.tsx +3 -0
- package/src/widgets/category/components/category-legend.tsx +3 -0
- package/src/widgets/category/components/category-row-multi.tsx +9 -2
- package/src/widgets/category/components/category-row-other.tsx +3 -0
- package/src/widgets/category/components/category-row-single.tsx +8 -1
- package/src/widgets/category/config.ts +11 -0
- package/src/widgets/category/types.ts +1 -0
- package/src/widgets/echart/echart-ui.tsx +7 -0
- package/src/widgets/echart/echart.tsx +6 -0
- package/src/widgets/echart/options.ts +7 -0
- package/src/widgets/echart/types.ts +3 -0
- package/src/widgets/echart/utils.ts +41 -0
- package/src/widgets/error/error.tsx +10 -0
- package/src/widgets/formula/components/item.tsx +3 -0
- package/src/widgets/formula/components/prefix.tsx +3 -0
- package/src/widgets/formula/components/row.tsx +3 -0
- package/src/widgets/formula/components/series.tsx +3 -0
- package/src/widgets/formula/components/suffix.tsx +3 -0
- package/src/widgets/formula/components/value.tsx +4 -2
- package/src/widgets/formula/config.ts +11 -0
- package/src/widgets/formula/formula-ui.tsx +3 -0
- package/src/widgets/histogram/config.ts +93 -21
- package/src/widgets/histogram/index.ts +6 -1
- package/src/widgets/histogram/style.ts +1 -1
- package/src/widgets/histogram/types.ts +9 -3
- package/src/widgets/loader/loader.tsx +22 -0
- package/src/widgets/loader/utils.ts +26 -3
- package/src/widgets/markdown/config.ts +10 -0
- package/src/widgets/markdown/markdown-ui.tsx +7 -0
- package/src/widgets/markdown/markdown.tsx +3 -0
- package/src/widgets/note/note.tsx +10 -0
- package/src/widgets/pie/config.ts +100 -33
- package/src/widgets/pie/style.ts +1 -1
- package/src/widgets/range/components/range-item.tsx +5 -2
- package/src/widgets/range/config.ts +5 -0
- package/src/widgets/range/range-ui.tsx +3 -0
- package/src/widgets/scatterplot/config.ts +19 -23
- package/src/widgets/scatterplot/style.ts +1 -1
- package/src/widgets/selection-summary/selection-summary.tsx +11 -0
- package/src/widgets/skeleton-loader/skeleton-loader.tsx +10 -0
- package/src/widgets/spread/components/max-value.tsx +4 -2
- package/src/widgets/spread/components/min-value.tsx +4 -2
- package/src/widgets/spread/components/separator.tsx +3 -0
- package/src/widgets/spread/config.ts +11 -0
- package/src/widgets/spread/spread-ui.tsx +3 -0
- package/src/widgets/stores/types.ts +2 -0
- package/src/widgets/subheader/subheader.tsx +11 -0
- package/src/widgets/table/config.ts +8 -3
- package/src/widgets/table/hooks/use-pagination.ts +11 -3
- package/src/widgets/table/hooks/use-selection.ts +11 -2
- package/src/widgets/table/hooks/use-sort.ts +11 -3
- package/src/widgets/timeseries/config.ts +32 -33
- package/src/widgets/timeseries/style.ts +1 -1
- package/src/widgets/utils/chart-config/download-config.ts +22 -0
- package/src/widgets/{_shared → utils}/chart-config/index.ts +4 -0
- package/src/widgets/{_shared → utils}/chart-config/option-builders.ts +23 -13
- package/src/widgets/utils/formatter.ts +2 -0
- package/src/widgets/utils/index.ts +26 -0
- package/src/widgets/wrapper/components/actions.tsx +3 -0
- package/src/widgets/wrapper/components/options.tsx +3 -0
- package/src/widgets/wrapper/components/title.tsx +3 -0
- package/src/widgets/wrapper/wrapper-ui.tsx +14 -0
- package/src/widgets/wrapper/wrapper.tsx +14 -0
- package/dist/styles-CAroD5Rc.js +0 -123
- package/dist/styles-CAroD5Rc.js.map +0 -1
- /package/dist/types/widgets/{_shared → utils}/chart-config/config-factory.d.ts +0 -0
- /package/dist/types/widgets/{_shared → utils}/chart-config/csv-modifiers.d.ts +0 -0
- /package/dist/types/widgets/{_shared → utils}/chart-config/option-builders.test.d.ts +0 -0
- /package/dist/types/widgets/{_shared → utils}/skeleton/index.d.ts +0 -0
- /package/dist/types/widgets/{_shared → utils}/skeleton/styles.d.ts +0 -0
- /package/src/widgets/{_shared → utils}/chart-config/config-factory.ts +0 -0
- /package/src/widgets/{_shared → utils}/chart-config/csv-modifiers.ts +0 -0
- /package/src/widgets/{_shared → utils}/chart-config/option-builders.test.ts +0 -0
- /package/src/widgets/{_shared → utils}/skeleton/index.ts +0 -0
- /package/src/widgets/{_shared → utils}/skeleton/styles.ts +0 -0
|
@@ -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":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-BDnrRKrp.js","sources":["../src/components/tooltip/tooltip.tsx"],"sourcesContent":["import { Tooltip as MuiTooltip, type TooltipProps } from '@mui/material'\n\nlet tooltipEnterDelay = 500\n\n/**\n * A wrapper around MUI's Tooltip component with enterNextDelay set to 1000ms by default.\n *\n * This component ensures consistent tooltip behavior across the application.\n *\n * @example\n * <Tooltip title=\"This is a tooltip\">\n * <Button>Hover me</Button>\n * </Tooltip>\n */\nexport function Tooltip({\n children,\n title,\n enterNextDelay = tooltipEnterDelay,\n ...props\n}: TooltipProps) {\n return (\n <MuiTooltip title={title} enterNextDelay={enterNextDelay} {...props}>\n {children}\n </MuiTooltip>\n )\n}\n\nexport function setTooltipEnterDelay(delay: number) {\n tooltipEnterDelay = delay\n}\n"],"names":["tooltipEnterDelay","Tooltip","t0","$","_c","children","props","t1","title","enterNextDelay","undefined","t2","MuiTooltip","setTooltipEnterDelay","delay"],"mappings":";;;AAEA,IAAIA,IAAoB;AAYjB,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA;AAAA,MAAAC,GAAAC,GAAAC,GAAAC;AAAA,EAAAL,SAAAD,KAAiB;AAAA,IAAAG,UAAAA;AAAAA,IAAAG,OAAAA;AAAAA,IAAAC,gBAAAF;AAAAA,IAAA,GAAAD;AAAAA,EAAAA,IAAAJ,GAKTC,OAAAD,GAAAC,OAAAE,GAAAF,OAAAG,GAAAH,OAAAI,GAAAJ,OAAAK,MAAAH,IAAAF,EAAA,CAAA,GAAAG,IAAAH,EAAA,CAAA,GAAAI,IAAAJ,EAAA,CAAA,GAAAK,IAAAL,EAAA,CAAA;AAFb,QAAAM,IAAAF,MAAAG,SAAAV,IAAAO;AAAkC,MAAAI;AAAA,SAAAR,EAAA,CAAA,MAAAE,KAAAF,EAAA,CAAA,MAAAM,KAAAN,EAAA,CAAA,MAAAG,KAAAH,SAAAK,KAIhCG,sBAACC,GAAA,EAAkBJ,OAAAA,GAAuBC,gBAAAA,MAAoBH,gBAE9D,GAAaH,OAAAE,GAAAF,OAAAM,GAAAN,OAAAG,GAAAH,OAAAK,GAAAL,OAAAQ,KAAAA,IAAAR,EAAA,CAAA,GAFbQ;AAEa;
|
|
1
|
+
{"version":3,"file":"tooltip-BDnrRKrp.js","sources":["../src/components/tooltip/tooltip.tsx"],"sourcesContent":["import { Tooltip as MuiTooltip, type TooltipProps } from '@mui/material'\n\nlet tooltipEnterDelay = 500\n\n/**\n * A wrapper around MUI's Tooltip component with enterNextDelay set to 1000ms by default.\n *\n * This component ensures consistent tooltip behavior across the application.\n *\n * @example\n * <Tooltip title=\"This is a tooltip\">\n * <Button>Hover me</Button>\n * </Tooltip>\n */\nexport function Tooltip({\n children,\n title,\n enterNextDelay = tooltipEnterDelay,\n ...props\n}: TooltipProps) {\n return (\n <MuiTooltip title={title} enterNextDelay={enterNextDelay} {...props}>\n {children}\n </MuiTooltip>\n )\n}\n\n/**\n * Sets the global default `enterNextDelay` for all Tooltip components in the application.\n *\n * @param delay - Delay in milliseconds before showing tooltips on subsequent hovers.\n *\n * @example\n * ```tsx\n * import { setTooltipEnterDelay } from '@carto/ps-react-ui/components';\n *\n * // Set global delay to 300ms at app initialization\n * setTooltipEnterDelay(300);\n * ```\n */\nexport function setTooltipEnterDelay(delay: number) {\n tooltipEnterDelay = delay\n}\n"],"names":["tooltipEnterDelay","Tooltip","t0","$","_c","children","props","t1","title","enterNextDelay","undefined","t2","MuiTooltip","setTooltipEnterDelay","delay"],"mappings":";;;AAEA,IAAIA,IAAoB;AAYjB,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA;AAAA,MAAAC,GAAAC,GAAAC,GAAAC;AAAA,EAAAL,SAAAD,KAAiB;AAAA,IAAAG,UAAAA;AAAAA,IAAAG,OAAAA;AAAAA,IAAAC,gBAAAF;AAAAA,IAAA,GAAAD;AAAAA,EAAAA,IAAAJ,GAKTC,OAAAD,GAAAC,OAAAE,GAAAF,OAAAG,GAAAH,OAAAI,GAAAJ,OAAAK,MAAAH,IAAAF,EAAA,CAAA,GAAAG,IAAAH,EAAA,CAAA,GAAAI,IAAAJ,EAAA,CAAA,GAAAK,IAAAL,EAAA,CAAA;AAFb,QAAAM,IAAAF,MAAAG,SAAAV,IAAAO;AAAkC,MAAAI;AAAA,SAAAR,EAAA,CAAA,MAAAE,KAAAF,EAAA,CAAA,MAAAM,KAAAN,EAAA,CAAA,MAAAG,KAAAH,SAAAK,KAIhCG,sBAACC,GAAA,EAAkBJ,OAAAA,GAAuBC,gBAAAA,MAAoBH,gBAE9D,GAAaH,OAAAE,GAAAF,OAAAM,GAAAN,OAAAG,GAAAH,OAAAK,GAAAL,OAAAQ,KAAAA,IAAAR,EAAA,CAAA,GAFbQ;AAEa;AAiBV,SAASE,EAAqBC,GAAe;AAClDd,EAAAA,IAAoBc;AACtB;"}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
import { BasemapsUIProps } from './types';
|
|
2
2
|
import { JSX } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Provides an interactive basemap selector with responsive drawer, grouping support, and customizable positioning.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is an uncontrolled component focused on UI presentation. Typically used with the `BasemapsControls` HOC from `@carto/ps-react-maps` for automatic state management.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <BasemapsControls mapId={mapId}>
|
|
12
|
+
* {({ basemap, setBasemap }) => (
|
|
13
|
+
* <BasemapsUI
|
|
14
|
+
* options={basemapOptions}
|
|
15
|
+
* selected={basemap}
|
|
16
|
+
* onChange={setBasemap}
|
|
17
|
+
* position="bottom-right"
|
|
18
|
+
* />
|
|
19
|
+
* )}
|
|
20
|
+
* </BasemapsControls>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
3
23
|
export declare function BasemapsUI({ options, labels: _labels, position, selected, onChange, TooltipProps, }: BasemapsUIProps): JSX.Element;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import { GeolocationControlProps } from './types';
|
|
2
2
|
import { JSX } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Provides a seamless interface for accessing device location through the browser's Geolocation API, with permission handling, continuous tracking, and error management.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <GeolocationControls
|
|
9
|
+
* onChange={(coords) => console.log(coords.latitude, coords.longitude)}
|
|
10
|
+
* onError={(error) => console.error(error.message)}
|
|
11
|
+
* />
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
3
14
|
export declare function GeolocationControls({ disabled, labels, PaperProps, TooltipProps, watch, onChange, onError, }: GeolocationControlProps): JSX.Element;
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { LassoToolsInlineComponentProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Provides an inline layout variant of the lasso tools interface with toggle button groups for mode selection and inline chip management for spatial filters.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <LassoToolsInlineUI
|
|
9
|
+
* enabled={enabled}
|
|
10
|
+
* values={spatialFilters}
|
|
11
|
+
* modes={modes}
|
|
12
|
+
* modesMapping={modesMapping}
|
|
13
|
+
* modeSelected={modeSelected}
|
|
14
|
+
* onChangeMode={setModeSelected}
|
|
15
|
+
* onChipToggle={handleChipToggle}
|
|
16
|
+
* onDelete={handleDelete}
|
|
17
|
+
* />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
3
20
|
export declare function LassoToolsInlineUI({ enabled, values, chipProps, labels, modes, modesMapping, modeSelected, BoxProps: { sx, ...BoxProps }, onChipToggle, onDelete, onChangeMode, onAllChipToggle, onAllDelete, }: LassoToolsInlineComponentProps): JSX.Element;
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { PickDeep } from 'type-fest';
|
|
3
3
|
import { LassoToolsComponentProps, OptionsChildrenProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Provides a comprehensive floating interface for spatial selection and drawing operations on maps, supporting polygon, rectangle, circle, freehand lasso, and edit modes.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Supports customizable slots for action, options, chips, and secondary actions via compound component pattern (e.g., `LassoToolsUI.Action`, `LassoToolsUI.Chips`).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <LassoToolsUI
|
|
13
|
+
* enabled={enabled}
|
|
14
|
+
* values={spatialFilters}
|
|
15
|
+
* modes={modes}
|
|
16
|
+
* modesMapping={modesMapping}
|
|
17
|
+
* modeSelected={modeSelected}
|
|
18
|
+
* onActionToggle={setEnabled}
|
|
19
|
+
* onChangeMode={setModeSelected}
|
|
20
|
+
* onChipToggle={handleChipToggle}
|
|
21
|
+
* onDelete={handleDelete}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
4
25
|
export declare function LassoToolsUI({ enabled, values, actionProps, chipProps, labels, modes, modesMapping, modeSelected, PaperProps: { sx, ...PaperProps }, onActionToggle, onChipToggle, onDelete, onChangeMode, onAllChipToggle, onAllDelete, ChipsSlot, ActionSlot, SecondaryActionsSlot, OptionsSlot, }: LassoToolsComponentProps): JSX.Element;
|
|
5
26
|
export declare namespace LassoToolsUI {
|
|
6
27
|
var Action: ({ modes, modesMapping, modeSelected, actionProps, enabled, labels, onActionToggle, }: Partial<Omit<LassoToolsComponentProps, "ChipsSlot" | "ActionsSlot" | "OptionsSlot" | "SecondaryActionsSlot">> & {
|
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { ListDataProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Displays structured data in an accessible list format with expandable views, interactive selection, tooltips, and loading states.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <ListDataUI
|
|
9
|
+
* data={[
|
|
10
|
+
* { id: '1', label: 'Population', value: '8.4M' },
|
|
11
|
+
* { id: '2', label: 'Median Age', value: '32 years' },
|
|
12
|
+
* ]}
|
|
13
|
+
* maxItems={3}
|
|
14
|
+
* onItemClick={(item) => setSelectedId(item.id)}
|
|
15
|
+
* selectedItemId={selectedId}
|
|
16
|
+
* />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
3
19
|
export declare function ListDataUI({ data, isLoading, maxItems, labels, showDivider, selectedItemId, tooltipProps, onExpand, onItemClick, }: ListDataProps): JSX.Element;
|
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
import { JSX } from 'react';
|
|
2
2
|
import { MeasurementToolsComponentProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Provides a measurement interface for calculating distances, areas, and buffers on maps with support for metric and imperial unit systems and real-time unit conversion.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <MeasurementToolsUI
|
|
9
|
+
* enabled={enabled}
|
|
10
|
+
* value={measurementValue}
|
|
11
|
+
* modes={DEFAULT_MEASUREMENT_TOOLS_MODES}
|
|
12
|
+
* units={DEFAULT_MEASUREMENT_TOOLS_UNITS}
|
|
13
|
+
* modesMapping={DEFAULT_MEASUREMENT_TOOLS_MODES_MAPPING}
|
|
14
|
+
* unitsMapping={DEFAULT_MEASUREMENT_TOOLS_UNITS_MAPPING}
|
|
15
|
+
* modeSelected={mode}
|
|
16
|
+
* unitSelected={unit}
|
|
17
|
+
* onActionToggle={setEnabled}
|
|
18
|
+
* onChangeMode={setMode}
|
|
19
|
+
* onChangeUnit={setUnit}
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
3
23
|
export declare function MeasurementToolsUI({ enabled, actionProps, labels, modes, modesMapping, unitsMapping, modeSelected, PaperProps: { sx, ...PaperProps }, units, unitSelected, onActionToggle, onChangeMode, onChangeUnit, }: MeasurementToolsComponentProps): JSX.Element;
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { TooltipProps } from '@mui/material';
|
|
2
2
|
import { JSX, Ref } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* An intelligent tooltip wrapper that automatically detects text overflow and displays a tooltip only when content is truncated.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Uses a render prop pattern. The child function receives a `ref` that must be attached to the element being monitored for overflow. Use the `dependencies` array to trigger re-evaluation when content or container size changes.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <SmartTooltip title="This is a long text that might get truncated">
|
|
12
|
+
* {({ ref }) => (
|
|
13
|
+
* <Typography ref={ref} noWrap sx={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
14
|
+
* This is a long text that might get truncated
|
|
15
|
+
* </Typography>
|
|
16
|
+
* )}
|
|
17
|
+
* </SmartTooltip>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
3
20
|
export declare function SmartTooltip<T extends HTMLElement>({ title, dependencies, timeout, TooltipProps, children, }: {
|
|
4
21
|
title: string | undefined;
|
|
5
22
|
dependencies?: unknown[];
|
|
@@ -10,4 +10,17 @@ import { TooltipProps } from '@mui/material';
|
|
|
10
10
|
* </Tooltip>
|
|
11
11
|
*/
|
|
12
12
|
export declare function Tooltip({ children, title, enterNextDelay, ...props }: TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* Sets the global default `enterNextDelay` for all Tooltip components in the application.
|
|
15
|
+
*
|
|
16
|
+
* @param delay - Delay in milliseconds before showing tooltips on subsequent hovers.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { setTooltipEnterDelay } from '@carto/ps-react-ui/components';
|
|
21
|
+
*
|
|
22
|
+
* // Set global delay to 300ms at app initialization
|
|
23
|
+
* setTooltipEnterDelay(300);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
13
26
|
export declare function setTooltipEnterDelay(delay: number): void;
|
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
import { ZoomControlProps } from './types';
|
|
2
2
|
import { JSX } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Provides intuitive zoom controls for maps and zoomable interfaces with flexible layouts, loading states, and optional reset functionality.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is an uncontrolled component. Typically used with the `ZoomControls` HOC from `@carto/ps-react-maps` for automatic state management.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <ZoomControlsUI
|
|
12
|
+
* zoom={zoom}
|
|
13
|
+
* onChange={setZoom}
|
|
14
|
+
* minZoom={2}
|
|
15
|
+
* maxZoom={20}
|
|
16
|
+
* />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
3
19
|
export declare function ZoomControlsUI({ zoom, disabled, direction, reverse, isLoading, maxZoom, minZoom, PaperProps, ResetViewProps, showZoom, onChange, onReset, }: ZoomControlProps): JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* This allows other parts of the application to access the widget's DOM element.
|
|
2
|
+
* Registers a DOM element ref and an ECharts instance ref with the widget store.
|
|
3
|
+
* This allows other parts of the application (e.g., screenshot export) to access the widget's DOM element.
|
|
4
4
|
*
|
|
5
|
-
* @param widgetId - The widget ID to register the
|
|
6
|
-
* @returns
|
|
5
|
+
* @param widgetId - The widget ID to register the refs under.
|
|
6
|
+
* @returns An object with `ref` (DOM element) and `instance` (ECharts instance) refs.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```tsx
|
|
@@ -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
|
-
*
|
|
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
|
|
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
|
*/
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import { DownloadProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Dropdown menu action for exporting widget data in various formats (CSV, PNG, etc.).
|
|
4
|
+
*
|
|
5
|
+
* Reads widget data from the store and triggers downloads using the modifier
|
|
6
|
+
* function defined in each `DownloadItem`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Download id={widgetId} items={barDownloadConfig({ refUI })} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export declare function Download({ id, items, labels, Icon, IconButtonProps, }: DownloadProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
import { DownloadItem } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Pre-configured download item for exporting widget data as a CSV file.
|
|
5
|
+
*
|
|
6
|
+
* Converts a 2D array of data into CSV format with proper escaping and
|
|
7
|
+
* triggers a browser download. Revokes the object URL after download.
|
|
8
|
+
*/
|
|
3
9
|
export declare const downloadToCSV: DownloadItem<unknown[][]>;
|
|
10
|
+
/**
|
|
11
|
+
* Pre-configured download item for exporting a widget as a PNG image.
|
|
12
|
+
*
|
|
13
|
+
* Uses html2canvas to capture the widget DOM element referenced by a React ref.
|
|
14
|
+
* Strips toolbar and action elements before capturing.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* The modifier expects a React ref to the widget's root HTML element, not raw data.
|
|
18
|
+
*/
|
|
4
19
|
export declare const downloadToPNG: Omit<DownloadItem, 'modifier'> & {
|
|
5
20
|
modifier: (ref: Ref<HTMLElement | null> | undefined) => Promise<string | undefined>;
|
|
6
21
|
};
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
import { FullScreenProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Displays widget content in a fullscreen modal dialog.
|
|
4
|
+
*
|
|
5
|
+
* Manages fullscreen state via the widget store and renders a MUI Dialog
|
|
6
|
+
* with the widget title and a close button.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <FullScreen id="my-widget" labels={{ ariaLabel: 'Expand chart' }}>
|
|
11
|
+
* <ChartContent id="my-widget" />
|
|
12
|
+
* </FullScreen>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
2
15
|
export declare function FullScreen({ id, labels, children, Icon, IconButtonProps, DialogContentProps: { sx, ...DialogContentProps }, DialogProps, }: FullScreenProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ export type { FullScreenState, FullScreenConfig } from './fullscreen/types';
|
|
|
3
3
|
export { Download } from './download/download';
|
|
4
4
|
export type { DownloadItem, DownloadProps } from './download/types';
|
|
5
5
|
export { downloadToCSV, downloadToPNG } from './download/exports';
|
|
6
|
-
export { RelativeData, RELATIVE_DATA_TOOL_ID, } from './relative-data/relative-data';
|
|
6
|
+
export { RelativeData, RELATIVE_DATA_TOOL_ID, RELATIVE_DATA_CONFIG_TOOL_ID, } from './relative-data/relative-data';
|
|
7
7
|
export type { RelativeDataProps } from './relative-data/types';
|
|
8
8
|
export { ZoomToggle, ZOOM_TOGGLE_TOOL_ID } from './zoom-toggle/zoom-toggle';
|
|
9
9
|
export type { ZoomToggleProps, ZoomState, ZoomConfig, } from './zoom-toggle/types';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RelativeDataProps } from './types';
|
|
2
2
|
export declare const RELATIVE_DATA_TOOL_ID = "relative-data";
|
|
3
|
+
export declare const RELATIVE_DATA_CONFIG_TOOL_ID = "relative-data-config";
|
|
3
4
|
/**
|
|
4
5
|
* Widget action to toggle between relative (percentage) and absolute data display.
|
|
5
6
|
*
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { BarConfig, BarWidgetConfig
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { BarConfig, BarWidgetConfig } from './types';
|
|
2
|
+
export declare const barDownloadConfig: ({ refUI }: import('../loader').ConfigProps) => import('../actions').DownloadItem<import('../echart').EchartWidgetData>[];
|
|
3
|
+
/**
|
|
4
|
+
* Generates ECharts configuration for bar chart widgets (vertical and horizontal), including axis, tooltip, legend, and series options styled with the CARTO theme.
|
|
5
|
+
*
|
|
6
|
+
* @param props - Bar chart configuration including data and theme.
|
|
7
|
+
* @returns Widget config with ECharts option object.
|
|
8
|
+
*/
|
|
5
9
|
export declare function barConfig(props: BarConfig): BarWidgetConfig;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { CategoryUIProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a category widget displaying horizontal bars for categorical data with support for single and multi-series layouts, selection, and overflow grouping.
|
|
4
|
+
*/
|
|
2
5
|
export declare function CategoryUI({ id }: CategoryUIProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -4,4 +4,7 @@ export interface CategoryBarProps {
|
|
|
4
4
|
color: string;
|
|
5
5
|
selected?: boolean;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Renders a single horizontal bar fill proportional to its value relative to the maximum.
|
|
9
|
+
*/
|
|
7
10
|
export declare function CategoryBar({ value, maxValue, color, selected, }: CategoryBarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,4 +3,7 @@ export interface CategoryLegendProps {
|
|
|
3
3
|
series: CategorySeriesConfig[];
|
|
4
4
|
colors: string[];
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Renders a color-coded legend for multi-series category widgets.
|
|
8
|
+
*/
|
|
6
9
|
export declare function CategoryLegend({ series, colors }: CategoryLegendProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -5,7 +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
|
+
/**
|
|
13
|
+
* Renders a multi-series category row with a label and multiple color-coded bars stacked vertically.
|
|
14
|
+
*/
|
|
15
|
+
export declare function CategoryRowMulti({ name, values, maxValue, colors, formatter, labelFormatter, onClick, selected, }: CategoryRowMultiProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,4 +3,7 @@ export interface CategoryRowOtherProps {
|
|
|
3
3
|
otherLabel?: string;
|
|
4
4
|
otherCountLabel?: string;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Renders an "Other" summary row indicating how many additional categories are hidden beyond `maxItems`.
|
|
8
|
+
*/
|
|
6
9
|
export declare function CategoryRowOther({ hiddenCount, otherLabel, otherCountLabel, }: CategoryRowOtherProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +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
|
+
/**
|
|
13
|
+
* Renders a single-series category row with a label, formatted value, and proportional bar.
|
|
14
|
+
*/
|
|
15
|
+
export declare function CategoryRowSingle({ name, value, maxValue, color, formatter, labelFormatter, onClick, selected, }: CategoryRowSingleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,6 +4,17 @@ import { CategoryWidgetConfig, CategoryWidgetData, CategorySeriesConfig } from '
|
|
|
4
4
|
interface CategoryDownloadConfigProps extends ConfigProps {
|
|
5
5
|
series?: CategorySeriesConfig[];
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Creates download configuration for category widgets, supporting PNG (screenshot) and CSV (data) exports. CSV output groups values by category across multiple series.
|
|
9
|
+
*
|
|
10
|
+
* @param props - Configuration with `refUI` reference and optional `series` for CSV column headers.
|
|
11
|
+
* @returns Array of download items for use with the Download action.
|
|
12
|
+
*/
|
|
7
13
|
export declare function categoryDownloadConfig({ refUI, series, }: CategoryDownloadConfigProps): DownloadItem<CategoryWidgetData>[];
|
|
14
|
+
/**
|
|
15
|
+
* Returns the default configuration for category list widgets, including empty series and a default `maxItems` of 10.
|
|
16
|
+
*
|
|
17
|
+
* @returns Default category widget config.
|
|
18
|
+
*/
|
|
8
19
|
export declare function categoryConfig(): CategoryWidgetConfig;
|
|
9
20
|
export {};
|
|
@@ -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;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { EchartUIProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Presentational component that initializes and manages an Apache ECharts instance.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Handles chart lifecycle (init, dispose), option updates, resize observation, and event listener management.
|
|
7
|
+
* Uses SVG renderer with a default height of 304px.
|
|
8
|
+
*/
|
|
2
9
|
export declare function EchartUI(props: EchartUIProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { EchartProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Stateful EChart widget component that reads data and options from the widget store and renders an ECharts chart.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Transforms widget data into ECharts dataset format and delegates rendering to {@link EchartUI}.
|
|
7
|
+
*/
|
|
2
8
|
export declare function Echart(props: EchartProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { EchartOptionsProps, EchartWidgetOptionProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the shared base ECharts options used across all EChart-based widgets (bar, pie, histogram, etc.).
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Configures grid spacing, tooltip styling, legend, axis pointer, and the default color palette
|
|
7
|
+
* derived from the MUI theme.
|
|
8
|
+
*/
|
|
2
9
|
export declare function getCommonOptions({ theme, }: EchartWidgetOptionProps<unknown>): EchartOptionsProps;
|
|
@@ -27,9 +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'];
|
|
36
|
+
formatter?: (value: number) => string;
|
|
37
|
+
labelFormatter?: (value: string | number) => string | number;
|
|
35
38
|
}
|