Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/ui / dist / module / inputs / TextBox / renderProps.js
Size: Mime:
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