@rentnerkev/table 0.0.0-stage → 0.0.2
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/LICENSE +21 -0
- package/README.md +161 -2
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/Messages/tableMessages.d.ts +4 -0
- package/dist/lib/Messages/tableMessages.d.ts.map +1 -0
- package/dist/lib/Messages/tableMessages.js +101 -0
- package/dist/lib/Messages/tableMessages.js.map +1 -0
- package/dist/lib/Table/events.d.ts +2 -0
- package/dist/lib/Table/events.d.ts.map +1 -0
- package/dist/lib/Table/events.js +5 -0
- package/dist/lib/Table/events.js.map +1 -0
- package/dist/lib/Table/filters.d.ts +20 -0
- package/dist/lib/Table/filters.d.ts.map +1 -0
- package/dist/lib/Table/filters.js +102 -0
- package/dist/lib/Table/filters.js.map +1 -0
- package/dist/lib/Table/presentation.d.ts +7 -0
- package/dist/lib/Table/presentation.d.ts.map +1 -0
- package/dist/lib/Table/presentation.js +63 -0
- package/dist/lib/Table/presentation.js.map +1 -0
- package/dist/lib/Table/rowOrder.d.ts +7 -0
- package/dist/lib/Table/rowOrder.d.ts.map +1 -0
- package/dist/lib/Table/rowOrder.js +26 -0
- package/dist/lib/Table/rowOrder.js.map +1 -0
- package/dist/lib/Table/table.d.ts +89 -0
- package/dist/lib/Table/table.d.ts.map +1 -0
- package/dist/lib/Table/table.js +29 -0
- package/dist/lib/Table/table.js.map +1 -0
- package/dist/shared/Table/Components/DataTable.d.ts +4 -0
- package/dist/shared/Table/Components/DataTable.d.ts.map +1 -0
- package/dist/shared/Table/Components/DataTable.js +13 -0
- package/dist/shared/Table/Components/DataTable.js.map +1 -0
- package/dist/shared/Table/Components/DataTablePagination.d.ts +4 -0
- package/dist/shared/Table/Components/DataTablePagination.d.ts.map +1 -0
- package/dist/shared/Table/Components/DataTablePagination.js +10 -0
- package/dist/shared/Table/Components/DataTablePagination.js.map +1 -0
- package/dist/shared/Table/Components/DataTableToolbar.d.ts +4 -0
- package/dist/shared/Table/Components/DataTableToolbar.d.ts.map +1 -0
- package/dist/shared/Table/Components/DataTableToolbar.js +19 -0
- package/dist/shared/Table/Components/DataTableToolbar.js.map +1 -0
- package/dist/shared/Table/Components/Table.d.ts +4 -0
- package/dist/shared/Table/Components/Table.d.ts.map +1 -0
- package/dist/shared/Table/Components/Table.js +18 -0
- package/dist/shared/Table/Components/Table.js.map +1 -0
- package/dist/shared/Table/Components/TableBody.d.ts +4 -0
- package/dist/shared/Table/Components/TableBody.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableBody.js +8 -0
- package/dist/shared/Table/Components/TableBody.js.map +1 -0
- package/dist/shared/Table/Components/TableButton.d.ts +3 -0
- package/dist/shared/Table/Components/TableButton.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableButton.js +5 -0
- package/dist/shared/Table/Components/TableButton.js.map +1 -0
- package/dist/shared/Table/Components/TableCheckbox.d.ts +3 -0
- package/dist/shared/Table/Components/TableCheckbox.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableCheckbox.js +8 -0
- package/dist/shared/Table/Components/TableCheckbox.js.map +1 -0
- package/dist/shared/Table/Components/TableColumnFilter.d.ts +4 -0
- package/dist/shared/Table/Components/TableColumnFilter.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableColumnFilter.js +23 -0
- package/dist/shared/Table/Components/TableColumnFilter.js.map +1 -0
- package/dist/shared/Table/Components/TableDataRow.d.ts +4 -0
- package/dist/shared/Table/Components/TableDataRow.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableDataRow.js +26 -0
- package/dist/shared/Table/Components/TableDataRow.js.map +1 -0
- package/dist/shared/Table/Components/TableDateRangeFilter.d.ts +3 -0
- package/dist/shared/Table/Components/TableDateRangeFilter.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableDateRangeFilter.js +15 -0
- package/dist/shared/Table/Components/TableDateRangeFilter.js.map +1 -0
- package/dist/shared/Table/Components/TableHead.d.ts +4 -0
- package/dist/shared/Table/Components/TableHead.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableHead.js +17 -0
- package/dist/shared/Table/Components/TableHead.js.map +1 -0
- package/dist/shared/Table/Components/TableProvider.d.ts +3 -0
- package/dist/shared/Table/Components/TableProvider.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableProvider.js +9 -0
- package/dist/shared/Table/Components/TableProvider.js.map +1 -0
- package/dist/shared/Table/Components/TableReorderProvider.d.ts +3 -0
- package/dist/shared/Table/Components/TableReorderProvider.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableReorderProvider.js +43 -0
- package/dist/shared/Table/Components/TableReorderProvider.js.map +1 -0
- package/dist/shared/Table/Components/TableResizeHandle.d.ts +4 -0
- package/dist/shared/Table/Components/TableResizeHandle.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableResizeHandle.js +13 -0
- package/dist/shared/Table/Components/TableResizeHandle.js.map +1 -0
- package/dist/shared/Table/Components/TableRowActions.d.ts +3 -0
- package/dist/shared/Table/Components/TableRowActions.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableRowActions.js +9 -0
- package/dist/shared/Table/Components/TableRowActions.js.map +1 -0
- package/dist/shared/Table/Components/TableStatus.d.ts +3 -0
- package/dist/shared/Table/Components/TableStatus.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableStatus.js +18 -0
- package/dist/shared/Table/Components/TableStatus.js.map +1 -0
- package/dist/shared/Table/Components/TableSurface.d.ts +4 -0
- package/dist/shared/Table/Components/TableSurface.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableSurface.js +19 -0
- package/dist/shared/Table/Components/TableSurface.js.map +1 -0
- package/dist/shared/Table/Components/TableViewport.d.ts +4 -0
- package/dist/shared/Table/Components/TableViewport.d.ts.map +1 -0
- package/dist/shared/Table/Components/TableViewport.js +20 -0
- package/dist/shared/Table/Components/TableViewport.js.map +1 -0
- package/dist/shared/Table/Hooks/useDataTableLogic.d.ts +4 -0
- package/dist/shared/Table/Hooks/useDataTableLogic.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useDataTableLogic.js +201 -0
- package/dist/shared/Table/Hooks/useDataTableLogic.js.map +1 -0
- package/dist/shared/Table/Hooks/useTableCheckboxLogic.d.ts +3 -0
- package/dist/shared/Table/Hooks/useTableCheckboxLogic.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useTableCheckboxLogic.js +10 -0
- package/dist/shared/Table/Hooks/useTableCheckboxLogic.js.map +1 -0
- package/dist/shared/Table/Hooks/useTableColumnResizeLogic.d.ts +6 -0
- package/dist/shared/Table/Hooks/useTableColumnResizeLogic.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useTableColumnResizeLogic.js +40 -0
- package/dist/shared/Table/Hooks/useTableColumnResizeLogic.js.map +1 -0
- package/dist/shared/Table/Hooks/useTableDragLogic.d.ts +21 -0
- package/dist/shared/Table/Hooks/useTableDragLogic.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useTableDragLogic.js +110 -0
- package/dist/shared/Table/Hooks/useTableDragLogic.js.map +1 -0
- package/dist/shared/Table/Hooks/useTableLogic.d.ts +4 -0
- package/dist/shared/Table/Hooks/useTableLogic.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useTableLogic.js +26 -0
- package/dist/shared/Table/Hooks/useTableLogic.js.map +1 -0
- package/dist/shared/Table/Hooks/useTableOverlay.d.ts +3 -0
- package/dist/shared/Table/Hooks/useTableOverlay.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useTableOverlay.js +6 -0
- package/dist/shared/Table/Hooks/useTableOverlay.js.map +1 -0
- package/dist/shared/Table/Hooks/useTableResizeHandleLogic.d.ts +20 -0
- package/dist/shared/Table/Hooks/useTableResizeHandleLogic.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useTableResizeHandleLogic.js +52 -0
- package/dist/shared/Table/Hooks/useTableResizeHandleLogic.js.map +1 -0
- package/dist/shared/Table/Hooks/useTableRowDragContext.d.ts +5 -0
- package/dist/shared/Table/Hooks/useTableRowDragContext.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useTableRowDragContext.js +6 -0
- package/dist/shared/Table/Hooks/useTableRowDragContext.js.map +1 -0
- package/dist/shared/Table/Hooks/useTableRowEventsLogic.d.ts +12 -0
- package/dist/shared/Table/Hooks/useTableRowEventsLogic.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useTableRowEventsLogic.js +25 -0
- package/dist/shared/Table/Hooks/useTableRowEventsLogic.js.map +1 -0
- package/dist/shared/Table/Hooks/useTableRowOrder.d.ts +11 -0
- package/dist/shared/Table/Hooks/useTableRowOrder.d.ts.map +1 -0
- package/dist/shared/Table/Hooks/useTableRowOrder.js +19 -0
- package/dist/shared/Table/Hooks/useTableRowOrder.js.map +1 -0
- package/dist/shared/Table/Types/column.types.d.ts +35 -0
- package/dist/shared/Table/Types/column.types.d.ts.map +1 -0
- package/dist/shared/Table/Types/column.types.js +2 -0
- package/dist/shared/Table/Types/column.types.js.map +1 -0
- package/dist/shared/Table/Types/dataTable.types.d.ts +210 -0
- package/dist/shared/Table/Types/dataTable.types.d.ts.map +1 -0
- package/dist/shared/Table/Types/dataTable.types.js +2 -0
- package/dist/shared/Table/Types/dataTable.types.js.map +1 -0
- package/dist/shared/Table/Types/interaction.types.d.ts +86 -0
- package/dist/shared/Table/Types/interaction.types.d.ts.map +1 -0
- package/dist/shared/Table/Types/interaction.types.js +2 -0
- package/dist/shared/Table/Types/interaction.types.js.map +1 -0
- package/dist/shared/Table/Types/table.types.d.ts +80 -0
- package/dist/shared/Table/Types/table.types.d.ts.map +1 -0
- package/dist/shared/Table/Types/table.types.js +2 -0
- package/dist/shared/Table/Types/table.types.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/docs/usage.md +184 -0
- package/package.json +113 -5
- package/tailwind.css +7 -0
- package/theme.css +40 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import type { ColumnDef, Header, ReactTable, Row, RowData, SortingState, TableOptions } from '@tanstack/react-table';
|
|
3
|
+
import type { rentnerTableFeatures } from '../../../lib/Table/table.ts';
|
|
4
|
+
import type { TableInteractionMessages, TableRowEvents } from './interaction.types.ts';
|
|
5
|
+
export type TableLocale = 'de' | 'en';
|
|
6
|
+
export type TableSize = 'sm' | 'md' | 'lg';
|
|
7
|
+
export interface TableMessages extends Partial<TableInteractionMessages> {
|
|
8
|
+
empty: string;
|
|
9
|
+
loading: string;
|
|
10
|
+
sortAscending: string;
|
|
11
|
+
sortDescending: string;
|
|
12
|
+
clearSorting: string;
|
|
13
|
+
title: string;
|
|
14
|
+
search: string;
|
|
15
|
+
searchPlaceholder: string;
|
|
16
|
+
filters: string;
|
|
17
|
+
columns: string;
|
|
18
|
+
resetFilters: string;
|
|
19
|
+
noResults: string;
|
|
20
|
+
noResultsDescription: string;
|
|
21
|
+
emptyDescription: string;
|
|
22
|
+
error: string;
|
|
23
|
+
retry: string;
|
|
24
|
+
all: string;
|
|
25
|
+
filterColumn: (label: string) => string;
|
|
26
|
+
rowsPerPage: string;
|
|
27
|
+
firstPage: string;
|
|
28
|
+
previousPage: string;
|
|
29
|
+
nextPage: string;
|
|
30
|
+
lastPage: string;
|
|
31
|
+
pageInfo: (page: number, pages: number | null) => string;
|
|
32
|
+
rowRange: (first: number, last: number, total: number | null) => string;
|
|
33
|
+
results: (count: number) => string;
|
|
34
|
+
selected: (count: number) => string;
|
|
35
|
+
clearSelection: string;
|
|
36
|
+
selectPage: string;
|
|
37
|
+
selectRow: (label: string) => string;
|
|
38
|
+
expandRow: (label: string) => string;
|
|
39
|
+
collapseRow: (label: string) => string;
|
|
40
|
+
}
|
|
41
|
+
export type TableColumn<TData extends RowData, TValue = unknown> = ColumnDef<typeof rentnerTableFeatures, TData, TValue>;
|
|
42
|
+
export type RentnerTableInstance<TData extends RowData> = ReactTable<typeof rentnerTableFeatures, TData>;
|
|
43
|
+
export type RentnerTableOptions<TData extends RowData> = Omit<TableOptions<typeof rentnerTableFeatures, TData>, 'features'>;
|
|
44
|
+
export type TableLogicOptions<TData extends RowData> = Pick<TableOptions<typeof rentnerTableFeatures, TData>, 'data' | 'columns' | 'getRowId' | 'enableSorting'> & {
|
|
45
|
+
initialSorting?: SortingState;
|
|
46
|
+
locale?: TableLocale;
|
|
47
|
+
messages?: Partial<TableMessages>;
|
|
48
|
+
/** Enable horizontal drag handles and keyboard column resizing. Defaults to false. */
|
|
49
|
+
resizableColumns?: boolean;
|
|
50
|
+
};
|
|
51
|
+
export type TableProps<TData extends RowData> = Omit<ComponentPropsWithRef<'table'>, 'children'> & TableLogicOptions<TData> & TableRowEvents<TData> & {
|
|
52
|
+
children?: never;
|
|
53
|
+
caption?: ReactNode;
|
|
54
|
+
size?: TableSize;
|
|
55
|
+
striped?: boolean;
|
|
56
|
+
isLoading?: boolean;
|
|
57
|
+
emptyState?: ReactNode;
|
|
58
|
+
loadingState?: ReactNode;
|
|
59
|
+
containerClassName?: string;
|
|
60
|
+
};
|
|
61
|
+
export interface TableHeaderState<TData extends RowData> {
|
|
62
|
+
header: Header<typeof rentnerTableFeatures, TData, unknown>;
|
|
63
|
+
canSort: boolean;
|
|
64
|
+
sortDirection: 'ascending' | 'descending' | undefined;
|
|
65
|
+
sortAction: string;
|
|
66
|
+
sortIndicator: string;
|
|
67
|
+
}
|
|
68
|
+
export interface TableLogicResult<TData extends RowData> {
|
|
69
|
+
table: ReactTable<typeof rentnerTableFeatures, TData>;
|
|
70
|
+
state: {
|
|
71
|
+
headerGroups: {
|
|
72
|
+
id: string;
|
|
73
|
+
headers: TableHeaderState<TData>[];
|
|
74
|
+
}[];
|
|
75
|
+
rows: Row<typeof rentnerTableFeatures, TData>[];
|
|
76
|
+
columnCount: number;
|
|
77
|
+
messages: TableMessages;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=table.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.types.d.ts","sourceRoot":"","sources":["../../../../src/shared/Table/Types/table.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.types.js","sourceRoot":"","sources":["../../../../src/shared/Table/Types/table.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentPropsWithRef, ReactNode } from 'react'\nimport type {\n ColumnDef,\n Header,\n ReactTable,\n Row,\n RowData,\n SortingState,\n TableOptions,\n} from '@tanstack/react-table'\nimport type { rentnerTableFeatures } from '../../../lib/Table/table.ts'\nimport type {\n TableInteractionMessages,\n TableRowEvents,\n} from './interaction.types.ts'\n\nexport type TableLocale = 'de' | 'en'\nexport type TableSize = 'sm' | 'md' | 'lg'\n\nexport interface TableMessages extends Partial<TableInteractionMessages> {\n empty: string\n loading: string\n sortAscending: string\n sortDescending: string\n clearSorting: string\n title: string\n search: string\n searchPlaceholder: string\n filters: string\n columns: string\n resetFilters: string\n noResults: string\n noResultsDescription: string\n emptyDescription: string\n error: string\n retry: string\n all: string\n filterColumn: (label: string) => string\n rowsPerPage: string\n firstPage: string\n previousPage: string\n nextPage: string\n lastPage: string\n pageInfo: (page: number, pages: number | null) => string\n rowRange: (first: number, last: number, total: number | null) => string\n results: (count: number) => string\n selected: (count: number) => string\n clearSelection: string\n selectPage: string\n selectRow: (label: string) => string\n expandRow: (label: string) => string\n collapseRow: (label: string) => string\n}\n\nexport type TableColumn<TData extends RowData, TValue = unknown> = ColumnDef<\n typeof rentnerTableFeatures,\n TData,\n TValue\n>\n\nexport type RentnerTableInstance<TData extends RowData> = ReactTable<\n typeof rentnerTableFeatures,\n TData\n>\nexport type RentnerTableOptions<TData extends RowData> = Omit<\n TableOptions<typeof rentnerTableFeatures, TData>,\n 'features'\n>\n\nexport type TableLogicOptions<TData extends RowData> = Pick<\n TableOptions<typeof rentnerTableFeatures, TData>,\n 'data' | 'columns' | 'getRowId' | 'enableSorting'\n> & {\n initialSorting?: SortingState\n locale?: TableLocale\n messages?: Partial<TableMessages>\n /** Enable horizontal drag handles and keyboard column resizing. Defaults to false. */\n resizableColumns?: boolean\n}\n\nexport type TableProps<TData extends RowData> = Omit<\n ComponentPropsWithRef<'table'>,\n 'children'\n> &\n TableLogicOptions<TData> &\n TableRowEvents<TData> & {\n children?: never\n caption?: ReactNode\n size?: TableSize\n striped?: boolean\n isLoading?: boolean\n emptyState?: ReactNode\n loadingState?: ReactNode\n containerClassName?: string\n }\n\nexport interface TableHeaderState<TData extends RowData> {\n header: Header<typeof rentnerTableFeatures, TData, unknown>\n canSort: boolean\n sortDirection: 'ascending' | 'descending' | undefined\n sortAction: string\n sortIndicator: string\n}\n\nexport interface TableLogicResult<TData extends RowData> {\n table: ReactTable<typeof rentnerTableFeatures, TData>\n state: {\n headerGroups: {\n id: string\n headers: TableHeaderState<TData>[]\n }[]\n rows: Row<typeof rentnerTableFeatures, TData>[]\n columnCount: number\n messages: TableMessages\n }\n}\n"]}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { TableCell, TableRowEvents, TableRowOrderChange, TableInteractionMessages, } from './shared/Table/Types/interaction.types.ts';
|
|
2
|
+
export type { TableColumn, TableLocale, TableLogicOptions, TableLogicResult, TableMessages, TableProps, TableSize, RentnerTableInstance, RentnerTableOptions, } from './shared/Table/Types/table.types.ts';
|
|
3
|
+
export type { TableColumnMeta, TableColumnFilter, TableDateRange, } from './shared/Table/Types/column.types.ts';
|
|
4
|
+
export type { TableProviderProps } from './shared/Table/Types/dataTable.types.ts';
|
|
5
|
+
export type { DataTableProps, DataTableLogicOptions, DataTableLogicResult, DataTableContext, DataTableClassNames, TableRow, TableColumnInstance, TableSurfaceProps, DataTableToolbarProps, DataTablePaginationProps, TableRowActionsProps, } from './shared/Table/Types/dataTable.types.ts';
|
|
6
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,wBAAwB,GAC3B,MAAM,2CAA2C,CAAA;AAClD,YAAY,EACR,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,mBAAmB,GACtB,MAAM,qCAAqC,CAAA;AAC5C,YAAY,EACR,eAAe,EACf,iBAAiB,EACjB,cAAc,GACjB,MAAM,sCAAsC,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AACjF,YAAY,EACR,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,GACvB,MAAM,yCAAyC,CAAA"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["export type {\n TableCell,\n TableRowEvents,\n TableRowOrderChange,\n TableInteractionMessages,\n} from './shared/Table/Types/interaction.types.ts'\nexport type {\n TableColumn,\n TableLocale,\n TableLogicOptions,\n TableLogicResult,\n TableMessages,\n TableProps,\n TableSize,\n RentnerTableInstance,\n RentnerTableOptions,\n} from './shared/Table/Types/table.types.ts'\nexport type {\n TableColumnMeta,\n TableColumnFilter,\n TableDateRange,\n} from './shared/Table/Types/column.types.ts'\nexport type { TableProviderProps } from './shared/Table/Types/dataTable.types.ts'\nexport type {\n DataTableProps,\n DataTableLogicOptions,\n DataTableLogicResult,\n DataTableContext,\n DataTableClassNames,\n TableRow,\n TableColumnInstance,\n TableSurfaceProps,\n DataTableToolbarProps,\n DataTablePaginationProps,\n TableRowActionsProps,\n} from './shared/Table/Types/dataTable.types.ts'\n"]}
|
package/docs/usage.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# RentnerTable usage
|
|
2
|
+
|
|
3
|
+
The package supports React 19, React DOM 19, Tailwind CSS 4 and TanStack Table 9. Import `@rentnerkev/table/tailwind.css` after Tailwind; see the [README quick start](../README.md#quick-start) for a complete typed component.
|
|
4
|
+
|
|
5
|
+
## Components and entry points
|
|
6
|
+
|
|
7
|
+
| Entry | API |
|
|
8
|
+
| -------------------------------- | ---------------------------------------------------- |
|
|
9
|
+
| `@rentnerkev/table` | Public components, hooks, helpers, filters and types |
|
|
10
|
+
| `@rentnerkev/table/table` | `Table`, a minimal sortable table |
|
|
11
|
+
| `@rentnerkev/table/data-table` | `DataTable`, the complete table interface |
|
|
12
|
+
| `@rentnerkev/table/hooks` | `useDataTableLogic` |
|
|
13
|
+
| `@rentnerkev/table/filters` | Portable text, equality and date-range filters |
|
|
14
|
+
| `@rentnerkev/table/types` | Type-only contracts |
|
|
15
|
+
| `@rentnerkev/table/tailwind.css` | Theme, scanned library classes and control styles |
|
|
16
|
+
| `@rentnerkev/table/theme.css` | Shared theme token mapping only |
|
|
17
|
+
|
|
18
|
+
`DataTable` requires `data`, `columns` and `getRowId`. Supply a stable string ID from the record rather than a page-relative array index. `getRowLabel` gives selection and detail buttons a readable accessible name.
|
|
19
|
+
|
|
20
|
+
`Table` takes `data`, `columns`, an optional `getRowId` and a `caption`. It renders every supplied row and supports `enableSorting`, `initialSorting`, `locale`, `messages`, density, striped rows and loading/empty content. It accepts native table attributes and a ref.
|
|
21
|
+
|
|
22
|
+
## Resizing and row reordering
|
|
23
|
+
|
|
24
|
+
Both capabilities are opt-in. `resizableColumns` works with `Table` and `DataTable`; `reorderableRows` is provided by `DataTable`.
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { useState } from 'react'
|
|
28
|
+
import { DataTable, createTableColumnHelper } from '@rentnerkev/table'
|
|
29
|
+
|
|
30
|
+
interface Member {
|
|
31
|
+
id: string
|
|
32
|
+
name: string
|
|
33
|
+
role: string
|
|
34
|
+
}
|
|
35
|
+
const initialMembers: Member[] = [
|
|
36
|
+
{ id: 'alex', name: 'Alex Weber', role: 'Developer' },
|
|
37
|
+
{ id: 'sam', name: 'Sam Fischer', role: 'Designer' },
|
|
38
|
+
]
|
|
39
|
+
const column = createTableColumnHelper<Member>()
|
|
40
|
+
const columns = column.columns([
|
|
41
|
+
column.accessor('name', { header: 'Member', minSize: 100, maxSize: 600 }),
|
|
42
|
+
column.accessor('role', { header: 'Role', enableResizing: false }),
|
|
43
|
+
])
|
|
44
|
+
|
|
45
|
+
export default function ReusableTeam() {
|
|
46
|
+
const [data, setData] = useState(initialMembers)
|
|
47
|
+
return (
|
|
48
|
+
<DataTable
|
|
49
|
+
data={data}
|
|
50
|
+
columns={columns}
|
|
51
|
+
getRowId={(member) => member.id}
|
|
52
|
+
getRowLabel={(member) => member.name}
|
|
53
|
+
title="Project team"
|
|
54
|
+
resizableColumns
|
|
55
|
+
reorderableRows
|
|
56
|
+
onRowOrderChange={(next) => setData(next)}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Resize a leaf column at its edge. Arrow keys change width by 10 pixels, Shift+Arrow by 50; Home or double-click resets its configured size, and End selects its maximum. `minSize`, `maxSize` and `enableResizing` configure each column. Native `tableOptions.columnResizeMode`, `columnResizeDirection`, controlled `state.columnSizing` and `onColumnSizingChange` remain available on `DataTable`.
|
|
63
|
+
|
|
64
|
+
Drag a row by its handle, hold the handle briefly on touch devices, or use Space, arrow keys and Space/Enter to move it with the keyboard. Escape and drops outside the table cancel. The preview stays within the visible table width and includes expanded details. Clear sorting before reordering; dragging is disabled while sorting is active or the table is loading or showing an error.
|
|
65
|
+
|
|
66
|
+
`reorderableRows` alone keeps the order internally. Providing `onRowOrderChange(data, change)` makes the caller responsible for applying the returned array. `TableRowOrderChange` contains `activeId`, `overId`, `fromIndex` and `toIndex`; indices refer to the full supplied data, before filtering and pagination. Only rendered rows are drag targets. Keep stable record IDs, preserve the rest of the data when persisting server-page changes, and retain order in your backend when required. Selection and expanded details stay attached to their record during reordering. Drag dependencies load on demand.
|
|
67
|
+
|
|
68
|
+
## Row, cell and table events
|
|
69
|
+
|
|
70
|
+
`Table` and `DataTable` provide `onRowClick`, `onRowDoubleClick`, `onRowContextMenu`, `onCellClick`, `onCellDoubleClick` and `onCellContextMenu`. Callbacks receive the native typed row/cell followed by the React mouse event. Use `row.original`, `cell.row.original` and `cell.column.id` to route application actions.
|
|
71
|
+
|
|
72
|
+
Row click and double-click notifications ignore interactive controls, prevented events and descendants marked `data-no-row-click`. Cell handlers can call `preventDefault()` to suppress the row callback, or `stopPropagation()` to stop bubbling. Render editable cells as accessible buttons or shared RentnerKev controls; those controls keep their own keyboard behavior.
|
|
73
|
+
|
|
74
|
+
For context menus, either prevent the browser menu and open your own UI, or wrap the table with `ContextMenu` from `@rentnerkev/menu` and let the event bubble to that wrapper. Set the target row in `onRowContextMenu` before the wrapper opens. Native table events, attributes and refs go through `DataTable.tableProps`; `Table` accepts them directly. When using headless composition, pass `handler.handleRowReorder` to `TableSurface.onRowReorder` together with `reorderableRows`.
|
|
75
|
+
|
|
76
|
+
## Columns and filters
|
|
77
|
+
|
|
78
|
+
Create columns with `createTableColumnHelper<YourRecord>()`. `helper.columns([...])` preserves typed values across heterogeneous accessor columns. Define reusable columns outside render, or memoize columns that depend on locale or callbacks.
|
|
79
|
+
|
|
80
|
+
| Column setting | Behavior |
|
|
81
|
+
| --------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
82
|
+
| `meta.label` | Plain-text label for filter and visibility controls when the header is custom JSX |
|
|
83
|
+
| `meta.align` | `left`, `center` or `right` alignment for headers and cells |
|
|
84
|
+
| `meta.headerClassName`, `meta.cellClassName` | Extra classes for that column |
|
|
85
|
+
| `meta.filter: { type: 'text' }` | Trimmed, case-insensitive substring matching |
|
|
86
|
+
| `meta.filter: { type: 'select', options }` | Exact scalar value matching; options use string values |
|
|
87
|
+
| `meta.filter: { type: 'dateRange' }` | Inclusive local calendar-day boundaries |
|
|
88
|
+
| `meta.filter: { type: 'custom', render }` | Render a custom control with `value`, `onValueChange` and `label` |
|
|
89
|
+
| `enableColumnFilter: false` | Disable the column filter |
|
|
90
|
+
| `enableGlobalFilter: false` | Exclude a column from global search |
|
|
91
|
+
| `enableSorting: false`, `enableHiding: false` | Disable individual capabilities |
|
|
92
|
+
|
|
93
|
+
An explicit TanStack `filterFn` takes precedence over the default function selected by metadata. A custom filter control should supply a matching `filterFn` when text matching is unsuitable.
|
|
94
|
+
|
|
95
|
+
`TableDateRange` is `{ from?: string; to?: string }`, using `YYYY-MM-DD` boundaries. Rows may contain valid `Date` objects, timestamps or date strings. Date-only strings are interpreted as local dates. Invalid dates and reversed ranges produce no matches. Search, sorting and column-filter changes return to page one by default; `tableOptions.autoResetPageIndex: false` opts out. Client pages still clamp when the current page no longer exists.
|
|
96
|
+
|
|
97
|
+
## Selection, actions and expanded rows
|
|
98
|
+
|
|
99
|
+
Set `selectable` to `true` or a predicate receiving the native row. The header checkbox selects eligible rows on the current page. Selection uses record IDs and survives page changes; `bulkActions` receives the currently filtered selected rows and the native table instance. With manual server pagination it can only resolve selected records in the data currently supplied by the application. Keep a separate application-level ID selection when actions must span unloaded server pages.
|
|
100
|
+
|
|
101
|
+
`toolbarActions` accepts a node or a function receiving `{ table, selectedRows }`. `bulkActions` receives the same context. Use `table.resetRowSelection(true)` after a successful bulk operation when the selection should clear. Disabling `selectable` hides selection UI while preserving native selection state.
|
|
102
|
+
|
|
103
|
+
`TableRowActions` accepts an accessible `label` and the existing RentnerMenu item model. Place it in a display column; item callbacks can act on that column's row. See the [playground implementation](../playground/src/Hooks/useTeamTableLogic.tsx) for row menus and a bulk update.
|
|
104
|
+
|
|
105
|
+
`renderExpandedRow(row)` renders content in a separate full-width table row. Use `row.original` for the record. Keep data requests and mutations in application hooks; the table does not fetch or persist records.
|
|
106
|
+
|
|
107
|
+
## Controlled server data
|
|
108
|
+
|
|
109
|
+
Pass controlled TanStack state and callbacks through `tableOptions`. Set `manualPagination`, `manualFiltering` and `manualSorting` to make the server responsible for those operations. The application supplies the current page's records and a total `rowCount` when known.
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { useState } from 'react'
|
|
113
|
+
import { useDataTableLogic, createTableColumnHelper } from '@rentnerkev/table'
|
|
114
|
+
|
|
115
|
+
type Member = { id: string; name: string }
|
|
116
|
+
const column = createTableColumnHelper<Member>()
|
|
117
|
+
const columns = column.columns([column.accessor('name', { header: 'Member' })])
|
|
118
|
+
|
|
119
|
+
export function useRemoteMembersLogic(
|
|
120
|
+
data: readonly Member[],
|
|
121
|
+
rowCount: number,
|
|
122
|
+
) {
|
|
123
|
+
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 25 })
|
|
124
|
+
const [globalFilter, setGlobalFilter] = useState('')
|
|
125
|
+
|
|
126
|
+
return useDataTableLogic({
|
|
127
|
+
data,
|
|
128
|
+
columns,
|
|
129
|
+
getRowId: (member) => member.id,
|
|
130
|
+
tableOptions: {
|
|
131
|
+
manualPagination: true,
|
|
132
|
+
manualFiltering: true,
|
|
133
|
+
manualSorting: true,
|
|
134
|
+
rowCount,
|
|
135
|
+
state: { pagination, globalFilter },
|
|
136
|
+
onPaginationChange: setPagination,
|
|
137
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
138
|
+
},
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Connect these controlled values to your application's query hook and pass the query results into the table. For controlled sorting and column filters, add their state and matching callbacks as well. `useDataTableLogic` returns the native `table` alongside `state`, `handler` and `refs` for a custom UI. A controlled state slice needs its corresponding callback; `initialState` only sets uncontrolled defaults.
|
|
144
|
+
|
|
145
|
+
For an unknown total, use `pageCount: -1`; the footer omits the total page count and disables last-page navigation. Bound next-page navigation from your server response through an application-owned pagination UI when using this mode. `pagination={false}` renders all supplied rows.
|
|
146
|
+
|
|
147
|
+
## Appearance and messages
|
|
148
|
+
|
|
149
|
+
`size` accepts `sm`, `md` or `lg`. `DataTable` defaults to striped rows; `striped={false}` disables them. `stickyHeader` sticks within the table viewport; constrain the viewport height through `classNames.viewport` when using a vertically scrolling table.
|
|
150
|
+
|
|
151
|
+
The table scrolls horizontally inside its viewport at narrow widths. `classNames` exposes `root`, `toolbar`, `viewport`, `table`, `header`, `headerCell`, `row`, `cell` and `footer`. `rowClassName(row)` adds record-specific row classes.
|
|
152
|
+
|
|
153
|
+
Override shared `--rentner-*` tokens on `:root` or a container. For example:
|
|
154
|
+
|
|
155
|
+
```css
|
|
156
|
+
.light-table {
|
|
157
|
+
--rentner-surface: #ffffff;
|
|
158
|
+
--rentner-control: #edf1f6;
|
|
159
|
+
--rentner-foreground: #0f172a;
|
|
160
|
+
--rentner-muted: #475569;
|
|
161
|
+
--rentner-border: #cbd5e1;
|
|
162
|
+
--rentner-accent: #006d64;
|
|
163
|
+
--rentner-accent-hover: #00564f;
|
|
164
|
+
--rentner-accent-foreground: #ffffff;
|
|
165
|
+
--rentner-success: #047857;
|
|
166
|
+
--rentner-danger: #b91c1c;
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Popup controls use the table root as their default portal container, retaining scoped theme tokens. Pass `portalContainer` explicitly for an application overlay boundary. `TableProvider` is available for custom composition using these controls.
|
|
171
|
+
|
|
172
|
+
Set `locale="de"` or `locale="en"` and override individual labels or formatter functions through `messages`. Search, filter, visibility and pagination controls use the resolved messages. `searchable`, `columnFilters` and `columnVisibility` can independently hide their controls.
|
|
173
|
+
|
|
174
|
+
## Loading and errors
|
|
175
|
+
|
|
176
|
+
`isLoading` displays the loading state and disables built-in controls. `isRefreshing` retains the visible rows and adds a refresh indicator. Custom `toolbarActions` and `bulkActions` remain application-owned; manage their disabled state in your action components.
|
|
177
|
+
|
|
178
|
+
Use `error={true}` for the translated default error message, a React node for custom content, and `onRetry` for retry behavior. `error={false}` leaves data visible. `emptyState`, `loadingState` and `noResultsState` customize their respective content. Filtered empty results include a reset action.
|
|
179
|
+
|
|
180
|
+
## Rendering and performance
|
|
181
|
+
|
|
182
|
+
The library is ESM with public subpath exports and server-renderable markup. Interactive consumers need a client boundary in frameworks that distinguish server and client components. Date-filter UI loads lazily; row data remains application-owned.
|
|
183
|
+
|
|
184
|
+
Pagination bounds rendered rows. Row virtualization, fetching, CSV export, editing, persistence and infinite scrolling are application responsibilities. For large remote datasets, filter/sort/page on the server and provide a page of rows. Keep `data`, columns and controlled state referentially stable when their contents have not changed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,114 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@rentnerkev/table",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Accessible, typed React tables with TanStack Table and shared RentnerKev styling.",
|
|
5
|
+
"author": "RentnerKev",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"tailwind.css",
|
|
13
|
+
"theme.css",
|
|
14
|
+
"README.md",
|
|
15
|
+
"docs/usage.md"
|
|
16
|
+
],
|
|
17
|
+
"sideEffects": [
|
|
18
|
+
"./tailwind.css",
|
|
19
|
+
"./theme.css"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./table": {
|
|
27
|
+
"types": "./dist/shared/Table/Components/Table.d.ts",
|
|
28
|
+
"import": "./dist/shared/Table/Components/Table.js"
|
|
29
|
+
},
|
|
30
|
+
"./data-table": {
|
|
31
|
+
"types": "./dist/shared/Table/Components/DataTable.d.ts",
|
|
32
|
+
"import": "./dist/shared/Table/Components/DataTable.js"
|
|
33
|
+
},
|
|
34
|
+
"./hooks": {
|
|
35
|
+
"types": "./dist/shared/Table/Hooks/useDataTableLogic.d.ts",
|
|
36
|
+
"import": "./dist/shared/Table/Hooks/useDataTableLogic.js"
|
|
37
|
+
},
|
|
38
|
+
"./filters": {
|
|
39
|
+
"types": "./dist/lib/Table/filters.d.ts",
|
|
40
|
+
"import": "./dist/lib/Table/filters.js"
|
|
41
|
+
},
|
|
42
|
+
"./types": {
|
|
43
|
+
"types": "./dist/types.d.ts",
|
|
44
|
+
"import": "./dist/types.js"
|
|
45
|
+
},
|
|
46
|
+
"./tailwind.css": "./tailwind.css",
|
|
47
|
+
"./theme.css": "./theme.css",
|
|
48
|
+
"./package.json": "./package.json"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "bun scripts/build.ts && tsc",
|
|
52
|
+
"prepare": "bun run build",
|
|
53
|
+
"typecheck": "tsc --noEmit && tsc --project tsconfig.type-tests.json && bun run typecheck:playground && bun run typecheck:automation",
|
|
54
|
+
"typecheck:playground": "tsc --noEmit -p playground/tsconfig.json",
|
|
55
|
+
"typecheck:automation": "tsc --noEmit -p .github/scripts/tsconfig.json",
|
|
56
|
+
"test": "bun test",
|
|
57
|
+
"e2e": "playwright test",
|
|
58
|
+
"pack:check": "bun pm pack --dry-run",
|
|
59
|
+
"pack:consumer": "bun scripts/consumer/verify.ts",
|
|
60
|
+
"playground:install": "bun install --cwd playground --frozen-lockfile",
|
|
61
|
+
"playground:dev": "bun --cwd playground dev",
|
|
62
|
+
"playground:build": "bun --cwd playground build",
|
|
63
|
+
"lint": "oxlint --deny-warnings src scripts playground/src playground/vite.config.ts playwright.config.ts .github/scripts",
|
|
64
|
+
"lint:fix": "oxlint --fix --deny-warnings src scripts playground/src playground/vite.config.ts playwright.config.ts .github/scripts",
|
|
65
|
+
"format": "bun fmt src scripts playground .github docs README.md package.json tsconfig.json tsconfig.type-tests.json playwright.config.ts .oxlintrc.json bunfig.toml theme.css tailwind.css cliff.toml",
|
|
66
|
+
"format:check": "bun fmt --check src scripts playground .github docs README.md package.json tsconfig.json tsconfig.type-tests.json playwright.config.ts .oxlintrc.json bunfig.toml theme.css tailwind.css cliff.toml",
|
|
67
|
+
"verify": "bun run playground:install && bun run typecheck && bun run lint && bun run format:check && bun run test && bun run build && bun run pack:check && bun run pack:consumer && bun run playground:build && bun run e2e"
|
|
68
|
+
},
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git+https://github.com/RentnerKev/RentnerTable.git"
|
|
72
|
+
},
|
|
73
|
+
"homepage": "https://github.com/RentnerKev/RentnerTable",
|
|
74
|
+
"bugs": {
|
|
75
|
+
"url": "https://github.com/RentnerKev/RentnerTable/issues"
|
|
76
|
+
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"access": "public",
|
|
79
|
+
"registry": "https://registry.npmjs.org"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"react": "^19.0.0",
|
|
83
|
+
"react-dom": "^19.0.0"
|
|
84
|
+
},
|
|
85
|
+
"dependencies": {
|
|
86
|
+
"@dnd-kit/core": "^6.3.1",
|
|
87
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
88
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
89
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
90
|
+
"@rentnerkev/calendar": "^2.9.0",
|
|
91
|
+
"@rentnerkev/inputs": "^2.8.1",
|
|
92
|
+
"@rentnerkev/menu": "^1.1.0",
|
|
93
|
+
"@rentnerkev/select": "^6.1.0",
|
|
94
|
+
"@tanstack/react-table": "^9.3.1",
|
|
95
|
+
"lucide-react": "^1.73.0"
|
|
96
|
+
},
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"@axe-core/playwright": "^4.14.0",
|
|
99
|
+
"@happy-dom/global-registrator": "^21.0.4",
|
|
100
|
+
"@playwright/test": "^1.64.1",
|
|
101
|
+
"@testing-library/react": "^16.3.3",
|
|
102
|
+
"@testing-library/user-event": "^14.6.8",
|
|
103
|
+
"@types/bun": "^1.4.4",
|
|
104
|
+
"@types/node": "^26.6.6",
|
|
105
|
+
"@types/react": "^19.3.0",
|
|
106
|
+
"@types/react-dom": "^19.3.0",
|
|
107
|
+
"happy-dom": "^21.0.4",
|
|
108
|
+
"oxlint": "^1.91.0",
|
|
109
|
+
"react": "^19.3.1",
|
|
110
|
+
"react-dom": "^19.3.1",
|
|
111
|
+
"typescript": "^7.0.2"
|
|
112
|
+
},
|
|
113
|
+
"packageManager": "bun@1.4.4"
|
|
114
|
+
}
|
package/tailwind.css
ADDED
package/theme.css
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* Shared RentnerKev tokens. Set --rentner-* once on :root or a scoped container. */
|
|
2
|
+
@theme inline {
|
|
3
|
+
--color-rentner-control: var(
|
|
4
|
+
--rentner-control,
|
|
5
|
+
var(--color-input-dark, #22252b)
|
|
6
|
+
);
|
|
7
|
+
--color-rentner-surface: var(
|
|
8
|
+
--rentner-surface,
|
|
9
|
+
var(--color-surface-dark, #181a1f)
|
|
10
|
+
);
|
|
11
|
+
--color-rentner-foreground: var(--rentner-foreground, #ffffff);
|
|
12
|
+
--color-rentner-muted: var(
|
|
13
|
+
--rentner-muted,
|
|
14
|
+
var(--color-secondary-text, #9ca3af)
|
|
15
|
+
);
|
|
16
|
+
--color-rentner-border: var(
|
|
17
|
+
--rentner-border,
|
|
18
|
+
var(--color-border-dark, #2e323b)
|
|
19
|
+
);
|
|
20
|
+
--color-rentner-accent: var(
|
|
21
|
+
--rentner-accent,
|
|
22
|
+
var(--color-primary, #13ecd6)
|
|
23
|
+
);
|
|
24
|
+
--color-rentner-accent-hover: var(
|
|
25
|
+
--rentner-accent-hover,
|
|
26
|
+
var(--color-primary-hover, #0fbdaa)
|
|
27
|
+
);
|
|
28
|
+
--color-rentner-accent-foreground: var(
|
|
29
|
+
--rentner-accent-foreground,
|
|
30
|
+
#0f1014
|
|
31
|
+
);
|
|
32
|
+
--color-rentner-danger: var(--rentner-danger, #fb7185);
|
|
33
|
+
--color-rentner-success: var(--rentner-success, #34d399);
|
|
34
|
+
--color-rentner-warning: var(--rentner-warning, #fbbf24);
|
|
35
|
+
--color-rentner-info: var(--rentner-info, #60a5fa);
|
|
36
|
+
--radius-rentner-control: var(--rentner-radius, 0.75rem);
|
|
37
|
+
--spacing-rentner-control-sm: var(--rentner-control-sm, 2.25rem);
|
|
38
|
+
--spacing-rentner-control-md: var(--rentner-control-md, 2.75rem);
|
|
39
|
+
--spacing-rentner-control-lg: var(--rentner-control-lg, 3rem);
|
|
40
|
+
}
|