forked from react-toolbox/react-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure typescript definitions (react-toolbox#1114)
* ts: restructure typescript definitions - Add each raw components types - Update layout props to the new layout implementation - Add table definitions - Add HOC types * fix ListItem typescript definition * add themr identifiers definitions * simplify React.ReactNode properties * React.ReactNode | string => React.ReactNode is already indirectly type aliased to string
- Loading branch information
1 parent
d80dc82
commit f365724
Showing
89 changed files
with
3,771 additions
and
3,320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import * as React from "react"; | ||
import ReactToolbox from "../index"; | ||
|
||
export interface AppBarTheme { | ||
/** | ||
* Used for the component root element. | ||
*/ | ||
appBar?: string; | ||
/** | ||
* Added to the root element when the app bar is fixed. | ||
*/ | ||
fixed?: string; | ||
/** | ||
* Added to the root element when the app bar is flat. | ||
*/ | ||
flat?: string; | ||
/** | ||
* Used as the app bar title. | ||
*/ | ||
title?: string; | ||
/** | ||
* Added to the left icon app bar element. | ||
*/ | ||
leftIcon?: string; | ||
/** | ||
* Added to the right icon app bar element. | ||
*/ | ||
rightIcon?: string; | ||
/** | ||
* Added to the root element when the app bar is hidden during scroll. | ||
*/ | ||
scrollHide?: string; | ||
} | ||
|
||
export interface AppBarProps extends ReactToolbox.Props { | ||
/** | ||
* Children to pass through the component. | ||
*/ | ||
children?: React.ReactNode; | ||
/** | ||
* Determine if the bar should have position fixed or relative. | ||
* @default false | ||
*/ | ||
fixed?: boolean; | ||
/** | ||
* If true, the AppBar shows a shadow. | ||
* @default false | ||
*/ | ||
flat?: boolean; | ||
/** | ||
* If it exists it is used as the AppBar title | ||
*/ | ||
title?: string; | ||
/** | ||
* If it exists it is used as the AppBar left icon | ||
*/ | ||
leftIcon?: React.ReactNode; | ||
/** | ||
* Called when the left icon is clicked | ||
*/ | ||
onLeftIconClick?: Function; | ||
/** | ||
* If it exists it is used as the AppBar right icon | ||
*/ | ||
rightIcon?: React.ReactNode; | ||
/** | ||
* Called when the righticon is clicked | ||
*/ | ||
onRightIconClick?: Function; | ||
/** | ||
* Whether AppBar should be hidden during scroll. | ||
* @default false | ||
*/ | ||
scrollHide?: boolean; | ||
/** | ||
* Classnames object defining the component style. | ||
*/ | ||
theme?: AppBarTheme; | ||
} | ||
|
||
export class AppBar extends React.Component<AppBarProps, {}> { } | ||
|
||
export default AppBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,4 @@ | ||
import * as React from "react"; | ||
import ReactToolbox from "../index"; | ||
|
||
export interface AppBarTheme { | ||
/** | ||
* Used for the component root element. | ||
*/ | ||
appBar?: string; | ||
/** | ||
* Added to the root element when the app bar is fixed. | ||
*/ | ||
fixed?: string; | ||
/** | ||
* Added to the root element when the app bar is flat. | ||
*/ | ||
flat?: string; | ||
/** | ||
* Used as the app bar title. | ||
*/ | ||
title?: string; | ||
/** | ||
* Added to the left icon app bar element. | ||
*/ | ||
leftIcon?: string; | ||
/** | ||
* Added to the right icon app bar element. | ||
*/ | ||
rightIcon?: string; | ||
/** | ||
* Added to the root element when the app bar is hidden during scroll. | ||
*/ | ||
scrollHide?: string; | ||
} | ||
|
||
export interface AppBarProps extends ReactToolbox.Props { | ||
/** | ||
* Children to pass through the component. | ||
*/ | ||
children?: React.ReactNode; | ||
/** | ||
* Determine if the bar should have position fixed or relative. | ||
* @default false | ||
*/ | ||
fixed?: boolean; | ||
/** | ||
* If true, the AppBar shows a shadow. | ||
* @default false | ||
*/ | ||
flat?: boolean; | ||
/** | ||
* If it exists it is used as the AppBar title | ||
*/ | ||
title?: string; | ||
/** | ||
* If it exists it is used as the AppBar left icon | ||
*/ | ||
leftIcon?: string | React.ReactNode; | ||
/** | ||
* Called when the left icon is clicked | ||
*/ | ||
onLeftIconClick?: Function; | ||
/** | ||
* If it exists it is used as the AppBar right icon | ||
*/ | ||
rightIcon?: string | React.ReactNode; | ||
/** | ||
* Called when the righticon is clicked | ||
*/ | ||
onRightIconClick?: Function; | ||
/** | ||
* Whether AppBar should be hidden during scroll. | ||
* @default false | ||
*/ | ||
scrollHide?: boolean; | ||
/** | ||
* Classnames object defining the component style. | ||
*/ | ||
theme?: AppBarTheme; | ||
} | ||
|
||
export class AppBar extends React.Component<AppBarProps, {}> { } | ||
|
||
import { AppBar } from './AppBar'; | ||
export { AppBarProps, AppBarTheme } from './AppBar'; | ||
export { AppBar }; | ||
export default AppBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import * as React from "react"; | ||
import ReactToolbox from "../index"; | ||
import { InputProps, InputTheme } from "../input/Input"; | ||
|
||
export interface AutocompleteTheme { | ||
/** | ||
* Used for a suggestion when it's active. | ||
*/ | ||
active?: string; | ||
/** | ||
* Used for the root element. | ||
*/ | ||
autocomplete?: string; | ||
/** | ||
* Used when the input is focused. | ||
*/ | ||
focus?: string; | ||
/** | ||
* Used to style the Input component. | ||
*/ | ||
input?: string; | ||
/** | ||
* Used to style each suggestion. | ||
*/ | ||
suggestion?: string; | ||
/** | ||
* Used to style the suggestions container. | ||
*/ | ||
suggestions?: string; | ||
/** | ||
* Used for the suggestions when it's opening to the top. | ||
*/ | ||
up?: string; | ||
/** | ||
* Classname used for a single value. | ||
*/ | ||
value?: string; | ||
/** | ||
* Classname used for the values container. | ||
*/ | ||
values?: string; | ||
} | ||
|
||
export interface AutocompleteProps extends InputProps { | ||
/** | ||
* Determines if user can create a new option with the current typed value. | ||
* @default false | ||
*/ | ||
allowCreate?: boolean; | ||
/** | ||
* Determines the opening direction. It can be auto, up or down. | ||
* @default auto | ||
*/ | ||
direction?: "auto" | "up" | "down"; | ||
/** | ||
* If true, component will be disabled. | ||
* @default false | ||
*/ | ||
disabled?: boolean; | ||
/** | ||
* Sets the error string for the internal input element. | ||
* @default false | ||
*/ | ||
error?: React.ReactNode; | ||
/** | ||
* Whether component should keep focus after value change. | ||
* @default false | ||
*/ | ||
keepFocusOnChange?: boolean; | ||
/** | ||
* The text string to use for the floating label element. | ||
*/ | ||
label?: React.ReactNode; | ||
/** | ||
* If true, component can hold multiple values. | ||
* @default true | ||
*/ | ||
multiple?: boolean; | ||
/** | ||
* Callback function that is fired when component is blurred. | ||
*/ | ||
onBlur?: Function; | ||
/** | ||
* Callback function that is fired when the components's value changes. | ||
*/ | ||
onChange?: Function; | ||
/** | ||
* Callback function that is fired when component is focused. | ||
*/ | ||
onFocus?: Function; | ||
/** | ||
* Callback function that is fired when the components's query value changes. | ||
*/ | ||
onQueryChange?: Function; | ||
/** | ||
* Determines if the selected list is shown above or below input. It can be above or below. | ||
* @default above | ||
*/ | ||
selectedPosition?: "above" | "below" | "none"; | ||
/** | ||
* Determines if the selected list is shown if the `value` keys don't exist in the source. Only works if passing the `value` prop as an Object. | ||
* @default false | ||
*/ | ||
showSelectedWhenNotInSource?: boolean; | ||
/** | ||
* If true, the list of suggestions will not be filtered when a value is selected. | ||
* @default false | ||
*/ | ||
showSuggestionsWhenValueIsSet?: boolean; | ||
/** | ||
* Object of key/values or array representing all items suggested. | ||
*/ | ||
source?: any; | ||
/** | ||
* Determines how suggestions are supplied. | ||
* @default start | ||
*/ | ||
suggestionMatch?: "start" | "anywhere" | "word"; | ||
/** | ||
* Classnames object defining the component style. | ||
*/ | ||
theme?: AutocompleteTheme & InputTheme; | ||
/** | ||
* Value or array of values currently selected component. | ||
*/ | ||
value?: any; | ||
/** | ||
* Additional properties passed to inner Input component. | ||
*/ | ||
[key: string]: any; | ||
} | ||
|
||
export class Autocomplete extends React.Component<AutocompleteProps, {}> { } | ||
|
||
export default Autocomplete; |
Oops, something went wrong.