UNPKG

@elastic/eui

Version:

Elastic UI Component Library

94 lines (91 loc) 6.82 kB
"use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.euiTableHeaderFooterCellStyles = exports.euiTableCellCheckboxStyles = exports._useEuiTableStickyCellStyles = void 0; var _react = require("@emotion/react"); var _services = require("../../services"); var _global_styling = require("../../global_styling"); var _table = require("./table.styles"); var _const = require("./const"); function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 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 euiTableHeaderFooterCellStyles = exports.euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(euiThemeContext) { var euiTheme = euiThemeContext.euiTheme; // euiFontSize returns an object, so we keep object notation here to merge into css`` var sharedStyles = _objectSpread(_objectSpread({}, (0, _global_styling.euiFontSize)(euiThemeContext, 'xs')), {}, { fontWeight: euiTheme.font.weight.semiBold, color: euiTheme.colors.textHeading, verticalAlign: 'middle' }); return { euiTableHeaderCell: /*#__PURE__*/(0, _react.css)(sharedStyles, ";;label:euiTableHeaderCell;"), euiTableHeaderCell__content: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"), euiTableHeaderCell__button: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), " font-weight:inherit;line-height:inherit;.euiTableSortIcon--sortable{color:", euiTheme.components.tableCellSortableIconColor, ";}&:hover,&:focus{color:", euiTheme.colors.textPrimary, ";text-decoration:underline;.euiTableSortIcon--sortable{color:", euiTheme.colors.textPrimary, ";}};label:euiTableHeaderCell__button;"), euiTableFooterCell: { euiTableFooterCell: /*#__PURE__*/(0, _react.css)(sharedStyles, ";;label:euiTableFooterCell;"), hasBackground: /*#__PURE__*/(0, _react.css)("background-color:", euiTheme.components.tableFooterBackground, ";;label:hasBackground;") } }; }; var euiTableCellCheckboxStyles = exports.euiTableCellCheckboxStyles = function euiTableCellCheckboxStyles(euiThemeContext) { var euiTheme = euiThemeContext.euiTheme; var _euiTableVariables = (0, _table.euiTableVariables)(euiThemeContext), cellContentPadding = _euiTableVariables.cellContentPadding, mobileSizes = _euiTableVariables.mobileSizes, checkboxSize = _euiTableVariables.checkboxSize; var sharedCheckboxStyles = "\n ".concat((0, _global_styling.logicalCSS)('width', checkboxSize), "\n vertical-align: middle;\n "); return { euiTableHeaderCellCheckbox: /*#__PURE__*/(0, _react.css)(sharedCheckboxStyles, (0, _global_styling.logicalTextAlignCSS)('left'), ";;label:euiTableHeaderCellCheckbox;"), euiTableRowCellCheckbox: /*#__PURE__*/(0, _react.css)(sharedCheckboxStyles, ";;label:euiTableRowCellCheckbox;"), desktop: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-vertical', euiTheme.border.thin), ";;label:desktop;"), mobile: /*#__PURE__*/(0, _react.css)("position:absolute;", (0, _global_styling.logicalCSS)('top', cellContentPadding), " ", (0, _global_styling.logicalCSS)('left', mobileSizes.checkbox.offset), ";;label:mobile;") }; }; var _ref = process.env.NODE_ENV === "production" ? { name: "10im1kr-end", styles: "inset-inline-end:0;label:end;" } : { name: "10im1kr-end", styles: "inset-inline-end:0;label:end;", toString: _EMOTION_STRINGIFIED_CSS_ERROR__ }; var _ref2 = process.env.NODE_ENV === "production" ? { name: "1u5b4oq-start", styles: "inset-inline-start:0;label:start;" } : { name: "1u5b4oq-start", styles: "inset-inline-start:0;label:start;", toString: _EMOTION_STRINGIFIED_CSS_ERROR__ }; var euiTableStickyCellStyles = function euiTableStickyCellStyles(_ref3) { var euiTheme = _ref3.euiTheme; return { root: /*#__PURE__*/(0, _react.css)("position:sticky;background-color:var(\n --euiTableCellStickyBackgroundColor,\n ", euiTheme.colors.backgroundBasePlain, "\n );", (0, _global_styling.euiContainerQuery)('scroll-state(scrollable: right)', _const.EUI_TABLE_CSS_CONTAINER_NAME), "{&::before{content:'';position:absolute;inset-inline-start:0;inset-block:0;inline-size:", euiTheme.border.width.thin, ";background-color:", euiTheme.border.color, ";}};label:root;"), side: { start: _ref2, end: _ref } }; }; /** * @internal */ var _useEuiTableStickyCellStyles = exports._useEuiTableStickyCellStyles = function _useEuiTableStickyCellStyles(options) { var styles = (0, _services.useEuiMemoizedStyles)(euiTableStickyCellStyles); if (!options) { return undefined; } return [styles.root, styles.side[options.side]]; };