@expressms/smartapp-ui 1.1.2 → 1.1.3

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.
@@ -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, }: IActionModalProps) => import("react/jsx-runtime").JSX.Element;
3
+ declare const ActionModal: ({ isModalOpen, title, buttonName, confirmButtonFunction, cancelButtonFunction, placeholder, defaultValue, iconColor, buttonWidth, backgroundColor, }: IActionModalProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export default ActionModal;
@@ -20,13 +20,17 @@ 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, _c = _a.buttonWidth, buttonWidth = _c === void 0 ? 100 : _c;
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, backgroundColor = _a.backgroundColor;
24
24
  var _d = useState(defaultValue), value = _d[0], setValue = _d[1];
25
25
  var ref = useRef();
26
+ var onCloseModal = function () {
27
+ setValue('');
28
+ cancelButtonFunction();
29
+ };
26
30
  useEffect(function () {
27
31
  var checkIfClickedOutside = function (e) {
28
32
  if (isModalOpen && ref.current && !ref.current.contains(e.target)) {
29
- cancelButtonFunction();
33
+ onCloseModal();
30
34
  }
31
35
  };
32
36
  document === null || document === void 0 ? void 0 : document.addEventListener('click', checkIfClickedOutside, true);
@@ -37,6 +41,6 @@ var ActionModal = function (_a) {
37
41
  var onChange = function (value) {
38
42
  setValue(value);
39
43
  };
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); } }) }))] })) })) })));
44
+ 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: 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 }) })), _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
45
  };
42
46
  export default ActionModal;
@@ -3,10 +3,11 @@ export interface IActionModalProps {
3
3
  isModalOpen: boolean;
4
4
  title: string;
5
5
  buttonName: string;
6
- confirmButtonFunction: (str?: string) => void;
6
+ confirmButtonFunction: (str: string) => void;
7
7
  cancelButtonFunction: () => void;
8
8
  placeholder?: string;
9
9
  defaultValue?: string;
10
10
  iconColor?: string;
11
11
  buttonWidth?: IntRange<1, 101>;
12
+ backgroundColor?: string;
12
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expressms/smartapp-ui",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "SmartApp UI library",
5
5
  "license": "MIT",
6
6
  "main": "build/main/index.js",