Repository URL to install this package:
|
Version:
3.1.1 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const deps_1 = require("./deps");
const styled_1 = require("./styled");
function toPlaceholderProps(props, state) {
const isLabelOnTop = state.value !== '';
const placeholderText = deps_1.toPlaceholder(props, state);
const shouldAnimatePlaceholder = props.animatePlaceholder || props.shouldAnimatePlaceholder;
return Object.assign({}, props, { shouldAnimatePlaceholder,
isLabelOnTop,
placeholderText });
}
exports.toPlaceholderProps = toPlaceholderProps;
function renderPlaceholder(props, state) {
const { isLabelOnTop, placeholderText, shouldAnimatePlaceholder, } = toPlaceholderProps(props, state);
if (shouldAnimatePlaceholder === false) {
return '';
}
return (React.createElement(styled_1.StyledLabel, { className: 'input-box-label', isLabelOnTop: props.isLabelOnTop }, placeholderText));
}
exports.renderPlaceholder = renderPlaceholder;
function renderError(props, state) {
return (state.isValidInput === false && (React.createElement(styled_1.StyledErrorMessage, { text: state.errorMessage })));
}
exports.renderError = renderError;
// @todo also renderWrap if needed
function toWrap(props) {
return props.nowrap === true ? React.Fragment : styled_1.TextBoxWrapper;
}
exports.toWrap = toWrap;
//# sourceMappingURL=renderProps.js.map