@pie-lib/charting 8.0.8-next.20261109082044 → 8.0.8-next.20261109085818

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 {};
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  export declare class ActionsButton extends React.Component {
4
+ /** Re-renders once the language's catalog lands, for an element that did not preload it. */
5
+ relabel: () => void;
4
6
  constructor(props: any);
5
7
  componentWillUnmount(): void;
6
8
  static propTypes: {
@@ -1,15 +1,15 @@
1
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";
2
+ import { catalogs as t } from "./i18n/index.js";
3
+ import n, { useEffect as r, useRef as i } from "react";
4
+ import a from "prop-types";
5
+ import { styled as o } from "@mui/material/styles";
6
+ import { color as s, createUniqueId as c } from "@pie-lib/render-ui";
7
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
8
+ import { renderMath as f } from "@pie-element/shared-math-rendering-mathjax";
9
9
  import p from "@mui/material/Menu";
10
10
  import m from "@mui/material/MenuItem";
11
11
  //#region src/actions-button.tsx
12
- var { translator: h } = f, g = a("div")(() => ({ alignSelf: "flex-end" })), _ = a("button")(({ theme: e }) => ({
12
+ var h = o("div")(() => ({ alignSelf: "flex-end" })), g = o("button")(({ theme: e }) => ({
13
13
  display: "block",
14
14
  margin: 0,
15
15
  border: 0,
@@ -17,25 +17,26 @@ var { translator: h } = f, g = a("div")(() => ({ alignSelf: "flex-end" })), _ =
17
17
  font: "inherit",
18
18
  cursor: "pointer",
19
19
  fontSize: e.typography.fontSize,
20
- color: o.defaults.TERTIARY,
20
+ color: s.defaults.TERTIARY,
21
21
  padding: e.spacing(1),
22
22
  "&:focus-visible": {
23
- outline: `2px solid ${o.focusOutline()}`,
23
+ outline: `2px solid ${s.focusOutline()}`,
24
24
  outlineOffset: "-2px"
25
25
  }
26
- })), v = a(m)(({ theme: e }) => ({
26
+ })), _ = o(m)(({ theme: e }) => ({
27
27
  fontSize: e.typography.fontSize,
28
- color: o.defaults.TEXT
29
- })), y = ({ math: e }) => {
30
- let t = r(null);
31
- return n(() => {
28
+ color: s.defaults.TEXT
29
+ })), v = ({ math: e }) => {
30
+ let t = i(null);
31
+ return r(() => {
32
32
  let n = t.current;
33
- n && (n.textContent = e, d(n));
34
- }, [e]), /* @__PURE__ */ l("span", {
33
+ n && (n.textContent = e, f(n));
34
+ }, [e]), /* @__PURE__ */ u("span", {
35
35
  ref: t,
36
36
  style: { pointerEvents: "none" }
37
37
  });
38
- }, b = class extends t.Component {
38
+ }, y = class extends n.Component {
39
+ relabel = () => this.forceUpdate();
39
40
  constructor(e) {
40
41
  super(e), this.state = { actionsAnchorEl: null };
41
42
  }
@@ -43,13 +44,13 @@ var { translator: h } = f, g = a("div")(() => ({ alignSelf: "flex-end" })), _ =
43
44
  this.setState({ actionsAnchorEl: null });
44
45
  }
45
46
  static propTypes = {
46
- addCategory: i.func.isRequired,
47
- deleteCategory: i.func.isRequired,
48
- language: i.string,
49
- categories: i.array
47
+ addCategory: a.func.isRequired,
48
+ deleteCategory: a.func.isRequired,
49
+ language: a.string,
50
+ categories: a.array
50
51
  };
51
- triggerId = s("chart-actions");
52
- menuId = s("chart-actions-menu");
52
+ triggerId = c("chart-actions");
53
+ menuId = c("chart-actions-menu");
53
54
  handleActionsClick = (e) => {
54
55
  this.setState({ actionsAnchorEl: e.currentTarget });
55
56
  };
@@ -65,22 +66,22 @@ var { translator: h } = f, g = a("div")(() => ({ alignSelf: "flex-end" })), _ =
65
66
  t(e), this.handleActionsClose();
66
67
  };
67
68
  render() {
68
- let { categories: t, language: n } = this.props, { actionsAnchorEl: r } = this.state, i = !!r, a = (t || []).map((e, t) => ({
69
+ let { categories: n, language: r } = this.props, { actionsAnchorEl: i } = this.state, a = !!i, o = t.forLocale(r, this.relabel), s = (n || []).map((e, t) => ({
69
70
  category: e,
70
71
  index: t
71
72
  })).filter(({ category: e }) => e.deletable && !e.correctness);
72
- return /* @__PURE__ */ u(g, { children: [/* @__PURE__ */ l(_, {
73
+ return /* @__PURE__ */ d(h, { children: [/* @__PURE__ */ u(g, {
73
74
  type: "button",
74
75
  id: this.triggerId,
75
76
  "aria-haspopup": "menu",
76
- "aria-expanded": i,
77
- "aria-controls": i ? this.menuId : void 0,
77
+ "aria-expanded": a,
78
+ "aria-controls": a ? this.menuId : void 0,
78
79
  onClick: this.handleActionsClick,
79
- children: h.t("charting.actions", { lng: n })
80
- }), /* @__PURE__ */ u(p, {
80
+ children: o.t("actions")
81
+ }), /* @__PURE__ */ d(p, {
81
82
  id: this.menuId,
82
- open: i,
83
- anchorEl: r,
83
+ open: a,
84
+ anchorEl: i,
84
85
  onClose: this.handleActionsClose,
85
86
  variant: "menu",
86
87
  anchorOrigin: {
@@ -92,23 +93,23 @@ var { translator: h } = f, g = a("div")(() => ({ alignSelf: "flex-end" })), _ =
92
93
  horizontal: "left"
93
94
  },
94
95
  slotProps: { list: { "aria-labelledby": this.triggerId } },
95
- children: [/* @__PURE__ */ u(v, {
96
+ children: [/* @__PURE__ */ d(_, {
96
97
  onClick: () => this.handleAddCategory(),
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 }),
98
+ children: ["+ ", o.t("add")]
99
+ }), s.map(({ category: t, index: n }) => {
100
+ let r = o.t("delete"), i = e(t.label), a = t.label || o.t("newLabel");
101
+ return /* @__PURE__ */ u(_, {
102
+ "aria-label": i ? `${r} <${t.label.trim()}>` : void 0,
103
+ onClick: () => this.handleDeleteCategory(n),
104
+ children: i ? /* @__PURE__ */ d(l, { children: [
105
+ `${r} <`,
106
+ /* @__PURE__ */ u(v, { math: i }),
106
107
  ">"
107
- ] }) : `${i} <${o}>`
108
- }, r);
108
+ ] }) : `${r} <${a}>`
109
+ }, n);
109
110
  })]
110
111
  })] });
111
112
  }
112
113
  };
113
114
  //#endregion
114
- export { b as ActionsButton, b as default };
115
+ export { y as ActionsButton, y as default };
package/dist/axes.d.ts CHANGED
@@ -5,6 +5,8 @@ export declare class TickComponent extends React.Component {
5
5
  defineChart: PropTypes.Requireable<boolean>;
6
6
  error: PropTypes.Requireable<any>;
7
7
  };
8
+ /** Re-renders once the language's catalog lands, for an element that did not preload it. */
9
+ relabel: () => void;
8
10
  constructor(props: any);
9
11
  componentDidUpdate(prevProps: any): void;
10
12
  handleAlertDialog: (open: any, callback: any) => void;