@flipdish/portal-library 5.0.4 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/molecules/FlipdishStaffContainer/index.cjs.js +2 -0
- package/dist/components/molecules/FlipdishStaffContainer/index.cjs.js.map +1 -0
- package/dist/components/molecules/FlipdishStaffContainer/index.d.ts +10 -0
- package/dist/components/molecules/FlipdishStaffContainer/index.js +2 -0
- package/dist/components/molecules/FlipdishStaffContainer/index.js.map +1 -0
- package/dist/components/{GenericTableBody → molecules/GenericTable/GenericTableBody}/index.cjs.js +1 -1
- package/dist/components/molecules/GenericTable/GenericTableBody/index.cjs.js.map +1 -0
- package/dist/components/{GenericTableBody → molecules/GenericTable/GenericTableBody}/index.js +1 -1
- package/dist/components/molecules/GenericTable/GenericTableBody/index.js.map +1 -0
- package/dist/components/molecules/GenericTable/GenericTableBodyRow/index.cjs.js.map +1 -0
- package/dist/components/molecules/GenericTable/GenericTableBodyRow/index.js.map +1 -0
- package/dist/components/molecules/GenericTable/GenericTableTitle/index.cjs.js.map +1 -0
- package/dist/components/molecules/GenericTable/GenericTableTitle/index.js.map +1 -0
- package/dist/components/molecules/GenericTable/HighlightScrollbar.cjs.js +2 -0
- package/dist/components/molecules/GenericTable/HighlightScrollbar.cjs.js.map +1 -0
- package/dist/components/{GenericTable → molecules/GenericTable}/HighlightScrollbar.d.ts +2 -2
- package/dist/components/molecules/GenericTable/HighlightScrollbar.js +2 -0
- package/dist/components/molecules/GenericTable/HighlightScrollbar.js.map +1 -0
- package/dist/components/molecules/GenericTable/index.cjs.js +18 -0
- package/dist/components/molecules/GenericTable/index.cjs.js.map +1 -0
- package/dist/components/{GenericTable → molecules/GenericTable}/index.d.ts +1 -1
- package/dist/components/molecules/GenericTable/index.js +18 -0
- package/dist/components/molecules/GenericTable/index.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/FlipdishStaffContainer/index.cjs.js +0 -2
- package/dist/components/FlipdishStaffContainer/index.cjs.js.map +0 -1
- package/dist/components/FlipdishStaffContainer/index.d.ts +0 -10
- package/dist/components/FlipdishStaffContainer/index.js +0 -2
- package/dist/components/FlipdishStaffContainer/index.js.map +0 -1
- package/dist/components/GenericTable/HighlightScrollbar.cjs.js +0 -2
- package/dist/components/GenericTable/HighlightScrollbar.cjs.js.map +0 -1
- package/dist/components/GenericTable/HighlightScrollbar.js +0 -2
- package/dist/components/GenericTable/HighlightScrollbar.js.map +0 -1
- package/dist/components/GenericTable/index.cjs.js +0 -18
- package/dist/components/GenericTable/index.cjs.js.map +0 -1
- package/dist/components/GenericTable/index.js +0 -18
- package/dist/components/GenericTable/index.js.map +0 -1
- package/dist/components/GenericTableBody/index.cjs.js.map +0 -1
- package/dist/components/GenericTableBody/index.js.map +0 -1
- package/dist/components/GenericTableBodyRow/index.cjs.js.map +0 -1
- package/dist/components/GenericTableBodyRow/index.js.map +0 -1
- package/dist/components/GenericTableTitle/index.cjs.js.map +0 -1
- package/dist/components/GenericTableTitle/index.js.map +0 -1
- /package/dist/components/{GenericTableBody → molecules/GenericTable/GenericTableBody}/index.d.ts +0 -0
- /package/dist/components/{GenericTableBodyRow → molecules/GenericTable/GenericTableBodyRow}/index.cjs.js +0 -0
- /package/dist/components/{GenericTableBodyRow → molecules/GenericTable/GenericTableBodyRow}/index.d.ts +0 -0
- /package/dist/components/{GenericTableBodyRow → molecules/GenericTable/GenericTableBodyRow}/index.js +0 -0
- /package/dist/components/{GenericTableTitle → molecules/GenericTable/GenericTableTitle}/index.cjs.js +0 -0
- /package/dist/components/{GenericTableTitle → molecules/GenericTable/GenericTableTitle}/index.d.ts +0 -0
- /package/dist/components/{GenericTableTitle → molecules/GenericTable/GenericTableTitle}/index.js +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime");require("react");var i=require("@mui/material/Box"),r=require("@mui/material/styles"),t=require("@mui/material/Typography"),s=require("../../../icons/CustomerSupport/index.cjs.js"),a=require("@mui/material/Grid2");const l=r.styled(i)((({theme:e})=>({backgroundColor:e.palette.grey[200],borderRadius:"4px",padding:e.spacing(2)}))),n=r.styled(a)((({theme:e})=>({alignItems:"center",display:"flex",marginBottom:e.spacing(1.5)}))),d=r.styled(t)((({theme:e})=>({fontWeight:500,marginLeft:e.spacing(1)})));module.exports=({title:i,children:r,isFlipdishStaff:t})=>t?e.jsxs(l,{"data-testid":"flipdish-staff-only-container",children:[e.jsxs(n,{children:[e.jsx(s,{}),e.jsx(d,{children:i})]}),r]}):null;
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../src/components/molecules/FlipdishStaffContainer/index.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport Box from '@mui/material/Box';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport SupportAgentOutlinedIcon from '../../../icons/CustomerSupport';\nimport Grid from '../../atoms/Grid';\n\nconst StyledContainer = styled(Box)(({ theme }) => ({\n backgroundColor: theme.palette.grey[200],\n borderRadius: '4px',\n padding: theme.spacing(2),\n}));\n\nconst TitleContainer = styled(Grid)(({ theme }) => ({\n alignItems: 'center',\n display: 'flex',\n marginBottom: theme.spacing(1.5),\n}));\n\nconst Title = styled(Typography)(({ theme }) => ({\n fontWeight: 500,\n marginLeft: theme.spacing(1),\n}));\n\ninterface Props {\n title: string;\n children: ReactNode;\n isFlipdishStaff: boolean;\n}\n\nconst FlipdishStaffContainer = ({ title, children, isFlipdishStaff }: Props): React.ReactNode => {\n return (\n isFlipdishStaff ? <StyledContainer data-testid=\"flipdish-staff-only-container\">\n <TitleContainer>\n <SupportAgentOutlinedIcon />\n <Title>{title}</Title>\n </TitleContainer>\n\n {children}\n </StyledContainer> : null\n );\n};\n\nexport default FlipdishStaffContainer;\n"],"names":["StyledContainer","styled","Box","theme","backgroundColor","palette","grey","borderRadius","padding","spacing","TitleContainer","Grid","alignItems","display","marginBottom","Title","Typography","fontWeight","marginLeft","title","children","isFlipdishStaff","_jsxs","_jsx","SupportAgentOutlinedIcon"],"mappings":"sQASA,MAAMA,EAAkBC,EAAAA,OAAOC,EAAPD,EAAY,EAAGE,YAAO,CAC1CC,gBAAiBD,EAAME,QAAQC,KAAK,KACpCC,aAAc,MACdC,QAASL,EAAMM,QAAQ,OAGrBC,EAAiBT,EAAAA,OAAOU,EAAPV,EAAa,EAAGE,YAAO,CAC1CS,WAAY,SACZC,QAAS,OACTC,aAAcX,EAAMM,QAAQ,SAG1BM,EAAQd,EAAAA,OAAOe,EAAPf,EAAmB,EAAGE,YAAO,CACvCc,WAAY,IACZC,WAAYf,EAAMM,QAAQ,sBASC,EAAGU,QAAOC,WAAUC,qBAE3CA,EAAkBC,EAAAA,KAACtB,EAAe,CAAA,cAAa,gCAA+BoB,SAAA,CAC1EE,EAAAA,KAACZ,aACGa,EAAAA,IAACC,EAAwB,IACzBD,MAACR,EAAK,CAAAK,SAAED,OAGXC,KACgB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
title: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
isFlipdishStaff: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const FlipdishStaffContainer: ({ title, children, isFlipdishStaff }: Props) => React.ReactNode;
|
|
9
|
+
|
|
10
|
+
export { FlipdishStaffContainer as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsxs as i,jsx as t}from"react/jsx-runtime";import"react";import r from"@mui/material/Box";import{styled as e}from"@mui/material/styles";import m from"@mui/material/Typography";import a from"../../../icons/CustomerSupport/index.js";import o from"@mui/material/Grid2";const n=e(r)((({theme:i})=>({backgroundColor:i.palette.grey[200],borderRadius:"4px",padding:i.spacing(2)}))),l=e(o)((({theme:i})=>({alignItems:"center",display:"flex",marginBottom:i.spacing(1.5)}))),p=e(m)((({theme:i})=>({fontWeight:500,marginLeft:i.spacing(1)}))),s=({title:r,children:e,isFlipdishStaff:m})=>m?i(n,{"data-testid":"flipdish-staff-only-container",children:[i(l,{children:[t(a,{}),t(p,{children:r})]}),e]}):null;export{s as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/FlipdishStaffContainer/index.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport Box from '@mui/material/Box';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport SupportAgentOutlinedIcon from '../../../icons/CustomerSupport';\nimport Grid from '../../atoms/Grid';\n\nconst StyledContainer = styled(Box)(({ theme }) => ({\n backgroundColor: theme.palette.grey[200],\n borderRadius: '4px',\n padding: theme.spacing(2),\n}));\n\nconst TitleContainer = styled(Grid)(({ theme }) => ({\n alignItems: 'center',\n display: 'flex',\n marginBottom: theme.spacing(1.5),\n}));\n\nconst Title = styled(Typography)(({ theme }) => ({\n fontWeight: 500,\n marginLeft: theme.spacing(1),\n}));\n\ninterface Props {\n title: string;\n children: ReactNode;\n isFlipdishStaff: boolean;\n}\n\nconst FlipdishStaffContainer = ({ title, children, isFlipdishStaff }: Props): React.ReactNode => {\n return (\n isFlipdishStaff ? <StyledContainer data-testid=\"flipdish-staff-only-container\">\n <TitleContainer>\n <SupportAgentOutlinedIcon />\n <Title>{title}</Title>\n </TitleContainer>\n\n {children}\n </StyledContainer> : null\n );\n};\n\nexport default FlipdishStaffContainer;\n"],"names":["StyledContainer","styled","Box","theme","backgroundColor","palette","grey","borderRadius","padding","spacing","TitleContainer","Grid","alignItems","display","marginBottom","Title","Typography","fontWeight","marginLeft","FlipdishStaffContainer","title","children","isFlipdishStaff","_jsxs","_jsx","SupportAgentOutlinedIcon"],"mappings":"iRASA,MAAMA,EAAkBC,EAAOC,EAAPD,EAAY,EAAGE,YAAO,CAC1CC,gBAAiBD,EAAME,QAAQC,KAAK,KACpCC,aAAc,MACdC,QAASL,EAAMM,QAAQ,OAGrBC,EAAiBT,EAAOU,EAAPV,EAAa,EAAGE,YAAO,CAC1CS,WAAY,SACZC,QAAS,OACTC,aAAcX,EAAMM,QAAQ,SAG1BM,EAAQd,EAAOe,EAAPf,EAAmB,EAAGE,YAAO,CACvCc,WAAY,IACZC,WAAYf,EAAMM,QAAQ,OASxBU,EAAyB,EAAGC,QAAOC,WAAUC,qBAE3CA,EAAkBC,EAACvB,EAAe,CAAA,cAAa,gCAA+BqB,SAAA,CAC1EE,EAACb,aACGc,EAACC,EAAwB,IACzBD,EAACT,EAAK,CAAAM,SAAED,OAGXC,KACgB"}
|
package/dist/components/{GenericTableBody → molecules/GenericTable/GenericTableBody}/index.cjs.js
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material/Skeleton"),r=require("@mui/material/styles"),l=require("@mui/material/TableBody"),a=require("@mui/material/TableCell"),o=require("@mui/material/TableRow"),n=require("../GenericTableBodyRow/index.cjs.js");const s=r.styled(a,{shouldForwardProp:e=>"align"!==e&&"titleCell"!==e&&"warning"!==e&&"sticky"!==e&&"isTitleRow"!==e})((({align:e,titleCell:i,warning:t,sticky:r,isTitleRow:l})=>({textAlign:e,fontWeight:i||l?"bold":"normal",backgroundColor:t?"#ffcccb":"inherit",position:r?"sticky":"static"}))),c=({colIdx:t,colName:r,hasWarning:l,hasTitle:a,meta:o,row:n,type:c})=>{const d=n[r],m=o[r]?.align??"left",u=o[r]?.hideWhenEmpty??!1?"":"-",w={align:m,warning:l??!1,titleCell:a??!1,sticky:"sticky"===c&&0===t,"data-testid":`col-${r}`,isTitleRow:n.isTitleRow??!1};if(i.isValidElement(d))return e.jsx(s,{...w,children:d});switch(o[r]?.columnType){case"String":default:return e.jsx(s,{...w,children:d??u});case"Custom":return e.jsx(s,{...w,children:d?o[r]?.customComponent?.(d,n):u})}};module.exports=({columns:i,data:r,loading:a,type:d,onRowClick:m,meta:u})=>e.jsx(l,{children:a?Array.from(Array(5)).map(((r,l)=>e.jsx(o,{"data-testid":"row-loader",children:Array.from(i).map(((i,r)=>e.jsx(s,{align:"left","data-testid":`col-${i}`,isTitleRow:!1,sticky:!1,titleCell:!1,warning:!1,children:e.jsx(t,{height:22,width:"90%"})},`col-${i}-loader-${r}`)))},`row-loader-${l}`))):r?.map(((t,r)=>e.jsx(n,{row:t,tableRowTestKey:r.toString(),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material/Skeleton"),r=require("@mui/material/styles"),l=require("@mui/material/TableBody"),a=require("@mui/material/TableCell"),o=require("@mui/material/TableRow"),n=require("../GenericTableBodyRow/index.cjs.js");const s=r.styled(a,{shouldForwardProp:e=>"align"!==e&&"titleCell"!==e&&"warning"!==e&&"sticky"!==e&&"isTitleRow"!==e})((({align:e,titleCell:i,warning:t,sticky:r,isTitleRow:l})=>({textAlign:e,fontWeight:i||l?"bold":"normal",backgroundColor:t?"#ffcccb":"inherit",position:r?"sticky":"static"}))),c=({colIdx:t,colName:r,hasWarning:l,hasTitle:a,meta:o,row:n,type:c})=>{const d=n[r],m=o[r]?.align??"left",u=o[r]?.hideWhenEmpty??!1?"":"-",w={align:m,warning:l??!1,titleCell:a??!1,sticky:"sticky"===c&&0===t,"data-testid":`col-${r}`,isTitleRow:n.isTitleRow??!1};if(i.isValidElement(d))return e.jsx(s,{...w,children:d});switch(o[r]?.columnType){case"String":default:return e.jsx(s,{...w,children:d??u});case"Custom":return e.jsx(s,{...w,children:d?o[r]?.customComponent?.(d,n):u})}};module.exports=({columns:i,data:r,loading:a,type:d,onRowClick:m,meta:u})=>e.jsx(l,{children:a?Array.from(Array(5)).map(((r,l)=>e.jsx(o,{"data-testid":"row-loader",children:Array.from(i).map(((i,r)=>e.jsx(s,{align:"left","data-testid":`col-${i}`,isTitleRow:!1,sticky:!1,titleCell:!1,warning:!1,children:e.jsx(t,{height:22,width:"90%"})},`col-${i}-loader-${r}`)))},`row-loader-${l}`))):r?.map(((t,r)=>e.jsx(n,{onRowClick:m,row:t,tableRowTestKey:r.toString(),children:Array.from(i).map(((i,r)=>e.jsx(c,{colIdx:r,colName:i,meta:u??{},row:t,type:d},`cell-${i}-${r}`)))},`row-${r}`)))});
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../../src/components/molecules/GenericTable/GenericTableBody/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport Skeleton from '@mui/material/Skeleton';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport GenericTableBodyRow from '../GenericTableBodyRow';\n\nexport interface GenericTableColumns {\n columnName: string;\n columnTitle: string;\n columnType: 'Custom' | 'String';\n align?: 'left' | 'right';\n isVisible: boolean;\n ordinal: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n customComponent?: (data: any, row: any) => JSX.Element;\n tooltip?: string;\n hideWhenEmpty?: boolean;\n}\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) =>\n prop !== 'align' &&\n prop !== 'titleCell' &&\n prop !== 'warning' &&\n prop !== 'sticky' &&\n prop !== 'isTitleRow',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean; isTitleRow: boolean }>(\n ({ align, titleCell, warning, sticky, isTitleRow }) => ({\n textAlign: align,\n fontWeight: titleCell || isTitleRow ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n }),\n);\n\nexport interface TableCellProps {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'normal' | 'sticky';\n}\n\nconst RenderTableCell: React.FC<TableCellProps> = ({\n colIdx,\n colName,\n hasWarning,\n hasTitle,\n meta,\n row,\n type,\n}) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const prop = row[colName];\n const align = meta[colName]?.align ?? 'left';\n const hideWhenEmpty = meta[colName]?.hideWhenEmpty ?? false;\n const fallbackValue = hideWhenEmpty ? '' : '-';\n const tableCellProps = {\n align,\n warning: hasWarning ?? false,\n titleCell: hasTitle ?? false,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n isTitleRow: row['isTitleRow'] ?? false,\n };\n\n // When prop is a React element render it as is\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n if (React.isValidElement(prop)) {\n return <StyledTableCell {...tableCellProps}>{prop}</StyledTableCell>;\n }\n\n switch (meta[colName]?.columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n case 'Custom':\n return (\n <StyledTableCell {...tableCellProps}>\n {prop ? meta[colName]?.customComponent?.(prop, row) : fallbackValue}\n </StyledTableCell>\n );\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n }\n};\n\ninterface TableBodyProps {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'normal' | 'sticky';\n}\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n // eslint-disable-next-line react/no-array-index-key\n <TableRow key={`row-loader-${idx}`} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n // eslint-disable-next-line react/no-array-index-key\n key={`col-${columnName}-loader-${colIdx}`}\n align={'left'}\n data-testid={`col-${columnName}`}\n isTitleRow={false}\n sticky={false}\n titleCell={false}\n warning={false}\n >\n <Skeleton height={22} width=\"90%\" />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow\n // eslint-disable-next-line react/no-array-index-key\n key={`row-${rowIdx}`}\n onRowClick={onRowClick}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n row={row}\n tableRowTestKey={rowIdx.toString()}\n >\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell\n // eslint-disable-next-line react/no-array-index-key\n key={`cell-${colName}-${colIdx}`}\n colIdx={colIdx}\n colName={colName}\n meta={meta ?? {}}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n row={row}\n type={type}\n />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","isTitleRow","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","fallbackValue","hideWhenEmpty","tableCellProps","React","isValidElement","_jsx","children","columnType","customComponent","columns","data","loading","onRowClick","MuiTableBody","Array","from","map","_","idx","TableRow","columnName","Skeleton","height","width","rowIdx","GenericTableBodyRow","tableRowTestKey","toString"],"mappings":"wSAuBA,MAAMA,EAAkBC,EAAAA,OAAOC,EAAW,CACxCC,kBAAoBC,GACT,UAATA,GACS,cAATA,GACS,YAATA,GACS,WAATA,GACS,eAATA,GANoBH,EAQtB,EAAGI,QAAOC,YAAWC,UAASC,SAAQC,iBAAY,CAChDC,UAAWL,EACXM,WAAYL,GAAaG,EAAa,OAAS,SAC/CG,gBAAiBL,EAAU,UAAY,UACvCM,SAAUL,EAAS,SAAW,aAe5BM,EAA4C,EAChDC,SACAC,UACAC,aACAC,WACAC,OACAC,MACAC,WAGA,MAAMjB,EAAOgB,EAAIJ,GACXX,EAAQc,EAAKH,IAAUX,OAAS,OAEhCiB,EADgBH,EAAKH,IAAUO,gBAAiB,EAChB,GAAK,IACrCC,EAAiB,CACrBnB,QACAE,QAASU,IAAc,EACvBX,UAAWY,IAAY,EACvBV,OAAiB,WAATa,GAAgC,IAAXN,EAC7B,cAAe,OAAOC,IAEtBP,WAAYW,EAAgB,aAAK,GAKnC,GAAIK,EAAMC,eAAetB,GACvB,OAAOuB,EAAAA,IAAC3B,EAAe,IAAKwB,EAAcI,SAAGxB,IAG/C,OAAQe,EAAKH,IAAUa,YACrB,IAAK,SAQL,QACE,OAAOF,EAAAA,IAAC3B,EAAe,IAAKwB,WAAiBpB,GAAQkB,IAPvD,IAAK,SACH,OACEK,EAAAA,IAAC3B,EAAe,IAAKwB,EAAcI,SAChCxB,EAAOe,EAAKH,IAAUc,kBAAkB1B,EAAMgB,GAAOE,qBAmBb,EAAGS,UAASC,OAAMC,UAASZ,OAAMa,aAAYf,UAG5FQ,EAAAA,IAACQ,EAAY,CAAAP,SACVK,EACGG,MAAMC,KAAKD,MAJC,IAImBE,KAAI,CAACC,EAAGC,IAErCb,EAAAA,IAACc,iBAA+C,aAAYb,SACzDQ,MAAMC,KAAKN,GAASO,KAAI,CAACI,EAAY3B,IACpCY,EAAAA,IAAC3B,GAGCK,MAAO,OAAM,cACA,OAAOqC,IACpBjC,YAAY,EACZD,QAAQ,EACRF,WAAW,EACXC,SAAS,EAAKqB,SAEdD,MAACgB,EAAQ,CAACC,OAAQ,GAAIC,MAAM,SARvB,OAAOH,YAAqB3B,QAJxB,cAAcyB,OAiB/BR,GAAMM,KAAI,CAAClB,EAAK0B,IACdnB,EAAAA,IAACoB,EAGC,CAAAb,WAAYA,EAEZd,IAAKA,EACL4B,gBAAiBF,EAAOG,WAAUrB,SAEjCQ,MAAMC,KAAKN,GAASO,KAAI,CAACtB,EAASD,IACjCY,EAAAA,IAACb,GAGCC,OAAQA,EACRC,QAASA,EACTG,KAAMA,GAAQ,CAAA,EAEdC,IAAKA,EACLC,KAAMA,GAND,QAAQL,KAAWD,QATvB,OAAO+B"}
|
package/dist/components/{GenericTableBody → molecules/GenericTable/GenericTableBody}/index.js
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import i from"react";import e from"@mui/material/Skeleton";import{styled as r}from"@mui/material/styles";import l from"@mui/material/TableBody";import o from"@mui/material/TableCell";import a from"@mui/material/TableRow";import n from"../GenericTableBodyRow/index.js";const m=r(o,{shouldForwardProp:t=>"align"!==t&&"titleCell"!==t&&"warning"!==t&&"sticky"!==t&&"isTitleRow"!==t})((({align:t,titleCell:i,warning:e,sticky:r,isTitleRow:l})=>({textAlign:t,fontWeight:i||l?"bold":"normal",backgroundColor:e?"#ffcccb":"inherit",position:r?"sticky":"static"}))),c=({colIdx:e,colName:r,hasWarning:l,hasTitle:o,meta:a,row:n,type:c})=>{const s=n[r],d=a[r]?.align??"left",w=a[r]?.hideWhenEmpty??!1?"":"-",p={align:d,warning:l??!1,titleCell:o??!1,sticky:"sticky"===c&&0===e,"data-testid":`col-${r}`,isTitleRow:n.isTitleRow??!1};if(i.isValidElement(s))return t(m,{...p,children:s});switch(a[r]?.columnType){case"String":default:return t(m,{...p,children:s??w});case"Custom":return t(m,{...p,children:s?a[r]?.customComponent?.(s,n):w})}},s=({columns:i,data:r,loading:o,type:s,onRowClick:d,meta:w})=>t(l,{children:o?Array.from(Array(5)).map(((r,l)=>t(a,{"data-testid":"row-loader",children:Array.from(i).map(((i,r)=>t(m,{align:"left","data-testid":`col-${i}`,isTitleRow:!1,sticky:!1,titleCell:!1,warning:!1,children:t(e,{height:22,width:"90%"})},`col-${i}-loader-${r}`)))},`row-loader-${l}`))):r?.map(((e,r)=>t(n,{row:e,tableRowTestKey:r.toString(),
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import i from"react";import e from"@mui/material/Skeleton";import{styled as r}from"@mui/material/styles";import l from"@mui/material/TableBody";import o from"@mui/material/TableCell";import a from"@mui/material/TableRow";import n from"../GenericTableBodyRow/index.js";const m=r(o,{shouldForwardProp:t=>"align"!==t&&"titleCell"!==t&&"warning"!==t&&"sticky"!==t&&"isTitleRow"!==t})((({align:t,titleCell:i,warning:e,sticky:r,isTitleRow:l})=>({textAlign:t,fontWeight:i||l?"bold":"normal",backgroundColor:e?"#ffcccb":"inherit",position:r?"sticky":"static"}))),c=({colIdx:e,colName:r,hasWarning:l,hasTitle:o,meta:a,row:n,type:c})=>{const s=n[r],d=a[r]?.align??"left",w=a[r]?.hideWhenEmpty??!1?"":"-",p={align:d,warning:l??!1,titleCell:o??!1,sticky:"sticky"===c&&0===e,"data-testid":`col-${r}`,isTitleRow:n.isTitleRow??!1};if(i.isValidElement(s))return t(m,{...p,children:s});switch(a[r]?.columnType){case"String":default:return t(m,{...p,children:s??w});case"Custom":return t(m,{...p,children:s?a[r]?.customComponent?.(s,n):w})}},s=({columns:i,data:r,loading:o,type:s,onRowClick:d,meta:w})=>t(l,{children:o?Array.from(Array(5)).map(((r,l)=>t(a,{"data-testid":"row-loader",children:Array.from(i).map(((i,r)=>t(m,{align:"left","data-testid":`col-${i}`,isTitleRow:!1,sticky:!1,titleCell:!1,warning:!1,children:t(e,{height:22,width:"90%"})},`col-${i}-loader-${r}`)))},`row-loader-${l}`))):r?.map(((e,r)=>t(n,{onRowClick:d,row:e,tableRowTestKey:r.toString(),children:Array.from(i).map(((i,r)=>t(c,{colIdx:r,colName:i,meta:w??{},row:e,type:s},`cell-${i}-${r}`)))},`row-${r}`)))});export{s as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/molecules/GenericTable/GenericTableBody/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport Skeleton from '@mui/material/Skeleton';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport GenericTableBodyRow from '../GenericTableBodyRow';\n\nexport interface GenericTableColumns {\n columnName: string;\n columnTitle: string;\n columnType: 'Custom' | 'String';\n align?: 'left' | 'right';\n isVisible: boolean;\n ordinal: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n customComponent?: (data: any, row: any) => JSX.Element;\n tooltip?: string;\n hideWhenEmpty?: boolean;\n}\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) =>\n prop !== 'align' &&\n prop !== 'titleCell' &&\n prop !== 'warning' &&\n prop !== 'sticky' &&\n prop !== 'isTitleRow',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean; isTitleRow: boolean }>(\n ({ align, titleCell, warning, sticky, isTitleRow }) => ({\n textAlign: align,\n fontWeight: titleCell || isTitleRow ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n }),\n);\n\nexport interface TableCellProps {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'normal' | 'sticky';\n}\n\nconst RenderTableCell: React.FC<TableCellProps> = ({\n colIdx,\n colName,\n hasWarning,\n hasTitle,\n meta,\n row,\n type,\n}) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const prop = row[colName];\n const align = meta[colName]?.align ?? 'left';\n const hideWhenEmpty = meta[colName]?.hideWhenEmpty ?? false;\n const fallbackValue = hideWhenEmpty ? '' : '-';\n const tableCellProps = {\n align,\n warning: hasWarning ?? false,\n titleCell: hasTitle ?? false,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n isTitleRow: row['isTitleRow'] ?? false,\n };\n\n // When prop is a React element render it as is\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n if (React.isValidElement(prop)) {\n return <StyledTableCell {...tableCellProps}>{prop}</StyledTableCell>;\n }\n\n switch (meta[colName]?.columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n case 'Custom':\n return (\n <StyledTableCell {...tableCellProps}>\n {prop ? meta[colName]?.customComponent?.(prop, row) : fallbackValue}\n </StyledTableCell>\n );\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n }\n};\n\ninterface TableBodyProps {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'normal' | 'sticky';\n}\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n // eslint-disable-next-line react/no-array-index-key\n <TableRow key={`row-loader-${idx}`} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n // eslint-disable-next-line react/no-array-index-key\n key={`col-${columnName}-loader-${colIdx}`}\n align={'left'}\n data-testid={`col-${columnName}`}\n isTitleRow={false}\n sticky={false}\n titleCell={false}\n warning={false}\n >\n <Skeleton height={22} width=\"90%\" />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow\n // eslint-disable-next-line react/no-array-index-key\n key={`row-${rowIdx}`}\n onRowClick={onRowClick}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n row={row}\n tableRowTestKey={rowIdx.toString()}\n >\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell\n // eslint-disable-next-line react/no-array-index-key\n key={`cell-${colName}-${colIdx}`}\n colIdx={colIdx}\n colName={colName}\n meta={meta ?? {}}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n row={row}\n type={type}\n />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","isTitleRow","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","fallbackValue","hideWhenEmpty","tableCellProps","React","isValidElement","_jsx","children","columnType","customComponent","GenericTableBody","columns","data","loading","onRowClick","MuiTableBody","Array","from","map","_","idx","TableRow","columnName","Skeleton","height","width","rowIdx","GenericTableBodyRow","tableRowTestKey","toString"],"mappings":"oTAuBA,MAAMA,EAAkBC,EAAOC,EAAW,CACxCC,kBAAoBC,GACT,UAATA,GACS,cAATA,GACS,YAATA,GACS,WAATA,GACS,eAATA,GANoBH,EAQtB,EAAGI,QAAOC,YAAWC,UAASC,SAAQC,iBAAY,CAChDC,UAAWL,EACXM,WAAYL,GAAaG,EAAa,OAAS,SAC/CG,gBAAiBL,EAAU,UAAY,UACvCM,SAAUL,EAAS,SAAW,aAe5BM,EAA4C,EAChDC,SACAC,UACAC,aACAC,WACAC,OACAC,MACAC,WAGA,MAAMjB,EAAOgB,EAAIJ,GACXX,EAAQc,EAAKH,IAAUX,OAAS,OAEhCiB,EADgBH,EAAKH,IAAUO,gBAAiB,EAChB,GAAK,IACrCC,EAAiB,CACrBnB,QACAE,QAASU,IAAc,EACvBX,UAAWY,IAAY,EACvBV,OAAiB,WAATa,GAAgC,IAAXN,EAC7B,cAAe,OAAOC,IAEtBP,WAAYW,EAAgB,aAAK,GAKnC,GAAIK,EAAMC,eAAetB,GACvB,OAAOuB,EAAC3B,EAAe,IAAKwB,EAAcI,SAAGxB,IAG/C,OAAQe,EAAKH,IAAUa,YACrB,IAAK,SAQL,QACE,OAAOF,EAAC3B,EAAe,IAAKwB,WAAiBpB,GAAQkB,IAPvD,IAAK,SACH,OACEK,EAAC3B,EAAe,IAAKwB,EAAcI,SAChCxB,EAAOe,EAAKH,IAAUc,kBAAkB1B,EAAMgB,GAAOE,MAmB1DS,EAA6C,EAAGC,UAASC,OAAMC,UAASb,OAAMc,aAAYhB,UAG5FQ,EAACS,EAAY,CAAAR,SACVM,EACGG,MAAMC,KAAKD,MAJC,IAImBE,KAAI,CAACC,EAAGC,IAErCd,EAACe,iBAA+C,aAAYd,SACzDS,MAAMC,KAAKN,GAASO,KAAI,CAACI,EAAY5B,IACpCY,EAAC3B,GAGCK,MAAO,OAAM,cACA,OAAOsC,IACpBlC,YAAY,EACZD,QAAQ,EACRF,WAAW,EACXC,SAAS,EAAKqB,SAEdD,EAACiB,EAAQ,CAACC,OAAQ,GAAIC,MAAM,SARvB,OAAOH,YAAqB5B,QAJxB,cAAc0B,OAiB/BR,GAAMM,KAAI,CAACnB,EAAK2B,IACdpB,EAACqB,EAGC,CAAAb,WAAYA,EAEZf,IAAKA,EACL6B,gBAAiBF,EAAOG,WAAUtB,SAEjCS,MAAMC,KAAKN,GAASO,KAAI,CAACvB,EAASD,IACjCY,EAACb,GAGCC,OAAQA,EACRC,QAASA,EACTG,KAAMA,GAAQ,CAAA,EAEdC,IAAKA,EACLC,KAAMA,GAND,QAAQL,KAAWD,QATvB,OAAOgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../../src/components/molecules/GenericTable/GenericTableBodyRow/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { styled } from '@mui/material/styles';\nimport TableRow from '@mui/material/TableRow';\n\nexport interface TableBodyRowProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: any;\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n tableRowTestKey: string;\n}\n\nconst StyledTableRow = styled(TableRow, {\n shouldForwardProp: (prop) => prop !== 'isTitleRow',\n})<{ isTitleRow: boolean }>(({ theme, isTitleRow }) => {\n if (!isTitleRow) {\n return {};\n }\n\n return {\n backgroundColor: theme.palette.semantic.background['background-sunken'],\n };\n});\n\ntype TableBodyRowProp = TableBodyRowProps & { children: React.ReactNode };\n\nconst GenericTableBodyRow: React.FC<React.PropsWithChildren<TableBodyRowProp>> = (props) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { onRowClick, row, children, tableRowTestKey } = props;\n\n const onClick = (event: React.MouseEvent<HTMLTableRowElement>): void => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n event.preventDefault();\n onRowClick?.(row);\n };\n\n if (onRowClick) {\n return (\n <StyledTableRow\n data-testid={`row-clickable-${tableRowTestKey}`}\n hover={onClick !== undefined}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n isTitleRow={row['isTitleRow'] ?? false}\n onClick={onClick}\n >\n {children}\n </StyledTableRow>\n );\n }\n\n return <TableRow data-testid={`row-${tableRowTestKey}`}>{children}</TableRow>;\n};\n\nexport default GenericTableBodyRow;\n"],"names":["StyledTableRow","styled","TableRow","shouldForwardProp","prop","theme","isTitleRow","backgroundColor","palette","semantic","background","props","onRowClick","row","children","tableRowTestKey","onClick","event","preventDefault","_jsx","hover","undefined"],"mappings":"2IAaA,MAAMA,EAAiBC,EAAAA,OAAOC,EAAU,CACtCC,kBAAoBC,GAAkB,eAATA,GADRH,EAEK,EAAGI,QAAOC,gBAC/BA,EAIE,CACLC,gBAAiBF,EAAMG,QAAQC,SAASC,WAAW,sBAJ5C,CAAA,mBAUuEC,IAEhF,MAAMC,WAAEA,EAAUC,IAAEA,EAAGC,SAAEA,EAAQC,gBAAEA,GAAoBJ,EAEjDK,EAAWC,IAEfA,EAAMC,iBACNN,IAAaC,IAGf,OAAID,EAEAO,EAAAA,IAACnB,EAAc,CAAA,cACA,iBAAiBe,IAC9BK,WAAmBC,IAAZL,EAEPV,WAAYO,EAAgB,aAAK,EACjCG,QAASA,EAAOF,SAEfA,IAKAK,EAAAA,IAACjB,EAAQ,CAAA,cAAc,OAAOa,IAAiBD,SAAGA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/molecules/GenericTable/GenericTableBodyRow/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { styled } from '@mui/material/styles';\nimport TableRow from '@mui/material/TableRow';\n\nexport interface TableBodyRowProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: any;\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n tableRowTestKey: string;\n}\n\nconst StyledTableRow = styled(TableRow, {\n shouldForwardProp: (prop) => prop !== 'isTitleRow',\n})<{ isTitleRow: boolean }>(({ theme, isTitleRow }) => {\n if (!isTitleRow) {\n return {};\n }\n\n return {\n backgroundColor: theme.palette.semantic.background['background-sunken'],\n };\n});\n\ntype TableBodyRowProp = TableBodyRowProps & { children: React.ReactNode };\n\nconst GenericTableBodyRow: React.FC<React.PropsWithChildren<TableBodyRowProp>> = (props) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { onRowClick, row, children, tableRowTestKey } = props;\n\n const onClick = (event: React.MouseEvent<HTMLTableRowElement>): void => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n event.preventDefault();\n onRowClick?.(row);\n };\n\n if (onRowClick) {\n return (\n <StyledTableRow\n data-testid={`row-clickable-${tableRowTestKey}`}\n hover={onClick !== undefined}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n isTitleRow={row['isTitleRow'] ?? false}\n onClick={onClick}\n >\n {children}\n </StyledTableRow>\n );\n }\n\n return <TableRow data-testid={`row-${tableRowTestKey}`}>{children}</TableRow>;\n};\n\nexport default GenericTableBodyRow;\n"],"names":["StyledTableRow","styled","TableRow","shouldForwardProp","prop","theme","isTitleRow","backgroundColor","palette","semantic","background","GenericTableBodyRow","props","onRowClick","row","children","tableRowTestKey","onClick","event","preventDefault","_jsx","hover","undefined"],"mappings":"0IAaA,MAAMA,EAAiBC,EAAOC,EAAU,CACtCC,kBAAoBC,GAAkB,eAATA,GADRH,EAEK,EAAGI,QAAOC,gBAC/BA,EAIE,CACLC,gBAAiBF,EAAMG,QAAQC,SAASC,WAAW,sBAJ5C,CAAA,IAULC,EAA4EC,IAEhF,MAAMC,WAAEA,EAAUC,IAAEA,EAAGC,SAAEA,EAAQC,gBAAEA,GAAoBJ,EAEjDK,EAAWC,IAEfA,EAAMC,iBACNN,IAAaC,IAGf,OAAID,EAEAO,EAACpB,EAAc,CAAA,cACA,iBAAiBgB,IAC9BK,WAAmBC,IAAZL,EAEPX,WAAYQ,EAAgB,aAAK,EACjCG,QAASA,EAAOF,SAEfA,IAKAK,EAAClB,EAAQ,CAAA,cAAc,OAAOc,IAAiBD,SAAGA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../../src/components/molecules/GenericTable/GenericTableTitle/index.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport Grid, { type GridSize } from '../../../atoms/Grid';\n\ninterface OuterProps {\n maxGridWidth?: GridSize;\n subTitle?: string;\n title?: string;\n children?: ReactNode;\n titlePadding?: 'medium' | 'small';\n}\n\nconst HeaderContainer = styled(Grid, {\n shouldForwardProp: (prop) => prop !== 'titlePadding',\n})<{ titlePadding: OuterProps['titlePadding'] }>(({ theme, titlePadding }) => {\n switch (titlePadding) {\n case 'small':\n return {\n padding: theme.spacing(3, 0, 1.5),\n [theme.breakpoints.down('tablet')]: {\n padding: theme.spacing(3, 2, 1.5),\n },\n };\n case 'medium':\n return {\n padding: theme.spacing(4, 0, 2),\n [theme.breakpoints.down('tablet')]: {\n padding: theme.spacing(4, 2, 2),\n },\n };\n default:\n return { padding: 0 };\n }\n});\n\nconst SubTitle = styled(Typography)({\n width: 191,\n height: 16,\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.33,\n letterSpacing: 0.4,\n color: 'rgba(0, 0, 0, 0.38)',\n});\n\nconst GenericTableTitle = ({\n maxGridWidth = 12,\n subTitle,\n title,\n children,\n titlePadding = 'medium',\n}: OuterProps): JSX.Element => {\n return (\n <HeaderContainer container titlePadding={titlePadding}>\n <Grid size={{ base: maxGridWidth, mobile: maxGridWidth }}>\n {title && <Typography variant=\"h5\">{title}</Typography>}\n {subTitle && (\n <div>\n <SubTitle variant=\"caption\">{subTitle}</SubTitle>\n </div>\n )}\n </Grid>\n\n {children}\n </HeaderContainer>\n );\n};\n\nexport default GenericTableTitle;\n"],"names":["HeaderContainer","styled","Grid","shouldForwardProp","prop","theme","titlePadding","padding","spacing","breakpoints","down","SubTitle","Typography","width","height","fontSize","fontWeight","lineHeight","letterSpacing","color","maxGridWidth","subTitle","title","children","_jsxs","container","size","base","mobile","_jsx","variant"],"mappings":"8KAeA,MAAMA,EAAkBC,EAAAA,OAAOC,EAAM,CACnCC,kBAAoBC,GAAkB,iBAATA,GADPH,EAEyB,EAAGI,QAAOC,mBACzD,OAAQA,GACN,IAAK,QACH,MAAO,CACLC,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAC7B,CAACH,EAAMI,YAAYC,KAAK,WAAY,CAClCH,QAASF,EAAMG,QAAQ,EAAG,EAAG,OAGnC,IAAK,SACH,MAAO,CACLD,QAASF,EAAMG,QAAQ,EAAG,EAAG,GAC7B,CAACH,EAAMI,YAAYC,KAAK,WAAY,CAClCH,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAGnC,QACE,MAAO,CAAED,QAAS,OAIlBI,EAAWV,EAAAA,OAAOW,EAAPX,CAAmB,CAClCY,MAAO,IACPC,OAAQ,GACRC,SAAU,GACVC,WAAY,SACZC,WAAY,KACZC,cAAe,GACfC,MAAO,uCAGiB,EACxBC,eAAe,GACfC,WACAC,QACAC,WACAjB,eAAe,YAGbkB,EAAAA,KAACxB,EAAe,CAACyB,WAAS,EAACnB,aAAcA,EAAYiB,SAAA,CACnDC,OAACtB,EAAI,CAACwB,KAAM,CAAEC,KAAMP,EAAcQ,OAAQR,GAAcG,SAAA,CACrDD,GAASO,EAAAA,IAACjB,EAAU,CAACkB,QAAQ,KAAIP,SAAED,IACnCD,GACCQ,EAAAA,IAAA,MAAA,CAAAN,SACEM,MAAClB,EAAQ,CAACmB,QAAQ,UAASP,SAAEF,SAKlCE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/molecules/GenericTable/GenericTableTitle/index.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport Grid, { type GridSize } from '../../../atoms/Grid';\n\ninterface OuterProps {\n maxGridWidth?: GridSize;\n subTitle?: string;\n title?: string;\n children?: ReactNode;\n titlePadding?: 'medium' | 'small';\n}\n\nconst HeaderContainer = styled(Grid, {\n shouldForwardProp: (prop) => prop !== 'titlePadding',\n})<{ titlePadding: OuterProps['titlePadding'] }>(({ theme, titlePadding }) => {\n switch (titlePadding) {\n case 'small':\n return {\n padding: theme.spacing(3, 0, 1.5),\n [theme.breakpoints.down('tablet')]: {\n padding: theme.spacing(3, 2, 1.5),\n },\n };\n case 'medium':\n return {\n padding: theme.spacing(4, 0, 2),\n [theme.breakpoints.down('tablet')]: {\n padding: theme.spacing(4, 2, 2),\n },\n };\n default:\n return { padding: 0 };\n }\n});\n\nconst SubTitle = styled(Typography)({\n width: 191,\n height: 16,\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.33,\n letterSpacing: 0.4,\n color: 'rgba(0, 0, 0, 0.38)',\n});\n\nconst GenericTableTitle = ({\n maxGridWidth = 12,\n subTitle,\n title,\n children,\n titlePadding = 'medium',\n}: OuterProps): JSX.Element => {\n return (\n <HeaderContainer container titlePadding={titlePadding}>\n <Grid size={{ base: maxGridWidth, mobile: maxGridWidth }}>\n {title && <Typography variant=\"h5\">{title}</Typography>}\n {subTitle && (\n <div>\n <SubTitle variant=\"caption\">{subTitle}</SubTitle>\n </div>\n )}\n </Grid>\n\n {children}\n </HeaderContainer>\n );\n};\n\nexport default GenericTableTitle;\n"],"names":["HeaderContainer","styled","Grid","shouldForwardProp","prop","theme","titlePadding","padding","spacing","breakpoints","down","SubTitle","Typography","width","height","fontSize","fontWeight","lineHeight","letterSpacing","color","GenericTableTitle","maxGridWidth","subTitle","title","children","_jsxs","container","size","base","mobile","_jsx","variant"],"mappings":"yLAeA,MAAMA,EAAkBC,EAAOC,EAAM,CACnCC,kBAAoBC,GAAkB,iBAATA,GADPH,EAEyB,EAAGI,QAAOC,mBACzD,OAAQA,GACN,IAAK,QACH,MAAO,CACLC,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAC7B,CAACH,EAAMI,YAAYC,KAAK,WAAY,CAClCH,QAASF,EAAMG,QAAQ,EAAG,EAAG,OAGnC,IAAK,SACH,MAAO,CACLD,QAASF,EAAMG,QAAQ,EAAG,EAAG,GAC7B,CAACH,EAAMI,YAAYC,KAAK,WAAY,CAClCH,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAGnC,QACE,MAAO,CAAED,QAAS,OAIlBI,EAAWV,EAAOW,EAAPX,CAAmB,CAClCY,MAAO,IACPC,OAAQ,GACRC,SAAU,GACVC,WAAY,SACZC,WAAY,KACZC,cAAe,GACfC,MAAO,wBAGHC,EAAoB,EACxBC,eAAe,GACfC,WACAC,QACAC,WACAlB,eAAe,YAGbmB,EAACzB,EAAe,CAAC0B,WAAS,EAACpB,aAAcA,EAAYkB,SAAA,CACnDC,EAACvB,EAAI,CAACyB,KAAM,CAAEC,KAAMP,EAAcQ,OAAQR,GAAcG,SAAA,CACrDD,GAASO,EAAClB,EAAU,CAACmB,QAAQ,KAAIP,SAAED,IACnCD,GACCQ,EAAA,MAAA,CAAAN,SACEM,EAACnB,EAAQ,CAACoB,QAAQ,UAASP,SAAEF,SAKlCE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react");const t=require("@mui/material/styles").styled("div")((({hovered:e,isScrolling:r,theme:t})=>({overflowX:"auto","&::-webkit-scrollbar":{padding:"2px 0",height:"6px",border:`1px solid ${t.palette.divider}`},"&::-webkit-scrollbar-track":{background:t.palette.background.paper},"&::-webkit-scrollbar-thumb":{background:e?"rgba(5, 20, 158, 0.3)":t.palette.background.paper,borderRadius:"3px"},"&::-webkit-scrollbar-thumb:horizontal:active, &::-webkit-scrollbar-thumb:vertical:active":{background:e?"rgba(5, 20, 158, 0.6)":t.palette.background.paper},"&:hover .sticky":{boxShadow:r?`0px 2px 6px ${t.palette.background.paper}`:"none",transition:"box-shadow 200ms"}})));module.exports=o=>{const{children:a,onScroll:l,setIsScrolling:i,setScrollStarted:c}=o,[s,n]=r.useState(!1);return e.jsx(t,{hovered:s,isScrolling:!!i,onMouseEnter:()=>n(!0),onMouseLeave:()=>{n(!1),i&&i(!1),c&&c(!1)},onScroll:l,children:a})};
|
|
2
|
+
//# sourceMappingURL=HighlightScrollbar.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HighlightScrollbar.cjs.js","sources":["../../../../src/components/molecules/GenericTable/HighlightScrollbar.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport styled from '@fd/utilities/styledUtilities';\n\ninterface HighlightScrollbarProps {\n children: React.ReactNode;\n onScroll?: () => void;\n setIsScrolling?: React.Dispatch<React.SetStateAction<boolean>>;\n setScrollStarted?: React.Dispatch<React.SetStateAction<boolean>>;\n}\n\ninterface ContainerProps {\n hovered: boolean;\n isScrolling: boolean;\n}\n\nconst StyledContainer = styled('div')<ContainerProps>(({ hovered, isScrolling, theme }) => ({\n overflowX: 'auto',\n '&::-webkit-scrollbar': {\n padding: '2px 0',\n height: '6px',\n border: `1px solid ${theme.palette.divider}`,\n },\n '&::-webkit-scrollbar-track': {\n background: theme.palette.background.paper,\n },\n '&::-webkit-scrollbar-thumb': {\n background: hovered ? 'rgba(5, 20, 158, 0.3)' : theme.palette.background.paper,\n borderRadius: '3px',\n },\n '&::-webkit-scrollbar-thumb:horizontal:active, &::-webkit-scrollbar-thumb:vertical:active': {\n background: hovered ? 'rgba(5, 20, 158, 0.6)' : theme.palette.background.paper,\n },\n '&:hover .sticky': {\n boxShadow: isScrolling ? `0px 2px 6px ${theme.palette.background.paper}` : 'none',\n transition: 'box-shadow 200ms',\n },\n}));\n\nconst HighlightScrollbar: React.FC<React.PropsWithChildren<HighlightScrollbarProps>> = (props) => {\n const { children, onScroll, setIsScrolling, setScrollStarted } = props;\n const [hoveredTable, setHoveredTable] = useState(false);\n\n const highlightScrollbar = () => setHoveredTable(true);\n\n const fadeScrollbar = () => {\n setHoveredTable(false);\n if (setIsScrolling) setIsScrolling(false);\n if (setScrollStarted) setScrollStarted(false);\n };\n\n return (\n <StyledContainer\n hovered={hoveredTable}\n isScrolling={!!setIsScrolling}\n onMouseEnter={highlightScrollbar}\n onMouseLeave={fadeScrollbar}\n onScroll={onScroll}\n >\n {children}\n </StyledContainer>\n );\n};\n\nexport default HighlightScrollbar;\n"],"names":["StyledContainer","styled","hovered","isScrolling","theme","overflowX","padding","height","border","palette","divider","background","paper","borderRadius","boxShadow","transition","props","children","onScroll","setIsScrolling","setScrollStarted","hoveredTable","setHoveredTable","useState","_jsx","onMouseEnter","onMouseLeave"],"mappings":"mEAgBA,MAAMA,kCAAkBC,OAAO,MAAPA,EAA8B,EAAGC,UAASC,cAAaC,YAAO,CACpFC,UAAW,OACX,uBAAwB,CACtBC,QAAS,QACTC,OAAQ,MACRC,OAAQ,aAAaJ,EAAMK,QAAQC,WAErC,6BAA8B,CAC5BC,WAAYP,EAAMK,QAAQE,WAAWC,OAEvC,6BAA8B,CAC5BD,WAAYT,EAAU,wBAA0BE,EAAMK,QAAQE,WAAWC,MACzEC,aAAc,OAEhB,2FAA4F,CAC1FF,WAAYT,EAAU,wBAA0BE,EAAMK,QAAQE,WAAWC,OAE3E,kBAAmB,CACjBE,UAAWX,EAAc,eAAeC,EAAMK,QAAQE,WAAWC,QAAU,OAC3EG,WAAY,uCAIwEC,IACtF,MAAMC,SAAEA,EAAQC,SAAEA,EAAQC,eAAEA,EAAcC,iBAAEA,GAAqBJ,GAC1DK,EAAcC,GAAmBC,EAAAA,UAAS,GAUjD,OACEC,EAAAA,IAACxB,EAAe,CACdE,QAASmB,EACTlB,cAAegB,EACfM,aAZuB,IAAMH,GAAgB,GAa7CI,aAXkB,KACpBJ,GAAgB,GACZH,GAAgBA,GAAe,GAC/BC,GAAkBA,GAAiB,IASrCF,SAAUA,EAAQD,SAEjBA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import react__default from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface HighlightScrollbarProps {
|
|
4
4
|
children: react__default.ReactNode;
|
|
5
5
|
onScroll?: () => void;
|
|
6
6
|
setIsScrolling?: react__default.Dispatch<react__default.SetStateAction<boolean>>;
|
|
7
7
|
setScrollStarted?: react__default.Dispatch<react__default.SetStateAction<boolean>>;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
declare const HighlightScrollbar: react__default.FC<react__default.PropsWithChildren<HighlightScrollbarProps>>;
|
|
10
10
|
|
|
11
11
|
export { HighlightScrollbar as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useState as e}from"react";import{styled as o}from"@mui/material/styles";const t=o("div")((({hovered:r,isScrolling:e,theme:o})=>({overflowX:"auto","&::-webkit-scrollbar":{padding:"2px 0",height:"6px",border:`1px solid ${o.palette.divider}`},"&::-webkit-scrollbar-track":{background:o.palette.background.paper},"&::-webkit-scrollbar-thumb":{background:r?"rgba(5, 20, 158, 0.3)":o.palette.background.paper,borderRadius:"3px"},"&::-webkit-scrollbar-thumb:horizontal:active, &::-webkit-scrollbar-thumb:vertical:active":{background:r?"rgba(5, 20, 158, 0.6)":o.palette.background.paper},"&:hover .sticky":{boxShadow:e?`0px 2px 6px ${o.palette.background.paper}`:"none",transition:"box-shadow 200ms"}}))),a=o=>{const{children:a,onScroll:l,setIsScrolling:i,setScrollStarted:c}=o,[n,b]=e(!1);return r(t,{hovered:n,isScrolling:!!i,onMouseEnter:()=>b(!0),onMouseLeave:()=>{b(!1),i&&i(!1),c&&c(!1)},onScroll:l,children:a})};export{a as default};
|
|
2
|
+
//# sourceMappingURL=HighlightScrollbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HighlightScrollbar.js","sources":["../../../../src/components/molecules/GenericTable/HighlightScrollbar.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport styled from '@fd/utilities/styledUtilities';\n\ninterface HighlightScrollbarProps {\n children: React.ReactNode;\n onScroll?: () => void;\n setIsScrolling?: React.Dispatch<React.SetStateAction<boolean>>;\n setScrollStarted?: React.Dispatch<React.SetStateAction<boolean>>;\n}\n\ninterface ContainerProps {\n hovered: boolean;\n isScrolling: boolean;\n}\n\nconst StyledContainer = styled('div')<ContainerProps>(({ hovered, isScrolling, theme }) => ({\n overflowX: 'auto',\n '&::-webkit-scrollbar': {\n padding: '2px 0',\n height: '6px',\n border: `1px solid ${theme.palette.divider}`,\n },\n '&::-webkit-scrollbar-track': {\n background: theme.palette.background.paper,\n },\n '&::-webkit-scrollbar-thumb': {\n background: hovered ? 'rgba(5, 20, 158, 0.3)' : theme.palette.background.paper,\n borderRadius: '3px',\n },\n '&::-webkit-scrollbar-thumb:horizontal:active, &::-webkit-scrollbar-thumb:vertical:active': {\n background: hovered ? 'rgba(5, 20, 158, 0.6)' : theme.palette.background.paper,\n },\n '&:hover .sticky': {\n boxShadow: isScrolling ? `0px 2px 6px ${theme.palette.background.paper}` : 'none',\n transition: 'box-shadow 200ms',\n },\n}));\n\nconst HighlightScrollbar: React.FC<React.PropsWithChildren<HighlightScrollbarProps>> = (props) => {\n const { children, onScroll, setIsScrolling, setScrollStarted } = props;\n const [hoveredTable, setHoveredTable] = useState(false);\n\n const highlightScrollbar = () => setHoveredTable(true);\n\n const fadeScrollbar = () => {\n setHoveredTable(false);\n if (setIsScrolling) setIsScrolling(false);\n if (setScrollStarted) setScrollStarted(false);\n };\n\n return (\n <StyledContainer\n hovered={hoveredTable}\n isScrolling={!!setIsScrolling}\n onMouseEnter={highlightScrollbar}\n onMouseLeave={fadeScrollbar}\n onScroll={onScroll}\n >\n {children}\n </StyledContainer>\n );\n};\n\nexport default HighlightScrollbar;\n"],"names":["StyledContainer","styled","hovered","isScrolling","theme","overflowX","padding","height","border","palette","divider","background","paper","borderRadius","boxShadow","transition","HighlightScrollbar","props","children","onScroll","setIsScrolling","setScrollStarted","hoveredTable","setHoveredTable","useState","_jsx","onMouseEnter","onMouseLeave"],"mappings":"uHAgBA,MAAMA,EAAkBC,EAAO,MAAPA,EAA8B,EAAGC,UAASC,cAAaC,YAAO,CACpFC,UAAW,OACX,uBAAwB,CACtBC,QAAS,QACTC,OAAQ,MACRC,OAAQ,aAAaJ,EAAMK,QAAQC,WAErC,6BAA8B,CAC5BC,WAAYP,EAAMK,QAAQE,WAAWC,OAEvC,6BAA8B,CAC5BD,WAAYT,EAAU,wBAA0BE,EAAMK,QAAQE,WAAWC,MACzEC,aAAc,OAEhB,2FAA4F,CAC1FF,WAAYT,EAAU,wBAA0BE,EAAMK,QAAQE,WAAWC,OAE3E,kBAAmB,CACjBE,UAAWX,EAAc,eAAeC,EAAMK,QAAQE,WAAWC,QAAU,OAC3EG,WAAY,wBAIVC,EAAkFC,IACtF,MAAMC,SAAEA,EAAQC,SAAEA,EAAQC,eAAEA,EAAcC,iBAAEA,GAAqBJ,GAC1DK,EAAcC,GAAmBC,GAAS,GAUjD,OACEC,EAACzB,EAAe,CACdE,QAASoB,EACTnB,cAAeiB,EACfM,aAZuB,IAAMH,GAAgB,GAa7CI,aAXkB,KACpBJ,GAAgB,GACZH,GAAgBA,GAAe,GAC/BC,GAAkBA,GAAiB,IASrCF,SAAUA,EAAQD,SAEjBA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/Table"),t=require("@mui/material/TableCell"),r=require("@mui/material/TableHead"),a=require("@mui/material/TableRow"),l=require("@mui/material/Tooltip"),s=require("@mui/material/useMediaQuery"),o=require("../../atoms/IconButton/index.cjs.js"),n=require("@mui/material/styles"),d=require("@mui/material/styles/useTheme"),c=require("../../../icons/InformationCircle/index.cjs.js"),u=require("./GenericTableBody/index.cjs.js"),m=require("./GenericTableTitle/index.cjs.js"),h=require("./HighlightScrollbar.cjs.js");const x=n.styled("div")`
|
|
2
|
+
overflow-x: auto;
|
|
3
|
+
&::-webkit-scrollbar {
|
|
4
|
+
padding: 2px 0;
|
|
5
|
+
height: 6px;
|
|
6
|
+
border: 1px solid #d5d5d5;
|
|
7
|
+
}
|
|
8
|
+
&::-webkit-scrollbar-track {
|
|
9
|
+
background: #f1f1f1;
|
|
10
|
+
}
|
|
11
|
+
&::-webkit-scrollbar-thumb {
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
border-radius: 3px;
|
|
14
|
+
}
|
|
15
|
+
`,p=n.styled(t,{shouldForwardProp:e=>"isSticky"!==e&&"titleVariant"!==e})((({theme:e,isSticky:i,titleVariant:t})=>({fontSize:13,fontWeight:"light"===t?400:e.typography.fontWeightMedium,color:"light"===t?e.palette.semantic.text["text-weak"]:e.palette.semantic.text["text-strong"],padding:e.spacing(1.25,2),whiteSpace:"nowrap",position:i?"sticky":"relative",zIndex:i?1:"auto"}))),b=n.styled("div")`
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
`,g=n.styled(l)((({theme:e})=>({marginLeft:e.spacing(.5),svg:{fontSize:e.typography.body1.fontSize}})));module.exports=({data:t,title:l,subTitle:n,showTitle:j=!0,onRowClick:f,loading:y,metadata:k,titleVariant:w="default"})=>{const q=new Set(k.filter((e=>e.isVisible)).sort(((e,i)=>e.ordinal-i.ordinal)).map((e=>e.columnName))),T=k.reduce(((e,i)=>(e[i.columnName]=i,e)),{}),v=d(),S=!s(v.breakpoints.up("tablet")),I=S?"normal":"sticky";return e.jsxs(x,{children:[j&&e.jsx(m,{subTitle:n,title:l}),e.jsx(b,{children:e.jsx(h,{children:e.jsxs(i,{"aria-label":l,"data-testid":"generic-table"+(j?`-${l?.replace(" ","-").toLowerCase()}`:""),sx:{borderTop:"1px solid #e0e0e0",height:"10vh"},children:[e.jsx(r,{children:e.jsx(a,{children:Array.from(q).map(((i,t)=>{const{columnName:r,columnTitle:a,align:l="left",tooltip:s}=T[i]||{};return e.jsx(p,{align:l,isSticky:0===t&&!S,titleVariant:w,children:e.jsxs("div",{children:[e.jsx("span",{children:a}),s&&e.jsx(g,{placement:"right-start",title:s,children:e.jsx(o.IconButton,{"aria-label":"Info",size:"small",children:e.jsx(c,{"data-testid":"InfoOutlinedIcon",size:"sm"})})})]})},r)}))})}),e.jsx(u,{columns:q,data:t,loading:y,meta:T,onRowClick:f,type:I})]})})})]})};
|
|
18
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../../src/components/molecules/GenericTable/index.tsx"],"sourcesContent":["import Table from '@mui/material/Table';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport Tooltip from '@mui/material/Tooltip';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport IconButton from '@fd/components/atoms/IconButton';\nimport styled from '@fd/utilities/styledUtilities';\nimport useTheme from '@fd/utilities/useTheme';\n\nimport InfoOutlinedIcon from '../../../icons/InformationCircle';\nimport GenericTableBody, { type GenericTableColumns } from './GenericTableBody';\nimport GenericTableTitle from './GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\n\ninterface GenericTableProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n metadata: GenericTableColumns[];\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n showTitle?: boolean;\n subTitle?: string;\n title?: string;\n titleVariant?: 'default' | 'light';\n}\n\nconst StyledContainer = styled('div')`\n overflow-x: auto;\n &::-webkit-scrollbar {\n padding: 2px 0;\n height: 6px;\n border: 1px solid #d5d5d5;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #f5f5f5;\n border-radius: 3px;\n }\n`;\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'isSticky' && prop !== 'titleVariant',\n})<{ isSticky: boolean; titleVariant: 'default' | 'light' }>(({ theme, isSticky, titleVariant }) => ({\n fontSize: 13,\n fontWeight: titleVariant === 'light' ? 400 : theme.typography.fontWeightMedium,\n color:\n titleVariant === 'light'\n ? theme.palette.semantic.text['text-weak']\n : theme.palette.semantic.text['text-strong'],\n padding: theme.spacing(1.25, 2),\n whiteSpace: 'nowrap',\n position: isSticky ? 'sticky' : 'relative',\n zIndex: isSticky ? 1 : 'auto',\n}));\n\nconst StyledSpacingContainer = styled('div')`\n overflow: hidden;\n`;\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n marginLeft: theme.spacing(0.5),\n svg: {\n fontSize: theme.typography.body1.fontSize,\n },\n}));\n\nconst GenericTable = ({\n data,\n title,\n subTitle,\n showTitle = true,\n onRowClick,\n loading,\n metadata,\n titleVariant = 'default',\n}: GenericTableProps) => {\n const columns = new Set(\n metadata\n .filter((m) => m.isVisible)\n .sort((a, b) => a.ordinal - b.ordinal)\n .map((m) => m.columnName),\n );\n const tableMeta = metadata.reduce<{ [key: string]: GenericTableColumns }>((obj, mData) => {\n obj[mData.columnName] = mData;\n return obj;\n }, {});\n\n const theme = useTheme();\n const isMobile = !useMediaQuery(theme.breakpoints.up('tablet'));\n\n // We never want sticky on mobile - only on desktop\n const firstColumnStylePosition = isMobile ? 'normal' : 'sticky';\n\n const renderTableHeader = () => (\n <TableHead>\n <TableRow>\n {Array.from(columns).map((prop, idx) => {\n const { columnName, columnTitle, align = 'left', tooltip } = tableMeta[prop] || {};\n\n return (\n <StyledTableCell\n key={columnName}\n align={align}\n isSticky={idx === 0 && !isMobile}\n titleVariant={titleVariant}\n >\n <div>\n <span>{columnTitle}</span>\n {tooltip && (\n <StyledTooltip placement=\"right-start\" title={tooltip}>\n <IconButton aria-label=\"Info\" size=\"small\">\n <InfoOutlinedIcon data-testid=\"InfoOutlinedIcon\" size=\"sm\" />\n </IconButton>\n </StyledTooltip>\n )}\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle subTitle={subTitle} title={title}></GenericTableTitle>}\n <StyledSpacingContainer>\n <HighlightScrollbar>\n <Table\n aria-label={title}\n data-testid={`generic-table` + (showTitle ? `-${title?.replace(' ', '-').toLowerCase()}` : '')}\n sx={{\n borderTop: '1px solid #e0e0e0',\n height: '10vh',\n }}\n >\n {renderTableHeader()}\n <GenericTableBody\n columns={columns}\n data={data}\n loading={loading}\n meta={tableMeta}\n onRowClick={onRowClick}\n type={firstColumnStylePosition}\n />\n </Table>\n </HighlightScrollbar>\n </StyledSpacingContainer>\n </StyledContainer>\n );\n};\n\nexport default GenericTable;\n"],"names":["StyledContainer","styled","StyledTableCell","TableCell","shouldForwardProp","prop","theme","isSticky","titleVariant","fontSize","fontWeight","typography","fontWeightMedium","color","palette","semantic","text","padding","spacing","whiteSpace","position","zIndex","StyledSpacingContainer","StyledTooltip","Tooltip","marginLeft","svg","body1","data","title","subTitle","showTitle","onRowClick","loading","metadata","columns","Set","filter","m","isVisible","sort","a","b","ordinal","map","columnName","tableMeta","reduce","obj","mData","useTheme","isMobile","useMediaQuery","breakpoints","up","firstColumnStylePosition","_jsxs","children","_jsx","GenericTableTitle","HighlightScrollbar","Table","replace","toLowerCase","sx","borderTop","height","TableHead","TableRow","Array","from","idx","columnTitle","align","tooltip","placement","IconButton","size","InfoOutlinedIcon","GenericTableBody","meta","type"],"mappings":"wkBA6BA,MAAMA,EAAkBC,EAAAA,OAAO,MAAM;;;;;;;;;;;;;;EAgB/BC,EAAkBD,EAAAA,OAAOE,EAAW,CACxCC,kBAAoBC,GAAkB,aAATA,GAAgC,iBAATA,GAD9BJ,EAEqC,EAAGK,QAAOC,WAAUC,mBAAc,CAC7FC,SAAU,GACVC,WAA6B,UAAjBF,EAA2B,IAAMF,EAAMK,WAAWC,iBAC9DC,MACmB,UAAjBL,EACIF,EAAMQ,QAAQC,SAASC,KAAK,aAC5BV,EAAMQ,QAAQC,SAASC,KAAK,eAClCC,QAASX,EAAMY,QAAQ,KAAM,GAC7BC,WAAY,SACZC,SAAUb,EAAW,SAAW,WAChCc,OAAQd,EAAW,EAAI,WAGnBe,EAAyBrB,EAAAA,OAAO,MAAM;;EAItCsB,EAAgBtB,EAAAA,OAAOuB,EAAPvB,EAAgB,EAAGK,YAAO,CAC9CmB,WAAYnB,EAAMY,QAAQ,IAC1BQ,IAAK,CACHjB,SAAUH,EAAMK,WAAWgB,MAAMlB,6BAIhB,EACnBmB,OACAC,QACAC,WACAC,aAAY,EACZC,aACAC,UACAC,WACA1B,eAAe,cAEf,MAAM2B,EAAU,IAAIC,IAClBF,EACGG,QAAQC,GAAMA,EAAEC,YAChBC,MAAK,CAACC,EAAGC,IAAMD,EAAEE,QAAUD,EAAEC,UAC7BC,KAAKN,GAAMA,EAAEO,cAEZC,EAAYZ,EAASa,QAA+C,CAACC,EAAKC,KAC9ED,EAAIC,EAAMJ,YAAcI,EACjBD,IACN,CAAA,GAEG1C,EAAQ4C,IACRC,GAAYC,EAAc9C,EAAM+C,YAAYC,GAAG,WAG/CC,EAA2BJ,EAAW,SAAW,SAgCvD,OACEK,EAAAA,KAACxD,EAAe,CAAAyD,SAAA,CACb1B,GAAa2B,EAAAA,IAACC,EAAiB,CAAC7B,SAAUA,EAAUD,MAAOA,IAC5D6B,EAAAA,IAACpC,EAAsB,CAAAmC,SACrBC,MAACE,EAAkB,CAAAH,SACjBD,EAAAA,KAACK,EAAK,CAAA,aACQhC,gBACC,iBAAmBE,EAAY,IAAIF,GAAOiC,QAAQ,IAAK,KAAKC,gBAAkB,IAC3FC,GAAI,CACFC,UAAW,oBACXC,OAAQ,QACTT,SAAA,CAxCTC,EAAAA,IAACS,EAAS,CAAAV,SACRC,EAAAA,IAACU,EAAQ,CAAAX,SACNY,MAAMC,KAAKnC,GAASS,KAAI,CAACvC,EAAMkE,KAC9B,MAAM1B,WAAEA,EAAU2B,YAAEA,EAAWC,MAAEA,EAAQ,OAAMC,QAAEA,GAAY5B,EAAUzC,IAAS,CAAA,EAEhF,OACEqD,MAACxD,EAAe,CAEduE,MAAOA,EACPlE,SAAkB,IAARgE,IAAcpB,EACxB3C,aAAcA,EAAYiD,SAE1BD,EAAAA,sBACEE,EAAAA,IAAA,OAAA,CAAAD,SAAOe,IACNE,GACChB,EAAAA,IAACnC,EAAa,CAACoD,UAAU,cAAc9C,MAAO6C,EAAOjB,SACnDC,EAAAA,IAACkB,aAAU,CAAA,aAAY,OAAOC,KAAK,QAAOpB,SACxCC,MAACoB,EAAgB,CAAA,cAAa,mBAAmBD,KAAK,eAVzDhC,UAoCPa,MAACqB,EAAgB,CACf5C,QAASA,EACTP,KAAMA,EACNK,QAASA,EACT+C,KAAMlC,EACNd,WAAYA,EACZiD,KAAM1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import i from"@mui/material/Table";import r from"@mui/material/TableCell";import a from"@mui/material/TableHead";import o from"@mui/material/TableRow";import l from"@mui/material/Tooltip";import n from"@mui/material/useMediaQuery";import{IconButton as m}from"../../atoms/IconButton/index.js";import{styled as d}from"@mui/material/styles";import s from"@mui/material/styles/useTheme";import c from"../../../icons/InformationCircle/index.js";import p from"./GenericTableBody/index.js";import f from"./GenericTableTitle/index.js";import u from"./HighlightScrollbar.js";const h=d("div")`
|
|
2
|
+
overflow-x: auto;
|
|
3
|
+
&::-webkit-scrollbar {
|
|
4
|
+
padding: 2px 0;
|
|
5
|
+
height: 6px;
|
|
6
|
+
border: 1px solid #d5d5d5;
|
|
7
|
+
}
|
|
8
|
+
&::-webkit-scrollbar-track {
|
|
9
|
+
background: #f1f1f1;
|
|
10
|
+
}
|
|
11
|
+
&::-webkit-scrollbar-thumb {
|
|
12
|
+
background: #f5f5f5;
|
|
13
|
+
border-radius: 3px;
|
|
14
|
+
}
|
|
15
|
+
`,b=d(r,{shouldForwardProp:t=>"isSticky"!==t&&"titleVariant"!==t})((({theme:t,isSticky:e,titleVariant:i})=>({fontSize:13,fontWeight:"light"===i?400:t.typography.fontWeightMedium,color:"light"===i?t.palette.semantic.text["text-weak"]:t.palette.semantic.text["text-strong"],padding:t.spacing(1.25,2),whiteSpace:"nowrap",position:e?"sticky":"relative",zIndex:e?1:"auto"}))),g=d("div")`
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
`,x=d(l)((({theme:t})=>({marginLeft:t.spacing(.5),svg:{fontSize:t.typography.body1.fontSize}}))),y=({data:r,title:l,subTitle:d,showTitle:y=!0,onRowClick:k,loading:w,metadata:T,titleVariant:S="default"})=>{const v=new Set(T.filter((t=>t.isVisible)).sort(((t,e)=>t.ordinal-e.ordinal)).map((t=>t.columnName))),j=T.reduce(((t,e)=>(t[e.columnName]=e,t)),{}),z=s(),I=!n(z.breakpoints.up("tablet")),C=I?"normal":"sticky";return t(h,{children:[y&&e(f,{subTitle:d,title:l}),e(g,{children:e(u,{children:t(i,{"aria-label":l,"data-testid":"generic-table"+(y?`-${l?.replace(" ","-").toLowerCase()}`:""),sx:{borderTop:"1px solid #e0e0e0",height:"10vh"},children:[e(a,{children:e(o,{children:Array.from(v).map(((i,r)=>{const{columnName:a,columnTitle:o,align:l="left",tooltip:n}=j[i]||{};return e(b,{align:l,isSticky:0===r&&!I,titleVariant:S,children:t("div",{children:[e("span",{children:o}),n&&e(x,{placement:"right-start",title:n,children:e(m,{"aria-label":"Info",size:"small",children:e(c,{"data-testid":"InfoOutlinedIcon",size:"sm"})})})]})},a)}))})}),e(p,{columns:v,data:r,loading:w,meta:j,onRowClick:k,type:C})]})})})]})};export{y as default};
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/GenericTable/index.tsx"],"sourcesContent":["import Table from '@mui/material/Table';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport Tooltip from '@mui/material/Tooltip';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport IconButton from '@fd/components/atoms/IconButton';\nimport styled from '@fd/utilities/styledUtilities';\nimport useTheme from '@fd/utilities/useTheme';\n\nimport InfoOutlinedIcon from '../../../icons/InformationCircle';\nimport GenericTableBody, { type GenericTableColumns } from './GenericTableBody';\nimport GenericTableTitle from './GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\n\ninterface GenericTableProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n metadata: GenericTableColumns[];\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n showTitle?: boolean;\n subTitle?: string;\n title?: string;\n titleVariant?: 'default' | 'light';\n}\n\nconst StyledContainer = styled('div')`\n overflow-x: auto;\n &::-webkit-scrollbar {\n padding: 2px 0;\n height: 6px;\n border: 1px solid #d5d5d5;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #f5f5f5;\n border-radius: 3px;\n }\n`;\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'isSticky' && prop !== 'titleVariant',\n})<{ isSticky: boolean; titleVariant: 'default' | 'light' }>(({ theme, isSticky, titleVariant }) => ({\n fontSize: 13,\n fontWeight: titleVariant === 'light' ? 400 : theme.typography.fontWeightMedium,\n color:\n titleVariant === 'light'\n ? theme.palette.semantic.text['text-weak']\n : theme.palette.semantic.text['text-strong'],\n padding: theme.spacing(1.25, 2),\n whiteSpace: 'nowrap',\n position: isSticky ? 'sticky' : 'relative',\n zIndex: isSticky ? 1 : 'auto',\n}));\n\nconst StyledSpacingContainer = styled('div')`\n overflow: hidden;\n`;\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n marginLeft: theme.spacing(0.5),\n svg: {\n fontSize: theme.typography.body1.fontSize,\n },\n}));\n\nconst GenericTable = ({\n data,\n title,\n subTitle,\n showTitle = true,\n onRowClick,\n loading,\n metadata,\n titleVariant = 'default',\n}: GenericTableProps) => {\n const columns = new Set(\n metadata\n .filter((m) => m.isVisible)\n .sort((a, b) => a.ordinal - b.ordinal)\n .map((m) => m.columnName),\n );\n const tableMeta = metadata.reduce<{ [key: string]: GenericTableColumns }>((obj, mData) => {\n obj[mData.columnName] = mData;\n return obj;\n }, {});\n\n const theme = useTheme();\n const isMobile = !useMediaQuery(theme.breakpoints.up('tablet'));\n\n // We never want sticky on mobile - only on desktop\n const firstColumnStylePosition = isMobile ? 'normal' : 'sticky';\n\n const renderTableHeader = () => (\n <TableHead>\n <TableRow>\n {Array.from(columns).map((prop, idx) => {\n const { columnName, columnTitle, align = 'left', tooltip } = tableMeta[prop] || {};\n\n return (\n <StyledTableCell\n key={columnName}\n align={align}\n isSticky={idx === 0 && !isMobile}\n titleVariant={titleVariant}\n >\n <div>\n <span>{columnTitle}</span>\n {tooltip && (\n <StyledTooltip placement=\"right-start\" title={tooltip}>\n <IconButton aria-label=\"Info\" size=\"small\">\n <InfoOutlinedIcon data-testid=\"InfoOutlinedIcon\" size=\"sm\" />\n </IconButton>\n </StyledTooltip>\n )}\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle subTitle={subTitle} title={title}></GenericTableTitle>}\n <StyledSpacingContainer>\n <HighlightScrollbar>\n <Table\n aria-label={title}\n data-testid={`generic-table` + (showTitle ? `-${title?.replace(' ', '-').toLowerCase()}` : '')}\n sx={{\n borderTop: '1px solid #e0e0e0',\n height: '10vh',\n }}\n >\n {renderTableHeader()}\n <GenericTableBody\n columns={columns}\n data={data}\n loading={loading}\n meta={tableMeta}\n onRowClick={onRowClick}\n type={firstColumnStylePosition}\n />\n </Table>\n </HighlightScrollbar>\n </StyledSpacingContainer>\n </StyledContainer>\n );\n};\n\nexport default GenericTable;\n"],"names":["StyledContainer","styled","StyledTableCell","TableCell","shouldForwardProp","prop","theme","isSticky","titleVariant","fontSize","fontWeight","typography","fontWeightMedium","color","palette","semantic","text","padding","spacing","whiteSpace","position","zIndex","StyledSpacingContainer","StyledTooltip","Tooltip","marginLeft","svg","body1","GenericTable","data","title","subTitle","showTitle","onRowClick","loading","metadata","columns","Set","filter","m","isVisible","sort","a","b","ordinal","map","columnName","tableMeta","reduce","obj","mData","useTheme","isMobile","useMediaQuery","breakpoints","up","firstColumnStylePosition","_jsxs","children","_jsx","GenericTableTitle","HighlightScrollbar","Table","replace","toLowerCase","sx","borderTop","height","TableHead","TableRow","Array","from","idx","columnTitle","align","tooltip","placement","IconButton","size","InfoOutlinedIcon","GenericTableBody","meta","type"],"mappings":"wmBA6BA,MAAMA,EAAkBC,EAAO,MAAM;;;;;;;;;;;;;;EAgB/BC,EAAkBD,EAAOE,EAAW,CACxCC,kBAAoBC,GAAkB,aAATA,GAAgC,iBAATA,GAD9BJ,EAEqC,EAAGK,QAAOC,WAAUC,mBAAc,CAC7FC,SAAU,GACVC,WAA6B,UAAjBF,EAA2B,IAAMF,EAAMK,WAAWC,iBAC9DC,MACmB,UAAjBL,EACIF,EAAMQ,QAAQC,SAASC,KAAK,aAC5BV,EAAMQ,QAAQC,SAASC,KAAK,eAClCC,QAASX,EAAMY,QAAQ,KAAM,GAC7BC,WAAY,SACZC,SAAUb,EAAW,SAAW,WAChCc,OAAQd,EAAW,EAAI,WAGnBe,EAAyBrB,EAAO,MAAM;;EAItCsB,EAAgBtB,EAAOuB,EAAPvB,EAAgB,EAAGK,YAAO,CAC9CmB,WAAYnB,EAAMY,QAAQ,IAC1BQ,IAAK,CACHjB,SAAUH,EAAMK,WAAWgB,MAAMlB,cAI/BmB,EAAe,EACnBC,OACAC,QACAC,WACAC,aAAY,EACZC,aACAC,UACAC,WACA3B,eAAe,cAEf,MAAM4B,EAAU,IAAIC,IAClBF,EACGG,QAAQC,GAAMA,EAAEC,YAChBC,MAAK,CAACC,EAAGC,IAAMD,EAAEE,QAAUD,EAAEC,UAC7BC,KAAKN,GAAMA,EAAEO,cAEZC,EAAYZ,EAASa,QAA+C,CAACC,EAAKC,KAC9ED,EAAIC,EAAMJ,YAAcI,EACjBD,IACN,CAAA,GAEG3C,EAAQ6C,IACRC,GAAYC,EAAc/C,EAAMgD,YAAYC,GAAG,WAG/CC,EAA2BJ,EAAW,SAAW,SAgCvD,OACEK,EAACzD,EAAe,CAAA0D,SAAA,CACb1B,GAAa2B,EAACC,EAAiB,CAAC7B,SAAUA,EAAUD,MAAOA,IAC5D6B,EAACrC,EAAsB,CAAAoC,SACrBC,EAACE,EAAkB,CAAAH,SACjBD,EAACK,EAAK,CAAA,aACQhC,gBACC,iBAAmBE,EAAY,IAAIF,GAAOiC,QAAQ,IAAK,KAAKC,gBAAkB,IAC3FC,GAAI,CACFC,UAAW,oBACXC,OAAQ,QACTT,SAAA,CAxCTC,EAACS,EAAS,CAAAV,SACRC,EAACU,EAAQ,CAAAX,SACNY,MAAMC,KAAKnC,GAASS,KAAI,CAACxC,EAAMmE,KAC9B,MAAM1B,WAAEA,EAAU2B,YAAEA,EAAWC,MAAEA,EAAQ,OAAMC,QAAEA,GAAY5B,EAAU1C,IAAS,CAAA,EAEhF,OACEsD,EAACzD,EAAe,CAEdwE,MAAOA,EACPnE,SAAkB,IAARiE,IAAcpB,EACxB5C,aAAcA,EAAYkD,SAE1BD,mBACEE,EAAA,OAAA,CAAAD,SAAOe,IACNE,GACChB,EAACpC,EAAa,CAACqD,UAAU,cAAc9C,MAAO6C,EAAOjB,SACnDC,EAACkB,EAAU,CAAA,aAAY,OAAOC,KAAK,QAAOpB,SACxCC,EAACoB,EAAgB,CAAA,cAAa,mBAAmBD,KAAK,eAVzDhC,UAoCPa,EAACqB,EAAgB,CACf5C,QAASA,EACTP,KAAMA,EACNK,QAASA,EACT+C,KAAMlC,EACNd,WAAYA,EACZiD,KAAM1B"}
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime");require("react");var r=require("@mui/material/Box"),i=require("@mui/material/styles"),t=require("@mui/material/Typography"),s=require("../../icons/CustomerSupport/index.cjs.js"),a=require("@mui/material/Grid2");const l=i.styled(r)((({theme:e})=>({backgroundColor:e.palette.grey[200],borderRadius:"4px",padding:e.spacing(2)}))),n=i.styled(a)((({theme:e})=>({alignItems:"center",display:"flex",marginBottom:e.spacing(1.5)}))),d=i.styled(t)((({theme:e})=>({fontWeight:500,marginLeft:e.spacing(1)})));module.exports=({title:r,children:i})=>e.jsxs(l,{"data-testid":"flipdish-staff-only-container",children:[e.jsxs(n,{children:[e.jsx(s,{}),e.jsx(d,{children:r})]}),i]});
|
|
2
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/FlipdishStaffContainer/index.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport Box from '@mui/material/Box';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport SupportAgentOutlinedIcon from '../../icons/CustomerSupport';\nimport Grid from '../atoms/Grid';\n\nconst StyledContainer = styled(Box)(({ theme }) => ({\n backgroundColor: theme.palette.grey[200],\n borderRadius: '4px',\n padding: theme.spacing(2),\n}));\n\nconst TitleContainer = styled(Grid)(({ theme }) => ({\n alignItems: 'center',\n display: 'flex',\n marginBottom: theme.spacing(1.5),\n}));\n\nconst Title = styled(Typography)(({ theme }) => ({\n fontWeight: 500,\n marginLeft: theme.spacing(1),\n}));\n\ninterface Props {\n title: string;\n children: ReactNode;\n}\n\nconst FlipdishStaffContainer = ({ title, children }: Props) => {\n return (\n <StyledContainer data-testid=\"flipdish-staff-only-container\">\n <TitleContainer>\n <SupportAgentOutlinedIcon />\n <Title>{title}</Title>\n </TitleContainer>\n\n {children}\n </StyledContainer>\n );\n};\n\nexport default FlipdishStaffContainer;\n"],"names":["StyledContainer","styled","Box","theme","backgroundColor","palette","grey","borderRadius","padding","spacing","TitleContainer","Grid","alignItems","display","marginBottom","Title","Typography","fontWeight","marginLeft","title","children","_jsxs","_jsx","SupportAgentOutlinedIcon"],"mappings":"mQASA,MAAMA,EAAkBC,EAAAA,OAAOC,EAAPD,EAAY,EAAGE,YAAO,CAC1CC,gBAAiBD,EAAME,QAAQC,KAAK,KACpCC,aAAc,MACdC,QAASL,EAAMM,QAAQ,OAGrBC,EAAiBT,EAAAA,OAAOU,EAAPV,EAAa,EAAGE,YAAO,CAC1CS,WAAY,SACZC,QAAS,OACTC,aAAcX,EAAMM,QAAQ,SAG1BM,EAAQd,EAAAA,OAAOe,EAAPf,EAAmB,EAAGE,YAAO,CACvCc,WAAY,IACZC,WAAYf,EAAMM,QAAQ,sBAQC,EAAGU,QAAOC,cAEjCC,OAACrB,EAAe,CAAA,cAAa,gCAA+BoB,SAAA,CACxDC,OAACX,EAAc,CAAAU,SAAA,CACXE,EAAAA,IAACC,MACDD,MAACP,EAAK,CAAAK,SAAED,OAGXC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
title: string;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
declare const FlipdishStaffContainer: ({ title, children }: Props) => react_jsx_runtime.JSX.Element;
|
|
9
|
-
|
|
10
|
-
export { FlipdishStaffContainer as default };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsxs as t,jsx as i}from"react/jsx-runtime";import"react";import r from"@mui/material/Box";import{styled as e}from"@mui/material/styles";import m from"@mui/material/Typography";import o from"../../icons/CustomerSupport/index.js";import a from"@mui/material/Grid2";const n=e(r)((({theme:t})=>({backgroundColor:t.palette.grey[200],borderRadius:"4px",padding:t.spacing(2)}))),p=e(a)((({theme:t})=>({alignItems:"center",display:"flex",marginBottom:t.spacing(1.5)}))),l=e(m)((({theme:t})=>({fontWeight:500,marginLeft:t.spacing(1)}))),s=({title:r,children:e})=>t(n,{"data-testid":"flipdish-staff-only-container",children:[t(p,{children:[i(o,{}),i(l,{children:r})]}),e]});export{s as default};
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/FlipdishStaffContainer/index.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport Box from '@mui/material/Box';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport SupportAgentOutlinedIcon from '../../icons/CustomerSupport';\nimport Grid from '../atoms/Grid';\n\nconst StyledContainer = styled(Box)(({ theme }) => ({\n backgroundColor: theme.palette.grey[200],\n borderRadius: '4px',\n padding: theme.spacing(2),\n}));\n\nconst TitleContainer = styled(Grid)(({ theme }) => ({\n alignItems: 'center',\n display: 'flex',\n marginBottom: theme.spacing(1.5),\n}));\n\nconst Title = styled(Typography)(({ theme }) => ({\n fontWeight: 500,\n marginLeft: theme.spacing(1),\n}));\n\ninterface Props {\n title: string;\n children: ReactNode;\n}\n\nconst FlipdishStaffContainer = ({ title, children }: Props) => {\n return (\n <StyledContainer data-testid=\"flipdish-staff-only-container\">\n <TitleContainer>\n <SupportAgentOutlinedIcon />\n <Title>{title}</Title>\n </TitleContainer>\n\n {children}\n </StyledContainer>\n );\n};\n\nexport default FlipdishStaffContainer;\n"],"names":["StyledContainer","styled","Box","theme","backgroundColor","palette","grey","borderRadius","padding","spacing","TitleContainer","Grid","alignItems","display","marginBottom","Title","Typography","fontWeight","marginLeft","FlipdishStaffContainer","title","children","_jsxs","_jsx","SupportAgentOutlinedIcon"],"mappings":"8QASA,MAAMA,EAAkBC,EAAOC,EAAPD,EAAY,EAAGE,YAAO,CAC1CC,gBAAiBD,EAAME,QAAQC,KAAK,KACpCC,aAAc,MACdC,QAASL,EAAMM,QAAQ,OAGrBC,EAAiBT,EAAOU,EAAPV,EAAa,EAAGE,YAAO,CAC1CS,WAAY,SACZC,QAAS,OACTC,aAAcX,EAAMM,QAAQ,SAG1BM,EAAQd,EAAOe,EAAPf,EAAmB,EAAGE,YAAO,CACvCc,WAAY,IACZC,WAAYf,EAAMM,QAAQ,OAQxBU,EAAyB,EAAGC,QAAOC,cAEjCC,EAACtB,EAAe,CAAA,cAAa,gCAA+BqB,SAAA,CACxDC,EAACZ,EAAc,CAAAW,SAAA,CACXE,EAACC,MACDD,EAACR,EAAK,CAAAM,SAAED,OAGXC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var r=require("react/jsx-runtime"),e=require("@mui/material/styles"),o=require("react");const t=e.styled("div")((({hovered:r,isScrolling:e})=>({overflowX:"auto","&::-webkit-scrollbar":{padding:"2px 0",height:"6px",border:"1px solid #d5d5d5"},"&::-webkit-scrollbar-track":{background:"#f1f1f1"},"&::-webkit-scrollbar-thumb":{background:r?"rgba(5, 20, 158, 0.3)":"#f5f5f5",borderRadius:"3px"},"&::-webkit-scrollbar-thumb:horizontal:active, &::-webkit-scrollbar-thumb:vertical:active":{background:r?"rgba(5, 20, 158, 0.6)":"#f5f5f5"},"&:hover .sticky":{boxShadow:e?"0px 2px 6px rgba(0, 0, 0, 0.5)":"none",transition:"box-shadow 200ms"}})));module.exports=e=>{const{children:l,onScroll:i,setIsScrolling:a,setScrollStarted:s}=e,[c,b]=o.useState(!1);return r.jsx(t,{hovered:c,isScrolling:!!a,onMouseEnter:()=>b(!0),onMouseLeave:()=>{b(!1),a&&a(!1),s&&s(!1)},onScroll:i,children:l})};
|
|
2
|
-
//# sourceMappingURL=HighlightScrollbar.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightScrollbar.cjs.js","sources":["../../../src/components/GenericTable/HighlightScrollbar.tsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport React, { useState } from 'react';\n\ntype HighlightScrollbarProps = {\n children: React.ReactNode;\n onScroll?: () => void;\n setIsScrolling?: React.Dispatch<React.SetStateAction<boolean>>;\n setScrollStarted?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\ninterface ContainerProps {\n hovered: boolean;\n isScrolling: boolean;\n}\n\nconst StyledContainer = styled('div')<ContainerProps>(({ hovered, isScrolling }) => ({\n overflowX: 'auto',\n '&::-webkit-scrollbar': {\n padding: '2px 0',\n height: '6px',\n border: '1px solid #d5d5d5',\n },\n '&::-webkit-scrollbar-track': {\n background: '#f1f1f1',\n },\n '&::-webkit-scrollbar-thumb': {\n background: hovered ? 'rgba(5, 20, 158, 0.3)' : '#f5f5f5',\n borderRadius: '3px',\n },\n '&::-webkit-scrollbar-thumb:horizontal:active, &::-webkit-scrollbar-thumb:vertical:active': {\n background: hovered ? 'rgba(5, 20, 158, 0.6)' : '#f5f5f5',\n },\n '&:hover .sticky': {\n boxShadow: isScrolling ? '0px 2px 6px rgba(0, 0, 0, 0.5)' : 'none',\n transition: 'box-shadow 200ms',\n },\n}));\n\nconst HighlightScrollbar: React.FC<React.PropsWithChildren<HighlightScrollbarProps>> = (props) => {\n const { children, onScroll, setIsScrolling, setScrollStarted } = props;\n const [hoveredTable, setHoveredTable] = useState(false);\n\n const highlightScrollbar = () => setHoveredTable(true);\n\n const fadeScrollbar = () => {\n setHoveredTable(false);\n if (setIsScrolling) setIsScrolling(false);\n if (setScrollStarted) setScrollStarted(false);\n };\n\n return (\n <StyledContainer\n hovered={hoveredTable}\n isScrolling={!!setIsScrolling}\n onMouseEnter={highlightScrollbar}\n onMouseLeave={fadeScrollbar}\n onScroll={onScroll}\n >\n {children}\n </StyledContainer>\n );\n};\n\nexport default HighlightScrollbar;\n"],"names":["StyledContainer","styled","hovered","isScrolling","overflowX","padding","height","border","background","borderRadius","boxShadow","transition","props","children","onScroll","setIsScrolling","setScrollStarted","hoveredTable","setHoveredTable","useState","_jsx","onMouseEnter","onMouseLeave"],"mappings":"qGAeA,MAAMA,EAAkBC,EAAAA,OAAO,MAAPA,EAA8B,EAAGC,UAASC,kBAAa,CAC3EC,UAAW,OACX,uBAAwB,CACpBC,QAAS,QACTC,OAAQ,MACRC,OAAQ,qBAEZ,6BAA8B,CAC1BC,WAAY,WAEhB,6BAA8B,CAC1BA,WAAYN,EAAU,wBAA0B,UAChDO,aAAc,OAElB,2FAA4F,CACxFD,WAAYN,EAAU,wBAA0B,WAEpD,kBAAmB,CACfQ,UAAWP,EAAc,iCAAmC,OAC5DQ,WAAY,uCAIoEC,IACpF,MAAMC,SAAEA,EAAQC,SAAEA,EAAQC,eAAEA,EAAcC,iBAAEA,GAAqBJ,GAC1DK,EAAcC,GAAmBC,EAAAA,UAAS,GAUjD,OACIC,EAAAA,IAACpB,EAAe,CACZE,QAASe,EACTd,cAAeY,EACfM,aAZmB,IAAMH,GAAgB,GAazCI,aAXc,KAClBJ,GAAgB,GACZH,GAAgBA,GAAe,GAC/BC,GAAkBA,GAAiB,IASnCF,SAAUA,EAAQD,SAEjBA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{styled as o}from"@mui/material/styles";import{useState as e}from"react";const t=o("div")((({hovered:r,isScrolling:o})=>({overflowX:"auto","&::-webkit-scrollbar":{padding:"2px 0",height:"6px",border:"1px solid #d5d5d5"},"&::-webkit-scrollbar-track":{background:"#f1f1f1"},"&::-webkit-scrollbar-thumb":{background:r?"rgba(5, 20, 158, 0.3)":"#f5f5f5",borderRadius:"3px"},"&::-webkit-scrollbar-thumb:horizontal:active, &::-webkit-scrollbar-thumb:vertical:active":{background:r?"rgba(5, 20, 158, 0.6)":"#f5f5f5"},"&:hover .sticky":{boxShadow:o?"0px 2px 6px rgba(0, 0, 0, 0.5)":"none",transition:"box-shadow 200ms"}}))),l=o=>{const{children:l,onScroll:a,setIsScrolling:i,setScrollStarted:c}=o,[s,b]=e(!1);return r(t,{hovered:s,isScrolling:!!i,onMouseEnter:()=>b(!0),onMouseLeave:()=>{b(!1),i&&i(!1),c&&c(!1)},onScroll:a,children:l})};export{l as default};
|
|
2
|
-
//# sourceMappingURL=HighlightScrollbar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightScrollbar.js","sources":["../../../src/components/GenericTable/HighlightScrollbar.tsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport React, { useState } from 'react';\n\ntype HighlightScrollbarProps = {\n children: React.ReactNode;\n onScroll?: () => void;\n setIsScrolling?: React.Dispatch<React.SetStateAction<boolean>>;\n setScrollStarted?: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\ninterface ContainerProps {\n hovered: boolean;\n isScrolling: boolean;\n}\n\nconst StyledContainer = styled('div')<ContainerProps>(({ hovered, isScrolling }) => ({\n overflowX: 'auto',\n '&::-webkit-scrollbar': {\n padding: '2px 0',\n height: '6px',\n border: '1px solid #d5d5d5',\n },\n '&::-webkit-scrollbar-track': {\n background: '#f1f1f1',\n },\n '&::-webkit-scrollbar-thumb': {\n background: hovered ? 'rgba(5, 20, 158, 0.3)' : '#f5f5f5',\n borderRadius: '3px',\n },\n '&::-webkit-scrollbar-thumb:horizontal:active, &::-webkit-scrollbar-thumb:vertical:active': {\n background: hovered ? 'rgba(5, 20, 158, 0.6)' : '#f5f5f5',\n },\n '&:hover .sticky': {\n boxShadow: isScrolling ? '0px 2px 6px rgba(0, 0, 0, 0.5)' : 'none',\n transition: 'box-shadow 200ms',\n },\n}));\n\nconst HighlightScrollbar: React.FC<React.PropsWithChildren<HighlightScrollbarProps>> = (props) => {\n const { children, onScroll, setIsScrolling, setScrollStarted } = props;\n const [hoveredTable, setHoveredTable] = useState(false);\n\n const highlightScrollbar = () => setHoveredTable(true);\n\n const fadeScrollbar = () => {\n setHoveredTable(false);\n if (setIsScrolling) setIsScrolling(false);\n if (setScrollStarted) setScrollStarted(false);\n };\n\n return (\n <StyledContainer\n hovered={hoveredTable}\n isScrolling={!!setIsScrolling}\n onMouseEnter={highlightScrollbar}\n onMouseLeave={fadeScrollbar}\n onScroll={onScroll}\n >\n {children}\n </StyledContainer>\n );\n};\n\nexport default HighlightScrollbar;\n"],"names":["StyledContainer","styled","hovered","isScrolling","overflowX","padding","height","border","background","borderRadius","boxShadow","transition","HighlightScrollbar","props","children","onScroll","setIsScrolling","setScrollStarted","hoveredTable","setHoveredTable","useState","_jsx","onMouseEnter","onMouseLeave"],"mappings":"uHAeA,MAAMA,EAAkBC,EAAO,MAAPA,EAA8B,EAAGC,UAASC,kBAAa,CAC3EC,UAAW,OACX,uBAAwB,CACpBC,QAAS,QACTC,OAAQ,MACRC,OAAQ,qBAEZ,6BAA8B,CAC1BC,WAAY,WAEhB,6BAA8B,CAC1BA,WAAYN,EAAU,wBAA0B,UAChDO,aAAc,OAElB,2FAA4F,CACxFD,WAAYN,EAAU,wBAA0B,WAEpD,kBAAmB,CACfQ,UAAWP,EAAc,iCAAmC,OAC5DQ,WAAY,wBAIdC,EAAkFC,IACpF,MAAMC,SAAEA,EAAQC,SAAEA,EAAQC,eAAEA,EAAcC,iBAAEA,GAAqBJ,GAC1DK,EAAcC,GAAmBC,GAAS,GAUjD,OACIC,EAACrB,EAAe,CACZE,QAASgB,EACTf,cAAea,EACfM,aAZmB,IAAMH,GAAgB,GAazCI,aAXc,KAClBJ,GAAgB,GACZH,GAAgBA,GAAe,GAC/BC,GAAkBA,GAAiB,IASnCF,SAAUA,EAAQD,SAEjBA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/Card"),t=require("@mui/material/IconButton"),r=require("@mui/material/styles"),a=require("@mui/material/Table"),l=require("@mui/material/TableCell"),s=require("@mui/material/TableHead"),n=require("@mui/material/TableRow"),o=require("@mui/material/Tooltip"),d=require("@mui/material/useMediaQuery"),c=require("../../icons/InformationCircle/index.cjs.js"),u=require("../GenericTableBody/index.cjs.js"),m=require("../GenericTableTitle/index.cjs.js"),h=require("./HighlightScrollbar.cjs.js");const p=r.styled("div")`
|
|
2
|
-
overflow-x: auto;
|
|
3
|
-
&::-webkit-scrollbar {
|
|
4
|
-
padding: 2px 0;
|
|
5
|
-
height: 6px;
|
|
6
|
-
border: 1px solid #d5d5d5;
|
|
7
|
-
}
|
|
8
|
-
&::-webkit-scrollbar-track {
|
|
9
|
-
background: #f1f1f1;
|
|
10
|
-
}
|
|
11
|
-
&::-webkit-scrollbar-thumb {
|
|
12
|
-
background: #f5f5f5;
|
|
13
|
-
border-radius: 3px;
|
|
14
|
-
}
|
|
15
|
-
`,x=r.styled(l,{shouldForwardProp:e=>"isSticky"!==e&&"titleVariant"!==e})((({theme:e,isSticky:i,titleVariant:t})=>({fontSize:13,fontWeight:"light"===t?400:e.typography.fontWeightMedium,color:"light"===t?e.palette.semantic.text["text-weak"]:e.palette.semantic.text["text-strong"],padding:e.spacing(1.25,2),whiteSpace:"nowrap",position:i?"sticky":"relative",zIndex:i?1:"auto"}))),b=r.styled(i)`
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
`,g=r.styled(o)((({theme:e})=>({marginLeft:e.spacing(.5),svg:{fontSize:e.typography.body1.fontSize}})));module.exports=({data:i,title:l,subTitle:o,showTitle:j=!0,onRowClick:f,loading:y,metadata:k,titleVariant:w="default"})=>{const q=new Set(k.filter((e=>e.isVisible)).sort(((e,i)=>e.ordinal-i.ordinal)).map((e=>e.columnName))),T=k.reduce(((e,i)=>(e[i.columnName]=i,e)),{}),S=r.useTheme(),v=!d(S.breakpoints.up("tablet")),z=v?"normal":"sticky";return e.jsxs(p,{children:[j&&e.jsx(m,{subTitle:o,title:l}),e.jsx(b,{children:e.jsx(h,{children:e.jsxs(a,{"aria-label":l,"data-testid":"generic-table"+(j?`-${l?.replace(" ","-").toLowerCase()}`:""),children:[e.jsx(s,{children:e.jsx(n,{children:Array.from(q).map(((i,r)=>{const{columnName:a,columnTitle:l,align:s="left",tooltip:n}=T[i]||{};return e.jsx(x,{align:s,isSticky:0===r&&!v,titleVariant:w,children:e.jsxs("div",{children:[e.jsx("span",{children:l}),n&&e.jsx(g,{placement:"right-start",title:n,children:e.jsx(t,{size:"small",children:e.jsx(c,{"data-testid":"InfoOutlinedIcon",size:"sm"})})})]})},a)}))})}),e.jsx(u,{columns:q,data:i,loading:y,meta:T,type:z,onRowClick:f})]})})})]})};
|
|
18
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/GenericTable/index.tsx"],"sourcesContent":["import Card from '@mui/material/Card';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Table from '@mui/material/Table';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport Tooltip from '@mui/material/Tooltip';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport InfoOutlinedIcon from '../../icons/InformationCircle';\nimport GenericTableBody, { type GenericTableColumns } from '../GenericTableBody';\nimport GenericTableTitle from '../GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\n\ninterface GenericTableProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n metadata: GenericTableColumns[];\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n showTitle?: boolean;\n subTitle?: string;\n title?: string;\n titleVariant?: 'default' | 'light';\n}\n\nconst StyledContainer = styled('div')`\n overflow-x: auto;\n &::-webkit-scrollbar {\n padding: 2px 0;\n height: 6px;\n border: 1px solid #d5d5d5;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #f5f5f5;\n border-radius: 3px;\n }\n`;\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'isSticky' && prop !== 'titleVariant',\n})<{ isSticky: boolean; titleVariant: 'default' | 'light' }>(({ theme, isSticky, titleVariant }) => ({\n fontSize: 13,\n fontWeight: titleVariant === 'light' ? 400 : theme.typography.fontWeightMedium,\n color:\n titleVariant === 'light'\n ? theme.palette.semantic.text['text-weak']\n : theme.palette.semantic.text['text-strong'],\n padding: theme.spacing(1.25, 2),\n whiteSpace: 'nowrap',\n position: isSticky ? 'sticky' : 'relative',\n zIndex: isSticky ? 1 : 'auto',\n}));\n\nconst StyledPaper = styled(Card)`\n overflow: hidden;\n`;\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n marginLeft: theme.spacing(0.5),\n svg: {\n fontSize: theme.typography.body1.fontSize,\n },\n}));\n\nconst GenericTable = ({\n data,\n title,\n subTitle,\n showTitle = true,\n onRowClick,\n loading,\n metadata,\n titleVariant = 'default',\n}: GenericTableProps) => {\n const columns = new Set(\n metadata\n .filter((m) => m.isVisible)\n .sort((a, b) => a.ordinal - b.ordinal)\n .map((m) => m.columnName),\n );\n const tableMeta = metadata.reduce<{ [key: string]: GenericTableColumns }>((obj, mData) => {\n obj[mData.columnName] = mData;\n return obj;\n }, {});\n\n const theme = useTheme();\n const isMobile = !useMediaQuery(theme.breakpoints.up('tablet'));\n\n // We never want sticky on mobile - only on desktop\n const firstColumnStylePosition = isMobile ? 'normal' : 'sticky';\n\n const renderTableHeader = () => (\n <TableHead>\n <TableRow>\n {Array.from(columns).map((prop, idx) => {\n const { columnName, columnTitle, align = 'left', tooltip } = tableMeta[prop] || {};\n\n return (\n <StyledTableCell\n key={columnName}\n align={align}\n isSticky={idx === 0 && !isMobile}\n titleVariant={titleVariant}\n >\n <div>\n <span>{columnTitle}</span>\n {tooltip && (\n <StyledTooltip placement=\"right-start\" title={tooltip}>\n <IconButton size=\"small\">\n <InfoOutlinedIcon data-testid=\"InfoOutlinedIcon\" size=\"sm\" />\n </IconButton>\n </StyledTooltip>\n )}\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle subTitle={subTitle} title={title}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table\n aria-label={title}\n data-testid={`generic-table` + (showTitle ? `-${title?.replace(' ', '-').toLowerCase()}` : '')}\n >\n {renderTableHeader()}\n <GenericTableBody\n columns={columns}\n data={data}\n loading={loading}\n meta={tableMeta}\n type={firstColumnStylePosition}\n onRowClick={onRowClick}\n />\n </Table>\n </HighlightScrollbar>\n </StyledPaper>\n </StyledContainer>\n );\n};\n\nexport default GenericTable;\n"],"names":["StyledContainer","styled","StyledTableCell","TableCell","shouldForwardProp","prop","theme","isSticky","titleVariant","fontSize","fontWeight","typography","fontWeightMedium","color","palette","semantic","text","padding","spacing","whiteSpace","position","zIndex","StyledPaper","Card","StyledTooltip","Tooltip","marginLeft","svg","body1","data","title","subTitle","showTitle","onRowClick","loading","metadata","columns","Set","filter","m","isVisible","sort","a","b","ordinal","map","columnName","tableMeta","reduce","obj","mData","useTheme","isMobile","useMediaQuery","breakpoints","up","firstColumnStylePosition","_jsxs","_jsx","GenericTableTitle","children","HighlightScrollbar","Table","replace","toLowerCase","TableHead","TableRow","Array","from","idx","columnTitle","align","tooltip","placement","IconButton","size","InfoOutlinedIcon","GenericTableBody","meta","type"],"mappings":"ijBA4BA,MAAMA,EAAkBC,EAAAA,OAAO,MAAM;;;;;;;;;;;;;;EAgB/BC,EAAkBD,EAAAA,OAAOE,EAAW,CACxCC,kBAAoBC,GAAkB,aAATA,GAAgC,iBAATA,GAD9BJ,EAEqC,EAAGK,QAAOC,WAAUC,mBAAc,CAC7FC,SAAU,GACVC,WAA6B,UAAjBF,EAA2B,IAAMF,EAAMK,WAAWC,iBAC9DC,MACmB,UAAjBL,EACIF,EAAMQ,QAAQC,SAASC,KAAK,aAC5BV,EAAMQ,QAAQC,SAASC,KAAK,eAClCC,QAASX,EAAMY,QAAQ,KAAM,GAC7BC,WAAY,SACZC,SAAUb,EAAW,SAAW,WAChCc,OAAQd,EAAW,EAAI,WAGnBe,EAAcrB,EAAAA,OAAOsB,EAAK;;EAI1BC,EAAgBvB,EAAAA,OAAOwB,EAAPxB,EAAgB,EAAGK,YAAO,CAC9CoB,WAAYpB,EAAMY,QAAQ,IAC1BS,IAAK,CACHlB,SAAUH,EAAMK,WAAWiB,MAAMnB,6BAIhB,EACnBoB,OACAC,QACAC,WACAC,aAAY,EACZC,aACAC,UACAC,WACA3B,eAAe,cAEf,MAAM4B,EAAU,IAAIC,IAClBF,EACGG,QAAQC,GAAMA,EAAEC,YAChBC,MAAK,CAACC,EAAGC,IAAMD,EAAEE,QAAUD,EAAEC,UAC7BC,KAAKN,GAAMA,EAAEO,cAEZC,EAAYZ,EAASa,QAA+C,CAACC,EAAKC,KAC9ED,EAAIC,EAAMJ,YAAcI,EACjBD,IACN,CAAA,GAEG3C,EAAQ6C,EAAAA,WACRC,GAAYC,EAAc/C,EAAMgD,YAAYC,GAAG,WAG/CC,EAA2BJ,EAAW,SAAW,SAgCvD,OACEK,EAAAA,KAACzD,aACEgC,GAAa0B,EAAAA,IAACC,EAAiB,CAAC5B,SAAUA,EAAUD,MAAOA,IAC5D4B,EAAAA,IAACpC,EAAW,CAAAsC,SACVF,EAAAA,IAACG,EAAkB,CAAAD,SACjBH,EAAAA,KAACK,EAAK,CAAA,aACQhC,EAAK,cACJ,iBAAmBE,EAAY,IAAIF,GAAOiC,QAAQ,IAAK,KAAKC,gBAAkB,IAAGJ,SAAA,CApCtGF,EAAAA,IAACO,EAAS,CAAAL,SACRF,EAAAA,IAACQ,EAAQ,CAAAN,SACNO,MAAMC,KAAKhC,GAASS,KAAI,CAACxC,EAAMgE,KAC9B,MAAMvB,WAAEA,EAAUwB,YAAEA,EAAWC,MAAEA,EAAQ,OAAMC,QAAEA,GAAYzB,EAAU1C,IAAS,CAAA,EAEhF,OACEqD,MAACxD,EAAe,CAEdqE,MAAOA,EACPhE,SAAkB,IAAR8D,IAAcjB,EACxB5C,aAAcA,EAAYoD,SAE1BH,EAAAA,KAAA,MAAA,CAAAG,SAAA,CACEF,EAAAA,IAAA,OAAA,CAAAE,SAAOU,IACNE,GACCd,EAAAA,IAAClC,EAAa,CAACiD,UAAU,cAAc3C,MAAO0C,EAAOZ,SACnDF,EAAAA,IAACgB,EAAU,CAACC,KAAK,iBACfjB,EAAAA,IAACkB,EAAgB,CAAA,cAAa,mBAAmBD,KAAK,eAVzD7B,UAgCPY,EAAAA,IAACmB,EAAgB,CACfzC,QAASA,EACTP,KAAMA,EACNK,QAASA,EACT4C,KAAM/B,EACNgC,KAAMvB,EACNvB,WAAYA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{jsxs as t,jsx as i}from"react/jsx-runtime";import e from"@mui/material/Card";import r from"@mui/material/IconButton";import{styled as a,useTheme as o}from"@mui/material/styles";import l from"@mui/material/Table";import m from"@mui/material/TableCell";import n from"@mui/material/TableHead";import d from"@mui/material/TableRow";import c from"@mui/material/Tooltip";import s from"@mui/material/useMediaQuery";import p from"../../icons/InformationCircle/index.js";import f from"../GenericTableBody/index.js";import u from"../GenericTableTitle/index.js";import h from"./HighlightScrollbar.js";const b=a("div")`
|
|
2
|
-
overflow-x: auto;
|
|
3
|
-
&::-webkit-scrollbar {
|
|
4
|
-
padding: 2px 0;
|
|
5
|
-
height: 6px;
|
|
6
|
-
border: 1px solid #d5d5d5;
|
|
7
|
-
}
|
|
8
|
-
&::-webkit-scrollbar-track {
|
|
9
|
-
background: #f1f1f1;
|
|
10
|
-
}
|
|
11
|
-
&::-webkit-scrollbar-thumb {
|
|
12
|
-
background: #f5f5f5;
|
|
13
|
-
border-radius: 3px;
|
|
14
|
-
}
|
|
15
|
-
`,g=a(m,{shouldForwardProp:t=>"isSticky"!==t&&"titleVariant"!==t})((({theme:t,isSticky:i,titleVariant:e})=>({fontSize:13,fontWeight:"light"===e?400:t.typography.fontWeightMedium,color:"light"===e?t.palette.semantic.text["text-weak"]:t.palette.semantic.text["text-strong"],padding:t.spacing(1.25,2),whiteSpace:"nowrap",position:i?"sticky":"relative",zIndex:i?1:"auto"}))),k=a(e)`
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
`,w=a(c)((({theme:t})=>({marginLeft:t.spacing(.5),svg:{fontSize:t.typography.body1.fontSize}}))),x=({data:e,title:a,subTitle:m,showTitle:c=!0,onRowClick:x,loading:y,metadata:T,titleVariant:S="default"})=>{const v=new Set(T.filter((t=>t.isVisible)).sort(((t,i)=>t.ordinal-i.ordinal)).map((t=>t.columnName))),z=T.reduce(((t,i)=>(t[i.columnName]=i,t)),{}),C=o(),j=!s(C.breakpoints.up("tablet")),I=j?"normal":"sticky";return t(b,{children:[c&&i(u,{subTitle:m,title:a}),i(k,{children:i(h,{children:t(l,{"aria-label":a,"data-testid":"generic-table"+(c?`-${a?.replace(" ","-").toLowerCase()}`:""),children:[i(n,{children:i(d,{children:Array.from(v).map(((e,a)=>{const{columnName:o,columnTitle:l,align:m="left",tooltip:n}=z[e]||{};return i(g,{align:m,isSticky:0===a&&!j,titleVariant:S,children:t("div",{children:[i("span",{children:l}),n&&i(w,{placement:"right-start",title:n,children:i(r,{size:"small",children:i(p,{"data-testid":"InfoOutlinedIcon",size:"sm"})})})]})},o)}))})}),i(f,{columns:v,data:e,loading:y,meta:z,type:I,onRowClick:x})]})})})]})};export{x as default};
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/GenericTable/index.tsx"],"sourcesContent":["import Card from '@mui/material/Card';\nimport IconButton from '@mui/material/IconButton';\nimport { styled, useTheme } from '@mui/material/styles';\nimport Table from '@mui/material/Table';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport Tooltip from '@mui/material/Tooltip';\nimport useMediaQuery from '@mui/material/useMediaQuery';\n\nimport InfoOutlinedIcon from '../../icons/InformationCircle';\nimport GenericTableBody, { type GenericTableColumns } from '../GenericTableBody';\nimport GenericTableTitle from '../GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\n\ninterface GenericTableProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n metadata: GenericTableColumns[];\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n showTitle?: boolean;\n subTitle?: string;\n title?: string;\n titleVariant?: 'default' | 'light';\n}\n\nconst StyledContainer = styled('div')`\n overflow-x: auto;\n &::-webkit-scrollbar {\n padding: 2px 0;\n height: 6px;\n border: 1px solid #d5d5d5;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #f5f5f5;\n border-radius: 3px;\n }\n`;\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'isSticky' && prop !== 'titleVariant',\n})<{ isSticky: boolean; titleVariant: 'default' | 'light' }>(({ theme, isSticky, titleVariant }) => ({\n fontSize: 13,\n fontWeight: titleVariant === 'light' ? 400 : theme.typography.fontWeightMedium,\n color:\n titleVariant === 'light'\n ? theme.palette.semantic.text['text-weak']\n : theme.palette.semantic.text['text-strong'],\n padding: theme.spacing(1.25, 2),\n whiteSpace: 'nowrap',\n position: isSticky ? 'sticky' : 'relative',\n zIndex: isSticky ? 1 : 'auto',\n}));\n\nconst StyledPaper = styled(Card)`\n overflow: hidden;\n`;\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n marginLeft: theme.spacing(0.5),\n svg: {\n fontSize: theme.typography.body1.fontSize,\n },\n}));\n\nconst GenericTable = ({\n data,\n title,\n subTitle,\n showTitle = true,\n onRowClick,\n loading,\n metadata,\n titleVariant = 'default',\n}: GenericTableProps) => {\n const columns = new Set(\n metadata\n .filter((m) => m.isVisible)\n .sort((a, b) => a.ordinal - b.ordinal)\n .map((m) => m.columnName),\n );\n const tableMeta = metadata.reduce<{ [key: string]: GenericTableColumns }>((obj, mData) => {\n obj[mData.columnName] = mData;\n return obj;\n }, {});\n\n const theme = useTheme();\n const isMobile = !useMediaQuery(theme.breakpoints.up('tablet'));\n\n // We never want sticky on mobile - only on desktop\n const firstColumnStylePosition = isMobile ? 'normal' : 'sticky';\n\n const renderTableHeader = () => (\n <TableHead>\n <TableRow>\n {Array.from(columns).map((prop, idx) => {\n const { columnName, columnTitle, align = 'left', tooltip } = tableMeta[prop] || {};\n\n return (\n <StyledTableCell\n key={columnName}\n align={align}\n isSticky={idx === 0 && !isMobile}\n titleVariant={titleVariant}\n >\n <div>\n <span>{columnTitle}</span>\n {tooltip && (\n <StyledTooltip placement=\"right-start\" title={tooltip}>\n <IconButton size=\"small\">\n <InfoOutlinedIcon data-testid=\"InfoOutlinedIcon\" size=\"sm\" />\n </IconButton>\n </StyledTooltip>\n )}\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle subTitle={subTitle} title={title}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table\n aria-label={title}\n data-testid={`generic-table` + (showTitle ? `-${title?.replace(' ', '-').toLowerCase()}` : '')}\n >\n {renderTableHeader()}\n <GenericTableBody\n columns={columns}\n data={data}\n loading={loading}\n meta={tableMeta}\n type={firstColumnStylePosition}\n onRowClick={onRowClick}\n />\n </Table>\n </HighlightScrollbar>\n </StyledPaper>\n </StyledContainer>\n );\n};\n\nexport default GenericTable;\n"],"names":["StyledContainer","styled","StyledTableCell","TableCell","shouldForwardProp","prop","theme","isSticky","titleVariant","fontSize","fontWeight","typography","fontWeightMedium","color","palette","semantic","text","padding","spacing","whiteSpace","position","zIndex","StyledPaper","Card","StyledTooltip","Tooltip","marginLeft","svg","body1","GenericTable","data","title","subTitle","showTitle","onRowClick","loading","metadata","columns","Set","filter","m","isVisible","sort","a","b","ordinal","map","columnName","tableMeta","reduce","obj","mData","useTheme","isMobile","useMediaQuery","breakpoints","up","firstColumnStylePosition","_jsxs","_jsx","GenericTableTitle","children","HighlightScrollbar","Table","replace","toLowerCase","TableHead","TableRow","Array","from","idx","columnTitle","align","tooltip","placement","IconButton","size","InfoOutlinedIcon","GenericTableBody","meta","type"],"mappings":"qlBA4BA,MAAMA,EAAkBC,EAAO,MAAM;;;;;;;;;;;;;;EAgB/BC,EAAkBD,EAAOE,EAAW,CACxCC,kBAAoBC,GAAkB,aAATA,GAAgC,iBAATA,GAD9BJ,EAEqC,EAAGK,QAAOC,WAAUC,mBAAc,CAC7FC,SAAU,GACVC,WAA6B,UAAjBF,EAA2B,IAAMF,EAAMK,WAAWC,iBAC9DC,MACmB,UAAjBL,EACIF,EAAMQ,QAAQC,SAASC,KAAK,aAC5BV,EAAMQ,QAAQC,SAASC,KAAK,eAClCC,QAASX,EAAMY,QAAQ,KAAM,GAC7BC,WAAY,SACZC,SAAUb,EAAW,SAAW,WAChCc,OAAQd,EAAW,EAAI,WAGnBe,EAAcrB,EAAOsB,EAAK;;EAI1BC,EAAgBvB,EAAOwB,EAAPxB,EAAgB,EAAGK,YAAO,CAC9CoB,WAAYpB,EAAMY,QAAQ,IAC1BS,IAAK,CACHlB,SAAUH,EAAMK,WAAWiB,MAAMnB,cAI/BoB,EAAe,EACnBC,OACAC,QACAC,WACAC,aAAY,EACZC,aACAC,UACAC,WACA5B,eAAe,cAEf,MAAM6B,EAAU,IAAIC,IAClBF,EACGG,QAAQC,GAAMA,EAAEC,YAChBC,MAAK,CAACC,EAAGC,IAAMD,EAAEE,QAAUD,EAAEC,UAC7BC,KAAKN,GAAMA,EAAEO,cAEZC,EAAYZ,EAASa,QAA+C,CAACC,EAAKC,KAC9ED,EAAIC,EAAMJ,YAAcI,EACjBD,IACN,CAAA,GAEG5C,EAAQ8C,IACRC,GAAYC,EAAchD,EAAMiD,YAAYC,GAAG,WAG/CC,EAA2BJ,EAAW,SAAW,SAgCvD,OACEK,EAAC1D,aACEiC,GAAa0B,EAACC,EAAiB,CAAC5B,SAAUA,EAAUD,MAAOA,IAC5D4B,EAACrC,EAAW,CAAAuC,SACVF,EAACG,EAAkB,CAAAD,SACjBH,EAACK,EAAK,CAAA,aACQhC,EAAK,cACJ,iBAAmBE,EAAY,IAAIF,GAAOiC,QAAQ,IAAK,KAAKC,gBAAkB,IAAGJ,SAAA,CApCtGF,EAACO,EAAS,CAAAL,SACRF,EAACQ,EAAQ,CAAAN,SACNO,MAAMC,KAAKhC,GAASS,KAAI,CAACzC,EAAMiE,KAC9B,MAAMvB,WAAEA,EAAUwB,YAAEA,EAAWC,MAAEA,EAAQ,OAAMC,QAAEA,GAAYzB,EAAU3C,IAAS,CAAA,EAEhF,OACEsD,EAACzD,EAAe,CAEdsE,MAAOA,EACPjE,SAAkB,IAAR+D,IAAcjB,EACxB7C,aAAcA,EAAYqD,SAE1BH,EAAA,MAAA,CAAAG,SAAA,CACEF,EAAA,OAAA,CAAAE,SAAOU,IACNE,GACCd,EAACnC,EAAa,CAACkD,UAAU,cAAc3C,MAAO0C,EAAOZ,SACnDF,EAACgB,EAAU,CAACC,KAAK,iBACfjB,EAACkB,EAAgB,CAAA,cAAa,mBAAmBD,KAAK,eAVzD7B,UAgCPY,EAACmB,EAAgB,CACfzC,QAASA,EACTP,KAAMA,EACNK,QAASA,EACT4C,KAAM/B,EACNgC,KAAMvB,EACNvB,WAAYA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/GenericTableBody/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport Skeleton from '@mui/material/Skeleton';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport GenericTableBodyRow from '../GenericTableBodyRow';\n\nexport interface GenericTableColumns {\n columnName: string;\n columnTitle: string;\n columnType: 'Custom' | 'String';\n align?: 'left' | 'right';\n isVisible: boolean;\n ordinal: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n customComponent?: (data: any, row: any) => JSX.Element;\n tooltip?: string;\n hideWhenEmpty?: boolean;\n}\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) =>\n prop !== 'align' &&\n prop !== 'titleCell' &&\n prop !== 'warning' &&\n prop !== 'sticky' &&\n prop !== 'isTitleRow',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean; isTitleRow: boolean }>(\n ({ align, titleCell, warning, sticky, isTitleRow }) => ({\n textAlign: align,\n fontWeight: titleCell || isTitleRow ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n }),\n);\n\nexport interface TableCellProps {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'normal' | 'sticky';\n}\n\nconst RenderTableCell: React.FC<TableCellProps> = ({\n colIdx,\n colName,\n hasWarning,\n hasTitle,\n meta,\n row,\n type,\n}) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const prop = row[colName];\n const align = meta[colName]?.align ?? 'left';\n const hideWhenEmpty = meta[colName]?.hideWhenEmpty ?? false;\n const fallbackValue = hideWhenEmpty ? '' : '-';\n const tableCellProps = {\n align,\n warning: hasWarning ?? false,\n titleCell: hasTitle ?? false,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n isTitleRow: row['isTitleRow'] ?? false,\n };\n\n // When prop is a React element render it as is\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n if (React.isValidElement(prop)) {\n return <StyledTableCell {...tableCellProps}>{prop}</StyledTableCell>;\n }\n\n switch (meta[colName]?.columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n case 'Custom':\n return (\n <StyledTableCell {...tableCellProps}>\n {prop ? meta[colName]?.customComponent?.(prop, row) : fallbackValue}\n </StyledTableCell>\n );\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n }\n};\n\ninterface TableBodyProps {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'normal' | 'sticky';\n}\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n // eslint-disable-next-line react/no-array-index-key\n <TableRow key={`row-loader-${idx}`} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n // eslint-disable-next-line react/no-array-index-key\n key={`col-${columnName}-loader-${colIdx}`}\n align={'left'}\n data-testid={`col-${columnName}`}\n isTitleRow={false}\n sticky={false}\n titleCell={false}\n warning={false}\n >\n <Skeleton height={22} width=\"90%\" />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow\n // eslint-disable-next-line react/no-array-index-key\n key={`row-${rowIdx}`}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n row={row}\n tableRowTestKey={rowIdx.toString()}\n onRowClick={onRowClick}\n >\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell\n // eslint-disable-next-line react/no-array-index-key\n key={`cell-${colName}-${colIdx}`}\n colIdx={colIdx}\n colName={colName}\n meta={meta ?? {}}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n row={row}\n type={type}\n />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","isTitleRow","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","fallbackValue","hideWhenEmpty","tableCellProps","React","isValidElement","_jsx","children","columnType","customComponent","columns","data","loading","onRowClick","MuiTableBody","Array","from","map","_","idx","TableRow","columnName","Skeleton","height","width","rowIdx","GenericTableBodyRow","tableRowTestKey","toString"],"mappings":"wSAuBA,MAAMA,EAAkBC,EAAAA,OAAOC,EAAW,CACxCC,kBAAoBC,GACT,UAATA,GACS,cAATA,GACS,YAATA,GACS,WAATA,GACS,eAATA,GANoBH,EAQtB,EAAGI,QAAOC,YAAWC,UAASC,SAAQC,iBAAY,CAChDC,UAAWL,EACXM,WAAYL,GAAaG,EAAa,OAAS,SAC/CG,gBAAiBL,EAAU,UAAY,UACvCM,SAAUL,EAAS,SAAW,aAe5BM,EAA4C,EAChDC,SACAC,UACAC,aACAC,WACAC,OACAC,MACAC,WAGA,MAAMjB,EAAOgB,EAAIJ,GACXX,EAAQc,EAAKH,IAAUX,OAAS,OAEhCiB,EADgBH,EAAKH,IAAUO,gBAAiB,EAChB,GAAK,IACrCC,EAAiB,CACrBnB,QACAE,QAASU,IAAc,EACvBX,UAAWY,IAAY,EACvBV,OAAiB,WAATa,GAAgC,IAAXN,EAC7B,cAAe,OAAOC,IAEtBP,WAAYW,EAAgB,aAAK,GAKnC,GAAIK,EAAMC,eAAetB,GACvB,OAAOuB,EAAAA,IAAC3B,EAAe,IAAKwB,EAAcI,SAAGxB,IAG/C,OAAQe,EAAKH,IAAUa,YACrB,IAAK,SAQL,QACE,OAAOF,EAAAA,IAAC3B,EAAe,IAAKwB,WAAiBpB,GAAQkB,IAPvD,IAAK,SACH,OACEK,EAAAA,IAAC3B,EAAe,IAAKwB,EAAcI,SAChCxB,EAAOe,EAAKH,IAAUc,kBAAkB1B,EAAMgB,GAAOE,qBAmBb,EAAGS,UAASC,OAAMC,UAASZ,OAAMa,aAAYf,UAG5FQ,EAAAA,IAACQ,EAAY,CAAAP,SACVK,EACGG,MAAMC,KAAKD,MAJC,IAImBE,KAAI,CAACC,EAAGC,IAErCb,EAAAA,IAACc,iBAA+C,aAAYb,SACzDQ,MAAMC,KAAKN,GAASO,KAAI,CAACI,EAAY3B,IACpCY,EAAAA,IAAC3B,GAGCK,MAAO,OAAM,cACA,OAAOqC,IACpBjC,YAAY,EACZD,QAAQ,EACRF,WAAW,EACXC,SAAS,EAAKqB,SAEdD,MAACgB,EAAQ,CAACC,OAAQ,GAAIC,MAAM,SARvB,OAAOH,YAAqB3B,QAJxB,cAAcyB,OAiB/BR,GAAMM,KAAI,CAAClB,EAAK0B,IACdnB,EAAAA,IAACoB,GAIC3B,IAAKA,EACL4B,gBAAiBF,EAAOG,WACxBf,WAAYA,WAEXE,MAAMC,KAAKN,GAASO,KAAI,CAACtB,EAASD,IACjCY,MAACb,GAGCC,OAAQA,EACRC,QAASA,EACTG,KAAMA,GAAQ,CAAA,EAEdC,IAAKA,EACLC,KAAMA,GAND,QAAQL,KAAWD,QATvB,OAAO+B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/GenericTableBody/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport Skeleton from '@mui/material/Skeleton';\nimport { styled } from '@mui/material/styles';\nimport MuiTableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\n\nimport GenericTableBodyRow from '../GenericTableBodyRow';\n\nexport interface GenericTableColumns {\n columnName: string;\n columnTitle: string;\n columnType: 'Custom' | 'String';\n align?: 'left' | 'right';\n isVisible: boolean;\n ordinal: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n customComponent?: (data: any, row: any) => JSX.Element;\n tooltip?: string;\n hideWhenEmpty?: boolean;\n}\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) =>\n prop !== 'align' &&\n prop !== 'titleCell' &&\n prop !== 'warning' &&\n prop !== 'sticky' &&\n prop !== 'isTitleRow',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean; isTitleRow: boolean }>(\n ({ align, titleCell, warning, sticky, isTitleRow }) => ({\n textAlign: align,\n fontWeight: titleCell || isTitleRow ? 'bold' : 'normal',\n backgroundColor: warning ? '#ffcccb' : 'inherit',\n position: sticky ? 'sticky' : 'static',\n }),\n);\n\nexport interface TableCellProps {\n colIdx: number;\n colName: string;\n hasWarning?: boolean;\n hasTitle?: boolean;\n meta: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: Record<string, any>;\n type: 'normal' | 'sticky';\n}\n\nconst RenderTableCell: React.FC<TableCellProps> = ({\n colIdx,\n colName,\n hasWarning,\n hasTitle,\n meta,\n row,\n type,\n}) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const prop = row[colName];\n const align = meta[colName]?.align ?? 'left';\n const hideWhenEmpty = meta[colName]?.hideWhenEmpty ?? false;\n const fallbackValue = hideWhenEmpty ? '' : '-';\n const tableCellProps = {\n align,\n warning: hasWarning ?? false,\n titleCell: hasTitle ?? false,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n isTitleRow: row['isTitleRow'] ?? false,\n };\n\n // When prop is a React element render it as is\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n if (React.isValidElement(prop)) {\n return <StyledTableCell {...tableCellProps}>{prop}</StyledTableCell>;\n }\n\n switch (meta[colName]?.columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n case 'Custom':\n return (\n <StyledTableCell {...tableCellProps}>\n {prop ? meta[colName]?.customComponent?.(prop, row) : fallbackValue}\n </StyledTableCell>\n );\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n }\n};\n\ninterface TableBodyProps {\n columns: Set<string>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: any[];\n loading?: boolean;\n meta?: { [key: string]: GenericTableColumns };\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n type: 'normal' | 'sticky';\n}\n\nconst GenericTableBody: React.FC<TableBodyProps> = ({ columns, data, loading, type, onRowClick, meta }) => {\n const rowsPerPage = 5;\n return (\n <MuiTableBody>\n {loading\n ? Array.from(Array(rowsPerPage)).map((_, idx) => (\n // eslint-disable-next-line react/no-array-index-key\n <TableRow key={`row-loader-${idx}`} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n // eslint-disable-next-line react/no-array-index-key\n key={`col-${columnName}-loader-${colIdx}`}\n align={'left'}\n data-testid={`col-${columnName}`}\n isTitleRow={false}\n sticky={false}\n titleCell={false}\n warning={false}\n >\n <Skeleton height={22} width=\"90%\" />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow\n // eslint-disable-next-line react/no-array-index-key\n key={`row-${rowIdx}`}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n row={row}\n tableRowTestKey={rowIdx.toString()}\n onRowClick={onRowClick}\n >\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell\n // eslint-disable-next-line react/no-array-index-key\n key={`cell-${colName}-${colIdx}`}\n colIdx={colIdx}\n colName={colName}\n meta={meta ?? {}}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n row={row}\n type={type}\n />\n ))}\n </GenericTableBodyRow>\n ))}\n </MuiTableBody>\n );\n};\n\nexport default GenericTableBody;\n"],"names":["StyledTableCell","styled","TableCell","shouldForwardProp","prop","align","titleCell","warning","sticky","isTitleRow","textAlign","fontWeight","backgroundColor","position","RenderTableCell","colIdx","colName","hasWarning","hasTitle","meta","row","type","fallbackValue","hideWhenEmpty","tableCellProps","React","isValidElement","_jsx","children","columnType","customComponent","GenericTableBody","columns","data","loading","onRowClick","MuiTableBody","Array","from","map","_","idx","TableRow","columnName","Skeleton","height","width","rowIdx","GenericTableBodyRow","tableRowTestKey","toString"],"mappings":"oTAuBA,MAAMA,EAAkBC,EAAOC,EAAW,CACxCC,kBAAoBC,GACT,UAATA,GACS,cAATA,GACS,YAATA,GACS,WAATA,GACS,eAATA,GANoBH,EAQtB,EAAGI,QAAOC,YAAWC,UAASC,SAAQC,iBAAY,CAChDC,UAAWL,EACXM,WAAYL,GAAaG,EAAa,OAAS,SAC/CG,gBAAiBL,EAAU,UAAY,UACvCM,SAAUL,EAAS,SAAW,aAe5BM,EAA4C,EAChDC,SACAC,UACAC,aACAC,WACAC,OACAC,MACAC,WAGA,MAAMjB,EAAOgB,EAAIJ,GACXX,EAAQc,EAAKH,IAAUX,OAAS,OAEhCiB,EADgBH,EAAKH,IAAUO,gBAAiB,EAChB,GAAK,IACrCC,EAAiB,CACrBnB,QACAE,QAASU,IAAc,EACvBX,UAAWY,IAAY,EACvBV,OAAiB,WAATa,GAAgC,IAAXN,EAC7B,cAAe,OAAOC,IAEtBP,WAAYW,EAAgB,aAAK,GAKnC,GAAIK,EAAMC,eAAetB,GACvB,OAAOuB,EAAC3B,EAAe,IAAKwB,EAAcI,SAAGxB,IAG/C,OAAQe,EAAKH,IAAUa,YACrB,IAAK,SAQL,QACE,OAAOF,EAAC3B,EAAe,IAAKwB,WAAiBpB,GAAQkB,IAPvD,IAAK,SACH,OACEK,EAAC3B,EAAe,IAAKwB,EAAcI,SAChCxB,EAAOe,EAAKH,IAAUc,kBAAkB1B,EAAMgB,GAAOE,MAmB1DS,EAA6C,EAAGC,UAASC,OAAMC,UAASb,OAAMc,aAAYhB,UAG5FQ,EAACS,EAAY,CAAAR,SACVM,EACGG,MAAMC,KAAKD,MAJC,IAImBE,KAAI,CAACC,EAAGC,IAErCd,EAACe,iBAA+C,aAAYd,SACzDS,MAAMC,KAAKN,GAASO,KAAI,CAACI,EAAY5B,IACpCY,EAAC3B,GAGCK,MAAO,OAAM,cACA,OAAOsC,IACpBlC,YAAY,EACZD,QAAQ,EACRF,WAAW,EACXC,SAAS,EAAKqB,SAEdD,EAACiB,EAAQ,CAACC,OAAQ,GAAIC,MAAM,SARvB,OAAOH,YAAqB5B,QAJxB,cAAc0B,OAiB/BR,GAAMM,KAAI,CAACnB,EAAK2B,IACdpB,EAACqB,GAIC5B,IAAKA,EACL6B,gBAAiBF,EAAOG,WACxBf,WAAYA,WAEXE,MAAMC,KAAKN,GAASO,KAAI,CAACvB,EAASD,IACjCY,EAACb,GAGCC,OAAQA,EACRC,QAASA,EACTG,KAAMA,GAAQ,CAAA,EAEdC,IAAKA,EACLC,KAAMA,GAND,QAAQL,KAAWD,QATvB,OAAOgC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/GenericTableBodyRow/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { styled } from '@mui/material/styles';\nimport TableRow from '@mui/material/TableRow';\n\nexport interface TableBodyRowProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: any;\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n tableRowTestKey: string;\n}\n\nconst StyledTableRow = styled(TableRow, {\n shouldForwardProp: (prop) => prop !== 'isTitleRow',\n})<{ isTitleRow: boolean }>(({ theme, isTitleRow }) => {\n if (!isTitleRow) {\n return {};\n }\n\n return {\n backgroundColor: theme.palette.semantic.background['background-sunken'],\n };\n});\n\ntype TableBodyRowProp = TableBodyRowProps & { children: React.ReactNode };\n\nconst GenericTableBodyRow: React.FC<React.PropsWithChildren<TableBodyRowProp>> = (props) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { onRowClick, row, children, tableRowTestKey } = props;\n\n const onClick = (event: React.MouseEvent<HTMLTableRowElement>): void => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n event.preventDefault();\n onRowClick?.(row);\n };\n\n if (onRowClick) {\n return (\n <StyledTableRow\n data-testid={`row-clickable-${tableRowTestKey}`}\n hover={onClick !== undefined}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n isTitleRow={row['isTitleRow'] ?? false}\n onClick={onClick}\n >\n {children}\n </StyledTableRow>\n );\n }\n\n return <TableRow data-testid={`row-${tableRowTestKey}`}>{children}</TableRow>;\n};\n\nexport default GenericTableBodyRow;\n"],"names":["StyledTableRow","styled","TableRow","shouldForwardProp","prop","theme","isTitleRow","backgroundColor","palette","semantic","background","props","onRowClick","row","children","tableRowTestKey","onClick","event","preventDefault","_jsx","hover","undefined"],"mappings":"2IAaA,MAAMA,EAAiBC,EAAAA,OAAOC,EAAU,CACtCC,kBAAoBC,GAAkB,eAATA,GADRH,EAEK,EAAGI,QAAOC,gBAC/BA,EAIE,CACLC,gBAAiBF,EAAMG,QAAQC,SAASC,WAAW,sBAJ5C,CAAA,mBAUuEC,IAEhF,MAAMC,WAAEA,EAAUC,IAAEA,EAAGC,SAAEA,EAAQC,gBAAEA,GAAoBJ,EAEjDK,EAAWC,IAEfA,EAAMC,iBACNN,IAAaC,IAGf,OAAID,EAEAO,EAAAA,IAACnB,EAAc,CAAA,cACA,iBAAiBe,IAC9BK,WAAmBC,IAAZL,EAEPV,WAAYO,EAAgB,aAAK,EACjCG,QAASA,EAAOF,SAEfA,IAKAK,EAAAA,IAACjB,EAAQ,CAAA,cAAc,OAAOa,IAAiBD,SAAGA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/GenericTableBodyRow/index.tsx"],"sourcesContent":["import React from 'react';\n\nimport { styled } from '@mui/material/styles';\nimport TableRow from '@mui/material/TableRow';\n\nexport interface TableBodyRowProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n row: any;\n // eslint-disable-next-line @typescript-eslint/ban-types\n onRowClick?: Function;\n tableRowTestKey: string;\n}\n\nconst StyledTableRow = styled(TableRow, {\n shouldForwardProp: (prop) => prop !== 'isTitleRow',\n})<{ isTitleRow: boolean }>(({ theme, isTitleRow }) => {\n if (!isTitleRow) {\n return {};\n }\n\n return {\n backgroundColor: theme.palette.semantic.background['background-sunken'],\n };\n});\n\ntype TableBodyRowProp = TableBodyRowProps & { children: React.ReactNode };\n\nconst GenericTableBodyRow: React.FC<React.PropsWithChildren<TableBodyRowProp>> = (props) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { onRowClick, row, children, tableRowTestKey } = props;\n\n const onClick = (event: React.MouseEvent<HTMLTableRowElement>): void => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n event.preventDefault();\n onRowClick?.(row);\n };\n\n if (onRowClick) {\n return (\n <StyledTableRow\n data-testid={`row-clickable-${tableRowTestKey}`}\n hover={onClick !== undefined}\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n isTitleRow={row['isTitleRow'] ?? false}\n onClick={onClick}\n >\n {children}\n </StyledTableRow>\n );\n }\n\n return <TableRow data-testid={`row-${tableRowTestKey}`}>{children}</TableRow>;\n};\n\nexport default GenericTableBodyRow;\n"],"names":["StyledTableRow","styled","TableRow","shouldForwardProp","prop","theme","isTitleRow","backgroundColor","palette","semantic","background","GenericTableBodyRow","props","onRowClick","row","children","tableRowTestKey","onClick","event","preventDefault","_jsx","hover","undefined"],"mappings":"0IAaA,MAAMA,EAAiBC,EAAOC,EAAU,CACtCC,kBAAoBC,GAAkB,eAATA,GADRH,EAEK,EAAGI,QAAOC,gBAC/BA,EAIE,CACLC,gBAAiBF,EAAMG,QAAQC,SAASC,WAAW,sBAJ5C,CAAA,IAULC,EAA4EC,IAEhF,MAAMC,WAAEA,EAAUC,IAAEA,EAAGC,SAAEA,EAAQC,gBAAEA,GAAoBJ,EAEjDK,EAAWC,IAEfA,EAAMC,iBACNN,IAAaC,IAGf,OAAID,EAEAO,EAACpB,EAAc,CAAA,cACA,iBAAiBgB,IAC9BK,WAAmBC,IAAZL,EAEPX,WAAYQ,EAAgB,aAAK,EACjCG,QAASA,EAAOF,SAEfA,IAKAK,EAAClB,EAAQ,CAAA,cAAc,OAAOc,IAAiBD,SAAGA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/GenericTableTitle/index.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport Grid, {type GridSize} from '../atoms/Grid';\n\ninterface OuterProps {\n maxGridWidth?: GridSize;\n subTitle?: string;\n title?: string;\n children?: ReactNode;\n titlePadding?: 'medium' | 'small';\n}\n\nconst HeaderContainer = styled(Grid, {\n shouldForwardProp: (prop) => prop !== 'titlePadding',\n})<{ titlePadding: OuterProps['titlePadding'] }>(({ theme, titlePadding }) => {\n switch (titlePadding) {\n case 'small':\n return {\n padding: theme.spacing(3, 0, 1.5),\n [theme.breakpoints.down('tablet')]: {\n padding: theme.spacing(3, 2, 1.5),\n },\n };\n case 'medium':\n return {\n padding: theme.spacing(4, 0, 2),\n [theme.breakpoints.down('tablet')]: {\n padding: theme.spacing(4, 2, 2),\n },\n };\n default:\n return { padding: 0 };\n }\n});\n\nconst SubTitle = styled(Typography)({\n width: 191,\n height: 16,\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.33,\n letterSpacing: 0.4,\n color: 'rgba(0, 0, 0, 0.38)',\n});\n\nconst GenericTableTitle = ({\n maxGridWidth = 12,\n subTitle,\n title,\n children,\n titlePadding = 'medium',\n}: OuterProps): JSX.Element => {\n return (\n <HeaderContainer container titlePadding={titlePadding}>\n <Grid size={{ base: maxGridWidth, mobile: maxGridWidth }}>\n {title && <Typography variant=\"h5\">{title}</Typography>}\n {subTitle && (\n <div>\n <SubTitle variant=\"caption\">{subTitle}</SubTitle>\n </div>\n )}\n </Grid>\n\n {children}\n </HeaderContainer>\n );\n};\n\nexport default GenericTableTitle;\n"],"names":["HeaderContainer","styled","Grid","shouldForwardProp","prop","theme","titlePadding","padding","spacing","breakpoints","down","SubTitle","Typography","width","height","fontSize","fontWeight","lineHeight","letterSpacing","color","maxGridWidth","subTitle","title","children","_jsxs","container","size","base","mobile","_jsx","variant"],"mappings":"8KAeA,MAAMA,EAAkBC,EAAAA,OAAOC,EAAM,CACnCC,kBAAoBC,GAAkB,iBAATA,GADPH,EAEyB,EAAGI,QAAOC,mBACzD,OAAQA,GACN,IAAK,QACH,MAAO,CACLC,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAC7B,CAACH,EAAMI,YAAYC,KAAK,WAAY,CAClCH,QAASF,EAAMG,QAAQ,EAAG,EAAG,OAGnC,IAAK,SACH,MAAO,CACLD,QAASF,EAAMG,QAAQ,EAAG,EAAG,GAC7B,CAACH,EAAMI,YAAYC,KAAK,WAAY,CAClCH,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAGnC,QACE,MAAO,CAAED,QAAS,OAIlBI,EAAWV,EAAAA,OAAOW,EAAPX,CAAmB,CAClCY,MAAO,IACPC,OAAQ,GACRC,SAAU,GACVC,WAAY,SACZC,WAAY,KACZC,cAAe,GACfC,MAAO,uCAGiB,EACxBC,eAAe,GACfC,WACAC,QACAC,WACAjB,eAAe,YAGbkB,EAAAA,KAACxB,EAAe,CAACyB,WAAS,EAACnB,aAAcA,EAAYiB,SAAA,CACnDC,OAACtB,EAAI,CAACwB,KAAM,CAAEC,KAAMP,EAAcQ,OAAQR,GAAcG,SAAA,CACrDD,GAASO,EAAAA,IAACjB,EAAU,CAACkB,QAAQ,KAAIP,SAAED,IACnCD,GACCQ,EAAAA,IAAA,MAAA,CAAAN,SACEM,MAAClB,EAAQ,CAACmB,QAAQ,UAASP,SAAEF,SAKlCE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/GenericTableTitle/index.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nimport Grid, {type GridSize} from '../atoms/Grid';\n\ninterface OuterProps {\n maxGridWidth?: GridSize;\n subTitle?: string;\n title?: string;\n children?: ReactNode;\n titlePadding?: 'medium' | 'small';\n}\n\nconst HeaderContainer = styled(Grid, {\n shouldForwardProp: (prop) => prop !== 'titlePadding',\n})<{ titlePadding: OuterProps['titlePadding'] }>(({ theme, titlePadding }) => {\n switch (titlePadding) {\n case 'small':\n return {\n padding: theme.spacing(3, 0, 1.5),\n [theme.breakpoints.down('tablet')]: {\n padding: theme.spacing(3, 2, 1.5),\n },\n };\n case 'medium':\n return {\n padding: theme.spacing(4, 0, 2),\n [theme.breakpoints.down('tablet')]: {\n padding: theme.spacing(4, 2, 2),\n },\n };\n default:\n return { padding: 0 };\n }\n});\n\nconst SubTitle = styled(Typography)({\n width: 191,\n height: 16,\n fontSize: 12,\n fontWeight: 'normal',\n lineHeight: 1.33,\n letterSpacing: 0.4,\n color: 'rgba(0, 0, 0, 0.38)',\n});\n\nconst GenericTableTitle = ({\n maxGridWidth = 12,\n subTitle,\n title,\n children,\n titlePadding = 'medium',\n}: OuterProps): JSX.Element => {\n return (\n <HeaderContainer container titlePadding={titlePadding}>\n <Grid size={{ base: maxGridWidth, mobile: maxGridWidth }}>\n {title && <Typography variant=\"h5\">{title}</Typography>}\n {subTitle && (\n <div>\n <SubTitle variant=\"caption\">{subTitle}</SubTitle>\n </div>\n )}\n </Grid>\n\n {children}\n </HeaderContainer>\n );\n};\n\nexport default GenericTableTitle;\n"],"names":["HeaderContainer","styled","Grid","shouldForwardProp","prop","theme","titlePadding","padding","spacing","breakpoints","down","SubTitle","Typography","width","height","fontSize","fontWeight","lineHeight","letterSpacing","color","GenericTableTitle","maxGridWidth","subTitle","title","children","_jsxs","container","size","base","mobile","_jsx","variant"],"mappings":"yLAeA,MAAMA,EAAkBC,EAAOC,EAAM,CACnCC,kBAAoBC,GAAkB,iBAATA,GADPH,EAEyB,EAAGI,QAAOC,mBACzD,OAAQA,GACN,IAAK,QACH,MAAO,CACLC,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAC7B,CAACH,EAAMI,YAAYC,KAAK,WAAY,CAClCH,QAASF,EAAMG,QAAQ,EAAG,EAAG,OAGnC,IAAK,SACH,MAAO,CACLD,QAASF,EAAMG,QAAQ,EAAG,EAAG,GAC7B,CAACH,EAAMI,YAAYC,KAAK,WAAY,CAClCH,QAASF,EAAMG,QAAQ,EAAG,EAAG,KAGnC,QACE,MAAO,CAAED,QAAS,OAIlBI,EAAWV,EAAOW,EAAPX,CAAmB,CAClCY,MAAO,IACPC,OAAQ,GACRC,SAAU,GACVC,WAAY,SACZC,WAAY,KACZC,cAAe,GACfC,MAAO,wBAGHC,EAAoB,EACxBC,eAAe,GACfC,WACAC,QACAC,WACAlB,eAAe,YAGbmB,EAACzB,EAAe,CAAC0B,WAAS,EAACpB,aAAcA,EAAYkB,SAAA,CACnDC,EAACvB,EAAI,CAACyB,KAAM,CAAEC,KAAMP,EAAcQ,OAAQR,GAAcG,SAAA,CACrDD,GAASO,EAAClB,EAAU,CAACmB,QAAQ,KAAIP,SAAED,IACnCD,GACCQ,EAAA,MAAA,CAAAN,SACEM,EAACnB,EAAQ,CAACoB,QAAQ,UAASP,SAAEF,SAKlCE"}
|
/package/dist/components/{GenericTableBody → molecules/GenericTable/GenericTableBody}/index.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/components/{GenericTableBodyRow → molecules/GenericTable/GenericTableBodyRow}/index.js
RENAMED
|
File without changes
|
/package/dist/components/{GenericTableTitle → molecules/GenericTable/GenericTableTitle}/index.cjs.js
RENAMED
|
File without changes
|
/package/dist/components/{GenericTableTitle → molecules/GenericTable/GenericTableTitle}/index.d.ts
RENAMED
|
File without changes
|
/package/dist/components/{GenericTableTitle → molecules/GenericTable/GenericTableTitle}/index.js
RENAMED
|
File without changes
|