@flikk/ui 1.0.0-beta.10 → 1.0.0-beta.12
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 +2 -1
- package/dist/components/ai/MessageHistory/MessageHistory.js +1 -0
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +1 -0
- package/dist/components/ai/index.js +1 -0
- package/dist/components/core/Accordion/Accordion.animations.d.ts +6 -1
- package/dist/components/core/Accordion/Accordion.animations.js +15 -1
- 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 +6 -6
- package/dist/components/core/Accordion/Accordion.types.d.ts +34 -4
- 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 +20 -6
- 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 +3 -3
- package/dist/components/core/Badge/Badge.theme.js +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 +22 -25
- package/dist/components/core/Button/Button.ripple.d.ts +5 -1
- package/dist/components/core/Button/Button.ripple.js +27 -17
- package/dist/components/core/Button/Button.theme.d.ts +1 -2
- package/dist/components/core/Button/Button.theme.js +7 -7
- package/dist/components/core/Button/index.d.ts +2 -0
- package/dist/components/core/Calendar/Calendar.js +3 -3
- 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 +6 -6
- package/dist/components/core/Card/Card.types.d.ts +8 -13
- package/dist/components/core/Card/CardBody.d.ts +3 -0
- package/dist/components/core/Card/CardBody.js +11 -0
- package/dist/components/core/Card/CardSubtitle.d.ts +1 -1
- package/dist/components/core/Card/CardTitle.d.ts +1 -1
- 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.d.ts +2 -0
- package/dist/components/core/Drawer/Drawer.theme.js +12 -10
- 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/{DrawerContent.js → DrawerBody.js} +3 -3
- package/dist/components/core/Drawer/DrawerHeader.js +1 -0
- package/dist/components/core/Drawer/DrawerTitle.js +1 -1
- 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/MenuItem/MenuItem.js +3 -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 +2 -2
- package/dist/components/core/Message/Message.types.d.ts +1 -1
- 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/Modal/ModalHeader.js +1 -0
- 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} +5 -5
- 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/Toast/Toast.js +5 -1
- package/dist/components/core/Toast/Toast.types.d.ts +9 -9
- package/dist/components/core/index.js +7 -2
- package/dist/components/data-display/Feed/Feed.js +10 -2
- package/dist/components/data-display/Feed/Feed.types.d.ts +4 -4
- package/dist/components/data-display/GanttChart/GanttTaskContextMenu.js +1 -1
- package/dist/components/data-display/GanttChart/GanttToolbar.js +1 -0
- 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 +3 -1
- package/dist/components/data-display/Table/TableFilter.js +2 -1
- package/dist/components/data-display/Table/TableSelectionHeader.js +1 -1
- 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/Input/Input.js +2 -2
- package/dist/components/forms/Input/Input.types.d.ts +4 -4
- 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/index.d.ts +2 -2
- package/dist/components/forms/index.js +2 -2
- 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 +9 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/global.scss +1 -1
- package/dist/components/core/Accordion/AccordionContent.d.ts +0 -3
- package/dist/components/core/Button/Button.animations.d.ts +0 -5
- 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/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 -13
- package/dist/components/layout/FormLayout/FormLayoutHeader.d.ts +0 -3
- package/dist/components/layout/FormLayout/FormLayoutHeader.js +0 -12
|
@@ -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.
|
|
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
|
|
|
@@ -20,11 +20,13 @@ export declare const drawerPositionVariantsFullWidth: {
|
|
|
20
20
|
};
|
|
21
21
|
export declare const drawerSizeVariants: {
|
|
22
22
|
horizontal: {
|
|
23
|
+
sm: string;
|
|
23
24
|
md: string;
|
|
24
25
|
lg: string;
|
|
25
26
|
full: string;
|
|
26
27
|
};
|
|
27
28
|
vertical: {
|
|
29
|
+
sm: string;
|
|
28
30
|
md: string;
|
|
29
31
|
lg: string;
|
|
30
32
|
full: string;
|
|
@@ -5,39 +5,41 @@ const drawerTheme = {
|
|
|
5
5
|
"border border-[var(--color-border)] ring-4 ring-white/10 " +
|
|
6
6
|
"flex flex-col overflow-hidden rounded-[var(--drawer-radius)] " +
|
|
7
7
|
"dark:bg-[var(--color-background-secondary)] dark:ring-white/5",
|
|
8
|
-
|
|
8
|
+
inner: "h-full flex flex-col",
|
|
9
9
|
header: "flex items-start justify-between p-4 border-b border-[var(--color-border)] shrink-0 text-[var(--color-text-primary)] gap-4",
|
|
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
|
-
"dark:border-[var(--color-
|
|
15
|
+
"dark:border-[var(--color-border)]",
|
|
16
16
|
};
|
|
17
17
|
// Position variants with margin support
|
|
18
18
|
const drawerPositionVariantsWithMargin = {
|
|
19
|
-
left: "left-
|
|
20
|
-
right: "right-
|
|
21
|
-
top: "top-
|
|
22
|
-
bottom: "bottom-
|
|
19
|
+
left: "left-0 top-0 h-full", // 100vh - 1.5rem top - 1.5rem bottom
|
|
20
|
+
right: "right-0 top-0 h-full",
|
|
21
|
+
top: "top-0 left-0 w-full",
|
|
22
|
+
bottom: "bottom-0 left-0 w-full",
|
|
23
23
|
};
|
|
24
24
|
// Position variants for full-width/height drawers with consistent margins
|
|
25
25
|
const drawerPositionVariantsFullWidth = {
|
|
26
|
-
left: "left-
|
|
27
|
-
right: "right-
|
|
28
|
-
top: "top-
|
|
29
|
-
bottom: "bottom-
|
|
26
|
+
left: "left-0 top-0 right-0 bottom-0", // Consistent margins on all sides
|
|
27
|
+
right: "right-0 top-0 left-0 bottom-0",
|
|
28
|
+
top: "top-0 left-0 right-0 bottom-0",
|
|
29
|
+
bottom: "bottom-0 left-0 right-0 top-0",
|
|
30
30
|
};
|
|
31
31
|
// Size variants based on position
|
|
32
32
|
const drawerSizeVariants = {
|
|
33
33
|
// Horizontal drawers (left/right)
|
|
34
34
|
horizontal: {
|
|
35
|
+
sm: "w-[min(320px,90vw)]", // 320px on large screens, max 90% on small
|
|
35
36
|
md: "w-[min(420px,90vw)]", // 420px on large screens, max 90% on small
|
|
36
37
|
lg: "w-[min(560px,85vw)]", // 560px on large screens, max 85% on small
|
|
37
38
|
full: "w-full", // Full width - positioning handles margins
|
|
38
39
|
},
|
|
39
40
|
// Vertical drawers (top/bottom)
|
|
40
41
|
vertical: {
|
|
42
|
+
sm: "h-[min(240px,90vh)]", // 240px on large screens, max 90% on small
|
|
41
43
|
md: "h-[min(320px,90vh)]", // 320px on large screens, max 90% on small
|
|
42
44
|
lg: "h-[min(448px,85vh)]", // 448px on large screens, max 85% on small
|
|
43
45
|
full: "h-full", // Full height - positioning handles margins
|
|
@@ -1,10 +1,12 @@
|
|
|
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;
|
|
7
|
-
|
|
9
|
+
inner: string;
|
|
8
10
|
header: string;
|
|
9
11
|
headerContent: string;
|
|
10
12
|
title: string;
|
|
@@ -15,7 +17,7 @@ export interface DrawerTheme {
|
|
|
15
17
|
export interface DrawerThemeOverrides {
|
|
16
18
|
overlay?: string;
|
|
17
19
|
container?: string;
|
|
18
|
-
|
|
20
|
+
inner?: string;
|
|
19
21
|
header?: string;
|
|
20
22
|
headerContent?: string;
|
|
21
23
|
title?: string;
|
|
@@ -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
|
}
|
|
@@ -2,10 +2,10 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { cn } from '../../../utils/cn.js';
|
|
3
3
|
import { useDrawerContext } from './Drawer.js';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const DrawerBody = ({ children, className, ...props }) => {
|
|
6
6
|
const { theme } = useDrawerContext();
|
|
7
7
|
return (jsx("div", { className: cn(theme.body, className), ...props, children: children }));
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
DrawerBody.displayName = "Drawer.Body";
|
|
10
10
|
|
|
11
|
-
export {
|
|
11
|
+
export { DrawerBody };
|
|
@@ -2,6 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { cn } from '../../../utils/cn.js';
|
|
3
3
|
import { useDrawerContext } from './Drawer.js';
|
|
4
4
|
import { Button } from '../Button/Button.js';
|
|
5
|
+
import 'react';
|
|
5
6
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
|
6
7
|
|
|
7
8
|
const DrawerHeader = ({ children, icon, showCloseButton, className, ...props }) => {
|
|
@@ -4,7 +4,7 @@ import { useDrawerContext } from './Drawer.js';
|
|
|
4
4
|
|
|
5
5
|
const DrawerTitle = ({ children, className, ...props }) => {
|
|
6
6
|
const { theme, titleId } = useDrawerContext();
|
|
7
|
-
return (jsx("
|
|
7
|
+
return (jsx("h2", { id: titleId, className: cn(theme.title, className), ...props, children: children }));
|
|
8
8
|
};
|
|
9
9
|
DrawerTitle.displayName = "Drawer.Title";
|
|
10
10
|
|
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -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';
|
|
@@ -106,7 +106,7 @@ 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,
|
|
@@ -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
|
/**
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface MessageBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* The message content
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const MessageBody: React.ForwardRefExoticComponent<MessageBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -5,7 +5,7 @@ import { useMessageContext } from './MessageContext.js';
|
|
|
5
5
|
import { messageTheme } from './Message.theme.js';
|
|
6
6
|
import { TypeWriter } from './TypeWriter.js';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const MessageBody = React__default.forwardRef(({ children, className, ...props }, ref) => {
|
|
9
9
|
const { variant, role, isStreaming, typingSpeed } = useMessageContext();
|
|
10
10
|
// Get variant-specific theme
|
|
11
11
|
const variantTheme = messageTheme.variants[variant];
|
|
@@ -17,6 +17,6 @@ const MessageContent = React__default.forwardRef(({ children, className, ...prop
|
|
|
17
17
|
typeof children === 'string';
|
|
18
18
|
return (jsx("div", { ref: ref, className: bubbleStyle, ...props, children: shouldAnimate ? (jsx(TypeWriter, { text: children, speed: typingSpeed, enabled: true, className: "break-words" })) : typeof children === 'string' ? (jsx("p", { className: "break-words", children: children })) : (children) }));
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
MessageBody.displayName = 'Message.Body';
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { MessageBody };
|
|
@@ -5,3 +5,5 @@ export { messageListTheme } from './MessageList.theme';
|
|
|
5
5
|
export type { MessageListProps, MessageListTheme, MessageListThemeOverrides, } from './MessageList.types';
|
|
6
6
|
export { TypeWriter } from './TypeWriter';
|
|
7
7
|
export type { TypeWriterProps } from './TypeWriter';
|
|
8
|
+
export { MessageBody } from './MessageBody';
|
|
9
|
+
export type { MessageBodyProps } from './MessageBody';
|
|
@@ -32,6 +32,9 @@ const ModalRoot = ({ isOpen, onClose, size = "md", variant = "default", closeOnO
|
|
|
32
32
|
setIsBodyScrollable(false);
|
|
33
33
|
}
|
|
34
34
|
}, [isOpen]);
|
|
35
|
+
// Detect whether size is a preset token or an arbitrary Tailwind class
|
|
36
|
+
const SIZE_TOKENS = ["sm", "md", "lg", "xl", "full"];
|
|
37
|
+
const isSizeToken = SIZE_TOKENS.includes(size);
|
|
35
38
|
// Merge theme with overrides
|
|
36
39
|
const theme = {
|
|
37
40
|
...modalTheme,
|
|
@@ -46,6 +49,7 @@ const ModalRoot = ({ isOpen, onClose, size = "md", variant = "default", closeOnO
|
|
|
46
49
|
isOpen,
|
|
47
50
|
onClose,
|
|
48
51
|
size,
|
|
52
|
+
isSizeToken,
|
|
49
53
|
closeOnOverlayClick,
|
|
50
54
|
closeOnEsc,
|
|
51
55
|
showCloseButton,
|
|
@@ -55,7 +59,7 @@ const ModalRoot = ({ isOpen, onClose, size = "md", variant = "default", closeOnO
|
|
|
55
59
|
titleId,
|
|
56
60
|
subtitleId,
|
|
57
61
|
};
|
|
58
|
-
return (jsx(Overlay, { isOpen: isOpen, onClose: onClose, closeOnOverlayClick: closeOnOverlayClick, closeOnEsc: closeOnEsc, position: "center", role: role, ariaModal: true, ariaLabelledBy: titleId, ariaDescribedBy: subtitleId, contentClassName: cn(theme.container, (_a = theme.containerVariants) === null || _a === void 0 ? void 0 : _a[variant], modalSizeVariants[size], className), animations: {
|
|
62
|
+
return (jsx(Overlay, { isOpen: isOpen, onClose: onClose, closeOnOverlayClick: closeOnOverlayClick, closeOnEsc: closeOnEsc, position: "center", role: role, ariaModal: true, ariaLabelledBy: titleId, ariaDescribedBy: subtitleId, contentClassName: cn(theme.container, (_a = theme.containerVariants) === null || _a === void 0 ? void 0 : _a[variant], isSizeToken ? modalSizeVariants[size] : size, className), animations: {
|
|
59
63
|
overlay: modalOverlayAnimations,
|
|
60
64
|
content: modalContentAnimations,
|
|
61
65
|
}, ...props, children: jsx(ModalContext.Provider, { value: contextValue, children: children }) }));
|
|
@@ -9,7 +9,7 @@ const modalTheme = {
|
|
|
9
9
|
header: "flex items-start justify-between p-6 pb-0 shrink-0 border-b border-transparent gap-6 relative",
|
|
10
10
|
headerContent: "flex flex-col items-start gap-2 flex-1",
|
|
11
11
|
title: "text-lg leading-6 font-semibold text-[var(--color-text-primary)]",
|
|
12
|
-
subtitle: "text-base text-[var(--color-text-
|
|
12
|
+
subtitle: "text-base text-[var(--color-text-muted)] mt-0.5",
|
|
13
13
|
body: "flex-1 overflow-y-auto p-6 pb-3",
|
|
14
14
|
footer: "flex items-center justify-end gap-2 p-6 py-3 border-t border-transparent",
|
|
15
15
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export type
|
|
2
|
+
export type ModalSizeToken = "sm" | "md" | "lg" | "xl" | "full";
|
|
3
|
+
/** Preset size token or any arbitrary Tailwind width class, e.g. `"w-80"`, `"w-[50vw]"` */
|
|
4
|
+
export type ModalSize = ModalSizeToken | (string & {});
|
|
3
5
|
export type ModalVariant = "default" | "translucent";
|
|
4
6
|
export interface ModalTheme {
|
|
5
7
|
overlay: string;
|
|
@@ -27,6 +29,7 @@ export interface ModalContextValue {
|
|
|
27
29
|
isOpen: boolean;
|
|
28
30
|
onClose: () => void;
|
|
29
31
|
size: ModalSize;
|
|
32
|
+
isSizeToken: boolean;
|
|
30
33
|
closeOnOverlayClick: boolean;
|
|
31
34
|
closeOnEsc: boolean;
|
|
32
35
|
showCloseButton: boolean;
|
|
@@ -56,7 +59,7 @@ export interface ModalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "
|
|
|
56
59
|
* - `alertdialog`: Alert dialog requiring user acknowledgment
|
|
57
60
|
* @default "dialog"
|
|
58
61
|
*/
|
|
59
|
-
role?:
|
|
62
|
+
role?: "dialog" | "alertdialog";
|
|
60
63
|
children: React.ReactNode;
|
|
61
64
|
className?: string;
|
|
62
65
|
theme?: ModalThemeOverrides;
|
|
@@ -2,6 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { cn } from '../../../utils/cn.js';
|
|
3
3
|
import { useModalContext } from './Modal.js';
|
|
4
4
|
import { Button } from '../Button/Button.js';
|
|
5
|
+
import 'react';
|
|
5
6
|
import { XMarkIcon } from '@heroicons/react/24/outline';
|
|
6
7
|
|
|
7
8
|
const ModalHeader = ({ children, icon, showCloseButton, className, ...props }) => {
|
|
@@ -34,6 +34,7 @@ const ModalStackModal = ({ size = "md", variant = "default", showCloseButton = t
|
|
|
34
34
|
isOpen: true,
|
|
35
35
|
onClose: closeHandler,
|
|
36
36
|
size,
|
|
37
|
+
isSizeToken: ["sm", "md", "lg", "xl", "full"].includes(size),
|
|
37
38
|
closeOnOverlayClick: true,
|
|
38
39
|
closeOnEsc: true,
|
|
39
40
|
showCloseButton,
|
|
@@ -42,7 +42,7 @@ export interface PageHeadingIconProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
42
42
|
}
|
|
43
43
|
export interface PageHeadingBackButtonProps {
|
|
44
44
|
/** Text label next to the back arrow. @default "Back" */
|
|
45
|
-
label?:
|
|
45
|
+
label?: ReactNode;
|
|
46
46
|
onClick?: () => void;
|
|
47
47
|
className?: string;
|
|
48
48
|
}
|
|
@@ -5,7 +5,9 @@ import { ArrowLeftIcon } from '@heroicons/react/20/solid';
|
|
|
5
5
|
import { Button } from '../Button/Button.js';
|
|
6
6
|
|
|
7
7
|
const PageHeadingBackButton = React__default.forwardRef(({ label = "Back", onClick, className, ...props }, ref) => {
|
|
8
|
-
return (jsxs(Button, { ref: ref, variant: "link", color: "neutral", size: "sm", onClick: onClick, className: cn("mb-2 w-fit", className), ...props, children: [jsx(ArrowLeftIcon, { className: "size-4" }), label
|
|
8
|
+
return (jsxs(Button, { ref: ref, variant: "link", color: "neutral", size: "sm", onClick: onClick, className: cn("mb-2 w-fit", className), ...props, children: [jsx(ArrowLeftIcon, { className: "size-4" }), typeof label === 'string'
|
|
9
|
+
? jsx("span", { children: label })
|
|
10
|
+
: label] }));
|
|
9
11
|
});
|
|
10
12
|
PageHeadingBackButton.displayName = "PageHeadingBackButton";
|
|
11
13
|
|
|
@@ -2,5 +2,5 @@ import React from "react";
|
|
|
2
2
|
import { PopoverRootProps as PopoverProps } from "./Popover.types";
|
|
3
3
|
export declare const Popover: (({ children, className, isOpen: controlledIsOpen, defaultIsOpen, onOpenChange, placement, offset, triggerType, closeOnClickOutside, closeOnEsc, preventClose, hasBackdrop, theme: themeOverrides, darkMode, ...props }: PopoverProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
4
|
Trigger: React.ForwardRefExoticComponent<Omit<import("./Popover.types").PopoverTriggerProps, "ref"> & React.RefAttributes<any>>;
|
|
5
|
-
|
|
5
|
+
Body: React.ForwardRefExoticComponent<import("./Popover.types").PopoverBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
};
|
|
@@ -3,7 +3,7 @@ import { useId, useState, useRef, useCallback } from 'react';
|
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
4
|
import { PopoverContext } from './PopoverContext.js';
|
|
5
5
|
import { PopoverTrigger } from './PopoverTrigger.js';
|
|
6
|
-
import {
|
|
6
|
+
import { PopoverBody } from './PopoverBody.js';
|
|
7
7
|
import { popoverTheme } from './Popover.theme.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -16,9 +16,9 @@ import { popoverTheme } from './Popover.theme.js';
|
|
|
16
16
|
* <Popover.Trigger>
|
|
17
17
|
* <Button>Open Popover</Button>
|
|
18
18
|
* </Popover.Trigger>
|
|
19
|
-
* <Popover.
|
|
19
|
+
* <Popover.Body>
|
|
20
20
|
* <div>Popover content</div>
|
|
21
|
-
* </Popover.
|
|
21
|
+
* </Popover.Body>
|
|
22
22
|
* </Popover>
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
@@ -66,7 +66,7 @@ const PopoverRoot = ({ children, className, isOpen: controlledIsOpen, defaultIsO
|
|
|
66
66
|
// Export as a unified component
|
|
67
67
|
const Popover = Object.assign(PopoverRoot, {
|
|
68
68
|
Trigger: PopoverTrigger,
|
|
69
|
-
|
|
69
|
+
Body: PopoverBody,
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
export { Popover };
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
const popoverTheme = {
|
|
5
5
|
// Base styles for the popover
|
|
6
6
|
baseStyle: "z-50 outline-none",
|
|
7
|
-
//
|
|
8
|
-
|
|
7
|
+
// Body styles
|
|
8
|
+
bodyStyle: "bg-[var(--color-surface)] border border-[var(--color-border)] rounded-[var(--popover-radius)] shadow-real-xl p-4 max-w-[min(24rem,calc(100vw-2rem))] dark:bg-[var(--color-background-secondary)] ",
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { popoverTheme };
|
|
@@ -44,7 +44,7 @@ export interface PopoverTriggerProps {
|
|
|
44
44
|
className?: string;
|
|
45
45
|
[key: string]: unknown;
|
|
46
46
|
}
|
|
47
|
-
export interface
|
|
47
|
+
export interface PopoverBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
48
48
|
children: ReactNode;
|
|
49
49
|
animation?: boolean;
|
|
50
50
|
portal?: boolean;
|
|
@@ -61,6 +61,6 @@ export interface PopoverContentProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
61
61
|
export interface PopoverThemeOverrides {
|
|
62
62
|
/** Base style for the popover */
|
|
63
63
|
baseStyle?: string;
|
|
64
|
-
/**
|
|
65
|
-
|
|
64
|
+
/** Body style for the popover */
|
|
65
|
+
bodyStyle?: string;
|
|
66
66
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PopoverBodyProps } from "./Popover.types";
|
|
3
|
+
/**
|
|
4
|
+
* PopoverBody component displays the body/content of the popover
|
|
5
|
+
*/
|
|
6
|
+
declare const PopoverBody: React.ForwardRefExoticComponent<PopoverBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { PopoverBody };
|
|
@@ -48,9 +48,9 @@ const useDarkMode = () => {
|
|
|
48
48
|
return isDark;
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* PopoverBody component displays the body/content of the popover
|
|
52
52
|
*/
|
|
53
|
-
const
|
|
53
|
+
const PopoverBody = React__default.forwardRef(({ children, className, animation = true, portal = true, scrollable = false, maxHeight, ...props }, ref) => {
|
|
54
54
|
const { isOpen, onOpenChange, triggerRef, contentRef, placement, offset, triggerType, closeOnClickOutside, closeOnEsc, preventClose, hasBackdrop, theme, contentId, } = usePopoverContext();
|
|
55
55
|
const shouldReduceMotion = useReducedMotion();
|
|
56
56
|
const localRef = useRef(null);
|
|
@@ -111,7 +111,7 @@ const PopoverContent = React__default.forwardRef(({ children, className, animati
|
|
|
111
111
|
const isClient = useIsClient();
|
|
112
112
|
// Extract DOM props to avoid type conflicts with Framer Motion
|
|
113
113
|
const { onDrag, onDragStart, onDragEnd, onAnimationStart, onAnimationEnd, ...domProps } = props;
|
|
114
|
-
const contentClasses = cn(theme.baseStyle, theme.
|
|
114
|
+
const contentClasses = cn(theme.baseStyle, theme.bodyStyle, "popover-content", scrollable && "overflow-y-auto", className);
|
|
115
115
|
const contentPositionStyle = {
|
|
116
116
|
...cssVariables,
|
|
117
117
|
position: "fixed",
|
|
@@ -137,6 +137,6 @@ const PopoverContent = React__default.forwardRef(({ children, className, animati
|
|
|
137
137
|
}
|
|
138
138
|
return popoverContent;
|
|
139
139
|
});
|
|
140
|
-
|
|
140
|
+
PopoverBody.displayName = "Popover.Body";
|
|
141
141
|
|
|
142
|
-
export {
|
|
142
|
+
export { PopoverBody };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Popover } from './Popover';
|
|
2
2
|
import { PopoverContext, usePopoverContext } from './PopoverContext';
|
|
3
|
-
import { PopoverRootProps as PopoverProps,
|
|
4
|
-
|
|
5
|
-
export
|
|
3
|
+
import { PopoverRootProps as PopoverProps, PopoverBodyProps, PopoverTriggerProps, PopoverContextValue, PopoverPlacement, PopoverTriggerType, PopoverThemeOverrides } from './Popover.types';
|
|
4
|
+
import { PopoverBody } from './PopoverBody';
|
|
5
|
+
export { Popover, PopoverBody, PopoverContext, usePopoverContext };
|
|
6
|
+
export type { PopoverProps, PopoverBodyProps, PopoverTriggerProps, PopoverContextValue, PopoverPlacement, PopoverTriggerType, PopoverThemeOverrides };
|
|
@@ -17,7 +17,7 @@ export interface UnderlinePosition {
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const getUnderlineTransition: (shouldReduceMotion: boolean | null) => Transition;
|
|
19
19
|
/**
|
|
20
|
-
* Get
|
|
20
|
+
* Get TabsBody animation variants for directional fade animations
|
|
21
21
|
* Provides smooth fade-in from bottom and fade-out to top transitions
|
|
22
22
|
*/
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const getTabsBodyVariants: (shouldReduceMotion: boolean | null) => Variants | undefined;
|