UNPKG

kitchen-simulator

Version:

It is a kitchen simulator (self-contained micro-frontend).

69 lines 3.27 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; import _createClass from "@babel/runtime/helpers/esm/createClass"; import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf"; import _inherits from "@babel/runtime/helpers/esm/inherits"; import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral"; var _excluded = ["style"]; var _templateObject; function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } import React, { Component } from 'react'; import * as SharedStyle from "../../shared-style"; import { PROJECT_NAME_LENGTH_LIMIT, TEXT_COLOR_NEUTRAL_3, BG_COLOR_0, DEFAULT_FONT_FAMILY, SECONDARY_PURPLE_COLOR } from "../../constants"; import styled from 'styled-components'; var StyledInput = styled.input(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n padding: 15px 10px 12px 0px;\n width: 120px;\n font-family: ", ";\n font-size: 12px;\n font-weight: 600;\n line-height: 17px;\n color: ", ";\n background-color: ", ";\n border: 2px solid;\n text-align: right;\n float: right;\n border-radius: 5px;\n outline: 0;\n :focus {\n border-color: ", ";\n }\n"])), DEFAULT_FONT_FAMILY, TEXT_COLOR_NEUTRAL_3, BG_COLOR_0, SECONDARY_PURPLE_COLOR); var FormTextInput = /*#__PURE__*/function (_Component) { function FormTextInput(props) { var _this; _classCallCheck(this, FormTextInput); _this = _callSuper(this, FormTextInput, [props]); _this.state = { focus: false }; _this.input = /*#__PURE__*/React.createRef(null); return _this; } _inherits(FormTextInput, _Component); return _createClass(FormTextInput, [{ key: "componentDidMount", value: function componentDidMount() { if (this.input.current) { this.input.current.select(); } } }, { key: "render", value: function render() { var _this2 = this; var _this$props = this.props, style = _this$props.style, rest = _objectWithoutProperties(_this$props, _excluded); return /*#__PURE__*/React.createElement(StyledInput, _extends({ ref: this.input, onFocus: function onFocus(e) { return _this2.setState({ focus: true }); }, onBlur: function onBlur(e) { return _this2.setState({ focus: false }); }, style: style // autoFocus , type: "text" }, rest, { maxLength: PROJECT_NAME_LENGTH_LIMIT })); } }]); }(Component); export { FormTextInput as default }; FormTextInput.defaultProps = { style: {} };