foundation.d.ts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * @license
  3. * Copyright 2020 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 { MDCSegmentedButtonSegmentAdapter } from './adapter';
  25. /** MDC Segmented Button Segment Foundation */
  26. export declare class MDCSegmentedButtonSegmentFoundation extends MDCFoundation<MDCSegmentedButtonSegmentAdapter> {
  27. static get defaultAdapter(): MDCSegmentedButtonSegmentAdapter;
  28. constructor(adapter?: Partial<MDCSegmentedButtonSegmentAdapter>);
  29. /**
  30. * @return Returns true if segment is currently selected, otherwise returns
  31. * false
  32. */
  33. isSelected(): boolean;
  34. /**
  35. * Sets segment to be selected
  36. */
  37. setSelected(): void;
  38. /**
  39. * Sets segment to be not selected
  40. */
  41. setUnselected(): void;
  42. /**
  43. * @return Returns segment's segmentId if it was set by client
  44. */
  45. getSegmentId(): string | undefined;
  46. /**
  47. * Called when segment is clicked. If the wrapping segmented button is single
  48. * select, doesn't allow segment to be set to not selected. Otherwise, toggles
  49. * segment's selected status. Finally, emits event to wrapping segmented
  50. * button.
  51. *
  52. * @event selected With detail - SegmentDetail
  53. */
  54. handleClick(): void;
  55. /**
  56. * @return Returns bounding rectangle for ripple effect
  57. */
  58. getDimensions(): DOMRect;
  59. /**
  60. * Sets segment from not selected to selected, or selected to not selected
  61. */
  62. private toggleSelection;
  63. /**
  64. * Sets appropriate aria attribute, based on wrapping segmented button's
  65. * single selected value, to new value
  66. *
  67. * @param value Value that represents selected status
  68. */
  69. private setAriaAttr;
  70. }