@alexandregme/zljs 3.13.1 → 3.13.2

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.
@@ -852,7 +852,7 @@ var Sidebar = ({
852
852
  };
853
853
 
854
854
  // core/top-nav/top-nav.tsx
855
- import { useState as useState2 } from "react";
855
+ import { useEffect, useRef, useState as useState2 } from "react";
856
856
 
857
857
  // core/top-nav/top-nav.styles.ts
858
858
  import { tv as tv9 } from "tailwind-variants";
@@ -893,7 +893,27 @@ var TopNav = ({
893
893
  onLogout
894
894
  }) => {
895
895
  const [open, setOpen] = useState2(null);
896
+ const pressedInside = useRef(false);
896
897
  const styles = topNav();
898
+ useEffect(() => {
899
+ if (!open) {
900
+ return;
901
+ }
902
+ pressedInside.current = false;
903
+ const closeOnPressOutside = () => {
904
+ if (!pressedInside.current) {
905
+ setOpen(null);
906
+ }
907
+ pressedInside.current = false;
908
+ };
909
+ document.addEventListener("pointerdown", closeOnPressOutside);
910
+ return () => {
911
+ document.removeEventListener("pointerdown", closeOnPressOutside);
912
+ };
913
+ }, [open]);
914
+ const markPressInside = () => {
915
+ pressedInside.current = true;
916
+ };
897
917
  const hasLinks = sections.some((section2) => section2.items.length > 0);
898
918
  const menuOpen = open === "menu";
899
919
  const accountOpen = open === "account";
@@ -907,7 +927,7 @@ var TopNav = ({
907
927
  const close = () => {
908
928
  setOpen(null);
909
929
  };
910
- return /* @__PURE__ */ jsxs6("header", { className: styles.base(), children: [
930
+ return /* @__PURE__ */ jsxs6("header", { className: styles.base(), onPointerDown: markPressInside, children: [
911
931
  /* @__PURE__ */ jsxs6("div", { className: styles.bar(), children: [
912
932
  hasLinks ? /* @__PURE__ */ jsx11(
913
933
  Button,
@@ -985,7 +1005,7 @@ var TopNav = ({
985
1005
  };
986
1006
 
987
1007
  // features/toaster/components/toaster/toaster.tsx
988
- import { useEffect } from "react";
1008
+ import { useEffect as useEffect2 } from "react";
989
1009
  import { Toaster as SonnerToaster, toast } from "sonner";
990
1010
 
991
1011
  // features/toaster/components/toaster/toaster.styles.ts
@@ -1018,7 +1038,7 @@ var Toaster = () => {
1018
1038
  const toasts = useToastStore((s) => s.toasts);
1019
1039
  const removeToast = useToastStore((s) => s.removeToast);
1020
1040
  const { toast: toastStyles, closeButton } = toaster();
1021
- useEffect(() => {
1041
+ useEffect2(() => {
1022
1042
  toasts.forEach((t) => {
1023
1043
  toast[t.type](t.message, { id: `store-${t.id}` });
1024
1044
  removeToast(t.id);
@@ -1365,7 +1385,7 @@ var AccessPending = ({
1365
1385
  };
1366
1386
 
1367
1387
  // features/auth/components/auth-provider/auth-provider.tsx
1368
- import { useEffect as useEffect2 } from "react";
1388
+ import { useEffect as useEffect3 } from "react";
1369
1389
  import { Fragment as Fragment5, jsx as jsx19 } from "react/jsx-runtime";
1370
1390
  var AuthProvider = ({
1371
1391
  adapter,
@@ -1375,7 +1395,7 @@ var AuthProvider = ({
1375
1395
  const configure = useAuthStore((s) => s.configure);
1376
1396
  const setSession = useAuthStore((s) => s.setSession);
1377
1397
  const reset = useAuthStore((s) => s.reset);
1378
- useEffect2(() => {
1398
+ useEffect3(() => {
1379
1399
  configure(adapter, appId);
1380
1400
  const unsubscribe = adapter.onSessionChange(setSession);
1381
1401
  return () => {
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ import {
30
30
  usePageStore,
31
31
  useRouterStore,
32
32
  useToastStore
33
- } from "./chunk-H4EDTEZB.js";
33
+ } from "./chunk-ZB76FFTW.js";
34
34
  import {
35
35
  Error,
36
36
  FormInput,
@@ -7,7 +7,7 @@ import {
7
7
  ZustandProviders,
8
8
  usePageStore,
9
9
  useRouterStore
10
- } from "../chunk-H4EDTEZB.js";
10
+ } from "../chunk-ZB76FFTW.js";
11
11
 
12
12
  // core/next/root-layout/root-layout.styles.ts
13
13
  import { tv } from "tailwind-variants";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "3.13.1",
3
+ "version": "3.13.2",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",