@flikk/ui 1.0.0-beta.13 → 1.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +4 -2
- package/dist/components/ai/PromptInput/VoiceRecorder.js +1 -1
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.theme.js +4 -4
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +6 -0
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.js +3 -14
- package/dist/components/ai/index.d.ts +0 -5
- package/dist/components/ai/index.js +8 -4
- package/dist/components/charts/DonutChart/DonutChart.js +1 -1
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.js +1 -1
- package/dist/components/charts/FunnelChart/FunnelChart.js +2 -2
- package/dist/components/charts/shared/ChartLegend/ChartLegend.types.d.ts +13 -1
- package/dist/components/charts/shared/ChartLegend/ChartLegendContent.js +1 -1
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.types.d.ts +13 -2
- package/dist/components/core/Accordion/AccordionItem.js +1 -1
- package/dist/components/core/Accordion/AccordionTrigger.js +1 -1
- package/dist/components/core/Alert/Alert.animations.d.ts +11 -0
- package/dist/components/core/Alert/Alert.animations.js +44 -0
- package/dist/components/core/Alert/Alert.js +16 -3
- package/dist/components/core/Avatar/Avatar.js +12 -7
- package/dist/components/core/Avatar/Avatar.theme.d.ts +4 -6
- package/dist/components/core/Avatar/Avatar.theme.js +22 -12
- package/dist/components/core/Avatar/Avatar.types.d.ts +9 -0
- package/dist/components/core/AvatarGroup/AvatarGroup.animations.js +2 -2
- package/dist/components/core/AvatarGroup/AvatarGroup.js +1 -2
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +1 -1
- package/dist/components/core/Badge/Badge.animations.js +1 -1
- package/dist/components/core/Badge/Badge.js +26 -50
- package/dist/components/core/Badge/Badge.theme.js +49 -63
- package/dist/components/core/Badge/Badge.types.d.ts +6 -30
- package/dist/components/core/Button/Button.js +2 -2
- package/dist/components/core/Button/Button.ripple.js +1 -1
- package/dist/components/core/Button/Button.theme.d.ts +1 -1
- package/dist/components/core/Button/Button.theme.js +5 -5
- package/dist/components/core/Button/Button.types.d.ts +1 -1
- package/dist/components/core/ButtonGroup/ButtonGroup.theme.js +6 -6
- package/dist/components/core/ButtonGroup/ButtonGroupText.js +1 -3
- package/dist/components/core/Calendar/Calendar.js +29 -3
- package/dist/components/core/Calendar/Calendar.theme.js +11 -7
- package/dist/components/core/Calendar/Calendar.types.d.ts +3 -0
- package/dist/components/core/Calendar/CalendarMini/CalendarMini.js +2 -2
- package/dist/components/core/Carousel/CarouselBody.js +0 -1
- package/dist/components/core/CommandPalette/CommandItem.js +1 -1
- package/dist/components/core/CommandPalette/CommandPalette.js +6 -4
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +1 -0
- package/dist/components/core/CommandPalette/CommandPalette.types.d.ts +6 -0
- package/dist/components/core/ContextMenu/ContextMenu.js +5 -4
- package/dist/components/core/ContextMenu/ContextMenuTrigger.js +5 -6
- package/dist/components/core/Drawer/Drawer.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.js +25 -2
- package/dist/components/core/Drawer/Drawer.theme.js +2 -2
- package/dist/components/core/Drawer/Drawer.types.d.ts +6 -0
- package/dist/components/core/Drawer/DrawerHeader.js +1 -1
- package/dist/components/core/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/core/Dropdown/Dropdown.js +5 -1
- package/dist/components/core/Dropdown/Dropdown.types.d.ts +1 -0
- package/dist/components/core/Dropdown/DropdownItem.js +1 -1
- package/dist/components/core/Dropdown/DropdownMenu.js +4 -4
- package/dist/components/core/Dropdown/DropdownSection.js +1 -1
- package/dist/components/core/Dropdown/DropdownSeparator.js +1 -1
- package/dist/components/core/Dropdown/DropdownTrigger.d.ts +6 -1
- package/dist/components/core/Dropdown/DropdownTrigger.js +10 -8
- package/dist/components/core/Kbd/Kbd.theme.js +3 -3
- package/dist/components/core/Link/Link.js +4 -2
- package/dist/components/core/Message/Message.d.ts +9 -0
- package/dist/components/core/Message/Message.js +44 -3
- package/dist/components/core/Message/Message.theme.js +22 -0
- package/dist/components/core/Message/Message.types.d.ts +115 -0
- package/dist/components/core/Message/MessageAudio.d.ts +8 -0
- package/dist/components/core/Message/MessageAudio.js +11 -0
- package/dist/components/core/Message/MessageContext.d.ts +3 -1
- package/dist/components/core/Message/MessageDateDivider.d.ts +6 -0
- package/dist/components/core/Message/MessageDateDivider.js +10 -0
- package/dist/components/core/Message/MessageFile.d.ts +9 -0
- package/dist/components/core/Message/MessageFile.js +15 -0
- package/dist/components/core/Message/MessageImage.d.ts +11 -0
- package/dist/components/core/Message/MessageImage.js +13 -0
- package/dist/components/core/Message/MessageLink.d.ts +10 -0
- package/dist/components/core/Message/MessageLink.js +15 -0
- package/dist/components/core/Message/MessageReactions.d.ts +8 -0
- package/dist/components/core/Message/MessageReactions.js +12 -0
- package/dist/components/core/Message/MessageReply.d.ts +8 -0
- package/dist/components/core/Message/MessageReply.js +10 -0
- package/dist/components/core/Message/MessageSenderName.d.ts +6 -0
- package/dist/components/core/Message/MessageSenderName.js +10 -0
- package/dist/components/core/Message/MessageStatusIndicator.d.ts +9 -0
- package/dist/components/core/Message/MessageStatusIndicator.js +45 -0
- package/dist/components/core/Message/index.d.ts +19 -1
- package/dist/components/core/Modal/Modal.animations.d.ts +1 -0
- package/dist/components/core/Modal/Modal.animations.js +14 -11
- package/dist/components/core/Modal/ModalHeader.js +1 -1
- package/dist/components/core/NavItem/NavItem.js +100 -52
- package/dist/components/core/NavItem/NavItem.theme.js +6 -3
- package/dist/components/core/NavItem/NavItem.types.d.ts +44 -30
- package/dist/components/core/NavItem/index.d.ts +1 -1
- package/dist/components/core/Pagination/Pagination.theme.js +1 -1
- package/dist/components/core/Pill/Pill.theme.js +1 -1
- package/dist/components/core/Popover/Popover.d.ts +1 -1
- package/dist/components/core/Popover/PopoverBody.js +2 -2
- package/dist/components/core/Popover/PopoverTrigger.d.ts +1 -1
- package/dist/components/core/Popover/PopoverTrigger.js +11 -11
- package/dist/components/core/Progress/Progress.d.ts +9 -8
- package/dist/components/core/Progress/Progress.js +16 -16
- package/dist/components/core/Progress/Progress.theme.js +5 -16
- package/dist/components/core/Progress/Progress.types.d.ts +2 -20
- package/dist/components/core/Progress/index.d.ts +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.js +49 -7
- package/dist/components/core/ScrollArea/ScrollArea.types.d.ts +12 -3
- package/dist/components/core/ScrollArea/index.d.ts +1 -1
- package/dist/components/core/Segmented/SegmentedItem.js +1 -1
- package/dist/components/core/Sidebar/Sidebar.d.ts +11 -1
- package/dist/components/core/Sidebar/Sidebar.js +51 -17
- package/dist/components/core/Sidebar/Sidebar.theme.js +9 -7
- package/dist/components/core/Sidebar/Sidebar.types.d.ts +57 -0
- package/dist/components/core/Sidebar/SidebarContent.js +3 -1
- package/dist/components/core/Sidebar/SidebarContext.d.ts +14 -0
- package/dist/components/core/Sidebar/SidebarContext.js +63 -11
- package/dist/components/core/Sidebar/SidebarFooter.js +3 -1
- package/dist/components/core/Sidebar/SidebarHeader.js +6 -2
- package/dist/components/core/Sidebar/SidebarMobileTrigger.d.ts +3 -0
- package/dist/components/core/Sidebar/SidebarMobileTrigger.js +29 -0
- package/dist/components/core/Sidebar/SidebarNav.js +3 -2
- package/dist/components/core/Sidebar/SidebarNavGroup.js +4 -2
- package/dist/components/core/Sidebar/SidebarToggle.js +2 -1
- package/dist/components/core/Sidebar/SidebarUserProfile.d.ts +3 -0
- package/dist/components/core/Sidebar/SidebarUserProfile.js +35 -0
- package/dist/components/core/Sidebar/index.d.ts +3 -1
- package/dist/components/core/SocialIcon/SocialIcon.js +1 -1
- package/dist/components/core/Sortable/Sortable.js +2 -2
- package/dist/components/core/Sortable/Sortable.theme.js +1 -1
- package/dist/components/core/Sortable/Sortable.types.d.ts +7 -5
- package/dist/components/core/Tabs/Tabs.theme.d.ts +1 -1
- package/dist/components/core/Tabs/Tabs.theme.js +3 -3
- package/dist/components/core/Tabs/TabsBody.js +1 -1
- package/dist/components/core/Tabs/TabsTrigger.js +1 -1
- package/dist/components/core/Tag/Tag.js +2 -2
- package/dist/components/core/Toast/Toast.d.ts +2 -2
- package/dist/components/core/Toast/Toast.js +30 -21
- package/dist/components/core/Toast/Toast.theme.js +4 -9
- package/dist/components/core/Toast/Toast.types.d.ts +4 -21
- package/dist/components/core/Toast/index.d.ts +1 -1
- package/dist/components/core/Tooltip/Tooltip.js +1 -1
- package/dist/components/core/Tooltip/Tooltip.theme.js +1 -1
- package/dist/components/core/index.js +11 -0
- package/dist/components/data-display/GanttChart/GanttChart.types.d.ts +2 -2
- package/dist/components/data-display/GanttChart/GanttToolbar.js +1 -1
- package/dist/components/data-display/Table/Table.types.d.ts +8 -8
- package/dist/components/effects/CustomCursor/CustomCursor.js +2 -2
- package/dist/components/effects/GlassSurface/GlassSurface.d.ts +1 -1
- package/dist/components/effects/GlassSurface/GlassSurface.js +12 -4
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.animations.d.ts +39 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.animations.js +98 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.js +104 -0
- package/dist/components/effects/InteractiveCharacters/InteractiveCharacters.types.d.ts +30 -0
- package/dist/components/effects/InteractiveCharacters/characters/BlobCharacter.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/characters/BlobCharacter.js +36 -0
- package/dist/components/effects/InteractiveCharacters/characters/SmallCharacter.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/characters/SmallCharacter.js +36 -0
- package/dist/components/effects/InteractiveCharacters/characters/TallCharacter.d.ts +3 -0
- package/dist/components/effects/InteractiveCharacters/characters/TallCharacter.js +37 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useBlink.d.ts +14 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useBlink.js +41 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useIdleAnimation.d.ts +25 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useIdleAnimation.js +84 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useMouseTracking.d.ts +18 -0
- package/dist/components/effects/InteractiveCharacters/hooks/useMouseTracking.js +35 -0
- package/dist/components/effects/InteractiveCharacters/index.d.ts +2 -0
- package/dist/components/effects/MorphingText/MorphingText.d.ts +1 -1
- package/dist/components/effects/MorphingText/MorphingText.js +6 -5
- package/dist/components/effects/Neumorphic/InsetCircleButton.d.ts +9 -0
- package/dist/components/effects/Neumorphic/InsetCircleButton.js +10 -0
- package/dist/components/effects/Neumorphic/InsetPill.d.ts +7 -0
- package/dist/components/effects/Neumorphic/InsetPill.js +7 -0
- package/dist/components/effects/Neumorphic/index.d.ts +4 -0
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.d.ts +1 -1
- package/dist/components/effects/NoiseOverlay/NoiseOverlay.js +4 -4
- package/dist/components/effects/Overlay/Overlay.js +6 -4
- package/dist/components/effects/PageTransition/PageTransition.animations.d.ts +8 -0
- package/dist/components/effects/PageTransition/PageTransition.animations.js +53 -0
- package/dist/components/effects/PageTransition/PageTransition.d.ts +3 -0
- package/dist/components/effects/PageTransition/PageTransition.js +71 -0
- package/dist/components/effects/PageTransition/PageTransition.types.d.ts +15 -0
- package/dist/components/effects/PageTransition/index.d.ts +2 -0
- package/dist/components/effects/index.d.ts +6 -0
- package/dist/components/effects/index.js +4 -0
- package/dist/components/forms/Checkbox/Checkbox.animations.d.ts +14 -0
- package/dist/components/forms/Checkbox/Checkbox.animations.js +53 -0
- package/dist/components/forms/Checkbox/Checkbox.js +4 -2
- package/dist/components/forms/Checkbox/Checkbox.theme.js +3 -3
- package/dist/components/forms/ColorPicker/ColorPicker.types.d.ts +1 -1
- package/dist/components/forms/ColorPicker/ColorPickerBody.js +3 -3
- package/dist/components/forms/Combobox/Combobox.js +5 -3
- package/dist/components/forms/DatePicker/DatePickerBody.js +1 -1
- package/dist/components/forms/DateRangePicker/DateRangePicker.animations.d.ts +1 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.d.ts +37 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.js +110 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.d.ts +5 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +52 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.types.d.ts +154 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerBody.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerBody.js +208 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerPresets.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerPresets.js +41 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.d.ts +6 -0
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.js +32 -0
- package/dist/components/forms/DateRangePicker/dateRangePresets.d.ts +5 -0
- package/dist/components/forms/DateRangePicker/dateRangePresets.js +59 -0
- package/dist/components/forms/DateRangePicker/index.d.ts +4 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.animations.d.ts +36 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.animations.js +22 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.d.ts +3 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.js +111 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.d.ts +19 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.js +27 -0
- package/dist/components/forms/FileUpload/FileUploadProgress.types.d.ts +33 -0
- package/dist/components/forms/FileUpload/index.d.ts +3 -0
- package/dist/components/forms/Input/Input.js +8 -13
- package/dist/components/forms/Input/Input.types.d.ts +6 -0
- package/dist/components/forms/InputAddress/InputAddress.theme.js +1 -1
- package/dist/components/forms/InputCounter/InputCounter.js +1 -1
- package/dist/components/forms/InputCreditCard/InputCreditCard.theme.js +1 -1
- package/dist/components/forms/InputOTP/InputOTP.theme.js +1 -1
- package/dist/components/forms/Radio/Radio.animations.d.ts +10 -0
- package/dist/components/forms/Radio/Radio.animations.js +33 -0
- package/dist/components/forms/Radio/Radio.js +11 -2
- package/dist/components/forms/Radio/Radio.theme.js +3 -3
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +23 -14
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +2 -2
- package/dist/components/forms/RichTextEditor/RichTextEditor.types.d.ts +11 -0
- package/dist/components/forms/Select/Select.d.ts +1 -1
- package/dist/components/forms/Select/Select.js +7 -7
- package/dist/components/forms/Select/Select.types.d.ts +3 -3
- package/dist/components/forms/SelectableCard/SelectableCard.js +1 -1
- package/dist/components/forms/Slider/Slider.theme.js +1 -1
- package/dist/components/forms/Switch/Switch.theme.js +3 -3
- package/dist/components/forms/forms.theme.js +1 -1
- package/dist/components/forms/index.d.ts +6 -0
- package/dist/components/forms/index.js +8 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useMediaQuery.d.ts +5 -0
- package/dist/hooks/useMediaQuery.js +21 -0
- package/dist/index.js +23 -0
- package/dist/styles.css +1 -1
- package/dist/utils/dateUtils.js +56 -5
- package/dist/utils/formatUtils.d.ts +10 -0
- package/dist/utils/formatUtils.js +24 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +12 -4
- package/src/global.scss +320 -39
- package/src/styles/theme.css +151 -62
- package/src/theme-plugin.css +13 -0
- package/dist/components/ai/ApprovalCard/ApprovalCard.d.ts +0 -3
- package/dist/components/ai/ApprovalCard/ApprovalCard.js +0 -16
- package/dist/components/ai/ApprovalCard/ApprovalCard.theme.d.ts +0 -13
- package/dist/components/ai/ApprovalCard/ApprovalCard.theme.js +0 -15
- package/dist/components/ai/ApprovalCard/ApprovalCard.types.d.ts +0 -43
- package/dist/components/ai/ApprovalCard/index.d.ts +0 -2
- package/dist/components/ai/MessageHistory/MessageHistory.d.ts +0 -18
- package/dist/components/ai/MessageHistory/MessageHistory.js +0 -98
- package/dist/components/ai/MessageHistory/MessageHistory.theme.d.ts +0 -2
- package/dist/components/ai/MessageHistory/MessageHistory.theme.js +0 -8
- package/dist/components/ai/MessageHistory/MessageHistory.types.d.ts +0 -94
- package/dist/components/ai/MessageHistory/index.d.ts +0 -3
- package/dist/icons/Icon.d.ts +0 -24
- package/dist/icons/Icon.js +0 -30
- package/dist/icons/Index.d.ts +0 -16
- package/dist/icons/core/ChevronUpDown.d.ts +0 -1
- package/dist/icons/core/ChevronUpDown.js +0 -7
- package/dist/icons/core/DollarIcon.d.ts +0 -1
- package/dist/icons/core/DollarIcon.js +0 -5
- package/dist/icons/core/LockIcon.d.ts +0 -1
- package/dist/icons/core/LockIcon.js +0 -5
- package/dist/icons/core/MinusIcon.d.ts +0 -1
- package/dist/icons/core/MinusIcon.js +0 -7
- package/dist/icons/core/PlusIcon.d.ts +0 -1
- package/dist/icons/core/PlusIcon.js +0 -7
- package/dist/icons/core/SearchIcon.d.ts +0 -1
- package/dist/icons/core/SearchIcon.js +0 -7
- package/dist/icons/core/TickIcon.d.ts +0 -1
- package/dist/icons/core/TickIcon.js +0 -5
- package/dist/icons/core/User.d.ts +0 -1
- package/dist/utils/useClickOutside.d.ts +0 -1
|
@@ -14,6 +14,15 @@ import { MessageActions } from './MessageActions.js';
|
|
|
14
14
|
import { MessageTimestamp } from './MessageTimestamp.js';
|
|
15
15
|
import { MessageList } from './MessageList.js';
|
|
16
16
|
import { TypeWriter } from './TypeWriter.js';
|
|
17
|
+
import { MessageStatusIndicator } from './MessageStatusIndicator.js';
|
|
18
|
+
import { MessageSenderName } from './MessageSenderName.js';
|
|
19
|
+
import { MessageFile } from './MessageFile.js';
|
|
20
|
+
import { MessageImage } from './MessageImage.js';
|
|
21
|
+
import { MessageAudio } from './MessageAudio.js';
|
|
22
|
+
import { MessageLink } from './MessageLink.js';
|
|
23
|
+
import { MessageReply } from './MessageReply.js';
|
|
24
|
+
import { MessageReactions } from './MessageReactions.js';
|
|
25
|
+
import { MessageDateDivider } from './MessageDateDivider.js';
|
|
17
26
|
|
|
18
27
|
const MessageFooter = ({ isStreaming, streamingIndicator, showTimestamp, timestamp, actions, timestampStyle, streamingIndicatorStyle, actionsContainerStyle, variant, }) => {
|
|
19
28
|
if (isStreaming) {
|
|
@@ -32,7 +41,26 @@ const MessageFooter = ({ isStreaming, streamingIndicator, showTimestamp, timesta
|
|
|
32
41
|
? timestamp
|
|
33
42
|
: timestamp.toISOString(), className: "select-none", children: formatTimestamp(timestamp) }) })), actions && jsx("div", { className: cn(actionsContainerStyle), children: actions })] }));
|
|
34
43
|
};
|
|
35
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Renders attachment sub-components based on attachment type
|
|
46
|
+
*/
|
|
47
|
+
const AttachmentsList = ({ attachments, containerClassName }) => {
|
|
48
|
+
return (jsx("div", { className: cn(messageTheme.attachmentContainerStyle, containerClassName), children: attachments.map((attachment, index) => {
|
|
49
|
+
switch (attachment.type) {
|
|
50
|
+
case "file":
|
|
51
|
+
return (jsx(MessageFile, { name: attachment.name, url: attachment.url, size: attachment.size }, index));
|
|
52
|
+
case "image":
|
|
53
|
+
return (jsx(MessageImage, { src: attachment.url, thumbnailUrl: attachment.thumbnailUrl, name: attachment.name, size: attachment.size }, index));
|
|
54
|
+
case "audio":
|
|
55
|
+
return (jsx(MessageAudio, { name: attachment.name, duration: attachment.duration }, index));
|
|
56
|
+
case "link":
|
|
57
|
+
return (jsx(MessageLink, { url: attachment.url, thumbnailUrl: attachment.thumbnailUrl, title: attachment.name, description: attachment.description, domain: attachment.domain }, index));
|
|
58
|
+
default:
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}) }));
|
|
62
|
+
};
|
|
63
|
+
const MessageRoot = React__default.forwardRef(({ role, variant: variantProp, content, timestamp, avatar, showTimestamp = false, isStreaming = false, streamingIndicator, typingSpeed = 100, actions, onCopy, onRegenerate, showActions, status, readAt, onRetry, attachments, reactions, onReactionClick, replyTo, sender, isGrouped, className, theme: customTheme = {}, children, ...props }, ref) => {
|
|
36
64
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
37
65
|
// Determine the variant: role takes precedence over variant prop
|
|
38
66
|
let variant;
|
|
@@ -57,7 +85,9 @@ const MessageRoot = React__default.forwardRef(({ role, variant: variantProp, con
|
|
|
57
85
|
variant,
|
|
58
86
|
isStreaming,
|
|
59
87
|
typingSpeed,
|
|
60
|
-
|
|
88
|
+
status,
|
|
89
|
+
isGrouped,
|
|
90
|
+
}), [role, variant, isStreaming, typingSpeed, status, isGrouped]);
|
|
61
91
|
const messageContent = content;
|
|
62
92
|
// Determine if we should show default actions
|
|
63
93
|
const shouldShowDefaultActions = showActions !== false &&
|
|
@@ -100,7 +130,9 @@ const MessageRoot = React__default.forwardRef(({ role, variant: variantProp, con
|
|
|
100
130
|
if (variant === "system") {
|
|
101
131
|
return (jsx("div", { ref: ref, className: cn("w-full max-w-full", className), "data-variant": "system", "data-role": role, ...props, children: jsxs("div", { className: containerStyle, children: [jsx("div", { className: bubbleStyle, children: typeof renderedContent === "string" ? (jsx("p", { className: "text-base", children: renderedContent })) : (renderedContent) }), jsx(MessageFooter, { isStreaming: isStreaming, streamingIndicator: streamingIndicator, showTimestamp: showTimestamp, timestamp: timestamp, actions: undefined, timestampStyle: timestampStyle, streamingIndicatorStyle: cn(messageTheme.streamingIndicatorStyle, customTheme.streamingIndicatorStyle), actionsContainerStyle: undefined, variant: "system" })] }) }));
|
|
102
132
|
}
|
|
103
|
-
|
|
133
|
+
const showAvatar = avatar && !isGrouped;
|
|
134
|
+
const showSenderName = (sender === null || sender === void 0 ? void 0 : sender.name) && variant === "receiver" && !isGrouped;
|
|
135
|
+
return (jsxs("div", { ref: ref, className: cn("w-full max-w-full group", className), "data-variant": variant, "data-role": role, ...props, children: [jsxs("div", { className: containerStyle, children: [showAvatar ? (jsx("div", { className: "flex-shrink-0", children: jsx(Avatar, { src: avatar.src, name: avatar.name, fallback: avatar.fallback, size: "xs" }) })) : isGrouped && avatar ? (jsx("div", { className: "flex-shrink-0 size-8" })) : null, jsxs("div", { className: cn("flex flex-col", variant === "sender" ? "items-end" : "items-start"), children: [showSenderName && jsx(MessageSenderName, { name: sender.name }), jsxs("div", { className: bubbleStyle, children: [replyTo && (jsx(MessageReply, { name: replyTo.name, content: replyTo.content, avatar: replyTo.avatar })), typeof renderedContent === "string" ? (jsx("p", { className: "break-words", children: renderedContent })) : (renderedContent), attachments && attachments.length > 0 && (jsx(AttachmentsList, { attachments: attachments, containerClassName: customTheme.attachmentContainerStyle }))] }), jsx(MessageFooter, { isStreaming: isStreaming, streamingIndicator: streamingIndicator, showTimestamp: showTimestamp, timestamp: timestamp, actions: finalActions, timestampStyle: timestampStyle, streamingIndicatorStyle: cn(messageTheme.streamingIndicatorStyle, customTheme.streamingIndicatorStyle), actionsContainerStyle: cn(messageTheme.actionsContainerStyle, customTheme.actionsContainerStyle), variant: variant }), status && variant === "sender" && (jsx(MessageStatusIndicator, { status: status, readAt: readAt, onRetry: onRetry, className: cn(variant === "sender" ? "self-end mr-1" : "self-start ml-1", customTheme.statusStyle) }))] })] }), reactions && reactions.length > 0 && (jsx("div", { className: cn("mt-0.5", avatar && !isGrouped ? "ml-11" : "", variant === "sender" ? "flex justify-end mr-1" : ""), children: jsx(MessageReactions, { reactions: reactions, onReactionClick: onReactionClick, className: customTheme.reactionsContainerStyle }) }))] }));
|
|
104
136
|
});
|
|
105
137
|
MessageRoot.displayName = "Message";
|
|
106
138
|
// Attach compound components
|
|
@@ -110,6 +142,15 @@ const Message = Object.assign(MessageRoot, {
|
|
|
110
142
|
Actions: MessageActions,
|
|
111
143
|
Timestamp: MessageTimestamp,
|
|
112
144
|
List: MessageList,
|
|
145
|
+
Status: MessageStatusIndicator,
|
|
146
|
+
SenderName: MessageSenderName,
|
|
147
|
+
File: MessageFile,
|
|
148
|
+
Image: MessageImage,
|
|
149
|
+
Audio: MessageAudio,
|
|
150
|
+
Link: MessageLink,
|
|
151
|
+
Reply: MessageReply,
|
|
152
|
+
Reactions: MessageReactions,
|
|
153
|
+
DateDivider: MessageDateDivider,
|
|
113
154
|
});
|
|
114
155
|
|
|
115
156
|
export { Message };
|
|
@@ -39,6 +39,28 @@ const messageTheme = {
|
|
|
39
39
|
streamingIndicatorStyle: "flex items-center gap-1 text-[var(--color-text-placeholder)] text-sm " +
|
|
40
40
|
"dark:text-[var(--color-neutral-500)]",
|
|
41
41
|
actionsContainerStyle: "flex items-start gap-3",
|
|
42
|
+
// Status styles
|
|
43
|
+
statusStyle: "flex items-center gap-1 text-xs mt-1",
|
|
44
|
+
statusSending: "text-[var(--color-text-placeholder)] animate-pulse",
|
|
45
|
+
statusSent: "text-[var(--color-text-placeholder)]",
|
|
46
|
+
statusDelivered: "text-[var(--color-text-placeholder)]",
|
|
47
|
+
statusRead: "text-[var(--color-primary)]",
|
|
48
|
+
statusFailed: "text-[var(--color-danger)]",
|
|
49
|
+
// Attachment styles
|
|
50
|
+
attachmentContainerStyle: "flex flex-col gap-2 mt-2",
|
|
51
|
+
fileStyle: "flex items-center gap-3 rounded-lg border border-[var(--color-border)] bg-[var(--color-background-secondary)] px-3 py-2.5 text-sm",
|
|
52
|
+
imageStyle: "rounded-lg overflow-hidden max-w-xs",
|
|
53
|
+
audioStyle: "flex items-center gap-3 rounded-lg border border-[var(--color-border)] bg-[var(--color-background-secondary)] px-3 py-2.5 text-sm",
|
|
54
|
+
linkStyle: "flex flex-col rounded-lg border border-[var(--color-border)] overflow-hidden text-sm max-w-xs",
|
|
55
|
+
// Reactions styles
|
|
56
|
+
reactionsContainerStyle: "flex flex-wrap items-center gap-1.5 mt-1.5",
|
|
57
|
+
reactionPillStyle: "inline-flex items-center gap-1 rounded-full border border-[var(--color-border)] bg-[var(--color-background-secondary)] px-2 py-0.5 text-xs cursor-pointer transition-colors hover:bg-[var(--color-background-tertiary)]",
|
|
58
|
+
reactionPillActiveStyle: "border-[var(--color-primary-200)] bg-[var(--color-primary-50)] text-[var(--color-primary)]",
|
|
59
|
+
// Reply/quote styles
|
|
60
|
+
replyStyle: "border-l-2 border-[var(--color-border)] pl-2.5 mb-2 text-xs text-[var(--color-text-muted)]",
|
|
61
|
+
// Grouping styles
|
|
62
|
+
dateDividerStyle: "flex items-center gap-3 text-xs text-[var(--color-text-muted)] select-none",
|
|
63
|
+
senderNameStyle: "text-xs font-medium text-[var(--color-text-secondary)] mb-1 pl-1",
|
|
42
64
|
};
|
|
43
65
|
|
|
44
66
|
export { messageTheme };
|
|
@@ -7,6 +7,50 @@ export type MessageRole = "user" | "assistant" | "system";
|
|
|
7
7
|
* Message variant types for chat UI
|
|
8
8
|
*/
|
|
9
9
|
export type MessageVariant = "sender" | "receiver" | "system";
|
|
10
|
+
/**
|
|
11
|
+
* Message delivery status
|
|
12
|
+
*/
|
|
13
|
+
export type MessageStatus = "sending" | "sent" | "delivered" | "read" | "failed";
|
|
14
|
+
/**
|
|
15
|
+
* Attachment types
|
|
16
|
+
*/
|
|
17
|
+
export type MessageAttachmentType = "file" | "image" | "audio" | "link";
|
|
18
|
+
/**
|
|
19
|
+
* Attachment data
|
|
20
|
+
*/
|
|
21
|
+
export interface MessageAttachment {
|
|
22
|
+
type: MessageAttachmentType;
|
|
23
|
+
name?: string;
|
|
24
|
+
url?: string;
|
|
25
|
+
size?: string;
|
|
26
|
+
duration?: string;
|
|
27
|
+
thumbnailUrl?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
domain?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Reaction data
|
|
33
|
+
*/
|
|
34
|
+
export interface MessageReaction {
|
|
35
|
+
emoji: string;
|
|
36
|
+
count: number;
|
|
37
|
+
reacted?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reply/quote reference
|
|
41
|
+
*/
|
|
42
|
+
export interface MessageReplyTo {
|
|
43
|
+
name: string;
|
|
44
|
+
content: string;
|
|
45
|
+
avatar?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Sender display info
|
|
49
|
+
*/
|
|
50
|
+
export interface MessageSenderInfo {
|
|
51
|
+
name: string;
|
|
52
|
+
avatar?: string;
|
|
53
|
+
}
|
|
10
54
|
/**
|
|
11
55
|
* Avatar configuration for message sender
|
|
12
56
|
*/
|
|
@@ -99,6 +143,43 @@ export interface MessageProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
99
143
|
* @default true for assistant messages
|
|
100
144
|
*/
|
|
101
145
|
showActions?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Delivery status indicator (sending/sent/delivered/read/failed)
|
|
148
|
+
* Only renders for sender variant
|
|
149
|
+
*/
|
|
150
|
+
status?: MessageStatus;
|
|
151
|
+
/**
|
|
152
|
+
* Timestamp when the message was read (shown alongside read status)
|
|
153
|
+
*/
|
|
154
|
+
readAt?: Date | string;
|
|
155
|
+
/**
|
|
156
|
+
* Callback when retry button is clicked on failed messages
|
|
157
|
+
*/
|
|
158
|
+
onRetry?: () => void;
|
|
159
|
+
/**
|
|
160
|
+
* File, image, audio, or link attachments
|
|
161
|
+
*/
|
|
162
|
+
attachments?: MessageAttachment[];
|
|
163
|
+
/**
|
|
164
|
+
* Emoji reactions displayed below the message
|
|
165
|
+
*/
|
|
166
|
+
reactions?: MessageReaction[];
|
|
167
|
+
/**
|
|
168
|
+
* Callback when a reaction pill is clicked
|
|
169
|
+
*/
|
|
170
|
+
onReactionClick?: (emoji: string) => void;
|
|
171
|
+
/**
|
|
172
|
+
* Reply/quote reference shown above message content
|
|
173
|
+
*/
|
|
174
|
+
replyTo?: MessageReplyTo;
|
|
175
|
+
/**
|
|
176
|
+
* Sender display info (name shown above receiver bubbles)
|
|
177
|
+
*/
|
|
178
|
+
sender?: MessageSenderInfo;
|
|
179
|
+
/**
|
|
180
|
+
* Whether this is a consecutive message from the same sender (hides avatar & name)
|
|
181
|
+
*/
|
|
182
|
+
isGrouped?: boolean;
|
|
102
183
|
/**
|
|
103
184
|
* Custom theme overrides
|
|
104
185
|
*/
|
|
@@ -126,6 +207,23 @@ export interface MessageTheme {
|
|
|
126
207
|
};
|
|
127
208
|
streamingIndicatorStyle: string;
|
|
128
209
|
actionsContainerStyle: string;
|
|
210
|
+
statusStyle: string;
|
|
211
|
+
statusSending: string;
|
|
212
|
+
statusSent: string;
|
|
213
|
+
statusDelivered: string;
|
|
214
|
+
statusRead: string;
|
|
215
|
+
statusFailed: string;
|
|
216
|
+
attachmentContainerStyle: string;
|
|
217
|
+
fileStyle: string;
|
|
218
|
+
imageStyle: string;
|
|
219
|
+
audioStyle: string;
|
|
220
|
+
linkStyle: string;
|
|
221
|
+
reactionsContainerStyle: string;
|
|
222
|
+
reactionPillStyle: string;
|
|
223
|
+
reactionPillActiveStyle: string;
|
|
224
|
+
replyStyle: string;
|
|
225
|
+
dateDividerStyle: string;
|
|
226
|
+
senderNameStyle: string;
|
|
129
227
|
}
|
|
130
228
|
/**
|
|
131
229
|
* Theme overrides for Message component
|
|
@@ -141,6 +239,23 @@ export interface MessageThemeOverrides {
|
|
|
141
239
|
};
|
|
142
240
|
streamingIndicatorStyle?: string;
|
|
143
241
|
actionsContainerStyle?: string;
|
|
242
|
+
statusStyle?: string;
|
|
243
|
+
statusSending?: string;
|
|
244
|
+
statusSent?: string;
|
|
245
|
+
statusDelivered?: string;
|
|
246
|
+
statusRead?: string;
|
|
247
|
+
statusFailed?: string;
|
|
248
|
+
attachmentContainerStyle?: string;
|
|
249
|
+
fileStyle?: string;
|
|
250
|
+
imageStyle?: string;
|
|
251
|
+
audioStyle?: string;
|
|
252
|
+
linkStyle?: string;
|
|
253
|
+
reactionsContainerStyle?: string;
|
|
254
|
+
reactionPillStyle?: string;
|
|
255
|
+
reactionPillActiveStyle?: string;
|
|
256
|
+
replyStyle?: string;
|
|
257
|
+
dateDividerStyle?: string;
|
|
258
|
+
senderNameStyle?: string;
|
|
144
259
|
/** @deprecated Use variants.sender.containerModifier instead */
|
|
145
260
|
senderContainerStyle?: string;
|
|
146
261
|
/** @deprecated Use variants.sender.bubbleStyle instead */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { messageTheme } from './Message.theme.js';
|
|
5
|
+
import { PlayIcon } from '@heroicons/react/24/solid';
|
|
6
|
+
|
|
7
|
+
const MessageAudio = ({ duration, name, onClick, className, }) => {
|
|
8
|
+
return (jsxs("div", { className: cn(messageTheme.audioStyle, className), children: [jsx("button", { onClick: onClick, className: "flex items-center justify-center size-8 rounded-full bg-[var(--color-primary)] text-white flex-shrink-0 cursor-pointer", "aria-label": name ? `Play ${name}` : "Play audio", type: "button", children: jsx(PlayIcon, { className: "size-4 ml-0.5" }) }), jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [name && (jsx("span", { className: "font-medium text-[var(--color-text-primary)] truncate", children: name })), duration && (jsx("span", { className: "text-xs text-[var(--color-text-muted)]", children: duration }))] })] }));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { MessageAudio };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { MessageRole, MessageVariant } from './Message.types';
|
|
1
|
+
import { MessageRole, MessageVariant, MessageStatus } from './Message.types';
|
|
2
2
|
export interface MessageContextValue {
|
|
3
3
|
role?: MessageRole;
|
|
4
4
|
variant: MessageVariant;
|
|
5
5
|
isStreaming?: boolean;
|
|
6
6
|
typingSpeed?: number;
|
|
7
|
+
status?: MessageStatus;
|
|
8
|
+
isGrouped?: boolean;
|
|
7
9
|
}
|
|
8
10
|
export declare const MessageContext: import("react").Context<MessageContextValue | undefined>;
|
|
9
11
|
export declare const useMessageContext: () => MessageContextValue;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { messageTheme } from './Message.theme.js';
|
|
5
|
+
|
|
6
|
+
const MessageDateDivider = ({ label, className, }) => {
|
|
7
|
+
return (jsxs("div", { className: cn(messageTheme.dateDividerStyle, className), children: [jsx("hr", { className: "flex-1 border-t border-[var(--color-border)]" }), jsx("span", { children: label }), jsx("hr", { className: "flex-1 border-t border-[var(--color-border)]" })] }));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { MessageDateDivider };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { messageTheme } from './Message.theme.js';
|
|
5
|
+
import { DocumentIcon, ArrowDownTrayIcon } from '@heroicons/react/24/outline';
|
|
6
|
+
|
|
7
|
+
const MessageFile = ({ name = "File", url, size, onClick, className, }) => {
|
|
8
|
+
const content = (jsxs("div", { className: cn(messageTheme.fileStyle, className), onClick: !url ? onClick : undefined, role: !url && onClick ? "button" : undefined, tabIndex: !url && onClick ? 0 : undefined, children: [jsx(DocumentIcon, { className: "size-5 flex-shrink-0 text-[var(--color-text-muted)]" }), jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [jsx("span", { className: "font-medium text-[var(--color-text-primary)] truncate", children: name }), size && (jsx("span", { className: "text-xs text-[var(--color-text-muted)]", children: size }))] }), url && (jsx(ArrowDownTrayIcon, { className: "size-4 flex-shrink-0 text-[var(--color-text-muted)]" }))] }));
|
|
9
|
+
if (url) {
|
|
10
|
+
return (jsx("a", { href: url, download: true, className: "no-underline", "aria-label": `Download ${name}`, children: content }));
|
|
11
|
+
}
|
|
12
|
+
return content;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { MessageFile };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface MessageImageProps {
|
|
3
|
+
src?: string;
|
|
4
|
+
thumbnailUrl?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
size?: string;
|
|
7
|
+
alt?: string;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const MessageImage: React.FC<MessageImageProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { messageTheme } from './Message.theme.js';
|
|
5
|
+
|
|
6
|
+
const MessageImage = ({ src, thumbnailUrl, name, size, alt, onClick, className, }) => {
|
|
7
|
+
const imgSrc = thumbnailUrl || src;
|
|
8
|
+
if (!imgSrc)
|
|
9
|
+
return null;
|
|
10
|
+
return (jsxs("div", { className: cn(messageTheme.imageStyle, className), children: [jsx("img", { src: imgSrc, alt: alt || name || "Image attachment", className: "w-full h-auto object-cover cursor-pointer", onClick: onClick, role: onClick ? "button" : undefined, tabIndex: onClick ? 0 : undefined }), (name || size) && (jsxs("div", { className: "flex items-center justify-between px-2 py-1.5 text-xs text-[var(--color-text-muted)]", children: [name && jsx("span", { className: "truncate", children: name }), size && jsx("span", { className: "flex-shrink-0", children: size })] }))] }));
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { MessageImage };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { messageTheme } from './Message.theme.js';
|
|
5
|
+
import { LinkIcon } from '@heroicons/react/16/solid';
|
|
6
|
+
|
|
7
|
+
const MessageLink = ({ url, thumbnailUrl, title, description, domain, className, }) => {
|
|
8
|
+
const content = (jsxs("div", { className: cn(messageTheme.linkStyle, className), children: [thumbnailUrl && (jsx("img", { src: thumbnailUrl, alt: title || "Link preview", className: "w-full h-32 object-cover" })), jsxs("div", { className: "px-3 py-2.5 flex flex-col gap-0.5", children: [title && (jsx("span", { className: "font-medium text-[var(--color-text-primary)] line-clamp-1", children: title })), description && (jsx("span", { className: "text-[var(--color-text-muted)] line-clamp-2", children: description })), domain && (jsxs("span", { className: "flex items-center gap-1 text-xs text-[var(--color-text-placeholder)] mt-0.5", children: [jsx(LinkIcon, { className: "size-3" }), domain] }))] })] }));
|
|
9
|
+
if (url) {
|
|
10
|
+
return (jsx("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "no-underline", "aria-label": title ? `Open ${title}` : "Open link", children: content }));
|
|
11
|
+
}
|
|
12
|
+
return content;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { MessageLink };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MessageReaction } from "./Message.types";
|
|
3
|
+
export interface MessageReactionsProps {
|
|
4
|
+
reactions?: MessageReaction[];
|
|
5
|
+
onReactionClick?: (emoji: string) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const MessageReactions: React.FC<MessageReactionsProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { messageTheme } from './Message.theme.js';
|
|
5
|
+
|
|
6
|
+
const MessageReactions = ({ reactions, onReactionClick, className, }) => {
|
|
7
|
+
if (!(reactions === null || reactions === void 0 ? void 0 : reactions.length))
|
|
8
|
+
return null;
|
|
9
|
+
return (jsx("div", { className: cn(messageTheme.reactionsContainerStyle, className), children: reactions.map((reaction) => (jsxs("button", { type: "button", onClick: () => onReactionClick === null || onReactionClick === void 0 ? void 0 : onReactionClick(reaction.emoji), className: cn(messageTheme.reactionPillStyle, reaction.reacted && messageTheme.reactionPillActiveStyle), "aria-label": `${reaction.emoji} ${reaction.count}`, children: [jsx("span", { children: reaction.emoji }), jsx("span", { children: reaction.count })] }, reaction.emoji))) }));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { MessageReactions };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { messageTheme } from './Message.theme.js';
|
|
5
|
+
|
|
6
|
+
const MessageReply = ({ name, content, className, }) => {
|
|
7
|
+
return (jsxs("div", { className: cn(messageTheme.replyStyle, className), children: [jsx("span", { className: "font-semibold text-[var(--color-text-primary)]", children: name }), jsx("p", { className: "line-clamp-2 mt-0.5", children: content })] }));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { MessageReply };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { messageTheme } from './Message.theme.js';
|
|
5
|
+
|
|
6
|
+
const MessageSenderName = ({ name, className, }) => {
|
|
7
|
+
return (jsx("span", { className: cn(messageTheme.senderNameStyle, className), children: name }));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { MessageSenderName };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MessageStatus } from "./Message.types";
|
|
3
|
+
export interface MessageStatusIndicatorProps {
|
|
4
|
+
status?: MessageStatus;
|
|
5
|
+
readAt?: Date | string;
|
|
6
|
+
onRetry?: () => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const MessageStatusIndicator: React.FC<MessageStatusIndicatorProps>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { messageTheme } from './Message.theme.js';
|
|
5
|
+
import { Button } from '../Button/Button.js';
|
|
6
|
+
import { ExclamationCircleIcon, CheckIcon, ClockIcon } from '@heroicons/react/16/solid';
|
|
7
|
+
|
|
8
|
+
const DoubleCheck = ({ className }) => (jsxs("span", { className: cn("inline-flex items-center -space-x-2", className), children: [jsx(CheckIcon, { className: "size-3.5" }), jsx(CheckIcon, { className: "size-3.5" })] }));
|
|
9
|
+
const MessageStatusIndicator = ({ status, readAt, onRetry, className, }) => {
|
|
10
|
+
if (!status)
|
|
11
|
+
return null;
|
|
12
|
+
const statusConfig = {
|
|
13
|
+
sending: {
|
|
14
|
+
icon: jsx(ClockIcon, { className: "size-3.5" }),
|
|
15
|
+
style: messageTheme.statusSending,
|
|
16
|
+
label: "Sending",
|
|
17
|
+
},
|
|
18
|
+
sent: {
|
|
19
|
+
icon: jsx(CheckIcon, { className: "size-3.5" }),
|
|
20
|
+
style: messageTheme.statusSent,
|
|
21
|
+
label: "Sent",
|
|
22
|
+
},
|
|
23
|
+
delivered: {
|
|
24
|
+
icon: jsx(DoubleCheck, {}),
|
|
25
|
+
style: messageTheme.statusDelivered,
|
|
26
|
+
label: "Delivered",
|
|
27
|
+
},
|
|
28
|
+
read: {
|
|
29
|
+
icon: jsx(DoubleCheck, {}),
|
|
30
|
+
style: messageTheme.statusRead,
|
|
31
|
+
label: readAt
|
|
32
|
+
? `Read ${typeof readAt === "string" ? readAt : readAt.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}`
|
|
33
|
+
: "Read",
|
|
34
|
+
},
|
|
35
|
+
failed: {
|
|
36
|
+
icon: jsx(ExclamationCircleIcon, { className: "size-3.5" }),
|
|
37
|
+
style: messageTheme.statusFailed,
|
|
38
|
+
label: "Failed",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const config = statusConfig[status];
|
|
42
|
+
return (jsxs("div", { className: cn(messageTheme.statusStyle, config.style, className), "aria-label": config.label, children: [config.icon, status === "failed" && onRetry && (jsx(Button, { variant: "link", color: "danger", size: "sm", onClick: onRetry, className: "text-xs px-0 h-auto", "aria-label": "Retry sending message", children: "Retry" }))] }));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { MessageStatusIndicator };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Message } from './Message';
|
|
2
|
-
export type { MessageProps, MessageRole, MessageVariant, MessageAvatarProps, MessageTheme, MessageThemeOverrides, MessageVariantTheme, } from './Message.types';
|
|
2
|
+
export type { MessageProps, MessageRole, MessageVariant, MessageAvatarProps, MessageTheme, MessageThemeOverrides, MessageVariantTheme, MessageStatus, MessageAttachmentType, MessageAttachment, MessageReaction, MessageReplyTo, MessageSenderInfo, } from './Message.types';
|
|
3
3
|
export { messageTheme } from './Message.theme';
|
|
4
4
|
export { messageListTheme } from './MessageList.theme';
|
|
5
5
|
export type { MessageListProps, MessageListTheme, MessageListThemeOverrides, } from './MessageList.types';
|
|
@@ -7,3 +7,21 @@ export { TypeWriter } from './TypeWriter';
|
|
|
7
7
|
export type { TypeWriterProps } from './TypeWriter';
|
|
8
8
|
export { MessageBody } from './MessageBody';
|
|
9
9
|
export type { MessageBodyProps } from './MessageBody';
|
|
10
|
+
export { MessageStatusIndicator } from './MessageStatusIndicator';
|
|
11
|
+
export type { MessageStatusIndicatorProps } from './MessageStatusIndicator';
|
|
12
|
+
export { MessageSenderName } from './MessageSenderName';
|
|
13
|
+
export type { MessageSenderNameProps } from './MessageSenderName';
|
|
14
|
+
export { MessageFile } from './MessageFile';
|
|
15
|
+
export type { MessageFileProps } from './MessageFile';
|
|
16
|
+
export { MessageImage } from './MessageImage';
|
|
17
|
+
export type { MessageImageProps } from './MessageImage';
|
|
18
|
+
export { MessageAudio } from './MessageAudio';
|
|
19
|
+
export type { MessageAudioProps } from './MessageAudio';
|
|
20
|
+
export { MessageLink } from './MessageLink';
|
|
21
|
+
export type { MessageLinkProps } from './MessageLink';
|
|
22
|
+
export { MessageReply } from './MessageReply';
|
|
23
|
+
export type { MessageReplyProps } from './MessageReply';
|
|
24
|
+
export { MessageReactions } from './MessageReactions';
|
|
25
|
+
export type { MessageReactionsProps } from './MessageReactions';
|
|
26
|
+
export { MessageDateDivider } from './MessageDateDivider';
|
|
27
|
+
export type { MessageDateDividerProps } from './MessageDateDivider';
|
|
@@ -22,30 +22,33 @@ const modalOverlayAnimations = {
|
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* Modal content animation variants
|
|
25
|
+
* Scale + slight slide (Vercel/Notion style)
|
|
25
26
|
*/
|
|
26
27
|
const modalContentAnimations = {
|
|
27
28
|
initial: {
|
|
28
29
|
opacity: 0,
|
|
29
|
-
|
|
30
|
+
scale: 0.98,
|
|
31
|
+
y: 8,
|
|
30
32
|
},
|
|
31
33
|
animate: {
|
|
32
34
|
opacity: 1,
|
|
35
|
+
scale: 1,
|
|
33
36
|
y: 0,
|
|
34
37
|
transition: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
38
|
+
duration: 0.2,
|
|
39
|
+
ease: [0.4, 0, 0.2, 1],
|
|
40
|
+
delay: 0.05,
|
|
41
|
+
},
|
|
40
42
|
},
|
|
41
43
|
exit: {
|
|
42
44
|
opacity: 0,
|
|
43
|
-
|
|
45
|
+
scale: 0.98,
|
|
46
|
+
y: 4,
|
|
44
47
|
transition: {
|
|
45
|
-
duration: 0.
|
|
46
|
-
ease:
|
|
47
|
-
}
|
|
48
|
-
}
|
|
48
|
+
duration: 0.15,
|
|
49
|
+
ease: [0.4, 0, 1, 1],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
49
52
|
};
|
|
50
53
|
|
|
51
54
|
export { modalContentAnimations, modalOverlayAnimations };
|
|
@@ -8,7 +8,7 @@ import { XMarkIcon } from '@heroicons/react/24/outline';
|
|
|
8
8
|
const ModalHeader = ({ children, icon, showCloseButton, className, ...props }) => {
|
|
9
9
|
const { onClose, showCloseButton: contextShowCloseButton, theme, isBodyScrollable, } = useModalContext();
|
|
10
10
|
const shouldShowCloseButton = showCloseButton !== null && showCloseButton !== void 0 ? showCloseButton : contextShowCloseButton;
|
|
11
|
-
return (jsxs("div", { className: cn(theme.header, isBodyScrollable && "border-[var(--color-border)] relative", className), ...props, children: [jsxs("div", { className: cn(theme.headerContent), children: [icon && (jsx("div", { className: "flex-shrink-0 text-[var(--color-text-secondary)]", children: icon })), jsx("div", { className: "flex-1", children: children })] }), shouldShowCloseButton && (jsx("div", { className: "", children: jsx(Button, { color: "neutral", variant: "
|
|
11
|
+
return (jsxs("div", { className: cn(theme.header, isBodyScrollable && "border-[var(--color-border)] relative", className), ...props, children: [jsxs("div", { className: cn(theme.headerContent), children: [icon && (jsx("div", { className: "flex-shrink-0 text-[var(--color-text-secondary)]", children: icon })), jsx("div", { className: "flex-1", children: children })] }), shouldShowCloseButton && (jsx("div", { className: "", children: jsx(Button, { color: "neutral", variant: "soft", iconOnly: true, size: "sm", onClick: onClose, "aria-label": "Close modal", className: "rounded-full", children: jsx(XMarkIcon, { className: "size-5" }) }) }))] }));
|
|
12
12
|
};
|
|
13
13
|
ModalHeader.displayName = "Modal.Header";
|
|
14
14
|
|