{"version":3,"file":"ButtonBackToTop.BkFo7Y95.mjs","names":["useState","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/SpNLzs8SvqPF4kYo34UT/TUvlj0nICyssoAusdZMH/ButtonBackToTop.js"],"sourcesContent":["/**\n * @framerIntrinsicWidth 48\n * @framerIntrinsicHeight 48\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useMemo,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useReducedMotion,getTransition,getSpacing,getZIndex,getRadius}from\"https://framerusercontent.com/modules/zb8SeFEAitsE3Aq1tolb/auXmJ7lTprOPb5ljXFDO/colors.js\";import{getButtonBackgroundColor,getButtonIconColor,getGhostGlassButtonBackground}from\"https://framerusercontent.com/modules/jziVWOV3BxFa7do866W6/ExwuoNF27fDncYOgPtfU/buttonStyles.js\";import{getLiquidGlassFinish,liquidGlassLegacyHighlightToVariant}from\"https://framerusercontent.com/modules/OKFpRwNE6X8LgIEKbuJB/WPhQEdU0IPoq1OVQ1lnt/colorEffects.js\";import{getIcon}from\"https://framerusercontent.com/modules/fKzjax3Wmna7aU3KCPZx/ZEsYWkdiAa6tEKdBkB1I/icons.js\";import{iconPixelSizeForSquareSide}from\"https://framerusercontent.com/modules/LORybSIZ01GuqYosrm04/DjDCuVCr4pVjhZtICnRS/svg.js\";import{useInteractiveStates}from\"https://framerusercontent.com/modules/ybGk5zeqg5sx0cATodEy/92LgNXEK8Mxj8GgWAiN0/useInteractiveStates.js\";import{resolveBrand}from\"https://framerusercontent.com/modules/7NSJeaeou9P0OpUE6qK4/j0rDL3hZvZcw7cxP5cbL/themeHelpers.js\";import{breakpointPropertyControl}from\"https://framerusercontent.com/modules/fqabD3J3lU6VFoyJTkl9/XuSutgRb2fscK8LXIPHb/breakpointControl.js\";import{brandPropertyControl,themePropertyControls}from\"https://framerusercontent.com/modules/WlMkRQB3V7rn8cIYN98V/vB1ucmyiUTccgkdUzzQJ/brandControl.js\";import{resolveThemeProp}from\"https://framerusercontent.com/modules/5WgsjBO1A8BiShdO0B9C/r0GYDtytq52p0xC4TfQT/themeControl.js\";import{FRAMER_THEME_DESCRIPTION_SURFACE}from\"https://framerusercontent.com/modules/vkQqDtKpdgUyOodxbyn3/QbeDbzhxh6tG2UebUJz9/propertyControlCopy.js\";function getButtonDimension(size,breakpoint){if(size===\"large\"){return breakpoint===\"phone\"?48:56;}else if(size===\"medium\"){return 48;}return 44;}const ButtonBackToTopInternal=/*#__PURE__*/forwardRef(function ButtonBackToTopInternal(props,ref){const theme=resolveThemeProp(props);const{breakpoint=\"desktop\",brand,variant=\"glass\",size=\"medium\",placement=\"fixed\",corner=\"bottomRight\",offset=24,disabled=false,showAfterScroll=false,scrollThreshold=400,onClick,ariaLabel=\"Back to top\",id,style}=props;const reducedMotion=useReducedMotion();const isStaticRenderer=useIsStaticRenderer();const resolvedBrand=resolveBrand(brand);const[isPastThreshold,setIsPastThreshold]=useState(!showAfterScroll);const{styles:interactiveStyles,handlers:interactiveHandlers}=useInteractiveStates(disabled,{transitions:true,pressScale:false,brand:resolvedBrand,theme});const{transition:interactiveTransition,...interactiveStylesRest}=interactiveStyles;const mergedTransition=!reducedMotion&&interactiveTransition?`${getTransition(\"opacity\",\"quick\")}, ${interactiveTransition}`:interactiveTransition;useEffect(()=>{if(!showAfterScroll){setIsPastThreshold(true);return undefined;}if(typeof window===\"undefined\"){setIsPastThreshold(true);return undefined;}const handleScroll=()=>{setIsPastThreshold(window.scrollY>=scrollThreshold);};handleScroll();window.addEventListener(\"scroll\",handleScroll,{passive:true});return()=>{window.removeEventListener(\"scroll\",handleScroll);};},[showAfterScroll,scrollThreshold]);const buttonDimension=getButtonDimension(size,breakpoint);const iconSize=iconPixelSizeForSquareSide(buttonDimension);const surface=useMemo(()=>{if(variant===\"ghost\"){const baseFill=getButtonBackgroundColor(\"ghost\",theme,disabled);const background=theme===\"default\"?getGhostGlassButtonBackground(baseFill):baseFill;return{background,iconColor:getButtonIconColor(\"ghost\",theme,disabled),liquidGlassFinish:null};}const triggerVariant=theme===\"inverted\"?\"solid\":\"ghost\";const resolvedHighlightSheen=theme===\"inverted\"?\"dark\":\"light\";const neutralVariant=liquidGlassLegacyHighlightToVariant(resolvedHighlightSheen);const solidBackground=getButtonBackgroundColor(triggerVariant,theme,disabled);return{background:solidBackground,iconColor:getButtonIconColor(triggerVariant,theme,disabled),liquidGlassFinish:getLiquidGlassFinish({variant:neutralVariant,surface:\"button\",selected:false,brand:resolvedBrand,solidFill:solidBackground})};},[disabled,theme,variant,resolvedBrand]);const iconSvg=useMemo(()=>getIcon(\"arrow-narrow-up\",iconSize,surface.iconColor,{opticalInset:0}),[iconSize,surface.iconColor]);const buttonDimensionStyle=getSpacing(buttonDimension);const viewportPlacementStyles=useMemo(()=>{if(placement===\"inline\"){return{position:\"relative\",flexShrink:0};}const sideOffset=getSpacing(offset);const bottomOffset=breakpoint===\"phone\"?getSpacing(80):getSpacing(offset);return{position:\"fixed\",bottom:bottomOffset,...corner===\"bottomRight\"?{right:sideOffset}:{left:sideOffset},zIndex:getZIndex(\"floating\")};},[breakpoint,corner,offset,placement]);const handleClick=useCallback(event=>{if(disabled){event.preventDefault();}else{onClick?.(event);if(!event.defaultPrevented){if(typeof window!==\"undefined\"){window.scrollTo({top:0,behavior:reducedMotion?\"auto\":\"smooth\"});}}}},[disabled,onClick,reducedMotion]);const isViewportFixed=placement===\"fixed\"&&!isStaticRenderer;const wrapperStyle=isViewportFixed?{flexShrink:0,...style,position:\"relative\",width:0,height:0,overflow:\"visible\",pointerEvents:\"none\"}:{width:buttonDimensionStyle,height:buttonDimensionStyle,flexShrink:0,...style,position:\"relative\",pointerEvents:placement===\"fixed\"?\"none\":undefined};return /*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,children:/*#__PURE__*/_jsx(\"button\",{ref:ref,type:\"button\",id:id,disabled:disabled,\"aria-disabled\":disabled,\"aria-hidden\":!isPastThreshold,\"aria-label\":ariaLabel,tabIndex:isPastThreshold&&!disabled?0:-1,onClick:handleClick,onMouseEnter:interactiveHandlers.onMouseEnter,onMouseLeave:interactiveHandlers.onMouseLeave,onMouseDown:interactiveHandlers.onMouseDown,onMouseUp:interactiveHandlers.onMouseUp,onFocus:interactiveHandlers.onFocus,onBlur:interactiveHandlers.onBlur,style:{...viewportPlacementStyles,width:placement===\"inline\"?\"100%\":buttonDimensionStyle,height:placement===\"inline\"?\"100%\":buttonDimensionStyle,display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",padding:0,border:\"none\",borderRadius:getRadius(\"radius-full\"),color:surface.iconColor,background:surface.background,...surface.liquidGlassFinish??{},opacity:isPastThreshold?1:0,pointerEvents:isPastThreshold&&!disabled?\"auto\":\"none\",transformOrigin:\"center\",...interactiveStylesRest,...mergedTransition?{transition:mergedTransition}:{}},dangerouslySetInnerHTML:{__html:iconSvg}})});});export default function ButtonBackToTop(props){const{ref,...rest}=props;return /*#__PURE__*/_jsx(ButtonBackToTopInternal,{...rest,ref:ref});}ButtonBackToTop.displayName=\"Button Back To Top - Atom\";addPropertyControls(ButtonBackToTop,{variant:{type:ControlType.Enum,title:\"Variant\",description:\"Glass uses liquid-glass chrome. Ghost matches the lightweight Button ghost surface.\",options:[\"glass\",\"ghost\"],optionTitles:[\"Glass\",\"Ghost\"],displaySegmentedControl:true,defaultValue:\"glass\"},size:{type:ControlType.Enum,title:\"Size\",description:\"Choose the circular hit area size. Small remains touch-friendly on phone.\",options:[\"large\",\"medium\",\"small\"],optionTitles:[\"Large\",\"Medium\",\"Small\"],displaySegmentedControl:true,defaultValue:\"medium\"},placement:{type:ControlType.Enum,title:\"Placement\",description:\"Fixed pins the button to the viewport. Inline lets a parent component handle placement.\",options:[\"fixed\",\"inline\"],optionTitles:[\"Fixed\",\"Inline\"],displaySegmentedControl:true,defaultValue:\"fixed\"},corner:{type:ControlType.Enum,title:\"Corner\",description:\"Viewport corner used when Placement is Fixed.\",options:[\"bottomRight\",\"bottomLeft\"],optionTitles:[\"Bottom Right\",\"Bottom Left\"],displaySegmentedControl:true,defaultValue:\"bottomRight\",hidden:({placement})=>placement===\"inline\"},offset:{type:ControlType.Enum,title:\"Offset\",description:\"Distance from the viewport edges when Placement is Fixed.\",options:[16,24,32,40,48],optionTitles:[\"16 px\",\"24 px\",\"32 px\",\"40 px\",\"48 px\"],displaySegmentedControl:false,defaultValue:24,hidden:({placement})=>placement===\"inline\"},disabled:{type:ControlType.Boolean,title:\"Disabled\",description:\"Disables the control and prevents the default scroll-to-top action.\",enabledTitle:\"Yes\",disabledTitle:\"No\",defaultValue:false},showAfterScroll:{type:ControlType.Boolean,title:\"Show After Scroll\",description:\"Fade the button in only after the page has been scrolled past the threshold.\",enabledTitle:\"After Scroll\",disabledTitle:\"Always\",defaultValue:false},scrollThreshold:{type:ControlType.Number,title:\"Scroll Threshold\",description:\"Scroll distance in pixels before the button appears.\",min:0,max:2e3,step:50,defaultValue:400,hidden:({showAfterScroll})=>showAfterScroll!==true},onClick:{type:ControlType.EventHandler,title:\"On Click\",description:\"Runs before the default scroll-to-top behavior. Prevent default in custom code to replace the built-in scroll.\"},ariaLabel:{type:ControlType.String,title:\"ARIA Label\",description:\"Accessible name for this icon-only button.\",defaultValue:\"Back to top\",placeholder:\"e.g. Back to top\"},id:{type:ControlType.String,title:\"ID\",description:\"Set a unique id for analytics or custom page interactions.\",defaultValue:\"button-back-to-top\",placeholder:\"e.g. back-to-top\",preventLocalization:true},...breakpointPropertyControl(\"Pick the breakpoint that matches Framer's preview so size and edge offset align with the page layout.\"),...themePropertyControls(FRAMER_THEME_DESCRIPTION_SURFACE),...brandPropertyControl()});\nexport const __FramerMetadata__ = {\"exports\":{\"ButtonBackToTopProps\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"ButtonBackToTop\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\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