@landtrustinc/design-system 1.2.64 → 1.2.66

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.js CHANGED
@@ -6034,6 +6034,7 @@ var BottomDrawer = ({
6034
6034
  const containerRef = (0, import_react26.useRef)(null);
6035
6035
  const previousScrollY = (0, import_react26.useRef)(0);
6036
6036
  const previousActiveElement = (0, import_react26.useRef)(null);
6037
+ const wasOpenRef = (0, import_react26.useRef)(false);
6037
6038
  const handleKeyDown = (0, import_react26.useCallback)(
6038
6039
  (event) => {
6039
6040
  if (closeOnEscape && event.key === "Escape" && onClose) {
@@ -6044,6 +6045,7 @@ var BottomDrawer = ({
6044
6045
  );
6045
6046
  (0, import_react26.useEffect)(() => {
6046
6047
  if (isOpen) {
6048
+ wasOpenRef.current = true;
6047
6049
  previousScrollY.current = window.scrollY;
6048
6050
  previousActiveElement.current = document.activeElement;
6049
6051
  document.body.style.position = "fixed";
@@ -6054,7 +6056,8 @@ var BottomDrawer = ({
6054
6056
  if (containerRef.current) {
6055
6057
  containerRef.current.focus();
6056
6058
  }
6057
- } else {
6059
+ } else if (wasOpenRef.current) {
6060
+ wasOpenRef.current = false;
6058
6061
  document.body.style.position = "";
6059
6062
  document.body.style.overflow = "";
6060
6063
  document.body.style.width = "";
@@ -6987,8 +6990,8 @@ var useChatScrollControl = ({
6987
6990
  }) => {
6988
6991
  const scrollRef = (0, import_react39.useRef)(null);
6989
6992
  const savedScrollPosition = (0, import_react39.useRef)(0);
6990
- const previousMessagesLength = (0, import_react39.useRef)(messages.length);
6991
- const previousMessagesRef = (0, import_react39.useRef)(messages);
6993
+ const previousMessagesLengthRef = (0, import_react39.useRef)(messages.length);
6994
+ const previousIsThinkingRef = (0, import_react39.useRef)(isThinking);
6992
6995
  const userJustSentMessageRef = (0, import_react39.useRef)(false);
6993
6996
  const [isAtBottom, setIsAtBottom] = (0, import_react39.useState)(true);
6994
6997
  const [showScrollButton, setShowScrollButton] = (0, import_react39.useState)(false);
@@ -7044,11 +7047,11 @@ var useChatScrollControl = ({
7044
7047
  const el = scrollRef.current;
7045
7048
  if (!el || !isExpanded)
7046
7049
  return;
7047
- const messagesLengthChanged = messages.length !== previousMessagesLength.current;
7048
- const messagesContentChanged = messages !== previousMessagesRef.current;
7049
- previousMessagesLength.current = messages.length;
7050
- previousMessagesRef.current = messages;
7051
- if (messagesLengthChanged || messagesContentChanged || isThinking) {
7050
+ const messagesAdded = messages.length !== previousMessagesLengthRef.current;
7051
+ previousMessagesLengthRef.current = messages.length;
7052
+ const thinkingStarted = isThinking && !previousIsThinkingRef.current;
7053
+ previousIsThinkingRef.current = isThinking;
7054
+ if (messagesAdded || thinkingStarted) {
7052
7055
  if (!enableScrollToBottomControl) {
7053
7056
  requestAnimationFrame(() => {
7054
7057
  scrollToBottom("smooth");
@@ -7067,7 +7070,7 @@ var useChatScrollControl = ({
7067
7070
  }
7068
7071
  userJustSentMessageRef.current = false;
7069
7072
  }, [
7070
- messages,
7073
+ messages.length,
7071
7074
  isThinking,
7072
7075
  isExpanded,
7073
7076
  isAtBottom,
@@ -7235,6 +7238,9 @@ var ChatWidget = ({
7235
7238
  display: "flex",
7236
7239
  flexDirection: "column",
7237
7240
  gap: "var(--spacing-2)",
7241
+ css: import_react40.css`
7242
+ overscroll-behavior: contain;
7243
+ `,
7238
7244
  children: [
7239
7245
  /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(Box_default, { display: "flex", flexDirection: "column", gap: "var(--spacing-2)", children: renderedMessages }),
7240
7246
  isThinking && /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(Box_default, { css: receivedWrapperStyles, children: /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { css: thinkingRowStyles, children: [