// Type definitions for agate/Scroller

import { ScrollerBasicProps as ui_Scroller_ScrollerBasicProps } from "@enact/ui/Scroller";
import * as React from "react";

type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;

export interface ScrollerProps extends ui_Scroller_ScrollerBasicProps {
  /**
 * A callback function that receives a reference to the  `scrollTo`  feature.
 * 
 * Once received, the  `scrollTo`  method can be called as an imperative interface.
 * *  {position: {x, y}} - Pixel value for x and/or y position
 * *  {align} - Where the scroll area should be aligned. Values are:
 `'left'` ,  `'right'` ,  `'top'` ,  `'bottom'` ,
 `'topleft'` ,  `'topright'` ,  `'bottomleft'` , and  `'bottomright'` .
 * *  {node} - Node to scroll into view
 * *  {animate} - When  `true` , scroll occurs with animation. When  `false` , no
animation occurs.
 * *  {focus} - When  `true` , attempts to focus item after scroll. Only valid when scrolling
  by  `node` .
 * 
 * Note: Only specify one of:  `position` ,  `align` ,  `node`
 * 
 * Example:
 * ```
// If you set cbScrollTo prop like below;
cbScrollTo: (fn) => {this.scrollTo = fn;}
// You can simply call like below;
this.scrollTo({align: 'top'}); // scroll to the top
```
 */
  cbScrollTo?: Function;
  /**
   * Direction of the scroller.
   *
   * Valid values are:
   * *  `'both'` ,
   * *  `'horizontal'` , and
   * *  `'vertical'` .
   */
  direction?: string;
  /**
 * Allows 5-way navigation to the scrollbar controls. By default, 5-way will
not move focus to the scrollbar controls.
 */
  focusableScrollbar?: boolean;
  /**
   * Specifies how to show horizontal scrollbar.
   *
   * Valid values are:
   * *  `'auto'` ,
   * *  `'visible'` , and
   * *  `'hidden'` .
   */
  horizontalScrollbar?: string;
  /**
 * Unique identifier for the component.
 * 
 * When defined and when the  `Scroller`  is within a  Panel  , the
 `Scroller`  will store its scroll position and restore that position when returning to the
 `Panel` .
 */
  id?: string;
  /**
 * Called when scrolling.
 * 
 * Passes  `scrollLeft` ,  `scrollTop` .
It is not recommended to set this prop since it can cause performance degradation.
Use  `onScrollStart`  or  `onScrollStop`  instead.
 */
  onScroll?: Function;
  /**
 * Called when scroll starts.
 * 
 * Passes  `scrollLeft`  and  `scrollTop` .
 * 
 * Example:
 * ```
onScrollStart = ({scrollLeft, scrollTop}) => {
    // do something with scrollLeft and scrollTop
}

render = () => (
    <Scroller
        ...
        onScrollStart={this.onScrollStart}
        ...
    />
)
```
 */
  onScrollStart?: Function;
  /**
 * Called when scroll stops.
 * 
 * Passes  `scrollLeft`  and  `scrollTop` .
 * 
 * Example:
 * ```
onScrollStop = ({scrollLeft, scrollTop}) => {
    // do something with scrollLeft and scrollTop
}

render = () => (
    <Scroller
        ...
        onScrollStop={this.onScrollStop}
        ...
    />
)
```
 */
  onScrollStop?: Function;
  /**
   * Sets the hint string read when focusing the next button in the vertical scroll bar.
   */
  scrollDownAriaLabel?: string;
  /**
   * Sets the hint string read when focusing the previous button in the horizontal scroll bar.
   */
  scrollLeftAriaLabel?: string;
  /**
   * Specifies how to scroll.
   *
   * Valid values are:
   * *  `'translate'` ,
   * *  `'native'` .
   */
  scrollMode?: "native" | "translate";
  /**
   * Sets the hint string read when focusing the next button in the horizontal scroll bar.
   */
  scrollRightAriaLabel?: string;
  /**
   * Sets the hint string read when focusing the previous button in the vertical scroll bar.
   */
  scrollUpAriaLabel?: string;
  /**
   * Specifies how to show vertical scrollbar.
   *
   * Valid values are:
   * *  `'auto'` ,
   * *  `'visible'` , and
   * *  `'hidden'` .
   */
  verticalScrollbar?: string;
}
/**
 * An Agate-styled Scroller, useScroll applied.
 * 
 * Usage:
 * ```
<Scroller>Scroll me.</Scroller>
```
 */

export class Scroller extends React.Component<
  Merge<React.HTMLProps<HTMLElement>, ScrollerProps>
> {}

export default Scroller;
