@pactor-app/ui 1.13.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-CFUWF54N.js → chunk-E3BFTXSJ.js} +84 -16
- 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 +122 -49
- package/dist/components/index.d.cts +30 -10
- package/dist/components/index.d.ts +30 -10
- package/dist/components/index.js +4 -4
- package/dist/index.cjs +156 -83
- 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
package/dist/index.cjs
CHANGED
|
@@ -3567,18 +3567,49 @@ function FieldError({ className, ...props }) {
|
|
|
3567
3567
|
|
|
3568
3568
|
// src/components/components/Field/index.tsx
|
|
3569
3569
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3570
|
-
function Field2({
|
|
3570
|
+
function Field2({
|
|
3571
|
+
label,
|
|
3572
|
+
required,
|
|
3573
|
+
description,
|
|
3574
|
+
error,
|
|
3575
|
+
children,
|
|
3576
|
+
className,
|
|
3577
|
+
style,
|
|
3578
|
+
labelClassName,
|
|
3579
|
+
labelStyle,
|
|
3580
|
+
controlClassName,
|
|
3581
|
+
controlStyle,
|
|
3582
|
+
descriptionClassName,
|
|
3583
|
+
descriptionStyle,
|
|
3584
|
+
errorClassName,
|
|
3585
|
+
errorStyle
|
|
3586
|
+
}) {
|
|
3571
3587
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Field, { className, style, children: [
|
|
3572
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(FieldLabel, { children: [
|
|
3588
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(FieldLabel, { className: labelClassName, style: labelStyle, children: [
|
|
3573
3589
|
required ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { "aria-hidden": true, className: "text-destructive", children: [
|
|
3574
3590
|
"*",
|
|
3575
3591
|
" "
|
|
3576
3592
|
] }) : null,
|
|
3577
3593
|
label
|
|
3578
3594
|
] }) : null,
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3595
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3596
|
+
"div",
|
|
3597
|
+
{
|
|
3598
|
+
"data-slot": "field-control",
|
|
3599
|
+
className: cn(label ? "mt-2" : void 0, controlClassName),
|
|
3600
|
+
style: controlStyle,
|
|
3601
|
+
children
|
|
3602
|
+
}
|
|
3603
|
+
),
|
|
3604
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3605
|
+
FieldDescription,
|
|
3606
|
+
{
|
|
3607
|
+
className: descriptionClassName,
|
|
3608
|
+
style: descriptionStyle,
|
|
3609
|
+
children: description
|
|
3610
|
+
}
|
|
3611
|
+
) : null,
|
|
3612
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FieldError, { match: true, className: errorClassName, style: errorStyle, children: error }) : null
|
|
3582
3613
|
] });
|
|
3583
3614
|
}
|
|
3584
3615
|
|
|
@@ -3769,6 +3800,7 @@ function Grid({ columns = 1, gap, className, style, children }) {
|
|
|
3769
3800
|
// src/components/components/Header/index.tsx
|
|
3770
3801
|
var import_runtime11 = require("@pactor-app/runtime");
|
|
3771
3802
|
var import_lucide_react16 = require("lucide-react");
|
|
3803
|
+
var import_react15 = require("react");
|
|
3772
3804
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3773
3805
|
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";
|
|
3774
3806
|
function Header({
|
|
@@ -3779,6 +3811,8 @@ function Header({
|
|
|
3779
3811
|
menu,
|
|
3780
3812
|
user,
|
|
3781
3813
|
locales,
|
|
3814
|
+
themeToggle = false,
|
|
3815
|
+
onThemeChange,
|
|
3782
3816
|
onMenuSelect,
|
|
3783
3817
|
onDropdownSelect,
|
|
3784
3818
|
onUserSelect,
|
|
@@ -3799,7 +3833,7 @@ function Header({
|
|
|
3799
3833
|
"flex h-14 shrink-0 items-center gap-4 border-b bg-card px-4",
|
|
3800
3834
|
className
|
|
3801
3835
|
);
|
|
3802
|
-
if (!hasBrand && !dropdown && !hasMenu && !hasUser && !hasLocales) {
|
|
3836
|
+
if (!hasBrand && !dropdown && !hasMenu && !hasUser && !hasLocales && !themeToggle) {
|
|
3803
3837
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("header", { "data-slot": "layout-header", className: rootClass, style, children });
|
|
3804
3838
|
}
|
|
3805
3839
|
const brandNode = hasBrand && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { "data-slot": "header-brand", className: "flex items-center gap-2", children: [
|
|
@@ -3816,7 +3850,7 @@ function Header({
|
|
|
3816
3850
|
] });
|
|
3817
3851
|
const dropdownNode = dropdown !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(HeaderDropdownArea, { dropdown, onSelect: onDropdownSelect });
|
|
3818
3852
|
const showLeft = brandLeft || dropdownLeft || hasMenu;
|
|
3819
|
-
const showRight = dropdownRight || brandRight || hasLocales || hasUser;
|
|
3853
|
+
const showRight = dropdownRight || brandRight || hasLocales || hasUser || themeToggle;
|
|
3820
3854
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("header", { "data-slot": "layout-header", className: rootClass, style, children: [
|
|
3821
3855
|
showLeft && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { "data-slot": "header-left", className: "flex items-center gap-4", children: [
|
|
3822
3856
|
brandLeft && brandNode,
|
|
@@ -3827,6 +3861,7 @@ function Header({
|
|
|
3827
3861
|
showRight && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { "data-slot": "header-right", className: "flex items-center gap-4", children: [
|
|
3828
3862
|
dropdownRight && dropdownNode,
|
|
3829
3863
|
brandRight && brandNode,
|
|
3864
|
+
themeToggle && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(HeaderThemeToggle, { onSelect: onThemeChange }),
|
|
3830
3865
|
hasLocales && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(HeaderLocalesArea, { locales, onSelect: onLocaleChange }),
|
|
3831
3866
|
hasUser && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(HeaderUserArea, { user, onSelect: onUserSelect })
|
|
3832
3867
|
] })
|
|
@@ -3974,6 +4009,39 @@ function HeaderLocalesArea({
|
|
|
3974
4009
|
)) })
|
|
3975
4010
|
] });
|
|
3976
4011
|
}
|
|
4012
|
+
function readCurrentTheme() {
|
|
4013
|
+
if (typeof document === "undefined") {
|
|
4014
|
+
return "light";
|
|
4015
|
+
}
|
|
4016
|
+
return document.documentElement.getAttribute("data-pactor-theme") === "dark" ? "dark" : "light";
|
|
4017
|
+
}
|
|
4018
|
+
function HeaderThemeToggle({
|
|
4019
|
+
onSelect
|
|
4020
|
+
}) {
|
|
4021
|
+
const [theme, setTheme] = (0, import_react15.useState)(readCurrentTheme);
|
|
4022
|
+
const handleToggle = () => {
|
|
4023
|
+
const next = readCurrentTheme() === "dark" ? "light" : "dark";
|
|
4024
|
+
if (next === "dark") {
|
|
4025
|
+
document.documentElement.setAttribute("data-pactor-theme", "dark");
|
|
4026
|
+
} else {
|
|
4027
|
+
document.documentElement.removeAttribute("data-pactor-theme");
|
|
4028
|
+
}
|
|
4029
|
+
setTheme(next);
|
|
4030
|
+
onSelect?.(next);
|
|
4031
|
+
};
|
|
4032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
4033
|
+
"button",
|
|
4034
|
+
{
|
|
4035
|
+
type: "button",
|
|
4036
|
+
"data-slot": "header-theme-toggle",
|
|
4037
|
+
className: "flex size-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",
|
|
4038
|
+
title: theme === "dark" ? "\u5207\u6362\u4E3A\u6D45\u8272" : "\u5207\u6362\u4E3A\u6DF1\u8272",
|
|
4039
|
+
"aria-label": "\u5207\u6362\u660E\u6697\u4E3B\u9898",
|
|
4040
|
+
onClick: handleToggle,
|
|
4041
|
+
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" })
|
|
4042
|
+
}
|
|
4043
|
+
);
|
|
4044
|
+
}
|
|
3977
4045
|
|
|
3978
4046
|
// src/components/components/HoverCard/index.tsx
|
|
3979
4047
|
var import_runtime12 = require("@pactor-app/runtime");
|
|
@@ -4035,7 +4103,7 @@ function HoverCard2({ content, children, className, style }) {
|
|
|
4035
4103
|
|
|
4036
4104
|
// src/components/components/Input/index.tsx
|
|
4037
4105
|
var import_runtime13 = require("@pactor-app/runtime");
|
|
4038
|
-
var
|
|
4106
|
+
var import_react16 = require("react");
|
|
4039
4107
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4040
4108
|
function Input2({
|
|
4041
4109
|
name,
|
|
@@ -4053,9 +4121,9 @@ function Input2({
|
|
|
4053
4121
|
}) {
|
|
4054
4122
|
const form = useFormContext();
|
|
4055
4123
|
const { t } = (0, import_runtime13.useI18n)();
|
|
4056
|
-
const controlId = (0,
|
|
4124
|
+
const controlId = (0, import_react16.useId)();
|
|
4057
4125
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
4058
|
-
(0,
|
|
4126
|
+
(0, import_react16.useEffect)(() => {
|
|
4059
4127
|
if (inForm && form && name) {
|
|
4060
4128
|
form.registerField(name, rules, value);
|
|
4061
4129
|
return () => form.unregisterField(name);
|
|
@@ -4172,7 +4240,7 @@ function InputGroup2({ className, style, children }) {
|
|
|
4172
4240
|
}
|
|
4173
4241
|
|
|
4174
4242
|
// src/components/components/InputOTP/index.tsx
|
|
4175
|
-
var
|
|
4243
|
+
var import_react17 = require("react");
|
|
4176
4244
|
|
|
4177
4245
|
// src/ui/input-otp.tsx
|
|
4178
4246
|
var import_input_otp = require("input-otp");
|
|
@@ -4248,15 +4316,15 @@ function InputOTP2({
|
|
|
4248
4316
|
}) {
|
|
4249
4317
|
const form = useFormContext();
|
|
4250
4318
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
4251
|
-
(0,
|
|
4319
|
+
(0, import_react17.useEffect)(() => {
|
|
4252
4320
|
if (inForm && form && name) {
|
|
4253
4321
|
form.registerField(name, rules, value);
|
|
4254
4322
|
return () => form.unregisterField(name);
|
|
4255
4323
|
}
|
|
4256
4324
|
return void 0;
|
|
4257
4325
|
});
|
|
4258
|
-
const [innerValue, setInnerValue] = (0,
|
|
4259
|
-
(0,
|
|
4326
|
+
const [innerValue, setInnerValue] = (0, import_react17.useState)(typeof value === "string" ? value : "");
|
|
4327
|
+
(0, import_react17.useEffect)(() => {
|
|
4260
4328
|
if (!inForm) setInnerValue(typeof value === "string" ? value : "");
|
|
4261
4329
|
}, [inForm, value]);
|
|
4262
4330
|
const current = inForm && form && name ? typeof form.values[name] === "string" ? form.values[name] : "" : innerValue;
|
|
@@ -4494,7 +4562,7 @@ function Link2({ href, text, target, className, style, children }) {
|
|
|
4494
4562
|
}
|
|
4495
4563
|
|
|
4496
4564
|
// src/components/components/Menu/index.tsx
|
|
4497
|
-
var
|
|
4565
|
+
var import_react20 = require("react");
|
|
4498
4566
|
|
|
4499
4567
|
// src/components/components/Sidebar/rail-tooltip.tsx
|
|
4500
4568
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
@@ -4510,7 +4578,7 @@ function RailTooltip({
|
|
|
4510
4578
|
|
|
4511
4579
|
// src/components/components/Sidebar/index.tsx
|
|
4512
4580
|
var import_runtime16 = require("@pactor-app/runtime");
|
|
4513
|
-
var
|
|
4581
|
+
var import_react19 = require("react");
|
|
4514
4582
|
|
|
4515
4583
|
// src/ui/sidebar.tsx
|
|
4516
4584
|
var React5 = __toESM(require("react"), 1);
|
|
@@ -4518,13 +4586,13 @@ var import_class_variance_authority5 = require("class-variance-authority");
|
|
|
4518
4586
|
var import_lucide_react19 = require("lucide-react");
|
|
4519
4587
|
|
|
4520
4588
|
// src/hooks/use-mobile.ts
|
|
4521
|
-
var
|
|
4589
|
+
var import_react18 = require("react");
|
|
4522
4590
|
var MOBILE_MEDIA_QUERY = "(max-width: 767px)";
|
|
4523
4591
|
function useIsMobile() {
|
|
4524
|
-
const [isMobile, setIsMobile] = (0,
|
|
4592
|
+
const [isMobile, setIsMobile] = (0, import_react18.useState)(
|
|
4525
4593
|
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(MOBILE_MEDIA_QUERY).matches
|
|
4526
4594
|
);
|
|
4527
|
-
(0,
|
|
4595
|
+
(0, import_react18.useEffect)(() => {
|
|
4528
4596
|
if (typeof window.matchMedia !== "function") {
|
|
4529
4597
|
return;
|
|
4530
4598
|
}
|
|
@@ -4856,7 +4924,12 @@ function SidebarRoot({
|
|
|
4856
4924
|
className: cn(
|
|
4857
4925
|
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
4858
4926
|
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)]",
|
|
4859
|
-
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" :
|
|
4927
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : (
|
|
4928
|
+
// 边框色显式声明:不能只给宽度——宿主引入 Tailwind 时其
|
|
4929
|
+
// preflight(同为 base 层且后加载)会把默认 border-color
|
|
4930
|
+
// 重置为 currentColor,宽度型边框会脱离皮肤令牌
|
|
4931
|
+
"border-sidebar-border group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l"
|
|
4932
|
+
),
|
|
4860
4933
|
className
|
|
4861
4934
|
),
|
|
4862
4935
|
...props,
|
|
@@ -5157,14 +5230,14 @@ function SidebarInner({
|
|
|
5157
5230
|
const isMobile = useIsMobile();
|
|
5158
5231
|
const { state, setOpenMobile, toggleSidebar } = useSidebar();
|
|
5159
5232
|
const collapsed = state === "collapsed";
|
|
5160
|
-
const prevCollapsed = (0,
|
|
5161
|
-
(0,
|
|
5233
|
+
const prevCollapsed = (0, import_react19.useRef)(collapsed);
|
|
5234
|
+
(0, import_react19.useEffect)(() => {
|
|
5162
5235
|
if (prevCollapsed.current !== collapsed) {
|
|
5163
5236
|
prevCollapsed.current = collapsed;
|
|
5164
5237
|
onCollapse?.(collapsed);
|
|
5165
5238
|
}
|
|
5166
5239
|
}, [collapsed, onCollapse]);
|
|
5167
|
-
(0,
|
|
5240
|
+
(0, import_react19.useEffect)(() => {
|
|
5168
5241
|
if (locationKey !== void 0) {
|
|
5169
5242
|
setOpenMobile(false);
|
|
5170
5243
|
}
|
|
@@ -5262,7 +5335,7 @@ function Menu2({
|
|
|
5262
5335
|
const drawer = useSidebarDrawer();
|
|
5263
5336
|
const collapsed = mode === "inline" && drawer?.collapsed === true;
|
|
5264
5337
|
const collapsibleOn = collapsible && mode === "inline" && !collapsed;
|
|
5265
|
-
const [expandedKeys, setExpandedKeys] = (0,
|
|
5338
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react20.useState)(() => {
|
|
5266
5339
|
const initial = new Set(defaultExpandedKeys ?? []);
|
|
5267
5340
|
if (selectedKey !== void 0) {
|
|
5268
5341
|
collectAncestors(items, selectedKey, initial);
|
|
@@ -5342,8 +5415,8 @@ function MenuEntry({
|
|
|
5342
5415
|
const isDirectory = collapsible && hasChildren;
|
|
5343
5416
|
const expanded = isDirectory && expandedKeys?.has(item.key) === true;
|
|
5344
5417
|
const railDirectory = collapsed && hasChildren;
|
|
5345
|
-
const [flyoutOpen, setFlyoutOpen] = (0,
|
|
5346
|
-
const flyoutTimer = (0,
|
|
5418
|
+
const [flyoutOpen, setFlyoutOpen] = (0, import_react20.useState)(false);
|
|
5419
|
+
const flyoutTimer = (0, import_react20.useRef)(void 0);
|
|
5347
5420
|
const flyoutOpenNow = () => {
|
|
5348
5421
|
window.clearTimeout(flyoutTimer.current);
|
|
5349
5422
|
setFlyoutOpen(true);
|
|
@@ -5352,7 +5425,7 @@ function MenuEntry({
|
|
|
5352
5425
|
window.clearTimeout(flyoutTimer.current);
|
|
5353
5426
|
flyoutTimer.current = window.setTimeout(() => setFlyoutOpen(false), 200);
|
|
5354
5427
|
};
|
|
5355
|
-
(0,
|
|
5428
|
+
(0, import_react20.useEffect)(() => () => window.clearTimeout(flyoutTimer.current), []);
|
|
5356
5429
|
const button = /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
5357
5430
|
"button",
|
|
5358
5431
|
{
|
|
@@ -5751,7 +5824,7 @@ function Page({ title, className, style, children }) {
|
|
|
5751
5824
|
}
|
|
5752
5825
|
|
|
5753
5826
|
// src/components/components/Pagination/index.tsx
|
|
5754
|
-
var
|
|
5827
|
+
var import_react21 = require("react");
|
|
5755
5828
|
|
|
5756
5829
|
// src/ui/pagination.tsx
|
|
5757
5830
|
var import_lucide_react21 = require("lucide-react");
|
|
@@ -5879,7 +5952,7 @@ function Pagination2({
|
|
|
5879
5952
|
className,
|
|
5880
5953
|
style
|
|
5881
5954
|
}) {
|
|
5882
|
-
const [innerPage, setInnerPage] = (0,
|
|
5955
|
+
const [innerPage, setInnerPage] = (0, import_react21.useState)(1);
|
|
5883
5956
|
const pageCount = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
5884
5957
|
const current = Math.min(Math.max(1, page ?? innerPage), pageCount);
|
|
5885
5958
|
const goTo = (next) => {
|
|
@@ -5999,7 +6072,7 @@ function Progress2({ value, className, style }) {
|
|
|
5999
6072
|
}
|
|
6000
6073
|
|
|
6001
6074
|
// src/components/components/RadioGroup/index.tsx
|
|
6002
|
-
var
|
|
6075
|
+
var import_react22 = require("react");
|
|
6003
6076
|
|
|
6004
6077
|
// src/ui/radio-group.tsx
|
|
6005
6078
|
var import_radio = require("@base-ui/react/radio");
|
|
@@ -6085,9 +6158,9 @@ function RadioGroup2({
|
|
|
6085
6158
|
style
|
|
6086
6159
|
}) {
|
|
6087
6160
|
const form = useFormContext();
|
|
6088
|
-
const controlId = (0,
|
|
6161
|
+
const controlId = (0, import_react22.useId)();
|
|
6089
6162
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6090
|
-
(0,
|
|
6163
|
+
(0, import_react22.useEffect)(() => {
|
|
6091
6164
|
if (inForm && form && name) {
|
|
6092
6165
|
form.registerField(name, rules, value);
|
|
6093
6166
|
return () => form.unregisterField(name);
|
|
@@ -6159,7 +6232,7 @@ function RadioGroup2({
|
|
|
6159
6232
|
|
|
6160
6233
|
// src/components/components/Resizable/index.tsx
|
|
6161
6234
|
var import_runtime18 = require("@pactor-app/runtime");
|
|
6162
|
-
var
|
|
6235
|
+
var import_react23 = require("react");
|
|
6163
6236
|
|
|
6164
6237
|
// src/ui/resizable.tsx
|
|
6165
6238
|
var import_lucide_react22 = require("lucide-react");
|
|
@@ -6212,7 +6285,7 @@ function Resizable({
|
|
|
6212
6285
|
style
|
|
6213
6286
|
}) {
|
|
6214
6287
|
const { renderChildren } = (0, import_runtime18.useRenderer)();
|
|
6215
|
-
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(PanelGroup, { orientation: direction, className, style, children: panels.map((panel, index) => /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
6288
|
+
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: [
|
|
6216
6289
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ResizableHandle, { withHandle: true }) : null,
|
|
6217
6290
|
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
6218
6291
|
Panel,
|
|
@@ -6304,7 +6377,7 @@ function ScrollArea2({
|
|
|
6304
6377
|
|
|
6305
6378
|
// src/components/components/Select/index.tsx
|
|
6306
6379
|
var import_runtime19 = require("@pactor-app/runtime");
|
|
6307
|
-
var
|
|
6380
|
+
var import_react24 = require("react");
|
|
6308
6381
|
|
|
6309
6382
|
// src/ui/select.tsx
|
|
6310
6383
|
var import_select = require("@base-ui/react/select");
|
|
@@ -6454,9 +6527,9 @@ function Select2({
|
|
|
6454
6527
|
}) {
|
|
6455
6528
|
const form = useFormContext();
|
|
6456
6529
|
const { t } = (0, import_runtime19.useI18n)();
|
|
6457
|
-
const controlId = (0,
|
|
6530
|
+
const controlId = (0, import_react24.useId)();
|
|
6458
6531
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6459
|
-
(0,
|
|
6532
|
+
(0, import_react24.useEffect)(() => {
|
|
6460
6533
|
if (inForm && form && name) {
|
|
6461
6534
|
form.registerField(name, rules, value);
|
|
6462
6535
|
return () => form.unregisterField(name);
|
|
@@ -6651,7 +6724,7 @@ function Skeleton2({ shape = "line", width, height, className, style }) {
|
|
|
6651
6724
|
}
|
|
6652
6725
|
|
|
6653
6726
|
// src/components/components/Slider/index.tsx
|
|
6654
|
-
var
|
|
6727
|
+
var import_react25 = require("react");
|
|
6655
6728
|
|
|
6656
6729
|
// src/ui/slider.tsx
|
|
6657
6730
|
var import_slider = require("@base-ui/react/slider");
|
|
@@ -6733,7 +6806,7 @@ function Slider2({
|
|
|
6733
6806
|
}) {
|
|
6734
6807
|
const form = useFormContext();
|
|
6735
6808
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6736
|
-
(0,
|
|
6809
|
+
(0, import_react25.useEffect)(() => {
|
|
6737
6810
|
if (inForm && form && name) {
|
|
6738
6811
|
form.registerField(name, rules, value);
|
|
6739
6812
|
return () => form.unregisterField(name);
|
|
@@ -6784,7 +6857,7 @@ function Slider2({
|
|
|
6784
6857
|
|
|
6785
6858
|
// src/components/components/Sonner/index.tsx
|
|
6786
6859
|
var import_runtime20 = require("@pactor-app/runtime");
|
|
6787
|
-
var
|
|
6860
|
+
var import_react26 = require("react");
|
|
6788
6861
|
|
|
6789
6862
|
// src/ui/toast.tsx
|
|
6790
6863
|
var import_toast = require("@base-ui/react/toast");
|
|
@@ -6864,7 +6937,7 @@ function Toaster({ className }) {
|
|
|
6864
6937
|
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
6865
6938
|
function Sonner({ className, style }) {
|
|
6866
6939
|
const { context } = (0, import_runtime20.useRenderer)();
|
|
6867
|
-
(0,
|
|
6940
|
+
(0, import_react26.useEffect)(() => {
|
|
6868
6941
|
const { actions } = context;
|
|
6869
6942
|
if (actions.has("toast")) {
|
|
6870
6943
|
return;
|
|
@@ -6922,7 +6995,7 @@ function Statistic({ title, value, precision, suffix, className, style }) {
|
|
|
6922
6995
|
}
|
|
6923
6996
|
|
|
6924
6997
|
// src/components/components/Switch/index.tsx
|
|
6925
|
-
var
|
|
6998
|
+
var import_react27 = require("react");
|
|
6926
6999
|
|
|
6927
7000
|
// src/ui/switch.tsx
|
|
6928
7001
|
var import_switch = require("@base-ui/react/switch");
|
|
@@ -6961,9 +7034,9 @@ function Switch2({
|
|
|
6961
7034
|
style
|
|
6962
7035
|
}) {
|
|
6963
7036
|
const form = useFormContext();
|
|
6964
|
-
const controlId = (0,
|
|
7037
|
+
const controlId = (0, import_react27.useId)();
|
|
6965
7038
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
6966
|
-
(0,
|
|
7039
|
+
(0, import_react27.useEffect)(() => {
|
|
6967
7040
|
if (inForm && form && name) {
|
|
6968
7041
|
form.registerField(name, rules, value);
|
|
6969
7042
|
return () => form.unregisterField(name);
|
|
@@ -7017,7 +7090,7 @@ function Switch2({
|
|
|
7017
7090
|
|
|
7018
7091
|
// src/components/components/Table/index.tsx
|
|
7019
7092
|
var import_runtime21 = require("@pactor-app/runtime");
|
|
7020
|
-
var
|
|
7093
|
+
var import_react28 = require("react");
|
|
7021
7094
|
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
7022
7095
|
function renderCellValue2(value) {
|
|
7023
7096
|
if (value === void 0 || value === null) {
|
|
@@ -7040,7 +7113,7 @@ function Table3({
|
|
|
7040
7113
|
}) {
|
|
7041
7114
|
const { renderChildren } = (0, import_runtime21.useRenderer)();
|
|
7042
7115
|
const { t } = (0, import_runtime21.useI18n)();
|
|
7043
|
-
const [current, setCurrent] = (0,
|
|
7116
|
+
const [current, setCurrent] = (0, import_react28.useState)(1);
|
|
7044
7117
|
const pageSize = pagination === false ? void 0 : pagination?.pageSize;
|
|
7045
7118
|
const total = dataSource.length;
|
|
7046
7119
|
const pageCount = pageSize !== void 0 && pageSize > 0 ? Math.max(1, Math.ceil(total / pageSize)) : 1;
|
|
@@ -7275,7 +7348,7 @@ function Text({
|
|
|
7275
7348
|
}
|
|
7276
7349
|
|
|
7277
7350
|
// src/components/components/Textarea/index.tsx
|
|
7278
|
-
var
|
|
7351
|
+
var import_react29 = require("react");
|
|
7279
7352
|
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
7280
7353
|
function Textarea2({
|
|
7281
7354
|
name,
|
|
@@ -7290,9 +7363,9 @@ function Textarea2({
|
|
|
7290
7363
|
style
|
|
7291
7364
|
}) {
|
|
7292
7365
|
const form = useFormContext();
|
|
7293
|
-
const controlId = (0,
|
|
7366
|
+
const controlId = (0, import_react29.useId)();
|
|
7294
7367
|
const inForm = form?.inForm === true && typeof name === "string" && name !== "";
|
|
7295
|
-
(0,
|
|
7368
|
+
(0, import_react29.useEffect)(() => {
|
|
7296
7369
|
if (inForm && form && name) {
|
|
7297
7370
|
form.registerField(name, rules, value);
|
|
7298
7371
|
return () => form.unregisterField(name);
|
|
@@ -7720,10 +7793,10 @@ function collectDefaultOpenKeys(registry, activeMenuId) {
|
|
|
7720
7793
|
var import_permission = require("@pactor-app/permission");
|
|
7721
7794
|
var import_router = require("@pactor-app/router");
|
|
7722
7795
|
var import_runtime23 = require("@pactor-app/runtime");
|
|
7723
|
-
var
|
|
7796
|
+
var import_react31 = require("react");
|
|
7724
7797
|
|
|
7725
7798
|
// src/layout/admin/use-media-query.ts
|
|
7726
|
-
var
|
|
7799
|
+
var import_react30 = require("react");
|
|
7727
7800
|
var BREAKPOINT_PX = {
|
|
7728
7801
|
xs: 480,
|
|
7729
7802
|
sm: 576,
|
|
@@ -7733,10 +7806,10 @@ var BREAKPOINT_PX = {
|
|
|
7733
7806
|
xxl: 1600
|
|
7734
7807
|
};
|
|
7735
7808
|
function useMediaQuery(query) {
|
|
7736
|
-
const [matches, setMatches] = (0,
|
|
7809
|
+
const [matches, setMatches] = (0, import_react30.useState)(
|
|
7737
7810
|
() => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query).matches : false
|
|
7738
7811
|
);
|
|
7739
|
-
(0,
|
|
7812
|
+
(0, import_react30.useEffect)(() => {
|
|
7740
7813
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
7741
7814
|
return;
|
|
7742
7815
|
}
|
|
@@ -7779,8 +7852,8 @@ function CollapsedGroupFlyout({
|
|
|
7779
7852
|
activeMenuId,
|
|
7780
7853
|
defaultOpenKeys
|
|
7781
7854
|
}) {
|
|
7782
|
-
const [open, setOpen] = (0,
|
|
7783
|
-
const closeTimer = (0,
|
|
7855
|
+
const [open, setOpen] = (0, import_react31.useState)(false);
|
|
7856
|
+
const closeTimer = (0, import_react31.useRef)(void 0);
|
|
7784
7857
|
const openNow = () => {
|
|
7785
7858
|
window.clearTimeout(closeTimer.current);
|
|
7786
7859
|
setOpen(true);
|
|
@@ -7789,7 +7862,7 @@ function CollapsedGroupFlyout({
|
|
|
7789
7862
|
window.clearTimeout(closeTimer.current);
|
|
7790
7863
|
closeTimer.current = window.setTimeout(() => setOpen(false), 200);
|
|
7791
7864
|
};
|
|
7792
|
-
(0,
|
|
7865
|
+
(0, import_react31.useEffect)(() => () => window.clearTimeout(closeTimer.current), []);
|
|
7793
7866
|
return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
7794
7867
|
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
7795
7868
|
PopoverTrigger,
|
|
@@ -7973,16 +8046,16 @@ function AdminLayout({
|
|
|
7973
8046
|
const showTabs = config.tabs ?? false;
|
|
7974
8047
|
const showBreadcrumb = config.breadcrumb ?? false;
|
|
7975
8048
|
const showFooter = config.footer ?? false;
|
|
7976
|
-
const [collapsed, setCollapsed] = (0,
|
|
8049
|
+
const [collapsed, setCollapsed] = (0, import_react31.useState)(config.collapsed ?? false);
|
|
7977
8050
|
const broken = useBreakpointBelow(config.breakpoint);
|
|
7978
8051
|
const effectiveCollapsed = collapsed || broken;
|
|
7979
|
-
const [bridgeRoute, setBridgeRoute] = (0,
|
|
8052
|
+
const [bridgeRoute, setBridgeRoute] = (0, import_react31.useState)(
|
|
7980
8053
|
() => (0, import_router.resolveRoute)(registry, bridge.getLocation())
|
|
7981
8054
|
);
|
|
7982
|
-
const [tabs, setTabs] = (0,
|
|
7983
|
-
const tabsRef = (0,
|
|
8055
|
+
const [tabs, setTabs] = (0, import_react31.useState)([]);
|
|
8056
|
+
const tabsRef = (0, import_react31.useRef)(tabs);
|
|
7984
8057
|
tabsRef.current = tabs;
|
|
7985
|
-
(0,
|
|
8058
|
+
(0, import_react31.useEffect)(() => {
|
|
7986
8059
|
const handleLocation = (location) => {
|
|
7987
8060
|
const next = (0, import_router.resolveRoute)(registry, location);
|
|
7988
8061
|
setBridgeRoute(next);
|
|
@@ -8003,16 +8076,16 @@ function AdminLayout({
|
|
|
8003
8076
|
}, [registry, bridge]);
|
|
8004
8077
|
const route = routeProp ?? bridgeRoute;
|
|
8005
8078
|
const activeMenuId = route?.activeMenu;
|
|
8006
|
-
const visibleMenus = (0,
|
|
8079
|
+
const visibleMenus = (0, import_react31.useMemo)(
|
|
8007
8080
|
() => buildVisibleMenuTree(registry, permissionChecker),
|
|
8008
8081
|
[registry, permissionChecker]
|
|
8009
8082
|
);
|
|
8010
|
-
const defaultOpenKeysRef = (0,
|
|
8083
|
+
const defaultOpenKeysRef = (0, import_react31.useRef)(null);
|
|
8011
8084
|
if (defaultOpenKeysRef.current === null) {
|
|
8012
8085
|
defaultOpenKeysRef.current = collectDefaultOpenKeys(registry, activeMenuId);
|
|
8013
8086
|
}
|
|
8014
8087
|
const defaultOpenKeys = defaultOpenKeysRef.current;
|
|
8015
|
-
const activeTopId = (0,
|
|
8088
|
+
const activeTopId = (0, import_react31.useMemo)(() => {
|
|
8016
8089
|
if (activeMenuId !== void 0) {
|
|
8017
8090
|
const chain = findMenuChain(registry, activeMenuId);
|
|
8018
8091
|
if (chain.length > 0) {
|
|
@@ -8021,11 +8094,11 @@ function AdminLayout({
|
|
|
8021
8094
|
}
|
|
8022
8095
|
return void 0;
|
|
8023
8096
|
}, [registry, activeMenuId]);
|
|
8024
|
-
const [selectedTopId, setSelectedTopId] = (0,
|
|
8097
|
+
const [selectedTopId, setSelectedTopId] = (0, import_react31.useState)();
|
|
8025
8098
|
const secondaryTopId = selectedTopId ?? activeTopId ?? visibleMenus.find((m) => m.type === "group")?.id ?? visibleMenus[0]?.id;
|
|
8026
8099
|
const secondaryTop = visibleMenus.find((m) => m.id === secondaryTopId);
|
|
8027
8100
|
const hasSecondary = (secondaryTop?.children?.length ?? 0) > 0;
|
|
8028
|
-
const breadcrumbItems = (0,
|
|
8101
|
+
const breadcrumbItems = (0, import_react31.useMemo)(() => {
|
|
8029
8102
|
if (!showBreadcrumb || activeMenuId === void 0) {
|
|
8030
8103
|
return [];
|
|
8031
8104
|
}
|
|
@@ -8278,7 +8351,7 @@ function BlankLayout({ children }) {
|
|
|
8278
8351
|
|
|
8279
8352
|
// src/layout/chat/ChatLayout.tsx
|
|
8280
8353
|
var import_permission2 = require("@pactor-app/permission");
|
|
8281
|
-
var
|
|
8354
|
+
var import_react32 = require("react");
|
|
8282
8355
|
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
8283
8356
|
function ChatLayout({
|
|
8284
8357
|
brand,
|
|
@@ -8294,7 +8367,7 @@ function ChatLayout({
|
|
|
8294
8367
|
sidebarFooter,
|
|
8295
8368
|
children
|
|
8296
8369
|
}) {
|
|
8297
|
-
const registryMenus = (0,
|
|
8370
|
+
const registryMenus = (0, import_react32.useMemo)(() => {
|
|
8298
8371
|
if (menu !== void 0 || registry === void 0) {
|
|
8299
8372
|
return [];
|
|
8300
8373
|
}
|
|
@@ -8303,10 +8376,10 @@ function ChatLayout({
|
|
|
8303
8376
|
return visible.flatMap((item) => menuItemToMenuData(item));
|
|
8304
8377
|
}, [menu, registry, permissionChecker]);
|
|
8305
8378
|
const menuItems = menu ?? registryMenus;
|
|
8306
|
-
const [bridgePath, setBridgePath] = (0,
|
|
8379
|
+
const [bridgePath, setBridgePath] = (0, import_react32.useState)(
|
|
8307
8380
|
() => bridge?.getLocation().pathname ?? "/"
|
|
8308
8381
|
);
|
|
8309
|
-
(0,
|
|
8382
|
+
(0, import_react32.useEffect)(() => {
|
|
8310
8383
|
if (bridge === void 0) {
|
|
8311
8384
|
return;
|
|
8312
8385
|
}
|
|
@@ -8314,7 +8387,7 @@ function ChatLayout({
|
|
|
8314
8387
|
setBridgePath(location.pathname);
|
|
8315
8388
|
});
|
|
8316
8389
|
}, [bridge]);
|
|
8317
|
-
const activeKey = (0,
|
|
8390
|
+
const activeKey = (0, import_react32.useMemo)(() => {
|
|
8318
8391
|
if (activeMenuKey !== void 0) {
|
|
8319
8392
|
return activeMenuKey;
|
|
8320
8393
|
}
|
|
@@ -8689,7 +8762,7 @@ function isRecord(value) {
|
|
|
8689
8762
|
|
|
8690
8763
|
// src/interaction/provider.tsx
|
|
8691
8764
|
var import_runtime25 = require("@pactor-app/runtime");
|
|
8692
|
-
var
|
|
8765
|
+
var import_react33 = require("react");
|
|
8693
8766
|
var import_react_dom = require("react-dom");
|
|
8694
8767
|
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
8695
8768
|
var TOAST_DURATION = 3e3;
|
|
@@ -8703,11 +8776,11 @@ function InteractionProvider({
|
|
|
8703
8776
|
bridge,
|
|
8704
8777
|
children
|
|
8705
8778
|
}) {
|
|
8706
|
-
const [confirmState, setConfirmState] = (0,
|
|
8707
|
-
const [confirmOpen, setConfirmOpen] = (0,
|
|
8708
|
-
const [toasts, setToasts] = (0,
|
|
8779
|
+
const [confirmState, setConfirmState] = (0, import_react33.useState)(null);
|
|
8780
|
+
const [confirmOpen, setConfirmOpen] = (0, import_react33.useState)(false);
|
|
8781
|
+
const [toasts, setToasts] = (0, import_react33.useState)([]);
|
|
8709
8782
|
const { t } = (0, import_runtime25.useI18n)();
|
|
8710
|
-
const { modal, message } = (0,
|
|
8783
|
+
const { modal, message } = (0, import_react33.useMemo)(() => {
|
|
8711
8784
|
const pushToast = (type, content) => {
|
|
8712
8785
|
const id = Date.now() + Math.random();
|
|
8713
8786
|
setToasts((prev) => [...prev, { id, type, content }]);
|
|
@@ -8729,7 +8802,7 @@ function InteractionProvider({
|
|
|
8729
8802
|
};
|
|
8730
8803
|
return { modal: modalImpl, message: messageImpl };
|
|
8731
8804
|
}, []);
|
|
8732
|
-
(0,
|
|
8805
|
+
(0, import_react33.useEffect)(() => {
|
|
8733
8806
|
bridge.modal = modal;
|
|
8734
8807
|
bridge.message = message;
|
|
8735
8808
|
return () => {
|
|
@@ -8812,7 +8885,7 @@ function InteractionProvider({
|
|
|
8812
8885
|
// src/interaction/host.tsx
|
|
8813
8886
|
var import_lucide_react27 = require("lucide-react");
|
|
8814
8887
|
var import_runtime26 = require("@pactor-app/runtime");
|
|
8815
|
-
var
|
|
8888
|
+
var import_react34 = require("react");
|
|
8816
8889
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
8817
8890
|
function toCssWidth(width) {
|
|
8818
8891
|
if (width === void 0) {
|
|
@@ -8822,11 +8895,11 @@ function toCssWidth(width) {
|
|
|
8822
8895
|
}
|
|
8823
8896
|
function OverlayHost({ manager, resolvePage }) {
|
|
8824
8897
|
const renderer = (0, import_runtime26.useRenderer)();
|
|
8825
|
-
const stack = (0,
|
|
8898
|
+
const stack = (0, import_react34.useSyncExternalStore)(
|
|
8826
8899
|
(onChange) => manager.subscribe(onChange),
|
|
8827
8900
|
() => manager.stack()
|
|
8828
8901
|
);
|
|
8829
|
-
(0,
|
|
8902
|
+
(0, import_react34.useSyncExternalStore)(
|
|
8830
8903
|
(onChange) => {
|
|
8831
8904
|
const offState = renderer.context.state.subscribe(onChange);
|
|
8832
8905
|
const offData = renderer.context.data.subscribe(onChange);
|
|
@@ -8973,9 +9046,9 @@ function PageOverlayBody({
|
|
|
8973
9046
|
renderer,
|
|
8974
9047
|
resolvePage
|
|
8975
9048
|
}) {
|
|
8976
|
-
const [child, setChild] = (0,
|
|
8977
|
-
const [error, setError] = (0,
|
|
8978
|
-
(0,
|
|
9049
|
+
const [child, setChild] = (0, import_react34.useState)(null);
|
|
9050
|
+
const [error, setError] = (0, import_react34.useState)(null);
|
|
9051
|
+
(0, import_react34.useEffect)(() => {
|
|
8979
9052
|
if (!resolvePage) {
|
|
8980
9053
|
setError(
|
|
8981
9054
|
new Error(
|