@pie-lib/charting 8.0.1-next.20261004200555 → 8.0.1-next.20261004212815

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 {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,8 @@
1
1
  import e from "react";
2
2
  import t from "prop-types";
3
3
  import { styled as n } from "@mui/material/styles";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import { color as a } from "@pie-lib/render-ui";
4
+ import { color as r } from "@pie-lib/render-ui";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  import o from "@pie-lib/translator";
7
7
  import s from "@mui/material/Button";
8
8
  import c from "@mui/material/Popover";
@@ -11,7 +11,7 @@ import l from "@mui/material/Paper";
11
11
  var { translator: u } = o, d = n("div")(() => ({ alignSelf: "flex-end" })), f = n("div")(({ theme: e }) => ({
12
12
  cursor: "pointer",
13
13
  fontSize: e.typography.fontSize,
14
- color: a.tertiary(),
14
+ color: r.tertiary(),
15
15
  padding: e.spacing(1)
16
16
  })), p = n(l)(({ theme: e }) => ({
17
17
  padding: e.spacing(1),
@@ -21,7 +21,7 @@ var { translator: u } = o, d = n("div")(() => ({ alignSelf: "flex-end" })), f =
21
21
  "& button": {
22
22
  textTransform: "none",
23
23
  fontSize: e.typography.fontSize,
24
- color: a.text(),
24
+ color: r.text(),
25
25
  justifyContent: "flex-start"
26
26
  }
27
27
  })), m = class extends e.Component {
@@ -53,12 +53,12 @@ var { translator: u } = o, d = n("div")(() => ({ alignSelf: "flex-end" })), f =
53
53
  };
54
54
  render() {
55
55
  let { categories: e, language: t } = this.props, { actionsAnchorEl: n } = this.state;
56
- return /* @__PURE__ */ i(d, { children: [/* @__PURE__ */ r(f, {
56
+ return /* @__PURE__ */ a(d, { children: [/* @__PURE__ */ i(f, {
57
57
  role: "button",
58
58
  tabIndex: 0,
59
59
  onClick: this.handleActionsClick,
60
60
  children: "Actions"
61
- }), /* @__PURE__ */ r(c, {
61
+ }), /* @__PURE__ */ i(c, {
62
62
  open: !!n,
63
63
  anchorEl: n,
64
64
  onClose: this.handleActionsClose,
@@ -70,10 +70,10 @@ var { translator: u } = o, d = n("div")(() => ({ alignSelf: "flex-end" })), f =
70
70
  vertical: "top",
71
71
  horizontal: "left"
72
72
  },
73
- children: /* @__PURE__ */ i(p, { children: [/* @__PURE__ */ i(s, {
73
+ children: /* @__PURE__ */ a(p, { children: [/* @__PURE__ */ a(s, {
74
74
  onClick: () => this.handleAddCategory(),
75
75
  children: ["+ ", u.t("charting.add", { lng: t })]
76
- }), e.length > 0 && e.map((e, n) => e.deletable && !e.correctness && /* @__PURE__ */ r(s, {
76
+ }), e.length > 0 && e.map((e, n) => e.deletable && !e.correctness && /* @__PURE__ */ i(s, {
77
77
  onClick: () => this.handleDeleteCategory(n),
78
78
  children: `${u.t("charting.delete", { lng: t })} <${e.label || u.t("charting.newLabel", { lng: t })}>`
79
79
  }, n))] })
package/dist/axes.d.ts CHANGED
@@ -60,14 +60,19 @@ export declare class RawChartAxes extends React.Component {
60
60
  current: PropTypes.Requireable<Element>;
61
61
  }> | null | undefined>>;
62
62
  language: PropTypes.Requireable<string>;
63
+ onLabelOverhang: PropTypes.Requireable<(...args: any[]) => any>;
63
64
  };
64
65
  state: {
65
66
  height: number;
66
67
  width: number;
67
68
  };
69
+ reportedOverhang: number;
70
+ labelLayout: any;
71
+ reportLabelOverhang: any;
68
72
  measureHiddenLabel: any;
69
73
  _onDocMutation: any;
70
74
  observeHiddenLabel: any;
75
+ observeHiddenLabelSize: any;
71
76
  setHiddenLabelRef: any;
72
77
  componentDidMount(): void;
73
78
  componentWillUnmount(): void;
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, getTickValues as a } from "./utils.js";
5
- import { MarkLabel as o } from "./mark-label.js";
6
- import s from "react";
7
- import c from "prop-types";
8
- import { styled as l } from "@mui/material/styles";
9
- import { types as u } from "@pie-lib/plot";
10
- import { AlertDialog as d } from "@pie-lib/config-ui";
11
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
12
- import { color as m } from "@pie-lib/render-ui";
13
- import h from "@mui/material/Checkbox";
14
- import { renderMath as g } from "@pie-element/shared-math-rendering-mathjax";
15
- import _ from "@pie-lib/translator";
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";
16
16
  //#region src/axes.tsx
17
- var { translator: v } = _, y = /* @__PURE__ */ new Set(), b = null;
18
- function x(e) {
19
- y.add(e), !b && typeof document < "u" && (b = new MutationObserver(() => {
20
- y.forEach((e) => e());
21
- }), b.observe(document.body, {
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, {
22
22
  childList: !0,
23
23
  subtree: !0
24
24
  }));
25
25
  }
26
- function S(e) {
27
- y.delete(e), y.size === 0 && b && (b.disconnect(), b = null);
26
+ function C(e) {
27
+ b.delete(e), b.size === 0 && x && (x.disconnect(), x = null);
28
28
  }
29
- var C = l("text")(({ theme: e }) => ({
29
+ var w = u("text")(({ theme: e }) => ({
30
30
  fontSize: e.typography.fontSize - 2,
31
31
  fill: e.palette.error.main
32
- })), w = l(h)(() => ({ color: `${m.tertiary()} !important` })), T = l("g")(({ theme: e }) => ({
32
+ })), T = u(g)(() => ({ color: `${p.tertiary()} !important` })), E = u("g")(({ theme: e }) => ({
33
33
  "& .vx-axis-line": {
34
- stroke: m.visualElementsColors.AXIS_LINE_COLOR,
34
+ stroke: p.visualElementsColors.AXIS_LINE_COLOR,
35
35
  strokeWidth: 2
36
36
  },
37
37
  "& .vx-axis-tick": {
38
- fill: m.visualElementsColors.AXIS_TICK_COLOR,
38
+ fill: p.visualElementsColors.AXIS_TICK_COLOR,
39
39
  "& line": {
40
- stroke: m.visualElementsColors.AXIS_TICK_COLOR,
40
+ stroke: p.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
- })), E = (e) => ({
47
+ })), D = (e) => ({
48
48
  borderRadius: e.spacing(2),
49
- color: m.defaults.WHITE,
49
+ color: p.defaults.WHITE,
50
50
  fontSize: "16px",
51
51
  width: "16px",
52
52
  height: "16px",
53
53
  padding: "2px",
54
- border: `1px solid ${m.defaults.WHITE}`,
54
+ border: `1px solid ${p.defaults.WHITE}`,
55
55
  boxSizing: "unset"
56
- }), D = { backgroundColor: m.incorrectWithIcon() }, O = { backgroundColor: m.correct() }, k = class extends s.Component {
56
+ }), O = { backgroundColor: p.incorrectWithIcon() }, k = { backgroundColor: p.correct() }, A = class extends c.Component {
57
57
  static propTypes = {
58
- defineChart: c.bool,
59
- error: c.any
58
+ defineChart: l.bool,
59
+ error: l.any
60
60
  };
61
61
  constructor(e) {
62
62
  super(e), this.state = { dialog: { open: !1 } };
@@ -113,16 +113,16 @@ var C = l("text")(({ theme: e }) => ({
113
113
  return n;
114
114
  };
115
115
  render() {
116
- let { categories: e, xBand: t, bandWidth: i, barWidth: a, rotate: s, top: c, graphProps: l, defineChart: u, chartingOptions: m, x: h, y: g, formattedValue: _, changeInteractiveEnabled: y, changeEditableEnabled: b, error: x, autoFocus: S, hiddenLabelRef: T, showCorrectness: k, language: A } = this.props;
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
117
  if (!_) return null;
118
118
  let j = {
119
- correctnessIcon: E,
120
- incorrectIcon: D,
121
- correctIcon: O
122
- }, { dialog: M } = this.state, { changeEditable: N, changeInteractive: P } = m || {}, 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__ */ p("g", { children: [
124
- /* @__PURE__ */ p("foreignObject", {
125
- x: i ? V : h - a / 2,
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,
126
126
  y: 18,
127
127
  width: a,
128
128
  height: 4,
@@ -130,14 +130,14 @@ var C = l("text")(({ theme: e }) => ({
130
130
  pointerEvents: "none",
131
131
  overflow: "visible"
132
132
  },
133
- children: [F === 0 && /* @__PURE__ */ f(o, {
133
+ children: [F === 0 && /* @__PURE__ */ m(s, {
134
134
  isHiddenLabel: !0,
135
- inputRef: T,
135
+ inputRef: C,
136
136
  disabled: !0,
137
137
  mark: H,
138
138
  graphProps: l,
139
139
  barWidth: a
140
- }), /* @__PURE__ */ f(o, {
140
+ }), /* @__PURE__ */ m(s, {
141
141
  autoFocus: u && S,
142
142
  inputRef: (e) => this.input = e,
143
143
  disabled: !u && !L,
@@ -145,31 +145,31 @@ var C = l("text")(({ theme: e }) => ({
145
145
  graphProps: l,
146
146
  onChange: (e) => this.changeCategory(F, e),
147
147
  barWidth: a,
148
- rotate: s,
148
+ rotate: o,
149
149
  correctness: B,
150
150
  error: x && x[F],
151
- ariaLabel: v.t("charting.categoryLabel", {
151
+ ariaLabel: y.t("charting.categoryLabel", {
152
152
  lng: A,
153
153
  index: F + 1
154
154
  }),
155
155
  limitCharacters: !0,
156
- correctnessIndicator: k && B && /* @__PURE__ */ f(n, {
156
+ correctnessIndicator: E && B && /* @__PURE__ */ m(n, {
157
157
  correctness: B,
158
158
  interactive: R,
159
159
  classes: j
160
160
  })
161
161
  })]
162
162
  }),
163
- x && F === 0 && /* @__PURE__ */ f(C, {
163
+ x && F === 0 && /* @__PURE__ */ m(w, {
164
164
  y: g + 23,
165
165
  height: 6,
166
166
  textAnchor: "start",
167
167
  children: U
168
168
  }),
169
- u && F === 0 && /* @__PURE__ */ p("svg", {
169
+ u && F === 0 && /* @__PURE__ */ h("svg", {
170
170
  x: -55,
171
171
  style: { overflow: "visible" },
172
- children: [y && /* @__PURE__ */ f("text", {
172
+ children: [v && /* @__PURE__ */ m("text", {
173
173
  y: g + 90 + c,
174
174
  width: a,
175
175
  height: 4,
@@ -180,12 +180,12 @@ var C = l("text")(({ theme: e }) => ({
180
180
  maxWidth: a,
181
181
  display: "inline-block"
182
182
  },
183
- children: this.splitText(P?.authoringLabel, 20).map((e, t) => /* @__PURE__ */ f("tspan", {
183
+ children: this.splitText(P?.authoringLabel, 20).map((e, t) => /* @__PURE__ */ m("tspan", {
184
184
  x: "0",
185
185
  dy: `${t > 0 ? "1.2em" : ".6em"}`,
186
186
  children: e
187
187
  }, t))
188
- }), b && /* @__PURE__ */ f("text", {
188
+ }), b && /* @__PURE__ */ m("text", {
189
189
  y: g + 145 + c,
190
190
  width: a,
191
191
  height: 4,
@@ -196,15 +196,15 @@ var C = l("text")(({ theme: e }) => ({
196
196
  maxWidth: a,
197
197
  display: "inline-block"
198
198
  },
199
- children: this.splitText(N?.authoringLabel, 20).map((e, t) => /* @__PURE__ */ f("tspan", {
199
+ children: this.splitText(N?.authoringLabel, 20).map((e, t) => /* @__PURE__ */ m("tspan", {
200
200
  x: "0",
201
201
  dy: `${t > 0 ? "1.2em" : ".6em"}`,
202
202
  children: e
203
203
  }, t))
204
204
  })]
205
205
  }),
206
- u && y && /* @__PURE__ */ f("foreignObject", {
207
- x: h - 24,
206
+ u && v && /* @__PURE__ */ m("foreignObject", {
207
+ x: p - 24,
208
208
  y: g + 80 + c,
209
209
  width: a,
210
210
  height: 4,
@@ -212,14 +212,14 @@ var C = l("text")(({ theme: e }) => ({
212
212
  pointerEvents: "visible",
213
213
  overflow: "visible"
214
214
  },
215
- children: /* @__PURE__ */ f(w, {
215
+ children: /* @__PURE__ */ m(T, {
216
216
  style: { position: "fixed" },
217
217
  checked: R,
218
218
  onChange: (e) => this.changeInteractive(F, e.target.checked)
219
219
  })
220
220
  }),
221
- u && b && /* @__PURE__ */ f("foreignObject", {
222
- x: h - 24,
221
+ u && b && /* @__PURE__ */ m("foreignObject", {
222
+ x: p - 24,
223
223
  y: g + 130 + c,
224
224
  width: a,
225
225
  height: 4,
@@ -227,14 +227,14 @@ var C = l("text")(({ theme: e }) => ({
227
227
  pointerEvents: "visible",
228
228
  overflow: "visible"
229
229
  },
230
- children: /* @__PURE__ */ f(w, {
230
+ children: /* @__PURE__ */ m(T, {
231
231
  style: { position: "fixed" },
232
232
  checked: L,
233
233
  onChange: (e) => this.changeEditable(F, e.target.checked)
234
234
  })
235
235
  }),
236
- /* @__PURE__ */ f("foreignObject", {
237
- x: h - 24,
236
+ /* @__PURE__ */ m("foreignObject", {
237
+ x: p - 24,
238
238
  y: g + 100 + c,
239
239
  width: a,
240
240
  height: 4,
@@ -242,7 +242,7 @@ var C = l("text")(({ theme: e }) => ({
242
242
  pointerEvents: "visible",
243
243
  overflow: "visible"
244
244
  },
245
- children: /* @__PURE__ */ f(d, {
245
+ children: /* @__PURE__ */ m(f, {
246
246
  open: M.open,
247
247
  title: M.title,
248
248
  text: M.text,
@@ -253,56 +253,70 @@ var C = l("text")(({ theme: e }) => ({
253
253
  ] });
254
254
  }
255
255
  };
256
- k.propTypes = {
257
- categories: c.array,
258
- xBand: c.func,
259
- bandWidth: c.number,
260
- barWidth: c.number,
261
- rotate: c.number,
262
- top: c.number,
263
- x: c.number,
264
- y: c.number,
265
- graphProps: c.object,
266
- formattedValue: c.string,
267
- onChangeCategory: c.func,
268
- onChange: c.func,
269
- error: c.object,
270
- defineChart: c.bool,
271
- chartingOptions: c.object,
272
- changeInteractiveEnabled: c.bool,
273
- changeEditableEnabled: c.bool,
274
- autoFocus: c.bool,
275
- onAutoFocusUsed: c.func,
276
- showCorrectness: c.bool,
277
- hiddenLabelRef: c.oneOfType([c.func, c.shape({ current: c.instanceOf(Element) })]),
278
- language: c.string
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
279
279
  };
280
- var A = class extends s.Component {
280
+ var j = class extends c.Component {
281
281
  static propTypes = {
282
- bottomScale: c.func,
283
- categories: c.array,
284
- defineChart: c.bool,
285
- error: c.any,
286
- graphProps: u.GraphPropsType.isRequired,
287
- xBand: c.func,
288
- leftAxis: c.bool,
289
- onChange: c.func,
290
- onChangeCategory: c.func,
291
- top: c.number,
292
- theme: c.object,
293
- chartingOptions: c.object,
294
- changeInteractiveEnabled: c.bool,
295
- changeEditableEnabled: c.bool,
296
- autoFocus: c.bool,
297
- onAutoFocusUsed: c.func,
298
- showCorrectness: c.bool,
299
- hiddenLabelRef: c.oneOfType([c.func, c.shape({ current: c.instanceOf(Element) })]),
300
- language: c.string
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
301
302
  };
302
303
  state = {
303
304
  height: 0,
304
305
  width: 0
305
306
  };
307
+ reportedOverhang = 0;
308
+ labelLayout = () => {
309
+ let { graphProps: e, xBand: t, categories: n = [], theme: r } = this.props, { scale: a = {}, domain: o = {} } = e || {}, { height: s, width: c } = this.state, l = t && typeof t.bandwidth == "function" && t.bandwidth(), u = l || a.x && a.x(o.max) / n.length;
310
+ return {
311
+ bandWidth: l,
312
+ barWidth: u,
313
+ rotate: i(r && r.typography ? r.typography.fontSize : 14, s) || (c > u ? 25 : 0)
314
+ };
315
+ };
316
+ reportLabelOverhang = () => {
317
+ let { onLabelOverhang: e } = this.props, { height: t, width: n } = this.state, r = a(n, t, this.labelLayout().rotate);
318
+ e && r !== this.reportedOverhang && (this.reportedOverhang = r, e(r));
319
+ };
306
320
  measureHiddenLabel = () => {
307
321
  if (!this.hiddenLabelRef) return;
308
322
  let e = this.hiddenLabelRef.querySelector("mjx-container"), t = this.hiddenLabelRef.querySelector("input"), n = (e || t || this.hiddenLabelRef).getBoundingClientRect(), r = Math.floor(n.height), i = Math.floor(n.width);
@@ -317,68 +331,71 @@ var A = class extends s.Component {
317
331
  observeHiddenLabel = (e) => {
318
332
  if (!e) return;
319
333
  let t = e.querySelector("[data-latex], [data-raw]");
320
- t && g(e), (e.querySelector("mjx-container") || !t) && this.measureHiddenLabel(), x(this._onDocMutation);
334
+ t && _(e), (e.querySelector("mjx-container") || !t) && this.measureHiddenLabel(), S(this._onDocMutation), this.observeHiddenLabelSize(e);
335
+ };
336
+ observeHiddenLabelSize = (e) => {
337
+ e === this._sizedLabel || typeof ResizeObserver > "u" || (this._sizeObserver?.disconnect(), this._sizedLabel = e, this._sizeObserver = new ResizeObserver(() => this.measureHiddenLabel()), this._sizeObserver.observe(e));
321
338
  };
322
339
  setHiddenLabelRef = (e) => {
323
340
  e && e !== this.hiddenLabelRef && (this.hiddenLabelRef = e, this.observeHiddenLabel(e));
324
341
  };
325
342
  componentDidMount() {
326
- this.hiddenLabelRef && this.observeHiddenLabel(this.hiddenLabelRef);
343
+ this.hiddenLabelRef && this.observeHiddenLabel(this.hiddenLabelRef), this.reportLabelOverhang();
327
344
  }
328
345
  componentWillUnmount() {
329
- S(this._onDocMutation), this._updateTimer && clearTimeout(this._updateTimer);
346
+ C(this._onDocMutation), this._sizeObserver?.disconnect(), this._sizedLabel = null, this._updateTimer && clearTimeout(this._updateTimer);
330
347
  }
331
348
  componentDidUpdate(e) {
332
- e.categories !== this.props.categories && (this._updateTimer && clearTimeout(this._updateTimer), this._updateTimer = setTimeout(() => this.measureHiddenLabel(), 50));
349
+ e.categories !== this.props.categories && (this._updateTimer && clearTimeout(this._updateTimer), this._updateTimer = setTimeout(() => this.measureHiddenLabel(), 50)), this.reportLabelOverhang();
333
350
  }
334
351
  render() {
335
- let { graphProps: n, xBand: r, leftAxis: o, onChange: s, onChangeCategory: c, categories: l = [], top: u, defineChart: d, chartingOptions: m, changeInteractiveEnabled: h, changeEditableEnabled: g, theme: _, autoFocus: v, onAutoFocusUsed: y, error: b, showCorrectness: x, language: S } = this.props, { scale: C = {}, range: w = {}, domain: E = {}, size: D = {} } = n || {}, { height: O, width: A } = this.state, j = r && typeof r.rangeRound == "function" && r.rangeRound([0, D.width]), M = r && typeof r.bandwidth == "function" && r.bandwidth(), N = M || C.x && C.x(E.max) / l.length, P = a({
336
- ...w,
337
- step: w.labelStep
338
- }), F = i(_ && _.typography ? _.typography.fontSize : 14, O), I = A > N ? 25 : 0;
339
- return /* @__PURE__ */ p(T, { children: [o && /* @__PURE__ */ f(e, {
340
- scale: C.y,
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({
353
+ ...S,
354
+ step: S.labelStep
355
+ });
356
+ return /* @__PURE__ */ h(E, { children: [i && /* @__PURE__ */ m(e, {
357
+ scale: x.y,
341
358
  tickLength: 10,
342
359
  tickFormat: (e) => e,
343
- tickValues: P,
360
+ tickValues: k,
344
361
  tickLabelProps: (e) => ({
345
362
  dy: 4,
346
363
  dx: -10 - (e.toLocaleString().length || 1) * 5
347
364
  })
348
- }), /* @__PURE__ */ f(t, {
349
- scale: j,
350
- labelProps: { y: 60 + u },
351
- top: C.y && C.y(w.min),
365
+ }), /* @__PURE__ */ m(t, {
366
+ scale: w,
367
+ labelProps: { y: 60 + l },
368
+ top: x.y && x.y(S.min),
352
369
  textLabelProps: () => ({ textAnchor: "middle" }),
353
370
  tickFormat: (e) => e,
354
- tickComponent: (e) => /* @__PURE__ */ f(k, {
371
+ tickComponent: (e) => /* @__PURE__ */ m(A, {
355
372
  hiddenLabelRef: this.setHiddenLabelRef,
356
- categories: l,
373
+ categories: c,
357
374
  xBand: r,
358
- bandWidth: M,
359
- barWidth: N,
360
- rotate: F || I,
361
- top: u,
362
- defineChart: d,
363
- chartingOptions: m,
364
- autoFocus: v,
365
- onAutoFocusUsed: y,
366
- error: b,
367
- onChangeCategory: c,
368
- changeInteractiveEnabled: h,
369
- changeEditableEnabled: g,
370
- onChange: s,
375
+ bandWidth: T,
376
+ barWidth: D,
377
+ rotate: O,
378
+ top: l,
379
+ defineChart: u,
380
+ chartingOptions: d,
381
+ autoFocus: g,
382
+ onAutoFocusUsed: _,
383
+ error: v,
384
+ onChangeCategory: s,
385
+ changeInteractiveEnabled: f,
386
+ changeEditableEnabled: p,
387
+ onChange: a,
371
388
  graphProps: n,
372
389
  x: e.x,
373
390
  y: e.y,
374
391
  formattedValue: e.formattedValue,
375
- showCorrectness: x,
376
- language: S
392
+ showCorrectness: y,
393
+ language: b
377
394
  }),
378
- autoFocus: v,
379
- onAutoFocusUsed: y
395
+ autoFocus: g,
396
+ onAutoFocusUsed: _
380
397
  })] });
381
398
  }
382
399
  };
383
400
  //#endregion
384
- export { A as RawChartAxes, A as default, k as TickComponent };
401
+ export { j as RawChartAxes, j as default, A as TickComponent };
@@ -8,8 +8,8 @@ import s from "prop-types";
8
8
  import { styled as c } from "@mui/material/styles";
9
9
  import l from "debug";
10
10
  import { types as u } from "@pie-lib/plot";
11
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
12
- import { color as m } from "@pie-lib/render-ui";
11
+ import { color as d } from "@pie-lib/render-ui";
12
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
13
13
  //#region src/bars/common/bars.tsx
14
14
  var h = l("pie-lib:chart:bars"), g = [
15
15
  "#006699",
@@ -37,7 +37,7 @@ var h = l("pie-lib:chart:bars"), g = [
37
37
  "#167A7A",
38
38
  "#91862D",
39
39
  "#894A65"
40
- ], v = (e, t, n, r, i) => e && t && i ? r[n % r.length] : e && i ? m.visualElementsColors.ROLLOVER_FILL_BAR_COLOR : t || null, y = c(t)(() => ({ fill: m.defaults.TERTIARY })), b = class extends o.Component {
40
+ ], v = (e, t, n, r, i) => e && t && i ? r[n % r.length] : e && i ? d.visualElementsColors.ROLLOVER_FILL_BAR_COLOR : t || null, y = c(t)(() => ({ fill: d.defaults.TERTIARY })), b = class extends o.Component {
41
41
  static propTypes = {
42
42
  barColor: s.string,
43
43
  onChangeCategory: s.func,
@@ -90,14 +90,14 @@ var h = l("pie-lib:chart:bars"), g = [
90
90
  };
91
91
  render() {
92
92
  let { graphProps: e, value: t, label: o, xBand: s, index: c, interactive: l, correctness: u, barColor: h, defineChart: g, correctData: b } = this.props, { scale: x, range: S } = e, { dragValue: C, isHovered: w } = this.state, T = v(w, h, c, _, l && !u), E = Number.isFinite(C) ? C : t, D = s.bandwidth(), O = x.y(S.max - E), k = s(n({ label: o }, c)), A = S.max - E, j = S.max - A, M = b ? b.find((e) => e.label === o) : null, N = l ? r : i, P = !!h;
93
- return /* @__PURE__ */ p("g", {
93
+ return /* @__PURE__ */ m("g", {
94
94
  ref: (e) => this.gRef = e,
95
95
  onMouseEnter: this.handleMouseEnter,
96
96
  onMouseLeave: this.handleMouseLeave,
97
97
  onTouchStart: this.handleMouseEnter,
98
98
  onTouchEnd: this.handleMouseLeave,
99
99
  children: [
100
- /* @__PURE__ */ f(y, {
100
+ /* @__PURE__ */ p(y, {
101
101
  x: k,
102
102
  y: x.y(j),
103
103
  width: D,
@@ -107,8 +107,8 @@ var h = l("pie-lib:chart:bars"), g = [
107
107
  u && u.value === "incorrect" && (() => {
108
108
  let e = parseFloat(M && M.value);
109
109
  if (isNaN(e)) return null;
110
- let t = x.y(S.max - e), n = O, r = Math.abs(t - n), i = x.y(e), o = t > n ? m.borderGray() : m.defaults.WHITE, s = t > n ? i : i - r;
111
- return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(y, {
110
+ let t = x.y(S.max - e), n = O, r = Math.abs(t - n), i = x.y(e), o = t > n ? d.borderGray() : d.defaults.WHITE, s = t > n ? i : i - r;
111
+ return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(y, {
112
112
  x: k + 2,
113
113
  y: s,
114
114
  width: D - 4,
@@ -119,15 +119,15 @@ var h = l("pie-lib:chart:bars"), g = [
119
119
  strokeDasharray: "5,2",
120
120
  fill: "none"
121
121
  }
122
- }), /* @__PURE__ */ f("foreignObject", {
122
+ }), /* @__PURE__ */ p("foreignObject", {
123
123
  x: k + D - (P ? 24 : 14),
124
124
  y: i - 12,
125
125
  width: 24,
126
126
  height: 24,
127
- children: /* @__PURE__ */ f(a, { dashColor: o })
127
+ children: /* @__PURE__ */ p(a, { dashColor: o })
128
128
  })] });
129
129
  })(),
130
- /* @__PURE__ */ f(N, {
130
+ /* @__PURE__ */ p(N, {
131
131
  x: k,
132
132
  y: E,
133
133
  defineChart: g,
@@ -155,7 +155,7 @@ var h = l("pie-lib:chart:bars"), g = [
155
155
  };
156
156
  render() {
157
157
  let { data: t, graphProps: n, xBand: r, onChangeCategory: i, defineChart: a, histogram: o, correctData: s } = this.props;
158
- return /* @__PURE__ */ f(e, { children: (t || []).map((e, t) => /* @__PURE__ */ f(x, {
158
+ return /* @__PURE__ */ p(e, { children: (t || []).map((e, t) => /* @__PURE__ */ p(x, {
159
159
  value: e.value,
160
160
  interactive: a || e.interactive,
161
161
  defineChart: a,