@radix-ui/react-toast
Advanced tools
Comparing version 1.2.0-rc.3 to 1.2.0-rc.4
import * as React from 'react'; | ||
import * as DismissableLayer from '@radix-ui/react-dismissable-layer'; | ||
import * as Radix from '@radix-ui/react-primitive'; | ||
import { Primitive } from '@radix-ui/react-primitive'; | ||
declare type Scope<C = any> = { | ||
type Scope<C = any> = { | ||
[scopeName: string]: React.Context<C>[]; | ||
} | undefined; | ||
declare type ScopeHook = (scope: Scope) => { | ||
type ScopeHook = (scope: Scope) => { | ||
[__scopeProp: string]: Scope; | ||
@@ -17,3 +16,3 @@ }; | ||
declare type SwipeDirection = 'up' | 'down' | 'left' | 'right'; | ||
type SwipeDirection = 'up' | 'down' | 'left' | 'right'; | ||
declare const createToastScope: CreateScope; | ||
@@ -45,3 +44,3 @@ interface ToastProviderProps { | ||
declare const ToastProvider: React.FC<ToastProviderProps>; | ||
declare type PrimitiveOrderedListProps = Radix.ComponentPropsWithoutRef<typeof Primitive.ol>; | ||
type PrimitiveOrderedListProps = React.ComponentPropsWithoutRef<typeof Primitive.ol>; | ||
interface ToastViewportProps extends PrimitiveOrderedListProps { | ||
@@ -61,3 +60,3 @@ /** | ||
declare const ToastViewport: React.ForwardRefExoticComponent<ToastViewportProps & React.RefAttributes<HTMLOListElement>>; | ||
declare type ToastElement = ToastImplElement; | ||
type ToastElement = ToastImplElement; | ||
interface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateProps> { | ||
@@ -74,3 +73,3 @@ open?: boolean; | ||
declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLLIElement>>; | ||
declare type SwipeEvent = { | ||
type SwipeEvent = { | ||
currentTarget: EventTarget & ToastElement; | ||
@@ -84,9 +83,9 @@ } & Omit<CustomEvent<{ | ||
}>, 'currentTarget'>; | ||
declare type ToastImplElement = React.ElementRef<typeof Primitive.li>; | ||
declare type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer.Root>; | ||
declare type ToastImplPrivateProps = { | ||
type ToastImplElement = React.ElementRef<typeof Primitive.li>; | ||
type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer.Root>; | ||
type ToastImplPrivateProps = { | ||
open: boolean; | ||
onClose(): void; | ||
}; | ||
declare type PrimitiveListItemProps = Radix.ComponentPropsWithoutRef<typeof Primitive.li>; | ||
type PrimitiveListItemProps = React.ComponentPropsWithoutRef<typeof Primitive.li>; | ||
interface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps { | ||
@@ -107,3 +106,3 @@ type?: 'foreground' | 'background'; | ||
} | ||
declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>; | ||
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>; | ||
interface ToastTitleProps extends PrimitiveDivProps { | ||
@@ -125,3 +124,3 @@ } | ||
declare const ToastAction: React.ForwardRefExoticComponent<ToastActionProps & React.RefAttributes<HTMLButtonElement>>; | ||
declare type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>; | ||
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>; | ||
interface ToastCloseProps extends PrimitiveButtonProps { | ||
@@ -128,0 +127,0 @@ } |
@@ -85,2 +85,7 @@ "use strict"; | ||
const isClosePausedRef = React.useRef(false); | ||
if (!label.trim()) { | ||
console.error( | ||
`Invalid prop \`label\` supplied to \`${PROVIDER_NAME}\`. Expected non-empty \`string\`.` | ||
); | ||
} | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: __scopeToast, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( | ||
@@ -105,11 +110,2 @@ ToastProviderProvider, | ||
}; | ||
ToastProvider.propTypes = { | ||
label(props) { | ||
if (props.label && typeof props.label === "string" && !props.label.trim()) { | ||
const error = `Invalid prop \`label\` supplied to \`${PROVIDER_NAME}\`. Expected non-empty \`string\`.`; | ||
return new Error(error); | ||
} | ||
return null; | ||
} | ||
}; | ||
ToastProvider.displayName = PROVIDER_NAME; | ||
@@ -529,11 +525,2 @@ var VIEWPORT_NAME = "ToastViewport"; | ||
); | ||
ToastImpl.propTypes = { | ||
type(props) { | ||
if (props.type && !["foreground", "background"].includes(props.type)) { | ||
const error = `Invalid prop \`type\` supplied to \`${TOAST_NAME}\`. Expected \`foreground | background\`.`; | ||
return new Error(error); | ||
} | ||
return null; | ||
} | ||
}; | ||
var ToastAnnounce = (props) => { | ||
@@ -575,14 +562,11 @@ const { __scopeToast, children, ...announceProps } = props; | ||
const { altText, ...actionProps } = props; | ||
if (!altText) return null; | ||
if (!altText.trim()) { | ||
console.error( | ||
`Invalid prop \`altText\` supplied to \`${ACTION_NAME}\`. Expected non-empty \`string\`.` | ||
); | ||
return null; | ||
} | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastAnnounceExclude, { altText, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastClose, { ...actionProps, ref: forwardedRef }) }); | ||
} | ||
); | ||
ToastAction.propTypes = { | ||
altText(props) { | ||
if (!props.altText) { | ||
return new Error(`Missing prop \`altText\` expected on \`${ACTION_NAME}\``); | ||
} | ||
return null; | ||
} | ||
}; | ||
ToastAction.displayName = ACTION_NAME; | ||
@@ -589,0 +573,0 @@ var CLOSE_NAME = "ToastClose"; |
{ | ||
"name": "@radix-ui/react-toast", | ||
"version": "1.2.0-rc.3", | ||
"version": "1.2.0-rc.4", | ||
"license": "MIT", | ||
@@ -31,14 +31,14 @@ "exports": { | ||
"dependencies": { | ||
"@radix-ui/primitive": "1.1.0-rc.3", | ||
"@radix-ui/react-collection": "1.1.0-rc.3", | ||
"@radix-ui/react-compose-refs": "1.1.0-rc.3", | ||
"@radix-ui/react-context": "1.1.0-rc.3", | ||
"@radix-ui/react-dismissable-layer": "1.1.0-rc.3", | ||
"@radix-ui/react-portal": "1.1.0-rc.3", | ||
"@radix-ui/react-presence": "1.1.0-rc.3", | ||
"@radix-ui/react-primitive": "1.1.0-rc.3", | ||
"@radix-ui/react-use-callback-ref": "1.1.0-rc.3", | ||
"@radix-ui/react-use-controllable-state": "1.1.0-rc.3", | ||
"@radix-ui/react-use-layout-effect": "1.1.0-rc.3", | ||
"@radix-ui/react-visually-hidden": "1.1.0-rc.3" | ||
"@radix-ui/primitive": "1.1.0-rc.4", | ||
"@radix-ui/react-collection": "1.1.0-rc.4", | ||
"@radix-ui/react-compose-refs": "1.1.0-rc.4", | ||
"@radix-ui/react-context": "1.1.0-rc.4", | ||
"@radix-ui/react-dismissable-layer": "1.1.0-rc.4", | ||
"@radix-ui/react-portal": "1.1.0-rc.4", | ||
"@radix-ui/react-presence": "1.1.0-rc.4", | ||
"@radix-ui/react-primitive": "2.0.0-rc.1", | ||
"@radix-ui/react-use-callback-ref": "1.1.0-rc.4", | ||
"@radix-ui/react-use-controllable-state": "1.1.0-rc.4", | ||
"@radix-ui/react-use-layout-effect": "1.1.0-rc.4", | ||
"@radix-ui/react-visually-hidden": "1.1.0-rc.4" | ||
}, | ||
@@ -48,4 +48,4 @@ "peerDependencies": { | ||
"@types/react-dom": "*", | ||
"react": "^16.8 || ^17.0 || ^18.0", | ||
"react-dom": "^16.8 || ^17.0 || ^18.0" | ||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0", | ||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0" | ||
}, | ||
@@ -52,0 +52,0 @@ "peerDependenciesMeta": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
179661
1456
+ Added@radix-ui/primitive@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-collection@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-compose-refs@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-context@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-dismissable-layer@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-portal@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-presence@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-primitive@2.0.0-rc.1(transitive)
+ Added@radix-ui/react-slot@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-use-callback-ref@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-use-controllable-state@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-use-escape-keydown@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-use-layout-effect@1.1.0-rc.4(transitive)
+ Added@radix-ui/react-visually-hidden@1.1.0-rc.4(transitive)
- Removed@radix-ui/primitive@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-collection@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-compose-refs@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-context@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-dismissable-layer@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-portal@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-presence@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-primitive@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-slot@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-use-callback-ref@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-use-controllable-state@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-use-escape-keydown@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-use-layout-effect@1.1.0-rc.3(transitive)
- Removed@radix-ui/react-visually-hidden@1.1.0-rc.3(transitive)