@algenium/blocks 1.2.0 → 1.2.1-rc.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.
package/dist/index.d.cts CHANGED
@@ -404,8 +404,10 @@ interface NotificationsWidgetProps {
404
404
  soundType?: SoundType;
405
405
  pulseStyle?: PulseStyle;
406
406
  soundCooldown?: number;
407
+ /** "ghost" renders a borderless button matching other ghost icon buttons. */
408
+ buttonVariant?: "default" | "ghost";
407
409
  }
408
- declare function NotificationsWidget({ notifications: propNotifications, onMarkAsRead: propOnMarkAsRead, onMarkAllAsRead: propOnMarkAllAsRead, onDismiss: propOnDismiss, onClearAll: propOnClearAll, onNotificationClick: propOnNotificationClick, size, maxVisible, playSound, soundUrl, className, emptyMessage, title, dotColor, showPulse, soundType, pulseStyle, soundCooldown, }: NotificationsWidgetProps): react_jsx_runtime.JSX.Element;
410
+ declare function NotificationsWidget({ notifications: propNotifications, onMarkAsRead: propOnMarkAsRead, onMarkAllAsRead: propOnMarkAllAsRead, onDismiss: propOnDismiss, onClearAll: propOnClearAll, onNotificationClick: propOnNotificationClick, size, maxVisible, playSound, soundUrl, className, emptyMessage, title, dotColor, showPulse, soundType, pulseStyle, soundCooldown, buttonVariant, }: NotificationsWidgetProps): react_jsx_runtime.JSX.Element;
409
411
 
410
412
  interface CalendarWidgetLabels {
411
413
  title?: string;
@@ -573,9 +575,11 @@ interface ChatSidebarProps {
573
575
  labels?: ChatSidebarLabels;
574
576
  roleLabel?: (role: string) => string;
575
577
  roomTypeLabel?: (type: string) => string;
578
+ /** Top offset on mobile so the navbar stays visible (e.g. "3.5rem", "4rem"). */
579
+ mobileTopOffset?: string;
576
580
  className?: string;
577
581
  }
578
- declare function ChatSidebar({ currentUserId, config, labels, roleLabel, roomTypeLabel, className, }: ChatSidebarProps): react_jsx_runtime.JSX.Element | null;
582
+ declare function ChatSidebar({ currentUserId, config, labels, roleLabel, roomTypeLabel, mobileTopOffset, className, }: ChatSidebarProps): react_jsx_runtime.JSX.Element | null;
579
583
 
580
584
  declare const buttonVariants: (props?: ({
581
585
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
package/dist/index.d.ts CHANGED
@@ -404,8 +404,10 @@ interface NotificationsWidgetProps {
404
404
  soundType?: SoundType;
405
405
  pulseStyle?: PulseStyle;
406
406
  soundCooldown?: number;
407
+ /** "ghost" renders a borderless button matching other ghost icon buttons. */
408
+ buttonVariant?: "default" | "ghost";
407
409
  }
408
- declare function NotificationsWidget({ notifications: propNotifications, onMarkAsRead: propOnMarkAsRead, onMarkAllAsRead: propOnMarkAllAsRead, onDismiss: propOnDismiss, onClearAll: propOnClearAll, onNotificationClick: propOnNotificationClick, size, maxVisible, playSound, soundUrl, className, emptyMessage, title, dotColor, showPulse, soundType, pulseStyle, soundCooldown, }: NotificationsWidgetProps): react_jsx_runtime.JSX.Element;
410
+ declare function NotificationsWidget({ notifications: propNotifications, onMarkAsRead: propOnMarkAsRead, onMarkAllAsRead: propOnMarkAllAsRead, onDismiss: propOnDismiss, onClearAll: propOnClearAll, onNotificationClick: propOnNotificationClick, size, maxVisible, playSound, soundUrl, className, emptyMessage, title, dotColor, showPulse, soundType, pulseStyle, soundCooldown, buttonVariant, }: NotificationsWidgetProps): react_jsx_runtime.JSX.Element;
409
411
 
410
412
  interface CalendarWidgetLabels {
411
413
  title?: string;
@@ -573,9 +575,11 @@ interface ChatSidebarProps {
573
575
  labels?: ChatSidebarLabels;
574
576
  roleLabel?: (role: string) => string;
575
577
  roomTypeLabel?: (type: string) => string;
578
+ /** Top offset on mobile so the navbar stays visible (e.g. "3.5rem", "4rem"). */
579
+ mobileTopOffset?: string;
576
580
  className?: string;
577
581
  }
578
- declare function ChatSidebar({ currentUserId, config, labels, roleLabel, roomTypeLabel, className, }: ChatSidebarProps): react_jsx_runtime.JSX.Element | null;
582
+ declare function ChatSidebar({ currentUserId, config, labels, roleLabel, roomTypeLabel, mobileTopOffset, className, }: ChatSidebarProps): react_jsx_runtime.JSX.Element | null;
579
583
 
580
584
  declare const buttonVariants: (props?: ({
581
585
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
package/dist/index.js CHANGED
@@ -4986,7 +4986,8 @@ function NotificationsWidget({
4986
4986
  showPulse = true,
4987
4987
  soundType = "chime",
4988
4988
  pulseStyle = "ring",
4989
- soundCooldown = 2e3
4989
+ soundCooldown = 2e3,
4990
+ buttonVariant = "default"
4990
4991
  }) {
4991
4992
  const context = useNotificationsContext();
4992
4993
  const notifications = propNotifications ?? context?.notifications ?? [];
@@ -5164,8 +5165,8 @@ function NotificationsWidget({
5164
5165
  motion.button,
5165
5166
  {
5166
5167
  className: cn(
5167
- "relative inline-flex items-center justify-center rounded-lg",
5168
- "bg-muted/50 border border-border/50 hover:bg-muted/70 transition-colors",
5168
+ "relative inline-flex items-center justify-center rounded-lg transition-colors",
5169
+ buttonVariant === "ghost" ? "hover:bg-accent hover:text-accent-foreground" : "bg-muted/50 border border-border/50 hover:bg-muted/70",
5169
5170
  styles.button,
5170
5171
  className
5171
5172
  ),
@@ -6118,7 +6119,8 @@ function ChatSidebarProvider({
6118
6119
  if (conv && conv.rooms.length === 1) {
6119
6120
  setActiveRoomId(conv.rooms[0].id);
6120
6121
  setView("chat");
6121
- } else if (conv && conv.rooms.length > 1) {
6122
+ } else {
6123
+ setActiveRoomId(null);
6122
6124
  setView("list");
6123
6125
  }
6124
6126
  }
@@ -6779,6 +6781,7 @@ function ChatSidebar({
6779
6781
  labels = {},
6780
6782
  roleLabel,
6781
6783
  roomTypeLabel,
6784
+ mobileTopOffset,
6782
6785
  className
6783
6786
  }) {
6784
6787
  const {
@@ -6792,17 +6795,37 @@ function ChatSidebar({
6792
6795
  selectRoom,
6793
6796
  back
6794
6797
  } = useChatSidebar();
6798
+ useEffect(() => {
6799
+ if (!isOpen || typeof window === "undefined") return;
6800
+ const mq = window.matchMedia("(max-width: 767px)");
6801
+ const apply = () => {
6802
+ if (mq.matches) document.body.style.overflow = "hidden";
6803
+ else document.body.style.overflow = "";
6804
+ };
6805
+ apply();
6806
+ mq.addEventListener("change", apply);
6807
+ return () => {
6808
+ mq.removeEventListener("change", apply);
6809
+ document.body.style.overflow = "";
6810
+ };
6811
+ }, [isOpen]);
6795
6812
  if (!isOpen) return null;
6796
6813
  const getRoomTypeLabel = (type) => {
6797
6814
  if (roomTypeLabel) return roomTypeLabel(type);
6798
6815
  return roomTypeLabels[type] ?? type;
6799
6816
  };
6800
6817
  const activeConversation = activeCaseId ? conversations.find((c) => c.caseId === activeCaseId) : null;
6801
- return /* @__PURE__ */ jsx(
6818
+ const cssVars = {
6819
+ "--sidebar-top": mobileTopOffset ?? "0px"
6820
+ };
6821
+ const panel = /* @__PURE__ */ jsx(
6802
6822
  "div",
6803
6823
  {
6824
+ style: cssVars,
6804
6825
  className: cn(
6805
- "flex h-full w-[360px] flex-col border-l bg-background xl:w-[400px]",
6826
+ "flex min-h-0 flex-col bg-background",
6827
+ "fixed top-[var(--sidebar-top)] right-0 bottom-0 left-0 z-[100] w-full max-w-none border-0 shadow-none",
6828
+ "md:relative md:inset-auto md:z-auto md:h-full md:w-[360px] md:max-w-[360px] md:shrink-0 md:border-l md:shadow-none xl:w-[400px] xl:max-w-[400px]",
6806
6829
  className
6807
6830
  ),
6808
6831
  children: view === "list" ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -6897,6 +6920,18 @@ function ChatSidebar({
6897
6920
  ] })
6898
6921
  }
6899
6922
  );
6923
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6924
+ /* @__PURE__ */ jsx(
6925
+ "div",
6926
+ {
6927
+ style: cssVars,
6928
+ className: "fixed top-[var(--sidebar-top)] right-0 bottom-0 left-0 z-[90] bg-black/50 md:hidden",
6929
+ "aria-hidden": true,
6930
+ onClick: close
6931
+ }
6932
+ ),
6933
+ panel
6934
+ ] });
6900
6935
  }
6901
6936
  function formatRelativeTime(dateStr) {
6902
6937
  const date = new Date(dateStr);