focus-key-manager.d-BIKDy8oD.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { L as ListKeyManagerOption, a as ListKeyManager } from './list-key-manager.d-BlK3jyRn.js';
  2. import { F as FocusOrigin } from './focus-monitor.d-CvvJeQRc.js';
  3. /**
  4. * This is the interface for focusable items (used by the FocusKeyManager).
  5. * Each item must know how to focus itself, whether or not it is currently disabled
  6. * and be able to supply its label.
  7. */
  8. interface FocusableOption extends ListKeyManagerOption {
  9. /** Focuses the `FocusableOption`. */
  10. focus(origin?: FocusOrigin): void;
  11. }
  12. declare class FocusKeyManager<T> extends ListKeyManager<FocusableOption & T> {
  13. private _origin;
  14. /**
  15. * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
  16. * @param origin Focus origin to be used when focusing items.
  17. */
  18. setFocusOrigin(origin: FocusOrigin): this;
  19. /**
  20. * Sets the active item to the item at the specified
  21. * index and focuses the newly active item.
  22. * @param index Index of the item to be set as active.
  23. */
  24. setActiveItem(index: number): void;
  25. /**
  26. * Sets the active item to the item that is specified and focuses it.
  27. * @param item Item to be set as active.
  28. */
  29. setActiveItem(item: T): void;
  30. }
  31. export { FocusKeyManager as a };
  32. export type { FocusableOption as F };