{"version":3,"file":"ImageCaptionComparison.DDze6SYD.mjs","names":["React.useState","React.useRef","React.useCallback","React.useMemo","__esmMin","pe","init_npm_react_18_3_1","ne","init_ssg_sandbox_shims","te","window","_e","p","c","init_jsx_runtime","ce","de","useInView","init_framer_motion_DhsWWWsN","init_framer_BWFVvmND","addPropertyControls","ControlType","useIsStaticRenderer","ImageCaptionComparison","props","activePanel","setActivePanel","isPhone","setIsPhone","isStatic","containerRef","inView","media","update","shouldStack","stackPanels","interactionEnabled","transitionDuration","activateLeft","activateRight","resetDefault","panelStyle","panelHeight","captionBaseStyle","captionColor","captionPadding","captionFont","captionStickyWrapStyle","stickyOffset","imageViewportStyle","panelContentStyle","buildImageStyle","isActive","inactiveOpacity","isLeftActive","isRightActive","leftImage","leftCaption","rightImage","rightCaption","init_ImageCaptionComparison"],"sources":["https:/framerusercontent.com/modules/I7s7R8A2EmkpgMXwzAJ8/KWIoW2Hkfio87BjN2EWT/ImageCaptionComparison.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function ImageCaptionComparison(props){const{leftImage={src:\"https://framerusercontent.com/images/W0ydHK6Hgv0gC9uq3920LZnHeY.jpg\",alt:\"Model in tailored suiting details\"},rightImage={src:\"https://framerusercontent.com/images/5sIWfGIudB6dxMKJNKMtP2qLqY.jpg\",alt:\"Close-up tailoring craftsmanship\"},leftCaption=\"Hand-finished lapels shaped for a clean drape.\",rightCaption=\"Precision stitching and structure in every seam.\",inactiveOpacity=.45,panelHeight=440,captionColor=\"#FFFFFF\",captionPadding=\"8px\",stickyOffset=60,stackPanels=false,captionFont}=props;const[activePanel,setActivePanel]=React.useState(\"left\");const[isPhone,setIsPhone]=React.useState(false);const isStatic=useIsStaticRenderer();const containerRef=React.useRef(null);const inView=useInView(containerRef,{amount:.2,once:false});React.useEffect(()=>{if(typeof window!==\"undefined\"){const media=window.matchMedia(\"(max-width: 767px)\");const update=()=>{React.startTransition(()=>setIsPhone(media.matches));};update();media.addEventListener(\"change\",update);return()=>media.removeEventListener(\"change\",update);}else{React.startTransition(()=>setIsPhone(false));}},[]);const shouldStack=stackPanels||isPhone;const interactionEnabled=!stackPanels&&!isStatic&&inView;const transitionDuration=interactionEnabled?\"320ms\":\"0ms\";const activateLeft=React.useCallback(()=>{if(!interactionEnabled)return;React.startTransition(()=>setActivePanel(\"left\"));},[interactionEnabled]);const activateRight=React.useCallback(()=>{if(!interactionEnabled)return;React.startTransition(()=>setActivePanel(\"right\"));},[interactionEnabled]);const resetDefault=React.useCallback(()=>{if(!interactionEnabled)return;React.startTransition(()=>setActivePanel(\"left\"));},[interactionEnabled]);const panelStyle=React.useMemo(()=>({position:\"relative\",flex:shouldStack?\"0 0 auto\":1,width:shouldStack?\"100%\":undefined,minWidth:shouldStack?\"100%\":0,height:panelHeight,overflow:\"visible\",cursor:interactionEnabled?\"pointer\":\"default\"}),[panelHeight,interactionEnabled,shouldStack]);const captionBaseStyle=React.useMemo(()=>({margin:0,color:captionColor,padding:captionPadding,fontFamily:captionFont?.fontFamily,fontSize:captionFont?.fontSize,fontWeight:captionFont?.fontWeight,fontStyle:captionFont?.fontStyle,lineHeight:captionFont?.lineHeight,letterSpacing:captionFont?.letterSpacing,textAlign:captionFont?.textAlign,transition:`opacity ${transitionDuration} ease`,width:\"max-content\",maxWidth:\"calc(100% - 24px)\",pointerEvents:\"none\"}),[captionColor,captionFont,captionPadding,transitionDuration]);const captionStickyWrapStyle=React.useMemo(()=>({position:\"sticky\",top:stickyOffset,left:0,zIndex:3,pointerEvents:\"none\",paddingLeft:12,width:\"100%\"}),[stickyOffset]);const imageViewportStyle=React.useMemo(()=>({position:\"absolute\",inset:0,overflow:\"hidden\",zIndex:1}),[]);const panelContentStyle=React.useMemo(()=>({position:\"relative\",width:\"100%\",height:\"100%\",zIndex:2}),[]);const buildImageStyle=React.useCallback(isActive=>({width:\"100%\",height:\"100%\",objectFit:\"cover\",display:\"block\",filter:isActive?\"grayscale(0%)\":\"grayscale(100%)\",opacity:isActive?1:inactiveOpacity,transition:`filter ${transitionDuration} ease, opacity ${transitionDuration} ease`,transform:\"translateZ(0)\",willChange:\"filter, opacity\"}),[inactiveOpacity,transitionDuration]);const isLeftActive=stackPanels?true:activePanel===\"left\"||!interactionEnabled;const isRightActive=stackPanels?true:activePanel===\"right\"&&interactionEnabled;return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{position:\"relative\",width:\"100%\",display:\"flex\",flexDirection:shouldStack?\"column\":\"row\",gap:0},onMouseLeave:interactionEnabled?resetDefault:undefined,children:[/*#__PURE__*/_jsxs(\"article\",{role:interactionEnabled?\"button\":undefined,\"aria-label\":\"Left comparison panel\",tabIndex:interactionEnabled?0:-1,style:panelStyle,onMouseEnter:interactionEnabled?activateLeft:undefined,onFocus:interactionEnabled?activateLeft:undefined,onClick:interactionEnabled?activateLeft:undefined,children:[/*#__PURE__*/_jsx(\"div\",{style:imageViewportStyle,children:/*#__PURE__*/_jsx(\"img\",{...leftImage,alt:leftImage.alt||leftCaption,style:buildImageStyle(isLeftActive)})}),/*#__PURE__*/_jsx(\"div\",{style:panelContentStyle,children:/*#__PURE__*/_jsx(\"div\",{style:captionStickyWrapStyle,children:/*#__PURE__*/_jsx(\"p\",{style:{...captionBaseStyle,opacity:isLeftActive?1:0},children:leftCaption})})})]}),/*#__PURE__*/_jsxs(\"article\",{role:interactionEnabled?\"button\":undefined,\"aria-label\":\"Right comparison panel\",tabIndex:interactionEnabled?0:-1,style:panelStyle,onMouseEnter:interactionEnabled?activateRight:undefined,onFocus:interactionEnabled?activateRight:undefined,onClick:interactionEnabled?activateRight:undefined,children:[/*#__PURE__*/_jsx(\"div\",{style:imageViewportStyle,children:/*#__PURE__*/_jsx(\"img\",{...rightImage,alt:rightImage.alt||rightCaption,style:buildImageStyle(isRightActive)})}),/*#__PURE__*/_jsx(\"div\",{style:panelContentStyle,children:/*#__PURE__*/_jsx(\"div\",{style:captionStickyWrapStyle,children:/*#__PURE__*/_jsx(\"p\",{style:{...captionBaseStyle,opacity:isRightActive?1:0},children:rightCaption})})})]})]});}addPropertyControls(ImageCaptionComparison,{leftImage:{type:ControlType.ResponsiveImage,title:\"Left Image\"},rightImage:{type:ControlType.ResponsiveImage,title:\"Right Image\"},leftCaption:{type:ControlType.String,title:\"Left Caption\",defaultValue:\"Hand-finished lapels shaped for a clean drape.\"},rightCaption:{type:ControlType.String,title:\"Right Caption\",defaultValue:\"Precision stitching and structure in every seam.\"},inactiveOpacity:{type:ControlType.Number,title:\"Inactive\",defaultValue:.45,min:0,max:1,step:.01},panelHeight:{type:ControlType.Number,title:\"Height\",defaultValue:440,min:180,max:1e3,step:10,unit:\"px\"},captionColor:{type:ControlType.Color,title:\"Caption\",defaultValue:\"#FFFFFF\"},captionPadding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"8px\"},stickyOffset:{type:ControlType.Number,title:\"Sticky Top\",defaultValue:60,min:0,max:300,step:1,unit:\"px\"},stackPanels:{type:ControlType.Boolean,title:\"Stack Mobile\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},captionFont:{type:ControlType.Font,title:\"Caption Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"18px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\",textAlign:\"left\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ImageCaptionComparison\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ImageCaptionComparison.map"],"mappings":"A,2RAGG,SAAwBuB,EAAuB,EAAM,C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