@heartlandone/vega-react 1.46.0 → 1.47.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.
package/dist/components.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare const VegaCounterBadge: import("react").ForwardRefExoticComponent
|
|
|
22
22
|
export declare const VegaDatePicker: import("react").ForwardRefExoticComponent<JSX.VegaDatePicker & Omit<import("react").HTMLAttributes<HTMLVegaDatePickerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaDatePickerElement>>;
|
|
23
23
|
export declare const VegaDialog: import("react").ForwardRefExoticComponent<JSX.VegaDialog & Omit<import("react").HTMLAttributes<HTMLVegaDialogElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaDialogElement>>;
|
|
24
24
|
export declare const VegaDropdown: import("react").ForwardRefExoticComponent<JSX.VegaDropdown & Omit<import("react").HTMLAttributes<HTMLVegaDropdownElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaDropdownElement>>;
|
|
25
|
+
export declare const VegaDropdownGroup: import("react").ForwardRefExoticComponent<JSX.VegaDropdownGroup & Omit<import("react").HTMLAttributes<HTMLVegaDropdownGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaDropdownGroupElement>>;
|
|
26
|
+
export declare const VegaDropdownItem: import("react").ForwardRefExoticComponent<JSX.VegaDropdownItem & Omit<import("react").HTMLAttributes<HTMLVegaDropdownItemElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaDropdownItemElement>>;
|
|
25
27
|
export declare const VegaFieldError: import("react").ForwardRefExoticComponent<JSX.VegaFieldError & Omit<import("react").HTMLAttributes<HTMLVegaFieldErrorElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaFieldErrorElement>>;
|
|
26
28
|
export declare const VegaFieldLabel: import("react").ForwardRefExoticComponent<JSX.VegaFieldLabel & Omit<import("react").HTMLAttributes<HTMLVegaFieldLabelElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaFieldLabelElement>>;
|
|
27
29
|
export declare const VegaFlex: import("react").ForwardRefExoticComponent<JSX.VegaFlex & Omit<import("react").HTMLAttributes<HTMLVegaFlexElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaFlexElement>>;
|
|
@@ -55,6 +57,7 @@ export declare const VegaRadioGroup: import("react").ForwardRefExoticComponent<J
|
|
|
55
57
|
export declare const VegaSidenav: import("react").ForwardRefExoticComponent<JSX.VegaSidenav & Omit<import("react").HTMLAttributes<HTMLVegaSidenavElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaSidenavElement>>;
|
|
56
58
|
export declare const VegaSidenavGroup: import("react").ForwardRefExoticComponent<JSX.VegaSidenavGroup & Omit<import("react").HTMLAttributes<HTMLVegaSidenavGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaSidenavGroupElement>>;
|
|
57
59
|
export declare const VegaSidenavLink: import("react").ForwardRefExoticComponent<JSX.VegaSidenavLink & Omit<import("react").HTMLAttributes<HTMLVegaSidenavLinkElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaSidenavLinkElement>>;
|
|
60
|
+
export declare const VegaSlotContainer: import("react").ForwardRefExoticComponent<JSX.VegaSlotContainer & Omit<import("react").HTMLAttributes<HTMLVegaSlotContainerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaSlotContainerElement>>;
|
|
58
61
|
export declare const VegaStepper: import("react").ForwardRefExoticComponent<JSX.VegaStepper & Omit<import("react").HTMLAttributes<HTMLVegaStepperElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaStepperElement>>;
|
|
59
62
|
export declare const VegaTabGroup: import("react").ForwardRefExoticComponent<JSX.VegaTabGroup & Omit<import("react").HTMLAttributes<HTMLVegaTabGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaTabGroupElement>>;
|
|
60
63
|
export declare const VegaTabGroupPanel: import("react").ForwardRefExoticComponent<JSX.VegaTabGroupPanel & Omit<import("react").HTMLAttributes<HTMLVegaTabGroupPanelElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLVegaTabGroupPanelElement>>;
|
package/dist/components.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
/* auto-generated react proxies */
|
|
4
4
|
import { createReactComponent } from './react-component-lib';
|
|
5
5
|
import { defineCustomElements } from '@heartlandone/vega/loader';
|
|
6
|
+
import { setVegaEnv } from '@heartlandone/vega';
|
|
7
|
+
setVegaEnv({ framework: "react" });
|
|
6
8
|
defineCustomElements();
|
|
7
9
|
export const VegaAccordion = /*@__PURE__*/ createReactComponent('vega-accordion');
|
|
8
10
|
export const VegaAppFooter = /*@__PURE__*/ createReactComponent('vega-app-footer');
|
|
@@ -26,6 +28,8 @@ export const VegaCounterBadge = /*@__PURE__*/ createReactComponent('vega-counter
|
|
|
26
28
|
export const VegaDatePicker = /*@__PURE__*/ createReactComponent('vega-date-picker');
|
|
27
29
|
export const VegaDialog = /*@__PURE__*/ createReactComponent('vega-dialog');
|
|
28
30
|
export const VegaDropdown = /*@__PURE__*/ createReactComponent('vega-dropdown');
|
|
31
|
+
export const VegaDropdownGroup = /*@__PURE__*/ createReactComponent('vega-dropdown-group');
|
|
32
|
+
export const VegaDropdownItem = /*@__PURE__*/ createReactComponent('vega-dropdown-item');
|
|
29
33
|
export const VegaFieldError = /*@__PURE__*/ createReactComponent('vega-field-error');
|
|
30
34
|
export const VegaFieldLabel = /*@__PURE__*/ createReactComponent('vega-field-label');
|
|
31
35
|
export const VegaFlex = /*@__PURE__*/ createReactComponent('vega-flex');
|
|
@@ -59,6 +63,7 @@ export const VegaRadioGroup = /*@__PURE__*/ createReactComponent('vega-radio-gro
|
|
|
59
63
|
export const VegaSidenav = /*@__PURE__*/ createReactComponent('vega-sidenav');
|
|
60
64
|
export const VegaSidenavGroup = /*@__PURE__*/ createReactComponent('vega-sidenav-group');
|
|
61
65
|
export const VegaSidenavLink = /*@__PURE__*/ createReactComponent('vega-sidenav-link');
|
|
66
|
+
export const VegaSlotContainer = /*@__PURE__*/ createReactComponent('vega-slot-container');
|
|
62
67
|
export const VegaStepper = /*@__PURE__*/ createReactComponent('vega-stepper');
|
|
63
68
|
export const VegaTabGroup = /*@__PURE__*/ createReactComponent('vega-tab-group');
|
|
64
69
|
export const VegaTabGroupPanel = /*@__PURE__*/ createReactComponent('vega-tab-group-panel');
|
|
@@ -10,6 +10,7 @@ export declare type VegaRef<T> = {
|
|
|
10
10
|
* See more info here: https://medium.com/@teh_builder/ref-objects-inside-useeffect-hooks-eb7c15198780
|
|
11
11
|
* Link issue: https://gethired.atlassian.net/browse/VD-1297
|
|
12
12
|
*
|
|
13
|
+
* @param {() => void} callback - The `callback` parameter is a function that will be called when the `vegaRef` is available.
|
|
13
14
|
* @returns {VegaRef} a callback function of type `VegaRef<T>`.
|
|
14
15
|
*/
|
|
15
|
-
export declare function useVegaRef<T>(): VegaRef<T>;
|
|
16
|
+
export declare function useVegaRef<T>(callback?: (ref: T) => void): VegaRef<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* useVegaRef returns a callback that can be used to store a reference to a DOM node.
|
|
4
4
|
* It will be overridden to type {@link VegaRef} which value is stored by the callback
|
|
@@ -8,13 +8,21 @@ import { useCallback, useState } from "react";
|
|
|
8
8
|
* See more info here: https://medium.com/@teh_builder/ref-objects-inside-useeffect-hooks-eb7c15198780
|
|
9
9
|
* Link issue: https://gethired.atlassian.net/browse/VD-1297
|
|
10
10
|
*
|
|
11
|
+
* @param {() => void} callback - The `callback` parameter is a function that will be called when the `vegaRef` is available.
|
|
11
12
|
* @returns {VegaRef} a callback function of type `VegaRef<T>`.
|
|
12
13
|
*/
|
|
13
|
-
export function useVegaRef() {
|
|
14
|
+
export function useVegaRef(callback) {
|
|
14
15
|
const [refState, setRefState] = useState(undefined);
|
|
15
16
|
const refCallback = useCallback((node) => {
|
|
16
17
|
setRefState(node);
|
|
17
18
|
}, []);
|
|
18
19
|
refCallback.current = refState;
|
|
20
|
+
if (callback) {
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (refState) {
|
|
23
|
+
callback(refState);
|
|
24
|
+
}
|
|
25
|
+
}, [refState]);
|
|
26
|
+
}
|
|
19
27
|
return refCallback;
|
|
20
28
|
}
|
|
@@ -12,6 +12,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React, { createElement } from 'react';
|
|
13
13
|
import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs, } from './utils';
|
|
14
14
|
import { FeatureFlag } from '@heartlandone/vega';
|
|
15
|
+
import { VegaSlotContainer } from "../components";
|
|
16
|
+
const COMPONENT_WITH_SLOT_WRAPPER = new Set(["vega-table-cell"]);
|
|
15
17
|
export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
|
|
16
18
|
if (defineCustomElement !== undefined) {
|
|
17
19
|
defineCustomElement();
|
|
@@ -64,6 +66,17 @@ export const createReactComponent = (tagName, ReactComponentContext, manipulateP
|
|
|
64
66
|
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
65
67
|
}
|
|
66
68
|
const newProps = Object.assign(Object.assign({}, propsToPass), { ref: mergeRefs(forwardedRef, this.setComponentElRef), style });
|
|
69
|
+
/**
|
|
70
|
+
* The function will return the children wrapped in a VegaSlotContainer component if the tagName is
|
|
71
|
+
* in the [COMPONENT_WITH_SLOT_WRAPPER]{@link COMPONENT_WITH_SLOT_WRAPPER}
|
|
72
|
+
*
|
|
73
|
+
* To fix issue https://gethired.atlassian.net/browse/VD-1957
|
|
74
|
+
*
|
|
75
|
+
* @param {React.ReactNode} children - Children nodes of the component
|
|
76
|
+
*/
|
|
77
|
+
const renderChildrenWithSlotWrapper = (children) => {
|
|
78
|
+
return COMPONENT_WITH_SLOT_WRAPPER.has(tagName) ? (React.createElement(VegaSlotContainer, null, children)) : (children);
|
|
79
|
+
};
|
|
67
80
|
/**
|
|
68
81
|
* We use createElement here instead of
|
|
69
82
|
* React.createElement to work around a
|
|
@@ -71,7 +84,8 @@ export const createReactComponent = (tagName, ReactComponentContext, manipulateP
|
|
|
71
84
|
* React.createElement causes all elements to be rendered
|
|
72
85
|
* as <tagname> instead of the actual Web Component.
|
|
73
86
|
*/
|
|
74
|
-
return
|
|
87
|
+
return !FeatureFlag.isEnabled("VEGA_REACT.PREVENT_SSR") ||
|
|
88
|
+
this.state.canRender ? (createElement(tagName, newProps, renderChildrenWithSlotWrapper(children))) : (React.createElement(React.Fragment, null));
|
|
75
89
|
}
|
|
76
90
|
static get displayName() {
|
|
77
91
|
return displayName;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heartlandone/vega-react",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.47.0",
|
|
5
5
|
"description": "React specific wrapper for @heartlandone/vega",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"stencil-postbuild": "node ./src/scripts/stencil-post-build-script.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"typescript": "^4.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@heartlandone/vega": "1.
|
|
42
|
+
"@heartlandone/vega": "1.47.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": ">=16.7.0",
|