foundation.d.ts 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 { MDCSelectHelperTextAdapter } from './adapter';
  25. /** MDC Select Helper Text Foundation */
  26. export declare class MDCSelectHelperTextFoundation extends MDCFoundation<MDCSelectHelperTextAdapter> {
  27. static get cssClasses(): {
  28. HELPER_TEXT_VALIDATION_MSG: string;
  29. /** MDC Select Helper Text Foundation */
  30. HELPER_TEXT_VALIDATION_MSG_PERSISTENT: string;
  31. };
  32. static get strings(): {
  33. ARIA_HIDDEN: string;
  34. ROLE: string;
  35. };
  36. /**
  37. * See {@link MDCSelectHelperTextAdapter} for typing information on parameters
  38. * and return types.
  39. */
  40. static get defaultAdapter(): MDCSelectHelperTextAdapter;
  41. constructor(adapter?: Partial<MDCSelectHelperTextAdapter>);
  42. /**
  43. * @return The ID of the helper text, or null if none is set.
  44. */
  45. getId(): string | null;
  46. /**
  47. * @return Whether the helper text is currently visible.
  48. */
  49. isVisible(): boolean;
  50. /**
  51. * Sets the content of the helper text field.
  52. */
  53. setContent(content: string): void;
  54. /**
  55. * Sets the helper text to act as a validation message.
  56. * By default, validation messages are hidden when the select is valid and
  57. * visible when the select is invalid.
  58. *
  59. * @param isValidation True to make the helper text act as an error validation
  60. * message.
  61. */
  62. setValidation(isValidation: boolean): void;
  63. /**
  64. * Sets the persistency of the validation helper text.
  65. * This keeps the validation message visible even if the select is valid,
  66. * though it will be displayed in the normal (grey) color.
  67. */
  68. setValidationMsgPersistent(isPersistent: boolean): void;
  69. /**
  70. * @return Whether the helper text acts as a validation message.
  71. * By default, validation messages are hidden when the select is valid and
  72. * visible when the select is invalid.
  73. */
  74. getIsValidation(): boolean;
  75. /**
  76. * @return Whether the validation helper text persists even if the input is
  77. * valid. If it is, it will be displayed in the normal (grey) color.
  78. */
  79. getIsValidationMsgPersistent(): boolean;
  80. /**
  81. * When acting as a validation message, shows/hides the helper text and
  82. * triggers alerts as necessary based on the select's validity.
  83. */
  84. setValidity(selectIsValid: boolean): void;
  85. /**
  86. * Makes the helper text visible to screen readers.
  87. */
  88. private showToScreenReader;
  89. /**
  90. * Hides the help text from screen readers.
  91. */
  92. private hide;
  93. }
  94. export default MDCSelectHelperTextFoundation;