@pactor-app/ui 1.14.0 → 1.15.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/{chunk-GQE62HDV.js → chunk-5PTCPU2F.js} +1 -1
- package/dist/{chunk-L77EOXU3.js → chunk-E3BFTXSJ.js} +48 -11
- package/dist/{chunk-AUSWAD26.js → chunk-HGVZUEZG.js} +6 -1
- package/dist/{chunk-V2J6FHWX.js → chunk-PQA6RJ52.js} +2 -2
- package/dist/{chunk-NQQAPB7Q.js → chunk-VFPLY2GI.js} +1 -1
- package/dist/components/index.cjs +86 -44
- 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 +120 -78
- 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 +6 -1
- package/dist/layout/index.js +3 -3
- package/dist/ui/index.cjs +6 -1
- package/dist/ui/index.js +2 -2
- package/package.json +5 -5
- package/styles.css +1 -1
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Icon,
|
|
3
3
|
Menu,
|
|
4
4
|
Sidebar
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5PTCPU2F.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-VFPLY2GI.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-HGVZUEZG.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;
|
|
@@ -663,7 +663,12 @@ function SidebarRoot({
|
|
|
663
663
|
className: cn(
|
|
664
664
|
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
665
665
|
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)]" :
|
|
666
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : (
|
|
667
|
+
// 边框色显式声明:不能只给宽度——宿主引入 Tailwind 时其
|
|
668
|
+
// preflight(同为 base 层且后加载)会把默认 border-color
|
|
669
|
+
// 重置为 currentColor,宽度型边框会脱离皮肤令牌
|
|
670
|
+
"border-sidebar-border group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l"
|
|
671
|
+
),
|
|
667
672
|
className
|
|
668
673
|
),
|
|
669
674
|
...props,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Icon,
|
|
3
3
|
Menu,
|
|
4
4
|
Sidebar
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5PTCPU2F.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-HGVZUEZG.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
|
}
|
|
@@ -4848,7 +4885,12 @@ function SidebarRoot({
|
|
|
4848
4885
|
className: cn(
|
|
4849
4886
|
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
4850
4887
|
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)]" :
|
|
4888
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : (
|
|
4889
|
+
// 边框色显式声明:不能只给宽度——宿主引入 Tailwind 时其
|
|
4890
|
+
// preflight(同为 base 层且后加载)会把默认 border-color
|
|
4891
|
+
// 重置为 currentColor,宽度型边框会脱离皮肤令牌
|
|
4892
|
+
"border-sidebar-border group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l"
|
|
4893
|
+
),
|
|
4852
4894
|
className
|
|
4853
4895
|
),
|
|
4854
4896
|
...props,
|
|
@@ -5149,14 +5191,14 @@ function SidebarInner({
|
|
|
5149
5191
|
const isMobile = useIsMobile();
|
|
5150
5192
|
const { state, setOpenMobile, toggleSidebar } = useSidebar();
|
|
5151
5193
|
const collapsed = state === "collapsed";
|
|
5152
|
-
const prevCollapsed = (0,
|
|
5153
|
-
(0,
|
|
5194
|
+
const prevCollapsed = (0, import_react19.useRef)(collapsed);
|
|
5195
|
+
(0, import_react19.useEffect)(() => {
|
|
5154
5196
|
if (prevCollapsed.current !== collapsed) {
|
|
5155
5197
|
prevCollapsed.current = collapsed;
|
|
5156
5198
|
onCollapse?.(collapsed);
|
|
5157
5199
|
}
|
|
5158
5200
|
}, [collapsed, onCollapse]);
|
|
5159
|
-
(0,
|
|
5201
|
+
(0, import_react19.useEffect)(() => {
|
|
5160
5202
|
if (locationKey !== void 0) {
|
|
5161
5203
|
setOpenMobile(false);
|
|
5162
5204
|
}
|
|
@@ -5254,7 +5296,7 @@ function Menu2({
|
|
|
5254
5296
|
const drawer = useSidebarDrawer();
|
|
5255
5297
|
const collapsed = mode === "inline" && drawer?.collapsed === true;
|
|
5256
5298
|
const collapsibleOn = collapsible && mode === "inline" && !collapsed;
|
|
5257
|
-
const [expandedKeys, setExpandedKeys] = (0,
|
|
5299
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react20.useState)(() => {
|
|
5258
5300
|
const initial = new Set(defaultExpandedKeys ?? []);
|
|
5259
5301
|
if (selectedKey !== void 0) {
|
|
5260
5302
|
collectAncestors(items, selectedKey, initial);
|
|
@@ -5334,8 +5376,8 @@ function MenuEntry({
|
|
|
5334
5376
|
const isDirectory = collapsible && hasChildren;
|
|
5335
5377
|
const expanded = isDirectory && expandedKeys?.has(item.key) === true;
|
|
5336
5378
|
const railDirectory = collapsed && hasChildren;
|
|
5337
|
-
const [flyoutOpen, setFlyoutOpen] = (0,
|
|
5338
|
-
const flyoutTimer = (0,
|
|
5379
|
+
const [flyoutOpen, setFlyoutOpen] = (0, import_react20.useState)(false);
|
|
5380
|
+
const flyoutTimer = (0, import_react20.useRef)(void 0);
|
|
5339
5381
|
const flyoutOpenNow = () => {
|
|
5340
5382
|
window.clearTimeout(flyoutTimer.current);
|
|
5341
5383
|
setFlyoutOpen(true);
|
|
@@ -5344,7 +5386,7 @@ function MenuEntry({
|
|
|
5344
5386
|
window.clearTimeout(flyoutTimer.current);
|
|
5345
5387
|
flyoutTimer.current = window.setTimeout(() => setFlyoutOpen(false), 200);
|
|
5346
5388
|
};
|
|
5347
|
-
(0,
|
|
5389
|
+
(0, import_react20.useEffect)(() => () => window.clearTimeout(flyoutTimer.current), []);
|
|
5348
5390
|
const button = /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
5349
5391
|
"button",
|
|
5350
5392
|
{
|
|
@@ -5743,7 +5785,7 @@ function Page({ title, className, style, children }) {
|
|
|
5743
5785
|
}
|
|
5744
5786
|
|
|
5745
5787
|
// src/components/components/Pagination/index.tsx
|
|
5746
|
-
var
|
|
5788
|
+
var import_react21 = require("react");
|
|
5747
5789
|
|
|
5748
5790
|
// src/ui/pagination.tsx
|
|
5749
5791
|
var import_lucide_react21 = require("lucide-react");
|
|
@@ -5871,7 +5913,7 @@ function Pagination2({
|
|
|
5871
5913
|
className,
|
|
5872
5914
|
style
|
|
5873
5915
|
}) {
|
|
5874
|
-
const [innerPage, setInnerPage] = (0,
|
|
5916
|
+
const [innerPage, setInnerPage] = (0, import_react21.useState)(1);
|
|
5875
5917
|
const pageCount = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
5876
5918
|
const current = Math.min(Math.max(1, page ?? innerPage), pageCount);
|
|
5877
5919
|
const goTo = (next) => {
|
|
@@ -5991,7 +6033,7 @@ function Progress2({ value, className, style }) {
|
|
|
5991
6033
|
}
|
|
5992
6034
|
|
|
5993
6035
|
// src/components/components/RadioGroup/index.tsx
|
|
5994
|
-
var
|
|
6036
|
+
var import_react22 = require("react");
|
|
5995
6037
|
|
|
5996
6038
|
// src/ui/radio-group.tsx
|
|
5997
6039
|
var import_radio = require("@base-ui/react/radio");
|
|
@@ -6077,9 +6119,9 @@ function RadioGroup2({
|
|
|
6077
6119
|
style
|
|
6078
6120
|
}) {
|
|
6079
6121
|
const form = useFormContext();
|
|
6080
|
-
const controlId = (0,
|
|
6122
|
+
const controlId = (0, import_react22.useId)();
|
|
6081
6123
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6082
|
-
(0,
|
|
6124
|
+
(0, import_react22.useEffect)(() => {
|
|
6083
6125
|
if (inForm && form && name) {
|
|
6084
6126
|
form.registerField(name, rules, value);
|
|
6085
6127
|
return () => form.unregisterField(name);
|
|
@@ -6151,7 +6193,7 @@ function RadioGroup2({
|
|
|
6151
6193
|
|
|
6152
6194
|
// src/components/components/Resizable/index.tsx
|
|
6153
6195
|
var import_runtime18 = require("@pactor-app/runtime");
|
|
6154
|
-
var
|
|
6196
|
+
var import_react23 = require("react");
|
|
6155
6197
|
|
|
6156
6198
|
// src/ui/resizable.tsx
|
|
6157
6199
|
var import_lucide_react22 = require("lucide-react");
|
|
@@ -6204,7 +6246,7 @@ function Resizable({
|
|
|
6204
6246
|
style
|
|
6205
6247
|
}) {
|
|
6206
6248
|
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)(
|
|
6249
|
+
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
6250
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ResizableHandle, { withHandle: true }) : null,
|
|
6209
6251
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
6210
6252
|
Panel,
|
|
@@ -6296,7 +6338,7 @@ function ScrollArea2({
|
|
|
6296
6338
|
|
|
6297
6339
|
// src/components/components/Select/index.tsx
|
|
6298
6340
|
var import_runtime19 = require("@pactor-app/runtime");
|
|
6299
|
-
var
|
|
6341
|
+
var import_react24 = require("react");
|
|
6300
6342
|
|
|
6301
6343
|
// src/ui/select.tsx
|
|
6302
6344
|
var import_select = require("@base-ui/react/select");
|
|
@@ -6446,9 +6488,9 @@ function Select2({
|
|
|
6446
6488
|
}) {
|
|
6447
6489
|
const form = useFormContext();
|
|
6448
6490
|
const { t } = (0, import_runtime19.useI18n)();
|
|
6449
|
-
const controlId = (0,
|
|
6491
|
+
const controlId = (0, import_react24.useId)();
|
|
6450
6492
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6451
|
-
(0,
|
|
6493
|
+
(0, import_react24.useEffect)(() => {
|
|
6452
6494
|
if (inForm && form && name) {
|
|
6453
6495
|
form.registerField(name, rules, value);
|
|
6454
6496
|
return () => form.unregisterField(name);
|
|
@@ -6643,7 +6685,7 @@ function Skeleton2({ shape = "line", width, height, className, style }) {
|
|
|
6643
6685
|
}
|
|
6644
6686
|
|
|
6645
6687
|
// src/components/components/Slider/index.tsx
|
|
6646
|
-
var
|
|
6688
|
+
var import_react25 = require("react");
|
|
6647
6689
|
|
|
6648
6690
|
// src/ui/slider.tsx
|
|
6649
6691
|
var import_slider = require("@base-ui/react/slider");
|
|
@@ -6725,7 +6767,7 @@ function Slider2({
|
|
|
6725
6767
|
}) {
|
|
6726
6768
|
const form = useFormContext();
|
|
6727
6769
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6728
|
-
(0,
|
|
6770
|
+
(0, import_react25.useEffect)(() => {
|
|
6729
6771
|
if (inForm && form && name) {
|
|
6730
6772
|
form.registerField(name, rules, value);
|
|
6731
6773
|
return () => form.unregisterField(name);
|
|
@@ -6776,7 +6818,7 @@ function Slider2({
|
|
|
6776
6818
|
|
|
6777
6819
|
// src/components/components/Sonner/index.tsx
|
|
6778
6820
|
var import_runtime20 = require("@pactor-app/runtime");
|
|
6779
|
-
var
|
|
6821
|
+
var import_react26 = require("react");
|
|
6780
6822
|
|
|
6781
6823
|
// src/ui/toast.tsx
|
|
6782
6824
|
var import_toast = require("@base-ui/react/toast");
|
|
@@ -6856,7 +6898,7 @@ function Toaster({ className }) {
|
|
|
6856
6898
|
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
6857
6899
|
function Sonner({ className, style }) {
|
|
6858
6900
|
const { context } = (0, import_runtime20.useRenderer)();
|
|
6859
|
-
(0,
|
|
6901
|
+
(0, import_react26.useEffect)(() => {
|
|
6860
6902
|
const { actions } = context;
|
|
6861
6903
|
if (actions.has("toast")) {
|
|
6862
6904
|
return;
|
|
@@ -6914,7 +6956,7 @@ function Statistic({ title, value, precision, suffix, className, style }) {
|
|
|
6914
6956
|
}
|
|
6915
6957
|
|
|
6916
6958
|
// src/components/components/Switch/index.tsx
|
|
6917
|
-
var
|
|
6959
|
+
var import_react27 = require("react");
|
|
6918
6960
|
|
|
6919
6961
|
// src/ui/switch.tsx
|
|
6920
6962
|
var import_switch = require("@base-ui/react/switch");
|
|
@@ -6953,9 +6995,9 @@ function Switch2({
|
|
|
6953
6995
|
style
|
|
6954
6996
|
}) {
|
|
6955
6997
|
const form = useFormContext();
|
|
6956
|
-
const controlId = (0,
|
|
6998
|
+
const controlId = (0, import_react27.useId)();
|
|
6957
6999
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6958
|
-
(0,
|
|
7000
|
+
(0, import_react27.useEffect)(() => {
|
|
6959
7001
|
if (inForm && form && name) {
|
|
6960
7002
|
form.registerField(name, rules, value);
|
|
6961
7003
|
return () => form.unregisterField(name);
|
|
@@ -7009,7 +7051,7 @@ function Switch2({
|
|
|
7009
7051
|
|
|
7010
7052
|
// src/components/components/Table/index.tsx
|
|
7011
7053
|
var import_runtime21 = require("@pactor-app/runtime");
|
|
7012
|
-
var
|
|
7054
|
+
var import_react28 = require("react");
|
|
7013
7055
|
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
7014
7056
|
function renderCellValue2(value) {
|
|
7015
7057
|
if (value === void 0 || value === null) {
|
|
@@ -7032,7 +7074,7 @@ function Table3({
|
|
|
7032
7074
|
}) {
|
|
7033
7075
|
const { renderChildren } = (0, import_runtime21.useRenderer)();
|
|
7034
7076
|
const { t } = (0, import_runtime21.useI18n)();
|
|
7035
|
-
const [current, setCurrent] = (0,
|
|
7077
|
+
const [current, setCurrent] = (0, import_react28.useState)(1);
|
|
7036
7078
|
const pageSize = pagination === false ? void 0 : pagination?.pageSize;
|
|
7037
7079
|
const total = dataSource.length;
|
|
7038
7080
|
const pageCount = pageSize !== void 0 && pageSize > 0 ? Math.max(1, Math.ceil(total / pageSize)) : 1;
|
|
@@ -7267,7 +7309,7 @@ function Text({
|
|
|
7267
7309
|
}
|
|
7268
7310
|
|
|
7269
7311
|
// src/components/components/Textarea/index.tsx
|
|
7270
|
-
var
|
|
7312
|
+
var import_react29 = require("react");
|
|
7271
7313
|
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
7272
7314
|
function Textarea2({
|
|
7273
7315
|
name,
|
|
@@ -7282,9 +7324,9 @@ function Textarea2({
|
|
|
7282
7324
|
style
|
|
7283
7325
|
}) {
|
|
7284
7326
|
const form = useFormContext();
|
|
7285
|
-
const controlId = (0,
|
|
7327
|
+
const controlId = (0, import_react29.useId)();
|
|
7286
7328
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
7287
|
-
(0,
|
|
7329
|
+
(0, import_react29.useEffect)(() => {
|
|
7288
7330
|
if (inForm && form && name) {
|
|
7289
7331
|
form.registerField(name, rules, value);
|
|
7290
7332
|
return () => form.unregisterField(name);
|