@pedidopago/ui 1.16.27 → 1.16.29
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,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ModalProps } from './types';
|
|
3
|
-
export declare
|
|
2
|
+
export declare function Modal({ open, left, top, anchorX, anchorY, offsetX, offsetY, hideScrollBar, disableScrollOnOpen, maxWidth, maxHeight, onClose, hideOverlay, blurOverlay, portalNameId, ...rest }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,KAAK,CAAC,EACpB,IAAI,EACJ,IAAa,EACb,GAAY,EACZ,OAAkB,EAClB,OAAkB,EAClB,OAAe,EACf,OAAe,EACf,aAAqB,EACrB,mBAA0B,EAC1B,QAAQ,EACR,SAAS,EACT,OAAO,EACP,WAAW,EACX,WAAW,EACX,YAA4B,EAC5B,GAAG,IAAI,EACR,EAAE,UAAU,2CAwGZ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Modal=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Modal=Modal;var _framerMotion=require("framer-motion"),_react=require("react"),_useDisableBodyScroll=require("../../shared/hooks/useDisableBodyScroll"),_useKeyPress=require("../../shared/hooks/useKeyPress"),_ReactPortal=require("../ReactPortal"),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["open","left","top","anchorX","anchorY","offsetX","offsetY","hideScrollBar","disableScrollOnOpen","maxWidth","maxHeight","onClose","hideOverlay","blurOverlay","portalNameId"];function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}function Modal(_ref){var open=_ref.open,_ref$left=_ref.left,left=void 0===_ref$left?"50vw":_ref$left,_ref$top=_ref.top,top=void 0===_ref$top?"50vh":_ref$top,_ref$anchorX=_ref.anchorX,anchorX=void 0===_ref$anchorX?"center":_ref$anchorX,_ref$anchorY=_ref.anchorY,anchorY=void 0===_ref$anchorY?"center":_ref$anchorY,_ref$offsetX=_ref.offsetX,offsetX=void 0===_ref$offsetX?"0px":_ref$offsetX,_ref$offsetY=_ref.offsetY,offsetY=void 0===_ref$offsetY?"0px":_ref$offsetY,_ref$hideScrollBar=_ref.hideScrollBar,_ref$disableScrollOnO=_ref.disableScrollOnOpen,maxWidth=_ref.maxWidth,maxHeight=_ref.maxHeight,onClose=_ref.onClose,hideOverlay=_ref.hideOverlay,blurOverlay=_ref.blurOverlay,_ref$portalNameId=_ref.portalNameId,portalNameId=void 0===_ref$portalNameId?"portal-root":_ref$portalNameId,rest=_objectWithoutProperties(_ref,_excluded),containerRef=(0,_react.useRef)(null);(0,_useKeyPress.useKeyPress)("Escape",function(){return open&&onClose&&onClose()}),(0,_useDisableBodyScroll.useDisableBodyScroll)(open&&(void 0===_ref$disableScrollOnO||_ref$disableScrollOnO),"modal");var handleResize=function(){open&&onClose&&onClose()};// wee need to close the modal when resizing window to avoid
|
|
2
2
|
// admin messenger navbar problems.
|
|
3
|
-
return(0,_react.useEffect)(function(){return window.addEventListener("resize",handleResize),function(){window.removeEventListener("resize",handleResize)}},[open,onClose]),/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.AnimatePresence,{mode:"wait",children:open&&/*#__PURE__*/(0,_jsxRuntime.jsxs)(_ReactPortal.ReactPortal,{wrapperId:portalNameId,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Overlay,{initial:{opacity:0},exit:{opacity:0},animate:{opacity:blurOverlay?1:.5},transition:{duration:.2},isOpen:open,blur:blurOverlay,onClick:function onClick(){return onClose()},hidden:hideOverlay}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ModalContainer,{ref:containerRef,open:open,maxWidth:"number"==typeof maxWidth?"".concat(maxWidth,"px"):maxWidth,maxHeight:"number"==typeof maxHeight?"".concat(maxHeight,"px"):maxHeight,left:"calc(".concat(left," + ").concat(offsetX,")"),top:"calc(".concat(top," + ").concat(offsetY,")"),anchorTranslate:function(){var percentageX=0,percentageY=0;if("number"==typeof anchorX)percentageX=anchorX;else switch(anchorX){case"left":percentageX=0;break;case"center":percentageX=-50;break;case"right":percentageX=-100;break;default:throw new Error("\"".concat(anchorX,"\" is not a valid horizontal anchor."));}if("number"==typeof anchorY)percentageY=anchorY;else switch(anchorY){case"top":percentageY=0;break;case"center":percentageY=-50;break;case"bottom":percentageY=-100;break;default:throw new Error("\"".concat(anchorY,"\" is not a valid vertical anchor."));}return"translate(".concat(percentageX,"%, ").concat(percentageY,"%)")}(),children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ModalElement,{"data-scroll":"dispatch-scroll",open:open,maxHeight:"number"==typeof maxHeight?"".concat(maxHeight,"px"):maxHeight,hideScrollBar:void 0!==_ref$hideScrollBar&&_ref$hideScrollBar,initial:{scale:.8,opacity:0},exit:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.1},children:rest.children})})]})})}
|
|
3
|
+
return(0,_react.useEffect)(function(){return window.addEventListener("resize",handleResize),function(){window.removeEventListener("resize",handleResize)}},[open,onClose]),/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.AnimatePresence,{mode:"wait",children:open&&/*#__PURE__*/(0,_jsxRuntime.jsxs)(_ReactPortal.ReactPortal,{wrapperId:portalNameId,children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Overlay,{initial:{opacity:0},exit:{opacity:0},animate:{opacity:blurOverlay?1:.5},transition:{duration:.2},isOpen:open,blur:blurOverlay,onClick:function onClick(){return onClose()},hidden:hideOverlay}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ModalContainer,{ref:containerRef,open:open,maxWidth:"number"==typeof maxWidth?"".concat(maxWidth,"px"):maxWidth,maxHeight:"number"==typeof maxHeight?"".concat(maxHeight,"px"):maxHeight,left:"calc(".concat(left," + ").concat(offsetX,")"),top:"calc(".concat(top," + ").concat(offsetY,")"),anchorTranslate:function(){var percentageX=0,percentageY=0;if("number"==typeof anchorX)percentageX=anchorX;else switch(anchorX){case"left":percentageX=0;break;case"center":percentageX=-50;break;case"right":percentageX=-100;break;default:throw new Error("\"".concat(anchorX,"\" is not a valid horizontal anchor."));}if("number"==typeof anchorY)percentageY=anchorY;else switch(anchorY){case"top":percentageY=0;break;case"center":percentageY=-50;break;case"bottom":percentageY=-100;break;default:throw new Error("\"".concat(anchorY,"\" is not a valid vertical anchor."));}return"translate(".concat(percentageX,"%, ").concat(percentageY,"%)")}(),children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ModalElement,{"data-scroll":"dispatch-scroll",open:open,maxHeight:"number"==typeof maxHeight?"".concat(maxHeight,"px"):maxHeight,hideScrollBar:void 0!==_ref$hideScrollBar&&_ref$hideScrollBar,initial:{scale:.8,opacity:0},exit:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.1},children:rest.children})})]})})}
|