hrm_ui_lib 3.1.91 → 3.1.93

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.
@@ -18,6 +18,7 @@ import { ModalContent } from './ModalContent';
18
18
  import { useIsMobile } from '../../hooks/useGetIsMobile';
19
19
  import classNames from 'classnames';
20
20
  import { useEscapeKey } from '../../hooks/useEscapeKey';
21
+ import { createPortal } from 'react-dom';
21
22
  export const Modal = (_a) => {
22
23
  var { isOpen, onClose, className = '', size = 'medium', closeOnOutsideClick = true, isMobileFullScreen } = _a, rest = __rest(_a, ["isOpen", "onClose", "className", "size", "closeOnOutsideClick", "isMobileFullScreen"]);
23
24
  const isMobile = useIsMobile();
@@ -33,8 +34,8 @@ export const Modal = (_a) => {
33
34
  if (!shouldRender) {
34
35
  return null;
35
36
  }
36
- return (_jsx("div", { className: classnames('modal', `modal--${size}`, `modal--${animationState}`, className), children: _jsx("div", { className: classNames('modal__container', `modal__container--${animationState}`, {
37
+ return createPortal(_jsx("div", { className: classnames('modal', `modal--${size}`, `modal--${animationState}`, className), children: _jsx("div", { className: classNames('modal__container', `modal__container--${animationState}`, {
37
38
  modal__container_fullScreen: isMobile && isMobileFullScreen,
38
39
  [`modal__container_fullScreen--${animationState}`]: isMobile && isMobileFullScreen
39
- }), ref: setContainerRef, children: _jsx(ModalContent, Object.assign({}, rest, { onClose: onClose })) }) }));
40
+ }), ref: setContainerRef, children: _jsx(ModalContent, Object.assign({}, rest, { onClose: onClose })) }) }), document.body);
40
41
  };
@@ -6,6 +6,7 @@ import { useAnimation } from '../../hooks/useAnimation';
6
6
  import { Button } from '../Button';
7
7
  import { Text } from '../Text';
8
8
  import { useEscapeKey } from '../../hooks/useEscapeKey';
9
+ import { createPortal } from 'react-dom';
9
10
  export const ModalConfirmation = ({ isOpen, onClose, onSubmit, title, className = '', size = 'small', buttonProps, dataIdPrefix, closeOnOutsideClick = true, iconProps, subtitle }) => {
10
11
  const { animationState, shouldRender } = useAnimation({
11
12
  isOpen,
@@ -19,5 +20,5 @@ export const ModalConfirmation = ({ isOpen, onClose, onSubmit, title, className
19
20
  if (!shouldRender) {
20
21
  return null;
21
22
  }
22
- return (_jsx("div", { className: classnames('modal modal--confirmation', `modal--${size}`, `modal--${animationState}`, className), children: _jsx("div", { className: classnames('modal__container', 'text-center', `modal__container--${animationState}`), ref: setContainerRef, children: _jsxs("div", { className: 'modal__content', children: [(iconProps === null || iconProps === void 0 ? void 0 : iconProps.Component) ? (_jsx("div", { className: "modal__icon mb-32", children: _jsx(iconProps.Component, { size: 'xlarge' }) })) : null, title ? (_jsx(Text, { weight: "bolder", lineHeight: "large", size: "large", dataId: dataIdPrefix ? `${dataIdPrefix}-modal-title` : '', children: title })) : null, subtitle ? _jsx(Text, { className: 'mt-12', children: subtitle }) : null, buttonProps ? (_jsxs("div", { className: "modal__footer mt-32", children: [_jsx(Button, Object.assign({ type: "secondary", className: "modal__footer__btn mr-16", onClick: onClose, dataId: dataIdPrefix ? `${dataIdPrefix}-modal-cancel-button` : '' }, (buttonProps.cancel || {}))), _jsx(Button, Object.assign({ type: "danger", className: 'modal__footer__btn', onClick: onSubmit, dataId: dataIdPrefix ? `${dataIdPrefix}-modal-confirm-button` : '' }, buttonProps.confirm))] })) : null] }) }) }));
23
+ return createPortal(_jsx("div", { className: classnames('modal modal--confirmation', `modal--${size}`, `modal--${animationState}`, className), children: _jsx("div", { className: classnames('modal__container', 'text-center', `modal__container--${animationState}`), ref: setContainerRef, children: _jsxs("div", { className: 'modal__content', children: [(iconProps === null || iconProps === void 0 ? void 0 : iconProps.Component) ? (_jsx("div", { className: "modal__icon mb-32", children: _jsx(iconProps.Component, { size: 'xlarge' }) })) : null, title ? (_jsx(Text, { weight: "bolder", lineHeight: "large", size: "large", dataId: dataIdPrefix ? `${dataIdPrefix}-modal-title` : '', children: title })) : null, subtitle ? _jsx(Text, { className: 'mt-12', children: subtitle }) : null, buttonProps ? (_jsxs("div", { className: "modal__footer mt-32", children: [_jsx(Button, Object.assign({ type: "secondary", className: "modal__footer__btn mr-16", onClick: onClose, dataId: dataIdPrefix ? `${dataIdPrefix}-modal-cancel-button` : '' }, (buttonProps.cancel || {}))), _jsx(Button, Object.assign({ type: "danger", className: 'modal__footer__btn', onClick: onSubmit, dataId: dataIdPrefix ? `${dataIdPrefix}-modal-confirm-button` : '' }, buttonProps.confirm))] })) : null] }) }) }), document.body);
23
24
  };
@@ -13,11 +13,10 @@ export const MobileTopContent = ({ onBack, setSearchValue, searchValue, withSear
13
13
  setSearchValue('');
14
14
  };
15
15
  useEffect(() => {
16
- console.log(isOpen);
17
- if (isOpen && inputRef && inputRef.current) {
16
+ if (inputRef && inputRef.current) {
18
17
  inputRef.current.focus();
19
18
  }
20
- }, [inputRef.current, isOpen]);
19
+ }, [inputRef.current]);
21
20
  return (_jsxs("div", { className: "flexbox mobile_top_content", children: [_jsx(IconChevronLeft, { onClick: onBack, size: "large" }), withSearch && (_jsx(Input, { currentValue: searchValue, handleChange: onSearch, className: "ml-8", size: "small", ref: inputRef, rightIconProps: {
22
21
  Component: searchValue ? IconDismissFilled : IconSearchFilled,
23
22
  size: searchValue ? 'xsmall' : 'small',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hrm_ui_lib",
3
- "version": "3.1.91",
3
+ "version": "3.1.93",
4
4
  "description": "UI library for Dino",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",