Skip to content

Commit

Permalink
Merge pull request #35 from kit-data-manager/dev
Browse files Browse the repository at this point in the history
PR for v0.0.16
  • Loading branch information
ThomasJejkal authored Sep 30, 2024
2 parents f39a203 + 00aad88 commit 61e9ccd
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 57 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kit-data-manager/data-view-web-component",
"version": "0.0.15",
"version": "0.0.16",
"description": "Generic Web Component used to display various hierarchical data in a card format",
"main": "dist/index.cjs.js",
"module": "dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export const createOverlayComponent = <OverlayComponent extends object, OverlayT
}
}

return React.forwardRef<OverlayType, Props>((props, ref) => {
return <Overlay {...props} forwardedRef={ref} />;
});
return React.forwardRef<OverlayType, Props>((props: ReactOverlayProps, ref) => {
// @ts-ignore
return <Overlay forwardedRef={ref} {...props}/>;
})
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import React from 'react';

import type { StyleReactProps } from '../interfaces';

export type StencilReactExternalProps<PropType, ElementType> = PropType &
Omit<React.HTMLAttributes<ElementType>, 'style'> &
StyleReactProps;

// This will be replaced with React.ForwardedRef when react-output-target is upgraded to React v17
export type StencilReactForwardedRef<T> = ((instance: T | null) => void) | React.MutableRefObject<T | null> | null;

Expand All @@ -18,33 +12,5 @@ export const setRef = (ref: StencilReactForwardedRef<any> | React.Ref<any> | und
}
};

export const mergeRefs = (
...refs: (StencilReactForwardedRef<any> | React.Ref<any> | undefined)[]
): React.RefCallback<any> => {
return (value: any) => {
refs.forEach((ref) => {
setRef(ref, value);
});
};
};

export const createForwardRef = <PropType, ElementType>(ReactComponent: any, displayName: string) => {
const forwardRef = (
props: StencilReactExternalProps<PropType, ElementType>,
ref: StencilReactForwardedRef<ElementType>
) => {
return <ReactComponent {...props} forwardedRef={ref} />;
};
forwardRef.displayName = displayName;

return React.forwardRef(forwardRef);
};

export const defineCustomElement = (tagName: string, customElement: any) => {
if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
customElements.define(tagName, customElement);
}
};

export * from './attachProps';
export * from './case';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { PropsWithoutRef } from 'react';

import type { StyleReactProps } from '../interfaces';

Expand Down Expand Up @@ -30,7 +30,7 @@ export const mergeRefs = (

export const createForwardRef = <PropType, ElementType>(ReactComponent: any, displayName: string) => {
const forwardRef = (
props: StencilReactExternalProps<PropType, ElementType>,
props: PropsWithoutRef<StencilReactExternalProps<PropType, ElementType>>,
ref: StencilReactForwardedRef<ElementType>
) => {
return <ReactComponent {...props} forwardedRef={ref} />;
Expand Down
40 changes: 28 additions & 12 deletions react-library/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions react-library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kit-data-manager/data-view-web-component-react",
"version": "0.0.15",
"version": "0.0.16",
"description": "React Wrapper for Data View Web Component",
"main": "dist/index.js",
"module": "dist/index.js",
Expand All @@ -23,10 +23,11 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@types/react": "^18.3.1",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@types/node": "^20.12.11",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.4.5"
"typescript": "^5.5.4"
}
}

0 comments on commit 61e9ccd

Please sign in to comment.