@expressms/smartapp-ui 1.1.6 → 1.1.7
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/constants/constants.d.ts +1 -0
- package/build/main/constants/constants.js +1 -0
- package/build/main/helpers/index.d.ts +2 -1
- package/build/main/helpers/index.js +6 -2
- package/build/main/styles/stories.module.scss +129 -54
- package/build/main/styles/styles.min.css +1 -1
- package/build/main//321/201omponents/ActionModal/ActionModal.d.ts +1 -1
- package/build/main//321/201omponents/ActionModal/ActionModal.js +6 -6
- package/build/main//321/201omponents/ActionModal/types.d.ts +1 -0
- 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 +1 -0
- package/build/main//321/201omponents/Header/Header.js +3 -3
- package/build/main//321/201omponents/Header/types.d.ts +1 -0
- 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 +1 -0
- package/build/main//321/201omponents/Modal/Modal.d.ts +1 -1
- package/build/main//321/201omponents/Modal/Modal.js +4 -4
- package/build/main//321/201omponents/Modal/types.d.ts +1 -0
- package/package.json +3 -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, platform, placeholder, defaultValue, isButtonDisabled, iconColor, buttonWidth, backgroundColor, }: IActionModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const ActionModal: ({ isModalOpen, title, buttonName, confirmButtonFunction, cancelButtonFunction, theme, platform, placeholder, defaultValue, isButtonDisabled, iconColor, buttonWidth, backgroundColor, }: IActionModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default ActionModal;
|
|
@@ -12,17 +12,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useEffect, useRef, useState } from 'react';
|
|
14
14
|
import Popup from 'reactjs-popup';
|
|
15
|
-
import { ReactComponent as
|
|
15
|
+
import { ReactComponent as CloseIcon } from '../../assets/icons/cancel-cross.svg';
|
|
16
16
|
import Button from '../Button';
|
|
17
17
|
import Input from '../Input';
|
|
18
18
|
import { TButtonColor, TButtonType } from '../Button/types';
|
|
19
|
-
import { getClassNames, getColor, isMobilePlatform } from '../../helpers';
|
|
20
|
-
import {
|
|
19
|
+
import { getClassNames, getColor, getDefaultColorForCloseIcon, isMobilePlatform } from '../../helpers';
|
|
20
|
+
import { DEFAULT_POPUP_BACKGROUND_COLOR, PLATFORM, THEME } 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, _b = _a.platform, platform =
|
|
23
|
+
var isModalOpen = _a.isModalOpen, title = _a.title, buttonName = _a.buttonName, confirmButtonFunction = _a.confirmButtonFunction, cancelButtonFunction = _a.cancelButtonFunction, _b = _a.theme, theme = _b === void 0 ? THEME.default : _b, _c = _a.platform, platform = _c === void 0 ? PLATFORM.web : _c, placeholder = _a.placeholder, _d = _a.defaultValue, defaultValue = _d === void 0 ? '' : _d, isButtonDisabled = _a.isButtonDisabled, iconColor = _a.iconColor, _e = _a.buttonWidth, buttonWidth = _e === void 0 ? 100 : _e, backgroundColor = _a.backgroundColor;
|
|
24
24
|
var ref = useRef(null);
|
|
25
|
-
var
|
|
25
|
+
var _f = useState(defaultValue), value = _f[0], setValue = _f[1];
|
|
26
26
|
var onConfirmClick = function () {
|
|
27
27
|
confirmButtonFunction(value);
|
|
28
28
|
setValue('');
|
|
@@ -49,6 +49,6 @@ var ActionModal = function (_a) {
|
|
|
49
49
|
var onChange = function (value) {
|
|
50
50
|
setValue(value);
|
|
51
51
|
};
|
|
52
|
-
return (_jsx(Popup, __assign({ className: getClassNames('action-modal', '-', platform), closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className: getClassNames('smartapp-action-modal', '__', platform) }, { children: _jsxs("div", __assign({ className: getClassNames('smartapp-action-modal__content', '--', platform) }, { children: [_jsx("p", __assign({ className: getClassNames('smartapp-action-modal__content--title', '__', platform) }, { children: title })), _jsx("div", __assign({ onClick: onCloseModal, className: "smartapp-action-modal__content--cancel-cross" }, { children: _jsx(
|
|
52
|
+
return (_jsx(Popup, __assign({ className: getClassNames('action-modal', '-', platform), closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className: getClassNames('smartapp-action-modal', '__', [theme, platform]) }, { children: _jsxs("div", __assign({ className: getClassNames('smartapp-action-modal__content', '--', platform) }, { children: [_jsx("p", __assign({ className: getClassNames('smartapp-action-modal__content--title', '__', platform) }, { children: title })), _jsx("div", __assign({ onClick: onCloseModal, className: "smartapp-action-modal__content--cancel-cross" }, { children: _jsx(CloseIcon, { style: { color: getColor(iconColor, getDefaultColorForCloseIcon(theme)) } }) })), _jsx("div", __assign({ className: "smartapp-action-modal__content--input" }, { children: _jsx(Input, { theme: theme, defaultValue: value, placeholder: placeholder, onChange: onChange }) })), isMobilePlatform(platform) && _jsx("div", { className: "smartapp-action-modal__content--delimiter" }), _jsx("div", __assign({ className: "smartapp-action-modal__content--buttons" }, { children: _jsx(Button, { theme: theme, width: buttonWidth, isDisabled: isButtonDisabled, title: buttonName, typeButton: TButtonType.standard, color: TButtonColor.blue, onClickFunction: onConfirmClick }) }))] })) })) })));
|
|
53
53
|
};
|
|
54
54
|
export default ActionModal;
|
|
@@ -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;
|
|
@@ -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 { DEFAULT_BLACK_ICON_COLOR, DEFAULT_HEADER_BACKGROUND_COLOR, DEFAULT_HEADER_TEXT_COLOR, DEFAULT_RED_ICON_COLOR, FONT_SIZE, LINE_HEIGHT, PLATFORM, } from '../../constants';
|
|
18
|
+
import { DEFAULT_BLACK_ICON_COLOR, DEFAULT_GRAY_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) {
|
|
21
21
|
var _b;
|
|
@@ -28,8 +28,8 @@ var Header = function (_a) {
|
|
|
28
28
|
background: getColor(backgroundColor, DEFAULT_HEADER_BACKGROUND_COLOR),
|
|
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, DEFAULT_GRAY_ICON_COLOR) }, onClick: !isEnabled ? onClick : function () { } }));
|
|
33
33
|
};
|
|
34
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), customIcon] }))] })));
|
|
35
35
|
};
|
|
@@ -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 { 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,11 +13,11 @@ 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 { DEFAULT_POPUP_BACKGROUND_COLOR, 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
23
|
document.documentElement.style.setProperty('--modal-background', getColor(backgroundColor, DEFAULT_POPUP_BACKGROUND_COLOR));
|
|
@@ -33,6 +33,6 @@ var Modal = function (_a) {
|
|
|
33
33
|
document === null || document === void 0 ? void 0 : document.removeEventListener('click', 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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressms/smartapp-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "SmartApp UI library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/main/index.js",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"@storybook/addon-essentials": "^6.5.15",
|
|
17
17
|
"@storybook/addon-links": "^6.5.15",
|
|
18
18
|
"@storybook/addon-viewport": "^6.5.15",
|
|
19
|
+
"@storybook/addons": "^6.5.15",
|
|
20
|
+
"@storybook/core-events": "^6.5.15",
|
|
19
21
|
"@storybook/preset-scss": "^1.0.3",
|
|
20
22
|
"@storybook/react": "^6.5.15",
|
|
21
23
|
"@svgr/webpack": "5.5",
|