From bc24209ae219ed3f3fa0c406993d9a1062e75ad8 Mon Sep 17 00:00:00 2001 From: Alessandro Cuppari Date: Wed, 27 Sep 2023 17:11:55 +0100 Subject: [PATCH 1/2] fix comment style on columns.util --- packages/mantine-react-table/src/columns.utils.module.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mantine-react-table/src/columns.utils.module.css b/packages/mantine-react-table/src/columns.utils.module.css index e0ee6d3f0..b3e91a1dc 100644 --- a/packages/mantine-react-table/src/columns.utils.module.css +++ b/packages/mantine-react-table/src/columns.utils.module.css @@ -3,7 +3,7 @@ --width: calc(var(--header-id) * 1px); --bg-color: color-mix(in srgb, var(--mantine-color-dark-7) .2%, var(--mantine-color-black)); background-color: inherit; - // Not very sure about these attribute gymnastics... + /* Not very sure about these attribute gymnastics... */ [data-selected="true"] { background-color: rgba(var(--mantine-primary-color-filled), 0.1); } From bd54261b8a38fe52af3b61f4d419ac5631ac6213 Mon Sep 17 00:00:00 2001 From: Alessandro Cuppari Date: Wed, 27 Sep 2023 17:44:30 +0100 Subject: [PATCH 2/2] fix: re-add getprimarycolor and getprimaryshade utilities --- packages/mantine-react-table/src/column.utils.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/mantine-react-table/src/column.utils.ts b/packages/mantine-react-table/src/column.utils.ts index c9954024c..cb2a464db 100644 --- a/packages/mantine-react-table/src/column.utils.ts +++ b/packages/mantine-react-table/src/column.utils.ts @@ -15,6 +15,7 @@ import { type MantineTheme, } from '@mantine/core'; import { + type MantineShade, type MRT_Column, type MRT_ColumnDef, type MRT_ColumnOrderState, @@ -390,6 +391,17 @@ export const MRT_DefaultDisplayColumn = { export const parseCSSVarId = (id: string) => id.replace(/[^a-zA-Z0-9]/g, '_'); +export const getPrimaryShade = (theme: MantineTheme): number => + (theme.colorScheme === 'dark' + ? // @ts-ignore + theme.primaryShade?.dark ?? theme.primaryShade + : // @ts-ignore + theme.primaryShade?.light ?? theme.primaryShade) ?? 7; + +export const getPrimaryColor = ( + theme: MantineTheme, + shade?: MantineShade, +): string => theme.colors[theme.primaryColor][shade ?? getPrimaryShade(theme)]; export const flexRender = _flexRender as ( Comp: Renderable, props: any,