@sme.up/ketchup-react 6.8.0 → 7.1.0

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.
@@ -6,5 +6,5 @@ interface StencilReactInternalProps<ElementType> extends React.HTMLAttributes<El
6
6
  forwardedRef: React.RefObject<ElementType>;
7
7
  ref?: React.Ref<any>;
8
8
  }
9
- export declare const createReactComponent: <PropType, ElementType extends HTMLStencilElement, ContextStateType = {}, ExpandedPropsTypes = {}>(tagName: string, ReactComponentContext?: React.Context<ContextStateType>, manipulatePropsFunction?: (originalProps: StencilReactInternalProps<ElementType>, propsToPass: any) => ExpandedPropsTypes, defineCustomElement?: () => void) => React.ForwardRefExoticComponent<React.PropsWithoutRef<import("./utils").StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
9
+ export declare const createReactComponent: <PropType, ElementType extends HTMLStencilElement, ContextStateType = {}, ExpandedPropsTypes = {}>(tagName: string, ReactComponentContext?: React.Context<ContextStateType> | undefined, manipulatePropsFunction?: ((originalProps: StencilReactInternalProps<ElementType>, propsToPass: any) => ExpandedPropsTypes) | undefined, defineCustomElement?: (() => void) | undefined) => React.ForwardRefExoticComponent<React.PropsWithoutRef<import("./utils").StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
10
10
  export {};
@@ -1,14 +1,3 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import React, { createElement } from 'react';
13
2
  import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs, } from './utils';
14
3
  export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
@@ -30,7 +19,7 @@ export const createReactComponent = (tagName, ReactComponentContext, manipulateP
30
19
  attachProps(this.componentEl, this.props, prevProps);
31
20
  }
32
21
  render() {
33
- const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
22
+ const { children, forwardedRef, style, className, ref, ...cProps } = this.props;
34
23
  let propsToPass = Object.keys(cProps).reduce((acc, name) => {
35
24
  const value = cProps[name];
36
25
  if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
@@ -52,7 +41,11 @@ export const createReactComponent = (tagName, ReactComponentContext, manipulateP
52
41
  if (manipulatePropsFunction) {
53
42
  propsToPass = manipulatePropsFunction(this.props, propsToPass);
54
43
  }
55
- const newProps = Object.assign(Object.assign({}, propsToPass), { ref: mergeRefs(forwardedRef, this.setComponentElRef), style });
44
+ const newProps = {
45
+ ...propsToPass,
46
+ ref: mergeRefs(forwardedRef, this.setComponentElRef),
47
+ style,
48
+ };
56
49
  /**
57
50
  * We use createElement here instead of
58
51
  * React.createElement to work around a
@@ -16,6 +16,6 @@ export interface ReactOverlayProps {
16
16
  export declare const createOverlayComponent: <OverlayComponent extends object, OverlayType extends OverlayElement>(tagName: string, controller: {
17
17
  create: (options: any) => Promise<OverlayType>;
18
18
  }, customElement?: any) => React.ForwardRefExoticComponent<React.PropsWithoutRef<OverlayComponent & ReactOverlayProps & {
19
- forwardedRef?: StencilReactForwardedRef<OverlayType>;
19
+ forwardedRef?: StencilReactForwardedRef<OverlayType> | undefined;
20
20
  }> & React.RefAttributes<OverlayType>>;
21
21
  export {};
@@ -1,14 +1,3 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import React from 'react';
13
2
  import ReactDOM from 'react-dom';
14
3
  import { attachProps, dashToPascalCase, defineCustomElement, setRef, } from './utils';
@@ -73,9 +62,20 @@ export const createOverlayComponent = (tagName, controller, customElement) => {
73
62
  }
74
63
  }
75
64
  async present(prevProps) {
76
- const _a = this.props, { children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent } = _a, cProps = __rest(_a, ["children", "isOpen", "onDidDismiss", "onDidPresent", "onWillDismiss", "onWillPresent"]);
77
- const elementProps = Object.assign(Object.assign({}, cProps), { ref: this.props.forwardedRef, [didDismissEventName]: this.handleDismiss, [didPresentEventName]: (e) => this.props.onDidPresent && this.props.onDidPresent(e), [willDismissEventName]: (e) => this.props.onWillDismiss && this.props.onWillDismiss(e), [willPresentEventName]: (e) => this.props.onWillPresent && this.props.onWillPresent(e) });
78
- this.overlay = await controller.create(Object.assign(Object.assign({}, elementProps), { component: this.el, componentProps: {} }));
65
+ const { children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent, ...cProps } = this.props;
66
+ const elementProps = {
67
+ ...cProps,
68
+ ref: this.props.forwardedRef,
69
+ [didDismissEventName]: this.handleDismiss,
70
+ [didPresentEventName]: (e) => this.props.onDidPresent && this.props.onDidPresent(e),
71
+ [willDismissEventName]: (e) => this.props.onWillDismiss && this.props.onWillDismiss(e),
72
+ [willPresentEventName]: (e) => this.props.onWillPresent && this.props.onWillPresent(e),
73
+ };
74
+ this.overlay = await controller.create({
75
+ ...elementProps,
76
+ component: this.el,
77
+ componentProps: {},
78
+ });
79
79
  setRef(this.props.forwardedRef, this.overlay);
80
80
  attachProps(this.overlay, elementProps, prevProps);
81
81
  await this.overlay.present();
@@ -7,6 +7,6 @@ export declare const getClassName: (classList: DOMTokenList, newProps: any, oldP
7
7
  export declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
8
8
  export declare const syncEvent: (node: Element & {
9
9
  __events?: {
10
- [key: string]: (e: Event) => any;
11
- };
12
- }, eventName: string, newEventHandler?: (e: Event) => any) => void;
10
+ [key: string]: ((e: Event) => any) | undefined;
11
+ } | undefined;
12
+ }, eventName: string, newEventHandler?: ((e: Event) => any) | undefined) => void;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@sme.up/ketchup-react",
3
- "version": "6.8.0",
4
- "exports": "./dist/index.js",
5
- "types": "dist/index.d.ts",
3
+ "version": "7.1.0",
4
+ "module": "dist/index.js",
5
+ "typings": "dist/index.d.ts",
6
6
  "keywords": [
7
7
  "smeup",
8
8
  "KetchUP showcase",
@@ -10,7 +10,6 @@
10
10
  "custom elements",
11
11
  "components"
12
12
  ],
13
- "type": "module",
14
13
  "files": [
15
14
  "dist/"
16
15
  ],
@@ -21,16 +20,16 @@
21
20
  "description": "Ketchup React Components library by smeup",
22
21
  "license": "Apache-2.0",
23
22
  "dependencies": {
24
- "@sme.up/ketchup": "^6.8.0",
23
+ "@sme.up/ketchup": "^7.1.0",
25
24
  "react": "18.2.0",
26
- "react-dom": "18.2.0",
27
- "rimraf": "^3.0.2"
25
+ "react-dom": "18.2.0"
28
26
  },
29
27
  "devDependencies": {
30
- "typescript": "4.2.3",
31
28
  "@types/geojson": "^7946.0.8",
32
29
  "@types/node": "18.0.0",
33
30
  "@types/react": "18.0.14",
34
- "@types/react-dom": "18.0.5"
31
+ "@types/react-dom": "18.0.5",
32
+ "rimraf": "^3.0.2",
33
+ "typescript": "4.2.3"
35
34
  }
36
35
  }