{"version":3,"file":"DataTableAdvanced.Bb336dhu.mjs","names":["_jsx","_jsxs","React.Fragment","__esmMin","x","init_jsx_runtime","c","p","init_npm_react_18_3_1","addPropertyControls","init_framer_ChujFWHC","ControlType","textAt","init_tokens","colors","rowCells","row","CELL_KEYS","key","beyondColumnCount","position","_row","rootProps","cellControls","controls","index","cellPadding","spec","count","left","right","normalizeSchoolDayTimeRange","value","isFeeLikeColumnName","columnName","formatIndianPriceDisplay","match","numericPortion","integerPartRaw","decimalPart","integerPart","formattedInteger","normalizeDisplayCellValue","timeNormalizedValue","DataTable","props","mode","showHeader","showCellBorders","rawColumns","rawRows","textColor","headerTextColor","headerBackground","evenRowBackground","oddRowBackground","borderColor","textAlign","style","columns","MAX_COLUMNS","rows","s","SPEC","type","rule","column","VERTICAL_ALIGN","line","lineIndex","rowIndex","cells","columnIndex","cellKey","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,SAASe,EAASC,EAAI,CAAC,OAAOC,EAAU,IAAIC,GAAKF,IAAME,EAAI,CAAE,CAAC,SAASC,EAAkBC,EAAS,CAAC,OAAOC,EAAKC,IAAY,MAAM,QAAQA,GAAW,OAAO,GAAGA,EAAU,QAAQ,OAAOF,CAAS,CAAC,SAASG,GAAc,CAAC,IAAMC,EAAS,CAAC,EAAuX,OAArXP,EAAU,SAASC,EAAIO,IAAQ,CAACD,EAASN,GAAK,CAAC,KAAKP,EAAY,OAAO,MAAM,QAAQc,EAAM,IAAI,aAAa,GAAG,gBAAgB,GAAK,GAAGA,IAAQ,EAAE,CAAC,EAAE,CAAC,OAAON,EAAkBM,EAAM,CAAC,CAAC,CAAC,EAAED,EAAS,GAAGN,EAAI,aAAa,CAAC,KAAKP,EAAY,OAAO,MAAM,QAAQc,EAAM,EAAE,cAAc,aAAa,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,GAAGA,IAAQ,EAAE,CAAC,EAAE,CAAC,OAAON,EAA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