@almadar/ui 5.15.0 → 5.16.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.
@@ -10247,13 +10247,13 @@ var init_MapView = __esm({
10247
10247
  shadowSize: [41, 41]
10248
10248
  });
10249
10249
  L.Marker.prototype.options.icon = defaultIcon;
10250
- const { useEffect: useEffect69, useRef: useRef65, useCallback: useCallback114, useState: useState100 } = React86__namespace.default;
10250
+ const { useEffect: useEffect70, useRef: useRef66, useCallback: useCallback114, useState: useState100 } = React86__namespace.default;
10251
10251
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
10252
10252
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
10253
10253
  function MapUpdater({ centerLat, centerLng, zoom }) {
10254
10254
  const map = useMap();
10255
- const prevRef = useRef65({ centerLat, centerLng, zoom });
10256
- useEffect69(() => {
10255
+ const prevRef = useRef66({ centerLat, centerLng, zoom });
10256
+ useEffect70(() => {
10257
10257
  const prev = prevRef.current;
10258
10258
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
10259
10259
  map.setView([centerLat, centerLng], zoom);
@@ -10264,7 +10264,7 @@ var init_MapView = __esm({
10264
10264
  }
10265
10265
  function MapClickHandler({ onMapClick }) {
10266
10266
  const map = useMap();
10267
- useEffect69(() => {
10267
+ useEffect70(() => {
10268
10268
  if (!onMapClick) return;
10269
10269
  const handler = (e) => {
10270
10270
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -22566,6 +22566,21 @@ var init_DashboardLayout = __esm({
22566
22566
  };
22567
22567
  const [sidebarOpen, setSidebarOpen] = React86.useState(false);
22568
22568
  const [userMenuOpen, setUserMenuOpen] = React86.useState(false);
22569
+ const layoutRef = React86.useRef(null);
22570
+ const [isMobile, setIsMobile] = React86.useState(false);
22571
+ React86.useEffect(() => {
22572
+ const el = layoutRef.current;
22573
+ if (!el || typeof ResizeObserver === "undefined") return;
22574
+ const ro = new ResizeObserver((entries) => {
22575
+ const w = entries[0]?.contentRect.width ?? el.clientWidth;
22576
+ setIsMobile(w < 1024);
22577
+ });
22578
+ ro.observe(el);
22579
+ return () => ro.disconnect();
22580
+ }, []);
22581
+ React86.useEffect(() => {
22582
+ if (!isMobile && sidebarOpen) setSidebarOpen(false);
22583
+ }, [isMobile, sidebarOpen]);
22569
22584
  const location = reactRouterDom.useLocation();
22570
22585
  const ctxPagePath = useCurrentPagePath();
22571
22586
  const activePath = currentPath ?? ctxPagePath ?? location.pathname;
@@ -22578,15 +22593,15 @@ var init_DashboardLayout = __esm({
22578
22593
  const showBottomNav = layoutMode === "bottomnav";
22579
22594
  const isTopNav = layoutMode === "topnav";
22580
22595
  return /* @__PURE__ */ jsxRuntime.jsxs(
22581
- HStack,
22596
+ Box,
22582
22597
  {
22583
- gap: "none",
22584
- className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background items-stretch",
22598
+ ref: layoutRef,
22599
+ className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background flex flex-row items-stretch",
22585
22600
  children: [
22586
- showSidebar && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
22601
+ showSidebar && isMobile && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
22587
22602
  Box,
22588
22603
  {
22589
- className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20 @lg/dashboard:hidden",
22604
+ className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20",
22590
22605
  onClick: () => setSidebarOpen(false)
22591
22606
  }
22592
22607
  ),
@@ -22596,11 +22611,16 @@ var init_DashboardLayout = __esm({
22596
22611
  as: "aside",
22597
22612
  className: cn(
22598
22613
  "z-30 w-64 flex-shrink-0 bg-card dark:bg-card border-r border-border dark:border-border",
22599
- "fixed inset-y-0 left-0 @lg/dashboard:static @lg/dashboard:translate-x-0 @lg/dashboard:h-auto",
22600
- "transform transition-transform duration-200 ease-in-out",
22601
- "flex flex-col",
22602
- sidebarOpen ? "translate-x-0" : "-translate-x-full"
22614
+ "flex flex-col"
22603
22615
  ),
22616
+ style: isMobile ? {
22617
+ position: "fixed",
22618
+ top: 0,
22619
+ bottom: 0,
22620
+ left: 0,
22621
+ transform: sidebarOpen ? "translateX(0)" : "translateX(-100%)",
22622
+ transition: "transform 200ms ease-in-out"
22623
+ } : { position: "static", transform: "none" },
22604
22624
  children: [
22605
22625
  /* @__PURE__ */ jsxRuntime.jsxs(
22606
22626
  HStack,
@@ -22629,11 +22649,11 @@ var init_DashboardLayout = __esm({
22629
22649
  }
22630
22650
  )
22631
22651
  ] }),
22632
- /* @__PURE__ */ jsxRuntime.jsx(
22652
+ isMobile && /* @__PURE__ */ jsxRuntime.jsx(
22633
22653
  Button,
22634
22654
  {
22635
22655
  variant: "ghost",
22636
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22656
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22637
22657
  onClick: () => setSidebarOpen(false),
22638
22658
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "x", className: "h-5 w-5" })
22639
22659
  }
@@ -22674,11 +22694,11 @@ var init_DashboardLayout = __esm({
22674
22694
  justify: "between",
22675
22695
  className: "h-full px-3 @sm/dashboard:px-4 gap-2 @sm/dashboard:gap-4",
22676
22696
  children: [
22677
- showSidebar && /* @__PURE__ */ jsxRuntime.jsx(
22697
+ showSidebar && isMobile && /* @__PURE__ */ jsxRuntime.jsx(
22678
22698
  Button,
22679
22699
  {
22680
22700
  variant: "ghost",
22681
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22701
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22682
22702
  onClick: () => setSidebarOpen(true),
22683
22703
  "aria-label": "Open sidebar",
22684
22704
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "menu", className: "h-5 w-5" })
@@ -10198,13 +10198,13 @@ var init_MapView = __esm({
10198
10198
  shadowSize: [41, 41]
10199
10199
  });
10200
10200
  L.Marker.prototype.options.icon = defaultIcon;
10201
- const { useEffect: useEffect69, useRef: useRef65, useCallback: useCallback114, useState: useState100 } = React86__default;
10201
+ const { useEffect: useEffect70, useRef: useRef66, useCallback: useCallback114, useState: useState100 } = React86__default;
10202
10202
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
10203
10203
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
10204
10204
  function MapUpdater({ centerLat, centerLng, zoom }) {
10205
10205
  const map = useMap();
10206
- const prevRef = useRef65({ centerLat, centerLng, zoom });
10207
- useEffect69(() => {
10206
+ const prevRef = useRef66({ centerLat, centerLng, zoom });
10207
+ useEffect70(() => {
10208
10208
  const prev = prevRef.current;
10209
10209
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
10210
10210
  map.setView([centerLat, centerLng], zoom);
@@ -10215,7 +10215,7 @@ var init_MapView = __esm({
10215
10215
  }
10216
10216
  function MapClickHandler({ onMapClick }) {
10217
10217
  const map = useMap();
10218
- useEffect69(() => {
10218
+ useEffect70(() => {
10219
10219
  if (!onMapClick) return;
10220
10220
  const handler = (e) => {
10221
10221
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -22517,6 +22517,21 @@ var init_DashboardLayout = __esm({
22517
22517
  };
22518
22518
  const [sidebarOpen, setSidebarOpen] = useState(false);
22519
22519
  const [userMenuOpen, setUserMenuOpen] = useState(false);
22520
+ const layoutRef = useRef(null);
22521
+ const [isMobile, setIsMobile] = useState(false);
22522
+ useEffect(() => {
22523
+ const el = layoutRef.current;
22524
+ if (!el || typeof ResizeObserver === "undefined") return;
22525
+ const ro = new ResizeObserver((entries) => {
22526
+ const w = entries[0]?.contentRect.width ?? el.clientWidth;
22527
+ setIsMobile(w < 1024);
22528
+ });
22529
+ ro.observe(el);
22530
+ return () => ro.disconnect();
22531
+ }, []);
22532
+ useEffect(() => {
22533
+ if (!isMobile && sidebarOpen) setSidebarOpen(false);
22534
+ }, [isMobile, sidebarOpen]);
22520
22535
  const location = useLocation();
22521
22536
  const ctxPagePath = useCurrentPagePath();
22522
22537
  const activePath = currentPath ?? ctxPagePath ?? location.pathname;
@@ -22529,15 +22544,15 @@ var init_DashboardLayout = __esm({
22529
22544
  const showBottomNav = layoutMode === "bottomnav";
22530
22545
  const isTopNav = layoutMode === "topnav";
22531
22546
  return /* @__PURE__ */ jsxs(
22532
- HStack,
22547
+ Box,
22533
22548
  {
22534
- gap: "none",
22535
- className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background items-stretch",
22549
+ ref: layoutRef,
22550
+ className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background flex flex-row items-stretch",
22536
22551
  children: [
22537
- showSidebar && sidebarOpen && /* @__PURE__ */ jsx(
22552
+ showSidebar && isMobile && sidebarOpen && /* @__PURE__ */ jsx(
22538
22553
  Box,
22539
22554
  {
22540
- className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20 @lg/dashboard:hidden",
22555
+ className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20",
22541
22556
  onClick: () => setSidebarOpen(false)
22542
22557
  }
22543
22558
  ),
@@ -22547,11 +22562,16 @@ var init_DashboardLayout = __esm({
22547
22562
  as: "aside",
22548
22563
  className: cn(
22549
22564
  "z-30 w-64 flex-shrink-0 bg-card dark:bg-card border-r border-border dark:border-border",
22550
- "fixed inset-y-0 left-0 @lg/dashboard:static @lg/dashboard:translate-x-0 @lg/dashboard:h-auto",
22551
- "transform transition-transform duration-200 ease-in-out",
22552
- "flex flex-col",
22553
- sidebarOpen ? "translate-x-0" : "-translate-x-full"
22565
+ "flex flex-col"
22554
22566
  ),
22567
+ style: isMobile ? {
22568
+ position: "fixed",
22569
+ top: 0,
22570
+ bottom: 0,
22571
+ left: 0,
22572
+ transform: sidebarOpen ? "translateX(0)" : "translateX(-100%)",
22573
+ transition: "transform 200ms ease-in-out"
22574
+ } : { position: "static", transform: "none" },
22555
22575
  children: [
22556
22576
  /* @__PURE__ */ jsxs(
22557
22577
  HStack,
@@ -22580,11 +22600,11 @@ var init_DashboardLayout = __esm({
22580
22600
  }
22581
22601
  )
22582
22602
  ] }),
22583
- /* @__PURE__ */ jsx(
22603
+ isMobile && /* @__PURE__ */ jsx(
22584
22604
  Button,
22585
22605
  {
22586
22606
  variant: "ghost",
22587
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22607
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22588
22608
  onClick: () => setSidebarOpen(false),
22589
22609
  children: /* @__PURE__ */ jsx(Icon, { name: "x", className: "h-5 w-5" })
22590
22610
  }
@@ -22625,11 +22645,11 @@ var init_DashboardLayout = __esm({
22625
22645
  justify: "between",
22626
22646
  className: "h-full px-3 @sm/dashboard:px-4 gap-2 @sm/dashboard:gap-4",
22627
22647
  children: [
22628
- showSidebar && /* @__PURE__ */ jsx(
22648
+ showSidebar && isMobile && /* @__PURE__ */ jsx(
22629
22649
  Button,
22630
22650
  {
22631
22651
  variant: "ghost",
22632
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22652
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22633
22653
  onClick: () => setSidebarOpen(true),
22634
22654
  "aria-label": "Open sidebar",
22635
22655
  children: /* @__PURE__ */ jsx(Icon, { name: "menu", className: "h-5 w-5" })
@@ -10135,13 +10135,13 @@ var init_MapView = __esm({
10135
10135
  shadowSize: [41, 41]
10136
10136
  });
10137
10137
  L.Marker.prototype.options.icon = defaultIcon;
10138
- const { useEffect: useEffect70, useRef: useRef65, useCallback: useCallback114, useState: useState103 } = React85__namespace.default;
10138
+ const { useEffect: useEffect71, useRef: useRef66, useCallback: useCallback114, useState: useState103 } = React85__namespace.default;
10139
10139
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
10140
10140
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
10141
10141
  function MapUpdater({ centerLat, centerLng, zoom }) {
10142
10142
  const map = useMap();
10143
- const prevRef = useRef65({ centerLat, centerLng, zoom });
10144
- useEffect70(() => {
10143
+ const prevRef = useRef66({ centerLat, centerLng, zoom });
10144
+ useEffect71(() => {
10145
10145
  const prev = prevRef.current;
10146
10146
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
10147
10147
  map.setView([centerLat, centerLng], zoom);
@@ -10152,7 +10152,7 @@ var init_MapView = __esm({
10152
10152
  }
10153
10153
  function MapClickHandler({ onMapClick }) {
10154
10154
  const map = useMap();
10155
- useEffect70(() => {
10155
+ useEffect71(() => {
10156
10156
  if (!onMapClick) return;
10157
10157
  const handler = (e) => {
10158
10158
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -22335,6 +22335,21 @@ var init_DashboardLayout = __esm({
22335
22335
  };
22336
22336
  const [sidebarOpen, setSidebarOpen] = React85.useState(false);
22337
22337
  const [userMenuOpen, setUserMenuOpen] = React85.useState(false);
22338
+ const layoutRef = React85.useRef(null);
22339
+ const [isMobile, setIsMobile] = React85.useState(false);
22340
+ React85.useEffect(() => {
22341
+ const el = layoutRef.current;
22342
+ if (!el || typeof ResizeObserver === "undefined") return;
22343
+ const ro = new ResizeObserver((entries) => {
22344
+ const w = entries[0]?.contentRect.width ?? el.clientWidth;
22345
+ setIsMobile(w < 1024);
22346
+ });
22347
+ ro.observe(el);
22348
+ return () => ro.disconnect();
22349
+ }, []);
22350
+ React85.useEffect(() => {
22351
+ if (!isMobile && sidebarOpen) setSidebarOpen(false);
22352
+ }, [isMobile, sidebarOpen]);
22338
22353
  const location = reactRouterDom.useLocation();
22339
22354
  const ctxPagePath = useCurrentPagePath();
22340
22355
  const activePath = currentPath ?? ctxPagePath ?? location.pathname;
@@ -22347,15 +22362,15 @@ var init_DashboardLayout = __esm({
22347
22362
  const showBottomNav = layoutMode === "bottomnav";
22348
22363
  const isTopNav = layoutMode === "topnav";
22349
22364
  return /* @__PURE__ */ jsxRuntime.jsxs(
22350
- HStack,
22365
+ Box,
22351
22366
  {
22352
- gap: "none",
22353
- className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background items-stretch",
22367
+ ref: layoutRef,
22368
+ className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background flex flex-row items-stretch",
22354
22369
  children: [
22355
- showSidebar && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
22370
+ showSidebar && isMobile && sidebarOpen && /* @__PURE__ */ jsxRuntime.jsx(
22356
22371
  Box,
22357
22372
  {
22358
- className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20 @lg/dashboard:hidden",
22373
+ className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20",
22359
22374
  onClick: () => setSidebarOpen(false)
22360
22375
  }
22361
22376
  ),
@@ -22365,11 +22380,16 @@ var init_DashboardLayout = __esm({
22365
22380
  as: "aside",
22366
22381
  className: cn(
22367
22382
  "z-30 w-64 flex-shrink-0 bg-card dark:bg-card border-r border-border dark:border-border",
22368
- "fixed inset-y-0 left-0 @lg/dashboard:static @lg/dashboard:translate-x-0 @lg/dashboard:h-auto",
22369
- "transform transition-transform duration-200 ease-in-out",
22370
- "flex flex-col",
22371
- sidebarOpen ? "translate-x-0" : "-translate-x-full"
22383
+ "flex flex-col"
22372
22384
  ),
22385
+ style: isMobile ? {
22386
+ position: "fixed",
22387
+ top: 0,
22388
+ bottom: 0,
22389
+ left: 0,
22390
+ transform: sidebarOpen ? "translateX(0)" : "translateX(-100%)",
22391
+ transition: "transform 200ms ease-in-out"
22392
+ } : { position: "static", transform: "none" },
22373
22393
  children: [
22374
22394
  /* @__PURE__ */ jsxRuntime.jsxs(
22375
22395
  HStack,
@@ -22398,11 +22418,11 @@ var init_DashboardLayout = __esm({
22398
22418
  }
22399
22419
  )
22400
22420
  ] }),
22401
- /* @__PURE__ */ jsxRuntime.jsx(
22421
+ isMobile && /* @__PURE__ */ jsxRuntime.jsx(
22402
22422
  Button,
22403
22423
  {
22404
22424
  variant: "ghost",
22405
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22425
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22406
22426
  onClick: () => setSidebarOpen(false),
22407
22427
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "x", className: "h-5 w-5" })
22408
22428
  }
@@ -22443,11 +22463,11 @@ var init_DashboardLayout = __esm({
22443
22463
  justify: "between",
22444
22464
  className: "h-full px-3 @sm/dashboard:px-4 gap-2 @sm/dashboard:gap-4",
22445
22465
  children: [
22446
- showSidebar && /* @__PURE__ */ jsxRuntime.jsx(
22466
+ showSidebar && isMobile && /* @__PURE__ */ jsxRuntime.jsx(
22447
22467
  Button,
22448
22468
  {
22449
22469
  variant: "ghost",
22450
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22470
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22451
22471
  onClick: () => setSidebarOpen(true),
22452
22472
  "aria-label": "Open sidebar",
22453
22473
  children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "menu", className: "h-5 w-5" })
@@ -10086,13 +10086,13 @@ var init_MapView = __esm({
10086
10086
  shadowSize: [41, 41]
10087
10087
  });
10088
10088
  L.Marker.prototype.options.icon = defaultIcon;
10089
- const { useEffect: useEffect70, useRef: useRef65, useCallback: useCallback114, useState: useState103 } = React85__default;
10089
+ const { useEffect: useEffect71, useRef: useRef66, useCallback: useCallback114, useState: useState103 } = React85__default;
10090
10090
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
10091
10091
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
10092
10092
  function MapUpdater({ centerLat, centerLng, zoom }) {
10093
10093
  const map = useMap();
10094
- const prevRef = useRef65({ centerLat, centerLng, zoom });
10095
- useEffect70(() => {
10094
+ const prevRef = useRef66({ centerLat, centerLng, zoom });
10095
+ useEffect71(() => {
10096
10096
  const prev = prevRef.current;
10097
10097
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
10098
10098
  map.setView([centerLat, centerLng], zoom);
@@ -10103,7 +10103,7 @@ var init_MapView = __esm({
10103
10103
  }
10104
10104
  function MapClickHandler({ onMapClick }) {
10105
10105
  const map = useMap();
10106
- useEffect70(() => {
10106
+ useEffect71(() => {
10107
10107
  if (!onMapClick) return;
10108
10108
  const handler = (e) => {
10109
10109
  onMapClick(e.latlng.lat, e.latlng.lng);
@@ -22286,6 +22286,21 @@ var init_DashboardLayout = __esm({
22286
22286
  };
22287
22287
  const [sidebarOpen, setSidebarOpen] = useState(false);
22288
22288
  const [userMenuOpen, setUserMenuOpen] = useState(false);
22289
+ const layoutRef = useRef(null);
22290
+ const [isMobile, setIsMobile] = useState(false);
22291
+ useEffect(() => {
22292
+ const el = layoutRef.current;
22293
+ if (!el || typeof ResizeObserver === "undefined") return;
22294
+ const ro = new ResizeObserver((entries) => {
22295
+ const w = entries[0]?.contentRect.width ?? el.clientWidth;
22296
+ setIsMobile(w < 1024);
22297
+ });
22298
+ ro.observe(el);
22299
+ return () => ro.disconnect();
22300
+ }, []);
22301
+ useEffect(() => {
22302
+ if (!isMobile && sidebarOpen) setSidebarOpen(false);
22303
+ }, [isMobile, sidebarOpen]);
22289
22304
  const location = useLocation();
22290
22305
  const ctxPagePath = useCurrentPagePath();
22291
22306
  const activePath = currentPath ?? ctxPagePath ?? location.pathname;
@@ -22298,15 +22313,15 @@ var init_DashboardLayout = __esm({
22298
22313
  const showBottomNav = layoutMode === "bottomnav";
22299
22314
  const isTopNav = layoutMode === "topnav";
22300
22315
  return /* @__PURE__ */ jsxs(
22301
- HStack,
22316
+ Box,
22302
22317
  {
22303
- gap: "none",
22304
- className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background items-stretch",
22318
+ ref: layoutRef,
22319
+ className: "@container/dashboard min-h-screen w-full bg-background dark:bg-background flex flex-row items-stretch",
22305
22320
  children: [
22306
- showSidebar && sidebarOpen && /* @__PURE__ */ jsx(
22321
+ showSidebar && isMobile && sidebarOpen && /* @__PURE__ */ jsx(
22307
22322
  Box,
22308
22323
  {
22309
- className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20 @lg/dashboard:hidden",
22324
+ className: "fixed inset-0 bg-foreground/50 dark:bg-foreground/70 z-20",
22310
22325
  onClick: () => setSidebarOpen(false)
22311
22326
  }
22312
22327
  ),
@@ -22316,11 +22331,16 @@ var init_DashboardLayout = __esm({
22316
22331
  as: "aside",
22317
22332
  className: cn(
22318
22333
  "z-30 w-64 flex-shrink-0 bg-card dark:bg-card border-r border-border dark:border-border",
22319
- "fixed inset-y-0 left-0 @lg/dashboard:static @lg/dashboard:translate-x-0 @lg/dashboard:h-auto",
22320
- "transform transition-transform duration-200 ease-in-out",
22321
- "flex flex-col",
22322
- sidebarOpen ? "translate-x-0" : "-translate-x-full"
22334
+ "flex flex-col"
22323
22335
  ),
22336
+ style: isMobile ? {
22337
+ position: "fixed",
22338
+ top: 0,
22339
+ bottom: 0,
22340
+ left: 0,
22341
+ transform: sidebarOpen ? "translateX(0)" : "translateX(-100%)",
22342
+ transition: "transform 200ms ease-in-out"
22343
+ } : { position: "static", transform: "none" },
22324
22344
  children: [
22325
22345
  /* @__PURE__ */ jsxs(
22326
22346
  HStack,
@@ -22349,11 +22369,11 @@ var init_DashboardLayout = __esm({
22349
22369
  }
22350
22370
  )
22351
22371
  ] }),
22352
- /* @__PURE__ */ jsx(
22372
+ isMobile && /* @__PURE__ */ jsx(
22353
22373
  Button,
22354
22374
  {
22355
22375
  variant: "ghost",
22356
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22376
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground",
22357
22377
  onClick: () => setSidebarOpen(false),
22358
22378
  children: /* @__PURE__ */ jsx(Icon, { name: "x", className: "h-5 w-5" })
22359
22379
  }
@@ -22394,11 +22414,11 @@ var init_DashboardLayout = __esm({
22394
22414
  justify: "between",
22395
22415
  className: "h-full px-3 @sm/dashboard:px-4 gap-2 @sm/dashboard:gap-4",
22396
22416
  children: [
22397
- showSidebar && /* @__PURE__ */ jsx(
22417
+ showSidebar && isMobile && /* @__PURE__ */ jsx(
22398
22418
  Button,
22399
22419
  {
22400
22420
  variant: "ghost",
22401
- className: "@lg/dashboard:hidden p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22421
+ className: "p-2 rounded-md hover:bg-muted dark:hover:bg-muted text-muted-foreground dark:text-muted-foreground touch-manipulation min-h-[44px] min-w-[44px] flex items-center justify-center",
22402
22422
  onClick: () => setSidebarOpen(true),
22403
22423
  "aria-label": "Open sidebar",
22404
22424
  children: /* @__PURE__ */ jsx(Icon, { name: "menu", className: "h-5 w-5" })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.15.0",
3
+ "version": "5.16.1",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -129,7 +129,7 @@
129
129
  "typecheck": "tsc --noEmit"
130
130
  },
131
131
  "dependencies": {
132
- "@almadar/core": ">=9.8.0",
132
+ "@almadar/core": ">=9.10.0",
133
133
  "@almadar/evaluator": ">=2.9.2",
134
134
  "@almadar/logger": "^1.3.0",
135
135
  "@almadar/patterns": ">=2.35.0",