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

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 {};
@@ -44,11 +44,13 @@ export declare class RawBar extends React.Component {
44
44
  };
45
45
  constructor(props: any);
46
46
  componentDidMount(): void;
47
+ componentDidUpdate(prevProps: any): void;
47
48
  componentWillUnmount(): void;
48
49
  handleMouseMove: any;
49
50
  isMouseInsideSvgElement: any;
50
- handleMouseEnter: () => void;
51
- handleMouseLeave: () => void;
51
+ handleMouseEnter: () => any;
52
+ handleMouseLeave: () => any;
53
+ dragStart: any;
52
54
  setDragValue: (dragValue: any) => void;
53
55
  changeValue: any;
54
56
  dragStop: any;
@@ -2,17 +2,18 @@ import e from "../../node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_m
2
2
  import t from "../../node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/Bar.js";
3
3
  import { bandKey as n } from "../../utils.js";
4
4
  import { D as r, DragHandle as i } from "../../common/drag-handle.js";
5
- import { MarkSlider as a } from "../../common/mark-slider.js";
6
- import { CorrectCheckIcon as o } from "./correct-check-icon.js";
7
- import s from "react";
8
- import c from "prop-types";
9
- import { styled as l } from "@mui/material/styles";
10
- import u from "debug";
11
- import { types as d } from "@pie-lib/plot";
12
- import { color as f } from "@pie-lib/render-ui";
13
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
5
+ import { DragHover as a } from "../../common/drag-hover.js";
6
+ import { MarkSlider as o } from "../../common/mark-slider.js";
7
+ import { CorrectCheckIcon as s } from "./correct-check-icon.js";
8
+ import c from "react";
9
+ import l from "prop-types";
10
+ import { styled as u } from "@mui/material/styles";
11
+ import d from "debug";
12
+ import { types as f } from "@pie-lib/plot";
13
+ import { color as p } from "@pie-lib/render-ui";
14
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
14
15
  //#region src/bars/common/bars.tsx
15
- var g = u("pie-lib:chart:bars"), _ = [
16
+ var _ = d("pie-lib:chart:bars"), v = [
16
17
  "#006699",
17
18
  "#F59B00",
18
19
  "#08916D",
@@ -25,7 +26,7 @@ var g = u("pie-lib:chart:bars"), _ = [
25
26
  "#4FD2D2",
26
27
  "#F0E442",
27
28
  "#E287B2"
28
- ], v = [
29
+ ], y = [
29
30
  "#003754",
30
31
  "#975616",
31
32
  "#00503B",
@@ -38,48 +39,50 @@ var g = u("pie-lib:chart:bars"), _ = [
38
39
  "#167A7A",
39
40
  "#91862D",
40
41
  "#894A65"
41
- ], y = (e, t, n, r, i) => e && t && i ? r[n % r.length] : e && i ? f.visualElementsColors.ROLLOVER_FILL_BAR_COLOR : t || null, b = l(t)(() => ({ fill: f.defaults.TERTIARY })), x = 10, S = class extends s.Component {
42
+ ], b = (e, t, n, r, i) => e && t && i ? r[n % r.length] : e && i ? p.visualElementsColors.ROLLOVER_FILL_BAR_COLOR : t || null, x = u(t)(() => ({ fill: p.defaults.TERTIARY })), S = 10, C = class extends c.Component {
42
43
  static propTypes = {
43
- barColor: c.string,
44
- onChangeCategory: c.func,
45
- value: c.number,
46
- label: c.string,
47
- xBand: c.func,
48
- index: c.number.isRequired,
49
- graphProps: d.GraphPropsType.isRequired,
50
- interactive: c.bool,
51
- disabled: c.bool,
52
- correctness: c.shape({
53
- value: c.string,
54
- label: c.string
44
+ barColor: l.string,
45
+ onChangeCategory: l.func,
46
+ value: l.number,
47
+ label: l.string,
48
+ xBand: l.func,
49
+ index: l.number.isRequired,
50
+ graphProps: f.GraphPropsType.isRequired,
51
+ interactive: l.bool,
52
+ disabled: l.bool,
53
+ correctness: l.shape({
54
+ value: l.string,
55
+ label: l.string
55
56
  }),
56
- correctData: c.array,
57
- defineChart: c.bool,
58
- language: c.string
57
+ correctData: l.array,
58
+ defineChart: l.bool,
59
+ language: l.string
59
60
  };
60
61
  constructor(e) {
61
62
  super(e), this.state = {
62
63
  dragValue: void 0,
63
64
  isHovered: !1
64
- }, this.mouseX = 0, this.mouseY = 0;
65
+ }, this.hover = new a((e) => this.setState({ isHovered: e })), this.mouseX = 0, this.mouseY = 0;
65
66
  }
66
67
  componentDidMount() {
67
- window.addEventListener("mousemove", this.handleMouseMove);
68
+ this.hover.attach(), window.addEventListener("mousemove", this.handleMouseMove);
69
+ }
70
+ componentDidUpdate(e) {
71
+ this.props.disabled && !e.disabled && (this.hover.stop(), this.setDragValue(void 0));
68
72
  }
69
73
  componentWillUnmount() {
70
- window.removeEventListener("mousemove", this.handleMouseMove);
74
+ window.removeEventListener("mousemove", this.handleMouseMove), this.hover.dispose();
71
75
  }
72
76
  handleMouseMove = (e) => {
73
- this.mouseX = e.clientX, this.mouseY = e.clientY;
74
- let t = this.isMouseInsideSvgElement();
75
- this.setState({ isHovered: t });
77
+ this.mouseX = e.clientX, this.mouseY = e.clientY, this.hover.setInside(this.isMouseInsideSvgElement());
76
78
  };
77
79
  isMouseInsideSvgElement = () => {
78
80
  let e = this.gRef.getBoundingClientRect();
79
81
  return this.mouseX >= e.left && this.mouseX <= e.right && this.mouseY >= e.top && this.mouseY <= e.bottom;
80
82
  };
81
- handleMouseEnter = () => this.setState({ isHovered: !0 });
82
- handleMouseLeave = () => this.setState({ isHovered: !1 });
83
+ handleMouseEnter = () => this.hover.setInside(!0);
84
+ handleMouseLeave = () => this.hover.setInside(!1);
85
+ dragStart = () => this.hover.start();
83
86
  setDragValue = (e) => this.setState({ dragValue: e });
84
87
  changeValue = (e) => {
85
88
  let { label: t, onChangeCategory: n } = this.props;
@@ -89,48 +92,48 @@ var g = u("pie-lib:chart:bars"), _ = [
89
92
  });
90
93
  };
91
94
  dragStop = () => {
92
- let { dragValue: e } = this.state;
93
- g("[dragStop]", e), e !== void 0 && this.changeValue(e), this.setDragValue(void 0);
95
+ let { dragValue: e } = this.state, { disabled: t } = this.props;
96
+ _("[dragStop]", e), e !== void 0 && !t && this.changeValue(e), this.setDragValue(void 0), this.hover.stop();
94
97
  };
95
98
  dragValue = (e, t) => {
96
- g("[dragValue] next:", t), this.setDragValue(t);
99
+ _("[dragValue] next:", t), this.setDragValue(t);
97
100
  };
98
101
  render() {
99
- let { graphProps: e, value: t, label: s, xBand: c, index: l, interactive: u, disabled: d, correctness: g, barColor: _, defineChart: S, correctData: C, language: w } = this.props, { scale: T, range: E } = e, { dragValue: D, isHovered: O } = this.state, k = y(O, _, l, v, u && !g), A = Number.isFinite(D) ? D : t, j = c.bandwidth(), M = T.y(E.max - A), N = c(n({ label: s }, l)), P = E.max - A, F = E.max - P, I = C ? C.find((e) => e.label === s) : null, L = u ? r : i, R = !!_;
100
- return /* @__PURE__ */ h(a, {
102
+ let { graphProps: e, value: t, label: a, xBand: c, index: l, interactive: u, disabled: d, correctness: f, barColor: _, defineChart: v, correctData: C, language: w } = this.props, { scale: T, range: E } = e, { dragValue: D, isHovered: O } = this.state, k = b(O, _, l, y, u && !f), A = Number.isFinite(D) ? D : t, j = c.bandwidth(), M = T.y(E.max - A), N = c(n({ label: a }, l)), P = E.max - A, F = E.max - P, I = C ? C.find((e) => e.label === a) : null, L = u ? r : i, R = !!_;
103
+ return /* @__PURE__ */ g(o, {
101
104
  ref: (e) => this.gRef = e,
102
105
  onMouseEnter: this.handleMouseEnter,
103
106
  onMouseLeave: this.handleMouseLeave,
104
107
  onTouchStart: this.handleMouseEnter,
105
108
  onTouchEnd: this.handleMouseLeave,
106
109
  enabled: u && !d,
107
- label: s,
110
+ label: a,
108
111
  index: l,
109
112
  value: A,
110
113
  graphProps: e,
111
114
  language: w,
112
115
  focusBox: {
113
116
  x: N,
114
- y: T.y(F) - x,
117
+ y: T.y(F) - S,
115
118
  width: j,
116
- height: Math.max(0, M) + x
119
+ height: Math.max(0, M) + S
117
120
  },
118
121
  onChange: this.changeValue,
119
122
  children: [
120
- /* @__PURE__ */ m(b, {
123
+ /* @__PURE__ */ h(x, {
121
124
  x: N,
122
125
  y: T.y(F),
123
126
  width: j,
124
127
  height: M,
125
128
  style: { fill: k }
126
129
  }),
127
- g && g.value === "incorrect" && (() => {
130
+ f && f.value === "incorrect" && (() => {
128
131
  let e = parseFloat(I && I.value);
129
132
  if (isNaN(e)) return null;
130
- let t = T.y(E.max - e), n = M, r = Math.abs(t - n), i = T.y(e), a = t > n ? f.borderGray() : f.defaults.WHITE, s = t > n ? i : i - r;
131
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(b, {
133
+ let t = T.y(E.max - e), n = M, r = Math.abs(t - n), i = T.y(e), a = t > n ? p.borderGray() : p.defaults.WHITE, o = t > n ? i : i - r;
134
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(x, {
132
135
  x: N + 2,
133
- y: s,
136
+ y: o,
134
137
  width: j - 4,
135
138
  height: r,
136
139
  style: {
@@ -139,45 +142,46 @@ var g = u("pie-lib:chart:bars"), _ = [
139
142
  strokeDasharray: "5,2",
140
143
  fill: "none"
141
144
  }
142
- }), /* @__PURE__ */ m("foreignObject", {
145
+ }), /* @__PURE__ */ h("foreignObject", {
143
146
  x: N + j - (R ? 24 : 14),
144
147
  y: i - 12,
145
148
  width: 24,
146
149
  height: 24,
147
- children: /* @__PURE__ */ m(o, { dashColor: a })
150
+ children: /* @__PURE__ */ h(s, { dashColor: a })
148
151
  })] });
149
152
  })(),
150
- /* @__PURE__ */ m(L, {
153
+ /* @__PURE__ */ h(L, {
151
154
  x: N,
152
155
  y: A,
153
- defineChart: S,
156
+ defineChart: v,
154
157
  interactive: u,
155
158
  disabled: d,
156
159
  width: j,
160
+ onDragStart: this.dragStart,
157
161
  onDrag: (e) => this.dragValue(t, e),
158
162
  onDragStop: this.dragStop,
159
163
  graphProps: e,
160
- correctness: g,
164
+ correctness: f,
161
165
  isHovered: O,
162
166
  color: k
163
167
  })
164
168
  ]
165
169
  });
166
170
  }
167
- }, C = S, w = class extends s.Component {
171
+ }, w = C, T = class extends c.Component {
168
172
  static propTypes = {
169
- data: c.array,
170
- correctData: c.array,
171
- onChangeCategory: c.func,
172
- defineChart: c.bool,
173
- xBand: c.func,
174
- graphProps: d.GraphPropsType.isRequired,
175
- histogram: c.bool,
176
- language: c.string
173
+ data: l.array,
174
+ correctData: l.array,
175
+ onChangeCategory: l.func,
176
+ defineChart: l.bool,
177
+ xBand: l.func,
178
+ graphProps: f.GraphPropsType.isRequired,
179
+ histogram: l.bool,
180
+ language: l.string
177
181
  };
178
182
  render() {
179
183
  let { data: t, graphProps: n, xBand: r, onChangeCategory: i, defineChart: a, histogram: o, correctData: s, disabled: c, language: l } = this.props;
180
- return /* @__PURE__ */ m(e, { children: (t || []).map((e, t) => /* @__PURE__ */ m(C, {
184
+ return /* @__PURE__ */ h(e, { children: (t || []).map((e, t) => /* @__PURE__ */ h(w, {
181
185
  value: e.value,
182
186
  interactive: a || e.interactive,
183
187
  defineChart: a,
@@ -190,9 +194,9 @@ var g = u("pie-lib:chart:bars"), _ = [
190
194
  correctness: e.correctness,
191
195
  correctData: s,
192
196
  language: l,
193
- barColor: o && (_[t] ? _[t] : _[t % _.length])
197
+ barColor: o && (v[t] ? v[t] : v[t % v.length])
194
198
  }, `bar-${e.label}-${t}`)) });
195
199
  }
196
200
  };
197
201
  //#endregion
198
- export { w as Bars, w as default, S as RawBar };
202
+ export { T as Bars, T as default, C as RawBar };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  export declare const DragHandle: {
4
- ({ x, y, width, graphProps, interactive, isHovered, correctness, isPlot, ...rest }: {
4
+ ({ x, y, width, graphProps, interactive, isHovered, correctness, isPlot, isDragging, onDragStart, onDrag, onDragStop, ...rest }: {
5
5
  [x: string]: any;
6
6
  x: any;
7
7
  y: any;
@@ -11,6 +11,10 @@ export declare const DragHandle: {
11
11
  isHovered: any;
12
12
  correctness: any;
13
13
  isPlot: any;
14
+ isDragging: any;
15
+ onDragStart: any;
16
+ onDrag: any;
17
+ onDragStop: any;
14
18
  }): React.JSX.Element;
15
19
  propTypes: {
16
20
  x: PropTypes.Validator<number>;
@@ -52,13 +56,11 @@ export declare const DragHandle: {
52
56
  export declare const D: {
53
57
  new (props: any): {
54
58
  nodeRef: React.RefObject<unknown>;
59
+ isLocked: any;
55
60
  grid: any;
56
61
  onStart: any;
57
62
  position: any;
58
- tiny: any;
59
63
  getScaledBounds: any;
60
- getClientPoint: any;
61
- skipDragOutsideOfBounds: any;
62
64
  onDrag: any;
63
65
  getDelta: any;
64
66
  applyDelta: any;
@@ -85,6 +87,7 @@ export declare const D: {
85
87
  componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
86
88
  UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
87
89
  };
90
+ contextType: React.Context<boolean>;
88
91
  propTypes: {
89
92
  disabled: PropTypes.Requireable<boolean>;
90
93
  onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
@@ -117,6 +120,5 @@ export declare const D: {
117
120
  }>>>;
118
121
  }>>>;
119
122
  };
120
- contextType?: React.Context<any> | undefined;
121
123
  };
122
124
  export default D;
@@ -32,17 +32,17 @@ var f = r("svg")(() => ({ overflow: "visible !important" })), p = r("ellipse")((
32
32
  width: "16px",
33
33
  height: "16px",
34
34
  boxSizing: "unset"
35
- })), g = ({ x: n, y: r, width: i, graphProps: a, interactive: o, isHovered: u, correctness: d, isPlot: g, ..._ }) => {
36
- let { scale: v } = a, y = e(i)?.scale;
35
+ })), g = ({ x: n, y: r, width: i, graphProps: a, interactive: o, isHovered: u, correctness: d, isPlot: g, isDragging: _, onDragStart: v, onDrag: y, onDragStop: b, ...x }) => {
36
+ let { scale: S } = a, C = e(i)?.scale;
37
37
  return /* @__PURE__ */ l(f, {
38
38
  x: n,
39
- y: v.y(r) - 10,
39
+ y: S.y(r) - 10,
40
40
  width: i,
41
41
  overflow: "visible",
42
42
  children: [
43
43
  u && !d && o && /* @__PURE__ */ c(t, {
44
44
  width: i,
45
- scaleValue: y,
45
+ scaleValue: C,
46
46
  color: s.defaults.BORDER_GRAY
47
47
  }),
48
48
  o && !d && /* @__PURE__ */ c(p, {
@@ -50,7 +50,7 @@ var f = r("svg")(() => ({ overflow: "visible !important" })), p = r("ellipse")((
50
50
  cy: 10,
51
51
  rx: i / 2,
52
52
  ry: 66,
53
- ..._
53
+ ...x
54
54
  }),
55
55
  d && o && !g && /* @__PURE__ */ c("foreignObject", {
56
56
  x: i / 2 - 14,
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The hover of one mark. It knows whether the pointer is over the mark and whether the mark is being
3
+ * dragged, and reports `hovered` through `onChange` whenever that changes. It is the one place the rule
4
+ * lives, for function components (`useDragHover`) and class components alike:
5
+ * - a dragged mark is hovered wherever the pointer is
6
+ * - no other mark is hovered while one is dragged
7
+ * - when the drag ends, every mark the pointer is over is hovered again, the dragged one included
8
+ */
9
+ export declare class DragHover {
10
+ private onChange;
11
+ hovered: boolean;
12
+ private inside;
13
+ private dragging;
14
+ private alive;
15
+ constructor(onChange: (hovered: boolean) => void);
16
+ /** Starts listening for other marks' drags. Call it once the mark is mounted. */
17
+ attach(): void;
18
+ /** Stops listening, and ends the drag if the mark is unmounted in the middle of one. */
19
+ dispose(): void;
20
+ /** Whether the pointer is over the mark. Keep it current while dragging: the drop reads it. */
21
+ setInside(inside: boolean): void;
22
+ start(): void;
23
+ stop(): void;
24
+ update(): void;
25
+ }
26
+ /**
27
+ * Hover state for a function-component mark. `isDragging` is the flag gridDraggable passes to the mark
28
+ * it wraps; pass false for a mark that cannot be dragged, so pressing it does not count as a drag.
29
+ */
30
+ export declare const useDragHover: (isDragging: boolean) => {
31
+ hovered: boolean;
32
+ onEnter: () => void;
33
+ onLeave: () => void;
34
+ };
@@ -0,0 +1,44 @@
1
+ import e from "react";
2
+ //#region src/common/drag-hover.ts
3
+ var t = null, n = /* @__PURE__ */ new Set(), r = class {
4
+ onChange;
5
+ hovered = !1;
6
+ inside = !1;
7
+ dragging = !1;
8
+ alive = !1;
9
+ constructor(e) {
10
+ this.onChange = e;
11
+ }
12
+ attach() {
13
+ this.alive = !0, n.add(this);
14
+ }
15
+ dispose() {
16
+ this.stop(), this.alive = !1, n.delete(this);
17
+ }
18
+ setInside(e) {
19
+ this.inside = e, this.update();
20
+ }
21
+ start() {
22
+ this.dragging || (this.dragging = !0, t = this, i());
23
+ }
24
+ stop() {
25
+ this.dragging && (this.dragging = !1, t === this && (t = null), i());
26
+ }
27
+ update() {
28
+ let e = this.dragging || this.inside && (t === null || t === this);
29
+ this.alive && e !== this.hovered && (this.hovered = e, this.onChange(e));
30
+ }
31
+ }, i = () => n.forEach((e) => e.update()), a = (t) => {
32
+ let [n, i] = e.useState(!1), a = e.useRef(null);
33
+ a.current ||= new r(i);
34
+ let o = a.current;
35
+ return e.useEffect(() => (o.attach(), () => o.dispose()), [o]), e.useEffect(() => {
36
+ if (t) return o.start(), () => o.stop();
37
+ }, [t, o]), {
38
+ hovered: t || n,
39
+ onEnter: () => o.setInside(!0),
40
+ onLeave: () => o.setInside(!1)
41
+ };
42
+ };
43
+ //#endregion
44
+ export { r as DragHover, a as useDragHover };
@@ -43,13 +43,11 @@ export declare const DragHandle: typeof RawDragHandle;
43
43
  declare const DraggableHandle: {
44
44
  new (props: any): {
45
45
  nodeRef: React.RefObject<unknown>;
46
+ isLocked: any;
46
47
  grid: any;
47
48
  onStart: any;
48
49
  position: any;
49
- tiny: any;
50
50
  getScaledBounds: any;
51
- getClientPoint: any;
52
- skipDragOutsideOfBounds: any;
53
51
  onDrag: any;
54
52
  getDelta: any;
55
53
  applyDelta: any;
@@ -76,6 +74,7 @@ declare const DraggableHandle: {
76
74
  componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
77
75
  UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
78
76
  };
77
+ contextType: React.Context<boolean>;
79
78
  propTypes: {
80
79
  disabled: PropTypes.Requireable<boolean>;
81
80
  onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
@@ -108,6 +107,5 @@ declare const DraggableHandle: {
108
107
  }>>>;
109
108
  }>>>;
110
109
  };
111
- contextType?: React.Context<any> | undefined;
112
110
  };
113
111
  export default DraggableHandle;
@@ -46,6 +46,7 @@ export declare class RawLine extends React.Component {
46
46
  };
47
47
  constructor(props: any);
48
48
  UNSAFE_componentWillReceiveProps(nextProps: any): void;
49
+ componentDidUpdate(prevProps: any): void;
49
50
  setDragValue: (line: any) => void;
50
51
  dragStop: any;
51
52
  changeValue: any;
@@ -50,11 +50,17 @@ var p = (e, t) => {
50
50
  UNSAFE_componentWillReceiveProps(e) {
51
51
  c(this.props.data, e.data) || this.setState({ line: p(e.data, e.graphProps.domain) });
52
52
  }
53
+ componentDidUpdate(e) {
54
+ this.props.disabled && !e.disabled && this.state.dragging && this.setState({
55
+ dragging: !1,
56
+ line: p(this.props.data, this.props.graphProps.domain)
57
+ });
58
+ }
53
59
  setDragValue = (e) => this.setState({ line: e });
54
60
  dragStop = (e) => {
55
- let { onChange: t } = this.props;
61
+ let { onChange: t, disabled: n } = this.props;
56
62
  this.setState({ dragging: !1 }, () => {
57
- t(e, this.state.line[e]);
63
+ n || t(e, this.state.line[e]);
58
64
  });
59
65
  };
60
66
  changeValue = (e, t, n) => {
@@ -2,8 +2,9 @@ import e from "../node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_modu
2
2
  import t from "../node_modules/.bun/@visx_shape@4.0.0_d84c32d47042070f/node_modules/@visx/shape/esm/shapes/LinePath.js";
3
3
  import { CorrectnessIndicator as n, SmallCorrectPointIndicator as r } from "../common/correctness-indicators.js";
4
4
  import { dataToXBand as i } from "../utils.js";
5
- import { Line as a } from "./common/line.js";
6
- import o, { useState as s } from "react";
5
+ import { useDragHover as a } from "../common/drag-hover.js";
6
+ import { Line as o } from "./common/line.js";
7
+ import s from "react";
7
8
  import c from "prop-types";
8
9
  import { styled as l } from "@mui/material/styles";
9
10
  import { types as u } from "@pie-lib/plot";
@@ -14,7 +15,7 @@ var m = l(t)(() => ({
14
15
  stroke: d.defaults.TEXT,
15
16
  transition: "fill 200ms linear, height 200ms linear",
16
17
  "&.non-interactive": { stroke: d.disabled?.() || "#ccc" }
17
- })), h = l(e)(({ correctness: e, interactive: t }) => ({
18
+ })), h = l(e, { shouldForwardProp: (e) => e !== "correctness" && e !== "interactive" })(({ correctness: e, interactive: t }) => ({
18
19
  stroke: d.defaults.TEXT,
19
20
  transition: "fill 200ms linear, height 200ms linear",
20
21
  ...e && !t && {
@@ -27,7 +28,7 @@ var m = l(t)(() => ({
27
28
  fill: "transparent",
28
29
  stroke: "transparent"
29
30
  })), _ = (e) => {
30
- let { className: t, scale: i, x: a, y: o, r: c, correctness: l, interactive: u, correctData: _, label: v, ...y } = e, [b, x] = s(!1), S = c * 4, C = S / 2, w = i.x(a), T = i.y(o);
31
+ let { className: t, scale: i, x: o, y: s, r: c, correctness: l, interactive: u, correctData: _, label: v, isDragging: y, disabled: b, onDragStart: x, onDrag: S, onDragStop: C, ...w } = e, { hovered: T, onEnter: E, onLeave: D } = a(!!y && !b), O = c * 4, k = O / 2, A = i.x(o), j = i.y(s);
31
32
  return /* @__PURE__ */ p(h, {
32
33
  className: t,
33
34
  correctness: l,
@@ -35,59 +36,59 @@ var m = l(t)(() => ({
35
36
  children: [
36
37
  /* @__PURE__ */ f(m, {
37
38
  data: [{
38
- x: i.x(a) - c,
39
- y: i.y(o) + c
39
+ x: i.x(o) - c,
40
+ y: i.y(s) + c
40
41
  }, {
41
- x: i.x(a) + c,
42
- y: i.y(o) - c
42
+ x: i.x(o) + c,
43
+ y: i.y(s) - c
43
44
  }],
44
45
  x: (e) => e.x,
45
46
  y: (e) => e.y,
46
47
  strokeWidth: 5,
47
48
  style: { pointerEvents: "none" }
48
- }, `point-${a}-${o}-1`),
49
+ }, `point-${o}-${s}-1`),
49
50
  /* @__PURE__ */ f(m, {
50
51
  data: [{
51
- x: i.x(a) - c,
52
- y: i.y(o) - c
52
+ x: i.x(o) - c,
53
+ y: i.y(s) - c
53
54
  }, {
54
- x: i.x(a) + c,
55
- y: i.y(o) + c
55
+ x: i.x(o) + c,
56
+ y: i.y(s) + c
56
57
  }],
57
58
  x: (e) => e.x,
58
59
  y: (e) => e.y,
59
60
  strokeWidth: 5,
60
61
  style: { pointerEvents: "none" }
61
- }, `point-${a}-${o}-2`),
62
- b && /* @__PURE__ */ f("rect", {
63
- x: w - C,
64
- y: T - C,
65
- width: S,
66
- height: S,
62
+ }, `point-${o}-${s}-2`),
63
+ T && /* @__PURE__ */ f("rect", {
64
+ x: A - k,
65
+ y: j - k,
66
+ width: O,
67
+ height: O,
67
68
  stroke: d.defaults.BORDER_GRAY,
68
69
  fill: "none",
69
70
  strokeWidth: 2,
70
71
  pointerEvents: "none"
71
72
  }),
72
73
  /* @__PURE__ */ f(g, {
73
- cx: w,
74
- cy: T,
74
+ cx: A,
75
+ cy: j,
75
76
  r: c * 2,
76
- onMouseEnter: () => x(!0),
77
- onMouseLeave: () => x(!1),
78
- ...y
77
+ onMouseEnter: E,
78
+ onMouseLeave: D,
79
+ ...w
79
80
  }),
80
81
  /* @__PURE__ */ f(n, {
81
82
  scale: i,
82
- x: a,
83
- y: o,
83
+ x: o,
84
+ y: s,
84
85
  r: c,
85
86
  correctness: l,
86
87
  interactive: u
87
88
  }),
88
89
  /* @__PURE__ */ f(r, {
89
90
  scale: i,
90
- x: a,
91
+ x: o,
91
92
  r: c,
92
93
  correctness: l,
93
94
  correctData: _,
@@ -110,15 +111,15 @@ _.propTypes = {
110
111
  correctData: c.array,
111
112
  label: c.string
112
113
  };
113
- var v = class extends o.Component {
114
+ var v = class extends s.Component {
114
115
  static propTypes = {
115
116
  data: c.array,
116
117
  onChange: c.func,
117
118
  graphProps: u.GraphPropsType.isRequired
118
119
  };
119
120
  render() {
120
- let e = this.props, { data: t, graphProps: n } = e, { scale: r = {}, size: o = {} } = n || {}, s = i(r.x, t, o.width, "lineCross");
121
- return /* @__PURE__ */ f(a, {
121
+ let e = this.props, { data: t, graphProps: n } = e, { scale: r = {}, size: a = {} } = n || {}, s = i(r.x, t, a.width, "lineCross");
122
+ return /* @__PURE__ */ f(o, {
122
123
  ...e,
123
124
  xBand: s,
124
125
  CustomDraggableComponent: _
@@ -1,101 +1,100 @@
1
1
  import { CorrectnessIndicator as e, SmallCorrectPointIndicator as t } from "../common/correctness-indicators.js";
2
2
  import { dataToXBand as n } from "../utils.js";
3
- import { Line as r } from "./common/line.js";
4
- import i from "react";
5
- import a from "prop-types";
6
- import { styled as o } from "@mui/material/styles";
7
- import { types as s } from "@pie-lib/plot";
8
- import { color as c } from "@pie-lib/render-ui";
9
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ import { useDragHover as r } from "../common/drag-hover.js";
4
+ import { Line as i } from "./common/line.js";
5
+ import a from "react";
6
+ import o from "prop-types";
7
+ import { styled as s } from "@mui/material/styles";
8
+ import { types as c } from "@pie-lib/plot";
9
+ import { color as l } from "@pie-lib/render-ui";
10
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
11
  //#region src/line/line-dot.tsx
11
- var d = o("circle")(() => ({})), f = o("circle")(() => ({
12
+ var f = s("circle", { shouldForwardProp: (e) => e !== "correctness" && e !== "interactive" })(() => ({})), p = s("circle")(() => ({
12
13
  height: "20px",
13
14
  fill: "transparent",
14
15
  stroke: "none",
15
16
  pointerEvents: "auto"
16
- })), p = ({ scale: n, x: r, y: a, r: o, correctness: s, interactive: p, correctData: m, label: h, ...g }) => {
17
- let [_, v] = i.useState(!1), y = !s && p;
18
- return /* @__PURE__ */ u("g", {
19
- onMouseEnter: () => v(!0),
20
- onMouseLeave: () => v(!1),
21
- onTouchStart: () => v(!0),
22
- onTouchEnd: () => v(!1),
17
+ })), m = ({ scale: n, x: i, y: a, r: o, correctness: s, interactive: c, correctData: m, label: h, isDragging: g, disabled: _, onDragStart: v, onDrag: y, onDragStop: b, ...x }) => {
18
+ let { hovered: S, onEnter: C, onLeave: w } = r(!!g && !_), T = !s && c;
19
+ return /* @__PURE__ */ d("g", {
20
+ onMouseEnter: C,
21
+ onMouseLeave: w,
22
+ onTouchStart: C,
23
+ onTouchEnd: w,
23
24
  children: [
24
- /* @__PURE__ */ l(f, {
25
- cx: n.x(r),
25
+ /* @__PURE__ */ u(p, {
26
+ cx: n.x(i),
26
27
  cy: n.y(a),
27
28
  r: o * 3,
28
- onMouseEnter: () => v(!0),
29
- onMouseLeave: () => v(!1),
30
- ...g
29
+ ...x
31
30
  }),
32
- /* @__PURE__ */ l(d, {
33
- cx: n.x(r),
31
+ /* @__PURE__ */ u(f, {
32
+ cx: n.x(i),
34
33
  cy: n.y(a),
35
34
  r: o,
36
35
  correctness: s,
37
- interactive: p,
38
- ...g
36
+ interactive: c,
37
+ ...x
39
38
  }),
40
- /* @__PURE__ */ l(e, {
39
+ /* @__PURE__ */ u(e, {
41
40
  scale: n,
42
- x: r,
41
+ x: i,
43
42
  y: a,
44
43
  r: o,
45
44
  correctness: s,
46
- interactive: p
45
+ interactive: c
47
46
  }),
48
- /* @__PURE__ */ l(t, {
47
+ /* @__PURE__ */ u(t, {
49
48
  scale: n,
50
- x: r,
49
+ x: i,
51
50
  r: o,
52
51
  correctness: s,
53
52
  correctData: m,
54
53
  label: h
55
54
  }),
56
- _ && y && /* @__PURE__ */ l("rect", {
57
- x: n.x(r) - o * 2,
55
+ S && T && /* @__PURE__ */ u("rect", {
56
+ x: n.x(i) - o * 2,
58
57
  y: n.y(a) - o * 2,
59
58
  width: o * 4,
60
59
  height: o * 4,
61
- stroke: c.defaults.BORDER_GRAY,
60
+ stroke: l.defaults.BORDER_GRAY,
62
61
  strokeWidth: "1",
63
62
  fill: "none"
64
63
  })
65
64
  ]
66
65
  });
67
66
  };
68
- p.propTypes = {
69
- scale: a.object,
70
- x: a.number,
71
- y: a.number,
72
- r: a.number,
73
- correctness: a.shape({
74
- value: a.string,
75
- label: a.string
67
+ m.propTypes = {
68
+ scale: o.object,
69
+ x: o.number,
70
+ y: o.number,
71
+ r: o.number,
72
+ correctness: o.shape({
73
+ value: o.string,
74
+ label: o.string
76
75
  }),
77
- interactive: a.bool,
78
- correctData: a.array,
79
- label: a.string
76
+ interactive: o.bool,
77
+ correctData: o.array,
78
+ label: o.string
80
79
  };
81
- var m = class extends i.Component {
80
+ var h = class extends a.Component {
82
81
  static propTypes = {
83
- data: a.array,
84
- onChange: a.func,
85
- graphProps: s.GraphPropsType.isRequired
82
+ data: o.array,
83
+ onChange: o.func,
84
+ graphProps: c.GraphPropsType.isRequired
86
85
  };
87
86
  render() {
88
- let e = this.props, { data: t, graphProps: i } = e, { scale: a = {}, size: o = {} } = i || {}, s = n(a.x, t, o.width, "lineDot");
89
- return /* @__PURE__ */ l(r, {
87
+ let e = this.props, { data: t, graphProps: r } = e, { scale: a = {}, size: o = {} } = r || {}, s = n(a.x, t, o.width, "lineDot");
88
+ return /* @__PURE__ */ u(i, {
90
89
  ...e,
91
90
  xBand: s,
92
- CustomDraggableComponent: p
91
+ CustomDraggableComponent: m
93
92
  });
94
93
  }
95
- }, h = () => ({
94
+ }, g = () => ({
96
95
  type: "lineDot",
97
- Component: m,
96
+ Component: h,
98
97
  name: "Line Dot"
99
98
  });
100
99
  //#endregion
101
- export { m as LineDot, h as default };
100
+ export { h as LineDot, g as default };
@@ -47,8 +47,12 @@ export declare class RawPlot extends React.Component {
47
47
  language: PropTypes.Requireable<string>;
48
48
  };
49
49
  constructor(props: any);
50
+ componentDidMount(): void;
51
+ componentDidUpdate(prevProps: any): void;
52
+ componentWillUnmount(): void;
50
53
  handleMouseEnter: any;
51
54
  handleMouseLeave: any;
55
+ dragStart: any;
52
56
  setDragValue: (dragValue: any) => void;
53
57
  changeValue: any;
54
58
  dragStop: any;
@@ -2,51 +2,58 @@ import e from "../../node_modules/.bun/@visx_group@4.0.0_d84c32d47042070f/node_m
2
2
  import { bandKey as t } from "../../utils.js";
3
3
  import { correct as n, incorrect as r } from "../../common/styles.js";
4
4
  import { D as i, DragHandle as a } from "../../common/drag-handle.js";
5
- import { MarkSlider as o } from "../../common/mark-slider.js";
6
- import s from "react";
7
- import c from "prop-types";
8
- import { styled as l } from "@mui/material/styles";
9
- import u from "debug";
10
- import { types as d } from "@pie-lib/plot";
11
- import { color as f } from "@pie-lib/render-ui";
12
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
13
- import g from "@mui/icons-material/Check";
5
+ import { DragHover as o } from "../../common/drag-hover.js";
6
+ import { MarkSlider as s } from "../../common/mark-slider.js";
7
+ import c from "react";
8
+ import l from "prop-types";
9
+ import { styled as u } from "@mui/material/styles";
10
+ import d from "debug";
11
+ import { types as f } from "@pie-lib/plot";
12
+ import { color as p } from "@pie-lib/render-ui";
13
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
14
+ import _ from "@mui/icons-material/Check";
14
15
  //#region src/plot/common/plot.tsx
15
- var _ = u("pie-lib:chart:bars"), v = 16, y = 10, b = class extends s.Component {
16
+ var v = d("pie-lib:chart:bars"), y = 16, b = 10, x = class extends c.Component {
16
17
  static propTypes = {
17
- onChangeCategory: c.func,
18
- value: c.number,
19
- label: c.string,
20
- xBand: c.func,
21
- index: c.number.isRequired,
22
- graphProps: d.GraphPropsType.isRequired,
23
- CustomBarElement: c.func,
24
- interactive: c.bool,
25
- disabled: c.bool,
26
- correctness: c.shape({
27
- value: c.string,
28
- label: c.string
18
+ onChangeCategory: l.func,
19
+ value: l.number,
20
+ label: l.string,
21
+ xBand: l.func,
22
+ index: l.number.isRequired,
23
+ graphProps: f.GraphPropsType.isRequired,
24
+ CustomBarElement: l.func,
25
+ interactive: l.bool,
26
+ disabled: l.bool,
27
+ correctness: l.shape({
28
+ value: l.string,
29
+ label: l.string
29
30
  }),
30
- defineChart: c.bool,
31
- correctData: c.arrayOf(c.shape({
32
- value: c.oneOfType([c.string, c.number]),
33
- label: c.string
31
+ defineChart: l.bool,
32
+ correctData: l.arrayOf(l.shape({
33
+ value: l.oneOfType([l.string, l.number]),
34
+ label: l.string
34
35
  })),
35
- className: c.string,
36
- language: c.string
36
+ className: l.string,
37
+ language: l.string
37
38
  };
38
39
  constructor(e) {
39
40
  super(e), this.state = {
40
41
  dragValue: void 0,
41
42
  isHovered: !1
42
- };
43
+ }, this.hover = new o((e) => this.setState({ isHovered: e }));
43
44
  }
44
- handleMouseEnter = () => {
45
- this.setState({ isHovered: !0 });
46
- };
47
- handleMouseLeave = () => {
48
- this.setState({ isHovered: !1 });
49
- };
45
+ componentDidMount() {
46
+ this.hover.attach();
47
+ }
48
+ componentDidUpdate(e) {
49
+ this.props.disabled && !e.disabled && (this.hover.stop(), this.setDragValue(void 0));
50
+ }
51
+ componentWillUnmount() {
52
+ this.hover.dispose();
53
+ }
54
+ handleMouseEnter = () => this.hover.setInside(!0);
55
+ handleMouseLeave = () => this.hover.setInside(!1);
56
+ dragStart = () => this.hover.start();
50
57
  setDragValue = (e) => this.setState({ dragValue: e });
51
58
  changeValue = (e) => {
52
59
  let { label: t, onChangeCategory: n } = this.props;
@@ -56,43 +63,43 @@ var _ = u("pie-lib:chart:bars"), v = 16, y = 10, b = class extends s.Component {
56
63
  });
57
64
  };
58
65
  dragStop = () => {
59
- let { dragValue: e } = this.state;
60
- _("[dragStop]", e), e !== void 0 && this.changeValue(e), this.setDragValue(void 0);
66
+ let { dragValue: e } = this.state, { disabled: t } = this.props;
67
+ v("[dragStop]", e), e !== void 0 && !t && this.changeValue(e), this.setDragValue(void 0), this.hover.stop();
61
68
  };
62
69
  dragValue = (e, t) => {
63
- _("[dragValue] next:", t), this.setDragValue(t);
70
+ v("[dragValue] next:", t), this.setDragValue(t);
64
71
  };
65
72
  renderCorrectnessIcon = (e, t, n, r, i, a, o) => {
66
73
  let s;
67
- if (n === 0) s = i.y(0) - v / 2;
74
+ if (n === 0) s = i.y(0) - y / 2;
68
75
  else {
69
76
  let e = n - 1;
70
- s = i.y(e) - (a - o) / 2 - o / 2 - v / 2;
77
+ s = i.y(e) - (a - o) / 2 - o / 2 - y / 2;
71
78
  }
72
- return /* @__PURE__ */ m("foreignObject", {
73
- x: e + t / 2 - v / 2,
79
+ return /* @__PURE__ */ h("foreignObject", {
80
+ x: e + t / 2 - y / 2,
74
81
  y: s,
75
- width: v,
76
- height: v,
77
- children: /* @__PURE__ */ m(g, {
82
+ width: y,
83
+ height: y,
84
+ children: /* @__PURE__ */ h(_, {
78
85
  className: "correctnessIcon correctIcon smallIcon",
79
86
  title: r.label
80
87
  })
81
88
  });
82
89
  };
83
90
  render() {
84
- let { graphProps: e, value: n, label: r, xBand: c, index: l, CustomBarElement: u, interactive: d, disabled: g, correctness: v, defineChart: b, correctData: x, className: S, language: C } = this.props, { scale: w, range: T, size: E } = e, { max: D } = T || {}, { dragValue: O, isHovered: k } = this.state, A = Number.isFinite(O) ? O : n, j = c.bandwidth(), M = w.y(T.max - A), N = c(t({ label: r }, l));
85
- _("label:", r, "barX:", N, "v: ", A, "barHeight:", M, "barWidth: ", j);
91
+ let { graphProps: e, value: n, label: r, xBand: o, index: l, CustomBarElement: u, interactive: d, disabled: f, correctness: _, defineChart: y, correctData: x, className: S, language: C } = this.props, { scale: w, range: T, size: E } = e, { max: D } = T || {}, { dragValue: O, isHovered: k } = this.state, A = Number.isFinite(O) ? O : n, j = o.bandwidth(), M = w.y(T.max - A), N = o(t({ label: r }, l));
92
+ v("label:", r, "barX:", N, "v: ", A, "barHeight:", M, "barWidth: ", j);
86
93
  let P = [];
87
94
  for (let e = 0; e < A; e++) P.push(e);
88
- let F = E.height / D, I = (F > j ? j : F) * .8, L = d ? i : a, R = d && !v;
89
- return /* @__PURE__ */ m(s.Fragment, { children: /* @__PURE__ */ h(o, {
95
+ let F = E.height / D, I = (F > j ? j : F) * .8, L = d ? i : a, R = d && !_;
96
+ return /* @__PURE__ */ h(c.Fragment, { children: /* @__PURE__ */ g(s, {
90
97
  className: S,
91
98
  onMouseEnter: this.handleMouseEnter,
92
99
  onMouseLeave: this.handleMouseLeave,
93
100
  onTouchStart: this.handleMouseEnter,
94
101
  onTouchEnd: this.handleMouseLeave,
95
- enabled: d && !g,
102
+ enabled: d && !f,
96
103
  label: r,
97
104
  index: l,
98
105
  value: A,
@@ -100,18 +107,18 @@ var _ = u("pie-lib:chart:bars"), v = 16, y = 10, b = class extends s.Component {
100
107
  language: C,
101
108
  focusBox: {
102
109
  x: N,
103
- y: w.y(A) - y,
110
+ y: w.y(A) - b,
104
111
  width: j,
105
- height: F * P.length + y
112
+ height: F * P.length + b
106
113
  },
107
114
  onChange: this.changeValue,
108
115
  children: [
109
- k && R && /* @__PURE__ */ m("rect", {
116
+ k && R && /* @__PURE__ */ h("rect", {
110
117
  x: N,
111
118
  y: w.y(A),
112
119
  width: j,
113
120
  height: P?.length ? F * P.length : 0,
114
- stroke: f.defaults.BORDER_GRAY,
121
+ stroke: p.defaults.BORDER_GRAY,
115
122
  strokeWidth: "4px",
116
123
  fill: "transparent"
117
124
  }),
@@ -125,30 +132,30 @@ var _ = u("pie-lib:chart:bars"), v = 16, y = 10, b = class extends s.Component {
125
132
  value: n,
126
133
  scale: w
127
134
  })),
128
- v && v.value === "incorrect" && (() => {
135
+ _ && _.value === "incorrect" && (() => {
129
136
  let e = parseFloat(x[l] && x[l].value);
130
137
  if (isNaN(e)) return null;
131
138
  let i = A;
132
- if (e === 0) return this.renderCorrectnessIcon(N, j, e, v, w, F, I);
139
+ if (e === 0) return this.renderCorrectnessIcon(N, j, e, _, w, F, I);
133
140
  if (i > e) {
134
141
  let i = [];
135
142
  for (let t = 0; t < e; t++) i.push(t);
136
- let a = i[i.length - 1], o = c(t({ label: r }, l)), s = c.bandwidth(), d = E.height / D, f = (d > s ? s : d) * .8;
137
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(u, {
143
+ let a = i[i.length - 1], s = o(t({ label: r }, l)), c = o.bandwidth(), d = E.height / D, f = (d > c ? c : d) * .8;
144
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(u, {
138
145
  index: a,
139
146
  pointDiameter: f + 10,
140
- barX: o,
141
- barWidth: s,
147
+ barX: s,
148
+ barWidth: c,
142
149
  pointHeight: d,
143
150
  label: r,
144
151
  value: n,
145
152
  scale: w,
146
153
  dottedOverline: !0
147
- }), this.renderCorrectnessIcon(o, s, e, v, w, d, f)] });
154
+ }), this.renderCorrectnessIcon(s, c, e, _, w, d, f)] });
148
155
  }
149
156
  let a = [];
150
157
  for (let t = i; t < e; t++) a.push(t);
151
- return /* @__PURE__ */ h(p, { children: [a.map((e) => u({
158
+ return /* @__PURE__ */ g(m, { children: [a.map((e) => u({
152
159
  index: e,
153
160
  pointDiameter: I,
154
161
  barX: N,
@@ -158,52 +165,53 @@ var _ = u("pie-lib:chart:bars"), v = 16, y = 10, b = class extends s.Component {
158
165
  value: n,
159
166
  scale: w,
160
167
  dottedOverline: !0
161
- })), this.renderCorrectnessIcon(N, j, e, v, w, F, I)] });
168
+ })), this.renderCorrectnessIcon(N, j, e, _, w, F, I)] });
162
169
  })(),
163
- /* @__PURE__ */ m(L, {
170
+ /* @__PURE__ */ h(L, {
164
171
  x: N,
165
172
  y: A,
166
173
  interactive: d,
167
- disabled: g,
174
+ disabled: f,
168
175
  width: j,
176
+ onDragStart: this.dragStart,
169
177
  onDrag: (e) => this.dragValue(n, e),
170
178
  onDragStop: this.dragStop,
171
179
  graphProps: e,
172
- correctness: v,
180
+ correctness: _,
173
181
  isHovered: k,
174
- defineChart: b,
175
- color: f.primaryDark(),
182
+ defineChart: y,
183
+ color: p.primaryDark(),
176
184
  isPlot: !0
177
185
  })
178
186
  ]
179
187
  }) });
180
188
  }
181
- }, x = l(b)(({ theme: e }) => ({
189
+ }, S = u(x)(({ theme: e }) => ({
182
190
  "& .dot": {
183
- fill: f.visualElementsColors.PLOT_FILL_COLOR,
191
+ fill: p.visualElementsColors.PLOT_FILL_COLOR,
184
192
  "&.correct": n("stroke"),
185
193
  "&.incorrect": r("stroke")
186
194
  },
187
195
  "& .dotColor": {
188
- fill: f.visualElementsColors.PLOT_FILL_COLOR,
196
+ fill: p.visualElementsColors.PLOT_FILL_COLOR,
189
197
  "&.correct": n("fill"),
190
198
  "&.incorrect": r("fill")
191
199
  },
192
200
  "& .line": {
193
- stroke: f.visualElementsColors.PLOT_FILL_COLOR,
201
+ stroke: p.visualElementsColors.PLOT_FILL_COLOR,
194
202
  "&.correct": n("stroke"),
195
203
  "&.incorrect": r("stroke")
196
204
  },
197
- "& .correctIcon": { backgroundColor: f.correct() },
198
- "& .incorrectIcon": { backgroundColor: f.incorrectWithIcon() },
205
+ "& .correctIcon": { backgroundColor: p.correct() },
206
+ "& .incorrectIcon": { backgroundColor: p.incorrectWithIcon() },
199
207
  "& .correctnessIcon": {
200
208
  borderRadius: e.spacing(2),
201
- color: f.defaults.WHITE,
209
+ color: p.defaults.WHITE,
202
210
  fontSize: "16px",
203
211
  width: "16px",
204
212
  height: "16px",
205
213
  padding: "2px",
206
- border: `1px solid ${f.defaults.WHITE}`,
214
+ border: `1px solid ${p.defaults.WHITE}`,
207
215
  stroke: "initial",
208
216
  boxSizing: "unset",
209
217
  display: "block"
@@ -213,24 +221,24 @@ var _ = u("pie-lib:chart:bars"), v = 16, y = 10, b = class extends s.Component {
213
221
  width: "10px",
214
222
  height: "10px"
215
223
  }
216
- })), S = class extends s.Component {
224
+ })), C = class extends c.Component {
217
225
  static propTypes = {
218
- data: c.array,
219
- onChangeCategory: c.func,
220
- xBand: c.func,
221
- graphProps: d.GraphPropsType.isRequired,
222
- defineChart: c.bool,
223
- CustomBarElement: c.func,
224
- correctData: c.arrayOf(c.shape({
225
- value: c.oneOfType([c.string, c.number]),
226
- label: c.string
226
+ data: l.array,
227
+ onChangeCategory: l.func,
228
+ xBand: l.func,
229
+ graphProps: f.GraphPropsType.isRequired,
230
+ defineChart: l.bool,
231
+ CustomBarElement: l.func,
232
+ correctData: l.arrayOf(l.shape({
233
+ value: l.oneOfType([l.string, l.number]),
234
+ label: l.string
227
235
  })),
228
- className: c.string,
229
- language: c.string
236
+ className: l.string,
237
+ language: l.string
230
238
  };
231
239
  render() {
232
240
  let { data: t, graphProps: n, xBand: r, CustomBarElement: i, onChangeCategory: a, defineChart: o, correctData: s, disabled: c, language: l } = this.props;
233
- return /* @__PURE__ */ m(e, { children: (t || []).map((e, t) => /* @__PURE__ */ m(x, {
241
+ return /* @__PURE__ */ h(e, { children: (t || []).map((e, t) => /* @__PURE__ */ h(S, {
234
242
  value: e.value,
235
243
  label: e.label,
236
244
  interactive: o || e.interactive,
@@ -248,4 +256,4 @@ var _ = u("pie-lib:chart:bars"), v = 16, y = 10, b = class extends s.Component {
248
256
  }
249
257
  };
250
258
  //#endregion
251
- export { S as Plot, S as default, b as RawPlot };
259
+ export { C as Plot, C as default, x as RawPlot };
package/dist/utils.d.ts CHANGED
@@ -25,7 +25,7 @@ export declare const getGridLinesAndAxisByChartType: (range: any, chartType: any
25
25
  };
26
26
  export declare const getRotateAngle: (fontSize: any, height: any) => 0 | 25;
27
27
  export declare const getRotatedLabelOverhang: (width: any, height: any, angle: any) => number;
28
- export declare const getTopPadding: (barWidth: any) => 0 | 15 | 50 | 30;
28
+ export declare const getTopPadding: (barWidth: any) => 0 | 50 | 15 | 30;
29
29
  export declare const getScale: (width: any) => {
30
30
  scale: number;
31
31
  deltay: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/charting",
3
- "version": "8.0.8-next.20261102140134",
3
+ "version": "8.0.8-next.20261102164954",
4
4
  "description": "charting",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,8 @@
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.20261102140134",
18
- "@pie-lib/render-ui": "8.0.8-next.20261027193325",
17
+ "@pie-lib/plot": "5.0.8-next.20261102164954",
18
+ "@pie-lib/render-ui": "8.0.8-next.20261102164954",
19
19
  "@pie-lib/translator": "5.0.3-next.20261027184745",
20
20
  "@visx/axis": "^4.0.0",
21
21
  "@visx/event": "^4.0.0",
@@ -30,8 +30,8 @@
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.20261102140134",
34
- "@pie-element/shared-math-rendering-mathjax": "0.1.9-next.20261026200905",
33
+ "@pie-lib/config-ui": "14.0.8-next.20261102164954",
34
+ "@pie-element/shared-math-rendering-mathjax": "0.1.9-next.20261102164954",
35
35
  "@pie-element/shared-lodash": "0.1.4-next.20261026212738",
36
36
  "clsx": "^2.1.1",
37
37
  "d3-time": "^3.1.0",