@synerise/ds-condition 2.0.10 → 2.1.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,17 @@
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
+ # [2.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@2.0.10...@synerise/ds-condition@2.1.0) (2026-10-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * **condition:** add factor fillSpace to stretch a row's value field ([4638259](https://github.com/Synerise/synerise-design/commit/4638259191d08d64194b1b13543d586d3cb15792))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.0.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-condition@2.0.9...@synerise/ds-condition@2.0.10) (2026-10-09)
7
18
 
8
19
  **Note:** Version bump only for package @synerise/ds-condition
package/CLAUDE.md CHANGED
@@ -93,7 +93,7 @@ Shape of each element in `ConditionStep.conditions`:
93
93
  | `id` | `ReactText` | Unique condition id. |
94
94
  | `parameter` | `Omit<FactorsProps, 'onChangeValue'>?` | Rendered when provided. |
95
95
  | `operator` | `Omit<OperatorsProps, 'onChange'>?` | Rendered when `parameter.value` is set (or when `parameter` is absent). |
96
- | `factor` | `Omit<FactorsProps, 'onChangeValue' \| 'setSelectedFactorType'> & { withCustomFactor?: ReactNode }?` | Rendered only when `operator.value` is set. |
96
+ | `factor` | `Omit<FactorsProps, 'onChangeValue' \| 'setSelectedFactorType'> & { withCustomFactor?: ReactNode; fillSpace?: boolean }?` | Rendered only when `operator.value` is set. `fillSpace` makes this row's value field take the width the row can give it — see below. |
97
97
 
98
98
  ### `ConditionTexts` (type)
99
99
 
@@ -182,5 +182,9 @@ Merges the `texts` prop with react-intl defaults. Requires `IntlProvider` in the
182
182
  - **`autoClearCondition`** — when `true`, changing subject/context also fires `onChangeParameter`, `onChangeOperator`, `onChangeFactorValue` with `undefined` for all existing conditions, and removes all conditions beyond the first. This clears downstream values but the parent must still handle the callbacks to update its state.
183
183
  - **`hoverDisabled`** is also set automatically on steps that are not the currently active step (`currentStepId !== step.id`), creating a "focus" effect.
184
184
  - **`renderAddStep`** is hidden in `readOnly` mode; `addStep` button is also skipped when `addStep` prop is absent.
185
+ - **`factor.fillSpace`** — a per-row opt-in that makes the value field fill the row instead of sizing to its content. Two halves, both needed:
186
+ 1. `ConditionRow` rebuilds that row's `inputProps` as `{ ...inputProps, autoResize: undefined }`. With `autoResize` falsy, ds-autocomplete's `InputContainer` becomes `width: 100%` and the autosize hook never renders its sizer, so it never writes the inline `width` that would otherwise pin the field to the typed text. (This has to happen in `ConditionRow`: `inputProps` is passed *after* `{...conditionFactorProps}`, so a per-row `factor.inputProps` is clobbered by the Condition-level one.)
187
+ 2. `ConditionFactorWrapper` gets `$fillSpace`, which grows its children. The cell itself already grows (`:last-of-type` in `ConditionRow`), but once a remove trigger is present the cell is a flex container and ds-factors' root — ds-input's `OuterWrapper` — sits at `flex-grow: 0` and shrink-wraps to max-content, so without this the extra width just stays empty. Measured: cell 560px, `OuterWrapper` 204px before; 528px after.
188
+ The wrapper also carries a stable `ds-conditions-factor-fill-space` class for tests and consumers. Applies to the text factor types only — date/number/array set their own `autoResize` inside ds-factors, where the row-level suppression cannot reach.
185
189
  - **`data-popup-container`** attribute is on the root `S.Condition` element — used as the default popup container by nested dropdowns.
186
190
  - **`IntlProvider` required** — `useTranslations` calls `useIntl()`. If the app does not wrap with `IntlProvider`, this will throw. Provide `texts` prop with all keys as a workaround if needed.
package/README.md CHANGED
@@ -161,11 +161,32 @@ import Condition from '@synerise/ds-condition'
161
161
 
162
162
  | Property | Description | Type | Default |
163
163
  | ---------- | -------------------------- | -------------------------------------------- | ------- |
164
- | factor? | Factors selector options | [FactorsProps](/docs/components/factors) | - |
164
+ | factor? | Factors selector options. Also accepts `withCustomFactor` and `fillSpace` (see below) | [FactorsProps](/docs/components/factors) | - |
165
165
  | id | Id condition row | React.ReactText | - |
166
166
  | operator? | Operators selector options | [OperatorsProps](/docs/components/operators) | - |
167
167
  | parameter? | Parameter selector options | [FactorsProps](/docs/components/factors) | - |
168
168
 
169
+ #### Factor width
170
+
171
+ By default every factor text input sizes itself to its content, using the
172
+ `autoResize` defaults this component injects (`inputProps`). Set
173
+ `factor.fillSpace` on a single row to make that row's value field take all the
174
+ width the row can give it instead — useful for parameters whose values are long
175
+ (URLs, for example), where the field would otherwise start narrow and stay
176
+ narrow while the row has free space.
177
+
178
+ ```tsx
179
+ conditions: [
180
+ { id, parameter, operator, factor: { ...factor, fillSpace: true } },
181
+ ];
182
+ ```
183
+
184
+ It is a per-row opt-in, not a Condition-wide setting, and it suppresses that
185
+ row's `autoResize` default. It applies to the text factor types (`autocomplete`
186
+ and `default`); other types (date, number, array…) size themselves and ignore
187
+ it. The row must also have room to give: the factor cell only grows when it is
188
+ the last selector in the row, which is the normal case.
189
+
169
190
  #### Selectors appereance rules
170
191
 
171
192
  - Parameter appers when `parameter` prop is provided
@@ -41,6 +41,8 @@ export declare const ConditionOperatorWrapper: import('styled-components').Style
41
41
  }, never>;
42
42
  export declare const ConditionFactorWrapper: import('styled-components').StyledComponent<"div", any, {
43
43
  withRemoveTrigger?: boolean;
44
+ } & {
45
+ $fillSpace?: boolean;
44
46
  }, never>;
45
47
  export declare const ConditionRows: import('styled-components').StyledComponent<"div", any, {}, never>;
46
48
  export declare const ConditionRowDefinition: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -102,7 +102,7 @@ const ConditionOperatorWrapper = /* @__PURE__ */ styled(ConditionWrapper).withCo
102
102
  const ConditionFactorWrapper = /* @__PURE__ */ styled(ConditionWrapper).withConfig({
103
103
  displayName: "Conditionstyle__ConditionFactorWrapper",
104
104
  componentId: "sc-1lk06p3-23"
105
- })(["flex:30 1 auto;"]);
105
+ })(["flex:30 1 auto;", ""], (props) => Boolean(props.$fillSpace) && css(["> *:not(", "){flex-grow:1;min-width:0;}"], RemoveIconWrapper));
106
106
  const ConditionRows = /* @__PURE__ */ styled.div.withConfig({
107
107
  displayName: "Conditionstyle__ConditionRows",
108
108
  componentId: "sc-1lk06p3-24"
@@ -13,6 +13,13 @@ export type StepConditions = {
13
13
  operator?: Omit<OperatorsProps, 'onChange'>;
14
14
  factor?: Omit<FactorsProps, 'onChangeValue' | 'setSelectedFactorType'> & {
15
15
  withCustomFactor?: ReactNode;
16
+ /**
17
+ * Let the factor value fill the whole width the row can give it, instead
18
+ * of sizing to its content. Suppresses the row's `autoResize` default and
19
+ * lets the factor cell's contents grow. Applies to the text factor types
20
+ * (`autocomplete` and `default`) — other types size themselves.
21
+ */
22
+ fillSpace?: boolean;
16
23
  };
17
24
  };
18
25
  export type ConditionStep = {
@@ -65,9 +65,15 @@ const ConditionRow = ({
65
65
  } else if (renderConditionParameterWrapper) {
66
66
  lastConditionWrapper = "parameter";
67
67
  }
68
+ const fillSpace = Boolean(conditionFactor?.fillSpace);
69
+ const factorInputProps = useMemo(() => fillSpace ? {
70
+ ...inputProps,
71
+ autoResize: void 0
72
+ } : inputProps, [fillSpace, inputProps]);
68
73
  const conditionFactorProps = useMemo(() => {
69
74
  return {
70
75
  ...conditionFactor,
76
+ fillSpace: void 0,
71
77
  parameters: conditionFactor?.parameters && {
72
78
  ...conditionFactor.parameters,
73
79
  selectedButtonColored: conditionFactor.parameters?.selectedButtonColored === void 0 ? true : conditionFactor.parameters?.selectedButtonColored
@@ -99,7 +105,7 @@ const ConditionRow = ({
99
105
  }, onDeactivate, onChange: (value) => selectOperator(stepId, conditionId, value), opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === OPERATOR, readOnly, errorText: conditionOperator?.errorText }),
100
106
  lastConditionWrapper === "operator" && removeConditionTrigger
101
107
  ] }),
102
- renderConditionFactorWrapper && /* @__PURE__ */ jsxs(ConditionFactorWrapper, { "data-testid": "condition-factor-wrapper", withRemoveTrigger: lastConditionWrapper === "factor", children: [
108
+ renderConditionFactorWrapper && /* @__PURE__ */ jsxs(ConditionFactorWrapper, { "data-testid": "condition-factor-wrapper", className: fillSpace ? "ds-conditions-factor-fill-space" : void 0, withRemoveTrigger: lastConditionWrapper === "factor", $fillSpace: fillSpace, children: [
103
109
  conditionFactor?.withCustomFactor || /* @__PURE__ */ jsx(Factors, { selectedFactorType: "text", defaultFactorType: "text", value: "", customFactorValueComponents: factorParameterSelectorComponent && {
104
110
  parameter: {
105
111
  component: factorParameterSelectorComponent
@@ -107,7 +113,7 @@ const ConditionRow = ({
107
113
  contextParameter: {
108
114
  component: factorParameterSelectorComponent
109
115
  }
110
- }, factorValueExtraProps, ...conditionFactorProps, inputProps, getPopupContainerOverride: getPopupContainerOverride || getPopupContainer, onActivate: () => {
116
+ }, factorValueExtraProps, ...conditionFactorProps, inputProps: factorInputProps, getPopupContainerOverride: getPopupContainerOverride || getPopupContainer, onActivate: () => {
111
117
  onActivate && onActivate(FACTOR);
112
118
  }, onDeactivate, setSelectedFactorType: (factorType) => setStepConditionFactorType(stepId, conditionId, factorType), onChangeValue: (value) => setStepConditionFactorValue(stepId, conditionId, value), factorKey: conditionId, error: Boolean(conditionFactorProps.errorText), opened: hasPriority && stepId === currentStepId && conditionId === currentConditionId && currentField === FACTOR, readOnly }),
113
119
  lastConditionWrapper === "factor" && removeConditionTrigger
@@ -14,6 +14,8 @@ export type ConditionRowProps = Pick<ConditionProps, 'removeCondition' | 'getPop
14
14
  conditionOperator?: Omit<OperatorsProps, 'onChange'>;
15
15
  conditionFactor?: Omit<FactorsProps, 'onChangeValue'> & {
16
16
  withCustomFactor?: ReactNode;
17
+ /** See `StepConditions['factor']` in Condition.types. */
18
+ fillSpace?: boolean;
17
19
  };
18
20
  conditionsNumber: number;
19
21
  stepId: ReactText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-condition",
3
- "version": "2.0.10",
3
+ "version": "2.1.0",
4
4
  "description": "Condition UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -42,19 +42,19 @@
42
42
  ],
43
43
  "types": "dist/index.d.ts",
44
44
  "dependencies": {
45
- "@synerise/ds-button": "^2.1.2",
46
- "@synerise/ds-context-selector": "^2.1.4",
47
- "@synerise/ds-cruds": "^2.0.7",
48
- "@synerise/ds-factors": "^2.2.2",
49
- "@synerise/ds-icon": "^2.2.1",
50
- "@synerise/ds-inline-edit": "^2.0.8",
51
- "@synerise/ds-input": "^2.0.8",
52
- "@synerise/ds-operators": "^2.0.8",
53
- "@synerise/ds-sortable": "^2.0.3",
54
- "@synerise/ds-subject": "^2.0.8",
55
- "@synerise/ds-tooltip": "^2.0.7",
56
- "@synerise/ds-typography": "^2.0.7",
57
- "@synerise/ds-utils": "^2.2.0",
45
+ "@synerise/ds-button": "^2.1.3",
46
+ "@synerise/ds-context-selector": "^2.1.5",
47
+ "@synerise/ds-cruds": "^2.0.8",
48
+ "@synerise/ds-factors": "^2.3.0",
49
+ "@synerise/ds-icon": "^2.2.2",
50
+ "@synerise/ds-inline-edit": "^2.0.9",
51
+ "@synerise/ds-input": "^2.0.9",
52
+ "@synerise/ds-operators": "^2.0.9",
53
+ "@synerise/ds-sortable": "^2.0.4",
54
+ "@synerise/ds-subject": "^2.0.9",
55
+ "@synerise/ds-tooltip": "^2.0.8",
56
+ "@synerise/ds-typography": "^2.0.8",
57
+ "@synerise/ds-utils": "^2.2.1",
58
58
  "lodash.debounce": "^4.0.8"
59
59
  },
60
60
  "devDependencies": {
@@ -68,5 +68,5 @@
68
68
  "react-intl": ">=3.12.0 <= 6.8",
69
69
  "styled-components": "^5.3.3"
70
70
  },
71
- "gitHead": "7331c532cf684b40b130328005359a348aa06976"
71
+ "gitHead": "ac1a96b3cd66d2836b0639b3d9920fc0ebd7f8f3"
72
72
  }