@uncinc/uncinc-react-kitchen-sink 2.21.2 → 2.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Context/withMapping.d.ts +1 -1
- package/dist/Context/withMapping.js +4 -3
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Form/Checkbox/index.js +1 -1
- package/dist/components/Form/GenericFormElement/index.js +1 -1
- package/dist/components/Form/SearchField/index.js +1 -1
- package/dist/components/Form/TextField/index.js +1 -1
- package/dist/components/Pagination/index.js +1 -1
- package/dist/components/WysiwygField/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import KitchenSinkComponentMapperContext from './KitchenSinkComponentMapperContext';
|
|
4
|
-
var withMapping = function withMapping(BaseComponent) {
|
|
4
|
+
var withMapping = function withMapping(BaseComponent, mappingKey) {
|
|
5
5
|
return function (props) {
|
|
6
6
|
var componentIsWrapped = props.componentIsWrapped;
|
|
7
7
|
var context = useContext(KitchenSinkComponentMapperContext);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
var key = mappingKey || BaseComponent.displayName || BaseComponent.name;
|
|
9
|
+
if (context && BaseComponent && !componentIsWrapped && context[key]) {
|
|
10
|
+
var WrapperComponent = context[key];
|
|
10
11
|
return /*#__PURE__*/React.createElement(WrapperComponent, _extends({}, props, {
|
|
11
12
|
componentIsWrapped: true
|
|
12
13
|
}), props.children);
|
|
@@ -55,4 +55,4 @@ var GenericFormElement = function GenericFormElement(props) {
|
|
|
55
55
|
className: "FormElement__error ".concat(className, "__error")
|
|
56
56
|
}, error) : null));
|
|
57
57
|
};
|
|
58
|
-
export default withMapping(GenericFormElement);
|
|
58
|
+
export default withMapping(GenericFormElement, 'GenericFormElement');
|