{"version":3,"file":"PixelSquare.DAoIg4Mt.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/ltbVdymmpTN29li6vR1b/l3FCe5bJzuahex7z4Kqz/PixelSquare.js"],"sourcesContent":["// PixelSquare: Animated square with transform-based scaling, full Framer property controls, and accessibility\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{motion,useReducedMotion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * PixelSquare: Animated square with transform-based scaling, full Framer property controls, and accessibility\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function PixelSquare(props){// Destructure props with defaults\nconst{sizeStartPx=18,sizeEndPx=14,fillColor=\"#6161FF\",borderColor=\"#00000000\",borderWidth=0,borderRadius=4,shadow=false,playMode=\"autoplay\",duration=.6,delay=0,easing=\"easeInOut\",springStiffness=220,springDamping=20,loop=true,loopMode=\"yoyo\",isPaused=false,style}=props;// Compute base size and scales\nconst baseSize=Math.max(sizeStartPx,sizeEndPx);const startScale=sizeStartPx/baseSize;const endScale=sizeEndPx/baseSize;// Reduced motion: disables animation, renders static at start size\nconst prefersReducedMotion=useReducedMotion()||typeof window!==\"undefined\"&&window.matchMedia&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;// Animation state for interactive modes\nconst[active,setActive]=React.useState(false);// Keyboard accessibility: focus/space/enter\nconst wrapperRef=React.useRef(null);// Animation config\nconst isSpring=easing===\"spring\";const easeMap={easeInOut:[.42,0,.58,1],easeOut:[0,0,.58,1],linear:[0,0,1,1]};const ease=isSpring?undefined:easeMap[easing]||easeMap.easeInOut;// Animation variants\nconst getAnimate=()=>{if(prefersReducedMotion)return{scale:startScale};if(playMode===\"autoplay\"){// Looping animation\nreturn{scale:[startScale,endScale,startScale],transition:{duration:duration*2,delay,repeat:loop?Infinity:0,repeatType:loopMode===\"yoyo\"?\"reverse\":\"loop\",ease:isSpring?undefined:ease,type:isSpring?\"spring\":\"tween\",stiffness:isSpring?springStiffness:undefined,damping:isSpring?springDamping:undefined}};}if(playMode===\"hover\"||playMode===\"tap\"){// Interactive: animate on hover/tap/press\nreturn{scale:active?endScale:startScale};}if(playMode===\"controlled\"){// Controlled: play/pause\nreturn{scale:isPaused?startScale:endScale};}return{scale:startScale};};// Animation transition\nconst getTransition=()=>{if(prefersReducedMotion)return{duration:0};if(playMode===\"autoplay\")return undefined// handled in animate\n;if(isSpring){return{type:\"spring\",stiffness:springStiffness,damping:springDamping};}return{type:\"tween\",duration,delay,ease};};// Handlers for interactive modes\nconst handleHoverStart=()=>{if(playMode===\"hover\")setActive(true);};const handleHoverEnd=()=>{if(playMode===\"hover\")setActive(false);};const handleTapStart=()=>{if(playMode===\"tap\")setActive(true);};const handleTapEnd=()=>{if(playMode===\"tap\")setActive(false);};const handleClick=()=>{if(playMode===\"tap\")setActive(v=>!v);};// Keyboard: Space/Enter toggles in interactive modes\nconst handleKeyDown=e=>{if(playMode===\"hover\"||playMode===\"tap\"){if(e.key===\" \"||e.key===\"Enter\"){e.preventDefault();setActive(v=>!v);}}};// Box shadow style\nconst boxShadow=shadow?\"0 2px 8px rgba(0,0,0,0.12)\":\"none\";// Outer wrapper: fixed size, centers content\nreturn /*#__PURE__*/_jsx(\"figure\",{ref:wrapperRef,style:{display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",width:`${baseSize}px`,height:`${baseSize}px`,minWidth:baseSize,minHeight:baseSize,margin:0,position:\"relative\",...style},tabIndex:0,onKeyDown:handleKeyDown,\"aria-label\":\"Animated square\",role:\"img\",children:/*#__PURE__*/_jsx(motion.div,{style:{width:baseSize,height:baseSize,background:fillColor,border:`${borderWidth}px solid ${borderColor}`,borderRadius,boxShadow,willChange:\"transform\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",userSelect:\"none\",outline:\"none\",transformOrigin:\"center center\"},animate:getAnimate(),transition:getTransition(),initial:{scale:startScale},whileHover:playMode===\"hover\"?{scale:endScale}:undefined,whileTap:playMode===\"tap\"?{scale:endScale}:undefined,onHoverStart:handleHoverStart,onHoverEnd:handleHoverEnd,onTapStart:handleTapStart,onTapCancel:handleTapEnd,onTap:handleClick,tabIndex:-1,role:\"presentation\",\"aria-hidden\":\"true\"})});}addPropertyControls(PixelSquare,{// Size group\nsizeStartPx:{type:ControlType.Number,title:\"Size Start (px)\",min:4,max:64,defaultValue:18,group:\"Size\"},sizeEndPx:{type:ControlType.Number,title:\"Size End (px)\",min:4,max:64,defaultValue:14,group:\"Size\"},// Appearance group\nfillColor:{type:ControlType.Color,title:\"Fill Color\",defaultValue:\"#6161FF\",group:\"Appearance\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#00000000\",group:\"Appearance\"},borderWidth:{type:ControlType.Number,title:\"Border Width\",min:0,max:4,defaultValue:0,group:\"Appearance\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",min:0,max:16,defaultValue:4,group:\"Appearance\"},shadow:{type:ControlType.Boolean,title:\"Shadow\",defaultValue:false,group:\"Appearance\",enabledTitle:\"On\",disabledTitle:\"Off\"},// Animation group\nplayMode:{type:ControlType.Enum,title:\"Play Mode\",options:[\"autoplay\",\"hover\",\"tap\",\"controlled\"],optionTitles:[\"Autoplay\",\"Hover\",\"Tap\",\"Controlled\"],defaultValue:\"autoplay\",group:\"Animation\"},duration:{type:ControlType.Number,title:\"Duration (s)\",min:.1,max:3,step:.01,defaultValue:.6,group:\"Animation\"},delay:{type:ControlType.Number,title:\"Delay (s)\",min:0,max:3,step:.01,defaultValue:0,group:\"Animation\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"easeInOut\",\"easeOut\",\"linear\",\"spring\"],optionTitles:[\"Ease In Out\",\"Ease Out\",\"Linear\",\"Spring\"],defaultValue:\"easeInOut\",group:\"Animation\"},springStiffness:{type:ControlType.Number,title:\"Spring Stiffness\",min:1,max:500,defaultValue:220,group:\"Animation\",hidden:({easing})=>easing!==\"spring\"},springDamping:{type:ControlType.Number,title:\"Spring Damping\",min:1,max:100,defaultValue:20,group:\"Animation\",hidden:({easing})=>easing!==\"spring\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:true,group:\"Animation\",enabledTitle:\"On\",disabledTitle:\"Off\"},loopMode:{type:ControlType.Enum,title:\"Loop Mode\",options:[\"yoyo\",\"restart\"],optionTitles:[\"Yoyo\",\"Restart\"],defaultValue:\"yoyo\",group:\"Animation\",hidden:({loop})=>!loop},isPaused:{type:ControlType.Boolean,title:\"Is Paused\",defaultValue:false,group:\"Animation\",enabledTitle:\"Paused\",disabledTitle:\"Playing\",hidden:({playMode})=>playMode!==\"controlled\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PixelSquare\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PixelSquare.map"],"mappings":"kPAMG,SAAwB,EAAY,EAAM,CAC7C,GAAK,CAAC,cAAY,GAAG,YAAU,GAAG,YAAU,UAAU,cAAY,YAAY,cAAY,EAAE,eAAa,EAAE,SAAO,GAAM,WAAS,WAAW,WAAS,GAAG,QAAM,EAAE,SAAO,YAAY,kBAAgB,IAAI,gBAAc,GAAG,OAAK,GAAK,WAAS,OAAO,WAAS,GAAM,SAAO,EAClQ,EAAS,KAAK,IAAI,EAAY,CAAS,EAAQ,EAAW,EAAY,EAAe,EAAS,EAAU,EACxG,EAAqB,EAAiB,GAAU,IAAS,QAAa,EAAO,YAAY,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAChJ,CAAC,EAAO,GAAWA,EAAe,EAAK,EACtC,EAAWC,EAAa,IAAI,EAC5B,EAAS,IAAS,SAAe,EAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO,CAA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