UNPKG

@talend/react-forms

Version:

React forms library based on json schema form.

38 lines 1.13 kB
import PropTypes from 'prop-types'; import { Form, SizedIcon, StackHorizontal } from '@talend/design-system'; import { getLabelProps } from '../../../utils/labels'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; export default function TextModeCheckBox({ id, schema, value }) { const formlabelProps = getLabelProps(schema.title || value, schema.labelProps); const iconName = value ? 'check' : 'cross'; const dataTestID = `widget-checkbox-icon-${iconName}`; return /*#__PURE__*/_jsxs(StackHorizontal, { gap: "XXS", align: "center", children: [/*#__PURE__*/_jsx(SizedIcon, { id: id, "data-testid": dataTestID, "data-test": dataTestID, name: iconName, size: "S" }), /*#__PURE__*/_jsx(Form.Label, { htmlFor: id, ...formlabelProps })] }); } if (process.env.NODE_ENV !== 'production') { TextModeCheckBox.propTypes = { id: PropTypes.string, schema: PropTypes.shape({ title: PropTypes.string, labelProps: PropTypes.object }).isRequired, value: PropTypes.bool }; } //# sourceMappingURL=TextMode.component.js.map