@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
|
@@ -7,7 +7,7 @@ const codeBlockTheme = {
|
|
|
7
7
|
languageLabel: "text-sm uppercase tracking-wider font-semibold text-[var(--color-text-muted)]",
|
|
8
8
|
codeWrapper: "overflow-x-auto",
|
|
9
9
|
lineNumber: "text-[var(--color-text-muted)] select-none text-right tabular-nums min-w-[2.5rem] pr-4 opacity-50",
|
|
10
|
-
highlightedLine: " -mx-4 px-4 bg-[var(--color-primary-50)] border-l-2 border-l-[var(--color-primary)] dark:bg-neutral-400/5 dark:border-l-neutral-200",
|
|
10
|
+
highlightedLine: " -mx-4 px-4 bg-[var(--color-primary-50)] border-l-2 border-l-[var(--color-primary)] dark:bg-[var(--color-neutral-400)]/5 dark:border-l-[var(--color-neutral-200)]",
|
|
11
11
|
diffAddition: "-mx-4 px-4 bg-[var(--color-success-50)] border-l-4 border-l-[var(--color-success)] dark:bg-[var(--color-success-600)]/20 dark:border-l-[var(--color-success-700)]",
|
|
12
12
|
diffDeletion: "-mx-4 px-4 bg-[var(--color-danger-50)] border-l-4 border-l-[var(--color-danger)] dark:bg-[var(--color-danger-600)]/20 dark:border-l-[var(--color-danger-700)]",
|
|
13
13
|
copyButton: "p-1.5 rounded-[calc(var(--radius-base)*0.75)] text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-background-tertiary)] transition-colors cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]",
|
|
@@ -512,13 +512,15 @@ className, textareaClassName, footerClassName, theme = {},
|
|
|
512
512
|
return (jsx(Button, { iconOnly: true, className: cn(mergedTheme.submitButtonStyle, extraClassName), size: buttonSize, variant: buttonVariant, color: buttonColor, onClick: handleSubmit, disabled: !canSubmit, state: isLoading ? "loading" : "default", "aria-label": submitButtonLabel, title: submitShortcut ? `Submit (${submitShortcut})` : undefined, showReflection: buttonVariant === "filled" ? false : undefined, children: jsx(AnimatePresence, { mode: "wait", initial: false, children: jsx(motion.span, { variants: iconSwapVariants, initial: "initial", animate: "animate", exit: "exit", className: "flex items-center justify-center", children: submitButtonIcon }, "submit") }) }));
|
|
513
513
|
};
|
|
514
514
|
// ========== Render ==========
|
|
515
|
-
return (jsxs("div", { className: cn("
|
|
515
|
+
return (jsxs("div", { className: cn("w-full mx-auto", className), ...props, children: [jsx("input", { ref: fileInputRef, type: "file", accept: acceptedFileTypes.join(","), multiple: true, onChange: (e) => {
|
|
516
516
|
if (e.target.files)
|
|
517
517
|
processFiles(e.target.files);
|
|
518
518
|
e.target.value = "";
|
|
519
519
|
}, className: "sr-only", "aria-label": "Attach files" }), jsxs("div", { className: cn("relative", mergedTheme.baseStyle, mergedTheme.stateStyle, variant === "simple" ? "p-3 rounded-full pl-5" : ""), onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [jsx(AnimatePresence, { children: isDragOver && enableDropzone && (jsxs(motion.div, { variants: dropzoneContainerVariants, initial: "initial", animate: "animate", exit: "exit", className: mergedTheme.dropzoneStyle, children: [jsx(motion.div, { variants: dropzoneChildVariants, children: jsx(CloudArrowUpIcon, { className: "size-8 text-[var(--color-primary)] mx-auto" }) }), jsx(motion.p, { variants: dropzoneChildVariants, className: mergedTheme.dropzoneTitleStyle, children: dropzoneTitle ? (
|
|
520
520
|
// Parse **browse** as clickable button
|
|
521
|
-
jsx(Fragment, { children: resolvedDropzoneTitle
|
|
521
|
+
jsx(Fragment, { children: resolvedDropzoneTitle
|
|
522
|
+
.split(/\*\*(.*?)\*\*/)
|
|
523
|
+
.map((part, i) => i % 2 === 1 ? (jsx("button", { type: "button", onClick: handleDropzoneBrowse, className: "font-bold underline underline-offset-2 cursor-pointer hover:opacity-80", children: part }, i)) : (jsx("span", { children: part }, i))) })) : (resolvedDropzoneTitle) }), dropzoneSubtitle && (jsx(motion.p, { variants: dropzoneChildVariants, className: mergedTheme.dropzoneSubtitleStyle, children: dropzoneSubtitle })), dropzoneTitle && (jsx(motion.div, { variants: dropzoneChildVariants, className: mergedTheme.dropzoneActionsStyle, children: [
|
|
522
524
|
CloudArrowUpIcon,
|
|
523
525
|
MicrophoneIcon,
|
|
524
526
|
PaperClipIcon,
|
|
@@ -170,7 +170,7 @@ const VoiceRecorder = ({ onComplete, onCancel, maxDuration, className, }) => {
|
|
|
170
170
|
setRecordingState("recording");
|
|
171
171
|
}
|
|
172
172
|
}, [recordingState, clearTimer, startTimer]);
|
|
173
|
-
return (jsxs("div", { className: cn("flex items-center justify-between w-full", className), children: [jsx(Button, { variant: "
|
|
173
|
+
return (jsxs("div", { className: cn("flex items-center justify-between w-full", className), children: [jsx(Button, { variant: "soft", color: "neutral", size: "sm", className: "rounded-full", onClick: handleCancel, "aria-label": "Cancel recording", children: "Cancel" }), jsxs("div", { className: "flex items-center gap-2.5", children: [jsx(motion.div, { className: "size-2.5 rounded-full bg-[var(--color-danger)]", animate: recordingState === "recording"
|
|
174
174
|
? { opacity: [1, 0.3, 1] }
|
|
175
175
|
: { opacity: 0.5 }, transition: recordingState === "recording"
|
|
176
176
|
? { duration: 1.2, repeat: Infinity, ease: "easeInOut" }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const promptSuggestionTheme = {
|
|
2
|
-
baseStyle: "inline-flex items-center gap-2 py-
|
|
3
|
-
"bg-
|
|
2
|
+
baseStyle: "inline-flex items-center gap-2 py-1 px-3 rounded-[var(--card-radius)] " +
|
|
3
|
+
"bg-[var(--color-surface)] " +
|
|
4
4
|
"border border-[var(--color-border)] " +
|
|
5
|
-
"text-base
|
|
5
|
+
"text-base text-[var(--color-text-primary)] " +
|
|
6
6
|
"cursor-pointer transition-all duration-300 " +
|
|
7
|
-
"hover:bg-[var(--color-background-secondary)]
|
|
7
|
+
"hover:bg-[var(--color-background-secondary)] " +
|
|
8
8
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]",
|
|
9
9
|
iconStyle: "size-4 flex-shrink-0",
|
|
10
10
|
};
|
|
@@ -4,6 +4,12 @@ import { useStreamingSSE } from '../../../hooks/useStreamingSSE.js';
|
|
|
4
4
|
import { Message } from '../../core/Message/Message.js';
|
|
5
5
|
import { TypeWriter } from '../../core/Message/TypeWriter.js';
|
|
6
6
|
import '../../core/Message/MessageBody.js';
|
|
7
|
+
import 'clsx';
|
|
8
|
+
import 'tailwind-merge';
|
|
9
|
+
import '../../core/Button/Button.js';
|
|
10
|
+
import '@heroicons/react/16/solid';
|
|
11
|
+
import '@heroicons/react/24/outline';
|
|
12
|
+
import '@heroicons/react/24/solid';
|
|
7
13
|
import { ErrorDisplay } from './ErrorDisplay.js';
|
|
8
14
|
import { MarkdownRenderer } from './MarkdownRenderer.js';
|
|
9
15
|
import { AnimatedText } from './AnimatedText.js';
|
|
@@ -35,20 +35,9 @@ const ThinkingIndicator = React__default.forwardRef(({ visible = true, label = "
|
|
|
35
35
|
const dotsContainerStyle = customTheme.dotsContainerStyle ||
|
|
36
36
|
thinkingIndicatorTheme.dotsContainerStyle;
|
|
37
37
|
const dotStyle = customTheme.dotStyle || thinkingIndicatorTheme.dotStyle;
|
|
38
|
-
//
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
initial: { opacity: 0 },
|
|
42
|
-
animate: { opacity: 1 },
|
|
43
|
-
exit: { opacity: 0 },
|
|
44
|
-
}
|
|
45
|
-
: {
|
|
46
|
-
variants: containerVariants,
|
|
47
|
-
initial: "hidden",
|
|
48
|
-
animate: "visible",
|
|
49
|
-
exit: "exit",
|
|
50
|
-
};
|
|
51
|
-
return (jsx(AnimatePresence, { mode: "wait", children: visible && (jsxs(motion.div, { ref: ref, className: cn(baseStyle, sizeConfig.container, className), ...reducedMotionProps, ...props, children: [icon ? (jsx("span", { className: dotsContainerStyle, children: icon })) : (jsx("span", { className: dotsContainerStyle, children: [0, 1, 2].map((index) => (jsx(motion.span, { className: cn(dotStyle, sizeConfig.dot), variants: shouldReduceMotion ? undefined : dotVariants, initial: "initial", animate: "animate", custom: index, style: shouldReduceMotion ? { opacity: 0.7 } : undefined }, index))) })), showLabel && (jsx("span", { className: cn(labelStyle, sizeConfig.label), children: label }))] })) }));
|
|
38
|
+
// Extract conflicting DOM props for motion.div compatibility
|
|
39
|
+
const { onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, ...motionSafeProps } = props;
|
|
40
|
+
return (jsx(AnimatePresence, { mode: "wait", children: visible && (jsxs(motion.div, { ref: ref, className: cn(baseStyle, sizeConfig.container, className), variants: shouldReduceMotion ? undefined : containerVariants, initial: shouldReduceMotion ? { opacity: 0 } : "hidden", animate: shouldReduceMotion ? { opacity: 1 } : "visible", exit: shouldReduceMotion ? { opacity: 0 } : "exit", ...motionSafeProps, children: [icon ? (jsx("span", { className: dotsContainerStyle, children: icon })) : (jsx("span", { className: dotsContainerStyle, children: [0, 1, 2].map((index) => (jsx(motion.span, { className: cn(dotStyle, sizeConfig.dot), variants: shouldReduceMotion ? undefined : dotVariants, initial: "initial", animate: "animate", custom: index, style: shouldReduceMotion ? { opacity: 0.7 } : undefined }, index))) })), showLabel && (jsx("span", { className: cn(labelStyle, sizeConfig.label), children: label }))] })) }));
|
|
52
41
|
});
|
|
53
42
|
ThinkingIndicator.displayName = "ThinkingIndicator";
|
|
54
43
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export { Message, messageTheme } from "../core/Message";
|
|
2
2
|
export type { MessageProps, MessageRole, MessageVariant, MessageAvatarProps, MessageTheme, MessageThemeOverrides, } from "../core/Message";
|
|
3
|
-
export { MessageHistory, messageHistoryTheme } from "./MessageHistory";
|
|
4
|
-
export type { MessageHistoryProps, ChatMessageData, MessageHistoryTheme, MessageHistoryThemeOverrides, } from "./MessageHistory";
|
|
5
3
|
export { PromptInput, promptInputTheme } from "./PromptInput";
|
|
6
4
|
export type { PromptInputProps, PromptInputState, ModelOption, PromptInputTheme, PromptInputThemeOverrides, } from "./PromptInput";
|
|
7
5
|
export { ThinkingIndicator, thinkingIndicatorTheme } from "./ThinkingIndicator";
|
|
@@ -14,6 +12,3 @@ export { StreamingResponse, ErrorDisplay, MarkdownRenderer, AnimatedText, Stream
|
|
|
14
12
|
export type { StreamingResponseProps, StreamingResponseTheme, MarkdownOptions, AnimatedTextProps, StreamingCursorProps, MarkdownRendererProps, } from "./StreamingResponse";
|
|
15
13
|
export { CodeBlock, codeBlockTheme } from "./CodeBlock";
|
|
16
14
|
export type { CodeBlockProps, CodeBlockLanguage, CodeBlockTheme, CodeBlockThemeOverrides, } from "./CodeBlock";
|
|
17
|
-
export { ApprovalCard } from "./ApprovalCard";
|
|
18
|
-
export type { ApprovalCardProps, ApprovalRiskLevel, } from "./ApprovalCard";
|
|
19
|
-
export { approvalCardTheme } from "./ApprovalCard/ApprovalCard.theme";
|
|
@@ -2,8 +2,14 @@ export { Message } from '../core/Message/Message.js';
|
|
|
2
2
|
export { messageTheme } from '../core/Message/Message.theme.js';
|
|
3
3
|
import '../core/Message/TypeWriter.js';
|
|
4
4
|
import '../core/Message/MessageBody.js';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'clsx';
|
|
7
|
+
import 'tailwind-merge';
|
|
8
|
+
import 'react';
|
|
9
|
+
import '../core/Button/Button.js';
|
|
10
|
+
import '@heroicons/react/16/solid';
|
|
11
|
+
import '@heroicons/react/24/outline';
|
|
12
|
+
import '@heroicons/react/24/solid';
|
|
7
13
|
export { PromptInput } from './PromptInput/PromptInput.js';
|
|
8
14
|
export { promptInputTheme } from './PromptInput/PromptInput.theme.js';
|
|
9
15
|
export { ThinkingIndicator } from './ThinkingIndicator/ThinkingIndicator.js';
|
|
@@ -23,5 +29,3 @@ export { streamingResponseTheme } from './StreamingResponse/StreamingResponse.th
|
|
|
23
29
|
export { blockSlideIn, blockTransition, cursorPulse, staggerContainer, tokenFadeIn, tokenTransition } from './StreamingResponse/StreamingResponse.animations.js';
|
|
24
30
|
export { CodeBlock } from './CodeBlock/CodeBlock.js';
|
|
25
31
|
export { codeBlockTheme } from './CodeBlock/CodeBlock.theme.js';
|
|
26
|
-
export { ApprovalCard } from './ApprovalCard/ApprovalCard.js';
|
|
27
|
-
export { approvalCardTheme } from './ApprovalCard/ApprovalCard.theme.js';
|
|
@@ -10,7 +10,7 @@ import { resolveCssVariable, describeRingSegmentPath, interpolateHexColor, clamp
|
|
|
10
10
|
* DonutChart component for displaying a percentage value with a circular progress indicator
|
|
11
11
|
* Supports customization of size, thickness, animations, and theming
|
|
12
12
|
*/
|
|
13
|
-
const DonutChart = ({ variant = "solid", percentage, label, subtitle, size = 200, thickness = 2, segmentCount = 32, segmentGap = 0.35, showAnimation = true, className, children, theme: themeOverrides, colors, ...props }) => {
|
|
13
|
+
const DonutChart = ({ variant = "solid", percentage, label, subtitle, size = 200, thickness = 2, segmentCount = 32, segmentGap = 0.35, showAnimation = true, className, children, theme: themeOverrides, colors, onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, ...props }) => {
|
|
14
14
|
var _a, _b;
|
|
15
15
|
const [isHovered, setIsHovered] = useState(false);
|
|
16
16
|
const [hasAnimated, setHasAnimated] = useState(false);
|
|
@@ -93,7 +93,7 @@ const AnimatedStrokeSegment = React__default.memo(AnimatedStrokeSegmentInner);
|
|
|
93
93
|
* MultiSegmentDonutChart component for displaying multiple data values in a circular chart
|
|
94
94
|
* Each segment represents a different data point with its own value and optional color
|
|
95
95
|
*/
|
|
96
|
-
const MultiSegmentDonutChart = ({ data, size = 200, thickness = 4, segmentGap = 0.05, showAnimation = true, showLegend = false, legendPosition = "right", centerContent, className, theme: themeOverrides, onSegmentHover, onSegmentClick, roundedCaps = true, ...restProps }) => {
|
|
96
|
+
const MultiSegmentDonutChart = ({ data, size = 200, thickness = 4, segmentGap = 0.05, showAnimation = true, showLegend = false, legendPosition = "right", centerContent, className, theme: themeOverrides, onSegmentHover, onSegmentClick, roundedCaps = true, onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, ...restProps }) => {
|
|
97
97
|
const [hoveredSegment, setHoveredSegment] = useState(null);
|
|
98
98
|
const [hasAnimated, setHasAnimated] = useState(false);
|
|
99
99
|
const shouldReduceMotion = useReducedMotion();
|
|
@@ -430,7 +430,7 @@ const FunnelChart = ({ data, height = 400, width = 600, showPercentages = true,
|
|
|
430
430
|
animate: "visible",
|
|
431
431
|
custom: index,
|
|
432
432
|
}
|
|
433
|
-
: {}), children: jsxs(Badge, { color: isGoodConversion ? "success" : "warning", variant: "
|
|
433
|
+
: {}), children: jsxs(Badge, { color: isGoodConversion ? "success" : "warning", variant: "soft", size: "sm", pill: true, children: ["\u2193 ", stage.conversionRate.toFixed(1), "%"] }) }, `conversion-${stage.name}`));
|
|
434
434
|
}), orientation === "vertical" &&
|
|
435
435
|
showConversionRate &&
|
|
436
436
|
stages.map((stage, index) => {
|
|
@@ -448,7 +448,7 @@ const FunnelChart = ({ data, height = 400, width = 600, showPercentages = true,
|
|
|
448
448
|
animate: "visible",
|
|
449
449
|
custom: index,
|
|
450
450
|
}
|
|
451
|
-
: {}), children: jsxs(Badge, { color: isGoodConversion ? "success" : "warning", variant: "
|
|
451
|
+
: {}), children: jsxs(Badge, { color: isGoodConversion ? "success" : "warning", variant: "soft", size: "sm", pill: true, children: [stage.conversionRate.toFixed(0), "%"] }) }, `conversion-${stage.name}`));
|
|
452
452
|
}), showSummary && summaryPosition !== "none" && stages.length > 1 && (jsxs(motion.div, { className: cn("absolute bg-[var(--color-background)] rounded-lg shadow-sm border border-[var(--color-border)] px-3 py-2 pointer-events-none", getSummaryPositionClasses(summaryPosition)), ...(animate
|
|
453
453
|
? {
|
|
454
454
|
variants: summaryVariants,
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Individual payload item for chart legend entries
|
|
4
|
+
*/
|
|
5
|
+
export interface ChartLegendPayloadItem {
|
|
6
|
+
value?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
dataKey?: string;
|
|
11
|
+
payload?: Record<string, unknown>;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
2
14
|
export interface ChartLegendProps {
|
|
3
15
|
content?: ReactNode;
|
|
4
16
|
wrapperStyle?: React.CSSProperties;
|
|
@@ -9,7 +21,7 @@ export interface ChartLegendProps {
|
|
|
9
21
|
className?: string;
|
|
10
22
|
}
|
|
11
23
|
export interface ChartLegendContentProps {
|
|
12
|
-
payload?:
|
|
24
|
+
payload?: ChartLegendPayloadItem[];
|
|
13
25
|
nameKey?: string;
|
|
14
26
|
className?: string;
|
|
15
27
|
}
|
|
@@ -11,7 +11,7 @@ const ChartLegendContent = ({ payload = [], nameKey = 'name', className, ...prop
|
|
|
11
11
|
return (jsx("div", { className: `flex flex-wrap gap-4 ${className || ''}`, ...props, children: payload.map((entry, index) => {
|
|
12
12
|
const name = entry[nameKey] || entry.dataKey || `Series ${index + 1}`;
|
|
13
13
|
const color = entry.color || '#8884d8';
|
|
14
|
-
return (jsxs("div", { className: "flex items-center gap-2", children: [jsx("div", { className: "w-3 h-3 rounded", style: { backgroundColor: color } }), jsx("span", { className: "text-base text-gray-600", children: name })] }, index));
|
|
14
|
+
return (jsxs("div", { className: "flex items-center gap-2", children: [jsx("div", { className: "w-3 h-3 rounded", style: { backgroundColor: color } }), jsx("span", { className: "text-base text-gray-600", children: String(name) })] }, index));
|
|
15
15
|
}) }));
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Individual payload item from chart data
|
|
4
|
+
*/
|
|
5
|
+
export interface ChartTooltipPayloadItem {
|
|
6
|
+
name?: string;
|
|
7
|
+
value?: number | string;
|
|
8
|
+
color?: string;
|
|
9
|
+
dataKey?: string;
|
|
10
|
+
payload?: Record<string, unknown>;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
2
13
|
/**
|
|
3
14
|
* ChartTooltip theme configuration
|
|
4
15
|
*/
|
|
@@ -30,7 +41,7 @@ export interface ChartTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElem
|
|
|
30
41
|
contentStyle?: React.CSSProperties;
|
|
31
42
|
itemStyle?: React.CSSProperties;
|
|
32
43
|
active?: boolean;
|
|
33
|
-
payload?:
|
|
44
|
+
payload?: ChartTooltipPayloadItem[];
|
|
34
45
|
label?: string | number;
|
|
35
46
|
className?: string;
|
|
36
47
|
position?: {
|
|
@@ -42,7 +53,7 @@ export interface ChartTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElem
|
|
|
42
53
|
}
|
|
43
54
|
export interface ChartTooltipContentProps {
|
|
44
55
|
active?: boolean;
|
|
45
|
-
payload?:
|
|
56
|
+
payload?: ChartTooltipPayloadItem[];
|
|
46
57
|
label?: string | number;
|
|
47
58
|
labelKey?: string;
|
|
48
59
|
nameKey?: string;
|
|
@@ -52,6 +52,6 @@ const AccordionItem = React__default.forwardRef(({ children, className, value, .
|
|
|
52
52
|
const itemStyleClass = variant === "stacked" ? theme === null || theme === void 0 ? void 0 : theme.itemStyleStacked : theme === null || theme === void 0 ? void 0 : theme.itemStyle;
|
|
53
53
|
return (jsx(AccordionItemContext.Provider, { value: contextValue, children: jsx("div", { ref: ref, className: cn(itemStyleClass, className), "data-state": isOpen ? "open" : "closed", "data-variant": variant, "data-value": value, ...props, children: children }) }));
|
|
54
54
|
});
|
|
55
|
-
AccordionItem.displayName = "
|
|
55
|
+
AccordionItem.displayName = "Accordion.Item";
|
|
56
56
|
|
|
57
57
|
export { AccordionItem, useAccordionItemContext };
|
|
@@ -26,6 +26,6 @@ const AccordionTrigger = React__default.forwardRef(({ children, className, chevr
|
|
|
26
26
|
const animatedChevron = (rotation, extraClass) => (jsx(motion.div, { initial: false, animate: isOpen ? "open" : "closed", variants: createTriggerIconVariants(rotation), className: cn("flex items-center justify-center shrink-0", extraClass), children: defaultChevronIcon }));
|
|
27
27
|
return (jsxs("button", { ref: ref, type: "button", id: triggerId, className: cn(theme === null || theme === void 0 ? void 0 : theme.triggerStyle, className), "aria-expanded": isOpen, "aria-controls": contentId, "data-state": isOpen ? "open" : "closed", onClick: toggle, ...props, children: [useDefaultOnLeft && animatedChevron(resolvedChevronRotation), children, resolvedChevron && (jsx(motion.div, { initial: false, animate: isOpen ? "open" : "closed", variants: createTriggerIconVariants(resolvedChevronRotation), className: "flex items-center justify-center shrink-0 ml-auto", children: resolvedChevron }))] }));
|
|
28
28
|
});
|
|
29
|
-
AccordionTrigger.displayName = "
|
|
29
|
+
AccordionTrigger.displayName = "Accordion.Trigger";
|
|
30
30
|
|
|
31
31
|
export { AccordionTrigger };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Variants } from "motion/react";
|
|
2
|
+
/**
|
|
3
|
+
* Alert entrance/exit animation variants
|
|
4
|
+
* Entrance: slide down from -8px + fade in
|
|
5
|
+
* Exit: fade out + collapse height
|
|
6
|
+
*/
|
|
7
|
+
export declare const alertVariants: Variants;
|
|
8
|
+
/**
|
|
9
|
+
* Reduced motion variants — instant opacity toggle, no slide or collapse
|
|
10
|
+
*/
|
|
11
|
+
export declare const reducedMotionAlertVariants: Variants;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alert entrance/exit animation variants
|
|
3
|
+
* Entrance: slide down from -8px + fade in
|
|
4
|
+
* Exit: fade out + collapse height
|
|
5
|
+
*/
|
|
6
|
+
const alertVariants = {
|
|
7
|
+
hidden: {
|
|
8
|
+
opacity: 0,
|
|
9
|
+
y: -8,
|
|
10
|
+
height: 0,
|
|
11
|
+
paddingTop: 0,
|
|
12
|
+
paddingBottom: 0,
|
|
13
|
+
marginTop: 0,
|
|
14
|
+
marginBottom: 0,
|
|
15
|
+
overflow: "hidden",
|
|
16
|
+
transition: {
|
|
17
|
+
duration: 0.15,
|
|
18
|
+
ease: [0.4, 0, 1, 1],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
visible: {
|
|
22
|
+
opacity: 1,
|
|
23
|
+
y: 0,
|
|
24
|
+
height: "auto",
|
|
25
|
+
paddingTop: undefined,
|
|
26
|
+
paddingBottom: undefined,
|
|
27
|
+
marginTop: undefined,
|
|
28
|
+
marginBottom: undefined,
|
|
29
|
+
overflow: "visible",
|
|
30
|
+
transition: {
|
|
31
|
+
duration: 0.2,
|
|
32
|
+
ease: [0.4, 0, 0.2, 1],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Reduced motion variants — instant opacity toggle, no slide or collapse
|
|
38
|
+
*/
|
|
39
|
+
const reducedMotionAlertVariants = {
|
|
40
|
+
hidden: { opacity: 0 },
|
|
41
|
+
visible: { opacity: 1 },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { alertVariants, reducedMotionAlertVariants };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React__default from 'react';
|
|
2
|
+
import React__default, { useState } from 'react';
|
|
3
|
+
import { useReducedMotion, motion } from 'motion/react';
|
|
3
4
|
import { cn } from '../../../utils/cn.js';
|
|
4
5
|
import { alertTheme } from './Alert.theme.js';
|
|
6
|
+
import { reducedMotionAlertVariants, alertVariants } from './Alert.animations.js';
|
|
5
7
|
import { XMarkIcon, XCircleIcon, ExclamationTriangleIcon, CheckCircleIcon, InformationCircleIcon, BellIcon } from '@heroicons/react/24/solid';
|
|
6
8
|
import { Button } from '../Button/Button.js';
|
|
7
9
|
|
|
@@ -15,10 +17,16 @@ const defaultIcons = {
|
|
|
15
17
|
};
|
|
16
18
|
const Alert = React__default.forwardRef(({ variant = "default", color = "primary", title, subtitle, dismissible, icon, showIcon = true, avatar, actions, onDismiss, className, children, darkMode = false, ...props }, ref) => {
|
|
17
19
|
var _a;
|
|
20
|
+
const shouldReduceMotion = useReducedMotion();
|
|
21
|
+
const [isDismissing, setIsDismissing] = useState(false);
|
|
18
22
|
const iconColor = (_a = alertTheme.iconColors[color]) !== null && _a !== void 0 ? _a : alertTheme.iconColors.primary;
|
|
19
23
|
const showDismiss = dismissible === true || (dismissible !== false && !!onDismiss);
|
|
20
24
|
const handleDismiss = () => {
|
|
21
|
-
|
|
25
|
+
if (shouldReduceMotion) {
|
|
26
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setIsDismissing(true);
|
|
22
30
|
};
|
|
23
31
|
const renderIconOrAvatar = () => {
|
|
24
32
|
if (avatar) {
|
|
@@ -33,11 +41,16 @@ const Alert = React__default.forwardRef(({ variant = "default", color = "primary
|
|
|
33
41
|
const IconComponent = defaultIcons[color];
|
|
34
42
|
return (jsx("div", { className: "flex-shrink-0 w-6 h-6 mt-1", "aria-hidden": "true", children: jsx(IconComponent, { className: cn("w-6 h-6", iconColor) }) }));
|
|
35
43
|
};
|
|
36
|
-
const
|
|
44
|
+
const alertContent = (jsxs("div", { ref: ref, className: cn(alertTheme.baseStyle, alertTheme.variants[variant], className), role: "alert", "aria-live": "assertive", "aria-atomic": "true", ...props, children: [renderIconOrAvatar(), jsxs("div", { className: `flex-1 min-w-0 ${showDismiss ? "mr-5" : ""}`, children: [title && (typeof title === 'string'
|
|
37
45
|
? jsx("div", { className: cn("font-semibold text-[var(--color-text-primary)]"), children: title })
|
|
38
46
|
: title), subtitle && (typeof subtitle === 'string'
|
|
39
47
|
? jsx("div", { className: "text-[var(--color-text-secondary)]/90 mt-1", children: subtitle })
|
|
40
48
|
: subtitle), children && jsx("div", { className: "mt-2", children: children }), actions && (jsx("div", { className: "flex items-center gap-2 mt-6", children: actions }))] }), showDismiss && (jsx(Button, { variant: "link", color: "neutral", size: "sm", iconOnly: true, onClick: handleDismiss, "aria-label": "Dismiss alert", className: "rounded-full absolute top-2 right-2 flex-shrink-0", children: jsx(XMarkIcon, { className: "size-4", strokeWidth: 2 }) }))] }));
|
|
49
|
+
const alertNode = (jsx(motion.div, { variants: shouldReduceMotion ? reducedMotionAlertVariants : alertVariants, initial: "hidden", animate: isDismissing ? "hidden" : "visible", onAnimationComplete: (definition) => {
|
|
50
|
+
if (definition === "hidden" && isDismissing) {
|
|
51
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
52
|
+
}
|
|
53
|
+
}, children: alertContent }));
|
|
41
54
|
if (darkMode) {
|
|
42
55
|
return jsx("div", { className: "dark", children: alertNode });
|
|
43
56
|
}
|
|
@@ -6,7 +6,7 @@ import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
|
6
6
|
import '../Tooltip/Tooltip.animations.js';
|
|
7
7
|
import { UserIcon } from '@heroicons/react/24/solid';
|
|
8
8
|
|
|
9
|
-
const Avatar = React__default.forwardRef(({ src, name, size = "md", status = "none", fallback, className, role, lazyLoad = true, retryCount = 0, retryDelay = 1000, contextualLabel, groupPosition, showTooltip = false, initialsCount = 2, ...props }, ref) => {
|
|
9
|
+
const Avatar = React__default.forwardRef(({ src, name, size = "md", status = "none", fallback, className, role, lazyLoad = true, retryCount = 0, retryDelay = 1000, contextualLabel, groupPosition, showTooltip = false, initialsCount = 2, title, subtitle, ...props }, ref) => {
|
|
10
10
|
const [imageError, setImageError] = useState(false);
|
|
11
11
|
const [retries, setRetries] = useState(0);
|
|
12
12
|
const retryTimerRef = useRef(null);
|
|
@@ -86,13 +86,18 @@ const Avatar = React__default.forwardRef(({ src, name, size = "md", status = "no
|
|
|
86
86
|
: (resolvedName !== null && resolvedName !== void 0 ? resolvedName : "Avatar");
|
|
87
87
|
// Determine appropriate ARIA role
|
|
88
88
|
const ariaRole = role || (src ? undefined : "img");
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
const resolvedTitle = title !== null && title !== void 0 ? title : (subtitle ? resolvedName : undefined);
|
|
90
|
+
const hasTextSection = !!(resolvedTitle || subtitle);
|
|
91
|
+
// The avatar circle with status indicator
|
|
92
|
+
const avatarCircle = (jsxs("div", { className: cn("relative inline-flex avatar-wrapper shrink-0", groupPosition), children: [jsx("div", { className: cn(avatarTheme.baseStyle, avatarTheme.sizes[size], className), "aria-hidden": ariaRole === "presentation" ? "true" : undefined, "data-size": size, children: src && !imageError ? (jsx("img", { src: src, alt: resolvedName !== null && resolvedName !== void 0 ? resolvedName : "Avatar", className: "size-full object-cover object-top", onError: handleImageError, loading: lazyLoad ? "lazy" : undefined, "aria-hidden": ariaRole === "presentation" ? "true" : undefined, "data-loaded": "true" })) : (jsx("div", { className: "avatar-fallback flex items-center justify-center size-full", children: getFallbackContent() })) }), status !== "none" && (jsx("span", { className: cn("absolute rounded-full ring-2 ring-[var(--color-background)]", getStatusSize(), avatarTheme.statuses[status]), "aria-label": `Status: ${status}`, role: "status", "data-status": status }))] }));
|
|
93
|
+
// Wrap circle in tooltip if needed
|
|
94
|
+
const avatarWithTooltip = showTooltip && resolvedName ? (jsx(Tooltip, { content: resolvedName, placement: "top", children: avatarCircle })) : (avatarCircle);
|
|
95
|
+
// If no text section, render just the avatar
|
|
96
|
+
if (!hasTextSection) {
|
|
97
|
+
return (jsx("div", { ref: ref, role: ariaRole === "presentation" ? "presentation" : undefined, "aria-label": ariaRole === "presentation" ? undefined : accessibilityLabel, "data-size": size, "data-status": status, "data-error": imageError ? "true" : "false", ...props, children: avatarWithTooltip }));
|
|
94
98
|
}
|
|
95
|
-
|
|
99
|
+
// Render avatar with text section
|
|
100
|
+
return (jsxs("div", { ref: ref, className: cn("inline-flex items-center", avatarTheme.gapSizes[size]), role: ariaRole === "presentation" ? "presentation" : undefined, "aria-label": ariaRole === "presentation" ? undefined : accessibilityLabel, "data-size": size, "data-status": status, "data-error": imageError ? "true" : "false", ...props, children: [avatarWithTooltip, jsxs("div", { className: "min-w-0", children: [resolvedTitle && (jsx("div", { className: cn(avatarTheme.titleStyle, avatarTheme.textSizes[size]), children: resolvedTitle })), subtitle && (jsx("div", { className: cn(avatarTheme.subtitleStyle, avatarTheme.textSizes[size]), children: subtitle }))] })] }));
|
|
96
101
|
});
|
|
97
102
|
// Set display name for dev tools and Storybook
|
|
98
103
|
Avatar.displayName = "Avatar";
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { AvatarSize, AvatarStatus } from "./Avatar.types";
|
|
2
|
-
/**
|
|
3
|
-
* Internal theme structure for the Avatar component
|
|
4
|
-
*/
|
|
5
2
|
interface AvatarTheme {
|
|
6
3
|
baseStyle: string;
|
|
7
4
|
sizes: Record<AvatarSize, string>;
|
|
8
5
|
statuses: Record<AvatarStatus, string>;
|
|
6
|
+
titleStyle: string;
|
|
7
|
+
subtitleStyle: string;
|
|
8
|
+
textSizes: Record<AvatarSize, string>;
|
|
9
|
+
gapSizes: Record<AvatarSize, string>;
|
|
9
10
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Default theme for the Avatar component
|
|
12
|
-
*/
|
|
13
11
|
export declare const avatarTheme: AvatarTheme;
|
|
14
12
|
export {};
|
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default theme for the Avatar component
|
|
3
|
-
*/
|
|
4
1
|
const avatarTheme = {
|
|
5
|
-
|
|
6
|
-
baseStyle: "relative inline-flex items-center justify-center overflow-hidden bg-neutral-200 text-[var(--color-text-primary)] font-bold tracking-tighter rounded-[var(--avatar-radius)] border border-[var(--color-border)] transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2",
|
|
7
|
-
// Size variants using CSS variables
|
|
2
|
+
baseStyle: "relative inline-flex items-center justify-center overflow-hidden bg-[var(--color-surface)] text-[var(--color-text-primary)] font-bold tracking-tighter rounded-[var(--avatar-radius)] border border-[var(--color-border)] transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2",
|
|
8
3
|
sizes: {
|
|
9
|
-
xs: "size-[var(--avatar-size-xs)] text-
|
|
4
|
+
xs: "size-[var(--avatar-size-xs)] text-sm",
|
|
10
5
|
sm: "size-[var(--avatar-size-sm)] text-sm",
|
|
11
|
-
md: "size-[var(--avatar-size-md)] text-
|
|
12
|
-
lg: "size-[var(--avatar-size-lg)] text-
|
|
13
|
-
xl: "size-[var(--avatar-size-xl)] text-
|
|
6
|
+
md: "size-[var(--avatar-size-md)] text-base",
|
|
7
|
+
lg: "size-[var(--avatar-size-lg)] text-base",
|
|
8
|
+
xl: "size-[var(--avatar-size-xl)] text-base",
|
|
14
9
|
},
|
|
15
|
-
// Status indicator styles
|
|
16
10
|
statuses: {
|
|
17
11
|
online: "bg-[var(--color-success)]",
|
|
18
|
-
offline: "bg-
|
|
12
|
+
offline: "bg-[var(--color-text-muted)]",
|
|
19
13
|
busy: "bg-[var(--color-danger)]",
|
|
20
14
|
away: "bg-[var(--color-warning)]",
|
|
21
15
|
none: "",
|
|
22
16
|
},
|
|
17
|
+
titleStyle: "font-medium leading-tight text-[var(--color-text-primary)] truncate",
|
|
18
|
+
subtitleStyle: "leading-tight text-[var(--color-text-muted)] truncate",
|
|
19
|
+
textSizes: {
|
|
20
|
+
xs: "text-sm",
|
|
21
|
+
sm: "text-sm",
|
|
22
|
+
md: "text-base",
|
|
23
|
+
lg: "text-base",
|
|
24
|
+
xl: "text-base",
|
|
25
|
+
},
|
|
26
|
+
gapSizes: {
|
|
27
|
+
xs: "gap-1.5",
|
|
28
|
+
sm: "gap-2",
|
|
29
|
+
md: "gap-2.5",
|
|
30
|
+
lg: "gap-3",
|
|
31
|
+
xl: "gap-3",
|
|
32
|
+
},
|
|
23
33
|
};
|
|
24
34
|
|
|
25
35
|
export { avatarTheme };
|
|
@@ -67,4 +67,13 @@ export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
67
67
|
* @default 2
|
|
68
68
|
*/
|
|
69
69
|
initialsCount?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Title text displayed next to the avatar.
|
|
72
|
+
* Defaults to `name` if not provided.
|
|
73
|
+
*/
|
|
74
|
+
title?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Subtitle text displayed below the title (e.g., email, role).
|
|
77
|
+
*/
|
|
78
|
+
subtitle?: string;
|
|
70
79
|
}
|
|
@@ -48,8 +48,7 @@ const AvatarGroup = React__default.forwardRef(({ avatars = [], max = 5, size = "
|
|
|
48
48
|
index > 0 ? spacingClass : "z-10"), "data-position": position, "data-index": index, ...motionProps, children: jsx(Avatar, { size: size, ...avatarProps, contextualLabel: contextLabel,
|
|
49
49
|
// Ensure that groupPosition is not passed to avoid conflicts
|
|
50
50
|
groupPosition: undefined }) }, index));
|
|
51
|
-
}), overflowCount > 0 && (jsx("div", { className: cn(spacingClass,
|
|
52
|
-
"transition-transform duration-200 hover:scale-110"), "data-overflow-count": overflowCount, children: overflowIndicator ? (overflowIndicator(overflowCount)) : (jsx(Avatar, { size: size, name: `+${overflowCount} more`, fallback: jsxs("span", { children: ["+", overflowCount] }), className: avatarGroupTheme.overflowAvatarStyle, role: "img", "aria-label": `+ ${overflowCount} more users` })) }))] }));
|
|
51
|
+
}), overflowCount > 0 && (jsx("div", { className: cn(spacingClass, "self-center"), "data-overflow-count": overflowCount, children: overflowIndicator ? (overflowIndicator(overflowCount)) : (jsx(Avatar, { size: size, name: `+${overflowCount} more`, fallback: jsxs("span", { children: ["+", overflowCount] }), className: avatarGroupTheme.overflowAvatarStyle, role: "img", "aria-label": `+ ${overflowCount} more users` })) }))] }));
|
|
53
52
|
});
|
|
54
53
|
// Set display name for dev tools and Storybook
|
|
55
54
|
AvatarGroup.displayName = "AvatarGroup";
|
|
@@ -11,7 +11,7 @@ const avatarGroupTheme = {
|
|
|
11
11
|
loose: "-ml-2 z-10",
|
|
12
12
|
},
|
|
13
13
|
// Overflow avatar styles
|
|
14
|
-
overflowAvatarStyle: "bg-[var(--color-
|
|
14
|
+
overflowAvatarStyle: "bg-[var(--color-surface)] text-[var(--color-text-secondary)] font-semibold text-sm flex items-center justify-center size-7",
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export { avatarGroupTheme };
|