@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React__default, { useState, useMemo,
|
|
2
|
+
import React__default, { useState, useMemo, useCallback } from 'react';
|
|
3
3
|
import { AnimatePresence, motion } from 'motion/react';
|
|
4
4
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
|
5
|
+
import { UserIcon } from '@heroicons/react/16/solid';
|
|
5
6
|
import { cn } from '../../../utils/cn.js';
|
|
6
7
|
import { Avatar } from '../Avatar/Avatar.js';
|
|
7
8
|
import { animationTiming, dismissVariants, badgeVariants, dismissButtonVariants, dotVariants } from './Badge.animations.js';
|
|
@@ -31,16 +32,11 @@ const getShouldAnimate = () => {
|
|
|
31
32
|
* <Badge dismissible onDismiss={handleDismiss}>Removable</Badge>
|
|
32
33
|
* ```
|
|
33
34
|
*/
|
|
34
|
-
const Badge = React__default.memo(React__default.forwardRef(({ children, variant = "filled", color = "primary", size = "md", pill = false, withDot = false, iconStart, avatar, dismissible = false, onDismiss,
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
|
35
|
+
const Badge = React__default.memo(React__default.forwardRef(({ children, variant = "filled", color = "primary", size = "md", pill = false, withDot = false, iconStart, avatar, dismissible = false, onDismiss, disabled = false, maxWidth, className, theme: customTheme = {}, onClick, darkMode = false, ...props }, ref) => {
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
36
37
|
// State management
|
|
37
38
|
const [isVisible, setIsVisible] = useState(true);
|
|
38
|
-
const [isSelected, setIsSelected] = useState(selected);
|
|
39
39
|
const shouldAnimate = useMemo(getShouldAnimate, []);
|
|
40
|
-
// Sync internal state with controlled prop
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
setIsSelected(selected);
|
|
43
|
-
}, [selected]);
|
|
44
40
|
// Development-only warnings
|
|
45
41
|
if (process.env.NODE_ENV !== "production") {
|
|
46
42
|
if (dismissible && !onDismiss) {
|
|
@@ -49,9 +45,6 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
49
45
|
if (avatar && iconStart) {
|
|
50
46
|
console.warn("[Badge]: Both avatar and iconStart provided. Avatar takes precedence.");
|
|
51
47
|
}
|
|
52
|
-
if (selectable && !onSelect && selected === undefined) {
|
|
53
|
-
console.warn("[Badge]: selectable is true but no onSelect callback or selected prop provided. Component will work in uncontrolled mode.");
|
|
54
|
-
}
|
|
55
48
|
}
|
|
56
49
|
// Handle dismiss button click
|
|
57
50
|
const handleDismiss = useCallback((e) => {
|
|
@@ -62,17 +55,12 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
62
55
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss(e);
|
|
63
56
|
}, animationTiming.dismissDelay);
|
|
64
57
|
}, [onDismiss]);
|
|
65
|
-
// Handle badge click
|
|
58
|
+
// Handle badge click
|
|
66
59
|
const handleClick = useCallback((e) => {
|
|
67
60
|
if (disabled)
|
|
68
61
|
return;
|
|
69
|
-
if (selectable) {
|
|
70
|
-
const newSelected = !isSelected;
|
|
71
|
-
setIsSelected(newSelected);
|
|
72
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelected);
|
|
73
|
-
}
|
|
74
62
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
75
|
-
}, [
|
|
63
|
+
}, [onClick, disabled]);
|
|
76
64
|
// Merge default theme with custom theme overrides
|
|
77
65
|
const theme = {
|
|
78
66
|
...badgeTheme,
|
|
@@ -90,9 +78,9 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
90
78
|
...(_c = badgeTheme.variantColors) === null || _c === void 0 ? void 0 : _c.outline,
|
|
91
79
|
...(_d = customTheme.variantColors) === null || _d === void 0 ? void 0 : _d.outline,
|
|
92
80
|
},
|
|
93
|
-
|
|
94
|
-
...(_e = badgeTheme.variantColors) === null || _e === void 0 ? void 0 : _e.
|
|
95
|
-
...(_f = customTheme.variantColors) === null || _f === void 0 ? void 0 : _f.
|
|
81
|
+
soft: {
|
|
82
|
+
...(_e = badgeTheme.variantColors) === null || _e === void 0 ? void 0 : _e.soft,
|
|
83
|
+
...(_f = customTheme.variantColors) === null || _f === void 0 ? void 0 : _f.soft,
|
|
96
84
|
},
|
|
97
85
|
},
|
|
98
86
|
sizes: {
|
|
@@ -103,10 +91,6 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
103
91
|
...badgeTheme.pillSizes,
|
|
104
92
|
...customTheme.pillSizes,
|
|
105
93
|
},
|
|
106
|
-
radiusSizes: {
|
|
107
|
-
...badgeTheme.radiusSizes,
|
|
108
|
-
...customTheme.radiusSizes,
|
|
109
|
-
},
|
|
110
94
|
iconSizes: {
|
|
111
95
|
...badgeTheme.iconSizes,
|
|
112
96
|
...customTheme.iconSizes,
|
|
@@ -115,13 +99,9 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
115
99
|
...badgeTheme.avatarSizes,
|
|
116
100
|
...customTheme.avatarSizes,
|
|
117
101
|
},
|
|
118
|
-
|
|
119
|
-
...badgeTheme.
|
|
120
|
-
...customTheme.
|
|
121
|
-
},
|
|
122
|
-
dismissIconSizes: {
|
|
123
|
-
...badgeTheme.dismissIconSizes,
|
|
124
|
-
...customTheme.dismissIconSizes,
|
|
102
|
+
dismissSizes: {
|
|
103
|
+
...badgeTheme.dismissSizes,
|
|
104
|
+
...customTheme.dismissSizes,
|
|
125
105
|
},
|
|
126
106
|
dotColors: {
|
|
127
107
|
...badgeTheme.dotColors,
|
|
@@ -138,11 +118,11 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
138
118
|
const sizeStyle = ((_k = theme.sizes) === null || _k === void 0 ? void 0 : _k[size]) || "";
|
|
139
119
|
const shapeStyle = pill
|
|
140
120
|
? "rounded-full"
|
|
141
|
-
:
|
|
142
|
-
const dotColorStyle = ((
|
|
121
|
+
: "rounded-[var(--badge-radius)]";
|
|
122
|
+
const dotColorStyle = ((_l = theme.dotColors) === null || _l === void 0 ? void 0 : _l[color]) || "";
|
|
143
123
|
// Build base styles with all states
|
|
144
|
-
const isInteractive =
|
|
145
|
-
const baseStyles = cn(theme.baseStyle, shapeStyle, variantStyles, colorStyles, sizeStyle, pill && ((
|
|
124
|
+
const isInteractive = dismissible;
|
|
125
|
+
const baseStyles = cn(theme.baseStyle, shapeStyle, variantStyles, colorStyles, sizeStyle, pill && ((_m = theme.pillSizes) === null || _m === void 0 ? void 0 : _m[size]), isInteractive && "cursor-pointer", disabled && ((_o = theme.states) === null || _o === void 0 ? void 0 : _o.disabled), darkMode && "dark", className);
|
|
146
126
|
// Create data attributes for styling hooks
|
|
147
127
|
const dataAttributes = {
|
|
148
128
|
"data-variant": variant,
|
|
@@ -152,59 +132,55 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
152
132
|
"data-pill": pill ? "true" : "false",
|
|
153
133
|
"data-with-dot": withDot ? "true" : "false",
|
|
154
134
|
"data-dismissible": dismissible ? "true" : "false",
|
|
155
|
-
"data-selected": isSelected ? "true" : "false",
|
|
156
|
-
"data-selectable": selectable ? "true" : "false",
|
|
157
135
|
"data-disabled": disabled ? "true" : "false",
|
|
158
136
|
"data-interactive": isInteractive ? "true" : "false",
|
|
159
137
|
};
|
|
160
138
|
// Render left content (priority: avatar → iconStart → dot)
|
|
161
139
|
const renderLeftContent = () => {
|
|
162
|
-
var _a, _b;
|
|
140
|
+
var _a, _b, _c;
|
|
163
141
|
if (avatar) {
|
|
164
142
|
// Apply negative margin for overlap effect (scales with badge size)
|
|
165
143
|
const avatarMargin = pill
|
|
166
144
|
? {
|
|
167
|
-
xs: "-ml-1",
|
|
168
145
|
sm: "-ml-1.5",
|
|
169
146
|
md: "-ml-1.5",
|
|
170
147
|
}[size]
|
|
171
148
|
: {
|
|
172
|
-
xs: "-ml-1",
|
|
173
149
|
sm: "-ml-1.5",
|
|
174
150
|
md: "-ml-1",
|
|
175
151
|
}[size];
|
|
176
|
-
return (jsx(
|
|
152
|
+
return (jsx("span", { className: cn("inline-flex items-center justify-center shrink-0 overflow-hidden", (_a = theme.avatarSizes) === null || _a === void 0 ? void 0 : _a[size], avatarMargin, pill ? "rounded-full" : "rounded-md"), children: jsx(Avatar, { src: avatar.src, name: avatar.name, fallback: (_b = avatar.fallback) !== null && _b !== void 0 ? _b : jsx(UserIcon, { className: "size-2.5" }), initialsCount: avatar.initialsCount, size: "xs", className: cn("!size-full border-0", pill ? "rounded-full" : "rounded-md ring-0") }) }));
|
|
177
153
|
}
|
|
178
154
|
if (iconStart) {
|
|
179
|
-
return (jsx("span", { className: cn("inline-flex items-center justify-center flex-shrink-0", (
|
|
155
|
+
return (jsx("span", { className: cn("inline-flex items-center justify-center flex-shrink-0", (_c = theme.iconSizes) === null || _c === void 0 ? void 0 : _c[size]), "aria-hidden": "true", children: iconStart }));
|
|
180
156
|
}
|
|
181
157
|
if (withDot) {
|
|
182
158
|
if (shouldAnimate) {
|
|
183
|
-
return (jsx(motion.span, { className: cn("badge-dot rounded-full shrink-0 size-1.5", dotColorStyle), variants: dotVariants, "aria-hidden": "true" }));
|
|
159
|
+
return (jsx(motion.span, { className: cn("badge-dot rounded-full shrink-0 size-1.5 ring-2 ring-current/20", dotColorStyle), variants: dotVariants, "aria-hidden": "true" }));
|
|
184
160
|
}
|
|
185
161
|
return (jsx("span", { className: cn("badge-dot rounded-full shrink-0 size-1.5", dotColorStyle), "aria-hidden": "true" }));
|
|
186
162
|
}
|
|
187
163
|
return null;
|
|
188
164
|
};
|
|
189
165
|
if (!shouldAnimate) {
|
|
190
|
-
//
|
|
191
|
-
const
|
|
166
|
+
// Spread props directly — Badge only receives HTMLSpanElement attributes
|
|
167
|
+
const restHtmlProps = props;
|
|
192
168
|
// Non-animated render for Storybook or reduced-motion environments
|
|
193
|
-
return isVisible ? (jsxs("span", { ref: ref, className: baseStyles, onClick: handleClick,
|
|
169
|
+
return isVisible ? (jsxs("span", { ref: ref, className: baseStyles, onClick: handleClick, "aria-disabled": disabled || undefined, ...dataAttributes, ...restHtmlProps, children: [renderLeftContent(), jsx("span", { className: cn("badge-content", maxWidth && "truncate"), style: maxWidth
|
|
194
170
|
? {
|
|
195
171
|
maxWidth: typeof maxWidth === "number"
|
|
196
172
|
? `${maxWidth}px`
|
|
197
173
|
: maxWidth,
|
|
198
174
|
}
|
|
199
|
-
: undefined, children: children }), dismissible && (jsx("button", { type: "button", onClick: handleDismiss, className:
|
|
175
|
+
: undefined, children: children }), dismissible && (jsx("button", { type: "button", onClick: handleDismiss, className: "badge-dismiss-btn -ml-1 -mr-1 rounded-full p-0.5 cursor-pointer", "aria-label": "Dismiss", disabled: disabled, children: jsx(XMarkIcon, { className: cn("badge-dismiss-icon", (_p = theme.dismissSizes) === null || _p === void 0 ? void 0 : _p[size]), "aria-hidden": "true" }) }))] })) : null;
|
|
200
176
|
}
|
|
201
|
-
return (jsx(AnimatePresence, { mode: "wait", children: isVisible && (jsxs(motion.span, { ref: ref, className: baseStyles, onClick: handleClick,
|
|
177
|
+
return (jsx(AnimatePresence, { mode: "wait", children: isVisible && (jsxs(motion.span, { ref: ref, className: baseStyles, onClick: handleClick, "aria-disabled": disabled || undefined, variants: dismissible ? dismissVariants : badgeVariants, initial: "initial", animate: "animate", exit: "exit", ...dataAttributes, ...props, children: [renderLeftContent(), jsx("span", { className: cn("badge-content", maxWidth && "truncate"), style: maxWidth
|
|
202
178
|
? {
|
|
203
179
|
maxWidth: typeof maxWidth === "number"
|
|
204
180
|
? `${maxWidth}px`
|
|
205
181
|
: maxWidth,
|
|
206
182
|
}
|
|
207
|
-
: undefined, children: children }), dismissible && (jsx(motion.button, { type: "button", onClick: handleDismiss, className:
|
|
183
|
+
: undefined, children: children }), dismissible && (jsx(motion.button, { type: "button", onClick: handleDismiss, className: "badge-dismiss-btn -ml-1 -mr-1 rounded-full p-0.5 cursor-pointer", "aria-label": "Dismiss", disabled: disabled, variants: dismissButtonVariants, initial: "initial", whileHover: "hover", whileTap: "tap", children: jsx(XMarkIcon, { className: cn("badge-dismiss-icon", (_q = theme.dismissSizes) === null || _q === void 0 ? void 0 : _q[size]), "aria-hidden": "true", strokeWidth: 2 }) }))] })) }));
|
|
208
184
|
}));
|
|
209
185
|
Badge.displayName = "Badge";
|
|
210
186
|
|
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
import { semanticBgColors } from '../../../utils/colorUtils.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Default theme configuration for Badge component
|
|
5
3
|
* Uses variant-first color organization for reliable dark mode and className overrides
|
|
6
4
|
*/
|
|
7
5
|
const badgeTheme = {
|
|
8
6
|
// Base styles applied to all badges
|
|
9
|
-
baseStyle: "inline-flex items-center align-middle select-none whitespace-nowrap transition-all duration-300 h-fit",
|
|
7
|
+
baseStyle: "inline-flex items-center align-middle select-none whitespace-nowrap transition-all duration-300 h-fit w-fit tracking-tight font-semibold border",
|
|
10
8
|
// Visual style variants (structure only, no colors)
|
|
9
|
+
// All variants get `border` via baseStyle for consistent box sizing
|
|
11
10
|
variants: {
|
|
12
|
-
filled: "",
|
|
13
|
-
outline: "bg-transparent
|
|
14
|
-
|
|
11
|
+
filled: "border-transparent",
|
|
12
|
+
outline: "bg-transparent",
|
|
13
|
+
soft: "",
|
|
15
14
|
},
|
|
16
15
|
// Color styles organized PER VARIANT
|
|
17
16
|
// This structure enables reliable dark: variants and className overrides
|
|
18
17
|
variantColors: {
|
|
19
|
-
// Filled variant - solid backgrounds
|
|
18
|
+
// Filled variant - solid backgrounds, no visible border
|
|
20
19
|
filled: {
|
|
21
|
-
neutral: "bg-[var(--color-neutral-900)] text-white
|
|
22
|
-
"dark:bg-[var(--color-neutral-700)]
|
|
23
|
-
primary: "bg-[var(--color-primary)] text-[var(--color-primary-contrast)]
|
|
24
|
-
"dark:bg-[var(--color-primary-600)]
|
|
25
|
-
secondary: "bg-[var(--color-secondary)] text-[var(--color-secondary-contrast)]
|
|
26
|
-
"dark:bg-[var(--color-secondary-600)]
|
|
27
|
-
success: "bg-[var(--color-success-600)] text-[var(--color-success-contrast)]
|
|
28
|
-
"dark:bg-[var(--color-success-600)]
|
|
29
|
-
warning: "bg-[var(--color-warning)] text-[var(--color-warning-contrast)]
|
|
30
|
-
"dark:bg-[var(--color-warning-600)]
|
|
31
|
-
danger: "bg-[var(--color-danger)] text-[var(--color-danger-contrast)]
|
|
32
|
-
"dark:bg-[var(--color-danger-600)]
|
|
20
|
+
neutral: "bg-[var(--color-neutral-900)] text-white " +
|
|
21
|
+
"dark:bg-[var(--color-neutral-700)]",
|
|
22
|
+
primary: "bg-[var(--color-primary)] text-[var(--color-primary-contrast)] " +
|
|
23
|
+
"dark:bg-[var(--color-primary-600)]",
|
|
24
|
+
secondary: "bg-[var(--color-secondary)] text-[var(--color-secondary-contrast)] " +
|
|
25
|
+
"dark:bg-[var(--color-secondary-600)]",
|
|
26
|
+
success: "bg-[var(--color-success-600)] text-[var(--color-success-contrast)] " +
|
|
27
|
+
"dark:bg-[var(--color-success-600)]",
|
|
28
|
+
warning: "bg-[var(--color-warning)] text-[var(--color-warning-contrast)] " +
|
|
29
|
+
"dark:bg-[var(--color-warning-600)]",
|
|
30
|
+
danger: "bg-[var(--color-danger)] text-[var(--color-danger-contrast)] " +
|
|
31
|
+
"dark:bg-[var(--color-danger-600)]",
|
|
33
32
|
},
|
|
34
33
|
// Outline variant - transparent bg with colored border
|
|
35
34
|
outline: {
|
|
36
|
-
neutral: "text-[var(--color-text-
|
|
35
|
+
neutral: "text-[var(--color-text-primary)] border-[var(--color-border)] " + "",
|
|
37
36
|
primary: "text-[var(--color-primary)] border-[var(--color-border)] " +
|
|
38
37
|
"dark:text-[var(--color-primary-400)]",
|
|
39
38
|
secondary: "text-[var(--color-secondary)] border-[var(--color-border)] " +
|
|
@@ -45,68 +44,55 @@ const badgeTheme = {
|
|
|
45
44
|
danger: "text-[var(--color-danger)] border-[var(--color-border)] " +
|
|
46
45
|
"dark:text-[var(--color-danger-400)]",
|
|
47
46
|
},
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
neutral: "bg-[var(--color-neutral-
|
|
51
|
-
"dark:bg-[var(--color-neutral-900)]
|
|
52
|
-
primary: "bg-[var(--color-primary-100)] text-[var(--color-primary-
|
|
53
|
-
"dark:bg-[var(--color-primary-
|
|
54
|
-
secondary: "bg-[var(--color-secondary-100)] text-[var(--color-secondary-
|
|
55
|
-
"dark:bg-[var(--color-secondary-
|
|
56
|
-
success: "bg-[var(--color-success-100)] text-[var(--color-success-
|
|
57
|
-
"dark:bg-[var(--color-success-
|
|
58
|
-
warning: "bg-[var(--color-warning-100)] text-[var(--color-warning-
|
|
59
|
-
"dark:bg-[var(--color-warning-
|
|
60
|
-
danger: "bg-[var(--color-danger-100)] text-[var(--color-danger-
|
|
61
|
-
"dark:bg-[var(--color-danger-
|
|
47
|
+
// Soft variant - subtle background tints (Preline-style: 800 text, 500/20 dark bg)
|
|
48
|
+
soft: {
|
|
49
|
+
neutral: "bg-[var(--color-neutral-100)] text-[var(--color-text-primary)] border-[var(--color-text-primary)]/10 " +
|
|
50
|
+
"dark:bg-[var(--color-neutral-900)]",
|
|
51
|
+
primary: "bg-[var(--color-primary-100)] text-[var(--color-primary-800)] border-[var(--color-primary-800)]/20 " +
|
|
52
|
+
"dark:bg-[var(--color-primary-500)]/20 dark:text-[var(--color-primary-300)]",
|
|
53
|
+
secondary: "bg-[var(--color-secondary-100)] text-[var(--color-secondary-800)] border-[var(--color-secondary-800)]/10 " +
|
|
54
|
+
"dark:bg-[var(--color-secondary-500)]/20 dark:text-[var(--color-secondary-400)]",
|
|
55
|
+
success: "bg-[var(--color-success-100)] text-[var(--color-success-800)] border-[var(--color-success-800)]/20 " +
|
|
56
|
+
"dark:bg-[var(--color-success-500)]/20 dark:text-[var(--color-success-400)]",
|
|
57
|
+
warning: "bg-[var(--color-warning-100)] text-[var(--color-warning-800)] border-[var(--color-warning-800)]/20 " +
|
|
58
|
+
"dark:bg-[var(--color-warning-500)]/20 dark:text-[var(--color-warning-400)]",
|
|
59
|
+
danger: "bg-[var(--color-danger-100)] text-[var(--color-danger-800)] border-[var(--color-danger-800)]/20 " +
|
|
60
|
+
"dark:bg-[var(--color-danger-500)]/20 dark:text-[var(--color-danger-400)]",
|
|
62
61
|
},
|
|
63
62
|
},
|
|
64
63
|
// Flat size structure (no nested objects)
|
|
65
64
|
sizes: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
md: "text-sm px-2 py-0.25 gap-1 font-semibold",
|
|
69
|
-
},
|
|
70
|
-
// Border radius per size (using CSS variable)
|
|
71
|
-
radiusSizes: {
|
|
72
|
-
xs: "rounded-[calc(var(--badge-radius)*0.5)]",
|
|
73
|
-
sm: "rounded-[calc(var(--badge-radius)*0.75)]",
|
|
74
|
-
md: "rounded-[var(--badge-radius)]",
|
|
65
|
+
sm: "text-sm px-1.5 py-0.25 gap-1",
|
|
66
|
+
md: "text-base px-2 py-0.25 gap-1",
|
|
75
67
|
},
|
|
76
68
|
// Additional padding for pill shape
|
|
77
69
|
pillSizes: {
|
|
78
|
-
xs: "px-1.5",
|
|
79
70
|
sm: "px-2",
|
|
80
71
|
md: "px-2.5",
|
|
81
72
|
},
|
|
82
|
-
// Icon sizes
|
|
73
|
+
// Icon sizes — applies to wrapper span; [&>svg] selector ensures SVG scales to fit
|
|
83
74
|
iconSizes: {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
md: "size-3.5",
|
|
75
|
+
sm: "size-3.5 [&>svg]:size-3.5",
|
|
76
|
+
md: "size-4 [&>svg]:size-4",
|
|
87
77
|
},
|
|
88
78
|
// Avatar sizes (base sizes without negative margin)
|
|
89
79
|
avatarSizes: {
|
|
90
|
-
xs: "size-3.5",
|
|
91
80
|
sm: "size-4",
|
|
92
|
-
md: "size-
|
|
81
|
+
md: "size-5",
|
|
93
82
|
},
|
|
94
|
-
// Dismiss button
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
sm: "size-3.5",
|
|
83
|
+
// Dismiss icon sizes (button sizes itself from icon + padding)
|
|
84
|
+
dismissSizes: {
|
|
85
|
+
sm: "size-3",
|
|
98
86
|
md: "size-4",
|
|
99
87
|
},
|
|
100
|
-
//
|
|
101
|
-
dismissIconSizes: {
|
|
102
|
-
xs: "size-2",
|
|
103
|
-
sm: "size-2.5",
|
|
104
|
-
md: "size-3",
|
|
105
|
-
},
|
|
106
|
-
// Dot indicator colors (simple, no dark mode needed - inherits from parent)
|
|
88
|
+
// Dot inherits text color via currentColor — works across all variants/colors
|
|
107
89
|
dotColors: {
|
|
108
|
-
|
|
109
|
-
|
|
90
|
+
neutral: "bg-current",
|
|
91
|
+
primary: "bg-current",
|
|
92
|
+
secondary: "bg-current",
|
|
93
|
+
success: "bg-current",
|
|
94
|
+
warning: "bg-current",
|
|
95
|
+
danger: "bg-current",
|
|
110
96
|
},
|
|
111
97
|
// State styles
|
|
112
98
|
states: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode, MouseEvent } from "react";
|
|
2
2
|
import { SemanticColor } from "../../../utils/colorUtils";
|
|
3
|
-
export type BadgeVariant = "filled" | "outline" | "
|
|
3
|
+
export type BadgeVariant = "filled" | "outline" | "soft";
|
|
4
4
|
export type BadgeColor = SemanticColor;
|
|
5
|
-
export type BadgeSize = "
|
|
5
|
+
export type BadgeSize = "sm" | "md";
|
|
6
6
|
/**
|
|
7
7
|
* Theme configuration for Badge component
|
|
8
8
|
*/
|
|
@@ -28,10 +28,6 @@ export interface BadgeTheme {
|
|
|
28
28
|
* Additional padding for pill-shaped badges
|
|
29
29
|
*/
|
|
30
30
|
pillSizes: Record<BadgeSize, string>;
|
|
31
|
-
/**
|
|
32
|
-
* Border radius per badge size
|
|
33
|
-
*/
|
|
34
|
-
radiusSizes: Record<BadgeSize, string>;
|
|
35
31
|
/**
|
|
36
32
|
* Icon sizes for each badge size
|
|
37
33
|
*/
|
|
@@ -41,13 +37,9 @@ export interface BadgeTheme {
|
|
|
41
37
|
*/
|
|
42
38
|
avatarSizes: Record<BadgeSize, string>;
|
|
43
39
|
/**
|
|
44
|
-
* Dismiss button sizes
|
|
45
|
-
*/
|
|
46
|
-
dismissButtonSizes: Record<BadgeSize, string>;
|
|
47
|
-
/**
|
|
48
|
-
* Dismiss icon sizes for each badge size
|
|
40
|
+
* Dismiss icon sizes (button sizes itself from icon + padding)
|
|
49
41
|
*/
|
|
50
|
-
|
|
42
|
+
dismissSizes: Record<BadgeSize, string>;
|
|
51
43
|
/**
|
|
52
44
|
* Color styles for dot indicators
|
|
53
45
|
*/
|
|
@@ -69,18 +61,16 @@ export interface BadgeThemeOverrides {
|
|
|
69
61
|
variantColors?: Partial<Record<BadgeVariant, Partial<Record<BadgeColor, string>>>>;
|
|
70
62
|
sizes?: Partial<Record<BadgeSize, string>>;
|
|
71
63
|
pillSizes?: Partial<Record<BadgeSize, string>>;
|
|
72
|
-
radiusSizes?: Partial<Record<BadgeSize, string>>;
|
|
73
64
|
iconSizes?: Partial<Record<BadgeSize, string>>;
|
|
74
65
|
avatarSizes?: Partial<Record<BadgeSize, string>>;
|
|
75
|
-
|
|
76
|
-
dismissIconSizes?: Partial<Record<BadgeSize, string>>;
|
|
66
|
+
dismissSizes?: Partial<Record<BadgeSize, string>>;
|
|
77
67
|
dotColors?: Partial<Record<BadgeColor, string>>;
|
|
78
68
|
states?: Partial<{
|
|
79
69
|
disabled: string;
|
|
80
70
|
hover: string;
|
|
81
71
|
}>;
|
|
82
72
|
}
|
|
83
|
-
export interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "
|
|
73
|
+
export interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "inputMode"> {
|
|
84
74
|
/**
|
|
85
75
|
* The content to be displayed inside the badge
|
|
86
76
|
*/
|
|
@@ -136,20 +126,6 @@ export interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>,
|
|
|
136
126
|
* Required when dismissible is true
|
|
137
127
|
*/
|
|
138
128
|
onDismiss?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
139
|
-
/**
|
|
140
|
-
* Whether the badge is selectable/toggleable
|
|
141
|
-
* @default false
|
|
142
|
-
*/
|
|
143
|
-
selectable?: boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Whether the badge is currently selected (controlled)
|
|
146
|
-
* @default false
|
|
147
|
-
*/
|
|
148
|
-
selected?: boolean;
|
|
149
|
-
/**
|
|
150
|
-
* Callback when badge selection changes (for selectable badges)
|
|
151
|
-
*/
|
|
152
|
-
onSelect?: (selected: boolean) => void;
|
|
153
129
|
/**
|
|
154
130
|
* Whether the badge is disabled
|
|
155
131
|
* @default false
|
|
@@ -18,7 +18,7 @@ const BUTTON_TAP_ANIMATION = {
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
-
const Button = React__default.forwardRef(({ children, className = "", iconOnly = false, state = "default", size = "md", color, variant, block = false, onClick, enableRipple = true, rippleEffect = "default", rippleClassName, rippleScale = 10, showReflection = true, darkMode = false, disabled: disabledProp, "aria-label": ariaLabelProp, ...restProps }, ref) => {
|
|
21
|
+
const Button = React__default.forwardRef(({ children, className = "", iconOnly = false, state = "default", size = "md", color, variant, block = false, onClick, enableRipple = true, rippleEffect = "default", rippleClassName, rippleScale = 10, showReflection = true, darkMode = false, disabled: disabledProp, "aria-label": ariaLabelProp, onAnimationStart: _onAnimationStart, onAnimationEnd: _onAnimationEnd, onDrag: _onDrag, onDragStart: _onDragStart, onDragEnd: _onDragEnd, ...restProps }, ref) => {
|
|
22
22
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
23
23
|
const shouldReduceMotion = useReducedMotion();
|
|
24
24
|
const shouldDisableAnimations = !!shouldReduceMotion;
|
|
@@ -104,7 +104,7 @@ const Button = React__default.forwardRef(({ children, className = "", iconOnly =
|
|
|
104
104
|
node;
|
|
105
105
|
}
|
|
106
106
|
}, [buttonRef]);
|
|
107
|
-
return (jsxs(motion.button, { ...restProps
|
|
107
|
+
return (jsxs(motion.button, { ...restProps, ...animationProps, ref: mergedRef, type: "button", className: cn(buttonTheme.baseStyle, colorClasses, variantClasses, sizeClasses, blockStyle, stateClasses, darkMode && "dark", className), disabled: isDisabled, "data-state": state, "data-color": resolvedColor, "data-variant": resolvedVariant, "data-size": size, "data-icon-only": iconOnly ? "true" : "false", "data-block": block ? "true" : "false", "aria-disabled": isDisabled || undefined, "aria-invalid": isError || undefined, "aria-label": ariaLabel, onClick: handleClick, children: [showReflection &&
|
|
108
108
|
resolvedVariant !== "link" &&
|
|
109
109
|
resolvedVariant !== "outline" && (jsx("div", { className: "absolute top-0.25 right-0.25 left-0.25 h-3 border-t-[0.5px] border-white/40 rounded-t-[calc(var(--button-radius)-1.25px)] opacity-60" })), isLoading && (jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: jsx(Spinner, { size: "sm", color: color, className: spinnerClassName }) })), jsx("span", { className: cn("inline-flex items-center gap-2 whitespace-nowrap", isLoading && "opacity-0"), children: children }), enableRipple &&
|
|
110
110
|
ripples.map((ripple) => {
|
|
@@ -120,7 +120,7 @@ function getRippleColorClass(variant, color) {
|
|
|
120
120
|
if (variant === "filled") {
|
|
121
121
|
return "bg-white/30";
|
|
122
122
|
}
|
|
123
|
-
// For outline/
|
|
123
|
+
// For outline/soft buttons, use color-matched ripple
|
|
124
124
|
switch (color) {
|
|
125
125
|
case "primary":
|
|
126
126
|
return "bg-[var(--color-primary)]/20";
|
|
@@ -9,7 +9,7 @@ export interface ButtonTheme {
|
|
|
9
9
|
variantColors: {
|
|
10
10
|
filled: Record<ButtonColor, string>;
|
|
11
11
|
outline: Record<ButtonColor, string>;
|
|
12
|
-
|
|
12
|
+
soft: Record<ButtonColor, string>;
|
|
13
13
|
link: Record<ButtonColor, string>;
|
|
14
14
|
};
|
|
15
15
|
sizes: Record<ButtonSize, {
|
|
@@ -8,7 +8,7 @@ const buttonTheme = {
|
|
|
8
8
|
variantStyles: {
|
|
9
9
|
filled: "border hover:brightness-[0.9] dark:hover:brightness-[1.15]",
|
|
10
10
|
outline: "bg-transparent border",
|
|
11
|
-
|
|
11
|
+
soft: "border-transparent",
|
|
12
12
|
link: "bg-transparent border-transparent",
|
|
13
13
|
},
|
|
14
14
|
// Color styles organized BY VARIANT for reliable dark: prefixes
|
|
@@ -66,8 +66,8 @@ const buttonTheme = {
|
|
|
66
66
|
"dark:text-[var(--color-danger-300)] dark:border-[var(--color-danger-400)] " +
|
|
67
67
|
"dark:hover:bg-[var(--color-danger-900)]/30",
|
|
68
68
|
},
|
|
69
|
-
//
|
|
70
|
-
|
|
69
|
+
// Soft variant - subtle background tints
|
|
70
|
+
soft: {
|
|
71
71
|
neutral: "text-[var(--color-text-primary)] bg-[var(--color-neutral-100)] " +
|
|
72
72
|
"hover:bg-[var(--color-neutral-200)] " +
|
|
73
73
|
"focus-visible:outline-[var(--color-text-secondary)] " +
|
|
@@ -124,9 +124,9 @@ const buttonTheme = {
|
|
|
124
124
|
// Size variants
|
|
125
125
|
sizes: {
|
|
126
126
|
sm: {
|
|
127
|
-
default: "font-semibold min-h-[var(--button-min-h-sm)] px-[var(--button-px-sm)] py-[var(--button-py-sm)] text-
|
|
127
|
+
default: "font-semibold min-h-[var(--button-min-h-sm)] px-[var(--button-px-sm)] py-[var(--button-py-sm)] text-base",
|
|
128
128
|
iconOnly: "size-[var(--button-icon-size-sm)] p-[var(--button-icon-p-sm)]",
|
|
129
|
-
link: "font-semibold p-0 text-
|
|
129
|
+
link: "font-semibold p-0 text-base h-fit",
|
|
130
130
|
},
|
|
131
131
|
md: {
|
|
132
132
|
default: "font-semibold min-h-[var(--button-min-h-md)] px-[var(--button-px-md)] py-[var(--button-py-md)] text-base",
|
|
@@ -51,6 +51,6 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
51
51
|
darkMode?: boolean;
|
|
52
52
|
}
|
|
53
53
|
export type ButtonColor = SemanticColor;
|
|
54
|
-
export type ButtonVariant = "filled" | "outline" | "
|
|
54
|
+
export type ButtonVariant = "filled" | "outline" | "soft" | "link";
|
|
55
55
|
export type ButtonSize = "sm" | "md" | "lg";
|
|
56
56
|
export type ButtonState = "default" | "disabled" | "error" | "loading";
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
const buttonGroupTheme = {
|
|
5
5
|
// Base styles for the button group container with child button styling
|
|
6
6
|
baseStyle: "inline-flex items-stretch " +
|
|
7
|
-
// Horizontal orientation - direct button children
|
|
8
|
-
"[&>button:first-child]:rounded-r-none " +
|
|
9
|
-
"[&>button:last-child]:rounded-l-none " +
|
|
7
|
+
// Horizontal orientation - direct button children (skip only-child)
|
|
8
|
+
"[&>button:first-child:not(:only-child)]:rounded-r-none " +
|
|
9
|
+
"[&>button:last-child:not(:only-child)]:rounded-l-none " +
|
|
10
10
|
"[&>button:not(:first-child):not(:last-child)]:rounded-none " +
|
|
11
11
|
"[&>button:not(:first-child)]:-ml-px " +
|
|
12
12
|
"[&>button]:relative [&>button]:focus:z-10 [&>button]:hover:z-10 " +
|
|
13
|
-
// Horizontal orientation - nested button children (
|
|
14
|
-
"[&>*:first-child>button]:rounded-r-none " +
|
|
15
|
-
"[&>*:last-child>button]:rounded-l-none " +
|
|
13
|
+
// Horizontal orientation - nested button children (skip only-child)
|
|
14
|
+
"[&>*:first-child:not(:only-child)>button]:rounded-r-none " +
|
|
15
|
+
"[&>*:last-child:not(:only-child)>button]:rounded-l-none " +
|
|
16
16
|
"[&>*:not(:first-child):not(:last-child)>button]:rounded-none " +
|
|
17
17
|
"[&>*:not(:first-child)>button]:-ml-px " +
|
|
18
18
|
"[&>*>button]:relative [&>*>button]:focus:z-10 [&>*>button]:hover:z-10 " +
|
|
@@ -6,11 +6,9 @@ import { cn } from '../../../utils/cn.js';
|
|
|
6
6
|
const ButtonGroupText = React__default.forwardRef(({ children, className = "", asChild = false, ...props }, ref) => {
|
|
7
7
|
// If asChild is true, clone the child element with our styles
|
|
8
8
|
if (asChild && React__default.isValidElement(children)) {
|
|
9
|
-
const childProps = children.props;
|
|
10
9
|
return React__default.cloneElement(children, {
|
|
11
|
-
...childProps,
|
|
12
10
|
ref,
|
|
13
|
-
className: cn(buttonGroupTheme.textStyles,
|
|
11
|
+
className: cn(buttonGroupTheme.textStyles, children.props.className, className),
|
|
14
12
|
});
|
|
15
13
|
}
|
|
16
14
|
// Otherwise, render as a div
|
|
@@ -112,7 +112,7 @@ const generateCalendarDays = (year, month, selectedValue, mode = 'single', today
|
|
|
112
112
|
}
|
|
113
113
|
return days;
|
|
114
114
|
};
|
|
115
|
-
const Calendar = React__default.forwardRef(({ mode = 'single', value, defaultValue, onChange, minDate, maxDate, isDateDisabled: customIsDateDisabled, showToday = true, selectTodayByDefault = false, weekdays = ["M", "T", "W", "T", "F", "S", "S"], months, size = "md", headerMode, enableMonthDropdown = true, enableYearDropdown = true, yearRange, viewDate: externalViewDate, onViewDateChange, onNavigatePrev, onNavigateNext, className, ...props }, ref) => {
|
|
115
|
+
const Calendar = React__default.forwardRef(({ mode = 'single', value, defaultValue, onChange, minDate, maxDate, isDateDisabled: customIsDateDisabled, showToday = true, selectTodayByDefault = false, weekdays = ["M", "T", "W", "T", "F", "S", "S"], months, size = "md", headerMode, enableMonthDropdown = true, enableYearDropdown = true, yearRange, viewDate: externalViewDate, onViewDateChange, onNavigatePrev, onNavigateNext, showOtherMonthDays = true, className, ...props }, ref) => {
|
|
116
116
|
// Determine initial view date from value/defaultValue
|
|
117
117
|
const getInitialViewDate = () => {
|
|
118
118
|
if (value) {
|
|
@@ -371,10 +371,36 @@ const Calendar = React__default.forwardRef(({ mode = 'single', value, defaultVal
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
}, [minDate, maxDate, customIsDateDisabled, currentMonth, currentYear, onViewDateChange, mode, value, onChange, selectedValue, rangeSelectionState]);
|
|
374
|
-
return (jsxs("div", { ref: ref, className: cn(calendarTheme.baseStyle, className), ...props, children: [jsxs("div", { className: calendarTheme.headerStyle, children: [onNavigatePrev !== null && (jsx(Button, { onClick: navigateToPreviousMonth, "aria-label": "Previous month", disabled: !canNavigateToPrev, iconOnly: true, variant: "link", color: "neutral", size: "sm", children: jsx(ChevronLeftIcon, { className: "size-4", strokeWidth: 2 }) })), onNavigatePrev === null && jsx("div", { className: "w-8" }), resolvedHeaderMode === 'static' ? (jsxs("h2", { className: calendarTheme.titleStyle, children: [getMonthName(viewDate, months), " ", currentYear] })) : (jsxs("div", { className: calendarTheme.headerDropdownsStyle, children: [(resolvedHeaderMode === 'dropdown' || (resolvedHeaderMode === 'mixed' && enableMonthDropdown)) && (jsx(Select, { value: currentMonth.toString(), onChange: handleMonthChange, options: monthOptions, displayValue: currentAbbreviatedMonth, size: "sm", className: "text-base font-medium" })), (resolvedHeaderMode === 'dropdown' || (resolvedHeaderMode === 'mixed' && enableYearDropdown)) && (jsx(Select, { value: currentYear.toString(), onChange: handleYearChange, options: yearOptions, size: "sm", className: "text-base font-medium" }))] })), onNavigateNext !== null && (jsx(Button, { onClick: navigateToNextMonth, "aria-label": "Next month", disabled: !canNavigateToNext, iconOnly: true, variant: "link", color: "neutral", size: "sm", children: jsx(ChevronRightIcon, { className: "size-4", strokeWidth: 2 }) })), onNavigateNext === null && jsx("div", { className: "w-8" })] }), jsx("div", { className: calendarTheme.weekdaysStyle, children: weekdays.map((day, index) => (jsx("div", { className: calendarTheme.weekdayStyle, children: day }, index))) }), jsx("div", { className: calendarTheme.daysGridStyle, children: calendarDays.map((day) => {
|
|
374
|
+
return (jsxs("div", { ref: ref, className: cn(calendarTheme.baseStyle, className), ...props, children: [jsxs("div", { className: calendarTheme.headerStyle, children: [onNavigatePrev !== null && (jsx(Button, { onClick: navigateToPreviousMonth, "aria-label": "Previous month", disabled: !canNavigateToPrev, iconOnly: true, variant: "link", color: "neutral", size: "sm", children: jsx(ChevronLeftIcon, { className: "size-4", strokeWidth: 2 }) })), onNavigatePrev === null && jsx("div", { className: "w-8" }), resolvedHeaderMode === 'static' ? (jsxs("h2", { className: calendarTheme.titleStyle, children: [getMonthName(viewDate, months), " ", currentYear] })) : (jsxs("div", { className: calendarTheme.headerDropdownsStyle, children: [(resolvedHeaderMode === 'dropdown' || (resolvedHeaderMode === 'mixed' && enableMonthDropdown)) && (jsx(Select, { value: currentMonth.toString(), onChange: handleMonthChange, options: monthOptions, displayValue: currentAbbreviatedMonth, size: "sm", className: "text-base font-medium" })), (resolvedHeaderMode === 'dropdown' || (resolvedHeaderMode === 'mixed' && enableYearDropdown)) && (jsx(Select, { value: currentYear.toString(), onChange: handleYearChange, options: yearOptions, size: "sm", className: "text-base font-medium" }))] })), onNavigateNext !== null && (jsx(Button, { onClick: navigateToNextMonth, "aria-label": "Next month", disabled: !canNavigateToNext, iconOnly: true, variant: "link", color: "neutral", size: "sm", children: jsx(ChevronRightIcon, { className: "size-4", strokeWidth: 2 }) })), onNavigateNext === null && jsx("div", { className: "w-8" })] }), jsx("div", { className: calendarTheme.weekdaysStyle, children: weekdays.map((day, index) => (jsx("div", { className: calendarTheme.weekdayStyle, children: day }, index))) }), jsx("div", { className: calendarTheme.daysGridStyle, children: calendarDays.map((day, index) => {
|
|
375
375
|
var _a;
|
|
376
376
|
const dayNumber = day.date.getDate();
|
|
377
|
-
|
|
377
|
+
const isInStrip = day.isRangeStart || day.isRangeEnd || day.isInRange;
|
|
378
|
+
// Determine range position for strip rounding
|
|
379
|
+
let rangePos;
|
|
380
|
+
if (isInStrip) {
|
|
381
|
+
const isRowStart = index % 7 === 0;
|
|
382
|
+
const isRowEnd = index % 7 === 6;
|
|
383
|
+
const nextDay = calendarDays[index + 1];
|
|
384
|
+
const prevDay = calendarDays[index - 1];
|
|
385
|
+
const nextVisible = nextDay && (nextDay.isCurrentMonth || showOtherMonthDays);
|
|
386
|
+
const prevVisible = prevDay && (prevDay.isCurrentMonth || showOtherMonthDays);
|
|
387
|
+
const nextInStrip = nextVisible && (nextDay.isInRange || nextDay.isRangeEnd);
|
|
388
|
+
const prevInStrip = prevVisible && (prevDay.isInRange || prevDay.isRangeStart);
|
|
389
|
+
const effectiveStart = day.isRangeStart || isRowStart || !prevInStrip;
|
|
390
|
+
const effectiveEnd = day.isRangeEnd || isRowEnd || !nextInStrip;
|
|
391
|
+
if (effectiveStart && effectiveEnd)
|
|
392
|
+
rangePos = "single";
|
|
393
|
+
else if (effectiveStart)
|
|
394
|
+
rangePos = "start";
|
|
395
|
+
else if (effectiveEnd)
|
|
396
|
+
rangePos = "end";
|
|
397
|
+
else
|
|
398
|
+
rangePos = "middle";
|
|
399
|
+
}
|
|
400
|
+
if (!day.isCurrentMonth && !showOtherMonthDays) {
|
|
401
|
+
return jsx("div", {}, day.date.toISOString());
|
|
402
|
+
}
|
|
403
|
+
return (jsx("div", { className: cn("flex items-center justify-center", isInStrip && calendarTheme.rangeCellStyle), "data-range-pos": rangePos, children: jsxs(motion.button, { type: "button", onClick: () => handleDateSelect(day.date), disabled: day.isDisabled, className: cn(calendarTheme.dayButtonStyle, (_a = calendarTheme.dayButtonSizes) === null || _a === void 0 ? void 0 : _a[size]), "data-selected": day.isSelected, "data-range-start": day.isRangeStart, "data-range-end": day.isRangeEnd, "data-in-range": day.isInRange, "data-today": day.isToday && !day.isSelected && !day.isRangeStart && !day.isRangeEnd, "data-disabled": day.isDisabled, "data-other-month": !day.isCurrentMonth, "aria-label": `Select ${day.date.toLocaleDateString()}`, variants: shouldReduceMotion ? {} : calendarAnimations.dayButton, whileHover: shouldReduceMotion ? undefined : (!day.isDisabled ? "hover" : undefined), whileTap: shouldReduceMotion ? undefined : (!day.isDisabled ? "tap" : undefined), children: [jsx("time", { dateTime: day.date.toISOString().split("T")[0], children: dayNumber }), day.isToday && (jsx(motion.span, { className: "absolute z-10 bottom-1 left-1/2 -translate-x-1/2 w-1 h-1 bg-[var(--color-primary)] rounded-full", variants: shouldReduceMotion ? {} : calendarAnimations.todayDot, initial: shouldReduceMotion ? undefined : "initial", animate: shouldReduceMotion ? undefined : "animate" }))] }) }, day.date.toISOString()));
|
|
378
404
|
}) })] }));
|
|
379
405
|
});
|
|
380
406
|
Calendar.displayName = "Calendar";
|