From e2cb09b5aed3fd69eb3735bd04b05371a643f035 Mon Sep 17 00:00:00 2001 From: Jeremy Wells Date: Sat, 20 Jan 2018 06:07:16 +1300 Subject: [PATCH] [@types/react-onsenui] Add SpeedDial, SpeedDialItem, Segment, Toast components and add missing properties. (#22940) * [@types/react-onsenui] Add SpeedDial, SpeedDialItem, and Segment component types * [@types/react-onsenui] Add Toast component * [@types/react-onsenui] Add missing props to Tabbar component * [@types/react-onsenui] Tabbar renderTabs return type * [@types/react-onsenui] Tabbar animation is optional * [@types/react-onsenui] Tab label and icon * [@types/react-onsenui] Fix version, add missing style and className properties * [@types/react-onsenui] Add style and className properties to Toast * [@types/react-onsenui] tslint fixes * [@types/react-onsenui] Property fixes for PR Toast isOpen is required Tabbar index and renderTabs are required Tabbar animation does not accept 'fade' Tabbar onSwipe takes arguments * [@types/react-onsenui] tslint fixes --- types/react-onsenui/index.d.ts | 69 +++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/types/react-onsenui/index.d.ts b/types/react-onsenui/index.d.ts index b20a65db7c..7407eea34a 100644 --- a/types/react-onsenui/index.d.ts +++ b/types/react-onsenui/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for React Onsen UI (react-onsenui) 2.8 // Project: https://onsen.io/v2/docs/guide/react/ -// Definitions by: Ozytis , Salim +// Definitions by: Ozytis , Salim , Jemmyw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -223,6 +223,20 @@ export class Popover extends Component<{ onPostHide?(): void, }, any> {} +export class Toast extends Component<{ + isOpen: boolean, + animation?: 'default' | 'ascend' | 'lift' | 'fall' | 'fade' | 'none', + modifier?: string, + animationOptions?: AnimationOptions, + onPreShow?(): void, + onPostShow?(): void, + onPreHide?(): void, + onPostHide?(): void, + onDeviceBackButton?(): void, + className?: string, + style?: React.CSSProperties, +}, any> {} + export class ActionSheet extends Component<{ onCancel?(): void, isOpen?: boolean, @@ -334,21 +348,33 @@ export class Switch extends Component<{ * Tabs */ -export class Tab extends Component { } +export class Tab extends Component<{ + label?: string, + icon?: string, +}> { } export class TabActive extends Component { } export class TabInactive extends Component { } +export interface TabbarRenderTab { + content: JSX.Element; + tab: JSX.Element; +} + export class Tabbar extends Component<{ - index?: number, - renderTabs?(): any, + index: number, + renderTabs(): TabbarRenderTab[], position?: "bottom" | "top" | "auto", - animation: "none" | "slide" | "fade", + swipeable?: boolean, + ignoreEdgeWidth?: number, + animation?: "none" | "slide", animationOptions?: AnimationOptions, + tabBorder?: boolean, onPreChange?(): void, onPostChange?(): void, onReactive?(): void, + onSwipe?(index: number, animationOptions: AnimationOptions): void, }, any> { } /** @@ -392,6 +418,10 @@ export class Card extends Component<{ modifier?: string, }, any> {} +/** + * Controls + */ + /** Pull-to-refresh hook. */ export class PullHook extends Component<{ onChange?(e: PullHookChangeEvent): void, @@ -402,3 +432,32 @@ export class PullHook extends Component<{ thresholdHeight?: number, fixedContent?: boolean, }, any> {} + +export class Segment extends Component<{ + index?: number, + tabbarId?: string, + modifier?: string, + onPostChange?(): void, + className?: string, + style?: React.CSSProperties, +}, any> {} + +export type SpeedDialPosition = 'top' | 'right' | 'bottom' | 'left' | + 'top right' | 'top left' | 'bottom right' | 'bottom left'; +export type SpeedDialDirection = 'up' | 'down' | 'left' | 'right'; + +export class SpeedDial extends Component<{ + modifier?: string, + position?: SpeedDialPosition, + direction?: SpeedDialDirection, + disabled?: boolean, + className?: string, + style?: React.CSSProperties, +}, any> {} + +export class SpeedDialItem extends Component<{ + modifier?: string; + onClick?(e?: React.MouseEvent): void, + className?: string, + style?: React.CSSProperties, +}, any> {}