@synerise/ds-factors 2.4.1 → 2.5.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 +19 -0
- package/CLAUDE.md +47 -3
- package/README.md +62 -0
- package/dist/FactorValue/Array/Array.d.ts +2 -2
- package/dist/FactorValue/Array/Array.js +4 -48
- package/dist/FactorValue/Array/Array.types.d.ts +18 -3
- package/dist/FactorValue/Array/ArrayFactor.d.ts +5 -0
- package/dist/FactorValue/Array/ArrayFactor.js +69 -0
- package/dist/FactorValue/DateRange/DateRange.js +1 -1
- package/dist/Factors.types.d.ts +3 -3
- package/dist/hooks/useTexts.js +2 -8
- package/dist/index.d.ts +5 -1
- package/dist/index.js +7 -1
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.5.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@2.4.2...@synerise/ds-factors@2.5.0) (2026-11-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **factors:** add a standalone ArrayFactor and export ArrayModal ([15c0443](https://github.com/Synerise/synerise-design/commit/15c0443cdf6c91290abb252c56de6541e2c2219d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [2.4.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@2.4.1...@synerise/ds-factors@2.4.2) (2026-11-03)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @synerise/ds-factors
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [2.4.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-factors@2.4.0...@synerise/ds-factors@2.4.1) (2026-11-03)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-factors
|
package/CLAUDE.md
CHANGED
|
@@ -27,7 +27,7 @@ src/
|
|
|
27
27
|
Date/ — date picker via @synerise/ds-date-picker
|
|
28
28
|
DateRange/ — date range picker via @synerise/ds-date-range-picker
|
|
29
29
|
RelativeDate/ — relative date selector (offset + unit + before/after)
|
|
30
|
-
Array/ — array editor with creator, raw paste, and collector modes
|
|
30
|
+
Array/ — array editor with creator, raw paste, and collector modes; `ArrayFactor.tsx` is the public standalone trigger + modal
|
|
31
31
|
__specs__/
|
|
32
32
|
Factors.spec.tsx — Vitest tests
|
|
33
33
|
Factors.array.spec.tsx — Vitest tests for array type
|
|
@@ -91,6 +91,45 @@ src/
|
|
|
91
91
|
|
|
92
92
|
The built-in `FACTOR_TYPE_MAPPING` exported as a named value. Maps each `DefinedFactorTypes` key to `{ name, icon, component }`. Use alongside `customFactorValueComponents` to extend or inspect defaults.
|
|
93
93
|
|
|
94
|
+
### `ArrayFactor`
|
|
95
|
+
|
|
96
|
+
The array factor used on its own, without `Factors`: no type selector and no 173px minimum width. Its trigger sizes to its label, capped at the container (`max-width: 100%`); pass `className` to size it otherwise. Props (`ArrayFactorProps<ItemType>`): `onChange(value)` (required), `value`, `itemType` (default `'string'`), `texts` (any `DeepPartial<FactorsTexts>`, merged with the defaults inside), `readOnly`, `error`, `limit`, `collectorSuggestions`, `onActivate`, `onDeactivate`, `className`. Inside `Factors` the `array` type renders `ArrayFactorBase`, the same component with already-resolved texts. Merging those texts a second time would make lodash write into frozen React elements.
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { ArrayFactor } from '@synerise/ds-factors';
|
|
100
|
+
|
|
101
|
+
<ArrayFactor
|
|
102
|
+
itemType="string"
|
|
103
|
+
value={value}
|
|
104
|
+
onChange={setValue}
|
|
105
|
+
texts={{ array: { emptyTitle: 'No values yet' } }}
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### `ArrayModal`
|
|
110
|
+
|
|
111
|
+
The array editor without a trigger, for layouts that render their own button. Props (`ArrayModalProps<ItemType>`): `itemType` (required), `texts` (required, from `useFactorsTexts`), `onApply(value)`, `onCancel()`, `visible`, `value`, `readOnly`, `limit`, `collectorSuggestions`. It resets its draft whenever the `value` reference changes, so memoise a derived value. `ItemType` is inferred from `itemType`, so `onApply` receives `string[]` for `itemType="string"` and `number[]` for `"number"`.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { ArrayModal, useFactorsTexts } from '@synerise/ds-factors';
|
|
115
|
+
|
|
116
|
+
const [value, setValue] = useState<string[]>([]);
|
|
117
|
+
const texts = useFactorsTexts({ array: { modalTitle: 'Edit values' } });
|
|
118
|
+
|
|
119
|
+
<ArrayModal
|
|
120
|
+
visible={isModalOpen}
|
|
121
|
+
itemType="string"
|
|
122
|
+
value={value}
|
|
123
|
+
texts={texts}
|
|
124
|
+
onApply={setValue}
|
|
125
|
+
onCancel={() => setIsModalOpen(false)}
|
|
126
|
+
/>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### `useFactorsTexts`
|
|
130
|
+
|
|
131
|
+
The package's `useTexts` hook (see *Custom hooks*), exported under this name.
|
|
132
|
+
|
|
94
133
|
### Types exported
|
|
95
134
|
|
|
96
135
|
| Export | Description |
|
|
@@ -99,6 +138,11 @@ The built-in `FACTOR_TYPE_MAPPING` exported as a named value. Maps each `Defined
|
|
|
99
138
|
| `FactorType` | `LiteralStringUnion` of the 10 types (accepts custom strings) |
|
|
100
139
|
| `DefinedFactorTypes` | Strict union of the 10 built-in type strings |
|
|
101
140
|
| `FactorValueType` | Union of all possible value types |
|
|
141
|
+
| `ArrayFactorProps` | Props of `ArrayFactor` (generic over `'string' \| 'number'`) |
|
|
142
|
+
| `ArrayModalProps` | Props of `ArrayModal` (generic over `'string' \| 'number'`) |
|
|
143
|
+
| `ArrayItemType` | `'string' \| 'number'` |
|
|
144
|
+
| `ArrayValue` | `string[] \| number[]` — the array factor's value |
|
|
145
|
+
| `ArrayValueElement` | `string` or `number`, by item type |
|
|
102
146
|
| `FactorsProps` | Full props interface |
|
|
103
147
|
| `FactorsTexts` | Full texts interface |
|
|
104
148
|
| `ParameterValueType` | Shape of a selected parameter value |
|
|
@@ -162,9 +206,9 @@ import { factorTypes } from '@synerise/ds-factors';
|
|
|
162
206
|
|
|
163
207
|
## Custom hooks
|
|
164
208
|
|
|
165
|
-
### `useTexts`
|
|
209
|
+
### `useTexts` (public as `useFactorsTexts`)
|
|
166
210
|
|
|
167
|
-
Merges the user-provided `texts` (any `DeepPartial<FactorsTexts>`) with react-intl defaults using `lodash.merge`. Returns a complete `FactorsTexts` object. All default strings come from `DS.FACTORS.*` intl message IDs. Requires an `IntlProvider` ancestor.
|
|
211
|
+
Merges the user-provided `texts` (any `DeepPartial<FactorsTexts>`) with react-intl defaults using `lodash.merge`. Returns a complete `FactorsTexts` object. All default strings come from `DS.FACTORS.*` intl message IDs, except `array.emptyDescription` and `array.emptyResultsDescription`, which default to `undefined` so the array empty state shows only its title. Requires an `IntlProvider` ancestor.
|
|
168
212
|
|
|
169
213
|
## Styling
|
|
170
214
|
|
package/README.md
CHANGED
|
@@ -169,3 +169,65 @@ Type of value depends on current factor type and can contain values: `string` /
|
|
|
169
169
|
| renderEmptyGroups | Show group headers even if group has no items | boolean | - |
|
|
170
170
|
| dropdownDimensionsConfig | Override dropdown height at different viewport sizes | { defaultHeight?, lowerHeight?, threshold? } | - |
|
|
171
171
|
| showAllGroup | **Deprecated** | boolean | - |
|
|
172
|
+
|
|
173
|
+
### ArrayFactor
|
|
174
|
+
|
|
175
|
+
The array factor used on its own, without `Factors`: no type selector and no fixed minimum width. Its trigger sizes to its label, capped at the container.
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
import { ArrayFactor } from '@synerise/ds-factors'
|
|
179
|
+
|
|
180
|
+
<ArrayFactor
|
|
181
|
+
itemType="string"
|
|
182
|
+
value={value}
|
|
183
|
+
onChange={setValue}
|
|
184
|
+
texts={{ array: { emptyTitle: 'No values yet' } }}
|
|
185
|
+
/>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
| Property | Description | Type | Default |
|
|
189
|
+
| -------------------- | -------------------------------------------------------------- | --------------------------------------------- | ---------- |
|
|
190
|
+
| onChange | Called with the applied array | (value: ArrayValueElement<ItemType>[]) => void | - |
|
|
191
|
+
| value | Current array | ArrayValueElement<ItemType>[] | `[]` |
|
|
192
|
+
| itemType | Type of the items | `'string'` / `'number'` | `'string'` |
|
|
193
|
+
| texts | Any subset of the Factors texts, merged with the defaults | DeepPartial<FactorsTexts> | - |
|
|
194
|
+
| readOnly | Opens the editor read-only and hides the edit icon | boolean | false |
|
|
195
|
+
| error | Shows error styling on the trigger | boolean | - |
|
|
196
|
+
| limit | Maximum number of items | number | - |
|
|
197
|
+
| collectorSuggestions | Suggestions in the value collector | CollectorValue[] | - |
|
|
198
|
+
| onActivate | Called when the editor opens | () => void | - |
|
|
199
|
+
| onDeactivate | Called when the editor is closed without applying | () => void | - |
|
|
200
|
+
| className | Class name of the trigger button | string | - |
|
|
201
|
+
|
|
202
|
+
### ArrayModal
|
|
203
|
+
|
|
204
|
+
The array editor without a trigger, for layouts that render their own button. Its texts come from `useFactorsTexts`, which merges overrides with the `DS.FACTORS.*` defaults. `onApply` receives `string[]` for `itemType="string"` and `number[]` for `"number"`.
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
import { ArrayModal, useFactorsTexts } from '@synerise/ds-factors'
|
|
208
|
+
|
|
209
|
+
const [value, setValue] = useState<string[]>([])
|
|
210
|
+
const texts = useFactorsTexts({ array: { modalTitle: 'Edit values' } })
|
|
211
|
+
|
|
212
|
+
<Button onClick={() => setIsModalOpen(true)}>Edit value</Button>
|
|
213
|
+
<ArrayModal
|
|
214
|
+
visible={isModalOpen}
|
|
215
|
+
itemType="string"
|
|
216
|
+
value={value}
|
|
217
|
+
texts={texts}
|
|
218
|
+
onApply={setValue}
|
|
219
|
+
onCancel={() => setIsModalOpen(false)}
|
|
220
|
+
/>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
| Property | Description | Type | Default |
|
|
224
|
+
| -------------------- | ------------------------------------------------- | ---------------------------------------- | ------- |
|
|
225
|
+
| itemType | Type of the items | `'string'` / `'number'` | - |
|
|
226
|
+
| texts | Texts, from `useFactorsTexts` | FactorsTexts | - |
|
|
227
|
+
| onApply | Called with the edited array | (value: ArrayValueElement<ItemType>[]) => void | - |
|
|
228
|
+
| onCancel | Called when the modal is closed without applying | () => void | - |
|
|
229
|
+
| visible | Whether the modal is open | boolean | - |
|
|
230
|
+
| value | Current array | ArrayValueElement<ItemType>[] | - |
|
|
231
|
+
| readOnly | Disables editing | boolean | - |
|
|
232
|
+
| limit | Maximum number of items | number | - |
|
|
233
|
+
| collectorSuggestions | Suggestions in the value collector | CollectorValue[] | - |
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const Array:
|
|
2
|
+
import { FactorValueComponentProps } from '../../Factors.types';
|
|
3
|
+
export declare const Array: ({ value, onChange, texts, onActivate, onDeactivate, readOnly, error, arrayProps, }: FactorValueComponentProps) => React.JSX.Element;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import {
|
|
3
|
-
import Icon, { EditS } from "@synerise/ds-icon";
|
|
4
|
-
import { TagShape } from "@synerise/ds-tag";
|
|
5
|
-
import { TriggerButton, TriggerButtonLabel } from "./Array.styles.js";
|
|
6
|
-
import { ArrayModal } from "./components/ArrayModal.js";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ArrayFactorBase } from "./ArrayFactor.js";
|
|
7
3
|
const Array = ({
|
|
8
|
-
value
|
|
4
|
+
value,
|
|
9
5
|
onChange,
|
|
10
6
|
texts,
|
|
11
7
|
onActivate,
|
|
@@ -13,47 +9,7 @@ const Array = ({
|
|
|
13
9
|
readOnly = false,
|
|
14
10
|
error,
|
|
15
11
|
arrayProps = {}
|
|
16
|
-
}) => {
|
|
17
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
18
|
-
const handleOnClick = () => {
|
|
19
|
-
setIsVisible(true);
|
|
20
|
-
onActivate && onActivate();
|
|
21
|
-
};
|
|
22
|
-
const buttonLabel = useMemo(() => {
|
|
23
|
-
if (!arrayValue?.length) {
|
|
24
|
-
return texts.array.triggerLabel;
|
|
25
|
-
}
|
|
26
|
-
return `${arrayValue.join(", ")} `;
|
|
27
|
-
}, [arrayValue, texts.array.triggerLabel]);
|
|
28
|
-
const triggerMode = useMemo(() => {
|
|
29
|
-
return readOnly ? "" : "label-icon";
|
|
30
|
-
}, [readOnly]);
|
|
31
|
-
const handleApply = (changedValue) => {
|
|
32
|
-
setIsVisible(false);
|
|
33
|
-
onChange(changedValue);
|
|
34
|
-
};
|
|
35
|
-
const handleCancel = () => {
|
|
36
|
-
setIsVisible(false);
|
|
37
|
-
onDeactivate && onDeactivate();
|
|
38
|
-
};
|
|
39
|
-
const tagProps = {
|
|
40
|
-
asPill: true,
|
|
41
|
-
name: `${arrayValue.length}`,
|
|
42
|
-
color: error ? "var(--ds-color-background-danger-solid)" : "var(--ds-color-background-neutral-solid)",
|
|
43
|
-
textColor: "var(--ds-color-text-base-onsolid)",
|
|
44
|
-
shape: TagShape.DEFAULT_ROUND
|
|
45
|
-
};
|
|
46
|
-
const tooltipProps = arrayValue?.length ? {
|
|
47
|
-
title: /* @__PURE__ */ jsx(Fragment, { children: arrayValue.join(", ") })
|
|
48
|
-
} : void 0;
|
|
49
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
-
/* @__PURE__ */ jsxs(TriggerButton, { error, type: "secondary", mode: triggerMode, onClick: handleOnClick, tooltipProps, "data-testid": "ds-factors-array", tagProps: arrayValue.length ? tagProps : void 0, children: [
|
|
51
|
-
/* @__PURE__ */ jsx(TriggerButtonLabel, { children: buttonLabel }),
|
|
52
|
-
!readOnly && /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(EditS, {}) })
|
|
53
|
-
] }),
|
|
54
|
-
/* @__PURE__ */ jsx(ArrayModal, { value: arrayValue, onApply: handleApply, onCancel: handleCancel, texts, visible: isVisible, readOnly, itemType: "string", ...arrayProps })
|
|
55
|
-
] });
|
|
56
|
-
};
|
|
12
|
+
}) => /* @__PURE__ */ jsx(ArrayFactorBase, { value, onChange: (changedValue) => onChange(changedValue), texts, onActivate, onDeactivate, readOnly, error, ...arrayProps });
|
|
57
13
|
export {
|
|
58
14
|
Array
|
|
59
15
|
};
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { ArrayProps, ArrayValueElement, FactorsTexts } from '../../Factors.types';
|
|
4
|
-
export type
|
|
2
|
+
import { DeepPartial } from '@synerise/ds-utils';
|
|
3
|
+
import { ArrayItemType, ArrayProps, ArrayValueElement, FactorsTexts } from '../../Factors.types';
|
|
4
|
+
export type ArrayFactorProps<ItemType extends ArrayItemType = 'string'> = Omit<ArrayProps, 'itemType'> & {
|
|
5
|
+
value?: ArrayValueElement<ItemType>[];
|
|
6
|
+
onChange: (value: ArrayValueElement<ItemType>[]) => void;
|
|
7
|
+
itemType?: ItemType;
|
|
8
|
+
texts?: DeepPartial<FactorsTexts>;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
onActivate?: () => void;
|
|
12
|
+
onDeactivate?: () => void;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
export type ArrayFactorBaseProps<ItemType extends ArrayItemType> = Omit<ArrayFactorProps<ItemType>, 'texts'> & {
|
|
16
|
+
texts: FactorsTexts;
|
|
17
|
+
};
|
|
18
|
+
export type ArrayModalProps<ItemType extends 'string' | 'number'> = Omit<ArrayProps, 'itemType'> & {
|
|
19
|
+
itemType: ItemType;
|
|
5
20
|
visible?: boolean;
|
|
6
21
|
readOnly?: boolean;
|
|
7
22
|
onApply: (updatedValue: ArrayValueElement<ItemType>[]) => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ArrayItemType } from '../../Factors.types';
|
|
3
|
+
import { ArrayFactorBaseProps, ArrayFactorProps } from './Array.types';
|
|
4
|
+
export declare const ArrayFactor: <ItemType extends ArrayItemType = "string">({ texts, ...props }: ArrayFactorProps<ItemType>) => React.JSX.Element;
|
|
5
|
+
export declare const ArrayFactorBase: <ItemType extends ArrayItemType>({ value, onChange, itemType, limit, collectorSuggestions, texts, readOnly, error, onActivate, onDeactivate, className, }: ArrayFactorBaseProps<ItemType>) => React.JSX.Element;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo } from "react";
|
|
3
|
+
import Icon, { EditS } from "@synerise/ds-icon";
|
|
4
|
+
import { TagShape } from "@synerise/ds-tag";
|
|
5
|
+
import { useTexts } from "../../hooks/useTexts.js";
|
|
6
|
+
import { TriggerButton, TriggerButtonLabel } from "./Array.styles.js";
|
|
7
|
+
import { ArrayModal } from "./components/ArrayModal.js";
|
|
8
|
+
const NO_VALUE = [];
|
|
9
|
+
const ArrayFactor = ({
|
|
10
|
+
texts,
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
const resolvedTexts = useTexts(texts);
|
|
14
|
+
return /* @__PURE__ */ jsx(ArrayFactorBase, { ...props, texts: resolvedTexts });
|
|
15
|
+
};
|
|
16
|
+
const ArrayFactorBase = ({
|
|
17
|
+
value = NO_VALUE,
|
|
18
|
+
onChange,
|
|
19
|
+
itemType,
|
|
20
|
+
limit,
|
|
21
|
+
collectorSuggestions,
|
|
22
|
+
texts,
|
|
23
|
+
readOnly = false,
|
|
24
|
+
error,
|
|
25
|
+
onActivate,
|
|
26
|
+
onDeactivate,
|
|
27
|
+
className
|
|
28
|
+
}) => {
|
|
29
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
30
|
+
const handleOnClick = () => {
|
|
31
|
+
setIsVisible(true);
|
|
32
|
+
onActivate?.();
|
|
33
|
+
};
|
|
34
|
+
const buttonLabel = useMemo(() => {
|
|
35
|
+
if (!value.length) {
|
|
36
|
+
return texts.array.triggerLabel;
|
|
37
|
+
}
|
|
38
|
+
return `${value.join(", ")} `;
|
|
39
|
+
}, [value, texts.array.triggerLabel]);
|
|
40
|
+
const handleApply = (changedValue) => {
|
|
41
|
+
setIsVisible(false);
|
|
42
|
+
onChange(changedValue);
|
|
43
|
+
};
|
|
44
|
+
const handleCancel = () => {
|
|
45
|
+
setIsVisible(false);
|
|
46
|
+
onDeactivate?.();
|
|
47
|
+
};
|
|
48
|
+
const tagProps = {
|
|
49
|
+
asPill: true,
|
|
50
|
+
name: `${value.length}`,
|
|
51
|
+
color: error ? "var(--ds-color-background-danger-solid)" : "var(--ds-color-background-neutral-solid)",
|
|
52
|
+
textColor: "var(--ds-color-text-base-onsolid)",
|
|
53
|
+
shape: TagShape.DEFAULT_ROUND
|
|
54
|
+
};
|
|
55
|
+
const tooltipProps = value.length ? {
|
|
56
|
+
title: /* @__PURE__ */ jsx(Fragment, { children: value.join(", ") })
|
|
57
|
+
} : void 0;
|
|
58
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
59
|
+
/* @__PURE__ */ jsxs(TriggerButton, { className, error, type: "secondary", mode: readOnly ? "" : "label-icon", onClick: handleOnClick, tooltipProps, "data-testid": "ds-factors-array", tagProps: value.length ? tagProps : void 0, children: [
|
|
60
|
+
/* @__PURE__ */ jsx(TriggerButtonLabel, { children: buttonLabel }),
|
|
61
|
+
!readOnly && /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(EditS, {}) })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsx(ArrayModal, { value, onApply: handleApply, onCancel: handleCancel, texts, visible: isVisible, readOnly, itemType: itemType ?? "string", limit, collectorSuggestions })
|
|
64
|
+
] });
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
ArrayFactor,
|
|
68
|
+
ArrayFactorBase
|
|
69
|
+
};
|
|
@@ -21,7 +21,7 @@ const DateRangeInput = ({
|
|
|
21
21
|
onDeactivate && onDeactivate();
|
|
22
22
|
}
|
|
23
23
|
}, [onDeactivate]);
|
|
24
|
-
return /* @__PURE__ */ jsx(DateRangePicker, { onApply: changeHandler, showTime: true, getPopupContainer: getPopupContainerOverride || getPopupContainer, showFilter: true, value, texts: texts.dateRangePicker,
|
|
24
|
+
return /* @__PURE__ */ jsx(DateRangePicker, { onApply: changeHandler, showTime: true, getPopupContainer: getPopupContainerOverride || getPopupContainer, showFilter: true, value, texts: texts.dateRangePicker, relativeModes: ["PAST"], showRelativePicker: true, placement: "bottomLeft", onVisibleChange: handleVisibleChange, showNowButton: false, filterRangeDisplayMode: "slider", filterValueSelectionModes: ["Range"], rangePickerInputProps: {
|
|
25
25
|
readOnly,
|
|
26
26
|
error,
|
|
27
27
|
allowClear
|
package/dist/Factors.types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentType, ReactNode, ReactText } from 'react';
|
|
2
2
|
import { AutocompleteProps } from '@synerise/ds-autocomplete';
|
|
3
3
|
import { CollectorValue } from '@synerise/ds-collector';
|
|
4
|
-
import {
|
|
4
|
+
import { DateRange, DateRangePickerTexts as DateRangeTexts, RelativeUnit } from '@synerise/ds-date-range-picker';
|
|
5
5
|
import { InformationCardProps } from '@synerise/ds-information-card';
|
|
6
6
|
import { AutoResizeProp, InputProps } from '@synerise/ds-input';
|
|
7
7
|
import { ListItemProps } from '@synerise/ds-list-item';
|
|
@@ -10,7 +10,7 @@ export declare const ALL_FACTOR_TYPES: readonly ["text", "number", "parameter",
|
|
|
10
10
|
export type FactorType = LiteralStringUnion<(typeof ALL_FACTOR_TYPES)[number]>;
|
|
11
11
|
export type DefinedFactorTypes = (typeof ALL_FACTOR_TYPES)[number];
|
|
12
12
|
export type TupleType = [DefinedFactorTypes, SelectedFactorType];
|
|
13
|
-
export type RelativeDateUnit =
|
|
13
|
+
export type RelativeDateUnit = RelativeUnit;
|
|
14
14
|
export type RelativeTimeRelation = 'BEFORE' | 'AFTER';
|
|
15
15
|
export type RelativeDateValueType = {
|
|
16
16
|
temporalUnit: RelativeDateUnit;
|
|
@@ -54,7 +54,7 @@ export type ParameterItem = {
|
|
|
54
54
|
};
|
|
55
55
|
export type ArrayItemType = 'string' | 'number';
|
|
56
56
|
export type ArrayValue = ArrayValueElement<'string'>[] | ArrayValueElement<'number'>[];
|
|
57
|
-
export type FactorValueType = string | number | null | Date | RelativeDateValueType | undefined | DynamicKeyValueType | FormulaValueType | ArrayValue | ParameterValueType |
|
|
57
|
+
export type FactorValueType = string | number | null | Date | RelativeDateValueType | undefined | DynamicKeyValueType | FormulaValueType | ArrayValue | ParameterValueType | DateRange;
|
|
58
58
|
export type SelectedFactorType = {
|
|
59
59
|
name: string;
|
|
60
60
|
icon: ReactNode;
|
package/dist/hooks/useTexts.js
CHANGED
|
@@ -160,18 +160,12 @@ const useTexts = (defaultTexts) => {
|
|
|
160
160
|
id: "DS.FACTORS.ARRAY.EMPTY_TITLE",
|
|
161
161
|
defaultMessage: "No items defined yet"
|
|
162
162
|
}),
|
|
163
|
-
emptyDescription:
|
|
164
|
-
id: "DS.FACTORS.ARRAY.EMPTY_DESCRIPTION",
|
|
165
|
-
defaultMessage: "This is a simple empty state example text. You can easily change it."
|
|
166
|
-
}),
|
|
163
|
+
emptyDescription: void 0,
|
|
167
164
|
emptyResultsTitle: intl.formatMessage({
|
|
168
165
|
id: "DS.FACTORS.ARRAY.EMPTY_RESULTS_TITLE",
|
|
169
166
|
defaultMessage: "No items match your query"
|
|
170
167
|
}),
|
|
171
|
-
emptyResultsDescription:
|
|
172
|
-
id: "DS.FACTORS.ARRAY.EMPTY_RESULTS_DESCRIPTION",
|
|
173
|
-
defaultMessage: "This is a simple empty state example text. You can easily change it."
|
|
174
|
-
}),
|
|
168
|
+
emptyResultsDescription: void 0,
|
|
175
169
|
limitPrefix: intl.formatMessage({
|
|
176
170
|
id: "DS.FACTORS.ARRAY.LIMIT_PREFIX",
|
|
177
171
|
defaultMessage: "Limit"
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export { default, FACTOR_TYPE_MAPPING as factorTypes } from './Factors';
|
|
2
|
-
export { ALL_FACTOR_TYPES, type DefinedFactorTypes, type DynamicKeyValueType, type FactorsProps, type FactorsTexts, type FactorType, type FactorTypeSelectorProps, type FactorValueComponentProps,
|
|
2
|
+
export { ALL_FACTOR_TYPES, type ArrayItemType, type ArrayValue, type ArrayValueElement, type DefinedFactorTypes, type DynamicKeyValueType, type FactorsProps, type FactorsTexts, type FactorType, type FactorTypeSelectorProps, type FactorValueComponentProps,
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated, use FactorValueComponentProps type instead
|
|
5
5
|
*/
|
|
6
6
|
type FactorValueComponentProps as InputProps, type FactorValueProps, type FactorValueType, type FormulaModalProps, type FormulaValueType, type ParameterDropdownProps, type ParameterGroup, type ParameterItem, type ParameterValueType, type SelectedFactorType, type TextModalProps, } from './Factors.types';
|
|
7
|
+
export type { ArrayFactorProps, ArrayModalProps, } from './FactorValue/Array/Array.types';
|
|
8
|
+
export { ArrayFactor } from './FactorValue/Array/ArrayFactor';
|
|
9
|
+
export { ArrayModal } from './FactorValue/Array/components/ArrayModal';
|
|
10
|
+
export { useTexts as useFactorsTexts } from './hooks/useTexts';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { default as default2, FACTOR_TYPE_MAPPING } from "./Factors.js";
|
|
2
2
|
import { ALL_FACTOR_TYPES } from "./Factors.types.js";
|
|
3
|
+
import { ArrayFactor } from "./FactorValue/Array/ArrayFactor.js";
|
|
4
|
+
import { ArrayModal } from "./FactorValue/Array/components/ArrayModal.js";
|
|
5
|
+
import { useTexts } from "./hooks/useTexts.js";
|
|
3
6
|
export {
|
|
4
7
|
ALL_FACTOR_TYPES,
|
|
8
|
+
ArrayFactor,
|
|
9
|
+
ArrayModal,
|
|
5
10
|
default2 as default,
|
|
6
|
-
FACTOR_TYPE_MAPPING as factorTypes
|
|
11
|
+
FACTOR_TYPE_MAPPING as factorTypes,
|
|
12
|
+
useTexts as useFactorsTexts
|
|
7
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-factors",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Factors UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -42,31 +42,31 @@
|
|
|
42
42
|
],
|
|
43
43
|
"types": "dist/index.d.ts",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@synerise/ds-autocomplete": "^2.1.
|
|
45
|
+
"@synerise/ds-autocomplete": "^2.1.2",
|
|
46
46
|
"@synerise/ds-badge": "^2.1.1",
|
|
47
|
-
"@synerise/ds-button": "^2.2.
|
|
48
|
-
"@synerise/ds-button-group": "^2.1.
|
|
49
|
-
"@synerise/ds-collector": "^2.1.
|
|
50
|
-
"@synerise/ds-date-picker": "^2.2.
|
|
51
|
-
"@synerise/ds-date-range-picker": "^2.3.
|
|
47
|
+
"@synerise/ds-button": "^2.2.2",
|
|
48
|
+
"@synerise/ds-button-group": "^2.1.2",
|
|
49
|
+
"@synerise/ds-collector": "^2.1.2",
|
|
50
|
+
"@synerise/ds-date-picker": "^2.2.2",
|
|
51
|
+
"@synerise/ds-date-range-picker": "^2.3.3",
|
|
52
52
|
"@synerise/ds-divider": "^2.1.1",
|
|
53
|
-
"@synerise/ds-dropdown": "^2.2.
|
|
53
|
+
"@synerise/ds-dropdown": "^2.2.2",
|
|
54
54
|
"@synerise/ds-empty-states": "^2.1.1",
|
|
55
55
|
"@synerise/ds-icon": "^2.3.1",
|
|
56
|
-
"@synerise/ds-information-card": "^2.1.
|
|
56
|
+
"@synerise/ds-information-card": "^2.1.2",
|
|
57
57
|
"@synerise/ds-inline-alert": "^2.1.1",
|
|
58
|
-
"@synerise/ds-inline-edit": "^2.1.
|
|
58
|
+
"@synerise/ds-inline-edit": "^2.1.2",
|
|
59
59
|
"@synerise/ds-input": "^2.1.1",
|
|
60
60
|
"@synerise/ds-input-number": "^2.1.1",
|
|
61
|
-
"@synerise/ds-list-item": "^2.4.
|
|
62
|
-
"@synerise/ds-modal": "^2.
|
|
63
|
-
"@synerise/ds-result": "^2.1.
|
|
61
|
+
"@synerise/ds-list-item": "^2.4.1",
|
|
62
|
+
"@synerise/ds-modal": "^2.3.1",
|
|
63
|
+
"@synerise/ds-result": "^2.1.2",
|
|
64
64
|
"@synerise/ds-scrollbar": "^2.1.1",
|
|
65
|
-
"@synerise/ds-search": "^2.1.
|
|
66
|
-
"@synerise/ds-select": "^2.2.
|
|
65
|
+
"@synerise/ds-search": "^2.1.2",
|
|
66
|
+
"@synerise/ds-select": "^2.2.2",
|
|
67
67
|
"@synerise/ds-short-cuts": "^2.1.1",
|
|
68
|
-
"@synerise/ds-skeleton": "^2.1.
|
|
69
|
-
"@synerise/ds-tabs": "^2.1.
|
|
68
|
+
"@synerise/ds-skeleton": "^2.1.2",
|
|
69
|
+
"@synerise/ds-tabs": "^2.1.2",
|
|
70
70
|
"@synerise/ds-tag": "^2.1.1",
|
|
71
71
|
"@synerise/ds-tooltip": "^2.1.1",
|
|
72
72
|
"@synerise/ds-utils": "^2.3.1",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
85
85
|
"styled-components": "^5.3.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "4547f33b8c9317ccc697f89a2b2c62bcf97fbec3"
|
|
88
88
|
}
|