@clubmed/usg-chat-ui 1.5.0 → 1.6.0
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/README.md +6 -3
- package/assets/style.css +1 -1
- package/chunks/ChatApiClient.js +1 -1
- package/chunks/ChatApiClient.js.map +1 -1
- package/chunks/index.js.map +1 -1
- package/chunks/index3.js.map +1 -1
- package/chunks/index5.js +3 -3
- package/chunks/index5.js.map +1 -1
- package/chunks/index7.js +1 -5
- package/chunks/index7.js.map +1 -1
- package/chunks/react.esm.js +1 -0
- package/chunks/react.esm.js.map +1 -1
- package/chunks/react.js.map +1 -1
- package/chunks/useCollaboration.js +6 -6
- package/contexts/ChatJiraContext.js +3 -3
- package/molecules/AiElements/Conversation.js +3 -3
- package/molecules/AiElements/Conversation.js.map +1 -1
- package/molecules/AiElements/PromptInput.js +4 -4
- package/molecules/AiElements/Response.js.map +1 -1
- package/molecules/Collapsibles/Collapsible.js +5 -5
- package/molecules/Collapsibles/Collapsible.js.map +1 -1
- package/molecules/Labels/Label.js.map +1 -1
- package/molecules/RichText/EditorWithAI.js +3752 -3736
- package/molecules/RichText/EditorWithAI.js.map +1 -1
- package/molecules/Tabs/Tabs.js +1 -1
- package/molecules/Tabs/Tabs.js.map +1 -1
- package/organisms/canvas/CanvasLayout.js +950 -928
- package/organisms/canvas/CanvasLayout.js.map +1 -1
- package/organisms/chat/hooks/useChat.js +74 -74
- package/organisms/chat/hooks/useChat.js.map +1 -1
- package/organisms/chat/hooks/useChat.test.d.ts +1 -0
- package/organisms/chat/hooks/useChat.test.js +218 -0
- package/organisms/chat/hooks/useChat.test.js.map +1 -0
- package/package.json +1 -1
package/chunks/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sources":["../../../../node_modules/.pnpm/zustand@5.0.10_@types+react@19.2.
|
|
1
|
+
{"version":3,"file":"react.js","sources":["../../../../node_modules/.pnpm/zustand@5.0.10_@types+react@19.2.9_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.mjs","../../../../node_modules/.pnpm/zustand@5.0.10_@types+react@19.2.9_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/react.mjs"],"sourcesContent":["const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n","import React from 'react';\nimport { createStore } from 'zustand/vanilla';\n\nconst identity = (arg) => arg;\nfunction useStore(api, selector = identity) {\n const slice = React.useSyncExternalStore(\n api.subscribe,\n React.useCallback(() => selector(api.getState()), [api, selector]),\n React.useCallback(() => selector(api.getInitialState()), [api, selector])\n );\n React.useDebugValue(slice);\n return slice;\n}\nconst createImpl = (createState) => {\n const api = createStore(createState);\n const useBoundStore = (selector) => useStore(api, selector);\n Object.assign(useBoundStore, api);\n return useBoundStore;\n};\nconst create = ((createState) => createState ? createImpl(createState) : createImpl);\n\nexport { create, useStore };\n"],"names":["createStoreImpl","createState","state","listeners","setState","partial","replace","nextState","previousState","listener","getState","api","initialState","createStore","identity","arg","useStore","selector","slice","React","createImpl","useBoundStore","create"],"mappings":";AAAA,MAAMA,IAAkB,CAACC,MAAgB;AACvC,MAAIC;AACJ,QAAMC,IAA4B,oBAAI,IAAG,GACnCC,IAAW,CAACC,GAASC,MAAY;AACrC,UAAMC,IAAY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,
|
|
7473
7473
|
Oe as p,
|
|
7474
7474
|
Lt as q,
|
|
7475
|
-
|
|
7475
|
+
ro as r,
|
|
7476
7476
|
zh as s,
|
|
7477
7477
|
Hh as t,
|
|
7478
7478
|
Zh as u,
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7479
|
+
ne as v,
|
|
7480
|
+
Kh as w,
|
|
7481
|
+
D as x,
|
|
7482
|
+
q as y,
|
|
7483
|
+
ht as z
|
|
7484
7484
|
};
|
|
7485
7485
|
//# sourceMappingURL=useCollaboration.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as C,
|
|
2
|
+
import { createContext as C, useContext as c, useState as e, useCallback as d } from "react";
|
|
3
3
|
const a = C(null);
|
|
4
4
|
function J({ children: t }) {
|
|
5
|
-
const [i, o] = e(!1), [r, n] = e({ authUrl: "", threadId: "" }), s =
|
|
5
|
+
const [i, o] = e(!1), [r, n] = e({ authUrl: "", threadId: "" }), s = d((u) => {
|
|
6
6
|
n({
|
|
7
7
|
...r,
|
|
8
8
|
...u
|
|
@@ -16,7 +16,7 @@ function J({ children: t }) {
|
|
|
16
16
|
}, children: t });
|
|
17
17
|
}
|
|
18
18
|
function p() {
|
|
19
|
-
const t =
|
|
19
|
+
const t = c(a);
|
|
20
20
|
if (!t)
|
|
21
21
|
throw new Error("useChatJira must be used within a ChatProvider");
|
|
22
22
|
return t;
|
|
@@ -3,7 +3,7 @@ import { jsx as d, jsxs as P, Fragment as V } from "react/jsx-runtime";
|
|
|
3
3
|
import { Button as W } from "../Buttons/Button.js";
|
|
4
4
|
import { cn as D } from "../../utils/cn.js";
|
|
5
5
|
import * as Y from "react";
|
|
6
|
-
import { useState as R, useRef as U, useCallback as S, useMemo as X, useImperativeHandle as Q,
|
|
6
|
+
import { useState as R, useRef as U, useCallback as S, useMemo as X, useImperativeHandle as Q, useContext as Z, useLayoutEffect as $, useEffect as ee, createContext as te } from "react";
|
|
7
7
|
import { c as ne } from "../../chunks/createLucideIcon.js";
|
|
8
8
|
/**
|
|
9
9
|
* @license lucide-react v0.545.0 - ISC
|
|
@@ -234,7 +234,7 @@ function F(...i) {
|
|
|
234
234
|
const a = JSON.stringify(r);
|
|
235
235
|
return z.has(a) || z.set(a, Object.freeze(r)), c ? "instant" : z.get(a);
|
|
236
236
|
}
|
|
237
|
-
const G =
|
|
237
|
+
const G = te(null), ue = typeof window < "u" ? $ : ee;
|
|
238
238
|
function C({ instance: i, children: r, resize: c, initial: a, mass: l, damping: x, stiffness: E, targetScrollTop: g, contextRef: b, ...f }) {
|
|
239
239
|
const p = U(null), e = Y.useCallback((u, h) => {
|
|
240
240
|
const T = (n == null ? void 0 : n.targetScrollTop) ?? g;
|
|
@@ -284,7 +284,7 @@ function C({ instance: i, children: r, resize: c, initial: a, mass: l, damping:
|
|
|
284
284
|
i.Content = r;
|
|
285
285
|
})(C || (C = {}));
|
|
286
286
|
function J() {
|
|
287
|
-
const i =
|
|
287
|
+
const i = Z(G);
|
|
288
288
|
if (!i)
|
|
289
289
|
throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");
|
|
290
290
|
return i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Conversation.js","sources":["../../../../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/arrow-down.js","../../../../../node_modules/.pnpm/use-stick-to-bottom@1.1.1_react@19.2.3/node_modules/use-stick-to-bottom/dist/useStickToBottom.js","../../../../../node_modules/.pnpm/use-stick-to-bottom@1.1.1_react@19.2.3/node_modules/use-stick-to-bottom/dist/StickToBottom.js","../../../lib/molecules/AiElements/Conversation.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M12 5v14\", key: \"s699le\" }],\n [\"path\", { d: \"m19 12-7 7-7-7\", key: \"1idqje\" }]\n];\nconst ArrowDown = createLucideIcon(\"arrow-down\", __iconNode);\n\nexport { __iconNode, ArrowDown as default };\n//# sourceMappingURL=arrow-down.js.map\n","/*!---------------------------------------------------------------------------------------------\n * Copyright (c) StackBlitz. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { useCallback, useMemo, useRef, useState, } from \"react\";\nconst DEFAULT_SPRING_ANIMATION = {\n /**\n * A value from 0 to 1, on how much to damp the animation.\n * 0 means no damping, 1 means full damping.\n *\n * @default 0.7\n */\n damping: 0.7,\n /**\n * The stiffness of how fast/slow the animation gets up to speed.\n *\n * @default 0.05\n */\n stiffness: 0.05,\n /**\n * The inertial mass associated with the animation.\n * Higher numbers make the animation slower.\n *\n * @default 1.25\n */\n mass: 1.25,\n};\nconst STICK_TO_BOTTOM_OFFSET_PX = 70;\nconst SIXTY_FPS_INTERVAL_MS = 1000 / 60;\nconst RETAIN_ANIMATION_DURATION_MS = 350;\nlet mouseDown = false;\nglobalThis.document?.addEventListener(\"mousedown\", () => {\n mouseDown = true;\n});\nglobalThis.document?.addEventListener(\"mouseup\", () => {\n mouseDown = false;\n});\nglobalThis.document?.addEventListener(\"click\", () => {\n mouseDown = false;\n});\nexport const useStickToBottom = (options = {}) => {\n const [escapedFromLock, updateEscapedFromLock] = useState(false);\n const [isAtBottom, updateIsAtBottom] = useState(options.initial !== false);\n const [isNearBottom, setIsNearBottom] = useState(false);\n const optionsRef = useRef(null);\n optionsRef.current = options;\n const isSelecting = useCallback(() => {\n if (!mouseDown) {\n return false;\n }\n const selection = window.getSelection();\n if (!selection || !selection.rangeCount) {\n return false;\n }\n const range = selection.getRangeAt(0);\n return (range.commonAncestorContainer.contains(scrollRef.current) ||\n scrollRef.current?.contains(range.commonAncestorContainer));\n }, []);\n const setIsAtBottom = useCallback((isAtBottom) => {\n state.isAtBottom = isAtBottom;\n updateIsAtBottom(isAtBottom);\n }, []);\n const setEscapedFromLock = useCallback((escapedFromLock) => {\n state.escapedFromLock = escapedFromLock;\n updateEscapedFromLock(escapedFromLock);\n }, []);\n // biome-ignore lint/correctness/useExhaustiveDependencies: not needed\n const state = useMemo(() => {\n let lastCalculation;\n return {\n escapedFromLock,\n isAtBottom,\n resizeDifference: 0,\n accumulated: 0,\n velocity: 0,\n listeners: new Set(),\n get scrollTop() {\n return scrollRef.current?.scrollTop ?? 0;\n },\n set scrollTop(scrollTop) {\n if (scrollRef.current) {\n scrollRef.current.scrollTop = scrollTop;\n state.ignoreScrollToTop = scrollRef.current.scrollTop;\n }\n },\n get targetScrollTop() {\n if (!scrollRef.current || !contentRef.current) {\n return 0;\n }\n return (scrollRef.current.scrollHeight - 1 - scrollRef.current.clientHeight);\n },\n get calculatedTargetScrollTop() {\n if (!scrollRef.current || !contentRef.current) {\n return 0;\n }\n const { targetScrollTop } = this;\n if (!options.targetScrollTop) {\n return targetScrollTop;\n }\n if (lastCalculation?.targetScrollTop === targetScrollTop) {\n return lastCalculation.calculatedScrollTop;\n }\n const calculatedScrollTop = Math.max(Math.min(options.targetScrollTop(targetScrollTop, {\n scrollElement: scrollRef.current,\n contentElement: contentRef.current,\n }), targetScrollTop), 0);\n lastCalculation = { targetScrollTop, calculatedScrollTop };\n requestAnimationFrame(() => {\n lastCalculation = undefined;\n });\n return calculatedScrollTop;\n },\n get scrollDifference() {\n return this.calculatedTargetScrollTop - this.scrollTop;\n },\n get isNearBottom() {\n return this.scrollDifference <= STICK_TO_BOTTOM_OFFSET_PX;\n },\n };\n }, []);\n const scrollToBottom = useCallback((scrollOptions = {}) => {\n if (typeof scrollOptions === \"string\") {\n scrollOptions = { animation: scrollOptions };\n }\n if (!scrollOptions.preserveScrollPosition) {\n setIsAtBottom(true);\n }\n const waitElapsed = Date.now() + (Number(scrollOptions.wait) || 0);\n const behavior = mergeAnimations(optionsRef.current, scrollOptions.animation);\n const { ignoreEscapes = false } = scrollOptions;\n let durationElapsed;\n let startTarget = state.calculatedTargetScrollTop;\n if (scrollOptions.duration instanceof Promise) {\n scrollOptions.duration.finally(() => {\n durationElapsed = Date.now();\n });\n }\n else {\n durationElapsed = waitElapsed + (scrollOptions.duration ?? 0);\n }\n const next = async () => {\n const promise = new Promise(requestAnimationFrame).then(() => {\n if (!state.isAtBottom) {\n state.animation = undefined;\n return false;\n }\n const { scrollTop } = state;\n const tick = performance.now();\n const tickDelta = (tick - (state.lastTick ?? tick)) / SIXTY_FPS_INTERVAL_MS;\n state.animation || (state.animation = { behavior, promise, ignoreEscapes });\n if (state.animation.behavior === behavior) {\n state.lastTick = tick;\n }\n if (isSelecting()) {\n return next();\n }\n if (waitElapsed > Date.now()) {\n return next();\n }\n if (scrollTop < Math.min(startTarget, state.calculatedTargetScrollTop)) {\n if (state.animation?.behavior === behavior) {\n if (behavior === \"instant\") {\n state.scrollTop = state.calculatedTargetScrollTop;\n return next();\n }\n state.velocity =\n (behavior.damping * state.velocity +\n behavior.stiffness * state.scrollDifference) /\n behavior.mass;\n state.accumulated += state.velocity * tickDelta;\n state.scrollTop += state.accumulated;\n if (state.scrollTop !== scrollTop) {\n state.accumulated = 0;\n }\n }\n return next();\n }\n if (durationElapsed > Date.now()) {\n startTarget = state.calculatedTargetScrollTop;\n return next();\n }\n state.animation = undefined;\n /**\n * If we're still below the target, then queue\n * up another scroll to the bottom with the last\n * requested animatino.\n */\n if (state.scrollTop < state.calculatedTargetScrollTop) {\n return scrollToBottom({\n animation: mergeAnimations(optionsRef.current, optionsRef.current.resize),\n ignoreEscapes,\n duration: Math.max(0, durationElapsed - Date.now()) || undefined,\n });\n }\n return state.isAtBottom;\n });\n return promise.then((isAtBottom) => {\n requestAnimationFrame(() => {\n if (!state.animation) {\n state.lastTick = undefined;\n state.velocity = 0;\n }\n });\n return isAtBottom;\n });\n };\n if (scrollOptions.wait !== true) {\n state.animation = undefined;\n }\n if (state.animation?.behavior === behavior) {\n return state.animation.promise;\n }\n return next();\n }, [setIsAtBottom, isSelecting, state]);\n const stopScroll = useCallback(() => {\n setEscapedFromLock(true);\n setIsAtBottom(false);\n }, [setEscapedFromLock, setIsAtBottom]);\n const handleScroll = useCallback(({ target }) => {\n if (target !== scrollRef.current) {\n return;\n }\n const { scrollTop, ignoreScrollToTop } = state;\n let { lastScrollTop = scrollTop } = state;\n state.lastScrollTop = scrollTop;\n state.ignoreScrollToTop = undefined;\n if (ignoreScrollToTop && ignoreScrollToTop > scrollTop) {\n /**\n * When the user scrolls up while the animation plays, the `scrollTop` may\n * not come in separate events; if this happens, to make sure `isScrollingUp`\n * is correct, set the lastScrollTop to the ignored event.\n */\n lastScrollTop = ignoreScrollToTop;\n }\n setIsNearBottom(state.isNearBottom);\n /**\n * Scroll events may come before a ResizeObserver event,\n * so in order to ignore resize events correctly we use a\n * timeout.\n *\n * @see https://github.com/WICG/resize-observer/issues/25#issuecomment-248757228\n */\n setTimeout(() => {\n /**\n * When theres a resize difference ignore the resize event.\n */\n if (state.resizeDifference || scrollTop === ignoreScrollToTop) {\n return;\n }\n if (isSelecting()) {\n setEscapedFromLock(true);\n setIsAtBottom(false);\n return;\n }\n const isScrollingDown = scrollTop > lastScrollTop;\n const isScrollingUp = scrollTop < lastScrollTop;\n if (state.animation?.ignoreEscapes) {\n state.scrollTop = lastScrollTop;\n return;\n }\n if (isScrollingUp) {\n setEscapedFromLock(true);\n setIsAtBottom(false);\n }\n if (isScrollingDown) {\n setEscapedFromLock(false);\n }\n if (!state.escapedFromLock && state.isNearBottom) {\n setIsAtBottom(true);\n }\n }, 1);\n }, [setEscapedFromLock, setIsAtBottom, isSelecting, state]);\n const handleWheel = useCallback(({ target, deltaY }) => {\n let element = target;\n while (![\"scroll\", \"auto\"].includes(getComputedStyle(element).overflow)) {\n if (!element.parentElement) {\n return;\n }\n element = element.parentElement;\n }\n /**\n * The browser may cancel the scrolling from the mouse wheel\n * if we update it from the animation in meantime.\n * To prevent this, always escape when the wheel is scrolled up.\n */\n if (element === scrollRef.current &&\n deltaY < 0 &&\n scrollRef.current.scrollHeight > scrollRef.current.clientHeight &&\n !state.animation?.ignoreEscapes) {\n setEscapedFromLock(true);\n setIsAtBottom(false);\n }\n }, [setEscapedFromLock, setIsAtBottom, state]);\n const scrollRef = useRefCallback((scroll) => {\n scrollRef.current?.removeEventListener(\"scroll\", handleScroll);\n scrollRef.current?.removeEventListener(\"wheel\", handleWheel);\n scroll?.addEventListener(\"scroll\", handleScroll, { passive: true });\n scroll?.addEventListener(\"wheel\", handleWheel, { passive: true });\n }, []);\n const contentRef = useRefCallback((content) => {\n state.resizeObserver?.disconnect();\n if (!content) {\n return;\n }\n let previousHeight;\n state.resizeObserver = new ResizeObserver(([entry]) => {\n const { height } = entry.contentRect;\n const difference = height - (previousHeight ?? height);\n state.resizeDifference = difference;\n /**\n * Sometimes the browser can overscroll past the target,\n * so check for this and adjust appropriately.\n */\n if (state.scrollTop > state.targetScrollTop) {\n state.scrollTop = state.targetScrollTop;\n }\n setIsNearBottom(state.isNearBottom);\n if (difference >= 0) {\n /**\n * If it's a positive resize, scroll to the bottom when\n * we're already at the bottom.\n */\n const animation = mergeAnimations(optionsRef.current, previousHeight\n ? optionsRef.current.resize\n : optionsRef.current.initial);\n scrollToBottom({\n animation,\n wait: true,\n preserveScrollPosition: true,\n duration: animation === \"instant\" ? undefined : RETAIN_ANIMATION_DURATION_MS,\n });\n }\n else {\n /**\n * Else if it's a negative resize, check if we're near the bottom\n * if we are want to un-escape from the lock, because the resize\n * could have caused the container to be at the bottom.\n */\n if (state.isNearBottom) {\n setEscapedFromLock(false);\n setIsAtBottom(true);\n }\n }\n previousHeight = height;\n /**\n * Reset the resize difference after the scroll event\n * has fired. Requires a rAF to wait for the scroll event,\n * and a setTimeout to wait for the other timeout we have in\n * resizeObserver in case the scroll event happens after the\n * resize event.\n */\n requestAnimationFrame(() => {\n setTimeout(() => {\n if (state.resizeDifference === difference) {\n state.resizeDifference = 0;\n }\n }, 1);\n });\n });\n state.resizeObserver?.observe(content);\n }, []);\n return {\n contentRef,\n scrollRef,\n scrollToBottom,\n stopScroll,\n isAtBottom: isAtBottom || isNearBottom,\n isNearBottom,\n escapedFromLock,\n state,\n };\n};\nfunction useRefCallback(callback, deps) {\n // biome-ignore lint/correctness/useExhaustiveDependencies: not needed\n const result = useCallback((ref) => {\n result.current = ref;\n return callback(ref);\n }, deps);\n return result;\n}\nconst animationCache = new Map();\nfunction mergeAnimations(...animations) {\n const result = { ...DEFAULT_SPRING_ANIMATION };\n let instant = false;\n for (const animation of animations) {\n if (animation === \"instant\") {\n instant = true;\n continue;\n }\n if (typeof animation !== \"object\") {\n continue;\n }\n instant = false;\n result.damping = animation.damping ?? result.damping;\n result.stiffness = animation.stiffness ?? result.stiffness;\n result.mass = animation.mass ?? result.mass;\n }\n const key = JSON.stringify(result);\n if (!animationCache.has(key)) {\n animationCache.set(key, Object.freeze(result));\n }\n return instant ? \"instant\" : animationCache.get(key);\n}\n","import { jsx as _jsx } from \"react/jsx-runtime\";\n/*!---------------------------------------------------------------------------------------------\n * Copyright (c) StackBlitz. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport { createContext, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, } from \"react\";\nimport { useStickToBottom, } from \"./useStickToBottom.js\";\nconst StickToBottomContext = createContext(null);\nconst useIsomorphicLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\nexport function StickToBottom({ instance, children, resize, initial, mass, damping, stiffness, targetScrollTop: currentTargetScrollTop, contextRef, ...props }) {\n const customTargetScrollTop = useRef(null);\n const targetScrollTop = React.useCallback((target, elements) => {\n const get = context?.targetScrollTop ?? currentTargetScrollTop;\n return get?.(target, elements) ?? target;\n }, [currentTargetScrollTop]);\n const defaultInstance = useStickToBottom({\n mass,\n damping,\n stiffness,\n resize,\n initial,\n targetScrollTop,\n });\n const { scrollRef, contentRef, scrollToBottom, stopScroll, isAtBottom, escapedFromLock, state, } = instance ?? defaultInstance;\n const context = useMemo(() => ({\n scrollToBottom,\n stopScroll,\n scrollRef,\n isAtBottom,\n escapedFromLock,\n contentRef,\n state,\n get targetScrollTop() {\n return customTargetScrollTop.current;\n },\n set targetScrollTop(targetScrollTop) {\n customTargetScrollTop.current = targetScrollTop;\n },\n }), [\n scrollToBottom,\n isAtBottom,\n contentRef,\n scrollRef,\n stopScroll,\n escapedFromLock,\n state,\n ]);\n useImperativeHandle(contextRef, () => context, [context]);\n useIsomorphicLayoutEffect(() => {\n if (!scrollRef.current) {\n return;\n }\n if (getComputedStyle(scrollRef.current).overflow === \"visible\") {\n scrollRef.current.style.overflow = \"auto\";\n }\n }, []);\n return (_jsx(StickToBottomContext.Provider, { value: context, children: _jsx(\"div\", { ...props, children: typeof children === \"function\" ? children(context) : children }) }));\n}\n(function (StickToBottom) {\n function Content({ children, ...props }) {\n const context = useStickToBottomContext();\n return (_jsx(\"div\", { ref: context.scrollRef, style: {\n height: \"100%\",\n width: \"100%\",\n }, children: _jsx(\"div\", { ...props, ref: context.contentRef, children: typeof children === \"function\" ? children(context) : children }) }));\n }\n StickToBottom.Content = Content;\n})(StickToBottom || (StickToBottom = {}));\n/**\n * Use this hook inside a <StickToBottom> component to gain access to whether the component is at the bottom of the scrollable area.\n */\nexport function useStickToBottomContext() {\n const context = useContext(StickToBottomContext);\n if (!context) {\n throw new Error(\"use-stick-to-bottom component context must be used within a StickToBottom component\");\n }\n return context;\n}\n","\"use client\";\n\nimport { Button } from \"@clubmed/usg-chat-ui/molecules/Buttons/Button\";\nimport { cn } from \"@clubmed/usg-chat-ui/utils/cn\";\nimport { ArrowDownIcon } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { useCallback } from \"react\";\nimport { StickToBottom, useStickToBottomContext } from \"use-stick-to-bottom\";\n\nexport type ConversationProps = ComponentProps<typeof StickToBottom>;\n\nexport const Conversation = ({ className, ...props }: ConversationProps) => (\n <StickToBottom\n className={cn(\"relative flex-1 overflow-y-auto\", className)}\n initial=\"smooth\"\n resize=\"smooth\"\n role=\"log\"\n {...props}\n />\n);\n\nexport type ConversationContentProps = ComponentProps<\n typeof StickToBottom.Content\n>;\n\nexport const ConversationContent = ({\n className,\n ...props\n}: ConversationContentProps) => (\n <StickToBottom.Content className={cn(\"p-4 min-h-full flex flex-col\", className)} {...props} />\n);\n\nexport type ConversationEmptyStateProps = ComponentProps<\"div\"> & {\n title?: string;\n description?: string;\n icon?: React.ReactNode;\n greeting?: string;\n};\n\nexport const ConversationEmptyState = ({\n className,\n title = \"No messages yet\",\n description = \"Start a conversation to see messages here\",\n icon,\n greeting,\n children,\n ...props\n}: ConversationEmptyStateProps) => (\n <div\n className={cn(\n \"flex flex-1 flex-col items-center justify-center gap-6 p-8 text-center animate-bounceEnter\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n {icon && <div className=\"text-muted-foreground animate-bounceEnter animation-delay-300 flex-shrink-0\">{icon}</div>}\n <div className=\"space-y-3 animate-bounceEnter animation-delay-500 flex-shrink-0\">\n {greeting && (\n <p className=\"text-xl font-medium text-foreground animate-bounceEnter\">{greeting}</p>\n )}\n <h3 className=\"font-semibold text-lg sm:text-xl text-foreground\">{title}</h3>\n {description && (\n <p className=\"text-muted-foreground text-sm sm:text-base max-w-md leading-relaxed mx-auto\">{description}</p>\n )}\n </div>\n </>\n )}\n </div>\n);\n\nexport type ConversationScrollButtonProps = ComponentProps<typeof Button>;\n\nexport const ConversationScrollButton = ({\n className,\n ...props\n}: ConversationScrollButtonProps) => {\n const { isAtBottom, scrollToBottom } = useStickToBottomContext();\n\n const handleScrollToBottom = useCallback(() => {\n scrollToBottom();\n }, [scrollToBottom]);\n\n return (\n !isAtBottom && (\n <Button\n className={cn(\n \"absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full\",\n className\n )}\n onClick={handleScrollToBottom}\n size=\"icon\"\n type=\"button\"\n variant=\"outline\"\n {...props}\n >\n <ArrowDownIcon className=\"size-4\" />\n </Button>\n )\n );\n};\n"],"names":["__iconNode","ArrowDown","createLucideIcon","DEFAULT_SPRING_ANIMATION","STICK_TO_BOTTOM_OFFSET_PX","SIXTY_FPS_INTERVAL_MS","RETAIN_ANIMATION_DURATION_MS","mouseDown","_a","useStickToBottom","options","escapedFromLock","updateEscapedFromLock","useState","isAtBottom","updateIsAtBottom","isNearBottom","setIsNearBottom","optionsRef","useRef","isSelecting","useCallback","selection","range","scrollRef","setIsAtBottom","state","setEscapedFromLock","useMemo","lastCalculation","scrollTop","contentRef","targetScrollTop","calculatedScrollTop","scrollToBottom","scrollOptions","waitElapsed","behavior","mergeAnimations","ignoreEscapes","durationElapsed","startTarget","next","promise","tick","tickDelta","stopScroll","handleScroll","target","ignoreScrollToTop","lastScrollTop","isScrollingDown","isScrollingUp","handleWheel","deltaY","element","useRefCallback","scroll","_b","content","previousHeight","entry","height","difference","animation","callback","deps","result","ref","animationCache","animations","instant","key","StickToBottomContext","createContext","useIsomorphicLayoutEffect","useLayoutEffect","useEffect","StickToBottom","instance","children","resize","initial","mass","damping","stiffness","currentTargetScrollTop","contextRef","props","customTargetScrollTop","React","elements","get","context","defaultInstance","useImperativeHandle","_jsx","Content","useStickToBottomContext","useContext","Conversation","className","jsx","cn","ConversationContent","ConversationEmptyState","title","description","icon","greeting","jsxs","Fragment","ConversationScrollButton","handleScrollToBottom","Button","ArrowDownIcon"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,kBAAkB,KAAK,SAAQ,CAAE;AACjD,GACMC,KAAYC,GAAiB,cAAcF,EAAU;ACb3D;AAAA;AAAA;AAAA;AAKA,MAAMG,KAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA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,UAAAO,GAAS;AAAA,QAEnF,gBAAAP,EAAC,MAAA,EAAG,WAAU,oDAAoD,UAAAI,GAAM;AAAA,QACvEC,KACC,gBAAAL,EAAC,KAAA,EAAE,WAAU,+EAA+E,UAAAK,EAAA,CAAY;AAAA,MAAA,EAAA,CAE5G;AAAA,IAAA,EAAA,CACF;AAAA,EAAA;AAEJ,GAKWK,KAA2B,CAAC;AAAA,EACvC,WAAAX;AAAA,EACA,GAAGb;AACL,MAAqC;AACnC,QAAM,EAAE,YAAA1E,GAAY,gBAAAoB,EAAA,IAAmBgE,EAAA,GAEjCe,IAAuB5F,EAAY,MAAM;AAC7C,IAAAa,EAAA;AAAA,EACF,GAAG,CAACA,CAAc,CAAC;AAEnB,SACE,CAACpB,KACC,gBAAAwF;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,WAAWX;AAAA,QACT;AAAA,QACAF;AAAA,MAAA;AAAA,MAEF,SAASY;AAAA,MACT,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAGzB;AAAA,MAEJ,UAAA,gBAAAc,EAACa,IAAA,EAAc,WAAU,SAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAI1C;","x_google_ignoreList":[0,1,2]}
|
|
1
|
+
{"version":3,"file":"Conversation.js","sources":["../../../../../node_modules/.pnpm/lucide-react@0.545.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/arrow-down.js","../../../../../node_modules/.pnpm/use-stick-to-bottom@1.1.1_react@19.2.3/node_modules/use-stick-to-bottom/dist/useStickToBottom.js","../../../../../node_modules/.pnpm/use-stick-to-bottom@1.1.1_react@19.2.3/node_modules/use-stick-to-bottom/dist/StickToBottom.js","../../../lib/molecules/AiElements/Conversation.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.545.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M12 5v14\", key: \"s699le\" }],\n [\"path\", { d: \"m19 12-7 7-7-7\", key: \"1idqje\" }]\n];\nconst ArrowDown = createLucideIcon(\"arrow-down\", __iconNode);\n\nexport { __iconNode, ArrowDown as default };\n//# sourceMappingURL=arrow-down.js.map\n","/*!---------------------------------------------------------------------------------------------\n * Copyright (c) StackBlitz. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport { useCallback, useMemo, useRef, useState, } from \"react\";\nconst DEFAULT_SPRING_ANIMATION = {\n /**\n * A value from 0 to 1, on how much to damp the animation.\n * 0 means no damping, 1 means full damping.\n *\n * @default 0.7\n */\n damping: 0.7,\n /**\n * The stiffness of how fast/slow the animation gets up to speed.\n *\n * @default 0.05\n */\n stiffness: 0.05,\n /**\n * The inertial mass associated with the animation.\n * Higher numbers make the animation slower.\n *\n * @default 1.25\n */\n mass: 1.25,\n};\nconst STICK_TO_BOTTOM_OFFSET_PX = 70;\nconst SIXTY_FPS_INTERVAL_MS = 1000 / 60;\nconst RETAIN_ANIMATION_DURATION_MS = 350;\nlet mouseDown = false;\nglobalThis.document?.addEventListener(\"mousedown\", () => {\n mouseDown = true;\n});\nglobalThis.document?.addEventListener(\"mouseup\", () => {\n mouseDown = false;\n});\nglobalThis.document?.addEventListener(\"click\", () => {\n mouseDown = false;\n});\nexport const useStickToBottom = (options = {}) => {\n const [escapedFromLock, updateEscapedFromLock] = useState(false);\n const [isAtBottom, updateIsAtBottom] = useState(options.initial !== false);\n const [isNearBottom, setIsNearBottom] = useState(false);\n const optionsRef = useRef(null);\n optionsRef.current = options;\n const isSelecting = useCallback(() => {\n if (!mouseDown) {\n return false;\n }\n const selection = window.getSelection();\n if (!selection || !selection.rangeCount) {\n return false;\n }\n const range = selection.getRangeAt(0);\n return (range.commonAncestorContainer.contains(scrollRef.current) ||\n scrollRef.current?.contains(range.commonAncestorContainer));\n }, []);\n const setIsAtBottom = useCallback((isAtBottom) => {\n state.isAtBottom = isAtBottom;\n updateIsAtBottom(isAtBottom);\n }, []);\n const setEscapedFromLock = useCallback((escapedFromLock) => {\n state.escapedFromLock = escapedFromLock;\n updateEscapedFromLock(escapedFromLock);\n }, []);\n // biome-ignore lint/correctness/useExhaustiveDependencies: not needed\n const state = useMemo(() => {\n let lastCalculation;\n return {\n escapedFromLock,\n isAtBottom,\n resizeDifference: 0,\n accumulated: 0,\n velocity: 0,\n listeners: new Set(),\n get scrollTop() {\n return scrollRef.current?.scrollTop ?? 0;\n },\n set scrollTop(scrollTop) {\n if (scrollRef.current) {\n scrollRef.current.scrollTop = scrollTop;\n state.ignoreScrollToTop = scrollRef.current.scrollTop;\n }\n },\n get targetScrollTop() {\n if (!scrollRef.current || !contentRef.current) {\n return 0;\n }\n return (scrollRef.current.scrollHeight - 1 - scrollRef.current.clientHeight);\n },\n get calculatedTargetScrollTop() {\n if (!scrollRef.current || !contentRef.current) {\n return 0;\n }\n const { targetScrollTop } = this;\n if (!options.targetScrollTop) {\n return targetScrollTop;\n }\n if (lastCalculation?.targetScrollTop === targetScrollTop) {\n return lastCalculation.calculatedScrollTop;\n }\n const calculatedScrollTop = Math.max(Math.min(options.targetScrollTop(targetScrollTop, {\n scrollElement: scrollRef.current,\n contentElement: contentRef.current,\n }), targetScrollTop), 0);\n lastCalculation = { targetScrollTop, calculatedScrollTop };\n requestAnimationFrame(() => {\n lastCalculation = undefined;\n });\n return calculatedScrollTop;\n },\n get scrollDifference() {\n return this.calculatedTargetScrollTop - this.scrollTop;\n },\n get isNearBottom() {\n return this.scrollDifference <= STICK_TO_BOTTOM_OFFSET_PX;\n },\n };\n }, []);\n const scrollToBottom = useCallback((scrollOptions = {}) => {\n if (typeof scrollOptions === \"string\") {\n scrollOptions = { animation: scrollOptions };\n }\n if (!scrollOptions.preserveScrollPosition) {\n setIsAtBottom(true);\n }\n const waitElapsed = Date.now() + (Number(scrollOptions.wait) || 0);\n const behavior = mergeAnimations(optionsRef.current, scrollOptions.animation);\n const { ignoreEscapes = false } = scrollOptions;\n let durationElapsed;\n let startTarget = state.calculatedTargetScrollTop;\n if (scrollOptions.duration instanceof Promise) {\n scrollOptions.duration.finally(() => {\n durationElapsed = Date.now();\n });\n }\n else {\n durationElapsed = waitElapsed + (scrollOptions.duration ?? 0);\n }\n const next = async () => {\n const promise = new Promise(requestAnimationFrame).then(() => {\n if (!state.isAtBottom) {\n state.animation = undefined;\n return false;\n }\n const { scrollTop } = state;\n const tick = performance.now();\n const tickDelta = (tick - (state.lastTick ?? tick)) / SIXTY_FPS_INTERVAL_MS;\n state.animation || (state.animation = { behavior, promise, ignoreEscapes });\n if (state.animation.behavior === behavior) {\n state.lastTick = tick;\n }\n if (isSelecting()) {\n return next();\n }\n if (waitElapsed > Date.now()) {\n return next();\n }\n if (scrollTop < Math.min(startTarget, state.calculatedTargetScrollTop)) {\n if (state.animation?.behavior === behavior) {\n if (behavior === \"instant\") {\n state.scrollTop = state.calculatedTargetScrollTop;\n return next();\n }\n state.velocity =\n (behavior.damping * state.velocity +\n behavior.stiffness * state.scrollDifference) /\n behavior.mass;\n state.accumulated += state.velocity * tickDelta;\n state.scrollTop += state.accumulated;\n if (state.scrollTop !== scrollTop) {\n state.accumulated = 0;\n }\n }\n return next();\n }\n if (durationElapsed > Date.now()) {\n startTarget = state.calculatedTargetScrollTop;\n return next();\n }\n state.animation = undefined;\n /**\n * If we're still below the target, then queue\n * up another scroll to the bottom with the last\n * requested animatino.\n */\n if (state.scrollTop < state.calculatedTargetScrollTop) {\n return scrollToBottom({\n animation: mergeAnimations(optionsRef.current, optionsRef.current.resize),\n ignoreEscapes,\n duration: Math.max(0, durationElapsed - Date.now()) || undefined,\n });\n }\n return state.isAtBottom;\n });\n return promise.then((isAtBottom) => {\n requestAnimationFrame(() => {\n if (!state.animation) {\n state.lastTick = undefined;\n state.velocity = 0;\n }\n });\n return isAtBottom;\n });\n };\n if (scrollOptions.wait !== true) {\n state.animation = undefined;\n }\n if (state.animation?.behavior === behavior) {\n return state.animation.promise;\n }\n return next();\n }, [setIsAtBottom, isSelecting, state]);\n const stopScroll = useCallback(() => {\n setEscapedFromLock(true);\n setIsAtBottom(false);\n }, [setEscapedFromLock, setIsAtBottom]);\n const handleScroll = useCallback(({ target }) => {\n if (target !== scrollRef.current) {\n return;\n }\n const { scrollTop, ignoreScrollToTop } = state;\n let { lastScrollTop = scrollTop } = state;\n state.lastScrollTop = scrollTop;\n state.ignoreScrollToTop = undefined;\n if (ignoreScrollToTop && ignoreScrollToTop > scrollTop) {\n /**\n * When the user scrolls up while the animation plays, the `scrollTop` may\n * not come in separate events; if this happens, to make sure `isScrollingUp`\n * is correct, set the lastScrollTop to the ignored event.\n */\n lastScrollTop = ignoreScrollToTop;\n }\n setIsNearBottom(state.isNearBottom);\n /**\n * Scroll events may come before a ResizeObserver event,\n * so in order to ignore resize events correctly we use a\n * timeout.\n *\n * @see https://github.com/WICG/resize-observer/issues/25#issuecomment-248757228\n */\n setTimeout(() => {\n /**\n * When theres a resize difference ignore the resize event.\n */\n if (state.resizeDifference || scrollTop === ignoreScrollToTop) {\n return;\n }\n if (isSelecting()) {\n setEscapedFromLock(true);\n setIsAtBottom(false);\n return;\n }\n const isScrollingDown = scrollTop > lastScrollTop;\n const isScrollingUp = scrollTop < lastScrollTop;\n if (state.animation?.ignoreEscapes) {\n state.scrollTop = lastScrollTop;\n return;\n }\n if (isScrollingUp) {\n setEscapedFromLock(true);\n setIsAtBottom(false);\n }\n if (isScrollingDown) {\n setEscapedFromLock(false);\n }\n if (!state.escapedFromLock && state.isNearBottom) {\n setIsAtBottom(true);\n }\n }, 1);\n }, [setEscapedFromLock, setIsAtBottom, isSelecting, state]);\n const handleWheel = useCallback(({ target, deltaY }) => {\n let element = target;\n while (![\"scroll\", \"auto\"].includes(getComputedStyle(element).overflow)) {\n if (!element.parentElement) {\n return;\n }\n element = element.parentElement;\n }\n /**\n * The browser may cancel the scrolling from the mouse wheel\n * if we update it from the animation in meantime.\n * To prevent this, always escape when the wheel is scrolled up.\n */\n if (element === scrollRef.current &&\n deltaY < 0 &&\n scrollRef.current.scrollHeight > scrollRef.current.clientHeight &&\n !state.animation?.ignoreEscapes) {\n setEscapedFromLock(true);\n setIsAtBottom(false);\n }\n }, [setEscapedFromLock, setIsAtBottom, state]);\n const scrollRef = useRefCallback((scroll) => {\n scrollRef.current?.removeEventListener(\"scroll\", handleScroll);\n scrollRef.current?.removeEventListener(\"wheel\", handleWheel);\n scroll?.addEventListener(\"scroll\", handleScroll, { passive: true });\n scroll?.addEventListener(\"wheel\", handleWheel, { passive: true });\n }, []);\n const contentRef = useRefCallback((content) => {\n state.resizeObserver?.disconnect();\n if (!content) {\n return;\n }\n let previousHeight;\n state.resizeObserver = new ResizeObserver(([entry]) => {\n const { height } = entry.contentRect;\n const difference = height - (previousHeight ?? height);\n state.resizeDifference = difference;\n /**\n * Sometimes the browser can overscroll past the target,\n * so check for this and adjust appropriately.\n */\n if (state.scrollTop > state.targetScrollTop) {\n state.scrollTop = state.targetScrollTop;\n }\n setIsNearBottom(state.isNearBottom);\n if (difference >= 0) {\n /**\n * If it's a positive resize, scroll to the bottom when\n * we're already at the bottom.\n */\n const animation = mergeAnimations(optionsRef.current, previousHeight\n ? optionsRef.current.resize\n : optionsRef.current.initial);\n scrollToBottom({\n animation,\n wait: true,\n preserveScrollPosition: true,\n duration: animation === \"instant\" ? undefined : RETAIN_ANIMATION_DURATION_MS,\n });\n }\n else {\n /**\n * Else if it's a negative resize, check if we're near the bottom\n * if we are want to un-escape from the lock, because the resize\n * could have caused the container to be at the bottom.\n */\n if (state.isNearBottom) {\n setEscapedFromLock(false);\n setIsAtBottom(true);\n }\n }\n previousHeight = height;\n /**\n * Reset the resize difference after the scroll event\n * has fired. Requires a rAF to wait for the scroll event,\n * and a setTimeout to wait for the other timeout we have in\n * resizeObserver in case the scroll event happens after the\n * resize event.\n */\n requestAnimationFrame(() => {\n setTimeout(() => {\n if (state.resizeDifference === difference) {\n state.resizeDifference = 0;\n }\n }, 1);\n });\n });\n state.resizeObserver?.observe(content);\n }, []);\n return {\n contentRef,\n scrollRef,\n scrollToBottom,\n stopScroll,\n isAtBottom: isAtBottom || isNearBottom,\n isNearBottom,\n escapedFromLock,\n state,\n };\n};\nfunction useRefCallback(callback, deps) {\n // biome-ignore lint/correctness/useExhaustiveDependencies: not needed\n const result = useCallback((ref) => {\n result.current = ref;\n return callback(ref);\n }, deps);\n return result;\n}\nconst animationCache = new Map();\nfunction mergeAnimations(...animations) {\n const result = { ...DEFAULT_SPRING_ANIMATION };\n let instant = false;\n for (const animation of animations) {\n if (animation === \"instant\") {\n instant = true;\n continue;\n }\n if (typeof animation !== \"object\") {\n continue;\n }\n instant = false;\n result.damping = animation.damping ?? result.damping;\n result.stiffness = animation.stiffness ?? result.stiffness;\n result.mass = animation.mass ?? result.mass;\n }\n const key = JSON.stringify(result);\n if (!animationCache.has(key)) {\n animationCache.set(key, Object.freeze(result));\n }\n return instant ? \"instant\" : animationCache.get(key);\n}\n","import { jsx as _jsx } from \"react/jsx-runtime\";\n/*!---------------------------------------------------------------------------------------------\n * Copyright (c) StackBlitz. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport { createContext, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, } from \"react\";\nimport { useStickToBottom, } from \"./useStickToBottom.js\";\nconst StickToBottomContext = createContext(null);\nconst useIsomorphicLayoutEffect = typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\nexport function StickToBottom({ instance, children, resize, initial, mass, damping, stiffness, targetScrollTop: currentTargetScrollTop, contextRef, ...props }) {\n const customTargetScrollTop = useRef(null);\n const targetScrollTop = React.useCallback((target, elements) => {\n const get = context?.targetScrollTop ?? currentTargetScrollTop;\n return get?.(target, elements) ?? target;\n }, [currentTargetScrollTop]);\n const defaultInstance = useStickToBottom({\n mass,\n damping,\n stiffness,\n resize,\n initial,\n targetScrollTop,\n });\n const { scrollRef, contentRef, scrollToBottom, stopScroll, isAtBottom, escapedFromLock, state, } = instance ?? defaultInstance;\n const context = useMemo(() => ({\n scrollToBottom,\n stopScroll,\n scrollRef,\n isAtBottom,\n escapedFromLock,\n contentRef,\n state,\n get targetScrollTop() {\n return customTargetScrollTop.current;\n },\n set targetScrollTop(targetScrollTop) {\n customTargetScrollTop.current = targetScrollTop;\n },\n }), [\n scrollToBottom,\n isAtBottom,\n contentRef,\n scrollRef,\n stopScroll,\n escapedFromLock,\n state,\n ]);\n useImperativeHandle(contextRef, () => context, [context]);\n useIsomorphicLayoutEffect(() => {\n if (!scrollRef.current) {\n return;\n }\n if (getComputedStyle(scrollRef.current).overflow === \"visible\") {\n scrollRef.current.style.overflow = \"auto\";\n }\n }, []);\n return (_jsx(StickToBottomContext.Provider, { value: context, children: _jsx(\"div\", { ...props, children: typeof children === \"function\" ? children(context) : children }) }));\n}\n(function (StickToBottom) {\n function Content({ children, ...props }) {\n const context = useStickToBottomContext();\n return (_jsx(\"div\", { ref: context.scrollRef, style: {\n height: \"100%\",\n width: \"100%\",\n }, children: _jsx(\"div\", { ...props, ref: context.contentRef, children: typeof children === \"function\" ? children(context) : children }) }));\n }\n StickToBottom.Content = Content;\n})(StickToBottom || (StickToBottom = {}));\n/**\n * Use this hook inside a <StickToBottom> component to gain access to whether the component is at the bottom of the scrollable area.\n */\nexport function useStickToBottomContext() {\n const context = useContext(StickToBottomContext);\n if (!context) {\n throw new Error(\"use-stick-to-bottom component context must be used within a StickToBottom component\");\n }\n return context;\n}\n","\"use client\";\n\nimport { Button } from \"@clubmed/usg-chat-ui/molecules/Buttons/Button\";\nimport { cn } from \"@clubmed/usg-chat-ui/utils/cn\";\nimport { ArrowDownIcon } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { useCallback } from \"react\";\nimport { StickToBottom, useStickToBottomContext } from \"use-stick-to-bottom\";\n\nexport type ConversationProps = ComponentProps<typeof StickToBottom>;\n\nexport const Conversation = ({ className, ...props }: ConversationProps) => (\n <StickToBottom\n className={cn(\"relative flex-1 overflow-y-auto\", className)}\n initial=\"smooth\"\n resize=\"smooth\"\n role=\"log\"\n {...props}\n />\n);\n\nexport type ConversationContentProps = ComponentProps<\n typeof StickToBottom.Content\n>;\n\nexport const ConversationContent = ({\n className,\n ...props\n}: ConversationContentProps) => (\n <StickToBottom.Content className={cn(\"p-4 min-h-full flex flex-col\", className)} {...props} />\n);\n\nexport type ConversationEmptyStateProps = ComponentProps<\"div\"> & {\n title?: string;\n description?: string;\n icon?: React.ReactNode;\n greeting?: string;\n};\n\nexport const ConversationEmptyState = ({\n className,\n title = \"No messages yet\",\n description = \"Start a conversation to see messages here\",\n icon,\n greeting,\n children,\n ...props\n}: ConversationEmptyStateProps) => (\n <div\n className={cn(\n \"flex flex-1 flex-col items-center justify-center gap-6 p-8 text-center animate-bounceEnter\",\n className\n )}\n {...props}\n >\n {children ?? (\n <>\n {icon && <div className=\"text-muted-foreground animate-bounceEnter animation-delay-300 flex-shrink-0\">{icon}</div>}\n <div className=\"space-y-3 animate-bounceEnter animation-delay-500 flex-shrink-0\">\n {greeting && (\n <p className=\"text-xl font-medium text-foreground animate-bounceEnter\">{greeting}</p>\n )}\n <h3 className=\"font-semibold text-lg sm:text-xl text-foreground\">{title}</h3>\n {description && (\n <p className=\"text-muted-foreground text-sm sm:text-base max-w-md leading-relaxed mx-auto\">{description}</p>\n )}\n </div>\n </>\n )}\n </div>\n);\n\nexport type ConversationScrollButtonProps = ComponentProps<typeof Button>;\n\nexport const ConversationScrollButton = ({\n className,\n ...props\n}: ConversationScrollButtonProps) => {\n const { isAtBottom, scrollToBottom } = useStickToBottomContext();\n\n const handleScrollToBottom = useCallback(() => {\n scrollToBottom();\n }, [scrollToBottom]);\n\n return (\n !isAtBottom && (\n <Button\n className={cn(\n \"absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full\",\n className\n )}\n onClick={handleScrollToBottom}\n size=\"icon\"\n type=\"button\"\n variant=\"outline\"\n {...props}\n >\n <ArrowDownIcon className=\"size-4\" />\n </Button>\n )\n );\n};\n"],"names":["__iconNode","ArrowDown","createLucideIcon","DEFAULT_SPRING_ANIMATION","STICK_TO_BOTTOM_OFFSET_PX","SIXTY_FPS_INTERVAL_MS","RETAIN_ANIMATION_DURATION_MS","mouseDown","_a","useStickToBottom","options","escapedFromLock","updateEscapedFromLock","useState","isAtBottom","updateIsAtBottom","isNearBottom","setIsNearBottom","optionsRef","useRef","isSelecting","useCallback","selection","range","scrollRef","setIsAtBottom","state","setEscapedFromLock","useMemo","lastCalculation","scrollTop","contentRef","targetScrollTop","calculatedScrollTop","scrollToBottom","scrollOptions","waitElapsed","behavior","mergeAnimations","ignoreEscapes","durationElapsed","startTarget","next","promise","tick","tickDelta","stopScroll","handleScroll","target","ignoreScrollToTop","lastScrollTop","isScrollingDown","isScrollingUp","handleWheel","deltaY","element","useRefCallback","scroll","_b","content","previousHeight","entry","height","difference","animation","callback","deps","result","ref","animationCache","animations","instant","key","StickToBottomContext","createContext","useIsomorphicLayoutEffect","useLayoutEffect","useEffect","StickToBottom","instance","children","resize","initial","mass","damping","stiffness","currentTargetScrollTop","contextRef","props","customTargetScrollTop","React","elements","get","context","defaultInstance","useImperativeHandle","_jsx","Content","useStickToBottomContext","useContext","Conversation","className","jsx","cn","ConversationContent","ConversationEmptyState","title","description","icon","greeting","jsxs","Fragment","ConversationScrollButton","handleScrollToBottom","Button","ArrowDownIcon"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAMA,KAAa;AAAA,EACjB,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,SAAQ,CAAE;AAAA,EACzC,CAAC,QAAQ,EAAE,GAAG,kBAAkB,KAAK,SAAQ,CAAE;AACjD,GACMC,KAAYC,GAAiB,cAAcF,EAAU;ACb3D;AAAA;AAAA;AAAA;AAKA,MAAMG,KAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO7B,SAAS;AAAA;AAA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QAEnF,gBAAAP,EAAC,MAAA,EAAG,WAAU,oDAAoD,UAAAI,GAAM;AAAA,QACvEC,KACC,gBAAAL,EAAC,KAAA,EAAE,WAAU,+EAA+E,UAAAK,EAAA,CAAY;AAAA,MAAA,EAAA,CAE5G;AAAA,IAAA,EAAA,CACF;AAAA,EAAA;AAEJ,GAKWK,KAA2B,CAAC;AAAA,EACvC,WAAAX;AAAA,EACA,GAAGb;AACL,MAAqC;AACnC,QAAM,EAAE,YAAA1E,GAAY,gBAAAoB,EAAA,IAAmBgE,EAAA,GAEjCe,IAAuB5F,EAAY,MAAM;AAC7C,IAAAa,EAAA;AAAA,EACF,GAAG,CAACA,CAAc,CAAC;AAEnB,SACE,CAACpB,KACC,gBAAAwF;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,WAAWX;AAAA,QACT;AAAA,QACAF;AAAA,MAAA;AAAA,MAEF,SAASY;AAAA,MACT,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAGzB;AAAA,MAEJ,UAAA,gBAAAc,EAACa,IAAA,EAAc,WAAU,SAAA,CAAS;AAAA,IAAA;AAAA,EAAA;AAI1C;","x_google_ignoreList":[0,1,2]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { InputGroup as p,
|
|
3
|
+
import { InputGroup as p, InputGroupAddon as l, InputGroupButton as f, InputGroupTextarea as d } from "../Forms/InputGroups/InputGroup.js";
|
|
4
4
|
import { cn as c } from "../../utils/cn.js";
|
|
5
5
|
import { useState as b } from "react";
|
|
6
6
|
import { useChatLabels as g } from "../../contexts/ChatLabelsContext.js";
|
|
@@ -54,7 +54,7 @@ const y = [
|
|
|
54
54
|
t.key === "Enter" && !t.shiftKey && !m && !t.nativeEvent.isComposing && (t.preventDefault(), (u = t.currentTarget.form) == null || u.requestSubmit());
|
|
55
55
|
};
|
|
56
56
|
return /* @__PURE__ */ e(
|
|
57
|
-
|
|
57
|
+
d,
|
|
58
58
|
{
|
|
59
59
|
className: c("field-sizing-content max-h-48 min-h-16", o),
|
|
60
60
|
name: "message",
|
|
@@ -69,7 +69,7 @@ const y = [
|
|
|
69
69
|
className: o,
|
|
70
70
|
...r
|
|
71
71
|
}) => /* @__PURE__ */ e(
|
|
72
|
-
|
|
72
|
+
l,
|
|
73
73
|
{
|
|
74
74
|
align: "block-end",
|
|
75
75
|
className: c("justify-between gap-1", o),
|
|
@@ -86,7 +86,7 @@ const y = [
|
|
|
86
86
|
let n = /* @__PURE__ */ e(h, { className: "size-4" });
|
|
87
87
|
const { get: t } = g(), u = t("promptSubmitAriaLabel", "Submit");
|
|
88
88
|
return a === "submitted" ? n = /* @__PURE__ */ e(I, { className: "size-4 animate-spin" }) : a === "streaming" ? n = /* @__PURE__ */ e(x, { className: "size-4" }) : a === "error" && (n = /* @__PURE__ */ e(N, { className: "size-4" })), /* @__PURE__ */ e(
|
|
89
|
-
|
|
89
|
+
f,
|
|
90
90
|
{
|
|
91
91
|
"aria-label": u,
|
|
92
92
|
className: c(o),
|