{"version":3,"file":"TableWithFilter.BdMuafoR.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/RSnvLji32i0Xm2QuoLgz/NglA0PIoS20Njsuqhaq1/TableWithFilter.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Configure your Framer component props below\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n *\n */export function TableWithFilter({dataUrl}){const[data,setData]=useState(null);const[searchTerm,setSearchTerm]=useState(\"\");// Fetch data from the passed-in URL\nuseEffect(()=>{if(!dataUrl)return;fetch(dataUrl).then(res=>res.json()).then(jsonData=>setData(jsonData)).catch(err=>console.error(\"Error fetching data:\",err));},[dataUrl]);// Determine if data is an array (no descriptions) or object (with descriptions)\nconst isArrayData=Array.isArray(data);// Convert data into a consistent array-of-[key, value] structure\nlet entries=[];if(isArrayData){// data is something like [\"Airbrake\", \"Asana\", \"GitHub\", ...]\n// Convert each string into [detectorName, undefined]\nentries=(data||[]).map(item=>[item,undefined]);}else{// data is an object like { \"GitHub\": \"desc\", \"GitLab\": \"desc\" }\n// Convert to [key, value]\nentries=Object.entries(data||{});}// Simple filter by key or value\nconst filteredEntries=entries.filter(([key,value])=>{const term=searchTerm.toLowerCase();return key.toLowerCase().includes(term)||(value!==null&&value!==void 0?value:\"\").toLowerCase().includes(term);});return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(\"input\",{type:\"text\",placeholder:\"Filter...\",value:searchTerm,onChange:e=>setSearchTerm(e.target.value),style:inputStyle}),/*#__PURE__*/_jsxs(\"table\",{style:tableStyle,children:[/*#__PURE__*/_jsx(\"thead\",{children:/*#__PURE__*/_jsxs(\"tr\",{style:headerRowStyle,children:[/*#__PURE__*/_jsx(\"th\",{style:cellStyle,children:\"Name\"}),!isArrayData&&/*#__PURE__*/_jsx(\"th\",{style:cellStyle,children:\"Description\"})]})}),/*#__PURE__*/_jsx(\"tbody\",{children:filteredEntries.map(([detector,description])=>/*#__PURE__*/_jsxs(\"tr\",{style:rowStyle,children:[/*#__PURE__*/_jsx(\"td\",{style:{...cellStyle,fontFamily:\"monospace\"},children:detector}),!isArrayData&&/*#__PURE__*/_jsx(\"td\",{style:cellStyle,children:description})]},detector))})]})]});}addPropertyControls(TableWithFilter,{dataUrl:{title:\"JSON URL\",type:ControlType.String}});const containerStyle={backgroundColor:\"rgba(72, 58, 49, 0.08)\",padding:\"48px\",fontFamily:'\"National Park  Regular\", \"National Park  Regular Placeholder\", sans-serif',color:\"#483A31\",borderRadius:\"6px\",overflow:\"scroll\"};const inputStyle={backgroundColor:\"#F4EFE9\",border:\"0\",borderRadius:\"4px\",padding:\"8px\",fontSize:\"16px\",fontFamily:'\"National Park  Regular\", \"National Park  Regular Placeholder\", sans-serif',color:\"#483A31\",marginBottom:\"12px\",width:\"100%\"};const tableStyle={width:\"100%\",borderCollapse:\"collapse\",borderRadius:\"4px\",overflow:\"hidden\"};const headerRowStyle={background:\"rgba(72, 58, 49, 0.08)\"};const rowStyle={borderBottom:\"1px solid rgba(72, 58, 49, 0.08)\"};const cellStyle={padding:\"8px 12px\",textAlign:\"left\"};\nexport const __FramerMetadata__ = {\"exports\":{\"TableWithFilter\":{\"type\":\"reactComponent\",\"name\":\"TableWithFilter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableWithFilter.map"],"mappings":"iRAMG,SAAgB,EAAgB,CAAC,UAAQ,CAAC,CAAC,GAAK,CAAC,EAAK,EAAQ,CAACA,EAAS,MAAW,CAAC,EAAW,EAAc,CAACA,EAAS,IAC1H,MAAc,CAAK,GAAe,MAAM,GAAS,KAAK,GAAK,EAAI,QAAQ,KAAK,GAAU,EAAQ,IAAW,MAAM,G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