All files / src/form/fields/FieldContainer FieldContainer.js

100% Statements 7/7
72.22% Branches 13/18
100% Functions 2/2
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63                            4x                           4x   4x   4x   4x                                   11x   11x                
/**** Libraries ****/
import React, { PureComponent } from 'react';
import { defaultProps } from './props/defaultProps';
import { propTypes } from './props/propTypes';
 
/**** Components ****/
import { Container } from '@zohodesk/components/lib/Layout';
/**** Icons ****/
import { Icon } from '@zohodesk/icons';
/**** CSS ****/
import style from '../Fields.module.css';
 
export default class FieldContainer extends PureComponent {
  constructor(props) {
    super(props);
  }
 
  render() {
    let {
      children,
      ePhiData,
      isLocked,
      lockedInfoText,
      infoText,
      dataId,
      renderProps,
      alignContainer,
      dataSelectorId
    } = this.props;
 
    let { ePhiTitle = '', ePhiText = '', ePhiStatus = false } = ePhiData;
 
    let { start: renderStart = null, middle: renderMiddle = null, end: renderEnd = null } = renderProps;
 
    return (
      <Container align={alignContainer} alignBox='row' isCover={false} dataSelectorId={dataSelectorId}>
        {renderStart ? renderStart() : null}
        {children}
        {renderMiddle ? renderMiddle() : null}
        {infoText ? <Icon name='ZD-GN-info' iconClass={style.infoIcon} title={infoText} size='15' /> : null}
        {isLocked ? <Icon name='ZD-GN-lock' size='13' iconClass={style.lockIcon} title={lockedInfoText} /> : null}
        {ePhiStatus ? (
          <span data-title={ePhiTitle} data-id={`${dataId}_ePHI`} data-test-id={`${dataId}_ePHI`} className={style.ePhiTag}>
            {ePhiText}
          </span>
        ) : null}
        {renderEnd ? renderEnd() : null}
      </Container>
    );
  }
}
 
FieldContainer.propTypes = propTypes;
 
FieldContainer.defaultProps = defaultProps;
 
// if (__DOCS__) {
//   FieldContainer.docs = {
//     componentGroup: 'Form Fields',
//     folderName: 'General'
//   };
// }