@blueprintjs/core
Advanced tools
Comparing version 4.19.1 to 4.19.2
@@ -108,4 +108,4 @@ import * as React from "react"; | ||
/** @deprecated use the new, more specific type `ToasterInstance` instead (forwards-compatible with v5) */ | ||
export declare type Toaster = ToasterInstance; | ||
export declare type Toaster = OverlayToaster; | ||
/** @deprecated use `OverlayToasterProps` instead */ | ||
export declare type IToasterProps = OverlayToasterProps; |
@@ -166,4 +166,2 @@ "use strict"; | ||
exports.Toaster = OverlayToaster; | ||
// eslint-disable-next-line deprecation/deprecation | ||
exports.Toaster.displayName = "".concat(props_1.DISPLAYNAME_PREFIX, ".Toaster"); | ||
//# sourceMappingURL=toaster.js.map |
@@ -108,4 +108,4 @@ import * as React from "react"; | ||
/** @deprecated use the new, more specific type `ToasterInstance` instead (forwards-compatible with v5) */ | ||
export declare type Toaster = ToasterInstance; | ||
export declare type Toaster = OverlayToaster; | ||
/** @deprecated use `OverlayToasterProps` instead */ | ||
export declare type IToasterProps = OverlayToasterProps; |
@@ -163,4 +163,2 @@ /* | ||
export var Toaster = OverlayToaster; | ||
// eslint-disable-next-line deprecation/deprecation | ||
Toaster.displayName = "".concat(DISPLAYNAME_PREFIX, ".Toaster"); | ||
//# sourceMappingURL=toaster.js.map |
@@ -108,4 +108,4 @@ import * as React from "react"; | ||
/** @deprecated use the new, more specific type `ToasterInstance` instead (forwards-compatible with v5) */ | ||
export declare type Toaster = ToasterInstance; | ||
export declare type Toaster = OverlayToaster; | ||
/** @deprecated use `OverlayToasterProps` instead */ | ||
export declare type IToasterProps = OverlayToasterProps; |
@@ -148,4 +148,2 @@ /* | ||
export const Toaster = OverlayToaster; | ||
// eslint-disable-next-line deprecation/deprecation | ||
Toaster.displayName = `${DISPLAYNAME_PREFIX}.Toaster`; | ||
//# sourceMappingURL=toaster.js.map |
{ | ||
"name": "@blueprintjs/core", | ||
"version": "4.19.1", | ||
"version": "4.19.2", | ||
"description": "Core styles & components", | ||
@@ -5,0 +5,0 @@ "main": "lib/cjs/index.js", |
@@ -26,4 +26,4 @@ @# Toast | ||
The __OverlayToaster__ component is a stateful container for a single list of toasts. Internally, it | ||
uses the [Overlay](#core/components/overlay) component to manage children and transitions. It can be vertically | ||
The __OverlayToaster__ component (previously named __Toaster__) is a stateful container for a single list of toasts. | ||
Internally, it uses [__Overlay__](#core/components/overlay) to manage children and transitions. It can be vertically | ||
aligned along the top or bottom edge of its container (new toasts will slide in from that edge) and | ||
@@ -34,5 +34,27 @@ horizontally aligned along the left edge, center, or right edge of its container. | ||
1. `OverlayToaster.create(props)` static method returns a new `ToasterInstance` instance. Use the instance method `toaster.show()` to manipulate this instance. __(recommended)__ | ||
1. `<OverlayToaster><Toast />...</OverlayToaster>`: Render a `<OverlayToaster>` element with React `children`. | ||
1. `<OverlayToaster ref={(ref: ToasterInstance) => ref.show({ ...toast })} />`: Render a `<OverlayToaster>` element and use the `ref` prop to access its instance methods. | ||
1. __Recommended__: use the `OverlayToaster.create()` static method to access a new `ToasterInstance`: | ||
```ts | ||
const myToaster: ToasterInstance = OverlayToaster.create({ position: "bottom" }); | ||
myToaster.show({ ...toastOptions }); | ||
``` | ||
2. Render an `<OverlayToaster>` with `<Toast>` children: | ||
```ts | ||
render( | ||
<OverlayToaster> | ||
<Toast {...toastOptions} /> | ||
</OverlayToaster>, | ||
targetElement, | ||
); | ||
``` | ||
3. Use a ref callback or object to access toaster instance methods. | ||
- Example with ref callback: | ||
```ts | ||
render(<OverlayToaster ref={(ref: ToasterInstance | null) => ref?.show({ ...toastOptions })} />, targetElement); | ||
``` | ||
- Example with ref object (note that React type constraints require us to use the more specific `OverlayToaster` type): | ||
```ts | ||
const myToaster = React.createRef<OverlayToaster>(); | ||
render(<OverlayToaster ref={myToaster} />, targetElement); | ||
myToaster.current?.show({ ...toastOptions }); | ||
``` | ||
@@ -39,0 +61,0 @@ <div class="@ns-callout @ns-intent-primary @ns-icon-info-sign"> |
Sorry, the diff of this file is too big to display
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
5724324
84693