@sanity/desk-tool
Version:
Tool for managing all sorts of content in a structured manner
33 lines (32 loc) • 5.3 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Root = exports.IconWrapper = exports.IconBox = exports.EventLabel = void 0;
var _ui = require("@sanity/ui");
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var IconWrapper = (0, _styledComponents.default)(_ui.Flex)(_ref => {
var _theme$sanity$color$b;
var theme = _ref.theme;
var borderColor = (_theme$sanity$color$b = theme.sanity.color.base.skeleton) === null || _theme$sanity$color$b === void 0 ? void 0 : _theme$sanity$color$b.from;
return (0, _styledComponents.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n --timeline-hairline-width: 1px;\n position: relative;\n z-index: 2;\n margin: 0;\n padding: 0;\n\n &::before {\n position: absolute;\n content: '';\n height: 100%;\n width: var(--timeline-hairline-width);\n background: ", ";\n top: 0;\n left: calc((100% - var(--timeline-hairline-width)) / 2);\n z-index: 1;\n }\n "])), borderColor);
});
exports.IconWrapper = IconWrapper;
var Root = (0, _styledComponents.default)(_ui.MenuItem)(_ref2 => {
var _ref2$state = _ref2.state,
state = _ref2$state === void 0 ? 'enabled' : _ref2$state,
isHovered = _ref2.isHovered,
theme = _ref2.theme;
var color = theme.sanity.color;
var selectedState = color.button.default.primary.enabled;
return (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n min-width: 244px;\n\n ", "\n\n ", "\n\n ", "\n\n // line styling \uD83D\uDC47\n &:first-child ", "::before {\n height: 50%;\n top: unset;\n bottom: 0;\n }\n\n &:last-child ", "::before {\n height: 50%;\n }\n\n ", "\n\n // Remove timeline lines when using the keyboard to navigate timeline items\n &:focus ", "::before {\n background: transparent;\n }\n "])), state === 'selected' && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n --card-muted-fg-color: ", ";\n --card-border-color: ", ";\n &:not([data-selection-bottom='true']) {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n "])), selectedState.bg, selectedState.fg, selectedState.muted, selectedState.bg), state === 'withinSelection' && (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n box-shadow: 0px 3px 0px 0px var(--card-bg-color);\n &:not([data-selection-top='true']) {\n border-radius: 0;\n }\n\n ", " {\n &::before {\n background: var(--card-hairline-soft-color);\n }\n }\n "])), IconWrapper), state === 'disabled' && (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n [data-ui='Avatar'] {\n opacity: 0.2;\n }\n "]))), IconWrapper, IconWrapper, (isHovered || state === 'selected') && (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "::before {\n background: transparent;\n }\n "])), IconWrapper), IconWrapper);
});
exports.Root = Root;
var IconBox = (0, _styledComponents.default)(_ui.Box)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background: var(--card-bg-color);\n border-radius: 50px;\n position: relative;\n z-index: 2;\n"])));
exports.IconBox = IconBox;
var EventLabel = (0, _styledComponents.default)(_ui.Text)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n text-transform: capitalize;\n"])));
exports.EventLabel = EventLabel;