@mailstep/design-system 0.7.11 → 0.7.12
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/package.json +14 -12
- package/ui/Blocks/CommonGrid/components/PresetsModalBody/components/TagRemove.d.ts +1 -0
- package/ui/Blocks/CommonGrid/components/PresetsModalBody/components/TagRemove.js +7 -0
- package/ui/Blocks/CommonGrid/components/PresetsModalBody/index.js +2 -1
- package/ui/Blocks/CommonGrid/hooks/usePresetFileHandlers.js +29 -5
- package/ui/Elements/Icon/stories/BadgeIcon.stories.d.ts +1 -1
- package/ui/index.es.js +11974 -12016
- package/ui/index.umd.js +458 -444
- package/ui/utils/translations.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailstep/design-system",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./ui/index.js",
|
|
@@ -34,18 +34,20 @@
|
|
|
34
34
|
"@lingui/core": "3.17.2",
|
|
35
35
|
"@lingui/react": "3.17.2",
|
|
36
36
|
"@popperjs/core": "^2.11.8",
|
|
37
|
-
"@storybook/addon-controls": "^8.
|
|
38
|
-
"@storybook/addon-designs": "^8.0.
|
|
39
|
-
"@storybook/addon-essentials": "^8.
|
|
40
|
-
"@storybook/addon-interactions": "^8.
|
|
41
|
-
"@storybook/addon-links": "^8.
|
|
42
|
-
"@storybook/blocks": "^8.
|
|
43
|
-
"@storybook/react": "^8.
|
|
44
|
-
"@storybook/react-webpack5": "^8.
|
|
45
|
-
"@storybook/test": "^8.
|
|
37
|
+
"@storybook/addon-controls": "^8.4.7",
|
|
38
|
+
"@storybook/addon-designs": "^8.0.4",
|
|
39
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
40
|
+
"@storybook/addon-interactions": "^8.4.7",
|
|
41
|
+
"@storybook/addon-links": "^8.4.7",
|
|
42
|
+
"@storybook/blocks": "^8.4.7",
|
|
43
|
+
"@storybook/react": "^8.4.7",
|
|
44
|
+
"@storybook/react-webpack5": "^8.4.7",
|
|
45
|
+
"@storybook/test": "^8.4.7",
|
|
46
|
+
"@storybook/types": "^8.4.7",
|
|
46
47
|
"@svgr/rollup": "^8.0.1",
|
|
47
48
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
48
49
|
"@types/faker": "^4.1.11",
|
|
50
|
+
"@types/lodash": "^4.17.13",
|
|
49
51
|
"@types/luxon": "^3.4.2",
|
|
50
52
|
"@types/node": "^20.1.7",
|
|
51
53
|
"@types/react": "^18.2.6",
|
|
@@ -72,7 +74,7 @@
|
|
|
72
74
|
"eslint-plugin-react": "^7.35.0",
|
|
73
75
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
74
76
|
"eslint-plugin-react-perf": "^3.3.2",
|
|
75
|
-
"eslint-plugin-storybook": "^0.
|
|
77
|
+
"eslint-plugin-storybook": "^0.11.1",
|
|
76
78
|
"faker": "^5.1.0",
|
|
77
79
|
"immer": "9.0.7",
|
|
78
80
|
"lodash": "^4.17.21",
|
|
@@ -94,7 +96,7 @@
|
|
|
94
96
|
"react-use-draggable-scroll": "^0.4.7",
|
|
95
97
|
"redux": ">=4.0.5",
|
|
96
98
|
"reselect": "5.0.0-alpha.2",
|
|
97
|
-
"storybook": "^8.
|
|
99
|
+
"storybook": "^8.4.7",
|
|
98
100
|
"string-width": "6.1.0",
|
|
99
101
|
"styled-components": "^5.3.10",
|
|
100
102
|
"swiper": "^11.0.3",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TagRemove: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { styled } from '@xstyled/styled-components';
|
|
6
|
+
export var TagRemove = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: pointer;\n margin-left: 6px;\n height: fit-content;\n width: 17px;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n\n &:hover {\n svg {\n fill: black;\n }\n }\n"], ["\n cursor: pointer;\n margin-left: 6px;\n height: fit-content;\n width: 17px;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n\n &:hover {\n svg {\n fill: black;\n }\n }\n"])));
|
|
7
|
+
var templateObject_1;
|
|
@@ -16,6 +16,7 @@ import { Cancel } from '../../../../Elements/Icon/icons/Cancel';
|
|
|
16
16
|
import Tag from '../../../../Elements/Tag/Tag';
|
|
17
17
|
import { palletes } from '../../../../Elements/Tag/palletes';
|
|
18
18
|
import { H6 } from '../../../../Elements/Typography/Typography';
|
|
19
|
+
import { TagRemove } from './components/TagRemove';
|
|
19
20
|
import { Trans } from '@lingui/react';
|
|
20
21
|
import { x } from '@xstyled/styled-components';
|
|
21
22
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -26,6 +27,6 @@ export var PresetsModalBody = function (_a) {
|
|
|
26
27
|
return (_jsxs(x.div, { children: [_jsx(x.div, { display: "flex", rowGap: "12px", flexWrap: "wrap", children: hasPresets ? (presets === null || presets === void 0 ? void 0 : presets.map(function (_a, index) {
|
|
27
28
|
var presetName = _a[0], filters = _a[1];
|
|
28
29
|
var isSelected = presetName === selectedPresetName;
|
|
29
|
-
return (_jsxs(Tag, __assign({ size: "big", onClick: handleSelectPreset(presetName, filters) }, (isSelected ? palletes.redWhite : palletes.redRed), { pointer: true, children: [_jsx(H6, { mt: 0, mb: 0, variant: "semiBold", children: presetName }), _jsx(
|
|
30
|
+
return (_jsxs(Tag, __assign({ size: "big", onClick: handleSelectPreset(presetName, filters) }, (isSelected ? palletes.redWhite : palletes.redRed), { pointer: true, children: [_jsx(H6, { mt: 0, mb: 0, variant: "semiBold", children: presetName }), _jsx(TagRemove, { onClick: handleOpenDeletePresetModal(presetName), children: _jsx(Cancel, { fill: isSelected ? 'white' : '#DB2B19', width: "11px", height: "11px" }) })] }), "".concat(presetName, "_").concat(index)));
|
|
30
31
|
})) : (_jsx(Trans, { id: "dataGrid.noPresets.title", message: "No presets available" })) }), _jsx(x.input, { type: "file", accept: ".json", onChange: handleImportPresets, ref: fileInputRef, display: "none" }), _jsxs(x.div, { display: "flex", mt: "34px", gap: "12px", justifyContent: "space-between", children: [_jsxs(x.div, { display: "flex", gap: "12px", children: [hasPresets && (_jsx(Button, { onClick: handleExportPresets, type: "button", appearance: "secondary", children: _jsx(Trans, { id: "dataGrid.exportPreset.title", message: "Export presets" }) })), _jsx(Button, { onClick: handleImportButtonClick, type: "button", appearance: "secondary", children: _jsx(Trans, { id: "dataGrid.importPreset.title", message: "Import presets" }) })] }), _jsx(Button, { type: "button", onClick: onOpenCreatePresetModal, disabled: isEmpty(filters), children: _jsx(Trans, { id: "dataGrid.createNewPreset.title", message: "Create new preset" }) })] })] }));
|
|
31
32
|
};
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
1
12
|
import { useRef, useCallback } from 'react';
|
|
13
|
+
import omit from 'lodash/omit';
|
|
14
|
+
import { i18n } from '@lingui/core';
|
|
2
15
|
export var usePresetFileHandlers = function (_a) {
|
|
3
16
|
var gridName = _a.gridName, gridActions = _a.gridActions, gridSelectors = _a.gridSelectors;
|
|
4
17
|
var fileInputRef = useRef(null);
|
|
5
18
|
var handleExportPresets = useCallback(function () {
|
|
6
19
|
if (!gridName)
|
|
7
20
|
return;
|
|
8
|
-
var
|
|
21
|
+
var gridConfig = { gridName: gridName };
|
|
22
|
+
var data = __assign(__assign({}, gridSelectors.presets), { _: gridConfig });
|
|
23
|
+
var blob = new Blob([JSON.stringify(data, null, 2)], {
|
|
9
24
|
type: 'application/json'
|
|
10
25
|
});
|
|
11
26
|
var link = document.createElement('a');
|
|
@@ -14,7 +29,7 @@ export var usePresetFileHandlers = function (_a) {
|
|
|
14
29
|
document.body.appendChild(link);
|
|
15
30
|
link.click();
|
|
16
31
|
document.body.removeChild(link);
|
|
17
|
-
}, [gridName]);
|
|
32
|
+
}, [gridName, gridSelectors.presets]);
|
|
18
33
|
var handleImportPresets = useCallback(function (event) {
|
|
19
34
|
var _a;
|
|
20
35
|
if (!gridName)
|
|
@@ -28,11 +43,20 @@ export var usePresetFileHandlers = function (_a) {
|
|
|
28
43
|
var _a, _b;
|
|
29
44
|
try {
|
|
30
45
|
var fileContent = JSON.parse((_a = e.target) === null || _a === void 0 ? void 0 : _a.result);
|
|
31
|
-
|
|
46
|
+
var gridConfig = fileContent._;
|
|
47
|
+
if (gridConfig && gridConfig.gridName !== gridName) {
|
|
48
|
+
throw new Error(i18n._({ id: 'dataGrid.importPresets.gridNameNotSame', 'message': 'Grid name in file is not the same as current grid.' }));
|
|
49
|
+
}
|
|
50
|
+
(_b = gridActions.setPresets) === null || _b === void 0 ? void 0 : _b.call(gridActions, omit(fileContent, '_'));
|
|
32
51
|
}
|
|
33
52
|
catch (error) {
|
|
34
|
-
console.warn(
|
|
35
|
-
alert(
|
|
53
|
+
console.warn(error);
|
|
54
|
+
alert(i18n._({ id: 'dataGrid.importPresets.error', 'message': 'Error with importing files.' }) + error);
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
if (fileInputRef.current) {
|
|
58
|
+
fileInputRef.current.value = '';
|
|
59
|
+
}
|
|
36
60
|
}
|
|
37
61
|
};
|
|
38
62
|
}, [gridName]);
|
|
@@ -5,7 +5,7 @@ declare const meta: {
|
|
|
5
5
|
component: ({ badge, ...iconProps }: {
|
|
6
6
|
badge: "warning";
|
|
7
7
|
} & import("..").IconProps) => JSX.Element;
|
|
8
|
-
decorators: ((Story: import("@storybook/
|
|
8
|
+
decorators: ((Story: import("@storybook/csf").PartialStoryFn<import("@storybook/react/dist/types-a5624094").R, {
|
|
9
9
|
badge: "warning";
|
|
10
10
|
icon: string;
|
|
11
11
|
style?: "normal" | "light" | "solid" | undefined;
|