@pactor-app/ui 1.35.0 → 1.41.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.
@@ -443,7 +443,7 @@ function ShadcnDrawerView({
443
443
  "data-slot": "drawer-panel",
444
444
  className: cn(entry.width !== void 0 && "sm:max-w-none"),
445
445
  style: panelStyle,
446
- overlayProps: { onClick: onCancel },
446
+ overlayProps: { onPointerDown: onCancel },
447
447
  children: [
448
448
  /* @__PURE__ */ jsxs2(
449
449
  DrawerHeader,
@@ -238,18 +238,31 @@ function CardFooter({ className, ...props }) {
238
238
  );
239
239
  }
240
240
 
241
+ // src/ui/skeleton.tsx
242
+ import { jsx as jsx4 } from "react/jsx-runtime";
243
+ function Skeleton({ className, ...props }) {
244
+ return /* @__PURE__ */ jsx4(
245
+ "div",
246
+ {
247
+ "data-slot": "skeleton",
248
+ className: cn("animate-pulse rounded-md bg-muted", className),
249
+ ...props
250
+ }
251
+ );
252
+ }
253
+
241
254
  // src/ui/popover.tsx
242
255
  import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
243
- import { jsx as jsx4 } from "react/jsx-runtime";
256
+ import { jsx as jsx5 } from "react/jsx-runtime";
244
257
  function Popover({
245
258
  ...props
246
259
  }) {
247
- return /* @__PURE__ */ jsx4(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
260
+ return /* @__PURE__ */ jsx5(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
248
261
  }
249
262
  function PopoverTrigger({
250
263
  ...props
251
264
  }) {
252
- return /* @__PURE__ */ jsx4(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
265
+ return /* @__PURE__ */ jsx5(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
253
266
  }
254
267
  function PopoverContent({
255
268
  className,
@@ -259,7 +272,7 @@ function PopoverContent({
259
272
  anchor,
260
273
  ...props
261
274
  }) {
262
- return /* @__PURE__ */ jsx4(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
275
+ return /* @__PURE__ */ jsx5(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx5(
263
276
  PopoverPrimitive.Positioner,
264
277
  {
265
278
  align,
@@ -267,7 +280,7 @@ function PopoverContent({
267
280
  sideOffset,
268
281
  anchor,
269
282
  className: "isolate z-50",
270
- children: /* @__PURE__ */ jsx4(
283
+ children: /* @__PURE__ */ jsx5(
271
284
  PopoverPrimitive.Popup,
272
285
  {
273
286
  "data-slot": "popover-content",
@@ -283,9 +296,9 @@ function PopoverContent({
283
296
  }
284
297
 
285
298
  // src/ui/input.tsx
286
- import { jsx as jsx5 } from "react/jsx-runtime";
299
+ import { jsx as jsx6 } from "react/jsx-runtime";
287
300
  function Input({ className, type, ...props }) {
288
- return /* @__PURE__ */ jsx5(
301
+ return /* @__PURE__ */ jsx6(
289
302
  "input",
290
303
  {
291
304
  type,
@@ -301,14 +314,14 @@ function Input({ className, type, ...props }) {
301
314
 
302
315
  // src/ui/separator.tsx
303
316
  import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
304
- import { jsx as jsx6 } from "react/jsx-runtime";
317
+ import { jsx as jsx7 } from "react/jsx-runtime";
305
318
  function Separator({
306
319
  className,
307
320
  orientation = "horizontal",
308
321
  decorative: _decorative,
309
322
  ...props
310
323
  }) {
311
- return /* @__PURE__ */ jsx6(
324
+ return /* @__PURE__ */ jsx7(
312
325
  SeparatorPrimitive,
313
326
  {
314
327
  "data-slot": "separator",
@@ -326,32 +339,32 @@ function Separator({
326
339
  import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
327
340
  import { XIcon } from "lucide-react";
328
341
  import { cva } from "class-variance-authority";
329
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
342
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
330
343
  function Sheet({
331
344
  ...props
332
345
  }) {
333
- return /* @__PURE__ */ jsx7(DialogPrimitive.Root, { "data-slot": "sheet", ...props });
346
+ return /* @__PURE__ */ jsx8(DialogPrimitive.Root, { "data-slot": "sheet", ...props });
334
347
  }
335
348
  function SheetTrigger({
336
349
  ...props
337
350
  }) {
338
- return /* @__PURE__ */ jsx7(DialogPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
351
+ return /* @__PURE__ */ jsx8(DialogPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
339
352
  }
340
353
  function SheetClose({
341
354
  ...props
342
355
  }) {
343
- return /* @__PURE__ */ jsx7(DialogPrimitive.Close, { "data-slot": "sheet-close", ...props });
356
+ return /* @__PURE__ */ jsx8(DialogPrimitive.Close, { "data-slot": "sheet-close", ...props });
344
357
  }
345
358
  function SheetPortal({
346
359
  ...props
347
360
  }) {
348
- return /* @__PURE__ */ jsx7(DialogPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
361
+ return /* @__PURE__ */ jsx8(DialogPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
349
362
  }
350
363
  function SheetOverlay({
351
364
  className,
352
365
  ...props
353
366
  }) {
354
- return /* @__PURE__ */ jsx7(
367
+ return /* @__PURE__ */ jsx8(
355
368
  DialogPrimitive.Backdrop,
356
369
  {
357
370
  "data-slot": "sheet-overlay",
@@ -386,7 +399,7 @@ function SheetContent({
386
399
  ...props
387
400
  }) {
388
401
  return /* @__PURE__ */ jsxs3(SheetPortal, { "data-slot": "sheet-portal", children: [
389
- /* @__PURE__ */ jsx7(SheetOverlay, {}),
402
+ /* @__PURE__ */ jsx8(SheetOverlay, {}),
390
403
  /* @__PURE__ */ jsxs3(
391
404
  DialogPrimitive.Popup,
392
405
  {
@@ -399,7 +412,7 @@ function SheetContent({
399
412
  DialogPrimitive.Close,
400
413
  {
401
414
  "data-slot": "sheet-close",
402
- render: /* @__PURE__ */ jsx7(
415
+ render: /* @__PURE__ */ jsx8(
403
416
  "button",
404
417
  {
405
418
  type: "button",
@@ -407,8 +420,8 @@ function SheetContent({
407
420
  }
408
421
  ),
409
422
  children: [
410
- /* @__PURE__ */ jsx7(XIcon, {}),
411
- /* @__PURE__ */ jsx7("span", { className: "sr-only", children: "Close" })
423
+ /* @__PURE__ */ jsx8(XIcon, {}),
424
+ /* @__PURE__ */ jsx8("span", { className: "sr-only", children: "Close" })
412
425
  ]
413
426
  }
414
427
  )
@@ -418,7 +431,7 @@ function SheetContent({
418
431
  ] });
419
432
  }
420
433
  function SheetHeader({ className, ...props }) {
421
- return /* @__PURE__ */ jsx7(
434
+ return /* @__PURE__ */ jsx8(
422
435
  "div",
423
436
  {
424
437
  "data-slot": "sheet-header",
@@ -428,7 +441,7 @@ function SheetHeader({ className, ...props }) {
428
441
  );
429
442
  }
430
443
  function SheetFooter({ className, ...props }) {
431
- return /* @__PURE__ */ jsx7(
444
+ return /* @__PURE__ */ jsx8(
432
445
  "div",
433
446
  {
434
447
  "data-slot": "sheet-footer",
@@ -441,7 +454,7 @@ function SheetTitle({
441
454
  className,
442
455
  ...props
443
456
  }) {
444
- return /* @__PURE__ */ jsx7(
457
+ return /* @__PURE__ */ jsx8(
445
458
  DialogPrimitive.Title,
446
459
  {
447
460
  "data-slot": "sheet-title",
@@ -454,7 +467,7 @@ function SheetDescription({
454
467
  className,
455
468
  ...props
456
469
  }) {
457
- return /* @__PURE__ */ jsx7(
470
+ return /* @__PURE__ */ jsx8(
458
471
  DialogPrimitive.Description,
459
472
  {
460
473
  "data-slot": "sheet-description",
@@ -464,19 +477,6 @@ function SheetDescription({
464
477
  );
465
478
  }
466
479
 
467
- // src/ui/skeleton.tsx
468
- import { jsx as jsx8 } from "react/jsx-runtime";
469
- function Skeleton({ className, ...props }) {
470
- return /* @__PURE__ */ jsx8(
471
- "div",
472
- {
473
- "data-slot": "skeleton",
474
- className: cn("animate-pulse rounded-md bg-muted", className),
475
- ...props
476
- }
477
- );
478
- }
479
-
480
480
  // src/ui/sidebar.tsx
481
481
  import * as React from "react";
482
482
  import { cva as cva2 } from "class-variance-authority";
@@ -1168,6 +1168,7 @@ export {
1168
1168
  CardAction,
1169
1169
  CardContent,
1170
1170
  CardFooter,
1171
+ Skeleton,
1171
1172
  Popover,
1172
1173
  PopoverTrigger,
1173
1174
  PopoverContent,
@@ -1184,7 +1185,6 @@ export {
1184
1185
  SheetFooter,
1185
1186
  SheetTitle,
1186
1187
  SheetDescription,
1187
- Skeleton,
1188
1188
  useSidebar,
1189
1189
  SidebarProvider,
1190
1190
  SidebarRoot,
@@ -2,7 +2,7 @@ import {
2
2
  Popover,
3
3
  PopoverContent,
4
4
  PopoverTrigger
5
- } from "./chunk-RB7RCKAX.js";
5
+ } from "./chunk-IBMIQXOM.js";
6
6
  import {
7
7
  Button,
8
8
  buttonVariants,
@@ -675,15 +675,16 @@ function CarouselNext({
675
675
 
676
676
  // src/ui/checkbox.tsx
677
677
  import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
678
- import { CheckIcon } from "lucide-react";
678
+ import { CheckIcon, MinusIcon } from "lucide-react";
679
679
  import { jsx as jsx10 } from "react/jsx-runtime";
680
- function Checkbox({ className, ...props }) {
680
+ function Checkbox({ className, indeterminate, ...props }) {
681
681
  return /* @__PURE__ */ jsx10(
682
682
  CheckboxPrimitive.Root,
683
683
  {
684
684
  "data-slot": "checkbox",
685
+ indeterminate,
685
686
  className: cn(
686
- "peer size-4 shrink-0 cursor-pointer rounded-[4px] border border-input shadow-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground",
687
+ "peer size-4 shrink-0 cursor-pointer rounded-[4px] border border-input shadow-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[disabled]:cursor-not-allowed data-[disabled]:bg-muted data-[disabled]:opacity-60 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground",
687
688
  className
688
689
  ),
689
690
  ...props,
@@ -692,7 +693,7 @@ function Checkbox({ className, ...props }) {
692
693
  {
693
694
  "data-slot": "checkbox-indicator",
694
695
  className: "flex items-center justify-center text-current",
695
- children: /* @__PURE__ */ jsx10(CheckIcon, { className: "size-3.5" })
696
+ children: indeterminate ? /* @__PURE__ */ jsx10(MinusIcon, { className: "size-3.5" }) : /* @__PURE__ */ jsx10(CheckIcon, { className: "size-3.5" })
696
697
  }
697
698
  )
698
699
  }
@@ -982,12 +983,18 @@ function ContextMenuSeparator({
982
983
 
983
984
  // src/ui/table.tsx
984
985
  import { jsx as jsx16 } from "react/jsx-runtime";
985
- function Table({ className, ...props }) {
986
+ function Table({
987
+ className,
988
+ containerClassName,
989
+ containerStyle,
990
+ ...props
991
+ }) {
986
992
  return /* @__PURE__ */ jsx16(
987
993
  "div",
988
994
  {
989
995
  "data-slot": "table-container",
990
- className: "relative w-full overflow-x-auto",
996
+ className: cn("relative w-full overflow-x-auto", containerClassName),
997
+ style: containerStyle,
991
998
  children: /* @__PURE__ */ jsx16(
992
999
  "table",
993
1000
  {
@@ -1406,7 +1413,7 @@ function InputGroupInput({
1406
1413
 
1407
1414
  // src/ui/input-otp.tsx
1408
1415
  import { OTPInput, OTPInputContext } from "input-otp";
1409
- import { MinusIcon } from "lucide-react";
1416
+ import { MinusIcon as MinusIcon2 } from "lucide-react";
1410
1417
  import * as React3 from "react";
1411
1418
  import { jsx as jsx22, jsxs as jsxs8 } from "react/jsx-runtime";
1412
1419
  function InputOTP({
@@ -1462,7 +1469,7 @@ function InputOTPSlot({
1462
1469
  );
1463
1470
  }
1464
1471
  function InputOTPSeparator({ ...props }) {
1465
- return /* @__PURE__ */ jsx22("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx22(MinusIcon, {}) });
1472
+ return /* @__PURE__ */ jsx22("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx22(MinusIcon2, {}) });
1466
1473
  }
1467
1474
 
1468
1475
  // src/ui/item.tsx
@@ -2202,7 +2209,7 @@ function SelectTrigger({
2202
2209
  "data-slot": "select-trigger",
2203
2210
  "data-size": size,
2204
2211
  className: cn(
2205
- "flex w-fit cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 data-[placeholder]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
2212
+ "flex w-fit cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 data-[size=lg]:h-10 data-[placeholder]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
2206
2213
  className
2207
2214
  ),
2208
2215
  ...props,
@@ -16,7 +16,7 @@ import {
16
16
  TooltipTrigger,
17
17
  useIsMobile,
18
18
  useSidebar
19
- } from "./chunk-RB7RCKAX.js";
19
+ } from "./chunk-IBMIQXOM.js";
20
20
  import {
21
21
  cn
22
22
  } from "./chunk-WKJUCGV4.js";
@@ -63,10 +63,12 @@ import {
63
63
  Folder,
64
64
  Funnel,
65
65
  Globe,
66
+ GripVertical,
66
67
  Heart,
67
68
  History,
68
69
  House,
69
70
  Image,
71
+ Inbox,
70
72
  Info,
71
73
  Key,
72
74
  Languages,
@@ -179,6 +181,7 @@ var ICONS = {
179
181
  sun: Sun,
180
182
  moon: Moon,
181
183
  globe: Globe,
184
+ "grip-vertical": GripVertical,
182
185
  filter: Funnel,
183
186
  "list-filter": ListFilter,
184
187
  "more-horizontal": Ellipsis,
@@ -213,6 +216,7 @@ var ICONS = {
213
216
  terminal: Terminal,
214
217
  code: Code,
215
218
  database: Database,
219
+ inbox: Inbox,
216
220
  cloud: Cloud,
217
221
  languages: Languages,
218
222
  // @pactor-app/chat 收敛(spec: chat-icon-convergence):chat 既有图标与
@@ -400,6 +404,7 @@ function Sidebar({
400
404
  content,
401
405
  sidebarFooter,
402
406
  collapsible,
407
+ defaultCollapsed,
403
408
  onCollapse,
404
409
  locationKey,
405
410
  drawer = true,
@@ -410,7 +415,7 @@ function Sidebar({
410
415
  return /* @__PURE__ */ jsx3(
411
416
  SidebarProvider,
412
417
  {
413
- defaultOpen: true,
418
+ defaultOpen: !defaultCollapsed,
414
419
  className,
415
420
  style,
416
421
  children: /* @__PURE__ */ jsx3(
@@ -459,6 +464,7 @@ function SidebarInner({
459
464
  }, [locationKey, setOpenMobile]);
460
465
  const collapsedEffective = collapsible === true && collapsed && !isMobile;
461
466
  const brandNode = /* @__PURE__ */ jsx3(BrandNode, { brand, collapsed: collapsedEffective });
467
+ const collapsedBrandLogo = collapsedEffective && isBrandObject(brand) && brand.logo ? brand.logo : null;
462
468
  const sidebarContent = content !== void 0 && content !== null ? /* @__PURE__ */ jsx3(SidebarContentSlot, { content }) : items.length > 0 ? /* @__PURE__ */ jsx3(SidebarNavItems, { items }) : null;
463
469
  return /* @__PURE__ */ jsxs2(Fragment, { children: [
464
470
  /* @__PURE__ */ jsxs2(
@@ -466,33 +472,57 @@ function SidebarInner({
466
472
  {
467
473
  collapsible: collapsible ? "icon" : "offcanvas",
468
474
  children: [
469
- (brand !== void 0 || collapsible) && /* @__PURE__ */ jsx3(SidebarHeader, { children: /* @__PURE__ */ jsxs2(
470
- "div",
475
+ (brand !== void 0 || collapsible) && /* @__PURE__ */ jsx3(
476
+ SidebarHeader,
477
+ {
478
+ className: brand === void 0 ? "h-9" : void 0,
479
+ children: /* @__PURE__ */ jsxs2(
480
+ "div",
481
+ {
482
+ "data-slot": "sidebar-brand",
483
+ className: cn(
484
+ "flex shrink-0 items-center gap-2 px-2",
485
+ brand !== void 0 ? "h-14" : "h-9 justify-end w-full",
486
+ collapsedEffective && "justify-center px-0",
487
+ collapsedBrandLogo && "h-auto flex-col gap-1 py-1.5"
488
+ ),
489
+ children: [
490
+ collapsedEffective ? collapsedBrandLogo && isBrandObject(brand) ? /* @__PURE__ */ jsx3(
491
+ "img",
492
+ {
493
+ "data-slot": "sidebar-brand-logo",
494
+ src: brand.logo,
495
+ alt: brand.title,
496
+ className: "size-6 shrink-0"
497
+ }
498
+ ) : null : /* @__PURE__ */ jsx3("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: brandNode }),
499
+ collapsible && !isMobile && /* @__PURE__ */ jsx3(
500
+ "button",
501
+ {
502
+ type: "button",
503
+ "data-slot": "sidebar-collapse-trigger",
504
+ "aria-label": collapsedEffective ? t("pactor.layout.expandSidebar") : t("pactor.layout.collapseSidebar"),
505
+ "aria-expanded": !collapsedEffective,
506
+ className: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-sidebar-foreground/60 transition-colors hover:bg-sidebar-accent hover:text-sidebar-foreground",
507
+ onClick: toggleSidebar,
508
+ children: /* @__PURE__ */ jsx3(Icon, { name: collapsedEffective ? "chevron-right" : "chevron-left", size: 16 })
509
+ }
510
+ )
511
+ ]
512
+ }
513
+ )
514
+ }
515
+ ),
516
+ /* @__PURE__ */ jsx3(SidebarContent, { children: sidebarContent }),
517
+ sidebarFooter !== void 0 && sidebarFooter !== null && /* @__PURE__ */ jsx3(
518
+ SidebarFooter,
471
519
  {
472
- "data-slot": "sidebar-brand",
473
520
  className: cn(
474
- "flex h-14 shrink-0 items-center gap-2 px-2",
475
- collapsedEffective && "justify-center px-0"
521
+ collapsedEffective && "items-center px-0 [&_[data-slot=flex]]:justify-center [&_[data-slot=icon]]:hidden [&_[data-slot=text]]:hidden"
476
522
  ),
477
- children: [
478
- collapsedEffective ? null : /* @__PURE__ */ jsx3("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: brandNode }),
479
- collapsible && !isMobile && /* @__PURE__ */ jsx3(
480
- "button",
481
- {
482
- type: "button",
483
- "data-slot": "sidebar-collapse-trigger",
484
- "aria-label": collapsedEffective ? t("pactor.layout.expandSidebar") : t("pactor.layout.collapseSidebar"),
485
- "aria-expanded": !collapsedEffective,
486
- className: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-sidebar-foreground/60 transition-colors hover:bg-sidebar-accent hover:text-sidebar-foreground",
487
- onClick: toggleSidebar,
488
- children: /* @__PURE__ */ jsx3(Icon, { name: collapsedEffective ? "chevron-right" : "chevron-left", size: 16 })
489
- }
490
- )
491
- ]
523
+ children: /* @__PURE__ */ jsx3(SidebarContentSlot, { content: sidebarFooter })
492
524
  }
493
- ) }),
494
- /* @__PURE__ */ jsx3(SidebarContent, { children: sidebarContent }),
495
- sidebarFooter !== void 0 && sidebarFooter !== null && !collapsedEffective && /* @__PURE__ */ jsx3(SidebarFooter, { children: sidebarFooter })
525
+ )
496
526
  ]
497
527
  }
498
528
  ),
@@ -543,13 +573,14 @@ function Menu2({
543
573
  mode = "inline",
544
574
  selectedKey,
545
575
  collapsible = false,
576
+ collapsed: collapsedProp,
546
577
  defaultExpandedKeys,
547
578
  onSelect,
548
579
  className,
549
580
  style
550
581
  }) {
551
582
  const drawer = useSidebarDrawer();
552
- const collapsed = mode === "inline" && drawer?.collapsed === true;
583
+ const collapsed = collapsedProp ?? (mode === "inline" && drawer?.collapsed === true);
553
584
  const collapsibleOn = collapsible && mode === "inline" && !collapsed;
554
585
  const [expandedKeys, setExpandedKeys] = useState(() => {
555
586
  const initial = new Set(defaultExpandedKeys ?? []);