{"version":3,"file":"TopicChips.d_ohnsaM.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/JDRJ0exQIlfhfCakPN1U/11KWqweWyfNTi9h1aMEF/TopicChips.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Ambra · Topic chips\n * Links that set a query parameter (e.g. ?category=Buying) so a CMS list bound to a\n * page variable with that query param filters itself. The active chip is read from the URL.\n * Clicks update the URL in place (no page load), so the list filters without jumping to the top.\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TopicChips(props){const{param=\"category\",allLabel=\"All notes\",topics=[\"Buying\",\"Selling\",\"Investing\"],gap=8,fill=\"rgba(255,255,255,0.6)\",border=\"rgba(0,0,0,0.12)\",color=\"#2B2724\",activeFill=\"#141210\",activeColor=\"#FFFFFF\",font}=props;const[active,setActive]=useState(\"\");useEffect(()=>{if(typeof window===\"undefined\"||RenderTarget.current()===RenderTarget.canvas)return;const read=()=>setActive(new URLSearchParams(window.location.search).get(param)||\"\");read();window.addEventListener(\"popstate\",read);return()=>window.removeEventListener(\"popstate\",read);},[param]);const items=[{label:allLabel,value:\"\"},...topics.map(t=>({label:t,value:t}))];const base=typeof window!==\"undefined\"?window.location.pathname:\"\";return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexWrap:\"wrap\",gap,alignItems:\"center\"},children:items.map(it=>{const on=it.value===active;return /*#__PURE__*/_jsx(\"a\",{href:it.value?`${base}?${param}=${encodeURIComponent(it.value)}`:base,\"aria-current\":on?\"page\":undefined,onClick:e=>{// Filter in place: update the URL without a page load, so the\n// CMS list re-filters and the scroll position stays where it is.\nif(e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0)return;e.preventDefault();if(it.value===active)return;const url=it.value?`${base}?${param}=${encodeURIComponent(it.value)}`:base;// Empty state on purpose: Framer's own history state carries a scroll\n// position that it would restore, jumping the page to the top.\nwindow.history.pushState({},\"\",url);window.dispatchEvent(new PopStateEvent(\"popstate\"));setActive(it.value);},style:{display:\"inline-flex\",alignItems:\"center\",padding:\"9px 14px\",borderRadius:999,textDecoration:\"none\",fontFamily:\"Satoshi, sans-serif\",fontSize:14,fontWeight:500,lineHeight:1,letterSpacing:\"0.01em\",...font,background:on?activeFill:fill,color:on?activeColor:color,border:`1px solid ${on?activeFill:border}`,transition:\"background 0.25s, color 0.25s, border-color 0.25s\",cursor:\"pointer\"},onMouseEnter:e=>{if(!on)e.currentTarget.style.borderColor=color;},onMouseLeave:e=>{if(!on)e.currentTarget.style.borderColor=border;},children:it.label},it.label);})});}addPropertyControls(TopicChips,{param:{type:ControlType.String,title:\"Query param\",defaultValue:\"category\"},allLabel:{type:ControlType.String,title:\"All label\",defaultValue:\"All notes\"},topics:{type:ControlType.Array,title:\"Topics\",control:{type:ControlType.String},defaultValue:[\"Buying\",\"Selling\",\"Investing\"]},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:24},fill:{type:ControlType.Color,title:\"Fill\",defaultValue:\"rgba(255,255,255,0.6)\"},border:{type:ControlType.Color,title:\"Border\",defaultValue:\"rgba(0,0,0,0.12)\"},color:{type:ControlType.Color,title:\"Text\",defaultValue:\"#2B2724\"},activeFill:{type:ControlType.Color,title:\"Active fill\",defaultValue:\"#141210\"},activeColor:{type:ControlType.Color,title:\"Active text\",defaultValue:\"#FFFFFF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TopicChips\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TopicChips.map"],"mappings":"sMAOG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,QAAM,WAAW,WAAS,YAAY,SAAO,CAAC,SAAS,UAAU,WAAW,EAA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