@elastic/eui
Version:
Elastic UI Component Library
88 lines (85 loc) • 5.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.euiStepVariables = exports.euiStepTitleStyles = exports.euiStepStyles = exports.euiStepContentStyles = void 0;
var _react = require("@emotion/react");
var _services = require("../../services");
var _global_styling = require("../../global_styling");
/*
* 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 euiStepVariables = exports.euiStepVariables = function euiStepVariables(euiTheme) {
return {
numberSize: euiTheme.size.xl,
numberXSSize: euiTheme.size.l,
numberXXSSize: euiTheme.size.base,
numberMargin: euiTheme.size.base
};
};
var euiStepStyles = exports.euiStepStyles = function euiStepStyles(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme;
var euiStep = euiStepVariables(euiTheme);
// the vertical line is centered on the number, so we need to offset the line
// by half of the number size & half of the line size to center it
var getLeftPosition = function getLeftPosition(numberSize) {
return (0, _global_styling.mathWithUnits)([numberSize, euiTheme.border.width.thick], function (x, y) {
return x / 2 - y / 2;
});
};
return {
euiStep: /*#__PURE__*/(0, _react.css)("position:relative;&:not(:last-of-type)::before{content:'';position:absolute;", (0, _global_styling.logicalCSS)('bottom', 0), " ", (0, _global_styling.logicalCSS)('border-left', euiTheme.border.thick), ";};label:euiStep;"),
// Sizes
m: /*#__PURE__*/(0, _react.css)("&:not(:last-of-type)::before{", (0, _global_styling.logicalCSS)('top', euiStep.numberSize), " ", (0, _global_styling.logicalCSS)('left', getLeftPosition(euiStep.numberSize)), ";};label:m;"),
s: /*#__PURE__*/(0, _react.css)("&:not(:last-of-type)::before{", (0, _global_styling.logicalCSS)('top', euiStep.numberSize), " ", (0, _global_styling.logicalCSS)('left', getLeftPosition(euiStep.numberSize)), ";};label:s;"),
xs: /*#__PURE__*/(0, _react.css)("&:not(:last-of-type)::before{", (0, _global_styling.logicalCSS)('top', euiStep.numberXSSize), " ", (0, _global_styling.logicalCSS)('left', getLeftPosition(euiStep.numberXSSize)), ";};label:xs;"),
xxs: /*#__PURE__*/(0, _react.css)("&:not(:last-of-type)::before{", (0, _global_styling.logicalCSS)('top', euiStep.numberXXSSize), " ", (0, _global_styling.logicalCSS)('left', getLeftPosition(euiStep.numberXXSSize)), ";};label:xxs;")
};
};
var euiStepContentStyles = exports.euiStepContentStyles = function euiStepContentStyles(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme;
var euiStep = euiStepVariables(euiTheme);
return {
euiStep__content: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-top', euiTheme.size.s), " ", (0, _global_styling.logicalCSS)('padding-top', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-bottom', (0, _global_styling.mathWithUnits)([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
return x + y;
})), " ", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.base), ";;label:euiStep__content;"),
// Sizes
m: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', (0, _global_styling.mathWithUnits)([euiStep.numberSize, euiStep.numberMargin], function (x, y) {
return x / 2 + y;
})), (0, _global_styling.logicalCSS)('margin-left', (0, _global_styling.mathWithUnits)(euiStep.numberSize, function (x) {
return x / 2;
})), ";;label:m;"),
// `s` is the same as `m` - use a getter to duplicate its content
get s() {
return this.m;
},
xs: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', (0, _global_styling.mathWithUnits)([euiStep.numberXSSize, euiStep.numberMargin], function (x, y) {
return x / 2 + y;
})), (0, _global_styling.logicalCSS)('margin-left', (0, _global_styling.mathWithUnits)(euiStep.numberXSSize, function (x) {
return x / 2;
})), ";;label:xs;"),
xxs: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', (0, _global_styling.mathWithUnits)([euiStep.numberXXSSize, euiStep.numberMargin], function (x, y) {
return x / 2 + y;
})), (0, _global_styling.logicalCSS)('margin-left', (0, _global_styling.mathWithUnits)(euiStep.numberXXSSize, function (x) {
return x / 2;
})), ";;label:xxs;")
};
};
var euiStepTitleStyles = exports.euiStepTitleStyles = function euiStepTitleStyles(euiThemeContext) {
var euiTheme = euiThemeContext.euiTheme;
var euiStep = euiStepVariables(euiTheme);
return {
euiStep__titleWrapper: /*#__PURE__*/(0, _react.css)("display:flex;gap:", euiStep.numberMargin, ";;label:euiStep__titleWrapper;"),
euiStep__title: /*#__PURE__*/(0, _react.css)(";label:euiStep__title;"),
isDisabled: /*#__PURE__*/(0, _react.css)("color:", (0, _services.makeHighContrastColor)(euiTheme.colors.disabledText)(euiTheme.colors.body), ";;label:isDisabled;"),
// Sizes
m: /*#__PURE__*/(0, _react.css)(";label:m;"),
s: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-top', euiTheme.size.xs), ";;label:s;"),
xs: /*#__PURE__*/(0, _react.css)(";label:xs;"),
xxs: /*#__PURE__*/(0, _react.css)("line-height:", euiStep.numberXXSSize, ";;label:xxs;")
};
};