Files
DefinitelyTyped/navigation-react/index.d.ts
Eric Anderson 9b53298395 Support Pick<> on setState now that TS 2.1 is out (#13155)
* Support Partial<> on setState now that TS 2.1 is out

* Update readme to reflect setState being typed correctly

* Switch setState to Pick

* Restore cloneELement portion of readme

* Use Pick<> | S for setState due to cast issue

* state and props should be readonly

* Fix nit + document why we

* Add typescript compiler header

* Update to properly order headers

* Update readme to reflect 2.1.5 fixing stPick

* Update readme now that 2.1.5 is out

* All that depend on react now require 2.1

* Fix definition that fails due to readonly state
2017-01-23 12:36:53 -08:00

92 lines
2.3 KiB
TypeScript

// Type definitions for NavigationReact 2.0
// Project: http://grahammendick.github.io/navigation/
// Definitions by: Graham Mendick <https://github.com/grahammendick>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import { StateNavigator } from 'navigation';
import { Component, HTMLProps } from 'react';
/**
* Defines the Link Props contract
*/
interface LinkProps extends HTMLProps<HTMLAnchorElement> {
/**
* Indicates whether Links listen for navigate events
*/
lazy?: boolean;
/**
* Determines the effect on browser history
*/
historyAction?: 'add' | 'replace' | 'none';
/**
* Handles Link click events
*/
navigating?: (e: MouseEvent, domId: string, link: string) => boolean;
/**
* The State Navigator
*/
stateNavigator?: StateNavigator;
}
/**
* Defines the Refresh Link Props contract
*/
interface RefreshLinkProps extends LinkProps {
/**
* The NavigationData to pass
*/
navigationData?: any;
/**
* Indicates whether to include all the current NavigationData
*/
includeCurrentData?: boolean;
/**
* The data to add from the current NavigationData
*/
currentDataKeys?: string;
/**
* The Css Class to display when the Link is active
*/
activeCssClass?: string;
/**
* Indicates whether the Link is disabled when active
*/
disableActive?: boolean;
}
/**
* Hyperlink Component the navigates to the current State
*/
export class RefreshLink extends Component<RefreshLinkProps, any> { }
/**
* Defines the Navigation Link Props contract
*/
interface NavigationLinkProps extends RefreshLinkProps {
/**
* The key of the State to navigate to
*/
stateKey: string;
}
/**
* Hyperlink Component the navigates to a State
*/
export class NavigationLink extends Component<NavigationLinkProps, any> { }
/**
* Defines the Navigation Back Link Props contract
*/
interface NavigationBackLinkProps extends RefreshLinkProps {
/**
* Starting at 1, The number of Crumb steps to go back
*/
distance: number;
}
/**
* Hyperlink Component the navigates back along the crumb trail
*/
export class NavigationBackLink extends Component<NavigationBackLinkProps, any> { }