wix-style-react
Version:
wix-style-react
79 lines (65 loc) • 3.28 kB
JavaScript
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
import React from 'react';
import InputArea from 'wix-style-react/InputArea';
import TextButton from 'wix-storybook-utils/TextButton';
var CommandsExample = function (_React$Component) {
_inherits(CommandsExample, _React$Component);
function CommandsExample() {
_classCallCheck(this, CommandsExample);
return _possibleConstructorReturn(this, (CommandsExample.__proto__ || Object.getPrototypeOf(CommandsExample)).apply(this, arguments));
}
_createClass(CommandsExample, [{
key: 'render',
value: function render() {
var _this2 = this;
var handleClick1 = function handleClick1() {
return _this2.refs.inputtest.focus();
};
var handleClick2 = function handleClick2() {
_this2.refs.inputtest.focus();
setTimeout(function () {
return _this2.refs.inputtest.blur();
}, 1000);
};
var handleClick3 = function handleClick3() {
_this2.refs.inputtest.focus();
_this2.refs.inputtest.select();
};
return React.createElement(
'div',
null,
React.createElement(
'div',
{ style: { width: '400px' } },
React.createElement(InputArea, { ref: 'inputtest' })
),
React.createElement(
TextButton,
{ onClick: handleClick1 },
'Focus'
),
React.createElement(
TextButton,
{ onClick: handleClick2 },
'Focus & blur 1 second later'
),
React.createElement(
TextButton,
{ onClick: handleClick3 },
'Select text'
)
);
}
}]);
return CommandsExample;
}(React.Component);
export default (function () {
return React.createElement(
'div',
null,
React.createElement(CommandsExample, null)
);
});