@matt-dunn/react-wireframes
Version:
React component to annotate your components — useful for prototypes and proof of concepts
90 lines (55 loc) • 4.33 kB
JavaScript
;
require("core-js/modules/es.symbol");
require("core-js/modules/es.symbol.description");
require("core-js/modules/es.symbol.iterator");
require("core-js/modules/es.array.concat");
require("core-js/modules/es.array.from");
require("core-js/modules/es.array.iterator");
require("core-js/modules/es.array.join");
require("core-js/modules/es.array.slice");
require("core-js/modules/es.function.name");
require("core-js/modules/es.object.freeze");
require("core-js/modules/es.object.to-string");
require("core-js/modules/es.regexp.to-string");
require("core-js/modules/es.string.iterator");
require("core-js/modules/web.dom-collections.iterator");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Identifier = exports.IdentifierBase = exports.IdentifierContainer = void 0;
var _react = _interopRequireDefault(require("react"));
var _styled = _interopRequireDefault(require("@emotion/styled"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _templateObject() {
var data = _taggedTemplateLiteral(["\n all: initial;\n box-sizing: border-box;\n line-height: 1;\n border-radius: 2em;\n color: #333;\n background-color: yellow;\n border-color: #caca00;\n white-space: nowrap;\n min-width: 2em;\n max-width: initial;\n min-height: auto;\n max-height: initial;\n height: 2em;\n padding: 0.25em 0.5em;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n position: initial;\n overflow: visible;\n font-style: normal;\n font-weight: normal;\n font-size: 1rem;\n font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";\n text-align: center;\n text-decoration: none;\n text-transform: none;\n flex-grow: 0;\n flex-shrink: 0;\n"]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var IdentifierContainer = _styled.default.cite(_templateObject());
exports.IdentifierContainer = IdentifierContainer;
var getParentId = function getParentId(parent) {
return parent && [].concat(_toConsumableArray(getParentId(parent.api.getParentReference()) || []), [parent.id]);
};
var IdentifierBase = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
var annotation = _ref.annotation,
parentReference = _ref.parentReference,
className = _ref.className;
return /*#__PURE__*/_react.default.createElement(IdentifierContainer, {
ref: ref,
"data-annotation-identifier": true,
className: className
}, [].concat(_toConsumableArray(parentReference && getParentId(parentReference) || []), [annotation.id]).join("."));
});
exports.IdentifierBase = IdentifierBase;
IdentifierBase.displayName = "Identifier";
var Identifier = /*#__PURE__*/_react.default.memo(IdentifierBase);
exports.Identifier = Identifier;