@carto/ps-react-ui 4.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/range-l4fNHLEg.js +213 -0
  2. package/dist/range-l4fNHLEg.js.map +1 -0
  3. package/dist/resolve-theme-color-BdojIw0K.js +47 -0
  4. package/dist/resolve-theme-color-BdojIw0K.js.map +1 -0
  5. package/dist/table-CQCAnDLb.js +388 -0
  6. package/dist/table-CQCAnDLb.js.map +1 -0
  7. package/dist/types/widgets-v2/bar/types.d.ts +8 -3
  8. package/dist/types/widgets-v2/category/types.d.ts +8 -4
  9. package/dist/types/widgets-v2/formula/types.d.ts +10 -7
  10. package/dist/types/widgets-v2/histogram/types.d.ts +7 -3
  11. package/dist/types/widgets-v2/index.d.ts +1 -0
  12. package/dist/types/widgets-v2/pie/types.d.ts +10 -3
  13. package/dist/types/widgets-v2/range/range-ui.d.ts +12 -4
  14. package/dist/types/widgets-v2/range/range.d.ts +13 -8
  15. package/dist/types/widgets-v2/scatterplot/types.d.ts +7 -3
  16. package/dist/types/widgets-v2/table/style.d.ts +0 -4
  17. package/dist/types/widgets-v2/table/table-ui.d.ts +7 -1
  18. package/dist/types/widgets-v2/table/table.d.ts +1 -1
  19. package/dist/types/widgets-v2/table/types.d.ts +13 -2
  20. package/dist/types/widgets-v2/timeseries/types.d.ts +7 -3
  21. package/dist/types/widgets-v2/types.d.ts +25 -0
  22. package/dist/types/widgets-v2/utils/index.d.ts +1 -0
  23. package/dist/types/widgets-v2/utils/resolve-theme-color.d.ts +18 -0
  24. package/dist/types/widgets-v2/utils/resolve-theme-color.test.d.ts +1 -0
  25. package/dist/widgets-v2/bar.js +58 -55
  26. package/dist/widgets-v2/bar.js.map +1 -1
  27. package/dist/widgets-v2/histogram.js +65 -62
  28. package/dist/widgets-v2/histogram.js.map +1 -1
  29. package/dist/widgets-v2/pie.js +100 -94
  30. package/dist/widgets-v2/pie.js.map +1 -1
  31. package/dist/widgets-v2/range.js +1 -1
  32. package/dist/widgets-v2/scatterplot.js +107 -101
  33. package/dist/widgets-v2/scatterplot.js.map +1 -1
  34. package/dist/widgets-v2/table.js +2 -2
  35. package/dist/widgets-v2/timeseries.js +85 -79
  36. package/dist/widgets-v2/timeseries.js.map +1 -1
  37. package/dist/widgets-v2/utils.js +4 -3
  38. package/dist/widgets-v2.js +2 -2
  39. package/dist/widgets-v2.js.map +1 -1
  40. package/package.json +3 -3
  41. package/src/widgets-v2/bar/options.test.ts +19 -2
  42. package/src/widgets-v2/bar/options.ts +9 -3
  43. package/src/widgets-v2/bar/types.ts +8 -3
  44. package/src/widgets-v2/category/types.ts +9 -4
  45. package/src/widgets-v2/formula/types.ts +11 -7
  46. package/src/widgets-v2/histogram/options.test.ts +16 -2
  47. package/src/widgets-v2/histogram/options.ts +5 -4
  48. package/src/widgets-v2/histogram/types.ts +7 -3
  49. package/src/widgets-v2/index.ts +3 -0
  50. package/src/widgets-v2/pie/options.test.ts +20 -4
  51. package/src/widgets-v2/pie/options.ts +21 -17
  52. package/src/widgets-v2/pie/types.ts +10 -3
  53. package/src/widgets-v2/range/range-ui.test.tsx +8 -2
  54. package/src/widgets-v2/range/range-ui.tsx +81 -14
  55. package/src/widgets-v2/range/range.tsx +14 -8
  56. package/src/widgets-v2/scatterplot/options.test.ts +15 -3
  57. package/src/widgets-v2/scatterplot/options.ts +15 -11
  58. package/src/widgets-v2/scatterplot/types.ts +7 -3
  59. package/src/widgets-v2/table/style.ts +2 -5
  60. package/src/widgets-v2/table/table-ui.tsx +40 -7
  61. package/src/widgets-v2/table/table.tsx +6 -1
  62. package/src/widgets-v2/table/types.ts +13 -2
  63. package/src/widgets-v2/timeseries/options.test.ts +17 -2
  64. package/src/widgets-v2/timeseries/options.ts +10 -3
  65. package/src/widgets-v2/timeseries/types.ts +7 -3
  66. package/src/widgets-v2/types.ts +25 -0
  67. package/src/widgets-v2/utils/index.ts +1 -0
  68. package/src/widgets-v2/utils/resolve-theme-color.test.ts +43 -0
  69. package/src/widgets-v2/utils/resolve-theme-color.ts +34 -0
  70. package/dist/merge-options-DCkkHZIf.js +0 -34
  71. package/dist/merge-options-DCkkHZIf.js.map +0 -1
  72. package/dist/range-DsqTjSpg.js +0 -186
  73. package/dist/range-DsqTjSpg.js.map +0 -1
  74. package/dist/table-HIpXuq4G.js +0 -390
  75. package/dist/table-HIpXuq4G.js.map +0 -1
@@ -2,11 +2,19 @@ import { RangeDataItem, RangeItemValue } from './types';
2
2
  export interface RangeUIProps {
3
3
  items: readonly RangeDataItem[];
4
4
  /**
5
- * Fires when the user drags a thumb or commits a new value via the text
6
- * inputs. Per the destination-owned principle, the consumer owns the
7
- * value this widget surfaces changes but does not store them.
5
+ * Fires on every pointer tick while a thumb is being dragged (mirrors
6
+ * MUI `<Slider>`'s `onChange`). Use this to update local UI state
7
+ * not to persist expensive operations like remote queries.
8
8
  */
9
9
  onChange?: (index: number, value: RangeItemValue) => void;
10
+ /**
11
+ * Fires once when the user *releases* a slider thumb after dragging,
12
+ * after an arrow-key adjustment commits, or when the text inputs
13
+ * blur / Enter. Mirrors MUI `<Slider>`'s `onChangeCommitted`. Use
14
+ * this for side-effects you want to throttle to "drag end" — e.g.
15
+ * writing the value to a source filter that triggers refetches.
16
+ */
17
+ onChangeCommitted?: (index: number, value: RangeItemValue) => void;
10
18
  /** Number formatter for the slider tooltip and the text input display. */
11
19
  formatter?: (value: number) => string;
12
20
  }
@@ -16,4 +24,4 @@ export interface RangeUIProps {
16
24
  * UX. Each item is always a two-thumb range; supply `value` to seed the
17
25
  * starting selection, otherwise it defaults to `[min, max]`.
18
26
  */
19
- export declare function RangeUI({ items, onChange, formatter }: RangeUIProps): import("react/jsx-runtime").JSX.Element;
27
+ export declare function RangeUI({ items, onChange, onChangeCommitted, formatter, }: RangeUIProps): import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,24 @@
1
1
  import { RangeItemValue } from './types';
2
2
  export interface RangeProps {
3
3
  /**
4
- * Fires when the user moves a slider thumb or commits a new value via the
5
- * text inputs. Receives the item index in `state.data` and the new
6
- * `[low, high]` tuple. The consumer owns the data state — the widget
7
- * surfaces changes but does not persist them.
4
+ * Fires on every pointer tick while a thumb is being dragged. Use this
5
+ * for cheap UI updates (local state, optimistic display).
8
6
  */
9
7
  onChange?: (index: number, value: RangeItemValue) => void;
8
+ /**
9
+ * Fires once when the user *releases* a slider thumb (or when the text
10
+ * inputs blur / Enter, or when an arrow-key adjustment settles). Use
11
+ * this for expensive side-effects you want throttled to drag end —
12
+ * e.g. writing the value to a source filter that refetches widgets.
13
+ */
14
+ onChangeCommitted?: (index: number, value: RangeItemValue) => void;
10
15
  }
11
16
  /**
12
17
  * Stateful Range bridge — reads `data` (post-pipeline) and `formatter` from
13
18
  * the per-widget store and forwards them to the pure {@link RangeUI}. Per
14
19
  * the destination-owned principle, value changes flow back through
15
- * `onChange` the consumer is expected to update the data prop on
16
- * `<Provider>`. Use `disabled` on individual `RangeDataItem`s to disable
17
- * specific rows.
20
+ * `onChange` (per-tick) and `onChangeCommitted` (drag end) the consumer
21
+ * is expected to update the data prop on `<Provider>`. Use `disabled` on
22
+ * individual `RangeDataItem`s to disable specific rows.
18
23
  */
19
- export declare function Range({ onChange }: RangeProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function Range({ onChange, onChangeCommitted }: RangeProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { Theme } from '@mui/material';
2
2
  import { EChartsOption } from 'echarts';
3
+ import { WidgetSeries } from '../types';
3
4
  /** A single point — `[x, y]` tuple. */
4
5
  export type ScatterplotDatum = readonly [number, number];
5
6
  /** Scatterplot widget data — array of series, each a list of `[x, y]` tuples. */
@@ -16,7 +17,7 @@ export interface ScatterplotOptionsInput {
16
17
  * Combined inputs for the scatterplot option factory creator. Carries
17
18
  * everything the widget needs across BOTH phases — the structural-build
18
19
  * (`theme`, `xFormatter`, `yFormatter`, `optionsOverride`) AND the data
19
- * merge (`seriesNames`, `symbolSize`, `selection`).
20
+ * merge (`series`, `symbolSize`, `selection`).
20
21
  */
21
22
  export interface ScatterplotOptionFactoryInput {
22
23
  theme: Theme;
@@ -30,8 +31,11 @@ export interface ScatterplotOptionFactoryInput {
30
31
  xFormatter?: (value: number) => string;
31
32
  /** Optional formatter for y-axis values (structural baseline). */
32
33
  yFormatter?: (value: number) => string;
33
- /** Series names — drives the legend and `series[i].name`. */
34
- seriesNames?: readonly string[];
34
+ /**
35
+ * Per-series metadata — drives the legend, `series[i].name`, and
36
+ * (when `color` is set) a per-series colour override on the points.
37
+ */
38
+ series?: readonly WidgetSeries[];
35
39
  /** Symbol size in px (default `8`). */
36
40
  symbolSize?: number;
37
41
  /**
@@ -3,10 +3,6 @@ export declare const styles: {
3
3
  width: string;
4
4
  overflowX: "auto";
5
5
  };
6
- /**
7
- * Minimum table width so columns don't collapse to unreadable widths on
8
- * narrow widget shells. Mirrors v1.
9
- */
10
6
  table: {
11
7
  minWidth: number;
12
8
  };
@@ -11,6 +11,12 @@ export interface TableUIProps<T extends TableRow = TableRow> {
11
11
  pageSize: number;
12
12
  pageSizeOptions?: readonly number[];
13
13
  sort?: TableSortState;
14
+ /**
15
+ * Column name to use as the row identity. Drives selection lookup,
16
+ * React keys, and aria labels. Defaults to `'id'` — point it at
17
+ * another column when your rows don't carry an `id` field.
18
+ */
19
+ keyColumn?: string;
14
20
  /** Selected row ids. Destination-owned. */
15
21
  selection?: readonly (string | number)[];
16
22
  selectable?: boolean;
@@ -35,4 +41,4 @@ export interface TableUIProps<T extends TableRow = TableRow> {
35
41
  * Has no widget-store coupling — `<Table>` (the bridge) reads from the store
36
42
  * and feeds this UI with already-projected data.
37
43
  */
38
- export declare function TableUI<T extends TableRow = TableRow>({ columns, rows, total, page, pageSize, pageSizeOptions, sort, selection, selectable, onSortChange, onPageChange, onPageSizeChange, onSelectionChange, onRowClick, onRowHover, labels, emptyContent, size, }: TableUIProps<T>): import("react/jsx-runtime").JSX.Element;
44
+ export declare function TableUI<T extends TableRow = TableRow>({ columns, rows, total, page, pageSize, pageSizeOptions, sort, keyColumn, selection, selectable, onSortChange, onPageChange, onPageSizeChange, onSelectionChange, onRowClick, onRowHover, labels, emptyContent, size, }: TableUIProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { TableUIProps } from './table-ui';
2
2
  import { TableColumn, TableRow, TableSortState } from './types';
3
- export interface TableProps<T extends TableRow = TableRow> extends Pick<TableUIProps<T>, 'pageSizeOptions' | 'selectable' | 'labels' | 'emptyContent' | 'size'> {
3
+ export interface TableProps<T extends TableRow = TableRow> extends Pick<TableUIProps<T>, 'pageSizeOptions' | 'selectable' | 'labels' | 'emptyContent' | 'size' | 'keyColumn'> {
4
4
  /**
5
5
  * Column definitions. Order can be overridden by ChangeColumn via the
6
6
  * `columnOrder` field on the extended widget state.
@@ -1,8 +1,19 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { WidgetState } from '../stores';
3
- /** Single row of tabular data. Must have an `id` for selection / keying. */
3
+ /**
4
+ * Single row of tabular data.
5
+ *
6
+ * The default row-identity column is `id`. Consumers that don't have a
7
+ * literal `id` field can point `<Table>` / `<TableUI>` at a different
8
+ * column via the `keyColumn` prop; the library reads `row[keyColumn]`
9
+ * for selection lookup, React keys, and aria labels.
10
+ */
4
11
  export interface TableRow extends Record<string, unknown> {
5
- id: string | number;
12
+ /**
13
+ * Default row identity. Required when no `keyColumn` is configured.
14
+ * Omit when wiring `keyColumn` to a different column.
15
+ */
16
+ id?: string | number;
6
17
  }
7
18
  export type TableWidgetData = readonly TableRow[];
8
19
  export type TableSortDirection = 'asc' | 'desc';
@@ -1,5 +1,6 @@
1
1
  import { Theme } from '@mui/material';
2
2
  import { EChartsOption } from 'echarts';
3
+ import { WidgetSeries } from '../types';
3
4
  /**
4
5
  * A single point on a time series. `name` is the time coordinate — accepts a
5
6
  * Date object, a number (ms-since-epoch), or an ISO-8601 string. ECharts'
@@ -22,7 +23,7 @@ export interface TimeseriesOptionsInput {
22
23
  * Combined inputs for the timeseries option factory creator. Carries
23
24
  * everything the widget needs across BOTH phases — the structural-build
24
25
  * (`theme`, `formatter`, `labelFormatter`, `optionsOverride`) AND the
25
- * data merge (`seriesNames`, `smooth`, `area`, `selection`).
26
+ * data merge (`series`, `smooth`, `area`, `selection`).
26
27
  */
27
28
  export interface TimeseriesOptionFactoryInput {
28
29
  theme: Theme;
@@ -34,8 +35,11 @@ export interface TimeseriesOptionFactoryInput {
34
35
  * RelativeData's reactive formatter swaps.
35
36
  */
36
37
  labelFormatter?: (value: Date) => string;
37
- /** Series names — drives the legend and `series[i].name`. */
38
- seriesNames?: readonly string[];
38
+ /**
39
+ * Per-series metadata — drives the legend, `series[i].name`, and
40
+ * (when `color` is set) per-series line + marker colour overrides.
41
+ */
42
+ series?: readonly WidgetSeries[];
39
43
  /** Smooth lines (default `true`). */
40
44
  smooth?: boolean;
41
45
  /** Filled area below each line (default `false`). */
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Canonical cross-widget series metadata.
3
+ *
4
+ * Every widget that can carry multiple series (Bar, Pie, Histogram,
5
+ * Scatterplot, Timeseries, Category, Formula, Spread) accepts a
6
+ * `series: readonly WidgetSeries[]` prop. The `name` drives legends,
7
+ * tooltips, and category-row avatars; the optional `color` overrides
8
+ * the default palette assignment.
9
+ *
10
+ * For backward compatibility, the widget-specific names
11
+ * (`FormulaSeries`, `CategorySeriesConfig`) are kept as type aliases of
12
+ * `WidgetSeries` — see `formula/types.ts` and `category/types.ts`.
13
+ *
14
+ * Colours accept MUI theme paths (e.g. `'primary.main'`) as well as raw
15
+ * CSS strings (`'#ff0000'`, `'rgb(…)'`). The echart-based widgets
16
+ * resolve them through `resolveThemeColor` (see
17
+ * `widgets-v2/utils/resolve-theme-color.ts`); Category and Formula/Spread
18
+ * resolve them implicitly via MUI's `sx` prop.
19
+ */
20
+ export interface WidgetSeries {
21
+ /** Display name — drives legend, tooltip, and avatar glyphs. */
22
+ name: string;
23
+ /** Optional colour override. MUI theme path or raw CSS string. */
24
+ color?: string;
25
+ }
@@ -1,2 +1,3 @@
1
1
  export { mergeOptions } from './merge-options';
2
2
  export { positionDataZoomForLegend } from './data-zoom-layout';
3
+ export { resolveThemeColor } from './resolve-theme-color';
@@ -0,0 +1,18 @@
1
+ import { Theme } from '@mui/material';
2
+ /**
3
+ * Resolve a colour string against the MUI theme palette.
4
+ *
5
+ * - `'primary.main'`, `'secondary.dark'`, `'success.contrastText'`, … →
6
+ * walks `theme.palette` along the dot-separated path and returns the
7
+ * resolved string when traversal succeeds.
8
+ * - `'#ff0000'`, `'rgb(255, 0, 0)'`, `'red'` → returned as-is (assumed
9
+ * raw CSS; ECharts consumes them directly).
10
+ * - `undefined` → `undefined` (callers fall back to ECharts' palette).
11
+ *
12
+ * Used by the echart option factories (Bar, Pie, Histogram, Scatterplot,
13
+ * Timeseries) so per-series colours specified as theme paths in the
14
+ * unified `WidgetSeries` shape paint correctly. Category, Formula, and
15
+ * Spread render colours through MUI's `sx` resolver, which already
16
+ * handles theme paths — they don't need this helper.
17
+ */
18
+ export declare function resolveThemeColor(theme: Theme, raw: string | undefined): string | undefined;
@@ -1,8 +1,8 @@
1
1
  import * as $ from "echarts";
2
- import { n as g, d as z, g as E, c as G, f as H } from "../option-builders-F-c9ELi1.js";
2
+ import { n as y, d as z, g as E, c as G, f as H } from "../option-builders-F-c9ELi1.js";
3
3
  import { jsx as p, jsxs as M } from "react/jsx-runtime";
4
4
  import { c as R } from "react/compiler-runtime";
5
- import { Box as d, Skeleton as v } from "@mui/material";
5
+ import { Box as g, Skeleton as A } from "@mui/material";
6
6
  import "../widget-store-Bw5zRUGg.js";
7
7
  import "zustand/shallow";
8
8
  import "@mui/icons-material";
@@ -21,12 +21,12 @@ import "zustand/vanilla";
21
21
  import "zustand/middleware";
22
22
  import "zustand/react/shallow";
23
23
  import { Z as j } from "../transforms-Cdx4fkU5.js";
24
- import { m as W } from "../merge-options-DCkkHZIf.js";
25
- import { p as Y } from "../data-zoom-layout-BH0LPwSy.js";
24
+ import { m as W, r as Y } from "../resolve-theme-color-BdojIw0K.js";
25
+ import { p as q } from "../data-zoom-layout-BH0LPwSy.js";
26
26
  import "@mui/icons-material/FileDownload";
27
- import { a as q } from "../exports-Cx-f6m6U.js";
28
- import { b as U, C as J } from "../png-item-CS4z1iSH.js";
29
- function K({
27
+ import { a as U } from "../exports-Cx-f6m6U.js";
28
+ import { b as J, C as K } from "../png-item-CS4z1iSH.js";
29
+ function Q({
30
30
  theme: e,
31
31
  formatter: r,
32
32
  labelFormatter: t
@@ -90,8 +90,8 @@ function K({
90
90
  },
91
91
  yAxis: {
92
92
  type: "value",
93
- min: (o) => (l = o.min < 0 ? g(o.min) : 0, l),
94
- max: (o) => (a = o.max <= 0 ? 1 : g(o.max), a),
93
+ min: (o) => (l = o.min < 0 ? y(o.min) : 0, l),
94
+ max: (o) => (a = o.max <= 0 ? 1 : y(o.max), a),
95
95
  axisLine: {
96
96
  show: !1
97
97
  },
@@ -118,38 +118,38 @@ function K({
118
118
  }
119
119
  };
120
120
  }
121
- function Te(e) {
121
+ function je(e) {
122
122
  const {
123
123
  theme: r,
124
124
  formatter: t,
125
125
  labelFormatter: l,
126
126
  optionsOverride: a
127
- } = e, o = e.seriesNames, s = e.selection, m = s && s.length > 0 ? new Set(s) : null;
128
- return (n, A, w) => {
127
+ } = e, o = e.series, s = e.selection, m = s && s.length > 0 ? new Set(s) : null;
128
+ return (n, w, I) => {
129
129
  if (n == null) {
130
- const i = K({
130
+ const i = Q({
131
131
  theme: r,
132
132
  formatter: t,
133
133
  labelFormatter: l
134
134
  });
135
135
  return a ? W(i, a) : i;
136
136
  }
137
- const f = Array.isArray(A) ? A : [];
137
+ const f = Array.isArray(w) ? w : [];
138
138
  if (f.length === 0)
139
139
  return {
140
140
  ...n,
141
141
  dataset: [],
142
142
  series: []
143
143
  };
144
- const y = f.length > 1, O = typeof n.legend == "object" && !Array.isArray(n.legend) ? n.legend : {}, b = typeof n.grid == "object" && !Array.isArray(n.grid) ? n.grid : {}, _ = typeof n.tooltip == "object" && !Array.isArray(n.tooltip) ? n.tooltip : {}, I = typeof n.yAxis == "object" && !Array.isArray(n.yAxis) ? n.yAxis : {}, L = Array.isArray(n.series) ? n.series : [], N = L[0] ?? {}, x = w?.formatter, V = w?.labelFormatter, {
145
- niceMinVal: C,
146
- niceMaxVal: k
147
- } = Q(f), h = Y(n.dataZoom, y), D = typeof b.bottom == "number" ? b.bottom : 24, B = y ? 56 : D, P = h ? B + j.sliderHeight + j.sliderGap : B, Z = {
144
+ const b = f.length > 1, O = typeof n.legend == "object" && !Array.isArray(n.legend) ? n.legend : {}, x = typeof n.grid == "object" && !Array.isArray(n.grid) ? n.grid : {}, _ = typeof n.tooltip == "object" && !Array.isArray(n.tooltip) ? n.tooltip : {}, L = typeof n.yAxis == "object" && !Array.isArray(n.yAxis) ? n.yAxis : {}, C = Array.isArray(n.series) ? n.series : [], V = C[0] ?? {}, h = I?.formatter, D = I?.labelFormatter, {
145
+ niceMinVal: k,
146
+ niceMaxVal: T
147
+ } = X(f), v = q(n.dataZoom, b), N = typeof x.bottom == "number" ? x.bottom : 24, B = b ? 56 : N, P = v ? B + j.sliderHeight + j.sliderGap : B, Z = {
148
148
  color: (i) => {
149
149
  const c = i.color;
150
150
  if (!m) return c;
151
- const T = i.value?.name ?? i.name;
152
- return T != null && m.has(T) ? c : $.color.modifyAlpha(c, 0.15);
151
+ const u = i.value?.name ?? i.name;
152
+ return u != null && m.has(u) ? c : $.color.modifyAlpha(c, 0.15);
153
153
  }
154
154
  };
155
155
  return {
@@ -158,12 +158,12 @@ function Te(e) {
158
158
  source: i
159
159
  })),
160
160
  series: f.map((i, c) => {
161
- const S = L[c] ?? N;
161
+ const S = C[c] ?? V, u = Y(r, o?.[c]?.color);
162
162
  return {
163
163
  ...typeof S == "object" ? S : {},
164
164
  type: "bar",
165
165
  datasetIndex: c,
166
- name: o?.[c] ?? `Series ${c + 1}`,
166
+ name: o?.[c]?.name ?? `Series ${c + 1}`,
167
167
  encode: {
168
168
  x: "name",
169
169
  y: "value"
@@ -172,32 +172,35 @@ function Te(e) {
172
172
  emphasis: {
173
173
  focus: "series"
174
174
  },
175
- itemStyle: Z
175
+ itemStyle: Z,
176
+ ...u ? {
177
+ color: u
178
+ } : {}
176
179
  };
177
180
  }),
178
181
  legend: {
179
182
  ...O,
180
- show: y
183
+ show: b
181
184
  },
182
185
  grid: {
183
- ...b,
186
+ ...x,
184
187
  bottom: P
185
188
  },
186
- ...h ? {
187
- dataZoom: h
189
+ ...v ? {
190
+ dataZoom: v
188
191
  } : {},
189
192
  yAxis: {
190
- ...I,
191
- min: C,
192
- max: k,
193
+ ...L,
194
+ min: k,
195
+ max: T,
193
196
  axisLabel: {
194
- ...I.axisLabel ?? {},
195
- formatter: (i) => i !== k && i !== C || i === 0 ? "" : x ? x(i) : String(i)
197
+ ...L.axisLabel ?? {},
198
+ formatter: (i) => i !== T && i !== k || i === 0 ? "" : h ? h(i) : String(i)
196
199
  }
197
200
  },
198
201
  tooltip: {
199
202
  ..._,
200
- formatter: F(x, V)
203
+ formatter: F(h, D)
201
204
  }
202
205
  };
203
206
  };
@@ -213,18 +216,18 @@ function F(e, r) {
213
216
  };
214
217
  });
215
218
  }
216
- function Q(e) {
219
+ function X(e) {
217
220
  let r = 0, t = -1 / 0;
218
221
  for (const o of e)
219
222
  for (const s of o)
220
223
  typeof s?.value != "number" || !Number.isFinite(s.value) || (s.value < r && (r = s.value), s.value > t && (t = s.value));
221
- const l = r < 0 ? g(r) : 0, a = t <= 0 ? 1 : g(t);
224
+ const l = r < 0 ? y(r) : 0, a = t <= 0 ? 1 : y(t);
222
225
  return {
223
226
  niceMinVal: l,
224
227
  niceMaxVal: a
225
228
  };
226
229
  }
227
- const u = {
230
+ const d = {
228
231
  container: {
229
232
  display: "flex",
230
233
  alignItems: "center",
@@ -272,29 +275,29 @@ const u = {
272
275
  spacing: e
273
276
  }) => e(1.5)
274
277
  }
275
- }, X = ["20%", "40%", "60%", "20%", "80%"];
276
- function je() {
278
+ }, ee = ["20%", "40%", "60%", "20%", "80%"];
279
+ function Me() {
277
280
  const e = R(2);
278
281
  let r;
279
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ p(d, { sx: u.grid, children: X.map(te) }), e[0] = r) : r = e[0];
282
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ p(g, { sx: d.grid, children: ee.map(re) }), e[0] = r) : r = e[0];
280
283
  let t;
281
- return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ M(d, { sx: u.container, children: [
284
+ return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ M(g, { sx: d.container, children: [
282
285
  r,
283
- /* @__PURE__ */ p(d, { sx: u.legend, children: [0, 1].map(ee) })
286
+ /* @__PURE__ */ p(g, { sx: d.legend, children: [0, 1].map(te) })
284
287
  ] }), e[1] = t) : t = e[1], t;
285
288
  }
286
- function ee(e) {
287
- return /* @__PURE__ */ M(d, { sx: u.legendItem, children: [
288
- /* @__PURE__ */ p(v, { variant: "circular", width: 8, height: 8 }),
289
- /* @__PURE__ */ p(v, { width: 48, height: 8 })
289
+ function te(e) {
290
+ return /* @__PURE__ */ M(g, { sx: d.legendItem, children: [
291
+ /* @__PURE__ */ p(A, { variant: "circular", width: 8, height: 8 }),
292
+ /* @__PURE__ */ p(A, { width: 48, height: 8 })
290
293
  ] }, `legend-${e}`);
291
294
  }
292
- function te(e, r) {
293
- return /* @__PURE__ */ p(v, { sx: u.bar, variant: "rectangular", height: e }, `bar-${r}`);
295
+ function re(e, r) {
296
+ return /* @__PURE__ */ p(A, { sx: d.bar, variant: "rectangular", height: e }, `bar-${r}`);
294
297
  }
295
- function Me(e) {
298
+ function Fe(e) {
296
299
  const r = [];
297
- return e.getCaptureEl && r.push(U({
300
+ return e.getCaptureEl && r.push(J({
298
301
  filename: e.filename,
299
302
  getCaptureEl: e.getCaptureEl,
300
303
  pixelRatio: e.pngPixelRatio,
@@ -302,14 +305,14 @@ function Me(e) {
302
305
  })), r.push({
303
306
  id: "csv",
304
307
  label: "CSV",
305
- icon: /* @__PURE__ */ p(J, { fontSize: "small" }),
308
+ icon: /* @__PURE__ */ p(K, { fontSize: "small" }),
306
309
  resolve: () => {
307
310
  const t = e.getData(), l = [];
308
311
  for (const [o, s] of t.entries()) {
309
312
  o > 0 && l.push([]), l.push(["name", "value"]);
310
313
  for (const m of s) l.push([m.name, m.value]);
311
314
  }
312
- const a = q(l);
315
+ const a = U(l);
313
316
  return Promise.resolve({
314
317
  url: a.url,
315
318
  filename: `${e.filename}.csv`,
@@ -319,9 +322,9 @@ function Me(e) {
319
322
  }), r;
320
323
  }
321
324
  export {
322
- je as BarSkeleton,
323
- K as barOptions,
324
- Me as createBarDownloadConfig,
325
- Te as createBarOptionFactory
325
+ Me as BarSkeleton,
326
+ Q as barOptions,
327
+ Fe as createBarDownloadConfig,
328
+ je as createBarOptionFactory
326
329
  };
327
330
  //# sourceMappingURL=bar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bar.js","sources":["../../src/widgets-v2/bar/options.ts","../../src/widgets-v2/bar/skeleton.tsx","../../src/widgets-v2/bar/download.tsx"],"sourcesContent":["import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions } from '../utils'\nimport { positionDataZoomForLegend } from '../utils/data-zoom-layout'\nimport type {\n BarEChartsOption,\n BarOptionFactoryInput,\n BarOptionsInput,\n BarWidgetData,\n} from './types'\n\n/**\n * Builds the **structural** ECharts option for a bar widget — axes, grid,\n * tooltip styling, themed legend. Intentionally data-agnostic: no series,\n * no dataset, no `legend.show` (those depend on data and are added by the\n * option factory's merge phase). This separation is what lets data-side\n * pipeline transforms (Searcher, RelativeData) drive the rendered chart —\n * the merge happens at render time inside the Echart bridge.\n *\n * Styling matches the v1 `barConfig` look-and-feel: minimal axes (only\n * min/max y-labels rendered inside the plot via `niceNum`), themed tooltip,\n * scroll legend, and CARTO color palette. The y-axis min/max + label\n * formatter and the tooltip formatter are wired here for the no-data case;\n * {@link createBarOptionFactory} re-derives them at fusion time so reactive\n * formatter changes (RelativeData) and stack templates (StackToggle) flow\n * through to the chart.\n */\nexport function barOptions({\n theme,\n formatter,\n labelFormatter,\n}: BarOptionsInput): BarEChartsOption {\n // Closure shared between yAxis min/max callbacks and the label formatter,\n // so only the rounded extents are labelled (matches v1).\n let niceMin = 0\n let niceMax = 1\n\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps this when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n trigger: 'axis',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n axisPointer: { type: 'line' },\n position: createTooltipPositioner(theme),\n formatter: buildBarTooltipFormatter(formatter, labelFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false, labelFormatter }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'category',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],\n margin: 0,\n hideOverlap: true,\n ...(labelFormatter && {\n formatter: (v: string | number) => String(labelFormatter(v)),\n }),\n },\n },\n yAxis: {\n type: 'value',\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n axisLabel: {\n fontSize: theme.typography.overlineDelicate?.fontSize,\n fontFamily: theme.typography.overlineDelicate?.fontFamily,\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom',\n inside: true,\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n },\n } as BarEChartsOption\n}\n\n/**\n * Returns the bar widget's {@link OptionFactory} — a single closure that\n * handles BOTH option-construction phases:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link barOptions}, optionally merging the\n * consumer-supplied `optionsOverride` on top. Called once by Provider\n * to seed `rawOptions` in the store; configTransforms (StackToggle /\n * ZoomToggle / BrushToggle) then mutate it via the pipeline middleware.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`BarWidgetData`) into the option via the dataset API: one dataset\n * per series, each series referencing its dataset by index, encoded\n * by `name` (x) and `value` (y). Spreads any series-template fields\n * already on the incoming option (e.g. `{ stack: 'total' }` from\n * `addStack`) into every emitted series so configTransforms compose\n * end-to-end. Reactive `ctx.formatter` / `ctx.labelFormatter` drive\n * the y-axis min/max-only label and the tooltip formatter at fusion\n * time so RelativeData's percent formatter flows through without a\n * structural rebuild.\n *\n * Stable identity when the inputs don't change (consumers should wrap the\n * call in `useMemo` keyed on the same inputs).\n */\nexport function createBarOptionFactory(\n options: BarOptionFactoryInput,\n): OptionFactory {\n const { theme, formatter, labelFormatter, optionsOverride } = options\n const seriesNames = options.seriesNames\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0\n ? new Set<string | number>(selection)\n : null\n return (option, data, ctx) => {\n // Structural phase: Provider seeds rawOptions with this branch. No data\n // is read; we just emit the theme-aware base (optionally with override).\n if (option == null) {\n const structural = barOptions({ theme, formatter, labelFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data) ? (data as BarWidgetData) : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const broadcastTemplate = seriesTemplates[0] ?? {}\n\n // Reactive (live store) formatters from ctx — distinct from the\n // closure-time `formatter` / `labelFormatter` captured for the\n // structural-build branch above. RelativeData can install a percent\n // formatter on the store after the factory was constructed; the merge\n // phase reads `ctx` to pick that up.\n const liveFormatter = ctx?.formatter\n const liveLabelFormatter = ctx?.labelFormatter\n\n const { niceMinVal, niceMaxVal } = computeNiceBounds(seriesArr)\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`, push the\n // slider above the legend (if any) and reserve room in the grid below.\n const dataZoomLayout = positionDataZoomForLegend(option.dataZoom, hasLegend)\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = dataZoomLayout\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n\n // When a selection is active, dim non-selected bars by routing the\n // resolved palette color through `modifyAlpha`. Per-row `itemStyle` on\n // dataset object-rows is silently ignored when `series.encode` is in\n // play — the callback approach is the standard ECharts pattern for\n // per-data styling derived from a dataset.\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and bars would stay dimmed forever after an external clear. Always\n // emitting lets normal merge swap the callback in place, no\n // `replaceMerge` and no entry-animation flash on selection on/off.\n const dimItemStyle = {\n color: (params: CallbackDataParams) => {\n const base = params.color as string\n if (!selectionSet) return base\n const datum = params.value as { name?: string | number } | undefined\n const name = datum?.name ?? params.name\n return name != null && selectionSet.has(name)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n },\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n series: seriesArr.map((_, i) => {\n const template =\n (seriesTemplates[i] as object | undefined) ??\n (broadcastTemplate as object)\n return {\n ...(typeof template === 'object' ? template : {}),\n type: 'bar' as const,\n datasetIndex: i,\n name: seriesNames?.[i] ?? `Series ${i + 1}`,\n encode: { x: 'name', y: 'value' },\n barMaxWidth: 100,\n emphasis: { focus: 'series' },\n itemStyle: dimItemStyle,\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: {\n ...baseGrid,\n bottom: gridBottom,\n },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout } : {}),\n yAxis: {\n ...baseYAxis,\n min: niceMinVal,\n max: niceMaxVal,\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n formatter: (value: number) => {\n if (value !== niceMaxVal && value !== niceMinVal) return ''\n if (value === 0) return ''\n return liveFormatter ? liveFormatter(value) : String(value)\n },\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n formatter: buildBarTooltipFormatter(liveFormatter, liveLabelFormatter),\n },\n } as EChartsOption\n }\n}\n\nfunction buildBarTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: string | number) => string | number) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const row = item.value as { name?: string | number; value?: number }\n const raw = row?.value\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : (item.name ?? '')\n return { name: String(name), seriesName, marker, value: formattedValue }\n })\n}\n\nfunction computeNiceBounds(seriesArr: BarWidgetData): {\n niceMinVal: number\n niceMaxVal: number\n} {\n let min = 0\n let max = -Infinity\n for (const series of seriesArr) {\n for (const d of series) {\n if (typeof d?.value !== 'number' || !Number.isFinite(d.value)) continue\n if (d.value < min) min = d.value\n if (d.value > max) max = d.value\n }\n }\n const niceMinVal = min < 0 ? niceNum(min) : 0\n const niceMaxVal = max <= 0 ? 1 : niceNum(max)\n return { niceMinVal, niceMaxVal }\n}\n","import { Box, Skeleton, type SxProps, type Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n grid: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: '1 1 auto',\n alignItems: 'flex-end',\n width: '100%',\n },\n bar: {\n flex: 1,\n maxWidth: ({ spacing }) => spacing(12),\n '& + &': {\n marginLeft: ({ spacing }) => spacing(1),\n },\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\nconst BAR_HEIGHTS = ['20%', '40%', '60%', '20%', '80%'] as const\n\n/**\n * Loading state for the Bar widget. Mirrors a bar chart's silhouette — five\n * vertical bars at staggered heights anchored to the bottom, plus a legend\n * stub — so the skeleton reads as \"a bar chart\" rather than a generic list.\n */\nexport function BarSkeleton() {\n return (\n <Box sx={styles.container}>\n <Box sx={styles.grid}>\n {BAR_HEIGHTS.map((height, i) => (\n <Skeleton\n key={`bar-${i}`}\n sx={styles.bar}\n variant='rectangular'\n height={height}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n CSVIcon,\n buildPngDownloadItem,\n downloadToCSV,\n type DownloadItem,\n} from '../actions/download'\nimport type { BarWidgetData } from './types'\n\nexport interface BarDownloadConfigArgs {\n filename: string\n getData: () => BarWidgetData\n /**\n * Optional getter for the widget's capture element (registered by\n * `Widget.State` on its success path). When provided, a PNG item is\n * prepended to the returned list. Wire it to\n * `() => getCaptureEl(id)`.\n */\n getCaptureEl?: () => HTMLElement | null\n /** PNG `pixelRatio` (default 2). */\n pngPixelRatio?: number\n /** PNG `backgroundColor` (default transparent). */\n pngBackgroundColor?: string | null\n}\n\n/**\n * Builds download items for the Bar widget. Always includes a CSV item\n * with one `name,value` block per series, separated by an empty row when\n * there are multiple. When `getCaptureEl` is supplied, also prepends a PNG\n * item that rasterises the captured element via `html2canvas`.\n */\nexport function createBarDownloadConfig(\n args: BarDownloadConfigArgs,\n): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push({\n id: 'csv',\n label: 'CSV',\n icon: <CSVIcon fontSize='small' />,\n resolve: () => {\n const data = args.getData()\n const rows: unknown[][] = []\n for (const [i, series] of data.entries()) {\n if (i > 0) rows.push([])\n rows.push(['name', 'value'])\n for (const d of series) rows.push([d.name, d.value])\n }\n const handle = downloadToCSV(rows)\n return Promise.resolve({\n url: handle.url,\n filename: `${args.filename}.csv`,\n revoke: handle.revoke,\n })\n },\n })\n return items\n}\n"],"names":["barOptions","theme","formatter","labelFormatter","niceMin","niceMax","grid","left","parseInt","spacing","top","right","buildGridConfig","containLabel","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","textStyle","color","common","white","fontSize","fontFamily","typography","caption","axisPointer","type","position","createTooltipPositioner","buildBarTooltipFormatter","legend","buildLegendConfig","hasLegend","lineStyle","secondary","main","Object","values","qualitative","bold","xAxis","axisLine","show","axisTick","axisLabel","margin","hideOverlap","v","String","yAxis","min","extent","niceNum","max","splitLine","black","divider","overlineDelicate","showMaxLabel","showMinLabel","verticalAlign","inside","value","createBarOptionFactory","options","optionsOverride","seriesNames","selection","selectionSet","length","Set","option","data","ctx","structural","mergeOptions","seriesArr","Array","isArray","dataset","series","baseLegend","baseGrid","baseTooltip","baseYAxis","seriesTemplates","broadcastTemplate","liveFormatter","liveLabelFormatter","niceMinVal","niceMaxVal","computeNiceBounds","dataZoomLayout","positionDataZoomForLegend","dataZoom","fallbackBottom","bottom","baseBottom","gridBottom","ZOOM_LAYOUT","sliderHeight","sliderGap","dimItemStyle","params","base","name","has","echarts","modifyAlpha","map","s","source","_","i","template","datasetIndex","encode","x","y","barMaxWidth","emphasis","focus","itemStyle","createTooltipFormatter","item","raw","formattedValue","marker","seriesName","d","Number","isFinite","styles","container","display","alignItems","justifyContent","flexDirection","gap","height","flex","width","bar","maxWidth","marginLeft","legendItem","BAR_HEIGHTS","BarSkeleton","$","_c","t0","Symbol","for","jsx","Box","_temp","t1","_temp2","i_0","jsxs","Skeleton","createBarDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","pngBackgroundColor","id","label","icon","CSVIcon","resolve","getData","rows","entries","handle","downloadToCSV","Promise","url","revoke"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCO,SAASA,EAAW;AAAA,EACzBC,OAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,gBAAAA;AACe,GAAqB;AAGpC,MAAIC,IAAU,GACVC,IAAU;AAEd,SAAO;AAAA,IACLC,MAAM;AAAA,MACJC,MAAMC,SAASP,EAAMQ,QAAQ,CAAC,CAAC;AAAA,MAC/BC,KAAKF,SAASP,EAAMQ,QAAQ,CAAC,CAAC;AAAA,MAC9BE,OAAOH,SAASP,EAAMQ,QAAQ,CAAC,CAAC;AAAA;AAAA,MAEhC,GAAGG,EAAgB,IAAOX,CAAK;AAAA,MAC/BY,cAAc;AAAA,IAAA;AAAA,IAEhBC,SAAS;AAAA,MACPC,SAAS;AAAA,MACTC,iBAAiBf,EAAMgB,QAAQC,KAAK,GAAG;AAAA,MACvCC,aAAa;AAAA,MACbC,SAAS,CAACZ,SAASP,EAAMQ,QAAQ,CAAC,CAAC,GAAGD,SAASP,EAAMQ,QAAQ,CAAC,CAAC,CAAC;AAAA,MAChEY,WAAW;AAAA,QACTC,OAAOrB,EAAMgB,QAAQM,OAAOC;AAAAA,QAC5BC,UAAU;AAAA,QACVC,YAAYzB,EAAM0B,WAAWC,QAAQF;AAAAA,MAAAA;AAAAA,MAEvCG,aAAa;AAAA,QAAEC,MAAM;AAAA,MAAA;AAAA,MACrBC,UAAUC,EAAwB/B,CAAK;AAAA,MACvCC,WAAW+B,EAAyB/B,GAAWC,CAAc;AAAA,IAAA;AAAA;AAAA;AAAA,IAI/D+B,QAAQ;AAAA,MACN,GAAGC,EAAkB;AAAA,QAAEC,WAAW;AAAA,QAAOjC,gBAAAA;AAAAA,MAAAA,CAAgB;AAAA,IAAA;AAAA,IAE3D0B,aAAa;AAAA,MAAEQ,WAAW;AA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AU,GAAGL,EAAKK,QAAQ;AAAA,QAC1BgB,QAAQJ,EAAOI;AAAAA,MAAAA,CAChB;AAAA,IACH;AAAA,EAAA,CACD,GACMpB;AACT;"}
1
+ {"version":3,"file":"bar.js","sources":["../../src/widgets-v2/bar/options.ts","../../src/widgets-v2/bar/skeleton.tsx","../../src/widgets-v2/bar/download.tsx"],"sourcesContent":["import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport { positionDataZoomForLegend } from '../utils/data-zoom-layout'\nimport type {\n BarEChartsOption,\n BarOptionFactoryInput,\n BarOptionsInput,\n BarWidgetData,\n} from './types'\n\n/**\n * Builds the **structural** ECharts option for a bar widget — axes, grid,\n * tooltip styling, themed legend. Intentionally data-agnostic: no series,\n * no dataset, no `legend.show` (those depend on data and are added by the\n * option factory's merge phase). This separation is what lets data-side\n * pipeline transforms (Searcher, RelativeData) drive the rendered chart —\n * the merge happens at render time inside the Echart bridge.\n *\n * Styling matches the v1 `barConfig` look-and-feel: minimal axes (only\n * min/max y-labels rendered inside the plot via `niceNum`), themed tooltip,\n * scroll legend, and CARTO color palette. The y-axis min/max + label\n * formatter and the tooltip formatter are wired here for the no-data case;\n * {@link createBarOptionFactory} re-derives them at fusion time so reactive\n * formatter changes (RelativeData) and stack templates (StackToggle) flow\n * through to the chart.\n */\nexport function barOptions({\n theme,\n formatter,\n labelFormatter,\n}: BarOptionsInput): BarEChartsOption {\n // Closure shared between yAxis min/max callbacks and the label formatter,\n // so only the rounded extents are labelled (matches v1).\n let niceMin = 0\n let niceMax = 1\n\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps this when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n trigger: 'axis',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n axisPointer: { type: 'line' },\n position: createTooltipPositioner(theme),\n formatter: buildBarTooltipFormatter(formatter, labelFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false, labelFormatter }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'category',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],\n margin: 0,\n hideOverlap: true,\n ...(labelFormatter && {\n formatter: (v: string | number) => String(labelFormatter(v)),\n }),\n },\n },\n yAxis: {\n type: 'value',\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n axisLabel: {\n fontSize: theme.typography.overlineDelicate?.fontSize,\n fontFamily: theme.typography.overlineDelicate?.fontFamily,\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom',\n inside: true,\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n },\n } as BarEChartsOption\n}\n\n/**\n * Returns the bar widget's {@link OptionFactory} — a single closure that\n * handles BOTH option-construction phases:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link barOptions}, optionally merging the\n * consumer-supplied `optionsOverride` on top. Called once by Provider\n * to seed `rawOptions` in the store; configTransforms (StackToggle /\n * ZoomToggle / BrushToggle) then mutate it via the pipeline middleware.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`BarWidgetData`) into the option via the dataset API: one dataset\n * per series, each series referencing its dataset by index, encoded\n * by `name` (x) and `value` (y). Spreads any series-template fields\n * already on the incoming option (e.g. `{ stack: 'total' }` from\n * `addStack`) into every emitted series so configTransforms compose\n * end-to-end. Reactive `ctx.formatter` / `ctx.labelFormatter` drive\n * the y-axis min/max-only label and the tooltip formatter at fusion\n * time so RelativeData's percent formatter flows through without a\n * structural rebuild.\n *\n * Stable identity when the inputs don't change (consumers should wrap the\n * call in `useMemo` keyed on the same inputs).\n */\nexport function createBarOptionFactory(\n options: BarOptionFactoryInput,\n): OptionFactory {\n const { theme, formatter, labelFormatter, optionsOverride } = options\n const series = options.series\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0\n ? new Set<string | number>(selection)\n : null\n return (option, data, ctx) => {\n // Structural phase: Provider seeds rawOptions with this branch. No data\n // is read; we just emit the theme-aware base (optionally with override).\n if (option == null) {\n const structural = barOptions({ theme, formatter, labelFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data) ? (data as BarWidgetData) : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const broadcastTemplate = seriesTemplates[0] ?? {}\n\n // Reactive (live store) formatters from ctx — distinct from the\n // closure-time `formatter` / `labelFormatter` captured for the\n // structural-build branch above. RelativeData can install a percent\n // formatter on the store after the factory was constructed; the merge\n // phase reads `ctx` to pick that up.\n const liveFormatter = ctx?.formatter\n const liveLabelFormatter = ctx?.labelFormatter\n\n const { niceMinVal, niceMaxVal } = computeNiceBounds(seriesArr)\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`, push the\n // slider above the legend (if any) and reserve room in the grid below.\n const dataZoomLayout = positionDataZoomForLegend(option.dataZoom, hasLegend)\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = dataZoomLayout\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n\n // When a selection is active, dim non-selected bars by routing the\n // resolved palette color through `modifyAlpha`. Per-row `itemStyle` on\n // dataset object-rows is silently ignored when `series.encode` is in\n // play — the callback approach is the standard ECharts pattern for\n // per-data styling derived from a dataset.\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and bars would stay dimmed forever after an external clear. Always\n // emitting lets normal merge swap the callback in place, no\n // `replaceMerge` and no entry-animation flash on selection on/off.\n const dimItemStyle = {\n color: (params: CallbackDataParams) => {\n const base = params.color as string\n if (!selectionSet) return base\n const datum = params.value as { name?: string | number } | undefined\n const name = datum?.name ?? params.name\n return name != null && selectionSet.has(name)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n },\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n series: seriesArr.map((_, i) => {\n const template =\n (seriesTemplates[i] as object | undefined) ??\n (broadcastTemplate as object)\n // Per-series `color` override: ECharts sets `params.color` from\n // `series[i].color` when resolving styles, so the dim callback\n // above keeps working — it just dims the user's colour rather\n // than the palette default.\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n ...(typeof template === 'object' ? template : {}),\n type: 'bar' as const,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n encode: { x: 'name', y: 'value' },\n barMaxWidth: 100,\n emphasis: { focus: 'series' },\n itemStyle: dimItemStyle,\n ...(overrideColor ? { color: overrideColor } : {}),\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: {\n ...baseGrid,\n bottom: gridBottom,\n },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout } : {}),\n yAxis: {\n ...baseYAxis,\n min: niceMinVal,\n max: niceMaxVal,\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n formatter: (value: number) => {\n if (value !== niceMaxVal && value !== niceMinVal) return ''\n if (value === 0) return ''\n return liveFormatter ? liveFormatter(value) : String(value)\n },\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n formatter: buildBarTooltipFormatter(liveFormatter, liveLabelFormatter),\n },\n } as EChartsOption\n }\n}\n\nfunction buildBarTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: string | number) => string | number) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const row = item.value as { name?: string | number; value?: number }\n const raw = row?.value\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : (item.name ?? '')\n return { name: String(name), seriesName, marker, value: formattedValue }\n })\n}\n\nfunction computeNiceBounds(seriesArr: BarWidgetData): {\n niceMinVal: number\n niceMaxVal: number\n} {\n let min = 0\n let max = -Infinity\n for (const series of seriesArr) {\n for (const d of series) {\n if (typeof d?.value !== 'number' || !Number.isFinite(d.value)) continue\n if (d.value < min) min = d.value\n if (d.value > max) max = d.value\n }\n }\n const niceMinVal = min < 0 ? niceNum(min) : 0\n const niceMaxVal = max <= 0 ? 1 : niceNum(max)\n return { niceMinVal, niceMaxVal }\n}\n","import { Box, Skeleton, type SxProps, type Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n grid: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: '1 1 auto',\n alignItems: 'flex-end',\n width: '100%',\n },\n bar: {\n flex: 1,\n maxWidth: ({ spacing }) => spacing(12),\n '& + &': {\n marginLeft: ({ spacing }) => spacing(1),\n },\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\nconst BAR_HEIGHTS = ['20%', '40%', '60%', '20%', '80%'] as const\n\n/**\n * Loading state for the Bar widget. Mirrors a bar chart's silhouette — five\n * vertical bars at staggered heights anchored to the bottom, plus a legend\n * stub — so the skeleton reads as \"a bar chart\" rather than a generic list.\n */\nexport function BarSkeleton() {\n return (\n <Box sx={styles.container}>\n <Box sx={styles.grid}>\n {BAR_HEIGHTS.map((height, i) => (\n <Skeleton\n key={`bar-${i}`}\n sx={styles.bar}\n variant='rectangular'\n height={height}\n />\n ))}\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n CSVIcon,\n buildPngDownloadItem,\n downloadToCSV,\n type DownloadItem,\n} from '../actions/download'\nimport type { BarWidgetData } from './types'\n\nexport interface BarDownloadConfigArgs {\n filename: string\n getData: () => BarWidgetData\n /**\n * Optional getter for the widget's capture element (registered by\n * `Widget.State` on its success path). When provided, a PNG item is\n * prepended to the returned list. Wire it to\n * `() => getCaptureEl(id)`.\n */\n getCaptureEl?: () => HTMLElement | null\n /** PNG `pixelRatio` (default 2). */\n pngPixelRatio?: number\n /** PNG `backgroundColor` (default transparent). */\n pngBackgroundColor?: string | null\n}\n\n/**\n * Builds download items for the Bar widget. Always includes a CSV item\n * with one `name,value` block per series, separated by an empty row when\n * there are multiple. When `getCaptureEl` is supplied, also prepends a PNG\n * item that rasterises the captured element via `html2canvas`.\n */\nexport function createBarDownloadConfig(\n args: BarDownloadConfigArgs,\n): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push({\n id: 'csv',\n label: 'CSV',\n icon: <CSVIcon fontSize='small' />,\n resolve: () => {\n const data = args.getData()\n const rows: unknown[][] = []\n for (const [i, series] of data.entries()) {\n if (i > 0) rows.push([])\n rows.push(['name', 'value'])\n for (const d of series) rows.push([d.name, d.value])\n }\n const handle = downloadToCSV(rows)\n return Promise.resolve({\n url: handle.url,\n filename: `${args.filename}.csv`,\n revoke: handle.revoke,\n })\n },\n })\n return items\n}\n"],"names":["barOptions","theme","formatter","labelFormatter","niceMin","niceMax","grid","left","parseInt","spacing","top","right","buildGridConfig","containLabel","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","textStyle","color","common","white","fontSize","fontFamily","typography","caption","axisPointer","type","position","createTooltipPositioner","buildBarTooltipFormatter","legend","buildLegendConfig","hasLegend","lineStyle","secondary","main","Object","values","qualitative","bold","xAxis","axisLine","show","axisTick","axisLabel","margin","hideOverlap","v","String","yAxis","min","extent","niceNum","max","splitLine","black","divider","overlineDelicate","showMaxLabel","showMinLabel","verticalAlign","inside","value","createBarOptionFactory","options","optionsOverride","series","selection","selectionSet","length","Set","option","data","ctx","structural","mergeOptions","seriesArr","Array","isArray","dataset","baseLegend","baseGrid","baseTooltip","baseYAxis","seriesTemplates","broadcastTemplate","liveFormatter","liveLabelFormatter","niceMinVal","niceMaxVal","computeNiceBounds","dataZoomLayout","positionDataZoomForLegend","dataZoom","fallbackBottom","bottom","baseBottom","gridBottom","ZOOM_LAYOUT","sliderHeight","sliderGap","dimItemStyle","params","base","name","has","echarts","modifyAlpha","map","s","source","_","i","template","overrideColor","resolveThemeColor","datasetIndex","encode","x","y","barMaxWidth","emphasis","focus","itemStyle","createTooltipFormatter","item","raw","formattedValue","marker","seriesName","d","Number","isFinite","styles","container","display","alignItems","justifyContent","flexDirection","gap","height","flex","width","bar","maxWidth","marginLeft","legendItem","BAR_HEIGHTS","BarSkeleton","$","_c","t0","Symbol","for","jsx","Box","_temp","t1","_temp2","i_0","jsxs","Skeleton","createBarDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","pngBackgroundColor","id","label","icon","CSVIcon","resolve","getData","rows","entries","handle","downloadToCSV","Promise","url","revoke"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCO,SAASA,EAAW;AAAA,EACzBC,OAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,gBAAAA;AACe,GAAqB;AAGpC,MAAIC,IAAU,GACVC,IAAU;AAEd,SAAO;AAAA,IACLC,MAAM;AAAA,MACJC,MAAMC,SAASP,EAAMQ,QAAQ,CAAC,CAAC;AAAA,MAC/BC,KAAKF,SAASP,EAAMQ,QAAQ,CAAC,CAAC;AAAA,MAC9BE,OAAOH,SAASP,EAAMQ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