@axiom-lattice/react-sdk 2.1.36 → 2.1.37

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.d.mts CHANGED
@@ -1117,6 +1117,11 @@ interface LatticeChatShellConfig {
1117
1117
  * Defaults to "Lattice"
1118
1118
  */
1119
1119
  sidebarLogoText?: string;
1120
+ /**
1121
+ * Custom logo icon component
1122
+ * If not provided, defaults to Cpu icon
1123
+ */
1124
+ sidebarLogoIcon?: React.ReactNode;
1120
1125
  }
1121
1126
  /**
1122
1127
  * Lattice Chat Shell context value interface
package/dist/index.d.ts CHANGED
@@ -1117,6 +1117,11 @@ interface LatticeChatShellConfig {
1117
1117
  * Defaults to "Lattice"
1118
1118
  */
1119
1119
  sidebarLogoText?: string;
1120
+ /**
1121
+ * Custom logo icon component
1122
+ * If not provided, defaults to Cpu icon
1123
+ */
1124
+ sidebarLogoIcon?: React.ReactNode;
1120
1125
  }
1121
1126
  /**
1122
1127
  * Lattice Chat Shell context value interface
package/dist/index.js CHANGED
@@ -3121,14 +3121,86 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
3121
3121
  padding: 0;
3122
3122
  }
3123
3123
  `,
3124
- // Expanded sidebar styles
3124
+ // Icon mode styles (collapsed view) - Clean & Simple
3125
+ iconMode: css`
3126
+ display: flex;
3127
+ flex-direction: column;
3128
+ height: 100%;
3129
+ width: 100%;
3130
+ padding: 16px 8px;
3131
+ overflow-y: auto;
3132
+ overflow-x: hidden;
3133
+ `,
3134
+ iconModeLogo: css`
3135
+ display: flex;
3136
+ align-items: center;
3137
+ justify-content: center;
3138
+ width: 40px;
3139
+ height: 40px;
3140
+ margin: 8px auto 16px auto;
3141
+ flex-shrink: 0;
3142
+ border-radius: 12px;
3143
+ transition: all 0.2s ease;
3144
+
3145
+ &:hover {
3146
+ background: rgba(0, 0, 0, 0.04);
3147
+ }
3148
+ `,
3149
+ iconModeContainer: css`
3150
+ display: flex;
3151
+ flex-direction: column;
3152
+ gap: 4px;
3153
+ flex: 1;
3154
+ overflow-y: auto;
3155
+ `,
3156
+ iconModeDivider: css`
3157
+ width: 24px;
3158
+ height: 1px;
3159
+ background: ${token.colorBorder};
3160
+ margin: 8px auto;
3161
+ flex-shrink: 0;
3162
+ `,
3163
+ iconModeGroup: css`
3164
+ display: flex;
3165
+ flex-direction: column;
3166
+ gap: 4px;
3167
+ align-items: center;
3168
+ `,
3169
+ iconModeButton: css`
3170
+ display: flex;
3171
+ align-items: center;
3172
+ justify-content: center;
3173
+ width: 40px;
3174
+ height: 40px;
3175
+ border-radius: 10px;
3176
+ border: 1px solid transparent;
3177
+ background: transparent;
3178
+ color: ${token.colorTextSecondary};
3179
+ cursor: pointer;
3180
+ transition: all 0.2s ease;
3181
+
3182
+ &:hover {
3183
+ background: rgba(0, 0, 0, 0.04);
3184
+ color: ${token.colorPrimary};
3185
+ }
3186
+
3187
+ &:active {
3188
+ background: rgba(0, 0, 0, 0.08);
3189
+ }
3190
+
3191
+ .lucide {
3192
+ width: 22px;
3193
+ height: 22px;
3194
+ }
3195
+ `,
3196
+ // Expanded sidebar styles - Clean & Simple
3125
3197
  expandedMenu: css`
3126
3198
  display: flex;
3127
3199
  flex-direction: column;
3128
3200
  height: 100%;
3129
3201
  width: 100%;
3130
- padding: ${token.paddingMD}px;
3131
- gap: ${token.marginSM}px;
3202
+ padding: 16px;
3203
+ gap: 8px;
3132
3204
  overflow-y: auto;
3133
3205
  overflow-x: hidden;
3134
3206
  `,
@@ -3139,7 +3211,7 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
3139
3211
  padding: 8px 12px;
3140
3212
  margin-bottom: 16px;
3141
3213
  font-size: 18px;
3142
- font-weight: 700;
3214
+ font-weight: 600;
3143
3215
  color: ${token.colorText};
3144
3216
  white-space: nowrap;
3145
3217
  overflow: hidden;
@@ -3154,7 +3226,7 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
3154
3226
  }
3155
3227
 
3156
3228
  .logo-text {
3157
- transition: opacity 0.3s ease, width 0.3s ease;
3229
+ transition: all 0.2s ease;
3158
3230
  opacity: 1;
3159
3231
  }
3160
3232
 
@@ -3169,25 +3241,29 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
3169
3241
  justify-content: center;
3170
3242
  gap: 8px;
3171
3243
  padding: 10px 16px;
3172
- background: ${token.colorBgContainer};
3173
- border: 1px solid ${token.colorBorder};
3174
- border-radius: ${token.borderRadius}px;
3244
+ background: ${token.colorPrimary};
3245
+ border: none;
3246
+ border-radius: 20px;
3175
3247
  margin: 0 12px 16px 12px;
3176
3248
  cursor: pointer;
3177
- transition: all 0.3s ease;
3249
+ transition: all 0.2s ease;
3178
3250
  font-size: 14px;
3179
- color: ${token.colorText};
3251
+ font-weight: 600;
3252
+ color: white;
3180
3253
  white-space: nowrap;
3181
3254
  overflow: hidden;
3182
3255
 
3183
3256
  &:hover {
3184
- background: ${token.colorBgTextHover};
3185
- border-color: ${token.colorPrimary};
3186
- color: ${token.colorPrimary};
3257
+ opacity: 0.9;
3258
+ transform: translateY(-1px);
3259
+ }
3260
+
3261
+ &:active {
3262
+ transform: translateY(0);
3187
3263
  }
3188
3264
 
3189
3265
  .btn-text {
3190
- transition: opacity 0.3s ease, width 0.3s ease;
3266
+ transition: all 0.2s ease;
3191
3267
  opacity: 1;
3192
3268
  }
3193
3269
 
@@ -3197,7 +3273,7 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
3197
3273
  height: 40px;
3198
3274
  padding: 0;
3199
3275
  margin: 0 auto 16px auto;
3200
- border-radius: ${token.borderRadius}px;
3276
+ border-radius: 10px;
3201
3277
 
3202
3278
  .btn-text {
3203
3279
  opacity: 0;
@@ -3219,7 +3295,7 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
3219
3295
  margin-bottom: 4px;
3220
3296
  white-space: nowrap;
3221
3297
  overflow: hidden;
3222
- transition: opacity 0.3s ease;
3298
+ transition: all 0.2s ease;
3223
3299
 
3224
3300
  &.collapsed {
3225
3301
  opacity: 0;
@@ -3233,33 +3309,45 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
3233
3309
  align-items: center;
3234
3310
  gap: 12px;
3235
3311
  padding: 10px 12px;
3236
- border-radius: ${token.borderRadius}px;
3312
+ border-radius: 10px;
3237
3313
  color: ${token.colorText};
3238
- transition: all 0.2s;
3314
+ transition: all 0.2s ease;
3239
3315
  cursor: pointer;
3240
3316
  border: none;
3241
3317
  background: transparent;
3242
3318
  width: 100%;
3243
3319
  text-align: left;
3244
3320
  font-size: 14px;
3321
+ font-weight: 500;
3245
3322
  white-space: nowrap;
3246
3323
  overflow: hidden;
3247
3324
 
3248
3325
  &:hover {
3249
- background: ${token.colorBgTextHover};
3326
+ background: rgba(0, 0, 0, 0.04);
3327
+ color: ${token.colorPrimary};
3328
+ }
3329
+
3330
+ &:active {
3331
+ background: rgba(0, 0, 0, 0.08);
3250
3332
  }
3251
3333
 
3252
3334
  .menu-icon {
3253
3335
  flex-shrink: 0;
3254
- width: 20px;
3255
- height: 20px;
3336
+ width: 22px;
3337
+ height: 22px;
3256
3338
  display: flex;
3257
3339
  align-items: center;
3258
3340
  justify-content: center;
3341
+ color: ${token.colorTextSecondary};
3342
+ transition: all 0.2s ease;
3343
+ }
3344
+
3345
+ &:hover .menu-icon {
3346
+ color: ${token.colorPrimary};
3259
3347
  }
3260
3348
 
3261
3349
  .menu-label {
3262
- transition: opacity 0.3s ease, width 0.3s ease;
3350
+ transition: all 0.2s ease;
3263
3351
  opacity: 1;
3264
3352
  flex: 1;
3265
3353
  }
@@ -3270,7 +3358,7 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
3270
3358
  width: 40px;
3271
3359
  height: 40px;
3272
3360
  margin: 0 auto;
3273
- border-radius: ${token.borderRadius}px;
3361
+ border-radius: 10px;
3274
3362
 
3275
3363
  .menu-label {
3276
3364
  opacity: 0;
@@ -3279,43 +3367,38 @@ var useStyle = (0, import_antd_style2.createStyles)(({ token, css }) => {
3279
3367
  }
3280
3368
  }
3281
3369
  `,
3282
- menuToggleBtn: css`
3283
- position: absolute;
3284
- right: -12px;
3285
- top: 80px;
3286
- width: 24px;
3287
- height: 48px;
3288
- border-radius: 0 8px 8px 0;
3289
- background: ${token.colorBgContainer};
3290
- border: 1px solid ${token.colorBorder};
3291
- border-left: none;
3292
- cursor: pointer;
3370
+ buttonContainerExpanded: css`
3371
+ display: flex;
3372
+ flex-direction: column;
3373
+ gap: 4px;
3374
+ align-items: stretch;
3375
+ flex: 1;
3376
+ overflow-y: auto;
3377
+ `,
3378
+ collapseBtn: css`
3293
3379
  display: flex;
3294
3380
  align-items: center;
3295
3381
  justify-content: center;
3296
- box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
3297
- z-index: 10;
3298
- transition: all 0.2s;
3382
+ width: 32px;
3383
+ height: 32px;
3384
+ border-radius: 8px;
3385
+ border: 1px solid ${token.colorBorder};
3386
+ background: ${token.colorBgContainer};
3387
+ cursor: pointer;
3388
+ margin-left: auto;
3389
+ transition: all 0.2s ease;
3390
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
3299
3391
 
3300
3392
  &:hover {
3301
3393
  background: ${token.colorBgTextHover};
3302
- width: 28px;
3303
- right: -14px;
3394
+ border-color: ${token.colorPrimary};
3395
+ color: ${token.colorPrimary};
3304
3396
  }
3305
3397
 
3306
3398
  .lucide {
3307
- width: 16px;
3308
- height: 16px;
3309
- color: ${token.colorTextSecondary};
3399
+ width: 18px;
3400
+ height: 18px;
3310
3401
  }
3311
- `,
3312
- buttonContainerExpanded: css`
3313
- display: flex;
3314
- flex-direction: column;
3315
- gap: ${token.marginXS}px;
3316
- align-items: stretch;
3317
- flex: 1;
3318
- overflow-y: auto;
3319
3402
  `
3320
3403
  };
3321
3404
  });
@@ -3334,7 +3417,7 @@ var ColumnLayout = ({
3334
3417
  menu && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3335
3418
  "div",
3336
3419
  {
3337
- className: `${styles.menu} ${"open"} ${sideAppVisible || menuCollapsed ? "collapsed" : ""}`,
3420
+ className: `${styles.menu} ${"open"} ${sideAppVisible || menuCollapsed ? "collapsed" : "expanded"}`,
3338
3421
  children: [
3339
3422
  logo,
3340
3423
  menu
@@ -13401,7 +13484,7 @@ var MetricsConfigFormModal = ({
13401
13484
  var import_react61 = require("react");
13402
13485
 
13403
13486
  // src/components/Chat/ChatSidebar.tsx
13404
- var import_react60 = require("react");
13487
+ var import_react60 = __toESM(require("react"));
13405
13488
  var import_antd61 = require("antd");
13406
13489
  var import_lucide_react13 = require("lucide-react");
13407
13490
  var import_antd_style21 = require("antd-style");
@@ -20355,7 +20438,7 @@ var ChatSidebar = ({
20355
20438
  const { styles } = useStyle();
20356
20439
  const { setSettingsModalOpen, config } = useLatticeChatShellContext();
20357
20440
  const { selectAssistant } = useAssistantContext();
20358
- const { openSideApp, sideAppVisible } = useChatUIContext();
20441
+ const { openSideApp, sideAppVisible, setMenuCollapsed } = useChatUIContext();
20359
20442
  const workspaceContext = useWorkspaceContext();
20360
20443
  const [drawerStates, setDrawerStates] = (0, import_react60.useState)({});
20361
20444
  const [userExpanded, setUserExpanded] = (0, import_react60.useState)(config.sidebarDefaultExpanded ?? true);
@@ -20364,12 +20447,26 @@ var ChatSidebar = ({
20364
20447
  sidebarMode,
20365
20448
  sidebarShowToggle,
20366
20449
  sidebarShowNewAnalysis,
20367
- sidebarLogoText
20450
+ sidebarLogoText,
20451
+ sidebarLogoIcon
20368
20452
  } = config;
20369
20453
  const hasWorkspace = enableWorkspace && workspaceContext;
20370
20454
  const isExpandedMode = sidebarMode === "expanded";
20371
- const isExpanded = isExpandedMode && !sideAppVisible && userExpanded;
20455
+ const [isIconView, setIsIconView] = (0, import_react60.useState)(!isExpandedMode || !userExpanded);
20456
+ const isExpanded = isExpandedMode && !sideAppVisible && !isIconView;
20372
20457
  const isCollapsed = !isExpanded;
20458
+ (0, import_react60.useEffect)(() => {
20459
+ if (isExpandedMode) {
20460
+ setMenuCollapsed(isIconView);
20461
+ }
20462
+ }, [isExpandedMode, isIconView, setMenuCollapsed]);
20463
+ (0, import_react60.useEffect)(() => {
20464
+ if (isExpandedMode) {
20465
+ setIsIconView(!userExpanded);
20466
+ } else {
20467
+ setIsIconView(true);
20468
+ }
20469
+ }, [isExpandedMode, userExpanded]);
20373
20470
  const menuItems = (0, import_react60.useMemo)(() => {
20374
20471
  const items = [];
20375
20472
  for (const item of DEFAULT_MENU_ITEMS) {
@@ -20441,7 +20538,7 @@ var ChatSidebar = ({
20441
20538
  }, []);
20442
20539
  const handleToggleExpand = (0, import_react60.useCallback)(() => {
20443
20540
  if (!sideAppVisible) {
20444
- setUserExpanded((prev) => !prev);
20541
+ setIsIconView((prev) => !prev);
20445
20542
  }
20446
20543
  }, [sideAppVisible]);
20447
20544
  const handleNewAnalysis = (0, import_react60.useCallback)(() => {
@@ -20461,21 +20558,48 @@ var ChatSidebar = ({
20461
20558
  return item.content;
20462
20559
  }
20463
20560
  }, []);
20464
- const renderIconMode = () => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: sidebarStyles.sidebar, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: sidebarStyles.buttonContainer, children: menuItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
20465
- "button",
20466
- {
20467
- className: sidebarStyles.actionButton,
20468
- onClick: () => handleMenuClick(item),
20469
- title: item.name,
20470
- "aria-label": item.name,
20471
- children: item.icon
20472
- },
20473
- item.id
20474
- )) }) });
20561
+ const renderIconMode = () => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `${sidebarStyles.sidebar} ${styles.iconMode}`, children: [
20562
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: styles.iconModeLogo, children: sidebarLogoIcon || /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react13.Cpu, { size: 28, color: "#1677ff" }) }),
20563
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: styles.iconModeContainer, children: groupedItems.map(({ group, items }, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_react60.default.Fragment, { children: [
20564
+ groupIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: styles.iconModeDivider }),
20565
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: styles.iconModeGroup, children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
20566
+ "button",
20567
+ {
20568
+ className: styles.iconModeButton,
20569
+ onClick: () => handleMenuClick(item),
20570
+ title: item.name,
20571
+ "aria-label": item.name,
20572
+ children: item.icon
20573
+ },
20574
+ item.id
20575
+ )) })
20576
+ ] }, group || `group-${groupIndex}`)) }),
20577
+ sidebarShowToggle && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
20578
+ "button",
20579
+ {
20580
+ className: styles.iconModeButton,
20581
+ onClick: handleToggleExpand,
20582
+ title: "Expand sidebar",
20583
+ "aria-label": "Expand sidebar",
20584
+ style: { marginTop: "auto" },
20585
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react13.ChevronRight, { size: 22 })
20586
+ }
20587
+ )
20588
+ ] });
20475
20589
  const renderExpandedMode = () => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `${sidebarStyles.sidebar} ${styles.expandedMenu}`, children: [
20476
20590
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: `${styles.expandedMenuLogo} ${isCollapsed ? "collapsed" : ""}`, children: [
20477
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "logo-icon", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react13.Cpu, { size: 28, color: "#1677ff" }) }),
20478
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "logo-text", children: sidebarLogoText })
20591
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "logo-icon", children: sidebarLogoIcon || /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react13.Cpu, { size: 28, color: "#1677ff" }) }),
20592
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "logo-text", children: sidebarLogoText }),
20593
+ sidebarShowToggle && !sideAppVisible && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
20594
+ "button",
20595
+ {
20596
+ className: styles.collapseBtn,
20597
+ onClick: handleToggleExpand,
20598
+ title: "Collapse sidebar",
20599
+ "aria-label": "Collapse sidebar",
20600
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react13.PanelLeftClose, { size: 18 })
20601
+ }
20602
+ )
20479
20603
  ] }),
20480
20604
  sidebarShowNewAnalysis && /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
20481
20605
  "button",
@@ -20504,20 +20628,10 @@ var ChatSidebar = ({
20504
20628
  },
20505
20629
  item.id
20506
20630
  ))
20507
- ] }, group || "ungrouped")) }),
20508
- isExpandedMode && sidebarShowToggle && !sideAppVisible && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
20509
- "button",
20510
- {
20511
- className: styles.menuToggleBtn,
20512
- onClick: handleToggleExpand,
20513
- title: isExpanded ? "Collapse sidebar" : "Expand sidebar",
20514
- "aria-label": isExpanded ? "Collapse sidebar" : "Expand sidebar",
20515
- children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react13.ChevronLeft, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_lucide_react13.ChevronRight, { size: 16 })
20516
- }
20517
- )
20631
+ ] }, group || "ungrouped")) })
20518
20632
  ] });
20519
20633
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(import_jsx_runtime83.Fragment, { children: [
20520
- isExpandedMode ? renderExpandedMode() : renderIconMode(),
20634
+ isIconView ? renderIconMode() : renderExpandedMode(),
20521
20635
  menuItems.filter((item) => item.type === "drawer").map((item) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
20522
20636
  import_antd61.Drawer,
20523
20637
  {