Home Reference Source
public class | source

Control

Extends:

react~React.Component → Control

Direct Subclass:

App, ComponentWrapper, ContainerControl, Sequence, src/components/TabBar.js~ShadedTabs, Tab, TabBar, src/components/TabBar.js~Tabs, src/components/TabBar.js~TabsWithStdin, src/components/TabBar.js~TabsWithoutStdin, TextField

Indirect Subclass:

Form

Defines the base class for controls, which are components with visual representation.

Static Member Summary

Static Public Members
public static

BLUR_DIRECTION indicates the direction a onBlur() should move focus to next.

Static Method Summary

Static Public Methods
public static

buildControlForComponent(type: *, props: *, children: *): *

public static

componentHasChildren(component: *): *

Checks a React component to see if it has any children in props.

public static

firstFocusableControlOf(controlOrComponent: *): *

public static

isControl(anyComponentOrClass: *): *

Returns a boolean which indicates if the provided anyComponentOrClass parameter is an instance of Control (if passed an object) or a class derived from Control (if passed a function) or a component derived from Control.

public static

isReactComponent(anyComponentOrClass: *): *

Returns a boolean which indicates if the provided anyComponentOrClass parameter is an instance of React.Component (if passed an object) or a class derived from React.Component (if passed a function) or a component derived from React.Component.

public static

lastFocusableChild(controlOrComponent: *): *

public static
public static
public static

wrapComponent(component: *): *

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public

state: {...undefined: Object, "canIReachThisState": string}

Method Summary

Public Methods
public

blur()

In a command line interface, where focusable controls exist (think Visual Basic for DOS) to get an idea of the concept, we can't completely blur out of EVERY single control.

Something is always going to ALWAYS need to be accept / capture input, be it a Button or TextField or a Menu or a Tab or Tree. But the concept of the Control component is that it can easily allow focus to shift from one component to the next, and allow those components which extend the Control class to easily display one type of blurred output while accepting input once focused.

In order to guarantee this, blur will locate the forward (or reverse component) and 'select' it instead.

public

canBlur(): *

Returns a boolean which indicates if the Control instance is un-focusable.

public

canFocus(): *

Returns a boolean which indicates if a Control instance is focusable.

public
public
public

focus()

public
public

isBlurred(): *

The isBlurred() method returns the inverse of the isFocused() method.

public

isDisabled(): *

The isDisabled() method returns a boolean which indicates the value of the disabled property as passed into the component.

public

isEnabled(): *

The isEnabled() method returns the inverse value of the isDisabled() method.

public

The isFocusable() method returns a boolean which indicates the value of the field, focusable.

public

isFocused(): *

The isFocused() method returns a boolean which indicates the value of the focused property as passed into the component, as long as it is not disabled.

public

render(): *

Static Public Members

public static BLUR_DIRECTION: * source

BLUR_DIRECTION indicates the direction a onBlur() should move focus to next.

Static Public Methods

public static buildControlForComponent(type: *, props: *, children: *): * source

Params:

NameTypeAttributeDescription
type *
props *
children *

Return:

*

public static componentHasChildren(component: *): * source

Checks a React component to see if it has any children in props.

Params:

NameTypeAttributeDescription
component *

A proposed React component to inspect.

Return:

*

public static firstFocusableControlOf(controlOrComponent: *): * source

Params:

NameTypeAttributeDescription
controlOrComponent *

Return:

*

public static isControl(anyComponentOrClass: *): * source

Returns a boolean which indicates if the provided anyComponentOrClass parameter is an instance of Control (if passed an object) or a class derived from Control (if passed a function) or a component derived from Control.

Params:

NameTypeAttributeDescription
anyComponentOrClass *

Any valid React component or React component class or instance or derived component or class or instance.

Return:

*

true if anyComponentOrClass validates, false otherwise.

public static isReactComponent(anyComponentOrClass: *): * source

Returns a boolean which indicates if the provided anyComponentOrClass parameter is an instance of React.Component (if passed an object) or a class derived from React.Component (if passed a function) or a component derived from React.Component.

Params:

NameTypeAttributeDescription
anyComponentOrClass *

Any valid React component or React component class or instance or derived component or class or instance.

Return:

*

true if anyComponentOrClass validates, false otherwise.

public static lastFocusableChild(controlOrComponent: *): * source

Params:

NameTypeAttributeDescription
controlOrComponent *

Return:

*

public static nextFocusableChild() source

public static prevFocusableChild() source

public static wrapComponent(component: *): * source

Params:

NameTypeAttributeDescription
component *

Return:

*

Public Constructors

public constructor() source

Public Members

public focusable: boolean source

public state: {...undefined: Object, "canIReachThisState": string} source

Public Methods

public blur() source

In a command line interface, where focusable controls exist (think Visual Basic for DOS) to get an idea of the concept, we can't completely blur out of EVERY single control.

Something is always going to ALWAYS need to be accept / capture input, be it a Button or TextField or a Menu or a Tab or Tree. But the concept of the Control component is that it can easily allow focus to shift from one component to the next, and allow those components which extend the Control class to easily display one type of blurred output while accepting input once focused.

In order to guarantee this, blur will locate the forward (or reverse component) and 'select' it instead.

public canBlur(): * source

Returns a boolean which indicates if the Control instance is un-focusable.

Most Controls which exist will be focusable. It is the deault behavior that a derived Control class is always focusable.

If you want to disable focusable in a specific way, you can override the function and return false instead of true.

For example, consider a TextField whose input might be disabled for now. During the disabled state, canFocus() would return false, but otherwise return true.

Return:

*

public canFocus(): * source

Returns a boolean which indicates if a Control instance is focusable.

The default behavior is to always return true unless it is already focused.

The select(control) default behavior will always check the Control instance's canFocus() before doing any work.

Most Controls which exist will be focusable. It is the default behavior that a derived Control class is always focusable.

If you want to disable focusable in a specific way, you can override the function and return false instead of true.

For example, consider a TextField whose input might be disabled for now. During the disabled state, canFocus() would return false, but otherwise return true.

Return:

*

public containsFocus(): boolean source

Return:

boolean

public containsFocusable(): * source

Return:

*

public focus() source

public hasChildren(): * source

Return:

*

public isBlurred(): * source

The isBlurred() method returns the inverse of the isFocused() method.

Return:

*

public isDisabled(): * source

The isDisabled() method returns a boolean which indicates the value of the disabled property as passed into the component.

<Control disabled /> would cause isDisabled() to return true.

<Control /> would cause isDisabled() to return false.

Return:

*

public isEnabled(): * source

The isEnabled() method returns the inverse value of the isDisabled() method.

<Control disabled /> would cause isEnabled() to return false.

<Control /> would cause isEnabled() to return true.

Return:

*

public isFocusable(): * source

The isFocusable() method returns a boolean which indicates the value of the field, focusable. It is checked throughout other functions in Control, but can be safely overridden if you would like to extend Control so that it is focusable. The focusable field is normally set to false unless it is set manually, either using a consumer or by extending the Control class.

Return:

*

public isFocused(): * source

The isFocused() method returns a boolean which indicates the value of the focused property as passed into the component, as long as it is not disabled.

<Control focused /> would cause isFocused() to return true, unless the Control is disabled.

<Control focused disabled /> would cause isFocused() to return false, and is not a valid state for the Control component.

<Control /> would cause isFocused() to return false.

Return:

*

public render(): * source

Return:

*