-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typings): add Popup, Embed, Reveal and other updates (#1136)
feat(typings): add Popup, Embed, Reveal and other updates
- Loading branch information
1 parent
16f21ce
commit 340fd95
Showing
8 changed files
with
232 additions
and
64 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
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,100 @@ | ||
import * as React from 'react'; | ||
|
||
export interface PortalProps { | ||
/** Additional classes. */ | ||
className?: string; | ||
|
||
/** Controls whether or not the portal should close on a click outside. */ | ||
closeOnDocumentClick?: boolean; | ||
|
||
/** Controls whether or not the portal should close when escape is pressed is displayed. */ | ||
closeOnEscape?: boolean; | ||
|
||
/** | ||
* Controls whether or not the portal should close when mousing out of the portal. | ||
* NOTE: This will prevent `closeOnTriggerMouseLeave` when mousing over the | ||
* gap from the trigger to the portal. | ||
*/ | ||
closeOnPortalMouseLeave?: boolean; | ||
|
||
/** | ||
* Controls whether or not the portal should close on a click on the portal background. | ||
* NOTE: This differs from closeOnDocumentClick: | ||
* - DocumentClick - any click not within the portal | ||
* - RootNodeClick - a click not within the portal but within the portal's wrapper | ||
*/ | ||
closeOnRootNodeClick?: boolean; | ||
|
||
/** Controls whether or not the portal should close on blur of the trigger. */ | ||
closeOnTriggerBlur?: boolean; | ||
|
||
/** Controls whether or not the portal should close on click of the trigger. */ | ||
closeOnTriggerClick?: boolean; | ||
|
||
/** Controls whether or not the portal should close when mousing out of the trigger. */ | ||
closeOnTriggerMouseLeave?: boolean; | ||
|
||
/** Initial value of open. */ | ||
defaultOpen?: boolean; | ||
|
||
/** The node where the portal should mount. */ | ||
mountNode?: any; | ||
|
||
/** Milliseconds to wait before opening on mouse over */ | ||
mouseEnterDelay?: number; | ||
|
||
/** Milliseconds to wait before closing on mouse leave */ | ||
mouseLeaveDelay?: number; | ||
|
||
/** | ||
* Called when a close event happens | ||
* | ||
* @param {SyntheticEvent} event - React's original SyntheticEvent. | ||
* @param {object} data - All props. | ||
*/ | ||
onClose?: React.MouseEventHandler<HTMLDivElement>; | ||
|
||
/** | ||
* Called when the portal is mounted on the DOM | ||
* | ||
* @param {null} | ||
* @param {object} data - All props. | ||
*/ | ||
onMount?: (nothing: null, props: PortalProps) => void; | ||
|
||
/** | ||
* Called when an open event happens | ||
* | ||
* @param {SyntheticEvent} event - React's original SyntheticEvent. | ||
* @param {object} data - All props. | ||
*/ | ||
onOpen?: React.MouseEventHandler<HTMLDivElement>; | ||
|
||
/** | ||
* Called when the portal is unmounted from the DOM | ||
* | ||
* @param {null} | ||
* @param {object} data - All props. | ||
*/ | ||
onUnmount?: (nothing: null, props: PortalProps) => void; | ||
|
||
/** Controls whether or not the portal is displayed. */ | ||
open?: boolean; | ||
|
||
/** Controls whether or not the portal should open when the trigger is clicked. */ | ||
openOnTriggerClick?: boolean; | ||
|
||
/** Controls whether or not the portal should open on focus of the trigger. */ | ||
openOnTriggerFocus?: boolean; | ||
|
||
/** Controls whether or not the portal should open when mousing over the trigger. */ | ||
openOnTriggerMouseEnter?: boolean; | ||
|
||
/** Controls whether the portal should be prepended to the mountNode instead of appended. */ | ||
prepend?: boolean; | ||
|
||
/** Element to be rendered in-place where the portal is defined. */ | ||
trigger?: React.ReactNode; | ||
} | ||
|
||
export const Portal: React.ComponentClass<PortalProps>; |
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,21 +1,27 @@ | ||
import * as React from 'react'; | ||
import { FormTextAreaProps } from '../../collections/Form/index'; | ||
|
||
export interface TextareaProps extends FormTextAreaProps{ | ||
export interface TextAreaProps extends FormTextAreaProps { | ||
|
||
/** An element type to render as (string or function). */ | ||
as?: any; | ||
|
||
/** Indicates whether height of the textarea fits the content or not */ | ||
autoHeight?: boolean; | ||
|
||
/** | ||
* Called on change. | ||
* @param {SyntheticEvent} event - The React SyntheticEvent object | ||
* @param {object} data - All props and the event value. | ||
*/ | ||
onChange?: (event: React.FormEvent<HTMLTextAreaElement>, value: TextareaOnChangeValue ) => void; | ||
onChange?: (event: React.FormEvent<HTMLTextAreaElement>, value: TextAreaOnChangeValue) => void; | ||
|
||
/** The value of the textarea. */ | ||
value?: string; | ||
} | ||
|
||
interface TextareaOnChangeValue extends TextareaProps{ | ||
interface TextAreaOnChangeValue extends TextAreaProps { | ||
value: any; | ||
} | ||
|
||
export const Textarea: React.ComponentClass<TextareaProps>; | ||
export const TextArea: React.ComponentClass<TextAreaProps>; |
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,43 @@ | ||
import * as React from 'react'; | ||
|
||
interface RevealContentProps { | ||
/** An element type to render as (string or function). */ | ||
as?: any; | ||
|
||
/** Additional classes. */ | ||
className?: string; | ||
|
||
/** A reveal may contain content that is visible before interaction. */ | ||
hidden?: boolean; | ||
|
||
/** A reveal may contain content that is hidden before user interaction. */ | ||
visible?: boolean; | ||
} | ||
|
||
export const RevealContent: React.ComponentClass<RevealContentProps>; | ||
|
||
interface RevealProps { | ||
/** An active reveal displays its hidden content. */ | ||
active?: boolean; | ||
|
||
/** An animation name that will be applied to Reveal. */ | ||
animated?: 'fade' | 'small fade' | 'move' | 'move right' | 'move up' | 'move down' | 'rotate' | 'rotate left'; | ||
|
||
/** An element type to render as (string or function). */ | ||
as?: any; | ||
|
||
/** Additional classes. */ | ||
className?: string; | ||
|
||
/** A disabled reveal will not animate when hovered. */ | ||
disabled?: boolean; | ||
|
||
/** An element can show its content without delay. */ | ||
instant?: boolean; | ||
} | ||
|
||
interface RevealClass extends React.ComponentClass<RevealProps> { | ||
Content: typeof RevealContent; | ||
} | ||
|
||
export const Reveal: RevealClass; |
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
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
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,55 @@ | ||
import * as React from 'react'; | ||
|
||
interface EmbedProps { | ||
/** An embed can be active. */ | ||
active?: boolean; | ||
|
||
/** An element type to render as (string or function). */ | ||
as?: any; | ||
|
||
/** An embed can specify an alternative aspect ratio. */ | ||
aspectRatio?: '4:3' | '16:9' | '21:9'; | ||
|
||
/** Setting to true or false will force autoplay. */ | ||
autoplay?: boolean; | ||
|
||
/** Whether to show networks branded UI like title cards, or after video calls to action. */ | ||
brandedUI?: boolean; | ||
|
||
/** Additional classes. */ | ||
className?: string; | ||
|
||
/** Specifies a default chrome color with Vimeo or YouTube. */ | ||
color?: string; | ||
|
||
/** Initial value of active. */ | ||
defaultActive?: boolean; | ||
|
||
/** Whether to show networks branded UI like title cards, or after video calls to action. */ | ||
hd?: boolean; | ||
|
||
/** Specifies an icon to use with placeholder content. */ | ||
icon?: any; | ||
|
||
/** Specifies an id for source. */ | ||
id?: string; | ||
|
||
/** | ||
* Сalled on click. | ||
* | ||
* @param {SyntheticEvent} event - React's original SyntheticEvent. | ||
* @param {object} data - All props and proposed value. | ||
*/ | ||
onClick?: (e: React.FormEvent<HTMLVideoElement>, data: this) => void; | ||
|
||
/** A placeholder image for embed. */ | ||
placeholder?: string; | ||
|
||
/** Specifies a source to use. */ | ||
source?: 'youtube' | 'vimeo'; | ||
|
||
/** Specifies a url to use for embed. */ | ||
url?: string; | ||
} | ||
|
||
export const Embed: React.ComponentClass<EmbedProps>; |
Oops, something went wrong.