UNPKG

@atlaskit/checkbox

Version:

A checkbox is an input control that allows a user to select one or more options from a number of choices.

52 lines (47 loc) 2.84 kB
/* label.tsx generated by @compiled/babel-plugin v0.39.1 */ /** * Base state styles with CSS custom properties. * Pseudo-selectors (:hover, :focus-within, :active) on the label element * update CSS variables that cascade to the CheckboxIcon. * This avoids nested sibling selectors. * * Uses `css` over `cssMap` to work around a bug in Compiled types when * using CSS variables in pseudo-selectors. */ "use strict"; var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Label; require("./label.compiled.css"); var React = _interopRequireWildcard(require("react")); var _runtime = require("@compiled/react/runtime"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } var baseStyles = null; var textLabelLayoutStyles = null; // Checked/Indeterminate state var checkedStyles = null; // Invalid state - must override hover/active to maintain red border var invalidStyles = null; // Disabled state - must override hover/active to maintain disabled appearance var disabledStyles = null; // Disabled + Checked/Indeterminate var disabledCheckedStyles = null; function Label(_ref) { var children = _ref.children, isDisabled = _ref.isDisabled, isChecked = _ref.isChecked, isIndeterminate = _ref.isIndeterminate, isInvalid = _ref.isInvalid, testId = _ref.testId, label = _ref.label, id = _ref.id, xcss = _ref.xcss; return /*#__PURE__*/React.createElement("label", { className: (0, _runtime.ax)(["_11c8fhey _1e0c11p5 _1ejihkll _umai184x _1qwn1j9a _f0grrsbi _1c53glyw _1e9d1j28 _syazi7uo _80om73ad _ljcgdfik _1vj5l4ek _dh4gr01l _cz1u1l7x _jom5wc43 _1s071onz _106f1onz", label && "_zulp1nu5 _yv0ey09t", (isChecked || isIndeterminate) && "_1qwnjmqp _f0grjmqp _1e9d5w2r _1vj51q28 _q29q1q28 _dh4gr01l _cz1u1l7x _zoo95w2r _jom5wc43 _1s071onz _106f1onz", isInvalid && "_f0gr1bqt _q29q1bqt _cz1u1bqt _1s07gir2", isDisabled && "_1qwnby5v _f0grby5v _syaz1gmx _80om13gf _1vj5by5v _q29qby5v _dh4gby5v _cz1uby5v _jom5wc43 _1s0718qt _106f18qt", isDisabled && (isChecked || isIndeterminate) && "_1e9d2sac _9js12sac _zoo92sac", xcss]), "data-testid": testId, "data-disabled": isDisabled || undefined, id: id }, children); }