@oliasoft-open-source/charts-library 2.17.3 → 2.17.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "2.17.3",
3
+ "version": "2.17.4",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
6
6
  "bugs": {
@@ -49,8 +49,8 @@
49
49
  "@babel/eslint-parser": "^7.18.9",
50
50
  "@babel/preset-env": "^7.18.10",
51
51
  "@babel/preset-react": "^7.18.6",
52
- "@oliasoft-open-source/react-ui-library": "3.3.12",
53
- "@oliasoft-open-source/units": "2.6.1",
52
+ "@oliasoft-open-source/react-ui-library": "^3.4.2",
53
+ "@oliasoft-open-source/units": "^2.6.1",
54
54
  "@storybook/addon-actions": "^6.5.10",
55
55
  "@storybook/addon-docs": "^6.5.10",
56
56
  "@storybook/addon-links": "^6.5.10",
@@ -95,7 +95,7 @@
95
95
  "webpack-merge": "^5.8.0"
96
96
  },
97
97
  "peerDependencies": {
98
- "@oliasoft-open-source/react-ui-library": "^3",
98
+ "@oliasoft-open-source/react-ui-library": "^3.4.2",
99
99
  "@oliasoft-open-source/units": "^2.6.1",
100
100
  "immer": "^9",
101
101
  "prop-types": "^15",
package/release-notes.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Charts Library Release Notes
2
2
 
3
+ ## 2.17.4
4
+
5
+ - Use new `<NumberInput>` component from GUI Library in charts controls, to simplify validation ([OW-11773](https://oliasoft.atlassian.net/browse/OW-11773))
6
+
3
7
  ## 2.17.3
4
8
 
5
- - Replace legacy internal implementation of `isEqualWithTolerance` with `isCloseTo` from units package [OW-11767](https://oliasoft.atlassian.net/browse/OW-11767)
9
+ - Replace legacy internal implementation of `isEqualWithTolerance` with `isCloseTo` from units package ([OW-11767](https://oliasoft.atlassian.net/browse/OW-11767))
6
10
 
7
11
  ## 2.17.2
8
12
 
@@ -4,7 +4,7 @@ import {
4
4
  ButtonGroup,
5
5
  Field,
6
6
  Flex,
7
- Input,
7
+ NumberInput,
8
8
  InputGroup,
9
9
  InputGroupAddon,
10
10
  Popover,
@@ -122,7 +122,7 @@ const AxesOptionsPopover = ({
122
122
  return (
123
123
  <Field key={i} label={axisLabel || axis.id || ''}>
124
124
  <InputGroup small>
125
- <Input
125
+ <NumberInput
126
126
  name="min"
127
127
  value={min}
128
128
  error={translations[minError]}
@@ -138,7 +138,7 @@ const AxesOptionsPopover = ({
138
138
  onFocus={handleInputFocus}
139
139
  />
140
140
  <InputGroupAddon>to</InputGroupAddon>
141
- <Input
141
+ <NumberInput
142
142
  name="max"
143
143
  value={max}
144
144
  error={translations[maxError]}
@@ -1,9 +1,5 @@
1
1
  import { produce } from 'immer';
2
- import {
3
- isGreaterThanMin,
4
- isLessThanMax,
5
- validNumber,
6
- } from '../../utils/line-chart-utils';
2
+ import { isGreaterThanMin, isLessThanMax } from '../../utils/line-chart-utils';
7
3
  import { actionTypes } from './action-types';
8
4
 
9
5
  /**
@@ -37,7 +33,6 @@ const isEmptyString = (value) => value === '';
37
33
  const createErrorMessages = (value, compareTo, type) => {
38
34
  const errors = [];
39
35
  if (isEmptyString(value)) errors.push('mustHaveAValue');
40
- if (!validNumber(value)) errors.push('mustBeANumber');
41
36
 
42
37
  if (type === 'min' && !isLessThanMax(value, compareTo)) {
43
38
  errors.push('mustBeLessThanMax');
@@ -1,8 +1,4 @@
1
- import { toNum as toNumber, isValidNum } from '@oliasoft-open-source/units';
2
-
3
- const isOnlyNumbers = (str) => /^-?\d*\.?\d+$/.test(str);
4
-
5
- export const validNumber = (input) => isValidNum(input) && isOnlyNumbers(input);
1
+ import { toNum as toNumber } from '@oliasoft-open-source/units';
6
2
 
7
3
  export const toNum = (value) => {
8
4
  const asNumber = toNumber(value);