mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
[React.14] Add checkedLink/valueLink to HTMLAttributes for LinkedStateMixin
This commit is contained in:
+5
@@ -14,6 +14,11 @@ declare namespace __React {
|
||||
interface LinkedStateMixin extends Mixin<any, any> {
|
||||
linkState<T>(key: string): ReactLink<T>;
|
||||
}
|
||||
|
||||
interface HTMLAttributes {
|
||||
checkedLink?: ReactLink<string>;
|
||||
valueLink?: ReactLink<string>;
|
||||
}
|
||||
|
||||
namespace __Addons {
|
||||
export var LinkedStateMixin: LinkedStateMixin;
|
||||
|
||||
+19
-2
@@ -466,8 +466,25 @@ React.createFactory(CSSTransitionGroup)({
|
||||
// LinkedStateMixin addon
|
||||
// --------------------------------------------------------------------------
|
||||
React.createClass({
|
||||
mixins: [LinkedStateMixin],
|
||||
render: function() { return React.DOM.div(null) }
|
||||
mixins: [LinkedStateMixin],
|
||||
getInitialState: function() {
|
||||
return {
|
||||
isChecked: false,
|
||||
message: "hello!"
|
||||
};
|
||||
},
|
||||
render: function() {
|
||||
return React.DOM.div(null,
|
||||
React.DOM.input({
|
||||
type: "checkbox",
|
||||
checkedLink: this.linkState("isChecked")
|
||||
}),
|
||||
React.DOM.input({
|
||||
type: "text",
|
||||
valueLink: this.linkState("message")
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
Vendored
+5
-2
@@ -324,8 +324,6 @@ declare namespace __React {
|
||||
}
|
||||
|
||||
interface HTMLProps extends HTMLAttributes, Props<HTMLElement> {
|
||||
defaultChecked?: boolean;
|
||||
defaultValue?: string | string[];
|
||||
}
|
||||
|
||||
interface SVGProps extends SVGAttributes, Props<SVGElement> {
|
||||
@@ -454,6 +452,11 @@ declare namespace __React {
|
||||
}
|
||||
|
||||
interface HTMLAttributes extends DOMAttributes {
|
||||
// React-specific Attributes
|
||||
defaultChecked?: boolean;
|
||||
defaultValue?: string | string[];
|
||||
|
||||
// Standard HTML Attributes
|
||||
accept?: string;
|
||||
acceptCharset?: string;
|
||||
accessKey?: string;
|
||||
|
||||
Reference in New Issue
Block a user