Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit f3d7971

Browse files
committed
feat: add wrapper class table
1 parent 26340b7 commit f3d7971

File tree

5 files changed

+34
-19
lines changed

5 files changed

+34
-19
lines changed

.changeset/clean-bottles-relate.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/ui/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @codefixlabs/ui
22

3+
## 0.1.58
4+
5+
### Patch Changes
6+
7+
- Add wrapper class table
8+
39
## 0.1.57
410

511
### Patch Changes

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codefixlabs/ui",
3-
"version": "0.1.57",
3+
"version": "0.1.58",
44
"license": "MIT",
55
"sideEffects": false,
66
"exports": {

packages/ui/src/react/data-table.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,21 +474,22 @@ export function DataTablePagination<TData>({
474474
* -------------------------------------------------------------------------- */
475475

476476
interface TableClassNames {
477-
root?: string;
477+
body?: string;
478+
cell?: string;
478479
container?: string;
479-
table?: string;
480-
header?: string;
481-
headerRow?: string;
480+
emptyCell?: string;
481+
emptyRow?: string;
482482
footer?: string;
483483
footerRow?: string;
484+
header?: string;
484485
headerCell?: string;
485-
body?: string;
486+
headerRow?: string;
487+
pagination?: string;
488+
root?: string;
486489
row?: string;
487-
cell?: string;
488-
emptyRow?: string;
489-
emptyCell?: string;
490+
table?: string;
490491
toolbar?: string;
491-
pagination?: string;
492+
wrapper?: string;
492493
}
493494

494495
export function DataTableContent<TData, TValue>({
@@ -510,7 +511,13 @@ export function DataTableContent<TData, TValue>({
510511
)}
511512
data-test-id="container"
512513
>
513-
<Table className={classNames.table} data-test-id="table">
514+
<Table
515+
className={classNames.table}
516+
classNames={{
517+
wrapper: classNames.wrapper,
518+
}}
519+
data-test-id="table"
520+
>
514521
<TableHeader className={classNames.header} data-test-id="header">
515522
{table.getHeaderGroups().map((headerGroup) => (
516523
<TableRow

packages/ui/src/react/table.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ import { twMerge } from 'tailwind-merge';
88

99
export const Table = forwardRef<
1010
React.ElementRef<'table'>,
11-
React.ComponentPropsWithoutRef<'table'>
12-
>(({ className, ...props }, forwardedRef) => (
13-
<div className="w-full overflow-auto">
11+
React.ComponentPropsWithoutRef<'table'> & {
12+
classNames?: {
13+
wrapper?: string;
14+
};
15+
}
16+
>(({ className, classNames, ...props }, forwardedRef) => (
17+
<div
18+
className={twMerge('w-full overflow-auto', classNames?.wrapper)}
19+
data-test-id="wrapper"
20+
>
1421
<table
1522
className={twMerge('w-full caption-bottom text-sm', className)}
1623
ref={forwardedRef}

0 commit comments

Comments
 (0)