@tapizlabs/ui 0.2.13 → 0.2.14

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/index.js CHANGED
@@ -2292,13 +2292,23 @@ function LandingNavbarShell({
2292
2292
  themeLabels
2293
2293
  }) {
2294
2294
  const [open, setOpen] = useState7(false);
2295
+ const [renderDrawer, setRenderDrawer] = useState7(false);
2295
2296
  useEffect3(() => {
2296
- document.body.style.overflow = open ? "hidden" : "";
2297
- document.body.classList.toggle("tapiz-landing-navbar-open", open);
2298
- return () => {
2297
+ if (open) {
2298
+ setRenderDrawer(true);
2299
+ document.body.style.overflow = "hidden";
2300
+ document.body.classList.add("tapiz-landing-navbar-open");
2301
+ return () => {
2302
+ document.body.style.overflow = "";
2303
+ document.body.classList.remove("tapiz-landing-navbar-open");
2304
+ };
2305
+ }
2306
+ const timeoutId = window.setTimeout(() => {
2307
+ setRenderDrawer(false);
2299
2308
  document.body.style.overflow = "";
2300
2309
  document.body.classList.remove("tapiz-landing-navbar-open");
2301
- };
2310
+ }, 220);
2311
+ return () => window.clearTimeout(timeoutId);
2302
2312
  }, [open]);
2303
2313
  const drawerLabel = mobileDialogLabel ?? menuLabel;
2304
2314
  const resolvedCloseMenuLabel = closeMenuLabel ?? menuLabel;
@@ -2340,32 +2350,43 @@ function LandingNavbarShell({
2340
2350
  )
2341
2351
  ] })
2342
2352
  ] }) }),
2343
- open ? /* @__PURE__ */ jsx50(
2353
+ renderDrawer ? /* @__PURE__ */ jsx50(
2344
2354
  "button",
2345
2355
  {
2346
2356
  type: "button",
2347
2357
  className: "tapiz-landing-navbar__scrim",
2358
+ "data-state": open ? "open" : "closed",
2348
2359
  "aria-label": resolvedCloseMenuLabel,
2349
2360
  onClick: () => setOpen(false)
2350
2361
  }
2351
2362
  ) : null,
2352
- open ? /* @__PURE__ */ jsxs35("div", { className: "tapiz-landing-navbar__drawer", role: "dialog", "aria-modal": "true", "aria-label": drawerLabel, children: [
2353
- /* @__PURE__ */ jsx50("nav", { className: "tapiz-landing-navbar__drawer-nav", "aria-label": resolvedMobileNavLabel, children: items.map((item) => /* @__PURE__ */ jsxs35(
2354
- "a",
2355
- {
2356
- href: item.href,
2357
- className: "tapiz-landing-navbar__drawer-link",
2358
- onClick: () => setOpen(false),
2359
- children: [
2360
- item.icon ? /* @__PURE__ */ jsx50("span", { "aria-hidden": "true", className: "tapiz-landing-navbar__link-icon", children: item.icon }) : null,
2361
- /* @__PURE__ */ jsx50("span", { children: item.label })
2362
- ]
2363
- },
2364
- item.href
2365
- )) }),
2366
- mobileLanguageSwitcher ? /* @__PURE__ */ jsx50("div", { className: "tapiz-landing-navbar__language tapiz-landing-navbar__language--mobile", children: mobileLanguageSwitcher }) : null,
2367
- mobileActions ? /* @__PURE__ */ jsx50("div", { className: "tapiz-landing-navbar__drawer-actions", children: mobileActions }) : null
2368
- ] }) : null
2363
+ renderDrawer ? /* @__PURE__ */ jsxs35(
2364
+ "div",
2365
+ {
2366
+ className: "tapiz-landing-navbar__drawer",
2367
+ "data-state": open ? "open" : "closed",
2368
+ role: "dialog",
2369
+ "aria-modal": "true",
2370
+ "aria-label": drawerLabel,
2371
+ children: [
2372
+ /* @__PURE__ */ jsx50("nav", { className: "tapiz-landing-navbar__drawer-nav", "aria-label": resolvedMobileNavLabel, children: items.map((item) => /* @__PURE__ */ jsxs35(
2373
+ "a",
2374
+ {
2375
+ href: item.href,
2376
+ className: "tapiz-landing-navbar__drawer-link",
2377
+ onClick: () => setOpen(false),
2378
+ children: [
2379
+ item.icon ? /* @__PURE__ */ jsx50("span", { "aria-hidden": "true", className: "tapiz-landing-navbar__link-icon", children: item.icon }) : null,
2380
+ /* @__PURE__ */ jsx50("span", { children: item.label })
2381
+ ]
2382
+ },
2383
+ item.href
2384
+ )) }),
2385
+ mobileLanguageSwitcher ? /* @__PURE__ */ jsx50("div", { className: "tapiz-landing-navbar__language tapiz-landing-navbar__language--mobile", children: mobileLanguageSwitcher }) : null,
2386
+ mobileActions ? /* @__PURE__ */ jsx50("div", { className: "tapiz-landing-navbar__drawer-actions", children: mobileActions }) : null
2387
+ ]
2388
+ }
2389
+ ) : null
2369
2390
  ] });
2370
2391
  }
2371
2392