@uncinc/uncinc-react-kitchen-sink 2.21.1 → 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.
@@ -1,3 +1,3 @@
1
1
  export default withMapping;
2
- declare function withMapping(BaseComponent: any): (props: any) => React.JSX.Element;
2
+ declare function withMapping(BaseComponent: any, mappingKey: any): (props: any) => React.JSX.Element;
3
3
  import React from 'react';
@@ -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
- if (context && BaseComponent && !componentIsWrapped && context[BaseComponent.name]) {
9
- var WrapperComponent = context[BaseComponent.name];
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);
@@ -107,4 +107,4 @@ Button.propTypes = {
107
107
  current: PropTypes.element
108
108
  })])
109
109
  };
110
- export default withMapping(Button);
110
+ export default withMapping(Button, 'Button');
@@ -106,4 +106,4 @@ Checkbox.propTypes = {
106
106
  wrapperClassName: PropTypes.string,
107
107
  disabled: PropTypes.bool
108
108
  };
109
- export default withMapping(Checkbox);
109
+ export default withMapping(Checkbox, 'Checkbox');
@@ -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');
@@ -42,4 +42,4 @@ var SearchField = function SearchField(props) {
42
42
  className: "SearchField__error WebformComponent--error"
43
43
  }, error) : null);
44
44
  };
45
- export default withMapping(SearchField);
45
+ export default withMapping(SearchField, 'SearchField');
@@ -127,4 +127,4 @@ var RevealPasswordButton = function RevealPasswordButton(_ref) {
127
127
  flair: "outlined"
128
128
  }));
129
129
  };
130
- export default withMapping(TextField);
130
+ export default withMapping(TextField, 'TextField');
@@ -129,4 +129,4 @@ Pagination.defaultProps = {
129
129
  scrollToTopOffset: 0,
130
130
  scrollToTopBehavior: 'smooth'
131
131
  };
132
- export default withMapping(Pagination);
132
+ export default withMapping(Pagination, 'Pagination');
@@ -1,25 +1,3 @@
1
- export default WysiwygField;
2
- declare function WysiwygField({ html, customElementHandler, className, ...props }: {
3
- [x: string]: any;
4
- html: any;
5
- customElementHandler?: (() => void) | undefined;
6
- className?: string | undefined;
7
- }): React.JSX.Element;
8
- declare namespace WysiwygField {
9
- namespace propTypes {
10
- let html: PropTypes.Validator<string>;
11
- let customElementHandler: PropTypes.Requireable<(...args: any[]) => any>;
12
- let className: PropTypes.Requireable<string>;
13
- let id: PropTypes.Requireable<string>;
14
- }
15
- namespace defaultProps {
16
- export function customElementHandler_1(): void;
17
- export { customElementHandler_1 as customElementHandler };
18
- let className_1: string;
19
- export { className_1 as className };
20
- let id_1: null;
21
- export { id_1 as id };
22
- }
23
- }
1
+ declare const _default: (props: any) => React.JSX.Element;
2
+ export default _default;
24
3
  import React from 'react';
25
- import PropTypes from 'prop-types';
@@ -6,6 +6,7 @@ import React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import ReactHtmlParser from 'react-html-parser';
8
8
  import c from 'classnames';
9
+ import withMapping from '../../Context/withMapping';
9
10
  import Button from '../Button';
10
11
  var WysiwygField = function WysiwygField(_ref) {
11
12
  var html = _ref.html,
@@ -60,4 +61,4 @@ WysiwygField.defaultProps = {
60
61
  className: '',
61
62
  id: null
62
63
  };
63
- export default WysiwygField;
64
+ export default withMapping(WysiwygField, 'WysiwygField');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.21.1",
3
+ "version": "2.21.3",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",