{"version":3,"file":"DataTableAdvanced.D6XM7J1p.mjs","names":["React.Fragment"],"sources":["https:/framerusercontent.com/modules/i8sgJt9yKGohvpalxrCH/F67Bxj9AEf77leRSS4ma/DataTableAdvanced.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{colors,textAt}from\"https://framerusercontent.com/modules/lkg7fu5StluOFz8ZhA7m/RfwQbZ5ZBthEk87wVTgo/tokens.js\";const MAX_COLUMNS=12;const CELL_KEYS=Array.from({length:MAX_COLUMNS},(_,index)=>`cell${index+1}`);function rowCells(row){return CELL_KEYS.map(key=>row?.[key]);}function beyondColumnCount(position){return(_row,rootProps)=>Array.isArray(rootProps?.columns)&&rootProps.columns.length<position;}function cellControls(){const controls={};CELL_KEYS.forEach((key,index)=>{controls[key]={type:ControlType.String,title:`Cell ${index+1}`,defaultValue:\"\",displayTextArea:true,...index===0?{}:{hidden:beyondColumnCount(index+1)}};controls[`${key}FontWeight`]={type:ControlType.Number,title:`Cell ${index+1} Font Weight`,defaultValue:400,min:100,max:900,step:100,...index===0?{}:{hidden:beyondColumnCount(index+1)}};});return controls;}// ─────────────────────────────────────────────\n// Default colours\n// ─────────────────────────────────────────────\nconst DEFAULTS={textColor:colors.black[40],headerTextColor:colors.black[40],headerBackground:colors.coral[40],evenRowBackground:colors.white[40],oddRowBackground:colors.coral[10],borderColor:colors.coral[60],textAlign:\"left\"};const SPEC={desktop:{borderWidth:2,padY:16,padEdge:20,padInner:20},tablet:{borderWidth:1,padY:16,padEdge:20,padInner:16},phone:{borderWidth:1,padY:8,padEdge:8,padInner:8}};const VERTICAL_ALIGN=\"top\";function cellPadding(spec,index,count){const left=index===0?spec.padEdge:spec.padInner;const right=index===count-1?spec.padEdge:spec.padInner;return`${spec.padY}px ${right}px ${spec.padY}px ${left}px`;}function normalizeSchoolDayTimeRange(value){const schoolDayPattern=/^\\s*9(?::00)?\\s*AM\\s*(?:to|[-–—])\\s*5:30\\s*PM\\s*$/u;if(schoolDayPattern.test(value)){return\"9:00 AM - 5:30 PM\";}return value;}function isFeeLikeColumnName(columnName){return/(fee|price|cost|amount|charge)/i.test(columnName);}function formatIndianPriceDisplay(value){const monetaryPattern=/^(?:₹|Rs\\.?|INR)?\\s*([\\d][\\d,\\s]*(?:\\.\\d+)?)$/i;const match=value.trim().match(monetaryPattern);if(!match)return value;const numericPortion=match[1].replace(/[,\\s]/g,\"\");if(!/^\\d+(?:\\.\\d+)?$/.test(numericPortion))return value;const[integerPartRaw,decimalPart]=numericPortion.split(\".\");const integerPart=Number(integerPartRaw);if(!Number.isFinite(integerPart))return value;const formattedInteger=new Intl.NumberFormat(\"en-IN\",{maximumFractionDigits:0}).format(integerPart);return decimalPart!==undefined?`₹ ${formattedInteger}.${decimalPart}`:`₹ ${formattedInteger}`;}function normalizeDisplayCellValue(value,columnName){const timeNormalizedValue=normalizeSchoolDayTimeRange(value);if(!isFeeLikeColumnName(columnName)){return timeNormalizedValue;}return formatIndianPriceDisplay(timeNormalizedValue);}// ─────────────────────────────────────────────\n// Component\n// ─────────────────────────────────────────────\n/**\n * @framerIntrinsicWidth 1200\n * @framerIntrinsicHeight 120\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function DataTable(props){const{mode,showHeader,showCellBorders,columns:rawColumns,rows:rawRows,textColor,headerTextColor,headerBackground,evenRowBackground,oddRowBackground,borderColor,textAlign,style}=props;const columns=(Array.isArray(rawColumns)?rawColumns:[]).slice(0,MAX_COLUMNS);const rows=Array.isArray(rawRows)?rawRows:[];const s=SPEC[mode]??SPEC.desktop;const type=textAt(\"b3Regular\",SPEC[mode]?mode:\"desktop\");const rule=`${s.borderWidth}px solid ${borderColor}`;return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",overflowX:\"auto\",...style},children:/*#__PURE__*/_jsxs(\"table\",{style:{width:\"100%\",tableLayout:\"fixed\",borderCollapse:\"collapse\",border:rule,background:evenRowBackground,color:textColor,textAlign:\"left\",...type},children:[/*#__PURE__*/_jsx(\"colgroup\",{children:columns.map((column,index)=>/*#__PURE__*/_jsx(\"col\",{style:{width:column?.width||undefined}},index))}),showHeader&&/*#__PURE__*/_jsx(\"thead\",{children:/*#__PURE__*/_jsx(\"tr\",{style:{background:headerBackground,color:headerTextColor},children:columns.map((column,index)=>/*#__PURE__*/_jsx(\"th\",{scope:\"col\",style:{padding:cellPadding(s,index,columns.length),borderBottom:rule,borderRight:showCellBorders&&index<columns.length-1?rule:undefined,textAlign:textAlign,fontWeight:type.fontWeight,verticalAlign:VERTICAL_ALIGN,color:headerTextColor},children:column?.name?.split(\"\\n\").map((line,lineIndex)=>/*#__PURE__*/_jsxs(React.Fragment,{children:[lineIndex>0&&/*#__PURE__*/_jsx(\"br\",{}),line]},lineIndex))},index))})}),/*#__PURE__*/_jsx(\"tbody\",{children:rows.map((row,rowIndex)=>{const cells=rowCells(row);return /*#__PURE__*/_jsx(\"tr\",{style:{background:rowIndex%2===0?evenRowBackground:oddRowBackground},children:columns.map((column,columnIndex)=>{const cellKey=CELL_KEYS[columnIndex];const fontWeight=row?.[`${cellKey}FontWeight`]??400;const cellValue=cells[columnIndex];const displayCellValue=typeof cellValue===\"string\"?normalizeDisplayCellValue(cellValue,column?.name??\"\"):cellValue;return /*#__PURE__*/_jsx(\"td\",{style:{padding:cellPadding(s,columnIndex,columns.length),verticalAlign:VERTICAL_ALIGN,color:textColor,borderRight:showCellBorders&&columnIndex<columns.length-1?rule:undefined,borderBottom:showCellBorders&&rowIndex<rows.length-1?rule:undefined,textAlign:textAlign,fontWeight:fontWeight},children:displayCellValue?.split(\"\\n\").map((line,lineIndex)=>/*#__PURE__*/_jsxs(React.Fragment,{children:[lineIndex>0&&/*#__PURE__*/_jsx(\"br\",{}),line]},lineIndex))},columnIndex);})},rowIndex);})})]})});}// ─────────────────────────────────────────────\n// Property Controls\n// ─────────────────────────────────────────────\naddPropertyControls(DataTable,{mode:{type:ControlType.Enum,title:\"Mode\",options:[\"desktop\",\"tablet\",\"phone\"],optionTitles:[\"Desktop\",\"Tablet\",\"Phone\"],defaultValue:\"desktop\"},showHeader:{type:ControlType.Boolean,title:\"Show Header\",defaultValue:true},showCellBorders:{type:ControlType.Boolean,title:\"Cell Borders\",defaultValue:false},textAlign:{type:ControlType.Enum,title:\"Cell Alignment\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:DEFAULTS.textColor},headerTextColor:{type:ControlType.Color,title:\"Header Text\",defaultValue:DEFAULTS.headerTextColor},headerBackground:{type:ControlType.Color,title:\"Header Background\",defaultValue:DEFAULTS.headerBackground},evenRowBackground:{type:ControlType.Color,title:\"Even Row Background\",defaultValue:DEFAULTS.evenRowBackground},oddRowBackground:{type:ControlType.Color,title:\"Odd Row Background\",defaultValue:DEFAULTS.oddRowBackground},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:DEFAULTS.borderColor},columns:{type:ControlType.Array,title:\"Columns\",maxCount:MAX_COLUMNS,control:{type:ControlType.Object,title:\"Column\",controls:{name:{type:ControlType.String,title:\"Name\",defaultValue:\"Column\",displayTextArea:true},width:{type:ControlType.String,title:\"Width\",placeholder:\"auto\",description:\"Share of the table, e.g. 40%. Blank splits evenly.\"}}},defaultValue:[{name:\"Column 1\",width:\"\"},{name:\"Column 2\",width:\"\"},{name:\"Column 3\",width:\"\"}]},rows:{type:ControlType.Array,title:\"Rows\",control:{type:ControlType.Object,title:\"Row\",controls:{...cellControls()}},defaultValue:[]}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DataTable\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicWidth\":\"1200\",\"framerIntrinsicHeight\":\"120\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__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