@pactor-app/ui 1.14.0 → 1.15.1
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/{chunk-GQE62HDV.js → chunk-EDKF6SKZ.js} +1 -1
- package/dist/{chunk-L77EOXU3.js → chunk-LFV72DC2.js} +48 -11
- package/dist/{chunk-AUSWAD26.js → chunk-O7UAPVPB.js} +7 -8
- package/dist/{chunk-NQQAPB7Q.js → chunk-S6AHT3PD.js} +1 -1
- package/dist/{chunk-V2J6FHWX.js → chunk-VNKSGMTT.js} +2 -2
- package/dist/components/index.cjs +87 -51
- package/dist/components/index.d.cts +12 -6
- package/dist/components/index.d.ts +12 -6
- package/dist/components/index.js +4 -4
- package/dist/index.cjs +121 -85
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/layout/index.cjs +7 -8
- package/dist/layout/index.js +3 -3
- package/dist/ui/index.cjs +7 -8
- package/dist/ui/index.js +2 -2
- package/package.json +5 -5
- package/styles.css +3 -1
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Icon,
|
|
3
3
|
Menu,
|
|
4
4
|
Sidebar
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EDKF6SKZ.js";
|
|
6
6
|
import {
|
|
7
7
|
Alert,
|
|
8
8
|
AlertDescription,
|
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
chartColor,
|
|
142
142
|
navigationMenuTriggerStyle,
|
|
143
143
|
toast
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-S6AHT3PD.js";
|
|
145
145
|
import {
|
|
146
146
|
Dialog,
|
|
147
147
|
DialogContent,
|
|
@@ -176,7 +176,7 @@ import {
|
|
|
176
176
|
Tooltip,
|
|
177
177
|
TooltipContent,
|
|
178
178
|
TooltipTrigger
|
|
179
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-O7UAPVPB.js";
|
|
180
180
|
import {
|
|
181
181
|
Button,
|
|
182
182
|
cn
|
|
@@ -1884,6 +1884,7 @@ function Grid({ columns = 1, gap, className, style, children }) {
|
|
|
1884
1884
|
// src/components/components/Header/index.tsx
|
|
1885
1885
|
import { useI18n as useI18n5 } from "@pactor-app/runtime";
|
|
1886
1886
|
import { ChevronDownIcon } from "lucide-react";
|
|
1887
|
+
import { useState as useState10 } from "react";
|
|
1887
1888
|
import { Fragment as Fragment2, jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1888
1889
|
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";
|
|
1889
1890
|
function Header({
|
|
@@ -1894,6 +1895,8 @@ function Header({
|
|
|
1894
1895
|
menu,
|
|
1895
1896
|
user,
|
|
1896
1897
|
locales,
|
|
1898
|
+
themeToggle = false,
|
|
1899
|
+
onThemeChange,
|
|
1897
1900
|
onMenuSelect,
|
|
1898
1901
|
onDropdownSelect,
|
|
1899
1902
|
onUserSelect,
|
|
@@ -1914,7 +1917,7 @@ function Header({
|
|
|
1914
1917
|
"flex h-14 shrink-0 items-center gap-4 border-b bg-card px-4",
|
|
1915
1918
|
className
|
|
1916
1919
|
);
|
|
1917
|
-
if (!hasBrand && !dropdown && !hasMenu && !hasUser && !hasLocales) {
|
|
1920
|
+
if (!hasBrand && !dropdown && !hasMenu && !hasUser && !hasLocales && !themeToggle) {
|
|
1918
1921
|
return /* @__PURE__ */ jsx33("header", { "data-slot": "layout-header", className: rootClass, style, children });
|
|
1919
1922
|
}
|
|
1920
1923
|
const brandNode = hasBrand && /* @__PURE__ */ jsxs24("div", { "data-slot": "header-brand", className: "flex items-center gap-2", children: [
|
|
@@ -1931,7 +1934,7 @@ function Header({
|
|
|
1931
1934
|
] });
|
|
1932
1935
|
const dropdownNode = dropdown !== void 0 && /* @__PURE__ */ jsx33(HeaderDropdownArea, { dropdown, onSelect: onDropdownSelect });
|
|
1933
1936
|
const showLeft = brandLeft || dropdownLeft || hasMenu;
|
|
1934
|
-
const showRight = dropdownRight || brandRight || hasLocales || hasUser;
|
|
1937
|
+
const showRight = dropdownRight || brandRight || hasLocales || hasUser || themeToggle;
|
|
1935
1938
|
return /* @__PURE__ */ jsxs24("header", { "data-slot": "layout-header", className: rootClass, style, children: [
|
|
1936
1939
|
showLeft && /* @__PURE__ */ jsxs24("div", { "data-slot": "header-left", className: "flex items-center gap-4", children: [
|
|
1937
1940
|
brandLeft && brandNode,
|
|
@@ -1942,6 +1945,7 @@ function Header({
|
|
|
1942
1945
|
showRight && /* @__PURE__ */ jsxs24("div", { "data-slot": "header-right", className: "flex items-center gap-4", children: [
|
|
1943
1946
|
dropdownRight && dropdownNode,
|
|
1944
1947
|
brandRight && brandNode,
|
|
1948
|
+
themeToggle && /* @__PURE__ */ jsx33(HeaderThemeToggle, { onSelect: onThemeChange }),
|
|
1945
1949
|
hasLocales && /* @__PURE__ */ jsx33(HeaderLocalesArea, { locales, onSelect: onLocaleChange }),
|
|
1946
1950
|
hasUser && /* @__PURE__ */ jsx33(HeaderUserArea, { user, onSelect: onUserSelect })
|
|
1947
1951
|
] })
|
|
@@ -2089,6 +2093,39 @@ function HeaderLocalesArea({
|
|
|
2089
2093
|
)) })
|
|
2090
2094
|
] });
|
|
2091
2095
|
}
|
|
2096
|
+
function readCurrentTheme() {
|
|
2097
|
+
if (typeof document === "undefined") {
|
|
2098
|
+
return "light";
|
|
2099
|
+
}
|
|
2100
|
+
return document.documentElement.getAttribute("data-pactor-theme") === "dark" ? "dark" : "light";
|
|
2101
|
+
}
|
|
2102
|
+
function HeaderThemeToggle({
|
|
2103
|
+
onSelect
|
|
2104
|
+
}) {
|
|
2105
|
+
const [theme, setTheme] = useState10(readCurrentTheme);
|
|
2106
|
+
const handleToggle = () => {
|
|
2107
|
+
const next = readCurrentTheme() === "dark" ? "light" : "dark";
|
|
2108
|
+
if (next === "dark") {
|
|
2109
|
+
document.documentElement.setAttribute("data-pactor-theme", "dark");
|
|
2110
|
+
} else {
|
|
2111
|
+
document.documentElement.removeAttribute("data-pactor-theme");
|
|
2112
|
+
}
|
|
2113
|
+
setTheme(next);
|
|
2114
|
+
onSelect?.(next);
|
|
2115
|
+
};
|
|
2116
|
+
return /* @__PURE__ */ jsx33(
|
|
2117
|
+
"button",
|
|
2118
|
+
{
|
|
2119
|
+
type: "button",
|
|
2120
|
+
"data-slot": "header-theme-toggle",
|
|
2121
|
+
className: "flex size-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",
|
|
2122
|
+
title: theme === "dark" ? "\u5207\u6362\u4E3A\u6D45\u8272" : "\u5207\u6362\u4E3A\u6DF1\u8272",
|
|
2123
|
+
"aria-label": "\u5207\u6362\u660E\u6697\u4E3B\u9898",
|
|
2124
|
+
onClick: handleToggle,
|
|
2125
|
+
children: theme === "dark" ? /* @__PURE__ */ jsx33(Icon, { name: "sun", size: "sm" }) : /* @__PURE__ */ jsx33(Icon, { name: "moon", size: "sm" })
|
|
2126
|
+
}
|
|
2127
|
+
);
|
|
2128
|
+
}
|
|
2092
2129
|
|
|
2093
2130
|
// src/components/components/HoverCard/index.tsx
|
|
2094
2131
|
import { useRenderer as useRenderer9 } from "@pactor-app/runtime";
|
|
@@ -2222,7 +2259,7 @@ function InputGroup2({ className, style, children }) {
|
|
|
2222
2259
|
}
|
|
2223
2260
|
|
|
2224
2261
|
// src/components/components/InputOTP/index.tsx
|
|
2225
|
-
import { useEffect as useEffect8, useState as
|
|
2262
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
2226
2263
|
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2227
2264
|
function InputOTP2({
|
|
2228
2265
|
name,
|
|
@@ -2245,7 +2282,7 @@ function InputOTP2({
|
|
|
2245
2282
|
}
|
|
2246
2283
|
return void 0;
|
|
2247
2284
|
});
|
|
2248
|
-
const [innerValue, setInnerValue] =
|
|
2285
|
+
const [innerValue, setInnerValue] = useState11(typeof value === "string" ? value : "");
|
|
2249
2286
|
useEffect8(() => {
|
|
2250
2287
|
if (!inForm) setInnerValue(typeof value === "string" ? value : "");
|
|
2251
2288
|
}, [inForm, value]);
|
|
@@ -2450,7 +2487,7 @@ function Page({ title, className, style, children }) {
|
|
|
2450
2487
|
}
|
|
2451
2488
|
|
|
2452
2489
|
// src/components/components/Pagination/index.tsx
|
|
2453
|
-
import { useState as
|
|
2490
|
+
import { useState as useState12 } from "react";
|
|
2454
2491
|
import { jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2455
2492
|
function pageItems(current, count) {
|
|
2456
2493
|
if (count <= 7) {
|
|
@@ -2472,7 +2509,7 @@ function Pagination2({
|
|
|
2472
2509
|
className,
|
|
2473
2510
|
style
|
|
2474
2511
|
}) {
|
|
2475
|
-
const [innerPage, setInnerPage] =
|
|
2512
|
+
const [innerPage, setInnerPage] = useState12(1);
|
|
2476
2513
|
const pageCount = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
2477
2514
|
const current = Math.min(Math.max(1, page ?? innerPage), pageCount);
|
|
2478
2515
|
const goTo = (next) => {
|
|
@@ -3118,7 +3155,7 @@ function Switch2({
|
|
|
3118
3155
|
|
|
3119
3156
|
// src/components/components/Table/index.tsx
|
|
3120
3157
|
import { useI18n as useI18n8, useRenderer as useRenderer15 } from "@pactor-app/runtime";
|
|
3121
|
-
import { useState as
|
|
3158
|
+
import { useState as useState13 } from "react";
|
|
3122
3159
|
import { jsx as jsx63, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3123
3160
|
function renderCellValue2(value) {
|
|
3124
3161
|
if (value === void 0 || value === null) {
|
|
@@ -3141,7 +3178,7 @@ function Table2({
|
|
|
3141
3178
|
}) {
|
|
3142
3179
|
const { renderChildren } = useRenderer15();
|
|
3143
3180
|
const { t } = useI18n8();
|
|
3144
|
-
const [current, setCurrent] =
|
|
3181
|
+
const [current, setCurrent] = useState13(1);
|
|
3145
3182
|
const pageSize = pagination === false ? void 0 : pagination?.pageSize;
|
|
3146
3183
|
const total = dataSource.length;
|
|
3147
3184
|
const pageCount = pageSize !== void 0 && pageSize > 0 ? Math.max(1, Math.ceil(total / pageSize)) : 1;
|
|
@@ -508,9 +508,7 @@ function useIsMobile() {
|
|
|
508
508
|
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
509
509
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
510
510
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
511
|
-
var SIDEBAR_WIDTH = "16rem";
|
|
512
511
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
513
|
-
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
514
512
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
515
513
|
var SidebarContext = React.createContext(null);
|
|
516
514
|
function useSidebar() {
|
|
@@ -575,11 +573,7 @@ function SidebarProvider({
|
|
|
575
573
|
"div",
|
|
576
574
|
{
|
|
577
575
|
"data-slot": "sidebar-wrapper",
|
|
578
|
-
style
|
|
579
|
-
"--sidebar-width": SIDEBAR_WIDTH,
|
|
580
|
-
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
581
|
-
...style
|
|
582
|
-
},
|
|
576
|
+
style,
|
|
583
577
|
className: cn(
|
|
584
578
|
"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",
|
|
585
579
|
className
|
|
@@ -663,7 +657,12 @@ function SidebarRoot({
|
|
|
663
657
|
className: cn(
|
|
664
658
|
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
665
659
|
side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
666
|
-
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" :
|
|
660
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : (
|
|
661
|
+
// 边框色显式声明:不能只给宽度——宿主引入 Tailwind 时其
|
|
662
|
+
// preflight(同为 base 层且后加载)会把默认 border-color
|
|
663
|
+
// 重置为 currentColor,宽度型边框会脱离皮肤令牌
|
|
664
|
+
"border-sidebar-border group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l"
|
|
665
|
+
),
|
|
667
666
|
className
|
|
668
667
|
),
|
|
669
668
|
...props,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Icon,
|
|
3
3
|
Menu,
|
|
4
4
|
Sidebar
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EDKF6SKZ.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-
|
|
18
|
+
} from "./chunk-O7UAPVPB.js";
|
|
19
19
|
import {
|
|
20
20
|
cn
|
|
21
21
|
} from "./chunk-WKJUCGV4.js";
|
|
@@ -3761,6 +3761,7 @@ function Grid({ columns = 1, gap, className, style, children }) {
|
|
|
3761
3761
|
// src/components/components/Header/index.tsx
|
|
3762
3762
|
var import_runtime11 = require("@pactor-app/runtime");
|
|
3763
3763
|
var import_lucide_react16 = require("lucide-react");
|
|
3764
|
+
var import_react15 = require("react");
|
|
3764
3765
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3765
3766
|
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";
|
|
3766
3767
|
function Header({
|
|
@@ -3771,6 +3772,8 @@ function Header({
|
|
|
3771
3772
|
menu,
|
|
3772
3773
|
user,
|
|
3773
3774
|
locales,
|
|
3775
|
+
themeToggle = false,
|
|
3776
|
+
onThemeChange,
|
|
3774
3777
|
onMenuSelect,
|
|
3775
3778
|
onDropdownSelect,
|
|
3776
3779
|
onUserSelect,
|
|
@@ -3791,7 +3794,7 @@ function Header({
|
|
|
3791
3794
|
"flex h-14 shrink-0 items-center gap-4 border-b bg-card px-4",
|
|
3792
3795
|
className
|
|
3793
3796
|
);
|
|
3794
|
-
if (!hasBrand && !dropdown && !hasMenu && !hasUser && !hasLocales) {
|
|
3797
|
+
if (!hasBrand && !dropdown && !hasMenu && !hasUser && !hasLocales && !themeToggle) {
|
|
3795
3798
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("header", { "data-slot": "layout-header", className: rootClass, style, children });
|
|
3796
3799
|
}
|
|
3797
3800
|
const brandNode = hasBrand && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { "data-slot": "header-brand", className: "flex items-center gap-2", children: [
|
|
@@ -3808,7 +3811,7 @@ function Header({
|
|
|
3808
3811
|
] });
|
|
3809
3812
|
const dropdownNode = dropdown !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(HeaderDropdownArea, { dropdown, onSelect: onDropdownSelect });
|
|
3810
3813
|
const showLeft = brandLeft || dropdownLeft || hasMenu;
|
|
3811
|
-
const showRight = dropdownRight || brandRight || hasLocales || hasUser;
|
|
3814
|
+
const showRight = dropdownRight || brandRight || hasLocales || hasUser || themeToggle;
|
|
3812
3815
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("header", { "data-slot": "layout-header", className: rootClass, style, children: [
|
|
3813
3816
|
showLeft && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { "data-slot": "header-left", className: "flex items-center gap-4", children: [
|
|
3814
3817
|
brandLeft && brandNode,
|
|
@@ -3819,6 +3822,7 @@ function Header({
|
|
|
3819
3822
|
showRight && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { "data-slot": "header-right", className: "flex items-center gap-4", children: [
|
|
3820
3823
|
dropdownRight && dropdownNode,
|
|
3821
3824
|
brandRight && brandNode,
|
|
3825
|
+
themeToggle && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(HeaderThemeToggle, { onSelect: onThemeChange }),
|
|
3822
3826
|
hasLocales && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(HeaderLocalesArea, { locales, onSelect: onLocaleChange }),
|
|
3823
3827
|
hasUser && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(HeaderUserArea, { user, onSelect: onUserSelect })
|
|
3824
3828
|
] })
|
|
@@ -3966,6 +3970,39 @@ function HeaderLocalesArea({
|
|
|
3966
3970
|
)) })
|
|
3967
3971
|
] });
|
|
3968
3972
|
}
|
|
3973
|
+
function readCurrentTheme() {
|
|
3974
|
+
if (typeof document === "undefined") {
|
|
3975
|
+
return "light";
|
|
3976
|
+
}
|
|
3977
|
+
return document.documentElement.getAttribute("data-pactor-theme") === "dark" ? "dark" : "light";
|
|
3978
|
+
}
|
|
3979
|
+
function HeaderThemeToggle({
|
|
3980
|
+
onSelect
|
|
3981
|
+
}) {
|
|
3982
|
+
const [theme, setTheme] = (0, import_react15.useState)(readCurrentTheme);
|
|
3983
|
+
const handleToggle = () => {
|
|
3984
|
+
const next = readCurrentTheme() === "dark" ? "light" : "dark";
|
|
3985
|
+
if (next === "dark") {
|
|
3986
|
+
document.documentElement.setAttribute("data-pactor-theme", "dark");
|
|
3987
|
+
} else {
|
|
3988
|
+
document.documentElement.removeAttribute("data-pactor-theme");
|
|
3989
|
+
}
|
|
3990
|
+
setTheme(next);
|
|
3991
|
+
onSelect?.(next);
|
|
3992
|
+
};
|
|
3993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3994
|
+
"button",
|
|
3995
|
+
{
|
|
3996
|
+
type: "button",
|
|
3997
|
+
"data-slot": "header-theme-toggle",
|
|
3998
|
+
className: "flex size-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",
|
|
3999
|
+
title: theme === "dark" ? "\u5207\u6362\u4E3A\u6D45\u8272" : "\u5207\u6362\u4E3A\u6DF1\u8272",
|
|
4000
|
+
"aria-label": "\u5207\u6362\u660E\u6697\u4E3B\u9898",
|
|
4001
|
+
onClick: handleToggle,
|
|
4002
|
+
children: theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Icon, { name: "sun", size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Icon, { name: "moon", size: "sm" })
|
|
4003
|
+
}
|
|
4004
|
+
);
|
|
4005
|
+
}
|
|
3969
4006
|
|
|
3970
4007
|
// src/components/components/HoverCard/index.tsx
|
|
3971
4008
|
var import_runtime12 = require("@pactor-app/runtime");
|
|
@@ -4027,7 +4064,7 @@ function HoverCard2({ content, children, className, style }) {
|
|
|
4027
4064
|
|
|
4028
4065
|
// src/components/components/Input/index.tsx
|
|
4029
4066
|
var import_runtime13 = require("@pactor-app/runtime");
|
|
4030
|
-
var
|
|
4067
|
+
var import_react16 = require("react");
|
|
4031
4068
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4032
4069
|
function Input2({
|
|
4033
4070
|
name,
|
|
@@ -4045,9 +4082,9 @@ function Input2({
|
|
|
4045
4082
|
}) {
|
|
4046
4083
|
const form = useFormContext();
|
|
4047
4084
|
const { t } = (0, import_runtime13.useI18n)();
|
|
4048
|
-
const controlId = (0,
|
|
4085
|
+
const controlId = (0, import_react16.useId)();
|
|
4049
4086
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
4050
|
-
(0,
|
|
4087
|
+
(0, import_react16.useEffect)(() => {
|
|
4051
4088
|
if (inForm && form && name) {
|
|
4052
4089
|
form.registerField(name, rules, value);
|
|
4053
4090
|
return () => form.unregisterField(name);
|
|
@@ -4164,7 +4201,7 @@ function InputGroup2({ className, style, children }) {
|
|
|
4164
4201
|
}
|
|
4165
4202
|
|
|
4166
4203
|
// src/components/components/InputOTP/index.tsx
|
|
4167
|
-
var
|
|
4204
|
+
var import_react17 = require("react");
|
|
4168
4205
|
|
|
4169
4206
|
// src/ui/input-otp.tsx
|
|
4170
4207
|
var import_input_otp = require("input-otp");
|
|
@@ -4240,15 +4277,15 @@ function InputOTP2({
|
|
|
4240
4277
|
}) {
|
|
4241
4278
|
const form = useFormContext();
|
|
4242
4279
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
4243
|
-
(0,
|
|
4280
|
+
(0, import_react17.useEffect)(() => {
|
|
4244
4281
|
if (inForm && form && name) {
|
|
4245
4282
|
form.registerField(name, rules, value);
|
|
4246
4283
|
return () => form.unregisterField(name);
|
|
4247
4284
|
}
|
|
4248
4285
|
return void 0;
|
|
4249
4286
|
});
|
|
4250
|
-
const [innerValue, setInnerValue] = (0,
|
|
4251
|
-
(0,
|
|
4287
|
+
const [innerValue, setInnerValue] = (0, import_react17.useState)(typeof value === "string" ? value : "");
|
|
4288
|
+
(0, import_react17.useEffect)(() => {
|
|
4252
4289
|
if (!inForm) setInnerValue(typeof value === "string" ? value : "");
|
|
4253
4290
|
}, [inForm, value]);
|
|
4254
4291
|
const current = inForm && form && name ? typeof form.values[name] === "string" ? form.values[name] : "" : innerValue;
|
|
@@ -4486,7 +4523,7 @@ function Link2({ href, text, target, className, style, children }) {
|
|
|
4486
4523
|
}
|
|
4487
4524
|
|
|
4488
4525
|
// src/components/components/Menu/index.tsx
|
|
4489
|
-
var
|
|
4526
|
+
var import_react20 = require("react");
|
|
4490
4527
|
|
|
4491
4528
|
// src/components/components/Sidebar/rail-tooltip.tsx
|
|
4492
4529
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
@@ -4502,7 +4539,7 @@ function RailTooltip({
|
|
|
4502
4539
|
|
|
4503
4540
|
// src/components/components/Sidebar/index.tsx
|
|
4504
4541
|
var import_runtime16 = require("@pactor-app/runtime");
|
|
4505
|
-
var
|
|
4542
|
+
var import_react19 = require("react");
|
|
4506
4543
|
|
|
4507
4544
|
// src/ui/sidebar.tsx
|
|
4508
4545
|
var React5 = __toESM(require("react"), 1);
|
|
@@ -4510,13 +4547,13 @@ var import_class_variance_authority5 = require("class-variance-authority");
|
|
|
4510
4547
|
var import_lucide_react19 = require("lucide-react");
|
|
4511
4548
|
|
|
4512
4549
|
// src/hooks/use-mobile.ts
|
|
4513
|
-
var
|
|
4550
|
+
var import_react18 = require("react");
|
|
4514
4551
|
var MOBILE_MEDIA_QUERY = "(max-width: 767px)";
|
|
4515
4552
|
function useIsMobile() {
|
|
4516
|
-
const [isMobile, setIsMobile] = (0,
|
|
4553
|
+
const [isMobile, setIsMobile] = (0, import_react18.useState)(
|
|
4517
4554
|
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(MOBILE_MEDIA_QUERY).matches
|
|
4518
4555
|
);
|
|
4519
|
-
(0,
|
|
4556
|
+
(0, import_react18.useEffect)(() => {
|
|
4520
4557
|
if (typeof window.matchMedia !== "function") {
|
|
4521
4558
|
return;
|
|
4522
4559
|
}
|
|
@@ -4693,9 +4730,7 @@ function Skeleton({ className, ...props }) {
|
|
|
4693
4730
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
4694
4731
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
4695
4732
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
4696
|
-
var SIDEBAR_WIDTH = "16rem";
|
|
4697
4733
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
4698
|
-
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
4699
4734
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
4700
4735
|
var SidebarContext = React5.createContext(null);
|
|
4701
4736
|
function useSidebar() {
|
|
@@ -4760,11 +4795,7 @@ function SidebarProvider({
|
|
|
4760
4795
|
"div",
|
|
4761
4796
|
{
|
|
4762
4797
|
"data-slot": "sidebar-wrapper",
|
|
4763
|
-
style
|
|
4764
|
-
"--sidebar-width": SIDEBAR_WIDTH,
|
|
4765
|
-
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
4766
|
-
...style
|
|
4767
|
-
},
|
|
4798
|
+
style,
|
|
4768
4799
|
className: cn(
|
|
4769
4800
|
"group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",
|
|
4770
4801
|
className
|
|
@@ -4848,7 +4879,12 @@ function SidebarRoot({
|
|
|
4848
4879
|
className: cn(
|
|
4849
4880
|
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
4850
4881
|
side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
4851
|
-
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" :
|
|
4882
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : (
|
|
4883
|
+
// 边框色显式声明:不能只给宽度——宿主引入 Tailwind 时其
|
|
4884
|
+
// preflight(同为 base 层且后加载)会把默认 border-color
|
|
4885
|
+
// 重置为 currentColor,宽度型边框会脱离皮肤令牌
|
|
4886
|
+
"border-sidebar-border group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l"
|
|
4887
|
+
),
|
|
4852
4888
|
className
|
|
4853
4889
|
),
|
|
4854
4890
|
...props,
|
|
@@ -5149,14 +5185,14 @@ function SidebarInner({
|
|
|
5149
5185
|
const isMobile = useIsMobile();
|
|
5150
5186
|
const { state, setOpenMobile, toggleSidebar } = useSidebar();
|
|
5151
5187
|
const collapsed = state === "collapsed";
|
|
5152
|
-
const prevCollapsed = (0,
|
|
5153
|
-
(0,
|
|
5188
|
+
const prevCollapsed = (0, import_react19.useRef)(collapsed);
|
|
5189
|
+
(0, import_react19.useEffect)(() => {
|
|
5154
5190
|
if (prevCollapsed.current !== collapsed) {
|
|
5155
5191
|
prevCollapsed.current = collapsed;
|
|
5156
5192
|
onCollapse?.(collapsed);
|
|
5157
5193
|
}
|
|
5158
5194
|
}, [collapsed, onCollapse]);
|
|
5159
|
-
(0,
|
|
5195
|
+
(0, import_react19.useEffect)(() => {
|
|
5160
5196
|
if (locationKey !== void 0) {
|
|
5161
5197
|
setOpenMobile(false);
|
|
5162
5198
|
}
|
|
@@ -5254,7 +5290,7 @@ function Menu2({
|
|
|
5254
5290
|
const drawer = useSidebarDrawer();
|
|
5255
5291
|
const collapsed = mode === "inline" && drawer?.collapsed === true;
|
|
5256
5292
|
const collapsibleOn = collapsible && mode === "inline" && !collapsed;
|
|
5257
|
-
const [expandedKeys, setExpandedKeys] = (0,
|
|
5293
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react20.useState)(() => {
|
|
5258
5294
|
const initial = new Set(defaultExpandedKeys ?? []);
|
|
5259
5295
|
if (selectedKey !== void 0) {
|
|
5260
5296
|
collectAncestors(items, selectedKey, initial);
|
|
@@ -5334,8 +5370,8 @@ function MenuEntry({
|
|
|
5334
5370
|
const isDirectory = collapsible && hasChildren;
|
|
5335
5371
|
const expanded = isDirectory && expandedKeys?.has(item.key) === true;
|
|
5336
5372
|
const railDirectory = collapsed && hasChildren;
|
|
5337
|
-
const [flyoutOpen, setFlyoutOpen] = (0,
|
|
5338
|
-
const flyoutTimer = (0,
|
|
5373
|
+
const [flyoutOpen, setFlyoutOpen] = (0, import_react20.useState)(false);
|
|
5374
|
+
const flyoutTimer = (0, import_react20.useRef)(void 0);
|
|
5339
5375
|
const flyoutOpenNow = () => {
|
|
5340
5376
|
window.clearTimeout(flyoutTimer.current);
|
|
5341
5377
|
setFlyoutOpen(true);
|
|
@@ -5344,7 +5380,7 @@ function MenuEntry({
|
|
|
5344
5380
|
window.clearTimeout(flyoutTimer.current);
|
|
5345
5381
|
flyoutTimer.current = window.setTimeout(() => setFlyoutOpen(false), 200);
|
|
5346
5382
|
};
|
|
5347
|
-
(0,
|
|
5383
|
+
(0, import_react20.useEffect)(() => () => window.clearTimeout(flyoutTimer.current), []);
|
|
5348
5384
|
const button = /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
5349
5385
|
"button",
|
|
5350
5386
|
{
|
|
@@ -5743,7 +5779,7 @@ function Page({ title, className, style, children }) {
|
|
|
5743
5779
|
}
|
|
5744
5780
|
|
|
5745
5781
|
// src/components/components/Pagination/index.tsx
|
|
5746
|
-
var
|
|
5782
|
+
var import_react21 = require("react");
|
|
5747
5783
|
|
|
5748
5784
|
// src/ui/pagination.tsx
|
|
5749
5785
|
var import_lucide_react21 = require("lucide-react");
|
|
@@ -5871,7 +5907,7 @@ function Pagination2({
|
|
|
5871
5907
|
className,
|
|
5872
5908
|
style
|
|
5873
5909
|
}) {
|
|
5874
|
-
const [innerPage, setInnerPage] = (0,
|
|
5910
|
+
const [innerPage, setInnerPage] = (0, import_react21.useState)(1);
|
|
5875
5911
|
const pageCount = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
5876
5912
|
const current = Math.min(Math.max(1, page ?? innerPage), pageCount);
|
|
5877
5913
|
const goTo = (next) => {
|
|
@@ -5991,7 +6027,7 @@ function Progress2({ value, className, style }) {
|
|
|
5991
6027
|
}
|
|
5992
6028
|
|
|
5993
6029
|
// src/components/components/RadioGroup/index.tsx
|
|
5994
|
-
var
|
|
6030
|
+
var import_react22 = require("react");
|
|
5995
6031
|
|
|
5996
6032
|
// src/ui/radio-group.tsx
|
|
5997
6033
|
var import_radio = require("@base-ui/react/radio");
|
|
@@ -6077,9 +6113,9 @@ function RadioGroup2({
|
|
|
6077
6113
|
style
|
|
6078
6114
|
}) {
|
|
6079
6115
|
const form = useFormContext();
|
|
6080
|
-
const controlId = (0,
|
|
6116
|
+
const controlId = (0, import_react22.useId)();
|
|
6081
6117
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6082
|
-
(0,
|
|
6118
|
+
(0, import_react22.useEffect)(() => {
|
|
6083
6119
|
if (inForm && form && name) {
|
|
6084
6120
|
form.registerField(name, rules, value);
|
|
6085
6121
|
return () => form.unregisterField(name);
|
|
@@ -6151,7 +6187,7 @@ function RadioGroup2({
|
|
|
6151
6187
|
|
|
6152
6188
|
// src/components/components/Resizable/index.tsx
|
|
6153
6189
|
var import_runtime18 = require("@pactor-app/runtime");
|
|
6154
|
-
var
|
|
6190
|
+
var import_react23 = require("react");
|
|
6155
6191
|
|
|
6156
6192
|
// src/ui/resizable.tsx
|
|
6157
6193
|
var import_lucide_react22 = require("lucide-react");
|
|
@@ -6204,7 +6240,7 @@ function Resizable({
|
|
|
6204
6240
|
style
|
|
6205
6241
|
}) {
|
|
6206
6242
|
const { renderChildren } = (0, import_runtime18.useRenderer)();
|
|
6207
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(PanelGroup, { orientation: direction, className, style, children: panels.map((panel, index) => /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
6243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(PanelGroup, { orientation: direction, className, style, children: panels.map((panel, index) => /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_react23.Fragment, { children: [
|
|
6208
6244
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ResizableHandle, { withHandle: true }) : null,
|
|
6209
6245
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
6210
6246
|
Panel,
|
|
@@ -6296,7 +6332,7 @@ function ScrollArea2({
|
|
|
6296
6332
|
|
|
6297
6333
|
// src/components/components/Select/index.tsx
|
|
6298
6334
|
var import_runtime19 = require("@pactor-app/runtime");
|
|
6299
|
-
var
|
|
6335
|
+
var import_react24 = require("react");
|
|
6300
6336
|
|
|
6301
6337
|
// src/ui/select.tsx
|
|
6302
6338
|
var import_select = require("@base-ui/react/select");
|
|
@@ -6446,9 +6482,9 @@ function Select2({
|
|
|
6446
6482
|
}) {
|
|
6447
6483
|
const form = useFormContext();
|
|
6448
6484
|
const { t } = (0, import_runtime19.useI18n)();
|
|
6449
|
-
const controlId = (0,
|
|
6485
|
+
const controlId = (0, import_react24.useId)();
|
|
6450
6486
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6451
|
-
(0,
|
|
6487
|
+
(0, import_react24.useEffect)(() => {
|
|
6452
6488
|
if (inForm && form && name) {
|
|
6453
6489
|
form.registerField(name, rules, value);
|
|
6454
6490
|
return () => form.unregisterField(name);
|
|
@@ -6643,7 +6679,7 @@ function Skeleton2({ shape = "line", width, height, className, style }) {
|
|
|
6643
6679
|
}
|
|
6644
6680
|
|
|
6645
6681
|
// src/components/components/Slider/index.tsx
|
|
6646
|
-
var
|
|
6682
|
+
var import_react25 = require("react");
|
|
6647
6683
|
|
|
6648
6684
|
// src/ui/slider.tsx
|
|
6649
6685
|
var import_slider = require("@base-ui/react/slider");
|
|
@@ -6725,7 +6761,7 @@ function Slider2({
|
|
|
6725
6761
|
}) {
|
|
6726
6762
|
const form = useFormContext();
|
|
6727
6763
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6728
|
-
(0,
|
|
6764
|
+
(0, import_react25.useEffect)(() => {
|
|
6729
6765
|
if (inForm && form && name) {
|
|
6730
6766
|
form.registerField(name, rules, value);
|
|
6731
6767
|
return () => form.unregisterField(name);
|
|
@@ -6776,7 +6812,7 @@ function Slider2({
|
|
|
6776
6812
|
|
|
6777
6813
|
// src/components/components/Sonner/index.tsx
|
|
6778
6814
|
var import_runtime20 = require("@pactor-app/runtime");
|
|
6779
|
-
var
|
|
6815
|
+
var import_react26 = require("react");
|
|
6780
6816
|
|
|
6781
6817
|
// src/ui/toast.tsx
|
|
6782
6818
|
var import_toast = require("@base-ui/react/toast");
|
|
@@ -6856,7 +6892,7 @@ function Toaster({ className }) {
|
|
|
6856
6892
|
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
6857
6893
|
function Sonner({ className, style }) {
|
|
6858
6894
|
const { context } = (0, import_runtime20.useRenderer)();
|
|
6859
|
-
(0,
|
|
6895
|
+
(0, import_react26.useEffect)(() => {
|
|
6860
6896
|
const { actions } = context;
|
|
6861
6897
|
if (actions.has("toast")) {
|
|
6862
6898
|
return;
|
|
@@ -6914,7 +6950,7 @@ function Statistic({ title, value, precision, suffix, className, style }) {
|
|
|
6914
6950
|
}
|
|
6915
6951
|
|
|
6916
6952
|
// src/components/components/Switch/index.tsx
|
|
6917
|
-
var
|
|
6953
|
+
var import_react27 = require("react");
|
|
6918
6954
|
|
|
6919
6955
|
// src/ui/switch.tsx
|
|
6920
6956
|
var import_switch = require("@base-ui/react/switch");
|
|
@@ -6953,9 +6989,9 @@ function Switch2({
|
|
|
6953
6989
|
style
|
|
6954
6990
|
}) {
|
|
6955
6991
|
const form = useFormContext();
|
|
6956
|
-
const controlId = (0,
|
|
6992
|
+
const controlId = (0, import_react27.useId)();
|
|
6957
6993
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6958
|
-
(0,
|
|
6994
|
+
(0, import_react27.useEffect)(() => {
|
|
6959
6995
|
if (inForm && form && name) {
|
|
6960
6996
|
form.registerField(name, rules, value);
|
|
6961
6997
|
return () => form.unregisterField(name);
|
|
@@ -7009,7 +7045,7 @@ function Switch2({
|
|
|
7009
7045
|
|
|
7010
7046
|
// src/components/components/Table/index.tsx
|
|
7011
7047
|
var import_runtime21 = require("@pactor-app/runtime");
|
|
7012
|
-
var
|
|
7048
|
+
var import_react28 = require("react");
|
|
7013
7049
|
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
7014
7050
|
function renderCellValue2(value) {
|
|
7015
7051
|
if (value === void 0 || value === null) {
|
|
@@ -7032,7 +7068,7 @@ function Table3({
|
|
|
7032
7068
|
}) {
|
|
7033
7069
|
const { renderChildren } = (0, import_runtime21.useRenderer)();
|
|
7034
7070
|
const { t } = (0, import_runtime21.useI18n)();
|
|
7035
|
-
const [current, setCurrent] = (0,
|
|
7071
|
+
const [current, setCurrent] = (0, import_react28.useState)(1);
|
|
7036
7072
|
const pageSize = pagination === false ? void 0 : pagination?.pageSize;
|
|
7037
7073
|
const total = dataSource.length;
|
|
7038
7074
|
const pageCount = pageSize !== void 0 && pageSize > 0 ? Math.max(1, Math.ceil(total / pageSize)) : 1;
|
|
@@ -7267,7 +7303,7 @@ function Text({
|
|
|
7267
7303
|
}
|
|
7268
7304
|
|
|
7269
7305
|
// src/components/components/Textarea/index.tsx
|
|
7270
|
-
var
|
|
7306
|
+
var import_react29 = require("react");
|
|
7271
7307
|
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
7272
7308
|
function Textarea2({
|
|
7273
7309
|
name,
|
|
@@ -7282,9 +7318,9 @@ function Textarea2({
|
|
|
7282
7318
|
style
|
|
7283
7319
|
}) {
|
|
7284
7320
|
const form = useFormContext();
|
|
7285
|
-
const controlId = (0,
|
|
7321
|
+
const controlId = (0, import_react29.useId)();
|
|
7286
7322
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
7287
|
-
(0,
|
|
7323
|
+
(0, import_react29.useEffect)(() => {
|
|
7288
7324
|
if (inForm && form && name) {
|
|
7289
7325
|
form.registerField(name, rules, value);
|
|
7290
7326
|
return () => form.unregisterField(name);
|