@luminescent/ui-qwik 6.1.2 → 6.2.1

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.
@@ -685,8 +685,18 @@ const Menu = qwik.component$(({ size, ...props }) => {
685
685
  ]
686
686
  });
687
687
  });
688
- const Nav = qwik.component$(({ fixed, floating, noblur, nohamburger, colorClass = "lum-bg-lum-card-bg", ...props }) => {
688
+ const Nav = qwik.component$(({ fixed, floating, noblur, nohamburger, nodismiss, colorClass = "lum-bg-lum-card-bg", ...props }) => {
689
689
  const menu = qwik.useSignal(false);
690
+ qwik.useTask$(({ track }) => {
691
+ track(() => menu.value);
692
+ if (menu.value && !nodismiss) {
693
+ const onClick = () => {
694
+ menu.value = false;
695
+ window.removeEventListener("click", onClick);
696
+ };
697
+ window.addEventListener("click", onClick);
698
+ }
699
+ });
690
700
  return /* @__PURE__ */ jsxRuntime.jsxs("nav", {
691
701
  ...props,
692
702
  class: {
@@ -1073,12 +1083,17 @@ const Toggle = qwik.component$(({ checkbox, round, ...props }) => {
1073
1083
  });
1074
1084
  const Hoverable = {
1075
1085
  onMouseMove$: (e, el) => {
1076
- const mousex = e.clientX - el.getBoundingClientRect().left;
1077
- const mousey = e.clientY - el.getBoundingClientRect().top;
1078
- el.style.transform = `perspective(500px) rotateX(${(mousey / el.clientHeight - 0.5) * 10}deg) rotateY(${(mousex / el.clientWidth - 0.5) * 10}deg)`;
1086
+ const rect = el.getBoundingClientRect();
1087
+ const mouseX = e.clientX - rect.left;
1088
+ const mouseY = e.clientY - rect.top;
1089
+ const rotateX = (mouseY / rect.height - 0.5) * -10;
1090
+ const rotateY = (mouseX / rect.width - 0.5) * 10;
1091
+ el.style.transition = "transform 0.05s ease-out";
1092
+ el.style.transform = `perspective(500px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
1079
1093
  },
1080
- onMouseLeave$: (e, el) => {
1081
- el.style.transform = "rotateX(0deg) rotateY(0deg)";
1094
+ onMouseLeave$: (_e, el) => {
1095
+ el.style.transition = "transform 0.3s ease-out";
1096
+ el.style.transform = "perspective(500px) rotateX(0deg) rotateY(0deg)";
1082
1097
  }
1083
1098
  };
1084
1099
  const LogoBirdflop = qwik.component$(({ confused, fillGradient, size, ...props }) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
2
- import { component$, Slot, useStore, $, useSignal, useStyles$ } from "@builder.io/qwik";
2
+ import { component$, Slot, useStore, $, useSignal, useTask$, useStyles$ } from "@builder.io/qwik";
3
3
  const Link = component$(({ size, ...props }) => {
4
4
  return /* @__PURE__ */ jsxs("svg", {
5
5
  xmlns: "http://www.w3.org/2000/svg",
@@ -683,8 +683,18 @@ const Menu = component$(({ size, ...props }) => {
683
683
  ]
684
684
  });
685
685
  });
686
- const Nav = component$(({ fixed, floating, noblur, nohamburger, colorClass = "lum-bg-lum-card-bg", ...props }) => {
686
+ const Nav = component$(({ fixed, floating, noblur, nohamburger, nodismiss, colorClass = "lum-bg-lum-card-bg", ...props }) => {
687
687
  const menu = useSignal(false);
688
+ useTask$(({ track }) => {
689
+ track(() => menu.value);
690
+ if (menu.value && !nodismiss) {
691
+ const onClick = () => {
692
+ menu.value = false;
693
+ window.removeEventListener("click", onClick);
694
+ };
695
+ window.addEventListener("click", onClick);
696
+ }
697
+ });
688
698
  return /* @__PURE__ */ jsxs("nav", {
689
699
  ...props,
690
700
  class: {
@@ -1071,12 +1081,17 @@ const Toggle = component$(({ checkbox, round, ...props }) => {
1071
1081
  });
1072
1082
  const Hoverable = {
1073
1083
  onMouseMove$: (e, el) => {
1074
- const mousex = e.clientX - el.getBoundingClientRect().left;
1075
- const mousey = e.clientY - el.getBoundingClientRect().top;
1076
- el.style.transform = `perspective(500px) rotateX(${(mousey / el.clientHeight - 0.5) * 10}deg) rotateY(${(mousex / el.clientWidth - 0.5) * 10}deg)`;
1084
+ const rect = el.getBoundingClientRect();
1085
+ const mouseX = e.clientX - rect.left;
1086
+ const mouseY = e.clientY - rect.top;
1087
+ const rotateX = (mouseY / rect.height - 0.5) * -10;
1088
+ const rotateY = (mouseX / rect.width - 0.5) * 10;
1089
+ el.style.transition = "transform 0.05s ease-out";
1090
+ el.style.transform = `perspective(500px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;
1077
1091
  },
1078
- onMouseLeave$: (e, el) => {
1079
- el.style.transform = "rotateX(0deg) rotateY(0deg)";
1092
+ onMouseLeave$: (_e, el) => {
1093
+ el.style.transition = "transform 0.3s ease-out";
1094
+ el.style.transform = "perspective(500px) rotateX(0deg) rotateY(0deg)";
1080
1095
  }
1081
1096
  };
1082
1097
  const LogoBirdflop = component$(({ confused, fillGradient, size, ...props }) => {
@@ -7,6 +7,7 @@ interface NavProps extends Omit<PropsOf<'nav'>, 'class'> {
7
7
  floating?: boolean;
8
8
  noblur?: boolean;
9
9
  nohamburger?: boolean;
10
+ nodismiss?: boolean;
10
11
  colorClass?: string;
11
12
  }
12
13
  export declare const Nav: import("@builder.io/qwik").Component<NavProps>;
@@ -1,4 +1,4 @@
1
1
  export declare const Hoverable: {
2
2
  readonly onMouseMove$: (e: MouseEvent, el: HTMLElement) => void;
3
- readonly onMouseLeave$: (e: MouseEvent, el: HTMLElement) => void;
3
+ readonly onMouseLeave$: (_e: MouseEvent, el: HTMLElement) => void;
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luminescent/ui-qwik",
3
- "version": "6.1.2",
3
+ "version": "6.2.1",
4
4
  "description": "Luminescent UI library - Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",
@@ -50,7 +50,7 @@
50
50
  "vite-tsconfig-paths": "^5.1.4"
51
51
  },
52
52
  "peerDependencies": {
53
- "@luminescent/ui": "6.1.2"
53
+ "@luminescent/ui": "6.2.1"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "qwik build",