@janovix/blocks 1.0.0-rc.4 → 1.0.0-rc.5

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
@@ -187,7 +187,7 @@ interface NotificationsWidgetProps {
187
187
  pulseStyle?: PulseStyle;
188
188
  soundCooldown?: number;
189
189
  }
190
- declare function NotificationsWidget({ notifications, onMarkAsRead, onMarkAllAsRead, onDismiss, onClearAll, onNotificationClick, size, maxVisible, playSound: _playSound, soundUrl, className, emptyMessage, title, dotColor, showPulse, soundType, pulseStyle, soundCooldown, }: NotificationsWidgetProps): react_jsx_runtime.JSX.Element;
190
+ declare function NotificationsWidget({ notifications, onMarkAsRead, onMarkAllAsRead, onDismiss, onClearAll, onNotificationClick, size, maxVisible, playSound, soundUrl, className, emptyMessage, title, dotColor, showPulse, soundType, pulseStyle, soundCooldown, }: NotificationsWidgetProps): react_jsx_runtime.JSX.Element;
191
191
 
192
192
  declare const buttonVariants: (props?: ({
193
193
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
package/dist/index.d.ts CHANGED
@@ -187,7 +187,7 @@ interface NotificationsWidgetProps {
187
187
  pulseStyle?: PulseStyle;
188
188
  soundCooldown?: number;
189
189
  }
190
- declare function NotificationsWidget({ notifications, onMarkAsRead, onMarkAllAsRead, onDismiss, onClearAll, onNotificationClick, size, maxVisible, playSound: _playSound, soundUrl, className, emptyMessage, title, dotColor, showPulse, soundType, pulseStyle, soundCooldown, }: NotificationsWidgetProps): react_jsx_runtime.JSX.Element;
190
+ declare function NotificationsWidget({ notifications, onMarkAsRead, onMarkAllAsRead, onDismiss, onClearAll, onNotificationClick, size, maxVisible, playSound, soundUrl, className, emptyMessage, title, dotColor, showPulse, soundType, pulseStyle, soundCooldown, }: NotificationsWidgetProps): react_jsx_runtime.JSX.Element;
191
191
 
192
192
  declare const buttonVariants: (props?: ({
193
193
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
package/dist/index.js CHANGED
@@ -9630,9 +9630,11 @@ function AvatarEditor({
9630
9630
  const [dragStart, setDragStart] = useState({ x: 0, y: 0 });
9631
9631
  const [showGrid, setShowGrid] = useState(initialShowGrid);
9632
9632
  useEffect(() => {
9633
- if (imageSource && !imageSource.startsWith("data:")) {
9633
+ if (imageSource) {
9634
9634
  const img = new Image();
9635
- img.crossOrigin = "anonymous";
9635
+ if (!imageSource.startsWith("data:")) {
9636
+ img.crossOrigin = "anonymous";
9637
+ }
9636
9638
  img.onload = () => {
9637
9639
  setImage(img);
9638
9640
  setImageLoaded(true);
@@ -9820,6 +9822,7 @@ function AvatarEditor({
9820
9822
  const handleTouchMove = useCallback(
9821
9823
  (e) => {
9822
9824
  if (!isDragging) return;
9825
+ e.preventDefault();
9823
9826
  const touch = e.touches[0];
9824
9827
  setPosition({
9825
9828
  x: touch.clientX - dragStart.x,
@@ -10402,14 +10405,13 @@ function DrawerDescription({
10402
10405
  function useMediaQuery(query) {
10403
10406
  const [matches, setMatches] = useState(false);
10404
10407
  useEffect(() => {
10408
+ if (typeof window === "undefined") return;
10405
10409
  const media = window.matchMedia(query);
10406
- if (media.matches !== matches) {
10407
- setMatches(media.matches);
10408
- }
10410
+ setMatches(media.matches);
10409
10411
  const listener = () => setMatches(media.matches);
10410
10412
  media.addEventListener("change", listener);
10411
10413
  return () => media.removeEventListener("change", listener);
10412
- }, [matches, query]);
10414
+ }, [query]);
10413
10415
  return matches;
10414
10416
  }
10415
10417
  function AvatarEditorDialog({
@@ -10432,7 +10434,15 @@ function AvatarEditorDialog({
10432
10434
  const [editedValue, setEditedValue] = useState(value ?? null);
10433
10435
  const [isSaving, setIsSaving] = useState(false);
10434
10436
  const [feedback, setFeedback] = useState(null);
10437
+ const [mobileEditorSize, setMobileEditorSize] = useState(editorSize);
10435
10438
  const isMobile = useMediaQuery("(max-width: 640px)");
10439
+ useEffect(() => {
10440
+ if (typeof window !== "undefined" && isMobile) {
10441
+ setMobileEditorSize(Math.min(editorSize + 40, window.innerWidth - 48));
10442
+ } else {
10443
+ setMobileEditorSize(editorSize);
10444
+ }
10445
+ }, [isMobile, editorSize]);
10436
10446
  const handleOpenChange = useCallback(
10437
10447
  (open) => {
10438
10448
  if (open) {
@@ -10507,7 +10517,6 @@ function AvatarEditorDialog({
10507
10517
  ]
10508
10518
  }
10509
10519
  );
10510
- const mobileEditorSize = isMobile ? Math.min(editorSize + 40, window.innerWidth - 48) : editorSize;
10511
10520
  const EditorContent = /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
10512
10521
  /* @__PURE__ */ jsx(
10513
10522
  AvatarEditor,
@@ -10832,7 +10841,7 @@ function NotificationsWidget({
10832
10841
  onNotificationClick,
10833
10842
  size: size4 = "md",
10834
10843
  maxVisible = 5,
10835
- playSound: _playSound = true,
10844
+ playSound = true,
10836
10845
  soundUrl,
10837
10846
  className,
10838
10847
  emptyMessage = "No notifications",
@@ -10849,10 +10858,13 @@ function NotificationsWidget({
10849
10858
  const styles = sizeConfig[size4];
10850
10859
  const dotBgColor = dotColorConfig[dotColor];
10851
10860
  const unreadCount = notifications.filter((n) => !n.read).length;
10852
- const visibleNotifications = notifications.slice(0, maxVisible);
10861
+ const visibleNotifications = React32.useMemo(
10862
+ () => notifications.slice(0, maxVisible),
10863
+ [notifications, maxVisible]
10864
+ );
10853
10865
  const hasMore = notifications.length > maxVisible;
10854
10866
  React32.useEffect(() => {
10855
- if (soundType !== "none" && unreadCount > prevCount && prevCount > 0) {
10867
+ if (playSound && soundType !== "none" && unreadCount > prevCount && prevCount > 0) {
10856
10868
  const now = Date.now();
10857
10869
  if (now - lastSoundPlayedRef.current >= soundCooldown) {
10858
10870
  playNotificationSound(soundType, soundUrl);
@@ -10860,7 +10872,7 @@ function NotificationsWidget({
10860
10872
  }
10861
10873
  }
10862
10874
  setPrevCount(unreadCount);
10863
- }, [unreadCount, prevCount, soundType, soundUrl, soundCooldown]);
10875
+ }, [unreadCount, prevCount, soundType, soundUrl, soundCooldown, playSound]);
10864
10876
  React32.useEffect(() => {
10865
10877
  if (isOpen && onMarkAsRead) {
10866
10878
  visibleNotifications.forEach((notification) => {