{"version":3,"file":"Table.Bty3In40.mjs","names":[],"sources":["https:/framerusercontent.com/modules/jPswHC1nOUy18ZfP1wYc/mZYLsHJ7gStRAaqHwJ3r/Table.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";export default function CustomTable({data=\"\",columns=6,cellPadding=16,backgroundColor=\"#ffffff\",textColor=\"#000000\",borderColor=\"#e5e7eb\",headerColor=\"#333333\"}){// Parse the input text data into rows and cells\nconst parseTableData=text=>{if(!text||typeof text!==\"string\"){console.warn(\"CustomTable: Invalid or missing data prop\");return[[]];}const rows=text.split(\"\\n\").filter(row=>row.trim());return rows.map(row=>row.split(\"|\").map(cell=>cell.trim()));};const tableData=parseTableData(data);// If no data, show a message\nif(tableData.length===1&&tableData[0].length===0){return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"16px\",textAlign:\"center\",border:\"1px solid #e5e7eb\"},children:\"No table data provided\"});}// Function to determine text color based on background brightness\nconst getTextColor=backgroundColor=>{try{const hex=backgroundColor.replace(\"#\",\"\");const r=parseInt(hex.substr(0,2),16);const g=parseInt(hex.substr(2,2),16);const b=parseInt(hex.substr(4,2),16);const brightness=(r*299+g*587+b*114)/1e3;return brightness>128?\"#000000\":\"#ffffff\";}catch(error){return textColor;}};// Generate unique key for a cell\nconst generateCellKey=(rowIndex,colIndex,content)=>{return`${rowIndex}-${colIndex}-${content}`.replace(/\\s+/g,\"-\");};return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",overflowX:\"auto\"},children:/*#__PURE__*/_jsx(\"table\",{style:{width:\"100%\",borderCollapse:\"collapse\"},children:/*#__PURE__*/_jsx(\"tbody\",{children:tableData.map((row,rowIndex)=>/*#__PURE__*/_jsx(\"tr\",{children:Array.from({length:columns}).map((_,colIndex)=>{const cellContent=row[colIndex]||\"\";const bgColor=rowIndex===0?headerColor:backgroundColor;const cellTextColor=getTextColor(bgColor);return /*#__PURE__*/_jsx(\"td\",{style:{padding:cellPadding,backgroundColor:bgColor,color:cellTextColor,border:`1px solid ${borderColor}`},children:cellContent},generateCellKey(rowIndex,colIndex,cellContent));})},`row-${rowIndex}-${row.join(\"-\")}`))})})});}addPropertyControls(CustomTable,{data:{type:ControlType.String,title:\"Table Data\",defaultValue:\"Header1|Header2|Header3\\nValue1|Value2|Value3\",displayTextArea:true},columns:{type:ControlType.Number,title:\"Columns\",defaultValue:3,min:1,max:10,step:1},cellPadding:{type:ControlType.Number,title:\"Cell Padding\",defaultValue:16,min:0,max:40,step:1},backgroundColor:{type:ControlType.Color,title:\"Background Color\"},textColor:{type:ControlType.Color,title:\"Text Color\"},borderColor:{type:ControlType.Color,title:\"Border Color\"},headerColor:{type:ControlType.Color,title:\"Header Color\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomTable\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Table.map"],"mappings":"iOAA+F,SAAwB,EAAY,CAAC,OAAK,GAAG,UAAQ,EAAE,cAAY,GAAG,kBAAgB,UAAU,YAAU,UAAU,cAAY,UAAU,cAAY,UAAU,CAAC,CAChQ,IAAM,EAAe,GAAM,CAAC,IAAI,UAAa,GAAO,SAAoE,MAA1D,SAAQ,KAAK,4CAA4C,CAAO,CAAC,CAAG,CAAA,MAAQ,EAAK,EAAK,MAAM;EAAK,CAAC,OAAO,GAAK,EAAI,MAAM,CAAC,CAAC,MAAO,GAAK,IAAI,GAAK,EAAI,MAAM,IAAI,CAAC,IAAI,GAAM,EAAK,MAAM,CAAC,CAAC,AAAE,EAAO,EAAU,EAAe,EAAK,CAC1R,GAAG,EAAU,SAAS,GAAG,EAAU,GAAG,SAAS,EAAG,MAAoB,GAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,UAAU,SAAS,OAAO,mBAAoB,EAAC,SAAS,wBAAyB,EAAC,CAC1L,IAAM,EAAa,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