@radix-ui/react-toast 1.1.6-rc.6 → 1.2.0-rc.2
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/index.d.mts +49 -37
- package/dist/index.d.ts +49 -37
- package/dist/index.js +632 -704
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +625 -690
- package/dist/index.mjs.map +7 -1
- package/package.json +13 -14
- package/dist/index.d.ts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as DismissableLayer from
|
|
3
|
-
import * as Radix from
|
|
4
|
-
import { Primitive } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DismissableLayer from '@radix-ui/react-dismissable-layer';
|
|
3
|
+
import * as Radix from '@radix-ui/react-primitive';
|
|
4
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
5
|
+
|
|
6
|
+
declare type Scope<C = any> = {
|
|
7
|
+
[scopeName: string]: React.Context<C>[];
|
|
8
|
+
} | undefined;
|
|
9
|
+
declare type ScopeHook = (scope: Scope) => {
|
|
10
|
+
[__scopeProp: string]: Scope;
|
|
11
|
+
};
|
|
12
|
+
interface CreateScope {
|
|
13
|
+
scopeName: string;
|
|
14
|
+
(): ScopeHook;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare type SwipeDirection = 'up' | 'down' | 'left' | 'right';
|
|
18
|
+
declare const createToastScope: CreateScope;
|
|
19
|
+
interface ToastProviderProps {
|
|
8
20
|
children?: React.ReactNode;
|
|
9
21
|
/**
|
|
10
22
|
* An author-localized label for each toast. Used to help screen reader users
|
|
@@ -28,9 +40,9 @@ export interface ToastProviderProps {
|
|
|
28
40
|
*/
|
|
29
41
|
swipeThreshold?: number;
|
|
30
42
|
}
|
|
31
|
-
|
|
32
|
-
type PrimitiveOrderedListProps = Radix.ComponentPropsWithoutRef<typeof Primitive.ol>;
|
|
33
|
-
|
|
43
|
+
declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
44
|
+
declare type PrimitiveOrderedListProps = Radix.ComponentPropsWithoutRef<typeof Primitive.ol>;
|
|
45
|
+
interface ToastViewportProps extends PrimitiveOrderedListProps {
|
|
34
46
|
/**
|
|
35
47
|
* The keys to use as the keyboard shortcut that will move focus to the toast viewport.
|
|
36
48
|
* @defaultValue ['F8']
|
|
@@ -43,9 +55,9 @@ export interface ToastViewportProps extends PrimitiveOrderedListProps {
|
|
|
43
55
|
*/
|
|
44
56
|
label?: string;
|
|
45
57
|
}
|
|
46
|
-
|
|
47
|
-
type ToastElement = ToastImplElement;
|
|
48
|
-
|
|
58
|
+
declare const ToastViewport: React.ForwardRefExoticComponent<ToastViewportProps & React.RefAttributes<HTMLOListElement>>;
|
|
59
|
+
declare type ToastElement = ToastImplElement;
|
|
60
|
+
interface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateProps> {
|
|
49
61
|
open?: boolean;
|
|
50
62
|
defaultOpen?: boolean;
|
|
51
63
|
onOpenChange?(open: boolean): void;
|
|
@@ -55,8 +67,8 @@ export interface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateP
|
|
|
55
67
|
*/
|
|
56
68
|
forceMount?: true;
|
|
57
69
|
}
|
|
58
|
-
|
|
59
|
-
type SwipeEvent = {
|
|
70
|
+
declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLLIElement>>;
|
|
71
|
+
declare type SwipeEvent = {
|
|
60
72
|
currentTarget: EventTarget & ToastElement;
|
|
61
73
|
} & Omit<CustomEvent<{
|
|
62
74
|
originalEvent: React.PointerEvent;
|
|
@@ -65,13 +77,13 @@ type SwipeEvent = {
|
|
|
65
77
|
y: number;
|
|
66
78
|
};
|
|
67
79
|
}>, 'currentTarget'>;
|
|
68
|
-
type ToastImplElement = React.ElementRef<typeof Primitive.li>;
|
|
69
|
-
type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer.Root>;
|
|
70
|
-
type ToastImplPrivateProps = {
|
|
80
|
+
declare type ToastImplElement = React.ElementRef<typeof Primitive.li>;
|
|
81
|
+
declare type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer.Root>;
|
|
82
|
+
declare type ToastImplPrivateProps = {
|
|
71
83
|
open: boolean;
|
|
72
84
|
onClose(): void;
|
|
73
85
|
};
|
|
74
|
-
type PrimitiveListItemProps = Radix.ComponentPropsWithoutRef<typeof Primitive.li>;
|
|
86
|
+
declare type PrimitiveListItemProps = Radix.ComponentPropsWithoutRef<typeof Primitive.li>;
|
|
75
87
|
interface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps {
|
|
76
88
|
type?: 'foreground' | 'background';
|
|
77
89
|
/**
|
|
@@ -87,14 +99,14 @@ interface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps {
|
|
|
87
99
|
onSwipeCancel?(event: SwipeEvent): void;
|
|
88
100
|
onSwipeEnd?(event: SwipeEvent): void;
|
|
89
101
|
}
|
|
90
|
-
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
91
|
-
|
|
102
|
+
declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
103
|
+
interface ToastTitleProps extends PrimitiveDivProps {
|
|
92
104
|
}
|
|
93
|
-
|
|
94
|
-
|
|
105
|
+
declare const ToastTitle: React.ForwardRefExoticComponent<ToastTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
106
|
+
interface ToastDescriptionProps extends PrimitiveDivProps {
|
|
95
107
|
}
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
declare const ToastDescription: React.ForwardRefExoticComponent<ToastDescriptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
109
|
+
interface ToastActionProps extends ToastCloseProps {
|
|
98
110
|
/**
|
|
99
111
|
* A short description for an alternate way to carry out the action. For screen reader users
|
|
100
112
|
* who will not be able to navigate to the button easily/quickly.
|
|
@@ -103,17 +115,17 @@ export interface ToastActionProps extends ToastCloseProps {
|
|
|
103
115
|
*/
|
|
104
116
|
altText: string;
|
|
105
117
|
}
|
|
106
|
-
|
|
107
|
-
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
108
|
-
|
|
118
|
+
declare const ToastAction: React.ForwardRefExoticComponent<ToastActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
119
|
+
declare type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
120
|
+
interface ToastCloseProps extends PrimitiveButtonProps {
|
|
109
121
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
declare const ToastClose: React.ForwardRefExoticComponent<ToastCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
123
|
+
declare const Provider: React.FC<ToastProviderProps>;
|
|
124
|
+
declare const Viewport: React.ForwardRefExoticComponent<ToastViewportProps & React.RefAttributes<HTMLOListElement>>;
|
|
125
|
+
declare const Root: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLLIElement>>;
|
|
126
|
+
declare const Title: React.ForwardRefExoticComponent<ToastTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
127
|
+
declare const Description: React.ForwardRefExoticComponent<ToastDescriptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
128
|
+
declare const Action: React.ForwardRefExoticComponent<ToastActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
129
|
+
declare const Close: React.ForwardRefExoticComponent<ToastCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
118
130
|
|
|
119
|
-
|
|
131
|
+
export { Action, Close, Description, Provider, Root, Title, Toast, ToastAction, type ToastActionProps, ToastClose, type ToastCloseProps, ToastDescription, type ToastDescriptionProps, type ToastProps, ToastProvider, type ToastProviderProps, ToastTitle, type ToastTitleProps, ToastViewport, type ToastViewportProps, Viewport, createToastScope };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as DismissableLayer from
|
|
3
|
-
import * as Radix from
|
|
4
|
-
import { Primitive } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DismissableLayer from '@radix-ui/react-dismissable-layer';
|
|
3
|
+
import * as Radix from '@radix-ui/react-primitive';
|
|
4
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
5
|
+
|
|
6
|
+
declare type Scope<C = any> = {
|
|
7
|
+
[scopeName: string]: React.Context<C>[];
|
|
8
|
+
} | undefined;
|
|
9
|
+
declare type ScopeHook = (scope: Scope) => {
|
|
10
|
+
[__scopeProp: string]: Scope;
|
|
11
|
+
};
|
|
12
|
+
interface CreateScope {
|
|
13
|
+
scopeName: string;
|
|
14
|
+
(): ScopeHook;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare type SwipeDirection = 'up' | 'down' | 'left' | 'right';
|
|
18
|
+
declare const createToastScope: CreateScope;
|
|
19
|
+
interface ToastProviderProps {
|
|
8
20
|
children?: React.ReactNode;
|
|
9
21
|
/**
|
|
10
22
|
* An author-localized label for each toast. Used to help screen reader users
|
|
@@ -28,9 +40,9 @@ export interface ToastProviderProps {
|
|
|
28
40
|
*/
|
|
29
41
|
swipeThreshold?: number;
|
|
30
42
|
}
|
|
31
|
-
|
|
32
|
-
type PrimitiveOrderedListProps = Radix.ComponentPropsWithoutRef<typeof Primitive.ol>;
|
|
33
|
-
|
|
43
|
+
declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
44
|
+
declare type PrimitiveOrderedListProps = Radix.ComponentPropsWithoutRef<typeof Primitive.ol>;
|
|
45
|
+
interface ToastViewportProps extends PrimitiveOrderedListProps {
|
|
34
46
|
/**
|
|
35
47
|
* The keys to use as the keyboard shortcut that will move focus to the toast viewport.
|
|
36
48
|
* @defaultValue ['F8']
|
|
@@ -43,9 +55,9 @@ export interface ToastViewportProps extends PrimitiveOrderedListProps {
|
|
|
43
55
|
*/
|
|
44
56
|
label?: string;
|
|
45
57
|
}
|
|
46
|
-
|
|
47
|
-
type ToastElement = ToastImplElement;
|
|
48
|
-
|
|
58
|
+
declare const ToastViewport: React.ForwardRefExoticComponent<ToastViewportProps & React.RefAttributes<HTMLOListElement>>;
|
|
59
|
+
declare type ToastElement = ToastImplElement;
|
|
60
|
+
interface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateProps> {
|
|
49
61
|
open?: boolean;
|
|
50
62
|
defaultOpen?: boolean;
|
|
51
63
|
onOpenChange?(open: boolean): void;
|
|
@@ -55,8 +67,8 @@ export interface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateP
|
|
|
55
67
|
*/
|
|
56
68
|
forceMount?: true;
|
|
57
69
|
}
|
|
58
|
-
|
|
59
|
-
type SwipeEvent = {
|
|
70
|
+
declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLLIElement>>;
|
|
71
|
+
declare type SwipeEvent = {
|
|
60
72
|
currentTarget: EventTarget & ToastElement;
|
|
61
73
|
} & Omit<CustomEvent<{
|
|
62
74
|
originalEvent: React.PointerEvent;
|
|
@@ -65,13 +77,13 @@ type SwipeEvent = {
|
|
|
65
77
|
y: number;
|
|
66
78
|
};
|
|
67
79
|
}>, 'currentTarget'>;
|
|
68
|
-
type ToastImplElement = React.ElementRef<typeof Primitive.li>;
|
|
69
|
-
type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer.Root>;
|
|
70
|
-
type ToastImplPrivateProps = {
|
|
80
|
+
declare type ToastImplElement = React.ElementRef<typeof Primitive.li>;
|
|
81
|
+
declare type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer.Root>;
|
|
82
|
+
declare type ToastImplPrivateProps = {
|
|
71
83
|
open: boolean;
|
|
72
84
|
onClose(): void;
|
|
73
85
|
};
|
|
74
|
-
type PrimitiveListItemProps = Radix.ComponentPropsWithoutRef<typeof Primitive.li>;
|
|
86
|
+
declare type PrimitiveListItemProps = Radix.ComponentPropsWithoutRef<typeof Primitive.li>;
|
|
75
87
|
interface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps {
|
|
76
88
|
type?: 'foreground' | 'background';
|
|
77
89
|
/**
|
|
@@ -87,14 +99,14 @@ interface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps {
|
|
|
87
99
|
onSwipeCancel?(event: SwipeEvent): void;
|
|
88
100
|
onSwipeEnd?(event: SwipeEvent): void;
|
|
89
101
|
}
|
|
90
|
-
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
91
|
-
|
|
102
|
+
declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
103
|
+
interface ToastTitleProps extends PrimitiveDivProps {
|
|
92
104
|
}
|
|
93
|
-
|
|
94
|
-
|
|
105
|
+
declare const ToastTitle: React.ForwardRefExoticComponent<ToastTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
106
|
+
interface ToastDescriptionProps extends PrimitiveDivProps {
|
|
95
107
|
}
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
declare const ToastDescription: React.ForwardRefExoticComponent<ToastDescriptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
109
|
+
interface ToastActionProps extends ToastCloseProps {
|
|
98
110
|
/**
|
|
99
111
|
* A short description for an alternate way to carry out the action. For screen reader users
|
|
100
112
|
* who will not be able to navigate to the button easily/quickly.
|
|
@@ -103,17 +115,17 @@ export interface ToastActionProps extends ToastCloseProps {
|
|
|
103
115
|
*/
|
|
104
116
|
altText: string;
|
|
105
117
|
}
|
|
106
|
-
|
|
107
|
-
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
108
|
-
|
|
118
|
+
declare const ToastAction: React.ForwardRefExoticComponent<ToastActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
119
|
+
declare type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
120
|
+
interface ToastCloseProps extends PrimitiveButtonProps {
|
|
109
121
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
declare const ToastClose: React.ForwardRefExoticComponent<ToastCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
123
|
+
declare const Provider: React.FC<ToastProviderProps>;
|
|
124
|
+
declare const Viewport: React.ForwardRefExoticComponent<ToastViewportProps & React.RefAttributes<HTMLOListElement>>;
|
|
125
|
+
declare const Root: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLLIElement>>;
|
|
126
|
+
declare const Title: React.ForwardRefExoticComponent<ToastTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
127
|
+
declare const Description: React.ForwardRefExoticComponent<ToastDescriptionProps & React.RefAttributes<HTMLDivElement>>;
|
|
128
|
+
declare const Action: React.ForwardRefExoticComponent<ToastActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
129
|
+
declare const Close: React.ForwardRefExoticComponent<ToastCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
118
130
|
|
|
119
|
-
|
|
131
|
+
export { Action, Close, Description, Provider, Root, Title, Toast, ToastAction, type ToastActionProps, ToastClose, type ToastCloseProps, ToastDescription, type ToastDescriptionProps, type ToastProps, ToastProvider, type ToastProviderProps, ToastTitle, type ToastTitleProps, ToastViewport, type ToastViewportProps, Viewport, createToastScope };
|