{"version":3,"file":"ButtonAnimation.DGuzrNrz.mjs","names":["useRef","useCallback","HOVER_EVENT"],"sources":["https:/framerusercontent.com/modules/tGDxOm9v9wbJ6CwcgTrk/CBI1K1V6s09gMPyfeFfN/CornerFillButton.js","https:/framerusercontent.com/modules/GOccRNdzOes3sYetoEFw/cofzi0OSEVoen4CghaKj/ButtonAnimation.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useEffect,useRef}from\"react\";import{motion,useMotionTemplate,useMotionValue,useReducedMotion,useTransform,animate}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";const HOVER_EVENT=\"corner-fill-button:hover\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 520\n * @framerIntrinsicHeight 56\n */export default function CornerFillButton(props){const{label=\"確認する\",accent=\"#C1000E\",background=\"#FBE6C7\",radius=20,borderWidth=2,fontSize=20,letterSpacing=4,fontFamily='\"Noto Serif JP\", \"Times New Roman\", serif',duration=.55,hoverKey=\"default\",disabled=false,style,onClick}=props;const reduce=useReducedMotion();const fill=useMotionValue(0);const maxRef=useRef(400);const buttonRef=useRef(null);const animationRef=useRef(null);const rOuter=useTransform(fill,v=>(1-v)*maxRef.current);const rInner=useTransform(fill,v=>Math.max(0,(1-v)*maxRef.current-2));const mask=useMotionTemplate`radial-gradient(circle at 50% 50%, transparent ${rInner}px, #000 ${rOuter}px)`;useEffect(()=>{const el=buttonRef.current;if(!el)return;const measure=()=>{const w=el.offsetWidth;const h=el.offsetHeight;maxRef.current=Math.sqrt(w*w+h*h)/2+10;};measure();if(typeof ResizeObserver===\"undefined\")return;const ro=new ResizeObserver(measure);ro.observe(el);return()=>ro.disconnect();},[]);const stopAndSetFill=useCallback(value=>{animationRef.current?.stop();animationRef.current=null;fill.set(value);},[fill]);const animateFill=useCallback(target=>{animationRef.current?.stop();animationRef.current=animate(fill,target,{duration:reduce?0:duration,ease:[.22,1,.36,1]});return animationRef.current;},[duration,fill,reduce]);useEffect(()=>{stopAndSetFill(0);return()=>{animationRef.current?.stop();animationRef.current=null;};},[stopAndSetFill]);useEffect(()=>{if(typeof window===\"undefined\")return;const onExternalHover=event=>{const detail=event.detail||{};const source=detail.source;const sourceMatches=!!source&&!!buttonRef.current&&source.contains(buttonRef.current);const keyMatches=hoverKey!==\"default\"&&detail.key===hoverKey;if(!sourceMatches&&!keyMatches)return;if(disabled){stopAndSetFill(0);return;}animateFill(detail.hovered?1:0);};window.addEventListener(HOVER_EVENT,onExternalHover);return()=>window.removeEventListener(HOVER_EVENT,onExternalHover);},[animateFill,disabled,hoverKey,stopAndSetFill]);useEffect(()=>{if(disabled)stopAndSetFill(0);},[disabled,stopAndSetFill]);useEffect(()=>{if(typeof window===\"undefined\")return;const resetToIdle=()=>stopAndSetFill(0);const onVisibilityChange=()=>{if(document.hidden)resetToIdle();};window.addEventListener(\"pagehide\",resetToIdle);window.addEventListener(\"blur\",resetToIdle);document.addEventListener(\"visibilitychange\",onVisibilityChange);return()=>{window.removeEventListener(\"pagehide\",resetToIdle);window.removeEventListener(\"blur\",resetToIdle);document.removeEventListener(\"visibilitychange\",onVisibilityChange);};},[stopAndSetFill]);const R=Math.max(0,Number(radius)||0);const BW=Math.max(0,Number(borderWidth)||0);const cornerFillStart=Math.max(0,R-BW);const labelStyle={position:\"absolute\",inset:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",fontSize,letterSpacing,fontFamily,lineHeight:1,pointerEvents:\"none\"};const corners=[{box:{top:0,left:0},at:\"100% 100%\"},{box:{top:0,right:0},at:\"0% 100%\"},{box:{bottom:0,left:0},at:\"100% 0%\"},{box:{bottom:0,right:0},at:\"0% 0%\"}];const handleClick=event=>{if(disabled){event.preventDefault();return;}onClick?.();};return /*#__PURE__*/_jsxs(\"button\",{ref:buttonRef,type:\"button\",disabled:disabled,\"aria-disabled\":disabled,onClick:handleClick,onMouseEnter:()=>!disabled&&animateFill(1),onMouseLeave:()=>animateFill(0),onPointerCancel:()=>stopAndSetFill(0),onPointerLeave:()=>animateFill(0),onFocus:()=>!disabled&&animateFill(1),onBlur:()=>animateFill(0),style:{...style,position:\"relative\",display:\"block\",width:\"100%\",height:\"100%\",minHeight:1,padding:0,boxSizing:\"border-box\",background:\"transparent\",border:\"none\",textDecoration:\"none\",overflow:\"hidden\",cursor:disabled?\"default\":\"pointer\",opacity:disabled?.6:1,fontFamily,WebkitAppearance:\"none\",appearance:\"none\"},children:[/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":true,style:{position:\"absolute\",inset:0,boxSizing:\"border-box\",border:`${BW}px solid ${accent}`,borderRadius:R,pointerEvents:\"none\"}}),corners.map((corner,index)=>/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":true,style:{position:\"absolute\",width:R,height:R,pointerEvents:\"none\",...corner.box,backgroundImage:`radial-gradient(circle at ${corner.at}, transparent ${cornerFillStart}px, ${accent} ${cornerFillStart+.8}px)`}},index)),/*#__PURE__*/_jsx(\"span\",{style:{...labelStyle,color:accent},children:label}),/*#__PURE__*/_jsx(motion.span,{\"aria-hidden\":true,style:{...labelStyle,background:accent,color:background,borderRadius:R,WebkitMaskImage:mask,maskImage:mask,WebkitMaskRepeat:\"no-repeat\",maskRepeat:\"no-repeat\"},children:label})]});}CornerFillButton.displayName=\"Corner Fill Button\";addPropertyControls(CornerFillButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"確認する\"},accent:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#C1000E\"},background:{type:ControlType.Color,title:\"BG\",defaultValue:\"#FBE6C7\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:20,min:0,max:80,unit:\"px\"},borderWidth:{type:ControlType.Number,title:\"Border\",defaultValue:2,min:0,max:12,unit:\"px\"},fontSize:{type:ControlType.Number,title:\"Font\",defaultValue:20,min:8,max:64,unit:\"px\"},letterSpacing:{type:ControlType.Number,title:\"Spacing\",defaultValue:4,min:0,max:24,unit:\"px\"},fontFamily:{type:ControlType.String,title:\"Font Family\",defaultValue:'\"Noto Serif JP\", \"Times New Roman\", serif'},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:.55,min:0,max:2,step:.05,unit:\"s\"},hoverKey:{type:ControlType.String,title:\"Hover Key\",defaultValue:\"default\",description:\"透明リンクFrameのoverrideと同じキーにすると、上のFrameのhoverで反応します。\"},disabled:{type:ControlType.Boolean,title:\"Disabled\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CornerFillButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"520\",\"framerSupportedLayoutWidth\":\"any\",\"framerIntrinsicHeight\":\"56\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CornerFillButton.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect}from\"react\";const HOVER_EVENT=\"corner-fill-button:hover\";const HOVER_KEY=\"default\";function sendHover(hovered,source,key=HOVER_KEY){if(typeof window===\"undefined\")return;window.dispatchEvent(new CustomEvent(HOVER_EVENT,{detail:{key,hovered,source:source instanceof Element?source:null}}));}export function withCornerFillLinkOverlay(Component){return /*#__PURE__*/forwardRef(function CornerFillLinkOverlay(props,ref){const hoverKey=props?.hoverKey??HOVER_KEY;const resetHover=source=>{sendHover(false,source,hoverKey);};useEffect(()=>{resetHover();return()=>resetHover();},[hoverKey]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onMouseEnter:event=>{props.onMouseEnter?.(event);sendHover(true,event?.currentTarget,hoverKey);},onMouseLeave:event=>{props.onMouseLeave?.(event);sendHover(false,event?.currentTarget,hoverKey);},onFocus:event=>{props.onFocus?.(event);sendHover(true,event?.currentTarget,hoverKey);},onBlur:event=>{props.onBlur?.(event);resetHover(event?.currentTarget);},onPointerCancel:event=>{props.onPointerCancel?.(event);resetHover(event?.currentTarget);},onPointerLeave:event=>{props.onPointerLeave?.(event);resetHover(event?.currentTarget);},onPointerUp:event=>{props.onPointerUp?.(event);if(!event?.currentTarget?.matches?.(\":hover\")){resetHover(event?.currentTarget);}},style:{...props.style,background:\"rgba(0,0,0,0)\",opacity:1,cursor:\"pointer\"}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCornerFillLinkOverlay\":{\"type\":\"reactHoc\",\"name\":\"withCornerFillLinkOverlay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ButtonAnimation.map"],"mappings":"mSAKG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,QAAM,OAAO,SAAO,UAAU,aAAW,UAAU,SAAO,GAAG,cAAY,EAAE,WAAS,GAAG,gBAAc,EAAE,aAAW,4CAA4C,WAAS,IAAI,WAAS,UAAU,WAAS,GAAM,QAAM,WAAS,EAAY,EAAO,EAAiB,EAAQ,EAAK,EAAe,CAAC,EAAQ,EAAOA,EAAO,GAAG,EAAQ,EAAUA,EAAO,IAAI,EAAQ,EAAaA,EAAO,IAAI,EAAQ,EAAO,EAAa,EAAK,IAAI,EAAE,GAAG,EAAO,OAAO,EAA8E,EAAK,CAAiB,kDAArF,EAAa,EAAK,GAAG,KAAK,IAAI,GAAG,EAAE,GAAG,EAAO,QAAQ,CAAC,CAAsF,EAAE,WAAW,EAAO,KAAK,MAAc,CAAC,IAAM,EAAG,EAAU,QAAQ,GAAG,CAAC,EAAG,OAAO,IAAM,MAAY,CAAC,IAAM,EAAE,EAAG,YAAkB,EAAE,EAAG,aAAa,EAAO,QAAQ,KAAK,KAAK,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAG,EAAY,GAAV,EAAQ,EAAK,OAAO,eAAiB,IAAY,OAAO,IAAM,EAAG,IAAI,eAAe,CAAO,EAAiB,OAAf,EAAG,QAAQ,CAAE,MAAY,EAAG,WAAW,CAAE,EAAE,CAAC,CAAC,EAA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