@algenium/blocks 1.2.0-rc.1 → 1.2.0-rc.3

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.cjs CHANGED
@@ -6146,7 +6146,8 @@ function ChatSidebarProvider({
6146
6146
  if (conv && conv.rooms.length === 1) {
6147
6147
  setActiveRoomId(conv.rooms[0].id);
6148
6148
  setView("chat");
6149
- } else if (conv && conv.rooms.length > 1) {
6149
+ } else {
6150
+ setActiveRoomId(null);
6150
6151
  setView("list");
6151
6152
  }
6152
6153
  }
@@ -6807,6 +6808,7 @@ function ChatSidebar({
6807
6808
  labels = {},
6808
6809
  roleLabel,
6809
6810
  roomTypeLabel,
6811
+ mobileTopOffset,
6810
6812
  className
6811
6813
  }) {
6812
6814
  const {
@@ -6820,17 +6822,37 @@ function ChatSidebar({
6820
6822
  selectRoom,
6821
6823
  back
6822
6824
  } = useChatSidebar();
6825
+ React2.useEffect(() => {
6826
+ if (!isOpen || typeof window === "undefined") return;
6827
+ const mq = window.matchMedia("(max-width: 639px)");
6828
+ const apply = () => {
6829
+ if (mq.matches) document.body.style.overflow = "hidden";
6830
+ else document.body.style.overflow = "";
6831
+ };
6832
+ apply();
6833
+ mq.addEventListener("change", apply);
6834
+ return () => {
6835
+ mq.removeEventListener("change", apply);
6836
+ document.body.style.overflow = "";
6837
+ };
6838
+ }, [isOpen]);
6823
6839
  if (!isOpen) return null;
6824
6840
  const getRoomTypeLabel = (type) => {
6825
6841
  if (roomTypeLabel) return roomTypeLabel(type);
6826
6842
  return roomTypeLabels[type] ?? type;
6827
6843
  };
6828
6844
  const activeConversation = activeCaseId ? conversations.find((c) => c.caseId === activeCaseId) : null;
6829
- return /* @__PURE__ */ jsxRuntime.jsx(
6845
+ const cssVars = {
6846
+ "--sidebar-top": mobileTopOffset ?? "0px"
6847
+ };
6848
+ const panel = /* @__PURE__ */ jsxRuntime.jsx(
6830
6849
  "div",
6831
6850
  {
6851
+ style: cssVars,
6832
6852
  className: cn(
6833
- "flex h-full w-[360px] flex-col border-l bg-background xl:w-[400px]",
6853
+ "flex min-h-0 flex-col bg-background",
6854
+ "fixed top-[var(--sidebar-top)] right-0 bottom-0 left-0 z-[100] w-full max-w-none border-0 shadow-none",
6855
+ "sm:relative sm:inset-auto sm:z-auto sm:h-full sm:w-[360px] sm:max-w-[360px] sm:shrink-0 sm:border-l sm:shadow-none xl:w-[400px] xl:max-w-[400px]",
6834
6856
  className
6835
6857
  ),
6836
6858
  children: view === "list" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -6925,6 +6947,18 @@ function ChatSidebar({
6925
6947
  ] })
6926
6948
  }
6927
6949
  );
6950
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6951
+ /* @__PURE__ */ jsxRuntime.jsx(
6952
+ "div",
6953
+ {
6954
+ style: cssVars,
6955
+ className: "fixed top-[var(--sidebar-top)] right-0 bottom-0 left-0 z-[90] bg-black/50 sm:hidden",
6956
+ "aria-hidden": true,
6957
+ onClick: close
6958
+ }
6959
+ ),
6960
+ panel
6961
+ ] });
6928
6962
  }
6929
6963
  function formatRelativeTime(dateStr) {
6930
6964
  const date = new Date(dateStr);