@elastic/eui
Version:
Elastic UI Component Library
41 lines (40 loc) • 2.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.euiFormLabelStyles = exports.euiFormLabel = void 0;
var _react = require("@emotion/react");
var _serialize = require("@emotion/serialize");
var _global_styling = require("../../../global_styling");
var _title = require("../../title/title.styles");
var _excluded = ["fontWeight"];
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
var euiFormLabel = exports.euiFormLabel = function euiFormLabel(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme;
// Exclude the fontWeight from the title, since we're setting our own later
var _euiTitle = (0, _title.euiTitle)(euiThemeContext, 'xxxs'),
_ = _euiTitle.fontWeight,
_titleStyles = _objectWithoutProperties(_euiTitle, _excluded);
// Since we're not returning a css`` string (to avoid generating an extra Emotion
// className), we need to manually serialize the style object into a string
var titleStyles = (0, _serialize.serializeStyles)([_titleStyles]).styles;
return "\n ".concat(titleStyles, "\n font-weight: ").concat(euiTheme.font.weight.semiBold, ";\n ").concat((0, _global_styling.euiTextBreakWord)(), "\n ");
};
var euiFormLabelStyles = exports.euiFormLabelStyles = function euiFormLabelStyles(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme;
return {
euiFormLabel: /*#__PURE__*/(0, _react.css)(euiFormLabel(euiThemeContext), " display:inline-block;", _global_styling.euiCanAnimate, "{transition:color ", euiTheme.animation.fast, " ", euiTheme.animation.resistance, ";};label:euiFormLabel;"),
// Skip css`` to avoid generating an extra Emotion className
// Use :where to reduce specificity & make the CSS easier to override by prepend/append nodes
notDisabled: "\n &:where([for]) {\n cursor: pointer;\n }\n ",
invalid: /*#__PURE__*/(0, _react.css)("color:", euiTheme.colors.textDanger, ";;label:invalid;")
};
};