{"version":3,"file":"Filter_Chips.-9sIXmMi.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/bQvS3zGdib5DfcemGfgq/4uZJKujaHwUAJsiFEBj9/Filter_Chips.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Filter Chips — pill filters for a list of native cards (Work, Journal…).\n * How it works: give each card layer its tags in square brackets in the layer name,\n * e.g. \"Card Aube [identity packaging campaign]\". Clicking a chip hides the cards in the\n * same section whose tags don't match. The first chip (\"All work\") shows everything.\n * Chips: comma-separated labels. They match tags without the plural \"s\" (Campaigns ↔ campaign).\n * (\"[grid]\" is reserved for the Work View Toggle and is ignored here.)\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */const SANS=\"'Inter Tight', 'Inter Tight Placeholder', sans-serif\";const norm=s=>s.toLowerCase().trim().replace(/s$/,\"\");const tagsOf=el=>{const m=(el.getAttribute(\"data-framer-name\")||\"\").match(/\\[([^\\]]+)\\]/);if(!m||m[1].trim()===\"grid\")return null;return m[1].split(/[\\s,]+/).filter(Boolean).map(norm);};export default function FilterChips(props){const{chips=\"All work, Identity, Packaging, Campaigns, Digital, Strategy\",ink=\"#2B2B2D\",line=\"rgba(43,43,45,.1)\",fill=\"#FFFFFF\",style}=props;const list=String(chips).split(\",\").map(s=>s.trim()).filter(Boolean);const[on,setOn]=React.useState(0);const[hover,setHover]=React.useState(null);const ref=React.useRef(null);React.useEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas)return;// the nearest ancestor that holds tagged cards is the scope\nlet scope=ref.current;let cards=[];while(scope&&scope.parentElement){scope=scope.parentElement;cards=Array.from(scope.querySelectorAll(\"[data-framer-name*='[']\")).filter(el=>tagsOf(el));if(cards.length)break;}const f=norm(list[on]||\"\");cards.forEach(el=>{const t=tagsOf(el)||[];const show=on===0||t.some(x=>x===f||x.startsWith(f)||f.startsWith(x));el.style.display=show?\"\":\"none\";});},[on,chips]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,role:\"group\",\"aria-label\":\"Filter\",style:{display:\"flex\",flexWrap:\"wrap\",gap:8,...style},children:list.map((label,i)=>{const active=i===on;return /*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-pressed\":active,onClick:()=>setOn(i),onPointerEnter:()=>setHover(i),onPointerLeave:()=>setHover(null),style:{all:\"unset\",cursor:\"pointer\",padding:\"10px 16px\",borderRadius:999,font:`500 13px/1.2 ${SANS}`,background:active?ink:fill,color:active?\"#fff\":ink,border:`1px solid ${active||hover===i?ink:line}`,transition:\"background .3s, color .3s, border-color .3s\"},children:label},i);})});}addPropertyControls(FilterChips,{chips:{type:ControlType.String,title:\"Chips\",defaultValue:\"All work, Identity, Packaging, Campaigns, Digital, Strategy\",description:\"Comma-separated. The first chip shows everything.\"},ink:{type:ControlType.Color,title:\"Ink\",defaultValue:\"#2B2B2D\"},fill:{type:ControlType.Color,title:\"Fill\",defaultValue:\"#FFFFFF\"},line:{type:ControlType.Color,title:\"Line\",defaultValue:\"rgba(43,43,45,.1)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FilterChips\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Filter_Chips.map"],"mappings":"+LASqT,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,QAAM,8DAA8D,MAAI,UAAU,OAAK,oBAAoB,OAAK,UAAU,SAAO,EAAY,EAAK,OAAO,CAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,EAAO,CAAC,EAAG,GAAOA,EAAe,CAAC,EAAO,CAAC,EAAM,GAAUA,EAAe,IAAI,EAAQ,EAAIC,EAAa,IAAI,EAC7Q,OAD+Q,MAAoB,CAAC,GAAG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