@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
|
@@ -3,11 +3,11 @@ import { useState, useRef, useCallback, useEffect } from 'react';
|
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
4
|
import { ContextMenuContext } from './ContextMenuContext.js';
|
|
5
5
|
import { ContextMenuTrigger } from './ContextMenuTrigger.js';
|
|
6
|
-
import {
|
|
6
|
+
import { ContextMenuBody } from './ContextMenuBody.js';
|
|
7
7
|
import { ContextMenuItem } from './ContextMenuItem.js';
|
|
8
8
|
import { ContextMenuSub } from './ContextMenuSub.js';
|
|
9
9
|
import { ContextMenuSubTrigger } from './ContextMenuSubTrigger.js';
|
|
10
|
-
import {
|
|
10
|
+
import { ContextMenuSubBody } from './ContextMenuSubBody.js';
|
|
11
11
|
import { ContextMenuSeparator } from './ContextMenuSeparator.js';
|
|
12
12
|
import { ContextMenuLabel } from './ContextMenuLabel.js';
|
|
13
13
|
import { contextMenuTheme } from './ContextMenu.theme.js';
|
|
@@ -22,11 +22,11 @@ import { contextMenuTheme } from './ContextMenu.theme.js';
|
|
|
22
22
|
* <ContextMenu.Trigger>
|
|
23
23
|
* <div>Right click here</div>
|
|
24
24
|
* </ContextMenu.Trigger>
|
|
25
|
-
* <ContextMenu.
|
|
25
|
+
* <ContextMenu.Body>
|
|
26
26
|
* <ContextMenu.Item shortcut="⌘R">Reload</ContextMenu.Item>
|
|
27
27
|
* <ContextMenu.Separator />
|
|
28
28
|
* <ContextMenu.Item checked={true}>Show Bookmarks</ContextMenu.Item>
|
|
29
|
-
* </ContextMenu.
|
|
29
|
+
* </ContextMenu.Body>
|
|
30
30
|
* </ContextMenu>
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
@@ -78,11 +78,11 @@ ContextMenuRoot.displayName = "ContextMenu";
|
|
|
78
78
|
// Export as a unified component with sub-components
|
|
79
79
|
const ContextMenu = Object.assign(ContextMenuRoot, {
|
|
80
80
|
Trigger: ContextMenuTrigger,
|
|
81
|
-
|
|
81
|
+
Body: ContextMenuBody,
|
|
82
82
|
Item: ContextMenuItem,
|
|
83
83
|
Sub: ContextMenuSub,
|
|
84
84
|
SubTrigger: ContextMenuSubTrigger,
|
|
85
|
-
|
|
85
|
+
SubBody: ContextMenuSubBody,
|
|
86
86
|
Separator: ContextMenuSeparator,
|
|
87
87
|
Label: ContextMenuLabel,
|
|
88
88
|
});
|
|
@@ -26,7 +26,7 @@ export interface ContextMenuTriggerProps {
|
|
|
26
26
|
className?: string;
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
}
|
|
29
|
-
export interface
|
|
29
|
+
export interface ContextMenuBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
30
30
|
children: ReactNode;
|
|
31
31
|
className?: string;
|
|
32
32
|
animation?: boolean;
|
|
@@ -53,7 +53,7 @@ export interface ContextMenuSubTriggerProps extends React.HTMLAttributes<HTMLDiv
|
|
|
53
53
|
className?: string;
|
|
54
54
|
disabled?: boolean;
|
|
55
55
|
}
|
|
56
|
-
export interface
|
|
56
|
+
export interface ContextMenuSubBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
57
57
|
children: ReactNode;
|
|
58
58
|
className?: string;
|
|
59
59
|
animation?: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ContextMenuBodyProps } from "./ContextMenu.types";
|
|
3
|
+
/**
|
|
4
|
+
* ContextMenuBody - Renders the menu at cursor position with keyboard navigation
|
|
5
|
+
*/
|
|
6
|
+
export declare const ContextMenuBody: React.ForwardRefExoticComponent<ContextMenuBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -7,9 +7,9 @@ import { useContextMenuContext } from './ContextMenuContext.js';
|
|
|
7
7
|
import { useIsClient } from '../../../hooks/useIsClient.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* ContextMenuBody - Renders the menu at cursor position with keyboard navigation
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
12
|
+
const ContextMenuBody = React__default.forwardRef(({ children, className, animation = true, "aria-label": ariaLabel, ...props }, ref) => {
|
|
13
13
|
const { isOpen, onOpenChange, cursorPosition, contentRef, triggerRef, theme, } = useContextMenuContext();
|
|
14
14
|
const shouldReduceMotion = useReducedMotion();
|
|
15
15
|
const isClient = useIsClient();
|
|
@@ -192,6 +192,6 @@ const ContextMenuContent = React__default.forwardRef(({ children, className, ani
|
|
|
192
192
|
? createPortal(menuContent, document.body)
|
|
193
193
|
: null;
|
|
194
194
|
});
|
|
195
|
-
|
|
195
|
+
ContextMenuBody.displayName = "ContextMenu.Body";
|
|
196
196
|
|
|
197
|
-
export {
|
|
197
|
+
export { ContextMenuBody };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ContextMenuSubBodyProps } from "./ContextMenu.types";
|
|
3
|
+
/**
|
|
4
|
+
* ContextMenuSubBody - Submenu content positioned to the right of trigger
|
|
5
|
+
*/
|
|
6
|
+
export declare const ContextMenuSubBody: React.ForwardRefExoticComponent<ContextMenuSubBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -7,9 +7,9 @@ import { useContextMenuContext, useSubMenuContext } from './ContextMenuContext.j
|
|
|
7
7
|
import { useIsClient } from '../../../hooks/useIsClient.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* ContextMenuSubBody - Submenu content positioned to the right of trigger
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
12
|
+
const ContextMenuSubBody = React__default.forwardRef(({ children, className, animation = true, ...props }, ref) => {
|
|
13
13
|
const { theme } = useContextMenuContext();
|
|
14
14
|
const { isOpen, triggerRef, onOpenChange } = useSubMenuContext();
|
|
15
15
|
const shouldReduceMotion = useReducedMotion();
|
|
@@ -101,6 +101,6 @@ const ContextMenuSubContent = React__default.forwardRef(({ children, className,
|
|
|
101
101
|
? createPortal(submenuContent, document.body)
|
|
102
102
|
: null;
|
|
103
103
|
});
|
|
104
|
-
|
|
104
|
+
ContextMenuSubBody.displayName = "ContextMenu.SubBody";
|
|
105
105
|
|
|
106
|
-
export {
|
|
106
|
+
export { ContextMenuSubBody };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ContextMenu } from "./ContextMenu";
|
|
2
|
-
export type { ContextMenuProps, ContextMenuTriggerProps,
|
|
2
|
+
export type { ContextMenuProps, ContextMenuTriggerProps, ContextMenuBodyProps, ContextMenuItemProps, ContextMenuSubProps, ContextMenuSubTriggerProps, ContextMenuSubBodyProps, ContextMenuSeparatorProps, ContextMenuLabelProps, ContextMenuThemeOverrides, } from "./ContextMenu.types";
|
|
3
3
|
export type { ContextMenuTheme } from "./ContextMenu.theme";
|
|
4
4
|
export { contextMenuTheme } from "./ContextMenu.theme";
|
|
@@ -16,8 +16,8 @@ export declare const Drawer: {
|
|
|
16
16
|
({ children, className, ...props }: import("./Drawer.types").DrawerSubtitleProps): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
displayName: string;
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
({ children, className, ...props }: import("./Drawer.types").
|
|
19
|
+
Body: {
|
|
20
|
+
({ children, className, ...props }: import("./Drawer.types").DrawerBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
displayName: string;
|
|
22
22
|
};
|
|
23
23
|
Footer: {
|
|
@@ -8,7 +8,7 @@ import { drawerOverlayAnimations, getDrawerContentAnimations } from './Drawer.an
|
|
|
8
8
|
import { DrawerHeader } from './DrawerHeader.js';
|
|
9
9
|
import { DrawerTitle } from './DrawerTitle.js';
|
|
10
10
|
import { DrawerSubtitle } from './DrawerSubtitle.js';
|
|
11
|
-
import {
|
|
11
|
+
import { DrawerBody } from './DrawerBody.js';
|
|
12
12
|
import { DrawerFooter } from './DrawerFooter.js';
|
|
13
13
|
|
|
14
14
|
// Create context for Drawer components
|
|
@@ -43,7 +43,18 @@ const DrawerRoot = ({ isOpen, onClose, title, subtitle, icon, position = "right"
|
|
|
43
43
|
theme,
|
|
44
44
|
titleId,
|
|
45
45
|
subtitleId,
|
|
46
|
-
}), [
|
|
46
|
+
}), [
|
|
47
|
+
isOpen,
|
|
48
|
+
onClose,
|
|
49
|
+
position,
|
|
50
|
+
size,
|
|
51
|
+
closeOnOverlayClick,
|
|
52
|
+
closeOnEsc,
|
|
53
|
+
showCloseButton,
|
|
54
|
+
theme,
|
|
55
|
+
titleId,
|
|
56
|
+
subtitleId,
|
|
57
|
+
]);
|
|
47
58
|
// Detect if children contain a compound Drawer.Header
|
|
48
59
|
const hasCompoundHeader = React__default.Children.toArray(children).some((child) => {
|
|
49
60
|
var _a;
|
|
@@ -52,19 +63,27 @@ const DrawerRoot = ({ isOpen, onClose, title, subtitle, icon, position = "right"
|
|
|
52
63
|
});
|
|
53
64
|
// Auto-generate header when using prop shorthand (backward compat)
|
|
54
65
|
const shouldAutoRenderHeader = !hasCompoundHeader && (title || showCloseButton);
|
|
55
|
-
//
|
|
66
|
+
// Detect whether size is a preset token or an arbitrary Tailwind class
|
|
67
|
+
const SIZE_TOKENS = ["sm", "md", "lg", "full"];
|
|
68
|
+
const isSizeToken = SIZE_TOKENS.includes(size);
|
|
69
|
+
// Get size variant based on position (only for preset tokens)
|
|
56
70
|
const isHorizontal = position === "left" || position === "right";
|
|
57
|
-
const sizeVariant =
|
|
58
|
-
?
|
|
59
|
-
|
|
71
|
+
const sizeVariant = isSizeToken
|
|
72
|
+
? isHorizontal
|
|
73
|
+
? drawerSizeVariants.horizontal[size]
|
|
74
|
+
: drawerSizeVariants.vertical[size]
|
|
75
|
+
: size; // treat arbitrary string as a raw Tailwind class
|
|
60
76
|
// Use different positioning for full-width/height drawers
|
|
61
77
|
const positionVariant = size === "full"
|
|
62
78
|
? drawerPositionVariantsFullWidth[position]
|
|
63
79
|
: drawerPositionVariantsWithMargin[position];
|
|
64
|
-
return (jsx(Overlay, { isOpen: isOpen, onClose: onClose, closeOnOverlayClick: closeOnOverlayClick, closeOnEsc: closeOnEsc, position: "none", role: "dialog", ariaModal: true, ariaLabelledBy: titleId, ariaDescribedBy: subtitleId, contentClassName: cn(theme.container, positionVariant, size !== "full" && sizeVariant,
|
|
80
|
+
return (jsx(Overlay, { isOpen: isOpen, onClose: onClose, closeOnOverlayClick: closeOnOverlayClick, closeOnEsc: closeOnEsc, position: "none", role: "dialog", ariaModal: true, ariaLabelledBy: titleId, ariaDescribedBy: subtitleId, contentClassName: cn(theme.container, positionVariant, isSizeToken && size !== "full" && sizeVariant, !isSizeToken && sizeVariant, // raw Tailwind class
|
|
81
|
+
className), animations: {
|
|
65
82
|
overlay: drawerOverlayAnimations,
|
|
66
83
|
content: getDrawerContentAnimations(position),
|
|
67
|
-
}, ...props, children: jsx(DrawerContext.Provider, { value: contextValue, children: jsxs("div", { className: theme.inner, children: [shouldAutoRenderHeader && (jsxs(DrawerHeader, { icon: icon, children: [title &&
|
|
84
|
+
}, ...props, children: jsx(DrawerContext.Provider, { value: contextValue, children: jsxs("div", { className: theme.inner, children: [shouldAutoRenderHeader && (jsxs(DrawerHeader, { icon: icon, children: [title &&
|
|
85
|
+
(typeof title === "string" ? (jsx(DrawerTitle, { children: title })) : (title)), subtitle &&
|
|
86
|
+
(typeof subtitle === "string" ? (jsx(DrawerSubtitle, { children: subtitle })) : (subtitle))] })), children] }) }) }));
|
|
68
87
|
};
|
|
69
88
|
DrawerRoot.displayName = "Drawer";
|
|
70
89
|
// Attach compound subcomponents
|
|
@@ -72,7 +91,7 @@ const Drawer = Object.assign(DrawerRoot, {
|
|
|
72
91
|
Header: DrawerHeader,
|
|
73
92
|
Title: DrawerTitle,
|
|
74
93
|
Subtitle: DrawerSubtitle,
|
|
75
|
-
|
|
94
|
+
Body: DrawerBody,
|
|
76
95
|
Footer: DrawerFooter,
|
|
77
96
|
});
|
|
78
97
|
|
|
@@ -10,7 +10,7 @@ const drawerTheme = {
|
|
|
10
10
|
headerContent: "flex items-start gap-3 flex-1 min-w-0",
|
|
11
11
|
title: "text-lg font-semibold leading-6 text-[var(--color-text-primary)]",
|
|
12
12
|
subtitle: "text-base text-[var(--color-text-secondary)] mt-0.5",
|
|
13
|
-
|
|
13
|
+
body: "flex-1 overflow-y-auto p-4",
|
|
14
14
|
footer: "flex items-center justify-end gap-3 p-4 border-t border-[var(--color-border)] shrink-0 " +
|
|
15
15
|
"dark:border-[var(--color-border)]",
|
|
16
16
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export type DrawerPosition = "left" | "right" | "top" | "bottom";
|
|
3
|
-
export type
|
|
3
|
+
export type DrawerSizeToken = "sm" | "md" | "lg" | "full";
|
|
4
|
+
/** Preset size token or any arbitrary Tailwind width/height class, e.g. `"w-80"`, `"w-[50vw]"` */
|
|
5
|
+
export type DrawerSize = DrawerSizeToken | (string & {});
|
|
4
6
|
export interface DrawerTheme {
|
|
5
7
|
overlay: string;
|
|
6
8
|
container: string;
|
|
@@ -9,7 +11,7 @@ export interface DrawerTheme {
|
|
|
9
11
|
headerContent: string;
|
|
10
12
|
title: string;
|
|
11
13
|
subtitle: string;
|
|
12
|
-
|
|
14
|
+
body: string;
|
|
13
15
|
footer: string;
|
|
14
16
|
}
|
|
15
17
|
export interface DrawerThemeOverrides {
|
|
@@ -20,7 +22,7 @@ export interface DrawerThemeOverrides {
|
|
|
20
22
|
headerContent?: string;
|
|
21
23
|
title?: string;
|
|
22
24
|
subtitle?: string;
|
|
23
|
-
|
|
25
|
+
body?: string;
|
|
24
26
|
footer?: string;
|
|
25
27
|
}
|
|
26
28
|
export interface DrawerContextValue {
|
|
@@ -39,9 +41,9 @@ export interface DrawerProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
39
41
|
isOpen: boolean;
|
|
40
42
|
onClose: () => void;
|
|
41
43
|
/** Title text displayed in the drawer header */
|
|
42
|
-
title?:
|
|
44
|
+
title?: React.ReactNode;
|
|
43
45
|
/** Subtitle text displayed below the title */
|
|
44
|
-
subtitle?:
|
|
46
|
+
subtitle?: React.ReactNode;
|
|
45
47
|
/** Icon displayed to the left of the title/description */
|
|
46
48
|
icon?: React.ReactNode;
|
|
47
49
|
position?: DrawerPosition;
|
|
@@ -75,7 +77,7 @@ export interface DrawerSubtitleProps extends React.HTMLAttributes<HTMLParagraphE
|
|
|
75
77
|
children: React.ReactNode;
|
|
76
78
|
className?: string;
|
|
77
79
|
}
|
|
78
|
-
export interface
|
|
80
|
+
export interface DrawerBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
79
81
|
children: React.ReactNode;
|
|
80
82
|
className?: string;
|
|
81
83
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cn } from '../../../utils/cn.js';
|
|
3
|
+
import { useDrawerContext } from './Drawer.js';
|
|
4
|
+
|
|
5
|
+
const DrawerBody = ({ children, className, ...props }) => {
|
|
6
|
+
const { theme } = useDrawerContext();
|
|
7
|
+
return (jsx("div", { className: cn(theme.body, className), ...props, children: children }));
|
|
8
|
+
};
|
|
9
|
+
DrawerBody.displayName = "Drawer.Body";
|
|
10
|
+
|
|
11
|
+
export { DrawerBody };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { Drawer } from "./Drawer";
|
|
2
|
-
export
|
|
2
|
+
export { DrawerBody } from "./DrawerBody";
|
|
3
|
+
export type { DrawerProps, DrawerPosition, DrawerSize, DrawerThemeOverrides, DrawerHeaderProps, DrawerTitleProps, DrawerSubtitleProps, DrawerBodyProps, DrawerFooterProps, } from "./Drawer.types";
|
|
@@ -59,16 +59,16 @@ export interface DropdownItemProps extends Omit<React.HTMLAttributes<HTMLDivElem
|
|
|
59
59
|
className?: string;
|
|
60
60
|
startContent?: ReactNode;
|
|
61
61
|
endContent?: ReactNode;
|
|
62
|
-
subtitle?:
|
|
62
|
+
subtitle?: ReactNode;
|
|
63
63
|
shortcut?: ReactNode;
|
|
64
64
|
isDisabled?: boolean;
|
|
65
65
|
isDanger?: boolean;
|
|
66
66
|
onAction?: () => void;
|
|
67
67
|
}
|
|
68
|
-
export interface DropdownSectionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
68
|
+
export interface DropdownSectionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
69
69
|
children: ReactNode;
|
|
70
70
|
className?: string;
|
|
71
|
-
title?:
|
|
71
|
+
title?: ReactNode;
|
|
72
72
|
showDivider?: boolean;
|
|
73
73
|
}
|
|
74
74
|
export interface DropdownSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -8,7 +8,9 @@ import { useDropdownContext } from './DropdownContext.js';
|
|
|
8
8
|
*/
|
|
9
9
|
const DropdownSection = React__default.forwardRef(({ children, className, title, showDivider = false, ...props }, ref) => {
|
|
10
10
|
const { theme } = useDropdownContext();
|
|
11
|
-
return (jsxs(Fragment, { children: [showDivider && jsx("div", { className: theme.separatorStyle, role: "separator" }), jsxs("div", { ref: ref, role: "group", "aria-label": title, className: cn(theme.sectionStyle, className), ...props, children: [title && (
|
|
11
|
+
return (jsxs(Fragment, { children: [showDivider && jsx("div", { className: theme.separatorStyle, role: "separator" }), jsxs("div", { ref: ref, role: "group", "aria-label": typeof title === 'string' ? title : undefined, className: cn(theme.sectionStyle, className), ...props, children: [title && (typeof title === 'string'
|
|
12
|
+
? jsx("div", { className: theme.sectionTitleStyle, role: "presentation", children: title })
|
|
13
|
+
: title), children] })] }));
|
|
12
14
|
});
|
|
13
15
|
DropdownSection.displayName = "DropdownSection";
|
|
14
16
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { fileTypeIconTheme } from './FileTypeIcon.theme.js';
|
|
5
|
+
import { fileTypes } from './fileTypes.js';
|
|
6
|
+
|
|
7
|
+
const FileTypeIcon = React__default.forwardRef(({ type, size = 'md', colorMode = 'color', className, theme: customTheme, ...props }, ref) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const fileType = fileTypes[type];
|
|
10
|
+
if (!fileType) {
|
|
11
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
12
|
+
console.warn(`[FileTypeIcon]: Unknown type "${type}". Available types: ${Object.keys(fileTypes).join(', ')}`);
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const theme = {
|
|
17
|
+
...fileTypeIconTheme,
|
|
18
|
+
...customTheme,
|
|
19
|
+
sizes: { ...fileTypeIconTheme.sizes, ...customTheme === null || customTheme === void 0 ? void 0 : customTheme.sizes },
|
|
20
|
+
};
|
|
21
|
+
const resolvedSize = typeof size === 'number' ? size : (_a = theme.sizes[size]) !== null && _a !== void 0 ? _a : 24;
|
|
22
|
+
const strokeColor = colorMode === 'color' ? '#D5D7DA' : 'currentColor';
|
|
23
|
+
const strokeOpacity = colorMode === 'color' ? 1 : 0.3;
|
|
24
|
+
const badgeColor = colorMode === 'color' ? fileType.color : 'currentColor';
|
|
25
|
+
const labelText = fileType.label;
|
|
26
|
+
const badgeWidth = Math.round(labelText.length * 6 + 8);
|
|
27
|
+
const badgeX = 1;
|
|
28
|
+
const textX = badgeX + badgeWidth / 2;
|
|
29
|
+
return (jsxs("svg", { ref: ref, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 40 40", width: resolvedSize, height: resolvedSize, fill: "none", role: "img", "aria-label": `${fileType.label} file`, "data-type": type, "data-color-mode": colorMode, "data-size": size, className: cn(theme.baseStyle, className), ...props, children: [jsx("path", { d: "M11 0.75H27C27.1212 0.75 27.2375 0.798088 27.3232 0.883789L38.1162 11.6768C38.2019 11.7625 38.25 11.8788 38.25 12V36C38.25 37.7949 36.7949 39.25 35 39.25H11C9.20507 39.25 7.75 37.7949 7.75 36V4C7.75 2.20507 9.20508 0.75 11 0.75Z", stroke: strokeColor, strokeWidth: "1.5", opacity: strokeOpacity }), jsx("path", { d: "M27 0.5V8C27 10.2091 28.7909 12 31 12H38.5", stroke: strokeColor, strokeWidth: "1.5", opacity: strokeOpacity }), jsx("rect", { x: badgeX, y: 18, width: badgeWidth, height: 16, rx: 2, fill: badgeColor, opacity: colorMode === 'color' ? 1 : 0.15 }), jsx("text", { x: textX, y: 26, textAnchor: "middle", dominantBaseline: "central", fill: colorMode === 'color' ? 'white' : 'currentColor', fontSize: 9.5, fontWeight: 700, fontFamily: "Arial, Helvetica, sans-serif", letterSpacing: 0.3, children: labelText })] }));
|
|
30
|
+
});
|
|
31
|
+
FileTypeIcon.displayName = 'FileTypeIcon';
|
|
32
|
+
|
|
33
|
+
export { FileTypeIcon };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type FileTypeName = 'pdf' | 'doc' | 'docx' | 'txt' | 'xls' | 'xlsx' | 'csv' | 'ppt' | 'mp3' | 'wav' | 'mp4' | 'mov' | 'jpg' | 'png' | 'svg' | 'gif' | 'zip' | 'rar';
|
|
3
|
+
export type FileTypeIconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
export type FileTypeIconColorMode = 'color' | 'mono';
|
|
5
|
+
export interface FileTypeIconTheme {
|
|
6
|
+
baseStyle: string;
|
|
7
|
+
sizes: Record<FileTypeIconSize, number>;
|
|
8
|
+
}
|
|
9
|
+
export interface FileTypeIconThemeOverrides {
|
|
10
|
+
baseStyle?: string;
|
|
11
|
+
sizes?: Partial<Record<FileTypeIconSize, number>>;
|
|
12
|
+
}
|
|
13
|
+
export interface FileTypeIconProps extends React.SVGProps<SVGSVGElement> {
|
|
14
|
+
type: FileTypeName;
|
|
15
|
+
size?: FileTypeIconSize | number;
|
|
16
|
+
colorMode?: FileTypeIconColorMode;
|
|
17
|
+
className?: string;
|
|
18
|
+
theme?: FileTypeIconThemeOverrides;
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const fileTypes = {
|
|
2
|
+
// PDF
|
|
3
|
+
pdf: { label: 'PDF', color: '#E5252A', category: 'pdf' },
|
|
4
|
+
// Documents
|
|
5
|
+
doc: { label: 'DOC', color: '#2B7CD3', category: 'document' },
|
|
6
|
+
docx: { label: 'DOCX', color: '#2B7CD3', category: 'document' },
|
|
7
|
+
txt: { label: 'TXT', color: '#4B5563', category: 'document' },
|
|
8
|
+
// Spreadsheets
|
|
9
|
+
xls: { label: 'XLS', color: '#1D6F42', category: 'spreadsheet' },
|
|
10
|
+
xlsx: { label: 'XLSX', color: '#1D6F42', category: 'spreadsheet' },
|
|
11
|
+
csv: { label: 'CSV', color: '#1D6F42', category: 'spreadsheet' },
|
|
12
|
+
// Presentations
|
|
13
|
+
ppt: { label: 'PPT', color: '#D04423', category: 'presentation' },
|
|
14
|
+
// Audio
|
|
15
|
+
mp3: { label: 'MP3', color: '#8B5CF6', category: 'audio' },
|
|
16
|
+
wav: { label: 'WAV', color: '#8B5CF6', category: 'audio' },
|
|
17
|
+
// Video
|
|
18
|
+
mp4: { label: 'MP4', color: '#7C3AED', category: 'video' },
|
|
19
|
+
mov: { label: 'MOV', color: '#7C3AED', category: 'video' },
|
|
20
|
+
// Images
|
|
21
|
+
jpg: { label: 'JPG', color: '#F59E0B', category: 'image' },
|
|
22
|
+
png: { label: 'PNG', color: '#F59E0B', category: 'image' },
|
|
23
|
+
svg: { label: 'SVG', color: '#F59E0B', category: 'image' },
|
|
24
|
+
gif: { label: 'GIF', color: '#F59E0B', category: 'image' },
|
|
25
|
+
// Archives
|
|
26
|
+
zip: { label: 'ZIP', color: '#CA8A04', category: 'archive' },
|
|
27
|
+
rar: { label: 'RAR', color: '#CA8A04', category: 'archive' },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { fileTypes };
|
|
@@ -26,7 +26,9 @@ const MenuItem = React__default.forwardRef(({ children, className, startContent,
|
|
|
26
26
|
handleClick();
|
|
27
27
|
}
|
|
28
28
|
}, [handleClick]);
|
|
29
|
-
return (jsxs("div", { ref: ref, role: role, tabIndex: disabled ? undefined : -1, "aria-disabled": disabled, "data-focused": isFocused, "data-disabled": disabled, className: cn(theme.baseStyle, theme.focusStyle, isDanger && theme.dangerStyle, className), onClick: handleClick, onKeyDown: handleKeyDown, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), ...props, children: [startContent && (jsx("div", { className: "flex items-center justify-center flex-shrink-0", children: startContent })), jsxs("div", { className: "flex-1 min-w-0", children: [jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsx("span", { className: "truncate", children: children }), shortcut && (jsx("span", { className: "ml-auto flex-shrink-0", children: shortcut }))] }), subtitle &&
|
|
29
|
+
return (jsxs("div", { ref: ref, role: role, tabIndex: disabled ? undefined : -1, "aria-disabled": disabled, "data-focused": isFocused, "data-disabled": disabled, className: cn(theme.baseStyle, theme.focusStyle, isDanger && theme.dangerStyle, className), onClick: handleClick, onKeyDown: handleKeyDown, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), ...props, children: [startContent && (jsx("div", { className: "flex items-center justify-center flex-shrink-0", children: startContent })), jsxs("div", { className: "flex-1 min-w-0", children: [jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsx("span", { className: "truncate", children: children }), shortcut && (jsx("span", { className: "ml-auto flex-shrink-0", children: shortcut }))] }), subtitle && (typeof subtitle === 'string'
|
|
30
|
+
? jsx("div", { className: theme.subtitleStyle, children: subtitle })
|
|
31
|
+
: subtitle)] }), endContent && (jsx("div", { className: "flex items-center justify-center ml-2", children: endContent }))] }));
|
|
30
32
|
});
|
|
31
33
|
MenuItem.displayName = "MenuItem";
|
|
32
34
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const menuItemTheme = {
|
|
2
2
|
// Base item styling with hover, focus, and disabled states
|
|
3
|
-
baseStyle: "relative flex items-center gap-2 px-
|
|
3
|
+
baseStyle: "relative flex items-center gap-2 px-3 py-1.5 text-base font-[500] text-[var(--color-text-primary)] cursor-pointer outline-none select-none rounded-[var(--radius-base)] transition-colors duration-300 " +
|
|
4
4
|
"hover:bg-[var(--color-background-secondary)] focus:bg-[var(--color-background-secondary)] " +
|
|
5
5
|
"data-[focused=true]:bg-[var(--color-background-secondary)] " +
|
|
6
6
|
"data-[selected=true]:bg-[var(--color-primary)]/5 data-[selected=true]:text-[var(--color-primary)] " +
|
|
@@ -10,7 +10,7 @@ export interface MenuItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
10
10
|
/** Icon or element at the end (right side) */
|
|
11
11
|
endContent?: ReactNode;
|
|
12
12
|
/** Secondary text below the label */
|
|
13
|
-
subtitle?:
|
|
13
|
+
subtitle?: ReactNode;
|
|
14
14
|
/** Keyboard shortcut display */
|
|
15
15
|
shortcut?: ReactNode;
|
|
16
16
|
/** Whether the item is disabled */
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { MessageProps } from "./Message.types";
|
|
3
3
|
export declare const Message: React.ForwardRefExoticComponent<MessageProps & React.RefAttributes<HTMLDivElement>> & {
|
|
4
4
|
Avatar: React.ForwardRefExoticComponent<import("./MessageAvatar").MessageAvatarComponentProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
-
|
|
5
|
+
Body: React.ForwardRefExoticComponent<import("./MessageBody").MessageBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
Actions: React.ForwardRefExoticComponent<import("./MessageActions").MessageActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
7
|
Timestamp: React.ForwardRefExoticComponent<import("./MessageTimestamp").MessageTimestampProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
List: React.ForwardRefExoticComponent<import("./MessageList.types").MessageListProps & React.RefAttributes<import("..").ScrollAreaRef>>;
|
|
@@ -9,7 +9,7 @@ import { motion } from 'motion/react';
|
|
|
9
9
|
import { DocumentDuplicateIcon, ArrowPathIcon } from '@heroicons/react/24/outline';
|
|
10
10
|
import { MessageContext } from './MessageContext.js';
|
|
11
11
|
import { MessageAvatar } from './MessageAvatar.js';
|
|
12
|
-
import {
|
|
12
|
+
import { MessageBody } from './MessageBody.js';
|
|
13
13
|
import { MessageActions } from './MessageActions.js';
|
|
14
14
|
import { MessageTimestamp } from './MessageTimestamp.js';
|
|
15
15
|
import { MessageList } from './MessageList.js';
|
|
@@ -100,13 +100,13 @@ const MessageRoot = React__default.forwardRef(({ role, variant: variantProp, con
|
|
|
100
100
|
if (variant === "system") {
|
|
101
101
|
return (jsx("div", { ref: ref, className: cn("w-full max-w-full", className), "data-variant": "system", "data-role": role, ...props, children: jsxs("div", { className: containerStyle, children: [jsx("div", { className: bubbleStyle, children: typeof renderedContent === "string" ? (jsx("p", { className: "text-base", children: renderedContent })) : (renderedContent) }), jsx(MessageFooter, { isStreaming: isStreaming, streamingIndicator: streamingIndicator, showTimestamp: showTimestamp, timestamp: timestamp, actions: undefined, timestampStyle: timestampStyle, streamingIndicatorStyle: cn(messageTheme.streamingIndicatorStyle, customTheme.streamingIndicatorStyle), actionsContainerStyle: undefined, variant: "system" })] }) }));
|
|
102
102
|
}
|
|
103
|
-
return (jsx("div", { ref: ref, className: cn("w-full max-w-full group", className), "data-variant": variant, "data-role": role, ...props, children: jsxs("div", { className: containerStyle, children: [avatar && (jsx("div", { className: "flex-shrink-0", children: jsx(Avatar, { src: avatar.src,
|
|
103
|
+
return (jsx("div", { ref: ref, className: cn("w-full max-w-full group", className), "data-variant": variant, "data-role": role, ...props, children: jsxs("div", { className: containerStyle, children: [avatar && (jsx("div", { className: "flex-shrink-0", children: jsx(Avatar, { src: avatar.src, name: avatar.name, fallback: avatar.fallback, size: "xs" }) })), jsxs("div", { className: cn("flex flex-col", variant === "sender" ? "items-end" : "items-start"), children: [jsx("div", { className: bubbleStyle, children: typeof renderedContent === "string" ? (jsx("p", { className: "break-words", children: renderedContent })) : (renderedContent) }), jsx(MessageFooter, { isStreaming: isStreaming, streamingIndicator: streamingIndicator, showTimestamp: showTimestamp, timestamp: timestamp, actions: finalActions, timestampStyle: timestampStyle, streamingIndicatorStyle: cn(messageTheme.streamingIndicatorStyle, customTheme.streamingIndicatorStyle), actionsContainerStyle: cn(messageTheme.actionsContainerStyle, customTheme.actionsContainerStyle), variant: variant })] })] }) }));
|
|
104
104
|
});
|
|
105
105
|
MessageRoot.displayName = "Message";
|
|
106
106
|
// Attach compound components
|
|
107
107
|
const Message = Object.assign(MessageRoot, {
|
|
108
108
|
Avatar: MessageAvatar,
|
|
109
|
-
|
|
109
|
+
Body: MessageBody,
|
|
110
110
|
Actions: MessageActions,
|
|
111
111
|
Timestamp: MessageTimestamp,
|
|
112
112
|
List: MessageList,
|
|
@@ -6,12 +6,12 @@ const messageTheme = {
|
|
|
6
6
|
// Shared base styles (apply to all variants)
|
|
7
7
|
bubbleBaseStyle: "max-w-[80%] sm:max-w-[85%] rounded-[calc(var(--radius-base)*1.5)] px-3 py-2 w-fit min-w-fit h-fit",
|
|
8
8
|
containerBaseStyle: "flex items-start gap-3 h-fit text-base",
|
|
9
|
-
timestampStyle: "text-
|
|
9
|
+
timestampStyle: "text-xs text-[var(--color-text-placeholder)] dark:text-[var(--color-neutral-500)]",
|
|
10
10
|
// Variant-specific modifiers (only differences)
|
|
11
11
|
variants: {
|
|
12
12
|
sender: {
|
|
13
13
|
containerModifier: "flex-row-reverse", // Reverse direction for right alignment
|
|
14
|
-
bubbleStyle: "bg-[var(--color-
|
|
14
|
+
bubbleStyle: "bg-[var(--color-neutral-900)] text-[var(--color-neutral-100)] " +
|
|
15
15
|
"rounded-tr-xs " +
|
|
16
16
|
// Dark mode - slightly darker gradient for better contrast
|
|
17
17
|
" ",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* Message role types for AI conversations
|
|
4
4
|
*/
|
|
5
|
-
export type MessageRole =
|
|
5
|
+
export type MessageRole = "user" | "assistant" | "system";
|
|
6
6
|
/**
|
|
7
7
|
* Message variant types for chat UI
|
|
8
8
|
*/
|
|
9
|
-
export type MessageVariant =
|
|
9
|
+
export type MessageVariant = "sender" | "receiver" | "system";
|
|
10
10
|
/**
|
|
11
11
|
* Avatar configuration for message sender
|
|
12
12
|
*/
|
|
@@ -16,9 +16,9 @@ export interface MessageAvatarProps {
|
|
|
16
16
|
*/
|
|
17
17
|
src?: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* The name for the avatar (used for initials and alt text)
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
name: string;
|
|
22
22
|
/**
|
|
23
23
|
* Fallback content to display when image fails to load
|
|
24
24
|
*/
|
|
@@ -28,7 +28,7 @@ export interface MessageAvatarProps {
|
|
|
28
28
|
* Message component props
|
|
29
29
|
* Supports both props-based API and compound component API
|
|
30
30
|
*/
|
|
31
|
-
export interface MessageProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
31
|
+
export interface MessageProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "content"> {
|
|
32
32
|
/**
|
|
33
33
|
* The role of the message sender (AI semantic naming)
|
|
34
34
|
* Takes precedence over variant if both are provided
|
|
@@ -47,7 +47,7 @@ export interface MessageProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
47
47
|
variant?: MessageVariant;
|
|
48
48
|
/**
|
|
49
49
|
* The message content (supports rich content, markdown, etc.)
|
|
50
|
-
* Note: Optional when using compound API with Message.
|
|
50
|
+
* Note: Optional when using compound API with Message.Body
|
|
51
51
|
*/
|
|
52
52
|
content?: ReactNode;
|
|
53
53
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface MessageAvatarComponentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
/**
|
|
4
4
|
* The source URL for the avatar image
|
|
5
5
|
*/
|
|
6
6
|
src?: string;
|
|
7
7
|
/**
|
|
8
|
-
* The name
|
|
8
|
+
* The name for the avatar
|
|
9
9
|
*/
|
|
10
10
|
name: string;
|
|
11
11
|
/**
|