@synerise/ds-factors 0.20.5 → 0.20.7

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/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.20.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.20.6...@synerise/ds-factors@0.20.7) (2023-10-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **factors:** error validation for formula and date range factor type ([a9485dd](https://github.com/Synerise/synerise-design/commit/a9485dd239e8b5cf285ef5f2ab08f1d9b1993628))
12
+ * **factors:** pass error to number input ([1a76ef6](https://github.com/Synerise/synerise-design/commit/1a76ef686593e40bd4c0fe31405134220a2fa669))
13
+
14
+
15
+
16
+
17
+
18
+ ## [0.20.6](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.20.5...@synerise/ds-factors@0.20.6) (2023-10-11)
19
+
20
+ **Note:** Version bump only for package @synerise/ds-factors
21
+
22
+
23
+
24
+
25
+
6
26
  ## [0.20.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@0.20.4...@synerise/ds-factors@0.20.5) (2023-10-06)
7
27
 
8
28
  **Note:** Version bump only for package @synerise/ds-factors
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { InputProps } from '../../Factors.types';
3
- declare const DateRangeInput: React.FC<InputProps>;
2
+ declare const DateRangeInput: ({ value, onChange, error, texts, onDeactivate, readOnly }: InputProps) => JSX.Element;
4
3
  export default DateRangeInput;
@@ -1,19 +1,20 @@
1
- import * as React from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import DateRangePicker from '@synerise/ds-date-range-picker';
3
3
  import { useIntl } from 'react-intl';
4
4
 
5
5
  var DateRangeInput = function DateRangeInput(_ref) {
6
6
  var value = _ref.value,
7
7
  onChange = _ref.onChange,
8
+ error = _ref.error,
8
9
  texts = _ref.texts,
9
10
  onDeactivate = _ref.onDeactivate,
10
11
  _ref$readOnly = _ref.readOnly,
11
12
  readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
12
13
  var intl = useIntl();
13
- var changeHandler = React.useCallback(function (date) {
14
+ var changeHandler = useCallback(function (date) {
14
15
  onChange(date);
15
16
  }, [onChange]);
16
- var handleVisibleChange = React.useCallback(function (visible) {
17
+ var handleVisibleChange = useCallback(function (visible) {
17
18
  if (!visible) {
18
19
  onDeactivate && onDeactivate();
19
20
  }
@@ -36,7 +37,8 @@ var DateRangeInput = function DateRangeInput(_ref) {
36
37
  filterRangeDisplayMode: "slider",
37
38
  filterValueSelectionModes: ['Range'],
38
39
  rangePickerInputProps: {
39
- readOnly: readOnly
40
+ readOnly: readOnly,
41
+ error: error
40
42
  },
41
43
  readOnly: readOnly
42
44
  });
@@ -73,7 +73,7 @@ var DynamicKey = function DynamicKey(_ref) {
73
73
  error: localError || error,
74
74
  readOnly: readOnly
75
75
  }));
76
- return readOnly ? trigger : /*#__PURE__*/React.createElement(S.DynamicKey, {
76
+ return /*#__PURE__*/React.createElement(S.DynamicKey, {
77
77
  withoutTypeSelector: withoutTypeSelector
78
78
  }, trigger);
79
79
  };
@@ -4,5 +4,5 @@ export var DynamicKey = styled.div.withConfig({
4
4
  displayName: "DynamicKeystyle__DynamicKey",
5
5
  componentId: "sc-43cup-0"
6
6
  })(["display:flex;flex-direction:row;align-items:center;justify-content:flex-start;width:100%;.ant-input{flex:1;&:focus{z-index:2;}&:first-of-type{border-radius:", ";}&:last-of-type{border-radius:0 3px 3px 0;margin-left:-1px;}}"], function (props) {
7
- return props.withoutTypeSelector ? '3px 0 0 3px' : '0 3px 3px 0';
7
+ return props.withoutTypeSelector ? '3px 0 0 3px' : '0';
8
8
  });
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { InputProps } from '../../Factors.types';
3
- declare const FormulaInput: React.FC<InputProps>;
2
+ declare const FormulaInput: ({ value, error, onChange, withoutTypeSelector, texts, formulaEditor, readOnly, }: InputProps) => JSX.Element;
4
3
  export default FormulaInput;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React, { useState, useMemo, useCallback } from 'react';
2
2
  import Button from '@synerise/ds-button';
3
3
  import Icon, { EditS } from '@synerise/ds-icon';
4
4
  import Badge from '@synerise/ds-badge';
@@ -7,6 +7,7 @@ import * as S from './Formula.styles';
7
7
 
8
8
  var FormulaInput = function FormulaInput(_ref) {
9
9
  var value = _ref.value,
10
+ error = _ref.error,
10
11
  onChange = _ref.onChange,
11
12
  _ref$withoutTypeSelec = _ref.withoutTypeSelector,
12
13
  withoutTypeSelector = _ref$withoutTypeSelec === void 0 ? false : _ref$withoutTypeSelec,
@@ -15,41 +16,41 @@ var FormulaInput = function FormulaInput(_ref) {
15
16
  _ref$readOnly = _ref.readOnly,
16
17
  readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
17
18
 
18
- var _React$useState = React.useState(false),
19
- openFormulaModal = _React$useState[0],
20
- setOpenFormulaModal = _React$useState[1];
19
+ var _useState = useState(false),
20
+ openFormulaModal = _useState[0],
21
+ setOpenFormulaModal = _useState[1];
21
22
 
22
- var triggerMode = React.useMemo(function () {
23
+ var triggerMode = useMemo(function () {
23
24
  if (value) {
24
25
  return readOnly ? 'label-icon' : 'two-icons';
25
26
  }
26
27
 
27
28
  return readOnly ? 'simple' : 'label-icon';
28
29
  }, [value, readOnly]);
29
- var activeIcon = React.useMemo(function () {
30
+ var activeIcon = useMemo(function () {
30
31
  return value ? /*#__PURE__*/React.createElement(Badge, {
31
32
  flag: true,
32
33
  status: "active"
33
34
  }) : '';
34
35
  }, [value]);
35
- var label = React.useMemo(function () {
36
+ var label = useMemo(function () {
36
37
  return value ? value.name : texts.formula.buttonPlaceholder;
37
38
  }, [value, texts.formula.buttonPlaceholder]);
38
- var handleChange = React.useCallback(function (val) {
39
+ var handleChange = useCallback(function (val) {
39
40
  setOpenFormulaModal(false);
40
41
  onChange(val);
41
42
  }, [onChange]);
42
-
43
- var handleClick = function handleClick() {
43
+ var handleClick = !readOnly ? function () {
44
44
  return setOpenFormulaModal(true);
45
- };
46
-
45
+ } : undefined;
47
46
  return /*#__PURE__*/React.createElement(S.FormulaButton, {
48
47
  withoutTypeSelector: withoutTypeSelector
49
48
  }, /*#__PURE__*/React.createElement(Button, {
49
+ readOnly: readOnly,
50
50
  type: "secondary",
51
+ error: error,
51
52
  mode: triggerMode,
52
- onClick: !readOnly ? handleClick : undefined
53
+ onClick: handleClick
53
54
  }, activeIcon, label, /*#__PURE__*/React.createElement(Icon, {
54
55
  component: /*#__PURE__*/React.createElement(EditS, null)
55
56
  })), /*#__PURE__*/React.createElement(FormulaModal, {
@@ -3,7 +3,8 @@ import InputNumber from '@synerise/ds-input-number';
3
3
  import { debounce } from 'lodash';
4
4
 
5
5
  var NumberInput = function NumberInput(_ref) {
6
- var value = _ref.value,
6
+ var error = _ref.error,
7
+ value = _ref.value,
7
8
  onChange = _ref.onChange,
8
9
  texts = _ref.texts,
9
10
  opened = _ref.opened,
@@ -31,6 +32,7 @@ var NumberInput = function NumberInput(_ref) {
31
32
  setLocalValue(value);
32
33
  }, [value]);
33
34
  return /*#__PURE__*/React.createElement(InputNumber, {
35
+ error: error,
34
36
  autoFocus: opened,
35
37
  placeholder: texts.valuePlaceholder,
36
38
  value: localValue,
package/dist/Factors.d.ts CHANGED
@@ -29,7 +29,7 @@ export declare const factorTypes: {
29
29
  formula: {
30
30
  icon: JSX.Element;
31
31
  name: string;
32
- input: React.FC<import("./Factors.types").InputProps>;
32
+ input: ({ value, error, onChange, withoutTypeSelector, texts, formulaEditor, readOnly, }: import("./Factors.types").InputProps) => JSX.Element;
33
33
  };
34
34
  array: {
35
35
  icon: JSX.Element;
@@ -44,7 +44,7 @@ export declare const factorTypes: {
44
44
  dateRange: {
45
45
  icon: JSX.Element;
46
46
  name: string;
47
- input: React.FC<import("./Factors.types").InputProps>;
47
+ input: ({ value, onChange, error, texts, onDeactivate, readOnly }: import("./Factors.types").InputProps) => JSX.Element;
48
48
  };
49
49
  };
50
50
  declare const Factors: React.FC<FactorsProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-factors",
3
- "version": "0.20.5",
3
+ "version": "0.20.7",
4
4
  "description": "Factors UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -21,6 +21,7 @@
21
21
  "build:js": "babel --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
22
  "build:watch": "npm run build:js -- --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
+ "pack:ci": "npm pack --pack-destination ../../portal/storybook-static/static",
24
25
  "prepublish": "npm run build",
25
26
  "test": "jest",
26
27
  "test:watch": "npm run test -- --watchAll",
@@ -32,25 +33,25 @@
32
33
  ],
33
34
  "types": "dist/index.d.ts",
34
35
  "dependencies": {
35
- "@synerise/ds-autocomplete": "^0.5.3",
36
- "@synerise/ds-badge": "^0.6.38",
37
- "@synerise/ds-button": "^0.18.3",
38
- "@synerise/ds-date-picker": "^0.10.19",
39
- "@synerise/ds-date-range-picker": "^0.24.9",
40
- "@synerise/ds-dropdown": "^0.17.82",
41
- "@synerise/ds-icon": "^0.58.3",
42
- "@synerise/ds-information-card": "^0.3.40",
43
- "@synerise/ds-inline-edit": "^0.6.82",
44
- "@synerise/ds-input": "^0.19.3",
45
- "@synerise/ds-input-number": "^0.8.25",
46
- "@synerise/ds-loader": "^0.2.45",
47
- "@synerise/ds-menu": "^0.18.0",
48
- "@synerise/ds-modal": "^0.17.6",
49
- "@synerise/ds-result": "^0.6.32",
50
- "@synerise/ds-scrollbar": "^0.6.8",
51
- "@synerise/ds-tabs": "^0.13.80",
52
- "@synerise/ds-tooltip": "^0.14.5",
53
- "@synerise/ds-utils": "^0.24.17",
36
+ "@synerise/ds-autocomplete": "^0.5.4",
37
+ "@synerise/ds-badge": "^0.6.39",
38
+ "@synerise/ds-button": "^0.18.4",
39
+ "@synerise/ds-date-picker": "^0.10.21",
40
+ "@synerise/ds-date-range-picker": "^0.25.0",
41
+ "@synerise/ds-dropdown": "^0.17.83",
42
+ "@synerise/ds-icon": "^0.58.4",
43
+ "@synerise/ds-information-card": "^0.3.42",
44
+ "@synerise/ds-inline-edit": "^0.6.83",
45
+ "@synerise/ds-input": "^0.19.4",
46
+ "@synerise/ds-input-number": "^0.8.26",
47
+ "@synerise/ds-loader": "^0.2.46",
48
+ "@synerise/ds-menu": "^0.18.1",
49
+ "@synerise/ds-modal": "^0.17.7",
50
+ "@synerise/ds-result": "^0.6.33",
51
+ "@synerise/ds-scrollbar": "^0.6.9",
52
+ "@synerise/ds-tabs": "^0.13.81",
53
+ "@synerise/ds-tooltip": "^0.14.6",
54
+ "@synerise/ds-utils": "^0.24.18",
54
55
  "lodash": "^4.17.19",
55
56
  "react-intl": "3.12.0",
56
57
  "react-window": "1.8.5",
@@ -66,5 +67,5 @@
66
67
  "@testing-library/react": "10.0.1",
67
68
  "@testing-library/user-event": "^10.3.1"
68
69
  },
69
- "gitHead": "d944339a738211d8f74b27360481aafd7ef51ddd"
70
+ "gitHead": "02f0a1dad6df5acf89b3d3defa6993716ba992fb"
70
71
  }