UNPKG

@storybook/design-system

Version:
74 lines (62 loc) 2.64 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.ClipboardCode = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _react = _interopRequireDefault(require("react")); var _theming = require("@storybook/theming"); var _ClipboardIcon = require("./ClipboardIcon"); var _excluded = ["code"]; 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)."; } var Container = (0, _theming.styled)("div", process.env.NODE_ENV === "production" ? { target: "e192l8fv2" } : { target: "e192l8fv2", label: "Container" })(process.env.NODE_ENV === "production" ? { name: "bjn8wh", styles: "position:relative" } : { name: "bjn8wh", styles: "position:relative", toString: _EMOTION_STRINGIFIED_CSS_ERROR__ }); var Code = (0, _theming.styled)("pre", process.env.NODE_ENV === "production" ? { target: "e192l8fv1" } : { target: "e192l8fv1", label: "Code" })(process.env.NODE_ENV === "production" ? { name: "1soaq5g", styles: "width:100%;display:block;margin:0;padding-right:32px;overflow:hidden;word-wrap:break-word" } : { name: "1soaq5g", styles: "width:100%;display:block;margin:0;padding-right:32px;overflow:hidden;word-wrap:break-word", toString: _EMOTION_STRINGIFIED_CSS_ERROR__ }); var StyledClipboardIcon = ( /*#__PURE__*/0, _theming.styled)(_ClipboardIcon.ClipboardIcon, process.env.NODE_ENV === "production" ? { target: "e192l8fv0" } : { target: "e192l8fv0", label: "StyledClipboardIcon" })(process.env.NODE_ENV === "production" ? { name: "1hargoy", styles: "position:absolute;top:4px;right:4px" } : { name: "1hargoy", styles: "position:absolute;top:4px;right:4px", toString: _EMOTION_STRINGIFIED_CSS_ERROR__ }); var ClipboardCode = function ClipboardCode(_ref) { var code = _ref.code, props = (0, _objectWithoutProperties2["default"])(_ref, _excluded); return /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(Code, (0, _extends2["default"])({ id: "clipboard-code" }, props), code), /*#__PURE__*/_react["default"].createElement(StyledClipboardIcon, { toCopy: code })); }; exports.ClipboardCode = ClipboardCode;