@synerise/ds-collector 1.2.0 → 1.2.2
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 +546 -1776
- package/dist/Collector.d.ts +2 -2
- package/dist/Collector.js +10 -6
- package/dist/Collector.styles.d.ts +1 -1
- package/dist/Collector.styles.js +3 -3
- package/dist/Collector.types.d.ts +1 -1
- package/dist/Elements/ButtonPanel/ButtonPanel.d.ts +1 -1
- package/dist/Elements/ButtonPanel/ButtonPanel.types.d.ts +1 -1
- package/dist/Elements/NavigationHint/NavigationHint.d.ts +1 -1
- package/dist/Elements/NavigationHint/NavigationHint.types.d.ts +1 -1
- package/dist/Elements/OptionsDropdown/OptionsDropdown.d.ts +1 -1
- package/dist/Elements/OptionsDropdown/OptionsDropdown.js +7 -5
- package/dist/Elements/OptionsDropdown/OptionsDropdown.types.d.ts +3 -3
- package/dist/Elements/Values/Values.d.ts +2 -2
- package/dist/Elements/Values/Values.js +1 -2
- package/dist/Elements/Values/Values.types.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/utils.d.ts +3 -3
- package/package.json +10 -10
package/dist/Collector.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CollectorProps } from './Collector.types';
|
|
2
|
+
import { type CollectorProps } from './Collector.types';
|
|
3
3
|
declare const Collector: {
|
|
4
4
|
({ allowCustomValue, allowMultipleValues, addButtonProps, cancelButtonProps, keepSearchQueryOnSelect, error, className, description, enableCustomFilteringSuggestions, selected, suggestions, showNavigationHints, onConfirm, onCancel, label, errorText, disabled, fixedHeight, texts: defaultTexts, lookupConfig, onItemAdd, onItemDeselect, onItemSelect, onMultipleItemsSelect, dropdownContent, disableButtonPanel, disableSearch, dropdownItemHeight, searchValue, renderItem, onSearchValueChange, allowPaste, showCount, listHeader, hideDropdownOnClickOutside, valuesSeparator, }: CollectorProps): React.JSX.Element;
|
|
5
5
|
Container: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -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: ({ values, onDeselect, disabled, focused, displayLookupKey }: import("./Elements/Values/Values.types").ValuesProps) => React.JSX.Element;
|
|
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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useEffect, useMemo, useCallback, useRef, useState } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { FormattedMessage } from 'react-intl';
|
|
5
5
|
import { focusWithArrowKeys, useOnClickOutside } from '@synerise/ds-utils';
|
|
6
6
|
import * as S from './Collector.styles';
|
|
7
7
|
import ButtonPanel from './Elements/ButtonPanel/ButtonPanel';
|
|
8
|
+
import NavigationHint from './Elements/NavigationHint/NavigationHint';
|
|
8
9
|
import OptionsDropdown from './Elements/OptionsDropdown/OptionsDropdown';
|
|
9
|
-
import { filterOutNullishArrayItems, filterValueSuggestions, isOverflown, scrollWithHorizontalArrow } from './utils';
|
|
10
10
|
import Values from './Elements/Values/Values';
|
|
11
|
-
import NavigationHint from './Elements/NavigationHint/NavigationHint';
|
|
12
11
|
import { useTranslations } from './hooks/useTranslations';
|
|
12
|
+
import { filterOutNullishArrayItems, filterValueSuggestions, isOverflown, scrollWithHorizontalArrow } from './utils';
|
|
13
13
|
var DROPDOWN_PADDING = 2 * 8;
|
|
14
14
|
var COLLECTOR_CLASSNAME = 'ds-collector';
|
|
15
15
|
var DEFAULT_VALUES_SEPARATOR = ';';
|
|
@@ -153,7 +153,9 @@ var Collector = function Collector(_ref) {
|
|
|
153
153
|
}
|
|
154
154
|
}, [selectedValues, mainContentRef, fixedHeight]);
|
|
155
155
|
useEffect(function () {
|
|
156
|
-
if (!enableCustomFilteringSuggestions)
|
|
156
|
+
if (!enableCustomFilteringSuggestions) {
|
|
157
|
+
filterSuggestions(value);
|
|
158
|
+
}
|
|
157
159
|
}, [value, selectedValues, filterSuggestions, enableCustomFilteringSuggestions]);
|
|
158
160
|
useEffect(function () {
|
|
159
161
|
setIsAddActive(Boolean(selected.length) || canCreateItemFromValue());
|
|
@@ -235,7 +237,7 @@ var Collector = function Collector(_ref) {
|
|
|
235
237
|
var suggestionsIncludesCurrentValue = suggestionsIncludesItem(value);
|
|
236
238
|
if (allowCustomValue || suggestionsIncludesCurrentValue) {
|
|
237
239
|
var newValue = onItemAdd && onItemAdd(value);
|
|
238
|
-
newValue && onConfirm
|
|
240
|
+
newValue && onConfirm([newValue]);
|
|
239
241
|
clear();
|
|
240
242
|
}
|
|
241
243
|
}, [allowMultipleValues, suggestionsIncludesItem, value, allowCustomValue, createItem, selectedValues, onConfirm, clear, onItemAdd]);
|
|
@@ -260,7 +262,9 @@ var Collector = function Collector(_ref) {
|
|
|
260
262
|
if (!isPasteEvent) {
|
|
261
263
|
onSearchValueChange && onSearchValueChange(event.target.value);
|
|
262
264
|
setValue(event.target.value);
|
|
263
|
-
if (!enableCustomFilteringSuggestions)
|
|
265
|
+
if (!enableCustomFilteringSuggestions) {
|
|
266
|
+
filterSuggestions(event.target.value);
|
|
267
|
+
}
|
|
264
268
|
}
|
|
265
269
|
};
|
|
266
270
|
useOnClickOutside(containerRef, function () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ContentAbove, Label, ContentBelow, Description, ErrorText, ValueText } from '@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles';
|
|
3
2
|
import Button from '@synerise/ds-button';
|
|
3
|
+
import { ContentAbove, ContentBelow, Description, ErrorText, Label, ValueText } from '@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles';
|
|
4
4
|
export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
5
|
export declare const CollectorInput: import("styled-components").StyledComponent<"div", any, import("@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles").InputWrapperProps & {
|
|
6
6
|
error?: boolean | undefined;
|
package/dist/Collector.styles.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
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
|
-
import Value from '@synerise/ds-input/dist/InputMultivalue/Elements/Value';
|
|
5
2
|
import Button from '@synerise/ds-button';
|
|
3
|
+
import Value from '@synerise/ds-input/dist/InputMultivalue/Elements/Value';
|
|
4
|
+
import { BorderLessInput, ContentAbove, ContentBelow, Description, ErrorText, IconWrapper, InputWrapper, Label, ValueText } from '@synerise/ds-input/dist/InputMultivalue/InputMultivalue.styles';
|
|
5
|
+
import DSScrollbar from '@synerise/ds-scrollbar';
|
|
6
6
|
export var Container = styled.div.withConfig({
|
|
7
7
|
displayName: "Collectorstyles__Container",
|
|
8
8
|
componentId: "sc-14aly5p-0"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ButtonProps } from '@synerise/ds-button';
|
|
3
3
|
import type { ScrollbarAdditionalProps } from '@synerise/ds-scrollbar';
|
|
4
|
-
import { DataAttributes } from '@synerise/ds-utils';
|
|
4
|
+
import type { DataAttributes } from '@synerise/ds-utils';
|
|
5
5
|
export type CollectorProps = {
|
|
6
6
|
addButtonProps?: Partial<ButtonProps & DataAttributes>;
|
|
7
7
|
allowCustomValue?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OptionsDropdownProps } from './OptionsDropdown.types';
|
|
2
|
+
import { type OptionsDropdownProps } from './OptionsDropdown.types';
|
|
3
3
|
declare const OptionsDropdown: ({ showAddButton, options, visible, value, onSelect, onClick, width, onItemAdd, showNavigationHints, lookupKey, texts, customContent, renderItem, dropdownItemHeight, scrollbarProps, listHeader, }: OptionsDropdownProps) => React.JSX.Element;
|
|
4
4
|
export default OptionsDropdown;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useEffect, useState
|
|
3
|
-
import Scrollbar from '@synerise/ds-scrollbar';
|
|
4
|
-
import SearchItems from '@synerise/ds-search/dist/Elements/SearchItems/SearchItems';
|
|
5
|
-
import Icon, { Add3M } from '@synerise/ds-icon';
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
6
3
|
import Divider from '@synerise/ds-divider';
|
|
4
|
+
import Icon, { Add3M } from '@synerise/ds-icon';
|
|
7
5
|
import ListItem from '@synerise/ds-list-item';
|
|
6
|
+
import Scrollbar from '@synerise/ds-scrollbar';
|
|
7
|
+
import SearchItems from '@synerise/ds-search/dist/Elements/SearchItems/SearchItems';
|
|
8
8
|
import * as S from '../../Collector.styles';
|
|
9
9
|
import NavigationHint from '../NavigationHint/NavigationHint';
|
|
10
10
|
var getRowHeight = function getRowHeight(size) {
|
|
11
|
-
if (size === 'large')
|
|
11
|
+
if (size === 'large') {
|
|
12
|
+
return 54;
|
|
13
|
+
}
|
|
12
14
|
return 32;
|
|
13
15
|
};
|
|
14
16
|
var OptionsDropdown = function OptionsDropdown(_ref) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ScrollbarAdditionalProps } from '@synerise/ds-scrollbar';
|
|
3
|
-
import { CollectorTexts, CollectorValue } from '../../Collector.types';
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type ScrollbarAdditionalProps } from '@synerise/ds-scrollbar';
|
|
3
|
+
import { type CollectorTexts, type CollectorValue } from '../../Collector.types';
|
|
4
4
|
export type OptionsDropdownProps = {
|
|
5
5
|
showAddButton?: boolean;
|
|
6
6
|
options: CollectorValue[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ValuesProps } from './Values.types';
|
|
3
|
-
|
|
2
|
+
import { type ValuesProps } from './Values.types';
|
|
3
|
+
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
|
-
|
|
3
|
+
var Values = function Values(_ref) {
|
|
4
4
|
var values = _ref.values,
|
|
5
5
|
onDeselect = _ref.onDeselect,
|
|
6
6
|
disabled = _ref.disabled,
|
|
@@ -8,7 +8,6 @@ export var Values = function Values(_ref) {
|
|
|
8
8
|
displayLookupKey = _ref.displayLookupKey;
|
|
9
9
|
return /*#__PURE__*/React.createElement(React.Fragment, null, values.map(function (val, index) {
|
|
10
10
|
return /*#__PURE__*/React.createElement(S.CollectorValue, {
|
|
11
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
12
11
|
key: val + "-" + index,
|
|
13
12
|
onRemoveClick: function onRemoveClick() {
|
|
14
13
|
onDeselect && onDeselect(val);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './Collector';
|
|
2
|
-
export type { CollectorValue, CollectorProps, CollectorValuesSeparator, CollectorTexts } from './Collector.types';
|
|
2
|
+
export type { CollectorValue, CollectorProps, CollectorValuesSeparator, CollectorTexts, } from './Collector.types';
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CollectorValue } from './Collector.types';
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type CollectorValue } from './Collector.types';
|
|
3
3
|
export declare const scrollWithHorizontalArrow: (ref: React.RefObject<HTMLElement>, event: React.KeyboardEvent<HTMLElement>, scrollStep?: number | undefined) => void;
|
|
4
|
-
export declare const filterOutNullishArrayItems: <T
|
|
4
|
+
export declare const filterOutNullishArrayItems: <T>(array: ("" | T | null | undefined)[]) => T[];
|
|
5
5
|
export declare const isOverflown: (elementRef: React.RefObject<HTMLDivElement>) => boolean;
|
|
6
6
|
export declare const filterValueSuggestions: (suggestions: CollectorValue[], selected: CollectorValue[], searchValue: string, lookupKey: string) => CollectorValue[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-collector",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
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.4.
|
|
38
|
-
"@synerise/ds-divider": "^1.0.
|
|
39
|
-
"@synerise/ds-icon": "^1.5.
|
|
40
|
-
"@synerise/ds-input": "^1.3.
|
|
41
|
-
"@synerise/ds-list-item": "^1.0.
|
|
42
|
-
"@synerise/ds-scrollbar": "^1.1.
|
|
43
|
-
"@synerise/ds-search": "^1.2.
|
|
44
|
-
"@synerise/ds-utils": "^1.3.
|
|
37
|
+
"@synerise/ds-button": "^1.4.2",
|
|
38
|
+
"@synerise/ds-divider": "^1.0.13",
|
|
39
|
+
"@synerise/ds-icon": "^1.5.4",
|
|
40
|
+
"@synerise/ds-input": "^1.3.2",
|
|
41
|
+
"@synerise/ds-list-item": "^1.0.13",
|
|
42
|
+
"@synerise/ds-scrollbar": "^1.1.2",
|
|
43
|
+
"@synerise/ds-search": "^1.2.2",
|
|
44
|
+
"@synerise/ds-utils": "^1.3.1",
|
|
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": "4512641033ba3581a3df208143c547fcfed45895"
|
|
59
59
|
}
|