{"version":3,"sources":["../src/components/tables/table-elements.tsx","../src/components/tables/table.tsx"],"names":["React","Caption","children","props","fp_default","Thead","Tbody","Tr","Td","Table","id","RenderHead","data","head","item","index","RenderBody","rec","RenderTable","tblBody","tblCaption","tblHead"],"mappings":"yCAEA,OAAOA,MAAW,QAGX,IAAMC,EAAU,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAM,IAEzCH,EAAA,cAACI,EAAA,CAAG,GAAG,UAAW,GAAGD,GAClBD,CACH,EAISG,EAAQ,CAAC,CAAE,SAAAH,EAAU,GAAGC,CAAM,IACzCH,EAAA,cAACI,EAAA,CAAG,GAAG,QAAS,GAAGD,GAChBD,CACH,EAGWI,EAAQ,CAAC,CAAE,SAAAJ,EAAU,GAAGC,CAAM,IACzCH,EAAA,cAACI,EAAA,CAAG,GAAG,QAAS,GAAGD,GAChBD,CACH,EAGWK,EAAK,CAAC,CAAE,SAAAL,EAAU,GAAGC,CAAM,IACtCH,EAAA,cAACI,EAAA,CAAG,GAAG,KAAM,GAAGD,GACbD,CACH,EAGWM,EAAK,CAAC,CAAE,SAAAN,EAAU,GAAGC,CAAM,IACtCH,EAAA,cAACI,EAAA,CAAG,GAAG,KAAM,GAAGD,GACbD,CACH,EAGWO,EAAQ,CAAC,CAAE,GAAAC,EAAI,SAAAR,EAAU,GAAGC,CAAM,IAE3CH,EAAA,cAACI,EAAA,CACC,GAAG,UACH,GAAIM,EACH,GAAGP,EACJ,aAAW,iBAEXH,EAAA,cAAC,aAAOE,CAAS,CACnB,EAIJO,EAAM,YAAc,QACpBR,EAAQ,YAAc,UACtBI,EAAM,YAAc,QACpBC,EAAM,YAAc,QACpBC,EAAG,YAAc,KACjBC,EAAG,YAAc,KCpDjB,OAAOR,MAAW,QAaX,IAAMW,EAAcC,GAAa,CACtC,IAAMC,EAAOD,EAAK,IAAI,CAACE,EAAMC,IACpBf,EAAA,cAAC,MAAG,IAAKe,GAAQD,CAAK,CAC9B,EACD,OAAOd,EAAA,cAAC,UAAIa,CAAK,CACnB,EAKaG,EAAcJ,GAAoC,CAC7D,IAAMK,EAAML,EAAK,IAAI,CAACE,EAAMC,IAExBf,EAAA,cAAC,MAAG,IAAKe,EAGT,CAEH,EACD,OAAOf,EAAA,cAACM,EAAA,KAAOW,CAAI,CACrB,EAMaC,EAAc,CAAC,CAAE,QAAAC,EAAS,WAAAC,EAAY,QAAAC,CAAQ,IAEvDrB,EAAA,cAACS,EAAA,KACEW,GAAcpB,EAAA,cAACC,EAAA,KAASmB,CAAW,EACpCpB,EAAA,cAACK,EAAA,KACCL,EAAA,cAACO,EAAA,KAAIc,CAAQ,CACf,EACArB,EAAA,cAACM,EAAA,KAAOa,CAAQ,CAClB,EAIJD,EAAY,YAAc,MAC1BF,EAAW,YAAc,aACzBL,EAAW,YAAc","sourcesContent":["import FP from '../fp'\nimport { ComponentProps } from '../../types'\nimport React from 'react'\n\n\nexport const Caption = ({ children, ...props }: ComponentProps) => {\n  return (\n    <FP as=\"caption\" {...props}>\n      {children}\n    </FP>\n  )\n}\n\nexport const Thead = ({ children, ...props }: ComponentProps) => (\n  <FP as=\"thead\" {...props}>\n    {children}\n  </FP>\n)\n\nexport const Tbody = ({ children, ...props }: ComponentProps) => (\n  <FP as=\"tbody\" {...props}>\n    {children}\n  </FP>\n)\n\nexport const Tr = ({ children, ...props }: ComponentProps) => (\n  <FP as=\"tr\" {...props}>\n    {children}\n  </FP>\n)\n\nexport const Td = ({ children, ...props }: ComponentProps) => (\n  <FP as=\"td\" {...props}>\n    {children}\n  </FP>\n)\n\nexport const Table = ({ id, children, ...props }: ComponentProps) => {\n  return (\n    <FP\n      as=\"section\"\n      id={id}\n      {...props}\n      data-style=\"table-wrapper\"\n    >\n      <table>{children}</table>\n    </FP>\n  )\n}\n\nTable.displayName = 'Table'\nCaption.displayName = 'Caption'\nThead.displayName = 'Thead'\nTbody.displayName = 'Tbody'\nTr.displayName = 'Tr'\nTd.displayName = 'Td'\n\n","import { Table, Caption, Thead, Tbody, Tr } from './table-elements'\nimport { ComponentProps } from '../../types'\n\nimport React from 'react'\n\nexport interface TableProps extends ComponentProps {\n  tblHead: React.ReactNode\n  tblBody: React.ReactNode\n  tblCaption?: React.ReactNode\n}\n\nexport type dataType = { id: number; items: string[] }[]\n\n/**\n * Render the `thead` by passing an array of names\n */\nexport const RenderHead = (data: []) => {\n  const head = data.map((item, index) => {\n    return <th key={index}>{item}</th>\n  })\n  return <tr>{head}</tr>\n}\n\n/**\n * Render the table body `tr`, `td` with the data provided\n */\nexport const RenderBody = (data: Record<string, unknown>[]) => {\n  const rec = data.map((item, index) => {\n    return (\n      <tr key={index}>\n        {/* <td>{item?.id}</td>\n        <td>{item?.items}</td> */}\n      </tr>\n    )\n  })\n  return <Tbody>{rec}</Tbody>\n}\n\n/**\n * Render the table placing `caption`, `thead` and `tbody` in the correct order\n * caption is optional\n */\nexport const RenderTable = ({ tblBody, tblCaption, tblHead }: TableProps) => {\n  return (\n    <Table>\n      {tblCaption && <Caption>{tblCaption}</Caption>}\n      <Thead>\n        <Tr>{tblHead}</Tr>\n      </Thead>\n      <Tbody>{tblBody}</Tbody>\n    </Table>\n  )\n}\n\nRenderTable.displayName = 'TBL'\nRenderBody.displayName = 'renderBody'\nRenderHead.displayName = 'renderHead'\n"]}