@carbonid1/design-system 7.6.0 → 7.6.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.
@@ -668,10 +668,12 @@ function useMessageScrollerEngine({ autoFollow, defaultScrollPosition, scrollEdg
668
668
  scrollToBottom({ behavior: 'auto' });
669
669
  return;
670
670
  }
671
- if (restorePrependAnchor()) {
671
+ // Re-seat an anchored message before the generic prepend restore: the restore's own scroll
672
+ // event could otherwise read as someone else scrolling and let go of the message.
673
+ if (reanchorToAnchoredMessage()) {
672
674
  return;
673
675
  }
674
- if (reanchorToAnchoredMessage()) {
676
+ if (restorePrependAnchor()) {
675
677
  return;
676
678
  }
677
679
  syncAfterScroll();
@@ -711,16 +713,25 @@ function useMessageScrollerEngine({ autoFollow, defaultScrollPosition, scrollEdg
711
713
  }
712
714
  const status = measureStatus();
713
715
  const isAnchoredMode = modeRef.current === 'anchored-to-message' || modeRef.current === 'settling-jump';
714
- if (!autoFollowRef.current || !status.isAtBottom || !isAnchoredMode) {
716
+ if (autoFollowRef.current && status.isAtBottom && isAnchoredMode) {
717
+ modeRef.current = 'following-bottom';
718
+ autoscrollingRef.current = false;
719
+ bottomFollowIntentRef.current = false;
720
+ userScrollIntentRef.current = false;
721
+ anchoredElementRef.current = null;
722
+ clearSpacer();
723
+ syncAfterScroll();
715
724
  return;
716
725
  }
717
- modeRef.current = 'following-bottom';
718
- autoscrollingRef.current = false;
719
- bottomFollowIntentRef.current = false;
720
- userScrollIntentRef.current = false;
721
- anchoredElementRef.current = null;
722
- clearSpacer();
723
- syncAfterScroll();
726
+ // Past the jump, an anchored view only moves when someone else scrolls it: a scrollbar drag,
727
+ // find-in-page, or scrollIntoView. None of those fire wheel, touch, or key input, so let go of
728
+ // the message here, or the next resize or new content would snap the view back to it.
729
+ if (modeRef.current === 'anchored-to-message') {
730
+ autoscrollingRef.current = false;
731
+ bottomFollowIntentRef.current = false;
732
+ anchoredElementRef.current = null;
733
+ modeRef.current = 'free-scrolling';
734
+ }
724
735
  }, [clearSpacer, measureStatus, syncAfterScroll]);
725
736
  const markUserScrollIntent = useCallback(() => {
726
737
  userScrollIntentRef.current = true;
@@ -55,5 +55,7 @@ const ToastList = ({ richColors }) => {
55
55
  item.type === 'error' &&
56
56
  'border-destructive/40 dark:border-destructive/50 bg-[color-mix(in_oklab,var(--popover)_90%,var(--destructive))]'), children: _jsxs(BaseToast.Content, { className: "flex h-full items-start gap-3 overflow-hidden p-3 transition-opacity duration-180 ease-[cubic-bezier(0.23,1,0.32,1)] data-behind:opacity-0 data-expanded:opacity-100 motion-reduce:transition-none", children: [item.type === 'success' && (_jsx(CircleCheck, { className: "text-success-foreground mt-0.5 size-4 shrink-0", "aria-hidden": "true" })), item.type === 'error' && (_jsx(CircleAlert, { className: "text-destructive mt-0.5 size-4 shrink-0", "aria-hidden": "true" })), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx(BaseToast.Title, { className: "m-0 text-sm leading-5 font-medium break-words" }), item.description !== undefined && (_jsx(BaseToast.Description, { className: "text-muted-foreground mt-0.5 mb-0 text-sm leading-5 break-words" }))] }), (item.actionProps || item.data?.closeButton) && (_jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsx(BaseToast.Action, { className: buttonVariants({ variant: 'outline', size: 'default' }) }), item.data?.closeButton && (_jsx(BaseToast.Close, { "aria-label": "Close toast", className: buttonVariants({ variant: 'subtle', size: 'icon' }), children: _jsx(X, { "aria-hidden": "true" }) }))] }))] }) }, item.id)));
57
57
  };
58
- const Toaster = ({ className, duration = DEFAULT_DURATION, richColors = false, visibleToasts = DEFAULT_VISIBLE_TOASTS, }) => (_jsx(BaseToast.Provider, { limit: visibleToasts, timeout: duration, toastManager: toastManager, children: _jsx(BaseToast.Portal, { children: _jsx(BaseToast.Viewport, { className: cn('fixed right-[max(1rem,env(safe-area-inset-right))] bottom-[max(1rem,env(safe-area-inset-bottom))] z-50 w-[calc(100vw-2rem)] outline-none sm:right-6 sm:bottom-6 sm:w-[22.5rem]', className), children: _jsx(ToastList, { richColors: richColors }) }) }) }));
58
+ const Toaster = ({ className, duration = DEFAULT_DURATION, richColors = false, visibleToasts = DEFAULT_VISIBLE_TOASTS, }) => (_jsx(BaseToast.Provider, { limit: visibleToasts, timeout: duration, toastManager: toastManager, children: _jsx(BaseToast.Portal, { children: _jsx(BaseToast.Viewport, { className: cn(
59
+ // Toast actions must stay above dialogs and popovers, whose default layer is z-50.
60
+ 'fixed right-[max(1rem,env(safe-area-inset-right))] bottom-[max(1rem,env(safe-area-inset-bottom))] z-60 w-[calc(100vw-2rem)] outline-none sm:right-6 sm:bottom-6 sm:w-[22.5rem]', className), children: _jsx(ToastList, { richColors: richColors }) }) }) }));
59
61
  export { Toaster, toast };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonid1/design-system",
3
- "version": "7.6.0",
3
+ "version": "7.6.2",
4
4
  "description": "Shared React UI primitives + design tokens (themes, postcss config)",
5
5
  "repository": {
6
6
  "type": "git",