@synerise/ds-collector 1.0.7 → 1.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,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.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@1.0.8...@synerise/ds-collector@1.1.0) (2025-05-19)
7
+
8
+
9
+ ### Features
10
+
11
+ * **collector:** make texts prop optional ([6d59694](https://github.com/Synerise/synerise-design/commit/6d59694a427102714ebcd9579fe086d72066d9af))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.0.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@1.0.7...@synerise/ds-collector@1.0.8) (2025-05-07)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-collector
20
+
21
+
22
+
23
+
24
+
6
25
  ## [1.0.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-collector@1.0.6...@synerise/ds-collector@1.0.7) (2025-04-24)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-collector
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { CollectorProps } from './Collector.types';
3
3
  declare const Collector: {
4
- ({ allowCustomValue, allowMultipleValues, addButtonProps, cancelButtonProps, keepSearchQueryOnSelect, error, className, description, enableCustomFilteringSuggestions, selected, suggestions, showNavigationHints, onConfirm, onCancel, label, errorText, disabled, fixedHeight, texts, lookupConfig, onItemAdd, onItemDeselect, onItemSelect, onMultipleItemsSelect, dropdownContent, disableButtonPanel, disableSearch, dropdownItemHeight, searchValue, renderItem, onSearchValueChange, allowPaste, showCount, listHeader, hideDropdownOnClickOutside, valuesSeparator, }: CollectorProps): React.JSX.Element;
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>;
6
6
  ContentBelow: import("styled-components").StyledComponent<"div", any, {}, never>;
7
7
  Description: import("styled-components").StyledComponent<"div", any, {}, never>;
package/dist/Collector.js CHANGED
@@ -9,6 +9,7 @@ import OptionsDropdown from './Elements/OptionsDropdown/OptionsDropdown';
9
9
  import { filterOutNullishArrayItems, filterValueSuggestions, isOverflown, scrollWithHorizontalArrow } from './utils';
10
10
  import Values from './Elements/Values/Values';
11
11
  import NavigationHint from './Elements/NavigationHint/NavigationHint';
12
+ import { useTranslations } from './hooks/useTranslations';
12
13
  var DROPDOWN_PADDING = 2 * 8;
13
14
  var COLLECTOR_CLASSNAME = 'ds-collector';
14
15
  var DEFAULT_VALUES_SEPARATOR = ';';
@@ -32,7 +33,7 @@ var Collector = function Collector(_ref) {
32
33
  errorText = _ref.errorText,
33
34
  disabled = _ref.disabled,
34
35
  fixedHeight = _ref.fixedHeight,
35
- texts = _ref.texts,
36
+ defaultTexts = _ref.texts,
36
37
  lookupConfig = _ref.lookupConfig,
37
38
  onItemAdd = _ref.onItemAdd,
38
39
  onItemDeselect = _ref.onItemDeselect,
@@ -52,6 +53,7 @@ var Collector = function Collector(_ref) {
52
53
  hideDropdownOnClickOutside = _ref$hideDropdownOnCl === void 0 ? true : _ref$hideDropdownOnCl,
53
54
  _ref$valuesSeparator = _ref.valuesSeparator,
54
55
  valuesSeparator = _ref$valuesSeparator === void 0 ? DEFAULT_VALUES_SEPARATOR : _ref$valuesSeparator;
56
+ var texts = useTranslations(defaultTexts);
55
57
  var inputRef = useRef(null);
56
58
  var containerRef = useRef(null);
57
59
  var mainContentRef = useRef(null);
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type { ReactNode } from 'react';
2
2
  import { ButtonProps } from '@synerise/ds-button';
3
3
  import { ScrollbarAdditionalProps } from '@synerise/ds-scrollbar';
4
4
  export type CollectorProps = {
@@ -7,22 +7,22 @@ export type CollectorProps = {
7
7
  allowMultipleValues?: boolean;
8
8
  cancelButtonProps?: Partial<ButtonProps>;
9
9
  className?: string;
10
- description?: React.ReactNode | string;
10
+ description?: ReactNode;
11
11
  disabled?: boolean;
12
12
  disableSearch?: boolean;
13
13
  disableButtonPanel?: boolean;
14
- dropdownContent?: React.ReactNode;
14
+ dropdownContent?: ReactNode;
15
15
  error?: boolean;
16
- errorText?: React.ReactNode | string;
16
+ errorText?: ReactNode;
17
17
  fixedHeight?: boolean;
18
18
  keepSearchQueryOnSelect?: boolean;
19
- label?: React.ReactNode | string;
19
+ label?: ReactNode;
20
20
  lookupConfig?: LookupConfig;
21
21
  onSearchValueChange?: (value: string) => void;
22
22
  onConfirm?: (values: CollectorValue[]) => void;
23
23
  onCancel?: () => void;
24
24
  onItemDeselect?: (item: CollectorValue) => void;
25
- onItemAdd?: (itemName: React.ReactText) => CollectorValue;
25
+ onItemAdd?: (itemName: string | number) => CollectorValue;
26
26
  onItemSelect: (item: CollectorValue) => void;
27
27
  onMultipleItemsSelect?: (items: CollectorValue[]) => void;
28
28
  renderItem?: (value: CollectorValue) => JSX.Element;
@@ -30,23 +30,23 @@ export type CollectorProps = {
30
30
  searchValue?: string;
31
31
  selected: CollectorValue[];
32
32
  suggestions: CollectorValue[];
33
- texts: CollectorTexts;
33
+ texts?: Partial<CollectorTexts>;
34
34
  dropdownItemHeight?: 'large';
35
35
  enableCustomFilteringSuggestions?: boolean;
36
36
  scrollbarProps?: ScrollbarAdditionalProps;
37
37
  allowPaste?: boolean;
38
38
  showCount?: boolean;
39
39
  valuesSeparator?: CollectorValuesSeparator;
40
- listHeader?: React.ReactNode;
40
+ listHeader?: ReactNode;
41
41
  hideDropdownOnClickOutside?: boolean;
42
42
  };
43
43
  export type CollectorValuesSeparator = ';' | ',' | '|';
44
44
  export type CollectorTexts = {
45
- add: string | React.ReactNode;
46
- cancel: string | React.ReactNode;
45
+ add: ReactNode;
46
+ cancel: ReactNode;
47
47
  placeholder: string;
48
- toNavigate: string | React.ReactNode;
49
- toSelect: string | React.ReactNode;
48
+ toNavigate: ReactNode;
49
+ toSelect: ReactNode;
50
50
  };
51
51
  export type LookupConfig = {
52
52
  filter: string;
@@ -0,0 +1,2 @@
1
+ import type { CollectorTexts } from '../Collector.types';
2
+ export declare const useTranslations: (texts?: Partial<CollectorTexts>) => CollectorTexts;
@@ -0,0 +1,28 @@
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 from 'react';
3
+ import { FormattedMessage, useIntl } from 'react-intl';
4
+ export var useTranslations = function useTranslations(texts) {
5
+ var intl = useIntl();
6
+ return _extends({
7
+ add: /*#__PURE__*/React.createElement(FormattedMessage, {
8
+ id: "DS.COLLECTOR.ADD",
9
+ defaultMessage: "Add"
10
+ }),
11
+ cancel: /*#__PURE__*/React.createElement(FormattedMessage, {
12
+ id: "DS.COLLECTOR.CANCEL",
13
+ defaultMessage: "Cancel"
14
+ }),
15
+ placeholder: intl.formatMessage({
16
+ id: 'DS.COLLECTOR.PLACEHOLDER',
17
+ defaultMessage: 'Type value'
18
+ }),
19
+ toNavigate: /*#__PURE__*/React.createElement(FormattedMessage, {
20
+ id: "DS.COLLECTOR.TO-NAVIGATE",
21
+ defaultMessage: "to navigate"
22
+ }),
23
+ toSelect: /*#__PURE__*/React.createElement(FormattedMessage, {
24
+ id: "DS.COLLECTOR.TO-SELECT",
25
+ defaultMessage: "to select"
26
+ })
27
+ }, texts || {});
28
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-collector",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
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.1.5",
38
- "@synerise/ds-divider": "^1.0.6",
39
- "@synerise/ds-icon": "^1.4.1",
40
- "@synerise/ds-input": "^1.1.1",
41
- "@synerise/ds-list-item": "^1.0.6",
42
- "@synerise/ds-scrollbar": "^1.0.6",
43
- "@synerise/ds-search": "^1.1.3",
44
- "@synerise/ds-utils": "^1.0.1",
37
+ "@synerise/ds-button": "^1.3.0",
38
+ "@synerise/ds-divider": "^1.0.8",
39
+ "@synerise/ds-icon": "^1.5.0",
40
+ "@synerise/ds-input": "^1.1.3",
41
+ "@synerise/ds-list-item": "^1.0.8",
42
+ "@synerise/ds-scrollbar": "^1.0.8",
43
+ "@synerise/ds-search": "^1.1.5",
44
+ "@synerise/ds-utils": "^1.1.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": "fc601270d3c84a5a52b62473a01f1b3c1c7014a7"
58
+ "gitHead": "8aa16b27c86c97e3ac774d92561ab0a03176c439"
59
59
  }