@flikk/ui 1.0.0-beta.14 → 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 +3 -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/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 +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.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 +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 +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.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 +21 -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 +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/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
|
@@ -16,25 +16,26 @@ const PROGRESS_SPRING_TRANSITION = {
|
|
|
16
16
|
* Features:
|
|
17
17
|
* - Determinate mode: Shows specific progress value (0-100)
|
|
18
18
|
* - Indeterminate mode: Animated loading state when value is undefined
|
|
19
|
-
* - Multiple sizes
|
|
19
|
+
* - Multiple sizes with default primary color
|
|
20
|
+
* - className controls the fill bar color (the primary styling target)
|
|
21
|
+
* - wrapperClassName controls the outer container
|
|
20
22
|
* - Flexible label positioning (right, top, bottom, inside)
|
|
21
23
|
* - Respects reduced motion preferences
|
|
22
|
-
* - Full className override support
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
|
-
* //
|
|
26
|
-
* <Progress value={60}
|
|
26
|
+
* // Default (primary color)
|
|
27
|
+
* <Progress value={60} />
|
|
28
|
+
*
|
|
29
|
+
* // Custom fill color via className
|
|
30
|
+
* <Progress value={70} className="bg-[var(--color-success)]" />
|
|
27
31
|
*
|
|
28
32
|
* // With label
|
|
29
33
|
* <Progress value={75} showLabel labelPosition="right" />
|
|
30
34
|
*
|
|
31
35
|
* // Indeterminate (loading)
|
|
32
|
-
* <Progress
|
|
33
|
-
*
|
|
34
|
-
* // Custom label format
|
|
35
|
-
* <Progress value={50} showLabel formatLabel={(pct) => `${pct}% complete`} />
|
|
36
|
+
* <Progress />
|
|
36
37
|
*/
|
|
37
|
-
const Progress = React__default.forwardRef(({ value, size = "md",
|
|
38
|
+
const Progress = React__default.forwardRef(({ value, size = "md", showLabel = false, labelPosition = "right", formatLabel, animated = true, wrapperClassName, className, theme: customTheme, ...props }, ref) => {
|
|
38
39
|
const shouldReduceMotion = useReducedMotion();
|
|
39
40
|
// Merge custom theme with default theme
|
|
40
41
|
const theme = useMemo(() => {
|
|
@@ -44,7 +45,6 @@ const Progress = React__default.forwardRef(({ value, size = "md", color = "prima
|
|
|
44
45
|
...progressTheme,
|
|
45
46
|
...customTheme,
|
|
46
47
|
sizes: { ...progressTheme.sizes, ...customTheme.sizes },
|
|
47
|
-
colors: { ...progressTheme.colors, ...customTheme.colors },
|
|
48
48
|
};
|
|
49
49
|
}, [customTheme]);
|
|
50
50
|
// Calculate percentage (clamped to 0-100)
|
|
@@ -71,7 +71,7 @@ const Progress = React__default.forwardRef(({ value, size = "md", color = "prima
|
|
|
71
71
|
case "top":
|
|
72
72
|
return "flex flex-col gap-1.5";
|
|
73
73
|
case "bottom":
|
|
74
|
-
return "flex flex-col
|
|
74
|
+
return "flex flex-col gap-1.5";
|
|
75
75
|
case "right":
|
|
76
76
|
return "flex items-center gap-3";
|
|
77
77
|
case "inside":
|
|
@@ -95,14 +95,14 @@ const Progress = React__default.forwardRef(({ value, size = "md", color = "prima
|
|
|
95
95
|
: ""), children: label }));
|
|
96
96
|
};
|
|
97
97
|
// Track element with optional fill
|
|
98
|
-
const renderTrack = () => (jsxs("div", { className: cn(theme.trackStyle, theme.sizes[size], "relative",
|
|
98
|
+
const renderTrack = () => (jsxs("div", { className: cn(theme.trackStyle, theme.sizes[size], "relative", wrapperClassName), children: [isIndeterminate ? (
|
|
99
99
|
// Indeterminate animation
|
|
100
|
-
jsx("div", { className: cn(theme.fillStyle,
|
|
100
|
+
jsx("div", { className: cn(theme.fillStyle, "absolute", theme.indeterminateStyle, className) })) : shouldAnimate ? (
|
|
101
101
|
// Animated determinate progress with spring animation
|
|
102
|
-
jsx(motion.div, { className: cn(theme.fillStyle,
|
|
102
|
+
jsx(motion.div, { className: cn(theme.fillStyle, className), initial: { width: 0 }, animate: { width: `${percentage}%` }, transition: PROGRESS_SPRING_TRANSITION })) : (
|
|
103
103
|
// Static determinate progress
|
|
104
|
-
jsx("div", { className: cn(theme.fillStyle,
|
|
105
|
-
return (jsxs("div", { ref: ref, className: cn(theme.containerStyle, containerLayoutClass
|
|
104
|
+
jsx("div", { className: cn(theme.fillStyle, className), style: { width: `${percentage}%` } })), showLabel && labelPosition === "inside" && size === "lg" && !isIndeterminate && (jsx("span", { className: theme.insideLabelStyle, children: label }))] }));
|
|
105
|
+
return (jsxs("div", { ref: ref, className: cn(theme.containerStyle, containerLayoutClass), role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": isIndeterminate ? undefined : percentage, "aria-label": isIndeterminate ? "Loading" : `${percentage}% complete`, ...props, children: [labelPosition === "top" && renderLabel(), labelPosition === "right" ? (jsxs(Fragment, { children: [jsx("div", { className: "flex-1", children: renderTrack() }), renderLabel()] })) : (renderTrack()), labelPosition === "bottom" && renderLabel()] }));
|
|
106
106
|
});
|
|
107
107
|
Progress.displayName = "Progress";
|
|
108
108
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { semanticBgColors } from '../../../utils/colorUtils.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Default theme configuration for Progress component
|
|
5
3
|
*/
|
|
@@ -8,10 +6,10 @@ const progressTheme = {
|
|
|
8
6
|
containerStyle: "w-full",
|
|
9
7
|
// Track (background) styles
|
|
10
8
|
trackStyle: "relative w-full rounded-full bg-[var(--color-background-tertiary)] overflow-hidden",
|
|
11
|
-
// Fill (progress bar) styles
|
|
12
|
-
fillStyle: "h-full rounded-full",
|
|
9
|
+
// Fill (progress bar) styles — includes default primary color
|
|
10
|
+
fillStyle: "h-full rounded-full bg-[var(--color-primary)]",
|
|
13
11
|
// Label text styles
|
|
14
|
-
labelStyle: "text-base font-
|
|
12
|
+
labelStyle: "text-base font-semibold text-[var(--color-text-secondary)] tabular-nums min-w-[2.5rem] text-right",
|
|
15
13
|
// Inside label styles (when label is positioned inside the bar)
|
|
16
14
|
insideLabelStyle: "absolute inset-0 flex items-center justify-center text-sm font-medium text-[var(--color-primary-contrast)] tabular-nums",
|
|
17
15
|
// Size variants for track height
|
|
@@ -20,17 +18,8 @@ const progressTheme = {
|
|
|
20
18
|
md: "h-2.5",
|
|
21
19
|
lg: "h-4",
|
|
22
20
|
},
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
neutral: semanticBgColors.neutral + " dark:bg-[var(--color-neutral-500)]",
|
|
26
|
-
primary: semanticBgColors.primary + " dark:bg-[var(--color-primary-400)]",
|
|
27
|
-
secondary: semanticBgColors.secondary + " dark:bg-[var(--color-secondary-400)]",
|
|
28
|
-
success: semanticBgColors.success + " dark:bg-[var(--color-success-400)]",
|
|
29
|
-
warning: semanticBgColors.warning + " dark:bg-[var(--color-warning-400)]",
|
|
30
|
-
danger: semanticBgColors.danger + " dark:bg-[var(--color-danger-400)]",
|
|
31
|
-
},
|
|
32
|
-
// Indeterminate animation styles
|
|
33
|
-
indeterminateStyle: "animate-[progress-indeterminate_1.5s_ease-in-out_infinite]",
|
|
21
|
+
// Indeterminate animation styles (striped pattern by default)
|
|
22
|
+
indeterminateStyle: "animate-[progress-indeterminate_1.8s_linear_infinite] bg-[repeating-linear-gradient(45deg,var(--color-primary),var(--color-primary)_10px,var(--color-primary-700)_10px,var(--color-primary-700)_20px)]",
|
|
34
23
|
};
|
|
35
24
|
|
|
36
25
|
export { progressTheme };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { SemanticColor } from "../../../utils/colorUtils";
|
|
3
2
|
export type ProgressSize = "sm" | "md" | "lg";
|
|
4
|
-
export type ProgressColor = SemanticColor;
|
|
5
3
|
export type ProgressLabelPosition = "right" | "top" | "bottom" | "inside";
|
|
6
4
|
/**
|
|
7
5
|
* Theme configuration for Progress component
|
|
@@ -19,8 +17,6 @@ export interface ProgressTheme {
|
|
|
19
17
|
insideLabelStyle: string;
|
|
20
18
|
/** Size variants for the track height */
|
|
21
19
|
sizes: Record<ProgressSize, string>;
|
|
22
|
-
/** Color variants for the fill */
|
|
23
|
-
colors: Record<ProgressColor, string>;
|
|
24
20
|
/** Indeterminate animation styles */
|
|
25
21
|
indeterminateStyle: string;
|
|
26
22
|
}
|
|
@@ -34,7 +30,6 @@ export interface ProgressThemeOverrides {
|
|
|
34
30
|
labelStyle?: string;
|
|
35
31
|
insideLabelStyle?: string;
|
|
36
32
|
sizes?: Partial<Record<ProgressSize, string>>;
|
|
37
|
-
colors?: Partial<Record<ProgressColor, string>>;
|
|
38
33
|
indeterminateStyle?: string;
|
|
39
34
|
}
|
|
40
35
|
export interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
@@ -48,11 +43,6 @@ export interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
48
43
|
* @default 'md'
|
|
49
44
|
*/
|
|
50
45
|
size?: ProgressSize;
|
|
51
|
-
/**
|
|
52
|
-
* The semantic color of the progress bar
|
|
53
|
-
* @default 'primary'
|
|
54
|
-
*/
|
|
55
|
-
color?: ProgressColor;
|
|
56
46
|
/**
|
|
57
47
|
* Whether to show the percentage label
|
|
58
48
|
* @default false
|
|
@@ -75,17 +65,9 @@ export interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
75
65
|
*/
|
|
76
66
|
animated?: boolean;
|
|
77
67
|
/**
|
|
78
|
-
* Additional class name for the track
|
|
79
|
-
*/
|
|
80
|
-
trackClassName?: string;
|
|
81
|
-
/**
|
|
82
|
-
* Additional class name for the fill (progress) element
|
|
83
|
-
*/
|
|
84
|
-
fillClassName?: string;
|
|
85
|
-
/**
|
|
86
|
-
* Additional class name for the container
|
|
68
|
+
* Additional class name for the outer container/track wrapper
|
|
87
69
|
*/
|
|
88
|
-
|
|
70
|
+
wrapperClassName?: string;
|
|
89
71
|
/**
|
|
90
72
|
* Component-level theme overrides
|
|
91
73
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Progress } from "./Progress";
|
|
2
|
-
export type { ProgressProps, ProgressSize,
|
|
2
|
+
export type { ProgressProps, ProgressSize, ProgressLabelPosition, ProgressThemeOverrides, } from "./Progress.types";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React__default, { useRef, useMemo, useImperativeHandle } from 'react';
|
|
2
|
+
import React__default, { useRef, useMemo, useImperativeHandle, useState, useEffect } from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
4
|
import { scrollAreaTheme } from './ScrollArea.theme.js';
|
|
5
5
|
import { useSmoothScroll } from './smooth/useSmoothScroll.js';
|
|
@@ -25,7 +25,7 @@ import { useSmoothScroll } from './smooth/useSmoothScroll.js';
|
|
|
25
25
|
* </ScrollArea>
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
const ScrollArea = React__default.forwardRef(({ children, type = 'hover', orientation = 'vertical', snap, snapAlign = 'start', smooth = false, smoothConfig, onScrollProgress, onPerformanceUpdate, className, theme, ...props }, ref) => {
|
|
28
|
+
const ScrollArea = React__default.forwardRef(({ children, type = 'hover', size = 'default', orientation = 'vertical', snap, snapAlign = 'start', smooth = false, smoothConfig, onScrollProgress, onPerformanceUpdate, className, theme, ...props }, ref) => {
|
|
29
29
|
// Internal ref for the scrollable element
|
|
30
30
|
const internalRef = useRef(null);
|
|
31
31
|
// Determine scroll orientation for smooth scroll
|
|
@@ -65,6 +65,26 @@ const ScrollArea = React__default.forwardRef(({ children, type = 'hover', orient
|
|
|
65
65
|
}
|
|
66
66
|
return extendedRef;
|
|
67
67
|
}, [smooth, smoothAPI]);
|
|
68
|
+
// Scroll-detection state for type='scroll' (overlay scrollbar)
|
|
69
|
+
const [isScrolling, setIsScrolling] = useState(false);
|
|
70
|
+
const scrollTimerRef = useRef(undefined);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (type !== 'scroll')
|
|
73
|
+
return;
|
|
74
|
+
const el = internalRef.current;
|
|
75
|
+
if (!el)
|
|
76
|
+
return;
|
|
77
|
+
const onScroll = () => {
|
|
78
|
+
setIsScrolling(true);
|
|
79
|
+
clearTimeout(scrollTimerRef.current);
|
|
80
|
+
scrollTimerRef.current = setTimeout(() => setIsScrolling(false), 1000);
|
|
81
|
+
};
|
|
82
|
+
el.addEventListener('scroll', onScroll, { passive: true });
|
|
83
|
+
return () => {
|
|
84
|
+
el.removeEventListener('scroll', onScroll);
|
|
85
|
+
clearTimeout(scrollTimerRef.current);
|
|
86
|
+
};
|
|
87
|
+
}, [type]);
|
|
68
88
|
// Resolve theme with overrides
|
|
69
89
|
const resolvedTheme = useMemo(() => {
|
|
70
90
|
var _a, _b, _c;
|
|
@@ -75,7 +95,19 @@ const ScrollArea = React__default.forwardRef(({ children, type = 'hover', orient
|
|
|
75
95
|
});
|
|
76
96
|
}, [theme]);
|
|
77
97
|
// Determine overflow classes based on orientation
|
|
98
|
+
// For type='scroll', use overflow:overlay so scrollbar overlays content
|
|
78
99
|
const overflowClasses = useMemo(() => {
|
|
100
|
+
if (type === 'scroll') {
|
|
101
|
+
switch (orientation) {
|
|
102
|
+
case 'horizontal':
|
|
103
|
+
return 'overflow-x-[overlay] overflow-y-hidden';
|
|
104
|
+
case 'both':
|
|
105
|
+
return 'overflow-x-[overlay] overflow-y-[overlay]';
|
|
106
|
+
case 'vertical':
|
|
107
|
+
default:
|
|
108
|
+
return 'overflow-y-[overlay] overflow-x-hidden';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
79
111
|
switch (orientation) {
|
|
80
112
|
case 'horizontal':
|
|
81
113
|
return 'overflow-x-auto overflow-y-hidden';
|
|
@@ -85,7 +117,7 @@ const ScrollArea = React__default.forwardRef(({ children, type = 'hover', orient
|
|
|
85
117
|
default:
|
|
86
118
|
return 'overflow-y-auto overflow-x-hidden';
|
|
87
119
|
}
|
|
88
|
-
}, [orientation]);
|
|
120
|
+
}, [orientation, type]);
|
|
89
121
|
// Scroll snap classes
|
|
90
122
|
// When snap is enabled for horizontal/both, the viewport becomes a flex container
|
|
91
123
|
// so that items are direct children of the scrollable element (required for snap-align).
|
|
@@ -107,9 +139,11 @@ const ScrollArea = React__default.forwardRef(({ children, type = 'hover', orient
|
|
|
107
139
|
return `${axisClass} ${strictnessClass} ${alignClass} ${layoutClass}`;
|
|
108
140
|
}, [snap, orientation, snapAlign]);
|
|
109
141
|
// Base scrollbar styling classes (shared across all types)
|
|
142
|
+
const scrollbarDimension = size === 'thin'
|
|
143
|
+
? '[&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar]:h-1'
|
|
144
|
+
: '[&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar]:h-2';
|
|
110
145
|
const scrollbarBase = [
|
|
111
|
-
|
|
112
|
-
'[&::-webkit-scrollbar]:h-2',
|
|
146
|
+
scrollbarDimension,
|
|
113
147
|
'[&::-webkit-scrollbar-track]:bg-transparent',
|
|
114
148
|
'[&::-webkit-scrollbar-thumb]:rounded-full',
|
|
115
149
|
'[&::-webkit-scrollbar-corner]:bg-transparent',
|
|
@@ -124,13 +158,21 @@ const ScrollArea = React__default.forwardRef(({ children, type = 'hover', orient
|
|
|
124
158
|
].join(' ');
|
|
125
159
|
case 'scroll':
|
|
126
160
|
return [
|
|
127
|
-
'[&::-webkit-scrollbar-thumb]:bg-
|
|
161
|
+
'[&::-webkit-scrollbar-thumb]:bg-transparent',
|
|
162
|
+
'[&[data-scrolling]::-webkit-scrollbar-thumb]:bg-black/30',
|
|
163
|
+
'[&::-webkit-scrollbar-thumb]:transition-colors',
|
|
164
|
+
'[&::-webkit-scrollbar-thumb]:duration-300',
|
|
128
165
|
].join(' ');
|
|
129
166
|
case 'hover':
|
|
130
167
|
return [
|
|
131
168
|
'[&::-webkit-scrollbar-thumb]:bg-transparent',
|
|
132
169
|
'[&:hover::-webkit-scrollbar-thumb]:bg-[var(--color-border)]',
|
|
133
170
|
].join(' ');
|
|
171
|
+
case 'none':
|
|
172
|
+
return [
|
|
173
|
+
'[&::-webkit-scrollbar]:!hidden',
|
|
174
|
+
'[scrollbar-width:none]',
|
|
175
|
+
].join(' ');
|
|
134
176
|
case 'auto':
|
|
135
177
|
default:
|
|
136
178
|
return [
|
|
@@ -138,7 +180,7 @@ const ScrollArea = React__default.forwardRef(({ children, type = 'hover', orient
|
|
|
138
180
|
].join(' ');
|
|
139
181
|
}
|
|
140
182
|
}, [type]);
|
|
141
|
-
return (jsx("div", { ref: internalRef, className: cn(resolvedTheme.baseStyle, overflowClasses, snapClasses, scrollbarBase, scrollbarVisibility, className), "data-orientation": orientation, "data-type": type, "data-smooth": smooth, ...props, children: children }));
|
|
183
|
+
return (jsx("div", { ref: internalRef, className: cn(resolvedTheme.baseStyle, overflowClasses, snapClasses, scrollbarBase, scrollbarVisibility, className), "data-orientation": orientation, "data-type": type, "data-smooth": smooth, "data-scrolling": isScrolling || undefined, ...props, children: children }));
|
|
142
184
|
});
|
|
143
185
|
ScrollArea.displayName = 'ScrollArea';
|
|
144
186
|
|
|
@@ -4,10 +4,17 @@ import { SmoothScrollConfig, ScrollProgress, PerformanceMetrics } from './smooth
|
|
|
4
4
|
* Scrollbar visibility behavior
|
|
5
5
|
* - 'auto': Standard browser behavior (show when content overflows)
|
|
6
6
|
* - 'always': Always show scrollbar
|
|
7
|
-
* - 'scroll':
|
|
7
|
+
* - 'scroll': Show scrollbar only while actively scrolling (overlay, no track)
|
|
8
8
|
* - 'hover': Show scrollbar only on hover
|
|
9
|
+
* - 'none': Hide scrollbar completely while keeping scroll functionality
|
|
9
10
|
*/
|
|
10
|
-
export type ScrollAreaType = 'auto' | 'always' | 'scroll' | 'hover';
|
|
11
|
+
export type ScrollAreaType = 'auto' | 'always' | 'scroll' | 'hover' | 'none';
|
|
12
|
+
/**
|
|
13
|
+
* Scrollbar size
|
|
14
|
+
* - 'default': 8px scrollbar (w-2/h-2)
|
|
15
|
+
* - 'thin': 4px scrollbar (w-1/h-1)
|
|
16
|
+
*/
|
|
17
|
+
export type ScrollAreaSize = 'default' | 'thin';
|
|
11
18
|
/**
|
|
12
19
|
* Theme structure for the ScrollArea component
|
|
13
20
|
*/
|
|
@@ -29,7 +36,7 @@ export interface ScrollAreaThemeOverrides {
|
|
|
29
36
|
*/
|
|
30
37
|
export interface ScrollAreaRef extends HTMLDivElement {
|
|
31
38
|
/** Programmatically scroll to position with smooth animation */
|
|
32
|
-
smoothScrollTo?: (position: number, options?:
|
|
39
|
+
smoothScrollTo?: (position: number, options?: import("./smooth/SmoothScrollEngine.types").ScrollToOptions) => void;
|
|
33
40
|
/** Get current scroll velocity */
|
|
34
41
|
getScrollVelocity?: () => number;
|
|
35
42
|
/** Pause smooth scrolling */
|
|
@@ -65,6 +72,8 @@ export interface ScrollAreaProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
65
72
|
children: ReactNode;
|
|
66
73
|
/** Scrollbar visibility behavior @default 'hover' */
|
|
67
74
|
type?: ScrollAreaType;
|
|
75
|
+
/** Scrollbar size @default 'default' */
|
|
76
|
+
size?: ScrollAreaSize;
|
|
68
77
|
/** Scroll direction @default 'vertical' */
|
|
69
78
|
orientation?: 'vertical' | 'horizontal' | 'both';
|
|
70
79
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ScrollArea } from './ScrollArea';
|
|
2
|
-
export type { ScrollAreaProps, ScrollAreaRef, ScrollAreaTheme, ScrollAreaThemeOverrides, ScrollAreaType, } from './ScrollArea.types';
|
|
2
|
+
export type { ScrollAreaProps, ScrollAreaRef, ScrollAreaTheme, ScrollAreaThemeOverrides, ScrollAreaType, ScrollAreaSize, } from './ScrollArea.types';
|
|
3
3
|
export { scrollAreaTheme } from './ScrollArea.theme';
|
|
4
4
|
export { useSmoothScroll } from './smooth/useSmoothScroll';
|
|
5
5
|
export type { SmoothScrollAPI, SmoothScrollConfig, ScrollProgress, ScrollToOptions, SnapPoint, EasingFunction, PerformanceMetrics, } from './smooth';
|
|
@@ -24,6 +24,6 @@ const SegmentedItem = React__default.forwardRef(({ value, disabled = false, chil
|
|
|
24
24
|
), onClick: handleClick, "data-value": value, "data-selected": isSelected, "data-disabled": isDisabled, ...props, children: children }));
|
|
25
25
|
});
|
|
26
26
|
// Set display name for dev tools and Storybook
|
|
27
|
-
SegmentedItem.displayName = "
|
|
27
|
+
SegmentedItem.displayName = "Segmented.Item";
|
|
28
28
|
|
|
29
29
|
export { SegmentedItem };
|
|
@@ -31,12 +31,13 @@ const SidebarDesktop = React__default.forwardRef(({ side = "left", variant = "si
|
|
|
31
31
|
variants: { ...sidebarTheme.variants, ...customTheme.variants },
|
|
32
32
|
sides: { ...sidebarTheme.sides, ...customTheme.sides },
|
|
33
33
|
}), [customTheme]);
|
|
34
|
+
const { onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, ...motionSafeProps } = props;
|
|
34
35
|
const sidebarClasses = cn(theme.baseStyle, theme.variants[variant], theme.sides[side], className);
|
|
35
36
|
const animateValue = useMemo(() => ({
|
|
36
37
|
width: collapsed ? collapsedWidth : expandedWidth,
|
|
37
38
|
maxWidth: "100vw",
|
|
38
39
|
}), [collapsed, collapsedWidth, expandedWidth]);
|
|
39
|
-
return (jsx(motion.div, { ref: ref, className: sidebarClasses, "data-side": side, "data-variant": variant, "data-collapsed": collapsed, initial: false, animate: animateValue, transition: SIDEBAR_TRANSITION, ...
|
|
40
|
+
return (jsx(motion.div, { ref: ref, className: sidebarClasses, "data-side": side, "data-variant": variant, "data-collapsed": collapsed, initial: false, animate: animateValue, transition: SIDEBAR_TRANSITION, ...motionSafeProps, children: children }));
|
|
40
41
|
});
|
|
41
42
|
SidebarDesktop.displayName = "SidebarDesktop";
|
|
42
43
|
const SidebarMobile = ({ children, className, theme: customTheme = {} }) => {
|
|
@@ -21,7 +21,8 @@ const SidebarMobileTrigger = React__default.forwardRef(({ icon, className, onCli
|
|
|
21
21
|
setMobileOpen(true);
|
|
22
22
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
const { onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, color: _color, ...buttonProps } = props;
|
|
25
|
+
return (jsx(Button, { ref: ref, variant: "soft", size: "sm", className: cn("size-9 p-0", className), onClick: handleClick, "aria-label": "Open navigation menu", ...buttonProps, children: icon || jsx(Bars3Icon, { className: "size-5" }) }));
|
|
25
26
|
});
|
|
26
27
|
SidebarMobileTrigger.displayName = "SidebarMobileTrigger";
|
|
27
28
|
|
|
@@ -19,7 +19,8 @@ const SidebarToggle = React__default.forwardRef(({ expandIcon, collapseIcon, cla
|
|
|
19
19
|
toggleCollapsed();
|
|
20
20
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
const { onAnimationStart, onAnimationEnd, onDrag, onDragStart, onDragEnd, color: _color, ...buttonProps } = props;
|
|
23
|
+
return (jsx(Button, { ref: ref, variant: "soft", size: "sm", className: cn("size-8 p-0", className), onClick: handleClick, "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar", title: collapsed ? "Expand sidebar" : "Collapse sidebar", ...buttonProps, children: jsx(motion.div, { initial: false, animate: { rotate: collapsed ? 180 : 0 }, transition: { duration: 0.2 }, children: collapsed
|
|
23
24
|
? expandIcon || jsx(ChevronRightIcon, { className: "size-4" })
|
|
24
25
|
: collapseIcon || jsx(ChevronLeftIcon, { className: "size-4" }) }) }));
|
|
25
26
|
});
|
|
@@ -21,7 +21,7 @@ const SidebarUserProfile = React__default.forwardRef(({ name, email, avatar, sta
|
|
|
21
21
|
const content = (jsxs("div", { ref: ref, className: cn("flex items-center gap-3 rounded-[var(--radius-base)] cursor-pointer transition-colors duration-150 hover:bg-[var(--color-background-secondary)]", isCollapsedView ? "justify-center p-2" : "px-3 py-2", className), role: "button", tabIndex: 0, onClick: onClick, onKeyDown: (e) => {
|
|
22
22
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
23
23
|
e.preventDefault();
|
|
24
|
-
|
|
24
|
+
e.currentTarget.click();
|
|
25
25
|
}
|
|
26
26
|
}, ...props, children: [avatarElement, !isCollapsedView && (jsxs("div", { className: "flex-1 min-w-0", children: [jsx("div", { className: "text-sm font-medium text-[var(--color-text-primary)] truncate", children: name }), email && (jsx("div", { className: "text-xs text-[var(--color-text-muted)] truncate", children: email }))] }))] }));
|
|
27
27
|
// Tooltip when collapsed
|
|
@@ -22,7 +22,7 @@ const SocialIcon = React__default.forwardRef(({ icon, size = 'md', colorMode = '
|
|
|
22
22
|
const fill = colorMode === 'brand' ? platform.brandColor : 'currentColor';
|
|
23
23
|
return (jsx("svg", { ref: ref, xmlns: "http://www.w3.org/2000/svg", viewBox: platform.viewBox, width: resolvedSize, height: resolvedSize, fill: fill, role: "img", "aria-label": `${platform.label} icon`, "data-icon": icon, "data-color-mode": colorMode, "data-size": size, className: cn(theme.baseStyle, className), ...props, children: platform.shapes.map((shape, i) => {
|
|
24
24
|
var _a;
|
|
25
|
-
return (jsx("path", { d: shape.d, fill: (_a = shape.fill) !== null && _a !== void 0 ? _a : undefined }, i));
|
|
25
|
+
return (jsx("path", { d: shape.d, fill: colorMode === 'brand' ? ((_a = shape.fill) !== null && _a !== void 0 ? _a : undefined) : undefined }, i));
|
|
26
26
|
}) }));
|
|
27
27
|
});
|
|
28
28
|
SocialIcon.displayName = 'SocialIcon';
|
|
@@ -154,7 +154,7 @@ const SortableItem = React__default.forwardRef(({ id, children, className, theme
|
|
|
154
154
|
context.setDraggedItemContent(children);
|
|
155
155
|
const items = Array.from(context.itemRefs.current.entries());
|
|
156
156
|
const currentIndex = items.findIndex(([itemId]) => itemId === id);
|
|
157
|
-
(_a = context.onSortDragStart) === null || _a === void 0 ? void 0 : _a.call(context, { id, index: currentIndex, data: value }
|
|
157
|
+
(_a = context.onSortDragStart) === null || _a === void 0 ? void 0 : _a.call(context, { id, index: currentIndex, data: value });
|
|
158
158
|
}, [disabled, id, children, context, value]);
|
|
159
159
|
const handleDragEnd = useCallback(() => {
|
|
160
160
|
var _a;
|
|
@@ -164,7 +164,7 @@ const SortableItem = React__default.forwardRef(({ id, children, className, theme
|
|
|
164
164
|
context.setDropPosition(null);
|
|
165
165
|
const items = Array.from(context.itemRefs.current.entries());
|
|
166
166
|
const currentIndex = items.findIndex(([itemId]) => itemId === id);
|
|
167
|
-
(_a = context.onSortDragEnd) === null || _a === void 0 ? void 0 : _a.call(context, { id, index: currentIndex, data: value }
|
|
167
|
+
(_a = context.onSortDragEnd) === null || _a === void 0 ? void 0 : _a.call(context, { id, index: currentIndex, data: value });
|
|
168
168
|
}, [id, context, value]);
|
|
169
169
|
const handlePointerDown = useCallback((event) => {
|
|
170
170
|
if (disabled) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const sortableTheme = {
|
|
2
2
|
containerStyle: "relative list-none",
|
|
3
3
|
itemStyle: "relative cursor-move select-none relative focus-within:z-10 list-none",
|
|
4
|
-
dragHandleStyle: "cursor-grab active:cursor-grabbing p-1 text-
|
|
4
|
+
dragHandleStyle: "cursor-grab active:cursor-grabbing p-1 text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] flex items-center justify-center rounded transition-colors duration-200",
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export { sortableTheme };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactNode
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export interface SortableData {
|
|
3
3
|
id: string;
|
|
4
4
|
index: number;
|
|
5
5
|
data?: string | number | Record<string, unknown>;
|
|
6
6
|
}
|
|
7
|
+
/** Event type for sort drag callbacks - may be a native event, React event, or absent (keyboard-initiated) */
|
|
8
|
+
export type SortableEvent = React.KeyboardEvent<HTMLDivElement> | Event | undefined;
|
|
7
9
|
export interface SortableTheme {
|
|
8
10
|
containerStyle: string;
|
|
9
11
|
itemStyle: string;
|
|
@@ -28,9 +30,9 @@ export interface SortableProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onD
|
|
|
28
30
|
/** Show drag handles */
|
|
29
31
|
showDragHandle?: boolean;
|
|
30
32
|
/** Called when drag starts */
|
|
31
|
-
onSortDragStart?: (data: SortableData, event
|
|
33
|
+
onSortDragStart?: (data: SortableData, event?: SortableEvent) => void;
|
|
32
34
|
/** Called when drag ends */
|
|
33
|
-
onSortDragEnd?: (data: SortableData, event
|
|
35
|
+
onSortDragEnd?: (data: SortableData, event?: SortableEvent) => void;
|
|
34
36
|
/** Optional array of values for Reorder.Group - auto-extracted from children if not provided */
|
|
35
37
|
values?: (string | number)[];
|
|
36
38
|
}
|
|
@@ -53,8 +55,8 @@ export interface SortableContextValue {
|
|
|
53
55
|
showDragHandle: boolean;
|
|
54
56
|
theme: SortableTheme;
|
|
55
57
|
onReorder: (fromIndex: number, toIndex: number) => void;
|
|
56
|
-
onSortDragStart?: (data: SortableData, event
|
|
57
|
-
onSortDragEnd?: (data: SortableData, event
|
|
58
|
+
onSortDragStart?: (data: SortableData, event?: SortableEvent) => void;
|
|
59
|
+
onSortDragEnd?: (data: SortableData, event?: SortableEvent) => void;
|
|
58
60
|
draggedItem: string | null;
|
|
59
61
|
setDraggedItem: (id: string | null) => void;
|
|
60
62
|
dropPosition: {
|
|
@@ -14,7 +14,7 @@ const TabsBody = React__default.forwardRef(({ value, forceMount = false, childre
|
|
|
14
14
|
const shouldReduceMotion = useReducedMotion();
|
|
15
15
|
// Check if we're in Storybook and should disable animations
|
|
16
16
|
const isInStorybook = typeof window !== 'undefined' && window.__STORYBOOK_DISABLE_ANIMATIONS__;
|
|
17
|
-
const shouldDisableAnimations = !!shouldReduceMotion || isInStorybook;
|
|
17
|
+
const shouldDisableAnimations = !!shouldReduceMotion || !!isInStorybook;
|
|
18
18
|
const isSelected = value === selectedValue;
|
|
19
19
|
const shouldRender = forceMount || isSelected;
|
|
20
20
|
// Compute animation variants without a global cache (HMR-safe)
|
|
@@ -14,7 +14,7 @@ const TabsTrigger = React__default.forwardRef(({ value, disabled = false, childr
|
|
|
14
14
|
const shouldReduceMotion = useReducedMotion();
|
|
15
15
|
// Check if we're in Storybook and should disable animations
|
|
16
16
|
const isInStorybook = typeof window !== 'undefined' && window.__STORYBOOK_DISABLE_ANIMATIONS__;
|
|
17
|
-
const shouldDisableAnimations = !!shouldReduceMotion || isInStorybook;
|
|
17
|
+
const shouldDisableAnimations = !!shouldReduceMotion || !!isInStorybook;
|
|
18
18
|
// Memoize derived state flags for performance
|
|
19
19
|
const derivedState = useMemo(() => ({
|
|
20
20
|
isSelected: value === selectedValue,
|
|
@@ -47,10 +47,10 @@ const Tag = React__default.forwardRef(({ children, size = "md", removable = true
|
|
|
47
47
|
// Avatar takes precedence over startContent
|
|
48
48
|
const renderLeadingContent = () => {
|
|
49
49
|
if (avatar) {
|
|
50
|
-
return (jsx(Avatar, { src: avatar.src, name: avatar.name, fallback: avatar.fallback, initialsCount: avatar.initialsCount,
|
|
50
|
+
return (jsx("span", { className: cn("inline-flex items-center justify-center shrink-0 overflow-hidden rounded-full", theme.avatarSizes[size]), children: jsx(Avatar, { src: avatar.src, name: avatar.name, fallback: avatar.fallback, initialsCount: avatar.initialsCount, size: "xs", className: "!size-full border-0 rounded-full" }) }));
|
|
51
51
|
}
|
|
52
52
|
if (startContent) {
|
|
53
|
-
return (jsx("span", { className: cn("inline-flex items-center", theme.startContentSizes[size]), children: startContent }));
|
|
53
|
+
return (jsx("span", { className: cn("inline-flex items-center justify-center shrink-0", theme.startContentSizes[size]), children: startContent }));
|
|
54
54
|
}
|
|
55
55
|
return null;
|
|
56
56
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { ToastProps } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ToastProps } from "./Toast.types";
|
|
3
3
|
export declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -5,14 +5,18 @@ import { cn } from '../../../utils/cn.js';
|
|
|
5
5
|
import { toastTheme } from './Toast.theme.js';
|
|
6
6
|
import { toastAnimations, getToastStackingAnimation } from './Toast.animations.js';
|
|
7
7
|
import { ArrowPathIcon, InformationCircleIcon, XMarkIcon } from '@heroicons/react/24/solid';
|
|
8
|
+
import { Button } from '../Button/Button.js';
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
-
|
|
10
|
+
const isToastAction = (action) => typeof action === "object" &&
|
|
11
|
+
action !== null &&
|
|
12
|
+
"label" in action &&
|
|
13
|
+
"onClick" in action;
|
|
14
|
+
const Toast = React__default.forwardRef(({ toast, className, onDismiss, index = 0, isExpanded = false, totalToasts = 1, onMouseEnter, onMouseLeave, onHeightChange, expandedOffset, darkMode = false, ...props }, ref) => {
|
|
11
15
|
var _a;
|
|
12
16
|
const internalRef = useRef(null);
|
|
13
17
|
const setRefs = useCallback((node) => {
|
|
14
18
|
internalRef.current = node;
|
|
15
|
-
if (typeof ref ===
|
|
19
|
+
if (typeof ref === "function") {
|
|
16
20
|
ref(node);
|
|
17
21
|
}
|
|
18
22
|
else if (ref) {
|
|
@@ -20,11 +24,9 @@ onDismiss, index = 0, isExpanded = false, totalToasts = 1, onMouseEnter, onMouse
|
|
|
20
24
|
}
|
|
21
25
|
}, [ref]);
|
|
22
26
|
const shouldReduceMotion = useReducedMotion();
|
|
23
|
-
const { id, variant =
|
|
24
|
-
const isTextOnly = !subtitle && !action;
|
|
25
|
-
const defaultIcon = state ===
|
|
26
|
-
? (jsx(motion.div, { animate: { rotate: 360 }, transition: { repeat: Infinity, duration: 1, ease: "linear" }, children: jsx(ArrowPathIcon, { className: "w-5 h-5" }) }))
|
|
27
|
-
: jsx(InformationCircleIcon, { className: "w-5 h-5" });
|
|
27
|
+
const { id, variant = "default", state = "default", title, subtitle, icon, action, children, duration = 5000, dismissible = true, } = toast;
|
|
28
|
+
const isTextOnly = !subtitle && !action && !children;
|
|
29
|
+
const defaultIcon = state === "loading" ? (jsx(motion.div, { animate: { rotate: 360 }, transition: { repeat: Infinity, duration: 1, ease: "linear" }, children: jsx(ArrowPathIcon, { className: "w-5 h-5" }) })) : (jsx(InformationCircleIcon, { className: "w-5 h-5" }));
|
|
28
30
|
const resolvedIcon = icon || defaultIcon;
|
|
29
31
|
// Auto-dismiss after duration
|
|
30
32
|
useEffect(() => {
|
|
@@ -46,9 +48,11 @@ onDismiss, index = 0, isExpanded = false, totalToasts = 1, onMouseEnter, onMouse
|
|
|
46
48
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss(id);
|
|
47
49
|
};
|
|
48
50
|
const handleActionClick = () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
if (isToastAction(action)) {
|
|
52
|
+
action.onClick();
|
|
53
|
+
if (dismissible) {
|
|
54
|
+
handleDismiss();
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
};
|
|
54
58
|
const stackingStyle = getToastStackingAnimation(index, totalToasts, isExpanded, expandedOffset);
|
|
@@ -58,31 +62,36 @@ onDismiss, index = 0, isExpanded = false, totalToasts = 1, onMouseEnter, onMouse
|
|
|
58
62
|
opacity: (_a = stackingStyle.opacity) !== null && _a !== void 0 ? _a : 1,
|
|
59
63
|
y: (_b = stackingStyle.y) !== null && _b !== void 0 ? _b : 0,
|
|
60
64
|
scale: (_c = stackingStyle.scale) !== null && _c !== void 0 ? _c : 1,
|
|
61
|
-
zIndex: (_d = stackingStyle.zIndex) !== null && _d !== void 0 ? _d : 1
|
|
65
|
+
zIndex: (_d = stackingStyle.zIndex) !== null && _d !== void 0 ? _d : 1,
|
|
62
66
|
});
|
|
63
|
-
}, [
|
|
67
|
+
}, [
|
|
68
|
+
stackingStyle.opacity,
|
|
69
|
+
stackingStyle.y,
|
|
70
|
+
stackingStyle.scale,
|
|
71
|
+
stackingStyle.zIndex,
|
|
72
|
+
]);
|
|
64
73
|
const styleValue = useMemo(() => {
|
|
65
74
|
var _a;
|
|
66
75
|
return ({
|
|
67
76
|
zIndex: (_a = stackingStyle.zIndex) !== null && _a !== void 0 ? _a : 1,
|
|
68
|
-
position: (index > 0
|
|
77
|
+
position: (index > 0
|
|
78
|
+
? "absolute"
|
|
79
|
+
: "relative"),
|
|
69
80
|
top: index > 0 ? 0 : undefined,
|
|
70
81
|
left: index > 0 ? 0 : undefined,
|
|
71
|
-
width: index > 0 ?
|
|
82
|
+
width: index > 0 ? "100%" : undefined,
|
|
72
83
|
});
|
|
73
84
|
}, [stackingStyle.zIndex, index]);
|
|
74
85
|
const toastNode = (jsxs(motion.div, { ref: setRefs, layout: true, initial: shouldReduceMotion ? false : toastAnimations.initial, animate: animateValue, exit: shouldReduceMotion
|
|
75
86
|
? { ...toastAnimations.exit, transition: { duration: 0 } }
|
|
76
|
-
: toastAnimations.exit, transition: shouldReduceMotion ? { duration: 0 } : toastAnimations.transition, className: cn(toastTheme.baseStyle, isTextOnly &&
|
|
77
|
-
? jsx("div", { className:
|
|
78
|
-
:
|
|
79
|
-
? jsx("div", { className: toastTheme.subtitleStyle, children: subtitle })
|
|
80
|
-
: subtitle), action && (jsx("div", { className: "mt-2", children: jsx("button", { type: "button", className: toastTheme.actionStyle, onClick: handleActionClick, children: action.label }) }))] }), dismissible && (jsx("button", { type: "button", className: isTextOnly ? toastTheme.closeButtonCenteredStyle : toastTheme.closeButtonStyle, onClick: handleDismiss, "aria-label": "Dismiss notification", children: jsx(XMarkIcon, { className: "w-4 h-4" }) }))] }));
|
|
87
|
+
: toastAnimations.exit, transition: shouldReduceMotion ? { duration: 0 } : toastAnimations.transition, className: cn(toastTheme.baseStyle, isTextOnly && "items-center", ((_a = toastTheme.variants) === null || _a === void 0 ? void 0 : _a[variant]) || "", "pointer-events-auto", index > 0 && !isExpanded && "absolute top-0 left-0", className), style: styleValue, role: "alert", "aria-live": "polite", children: [jsx("div", { className: cn(toastTheme.iconStyle, !isTextOnly && "mt-0.5"), children: resolvedIcon }), jsxs("div", { className: "flex-1 min-w-0", children: [title &&
|
|
88
|
+
(typeof title === "string" ? (jsx("div", { className: cn(toastTheme.titleStyle, !isTextOnly && "font-semibold"), children: title })) : (title)), subtitle &&
|
|
89
|
+
(typeof subtitle === "string" ? (jsx("div", { className: toastTheme.subtitleStyle, children: subtitle })) : (subtitle)), action && (jsx("div", { className: "mt-4", children: isToastAction(action) ? (jsx(Button, { variant: "link", color: "primary", onClick: handleActionClick, children: action.label })) : (action) })), children] }), dismissible && (jsx("button", { type: "button", className: cn(toastTheme.closeButtonStyle, !isTextOnly && "mt-0.5"), onClick: handleDismiss, "aria-label": "Dismiss notification", children: jsx(XMarkIcon, { className: "size-5" }) }))] }));
|
|
81
90
|
if (darkMode) {
|
|
82
91
|
return jsx("div", { className: "dark", children: toastNode });
|
|
83
92
|
}
|
|
84
93
|
return toastNode;
|
|
85
94
|
});
|
|
86
|
-
Toast.displayName =
|
|
95
|
+
Toast.displayName = "Toast";
|
|
87
96
|
|
|
88
97
|
export { Toast };
|