@eintrek/erp-theme 1.0.4 → 1.4.4
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/dist/components/data-table/data-table-cell.d.ts +35 -0
- package/dist/components/data-table/data-table-column-header.d.ts +9 -0
- package/dist/components/data-table/data-table-config.d.ts +124 -0
- package/dist/components/data-table/data-table-date-filter.d.ts +8 -0
- package/dist/components/data-table/data-table-faceted-filter.d.ts +10 -0
- package/dist/components/data-table/data-table-filter-dropdown.d.ts +12 -0
- package/dist/components/data-table/data-table-filter-list.d.ts +11 -0
- package/dist/components/data-table/data-table-pagination.d.ts +21 -0
- package/dist/components/data-table/data-table-range-filter.d.ts +11 -0
- package/dist/components/data-table/data-table-skeleton.d.ts +11 -0
- package/dist/components/data-table/data-table-slider-filter.d.ts +6 -0
- package/dist/components/data-table/data-table-sort-list.d.ts +8 -0
- package/dist/components/data-table/data-table-toolbar.d.ts +12 -0
- package/dist/components/data-table/data-table-types.d.ts +115 -0
- package/dist/components/data-table/data-table-view-options.d.ts +6 -0
- package/dist/components/data-table/data-table.d.ts +11 -0
- package/dist/components/data-table/hooks/use-callback-ref.d.ts +9 -0
- package/dist/components/data-table/hooks/use-data-table.d.ts +24 -0
- package/dist/components/data-table/hooks/use-debounced-callback.d.ts +4 -0
- package/dist/components/data-table/hooks/use-media-query.d.ts +1 -0
- package/dist/components/data-table/index.d.ts +17 -0
- package/dist/components/ui/custom-select-field2.d.ts +18 -0
- package/dist/components/ui/date-picker-field.d.ts +13 -0
- package/dist/components/ui/date-picker.d.ts +19 -0
- package/dist/components/ui/file-uploader.d.ts +33 -0
- package/dist/components/ui/form-skeleton.d.ts +11 -0
- package/dist/components/ui/input-field.d.ts +13 -0
- package/dist/components/ui/loading-screen.d.ts +1 -0
- package/dist/components/ui/page-header.d.ts +7 -0
- package/dist/components/ui/select-field.d.ts +31 -0
- package/dist/components/ui/textarea-field.d.ts +13 -0
- package/dist/components/ui/validation-errors.d.ts +25 -0
- package/dist/hooks/use-debounce.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +16123 -5962
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16182 -5967
- package/dist/index.js.map +1 -1
- package/dist/lib/baht-text.d.ts +1 -0
- package/dist/lib/date-utils.d.ts +71 -0
- package/dist/lib/file.d.ts +20 -0
- package/dist/lib/format.d.ts +35 -0
- package/package.json +7 -4
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
interface DataTableCellProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
title?: string;
|
|
5
|
+
truncate?: boolean;
|
|
6
|
+
maxWidth?: string;
|
|
7
|
+
showTooltip?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
lineClamp?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Reusable cell component with truncation and tooltip support
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Basic usage with truncation
|
|
16
|
+
* <DataTableCell truncate title="Full text content">
|
|
17
|
+
* Long text that will be truncated
|
|
18
|
+
* </DataTableCell>
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Multi-line truncation
|
|
22
|
+
* <DataTableCell truncate lineClamp={2} maxWidth="300px">
|
|
23
|
+
* Multi-line text content
|
|
24
|
+
* </DataTableCell>
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Without truncation (default)
|
|
28
|
+
* <DataTableCell>
|
|
29
|
+
* Normal cell content
|
|
30
|
+
* </DataTableCell>
|
|
31
|
+
*/
|
|
32
|
+
export declare function DataTableCell({ children, title, truncate, maxWidth, width, showTooltip, lineClamp, className, ...props }: DataTableCellProps & {
|
|
33
|
+
width?: string;
|
|
34
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Column } from "@tanstack/react-table";
|
|
2
|
+
import { DropdownMenuTrigger } from "../../index";
|
|
3
|
+
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
4
|
+
column: Column<TData, TValue>;
|
|
5
|
+
title: string;
|
|
6
|
+
sortable?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function DataTableColumnHeader<TData, TValue>({ column, title, className, sortable, ...props }: DataTableColumnHeaderProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export type DataTableConfig = typeof dataTableConfig;
|
|
2
|
+
export declare const dataTableConfig: {
|
|
3
|
+
textOperators: ({
|
|
4
|
+
label: string;
|
|
5
|
+
value: "iLike";
|
|
6
|
+
} | {
|
|
7
|
+
label: string;
|
|
8
|
+
value: "notILike";
|
|
9
|
+
} | {
|
|
10
|
+
label: string;
|
|
11
|
+
value: "eq";
|
|
12
|
+
} | {
|
|
13
|
+
label: string;
|
|
14
|
+
value: "ne";
|
|
15
|
+
} | {
|
|
16
|
+
label: string;
|
|
17
|
+
value: "isEmpty";
|
|
18
|
+
} | {
|
|
19
|
+
label: string;
|
|
20
|
+
value: "isNotEmpty";
|
|
21
|
+
})[];
|
|
22
|
+
numericOperators: ({
|
|
23
|
+
label: string;
|
|
24
|
+
value: "eq";
|
|
25
|
+
} | {
|
|
26
|
+
label: string;
|
|
27
|
+
value: "ne";
|
|
28
|
+
} | {
|
|
29
|
+
label: string;
|
|
30
|
+
value: "lt";
|
|
31
|
+
} | {
|
|
32
|
+
label: string;
|
|
33
|
+
value: "lte";
|
|
34
|
+
} | {
|
|
35
|
+
label: string;
|
|
36
|
+
value: "gt";
|
|
37
|
+
} | {
|
|
38
|
+
label: string;
|
|
39
|
+
value: "gte";
|
|
40
|
+
} | {
|
|
41
|
+
label: string;
|
|
42
|
+
value: "isBetween";
|
|
43
|
+
} | {
|
|
44
|
+
label: string;
|
|
45
|
+
value: "isEmpty";
|
|
46
|
+
} | {
|
|
47
|
+
label: string;
|
|
48
|
+
value: "isNotEmpty";
|
|
49
|
+
})[];
|
|
50
|
+
dateOperators: ({
|
|
51
|
+
label: string;
|
|
52
|
+
value: "eq";
|
|
53
|
+
} | {
|
|
54
|
+
label: string;
|
|
55
|
+
value: "ne";
|
|
56
|
+
} | {
|
|
57
|
+
label: string;
|
|
58
|
+
value: "lt";
|
|
59
|
+
} | {
|
|
60
|
+
label: string;
|
|
61
|
+
value: "gt";
|
|
62
|
+
} | {
|
|
63
|
+
label: string;
|
|
64
|
+
value: "lte";
|
|
65
|
+
} | {
|
|
66
|
+
label: string;
|
|
67
|
+
value: "gte";
|
|
68
|
+
} | {
|
|
69
|
+
label: string;
|
|
70
|
+
value: "isBetween";
|
|
71
|
+
} | {
|
|
72
|
+
label: string;
|
|
73
|
+
value: "isRelativeToToday";
|
|
74
|
+
} | {
|
|
75
|
+
label: string;
|
|
76
|
+
value: "isEmpty";
|
|
77
|
+
} | {
|
|
78
|
+
label: string;
|
|
79
|
+
value: "isNotEmpty";
|
|
80
|
+
})[];
|
|
81
|
+
selectOperators: ({
|
|
82
|
+
label: string;
|
|
83
|
+
value: "eq";
|
|
84
|
+
} | {
|
|
85
|
+
label: string;
|
|
86
|
+
value: "ne";
|
|
87
|
+
} | {
|
|
88
|
+
label: string;
|
|
89
|
+
value: "isEmpty";
|
|
90
|
+
} | {
|
|
91
|
+
label: string;
|
|
92
|
+
value: "isNotEmpty";
|
|
93
|
+
})[];
|
|
94
|
+
multiSelectOperators: ({
|
|
95
|
+
label: string;
|
|
96
|
+
value: "inArray";
|
|
97
|
+
} | {
|
|
98
|
+
label: string;
|
|
99
|
+
value: "notInArray";
|
|
100
|
+
} | {
|
|
101
|
+
label: string;
|
|
102
|
+
value: "isEmpty";
|
|
103
|
+
} | {
|
|
104
|
+
label: string;
|
|
105
|
+
value: "isNotEmpty";
|
|
106
|
+
})[];
|
|
107
|
+
booleanOperators: ({
|
|
108
|
+
label: string;
|
|
109
|
+
value: "eq";
|
|
110
|
+
} | {
|
|
111
|
+
label: string;
|
|
112
|
+
value: "ne";
|
|
113
|
+
})[];
|
|
114
|
+
sortOrders: ({
|
|
115
|
+
label: string;
|
|
116
|
+
value: "asc";
|
|
117
|
+
} | {
|
|
118
|
+
label: string;
|
|
119
|
+
value: "desc";
|
|
120
|
+
})[];
|
|
121
|
+
filterVariants: readonly ["text", "number", "range", "date", "dateRange", "boolean", "select", "multiSelect"];
|
|
122
|
+
operators: readonly ["iLike", "notILike", "eq", "ne", "inArray", "notInArray", "isEmpty", "isNotEmpty", "lt", "lte", "gt", "gte", "isBetween", "isRelativeToToday"];
|
|
123
|
+
joinOperators: readonly ["and", "or"];
|
|
124
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Column } from "@tanstack/react-table";
|
|
2
|
+
interface DataTableDateFilterProps<TData> {
|
|
3
|
+
column: Column<TData, unknown>;
|
|
4
|
+
title?: string;
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function DataTableDateFilter<TData>({ column, title, multiple, }: DataTableDateFilterProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Column } from "@tanstack/react-table";
|
|
2
|
+
import type { Option } from "./data-table-types";
|
|
3
|
+
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
4
|
+
column?: Column<TData, TValue>;
|
|
5
|
+
title?: string;
|
|
6
|
+
options: Option[];
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function DataTableFacetedFilter<TData, TValue>({ column, title, options, multiple, }: DataTableFacetedFilterProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface DataTableFilterDropdownProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
buttonText?: string;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
variant?: "default" | "outline";
|
|
8
|
+
/** Applied to PopoverContent (e.g. min-w-[520px] for custom filter layout) */
|
|
9
|
+
contentClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function DataTableFilterDropdown({ children, className, buttonText, icon, variant, contentClassName, }: DataTableFilterDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Table } from "@tanstack/react-table";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { PopoverContent } from "../../index";
|
|
4
|
+
interface DataTableFilterListProps<TData> extends React.ComponentProps<typeof PopoverContent> {
|
|
5
|
+
table: Table<TData>;
|
|
6
|
+
debounceMs?: number;
|
|
7
|
+
throttleMs?: number;
|
|
8
|
+
shallow?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function DataTableFilterList<TData>({ table, debounceMs, throttleMs, shallow, ...props }: DataTableFilterListProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Table } from "@tanstack/react-table";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
interface DataTablePaginationProps<TData> extends React.ComponentProps<"div"> {
|
|
4
|
+
table: Table<TData>;
|
|
5
|
+
pageSizeOptions?: number[];
|
|
6
|
+
}
|
|
7
|
+
export declare function DataTablePagination<TData>({ table, pageSizeOptions, className, ...props }: DataTablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
/**
|
|
9
|
+
* SimplePagination - A standalone pagination component for non-DataTable use cases
|
|
10
|
+
*/
|
|
11
|
+
interface SimplePaginationProps extends React.ComponentProps<"div"> {
|
|
12
|
+
currentPage: number;
|
|
13
|
+
totalPages: number;
|
|
14
|
+
onPageChange: (page: number) => void;
|
|
15
|
+
totalItems?: number;
|
|
16
|
+
pageSize?: number;
|
|
17
|
+
pageSizeOptions?: number[];
|
|
18
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function SimplePagination({ currentPage, totalPages, onPageChange, totalItems, pageSize, pageSizeOptions, onPageSizeChange, className, ...props }: SimplePaginationProps): import("react/jsx-runtime").JSX.Element | null;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Column } from "@tanstack/react-table";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { ExtendedColumnFilter } from "./data-table-types";
|
|
4
|
+
interface DataTableRangeFilterProps<TData> extends React.ComponentProps<"div"> {
|
|
5
|
+
filter: ExtendedColumnFilter<TData>;
|
|
6
|
+
column: Column<TData>;
|
|
7
|
+
inputId: string;
|
|
8
|
+
onFilterUpdate: (filterId: string, updates: Partial<Omit<ExtendedColumnFilter<TData>, "filterId">>) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function DataTableRangeFilter<TData>({ filter, column, inputId, onFilterUpdate, className, ...props }: DataTableRangeFilterProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface DataTableSkeletonProps extends React.ComponentProps<"div"> {
|
|
2
|
+
columnCount: number;
|
|
3
|
+
rowCount?: number;
|
|
4
|
+
filterCount?: number;
|
|
5
|
+
cellWidths?: string[];
|
|
6
|
+
withViewOptions?: boolean;
|
|
7
|
+
withPagination?: boolean;
|
|
8
|
+
shrinkZero?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function DataTableSkeleton({ columnCount, rowCount, filterCount, cellWidths, withViewOptions, withPagination, shrinkZero, className, ...props }: DataTableSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Column } from "@tanstack/react-table";
|
|
2
|
+
interface DataTableSliderFilterProps<TData> {
|
|
3
|
+
column: Column<TData, unknown>;
|
|
4
|
+
}
|
|
5
|
+
export declare function DataTableSliderFilter<TData>({ column, }: DataTableSliderFilterProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Table } from "@tanstack/react-table";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { PopoverContent } from "../../index";
|
|
4
|
+
interface DataTableSortListProps<TData> extends React.ComponentProps<typeof PopoverContent> {
|
|
5
|
+
table: Table<TData>;
|
|
6
|
+
}
|
|
7
|
+
export declare function DataTableSortList<TData>({ table, ...props }: DataTableSortListProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Table } from "@tanstack/react-table";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
interface DataTableToolbarProps<TData> extends React.ComponentProps<"div"> {
|
|
4
|
+
table: Table<TData>;
|
|
5
|
+
mode?: "simple" | "advanced";
|
|
6
|
+
/** Custom filter content; when set, shown inside the filter dropdown instead of default column filters */
|
|
7
|
+
filterContent?: React.ReactNode;
|
|
8
|
+
/** Optional class for the filter dropdown popover when using filterContent (e.g. min-w-[560px]) */
|
|
9
|
+
filterDropdownContentClassName?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function DataTableToolbar<TData>({ table, mode, filterContent, filterDropdownContentClassName, className, ...props }: DataTableToolbarProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { ColumnSort, Row } from "@tanstack/react-table";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { DataTableConfig } from "./data-table-config";
|
|
5
|
+
import type { Column } from "@tanstack/react-table";
|
|
6
|
+
export interface Option {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
icon?: React.ComponentType<{
|
|
10
|
+
className?: string;
|
|
11
|
+
}>;
|
|
12
|
+
count?: number;
|
|
13
|
+
}
|
|
14
|
+
export type FilterOperator = DataTableConfig["operators"][number];
|
|
15
|
+
export type FilterVariant = DataTableConfig["filterVariants"][number];
|
|
16
|
+
export type JoinOperator = DataTableConfig["joinOperators"][number];
|
|
17
|
+
declare const filterItemSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodString;
|
|
19
|
+
value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
20
|
+
variant: z.ZodEnum<[string, ...string[]]>;
|
|
21
|
+
operator: z.ZodEnum<[string, ...string[]]>;
|
|
22
|
+
filterId: z.ZodString;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
id: string;
|
|
25
|
+
value: string | string[];
|
|
26
|
+
operator: string;
|
|
27
|
+
variant: string;
|
|
28
|
+
filterId: string;
|
|
29
|
+
}, {
|
|
30
|
+
id: string;
|
|
31
|
+
value: string | string[];
|
|
32
|
+
operator: string;
|
|
33
|
+
variant: string;
|
|
34
|
+
filterId: string;
|
|
35
|
+
}>;
|
|
36
|
+
export type FilterItemSchema = z.infer<typeof filterItemSchema>;
|
|
37
|
+
export interface ExtendedColumnFilter<TData> extends FilterItemSchema {
|
|
38
|
+
id: Extract<keyof TData, string>;
|
|
39
|
+
}
|
|
40
|
+
export interface ExtendedColumnSort<TData> extends Omit<ColumnSort, "id"> {
|
|
41
|
+
id: Extract<keyof TData, string>;
|
|
42
|
+
}
|
|
43
|
+
export interface ToolbarColumnMeta {
|
|
44
|
+
variant?: "text" | "number" | "range" | "date" | "dateRange" | "select" | "multiSelect" | "boolean";
|
|
45
|
+
label?: string;
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
unit?: string;
|
|
48
|
+
options?: Option[];
|
|
49
|
+
range?: [number, number];
|
|
50
|
+
icon?: React.ComponentType<{
|
|
51
|
+
className?: string;
|
|
52
|
+
}>;
|
|
53
|
+
sticky?: "left" | "right";
|
|
54
|
+
/** Pixel offset from the sticky edge — used when stacking multiple sticky
|
|
55
|
+
* columns on the same side (e.g. the second-to-right pinned column needs
|
|
56
|
+
* `stickyOffset` equal to the rightmost pinned column's width). */
|
|
57
|
+
stickyOffset?: number;
|
|
58
|
+
hideHeader?: boolean;
|
|
59
|
+
showLeftDivider?: boolean;
|
|
60
|
+
renderFilter?: (props: {
|
|
61
|
+
column: Column<unknown>;
|
|
62
|
+
}) => React.ReactNode;
|
|
63
|
+
}
|
|
64
|
+
export interface DataTableRowAction<TData> {
|
|
65
|
+
row: Row<TData>;
|
|
66
|
+
variant: "update" | "delete";
|
|
67
|
+
}
|
|
68
|
+
declare module "@tanstack/react-table" {
|
|
69
|
+
interface ColumnMeta<TData, TValue> extends ToolbarColumnMeta {
|
|
70
|
+
}
|
|
71
|
+
interface TableMeta<TData> {
|
|
72
|
+
queryKeys?: {
|
|
73
|
+
filters?: string;
|
|
74
|
+
joinOperator?: string;
|
|
75
|
+
sort?: string;
|
|
76
|
+
page?: string;
|
|
77
|
+
perPage?: string;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get filters state parser for URL synchronization
|
|
83
|
+
*/
|
|
84
|
+
export declare const getFiltersStateParser: <TData>(columnIds?: string[] | Set<string>) => import("nuqs/server").SingleParserBuilder<ExtendedColumnFilter<TData>[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Get common pinning styles for table columns
|
|
87
|
+
*/
|
|
88
|
+
export declare function getCommonPinningStyles<TData>({ column, withBorder, }: {
|
|
89
|
+
column: Column<TData>;
|
|
90
|
+
withBorder?: boolean;
|
|
91
|
+
}): React.CSSProperties;
|
|
92
|
+
/**
|
|
93
|
+
* Get filter operators for a specific filter variant
|
|
94
|
+
*/
|
|
95
|
+
export declare function getFilterOperators(filterVariant: FilterVariant): {
|
|
96
|
+
label: string;
|
|
97
|
+
value: FilterOperator;
|
|
98
|
+
}[];
|
|
99
|
+
/**
|
|
100
|
+
* Get default filter operator for a filter variant
|
|
101
|
+
*/
|
|
102
|
+
export declare function getDefaultFilterOperator(filterVariant: FilterVariant): "iLike" | "notILike" | "eq" | "ne" | "isEmpty" | "isNotEmpty" | "lt" | "lte" | "gt" | "gte" | "isBetween" | "isRelativeToToday" | "inArray" | "notInArray";
|
|
103
|
+
/**
|
|
104
|
+
* Get valid filters (remove empty/invalid filters)
|
|
105
|
+
*/
|
|
106
|
+
export declare function getValidFilters<TData>(filters: ExtendedColumnFilter<TData>[]): ExtendedColumnFilter<TData>[];
|
|
107
|
+
export declare const getSortingStateParser: <TData>(columnIds?: string[] | Set<string>) => import("nuqs/server").SingleParserBuilder<ExtendedColumnSort<TData>[]>;
|
|
108
|
+
export interface QueryKeys {
|
|
109
|
+
page: string;
|
|
110
|
+
perPage: string;
|
|
111
|
+
sort: string;
|
|
112
|
+
filters: string;
|
|
113
|
+
joinOperator: string;
|
|
114
|
+
}
|
|
115
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Table } from "@tanstack/react-table";
|
|
2
|
+
interface DataTableViewOptionsProps<TData> {
|
|
3
|
+
table: Table<TData>;
|
|
4
|
+
}
|
|
5
|
+
export declare function DataTableViewOptions<TData>({ table, }: DataTableViewOptionsProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Table as TanstackTable, type Row } from "@tanstack/react-table";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
interface DataTableProps<TData> extends React.ComponentProps<"div"> {
|
|
4
|
+
table: TanstackTable<TData>;
|
|
5
|
+
actionBar?: React.ReactNode;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
isFetching?: boolean;
|
|
8
|
+
getRowClassName?: (row: Row<TData>) => string;
|
|
9
|
+
}
|
|
10
|
+
export declare function DataTable<TData>({ table, actionBar, children, className, isLoading, isFetching, getRowClassName, ...props }: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://github.com/radix-ui/primitives/blob/main/packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
6
|
+
* prop or avoid re-executing effects when passed as a dependency
|
|
7
|
+
*/
|
|
8
|
+
declare function useCallbackRef<T extends (...args: never[]) => unknown>(callback: T | undefined): T;
|
|
9
|
+
export { useCallbackRef };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type TableOptions, type TableState } from "@tanstack/react-table";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { ExtendedColumnSort, QueryKeys } from "../data-table-types";
|
|
4
|
+
export interface UseDataTableProps<TData> extends Omit<TableOptions<TData>, "state" | "pageCount" | "getCoreRowModel" | "manualFiltering" | "manualPagination" | "manualSorting">, Required<Pick<TableOptions<TData>, "pageCount">> {
|
|
5
|
+
initialState?: Omit<Partial<TableState>, "sorting"> & {
|
|
6
|
+
sorting?: ExtendedColumnSort<TData>[];
|
|
7
|
+
};
|
|
8
|
+
queryKeys?: Partial<QueryKeys>;
|
|
9
|
+
history?: "push" | "replace";
|
|
10
|
+
debounceMs?: number;
|
|
11
|
+
throttleMs?: number;
|
|
12
|
+
clearOnDefault?: boolean;
|
|
13
|
+
enableAdvancedFilter?: boolean;
|
|
14
|
+
scroll?: boolean;
|
|
15
|
+
shallow?: boolean;
|
|
16
|
+
startTransition?: React.TransitionStartFunction;
|
|
17
|
+
resetOnMount?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function useDataTable<TData>(props: UseDataTableProps<TData>): {
|
|
20
|
+
table: import("@tanstack/react-table").Table<TData>;
|
|
21
|
+
shallow: boolean;
|
|
22
|
+
debounceMs: number;
|
|
23
|
+
throttleMs: number;
|
|
24
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see https://github.com/mantinedev/mantine/blob/master/packages/@mantine/hooks/src/use-debounced-callback/use-debounced-callback.ts
|
|
3
|
+
*/
|
|
4
|
+
export declare function useDebouncedCallback<T extends (...args: never[]) => unknown>(callback: T, delay: number): (...args: Parameters<T>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { DataTable } from "./data-table";
|
|
2
|
+
export { DataTableCell } from "./data-table-cell";
|
|
3
|
+
export { DataTableColumnHeader } from "./data-table-column-header";
|
|
4
|
+
export { DataTablePagination } from "./data-table-pagination";
|
|
5
|
+
export { DataTableSkeleton } from "./data-table-skeleton";
|
|
6
|
+
export { DataTableDateFilter } from "./data-table-date-filter";
|
|
7
|
+
export { DataTableFacetedFilter } from "./data-table-faceted-filter";
|
|
8
|
+
export { DataTableSliderFilter } from "./data-table-slider-filter";
|
|
9
|
+
export { DataTableToolbar } from "./data-table-toolbar";
|
|
10
|
+
export { DataTableViewOptions } from "./data-table-view-options";
|
|
11
|
+
export { DataTableSortList } from "./data-table-sort-list";
|
|
12
|
+
export { DataTableFilterList } from "./data-table-filter-list";
|
|
13
|
+
export { useDataTable, type UseDataTableProps } from "./hooks/use-data-table";
|
|
14
|
+
export { DataTableRangeFilter } from "./data-table-range-filter";
|
|
15
|
+
export { DataTableFilterDropdown } from "./data-table-filter-dropdown";
|
|
16
|
+
export { dataTableConfig, type DataTableConfig } from "./data-table-config";
|
|
17
|
+
export * from "./data-table-types";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Control, FieldValues, Path } from "react-hook-form";
|
|
2
|
+
interface CustomSelectField2Props<T extends FieldValues> {
|
|
3
|
+
name: Path<T>;
|
|
4
|
+
label: string;
|
|
5
|
+
control: Control<T>;
|
|
6
|
+
options: {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[];
|
|
10
|
+
placeholder: string;
|
|
11
|
+
searchPlaceholder?: string;
|
|
12
|
+
emptyText?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
readonly?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function CustomSelectField2<T extends FieldValues>({ name, label, control, options, placeholder, searchPlaceholder, emptyText, required, readonly, className, }: CustomSelectField2Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type DatePickerProps } from "./date-picker";
|
|
3
|
+
export interface DatePickerFieldProps extends DatePickerProps {
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
helperText?: React.ReactNode;
|
|
6
|
+
error?: React.ReactNode;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
containerClassName?: string;
|
|
9
|
+
labelClassName?: string;
|
|
10
|
+
messageClassName?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function DatePickerField({ id, label, helperText, error, required, containerClassName, labelClassName, messageClassName, className, ...props }: DatePickerFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { DatePickerField };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface DatePickerProps {
|
|
2
|
+
date?: Date;
|
|
3
|
+
onDateChange?: (date: Date | undefined) => void;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
/** Restrict which dates are selectable. Default: no future dates and no dates before 1900-01-01. */
|
|
7
|
+
disabledDates?: (date: Date) => boolean;
|
|
8
|
+
/** Override the trigger label format. Defaults to Intl `th-TH` long format. */
|
|
9
|
+
formatDate?: (date: Date) => string;
|
|
10
|
+
className?: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
/** Used as `aria-label` and trigger placeholder when no date is selected. */
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
"aria-required"?: boolean;
|
|
15
|
+
"aria-invalid"?: boolean;
|
|
16
|
+
"aria-describedby"?: string;
|
|
17
|
+
}
|
|
18
|
+
declare function DatePicker({ date, onDateChange, placeholder, disabled, disabledDates, formatDate, className, id, ariaLabel, "aria-required": ariaRequired, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export { DatePicker };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface UploadedFile {
|
|
2
|
+
id: string;
|
|
3
|
+
file: File;
|
|
4
|
+
title: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to convert File objects to UploadedFile format
|
|
9
|
+
*/
|
|
10
|
+
export declare const convertFilesToUploadedFiles: (files: File[] | undefined) => UploadedFile[];
|
|
11
|
+
/**
|
|
12
|
+
* Helper function to convert single File to UploadedFile format
|
|
13
|
+
*/
|
|
14
|
+
export declare const convertFileToUploadedFile: (file: File | undefined) => UploadedFile[];
|
|
15
|
+
export interface FileUploaderProps {
|
|
16
|
+
label: string;
|
|
17
|
+
helperText?: string;
|
|
18
|
+
accept?: string;
|
|
19
|
+
maxSizeMB?: number;
|
|
20
|
+
multiple?: boolean;
|
|
21
|
+
onFilesChange: (files: UploadedFile[]) => void;
|
|
22
|
+
mode?: "create" | "edit" | "view";
|
|
23
|
+
className?: string;
|
|
24
|
+
buttonText?: string;
|
|
25
|
+
initialFiles?: UploadedFile[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* FileUploader Component
|
|
29
|
+
*
|
|
30
|
+
* A simple file uploader with validation and download functionality.
|
|
31
|
+
* Displays uploaded files as blue clickable links.
|
|
32
|
+
*/
|
|
33
|
+
export declare function FileUploader({ label, helperText, accept, maxSizeMB, multiple, onFilesChange, mode, className, buttonText, initialFiles, }: FileUploaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface FormSkeletonSection {
|
|
2
|
+
title: string;
|
|
3
|
+
fieldRows: number[];
|
|
4
|
+
gridCols?: 1 | 2 | 3;
|
|
5
|
+
}
|
|
6
|
+
export interface FormSkeletonProps {
|
|
7
|
+
sections: FormSkeletonSection[];
|
|
8
|
+
showActionButtons?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function FormSkeleton({ sections, showActionButtons, className, }: FormSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface InputFieldProps extends Omit<React.ComponentProps<"input">, "ref"> {
|
|
3
|
+
label?: React.ReactNode;
|
|
4
|
+
helperText?: React.ReactNode;
|
|
5
|
+
error?: React.ReactNode;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
containerClassName?: string;
|
|
8
|
+
labelClassName?: string;
|
|
9
|
+
messageClassName?: string;
|
|
10
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
11
|
+
}
|
|
12
|
+
declare function InputField({ id, label, helperText, error, required, containerClassName, labelClassName, messageClassName, className, ref, ...props }: InputFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { InputField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LoadingScreen(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface SelectFieldOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface SelectFieldProps {
|
|
8
|
+
id?: string;
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
helperText?: React.ReactNode;
|
|
11
|
+
error?: React.ReactNode;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
onValueChange?: (value: string) => void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Declarative list of options. Ignored when `children` is provided. */
|
|
19
|
+
options?: SelectFieldOption[];
|
|
20
|
+
/** Use this to compose custom `<SelectContent>` children. Overrides `options`. */
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
containerClassName?: string;
|
|
23
|
+
labelClassName?: string;
|
|
24
|
+
triggerClassName?: string;
|
|
25
|
+
messageClassName?: string;
|
|
26
|
+
size?: "sm" | "default";
|
|
27
|
+
"aria-label"?: string;
|
|
28
|
+
"aria-describedby"?: string;
|
|
29
|
+
}
|
|
30
|
+
declare function SelectField({ id, label, helperText, error, required, placeholder, value, defaultValue, onValueChange, disabled, options, children, containerClassName, labelClassName, triggerClassName, messageClassName, size, "aria-label": ariaLabel, "aria-describedby": ariaDescribedby, }: SelectFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export { SelectField };
|