UNPKG

@bigbinary/neetoui

Version:

neetoUI drives the experience at all neeto products

77 lines (74 loc) 2.93 kB
import _extends from '@babel/runtime/helpers/extends'; import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties'; import React__default, { forwardRef } from 'react'; import classnames from 'classnames'; import { u as useId } from './useId-Jj9hXm-g.js'; import '@babel/runtime/helpers/slicedToArray'; import 'react-router-dom'; import '@bigbinary/neeto-hotkeys'; import './overlayManager.js'; import { h as hyphenize } from './index-Dxaw6gl9.js'; import '@babel/runtime/helpers/defineProperty'; import 'qs'; import Label from './Label.js'; import '@babel/runtime/helpers/classCallCheck'; import '@babel/runtime/helpers/createClass'; import '@bigbinary/neeto-cist'; import 'ramda'; import './en-CIkXIYyl.js'; import '@babel/runtime/helpers/toConsumableArray'; import 'dayjs'; import 'dayjs/plugin/localeData'; import 'dayjs/plugin/utc'; import 'dayjs/plugin/weekday'; import 'dayjs/plugin/weekOfYear'; import '@bigbinary/neeto-icons'; import './Button.js'; import './Spinner.js'; import './Tooltip.js'; import '@tippyjs/react'; import 'tippy.js'; import './Popover.js'; import './Typography.js'; var _excluded = ["label", "error", "className", "required", "labelProps", "children"]; var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) { var _ref$label = _ref.label, label = _ref$label === void 0 ? "" : _ref$label, _ref$error = _ref.error, error = _ref$error === void 0 ? "" : _ref$error, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className, _ref$required = _ref.required, required = _ref$required === void 0 ? false : _ref$required, labelProps = _ref.labelProps, children = _ref.children, otherProps = _objectWithoutProperties(_ref, _excluded); var id = useId(otherProps.id); var errorId = "error_".concat(id); var renderLabel = label || children; return /*#__PURE__*/React__default.createElement("div", { className: classnames(["neeto-ui-checkbox__wrapper", className]) }, /*#__PURE__*/React__default.createElement("div", { className: "neeto-ui-checkbox__container" }, /*#__PURE__*/React__default.createElement("input", _extends({ id: id, ref: ref, required: required, "aria-invalid": !!error, className: "neeto-ui-checkbox", "data-cy": "".concat(hyphenize(renderLabel), "-checkbox-input"), name: id, type: "checkbox" }, otherProps)), renderLabel && /*#__PURE__*/React__default.createElement(Label, _extends({ required: required, "data-cy": "".concat(hyphenize(renderLabel), "-checkbox-label"), htmlFor: id }, labelProps), renderLabel)), !!error && /*#__PURE__*/React__default.createElement("p", { className: "neeto-ui-input__error", "data-cy": "".concat(hyphenize(renderLabel), "-checkbox-error"), id: errorId }, error)); }); Checkbox.displayName = "Checkbox"; export { Checkbox as default }; //# sourceMappingURL=Checkbox.js.map