@eccenca/gui-elements
Version:
GUI elements based on other libraries, usable in React application, written in Typescript.
45 lines • 2.45 kB
JavaScript
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 PropertyName from "./PropertyName.js";
import PropertyValue from "./PropertyValue.js";
export var PropertyValuePair = function (_a) {
var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b, nowrap = _a.nowrap, _c = _a.hasSpacing, hasSpacing = _c === void 0 ? false : _c, _d = _a.hasDivider, hasDivider = _d === void 0 ? false : _d, _e = _a.singleColumn, singleColumn = _e === void 0 ? false : _e, otherProps = __rest(_a, ["children", "className", "nowrap", "hasSpacing", "hasDivider", "singleColumn"]);
var alteredChildren = nowrap
? React.Children.map(children, function (child) {
var originalChild = child;
if (originalChild.type && (originalChild.type === PropertyName || originalChild.type === PropertyValue)) {
return React.cloneElement(originalChild, { nowrap: true });
}
return child;
})
: children;
return (React.createElement("div", __assign({ className: "".concat(eccgui, "-propertyvalue__pair") +
(className ? " " + className : "") +
(hasSpacing ? " ".concat(eccgui, "-propertyvalue__pair--hasspacing") : "") +
(hasDivider ? " ".concat(eccgui, "-propertyvalue__pair--hasdivider") : "") +
(singleColumn ? " ".concat(eccgui, "-propertyvalue__pair--singlecolumn") : "") }, otherProps), alteredChildren));
};
export default PropertyValuePair;
//# sourceMappingURL=PropertyValuePair.js.map