@flikk/ui 1.0.0-beta.11 → 1.0.0-beta.13
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/ApprovalCard/ApprovalCard.js +1 -1
- package/dist/components/ai/MessageHistory/MessageHistory.js +1 -0
- package/dist/components/ai/PromptInput/PromptInput.js +7 -125
- package/dist/components/ai/PromptInput/VoiceRecorder.js +0 -77
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +1 -0
- package/dist/components/ai/StreamingResponse/StreamingResponse.types.d.ts +7 -7
- package/dist/components/ai/index.js +1 -0
- package/dist/components/core/Accordion/Accordion.d.ts +1 -1
- package/dist/components/core/Accordion/Accordion.js +2 -2
- package/dist/components/core/Accordion/Accordion.theme.d.ts +2 -2
- package/dist/components/core/Accordion/Accordion.theme.js +4 -4
- package/dist/components/core/Accordion/Accordion.types.d.ts +19 -20
- package/dist/components/core/Accordion/AccordionBody.d.ts +3 -0
- package/dist/components/core/Accordion/{AccordionContent.js → AccordionBody.js} +4 -4
- package/dist/components/core/Accordion/AccordionItem.js +1 -1
- package/dist/components/core/Accordion/AccordionTrigger.js +14 -7
- package/dist/components/core/Accordion/index.d.ts +2 -2
- package/dist/components/core/Alert/Alert.js +5 -1
- package/dist/components/core/Alert/Alert.types.d.ts +4 -4
- package/dist/components/core/Avatar/Avatar.js +22 -18
- package/dist/components/core/Avatar/Avatar.theme.js +1 -1
- package/dist/components/core/Avatar/Avatar.types.d.ts +9 -8
- package/dist/components/core/AvatarGroup/AvatarGroup.js +2 -2
- package/dist/components/core/Badge/Badge.js +7 -5
- package/dist/components/core/Badge/Badge.theme.js +11 -4
- package/dist/components/core/Badge/Badge.types.d.ts +2 -2
- package/dist/components/core/Breadcrumbs/Breadcrumbs.js +7 -3
- package/dist/components/core/Breadcrumbs/Breadcrumbs.types.d.ts +1 -1
- package/dist/components/core/Button/Button.js +2 -8
- package/dist/components/core/Button/Button.theme.js +7 -7
- package/dist/components/core/Calendar/Calendar.js +3 -3
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.types.d.ts +5 -6
- package/dist/components/core/Card/Card.d.ts +2 -2
- package/dist/components/core/Card/Card.js +3 -3
- package/dist/components/core/Card/Card.theme.js +3 -3
- package/dist/components/core/Card/Card.types.d.ts +4 -4
- package/dist/components/core/Card/CardBody.d.ts +3 -0
- package/dist/components/core/Card/CardBody.js +11 -0
- package/dist/components/core/Card/index.d.ts +2 -2
- package/dist/components/core/Carousel/Carousel.js +4 -4
- package/dist/components/core/Carousel/Carousel.types.d.ts +4 -4
- package/dist/components/core/Carousel/CarouselBody.d.ts +4 -0
- package/dist/components/core/Carousel/{CarouselContent.js → CarouselBody.js} +3 -3
- package/dist/components/core/Carousel/index.d.ts +2 -1
- package/dist/components/core/ContextMenu/ContextMenu.d.ts +2 -2
- package/dist/components/core/ContextMenu/ContextMenu.js +6 -6
- package/dist/components/core/ContextMenu/ContextMenu.types.d.ts +2 -2
- package/dist/components/core/ContextMenu/ContextMenuBody.d.ts +6 -0
- package/dist/components/core/ContextMenu/{ContextMenuContent.js → ContextMenuBody.js} +4 -4
- package/dist/components/core/ContextMenu/ContextMenuSubBody.d.ts +6 -0
- package/dist/components/core/ContextMenu/{ContextMenuSubContent.js → ContextMenuSubBody.js} +4 -4
- package/dist/components/core/ContextMenu/index.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.d.ts +2 -2
- package/dist/components/core/Drawer/Drawer.js +28 -9
- package/dist/components/core/Drawer/Drawer.theme.js +1 -1
- package/dist/components/core/Drawer/Drawer.types.d.ts +8 -6
- package/dist/components/core/Drawer/DrawerBody.d.ts +5 -0
- package/dist/components/core/Drawer/DrawerBody.js +11 -0
- package/dist/components/core/Drawer/index.d.ts +2 -1
- package/dist/components/core/Dropdown/Dropdown.types.d.ts +3 -3
- package/dist/components/core/Dropdown/DropdownSection.js +3 -1
- package/dist/components/core/FileTypeIcon/FileTypeIcon.d.ts +3 -0
- package/dist/components/core/FileTypeIcon/FileTypeIcon.js +33 -0
- package/dist/components/core/FileTypeIcon/FileTypeIcon.theme.d.ts +2 -0
- package/dist/components/core/FileTypeIcon/FileTypeIcon.theme.js +12 -0
- package/dist/components/core/FileTypeIcon/FileTypeIcon.types.d.ts +19 -0
- package/dist/components/core/FileTypeIcon/fileTypes.d.ts +7 -0
- package/dist/components/core/FileTypeIcon/fileTypes.js +30 -0
- package/dist/components/core/FileTypeIcon/index.d.ts +2 -0
- package/dist/components/core/MenuItem/MenuItem.js +3 -1
- package/dist/components/core/MenuItem/MenuItem.theme.js +1 -1
- package/dist/components/core/MenuItem/MenuItem.types.d.ts +1 -1
- package/dist/components/core/Message/Message.d.ts +1 -1
- package/dist/components/core/Message/Message.js +3 -3
- package/dist/components/core/Message/Message.theme.js +2 -2
- package/dist/components/core/Message/Message.types.d.ts +7 -7
- package/dist/components/core/Message/MessageAvatar.d.ts +2 -2
- package/dist/components/core/Message/MessageAvatar.js +3 -3
- package/dist/components/core/Message/MessageBody.d.ts +8 -0
- package/dist/components/core/Message/{MessageContent.js → MessageBody.js} +3 -3
- package/dist/components/core/Message/index.d.ts +2 -0
- package/dist/components/core/Modal/Modal.js +5 -1
- package/dist/components/core/Modal/Modal.theme.js +1 -1
- package/dist/components/core/Modal/Modal.types.d.ts +5 -2
- package/dist/components/core/ModalStack/ModalStackModal.js +1 -0
- package/dist/components/core/PageHeading/PageHeading.types.d.ts +1 -1
- package/dist/components/core/PageHeading/PageHeadingBackButton.js +3 -1
- package/dist/components/core/Popover/Popover.d.ts +1 -1
- package/dist/components/core/Popover/Popover.js +4 -4
- package/dist/components/core/Popover/Popover.theme.d.ts +1 -1
- package/dist/components/core/Popover/Popover.theme.js +2 -2
- package/dist/components/core/Popover/Popover.types.d.ts +3 -3
- package/dist/components/core/Popover/PopoverBody.d.ts +7 -0
- package/dist/components/core/Popover/{PopoverContent.js → PopoverBody.js} +24 -13
- package/dist/components/core/Popover/index.d.ts +4 -3
- package/dist/components/core/Tabs/Tabs.animations.d.ts +2 -2
- package/dist/components/core/Tabs/Tabs.animations.js +3 -3
- package/dist/components/core/Tabs/Tabs.d.ts +1 -1
- package/dist/components/core/Tabs/Tabs.js +3 -3
- package/dist/components/core/Tabs/Tabs.theme.d.ts +1 -1
- package/dist/components/core/Tabs/Tabs.theme.js +2 -2
- package/dist/components/core/Tabs/Tabs.types.d.ts +9 -9
- package/dist/components/core/Tabs/TabsBody.d.ts +6 -0
- package/dist/components/core/Tabs/{TabsContent.js → TabsBody.js} +8 -8
- package/dist/components/core/Tabs/index.d.ts +2 -2
- package/dist/components/core/Tag/Tag.d.ts +1 -1
- package/dist/components/core/Tag/Tag.js +2 -2
- package/dist/components/core/Tag/Tag.types.d.ts +1 -1
- package/dist/components/core/Toast/Toast.js +5 -1
- package/dist/components/core/Toast/Toast.types.d.ts +9 -9
- package/dist/components/core/index.d.ts +1 -1
- package/dist/components/core/index.js +7 -3
- package/dist/components/data-display/Feed/Feed.animations.d.ts +40 -0
- package/dist/components/data-display/Feed/Feed.animations.js +26 -0
- package/dist/components/data-display/Feed/Feed.d.ts +5 -1
- package/dist/components/data-display/Feed/Feed.js +87 -52
- package/dist/components/data-display/Feed/Feed.theme.js +11 -13
- package/dist/components/data-display/Feed/Feed.types.d.ts +35 -34
- package/dist/components/data-display/Feed/index.d.ts +1 -1
- package/dist/components/data-display/GanttChart/GanttTaskBar.js +11 -9
- package/dist/components/data-display/GanttChart/GanttTaskContextMenu.js +1 -1
- package/dist/components/data-display/KPI/KPI.js +2 -2
- package/dist/components/data-display/KPI/KPI.types.d.ts +3 -3
- package/dist/components/data-display/Metric/Metric.js +2 -2
- package/dist/components/data-display/Metric/Metric.types.d.ts +3 -3
- package/dist/components/data-display/Table/TableColumnManager.js +2 -1
- package/dist/components/data-display/Table/TableFilter.js +2 -1
- package/dist/components/data-display/Timeline/TimelineMarker.js +2 -2
- package/dist/components/effects/3d/index.d.ts +1 -1
- package/dist/components/effects/AIOrb/AIOrb.d.ts +1 -0
- package/dist/components/effects/AIOrb/AIOrb.js +3 -2
- package/dist/components/effects/AIOrb/AIOrb.types.d.ts +1 -0
- package/dist/components/effects/AIOrb/hooks/index.d.ts +2 -0
- package/dist/components/effects/AIOrb/hooks/useOrbState.d.ts +20 -0
- package/dist/components/effects/AIOrb/hooks/useOrbState.js +27 -0
- package/dist/components/effects/AIOrb/index.d.ts +2 -2
- package/dist/components/effects/AIOrb/variants/Aura/Aura.d.ts +3 -0
- package/dist/components/effects/AIOrb/variants/Aura/Aura.js +75 -0
- package/dist/components/effects/AIOrb/variants/Aura/Aura.shaders.d.ts +28 -0
- package/dist/components/effects/AIOrb/variants/Aura/Aura.shaders.js +191 -0
- package/dist/components/effects/AIOrb/variants/Aura/Aura.types.d.ts +53 -0
- package/dist/components/effects/AIOrb/variants/Aura/ShaderCanvas.d.ts +17 -0
- package/dist/components/effects/AIOrb/variants/Aura/ShaderCanvas.js +149 -0
- package/dist/components/effects/AIOrb/variants/Aura/index.d.ts +2 -0
- package/dist/components/effects/AIOrb/variants/DotSphere/DotSphere.js +38 -7
- package/dist/components/effects/AIOrb/variants/DotSphere/DotSphere.types.d.ts +6 -0
- package/dist/components/effects/AIOrb/variants/Liquid/Liquid.js +34 -8
- package/dist/components/effects/AIOrb/variants/Liquid/Liquid.types.d.ts +6 -0
- package/dist/components/effects/AIOrb/variants/index.d.ts +2 -0
- package/dist/components/effects/CustomCursor/CustomCursor.d.ts +2 -2
- package/dist/components/effects/CustomCursor/CustomCursor.js +50 -47
- package/dist/components/effects/GlassSurface/GlassSurface.js +24 -12
- package/dist/components/effects/GlassSurface/GlassSurface.types.d.ts +8 -0
- package/dist/components/forms/Checkbox/Checkbox.js +1 -1
- package/dist/components/forms/Checkbox/Checkbox.types.d.ts +5 -5
- package/dist/components/forms/Checkbox/CheckboxGroup.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/components/forms/ColorPicker/ColorPicker.js +2 -2
- package/dist/components/forms/ColorPicker/ColorPicker.types.d.ts +2 -2
- package/dist/components/forms/ColorPicker/ColorPickerBody.d.ts +7 -0
- package/dist/components/forms/ColorPicker/{ColorPickerContent.js → ColorPickerBody.js} +5 -5
- package/dist/components/forms/ColorPicker/index.d.ts +2 -2
- package/dist/components/forms/DatePicker/DatePicker.d.ts +7 -3
- package/dist/components/forms/DatePicker/DatePicker.js +6 -5
- package/dist/components/forms/DatePicker/DatePicker.theme.js +3 -3
- package/dist/components/forms/DatePicker/DatePicker.types.d.ts +9 -4
- package/dist/components/forms/DatePicker/DatePickerBody.d.ts +7 -0
- package/dist/components/forms/DatePicker/{DatePickerContent.js → DatePickerBody.js} +10 -9
- package/dist/components/forms/DatePicker/index.d.ts +2 -2
- package/dist/components/forms/FileUpload/FileUpload.js +0 -78
- package/dist/components/forms/Input/Input.js +2 -2
- package/dist/components/forms/Input/Input.types.d.ts +4 -4
- package/dist/components/forms/Mention/Mention.js +2 -2
- package/dist/components/forms/Radio/Radio.js +1 -1
- package/dist/components/forms/Radio/Radio.types.d.ts +5 -5
- package/dist/components/forms/Radio/RadioGroup.js +1 -1
- package/dist/components/forms/Select/Select.js +2 -2
- package/dist/components/forms/Select/Select.types.d.ts +4 -4
- package/dist/components/forms/Switch/Switch.js +1 -1
- package/dist/components/forms/Switch/Switch.types.d.ts +4 -4
- package/dist/components/forms/Textarea/Textarea.js +2 -2
- package/dist/components/forms/Textarea/Textarea.types.d.ts +4 -4
- package/dist/components/forms/TimePicker/TimePickerContent.js +1 -78
- package/dist/components/forms/index.d.ts +2 -2
- package/dist/components/forms/index.js +2 -80
- package/dist/components/layout/FormLayout/FormLayout.d.ts +0 -2
- package/dist/components/layout/FormLayout/FormLayout.js +12 -6
- package/dist/components/layout/FormLayout/FormLayout.theme.js +2 -5
- package/dist/components/layout/FormLayout/FormLayout.types.d.ts +8 -26
- package/dist/components/layout/FormLayout/FormLayoutSection.js +3 -2
- package/dist/components/layout/FormLayout/index.d.ts +1 -1
- package/dist/index.js +197 -199
- package/dist/styles.css +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/paletteGenerator.d.ts +46 -0
- package/package.json +1 -1
- package/src/styles/theme.css +2 -6
- package/dist/components/core/Accordion/AccordionContent.d.ts +0 -3
- package/dist/components/core/Card/CardContent.d.ts +0 -3
- package/dist/components/core/Card/CardContent.js +0 -11
- package/dist/components/core/Carousel/CarouselContent.d.ts +0 -4
- package/dist/components/core/ContextMenu/ContextMenuContent.d.ts +0 -6
- package/dist/components/core/ContextMenu/ContextMenuSubContent.d.ts +0 -6
- package/dist/components/core/Drawer/DrawerContent.d.ts +0 -5
- package/dist/components/core/Drawer/DrawerContent.js +0 -11
- package/dist/components/core/Loader/Loader.d.ts +0 -24
- package/dist/components/core/Loader/Loader.js +0 -57
- package/dist/components/core/Loader/Loader.theme.d.ts +0 -27
- package/dist/components/core/Loader/Loader.theme.js +0 -60
- package/dist/components/core/Loader/Loader.types.d.ts +0 -71
- package/dist/components/core/Loader/index.d.ts +0 -2
- package/dist/components/core/Message/MessageContent.d.ts +0 -8
- package/dist/components/core/Popover/PopoverContent.d.ts +0 -7
- package/dist/components/core/Tabs/TabsContent.d.ts +0 -6
- package/dist/components/forms/ColorPicker/ColorPickerContent.d.ts +0 -7
- package/dist/components/forms/DatePicker/DatePickerContent.d.ts +0 -7
- package/dist/components/layout/FormLayout/FormLayoutBody.d.ts +0 -3
- package/dist/components/layout/FormLayout/FormLayoutBody.js +0 -91
- package/dist/components/layout/FormLayout/FormLayoutHeader.d.ts +0 -3
- package/dist/components/layout/FormLayout/FormLayoutHeader.js +0 -12
|
@@ -4,12 +4,14 @@ import { cn } from '../../../utils/cn.js';
|
|
|
4
4
|
import { avatarTheme } from './Avatar.theme.js';
|
|
5
5
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
6
6
|
import '../Tooltip/Tooltip.animations.js';
|
|
7
|
+
import { UserIcon } from '@heroicons/react/24/solid';
|
|
7
8
|
|
|
8
|
-
const Avatar = React__default.forwardRef(({ src,
|
|
9
|
-
size = "md", status = "none", fallback, className, role, lazyLoad = true, retryCount = 0, retryDelay = 1000, contextualLabel, groupPosition, showTooltip = false, ...props }, ref) => {
|
|
9
|
+
const Avatar = React__default.forwardRef(({ src, name, size = "md", status = "none", fallback, className, role, lazyLoad = true, retryCount = 0, retryDelay = 1000, contextualLabel, groupPosition, showTooltip = false, initialsCount = 2, ...props }, ref) => {
|
|
10
10
|
const [imageError, setImageError] = useState(false);
|
|
11
11
|
const [retries, setRetries] = useState(0);
|
|
12
12
|
const retryTimerRef = useRef(null);
|
|
13
|
+
// Normalize null to undefined for internal use
|
|
14
|
+
const resolvedName = name !== null && name !== void 0 ? name : undefined;
|
|
13
15
|
// Clear timeout on unmount to prevent memory leaks
|
|
14
16
|
useEffect(() => {
|
|
15
17
|
return () => {
|
|
@@ -43,21 +45,23 @@ size = "md", status = "none", fallback, className, role, lazyLoad = true, retryC
|
|
|
43
45
|
}, [retries, retryCount, retryDelay]);
|
|
44
46
|
// Handle fallback content
|
|
45
47
|
const getFallbackContent = () => {
|
|
48
|
+
// 1. Explicit fallback always wins
|
|
46
49
|
if (fallback) {
|
|
47
50
|
return fallback;
|
|
48
51
|
}
|
|
49
|
-
//
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
+
// 2. Generate initials from name
|
|
53
|
+
if (resolvedName) {
|
|
54
|
+
const maxInitials = size === "xs" ? 1 : initialsCount;
|
|
55
|
+
const initials = resolvedName
|
|
56
|
+
.split(" ")
|
|
57
|
+
.map((part) => part[0])
|
|
58
|
+
.slice(0, maxInitials)
|
|
59
|
+
.join("")
|
|
60
|
+
.toUpperCase();
|
|
61
|
+
return jsx("span", { "aria-hidden": "true", children: initials });
|
|
52
62
|
}
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
.split(" ")
|
|
56
|
-
.map((part) => part[0])
|
|
57
|
-
.slice(0, 1)
|
|
58
|
-
.join("")
|
|
59
|
-
.toUpperCase();
|
|
60
|
-
return jsx("span", { "aria-hidden": "true", children: initials });
|
|
63
|
+
// 3. Default placeholder icon
|
|
64
|
+
return jsx(UserIcon, { className: "w-1/2 h-1/2" });
|
|
61
65
|
};
|
|
62
66
|
// Determine status indicator size based on avatar size
|
|
63
67
|
const getStatusSize = () => {
|
|
@@ -78,15 +82,15 @@ size = "md", status = "none", fallback, className, role, lazyLoad = true, retryC
|
|
|
78
82
|
};
|
|
79
83
|
// Create full accessibility label including context if provided
|
|
80
84
|
const accessibilityLabel = contextualLabel
|
|
81
|
-
? `${
|
|
82
|
-
:
|
|
85
|
+
? `${resolvedName !== null && resolvedName !== void 0 ? resolvedName : "Avatar"}${contextualLabel}`
|
|
86
|
+
: (resolvedName !== null && resolvedName !== void 0 ? resolvedName : "Avatar");
|
|
83
87
|
// Determine appropriate ARIA role
|
|
84
88
|
const ariaRole = role || (src ? undefined : "img");
|
|
85
89
|
// Avatar content to potentially wrap in tooltip
|
|
86
|
-
const avatarContent = (jsxs("div", { ref: ref, className: cn("relative inline-flex avatar-wrapper", groupPosition), role: ariaRole === "presentation" ? "presentation" : undefined, "aria-label": ariaRole === "presentation" ? undefined : accessibilityLabel, "data-size": size, "data-status": status, "data-error": imageError ? "true" : "false", ...props, children: [jsx("div", { className: cn(avatarTheme.baseStyle, avatarTheme.sizes[size], className), "aria-hidden": ariaRole === "presentation" ? "true" : undefined, "data-size": size, children: src && !imageError ? (jsx("img", { src: src, alt:
|
|
90
|
+
const avatarContent = (jsxs("div", { ref: ref, className: cn("relative inline-flex avatar-wrapper", groupPosition), role: ariaRole === "presentation" ? "presentation" : undefined, "aria-label": ariaRole === "presentation" ? undefined : accessibilityLabel, "data-size": size, "data-status": status, "data-error": imageError ? "true" : "false", ...props, children: [jsx("div", { className: cn(avatarTheme.baseStyle, avatarTheme.sizes[size], className), "aria-hidden": ariaRole === "presentation" ? "true" : undefined, "data-size": size, children: src && !imageError ? (jsx("img", { src: src, alt: resolvedName !== null && resolvedName !== void 0 ? resolvedName : "Avatar", className: "size-full object-cover object-top", onError: handleImageError, loading: lazyLoad ? "lazy" : undefined, "aria-hidden": ariaRole === "presentation" ? "true" : undefined, "data-loaded": "true" })) : (jsx("div", { className: "avatar-fallback", children: getFallbackContent() })) }), status !== "none" && (jsx("span", { className: cn("absolute rounded-full ring-2 ring-[var(--color-background)]", getStatusSize(), avatarTheme.statuses[status]), "aria-label": `Status: ${status}`, role: "status", "data-status": status }))] }));
|
|
87
91
|
// Conditionally wrap in tooltip
|
|
88
|
-
if (showTooltip &&
|
|
89
|
-
return (jsx(Tooltip, { content:
|
|
92
|
+
if (showTooltip && resolvedName) {
|
|
93
|
+
return (jsx(Tooltip, { content: resolvedName, placement: "top", children: avatarContent }));
|
|
90
94
|
}
|
|
91
95
|
return avatarContent;
|
|
92
96
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const avatarTheme = {
|
|
5
5
|
// Base styles for the avatar element
|
|
6
|
-
baseStyle: "relative inline-flex items-center justify-center overflow-hidden bg-neutral-200 text-[var(--color-text-primary)] font-
|
|
6
|
+
baseStyle: "relative inline-flex items-center justify-center overflow-hidden bg-neutral-200 text-[var(--color-text-primary)] font-bold tracking-tighter rounded-[var(--avatar-radius)] border border-[var(--color-border)] transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2",
|
|
7
7
|
// Size variants using CSS variables
|
|
8
8
|
sizes: {
|
|
9
9
|
xs: "size-[var(--avatar-size-xs)] text-xs",
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
2
|
-
export type AvatarSize =
|
|
3
|
-
export type AvatarStatus =
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
3
|
+
export type AvatarStatus = "online" | "offline" | "busy" | "away" | "none";
|
|
4
4
|
export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
/**
|
|
6
6
|
* The source URL for the avatar image
|
|
7
7
|
*/
|
|
8
8
|
src?: string;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* The name of the person or entity represented by the avatar.
|
|
11
|
+
* Used to generate initials for the fallback and as alt text for the image.
|
|
12
|
+
* Accepts `null` for compatibility with nullable data sources.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
name?: string | null;
|
|
15
15
|
/**
|
|
16
16
|
* The size of the avatar
|
|
17
17
|
* @default "md"
|
|
@@ -23,7 +23,8 @@ export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
23
23
|
*/
|
|
24
24
|
status?: AvatarStatus;
|
|
25
25
|
/**
|
|
26
|
-
* Fallback content to display when image fails to load or no src is provided
|
|
26
|
+
* Fallback content to display when image fails to load or no src is provided.
|
|
27
|
+
* Overrides the default placeholder icon and auto-generated initials.
|
|
27
28
|
*/
|
|
28
29
|
fallback?: ReactNode;
|
|
29
30
|
/**
|
|
@@ -18,7 +18,7 @@ const AvatarGroup = React__default.forwardRef(({ avatars = [], max = 5, size = "
|
|
|
18
18
|
const directionClass = direction === "row-reverse" ? "flex-row-reverse" : "flex-row";
|
|
19
19
|
const totalPeople = avatars.length;
|
|
20
20
|
const groupDescription = avatars
|
|
21
|
-
.map((avatar) => avatar.
|
|
21
|
+
.map((avatar) => avatar.name || "User")
|
|
22
22
|
.join(", ");
|
|
23
23
|
return {
|
|
24
24
|
visibleAvatars,
|
|
@@ -49,7 +49,7 @@ const AvatarGroup = React__default.forwardRef(({ avatars = [], max = 5, size = "
|
|
|
49
49
|
// Ensure that groupPosition is not passed to avoid conflicts
|
|
50
50
|
groupPosition: undefined }) }, index));
|
|
51
51
|
}), overflowCount > 0 && (jsx("div", { className: cn(spacingClass, enableAnimations &&
|
|
52
|
-
"transition-transform duration-200 hover:scale-110"), "data-overflow-count": overflowCount, children: overflowIndicator ? (overflowIndicator(overflowCount)) : (jsx(Avatar, { size: size,
|
|
52
|
+
"transition-transform duration-200 hover:scale-110"), "data-overflow-count": overflowCount, children: overflowIndicator ? (overflowIndicator(overflowCount)) : (jsx(Avatar, { size: size, name: `+${overflowCount} more`, fallback: jsxs("span", { children: ["+", overflowCount] }), className: avatarGroupTheme.overflowAvatarStyle, role: "img", "aria-label": `+ ${overflowCount} more users` })) }))] }));
|
|
53
53
|
});
|
|
54
54
|
// Set display name for dev tools and Storybook
|
|
55
55
|
AvatarGroup.displayName = "AvatarGroup";
|
|
@@ -164,14 +164,16 @@ const Badge = React__default.memo(React__default.forwardRef(({ children, variant
|
|
|
164
164
|
// Apply negative margin for overlap effect (scales with badge size)
|
|
165
165
|
const avatarMargin = pill
|
|
166
166
|
? {
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
xs: "-ml-1",
|
|
168
|
+
sm: "-ml-1.5",
|
|
169
|
+
md: "-ml-1.5",
|
|
169
170
|
}[size]
|
|
170
171
|
: {
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
xs: "-ml-1",
|
|
173
|
+
sm: "-ml-1.5",
|
|
174
|
+
md: "-ml-1",
|
|
173
175
|
}[size];
|
|
174
|
-
return (jsx(Avatar, { src: avatar.src,
|
|
176
|
+
return (jsx(Avatar, { src: avatar.src, name: avatar.name, fallback: avatar.fallback, initialsCount: avatar.initialsCount, className: cn((_a = theme.avatarSizes) === null || _a === void 0 ? void 0 : _a[size], avatarMargin, "border-0", pill ? "rounded-full" : "rounded-md ring-0") }));
|
|
175
177
|
}
|
|
176
178
|
if (iconStart) {
|
|
177
179
|
return (jsx("span", { className: cn("inline-flex items-center justify-center flex-shrink-0", (_b = theme.iconSizes) === null || _b === void 0 ? void 0 : _b[size]), "aria-hidden": "true", children: iconStart }));
|
|
@@ -6,7 +6,7 @@ import { semanticBgColors } from '../../../utils/colorUtils.js';
|
|
|
6
6
|
*/
|
|
7
7
|
const badgeTheme = {
|
|
8
8
|
// Base styles applied to all badges
|
|
9
|
-
baseStyle: "inline-flex items-center
|
|
9
|
+
baseStyle: "inline-flex items-center align-middle select-none whitespace-nowrap transition-all duration-300 h-fit",
|
|
10
10
|
// Visual style variants (structure only, no colors)
|
|
11
11
|
variants: {
|
|
12
12
|
filled: "",
|
|
@@ -47,7 +47,7 @@ const badgeTheme = {
|
|
|
47
47
|
},
|
|
48
48
|
// Ghost variant - subtle background tints
|
|
49
49
|
ghost: {
|
|
50
|
-
neutral: "bg-[var(--color-neutral-200)] text-[var(--color-text-
|
|
50
|
+
neutral: "bg-[var(--color-neutral-200)] text-[var(--color-text-primary)] " +
|
|
51
51
|
"dark:bg-[var(--color-neutral-900)] ",
|
|
52
52
|
primary: "bg-[var(--color-primary-100)] text-[var(--color-primary-700)] " +
|
|
53
53
|
"dark:bg-[var(--color-primary-600)]/30 dark:text-[var(--color-primary-400)]",
|
|
@@ -63,36 +63,43 @@ const badgeTheme = {
|
|
|
63
63
|
},
|
|
64
64
|
// Flat size structure (no nested objects)
|
|
65
65
|
sizes: {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
xs: "text-xs px-1 py-0 gap-1 font-medium",
|
|
67
|
+
sm: "text-sm px-1.5 py-0 gap-1 font-medium",
|
|
68
|
+
md: "text-sm px-2 py-0.25 gap-1 font-semibold",
|
|
68
69
|
},
|
|
69
70
|
// Border radius per size (using CSS variable)
|
|
70
71
|
radiusSizes: {
|
|
72
|
+
xs: "rounded-[calc(var(--badge-radius)*0.5)]",
|
|
71
73
|
sm: "rounded-[calc(var(--badge-radius)*0.75)]",
|
|
72
74
|
md: "rounded-[var(--badge-radius)]",
|
|
73
75
|
},
|
|
74
76
|
// Additional padding for pill shape
|
|
75
77
|
pillSizes: {
|
|
78
|
+
xs: "px-1.5",
|
|
76
79
|
sm: "px-2",
|
|
77
80
|
md: "px-2.5",
|
|
78
81
|
},
|
|
79
82
|
// Icon sizes
|
|
80
83
|
iconSizes: {
|
|
84
|
+
xs: "size-2.5",
|
|
81
85
|
sm: "size-3",
|
|
82
86
|
md: "size-3.5",
|
|
83
87
|
},
|
|
84
88
|
// Avatar sizes (base sizes without negative margin)
|
|
85
89
|
avatarSizes: {
|
|
90
|
+
xs: "size-3.5",
|
|
86
91
|
sm: "size-4",
|
|
87
92
|
md: "size-4",
|
|
88
93
|
},
|
|
89
94
|
// Dismiss button container sizes
|
|
90
95
|
dismissButtonSizes: {
|
|
96
|
+
xs: "size-3",
|
|
91
97
|
sm: "size-3.5",
|
|
92
98
|
md: "size-4",
|
|
93
99
|
},
|
|
94
100
|
// Dismiss icon sizes (inside button)
|
|
95
101
|
dismissIconSizes: {
|
|
102
|
+
xs: "size-2",
|
|
96
103
|
sm: "size-2.5",
|
|
97
104
|
md: "size-3",
|
|
98
105
|
},
|
|
@@ -2,7 +2,7 @@ import React, { ReactNode, MouseEvent } from "react";
|
|
|
2
2
|
import { SemanticColor } from "../../../utils/colorUtils";
|
|
3
3
|
export type BadgeVariant = "filled" | "outline" | "ghost";
|
|
4
4
|
export type BadgeColor = SemanticColor;
|
|
5
|
-
export type BadgeSize = "sm" | "md";
|
|
5
|
+
export type BadgeSize = "xs" | "sm" | "md";
|
|
6
6
|
/**
|
|
7
7
|
* Theme configuration for Badge component
|
|
8
8
|
*/
|
|
@@ -122,7 +122,7 @@ export interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>,
|
|
|
122
122
|
*/
|
|
123
123
|
avatar?: {
|
|
124
124
|
src?: string;
|
|
125
|
-
|
|
125
|
+
name: string;
|
|
126
126
|
fallback?: ReactNode;
|
|
127
127
|
initialsCount?: number;
|
|
128
128
|
};
|
|
@@ -42,8 +42,10 @@ const Breadcrumbs = ({ items, separator, maxItems = 4, variant = "default", clas
|
|
|
42
42
|
// Render individual breadcrumb item
|
|
43
43
|
const renderItem = (item, index, isLast) => {
|
|
44
44
|
const isCurrentPage = isLast || !item.href;
|
|
45
|
-
const itemContent = (jsxs(Fragment, { children: [showIcons && item.iconStart && (jsx("span", { className: "mr-1.5 flex-shrink-0", children: item.iconStart })), item.label
|
|
46
|
-
|
|
45
|
+
const itemContent = (jsxs(Fragment, { children: [showIcons && item.iconStart && (jsx("span", { className: "mr-1.5 flex-shrink-0", children: item.iconStart })), typeof item.label === 'string'
|
|
46
|
+
? jsx("span", { children: item.label })
|
|
47
|
+
: item.label] }));
|
|
48
|
+
return (jsx("span", { className: "flex items-center text-base", children: isCurrentPage ? (jsx("span", { className: cn("flex items-center", theme.current), "aria-current": "page", children: itemContent })) : (jsx("a", { href: item.href, className: cn("flex items-center", theme.link), "aria-label": typeof item.label === 'string' ? `Navigate to ${item.label}` : undefined, children: itemContent })) }, `breadcrumb-${index}`));
|
|
47
49
|
};
|
|
48
50
|
// Render separator
|
|
49
51
|
const renderSeparator = (index) => {
|
|
@@ -60,7 +62,9 @@ const Breadcrumbs = ({ items, separator, maxItems = 4, variant = "default", clas
|
|
|
60
62
|
window.location.href = selectedItem.href;
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
|
-
return (jsxs(Dropdown, { isOpen: isEllipsisOpen, onOpenChange: setIsEllipsisOpen, onAction: handleEllipsisAction, placement: "bottom-start", offset: 8, children: [jsx(Dropdown.Trigger, { children: jsx("button", { type: "button", className: cn(theme.ellipsis), "aria-label": `Navigate to one of ${hiddenItems.length} hidden breadcrumbs`, children: "..." }) }), jsx(Dropdown.Menu, { "aria-label": "Hidden breadcrumb items", children: hiddenItems.map((item, index) => (jsx(Dropdown.Item, { itemKey: `hidden-${index}`, startContent: showIcons && item.iconStart, children: item.label
|
|
65
|
+
return (jsxs(Dropdown, { isOpen: isEllipsisOpen, onOpenChange: setIsEllipsisOpen, onAction: handleEllipsisAction, placement: "bottom-start", offset: 8, children: [jsx(Dropdown.Trigger, { children: jsx("button", { type: "button", className: cn(theme.ellipsis), "aria-label": `Navigate to one of ${hiddenItems.length} hidden breadcrumbs`, children: "..." }) }), jsx(Dropdown.Menu, { "aria-label": "Hidden breadcrumb items", children: hiddenItems.map((item, index) => (jsx(Dropdown.Item, { itemKey: `hidden-${index}`, startContent: showIcons && item.iconStart, children: typeof item.label === 'string'
|
|
66
|
+
? jsx("span", { children: item.label })
|
|
67
|
+
: item.label }, `hidden-${index}`))) })] }, "ellipsis"));
|
|
64
68
|
};
|
|
65
69
|
// Build the breadcrumb elements
|
|
66
70
|
const breadcrumbElements = [];
|
|
@@ -4,7 +4,7 @@ import React from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface BreadcrumbItem {
|
|
6
6
|
/** The display text for the breadcrumb item */
|
|
7
|
-
label:
|
|
7
|
+
label: React.ReactNode;
|
|
8
8
|
/** Optional href for navigation. If not provided, item is treated as current page */
|
|
9
9
|
href?: string;
|
|
10
10
|
/** Optional icon to display at the start (before the label) */
|
|
@@ -59,13 +59,7 @@ const Button = React__default.forwardRef(({ children, className = "", iconOnly =
|
|
|
59
59
|
console.error("Error in button click handler:", error);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
}, [
|
|
63
|
-
onClick,
|
|
64
|
-
isDisabled,
|
|
65
|
-
enableRipple,
|
|
66
|
-
shouldReduceMotion,
|
|
67
|
-
createRipple,
|
|
68
|
-
]);
|
|
62
|
+
}, [onClick, isDisabled, enableRipple, shouldReduceMotion, createRipple]);
|
|
69
63
|
// Compute theme classes (direct computation - faster than useMemo)
|
|
70
64
|
const sizeClasses = ((_b = (_a = buttonTheme.sizes) === null || _a === void 0 ? void 0 : _a[size]) === null || _b === void 0 ? void 0 : _b[iconOnly ? "iconOnly" : resolvedVariant === "link" ? "link" : "default"]) || "";
|
|
71
65
|
const colorClasses = ((_c = buttonTheme.variantColors[resolvedVariant]) === null || _c === void 0 ? void 0 : _c[resolvedColor]) || "";
|
|
@@ -112,7 +106,7 @@ const Button = React__default.forwardRef(({ children, className = "", iconOnly =
|
|
|
112
106
|
}, [buttonRef]);
|
|
113
107
|
return (jsxs(motion.button, { ...restProps /* React drag events conflict with motion drag events */, ...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 &&
|
|
114
108
|
resolvedVariant !== "link" &&
|
|
115
|
-
resolvedVariant !== "outline" && (jsx("div", { className: "absolute top-0.25 right-0.25 left-0.25 h-3
|
|
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 &&
|
|
116
110
|
ripples.map((ripple) => {
|
|
117
111
|
const animation = getRippleAnimation(effect, ripple, rippleScale);
|
|
118
112
|
return (jsx(motion.span, { initial: animation.initial, animate: animation.animate, transition: animation.transition, className: cn("absolute rounded-full size-5 pointer-events-none ", animation.className, rippleClassName ||
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const buttonTheme = {
|
|
5
5
|
// Base styles for the button element
|
|
6
|
-
baseStyle: "relative inline-flex items-center justify-center gap-2
|
|
6
|
+
baseStyle: "relative inline-flex items-center justify-center gap-2 focus:outline-none rounded-[var(--button-radius)] overflow-hidden cursor-pointer transition-all duration-300 ease-in-out min-w-fit flex-shrink-0 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 cursor-pointer",
|
|
7
7
|
// Visual style variants - STRUCTURE only (no colors)
|
|
8
8
|
variantStyles: {
|
|
9
9
|
filled: "border hover:brightness-[0.9] dark:hover:brightness-[1.15]",
|
|
@@ -124,19 +124,19 @@ const buttonTheme = {
|
|
|
124
124
|
// Size variants
|
|
125
125
|
sizes: {
|
|
126
126
|
sm: {
|
|
127
|
-
default: "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-sm",
|
|
128
128
|
iconOnly: "size-[var(--button-icon-size-sm)] p-[var(--button-icon-p-sm)]",
|
|
129
|
-
link: "p-0 text-
|
|
129
|
+
link: "font-semibold p-0 text-sm h-fit",
|
|
130
130
|
},
|
|
131
131
|
md: {
|
|
132
|
-
default: "min-h-[var(--button-min-h-md)] px-[var(--button-px-md)] py-[var(--button-py-md)] text-base",
|
|
132
|
+
default: "font-semibold min-h-[var(--button-min-h-md)] px-[var(--button-px-md)] py-[var(--button-py-md)] text-base",
|
|
133
133
|
iconOnly: "size-[var(--button-icon-size-md)] p-[var(--button-icon-p-md)]",
|
|
134
|
-
link: "p-0 text-base h-fit",
|
|
134
|
+
link: "font-semibold p-0 text-base h-fit",
|
|
135
135
|
},
|
|
136
136
|
lg: {
|
|
137
|
-
default: "min-h-[var(--button-min-h-lg)] px-[var(--button-px-lg)] py-[var(--button-py-lg)] text-lg",
|
|
137
|
+
default: "font-semibold min-h-[var(--button-min-h-lg)] px-[var(--button-px-lg)] py-[var(--button-py-lg)] text-lg",
|
|
138
138
|
iconOnly: "size-[var(--button-icon-size-lg)] p-[var(--button-icon-p-lg)]",
|
|
139
|
-
link: "p-0 text-lg h-fit",
|
|
139
|
+
link: "font-semibold p-0 text-lg h-fit",
|
|
140
140
|
},
|
|
141
141
|
},
|
|
142
142
|
// State styles
|
|
@@ -224,8 +224,8 @@ const Calendar = React__default.forwardRef(({ mode = 'single', value, defaultVal
|
|
|
224
224
|
// Generate year options - filter based on minDate/maxDate
|
|
225
225
|
const currentDate = new Date();
|
|
226
226
|
const defaultYearRange = {
|
|
227
|
-
start: currentDate.getFullYear() -
|
|
228
|
-
end: currentDate.getFullYear()
|
|
227
|
+
start: currentDate.getFullYear() - 100,
|
|
228
|
+
end: currentDate.getFullYear(),
|
|
229
229
|
};
|
|
230
230
|
const actualYearRange = yearRange || defaultYearRange;
|
|
231
231
|
const yearOptions = useMemo(() => {
|
|
@@ -239,7 +239,7 @@ const Calendar = React__default.forwardRef(({ mode = 'single', value, defaultVal
|
|
|
239
239
|
endYear = Math.min(endYear, maxDate.getFullYear());
|
|
240
240
|
}
|
|
241
241
|
const options = [];
|
|
242
|
-
for (let year =
|
|
242
|
+
for (let year = endYear; year >= startYear; year--) {
|
|
243
243
|
options.push({
|
|
244
244
|
id: year,
|
|
245
245
|
value: year.toString(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HTMLAttributes } from
|
|
2
|
-
import { CalendarEventThemeOverrides } from
|
|
3
|
-
import { CalendarEvent as CalendarEventType, GridConfig, EventPosition } from
|
|
4
|
-
export type CalendarEventVariant =
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
import { CalendarEventThemeOverrides } from "./CalendarEvent.theme";
|
|
3
|
+
import { CalendarEvent as CalendarEventType, GridConfig, EventPosition } from "../../../../utils";
|
|
4
|
+
export type CalendarEventVariant = "daily" | "weekly" | "monthly";
|
|
5
5
|
export interface CalendarEventProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
variant?: CalendarEventVariant;
|
|
7
7
|
event: CalendarEventType & {
|
|
@@ -9,7 +9,6 @@ export interface CalendarEventProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
attendees?: Array<{
|
|
10
10
|
name: string;
|
|
11
11
|
src: string;
|
|
12
|
-
alt: string;
|
|
13
12
|
showTooltip?: boolean;
|
|
14
13
|
}>;
|
|
15
14
|
};
|
|
@@ -20,5 +19,5 @@ export interface CalendarEventProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
20
19
|
gridInterval?: number;
|
|
21
20
|
startOffset?: number;
|
|
22
21
|
theme?: CalendarEventThemeOverrides;
|
|
23
|
-
onEventClick?: (eventData: CalendarEventProps[
|
|
22
|
+
onEventClick?: (eventData: CalendarEventProps["event"]) => void;
|
|
24
23
|
}
|
|
@@ -2,7 +2,7 @@ import { CardComponent } from './Card.types';
|
|
|
2
2
|
import { CardHeader } from './CardHeader';
|
|
3
3
|
import { CardTitle } from './CardTitle';
|
|
4
4
|
import { CardSubtitle } from './CardSubtitle';
|
|
5
|
-
import {
|
|
5
|
+
import { CardBody } from './CardBody';
|
|
6
6
|
import { CardFooter } from './CardFooter';
|
|
7
|
-
export { CardHeader, CardTitle, CardSubtitle,
|
|
7
|
+
export { CardHeader, CardTitle, CardSubtitle, CardBody, CardFooter };
|
|
8
8
|
export declare const Card: CardComponent;
|
|
@@ -5,7 +5,7 @@ import { cardTheme } from './Card.theme.js';
|
|
|
5
5
|
import { CardHeader } from './CardHeader.js';
|
|
6
6
|
import { CardTitle } from './CardTitle.js';
|
|
7
7
|
import { CardSubtitle } from './CardSubtitle.js';
|
|
8
|
-
import {
|
|
8
|
+
import { CardBody } from './CardBody.js';
|
|
9
9
|
import { CardFooter } from './CardFooter.js';
|
|
10
10
|
|
|
11
11
|
const CardRoot = React__default.forwardRef(({ children, className, theme: customTheme = {}, darkMode = false, ...props }, ref) => {
|
|
@@ -21,8 +21,8 @@ const Card = Object.assign(CardRoot, {
|
|
|
21
21
|
Header: CardHeader,
|
|
22
22
|
Title: CardTitle,
|
|
23
23
|
Subtitle: CardSubtitle,
|
|
24
|
-
|
|
24
|
+
Body: CardBody,
|
|
25
25
|
Footer: CardFooter,
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
export { Card,
|
|
28
|
+
export { Card, CardBody, CardFooter, CardHeader, CardSubtitle, CardTitle };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const cardTheme = {
|
|
2
2
|
baseStyle: "rounded-[var(--card-radius)] overflow-hidden bg-white border border-[var(--color-border)] shadow-xs dark:bg-[var(--color-background-secondary)]",
|
|
3
|
-
headerStyle: "flex flex-col
|
|
3
|
+
headerStyle: "flex flex-col p-6",
|
|
4
4
|
titleStyle: "text-lg font-semibold leading-none text-[var(--color-text-primary)]",
|
|
5
|
-
subtitleStyle: "text-
|
|
6
|
-
|
|
5
|
+
subtitleStyle: "text-base text-[var(--color-text-muted)] mt-1.5",
|
|
6
|
+
bodyStyle: "p-6 pt-0",
|
|
7
7
|
footerStyle: "flex items-center p-6 pt-0",
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -4,7 +4,7 @@ export interface CardTheme {
|
|
|
4
4
|
headerStyle: string;
|
|
5
5
|
titleStyle: string;
|
|
6
6
|
subtitleStyle: string;
|
|
7
|
-
|
|
7
|
+
bodyStyle: string;
|
|
8
8
|
footerStyle: string;
|
|
9
9
|
}
|
|
10
10
|
export interface CardThemeOverrides {
|
|
@@ -12,7 +12,7 @@ export interface CardThemeOverrides {
|
|
|
12
12
|
headerStyle?: string;
|
|
13
13
|
titleStyle?: string;
|
|
14
14
|
subtitleStyle?: string;
|
|
15
|
-
|
|
15
|
+
bodyStyle?: string;
|
|
16
16
|
footerStyle?: string;
|
|
17
17
|
}
|
|
18
18
|
export interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -41,13 +41,13 @@ export interface CardComponent extends ForwardRefExoticComponent<CardProps & Ref
|
|
|
41
41
|
Header: ForwardRefExoticComponent<CardHeaderProps & RefAttributes<HTMLDivElement>>;
|
|
42
42
|
Title: ForwardRefExoticComponent<CardTitleProps & RefAttributes<HTMLDivElement>>;
|
|
43
43
|
Subtitle: ForwardRefExoticComponent<CardSubtitleProps & RefAttributes<HTMLDivElement>>;
|
|
44
|
-
|
|
44
|
+
Body: ForwardRefExoticComponent<CardBodyProps & RefAttributes<HTMLDivElement>>;
|
|
45
45
|
Footer: ForwardRefExoticComponent<CardFooterProps & RefAttributes<HTMLDivElement>>;
|
|
46
46
|
}
|
|
47
47
|
export interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
48
48
|
className?: string;
|
|
49
49
|
}
|
|
50
|
-
export interface
|
|
50
|
+
export interface CardBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
51
51
|
className?: string;
|
|
52
52
|
}
|
|
53
53
|
export interface CardFooterProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { cardTheme } from './Card.theme.js';
|
|
5
|
+
|
|
6
|
+
const CardBody = React__default.forwardRef(({ children, className, ...props }, ref) => {
|
|
7
|
+
return (jsx("div", { ref: ref, className: cn(cardTheme.bodyStyle, className), ...props, children: children }));
|
|
8
|
+
});
|
|
9
|
+
CardBody.displayName = 'Card.Body';
|
|
10
|
+
|
|
11
|
+
export { CardBody };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Card, CardHeader, CardTitle, CardSubtitle,
|
|
2
|
-
export type { CardProps, CardHeaderProps, CardTitleProps, CardSubtitleProps,
|
|
1
|
+
export { Card, CardHeader, CardTitle, CardSubtitle, CardBody, CardFooter } from './Card';
|
|
2
|
+
export type { CardProps, CardHeaderProps, CardTitleProps, CardSubtitleProps, CardBodyProps, CardFooterProps, CardTheme, CardThemeOverrides } from './Card.types';
|
|
@@ -3,18 +3,18 @@ import React__default, { useState, useEffect, useCallback, useMemo } from 'react
|
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
4
|
import { carouselTheme } from './Carousel.theme.js';
|
|
5
5
|
import { CarouselContext } from './CarouselContext.js';
|
|
6
|
-
import {
|
|
6
|
+
import { CarouselBody } from './CarouselBody.js';
|
|
7
7
|
import { CarouselItem } from './CarouselItem.js';
|
|
8
8
|
import { CarouselPrevious } from './CarouselPrevious.js';
|
|
9
9
|
import { CarouselNext } from './CarouselNext.js';
|
|
10
10
|
|
|
11
11
|
const CarouselRoot = React__default.forwardRef(({ orientation = 'horizontal', opts = {}, showControls = false, defaultIndex = 0, onSlideChange, className, children, ...rest }, ref) => {
|
|
12
12
|
const { align = 'start', loop = false, slidesToScroll = 1, draggable = true, dragThreshold = 0.1, } = opts;
|
|
13
|
-
// Count total slides by looking for
|
|
13
|
+
// Count total slides by looking for CarouselBody and its CarouselItem children
|
|
14
14
|
const totalSlides = React__default.useMemo(() => {
|
|
15
15
|
let count = 0;
|
|
16
16
|
React__default.Children.forEach(children, (child) => {
|
|
17
|
-
if (React__default.isValidElement(child) && child.type ===
|
|
17
|
+
if (React__default.isValidElement(child) && child.type === CarouselBody) {
|
|
18
18
|
const contentProps = child.props;
|
|
19
19
|
count = React__default.Children.count(contentProps.children);
|
|
20
20
|
}
|
|
@@ -73,7 +73,7 @@ const CarouselRoot = React__default.forwardRef(({ orientation = 'horizontal', op
|
|
|
73
73
|
CarouselRoot.displayName = 'Carousel';
|
|
74
74
|
// Create compound component with sub-components
|
|
75
75
|
const Carousel = Object.assign(CarouselRoot, {
|
|
76
|
-
|
|
76
|
+
Body: CarouselBody,
|
|
77
77
|
Item: CarouselItem,
|
|
78
78
|
Previous: CarouselPrevious,
|
|
79
79
|
Next: CarouselNext,
|
|
@@ -67,13 +67,13 @@ export interface CarouselProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
67
67
|
*/
|
|
68
68
|
className?: string;
|
|
69
69
|
/**
|
|
70
|
-
* Children components (
|
|
70
|
+
* Children components (CarouselBody, CarouselPrevious, CarouselNext)
|
|
71
71
|
*/
|
|
72
72
|
children?: ReactNode;
|
|
73
73
|
}
|
|
74
|
-
export interface
|
|
74
|
+
export interface CarouselBodyProps extends HTMLAttributes<HTMLDivElement> {
|
|
75
75
|
/**
|
|
76
|
-
* Custom class name for the
|
|
76
|
+
* Custom class name for the body container
|
|
77
77
|
*/
|
|
78
78
|
className?: string;
|
|
79
79
|
/**
|
|
@@ -106,7 +106,7 @@ export interface CarouselControlProps extends HTMLAttributes<HTMLButtonElement>
|
|
|
106
106
|
'aria-label'?: string;
|
|
107
107
|
}
|
|
108
108
|
export interface CarouselComponent extends ForwardRefExoticComponent<CarouselProps & RefAttributes<HTMLDivElement>> {
|
|
109
|
-
|
|
109
|
+
Body: ForwardRefExoticComponent<CarouselBodyProps & RefAttributes<HTMLDivElement>>;
|
|
110
110
|
Item: ForwardRefExoticComponent<CarouselItemProps & RefAttributes<HTMLDivElement>>;
|
|
111
111
|
Previous: ForwardRefExoticComponent<CarouselControlProps & RefAttributes<HTMLButtonElement>>;
|
|
112
112
|
Next: ForwardRefExoticComponent<CarouselControlProps & RefAttributes<HTMLButtonElement>>;
|
|
@@ -5,7 +5,7 @@ import { cn } from '../../../utils/cn.js';
|
|
|
5
5
|
import { useCarouselContext } from './CarouselContext.js';
|
|
6
6
|
import { carouselTheme } from './Carousel.theme.js';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const CarouselBody = React__default.forwardRef(({ className, children, ...props }, ref) => {
|
|
9
9
|
const { currentIndex, orientation, opts, scrollPrev, scrollNext } = useCarouselContext();
|
|
10
10
|
const shouldReduceMotion = useReducedMotion();
|
|
11
11
|
const internalRef = React__default.useRef(null);
|
|
@@ -47,6 +47,6 @@ const CarouselContent = React__default.forwardRef(({ className, children, ...pro
|
|
|
47
47
|
});
|
|
48
48
|
}) }) }));
|
|
49
49
|
});
|
|
50
|
-
|
|
50
|
+
CarouselBody.displayName = 'Carousel.Body';
|
|
51
51
|
|
|
52
|
-
export {
|
|
52
|
+
export { CarouselBody };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { Carousel } from './Carousel';
|
|
2
|
-
export
|
|
2
|
+
export { CarouselBody } from './CarouselBody';
|
|
3
|
+
export type { CarouselProps, CarouselBodyProps, CarouselItemProps, CarouselControlProps, CarouselOptions, CarouselOrientation, } from './Carousel.types';
|
|
@@ -5,11 +5,11 @@ export declare const ContextMenu: {
|
|
|
5
5
|
displayName: string;
|
|
6
6
|
} & {
|
|
7
7
|
Trigger: React.ForwardRefExoticComponent<import("./ContextMenu.types").ContextMenuTriggerProps & React.RefAttributes<HTMLElement>>;
|
|
8
|
-
|
|
8
|
+
Body: React.ForwardRefExoticComponent<import("./ContextMenu.types").ContextMenuBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
9
|
Item: React.ForwardRefExoticComponent<import("./ContextMenu.types").ContextMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
Sub: React.FC<import("./ContextMenu.types").ContextMenuSubProps>;
|
|
11
11
|
SubTrigger: React.ForwardRefExoticComponent<import("./ContextMenu.types").ContextMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
|
|
12
|
+
SubBody: React.ForwardRefExoticComponent<import("./ContextMenu.types").ContextMenuSubBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
13
|
Separator: React.ForwardRefExoticComponent<import("./ContextMenu.types").ContextMenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
14
|
Label: React.ForwardRefExoticComponent<import("./ContextMenu.types").ContextMenuLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
15
|
};
|