UNPKG

@eccenca/gui-elements

Version:

GUI elements based on other libraries, usable in React application, written in Typescript.

50 lines 2.37 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BreadcrumbItem = void 0; const react_1 = __importDefault(require("react")); // import PropTypes from 'prop-types'; const core_1 = require("@blueprintjs/core"); const openInNewTab_1 = require("../../common/utils/openInNewTab"); const constants_1 = require("../../configuration/constants"); /** * Item of the breadcrumbs list. * It cannot be used directly but the properties can be used within the elements of the `BreadcrumbList.items` property. */ const BreadcrumbItem = (_a) => { /* FIXME: adding `data-divider` does not work this way because BlueprintJS breadcrumb component does not support (and forward) it on HTML element level. The idea is to add the divider as data-* property to use it via CSS/Sass as content for the pseudo element, currently done static in CSS with slash char. */ var { className = "", onClick, href } = _a, //itemDivider='', otherBlueprintBreadcrumbProps = __rest(_a, ["className", "onClick", "href"]); const actionIsSet = !!onClick || !!href; const allowActions = !otherBlueprintBreadcrumbProps.current && !otherBlueprintBreadcrumbProps.disabled && actionIsSet; const actions = allowActions ? { href, onClick: (e) => (0, openInNewTab_1.openInNewTab)(e, onClick, href), } : {}; return (react_1.default.createElement(core_1.Breadcrumb, Object.assign({}, otherBlueprintBreadcrumbProps, actions, { className: `${constants_1.CLASSPREFIX}-breadcrumb__item ` + className }))); }; exports.BreadcrumbItem = BreadcrumbItem; exports.default = exports.BreadcrumbItem; //# sourceMappingURL=BreadcrumbItem.js.map