@tomino/dynamic-form-semantic-ui
Version:
Semantic UI form renderer based on dynamic form generation
25 lines • 1.28 kB
JavaScript
import * as React from 'react';
import { css } from '../../common';
import { TextArea } from 'semantic-ui-react';
import { SignatureSign } from './signature_sign';
import { SignatureReject } from './signature_reject';
import { ErrorView } from '../error_view';
import { valueSource } from '../../helpers';
const signatureLine = css `
height: 20px;
margin: 12px;
border-bottom: dashed 1px #d4d4d5;
`;
export const SignatureRoot = props => {
const [reason, setReason] = React.useState('');
if (props.readOnly) {
return React.createElement("div", { className: signatureLine }, "\u00A0");
}
return (React.createElement(React.Fragment, null,
props.allowComment && (React.createElement(TextArea, { placeholder: "Please leave a comment ...", value: reason, onChange: e => setReason(e.currentTarget.value) })),
React.createElement(SignatureSign, Object.assign({}, props, { reason: reason })),
(props.formElement.props || {}).allowReject && (React.createElement(SignatureReject, Object.assign({}, props, { reason: reason }))),
React.createElement(ErrorView, { owner: props.owner, source: valueSource(props.formElement) + '.name', newLine: true })));
};
SignatureRoot.displayName = 'Signature';
//# sourceMappingURL=signature.js.map