@xplortech/apollo-react 0.5.3 → 1.0.0-beta.10
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/components.d.ts +5 -0
- package/dist/components.js +5 -0
- package/dist/components.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/react-component-lib/createComponent.d.ts +1 -1
- package/dist/react-component-lib/createComponent.js +24 -8
- package/dist/react-component-lib/createComponent.js.map +1 -1
- package/dist/react-component-lib/createOverlayComponent.d.ts +5 -4
- package/dist/react-component-lib/createOverlayComponent.js +29 -10
- package/dist/react-component-lib/createOverlayComponent.js.map +1 -1
- package/dist/react-component-lib/utils/attachProps.d.ts +1 -1
- package/dist/react-component-lib/utils/attachProps.js +14 -12
- package/dist/react-component-lib/utils/attachProps.js.map +1 -1
- package/dist/react-component-lib/utils/case.js.map +1 -1
- package/dist/react-component-lib/utils/index.d.ts +4 -1
- package/dist/react-component-lib/utils/index.js +15 -4
- package/dist/react-component-lib/utils/index.js.map +1 -1
- package/licence +21 -0
- package/package.json +7 -6
package/dist/components.d.ts
CHANGED
|
@@ -12,8 +12,13 @@ export declare const XplCheckbox: import("react").ForwardRefExoticComponent<JSX.
|
|
|
12
12
|
export declare const XplChoicelist: import("react").ForwardRefExoticComponent<JSX.XplChoicelist & Omit<import("react").HTMLAttributes<HTMLXplChoicelistElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplChoicelistElement>>;
|
|
13
13
|
export declare const XplContentArea: import("react").ForwardRefExoticComponent<JSX.XplContentArea & Omit<import("react").HTMLAttributes<HTMLXplContentAreaElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplContentAreaElement>>;
|
|
14
14
|
export declare const XplDivider: import("react").ForwardRefExoticComponent<JSX.XplDivider & Omit<import("react").HTMLAttributes<HTMLXplDividerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplDividerElement>>;
|
|
15
|
+
export declare const XplDropdown: import("react").ForwardRefExoticComponent<JSX.XplDropdown & Omit<import("react").HTMLAttributes<HTMLXplDropdownElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplDropdownElement>>;
|
|
16
|
+
export declare const XplDropdownGroup: import("react").ForwardRefExoticComponent<JSX.XplDropdownGroup & Omit<import("react").HTMLAttributes<HTMLXplDropdownGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplDropdownGroupElement>>;
|
|
17
|
+
export declare const XplDropdownHeading: import("react").ForwardRefExoticComponent<JSX.XplDropdownHeading & Omit<import("react").HTMLAttributes<HTMLXplDropdownHeadingElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplDropdownHeadingElement>>;
|
|
18
|
+
export declare const XplDropdownOption: import("react").ForwardRefExoticComponent<JSX.XplDropdownOption & Omit<import("react").HTMLAttributes<HTMLXplDropdownOptionElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplDropdownOptionElement>>;
|
|
15
19
|
export declare const XplGrid: import("react").ForwardRefExoticComponent<JSX.XplGrid & Omit<import("react").HTMLAttributes<HTMLXplGridElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplGridElement>>;
|
|
16
20
|
export declare const XplGridItem: import("react").ForwardRefExoticComponent<JSX.XplGridItem & Omit<import("react").HTMLAttributes<HTMLXplGridItemElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplGridItemElement>>;
|
|
21
|
+
export declare const XplIcon: import("react").ForwardRefExoticComponent<JSX.XplIcon & Omit<import("react").HTMLAttributes<HTMLXplIconElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplIconElement>>;
|
|
17
22
|
export declare const XplInput: import("react").ForwardRefExoticComponent<JSX.XplInput & Omit<import("react").HTMLAttributes<HTMLXplInputElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplInputElement>>;
|
|
18
23
|
export declare const XplList: import("react").ForwardRefExoticComponent<JSX.XplList & Omit<import("react").HTMLAttributes<HTMLXplListElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplListElement>>;
|
|
19
24
|
export declare const XplMainNav: import("react").ForwardRefExoticComponent<JSX.XplMainNav & Omit<import("react").HTMLAttributes<HTMLXplMainNavElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLXplMainNavElement>>;
|
package/dist/components.js
CHANGED
|
@@ -16,8 +16,13 @@ export const XplCheckbox = /*@__PURE__*/ createReactComponent('xpl-checkbox');
|
|
|
16
16
|
export const XplChoicelist = /*@__PURE__*/ createReactComponent('xpl-choicelist');
|
|
17
17
|
export const XplContentArea = /*@__PURE__*/ createReactComponent('xpl-content-area');
|
|
18
18
|
export const XplDivider = /*@__PURE__*/ createReactComponent('xpl-divider');
|
|
19
|
+
export const XplDropdown = /*@__PURE__*/ createReactComponent('xpl-dropdown');
|
|
20
|
+
export const XplDropdownGroup = /*@__PURE__*/ createReactComponent('xpl-dropdown-group');
|
|
21
|
+
export const XplDropdownHeading = /*@__PURE__*/ createReactComponent('xpl-dropdown-heading');
|
|
22
|
+
export const XplDropdownOption = /*@__PURE__*/ createReactComponent('xpl-dropdown-option');
|
|
19
23
|
export const XplGrid = /*@__PURE__*/ createReactComponent('xpl-grid');
|
|
20
24
|
export const XplGridItem = /*@__PURE__*/ createReactComponent('xpl-grid-item');
|
|
25
|
+
export const XplIcon = /*@__PURE__*/ createReactComponent('xpl-icon');
|
|
21
26
|
export const XplInput = /*@__PURE__*/ createReactComponent('xpl-input');
|
|
22
27
|
export const XplList = /*@__PURE__*/ createReactComponent('xpl-list');
|
|
23
28
|
export const XplMainNav = /*@__PURE__*/ createReactComponent('xpl-main-nav');
|
package/dist/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB,kCAAkC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAI7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,oBAAoB,EAAE,CAAC;AACvB,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAA,oBAAoB,CAA0D,uBAAuB,CAAC,CAAC;AACvJ,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAA,oBAAoB,CAAsC,YAAY,CAAC,CAAC;AAC9G,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAA,oBAAoB,CAA0C,cAAc,CAAC,CAAC;AACtH,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAA,oBAAoB,CAAoC,WAAW,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAA,oBAAoB,CAAsD,qBAAqB,CAAC,CAAC;AAC/I,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAA,oBAAoB,CAAgD,iBAAiB,CAAC,CAAC;AAClI,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAA,oBAAoB,CAAsC,YAAY,CAAC,CAAC;AAC9G,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAA,oBAAoB,CAA4C,gBAAgB,CAAC,CAAC;AAC3H,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAA,oBAAoB,CAA0C,cAAc,CAAC,CAAC;AACtH,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAA,oBAAoB,CAA8C,gBAAgB,CAAC,CAAC;AAC9H,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAA,oBAAoB,CAA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CAAC;AACvI,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAA,oBAAoB,CAAsC,YAAY,CAAC,CAAC;AAC9G,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAA,oBAAoB,CAAoC,WAAW,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAA,oBAAoB,CAAgC,SAAS,CAAC,CAAC;AAClG,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAA,oBAAoB,CAAsC,YAAY,CAAC,CAAC;AAC9G,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAA,oBAAoB,CAA8C,iBAAiB,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -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) => 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>, manipulatePropsFunction?: (originalProps: StencilReactInternalProps<ElementType>, propsToPass: any) => ExpandedPropsTypes, defineCustomElement?: () => void) => React.ForwardRefExoticComponent<React.PropsWithoutRef<import("./utils").StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
|
|
10
10
|
export {};
|
|
@@ -9,9 +9,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { attachProps, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs
|
|
14
|
-
export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction) => {
|
|
12
|
+
import React, { createElement } from 'react';
|
|
13
|
+
import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs } from './utils';
|
|
14
|
+
export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
|
|
15
|
+
if (defineCustomElement !== undefined) {
|
|
16
|
+
defineCustomElement();
|
|
17
|
+
}
|
|
15
18
|
const displayName = dashToPascalCase(tagName);
|
|
16
19
|
const ReactComponent = class extends React.Component {
|
|
17
20
|
constructor(props) {
|
|
@@ -29,22 +32,35 @@ export const createReactComponent = (tagName, ReactComponentContext, manipulateP
|
|
|
29
32
|
render() {
|
|
30
33
|
const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
|
|
31
34
|
let propsToPass = Object.keys(cProps).reduce((acc, name) => {
|
|
35
|
+
const value = cProps[name];
|
|
32
36
|
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
33
37
|
const eventName = name.substring(2).toLowerCase();
|
|
34
|
-
if (typeof document !== 'undefined' && isCoveredByReact(eventName
|
|
35
|
-
acc[name] =
|
|
38
|
+
if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {
|
|
39
|
+
acc[name] = value;
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
else {
|
|
39
|
-
|
|
43
|
+
// we should only render strings, booleans, and numbers as attrs in html.
|
|
44
|
+
// objects, functions, arrays etc get synced via properties on mount.
|
|
45
|
+
const type = typeof value;
|
|
46
|
+
if (type === 'string' || type === 'boolean' || type === 'number') {
|
|
47
|
+
acc[camelToDashCase(name)] = value;
|
|
48
|
+
}
|
|
40
49
|
}
|
|
41
50
|
return acc;
|
|
42
51
|
}, {});
|
|
43
52
|
if (manipulatePropsFunction) {
|
|
44
53
|
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
45
54
|
}
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
const newProps = Object.assign(Object.assign({}, propsToPass), { ref: mergeRefs(forwardedRef, this.setComponentElRef), style });
|
|
56
|
+
/**
|
|
57
|
+
* We use createElement here instead of
|
|
58
|
+
* React.createElement to work around a
|
|
59
|
+
* bug in Vite (https://github.com/vitejs/vite/issues/6104).
|
|
60
|
+
* React.createElement causes all elements to be rendered
|
|
61
|
+
* as <tagname> instead of the actual Web Component.
|
|
62
|
+
*/
|
|
63
|
+
return createElement(tagName, newProps, children);
|
|
48
64
|
}
|
|
49
65
|
static get displayName() {
|
|
50
66
|
return displayName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponent.js","sourceRoot":"","sources":["../../src/react-component-lib/createComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"createComponent.js","sourceRoot":"","sources":["../../src/react-component-lib/createComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,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,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;oBAClD,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,gBAAgB,CAAC,SAAS,CAAC,EAAE;wBAClE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;qBACnB;iBACF;qBAAM;oBACL,yEAAyE;oBACzE,qEAAqE;oBACrE,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC;oBAE1B,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,EAAE;wBAChE,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;qBACpC;iBACF;gBACD,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAAwB,CAAC,CAAC;YAE7B,IAAI,uBAAuB,EAAE;gBAC3B,WAAW,GAAG,uBAAuB,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;aAChE;YAED,MAAM,QAAQ,mCACT,WAAW,KACd,GAAG,EAAE,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,EACpD,KAAK,GACN,CAAC;YAEF;;;;;;eAMG;YACH,OAAO,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,KAAK,WAAW;YACpB,OAAO,WAAW,CAAC;QACrB,CAAC;KACF,CAAC;IAEF,iGAAiG;IACjG,IAAI,qBAAqB,EAAE;QACzB,cAAc,CAAC,WAAW,GAAG,qBAAqB,CAAC;KACpD;IAED,OAAO,gBAAgB,CAAwB,cAAc,EAAE,WAAW,CAAC,CAAC;AAC9E,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { OverlayEventDetail } from './interfaces';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import { OverlayEventDetail } from './interfaces';
|
|
3
|
+
import { StencilReactForwardedRef } from './utils';
|
|
3
4
|
interface OverlayElement extends HTMLElement {
|
|
4
5
|
present: () => Promise<void>;
|
|
5
6
|
dismiss: (data?: any, role?: string | undefined) => Promise<boolean>;
|
|
@@ -12,9 +13,9 @@ export interface ReactOverlayProps {
|
|
|
12
13
|
onWillDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
13
14
|
onWillPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
14
15
|
}
|
|
15
|
-
export declare const createOverlayComponent: <OverlayComponent extends object, OverlayType extends OverlayElement>(
|
|
16
|
+
export declare const createOverlayComponent: <OverlayComponent extends object, OverlayType extends OverlayElement>(tagName: string, controller: {
|
|
16
17
|
create: (options: any) => Promise<OverlayType>;
|
|
17
|
-
}) => React.ForwardRefExoticComponent<React.PropsWithoutRef<OverlayComponent & ReactOverlayProps & {
|
|
18
|
-
forwardedRef?:
|
|
18
|
+
}, customElement?: any) => React.ForwardRefExoticComponent<React.PropsWithoutRef<OverlayComponent & ReactOverlayProps & {
|
|
19
|
+
forwardedRef?: StencilReactForwardedRef<OverlayType>;
|
|
19
20
|
}> & React.RefAttributes<OverlayType>>;
|
|
20
21
|
export {};
|
|
@@ -12,16 +12,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import ReactDOM from 'react-dom';
|
|
15
|
-
import { attachProps } from './utils';
|
|
16
|
-
export const createOverlayComponent = (
|
|
15
|
+
import { attachProps, dashToPascalCase, defineCustomElement, setRef } from './utils';
|
|
16
|
+
export const createOverlayComponent = (tagName, controller, customElement) => {
|
|
17
|
+
defineCustomElement(tagName, customElement);
|
|
18
|
+
const displayName = dashToPascalCase(tagName);
|
|
17
19
|
const didDismissEventName = `on${displayName}DidDismiss`;
|
|
18
20
|
const didPresentEventName = `on${displayName}DidPresent`;
|
|
19
21
|
const willDismissEventName = `on${displayName}WillDismiss`;
|
|
20
22
|
const willPresentEventName = `on${displayName}WillPresent`;
|
|
23
|
+
let isDismissing = false;
|
|
21
24
|
class Overlay extends React.Component {
|
|
22
25
|
constructor(props) {
|
|
23
26
|
super(props);
|
|
24
|
-
|
|
27
|
+
if (typeof document !== 'undefined') {
|
|
28
|
+
this.el = document.createElement('div');
|
|
29
|
+
}
|
|
25
30
|
this.handleDismiss = this.handleDismiss.bind(this);
|
|
26
31
|
}
|
|
27
32
|
static get displayName() {
|
|
@@ -41,9 +46,14 @@ export const createOverlayComponent = (displayName, controller) => {
|
|
|
41
46
|
if (this.props.onDidDismiss) {
|
|
42
47
|
this.props.onDidDismiss(event);
|
|
43
48
|
}
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
setRef(this.props.forwardedRef, null);
|
|
50
|
+
}
|
|
51
|
+
shouldComponentUpdate(nextProps) {
|
|
52
|
+
// Check if the overlay component is about to dismiss
|
|
53
|
+
if (this.overlay && nextProps.isOpen !== this.props.isOpen && nextProps.isOpen === false) {
|
|
54
|
+
isDismissing = true;
|
|
46
55
|
}
|
|
56
|
+
return true;
|
|
47
57
|
}
|
|
48
58
|
async componentDidUpdate(prevProps) {
|
|
49
59
|
if (this.overlay) {
|
|
@@ -54,24 +64,33 @@ export const createOverlayComponent = (displayName, controller) => {
|
|
|
54
64
|
}
|
|
55
65
|
if (this.overlay && prevProps.isOpen !== this.props.isOpen && this.props.isOpen === false) {
|
|
56
66
|
await this.overlay.dismiss();
|
|
67
|
+
isDismissing = false;
|
|
68
|
+
/**
|
|
69
|
+
* Now that the overlay is dismissed
|
|
70
|
+
* we need to render again so that any
|
|
71
|
+
* inner components will be unmounted
|
|
72
|
+
*/
|
|
73
|
+
this.forceUpdate();
|
|
57
74
|
}
|
|
58
75
|
}
|
|
59
76
|
async present(prevProps) {
|
|
60
77
|
const _a = this.props, { children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent } = _a, cProps = __rest(_a, ["children", "isOpen", "onDidDismiss", "onDidPresent", "onWillDismiss", "onWillPresent"]);
|
|
61
78
|
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) });
|
|
62
79
|
this.overlay = await controller.create(Object.assign(Object.assign({}, elementProps), { component: this.el, componentProps: {} }));
|
|
63
|
-
|
|
64
|
-
this.props.forwardedRef.current = this.overlay;
|
|
65
|
-
}
|
|
80
|
+
setRef(this.props.forwardedRef, this.overlay);
|
|
66
81
|
attachProps(this.overlay, elementProps, prevProps);
|
|
67
82
|
await this.overlay.present();
|
|
68
83
|
}
|
|
69
84
|
render() {
|
|
70
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Continue to render the component even when
|
|
87
|
+
* overlay is dismissing otherwise component
|
|
88
|
+
* will be hidden before animation is done.
|
|
89
|
+
*/
|
|
90
|
+
return ReactDOM.createPortal(this.props.isOpen || isDismissing ? this.props.children : null, this.el);
|
|
71
91
|
}
|
|
72
92
|
}
|
|
73
93
|
return React.forwardRef((props, ref) => {
|
|
74
|
-
// @ts-ignore
|
|
75
94
|
return _jsx(Overlay, Object.assign({}, props, { forwardedRef: ref }));
|
|
76
95
|
});
|
|
77
96
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOverlayComponent.js","sourceRoot":"","sources":["../../src/react-component-lib/createOverlayComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"createOverlayComponent.js","sourceRoot":"","sources":["../../src/react-component-lib/createOverlayComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AAGjC,OAAO,EAA4B,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,SAAS,CAA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AC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@ export declare const getClassName: (classList: DOMTokenList, newProps: any, oldP
|
|
|
4
4
|
* Checks if an event is supported in the current execution environment.
|
|
5
5
|
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
6
6
|
*/
|
|
7
|
-
export declare const isCoveredByReact: (eventNameSuffix: string
|
|
7
|
+
export declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
|
|
8
8
|
export declare const syncEvent: (node: Element & {
|
|
9
9
|
__events?: {
|
|
10
10
|
[key: string]: (e: Event) => any;
|
|
@@ -19,7 +19,7 @@ export const attachProps = (node, newProps, oldProps = {}) => {
|
|
|
19
19
|
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
20
20
|
const eventName = name.substring(2);
|
|
21
21
|
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
22
|
-
if (
|
|
22
|
+
if (!isCoveredByReact(eventNameLc)) {
|
|
23
23
|
syncEvent(node, eventNameLc, newProps[name]);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -29,9 +29,6 @@ export const attachProps = (node, newProps, oldProps = {}) => {
|
|
|
29
29
|
if (propType === 'string') {
|
|
30
30
|
node.setAttribute(camelToDashCase(name), newProps[name]);
|
|
31
31
|
}
|
|
32
|
-
else {
|
|
33
|
-
node[name] = newProps[name];
|
|
34
|
-
}
|
|
35
32
|
}
|
|
36
33
|
});
|
|
37
34
|
}
|
|
@@ -64,15 +61,20 @@ export const getClassName = (classList, newProps, oldProps) => {
|
|
|
64
61
|
* Checks if an event is supported in the current execution environment.
|
|
65
62
|
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
66
63
|
*/
|
|
67
|
-
export const isCoveredByReact = (eventNameSuffix
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
isSupported =
|
|
64
|
+
export const isCoveredByReact = (eventNameSuffix) => {
|
|
65
|
+
if (typeof document === 'undefined') {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const eventName = 'on' + eventNameSuffix;
|
|
70
|
+
let isSupported = eventName in document;
|
|
71
|
+
if (!isSupported) {
|
|
72
|
+
const element = document.createElement('div');
|
|
73
|
+
element.setAttribute(eventName, 'return;');
|
|
74
|
+
isSupported = typeof element[eventName] === 'function';
|
|
75
|
+
}
|
|
76
|
+
return isSupported;
|
|
74
77
|
}
|
|
75
|
-
return isSupported;
|
|
76
78
|
};
|
|
77
79
|
export const syncEvent = (node, eventName, newEventHandler) => {
|
|
78
80
|
const eventStore = node.__events || (node.__events = {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachProps.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/attachProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAiB,EAAE,QAAa,EAAE,WAAgB,EAAE,EAAE,EAAE;IAClF,6GAA6G;IAC7G,IAAI,IAAI,YAAY,OAAO,EAAE;QAC3B,iDAAiD;QACjD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnE,IAAI,SAAS,KAAK,EAAE,EAAE;YACpB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;SAC5B;QAED,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrC,IACE,IAAI,KAAK,UAAU;gBACnB,IAAI,KAAK,OAAO;gBAChB,IAAI,KAAK,KAAK;gBACd,IAAI,KAAK,OAAO;gBAChB,IAAI,KAAK,WAAW;gBACpB,IAAI,KAAK,cAAc,EACvB;gBACA,OAAO;aACR;YACD,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KA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+
{"version":3,"file":"case.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/case.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAE,EAAE,CAC9C,GAAG;KACA,WAAW,EAAE;KACb,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACpE,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { StyleReactProps } from '../interfaces';
|
|
3
3
|
export type StencilReactExternalProps<PropType, ElementType> = PropType & Omit<React.HTMLAttributes<ElementType>, 'style'> & StyleReactProps;
|
|
4
|
-
export
|
|
4
|
+
export type StencilReactForwardedRef<T> = ((instance: T | null) => void) | React.MutableRefObject<T | null> | null;
|
|
5
|
+
export declare const setRef: (ref: StencilReactForwardedRef<any> | React.Ref<any> | undefined, value: any) => void;
|
|
6
|
+
export declare const mergeRefs: (...refs: (StencilReactForwardedRef<any> | React.Ref<any> | undefined)[]) => React.RefCallback<any>;
|
|
5
7
|
export declare const createForwardRef: <PropType, ElementType>(ReactComponent: any, displayName: string) => React.ForwardRefExoticComponent<React.PropsWithoutRef<StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
|
|
8
|
+
export declare const defineCustomElement: (tagName: string, customElement: any) => void;
|
|
6
9
|
export * from './attachProps';
|
|
7
10
|
export * from './case';
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
export const mergeRefs = (...refs) => (value) => refs.forEach((ref) => {
|
|
3
|
+
export const setRef = (ref, value) => {
|
|
5
4
|
if (typeof ref === 'function') {
|
|
6
5
|
ref(value);
|
|
7
6
|
}
|
|
8
7
|
else if (ref != null) {
|
|
9
|
-
//
|
|
8
|
+
// Cast as a MutableRef so we can assign current
|
|
10
9
|
ref.current = value;
|
|
11
10
|
}
|
|
12
|
-
}
|
|
11
|
+
};
|
|
12
|
+
export const mergeRefs = (...refs) => {
|
|
13
|
+
return (value) => {
|
|
14
|
+
refs.forEach((ref) => {
|
|
15
|
+
setRef(ref, value);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
};
|
|
13
19
|
export const createForwardRef = (ReactComponent, displayName) => {
|
|
14
20
|
const forwardRef = (props, ref) => {
|
|
15
21
|
return _jsx(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
|
|
@@ -17,6 +23,11 @@ export const createForwardRef = (ReactComponent, displayName) => {
|
|
|
17
23
|
forwardRef.displayName = displayName;
|
|
18
24
|
return React.forwardRef(forwardRef);
|
|
19
25
|
};
|
|
26
|
+
export const defineCustomElement = (tagName, customElement) => {
|
|
27
|
+
if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
|
|
28
|
+
customElements.define(tagName, customElement);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
20
31
|
export * from './attachProps';
|
|
21
32
|
export * from './case';
|
|
22
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/index.tsx"],"names":[],"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AAC9B,cAAc,QAAQ,CAAC"}
|
package/licence
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, Xplor XT1, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xplortech/apollo-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,16 +21,17 @@
|
|
|
21
21
|
"@types/react-dom": "18.0.11",
|
|
22
22
|
"jest": "^29.4.3",
|
|
23
23
|
"np": "^7.6.3",
|
|
24
|
-
"react": "^
|
|
25
|
-
"react-dom": "^
|
|
24
|
+
"react": "^18.2.0",
|
|
25
|
+
"react-dom": "^18.2.0",
|
|
26
26
|
"typescript": "^4.9.5"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@xplortech/apollo-core": "^0.
|
|
29
|
+
"@xplortech/apollo-core": "^1.0.0-beta.10",
|
|
30
|
+
"@xplortech/apollo-icons": "^0.1.0-alpha.0"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"react": "^
|
|
33
|
-
"react-dom": "^
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"react-dom": "^18.2.0"
|
|
34
35
|
},
|
|
35
36
|
"jest": {
|
|
36
37
|
"preset": "ts-jest",
|