@nccirtu/tablefy 0.1.1 → 0.1.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/columns/columns/actions-column.d.ts +26 -0
- package/dist/columns/columns/avatar-group-column.d.ts +38 -0
- package/dist/columns/columns/badge-column.d.ts +22 -0
- package/dist/columns/columns/base-column.d.ts +19 -0
- package/dist/columns/columns/button-column.d.ts +14 -0
- package/dist/columns/columns/checkbox-column.d.ts +5 -0
- package/dist/columns/columns/date-column.d.ts +24 -0
- package/dist/columns/columns/dropdown-column.d.ts +17 -0
- package/dist/columns/columns/icon-column.d.ts +58 -0
- package/dist/columns/columns/image-column.d.ts +21 -0
- package/dist/columns/columns/index.d.ts +16 -0
- package/dist/columns/columns/input-column.d.ts +14 -0
- package/dist/columns/columns/link-column.d.ts +27 -0
- package/dist/columns/columns/number-column.d.ts +23 -0
- package/dist/columns/columns/progress-column.d.ts +30 -0
- package/dist/columns/columns/select-column.d.ts +19 -0
- package/dist/columns/columns/text-column.d.ts +14 -0
- package/dist/columns/columns/types.d.ts +37 -0
- package/dist/columns/components/animata/list/avatar-list.d.ts +12 -0
- package/dist/columns/components/ui/badge.d.ts +9 -0
- package/dist/columns/components/ui/button.d.ts +10 -0
- package/dist/columns/components/ui/checkbox.d.ts +4 -0
- package/dist/columns/components/ui/data-table/data-table-empty.d.ts +8 -0
- package/dist/columns/components/ui/data-table/data-table-header.d.ts +15 -0
- package/dist/columns/components/ui/data-table/data-table-pagination.d.ts +9 -0
- package/dist/columns/components/ui/data-table/data-table-schema.d.ts +5 -0
- package/dist/columns/components/ui/data-table/data-table.d.ts +13 -0
- package/dist/columns/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/columns/components/ui/input.d.ts +3 -0
- package/dist/columns/components/ui/progress.d.ts +4 -0
- package/dist/columns/components/ui/select.d.ts +15 -0
- package/dist/columns/components/ui/table.d.ts +10 -0
- package/dist/columns/components/ui/tooltip.d.ts +7 -0
- package/dist/columns/index.d.ts +15 -13
- package/dist/columns/index.esm.js +10331 -0
- package/dist/columns/index.esm.js.map +1 -0
- package/dist/columns/index.js +10365 -0
- package/dist/columns/index.js.map +1 -0
- package/dist/columns/lib/builders/empty-state.d.ts +27 -0
- package/dist/columns/lib/builders/index.d.ts +2 -0
- package/dist/columns/lib/builders/table-schema.d.ts +15 -0
- package/dist/columns/lib/types/actions.d.ts +20 -0
- package/dist/columns/lib/types/empty-state.d.ts +18 -0
- package/dist/columns/lib/types/filters.d.ts +25 -0
- package/dist/columns/lib/types/index.d.ts +4 -0
- package/dist/columns/lib/types/table.d.ts +41 -0
- package/dist/columns/lib/utils.d.ts +1 -0
- package/package.json +14 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
interface ActionItem<TData> {
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
onClick?: (row: TData) => void;
|
|
7
|
+
href?: (row: TData) => string;
|
|
8
|
+
variant?: 'default' | 'destructive';
|
|
9
|
+
separator?: boolean;
|
|
10
|
+
hidden?: (row: TData) => boolean;
|
|
11
|
+
disabled?: (row: TData) => boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class ActionsColumn<TData> {
|
|
14
|
+
private config;
|
|
15
|
+
static make<TData>(): ActionsColumn<TData>;
|
|
16
|
+
label(label: string): this;
|
|
17
|
+
triggerIcon(icon: ReactNode): this;
|
|
18
|
+
action(action: ActionItem<TData>): this;
|
|
19
|
+
view(onClick: (row: TData) => void): this;
|
|
20
|
+
edit(onClick: (row: TData) => void): this;
|
|
21
|
+
delete(onClick: (row: TData) => void): this;
|
|
22
|
+
link(label: string, href: (row: TData) => string): this;
|
|
23
|
+
separator(): this;
|
|
24
|
+
build(): ColumnDef<TData, unknown>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumn } from "./base-column";
|
|
3
|
+
import { BaseColumnConfig } from "./types";
|
|
4
|
+
interface AvatarItem {
|
|
5
|
+
src?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
fallback?: string;
|
|
8
|
+
}
|
|
9
|
+
interface AvatarGroupColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
10
|
+
maxVisible?: number;
|
|
11
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
12
|
+
overlap?: "none" | "sm" | "md" | "lg";
|
|
13
|
+
showTooltip?: boolean;
|
|
14
|
+
nameField?: keyof TData | ((row: TData) => AvatarItem[]);
|
|
15
|
+
srcField?: string;
|
|
16
|
+
fallbackField?: string;
|
|
17
|
+
showNames?: boolean;
|
|
18
|
+
maxNames?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class AvatarGroupColumn<TData> extends BaseColumn<TData, AvatarGroupColumnConfig<TData>> {
|
|
21
|
+
constructor(accessor: keyof TData | string);
|
|
22
|
+
static make<TData>(accessor: keyof TData | string): AvatarGroupColumn<TData>;
|
|
23
|
+
maxVisible(max: number): this;
|
|
24
|
+
size(size: "xs" | "sm" | "md" | "lg"): this;
|
|
25
|
+
overlap(overlap: "none" | "sm" | "md" | "lg"): this;
|
|
26
|
+
noOverlap(): this;
|
|
27
|
+
hideTooltip(): this;
|
|
28
|
+
fields(config: {
|
|
29
|
+
src?: string;
|
|
30
|
+
name: string;
|
|
31
|
+
fallback?: string;
|
|
32
|
+
}): this;
|
|
33
|
+
mapItems(fn: (row: TData) => AvatarItem[]): this;
|
|
34
|
+
showNames(show?: boolean, max?: number): this;
|
|
35
|
+
private toContactItems;
|
|
36
|
+
build(): ColumnDef<TData, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { BaseColumn } from "./base-column";
|
|
4
|
+
import { BadgeColumnConfig } from "./types";
|
|
5
|
+
type BadgeVariant = "default" | "secondary" | "destructive" | "outline" | "success" | "warning" | "info" | "muted";
|
|
6
|
+
interface VariantConfig {
|
|
7
|
+
label?: string;
|
|
8
|
+
variant?: BadgeVariant;
|
|
9
|
+
className?: string;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare class BadgeColumn<TData> extends BaseColumn<TData, BadgeColumnConfig<TData>> {
|
|
13
|
+
static make<TData>(accessor: keyof TData | string): BadgeColumn<TData>;
|
|
14
|
+
variants(variants: Record<string, VariantConfig>): this;
|
|
15
|
+
boolean(trueLabel?: string, falseLabel?: string): this;
|
|
16
|
+
status(statuses: Record<string, {
|
|
17
|
+
label: string;
|
|
18
|
+
color: string;
|
|
19
|
+
}>): this;
|
|
20
|
+
build(): ColumnDef<TData, unknown>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { BaseColumnConfig } from './types';
|
|
3
|
+
export declare abstract class BaseColumn<TData, TConfig extends BaseColumnConfig<TData>> {
|
|
4
|
+
protected config: TConfig;
|
|
5
|
+
constructor(accessor: keyof TData | string);
|
|
6
|
+
label(label: string): this;
|
|
7
|
+
sortable(sortable?: boolean): this;
|
|
8
|
+
searchable(searchable?: boolean): this;
|
|
9
|
+
hidden(hidden?: boolean): this;
|
|
10
|
+
alignLeft(): this;
|
|
11
|
+
alignCenter(): this;
|
|
12
|
+
alignRight(): this;
|
|
13
|
+
width(width: string | number): this;
|
|
14
|
+
className(className: string): this;
|
|
15
|
+
headerClassName(className: string): this;
|
|
16
|
+
cellClassName(className: string): this;
|
|
17
|
+
abstract build(): ColumnDef<TData, unknown>;
|
|
18
|
+
protected getAlignmentClass(): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ButtonColumnConfig {
|
|
2
|
+
accessorKey?: string;
|
|
3
|
+
header?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
onClick?: (data: any) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ButtonColumn: (config: ButtonColumnConfig) => {
|
|
8
|
+
accessorKey: string;
|
|
9
|
+
header: string;
|
|
10
|
+
cell: ({ row }: {
|
|
11
|
+
row: any;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
export { ButtonColumn as buttonColumn };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { BaseColumn } from './base-column';
|
|
3
|
+
import { BaseColumnConfig } from './types';
|
|
4
|
+
interface DateColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
5
|
+
format?: 'short' | 'long' | 'relative' | 'time' | 'datetime' | string;
|
|
6
|
+
locale?: string;
|
|
7
|
+
showIcon?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class DateColumn<TData> extends BaseColumn<TData, DateColumnConfig<TData>> {
|
|
10
|
+
constructor(accessor: keyof TData | string);
|
|
11
|
+
static make<TData>(accessor: keyof TData | string): DateColumn<TData>;
|
|
12
|
+
format(format: 'short' | 'long' | 'relative' | 'time' | 'datetime'): this;
|
|
13
|
+
locale(locale: string): this;
|
|
14
|
+
withIcon(show?: boolean): this;
|
|
15
|
+
short(): this;
|
|
16
|
+
long(): this;
|
|
17
|
+
relative(): this;
|
|
18
|
+
time(): this;
|
|
19
|
+
datetime(): this;
|
|
20
|
+
private formatDate;
|
|
21
|
+
private getRelativeTime;
|
|
22
|
+
build(): ColumnDef<TData, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface DropdownOption {
|
|
2
|
+
label: string;
|
|
3
|
+
onClick?: (data: any) => void;
|
|
4
|
+
}
|
|
5
|
+
interface DropdownColumnConfig {
|
|
6
|
+
accessorKey?: string;
|
|
7
|
+
header?: string;
|
|
8
|
+
options: DropdownOption[];
|
|
9
|
+
}
|
|
10
|
+
export declare const DropdownColumn: (config: DropdownColumnConfig) => {
|
|
11
|
+
accessorKey: string;
|
|
12
|
+
header: string;
|
|
13
|
+
cell: ({ row }: {
|
|
14
|
+
row: any;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
};
|
|
17
|
+
export { DropdownColumn as dropdownColumn };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { BaseColumn } from './base-column';
|
|
5
|
+
import { BaseColumnConfig } from './types';
|
|
6
|
+
interface IconState {
|
|
7
|
+
icon: ReactNode | LucideIcon;
|
|
8
|
+
label?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
bgColor?: string;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
}
|
|
13
|
+
interface IconColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
14
|
+
states?: Record<string, IconState>;
|
|
15
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
16
|
+
showLabel?: boolean;
|
|
17
|
+
showTooltip?: boolean;
|
|
18
|
+
withBackground?: boolean;
|
|
19
|
+
defaultIcon?: ReactNode;
|
|
20
|
+
defaultLabel?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class IconColumn<TData> extends BaseColumn<TData, IconColumnConfig<TData>> {
|
|
23
|
+
constructor(accessor: keyof TData | string);
|
|
24
|
+
static make<TData>(accessor: keyof TData | string): IconColumn<TData>;
|
|
25
|
+
state(value: string, config: IconState): this;
|
|
26
|
+
states(states: Record<string, IconState>): this;
|
|
27
|
+
size(size: 'xs' | 'sm' | 'md' | 'lg'): this;
|
|
28
|
+
showLabel(show?: boolean): this;
|
|
29
|
+
hideTooltip(): this;
|
|
30
|
+
withBackground(show?: boolean): this;
|
|
31
|
+
default(icon: ReactNode, label?: string): this;
|
|
32
|
+
boolean(config?: {
|
|
33
|
+
trueIcon?: ReactNode;
|
|
34
|
+
falseIcon?: ReactNode;
|
|
35
|
+
trueLabel?: string;
|
|
36
|
+
falseLabel?: string;
|
|
37
|
+
trueColor?: string;
|
|
38
|
+
falseColor?: string;
|
|
39
|
+
trueBgColor?: string;
|
|
40
|
+
falseBgColor?: string;
|
|
41
|
+
}): this;
|
|
42
|
+
activeInactive(): this;
|
|
43
|
+
onlineStatus(): this;
|
|
44
|
+
priority(): this;
|
|
45
|
+
verification(): this;
|
|
46
|
+
private createCheckIcon;
|
|
47
|
+
private createXIcon;
|
|
48
|
+
private createCircleIcon;
|
|
49
|
+
private createArrowUpIcon;
|
|
50
|
+
private createArrowDownIcon;
|
|
51
|
+
private createMinusIcon;
|
|
52
|
+
private createAlertIcon;
|
|
53
|
+
private createShieldCheckIcon;
|
|
54
|
+
private createShieldXIcon;
|
|
55
|
+
private createClockIcon;
|
|
56
|
+
build(): ColumnDef<TData, unknown>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { BaseColumn } from './base-column';
|
|
3
|
+
import { BaseColumnConfig } from './types';
|
|
4
|
+
interface ImageColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
5
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
|
+
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
7
|
+
fallback?: string;
|
|
8
|
+
alt?: (row: TData) => string;
|
|
9
|
+
}
|
|
10
|
+
export declare class ImageColumn<TData> extends BaseColumn<TData, ImageColumnConfig<TData>> {
|
|
11
|
+
constructor(accessor: keyof TData | string);
|
|
12
|
+
static make<TData>(accessor: keyof TData | string): ImageColumn<TData>;
|
|
13
|
+
size(size: 'sm' | 'md' | 'lg'): this;
|
|
14
|
+
rounded(rounded: 'none' | 'sm' | 'md' | 'lg' | 'full'): this;
|
|
15
|
+
circular(): this;
|
|
16
|
+
square(): this;
|
|
17
|
+
fallback(url: string): this;
|
|
18
|
+
alt(fn: (row: TData) => string): this;
|
|
19
|
+
build(): ColumnDef<TData, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { AvatarGroupColumn } from "./avatar-group-column";
|
|
2
|
+
export { BadgeColumn } from "./badge-column";
|
|
3
|
+
export { ButtonColumn } from "./button-column";
|
|
4
|
+
export { CheckboxColumn } from "./checkbox-column";
|
|
5
|
+
export { DateColumn } from "./date-column";
|
|
6
|
+
export { DropdownColumn } from "./dropdown-column";
|
|
7
|
+
export { IconColumn } from "./icon-column";
|
|
8
|
+
export { ImageColumn } from "./image-column";
|
|
9
|
+
export { InputColumn } from "./input-column";
|
|
10
|
+
export { LinkColumn } from "./link-column";
|
|
11
|
+
export { NumberColumn } from "./number-column";
|
|
12
|
+
export { ProgressColumn } from "./progress-column";
|
|
13
|
+
export { SelectColumn } from "./select-column";
|
|
14
|
+
export { TextColumn } from "./text-column";
|
|
15
|
+
export { ActionsColumn } from "./actions-column";
|
|
16
|
+
export type * from "./types";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface InputColumnConfig {
|
|
2
|
+
accessorKey?: string;
|
|
3
|
+
header?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
onChange?: (data: any, value: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const InputColumn: (config: InputColumnConfig) => {
|
|
8
|
+
accessorKey: string;
|
|
9
|
+
header: string;
|
|
10
|
+
cell: ({ row }: {
|
|
11
|
+
row: any;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
export { InputColumn as inputColumn };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BaseColumn } from './base-column';
|
|
4
|
+
import { BaseColumnConfig } from './types';
|
|
5
|
+
interface LinkColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
6
|
+
href?: string | ((row: TData) => string);
|
|
7
|
+
external?: boolean;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
showExternalIcon?: boolean;
|
|
10
|
+
underline?: 'always' | 'hover' | 'never';
|
|
11
|
+
openInNewTab?: boolean;
|
|
12
|
+
onClick?: (row: TData) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare class LinkColumn<TData> extends BaseColumn<TData, LinkColumnConfig<TData>> {
|
|
15
|
+
constructor(accessor: keyof TData | string);
|
|
16
|
+
static make<TData>(accessor: keyof TData | string): LinkColumn<TData>;
|
|
17
|
+
href(href: string | ((row: TData) => string)): this;
|
|
18
|
+
urlFromField(field: keyof TData): this;
|
|
19
|
+
external(external?: boolean): this;
|
|
20
|
+
icon(icon: ReactNode): this;
|
|
21
|
+
showExternalIcon(show?: boolean): this;
|
|
22
|
+
underline(style: 'always' | 'hover' | 'never'): this;
|
|
23
|
+
openInNewTab(open?: boolean): this;
|
|
24
|
+
onClick(handler: (row: TData) => void): this;
|
|
25
|
+
build(): ColumnDef<TData, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { BaseColumn } from './base-column';
|
|
3
|
+
import { BaseColumnConfig } from './types';
|
|
4
|
+
interface NumberColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
5
|
+
decimals?: number;
|
|
6
|
+
locale?: string;
|
|
7
|
+
currency?: string;
|
|
8
|
+
percent?: boolean;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
suffix?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class NumberColumn<TData> extends BaseColumn<TData, NumberColumnConfig<TData>> {
|
|
13
|
+
constructor(accessor: keyof TData | string);
|
|
14
|
+
static make<TData>(accessor: keyof TData | string): NumberColumn<TData>;
|
|
15
|
+
decimals(decimals: number): this;
|
|
16
|
+
locale(locale: string): this;
|
|
17
|
+
money(currency?: string): this;
|
|
18
|
+
percent(): this;
|
|
19
|
+
prefix(prefix: string): this;
|
|
20
|
+
suffix(suffix: string): this;
|
|
21
|
+
build(): ColumnDef<TData, unknown>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { BaseColumn } from './base-column';
|
|
3
|
+
import { BaseColumnConfig } from './types';
|
|
4
|
+
interface ProgressColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
5
|
+
max?: number;
|
|
6
|
+
showValue?: boolean;
|
|
7
|
+
showPercentage?: boolean;
|
|
8
|
+
size?: 'sm' | 'md' | 'lg';
|
|
9
|
+
color?: 'default' | 'success' | 'warning' | 'danger' | ((value: number, max: number) => string);
|
|
10
|
+
thresholds?: {
|
|
11
|
+
warning?: number;
|
|
12
|
+
danger?: number;
|
|
13
|
+
};
|
|
14
|
+
format?: (value: number, max: number) => string;
|
|
15
|
+
}
|
|
16
|
+
export declare class ProgressColumn<TData> extends BaseColumn<TData, ProgressColumnConfig<TData>> {
|
|
17
|
+
constructor(accessor: keyof TData | string);
|
|
18
|
+
static make<TData>(accessor: keyof TData | string): ProgressColumn<TData>;
|
|
19
|
+
max(max: number): this;
|
|
20
|
+
showValue(show?: boolean): this;
|
|
21
|
+
showPercentage(show?: boolean): this;
|
|
22
|
+
hideLabel(): this;
|
|
23
|
+
size(size: 'sm' | 'md' | 'lg'): this;
|
|
24
|
+
color(color: 'default' | 'success' | 'warning' | 'danger'): this;
|
|
25
|
+
colorByThreshold(warning?: number, danger?: number): this;
|
|
26
|
+
colorByThresholdInverse(warning?: number, danger?: number): this;
|
|
27
|
+
format(fn: (value: number, max: number) => string): this;
|
|
28
|
+
build(): ColumnDef<TData, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface SelectOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
interface SelectColumnConfig {
|
|
6
|
+
accessorKey?: string;
|
|
7
|
+
header?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
options: SelectOption[];
|
|
10
|
+
onChange?: (data: any, value: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const SelectColumn: (config: SelectColumnConfig) => {
|
|
13
|
+
accessorKey: string;
|
|
14
|
+
header: string;
|
|
15
|
+
cell: ({ row }: {
|
|
16
|
+
row: any;
|
|
17
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
};
|
|
19
|
+
export { SelectColumn as selectColumn };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnDef, Row } from '@tanstack/react-table';
|
|
2
|
+
import { BaseColumn } from './base-column';
|
|
3
|
+
import { FormattedColumnConfig } from './types';
|
|
4
|
+
export declare class TextColumn<TData> extends BaseColumn<TData, FormattedColumnConfig<TData>> {
|
|
5
|
+
static make<TData>(accessor: keyof TData | string): TextColumn<TData>;
|
|
6
|
+
formatter(fn: (value: unknown, row: Row<TData>) => React.ReactNode): this;
|
|
7
|
+
prefix(prefix: string): this;
|
|
8
|
+
suffix(suffix: string): this;
|
|
9
|
+
placeholder(placeholder: string): this;
|
|
10
|
+
uppercase(): this;
|
|
11
|
+
lowercase(): this;
|
|
12
|
+
limit(chars: number): this;
|
|
13
|
+
build(): ColumnDef<TData, unknown>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Row } from '@tanstack/react-table';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface BaseColumnConfig<TData> {
|
|
4
|
+
accessor: keyof TData | string;
|
|
5
|
+
label?: string;
|
|
6
|
+
sortable?: boolean;
|
|
7
|
+
searchable?: boolean;
|
|
8
|
+
hidden?: boolean;
|
|
9
|
+
align?: 'left' | 'center' | 'right';
|
|
10
|
+
width?: string | number;
|
|
11
|
+
className?: string;
|
|
12
|
+
headerClassName?: string;
|
|
13
|
+
cellClassName?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface FormattedColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
16
|
+
formatter?: (value: unknown, row: Row<TData>) => ReactNode;
|
|
17
|
+
prefix?: string;
|
|
18
|
+
suffix?: string;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface BadgeColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
22
|
+
variants?: Record<string, {
|
|
23
|
+
label?: string;
|
|
24
|
+
variant?: 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'info' | 'muted';
|
|
25
|
+
className?: string;
|
|
26
|
+
icon?: ReactNode;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
export interface ActionConfig<TData> {
|
|
30
|
+
label: string;
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
onClick?: (row: TData) => void;
|
|
33
|
+
href?: (row: TData) => string;
|
|
34
|
+
variant?: 'default' | 'destructive' | 'ghost';
|
|
35
|
+
hidden?: (row: TData) => boolean;
|
|
36
|
+
disabled?: (row: TData) => boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const AvatarList: ({ items, maxVisible, size, ...props }: {
|
|
2
|
+
items: Array<{
|
|
3
|
+
id: string;
|
|
4
|
+
src?: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
initials?: string;
|
|
7
|
+
}>;
|
|
8
|
+
maxVisible?: number;
|
|
9
|
+
size?: number | string;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default AvatarList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "secondary" | "outline" | "ghost" | "destructive" | "success" | "warning" | "info" | "muted" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/dist/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, badgeVariants };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "secondary" | "outline" | "ghost" | "destructive" | "table_header" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | "table_header" | "xs" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/dist/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, buttonVariants };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EmptyStateConfig } from "@/lib/types";
|
|
2
|
+
interface DataTableEmptyProps {
|
|
3
|
+
config: EmptyStateConfig;
|
|
4
|
+
colSpan: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function DataTableEmpty({ config, colSpan, className, }: DataTableEmptyProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Table as TanstackTable } from "@tanstack/react-table";
|
|
2
|
+
import { HeaderAction, SearchConfig } from "@/lib/types";
|
|
3
|
+
interface DataTableHeaderProps<TData> {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
actions?: HeaderAction<TData>[];
|
|
7
|
+
search?: SearchConfig;
|
|
8
|
+
searchValue?: string;
|
|
9
|
+
onSearchChange?: (value: string) => void;
|
|
10
|
+
table?: TanstackTable<TData>;
|
|
11
|
+
selectedCount?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function DataTableHeader<TData>({ title, description, actions, search, searchValue, onSearchChange, table, selectedCount, className, }: DataTableHeaderProps<TData>): import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Table as TanstackTable } from "@tanstack/react-table";
|
|
2
|
+
import { PaginationConfig } from "@/lib/types";
|
|
3
|
+
interface DataTablePaginationProps<TData> {
|
|
4
|
+
table: TanstackTable<TData>;
|
|
5
|
+
config?: PaginationConfig;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function DataTablePagination<TData>({ table, config, className, }: DataTablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { DataTableConfig } from "@/lib/types";
|
|
3
|
+
interface DataTableProps<TData, TValue> {
|
|
4
|
+
columns: ColumnDef<TData, TValue>[];
|
|
5
|
+
data: TData[];
|
|
6
|
+
config?: DataTableConfig<TData>;
|
|
7
|
+
className?: string;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
isError?: boolean;
|
|
10
|
+
onRetry?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function DataTable<TData, TValue>({ columns, data, config, className, isLoading, isError, onRetry, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
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, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
3
|
+
declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function SelectGroup({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
7
|
+
size?: "sm" | "default";
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function SelectContent({ className, children, position, align, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -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, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
3
|
+
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|