@pactor-app/ui 1.34.0 → 1.40.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.
@@ -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 ?? []);
@@ -2,7 +2,7 @@ import {
2
2
  Icon,
3
3
  Menu,
4
4
  Sidebar
5
- } from "./chunk-44DAGWXZ.js";
5
+ } from "./chunk-PWXXEJ4J.js";
6
6
  import {
7
7
  Accordion,
8
8
  AccordionContent,
@@ -15,7 +15,7 @@ import {
15
15
  Popover,
16
16
  PopoverContent,
17
17
  PopoverTrigger
18
- } from "./chunk-RB7RCKAX.js";
18
+ } from "./chunk-IBMIQXOM.js";
19
19
  import {
20
20
  cn
21
21
  } from "./chunk-WKJUCGV4.js";