@hef2024/llmasaservice-ui 0.17.0 → 0.19.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hef2024/llmasaservice-ui",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Prebuilt UI components for LLMAsAService.io",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -190,9 +190,11 @@
190
190
  .ai-agent-panel {
191
191
  display: flex;
192
192
  flex-direction: row;
193
+ flex-wrap: nowrap; /* Prevent sidebar from wrapping below */
193
194
  /* Fill parent height - works in flex containers */
194
195
  align-self: stretch;
195
196
  height: 100%;
197
+ min-height: 400px; /* Fallback min-height when parent height is undefined */
196
198
  max-height: 100%;
197
199
  background-color: var(--ai-sidebar-bg);
198
200
  border-left: 1px solid var(--ai-sidebar-border);
@@ -211,7 +213,7 @@
211
213
 
212
214
  /* Sidebar position - left (default) */
213
215
  .ai-agent-panel--sidebar-left {
214
- flex-direction: row;
216
+ flex-direction: row !important;
215
217
  }
216
218
 
217
219
  .ai-agent-panel--sidebar-left .ai-agent-panel__sidebar {
@@ -1369,6 +1371,23 @@
1369
1371
  border: none;
1370
1372
  }
1371
1373
 
1374
+ /* --------------------------------------------------------
1375
+ Chat Header (for collapse button when no sidebar)
1376
+ -------------------------------------------------------- */
1377
+ .ai-agent-panel__chat-header {
1378
+ display: flex;
1379
+ align-items: center;
1380
+ justify-content: flex-end;
1381
+ padding: 8px;
1382
+ background-color: var(--ai-header-bg);
1383
+ border-bottom: 1px solid var(--ai-header-border);
1384
+ flex-shrink: 0;
1385
+ }
1386
+
1387
+ .ai-agent-panel__chat-header-spacer {
1388
+ flex: 1;
1389
+ }
1390
+
1372
1391
  /* --------------------------------------------------------
1373
1392
  Context Change Notification
1374
1393
  -------------------------------------------------------- */
@@ -91,6 +91,7 @@ export interface AIAgentPanelProps {
91
91
 
92
92
  // UI Configuration
93
93
  theme?: 'light' | 'dark';
94
+ collapsible?: boolean;
94
95
  defaultCollapsed?: boolean;
95
96
  defaultWidth?: number;
96
97
  minWidth?: number;
@@ -540,6 +541,7 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
540
541
  maxContextTokens = 8000,
541
542
  data = [],
542
543
  theme = 'light',
544
+ collapsible = true,
543
545
  defaultCollapsed = false,
544
546
  defaultWidth = 720,
545
547
  minWidth = 520,
@@ -567,8 +569,8 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
567
569
  historyListLimit = 50,
568
570
  showConversationHistory = true,
569
571
  }, ref) => {
570
- // Panel state
571
- const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
572
+ // Panel state - only start collapsed if collapsible is true
573
+ const [isCollapsed, setIsCollapsed] = useState(collapsible && defaultCollapsed);
572
574
  const [isHistoryCollapsed, setIsHistoryCollapsed] = useState(() => {
573
575
  if (typeof window !== 'undefined') {
574
576
  const saved = localStorage.getItem('ai-agent-panel-history-collapsed');
@@ -1642,10 +1644,11 @@ console.log("apiKey", apiKey);
1642
1644
  }
1643
1645
  }, [onConversationChange]);
1644
1646
 
1645
- // Toggle collapse
1647
+ // Toggle collapse - only if collapsible is enabled
1646
1648
  const toggleCollapse = useCallback(() => {
1649
+ if (!collapsible) return;
1647
1650
  setIsCollapsed((prev) => !prev);
1648
- }, []);
1651
+ }, [collapsible]);
1649
1652
 
1650
1653
  // Toggle history collapse
1651
1654
  const toggleHistoryCollapse = useCallback(() => {
@@ -1666,8 +1669,8 @@ console.log("apiKey", apiKey);
1666
1669
  !showConversationHistory ? 'ai-agent-panel--no-history' : '',
1667
1670
  ].filter(Boolean).join(' ');
1668
1671
 
1669
- // Collapsed view
1670
- if (isCollapsed) {
1672
+ // Collapsed view - only render if collapsible is enabled
1673
+ if (collapsible && isCollapsed) {
1671
1674
  return (
1672
1675
  <div className={panelClasses} ref={panelRef}>
1673
1676
  <div
@@ -1942,9 +1945,11 @@ console.log("apiKey", apiKey);
1942
1945
  <SidebarIcon />
1943
1946
  </Button>
1944
1947
  </Tooltip>
1945
- <Button variant="ghost" size="icon" onClick={toggleCollapse}>
1946
- {position === 'right' ? <ChevronRightIcon /> : <ChevronLeftIcon />}
1947
- </Button>
1948
+ {collapsible && (
1949
+ <Button variant="ghost" size="icon" onClick={toggleCollapse}>
1950
+ {position === 'right' ? <ChevronRightIcon /> : <ChevronLeftIcon />}
1951
+ </Button>
1952
+ )}
1948
1953
  </div>
1949
1954
 
1950
1955
  {/* Conversation list */}
@@ -2060,6 +2065,18 @@ console.log("apiKey", apiKey);
2060
2065
 
2061
2066
  {/* Chat area */}
2062
2067
  <div className="ai-agent-panel__chat">
2068
+ {/* Collapse button when no sidebar is shown */}
2069
+ {!showConversationHistory && collapsible && (
2070
+ <div className="ai-agent-panel__chat-header">
2071
+ <div className="ai-agent-panel__chat-header-spacer" />
2072
+ <Tooltip content="Collapse Panel" side={position === 'right' ? 'left' : 'right'}>
2073
+ <Button variant="ghost" size="icon" onClick={toggleCollapse}>
2074
+ {position === 'right' ? <ChevronRightIcon /> : <ChevronLeftIcon />}
2075
+ </Button>
2076
+ </Tooltip>
2077
+ </div>
2078
+ )}
2079
+
2063
2080
  {/* Context change notification */}
2064
2081
  {showContextNotification && (
2065
2082
  <div className="ai-agent-panel__context-notification">