@synerise/ds-collector 1.4.26 → 1.4.28
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 +8 -0
- package/dist/Collector.d.ts +6 -6
- package/dist/Collector.js +185 -261
- package/dist/Collector.styles.d.ts +17 -17
- package/dist/Collector.styles.js +63 -79
- package/dist/Collector.types.d.ts +4 -4
- package/dist/Collector.types.js +1 -1
- package/dist/Elements/ButtonPanel/ButtonPanel.d.ts +2 -2
- package/dist/Elements/ButtonPanel/ButtonPanel.js +21 -33
- package/dist/Elements/ButtonPanel/ButtonPanel.styles.d.ts +1 -1
- package/dist/Elements/ButtonPanel/ButtonPanel.styles.js +6 -3
- package/dist/Elements/ButtonPanel/ButtonPanel.types.d.ts +2 -2
- package/dist/Elements/ButtonPanel/ButtonPanel.types.js +1 -1
- package/dist/Elements/NavigationHint/NavigationHint.d.ts +2 -2
- package/dist/Elements/NavigationHint/NavigationHint.js +15 -11
- package/dist/Elements/NavigationHint/NavigationHint.types.d.ts +1 -1
- package/dist/Elements/NavigationHint/NavigationHint.types.js +1 -1
- package/dist/Elements/OptionsDropdown/OptionsDropdown.d.ts +2 -2
- package/dist/Elements/OptionsDropdown/OptionsDropdown.js +59 -73
- package/dist/Elements/OptionsDropdown/OptionsDropdown.types.d.ts +3 -3
- package/dist/Elements/OptionsDropdown/OptionsDropdown.types.js +1 -1
- package/dist/Elements/Values/Values.d.ts +2 -2
- package/dist/Elements/Values/Values.js +15 -21
- package/dist/Elements/Values/Values.types.d.ts +1 -1
- package/dist/Elements/Values/Values.types.js +1 -1
- package/dist/hooks/useTranslations.d.ts +1 -1
- package/dist/hooks/useTranslations.js +17 -26
- package/dist/index.js +4 -1
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +27 -29
- package/package.json +12 -12
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CollectorTexts } from '../Collector.types';
|
|
2
2
|
export declare const useTranslations: (texts?: Partial<CollectorTexts>) => CollectorTexts;
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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:
|
|
17
|
-
defaultMessage:
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (
|
|
5
|
-
|
|
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:
|
|
7
|
+
behavior: "smooth"
|
|
11
8
|
});
|
|
12
9
|
}
|
|
13
|
-
if (event.key ===
|
|
14
|
-
|
|
10
|
+
if (event.key === "ArrowRight") {
|
|
11
|
+
ref?.current && ref.current.scrollBy({
|
|
15
12
|
left: scrollStep,
|
|
16
|
-
behavior:
|
|
13
|
+
behavior: "smooth"
|
|
17
14
|
});
|
|
18
15
|
}
|
|
19
16
|
};
|
|
20
|
-
|
|
21
|
-
return items.filter(
|
|
22
|
-
return Boolean(val.trim());
|
|
23
|
-
});
|
|
17
|
+
const filterOutEmptyStrings = (items) => {
|
|
18
|
+
return items.filter((val) => Boolean(val.trim()));
|
|
24
19
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return Boolean(val);
|
|
28
|
-
});
|
|
20
|
+
const filterOutNullishArrayItems = (array) => {
|
|
21
|
+
const filtered = array.filter((val) => Boolean(val));
|
|
29
22
|
return filtered;
|
|
30
23
|
};
|
|
31
|
-
|
|
24
|
+
const isOverflown = (elementRef) => {
|
|
32
25
|
if (elementRef !== null && elementRef.current !== null) {
|
|
33
|
-
|
|
26
|
+
const element = elementRef.current;
|
|
34
27
|
return element.scrollWidth - INPUT_MIN_WIDTH > element.clientWidth;
|
|
35
28
|
}
|
|
36
29
|
return false;
|
|
37
30
|
};
|
|
38
|
-
|
|
39
|
-
return suggestions.filter(
|
|
40
|
-
|
|
41
|
-
|
|
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.
|
|
3
|
+
"version": "1.4.28",
|
|
4
4
|
"description": "Collector UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
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": "
|
|
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",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
],
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-button": "^1.5.
|
|
39
|
-
"@synerise/ds-divider": "^1.3.
|
|
40
|
-
"@synerise/ds-icon": "^1.15.
|
|
41
|
-
"@synerise/ds-input": "^1.6.
|
|
42
|
-
"@synerise/ds-list-item": "^1.4.
|
|
43
|
-
"@synerise/ds-scrollbar": "^1.2.
|
|
44
|
-
"@synerise/ds-search": "^1.5.
|
|
45
|
-
"@synerise/ds-utils": "^1.7.
|
|
38
|
+
"@synerise/ds-button": "^1.5.19",
|
|
39
|
+
"@synerise/ds-divider": "^1.3.3",
|
|
40
|
+
"@synerise/ds-icon": "^1.15.2",
|
|
41
|
+
"@synerise/ds-input": "^1.6.11",
|
|
42
|
+
"@synerise/ds-list-item": "^1.4.11",
|
|
43
|
+
"@synerise/ds-scrollbar": "^1.2.18",
|
|
44
|
+
"@synerise/ds-search": "^1.5.11",
|
|
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": "
|
|
60
|
+
"gitHead": "c2384982c3533a31eb5e5e0408f8dcecb2b0f399"
|
|
61
61
|
}
|