@synerise/ds-condition 0.22.39 → 0.23.0

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,28 @@
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.23.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.22.40...@synerise/ds-condition@0.23.0) (2024-08-30)
7
+
8
+
9
+ ### Features
10
+
11
+ * **storybook7:** condition stories ([50c3613](https://github.com/Synerise/synerise-design/commit/50c36138dfd1097fe3b1182047eded4bbea584e9))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.22.40](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.22.39...@synerise/ds-condition@0.22.40) (2024-08-27)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **factors:** btn color for selected parameter factor ([ef17cbb](https://github.com/Synerise/synerise-design/commit/ef17cbb394078fa27bad346c6f926521ad892aa4))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [0.22.39](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@0.22.38...@synerise/ds-condition@0.22.39) (2024-08-19)
7
29
 
8
30
  **Note:** Version bump only for package @synerise/ds-condition
@@ -1,3 +1,3 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import * as T from './ConditionRow.types';
3
- export declare const ConditionRow: React.FC<T.ConditionRowProps>;
3
+ export declare const ConditionRow: ({ index, conditionId, conditionParameter, conditionOperator, conditionFactor, removeCondition, addCondition, minConditionLength, maxConditionLength, conditionsNumber, stepId, currentStepId, currentConditionId, currentField, selectParameter, selectOperator, setStepConditionFactorType, setStepConditionFactorValue, getPopupContainerOverride, onActivate, hasPriority, texts, onDeactivate, inputProps, readOnly, }: T.ConditionRowProps) => React.JSX.Element;
@@ -1,15 +1,20 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
+
7
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+
9
+ import React, { useMemo } from 'react';
3
10
  import Factors from '@synerise/ds-factors';
4
11
  import Operators from '@synerise/ds-operators';
5
12
  import Tooltip from '@synerise/ds-tooltip';
6
13
  import Icon, { CloseS } from '@synerise/ds-icon';
7
14
  import { theme } from '@synerise/ds-core';
8
15
  import { getPopupContainer } from '@synerise/ds-utils';
9
- import * as React from 'react';
10
16
  import { FACTOR, OPERATOR, PARAMETER } from '../../constants';
11
17
  import * as S from '../../Condition.style';
12
- // eslint-disable-next-line import/prefer-default-export
13
18
  export var ConditionRow = function ConditionRow(_ref) {
14
19
  var index = _ref.index,
15
20
  conditionId = _ref.conditionId,
@@ -41,7 +46,7 @@ export var ConditionRow = function ConditionRow(_ref) {
41
46
  var conditionParameterErrorText = conditionParameter == null ? void 0 : conditionParameter.errorText;
42
47
  var conditionOperatorErrorText = conditionOperator == null ? void 0 : conditionOperator.errorText;
43
48
  var rowHasError = !!(conditionParameterErrorText || conditionOperatorErrorText || conditionFactorErrorText);
44
- var conditionErrorMessage = React.useMemo(function () {
49
+ var conditionErrorMessage = useMemo(function () {
45
50
  var errorText;
46
51
 
47
52
  if (conditionParameterErrorText) {
@@ -79,6 +84,15 @@ export var ConditionRow = function ConditionRow(_ref) {
79
84
  lastConditionWrapper = 'parameter';
80
85
  }
81
86
 
87
+ var conditionFactorProps = useMemo(function () {
88
+ var _conditionFactor$para, _conditionFactor$para2;
89
+
90
+ return _objectSpread({}, conditionFactor, {
91
+ parameters: (conditionFactor == null ? void 0 : conditionFactor.parameters) && _objectSpread({}, conditionFactor.parameters, {
92
+ selectedButtonColored: ((_conditionFactor$para = conditionFactor.parameters) == null ? void 0 : _conditionFactor$para.selectedButtonColored) === undefined ? true : (_conditionFactor$para2 = conditionFactor.parameters) == null ? void 0 : _conditionFactor$para2.selectedButtonColored
93
+ })
94
+ });
95
+ }, [conditionFactor]);
82
96
  return /*#__PURE__*/React.createElement(S.ConditionRow, {
83
97
  "data-testid": "condition-row",
84
98
  onlyChild: maxConditionLength === 1,
@@ -126,7 +140,7 @@ export var ConditionRow = function ConditionRow(_ref) {
126
140
  })), lastConditionWrapper === 'operator' && removeConditionTrigger), renderConditionFactorWrapper && /*#__PURE__*/React.createElement(S.ConditionWrapper, {
127
141
  "data-testid": "condition-factor-wrapper",
128
142
  withRemoveTrigger: lastConditionWrapper === 'factor'
129
- }, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({}, conditionFactor, {
143
+ }, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({}, conditionFactorProps, {
130
144
  inputProps: inputProps,
131
145
  getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
132
146
  onActivate: function onActivate() {
@@ -140,7 +154,7 @@ export var ConditionRow = function ConditionRow(_ref) {
140
154
  return setStepConditionFactorValue(stepId, conditionId, value);
141
155
  },
142
156
  factorKey: conditionId,
143
- error: Boolean(conditionFactor.errorText),
157
+ error: Boolean(conditionFactorProps.errorText),
144
158
  opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === FACTOR,
145
159
  readOnly: readOnly
146
160
  })), lastConditionWrapper === 'factor' && removeConditionTrigger)), conditionErrorMessage));
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default } from './Condition';
2
2
  export type { ConditionStepCrudActions } from './ConditionStep/ConditionStep.types';
3
+ export type { ConditionProps, ConditionStep, ConditionTexts, StepConditions } from './Condition.types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-condition",
3
- "version": "0.22.39",
3
+ "version": "0.23.0",
4
4
  "description": "Condition UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,16 +33,16 @@
33
33
  ],
34
34
  "types": "dist/index.d.ts",
35
35
  "dependencies": {
36
- "@synerise/ds-button": "^0.21.5",
37
- "@synerise/ds-context-selector": "^0.24.4",
38
- "@synerise/ds-cruds": "^0.5.15",
39
- "@synerise/ds-factors": "^0.23.6",
40
- "@synerise/ds-icon": "^0.65.0",
41
- "@synerise/ds-inline-edit": "^0.8.5",
42
- "@synerise/ds-input": "^0.23.6",
43
- "@synerise/ds-operators": "^0.11.6",
44
- "@synerise/ds-subject": "^0.10.9",
45
- "@synerise/ds-tooltip": "^0.14.35",
36
+ "@synerise/ds-button": "^0.21.7",
37
+ "@synerise/ds-context-selector": "^0.24.6",
38
+ "@synerise/ds-cruds": "^0.5.17",
39
+ "@synerise/ds-factors": "^0.24.0",
40
+ "@synerise/ds-icon": "^0.65.2",
41
+ "@synerise/ds-inline-edit": "^0.8.7",
42
+ "@synerise/ds-input": "^0.24.1",
43
+ "@synerise/ds-operators": "^0.12.0",
44
+ "@synerise/ds-subject": "^0.10.11",
45
+ "@synerise/ds-tooltip": "^0.14.37",
46
46
  "@synerise/ds-utils": "^0.28.2",
47
47
  "lodash": "^4.17.19",
48
48
  "react-intl": "3.12.0",
@@ -54,5 +54,5 @@
54
54
  "react": ">=16.9.0 <= 17.0.2",
55
55
  "styled-components": "5.0.1"
56
56
  },
57
- "gitHead": "2e6de17b64023536c24be8fcb67b1e53e8bffa3d"
57
+ "gitHead": "d5df67eecdc1cbcb56def8c17d04b7d883876fbf"
58
58
  }