tab.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /** Returns a new `BaseComponent` instance. */
  2. declare class BaseComponent {
  3. element: Element;
  4. options?: BaseOptions;
  5. /**
  6. * @param target `Element` or selector string
  7. * @param config component instance options
  8. */
  9. constructor(target: Element | string, config?: BaseOptions);
  10. get version(): string;
  11. get name(): string;
  12. get defaults(): {};
  13. /** just to have something to extend from */
  14. _toggleEventListeners: () => void;
  15. /** Removes component from target element. */
  16. dispose(): void;
  17. }
  18. declare interface BaseOptions {
  19. [key: string]: unknown;
  20. }
  21. /** Creates a new `Tab` instance. */
  22. declare class Tab extends BaseComponent {
  23. static selector: string;
  24. static init: (element: Element) => Tab;
  25. static getInstance: (element: Element) => Tab | null;
  26. element: HTMLElement;
  27. nav: HTMLElement | null;
  28. content: HTMLElement | null;
  29. tabContent: HTMLElement | null;
  30. nextContent: HTMLElement | null;
  31. dropdown: HTMLElement | null;
  32. /** @param target the target element */
  33. constructor(target: Element | string);
  34. /**
  35. * Returns component name string.
  36. */
  37. get name(): string;
  38. /** Shows the tab to the user. */
  39. show(): void;
  40. /**
  41. * Toggles on/off the `click` event listener.
  42. *
  43. * @param add when `true`, event listener is added
  44. */
  45. _toggleEventListeners: (add?: boolean) => void;
  46. /** Removes the `Tab` component from the target element. */
  47. dispose(): void;
  48. }
  49. export default Tab;
  50. export { }