{"version":3,"file":"SkipToContent.jcm4QfLd.mjs","names":["useState","useRef","useEffect","_jsx","createPortal","__esmMin","init_npm_react_18_3_1","init_npm_react_dom_18_3_1","_e","c","init_jsx_runtime","ce","de","addPropertyControls","init_framer_BWzg2IRg","ControlType","SkipToContent","props","text","href","targetID","topOffset","focused","setFocused","containerRef","mounted","setMounted","container","targetId","link","visuallyHiddenStyle","configured","target","element","focusTarget","Ha","init_SkipToContent"],"sources":["https:/framerusercontent.com/modules/xnLZiPzFqyV82wFhgC0x/F6q5ZBnUMlEsl0r82THg/SkipToContent.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,useRef}from\"react\";import{createPortal}from\"react-dom\";export default function SkipToContent(props){const{text=\"Skip to content\",href,targetID,topOffset=16}=props;const[focused,setFocused]=useState(false);const containerRef=useRef(null);const[mounted,setMounted]=useState(false);useEffect(()=>{// Create a host div and insert it as the very first child of <body>,\n// so the portalled link comes before all other tabbable content in\n// DOM order. The first Tab press then lands on the skip link.\nconst container=document.createElement(\"div\");container.setAttribute(\"data-skip-to-content-root\",\"\");document.body.insertBefore(container,document.body.firstChild);containerRef.current=container;setMounted(true);return()=>{container.remove();containerRef.current=null;};},[]);// Support the current `href` control and legacy instances that still store\n// `targetID`. Prefer the legacy value when href is absent or only carries\n// the component's old default, then normalize a leading hash.\nconst configuredTarget=targetID&&(!href||href===\"main\")?targetID:href||\"main\";const targetId=configuredTarget.replace(/^#+/,\"\")||\"main\";const handleClick=e=>{const configured=document.getElementById(targetId);// Framer preview can use its own generated section IDs. Keep the\n// semantic main landmark as a fallback, choosing only the visible page.\nconst target=configured&&configured.getClientRects().length>0?configured:Array.from(document.querySelectorAll(\"main, [role='main']\")).find(element=>element.getClientRects().length>0);if(!target)return;e.preventDefault();// Prefer focusing the first heading inside the target — screen\n// readers will announce its text + level, which is what users\n// actually want to hear after skipping. Fall back to the target\n// itself if there are no headings (and accept that a bare\n// landmark may announce \"no accessible text\" unless it has an\n// aria-label).\nconst heading=target.querySelector(\"h1, h2, h3, h4, h5, h6, [role='heading']\");const focusTarget=heading??target;if(!focusTarget.hasAttribute(\"tabindex\")){focusTarget.setAttribute(\"tabindex\",\"-1\");}focusTarget.focus({preventScroll:true});target.scrollIntoView({block:\"start\",behavior:\"smooth\"});};const focusedStyle={position:\"fixed\",top:topOffset,left:topOffset,zIndex:2147483647,padding:\"8px 16px\",background:\"white\",color:\"black\",border:\"2px solid black\",outline:\"2px solid #0066ff\",outlineOffset:2,fontWeight:\"bold\",fontSize:\"1rem\",textDecoration:\"none\",borderRadius:4,width:\"auto\",height:\"auto\",overflow:\"visible\",margin:0,whiteSpace:\"nowrap\"};const link=/*#__PURE__*/_jsx(\"a\",{style:focused?focusedStyle:visuallyHiddenStyle,href:`#${targetId}`,onFocus:()=>setFocused(true),onBlur:()=>setFocused(false),onClick:handleClick,children:text});// Before mount (or in environments without `document`) render inline so\n// React has something to hydrate. Once mounted, portal to <body> so the\n// link escapes any ancestor stacking context / transform that would\n// otherwise trap `position: fixed` below the page chrome.\nif(!mounted||!containerRef.current){return link;}return /*#__PURE__*/createPortal(link,containerRef.current);}const visuallyHiddenStyle={position:\"absolute\",width:1,height:1,padding:0,margin:-1,overflow:\"hidden\",clipPath:\"inset(50%)\",whiteSpace:\"nowrap\",border:0};addPropertyControls(SkipToContent,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Skip to content\"},href:{type:ControlType.String,title:\"Target ID\",defaultValue:\"main\",placeholder:\"main\"},topOffset:{type:ControlType.Number,title:\"Top Offset\",defaultValue:16,min:0,unit:\"px\",displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SkipToContent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SkipToContent.map"],"mappings":"A,iMAAgL,SAAwBgB,EAAcC,EAA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