{"version":3,"file":"AgeFinder.BY8UseDX.mjs","names":["useState","useRef","__esmMin","init_ssg_sandbox_shims","window","_e","de","p","init_npm_react_18_3_1","ce","RenderTarget","init_framer_DKtAEkcX","addPropertyControls","ControlType","AgeFinder","bhFontVars","props","AgeFinderInner","age","setAge","count","setCount","ref","canvas","ages","a","from","to","q","list","listName","items","read","it","n","reduce","lo","hi","show","was","u","sans","pill","on","click","accent","fill","ink","label","key","soft","emptyText","init_AgeFinder","init_jsx_runtime","f"],"sources":["https:/framerusercontent.com/modules/O7TXFSih3xwgE4amehOt/yZ2tLJQVB4RVmWjmJYlI/AgeFinder.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";// One \"Fonts\" setting in the panel. Type a font family that your text styles already use (so it is loaded).\nconst bhFontVars=f=>({...f?.heading?{\"--bh-serif\":`\"${f.heading}\"`}:{},...f?.body?{\"--bh-sans\":`\"${f.body}\"`}:{}});/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function AgeFinder(props){// Fonts setting: sets the font variables the styles below read (empty = the template fonts)\nreturn /*#__PURE__*/_jsx(\"div\",{style:{display:\"contents\",...bhFontVars(props.fonts)},children:/*#__PURE__*/_jsx(AgeFinderInner,{...props})});}function AgeFinderInner(props){const{from=5,to=15,listName=\"Sessions List\",ink=\"#1C211C\",soft=\"#5E6158\",accent=\"#A8432C\",fill=\"#FBF8F1\",label=\"My child is\",emptyText=\"No session for that age yet. Call us and we will help.\"}=props;const[age,setAge]=useState(null);const[count,setCount]=useState(null);const ref=useRef(null);const canvas=RenderTarget.current()===RenderTarget.canvas;const ages=[];for(let a=from;a<=to;a++)ages.push(a);useEffect(()=>{if(canvas)return;const q=Number(new URLSearchParams(window.location.search).get(\"age\"));if(q>=from&&q<=to)setAge(q);},[canvas]);useEffect(()=>{if(canvas)return;const scope=(ref.current?.closest(\"section\"))||document;const list=scope.querySelector(`[data-framer-name=\"${listName}\"]`);if(!list)return;const items=Array.from(list.children);const read=(it,n)=>parseFloat((it.querySelector(`[data-framer-name=\"${n}\"]`)?.textContent||\"\").replace(/[^\\d.]/g,\"\"));let n=0;const reduce=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;items.forEach(it=>{const lo=read(it,\"D AgeMin\"),hi=read(it,\"D AgeMax\");const show=age===null||!(lo>age)&&!(hi<age);const was=it.style.display!==\"none\";it.style.display=show?\"\":\"none\";if(show){n++;if(!was&&!reduce)it.animate([{opacity:0,transform:\"translateY(14px)\"},{opacity:1,transform:\"none\"}],{duration:450,easing:\"cubic-bezier(.22,1,.36,1)\"});}});setCount(n);try{const u=new URL(window.location.href);if(age===null)u.searchParams.delete(\"age\");else u.searchParams.set(\"age\",String(age));window.history.replaceState(window.history.state,\"\",u.toString());}catch{}},[age,listName,canvas]);const sans=`var(--bh-sans, \"Inter\"), system-ui, sans-serif`;const pill=(label,on,click,key)=>/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-pressed\":on,onClick:click,style:{font:`500 12px/1 ${sans}`,letterSpacing:\"0.06em\",textTransform:\"uppercase\",padding:\"11px 16px\",minWidth:44,minHeight:40,borderRadius:999,cursor:\"pointer\",border:`1px solid ${on?accent:\"rgba(28,33,28,0.22)\"}`,background:on?accent:fill,color:on?\"#FFFFFF\":ink,transition:\"background .2s, color .2s, border-color .2s\"},children:label},key);return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...props.style,display:\"flex\",flexDirection:\"column\",gap:14,width:\"100%\"},children:[/*#__PURE__*/_jsxs(\"div\",{role:\"group\",\"aria-label\":\"Show sessions for my child’s age\",style:{display:\"flex\",flexWrap:\"wrap\",gap:8,alignItems:\"center\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{font:`500 11px/1 ${sans}`,letterSpacing:\"0.16em\",textTransform:\"uppercase\",color:soft,marginRight:6},children:label}),pill(\"Any age\",age===null,()=>setAge(null),\"all\"),ages.map(a=>pill(String(a),age===a,()=>setAge(a),String(a)))]}),/*#__PURE__*/_jsx(\"p\",{\"aria-live\":\"polite\",style:{margin:0,font:`400 14px/1.5 ${sans}`,color:soft,minHeight:21},children:age===null||count===null?\"\":count===0?emptyText:`${count} session${count===1?\"\":\"s\"} for age ${age}.`})]});}addPropertyControls(AgeFinder,{fonts:{type:ControlType.Object,title:\"Fonts\",description:\"Use the same font names as your text styles.\",controls:{body:{type:ControlType.String,title:\"Body\",defaultValue:\"Inter\"}}},label:{type:ControlType.String,title:\"Label\",defaultValue:\"My child is\"},from:{type:ControlType.Number,title:\"Youngest\",defaultValue:5,min:0,max:20,step:1},to:{type:ControlType.Number,title:\"Oldest\",defaultValue:15,min:1,max:25,step:1},listName:{type:ControlType.String,title:\"List layer\",defaultValue:\"Sessions List\",description:\"Name of the CMS list layer in the same section.\"},emptyText:{type:ControlType.String,title:\"No match\",defaultValue:\"No session for that age yet. Call us and we will help.\"},ink:{type:ControlType.Color,title:\"Text\",defaultValue:\"#1C211C\"},soft:{type:ControlType.Color,title:\"Muted\",defaultValue:\"#5E6158\"},accent:{type:ControlType.Color,title:\"Active\",defaultValue:\"#A8432C\"},fill:{type:ControlType.Color,title:\"Pill fill\",defaultValue:\"#FBF8F1\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AgeFinder\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AgeFinder.map"],"mappings":"A,2MAIG,SAAwBc,EAAU,EAAM,CAC3C,MAAoB,gBAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,WAAW,GAAGC,EAAWC,EAAM,KAAK,CAAC,EAAE,SAAsB,gBAAKC,EAAe,CAAC,GAAGD,CAAK,CAAC,CAAC,CA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