UNPKG

react-elegant-ui

Version:

Elegant UI components, made by BEM best practices for react

31 lines 1.11 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); }; import React from 'react'; import { getDisplayName } from '../getDisplayName'; /** * Constructor of HOC with options * * This HOC should use with `compose` or `composeU` or with alternative implementations, * which consider a utility props of result wrapper and remove props while not match. */ export var withHOCConstructor = function (options, Wrapper) { var ConfigurableHOC = function (Component) { // TODO: fix any if possible var WithHOC = Wrapper(Component); var WrappedComponent = function (props) { return /*#__PURE__*/React.createElement(WithHOC, __assign({}, props)); }; WrappedComponent.displayName = getDisplayName(Component); return WrappedComponent; }; ConfigurableHOC.__hocOptions = options; return ConfigurableHOC; };