index.d.ts 20.9 KB
Newer Older
K
Kamran Ahmed 已提交
1
declare module 'driver.js' {
K
Kamran Ahmed 已提交
2
  class Driver {
K
Kamran Ahmed 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    /**
     * Refers to the global document object
     */
    private document: Document;

    /**
     * Refers to the global window object
     */
    private window: Window;

    /**
     * If the driver is active or not
     */
    public isActivated: boolean;

18 19 20 21 22 23
    /**
     * Flag for if the current move was prevented. It is used in
     * onNext() or onPrevious() callbacks to stop the current transition
     */
    private currentMovePrevented: boolean;

K
Kamran Ahmed 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
    /**
     * Refers to the array of steps to be presented if any
     */
    private steps: Array<Driver.Step>;

    /**
     * Refers to step index that is currently active
     */
    private currentStep: number;

    /**
     * Refers to the overlay for the screen
     */
    private overlay: Driver.Overlay;

    /**
     * @param {DriverOptions} options
     */
    public constructor(options?: Driver.DriverOptions);

44 45 46 47 48 49 50 51
    /**
     * Public getter for steps property
     */
    public getSteps(): Array<Driver.Step>;

    /**
     * Public setter for steps property
     */
K
Kamran Ahmed 已提交
52
    public setSteps(): void;
53

K
Kamran Ahmed 已提交
54 55 56
    /**
     * Does the required bindings for DOM Events
     */
K
Kamran Ahmed 已提交
57
    private bind(): void;
K
Kamran Ahmed 已提交
58 59 60 61 62 63

    /**
     * Listener for the click event, to decide if
     * to next/previous step, reset the overlay etc
     * @param {Event} e
     */
K
Kamran Ahmed 已提交
64
    private onClick(e: Event): void;
K
Kamran Ahmed 已提交
65 66 67 68 69

    /**
     * Refreshes the driver and resets the position for stage
     * and popover on resizing the window
     */
K
Kamran Ahmed 已提交
70
    private onResize(): void;
K
Kamran Ahmed 已提交
71 72 73 74 75

    /**
     * Makes it operable with keyboard
     * @param {Event} e
     */
K
Kamran Ahmed 已提交
76
    private onKeyUp(e: Event): void;
K
Kamran Ahmed 已提交
77

78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
    /**
     * Handles the internal next event
     */
    private handleNext(): void;

    /**
     * Handles the internal previous event
     */
    private handlePrevious(): void;

    /**
     * Prevents the current move. Useful in `onNext` if you want to
     * perform some asynchronous task and manually move to next step
     */
    public preventMove(): void;

K
Kamran Ahmed 已提交
94 95 96 97
    /**
     * Moves to the previous step if possible
     * otherwise resets the overlay
     */
K
Kamran Ahmed 已提交
98
    public movePrevious(): void;
K
Kamran Ahmed 已提交
99 100 101 102 103

    /**
     * Moves to the next step if possible
     * otherwise resets the overlay
     */
K
Kamran Ahmed 已提交
104
    public moveNext(): void;
K
Kamran Ahmed 已提交
105

106 107 108 109 110 111
    /**
     * Prevents the current move. Useful in `onNext` if you want to
     * perform some asynchronous task and manually move to next step
     */
    preventMove(): void;

K
Kamran Ahmed 已提交
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    /**
     * Checks if can be moved to next step
     * @return {boolean}
     */
    public hasNextStep(): boolean;

    /**
     * Checks if can be moved to previous step
     * @return {boolean}
     */
    public hasPreviousStep(): boolean;

    /**
     * Resets the steps and clears the overlay
     */
127
    public reset(immediate?: boolean): void;
K
Kamran Ahmed 已提交
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150

    /**
     * Checks if there is any highlighted element or not
     * @return {boolean}
     */
    public hasHighlightedElement(): boolean;

    /**
     * Gets the currently highlighted element if any
     * @return {Driver.Element}
     */
    public getHighlightedElement(): Driver.Element | null;

    /**
     * Gets the last highlighted element if any
     * @return {Driver.Element}
     */
    public getLastHighlightedElement(): Driver.Element | null;

    /**
     * Defines the steps to be used in multi-step driver
     * @param {Array<Driver.Step>} steps
     */
K
Kamran Ahmed 已提交
151
    public defineSteps(steps: Array<Driver.Step>): void;
K
Kamran Ahmed 已提交
152 153 154 155 156 157 158

    /**
     * Prepares {Driver.Element} from the given step definition
     * @param {Driver.Step | string} step query selector or step definition for the step
     * @param {Array<Driver.Step>} allSteps all the given steps
     * @param {number} stepIndex array index for the current step
     */
K
Kamran Ahmed 已提交
159
    private prepareElementFromStep(step: Driver.Step | string, allSteps: Array<Driver.Step>, stepIndex: number): void;
K
Kamran Ahmed 已提交
160 161 162 163 164

    /**
     * Starts presenting the set steps from the given index
     * @param {number} index
     */
K
Kamran Ahmed 已提交
165
    public start(index?: number): void;
K
Kamran Ahmed 已提交
166 167 168 169 170

    /**
     * Highlights the given element. Element can be a query selector or a step definition
     * @param {string | Driver.Step} element
     */
K
Kamran Ahmed 已提交
171
    public highlight(element: string | Driver.Step): void;
K
Kamran Ahmed 已提交
172 173 174
  }

  namespace Driver {
K
Kamran Ahmed 已提交
175
    interface Step {
K
Kamran Ahmed 已提交
176 177 178
      /**
       * Query selector representing the DOM Element
       */
179
      element: string | HTMLElement | Node;
K
Kamran Ahmed 已提交
180 181 182 183 184 185 186 187 188 189

      /**
       * Color of stage when this step is active
       * @default #ffffff
       */
      stageBackground?: string;

      /**
       * Options representing popover for this step
       */
K
Kamran Ahmed 已提交
190
      popover?: Driver.PopoverOptions;
191 192 193 194

      /**
       * Is called when the next element is about to be highlighted
       */
195
      onNext?: (element: Driver.Element) => void;
196 197 198 199

      /**
       * Is called when the previous element is about to be highlighted
       */
200
      onPrevious?: (element: Driver.Element) => void;
K
Kamran Ahmed 已提交
201 202
    }

K
Kamran Ahmed 已提交
203
    class Element {
K
Kamran Ahmed 已提交
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
      /**
       * Refers to the DOM element that this class wraps
       */
      private node: Node | HTMLElement;
      /**
       * Refers to the global Document object
       */
      private document: Document;
      /**
       * Refers to the global window object
       */
      private window: Window;
      /**
       * Options for this element
       */
      private options: Driver.ElementOptions;
      /**
       * Refers to the overlay that wraps the body
       */
      private overlay: Driver.Overlay;
      /**
       * Refers to the Popover object to be displayed against this element
       */
      private popover: Driver.Popover;
      /**
       * Refers to the stage that will be displayed behind this element
       */
      private stage: Driver.Stage;

      /**
       * @param {HTMLElement | Node} node
       * @param {Driver.DriverOptions} options
       * @param {Driver.Popover} popover
       * @param {Driver.Stage} stage
       * @param {Driver.Overlay} overlay
       * @param {Window} window
       * @param {Document} document
       */
      constructor(node: HTMLElement | Node,
                  options: Driver.DriverOptions,
                  popover: Driver.Popover,
                  stage: Driver.Stage,
                  overlay: Driver.Overlay,
                  window: Window,
                  document: Document);

      /**
       * Checks if the give element is in view port or not
       * @return {boolean}
       */
      public isInView(): boolean;

      /**
       * Brings the current DOMElement in view
       */
K
Kamran Ahmed 已提交
259
      public bringInView(): void;
K
Kamran Ahmed 已提交
260 261 262 263 264 265 266 267 268 269

      /**
       * Gets the position of element on screen
       * @return {Driver.Position}
       */
      public getCalculatedPosition(): Driver.Position;

      /**
       * Manually scrolls to current element if scrollInToView is not supported
       */
K
Kamran Ahmed 已提交
270
      private scrollManually(): void;
K
Kamran Ahmed 已提交
271 272 273 274 275

      /**
       * Is called when the current element is deselected
       * @param {boolean} hideStage
       */
K
Kamran Ahmed 已提交
276
      private onDeselected(hideStage?: boolean): void;
K
Kamran Ahmed 已提交
277 278 279 280

      /**
       * Is called when element is about to be highlighted
       */
K
Kamran Ahmed 已提交
281
      private onHighlightStarted(): void;
K
Kamran Ahmed 已提交
282 283 284 285

      /**
       * Is called when element has been successfully highlighted
       */
K
Kamran Ahmed 已提交
286
      private onHighlighted(): void;
K
Kamran Ahmed 已提交
287 288 289 290

      /**
       * Shows the stage on the current element
       */
K
Kamran Ahmed 已提交
291
      private showStage(): void;
K
Kamran Ahmed 已提交
292 293 294 295

      /**
       * Hides the popover from the current element if visible
       */
K
Kamran Ahmed 已提交
296
      private hidePopover(): void;
K
Kamran Ahmed 已提交
297 298 299 300

      /**
       * Shows the popover on current element if possible
       */
K
Kamran Ahmed 已提交
301
      private showPopover(): void;
K
Kamran Ahmed 已提交
302 303 304 305 306 307 308 309 310 311

      /**
       * Gets the full page size
       */
      private getFullPageSize(): Driver.ElementSize;

      /**
       * Checks if the current element is same as passed element
       * @param {Driver.Element} element
       */
K
Kamran Ahmed 已提交
312
      private isSame(element: Driver.Element): void;
K
Kamran Ahmed 已提交
313 314 315 316 317 318 319 320 321 322 323 324

      /**
       * Gets the node that this element refers to
       * @return {Node | HTMLElement}
       */
      public getNode(): Node | HTMLElement;

      /**
       * Gets the size of current element
       * @return {Driver.ElementSize}
       */
      public getSize(): Driver.ElementSize;
325

326 327 328 329 330 331
      /**
       * Gets the popover on current element if any
       * @returns {Driver.Popover}
       */
      public getPopover(): Driver.Popover;

332 333 334 335 336 337 338 339 340
      /**
       * Removes the highlight classes from current element if any
       */
      private removeHighlightClasses(): void;

      /**
       * Adds the highlight classes to current element if required
       */
      private addHighlightClasses(): void;
K
Kamran Ahmed 已提交
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358

      /**
       * Walks through the parents of the current element and fixes
       * the stacking context
       */
      private fixStackingContext(): void;

      /**
       * Checks if we can make the current element relative or not
       * @return {boolean}
       */
      private canMakeRelative(): boolean;

      /**
       * Get current element's CSS attribute value
       * @return {string}
       */
      private getStyleProperty(): string;
K
Kamran Ahmed 已提交
359 360
    }

K
Kamran Ahmed 已提交
361
    class Overlay {
K
Kamran Ahmed 已提交
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
      /**
       * Options to modify the overlay behavior
       */
      private options: Driver.DriverOptions;

      /**
       * Refers to currently highlighted element
       */
      private highlightedElement: Driver.Element | null;

      /**
       * Refers to element highlighted before currently highlighted element
       */
      private lastHighlightedElement: Driver.Element | null;

      /**
       * Refers to timeout handler used to animate while resetting
       */
      private hideTimer: number | null;

      /**
       * Refers to global object Window
       */
      private window: Window;

      /**
       * Refers to global object Document
       */
      private document: Document;

      /**
       * Prepares the DOM element for overlay and appends to body
       */
K
Kamran Ahmed 已提交
395
      private attachNode(): void;
K
Kamran Ahmed 已提交
396 397 398 399 400

      /**
       * Highlights the given Element while resetting the existing one
       * @param {Driver.Element} element
       */
K
Kamran Ahmed 已提交
401
      public highlight(element: Driver.Element): void;
K
Kamran Ahmed 已提交
402 403 404 405

      /**
       * Shows the overlay while appending to body if it is not there already
       */
K
Kamran Ahmed 已提交
406
      public show(): void;
K
Kamran Ahmed 已提交
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424

      /**
       * Gets the highlighted element in overlay if any
       * @return {Driver.Element | null}
       */
      public getHighlightedElement(): Driver.Element | null;

      /**
       * Gets the element highlighted before current element if any
       * @return {Driver.Element | null}
       */
      public getLastHighlightedElement(): Driver.Element | null;

      /**
       * Removes the overlay and deselects the highlighted element. Does that with animation
       * by default or without animation if immediate is set to false
       * @param {boolean} immediate
       */
K
Kamran Ahmed 已提交
425
      public clear(immediate?: boolean): void;
K
Kamran Ahmed 已提交
426 427 428 429

      /**
       * Removes the overlay node if it exists
       */
K
Kamran Ahmed 已提交
430
      private removeNode(): void;
K
Kamran Ahmed 已提交
431 432 433 434 435

      /**
       * Refreshes the overlay i.e. sets the size according to current window size
       * And moves the highlight around if necessary
       */
K
Kamran Ahmed 已提交
436
      public refresh(): void;
K
Kamran Ahmed 已提交
437 438
    }

K
Kamran Ahmed 已提交
439
    class Popover {
K
Kamran Ahmed 已提交
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
      private node: Node | HTMLElement;
      private tipNode: Node | HTMLElement;
      private titleNode: Node | HTMLElement;
      private descriptionNode: Node | HTMLElement;
      private footerNode: Node | HTMLElement;
      private nextBtnNode: Node | HTMLElement;
      private prevBtnNode: Node | HTMLElement;
      private closeBtnNode: Node | HTMLElement;
      private window: Window;
      private document: Document;

      /**
       * @param {Driver.PopoverOptions} options
       * @param {Window} window
       * @param {Document} document
       */
      constructor(options: Driver.PopoverOptions,
                  window: Window,
                  document: Document);

      /**
       * Prepares the DOM element for popover and appends to the body
       */
K
Kamran Ahmed 已提交
463
      private attachNode(): void;
K
Kamran Ahmed 已提交
464 465 466 467

      /**
       * Hides the popover if visible
       */
K
Kamran Ahmed 已提交
468
      public hide(): void;
K
Kamran Ahmed 已提交
469 470 471 472

      /**
       * Sets the initial state for popover before changing position
       */
K
Kamran Ahmed 已提交
473
      private setInitialState(): void;
K
Kamran Ahmed 已提交
474 475 476 477 478

      /**
       * Shows the popover at the given position
       * @param {Driver.Position} position
       */
K
Kamran Ahmed 已提交
479
      public show(position: Driver.Position): void;
K
Kamran Ahmed 已提交
480 481 482 483

      /**
       * Renders the buttons in the footer of the popover
       */
K
Kamran Ahmed 已提交
484
      private renderFooter(): void;
K
Kamran Ahmed 已提交
485 486 487 488 489

      /**
       * Positions the popover to the left of the given element position
       * @param {Driver.Position} position
       */
K
Kamran Ahmed 已提交
490
      private positionOnLeft(position: Driver.Position): void;
K
Kamran Ahmed 已提交
491

K
Kamran Ahmed 已提交
492 493 494 495 496 497 498 499 500 501 502 503
      /**
       * Positions the popover to the left-center of the given element position
       * @param {Driver.Position} position
       */
      private positionOnLeftCenter(position: Driver.Position): void;

      /**
       * Positions the popover to the left-bottom of the given element position
       * @param {Driver.Position} position
       */
      private positionOnLeftBottom(position: Driver.Position): void;

K
Kamran Ahmed 已提交
504 505 506 507
      /**
       * Positions the popover to the right of the given element position
       * @param {Driver.Position} position
       */
K
Kamran Ahmed 已提交
508
      private positionOnRight(position: Driver.Position): void;
K
Kamran Ahmed 已提交
509

K
Kamran Ahmed 已提交
510 511 512 513 514 515 516 517 518 519 520 521
      /**
       * Positions the popover to the right-center of the given element position
       * @param {Driver.Position} position
       */
      private positionOnRightCenter(position: Driver.Position): void;

      /**
       * Positions the popover to the right-bottom of the given element position
       * @param {Driver.Position} position
       */
      private positionOnRightBottom(position: Driver.Position): void;

K
Kamran Ahmed 已提交
522 523 524 525
      /**
       * Positions the popover to the top of the given element position
       * @param {Driver.Position} position
       */
K
Kamran Ahmed 已提交
526
      private positionOnTop(position: Driver.Position): void;
K
Kamran Ahmed 已提交
527

K
Kamran Ahmed 已提交
528 529 530 531 532 533 534 535 536 537 538 539
      /**
       * Positions the popover to the top-center of the given element position
       * @param {Driver.Position} position
       */
      private positionOnTopCenter(position: Driver.Position): void;

      /**
       * Positions the popover to the top-right of the given element position
       * @param {Driver.Position} position
       */
      private positionOnTopRight(position: Driver.Position): void;

K
Kamran Ahmed 已提交
540 541 542 543
      /**
       * Positions the popover to the bottom of the given element position
       * @param {Driver.Position} position
       */
K
Kamran Ahmed 已提交
544
      private positionOnBottom(position: Driver.Position): void;
K
Kamran Ahmed 已提交
545

K
Kamran Ahmed 已提交
546 547 548 549 550 551 552 553 554 555 556 557
      /**
       * Positions the popover to the bottom-center of the given element position
       * @param {Driver.Position} position
       */
      private positionOnBottomCenter(position: Driver.Position): void;

      /**
       * Positions the popover to the bottom-right of the given element position
       * @param {Driver.Position} position
       */
      private positionOnBottomRight(position: Driver.Position): void;

K
Kamran Ahmed 已提交
558 559 560 561
      /**
       * Positions the popover automatically around the element position
       * @param {Driver.Position} position
       */
K
Kamran Ahmed 已提交
562
      private autoPosition(position: Driver.Position): void;
563 564 565 566 567 568 569 570 571 572 573 574

      /**
       * Gets the title node for popover
       * @returns {Node | HTMLElement}
       */
      public getTitleNode(): Node | HTMLElement;

      /**
       * Gets the description node for popover
       * @returns {Node | HTMLElement}
       */
      public getDescriptionNode(): Node | HTMLElement;
K
Kamran Ahmed 已提交
575 576
    }

K
Kamran Ahmed 已提交
577
    class Stage extends Element {
K
Kamran Ahmed 已提交
578 579 580 581 582 583 584 585 586 587 588 589
      /**
       * @param {Driver.StageOptions} options
       * @param {Window} window
       * @param {Document} document
       */
      constructor(options: Driver.StageOptions,
                  window: Window,
                  document: Document);

      /**
       * Prepares the node and appends to body if not there already
       */
K
Kamran Ahmed 已提交
590
      private attachNode(): void;
K
Kamran Ahmed 已提交
591 592 593 594

      /**
       * Hides the stage by removing the node
       */
K
Kamran Ahmed 已提交
595
      public hide(): void;
K
Kamran Ahmed 已提交
596 597 598 599

      /**
       * Sets the default properties on the node
       */
K
Kamran Ahmed 已提交
600
      private setInitialStyle(): void;
K
Kamran Ahmed 已提交
601 602 603 604 605

      /**
       * Shows the stage at provided position
       * @param {Driver.Position} position
       */
K
Kamran Ahmed 已提交
606
      public show(position: Driver.Position): void;
K
Kamran Ahmed 已提交
607 608
    }

K
Kamran Ahmed 已提交
609
    class Position {
K
Kamran Ahmed 已提交
610
      constructor({
K
Kamran Ahmed 已提交
611 612 613 614
                    left,
                    top,
                    bottom,
                    right,
K
Kamran Ahmed 已提交
615
                  });
K
Kamran Ahmed 已提交
616 617 618 619 620 621 622 623 624 625 626

      /**
       * Checks if the given position is valid and can be highlighted
       * @return {boolean}
       */
      canHighlight(): boolean;

      /**
       * Checks if the given position is same as the passed position
       * @param {Driver.Position} position
       */
K
Kamran Ahmed 已提交
627
      equals(position: Driver.Position): void;
K
Kamran Ahmed 已提交
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
    }

    interface ScreenCoordinates {
      x: number;
      y: number;
    }

    interface ElementSize {
      width: number;
      height: number;
    }

    interface PopoverOptions {
      /**
       * Title for the popover
       */
      title?: string;

      /**
       * Description for the popover
       */
      description: string;

      /**
       * Whether to show control buttons or not
       * @default true
       */
K
Kamran Ahmed 已提交
655
      showButtons?: boolean;
K
Kamran Ahmed 已提交
656 657 658 659 660

      /**
       * Text on the button in the final step
       * @default 'Done'
       */
K
Kamran Ahmed 已提交
661
      doneBtnText?: string;
K
Kamran Ahmed 已提交
662 663 664 665 666

      /**
       * Text on the close button
       * @default 'Close'
       */
K
Kamran Ahmed 已提交
667
      closeBtnText?: string;
K
Kamran Ahmed 已提交
668 669 670 671 672

      /**
       * Text on the next button
       * @default 'Next'
       */
K
Kamran Ahmed 已提交
673
      nextBtnText?: string;
K
Kamran Ahmed 已提交
674 675 676 677 678

      /**
       * Text on the previous button
       * @default 'Previous'
       */
K
Kamran Ahmed 已提交
679 680 681 682 683 684 685 686
      prevBtnText?: string;

      /**
       * Total number of elements with popovers
       * @default 0
       */
      totalCount?: number;

K
Kamran Ahmed 已提交
687 688 689 690 691 692
      /**
       * Additional offset of the popover
       * @default 0
       */
      offset?: number;

K
Kamran Ahmed 已提交
693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709
      /**
       * Counter for the current popover
       * @default 0
       */
      currentIndex?: number;

      /**
       * If the current popover is the first one
       * @default true
       */
      isFirst?: boolean;

      /**
       * If the current popover is the last one
       * @default true
       */
      isLast?: boolean;
710 711 712 713 714 715

      /**
       * Position for the popover on element
       * @default auto
       */
      position?: string;
K
Kamran Ahmed 已提交
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749
    }

    interface DriverOptions {
      /**
       * Whether to animate while transitioning from one highlighted
       * element to another
       * @default true
       */
      animate?: boolean;

      /**
       * Opacity for the overlay
       * @default 0.75
       */
      opacity?: number,

      /**
       * Distance of elements corner from the edges of the overlay
       * @default 10
       */
      padding?: number,

      /**
       * Options to be passed to scrollIntoView if supported by browser
       * @default { behavior: 'instant', block: 'center' }
       */
      scrollIntoViewOptions?: ScrollIntoViewOptions,

      /**
       * Clicking outside the highlighted element should reset driver or not
       * @default true
       */
      allowClose?: boolean,

750 751 752 753 754 755
      /**
       * Whether to allow controlling steps through keyboard
       * @default true
       */
      keyboardControl?: boolean,

756 757 758 759
      /**
       * Clicking outside the highlighted element should move next
       * @default false
       */
K
Kamran Ahmed 已提交
760
      overlayClickNext?: boolean,
761

K
Kamran Ahmed 已提交
762 763 764 765 766 767 768 769 770 771
      /**
       * Background color for the stage behind the highlighted element
       * @default '#ffffff'
       */
      stageBackground?: string,

      /**
       * Whether to show control buttons or not
       * @default true
       */
K
Kamran Ahmed 已提交
772
      showButtons?: boolean;
K
Kamran Ahmed 已提交
773 774 775 776 777

      /**
       * Text on the button in the final step
       * @default 'Done'
       */
K
Kamran Ahmed 已提交
778
      doneBtnText?: string;
K
Kamran Ahmed 已提交
779 780 781 782 783

      /**
       * Text on the close button
       * @default 'Close'
       */
K
Kamran Ahmed 已提交
784
      closeBtnText?: string;
K
Kamran Ahmed 已提交
785 786 787 788 789

      /**
       * Text on the next button
       * @default 'Next'
       */
K
Kamran Ahmed 已提交
790
      nextBtnText?: string;
K
Kamran Ahmed 已提交
791 792 793 794 795

      /**
       * Text on the previous button
       * @default 'Previous'
       */
K
Kamran Ahmed 已提交
796
      prevBtnText?: string;
K
Kamran Ahmed 已提交
797 798 799 800 801 802

      /**
       * Callback to be called when element is about to be highlighted
       * @param {Driver.Element} element
       * @returns any
       */
K
Kamran Ahmed 已提交
803
      onHighlightStarted?: (element: Driver.Element) => void;
K
Kamran Ahmed 已提交
804 805 806 807 808 809

      /**
       * Callback to be called when element has been highlighted
       * @param {Driver.Element} element
       * @returns any
       */
K
Kamran Ahmed 已提交
810
      onHighlighted?: (element: Driver.Element) => void,
K
Kamran Ahmed 已提交
811 812 813 814 815 816

      /**
       * Callback to be called when element has been deselected
       * @param {Driver.Element} element
       * @returns any
       */
K
Kamran Ahmed 已提交
817
      onDeselected?: (element: Driver.Element) => void,
818 819 820 821

      /**
       * Is called when the overlay is about to reset
       */
822 823 824 825 826
      onReset?: (element: Driver.Element) => void,

      /**
       * Is called when the next element is about to be highlighted
       */
827
      onNext?: (element: Driver.Element) => void;
828 829 830 831

      /**
       * Is called when the previous element is about to be highlighted
       */
832
      onPrevious?: (element: Driver.Element) => void;
K
Kamran Ahmed 已提交
833 834 835 836 837 838 839 840
    }

    interface ElementOptions extends Driver.DriverOptions {
    }

    interface StageOptions extends ElementOptions {
    }
  }
K
Kamran Ahmed 已提交
841 842

  export = Driver;
843
}