ai-design-system 0.1.110 → 0.1.111
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/components/composites/SessionHeader/SessionHeader.tsx +9 -5
- package/components/features/ChatPanel/ChatPanel.tsx +14 -0
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +99 -87
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -28,6 +28,8 @@ export interface SessionHeaderProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
28
28
|
onSelectSession?: (id: string) => void;
|
|
29
29
|
onDownloadSession?: () => Promise<FileDownloadResult | undefined>;
|
|
30
30
|
showActions?: boolean;
|
|
31
|
+
showNewSession?: boolean;
|
|
32
|
+
showDownloadSession?: boolean;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/**
|
|
@@ -37,7 +39,7 @@ export interface SessionHeaderProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
37
39
|
* and a dropdown history of past sessions.
|
|
38
40
|
*/
|
|
39
41
|
export const SessionHeader = React.forwardRef<HTMLDivElement, SessionHeaderProps>(
|
|
40
|
-
({ title, sessions, activeSessionId, onNewSession, onCloseSession, onSelectSession, onDownloadSession, showActions = true, className, ...props }, ref) => {
|
|
42
|
+
({ title, sessions, activeSessionId, onNewSession, onCloseSession, onSelectSession, onDownloadSession, showActions = true, showNewSession = true, showDownloadSession = true, className, ...props }, ref) => {
|
|
41
43
|
const activeSession = sessions?.find(s => s.id === activeSessionId);
|
|
42
44
|
const downloadRef = React.useRef<HTMLAnchorElement>(null);
|
|
43
45
|
|
|
@@ -72,14 +74,16 @@ export const SessionHeader = React.forwardRef<HTMLDivElement, SessionHeaderProps
|
|
|
72
74
|
</div>
|
|
73
75
|
{showActions && (
|
|
74
76
|
<div className="flex items-center space-x-1 flex-none">
|
|
75
|
-
{onDownloadSession && (
|
|
77
|
+
{Boolean(onDownloadSession && showDownloadSession) && (
|
|
76
78
|
<Button variant="ghost" size="icon" onClick={handleDownloadClick} className="h-8 w-8" title="Download Chat History">
|
|
77
79
|
<Icon name="download" className="h-4 w-4" />
|
|
78
80
|
</Button>
|
|
79
81
|
)}
|
|
80
|
-
|
|
81
|
-
<
|
|
82
|
-
|
|
82
|
+
{Boolean(onNewSession && showNewSession) && (
|
|
83
|
+
<Button variant="ghost" size="icon" onClick={onNewSession} className="h-8 w-8" title="New Session">
|
|
84
|
+
<Icon name="plus" className="h-4 w-4" />
|
|
85
|
+
</Button>
|
|
86
|
+
)}
|
|
83
87
|
|
|
84
88
|
<DropdownMenu>
|
|
85
89
|
<DropdownMenuTrigger asChild>
|
|
@@ -225,6 +225,16 @@ export interface ChatPanelProps {
|
|
|
225
225
|
* @default true
|
|
226
226
|
*/
|
|
227
227
|
showSessionActions?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Whether to show the new session (+) action in the session header
|
|
230
|
+
* @default true
|
|
231
|
+
*/
|
|
232
|
+
showNewSession?: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Whether to show the download session action in the session header
|
|
235
|
+
* @default true
|
|
236
|
+
*/
|
|
237
|
+
showDownloadSession?: boolean;
|
|
228
238
|
/**
|
|
229
239
|
* Presentation variant for ChatPanel:
|
|
230
240
|
* - "default": standard full flex-1 panel (default)
|
|
@@ -286,6 +296,8 @@ export const ChatPanel = React.memo<ChatPanelProps>(
|
|
|
286
296
|
showHeader = true,
|
|
287
297
|
sessionTitle,
|
|
288
298
|
showSessionActions = true,
|
|
299
|
+
showNewSession = true,
|
|
300
|
+
showDownloadSession = true,
|
|
289
301
|
variant = "default",
|
|
290
302
|
onClose,
|
|
291
303
|
}) => {
|
|
@@ -446,6 +458,8 @@ export const ChatPanel = React.memo<ChatPanelProps>(
|
|
|
446
458
|
<SessionHeader
|
|
447
459
|
title={sessionTitle}
|
|
448
460
|
showActions={showSessionActions}
|
|
461
|
+
showNewSession={showNewSession}
|
|
462
|
+
showDownloadSession={showDownloadSession}
|
|
449
463
|
sessions={sessions}
|
|
450
464
|
activeSessionId={activeSessionId}
|
|
451
465
|
onNewSession={onNewSession}
|
package/dist/index.cjs
CHANGED
|
@@ -7921,7 +7921,7 @@ var ApprovalCard = React3__namespace.memo(
|
|
|
7921
7921
|
ApprovalCard.displayName = "ApprovalCard";
|
|
7922
7922
|
var SessionHeader = React3__namespace.forwardRef(
|
|
7923
7923
|
(_a, ref) => {
|
|
7924
|
-
var _b = _a, { title, sessions, activeSessionId, onNewSession, onCloseSession, onSelectSession, onDownloadSession, showActions = true, className } = _b, props = __objRest(_b, ["title", "sessions", "activeSessionId", "onNewSession", "onCloseSession", "onSelectSession", "onDownloadSession", "showActions", "className"]);
|
|
7924
|
+
var _b = _a, { title, sessions, activeSessionId, onNewSession, onCloseSession, onSelectSession, onDownloadSession, showActions = true, showNewSession = true, showDownloadSession = true, className } = _b, props = __objRest(_b, ["title", "sessions", "activeSessionId", "onNewSession", "onCloseSession", "onSelectSession", "onDownloadSession", "showActions", "showNewSession", "showDownloadSession", "className"]);
|
|
7925
7925
|
const activeSession = sessions == null ? void 0 : sessions.find((s) => s.id === activeSessionId);
|
|
7926
7926
|
const downloadRef = React3__namespace.useRef(null);
|
|
7927
7927
|
const handleDownloadClick = React3__namespace.useCallback(async () => {
|
|
@@ -7947,8 +7947,8 @@ var SessionHeader = React3__namespace.forwardRef(
|
|
|
7947
7947
|
children: [
|
|
7948
7948
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-2 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium truncate", children: displayTitle }) }),
|
|
7949
7949
|
showActions && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-1 flex-none", children: [
|
|
7950
|
-
onDownloadSession && /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "ghost", size: "icon", onClick: handleDownloadClick, className: "h-8 w-8", title: "Download Chat History", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "download", className: "h-4 w-4" }) }),
|
|
7951
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "ghost", size: "icon", onClick: onNewSession, className: "h-8 w-8", title: "New Session", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "plus", className: "h-4 w-4" }) }),
|
|
7950
|
+
Boolean(onDownloadSession && showDownloadSession) && /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "ghost", size: "icon", onClick: handleDownloadClick, className: "h-8 w-8", title: "Download Chat History", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "download", className: "h-4 w-4" }) }),
|
|
7951
|
+
Boolean(onNewSession && showNewSession) && /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "ghost", size: "icon", onClick: onNewSession, className: "h-8 w-8", title: "New Session", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "plus", className: "h-4 w-4" }) }),
|
|
7952
7952
|
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2, { children: [
|
|
7953
7953
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "clock", className: "h-4 w-4" }) }) }),
|
|
7954
7954
|
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "end", className: "w-64 max-h-80 overflow-y-auto", children: [
|
|
@@ -8180,6 +8180,8 @@ var ChatPanel = React3__namespace.memo(
|
|
|
8180
8180
|
showHeader = true,
|
|
8181
8181
|
sessionTitle,
|
|
8182
8182
|
showSessionActions = true,
|
|
8183
|
+
showNewSession = true,
|
|
8184
|
+
showDownloadSession = true,
|
|
8183
8185
|
variant = "default",
|
|
8184
8186
|
onClose
|
|
8185
8187
|
}) => {
|
|
@@ -8305,6 +8307,8 @@ var ChatPanel = React3__namespace.memo(
|
|
|
8305
8307
|
{
|
|
8306
8308
|
title: sessionTitle,
|
|
8307
8309
|
showActions: showSessionActions,
|
|
8310
|
+
showNewSession,
|
|
8311
|
+
showDownloadSession,
|
|
8308
8312
|
sessions,
|
|
8309
8313
|
activeSessionId,
|
|
8310
8314
|
onNewSession,
|