@pie-lib/charting 8.0.1-next.20261006003311 → 8.0.1-next.20261006032932

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.
@@ -0,0 +1 @@
1
+ export {};
package/dist/axes.js CHANGED
@@ -1,62 +1,62 @@
1
1
  import e from "./node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/AxisLeft.js";
2
2
  import t from "./node_modules/.bun/@visx_axis@4.0.0_d84c32d47042070f/node_modules/@visx/axis/esm/axis/AxisBottom.js";
3
3
  import { TickCorrectnessIndicator as n } from "./common/correctness-indicators.js";
4
- import { bandKey as r, getRotateAngle as i, getRotatedLabelOverhang as a, getTickValues as o } from "./utils.js";
5
- import { MarkLabel as s } from "./mark-label.js";
6
- import c from "react";
7
- import l from "prop-types";
8
- import { styled as u } from "@mui/material/styles";
9
- import { types as d } from "@pie-lib/plot";
10
- import { AlertDialog as f } from "@pie-lib/config-ui";
11
- import { color as p } from "@pie-lib/render-ui";
12
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
13
- import g from "@mui/material/Checkbox";
14
- import { renderMath as _ } from "@pie-element/shared-math-rendering-mathjax";
15
- import v from "@pie-lib/translator";
4
+ import { bandKey as r, getRotateAngle as i, getRotatedLabelOverhang as a, getTickValues as o, textOf as s } from "./utils.js";
5
+ import { MarkLabel as c } from "./mark-label.js";
6
+ import l from "react";
7
+ import u from "prop-types";
8
+ import { styled as d } from "@mui/material/styles";
9
+ import { types as f } from "@pie-lib/plot";
10
+ import { AlertDialog as p } from "@pie-lib/config-ui";
11
+ import { color as m } from "@pie-lib/render-ui";
12
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
13
+ import _ from "@mui/material/Checkbox";
14
+ import { renderMath as v } from "@pie-element/shared-math-rendering-mathjax";
15
+ import y from "@pie-lib/translator";
16
16
  //#region src/axes.tsx
17
- var { translator: y } = v, b = /* @__PURE__ */ new Set(), x = null;
18
- function S(e) {
19
- b.add(e), !x && typeof document < "u" && (x = new MutationObserver(() => {
20
- b.forEach((e) => e());
21
- }), x.observe(document.body, {
17
+ var { translator: b } = y, x = /* @__PURE__ */ new Set(), S = null;
18
+ function C(e) {
19
+ x.add(e), !S && typeof document < "u" && (S = new MutationObserver(() => {
20
+ x.forEach((e) => e());
21
+ }), S.observe(document.body, {
22
22
  childList: !0,
23
23
  subtree: !0
24
24
  }));
25
25
  }
26
- function C(e) {
27
- b.delete(e), b.size === 0 && x && (x.disconnect(), x = null);
26
+ function w(e) {
27
+ x.delete(e), x.size === 0 && S && (S.disconnect(), S = null);
28
28
  }
29
- var w = u("text")(({ theme: e }) => ({
29
+ var T = d("text")(({ theme: e }) => ({
30
30
  fontSize: e.typography.fontSize - 2,
31
31
  fill: e.palette.error.main
32
- })), T = u(g)(() => ({ color: `${p.tertiary()} !important` })), E = u("g")(({ theme: e }) => ({
32
+ })), E = d(_)(() => ({ color: `${m.tertiary()} !important` })), D = d("g")(({ theme: e }) => ({
33
33
  "& .vx-axis-line": {
34
- stroke: p.visualElementsColors.AXIS_LINE_COLOR,
34
+ stroke: m.visualElementsColors.AXIS_LINE_COLOR,
35
35
  strokeWidth: 2
36
36
  },
37
37
  "& .vx-axis-tick": {
38
- fill: p.visualElementsColors.AXIS_TICK_COLOR,
38
+ fill: m.visualElementsColors.AXIS_TICK_COLOR,
39
39
  "& line": {
40
- stroke: p.visualElementsColors.AXIS_TICK_COLOR,
40
+ stroke: m.visualElementsColors.AXIS_TICK_COLOR,
41
41
  strokeWidth: 2
42
42
  },
43
43
  fontFamily: e.typography.body1?.fontFamily,
44
44
  fontSize: e.typography.fontSize,
45
45
  textAnchor: "middle"
46
46
  }
47
- })), D = (e) => ({
47
+ })), O = (e) => ({
48
48
  borderRadius: e.spacing(2),
49
- color: p.defaults.WHITE,
49
+ color: m.defaults.WHITE,
50
50
  fontSize: "16px",
51
51
  width: "16px",
52
52
  height: "16px",
53
53
  padding: "2px",
54
- border: `1px solid ${p.defaults.WHITE}`,
54
+ border: `1px solid ${m.defaults.WHITE}`,
55
55
  boxSizing: "unset"
56
- }), O = { backgroundColor: p.incorrectWithIcon() }, k = { backgroundColor: p.correct() }, A = class extends c.Component {
56
+ }), k = { backgroundColor: m.incorrectWithIcon() }, A = { backgroundColor: m.correct() }, j = class extends l.Component {
57
57
  static propTypes = {
58
- defineChart: l.bool,
59
- error: l.any
58
+ defineChart: u.bool,
59
+ error: u.any
60
60
  };
61
61
  constructor(e) {
62
62
  super(e), this.state = { dialog: { open: !1 } };
@@ -113,16 +113,16 @@ var w = u("text")(({ theme: e }) => ({
113
113
  return n;
114
114
  };
115
115
  render() {
116
- let { categories: e, xBand: t, bandWidth: i, barWidth: a, rotate: o, top: c, graphProps: l, defineChart: u, chartingOptions: d, x: p, y: g, formattedValue: _, changeInteractiveEnabled: v, changeEditableEnabled: b, error: x, autoFocus: S, hiddenLabelRef: C, showCorrectness: E, language: A } = this.props;
117
- if (!_) return null;
118
- let j = {
119
- correctnessIcon: D,
120
- incorrectIcon: O,
121
- correctIcon: k
122
- }, { dialog: M } = this.state, { changeEditable: N, changeInteractive: P } = d || {}, F = parseInt(_.split("-")[0], 10), I = e[F], { editable: L, interactive: R, label: z, correctness: B } = I || {}, V = t(r({ label: z }, F)), H = (e || []).reduce((e, t) => (e && e.label ? e.label.length : 0) > (t && t.label ? t.label.length : 0) ? e : t, { label: "" }), U = x ? [...new Set(Object.values(x))].join(" ") : "";
123
- return /* @__PURE__ */ h("g", { children: [
124
- /* @__PURE__ */ h("foreignObject", {
125
- x: i ? V : p - a / 2,
116
+ let { categories: e, xBand: t, bandWidth: i, barWidth: a, rotate: o, top: l, graphProps: u, defineChart: d, chartingOptions: f, x: m, y: _, formattedValue: v, changeInteractiveEnabled: y, changeEditableEnabled: x, error: S, autoFocus: C, hiddenLabelRef: w, showCorrectness: D, language: j } = this.props;
117
+ if (!v) return null;
118
+ let M = {
119
+ correctnessIcon: O,
120
+ incorrectIcon: k,
121
+ correctIcon: A
122
+ }, { dialog: N } = this.state, { changeEditable: P, changeInteractive: F } = f || {}, I = parseInt(v.split("-")[0], 10), L = e[I], { editable: R, interactive: z, label: B, correctness: V } = L || {}, H = t(r({ label: B }, I)), U = (e || []).reduce((e, t) => (e && e.label ? e.label.length : 0) > (t && t.label ? t.label.length : 0) ? e : t, { label: "" }), W = S ? [...new Set(Object.values(S))].join(" ") : "";
123
+ return /* @__PURE__ */ g("g", { children: [
124
+ /* @__PURE__ */ g("foreignObject", {
125
+ x: i ? H : m - a / 2,
126
126
  y: 18,
127
127
  width: a,
128
128
  height: 4,
@@ -130,47 +130,53 @@ var w = u("text")(({ theme: e }) => ({
130
130
  pointerEvents: "none",
131
131
  overflow: "visible"
132
132
  },
133
- children: [F === 0 && /* @__PURE__ */ m(s, {
133
+ children: [I === 0 && /* @__PURE__ */ h(c, {
134
134
  isHiddenLabel: !0,
135
- inputRef: C,
135
+ inputRef: w,
136
136
  disabled: !0,
137
- mark: H,
138
- graphProps: l,
137
+ mark: U,
138
+ graphProps: u,
139
139
  barWidth: a
140
- }), /* @__PURE__ */ m(s, {
141
- autoFocus: u && S,
140
+ }), /* @__PURE__ */ h(c, {
141
+ autoFocus: d && C,
142
142
  inputRef: (e) => this.input = e,
143
- disabled: !u && !L,
144
- mark: I,
145
- graphProps: l,
146
- onChange: (e) => this.changeCategory(F, e),
143
+ disabled: !d && !R,
144
+ mark: L,
145
+ graphProps: u,
146
+ onChange: (e) => this.changeCategory(I, e),
147
147
  barWidth: a,
148
148
  rotate: o,
149
- correctness: B,
150
- error: x && x[F],
151
- ariaLabel: y.t("charting.categoryLabel", {
152
- lng: A,
153
- index: F + 1
149
+ correctness: V,
150
+ error: S && S[I],
151
+ ariaLabel: b.t("charting.categoryLabel", {
152
+ lng: j,
153
+ index: I + 1
154
+ }),
155
+ mathAriaLabel: b.t("charting.categoryLabelValue", {
156
+ lng: j,
157
+ index: I + 1,
158
+ label: s(B),
159
+ interpolation: { escapeValue: !1 }
154
160
  }),
155
161
  limitCharacters: !0,
156
- correctnessIndicator: E && B && /* @__PURE__ */ m(n, {
157
- correctness: B,
158
- interactive: R,
159
- classes: j
162
+ correctnessIndicator: D && V && /* @__PURE__ */ h(n, {
163
+ correctness: V,
164
+ interactive: z,
165
+ classes: M
160
166
  })
161
167
  })]
162
168
  }),
163
- x && F === 0 && /* @__PURE__ */ m(w, {
164
- y: g + 23,
169
+ S && I === 0 && /* @__PURE__ */ h(T, {
170
+ y: _ + 23,
165
171
  height: 6,
166
172
  textAnchor: "start",
167
- children: U
173
+ children: W
168
174
  }),
169
- u && F === 0 && /* @__PURE__ */ h("svg", {
175
+ d && I === 0 && /* @__PURE__ */ g("svg", {
170
176
  x: -55,
171
177
  style: { overflow: "visible" },
172
- children: [v && /* @__PURE__ */ m("text", {
173
- y: g + 90 + c,
178
+ children: [y && /* @__PURE__ */ h("text", {
179
+ y: _ + 90 + l,
174
180
  width: a,
175
181
  height: 4,
176
182
  style: {
@@ -180,13 +186,13 @@ var w = u("text")(({ theme: e }) => ({
180
186
  maxWidth: a,
181
187
  display: "inline-block"
182
188
  },
183
- children: this.splitText(P?.authoringLabel, 20).map((e, t) => /* @__PURE__ */ m("tspan", {
189
+ children: this.splitText(F?.authoringLabel, 20).map((e, t) => /* @__PURE__ */ h("tspan", {
184
190
  x: "0",
185
191
  dy: `${t > 0 ? "1.2em" : ".6em"}`,
186
192
  children: e
187
193
  }, t))
188
- }), b && /* @__PURE__ */ m("text", {
189
- y: g + 145 + c,
194
+ }), x && /* @__PURE__ */ h("text", {
195
+ y: _ + 145 + l,
190
196
  width: a,
191
197
  height: 4,
192
198
  style: {
@@ -196,109 +202,109 @@ var w = u("text")(({ theme: e }) => ({
196
202
  maxWidth: a,
197
203
  display: "inline-block"
198
204
  },
199
- children: this.splitText(N?.authoringLabel, 20).map((e, t) => /* @__PURE__ */ m("tspan", {
205
+ children: this.splitText(P?.authoringLabel, 20).map((e, t) => /* @__PURE__ */ h("tspan", {
200
206
  x: "0",
201
207
  dy: `${t > 0 ? "1.2em" : ".6em"}`,
202
208
  children: e
203
209
  }, t))
204
210
  })]
205
211
  }),
206
- u && v && /* @__PURE__ */ m("foreignObject", {
207
- x: p - 24,
208
- y: g + 80 + c,
212
+ d && y && /* @__PURE__ */ h("foreignObject", {
213
+ x: m - 24,
214
+ y: _ + 80 + l,
209
215
  width: a,
210
216
  height: 4,
211
217
  style: {
212
218
  pointerEvents: "visible",
213
219
  overflow: "visible"
214
220
  },
215
- children: /* @__PURE__ */ m(T, {
221
+ children: /* @__PURE__ */ h(E, {
216
222
  style: { position: "fixed" },
217
- checked: R,
218
- onChange: (e) => this.changeInteractive(F, e.target.checked)
223
+ checked: z,
224
+ onChange: (e) => this.changeInteractive(I, e.target.checked)
219
225
  })
220
226
  }),
221
- u && b && /* @__PURE__ */ m("foreignObject", {
222
- x: p - 24,
223
- y: g + 130 + c,
227
+ d && x && /* @__PURE__ */ h("foreignObject", {
228
+ x: m - 24,
229
+ y: _ + 130 + l,
224
230
  width: a,
225
231
  height: 4,
226
232
  style: {
227
233
  pointerEvents: "visible",
228
234
  overflow: "visible"
229
235
  },
230
- children: /* @__PURE__ */ m(T, {
236
+ children: /* @__PURE__ */ h(E, {
231
237
  style: { position: "fixed" },
232
- checked: L,
233
- onChange: (e) => this.changeEditable(F, e.target.checked)
238
+ checked: R,
239
+ onChange: (e) => this.changeEditable(I, e.target.checked)
234
240
  })
235
241
  }),
236
- /* @__PURE__ */ m("foreignObject", {
237
- x: p - 24,
238
- y: g + 100 + c,
242
+ /* @__PURE__ */ h("foreignObject", {
243
+ x: m - 24,
244
+ y: _ + 100 + l,
239
245
  width: a,
240
246
  height: 4,
241
247
  style: {
242
248
  pointerEvents: "visible",
243
249
  overflow: "visible"
244
250
  },
245
- children: /* @__PURE__ */ m(f, {
246
- open: M.open,
247
- title: M.title,
248
- text: M.text,
249
- onClose: M.onClose,
250
- onConfirm: M.onConfirm
251
+ children: /* @__PURE__ */ h(p, {
252
+ open: N.open,
253
+ title: N.title,
254
+ text: N.text,
255
+ onClose: N.onClose,
256
+ onConfirm: N.onConfirm
251
257
  })
252
258
  })
253
259
  ] });
254
260
  }
255
261
  };
256
- A.propTypes = {
257
- categories: l.array,
258
- xBand: l.func,
259
- bandWidth: l.number,
260
- barWidth: l.number,
261
- rotate: l.number,
262
- top: l.number,
263
- x: l.number,
264
- y: l.number,
265
- graphProps: l.object,
266
- formattedValue: l.string,
267
- onChangeCategory: l.func,
268
- onChange: l.func,
269
- error: l.object,
270
- defineChart: l.bool,
271
- chartingOptions: l.object,
272
- changeInteractiveEnabled: l.bool,
273
- changeEditableEnabled: l.bool,
274
- autoFocus: l.bool,
275
- onAutoFocusUsed: l.func,
276
- showCorrectness: l.bool,
277
- hiddenLabelRef: l.oneOfType([l.func, l.shape({ current: l.instanceOf(Element) })]),
278
- language: l.string
262
+ j.propTypes = {
263
+ categories: u.array,
264
+ xBand: u.func,
265
+ bandWidth: u.number,
266
+ barWidth: u.number,
267
+ rotate: u.number,
268
+ top: u.number,
269
+ x: u.number,
270
+ y: u.number,
271
+ graphProps: u.object,
272
+ formattedValue: u.string,
273
+ onChangeCategory: u.func,
274
+ onChange: u.func,
275
+ error: u.object,
276
+ defineChart: u.bool,
277
+ chartingOptions: u.object,
278
+ changeInteractiveEnabled: u.bool,
279
+ changeEditableEnabled: u.bool,
280
+ autoFocus: u.bool,
281
+ onAutoFocusUsed: u.func,
282
+ showCorrectness: u.bool,
283
+ hiddenLabelRef: u.oneOfType([u.func, u.shape({ current: u.instanceOf(Element) })]),
284
+ language: u.string
279
285
  };
280
- var j = class extends c.Component {
286
+ var M = class extends l.Component {
281
287
  static propTypes = {
282
- bottomScale: l.func,
283
- categories: l.array,
284
- defineChart: l.bool,
285
- error: l.any,
286
- graphProps: d.GraphPropsType.isRequired,
287
- xBand: l.func,
288
- leftAxis: l.bool,
289
- onChange: l.func,
290
- onChangeCategory: l.func,
291
- top: l.number,
292
- theme: l.object,
293
- chartingOptions: l.object,
294
- changeInteractiveEnabled: l.bool,
295
- changeEditableEnabled: l.bool,
296
- autoFocus: l.bool,
297
- onAutoFocusUsed: l.func,
298
- showCorrectness: l.bool,
299
- hiddenLabelRef: l.oneOfType([l.func, l.shape({ current: l.instanceOf(Element) })]),
300
- language: l.string,
301
- onLabelOverhang: l.func
288
+ bottomScale: u.func,
289
+ categories: u.array,
290
+ defineChart: u.bool,
291
+ error: u.any,
292
+ graphProps: f.GraphPropsType.isRequired,
293
+ xBand: u.func,
294
+ leftAxis: u.bool,
295
+ onChange: u.func,
296
+ onChangeCategory: u.func,
297
+ top: u.number,
298
+ theme: u.object,
299
+ chartingOptions: u.object,
300
+ changeInteractiveEnabled: u.bool,
301
+ changeEditableEnabled: u.bool,
302
+ autoFocus: u.bool,
303
+ onAutoFocusUsed: u.func,
304
+ showCorrectness: u.bool,
305
+ hiddenLabelRef: u.oneOfType([u.func, u.shape({ current: u.instanceOf(Element) })]),
306
+ language: u.string,
307
+ onLabelOverhang: u.func
302
308
  };
303
309
  state = {
304
310
  height: 0,
@@ -331,7 +337,7 @@ var j = class extends c.Component {
331
337
  observeHiddenLabel = (e) => {
332
338
  if (!e) return;
333
339
  let t = e.querySelector("[data-latex], [data-raw]");
334
- t && _(e), (e.querySelector("mjx-container") || !t) && this.measureHiddenLabel(), S(this._onDocMutation), this.observeHiddenLabelSize(e);
340
+ t && v(e), (e.querySelector("mjx-container") || !t) && this.measureHiddenLabel(), C(this._onDocMutation), this.observeHiddenLabelSize(e);
335
341
  };
336
342
  observeHiddenLabelSize = (e) => {
337
343
  e === this._sizedLabel || typeof ResizeObserver > "u" || (this._sizeObserver?.disconnect(), this._sizedLabel = e, this._sizeObserver = new ResizeObserver(() => this.measureHiddenLabel()), this._sizeObserver.observe(e));
@@ -343,17 +349,17 @@ var j = class extends c.Component {
343
349
  this.hiddenLabelRef && this.observeHiddenLabel(this.hiddenLabelRef), this.reportLabelOverhang();
344
350
  }
345
351
  componentWillUnmount() {
346
- C(this._onDocMutation), this._sizeObserver?.disconnect(), this._sizedLabel = null, this._updateTimer && clearTimeout(this._updateTimer);
352
+ w(this._onDocMutation), this._sizeObserver?.disconnect(), this._sizedLabel = null, this._updateTimer && clearTimeout(this._updateTimer);
347
353
  }
348
354
  componentDidUpdate(e) {
349
355
  e.categories !== this.props.categories && (this._updateTimer && clearTimeout(this._updateTimer), this._updateTimer = setTimeout(() => this.measureHiddenLabel(), 50)), this.reportLabelOverhang();
350
356
  }
351
357
  render() {
352
- let { graphProps: n, xBand: r, leftAxis: i, onChange: a, onChangeCategory: s, categories: c = [], top: l, defineChart: u, chartingOptions: d, changeInteractiveEnabled: f, changeEditableEnabled: p, autoFocus: g, onAutoFocusUsed: _, error: v, showCorrectness: y, language: b } = this.props, { scale: x = {}, range: S = {}, size: C = {} } = n || {}, w = r && typeof r.rangeRound == "function" && r.rangeRound([0, C.width]), { bandWidth: T, barWidth: D, rotate: O } = this.labelLayout(), k = o({
358
+ let { graphProps: n, xBand: r, leftAxis: i, onChange: a, onChangeCategory: s, categories: c = [], top: l, defineChart: u, chartingOptions: d, changeInteractiveEnabled: f, changeEditableEnabled: p, autoFocus: m, onAutoFocusUsed: _, error: v, showCorrectness: y, language: b } = this.props, { scale: x = {}, range: S = {}, size: C = {} } = n || {}, w = r && typeof r.rangeRound == "function" && r.rangeRound([0, C.width]), { bandWidth: T, barWidth: E, rotate: O } = this.labelLayout(), k = o({
353
359
  ...S,
354
360
  step: S.labelStep
355
361
  });
356
- return /* @__PURE__ */ h(E, { children: [i && /* @__PURE__ */ m(e, {
362
+ return /* @__PURE__ */ g(D, { children: [i && /* @__PURE__ */ h(e, {
357
363
  scale: x.y,
358
364
  tickLength: 10,
359
365
  tickFormat: (e) => e,
@@ -362,23 +368,23 @@ var j = class extends c.Component {
362
368
  dy: 4,
363
369
  dx: -10 - (e.toLocaleString().length || 1) * 5
364
370
  })
365
- }), /* @__PURE__ */ m(t, {
371
+ }), /* @__PURE__ */ h(t, {
366
372
  scale: w,
367
373
  labelProps: { y: 60 + l },
368
374
  top: x.y && x.y(S.min),
369
375
  textLabelProps: () => ({ textAnchor: "middle" }),
370
376
  tickFormat: (e) => e,
371
- tickComponent: (e) => /* @__PURE__ */ m(A, {
377
+ tickComponent: (e) => /* @__PURE__ */ h(j, {
372
378
  hiddenLabelRef: this.setHiddenLabelRef,
373
379
  categories: c,
374
380
  xBand: r,
375
381
  bandWidth: T,
376
- barWidth: D,
382
+ barWidth: E,
377
383
  rotate: O,
378
384
  top: l,
379
385
  defineChart: u,
380
386
  chartingOptions: d,
381
- autoFocus: g,
387
+ autoFocus: m,
382
388
  onAutoFocusUsed: _,
383
389
  error: v,
384
390
  onChangeCategory: s,
@@ -392,10 +398,10 @@ var j = class extends c.Component {
392
398
  showCorrectness: y,
393
399
  language: b
394
400
  }),
395
- autoFocus: g,
401
+ autoFocus: m,
396
402
  onAutoFocusUsed: _
397
403
  })] });
398
404
  }
399
405
  };
400
406
  //#endregion
401
- export { j as RawChartAxes, j as default, A as TickComponent };
407
+ export { M as RawChartAxes, M as default, j as TickComponent };
@@ -40,6 +40,7 @@ export declare class RawBar extends React.Component {
40
40
  }>>;
41
41
  correctData: PropTypes.Requireable<any[]>;
42
42
  defineChart: PropTypes.Requireable<boolean>;
43
+ language: PropTypes.Requireable<string>;
43
44
  };
44
45
  constructor(props: any);
45
46
  componentDidMount(): void;
@@ -49,6 +50,7 @@ export declare class RawBar extends React.Component {
49
50
  handleMouseEnter: () => void;
50
51
  handleMouseLeave: () => void;
51
52
  setDragValue: (dragValue: any) => void;
53
+ changeValue: any;
52
54
  dragStop: any;
53
55
  dragValue: any;
54
56
  render(): React.JSX.Element;
@@ -85,6 +87,7 @@ export declare class Bars extends React.Component {
85
87
  }>>>;
86
88
  }>>>;
87
89
  histogram: PropTypes.Requireable<boolean>;
90
+ language: PropTypes.Requireable<string>;
88
91
  };
89
92
  render(): React.JSX.Element;
90
93
  }