@primer/components
Version:
Primer react components
87 lines (68 loc) • 4.79 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _ = require(".");
var _constants = require("./constants");
var _sx = _interopRequireDefault(require("./sx"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const Timeline = _styledComponents.default.div.withConfig({
displayName: "Timeline",
componentId: "sc-c4dq2e-0"
})(["display:flex;flex-direction:column;", " ", ";"], props => props.clipSidebar && (0, _styledComponents.css)([".Timeline-Item:first-child{padding-top:0;}.Timeline-Item:last-child{padding-bottom:0;}"]), _sx.default);
const TimelineItem = _styledComponents.default.div.attrs(props => ({
className: (0, _classnames.default)('Timeline-Item', props.className)
})).withConfig({
displayName: "Timeline__TimelineItem",
componentId: "sc-c4dq2e-1"
})(["display:flex;position:relative;padding:", " 0;margin-left:", ";&::before{position:absolute;top:0;bottom:0;left:0;display:block;width:2px;content:'';background-color:", ";}", " ", ";"], (0, _constants.get)('space.3'), (0, _constants.get)('space.3'), (0, _constants.get)('colors.border.muted'), props => props.condensed && (0, _styledComponents.css)(["padding-top:", ";padding-bottom:0;&:last-child{padding-bottom:", ";}.TimelineItem-Badge{height:16px;margin-top:", ";margin-bottom:", ";color:", ";background-color:", ";border:0;}"], (0, _constants.get)('space.1'), (0, _constants.get)('space.3'), (0, _constants.get)('space.2'), (0, _constants.get)('space.2'), (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('colors.canvas.default')), _sx.default);
const TimelineBadge = props => {
return /*#__PURE__*/_react.default.createElement(_.Box, {
position: "relative",
zIndex: 1
}, /*#__PURE__*/_react.default.createElement(_.Box, {
display: "flex",
className: "TimelineItem-Badge",
flexShrink: 0,
borderRadius: "50%",
borderWidth: "2px",
borderStyle: "solid",
borderColor: "canvas.default",
overflow: "hidden",
color: "fg.muted",
bg: "timeline.badgeBg",
width: "32px",
height: "32px",
mr: 2,
ml: "-15px",
alignItems: "center",
justifyContent: "center",
sx: props.sx
}, props.children));
};
TimelineBadge.displayName = "TimelineBadge";
const TimelineBody = _styledComponents.default.div.withConfig({
displayName: "Timeline__TimelineBody",
componentId: "sc-c4dq2e-2"
})(["min-width:0;max-width:100%;margin-top:", ";color:", ";flex:auto;font-size:", ";", ";"], (0, _constants.get)('space.1'), (0, _constants.get)('colors.fg.muted'), (0, _constants.get)('fontSizes.1'), _sx.default);
const TimelineBreak = _styledComponents.default.div.withConfig({
displayName: "Timeline__TimelineBreak",
componentId: "sc-c4dq2e-3"
})(["position:relative z-index:1;height:24px;margin:0;margin-bottom:-", ";margin-left:0;background-color:", ";border:0;border-top:", " solid ", ";", ";"], (0, _constants.get)('space.3'), (0, _constants.get)('colors.canvas.default'), (0, _constants.get)('space.1'), (0, _constants.get)('colors.border.default'), _sx.default);
TimelineItem.displayName = 'Timeline.Item';
TimelineBadge.displayName = 'Timeline.Badge';
TimelineBody.displayName = 'Timeline.Body';
TimelineBreak.displayName = 'Timeline.Break';
var _default = Object.assign(Timeline, {
Item: TimelineItem,
Badge: TimelineBadge,
Body: TimelineBody,
Break: TimelineBreak
});
exports.default = _default;