@flikk/ui 1.0.0-beta.14 → 1.0.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +3 -1
- package/dist/components/ai/PromptSuggestions/PromptSuggestion.theme.js +4 -4
- package/dist/components/ai/StreamingResponse/AnimatedText.js +3 -3
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.js +22 -22
- package/dist/components/ai/StreamingResponse/StreamingCursor.js +1 -1
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.js +10 -10
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +9 -3
- package/dist/components/ai/StreamingResponse/WordAnimationContext.d.ts +1 -1
- package/dist/components/ai/StreamingResponse/WordAnimationContext.js +11 -11
- package/dist/components/ai/index.d.ts +0 -7
- package/dist/components/ai/index.js +8 -6
- package/dist/components/charts/DonutChart/DonutChart.js +1 -1
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.js +1 -1
- 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 +23 -47
- package/dist/components/core/Badge/Badge.theme.js +48 -62
- package/dist/components/core/Badge/Badge.types.d.ts +5 -29
- package/dist/components/core/Button/Button.js +2 -2
- package/dist/components/core/Button/Button.theme.js +2 -2
- 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/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/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 +3 -1
- 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/Pagination/Pagination.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 +4 -15
- 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.js +2 -1
- package/dist/components/core/Sidebar/SidebarMobileTrigger.js +2 -1
- package/dist/components/core/Sidebar/SidebarToggle.js +2 -1
- package/dist/components/core/Sidebar/SidebarUserProfile.js +1 -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/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 +9 -0
- package/dist/components/data-display/GanttChart/GanttChart.types.d.ts +2 -2
- 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 +17 -9
- package/dist/components/effects/GlassSurface/GlassSurface.types.d.ts +6 -0
- 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 +10 -0
- package/dist/components/effects/Neumorphic/InsetCircleButton.js +10 -0
- package/dist/components/effects/Neumorphic/InsetPill.d.ts +8 -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 +13 -4
- 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.js +10 -3
- package/dist/components/forms/Slider/Slider.theme.js +3 -3
- package/dist/components/forms/Switch/Switch.js +10 -2
- 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 -3
- package/dist/components/forms/index.js +8 -2
- 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 +21 -2
- 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 +319 -39
- package/src/styles/theme.css +105 -16
- 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/components/ai/ThinkingIndicator/ThinkingIndicator.animations.d.ts +0 -10
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.animations.js +0 -47
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.d.ts +0 -20
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.js +0 -55
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.theme.d.ts +0 -2
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.theme.js +0 -20
- package/dist/components/ai/ThinkingIndicator/ThinkingIndicator.types.d.ts +0 -67
- package/dist/components/ai/ThinkingIndicator/index.d.ts +0 -3
- package/dist/components/forms/TransferList/TransferList.animations.d.ts +0 -10
- package/dist/components/forms/TransferList/TransferList.animations.js +0 -32
- package/dist/components/forms/TransferList/TransferList.d.ts +0 -28
- package/dist/components/forms/TransferList/TransferList.js +0 -199
- package/dist/components/forms/TransferList/TransferList.theme.d.ts +0 -6
- package/dist/components/forms/TransferList/TransferList.theme.js +0 -60
- package/dist/components/forms/TransferList/TransferList.types.d.ts +0 -101
- package/dist/components/forms/TransferList/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
|
@@ -2,7 +2,7 @@ import React, { ReactNode, MouseEvent } from "react";
|
|
|
2
2
|
import { SemanticColor } from "../../../utils/colorUtils";
|
|
3
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) => {
|
|
@@ -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",
|
|
@@ -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";
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
const calendarTheme = {
|
|
6
6
|
baseStyle: "select-none w-full bg-white dark:bg-[var(--color-neutral-900)]",
|
|
7
7
|
headerStyle: "flex items-center justify-between mb-4",
|
|
8
|
-
titleStyle: "text-
|
|
9
|
-
"dark:text-[var(--color-neutral-200)] dark:hover:text-[var(--color-primary-400)]",
|
|
8
|
+
titleStyle: "text-base font-semibold text-[var(--color-text-primary)] " + "",
|
|
10
9
|
headerDropdownsStyle: "grid grid-cols-2 items-center gap-2 flex-1 justify-center mx-3",
|
|
11
10
|
navButtonStyle: "inline-flex items-center justify-center size-8 rounded-[calc(var(--radius-base)*0.75)] border-0 bg-transparent " +
|
|
12
11
|
"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-primary-50)] " +
|
|
@@ -18,8 +17,13 @@ const calendarTheme = {
|
|
|
18
17
|
weekdaysStyle: "grid grid-cols-7 mb-2",
|
|
19
18
|
weekdayStyle: "flex items-center justify-center h-8 text-sm font-medium text-[var(--color-text-muted)] " +
|
|
20
19
|
"dark:text-[var(--color-neutral-500)]",
|
|
21
|
-
daysGridStyle: "grid grid-cols-7 gap-0.5",
|
|
22
|
-
|
|
20
|
+
daysGridStyle: "grid grid-cols-7 gap-y-0.5 gap-x-0",
|
|
21
|
+
rangeCellStyle: "bg-[var(--color-primary-50)]/70 " +
|
|
22
|
+
"data-[range-pos=start]:rounded-l-full " +
|
|
23
|
+
"data-[range-pos=end]:rounded-r-full " +
|
|
24
|
+
"data-[range-pos=single]:rounded-full " +
|
|
25
|
+
"dark:bg-[var(--color-primary-900)]/50",
|
|
26
|
+
dayButtonStyle: "relative z-10 flex items-center justify-center rounded-full border-0 bg-transparent font-medium cursor-pointer " +
|
|
23
27
|
"transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2 " +
|
|
24
28
|
// Base text color
|
|
25
29
|
"text-[var(--color-text-primary)] dark:text-[var(--color-neutral-200)] " +
|
|
@@ -37,11 +41,11 @@ const calendarTheme = {
|
|
|
37
41
|
// Other month state
|
|
38
42
|
"data-[other-month=true]:text-[var(--color-text-muted)] data-[other-month=true]:opacity-60 " +
|
|
39
43
|
"dark:data-[other-month=true]:text-[var(--color-neutral-600)] " +
|
|
40
|
-
// Range mode states
|
|
44
|
+
// Range mode states (strip background handled by wrapper cell)
|
|
41
45
|
"data-[range-start=true]:bg-[var(--color-primary)] data-[range-start=true]:text-[var(--color-primary-contrast)] " +
|
|
42
46
|
"data-[range-end=true]:bg-[var(--color-primary)] data-[range-end=true]:text-[var(--color-primary-contrast)] " +
|
|
43
|
-
"data-[in-range=true]:
|
|
44
|
-
"dark:data-[in-range=true]:
|
|
47
|
+
"data-[in-range=true]:text-[var(--color-text-primary)] " +
|
|
48
|
+
"dark:data-[in-range=true]:text-[var(--color-neutral-200)] " +
|
|
45
49
|
// Focus offset for dark mode
|
|
46
50
|
"dark:focus-visible:ring-offset-[var(--color-neutral-900)]",
|
|
47
51
|
dayButtonSizes: {
|
|
@@ -83,6 +83,8 @@ export interface CalendarProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
83
83
|
onNavigatePrev?: (() => void) | null;
|
|
84
84
|
/** Custom next navigation handler (null to hide right arrow) */
|
|
85
85
|
onNavigateNext?: (() => void) | null;
|
|
86
|
+
/** Whether to show days from adjacent months (default: true) */
|
|
87
|
+
showOtherMonthDays?: boolean;
|
|
86
88
|
/** Additional class name for the container */
|
|
87
89
|
className?: string;
|
|
88
90
|
}
|
|
@@ -119,6 +121,7 @@ export interface CalendarTheme {
|
|
|
119
121
|
weekdaysStyle: string;
|
|
120
122
|
weekdayStyle: string;
|
|
121
123
|
daysGridStyle: string;
|
|
124
|
+
rangeCellStyle: string;
|
|
122
125
|
dayButtonStyle: string;
|
|
123
126
|
dayButtonSizes?: Record<CalendarSize, string>;
|
|
124
127
|
}
|
|
@@ -42,7 +42,6 @@ const CarouselBody = React__default.forwardRef(({ className, children, ...props
|
|
|
42
42
|
if (!React__default.isValidElement(child))
|
|
43
43
|
return child;
|
|
44
44
|
return React__default.cloneElement(child, {
|
|
45
|
-
...child.props,
|
|
46
45
|
'aria-hidden': index !== currentIndex,
|
|
47
46
|
});
|
|
48
47
|
}) }) }));
|
|
@@ -126,7 +126,7 @@ const CommandItem = ({ command, index, isHighlighted, contentStart, contentEnd,
|
|
|
126
126
|
}
|
|
127
127
|
return null;
|
|
128
128
|
};
|
|
129
|
-
return (jsxs("div", { "data-command-index": index, "data-highlighted": isHighlighted, "data-disabled": command.disabled || false, className: cn(theme.commandItem, className), onClick: handleClick, onMouseEnter: handleMouseEnter, children: [finalContentStart && (jsx("div", { className: "flex-shrink-0", children: finalContentStart })), jsxs("div", { className: "flex-1 min-w-0", children: [jsx("div", { className: "text-base truncate", children: command.label }), command.subtitle && (jsx("div", { className: "text-base opacity-70 truncate mt-0", children: command.subtitle }))] }), renderContentEnd()] }));
|
|
129
|
+
return (jsxs("div", { "data-command-index": index, "data-highlighted": isHighlighted, "data-disabled": command.disabled || false, className: cn(theme.commandItem, className), role: "option", "aria-selected": isHighlighted, "aria-disabled": command.disabled || false, onClick: handleClick, onMouseEnter: handleMouseEnter, children: [finalContentStart && (jsx("div", { className: "flex-shrink-0", children: finalContentStart })), jsxs("div", { className: "flex-1 min-w-0", children: [jsx("div", { className: "text-base truncate", children: command.label }), command.subtitle && (jsx("div", { className: "text-base opacity-70 truncate mt-0", children: command.subtitle }))] }), renderContentEnd()] }));
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
export { CommandItem };
|
|
@@ -6,6 +6,8 @@ import { cn } from '../../../utils/cn.js';
|
|
|
6
6
|
import { MagnifyingGlassIcon } from '@heroicons/react/24/outline';
|
|
7
7
|
import { CommandItem } from './CommandItem.js';
|
|
8
8
|
import { Overlay } from '../../effects/Overlay/Overlay.js';
|
|
9
|
+
import { ScrollArea } from '../ScrollArea/ScrollArea.js';
|
|
10
|
+
import '../ScrollArea/smooth/SmoothScrollEngine.js';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Default filter function for commands
|
|
@@ -77,7 +79,7 @@ const groupCommandsByCategory = (commands) => {
|
|
|
77
79
|
* />
|
|
78
80
|
* ```
|
|
79
81
|
*/
|
|
80
|
-
const CommandPalette = React__default.forwardRef(({ isOpen, onClose, commands = [], placeholder = "Type a command or search...", emptyMessage = "No results found.", maxHeight = "400px", className = "", overlayClassName = "", theme: themeOverrides, grouped = false, onSearchChange, filterFunction = defaultFilterFunction, closeOnOverlayClick = true, closeOnEsc = true, }, ref) => {
|
|
82
|
+
const CommandPalette = React__default.forwardRef(({ isOpen, onClose, commands = [], placeholder = "Type a command or search...", emptyMessage = "No results found.", maxHeight = "400px", className = "", overlayClassName = "", theme: themeOverrides, grouped = false, onSearchChange, filterFunction = defaultFilterFunction, closeOnOverlayClick = true, closeOnEsc = true, footer, footerClassName, }, ref) => {
|
|
81
83
|
// Merge theme with overrides
|
|
82
84
|
const theme = useMemo(() => ({ ...commandPaletteTheme, ...(themeOverrides || {}) }), [themeOverrides]);
|
|
83
85
|
// State
|
|
@@ -195,7 +197,7 @@ const CommandPalette = React__default.forwardRef(({ isOpen, onClose, commands =
|
|
|
195
197
|
// Render commands list
|
|
196
198
|
const renderCommandsList = () => {
|
|
197
199
|
if (flatFilteredCommands.length === 0) {
|
|
198
|
-
return jsx("div", { className: theme.emptyState, children: emptyMessage });
|
|
200
|
+
return jsx("div", { className: theme.emptyState, "aria-live": "polite", children: emptyMessage });
|
|
199
201
|
}
|
|
200
202
|
// If grouped, render with group labels
|
|
201
203
|
if (isGroupedCommands(displayCommands)) {
|
|
@@ -212,9 +214,9 @@ const CommandPalette = React__default.forwardRef(({ isOpen, onClose, commands =
|
|
|
212
214
|
return (jsxs(Overlay, { ref: ref, isOpen: isOpen, onClose: onClose, closeOnOverlayClick: closeOnOverlayClick, closeOnEsc: closeOnEsc, position: "top", overlayClassName: overlayClassName, contentClassName: cn(theme.container, className), animations: {
|
|
213
215
|
overlay: overlayAnimations,
|
|
214
216
|
content: containerAnimations,
|
|
215
|
-
}, children: [jsx("div", { className: theme.searchWrapper, children: jsxs("div", { className: "flex items-center gap-3", children: [jsx(MagnifyingGlassIcon, { className: "w-5 h-5 text-[var(--color-text-muted)]", strokeWidth: 2 }), jsx("input", { ref: searchInputRef, type: "text", className: theme.searchInput, placeholder: placeholder, value: searchValue, onChange: handleSearchChange, autoComplete: "off", autoCorrect: "off", spellCheck: false })] }) }), jsx(
|
|
217
|
+
}, children: [jsx("div", { className: theme.searchWrapper, children: jsxs("div", { className: "flex items-center gap-3", children: [jsx(MagnifyingGlassIcon, { className: "w-5 h-5 text-[var(--color-text-muted)]", strokeWidth: 2 }), jsx("input", { ref: searchInputRef, type: "text", className: theme.searchInput, placeholder: placeholder, value: searchValue, onChange: handleSearchChange, autoComplete: "off", autoCorrect: "off", spellCheck: false, "aria-label": "Search commands" })] }) }), jsx(ScrollArea, { ref: listContainerRef, type: "hover", className: "overscroll-contain px-1", style: {
|
|
216
218
|
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight,
|
|
217
|
-
}, children: renderCommandsList() })] }));
|
|
219
|
+
}, children: jsx("div", { role: "listbox", "aria-label": "Commands", children: renderCommandsList() }) }), footer && (jsx("div", { className: cn(theme.footer, footerClassName), children: footer }))] }));
|
|
218
220
|
});
|
|
219
221
|
CommandPalette.displayName = "CommandPalette";
|
|
220
222
|
|
|
@@ -25,6 +25,7 @@ const commandPaletteTheme = {
|
|
|
25
25
|
"dark:data-[highlighted=true]:bg-[var(--color-primary-600)]",
|
|
26
26
|
emptyState: "px-4 py-12 text-center text-base text-[var(--color-text-muted)] " +
|
|
27
27
|
"dark:text-[var(--color-neutral-500)]",
|
|
28
|
+
footer: "border-t border-[var(--color-border)] px-4 py-2 text-sm text-[var(--color-text-muted)]font-medium",
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
export { commandPaletteTheme };
|
|
@@ -67,6 +67,10 @@ export interface CommandPaletteProps {
|
|
|
67
67
|
closeOnOverlayClick?: boolean;
|
|
68
68
|
/** Whether pressing Escape should close the palette (default: true) */
|
|
69
69
|
closeOnEsc?: boolean;
|
|
70
|
+
/** Footer content rendered below the command list (e.g., keyboard hints) */
|
|
71
|
+
footer?: React.ReactNode;
|
|
72
|
+
/** Additional class name for the footer */
|
|
73
|
+
footerClassName?: string;
|
|
70
74
|
}
|
|
71
75
|
/**
|
|
72
76
|
* Theme overrides for the CommandPalette component
|
|
@@ -86,4 +90,6 @@ export interface CommandPaletteThemeOverrides {
|
|
|
86
90
|
commandItem?: string;
|
|
87
91
|
/** Style for empty state */
|
|
88
92
|
emptyState?: string;
|
|
93
|
+
/** Style for the footer area */
|
|
94
|
+
footer?: string;
|
|
89
95
|
}
|
|
@@ -39,11 +39,12 @@ const ContextMenuRoot = ({ children, className, onOpenChange, theme: themeOverri
|
|
|
39
39
|
const handleOpenChange = useCallback((value) => {
|
|
40
40
|
setIsOpen(value);
|
|
41
41
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(value);
|
|
42
|
-
// Get cursor position from trigger element when opening
|
|
42
|
+
// Get cursor position from trigger element data attributes when opening
|
|
43
43
|
if (value && triggerRef.current) {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const x = triggerRef.current.dataset.cursorX;
|
|
45
|
+
const y = triggerRef.current.dataset.cursorY;
|
|
46
|
+
if (x && y) {
|
|
47
|
+
setCursorPosition({ x: Number(x), y: Number(y) });
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
}, [onOpenChange]);
|
|
@@ -14,11 +14,10 @@ const ContextMenuTrigger = React__default.forwardRef(({ children, className, dis
|
|
|
14
14
|
// Prevent default browser context menu
|
|
15
15
|
e.preventDefault();
|
|
16
16
|
e.stopPropagation();
|
|
17
|
-
// Store cursor position
|
|
18
|
-
e.currentTarget
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
17
|
+
// Store cursor position on trigger element via data attributes
|
|
18
|
+
const target = e.currentTarget;
|
|
19
|
+
target.dataset.cursorX = String(e.clientX);
|
|
20
|
+
target.dataset.cursorY = String(e.clientY);
|
|
22
21
|
// Now open the menu with position available
|
|
23
22
|
onOpenChange(true);
|
|
24
23
|
}, [disabled, onOpenChange]);
|
|
@@ -44,6 +43,6 @@ const ContextMenuTrigger = React__default.forwardRef(({ children, className, dis
|
|
|
44
43
|
"data-disabled": disabled,
|
|
45
44
|
});
|
|
46
45
|
});
|
|
47
|
-
ContextMenuTrigger.displayName = "
|
|
46
|
+
ContextMenuTrigger.displayName = "ContextMenu.Trigger";
|
|
48
47
|
|
|
49
48
|
export { ContextMenuTrigger };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DrawerProps, DrawerContextValue } from "./Drawer.types";
|
|
2
2
|
export declare const useDrawerContext: () => DrawerContextValue;
|
|
3
3
|
export declare const Drawer: {
|
|
4
|
-
({ isOpen, onClose, title, subtitle, icon, position, size, closeOnOverlayClick, closeOnEsc, showCloseButton, children, className, theme: themeOverrides, scale, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
({ isOpen, onClose, title, subtitle, icon, position, size, closeOnOverlayClick, closeOnEsc, showCloseButton, children, className, theme: themeOverrides, scale, closeOnBack, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
} & {
|
|
7
7
|
Header: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import React__default, { createContext, useId, useMemo, useContext } from 'react';
|
|
2
|
+
import React__default, { createContext, useId, useMemo, useRef, useEffect, useContext } from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
4
|
import { useScaleBackground } from '../../../hooks/useScaleBackground.js';
|
|
5
5
|
import { Overlay } from '../../effects/Overlay/Overlay.js';
|
|
@@ -11,6 +11,27 @@ import { DrawerSubtitle } from './DrawerSubtitle.js';
|
|
|
11
11
|
import { DrawerBody } from './DrawerBody.js';
|
|
12
12
|
import { DrawerFooter } from './DrawerFooter.js';
|
|
13
13
|
|
|
14
|
+
/** Manages browser history so the back button closes the drawer instead of navigating. */
|
|
15
|
+
function useCloseOnBack(isOpen, onClose, enabled) {
|
|
16
|
+
const closedByPopstate = useRef(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!enabled || !isOpen)
|
|
19
|
+
return;
|
|
20
|
+
closedByPopstate.current = false;
|
|
21
|
+
history.pushState({ flikDrawer: true }, "");
|
|
22
|
+
const handlePopstate = () => {
|
|
23
|
+
closedByPopstate.current = true;
|
|
24
|
+
onClose();
|
|
25
|
+
};
|
|
26
|
+
window.addEventListener("popstate", handlePopstate);
|
|
27
|
+
return () => {
|
|
28
|
+
window.removeEventListener("popstate", handlePopstate);
|
|
29
|
+
if (!closedByPopstate.current) {
|
|
30
|
+
history.back();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, [isOpen, onClose, enabled]);
|
|
34
|
+
}
|
|
14
35
|
// Create context for Drawer components
|
|
15
36
|
const DrawerContext = createContext(undefined);
|
|
16
37
|
const useDrawerContext = () => {
|
|
@@ -19,7 +40,9 @@ const useDrawerContext = () => {
|
|
|
19
40
|
throw new Error("Drawer compound components must be used within <Drawer>");
|
|
20
41
|
return ctx;
|
|
21
42
|
};
|
|
22
|
-
const DrawerRoot = ({ isOpen, onClose, title, subtitle, icon, position = "right", size = "md", closeOnOverlayClick = true, closeOnEsc = true, showCloseButton = true, children, className, theme: themeOverrides, scale = 0.94, ...props }) => {
|
|
43
|
+
const DrawerRoot = ({ isOpen, onClose, title, subtitle, icon, position = "right", size = "md", closeOnOverlayClick = true, closeOnEsc = true, showCloseButton = true, children, className, theme: themeOverrides, scale = 0.94, closeOnBack = false, ...props }) => {
|
|
44
|
+
// Close drawer on browser back button
|
|
45
|
+
useCloseOnBack(isOpen, onClose, closeOnBack);
|
|
23
46
|
// iOS-style scale background effect
|
|
24
47
|
useScaleBackground({ isOpen, scale, position });
|
|
25
48
|
// Generate unique IDs for ARIA linkage
|
|
@@ -11,8 +11,8 @@ const drawerTheme = {
|
|
|
11
11
|
title: "text-lg font-semibold leading-6 text-[var(--color-text-primary)]",
|
|
12
12
|
subtitle: "text-base text-[var(--color-text-secondary)] mt-0.5",
|
|
13
13
|
body: "flex-1 overflow-y-auto p-4",
|
|
14
|
-
footer: "flex items-center justify-end gap-3 p-4 border-t border-[var(--color-border)] shrink-0 " +
|
|
15
|
-
"
|
|
14
|
+
footer: "flex items-center justify-end gap-3 p-4 py-3 border-t border-[var(--color-border)] shrink-0 " +
|
|
15
|
+
"",
|
|
16
16
|
};
|
|
17
17
|
// Position variants with margin support
|
|
18
18
|
const drawerPositionVariantsWithMargin = {
|
|
@@ -62,6 +62,12 @@ export interface DrawerProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
62
62
|
* @default 0.94
|
|
63
63
|
*/
|
|
64
64
|
scale?: number;
|
|
65
|
+
/**
|
|
66
|
+
* When enabled, pressing the browser back button closes the drawer
|
|
67
|
+
* instead of navigating away. Useful for mobile-like UX.
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
closeOnBack?: boolean;
|
|
65
71
|
}
|
|
66
72
|
export interface DrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
67
73
|
children: React.ReactNode;
|
|
@@ -5,7 +5,7 @@ export declare const Dropdown: {
|
|
|
5
5
|
displayName: string;
|
|
6
6
|
} & {
|
|
7
7
|
Trigger: {
|
|
8
|
-
({ children, className }: import("./Dropdown.types").DropdownTriggerProps): React.ReactElement<
|
|
8
|
+
({ children, className }: import("./Dropdown.types").DropdownTriggerProps): React.ReactElement<import("./DropdownTrigger").TriggerChildProps, string | React.JSXElementConstructor<any>>;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
11
11
|
Menu: React.ForwardRefExoticComponent<import("./Dropdown.types").DropdownMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useRef, useCallback } from 'react';
|
|
2
|
+
import { useState, useRef, useId, useCallback } from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
4
|
import { DropdownContext } from './DropdownContext.js';
|
|
5
5
|
import { DropdownTrigger } from './DropdownTrigger.js';
|
|
@@ -41,6 +41,9 @@ const DropdownRoot = ({ children, className, isOpen: controlledIsOpen, defaultIs
|
|
|
41
41
|
// Refs for positioning
|
|
42
42
|
const triggerRef = useRef(null);
|
|
43
43
|
const menuRef = useRef(null);
|
|
44
|
+
// Generate a stable menu ID for aria-controls
|
|
45
|
+
const generatedMenuId = useId();
|
|
46
|
+
const menuId = `dropdown-menu-${generatedMenuId}`;
|
|
44
47
|
// Handle open state changes
|
|
45
48
|
const handleOpenChange = useCallback((value) => {
|
|
46
49
|
if (!isControlledOpen) {
|
|
@@ -68,6 +71,7 @@ const DropdownRoot = ({ children, className, isOpen: controlledIsOpen, defaultIs
|
|
|
68
71
|
onOpenChange: handleOpenChange,
|
|
69
72
|
triggerRef,
|
|
70
73
|
menuRef,
|
|
74
|
+
menuId,
|
|
71
75
|
placement,
|
|
72
76
|
offset,
|
|
73
77
|
closeOnSelect,
|
|
@@ -7,6 +7,7 @@ export interface DropdownContextValue {
|
|
|
7
7
|
onOpenChange: (isOpen: boolean) => void;
|
|
8
8
|
triggerRef: React.RefObject<HTMLElement | null>;
|
|
9
9
|
menuRef: React.RefObject<HTMLDivElement | null>;
|
|
10
|
+
menuId: string;
|
|
10
11
|
placement: DropdownPlacement;
|
|
11
12
|
offset: number;
|
|
12
13
|
closeOnSelect: boolean;
|
|
@@ -69,6 +69,6 @@ const DropdownItem = React__default.forwardRef(({ itemKey, children, className,
|
|
|
69
69
|
focusStyle: theme.itemFocusStyle,
|
|
70
70
|
}, ...props, children: children }));
|
|
71
71
|
});
|
|
72
|
-
DropdownItem.displayName = "
|
|
72
|
+
DropdownItem.displayName = "Dropdown.Item";
|
|
73
73
|
|
|
74
74
|
export { DropdownItem };
|
|
@@ -41,7 +41,7 @@ const useDarkMode = () => {
|
|
|
41
41
|
* DropdownMenu component - renders the menu with keyboard navigation
|
|
42
42
|
*/
|
|
43
43
|
const DropdownMenu = React__default.forwardRef(({ children, className, animation = true, portal = true, horizontal = false, "aria-label": ariaLabel, ...props }, ref) => {
|
|
44
|
-
const { isOpen, onOpenChange, triggerRef, menuRef, placement, offset, theme, } = useDropdownContext();
|
|
44
|
+
const { isOpen, onOpenChange, triggerRef, menuRef, menuId, placement, offset, theme, } = useDropdownContext();
|
|
45
45
|
// Detect dark mode for portal content
|
|
46
46
|
const isDarkMode = useDarkMode();
|
|
47
47
|
const isClient = useIsClient();
|
|
@@ -54,7 +54,7 @@ const DropdownMenu = React__default.forwardRef(({ children, className, animation
|
|
|
54
54
|
const { position, cssVariables, contentRef: portalContentRef, } = useSelectPortal({
|
|
55
55
|
triggerRef,
|
|
56
56
|
isOpen: isOpen || false,
|
|
57
|
-
placement
|
|
57
|
+
placement,
|
|
58
58
|
offset: offset || 4,
|
|
59
59
|
autoWidth: false,
|
|
60
60
|
stickyTracking: true,
|
|
@@ -208,7 +208,7 @@ const DropdownMenu = React__default.forwardRef(({ children, className, animation
|
|
|
208
208
|
...cssVariables,
|
|
209
209
|
top: `${position.top}px`,
|
|
210
210
|
left: `${position.left}px`,
|
|
211
|
-
}, role: "menu", "aria-label": ariaLabel || "Menu", "aria-orientation": horizontal ? "horizontal" : "vertical", tabIndex: -1, onKeyDown: handleKeyDown, variants: shouldReduceMotion || !animation ? {} : menuVariants, initial: shouldReduceMotion || !animation ? undefined : "hidden", animate: shouldReduceMotion || !animation ? undefined : "visible", exit: shouldReduceMotion || !animation ? undefined : "exit", transition: shouldReduceMotion || !animation
|
|
211
|
+
}, id: menuId, role: "menu", "aria-label": ariaLabel || "Menu", "aria-orientation": horizontal ? "horizontal" : "vertical", tabIndex: -1, onKeyDown: handleKeyDown, variants: shouldReduceMotion || !animation ? {} : menuVariants, initial: shouldReduceMotion || !animation ? undefined : "hidden", animate: shouldReduceMotion || !animation ? undefined : "visible", exit: shouldReduceMotion || !animation ? undefined : "exit", transition: shouldReduceMotion || !animation
|
|
212
212
|
? { duration: 0 }
|
|
213
213
|
: {
|
|
214
214
|
type: "spring",
|
|
@@ -221,6 +221,6 @@ const DropdownMenu = React__default.forwardRef(({ children, className, animation
|
|
|
221
221
|
}
|
|
222
222
|
return menuContent;
|
|
223
223
|
});
|
|
224
|
-
DropdownMenu.displayName = "
|
|
224
|
+
DropdownMenu.displayName = "Dropdown.Menu";
|
|
225
225
|
|
|
226
226
|
export { DropdownMenu };
|
|
@@ -12,6 +12,6 @@ const DropdownSection = React__default.forwardRef(({ children, className, title,
|
|
|
12
12
|
? jsx("div", { className: theme.sectionTitleStyle, role: "presentation", children: title })
|
|
13
13
|
: title), children] })] }));
|
|
14
14
|
});
|
|
15
|
-
DropdownSection.displayName = "
|
|
15
|
+
DropdownSection.displayName = "Dropdown.Section";
|
|
16
16
|
|
|
17
17
|
export { DropdownSection };
|
|
@@ -10,6 +10,6 @@ const DropdownSeparator = React__default.forwardRef(({ className, ...props }, re
|
|
|
10
10
|
const { theme } = useDropdownContext();
|
|
11
11
|
return (jsx("div", { ref: ref, role: "separator", className: cn(theme.separatorStyle, className), ...props }));
|
|
12
12
|
});
|
|
13
|
-
DropdownSeparator.displayName = "
|
|
13
|
+
DropdownSeparator.displayName = "Dropdown.Separator";
|
|
14
14
|
|
|
15
15
|
export { DropdownSeparator };
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DropdownTriggerProps } from "./Dropdown.types";
|
|
3
|
+
export interface TriggerChildProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
6
|
+
ref?: React.Ref<HTMLElement>;
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* DropdownTrigger component - wraps the trigger element
|
|
5
10
|
*/
|
|
6
11
|
export declare const DropdownTrigger: {
|
|
7
|
-
({ children, className }: DropdownTriggerProps): React.ReactElement<
|
|
12
|
+
({ children, className }: DropdownTriggerProps): React.ReactElement<TriggerChildProps, string | React.JSXElementConstructor<any>>;
|
|
8
13
|
displayName: string;
|
|
9
14
|
};
|