ion-toast.js 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. /*!
  2. * (C) Ionic http://ionicframework.com - MIT License
  3. */
  4. import { Build, proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
  5. import { E as ENABLE_HTML_CONTENT_DEFAULT, a as sanitizeDOMString } from './config.js';
  6. import { g as getElementRoot, r as raf } from './helpers.js';
  7. import { c as createLockController } from './lock-controller.js';
  8. import { a as printIonWarning, c as config, p as printIonError } from './index4.js';
  9. import { O as OVERLAY_GESTURE_PRIORITY, d as createDelegateController, e as createTriggerController, i as isCancel, j as prepareOverlay, k as setOverlayId, f as present, g as dismiss, h as eventMethod, s as safeCall, G as GESTURE } from './overlays.js';
  10. import { c as createColorClasses, g as getClassMap } from './theme.js';
  11. import { b as getIonMode } from './ionic-global.js';
  12. import { c as createAnimation } from './animation.js';
  13. import { w as win } from './index6.js';
  14. import { createGesture } from './index3.js';
  15. import { d as defineCustomElement$3 } from './icon.js';
  16. import { d as defineCustomElement$2 } from './ripple-effect.js';
  17. /**
  18. * Calculate the CSS top and bottom position of the toast, to be used
  19. * as starting points for the animation keyframes.
  20. *
  21. * The default animations for both MD and iOS
  22. * use translateY, which calculates from the
  23. * top edge of the screen. This behavior impacts
  24. * how we compute the offset when a toast has
  25. * position='bottom' since we need to calculate from
  26. * the bottom edge of the screen instead.
  27. *
  28. * @param position The value of the toast's position prop.
  29. * @param positionAnchor The element the toast should be anchored to,
  30. * if applicable.
  31. * @param mode The toast component's mode (md, ios, etc).
  32. * @param toast A reference to the toast element itself.
  33. */
  34. function getAnimationPosition(position, positionAnchor, mode, toast) {
  35. /**
  36. * Start with a predefined offset from the edge the toast will be
  37. * positioned relative to, whether on the screen or anchor element.
  38. */
  39. let offset;
  40. if (mode === 'md') {
  41. offset = position === 'top' ? 8 : -8;
  42. }
  43. else {
  44. offset = position === 'top' ? 10 : -10;
  45. }
  46. /**
  47. * If positionAnchor is defined, add in the distance from the target
  48. * screen edge to the target anchor edge. For position="top", the
  49. * bottom anchor edge is targeted. For position="bottom", the top
  50. * anchor edge is targeted.
  51. */
  52. if (positionAnchor && win) {
  53. warnIfAnchorIsHidden(positionAnchor, toast);
  54. const box = positionAnchor.getBoundingClientRect();
  55. if (position === 'top') {
  56. offset += box.bottom;
  57. }
  58. else if (position === 'bottom') {
  59. /**
  60. * Just box.top is the distance from the top edge of the screen
  61. * to the top edge of the anchor. We want to calculate from the
  62. * bottom edge of the screen instead.
  63. */
  64. offset -= win.innerHeight - box.top;
  65. }
  66. /**
  67. * We don't include safe area here because that should already be
  68. * accounted for when checking the position of the anchor.
  69. */
  70. return {
  71. top: `${offset}px`,
  72. bottom: `${offset}px`,
  73. };
  74. }
  75. else {
  76. return {
  77. top: `calc(${offset}px + var(--ion-safe-area-top, 0px))`,
  78. bottom: `calc(${offset}px - var(--ion-safe-area-bottom, 0px))`,
  79. };
  80. }
  81. }
  82. /**
  83. * If the anchor element is hidden, getBoundingClientRect()
  84. * will return all 0s for it, which can cause unexpected
  85. * results in the position calculation when animating.
  86. */
  87. function warnIfAnchorIsHidden(positionAnchor, toast) {
  88. if (positionAnchor.offsetParent === null) {
  89. printIonWarning('[ion-toast] - The positionAnchor element for ion-toast was found in the DOM, but appears to be hidden. This may lead to unexpected positioning of the toast.', toast);
  90. }
  91. }
  92. /**
  93. * Returns the top offset required to place
  94. * the toast in the middle of the screen.
  95. * Only needed when position="toast".
  96. * @param toastHeight - The height of the ion-toast element
  97. * @param wrapperHeight - The height of the .toast-wrapper element
  98. * inside the toast's shadow root.
  99. */
  100. const getOffsetForMiddlePosition = (toastHeight, wrapperHeight) => {
  101. return Math.floor(toastHeight / 2 - wrapperHeight / 2);
  102. };
  103. /**
  104. * iOS Toast Enter Animation
  105. */
  106. const iosEnterAnimation = (baseEl, opts) => {
  107. const baseAnimation = createAnimation();
  108. const wrapperAnimation = createAnimation();
  109. const { position, top, bottom } = opts;
  110. const root = getElementRoot(baseEl);
  111. const wrapperEl = root.querySelector('.toast-wrapper');
  112. wrapperAnimation.addElement(wrapperEl);
  113. switch (position) {
  114. case 'top':
  115. wrapperAnimation.fromTo('transform', 'translateY(-100%)', `translateY(${top})`);
  116. break;
  117. case 'middle':
  118. const topPosition = getOffsetForMiddlePosition(baseEl.clientHeight, wrapperEl.clientHeight);
  119. wrapperEl.style.top = `${topPosition}px`;
  120. wrapperAnimation.fromTo('opacity', 0.01, 1);
  121. break;
  122. default:
  123. wrapperAnimation.fromTo('transform', 'translateY(100%)', `translateY(${bottom})`);
  124. break;
  125. }
  126. return baseAnimation.easing('cubic-bezier(.155,1.105,.295,1.12)').duration(400).addAnimation(wrapperAnimation);
  127. };
  128. /**
  129. * iOS Toast Leave Animation
  130. */
  131. const iosLeaveAnimation = (baseEl, opts) => {
  132. const baseAnimation = createAnimation();
  133. const wrapperAnimation = createAnimation();
  134. const { position, top, bottom } = opts;
  135. const root = getElementRoot(baseEl);
  136. const wrapperEl = root.querySelector('.toast-wrapper');
  137. wrapperAnimation.addElement(wrapperEl);
  138. switch (position) {
  139. case 'top':
  140. wrapperAnimation.fromTo('transform', `translateY(${top})`, 'translateY(-100%)');
  141. break;
  142. case 'middle':
  143. wrapperAnimation.fromTo('opacity', 0.99, 0);
  144. break;
  145. default:
  146. wrapperAnimation.fromTo('transform', `translateY(${bottom})`, 'translateY(100%)');
  147. break;
  148. }
  149. return baseAnimation.easing('cubic-bezier(.36,.66,.04,1)').duration(300).addAnimation(wrapperAnimation);
  150. };
  151. /**
  152. * MD Toast Enter Animation
  153. */
  154. const mdEnterAnimation = (baseEl, opts) => {
  155. const baseAnimation = createAnimation();
  156. const wrapperAnimation = createAnimation();
  157. const { position, top, bottom } = opts;
  158. const root = getElementRoot(baseEl);
  159. const wrapperEl = root.querySelector('.toast-wrapper');
  160. wrapperAnimation.addElement(wrapperEl);
  161. switch (position) {
  162. case 'top':
  163. wrapperEl.style.setProperty('transform', `translateY(${top})`);
  164. wrapperAnimation.fromTo('opacity', 0.01, 1);
  165. break;
  166. case 'middle':
  167. const topPosition = getOffsetForMiddlePosition(baseEl.clientHeight, wrapperEl.clientHeight);
  168. wrapperEl.style.top = `${topPosition}px`;
  169. wrapperAnimation.fromTo('opacity', 0.01, 1);
  170. break;
  171. default:
  172. wrapperEl.style.setProperty('transform', `translateY(${bottom})`);
  173. wrapperAnimation.fromTo('opacity', 0.01, 1);
  174. break;
  175. }
  176. return baseAnimation.easing('cubic-bezier(.36,.66,.04,1)').duration(400).addAnimation(wrapperAnimation);
  177. };
  178. /**
  179. * md Toast Leave Animation
  180. */
  181. const mdLeaveAnimation = (baseEl) => {
  182. const baseAnimation = createAnimation();
  183. const wrapperAnimation = createAnimation();
  184. const root = getElementRoot(baseEl);
  185. const wrapperEl = root.querySelector('.toast-wrapper');
  186. wrapperAnimation.addElement(wrapperEl).fromTo('opacity', 0.99, 0);
  187. return baseAnimation.easing('cubic-bezier(.36,.66,.04,1)').duration(300).addAnimation(wrapperAnimation);
  188. };
  189. /**
  190. * Create a gesture that allows the Toast
  191. * to be swiped to dismiss.
  192. * @param el - The Toast element
  193. * @param toastPosition - The last computed position of the Toast. This is computed in the "present" method.
  194. * @param onDismiss - A callback to fire when the Toast was swiped to dismiss.
  195. */
  196. const createSwipeToDismissGesture = (el, toastPosition, onDismiss) => {
  197. /**
  198. * Users should swipe on the visible toast wrapper
  199. * rather than on ion-toast which covers the entire screen.
  200. * When testing the class instance the inner wrapper will not
  201. * be defined. As a result, we use a placeholder element in those environments.
  202. */
  203. const wrapperEl = Build.isTesting
  204. ? document.createElement('div')
  205. : getElementRoot(el).querySelector('.toast-wrapper');
  206. const hostElHeight = el.clientHeight;
  207. const wrapperElBox = wrapperEl.getBoundingClientRect();
  208. /**
  209. * The maximum amount that
  210. * the toast can be swiped. This should
  211. * account for the wrapper element's height
  212. * too so the toast can be swiped offscreen
  213. * completely.
  214. */
  215. let MAX_SWIPE_DISTANCE = 0;
  216. /**
  217. * The step value at which a toast
  218. * is eligible for dismissing via gesture.
  219. */
  220. const DISMISS_THRESHOLD = 0.5;
  221. /**
  222. * The middle position Toast starts 50% of the way
  223. * through the animation, so we need to use this
  224. * as the starting point for our step values.
  225. */
  226. const STEP_OFFSET = el.position === 'middle' ? 0.5 : 0;
  227. /**
  228. * When the Toast is at the top users will be
  229. * swiping up. As a result, the delta values will be
  230. * negative numbers which will result in negative steps
  231. * and thresholds. As a result, we need to make those numbers
  232. * positive.
  233. */
  234. const INVERSION_FACTOR = el.position === 'top' ? -1 : 1;
  235. /**
  236. * The top offset that places the
  237. * toast in the middle of the screen.
  238. * Only needed when position="middle".
  239. */
  240. const topPosition = getOffsetForMiddlePosition(hostElHeight, wrapperElBox.height);
  241. const SWIPE_UP_DOWN_KEYFRAMES = [
  242. { offset: 0, transform: `translateY(-${topPosition + wrapperElBox.height}px)` },
  243. { offset: 0.5, transform: `translateY(0px)` },
  244. { offset: 1, transform: `translateY(${topPosition + wrapperElBox.height}px)` },
  245. ];
  246. const swipeAnimation = createAnimation('toast-swipe-to-dismiss-animation')
  247. .addElement(wrapperEl)
  248. /**
  249. * The specific value here does not actually
  250. * matter. We just need this to be a positive
  251. * value so the animation does not jump
  252. * to the end when the user beings to drag.
  253. */
  254. .duration(100);
  255. switch (el.position) {
  256. case 'middle':
  257. MAX_SWIPE_DISTANCE = hostElHeight + wrapperElBox.height;
  258. swipeAnimation.keyframes(SWIPE_UP_DOWN_KEYFRAMES);
  259. /**
  260. * Toast can be swiped up or down but
  261. * should start in the middle of the screen.
  262. */
  263. swipeAnimation.progressStart(true, 0.5);
  264. break;
  265. case 'top':
  266. /**
  267. * The bottom edge of the wrapper
  268. * includes the distance between the top
  269. * of the screen and the top of the wrapper
  270. * as well as the wrapper height so the wrapper
  271. * can be dragged fully offscreen.
  272. */
  273. MAX_SWIPE_DISTANCE = wrapperElBox.bottom;
  274. swipeAnimation.keyframes([
  275. { offset: 0, transform: `translateY(${toastPosition.top})` },
  276. { offset: 1, transform: 'translateY(-100%)' },
  277. ]);
  278. swipeAnimation.progressStart(true, 0);
  279. break;
  280. case 'bottom':
  281. default:
  282. /**
  283. * This computes the distance between the
  284. * top of the wrapper and the bottom of the
  285. * screen including the height of the wrapper
  286. * element so it can be dragged fully offscreen.
  287. */
  288. MAX_SWIPE_DISTANCE = hostElHeight - wrapperElBox.top;
  289. swipeAnimation.keyframes([
  290. { offset: 0, transform: `translateY(${toastPosition.bottom})` },
  291. { offset: 1, transform: 'translateY(100%)' },
  292. ]);
  293. swipeAnimation.progressStart(true, 0);
  294. break;
  295. }
  296. const computeStep = (delta) => {
  297. return (delta * INVERSION_FACTOR) / MAX_SWIPE_DISTANCE;
  298. };
  299. const onMove = (detail) => {
  300. const step = STEP_OFFSET + computeStep(detail.deltaY);
  301. swipeAnimation.progressStep(step);
  302. };
  303. const onEnd = (detail) => {
  304. const velocity = detail.velocityY;
  305. const threshold = ((detail.deltaY + velocity * 1000) / MAX_SWIPE_DISTANCE) * INVERSION_FACTOR;
  306. /**
  307. * Disable the gesture for the remainder of the animation.
  308. * It will be re-enabled if the toast animates back to
  309. * its initial presented position.
  310. */
  311. gesture.enable(false);
  312. let shouldDismiss = true;
  313. let playTo = 1;
  314. let step = 0;
  315. let remainingDistance = 0;
  316. if (el.position === 'middle') {
  317. /**
  318. * A middle positioned Toast appears
  319. * in the middle of the screen (at animation offset 0.5).
  320. * As a result, the threshold will be calculated relative
  321. * to this starting position. In other words at animation offset 0.5
  322. * the threshold will be 0. We want the middle Toast to be eligible
  323. * for dismiss when the user has swiped either half way up or down the
  324. * screen. As a result, we divide DISMISS_THRESHOLD in half. We also
  325. * consider when the threshold is a negative in the event the
  326. * user drags up (since the deltaY will also be negative).
  327. */
  328. shouldDismiss = threshold >= DISMISS_THRESHOLD / 2 || threshold <= -DISMISS_THRESHOLD / 2;
  329. /**
  330. * Since we are replacing the keyframes
  331. * below the animation always starts from
  332. * the beginning of the new keyframes.
  333. * Similarly, we are always playing to
  334. * the end of the new keyframes.
  335. */
  336. playTo = 1;
  337. step = 0;
  338. /**
  339. * The Toast should animate from wherever its
  340. * current position is to the desired end state.
  341. *
  342. * To begin, we get the current position of the
  343. * Toast for its starting state.
  344. */
  345. const wrapperElBox = wrapperEl.getBoundingClientRect();
  346. const startOffset = wrapperElBox.top - topPosition;
  347. const startPosition = `${startOffset}px`;
  348. /**
  349. * If the deltaY is negative then the user is swiping
  350. * up, so the Toast should animate to the top of the screen.
  351. * If the deltaY is positive then the user is swiping
  352. * down, so the Toast should animate to the bottom of the screen.
  353. * We also account for when the deltaY is 0, but realistically
  354. * that should never happen because it means the user did not drag
  355. * the toast.
  356. */
  357. const offsetFactor = detail.deltaY <= 0 ? -1 : 1;
  358. const endOffset = (topPosition + wrapperElBox.height) * offsetFactor;
  359. /**
  360. * If the Toast should dismiss
  361. * then we need to figure out which edge of
  362. * the screen it should animate towards.
  363. * By default, the Toast will come
  364. * back to its default state in the
  365. * middle of the screen.
  366. */
  367. const endPosition = shouldDismiss ? `${endOffset}px` : '0px';
  368. const KEYFRAMES = [
  369. { offset: 0, transform: `translateY(${startPosition})` },
  370. { offset: 1, transform: `translateY(${endPosition})` },
  371. ];
  372. swipeAnimation.keyframes(KEYFRAMES);
  373. /**
  374. * Compute the remaining amount of pixels the
  375. * toast needs to move to be fully dismissed.
  376. */
  377. remainingDistance = endOffset - startOffset;
  378. }
  379. else {
  380. shouldDismiss = threshold >= DISMISS_THRESHOLD;
  381. playTo = shouldDismiss ? 1 : 0;
  382. step = computeStep(detail.deltaY);
  383. /**
  384. * Compute the remaining amount of pixels the
  385. * toast needs to move to be fully dismissed.
  386. */
  387. const remainingStepAmount = shouldDismiss ? 1 - step : step;
  388. remainingDistance = remainingStepAmount * MAX_SWIPE_DISTANCE;
  389. }
  390. /**
  391. * The animation speed should depend on how quickly
  392. * the user flicks the toast across the screen. However,
  393. * it should be no slower than 200ms.
  394. * We use Math.abs on the remainingDistance because that value
  395. * can be negative when swiping up on a middle position toast.
  396. */
  397. const duration = Math.min(Math.abs(remainingDistance) / Math.abs(velocity), 200);
  398. swipeAnimation
  399. .onFinish(() => {
  400. if (shouldDismiss) {
  401. onDismiss();
  402. swipeAnimation.destroy();
  403. }
  404. else {
  405. if (el.position === 'middle') {
  406. /**
  407. * If the toast snapped back to
  408. * the middle of the screen we need
  409. * to reset the keyframes
  410. * so the toast can be swiped
  411. * up or down again.
  412. */
  413. swipeAnimation.keyframes(SWIPE_UP_DOWN_KEYFRAMES).progressStart(true, 0.5);
  414. }
  415. else {
  416. swipeAnimation.progressStart(true, 0);
  417. }
  418. /**
  419. * If the toast did not dismiss then
  420. * the user should be able to swipe again.
  421. */
  422. gesture.enable(true);
  423. }
  424. /**
  425. * This must be a one time callback
  426. * otherwise a new callback will
  427. * be added every time onEnd runs.
  428. */
  429. }, { oneTimeCallback: true })
  430. .progressEnd(playTo, step, duration);
  431. };
  432. const gesture = createGesture({
  433. el: wrapperEl,
  434. gestureName: 'toast-swipe-to-dismiss',
  435. gesturePriority: OVERLAY_GESTURE_PRIORITY,
  436. /**
  437. * Toast only supports vertical swipes.
  438. * This needs to be updated if we later
  439. * support horizontal swipes.
  440. */
  441. direction: 'y',
  442. onMove,
  443. onEnd,
  444. });
  445. return gesture;
  446. };
  447. const toastIosCss = ":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:normal;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}:host{inset-inline-start:0}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);pointer-events:auto}.toast-wrapper{inset-inline-start:var(--start);inset-inline-end:var(--end)}.toast-wrapper.toast-top{-webkit-transform:translate3d(0, -100%, 0);transform:translate3d(0, -100%, 0);top:0}.toast-wrapper.toast-bottom{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);bottom:0}.toast-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-layout-stacked .toast-container{-ms-flex-wrap:wrap;flex-wrap:wrap}.toast-layout-baseline .toast-content{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}.toast-icon{-webkit-margin-start:16px;margin-inline-start:16px}.toast-content{min-width:0}.toast-message{-ms-flex:1;flex:1;white-space:var(--white-space)}.toast-button-group{display:-ms-flexbox;display:flex}.toast-layout-stacked .toast-button-group{-ms-flex-pack:end;justify-content:end;width:100%}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon,.toast-button-icon{font-size:1.4em}.toast-button-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--border-radius:14px;--button-color:var(--ion-color-primary, #0054e9);--color:var(--ion-color-step-850, var(--ion-text-color-step-150, #262626));--max-width:700px;--max-height:478px;--start:10px;--end:10px;font-size:clamp(14px, 0.875rem, 43.4px)}.toast-wrapper{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;z-index:10}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.toast-translucent) .toast-wrapper{background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}:host(.ion-color.toast-translucent) .toast-wrapper{background:rgba(var(--ion-color-base-rgb), 0.8)}}.toast-wrapper.toast-middle{opacity:0.01}.toast-content{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:15px;padding-bottom:15px}.toast-header{margin-bottom:2px;font-weight:500}.toast-button{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:10px;padding-bottom:10px;min-height:44px;-webkit-transition:background-color, opacity 100ms linear;transition:background-color, opacity 100ms linear;border:0;background-color:transparent;font-family:var(--ion-font-family);font-size:clamp(17px, 1.0625rem, 21.998px);font-weight:500;overflow:hidden}.toast-button.ion-activated{opacity:0.4}@media (any-hover: hover){.toast-button:hover{opacity:0.6}}";
  448. const IonToastIosStyle0 = toastIosCss;
  449. const toastMdCss = ":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:normal;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}:host{inset-inline-start:0}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);pointer-events:auto}.toast-wrapper{inset-inline-start:var(--start);inset-inline-end:var(--end)}.toast-wrapper.toast-top{-webkit-transform:translate3d(0, -100%, 0);transform:translate3d(0, -100%, 0);top:0}.toast-wrapper.toast-bottom{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);bottom:0}.toast-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-layout-stacked .toast-container{-ms-flex-wrap:wrap;flex-wrap:wrap}.toast-layout-baseline .toast-content{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}.toast-icon{-webkit-margin-start:16px;margin-inline-start:16px}.toast-content{min-width:0}.toast-message{-ms-flex:1;flex:1;white-space:var(--white-space)}.toast-button-group{display:-ms-flexbox;display:flex}.toast-layout-stacked .toast-button-group{-ms-flex-pack:end;justify-content:end;width:100%}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon,.toast-button-icon{font-size:1.4em}.toast-button-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-800, var(--ion-background-color-step-800, #333333));--border-radius:4px;--box-shadow:0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);--button-color:var(--ion-color-primary, #0054e9);--color:var(--ion-color-step-50, var(--ion-text-color-step-950, #f2f2f2));--max-width:700px;--start:8px;--end:8px;font-size:0.875rem}.toast-wrapper{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;opacity:0.01;z-index:10}.toast-content{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:14px;padding-bottom:14px}.toast-header{margin-bottom:2px;font-weight:500;line-height:1.25rem}.toast-message{line-height:1.25rem}.toast-layout-baseline .toast-button-group-start{-webkit-margin-start:8px;margin-inline-start:8px}.toast-layout-stacked .toast-button-group-start{-webkit-margin-end:8px;margin-inline-end:8px;margin-top:8px}.toast-layout-baseline .toast-button-group-end{-webkit-margin-end:8px;margin-inline-end:8px}.toast-layout-stacked .toast-button-group-end{-webkit-margin-end:8px;margin-inline-end:8px;margin-bottom:8px}.toast-button{-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px;padding-top:10px;padding-bottom:10px;position:relative;background-color:transparent;font-family:var(--ion-font-family);font-size:0.875rem;font-weight:500;letter-spacing:0.84px;text-transform:uppercase;overflow:hidden}.toast-button-cancel{color:var(--ion-color-step-100, var(--ion-text-color-step-900, #e6e6e6))}.toast-button-icon-only{border-radius:50%;-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px;padding-top:9px;padding-bottom:9px;width:36px;height:36px}@media (any-hover: hover){.toast-button:hover{background-color:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.08)}.toast-button-cancel:hover{background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.08)}}";
  450. const IonToastMdStyle0 = toastMdCss;
  451. const Toast = /*@__PURE__*/ proxyCustomElement(class Toast extends HTMLElement {
  452. constructor() {
  453. super();
  454. this.__registerHost();
  455. this.__attachShadow();
  456. this.didPresent = createEvent(this, "ionToastDidPresent", 7);
  457. this.willPresent = createEvent(this, "ionToastWillPresent", 7);
  458. this.willDismiss = createEvent(this, "ionToastWillDismiss", 7);
  459. this.didDismiss = createEvent(this, "ionToastDidDismiss", 7);
  460. this.didPresentShorthand = createEvent(this, "didPresent", 7);
  461. this.willPresentShorthand = createEvent(this, "willPresent", 7);
  462. this.willDismissShorthand = createEvent(this, "willDismiss", 7);
  463. this.didDismissShorthand = createEvent(this, "didDismiss", 7);
  464. this.delegateController = createDelegateController(this);
  465. this.lockController = createLockController();
  466. this.triggerController = createTriggerController();
  467. this.customHTMLEnabled = config.get('innerHTMLTemplatesEnabled', ENABLE_HTML_CONTENT_DEFAULT);
  468. this.presented = false;
  469. this.dispatchCancelHandler = (ev) => {
  470. const role = ev.detail.role;
  471. if (isCancel(role)) {
  472. const cancelButton = this.getButtons().find((b) => b.role === 'cancel');
  473. this.callButtonHandler(cancelButton);
  474. }
  475. };
  476. /**
  477. * Create a new swipe gesture so Toast
  478. * can be swiped to dismiss.
  479. */
  480. this.createSwipeGesture = (toastPosition) => {
  481. const gesture = (this.gesture = createSwipeToDismissGesture(this.el, toastPosition, () => {
  482. /**
  483. * If the gesture completed then
  484. * we should dismiss the toast.
  485. */
  486. this.dismiss(undefined, GESTURE);
  487. }));
  488. gesture.enable(true);
  489. };
  490. /**
  491. * Destroy an existing swipe gesture
  492. * so Toast can no longer be swiped to dismiss.
  493. */
  494. this.destroySwipeGesture = () => {
  495. const { gesture } = this;
  496. if (gesture === undefined) {
  497. return;
  498. }
  499. gesture.destroy();
  500. this.gesture = undefined;
  501. };
  502. /**
  503. * Returns `true` if swipeGesture
  504. * is configured to a value that enables the swipe behavior.
  505. * Returns `false` otherwise.
  506. */
  507. this.prefersSwipeGesture = () => {
  508. const { swipeGesture } = this;
  509. return swipeGesture === 'vertical';
  510. };
  511. this.revealContentToScreenReader = false;
  512. this.overlayIndex = undefined;
  513. this.delegate = undefined;
  514. this.hasController = false;
  515. this.color = undefined;
  516. this.enterAnimation = undefined;
  517. this.leaveAnimation = undefined;
  518. this.cssClass = undefined;
  519. this.duration = config.getNumber('toastDuration', 0);
  520. this.header = undefined;
  521. this.layout = 'baseline';
  522. this.message = undefined;
  523. this.keyboardClose = false;
  524. this.position = 'bottom';
  525. this.positionAnchor = undefined;
  526. this.buttons = undefined;
  527. this.translucent = false;
  528. this.animated = true;
  529. this.icon = undefined;
  530. this.htmlAttributes = undefined;
  531. this.swipeGesture = undefined;
  532. this.isOpen = false;
  533. this.trigger = undefined;
  534. }
  535. swipeGestureChanged() {
  536. /**
  537. * If the Toast is presented, then we need to destroy
  538. * any actives gestures before a new gesture is potentially
  539. * created below.
  540. *
  541. * If the Toast is dismissed, then no gesture should be available
  542. * since the Toast is not visible. This case should never
  543. * happen since the "dismiss" method handles destroying
  544. * any active swipe gestures, but we keep this code
  545. * around to handle the first case.
  546. */
  547. this.destroySwipeGesture();
  548. /**
  549. * A new swipe gesture should only be created
  550. * if the Toast is presented. If the Toast is not
  551. * yet presented then the "present" method will
  552. * handle calling the swipe gesture setup function.
  553. */
  554. if (this.presented && this.prefersSwipeGesture()) {
  555. /**
  556. * If the Toast is presented then
  557. * lastPresentedPosition is defined.
  558. */
  559. this.createSwipeGesture(this.lastPresentedPosition);
  560. }
  561. }
  562. onIsOpenChange(newValue, oldValue) {
  563. if (newValue === true && oldValue === false) {
  564. this.present();
  565. }
  566. else if (newValue === false && oldValue === true) {
  567. this.dismiss();
  568. }
  569. }
  570. triggerChanged() {
  571. const { trigger, el, triggerController } = this;
  572. if (trigger) {
  573. triggerController.addClickListener(el, trigger);
  574. }
  575. }
  576. connectedCallback() {
  577. prepareOverlay(this.el);
  578. this.triggerChanged();
  579. }
  580. disconnectedCallback() {
  581. this.triggerController.removeClickListener();
  582. }
  583. componentWillLoad() {
  584. var _a;
  585. if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
  586. setOverlayId(this.el);
  587. }
  588. }
  589. componentDidLoad() {
  590. /**
  591. * If toast was rendered with isOpen="true"
  592. * then we should open toast immediately.
  593. */
  594. if (this.isOpen === true) {
  595. raf(() => this.present());
  596. }
  597. /**
  598. * When binding values in frameworks such as Angular
  599. * it is possible for the value to be set after the Web Component
  600. * initializes but before the value watcher is set up in Stencil.
  601. * As a result, the watcher callback may not be fired.
  602. * We work around this by manually calling the watcher
  603. * callback when the component has loaded and the watcher
  604. * is configured.
  605. */
  606. this.triggerChanged();
  607. }
  608. /**
  609. * Present the toast overlay after it has been created.
  610. */
  611. async present() {
  612. const unlock = await this.lockController.lock();
  613. await this.delegateController.attachViewToDom();
  614. const { el, position } = this;
  615. const anchor = this.getAnchorElement();
  616. const animationPosition = getAnimationPosition(position, anchor, getIonMode(this), el);
  617. /**
  618. * Cache the calculated position of the toast, so we can re-use it
  619. * in the dismiss animation.
  620. */
  621. this.lastPresentedPosition = animationPosition;
  622. await present(this, 'toastEnter', iosEnterAnimation, mdEnterAnimation, {
  623. position,
  624. top: animationPosition.top,
  625. bottom: animationPosition.bottom,
  626. });
  627. /**
  628. * Content is revealed to screen readers after
  629. * the transition to avoid jank since this
  630. * state updates will cause a re-render.
  631. */
  632. this.revealContentToScreenReader = true;
  633. if (this.duration > 0) {
  634. this.durationTimeout = setTimeout(() => this.dismiss(undefined, 'timeout'), this.duration);
  635. }
  636. /**
  637. * If the Toast has a swipe gesture then we can
  638. * create the gesture so users can swipe the
  639. * presented Toast.
  640. */
  641. if (this.prefersSwipeGesture()) {
  642. this.createSwipeGesture(animationPosition);
  643. }
  644. unlock();
  645. }
  646. /**
  647. * Dismiss the toast overlay after it has been presented.
  648. *
  649. * @param data Any data to emit in the dismiss events.
  650. * @param role The role of the element that is dismissing the toast.
  651. * This can be useful in a button handler for determining which button was
  652. * clicked to dismiss the toast.
  653. * Some examples include: ``"cancel"`, `"destructive"`, "selected"`, and `"backdrop"`.
  654. *
  655. * This is a no-op if the overlay has not been presented yet. If you want
  656. * to remove an overlay from the DOM that was never presented, use the
  657. * [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
  658. */
  659. async dismiss(data, role) {
  660. var _a, _b;
  661. const unlock = await this.lockController.lock();
  662. const { durationTimeout, position, lastPresentedPosition } = this;
  663. if (durationTimeout) {
  664. clearTimeout(durationTimeout);
  665. }
  666. const dismissed = await dismiss(this, data, role, 'toastLeave', iosLeaveAnimation, mdLeaveAnimation,
  667. /**
  668. * Fetch the cached position that was calculated back in the present
  669. * animation. We always want to animate the dismiss from the same
  670. * position the present stopped at, so the animation looks continuous.
  671. */
  672. {
  673. position,
  674. top: (_a = lastPresentedPosition === null || lastPresentedPosition === void 0 ? void 0 : lastPresentedPosition.top) !== null && _a !== void 0 ? _a : '',
  675. bottom: (_b = lastPresentedPosition === null || lastPresentedPosition === void 0 ? void 0 : lastPresentedPosition.bottom) !== null && _b !== void 0 ? _b : '',
  676. });
  677. if (dismissed) {
  678. this.delegateController.removeViewFromDom();
  679. this.revealContentToScreenReader = false;
  680. }
  681. this.lastPresentedPosition = undefined;
  682. /**
  683. * If the Toast has a swipe gesture then we can
  684. * safely destroy it now that it is dismissed.
  685. */
  686. this.destroySwipeGesture();
  687. unlock();
  688. return dismissed;
  689. }
  690. /**
  691. * Returns a promise that resolves when the toast did dismiss.
  692. */
  693. onDidDismiss() {
  694. return eventMethod(this.el, 'ionToastDidDismiss');
  695. }
  696. /**
  697. * Returns a promise that resolves when the toast will dismiss.
  698. */
  699. onWillDismiss() {
  700. return eventMethod(this.el, 'ionToastWillDismiss');
  701. }
  702. getButtons() {
  703. const buttons = this.buttons
  704. ? this.buttons.map((b) => {
  705. return typeof b === 'string' ? { text: b } : b;
  706. })
  707. : [];
  708. return buttons;
  709. }
  710. /**
  711. * Returns the element specified by the positionAnchor prop,
  712. * or undefined if prop's value is an ID string and the element
  713. * is not found in the DOM.
  714. */
  715. getAnchorElement() {
  716. const { position, positionAnchor, el } = this;
  717. /**
  718. * If positionAnchor is undefined then
  719. * no anchor should be used when presenting the toast.
  720. */
  721. if (positionAnchor === undefined) {
  722. return;
  723. }
  724. if (position === 'middle' && positionAnchor !== undefined) {
  725. printIonWarning('[ion-toast] - The positionAnchor property is ignored when using position="middle".', this.el);
  726. return undefined;
  727. }
  728. if (typeof positionAnchor === 'string') {
  729. /**
  730. * If the anchor is defined as an ID, find the element.
  731. * We do this on every present so the toast doesn't need
  732. * to account for the surrounding DOM changing since the
  733. * last time it was presented.
  734. */
  735. const foundEl = document.getElementById(positionAnchor);
  736. if (foundEl === null) {
  737. printIonWarning(`[ion-toast] - An anchor element with an ID of "${positionAnchor}" was not found in the DOM.`, el);
  738. return undefined;
  739. }
  740. return foundEl;
  741. }
  742. if (positionAnchor instanceof HTMLElement) {
  743. return positionAnchor;
  744. }
  745. printIonWarning('[ion-toast] - Invalid positionAnchor value:', positionAnchor, el);
  746. return undefined;
  747. }
  748. async buttonClick(button) {
  749. const role = button.role;
  750. if (isCancel(role)) {
  751. return this.dismiss(undefined, role);
  752. }
  753. const shouldDismiss = await this.callButtonHandler(button);
  754. if (shouldDismiss) {
  755. return this.dismiss(undefined, role);
  756. }
  757. return Promise.resolve();
  758. }
  759. async callButtonHandler(button) {
  760. if (button === null || button === void 0 ? void 0 : button.handler) {
  761. // a handler has been provided, execute it
  762. // pass the handler the values from the inputs
  763. try {
  764. const rtn = await safeCall(button.handler);
  765. if (rtn === false) {
  766. // if the return value of the handler is false then do not dismiss
  767. return false;
  768. }
  769. }
  770. catch (e) {
  771. printIonError('[ion-toast] - Exception in callButtonHandler:', e);
  772. }
  773. }
  774. return true;
  775. }
  776. renderButtons(buttons, side) {
  777. if (buttons.length === 0) {
  778. return;
  779. }
  780. const mode = getIonMode(this);
  781. const buttonGroupsClasses = {
  782. 'toast-button-group': true,
  783. [`toast-button-group-${side}`]: true,
  784. };
  785. return (h("div", { class: buttonGroupsClasses }, buttons.map((b) => (h("button", Object.assign({}, b.htmlAttributes, { type: "button", class: buttonClass(b), tabIndex: 0, onClick: () => this.buttonClick(b), part: buttonPart(b) }), h("div", { class: "toast-button-inner" }, b.icon && (h("ion-icon", { "aria-hidden": "true", icon: b.icon, slot: b.text === undefined ? 'icon-only' : undefined, class: "toast-button-icon" })), b.text), mode === 'md' && (h("ion-ripple-effect", { type: b.icon !== undefined && b.text === undefined ? 'unbounded' : 'bounded' })))))));
  786. }
  787. /**
  788. * Render the `message` property.
  789. * @param key - A key to give the element a stable identity. This is used to improve compatibility with screen readers.
  790. * @param ariaHidden - If "true" then content will be hidden from screen readers.
  791. */
  792. renderToastMessage(key, ariaHidden = null) {
  793. const { customHTMLEnabled, message } = this;
  794. if (customHTMLEnabled) {
  795. return (h("div", { key: key, "aria-hidden": ariaHidden, class: "toast-message", part: "message", innerHTML: sanitizeDOMString(message) }));
  796. }
  797. return (h("div", { key: key, "aria-hidden": ariaHidden, class: "toast-message", part: "message" }, message));
  798. }
  799. /**
  800. * Render the `header` property.
  801. * @param key - A key to give the element a stable identity. This is used to improve compatibility with screen readers.
  802. * @param ariaHidden - If "true" then content will be hidden from screen readers.
  803. */
  804. renderHeader(key, ariaHidden = null) {
  805. return (h("div", { key: key, class: "toast-header", "aria-hidden": ariaHidden, part: "header" }, this.header));
  806. }
  807. render() {
  808. const { layout, el, revealContentToScreenReader, header, message } = this;
  809. const allButtons = this.getButtons();
  810. const startButtons = allButtons.filter((b) => b.side === 'start');
  811. const endButtons = allButtons.filter((b) => b.side !== 'start');
  812. const mode = getIonMode(this);
  813. const wrapperClass = {
  814. 'toast-wrapper': true,
  815. [`toast-${this.position}`]: true,
  816. [`toast-layout-${layout}`]: true,
  817. };
  818. /**
  819. * Stacked buttons are only meant to be
  820. * used with one type of button.
  821. */
  822. if (layout === 'stacked' && startButtons.length > 0 && endButtons.length > 0) {
  823. printIonWarning('[ion-toast] - This toast is using start and end buttons with the stacked toast layout. We recommend following the best practice of using either start or end buttons with the stacked toast layout.', el);
  824. }
  825. return (h(Host, Object.assign({ key: 'a2216d860255c99337464370dcb12f6125871a50', tabindex: "-1" }, this.htmlAttributes, { style: {
  826. zIndex: `${60000 + this.overlayIndex}`,
  827. }, class: createColorClasses(this.color, Object.assign(Object.assign({ [mode]: true }, getClassMap(this.cssClass)), { 'overlay-hidden': true, 'toast-translucent': this.translucent })), onIonToastWillDismiss: this.dispatchCancelHandler }), h("div", { key: 'd5adf8bc4c6c52431600033a76c4795689f9b412', class: wrapperClass }, h("div", { key: 'ab694497ae37ceba123217eb48800129b9bebb84', class: "toast-container", part: "container" }, this.renderButtons(startButtons, 'start'), this.icon !== undefined && (h("ion-icon", { key: '224854fa3989ce0eb69416cb5b0cc55fc9f131ea', class: "toast-icon", part: "icon", icon: this.icon, lazy: false, "aria-hidden": "true" })), h("div", { key: 'c8e11fb5bdac202987f5c8613a0ebbd42bda946e', class: "toast-content", role: "status", "aria-atomic": "true", "aria-live": "polite" }, !revealContentToScreenReader && header !== undefined && this.renderHeader('oldHeader', 'true'), !revealContentToScreenReader && message !== undefined && this.renderToastMessage('oldMessage', 'true'), revealContentToScreenReader && header !== undefined && this.renderHeader('header'), revealContentToScreenReader && message !== undefined && this.renderToastMessage('header')), this.renderButtons(endButtons, 'end')))));
  828. }
  829. get el() { return this; }
  830. static get watchers() { return {
  831. "swipeGesture": ["swipeGestureChanged"],
  832. "isOpen": ["onIsOpenChange"],
  833. "trigger": ["triggerChanged"]
  834. }; }
  835. static get style() { return {
  836. ios: IonToastIosStyle0,
  837. md: IonToastMdStyle0
  838. }; }
  839. }, [33, "ion-toast", {
  840. "overlayIndex": [2, "overlay-index"],
  841. "delegate": [16],
  842. "hasController": [4, "has-controller"],
  843. "color": [513],
  844. "enterAnimation": [16],
  845. "leaveAnimation": [16],
  846. "cssClass": [1, "css-class"],
  847. "duration": [2],
  848. "header": [1],
  849. "layout": [1],
  850. "message": [1],
  851. "keyboardClose": [4, "keyboard-close"],
  852. "position": [1],
  853. "positionAnchor": [1, "position-anchor"],
  854. "buttons": [16],
  855. "translucent": [4],
  856. "animated": [4],
  857. "icon": [1],
  858. "htmlAttributes": [16],
  859. "swipeGesture": [1, "swipe-gesture"],
  860. "isOpen": [4, "is-open"],
  861. "trigger": [1],
  862. "revealContentToScreenReader": [32],
  863. "present": [64],
  864. "dismiss": [64],
  865. "onDidDismiss": [64],
  866. "onWillDismiss": [64]
  867. }, undefined, {
  868. "swipeGesture": ["swipeGestureChanged"],
  869. "isOpen": ["onIsOpenChange"],
  870. "trigger": ["triggerChanged"]
  871. }]);
  872. const buttonClass = (button) => {
  873. return {
  874. 'toast-button': true,
  875. 'toast-button-icon-only': button.icon !== undefined && button.text === undefined,
  876. [`toast-button-${button.role}`]: button.role !== undefined,
  877. 'ion-focusable': true,
  878. 'ion-activatable': true,
  879. };
  880. };
  881. const buttonPart = (button) => {
  882. return isCancel(button.role) ? 'button cancel' : 'button';
  883. };
  884. function defineCustomElement$1() {
  885. if (typeof customElements === "undefined") {
  886. return;
  887. }
  888. const components = ["ion-toast", "ion-icon", "ion-ripple-effect"];
  889. components.forEach(tagName => { switch (tagName) {
  890. case "ion-toast":
  891. if (!customElements.get(tagName)) {
  892. customElements.define(tagName, Toast);
  893. }
  894. break;
  895. case "ion-icon":
  896. if (!customElements.get(tagName)) {
  897. defineCustomElement$3();
  898. }
  899. break;
  900. case "ion-ripple-effect":
  901. if (!customElements.get(tagName)) {
  902. defineCustomElement$2();
  903. }
  904. break;
  905. } });
  906. }
  907. const IonToast = Toast;
  908. const defineCustomElement = defineCustomElement$1;
  909. export { IonToast, defineCustomElement };