@pie-lib/charting 8.0.1-next.20261004005223 → 8.0.1-next.20261004011201

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 {};
package/dist/chart.d.ts CHANGED
@@ -1,5 +1,15 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ export declare const chartAlternative: ({ title, chartType, categories, range, language }: {
4
+ title: any;
5
+ chartType: any;
6
+ categories: any;
7
+ range: any;
8
+ language: any;
9
+ }) => {
10
+ ariaLabel: string;
11
+ ariaDescription: string;
12
+ };
3
13
  export declare class Chart extends React.Component {
4
14
  constructor(props: any);
5
15
  static propTypes: {
package/dist/chart.js CHANGED
@@ -8,12 +8,34 @@ import l from "prop-types";
8
8
  import { styled as u } from "@mui/material/styles";
9
9
  import d from "debug";
10
10
  import { cloneDeep as f } from "@pie-element/shared-lodash";
11
- import { Root as p, createGraphProps as m } from "@pie-lib/plot";
12
- import { AlertDialog as h } from "@pie-lib/config-ui";
13
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
14
- import v from "@pie-lib/translator";
11
+ import { Root as p, createGraphProps as m, utils as h } from "@pie-lib/plot";
12
+ import { AlertDialog as g } from "@pie-lib/config-ui";
13
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
14
+ import y from "@pie-lib/translator";
15
15
  //#region src/chart.tsx
16
- var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({ width: "min-content" })), S = class extends c.Component {
16
+ var { translator: b } = y, ee = d("pie-lib:charts:chart"), x = u("div")(() => ({ width: "min-content" })), S = (e) => e ? h.extractTextFromHTML(e).trim() : "", C = ({ title: e, chartType: t, categories: n, range: r, language: i }) => {
17
+ let a = {
18
+ lng: i,
19
+ interpolation: { escapeValue: !1 }
20
+ }, o = b.t(`charting.chartTypes.${t}`, a), s = S(r.label), c = s ? b.t("charting.labelledValueRange", {
21
+ ...a,
22
+ label: s,
23
+ min: r.min,
24
+ max: r.max
25
+ }) : b.t("charting.valueRange", {
26
+ ...a,
27
+ min: r.min,
28
+ max: r.max
29
+ }), l = b.t("charting.categories", {
30
+ ...a,
31
+ count: n.length,
32
+ categories: n.map((e) => S(e.label)).join(", ")
33
+ });
34
+ return {
35
+ ariaLabel: S(e) || o,
36
+ ariaDescription: `${o}. ${l} ${c}`
37
+ };
38
+ }, w = class extends c.Component {
17
39
  constructor(e) {
18
40
  super(e), this.state = {
19
41
  dialog: { open: !1 },
@@ -114,15 +136,15 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
114
136
  let { onDataChange: e, data: t, categoryDefaultLabel: n, defineChart: r, categoryDefaults: i, language: a } = this.props;
115
137
  (t || []).length > 19 ? this.setState({ dialog: {
116
138
  open: !0,
117
- title: y.t("common:warning", { lng: a }),
118
- text: y.t("charting.reachedLimit_other", {
139
+ title: b.t("common:warning", { lng: a }),
140
+ text: b.t("charting.reachedLimit_other", {
119
141
  count: 20,
120
142
  lng: a
121
143
  }),
122
144
  onConfirm: () => this.handleAlertDialog(!1)
123
145
  } }) : (this.setState({ autoFocus: !0 }), e([...t, {
124
146
  inDefineChart: r,
125
- label: n || y.t("charting.newLabel", { lng: a }),
147
+ label: n || b.t("charting.newLabel", { lng: a }),
126
148
  value: 0,
127
149
  deletable: !0,
128
150
  editable: !i || i?.editable,
@@ -144,27 +166,36 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
144
166
  this.setState({ autoFocus: !1 });
145
167
  };
146
168
  render() {
147
- let { domain: o = {}, range: c = {}, chartingOptions: l, size: u, title: d, onChangeTitle: v, onChangeLabels: y, labelsPlaceholders: S, titlePlaceholder: C, addCategoryEnabled: w, changeInteractiveEnabled: T, changeEditableEnabled: E, showPixelGuides: D, error: O, mathMlOptions: k = {}, language: A, labelsCharactersLimit: j, correctData: M } = this.props, { chartType: N } = this.props, { dialog: P } = this.state, F = this.props.defineChart || !1, { width: I, height: L } = u || {}, R = {
169
+ let { domain: o = {}, range: c = {}, chartingOptions: l, size: u, title: d, onChangeTitle: h, onChangeLabels: y, labelsPlaceholders: b, titlePlaceholder: S, addCategoryEnabled: w, changeInteractiveEnabled: T, changeEditableEnabled: E, showPixelGuides: D, error: O, mathMlOptions: k = {}, language: A, labelsCharactersLimit: j, correctData: M } = this.props, { chartType: N } = this.props, { dialog: P } = this.state, F = this.props.defineChart || !1, { width: I, height: L } = u || {}, R = {
148
170
  left: c?.label || "",
149
171
  bottom: o?.label || ""
150
- }, { ChartComponent: z } = this.getChart(), B = this.getFilteredCategories(), V = n(o, c, N), { verticalLines: H, horizontalLines: U, leftAxis: W } = r(V.range, N), G = { graphProps: m(V.domain, V.range, u, () => this.rootNode) };
151
- b("[render] common:", G);
152
- let K = {
172
+ }, { type: z, ChartComponent: B } = this.getChart(), V = this.getFilteredCategories(), H = n(o, c, N), { ariaLabel: U, ariaDescription: W } = C({
173
+ title: d,
174
+ chartType: z,
175
+ categories: V,
176
+ range: {
177
+ ...H.range,
178
+ label: c.label
179
+ },
180
+ language: A
181
+ }), { verticalLines: G, horizontalLines: K, leftAxis: q } = r(H.range, N), J = { graphProps: m(H.domain, H.range, u, () => this.rootNode) };
182
+ ee("[render] common:", J);
183
+ let Y = {
153
184
  x: -10,
154
185
  y: -75,
155
186
  width: I + 20,
156
187
  height: L + 130
157
- }, { scale: q } = G.graphProps, J = t(q.x, B, I, N), Y = J.bandwidth() || q.x(V.domain.max) / B.length, X = F ? 160 : 60, Z = i(Y), Q = f(G);
158
- return Q.graphProps.size.height += Z + X, (N === "dotPlot" || N === "linePlot") && M?.length && R.bottom && (Q.graphProps.size.height += 25), /* @__PURE__ */ _(x, { children: [/* @__PURE__ */ _(p, {
188
+ }, { scale: X } = J.graphProps, Z = t(X.x, V, I, N), te = Z.bandwidth() || X.x(H.domain.max) / V.length, ne = F ? 160 : 60, Q = i(te), $ = f(J);
189
+ return $.graphProps.size.height += Q + ne, (N === "dotPlot" || N === "linePlot") && M?.length && R.bottom && ($.graphProps.size.height += 25), /* @__PURE__ */ v(x, { children: [/* @__PURE__ */ v(p, {
159
190
  title: d,
160
- onChangeTitle: v,
191
+ onChangeTitle: h,
161
192
  disabledTitle: !F,
162
193
  showTitle: !0,
163
194
  showLabels: !0,
164
195
  labels: R,
165
196
  onChangeLabels: y,
166
- labelsPlaceholders: S,
167
- titlePlaceholder: C,
197
+ labelsPlaceholders: b,
198
+ titlePlaceholder: S,
168
199
  defineChart: F,
169
200
  disabledLabels: !F,
170
201
  isChart: !0,
@@ -172,65 +203,67 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
172
203
  rootRef: (e) => this.rootNode = e,
173
204
  mathMlOptions: k,
174
205
  labelsCharactersLimit: j,
175
- ...Q,
206
+ ariaLabel: U,
207
+ ariaDescription: W,
208
+ ...$,
176
209
  children: [
177
- /* @__PURE__ */ g(e, {
178
- ...G,
179
- xBand: J,
180
- rowTickValues: U,
181
- columnTickValues: H
210
+ /* @__PURE__ */ _(e, {
211
+ ...J,
212
+ xBand: Z,
213
+ rowTickValues: K,
214
+ columnTickValues: G
182
215
  }),
183
- /* @__PURE__ */ g(a, {
216
+ /* @__PURE__ */ _(a, {
184
217
  autoFocus: this.state.autoFocus,
185
218
  onAutoFocusUsed: this.resetAutoFocus,
186
- ...G,
219
+ ...J,
187
220
  defineChart: F,
188
- categories: B,
189
- xBand: J,
190
- leftAxis: W,
221
+ categories: V,
222
+ xBand: Z,
223
+ leftAxis: q,
191
224
  onChange: this.changeData,
192
225
  onChangeCategory: this.changeCategory,
193
226
  chartingOptions: l,
194
227
  changeInteractiveEnabled: T,
195
228
  changeEditableEnabled: E,
196
- top: Z,
229
+ top: Q,
197
230
  error: O,
198
231
  showCorrectness: N === "linePlot" || N === "dotPlot",
199
232
  language: A
200
233
  }),
201
- w ? /* @__PURE__ */ g("foreignObject", {
234
+ w ? /* @__PURE__ */ _("foreignObject", {
202
235
  x: I,
203
236
  y: L - 16,
204
237
  width: I,
205
238
  height: L,
206
- children: /* @__PURE__ */ g("div", {
239
+ children: /* @__PURE__ */ _("div", {
207
240
  xmlns: "http://www.w3.org/1999/xhtml",
208
241
  style: {
209
242
  display: "flex",
210
243
  justifyContent: "flex-start"
211
244
  },
212
- children: /* @__PURE__ */ g(s, {
213
- categories: B,
245
+ children: /* @__PURE__ */ _(s, {
246
+ categories: V,
214
247
  addCategory: this.addCategory,
215
248
  deleteCategory: this.deleteCategory,
216
249
  language: A
217
250
  })
218
251
  })
219
252
  }) : null,
220
- /* @__PURE__ */ g("mask", {
253
+ /* @__PURE__ */ _("mask", {
221
254
  id: `${this.maskUid}`,
222
- children: /* @__PURE__ */ g("rect", {
223
- ...K,
255
+ children: /* @__PURE__ */ _("rect", {
256
+ ...Y,
224
257
  fill: "white"
225
258
  })
226
259
  }),
227
- /* @__PURE__ */ g("g", {
260
+ /* @__PURE__ */ _("g", {
228
261
  id: "marks",
229
262
  mask: `url('#${this.maskUid}')`,
230
- children: z && /* @__PURE__ */ g(z, {
231
- ...G,
232
- data: B,
233
- height: Q.graphProps.size.height,
263
+ children: B && /* @__PURE__ */ _(B, {
264
+ ...J,
265
+ data: V,
266
+ height: $.graphProps.size.height,
234
267
  defineChart: F,
235
268
  onChange: this.changeData,
236
269
  onChangeCategory: this.changeCategory,
@@ -238,7 +271,7 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
238
271
  })
239
272
  })
240
273
  ]
241
- }), /* @__PURE__ */ g(h, {
274
+ }), /* @__PURE__ */ _(g, {
242
275
  open: P.open,
243
276
  title: P.title,
244
277
  text: P.text,
@@ -248,4 +281,4 @@ var { translator: y } = v, b = d("pie-lib:charts:chart"), x = u("div")(() => ({
248
281
  }
249
282
  };
250
283
  //#endregion
251
- export { S as Chart, S as default };
284
+ export { w as Chart, w as default, C as chartAlternative };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/charting",
3
- "version": "8.0.1-next.20261004005223",
3
+ "version": "8.0.1-next.20261004011201",
4
4
  "description": "charting",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,9 +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.1-next.20261004003105",
16
+ "@pie-lib/plot": "5.0.1-next.20261004011201",
17
17
  "@pie-lib/render-ui": "8.0.1-next.20261003161149",
18
- "@pie-lib/translator": "5.0.1-next.20261004005223",
18
+ "@pie-lib/translator": "5.0.1-next.20261004011201",
19
19
  "@visx/axis": "^4.0.0",
20
20
  "@visx/event": "^4.0.0",
21
21
  "@visx/grid": "^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.1-next.20261004003105",
32
+ "@pie-lib/config-ui": "14.0.1-next.20261004011201",
33
33
  "@pie-element/shared-math-rendering-mathjax": "0.1.2-next.20261003161149",
34
34
  "@pie-element/shared-lodash": "0.1.2-next.20261002215153",
35
35
  "clsx": "^2.1.1",