@pactor-app/ui 1.8.0 → 1.9.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/dist/index.js CHANGED
@@ -71,7 +71,7 @@ import {
71
71
  createComponentRegistry,
72
72
  registerBuiltinComponents,
73
73
  useFormContext
74
- } from "./chunk-7YOIAVV6.js";
74
+ } from "./chunk-KUFQSYTS.js";
75
75
  import {
76
76
  InteractionProvider,
77
77
  OVERLAY_CANCEL_PAYLOAD,
@@ -79,7 +79,7 @@ import {
79
79
  OverlayManager,
80
80
  createUiBridge,
81
81
  registerInteractionActions
82
- } from "./chunk-7KC6DMKH.js";
82
+ } from "./chunk-S3SMCICK.js";
83
83
  import {
84
84
  AdminLayout,
85
85
  BlankLayout,
@@ -101,7 +101,7 @@ import {
101
101
  normalizeIconName,
102
102
  useSidebarDrawer
103
103
  } from "./chunk-PECP7DJB.js";
104
- import "./chunk-XUIXZJDQ.js";
104
+ import "./chunk-VT5XP4U4.js";
105
105
  import "./chunk-F42SGQNW.js";
106
106
  import "./chunk-VM4FESQB.js";
107
107
  import "./chunk-WKJUCGV4.js";
@@ -422,6 +422,7 @@ function InteractionProvider({
422
422
  children
423
423
  }) {
424
424
  const [confirmState, setConfirmState] = (0, import_react.useState)(null);
425
+ const [confirmOpen, setConfirmOpen] = (0, import_react.useState)(false);
425
426
  const [toasts, setToasts] = (0, import_react.useState)([]);
426
427
  const { t } = (0, import_runtime2.useI18n)();
427
428
  const { modal, message } = (0, import_react.useMemo)(() => {
@@ -435,6 +436,7 @@ function InteractionProvider({
435
436
  const modalImpl = {
436
437
  confirm(config) {
437
438
  setConfirmState({ ...config });
439
+ setConfirmOpen(true);
438
440
  }
439
441
  };
440
442
  const messageImpl = {
@@ -455,12 +457,12 @@ function InteractionProvider({
455
457
  }, [bridge, modal, message]);
456
458
  const handleOk = () => {
457
459
  const state = confirmState;
458
- setConfirmState(null);
460
+ setConfirmOpen(false);
459
461
  state?.onOk?.();
460
462
  };
461
463
  const handleCancel = () => {
462
464
  const state = confirmState;
463
- setConfirmState(null);
465
+ setConfirmOpen(false);
464
466
  state?.onCancel?.();
465
467
  };
466
468
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
@@ -470,12 +472,17 @@ function InteractionProvider({
470
472
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
471
473
  Dialog,
472
474
  {
473
- open: confirmState !== null,
475
+ open: confirmOpen,
474
476
  onOpenChange: (open) => {
475
477
  if (!open) {
476
478
  handleCancel();
477
479
  }
478
480
  },
481
+ onOpenChangeComplete: (open) => {
482
+ if (!open) {
483
+ setConfirmState(null);
484
+ }
485
+ },
479
486
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(DialogContent, { "data-slot": "confirm-dialog", className: "sm:max-w-sm", children: [
480
487
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(DialogHeader, { children: [
481
488
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DialogTitle, { children: confirmState?.title ?? "" }),
@@ -142,7 +142,9 @@ interface InteractionProviderProps {
142
142
  * InteractionProvider:mount 时向 UiBridge 注入自绘实现:
143
143
  *
144
144
  * - `modal.confirm({ title, content, onOk, onCancel })`:vendored shadcn
145
- * Dialog 渲染确认框,确定/取消回调后关闭(先关闭再回调);
145
+ * Dialog 渲染确认框,确定/取消时先关闭再回调(与 antd Modal.confirm
146
+ * 时序一致);内容状态与 open 标志分离,待关闭动画结束才清空,
147
+ * 避免退出动画期间渲染空内容导致闪烁;
146
148
  * - `message.{success,error,info,warning}`:toast 栈(容器固定右上角,
147
149
  * 自动约 3s 消失,类型色条读语义令牌)。
148
150
  *
@@ -142,7 +142,9 @@ interface InteractionProviderProps {
142
142
  * InteractionProvider:mount 时向 UiBridge 注入自绘实现:
143
143
  *
144
144
  * - `modal.confirm({ title, content, onOk, onCancel })`:vendored shadcn
145
- * Dialog 渲染确认框,确定/取消回调后关闭(先关闭再回调);
145
+ * Dialog 渲染确认框,确定/取消时先关闭再回调(与 antd Modal.confirm
146
+ * 时序一致);内容状态与 open 标志分离,待关闭动画结束才清空,
147
+ * 避免退出动画期间渲染空内容导致闪烁;
146
148
  * - `message.{success,error,info,warning}`:toast 栈(容器固定右上角,
147
149
  * 自动约 3s 消失,类型色条读语义令牌)。
148
150
  *
@@ -5,7 +5,7 @@ import {
5
5
  OverlayManager,
6
6
  createUiBridge,
7
7
  registerInteractionActions
8
- } from "../chunk-7KC6DMKH.js";
8
+ } from "../chunk-S3SMCICK.js";
9
9
  import "../chunk-F42SGQNW.js";
10
10
  import "../chunk-WKJUCGV4.js";
11
11
  export {
package/dist/ui/index.cjs CHANGED
@@ -4554,6 +4554,7 @@ function TableCaption({
4554
4554
 
4555
4555
  // src/ui/tabs.tsx
4556
4556
  var import_tabs = require("@base-ui/react/tabs");
4557
+ var import_class_variance_authority9 = require("class-variance-authority");
4557
4558
  var import_jsx_runtime53 = require("react/jsx-runtime");
4558
4559
  function Tabs({
4559
4560
  className,
@@ -4568,18 +4569,31 @@ function Tabs({
4568
4569
  }
4569
4570
  );
4570
4571
  }
4572
+ var tabsListVariants = (0, import_class_variance_authority9.cva)(
4573
+ "group/tabs-list inline-flex w-fit items-center justify-center text-muted-foreground",
4574
+ {
4575
+ variants: {
4576
+ variant: {
4577
+ default: "h-9 rounded-lg bg-muted p-[3px]",
4578
+ line: "h-auto gap-1 rounded-none border-b border-border bg-transparent p-0"
4579
+ }
4580
+ },
4581
+ defaultVariants: {
4582
+ variant: "default"
4583
+ }
4584
+ }
4585
+ );
4571
4586
  function TabsList({
4572
4587
  className,
4588
+ variant,
4573
4589
  ...props
4574
4590
  }) {
4575
4591
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
4576
4592
  import_tabs.Tabs.List,
4577
4593
  {
4578
4594
  "data-slot": "tabs-list",
4579
- className: cn(
4580
- "inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground",
4581
- className
4582
- ),
4595
+ "data-variant": variant ?? "default",
4596
+ className: cn(tabsListVariants({ variant }), className),
4583
4597
  ...props
4584
4598
  }
4585
4599
  );
@@ -4593,7 +4607,12 @@ function TabsTrigger({
4593
4607
  {
4594
4608
  "data-slot": "tabs-trigger",
4595
4609
  className: cn(
4596
- "inline-flex h-[calc(100%-1px)] flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-active:border-border data-active:bg-card data-active:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
4610
+ "inline-flex h-[calc(100%-1px)] flex-1 cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
4611
+ // default 变体:激活态胶囊(边框 + 卡片底 + 阴影)
4612
+ "group-data-[variant=default]/tabs-list:data-active:border-border group-data-[variant=default]/tabs-list:data-active:bg-card group-data-[variant=default]/tabs-list:data-active:shadow-sm",
4613
+ // line 变体:下划线指示——弱化未激活文字,激活态底部 2px 主色线
4614
+ //(叠在 List 的底边轨道上),无底色/圆角/阴影
4615
+ "group-data-[variant=line]/tabs-list:-mb-px group-data-[variant=line]/tabs-list:h-9 group-data-[variant=line]/tabs-list:rounded-none group-data-[variant=line]/tabs-list:border-x-0 group-data-[variant=line]/tabs-list:border-t-0 group-data-[variant=line]/tabs-list:border-b-2 group-data-[variant=line]/tabs-list:py-1.5 group-data-[variant=line]/tabs-list:text-muted-foreground group-data-[variant=line]/tabs-list:data-active:border-b-primary group-data-[variant=line]/tabs-list:data-active:text-foreground",
4597
4616
  className
4598
4617
  ),
4599
4618
  ...props
@@ -4635,9 +4654,9 @@ function Textarea({
4635
4654
 
4636
4655
  // src/ui/toggle.tsx
4637
4656
  var import_toggle = require("@base-ui/react/toggle");
4638
- var import_class_variance_authority9 = require("class-variance-authority");
4657
+ var import_class_variance_authority10 = require("class-variance-authority");
4639
4658
  var import_jsx_runtime55 = require("react/jsx-runtime");
4640
- var toggleVariants = (0, import_class_variance_authority9.cva)(
4659
+ var toggleVariants = (0, import_class_variance_authority10.cva)(
4641
4660
  "inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-colors outline-none hover:bg-muted hover:text-muted-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-pressed:bg-accent data-pressed:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
4642
4661
  {
4643
4662
  variants: {
@@ -4733,9 +4752,9 @@ function ToggleGroupItem({
4733
4752
  }
4734
4753
 
4735
4754
  // src/ui/typography.tsx
4736
- var import_class_variance_authority10 = require("class-variance-authority");
4755
+ var import_class_variance_authority11 = require("class-variance-authority");
4737
4756
  var import_jsx_runtime57 = require("react/jsx-runtime");
4738
- var typographyVariants = (0, import_class_variance_authority10.cva)("", {
4757
+ var typographyVariants = (0, import_class_variance_authority11.cva)("", {
4739
4758
  variants: {
4740
4759
  variant: {
4741
4760
  h1: "scroll-m-20 text-4xl font-extrabold tracking-tight text-balance",
@@ -72,7 +72,7 @@ declare function AlertDescription({ className, ...props }: React.ComponentProps<
72
72
  */
73
73
  declare const buttonVariants: (props?: ({
74
74
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
75
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
75
+ size?: "default" | "sm" | "lg" | "icon" | "xs" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
76
76
  } & class_variance_authority_types.ClassProp) | undefined) => string;
77
77
  declare function Button({ className, variant, size, asChild, children, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
78
78
  asChild?: boolean;
@@ -658,9 +658,14 @@ declare function TableCaption({ className, ...props }: React.ComponentProps<'cap
658
658
  * 官方源码:https://ui.shadcn.com/r/styles/base-nova/tabs.json
659
659
  * Root/List/Tab/Panel 对应原 Radix Root/List/Trigger/Content;激活态属性
660
660
  * 由 `data-[state=active]` 换成官方 `data-active` 自定义变体。
661
+ * List 支持 `variant`(default 胶囊 / line 下划线);激活态装饰按
662
+ * `group-data-[variant=*]/tabs-list` 分别限定,两种变体互不污染。
661
663
  */
662
664
  declare function Tabs({ className, ...props }: Tabs$1.Root.Props): React.JSX.Element;
663
- declare function TabsList({ className, ...props }: Tabs$1.List.Props): React.JSX.Element;
665
+ declare const tabsListVariants: (props?: ({
666
+ variant?: "line" | "default" | null | undefined;
667
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
668
+ declare function TabsList({ className, variant, ...props }: Tabs$1.List.Props & VariantProps<typeof tabsListVariants>): React.JSX.Element;
664
669
  declare function TabsTrigger({ className, ...props }: Tabs$1.Tab.Props): React.JSX.Element;
665
670
  declare function TabsContent({ className, ...props }: Tabs$1.Panel.Props): React.JSX.Element;
666
671
 
@@ -72,7 +72,7 @@ declare function AlertDescription({ className, ...props }: React.ComponentProps<
72
72
  */
73
73
  declare const buttonVariants: (props?: ({
74
74
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
75
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
75
+ size?: "default" | "sm" | "lg" | "icon" | "xs" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
76
76
  } & class_variance_authority_types.ClassProp) | undefined) => string;
77
77
  declare function Button({ className, variant, size, asChild, children, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
78
78
  asChild?: boolean;
@@ -658,9 +658,14 @@ declare function TableCaption({ className, ...props }: React.ComponentProps<'cap
658
658
  * 官方源码:https://ui.shadcn.com/r/styles/base-nova/tabs.json
659
659
  * Root/List/Tab/Panel 对应原 Radix Root/List/Trigger/Content;激活态属性
660
660
  * 由 `data-[state=active]` 换成官方 `data-active` 自定义变体。
661
+ * List 支持 `variant`(default 胶囊 / line 下划线);激活态装饰按
662
+ * `group-data-[variant=*]/tabs-list` 分别限定,两种变体互不污染。
661
663
  */
662
664
  declare function Tabs({ className, ...props }: Tabs$1.Root.Props): React.JSX.Element;
663
- declare function TabsList({ className, ...props }: Tabs$1.List.Props): React.JSX.Element;
665
+ declare const tabsListVariants: (props?: ({
666
+ variant?: "line" | "default" | null | undefined;
667
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
668
+ declare function TabsList({ className, variant, ...props }: Tabs$1.List.Props & VariantProps<typeof tabsListVariants>): React.JSX.Element;
664
669
  declare function TabsTrigger({ className, ...props }: Tabs$1.Tab.Props): React.JSX.Element;
665
670
  declare function TabsContent({ className, ...props }: Tabs$1.Panel.Props): React.JSX.Element;
666
671
 
package/dist/ui/index.js CHANGED
@@ -160,7 +160,7 @@ import {
160
160
  toggleVariants,
161
161
  typographyVariants,
162
162
  useCarousel
163
- } from "../chunk-XUIXZJDQ.js";
163
+ } from "../chunk-VT5XP4U4.js";
164
164
  import {
165
165
  Dialog,
166
166
  DialogClose,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pactor-app/ui",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Pactor UI kit (shadcn): the single built-in UI kit — vendored shadcn/ui components (Base UI primitives + cva + tailwind-merge + lucide-react), props contracts, interaction core (OverlayManager / UiBridge) and layouts, with build-time Tailwind v4 prebuilt styles.css (zero consumer-side Tailwind config)",
5
5
  "keywords": [
6
6
  "pactor",
@@ -105,10 +105,10 @@
105
105
  "recharts": "^3.10.1",
106
106
  "tailwind-merge": "^3.6.0",
107
107
  "vaul": "^1.1.2",
108
- "@pactor-app/core": "1.8.0",
109
- "@pactor-app/runtime": "1.8.0",
110
- "@pactor-app/permission": "1.8.0",
111
- "@pactor-app/router": "1.8.0"
108
+ "@pactor-app/core": "1.9.0",
109
+ "@pactor-app/permission": "1.9.0",
110
+ "@pactor-app/router": "1.9.0",
111
+ "@pactor-app/runtime": "1.9.0"
112
112
  },
113
113
  "peerDependencies": {
114
114
  "react": ">=18",
package/styles.css CHANGED
@@ -1882,6 +1882,33 @@
1882
1882
  --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
1883
1883
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1884
1884
  }
1885
+ .group-data-\[variant\=line\]\/tabs-list\:-mb-px:is(:where(.group\/tabs-list)[data-variant="line"] *) {
1886
+ margin-bottom: -1px;
1887
+ }
1888
+ .group-data-\[variant\=line\]\/tabs-list\:h-9:is(:where(.group\/tabs-list)[data-variant="line"] *) {
1889
+ height: calc(var(--spacing) * 9);
1890
+ }
1891
+ .group-data-\[variant\=line\]\/tabs-list\:rounded-none:is(:where(.group\/tabs-list)[data-variant="line"] *) {
1892
+ border-radius: 0;
1893
+ }
1894
+ .group-data-\[variant\=line\]\/tabs-list\:border-x-0:is(:where(.group\/tabs-list)[data-variant="line"] *) {
1895
+ border-inline-style: var(--tw-border-style);
1896
+ border-inline-width: 0px;
1897
+ }
1898
+ .group-data-\[variant\=line\]\/tabs-list\:border-t-0:is(:where(.group\/tabs-list)[data-variant="line"] *) {
1899
+ border-top-style: var(--tw-border-style);
1900
+ border-top-width: 0px;
1901
+ }
1902
+ .group-data-\[variant\=line\]\/tabs-list\:border-b-2:is(:where(.group\/tabs-list)[data-variant="line"] *) {
1903
+ border-bottom-style: var(--tw-border-style);
1904
+ border-bottom-width: 2px;
1905
+ }
1906
+ .group-data-\[variant\=line\]\/tabs-list\:py-1\.5:is(:where(.group\/tabs-list)[data-variant="line"] *) {
1907
+ padding-block: calc(var(--spacing) * 1.5);
1908
+ }
1909
+ .group-data-\[variant\=line\]\/tabs-list\:text-muted-foreground:is(:where(.group\/tabs-list)[data-variant="line"] *) {
1910
+ color: var(--muted-foreground);
1911
+ }
1885
1912
  .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:block:is(:where(.group\/drawer-content)[data-vaul-drawer-direction="bottom"] *) {
1886
1913
  display: block;
1887
1914
  }
@@ -2744,25 +2771,31 @@
2744
2771
  .data-closed\:slide-out-to-top:where([data-closed]:not([data-closed='false'])) {
2745
2772
  --tw-exit-translate-y: -100%;
2746
2773
  }
2747
- .data-active\:border-border:where([data-active]:not([data-active='false'])) {
2748
- border-color: var(--border);
2749
- }
2750
2774
  .data-active\:bg-\(--menu-active-background\)\/50:where([data-active]:not([data-active='false'])) {
2751
2775
  background-color: var(--menu-active-background);
2752
2776
  @supports (color: color-mix(in lab, red, red)) {
2753
2777
  background-color: color-mix(in oklab, var(--menu-active-background) 50%, transparent);
2754
2778
  }
2755
2779
  }
2756
- .data-active\:bg-card:where([data-active]:not([data-active='false'])) {
2757
- background-color: var(--card);
2758
- }
2759
2780
  .data-active\:text-\(--menu-active-foreground\):where([data-active]:not([data-active='false'])) {
2760
2781
  color: var(--menu-active-foreground);
2761
2782
  }
2762
- .data-active\:shadow-sm:where([data-active]:not([data-active='false'])) {
2783
+ .group-data-\[variant\=default\]\/tabs-list\:data-active\:border-border:is(:where(.group\/tabs-list)[data-variant="default"] *):where([data-active]:not([data-active='false'])) {
2784
+ border-color: var(--border);
2785
+ }
2786
+ .group-data-\[variant\=default\]\/tabs-list\:data-active\:bg-card:is(:where(.group\/tabs-list)[data-variant="default"] *):where([data-active]:not([data-active='false'])) {
2787
+ background-color: var(--card);
2788
+ }
2789
+ .group-data-\[variant\=default\]\/tabs-list\:data-active\:shadow-sm:is(:where(.group\/tabs-list)[data-variant="default"] *):where([data-active]:not([data-active='false'])) {
2763
2790
  --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
2764
2791
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
2765
2792
  }
2793
+ .group-data-\[variant\=line\]\/tabs-list\:data-active\:border-b-primary:is(:where(.group\/tabs-list)[data-variant="line"] *):where([data-active]:not([data-active='false'])) {
2794
+ border-bottom-color: var(--primary);
2795
+ }
2796
+ .group-data-\[variant\=line\]\/tabs-list\:data-active\:text-foreground:is(:where(.group\/tabs-list)[data-variant="line"] *):where([data-active]:not([data-active='false'])) {
2797
+ color: var(--foreground);
2798
+ }
2766
2799
  .data-disabled\:pointer-events-none:where([data-disabled]:not([data-disabled='false'])) {
2767
2800
  pointer-events: none;
2768
2801
  }