UNPKG

@try-at-software/input-elements

Version:

A package providing different input elements that are extensible and easily configurable for your custom needs.

27 lines (26 loc) 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TextInput = void 0; const react_1 = require("@fluentui/react"); const React = require("react"); const Components_1 = require("../../Components"); class TextInput extends React.Component { constructor() { super(...arguments); this.handleChange = (_event, newValue) => { const { onChange } = this.props; onChange === null || onChange === void 0 ? void 0 : onChange(newValue); }; } render() { if (!this.props) return null; const { dynamicProps, operativeProps } = this.props; const { isDisabled } = dynamicProps; const { autoFocus, contentType, placeholder } = operativeProps; return (React.createElement(React.Fragment, null, React.createElement(Components_1.LabelRenderer, { label: this.props.label, required: !!this.props.renderRequiredIndicator }), React.createElement(react_1.TextField, { "data-automationid": "text-input", value: this.props.value || '', onChange: this.handleChange, errorMessage: Components_1.materializeErrorMessage(this.props.errorMessage), type: contentType, placeholder: placeholder, validateOnFocusOut: true, disabled: isDisabled, autoFocus: autoFocus }))); } } exports.TextInput = TextInput;