@flipdish/portal-library 1.0.53 → 1.0.55
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/ui/GenericTable/GenericTable.cjs.js +3 -3
- package/dist/components/ui/GenericTable/GenericTable.cjs.js.map +1 -1
- package/dist/components/ui/GenericTable/GenericTable.d.ts +2 -1
- package/dist/components/ui/GenericTable/GenericTable.js +3 -3
- package/dist/components/ui/GenericTable/GenericTable.js.map +1 -1
- package/dist/components/ui/GenericTable/types.d.ts +1 -0
- package/dist/components/ui/GenericTableBody/GenericTableBody.cjs.js +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.cjs.js.map +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.js +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.js.map +1 -1
- package/dist/components/ui/GenericTableBodyRow/GenericTableBodyRow.cjs.js +1 -1
- package/dist/components/ui/GenericTableBodyRow/GenericTableBodyRow.cjs.js.map +1 -1
- package/dist/components/ui/GenericTableBodyRow/GenericTableBodyRow.js +1 -1
- package/dist/components/ui/GenericTableBodyRow/GenericTableBodyRow.js.map +1 -1
- package/dist/components/ui/Switch/Switch.cjs.js +1 -1
- package/dist/components/ui/Switch/Switch.cjs.js.map +1 -1
- package/dist/components/ui/Switch/Switch.d.ts +2 -1
- package/dist/components/ui/Switch/Switch.js +1 -1
- package/dist/components/ui/Switch/Switch.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/styles"),r=require("@mui/material/Table"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/styles"),r=require("@mui/material/Table"),t=require("@mui/material/TableCell"),a=require("@mui/material/TableHead"),l=require("@mui/material/TableRow"),s=require("@mui/material/useMediaQuery"),o=require("../GenericTableTitle/GenericTableTitle.cjs.js"),n=require("./HighlightScrollbar.cjs.js"),d=require("../GenericTableBody/GenericTableBody.cjs.js"),c=require("@mui/material/Card"),u=require("@mui/icons-material/InfoOutlined"),m=require("@mui/material/Tooltip"),h=require("@mui/material/IconButton");const p=i.styled("div")`
|
|
2
2
|
overflow-x: auto;
|
|
3
3
|
&::-webkit-scrollbar {
|
|
4
4
|
padding: 2px 0;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
background: #f5f5f5;
|
|
13
13
|
border-radius: 3px;
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
15
|
+
`,b=i.styled(t,{shouldForwardProp:e=>"isSticky"!==e&&"titleVariant"!==e})((({theme:e,isSticky:i,titleVariant:r})=>({fontSize:13,fontWeight:"light"===r?400:e.typography.fontWeightMedium,color:"light"===r?"rgba(0, 0, 0, 0.54)":e.palette.text.primary,padding:e.spacing(1.25,2),whiteSpace:"nowrap",position:i?"sticky":"relative",zIndex:i?1:"auto"}))),g=i.styled(c)`
|
|
16
16
|
overflow: hidden;
|
|
17
|
-
`,
|
|
17
|
+
`,x=i.styled(m)((({theme:e})=>({marginLeft:e.spacing(.5),svg:{fontSize:e.typography.body1.fontSize}})));module.exports=({data:t,title:c,subTitle:m,showTitle:j=!0,onRowClick:y,loading:f,metadata:T,titleVariant:k="default"})=>{const q=new Set(T.filter((e=>e.isVisible)).sort(((e,i)=>e.ordinal-i.ordinal)).map((e=>e.columnName))),w=T.reduce(((e,i)=>(e[i.columnName]=i,e)),{}),S=i.useTheme(),v=!s(S.breakpoints.up("sm")),z=v?"normal":"sticky";return e.jsxs(p,{children:[j&&e.jsx(o,{title:c,subTitle:m}),e.jsx(g,{children:e.jsx(n,{children:e.jsxs(r,{"aria-label":c,"data-testid":"generic-table"+(j?`-${c.replace(" ","-").toLowerCase()}`:""),children:[e.jsx(a,{children:e.jsx(l,{children:Array.from(q).map(((i,r)=>{const{columnName:t,columnTitle:a,align:l="left",tooltip:s}=w[i];return e.jsx(b,{align:l,isSticky:0===r&&!v,titleVariant:k,children:e.jsxs("div",{children:[e.jsx("span",{children:a}),s&&e.jsx(x,{title:s,placement:"right-start",children:e.jsx(h,{size:"small",children:e.jsx(u,{fontSize:"small"})})})]})},t)}))})}),e.jsx(d,{type:z,data:t,columns:q,onRowClick:y,loading:f,meta:w})]})})})]})};
|
|
18
18
|
//# sourceMappingURL=GenericTable.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTable.cjs.js","sources":["../../../../src/components/ui/GenericTable/GenericTable.tsx"],"sourcesContent":["import { styled, useTheme } from '@mui/material/styles';\n\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 useMediaQuery from '@mui/material/useMediaQuery';\nimport { GenericTableColumns } from './types';\nimport GenericTableTitle from '../GenericTableTitle/GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\nimport { GenericTableBody } from '../GenericTableBody';\nimport Card from '@mui/material/Card';\nimport InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';\nimport Tooltip from '@mui/material/Tooltip';\nimport IconButton from '@mui/material/IconButton';\n\ntype 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};\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',\n})<{ isSticky: boolean }>(({ theme, isSticky }) => ({\n fontSize: 13,\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 = ({ data, title, subTitle, showTitle = true, onRowClick, loading, metadata }: 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('sm'));\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 return (\n <StyledTableCell key={columnName} align={align} isSticky={idx === 0 && !isMobile}>\n <div>\n <span>{columnTitle}</span>\n {tooltip && (\n <StyledTooltip title={tooltip} placement=\"right-start\">\n <IconButton size=\"small\">\n <InfoOutlinedIcon fontSize=\"small\" />\n </IconButton>\n </StyledTooltip>\n )}\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle title={title} subTitle={subTitle}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table aria-label={title} data-testid={`generic-table` + (showTitle ? `-${title.replace(' ', '-').toLowerCase()}` : '')}>\n {renderTableHeader()}\n <GenericTableBody\n type={firstColumnStylePosition}\n data={data}\n columns={columns}\n onRowClick={onRowClick}\n loading={loading}\n meta={tableMeta}\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","fontSize","padding","spacing","whiteSpace","position","zIndex","StyledPaper","Card","StyledTooltip","Tooltip","marginLeft","svg","
|
|
1
|
+
{"version":3,"file":"GenericTable.cjs.js","sources":["../../../../src/components/ui/GenericTable/GenericTable.tsx"],"sourcesContent":["import { styled, useTheme } from '@mui/material/styles';\n\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 useMediaQuery from '@mui/material/useMediaQuery';\nimport { GenericTableColumns } from './types';\nimport GenericTableTitle from '../GenericTableTitle/GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\nimport { GenericTableBody } from '../GenericTableBody';\nimport Card from '@mui/material/Card';\nimport InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';\nimport Tooltip from '@mui/material/Tooltip';\nimport IconButton from '@mui/material/IconButton';\n\ntype 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: titleVariant === 'light' ? 'rgba(0, 0, 0, 0.54)' : theme.palette.text.primary,\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 = ({ data, title, subTitle, showTitle = true, onRowClick, loading, metadata, titleVariant = 'default' }: 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('sm'));\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 return (\n <StyledTableCell key={columnName} align={align} isSticky={idx === 0 && !isMobile} titleVariant={titleVariant}>\n <div>\n <span>{columnTitle}</span>\n {tooltip && (\n <StyledTooltip title={tooltip} placement=\"right-start\">\n <IconButton size=\"small\">\n <InfoOutlinedIcon fontSize=\"small\" />\n </IconButton>\n </StyledTooltip>\n )}\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle title={title} subTitle={subTitle}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table aria-label={title} data-testid={`generic-table` + (showTitle ? `-${title.replace(' ', '-').toLowerCase()}` : '')}>\n {renderTableHeader()}\n <GenericTableBody\n type={firstColumnStylePosition}\n data={data}\n columns={columns}\n onRowClick={onRowClick}\n loading={loading}\n meta={tableMeta}\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","text","primary","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","jsxs","_jsx","GenericTableTitle","children","HighlightScrollbar","Table","replace","toLowerCase","jsx","TableHead","TableRow","Array","from","idx","columnTitle","align","tooltip","placement","IconButton","size","InfoOutlinedIcon","GenericTableBody","type","meta"],"mappings":"8jBA6BA,MAAMA,EAAkBC,EAAAA,OAAO,MAAM;;;;;;;;;;;;;;EAgB/BC,EAAkBD,EAAMA,OAACE,EAAW,CACtCC,kBAAoBC,GAAkB,aAATA,GAAgC,iBAATA,GADhCJ,EAEqC,EAAGK,QAAOC,WAAUC,mBAAoB,CACjGC,SAAU,GACVC,WAA6B,UAAjBF,EAA2B,IAAMF,EAAMK,WAAWC,iBAC9DC,MAAwB,UAAjBL,EAA2B,sBAAwBF,EAAMQ,QAAQC,KAAKC,QAC7EC,QAASX,EAAMY,QAAQ,KAAM,GAC7BC,WAAY,SACZC,SAAUb,EAAW,SAAW,WAChCc,OAAQd,EAAW,EAAI,WAGrBe,EAAcrB,EAAAA,OAAOsB,EAAK;;EAI1BC,EAAgBvB,EAAAA,OAAOwB,EAAPxB,EAAgB,EAAGK,YAAa,CAClDoB,WAAYpB,EAAMY,QAAQ,IAC1BS,IAAK,CACDlB,SAAUH,EAAMK,WAAWiB,MAAMnB,6BAIpB,EAAGoB,OAAMC,QAAOC,WAAUC,aAAY,EAAMC,aAAYC,UAASC,WAAU3B,eAAe,cAC3G,MAAM4B,EAAU,IAAIC,IAChBF,EACKG,QAAQC,GAAMA,EAAEC,YAChBC,MAAK,CAACC,EAAGC,IAAMD,EAAEE,QAAUD,EAAEC,UAC7BC,KAAKN,GAAMA,EAAEO,cAEhBC,EAAYZ,EAASa,QAA+C,CAACC,EAAKC,KAC5ED,EAAIC,EAAMJ,YAAcI,EACjBD,IACR,CAAE,GAEC3C,EAAQ6C,EAAAA,WACRC,GAAYC,EAAc/C,EAAMgD,YAAYC,GAAG,OAG/CC,EAA2BJ,EAAW,SAAW,SA0BvD,OACIK,EAACC,KAAA1D,aACIgC,GAAa2B,MAACC,EAAiB,CAAC9B,MAAOA,EAAOC,SAAUA,IACzD4B,EAAAA,IAACrC,EAAW,CAAAuC,SACRF,MAACG,EAAkB,CAAAD,SACfJ,EAAAA,KAACM,EAAK,CAAA,aAAajC,EAAoB,cAAA,iBAAmBE,EAAY,IAAIF,EAAMkC,QAAQ,IAAK,KAAKC,gBAAkB,IAC/GJ,SAAA,CA7BjBF,EAAAO,IAACC,EAAS,CAAAN,SACNF,EAAAA,IAACS,EACI,CAAAP,SAAAQ,MAAMC,KAAKlC,GAASS,KAAI,CAACxC,EAAMkE,KAC5B,MAAMzB,WAAEA,EAAU0B,YAAEA,EAAWC,MAAEA,EAAQ,OAAMC,QAAEA,GAAY3B,EAAU1C,GACvE,OACIsD,MAACzD,EAAe,CAAkBuE,MAAOA,EAAOlE,SAAkB,IAARgE,IAAcnB,EAAU5C,aAAcA,EAC5FqD,SAAAJ,OAAA,MAAA,CAAAI,SAAA,CACIF,EAAAA,IAAO,OAAA,CAAAE,SAAAW,IACNE,GACGf,EAAAA,IAACnC,EAAc,CAAAM,MAAO4C,EAASC,UAAU,cACrCd,SAAAF,EAAAA,IAACiB,EAAU,CAACC,KAAK,QAAOhB,SACpBF,EAACO,IAAAY,EAAiB,CAAArE,SAAS,kBANzBqC,EAYxB,QAaEa,EAAAO,IAACa,EACG,CAAAC,KAAMxB,EACN3B,KAAMA,EACNO,QAASA,EACTH,WAAYA,EACZC,QAASA,EACT+C,KAAMlC,aAM5B"}
|
|
@@ -9,7 +9,8 @@ type GenericTableProps = {
|
|
|
9
9
|
showTitle?: boolean;
|
|
10
10
|
subTitle?: string;
|
|
11
11
|
title?: string;
|
|
12
|
+
titleVariant?: 'default' | 'light';
|
|
12
13
|
};
|
|
13
|
-
declare const GenericTable: ({ data, title, subTitle, showTitle, onRowClick, loading, metadata }: GenericTableProps) => react_jsx_runtime.JSX.Element;
|
|
14
|
+
declare const GenericTable: ({ data, title, subTitle, showTitle, onRowClick, loading, metadata, titleVariant }: GenericTableProps) => react_jsx_runtime.JSX.Element;
|
|
14
15
|
|
|
15
16
|
export { GenericTable as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as i,jsx as
|
|
1
|
+
import{jsxs as i,jsx as t}from"react/jsx-runtime";import{styled as e,useTheme as r}from"@mui/material/styles";import a from"@mui/material/Table";import o from"@mui/material/TableCell";import l from"@mui/material/TableHead";import m from"@mui/material/TableRow";import n from"@mui/material/useMediaQuery";import d from"../GenericTableTitle/GenericTableTitle.js";import c from"./HighlightScrollbar.js";import p from"../GenericTableBody/GenericTableBody.js";import s from"@mui/material/Card";import u from"@mui/icons-material/InfoOutlined";import f from"@mui/material/Tooltip";import h from"@mui/material/IconButton";const b=e("div")`
|
|
2
2
|
overflow-x: auto;
|
|
3
3
|
&::-webkit-scrollbar {
|
|
4
4
|
padding: 2px 0;
|
|
@@ -12,7 +12,7 @@ import{jsxs as i,jsx as e}from"react/jsx-runtime";import{styled as r,useTheme as
|
|
|
12
12
|
background: #f5f5f5;
|
|
13
13
|
border-radius: 3px;
|
|
14
14
|
}
|
|
15
|
-
`,g=
|
|
15
|
+
`,g=e(o,{shouldForwardProp:i=>"isSticky"!==i&&"titleVariant"!==i})((({theme:i,isSticky:t,titleVariant:e})=>({fontSize:13,fontWeight:"light"===e?400:i.typography.fontWeightMedium,color:"light"===e?"rgba(0, 0, 0, 0.54)":i.palette.text.primary,padding:i.spacing(1.25,2),whiteSpace:"nowrap",position:t?"sticky":"relative",zIndex:t?1:"auto"}))),y=e(s)`
|
|
16
16
|
overflow: hidden;
|
|
17
|
-
`,
|
|
17
|
+
`,T=e(f)((({theme:i})=>({marginLeft:i.spacing(.5),svg:{fontSize:i.typography.body1.fontSize}}))),k=({data:e,title:o,subTitle:s,showTitle:f=!0,onRowClick:k,loading:w,metadata:S,titleVariant:x="default"})=>{const v=new Set(S.filter((i=>i.isVisible)).sort(((i,t)=>i.ordinal-t.ordinal)).map((i=>i.columnName))),z=S.reduce(((i,t)=>(i[t.columnName]=t,i)),{}),C=r(),V=!n(C.breakpoints.up("sm")),j=V?"normal":"sticky";return i(b,{children:[f&&t(d,{title:o,subTitle:s}),t(y,{children:t(c,{children:i(a,{"aria-label":o,"data-testid":"generic-table"+(f?`-${o.replace(" ","-").toLowerCase()}`:""),children:[t(l,{children:t(m,{children:Array.from(v).map(((e,r)=>{const{columnName:a,columnTitle:o,align:l="left",tooltip:m}=z[e];return t(g,{align:l,isSticky:0===r&&!V,titleVariant:x,children:i("div",{children:[t("span",{children:o}),m&&t(T,{title:m,placement:"right-start",children:t(h,{size:"small",children:t(u,{fontSize:"small"})})})]})},a)}))})}),t(p,{type:j,data:e,columns:v,onRowClick:k,loading:w,meta:z})]})})})]})};export{k as default};
|
|
18
18
|
//# sourceMappingURL=GenericTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTable.js","sources":["../../../../src/components/ui/GenericTable/GenericTable.tsx"],"sourcesContent":["import { styled, useTheme } from '@mui/material/styles';\n\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 useMediaQuery from '@mui/material/useMediaQuery';\nimport { GenericTableColumns } from './types';\nimport GenericTableTitle from '../GenericTableTitle/GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\nimport { GenericTableBody } from '../GenericTableBody';\nimport Card from '@mui/material/Card';\nimport InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';\nimport Tooltip from '@mui/material/Tooltip';\nimport IconButton from '@mui/material/IconButton';\n\ntype 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};\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',\n})<{ isSticky: boolean }>(({ theme, isSticky }) => ({\n fontSize: 13,\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 = ({ data, title, subTitle, showTitle = true, onRowClick, loading, metadata }: 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('sm'));\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 return (\n <StyledTableCell key={columnName} align={align} isSticky={idx === 0 && !isMobile}>\n <div>\n <span>{columnTitle}</span>\n {tooltip && (\n <StyledTooltip title={tooltip} placement=\"right-start\">\n <IconButton size=\"small\">\n <InfoOutlinedIcon fontSize=\"small\" />\n </IconButton>\n </StyledTooltip>\n )}\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle title={title} subTitle={subTitle}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table aria-label={title} data-testid={`generic-table` + (showTitle ? `-${title.replace(' ', '-').toLowerCase()}` : '')}>\n {renderTableHeader()}\n <GenericTableBody\n type={firstColumnStylePosition}\n data={data}\n columns={columns}\n onRowClick={onRowClick}\n loading={loading}\n meta={tableMeta}\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","fontSize","padding","spacing","whiteSpace","position","zIndex","StyledPaper","Card","StyledTooltip","Tooltip","marginLeft","svg","
|
|
1
|
+
{"version":3,"file":"GenericTable.js","sources":["../../../../src/components/ui/GenericTable/GenericTable.tsx"],"sourcesContent":["import { styled, useTheme } from '@mui/material/styles';\n\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 useMediaQuery from '@mui/material/useMediaQuery';\nimport { GenericTableColumns } from './types';\nimport GenericTableTitle from '../GenericTableTitle/GenericTableTitle';\nimport HighlightScrollbar from './HighlightScrollbar';\nimport { GenericTableBody } from '../GenericTableBody';\nimport Card from '@mui/material/Card';\nimport InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';\nimport Tooltip from '@mui/material/Tooltip';\nimport IconButton from '@mui/material/IconButton';\n\ntype 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: titleVariant === 'light' ? 'rgba(0, 0, 0, 0.54)' : theme.palette.text.primary,\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 = ({ data, title, subTitle, showTitle = true, onRowClick, loading, metadata, titleVariant = 'default' }: 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('sm'));\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 return (\n <StyledTableCell key={columnName} align={align} isSticky={idx === 0 && !isMobile} titleVariant={titleVariant}>\n <div>\n <span>{columnTitle}</span>\n {tooltip && (\n <StyledTooltip title={tooltip} placement=\"right-start\">\n <IconButton size=\"small\">\n <InfoOutlinedIcon fontSize=\"small\" />\n </IconButton>\n </StyledTooltip>\n )}\n </div>\n </StyledTableCell>\n );\n })}\n </TableRow>\n </TableHead>\n );\n\n return (\n <StyledContainer>\n {showTitle && <GenericTableTitle title={title} subTitle={subTitle}></GenericTableTitle>}\n <StyledPaper>\n <HighlightScrollbar>\n <Table aria-label={title} data-testid={`generic-table` + (showTitle ? `-${title.replace(' ', '-').toLowerCase()}` : '')}>\n {renderTableHeader()}\n <GenericTableBody\n type={firstColumnStylePosition}\n data={data}\n columns={columns}\n onRowClick={onRowClick}\n loading={loading}\n meta={tableMeta}\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","text","primary","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","type","meta"],"mappings":"smBA6BA,MAAMA,EAAkBC,EAAO,MAAM;;;;;;;;;;;;;;EAgB/BC,EAAkBD,EAAOE,EAAW,CACtCC,kBAAoBC,GAAkB,aAATA,GAAgC,iBAATA,GADhCJ,EAEqC,EAAGK,QAAOC,WAAUC,mBAAoB,CACjGC,SAAU,GACVC,WAA6B,UAAjBF,EAA2B,IAAMF,EAAMK,WAAWC,iBAC9DC,MAAwB,UAAjBL,EAA2B,sBAAwBF,EAAMQ,QAAQC,KAAKC,QAC7EC,QAASX,EAAMY,QAAQ,KAAM,GAC7BC,WAAY,SACZC,SAAUb,EAAW,SAAW,WAChCc,OAAQd,EAAW,EAAI,WAGrBe,EAAcrB,EAAOsB,EAAK;;EAI1BC,EAAgBvB,EAAOwB,EAAPxB,EAAgB,EAAGK,YAAa,CAClDoB,WAAYpB,EAAMY,QAAQ,IAC1BS,IAAK,CACDlB,SAAUH,EAAMK,WAAWiB,MAAMnB,cAInCoB,EAAe,EAAGC,OAAMC,QAAOC,WAAUC,aAAY,EAAMC,aAAYC,UAASC,WAAU5B,eAAe,cAC3G,MAAM6B,EAAU,IAAIC,IAChBF,EACKG,QAAQC,GAAMA,EAAEC,YAChBC,MAAK,CAACC,EAAGC,IAAMD,EAAEE,QAAUD,EAAEC,UAC7BC,KAAKN,GAAMA,EAAEO,cAEhBC,EAAYZ,EAASa,QAA+C,CAACC,EAAKC,KAC5ED,EAAIC,EAAMJ,YAAcI,EACjBD,IACR,CAAE,GAEC5C,EAAQ8C,IACRC,GAAYC,EAAchD,EAAMiD,YAAYC,GAAG,OAG/CC,EAA2BJ,EAAW,SAAW,SA0BvD,OACIK,EAAC1D,aACIiC,GAAa0B,EAACC,EAAiB,CAAC7B,MAAOA,EAAOC,SAAUA,IACzD2B,EAACrC,EAAW,CAAAuC,SACRF,EAACG,EAAkB,CAAAD,SACfH,EAACK,EAAK,CAAA,aAAahC,EAAoB,cAAA,iBAAmBE,EAAY,IAAIF,EAAMiC,QAAQ,IAAK,KAAKC,gBAAkB,IAC/GJ,SAAA,CA7BjBF,EAACO,EAAS,CAAAL,SACNF,EAACQ,EACI,CAAAN,SAAAO,MAAMC,KAAKhC,GAASS,KAAI,CAACzC,EAAMiE,KAC5B,MAAMvB,WAAEA,EAAUwB,YAAEA,EAAWC,MAAEA,EAAQ,OAAMC,QAAEA,GAAYzB,EAAU3C,GACvE,OACIsD,EAACzD,EAAe,CAAkBsE,MAAOA,EAAOjE,SAAkB,IAAR+D,IAAcjB,EAAU7C,aAAcA,EAC5FqD,SAAAH,EAAA,MAAA,CAAAG,SAAA,CACIF,EAAO,OAAA,CAAAE,SAAAU,IACNE,GACGd,EAACnC,EAAc,CAAAO,MAAO0C,EAASC,UAAU,cACrCb,SAAAF,EAACgB,EAAU,CAACC,KAAK,QAAOf,SACpBF,EAACkB,EAAiB,CAAApE,SAAS,kBANzBsC,EAYxB,QAaEY,EAACmB,EACG,CAAAC,KAAMtB,EACN3B,KAAMA,EACNO,QAASA,EACTH,WAAYA,EACZC,QAASA,EACT6C,KAAMhC,aAM5B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/styles"),t=require("@mui/material/TableBody"),r=require("@mui/material/TableCell"),l=require("@mui/material/TableRow"),a=require("@mui/material/Skeleton"),o=require("../GenericTableBodyRow/GenericTableBodyRow.cjs.js");const n=i.styled(r,{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"}))),s=({colIdx:i,colName:t,hasWarning:r,hasTitle:l,meta:a,row:o,type:s})=>{const c=o[t],m=a[t].align??"left",d=a[t].hideWhenEmpty??!1?"":"-",u={align:m,warning:r,titleCell:l,sticky:"sticky"===s&&0===i,"data-testid":`col-${t}`,isTitleRow:o.isTitleRow??!1};if("object"==typeof c)return e.jsx(n,{...u,children:c??d});switch(a[t].columnType){case"String":default:return e.jsx(n,{...u,children:c??d});case"Custom":return e.jsx(n,{...u,children:c?a[t].customComponent(c,o):d})}};module.exports=({columns:i,data:r,loading:c,type:m,onRowClick:d,meta:u})=>e.jsx(t,{children:c?Array.from(Array(5)).map(((t,r)=>e.jsx(l,{"data-testid":"row-loader",children:Array.from(i).map(((i,t)=>e.jsx(n,{align:"left",titleCell:!1,warning:!1,sticky:!1,"data-testid":`col-${i}`,isTitleRow:!1,children:e.jsx(a,{width:"90%",height:22})},t)))},r))):r?.map(((t,r)=>e.jsx(o,{onRowClick:d,row:t,tableRowTestKey:r.toString(),children:Array.from(i).map(((i,r)=>e.jsx(s,{colIdx:r,colName:i,row:t,type:m,meta:u},r)))},r)))});
|
|
2
2
|
//# sourceMappingURL=GenericTableBody.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableBody.cjs.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\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 { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(({ align, titleCell, warning, sticky }) => ({\n
|
|
1
|
+
{"version":3,"file":"GenericTableBody.cjs.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\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 { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky' && 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 type 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: 'sticky' | 'normal';\n};\n\nconst RenderTableCell: React.FC<TableCellProps> = ({ colIdx, colName, hasWarning, hasTitle, meta, row, type }) => {\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,\n titleCell: hasTitle,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n isTitleRow: row.isTitleRow ?? false,\n };\n\n // When object is passed for cell then render it as it is\n if (typeof prop === 'object') {\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n }\n\n switch (meta[colName].columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n case 'Custom':\n return <StyledTableCell {...tableCellProps}>{prop ? meta[colName].customComponent(prop, row) : fallbackValue}</StyledTableCell>;\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n }\n};\n\ntype 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: 'sticky' | 'normal';\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 <TableRow key={idx} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n key={colIdx}\n align={'left'}\n titleCell={false}\n warning={false}\n sticky={false}\n data-testid={`col-${columnName}`}\n isTitleRow={false}\n >\n <Skeleton width=\"90%\" height={22} />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow key={rowIdx} onRowClick={onRowClick} row={row} tableRowTestKey={rowIdx.toString()}>\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell key={colIdx} colIdx={colIdx} colName={colName} row={row} type={type} meta={meta} />\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","_jsx","jsx","columnType","children","customComponent","columns","data","loading","onRowClick","MuiTableBody","Array","from","map","_","idx","TableRow","columnName","Skeleton","width","height","rowIdx","GenericTableBodyRow","tableRowTestKey","toString"],"mappings":"mSAUA,MAAMA,EAAkBC,EAAMA,OAACC,EAAW,CACtCC,kBAAoBC,GAAkB,UAATA,GAA6B,cAATA,GAAiC,YAATA,GAA+B,WAATA,GAA8B,eAATA,GADhGH,EAGpB,EAAGI,QAAOC,YAAWC,UAASC,SAAQC,iBAAkB,CACpDC,UAAWL,EACXM,WAAYL,GAAaG,EAAa,OAAS,SAC/CG,gBAAiBL,EAAU,UAAY,UACvCM,SAAUL,EAAS,SAAW,aAehCM,EAA4C,EAAGC,SAAQC,UAASC,aAAYC,WAAUC,OAAMC,MAAKC,WACnG,MAAMjB,EAAOgB,EAAIJ,GACXX,EAAQc,EAAKH,GAASX,OAAS,OAE/BiB,EADgBH,EAAKH,GAASO,gBAAiB,EACf,GAAK,IACrCC,EAAiB,CACnBnB,QACAE,QAASU,EACTX,UAAWY,EACXV,OAAiB,WAATa,GAAgC,IAAXN,EAC7B,cAAe,OAAOC,IACtBP,WAAYW,EAAIX,aAAc,GAIlC,GAAoB,iBAATL,EACP,OAAOqB,EAAAC,IAAC1B,EAAoB,IAAAwB,WAAiBpB,GAAQkB,IAGzD,OAAQH,EAAKH,GAASW,YAClB,IAAK,SAIL,QACI,OAAOF,EAAAC,IAAC1B,EAAoB,IAAAwB,WAAiBpB,GAAQkB,IAHzD,IAAK,SACD,OAAOG,EAAAA,IAACzB,EAAe,IAAKwB,EAAcI,SAAGxB,EAAOe,EAAKH,GAASa,gBAAgBzB,EAAMgB,GAAOE,IAGtG,iBAc8C,EAAGQ,UAASC,OAAMC,UAASX,OAAMY,aAAYd,UAGxFM,MAACS,EAAY,CAAAN,SACRI,EACKG,MAAMC,KAAKD,MAJL,IAIyBE,KAAI,CAACC,EAAGC,IACnCd,MAACe,EAAQ,CAAA,cAAuB,aAC3BZ,SAAAO,MAAMC,KAAKN,GAASO,KAAI,CAACI,EAAY1B,IAClCU,EAACC,IAAA1B,EAEG,CAAAK,MAAO,OACPC,WAAW,EACXC,SAAS,EACTC,QAAQ,EAAK,cACA,OAAOiC,IACpBhC,YAAY,EAEZmB,SAAAH,MAACiB,EAAS,CAAAC,MAAM,MAAMC,OAAQ,MARzB7B,MAHFwB,KAgBnBR,GAAMM,KAAI,CAACjB,EAAKyB,IACZpB,EAAAA,IAACqB,EAAmB,CAAcb,WAAYA,EAAYb,IAAKA,EAAK2B,gBAAiBF,EAAOG,WACvFpB,SAAAO,MAAMC,KAAKN,GAASO,KAAI,CAACrB,EAASD,IAC/BU,EAAAA,IAACX,EAAe,CAAcC,OAAQA,EAAQC,QAASA,EAASI,IAAKA,EAAKC,KAAMA,EAAMF,KAAMA,GAAtEJ,MAFJ8B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{styled as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{styled as i}from"@mui/material/styles";import e from"@mui/material/TableBody";import o from"@mui/material/TableCell";import r from"@mui/material/TableRow";import l from"@mui/material/Skeleton";import a from"../GenericTableBodyRow/GenericTableBodyRow.js";const n=i(o,{shouldForwardProp:t=>"align"!==t&&"titleCell"!==t&&"warning"!==t&&"sticky"!==t&&"isTitleRow"!==t})((({align:t,titleCell:i,warning:e,sticky:o,isTitleRow:r})=>({textAlign:t,fontWeight:i||r?"bold":"normal",backgroundColor:e?"#ffcccb":"inherit",position:o?"sticky":"static"}))),m=({colIdx:i,colName:e,hasWarning:o,hasTitle:r,meta:l,row:a,type:m})=>{const c=a[e],s=l[e].align??"left",d=l[e].hideWhenEmpty??!1?"":"-",w={align:s,warning:o,titleCell:r,sticky:"sticky"===m&&0===i,"data-testid":`col-${e}`,isTitleRow:a.isTitleRow??!1};if("object"==typeof c)return t(n,{...w,children:c??d});switch(l[e].columnType){case"String":default:return t(n,{...w,children:c??d});case"Custom":return t(n,{...w,children:c?l[e].customComponent(c,a):d})}},c=({columns:i,data:o,loading:c,type:s,onRowClick:d,meta:w})=>t(e,{children:c?Array.from(Array(5)).map(((e,o)=>t(r,{"data-testid":"row-loader",children:Array.from(i).map(((i,e)=>t(n,{align:"left",titleCell:!1,warning:!1,sticky:!1,"data-testid":`col-${i}`,isTitleRow:!1,children:t(l,{width:"90%",height:22})},e)))},o))):o?.map(((e,o)=>t(a,{onRowClick:d,row:e,tableRowTestKey:o.toString(),children:Array.from(i).map(((i,o)=>t(m,{colIdx:o,colName:i,row:e,type:s,meta:w},o)))},o)))});export{c as default};
|
|
2
2
|
//# sourceMappingURL=GenericTableBody.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableBody.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\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 { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky',\n})<{ align: string; titleCell: boolean; warning: boolean; sticky: boolean }>(({ align, titleCell, warning, sticky }) => ({\n
|
|
1
|
+
{"version":3,"file":"GenericTableBody.js","sources":["../../../../src/components/ui/GenericTableBody/GenericTableBody.tsx"],"sourcesContent":["import React from 'react';\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 { GenericTableColumns } from '../GenericTable';\nimport Skeleton from '@mui/material/Skeleton';\nimport { GenericTableBodyRow } from '../GenericTableBodyRow';\n\nconst StyledTableCell = styled(TableCell, {\n shouldForwardProp: (prop) => prop !== 'align' && prop !== 'titleCell' && prop !== 'warning' && prop !== 'sticky' && 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 type 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: 'sticky' | 'normal';\n};\n\nconst RenderTableCell: React.FC<TableCellProps> = ({ colIdx, colName, hasWarning, hasTitle, meta, row, type }) => {\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,\n titleCell: hasTitle,\n sticky: type === 'sticky' && colIdx === 0,\n 'data-testid': `col-${colName}`,\n isTitleRow: row.isTitleRow ?? false,\n };\n\n // When object is passed for cell then render it as it is\n if (typeof prop === 'object') {\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n }\n\n switch (meta[colName].columnType) {\n case 'String':\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n case 'Custom':\n return <StyledTableCell {...tableCellProps}>{prop ? meta[colName].customComponent(prop, row) : fallbackValue}</StyledTableCell>;\n default:\n return <StyledTableCell {...tableCellProps}>{prop ?? fallbackValue}</StyledTableCell>;\n }\n};\n\ntype 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: 'sticky' | 'normal';\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 <TableRow key={idx} data-testid=\"row-loader\">\n {Array.from(columns).map((columnName, colIdx) => (\n <StyledTableCell\n key={colIdx}\n align={'left'}\n titleCell={false}\n warning={false}\n sticky={false}\n data-testid={`col-${columnName}`}\n isTitleRow={false}\n >\n <Skeleton width=\"90%\" height={22} />\n </StyledTableCell>\n ))}\n </TableRow>\n ))\n : data?.map((row, rowIdx) => (\n <GenericTableBodyRow key={rowIdx} onRowClick={onRowClick} row={row} tableRowTestKey={rowIdx.toString()}>\n {Array.from(columns).map((colName, colIdx) => (\n <RenderTableCell key={colIdx} colIdx={colIdx} colName={colName} row={row} type={type} meta={meta} />\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","_jsx","columnType","children","customComponent","GenericTableBody","columns","data","loading","onRowClick","MuiTableBody","Array","from","map","_","idx","TableRow","columnName","Skeleton","width","height","rowIdx","GenericTableBodyRow","tableRowTestKey","toString"],"mappings":"6SAUA,MAAMA,EAAkBC,EAAOC,EAAW,CACtCC,kBAAoBC,GAAkB,UAATA,GAA6B,cAATA,GAAiC,YAATA,GAA+B,WAATA,GAA8B,eAATA,GADhGH,EAGpB,EAAGI,QAAOC,YAAWC,UAASC,SAAQC,iBAAkB,CACpDC,UAAWL,EACXM,WAAYL,GAAaG,EAAa,OAAS,SAC/CG,gBAAiBL,EAAU,UAAY,UACvCM,SAAUL,EAAS,SAAW,aAehCM,EAA4C,EAAGC,SAAQC,UAASC,aAAYC,WAAUC,OAAMC,MAAKC,WACnG,MAAMjB,EAAOgB,EAAIJ,GACXX,EAAQc,EAAKH,GAASX,OAAS,OAE/BiB,EADgBH,EAAKH,GAASO,gBAAiB,EACf,GAAK,IACrCC,EAAiB,CACnBnB,QACAE,QAASU,EACTX,UAAWY,EACXV,OAAiB,WAATa,GAAgC,IAAXN,EAC7B,cAAe,OAAOC,IACtBP,WAAYW,EAAIX,aAAc,GAIlC,GAAoB,iBAATL,EACP,OAAOqB,EAACzB,EAAoB,IAAAwB,WAAiBpB,GAAQkB,IAGzD,OAAQH,EAAKH,GAASU,YAClB,IAAK,SAIL,QACI,OAAOD,EAACzB,EAAoB,IAAAwB,WAAiBpB,GAAQkB,IAHzD,IAAK,SACD,OAAOG,EAACzB,EAAe,IAAKwB,EAAcG,SAAGvB,EAAOe,EAAKH,GAASY,gBAAgBxB,EAAMgB,GAAOE,IAGtG,EAcCO,EAA6C,EAAGC,UAASC,OAAMC,UAASX,OAAMY,aAAYd,UAGxFM,EAACS,EAAY,CAAAP,SACRK,EACKG,MAAMC,KAAKD,MAJL,IAIyBE,KAAI,CAACC,EAAGC,IACnCd,EAACe,EAAQ,CAAA,cAAuB,aAC3Bb,SAAAQ,MAAMC,KAAKN,GAASO,KAAI,CAACI,EAAY1B,IAClCU,EAACzB,EAEG,CAAAK,MAAO,OACPC,WAAW,EACXC,SAAS,EACTC,QAAQ,EAAK,cACA,OAAOiC,IACpBhC,YAAY,EAEZkB,SAAAF,EAACiB,EAAS,CAAAC,MAAM,MAAMC,OAAQ,MARzB7B,MAHFwB,KAgBnBR,GAAMM,KAAI,CAACjB,EAAKyB,IACZpB,EAACqB,EAAmB,CAAcb,WAAYA,EAAYb,IAAKA,EAAK2B,gBAAiBF,EAAOG,WACvFrB,SAAAQ,MAAMC,KAAKN,GAASO,KAAI,CAACrB,EAASD,IAC/BU,EAACX,EAAe,CAAcC,OAAQA,EAAQC,QAASA,EAASI,IAAKA,EAAKC,KAAMA,EAAMF,KAAMA,GAAtEJ,MAFJ8B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@mui/material/TableRow");const r=require("@mui/material/styles").styled(t,{shouldForwardProp:e=>"isTitleRow"!==e})((({theme:e,isTitleRow:t})=>t?{backgroundColor:e.palette.grey[100]}:{}));module.exports=o=>{const{onRowClick:i,row:l,children:s,tableRowTestKey:a}=o,d=e=>{e.preventDefault(),i&&i(l)};return i?e.jsx(r,{role:"button",onClick:d,hover:void 0!==d,"data-testid":`row-${a}`,isTitleRow:l.isTitleRow??!1,children:s}):e.jsx(t,{"data-testid":`row-${a}`,children:s})};
|
|
2
2
|
//# sourceMappingURL=GenericTableBodyRow.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableBodyRow.cjs.js","sources":["../../../../src/components/ui/GenericTableBodyRow/GenericTableBodyRow.tsx"],"sourcesContent":["import React from 'react';\n\nimport TableRow from '@mui/material/TableRow';\n\nexport type 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\ntype TableBodyRowProp = TableBodyRowProps & { children: React.ReactNode };\n\nconst GenericTableBodyRow: React.FC<React.PropsWithChildren<TableBodyRowProp>> = (props) => {\n const { onRowClick, row, children, tableRowTestKey } = props;\n\n const onClick = (e) => {\n e.preventDefault();\n onRowClick && onRowClick(row);\n };\n\n if (onRowClick) {\n return (\n <
|
|
1
|
+
{"version":3,"file":"GenericTableBodyRow.cjs.js","sources":["../../../../src/components/ui/GenericTableBodyRow/GenericTableBodyRow.tsx"],"sourcesContent":["import React from 'react';\n\nimport TableRow from '@mui/material/TableRow';\nimport { styled } from '@mui/material/styles';\n\nexport type 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.grey[100],\n };\n});\n\ntype TableBodyRowProp = TableBodyRowProps & { children: React.ReactNode };\n\nconst GenericTableBodyRow: React.FC<React.PropsWithChildren<TableBodyRowProp>> = (props) => {\n const { onRowClick, row, children, tableRowTestKey } = props;\n\n const onClick = (e) => {\n e.preventDefault();\n onRowClick && onRowClick(row);\n };\n\n if (onRowClick) {\n return (\n <StyledTableRow\n role=\"button\"\n onClick={onClick}\n hover={onClick !== undefined}\n data-testid={`row-${tableRowTestKey}`}\n isTitleRow={row.isTitleRow ?? false}\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","grey","props","onRowClick","row","children","tableRowTestKey","onClick","e","preventDefault","_jsx","jsx","role","hover","undefined"],"mappings":"oFAaA,MAAMA,kCAAuBC,OAACC,EAAU,CACpCC,kBAAoBC,GAAkB,eAATA,GADVH,EAEK,EAAGI,QAAOC,gBAC7BA,EAIE,CACHC,gBAAiBF,EAAMG,QAAQC,KAAK,MAJ7B,oBAUmEC,IAC9E,MAAMC,WAAEA,EAAUC,IAAEA,EAAGC,SAAEA,EAAQC,gBAAEA,GAAoBJ,EAEjDK,EAAWC,IACbA,EAAEC,iBACFN,GAAcA,EAAWC,EAAI,EAGjC,OAAID,EAEIO,EAAAC,IAACnB,EAAc,CACXoB,KAAK,SACLL,QAASA,EACTM,WAAmBC,IAAZP,EAAqB,cACf,OAAOD,IACpBR,WAAYM,EAAIN,aAAc,EAAKO,SAElCA,IAKNK,MAAChB,EAAsB,CAAA,cAAA,OAAOY,IAAiBD,SAAGA,GAAoB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import e from"@mui/material/TableRow";const o=o=>{const{onRowClick:
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import e from"@mui/material/TableRow";import{styled as o}from"@mui/material/styles";const r=o(e,{shouldForwardProp:t=>"isTitleRow"!==t})((({theme:t,isTitleRow:e})=>e?{backgroundColor:t.palette.grey[100]}:{})),i=o=>{const{onRowClick:i,row:l,children:a,tableRowTestKey:s}=o,d=t=>{t.preventDefault(),i&&i(l)};return i?t(r,{role:"button",onClick:d,hover:void 0!==d,"data-testid":`row-${s}`,isTitleRow:l.isTitleRow??!1,children:a}):t(e,{"data-testid":`row-${s}`,children:a})};export{i as default};
|
|
2
2
|
//# sourceMappingURL=GenericTableBodyRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericTableBodyRow.js","sources":["../../../../src/components/ui/GenericTableBodyRow/GenericTableBodyRow.tsx"],"sourcesContent":["import React from 'react';\n\nimport TableRow from '@mui/material/TableRow';\n\nexport type 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\ntype TableBodyRowProp = TableBodyRowProps & { children: React.ReactNode };\n\nconst GenericTableBodyRow: React.FC<React.PropsWithChildren<TableBodyRowProp>> = (props) => {\n const { onRowClick, row, children, tableRowTestKey } = props;\n\n const onClick = (e) => {\n e.preventDefault();\n onRowClick && onRowClick(row);\n };\n\n if (onRowClick) {\n return (\n <
|
|
1
|
+
{"version":3,"file":"GenericTableBodyRow.js","sources":["../../../../src/components/ui/GenericTableBodyRow/GenericTableBodyRow.tsx"],"sourcesContent":["import React from 'react';\n\nimport TableRow from '@mui/material/TableRow';\nimport { styled } from '@mui/material/styles';\n\nexport type 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.grey[100],\n };\n});\n\ntype TableBodyRowProp = TableBodyRowProps & { children: React.ReactNode };\n\nconst GenericTableBodyRow: React.FC<React.PropsWithChildren<TableBodyRowProp>> = (props) => {\n const { onRowClick, row, children, tableRowTestKey } = props;\n\n const onClick = (e) => {\n e.preventDefault();\n onRowClick && onRowClick(row);\n };\n\n if (onRowClick) {\n return (\n <StyledTableRow\n role=\"button\"\n onClick={onClick}\n hover={onClick !== undefined}\n data-testid={`row-${tableRowTestKey}`}\n isTitleRow={row.isTitleRow ?? false}\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","grey","GenericTableBodyRow","props","onRowClick","row","children","tableRowTestKey","onClick","e","preventDefault","_jsx","role","hover","undefined"],"mappings":"4HAaA,MAAMA,EAAiBC,EAAOC,EAAU,CACpCC,kBAAoBC,GAAkB,eAATA,GADVH,EAEK,EAAGI,QAAOC,gBAC7BA,EAIE,CACHC,gBAAiBF,EAAMG,QAAQC,KAAK,MAJ7B,KAUTC,EAA4EC,IAC9E,MAAMC,WAAEA,EAAUC,IAAEA,EAAGC,SAAEA,EAAQC,gBAAEA,GAAoBJ,EAEjDK,EAAWC,IACbA,EAAEC,iBACFN,GAAcA,EAAWC,EAAI,EAGjC,OAAID,EAEIO,EAACnB,EAAc,CACXoB,KAAK,SACLJ,QAASA,EACTK,WAAmBC,IAAZN,EAAqB,cACf,OAAOD,IACpBT,WAAYO,EAAIP,aAAc,EAAKQ,SAElCA,IAKNK,EAACjB,EAAsB,CAAA,cAAA,OAAOa,IAAiBD,SAAGA,GAAoB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),a=require("@mui/material"),r=require("@mui/material/Switch");module.exports=({label:l,checked:t,onChange:i,labelPlacement:m="start",size:s="medium",disabled:c=!1,testId:d})=>e.jsx(a.FormControlLabel,{label:l,labelPlacement:m,control:e.jsx(r,{checked:t,onChange:i,color:"primary",size:s,disabled:c,"data-fd":d})});
|
|
2
2
|
//# sourceMappingURL=Switch.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.cjs.js","sources":["../../../../src/components/ui/Switch/Switch.tsx"],"sourcesContent":["import { FormControlLabel, FormControlLabelProps } from '@mui/material';\nimport MuiSwitch, { SwitchProps as MuiSwitchProps } from '@mui/material/Switch';\n\nexport type SwitchProps = {\n label: string;\n labelPlacement?: FormControlLabelProps['labelPlacement'];\n checked?: boolean;\n onChange?: MuiSwitchProps['onChange'];\n size?: MuiSwitchProps['size'];\n disabled?: boolean;\n};\n\nconst Switch = ({ label, checked, onChange, labelPlacement = 'start', size = 'medium', disabled = false }: SwitchProps) => {\n return (\n <FormControlLabel\n label={label}\n labelPlacement={labelPlacement}\n control={<MuiSwitch checked={checked} onChange={onChange} color=\"primary\" size={size} disabled={disabled} />}\n />\n );\n};\n\nexport default Switch;\n"],"names":["label","checked","onChange","labelPlacement","size","disabled","_jsx","FormControlLabel","control","MuiSwitch","color"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Switch.cjs.js","sources":["../../../../src/components/ui/Switch/Switch.tsx"],"sourcesContent":["import { FormControlLabel, FormControlLabelProps } from '@mui/material';\nimport MuiSwitch, { SwitchProps as MuiSwitchProps } from '@mui/material/Switch';\n\nexport type SwitchProps = {\n label: string;\n labelPlacement?: FormControlLabelProps['labelPlacement'];\n checked?: boolean;\n onChange?: MuiSwitchProps['onChange'];\n size?: MuiSwitchProps['size'];\n disabled?: boolean;\n testId?: string;\n};\n\nconst Switch = ({ label, checked, onChange, labelPlacement = 'start', size = 'medium', disabled = false, testId = undefined }: SwitchProps) => {\n return (\n <FormControlLabel\n label={label}\n labelPlacement={labelPlacement}\n control={<MuiSwitch checked={checked} onChange={onChange} color=\"primary\" size={size} disabled={disabled} data-fd={testId} />}\n />\n );\n};\n\nexport default Switch;\n"],"names":["label","checked","onChange","labelPlacement","size","disabled","testId","_jsx","FormControlLabel","control","MuiSwitch","color"],"mappings":"4HAae,EAAGA,QAAOC,UAASC,WAAUC,iBAAiB,QAASC,OAAO,SAAUC,YAAW,EAAOC,YAEjGC,MAACC,EAAAA,kBACGR,MAAOA,EACPG,eAAgBA,EAChBM,QAASF,EAAAA,IAACG,EAAS,CAACT,QAASA,EAASC,SAAUA,EAAUS,MAAM,UAAUP,KAAMA,EAAMC,SAAUA,EAAQ,UAAWC"}
|
|
@@ -9,7 +9,8 @@ type SwitchProps = {
|
|
|
9
9
|
onChange?: SwitchProps$1['onChange'];
|
|
10
10
|
size?: SwitchProps$1['size'];
|
|
11
11
|
disabled?: boolean;
|
|
12
|
+
testId?: string;
|
|
12
13
|
};
|
|
13
|
-
declare const Switch: ({ label, checked, onChange, labelPlacement, size, disabled }: SwitchProps) => react_jsx_runtime.JSX.Element;
|
|
14
|
+
declare const Switch: ({ label, checked, onChange, labelPlacement, size, disabled, testId }: SwitchProps) => react_jsx_runtime.JSX.Element;
|
|
14
15
|
|
|
15
16
|
export { type SwitchProps, Switch as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{FormControlLabel as a}from"@mui/material";import
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{FormControlLabel as a}from"@mui/material";import t from"@mui/material/Switch";const l=({label:l,checked:m,onChange:r,labelPlacement:i="start",size:o="medium",disabled:c=!1,testId:d})=>e(a,{label:l,labelPlacement:i,control:e(t,{checked:m,onChange:r,color:"primary",size:o,disabled:c,"data-fd":d})});export{l as default};
|
|
2
2
|
//# sourceMappingURL=Switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../../../src/components/ui/Switch/Switch.tsx"],"sourcesContent":["import { FormControlLabel, FormControlLabelProps } from '@mui/material';\nimport MuiSwitch, { SwitchProps as MuiSwitchProps } from '@mui/material/Switch';\n\nexport type SwitchProps = {\n label: string;\n labelPlacement?: FormControlLabelProps['labelPlacement'];\n checked?: boolean;\n onChange?: MuiSwitchProps['onChange'];\n size?: MuiSwitchProps['size'];\n disabled?: boolean;\n};\n\nconst Switch = ({ label, checked, onChange, labelPlacement = 'start', size = 'medium', disabled = false }: SwitchProps) => {\n return (\n <FormControlLabel\n label={label}\n labelPlacement={labelPlacement}\n control={<MuiSwitch checked={checked} onChange={onChange} color=\"primary\" size={size} disabled={disabled} />}\n />\n );\n};\n\nexport default Switch;\n"],"names":["Switch","label","checked","onChange","labelPlacement","size","disabled","_jsx","FormControlLabel","control","MuiSwitch","color"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../../src/components/ui/Switch/Switch.tsx"],"sourcesContent":["import { FormControlLabel, FormControlLabelProps } from '@mui/material';\nimport MuiSwitch, { SwitchProps as MuiSwitchProps } from '@mui/material/Switch';\n\nexport type SwitchProps = {\n label: string;\n labelPlacement?: FormControlLabelProps['labelPlacement'];\n checked?: boolean;\n onChange?: MuiSwitchProps['onChange'];\n size?: MuiSwitchProps['size'];\n disabled?: boolean;\n testId?: string;\n};\n\nconst Switch = ({ label, checked, onChange, labelPlacement = 'start', size = 'medium', disabled = false, testId = undefined }: SwitchProps) => {\n return (\n <FormControlLabel\n label={label}\n labelPlacement={labelPlacement}\n control={<MuiSwitch checked={checked} onChange={onChange} color=\"primary\" size={size} disabled={disabled} data-fd={testId} />}\n />\n );\n};\n\nexport default Switch;\n"],"names":["Switch","label","checked","onChange","labelPlacement","size","disabled","testId","_jsx","FormControlLabel","control","MuiSwitch","color"],"mappings":"6HAaM,MAAAA,EAAS,EAAGC,QAAOC,UAASC,WAAUC,iBAAiB,QAASC,OAAO,SAAUC,YAAW,EAAOC,YAEjGC,EAACC,GACGR,MAAOA,EACPG,eAAgBA,EAChBM,QAASF,EAACG,EAAS,CAACT,QAASA,EAASC,SAAUA,EAAUS,MAAM,UAAUP,KAAMA,EAAMC,SAAUA,EAAQ,UAAWC"}
|