@yakad/ui 1.3.104 → 1.3.106
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,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export interface InteractiveSurfaceProps
|
|
2
|
+
export interface InteractiveSurfaceProps {
|
|
3
3
|
onRightClick?: (e: MouseEvent) => void;
|
|
4
4
|
onTap?: (e: TouchEvent) => void;
|
|
5
5
|
onDoubleTap?: (e: TouchEvent) => void;
|
|
@@ -18,6 +18,6 @@ export interface InteractiveSurfaceProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
18
18
|
onHidden?: () => void;
|
|
19
19
|
onMouseHoverStart?: (e: MouseEvent) => void;
|
|
20
20
|
onMouseHoverLeave?: (e: MouseEvent) => void;
|
|
21
|
-
children?: React.
|
|
21
|
+
children?: React.ReactElement;
|
|
22
22
|
}
|
|
23
|
-
export declare const InteractiveSurface: import("react").ForwardRefExoticComponent<InteractiveSurfaceProps & import("react").RefAttributes<
|
|
23
|
+
export declare const InteractiveSurface: import("react").ForwardRefExoticComponent<InteractiveSurfaceProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -10,9 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
import {
|
|
14
|
-
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
13
|
+
import { mergeRefs } from "@yakad/lib";
|
|
14
|
+
import { cloneElement, forwardRef, isValidElement, useEffect, useImperativeHandle, useRef, } from "react";
|
|
15
15
|
export const InteractiveSurface = forwardRef((_a, forwardedRef) => {
|
|
16
|
+
var _b;
|
|
16
17
|
var { children, onRightClick, onTap, onDoubleTap, onOutsideClick, onSwipeLeft, onSwipeRight, onSwipeUp, onSwipeDown, onPinchIn, onPinchOut, onRotate, onScrollStart, onScrollStop, onResize, onVisibile, onHidden, onMouseHoverStart, onMouseHoverLeave } = _a, restProps = __rest(_a, ["children", "onRightClick", "onTap", "onDoubleTap", "onOutsideClick", "onSwipeLeft", "onSwipeRight", "onSwipeUp", "onSwipeDown", "onPinchIn", "onPinchOut", "onRotate", "onScrollStart", "onScrollStop", "onResize", "onVisibile", "onHidden", "onMouseHoverStart", "onMouseHoverLeave"]);
|
|
17
18
|
const localRef = useRef(null);
|
|
18
19
|
// Let the parent access our DOM node
|
|
@@ -211,5 +212,7 @@ export const InteractiveSurface = forwardRef((_a, forwardedRef) => {
|
|
|
211
212
|
onMouseHoverStart,
|
|
212
213
|
onMouseHoverLeave,
|
|
213
214
|
]);
|
|
214
|
-
|
|
215
|
+
if (!isValidElement(children))
|
|
216
|
+
return null;
|
|
217
|
+
return cloneElement(children, Object.assign(Object.assign({}, restProps), { ref: mergeRefs(localRef, forwardedRef, (_b = children.props) === null || _b === void 0 ? void 0 : _b.ref) }));
|
|
215
218
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yakad/ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.106",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Natiq",
|
|
6
6
|
"description": "UI components for NextJS/React",
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
"typecheck": "tsc --noEmit",
|
|
29
29
|
"lint": "eslint src/**/*.{ts,tsx}",
|
|
30
30
|
"test": "echo \"No tests specified\" && exit 0",
|
|
31
|
-
"prepublishOnly": "npm run test && npm run build && npm run typecheck
|
|
31
|
+
"prepublishOnly": "npm run test && npm run build && npm run typecheck"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@yakad/lib": "1.0.22",
|
|
34
35
|
"@yakad/symbols": "1.0.25",
|
|
35
36
|
"classnames": "2.5.1"
|
|
36
37
|
},
|