{"version":3,"file":"DataTableAdvanced.CWVuhQzR.mjs","names":["React.Fragment","__esmMin","x","init_jsx_runtime","c","p","init_npm_react_18_3_1","addPropertyControls","init_framer_BWFVvmND","ControlType","textAt","init_tokens","colors","rowCells","CELL_KEYS","row","key","beyondColumnCount","rootProps","position","cellControls","controls","index","cellPadding","left","spec","right","count","normalizeSchoolDayTimeRange","value","isFeeLikeColumnName","columnName","formatIndianPriceDisplay","match","numericPortion","integerPartRaw","decimalPart","integerPart","formattedInteger","normalizeDisplayCellValue","timeNormalizedValue","DataTable","rawColumns","rawRows","props","columns","MAX_COLUMNS","rows","s","SPEC","mode","type","rule","borderColor","style","evenRowBackground","textColor","column","showHeader","headerBackground","headerTextColor","showCellBorders","VERTICAL_ALIGN","lineIndex","line","cells","rowIndex","oddRowBackground","cellKey","columnIndex","fontWeight","cellValue","displayCellValue","DEFAULTS","init_DataTableAdvanced"],"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\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DataTableAdvanced.map"],"mappings":"A,yOAAgW,SAASa,EAAS,EAAI,CAAC,OAAOC,EAAU,IAAI,GAAKC,IAAMC,EAAI,CAAE,CAAC,SAASC,EAAkB,EAAS,CAAC,OAAO,EAAK,IAAY,MAAM,QAAQC,GAAW,OAAO,GAAGA,EAAU,QAAQ,OAAOC,CAAS,CAAC,SAASC,GAAc,CAAC,IAAMC,EAAS,CAAC,EAAuX,OAArXP,EAAU,SAAS,EAAI,IAAQ,CAAC,EAASE,GAAK,CAAC,KAAKP,EAAY,OAAO,MAAM,QAAQa,EAAM,IAAI,aAAa,GAAG,gBAAgB,GAAK,GAAGA,IAAQ,EAAE,CAAC,EAAE,CAAC,OAAOL,EAAkBK,EAAM,CAAC,CAAC,CAAC,EAAE,EAAS,GAAGN,EAAI,aAAa,CAAC,KAAKP,EAAY,OAAO,MAAM,QAAQa,EAAM,EAAE,cAAc,aAAa,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,GAAGA,IAAQ,EAAE,CAAC,EAAE,CAAC,OAAOL,EAAkBK,EAAM,CAAC,CAAC,CAA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