@synerise/ds-condition 1.3.2 → 1.4.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,22 @@
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
+ # [1.4.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@1.3.2...@synerise/ds-condition@1.4.0) (2025-07-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **condition:** allow param button to use available space ([b3ea666](https://github.com/Synerise/synerise-design/commit/b3ea666417cd14440ceff58de2e91e58198bfd49))
12
+
13
+
14
+ ### Features
15
+
16
+ * **factors:** pass component props ([81f40dd](https://github.com/Synerise/synerise-design/commit/81f40dd18b3e7d88828d5e418efc94b1cb9eda91))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.3.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@1.3.1...@synerise/ds-condition@1.3.2) (2025-07-01)
7
23
 
8
24
  **Note:** Version bump only for package @synerise/ds-condition
package/dist/Condition.js CHANGED
@@ -48,7 +48,8 @@ var Condition = function Condition(props) {
48
48
  factorParameterSelectorComponent = props.factorParameterSelectorComponent,
49
49
  actionAttributeParameterSelectorComponent = props.actionAttributeParameterSelectorComponent,
50
50
  _props$showEmptyCondi = props.showEmptyConditionPlaceholder,
51
- showEmptyConditionPlaceholder = _props$showEmptyCondi === void 0 ? false : _props$showEmptyCondi;
51
+ showEmptyConditionPlaceholder = _props$showEmptyCondi === void 0 ? false : _props$showEmptyCondi,
52
+ factorValueExtraProps = props.factorValueExtraProps;
52
53
  var allTexts = useTranslations(texts);
53
54
  var _useState = useState(),
54
55
  draggedStep = _useState[0],
@@ -278,7 +279,8 @@ var Condition = function Condition(props) {
278
279
  readOnly: readOnly,
279
280
  singleStepCondition: singleStepCondition,
280
281
  showActionAttribute: showActionAttribute,
281
- showEmptyConditionPlaceholder: showEmptyConditionPlaceholder
282
+ showEmptyConditionPlaceholder: showEmptyConditionPlaceholder,
283
+ factorValueExtraProps: factorValueExtraProps
282
284
  });
283
285
  }), /*#__PURE__*/React.createElement(DragOverlay, {
284
286
  dropAnimation: null
@@ -34,6 +34,15 @@ export declare const RemoveIconWrapper: import("styled-components").StyledCompon
34
34
  export declare const ConditionWrapper: import("styled-components").StyledComponent<"div", any, {
35
35
  withRemoveTrigger?: boolean | undefined;
36
36
  }, never>;
37
+ export declare const ConditionParameterWrapper: import("styled-components").StyledComponent<"div", any, {
38
+ withRemoveTrigger?: boolean | undefined;
39
+ }, never>;
40
+ export declare const ConditionOperatorWrapper: import("styled-components").StyledComponent<"div", any, {
41
+ withRemoveTrigger?: boolean | undefined;
42
+ }, never>;
43
+ export declare const ConditionFactorWrapper: import("styled-components").StyledComponent<"div", any, {
44
+ withRemoveTrigger?: boolean | undefined;
45
+ }, never>;
37
46
  export declare const ConditionRows: import("styled-components").StyledComponent<"div", any, {}, never>;
38
47
  export declare const ConditionRowDefinition: import("styled-components").StyledComponent<"div", any, {}, never>;
39
48
  export declare const ConditionRowLine: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,5 +1,6 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import Cruds from '@synerise/ds-cruds';
3
+ import { Value } from '@synerise/ds-factors/dist/FactorValue/Parameter/Parameter.style';
3
4
  import Icon from '@synerise/ds-icon';
4
5
  import { InputGroupItem } from '@synerise/ds-input/dist/InputGroup.styles';
5
6
  export var ErrorWrapper = styled.div.withConfig({
@@ -108,28 +109,40 @@ export var RemoveIconWrapper = styled.span.attrs({
108
109
  export var ConditionWrapper = styled.div.withConfig({
109
110
  displayName: "Conditionstyle__ConditionWrapper",
110
111
  componentId: "sc-1lk06p3-20"
111
- })(["", ";", "{min-width:0;}"], function (props) {
112
+ })(["", ";", "{min-width:0;}", "{min-width:50px;max-width:none;}"], function (props) {
112
113
  return Boolean(props.withRemoveTrigger) && css(["&{display:flex;> *{min-width:0;}}", "{flex:0 0 24px;}"], RemoveIconWrapper);
113
- }, InputGroupItem);
114
+ }, InputGroupItem, Value);
115
+ export var ConditionParameterWrapper = styled(ConditionWrapper).withConfig({
116
+ displayName: "Conditionstyle__ConditionParameterWrapper",
117
+ componentId: "sc-1lk06p3-21"
118
+ })(["flex:0 400 auto;min-width:120px;"]);
119
+ export var ConditionOperatorWrapper = styled(ConditionWrapper).withConfig({
120
+ displayName: "Conditionstyle__ConditionOperatorWrapper",
121
+ componentId: "sc-1lk06p3-22"
122
+ })(["flex:0 0 auto;"]);
123
+ export var ConditionFactorWrapper = styled(ConditionWrapper).withConfig({
124
+ displayName: "Conditionstyle__ConditionFactorWrapper",
125
+ componentId: "sc-1lk06p3-23"
126
+ })(["flex:30 1 auto;"]);
114
127
  export var ConditionRows = styled.div.withConfig({
115
128
  displayName: "Conditionstyle__ConditionRows",
116
- componentId: "sc-1lk06p3-21"
129
+ componentId: "sc-1lk06p3-24"
117
130
  })(["flex-grow:1;min-width:0;"]);
118
131
  export var ConditionRowDefinition = styled.div.withConfig({
119
132
  displayName: "Conditionstyle__ConditionRowDefinition",
120
- componentId: "sc-1lk06p3-22"
133
+ componentId: "sc-1lk06p3-25"
121
134
  })(["display:flex;flex-direction:row;align-items:flex-start;justify-content:flex-start;"]);
122
135
  export var ConditionRowLine = styled.div.withConfig({
123
136
  displayName: "Conditionstyle__ConditionRowLine",
124
- componentId: "sc-1lk06p3-23"
137
+ componentId: "sc-1lk06p3-26"
125
138
  })(["flex-grow:1;min-width:0;"]);
126
139
  export var AddConditionRow = styled.div.withConfig({
127
140
  displayName: "Conditionstyle__AddConditionRow",
128
- componentId: "sc-1lk06p3-24"
141
+ componentId: "sc-1lk06p3-27"
129
142
  })(["display:flex;align-items:flex-start;justify-content:flex-start;flex-direction:row;"]);
130
143
  export var ConditionConnections = styled.span.withConfig({
131
144
  displayName: "Conditionstyle__ConditionConnections",
132
- componentId: "sc-1lk06p3-25"
145
+ componentId: "sc-1lk06p3-28"
133
146
  })(["display:flex;width:32px;min-width:32px;margin:0 12px;position:relative;height:32px;&:before{position:absolute;content:'';width:", ";height:1px;top:16px;left:", ";background-color:", ";}&:after{display:", ";position:absolute;content:'';width:1px;left:50%;height:auto;top:", ";bottom:", ";background-color:", ";}"], function (props) {
134
147
  return props.first ? '100%' : '16px';
135
148
  }, function (props) {
@@ -147,7 +160,7 @@ export var ConditionConnections = styled.span.withConfig({
147
160
  });
148
161
  export var ConditionRow = styled.div.withConfig({
149
162
  displayName: "Conditionstyle__ConditionRow",
150
- componentId: "sc-1lk06p3-26"
163
+ componentId: "sc-1lk06p3-29"
151
164
  })(["padding-bottom:", ";display:flex;flex-grow:1;", "{height:", ";", "}}", "{margin-right:8px;&:last-of-type{margin-right:0;flex-grow:1;min-width:0;}&:only-of-type{flex-grow:0;}}&:hover{", "{opacity:1;visibility:visible;pointer-events:all;cursor:pointer;}}"], function (props) {
152
165
  return props.onlyChild ? '0' : '16px';
153
166
  }, ConditionConnections, function (props) {
@@ -159,9 +172,9 @@ export var ConditionRow = styled.div.withConfig({
159
172
  }, ConditionWrapper, RemoveIconWrapper);
160
173
  export var AddStepButton = styled.div.withConfig({
161
174
  displayName: "Conditionstyle__AddStepButton",
162
- componentId: "sc-1lk06p3-27"
175
+ componentId: "sc-1lk06p3-30"
163
176
  })(["margin:12px 24px 0;"]);
164
177
  export var ActionAttribute = styled.div.withConfig({
165
178
  displayName: "Conditionstyle__ActionAttribute",
166
- componentId: "sc-1lk06p3-28"
179
+ componentId: "sc-1lk06p3-31"
167
180
  })(["margin-left:8px;display:flex;"]);
@@ -72,6 +72,7 @@ export type ConditionProps = {
72
72
  hoverDisabled?: boolean;
73
73
  autoOpenedComponent?: 'subject' | 'operator' | 'factor' | 'parameter' | 'context';
74
74
  inputProps?: Partial<InputProps>;
75
+ factorValueExtraProps?: FactorsProps['factorValueExtraProps'];
75
76
  onDeactivate?: (currentStepId: ReactText, currentConditionId: ReactText) => void;
76
77
  readOnly?: boolean;
77
78
  singleStepCondition?: boolean;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import type * as T from './ConditionRow.types';
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, parameterSelectorComponent, factorParameterSelectorComponent, }: T.ConditionRowProps) => React.JSX.Element;
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, parameterSelectorComponent, factorParameterSelectorComponent, factorValueExtraProps, }: T.ConditionRowProps) => React.JSX.Element;
@@ -36,7 +36,8 @@ export var ConditionRow = function ConditionRow(_ref) {
36
36
  _ref$readOnly = _ref.readOnly,
37
37
  readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
38
38
  parameterSelectorComponent = _ref.parameterSelectorComponent,
39
- factorParameterSelectorComponent = _ref.factorParameterSelectorComponent;
39
+ factorParameterSelectorComponent = _ref.factorParameterSelectorComponent,
40
+ factorValueExtraProps = _ref.factorValueExtraProps;
40
41
  var conditionFactorErrorText = conditionFactor == null ? void 0 : conditionFactor.errorText;
41
42
  var conditionParameterErrorText = conditionParameter == null ? void 0 : conditionParameter.errorText;
42
43
  var conditionOperatorErrorText = conditionOperator == null ? void 0 : conditionOperator.errorText;
@@ -96,10 +97,10 @@ export var ConditionRow = function ConditionRow(_ref) {
96
97
  first: index === 0,
97
98
  last: readOnly ? Boolean(index + 1 === conditionsNumber) : Boolean(addCondition && index + 1 === conditionsNumber && maxConditionLength !== undefined && conditionsNumber === maxConditionLength),
98
99
  readOnly: readOnly
99
- }), /*#__PURE__*/React.createElement(S.ConditionRowLine, null, /*#__PURE__*/React.createElement(S.ConditionRowDefinition, null, /*#__PURE__*/React.createElement(S.ConditionWrapper, {
100
+ }), /*#__PURE__*/React.createElement(S.ConditionRowLine, null, /*#__PURE__*/React.createElement(S.ConditionRowDefinition, null, renderConditionParameterWrapper && /*#__PURE__*/React.createElement(S.ConditionParameterWrapper, {
100
101
  "data-testid": "condition-parameter-wrapper",
101
102
  withRemoveTrigger: lastConditionWrapper === 'parameter'
102
- }, renderConditionParameterWrapper && /*#__PURE__*/React.createElement(Factors, _extends({
103
+ }, /*#__PURE__*/React.createElement(Factors, _extends({
103
104
  selectedFactorType: "",
104
105
  defaultFactorType: "",
105
106
  value: "",
@@ -124,7 +125,7 @@ export var ConditionRow = function ConditionRow(_ref) {
124
125
  opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === PARAMETER,
125
126
  readOnly: readOnly,
126
127
  error: Boolean(conditionParameter == null ? void 0 : conditionParameter.errorText)
127
- })), lastConditionWrapper === 'parameter' && removeConditionTrigger), renderConditionOperatorWrapper && /*#__PURE__*/React.createElement(S.ConditionWrapper, {
128
+ })), lastConditionWrapper === 'parameter' && removeConditionTrigger), renderConditionOperatorWrapper && /*#__PURE__*/React.createElement(S.ConditionOperatorWrapper, {
128
129
  "data-testid": "condition-operator-wrapper",
129
130
  withRemoveTrigger: lastConditionWrapper === 'operator'
130
131
  }, /*#__PURE__*/React.createElement(Operators, _extends({
@@ -142,7 +143,7 @@ export var ConditionRow = function ConditionRow(_ref) {
142
143
  opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR,
143
144
  readOnly: readOnly,
144
145
  errorText: conditionOperator == null ? void 0 : conditionOperator.errorText
145
- })), lastConditionWrapper === 'operator' && removeConditionTrigger), renderConditionFactorWrapper && /*#__PURE__*/React.createElement(S.ConditionWrapper, {
146
+ })), lastConditionWrapper === 'operator' && removeConditionTrigger), renderConditionFactorWrapper && /*#__PURE__*/React.createElement(S.ConditionFactorWrapper, {
146
147
  "data-testid": "condition-factor-wrapper",
147
148
  withRemoveTrigger: lastConditionWrapper === 'factor'
148
149
  }, (conditionFactor == null ? void 0 : conditionFactor.withCustomFactor) || /*#__PURE__*/React.createElement(Factors, _extends({
@@ -156,7 +157,8 @@ export var ConditionRow = function ConditionRow(_ref) {
156
157
  contextParameter: {
157
158
  component: factorParameterSelectorComponent
158
159
  }
159
- }
160
+ },
161
+ factorValueExtraProps: factorValueExtraProps
160
162
  }, conditionFactorProps, {
161
163
  inputProps: inputProps,
162
164
  getPopupContainerOverride: getPopupContainerOverride || getPopupContainer,
@@ -2,7 +2,7 @@ import type { ReactNode, ReactText } from 'react';
2
2
  import type { FactorValueComponentProps, FactorsProps } from '@synerise/ds-factors';
3
3
  import type { OperatorsProps } from '@synerise/ds-operators';
4
4
  import type { ConditionProps, ConditionTexts } from '../../Condition.types';
5
- export type ConditionRowProps = Pick<ConditionProps, 'removeCondition' | 'getPopupContainerOverride' | 'factorParameterSelectorComponent' | 'parameterSelectorComponent'> & {
5
+ export type ConditionRowProps = Pick<ConditionProps, 'removeCondition' | 'getPopupContainerOverride' | 'factorParameterSelectorComponent' | 'parameterSelectorComponent' | 'factorValueExtraProps'> & {
6
6
  index: number;
7
7
  error?: boolean;
8
8
  hasPriority?: boolean;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import type * as T from './ConditionStep.types';
3
- export declare const ConditionStep: ({ step, texts, index, isLast, isDragged, addCondition, removeCondition, updateStepName, removeStep, duplicateStep, minConditionsLength, maxConditionsLength, draggableEnabled, selectSubject, selectContext, selectActionAttribute, selectOperator, selectParameter, setStepConditionFactorType, setStepConditionFactorValue, getPopupContainerOverride, hasPriority, currentStepId, currentConditionId, currentField, setCurrentField, setCurrentCondition, setCurrentStep, onDeactivate, showSuffix, inputProps, readOnly, singleStepCondition, showActionAttribute, contextSelectorComponent: CustomContextSelectorComponent, actionAttributeParameterSelectorComponent, parameterSelectorComponent, factorParameterSelectorComponent, showEmptyConditionPlaceholder, }: T.ConditionStepProps) => React.JSX.Element;
3
+ export declare const ConditionStep: ({ step, texts, index, isLast, isDragged, addCondition, removeCondition, updateStepName, removeStep, duplicateStep, minConditionsLength, maxConditionsLength, draggableEnabled, selectSubject, selectContext, selectActionAttribute, selectOperator, selectParameter, setStepConditionFactorType, setStepConditionFactorValue, getPopupContainerOverride, hasPriority, currentStepId, currentConditionId, currentField, setCurrentField, setCurrentCondition, setCurrentStep, onDeactivate, showSuffix, inputProps, readOnly, singleStepCondition, showActionAttribute, contextSelectorComponent: CustomContextSelectorComponent, actionAttributeParameterSelectorComponent, parameterSelectorComponent, factorParameterSelectorComponent, showEmptyConditionPlaceholder, factorValueExtraProps, }: T.ConditionStepProps) => React.JSX.Element;
@@ -56,7 +56,8 @@ export var ConditionStep = function ConditionStep(_ref) {
56
56
  parameterSelectorComponent = _ref.parameterSelectorComponent,
57
57
  factorParameterSelectorComponent = _ref.factorParameterSelectorComponent,
58
58
  _ref$showEmptyConditi = _ref.showEmptyConditionPlaceholder,
59
- showEmptyConditionPlaceholder = _ref$showEmptyConditi === void 0 ? false : _ref$showEmptyConditi;
59
+ showEmptyConditionPlaceholder = _ref$showEmptyConditi === void 0 ? false : _ref$showEmptyConditi,
60
+ factorValueExtraProps = _ref.factorValueExtraProps;
60
61
  var _useSortable = useSortable({
61
62
  id: step.id
62
63
  }),
@@ -168,9 +169,10 @@ export var ConditionStep = function ConditionStep(_ref) {
168
169
  onDeactivate: onDeactivate,
169
170
  readOnly: readOnly,
170
171
  parameterSelectorComponent: parameterSelectorComponent,
171
- factorParameterSelectorComponent: factorParameterSelectorComponent
172
+ factorParameterSelectorComponent: factorParameterSelectorComponent,
173
+ factorValueExtraProps: factorValueExtraProps
172
174
  });
173
- }, [step.id, step.conditions.length, step.context, hasPriority, currentConditionId, addCondition, removeCondition, minConditionsLength, maxConditionsLength, currentStepId, currentField, selectParameter, selectOperator, getPopupContainerOverride, setStepConditionFactorType, setStepConditionFactorValue, allTexts, onDeactivate, _onActivate, setCurrentField, setCurrentCondition, setCurrentStep, inputProps, readOnly, parameterSelectorComponent, factorParameterSelectorComponent]);
175
+ }, [step.id, step.conditions.length, step.context, hasPriority, currentConditionId, addCondition, removeCondition, minConditionsLength, maxConditionsLength, currentStepId, currentField, selectParameter, selectOperator, getPopupContainerOverride, setStepConditionFactorType, setStepConditionFactorValue, allTexts, onDeactivate, _onActivate, setCurrentField, setCurrentCondition, setCurrentStep, inputProps, readOnly, parameterSelectorComponent, factorParameterSelectorComponent, factorValueExtraProps]);
174
176
  var hasSelectedSubjectOrContext = useMemo(function () {
175
177
  var _step$subject2, _step$context3;
176
178
  return ((_step$subject2 = step.subject) == null ? void 0 : _step$subject2.selectedItem) || ((_step$context3 = step.context) == null ? void 0 : _step$context3.selectedItem);
@@ -4,7 +4,7 @@ import type { FactorType, FactorValueType } from '@synerise/ds-factors';
4
4
  import type { OperatorsGroup, OperatorsItem } from '@synerise/ds-operators';
5
5
  import type { SubjectItem } from '@synerise/ds-subject';
6
6
  import type { ConditionProps, ConditionStep } from '../Condition.types';
7
- export type ConditionStepProps = Pick<ConditionProps, 'singleStepCondition' | 'showActionAttribute' | 'showEmptyConditionPlaceholder' | 'showSuffix' | 'readOnly' | 'inputProps' | 'hoverDisabled' | 'getPopupContainerOverride' | 'minConditionsLength' | 'addCondition' | 'removeCondition' | 'texts' | 'maxConditionsLength' | 'contextSelectorComponent' | 'factorParameterSelectorComponent' | 'parameterSelectorComponent' | 'actionAttributeParameterSelectorComponent'> & {
7
+ export type ConditionStepProps = Pick<ConditionProps, 'singleStepCondition' | 'showActionAttribute' | 'showEmptyConditionPlaceholder' | 'showSuffix' | 'readOnly' | 'inputProps' | 'hoverDisabled' | 'getPopupContainerOverride' | 'minConditionsLength' | 'addCondition' | 'removeCondition' | 'texts' | 'maxConditionsLength' | 'contextSelectorComponent' | 'factorParameterSelectorComponent' | 'parameterSelectorComponent' | 'actionAttributeParameterSelectorComponent' | 'factorValueExtraProps'> & {
8
8
  index: number;
9
9
  isLast?: boolean;
10
10
  isDragged?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-condition",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Condition UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -35,14 +35,14 @@
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
37
  "@synerise/ds-button": "^1.4.2",
38
- "@synerise/ds-context-selector": "^1.1.16",
38
+ "@synerise/ds-context-selector": "^1.1.17",
39
39
  "@synerise/ds-cruds": "^1.0.13",
40
- "@synerise/ds-factors": "^1.3.2",
40
+ "@synerise/ds-factors": "^1.4.0",
41
41
  "@synerise/ds-icon": "^1.5.4",
42
42
  "@synerise/ds-inline-edit": "^1.0.17",
43
43
  "@synerise/ds-input": "^1.3.2",
44
44
  "@synerise/ds-operators": "^1.0.16",
45
- "@synerise/ds-sortable": "^1.3.1",
45
+ "@synerise/ds-sortable": "^1.3.2",
46
46
  "@synerise/ds-subject": "^1.0.17",
47
47
  "@synerise/ds-tooltip": "^1.1.12",
48
48
  "@synerise/ds-typography": "^1.0.13",
@@ -55,5 +55,5 @@
55
55
  "react-intl": ">=3.12.0 <= 6.8",
56
56
  "styled-components": "^5.3.3"
57
57
  },
58
- "gitHead": "4512641033ba3581a3df208143c547fcfed45895"
58
+ "gitHead": "2161bdb04f3db0f79b7d0465ce6b41121f1543ef"
59
59
  }