component.d.ts 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 { MDCComponent } from '@material/base/component';
  24. import { MDCChipActionType } from '../action/constants';
  25. import { MDCChipFactory } from '../chip/component';
  26. import { MDCChipSetFoundation } from './foundation';
  27. /**
  28. * MDCChip provides component encapsulation of the foundation implementation.
  29. */
  30. export declare class MDCChipSet extends MDCComponent<MDCChipSetFoundation> {
  31. static attachTo(root: HTMLElement): MDCChipSet;
  32. private handleChipAnimation;
  33. private handleChipInteraction;
  34. private handleChipNavigation;
  35. private chips;
  36. initialize(chipFactory?: MDCChipFactory): void;
  37. initialSyncWithDOM(): void;
  38. destroy(): void;
  39. getDefaultFoundation(): MDCChipSetFoundation;
  40. /** Returns the index of the chip with the given ID or -1 if none exists. */
  41. getChipIndexByID(chipID: string): number;
  42. /**
  43. * Returns the ID of the chip at the given index or an empty string if the
  44. * index is out of bounds.
  45. */
  46. getChipIdAtIndex(index: number): string;
  47. /** Returns the unique indexes of the selected chips. */
  48. getSelectedChipIndexes(): ReadonlySet<number>;
  49. /** Sets the selection state of the chip. */
  50. setChipSelected(index: number, action: MDCChipActionType, isSelected: boolean): void;
  51. /** Returns the selection state of the chip. */
  52. isChipSelected(index: number, action: MDCChipActionType): boolean;
  53. /** Animates the chip addition at the given index. */
  54. addChip(index: number): void;
  55. /** Removes the chip at the given index. */
  56. removeChip(index: number): void;
  57. private isIndexValid;
  58. }