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