@synerise/ds-collector 1.1.4 → 1.2.1
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/dist/Collector.d.ts +1 -1
- package/dist/Collector.js +21 -9
- package/dist/Collector.styles.d.ts +3 -2
- package/dist/Collector.styles.js +16 -11
- package/dist/Collector.types.d.ts +5 -4
- package/dist/Elements/Values/Values.d.ts +1 -1
- package/dist/Elements/Values/Values.js +3 -2
- package/dist/Elements/Values/Values.types.d.ts +1 -0
- package/package.json +10 -10
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
|
+
## [1.2.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@1.2.0...@synerise/ds-collector@1.2.1) (2025-06-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-collector
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.2.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@1.1.4...@synerise/ds-collector@1.2.0) (2025-06-24)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **factors:** array factor type ([195d328](https://github.com/Synerise/synerise-design/commit/195d3286e98b5f07fc9c1e56001e6ae844b7a080))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [1.1.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@1.1.3...@synerise/ds-collector@1.1.4) (2025-06-12)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-collector
|
package/dist/Collector.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ declare const Collector: {
|
|
|
49
49
|
}, never>;
|
|
50
50
|
Counter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
51
51
|
Label: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
52
|
-
Values:
|
|
52
|
+
Values: ({ values, onDeselect, disabled, focused, displayLookupKey }: import("./Elements/Values/Values.types").ValuesProps) => React.JSX.Element;
|
|
53
53
|
ButtonPanel: React.FC<import("./Elements/ButtonPanel/ButtonPanel.types").ButtonPanelProps>;
|
|
54
54
|
OptionsDropdown: ({ showAddButton, options, visible, value, onSelect, onClick, width, onItemAdd, showNavigationHints, lookupKey, texts, customContent, renderItem, dropdownItemHeight, scrollbarProps, listHeader, }: import("./Elements/OptionsDropdown/OptionsDropdown.types").OptionsDropdownProps) => React.JSX.Element;
|
|
55
55
|
NavigationHint: React.FC<import("./Elements/NavigationHint/NavigationHint.types").NavigationHintProps>;
|
package/dist/Collector.js
CHANGED
|
@@ -188,8 +188,8 @@ var Collector = function Collector(_ref) {
|
|
|
188
188
|
if (allowMultipleValues) {
|
|
189
189
|
onItemSelect(newValue);
|
|
190
190
|
setValue('');
|
|
191
|
-
} else {
|
|
192
|
-
onConfirm
|
|
191
|
+
} else if (onConfirm) {
|
|
192
|
+
onConfirm([newValue]);
|
|
193
193
|
!keepSearchQueryOnSelect && clear();
|
|
194
194
|
}
|
|
195
195
|
};
|
|
@@ -203,10 +203,18 @@ var Collector = function Collector(_ref) {
|
|
|
203
203
|
};
|
|
204
204
|
var handleKeyPress = function handleKeyPress(event) {
|
|
205
205
|
if (event.key === 'Enter') {
|
|
206
|
-
|
|
206
|
+
if (value) {
|
|
207
|
+
addItem();
|
|
208
|
+
} else if (selectedValues.length) {
|
|
209
|
+
onConfirmCallback();
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
207
212
|
}
|
|
208
|
-
if (
|
|
209
|
-
|
|
213
|
+
if (allowCustomValue && event.key === valuesSeparator) {
|
|
214
|
+
event.preventDefault();
|
|
215
|
+
if (value.trim()) {
|
|
216
|
+
addItem();
|
|
217
|
+
}
|
|
210
218
|
}
|
|
211
219
|
};
|
|
212
220
|
var onCancelCallback = useCallback(function () {
|
|
@@ -214,10 +222,13 @@ var Collector = function Collector(_ref) {
|
|
|
214
222
|
onCancel && onCancel();
|
|
215
223
|
}, [onCancel, clear]);
|
|
216
224
|
var onConfirmCallback = useCallback(function () {
|
|
225
|
+
if (!onConfirm) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
217
228
|
if (allowMultipleValues) {
|
|
218
229
|
var createdItem = value && createItem(value);
|
|
219
230
|
var finalItems = createdItem ? [].concat(selectedValues, [createdItem]) : selectedValues;
|
|
220
|
-
onConfirm
|
|
231
|
+
onConfirm(finalItems);
|
|
221
232
|
clear();
|
|
222
233
|
return;
|
|
223
234
|
}
|
|
@@ -296,7 +307,8 @@ var Collector = function Collector(_ref) {
|
|
|
296
307
|
transparent: !!disableSearch,
|
|
297
308
|
hidden: !!disableSearch && !!selectedValues.length,
|
|
298
309
|
placeholder: selectedValues && selectedValues.length ? undefined : texts == null ? void 0 : texts.placeholder,
|
|
299
|
-
hasValues: !!(selectedValues != null && selectedValues.length)
|
|
310
|
+
hasValues: !!(selectedValues != null && selectedValues.length),
|
|
311
|
+
"data-testid": "ds-collector-input"
|
|
300
312
|
})));
|
|
301
313
|
var innerContent = fixedHeight ? valuesContainer : /*#__PURE__*/React.createElement(S.Scrollbar, {
|
|
302
314
|
absolute: true,
|
|
@@ -328,9 +340,9 @@ var Collector = function Collector(_ref) {
|
|
|
328
340
|
disabled: !!disabled,
|
|
329
341
|
showCancel: !!value || !!(selectedValues != null && selectedValues.length),
|
|
330
342
|
texts: texts,
|
|
331
|
-
addButtonProps: _extends({
|
|
343
|
+
addButtonProps: _extends({
|
|
332
344
|
disabled: !isAddActive
|
|
333
|
-
}),
|
|
345
|
+
}, addButtonProps),
|
|
334
346
|
cancelButtonProps: cancelButtonProps
|
|
335
347
|
}))), /*#__PURE__*/React.createElement(OptionsDropdown, {
|
|
336
348
|
options: filteredSuggestions,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ContentAbove, Label, ContentBelow, Description, ErrorText, ValueText } from '@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles';
|
|
3
|
-
import Value from '@synerise/ds-input/dist/InputMultivalue/Elements/Value';
|
|
4
3
|
import Button from '@synerise/ds-button';
|
|
5
4
|
export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
5
|
export declare const CollectorInput: import("styled-components").StyledComponent<"div", any, import("@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles").InputWrapperProps & {
|
|
@@ -45,7 +44,9 @@ export declare const Input: import("styled-components").StyledComponent<"input",
|
|
|
45
44
|
hidden: boolean;
|
|
46
45
|
}, never>;
|
|
47
46
|
export declare const SearchWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
48
|
-
export { Value
|
|
47
|
+
export declare const CollectorValue: import("styled-components").StyledComponent<({ disabled, key, onRemoveClick, value, focused, className, ...rest }: import("@synerise/ds-input/dist/InputMultivalue/Elements/Value.types").ValueProps) => import("react").JSX.Element, any, {
|
|
48
|
+
hasError?: boolean | undefined;
|
|
49
|
+
}, never>;
|
|
49
50
|
export { ContentAbove };
|
|
50
51
|
export { Label };
|
|
51
52
|
export { ContentBelow };
|
package/dist/Collector.styles.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { InputWrapper, BorderLessInput, ContentAbove, Label, ContentBelow, Description, ErrorText, ValueText } from '@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles';
|
|
2
|
-
import DSScrollbar from '@synerise/ds-scrollbar';
|
|
3
1
|
import styled, { css } from 'styled-components';
|
|
2
|
+
import { InputWrapper, IconWrapper, BorderLessInput, ContentAbove, Label, ContentBelow, Description, ErrorText, ValueText } from '@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles';
|
|
3
|
+
import DSScrollbar from '@synerise/ds-scrollbar';
|
|
4
4
|
import Value from '@synerise/ds-input/dist/InputMultivalue/Elements/Value';
|
|
5
5
|
import Button from '@synerise/ds-button';
|
|
6
6
|
export var Container = styled.div.withConfig({
|
|
@@ -60,7 +60,12 @@ export var SearchWrapper = styled.div.withConfig({
|
|
|
60
60
|
displayName: "Collectorstyles__SearchWrapper",
|
|
61
61
|
componentId: "sc-14aly5p-6"
|
|
62
62
|
})(["flex:1 0 auto;"]);
|
|
63
|
-
export
|
|
63
|
+
export var CollectorValue = styled(Value).withConfig({
|
|
64
|
+
displayName: "Collectorstyles__CollectorValue",
|
|
65
|
+
componentId: "sc-14aly5p-7"
|
|
66
|
+
})(["", ""], function (props) {
|
|
67
|
+
return props.hasError && css(["&&{background:", ";color:", ";", "{color:", ";}}"], props.theme.palette['red-600'], props.theme.palette.white, IconWrapper, props.theme.palette.white);
|
|
68
|
+
});
|
|
64
69
|
export { ContentAbove };
|
|
65
70
|
export { Label };
|
|
66
71
|
export { ContentBelow };
|
|
@@ -69,33 +74,33 @@ export { ErrorText };
|
|
|
69
74
|
export { ValueText };
|
|
70
75
|
export var DropdownWrapper = styled.div.withConfig({
|
|
71
76
|
displayName: "Collectorstyles__DropdownWrapper",
|
|
72
|
-
componentId: "sc-14aly5p-
|
|
77
|
+
componentId: "sc-14aly5p-8"
|
|
73
78
|
})(["position:relative;user-select:none;"]);
|
|
74
79
|
export var CustomContentWrapper = styled.div.withConfig({
|
|
75
80
|
displayName: "Collectorstyles__CustomContentWrapper",
|
|
76
|
-
componentId: "sc-14aly5p-
|
|
81
|
+
componentId: "sc-14aly5p-9"
|
|
77
82
|
})(["position:absolute;z-index:99;"]);
|
|
78
83
|
export var DropdownContent = styled.div.withConfig({
|
|
79
84
|
displayName: "Collectorstyles__DropdownContent",
|
|
80
|
-
componentId: "sc-14aly5p-
|
|
85
|
+
componentId: "sc-14aly5p-10"
|
|
81
86
|
})(["background:", ";border-radius:3px;padding:8px 0 8px 8px;position:absolute;width:100%;top:4px;left:0;box-shadow:0 16px 32px 0 rgba(35,41,54,0.12);z-index:99;"], function (props) {
|
|
82
87
|
return props.theme.palette.white;
|
|
83
88
|
});
|
|
84
89
|
export var DropdownAddButton = styled(Button).withConfig({
|
|
85
90
|
displayName: "Collectorstyles__DropdownAddButton",
|
|
86
|
-
componentId: "sc-14aly5p-
|
|
91
|
+
componentId: "sc-14aly5p-11"
|
|
87
92
|
})(["white-space:nowrap;overflow:hidden;width:100%;text-overflow:ellipsis;&&{display:flex;justify-content:flex-start;align-items:center;font-weight:400;text-align:left;}.ds-icon{margin-left:16px;margin-right:8px;}strong{font-weight:500;margin:0 0 0 3px;display:block;overflow:hidden;text-overflow:ellipsis;}"]);
|
|
88
93
|
export var DropdownTop = styled.div.withConfig({
|
|
89
94
|
displayName: "Collectorstyles__DropdownTop",
|
|
90
|
-
componentId: "sc-14aly5p-
|
|
95
|
+
componentId: "sc-14aly5p-12"
|
|
91
96
|
})(["padding-right:8px;"]);
|
|
92
97
|
export var DividerContainer = styled.div.withConfig({
|
|
93
98
|
displayName: "Collectorstyles__DividerContainer",
|
|
94
|
-
componentId: "sc-14aly5p-
|
|
99
|
+
componentId: "sc-14aly5p-13"
|
|
95
100
|
})(["padding:8px 12px;"]);
|
|
96
101
|
export var NavigationWrapper = styled.div.withConfig({
|
|
97
102
|
displayName: "Collectorstyles__NavigationWrapper",
|
|
98
|
-
componentId: "sc-14aly5p-
|
|
103
|
+
componentId: "sc-14aly5p-14"
|
|
99
104
|
})(["margin-top:8px;border-top:1px solid ", ";background:", ";padding:12px 16px;margin-left:-8px;margin-bottom:-8px;color:", ";display:flex;align-items:center;.ds-icon > svg{fill:", ";}span{margin-left:2px;margin-right:8px;font-weight:500;}"], function (props) {
|
|
100
105
|
return props.theme.palette['grey-100'];
|
|
101
106
|
}, function (props) {
|
|
@@ -107,5 +112,5 @@ export var NavigationWrapper = styled.div.withConfig({
|
|
|
107
112
|
});
|
|
108
113
|
export var Counter = styled.div.withConfig({
|
|
109
114
|
displayName: "Collectorstyles__Counter",
|
|
110
|
-
componentId: "sc-14aly5p-
|
|
115
|
+
componentId: "sc-14aly5p-15"
|
|
111
116
|
})(["display:flex;height:26px;align-items:center;column-gap:4px;"]);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { ButtonProps } from '@synerise/ds-button';
|
|
3
|
-
import { ScrollbarAdditionalProps } from '@synerise/ds-scrollbar';
|
|
2
|
+
import type { ButtonProps } from '@synerise/ds-button';
|
|
3
|
+
import type { ScrollbarAdditionalProps } from '@synerise/ds-scrollbar';
|
|
4
|
+
import { DataAttributes } from '@synerise/ds-utils';
|
|
4
5
|
export type CollectorProps = {
|
|
5
|
-
addButtonProps?: Partial<ButtonProps>;
|
|
6
|
+
addButtonProps?: Partial<ButtonProps & DataAttributes>;
|
|
6
7
|
allowCustomValue?: boolean;
|
|
7
8
|
allowMultipleValues?: boolean;
|
|
8
|
-
cancelButtonProps?: Partial<ButtonProps>;
|
|
9
|
+
cancelButtonProps?: Partial<ButtonProps & DataAttributes>;
|
|
9
10
|
className?: string;
|
|
10
11
|
description?: ReactNode;
|
|
11
12
|
disabled?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ValuesProps } from './Values.types';
|
|
3
|
-
declare const Values: React.
|
|
3
|
+
export declare const Values: ({ values, onDeselect, disabled, focused, displayLookupKey }: ValuesProps) => React.JSX.Element;
|
|
4
4
|
export default Values;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import * as S from '../../Collector.styles';
|
|
3
|
-
var Values = function Values(_ref) {
|
|
3
|
+
export var Values = function Values(_ref) {
|
|
4
4
|
var values = _ref.values,
|
|
5
5
|
onDeselect = _ref.onDeselect,
|
|
6
6
|
disabled = _ref.disabled,
|
|
@@ -15,7 +15,8 @@ var Values = function Values(_ref) {
|
|
|
15
15
|
},
|
|
16
16
|
value: val[displayLookupKey],
|
|
17
17
|
focused: focused,
|
|
18
|
-
disabled: disabled
|
|
18
|
+
disabled: disabled,
|
|
19
|
+
hasError: val.hasError
|
|
19
20
|
});
|
|
20
21
|
}));
|
|
21
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-collector",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Collector UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^1.
|
|
38
|
-
"@synerise/ds-divider": "^1.0.
|
|
39
|
-
"@synerise/ds-icon": "^1.5.
|
|
40
|
-
"@synerise/ds-input": "^1.
|
|
41
|
-
"@synerise/ds-list-item": "^1.0.
|
|
42
|
-
"@synerise/ds-scrollbar": "^1.
|
|
43
|
-
"@synerise/ds-search": "^1.1
|
|
44
|
-
"@synerise/ds-utils": "^1.
|
|
37
|
+
"@synerise/ds-button": "^1.4.1",
|
|
38
|
+
"@synerise/ds-divider": "^1.0.12",
|
|
39
|
+
"@synerise/ds-icon": "^1.5.3",
|
|
40
|
+
"@synerise/ds-input": "^1.3.1",
|
|
41
|
+
"@synerise/ds-list-item": "^1.0.12",
|
|
42
|
+
"@synerise/ds-scrollbar": "^1.1.1",
|
|
43
|
+
"@synerise/ds-search": "^1.2.1",
|
|
44
|
+
"@synerise/ds-utils": "^1.3.0",
|
|
45
45
|
"classnames": "2.3.2",
|
|
46
46
|
"lodash.isequal": "^4.5.0"
|
|
47
47
|
},
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/lodash.isequal": "^4.5.8"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "11fe1d29b2ac23e70c3d5e6ce8ae20201a619a34"
|
|
59
59
|
}
|