{"version":3,"file":"Modal_Trigger.DgTD5PyT.mjs","names":["useState","useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/3eb2pqX0GGhzvB4zzWMw/saj88vcTYDaySRfLNpGm/Ssq4OBf9E.js","https:/framerusercontent.com/modules/gzlOp32jiotI41qoKAWR/ywWcjLixWUOKtCQdWR5F/Modal_Trigger.js"],"sourcesContent":["// Generated by Framer (dd59b2c)\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,cx,motion,useSVGTemplate,withCSS}from\"framer\";import*as React from\"react\";import{forwardRef}from\"react\";const mask=\"var(--framer-icon-mask)\";const Base=/*#__PURE__*/forwardRef(function(props,ref){return /*#__PURE__*/_jsx(\"svg\",{...props,ref:ref,children:props.children});});const MotionSVG=motion.create(Base);const SVG=/*#__PURE__*/forwardRef((props,ref)=>{const{animated,layoutId,children,...rest}=props;return animated?/*#__PURE__*/_jsx(MotionSVG,{...rest,layoutId:layoutId,ref:ref,children:children}):/*#__PURE__*/_jsx(\"svg\",{...rest,ref:ref,children:children});});const svg='<svg display=\"block\" role=\"presentation\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 0 0 L 10 14 M 10 0 L 0 14\" fill=\"transparent\" height=\"14px\" id=\"Qi8Lp_NLO\" stroke-dasharray=\"\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"var(--1ww558a, 2)\" stroke=\"var(--4rxgx6, black)\" transform=\"translate(7 5)\" width=\"10px\"/></svg>';const getProps=({color,height,id,width,width1,...props})=>{return{...props,CRY1Fpez4:color??props.CRY1Fpez4??\"rgb(0, 0, 0)\",vet7gqNu_:width1??props.vet7gqNu_??2};};const Component=/*#__PURE__*/React.forwardRef(function(props,ref){const{style,className,layoutId,variant,CRY1Fpez4,vet7gqNu_,...restProps}=getProps(props);const href=useSVGTemplate(\"2502894650\",svg);return /*#__PURE__*/_jsx(SVG,{...restProps,className:cx(\"framer-hM6J5\",className),layoutId:layoutId,ref:ref,role:\"presentation\",style:{\"--1ww558a\":vet7gqNu_,\"--4rxgx6\":CRY1Fpez4,...style},viewBox:\"0 0 24 24\",children:/*#__PURE__*/_jsx(\"use\",{href:href})});});const css=[`.framer-hM6J5 { -webkit-mask: ${mask}; aspect-ratio: 1; display: block; mask: ${mask}; width: 24px; }`];/**\n * This is a generated Framer component.\n * @framerIntrinsicWidth 24\n * @framerIntrinsicHeight 24\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerVariables {\"CRY1Fpez4\":\"color\",\"vet7gqNu_\":\"width1\"}\n * @framerImmutableVariables true\n * @framerVector {\"name\":\"Alphabet X\",\"color\":{\"type\":\"variable\",\"value\":\"4rxgx6\"},\"set\":{\"localId\":\"vectorSet/dSZJyzeMx\",\"id\":\"dSZJyzeMx\",\"moduleId\":\"E1vFg1A6wcWAGuFi9Hz1\"}}\n */const Icon=withCSS(Component,css,\"framer-hM6J5\");Icon.displayName=\"Alphabet X\";export default Icon;addPropertyControls(Icon,{CRY1Fpez4:{defaultValue:\"rgb(0, 0, 0)\",hidden:false,title:\"Color\",type:ControlType.Color},vet7gqNu_:{defaultValue:2,displayStepper:true,hidden:false,max:4,min:1,title:\"Width\",type:ControlType.Number}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Icon\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"24\",\"framerVariables\":\"{\\\"CRY1Fpez4\\\":\\\"color\\\",\\\"vet7gqNu_\\\":\\\"width1\\\"}\",\"framerIntrinsicHeight\":\"24\",\"framerContractVersion\":\"1\",\"framerVector\":\"{\\\"name\\\":\\\"Alphabet X\\\",\\\"color\\\":{\\\"type\\\":\\\"variable\\\",\\\"value\\\":\\\"4rxgx6\\\"},\\\"set\\\":{\\\"localId\\\":\\\"vectorSet/dSZJyzeMx\\\",\\\"id\\\":\\\"dSZJyzeMx\\\",\\\"moduleId\\\":\\\"E1vFg1A6wcWAGuFi9Hz1\\\"}}\",\"framerImmutableVariables\":\"true\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{useCallback,useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerIntrinsicHeight 0\n * @framerIntrinsicWidth 0\n */export default function ModalTrigger({showOnMouseLeave,delayConfig,scrollConfig}){const[hasBeenTriggered,setHasBeenTriggered]=useState(false);const triggerRef=useRef(null);// Event listeners added in the effect call don't have access to state\n// updates, so we'll use a ref and set both ref.current and state\n// in _setHasBeenTriggered.\nconst stateRef=useRef(hasBeenTriggered);const _setHasBeenTriggered=newState=>{stateRef.current=newState;setHasBeenTriggered(newState);};const showModal=useCallback(node=>{if(stateRef.current)return;simulateClick(node);_setHasBeenTriggered(true);},[]);const triggerOnMouseOut=useCallback(node=>e=>{// You can remove conditions if you'd prefer that the pop-up isn't\n    // triggered by the mouse leaving certain edges of the viewport.\n    if(// Top\n    e.clientY<=0||// Left\n    e.clientX<=0||// Right\n    e.clientX>=window.innerWidth||// Bottom\n    e.clientY>=window.innerHeight){showModal(node);}},[showModal]);// Listen for mouse leaving the viewport if showOnMouseLeave is true\nuseEffect(()=>{const triggerNode=triggerRef.current;if(triggerNode){if(showOnMouseLeave){window.addEventListener(\"mouseout\",triggerOnMouseOut(triggerNode));return()=>window.removeEventListener(\"mouseout\",triggerOnMouseOut(triggerNode));}}return;},[triggerOnMouseOut,showOnMouseLeave,showModal]);// Initialize a timer if showOnDelay is true\nuseEffect(()=>{const triggerNode=triggerRef.current;if(triggerNode){if(delayConfig.showOnDelay){const delay=setTimeout(()=>showModal(triggerNode),delayConfig.delaySeconds*1e3);return()=>clearTimeout(delay);}}return;},[delayConfig.showOnDelay,delayConfig.delaySeconds,showModal]);// Listen for clicks on the button and disable our triggers\n// if the button has been clicked\nuseEffect(()=>{const triggerNode=triggerRef.current;if(triggerNode){var _triggerNode_parentElement;const preventTriggers=()=>_setHasBeenTriggered(true);const button=(_triggerNode_parentElement=triggerNode.parentElement)===null||_triggerNode_parentElement===void 0?void 0:_triggerNode_parentElement.parentElement;if(button){button.addEventListener(\"keyup\",preventTriggers);button.addEventListener(\"mouseup\",preventTriggers);return()=>{window.removeEventListener(\"keyup\",preventTriggers);window.removeEventListener(\"mouseup\",preventTriggers);};}}return;},[]);// Listen for scroll if showOnScrollToPercentage is true\nuseEffect(()=>{if(scrollConfig.showOnScrollToPercentage){const initialYCoordBottomOfViewport=window.scrollY+window.innerHeight;const triggerNode=triggerRef.current;const body=document.querySelector(\"body\");if(triggerNode&&body){const scrollListener=()=>{const scrollPositionOfBottomOfViewport=window.scrollY+window.innerHeight;const triggerPoint=body.scrollHeight*scrollConfig.scrollPercentage/100;if(scrollPositionOfBottomOfViewport>=triggerPoint&&// Don't trigger if the user started below the trigger point\n// (this could happen after a refresh)\ninitialYCoordBottomOfViewport<triggerPoint){showModal(triggerNode);}};window.addEventListener(\"scroll\",scrollListener);return()=>window.removeEventListener(\"scroll\",scrollListener);}}return;},[scrollConfig.showOnScrollToPercentage,scrollConfig.scrollPercentage,showModal]);// It would be nice to aria-hide the container that Framer\n// wraps this in, but that would only be possible on the canvas\n// and it's not!\nreturn /*#__PURE__*/_jsx(\"div\",{ref:triggerRef,\"aria-hidden\":\"true\"});}// If this component breaks, it could be because Framer has decided to not wrap\n// code components in containers anymore. If that's the case, access\n// node.parentElement instead of node.parentElement.parentElement\nconst simulateClick=node=>{var _node_parentElement;if((_node_parentElement=node.parentElement)===null||_node_parentElement===void 0?void 0:_node_parentElement.parentElement){const button=node.parentElement.parentElement;button.dispatchEvent(new FocusEvent(\"focus\"));button.dispatchEvent(new KeyboardEvent(\"keydown\",{key:\"Enter\"}));button.dispatchEvent(new KeyboardEvent(\"keyup\",{key:\"Enter\"}));}};addPropertyControls(ModalTrigger,{showOnMouseLeave:{type:ControlType.Boolean,title:\"MouseLeave\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},delayConfig:{type:ControlType.Object,title:\"Delay\",buttonTitle:\"Configure\",controls:{showOnDelay:{type:ControlType.Boolean,title:\"Trigger\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},delaySeconds:{type:ControlType.Number,title:\"Seconds\",defaultValue:10,min:0,max:300,step:5,displayStepper:true,unit:\" s\"}}},scrollConfig:{type:ControlType.Object,title:\"Scroll\",buttonTitle:\"Configure\",controls:{showOnScrollToPercentage:{type:ControlType.Boolean,title:\"Trigger\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},scrollPercentage:{type:ControlType.Number,title:\"Scroll %\",defaultValue:50,min:0,max:100,step:1,displayStepper:true,unit:\" %\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ModalTrigger\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"0\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"0\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Modal_Trigger.map"],"mappings":"sTAC2C,IAAqF,IAA4B,CAAoC,EAAK,0BAAgC,EAAkB,EAAW,SAAS,EAAM,EAAI,CAAC,OAAoB,EAAK,MAAM,CAAC,GAAG,EAAU,MAAI,SAAS,EAAM,SAAS,CAAC,EAAG,CAAO,EAAU,EAAO,OAAO,EAAK,CAAO,EAAiB,GAAY,EAAM,IAAM,CAAC,GAAK,CAAC,WAAS,WAAS,WAAS,GAAG,GAAM,EAAM,OAAO,EAAsB,EAAK,EAAU,CAAC,GAAG,EAAc,WAAa,MAAa,WAAS,CAAC,CAAc,EAAK,MAAM,CAAC,GAAG,EAAS,MAAa,WAAS,CAAC,EAAG,CAAO,EAAI,0WAAgX,GAAU,CAAC,QAAM,SAAO,KAAG,QAAM,SAAO,GAAG,MAAgB,CAAC,GAA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