@synerise/ds-collector 1.4.25 → 1.4.27

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +9 -7
  3. package/dist/Collector.d.ts +6 -6
  4. package/dist/Collector.js +185 -261
  5. package/dist/Collector.styles.d.ts +17 -17
  6. package/dist/Collector.styles.js +63 -79
  7. package/dist/Collector.types.d.ts +4 -4
  8. package/dist/Collector.types.js +1 -1
  9. package/dist/Elements/ButtonPanel/ButtonPanel.d.ts +2 -2
  10. package/dist/Elements/ButtonPanel/ButtonPanel.js +21 -33
  11. package/dist/Elements/ButtonPanel/ButtonPanel.styles.d.ts +1 -1
  12. package/dist/Elements/ButtonPanel/ButtonPanel.styles.js +6 -3
  13. package/dist/Elements/ButtonPanel/ButtonPanel.types.d.ts +2 -2
  14. package/dist/Elements/ButtonPanel/ButtonPanel.types.js +1 -1
  15. package/dist/Elements/NavigationHint/NavigationHint.d.ts +2 -2
  16. package/dist/Elements/NavigationHint/NavigationHint.js +15 -11
  17. package/dist/Elements/NavigationHint/NavigationHint.types.d.ts +1 -1
  18. package/dist/Elements/NavigationHint/NavigationHint.types.js +1 -1
  19. package/dist/Elements/OptionsDropdown/OptionsDropdown.d.ts +2 -2
  20. package/dist/Elements/OptionsDropdown/OptionsDropdown.js +59 -73
  21. package/dist/Elements/OptionsDropdown/OptionsDropdown.types.d.ts +3 -3
  22. package/dist/Elements/OptionsDropdown/OptionsDropdown.types.js +1 -1
  23. package/dist/Elements/Values/Values.d.ts +2 -2
  24. package/dist/Elements/Values/Values.js +15 -21
  25. package/dist/Elements/Values/Values.types.d.ts +1 -1
  26. package/dist/Elements/Values/Values.types.js +1 -1
  27. package/dist/hooks/useTranslations.d.ts +1 -1
  28. package/dist/hooks/useTranslations.js +17 -26
  29. package/dist/index.js +4 -1
  30. package/dist/modules.d.js +1 -1
  31. package/dist/modules.d.ts +0 -0
  32. package/dist/utils.d.ts +2 -2
  33. package/dist/utils.js +27 -29
  34. package/package.json +14 -14
@@ -1,22 +1,16 @@
1
- import React from 'react';
2
- import * as S from '../../Collector.styles';
3
- var Values = function Values(_ref) {
4
- var values = _ref.values,
5
- onDeselect = _ref.onDeselect,
6
- disabled = _ref.disabled,
7
- focused = _ref.focused,
8
- displayLookupKey = _ref.displayLookupKey;
9
- return /*#__PURE__*/React.createElement(React.Fragment, null, values.map(function (val, index) {
10
- return /*#__PURE__*/React.createElement(S.CollectorValue, {
11
- key: val + "-" + index,
12
- onRemoveClick: function onRemoveClick() {
13
- onDeselect && onDeselect(val);
14
- },
15
- value: val[displayLookupKey],
16
- focused: focused,
17
- disabled: disabled,
18
- hasError: val.hasError
19
- });
20
- }));
1
+ import { jsx, Fragment } from "react/jsx-runtime";
2
+ import { CollectorValue } from "../../Collector.styles.js";
3
+ const Values = ({
4
+ values,
5
+ onDeselect,
6
+ disabled,
7
+ focused,
8
+ displayLookupKey
9
+ }) => {
10
+ return /* @__PURE__ */ jsx(Fragment, { children: values.map((val, index) => /* @__PURE__ */ jsx(CollectorValue, { onRemoveClick: () => {
11
+ onDeselect && onDeselect(val);
12
+ }, value: val[displayLookupKey], focused, disabled, hasError: val.hasError }, `${val}-${index}`)) });
13
+ };
14
+ export {
15
+ Values as default
21
16
  };
22
- export default Values;
@@ -1,4 +1,4 @@
1
- import { type CollectorValue } from '../../Collector.types';
1
+ import { CollectorValue } from '../../Collector.types';
2
2
  export type ValuesProps = {
3
3
  values: CollectorValue[];
4
4
  onDeselect?: (value: CollectorValue) => void;
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,2 +1,2 @@
1
- import type { CollectorTexts } from '../Collector.types';
1
+ import { CollectorTexts } from '../Collector.types';
2
2
  export declare const useTranslations: (texts?: Partial<CollectorTexts>) => CollectorTexts;
@@ -1,28 +1,19 @@
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
- }),
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useIntl, FormattedMessage } from "react-intl";
3
+ const useTranslations = (texts) => {
4
+ const intl = useIntl();
5
+ return {
6
+ add: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.COLLECTOR.ADD", defaultMessage: "Add" }),
7
+ cancel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.COLLECTOR.CANCEL", defaultMessage: "Cancel" }),
15
8
  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"
9
+ id: "DS.COLLECTOR.PLACEHOLDER",
10
+ defaultMessage: "Type value"
22
11
  }),
23
- toSelect: /*#__PURE__*/React.createElement(FormattedMessage, {
24
- id: "DS.COLLECTOR.TO-SELECT",
25
- defaultMessage: "to select"
26
- })
27
- }, texts || {});
28
- };
12
+ toNavigate: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.COLLECTOR.TO-NAVIGATE", defaultMessage: "to navigate" }),
13
+ toSelect: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.COLLECTOR.TO-SELECT", defaultMessage: "to select" }),
14
+ ...texts || {}
15
+ };
16
+ };
17
+ export {
18
+ useTranslations
19
+ };
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- export { default } from './Collector';
1
+ import { default as default2 } from "./Collector.js";
2
+ export {
3
+ default2 as default
4
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom';
1
+ import "@testing-library/jest-dom";
File without changes
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type React from 'react';
2
- import { type CollectorValue } from './Collector.types';
1
+ import { default as React } from 'react';
2
+ import { CollectorValue } from './Collector.types';
3
3
  export declare const scrollWithHorizontalArrow: (ref: React.RefObject<HTMLElement>, event: React.KeyboardEvent<HTMLElement>, scrollStep?: number | undefined) => void;
4
4
  export declare const filterOutEmptyStrings: (items: string[]) => string[];
5
5
  export declare const filterOutNullishArrayItems: <T>(array: (T | null | "" | undefined)[]) => T[];
package/dist/utils.js CHANGED
@@ -1,46 +1,44 @@
1
- import isEqual from 'lodash.isequal';
2
- var INPUT_MIN_WIDTH = 150;
3
- export var scrollWithHorizontalArrow = function scrollWithHorizontalArrow(ref, event, scrollStep) {
4
- if (scrollStep === void 0) {
5
- scrollStep = 200;
6
- }
7
- if (event.key === 'ArrowLeft') {
8
- (ref == null ? void 0 : ref.current) && ref.current.scrollBy({
1
+ import isEqual from "lodash.isequal";
2
+ const INPUT_MIN_WIDTH = 150;
3
+ const scrollWithHorizontalArrow = (ref, event, scrollStep = 200) => {
4
+ if (event.key === "ArrowLeft") {
5
+ ref?.current && ref.current.scrollBy({
9
6
  left: -scrollStep,
10
- behavior: 'smooth'
7
+ behavior: "smooth"
11
8
  });
12
9
  }
13
- if (event.key === 'ArrowRight') {
14
- (ref == null ? void 0 : ref.current) && ref.current.scrollBy({
10
+ if (event.key === "ArrowRight") {
11
+ ref?.current && ref.current.scrollBy({
15
12
  left: scrollStep,
16
- behavior: 'smooth'
13
+ behavior: "smooth"
17
14
  });
18
15
  }
19
16
  };
20
- export var filterOutEmptyStrings = function filterOutEmptyStrings(items) {
21
- return items.filter(function (val) {
22
- return Boolean(val.trim());
23
- });
17
+ const filterOutEmptyStrings = (items) => {
18
+ return items.filter((val) => Boolean(val.trim()));
24
19
  };
25
- export var filterOutNullishArrayItems = function filterOutNullishArrayItems(array) {
26
- var filtered = array.filter(function (val) {
27
- return Boolean(val);
28
- });
20
+ const filterOutNullishArrayItems = (array) => {
21
+ const filtered = array.filter((val) => Boolean(val));
29
22
  return filtered;
30
23
  };
31
- export var isOverflown = function isOverflown(elementRef) {
24
+ const isOverflown = (elementRef) => {
32
25
  if (elementRef !== null && elementRef.current !== null) {
33
- var element = elementRef.current;
26
+ const element = elementRef.current;
34
27
  return element.scrollWidth - INPUT_MIN_WIDTH > element.clientWidth;
35
28
  }
36
29
  return false;
37
30
  };
38
- export var filterValueSuggestions = function filterValueSuggestions(suggestions, selected, searchValue, lookupKey) {
39
- return suggestions.filter(function (suggestion) {
40
- var matchesSearchValue = suggestion[lookupKey].toLowerCase().includes(searchValue.toLowerCase());
41
- var notInSelected = !selected.find(function (item) {
42
- return isEqual(item, suggestion);
43
- });
31
+ const filterValueSuggestions = (suggestions, selected, searchValue, lookupKey) => {
32
+ return suggestions.filter((suggestion) => {
33
+ const matchesSearchValue = suggestion[lookupKey].toLowerCase().includes(searchValue.toLowerCase());
34
+ const notInSelected = !selected.find((item) => isEqual(item, suggestion));
44
35
  return matchesSearchValue && notInSelected;
45
36
  });
46
- };
37
+ };
38
+ export {
39
+ filterOutEmptyStrings,
40
+ filterOutNullishArrayItems,
41
+ filterValueSuggestions,
42
+ isOverflown,
43
+ scrollWithHorizontalArrow
44
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-collector",
3
- "version": "1.4.25",
3
+ "version": "1.4.27",
4
4
  "description": "Collector UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -16,15 +16,15 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm run build:js && pnpm run build:css && pnpm run defs",
19
+ "build": "vite build",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
21
  "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
- "build:watch": "pnpm run build:js -- --watch",
22
+ "build:watch": "vite build --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
25
25
  "prepublish": "pnpm run build",
26
- "test": "vitest",
27
- "test:watch": "pnpm run test -- --watch",
26
+ "test": "vitest run",
27
+ "test:watch": "vitest",
28
28
  "types": "tsc --noEmit",
29
29
  "check:circular-dependencies": "madge --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json src/ --exclude '/dist/'",
30
30
  "upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
@@ -35,14 +35,14 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-button": "^1.5.16",
39
- "@synerise/ds-divider": "^1.3.0",
40
- "@synerise/ds-icon": "^1.14.1",
41
- "@synerise/ds-input": "^1.6.8",
42
- "@synerise/ds-list-item": "^1.4.8",
43
- "@synerise/ds-scrollbar": "^1.2.15",
44
- "@synerise/ds-search": "^1.5.8",
45
- "@synerise/ds-utils": "^1.6.0",
38
+ "@synerise/ds-button": "^1.5.18",
39
+ "@synerise/ds-divider": "^1.3.2",
40
+ "@synerise/ds-icon": "^1.15.1",
41
+ "@synerise/ds-input": "^1.6.10",
42
+ "@synerise/ds-list-item": "^1.4.10",
43
+ "@synerise/ds-scrollbar": "^1.2.17",
44
+ "@synerise/ds-search": "^1.5.10",
45
+ "@synerise/ds-utils": "^1.7.1",
46
46
  "classnames": "^2.5.1",
47
47
  "lodash.isequal": "^4.5.0"
48
48
  },
@@ -57,5 +57,5 @@
57
57
  "@types/lodash.isequal": "^4.5.8",
58
58
  "vitest": "4"
59
59
  },
60
- "gitHead": "8dfafc5d7278f09d430f1e7499782d05c76b47c0"
60
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
61
61
  }