@elastic/eui
Version:
Elastic UI Component Library
86 lines (85 loc) • 5.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.euiRangeTicksStyles = exports.euiRangeTickStyles = void 0;
var _react = require("@emotion/react");
var _global_styling = require("../../../global_styling");
var _high_contrast = require("../../../global_styling/functions/high_contrast");
var _range = require("./range.styles");
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /*
* 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.
*/
var tickStyles = function tickStyles(euiThemeContext, range) {
var euiTheme = euiThemeContext.euiTheme;
return "\n position: absolute;\n ".concat((0, _global_styling.logicalCSS)('top', 0), ";\n block-size: ").concat(range.tickHeight, ";\n ").concat((0, _high_contrast.highContrastModeStyles)(euiThemeContext, {
none: "\n inline-size: ".concat(range.tickWidth, ";\n background-color: ").concat(range.tickColor, ";\n "),
// Windows high contrast themes ignore background color but render borders
forced: (0, _global_styling.logicalCSS)('border-left', "".concat(range.tickWidth, " solid ").concat(range.tickColor))
}), "\n border-radius: ").concat(euiTheme.border.radius.small, ";\n ");
};
var _ref3 = process.env.NODE_ENV === "production" ? {
name: "1sbhdc4-euiRangeTicks",
styles: "position:absolute;inset-inline:0;display:flex;label:euiRangeTicks;"
} : {
name: "1sbhdc4-euiRangeTicks",
styles: "position:absolute;inset-inline:0;display:flex;label:euiRangeTicks;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
var euiRangeTicksStyles = exports.euiRangeTicksStyles = function euiRangeTicksStyles(euiThemeContext) {
var range = (0, _range.euiRangeVariables)(euiThemeContext);
return {
// Base
euiRangeTicks: _ref3,
isCustom: /*#__PURE__*/(0, _react.css)("inset-inline:", (0, _global_styling.mathWithUnits)(range.thumbWidth, function (x) {
return x / 8;
}), ";;label:isCustom;"),
// compressed and non-compressed styles
regular: /*#__PURE__*/(0, _react.css)("block-size:", (0, _global_styling.mathWithUnits)([range.height, range.thumbHeight], function (x, y) {
return x - y;
}), ";inset-block-start:", range.thumbHeight, ";;label:regular;"),
compressed: /*#__PURE__*/(0, _react.css)("block-size:", (0, _global_styling.mathWithUnits)([range.compressedHeight, range.trackBottomPositionWithTicks], function (x, y) {
return x - y;
}), ";inset-block-start:", (0, _global_styling.mathWithUnits)([range.thumbHeight, range.trackHeight], function (x, y) {
return x - (x - y) / 2;
}), ";;label:compressed;")
};
};
var _ref = process.env.NODE_ENV === "production" ? {
name: "jgvly2-isMax",
styles: "transform:translateX(0);.euiRangeTick__pseudo{inset-inline-end:0;};label:isMax;"
} : {
name: "jgvly2-isMax",
styles: "transform:translateX(0);.euiRangeTick__pseudo{inset-inline-end:0;};label:isMax;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
var _ref2 = process.env.NODE_ENV === "production" ? {
name: "1nx14mu-isMin",
styles: "transform:translateX(0);.euiRangeTick__pseudo{inset-inline-start:0;};label:isMin;"
} : {
name: "1nx14mu-isMin",
styles: "transform:translateX(0);.euiRangeTick__pseudo{inset-inline-start:0;};label:isMin;",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};
var euiRangeTickStyles = exports.euiRangeTickStyles = function euiRangeTickStyles(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme;
var range = (0, _range.euiRangeVariables)(euiThemeContext);
return {
// Base
euiRangeTick: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSSWithFallback)('overflow-x', 'hidden'), " ", (0, _global_styling.logicalCSSWithFallback)('overflow-y', 'hidden'), " text-overflow:ellipsis;font-size:", (0, _global_styling.euiFontSize)(euiThemeContext, 'xs').fontSize, ";position:absolute;transform:translateX(-50%);&:disabled{cursor:not-allowed;}&:enabled:hover,&:focus{color:", range.focusColor, ";};label:euiRangeTick;"),
// compressed and non-compressed styles
compressed: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-top', euiTheme.size.s), " &::before{", (0, _global_styling.logicalCSS)('margin-top', euiTheme.size.xxs), ";};label:compressed;"),
regular: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-top', euiTheme.size.m), ";;label:regular;"),
selected: /*#__PURE__*/(0, _react.css)("font-weight:", euiTheme.font.weight.medium, ";color:", range.focusColor, ";;label:selected;"),
isCustom: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSSWithFallback)('overflow-x', 'hidden'), ";;label:isCustom;"),
// Tick marks can use either a ::before pseudo element or a span __pseudo node
hasPseudoTickMark: /*#__PURE__*/(0, _react.css)("&::before{", tickStyles(euiThemeContext, range), " content:'';inset-inline-start:calc(50% - ", range.thumbBorderWidth, ");};label:hasPseudoTickMark;"),
euiRangeTick__pseudo: /*#__PURE__*/(0, _react.css)(tickStyles(euiThemeContext, range), ";;label:euiRangeTick__pseudo;"),
isMin: _ref2,
isMax: _ref
};
};