@expressms/smartapp-ui 1.1.3 → 1.1.4
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/constants/constants.d.ts +1 -0
- package/build/main/constants/constants.js +1 -0
- package/build/main/helpers/index.d.ts +2 -0
- package/build/main/helpers/index.js +3 -0
- package/build/main/styles/stories.module.scss +124 -45
- 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 +14 -6
- package/build/main//321/201omponents/ActionModal/types.d.ts +2 -0
- package/build/main//321/201omponents/ConfirmationModal/ConfirmationModal.d.ts +1 -1
- package/build/main//321/201omponents/ConfirmationModal/ConfirmationModal.js +8 -3
- package/build/main//321/201omponents/ConfirmationModal/types.d.ts +4 -2
- package/package.json +1 -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, buttonWidth, backgroundColor, }: IActionModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const ActionModal: ({ isModalOpen, title, buttonName, confirmButtonFunction, cancelButtonFunction, platform, placeholder, defaultValue, isButtonDisabled, iconColor, buttonWidth, backgroundColor, }: IActionModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default ActionModal;
|
|
@@ -16,17 +16,24 @@ 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 { getColor } from '../../helpers';
|
|
20
|
-
import { DEFAULT_GRAY_ICON_COLOR } from '../../constants';
|
|
19
|
+
import { getClassNames, getColor, isMobilePlatform } from '../../helpers';
|
|
20
|
+
import { DEFAULT_GRAY_ICON_COLOR, DEFAULT_POPUP_BACKGROUND_COLOR, PLATFORM } 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,
|
|
24
|
-
var
|
|
25
|
-
var
|
|
23
|
+
var isModalOpen = _a.isModalOpen, title = _a.title, buttonName = _a.buttonName, confirmButtonFunction = _a.confirmButtonFunction, cancelButtonFunction = _a.cancelButtonFunction, _b = _a.platform, platform = _b === void 0 ? PLATFORM.web : _b, placeholder = _a.placeholder, _c = _a.defaultValue, defaultValue = _c === void 0 ? '' : _c, isButtonDisabled = _a.isButtonDisabled, iconColor = _a.iconColor, _d = _a.buttonWidth, buttonWidth = _d === void 0 ? 100 : _d, backgroundColor = _a.backgroundColor;
|
|
24
|
+
var ref = useRef(null);
|
|
25
|
+
var _e = useState(defaultValue), value = _e[0], setValue = _e[1];
|
|
26
|
+
var onConfirmClick = function () {
|
|
27
|
+
confirmButtonFunction(value);
|
|
28
|
+
setValue('');
|
|
29
|
+
};
|
|
26
30
|
var onCloseModal = function () {
|
|
27
31
|
setValue('');
|
|
28
32
|
cancelButtonFunction();
|
|
29
33
|
};
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
document.documentElement.style.setProperty('--action-modal-background', getColor(backgroundColor, DEFAULT_POPUP_BACKGROUND_COLOR));
|
|
36
|
+
}, [backgroundColor]);
|
|
30
37
|
useEffect(function () {
|
|
31
38
|
var checkIfClickedOutside = function (e) {
|
|
32
39
|
if (isModalOpen && ref.current && !ref.current.contains(e.target)) {
|
|
@@ -37,10 +44,11 @@ var ActionModal = function (_a) {
|
|
|
37
44
|
return function () {
|
|
38
45
|
document === null || document === void 0 ? void 0 : document.removeEventListener('click', checkIfClickedOutside, true);
|
|
39
46
|
};
|
|
47
|
+
// eslint-disable-next-line
|
|
40
48
|
}, [isModalOpen, cancelButtonFunction]);
|
|
41
49
|
var onChange = function (value) {
|
|
42
50
|
setValue(value);
|
|
43
51
|
};
|
|
44
|
-
return (_jsx(Popup, __assign({ closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className:
|
|
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(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 }) })), isMobilePlatform(platform) && _jsx("div", { className: "smartapp-action-modal__content--delimiter" }), _jsx("div", __assign({ className: "smartapp-action-modal__content--buttons" }, { children: _jsx(Button, { width: buttonWidth, isDisabled: isButtonDisabled, title: buttonName, typeButton: TButtonType.standard, color: TButtonColor.blue, onClickFunction: onConfirmClick }) }))] })) })) })));
|
|
45
53
|
};
|
|
46
54
|
export default ActionModal;
|
|
@@ -5,8 +5,10 @@ export interface IActionModalProps {
|
|
|
5
5
|
buttonName: string;
|
|
6
6
|
confirmButtonFunction: (str: string) => void;
|
|
7
7
|
cancelButtonFunction: () => void;
|
|
8
|
+
platform?: 'web' | 'ios' | 'android';
|
|
8
9
|
placeholder?: string;
|
|
9
10
|
defaultValue?: string;
|
|
11
|
+
isButtonDisabled?: boolean;
|
|
10
12
|
iconColor?: string;
|
|
11
13
|
buttonWidth?: IntRange<1, 101>;
|
|
12
14
|
backgroundColor?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IConfirmationModalProps } from './types';
|
|
2
2
|
import '../../styles/stories.module.scss';
|
|
3
|
-
declare const ConfirmationModal: ({ title, text, cancelButtonName, confirmButtonName, cancelButtonFunction, confirmButtonFunction,
|
|
3
|
+
declare const ConfirmationModal: ({ isModalOpen, title, text, cancelButtonName, confirmButtonName, cancelButtonFunction, confirmButtonFunction, platform, backgroundColor, }: IConfirmationModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default ConfirmationModal;
|
|
@@ -14,10 +14,15 @@ 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 { DEFAULT_POPUP_BACKGROUND_COLOR, PLATFORM } from '../../constants';
|
|
18
|
+
import { getClassNames, getColor, isMobilePlatform } from '../../helpers';
|
|
17
19
|
import '../../styles/stories.module.scss';
|
|
18
20
|
var ConfirmationModal = function (_a) {
|
|
19
|
-
var title = _a.title, text = _a.text, cancelButtonName = _a.cancelButtonName, confirmButtonName = _a.confirmButtonName, cancelButtonFunction = _a.cancelButtonFunction, confirmButtonFunction = _a.confirmButtonFunction,
|
|
20
|
-
var ref = useRef();
|
|
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
|
+
var ref = useRef(null);
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
document.documentElement.style.setProperty('--confirmation-modal-background', getColor(backgroundColor, DEFAULT_POPUP_BACKGROUND_COLOR));
|
|
25
|
+
}, [backgroundColor]);
|
|
21
26
|
useEffect(function () {
|
|
22
27
|
var checkIfClickedOutside = function (e) {
|
|
23
28
|
if (isModalOpen && ref.current && !ref.current.contains(e.target)) {
|
|
@@ -29,6 +34,6 @@ var ConfirmationModal = function (_a) {
|
|
|
29
34
|
document === null || document === void 0 ? void 0 : document.removeEventListener('click', checkIfClickedOutside, true);
|
|
30
35
|
};
|
|
31
36
|
}, [isModalOpen, cancelButtonFunction]);
|
|
32
|
-
return (_jsx(Popup, __assign({ closeOnDocumentClick: true, modal: true, open: isModalOpen }, { children: _jsx("div", __assign({ ref: ref, className:
|
|
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 })] }))] })) })) })));
|
|
33
38
|
};
|
|
34
39
|
export default ConfirmationModal;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export interface IConfirmationModalProps {
|
|
2
|
-
|
|
2
|
+
isModalOpen: boolean;
|
|
3
|
+
title?: string;
|
|
3
4
|
text: string;
|
|
4
5
|
cancelButtonName: string;
|
|
5
6
|
confirmButtonName: string;
|
|
6
7
|
cancelButtonFunction: () => void;
|
|
7
8
|
confirmButtonFunction: (option?: any) => void;
|
|
8
|
-
|
|
9
|
+
platform?: 'web' | 'ios' | 'android';
|
|
10
|
+
backgroundColor?: string;
|
|
9
11
|
}
|