@pie-lib/charting 8.0.2-next.20261007003844 → 8.0.2-next.20261007021359

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 (2) hide show
  1. package/dist/mark-label.js +48 -47
  2. package/package.json +5 -4
@@ -8,12 +8,13 @@ import { types as d } from "@pie-lib/plot";
8
8
  import { color as f } from "@pie-lib/render-ui";
9
9
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
10
10
  import { renderMath as h } from "@pie-element/shared-math-rendering-mathjax";
11
+ import { sanitizeModelHtml as g } from "@pie-element/shared-utils";
11
12
  //#region src/mark-label.tsx
12
- var g = u("div")({
13
+ var _ = u("div")({
13
14
  display: "flex",
14
15
  flexDirection: "column",
15
16
  alignItems: "center"
16
- }), _ = f.disabledText();
17
+ }), v = f.disabledText();
17
18
  u("input")(({ theme: e }) => ({
18
19
  float: "right",
19
20
  fontFamily: e.typography.fontFamily,
@@ -24,7 +25,7 @@ u("input")(({ theme: e }) => ({
24
25
  "&.disabledMarkLabel": { backgroundColor: "transparent !important" },
25
26
  "&.error": { border: `2px solid ${e.palette.error.main}` }
26
27
  }));
27
- var v = u("div")(({ theme: e }) => ({
28
+ var y = u("div")(({ theme: e }) => ({
28
29
  pointerEvents: "auto",
29
30
  textAlign: "center",
30
31
  fontSize: e.typography.fontSize + 2,
@@ -33,7 +34,7 @@ var v = u("div")(({ theme: e }) => ({
33
34
  paddingTop: e.typography.fontSize / 2,
34
35
  "&.disabledMarkLabel": {
35
36
  ...r("color"),
36
- color: _,
37
+ color: v,
37
38
  backgroundColor: "transparent !important"
38
39
  },
39
40
  "&.error": { border: `2px solid ${e.palette.error.main}` },
@@ -44,68 +45,68 @@ var v = u("div")(({ theme: e }) => ({
44
45
  outlineOffset: "2px"
45
46
  }
46
47
  }));
47
- function y(e) {
48
+ function b(e) {
48
49
  let t = e?.trim() || "";
49
50
  return (/* @__PURE__ */ new RegExp(/^[1-9]*[0-9]*\s?[1-9][0-9]*\/[1-9][0-9]*$/)).test(t);
50
51
  }
51
- function b(e) {
52
+ function x(e) {
52
53
  let t = e?.trim() || "", n, r = "", i = t.split(" ");
53
54
  n = i[1] && i[1].includes("/") ? i[1].split("/") || "" : t?.split("/") || "";
54
55
  let a;
55
- if (y(e)) return i[0] && i[1] && (r = i[0]), a = `\\(${r}\\frac{${n[0]}}{${n[1]}}\\)`, a;
56
+ if (b(e)) return i[0] && i[1] && (r = i[0]), a = `\\(${r}\\frac{${n[0]}}{${n[1]}}\\)`, a;
56
57
  }
57
- var x = (n) => {
58
- let [r, i] = c(null), l = a((e) => i(e), null), { mark: u = {}, disabled: d, inputRef: f, barWidth: y, rotate: x, correctness: S, autoFocus: C, error: w, isHiddenLabel: T, limitCharacters: E, correctnessIndicator: D, ariaLabel: O, mathAriaLabel: k } = n, [A, j] = c(u.label), [M, N] = c(b(u.label)), [P, F] = c(!1), I = s(null), L = (e) => {
59
- E && e.target.value && e.target.value.length > 20 || j(e.target.value);
60
- }, R = () => P === !1 && M !== void 0, z = () => F(!0), B = (e) => {
61
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), z());
62
- }, V = (e) => {
63
- N(b(u.label)), F(!1), n.onChange(e.target.value);
64
- }, H = {};
65
- return x && (H = {
58
+ var S = (n) => {
59
+ let [r, i] = c(null), l = a((e) => i(e), null), { mark: u = {}, disabled: d, inputRef: f, barWidth: b, rotate: S, correctness: C, autoFocus: w, error: T, isHiddenLabel: E, limitCharacters: D, correctnessIndicator: O, ariaLabel: k, mathAriaLabel: A } = n, [j, M] = c(u.label), [N, P] = c(x(u.label)), [F, I] = c(!1), L = s(null), R = (e) => {
60
+ D && e.target.value && e.target.value.length > 20 || M(e.target.value);
61
+ }, z = () => F === !1 && N !== void 0, B = () => I(!0), V = (e) => {
62
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), B());
63
+ }, H = (e) => {
64
+ P(x(u.label)), I(!1), n.onChange(e.target.value);
65
+ }, U = {};
66
+ return S && (U = {
66
67
  width: "unset",
67
68
  textAlign: "left"
68
69
  }), o(() => {
69
- j(u.label);
70
+ M(u.label);
70
71
  }, [u.label]), o(() => {
71
- let e = I.current;
72
- e && M && (e.innerHTML = M, h(e));
73
- }, [A, M]), /* @__PURE__ */ m(g, { children: [D, R() ? /* @__PURE__ */ p(v, {
72
+ let e = L.current;
73
+ e && N && (e.innerHTML = g(N), h(e));
74
+ }, [j, N]), /* @__PURE__ */ m(_, { children: [O, z() ? /* @__PURE__ */ p(y, {
74
75
  ref: (e) => {
75
- I.current = e, typeof f == "function" && f(e);
76
+ L.current = e, typeof f == "function" && f(e);
76
77
  },
77
78
  className: e({
78
79
  disabledMarkLabel: d,
79
- error: w,
80
- correct: u.editable && S?.label === "correct",
81
- incorrect: u.editable && S?.label === "incorrect"
80
+ error: T,
81
+ correct: u.editable && C?.label === "correct",
82
+ incorrect: u.editable && C?.label === "incorrect"
82
83
  }),
83
84
  ...!d && {
84
85
  role: "button",
85
86
  tabIndex: 0,
86
- "aria-label": k || O,
87
- onClick: z,
88
- onKeyDown: B
87
+ "aria-label": A || k,
88
+ onClick: B,
89
+ onKeyDown: V
89
90
  },
90
91
  style: {
91
- minWidth: y,
92
+ minWidth: b,
92
93
  position: "fixed",
93
94
  transformOrigin: "left",
94
- transform: `rotate(${x}deg)`,
95
- visibility: T ? "hidden" : "unset",
96
- marginTop: D ? "24px" : "0"
95
+ transform: `rotate(${S}deg)`,
96
+ visibility: E ? "hidden" : "unset",
97
+ marginTop: O ? "24px" : "0"
97
98
  }
98
99
  }) : /* @__PURE__ */ p(t, {
99
100
  inputRef: (e) => {
100
101
  l(e), typeof f == "function" && f(e);
101
102
  },
102
103
  name: "mark-label-input",
103
- "aria-label": O,
104
- autoFocus: P || C,
104
+ "aria-label": k,
105
+ autoFocus: F || w,
105
106
  disabled: d,
106
- inputClassName: e(S && u.editable ? S.label : null, d && "disabledMarkLabel", w && "error"),
107
+ inputClassName: e(C && u.editable ? C.label : null, d && "disabledMarkLabel", T && "error"),
107
108
  inputStyle: {
108
- minWidth: y,
109
+ minWidth: b,
109
110
  textAlign: "center",
110
111
  background: "transparent",
111
112
  boxSizing: "border-box",
@@ -113,28 +114,28 @@ var x = (n) => {
113
114
  paddingRight: 0,
114
115
  border: "none",
115
116
  ...d ? {
116
- color: _,
117
- WebkitTextFillColor: _
117
+ color: v,
118
+ WebkitTextFillColor: v
118
119
  } : {},
119
- ...H
120
+ ...U
120
121
  },
121
- value: A,
122
+ value: j,
122
123
  style: {
123
124
  position: "fixed",
124
125
  pointerEvents: "auto",
125
126
  top: 0,
126
127
  left: 0,
127
- minWidth: y,
128
+ minWidth: b,
128
129
  transformOrigin: "left",
129
- transform: `rotate(${x}deg)`,
130
- visibility: T ? "hidden" : "unset",
131
- marginTop: D ? "24px" : "0"
130
+ transform: `rotate(${S}deg)`,
131
+ visibility: E ? "hidden" : "unset",
132
+ marginTop: O ? "24px" : "0"
132
133
  },
133
- onChange: L,
134
- onBlur: V
134
+ onChange: R,
135
+ onBlur: H
135
136
  })] });
136
137
  };
137
- x.propTypes = {
138
+ S.propTypes = {
138
139
  autoFocus: l.bool,
139
140
  disabled: l.bool,
140
141
  error: l.any,
@@ -155,4 +156,4 @@ x.propTypes = {
155
156
  mathAriaLabel: l.string
156
157
  };
157
158
  //#endregion
158
- export { x as MarkLabel, x as default };
159
+ export { S as MarkLabel, S as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/charting",
3
- "version": "8.0.2-next.20261007003844",
3
+ "version": "8.0.2-next.20261007021359",
4
4
  "description": "charting",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,8 +13,9 @@
13
13
  "@mapbox/point-geometry": "^1.1.0",
14
14
  "@mui/icons-material": "^7.3.4",
15
15
  "@mui/material": "^7.3.4",
16
- "@pie-lib/plot": "5.0.2-next.20261007003844",
17
- "@pie-lib/render-ui": "8.0.2-next.20261007003844",
16
+ "@pie-element/shared-utils": "0.2.0-next.20261007021359",
17
+ "@pie-lib/plot": "5.0.2-next.20261007021359",
18
+ "@pie-lib/render-ui": "8.0.2-next.20261007021359",
18
19
  "@pie-lib/translator": "5.0.2-next.20261006160832",
19
20
  "@visx/axis": "^4.0.0",
20
21
  "@visx/event": "^4.0.0",
@@ -29,7 +30,7 @@
29
30
  "invariant": "^2.2.4",
30
31
  "react-draggable": "^4.7.1",
31
32
  "prop-types": "^15.8.1",
32
- "@pie-lib/config-ui": "14.0.2-next.20261007003844",
33
+ "@pie-lib/config-ui": "14.0.2-next.20261007021359",
33
34
  "@pie-element/shared-math-rendering-mathjax": "0.1.3-next.20261007003844",
34
35
  "@pie-element/shared-lodash": "0.1.3-next.20261006160832",
35
36
  "clsx": "^2.1.1",