@pactor-app/ui 1.10.0 → 1.11.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.cjs CHANGED
@@ -877,6 +877,7 @@ var import_react2 = require("react");
877
877
 
878
878
  // src/ui/breadcrumb.tsx
879
879
  var import_lucide_react3 = require("lucide-react");
880
+ var React2 = __toESM(require("react"), 1);
880
881
  var import_jsx_runtime16 = require("react/jsx-runtime");
881
882
  function Breadcrumb({ ...props }) {
882
883
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...props });
@@ -904,12 +905,27 @@ function BreadcrumbItem({ className, ...props }) {
904
905
  }
905
906
  );
906
907
  }
907
- function BreadcrumbLink({ className, ...props }) {
908
+ function BreadcrumbLink({
909
+ className,
910
+ render,
911
+ ...props
912
+ }) {
913
+ const linkClassName = cn("transition-colors hover:text-foreground", className);
914
+ if (render) {
915
+ return React2.cloneElement(render, {
916
+ "data-slot": "breadcrumb-link",
917
+ ...props,
918
+ className: cn(
919
+ linkClassName,
920
+ render.props.className
921
+ )
922
+ });
923
+ }
908
924
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
909
925
  "a",
910
926
  {
911
927
  "data-slot": "breadcrumb-link",
912
- className: cn("transition-colors hover:text-foreground", className),
928
+ className: linkClassName,
913
929
  ...props
914
930
  }
915
931
  );
@@ -945,14 +961,37 @@ function BreadcrumbSeparator({
945
961
  );
946
962
  }
947
963
 
964
+ // src/components/spa-link.ts
965
+ var import_runtime3 = require("@pactor-app/runtime");
966
+ function shouldInterceptLinkClick(event, href, target) {
967
+ return typeof href === "string" && href.startsWith("/") && (target === void 0 || target === "_self") && event.button === 0 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey;
968
+ }
969
+ function useSpaLinkClick() {
970
+ const { context } = (0, import_runtime3.useRenderer)();
971
+ return (event, href, target) => {
972
+ if (shouldInterceptLinkClick(event, href, target)) {
973
+ event.preventDefault();
974
+ context.route.navigate(href);
975
+ }
976
+ };
977
+ }
978
+
948
979
  // src/components/components/Breadcrumb/index.tsx
949
980
  var import_jsx_runtime17 = require("react/jsx-runtime");
950
981
  function Breadcrumb2({ items = [], className, style }) {
982
+ const handleSpaClick = useSpaLinkClick();
951
983
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Breadcrumb, { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BreadcrumbList, { children: items.map((item, index) => {
952
984
  const isLast = index === items.length - 1;
953
985
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react2.Fragment, { children: [
954
986
  index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BreadcrumbSeparator, {}) : null,
955
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BreadcrumbItem, { children: isLast || !item.href ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BreadcrumbLink, { href: item.href, children: item.label }) })
987
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BreadcrumbItem, { children: isLast || !item.href ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
988
+ BreadcrumbLink,
989
+ {
990
+ href: item.href,
991
+ onClick: (event) => handleSpaClick(event, item.href),
992
+ children: item.label
993
+ }
994
+ ) })
956
995
  ] }, `${item.label}-${index}`);
957
996
  }) }) });
958
997
  }
@@ -974,6 +1013,7 @@ var sizeMap = {
974
1013
  };
975
1014
  function Button2({
976
1015
  text,
1016
+ icon,
977
1017
  variant = "default",
978
1018
  danger,
979
1019
  size = "middle",
@@ -1002,7 +1042,7 @@ function Button2({
1002
1042
  className
1003
1043
  ),
1004
1044
  children: [
1005
- loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react4.Loader2, { "aria-hidden": true, className: "animate-spin" }) : null,
1045
+ loading ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react4.Loader2, { "aria-hidden": true, className: "animate-spin" }) : icon ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { name: icon, size: "sm" }) : null,
1006
1046
  text ?? children
1007
1047
  ]
1008
1048
  }
@@ -1275,17 +1315,17 @@ function Card2({ title, bordered = true, rounded, className, style, children })
1275
1315
  }
1276
1316
 
1277
1317
  // src/components/components/Carousel/index.tsx
1278
- var import_runtime3 = require("@pactor-app/runtime");
1318
+ var import_runtime4 = require("@pactor-app/runtime");
1279
1319
  var import_react5 = require("react");
1280
1320
 
1281
1321
  // src/ui/carousel.tsx
1282
1322
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"), 1);
1283
1323
  var import_lucide_react6 = require("lucide-react");
1284
- var React2 = __toESM(require("react"), 1);
1324
+ var React3 = __toESM(require("react"), 1);
1285
1325
  var import_jsx_runtime25 = require("react/jsx-runtime");
1286
- var CarouselContext = React2.createContext(null);
1326
+ var CarouselContext = React3.createContext(null);
1287
1327
  function useCarousel() {
1288
- const context = React2.useContext(CarouselContext);
1328
+ const context = React3.useContext(CarouselContext);
1289
1329
  if (!context) {
1290
1330
  throw new Error("useCarousel must be used within a <Carousel />");
1291
1331
  }
@@ -1304,16 +1344,16 @@ function Carousel({
1304
1344
  { ...opts, axis: orientation === "horizontal" ? "x" : "y" },
1305
1345
  plugins
1306
1346
  );
1307
- const [canScrollPrev, setCanScrollPrev] = React2.useState(false);
1308
- const [canScrollNext, setCanScrollNext] = React2.useState(false);
1309
- const onSelect = React2.useCallback((carouselApi) => {
1347
+ const [canScrollPrev, setCanScrollPrev] = React3.useState(false);
1348
+ const [canScrollNext, setCanScrollNext] = React3.useState(false);
1349
+ const onSelect = React3.useCallback((carouselApi) => {
1310
1350
  if (!carouselApi) return;
1311
1351
  setCanScrollPrev(carouselApi.canScrollPrev());
1312
1352
  setCanScrollNext(carouselApi.canScrollNext());
1313
1353
  }, []);
1314
- const scrollPrev = React2.useCallback(() => api?.scrollPrev(), [api]);
1315
- const scrollNext = React2.useCallback(() => api?.scrollNext(), [api]);
1316
- const handleKeyDown = React2.useCallback(
1354
+ const scrollPrev = React3.useCallback(() => api?.scrollPrev(), [api]);
1355
+ const scrollNext = React3.useCallback(() => api?.scrollNext(), [api]);
1356
+ const handleKeyDown = React3.useCallback(
1317
1357
  (event) => {
1318
1358
  if (event.key === "ArrowLeft") {
1319
1359
  event.preventDefault();
@@ -1325,10 +1365,10 @@ function Carousel({
1325
1365
  },
1326
1366
  [scrollPrev, scrollNext]
1327
1367
  );
1328
- React2.useEffect(() => {
1368
+ React3.useEffect(() => {
1329
1369
  if (api && setApi) setApi(api);
1330
1370
  }, [api, setApi]);
1331
- React2.useEffect(() => {
1371
+ React3.useEffect(() => {
1332
1372
  if (!api) return;
1333
1373
  onSelect(api);
1334
1374
  api.on("reInit", onSelect);
@@ -1465,7 +1505,7 @@ function Carousel2({
1465
1505
  className,
1466
1506
  style
1467
1507
  }) {
1468
- const { renderChildren } = (0, import_runtime3.useRenderer)();
1508
+ const { renderChildren } = (0, import_runtime4.useRenderer)();
1469
1509
  const [api, setApi] = (0, import_react5.useState)();
1470
1510
  (0, import_react5.useEffect)(() => {
1471
1511
  if (!api || !autoplay) return;
@@ -1981,7 +2021,7 @@ function Combobox2({
1981
2021
  }
1982
2022
 
1983
2023
  // src/components/components/Command/index.tsx
1984
- var import_runtime4 = require("@pactor-app/runtime");
2024
+ var import_runtime5 = require("@pactor-app/runtime");
1985
2025
  var import_jsx_runtime35 = require("react/jsx-runtime");
1986
2026
  function Command2({
1987
2027
  groups = [],
@@ -1991,7 +2031,7 @@ function Command2({
1991
2031
  className,
1992
2032
  style
1993
2033
  }) {
1994
- const { t } = (0, import_runtime4.useI18n)();
2034
+ const { t } = (0, import_runtime5.useI18n)();
1995
2035
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Command, { className, style, children: [
1996
2036
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CommandInput, { placeholder }),
1997
2037
  /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(CommandList, { children: [
@@ -2141,7 +2181,7 @@ function Chart({
2141
2181
  }
2142
2182
 
2143
2183
  // src/components/components/ChatInput/index.tsx
2144
- var import_runtime5 = require("@pactor-app/runtime");
2184
+ var import_runtime6 = require("@pactor-app/runtime");
2145
2185
  var import_lucide_react11 = require("lucide-react");
2146
2186
  var import_react9 = require("react");
2147
2187
 
@@ -2181,7 +2221,7 @@ function ChatInput({
2181
2221
  className,
2182
2222
  style
2183
2223
  }) {
2184
- const { renderChildren } = (0, import_runtime5.useRenderer)();
2224
+ const { renderChildren } = (0, import_runtime6.useRenderer)();
2185
2225
  const controlled = value !== void 0;
2186
2226
  const [draft, setDraft] = (0, import_react9.useState)("");
2187
2227
  const text = controlled ? value : draft;
@@ -2349,7 +2389,7 @@ function ContextMenu2({
2349
2389
  }
2350
2390
 
2351
2391
  // src/components/components/DataTable/index.tsx
2352
- var import_runtime6 = require("@pactor-app/runtime");
2392
+ var import_runtime7 = require("@pactor-app/runtime");
2353
2393
  var import_lucide_react12 = require("lucide-react");
2354
2394
  var import_react10 = require("react");
2355
2395
 
@@ -2477,8 +2517,8 @@ function DataTable({
2477
2517
  className,
2478
2518
  style
2479
2519
  }) {
2480
- const { renderChildren } = (0, import_runtime6.useRenderer)();
2481
- const { t } = (0, import_runtime6.useI18n)();
2520
+ const { renderChildren } = (0, import_runtime7.useRenderer)();
2521
+ const { t } = (0, import_runtime7.useI18n)();
2482
2522
  const [sortState, setSortState] = (0, import_react10.useState)(sort);
2483
2523
  const [filters, setFilters] = (0, import_react10.useState)({});
2484
2524
  const [current, setCurrent] = (0, import_react10.useState)(1);
@@ -2597,7 +2637,7 @@ function DataTable({
2597
2637
  }
2598
2638
 
2599
2639
  // src/components/components/DatePicker/index.tsx
2600
- var import_runtime7 = require("@pactor-app/runtime");
2640
+ var import_runtime8 = require("@pactor-app/runtime");
2601
2641
  var import_date_fns2 = require("date-fns");
2602
2642
  var import_locale = require("date-fns/locale");
2603
2643
  var import_lucide_react13 = require("lucide-react");
@@ -2643,7 +2683,7 @@ function DatePicker(props) {
2643
2683
  const value = props.value;
2644
2684
  const onChange = props.onChange;
2645
2685
  const form = useFormContext();
2646
- const { locale, t } = (0, import_runtime7.useI18n)();
2686
+ const { locale, t } = (0, import_runtime8.useI18n)();
2647
2687
  const dfLocale = toDateFnsLocale(locale);
2648
2688
  const controlId = (0, import_react11.useId)();
2649
2689
  const inForm = form?.inForm === true && typeof name === "string" && name !== "";
@@ -2886,7 +2926,7 @@ function DatePicker(props) {
2886
2926
  }
2887
2927
 
2888
2928
  // src/components/components/Dialog/index.tsx
2889
- var import_runtime8 = require("@pactor-app/runtime");
2929
+ var import_runtime9 = require("@pactor-app/runtime");
2890
2930
  var import_react12 = require("react");
2891
2931
 
2892
2932
  // src/ui/dialog.tsx
@@ -3032,7 +3072,7 @@ function Dialog2({
3032
3072
  className,
3033
3073
  style
3034
3074
  }) {
3035
- const { renderChildren } = (0, import_runtime8.useRenderer)();
3075
+ const { renderChildren } = (0, import_runtime9.useRenderer)();
3036
3076
  const [innerOpen, setInnerOpen] = (0, import_react12.useState)(false);
3037
3077
  const controlled = open !== void 0;
3038
3078
  const visible = controlled ? open : innerOpen;
@@ -3436,9 +3476,15 @@ function FieldError({ className, ...props }) {
3436
3476
 
3437
3477
  // src/components/components/Field/index.tsx
3438
3478
  var import_jsx_runtime56 = require("react/jsx-runtime");
3439
- function Field2({ label, description, error, children, className, style }) {
3479
+ function Field2({ label, required, description, error, children, className, style }) {
3440
3480
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Field, { className, style, children: [
3441
- label ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(FieldLabel, { children: label }) : null,
3481
+ label ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(FieldLabel, { children: [
3482
+ required ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { "aria-hidden": true, className: "text-destructive", children: [
3483
+ "*",
3484
+ " "
3485
+ ] }) : null,
3486
+ label
3487
+ ] }) : null,
3442
3488
  children,
3443
3489
  description ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(FieldDescription, { children: description }) : null,
3444
3490
  error ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(FieldError, { match: true, children: error }) : null
@@ -3513,7 +3559,7 @@ function Footer({ className, style, children }) {
3513
3559
  }
3514
3560
 
3515
3561
  // src/components/components/Form/index.tsx
3516
- var import_runtime9 = require("@pactor-app/runtime");
3562
+ var import_runtime10 = require("@pactor-app/runtime");
3517
3563
  var import_react13 = require("react");
3518
3564
  var import_jsx_runtime59 = require("react/jsx-runtime");
3519
3565
  function isEmpty(value) {
@@ -3529,7 +3575,7 @@ function Form({
3529
3575
  onSubmit,
3530
3576
  onValuesChange
3531
3577
  }) {
3532
- const { context } = (0, import_runtime9.useRenderer)();
3578
+ const { context } = (0, import_runtime10.useRenderer)();
3533
3579
  const [values, setValues] = (0, import_react13.useState)(() => ({
3534
3580
  ...initialValues
3535
3581
  }));
@@ -3630,7 +3676,7 @@ function Grid({ columns = 1, gap, className, style, children }) {
3630
3676
  }
3631
3677
 
3632
3678
  // src/components/components/Header/index.tsx
3633
- var import_runtime10 = require("@pactor-app/runtime");
3679
+ var import_runtime11 = require("@pactor-app/runtime");
3634
3680
  var import_lucide_react16 = require("lucide-react");
3635
3681
  var import_jsx_runtime61 = require("react/jsx-runtime");
3636
3682
  var menuItemClass = "flex items-center gap-1 rounded-md px-3 py-2 text-sm transition-colors text-muted-foreground hover:bg-accent/50 hover:text-foreground";
@@ -3813,7 +3859,7 @@ function HeaderLocalesArea({
3813
3859
  locales,
3814
3860
  onSelect
3815
3861
  }) {
3816
- const { locale } = (0, import_runtime10.useI18n)();
3862
+ const { locale } = (0, import_runtime11.useI18n)();
3817
3863
  const current = locales.find((option) => option.value === locale);
3818
3864
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(DropdownMenu, { children: [
3819
3865
  /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
@@ -3839,7 +3885,7 @@ function HeaderLocalesArea({
3839
3885
  }
3840
3886
 
3841
3887
  // src/components/components/HoverCard/index.tsx
3842
- var import_runtime11 = require("@pactor-app/runtime");
3888
+ var import_runtime12 = require("@pactor-app/runtime");
3843
3889
 
3844
3890
  // src/ui/hover-card.tsx
3845
3891
  var import_preview_card = require("@base-ui/react/preview-card");
@@ -3889,7 +3935,7 @@ function isDslNode2(value) {
3889
3935
  return typeof value === "object" && value !== null && typeof value.type === "string";
3890
3936
  }
3891
3937
  function HoverCard2({ content, children, className, style }) {
3892
- const { renderChildren } = (0, import_runtime11.useRenderer)();
3938
+ const { renderChildren } = (0, import_runtime12.useRenderer)();
3893
3939
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(HoverCard, { children: [
3894
3940
  /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(HoverCardTrigger, { render: triggerWrapper("hover-card-trigger-wrap"), children }),
3895
3941
  /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(HoverCardContent, { className, style, children: isDslNode2(content) ? renderChildren([content]) : content })
@@ -3897,7 +3943,7 @@ function HoverCard2({ content, children, className, style }) {
3897
3943
  }
3898
3944
 
3899
3945
  // src/components/components/Input/index.tsx
3900
- var import_runtime12 = require("@pactor-app/runtime");
3946
+ var import_runtime13 = require("@pactor-app/runtime");
3901
3947
  var import_react15 = require("react");
3902
3948
  var import_jsx_runtime64 = require("react/jsx-runtime");
3903
3949
  function Input2({
@@ -3911,10 +3957,11 @@ function Input2({
3911
3957
  allowClear,
3912
3958
  onChange,
3913
3959
  className,
3960
+ controlClassName,
3914
3961
  style
3915
3962
  }) {
3916
3963
  const form = useFormContext();
3917
- const { t } = (0, import_runtime12.useI18n)();
3964
+ const { t } = (0, import_runtime13.useI18n)();
3918
3965
  const controlId = (0, import_react15.useId)();
3919
3966
  const inForm = form?.inForm === true && typeof name === "string" && name !== "";
3920
3967
  (0, import_react15.useEffect)(() => {
@@ -3942,7 +3989,10 @@ function Input2({
3942
3989
  value: currentValue,
3943
3990
  placeholder,
3944
3991
  disabled,
3945
- className: !inFormRoot && allowClear !== true ? className : void 0,
3992
+ className: cn(
3993
+ !inFormRoot && allowClear !== true && className,
3994
+ allowClear !== true && controlClassName
3995
+ ),
3946
3996
  style: !inFormRoot && allowClear !== true ? style : void 0,
3947
3997
  onChange: (event) => {
3948
3998
  if (inForm && form && name) {
@@ -3965,7 +4015,11 @@ function Input2({
3965
4015
  const control = allowClear === true ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
3966
4016
  "span",
3967
4017
  {
3968
- className: cn("flex items-center gap-1", !inFormRoot && className),
4018
+ className: cn(
4019
+ "flex items-center gap-1",
4020
+ !inFormRoot && className,
4021
+ controlClassName
4022
+ ),
3969
4023
  style: inFormRoot ? void 0 : style,
3970
4024
  children: [
3971
4025
  input,
@@ -4032,7 +4086,7 @@ var import_react16 = require("react");
4032
4086
  // src/ui/input-otp.tsx
4033
4087
  var import_input_otp = require("input-otp");
4034
4088
  var import_lucide_react17 = require("lucide-react");
4035
- var React3 = __toESM(require("react"), 1);
4089
+ var React4 = __toESM(require("react"), 1);
4036
4090
  var import_jsx_runtime67 = require("react/jsx-runtime");
4037
4091
  function InputOTP({
4038
4092
  className,
@@ -4067,7 +4121,7 @@ function InputOTPSlot({
4067
4121
  className,
4068
4122
  ...props
4069
4123
  }) {
4070
- const inputOTPContext = React3.useContext(import_input_otp.OTPInputContext);
4124
+ const inputOTPContext = React4.useContext(import_input_otp.OTPInputContext);
4071
4125
  const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
4072
4126
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
4073
4127
  "div",
@@ -4156,7 +4210,7 @@ function InputOTP2({
4156
4210
  }
4157
4211
 
4158
4212
  // src/components/components/Item/index.tsx
4159
- var import_runtime13 = require("@pactor-app/runtime");
4213
+ var import_runtime14 = require("@pactor-app/runtime");
4160
4214
 
4161
4215
  // src/ui/item.tsx
4162
4216
  var import_jsx_runtime69 = require("react/jsx-runtime");
@@ -4237,7 +4291,7 @@ function Item2({
4237
4291
  className,
4238
4292
  style
4239
4293
  }) {
4240
- const { renderChildren } = (0, import_runtime13.useRenderer)();
4294
+ const { renderChildren } = (0, import_runtime14.useRenderer)();
4241
4295
  const mediaNodes = media === void 0 ? [] : Array.isArray(media) ? media : [media];
4242
4296
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Item, { className, style, children: [
4243
4297
  mediaNodes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ItemMedia, { children: renderChildren(mediaNodes) }) : null,
@@ -4298,10 +4352,10 @@ function Label2({ text, htmlFor, className, style }) {
4298
4352
 
4299
4353
  // src/components/components/Layout/index.tsx
4300
4354
  var import_core = require("@pactor-app/core");
4301
- var import_runtime14 = require("@pactor-app/runtime");
4355
+ var import_runtime15 = require("@pactor-app/runtime");
4302
4356
  var import_jsx_runtime75 = require("react/jsx-runtime");
4303
4357
  function Layout({ direction, className, style, dslChildren }) {
4304
- const { renderChildren, context } = (0, import_runtime14.useRenderer)();
4358
+ const { renderChildren, context } = (0, import_runtime15.useRenderer)();
4305
4359
  const hasSider = Array.isArray(dslChildren) ? dslChildren.some(
4306
4360
  (child) => !(0, import_core.isDslSourceRef)(child) && resolveRootType(child, context) === "Sider"
4307
4361
  ) : false;
@@ -4332,6 +4386,7 @@ function resolveRootType(node, context) {
4332
4386
  // src/components/components/Link/index.tsx
4333
4387
  var import_jsx_runtime76 = require("react/jsx-runtime");
4334
4388
  function Link2({ href, text, target, className, style, children }) {
4389
+ const handleSpaClick = useSpaLinkClick();
4335
4390
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
4336
4391
  "a",
4337
4392
  {
@@ -4341,6 +4396,7 @@ function Link2({ href, text, target, className, style, children }) {
4341
4396
  rel: target === "_blank" ? "noreferrer" : void 0,
4342
4397
  className: cn("text-primary underline-offset-4 hover:underline", className),
4343
4398
  style,
4399
+ onClick: (event) => handleSpaClick(event, href, target),
4344
4400
  children: text ?? children
4345
4401
  }
4346
4402
  );
@@ -4422,11 +4478,11 @@ function RailTooltip({
4422
4478
  }
4423
4479
 
4424
4480
  // src/components/components/Sidebar/index.tsx
4425
- var import_runtime15 = require("@pactor-app/runtime");
4481
+ var import_runtime16 = require("@pactor-app/runtime");
4426
4482
  var import_react18 = require("react");
4427
4483
 
4428
4484
  // src/ui/sidebar.tsx
4429
- var React4 = __toESM(require("react"), 1);
4485
+ var React5 = __toESM(require("react"), 1);
4430
4486
  var import_class_variance_authority5 = require("class-variance-authority");
4431
4487
  var import_lucide_react19 = require("lucide-react");
4432
4488
 
@@ -4618,9 +4674,9 @@ var SIDEBAR_WIDTH = "16rem";
4618
4674
  var SIDEBAR_WIDTH_MOBILE = "18rem";
4619
4675
  var SIDEBAR_WIDTH_ICON = "3rem";
4620
4676
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
4621
- var SidebarContext = React4.createContext(null);
4677
+ var SidebarContext = React5.createContext(null);
4622
4678
  function useSidebar() {
4623
- const context = React4.useContext(SidebarContext);
4679
+ const context = React5.useContext(SidebarContext);
4624
4680
  if (!context) {
4625
4681
  throw new Error("useSidebar must be used within a SidebarProvider.");
4626
4682
  }
@@ -4636,10 +4692,10 @@ function SidebarProvider({
4636
4692
  ...props
4637
4693
  }) {
4638
4694
  const isMobile = useIsMobile();
4639
- const [openMobile, setOpenMobile] = React4.useState(false);
4640
- const [_open, _setOpen] = React4.useState(defaultOpen);
4695
+ const [openMobile, setOpenMobile] = React5.useState(false);
4696
+ const [_open, _setOpen] = React5.useState(defaultOpen);
4641
4697
  const open = openProp ?? _open;
4642
- const setOpen = React4.useCallback(
4698
+ const setOpen = React5.useCallback(
4643
4699
  (value) => {
4644
4700
  const openState = typeof value === "function" ? value(open) : value;
4645
4701
  if (setOpenProp) {
@@ -4651,10 +4707,10 @@ function SidebarProvider({
4651
4707
  },
4652
4708
  [setOpenProp, open]
4653
4709
  );
4654
- const toggleSidebar = React4.useCallback(() => {
4710
+ const toggleSidebar = React5.useCallback(() => {
4655
4711
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
4656
4712
  }, [isMobile, setOpen, setOpenMobile]);
4657
- React4.useEffect(() => {
4713
+ React5.useEffect(() => {
4658
4714
  const handleKeyDown = (event) => {
4659
4715
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
4660
4716
  event.preventDefault();
@@ -4665,7 +4721,7 @@ function SidebarProvider({
4665
4721
  return () => window.removeEventListener("keydown", handleKeyDown);
4666
4722
  }, [toggleSidebar]);
4667
4723
  const state = open ? "expanded" : "collapsed";
4668
- const contextValue = React4.useMemo(
4724
+ const contextValue = React5.useMemo(
4669
4725
  () => ({
4670
4726
  state,
4671
4727
  open,
@@ -4839,10 +4895,10 @@ function SidebarContent({ className, ...props }) {
4839
4895
  );
4840
4896
  }
4841
4897
  function renderAsChild(children, dataSlot, className, rest) {
4842
- if (!React4.isValidElement(children)) {
4898
+ if (!React5.isValidElement(children)) {
4843
4899
  return null;
4844
4900
  }
4845
- return React4.cloneElement(children, {
4901
+ return React5.cloneElement(children, {
4846
4902
  "data-slot": dataSlot,
4847
4903
  className: cn(
4848
4904
  className,
@@ -4959,7 +5015,7 @@ function useSidebarDrawer() {
4959
5015
  }
4960
5016
  function useOptionalRenderer() {
4961
5017
  try {
4962
- return (0, import_runtime15.useRenderer)();
5018
+ return (0, import_runtime16.useRenderer)();
4963
5019
  } catch {
4964
5020
  return null;
4965
5021
  }
@@ -5066,7 +5122,7 @@ function SidebarInner({
5066
5122
  drawer = true,
5067
5123
  children
5068
5124
  }) {
5069
- const { t } = (0, import_runtime15.useI18n)();
5125
+ const { t } = (0, import_runtime16.useI18n)();
5070
5126
  const isMobile = useIsMobile();
5071
5127
  const { state, setOpenMobile, toggleSidebar } = useSidebar();
5072
5128
  const collapsed = state === "collapsed";
@@ -5844,13 +5900,13 @@ function Pagination2({
5844
5900
  }
5845
5901
 
5846
5902
  // src/components/components/Popover/index.tsx
5847
- var import_runtime16 = require("@pactor-app/runtime");
5903
+ var import_runtime17 = require("@pactor-app/runtime");
5848
5904
  var import_jsx_runtime92 = require("react/jsx-runtime");
5849
5905
  function isDslNode3(value) {
5850
5906
  return typeof value === "object" && value !== null && typeof value.type === "string";
5851
5907
  }
5852
5908
  function Popover2({ content, children, className, style }) {
5853
- const { renderChildren } = (0, import_runtime16.useRenderer)();
5909
+ const { renderChildren } = (0, import_runtime17.useRenderer)();
5854
5910
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Popover, { children: [
5855
5911
  /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
5856
5912
  PopoverTrigger,
@@ -6071,7 +6127,7 @@ function RadioGroup2({
6071
6127
  }
6072
6128
 
6073
6129
  // src/components/components/Resizable/index.tsx
6074
- var import_runtime17 = require("@pactor-app/runtime");
6130
+ var import_runtime18 = require("@pactor-app/runtime");
6075
6131
  var import_react22 = require("react");
6076
6132
 
6077
6133
  // src/ui/resizable.tsx
@@ -6124,7 +6180,7 @@ function Resizable({
6124
6180
  className,
6125
6181
  style
6126
6182
  }) {
6127
- const { renderChildren } = (0, import_runtime17.useRenderer)();
6183
+ const { renderChildren } = (0, import_runtime18.useRenderer)();
6128
6184
  return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(PanelGroup, { orientation: direction, className, style, children: panels.map((panel, index) => /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_react22.Fragment, { children: [
6129
6185
  index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ResizableHandle, { withHandle: true }) : null,
6130
6186
  /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
@@ -6216,7 +6272,7 @@ function ScrollArea2({
6216
6272
  }
6217
6273
 
6218
6274
  // src/components/components/Select/index.tsx
6219
- var import_runtime18 = require("@pactor-app/runtime");
6275
+ var import_runtime19 = require("@pactor-app/runtime");
6220
6276
  var import_react23 = require("react");
6221
6277
 
6222
6278
  // src/ui/select.tsx
@@ -6362,10 +6418,11 @@ function Select2({
6362
6418
  allowClear,
6363
6419
  onChange,
6364
6420
  className,
6421
+ controlClassName,
6365
6422
  style
6366
6423
  }) {
6367
6424
  const form = useFormContext();
6368
- const { t } = (0, import_runtime18.useI18n)();
6425
+ const { t } = (0, import_runtime19.useI18n)();
6369
6426
  const controlId = (0, import_react23.useId)();
6370
6427
  const inForm = form?.inForm === true && typeof name === "string" && name !== "";
6371
6428
  (0, import_react23.useEffect)(() => {
@@ -6387,7 +6444,11 @@ function Select2({
6387
6444
  const select = /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
6388
6445
  "span",
6389
6446
  {
6390
- className: cn("inline-flex items-center gap-1", !inFormRoot && className),
6447
+ className: cn(
6448
+ "inline-flex items-center gap-1",
6449
+ !inFormRoot && className,
6450
+ controlClassName
6451
+ ),
6391
6452
  style: inFormRoot ? void 0 : style,
6392
6453
  children: [
6393
6454
  /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
@@ -6690,7 +6751,7 @@ function Slider2({
6690
6751
  }
6691
6752
 
6692
6753
  // src/components/components/Sonner/index.tsx
6693
- var import_runtime19 = require("@pactor-app/runtime");
6754
+ var import_runtime20 = require("@pactor-app/runtime");
6694
6755
  var import_react25 = require("react");
6695
6756
 
6696
6757
  // src/ui/toast.tsx
@@ -6770,7 +6831,7 @@ function Toaster({ className }) {
6770
6831
  // src/components/components/Sonner/index.tsx
6771
6832
  var import_jsx_runtime111 = require("react/jsx-runtime");
6772
6833
  function Sonner({ className, style }) {
6773
- const { context } = (0, import_runtime19.useRenderer)();
6834
+ const { context } = (0, import_runtime20.useRenderer)();
6774
6835
  (0, import_react25.useEffect)(() => {
6775
6836
  const { actions } = context;
6776
6837
  if (actions.has("toast")) {
@@ -6923,7 +6984,7 @@ function Switch2({
6923
6984
  }
6924
6985
 
6925
6986
  // src/components/components/Table/index.tsx
6926
- var import_runtime20 = require("@pactor-app/runtime");
6987
+ var import_runtime21 = require("@pactor-app/runtime");
6927
6988
  var import_react27 = require("react");
6928
6989
  var import_jsx_runtime117 = require("react/jsx-runtime");
6929
6990
  function renderCellValue2(value) {
@@ -6945,8 +7006,8 @@ function Table3({
6945
7006
  className,
6946
7007
  style
6947
7008
  }) {
6948
- const { renderChildren } = (0, import_runtime20.useRenderer)();
6949
- const { t } = (0, import_runtime20.useI18n)();
7009
+ const { renderChildren } = (0, import_runtime21.useRenderer)();
7010
+ const { t } = (0, import_runtime21.useI18n)();
6950
7011
  const [current, setCurrent] = (0, import_react27.useState)(1);
6951
7012
  const pageSize = pagination === false ? void 0 : pagination?.pageSize;
6952
7013
  const total = dataSource.length;
@@ -7012,7 +7073,7 @@ function Table3({
7012
7073
  }
7013
7074
 
7014
7075
  // src/components/components/Tabs/index.tsx
7015
- var import_runtime21 = require("@pactor-app/runtime");
7076
+ var import_runtime22 = require("@pactor-app/runtime");
7016
7077
 
7017
7078
  // src/ui/tabs.tsx
7018
7079
  var import_tabs = require("@base-ui/react/tabs");
@@ -7098,7 +7159,7 @@ function TabsContent({
7098
7159
  // src/components/components/Tabs/index.tsx
7099
7160
  var import_jsx_runtime119 = require("react/jsx-runtime");
7100
7161
  function Tabs2({ items = [], activeKey, variant, onChange, className, style }) {
7101
- const { renderChildren } = (0, import_runtime21.useRenderer)();
7162
+ const { renderChildren } = (0, import_runtime22.useRenderer)();
7102
7163
  return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
7103
7164
  Tabs,
7104
7165
  {
@@ -7291,9 +7352,9 @@ function Toggle2({
7291
7352
  // src/ui/toggle-group.tsx
7292
7353
  var import_toggle3 = require("@base-ui/react/toggle");
7293
7354
  var import_toggle_group = require("@base-ui/react/toggle-group");
7294
- var React5 = __toESM(require("react"), 1);
7355
+ var React6 = __toESM(require("react"), 1);
7295
7356
  var import_jsx_runtime124 = require("react/jsx-runtime");
7296
- var ToggleGroupContext = React5.createContext({
7357
+ var ToggleGroupContext = React6.createContext({
7297
7358
  size: "default",
7298
7359
  variant: "default"
7299
7360
  });
@@ -7326,7 +7387,7 @@ function ToggleGroupItem({
7326
7387
  size,
7327
7388
  ...props
7328
7389
  }) {
7329
- const context = React5.useContext(ToggleGroupContext);
7390
+ const context = React6.useContext(ToggleGroupContext);
7330
7391
  return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
7331
7392
  import_toggle3.Toggle,
7332
7393
  {
@@ -7599,7 +7660,7 @@ function collectDefaultOpenKeys(registry, activeMenuId) {
7599
7660
  // src/layout/admin/AdminLayout.tsx
7600
7661
  var import_permission = require("@pactor-app/permission");
7601
7662
  var import_router = require("@pactor-app/router");
7602
- var import_runtime22 = require("@pactor-app/runtime");
7663
+ var import_runtime23 = require("@pactor-app/runtime");
7603
7664
  var import_react30 = require("react");
7604
7665
 
7605
7666
  // src/layout/admin/use-media-query.ts
@@ -7846,7 +7907,7 @@ function AdminLayout({
7846
7907
  headerExtra,
7847
7908
  children
7848
7909
  }) {
7849
- const { t } = (0, import_runtime22.useI18n)();
7910
+ const { t } = (0, import_runtime23.useI18n)();
7850
7911
  const mode = config.mode ?? "top-side";
7851
7912
  const showHeader = config.header ?? true;
7852
7913
  const showSidebar = (config.sidebar ?? true) && mode !== "top-bottom";
@@ -8489,7 +8550,7 @@ var OverlayManager = class {
8489
8550
  };
8490
8551
 
8491
8552
  // src/interaction/actions.ts
8492
- var import_runtime23 = require("@pactor-app/runtime");
8553
+ var import_runtime24 = require("@pactor-app/runtime");
8493
8554
  function createUiBridge() {
8494
8555
  return {};
8495
8556
  }
@@ -8505,7 +8566,7 @@ function registerInteractionActions(actions, manager, ui) {
8505
8566
  return failure("[pactor-interaction] overlay.open \u7F3A\u5C11 overlay \u914D\u7F6E\u53C2\u6570");
8506
8567
  }
8507
8568
  const { content, ...rest } = overlay;
8508
- const resolved = (0, import_runtime23.resolveDeep)(rest, ctx.scope);
8569
+ const resolved = (0, import_runtime24.resolveDeep)(rest, ctx.scope);
8509
8570
  const config = { ...resolved, content };
8510
8571
  const data = await manager.open(config, {
8511
8572
  parentScope: { ...ctx.scope }
@@ -8568,7 +8629,7 @@ function isRecord(value) {
8568
8629
  }
8569
8630
 
8570
8631
  // src/interaction/provider.tsx
8571
- var import_runtime24 = require("@pactor-app/runtime");
8632
+ var import_runtime25 = require("@pactor-app/runtime");
8572
8633
  var import_react32 = require("react");
8573
8634
  var import_react_dom = require("react-dom");
8574
8635
  var import_jsx_runtime134 = require("react/jsx-runtime");
@@ -8586,7 +8647,7 @@ function InteractionProvider({
8586
8647
  const [confirmState, setConfirmState] = (0, import_react32.useState)(null);
8587
8648
  const [confirmOpen, setConfirmOpen] = (0, import_react32.useState)(false);
8588
8649
  const [toasts, setToasts] = (0, import_react32.useState)([]);
8589
- const { t } = (0, import_runtime24.useI18n)();
8650
+ const { t } = (0, import_runtime25.useI18n)();
8590
8651
  const { modal, message } = (0, import_react32.useMemo)(() => {
8591
8652
  const pushToast = (type, content) => {
8592
8653
  const id = Date.now() + Math.random();
@@ -8691,7 +8752,7 @@ function InteractionProvider({
8691
8752
 
8692
8753
  // src/interaction/host.tsx
8693
8754
  var import_lucide_react27 = require("lucide-react");
8694
- var import_runtime25 = require("@pactor-app/runtime");
8755
+ var import_runtime26 = require("@pactor-app/runtime");
8695
8756
  var import_react33 = require("react");
8696
8757
  var import_jsx_runtime135 = require("react/jsx-runtime");
8697
8758
  function toCssWidth(width) {
@@ -8701,7 +8762,7 @@ function toCssWidth(width) {
8701
8762
  return typeof width === "number" ? `${width}px` : width;
8702
8763
  }
8703
8764
  function OverlayHost({ manager, resolvePage }) {
8704
- const renderer = (0, import_runtime25.useRenderer)();
8765
+ const renderer = (0, import_runtime26.useRenderer)();
8705
8766
  const stack = (0, import_react33.useSyncExternalStore)(
8706
8767
  (onChange) => manager.subscribe(onChange),
8707
8768
  () => manager.stack()
@@ -8734,7 +8795,7 @@ function OverlayEntryView({
8734
8795
  renderer,
8735
8796
  resolvePage
8736
8797
  }) {
8737
- const { t } = (0, import_runtime25.useI18n)();
8798
+ const { t } = (0, import_runtime26.useI18n)();
8738
8799
  const handleCancel = () => manager.close(entry.id);
8739
8800
  let body = null;
8740
8801
  if (entry.content) {
@@ -8802,7 +8863,7 @@ function ShadcnDrawerView({
8802
8863
  onCancel,
8803
8864
  children
8804
8865
  }) {
8805
- const { t } = (0, import_runtime25.useI18n)();
8866
+ const { t } = (0, import_runtime26.useI18n)();
8806
8867
  const panelStyle = entry.width === void 0 ? void 0 : { width: toCssWidth(entry.width) };
8807
8868
  return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
8808
8869
  Drawer,
@@ -8873,7 +8934,7 @@ function PageOverlayBody({
8873
8934
  return;
8874
8935
  }
8875
8936
  const host = renderer.context;
8876
- created = (0, import_runtime25.createPageRuntime)(pageDsl, {
8937
+ created = (0, import_runtime26.createPageRuntime)(pageDsl, {
8877
8938
  app: host.app,
8878
8939
  user: host.user,
8879
8940
  components: host.components,
@@ -8902,7 +8963,7 @@ function PageOverlayBody({
8902
8963
  if (!child) {
8903
8964
  return null;
8904
8965
  }
8905
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_runtime25.PageRuntimeView, { runtime: child });
8966
+ return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_runtime26.PageRuntimeView, { runtime: child });
8906
8967
  }
8907
8968
  // Annotate the CommonJS export names for ESM import in node:
8908
8969
  0 && (module.exports = {