{"version":3,"file":"Examples.DbF1M4Wl.mjs","names":[],"sources":["https:/framerusercontent.com/modules/vxXrLJ8zsN3XxRxBmdwp/xkazwI15tnmToJHDs3ZI/Examples.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";import{useEffect,useState}from\"react\";import{useSpring}from\"framer-motion\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";// Learn more: https://www.framer.com/developers/overrides/\nconst useStore=createStore({background:\"#0099FF\"});export function withRotate(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{rotate:90},transition:{duration:2}});});}export function withHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:{scale:1.05}});});}export function withRandomColor(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{background:store.background},onClick:()=>{setStore({background:randomColor()});}});});}export function textBadge(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[hasText,setHasText]=useState(false);useEffect(()=>{if(!ref?.current)return;const p=ref.current.querySelector(\"p\");setHasText(Boolean(p?.textContent?.trim()));});return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:hasText?{backgroundColor:\"rgba(255, 255, 255, 0.1)\",padding:\"7px 10px\",borderRadius:\"20px\"}:{backgroundColor:\"transparent\",padding:0,borderRadius:0}});});}export function with3DTilt(Component,{maxTilt=15,perspective=1e3}={}){return /*#__PURE__*/forwardRef((props,ref)=>{const rotateX=useSpring(0,{stiffness:150,damping:20});const rotateY=useSpring(0,{stiffness:150,damping:20});function handleMouseMove(e){const rect=e.currentTarget.getBoundingClientRect();const x=e.clientX-rect.left;const y=e.clientY-rect.top;const centerX=rect.width/2;const centerY=rect.height/2;rotateX.set((y-centerY)/centerY*-maxTilt);rotateY.set((x-centerX)/centerX*maxTilt);}function handleMouseLeave(){rotateX.set(0);rotateY.set(0);}return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onMouseMove:handleMouseMove,onMouseLeave:handleMouseLeave,/* IMPORTANT */whileHover:{},style:{...props.style||{},rotateX,rotateY,transformStyle:\"preserve-3d\",transformPerspective:perspective}});});}export function withTriangleMask(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:{...props.style||{},/* Required */overflow:\"hidden\",/* Top-down inverted triangle */clipPath:\"polygon(0 0, 100% 0, 50% 100%)\"}});});}// 1. Create a \"store\" to hold the word count\nconst useStore2=createStore({wordCount:0});// 2. Apply this to the invisible Body Text layer\nexport function getCMSContent(Component){return props=>{const text=props.text||\"\";// Count words whenever the text changes\nconst count=text.split(/\\s+/).filter(w=>w.length>0).length;useStore2.set({wordCount:count});return /*#__PURE__*/_jsx(Component,{...props});};}// 3. Apply this to the layer where you want to SHOW the count\nexport function showWordCount(Component){return props=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{...props,text:`${store.wordCount} words`});};}\nexport const __FramerMetadata__ = {\"exports\":{\"showWordCount\":{\"type\":\"reactHoc\",\"name\":\"showWordCount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"with3DTilt\":{\"type\":\"reactHoc\",\"name\":\"with3DTilt\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTriangleMask\":{\"type\":\"reactHoc\",\"name\":\"withTriangleMask\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"textBadge\":{\"type\":\"reactHoc\",\"name\":\"textBadge\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getCMSContent\":{\"type\":\"reactHoc\",\"name\":\"getCMSContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"gOAC6O,SAAgB,EAAU,EAAU,CAAC,OAAoB,GAAY,EAAM,IAA2B,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAG,CAA+tB,SAAgB,EAAW,EAAU,CAAC,UAAQ,GAAG,cAAY,KAAK,EAAE,CAAC,CAAC,OAAoB,GAAY,EAAM,IAAM,CAAC,IAAM,EAAQ,EAAU,EAAE,CAAC,UAAU,IAAI,QAAQ,GAAG,CAAC,CAAO,EAAQ,EAAU,EAAE,CAAC,UAAU,IAAI,QAAQ,GAAG,CAAC,CAAC,SAAS,EAAgB,EAAE,CAAC,IAAM,EAAK,EAAE,cAAc,uBAAuB,CAAO,EAAE,EAAE,QAAQ,EAAK,KAAW,EAAE,EAAE,QAAQ,EAAK,IAAU,EAAQ,EAAK,MAAM,EAAQ,EAAQ,EAAK,OAAO,EAAE,EAAQ,KAAK,EAAE,GAAS,EAAQ,CAAC,EAAQ,CAAC,EAAQ,KAAK,EAAE,GAAS,EAAQ,EAAQ,CAAE,SAAS,GAAkB,CAAC,EAAQ,IAAI,EAAE,CAAC,EAAQ,IAAI,EAAE,CAAE,OAAoB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,YAAY,EAAgB,aAAa,EAAgC,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,EAAM,OAAO,EAAE,CAAC,UAAQ,UAAQ,eAAe,cAAc,qBAAqB,EAAY,CAAC,CAAC,EAAG,kBADx2D,IAA8B,IAA2E,IAAqE,IAAqE,CAC/Q,EAAY,CAAC,WAAW,UAAU,CAAC,CAClC,EAAY,CAAC,UAAU,EAAE,CAAC"}