@forgedevstack/bear 1.3.2 → 1.3.3
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 +4 -0
- package/dist/components/ApprovalCard/ApprovalCard.cjs +1 -0
- package/dist/components/ApprovalCard/ApprovalCard.const.cjs +1 -0
- package/dist/components/ApprovalCard/ApprovalCard.const.d.ts +2 -0
- package/dist/components/ApprovalCard/ApprovalCard.const.js +8 -0
- package/dist/components/ApprovalCard/ApprovalCard.d.ts +2 -0
- package/dist/components/ApprovalCard/ApprovalCard.js +25 -0
- package/dist/components/ApprovalCard/ApprovalCard.types.d.ts +15 -0
- package/dist/components/ApprovalCard/index.d.ts +2 -0
- package/dist/components/ArtifactCard/ArtifactCard.cjs +1 -0
- package/dist/components/ArtifactCard/ArtifactCard.const.cjs +1 -0
- package/dist/components/ArtifactCard/ArtifactCard.const.d.ts +3 -0
- package/dist/components/ArtifactCard/ArtifactCard.const.js +8 -0
- package/dist/components/ArtifactCard/ArtifactCard.d.ts +2 -0
- package/dist/components/ArtifactCard/ArtifactCard.js +43 -0
- package/dist/components/ArtifactCard/ArtifactCard.types.d.ts +15 -0
- package/dist/components/ArtifactCard/index.d.ts +2 -0
- package/dist/components/Banner/Banner.const.cjs +1 -1
- package/dist/components/Banner/Banner.const.js +9 -8
- package/dist/components/Chart/BarChart.cjs +1 -1
- package/dist/components/Chart/BarChart.js +65 -72
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.js +21 -18
- package/dist/components/Chart/Chart.types.d.ts +1 -1
- package/dist/components/Chart/FunnelChart.cjs +1 -1
- package/dist/components/Chart/FunnelChart.js +38 -36
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.js +74 -60
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.js +102 -82
- package/dist/components/Chart/RadarChart.cjs +1 -1
- package/dist/components/Chart/RadarChart.d.ts +1 -1
- package/dist/components/Chart/RadarChart.js +116 -93
- package/dist/components/Chat/Chat.cjs +1 -1
- package/dist/components/Chat/Chat.const.cjs +1 -1
- package/dist/components/Chat/Chat.const.d.ts +9 -22
- package/dist/components/Chat/Chat.const.js +18 -26
- package/dist/components/Chat/Chat.d.ts +1 -20
- package/dist/components/Chat/Chat.js +107 -162
- package/dist/components/Chat/Chat.types.d.ts +20 -27
- package/dist/components/Chat/Chat.utils.cjs +1 -0
- package/dist/components/Chat/Chat.utils.d.ts +2 -0
- package/dist/components/Chat/Chat.utils.js +10 -0
- package/dist/components/Chat/helpers/ChatTypingIndicator.cjs +1 -0
- package/dist/components/Chat/helpers/ChatTypingIndicator.d.ts +3 -0
- package/dist/components/Chat/helpers/ChatTypingIndicator.js +14 -0
- package/dist/components/Chat/index.d.ts +2 -1
- package/dist/components/ChatBubble/ChatBubble.cjs +1 -0
- package/dist/components/ChatBubble/ChatBubble.const.cjs +1 -0
- package/dist/components/ChatBubble/ChatBubble.const.d.ts +13 -0
- package/dist/components/ChatBubble/ChatBubble.const.js +17 -0
- package/dist/components/ChatBubble/ChatBubble.d.ts +2 -0
- package/dist/components/ChatBubble/ChatBubble.js +32 -0
- package/dist/components/ChatBubble/ChatBubble.types.d.ts +12 -0
- package/dist/components/ChatBubble/ChatBubble.utils.cjs +1 -0
- package/dist/components/ChatBubble/ChatBubble.utils.d.ts +6 -0
- package/dist/components/ChatBubble/ChatBubble.utils.js +15 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleSystem.cjs +1 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleSystem.d.ts +2 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleSystem.js +21 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleThread.cjs +1 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleThread.d.ts +4 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleThread.js +63 -0
- package/dist/components/ChatBubble/index.d.ts +2 -0
- package/dist/components/ChatError/ChatError.cjs +1 -0
- package/dist/components/ChatError/ChatError.const.cjs +1 -0
- package/dist/components/ChatError/ChatError.const.d.ts +2 -0
- package/dist/components/ChatError/ChatError.const.js +8 -0
- package/dist/components/ChatError/ChatError.d.ts +2 -0
- package/dist/components/ChatError/ChatError.js +32 -0
- package/dist/components/ChatError/ChatError.types.d.ts +14 -0
- package/dist/components/ChatError/index.d.ts +2 -0
- package/dist/components/CitationList/CitationList.cjs +1 -0
- package/dist/components/CitationList/CitationList.d.ts +2 -0
- package/dist/components/CitationList/CitationList.js +30 -0
- package/dist/components/CitationList/CitationList.types.d.ts +15 -0
- package/dist/components/CitationList/helpers/CitationListTitle.cjs +1 -0
- package/dist/components/CitationList/helpers/CitationListTitle.d.ts +2 -0
- package/dist/components/CitationList/helpers/CitationListTitle.js +10 -0
- package/dist/components/CitationList/helpers/index.d.ts +1 -0
- package/dist/components/CitationList/index.d.ts +2 -0
- package/dist/components/ContextMeter/ContextMeter.cjs +1 -0
- package/dist/components/ContextMeter/ContextMeter.const.cjs +1 -0
- package/dist/components/ContextMeter/ContextMeter.const.d.ts +6 -0
- package/dist/components/ContextMeter/ContextMeter.const.js +11 -0
- package/dist/components/ContextMeter/ContextMeter.d.ts +2 -0
- package/dist/components/ContextMeter/ContextMeter.js +49 -0
- package/dist/components/ContextMeter/ContextMeter.types.d.ts +11 -0
- package/dist/components/ContextMeter/ContextMeter.utils.cjs +1 -0
- package/dist/components/ContextMeter/ContextMeter.utils.d.ts +2 -0
- package/dist/components/ContextMeter/ContextMeter.utils.js +12 -0
- package/dist/components/ContextMeter/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.d.ts +2 -1
- package/dist/components/Drawer/Drawer.const.js +7 -6
- package/dist/components/Drawer/Drawer.d.ts +1 -1
- package/dist/components/Drawer/Drawer.js +93 -83
- package/dist/components/Drawer/Drawer.types.d.ts +4 -1
- package/dist/components/Drawer/hooks/useDrawer.cjs +1 -1
- package/dist/components/Drawer/hooks/useDrawer.js +33 -34
- package/dist/components/Drawer/index.d.ts +1 -1
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.d.ts +8 -6
- package/dist/components/EmptyState/EmptyState.const.js +15 -8
- package/dist/components/EmptyState/EmptyState.d.ts +1 -2
- package/dist/components/EmptyState/EmptyState.js +39 -43
- package/dist/components/EmptyState/EmptyState.types.d.ts +2 -0
- package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.cjs +1 -0
- package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.d.ts +3 -0
- package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.js +8 -0
- package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.cjs +1 -0
- package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.d.ts +3 -0
- package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.js +8 -0
- package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.cjs +1 -0
- package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.d.ts +3 -0
- package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.js +8 -0
- package/dist/components/EmptyState/helpers/index.d.ts +3 -0
- package/dist/components/EmptyState/index.d.ts +1 -1
- package/dist/components/FloatingChat/FloatingChat.cjs +1 -1
- package/dist/components/FloatingChat/FloatingChat.const.cjs +1 -1
- package/dist/components/FloatingChat/FloatingChat.const.d.ts +12 -1
- package/dist/components/FloatingChat/FloatingChat.const.js +25 -7
- package/dist/components/FloatingChat/FloatingChat.d.ts +1 -18
- package/dist/components/FloatingChat/FloatingChat.js +93 -124
- package/dist/components/FloatingChat/FloatingChat.types.d.ts +11 -22
- package/dist/components/FloatingChat/FloatingChat.utils.cjs +1 -0
- package/dist/components/FloatingChat/FloatingChat.utils.d.ts +2 -0
- package/dist/components/FloatingChat/FloatingChat.utils.js +12 -0
- package/dist/components/FloatingChat/helpers/FloatingChatHeader.cjs +1 -0
- package/dist/components/FloatingChat/helpers/FloatingChatHeader.d.ts +9 -0
- package/dist/components/FloatingChat/helpers/FloatingChatHeader.js +21 -0
- package/dist/components/FloatingChat/helpers/FloatingChatTrigger.cjs +1 -0
- package/dist/components/FloatingChat/helpers/FloatingChatTrigger.d.ts +9 -0
- package/dist/components/FloatingChat/helpers/FloatingChatTrigger.js +17 -0
- package/dist/components/FloatingChat/index.d.ts +1 -1
- package/dist/components/FormSkeleton/FormSkeleton.cjs +1 -1
- package/dist/components/FormSkeleton/FormSkeleton.d.ts +1 -1
- package/dist/components/FormSkeleton/FormSkeleton.js +35 -24
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Icon/productIcons.cjs +1 -0
- package/dist/components/Icon/productIcons.d.ts +7 -0
- package/dist/components/Icon/productIcons.js +25 -0
- package/dist/components/MessageActions/MessageActions.cjs +1 -0
- package/dist/components/MessageActions/MessageActions.const.cjs +1 -0
- package/dist/components/MessageActions/MessageActions.const.d.ts +2 -0
- package/dist/components/MessageActions/MessageActions.const.js +10 -0
- package/dist/components/MessageActions/MessageActions.d.ts +2 -0
- package/dist/components/MessageActions/MessageActions.js +31 -0
- package/dist/components/MessageActions/MessageActions.types.d.ts +16 -0
- package/dist/components/MessageActions/index.d.ts +2 -0
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/ModelSelect/ModelSelect.cjs +1 -0
- package/dist/components/ModelSelect/ModelSelect.const.cjs +1 -0
- package/dist/components/ModelSelect/ModelSelect.const.d.ts +1 -0
- package/dist/components/ModelSelect/ModelSelect.const.js +4 -0
- package/dist/components/ModelSelect/ModelSelect.d.ts +2 -0
- package/dist/components/ModelSelect/ModelSelect.js +41 -0
- package/dist/components/ModelSelect/ModelSelect.types.d.ts +16 -0
- package/dist/components/ModelSelect/index.d.ts +2 -0
- package/dist/components/OverlayPortal/OverlayPortal.const.cjs +1 -1
- package/dist/components/OverlayPortal/OverlayPortal.const.js +6 -5
- package/dist/components/PasswordInput/PasswordInput.cjs +1 -1
- package/dist/components/PasswordInput/PasswordInput.js +5 -5
- package/dist/components/PromptComposer/PromptComposer.cjs +1 -0
- package/dist/components/PromptComposer/PromptComposer.const.cjs +1 -0
- package/dist/components/PromptComposer/PromptComposer.const.d.ts +6 -0
- package/dist/components/PromptComposer/PromptComposer.const.js +14 -0
- package/dist/components/PromptComposer/PromptComposer.d.ts +2 -0
- package/dist/components/PromptComposer/PromptComposer.js +132 -0
- package/dist/components/PromptComposer/PromptComposer.types.d.ts +45 -0
- package/dist/components/PromptComposer/PromptComposer.utils.cjs +1 -0
- package/dist/components/PromptComposer/PromptComposer.utils.d.ts +5 -0
- package/dist/components/PromptComposer/PromptComposer.utils.js +16 -0
- package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.cjs +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.d.ts +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.js +6 -0
- package/dist/components/PromptComposer/helpers/PromptComposerFileChip.cjs +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerFileChip.d.ts +2 -0
- package/dist/components/PromptComposer/helpers/PromptComposerFileChip.js +18 -0
- package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.cjs +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.d.ts +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.js +9 -0
- package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.cjs +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.d.ts +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.js +6 -0
- package/dist/components/PromptComposer/helpers/index.d.ts +4 -0
- package/dist/components/PromptComposer/index.d.ts +2 -0
- package/dist/components/PromptSuggestions/PromptSuggestions.cjs +1 -0
- package/dist/components/PromptSuggestions/PromptSuggestions.d.ts +2 -0
- package/dist/components/PromptSuggestions/PromptSuggestions.js +39 -0
- package/dist/components/PromptSuggestions/PromptSuggestions.types.d.ts +13 -0
- package/dist/components/PromptSuggestions/index.d.ts +2 -0
- package/dist/components/RichEditor/helpers/IconRender.cjs +1 -1
- package/dist/components/RichEditor/helpers/IconRender.js +16 -16
- package/dist/components/RichEditor/helpers/toolbarItemRender.cjs +1 -1
- package/dist/components/RichEditor/helpers/toolbarItemRender.js +23 -23
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +23 -23
- package/dist/components/Select/helpers/SelectCheckSvg.cjs +1 -0
- package/dist/components/Select/helpers/SelectCheckSvg.d.ts +3 -0
- package/dist/components/Select/helpers/SelectCheckSvg.js +8 -0
- package/dist/components/Select/helpers/SelectChevronDownSvg.cjs +1 -0
- package/dist/components/Select/helpers/SelectChevronDownSvg.d.ts +3 -0
- package/dist/components/Select/helpers/SelectChevronDownSvg.js +8 -0
- package/dist/components/Select/helpers/index.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.const.cjs +2 -2
- package/dist/components/Skeleton/Skeleton.const.js +5 -6
- package/dist/components/Skeleton/Skeleton.js +59 -59
- package/dist/components/StatCard/StatCard.cjs +1 -1
- package/dist/components/StatCard/StatCard.const.cjs +1 -1
- package/dist/components/StatCard/StatCard.const.d.ts +0 -7
- package/dist/components/StatCard/StatCard.const.js +5 -12
- package/dist/components/StatCard/StatCard.d.ts +1 -2
- package/dist/components/StatCard/StatCard.js +48 -37
- package/dist/components/StatCard/StatCard.utils.cjs +1 -0
- package/dist/components/StatCard/StatCard.utils.d.ts +2 -0
- package/dist/components/StatCard/StatCard.utils.js +7 -0
- package/dist/components/StreamingMessage/StreamingMessage.cjs +1 -0
- package/dist/components/StreamingMessage/StreamingMessage.const.cjs +1 -0
- package/dist/components/StreamingMessage/StreamingMessage.const.d.ts +5 -0
- package/dist/components/StreamingMessage/StreamingMessage.const.js +10 -0
- package/dist/components/StreamingMessage/StreamingMessage.d.ts +2 -0
- package/dist/components/StreamingMessage/StreamingMessage.js +48 -0
- package/dist/components/StreamingMessage/StreamingMessage.types.d.ts +15 -0
- package/dist/components/StreamingMessage/index.d.ts +2 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.cjs +1 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.const.cjs +1 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.const.d.ts +7 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.const.js +14 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts +2 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.js +39 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.types.d.ts +14 -0
- package/dist/components/ThemeSwitcher/index.d.ts +2 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.cjs +1 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.const.cjs +1 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.const.d.ts +4 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.const.js +9 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.d.ts +2 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.js +45 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.types.d.ts +16 -0
- package/dist/components/ThinkingBlock/index.d.ts +2 -0
- package/dist/components/ToolCall/ToolCall.cjs +1 -0
- package/dist/components/ToolCall/ToolCall.const.cjs +1 -0
- package/dist/components/ToolCall/ToolCall.const.d.ts +5 -0
- package/dist/components/ToolCall/ToolCall.const.js +17 -0
- package/dist/components/ToolCall/ToolCall.d.ts +2 -0
- package/dist/components/ToolCall/ToolCall.js +43 -0
- package/dist/components/ToolCall/ToolCall.types.d.ts +20 -0
- package/dist/components/ToolCall/index.d.ts +2 -0
- package/dist/components/Transition/Transition.const.cjs +1 -1
- package/dist/components/Transition/Transition.const.js +12 -6
- package/dist/components/Transition/Transition.types.d.ts +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +37 -9
- package/dist/components/index.js +455 -423
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.d.ts +46 -0
- package/dist/constants/generals.const.js +158 -115
- package/dist/constants/keys.const.cjs +1 -1
- package/dist/constants/keys.const.js +2 -1
- package/dist/constants/numbers.const.cjs +1 -1
- package/dist/constants/numbers.const.d.ts +7 -0
- package/dist/constants/numbers.const.js +60 -52
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +19 -44
- package/dist/context/BearProvider.js +223 -208
- package/dist/context/bearProvider.types.d.ts +4 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/hooks/useFixedAnchorPosition/index.d.ts +1 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs +1 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.d.ts +2 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js +12 -11
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.types.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +595 -563
- package/dist/styles/_ai-chat.css +487 -0
- package/dist/styles/_base.css +2 -0
- package/dist/styles/_chart.css +144 -0
- package/dist/styles/_effects.css +8 -4
- package/dist/styles/_skeleton.css +90 -0
- package/dist/styles/main.css +3 -0
- package/dist/styles.css +734 -32
- package/package.json +1 -1
- package/dist/components/FormSkeleton/FormSkeleton.const.cjs +0 -1
- package/dist/components/FormSkeleton/FormSkeleton.const.d.ts +0 -5
- package/dist/components/FormSkeleton/FormSkeleton.const.js +0 -8
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.js +0 -14
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.js +0 -35
- package/dist/node_modules/@forgedevstack/bear-icons/dist/action.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/action.js +0 -26
- package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.js +0 -4
- package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.js +0 -130
- package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.js +0 -12
- package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.js +0 -18
- package/dist/node_modules/@forgedevstack/bear-icons/dist/status.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/status.js +0 -6
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { ChatBubbleProps as ChatBubbleComponentProps } from '../ChatBubble/ChatBubble.types';
|
|
3
|
+
import { PromptSuggestionItem } from '../PromptSuggestions/PromptSuggestions.types';
|
|
2
4
|
export interface ChatMessage {
|
|
3
5
|
id: string;
|
|
4
6
|
content: string | ReactNode;
|
|
@@ -9,48 +11,39 @@ export interface ChatMessage {
|
|
|
9
11
|
status?: 'sending' | 'sent' | 'delivered' | 'read' | 'error';
|
|
10
12
|
metadata?: Record<string, unknown>;
|
|
11
13
|
}
|
|
14
|
+
export interface ChatTranslations {
|
|
15
|
+
placeholder: string;
|
|
16
|
+
typingText: string;
|
|
17
|
+
newMessagesLabel: string;
|
|
18
|
+
}
|
|
12
19
|
export interface ChatProps {
|
|
13
20
|
id?: string;
|
|
14
|
-
|
|
21
|
+
testId?: string;
|
|
15
22
|
messages: ChatMessage[];
|
|
16
|
-
/** Callback when user sends a message */
|
|
17
23
|
onSend?: (message: string) => void;
|
|
18
|
-
|
|
24
|
+
onStop?: () => void;
|
|
25
|
+
onAttach?: (files: File[]) => void;
|
|
19
26
|
isLoading?: boolean;
|
|
20
|
-
|
|
27
|
+
isStreaming?: boolean;
|
|
28
|
+
isTyping?: boolean;
|
|
21
29
|
placeholder?: string;
|
|
22
|
-
/** Chat header content */
|
|
23
30
|
header?: ReactNode;
|
|
24
|
-
/** Chat footer content (below input) */
|
|
25
31
|
footer?: ReactNode;
|
|
26
|
-
/** Show timestamps */
|
|
27
32
|
showTimestamps?: boolean;
|
|
28
|
-
/** Show message status */
|
|
29
33
|
showStatus?: boolean;
|
|
30
|
-
/** Show avatars */
|
|
31
34
|
showAvatars?: boolean;
|
|
32
|
-
/** User avatar URL */
|
|
33
35
|
userAvatar?: string;
|
|
34
|
-
/** Bot avatar URL */
|
|
35
36
|
botAvatar?: string;
|
|
36
|
-
/** Typing indicator */
|
|
37
|
-
isTyping?: boolean;
|
|
38
|
-
/** Typing indicator text */
|
|
39
37
|
typingText?: string;
|
|
40
|
-
/** Custom class name */
|
|
41
38
|
className?: string;
|
|
42
|
-
/** Height of the chat container */
|
|
43
39
|
height?: number | string;
|
|
44
|
-
/** Test ID */
|
|
45
|
-
testId?: string;
|
|
46
|
-
/** Disable input */
|
|
47
40
|
disabled?: boolean;
|
|
41
|
+
allowAttach?: boolean;
|
|
42
|
+
suggestions?: PromptSuggestionItem[];
|
|
43
|
+
onSuggestionSelect?: (id: string) => void;
|
|
44
|
+
errorTitle?: string;
|
|
45
|
+
errorMessage?: ReactNode;
|
|
46
|
+
onRetry?: () => void;
|
|
47
|
+
translations?: Partial<ChatTranslations>;
|
|
48
48
|
}
|
|
49
|
-
export
|
|
50
|
-
message: ChatMessage;
|
|
51
|
-
showTimestamp?: boolean;
|
|
52
|
-
showStatus?: boolean;
|
|
53
|
-
showAvatar?: boolean;
|
|
54
|
-
userAvatar?: string;
|
|
55
|
-
botAvatar?: string;
|
|
56
|
-
}
|
|
49
|
+
export type ChatBubbleProps = ChatBubbleComponentProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../constants/generals.const.cjs"),o=require("./Chat.const.cjs"),n=t=>{const e=typeof t=="number"?`${t}${r.UNIT_PX}`:t;return{[o.CHAT_HEIGHT_VAR]:e}},s=t=>t.scrollHeight-t.scrollTop-t.clientHeight<=o.CHAT_STICK_THRESHOLD;exports.isChatScrollerAtBottom=s;exports.resolveChatHeightVar=n;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UNIT_PX as r } from "../../constants/generals.const.js";
|
|
2
|
+
import { CHAT_HEIGHT_VAR as e, CHAT_STICK_THRESHOLD as n } from "./Chat.const.js";
|
|
3
|
+
const s = (t) => {
|
|
4
|
+
const o = typeof t == "number" ? `${t}${r}` : t;
|
|
5
|
+
return { [e]: o };
|
|
6
|
+
}, i = (t) => t.scrollHeight - t.scrollTop - t.clientHeight <= n;
|
|
7
|
+
export {
|
|
8
|
+
i as isChatScrollerAtBottom,
|
|
9
|
+
s as resolveChatHeightVar
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("../../Flex/Flex.cjs"),r=require("../../Typography/Typography.cjs"),i=require("../../../constants/numbers.const.cjs"),p=a=>{const{text:o}=a,s=Array.from({length:i.TYPING_DOT_COUNT},(t,c)=>c);return e.jsxs(n.Flex,{className:"Bear-ChatTyping",align:"center",gap:2,children:[e.jsx(n.Flex,{className:"Bear-ChatTyping__dots",align:"center",children:s.map(t=>e.jsx(r.Typography,{component:"span",className:"Bear-ChatTyping__dot"},t))}),e.jsx(r.Typography,{variant:"caption",color:"muted",children:o})]})};exports.ChatTypingIndicator=p;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Flex as a } from "../../Flex/Flex.js";
|
|
3
|
+
import { Typography as o } from "../../Typography/Typography.js";
|
|
4
|
+
import { TYPING_DOT_COUNT as m } from "../../../constants/numbers.const.js";
|
|
5
|
+
const d = (n) => {
|
|
6
|
+
const { text: e } = n, i = Array.from({ length: m }, (t, p) => p);
|
|
7
|
+
return /* @__PURE__ */ c(a, { className: "Bear-ChatTyping", align: "center", gap: 2, children: [
|
|
8
|
+
/* @__PURE__ */ r(a, { className: "Bear-ChatTyping__dots", align: "center", children: i.map((t) => /* @__PURE__ */ r(o, { component: "span", className: "Bear-ChatTyping__dot" }, t)) }),
|
|
9
|
+
/* @__PURE__ */ r(o, { variant: "caption", color: "muted", children: e })
|
|
10
|
+
] });
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
d as ChatTypingIndicator
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("../../constants/generals.const.cjs");require("react");const _=require("../../utils/generateBearId.utils.cjs"),b=require("../../utils/useBearId.cjs"),t=require("./ChatBubble.const.cjs"),c=require("./ChatBubble.utils.cjs"),l=require("./helpers/ChatBubbleSystem.cjs"),T=require("./helpers/ChatBubbleThread.cjs"),h=a=>{const{id:u,showTimestamp:n=t.CHAT_BUBBLE_DEFAULT_SHOW_TIMESTAMP,showStatus:B=t.CHAT_BUBBLE_DEFAULT_SHOW_STATUS,showAvatar:o=t.CHAT_BUBBLE_DEFAULT_SHOW_AVATAR,...e}=a,i=b.useBearId(d.COMPONENT_NAME_CHAT_BUBBLE),s=_.resolveBearId(u,i);return c.isChatSystemSender(e.message.sender)?r.jsx(l.ChatBubbleSystem,{id:s,testId:e.testId,message:e.message,className:e.className}):r.jsx(T.ChatBubbleThread,{...e,id:s,domId:s,showTimestamp:n,showStatus:B,showAvatar:o})};exports.ChatBubble=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../constants/generals.const.cjs"),B=_.BOOLEAN_TRUE,T=_.BOOLEAN_TRUE,A=_.BOOLEAN_TRUE,E={sending:"○",sent:"✓",delivered:"✓✓",read:"✓✓",error:"!"},U="U",L="B",H="2-digit";exports.CHAT_BUBBLE_BOT_INITIAL=L;exports.CHAT_BUBBLE_DEFAULT_SHOW_AVATAR=A;exports.CHAT_BUBBLE_DEFAULT_SHOW_STATUS=T;exports.CHAT_BUBBLE_DEFAULT_SHOW_TIMESTAMP=B;exports.CHAT_BUBBLE_STATUS_MARK=E;exports.CHAT_BUBBLE_TIME_DIGIT=H;exports.CHAT_BUBBLE_USER_INITIAL=U;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const CHAT_BUBBLE_DEFAULT_SHOW_TIMESTAMP = true;
|
|
2
|
+
export declare const CHAT_BUBBLE_DEFAULT_SHOW_STATUS = true;
|
|
3
|
+
export declare const CHAT_BUBBLE_DEFAULT_SHOW_AVATAR = true;
|
|
4
|
+
export declare const CHAT_BUBBLE_STATUS_MARK: {
|
|
5
|
+
readonly sending: "○";
|
|
6
|
+
readonly sent: "✓";
|
|
7
|
+
readonly delivered: "✓✓";
|
|
8
|
+
readonly read: "✓✓";
|
|
9
|
+
readonly error: "!";
|
|
10
|
+
};
|
|
11
|
+
export declare const CHAT_BUBBLE_USER_INITIAL = "U";
|
|
12
|
+
export declare const CHAT_BUBBLE_BOT_INITIAL = "B";
|
|
13
|
+
export declare const CHAT_BUBBLE_TIME_DIGIT = "2-digit";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BOOLEAN_TRUE as _ } from "../../constants/generals.const.js";
|
|
2
|
+
const T = _, A = _, E = _, U = {
|
|
3
|
+
sending: "○",
|
|
4
|
+
sent: "✓",
|
|
5
|
+
delivered: "✓✓",
|
|
6
|
+
read: "✓✓",
|
|
7
|
+
error: "!"
|
|
8
|
+
}, L = "U", o = "B", t = "2-digit";
|
|
9
|
+
export {
|
|
10
|
+
o as CHAT_BUBBLE_BOT_INITIAL,
|
|
11
|
+
E as CHAT_BUBBLE_DEFAULT_SHOW_AVATAR,
|
|
12
|
+
A as CHAT_BUBBLE_DEFAULT_SHOW_STATUS,
|
|
13
|
+
T as CHAT_BUBBLE_DEFAULT_SHOW_TIMESTAMP,
|
|
14
|
+
U as CHAT_BUBBLE_STATUS_MARK,
|
|
15
|
+
t as CHAT_BUBBLE_TIME_DIGIT,
|
|
16
|
+
L as CHAT_BUBBLE_USER_INITIAL
|
|
17
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { COMPONENT_NAME_CHAT_BUBBLE as T } from "../../constants/generals.const.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { resolveBearId as _ } from "../../utils/generateBearId.utils.js";
|
|
5
|
+
import { useBearId as d } from "../../utils/useBearId.js";
|
|
6
|
+
import { CHAT_BUBBLE_DEFAULT_SHOW_TIMESTAMP as A, CHAT_BUBBLE_DEFAULT_SHOW_STATUS as p, CHAT_BUBBLE_DEFAULT_SHOW_AVATAR as E } from "./ChatBubble.const.js";
|
|
7
|
+
import { isChatSystemSender as S } from "./ChatBubble.utils.js";
|
|
8
|
+
import { ChatBubbleSystem as f } from "./helpers/ChatBubbleSystem.js";
|
|
9
|
+
import { ChatBubbleThread as n } from "./helpers/ChatBubbleThread.js";
|
|
10
|
+
const l = (s) => {
|
|
11
|
+
const {
|
|
12
|
+
id: m,
|
|
13
|
+
showTimestamp: o = A,
|
|
14
|
+
showStatus: a = p,
|
|
15
|
+
showAvatar: B = E,
|
|
16
|
+
...e
|
|
17
|
+
} = s, i = d(T), t = _(m, i);
|
|
18
|
+
return S(e.message.sender) ? /* @__PURE__ */ r(f, { id: t, testId: e.testId, message: e.message, className: e.className }) : /* @__PURE__ */ r(
|
|
19
|
+
n,
|
|
20
|
+
{
|
|
21
|
+
...e,
|
|
22
|
+
id: t,
|
|
23
|
+
domId: t,
|
|
24
|
+
showTimestamp: o,
|
|
25
|
+
showStatus: a,
|
|
26
|
+
showAvatar: B
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
l as ChatBubble
|
|
32
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChatMessage } from '../Chat/Chat.types';
|
|
2
|
+
export interface ChatBubbleProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
testId?: string;
|
|
5
|
+
message: ChatMessage;
|
|
6
|
+
showTimestamp?: boolean;
|
|
7
|
+
showStatus?: boolean;
|
|
8
|
+
showAvatar?: boolean;
|
|
9
|
+
userAvatar?: string;
|
|
10
|
+
botAvatar?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./ChatBubble.const.cjs"),r=e=>e==="user",o=e=>e==="system",i=(e,n,a)=>e.avatar?e.avatar:r(e.sender)?n:a,u=e=>e.name?e.name[0]:r(e.sender)?t.CHAT_BUBBLE_USER_INITIAL:t.CHAT_BUBBLE_BOT_INITIAL,B=e=>{if(e)return e.toLocaleTimeString([],{hour:t.CHAT_BUBBLE_TIME_DIGIT,minute:t.CHAT_BUBBLE_TIME_DIGIT})};exports.formatChatBubbleTime=B;exports.isChatSystemSender=o;exports.isChatUserSender=r;exports.resolveChatBubbleAvatar=i;exports.resolveChatBubbleInitial=u;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChatMessage } from '../Chat/Chat.types';
|
|
2
|
+
export declare const isChatUserSender: (sender: ChatMessage["sender"]) => sender is "user";
|
|
3
|
+
export declare const isChatSystemSender: (sender: ChatMessage["sender"]) => sender is "system";
|
|
4
|
+
export declare const resolveChatBubbleAvatar: (message: ChatMessage, userAvatar?: string, botAvatar?: string) => string | undefined;
|
|
5
|
+
export declare const resolveChatBubbleInitial: (message: ChatMessage) => string;
|
|
6
|
+
export declare const formatChatBubbleTime: (timestamp?: Date) => string | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CHAT_BUBBLE_TIME_DIGIT as t, CHAT_BUBBLE_USER_INITIAL as a, CHAT_BUBBLE_BOT_INITIAL as B } from "./ChatBubble.const.js";
|
|
2
|
+
const e = (r) => r === "user", u = (r) => r === "system", I = (r, n, o) => r.avatar ? r.avatar : e(r.sender) ? n : o, T = (r) => r.name ? r.name[0] : e(r.sender) ? a : B, _ = (r) => {
|
|
3
|
+
if (r)
|
|
4
|
+
return r.toLocaleTimeString([], {
|
|
5
|
+
hour: t,
|
|
6
|
+
minute: t
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
_ as formatChatBubbleTime,
|
|
11
|
+
u as isChatSystemSender,
|
|
12
|
+
e as isChatUserSender,
|
|
13
|
+
I as resolveChatBubbleAvatar,
|
|
14
|
+
T as resolveChatBubbleInitial
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../Flex/Flex.cjs"),u=require("../../Typography/Typography.cjs"),l=require("../../../utils/cn.cjs");require("react");const b=t=>{const{id:r,testId:s,message:a,className:n}=t;return e.jsx(c.Flex,{id:r,testId:s,className:l.cn("Bear-ChatBubble","Bear-ChatBubble--system",n),justify:"center",children:e.jsx(u.Typography,{variant:"caption",className:"Bear-ChatBubble__bubble",children:a.content})})};exports.ChatBubbleSystem=b;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Flex as o } from "../../Flex/Flex.js";
|
|
3
|
+
import { Typography as b } from "../../Typography/Typography.js";
|
|
4
|
+
import { cn as c } from "../../../utils/cn.js";
|
|
5
|
+
import "react";
|
|
6
|
+
const u = (t) => {
|
|
7
|
+
const { id: r, testId: a, message: s, className: m } = t;
|
|
8
|
+
return /* @__PURE__ */ e(
|
|
9
|
+
o,
|
|
10
|
+
{
|
|
11
|
+
id: r,
|
|
12
|
+
testId: a,
|
|
13
|
+
className: c("Bear-ChatBubble", "Bear-ChatBubble--system", m),
|
|
14
|
+
justify: "center",
|
|
15
|
+
children: /* @__PURE__ */ e(b, { variant: "caption", className: "Bear-ChatBubble__bubble", children: s.content })
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
u as ChatBubbleSystem
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),_=require("../../Avatar/Avatar.cjs"),l=require("../../../utils/cn.cjs");require("react");require("../../Box/Box.cjs");const r=require("../../Flex/Flex.cjs"),t=require("../../Typography/Typography.cjs"),v=require("../ChatBubble.const.cjs"),s=require("../ChatBubble.utils.cjs"),y=o=>{const{domId:u,testId:c,message:e,showTimestamp:b,showStatus:h,showAvatar:d,userAvatar:m,botAvatar:B,className:p}=o,C=s.isChatUserSender(e.sender),n=s.formatChatBubbleTime(e.timestamp),i=e.status?v.CHAT_BUBBLE_STATUS_MARK[e.status]:void 0;return a.jsxs(r.Flex,{id:u,testId:c,className:l.cn("Bear-ChatBubble",`Bear-ChatBubble--${e.sender}`,p),align:"start",gap:2,children:[d&&a.jsx(_.Avatar,{src:s.resolveChatBubbleAvatar(e,m,B),initials:s.resolveChatBubbleInitial(e),size:"sm"}),a.jsxs(r.Flex,{className:"Bear-ChatBubble__body",direction:"column",gap:1,children:[e.name&&a.jsx(t.Typography,{variant:"caption",color:"muted",children:e.name}),a.jsx(t.Typography,{variant:"body2",className:"Bear-ChatBubble__bubble",children:e.content}),a.jsxs(r.Flex,{className:"Bear-ChatBubble__meta",align:"center",gap:1,children:[b&&n&&a.jsx(t.Typography,{variant:"caption",color:"muted",children:n}),h&&i&&C&&a.jsx(t.Typography,{variant:"caption",className:l.cn("Bear-ChatBubble__status",e.status&&`Bear-ChatBubble__status--${e.status}`),children:i})]})]})]})};exports.ChatBubbleThread=y;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar as _ } from "../../Avatar/Avatar.js";
|
|
3
|
+
import { cn as m } from "../../../utils/cn.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import "../../Box/Box.js";
|
|
6
|
+
import { Flex as s } from "../../Flex/Flex.js";
|
|
7
|
+
import { Typography as e } from "../../Typography/Typography.js";
|
|
8
|
+
import { CHAT_BUBBLE_STATUS_MARK as v } from "../ChatBubble.const.js";
|
|
9
|
+
import { isChatUserSender as f, formatChatBubbleTime as A, resolveChatBubbleInitial as g, resolveChatBubbleAvatar as T } from "../ChatBubble.utils.js";
|
|
10
|
+
const M = (l) => {
|
|
11
|
+
const {
|
|
12
|
+
domId: n,
|
|
13
|
+
testId: b,
|
|
14
|
+
message: a,
|
|
15
|
+
showTimestamp: c,
|
|
16
|
+
showStatus: u,
|
|
17
|
+
showAvatar: h,
|
|
18
|
+
userAvatar: d,
|
|
19
|
+
botAvatar: B,
|
|
20
|
+
className: p
|
|
21
|
+
} = l, C = f(a.sender), o = A(a.timestamp), i = a.status ? v[a.status] : void 0;
|
|
22
|
+
return /* @__PURE__ */ r(
|
|
23
|
+
s,
|
|
24
|
+
{
|
|
25
|
+
id: n,
|
|
26
|
+
testId: b,
|
|
27
|
+
className: m("Bear-ChatBubble", `Bear-ChatBubble--${a.sender}`, p),
|
|
28
|
+
align: "start",
|
|
29
|
+
gap: 2,
|
|
30
|
+
children: [
|
|
31
|
+
h && /* @__PURE__ */ t(
|
|
32
|
+
_,
|
|
33
|
+
{
|
|
34
|
+
src: T(a, d, B),
|
|
35
|
+
initials: g(a),
|
|
36
|
+
size: "sm"
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ r(s, { className: "Bear-ChatBubble__body", direction: "column", gap: 1, children: [
|
|
40
|
+
a.name && /* @__PURE__ */ t(e, { variant: "caption", color: "muted", children: a.name }),
|
|
41
|
+
/* @__PURE__ */ t(e, { variant: "body2", className: "Bear-ChatBubble__bubble", children: a.content }),
|
|
42
|
+
/* @__PURE__ */ r(s, { className: "Bear-ChatBubble__meta", align: "center", gap: 1, children: [
|
|
43
|
+
c && o && /* @__PURE__ */ t(e, { variant: "caption", color: "muted", children: o }),
|
|
44
|
+
u && i && C && /* @__PURE__ */ t(
|
|
45
|
+
e,
|
|
46
|
+
{
|
|
47
|
+
variant: "caption",
|
|
48
|
+
className: m(
|
|
49
|
+
"Bear-ChatBubble__status",
|
|
50
|
+
a.status && `Bear-ChatBubble__status--${a.status}`
|
|
51
|
+
),
|
|
52
|
+
children: i
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] })
|
|
56
|
+
] })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
M as ChatBubbleThread
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("../../constants/generals.const.cjs"),p=require("../../utils/cn.cjs");require("react");const R=require("../../utils/generateBearId.utils.cjs"),x=require("../../utils/useBearId.cjs"),B=require("../../utils/liveRegion.utils.cjs"),T=require("../Box/Box.cjs"),_=require("../Button/Button.cjs"),E=require("../Flex/Flex.cjs"),o=require("../Typography/Typography.cjs"),v=require("./ChatError.const.cjs"),C=s=>{const{id:i,testId:a,title:c,children:r,onRetry:t,translations:l,className:u}=s,d=x.useBearId(y.COMPONENT_NAME_CHAT_ERROR),g=R.resolveBearId(i,d),n={...v.CHAT_ERROR_DEFAULT_TRANSLATIONS,...l},h=c??n.title,q=B.getBearLiveRegionProps("error");return e.jsx(T.Box,{id:g,"data-testid":a,className:p.cn("Bear-ChatError",u),...q,children:e.jsxs(E.Flex,{direction:"column",gap:2,align:"start",children:[e.jsx(o.Typography,{variant:"subtitle2",children:h}),r&&e.jsx(o.Typography,{variant:"body2",children:r}),t&&e.jsx(_.Button,{type:"button",variant:"outline",size:"sm",onClick:t,children:n.retryLabel})]})})};exports.ChatError=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/generals.const.cjs"),t={title:"Something went wrong",retryLabel:e.LABEL_RETRY};exports.CHAT_ERROR_DEFAULT_TRANSLATIONS=t;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as r, jsxs as R } from "react/jsx-runtime";
|
|
2
|
+
import { COMPONENT_NAME_CHAT_ERROR as g } from "../../constants/generals.const.js";
|
|
3
|
+
import { cn as u } from "../../utils/cn.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { resolveBearId as E } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as N } from "../../utils/useBearId.js";
|
|
7
|
+
import { getBearLiveRegionProps as T } from "../../utils/liveRegion.utils.js";
|
|
8
|
+
import { Box as v } from "../Box/Box.js";
|
|
9
|
+
import { Button as y } from "../Button/Button.js";
|
|
10
|
+
import { Flex as A } from "../Flex/Flex.js";
|
|
11
|
+
import { Typography as i } from "../Typography/Typography.js";
|
|
12
|
+
import { CHAT_ERROR_DEFAULT_TRANSLATIONS as B } from "./ChatError.const.js";
|
|
13
|
+
const S = (n) => {
|
|
14
|
+
const { id: a, testId: m, title: s, children: t, onRetry: o, translations: l, className: d } = n, p = N(g), c = E(a, p), e = { ...B, ...l }, f = s ?? e.title, h = T("error");
|
|
15
|
+
return /* @__PURE__ */ r(
|
|
16
|
+
v,
|
|
17
|
+
{
|
|
18
|
+
id: c,
|
|
19
|
+
"data-testid": m,
|
|
20
|
+
className: u("Bear-ChatError", d),
|
|
21
|
+
...h,
|
|
22
|
+
children: /* @__PURE__ */ R(A, { direction: "column", gap: 2, align: "start", children: [
|
|
23
|
+
/* @__PURE__ */ r(i, { variant: "subtitle2", children: f }),
|
|
24
|
+
t && /* @__PURE__ */ r(i, { variant: "body2", children: t }),
|
|
25
|
+
o && /* @__PURE__ */ r(y, { type: "button", variant: "outline", size: "sm", onClick: o, children: e.retryLabel })
|
|
26
|
+
] })
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
S as ChatError
|
|
32
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ChatErrorTranslations {
|
|
3
|
+
title: string;
|
|
4
|
+
retryLabel: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ChatErrorProps {
|
|
7
|
+
id?: string;
|
|
8
|
+
testId?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
onRetry?: () => void;
|
|
12
|
+
translations?: Partial<ChatErrorTranslations>;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("../../constants/generals.const.cjs"),d=require("../../utils/cn.cjs");require("react");const l=require("../../utils/generateBearId.utils.cjs"),x=require("../../utils/useBearId.cjs"),m=require("../Box/Box.cjs"),p=require("../Flex/Flex.cjs"),q=require("../Typography/Typography.cjs"),I=require("./helpers/CitationListTitle.cjs"),T=r=>{const{id:i,testId:s,citations:n,className:o}=r,a=x.useBearId(u.COMPONENT_NAME_CITATION_LIST),c=l.resolveBearId(i,a);return t.jsx(p.Flex,{id:c,testId:s,className:d.cn("Bear-CitationList",o),direction:"column",gap:2,children:n.map(e=>t.jsxs(m.Box,{className:"Bear-CitationList__item",children:[t.jsx(I.CitationListTitle,{citation:e}),e.excerpt&&t.jsx(q.Typography,{variant:"caption",color:"muted",children:e.excerpt})]},e.id))})};exports.CitationList=T;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { COMPONENT_NAME_CITATION_LIST as c } from "../../constants/generals.const.js";
|
|
3
|
+
import { cn as d } from "../../utils/cn.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { resolveBearId as l } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as f } from "../../utils/useBearId.js";
|
|
7
|
+
import { Box as I } from "../Box/Box.js";
|
|
8
|
+
import { Flex as x } from "../Flex/Flex.js";
|
|
9
|
+
import { Typography as N } from "../Typography/Typography.js";
|
|
10
|
+
import { CitationListTitle as C } from "./helpers/CitationListTitle.js";
|
|
11
|
+
const y = (t) => {
|
|
12
|
+
const { id: i, testId: e, citations: m, className: s } = t, a = f(c), p = l(i, a);
|
|
13
|
+
return /* @__PURE__ */ o(
|
|
14
|
+
x,
|
|
15
|
+
{
|
|
16
|
+
id: p,
|
|
17
|
+
testId: e,
|
|
18
|
+
className: d("Bear-CitationList", s),
|
|
19
|
+
direction: "column",
|
|
20
|
+
gap: 2,
|
|
21
|
+
children: m.map((r) => /* @__PURE__ */ n(I, { className: "Bear-CitationList__item", children: [
|
|
22
|
+
/* @__PURE__ */ o(C, { citation: r }),
|
|
23
|
+
r.excerpt && /* @__PURE__ */ o(N, { variant: "caption", color: "muted", children: r.excerpt })
|
|
24
|
+
] }, r.id))
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
y as CitationList
|
|
30
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CitationItem {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
excerpt?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CitationListProps {
|
|
8
|
+
id?: string;
|
|
9
|
+
testId?: string;
|
|
10
|
+
citations: CitationItem[];
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CitationListTitleProps {
|
|
14
|
+
citation: CitationItem;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("../../Link/Link.cjs"),n=require("../../Typography/Typography.cjs"),o=i=>{const{citation:t}=i;return t.href?e.jsx(r.Link,{href:t.href,children:t.title}):e.jsx(n.Typography,{variant:"subtitle2",children:t.title})};exports.CitationListTitle=o;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Link as e } from "../../Link/Link.js";
|
|
3
|
+
import { Typography as o } from "../../Typography/Typography.js";
|
|
4
|
+
const l = (i) => {
|
|
5
|
+
const { citation: t } = i;
|
|
6
|
+
return t.href ? /* @__PURE__ */ r(e, { href: t.href, children: t.title }) : /* @__PURE__ */ r(o, { variant: "subtitle2", children: t.title });
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
l as CitationListTitle
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CitationListTitle } from './CitationListTitle';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("../../constants/numbers.const.cjs"),c=require("../../constants/generals.const.cjs"),B=require("../../utils/cn.cjs");require("react");const q=require("../../utils/generateBearId.utils.cjs"),b=require("../../utils/useBearId.cjs"),n=require("../Box/Box.cjs"),g=require("../Flex/Flex.cjs"),i=require("../Typography/Typography.cjs"),l=require("./ContextMeter.const.cjs"),u=require("./ContextMeter.utils.cjs"),m=x=>{const{id:d,testId:T,used:t,max:r=l.CONTEXT_METER_MAX_DEFAULT,translations:_,className:M}=x,C=b.useBearId(c.COMPONENT_NAME_CONTEXT_METER),s=q.resolveBearId(d,C),E={...l.CONTEXT_METER_DEFAULT_TRANSLATIONS,..._},a=u.resolveContextMeterPercent(t,r),N=u.resolveContextMeterTone(a),o=`${s}-label`;return e.jsxs(n.Box,{id:s,"data-testid":T,className:B.cn("Bear-ContextMeter",`Bear-ContextMeter--${N}`,M),style:{"--Bear-ContextMeter-percent":`${a}${c.PERCENT_UNIT}`},children:[e.jsxs(g.Flex,{justify:"between",align:"center",gap:2,children:[e.jsx(i.Typography,{id:o,variant:"caption",children:E.label}),e.jsxs(i.Typography,{variant:"caption",children:[t,"/",r]})]}),e.jsx(n.Box,{className:"Bear-ContextMeter__track",role:"progressbar","aria-labelledby":o,"aria-valuemin":p.ZERO,"aria-valuemax":r,"aria-valuenow":t,children:e.jsx(n.Box,{className:"Bear-ContextMeter__fill"})})]})};exports.ContextMeter=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../../constants/numbers.const.cjs"),T={label:"Context"},_=E.CONTEXT_METER_DEFAULT_MAX,N=E.SEVENTY_TWO,R=E.NINETY,C=E.ONE_HUNDRED;exports.CONTEXT_METER_DANGER_PERCENT=R;exports.CONTEXT_METER_DEFAULT_TRANSLATIONS=T;exports.CONTEXT_METER_MAX_DEFAULT=_;exports.CONTEXT_METER_PERCENT_CAP=C;exports.CONTEXT_METER_WARN_PERCENT=N;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContextMeterTranslations } from './ContextMeter.types';
|
|
2
|
+
export declare const CONTEXT_METER_DEFAULT_TRANSLATIONS: ContextMeterTranslations;
|
|
3
|
+
export declare const CONTEXT_METER_MAX_DEFAULT = 100;
|
|
4
|
+
export declare const CONTEXT_METER_WARN_PERCENT = 72;
|
|
5
|
+
export declare const CONTEXT_METER_DANGER_PERCENT = 90;
|
|
6
|
+
export declare const CONTEXT_METER_PERCENT_CAP = 100;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CONTEXT_METER_DEFAULT_MAX as E, ONE_HUNDRED as T, NINETY as _, SEVENTY_TWO as N } from "../../constants/numbers.const.js";
|
|
2
|
+
const C = {
|
|
3
|
+
label: "Context"
|
|
4
|
+
}, A = E, o = N, t = _, O = T;
|
|
5
|
+
export {
|
|
6
|
+
t as CONTEXT_METER_DANGER_PERCENT,
|
|
7
|
+
C as CONTEXT_METER_DEFAULT_TRANSLATIONS,
|
|
8
|
+
A as CONTEXT_METER_MAX_DEFAULT,
|
|
9
|
+
O as CONTEXT_METER_PERCENT_CAP,
|
|
10
|
+
o as CONTEXT_METER_WARN_PERCENT
|
|
11
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs as t, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { ZERO as N } from "../../constants/numbers.const.js";
|
|
3
|
+
import { COMPONENT_NAME_CONTEXT_METER as _, PERCENT_UNIT as f } from "../../constants/generals.const.js";
|
|
4
|
+
import { cn as C } from "../../utils/cn.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { resolveBearId as b } from "../../utils/generateBearId.utils.js";
|
|
7
|
+
import { useBearId as v } from "../../utils/useBearId.js";
|
|
8
|
+
import { Box as a } from "../Box/Box.js";
|
|
9
|
+
import { Flex as B } from "../Flex/Flex.js";
|
|
10
|
+
import { Typography as s } from "../Typography/Typography.js";
|
|
11
|
+
import { CONTEXT_METER_MAX_DEFAULT as I, CONTEXT_METER_DEFAULT_TRANSLATIONS as u } from "./ContextMeter.const.js";
|
|
12
|
+
import { resolveContextMeterPercent as O, resolveContextMeterTone as h } from "./ContextMeter.utils.js";
|
|
13
|
+
const D = (m) => {
|
|
14
|
+
const { id: c, testId: p, used: e, max: r = I, translations: d, className: T } = m, E = v(_), n = b(c, E), x = { ...u, ...d }, i = O(e, r), M = h(i), l = `${n}-label`;
|
|
15
|
+
return /* @__PURE__ */ t(
|
|
16
|
+
a,
|
|
17
|
+
{
|
|
18
|
+
id: n,
|
|
19
|
+
"data-testid": p,
|
|
20
|
+
className: C("Bear-ContextMeter", `Bear-ContextMeter--${M}`, T),
|
|
21
|
+
style: { "--Bear-ContextMeter-percent": `${i}${f}` },
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ t(B, { justify: "between", align: "center", gap: 2, children: [
|
|
24
|
+
/* @__PURE__ */ o(s, { id: l, variant: "caption", children: x.label }),
|
|
25
|
+
/* @__PURE__ */ t(s, { variant: "caption", children: [
|
|
26
|
+
e,
|
|
27
|
+
"/",
|
|
28
|
+
r
|
|
29
|
+
] })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ o(
|
|
32
|
+
a,
|
|
33
|
+
{
|
|
34
|
+
className: "Bear-ContextMeter__track",
|
|
35
|
+
role: "progressbar",
|
|
36
|
+
"aria-labelledby": l,
|
|
37
|
+
"aria-valuemin": N,
|
|
38
|
+
"aria-valuemax": r,
|
|
39
|
+
"aria-valuenow": e,
|
|
40
|
+
children: /* @__PURE__ */ o(a, { className: "Bear-ContextMeter__fill" })
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
D as ContextMeter
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../constants/numbers.const.cjs"),e=require("./ContextMeter.const.cjs"),o=(t,n)=>{if(n<=r.ZERO)return r.ZERO;const E=t/n*e.CONTEXT_METER_PERCENT_CAP;return E<r.ZERO?r.ZERO:E>e.CONTEXT_METER_PERCENT_CAP?e.CONTEXT_METER_PERCENT_CAP:E},T=t=>t>=e.CONTEXT_METER_DANGER_PERCENT?"danger":t>=e.CONTEXT_METER_WARN_PERCENT?"warn":"ok";exports.resolveContextMeterPercent=o;exports.resolveContextMeterTone=T;
|