UNPKG

1.66 kBTypeScriptView Raw
1import React from 'react';
2import type { ReactNode } from 'react';
3import { NativeProps } from '../../utils/native-props';
4import { PropagationEvent } from '../../utils/with-stop-propagation';
5declare type SideType = 'left' | 'right';
6export declare type SwipeActionRef = {
7 close: () => void;
8 show: (side?: SideType) => void;
9};
10declare type ActionColor = 'light' | 'weak' | 'primary' | 'success' | 'warning' | 'danger';
11export declare type Action = {
12 key: string | number;
13 text: ReactNode;
14 color?: ActionColor | string;
15 onClick?: (e: React.MouseEvent) => void;
16};
17export declare type SwipeActionProps = {
18 rightActions?: Action[];
19 leftActions?: Action[];
20 onAction?: (action: Action, e: React.MouseEvent) => void;
21 closeOnTouchOutside?: boolean;
22 closeOnAction?: boolean;
23 children: ReactNode;
24 stopPropagation?: PropagationEvent[];
25 onActionsReveal?: (side: SideType) => void;
26} & NativeProps<'--background'>;
27export declare const SwipeAction: React.ForwardRefExoticComponent<{
28 rightActions?: Action[] | undefined;
29 leftActions?: Action[] | undefined;
30 onAction?: ((action: Action, e: React.MouseEvent) => void) | undefined;
31 closeOnTouchOutside?: boolean | undefined;
32 closeOnAction?: boolean | undefined;
33 children: ReactNode;
34 stopPropagation?: PropagationEvent[] | undefined;
35 onActionsReveal?: ((side: SideType) => void) | undefined;
36} & {
37 className?: string | undefined;
38 style?: (React.CSSProperties & Partial<Record<"--background", string>>) | undefined;
39 tabIndex?: number | undefined;
40} & React.AriaAttributes & React.RefAttributes<SwipeActionRef>>;
41export {};
42
\No newline at end of file