mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
feat(toast): add ability to use toast inline (#26215)
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import {
|
||||
JSX,
|
||||
ToastButton as ToastButtonCore,
|
||||
ToastOptions as ToastOptionsCore,
|
||||
toastController as toastControllerCore,
|
||||
ToastOptions as ToastOptionsCore
|
||||
} from '@ionic/core/components';
|
||||
import { defineCustomElement } from '@ionic/core/components/ion-toast.js';
|
||||
|
||||
import { createControllerComponent } from './createControllerComponent';
|
||||
import { createInlineOverlayComponent } from './createInlineOverlayComponent';
|
||||
|
||||
export interface ToastButton extends Omit<ToastButtonCore, 'icon'> {
|
||||
icon?:
|
||||
@ -20,15 +20,7 @@ export interface ToastOptions extends Omit<ToastOptionsCore, 'buttons'> {
|
||||
buttons?: (ToastButton | string)[];
|
||||
}
|
||||
|
||||
const toastController = {
|
||||
create: (options: ToastOptions) => toastControllerCore.create(options as any),
|
||||
dismiss: (data?: any, role?: string | undefined, id?: string | undefined) =>
|
||||
toastControllerCore.dismiss(data, role, id),
|
||||
getTop: () => toastControllerCore.getTop(),
|
||||
};
|
||||
|
||||
export const IonToast = /*@__PURE__*/ createControllerComponent<ToastOptions, HTMLIonToastElement>(
|
||||
export const IonToast = /*@__PURE__*/ createInlineOverlayComponent<JSX.IonToast, HTMLIonToastElement>(
|
||||
'ion-toast',
|
||||
toastController,
|
||||
defineCustomElement
|
||||
);
|
||||
|
Reference in New Issue
Block a user