@pie-lib/graphing-solution-set 5.0.8-next.20261103123052 → 5.0.8-next.20261109072207

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.
package/dist/bg.js CHANGED
@@ -26,7 +26,10 @@ var l = class extends n.Component {
26
26
  };
27
27
  onRectClick = (t, n) => {
28
28
  let { onClick: r, graphProps: i } = this.props, { scale: a } = i, o = this.getRectPadding(), c = s(n, t.node()), l = a.x.invert(c[0] - o), u = a.y.invert(c[1] - o), d = e(i.range), f = e(i.domain), p = (e, t) => e.length && e.reduce((e, n) => Math.abs(n - t) <= Math.abs(e - t) ? n : e), m = {};
29
- f.indexOf(l) >= 0 && d.indexOf(u) >= 0 ? (m.x = l, m.y = u) : (m.x = p(f, l), m.y = p(d, u)), r(m);
29
+ f.indexOf(l) >= 0 && d.indexOf(u) >= 0 ? (m.x = l, m.y = u) : (m.x = p(f, l), m.y = p(d, u)), r(m, {
30
+ x: l,
31
+ y: u
32
+ });
30
33
  };
31
34
  render() {
32
35
  let { width: e, height: t } = this.props, n = this.getRectPadding();
package/dist/graph.js CHANGED
@@ -110,25 +110,25 @@ var { translator: b } = g, x = _("pie-lib:graphing-solution-set:graph"), S = {
110
110
  let t = (this.props.tools || []).find((t) => t.type === e.type);
111
111
  return t && t.Component || null;
112
112
  };
113
- onBgClick = (e) => {
114
- let { x: t, y: n } = e || {}, { labelModeEnabled: r, currentTool: i, marks: a, gssLineData: o, onSolutionSetSelected: s } = this.props;
115
- if (o) {
116
- if (o.selectedTool === "solutionSet") {
117
- s(e);
113
+ onBgClick = (e, t) => {
114
+ let { x: n, y: r } = e || {}, { labelModeEnabled: i, currentTool: a, marks: o, gssLineData: s, onSolutionSetSelected: c } = this.props;
115
+ if (s) {
116
+ if (s.selectedTool === "solutionSet") {
117
+ c(e, t);
118
118
  return;
119
119
  }
120
- if (o.numberOfLines === 1 && o.selectedTool === "lineA" && a.length === 1 && !a[0].building || o.numberOfLines === 2 && o.selectedTool === "lineA" && a.length === 2 || o.numberOfLines === 2 && o.selectedTool === "lineA" && a.length === 1 && !a[0].building || o.numberOfLines === 2 && o.selectedTool === "lineB" && a.length === 2 && !a[1].building) return;
120
+ if (s.numberOfLines === 1 && s.selectedTool === "lineA" && o.length === 1 && !o[0].building || s.numberOfLines === 2 && s.selectedTool === "lineA" && o.length === 2 || s.numberOfLines === 2 && s.selectedTool === "lineA" && o.length === 1 && !o[0].building || s.numberOfLines === 2 && s.selectedTool === "lineB" && o.length === 2 && !o[1].building) return;
121
121
  }
122
- if (r || !i || [null, void 0].includes(t) || [null, void 0].includes(n)) return;
123
- x("[onBgClick] x,y: ", t, n);
124
- let c = a.filter((e) => e.building)[0], l;
125
- l = c && i && c.type === i.type ? i.addPoint({
126
- x: t,
127
- y: n
128
- }, { ...c }) : i.addPoint({
129
- x: t,
130
- y: n
131
- }, void 0), this.updateMarks(c, l, !0);
122
+ if (i || !a || [null, void 0].includes(n) || [null, void 0].includes(r)) return;
123
+ x("[onBgClick] x,y: ", n, r);
124
+ let l = o.filter((e) => e.building)[0], u;
125
+ u = l && a && l.type === a.type ? a.addPoint({
126
+ x: n,
127
+ y: r
128
+ }, { ...l }) : a.addPoint({
129
+ x: n,
130
+ y: r
131
+ }, void 0), this.updateMarks(l, u, !0);
132
132
  };
133
133
  render() {
134
134
  let { axesSettings: t, currentTool: r, coordinatesOnHover: a, size: s, disabledLabels: c, disabledTitle: l, domain: u, backgroundMarks: p, range: m, title: h, labels: g, labelModeEnabled: _, labelsPlaceholders: b, showLabels: x, showPixelGuides: S, showTitle: w, titlePlaceholder: D, onChangeLabels: O, onChangeTitle: k, mathMlOptions: A = {}, gssLineData: j, disabled: M, language: N } = this.props, { marks: P } = this.props, F = f(u, m, s, () => this.rootNode), I = C(s), L = {
@@ -5,10 +5,14 @@ export declare class ToolMenu extends React.Component {
5
5
  gssLineData: PropTypes.Requireable<object>;
6
6
  disabled: PropTypes.Requireable<boolean>;
7
7
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
8
+ language: PropTypes.Requireable<string>;
8
9
  };
9
10
  idPrefix: string;
10
11
  onChangeRadioValue: any;
11
12
  lineTypeChange: any;
13
+ renderLineTypeButton(line: any, type: any, side: any): React.JSX.Element;
14
+ renderToolRadio(value: any): React.JSX.Element;
15
+ renderLine(line: any): React.JSX.Element;
12
16
  render(): React.JSX.Element;
13
17
  }
14
18
  export default ToolMenu;
package/dist/tool-menu.js CHANGED
@@ -1,15 +1,17 @@
1
1
  import e from "react";
2
2
  import t from "prop-types";
3
3
  import { createUniqueId as n } from "@pie-lib/render-ui";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import { styled as a } from "@mui/material/styles";
6
- import { Button as o, Radio as s, Typography as c } from "@mui/material";
4
+ import r from "@pie-lib/translator";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import { styled as o } from "@mui/material/styles";
7
+ import { Button as s, Radio as c, Typography as l } from "@mui/material";
7
8
  //#region src/tool-menu.tsx
8
- var l = class extends e.Component {
9
+ var { translator: u } = r, d = class extends e.Component {
9
10
  static propTypes = {
10
11
  gssLineData: t.object,
11
12
  disabled: t.bool,
12
- onChange: t.func
13
+ onChange: t.func,
14
+ language: t.string
13
15
  };
14
16
  idPrefix = n("gss-tool-menu");
15
17
  onChangeRadioValue = (e) => {
@@ -20,110 +22,69 @@ var l = class extends e.Component {
20
22
  let { gssLineData: n, onChange: r } = this.props, i = n.selectedTool;
21
23
  n[`line${e}`].lineType = t, r(n, i);
22
24
  };
25
+ renderLineTypeButton(e, t, n) {
26
+ let { gssLineData: r, disabled: o, language: c } = this.props, l = r[`line${e}`].lineType === t;
27
+ return /* @__PURE__ */ a(s, {
28
+ size: "small",
29
+ variant: "contained",
30
+ color: l ? "primary" : "inherit",
31
+ disabled: !!o,
32
+ "aria-pressed": l,
33
+ onClick: () => this.lineTypeChange(e, t),
34
+ className: `lineTypeButton${n}${`${l ? "Selected" : "UnSelected"}${o ? "Disabled" : ""}`}`,
35
+ children: [
36
+ l && /* @__PURE__ */ i("span", {
37
+ "aria-hidden": "true",
38
+ children: "✔"
39
+ }),
40
+ " ",
41
+ u.t(`graphing.${t.toLowerCase()}`, { lng: c })
42
+ ]
43
+ });
44
+ }
45
+ renderToolRadio(e) {
46
+ let { gssLineData: t, disabled: n, language: r } = this.props;
47
+ return /* @__PURE__ */ a("div", {
48
+ className: "radioFieldInner",
49
+ children: [/* @__PURE__ */ i(c, {
50
+ name: `${this.idPrefix}-line`,
51
+ onChange: this.onChangeRadioValue,
52
+ value: e,
53
+ disabled: !!n,
54
+ checked: t.selectedTool === e,
55
+ className: "lineTypeRadio",
56
+ inputProps: { "aria-labelledby": `${this.idPrefix}-${e}` }
57
+ }), /* @__PURE__ */ i(l, {
58
+ id: `${this.idPrefix}-${e}`,
59
+ className: "lineNameFont",
60
+ children: u.t(`graphing.${e}`, { lng: r })
61
+ })]
62
+ });
63
+ }
64
+ renderLine(e) {
65
+ return /* @__PURE__ */ a("div", {
66
+ className: "radioFieldOuter",
67
+ children: [this.renderToolRadio(`line${e}`), /* @__PURE__ */ a("div", {
68
+ className: "radioFieldButtons",
69
+ children: [this.renderLineTypeButton(e, "Solid", "Left"), this.renderLineTypeButton(e, "Dashed", "Right")]
70
+ })]
71
+ });
72
+ }
23
73
  render() {
24
- let { gssLineData: e, disabled: t } = this.props;
25
- return /* @__PURE__ */ r(u, { children: /* @__PURE__ */ i("div", {
74
+ let { gssLineData: e } = this.props;
75
+ return /* @__PURE__ */ i(f, { children: /* @__PURE__ */ a("div", {
26
76
  className: "selectLineRadioGroup",
27
77
  children: [
78
+ this.renderLine("A"),
79
+ e.numberOfLines === 2 && this.renderLine("B"),
28
80
  /* @__PURE__ */ i("div", {
29
81
  className: "radioFieldOuter",
30
- children: [/* @__PURE__ */ i("div", {
31
- className: "radioFieldInner",
32
- children: [/* @__PURE__ */ r(s, {
33
- name: `${this.idPrefix}-line`,
34
- onChange: this.onChangeRadioValue,
35
- value: "lineA",
36
- disabled: !!t,
37
- checked: e.selectedTool === "lineA",
38
- className: "lineTypeRadio",
39
- inputProps: { "aria-labelledby": `${this.idPrefix}-lineA` }
40
- }), /* @__PURE__ */ r(c, {
41
- id: `${this.idPrefix}-lineA`,
42
- className: "lineNameFont",
43
- children: "Line A"
44
- })]
45
- }), /* @__PURE__ */ i("div", {
46
- className: "radioFieldButtons",
47
- children: [/* @__PURE__ */ i(o, {
48
- size: "small",
49
- variant: "contained",
50
- color: e.lineA.lineType === "Solid" ? "primary" : "inherit",
51
- disabled: !!t,
52
- onClick: () => this.lineTypeChange("A", "Solid"),
53
- className: e.lineA.lineType === "Solid" ? t ? "lineTypeButtonLeftSelectedDisabled" : "lineTypeButtonLeftSelected" : t ? "lineTypeButtonLeftUnSelectedDisabled" : "lineTypeButtonLeftUnSelected",
54
- children: [e.lineA.lineType === "Solid" && "✔", " Solid"]
55
- }), /* @__PURE__ */ i(o, {
56
- size: "small",
57
- variant: "contained",
58
- color: e.lineA.lineType === "Dashed" ? "primary" : "inherit",
59
- disabled: !!t,
60
- onClick: () => this.lineTypeChange("A", "Dashed"),
61
- className: e.lineA.lineType === "Dashed" ? t ? "lineTypeButtonRightSelectedDisabled" : "lineTypeButtonRightSelected" : t ? "lineTypeButtonRightUnSelectedDisabled" : "lineTypeButtonRightUnSelected",
62
- children: [e.lineA.lineType === "Dashed" && "✔", " Dashed"]
63
- })]
64
- })]
65
- }),
66
- e.numberOfLines === 2 && /* @__PURE__ */ i("div", {
67
- className: "radioFieldOuter",
68
- children: [/* @__PURE__ */ i("div", {
69
- className: "radioFieldInner",
70
- children: [/* @__PURE__ */ r(s, {
71
- name: `${this.idPrefix}-line`,
72
- onChange: this.onChangeRadioValue,
73
- value: "lineB",
74
- disabled: !!t,
75
- checked: e.selectedTool === "lineB",
76
- className: "lineTypeRadio",
77
- inputProps: { "aria-labelledby": `${this.idPrefix}-lineB` }
78
- }), /* @__PURE__ */ r(c, {
79
- id: `${this.idPrefix}-lineB`,
80
- className: "lineNameFont",
81
- children: "Line B"
82
- })]
83
- }), /* @__PURE__ */ i("div", {
84
- className: "radioFieldButtons",
85
- children: [/* @__PURE__ */ i(o, {
86
- size: "small",
87
- variant: "contained",
88
- color: e.lineB.lineType === "Solid" ? "primary" : "inherit",
89
- disabled: !!t,
90
- onClick: () => this.lineTypeChange("B", "Solid"),
91
- className: e.lineB.lineType === "Solid" ? t ? "lineTypeButtonLeftSelectedDisabled" : "lineTypeButtonLeftSelected" : t ? "lineTypeButtonLeftUnSelectedDisabled" : "lineTypeButtonLeftUnSelected",
92
- children: [e.lineB.lineType === "Solid" && "✔", " Solid"]
93
- }), /* @__PURE__ */ i(o, {
94
- size: "small",
95
- variant: "contained",
96
- color: e.lineB.lineType === "Dashed" ? "primary" : "inherit",
97
- disabled: !!t,
98
- onClick: () => this.lineTypeChange("B", "Dashed"),
99
- className: e.lineB.lineType === "Dashed" ? t ? "lineTypeButtonRightSelectedDisabled" : "lineTypeButtonRightSelected" : t ? "lineTypeButtonRightUnSelectedDisabled" : "lineTypeButtonRightUnSelected",
100
- children: [e.lineB.lineType === "Dashed" && "✔", " Dashed"]
101
- })]
102
- })]
103
- }),
104
- /* @__PURE__ */ r("div", {
105
- className: "radioFieldOuter",
106
- children: /* @__PURE__ */ i("div", {
107
- className: "radioFieldInner",
108
- children: [/* @__PURE__ */ r(s, {
109
- name: `${this.idPrefix}-line`,
110
- onChange: this.onChangeRadioValue,
111
- value: "solutionSet",
112
- disabled: !!t,
113
- checked: e.selectedTool === "solutionSet",
114
- className: "lineTypeRadio",
115
- inputProps: { "aria-labelledby": `${this.idPrefix}-solutionSet` }
116
- }), /* @__PURE__ */ r(c, {
117
- id: `${this.idPrefix}-solutionSet`,
118
- className: "lineNameFont",
119
- children: "Solution Set"
120
- })]
121
- })
82
+ children: this.renderToolRadio("solutionSet")
122
83
  })
123
84
  ]
124
85
  }) });
125
86
  }
126
- }, u = a("div")(() => ({
87
+ }, f = o("div")(() => ({
127
88
  "& .selectLineRadioGroup": {
128
89
  display: "flex",
129
90
  flexWrap: "wrap",
@@ -193,4 +154,4 @@ var l = class extends e.Component {
193
154
  }
194
155
  }));
195
156
  //#endregion
196
- export { l as ToolMenu, l as default };
157
+ export { d as ToolMenu, d as default };
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@pie-lib/graphing-solution-set",
3
- "version": "5.0.8-next.20261103123052",
3
+ "version": "5.0.8-next.20261109072207",
4
4
  "description": "Graphing components",
5
+ "license": "MIT",
5
6
  "repository": {
6
7
  "type": "git",
7
8
  "url": "git+https://github.com/pie-framework/pie-elements-ng.git",
@@ -15,13 +16,13 @@
15
16
  "@mui/icons-material": "^7.3.4",
16
17
  "@mui/material": "^7.3.4",
17
18
  "@pie-element/shared-utils": "0.1.7-next.20261027193325",
18
- "@pie-lib/drag": "5.0.8-next.20261103123052",
19
- "@pie-lib/editable-html-tip-tap": "3.1.3-next.20261103123052",
20
- "@pie-lib/graphing-utils": "4.0.3-next.20261026212738",
21
- "@pie-lib/plot": "5.0.8-next.20261103123052",
22
- "@pie-lib/render-ui": "8.0.8-next.20261103123052",
23
- "@pie-lib/tools": "3.0.3-next.20261026212738",
24
- "@pie-lib/translator": "5.0.3-next.20261103123052",
19
+ "@pie-lib/drag": "5.0.8-next.20261107131445",
20
+ "@pie-lib/editable-html-tip-tap": "3.1.3-next.20261109072207",
21
+ "@pie-lib/graphing-utils": "4.0.3-next.20261107131445",
22
+ "@pie-lib/plot": "5.0.8-next.20261109072207",
23
+ "@pie-lib/render-ui": "8.0.8-next.20261106152257",
24
+ "@pie-lib/tools": "3.0.3-next.20261107131445",
25
+ "@pie-lib/translator": "5.0.3-next.20261109072207",
25
26
  "@visx/axis": "^4.0.0",
26
27
  "@visx/clip-path": "^4.0.0",
27
28
  "@visx/curve": "^4.0.0",
@@ -41,7 +42,7 @@
41
42
  "redux-undo": "^1.1.0",
42
43
  "@pie-element/shared-lodash": "0.1.4-next.20261026212738",
43
44
  "clsx": "^2.1.1",
44
- "@pie-lib/config-ui": "14.0.8-next.20261103123052",
45
+ "@pie-lib/config-ui": "14.0.8-next.20261109072207",
45
46
  "@dnd-kit/core": "^6.3.1",
46
47
  "@dnd-kit/utilities": "^3.2.2",
47
48
  "d3-shape": "^3.2.0"