zaravand-ui 1.0.2 → 1.0.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/dist/components/Button/Button.d.ts +4 -0
- package/dist/components/Button/Button.interface.d.ts +13 -0
- package/dist/components/Button/Button.variant.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.d.ts +4 -0
- package/dist/components/Checkbox/Checkbox.interface.d.ts +19 -0
- package/dist/components/Checkbox/Checkbox.variant.d.ts +8 -0
- package/dist/components/DatePicker/DatePicker.d.ts +8 -0
- package/dist/components/DatePicker/DatePicker.interface.d.ts +44 -0
- package/dist/components/DatePicker/DatePicker.variant.d.ts +19 -0
- package/dist/components/Dialog/Dialog.d.ts +3 -0
- package/dist/components/Dialog/Dialog.interface.d.ts +21 -0
- package/dist/components/Dialog/Dialog.variant.d.ts +7 -0
- package/dist/components/Input/Input.d.ts +3 -0
- package/dist/components/Input/Input.interface.d.ts +24 -0
- package/dist/components/Input/Input.variant.d.ts +4 -0
- package/dist/components/Pagination/Pagination.d.ts +3 -0
- package/dist/components/Pagination/Pagination.interface.d.ts +12 -0
- package/dist/components/Pagination/Pagination.variant.d.ts +11 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +6 -0
- package/dist/components/RadioGroup/RadioGroup.interface.d.ts +34 -0
- package/dist/components/RadioGroup/RadioGroup.variant.d.ts +21 -0
- package/dist/components/Select/Select.d.ts +20 -0
- package/dist/components/Select/Select.filter.d.ts +8 -0
- package/dist/components/Select/Select.interface.d.ts +44 -0
- package/dist/components/Select/Select.variant.d.ts +13 -0
- package/dist/components/Sheet/Sheet.d.ts +3 -0
- package/dist/components/Sheet/Sheet.interface.d.ts +23 -0
- package/dist/components/Sheet/Sheet.variant.d.ts +10 -0
- package/dist/components/Skeleton/Skeleton.d.ts +3 -0
- package/dist/components/Skeleton/Skeleton.interface.d.ts +5 -0
- package/dist/components/Skeleton/Skeleton.variant.d.ts +2 -0
- package/dist/components/Spinner/Spinner.d.ts +3 -0
- package/dist/components/Spinner/Spinner.interface.d.ts +6 -0
- package/dist/components/Spinner/Spinner.variant.d.ts +10 -0
- package/dist/components/Table/Table.constants.d.ts +36 -0
- package/dist/components/Table/Table.d.ts +32 -0
- package/dist/components/Table/Table.interface.d.ts +142 -0
- package/dist/components/Table/Table.utils.d.ts +11 -0
- package/dist/components/Table/Table.variant.d.ts +11 -0
- package/dist/components/Table/TableEmptyState.d.ts +2 -0
- package/dist/components/Table/TablePaginationControls.d.ts +2 -0
- package/dist/components/Table/hooks/useTablePagination.d.ts +37 -0
- package/dist/components/Table/hooks/useTableSearch.d.ts +18 -0
- package/dist/components/Textarea/Textarea.d.ts +3 -0
- package/dist/components/Textarea/Textarea.interface.d.ts +23 -0
- package/dist/components/Textarea/Textarea.variant.d.ts +4 -0
- package/dist/components/Toast/Toast.d.ts +13 -0
- package/dist/components/Toast/Toast.interface.d.ts +6 -0
- package/dist/components/Toast/Toast.variant.d.ts +9 -0
- package/dist/components/Toast/ToastHost.d.ts +2 -0
- package/dist/components/Toast/function/showToast.d.ts +17 -0
- package/dist/components/Toast/function/toastVisual.d.ts +10 -0
- package/dist/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.interface.d.ts +13 -0
- package/dist/components/Tooltip/Tooltip.variant.d.ts +2 -0
- package/dist/components/shared/fieldStyles.d.ts +3 -0
- package/dist/index.cjs +3 -3
- package/dist/index.css +1 -1
- package/dist/index.d.ts +39 -0
- package/dist/index.js +30 -30
- package/dist/lib/utils.d.ts +5 -0
- package/dist/services/convertToPersianDigits/convertToPersianDigits.d.ts +5 -0
- package/dist/shared/theme.d.ts +26 -0
- package/package.json +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { SelectProps } from "../Select/Select.interface";
|
|
3
|
+
export type TableFieldType = 'text' | 'number' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'date';
|
|
4
|
+
type TableFieldValueByType = {
|
|
5
|
+
text: string;
|
|
6
|
+
number: number;
|
|
7
|
+
textarea: string;
|
|
8
|
+
select: string;
|
|
9
|
+
checkbox: boolean;
|
|
10
|
+
radio: string;
|
|
11
|
+
date: Date | string;
|
|
12
|
+
};
|
|
13
|
+
export type TableFieldValue = TableFieldValueByType[TableFieldType];
|
|
14
|
+
export type DynamicTableRow = Record<string, TableFieldValue | null | undefined>;
|
|
15
|
+
export type TableRowId = string | number;
|
|
16
|
+
export type TablePagingMode = 'pagination' | 'infinite';
|
|
17
|
+
export type TablePaginationToken = number | 'ellipsis-start' | 'ellipsis-end';
|
|
18
|
+
export type TableMutationHookResult = boolean | void | Promise<boolean | void>;
|
|
19
|
+
export type TableRowActionInput = {
|
|
20
|
+
row: DynamicTableRow;
|
|
21
|
+
rowIndex: number;
|
|
22
|
+
rowId?: TableRowId;
|
|
23
|
+
};
|
|
24
|
+
export type TableAddRowHandler = () => void | Promise<void>;
|
|
25
|
+
export type TableEditRowHandler = (input: TableRowActionInput) => void | Promise<void>;
|
|
26
|
+
export type TableDeleteRowHandler = (input: TableRowActionInput) => void | Promise<void>;
|
|
27
|
+
export type TableAction = {
|
|
28
|
+
icon: React.ReactNode;
|
|
29
|
+
onClick: (input: TableRowActionInput) => void | Promise<void>;
|
|
30
|
+
tooltip: string;
|
|
31
|
+
};
|
|
32
|
+
export type TableCellSelectChangeHandlerInput = {
|
|
33
|
+
row: DynamicTableRow;
|
|
34
|
+
previousRow: DynamicTableRow;
|
|
35
|
+
rowIndex: number;
|
|
36
|
+
rowId?: TableRowId;
|
|
37
|
+
columnKey: string;
|
|
38
|
+
value: string;
|
|
39
|
+
};
|
|
40
|
+
export type TableCellSelectChangeHandler = (input: TableCellSelectChangeHandlerInput) => TableMutationHookResult;
|
|
41
|
+
export type TableColumnViewType = "text" | "select";
|
|
42
|
+
type TableBaseSelectOptions = NonNullable<SelectProps["options"]>;
|
|
43
|
+
export type TableSelectOption = TableBaseSelectOptions[number];
|
|
44
|
+
export type TableSelectOptionsSource = NonNullable<SelectProps["remoteOptions"]>;
|
|
45
|
+
export type TableSchemaColumn = {
|
|
46
|
+
key: string;
|
|
47
|
+
label: string;
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
displayPlaceholder?: string;
|
|
50
|
+
/**
|
|
51
|
+
* When true for checkbox fields, value must be `true` on submit.
|
|
52
|
+
*/
|
|
53
|
+
mustBeChecked?: boolean;
|
|
54
|
+
view: boolean;
|
|
55
|
+
viewType?: TableColumnViewType;
|
|
56
|
+
type: TableFieldType;
|
|
57
|
+
options?: TableSelectOption[];
|
|
58
|
+
optionsSource?: TableSelectOptionsSource;
|
|
59
|
+
};
|
|
60
|
+
export type TableSchemaPagination = {
|
|
61
|
+
page: number;
|
|
62
|
+
pageSize: number;
|
|
63
|
+
totalItems: number;
|
|
64
|
+
/**
|
|
65
|
+
* Used for remote paging. `mode` indicates whether page change happened in
|
|
66
|
+
* regular pagination or infinite mode.
|
|
67
|
+
*/
|
|
68
|
+
onPageChange?: (page: number, mode?: TablePagingMode) => void;
|
|
69
|
+
onSearchChange?: (search: string) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Optional load-more callback for remote infinite mode.
|
|
72
|
+
* When used, parent should append next page rows to current `data` instead
|
|
73
|
+
* of replacing them.
|
|
74
|
+
*/
|
|
75
|
+
onLoadMore?: (nextPage: number) => void | Promise<void>;
|
|
76
|
+
};
|
|
77
|
+
export type TableSchema = {
|
|
78
|
+
columns: TableSchemaColumn[];
|
|
79
|
+
searchable?: boolean;
|
|
80
|
+
pagination?: TableSchemaPagination;
|
|
81
|
+
};
|
|
82
|
+
export type TableVisibleRow = {
|
|
83
|
+
row: DynamicTableRow;
|
|
84
|
+
rowIndex: number;
|
|
85
|
+
rowId?: TableRowId;
|
|
86
|
+
};
|
|
87
|
+
export type TableRowIdResolver = (row: DynamicTableRow, index: number) => TableRowId;
|
|
88
|
+
export interface TableProps {
|
|
89
|
+
className?: string;
|
|
90
|
+
children?: React.ReactNode;
|
|
91
|
+
containerClassName?: string;
|
|
92
|
+
loading?: boolean;
|
|
93
|
+
isMutating?: boolean;
|
|
94
|
+
stickyHeaderOnScroll?: boolean;
|
|
95
|
+
maxVisibleRowsBeforeScroll?: number;
|
|
96
|
+
schema: TableSchema;
|
|
97
|
+
data: DynamicTableRow[];
|
|
98
|
+
setData: React.Dispatch<React.SetStateAction<DynamicTableRow[]>>;
|
|
99
|
+
onAdd?: TableAddRowHandler;
|
|
100
|
+
onEdit?: TableEditRowHandler;
|
|
101
|
+
onDelete?: TableDeleteRowHandler;
|
|
102
|
+
actions?: TableAction[];
|
|
103
|
+
onCellSelectChange?: TableCellSelectChangeHandler;
|
|
104
|
+
getRowId?: TableRowIdResolver;
|
|
105
|
+
showNumberRow?: boolean;
|
|
106
|
+
}
|
|
107
|
+
type TableSectionProps = {
|
|
108
|
+
className?: string;
|
|
109
|
+
children?: React.ReactNode;
|
|
110
|
+
};
|
|
111
|
+
export type TableHeaderProps = TableSectionProps;
|
|
112
|
+
export type TableBodyProps = TableSectionProps;
|
|
113
|
+
export type TableFooterProps = TableSectionProps;
|
|
114
|
+
export type TableRowState = 'selected';
|
|
115
|
+
export type TableRowProps = TableSectionProps & {
|
|
116
|
+
state?: TableRowState;
|
|
117
|
+
slot?: 'table-row' | 'table-loading-row';
|
|
118
|
+
};
|
|
119
|
+
type TableCellElementProps = {
|
|
120
|
+
className?: string;
|
|
121
|
+
children?: React.ReactNode;
|
|
122
|
+
};
|
|
123
|
+
export type TableHeadProps = TableCellElementProps;
|
|
124
|
+
export type TableCellProps = TableCellElementProps;
|
|
125
|
+
export type TablePaginationControlsProps = {
|
|
126
|
+
shouldRenderInfiniteMode: boolean;
|
|
127
|
+
shouldShowInfiniteLoadingStatus: boolean;
|
|
128
|
+
shouldShowInfiniteReadyStatus: boolean;
|
|
129
|
+
shouldShowInfiniteCompletedStatus: boolean;
|
|
130
|
+
shouldRenderPagination: boolean;
|
|
131
|
+
loading: boolean;
|
|
132
|
+
isRowActionBusy: boolean;
|
|
133
|
+
currentPage: number;
|
|
134
|
+
totalPages: number;
|
|
135
|
+
onPageChange: (nextPage: number) => void;
|
|
136
|
+
};
|
|
137
|
+
export type TableEmptyStateProps = {
|
|
138
|
+
colSpan: number;
|
|
139
|
+
showSearchInput: boolean;
|
|
140
|
+
normalizedSearchTerm: string;
|
|
141
|
+
};
|
|
142
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DynamicTableRow, TablePaginationToken, TableRowId, TableRowIdResolver, TableSchemaColumn } from './Table.interface';
|
|
2
|
+
export declare function resolveLoadingRowsCount(pageSize: number | undefined, dataLength: number): number;
|
|
3
|
+
export declare function resolveLoadingCellSkeletonClassName(column: TableSchemaColumn, rowIndex: number): string;
|
|
4
|
+
export declare function buildPaginationTokens(currentPage: number, totalPages: number): TablePaginationToken[];
|
|
5
|
+
export declare function isEmptyCellValue(value: unknown): boolean;
|
|
6
|
+
export declare function resolveDateValue(value: unknown): Date | null;
|
|
7
|
+
export declare function resolvePlaceholder(column: TableSchemaColumn): string;
|
|
8
|
+
export declare function formatCellValue(value: unknown, column: TableSchemaColumn): string;
|
|
9
|
+
export declare function resolveSafeRowId(row: DynamicTableRow, index: number, getRowId?: TableRowIdResolver): TableRowId | undefined;
|
|
10
|
+
export declare function findRowIndexByIdentifier(rows: DynamicTableRow[], targetRowIndex: number, targetRowId: TableRowId | undefined, getRowId?: TableRowIdResolver): number;
|
|
11
|
+
export declare function replaceRowByIdentifier(rows: DynamicTableRow[], targetRowIndex: number, targetRowId: TableRowId | undefined, getRowId: TableRowIdResolver | undefined, nextRow: DynamicTableRow): DynamicTableRow[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const tableContainerVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
export declare const tableVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
|
+
export declare const ticketContainerVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
4
|
+
export declare const ticketControlsVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
5
|
+
export declare const ticketTableShellVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
6
|
+
export declare const tableHeaderVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
7
|
+
export declare const tableBodyVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
8
|
+
export declare const tableFooterVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
|
+
export declare const tableRowVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
10
|
+
export declare const tableHeadVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
11
|
+
export declare const tableCellVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { TablePaginationControlsProps } from "./Table.interface";
|
|
2
|
+
export default function TablePaginationControls({ shouldRenderInfiniteMode, shouldShowInfiniteLoadingStatus, shouldShowInfiniteReadyStatus, shouldShowInfiniteCompletedStatus, shouldRenderPagination, loading, isRowActionBusy, currentPage, totalPages, onPageChange, }: TablePaginationControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TablePagingMode, TableSchemaPagination, TableVisibleRow } from '../Table.interface';
|
|
3
|
+
type UseTablePaginationInput = {
|
|
4
|
+
hasChildren: boolean;
|
|
5
|
+
filteredRows: TableVisibleRow[];
|
|
6
|
+
paginationConfig?: TableSchemaPagination;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
isRowActionBusy: boolean;
|
|
9
|
+
searchKey: string;
|
|
10
|
+
maxVisibleRowsBeforeScroll?: number;
|
|
11
|
+
};
|
|
12
|
+
type UseTablePaginationResult = {
|
|
13
|
+
pagingMode: TablePagingMode;
|
|
14
|
+
currentPage: number;
|
|
15
|
+
totalPages: number;
|
|
16
|
+
resolvedPageSize: number;
|
|
17
|
+
visibleRows: TableVisibleRow[];
|
|
18
|
+
paginationTokens: Array<number | 'ellipsis-start' | 'ellipsis-end'>;
|
|
19
|
+
canGoToPreviousPage: boolean;
|
|
20
|
+
canGoToNextPage: boolean;
|
|
21
|
+
canUsePaging: boolean;
|
|
22
|
+
showPagingModeToggle: boolean;
|
|
23
|
+
shouldRenderPagination: boolean;
|
|
24
|
+
shouldRenderInfiniteMode: boolean;
|
|
25
|
+
canLoadMoreInInfiniteMode: boolean;
|
|
26
|
+
shouldUseRemotePaging: boolean;
|
|
27
|
+
shouldUseScrollableRows: boolean;
|
|
28
|
+
tableScrollViewportRef: React.RefObject<HTMLDivElement | null>;
|
|
29
|
+
infiniteScrollSentinelRef: React.RefObject<HTMLDivElement | null>;
|
|
30
|
+
tableScrollViewportStyle: React.CSSProperties | undefined;
|
|
31
|
+
handlePageChange: (nextPage: number) => void;
|
|
32
|
+
handlePagingModeToggle: () => void;
|
|
33
|
+
handleTableScrollViewport: (event: React.UIEvent<HTMLDivElement>) => void;
|
|
34
|
+
isInfiniteRequestPending: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare function useTablePagination({ hasChildren, filteredRows, paginationConfig, loading, isRowActionBusy, searchKey, maxVisibleRowsBeforeScroll, }: UseTablePaginationInput): UseTablePaginationResult;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { DynamicTableRow, TableRowIdResolver, TableSchemaColumn, TableVisibleRow } from '../Table.interface';
|
|
3
|
+
type UseTableSearchInput = {
|
|
4
|
+
data: DynamicTableRow[];
|
|
5
|
+
visibleColumns: TableSchemaColumn[];
|
|
6
|
+
showSearchInput: boolean;
|
|
7
|
+
hasRemoteSearchHandler: boolean;
|
|
8
|
+
onSearchChange?: (search: string) => void;
|
|
9
|
+
getRowId?: TableRowIdResolver;
|
|
10
|
+
};
|
|
11
|
+
type UseTableSearchResult = {
|
|
12
|
+
searchTerm: string;
|
|
13
|
+
normalizedSearchTerm: string;
|
|
14
|
+
filteredRows: TableVisibleRow[];
|
|
15
|
+
handleSearchInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function useTableSearch({ data, visibleColumns, showSearchInput, hasRemoteSearchHandler, onSearchChange, getRowId, }: UseTableSearchInput): UseTableSearchResult;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { TextareaProps } from "./Textarea.interface";
|
|
2
|
+
declare function Textarea({ className, resize, title, required, placeholder, onChange, onBlur, onFocus, onInvalid, id, name, disabled, readOnly, autoComplete, rows, maxLength, "aria-label": ariaLabel, value, defaultValue, }: TextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default Textarea;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { VariantProps } from "class-variance-authority";
|
|
3
|
+
import { textareaVariants } from "./Textarea.variant";
|
|
4
|
+
export interface TextareaProps extends VariantProps<typeof textareaVariants> {
|
|
5
|
+
title?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
autoComplete?: string;
|
|
13
|
+
rows?: number;
|
|
14
|
+
maxLength?: number;
|
|
15
|
+
className?: string;
|
|
16
|
+
value?: string | number | readonly string[];
|
|
17
|
+
defaultValue?: string | number | readonly string[];
|
|
18
|
+
"aria-label"?: string;
|
|
19
|
+
onChange?: React.ChangeEventHandler<HTMLTextAreaElement>;
|
|
20
|
+
onBlur?: React.FocusEventHandler<HTMLTextAreaElement>;
|
|
21
|
+
onFocus?: React.FocusEventHandler<HTMLTextAreaElement>;
|
|
22
|
+
onInvalid?: React.FormEventHandler<HTMLTextAreaElement>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ToastPrimitive from "@radix-ui/react-toast";
|
|
3
|
+
import type { ToastProps } from "./Toast.interface";
|
|
4
|
+
type ToastProviderProps = React.ComponentProps<typeof ToastPrimitive.Provider>;
|
|
5
|
+
declare function ToastProvider(props: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
7
|
+
declare function Toast({ className, variant, ...props }: ToastProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitive.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export { ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, };
|
|
13
|
+
export default Toast;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { VariantProps } from "class-variance-authority";
|
|
3
|
+
import type * as ToastPrimitive from "@radix-ui/react-toast";
|
|
4
|
+
import { toastVariants } from "./Toast.variant";
|
|
5
|
+
export interface ToastProps extends React.ComponentProps<typeof ToastPrimitive.Root>, VariantProps<typeof toastVariants> {
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const toastViewportVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
|
+
declare const toastVariants: (props?: ({
|
|
3
|
+
variant?: "success" | "warning" | "default" | "error" | "info" | "destructive" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
|
+
declare const toastActionVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
6
|
+
declare const toastCloseVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
7
|
+
declare const toastTitleVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
8
|
+
declare const toastDescriptionVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
|
+
export { toastActionVariants, toastCloseVariants, toastDescriptionVariants, toastTitleVariants, toastVariants, toastViewportVariants, };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ToastType = "info" | "warning" | "error" | "success" | "succes";
|
|
2
|
+
export type ShowToastInput = {
|
|
3
|
+
title: string;
|
|
4
|
+
message: string;
|
|
5
|
+
duration?: number | null;
|
|
6
|
+
type: ToastType;
|
|
7
|
+
};
|
|
8
|
+
export type ToastPayload = Omit<ShowToastInput, "type" | "duration"> & {
|
|
9
|
+
duration: number;
|
|
10
|
+
isPersistent: boolean;
|
|
11
|
+
type: Exclude<ToastType, "succes">;
|
|
12
|
+
};
|
|
13
|
+
type ToastListener = (payload: ToastPayload) => void;
|
|
14
|
+
export declare const PERSISTENT_DURATION = 2147483647;
|
|
15
|
+
export declare function subscribeToast(listener: ToastListener): () => void;
|
|
16
|
+
export declare function showToast({ title, message, duration, type }: ShowToastInput): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LucideIcon } from "lucide-react";
|
|
2
|
+
import type { ToastPayload } from "./showToast";
|
|
3
|
+
type ToastVariant = ToastPayload["type"];
|
|
4
|
+
type ToastVisualConfig = {
|
|
5
|
+
Icon: LucideIcon;
|
|
6
|
+
iconClassName: string;
|
|
7
|
+
progressClassName: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function getToastVisual(type: ToastVariant): ToastVisualConfig;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
export interface TooltipProps extends Omit<React.ComponentProps<typeof TooltipPrimitive.Root>, "children"> {
|
|
4
|
+
text: React.ReactNode;
|
|
5
|
+
trigger: React.ReactNode;
|
|
6
|
+
position?: "top" | "right" | "bottom" | "left";
|
|
7
|
+
className?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
sideOffset?: number;
|
|
10
|
+
delayDuration?: number;
|
|
11
|
+
skipDelayDuration?: number;
|
|
12
|
+
children?: never;
|
|
13
|
+
}
|