@expressms/smartapp-ui 1.1.0 → 1.1.2

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 (31) hide show
  1. package/build/main/assets/icons/loader.svg +3 -0
  2. package/build/main/constants/constants.d.ts +4 -0
  3. package/build/main/constants/constants.js +5 -0
  4. package/build/main/helpers/index.d.ts +1 -1
  5. package/build/main/helpers/index.js +2 -2
  6. package/build/main/styles/stories.module.scss +118 -12
  7. package/build/main/styles/styles.min.css +1 -1
  8. package/build/main//321/201omponents/ActionModal/ActionModal.d.ts +1 -1
  9. package/build/main//321/201omponents/ActionModal/ActionModal.js +4 -4
  10. package/build/main//321/201omponents/ActionModal/types.d.ts +2 -0
  11. package/build/main//321/201omponents/AttachedFile/AttachedFile.js +3 -3
  12. package/build/main//321/201omponents/Checkbox/Checkbox.js +2 -2
  13. package/build/main//321/201omponents/Chips/Chips.js +2 -2
  14. package/build/main//321/201omponents/ConfirmationModal/ConfirmationModal.js +1 -1
  15. package/build/main//321/201omponents/DragAndDrop/DragAndDrop.js +2 -2
  16. package/build/main//321/201omponents/Error/Error.js +2 -2
  17. package/build/main//321/201omponents/Header/Header.js +4 -4
  18. package/build/main//321/201omponents/Header/types.d.ts +1 -2
  19. package/build/main//321/201omponents/Loader/Loader.js +2 -2
  20. package/build/main//321/201omponents/Profile/Profile.js +4 -4
  21. package/build/main//321/201omponents/Stories/Stories.js +30 -16
  22. package/build/main//321/201omponents/Stories/types.d.ts +1 -2
  23. package/build/main//321/201omponents/SyncLoader/SyncLoader.d.ts +4 -0
  24. package/build/main//321/201omponents/SyncLoader/SyncLoader.js +66 -0
  25. package/build/main//321/201omponents/SyncLoader/index.d.ts +1 -0
  26. package/build/main//321/201omponents/SyncLoader/index.js +1 -0
  27. package/build/main//321/201omponents/SyncLoader/types.d.ts +6 -0
  28. package/build/main//321/201omponents/SyncLoader/types.js +1 -0
  29. package/build/main//321/201omponents/index.d.ts +1 -0
  30. package/build/main//321/201omponents/index.js +1 -0
  31. package/package.json +4 -1
@@ -1,4 +1,4 @@
1
1
  import { IActionModalProps } from './types';
2
2
  import '../../styles/stories.module.scss';
3
- declare const ActionModal: ({ isModalOpen, title, buttonName, confirmButtonFunction, cancelButtonFunction, placeholder, defaultValue, iconColor, }: IActionModalProps) => import("react/jsx-runtime").JSX.Element;
3
+ declare const ActionModal: ({ isModalOpen, title, buttonName, confirmButtonFunction, cancelButtonFunction, placeholder, defaultValue, iconColor, buttonWidth, }: IActionModalProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export default ActionModal;
@@ -16,12 +16,12 @@ 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 { getIconColor } from '../../helpers';
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) {
23
- var isModalOpen = _a.isModalOpen, title = _a.title, buttonName = _a.buttonName, confirmButtonFunction = _a.confirmButtonFunction, cancelButtonFunction = _a.cancelButtonFunction, placeholder = _a.placeholder, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, iconColor = _a.iconColor;
24
- var _c = useState(defaultValue), value = _c[0], setValue = _c[1];
23
+ var isModalOpen = _a.isModalOpen, title = _a.title, buttonName = _a.buttonName, confirmButtonFunction = _a.confirmButtonFunction, cancelButtonFunction = _a.cancelButtonFunction, placeholder = _a.placeholder, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, iconColor = _a.iconColor, _c = _a.buttonWidth, buttonWidth = _c === void 0 ? 100 : _c;
24
+ var _d = useState(defaultValue), value = _d[0], setValue = _d[1];
25
25
  var ref = useRef();
26
26
  useEffect(function () {
27
27
  var checkIfClickedOutside = function (e) {
@@ -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: getIconColor(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); } }) }))] })) })) })));
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, { width: buttonWidth, title: buttonName, typeButton: TButtonType.standard, color: TButtonColor.blue, onClickFunction: function () { return confirmButtonFunction(value); } }) }))] })) })) })));
41
41
  };
42
42
  export default ActionModal;
@@ -1,3 +1,4 @@
1
+ import { IntRange } from '../types';
1
2
  export interface IActionModalProps {
2
3
  isModalOpen: boolean;
3
4
  title: string;
@@ -7,4 +8,5 @@ export interface IActionModalProps {
7
8
  placeholder?: string;
8
9
  defaultValue?: string;
9
10
  iconColor?: string;
11
+ buttonWidth?: IntRange<1, 101>;
10
12
  }
@@ -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 { getIconColor } from '../../helpers';
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: getIconColor(fileColor, DEFAULT_GRAY_ICON_COLOR) } }) })), _jsxs("div", __assign({ className: classNames({
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: getIconColor(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: getIconColor(downloadColor, DEFAULT_BLUE_ICON_COLOR) } }) })))] }))] }))] }), weight));
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 { getIconColor } from '../../helpers';
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: getIconColor(iconColor, DEFAULT_BLUE_ICON_COLOR) } }) : _jsx("span", { className: "checkmark" })] })) })));
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 { getIconColor } from '../../helpers';
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: getIconColor(iconColor, DEFAULT_GRAY_ICON_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;
@@ -29,6 +29,6 @@ var ConfirmationModal = function (_a) {
29
29
  document === null || document === void 0 ? void 0 : document.removeEventListener('click', checkIfClickedOutside, true);
30
30
  };
31
31
  }, [isModalOpen, cancelButtonFunction]);
32
- return (_jsx(Popup, __assign({ closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className: "smartapp-confirmation-modal" }, { children: _jsxs("div", __assign({ className: "smartapp-confirmation-modal__content" }, { children: [_jsx("p", __assign({ className: "smartapp-confirmation-modal__content--title" }, { children: title })), _jsx("p", __assign({ className: "smartapp-confirmation-modal__content--text" }, { children: text })), _jsxs("div", __assign({ className: "smartapp-confirmation-modal__content--buttons" }, { children: [_jsx(Button, { width: 50, title: cancelButtonName, typeButton: TButtonType.low, onClickFunction: cancelButtonFunction, color: TButtonColor.white }), _jsx(Button, { width: 50, title: confirmButtonName, typeButton: TButtonType.low, onClickFunction: confirmButtonFunction, color: TButtonColor.red })] }))] })) })) })));
32
+ return (_jsx(Popup, __assign({ closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className: "smartapp-confirmation-modal" }, { children: _jsxs("div", __assign({ className: "smartapp-confirmation-modal__content" }, { children: [_jsx("p", __assign({ className: "smartapp-confirmation-modal__content--title" }, { children: title })), _jsx("p", __assign({ className: "smartapp-confirmation-modal__content--text" }, { children: text })), _jsxs("div", __assign({ className: "smartapp-confirmation-modal__content--buttons" }, { children: [_jsx(Button, { width: 50, title: cancelButtonName, typeButton: TButtonType.standard, onClickFunction: cancelButtonFunction, color: TButtonColor.white }), _jsx(Button, { width: 50, title: confirmButtonName, typeButton: TButtonType.standard, onClickFunction: confirmButtonFunction, color: TButtonColor.blue })] }))] })) })) })));
33
33
  };
34
34
  export default ConfirmationModal;
@@ -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 { getIconColor } from '../../helpers';
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: getIconColor(orderColor, DEFAULT_GRAY_ICON_COLOR) } }), onClickDeleteOption && _jsx(DeleteIcon, { className: "cp", style: { color: getIconColor(deleteColor, DEFAULT_BLUE_ICON_COLOR) }, onClick: function () { return onClickDeleteOption(instanceOption); } })] }))] }))); } }), instanceOption.id)); }) }))); } })) })) })));
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 { getIconColor } from '../../helpers';
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: getIconColor(iconColor, DEFAULT_GRAY_ICON_COLOR) } }) })), _jsx("p", __assign({ className: "smartapp-error__title" }, { children: title })), _jsx("p", __assign({ className: "smartapp-error__text" }, { children: text }))] })));
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 { getIconColor } from '../../helpers';
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: getIconColor(textColor, DEFAULT_HEADER_TEXT_COLOR),
28
- background: getIconColor(backgroundColor, DEFAULT_HEADER_BACKGROUND_COLOR),
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: getIconColor(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: getIconColor(trashColor, DEFAULT_RED_ICON_COLOR) } }) }))), refreshIcon && renderRefreshIcon(refreshIcon)] }))] })));
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?: 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 { getIconColor } from '../../helpers';
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 getIconColor(backgroundColor, defaultColor);
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 { getIconColor } from '../../helpers';
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: getIconColor(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: getIconColor(addProfileColor, DEFAULT_BLUE_ICON_COLOR),
38
- color: getIconColor(addProfileBackgroundColor, DEFAULT_BLUE_LIGHT_ICON_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;
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useEffect, useState } from 'react';
13
+ import { useEffect, useLayoutEffect, useState } from 'react';
14
14
  import classNames from 'classnames';
15
15
  import { isNull, sortBy } from 'lodash';
16
16
  import Stories from 'react-insta-stories';
@@ -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 { getIconColor, isAndroidPlatform, isIosPlatform, isWebPlatform } from '../../helpers';
23
+ import { getColor, isAndroidPlatform, isIosPlatform, isWebPlatform } from '../../helpers';
24
24
  import '../../styles/stories.module.scss';
25
25
  var storyItemBaseStyles = {
26
26
  height: '100%',
@@ -98,7 +98,6 @@ var StoriesComponent = function (_a) {
98
98
  handleCloseGroupStories();
99
99
  }
100
100
  };
101
- var onPrevious = function () { return activeStoryId === stories[0].id && handlePrevious(); };
102
101
  var onStoryStart = function (storyIndex) {
103
102
  var isVideoStory = stories[storyIndex].type === STORY_TYPE.video;
104
103
  isVideoStory && setActiveStoryId(stories[storyIndex].id);
@@ -114,12 +113,23 @@ var StoriesComponent = function (_a) {
114
113
  changeGroupStoriesToViewed(activeGroupStories);
115
114
  }
116
115
  };
116
+ var getCurrentStoryIndex = function () { return stories.findIndex(function (_a) {
117
+ var id = _a.id;
118
+ return id === activeStoryId;
119
+ }); };
120
+ var onPrevious = function () {
121
+ activeStoryId === stories[0].id ? handlePrevious() : onStoryStart(getCurrentStoryIndex() - 1);
122
+ };
123
+ var onNext = function () {
124
+ var currentStoryIndex = getCurrentStoryIndex();
125
+ currentStoryIndex !== stories.length - 1 && onStoryStart(currentStoryIndex + 1);
126
+ };
117
127
  var getImageContent = function (_a) {
118
128
  var id = _a.id, title = _a.title, body = _a.body, backgroundSource = _a.backgroundSource, button = _a.button, image = _a.image;
119
129
  return ({
120
130
  content: function () {
121
131
  // eslint-disable-next-line react-hooks/rules-of-hooks
122
- useEffect(function () {
132
+ useLayoutEffect(function () {
123
133
  setActiveStoryId(id);
124
134
  var storyWrapper = document.querySelector('.smartapp-stories');
125
135
  var storyWrapperHeight = (storyWrapper === null || storyWrapper === void 0 ? void 0 : storyWrapper.getBoundingClientRect().height) || 0;
@@ -132,8 +142,8 @@ var StoriesComponent = function (_a) {
132
142
  storyContent === null || storyContent === void 0 ? void 0 : storyContent.style.setProperty('--padding', paddingTop);
133
143
  }, []);
134
144
  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: getIconColor(button.textColor, DEFAULT_TEXT_BUTTON_COLOR),
136
- background: getIconColor(button.backgroundColor, DEFAULT_BACKGROUND_BUTTON_COLOR),
145
+ color: getColor(button.textColor, DEFAULT_TEXT_BUTTON_COLOR),
146
+ background: getColor(button.backgroundColor, DEFAULT_BACKGROUND_BUTTON_COLOR),
137
147
  }, className: classNames('smartapp-stories__story--button', "smartapp-stories__story--button__".concat(platform)), onClick: button.action }, { children: button.text })))] })) }), id));
138
148
  },
139
149
  });
@@ -151,6 +161,16 @@ var StoriesComponent = function (_a) {
151
161
  onSwipedLeft: function () { return handleNext(); },
152
162
  onSwipedRight: function () { return handlePrevious(); },
153
163
  });
164
+ var createBackgroundVideo = function (id, url) {
165
+ var video = document.createElement('video');
166
+ video.id = "background_video_".concat(id);
167
+ video.src = url;
168
+ video.muted = true;
169
+ video.playsInline = true;
170
+ video.autoplay = true;
171
+ video.classList.add('smartapp-stories-content__background-video');
172
+ return video;
173
+ };
154
174
  useEffect(function () {
155
175
  var sortedStories = sortStoriesByOrder((groupStories === null || groupStories === void 0 ? void 0 : groupStories.stories) || []);
156
176
  setActiveGroupStories(groupStories);
@@ -185,20 +205,14 @@ var StoriesComponent = function (_a) {
185
205
  isWebPlatform(platform) && (popupElement === null || popupElement === void 0 ? void 0 : popupElement.style.setProperty('--background', background));
186
206
  }
187
207
  else {
208
+ var id = activeStory.id, url = activeStory.url;
188
209
  var prevBackgroundVideos = document.querySelectorAll(".smartapp-stories-content__background-video");
189
210
  !isEmpty(prevBackgroundVideos) && prevBackgroundVideos.forEach(function (video) { return video.remove(); });
190
- var video = document.createElement('video');
191
- video.id = "background_video_".concat(activeStory.id);
192
- video.src = activeStory.url;
193
- video.playsInline = true;
194
- video.autoplay = true;
195
- video.muted = true;
196
- video.classList.add('smartapp-stories-content__background-video');
197
211
  if (isWebPlatform(platform)) {
198
212
  popupElement === null || popupElement === void 0 ? void 0 : popupElement.style.removeProperty('--background');
199
- popupElement === null || popupElement === void 0 ? void 0 : popupElement.appendChild(video);
213
+ popupElement === null || popupElement === void 0 ? void 0 : popupElement.appendChild(createBackgroundVideo(id, url));
200
214
  }
201
- videoWrapper === null || videoWrapper === void 0 ? void 0 : videoWrapper.appendChild(video.cloneNode(true));
215
+ videoWrapper === null || videoWrapper === void 0 ? void 0 : videoWrapper.appendChild(createBackgroundVideo(id, url));
202
216
  }
203
217
  }
204
218
  }, [platform, activeStory]);
@@ -212,7 +226,7 @@ var StoriesComponent = function (_a) {
212
226
  _b['smartapp-stories__video'] = (activeStory === null || activeStory === void 0 ? void 0 : activeStory.type) === STORY_TYPE.video,
213
227
  _b['smartapp-stories__animate-right'] = isAnimateToRight,
214
228
  _b['smartapp-stories__animate-left'] = isAnimateToLeft,
215
- _b)) }, swipeableHandlers, { children: _jsx(Stories, { defaultInterval: 6000, width: "100%", height: "100%", stories: getStories(), onStoryStart: onStoryStart, onPrevious: onPrevious, onAllStoriesEnd: handleNext, progressContainerStyles: progressContainerStyles(platform), progressWrapperStyles: progressWrapperStyles, progressStyles: progressStyles }, activeGroupStories.id) })), _jsx(CloseStoriesIcon, { className: classNames((_c = {
229
+ _b)) }, swipeableHandlers, { children: _jsx(Stories, { defaultInterval: 6000, width: "100%", height: "100%", stories: getStories(), onStoryStart: onStoryStart, onPrevious: onPrevious, onNext: onNext, onAllStoriesEnd: handleNext, progressContainerStyles: progressContainerStyles(platform), progressWrapperStyles: progressWrapperStyles, progressStyles: progressStyles }, activeGroupStories.id) })), _jsx(CloseStoriesIcon, { className: classNames((_c = {
216
230
  'smartapp-stories__icon': true
217
231
  },
218
232
  _c["smartapp-stories__icon--".concat(platform)] = true,
@@ -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?: PLATFORM;
42
+ platform?: 'web' | 'ios' | 'android';
44
43
  fontFamily?: string;
45
44
  groupStories: TGroupStories | null;
46
45
  allGroupsStories: TGroupStories[];
@@ -0,0 +1,4 @@
1
+ import { ISyncLoaderProps } from './types';
2
+ import '../../styles/stories.module.scss';
3
+ declare const SyncLoader: ({ isLoading, theme, color, fontFamily, }: ISyncLoaderProps) => import("react/jsx-runtime").JSX.Element | null;
4
+ export default SyncLoader;
@@ -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,6 @@
1
+ export interface ISyncLoaderProps {
2
+ isLoading: boolean;
3
+ theme?: 'default' | 'dark';
4
+ color?: string;
5
+ fontFamily?: string;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -18,3 +18,4 @@ export { default as Profile } from './Profile';
18
18
  export { default as Switcher } from './Switcher';
19
19
  export { default as Toggle } from './Toggle';
20
20
  export { default as Stories } from './Stories';
21
+ export { default as SyncLoader } from './SyncLoader';
@@ -18,3 +18,4 @@ export { default as Profile } from './Profile';
18
18
  export { default as Switcher } from './Switcher';
19
19
  export { default as Toggle } from './Toggle';
20
20
  export { default as Stories } from './Stories';
21
+ export { default as SyncLoader } from './SyncLoader';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressms/smartapp-ui",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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",