UNPKG

@talend/react-forms

Version:

React forms library based on json schema form.

45 lines (44 loc) 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = TextModeCheckBox; var _propTypes = _interopRequireDefault(require("prop-types")); var _designSystem = require("@talend/design-system"); var _labels = require("../../../utils/labels"); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } function TextModeCheckBox({ id, schema, value }) { const formlabelProps = (0, _labels.getLabelProps)(schema.title || value, schema.labelProps); const iconName = value ? 'check' : 'cross'; const dataTestID = `widget-checkbox-icon-${iconName}`; return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_designSystem.StackHorizontal, { gap: "XXS", align: "center", children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_designSystem.SizedIcon, { id: id, "data-testid": dataTestID, "data-test": dataTestID, name: iconName, size: "S" }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_designSystem.Form.Label, { htmlFor: id, ...formlabelProps })] }); } if (process.env.NODE_ENV !== 'production') { TextModeCheckBox.propTypes = { id: _propTypes.default.string, schema: _propTypes.default.shape({ title: _propTypes.default.string, labelProps: _propTypes.default.object }).isRequired, value: _propTypes.default.bool }; } //# sourceMappingURL=TextMode.component.js.map