@raxrai/stylelab-ui 0.4.0 → 0.4.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.
package/README.md CHANGED
@@ -219,6 +219,10 @@ import { cn, mergeRefs, useFocusTrap, useClickOutside, useKeyboardNavigation, ge
219
219
 
220
220
  ## Changelog
221
221
 
222
+ ### [0.4.1]
223
+
224
+ - **Navbar** — Mobile menu: click-outside ref now wraps both the bar and the dropdown panel so taps on nav links or buttons (e.g. Log out) run the action instead of only closing the menu. Mobile panel uses an explicit opaque theme-aware background in all themes (readable with glass/clay). Optional `mobileMenuExtra` prop renders content at the bottom of the hamburger overlay (e.g. a Log out button); clicking it closes the menu.
225
+
222
226
  ### [0.4.0]
223
227
 
224
228
  - **Overrides + refs** — Component roots consistently support `style`, consumer `className` overrides (consumer class last), and ref forwarding across the library.
package/dist/index.cjs CHANGED
@@ -13280,21 +13280,28 @@ var Modal = (0, import_react43.forwardRef)(function Modal2({
13280
13280
  // components/Navbar.tsx
13281
13281
  var import_react44 = require("react");
13282
13282
  var import_jsx_runtime22 = require("react/jsx-runtime");
13283
- var Navbar = (0, import_react44.forwardRef)(function Navbar2({ children, logo, items, right, className, style }, ref) {
13283
+ var DARK_PANEL_THEMES = ["night", "glass", "cyberpunk"];
13284
+ function mobilePanelOpaqueClasses(theme) {
13285
+ if (DARK_PANEL_THEMES.includes(theme)) {
13286
+ return "bg-zinc-900 text-zinc-100 border-zinc-700";
13287
+ }
13288
+ return "bg-white text-zinc-900 border-zinc-200";
13289
+ }
13290
+ var Navbar = (0, import_react44.forwardRef)(function Navbar2({ children, logo, items, right, mobileMenuExtra, className, style }, ref) {
13284
13291
  const [mobileOpen, setMobileOpen] = (0, import_react44.useState)(false);
13285
13292
  const navRef = (0, import_react44.useRef)(null);
13293
+ const wrapperRef = (0, import_react44.useRef)(null);
13286
13294
  const mergedNavRef = mergeRefs(ref, navRef);
13287
13295
  const { theme } = useTheme();
13288
13296
  const themeClass = getThemeClass(theme, "navbar", "default");
13289
- const mobilePanelBgOverride = theme === "glass" ? "bg-white/95 backdrop-blur-xl" : theme === "clay" ? "bg-white/95" : null;
13290
13297
  useClickOutside(
13291
- navRef,
13298
+ wrapperRef,
13292
13299
  (0, import_react44.useCallback)(() => setMobileOpen(false), []),
13293
13300
  { enabled: mobileOpen }
13294
13301
  );
13295
13302
  const hasResponsiveNav = items != null && items.length > 0;
13296
13303
  if (hasResponsiveNav) {
13297
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
13304
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13298
13305
  "nav",
13299
13306
  {
13300
13307
  ref: mergedNavRef,
@@ -13304,7 +13311,7 @@ var Navbar = (0, import_react44.forwardRef)(function Navbar2({ children, logo, i
13304
13311
  className
13305
13312
  ),
13306
13313
  style,
13307
- children: [
13314
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { ref: wrapperRef, className: "flex min-h-14 w-full flex-col", children: [
13308
13315
  /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex h-14 w-full min-w-0 shrink-0 items-center justify-between gap-2", children: [
13309
13316
  logo != null ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex min-w-0 shrink-0 items-center overflow-hidden", children: logo }) : null,
13310
13317
  /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "hidden flex-1 items-center justify-end gap-4 sm:flex", children: [
@@ -13334,29 +13341,39 @@ var Navbar = (0, import_react44.forwardRef)(function Navbar2({ children, logo, i
13334
13341
  )
13335
13342
  ] })
13336
13343
  ] }),
13337
- mobileOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13344
+ mobileOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
13338
13345
  "div",
13339
13346
  {
13340
13347
  className: cn(
13341
- "absolute left-0 right-0 top-14 z-10 flex flex-col gap-1 border-t border-inherit px-3 py-3 shadow-lg sm:hidden",
13342
- themeClass,
13343
- mobilePanelBgOverride
13348
+ "absolute left-0 right-0 top-14 z-10 flex flex-col gap-1 border-t px-3 py-3 shadow-lg sm:hidden",
13349
+ mobilePanelOpaqueClasses(theme)
13344
13350
  ),
13345
13351
  role: "dialog",
13346
13352
  "aria-label": "Navigation menu",
13347
- children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13348
- "a",
13349
- {
13350
- href: item.href,
13351
- className: "block rounded-lg px-3 py-2.5 text-sm font-medium text-inherit opacity-90 transition-opacity hover:opacity-100",
13352
- onClick: () => setMobileOpen(false),
13353
- children: item.label
13354
- },
13355
- item.href
13356
- ))
13353
+ children: [
13354
+ items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13355
+ "a",
13356
+ {
13357
+ href: item.href,
13358
+ className: "block rounded-lg px-3 py-2.5 text-sm font-medium text-inherit opacity-90 transition-opacity hover:opacity-100",
13359
+ onClick: () => setMobileOpen(false),
13360
+ children: item.label
13361
+ },
13362
+ item.href
13363
+ )),
13364
+ mobileMenuExtra != null ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
13365
+ "div",
13366
+ {
13367
+ className: "mt-2 border-t border-inherit pt-3",
13368
+ onClick: () => setMobileOpen(false),
13369
+ role: "presentation",
13370
+ children: mobileMenuExtra
13371
+ }
13372
+ ) : null
13373
+ ]
13357
13374
  }
13358
13375
  )
13359
- ]
13376
+ ] })
13360
13377
  }
13361
13378
  );
13362
13379
  }