@expressms/smartapp-ui 1.0.7 → 1.1.1
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/build/main/assets/icons/loader.svg +3 -0
- package/build/main/assets/icons/refresh.svg +3 -0
- package/build/main/constants/constants.d.ts +20 -0
- package/build/main/constants/constants.js +23 -0
- package/build/main/helpers/index.d.ts +4 -1
- package/build/main/helpers/index.js +6 -2
- package/build/main/styles/stories.module.scss +184 -21
- package/build/main/styles/styles.min.css +1 -1
- package/build/main//321/201omponents/ActionModal/ActionModal.js +2 -2
- package/build/main//321/201omponents/AttachedFile/AttachedFile.js +3 -3
- package/build/main//321/201omponents/Avatar/Avatar.d.ts +1 -1
- package/build/main//321/201omponents/Avatar/Avatar.js +16 -16
- package/build/main//321/201omponents/Avatar/types.d.ts +4 -2
- package/build/main//321/201omponents/Avatar/types.js +1 -0
- package/build/main//321/201omponents/Checkbox/Checkbox.js +2 -2
- package/build/main//321/201omponents/Chips/Chips.js +2 -2
- package/build/main//321/201omponents/CustomSelectProfiles/CustomSelectProfiles.js +3 -3
- package/build/main//321/201omponents/DragAndDrop/DragAndDrop.js +2 -2
- package/build/main//321/201omponents/Error/Error.js +2 -2
- package/build/main//321/201omponents/Header/Header.d.ts +1 -1
- package/build/main//321/201omponents/Header/Header.js +18 -4
- package/build/main//321/201omponents/Header/types.d.ts +10 -0
- package/build/main//321/201omponents/Loader/Loader.d.ts +1 -1
- package/build/main//321/201omponents/Loader/Loader.js +17 -2
- package/build/main//321/201omponents/Loader/types.d.ts +6 -0
- package/build/main//321/201omponents/Profile/Profile.js +4 -4
- package/build/main//321/201omponents/Stories/Stories.js +91 -38
- package/build/main//321/201omponents/Stories/types.d.ts +23 -7
- package/build/main//321/201omponents/Stories/types.js +5 -0
- package/build/main//321/201omponents/SyncLoader/SyncLoader.d.ts +4 -0
- package/build/main//321/201omponents/SyncLoader/SyncLoader.js +66 -0
- package/build/main//321/201omponents/SyncLoader/index.d.ts +1 -0
- package/build/main//321/201omponents/SyncLoader/index.js +1 -0
- package/build/main//321/201omponents/SyncLoader/types.d.ts +6 -0
- package/build/main//321/201omponents/SyncLoader/types.js +1 -0
- package/build/main//321/201omponents/index.d.ts +1 -0
- package/build/main//321/201omponents/index.js +1 -0
- package/package.json +4 -1
|
@@ -2,29 +2,44 @@ export declare enum STORY_BACKGROUND_TYPES {
|
|
|
2
2
|
color = "color",
|
|
3
3
|
image = "image"
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export declare enum STORY_TYPE {
|
|
6
|
+
image = "image",
|
|
7
|
+
video = "video"
|
|
8
|
+
}
|
|
9
|
+
export type TBackgroundSource = {
|
|
10
|
+
type: 'color' | 'image';
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
type TCommonStoryItem = {
|
|
6
14
|
id: number;
|
|
7
15
|
order: number;
|
|
8
16
|
viewed?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export interface TImageStoryItem extends TCommonStoryItem {
|
|
19
|
+
type: 'image';
|
|
9
20
|
title: string | null;
|
|
10
21
|
body: string | null;
|
|
11
|
-
backgroundSource:
|
|
12
|
-
type: STORY_BACKGROUND_TYPES;
|
|
13
|
-
value: string;
|
|
14
|
-
};
|
|
22
|
+
backgroundSource: TBackgroundSource;
|
|
15
23
|
button: {
|
|
16
24
|
text: string;
|
|
25
|
+
textColor?: string;
|
|
26
|
+
backgroundColor?: string;
|
|
17
27
|
action: () => void;
|
|
18
28
|
} | null;
|
|
19
29
|
image: string | null;
|
|
20
|
-
}
|
|
30
|
+
}
|
|
31
|
+
export interface TVideoStoryItem extends TCommonStoryItem {
|
|
32
|
+
type: 'video';
|
|
33
|
+
url: string;
|
|
34
|
+
}
|
|
35
|
+
export type TStoryItem = TImageStoryItem | TVideoStoryItem;
|
|
21
36
|
export type TGroupStories = {
|
|
22
37
|
id: number;
|
|
23
38
|
viewed: boolean;
|
|
24
39
|
stories: TStoryItem[];
|
|
25
40
|
};
|
|
26
41
|
export interface IStoriesProps {
|
|
27
|
-
platform?:
|
|
42
|
+
platform?: 'web' | 'ios' | 'android';
|
|
28
43
|
fontFamily?: string;
|
|
29
44
|
groupStories: TGroupStories | null;
|
|
30
45
|
allGroupsStories: TGroupStories[];
|
|
@@ -32,3 +47,4 @@ export interface IStoriesProps {
|
|
|
32
47
|
changeGroupStoriesToViewed?: (groupStories: TGroupStories) => void;
|
|
33
48
|
handleCloseGroupStories: () => void;
|
|
34
49
|
}
|
|
50
|
+
export {};
|
|
@@ -3,3 +3,8 @@ export var STORY_BACKGROUND_TYPES;
|
|
|
3
3
|
STORY_BACKGROUND_TYPES["color"] = "color";
|
|
4
4
|
STORY_BACKGROUND_TYPES["image"] = "image";
|
|
5
5
|
})(STORY_BACKGROUND_TYPES || (STORY_BACKGROUND_TYPES = {}));
|
|
6
|
+
export var STORY_TYPE;
|
|
7
|
+
(function (STORY_TYPE) {
|
|
8
|
+
STORY_TYPE["image"] = "image";
|
|
9
|
+
STORY_TYPE["video"] = "video";
|
|
10
|
+
})(STORY_TYPE || (STORY_TYPE = {}));
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { useEffect } from 'react';
|
|
23
|
+
import classNames from 'classnames';
|
|
24
|
+
import Color from 'color';
|
|
25
|
+
import { normal } from 'color-blend';
|
|
26
|
+
import { ReactComponent as LoaderIcon } from '../../assets/icons/loader.svg';
|
|
27
|
+
import { DEFAULT_BLUE_ICON_COLOR, DEFAULT_FONT_FAMILY, THEME } from '../../constants';
|
|
28
|
+
import { getColor } from '../../helpers';
|
|
29
|
+
import '../../styles/stories.module.scss';
|
|
30
|
+
var SyncLoader = function (_a) {
|
|
31
|
+
var isLoading = _a.isLoading, _b = _a.theme, theme = _b === void 0 ? THEME.default : _b, color = _a.color, _c = _a.fontFamily, fontFamily = _c === void 0 ? DEFAULT_FONT_FAMILY : _c;
|
|
32
|
+
var isDarkTheme = theme === THEME.dark;
|
|
33
|
+
var loaderColor = getColor(color, DEFAULT_BLUE_ICON_COLOR);
|
|
34
|
+
var getBackgroundStyles = function () {
|
|
35
|
+
var _a = Color(loaderColor).rgb().object(), red = _a.r, green = _a.g, blue = _a.b;
|
|
36
|
+
var backgroundColorRGBA = { r: red, g: green, b: blue, a: 0.2 };
|
|
37
|
+
var WHITE_COLOR = { r: 255, g: 255, b: 255, a: 1 };
|
|
38
|
+
var BLACK_COLOR = { r: 61, g: 61, b: 61, a: 1 };
|
|
39
|
+
var _b = isDarkTheme
|
|
40
|
+
? normal(BLACK_COLOR, backgroundColorRGBA)
|
|
41
|
+
: normal(WHITE_COLOR, backgroundColorRGBA), r = _b.r, g = _b.g, b = _b.b, a = _b.a;
|
|
42
|
+
return { background: "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(a, ")") };
|
|
43
|
+
};
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
var timerId;
|
|
46
|
+
var dots = document.querySelectorAll('.smartapp-sync-loader__text--dots__dot');
|
|
47
|
+
var animationEndFunction = function () {
|
|
48
|
+
dots.forEach(function (dot) { return dot.style.display = 'none'; });
|
|
49
|
+
timerId = setTimeout(function () {
|
|
50
|
+
dots.forEach(function (dot) { return dot.style.display = 'unset'; });
|
|
51
|
+
}, 150);
|
|
52
|
+
};
|
|
53
|
+
if (isLoading) {
|
|
54
|
+
dots[0].addEventListener('animationend', animationEndFunction);
|
|
55
|
+
}
|
|
56
|
+
return function () {
|
|
57
|
+
clearTimeout(timerId);
|
|
58
|
+
isLoading && dots[0].removeEventListener('animationend', animationEndFunction);
|
|
59
|
+
};
|
|
60
|
+
}, [isLoading]);
|
|
61
|
+
if (!isLoading) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return (_jsxs("div", __assign({ className: "smartapp-sync-loader", style: getBackgroundStyles() }, { children: [_jsx(LoaderIcon, { className: "smartapp-sync-loader__icon", style: { color: loaderColor } }), _jsxs("div", __assign({ style: { fontFamily: "".concat(fontFamily, ", sans-serif") }, className: classNames({ 'smartapp-sync-loader__text': true, 'smartapp-sync-loader__text--dark': isDarkTheme }) }, { children: ["\u041E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435", _jsx("div", __assign({ className: "smartapp-sync-loader__text--dots" }, { children: __spreadArray([], Array(3), true).map(function (_, index) { return _jsx("div", __assign({ className: "smartapp-sync-loader__text--dots__dot" }, { children: "." }), index); }) }))] }))] })));
|
|
65
|
+
};
|
|
66
|
+
export default SyncLoader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SyncLoader';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SyncLoader';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressms/smartapp-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "SmartApp UI library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/main/index.js",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@testing-library/jest-dom": "^5.16.5",
|
|
23
23
|
"@testing-library/react": "^13.4.0",
|
|
24
24
|
"@testing-library/user-event": "^13.5.0",
|
|
25
|
+
"@types/color": "^3.0.6",
|
|
25
26
|
"@types/jest": "^27.5.2",
|
|
26
27
|
"@types/node": "^16.18.11",
|
|
27
28
|
"@types/react": "^18.0.27",
|
|
@@ -41,6 +42,8 @@
|
|
|
41
42
|
"camelcase": "^6.2.1",
|
|
42
43
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
43
44
|
"classnames": "^2.3.2",
|
|
45
|
+
"color": "^4.2.3",
|
|
46
|
+
"color-blend": "^4.0.0",
|
|
44
47
|
"copyfiles": "^2.4.1",
|
|
45
48
|
"css-loader": "^6.5.1",
|
|
46
49
|
"css-minimizer-webpack-plugin": "^3.2.0",
|