@oliasoft-open-source/charts-library 4.3.11 → 4.3.12

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/index.js CHANGED
@@ -11,7 +11,7 @@ import React__default, { forwardRef, useRef, useEffect, createContext as createC
11
11
  import { produce } from "immer";
12
12
  import { round as round$2, displayNumber, isCloseTo, roundByMagnitude } from "@oliasoft-open-source/units";
13
13
  import cx from "classnames";
14
- import { Icon, Tooltip as Tooltip$2, Button, Flex, Text, Menu, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Portal } from "@oliasoft-open-source/react-ui-library";
14
+ import { Portal, Icon, Tooltip as Tooltip$2, Button, Flex, Text, Menu, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer } from "@oliasoft-open-source/react-ui-library";
15
15
  import { isEmpty, isArray as isArray$2, some, has, cloneDeep, defaultTo, findIndex, set as set$2, debounce as debounce$3, isNil, map as map$3, find, get as get$1 } from "lodash";
16
16
  import { roundNumberToPrecision } from "@oliasoft-open-source/units/dist/rounding/rounding";
17
17
  /*!
@@ -22784,6 +22784,15 @@ const initialState = ({ options, persistenceId }) => {
22784
22784
  initialAxesRanges: []
22785
22785
  };
22786
22786
  };
22787
+ const ControlsPortal = ({
22788
+ children,
22789
+ controlsPortalId
22790
+ }) => {
22791
+ if (controlsPortalId) {
22792
+ return /* @__PURE__ */ jsx(Portal, { id: controlsPortalId, children });
22793
+ }
22794
+ return children;
22795
+ };
22787
22796
  const SvgLineOnly = (props) => /* @__PURE__ */ React.createElement("svg", { fill: "currentColor", height: "1em", viewBox: "0 0 12 12", width: "1em", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", ...props }, /* @__PURE__ */ React.createElement("clipPath", { id: "a" }, /* @__PURE__ */ React.createElement("path", { d: "m0 0h12v12h-12z" })), /* @__PURE__ */ React.createElement("g", { clipPath: "url(#a)" }, /* @__PURE__ */ React.createElement("path", { d: "m.5 6.5v-1h11v1c-4.16104 0-6.63549 0-11 0z" })));
22788
22797
  const SvgPointOnly = (props) => /* @__PURE__ */ React.createElement("svg", { fill: "currentColor", height: "1em", viewBox: "0 0 12 12", width: "1em", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("circle", { cx: 6, cy: 6, r: 2 }));
22789
22798
  const SvgLineAndPoint = (props) => /* @__PURE__ */ React.createElement("svg", { fill: "currentColor", height: "1em", viewBox: "0 0 12 12", width: "1em", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", ...props }, /* @__PURE__ */ React.createElement("clipPath", { id: "a" }, /* @__PURE__ */ React.createElement("path", { d: "m0 0h12v12h-12z" })), /* @__PURE__ */ React.createElement("g", { clipPath: "url(#a)" }, /* @__PURE__ */ React.createElement("path", { d: "m7.937 6.5c-.11122.42912-.36179.80916-.71237 1.08047-.35058.2713-.78133.4185-1.22463.4185s-.87405-.1472-1.22463-.4185c-.35058-.27131-.60115-.65135-.71237-1.08047h-3.563v-1h3.563c.11122-.42912.36179-.80916.71237-1.08046s.78133-.41851 1.22463-.41851.87405.14721 1.22463.41851.60115.65134.71237 1.08046h3.563v1z" })));
@@ -24449,15 +24458,6 @@ const AxesOptions = (optionsPopover) => {
24449
24458
  }
24450
24459
  );
24451
24460
  };
24452
- const ControlsPortal = ({
24453
- children,
24454
- controlsPortalId
24455
- }) => {
24456
- if (controlsPortalId && document.getElementById(controlsPortalId)) {
24457
- return /* @__PURE__ */ jsx(Portal, { id: controlsPortalId, children });
24458
- }
24459
- return children;
24460
- };
24461
24461
  const Controls = ({
24462
24462
  headerComponent,
24463
24463
  subheaderComponent,
@@ -40062,6 +40062,7 @@ const getDefaultProps$1 = (props) => {
40062
40062
  const options = (chart2 == null ? void 0 : chart2.options) || {};
40063
40063
  return {
40064
40064
  testId: (chart2 == null ? void 0 : chart2.testId) ?? "",
40065
+ controlsPortalId: (chart2 == null ? void 0 : chart2.controlsPortalId) ?? "",
40065
40066
  data: chart2 == null ? void 0 : chart2.data,
40066
40067
  options: {
40067
40068
  title: (options == null ? void 0 : options.title) || "",
@@ -40103,7 +40104,7 @@ const BarChart = (props) => {
40103
40104
  const chartRef = useRef(null);
40104
40105
  const chart2 = getDefaultProps$1(props);
40105
40106
  const { translations, languageKey } = getConfig();
40106
- const { options, testId } = chart2;
40107
+ const { options, testId, controlsPortalId } = chart2;
40107
40108
  const { chartStyling, graph } = options;
40108
40109
  const { generatedDatasets } = useBarChartConfig(chartRef, chart2);
40109
40110
  const barChartOptions = useBarChartOptions({ chart: chart2, chartRef });
@@ -40118,7 +40119,7 @@ const BarChart = (props) => {
40118
40119
  },
40119
40120
  "data-testid": testId,
40120
40121
  children: [
40121
- /* @__PURE__ */ jsx("div", { className: styles$1.actions, children: /* @__PURE__ */ jsx(Tooltip$2, { text: translations.downloadAsPNG, placement: "bottom-end", children: /* @__PURE__ */ jsx(
40122
+ /* @__PURE__ */ jsx(ControlsPortal, { controlsPortalId, children: /* @__PURE__ */ jsx("div", { className: styles$1.actions, children: /* @__PURE__ */ jsx(Tooltip$2, { text: translations.downloadAsPNG, placement: "bottom-end", children: /* @__PURE__ */ jsx(
40122
40123
  Button,
40123
40124
  {
40124
40125
  small: true,
@@ -40128,7 +40129,7 @@ const BarChart = (props) => {
40128
40129
  icon: "download",
40129
40130
  onClick: () => downloadPgn(chartRef)
40130
40131
  }
40131
- ) }) }),
40132
+ ) }) }) }),
40132
40133
  /* @__PURE__ */ jsx(DndProvider, { backend: HTML5Backend, context: window, children: /* @__PURE__ */ jsxs("div", { className: styles$1.canvas, id: "canvas", children: [
40133
40134
  /* @__PURE__ */ jsx(
40134
40135
  Bar,