munza-x-data-grid 1.3.0 → 1.3.3
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/README.md +244 -60
- package/dist/components/feedback/NoDataFoundMsg.d.ts +2 -0
- package/dist/components/feedback/TableError.d.ts +2 -0
- package/dist/components/feedback/TableErrorMsg.d.ts +2 -0
- package/dist/components/feedback/TableNoData.d.ts +2 -0
- package/dist/components/feedback/TableRowSkeleton.d.ts +7 -0
- package/dist/components/feedback/TableSkeleton.d.ts +2 -0
- package/dist/components/header/HeaderFilter.d.ts +5 -0
- package/dist/components/header/HeaderMenu.d.ts +5 -0
- package/dist/components/header/HeaderSort.d.ts +5 -0
- package/dist/components/pagination/index.d.ts +4 -0
- package/dist/components/table/TBody.d.ts +2 -0
- package/dist/components/table/TCell.d.ts +6 -0
- package/dist/components/table/THead.d.ts +6 -0
- package/dist/components/table/THeader.d.ts +2 -0
- package/dist/components/table/TMain.d.ts +2 -0
- package/dist/components/toolbar/ToolbarFilter.d.ts +5 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/debounced-input.d.ts +7 -0
- package/dist/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/native-select.d.ts +8 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/contexts/GridContext.d.ts +37 -0
- package/dist/core/Grid.d.ts +3 -0
- package/dist/data-grid.cjs +44 -0
- package/dist/data-grid.js +7946 -179
- package/dist/hooks/useGrid.d.ts +2 -0
- package/dist/hooks/useGridState.d.ts +16 -0
- package/dist/hooks/useSyncScroll.d.ts +7 -0
- package/dist/index.css +4 -0
- package/dist/index.d.ts +4 -2
- package/dist/lib/utils.d.ts +2 -0
- package/dist/utils/getPinStyles.d.ts +3 -0
- package/package.json +25 -13
- package/dist/App.d.ts +0 -2
- package/dist/Button.d.ts +0 -7
- package/dist/data-grid.umd.cjs +0 -6
- package/dist/favicon.svg +0 -1
- package/dist/icons.svg +0 -24
- package/dist/main.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,73 +1,257 @@
|
|
|
1
|
-
#
|
|
1
|
+
# munza-x-data-grid
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A flexible, feature-rich React data grid component built on top of [@tanstack/react-table](https://tanstack.com/table), with Tailwind CSS v4 styling and shadcn/ui primitives.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
---
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
|
7
|
+
## Installation
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install munza-x-data-grid
|
|
11
|
+
```
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
Import the stylesheet in your app entry point:
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
```js
|
|
16
|
+
import 'munza-x-data-grid/style.css';
|
|
17
|
+
```
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
### Peer Dependencies
|
|
17
20
|
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
globalIgnores(['dist']),
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.{ts,tsx}'],
|
|
23
|
-
extends: [
|
|
24
|
-
// Other configs...
|
|
25
|
-
|
|
26
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
27
|
-
tseslint.configs.recommendedTypeChecked,
|
|
28
|
-
// Alternatively, use this for stricter rules
|
|
29
|
-
tseslint.configs.strictTypeChecked,
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
32
|
-
|
|
33
|
-
// Other configs...
|
|
34
|
-
],
|
|
35
|
-
languageOptions: {
|
|
36
|
-
parserOptions: {
|
|
37
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
-
tsconfigRootDir: import.meta.dirname,
|
|
39
|
-
},
|
|
40
|
-
// other options...
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
])
|
|
21
|
+
```bash
|
|
22
|
+
npm install react react-dom
|
|
44
23
|
```
|
|
45
24
|
|
|
46
|
-
|
|
25
|
+
Requires **React 18 or 19**.
|
|
47
26
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Basic Usage
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Grid, useGridState, type ColumnDef } from 'munza-x-data-grid';
|
|
33
|
+
import 'munza-x-data-grid/style.css';
|
|
34
|
+
|
|
35
|
+
type Person = {
|
|
36
|
+
firstName: string;
|
|
37
|
+
lastName: string;
|
|
38
|
+
age: number;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const columns: ColumnDef<Person>[] = [
|
|
42
|
+
{ accessorKey: 'firstName', header: 'First Name' },
|
|
43
|
+
{ accessorKey: 'lastName', header: 'Last Name' },
|
|
44
|
+
{ accessorKey: 'age', header: 'Age' },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const data: Person[] = [{ firstName: 'Alice', lastName: 'Smith', age: 30 }];
|
|
48
|
+
|
|
49
|
+
export default function App() {
|
|
50
|
+
const { state, handlers } = useGridState();
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<Grid
|
|
54
|
+
columns={columns}
|
|
55
|
+
payload={{ data, total: data.length }}
|
|
56
|
+
state={state}
|
|
57
|
+
{...handlers}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## API Reference
|
|
66
|
+
|
|
67
|
+
### `<Grid />`
|
|
68
|
+
|
|
69
|
+
The top-level component that renders the full data grid.
|
|
70
|
+
|
|
71
|
+
| Prop | Type | Required | Description |
|
|
72
|
+
| ----------------------- | ------------------------------------------ | -------- | -------------------------------------------------------- |
|
|
73
|
+
| `columns` | `ColumnDef<T>[]` | ✅ | Column definitions (TanStack Table format) |
|
|
74
|
+
| `payload` | `{ data: T[], total: number }` | ✅ | Row data and total count for pagination |
|
|
75
|
+
| `state` | `Partial<TableState>` | ✅ | Controlled table state (from `useGridState`) |
|
|
76
|
+
| `onColumnFiltersChange` | `OnChangeFn<ColumnFiltersState>` | — | Callback for column filter changes |
|
|
77
|
+
| `onPaginationChange` | `OnChangeFn<PaginationState>` | — | Callback for pagination changes |
|
|
78
|
+
| `onSortingChange` | `OnChangeFn<SortingState>` | — | Callback for sort changes |
|
|
79
|
+
| `setGlobalFilter` | `Dispatch<SetStateAction<string>>` | — | Callback to update the global search filter |
|
|
80
|
+
| `isLoading` | `boolean` | — | Displays a loading state |
|
|
81
|
+
| `isError` | `boolean` | — | Displays an error state |
|
|
82
|
+
| `manualPagination` | `boolean` | — | Set `true` for server-side pagination (default: `false`) |
|
|
83
|
+
| `getRowCanExpand` | `(row: Row<T>) => boolean` | — | Controls which rows are expandable |
|
|
84
|
+
| `renderSubComponent` | `(props: { row: Row<T> }) => ReactElement` | — | Renders expanded row content |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### `useGridState()`
|
|
89
|
+
|
|
90
|
+
Hook that provides controlled state and event handlers to pass into `<Grid />`.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
const { state, handlers } = useGridState();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Returns:**
|
|
97
|
+
|
|
98
|
+
| Key | Description |
|
|
99
|
+
| ---------- | ----------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| `state` | Partial `TableState` object (sorting, pagination, filters, etc.) |
|
|
101
|
+
| `handlers` | Object containing `onSortingChange`, `onPaginationChange`, `onColumnFiltersChange`, `setGlobalFilter` |
|
|
102
|
+
|
|
103
|
+
Spread `handlers` directly onto `<Grid />`:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<Grid state={state} {...handlers} columns={columns} payload={payload} />
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Column Definitions
|
|
112
|
+
|
|
113
|
+
Columns follow the standard [TanStack Table `ColumnDef`](https://tanstack.com/table/latest/docs/api/core/column-def) format with an additional `meta` field for filter configuration.
|
|
114
|
+
|
|
115
|
+
### Filter Variants
|
|
116
|
+
|
|
117
|
+
Set `meta.filterVariant` on a column to control its filter UI:
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
{
|
|
121
|
+
accessorKey: 'status',
|
|
122
|
+
header: 'Status',
|
|
123
|
+
meta: {
|
|
124
|
+
filterVariant: 'select', // dropdown filter
|
|
71
125
|
},
|
|
72
|
-
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
{
|
|
129
|
+
accessorKey: 'age',
|
|
130
|
+
header: 'Age',
|
|
131
|
+
meta: {
|
|
132
|
+
filterVariant: 'text', // text input filter
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Row Number Column
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
{
|
|
141
|
+
accessorFn: (_row, index) => index + 1,
|
|
142
|
+
cell: ({ row }) => row.index + 1,
|
|
143
|
+
id: 'rowNumber',
|
|
144
|
+
header: '',
|
|
145
|
+
size: 54,
|
|
146
|
+
maxSize: 54,
|
|
147
|
+
enableColumnFilter: false,
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Checkbox Selection Column
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
{
|
|
155
|
+
id: 'select',
|
|
156
|
+
header: ({ table }) => (
|
|
157
|
+
<Checkbox
|
|
158
|
+
checked={
|
|
159
|
+
table.getIsAllPageRowsSelected() ||
|
|
160
|
+
(table.getIsSomePageRowsSelected() && 'indeterminate')
|
|
161
|
+
}
|
|
162
|
+
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
|
|
163
|
+
aria-label="Select all"
|
|
164
|
+
/>
|
|
165
|
+
),
|
|
166
|
+
cell: ({ row }) => (
|
|
167
|
+
<Checkbox
|
|
168
|
+
checked={row.getIsSelected()}
|
|
169
|
+
onCheckedChange={(value) => row.toggleSelected(!!value)}
|
|
170
|
+
aria-label="Select row"
|
|
171
|
+
/>
|
|
172
|
+
),
|
|
173
|
+
size: 40,
|
|
174
|
+
maxSize: 40,
|
|
175
|
+
enableColumnFilter: false,
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Server-Side Pagination
|
|
182
|
+
|
|
183
|
+
Set `manualPagination` to `true` and pass `payload.total` as the full server-side count.
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
<Grid
|
|
187
|
+
columns={columns}
|
|
188
|
+
payload={{ data: serverData, total: serverTotal }}
|
|
189
|
+
state={state}
|
|
190
|
+
{...handlers}
|
|
191
|
+
manualPagination={true}
|
|
192
|
+
/>
|
|
73
193
|
```
|
|
194
|
+
|
|
195
|
+
The built-in pagination UI supports the following page sizes:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Expandable Rows
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
<Grid
|
|
207
|
+
columns={columns}
|
|
208
|
+
payload={payload}
|
|
209
|
+
state={state}
|
|
210
|
+
{...handlers}
|
|
211
|
+
getRowCanExpand={(row) => !!row.original.subRows?.length}
|
|
212
|
+
renderSubComponent={({ row }) => (
|
|
213
|
+
<div className="p-4">
|
|
214
|
+
<pre>{JSON.stringify(row.original, null, 2)}</pre>
|
|
215
|
+
</div>
|
|
216
|
+
)}
|
|
217
|
+
/>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Column Pinning
|
|
223
|
+
|
|
224
|
+
Column pinning is managed internally by the grid. No additional configuration is required — use the built-in toolbar UI to pin columns left or right.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Default Column Sizing
|
|
229
|
+
|
|
230
|
+
| Property | Default |
|
|
231
|
+
| --------- | ------- |
|
|
232
|
+
| `size` | `180px` |
|
|
233
|
+
| `minSize` | `180px` |
|
|
234
|
+
| `maxSize` | `180px` |
|
|
235
|
+
|
|
236
|
+
Override per-column:
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
{
|
|
240
|
+
accessorKey: 'id',
|
|
241
|
+
size: 60,
|
|
242
|
+
minSize: 60,
|
|
243
|
+
maxSize: 60,
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## TypeScript
|
|
250
|
+
|
|
251
|
+
All props and hooks are fully typed. Import types directly from the package:
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
import type { ColumnDef } from 'munza-x-data-grid';
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
TanStack Table types (`Row`, `TableState`, `PaginationState`, etc.) are re-exported and available from `@tanstack/react-table`.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Badge };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
5
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Button };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Collapsible as CollapsiblePrimitive } from 'radix-ui';
|
|
2
|
+
declare function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
declare const DebouncedInput: ({ value: initialValue, onChange, debounce, ...props }: {
|
|
3
|
+
value: string | number;
|
|
4
|
+
onChange: (value: string | number) => void;
|
|
5
|
+
debounce?: number;
|
|
6
|
+
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange">) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default DebouncedInput;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DropdownMenuContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
variant?: 'default' | 'destructive';
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {
|
|
13
|
+
inset?: boolean;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function DropdownMenuRadioItem({ className, children, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
|
|
17
|
+
inset?: boolean;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
20
|
+
inset?: boolean;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
26
|
+
inset?: boolean;
|
|
27
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
declare function Empty({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function EmptyHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const emptyMediaVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "icon" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
declare function EmptyMedia({ className, variant, ...props }: React.ComponentProps<'div'> & VariantProps<typeof emptyMediaVariants>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function EmptyTitle({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function EmptyDescription({ className, ...props }: React.ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function EmptyContent({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type NativeSelectProps = Omit<React.ComponentProps<'select'>, 'size'> & {
|
|
3
|
+
size?: 'sm' | 'default';
|
|
4
|
+
};
|
|
5
|
+
declare function NativeSelect({ className, size, ...props }: NativeSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function NativeSelectOption({ ...props }: React.ComponentProps<'option'>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function NativeSelectOptGroup({ className, ...props }: React.ComponentProps<'optgroup'>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Separator as SeparatorPrimitive } from 'radix-ui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<typeof SeparatorPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export { Separator };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<'table'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<'thead'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<'tbody'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<'tr'>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<'th'>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<'td'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<'caption'>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ColumnDef, ColumnFiltersState, OnChangeFn, PaginationState, Row, SortingState, Table, TableState } from '@tanstack/react-table';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface GridContextProps<T> {
|
|
4
|
+
table: Table<T>;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
isError?: boolean;
|
|
7
|
+
paneRef1: React.RefObject<HTMLDivElement | null>;
|
|
8
|
+
paneRef2: React.RefObject<HTMLDivElement | null>;
|
|
9
|
+
globalFilter?: string;
|
|
10
|
+
setGlobalFilter?: React.Dispatch<React.SetStateAction<string>>;
|
|
11
|
+
renderSubComponent?: (props: {
|
|
12
|
+
row: Row<T>;
|
|
13
|
+
}) => React.ReactElement;
|
|
14
|
+
}
|
|
15
|
+
declare const GridContext: React.Context<GridContextProps<any> | undefined>;
|
|
16
|
+
interface GridContextProviderProps<T> {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
payload?: {
|
|
19
|
+
data: T[];
|
|
20
|
+
total: number;
|
|
21
|
+
};
|
|
22
|
+
columns: ColumnDef<T>[];
|
|
23
|
+
state?: Partial<TableState>;
|
|
24
|
+
onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>;
|
|
25
|
+
onPaginationChange?: OnChangeFn<PaginationState>;
|
|
26
|
+
onSortingChange?: OnChangeFn<SortingState>;
|
|
27
|
+
manualPagination?: boolean;
|
|
28
|
+
isLoading?: boolean;
|
|
29
|
+
isError?: boolean;
|
|
30
|
+
setGlobalFilter?: React.Dispatch<React.SetStateAction<string>>;
|
|
31
|
+
renderSubComponent?: (props: {
|
|
32
|
+
row: Row<T>;
|
|
33
|
+
}) => React.ReactElement;
|
|
34
|
+
getRowCanExpand?: (row: Row<T>) => boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const GridContextProvider: <T>({ children, payload, columns, state, onColumnFiltersChange, onPaginationChange, onSortingChange, setGlobalFilter, manualPagination, isError, isLoading, getRowCanExpand, renderSubComponent, }: GridContextProviderProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export default GridContext;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { GridProps } from '../types';
|
|
2
|
+
declare const Grid: <T>({ columns, payload, state, onColumnFiltersChange, onPaginationChange, onSortingChange, isLoading, isError, setGlobalFilter, getRowCanExpand, renderSubComponent, manualPagination, }: GridProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export { Grid };
|