diff --git a/packages/mantine-react-table/src/buttons/MRT_ExpandAllButton.module.css b/packages/mantine-react-table/src/buttons/MRT_ExpandAllButton.module.css index 248c7858f..21a7abd70 100644 --- a/packages/mantine-react-table/src/buttons/MRT_ExpandAllButton.module.css +++ b/packages/mantine-react-table/src/buttons/MRT_ExpandAllButton.module.css @@ -8,10 +8,10 @@ &:hover { opacity: 1; } - &.xl { + &:global(.xl) { margin-left: -6px; } - &.md { + &:global(.md) { margin-left: 0; } .chevron { diff --git a/packages/mantine-react-table/src/head/MRT_TableHeadCellResizeHandle.module.css b/packages/mantine-react-table/src/head/MRT_TableHeadCellResizeHandle.module.css index 60251fe78..aa77d9bcc 100644 --- a/packages/mantine-react-table/src/head/MRT_TableHeadCellResizeHandle.module.css +++ b/packages/mantine-react-table/src/head/MRT_TableHeadCellResizeHandle.module.css @@ -1,22 +1,23 @@ -.MRT_TableHeadCellResizeHandle { +.root { cursor: col-resize; - margin-right: var(--margin-right); position: absolute; - right: 4px; - padding-left: 1px; - padding-right: 2px; - transform: var(--transform); - &:active > .mantine-Divider-vertical { - border-left-color: var(--mantine-color-default); - } -} - -.MRT_TableHeadCellResizeHandleDivider { border-radius: 2px; - border-width: 4px; + right: 0px; + width: 3px; height: 24px; - touch-action: none; - transition: var(--transition); - user-select: none; - z-index: 4; + margin-right: -10px; + &:global(.md) { + margin-right: -16px; + } + &:global(.xl) { + margin-right: -22px; + } + background: var(--mantine-color-placeholder); + &:hover { + background: var(--mantine-primary-color-filled-hover); + } + &:active { + background: var(--mantine-primary-color-filled); + } + transform: var(--mrt-transform); } diff --git a/packages/mantine-react-table/src/head/MRT_TableHeadCellResizeHandle.tsx b/packages/mantine-react-table/src/head/MRT_TableHeadCellResizeHandle.tsx index 5b3a2bc93..bc263943c 100644 --- a/packages/mantine-react-table/src/head/MRT_TableHeadCellResizeHandle.tsx +++ b/packages/mantine-react-table/src/head/MRT_TableHeadCellResizeHandle.tsx @@ -1,4 +1,5 @@ -import { Box, Divider } from '@mantine/core'; +import clsx from 'clsx'; +import { Box } from '@mantine/core'; import { type MRT_Header, type MRT_TableInstance } from '../types'; import classes from './MRT_TableHeadCellResizeHandle.module.css'; @@ -21,9 +22,18 @@ export const MRT_TableHeadCellResizeHandle = < } = table; const { density } = getState(); const { column } = header; + const handler = header.getResizeHandler(); + + const offset = + columnResizeMode === 'onEnd' && column.getIsResizing() + ? `translateX(${getState().columnSizingInfo.deltaOffset ?? 0}px)` + : undefined; return ( { setColumnSizingInfo((old) => ({ ...old, @@ -31,32 +41,12 @@ export const MRT_TableHeadCellResizeHandle = < })); column.resetSize(); }} - onMouseDown={header.getResizeHandler()} - onTouchStart={header.getResizeHandler()} - className={classes.MRT_TableHeadCellResizeHandle} - __vars={{ - '--margin-right': - density === 'xl' - ? 'rem(-24px)' - : density === 'md' - ? 'rem(-20px)' - : 'rem(-14px)', - '--transform': - column.getIsResizing() && columnResizeMode === 'onEnd' - ? `translateX(${getState().columnSizingInfo.deltaOffset ?? 0}px)` - : undefined, - }} - > - - + className={clsx( + 'mrt-table-head-cell-resize-handle', + classes.root, + density, + )} + __vars={{ '--mrt-transform': offset }} + > ); }; diff --git a/packages/mantine-react-table/src/toolbar/MRT_ToolbarAlertBanner.module.css b/packages/mantine-react-table/src/toolbar/MRT_ToolbarAlertBanner.module.css index 71d7ed5eb..86c235fab 100644 --- a/packages/mantine-react-table/src/toolbar/MRT_ToolbarAlertBanner.module.css +++ b/packages/mantine-react-table/src/toolbar/MRT_ToolbarAlertBanner.module.css @@ -27,10 +27,10 @@ padding: 8px 16px; &.head-overlay { padding: 2px; - &.xl { + &:global(.xl) { padding: 16px; } - &.md { + &:global(.md) { padding: 8px; } }