Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] feat: Overlay2 component #6656

Merged
merged 24 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
handle Toast deprecation
  • Loading branch information
adidahiya committed Jan 22, 2024
commit 0f2f1d24c0b3546bea593a4053060c6bcc1ecf66
1 change: 1 addition & 0 deletions packages/core/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export { Tag, type TagProps } from "./tag/tag";
export { TagInput, type TagInputProps, type TagInputAddMethod } from "./tag-input/tagInput";
export { OverlayToaster, type OverlayToasterCreateOptions } from "./toast/overlayToaster";
export type { OverlayToasterProps, ToasterPosition } from "./toast/overlayToasterProps";
// eslint-disable-next-line deprecation/deprecation
export { Toast } from "./toast/toast";
export { Toast2 } from "./toast/toast2";
export type { ToastProps } from "./toast/toastProps";
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/toast/overlayToaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export class OverlayToaster extends AbstractPureComponent<OverlayToasterProps, O
*/
private renderChildren() {
return React.Children.map(this.props.children, child => {
// eslint-disable-next-line deprecation/deprecation
if (isElementOfType(child, Toast)) {
return <Toast2 {...child.props} />;
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/toast/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import type { ToastProps } from "./toastProps";
/**
* Toast component.
*
* @deprecated use `Toast2` instead
* @deprecated use `Toast2` instead, which forwards DOM refs and is thus compatible with `Overlay2`.
* @see https://blueprintjs.com/docs/#core/components/toast
*/
export class Toast extends AbstractPureComponent<ToastProps> {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/components/toast/toast2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ import type { ToastProps } from "./toastProps";
/**
* Toast2 component.
*
* Compared to the deprecated `Toast` component, this is a function component which forwards DOM
* refs and is thus compatible with `Overlay2`.
*
* @see https://blueprintjs.com/docs/#core/components/toast2
*/
export const Toast2 = React.forwardRef<HTMLDivElement, ToastProps>((props, ref) => {
Expand Down