@yandex/ui
Version:
Yandex UI components
23 lines (22 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.withJsxContent = void 0;
var tslib_1 = require("tslib");
var react_1 = tslib_1.__importDefault(require("react"));
var getDisplayName_1 = require("../../lib/getDisplayName");
var useCollection_1 = require("../../useCollection");
/**
* Модификатор, отвечающий за содержимое меню.
*/
function withJsxContent(WrappedComponent) {
var WithJsxContent = function (props) {
var items = props.items, children = props.children, otherProps = tslib_1.__rest(props, ["items", "children"]);
var collection = useCollection_1.useCollection(props);
return react_1.default.createElement(WrappedComponent, tslib_1.__assign({}, otherProps, { items: items || collection }));
};
WithJsxContent.displayName = "withJsxContent(" + getDisplayName_1.getDisplayName(WrappedComponent) + ")";
return WithJsxContent;
}
exports.withJsxContent = withJsxContent;
tslib_1.__exportStar(require("./Group"), exports);
tslib_1.__exportStar(require("./Item"), exports);