@expressms/smartapp-ui 1.1.0 → 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/constants/constants.d.ts +4 -0
- package/build/main/constants/constants.js +5 -0
- package/build/main/helpers/index.d.ts +1 -1
- package/build/main/helpers/index.js +2 -2
- package/build/main/styles/stories.module.scss +88 -0
- 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/Checkbox/Checkbox.js +2 -2
- package/build/main//321/201omponents/Chips/Chips.js +2 -2
- 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.js +4 -4
- package/build/main//321/201omponents/Header/types.d.ts +1 -2
- package/build/main//321/201omponents/Loader/Loader.js +2 -2
- package/build/main//321/201omponents/Profile/Profile.js +4 -4
- package/build/main//321/201omponents/Stories/Stories.js +3 -3
- package/build/main//321/201omponents/Stories/types.d.ts +1 -2
- 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
|
@@ -16,7 +16,7 @@ import { ReactComponent as CancelIcon } from '../../assets/icons/cancel-cross.sv
|
|
|
16
16
|
import Button from '../Button';
|
|
17
17
|
import Input from '../Input';
|
|
18
18
|
import { TButtonColor, TButtonType } from '../Button/types';
|
|
19
|
-
import {
|
|
19
|
+
import { getColor } from '../../helpers';
|
|
20
20
|
import { DEFAULT_GRAY_ICON_COLOR } from '../../constants';
|
|
21
21
|
import '../../styles/stories.module.scss';
|
|
22
22
|
var ActionModal = function (_a) {
|
|
@@ -37,6 +37,6 @@ var ActionModal = function (_a) {
|
|
|
37
37
|
var onChange = function (value) {
|
|
38
38
|
setValue(value);
|
|
39
39
|
};
|
|
40
|
-
return (_jsx(Popup, __assign({ closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className: "smartapp-action-modal" }, { children: _jsxs("div", __assign({ className: "smartapp-action-modal__content" }, { children: [_jsx("p", __assign({ className: "smartapp-action-modal__content--title" }, { children: title })), _jsx("div", __assign({ onClick: cancelButtonFunction, className: "smartapp-action-modal__content__cancel-cross" }, { children: _jsx(CancelIcon, { style: { color:
|
|
40
|
+
return (_jsx(Popup, __assign({ closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className: "smartapp-action-modal" }, { children: _jsxs("div", __assign({ className: "smartapp-action-modal__content" }, { children: [_jsx("p", __assign({ className: "smartapp-action-modal__content--title" }, { children: title })), _jsx("div", __assign({ onClick: cancelButtonFunction, className: "smartapp-action-modal__content__cancel-cross" }, { children: _jsx(CancelIcon, { style: { color: getColor(iconColor, DEFAULT_GRAY_ICON_COLOR) } }) })), _jsx("div", __assign({ className: "smartapp-action-modal__content--input" }, { children: _jsx(Input, { defaultValue: value, placeholder: placeholder, onChange: onChange }) })), _jsx("div", __assign({ className: "smartapp-action-modal__content--buttons" }, { children: _jsx(Button, { title: buttonName, typeButton: TButtonType.low, color: TButtonColor.blue, onClickFunction: function () { return confirmButtonFunction(value); } }) }))] })) })) })));
|
|
41
41
|
};
|
|
42
42
|
export default ActionModal;
|
|
@@ -14,14 +14,14 @@ import classNames from 'classnames';
|
|
|
14
14
|
import { ReactComponent as FileIcon } from '../../assets/icons/file.svg';
|
|
15
15
|
import { ReactComponent as RemoveIcon } from '../../assets/icons/close.svg';
|
|
16
16
|
import { ReactComponent as DownloadIcon } from '../../assets/icons/download.svg';
|
|
17
|
-
import {
|
|
17
|
+
import { getColor } from '../../helpers';
|
|
18
18
|
import { DEFAULT_BLUE_ICON_COLOR, DEFAULT_GRAY_ICON_COLOR } from '../../constants';
|
|
19
19
|
import '../../styles/stories.module.scss';
|
|
20
20
|
var AttachedFile = function (_a) {
|
|
21
21
|
var fileName = _a.fileName, weight = _a.weight, weightType = _a.weightType, _b = _a.isSpaceBetween, isSpaceBetween = _b === void 0 ? false : _b, _c = _a.onClickDownloadFile, onClickDownloadFile = _c === void 0 ? undefined : _c, _d = _a.onClickRemoveFile, onClickRemoveFile = _d === void 0 ? undefined : _d, _e = _a.isRemoveFile, isRemoveFile = _e === void 0 ? false : _e, _f = _a.isDownloadFile, isDownloadFile = _f === void 0 ? false : _f, _g = _a.width, width = _g === void 0 ? 100 : _g, fileColor = _a.fileColor, downloadColor = _a.downloadColor, removeColor = _a.removeColor;
|
|
22
|
-
return (_jsxs("div", __assign({ style: { width: "".concat(width, "%") }, className: "smartapp-attached-file" }, { children: [_jsx("div", __assign({ className: "smartapp-attached-file--icon" }, { children: _jsx(FileIcon, { style: { color:
|
|
22
|
+
return (_jsxs("div", __assign({ style: { width: "".concat(width, "%") }, className: "smartapp-attached-file" }, { children: [_jsx("div", __assign({ className: "smartapp-attached-file--icon" }, { children: _jsx(FileIcon, { style: { color: getColor(fileColor, DEFAULT_GRAY_ICON_COLOR) } }) })), _jsxs("div", __assign({ className: classNames({
|
|
23
23
|
'smartapp-attached-file__value': true,
|
|
24
24
|
'justify-space-between': isSpaceBetween,
|
|
25
|
-
}) }, { children: [_jsxs("div", __assign({ className: "smartapp-attached-file__value--info" }, { children: [_jsx("p", __assign({ className: "smartapp-attached-file__value--info__name" }, { children: fileName })), _jsx("p", __assign({ className: "smartapp-attached-file__value--info__weight" }, { children: "".concat(weight, " ").concat(weightType) }))] })), _jsxs("div", __assign({ className: "smartapp-attached-file__value--icons" }, { children: [onClickRemoveFile && isRemoveFile && (_jsx("div", __assign({ onClick: function () { return onClickRemoveFile(fileName); }, className: "smartapp-attached-file__value--icons__close" }, { children: _jsx(RemoveIcon, { style: { color:
|
|
25
|
+
}) }, { children: [_jsxs("div", __assign({ className: "smartapp-attached-file__value--info" }, { children: [_jsx("p", __assign({ className: "smartapp-attached-file__value--info__name" }, { children: fileName })), _jsx("p", __assign({ className: "smartapp-attached-file__value--info__weight" }, { children: "".concat(weight, " ").concat(weightType) }))] })), _jsxs("div", __assign({ className: "smartapp-attached-file__value--icons" }, { children: [onClickRemoveFile && isRemoveFile && (_jsx("div", __assign({ onClick: function () { return onClickRemoveFile(fileName); }, className: "smartapp-attached-file__value--icons__close" }, { children: _jsx(RemoveIcon, { style: { color: getColor(removeColor, DEFAULT_BLUE_ICON_COLOR) } }) }))), onClickDownloadFile && isDownloadFile && (_jsx("div", __assign({ onClick: function () { return onClickDownloadFile(fileName); }, className: "smartapp-attached-file__value--icons__download" }, { children: _jsx(DownloadIcon, { style: { color: getColor(downloadColor, DEFAULT_BLUE_ICON_COLOR) } }) })))] }))] }))] }), weight));
|
|
26
26
|
};
|
|
27
27
|
export default AttachedFile;
|
|
@@ -11,11 +11,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ReactComponent as CheckIcon } from '../../assets/icons/check-mark.svg';
|
|
14
|
-
import {
|
|
14
|
+
import { getColor } from '../../helpers';
|
|
15
15
|
import { DEFAULT_BLUE_ICON_COLOR } from '../../constants';
|
|
16
16
|
import '../../styles/stories.module.scss';
|
|
17
17
|
var CheckBox = function (_a) {
|
|
18
18
|
var id = _a.id, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, iconColor = _a.iconColor, _d = _a.onChange, onChange = _d === void 0 ? function () { return undefined; } : _d;
|
|
19
|
-
return (_jsx("div", __assign({ className: "smartapp-check-box" }, { children: _jsxs("label", __assign({ htmlFor: "cb-".concat(id) }, { children: [_jsx("input", { id: "cb-".concat(id), type: "checkbox", className: "smartapp-check-box__custom-check-box", disabled: disabled, checked: checked, onChange: onChange }), checked ? _jsx(CheckIcon, { style: { color:
|
|
19
|
+
return (_jsx("div", __assign({ className: "smartapp-check-box" }, { children: _jsxs("label", __assign({ htmlFor: "cb-".concat(id) }, { children: [_jsx("input", { id: "cb-".concat(id), type: "checkbox", className: "smartapp-check-box__custom-check-box", disabled: disabled, checked: checked, onChange: onChange }), checked ? _jsx(CheckIcon, { style: { color: getColor(iconColor, DEFAULT_BLUE_ICON_COLOR) } }) : _jsx("span", { className: "checkmark" })] })) })));
|
|
20
20
|
};
|
|
21
21
|
export default CheckBox;
|
|
@@ -12,11 +12,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ReactComponent as CancelIcon } from '../../assets/icons/cancel-cross.svg';
|
|
14
14
|
import Avatar from '../Avatar';
|
|
15
|
-
import {
|
|
15
|
+
import { getColor } from '../../helpers';
|
|
16
16
|
import { DEFAULT_GRAY_ICON_COLOR } from '../../constants';
|
|
17
17
|
import '../../styles/stories.module.scss';
|
|
18
18
|
var Chips = function (_a) {
|
|
19
19
|
var name = _a.name, iconColor = _a.iconColor, _b = _a.onCancelFunction, onCancelFunction = _b === void 0 ? function () { return undefined; } : _b;
|
|
20
|
-
return (_jsxs("div", __assign({ className: "smartapp-chips" }, { children: [_jsxs("div", __assign({ className: "smartapp-chips__info" }, { children: [_jsx(Avatar, { username: name, size: 24 }), _jsx("p", __assign({ className: "smartapp-chips__info--name" }, { children: name }))] })), _jsx("div", __assign({ onClick: function () { return onCancelFunction(name); }, className: "smartapp-chips__cancel-icon" }, { children: _jsx(CancelIcon, { style: { color:
|
|
20
|
+
return (_jsxs("div", __assign({ className: "smartapp-chips" }, { children: [_jsxs("div", __assign({ className: "smartapp-chips__info" }, { children: [_jsx(Avatar, { username: name, size: 24 }), _jsx("p", __assign({ className: "smartapp-chips__info--name" }, { children: name }))] })), _jsx("div", __assign({ onClick: function () { return onCancelFunction(name); }, className: "smartapp-chips__cancel-icon" }, { children: _jsx(CancelIcon, { style: { color: getColor(iconColor, DEFAULT_GRAY_ICON_COLOR) } }) }))] })));
|
|
21
21
|
};
|
|
22
22
|
export default Chips;
|
|
@@ -15,7 +15,7 @@ import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
|
15
15
|
import { ReactComponent as OrderIcon } from '../../assets/icons/order.svg';
|
|
16
16
|
import { ReactComponent as DeleteIcon } from '../../assets/icons/close.svg';
|
|
17
17
|
import CheckBox from '../Checkbox';
|
|
18
|
-
import {
|
|
18
|
+
import { getColor } from '../../helpers';
|
|
19
19
|
import { DEFAULT_BLUE_ICON_COLOR, DEFAULT_GRAY_ICON_COLOR } from '../../constants';
|
|
20
20
|
import '../../styles/stories.module.scss';
|
|
21
21
|
var DragAndDrop = function (_a) {
|
|
@@ -50,6 +50,6 @@ var DragAndDrop = function (_a) {
|
|
|
50
50
|
var newOptions = reorderOptions(options, result.source.index, result.destination.index);
|
|
51
51
|
onDragEndFunction(newOptions);
|
|
52
52
|
};
|
|
53
|
-
return (_jsx("div", __assign({ style: { width: "".concat(width, "%") }, className: "smartapp-drag-drop" }, { children: _jsx(DragDropContext, __assign({ onDragStart: onDragStart, onDragEnd: onDragEnd }, { children: _jsx(Droppable, __assign({ droppableId: "droppable" }, { children: function (provided) { return (_jsx("div", __assign({}, provided.droppableProps, { ref: provided.innerRef, className: "smartapp-drag-drop__container" }, { children: options === null || options === void 0 ? void 0 : options.map(function (instanceOption, index) { return (_jsx(Draggable, __assign({ draggableId: instanceOption.id, index: index }, { children: function (provided) { return (_jsxs("div", __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { className: "smartapp-drag-drop__container--instance" }, { children: [_jsxs("div", __assign({ className: "smartapp-drag-drop__container--instance__info" }, { children: [isCheckbox(instanceOption) && onChangeIsCompletedOption && (_jsx(CheckBox, { id: instanceOption.id, checked: instanceOption.isCompleted, iconColor: checkboxColor, onChange: function () { return onChangeIsCompletedOption(instanceOption); } })), onChangeOption ? (_jsx("input", { onChange: function (e) { return onChangeOption && onChangeOption(e, instanceOption); }, defaultValue: instanceOption.defaultValue, className: "smartapp-drag-drop__container--instance__info--name", type: "text", enterKeyHint: "enter", placeholder: placeholder }, instanceOption === null || instanceOption === void 0 ? void 0 : instanceOption.id)) : (_jsx("p", __assign({ className: "smartapp-drag-drop__container--instance__info--name" }, { children: instanceOption.defaultValue })))] })), _jsxs("div", __assign({ className: "smartapp-drag-drop__container--instance__icons" }, { children: [_jsx(OrderIcon, { style: { color:
|
|
53
|
+
return (_jsx("div", __assign({ style: { width: "".concat(width, "%") }, className: "smartapp-drag-drop" }, { children: _jsx(DragDropContext, __assign({ onDragStart: onDragStart, onDragEnd: onDragEnd }, { children: _jsx(Droppable, __assign({ droppableId: "droppable" }, { children: function (provided) { return (_jsx("div", __assign({}, provided.droppableProps, { ref: provided.innerRef, className: "smartapp-drag-drop__container" }, { children: options === null || options === void 0 ? void 0 : options.map(function (instanceOption, index) { return (_jsx(Draggable, __assign({ draggableId: instanceOption.id, index: index }, { children: function (provided) { return (_jsxs("div", __assign({ ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { className: "smartapp-drag-drop__container--instance" }, { children: [_jsxs("div", __assign({ className: "smartapp-drag-drop__container--instance__info" }, { children: [isCheckbox(instanceOption) && onChangeIsCompletedOption && (_jsx(CheckBox, { id: instanceOption.id, checked: instanceOption.isCompleted, iconColor: checkboxColor, onChange: function () { return onChangeIsCompletedOption(instanceOption); } })), onChangeOption ? (_jsx("input", { onChange: function (e) { return onChangeOption && onChangeOption(e, instanceOption); }, defaultValue: instanceOption.defaultValue, className: "smartapp-drag-drop__container--instance__info--name", type: "text", enterKeyHint: "enter", placeholder: placeholder }, instanceOption === null || instanceOption === void 0 ? void 0 : instanceOption.id)) : (_jsx("p", __assign({ className: "smartapp-drag-drop__container--instance__info--name" }, { children: instanceOption.defaultValue })))] })), _jsxs("div", __assign({ className: "smartapp-drag-drop__container--instance__icons" }, { children: [_jsx(OrderIcon, { style: { color: getColor(orderColor, DEFAULT_GRAY_ICON_COLOR) } }), onClickDeleteOption && _jsx(DeleteIcon, { className: "cp", style: { color: getColor(deleteColor, DEFAULT_BLUE_ICON_COLOR) }, onClick: function () { return onClickDeleteOption(instanceOption); } })] }))] }))); } }), instanceOption.id)); }) }))); } })) })) })));
|
|
54
54
|
};
|
|
55
55
|
export default DragAndDrop;
|
|
@@ -11,11 +11,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ReactComponent as ErrorIcon } from '../../assets/icons/error.svg';
|
|
14
|
-
import {
|
|
14
|
+
import { getColor } from '../../helpers';
|
|
15
15
|
import { DEFAULT_GRAY_ICON_COLOR } from '../../constants';
|
|
16
16
|
import '../../styles/stories.module.scss';
|
|
17
17
|
var Error = function (_a) {
|
|
18
18
|
var _b = _a.title, title = _b === void 0 ? 'Ошибка' : _b, _c = _a.text, text = _c === void 0 ? 'Попробуйте еще раз' : _c, _d = _a.width, width = _d === void 0 ? 100 : _d, iconColor = _a.iconColor;
|
|
19
|
-
return (_jsxs("div", __assign({ className: "smartapp-error", style: { width: "".concat(width, "%") } }, { children: [_jsx("div", __assign({ className: "smartapp-error__icon" }, { children: _jsx(ErrorIcon, { style: { color:
|
|
19
|
+
return (_jsxs("div", __assign({ className: "smartapp-error", style: { width: "".concat(width, "%") } }, { children: [_jsx("div", __assign({ className: "smartapp-error__icon" }, { children: _jsx(ErrorIcon, { style: { color: getColor(iconColor, DEFAULT_GRAY_ICON_COLOR) } }) })), _jsx("p", __assign({ className: "smartapp-error__title" }, { children: title })), _jsx("p", __assign({ className: "smartapp-error__text" }, { children: text }))] })));
|
|
20
20
|
};
|
|
21
21
|
export default Error;
|
|
@@ -14,7 +14,7 @@ import classNames from 'classnames';
|
|
|
14
14
|
import { ReactComponent as ArrowBackIcon } from '../../assets/icons/arrow-back.svg';
|
|
15
15
|
import { ReactComponent as TrashIcon } from '../../assets/icons/trash.svg';
|
|
16
16
|
import { ReactComponent as RefreshIcon } from '../../assets/icons/refresh.svg';
|
|
17
|
-
import {
|
|
17
|
+
import { getColor } from '../../helpers';
|
|
18
18
|
import { DEFAULT_BLACK_ICON_COLOR, DEFAULT_HEADER_BACKGROUND_COLOR, DEFAULT_HEADER_TEXT_COLOR, DEFAULT_RED_ICON_COLOR, FONT_SIZE, LINE_HEIGHT, PLATFORM, } from '../../constants';
|
|
19
19
|
import '../../styles/stories.module.scss';
|
|
20
20
|
var Header = function (_a) {
|
|
@@ -24,13 +24,13 @@ var Header = function (_a) {
|
|
|
24
24
|
height: headerHeight && "".concat(headerHeight - 29, "px"),
|
|
25
25
|
fontSize: FONT_SIZE[textSize],
|
|
26
26
|
lineHeight: LINE_HEIGHT[textSize],
|
|
27
|
-
color:
|
|
28
|
-
background:
|
|
27
|
+
color: getColor(textColor, DEFAULT_HEADER_TEXT_COLOR),
|
|
28
|
+
background: getColor(backgroundColor, DEFAULT_HEADER_BACKGROUND_COLOR),
|
|
29
29
|
}); };
|
|
30
30
|
var renderRefreshIcon = function (_a) {
|
|
31
31
|
var isEnabled = _a.isEnabled, onClick = _a.onClick;
|
|
32
32
|
return (_jsx(RefreshIcon, { className: classNames({ 'smartapp-header__icons--refresh': isEnabled }), onClick: !isEnabled ? onClick : function () { } }));
|
|
33
33
|
};
|
|
34
|
-
return (_jsxs("div", __assign({ className: classNames((_b = { 'smartapp-header': true }, _b["smartapp-header__".concat(platform)] = true, _b)), style: getHeaderStyles() }, { children: [_jsxs("div", __assign({ className: "smartapp-header__info" }, { children: [isBack && (_jsx(ArrowBackIcon, { style: { color:
|
|
34
|
+
return (_jsxs("div", __assign({ className: classNames((_b = { 'smartapp-header': true }, _b["smartapp-header__".concat(platform)] = true, _b)), style: getHeaderStyles() }, { children: [_jsxs("div", __assign({ className: "smartapp-header__info" }, { children: [isBack && (_jsx(ArrowBackIcon, { style: { color: getColor(arrowColor, DEFAULT_BLACK_ICON_COLOR) }, onClick: onClickBack, className: "smartapp-header__info--arrow-back" })), title && _jsx("p", __assign({ className: "smartapp-header__info--title" }, { children: title }))] })), _jsxs("div", __assign({ className: "smartapp-header__icons" }, { children: [isRemove && (_jsx("div", __assign({ onClick: onClickRemove, className: "smartapp-header__icons--trash" }, { children: _jsx(TrashIcon, { style: { color: getColor(trashColor, DEFAULT_RED_ICON_COLOR) } }) }))), refreshIcon && renderRefreshIcon(refreshIcon)] }))] })));
|
|
35
35
|
};
|
|
36
36
|
export default Header;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PLATFORM } from '../../constants';
|
|
2
1
|
export type TRefreshIcon = {
|
|
3
2
|
isEnabled: boolean;
|
|
4
3
|
onClick: () => void;
|
|
@@ -12,7 +11,7 @@ export interface IHeaderProps {
|
|
|
12
11
|
onClickRemove?: () => void;
|
|
13
12
|
arrowColor?: string;
|
|
14
13
|
trashColor?: string;
|
|
15
|
-
platform?:
|
|
14
|
+
platform?: 'web' | 'ios' | 'android';
|
|
16
15
|
headerHeight?: number;
|
|
17
16
|
textSize?: 'small' | 'default' | 'large';
|
|
18
17
|
textColor?: string;
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { ColorRing } from 'react-loader-spinner';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import { DEFAULT_GRAY_LOADER_BACKGROUND_COLOR, DEFAULT_WHITE_LOADER_BACKGROUND_COLOR, FONT_SIZE, LINE_HEIGHT, } from '../../constants';
|
|
16
|
-
import {
|
|
16
|
+
import { getColor } from '../../helpers';
|
|
17
17
|
import '../../styles/stories.module.scss';
|
|
18
18
|
var Loader = function (_a) {
|
|
19
19
|
var _b = _a.isLoader, isLoader = _b === void 0 ? false : _b, _c = _a.isFullScreen, isFullScreen = _c === void 0 ? true : _c, _d = _a.isTextItalic, isTextItalic = _d === void 0 ? false : _d, title = _a.title, _e = _a.textSize, textSize = _e === void 0 ? 'small' : _e, _f = _a.width, width = _f === void 0 ? 150 : _f, _g = _a.iconSize, iconSize = _g === void 0 ? 32 : _g, backgroundColor = _a.backgroundColor;
|
|
@@ -24,7 +24,7 @@ var Loader = function (_a) {
|
|
|
24
24
|
}); };
|
|
25
25
|
var getBackgroundColor = function () {
|
|
26
26
|
var defaultColor = isFullScreen ? DEFAULT_GRAY_LOADER_BACKGROUND_COLOR : DEFAULT_WHITE_LOADER_BACKGROUND_COLOR;
|
|
27
|
-
return
|
|
27
|
+
return getColor(backgroundColor, defaultColor);
|
|
28
28
|
};
|
|
29
29
|
return (_jsx("div", __assign({ className: classNames({
|
|
30
30
|
'smartapp-loader-wrapper': true,
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { useEffect, useRef } from 'react';
|
|
14
14
|
import { ReactComponent as LogoutIcon } from '../../assets/icons/logout.svg';
|
|
15
15
|
import { ReactComponent as AddProfileIcon } from '../../assets/icons/plus.svg';
|
|
16
|
-
import {
|
|
16
|
+
import { getColor } from '../../helpers';
|
|
17
17
|
import { DEFAULT_BLUE_ICON_COLOR, DEFAULT_BLUE_LIGHT_ICON_COLOR } from '../../constants';
|
|
18
18
|
import '../../styles/stories.module.scss';
|
|
19
19
|
var Profile = function (_a) {
|
|
@@ -33,9 +33,9 @@ var Profile = function (_a) {
|
|
|
33
33
|
document.removeEventListener('mousedown', checkIfClickedOutside);
|
|
34
34
|
};
|
|
35
35
|
}, [isShowProfile, onChange]);
|
|
36
|
-
return (_jsxs("div", __assign({ ref: ref, className: "smartapp-profile__container" }, { children: [_jsx("div", __assign({ onClick: function () { return onChange(!isShowProfile); }, className: "smartapp-profile__avatar" }, { children: initials })), isShowProfile && (_jsxs("div", __assign({ style: { width: "".concat(width, "%") }, className: "smartapp-profile" }, { children: [_jsxs("div", __assign({ className: "smartapp-profile__current-profile" }, { children: [_jsxs("div", __assign({ className: "smartapp-profile__current-profile--info" }, { children: [_jsx("div", __assign({ className: "smartapp-profile__avatar" }, { children: initials })), _jsxs("div", __assign({ className: "smartapp-profile__current-profile--info__data" }, { children: [_jsx("p", __assign({ className: "smartapp-profile__current-profile--info__data--username" }, { children: username })), email && _jsx("p", __assign({ className: "smartapp-profile__current-profile--info__data--email" }, { children: email }))] }))] })), _jsx("div", __assign({ onClick: onClickLogout, className: "smartapp-profile__current-profile--logout" }, { children: _jsx(LogoutIcon, { style: { color:
|
|
37
|
-
stroke:
|
|
38
|
-
color:
|
|
36
|
+
return (_jsxs("div", __assign({ ref: ref, className: "smartapp-profile__container" }, { children: [_jsx("div", __assign({ onClick: function () { return onChange(!isShowProfile); }, className: "smartapp-profile__avatar" }, { children: initials })), isShowProfile && (_jsxs("div", __assign({ style: { width: "".concat(width, "%") }, className: "smartapp-profile" }, { children: [_jsxs("div", __assign({ className: "smartapp-profile__current-profile" }, { children: [_jsxs("div", __assign({ className: "smartapp-profile__current-profile--info" }, { children: [_jsx("div", __assign({ className: "smartapp-profile__avatar" }, { children: initials })), _jsxs("div", __assign({ className: "smartapp-profile__current-profile--info__data" }, { children: [_jsx("p", __assign({ className: "smartapp-profile__current-profile--info__data--username" }, { children: username })), email && _jsx("p", __assign({ className: "smartapp-profile__current-profile--info__data--email" }, { children: email }))] }))] })), _jsx("div", __assign({ onClick: onClickLogout, className: "smartapp-profile__current-profile--logout" }, { children: _jsx(LogoutIcon, { style: { color: getColor(logoutColor, DEFAULT_BLUE_ICON_COLOR) } }) }))] })), isMultipleProfile && (_jsxs("div", __assign({ onClick: onClickAddProfile, className: "smartapp-profile__add-profile" }, { children: [_jsx("div", __assign({ className: "smartapp-profile__add-profile--icon" }, { children: _jsx(AddProfileIcon, { style: {
|
|
37
|
+
stroke: getColor(addProfileColor, DEFAULT_BLUE_ICON_COLOR),
|
|
38
|
+
color: getColor(addProfileBackgroundColor, DEFAULT_BLUE_LIGHT_ICON_COLOR)
|
|
39
39
|
} }) })), _jsx("p", __assign({ className: "smartapp-profile__add-profile--title" }, { children: "\u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u0430\u043A\u043A\u0430\u0443\u043D\u0442" }))] })))] })))] })));
|
|
40
40
|
};
|
|
41
41
|
export default Profile;
|
|
@@ -20,7 +20,7 @@ import { isEmpty } from 'lodash';
|
|
|
20
20
|
import { ReactComponent as CloseStoriesIcon } from '../../assets/icons/close-stories.svg';
|
|
21
21
|
import { STORY_BACKGROUND_TYPES, STORY_TYPE, } from './types';
|
|
22
22
|
import { BUTTON_PADDING, DEFAULT_BACKGROUND_BUTTON_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_TEXT_BUTTON_COLOR, MAX_PADDING_FOR_IMAGE, PLATFORM, } from '../../constants';
|
|
23
|
-
import {
|
|
23
|
+
import { getColor, isAndroidPlatform, isIosPlatform, isWebPlatform } from '../../helpers';
|
|
24
24
|
import '../../styles/stories.module.scss';
|
|
25
25
|
var storyItemBaseStyles = {
|
|
26
26
|
height: '100%',
|
|
@@ -132,8 +132,8 @@ var StoriesComponent = function (_a) {
|
|
|
132
132
|
storyContent === null || storyContent === void 0 ? void 0 : storyContent.style.setProperty('--padding', paddingTop);
|
|
133
133
|
}, []);
|
|
134
134
|
return (_jsx("div", __assign({ style: getStoryStyles(backgroundSource) }, { children: _jsxs("div", __assign({ style: { fontFamily: "".concat(fontFamily, ", sans-serif") }, className: "smartapp-stories__story" }, { children: [image && _jsx("div", __assign({ className: "smartapp-stories__story--image" }, { children: _jsx("img", { src: image, alt: "" }) })), title && _jsx("div", __assign({ className: "smartapp-stories__story--title" }, { children: title })), body && _jsx("div", __assign({ className: "smartapp-stories__story--body" }, { children: body })), button && (_jsx("div", __assign({ style: {
|
|
135
|
-
color:
|
|
136
|
-
background:
|
|
135
|
+
color: getColor(button.textColor, DEFAULT_TEXT_BUTTON_COLOR),
|
|
136
|
+
background: getColor(button.backgroundColor, DEFAULT_BACKGROUND_BUTTON_COLOR),
|
|
137
137
|
}, className: classNames('smartapp-stories__story--button', "smartapp-stories__story--button__".concat(platform)), onClick: button.action }, { children: button.text })))] })) }), id));
|
|
138
138
|
},
|
|
139
139
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PLATFORM } from '../../constants';
|
|
2
1
|
export declare enum STORY_BACKGROUND_TYPES {
|
|
3
2
|
color = "color",
|
|
4
3
|
image = "image"
|
|
@@ -40,7 +39,7 @@ export type TGroupStories = {
|
|
|
40
39
|
stories: TStoryItem[];
|
|
41
40
|
};
|
|
42
41
|
export interface IStoriesProps {
|
|
43
|
-
platform?:
|
|
42
|
+
platform?: 'web' | 'ios' | 'android';
|
|
44
43
|
fontFamily?: string;
|
|
45
44
|
groupStories: TGroupStories | null;
|
|
46
45
|
allGroupsStories: TGroupStories[];
|
|
@@ -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.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",
|