@pie-lib/charting 8.0.8-next.20261102105711 → 8.0.8-next.20261102140134

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.
@@ -1,13 +1,15 @@
1
- import e from "react";
2
- import t from "prop-types";
3
- import { styled as n } from "@mui/material/styles";
4
- import { color as r, createUniqueId as i } from "@pie-lib/render-ui";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
- import s from "@pie-lib/translator";
7
- import c from "@mui/material/Menu";
8
- import l from "@mui/material/MenuItem";
1
+ import { getLabelMathFormat as e } from "./mark-label.js";
2
+ import t, { useEffect as n, useRef as r } from "react";
3
+ import i from "prop-types";
4
+ import { styled as a } from "@mui/material/styles";
5
+ import { color as o, createUniqueId as s } from "@pie-lib/render-ui";
6
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
7
+ import { renderMath as d } from "@pie-element/shared-math-rendering-mathjax";
8
+ import f from "@pie-lib/translator";
9
+ import p from "@mui/material/Menu";
10
+ import m from "@mui/material/MenuItem";
9
11
  //#region src/actions-button.tsx
10
- var { translator: u } = s, d = n("div")(() => ({ alignSelf: "flex-end" })), f = n("button")(({ theme: e }) => ({
12
+ var { translator: h } = f, g = a("div")(() => ({ alignSelf: "flex-end" })), _ = a("button")(({ theme: e }) => ({
11
13
  display: "block",
12
14
  margin: 0,
13
15
  border: 0,
@@ -15,16 +17,25 @@ var { translator: u } = s, d = n("div")(() => ({ alignSelf: "flex-end" })), f =
15
17
  font: "inherit",
16
18
  cursor: "pointer",
17
19
  fontSize: e.typography.fontSize,
18
- color: r.defaults.TERTIARY,
20
+ color: o.defaults.TERTIARY,
19
21
  padding: e.spacing(1),
20
22
  "&:focus-visible": {
21
- outline: `2px solid ${r.focusOutline()}`,
23
+ outline: `2px solid ${o.focusOutline()}`,
22
24
  outlineOffset: "-2px"
23
25
  }
24
- })), p = n(l)(({ theme: e }) => ({
26
+ })), v = a(m)(({ theme: e }) => ({
25
27
  fontSize: e.typography.fontSize,
26
- color: r.defaults.TEXT
27
- })), m = class extends e.Component {
28
+ color: o.defaults.TEXT
29
+ })), y = ({ math: e }) => {
30
+ let t = r(null);
31
+ return n(() => {
32
+ let n = t.current;
33
+ n && (n.textContent = e, d(n));
34
+ }, [e]), /* @__PURE__ */ l("span", {
35
+ ref: t,
36
+ style: { pointerEvents: "none" }
37
+ });
38
+ }, b = class extends t.Component {
28
39
  constructor(e) {
29
40
  super(e), this.state = { actionsAnchorEl: null };
30
41
  }
@@ -32,13 +43,13 @@ var { translator: u } = s, d = n("div")(() => ({ alignSelf: "flex-end" })), f =
32
43
  this.setState({ actionsAnchorEl: null });
33
44
  }
34
45
  static propTypes = {
35
- addCategory: t.func.isRequired,
36
- deleteCategory: t.func.isRequired,
37
- language: t.string,
38
- categories: t.array
46
+ addCategory: i.func.isRequired,
47
+ deleteCategory: i.func.isRequired,
48
+ language: i.string,
49
+ categories: i.array
39
50
  };
40
- triggerId = i("chart-actions");
41
- menuId = i("chart-actions-menu");
51
+ triggerId = s("chart-actions");
52
+ menuId = s("chart-actions-menu");
42
53
  handleActionsClick = (e) => {
43
54
  this.setState({ actionsAnchorEl: e.currentTarget });
44
55
  };
@@ -54,22 +65,22 @@ var { translator: u } = s, d = n("div")(() => ({ alignSelf: "flex-end" })), f =
54
65
  t(e), this.handleActionsClose();
55
66
  };
56
67
  render() {
57
- let { categories: e, language: t } = this.props, { actionsAnchorEl: n } = this.state, r = !!n, i = (e || []).map((e, t) => ({
68
+ let { categories: t, language: n } = this.props, { actionsAnchorEl: r } = this.state, i = !!r, a = (t || []).map((e, t) => ({
58
69
  category: e,
59
70
  index: t
60
71
  })).filter(({ category: e }) => e.deletable && !e.correctness);
61
- return /* @__PURE__ */ o(d, { children: [/* @__PURE__ */ a(f, {
72
+ return /* @__PURE__ */ u(g, { children: [/* @__PURE__ */ l(_, {
62
73
  type: "button",
63
74
  id: this.triggerId,
64
75
  "aria-haspopup": "menu",
65
- "aria-expanded": r,
66
- "aria-controls": r ? this.menuId : void 0,
76
+ "aria-expanded": i,
77
+ "aria-controls": i ? this.menuId : void 0,
67
78
  onClick: this.handleActionsClick,
68
- children: u.t("charting.actions", { lng: t })
69
- }), /* @__PURE__ */ o(c, {
79
+ children: h.t("charting.actions", { lng: n })
80
+ }), /* @__PURE__ */ u(p, {
70
81
  id: this.menuId,
71
- open: r,
72
- anchorEl: n,
82
+ open: i,
83
+ anchorEl: r,
73
84
  onClose: this.handleActionsClose,
74
85
  variant: "menu",
75
86
  anchorOrigin: {
@@ -81,15 +92,23 @@ var { translator: u } = s, d = n("div")(() => ({ alignSelf: "flex-end" })), f =
81
92
  horizontal: "left"
82
93
  },
83
94
  slotProps: { list: { "aria-labelledby": this.triggerId } },
84
- children: [/* @__PURE__ */ o(p, {
95
+ children: [/* @__PURE__ */ u(v, {
85
96
  onClick: () => this.handleAddCategory(),
86
- children: ["+ ", u.t("charting.add", { lng: t })]
87
- }), i.map(({ category: e, index: n }) => /* @__PURE__ */ a(p, {
88
- onClick: () => this.handleDeleteCategory(n),
89
- children: `${u.t("charting.delete", { lng: t })} <${e.label || u.t("charting.newLabel", { lng: t })}>`
90
- }, n))]
97
+ children: ["+ ", h.t("charting.add", { lng: n })]
98
+ }), a.map(({ category: t, index: r }) => {
99
+ let i = h.t("charting.delete", { lng: n }), a = e(t.label), o = t.label || h.t("charting.newLabel", { lng: n });
100
+ return /* @__PURE__ */ l(v, {
101
+ "aria-label": a ? `${i} <${t.label.trim()}>` : void 0,
102
+ onClick: () => this.handleDeleteCategory(r),
103
+ children: a ? /* @__PURE__ */ u(c, { children: [
104
+ `${i} <`,
105
+ /* @__PURE__ */ l(y, { math: a }),
106
+ ">"
107
+ ] }) : `${i} <${o}>`
108
+ }, r);
109
+ })]
91
110
  })] });
92
111
  }
93
112
  };
94
113
  //#endregion
95
- export { m as ActionsButton, m as default };
114
+ export { b as ActionsButton, b as default };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ export declare function getLabelMathFormat(label: any): string | undefined;
3
4
  export declare const MarkLabel: {
4
5
  (props: any): React.JSX.Element;
5
6
  propTypes: {
@@ -162,4 +162,4 @@ w.propTypes = {
162
162
  mathAriaLabel: l.string
163
163
  };
164
164
  //#endregion
165
- export { w as MarkLabel, w as default };
165
+ export { w as MarkLabel, w as default, C as getLabelMathFormat };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/charting",
3
- "version": "8.0.8-next.20261102105711",
3
+ "version": "8.0.8-next.20261102140134",
4
4
  "description": "charting",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  "@mui/icons-material": "^7.3.4",
15
15
  "@mui/material": "^7.3.4",
16
16
  "@pie-element/shared-utils": "0.1.7-next.20261027193325",
17
- "@pie-lib/plot": "5.0.8-next.20261102105711",
17
+ "@pie-lib/plot": "5.0.8-next.20261102140134",
18
18
  "@pie-lib/render-ui": "8.0.8-next.20261027193325",
19
19
  "@pie-lib/translator": "5.0.3-next.20261027184745",
20
20
  "@visx/axis": "^4.0.0",
@@ -30,7 +30,7 @@
30
30
  "invariant": "^2.2.4",
31
31
  "react-draggable": "^4.7.2",
32
32
  "prop-types": "^15.8.1",
33
- "@pie-lib/config-ui": "14.0.8-next.20261102105711",
33
+ "@pie-lib/config-ui": "14.0.8-next.20261102140134",
34
34
  "@pie-element/shared-math-rendering-mathjax": "0.1.9-next.20261026200905",
35
35
  "@pie-element/shared-lodash": "0.1.4-next.20261026212738",
36
36
  "clsx": "^2.1.1",