@prijsvrijtechsupport/ui 0.0.31 → 0.0.32
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/topHeaderMenu/index.d.ts +8 -0
- package/dist/index.cjs +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,5 +5,13 @@ interface TopHeaderMenuProps {
|
|
|
5
5
|
menuItems?: React.ReactNode[];
|
|
6
6
|
onHeartClick?: () => void;
|
|
7
7
|
}
|
|
8
|
+
interface FlyingIcon {
|
|
9
|
+
id: number;
|
|
10
|
+
startX: number;
|
|
11
|
+
startY: number;
|
|
12
|
+
endX: number;
|
|
13
|
+
endY: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const createTimeoutCallback: (iconId: number, setFlyingIcons: React.Dispatch<React.SetStateAction<FlyingIcon[]>>, onHeartClick?: () => void) => () => void;
|
|
8
16
|
export declare const TopHeaderMenu: ({ className, menuItems, onHeartClick, ...props }: TopHeaderMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
17
|
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -4362,6 +4362,14 @@ const Toggle = TransportToggle;
|
|
|
4362
4362
|
|
|
4363
4363
|
//#endregion
|
|
4364
4364
|
//#region src/components/topHeaderMenu/index.tsx
|
|
4365
|
+
const createTimeoutCallback = (iconId, setFlyingIcons, onHeartClick) => {
|
|
4366
|
+
return () => {
|
|
4367
|
+
setFlyingIcons((prev) => prev.filter((icon) => icon.id !== iconId));
|
|
4368
|
+
if (onHeartClick) {
|
|
4369
|
+
onHeartClick();
|
|
4370
|
+
}
|
|
4371
|
+
};
|
|
4372
|
+
};
|
|
4365
4373
|
const TopHeaderMenu = ({ className, menuItems, onHeartClick,...props }) => {
|
|
4366
4374
|
const [flyingIcons, setFlyingIcons] = (0, react.useState)([]);
|
|
4367
4375
|
const iconIdCounter = (0, react.useRef)(0);
|
|
@@ -4384,12 +4392,8 @@ const TopHeaderMenu = ({ className, menuItems, onHeartClick,...props }) => {
|
|
|
4384
4392
|
endY: targetRect.top + targetRect.height / 2
|
|
4385
4393
|
};
|
|
4386
4394
|
setFlyingIcons((prev) => [...prev, newIcon]);
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
if (onHeartClick) {
|
|
4390
|
-
onHeartClick();
|
|
4391
|
-
}
|
|
4392
|
-
}, 1e3);
|
|
4395
|
+
const timeoutCallback = createTimeoutCallback(newIcon.id, setFlyingIcons, onHeartClick);
|
|
4396
|
+
setTimeout(timeoutCallback, 1e3);
|
|
4393
4397
|
};
|
|
4394
4398
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4395
4399
|
"data-component": "top-header-menu",
|