{"version":3,"file":"TableFromCSV.Bk1UHShd.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/ZJgb882hel9xe04OyemV/At05FABuhtp5TeCcfalc/TableFromCSV.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect}from\"react\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function TableFromCSV(props){const[data,setData]=useState([]);const[headers,setHeaders]=useState([]);useEffect(()=>{// Parse CSV data\nconst parseCSV=csv=>{const lines=csv.split(\"\\n\").filter(line=>line.trim()!==\"\")// Split by line and remove any empty lines\n;const parsedHeaders=lines[0].split(\",\").map(header=>header.trim())// Trim each header\n;const parsedData=lines.slice(1).map(line=>{const values=line.split(\",\").map(value=>value.trim())// Trim each cell value\n;const row={};parsedHeaders.forEach((header,index)=>{row[header]=values[index]||\"\"// Handle missing values\n;});return row;});setHeaders(parsedHeaders);setData(parsedData);};parseCSV(props.csv);},[]);return /*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,children:data.length>0&&/*#__PURE__*/_jsxs(\"table\",{style:tableStyle,children:[/*#__PURE__*/_jsx(\"thead\",{children:/*#__PURE__*/_jsx(\"tr\",{children:headers.map((header,index)=>/*#__PURE__*/_jsx(\"th\",{style:headerCellStyle,children:header},index))})}),/*#__PURE__*/_jsx(\"tbody\",{children:data.map((row,rowIndex)=>/*#__PURE__*/_jsx(\"tr\",{children:headers.map((header,index)=>/*#__PURE__*/_jsx(\"td\",{style:cellStyle,children:row[header]},index))},rowIndex))})]})});}const wrapperStyle={overflowX:\"auto\",margin:\"0 -24px -24px\",paddingBottom:\"24px\"};const tableStyle={color:\"white\",borderCollapse:\"collapse\",fontFamily:'\"Haas Grot Text R Web 55 Roman\", \"Haas Grot Text R Web 55 Roman Placeholder\", sans-serif',fontSize:\"14px\",lineHeight:\"20px\",minWidth:\"520px\",margin:\"0 24px\"};const cellStyle={padding:\"8px 12px\",border:\"1px solid rgba(255,255,255,0.1)\",textAlign:\"left\"};const headerCellStyle={...cellStyle,fontFamily:'\"Haas Grot Text R Web 75 Bold\", \"Haas Grot Text R Web 75 Bold Placeholder\", sans-serif'};TableFromCSV.defaultProps={csv:\"Value, value, value\"};addPropertyControls(TableFromCSV,{csv:{type:ControlType.String,title:\"CSV\",defaultValue:\"Value, value, value\",displayTextArea:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TableFromCSV\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TableFromCSV.map"],"mappings":"oLAMG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,EAAK,GAASA,EAAS,EAAE,CAAC,CAAM,CAAC,EAAQ,GAAYA,EAAS,EAAE,CAAC,CAK1B,OAL2B,MAAc,EACtH,GAAK,CAAC,IAAM,EAAM,EAAI,MAAM;EAAK,CAAC,OAAO,GAAM,EAAK,MAAM,GAAG,GAAG,CACxE,EAAc,EAAM,GAAG,MAAM,IAAI,CAAC,IAAI,GAAQ,EAAO,MAAM,CAAC,CAC5D,EAAW,EAAM,MAAM,EAAE,CAAC,IAAI,GAAM,CAAC,IAAM,EAAO,EAAK,MAAM,IAAI,CAAC,IAAI,GAAO,EAAM,MAAM,CAAC,CAC1F,EAAI,EAAE,CACT,OADU,EAAc,SAAS,EAAO,IAAQ,CAAC,EAAI,GAAQ,EAAO,IAAQ,IAC7E,CAAQ,GAAM,CAAC,EAAW,EAAc,CAAC,EAAQ,EAAW,GAAY,EAAM,IAAI,EAAG,EAAE,CAAC,CAAqB,EAAK,MAAM,CAAC,MAAM,EAAa,SAAS,EAAK,OAAO,GAAgB,EAAM,QAAQ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