UNPKG

@eccenca/gui-elements

Version:

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

48 lines 2.67 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; 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; }; import React from "react"; import { CLASSPREFIX as eccgui } from "../../configuration/constants.js"; import Card from "../Card/Card.js"; /** * This element can include all basic information and actions to give an overview about the item. * Mainly used in items list or to create basic widgets. */ export var OverviewItem = function (_a) { var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b, _c = _a.densityHigh, densityHigh = _c === void 0 ? false : _c, _d = _a.hasSpacing, hasSpacing = _d === void 0 ? false : _d, _e = _a.hasCardWrapper, hasCardWrapper = _e === void 0 ? false : _e, cardProps = _a.cardProps, otherProps = __rest(_a, ["children", "className", "densityHigh", "hasSpacing", "hasCardWrapper", "cardProps"]); var item = (React.createElement("div", __assign({}, otherProps, { className: "".concat(eccgui, "-overviewitem__item ") + (densityHigh ? "".concat(eccgui, "-overviewitem__item--highdensity ") : "") + (hasSpacing ? "".concat(eccgui, "-overviewitem__item--hasspacing ") : "") + className }), children)); // eslint-disable-next-line @typescript-eslint/no-explicit-any var accessibilityParameters = Object.create(null); if (typeof otherProps.onClick !== "undefined" || typeof otherProps.onKeyDown !== "undefined") { accessibilityParameters["tabIndex"] = 0; } if (typeof otherProps.onClick !== "undefined" && typeof otherProps.onKeyDown !== "undefined") { accessibilityParameters["role"] = "button"; } var element = React.cloneElement(item, accessibilityParameters); return hasCardWrapper ? (React.createElement(Card, __assign({ isOnlyLayout: true }, cardProps), element)) : (element); }; export default OverviewItem; //# sourceMappingURL=OverviewItem.js.map