@expressms/smartapp-ui 1.1.6 → 1.1.8
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/refresh.svg +1 -1
- package/build/main/assets/icons/story-loader.svg +3 -0
- package/build/main/constants/constants.d.ts +13 -13
- package/build/main/constants/constants.js +14 -13
- package/build/main/constants/index.d.ts +1 -0
- package/build/main/constants/index.js +1 -0
- package/build/main/constants/types.d.ts +8 -0
- package/build/main/constants/types.js +1 -0
- package/build/main/helpers/index.d.ts +3 -1
- package/build/main/helpers/index.js +6 -2
- package/build/main/styles/main.js +0 -0
- package/build/main/styles/stories.module.scss +167 -55
- package/build/main/styles/styles.min.css +30 -77
- package/build/main/styles/styles.scss +13 -0
- package/build/main//321/201omponents/ActionModal/ActionModal.d.ts +1 -1
- package/build/main//321/201omponents/ActionModal/ActionModal.js +9 -9
- package/build/main//321/201omponents/ActionModal/types.d.ts +2 -2
- package/build/main//321/201omponents/AttachedFile/AttachedFile.js +3 -3
- package/build/main//321/201omponents/Button/Button.d.ts +1 -1
- package/build/main//321/201omponents/Button/Button.js +3 -2
- package/build/main//321/201omponents/Button/types.d.ts +2 -1
- package/build/main//321/201omponents/Checkbox/Checkbox.js +3 -3
- package/build/main//321/201omponents/Chips/Chips.js +2 -2
- package/build/main//321/201omponents/ConfirmationModal/ConfirmationModal.js +4 -4
- package/build/main//321/201omponents/ConfirmationModal/types.d.ts +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 +6 -6
- package/build/main//321/201omponents/Header/types.d.ts +3 -2
- package/build/main//321/201omponents/Input/Input.d.ts +1 -1
- package/build/main//321/201omponents/Input/Input.js +4 -4
- package/build/main//321/201omponents/Input/types.d.ts +2 -1
- package/build/main//321/201omponents/Loader/Loader.d.ts +1 -1
- package/build/main//321/201omponents/Loader/Loader.js +8 -5
- package/build/main//321/201omponents/Loader/types.d.ts +2 -1
- package/build/main//321/201omponents/Modal/Modal.d.ts +1 -1
- package/build/main//321/201omponents/Modal/Modal.js +7 -7
- package/build/main//321/201omponents/Modal/types.d.ts +2 -2
- package/build/main//321/201omponents/Notification/types.d.ts +2 -2
- package/build/main//321/201omponents/Profile/Profile.js +4 -4
- package/build/main//321/201omponents/RadioButton/RadioButton.js +3 -3
- package/build/main//321/201omponents/Stories/Stories.js +30 -8
- package/build/main//321/201omponents/Stories/types.d.ts +4 -3
- package/build/main//321/201omponents/SyncLoader/SyncLoader.js +2 -2
- package/build/main//321/201omponents/SyncLoader/types.d.ts +2 -2
- package/build/main//321/201omponents/Toggle/Toggle.js +3 -3
- package/package.json +3 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IntRange } from '../types';
|
|
2
|
-
|
|
2
|
+
import { ICommonProps } from '../../constants';
|
|
3
|
+
export interface IActionModalProps extends ICommonProps {
|
|
3
4
|
isModalOpen: boolean;
|
|
4
5
|
title: string;
|
|
5
6
|
buttonName: string;
|
|
6
7
|
confirmButtonFunction: (str: string) => void;
|
|
7
8
|
cancelButtonFunction: () => void;
|
|
8
|
-
platform?: 'web' | 'ios' | 'android';
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
defaultValue?: string;
|
|
11
11
|
isButtonDisabled?: boolean;
|
|
@@ -15,13 +15,13 @@ 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
17
|
import { getColor } from '../../helpers';
|
|
18
|
-
import {
|
|
18
|
+
import { COLORS } 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: getColor(fileColor,
|
|
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, COLORS.gray) } }) })), _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: getColor(removeColor,
|
|
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, COLORS.blue) } }) }))), onClickDownloadFile && isDownloadFile && (_jsx("div", __assign({ onClick: function () { return onClickDownloadFile(fileName); }, className: "smartapp-attached-file__value--icons__download" }, { children: _jsx(DownloadIcon, { style: { color: getColor(downloadColor, COLORS.blue) } }) })))] }))] }))] }), weight));
|
|
26
26
|
};
|
|
27
27
|
export default AttachedFile;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IButtonProps } from './types';
|
|
2
2
|
import '../../styles/stories.module.scss';
|
|
3
|
-
declare const Button: ({ title, isDisabled, typeButton, color, width, onClickFunction }: IButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const Button: ({ title, isDisabled, typeButton, color, width, theme, onClickFunction }: IButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default Button;
|
|
@@ -12,9 +12,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { TButtonType, TButtonColor } from './types';
|
|
15
|
+
import { THEME } from '../../constants';
|
|
15
16
|
import '../../styles/stories.module.scss';
|
|
16
17
|
var Button = function (_a) {
|
|
17
|
-
var title = _a.title, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = _a.typeButton, typeButton = _c === void 0 ? TButtonType.standard : _c, _d = _a.color, color = _d === void 0 ? TButtonColor.white : _d, _e = _a.width, width = _e === void 0 ? 100 : _e, _f = _a.onClickFunction, onClickFunction =
|
|
18
|
-
return (_jsx("button", __assign({ className: classNames(
|
|
18
|
+
var title = _a.title, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = _a.typeButton, typeButton = _c === void 0 ? TButtonType.standard : _c, _d = _a.color, color = _d === void 0 ? TButtonColor.white : _d, _e = _a.width, width = _e === void 0 ? 100 : _e, _f = _a.theme, theme = _f === void 0 ? THEME.default : _f, _g = _a.onClickFunction, onClickFunction = _g === void 0 ? function () { return undefined; } : _g;
|
|
19
|
+
return (_jsx("button", __assign({ className: classNames("smartapp-button__".concat(typeButton), "smartapp-button__color--".concat(color), "smartapp-button__".concat(theme, "--").concat(color), isDisabled && 'smartapp-button__disabled'), style: { width: "".concat(width, "%") }, onClick: onClickFunction }, { children: title })));
|
|
19
20
|
};
|
|
20
21
|
export default Button;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IntRange } from '../types';
|
|
2
|
+
import { IThemeProps } from '../../constants';
|
|
2
3
|
export declare enum TButtonType {
|
|
3
4
|
standard = "standard",
|
|
4
5
|
low = "low"
|
|
@@ -8,7 +9,7 @@ export declare enum TButtonColor {
|
|
|
8
9
|
blue = "blue",
|
|
9
10
|
red = "red"
|
|
10
11
|
}
|
|
11
|
-
export interface IButtonProps {
|
|
12
|
+
export interface IButtonProps extends IThemeProps {
|
|
12
13
|
title: string;
|
|
13
14
|
isDisabled?: boolean;
|
|
14
15
|
typeButton?: 'standard' | 'low';
|
|
@@ -13,13 +13,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { useEffect } from 'react';
|
|
14
14
|
import { ReactComponent as CheckIcon } from '../../assets/icons/check-mark.svg';
|
|
15
15
|
import { getColor } from '../../helpers';
|
|
16
|
-
import {
|
|
16
|
+
import { COLORS } from '../../constants';
|
|
17
17
|
import '../../styles/stories.module.scss';
|
|
18
18
|
var CheckBox = function (_a) {
|
|
19
19
|
var id = _a.id, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = _a.isChecked, isChecked = _c === void 0 ? false : _c, checkedColor = _a.checkedColor, checkedHoverColor = _a.checkedHoverColor, _d = _a.onChange, onChange = _d === void 0 ? function () { return undefined; } : _d;
|
|
20
20
|
useEffect(function () {
|
|
21
|
-
document.documentElement.style.setProperty('--checkbox-hover-color', getColor(checkedHoverColor,
|
|
21
|
+
document.documentElement.style.setProperty('--checkbox-hover-color', getColor(checkedHoverColor, COLORS.darkBlue));
|
|
22
22
|
}, [checkedHoverColor]);
|
|
23
|
-
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: isDisabled, checked: isChecked, onChange: onChange }), isChecked ? _jsx(CheckIcon, { style: { color: getColor(checkedColor,
|
|
23
|
+
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: isDisabled, checked: isChecked, onChange: onChange }), isChecked ? _jsx(CheckIcon, { style: { color: getColor(checkedColor, COLORS.blue) } }) : _jsx("span", { className: "checkmark" })] })) })));
|
|
24
24
|
};
|
|
25
25
|
export default CheckBox;
|
|
@@ -13,10 +13,10 @@ 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
15
|
import { getColor } from '../../helpers';
|
|
16
|
-
import {
|
|
16
|
+
import { COLORS } 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: getColor(iconColor,
|
|
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, COLORS.gray) } }) }))] })));
|
|
21
21
|
};
|
|
22
22
|
export default Chips;
|
|
@@ -14,14 +14,14 @@ import { useEffect, useRef } from 'react';
|
|
|
14
14
|
import Popup from 'reactjs-popup';
|
|
15
15
|
import Button from '../Button';
|
|
16
16
|
import { TButtonColor, TButtonType } from '../Button/types';
|
|
17
|
-
import {
|
|
17
|
+
import { COLORS, PLATFORM } from '../../constants';
|
|
18
18
|
import { getClassNames, getColor, isMobilePlatform } from '../../helpers';
|
|
19
19
|
import '../../styles/stories.module.scss';
|
|
20
20
|
var ConfirmationModal = function (_a) {
|
|
21
21
|
var isModalOpen = _a.isModalOpen, title = _a.title, text = _a.text, cancelButtonName = _a.cancelButtonName, confirmButtonName = _a.confirmButtonName, cancelButtonFunction = _a.cancelButtonFunction, confirmButtonFunction = _a.confirmButtonFunction, _b = _a.platform, platform = _b === void 0 ? PLATFORM.web : _b, backgroundColor = _a.backgroundColor;
|
|
22
22
|
var ref = useRef(null);
|
|
23
23
|
useEffect(function () {
|
|
24
|
-
document.documentElement.style.setProperty('--confirmation-modal-background', getColor(backgroundColor,
|
|
24
|
+
document.documentElement.style.setProperty('--confirmation-modal-background', getColor(backgroundColor, COLORS.lightBlue));
|
|
25
25
|
}, [backgroundColor]);
|
|
26
26
|
useEffect(function () {
|
|
27
27
|
var checkIfClickedOutside = function (e) {
|
|
@@ -29,9 +29,9 @@ var ConfirmationModal = function (_a) {
|
|
|
29
29
|
cancelButtonFunction();
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
document === null || document === void 0 ? void 0 : document.addEventListener('
|
|
32
|
+
document === null || document === void 0 ? void 0 : document.addEventListener('mousedown', checkIfClickedOutside, true);
|
|
33
33
|
return function () {
|
|
34
|
-
document === null || document === void 0 ? void 0 : document.removeEventListener('
|
|
34
|
+
document === null || document === void 0 ? void 0 : document.removeEventListener('mousedown', checkIfClickedOutside, true);
|
|
35
35
|
};
|
|
36
36
|
}, [isModalOpen, cancelButtonFunction]);
|
|
37
37
|
return (_jsx(Popup, __assign({ className: getClassNames('confirmation-modal', '-', platform), closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className: getClassNames('smartapp-confirmation-modal', '__', platform) }, { children: _jsxs("div", __assign({ className: getClassNames('smartapp-confirmation-modal__content', '--', platform) }, { children: [title && _jsx("p", __assign({ className: "smartapp-confirmation-modal__content--title" }, { children: title })), _jsx("p", __assign({ className: "smartapp-confirmation-modal__content--text" }, { children: text })), isMobilePlatform(platform) && _jsx("div", { className: "smartapp-confirmation-modal__content--delimiter" }), _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 })] }))] })) })) })));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { IPlatformProps } from '../../constants';
|
|
2
|
+
export interface IConfirmationModalProps extends IPlatformProps {
|
|
2
3
|
isModalOpen: boolean;
|
|
3
4
|
title?: string;
|
|
4
5
|
text: string;
|
|
@@ -6,6 +7,5 @@ export interface IConfirmationModalProps {
|
|
|
6
7
|
confirmButtonName: string;
|
|
7
8
|
cancelButtonFunction: () => void;
|
|
8
9
|
confirmButtonFunction: (option?: any) => void;
|
|
9
|
-
platform?: 'web' | 'ios' | 'android';
|
|
10
10
|
backgroundColor?: string;
|
|
11
11
|
}
|
|
@@ -16,7 +16,7 @@ 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
18
|
import { getColor } from '../../helpers';
|
|
19
|
-
import {
|
|
19
|
+
import { COLORS } from '../../constants';
|
|
20
20
|
import '../../styles/stories.module.scss';
|
|
21
21
|
var DragAndDrop = function (_a) {
|
|
22
22
|
var placeholder = _a.placeholder, options = _a.options, onDragEndFunction = _a.onDragEndFunction, onChangeIsCompletedOption = _a.onChangeIsCompletedOption, onChangeOption = _a.onChangeOption, onClickDeleteOption = _a.onClickDeleteOption, width = _a.width, checkboxColor = _a.checkboxColor, orderColor = _a.orderColor, deleteColor = _a.deleteColor;
|
|
@@ -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, isChecked: instanceOption.isCompleted, checkedColor: 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,
|
|
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, isChecked: instanceOption.isCompleted, checkedColor: 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, COLORS.gray) } }), onClickDeleteOption && _jsx(DeleteIcon, { className: "cp", style: { color: getColor(deleteColor, COLORS.blue) }, onClick: function () { return onClickDeleteOption(instanceOption); } })] }))] }))); } }), instanceOption.id)); }) }))); } })) })) })));
|
|
54
54
|
};
|
|
55
55
|
export default DragAndDrop;
|
|
@@ -12,10 +12,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
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
14
|
import { getColor } from '../../helpers';
|
|
15
|
-
import {
|
|
15
|
+
import { COLORS } 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: getColor(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: getColor(iconColor, COLORS.gray) } }) })), _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;
|
|
@@ -15,7 +15,7 @@ import { ReactComponent as ArrowBackIcon } from '../../assets/icons/arrow-back.s
|
|
|
15
15
|
import { ReactComponent as TrashIcon } from '../../assets/icons/trash.svg';
|
|
16
16
|
import { ReactComponent as RefreshIcon } from '../../assets/icons/refresh.svg';
|
|
17
17
|
import { getColor } from '../../helpers';
|
|
18
|
-
import {
|
|
18
|
+
import { COLORS, FONT_SIZE, LINE_HEIGHT, PLATFORM } from '../../constants';
|
|
19
19
|
import '../../styles/stories.module.scss';
|
|
20
20
|
var Header = function (_a) {
|
|
21
21
|
var _b;
|
|
@@ -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: getColor(textColor,
|
|
28
|
-
background: getColor(backgroundColor,
|
|
27
|
+
color: getColor(textColor, COLORS.black),
|
|
28
|
+
background: getColor(backgroundColor, COLORS.white),
|
|
29
29
|
}); };
|
|
30
30
|
var renderRefreshIcon = function (_a) {
|
|
31
|
-
var isEnabled = _a.isEnabled, onClick = _a.onClick;
|
|
32
|
-
return (_jsx(RefreshIcon, { className: classNames({ 'smartapp-header__icons--refresh': isEnabled }), onClick: !isEnabled ? onClick : function () { } }));
|
|
31
|
+
var isEnabled = _a.isEnabled, color = _a.color, onClick = _a.onClick;
|
|
32
|
+
return (_jsx(RefreshIcon, { className: classNames({ 'smartapp-header__icons--refresh': isEnabled }), style: { color: getColor(color, COLORS.gray) }, 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: getColor(arrowColor,
|
|
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, COLORS.black) }, 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, COLORS.red) } }) }))), refreshIcon && renderRefreshIcon(refreshIcon), customIcon] }))] })));
|
|
35
35
|
};
|
|
36
36
|
export default Header;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { IPlatformProps } from '../../constants';
|
|
2
3
|
export type TRefreshIcon = {
|
|
3
4
|
isEnabled: boolean;
|
|
5
|
+
color?: string;
|
|
4
6
|
onClick: () => void;
|
|
5
7
|
};
|
|
6
|
-
export interface IHeaderProps {
|
|
8
|
+
export interface IHeaderProps extends IPlatformProps {
|
|
7
9
|
title?: string;
|
|
8
10
|
isBack?: boolean;
|
|
9
11
|
isRemove?: boolean;
|
|
@@ -13,7 +15,6 @@ export interface IHeaderProps {
|
|
|
13
15
|
onClickRemove?: () => void;
|
|
14
16
|
arrowColor?: string;
|
|
15
17
|
trashColor?: string;
|
|
16
|
-
platform?: 'web' | 'ios' | 'android';
|
|
17
18
|
headerHeight?: number;
|
|
18
19
|
textSize?: 'small' | 'default' | 'large';
|
|
19
20
|
textColor?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IInputProps } from './types';
|
|
2
2
|
import '../../styles/stories.module.scss';
|
|
3
|
-
declare const Input: ({ isPassword, isClearable, autoFocus, title, placeholder, defaultValue, error, textSize, width, className, onChange, onEnterPress, onClearClick, }: IInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const Input: ({ isPassword, isClearable, autoFocus, title, placeholder, defaultValue, error, textSize, width, className, theme, onChange, onEnterPress, onClearClick, }: IInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default Input;
|
|
@@ -15,13 +15,13 @@ import classNames from 'classnames';
|
|
|
15
15
|
import { ReactComponent as IconEye } from '../../assets/icons/icon-eye.svg';
|
|
16
16
|
import { ReactComponent as IconEyeClosed } from '../../assets/icons/icon-eye-off.svg';
|
|
17
17
|
import { ReactComponent as ClearIcon } from '../../assets/icons/clear.svg';
|
|
18
|
-
import { ENTER_KEY, FONT_SIZE, INPUT_TYPE_PASSWORD, INPUT_TYPE_TEXT, LINE_HEIGHT } from '../../constants';
|
|
18
|
+
import { ENTER_KEY, FONT_SIZE, INPUT_TYPE_PASSWORD, INPUT_TYPE_TEXT, LINE_HEIGHT, THEME } from '../../constants';
|
|
19
19
|
import '../../styles/stories.module.scss';
|
|
20
20
|
var Input = function (_a) {
|
|
21
21
|
var _b;
|
|
22
|
-
var _c = _a.isPassword, isPassword = _c === void 0 ? false : _c, _d = _a.isClearable, isClearable = _d === void 0 ? false : _d, _e = _a.autoFocus, autoFocus = _e === void 0 ? false : _e, title = _a.title, placeholder = _a.placeholder, defaultValue = _a.defaultValue, error = _a.error, _f = _a.textSize, textSize = _f === void 0 ? 'small' : _f, _g = _a.width, width = _g === void 0 ? 100 : _g, _h = _a.className, className = _h === void 0 ? '' : _h, onChange = _a.onChange, onEnterPress = _a.onEnterPress, onClearClick = _a.onClearClick;
|
|
22
|
+
var _c = _a.isPassword, isPassword = _c === void 0 ? false : _c, _d = _a.isClearable, isClearable = _d === void 0 ? false : _d, _e = _a.autoFocus, autoFocus = _e === void 0 ? false : _e, title = _a.title, placeholder = _a.placeholder, defaultValue = _a.defaultValue, error = _a.error, _f = _a.textSize, textSize = _f === void 0 ? 'small' : _f, _g = _a.width, width = _g === void 0 ? 100 : _g, _h = _a.className, className = _h === void 0 ? '' : _h, _j = _a.theme, theme = _j === void 0 ? THEME.default : _j, onChange = _a.onChange, onEnterPress = _a.onEnterPress, onClearClick = _a.onClearClick;
|
|
23
23
|
var inputRef = useRef(null);
|
|
24
|
-
var
|
|
24
|
+
var _k = useState(false), isPasswordShown = _k[0], setIsPasswordShown = _k[1];
|
|
25
25
|
useEffect(function () {
|
|
26
26
|
var inputElement = inputRef.current;
|
|
27
27
|
if (inputElement && inputElement.value.length) {
|
|
@@ -52,6 +52,6 @@ var Input = function (_a) {
|
|
|
52
52
|
setIsPasswordShown(!isPasswordShown);
|
|
53
53
|
!((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value.length) && ((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus());
|
|
54
54
|
};
|
|
55
|
-
return (_jsxs("div", __assign({ style: { width: "".concat(width, "%") }, className: classNames(
|
|
55
|
+
return (_jsxs("div", __assign({ style: { width: "".concat(width, "%") }, className: classNames('smartapp-input', "smartapp-input__".concat(theme), (_b = {}, _b[className] = className, _b)) }, { children: [title && _jsx("p", __assign({ className: "smartapp-input__title" }, { children: title })), _jsxs("div", __assign({ className: "smartapp-input__container" }, { children: [_jsx("input", { ref: inputRef, className: classNames('smartapp-input__container--field', { 'smartapp-input__container--field__with-clear-button': isClearable }), style: getTextStyles(), type: getInputType(), defaultValue: defaultValue, autoFocus: autoFocus, placeholder: placeholder, onKeyDown: handleKeyDown, onChange: function (e) { return onChange(e.target.value); } }), isPassword && (_jsx("button", __assign({ className: "smartapp-input__container--eye-button", type: "button", onClick: function () { return onClickButton(); } }, { children: isPasswordShown ? _jsx(IconEye, {}) : _jsx(IconEyeClosed, {}) }))), isClearable && _jsx(ClearIcon, { className: "smartapp-input__container--clear-icon", onClick: onClearClick })] })), error && _jsx("div", __assign({ className: "smartapp-input__error" }, { children: error }))] })));
|
|
56
56
|
};
|
|
57
57
|
export default Input;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ILoaderProps } from './types';
|
|
2
2
|
import '../../styles/stories.module.scss';
|
|
3
|
-
declare const Loader: ({ isLoader, isFullScreen, isTextItalic, title, textSize, width, iconSize, backgroundColor, }: ILoaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const Loader: ({ isLoader, isFullScreen, isTextItalic, title, textSize, width, iconSize, backgroundColor, theme, }: ILoaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default Loader;
|
|
@@ -12,23 +12,26 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
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
|
-
import {
|
|
16
|
-
import { getColor } from '../../helpers';
|
|
15
|
+
import { COLORS, FONT_SIZE, LINE_HEIGHT, THEME } from '../../constants';
|
|
16
|
+
import { getClassNames, getColor } from '../../helpers';
|
|
17
17
|
import '../../styles/stories.module.scss';
|
|
18
18
|
var Loader = function (_a) {
|
|
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;
|
|
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, _h = _a.theme, theme = _h === void 0 ? THEME.default : _h;
|
|
20
|
+
var isDarkTheme = theme === THEME.dark;
|
|
20
21
|
var getTextStyles = function () { return ({
|
|
21
22
|
fontSize: FONT_SIZE[textSize],
|
|
22
23
|
fontStyle: isTextItalic ? 'italic' : 'normal',
|
|
23
24
|
lineHeight: LINE_HEIGHT[textSize],
|
|
24
25
|
}); };
|
|
25
26
|
var getBackgroundColor = function () {
|
|
26
|
-
var defaultColor =
|
|
27
|
+
var defaultColor = isDarkTheme
|
|
28
|
+
? COLORS.white3
|
|
29
|
+
: (isFullScreen ? COLORS.lightGray : COLORS.white);
|
|
27
30
|
return getColor(backgroundColor, defaultColor);
|
|
28
31
|
};
|
|
29
32
|
return (_jsx("div", __assign({ className: classNames({
|
|
30
33
|
'smartapp-loader-wrapper': true,
|
|
31
34
|
'smartapp-loader-wrapper__full-screen': isFullScreen,
|
|
32
|
-
}), style: { background: getBackgroundColor() } }, { children: _jsxs("div", __assign({ className: "smartapp-loader", style: { width: "".concat(width, "px") } }, { children: [_jsx(ColorRing, { visible: isLoader, height: iconSize, width: iconSize, ariaLabel: "blocks-loading", wrapperStyle: {}, wrapperClass: "blocks-wrapper", colors: ['#4799E3', '#4799E3', '#4799E3', '#4799E3', '#4799E3'] }), title && _jsx("p", __assign({ className:
|
|
35
|
+
}), style: { background: getBackgroundColor() } }, { children: _jsxs("div", __assign({ className: "smartapp-loader", style: { width: "".concat(width, "px") } }, { children: [_jsx(ColorRing, { visible: isLoader, height: iconSize, width: iconSize, ariaLabel: "blocks-loading", wrapperStyle: {}, wrapperClass: "blocks-wrapper", colors: ['#4799E3', '#4799E3', '#4799E3', '#4799E3', '#4799E3'] }), title && _jsx("p", __assign({ className: getClassNames('smartapp-loader__title', '--', theme), style: getTextStyles() }, { children: title }))] })) })));
|
|
33
36
|
};
|
|
34
37
|
export default Loader;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IModalProps } from './types';
|
|
2
2
|
import '../../styles/stories.module.scss';
|
|
3
|
-
declare const Modal: ({ isModalOpen, content, handleCloseModal, title, platform, iconColor, backgroundColor }: IModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const Modal: ({ isModalOpen, content, handleCloseModal, title, theme, platform, iconColor, backgroundColor, }: IModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default Modal;
|
|
@@ -13,14 +13,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { useEffect, useRef } from 'react';
|
|
14
14
|
import Popup from 'reactjs-popup';
|
|
15
15
|
import { ReactComponent as CloseIcon } from '../../assets/icons/cancel-cross.svg';
|
|
16
|
-
import {
|
|
17
|
-
import { getClassNames, getColor } from '../../helpers';
|
|
16
|
+
import { COLORS, PLATFORM, THEME } from '../../constants';
|
|
17
|
+
import { getClassNames, getColor, getDefaultColorForCloseIcon } from '../../helpers';
|
|
18
18
|
import '../../styles/stories.module.scss';
|
|
19
19
|
var Modal = function (_a) {
|
|
20
|
-
var isModalOpen = _a.isModalOpen, content = _a.content, handleCloseModal = _a.handleCloseModal, title = _a.title, _b = _a.platform, platform =
|
|
20
|
+
var isModalOpen = _a.isModalOpen, content = _a.content, handleCloseModal = _a.handleCloseModal, title = _a.title, _b = _a.theme, theme = _b === void 0 ? THEME.default : _b, _c = _a.platform, platform = _c === void 0 ? PLATFORM.web : _c, iconColor = _a.iconColor, backgroundColor = _a.backgroundColor;
|
|
21
21
|
var ref = useRef(null);
|
|
22
22
|
useEffect(function () {
|
|
23
|
-
document.documentElement.style.setProperty('--modal-background', getColor(backgroundColor,
|
|
23
|
+
document.documentElement.style.setProperty('--modal-background', getColor(backgroundColor, COLORS.lightBlue));
|
|
24
24
|
}, [backgroundColor]);
|
|
25
25
|
useEffect(function () {
|
|
26
26
|
var checkIfClickedOutside = function (e) {
|
|
@@ -28,11 +28,11 @@ var Modal = function (_a) {
|
|
|
28
28
|
handleCloseModal();
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
document === null || document === void 0 ? void 0 : document.addEventListener('
|
|
31
|
+
document === null || document === void 0 ? void 0 : document.addEventListener('mousedown', checkIfClickedOutside, true);
|
|
32
32
|
return function () {
|
|
33
|
-
document === null || document === void 0 ? void 0 : document.removeEventListener('
|
|
33
|
+
document === null || document === void 0 ? void 0 : document.removeEventListener('mousedown', checkIfClickedOutside, true);
|
|
34
34
|
};
|
|
35
35
|
}, [isModalOpen, handleCloseModal]);
|
|
36
|
-
return (_jsx(Popup, __assign({ className: getClassNames('modal', '-', platform), closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className: getClassNames('smartapp-modal', '__', platform) }, { children: _jsxs("div", __assign({ className: getClassNames('smartapp-modal__content', '--', platform) }, { children: [title && _jsx("p", __assign({ className: "smartapp-modal__content--title" }, { children: title })), _jsx("div", __assign({ onClick: handleCloseModal, className: "smartapp-modal__content--close-icon" }, { children: _jsx(CloseIcon, { style: { color: getColor(iconColor,
|
|
36
|
+
return (_jsx(Popup, __assign({ className: getClassNames('modal', '-', platform), closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className: getClassNames('smartapp-modal', '__', [theme, platform]) }, { children: _jsxs("div", __assign({ className: getClassNames('smartapp-modal__content', '--', platform) }, { children: [title && _jsx("p", __assign({ className: "smartapp-modal__content--title" }, { children: title })), _jsx("div", __assign({ onClick: handleCloseModal, className: "smartapp-modal__content--close-icon" }, { children: _jsx(CloseIcon, { style: { color: getColor(iconColor, getDefaultColorForCloseIcon(theme)) } }) })), content] })) })) })));
|
|
37
37
|
};
|
|
38
38
|
export default Modal;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
|
|
2
|
+
import { ICommonProps } from '../../constants';
|
|
3
|
+
export interface IModalProps extends ICommonProps {
|
|
3
4
|
isModalOpen: boolean;
|
|
4
5
|
content: ReactElement;
|
|
5
6
|
handleCloseModal: () => void;
|
|
6
7
|
title?: string;
|
|
7
|
-
platform?: 'web' | 'ios' | 'android';
|
|
8
8
|
iconColor?: string;
|
|
9
9
|
backgroundColor?: string;
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
|
|
2
|
+
import { IPlatformProps } from '../../constants';
|
|
3
|
+
export interface INotificationProps extends IPlatformProps {
|
|
3
4
|
isShown: boolean;
|
|
4
5
|
type?: 'success' | 'info' | 'warning' | 'error';
|
|
5
6
|
isAutoHidden?: boolean;
|
|
6
7
|
hideDuration?: number;
|
|
7
|
-
platform?: 'web' | 'ios' | 'android';
|
|
8
8
|
message: string | ReactElement;
|
|
9
9
|
action?: {
|
|
10
10
|
text?: string;
|
|
@@ -14,7 +14,7 @@ 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
16
|
import { getColor } from '../../helpers';
|
|
17
|
-
import {
|
|
17
|
+
import { COLORS } from '../../constants';
|
|
18
18
|
import '../../styles/stories.module.scss';
|
|
19
19
|
var Profile = function (_a) {
|
|
20
20
|
var _b, _c, _d;
|
|
@@ -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: getColor(logoutColor,
|
|
37
|
-
stroke: getColor(addProfileColor,
|
|
38
|
-
color: getColor(addProfileBackgroundColor,
|
|
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, COLORS.blue) } }) }))] })), 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, COLORS.blue),
|
|
38
|
+
color: getColor(addProfileBackgroundColor, COLORS.lighterBlue)
|
|
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;
|
|
@@ -11,14 +11,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { useEffect } from 'react';
|
|
14
|
-
import {
|
|
14
|
+
import { COLORS } from '../../constants';
|
|
15
15
|
import { getColor } from '../../helpers';
|
|
16
16
|
import '../../styles/stories.module.scss';
|
|
17
17
|
var RadioButton = function (_a) {
|
|
18
18
|
var id = _a.id, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = _a.isChecked, isChecked = _c === void 0 ? false : _c, checkedColor = _a.checkedColor, checkedHoverColor = _a.checkedHoverColor, onChange = _a.onChange;
|
|
19
19
|
useEffect(function () {
|
|
20
|
-
document.documentElement.style.setProperty('--radio-button-color', getColor(checkedColor,
|
|
21
|
-
document.documentElement.style.setProperty('--radio-button-hover-color', getColor(checkedHoverColor,
|
|
20
|
+
document.documentElement.style.setProperty('--radio-button-color', getColor(checkedColor, COLORS.blue));
|
|
21
|
+
document.documentElement.style.setProperty('--radio-button-hover-color', getColor(checkedHoverColor, COLORS.darkBlue));
|
|
22
22
|
}, [checkedColor, checkedHoverColor]);
|
|
23
23
|
return (_jsx("div", __assign({ className: "smartapp-radio-button" }, { children: _jsx("label", __assign({ htmlFor: "smartapp-radio-button-".concat(id), onClick: onChange }, { children: _jsx("input", { type: "radio", id: "smartapp-radio-button-".concat(id), checked: isChecked, disabled: isDisabled }) })) })));
|
|
24
24
|
};
|
|
@@ -18,8 +18,9 @@ import Popup from 'reactjs-popup';
|
|
|
18
18
|
import { useSwipeable } from 'react-swipeable';
|
|
19
19
|
import { isEmpty } from 'lodash';
|
|
20
20
|
import { ReactComponent as CloseStoriesIcon } from '../../assets/icons/close-stories.svg';
|
|
21
|
+
import { ReactComponent as LoaderIcon } from '../../assets/icons/story-loader.svg';
|
|
21
22
|
import { STORY_BACKGROUND_TYPES, STORY_TYPE, } from './types';
|
|
22
|
-
import {
|
|
23
|
+
import { COLORS, DEFAULT_FONT_FAMILY, NUMBER_OF_STORIES_FOR_ROUND_INDICATORS, PLATFORM, } from '../../constants';
|
|
23
24
|
import { getColor, isIosPlatform, isWebPlatform } from '../../helpers';
|
|
24
25
|
import '../../styles/stories.module.scss';
|
|
25
26
|
var storyItemBaseStyles = {
|
|
@@ -65,9 +66,14 @@ var StoriesComponent = function (_a) {
|
|
|
65
66
|
var id = _a.id;
|
|
66
67
|
return id === activeStoryId;
|
|
67
68
|
});
|
|
69
|
+
var isColorOnBackground = function (type) { return type === STORY_BACKGROUND_TYPES.color; };
|
|
70
|
+
var isImageOnBackground = function (_a) {
|
|
71
|
+
var type = _a.type;
|
|
72
|
+
return type === STORY_BACKGROUND_TYPES.image;
|
|
73
|
+
};
|
|
68
74
|
var getStoryStyles = function (_a) {
|
|
69
75
|
var type = _a.type, value = _a.value;
|
|
70
|
-
return type
|
|
76
|
+
return isColorOnBackground(type)
|
|
71
77
|
? __assign(__assign({}, storyItemBaseStyles), { background: value }) : __assign(__assign({}, storyItemBaseStyles), { backgroundImage: "url(".concat(value, ")"), backgroundSize: 'cover' });
|
|
72
78
|
};
|
|
73
79
|
var changeActiveGroupStories = function (groupStoriesItem) {
|
|
@@ -127,15 +133,31 @@ var StoriesComponent = function (_a) {
|
|
|
127
133
|
var getImageContent = function (_a) {
|
|
128
134
|
var id = _a.id, title = _a.title, body = _a.body, backgroundSource = _a.backgroundSource, button = _a.button, image = _a.image;
|
|
129
135
|
return ({
|
|
130
|
-
content: function () {
|
|
136
|
+
content: function (_a) {
|
|
137
|
+
var action = _a.action;
|
|
138
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
139
|
+
var _b = useState(false), isImageLoaded = _b[0], setIsImageLoaded = _b[1];
|
|
140
|
+
var isLoaderVisible = image && (!isImageLoaded || isAnimateToLeft || isAnimateToRight);
|
|
131
141
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
132
142
|
useLayoutEffect(function () {
|
|
133
143
|
setActiveStoryId(id);
|
|
134
144
|
}, []);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
146
|
+
useLayoutEffect(function () {
|
|
147
|
+
var timeoutId;
|
|
148
|
+
timeoutId = setTimeout(function () { return action(isLoaderVisible ? 'pause' : 'play'); }, 0);
|
|
149
|
+
return function () { return clearTimeout(timeoutId); };
|
|
150
|
+
}, [isLoaderVisible, action]);
|
|
151
|
+
var handleImageLoad = function () {
|
|
152
|
+
setTimeout(function () {
|
|
153
|
+
action('play');
|
|
154
|
+
setIsImageLoaded(true);
|
|
155
|
+
}, 0);
|
|
156
|
+
};
|
|
157
|
+
return (_jsx("div", __assign({ style: getStoryStyles(backgroundSource) }, { children: _jsxs("div", __assign({ style: { fontFamily: "".concat(fontFamily, ", sans-serif") }, className: classNames('smartapp-stories__story', { 'smartapp-stories__story--image-bg': isImageOnBackground(backgroundSource) }) }, { children: [_jsxs("div", __assign({ style: { opacity: isLoaderVisible ? '0' : '1' } }, { children: [image && (_jsx("div", __assign({ className: "smartapp-stories__story--image" }, { children: _jsx("img", { src: image, alt: "", onLoad: handleImageLoad }) }))), 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: {
|
|
158
|
+
color: getColor(button.textColor, COLORS.black),
|
|
159
|
+
background: getColor(button.backgroundColor, COLORS.white),
|
|
160
|
+
}, className: classNames('smartapp-stories__story--button', "smartapp-stories__story--button__".concat(platform)), onClick: button.action }, { children: button.text })))] })), isLoaderVisible && (_jsx("div", __assign({ className: 'smartapp-stories__story--loader' }, { children: _jsx(LoaderIcon, {}) })))] })) }), id));
|
|
139
161
|
},
|
|
140
162
|
});
|
|
141
163
|
};
|
|
@@ -204,7 +226,7 @@ var StoriesComponent = function (_a) {
|
|
|
204
226
|
if (activeStory.type === STORY_TYPE.image) {
|
|
205
227
|
var _a = activeStory.backgroundSource, type = _a.type, value = _a.value;
|
|
206
228
|
var prevBackgroundVideos = document.querySelectorAll(".smartapp-stories-content__background-video");
|
|
207
|
-
var background = type
|
|
229
|
+
var background = isColorOnBackground(type) ? value : "url(".concat(value, ")");
|
|
208
230
|
!isEmpty(prevBackgroundVideos) && prevBackgroundVideos.forEach(function (video) { return video.remove(); });
|
|
209
231
|
isWebPlatform(platform) && (popupElement === null || popupElement === void 0 ? void 0 : popupElement.style.setProperty('--background', background));
|
|
210
232
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IPlatformProps } from '../../constants';
|
|
1
2
|
export declare enum STORY_BACKGROUND_TYPES {
|
|
2
3
|
color = "color",
|
|
3
4
|
image = "image"
|
|
@@ -6,8 +7,9 @@ export declare enum STORY_TYPE {
|
|
|
6
7
|
image = "image",
|
|
7
8
|
video = "video"
|
|
8
9
|
}
|
|
10
|
+
export type TBackgroundType = 'color' | 'image';
|
|
9
11
|
export type TBackgroundSource = {
|
|
10
|
-
type:
|
|
12
|
+
type: TBackgroundType;
|
|
11
13
|
value: string;
|
|
12
14
|
};
|
|
13
15
|
type TCommonStoryItem = {
|
|
@@ -38,8 +40,7 @@ export type TGroupStories = {
|
|
|
38
40
|
viewed: boolean;
|
|
39
41
|
stories: TStoryItem[];
|
|
40
42
|
};
|
|
41
|
-
export interface IStoriesProps {
|
|
42
|
-
platform?: 'web' | 'ios' | 'android';
|
|
43
|
+
export interface IStoriesProps extends IPlatformProps {
|
|
43
44
|
fontFamily?: string;
|
|
44
45
|
groupStories: TGroupStories | null;
|
|
45
46
|
allGroupsStories: TGroupStories[];
|
|
@@ -24,13 +24,13 @@ import classNames from 'classnames';
|
|
|
24
24
|
import Color from 'color';
|
|
25
25
|
import { normal } from 'color-blend';
|
|
26
26
|
import { ReactComponent as LoaderIcon } from '../../assets/icons/loader.svg';
|
|
27
|
-
import {
|
|
27
|
+
import { COLORS, DEFAULT_FONT_FAMILY, THEME } from '../../constants';
|
|
28
28
|
import { getColor } from '../../helpers';
|
|
29
29
|
import '../../styles/stories.module.scss';
|
|
30
30
|
var SyncLoader = function (_a) {
|
|
31
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
32
|
var isDarkTheme = theme === THEME.dark;
|
|
33
|
-
var loaderColor = getColor(color,
|
|
33
|
+
var loaderColor = getColor(color, COLORS.blue);
|
|
34
34
|
var getBackgroundStyles = function () {
|
|
35
35
|
var _a = Color(loaderColor).rgb().object(), red = _a.r, green = _a.g, blue = _a.b;
|
|
36
36
|
var backgroundColorRGBA = { r: red, g: green, b: blue, a: 0.2 };
|