@melony/react 0.1.52 → 0.1.53
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/index.cjs +170 -160
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -9
- package/dist/index.d.ts +8 -9
- package/dist/index.js +171 -161
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -384,15 +384,14 @@ declare const Image: React__default.FC<UIContract["image"]>;
|
|
|
384
384
|
|
|
385
385
|
declare const Label: React__default.FC<UIContract["label"]>;
|
|
386
386
|
|
|
387
|
+
interface DropdownItem {
|
|
388
|
+
label: string;
|
|
389
|
+
icon?: string;
|
|
390
|
+
onClickAction?: Event;
|
|
391
|
+
}
|
|
387
392
|
interface DropdownProps {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
triggerClassName?: string;
|
|
391
|
-
items: {
|
|
392
|
-
label: string;
|
|
393
|
-
icon: React$1.ReactNode;
|
|
394
|
-
onClick: () => void;
|
|
395
|
-
}[];
|
|
393
|
+
items?: DropdownItem[];
|
|
394
|
+
children?: React$1.ReactNode;
|
|
396
395
|
}
|
|
397
396
|
declare const Dropdown: React$1.FC<DropdownProps>;
|
|
398
397
|
|
|
@@ -441,4 +440,4 @@ declare const Hidden: React__default.FC<UIContract["hidden"]>;
|
|
|
441
440
|
|
|
442
441
|
declare const ColorPicker: React__default.FC<UIContract["colorPicker"]>;
|
|
443
442
|
|
|
444
|
-
export { AccountButton, type AccountButtonProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, Badge, Box, Button, Card, Chart, ChatHeader, type ChatHeaderProps, Checkbox, Col, ColorPicker, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, CreateThreadListItem, type CreateThreadListItemProps, Divider, Dropdown, type DropdownProps, Float, Form, FullChat, type FullChatProps, Heading, Hidden, Image, Input, Label, List, ListItem, MelonyContext, type MelonyContextValue, MelonyProvider, type MelonyProviderProps, PopupChat, type PopupChatProps, RadioGroup, Row, type ScreenSize, Select, Sidebar, SidebarContext, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarToggle, type SidebarToggleProps, Spacer, type StarterPrompt, Surface, type SurfaceProps, Text, Textarea, ThemeProvider, ThemeToggle, Thread, ThreadContext, type ThreadContextValue, type ThreadData, ThreadList, type ThreadListProps, ThreadPopover, type ThreadPopoverProps, ThreadProvider, type ThreadProviderProps, type ThreadService, UIRenderer, type UIRendererProps, Upload, type UseMelonyOptions, type UseSurfaceOptions, type User, WelcomeScreen, type WelcomeScreenProps, useAuth, useMelony, useScreenSize, useSidebar, useSurface, useTheme, useThreads };
|
|
443
|
+
export { AccountButton, type AccountButtonProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, Badge, Box, Button, Card, Chart, ChatHeader, type ChatHeaderProps, Checkbox, Col, ColorPicker, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, CreateThreadListItem, type CreateThreadListItemProps, Divider, Dropdown, type DropdownItem, type DropdownProps, Float, Form, FullChat, type FullChatProps, Heading, Hidden, Image, Input, Label, List, ListItem, MelonyContext, type MelonyContextValue, MelonyProvider, type MelonyProviderProps, PopupChat, type PopupChatProps, RadioGroup, Row, type ScreenSize, Select, Sidebar, SidebarContext, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarToggle, type SidebarToggleProps, Spacer, type StarterPrompt, Surface, type SurfaceProps, Text, Textarea, ThemeProvider, ThemeToggle, Thread, ThreadContext, type ThreadContextValue, type ThreadData, ThreadList, type ThreadListProps, ThreadPopover, type ThreadPopoverProps, ThreadProvider, type ThreadProviderProps, type ThreadService, UIRenderer, type UIRendererProps, Upload, type UseMelonyOptions, type UseSurfaceOptions, type User, WelcomeScreen, type WelcomeScreenProps, useAuth, useMelony, useScreenSize, useSidebar, useSurface, useTheme, useThreads };
|
package/dist/index.d.ts
CHANGED
|
@@ -384,15 +384,14 @@ declare const Image: React__default.FC<UIContract["image"]>;
|
|
|
384
384
|
|
|
385
385
|
declare const Label: React__default.FC<UIContract["label"]>;
|
|
386
386
|
|
|
387
|
+
interface DropdownItem {
|
|
388
|
+
label: string;
|
|
389
|
+
icon?: string;
|
|
390
|
+
onClickAction?: Event;
|
|
391
|
+
}
|
|
387
392
|
interface DropdownProps {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
triggerClassName?: string;
|
|
391
|
-
items: {
|
|
392
|
-
label: string;
|
|
393
|
-
icon: React$1.ReactNode;
|
|
394
|
-
onClick: () => void;
|
|
395
|
-
}[];
|
|
393
|
+
items?: DropdownItem[];
|
|
394
|
+
children?: React$1.ReactNode;
|
|
396
395
|
}
|
|
397
396
|
declare const Dropdown: React$1.FC<DropdownProps>;
|
|
398
397
|
|
|
@@ -441,4 +440,4 @@ declare const Hidden: React__default.FC<UIContract["hidden"]>;
|
|
|
441
440
|
|
|
442
441
|
declare const ColorPicker: React__default.FC<UIContract["colorPicker"]>;
|
|
443
442
|
|
|
444
|
-
export { AccountButton, type AccountButtonProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, Badge, Box, Button, Card, Chart, ChatHeader, type ChatHeaderProps, Checkbox, Col, ColorPicker, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, CreateThreadListItem, type CreateThreadListItemProps, Divider, Dropdown, type DropdownProps, Float, Form, FullChat, type FullChatProps, Heading, Hidden, Image, Input, Label, List, ListItem, MelonyContext, type MelonyContextValue, MelonyProvider, type MelonyProviderProps, PopupChat, type PopupChatProps, RadioGroup, Row, type ScreenSize, Select, Sidebar, SidebarContext, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarToggle, type SidebarToggleProps, Spacer, type StarterPrompt, Surface, type SurfaceProps, Text, Textarea, ThemeProvider, ThemeToggle, Thread, ThreadContext, type ThreadContextValue, type ThreadData, ThreadList, type ThreadListProps, ThreadPopover, type ThreadPopoverProps, ThreadProvider, type ThreadProviderProps, type ThreadService, UIRenderer, type UIRendererProps, Upload, type UseMelonyOptions, type UseSurfaceOptions, type User, WelcomeScreen, type WelcomeScreenProps, useAuth, useMelony, useScreenSize, useSidebar, useSurface, useTheme, useThreads };
|
|
443
|
+
export { AccountButton, type AccountButtonProps, AuthContext, type AuthContextValue, AuthProvider, type AuthProviderProps, type AuthService, Badge, Box, Button, Card, Chart, ChatHeader, type ChatHeaderProps, Checkbox, Col, ColorPicker, Composer, type ComposerOption, type ComposerOptionGroup, CreateThreadButton, type CreateThreadButtonProps, CreateThreadListItem, type CreateThreadListItemProps, Divider, Dropdown, type DropdownItem, type DropdownProps, Float, Form, FullChat, type FullChatProps, Heading, Hidden, Image, Input, Label, List, ListItem, MelonyContext, type MelonyContextValue, MelonyProvider, type MelonyProviderProps, PopupChat, type PopupChatProps, RadioGroup, Row, type ScreenSize, Select, Sidebar, SidebarContext, type SidebarContextValue, type SidebarProps, SidebarProvider, type SidebarProviderProps, SidebarToggle, type SidebarToggleProps, Spacer, type StarterPrompt, Surface, type SurfaceProps, Text, Textarea, ThemeProvider, ThemeToggle, Thread, ThreadContext, type ThreadContextValue, type ThreadData, ThreadList, type ThreadListProps, ThreadPopover, type ThreadPopoverProps, ThreadProvider, type ThreadProviderProps, type ThreadService, UIRenderer, type UIRendererProps, Upload, type UseMelonyOptions, type UseSurfaceOptions, type User, WelcomeScreen, type WelcomeScreenProps, useAuth, useMelony, useScreenSize, useSidebar, useSurface, useTheme, useThreads };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { clsx } from 'clsx';
|
|
|
8
8
|
import { twMerge } from 'tailwind-merge';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import * as ICONS from '@tabler/icons-react';
|
|
11
|
-
import { IconX, IconChevronLeft, IconChevronRight, IconLoader2, IconCheck, IconUpload, IconUser, IconLogout, IconBrandGoogle, IconFileText, IconFile, IconPaperclip, IconChevronDown, IconArrowUp,
|
|
11
|
+
import { IconX, IconChevronLeft, IconChevronRight, IconLoader2, IconCheck, IconUpload, IconDotsVertical, IconUser, IconLogout, IconBrandGoogle, IconFileText, IconFile, IconPaperclip, IconChevronDown, IconArrowUp, IconHistory, IconPlus, IconArrowLeft, IconMessage, IconLayoutSidebarLeftExpand, IconLayoutSidebarLeftCollapse, IconLayoutSidebarRightExpand, IconLayoutSidebarRightCollapse, IconDeviceDesktop, IconMoon, IconSun, IconSelector, IconChevronUp } from '@tabler/icons-react';
|
|
12
12
|
export * from '@tabler/icons-react';
|
|
13
13
|
import { Separator as Separator$1 } from '@base-ui/react/separator';
|
|
14
14
|
import { mergeProps } from '@base-ui/react/merge-props';
|
|
@@ -2117,6 +2117,165 @@ var Form = ({
|
|
|
2117
2117
|
}
|
|
2118
2118
|
);
|
|
2119
2119
|
};
|
|
2120
|
+
function DropdownMenu({ ...props }) {
|
|
2121
|
+
return /* @__PURE__ */ jsx(Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2122
|
+
}
|
|
2123
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
2124
|
+
return /* @__PURE__ */ jsx(Menu.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
2125
|
+
}
|
|
2126
|
+
function DropdownMenuContent({
|
|
2127
|
+
align = "start",
|
|
2128
|
+
alignOffset = 0,
|
|
2129
|
+
side = "bottom",
|
|
2130
|
+
sideOffset = 4,
|
|
2131
|
+
className,
|
|
2132
|
+
...props
|
|
2133
|
+
}) {
|
|
2134
|
+
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(
|
|
2135
|
+
Menu.Positioner,
|
|
2136
|
+
{
|
|
2137
|
+
className: "isolate z-50 outline-none",
|
|
2138
|
+
align,
|
|
2139
|
+
alignOffset,
|
|
2140
|
+
side,
|
|
2141
|
+
sideOffset,
|
|
2142
|
+
children: /* @__PURE__ */ jsx(
|
|
2143
|
+
Menu.Popup,
|
|
2144
|
+
{
|
|
2145
|
+
"data-slot": "dropdown-menu-content",
|
|
2146
|
+
className: cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/5 bg-popover text-popover-foreground min-w-48 rounded-2xl p-1 shadow-2xl ring-1 duration-100 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden", className),
|
|
2147
|
+
...props
|
|
2148
|
+
}
|
|
2149
|
+
)
|
|
2150
|
+
}
|
|
2151
|
+
) });
|
|
2152
|
+
}
|
|
2153
|
+
function DropdownMenuGroup({ ...props }) {
|
|
2154
|
+
return /* @__PURE__ */ jsx(Menu.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
2155
|
+
}
|
|
2156
|
+
function DropdownMenuLabel({
|
|
2157
|
+
className,
|
|
2158
|
+
inset,
|
|
2159
|
+
...props
|
|
2160
|
+
}) {
|
|
2161
|
+
return /* @__PURE__ */ jsx(
|
|
2162
|
+
Menu.GroupLabel,
|
|
2163
|
+
{
|
|
2164
|
+
"data-slot": "dropdown-menu-label",
|
|
2165
|
+
"data-inset": inset,
|
|
2166
|
+
className: cn("text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8", className),
|
|
2167
|
+
...props
|
|
2168
|
+
}
|
|
2169
|
+
);
|
|
2170
|
+
}
|
|
2171
|
+
function DropdownMenuItem({
|
|
2172
|
+
className,
|
|
2173
|
+
inset,
|
|
2174
|
+
variant = "default",
|
|
2175
|
+
...props
|
|
2176
|
+
}) {
|
|
2177
|
+
return /* @__PURE__ */ jsx(
|
|
2178
|
+
Menu.Item,
|
|
2179
|
+
{
|
|
2180
|
+
"data-slot": "dropdown-menu-item",
|
|
2181
|
+
"data-inset": inset,
|
|
2182
|
+
"data-variant": variant,
|
|
2183
|
+
className: cn(
|
|
2184
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-2.5 rounded-xl px-3 py-2 text-sm [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2185
|
+
className
|
|
2186
|
+
),
|
|
2187
|
+
...props
|
|
2188
|
+
}
|
|
2189
|
+
);
|
|
2190
|
+
}
|
|
2191
|
+
function DropdownMenuCheckboxItem({
|
|
2192
|
+
className,
|
|
2193
|
+
children,
|
|
2194
|
+
checked,
|
|
2195
|
+
...props
|
|
2196
|
+
}) {
|
|
2197
|
+
return /* @__PURE__ */ jsxs(
|
|
2198
|
+
Menu.CheckboxItem,
|
|
2199
|
+
{
|
|
2200
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
2201
|
+
className: cn(
|
|
2202
|
+
"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-2.5 rounded-xl py-2 pr-8 pl-3 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2203
|
+
className
|
|
2204
|
+
),
|
|
2205
|
+
checked,
|
|
2206
|
+
...props,
|
|
2207
|
+
children: [
|
|
2208
|
+
/* @__PURE__ */ jsx(
|
|
2209
|
+
"span",
|
|
2210
|
+
{
|
|
2211
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2212
|
+
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2213
|
+
children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(
|
|
2214
|
+
IconCheck,
|
|
2215
|
+
{}
|
|
2216
|
+
) })
|
|
2217
|
+
}
|
|
2218
|
+
),
|
|
2219
|
+
children
|
|
2220
|
+
]
|
|
2221
|
+
}
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
function DropdownMenuSeparator({
|
|
2225
|
+
className,
|
|
2226
|
+
...props
|
|
2227
|
+
}) {
|
|
2228
|
+
return /* @__PURE__ */ jsx(
|
|
2229
|
+
Menu.Separator,
|
|
2230
|
+
{
|
|
2231
|
+
"data-slot": "dropdown-menu-separator",
|
|
2232
|
+
className: cn("bg-border/50 -mx-1 my-1 h-px", className),
|
|
2233
|
+
...props
|
|
2234
|
+
}
|
|
2235
|
+
);
|
|
2236
|
+
}
|
|
2237
|
+
var Dropdown = ({
|
|
2238
|
+
items = [],
|
|
2239
|
+
children
|
|
2240
|
+
}) => {
|
|
2241
|
+
const { sendEvent } = useMelony();
|
|
2242
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2243
|
+
/* @__PURE__ */ jsx(
|
|
2244
|
+
DropdownMenuTrigger,
|
|
2245
|
+
{
|
|
2246
|
+
render: (props) => /* @__PURE__ */ jsx(
|
|
2247
|
+
Button,
|
|
2248
|
+
{
|
|
2249
|
+
variant: "ghost",
|
|
2250
|
+
size: "icon-xs",
|
|
2251
|
+
...props,
|
|
2252
|
+
onClick: (e) => {
|
|
2253
|
+
e.stopPropagation();
|
|
2254
|
+
props.onClick?.(e);
|
|
2255
|
+
},
|
|
2256
|
+
children: children || /* @__PURE__ */ jsx(IconDotsVertical, { className: "size-3.5" })
|
|
2257
|
+
}
|
|
2258
|
+
)
|
|
2259
|
+
}
|
|
2260
|
+
),
|
|
2261
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", className: cn("w-32"), children: items.map((item, i) => /* @__PURE__ */ jsxs(
|
|
2262
|
+
DropdownMenuItem,
|
|
2263
|
+
{
|
|
2264
|
+
onClick: (e) => {
|
|
2265
|
+
e.stopPropagation();
|
|
2266
|
+
if (item.onClickAction) {
|
|
2267
|
+
sendEvent(item.onClickAction);
|
|
2268
|
+
}
|
|
2269
|
+
},
|
|
2270
|
+
children: [
|
|
2271
|
+
item.icon && /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }),
|
|
2272
|
+
/* @__PURE__ */ jsx("span", { className: item.icon ? "ml-2" : "", children: item.label })
|
|
2273
|
+
]
|
|
2274
|
+
},
|
|
2275
|
+
`${item.label}-${i}`
|
|
2276
|
+
)) })
|
|
2277
|
+
] });
|
|
2278
|
+
};
|
|
2120
2279
|
function UIRenderer({ node }) {
|
|
2121
2280
|
const { type, props, children } = node;
|
|
2122
2281
|
const typeMap = {
|
|
@@ -2146,7 +2305,8 @@ function UIRenderer({ node }) {
|
|
|
2146
2305
|
form: Form,
|
|
2147
2306
|
chart: Chart,
|
|
2148
2307
|
label: Label2,
|
|
2149
|
-
upload: Upload
|
|
2308
|
+
upload: Upload,
|
|
2309
|
+
dropdown: Dropdown
|
|
2150
2310
|
};
|
|
2151
2311
|
const Component = typeMap[type];
|
|
2152
2312
|
if (!Component) {
|
|
@@ -2329,123 +2489,6 @@ var useAuth = () => {
|
|
|
2329
2489
|
}
|
|
2330
2490
|
return context;
|
|
2331
2491
|
};
|
|
2332
|
-
function DropdownMenu({ ...props }) {
|
|
2333
|
-
return /* @__PURE__ */ jsx(Menu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2334
|
-
}
|
|
2335
|
-
function DropdownMenuTrigger({ ...props }) {
|
|
2336
|
-
return /* @__PURE__ */ jsx(Menu.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
2337
|
-
}
|
|
2338
|
-
function DropdownMenuContent({
|
|
2339
|
-
align = "start",
|
|
2340
|
-
alignOffset = 0,
|
|
2341
|
-
side = "bottom",
|
|
2342
|
-
sideOffset = 4,
|
|
2343
|
-
className,
|
|
2344
|
-
...props
|
|
2345
|
-
}) {
|
|
2346
|
-
return /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(
|
|
2347
|
-
Menu.Positioner,
|
|
2348
|
-
{
|
|
2349
|
-
className: "isolate z-50 outline-none",
|
|
2350
|
-
align,
|
|
2351
|
-
alignOffset,
|
|
2352
|
-
side,
|
|
2353
|
-
sideOffset,
|
|
2354
|
-
children: /* @__PURE__ */ jsx(
|
|
2355
|
-
Menu.Popup,
|
|
2356
|
-
{
|
|
2357
|
-
"data-slot": "dropdown-menu-content",
|
|
2358
|
-
className: cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/5 bg-popover text-popover-foreground min-w-48 rounded-2xl p-1 shadow-2xl ring-1 duration-100 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden", className),
|
|
2359
|
-
...props
|
|
2360
|
-
}
|
|
2361
|
-
)
|
|
2362
|
-
}
|
|
2363
|
-
) });
|
|
2364
|
-
}
|
|
2365
|
-
function DropdownMenuGroup({ ...props }) {
|
|
2366
|
-
return /* @__PURE__ */ jsx(Menu.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
2367
|
-
}
|
|
2368
|
-
function DropdownMenuLabel({
|
|
2369
|
-
className,
|
|
2370
|
-
inset,
|
|
2371
|
-
...props
|
|
2372
|
-
}) {
|
|
2373
|
-
return /* @__PURE__ */ jsx(
|
|
2374
|
-
Menu.GroupLabel,
|
|
2375
|
-
{
|
|
2376
|
-
"data-slot": "dropdown-menu-label",
|
|
2377
|
-
"data-inset": inset,
|
|
2378
|
-
className: cn("text-muted-foreground px-3 py-2.5 text-xs data-[inset]:pl-8", className),
|
|
2379
|
-
...props
|
|
2380
|
-
}
|
|
2381
|
-
);
|
|
2382
|
-
}
|
|
2383
|
-
function DropdownMenuItem({
|
|
2384
|
-
className,
|
|
2385
|
-
inset,
|
|
2386
|
-
variant = "default",
|
|
2387
|
-
...props
|
|
2388
|
-
}) {
|
|
2389
|
-
return /* @__PURE__ */ jsx(
|
|
2390
|
-
Menu.Item,
|
|
2391
|
-
{
|
|
2392
|
-
"data-slot": "dropdown-menu-item",
|
|
2393
|
-
"data-inset": inset,
|
|
2394
|
-
"data-variant": variant,
|
|
2395
|
-
className: cn(
|
|
2396
|
-
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-2.5 rounded-xl px-3 py-2 text-sm [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2397
|
-
className
|
|
2398
|
-
),
|
|
2399
|
-
...props
|
|
2400
|
-
}
|
|
2401
|
-
);
|
|
2402
|
-
}
|
|
2403
|
-
function DropdownMenuCheckboxItem({
|
|
2404
|
-
className,
|
|
2405
|
-
children,
|
|
2406
|
-
checked,
|
|
2407
|
-
...props
|
|
2408
|
-
}) {
|
|
2409
|
-
return /* @__PURE__ */ jsxs(
|
|
2410
|
-
Menu.CheckboxItem,
|
|
2411
|
-
{
|
|
2412
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
2413
|
-
className: cn(
|
|
2414
|
-
"focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-2.5 rounded-xl py-2 pr-8 pl-3 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
2415
|
-
className
|
|
2416
|
-
),
|
|
2417
|
-
checked,
|
|
2418
|
-
...props,
|
|
2419
|
-
children: [
|
|
2420
|
-
/* @__PURE__ */ jsx(
|
|
2421
|
-
"span",
|
|
2422
|
-
{
|
|
2423
|
-
className: "pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none",
|
|
2424
|
-
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
2425
|
-
children: /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(
|
|
2426
|
-
IconCheck,
|
|
2427
|
-
{}
|
|
2428
|
-
) })
|
|
2429
|
-
}
|
|
2430
|
-
),
|
|
2431
|
-
children
|
|
2432
|
-
]
|
|
2433
|
-
}
|
|
2434
|
-
);
|
|
2435
|
-
}
|
|
2436
|
-
function DropdownMenuSeparator({
|
|
2437
|
-
className,
|
|
2438
|
-
...props
|
|
2439
|
-
}) {
|
|
2440
|
-
return /* @__PURE__ */ jsx(
|
|
2441
|
-
Menu.Separator,
|
|
2442
|
-
{
|
|
2443
|
-
"data-slot": "dropdown-menu-separator",
|
|
2444
|
-
className: cn("bg-border/50 -mx-1 my-1 h-px", className),
|
|
2445
|
-
...props
|
|
2446
|
-
}
|
|
2447
|
-
);
|
|
2448
|
-
}
|
|
2449
2492
|
var AccountButton = ({
|
|
2450
2493
|
className,
|
|
2451
2494
|
variant = "outline",
|
|
@@ -3561,40 +3604,8 @@ function ChatHeader({
|
|
|
3561
3604
|
}
|
|
3562
3605
|
);
|
|
3563
3606
|
}
|
|
3564
|
-
var Dropdown = ({
|
|
3565
|
-
className,
|
|
3566
|
-
trigger,
|
|
3567
|
-
triggerClassName,
|
|
3568
|
-
items
|
|
3569
|
-
}) => {
|
|
3570
|
-
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
3571
|
-
/* @__PURE__ */ jsx(
|
|
3572
|
-
DropdownMenuTrigger,
|
|
3573
|
-
{
|
|
3574
|
-
className: triggerClassName,
|
|
3575
|
-
render: (props) => /* @__PURE__ */ jsx(
|
|
3576
|
-
Button,
|
|
3577
|
-
{
|
|
3578
|
-
variant: "ghost",
|
|
3579
|
-
size: "icon-xs",
|
|
3580
|
-
...props,
|
|
3581
|
-
onClick: (e) => {
|
|
3582
|
-
e.stopPropagation();
|
|
3583
|
-
props.onClick?.(e);
|
|
3584
|
-
},
|
|
3585
|
-
children: trigger || /* @__PURE__ */ jsx(IconDotsVertical, { className: "size-3.5" })
|
|
3586
|
-
}
|
|
3587
|
-
)
|
|
3588
|
-
}
|
|
3589
|
-
),
|
|
3590
|
-
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", className: cn("w-32", className), children: items.map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: item.onClick, children: [
|
|
3591
|
-
item.icon,
|
|
3592
|
-
/* @__PURE__ */ jsx("span", { children: item.label })
|
|
3593
|
-
] }, item.label)) })
|
|
3594
|
-
] });
|
|
3595
|
-
};
|
|
3596
3607
|
var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
3597
|
-
const { threads, activeThreadId
|
|
3608
|
+
const { threads, activeThreadId } = useThreads();
|
|
3598
3609
|
const sortedThreads = React3.useMemo(() => {
|
|
3599
3610
|
return [...threads].sort((a, b) => {
|
|
3600
3611
|
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
@@ -3602,13 +3613,6 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3602
3613
|
return dateB - dateA;
|
|
3603
3614
|
});
|
|
3604
3615
|
}, [threads]);
|
|
3605
|
-
const handleDelete = async (threadId) => {
|
|
3606
|
-
try {
|
|
3607
|
-
await deleteThread(threadId);
|
|
3608
|
-
} catch (error) {
|
|
3609
|
-
console.error("Failed to delete thread:", error);
|
|
3610
|
-
}
|
|
3611
|
-
};
|
|
3612
3616
|
return /* @__PURE__ */ jsx(List, { padding, gap, flex: "1", overflow: "scroll", children: sortedThreads.map((thread) => {
|
|
3613
3617
|
thread.id === activeThreadId;
|
|
3614
3618
|
return /* @__PURE__ */ jsxs(
|
|
@@ -3632,8 +3636,14 @@ var ThreadList = ({ padding, background, gap, radius = "md" }) => {
|
|
|
3632
3636
|
items: [
|
|
3633
3637
|
{
|
|
3634
3638
|
label: "Delete",
|
|
3635
|
-
icon:
|
|
3636
|
-
|
|
3639
|
+
icon: "trash",
|
|
3640
|
+
onClickAction: {
|
|
3641
|
+
role: "system",
|
|
3642
|
+
type: "delete-thread",
|
|
3643
|
+
data: {
|
|
3644
|
+
threadId: thread.id
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3637
3647
|
}
|
|
3638
3648
|
]
|
|
3639
3649
|
}
|