@uncinc/uncinc-react-kitchen-sink 2.21.2 → 2.21.4

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,5 +1,5 @@
1
1
  export default Share;
2
- declare function Share({ title, pageTitle, url, items, onClick, customItems, withLabels, headingLevel }: {
2
+ declare function Share({ title, pageTitle, url, items, onClick, customItems, withLabels, headingLevel, isDropdown }: {
3
3
  title: any;
4
4
  pageTitle: any;
5
5
  url: any;
@@ -8,6 +8,7 @@ declare function Share({ title, pageTitle, url, items, onClick, customItems, wit
8
8
  customItems: any;
9
9
  withLabels: any;
10
10
  headingLevel?: number | undefined;
11
+ isDropdown?: boolean | undefined;
11
12
  }): React.JSX.Element;
12
13
  declare namespace Share {
13
14
  namespace defaultProps {
@@ -18,6 +19,7 @@ declare namespace Share {
18
19
  function onClick(): void;
19
20
  let withLabels: boolean;
20
21
  let customItems: {};
22
+ let isDropdown: boolean;
21
23
  }
22
24
  }
23
25
  import React from 'react';
@@ -1,3 +1,4 @@
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); }
1
2
  import React from 'react';
2
3
  import { EmailShareButton, FacebookShareButton, LinkedinShareButton, TwitterShareButton, WhatsappShareButton, PinterestShareButton, RedditShareButton, TelegramShareButton } from 'react-share';
3
4
  import './style.scss';
@@ -44,7 +45,9 @@ var Share = function Share(_ref2) {
44
45
  customItems = _ref2.customItems,
45
46
  withLabels = _ref2.withLabels,
46
47
  _ref2$headingLevel = _ref2.headingLevel,
47
- headingLevel = _ref2$headingLevel === void 0 ? 3 : _ref2$headingLevel;
48
+ headingLevel = _ref2$headingLevel === void 0 ? 3 : _ref2$headingLevel,
49
+ _ref2$isDropdown = _ref2.isDropdown,
50
+ isDropdown = _ref2$isDropdown === void 0 ? true : _ref2$isDropdown;
48
51
  var HeadingTag = "h".concat(headingLevel);
49
52
  var windowUrl = url || window.location.href;
50
53
  var buttons = items.map(function (item) {
@@ -65,10 +68,12 @@ var Share = function Share(_ref2) {
65
68
  className: "Share"
66
69
  }, /*#__PURE__*/React.createElement("div", {
67
70
  className: "Share__wrapper"
68
- }, /*#__PURE__*/React.createElement(HeadingTag, {
69
- className: "Share__title",
70
- tabIndex: "0"
71
- }, title), /*#__PURE__*/React.createElement("div", {
71
+ }, /*#__PURE__*/React.createElement(HeadingTag, _extends({
72
+ className: "Share__title"
73
+ }, isDropdown && {
74
+ tabIndex: '0',
75
+ role: 'button'
76
+ }), title), /*#__PURE__*/React.createElement("div", {
72
77
  className: "Share__buttons"
73
78
  }, buttons)));
74
79
  };
@@ -79,6 +84,7 @@ Share.defaultProps = {
79
84
  items: ['mail', 'facebook', 'linkedin', 'twitter', 'whatsapp'],
80
85
  onClick: function onClick() {},
81
86
  withLabels: false,
82
- customItems: {}
87
+ customItems: {},
88
+ isDropdown: true
83
89
  };
84
90
  export default Share;
@@ -61,4 +61,4 @@ WysiwygField.defaultProps = {
61
61
  className: '',
62
62
  id: null
63
63
  };
64
- export default withMapping(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.2",
3
+ "version": "2.21.4",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",