@pedidopago/ui 1.16.28 → 1.16.30
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,2CAqFZ"}
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Modal=
|
|
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)(_ReactPortal.ReactPortal,{wrapperId:portalNameId+id,children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.AnimatePresence,{mode:"wait",children:open&&/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{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})})]})})})},Modal=/*#__PURE__*/(0,_react.memo)(ModalComponent);exports.Modal=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 _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}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),_useState=(0,_react.useState)(open),_useState2=_slicedToArray(_useState,2),isOpen=_useState2[0],setIsOpen=_useState2[1],getAnchorTranslate=(0,_react.useCallback)(function(){var getPercentage=function(type,value){if("number"==typeof value)return value;var anchor="x"===type?anchorX:anchorY;if("number"==typeof anchor)return anchor;switch(anchor){case"left":case"top":return 0;case"center":return-50;case"right":case"bottom":return-100;default:throw new Error("Invalid ".concat(type," anchor: ").concat(anchor));}};return"translate(\n ".concat(getPercentage("x",anchorX),"%, \n ").concat(getPercentage("y",anchorY),"%\n )")},[anchorX,anchorY]);(0,_react.useEffect)(function(){return setIsOpen(open)},[open]);var handleClose=(0,_react.useCallback)(function(){return null===onClose||void 0===onClose?void 0:onClose()},[onClose]),handleResize=(0,_react.useCallback)(function(){return isOpen&&(null===onClose||void 0===onClose?void 0:onClose())},[isOpen,onClose]);return(0,_useKeyPress.useKeyPress)("Escape",handleClose),(0,_useDisableBodyScroll.useDisableBodyScroll)(isOpen&&(void 0===_ref$disableScrollOnO||_ref$disableScrollOnO),"modal"),(0,_react.useEffect)(function(){return window.addEventListener("resize",handleResize),function(){return window.removeEventListener("resize",handleResize)}},[handleResize]),/*#__PURE__*/(0,_jsxRuntime.jsx)(_framerMotion.AnimatePresence,{mode:"wait",children:isOpen&&/*#__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:isOpen,blur:blurOverlay,onClick:handleClose,hidden:hideOverlay}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ModalContainer,{ref:containerRef,open:isOpen,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:getAnchorTranslate(),children:/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ModalElement,{"data-scroll":"dispatch-scroll",open:isOpen,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})})]})})}
|