foundation.d.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /**
  2. * @license
  3. * Copyright 2018 Google Inc.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to deal
  7. * in the Software without restriction, including without limitation the rights
  8. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. * copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in
  13. * all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. * THE SOFTWARE.
  22. */
  23. import { MDCFoundation } from '@material/base/foundation';
  24. import { MDCSnackbarAdapter } from './adapter';
  25. /** MDC Snackbar Foundation */
  26. export declare class MDCSnackbarFoundation extends MDCFoundation<MDCSnackbarAdapter> {
  27. static get cssClasses(): {
  28. CLOSING: string;
  29. OPEN: string;
  30. OPENING: string;
  31. };
  32. static get strings(): {
  33. ACTION_SELECTOR: string;
  34. CLOSED_EVENT: string;
  35. CLOSING_EVENT: string;
  36. DATA_LIVE_LABEL_TEXT: string;
  37. DISMISS_SELECTOR: string;
  38. LABEL_SELECTOR: string;
  39. OPENED_EVENT: string;
  40. OPENING_EVENT: string;
  41. REASON_ACTION: string;
  42. REASON_DISMISS: string;
  43. SURFACE_SELECTOR: string;
  44. };
  45. static get numbers(): {
  46. DEFAULT_AUTO_DISMISS_TIMEOUT_MS: number;
  47. INDETERMINATE: number;
  48. MAX_AUTO_DISMISS_TIMEOUT_MS: number;
  49. MIN_AUTO_DISMISS_TIMEOUT_MS: number;
  50. SNACKBAR_ANIMATION_CLOSE_TIME_MS: number;
  51. SNACKBAR_ANIMATION_OPEN_TIME_MS: number;
  52. ARIA_LIVE_DELAY_MS: number;
  53. };
  54. static get defaultAdapter(): MDCSnackbarAdapter;
  55. private opened;
  56. private animationFrame;
  57. private animationTimer;
  58. private autoDismissTimer;
  59. private autoDismissTimeoutMs;
  60. private closeOnEscape;
  61. constructor(adapter?: Partial<MDCSnackbarAdapter>);
  62. destroy(): void;
  63. open(): void;
  64. /**
  65. * @param reason Why the snackbar was closed. Value will be passed to
  66. * CLOSING_EVENT and CLOSED_EVENT via the `event.detail.reason` property.
  67. * Standard values are REASON_ACTION and REASON_DISMISS, but custom
  68. * client-specific values may also be used if desired.
  69. */
  70. close(reason?: string): void;
  71. isOpen(): boolean;
  72. getTimeoutMs(): number;
  73. setTimeoutMs(timeoutMs: number): void;
  74. getCloseOnEscape(): boolean;
  75. setCloseOnEscape(closeOnEscape: boolean): void;
  76. handleKeyDown(evt: KeyboardEvent): void;
  77. handleActionButtonClick(_evt: MouseEvent): void;
  78. handleActionIconClick(_evt: MouseEvent): void;
  79. private clearAutoDismissTimer;
  80. private handleAnimationTimerEnd;
  81. /**
  82. * Runs the given logic on the next animation frame, using setTimeout to
  83. * factor in Firefox reflow behavior.
  84. */
  85. private runNextAnimationFrame;
  86. }
  87. export default MDCSnackbarFoundation;