{"version":3,"file":"ProgramFilter.eesZIMcJ.mjs","names":["useRef","useState","d","c","__esmMin","_e","de","c","init_jsx_runtime","init_npm_react_18_3_1","ce","init_framer_D6uXRwWs","addPropertyControls","ControlType","RenderTarget","F","C","ProgramFilter","props","isCanvas","ref","on","setOn","list","chips","findGrid","p","g","gridName","spansFor","out","left","count","r","apply","grid","bento","items","want","i","run","shown","it","categoryLayer","spans","cat","animate","css","ts","t","pick","align","c$1","init_ProgramFilter","init_Theme"],"sources":["https:/framerusercontent.com/modules/lB7NzaX9PhpIz9B6ErS2/eSrZbLsfq3N1jClmBNoX/ProgramFilter.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{C,F}from\"https://framerusercontent.com/modules/ZMtzPGDtJUig5p6F4vt7/UnzG9ArJ8tCcten7zGsi/Theme.js\";/**\n * Filter chips for a CMS Collection List. Each card needs a text layer named \"Category\" (bound to the\n * Category field); the list itself is found by its layer name (\"Program Grid\" by default).\n * Optional bento layout on desktop: 7 + 5 columns, then rows of three — like the HTML master.\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function ProgramFilter(props){const{chips,gridName,categoryLayer,bento,align}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const ref=useRef(null);const[on,setOn]=useState(0);const list=chips&&chips.length?chips:[\"All\",\"Create\",\"Discover\",\"Build\",\"Move\"];const findGrid=()=>{let p=ref.current;while(p){const g=p.querySelector(`[data-framer-name=\"${gridName}\"]`);if(g)return g;p=p.parentElement;}return null;};// bento spans: 7 + 5, then rows of three, and the last rows are rebalanced so no card sits alone\nconst spansFor=count=>{const out=[];let left=count;while(left>0){const r=left>=5&&!(left===6)?5:left;if(r===5)out.push(7,5,4,4,4);else if(r===6)out.push(7,5,6,6,6,6);else if(r===4)out.push(7,5,6,6);else if(r===3)out.push(4,4,4);else if(r===2)out.push(7,5);else out.push(12);left-=r;}return out;};const apply=(i,animate)=>{const grid=findGrid();if(!grid)return;if(bento)grid.setAttribute(\"data-wk-bento\",\"1\");const items=Array.from(grid.children);const want=(list[i]||\"\").trim().toLowerCase();const run=()=>{let n=0;const shown=items.filter(it=>i===0||(it.querySelector(`[data-framer-name=\"${categoryLayer}\"]`)?.textContent||\"\").trim().toLowerCase()===want).length;const spans=spansFor(shown);items.forEach(it=>{const cat=(it.querySelector(`[data-framer-name=\"${categoryLayer}\"]`)?.textContent||\"\").trim().toLowerCase();const show=i===0||cat===want;if(show){it.removeAttribute(\"data-wk-hide\");it.setAttribute(\"data-wk-span\",String(spans[n]||4));if(animate){it.setAttribute(\"data-wk-out\",\"1\");const d=n;setTimeout(()=>it.removeAttribute(\"data-wk-out\"),40+d*60);}n++;}else{it.setAttribute(\"data-wk-hide\",\"1\");it.removeAttribute(\"data-wk-span\");}});};if(!animate)return run();items.forEach(it=>it.setAttribute(\"data-wk-out\",\"1\"));setTimeout(run,matchMedia(\"(prefers-reduced-motion: reduce)\").matches?0:320);};useEffect(()=>{if(isCanvas)return;const css=document.createElement(\"style\");css.setAttribute(\"data-wk-filter\",\"1\");css.textContent=`[data-wk-hide]{display:none!important}\n[data-wk-out]{opacity:0!important;transform:scale(.94)!important}\n[data-wk-span]{transition:opacity .45s,transform .6s cubic-bezier(.22,1,.36,1)}\n@media (min-width:1000px){[data-wk-bento]{grid-template-columns:repeat(12,minmax(0,1fr))!important;grid-template-rows:none!important;grid-auto-rows:auto!important;align-items:stretch!important}\n[data-wk-bento]>[data-wk-span]{align-self:stretch!important;height:auto!important}[data-wk-bento]>[data-wk-span]>*{height:100%!important}[data-wk-bento]>[data-wk-span] [data-framer-name=\"Media\"]{flex:1 1 auto!important}\n[data-wk-bento]>[data-wk-span=\"6\"]{grid-column:span 6!important}[data-wk-bento]>[data-wk-span=\"12\"]{grid-column:span 12!important}\n[data-wk-bento]>[data-wk-span=\"7\"]{grid-column:span 7!important}[data-wk-bento]>[data-wk-span=\"5\"]{grid-column:span 5!important}[data-wk-bento]>[data-wk-span=\"4\"]{grid-column:span 4!important}}`;document.head.appendChild(css);const ts=[0,300,1200].map(t=>setTimeout(()=>apply(on,false),t));return()=>{css.remove();ts.forEach(clearTimeout);};},[isCanvas,gridName,categoryLayer,bento]);const pick=i=>{if(i===on)return;setOn(i);if(!isCanvas)apply(i,true);};return /*#__PURE__*/_jsx(\"div\",{ref:ref,role:\"group\",\"aria-label\":\"Filter programs\",style:{display:\"flex\",flexWrap:\"wrap\",gap:8,justifyContent:align===\"right\"?\"flex-end\":\"flex-start\"},children:list.map((c,i)=>/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-pressed\":on===i,onClick:()=>pick(i),style:{height:42,padding:\"0 18px\",borderRadius:99,border:0,cursor:\"pointer\",boxShadow:`inset 0 0 0 1.5px ${C.ink}`,background:on===i?C.ink:\"transparent\",color:on===i?C.cream:C.ink,font:`600 13px/1 ${F.display}`,letterSpacing:\".06em\",textTransform:\"uppercase\",transition:\"background .3s, color .3s\"},children:c},i))});}ProgramFilter.defaultProps={chips:[\"All\",\"Create\",\"Discover\",\"Build\",\"Move\"],gridName:\"Program Grid\",categoryLayer:\"Category\",bento:true,align:\"right\"};addPropertyControls(ProgramFilter,{chips:{type:ControlType.Array,title:\"Chips\",control:{type:ControlType.String},defaultValue:[\"All\",\"Create\",\"Discover\",\"Build\",\"Move\"],description:\"First chip shows everything. Others must match the Category text on the cards.\"},gridName:{type:ControlType.String,title:\"List layer\",defaultValue:\"Program Grid\"},categoryLayer:{type:ControlType.String,title:\"Category layer\",defaultValue:\"Category\"},bento:{type:ControlType.Boolean,title:\"Bento layout\",defaultValue:true,description:\"Desktop: 7 + 5 columns, then rows of three (live site).\"},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"right\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProgramFilter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProgramFilter.map"],"mappings":"A,uPAMG,SAAwBiB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,WAAS,gBAAc,QAAM,SAAOC,EAAYC,EAASL,EAAa,QAAQ,IAAIA,EAAa,OAAaM,EAAIpB,EAAO,IAAI,EAAO,CAACqB,EAAGC,GAAOrB,EAAS,CAAC,EAAQsB,EAAKC,GAAOA,EAAM,OAAOA,EAAM,CAAC,MAAM,SAAS,WAAW,QAAQ,MAAM,EAAQC,MAAa,CAAC,IAAIC,EAAEN,EAAI,QAAQ,KAAMM,GAAE,CAAC,IAAMC,EAAED,EAAE,cAAc,sBAAsBE,EAAS,GAAG,EAAE,GAAGD,EAAE,OAAOA,EAAE,EAAED,EAAE,aAAc,CAAC,OAAO,IAAK,EACvbG,EAAS,GAAO,CAAC,IAAMC,EAAI,CAAC,EAAMC,EAAKC,EAAM,KAAMD,EAAK,GAAE,CAAC,IAAME,EAAEF,GAAM,GAAKA,IAAO,EAAG,EAAEA,EAAQE,IAAI,EAAEH,EAAI,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,EAAUG,IAAI,EAAEH,EAAI,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAUG,IAAI,EAAEH,EAAI,KAAK,EAAE,EAAE,EAAE,CAAC,EAAUG,IAAI,EAAEH,EAAI,KAAK,EAAE,EAAE,CAAC,EAAUG,IAAI,EAAEH,EAAI,KAAK,EAAE,CAAC,EAAOA,EAAI,KAAK,EAAE,EAAE,GAAMG,CAAE,CAAC,OAAOH,CAAI,EAAQI,GAAO,EAAE,IAAU,CAAC,IAAMC,EAAKV,EAAS,EAAE,GAAG,CAACU,EAAK,OAAUC,GAAMD,EAAK,aAAa,gBAAgB,GAAG,EAAE,IA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