@pie-lib/charting 8.0.0-next.35 → 8.0.0-next.36

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