@segmentify/ui 0.0.21 → 0.0.23
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/app.d.ts +12 -0
- package/dist/components/atoms/table.d.ts +5 -12
- package/dist/components/molecules/base-button.d.ts +2 -7
- package/dist/components/molecules/combobox-field.d.ts +15 -16
- package/dist/components/molecules/debounced-input.d.ts +11 -3
- package/dist/components/organisms/data-table/column-visibility.d.ts +7 -0
- package/dist/components/organisms/data-table/content.d.ts +8 -0
- package/dist/components/organisms/data-table/context.d.ts +9 -0
- package/dist/components/organisms/data-table/index.d.ts +13 -0
- package/dist/components/organisms/data-table/pagination.d.ts +7 -0
- package/dist/components/organisms/data-table/root.d.ts +12 -0
- package/dist/components/organisms/data-table/search.d.ts +7 -0
- package/dist/components/organisms/data-table/toolbar.d.ts +7 -0
- package/dist/components/organisms/form-combobox.d.ts +6 -8
- package/dist/components/organisms/form-file-upload.d.ts +3 -5
- package/dist/components/organisms/form-password.d.ts +3 -5
- package/dist/components/organisms/form-radio.d.ts +3 -5
- package/dist/components/organisms/form-slider.d.ts +5 -7
- package/dist/components/organisms/form-switch.d.ts +3 -5
- package/dist/components/organisms/form-textarea.d.ts +3 -5
- package/dist/hooks/use-data-table.d.ts +133 -0
- package/dist/index.d.ts +2 -1
- package/dist/mock.d.ts +3 -0
- package/dist/segmentify-ui.cjs +85 -82
- package/dist/segmentify-ui.js +18476 -15902
- package/dist/ui.css +168 -39
- package/package.json +3 -1
package/dist/app.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
+
export type Product = {
|
|
2
|
+
id: number;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
price: number;
|
|
6
|
+
discountPercentage: number;
|
|
7
|
+
rating: number;
|
|
8
|
+
stock: number;
|
|
9
|
+
brand: string;
|
|
10
|
+
category: string;
|
|
11
|
+
thumbnail: string;
|
|
12
|
+
};
|
|
1
13
|
declare function App(): import("react/jsx-runtime").JSX.Element;
|
|
2
14
|
export default App;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
declare function Table({ className, ...props }: React.ComponentProps<'table'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
|
|
4
|
-
disableHover?: boolean;
|
|
5
|
-
};
|
|
6
|
-
declare function TableHeader({ className, disableHover, ...props }: TableHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
declare function TableHead({ className, ...props }: React.ComponentProps<'th'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<'thead'>): import("react/jsx-runtime").JSX.Element;
|
|
8
4
|
declare function TableBody({ className, ...props }: React.ComponentProps<'tbody'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
declare function TableRow({ className, disableHover, ...props }: TableRowProps): 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;
|
|
14
8
|
declare function TableCell({ className, ...props }: React.ComponentProps<'td'>): import("react/jsx-runtime").JSX.Element;
|
|
15
9
|
declare function TableCaption({ className, ...props }: React.ComponentProps<'caption'>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
|
|
17
|
-
export { Table, TableHeader, TableBody, TableHeadRow, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|
|
@@ -2,19 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import { buttonVariants } from '../../lib/design-variants';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
import type { Union } from 'ts-toolbelt';
|
|
5
|
-
type BaseProps = {
|
|
6
|
-
className?: string;
|
|
7
|
-
type?: 'button' | 'submit' | 'reset';
|
|
5
|
+
type BaseProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'children'> & {
|
|
8
6
|
size?: VariantProps<typeof buttonVariants>['size'];
|
|
9
7
|
variant?: VariantProps<typeof buttonVariants>['variant'];
|
|
10
8
|
label?: string;
|
|
11
9
|
suffix?: boolean;
|
|
12
10
|
prefix?: boolean;
|
|
13
11
|
isLoading?: boolean;
|
|
14
|
-
onClick?: () => void;
|
|
15
12
|
labelClassName?: string;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
form?: string;
|
|
18
13
|
};
|
|
19
14
|
type IconOnlyProps = BaseProps & {
|
|
20
15
|
isIconOnly: true;
|
|
@@ -25,5 +20,5 @@ type DefaultButtonProps = BaseProps & {
|
|
|
25
20
|
icon?: React.ReactNode;
|
|
26
21
|
};
|
|
27
22
|
type BaseButtonProps = Union.Strict<IconOnlyProps | DefaultButtonProps>;
|
|
28
|
-
declare const BaseButton:
|
|
23
|
+
declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
29
24
|
export { BaseButton };
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { SelectItemProps } from '../../lib/types';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type TriggerProps = {
|
|
3
|
+
trigger: React.ReactNode;
|
|
4
|
+
triggerPlaceholder?: never;
|
|
5
|
+
} | {
|
|
6
|
+
trigger?: never;
|
|
7
|
+
triggerPlaceholder: string;
|
|
8
|
+
};
|
|
9
|
+
type Props = TriggerProps & {
|
|
4
10
|
isDisabled?: boolean;
|
|
5
11
|
options: SelectItemProps[];
|
|
6
|
-
triggerPlaceholder: string;
|
|
7
12
|
isFormControlWrapper?: boolean;
|
|
8
13
|
avoidCollisions?: boolean;
|
|
9
14
|
contentClassName?: string;
|
|
@@ -12,21 +17,15 @@ type BaseProps = {
|
|
|
12
17
|
containerClassName?: string;
|
|
13
18
|
contentListClassName?: string;
|
|
14
19
|
closeOnSelect?: boolean;
|
|
20
|
+
align?: 'start' | 'center' | 'end';
|
|
15
21
|
label?: string;
|
|
16
|
-
onInputChange
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
value: string[];
|
|
22
|
+
onInputChange?: (inputValue: string) => void;
|
|
23
|
+
clearable?: boolean;
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
value: string | string[];
|
|
26
|
+
onValueChange: (value: string | string[]) => void;
|
|
22
27
|
hasAllOption?: boolean;
|
|
23
28
|
allOptionLabel?: string;
|
|
24
|
-
handleSelectAll: (value: string | string[], availableOptions: SelectItemProps[]) => void;
|
|
25
|
-
};
|
|
26
|
-
type SingleSelectProps = BaseProps & {
|
|
27
|
-
isMultiSelect?: false;
|
|
28
|
-
value: string;
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
export declare const ComboboxField: ({ value, isDisabled, hasAllOption, isMultiSelect, options, allOptionLabel, triggerPlaceholder, isFormControlWrapper, avoidCollisions, contentClassName, inputPlaceholder, emptyMessage, containerClassName, contentListClassName, closeOnSelect, label, handleSelectItem, handleSelectAll, onInputChange, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const ComboboxField: ({ value, isDisabled, hasAllOption, multiple, options, allOptionLabel, triggerPlaceholder, trigger, isFormControlWrapper, avoidCollisions, align, contentClassName, inputPlaceholder, emptyMessage, containerClassName, contentListClassName, closeOnSelect, label, onValueChange, onInputChange, clearable, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
32
31
|
export {};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { O } from 'ts-toolbelt';
|
|
2
|
+
interface BaseSearchInputProps {
|
|
3
3
|
value: string;
|
|
4
4
|
onChange: (value: string) => void;
|
|
5
5
|
placeholder: string;
|
|
6
6
|
className?: string;
|
|
7
|
-
label?: string;
|
|
8
7
|
inputClassName?: string;
|
|
9
8
|
}
|
|
9
|
+
type WithLabelProps = O.Merge<BaseSearchInputProps, {
|
|
10
|
+
label: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}>;
|
|
13
|
+
type WithoutLabelProps = O.Merge<BaseSearchInputProps, {
|
|
14
|
+
label?: undefined;
|
|
15
|
+
name?: string;
|
|
16
|
+
}>;
|
|
17
|
+
type SearchInputProps = WithLabelProps | WithoutLabelProps;
|
|
10
18
|
declare function DebouncedInput({ value, onChange, className, inputClassName, name, placeholder, label }: SearchInputProps): import("react/jsx-runtime").JSX.Element;
|
|
11
19
|
export { DebouncedInput };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface ColumnVisibilityProps {
|
|
2
|
+
inputPlaceholder?: string;
|
|
3
|
+
emptyMessage?: string;
|
|
4
|
+
allOptionLabel?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function ColumnVisibility({ inputPlaceholder, emptyMessage, allOptionLabel, }: ColumnVisibilityProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface ContentProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
loadingContent?: ReactNode;
|
|
5
|
+
emptyContent?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function Content({ className, loadingContent, emptyContent, }: ContentProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Table as TanstackTable } from '@tanstack/react-table';
|
|
2
|
+
export interface DataTableContextValue<TData> {
|
|
3
|
+
table: TanstackTable<TData>;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
globalFilter: string;
|
|
6
|
+
onGlobalFilterChange: (value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const DataTableContext: import("react").Context<DataTableContextValue<unknown> | null>;
|
|
9
|
+
export declare function useDataTableContext<TData>(): DataTableContextValue<TData>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Root } from './root';
|
|
2
|
+
import { Toolbar } from './toolbar';
|
|
3
|
+
import { Search } from './search';
|
|
4
|
+
import { ColumnVisibility } from './column-visibility';
|
|
5
|
+
import { Content } from './content';
|
|
6
|
+
export declare const DataTable: {
|
|
7
|
+
Root: typeof Root;
|
|
8
|
+
Toolbar: typeof Toolbar;
|
|
9
|
+
Search: typeof Search;
|
|
10
|
+
ColumnVisibility: typeof ColumnVisibility;
|
|
11
|
+
Content: typeof Content;
|
|
12
|
+
Pagination: ({ showSelectedCount, previousLabel, nextLabel, className, }: import("./pagination").PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface PaginationProps {
|
|
2
|
+
showSelectedCount?: boolean;
|
|
3
|
+
previousLabel?: string;
|
|
4
|
+
nextLabel?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const Pagination: ({ showSelectedCount, previousLabel, nextLabel, className, }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { type Table as TanstackTable } from '@tanstack/react-table';
|
|
3
|
+
interface RootProps<TData> {
|
|
4
|
+
table: TanstackTable<TData>;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
globalFilter?: string;
|
|
8
|
+
onGlobalFilterChange?: (value: string) => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function Root<TData>({ table, children, isLoading, globalFilter, onGlobalFilterChange, className, }: RootProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
2
1
|
import type { SelectItemProps } from '../../lib/types';
|
|
3
|
-
type
|
|
4
|
-
name:
|
|
5
|
-
control?: Control<TFieldValues>;
|
|
2
|
+
type Props = {
|
|
3
|
+
name: string;
|
|
6
4
|
label: string;
|
|
7
5
|
triggerPlaceholder: string;
|
|
8
6
|
inputPlaceholder: string;
|
|
9
7
|
options: SelectItemProps[];
|
|
10
8
|
description?: string;
|
|
11
|
-
|
|
9
|
+
multiple?: boolean;
|
|
12
10
|
emptyMessage: string;
|
|
13
11
|
containerClassName?: string;
|
|
14
12
|
contentClassName?: string;
|
|
15
13
|
contentListClassName?: string;
|
|
16
14
|
avoidCollisions?: boolean;
|
|
17
|
-
|
|
15
|
+
clearable?: boolean;
|
|
18
16
|
hasAllOption?: boolean;
|
|
19
17
|
allOptionLabel?: string;
|
|
20
18
|
closeOnSelect?: boolean;
|
|
21
|
-
onInputChange
|
|
19
|
+
onInputChange?: (inputValue: string) => void;
|
|
22
20
|
isDisabled?: boolean;
|
|
23
21
|
tooltipContent?: string;
|
|
24
22
|
};
|
|
25
|
-
export declare const FormCombobox:
|
|
23
|
+
export declare const FormCombobox: ({ name, label, triggerPlaceholder, inputPlaceholder, options, description, multiple, emptyMessage, containerClassName, contentClassName, contentListClassName, avoidCollisions, clearable, hasAllOption, allOptionLabel, closeOnSelect, onInputChange, isDisabled, tooltipContent, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
26
24
|
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
2
1
|
import type { ClassValue } from 'clsx';
|
|
3
|
-
type FormFileUploadProps
|
|
4
|
-
name:
|
|
5
|
-
control?: Control<TFieldValues>;
|
|
2
|
+
type FormFileUploadProps = {
|
|
3
|
+
name: string;
|
|
6
4
|
label?: string;
|
|
7
5
|
uploadButtonLabel?: string;
|
|
8
6
|
description?: string;
|
|
@@ -15,7 +13,7 @@ type FormFileUploadProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
|
15
13
|
onUpload?: (file: File) => Promise<string>;
|
|
16
14
|
};
|
|
17
15
|
export declare const FormFileUpload: {
|
|
18
|
-
|
|
16
|
+
({ name, label, uploadButtonLabel, description, accept, disabled, multiple, containerClassName, tooltipContent, hasRequiredIndicator, onUpload, }: FormFileUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
19
17
|
displayName: string;
|
|
20
18
|
};
|
|
21
19
|
export {};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
2
1
|
import type { ClassValue } from 'clsx';
|
|
3
|
-
type Props
|
|
2
|
+
type Props = {
|
|
4
3
|
label: string;
|
|
5
|
-
name:
|
|
4
|
+
name: string;
|
|
6
5
|
placeholder: string;
|
|
7
|
-
control?: Control<TFieldValues>;
|
|
8
6
|
containerClassName?: ClassValue;
|
|
9
7
|
description?: string;
|
|
10
8
|
tooltipContent?: string;
|
|
11
9
|
hasRequiredIndicator?: boolean;
|
|
12
10
|
};
|
|
13
|
-
export declare const FormPassword:
|
|
11
|
+
export declare const FormPassword: ({ label, name, containerClassName, description, placeholder, tooltipContent, hasRequiredIndicator, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
12
|
export {};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
2
1
|
import type { SelectItemProps } from '../../lib/types';
|
|
3
|
-
type Props
|
|
4
|
-
name:
|
|
2
|
+
type Props = {
|
|
3
|
+
name: string;
|
|
5
4
|
label: string;
|
|
6
5
|
items: SelectItemProps[];
|
|
7
|
-
control?: Control<TFieldValues>;
|
|
8
6
|
containerClassName?: string;
|
|
9
7
|
itemClassName?: string;
|
|
10
8
|
itemLabelClassName?: string;
|
|
11
9
|
selectedClassName?: string;
|
|
12
10
|
description?: string;
|
|
13
11
|
};
|
|
14
|
-
export declare const FormRadio:
|
|
12
|
+
export declare const FormRadio: ({ name, label, items, containerClassName, itemClassName, itemLabelClassName, selectedClassName, description, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
13
|
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
3
2
|
import { Slider } from '../../components/atoms/slider';
|
|
4
|
-
type FormSliderProps
|
|
5
|
-
name:
|
|
6
|
-
control?: Control<TFieldValues>;
|
|
3
|
+
type FormSliderProps = {
|
|
4
|
+
name: string;
|
|
7
5
|
label?: string;
|
|
8
6
|
description?: string;
|
|
9
7
|
min?: number;
|
|
@@ -12,12 +10,12 @@ type FormSliderProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
|
12
10
|
leftLabel?: string;
|
|
13
11
|
rightLabel?: string;
|
|
14
12
|
showLabels?: boolean;
|
|
15
|
-
complementaryField?:
|
|
13
|
+
complementaryField?: string;
|
|
16
14
|
onValueChange?: (value: number) => void;
|
|
17
15
|
containerClassName?: string;
|
|
18
16
|
labelClassName?: string;
|
|
19
17
|
showErrorPlaceholder?: boolean;
|
|
20
18
|
tooltipContent?: string;
|
|
21
|
-
} &
|
|
22
|
-
export declare const FormSlider:
|
|
19
|
+
} & React.ComponentProps<typeof Slider>;
|
|
20
|
+
export declare const FormSlider: ({ name, label, description, min, max, step, leftLabel, rightLabel, showLabels, complementaryField, onValueChange, containerClassName, labelClassName, showErrorPlaceholder, tooltipContent, ...props }: FormSliderProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
21
|
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
name: Path<TFieldValues>;
|
|
1
|
+
type Props = {
|
|
2
|
+
name: string;
|
|
4
3
|
label: string;
|
|
5
|
-
control?: Control<TFieldValues>;
|
|
6
4
|
description?: string;
|
|
7
5
|
};
|
|
8
|
-
export declare const FormSwitch:
|
|
6
|
+
export declare const FormSwitch: ({ name, label, description, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
7
|
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
type Props<TFieldValues extends FieldValues = FieldValues> = {
|
|
1
|
+
type Props = {
|
|
3
2
|
label: string;
|
|
4
|
-
name:
|
|
3
|
+
name: string;
|
|
5
4
|
placeholder: string;
|
|
6
|
-
control?: Control<TFieldValues>;
|
|
7
5
|
description?: string;
|
|
8
6
|
containerClassName?: string;
|
|
9
7
|
};
|
|
10
|
-
export declare const FormTextarea:
|
|
8
|
+
export declare const FormTextarea: ({ label, name, description, placeholder, containerClassName, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
9
|
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { type ColumnDef, type ColumnFiltersState, type SortingState, type VisibilityState, type PaginationState, type RowSelectionState, type Table } from '@tanstack/react-table';
|
|
2
|
+
import { type UseQueryOptions } from '@tanstack/react-query';
|
|
3
|
+
export interface FetcherParams {
|
|
4
|
+
pageIndex: number;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
sorting: SortingState;
|
|
7
|
+
columnFilters: ColumnFiltersState;
|
|
8
|
+
globalFilter: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FetcherResponse<TData> {
|
|
11
|
+
data: TData[];
|
|
12
|
+
totalCount?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface UseDataTableOptions<TData> {
|
|
15
|
+
/**
|
|
16
|
+
* Unique key for the query cache
|
|
17
|
+
* @required
|
|
18
|
+
*/
|
|
19
|
+
queryKey: string;
|
|
20
|
+
/**
|
|
21
|
+
* Column definitions for the table
|
|
22
|
+
*/
|
|
23
|
+
columns: ColumnDef<TData>[];
|
|
24
|
+
/**
|
|
25
|
+
* Fetcher function to load data
|
|
26
|
+
* Receives fetch params and should return data + optional totalCount
|
|
27
|
+
*/
|
|
28
|
+
fetcher: (params: FetcherParams) => Promise<FetcherResponse<TData>>;
|
|
29
|
+
/**
|
|
30
|
+
* Initial page size
|
|
31
|
+
* @default 10
|
|
32
|
+
*/
|
|
33
|
+
initialPageSize?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Initial sorting state
|
|
36
|
+
*/
|
|
37
|
+
initialSorting?: SortingState;
|
|
38
|
+
/**
|
|
39
|
+
* Initial column visibility
|
|
40
|
+
*/
|
|
41
|
+
initialColumnVisibility?: VisibilityState;
|
|
42
|
+
/**
|
|
43
|
+
* Whether pagination is handled manually (server-side)
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
manualPagination?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether sorting is handled manually (server-side)
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
manualSorting?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether filtering is handled manually (server-side)
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
manualFiltering?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Additional react-query options
|
|
59
|
+
* Allows customizing staleTime, gcTime, refetchInterval, etc.
|
|
60
|
+
*/
|
|
61
|
+
queryOptions?: Omit<UseQueryOptions<FetcherResponse<TData>, Error>, 'queryKey' | 'queryFn'>;
|
|
62
|
+
}
|
|
63
|
+
export interface UseDataTableReturn<TData> {
|
|
64
|
+
/**
|
|
65
|
+
* The table instance from @tanstack/react-table
|
|
66
|
+
*/
|
|
67
|
+
table: Table<TData>;
|
|
68
|
+
/**
|
|
69
|
+
* The current data array
|
|
70
|
+
*/
|
|
71
|
+
data: TData[];
|
|
72
|
+
/**
|
|
73
|
+
* Whether the initial data is loading (no data yet)
|
|
74
|
+
*/
|
|
75
|
+
isLoading: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether data is being fetched (including background refetches)
|
|
78
|
+
*/
|
|
79
|
+
isFetching: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether a refetch is in progress
|
|
82
|
+
*/
|
|
83
|
+
isRefetching: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Error if the fetch failed
|
|
86
|
+
*/
|
|
87
|
+
error: Error | null;
|
|
88
|
+
/**
|
|
89
|
+
* Total count of items (for pagination)
|
|
90
|
+
*/
|
|
91
|
+
totalCount: number;
|
|
92
|
+
/**
|
|
93
|
+
* Refetch the data
|
|
94
|
+
*/
|
|
95
|
+
refetch: () => void;
|
|
96
|
+
/**
|
|
97
|
+
* Current global filter value
|
|
98
|
+
*/
|
|
99
|
+
globalFilter: string;
|
|
100
|
+
/**
|
|
101
|
+
* Set the global filter
|
|
102
|
+
*/
|
|
103
|
+
setGlobalFilter: (value: string) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Current sorting state
|
|
106
|
+
*/
|
|
107
|
+
sorting: SortingState;
|
|
108
|
+
/**
|
|
109
|
+
* Current pagination state
|
|
110
|
+
*/
|
|
111
|
+
pagination: PaginationState;
|
|
112
|
+
/**
|
|
113
|
+
* Current column filters
|
|
114
|
+
*/
|
|
115
|
+
columnFilters: ColumnFiltersState;
|
|
116
|
+
/**
|
|
117
|
+
* Current column visibility
|
|
118
|
+
*/
|
|
119
|
+
columnVisibility: VisibilityState;
|
|
120
|
+
/**
|
|
121
|
+
* Current row selection
|
|
122
|
+
*/
|
|
123
|
+
rowSelection: RowSelectionState;
|
|
124
|
+
/**
|
|
125
|
+
* Whether the query is in success state
|
|
126
|
+
*/
|
|
127
|
+
isSuccess: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the query is in error state
|
|
130
|
+
*/
|
|
131
|
+
isError: boolean;
|
|
132
|
+
}
|
|
133
|
+
export declare function useDataTable<TData>({ queryKey, columns, fetcher, initialPageSize, initialSorting, initialColumnVisibility, manualPagination, manualSorting, manualFiltering, queryOptions, }: UseDataTableOptions<TData>): UseDataTableReturn<TData>;
|
package/dist/index.d.ts
CHANGED
|
@@ -66,10 +66,11 @@ export { Spinner } from './components/atoms/spinner';
|
|
|
66
66
|
export { Switch } from './components/atoms/switch';
|
|
67
67
|
export { SwitchField } from './components/molecules/switch-field';
|
|
68
68
|
export { Tabs, TabsList, TabsTrigger, TabsContent } from './components/atoms/tabs';
|
|
69
|
-
export { Table, TableHeader, TableBody,
|
|
69
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, } from './components/atoms/table';
|
|
70
70
|
export { Textarea } from './components/atoms/textarea';
|
|
71
71
|
export { TextAreaField } from './components/molecules/textarea-field';
|
|
72
72
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './components/atoms/tooltip';
|
|
73
73
|
export { TooltipField } from './components/molecules/tooltip-field';
|
|
74
74
|
export { QuillEditor } from './components/atoms/quill-editor';
|
|
75
|
+
export { useDataTable, type UseDataTableOptions, type UseDataTableReturn, type FetcherParams, type FetcherResponse, } from './hooks/use-data-table';
|
|
75
76
|
export { cn } from './lib/utils';
|
package/dist/mock.d.ts
ADDED