@oliasoft-open-source/charts-library 4.7.0-beta-5 → 4.7.0-beta-6

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 { Portal, Icon, Menu, Tooltip as Tooltip$2, Button, Text, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Flex } from "@oliasoft-open-source/react-ui-library";
14
+ import { Portal, Icon, Menu, Tooltip as Tooltip$2, Button, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Flex, Text } 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
  /*!
17
17
  * @kurkle/color v0.3.2
@@ -22892,20 +22892,7 @@ function getLineOptions({
22892
22892
  }
22893
22893
  ];
22894
22894
  }
22895
- const LineOptions = ({
22896
- lineEnabled,
22897
- onToggleLine,
22898
- onTogglePoints,
22899
- pointsEnabled,
22900
- translations
22901
- }) => {
22902
- const options = getLineOptions({
22903
- lineEnabled,
22904
- onToggleLine,
22905
- onTogglePoints,
22906
- pointsEnabled,
22907
- translations
22908
- });
22895
+ const LineOptions = ({ options }) => {
22909
22896
  const [menuOpen, setMenuOpen] = useState(false);
22910
22897
  const selectedOption = options.find((option) => option.selected);
22911
22898
  return /* @__PURE__ */ jsx(
@@ -23062,8 +23049,8 @@ function getDragOptions({
23062
23049
  }) {
23063
23050
  return [
23064
23051
  {
23065
- buttonLabel: dragToZoom,
23066
23052
  label: dragToZoom,
23053
+ description: doubleClickToReset,
23067
23054
  icon: /* @__PURE__ */ jsx(TbZoomIn, {}),
23068
23055
  selected: zoomEnabled,
23069
23056
  type: "Option",
@@ -23073,8 +23060,8 @@ function getDragOptions({
23073
23060
  }
23074
23061
  },
23075
23062
  {
23076
- buttonLabel: dragToPan,
23077
23063
  label: dragToPan,
23064
+ description: doubleClickToReset,
23078
23065
  icon: /* @__PURE__ */ jsx(TbArrowsMove, {}),
23079
23066
  selected: panEnabled,
23080
23067
  type: "Option",
@@ -23113,59 +23100,10 @@ function getDragOptions({
23113
23100
  selected: !zoomEnabled && !panEnabled && !enableDragPoints && !enableDragAnnotation,
23114
23101
  type: "Option",
23115
23102
  onClick: onDisableDragOptions
23116
- },
23117
- {
23118
- label: /* @__PURE__ */ jsx(Text, { small: true, muted: true, children: doubleClickToReset }),
23119
- type: "Option",
23120
- disabled: true
23121
23103
  }
23122
23104
  ];
23123
23105
  }
23124
- const DragOptions = ({
23125
- onTogglePan,
23126
- onToggleZoom,
23127
- panEnabled,
23128
- zoomEnabled,
23129
- enableDragPoints,
23130
- enableDragAnnotation,
23131
- isDragDataAllowed,
23132
- isDragAnnotationAllowed,
23133
- onToggleDragAnnotation,
23134
- onToggleDragPoints,
23135
- onDisableDragOptions,
23136
- translations: {
23137
- dragToZoom,
23138
- doubleClickToReset,
23139
- dragToPan,
23140
- dragToMovePoints,
23141
- dragDisabled,
23142
- dragToMoveAnnotation
23143
- }
23144
- }) => {
23145
- const options = useMemo(
23146
- () => getDragOptions({
23147
- onTogglePan,
23148
- onToggleZoom,
23149
- panEnabled,
23150
- zoomEnabled,
23151
- enableDragPoints,
23152
- enableDragAnnotation,
23153
- isDragDataAllowed,
23154
- isDragAnnotationAllowed,
23155
- onToggleDragAnnotation,
23156
- onToggleDragPoints,
23157
- onDisableDragOptions,
23158
- translations: {
23159
- dragToZoom,
23160
- doubleClickToReset,
23161
- dragToPan,
23162
- dragToMovePoints,
23163
- dragDisabled,
23164
- dragToMoveAnnotation
23165
- }
23166
- }),
23167
- [zoomEnabled, panEnabled, enableDragPoints, isDragDataAllowed]
23168
- );
23106
+ const DragOptions = ({ options }) => {
23169
23107
  const selectedOption = options.find((option) => option.selected);
23170
23108
  return /* @__PURE__ */ jsx(
23171
23109
  Menu,
@@ -23179,7 +23117,7 @@ const DragOptions = ({
23179
23117
  colored: "muted",
23180
23118
  basic: true,
23181
23119
  small: true,
23182
- label: (selectedOption == null ? void 0 : selectedOption.buttonLabel) || (selectedOption == null ? void 0 : selectedOption.label),
23120
+ label: selectedOption == null ? void 0 : selectedOption.label,
23183
23121
  icon: selectedOption == null ? void 0 : selectedOption.icon
23184
23122
  }
23185
23123
  )
@@ -24643,6 +24581,39 @@ const Controls = ({
24643
24581
  });
24644
24582
  const [measureRef, { width }] = useMeasure$1();
24645
24583
  const isNarrow = width < 200;
24584
+ const lineOptions = useMemo(
24585
+ () => getLineOptions({
24586
+ lineEnabled,
24587
+ onToggleLine,
24588
+ onTogglePoints,
24589
+ pointsEnabled,
24590
+ translations
24591
+ }),
24592
+ [lineEnabled, pointsEnabled]
24593
+ );
24594
+ const dragOptions = useMemo(
24595
+ () => getDragOptions({
24596
+ onTogglePan,
24597
+ onToggleZoom,
24598
+ panEnabled,
24599
+ zoomEnabled,
24600
+ enableDragPoints,
24601
+ enableDragAnnotation,
24602
+ isDragDataAllowed: dragData == null ? void 0 : dragData.enableDragData,
24603
+ isDragAnnotationAllowed: annotations == null ? void 0 : annotations.enableDragAnnotation,
24604
+ onToggleDragAnnotation,
24605
+ onToggleDragPoints,
24606
+ onDisableDragOptions,
24607
+ translations
24608
+ }),
24609
+ [
24610
+ zoomEnabled,
24611
+ panEnabled,
24612
+ enableDragPoints,
24613
+ dragData == null ? void 0 : dragData.enableDragData,
24614
+ annotations == null ? void 0 : annotations.enableDragAnnotation
24615
+ ]
24616
+ );
24646
24617
  return /* @__PURE__ */ jsxs(Fragment, { children: [
24647
24618
  /* @__PURE__ */ jsxs("div", { className: styles$4.controls, children: [
24648
24619
  !!options.title && /* @__PURE__ */ jsx(Text, { bold: true, children: options.title }),
@@ -24672,36 +24643,11 @@ const Controls = ({
24672
24643
  menu: {
24673
24644
  placement: "bottom-end",
24674
24645
  sections: [
24675
- ...getLineOptions({
24676
- lineEnabled,
24677
- onToggleLine,
24678
- onTogglePoints,
24679
- pointsEnabled,
24680
- translations
24681
- }).map((option) => ({
24682
- ...option,
24683
- type: "Option"
24684
- })),
24646
+ ...lineOptions,
24685
24647
  {
24686
24648
  type: "Divider"
24687
24649
  },
24688
- ...getDragOptions({
24689
- onTogglePan,
24690
- onToggleZoom,
24691
- panEnabled,
24692
- zoomEnabled,
24693
- enableDragPoints,
24694
- enableDragAnnotation,
24695
- isDragDataAllowed: dragData == null ? void 0 : dragData.enableDragData,
24696
- isDragAnnotationAllowed: annotations == null ? void 0 : annotations.enableDragAnnotation,
24697
- onToggleDragAnnotation,
24698
- onToggleDragPoints,
24699
- onDisableDragOptions,
24700
- translations
24701
- }).map((option) => ({
24702
- ...option,
24703
- type: "Option"
24704
- })),
24650
+ ...dragOptions,
24705
24651
  {
24706
24652
  type: "Divider"
24707
24653
  },
@@ -24717,16 +24663,7 @@ const Controls = ({
24717
24663
  }
24718
24664
  }
24719
24665
  ) : /* @__PURE__ */ jsxs(Fragment, { children: [
24720
- /* @__PURE__ */ jsx(
24721
- LineOptions,
24722
- {
24723
- lineEnabled,
24724
- pointsEnabled,
24725
- onToggleLine,
24726
- onTogglePoints,
24727
- translations
24728
- }
24729
- ),
24666
+ /* @__PURE__ */ jsx(LineOptions, { options: lineOptions }),
24730
24667
  /* @__PURE__ */ jsx(
24731
24668
  Tooltip$2,
24732
24669
  {
@@ -24746,23 +24683,7 @@ const Controls = ({
24746
24683
  )
24747
24684
  }
24748
24685
  ),
24749
- /* @__PURE__ */ jsx(
24750
- DragOptions,
24751
- {
24752
- panEnabled,
24753
- zoomEnabled,
24754
- onTogglePan,
24755
- onToggleZoom,
24756
- enableDragPoints,
24757
- enableDragAnnotation,
24758
- isDragDataAllowed: dragData == null ? void 0 : dragData.enableDragData,
24759
- isDragAnnotationAllowed: annotations == null ? void 0 : annotations.enableDragAnnotation,
24760
- onToggleDragAnnotation,
24761
- onToggleDragPoints,
24762
- onDisableDragOptions,
24763
- translations
24764
- }
24765
- )
24686
+ /* @__PURE__ */ jsx(DragOptions, { options: dragOptions })
24766
24687
  ] })
24767
24688
  ] }),
24768
24689
  table2 ? /* @__PURE__ */ jsx(