@coveord/plasma-mantine 52.6.0 → 52.7.1
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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +32 -31
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/components/table/Table.d.ts.map +1 -1
- package/dist/cjs/components/table/Table.js +32 -86
- package/dist/cjs/components/table/Table.js.map +1 -1
- package/dist/cjs/components/table/Table.styles.d.ts +2 -5
- package/dist/cjs/components/table/Table.styles.d.ts.map +1 -1
- package/dist/cjs/components/table/Table.styles.js +7 -45
- package/dist/cjs/components/table/Table.styles.js.map +1 -1
- package/dist/cjs/components/table/Table.types.d.ts +57 -1
- package/dist/cjs/components/table/Table.types.d.ts.map +1 -1
- package/dist/cjs/components/table/TableActions.d.ts +12 -2
- package/dist/cjs/components/table/TableActions.d.ts.map +1 -1
- package/dist/cjs/components/table/TableActions.js +29 -7
- package/dist/cjs/components/table/TableActions.js.map +1 -1
- package/dist/cjs/components/table/TableDateRangePicker.d.ts +12 -1
- package/dist/cjs/components/table/TableDateRangePicker.d.ts.map +1 -1
- package/dist/cjs/components/table/TableDateRangePicker.js +31 -5
- package/dist/cjs/components/table/TableDateRangePicker.js.map +1 -1
- package/dist/cjs/components/table/TableFilter.d.ts +1 -0
- package/dist/cjs/components/table/TableFilter.d.ts.map +1 -1
- package/dist/cjs/components/table/TableFilter.js +3 -1
- package/dist/cjs/components/table/TableFilter.js.map +1 -1
- package/dist/cjs/components/table/TableHeader.d.ts.map +1 -1
- package/dist/cjs/components/table/TableHeader.js +3 -1
- package/dist/cjs/components/table/TableHeader.js.map +1 -1
- package/dist/cjs/components/table/TableLayoutControl.d.ts +3 -0
- package/dist/cjs/components/table/TableLayoutControl.d.ts.map +1 -0
- package/dist/cjs/components/table/TableLayoutControl.js +50 -0
- package/dist/cjs/components/table/TableLayoutControl.js.map +1 -0
- package/dist/cjs/components/table/TableLoading.d.ts +4 -0
- package/dist/cjs/components/table/TableLoading.d.ts.map +1 -0
- package/dist/cjs/components/table/TableLoading.js +28 -0
- package/dist/cjs/components/table/TableLoading.js.map +1 -0
- package/dist/cjs/components/table/TablePredicate.d.ts +12 -2
- package/dist/cjs/components/table/TablePredicate.d.ts.map +1 -1
- package/dist/cjs/components/table/TablePredicate.js +29 -4
- package/dist/cjs/components/table/TablePredicate.js.map +1 -1
- package/dist/cjs/components/table/Th.d.ts.map +1 -1
- package/dist/cjs/components/table/Th.js +2 -1
- package/dist/cjs/components/table/Th.js.map +1 -1
- package/dist/cjs/components/table/index.d.ts +2 -1
- package/dist/cjs/components/table/index.d.ts.map +1 -1
- package/dist/cjs/components/table/index.js +12 -3
- package/dist/cjs/components/table/index.js.map +1 -1
- package/dist/cjs/components/table/layouts/RowLayout.d.ts +3 -0
- package/dist/cjs/components/table/layouts/RowLayout.d.ts.map +1 -0
- package/dist/cjs/components/table/layouts/RowLayout.js +156 -0
- package/dist/cjs/components/table/layouts/RowLayout.js.map +1 -0
- package/dist/cjs/components/table/layouts/TableLayouts.d.ts +4 -0
- package/dist/cjs/components/table/layouts/TableLayouts.d.ts.map +1 -0
- package/dist/cjs/components/table/layouts/TableLayouts.js +16 -0
- package/dist/cjs/components/table/layouts/TableLayouts.js.map +1 -0
- package/dist/cjs/theme/Theme.js +7 -5
- package/dist/cjs/theme/Theme.js.map +1 -1
- package/dist/esm/components/table/Table.d.ts.map +1 -1
- package/dist/esm/components/table/Table.js +35 -89
- package/dist/esm/components/table/Table.js.map +1 -1
- package/dist/esm/components/table/Table.styles.d.ts +2 -5
- package/dist/esm/components/table/Table.styles.d.ts.map +1 -1
- package/dist/esm/components/table/Table.styles.js +7 -45
- package/dist/esm/components/table/Table.styles.js.map +1 -1
- package/dist/esm/components/table/Table.types.d.ts +57 -1
- package/dist/esm/components/table/Table.types.d.ts.map +1 -1
- package/dist/esm/components/table/Table.types.js.map +1 -1
- package/dist/esm/components/table/TableActions.d.ts +12 -2
- package/dist/esm/components/table/TableActions.d.ts.map +1 -1
- package/dist/esm/components/table/TableActions.js +30 -8
- package/dist/esm/components/table/TableActions.js.map +1 -1
- package/dist/esm/components/table/TableDateRangePicker.d.ts +12 -1
- package/dist/esm/components/table/TableDateRangePicker.d.ts.map +1 -1
- package/dist/esm/components/table/TableDateRangePicker.js +32 -6
- package/dist/esm/components/table/TableDateRangePicker.js.map +1 -1
- package/dist/esm/components/table/TableFilter.d.ts +1 -0
- package/dist/esm/components/table/TableFilter.d.ts.map +1 -1
- package/dist/esm/components/table/TableFilter.js +3 -1
- package/dist/esm/components/table/TableFilter.js.map +1 -1
- package/dist/esm/components/table/TableHeader.d.ts.map +1 -1
- package/dist/esm/components/table/TableHeader.js +3 -1
- package/dist/esm/components/table/TableHeader.js.map +1 -1
- package/dist/esm/components/table/TableLayoutControl.d.ts +3 -0
- package/dist/esm/components/table/TableLayoutControl.d.ts.map +1 -0
- package/dist/esm/components/table/TableLayoutControl.js +40 -0
- package/dist/esm/components/table/TableLayoutControl.js.map +1 -0
- package/dist/esm/components/table/TableLoading.d.ts +4 -0
- package/dist/esm/components/table/TableLoading.d.ts.map +1 -0
- package/dist/esm/components/table/TableLoading.js +18 -0
- package/dist/esm/components/table/TableLoading.js.map +1 -0
- package/dist/esm/components/table/TablePredicate.d.ts +12 -2
- package/dist/esm/components/table/TablePredicate.d.ts.map +1 -1
- package/dist/esm/components/table/TablePredicate.js +30 -5
- package/dist/esm/components/table/TablePredicate.js.map +1 -1
- package/dist/esm/components/table/Th.d.ts.map +1 -1
- package/dist/esm/components/table/Th.js +2 -1
- package/dist/esm/components/table/Th.js.map +1 -1
- package/dist/esm/components/table/index.d.ts +2 -1
- package/dist/esm/components/table/index.d.ts.map +1 -1
- package/dist/esm/components/table/index.js +1 -0
- package/dist/esm/components/table/index.js.map +1 -1
- package/dist/esm/components/table/layouts/RowLayout.d.ts +3 -0
- package/dist/esm/components/table/layouts/RowLayout.d.ts.map +1 -0
- package/dist/esm/components/table/layouts/RowLayout.js +146 -0
- package/dist/esm/components/table/layouts/RowLayout.js.map +1 -0
- package/dist/esm/components/table/layouts/TableLayouts.d.ts +4 -0
- package/dist/esm/components/table/layouts/TableLayouts.d.ts.map +1 -0
- package/dist/esm/components/table/layouts/TableLayouts.js +6 -0
- package/dist/esm/components/table/layouts/TableLayouts.js.map +1 -0
- package/dist/esm/theme/Theme.js +7 -5
- package/dist/esm/theme/Theme.js.map +1 -1
- package/package.json +6 -6
- package/src/components/table/Table.styles.ts +33 -88
- package/src/components/table/Table.tsx +39 -86
- package/src/components/table/Table.types.ts +59 -0
- package/src/components/table/TableActions.tsx +22 -6
- package/src/components/table/TableDateRangePicker.tsx +27 -6
- package/src/components/table/TableFilter.tsx +4 -3
- package/src/components/table/TableHeader.tsx +2 -0
- package/src/components/table/TableLayoutControl.tsx +29 -0
- package/src/components/table/TableLoading.tsx +8 -0
- package/src/components/table/TablePredicate.tsx +24 -7
- package/src/components/table/Th.tsx +1 -0
- package/src/components/table/__tests__/Table.spec.tsx +121 -369
- package/src/components/table/index.ts +9 -1
- package/src/components/table/layouts/RowLayout.tsx +150 -0
- package/src/components/table/layouts/TableLayouts.tsx +5 -0
- package/src/components/table/layouts/__tests__/RowLayout.spec.tsx +296 -0
- package/src/theme/Theme.tsx +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/table/layouts/RowLayout.tsx"],"sourcesContent":["import {ListSize16Px} from '@coveord/plasma-react-icons';\nimport {Box, Collapse, createStyles} from '@mantine/core';\nimport {flexRender} from '@tanstack/react-table';\nimport {defaultColumnSizing} from '@tanstack/table-core';\nimport {Fragment} from 'react';\nimport {TableLayout, TableLayoutProps} from '../Table.types';\nimport {TableCollapsibleColumn} from '../TableCollapsibleColumn';\nimport {useTable} from '../TableContext';\nimport {TableLoading} from '../TableLoading';\nimport {Th} from '../Th';\n\ninterface TableStylesParams {\n multiRowSelectionEnabled: boolean;\n disableRowSelection: boolean;\n}\n\nconst useStyles = createStyles<string, TableStylesParams>((theme, {multiRowSelectionEnabled, disableRowSelection}) => {\n const rowBackgroundColor =\n theme.colorScheme === 'dark'\n ? theme.fn.rgba(theme.colors[theme.primaryColor][7], 0.2)\n : theme.colors[theme.primaryColor][0];\n return {\n headerColumns: {\n '& th:first-of-type > *': {\n paddingLeft: theme.spacing.xl,\n },\n\n '& input[type=checkbox]': {\n backgroundColor: disableRowSelection ? `${theme.colors.gray[2]}` : undefined,\n borderColor: disableRowSelection ? `${theme.colors.gray[3]}` : `${theme.colors.gray[4]}`,\n pointerEvents: disableRowSelection ? 'none' : 'auto',\n cursor: disableRowSelection ? 'not-allowed' : 'default',\n\n '& + svg': {\n color: disableRowSelection ? `${theme.colors.gray[5]}` : 'inherit',\n },\n },\n },\n\n rowSelected: {\n backgroundColor: multiRowSelectionEnabled ? undefined : rowBackgroundColor,\n },\n\n rowUnselectable: {\n '& input[type=checkbox]': {\n backgroundColor: `${theme.colors.gray[2]}`,\n borderColor: `${theme.colors.gray[3]}`,\n pointerEvents: 'none',\n cursor: 'not-allowed',\n\n '&:checked + svg': {\n color: `${theme.colors.gray[5]}`,\n },\n },\n },\n\n rowCollapsibleButtonCell: {\n textAlign: 'right',\n padding: `calc(${theme.spacing.xs}/2) ${theme.spacing.sm} !important`,\n },\n\n row: {\n '&:hover': {\n backgroundColor: rowBackgroundColor,\n },\n },\n };\n});\n\nconst RowLayoutHeader = <T,>({table}: TableLayoutProps<T>) => {\n const {multiRowSelectionEnabled, disableRowSelection} = useTable();\n const {classes} = useStyles({disableRowSelection, multiRowSelectionEnabled});\n const headers = table.getHeaderGroups().map((headerGroup) => (\n <tr key={headerGroup.id} className={classes.headerColumns}>\n {headerGroup.headers.map((columnHeader) => (\n <Th key={columnHeader.id} header={columnHeader} />\n ))}\n </tr>\n ));\n return <>{headers}</>;\n};\n\nconst RowLayoutBody = <T,>({table, doubleClickAction, getExpandChildren, loading}: TableLayoutProps<T>) => {\n const {multiRowSelectionEnabled, disableRowSelection} = useTable();\n const {classes, cx} = useStyles({disableRowSelection, multiRowSelectionEnabled});\n\n const rows = table.getRowModel().rows.map((row) => {\n const rowChildren = getExpandChildren?.(row.original) ?? null;\n const isSelected = !!row.getIsSelected();\n\n return (\n <Fragment key={row.id}>\n <tr\n onClick={() => (disableRowSelection ? undefined : row.toggleSelected())}\n onDoubleClick={() => doubleClickAction?.(row.original)}\n className={cx(classes.row, {\n [classes.rowSelected]: isSelected,\n [classes.rowUnselectable]: disableRowSelection,\n })}\n aria-selected={isSelected}\n >\n {row.getVisibleCells().map((cell) => {\n const size = cell.column.getSize();\n const width = size !== defaultColumnSizing.size ? size : undefined;\n return (\n <td\n key={cell.id}\n style={{width}}\n className={cx({\n [classes.rowCollapsibleButtonCell]: cell.column.id === TableCollapsibleColumn.id,\n })}\n >\n <TableLoading visible={loading}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </TableLoading>\n </td>\n );\n })}\n </tr>\n {rowChildren ? (\n <tr>\n <td\n colSpan={table.getAllColumns().length}\n style={{\n padding: 0,\n borderTop: row.getIsExpanded() ? undefined : 'none',\n borderBottom: row.getIsExpanded() ? undefined : 'none',\n }}\n >\n <Collapse in={row.getIsExpanded()}>\n <Box px=\"sm\" py=\"xs\">\n {rowChildren}\n </Box>\n </Collapse>\n </td>\n </tr>\n ) : null}\n </Fragment>\n );\n });\n\n return <>{rows}</>;\n};\n\nexport const RowLayout: TableLayout = {\n name: 'Rows',\n icon: ListSize16Px,\n Header: RowLayoutHeader,\n Body: RowLayoutBody,\n};\n"],"names":["ListSize16Px","Box","Collapse","createStyles","flexRender","defaultColumnSizing","Fragment","TableCollapsibleColumn","useTable","TableLoading","Th","useStyles","theme","multiRowSelectionEnabled","disableRowSelection","rowBackgroundColor","colorScheme","fn","rgba","colors","primaryColor","headerColumns","paddingLeft","spacing","xl","backgroundColor","gray","undefined","borderColor","pointerEvents","cursor","color","rowSelected","rowUnselectable","rowCollapsibleButtonCell","textAlign","padding","xs","sm","row","RowLayoutHeader","table","classes","headers","getHeaderGroups","map","headerGroup","tr","className","columnHeader","header","id","RowLayoutBody","doubleClickAction","getExpandChildren","loading","cx","rows","getRowModel","rowChildren","original","isSelected","getIsSelected","onClick","toggleSelected","onDoubleClick","aria-selected","getVisibleCells","cell","size","column","getSize","width","td","style","visible","columnDef","getContext","colSpan","getAllColumns","length","borderTop","getIsExpanded","borderBottom","in","px","py","RowLayout","name","icon","Header","Body"],"mappings":";;AAAA,SAAQA,YAAY,QAAO,8BAA8B;AACzD,SAAQC,GAAG,EAAEC,QAAQ,EAAEC,YAAY,QAAO,gBAAgB;AAC1D,SAAQC,UAAU,QAAO,wBAAwB;AACjD,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,QAAQ,QAAO,QAAQ;AAE/B,SAAQC,sBAAsB,QAAO,4BAA4B;AACjE,SAAQC,QAAQ,QAAO,kBAAkB;AACzC,SAAQC,YAAY,QAAO,kBAAkB;AAC7C,SAAQC,EAAE,QAAO,QAAQ;AAOzB,IAAMC,YAAYR,aAAwC,SAACS;QAAQC,iCAAAA,0BAA0BC,4BAAAA;IACzF,IAAMC,qBACFH,MAAMI,gBAAgB,SAChBJ,MAAMK,GAAGC,KAAKN,MAAMO,MAAM,CAACP,MAAMQ,aAAa,CAAC,EAAE,EAAE,OACnDR,MAAMO,MAAM,CAACP,MAAMQ,aAAa,CAAC,EAAE;IAC7C,OAAO;QACHC,eAAe;YACX,0BAA0B;gBACtBC,aAAaV,MAAMW,QAAQC;YAC/B;YAEA,0BAA0B;gBACtBC,iBAAiBX,sBAAsB,AAAC,GAAuB,OAArBF,MAAMO,OAAOO,IAAI,CAAC,EAAE,IAAKC;gBACnEC,aAAad,sBAAsB,AAAC,GAAuB,OAArBF,MAAMO,OAAOO,IAAI,CAAC,EAAE,IAAK,AAAC,GAAuB,OAArBd,MAAMO,OAAOO,IAAI,CAAC,EAAE;gBACtFG,eAAef,sBAAsB,SAAS;gBAC9CgB,QAAQhB,sBAAsB,gBA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Ac5C,IAAI2C,kBAAkBvD,YAAY;wBACpD;kCAEA,cAAA,KAACzB;4BAASkF,IAAI7C,IAAI2C;sCACd,cAAA,KAACjF;gCAAIoF,IAAG;gCAAKC,IAAG;0CACX3B;;;;qBAKjB;;WA7COpB,IAAIY;IAgD3B;IAEA,qBAAO;kBAAGM;;AACd;AAEA,OAAO,IAAM8B,YAAyB;IAClCC,MAAM;IACNC,MAAMzF;IACN0F,QAAQlD;IACRmD,MAAMvC;AACV,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableLayouts.d.ts","sourceRoot":"","sources":["../../../../../src/components/table/layouts/TableLayouts.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;CAExB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/table/layouts/TableLayouts.tsx"],"sourcesContent":["import {RowLayout} from './RowLayout';\n\nexport const TableLayouts = {\n Rows: RowLayout,\n};\n"],"names":["RowLayout","TableLayouts","Rows"],"mappings":"AAAA,SAAQA,SAAS,QAAO,cAAc;AAEtC,OAAO,IAAMC,eAAe;IACxBC,MAAMF;AACV,EAAE"}
|
package/dist/esm/theme/Theme.js
CHANGED
|
@@ -329,11 +329,13 @@ export var plasmaTheme = {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
},
|
|
332
|
-
|
|
333
|
-
styles: {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
332
|
+
SegmentedControl: {
|
|
333
|
+
styles: function(theme) {
|
|
334
|
+
return {
|
|
335
|
+
root: {
|
|
336
|
+
backgroundColor: theme.colors.gray[2]
|
|
337
|
+
}
|
|
338
|
+
};
|
|
337
339
|
}
|
|
338
340
|
},
|
|
339
341
|
Stepper: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {CheckSize16Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {\n getSize,\n rem,\n type MantineThemeOverride,\n type NotificationProps,\n type StepperStylesParams,\n type TabsStylesParams,\n} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n // These are overrides over https://github.com/mantinedev/mantine/blob/master/src/mantine-styles/src/theme/default-theme.ts\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n lineHeight: 1.5,\n spacing: {\n xs: '8px',\n sm: '16px',\n md: '24px',\n lg: '32px',\n xl: '40px',\n },\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: '48px', lineHeight: undefined, fontWeight: 300},\n h2: {fontSize: '32px', lineHeight: undefined, fontWeight: 500},\n h3: {fontSize: '24px', lineHeight: undefined, fontWeight: 500},\n h4: {fontSize: '18px', lineHeight: undefined, fontWeight: 300},\n h5: {fontSize: '14px', lineHeight: undefined, fontWeight: 500},\n h6: {fontSize: '12px', lineHeight: undefined, fontWeight: 500},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: {\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em'},\n },\n },\n },\n Text: {\n defaultProps: {\n weight: 300,\n },\n styles: (theme, {}, {size}) => ({\n root: {\n fontSize: getSize({size: size ?? 'sm', sizes: theme.fontSizes}),\n },\n }),\n },\n Button: {\n styles: () => ({\n root: {\n fontWeight: 400,\n },\n }),\n variants: {\n outline: () => ({\n root: {\n backgroundColor: 'white',\n },\n }),\n },\n },\n Modal: {\n styles: (theme, {fullScreen, padding}, {size, variant}) => ({\n content: {\n flex: fullScreen\n ? '0 0 100%'\n : `0 0 ${getSize({\n size,\n sizes: {\n xs: rem(432),\n sm: rem(664),\n md: rem(896),\n lg: rem(1120),\n xl: rem('88%'),\n },\n })}`,\n overflow: 'auto',\n },\n title: {\n width: '100%',\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n fontWeight: 500,\n },\n header: {\n borderBottom: variant !== 'prompt' ? `1px solid ${color.primary.gray[3]}` : null,\n },\n body: {\n '&:not(:only-child)': {\n paddingTop: variant === 'prompt' ? 0 : getSize({size: padding, sizes: plasmaTheme.spacing}),\n },\n },\n }),\n },\n ModalOverlay: {\n defaultProps: {\n color: color.primary.navy[9],\n opacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n styles: (theme) => ({\n label: {\n marginBottom: theme.spacing.xs,\n },\n description: {\n fontSize: theme.fontSizes.sm,\n color: theme.colors.gray[7],\n marginBottom: theme.spacing.xs,\n },\n invalid: {\n color: theme.colors.red[9],\n borderColor: theme.colors.red[6],\n },\n error: {\n color: theme.colors.red[9],\n },\n }),\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n withArrow: true,\n withinPortal: true,\n multiline: true,\n zIndex: 10000,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action.6',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n styles: (theme) => ({\n label: {\n fontSize: theme.fontSizes.sm,\n fontWeight: 300,\n },\n }),\n },\n List: {\n styles: () => ({\n root: {\n listStyleType: 'disc',\n },\n }),\n },\n Radio: {\n styles: {\n labelWrapper: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n },\n },\n Popover: {\n defaultProps: {\n shadow: 'md',\n withArrow: true,\n },\n },\n Badge: {\n styles: {\n root: {\n textTransform: 'none',\n padding: '4px 8px',\n fontWeight: 500,\n },\n },\n },\n ColorSwatch: {\n defaultProps: {\n size: 8,\n withShadow: false,\n },\n },\n MenuItem: {\n defaultProps: {\n fw: 300,\n },\n },\n Notification: {\n styles: (theme, {color: notificationType}: NotificationProps) => ({\n root: {\n borderColor: theme.colors.gray[3],\n backgroundColor: theme.colors.gray[0],\n boxShadow: theme.shadows.lg,\n padding: theme.spacing.sm,\n '&[data-with-icon]': {\n paddingLeft: theme.spacing.sm,\n },\n },\n icon: {\n backgroundColor: 'transparent',\n marginRight: theme.spacing.sm,\n color: theme.colors?.[notificationType][6],\n },\n closeButton: {\n margin: theme.spacing.xs,\n color: theme.colors.gray[5],\n },\n }),\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'info',\n },\n },\n Skeleton: {\n styles: {\n visible: {\n '&::before': {zIndex: 'unset'},\n '&::after': {zIndex: 'unset'},\n },\n },\n },\n Segmented: {\n styles: {\n control: {\n zIndex: 'unset',\n },\n },\n },\n Stepper: {\n defaultProps: {\n size: 'xs',\n completedIcon: <CheckSize16Px />,\n },\n styles: (theme, {}: StepperStylesParams, {size}) => ({\n step: {\n '&[disabled]': {\n color: theme.colors.gray[5],\n '& .mantine-Stepper-stepDescription': {\n color: theme.colors.gray[5],\n },\n '& .mantine-Stepper-stepIcon': {\n borderColor: theme.colors.gray[1],\n },\n },\n },\n stepIcon: {\n fontWeight: 500,\n backgroundColor: theme.colors.gray[1],\n color: 'inherit',\n border: `${rem(1)} solid ${theme.colors.gray[3]}`,\n '&[data-progress]': {\n backgroundColor: theme.white,\n },\n\n '&[data-completed]': {\n backgroundColor: theme.white,\n borderColor: theme.colors.lime[6],\n color: theme.colors.lime[6],\n },\n },\n stepCompletedIcon: {\n color: theme.colors.lime[6],\n fontSize: rem(16),\n },\n stepDescription: {\n color: theme.colors.gray[7],\n fontSize: getSize({size, sizes: theme.fontSizes}),\n },\n separator: {\n height: rem(1),\n backgroundColor: theme.colors.gray[3],\n },\n separatorActive: {\n backgroundColor: theme.colors.gray[3],\n },\n verticalSeparator: {\n borderLeft: `${rem(1)} solid ${theme.colors.gray[3]}`,\n },\n verticalSeparatorActive: {\n borderColor: theme.colors.gray[3],\n },\n }),\n },\n Tabs: {\n styles: (theme, {orientation}: TabsStylesParams) => ({\n tabsList: {\n [orientation === 'horizontal' ? 'borderBottom' : 'borderRight']: `${rem(1)} solid ${\n theme.colors.gray[3]\n }`,\n },\n tab: {\n [orientation === 'horizontal' ? 'borderBottom' : 'borderRight']: `${rem(1)} solid transparent`,\n [orientation === 'horizontal' ? 'marginBottom' : 'marginRight']: rem(-1),\n },\n }),\n },\n },\n};\n"],"names":["CheckSize16Px","InfoSize24Px","color","getSize","rem","PlasmaColors","plasmaTheme","colorScheme","fontFamily","black","primary","gray","defaultRadius","lineHeight","spacing","xs","sm","md","lg","xl","primaryColor","headings","fontWeight","sizes","h1","fontSize","undefined","h2","h3","h4","h5","h6","shadows","colors","components","Alert","defaultProps","icon","height","styles","title","Title","root","letterSpacing","Text","weight","theme","size","fontSizes","Button","variants","outline","backgroundColor","Modal","fullScreen","padding","variant","content","flex","overflow","width","header","borderBottom","body","paddingTop","ModalOverlay","navy","opacity","InputWrapper","withAsterisk","label","marginBottom","description","invalid","red","borderColor","error","TextInput","radius","Tooltip","withArrow","withinPortal","multiline","zIndex","Loader","DateRangePicker","cell","textAlign","Anchor","fn","hover","textDecoration","action","Checkbox","List","listStyleType","Radio","labelWrapper","display","alignItems","Popover","shadow","Badge","textTransform","ColorSwatch","withShadow","MenuItem","fw","Notification","notificationType","boxShadow","paddingLeft","marginRight","closeButton","margin","Skeleton","visible","Segmented","control","Stepper","completedIcon","step","stepIcon","border","white","lime","stepCompletedIcon","stepDescription","separator","separatorActive","verticalSeparator","borderLeft","verticalSeparatorActive","Tabs","orientation","tabsList","tab"],"mappings":";;;;AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,8BAA8B;AACxE,SAAQC,KAAK,QAAO,yBAAyB;AAC7C,SACIC,OAAO,EACPC,GAAG,QAKA,gBAAgB;AAEvB,SAAQC,YAAY,QAAO,iBAAiB;AAE5C,OAAO,IAAMC,cAAoC;IAC7C,2HAA2H;IAC3HC,aAAa;IACbC,YAAY;IACZC,OAAOP,MAAMQ,QAAQC,IAAI,CAAC,EAAE;IAC5BC,eAAe;IACfC,YAAY;IACZC,SAAS;QACLC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;IACR;IACAC,cAAc;IACdC,UAAU;QACNb,YAAY;QACZc,YAAY;QACZC,OAAO;YACHC,IAAI;gBAACC,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DK,IAAI;gBAACF,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DM,IAAI;gBAACH,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DO,IAAI;gBAACJ,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DQ,IAAI;gBAACL,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;YAC7DS,IAAI;gBAACN,UAAU;gBAAQZ,YAAYa;gBAAWJ,YAAY;YAAG;QACjE;IACJ;IACAU,SAAS;QACLjB,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;IACR;IACAc,QAAQ5B;IACR6B,YAAY;QACRC,OAAO;YACHC,cAAc;gBACVC,oBAAM,KAACpC;oBAAaqC,QAAQ;;gBAC5BpC,OAAO;YAC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wBAAS;oBACnD;oBACAgF,WAAW;wBACP1F,QAAQlC,IAAI;wBACZgD,iBAAiBN,MAAMb,OAAOtB,IAAI,CAAC,EAAE;oBACzC;oBACAsH,iBAAiB;wBACb7E,iBAAiBN,MAAMb,OAAOtB,IAAI,CAAC,EAAE;oBACzC;oBACAuH,mBAAmB;wBACfC,YAAY,AAAC,GAAkBrF,OAAhB1C,IAAI,IAAG,WAA8B,OAArB0C,MAAMb,OAAOtB,IAAI,CAAC,EAAE;oBACvD;oBACAyH,yBAAyB;wBACrBzD,aAAa7B,MAAMb,OAAOtB,IAAI,CAAC,EAAE;oBACrC;gBACJ;;QACJ;QACA0H,MAAM;YACF9F,QAAQ,SAACO;oBAAQwF,oBAAAA;oBAMR;uBAN4C;oBACjDC,UACI,qBAACD,gBAAgB,eAAe,iBAAiB,eAAgB,AAAC,GAC9DxF,OADgE1C,IAAI,IAAG,WAE1E,OADG0C,MAAMb,OAAOtB,IAAI,CAAC,EAAE;oBAG5B6H,GAAG,GAAE,WACD,iBADC,MACAF,gBAAgB,eAAe,iBAAiB,eAAgB,AAAC,GAAS,OAAPlI,IAAI,IAAG,wBAC3E,iBAFC,MAEAkI,gBAAgB,eAAe,iBAAiB,eAAgBlI,IAAI,CAAC,KAFrE;gBAIT;;QACJ;IACJ;AACJ,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {CheckSize16Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {\n getSize,\n rem,\n type MantineThemeOverride,\n type NotificationProps,\n type StepperStylesParams,\n type TabsStylesParams,\n} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n // These are overrides over https://github.com/mantinedev/mantine/blob/master/src/mantine-styles/src/theme/default-theme.ts\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n lineHeight: 1.5,\n spacing: {\n xs: '8px',\n sm: '16px',\n md: '24px',\n lg: '32px',\n xl: '40px',\n },\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: '48px', lineHeight: undefined, fontWeight: 300},\n h2: {fontSize: '32px', lineHeight: undefined, fontWeight: 500},\n h3: {fontSize: '24px', lineHeight: undefined, fontWeight: 500},\n h4: {fontSize: '18px', lineHeight: undefined, fontWeight: 300},\n h5: {fontSize: '14px', lineHeight: undefined, fontWeight: 500},\n h6: {fontSize: '12px', lineHeight: undefined, fontWeight: 500},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: {\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em'},\n },\n },\n },\n Text: {\n defaultProps: {\n weight: 300,\n },\n styles: (theme, {}, {size}) => ({\n root: {\n fontSize: getSize({size: size ?? 'sm', sizes: theme.fontSizes}),\n },\n }),\n },\n Button: {\n styles: () => ({\n root: {\n fontWeight: 400,\n },\n }),\n variants: {\n outline: () => ({\n root: {\n backgroundColor: 'white',\n },\n }),\n },\n },\n Modal: {\n styles: (theme, {fullScreen, padding}, {size, variant}) => ({\n content: {\n flex: fullScreen\n ? '0 0 100%'\n : `0 0 ${getSize({\n size,\n sizes: {\n xs: rem(432),\n sm: rem(664),\n md: rem(896),\n lg: rem(1120),\n xl: rem('88%'),\n },\n })}`,\n overflow: 'auto',\n },\n title: {\n width: '100%',\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n fontWeight: 500,\n },\n header: {\n borderBottom: variant !== 'prompt' ? `1px solid ${color.primary.gray[3]}` : null,\n },\n body: {\n '&:not(:only-child)': {\n paddingTop: variant === 'prompt' ? 0 : getSize({size: padding, sizes: plasmaTheme.spacing}),\n },\n },\n }),\n },\n ModalOverlay: {\n defaultProps: {\n color: color.primary.navy[9],\n opacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n styles: (theme) => ({\n label: {\n marginBottom: theme.spacing.xs,\n },\n description: {\n fontSize: theme.fontSizes.sm,\n color: theme.colors.gray[7],\n marginBottom: theme.spacing.xs,\n },\n invalid: {\n color: theme.colors.red[9],\n borderColor: theme.colors.red[6],\n },\n error: {\n color: theme.colors.red[9],\n },\n }),\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n withArrow: true,\n withinPortal: true,\n multiline: true,\n zIndex: 10000,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action.6',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n styles: (theme) => ({\n label: {\n fontSize: theme.fontSizes.sm,\n fontWeight: 300,\n },\n }),\n },\n List: {\n styles: () => ({\n root: {\n listStyleType: 'disc',\n },\n }),\n },\n Radio: {\n styles: {\n labelWrapper: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n },\n },\n Popover: {\n defaultProps: {\n shadow: 'md',\n withArrow: true,\n },\n },\n Badge: {\n styles: {\n root: {\n textTransform: 'none',\n padding: '4px 8px',\n fontWeight: 500,\n },\n },\n },\n ColorSwatch: {\n defaultProps: {\n size: 8,\n withShadow: false,\n },\n },\n MenuItem: {\n defaultProps: {\n fw: 300,\n },\n },\n Notification: {\n styles: (theme, {color: notificationType}: NotificationProps) => ({\n root: {\n borderColor: theme.colors.gray[3],\n backgroundColor: theme.colors.gray[0],\n boxShadow: theme.shadows.lg,\n padding: theme.spacing.sm,\n '&[data-with-icon]': {\n paddingLeft: theme.spacing.sm,\n },\n },\n icon: {\n backgroundColor: 'transparent',\n marginRight: theme.spacing.sm,\n color: theme.colors?.[notificationType][6],\n },\n closeButton: {\n margin: theme.spacing.xs,\n color: theme.colors.gray[5],\n },\n }),\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'info',\n },\n },\n Skeleton: {\n styles: {\n visible: {\n '&::before': {zIndex: 'unset'},\n '&::after': {zIndex: 'unset'},\n },\n },\n },\n SegmentedControl: {\n styles: (theme) => ({\n root: {\n backgroundColor: theme.colors.gray[2],\n },\n }),\n },\n Stepper: {\n defaultProps: {\n size: 'xs',\n completedIcon: <CheckSize16Px />,\n },\n styles: (theme, {}: StepperStylesParams, {size}) => ({\n step: {\n '&[disabled]': {\n color: theme.colors.gray[5],\n '& .mantine-Stepper-stepDescription': {\n color: theme.colors.gray[5],\n },\n '& .mantine-Stepper-stepIcon': {\n borderColor: theme.colors.gray[1],\n },\n },\n },\n stepIcon: {\n fontWeight: 500,\n backgroundColor: theme.colors.gray[1],\n color: 'inherit',\n border: `${rem(1)} solid ${theme.colors.gray[3]}`,\n '&[data-progress]': {\n backgroundColor: theme.white,\n },\n\n '&[data-completed]': {\n backgroundColor: theme.white,\n borderColor: theme.colors.lime[6],\n color: theme.colors.lime[6],\n },\n },\n stepCompletedIcon: {\n color: theme.colors.lime[6],\n fontSize: rem(16),\n },\n stepDescription: {\n color: theme.colors.gray[7],\n fontSize: getSize({size, sizes: theme.fontSizes}),\n },\n separator: {\n height: rem(1),\n backgroundColor: theme.colors.gray[3],\n },\n separatorActive: {\n backgroundColor: theme.colors.gray[3],\n },\n verticalSeparator: {\n borderLeft: `${rem(1)} solid ${theme.colors.gray[3]}`,\n },\n verticalSeparatorActive: {\n borderColor: theme.colors.gray[3],\n },\n }),\n },\n Tabs: {\n styles: (theme, {orientation}: TabsStylesParams) => ({\n tabsList: {\n [orientation === 'horizontal' ? 'borderBottom' : 'borderRight']: `${rem(1)} solid ${\n theme.colors.gray[3]\n }`,\n },\n tab: {\n [orientation === 'horizontal' ? 'borderBottom' : 'borderRight']: `${rem(1)} solid transparent`,\n [orientation === 'horizontal' ? 'marginBottom' : 'marginRight']: rem(-1),\n },\n }),\n },\n },\n};\n"],"names":["CheckSize16Px","InfoSize24Px","color","getSize","rem","PlasmaColors","plasmaTheme","colorScheme","fontFamily","black","primary","gray","defaultRadius","lineHeight","spacing","xs","sm","md","lg","xl","primaryColor","headings","fontWeight","sizes","h1","fontSize","undefined","h2","h3","h4","h5","h6","shadows","colors","components","Alert","defaultProps","icon","height","styles","title","Title","root","letterSpacing","Text","weight","theme","size","fontSizes","Button","variants","outline","backgroundColor","Modal","fullScreen","padding","variant","content","flex","overflow","width","header","borderBottom","body","paddingTop","ModalOverlay","navy","opacity","InputWrapper","withAsterisk","label","marginBottom","description","invalid","red","borderColor","error","TextInput","radius","Tooltip","withArrow","withinPortal","multiline","zIndex","Loader","DateRangePicker","cell","textAlign","Anchor","fn","hover","textDecoration","action","Checkbox","List","listStyleType","Radio","labelWrapper","display","alignItems","Popover","shadow","Badge","textTransform","ColorSwatch","withShadow","MenuItem","fw","Notification","notificationType","boxShadow","paddingLeft","marginRight","closeButton","margin","Skeleton","visible","SegmentedControl","Stepper","completedIcon","step","stepIcon","border","white","lime","stepCompletedIcon","stepDescription","separator","separatorActive","verticalSeparator","borderLeft","verticalSeparatorActive","Tabs","orientation","tabsList","tab"],"mappings":";;;;AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,8BAA8B;AACxE,SAAQC,KAAK,QAAO,yBAAyB;AAC7C,SACIC,OAAO,EACPC,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AI,IAAG,WAA8B,OAArB0C,MAAMb,OAAOtB,IAAI,CAAC,EAAE;oBACvD;oBACAwH,yBAAyB;wBACrBxD,aAAa7B,MAAMb,OAAOtB,IAAI,CAAC,EAAE;oBACrC;gBACJ;;QACJ;QACAyH,MAAM;YACF7F,QAAQ,SAACO;oBAAQuF,oBAAAA;oBAMR;uBAN4C;oBACjDC,UACI,qBAACD,gBAAgB,eAAe,iBAAiB,eAAgB,AAAC,GAC9DvF,OADgE1C,IAAI,IAAG,WAE1E,OADG0C,MAAMb,OAAOtB,IAAI,CAAC,EAAE;oBAG5B4H,GAAG,GAAE,WACD,iBADC,MACAF,gBAAgB,eAAe,iBAAiB,eAAgB,AAAC,GAAS,OAAPjI,IAAI,IAAG,wBAC3E,iBAFC,MAEAiI,gBAAgB,eAAe,iBAAiB,eAAgBjI,IAAI,CAAC,KAFrE;gBAIT;;QACJ;IACJ;AACJ,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coveord/plasma-mantine",
|
|
3
|
-
"version": "52.
|
|
3
|
+
"version": "52.7.1",
|
|
4
4
|
"description": "A Plasma flavoured Mantine theme",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plasma",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"lodash.debounce": "4.0.8",
|
|
42
42
|
"lodash.defaultsdeep": "4.6.1",
|
|
43
43
|
"monaco-editor": "0.38.0",
|
|
44
|
-
"@coveord/plasma-react-icons": "52.
|
|
45
|
-
"@coveord/plasma-tokens": "52.
|
|
44
|
+
"@coveord/plasma-react-icons": "52.7.0",
|
|
45
|
+
"@coveord/plasma-tokens": "52.7.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@emotion/react": "11.11.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@mantine/modals": "6.0.11",
|
|
55
55
|
"@mantine/notifications": "6.0.11",
|
|
56
56
|
"@swc/cli": "0.1.62",
|
|
57
|
-
"@swc/core": "1.3.
|
|
57
|
+
"@swc/core": "1.3.60",
|
|
58
58
|
"@swc/jest": "0.2.26",
|
|
59
59
|
"@testing-library/jest-dom": "5.16.5",
|
|
60
60
|
"@testing-library/react": "13.4.0",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"react-dom": "18.2.0",
|
|
81
81
|
"rimraf": "3.0.2",
|
|
82
82
|
"tslib": "2.5.2",
|
|
83
|
-
"typescript": "5.0.
|
|
84
|
-
"vitest": "0.31.
|
|
83
|
+
"typescript": "5.0.4",
|
|
84
|
+
"vitest": "0.31.1"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@emotion/react": "^11.10.0",
|
|
@@ -1,99 +1,44 @@
|
|
|
1
1
|
import {createStyles} from '@mantine/core';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const useStyles = createStyles<string, TableStylesParams>((theme, {multiRowSelectionEnabled, disableRowSelection}) => {
|
|
9
|
-
const rowBackgroundColor =
|
|
10
|
-
theme.colorScheme === 'dark'
|
|
11
|
-
? theme.fn.rgba(theme.colors[theme.primaryColor][7], 0.2)
|
|
12
|
-
: theme.colors[theme.primaryColor][0];
|
|
13
|
-
return {
|
|
14
|
-
table: {
|
|
15
|
-
width: '100%',
|
|
16
|
-
'& thead tr th': {
|
|
17
|
-
borderBottom: 'none',
|
|
18
|
-
},
|
|
19
|
-
'& td:first-of-type': {
|
|
20
|
-
paddingLeft: theme.spacing.xl,
|
|
21
|
-
},
|
|
22
|
-
'& tbody td': {
|
|
23
|
-
verticalAlign: 'top',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
header: {
|
|
28
|
-
position: 'sticky',
|
|
29
|
-
top: 0,
|
|
30
|
-
backgroundColor: theme.colorScheme === 'dark' ? theme.black : theme.white,
|
|
31
|
-
transition: 'box-shadow 150ms ease',
|
|
32
|
-
zIndex: 1,
|
|
33
|
-
|
|
34
|
-
'&::after': {
|
|
35
|
-
content: '""',
|
|
36
|
-
position: 'absolute',
|
|
37
|
-
left: 0,
|
|
38
|
-
right: 0,
|
|
39
|
-
bottom: 0,
|
|
40
|
-
borderBottom: `1px solid ${theme.colors.gray[3]}`,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
headerColumns: {
|
|
45
|
-
'& th:first-of-type > *': {
|
|
46
|
-
paddingLeft: theme.spacing.xl,
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
'& input[type=checkbox]': {
|
|
50
|
-
backgroundColor: disableRowSelection ? `${theme.colors.gray[2]}` : undefined,
|
|
51
|
-
borderColor: disableRowSelection ? `${theme.colors.gray[3]}` : `${theme.colors.gray[4]}`,
|
|
52
|
-
pointerEvents: disableRowSelection ? 'none' : 'auto',
|
|
53
|
-
cursor: disableRowSelection ? 'not-allowed' : 'default',
|
|
54
|
-
|
|
55
|
-
'& + svg': {
|
|
56
|
-
color: disableRowSelection ? `${theme.colors.gray[5]}` : 'inherit',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
3
|
+
const useStyles = createStyles<string>((theme) => ({
|
|
4
|
+
table: {
|
|
5
|
+
width: '100%',
|
|
6
|
+
'& thead tr th': {
|
|
7
|
+
borderBottom: 'none',
|
|
59
8
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
backgroundColor: multiRowSelectionEnabled ? undefined : rowBackgroundColor,
|
|
9
|
+
'& td:first-of-type': {
|
|
10
|
+
paddingLeft: theme.spacing.xl,
|
|
63
11
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'& input[type=checkbox]': {
|
|
67
|
-
backgroundColor: `${theme.colors.gray[2]}`,
|
|
68
|
-
borderColor: `${theme.colors.gray[3]}`,
|
|
69
|
-
pointerEvents: 'none',
|
|
70
|
-
cursor: 'not-allowed',
|
|
71
|
-
|
|
72
|
-
'&:checked + svg': {
|
|
73
|
-
color: `${theme.colors.gray[5]}`,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
12
|
+
'& tbody td': {
|
|
13
|
+
verticalAlign: 'top',
|
|
76
14
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
header: {
|
|
18
|
+
position: 'sticky',
|
|
19
|
+
top: 0,
|
|
20
|
+
backgroundColor: theme.colorScheme === 'dark' ? theme.black : theme.white,
|
|
21
|
+
transition: 'box-shadow 150ms ease',
|
|
22
|
+
zIndex: 1,
|
|
23
|
+
|
|
24
|
+
'&::after': {
|
|
25
|
+
content: '""',
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
left: 0,
|
|
28
|
+
right: 0,
|
|
29
|
+
bottom: 0,
|
|
30
|
+
borderBottom: `1px solid ${theme.colors.gray[3]}`,
|
|
87
31
|
},
|
|
88
|
-
}
|
|
89
|
-
});
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
90
34
|
|
|
91
35
|
export const TableComponentsOrder = {
|
|
92
|
-
MultiSelectInfo:
|
|
93
|
-
Actions:
|
|
94
|
-
Predicate:
|
|
95
|
-
Filter:
|
|
96
|
-
DateRangePicker:
|
|
36
|
+
MultiSelectInfo: 6,
|
|
37
|
+
Actions: 5,
|
|
38
|
+
Predicate: 4,
|
|
39
|
+
Filter: 3,
|
|
40
|
+
DateRangePicker: 2,
|
|
41
|
+
LayoutControl: 1,
|
|
97
42
|
};
|
|
98
43
|
|
|
99
44
|
export default useStyles;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import {Box, Center,
|
|
1
|
+
import {Box, Center, Loader, Table as MantineTable} from '@mantine/core';
|
|
2
2
|
import {useForm} from '@mantine/form';
|
|
3
3
|
import {useDidUpdate} from '@mantine/hooks';
|
|
4
|
-
import {
|
|
5
|
-
ColumnDef,
|
|
6
|
-
Row,
|
|
7
|
-
TableState as TanstackTableState,
|
|
8
|
-
defaultColumnSizing,
|
|
9
|
-
flexRender,
|
|
10
|
-
getCoreRowModel,
|
|
11
|
-
useReactTable,
|
|
12
|
-
} from '@tanstack/react-table';
|
|
4
|
+
import {ColumnDef, Row, TableState as TanstackTableState, getCoreRowModel, useReactTable} from '@tanstack/react-table';
|
|
13
5
|
import debounce from 'lodash.debounce';
|
|
14
6
|
import defaultsDeep from 'lodash.defaultsdeep';
|
|
15
|
-
import {Children, Dispatch,
|
|
7
|
+
import {Children, Dispatch, ReactElement, useCallback, useEffect, useState} from 'react';
|
|
16
8
|
|
|
17
9
|
import useStyles from './Table.styles';
|
|
18
10
|
import {TableFormType, TableProps, TableState, TableType} from './Table.types';
|
|
@@ -28,14 +20,9 @@ import {TablePagination} from './TablePagination';
|
|
|
28
20
|
import {TablePerPage} from './TablePerPage';
|
|
29
21
|
import {TablePredicate} from './TablePredicate';
|
|
30
22
|
import {TableSelectableColumn} from './TableSelectableColumn';
|
|
31
|
-
import {Th} from './Th';
|
|
32
23
|
import {useRowSelection} from './useRowSelection';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<Skeleton style={{display: 'inline-block'}} {...props} sx={!props.visible ? {borderRadius: 0} : undefined}>
|
|
36
|
-
{props.children}
|
|
37
|
-
</Skeleton>
|
|
38
|
-
);
|
|
24
|
+
import {TableLoading} from './TableLoading';
|
|
25
|
+
import {TableLayouts} from './layouts/TableLayouts';
|
|
39
26
|
|
|
40
27
|
export const Table: TableType = <T,>({
|
|
41
28
|
data,
|
|
@@ -44,6 +31,7 @@ export const Table: TableType = <T,>({
|
|
|
44
31
|
getExpandChildren,
|
|
45
32
|
initialState = {},
|
|
46
33
|
columns,
|
|
34
|
+
layouts = [TableLayouts.Rows],
|
|
47
35
|
onMount,
|
|
48
36
|
onChange,
|
|
49
37
|
children,
|
|
@@ -61,9 +49,13 @@ export const Table: TableType = <T,>({
|
|
|
61
49
|
|
|
62
50
|
const {predicates, dateRange, ...initialStateWithoutForm} = initialState;
|
|
63
51
|
const form = useForm<TableFormType>({
|
|
64
|
-
initialValues: {
|
|
52
|
+
initialValues: {
|
|
53
|
+
predicates: initialState?.predicates ?? {},
|
|
54
|
+
dateRange: initialState?.dateRange ?? [null, null],
|
|
55
|
+
layout: initialState?.layout ?? layouts[0].name,
|
|
56
|
+
},
|
|
65
57
|
});
|
|
66
|
-
const {
|
|
58
|
+
const {classes} = useStyles();
|
|
67
59
|
|
|
68
60
|
const table = useReactTable({
|
|
69
61
|
initialState: defaultsDeep(initialStateWithoutForm, {pagination: {pageSize: TablePerPage.DEFAULT_SIZE}}),
|
|
@@ -108,7 +100,13 @@ export const Table: TableType = <T,>({
|
|
|
108
100
|
if (!multiRowSelectionEnabled) {
|
|
109
101
|
clearSelection();
|
|
110
102
|
}
|
|
111
|
-
}, [
|
|
103
|
+
}, [
|
|
104
|
+
state.globalFilter,
|
|
105
|
+
state.pagination,
|
|
106
|
+
state.sorting,
|
|
107
|
+
JSON.stringify(form.values.dateRange),
|
|
108
|
+
JSON.stringify(form.values.predicates),
|
|
109
|
+
]);
|
|
112
110
|
|
|
113
111
|
const clearFilters = useCallback(() => {
|
|
114
112
|
form.setFieldValue('predicates', initialState.predicates ?? {});
|
|
@@ -123,60 +121,8 @@ export const Table: TableType = <T,>({
|
|
|
123
121
|
);
|
|
124
122
|
}
|
|
125
123
|
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
const isSelected = !!row.getIsSelected();
|
|
129
|
-
|
|
130
|
-
return (
|
|
131
|
-
<Fragment key={row.id}>
|
|
132
|
-
<tr
|
|
133
|
-
onClick={() => (disableRowSelection ? undefined : row.toggleSelected())}
|
|
134
|
-
onDoubleClick={() => doubleClickAction?.(row.original)}
|
|
135
|
-
className={cx(classes.row, {
|
|
136
|
-
[classes.rowSelected]: isSelected,
|
|
137
|
-
[classes.rowUnselectable]: disableRowSelection,
|
|
138
|
-
})}
|
|
139
|
-
aria-selected={isSelected}
|
|
140
|
-
>
|
|
141
|
-
{row.getVisibleCells().map((cell) => {
|
|
142
|
-
const size = cell.column.getSize();
|
|
143
|
-
const width = size !== defaultColumnSizing.size ? size : undefined;
|
|
144
|
-
return (
|
|
145
|
-
<td
|
|
146
|
-
key={cell.id}
|
|
147
|
-
style={{width}}
|
|
148
|
-
className={cx({
|
|
149
|
-
[classes.rowCollapsibleButtonCell]: cell.column.id === TableCollapsibleColumn.id,
|
|
150
|
-
})}
|
|
151
|
-
>
|
|
152
|
-
<LoadingSkeleton visible={loading}>
|
|
153
|
-
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
154
|
-
</LoadingSkeleton>
|
|
155
|
-
</td>
|
|
156
|
-
);
|
|
157
|
-
})}
|
|
158
|
-
</tr>
|
|
159
|
-
{rowChildren ? (
|
|
160
|
-
<tr>
|
|
161
|
-
<td
|
|
162
|
-
colSpan={table.getAllColumns().length}
|
|
163
|
-
style={{
|
|
164
|
-
padding: 0,
|
|
165
|
-
borderTop: row.getIsExpanded() ? undefined : 'none',
|
|
166
|
-
borderBottom: row.getIsExpanded() ? undefined : 'none',
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
<Collapse in={row.getIsExpanded()}>
|
|
170
|
-
<Box px="sm" py="xs">
|
|
171
|
-
{rowChildren}
|
|
172
|
-
</Box>
|
|
173
|
-
</Collapse>
|
|
174
|
-
</td>
|
|
175
|
-
</tr>
|
|
176
|
-
) : null}
|
|
177
|
-
</Fragment>
|
|
178
|
-
);
|
|
179
|
-
});
|
|
124
|
+
const Layout = layouts.find(({name}) => name === form.values.layout);
|
|
125
|
+
const hasRows = table.getRowModel().rows.length > 0;
|
|
180
126
|
|
|
181
127
|
return (
|
|
182
128
|
<Box ref={outsideClickRef}>
|
|
@@ -195,10 +141,11 @@ export const Table: TableType = <T,>({
|
|
|
195
141
|
multiRowSelectionEnabled,
|
|
196
142
|
getPageCount: table.getPageCount,
|
|
197
143
|
disableRowSelection,
|
|
144
|
+
layouts,
|
|
198
145
|
}}
|
|
199
146
|
>
|
|
200
147
|
{consumer}
|
|
201
|
-
{!
|
|
148
|
+
{!hasRows && !isFiltered && !loading ? (
|
|
202
149
|
noDataChildren
|
|
203
150
|
) : (
|
|
204
151
|
<>
|
|
@@ -215,21 +162,25 @@ export const Table: TableType = <T,>({
|
|
|
215
162
|
</th>
|
|
216
163
|
</tr>
|
|
217
164
|
) : null}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
))}
|
|
165
|
+
<Layout.Header
|
|
166
|
+
table={table}
|
|
167
|
+
doubleClickAction={doubleClickAction}
|
|
168
|
+
getExpandChildren={getExpandChildren}
|
|
169
|
+
loading={loading}
|
|
170
|
+
/>
|
|
225
171
|
</thead>
|
|
226
172
|
<tbody>
|
|
227
|
-
{
|
|
228
|
-
|
|
173
|
+
{hasRows ? (
|
|
174
|
+
<Layout.Body
|
|
175
|
+
table={table}
|
|
176
|
+
doubleClickAction={doubleClickAction}
|
|
177
|
+
getExpandChildren={getExpandChildren}
|
|
178
|
+
loading={loading}
|
|
179
|
+
/>
|
|
229
180
|
) : (
|
|
230
181
|
<tr>
|
|
231
182
|
<td colSpan={table.getAllColumns().length}>
|
|
232
|
-
<
|
|
183
|
+
<TableLoading visible={loading}>{noDataChildren}</TableLoading>
|
|
233
184
|
</td>
|
|
234
185
|
</tr>
|
|
235
186
|
)}
|
|
@@ -255,3 +206,5 @@ Table.CollapsibleColumn = TableCollapsibleColumn;
|
|
|
255
206
|
Table.AccordionColumn = TableAccordionColumn;
|
|
256
207
|
Table.DateRangePicker = TableDateRangePicker;
|
|
257
208
|
Table.Consumer = TableConsumer;
|
|
209
|
+
Table.Loading = TableLoading;
|
|
210
|
+
Table.Layouts = TableLayouts;
|
|
@@ -2,12 +2,14 @@ import {UseFormReturnType} from '@mantine/form';
|
|
|
2
2
|
import {
|
|
3
3
|
ColumnDef,
|
|
4
4
|
CoreOptions,
|
|
5
|
+
Table,
|
|
5
6
|
TableOptions,
|
|
6
7
|
InitialTableState as TanstackInitialTableState,
|
|
7
8
|
TableState as TanstackTableState,
|
|
8
9
|
} from '@tanstack/table-core';
|
|
9
10
|
import {Dispatch, ReactElement, ReactNode, RefObject} from 'react';
|
|
10
11
|
|
|
12
|
+
import {Icon} from '@coveord/plasma-react-icons';
|
|
11
13
|
import {DateRangePickerValue} from '../date-range-picker/DateRangePickerInlineCalendar';
|
|
12
14
|
import {TableActions} from './TableActions';
|
|
13
15
|
import {TableAccordionColumn, TableCollapsibleColumn} from './TableCollapsibleColumn';
|
|
@@ -16,9 +18,11 @@ import {TableDateRangePicker} from './TableDateRangePicker';
|
|
|
16
18
|
import {TableFilter} from './TableFilter';
|
|
17
19
|
import {TableFooter} from './TableFooter';
|
|
18
20
|
import {TableHeader} from './TableHeader';
|
|
21
|
+
import {TableLoading} from './TableLoading';
|
|
19
22
|
import {TablePagination} from './TablePagination';
|
|
20
23
|
import {TablePerPage} from './TablePerPage';
|
|
21
24
|
import {TablePredicate} from './TablePredicate';
|
|
25
|
+
import {TableLayouts} from './layouts/TableLayouts';
|
|
22
26
|
|
|
23
27
|
export type RowSelectionWithData<TData> = Record<string, TData>;
|
|
24
28
|
export interface RowSelectionState<TData> {
|
|
@@ -34,6 +38,45 @@ export interface InitialTableState<TData>
|
|
|
34
38
|
|
|
35
39
|
export type onTableChangeEvent<TData> = (params: TableState<TData> & TableFormType) => void;
|
|
36
40
|
|
|
41
|
+
export interface TableLayout {
|
|
42
|
+
/**
|
|
43
|
+
* Name of the layout.
|
|
44
|
+
* Will be displayed in the layout control
|
|
45
|
+
*/
|
|
46
|
+
name: string;
|
|
47
|
+
/**
|
|
48
|
+
* Icon illustrating the layout.
|
|
49
|
+
* Will be displayed in the layout control
|
|
50
|
+
*/
|
|
51
|
+
icon?: Icon;
|
|
52
|
+
/**
|
|
53
|
+
* Header portion of the table.
|
|
54
|
+
* In the standard row layout that is where column headers would be displayed.
|
|
55
|
+
*/
|
|
56
|
+
Header: <T>(props: TableLayoutProps<T>) => ReactElement;
|
|
57
|
+
/**
|
|
58
|
+
* Body portion of the table.
|
|
59
|
+
* In the standard row layout that is where the rows would be displayed.
|
|
60
|
+
*/
|
|
61
|
+
Body: <T>(props: TableLayoutProps<T>) => ReactElement;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface TableLayoutProps<T = unknown> {
|
|
65
|
+
table: Table<T>;
|
|
66
|
+
loading?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Action passed when user double clicks on a row
|
|
69
|
+
*/
|
|
70
|
+
doubleClickAction?: (datum: T) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Function that generates the expandable content of a row
|
|
73
|
+
* Return null for rows that don't need to be expandable
|
|
74
|
+
*
|
|
75
|
+
* @param datum the row for which the children should be generated.
|
|
76
|
+
*/
|
|
77
|
+
getExpandChildren?: (datum: T) => ReactNode;
|
|
78
|
+
}
|
|
79
|
+
|
|
37
80
|
export type TableFormType = {
|
|
38
81
|
/**
|
|
39
82
|
* Object containing the table predicates and their selected values
|
|
@@ -47,6 +90,10 @@ export type TableFormType = {
|
|
|
47
90
|
* @example [new Date(2022, 0, 1), new Date(2022, 0, 31)]
|
|
48
91
|
*/
|
|
49
92
|
dateRange: DateRangePickerValue;
|
|
93
|
+
/**
|
|
94
|
+
* Selected layout name
|
|
95
|
+
*/
|
|
96
|
+
layout: TableLayout['name'];
|
|
50
97
|
};
|
|
51
98
|
|
|
52
99
|
export type TableContextType<TData> = {
|
|
@@ -105,6 +152,10 @@ export type TableContextType<TData> = {
|
|
|
105
152
|
* Function that returns the number of pages
|
|
106
153
|
*/
|
|
107
154
|
getPageCount: () => number;
|
|
155
|
+
/**
|
|
156
|
+
* Available layouts. When more than one layout is provided, it will display a layout control to switch between them.
|
|
157
|
+
*/
|
|
158
|
+
layouts: TableLayout[];
|
|
108
159
|
};
|
|
109
160
|
|
|
110
161
|
export interface TableProps<T> {
|
|
@@ -122,6 +173,12 @@ export interface TableProps<T> {
|
|
|
122
173
|
* @see https://tanstack.com/table/v8/docs/guide/column-defs
|
|
123
174
|
*/
|
|
124
175
|
columns: Array<ColumnDef<T>>;
|
|
176
|
+
/**
|
|
177
|
+
* Available layouts
|
|
178
|
+
*
|
|
179
|
+
* @default [Table.Layouts.Rows]
|
|
180
|
+
*/
|
|
181
|
+
layouts?: TableLayout[];
|
|
125
182
|
/**
|
|
126
183
|
* Function called when the table mounts
|
|
127
184
|
*
|
|
@@ -218,4 +275,6 @@ export interface TableType {
|
|
|
218
275
|
CollapsibleColumn: typeof TableCollapsibleColumn;
|
|
219
276
|
AccordionColumn: typeof TableAccordionColumn;
|
|
220
277
|
Consumer: typeof TableConsumer;
|
|
278
|
+
Loading: typeof TableLoading;
|
|
279
|
+
Layouts: typeof TableLayouts;
|
|
221
280
|
}
|