@helpwave/hightide 0.12.5 → 0.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +64 -34
- package/dist/index.d.ts +64 -34
- package/dist/index.js +336 -258
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +445 -368
- package/dist/index.mjs.map +1 -1
- package/dist/style/globals.css +190 -121
- package/dist/style/uncompiled/theme/colors/component.css +7 -0
- package/dist/style/uncompiled/theme/colors/semantic.css +4 -4
- package/dist/style/uncompiled/theme/components/app-page.css +2 -2
- package/dist/style/uncompiled/theme/components/avatar.css +12 -3
- package/dist/style/uncompiled/theme/components/button.css +1 -0
- package/dist/style/uncompiled/theme/components/card.css +16 -5
- package/dist/style/uncompiled/theme/components/checkbox.css +1 -7
- package/dist/style/uncompiled/theme/components/date-time-input.css +4 -0
- package/dist/style/uncompiled/theme/components/general.css +1 -0
- package/dist/style/uncompiled/theme/components/icon-button.css +1 -0
- package/dist/style/uncompiled/theme/components/switch.css +5 -1
- package/dist/style/uncompiled/theme/components/table.css +5 -1
- package/dist/style/uncompiled/theme/components/vertical-navigation.css +3 -2
- package/dist/style/uncompiled/utitlity/coloring.css +4 -8
- package/dist/style/uncompiled/utitlity/focus.css +14 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7129,6 +7129,7 @@ __export(index_exports, {
|
|
|
7129
7129
|
processModelLibrary: () => processModelLibrary,
|
|
7130
7130
|
range: () => range,
|
|
7131
7131
|
resolveSetState: () => resolveSetState,
|
|
7132
|
+
resolveTreeNodePath: () => resolveTreeNodePath,
|
|
7132
7133
|
segmentBounds: () => segmentBounds,
|
|
7133
7134
|
segmentPlaceholder: () => segmentPlaceholder,
|
|
7134
7135
|
setDayPeriod: () => setDayPeriod,
|
|
@@ -7321,6 +7322,125 @@ function Visibility({ children, isVisible }) {
|
|
|
7321
7322
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: isVisible && children });
|
|
7322
7323
|
}
|
|
7323
7324
|
|
|
7325
|
+
// src/components/display-and-visualization/Avatar.tsx
|
|
7326
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
7327
|
+
var import_react2 = require("react");
|
|
7328
|
+
var Avatar = ({
|
|
7329
|
+
image: initialImage,
|
|
7330
|
+
name,
|
|
7331
|
+
size = "md",
|
|
7332
|
+
...props
|
|
7333
|
+
}) => {
|
|
7334
|
+
const [hasError, setHasError] = (0, import_react.useState)(false);
|
|
7335
|
+
const [hasLoaded, setHasLoaded] = (0, import_react.useState)(false);
|
|
7336
|
+
const [image, setImage] = (0, import_react.useState)(initialImage);
|
|
7337
|
+
const displayName = (0, import_react.useMemo)(() => {
|
|
7338
|
+
const maxLetters = size === "sm" ? 1 : 2;
|
|
7339
|
+
return (name ?? "").split(" ").filter((_, index) => index < maxLetters).map((value) => value[0]).join("").toUpperCase();
|
|
7340
|
+
}, [name, size]);
|
|
7341
|
+
const isShowingImage = !!image && (!hasError || !hasLoaded);
|
|
7342
|
+
(0, import_react.useEffect)(() => {
|
|
7343
|
+
if (initialImage?.avatarUrl !== image?.avatarUrl) {
|
|
7344
|
+
setHasError(false);
|
|
7345
|
+
setHasLoaded(false);
|
|
7346
|
+
}
|
|
7347
|
+
setImage(initialImage);
|
|
7348
|
+
}, [image?.avatarUrl, initialImage]);
|
|
7349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
7350
|
+
"div",
|
|
7351
|
+
{
|
|
7352
|
+
...props,
|
|
7353
|
+
"data-name": "avatar",
|
|
7354
|
+
"data-size": size ?? void 0,
|
|
7355
|
+
children: [
|
|
7356
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Visibility, { isVisible: isShowingImage, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
7357
|
+
"img",
|
|
7358
|
+
{
|
|
7359
|
+
src: image?.avatarUrl,
|
|
7360
|
+
alt: image?.alt,
|
|
7361
|
+
"data-name": "avatar-image",
|
|
7362
|
+
onLoad: () => setHasLoaded(true),
|
|
7363
|
+
onError: () => setHasError(true),
|
|
7364
|
+
"data-error": hasError ? "" : void 0,
|
|
7365
|
+
"data-loaded": hasLoaded ? "" : void 0
|
|
7366
|
+
},
|
|
7367
|
+
image?.avatarUrl
|
|
7368
|
+
) }),
|
|
7369
|
+
name ? displayName : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.UserIcon, {})
|
|
7370
|
+
]
|
|
7371
|
+
}
|
|
7372
|
+
);
|
|
7373
|
+
};
|
|
7374
|
+
var AvatarGroup = ({
|
|
7375
|
+
avatars,
|
|
7376
|
+
showTotalNumber = true,
|
|
7377
|
+
size = "md",
|
|
7378
|
+
...props
|
|
7379
|
+
}) => {
|
|
7380
|
+
const maxShownProfiles = 5;
|
|
7381
|
+
const displayedProfiles = avatars.length < maxShownProfiles ? avatars : avatars.slice(0, maxShownProfiles);
|
|
7382
|
+
const notDisplayedProfiles = avatars.length - maxShownProfiles;
|
|
7383
|
+
const group = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "avatar-group-container", children: displayedProfiles.map((avatar, index) => /* @__PURE__ */ (0, import_react2.createElement)(
|
|
7384
|
+
Avatar,
|
|
7385
|
+
{
|
|
7386
|
+
...avatar,
|
|
7387
|
+
key: index,
|
|
7388
|
+
size,
|
|
7389
|
+
"data-group": ""
|
|
7390
|
+
}
|
|
7391
|
+
)) });
|
|
7392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
7393
|
+
"div",
|
|
7394
|
+
{
|
|
7395
|
+
...props,
|
|
7396
|
+
"data-name": props["data-name"] ?? "avatar-group",
|
|
7397
|
+
"data-size": size ?? void 0,
|
|
7398
|
+
children: [
|
|
7399
|
+
group,
|
|
7400
|
+
showTotalNumber && notDisplayedProfiles > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
7401
|
+
"span",
|
|
7402
|
+
{
|
|
7403
|
+
"data-name": "avatar-group-more",
|
|
7404
|
+
"data-size": size,
|
|
7405
|
+
children: `+ ${notDisplayedProfiles}`
|
|
7406
|
+
}
|
|
7407
|
+
)
|
|
7408
|
+
]
|
|
7409
|
+
}
|
|
7410
|
+
);
|
|
7411
|
+
};
|
|
7412
|
+
var AvatarWithStatus = ({
|
|
7413
|
+
status = "unknown",
|
|
7414
|
+
className,
|
|
7415
|
+
size = "md",
|
|
7416
|
+
...avatarProps
|
|
7417
|
+
}) => {
|
|
7418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
7419
|
+
"div",
|
|
7420
|
+
{
|
|
7421
|
+
className: (0, import_clsx3.default)(className),
|
|
7422
|
+
"data-name": "avatar-with-status",
|
|
7423
|
+
"data-size": size ?? void 0,
|
|
7424
|
+
children: [
|
|
7425
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Avatar, { ...avatarProps, size }),
|
|
7426
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
7427
|
+
"div",
|
|
7428
|
+
{
|
|
7429
|
+
"data-name": "avatar-with-status-dot",
|
|
7430
|
+
"data-size": size ?? void 0,
|
|
7431
|
+
"data-status": status
|
|
7432
|
+
}
|
|
7433
|
+
)
|
|
7434
|
+
]
|
|
7435
|
+
}
|
|
7436
|
+
);
|
|
7437
|
+
};
|
|
7438
|
+
|
|
7439
|
+
// src/components/display-and-visualization/Card.tsx
|
|
7440
|
+
var import_react3 = require("react");
|
|
7441
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
7442
|
+
var import_lucide_react2 = require("lucide-react");
|
|
7443
|
+
|
|
7324
7444
|
// src/utils/array.ts
|
|
7325
7445
|
var equalSizeGroups = (array, groupSize) => {
|
|
7326
7446
|
if (groupSize <= 0) {
|
|
@@ -7586,130 +7706,24 @@ var PropsUtil = {
|
|
|
7586
7706
|
mergeProps
|
|
7587
7707
|
};
|
|
7588
7708
|
|
|
7589
|
-
// src/components/display-and-visualization/Avatar.tsx
|
|
7590
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
7591
|
-
var import_react2 = require("react");
|
|
7592
|
-
var Avatar = ({
|
|
7593
|
-
image: initialImage,
|
|
7594
|
-
name,
|
|
7595
|
-
size = "md",
|
|
7596
|
-
...props
|
|
7597
|
-
}) => {
|
|
7598
|
-
const [hasError, setHasError] = (0, import_react.useState)(false);
|
|
7599
|
-
const [hasLoaded, setHasLoaded] = (0, import_react.useState)(false);
|
|
7600
|
-
const [image, setImage] = (0, import_react.useState)(initialImage);
|
|
7601
|
-
const displayName = (0, import_react.useMemo)(() => {
|
|
7602
|
-
const maxLetters = size === "sm" ? 1 : 2;
|
|
7603
|
-
return (name ?? "").split(" ").filter((_, index) => index < maxLetters).map((value) => value[0]).join("").toUpperCase();
|
|
7604
|
-
}, [name, size]);
|
|
7605
|
-
const isShowingImage = !!image && (!hasError || !hasLoaded);
|
|
7606
|
-
(0, import_react.useEffect)(() => {
|
|
7607
|
-
if (initialImage?.avatarUrl !== image?.avatarUrl) {
|
|
7608
|
-
setHasError(false);
|
|
7609
|
-
setHasLoaded(false);
|
|
7610
|
-
}
|
|
7611
|
-
setImage(initialImage);
|
|
7612
|
-
}, [image?.avatarUrl, initialImage]);
|
|
7613
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
7614
|
-
"div",
|
|
7615
|
-
{
|
|
7616
|
-
...props,
|
|
7617
|
-
"data-name": props["data-name"] ?? "avatar",
|
|
7618
|
-
"data-size": props["data-size"] ?? size ?? void 0,
|
|
7619
|
-
children: [
|
|
7620
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Visibility, { isVisible: isShowingImage, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
7621
|
-
"img",
|
|
7622
|
-
{
|
|
7623
|
-
src: image?.avatarUrl,
|
|
7624
|
-
alt: image?.alt,
|
|
7625
|
-
"data-name": "avatar-image",
|
|
7626
|
-
onLoad: () => setHasLoaded(true),
|
|
7627
|
-
onError: () => setHasError(true),
|
|
7628
|
-
"data-error": hasError ? "" : void 0,
|
|
7629
|
-
"data-loaded": hasLoaded ? "" : void 0
|
|
7630
|
-
},
|
|
7631
|
-
image?.avatarUrl
|
|
7632
|
-
) }),
|
|
7633
|
-
name ? displayName : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react.UserIcon, {})
|
|
7634
|
-
]
|
|
7635
|
-
}
|
|
7636
|
-
);
|
|
7637
|
-
};
|
|
7638
|
-
var AvatarGroup = ({
|
|
7639
|
-
avatars,
|
|
7640
|
-
showTotalNumber = true,
|
|
7641
|
-
size = "md",
|
|
7642
|
-
...props
|
|
7643
|
-
}) => {
|
|
7644
|
-
const maxShownProfiles = 5;
|
|
7645
|
-
const displayedProfiles = avatars.length < maxShownProfiles ? avatars : avatars.slice(0, maxShownProfiles);
|
|
7646
|
-
const notDisplayedProfiles = avatars.length - maxShownProfiles;
|
|
7647
|
-
const group = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "avatar-group-container", children: displayedProfiles.map((avatar, index) => /* @__PURE__ */ (0, import_react2.createElement)(
|
|
7648
|
-
Avatar,
|
|
7649
|
-
{
|
|
7650
|
-
...avatar,
|
|
7651
|
-
key: index,
|
|
7652
|
-
size,
|
|
7653
|
-
"data-group": ""
|
|
7654
|
-
}
|
|
7655
|
-
)) });
|
|
7656
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
7657
|
-
"div",
|
|
7658
|
-
{
|
|
7659
|
-
...props,
|
|
7660
|
-
"data-name": props["data-name"] ?? "avatar-group",
|
|
7661
|
-
"data-size": size ?? void 0,
|
|
7662
|
-
children: [
|
|
7663
|
-
group,
|
|
7664
|
-
showTotalNumber && notDisplayedProfiles > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
7665
|
-
"span",
|
|
7666
|
-
{
|
|
7667
|
-
"data-name": "avatar-group-more",
|
|
7668
|
-
"data-size": size,
|
|
7669
|
-
children: `+ ${notDisplayedProfiles}`
|
|
7670
|
-
}
|
|
7671
|
-
)
|
|
7672
|
-
]
|
|
7673
|
-
}
|
|
7674
|
-
);
|
|
7675
|
-
};
|
|
7676
|
-
var AvatarWithStatus = ({
|
|
7677
|
-
isOnline,
|
|
7678
|
-
className,
|
|
7679
|
-
size = "md",
|
|
7680
|
-
...avatarProps
|
|
7681
|
-
}) => {
|
|
7682
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
7683
|
-
"div",
|
|
7684
|
-
{
|
|
7685
|
-
className: (0, import_clsx3.default)(className),
|
|
7686
|
-
"data-name": "avatar-with-status",
|
|
7687
|
-
"data-size": size ?? void 0,
|
|
7688
|
-
children: [
|
|
7689
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Avatar, { ...avatarProps, size }),
|
|
7690
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
7691
|
-
"div",
|
|
7692
|
-
{
|
|
7693
|
-
"data-name": "avatar-with-status-dot",
|
|
7694
|
-
"data-size": size ?? void 0,
|
|
7695
|
-
"data-online": PropsUtil.dataAttributes.bool(isOnline),
|
|
7696
|
-
"aria-label": isOnline ? "Online" : "Offline"
|
|
7697
|
-
}
|
|
7698
|
-
)
|
|
7699
|
-
]
|
|
7700
|
-
}
|
|
7701
|
-
);
|
|
7702
|
-
};
|
|
7703
|
-
|
|
7704
7709
|
// src/components/display-and-visualization/Card.tsx
|
|
7705
|
-
var import_react3 = require("react");
|
|
7706
|
-
var import_clsx4 = __toESM(require("clsx"));
|
|
7707
|
-
var import_lucide_react2 = require("lucide-react");
|
|
7708
7710
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
7711
|
+
function CardHeaderContent({ title, description, leading, trailing }) {
|
|
7712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
7713
|
+
leading != null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-name": "card-leading", children: leading }),
|
|
7714
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-name": "card-content", children: [
|
|
7715
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-name": "card-title", children: title }),
|
|
7716
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Visibility, { isVisible: !!description, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-name": "card-description", children: description }) })
|
|
7717
|
+
] }),
|
|
7718
|
+
trailing != null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-name": "card-trailing", children: trailing })
|
|
7719
|
+
] });
|
|
7720
|
+
}
|
|
7709
7721
|
var Card = ({
|
|
7710
7722
|
title,
|
|
7711
7723
|
description,
|
|
7712
7724
|
size = "md",
|
|
7725
|
+
leading,
|
|
7726
|
+
trailing,
|
|
7713
7727
|
children,
|
|
7714
7728
|
className,
|
|
7715
7729
|
...props
|
|
@@ -7722,8 +7736,15 @@ var Card = ({
|
|
|
7722
7736
|
"data-name": props["data-name"] ?? "card",
|
|
7723
7737
|
"data-size": size,
|
|
7724
7738
|
children: [
|
|
7725
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("
|
|
7726
|
-
|
|
7739
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "data-name": "card-header", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7740
|
+
CardHeaderContent,
|
|
7741
|
+
{
|
|
7742
|
+
title,
|
|
7743
|
+
description,
|
|
7744
|
+
leading,
|
|
7745
|
+
trailing
|
|
7746
|
+
}
|
|
7747
|
+
) }),
|
|
7727
7748
|
children
|
|
7728
7749
|
]
|
|
7729
7750
|
}
|
|
@@ -7733,7 +7754,8 @@ var ActionCard = (0, import_react3.forwardRef)(function ActionCard2({
|
|
|
7733
7754
|
title,
|
|
7734
7755
|
description,
|
|
7735
7756
|
size = "md",
|
|
7736
|
-
|
|
7757
|
+
leading,
|
|
7758
|
+
trailing,
|
|
7737
7759
|
disabled = false,
|
|
7738
7760
|
children,
|
|
7739
7761
|
className,
|
|
@@ -7769,13 +7791,15 @@ var ActionCard = (0, import_react3.forwardRef)(function ActionCard2({
|
|
|
7769
7791
|
role: onClick ? "button" : void 0,
|
|
7770
7792
|
tabIndex: onClick && !disabled ? 0 : void 0,
|
|
7771
7793
|
children: [
|
|
7772
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7794
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "data-name": "card-header", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7795
|
+
CardHeaderContent,
|
|
7796
|
+
{
|
|
7797
|
+
title,
|
|
7798
|
+
description,
|
|
7799
|
+
leading,
|
|
7800
|
+
trailing
|
|
7801
|
+
}
|
|
7802
|
+
) }),
|
|
7779
7803
|
children
|
|
7780
7804
|
]
|
|
7781
7805
|
}
|
|
@@ -7785,6 +7809,7 @@ var NavigationCard = (0, import_react3.forwardRef)(function NavigationCard2({
|
|
|
7785
7809
|
title,
|
|
7786
7810
|
description,
|
|
7787
7811
|
size = "md",
|
|
7812
|
+
leading,
|
|
7788
7813
|
href,
|
|
7789
7814
|
isExternal = false,
|
|
7790
7815
|
children,
|
|
@@ -7830,10 +7855,14 @@ var NavigationCard = (0, import_react3.forwardRef)(function NavigationCard2({
|
|
|
7830
7855
|
tabIndex: 0,
|
|
7831
7856
|
children: [
|
|
7832
7857
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-name": "card-header", children: [
|
|
7833
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7858
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7859
|
+
CardHeaderContent,
|
|
7860
|
+
{
|
|
7861
|
+
title,
|
|
7862
|
+
description,
|
|
7863
|
+
leading
|
|
7864
|
+
}
|
|
7865
|
+
),
|
|
7837
7866
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7838
7867
|
"a",
|
|
7839
7868
|
{
|
|
@@ -14435,6 +14464,22 @@ function buildTreeIndex(nodes) {
|
|
|
14435
14464
|
roots: [...nodes]
|
|
14436
14465
|
};
|
|
14437
14466
|
}
|
|
14467
|
+
function resolveTreeNodePath(nodes, id) {
|
|
14468
|
+
if (id == null) return null;
|
|
14469
|
+
const entry = buildTreeIndex(nodes).byId.get(id);
|
|
14470
|
+
return entry?.path ?? null;
|
|
14471
|
+
}
|
|
14472
|
+
function flattenAllItems(nodes, expandedIds, path = []) {
|
|
14473
|
+
const result = [];
|
|
14474
|
+
for (const node of nodes) {
|
|
14475
|
+
const currentPath = [...path, node.id];
|
|
14476
|
+
const hasChildren = node.items.length > 0;
|
|
14477
|
+
const expanded = hasChildren && expandedIds.has(node.id);
|
|
14478
|
+
result.push({ id: node.id, path: currentPath, expanded });
|
|
14479
|
+
result.push(...flattenAllItems(node.items, expandedIds, currentPath));
|
|
14480
|
+
}
|
|
14481
|
+
return result;
|
|
14482
|
+
}
|
|
14438
14483
|
function flattenVisibleItems(nodes, expandedIds, path = []) {
|
|
14439
14484
|
const result = [];
|
|
14440
14485
|
for (const node of nodes) {
|
|
@@ -14471,11 +14516,11 @@ function isAncestorOf(ancestorId, descendantPath) {
|
|
|
14471
14516
|
const index = descendantPath.indexOf(ancestorId);
|
|
14472
14517
|
return index >= 0 && index < descendantPath.length - 1;
|
|
14473
14518
|
}
|
|
14474
|
-
function pruneExpandedIds(expandedIds,
|
|
14475
|
-
if (!onlyOneExpandedTree ||
|
|
14519
|
+
function pruneExpandedIds(expandedIds, focusedPath, onlyOneExpandedTree, index) {
|
|
14520
|
+
if (!onlyOneExpandedTree || focusedPath == null) {
|
|
14476
14521
|
return new Set(expandedIds);
|
|
14477
14522
|
}
|
|
14478
|
-
const pathSet = new Set(
|
|
14523
|
+
const pathSet = new Set(focusedPath);
|
|
14479
14524
|
const pruned = /* @__PURE__ */ new Set();
|
|
14480
14525
|
for (const id of expandedIds) {
|
|
14481
14526
|
if (!pathSet.has(id)) continue;
|
|
@@ -14486,77 +14531,80 @@ function pruneExpandedIds(expandedIds, activePath, onlyOneExpandedTree, index) {
|
|
|
14486
14531
|
}
|
|
14487
14532
|
return pruned;
|
|
14488
14533
|
}
|
|
14489
|
-
function
|
|
14534
|
+
function syncExpansionForFocused(expandedIds, focusedPath, onlyOneExpandedTree, index) {
|
|
14490
14535
|
const next = new Set(expandedIds);
|
|
14491
|
-
for (const id of getExpandableAncestorIds(
|
|
14536
|
+
for (const id of getExpandableAncestorIds(focusedPath, index)) {
|
|
14492
14537
|
next.add(id);
|
|
14493
14538
|
}
|
|
14494
|
-
return pruneExpandedIds(next,
|
|
14539
|
+
return pruneExpandedIds(next, focusedPath, onlyOneExpandedTree, index);
|
|
14495
14540
|
}
|
|
14496
14541
|
function useTreeNavigation({
|
|
14497
14542
|
nodes,
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14543
|
+
focusedId: controlledFocusedId,
|
|
14544
|
+
onFocusedIdChange,
|
|
14545
|
+
initialFocusedId,
|
|
14501
14546
|
onlyOneExpandedTree = false
|
|
14502
14547
|
}) {
|
|
14503
14548
|
const index = (0, import_react57.useMemo)(() => buildTreeIndex(nodes), [nodes]);
|
|
14504
|
-
const [
|
|
14505
|
-
value:
|
|
14506
|
-
onValueChange:
|
|
14507
|
-
defaultValue:
|
|
14549
|
+
const [focusedId, setFocusedId] = useControlledState({
|
|
14550
|
+
value: controlledFocusedId,
|
|
14551
|
+
onValueChange: onFocusedIdChange,
|
|
14552
|
+
defaultValue: initialFocusedId ?? null
|
|
14508
14553
|
});
|
|
14509
|
-
const
|
|
14510
|
-
if (
|
|
14511
|
-
if (index.byId.has(
|
|
14554
|
+
const resolvedFocusedId = (0, import_react57.useMemo)(() => {
|
|
14555
|
+
if (focusedId == null) return null;
|
|
14556
|
+
if (index.byId.has(focusedId)) return focusedId;
|
|
14512
14557
|
return null;
|
|
14513
|
-
}, [
|
|
14558
|
+
}, [focusedId, index]);
|
|
14514
14559
|
const [expandedIds, setExpandedIds] = (0, import_react57.useState)(() => /* @__PURE__ */ new Set());
|
|
14515
14560
|
(0, import_react57.useEffect)(() => {
|
|
14516
|
-
if (
|
|
14517
|
-
const entry = index.byId.get(
|
|
14561
|
+
if (resolvedFocusedId == null) return;
|
|
14562
|
+
const entry = index.byId.get(resolvedFocusedId);
|
|
14518
14563
|
if (entry == null) return;
|
|
14519
|
-
setExpandedIds((prev) =>
|
|
14520
|
-
}, [
|
|
14521
|
-
const
|
|
14564
|
+
setExpandedIds((prev) => syncExpansionForFocused(prev, entry.path, onlyOneExpandedTree, index));
|
|
14565
|
+
}, [resolvedFocusedId, onlyOneExpandedTree, index]);
|
|
14566
|
+
const visibleItems = (0, import_react57.useMemo)(() => {
|
|
14522
14567
|
return flattenVisibleItems(nodes, expandedIds);
|
|
14523
14568
|
}, [nodes, expandedIds]);
|
|
14524
|
-
const
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14569
|
+
const allItems = (0, import_react57.useMemo)(() => {
|
|
14570
|
+
return flattenAllItems(nodes, expandedIds);
|
|
14571
|
+
}, [nodes, expandedIds]);
|
|
14572
|
+
const focusedItem = (0, import_react57.useMemo)(() => {
|
|
14573
|
+
if (resolvedFocusedId == null) return null;
|
|
14574
|
+
return allItems.find((item) => item.id === resolvedFocusedId) ?? null;
|
|
14575
|
+
}, [allItems, resolvedFocusedId]);
|
|
14528
14576
|
const navigateTo = (0, import_react57.useCallback)((id) => {
|
|
14529
14577
|
const entry = index.byId.get(id);
|
|
14530
14578
|
if (entry == null) {
|
|
14531
14579
|
console.warn(`Attempted to navigate to node ${id} that does not exist`);
|
|
14532
14580
|
return;
|
|
14533
14581
|
}
|
|
14534
|
-
|
|
14582
|
+
setFocusedId(id);
|
|
14535
14583
|
setExpandedIds((prev) => {
|
|
14536
|
-
const next2 =
|
|
14584
|
+
const next2 = syncExpansionForFocused(prev, entry.path, onlyOneExpandedTree, index);
|
|
14537
14585
|
return next2;
|
|
14538
14586
|
});
|
|
14539
|
-
}, [index, onlyOneExpandedTree,
|
|
14587
|
+
}, [index, onlyOneExpandedTree, setFocusedId]);
|
|
14540
14588
|
const expand = (0, import_react57.useCallback)((id, options) => {
|
|
14541
14589
|
const entry = index.byId.get(id);
|
|
14542
14590
|
if (entry == null || entry.node.items.length === 0) return;
|
|
14543
14591
|
if (options?.isFocusing) {
|
|
14544
|
-
|
|
14592
|
+
setFocusedId(id);
|
|
14545
14593
|
}
|
|
14546
14594
|
setExpandedIds((prev) => {
|
|
14547
14595
|
const next2 = new Set(prev);
|
|
14548
14596
|
next2.add(id);
|
|
14549
|
-
const
|
|
14550
|
-
return pruneExpandedIds(next2,
|
|
14597
|
+
const focusedPath = options?.isFocusing ? entry.path : resolvedFocusedId != null ? index.byId.get(resolvedFocusedId)?.path ?? null : null;
|
|
14598
|
+
return pruneExpandedIds(next2, focusedPath, onlyOneExpandedTree, index);
|
|
14551
14599
|
});
|
|
14552
|
-
}, [index, onlyOneExpandedTree,
|
|
14600
|
+
}, [index, onlyOneExpandedTree, resolvedFocusedId, setFocusedId]);
|
|
14553
14601
|
const collapse = (0, import_react57.useCallback)((id, options) => {
|
|
14554
|
-
if (!options?.isFocusing &&
|
|
14555
|
-
const
|
|
14556
|
-
if (
|
|
14602
|
+
if (!options?.isFocusing && resolvedFocusedId != null) {
|
|
14603
|
+
const focusedEntry = index.byId.get(resolvedFocusedId);
|
|
14604
|
+
if (focusedEntry != null && isAncestorOf(id, focusedEntry.path)) return;
|
|
14557
14605
|
}
|
|
14558
14606
|
if (options?.isFocusing) {
|
|
14559
|
-
|
|
14607
|
+
setFocusedId(id);
|
|
14560
14608
|
}
|
|
14561
14609
|
const descendantIds = getDescendantIds(index, id);
|
|
14562
14610
|
setExpandedIds((prev) => {
|
|
@@ -14567,12 +14615,12 @@ function useTreeNavigation({
|
|
|
14567
14615
|
}
|
|
14568
14616
|
return next2;
|
|
14569
14617
|
});
|
|
14570
|
-
}, [index,
|
|
14618
|
+
}, [index, resolvedFocusedId, setFocusedId]);
|
|
14571
14619
|
const toggleExpansion = (0, import_react57.useCallback)((id, options) => {
|
|
14572
14620
|
const entry = index.byId.get(id);
|
|
14573
14621
|
if (entry == null || entry.node.items.length === 0) return;
|
|
14574
14622
|
if (options?.isFocusing) {
|
|
14575
|
-
|
|
14623
|
+
setFocusedId(id);
|
|
14576
14624
|
setExpandedIds((prev) => {
|
|
14577
14625
|
if (prev.has(id)) {
|
|
14578
14626
|
const next3 = new Set(prev);
|
|
@@ -14597,44 +14645,45 @@ function useTreeNavigation({
|
|
|
14597
14645
|
} else {
|
|
14598
14646
|
expand(id);
|
|
14599
14647
|
}
|
|
14600
|
-
}, [index, expandedIds, expand, collapse, onlyOneExpandedTree,
|
|
14648
|
+
}, [index, expandedIds, expand, collapse, onlyOneExpandedTree, setFocusedId]);
|
|
14601
14649
|
const next = (0, import_react57.useCallback)(() => {
|
|
14602
|
-
if (
|
|
14603
|
-
if (
|
|
14604
|
-
navigateTo(
|
|
14650
|
+
if (visibleItems.length === 0) return;
|
|
14651
|
+
if (resolvedFocusedId == null) {
|
|
14652
|
+
navigateTo(visibleItems[0].id);
|
|
14605
14653
|
return;
|
|
14606
14654
|
}
|
|
14607
|
-
const currentIndex =
|
|
14655
|
+
const currentIndex = visibleItems.findIndex((item) => item.id === resolvedFocusedId);
|
|
14608
14656
|
const startIndex = currentIndex < 0 ? 0 : currentIndex;
|
|
14609
|
-
if (startIndex <
|
|
14610
|
-
navigateTo(
|
|
14657
|
+
if (startIndex < visibleItems.length - 1) {
|
|
14658
|
+
navigateTo(visibleItems[startIndex + 1].id);
|
|
14611
14659
|
return;
|
|
14612
14660
|
}
|
|
14613
|
-
}, [
|
|
14661
|
+
}, [visibleItems, resolvedFocusedId, navigateTo]);
|
|
14614
14662
|
const previous = (0, import_react57.useCallback)(() => {
|
|
14615
|
-
if (
|
|
14616
|
-
if (
|
|
14617
|
-
navigateTo(
|
|
14663
|
+
if (visibleItems.length === 0) return;
|
|
14664
|
+
if (resolvedFocusedId == null) {
|
|
14665
|
+
navigateTo(visibleItems[visibleItems.length - 1].id);
|
|
14618
14666
|
return;
|
|
14619
14667
|
}
|
|
14620
|
-
const currentIndex =
|
|
14621
|
-
const startIndex = currentIndex < 0 ?
|
|
14668
|
+
const currentIndex = visibleItems.findIndex((item) => item.id === resolvedFocusedId);
|
|
14669
|
+
const startIndex = currentIndex < 0 ? visibleItems.length - 1 : currentIndex;
|
|
14622
14670
|
if (startIndex > 0) {
|
|
14623
|
-
navigateTo(
|
|
14671
|
+
navigateTo(visibleItems[startIndex - 1].id);
|
|
14624
14672
|
return;
|
|
14625
14673
|
}
|
|
14626
|
-
}, [
|
|
14674
|
+
}, [visibleItems, resolvedFocusedId, navigateTo]);
|
|
14627
14675
|
const first = (0, import_react57.useCallback)(() => {
|
|
14628
|
-
if (
|
|
14629
|
-
navigateTo(
|
|
14630
|
-
}, [
|
|
14676
|
+
if (visibleItems.length === 0) return;
|
|
14677
|
+
navigateTo(visibleItems[0].id);
|
|
14678
|
+
}, [visibleItems, navigateTo]);
|
|
14631
14679
|
const last = (0, import_react57.useCallback)(() => {
|
|
14632
|
-
if (
|
|
14633
|
-
navigateTo(
|
|
14634
|
-
}, [
|
|
14680
|
+
if (visibleItems.length === 0) return;
|
|
14681
|
+
navigateTo(visibleItems[visibleItems.length - 1].id);
|
|
14682
|
+
}, [visibleItems, navigateTo]);
|
|
14635
14683
|
return (0, import_react57.useMemo)(() => ({
|
|
14636
|
-
|
|
14637
|
-
|
|
14684
|
+
visibleItems,
|
|
14685
|
+
allItems,
|
|
14686
|
+
focusedItem,
|
|
14638
14687
|
navigateTo,
|
|
14639
14688
|
expand,
|
|
14640
14689
|
collapse,
|
|
@@ -14643,7 +14692,7 @@ function useTreeNavigation({
|
|
|
14643
14692
|
previous,
|
|
14644
14693
|
first,
|
|
14645
14694
|
last
|
|
14646
|
-
}), [
|
|
14695
|
+
}), [visibleItems, allItems, focusedItem, navigateTo, expand, collapse, toggleExpansion, next, previous, first, last]);
|
|
14647
14696
|
}
|
|
14648
14697
|
|
|
14649
14698
|
// src/components/layout/navigation/navigation-menus/NavigationContext.tsx
|
|
@@ -14651,22 +14700,41 @@ var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
|
14651
14700
|
var NavigationContext = (0, import_react58.createContext)(null);
|
|
14652
14701
|
function NavigationProvider({
|
|
14653
14702
|
children,
|
|
14654
|
-
|
|
14703
|
+
activeId = null,
|
|
14704
|
+
...treeOptions
|
|
14655
14705
|
}) {
|
|
14656
|
-
const navigation = useTreeNavigation(
|
|
14706
|
+
const navigation = useTreeNavigation({
|
|
14707
|
+
...treeOptions,
|
|
14708
|
+
initialFocusedId: treeOptions.initialFocusedId ?? activeId ?? treeOptions.nodes[0]?.id ?? null
|
|
14709
|
+
});
|
|
14657
14710
|
const itemRefs = (0, import_react58.useRef)(/* @__PURE__ */ new Map());
|
|
14658
|
-
const
|
|
14711
|
+
const [hasNavigatedToActiveId, setHasNavigatedToActiveId] = (0, import_react58.useState)(false);
|
|
14712
|
+
(0, import_react58.useEffect)(() => {
|
|
14713
|
+
if (activeId == null || hasNavigatedToActiveId) return;
|
|
14714
|
+
const navigationItem = navigation.allItems.find((item) => item.id === activeId);
|
|
14715
|
+
if (navigationItem == null) return;
|
|
14716
|
+
navigation.navigateTo(activeId);
|
|
14717
|
+
setHasNavigatedToActiveId(true);
|
|
14718
|
+
}, [activeId, navigation, navigation.navigateTo, navigation.allItems, hasNavigatedToActiveId]);
|
|
14719
|
+
const focusedId = (0, import_react58.useMemo)(() => {
|
|
14720
|
+
return navigation.focusedItem?.id ?? navigation.visibleItems[0]?.id ?? null;
|
|
14721
|
+
}, [navigation.focusedItem, navigation.visibleItems]);
|
|
14722
|
+
const activePath = (0, import_react58.useMemo)(() => {
|
|
14723
|
+
return resolveTreeNodePath(treeOptions.nodes, activeId);
|
|
14724
|
+
}, [treeOptions.nodes, activeId]);
|
|
14659
14725
|
const itemStateById = (0, import_react58.useMemo)(() => {
|
|
14660
14726
|
const map = /* @__PURE__ */ new Map();
|
|
14661
|
-
for (const item of navigation.
|
|
14727
|
+
for (const item of navigation.allItems) {
|
|
14662
14728
|
map.set(item.id, {
|
|
14663
14729
|
expanded: item.expanded,
|
|
14664
14730
|
isFocused: focusedId === item.id,
|
|
14731
|
+
isActive: activeId === item.id,
|
|
14732
|
+
isOnActivePath: activePath?.includes(item.id) ?? false,
|
|
14665
14733
|
path: item.path
|
|
14666
14734
|
});
|
|
14667
14735
|
}
|
|
14668
14736
|
return map;
|
|
14669
|
-
}, [navigation.
|
|
14737
|
+
}, [navigation.allItems, focusedId, activeId, activePath]);
|
|
14670
14738
|
const getItemState = (0, import_react58.useCallback)((id) => {
|
|
14671
14739
|
return itemStateById.get(id) ?? null;
|
|
14672
14740
|
}, [itemStateById]);
|
|
@@ -14682,9 +14750,12 @@ function NavigationProvider({
|
|
|
14682
14750
|
itemRefs.current.get(focusedId)?.focus();
|
|
14683
14751
|
}, [focusedId]);
|
|
14684
14752
|
const value = (0, import_react58.useMemo)(() => ({
|
|
14685
|
-
|
|
14753
|
+
focusedItem: navigation.focusedItem,
|
|
14686
14754
|
focusedId,
|
|
14687
|
-
|
|
14755
|
+
activeId,
|
|
14756
|
+
activePath,
|
|
14757
|
+
visibleItems: navigation.visibleItems,
|
|
14758
|
+
allItems: navigation.allItems,
|
|
14688
14759
|
getItemState,
|
|
14689
14760
|
navigateTo: navigation.navigateTo,
|
|
14690
14761
|
expand: navigation.expand,
|
|
@@ -14696,8 +14767,9 @@ function NavigationProvider({
|
|
|
14696
14767
|
toggleExpansion: navigation.toggleExpansion,
|
|
14697
14768
|
registerItemRef
|
|
14698
14769
|
}), [
|
|
14699
|
-
navigation.
|
|
14700
|
-
navigation.
|
|
14770
|
+
navigation.focusedItem,
|
|
14771
|
+
navigation.visibleItems,
|
|
14772
|
+
navigation.allItems,
|
|
14701
14773
|
navigation.navigateTo,
|
|
14702
14774
|
navigation.expand,
|
|
14703
14775
|
navigation.collapse,
|
|
@@ -14707,6 +14779,8 @@ function NavigationProvider({
|
|
|
14707
14779
|
navigation.last,
|
|
14708
14780
|
navigation.toggleExpansion,
|
|
14709
14781
|
focusedId,
|
|
14782
|
+
activeId,
|
|
14783
|
+
activePath,
|
|
14710
14784
|
getItemState,
|
|
14711
14785
|
registerItemRef
|
|
14712
14786
|
]);
|
|
@@ -14839,32 +14913,19 @@ function VerticalNavigationItem({
|
|
|
14839
14913
|
const handleHeaderActivate = (0, import_react59.useCallback)(() => {
|
|
14840
14914
|
toggleExpansion(id, { isFocusing: true });
|
|
14841
14915
|
}, [id, toggleExpansion]);
|
|
14842
|
-
const handleLeafActivate = (0, import_react59.useCallback)((
|
|
14843
|
-
if (event.target.closest('[data-name="vertical-navigation-item-link"]')) return;
|
|
14916
|
+
const handleLeafActivate = (0, import_react59.useCallback)(() => {
|
|
14844
14917
|
navigateTo(id);
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
href: url,
|
|
14850
|
-
target: "_blank",
|
|
14851
|
-
rel: "noopener noreferrer",
|
|
14852
|
-
"data-name": "vertical-navigation-item-link",
|
|
14853
|
-
tabIndex: -1,
|
|
14854
|
-
children: [
|
|
14855
|
-
label,
|
|
14856
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react9.ExternalLink, { className: "vertical-navigation-item-link-external-icon" })
|
|
14857
|
-
]
|
|
14858
|
-
}
|
|
14859
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
14860
|
-
"a",
|
|
14861
|
-
{
|
|
14862
|
-
href: url,
|
|
14863
|
-
"data-name": "vertical-navigation-item-link",
|
|
14864
|
-
tabIndex: -1,
|
|
14865
|
-
children: label
|
|
14918
|
+
if (url == null) return;
|
|
14919
|
+
if (external) {
|
|
14920
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
14921
|
+
return;
|
|
14866
14922
|
}
|
|
14867
|
-
|
|
14923
|
+
window.location.assign(url);
|
|
14924
|
+
}, [external, id, navigateTo, url]);
|
|
14925
|
+
const labelContent = url == null ? label : external ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { "data-name": "vertical-navigation-item-link", children: [
|
|
14926
|
+
label,
|
|
14927
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react9.ExternalLink, { className: "vertical-navigation-item-link-external-icon" })
|
|
14928
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "data-name": "vertical-navigation-item-link", children: label });
|
|
14868
14929
|
if (!hasChildren) {
|
|
14869
14930
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
14870
14931
|
"li",
|
|
@@ -15002,22 +15063,49 @@ var AppPageSidebarWithNavigation = ({
|
|
|
15002
15063
|
footer,
|
|
15003
15064
|
navigationItems,
|
|
15004
15065
|
contentOverwrite,
|
|
15005
|
-
|
|
15066
|
+
initialFocusedId,
|
|
15067
|
+
focusedId,
|
|
15068
|
+
onFocusedIdChange,
|
|
15069
|
+
activeId,
|
|
15006
15070
|
...props
|
|
15007
15071
|
}) => {
|
|
15008
15072
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppSidebar, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "app-page-sidebar-with-navigation", children: [
|
|
15009
15073
|
header && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-header", children: header }),
|
|
15010
|
-
navigationItems && !contentOverwrite && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
15074
|
+
navigationItems && !contentOverwrite && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
15075
|
+
VerticalNavigationTree,
|
|
15076
|
+
{
|
|
15077
|
+
items: navigationItems,
|
|
15078
|
+
initialFocusedId,
|
|
15079
|
+
focusedId,
|
|
15080
|
+
onFocusedIdChange,
|
|
15081
|
+
activeId
|
|
15082
|
+
}
|
|
15083
|
+
) }),
|
|
15011
15084
|
contentOverwrite && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-scroll", children: contentOverwrite }),
|
|
15012
15085
|
footer && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-footer", children: footer })
|
|
15013
15086
|
] }) });
|
|
15014
15087
|
};
|
|
15088
|
+
function findActiveIdByUrl(items, activeUrl) {
|
|
15089
|
+
for (const item of items) {
|
|
15090
|
+
if (item.url === activeUrl) return item.id;
|
|
15091
|
+
if (item.items != null) {
|
|
15092
|
+
const found = findActiveIdByUrl(item.items, activeUrl);
|
|
15093
|
+
if (found != null) return found;
|
|
15094
|
+
}
|
|
15095
|
+
}
|
|
15096
|
+
return null;
|
|
15097
|
+
}
|
|
15015
15098
|
var AppPage = ({ children, headerActions, sidebarProps, ...props }) => {
|
|
15016
15099
|
const translation = useHightideTranslation();
|
|
15017
15100
|
const [isSidebarOpen, setIsSidebarOpen] = (0, import_react60.useState)(false);
|
|
15101
|
+
const resolvedActiveId = (0, import_react60.useMemo)(() => {
|
|
15102
|
+
if (sidebarProps.activeId !== void 0) return sidebarProps.activeId;
|
|
15103
|
+
if (sidebarProps.activeUrl == null || sidebarProps.items == null) return null;
|
|
15104
|
+
return findActiveIdByUrl(sidebarProps.items, sidebarProps.activeUrl);
|
|
15105
|
+
}, [sidebarProps.activeId, sidebarProps.activeUrl, sidebarProps.items]);
|
|
15018
15106
|
const toNavigationItems = (0, import_react60.useCallback)((items) => {
|
|
15019
15107
|
return items?.map((item) => {
|
|
15020
|
-
const isActive =
|
|
15108
|
+
const isActive = item.id === resolvedActiveId;
|
|
15021
15109
|
return {
|
|
15022
15110
|
id: item.id,
|
|
15023
15111
|
label: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "app-page-navigation-item-label", "data-active-page": isActive ? "" : void 0, children: [
|
|
@@ -15029,25 +15117,10 @@ var AppPage = ({ children, headerActions, sidebarProps, ...props }) => {
|
|
|
15029
15117
|
items: toNavigationItems(item.items)
|
|
15030
15118
|
};
|
|
15031
15119
|
}) ?? void 0;
|
|
15032
|
-
}, [
|
|
15120
|
+
}, [resolvedActiveId]);
|
|
15033
15121
|
const navigationItems = (0, import_react60.useMemo)(() => toNavigationItems(
|
|
15034
15122
|
sidebarProps.items
|
|
15035
15123
|
), [sidebarProps.items, toNavigationItems]);
|
|
15036
|
-
const initialActiveId = (0, import_react60.useMemo)(() => {
|
|
15037
|
-
if (sidebarProps.initialActiveId) return sidebarProps.initialActiveId;
|
|
15038
|
-
if (!navigationItems) return void 0;
|
|
15039
|
-
const findActiveId = (items) => {
|
|
15040
|
-
for (const item of items) {
|
|
15041
|
-
if (item.url === sidebarProps.activeUrl) return item.id;
|
|
15042
|
-
if (item.items) {
|
|
15043
|
-
const found = findActiveId(item.items);
|
|
15044
|
-
if (found) return found;
|
|
15045
|
-
}
|
|
15046
|
-
}
|
|
15047
|
-
return void 0;
|
|
15048
|
-
};
|
|
15049
|
-
return findActiveId(navigationItems);
|
|
15050
|
-
}, [navigationItems, sidebarProps.activeUrl, sidebarProps.initialActiveId]);
|
|
15051
15124
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
15052
15125
|
"div",
|
|
15053
15126
|
{
|
|
@@ -15064,7 +15137,10 @@ var AppPage = ({ children, headerActions, sidebarProps, ...props }) => {
|
|
|
15064
15137
|
footer: sidebarProps.footer,
|
|
15065
15138
|
navigationItems,
|
|
15066
15139
|
contentOverwrite: sidebarProps.contentOverwrite,
|
|
15067
|
-
|
|
15140
|
+
initialFocusedId: sidebarProps.initialFocusedId,
|
|
15141
|
+
focusedId: sidebarProps.focusedId,
|
|
15142
|
+
onFocusedIdChange: sidebarProps.onFocusedIdChange,
|
|
15143
|
+
activeId: resolvedActiveId
|
|
15068
15144
|
}
|
|
15069
15145
|
),
|
|
15070
15146
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { "data-name": "app-page-content", children: [
|
|
@@ -15509,7 +15585,6 @@ var ThemeSelect = ({ ...props }) => {
|
|
|
15509
15585
|
{
|
|
15510
15586
|
value: theme,
|
|
15511
15587
|
onEditComplete: (value) => {
|
|
15512
|
-
console.log("onEditComplete", value);
|
|
15513
15588
|
props.onEditComplete?.(value);
|
|
15514
15589
|
setTheme(value);
|
|
15515
15590
|
},
|
|
@@ -15949,7 +16024,7 @@ var Navigation = ({ ...props }) => {
|
|
|
15949
16024
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
15950
16025
|
IconButton,
|
|
15951
16026
|
{
|
|
15952
|
-
tooltip: translation("
|
|
16027
|
+
tooltip: translation("menu"),
|
|
15953
16028
|
coloringStyle: "text",
|
|
15954
16029
|
color: "neutral",
|
|
15955
16030
|
onClick: () => setIsMobileOpen(true),
|
|
@@ -18283,7 +18358,7 @@ var DatePicker = ({
|
|
|
18283
18358
|
Button,
|
|
18284
18359
|
{
|
|
18285
18360
|
size: "sm",
|
|
18286
|
-
|
|
18361
|
+
color: "neutral",
|
|
18287
18362
|
className: (0, import_clsx29.default)("flex-row-1 items-center cursor-pointer select-none", {
|
|
18288
18363
|
"text-disabled": displayMode !== "day"
|
|
18289
18364
|
}),
|
|
@@ -19133,6 +19208,9 @@ var DateTimeInput = (0, import_react84.forwardRef)(function DateTimeInput2({
|
|
|
19133
19208
|
const focusField = () => {
|
|
19134
19209
|
fieldRef.current?.querySelector('[data-name="date-time-segment"]')?.focus();
|
|
19135
19210
|
};
|
|
19211
|
+
const hasClear = !required && allowClear && !readOnly && !disabled && state !== null;
|
|
19212
|
+
const hasTimePicker = !readOnly;
|
|
19213
|
+
const hasActions = hasClear || hasTimePicker || actions.length > 0;
|
|
19136
19214
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { ...containerProps, className: (0, import_clsx31.default)("relative w-full", containerProps?.className), children: [
|
|
19137
19215
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
19138
19216
|
"div",
|
|
@@ -19150,6 +19228,7 @@ var DateTimeInput = (0, import_react84.forwardRef)(function DateTimeInput2({
|
|
|
19150
19228
|
className: (0, import_clsx31.default)("cursor-text", props.className),
|
|
19151
19229
|
"data-name": props["data-name"] ?? "date-time-input",
|
|
19152
19230
|
"data-value": PropsUtil.dataAttributes.bool(!!state),
|
|
19231
|
+
"data-has-actions": PropsUtil.dataAttributes.bool(hasActions),
|
|
19153
19232
|
...PropsUtil.dataAttributes.interactionStates({ disabled, readOnly, invalid, required }),
|
|
19154
19233
|
...PropsUtil.aria.interactionStates({ disabled, readOnly, invalid, required }, props),
|
|
19155
19234
|
children: [
|
|
@@ -19168,13 +19247,12 @@ var DateTimeInput = (0, import_react84.forwardRef)(function DateTimeInput2({
|
|
|
19168
19247
|
onValueChange: (next) => setState(fromZoned(next)),
|
|
19169
19248
|
onEditComplete: (next) => onEditComplete?.(fromZoned(next)),
|
|
19170
19249
|
"aria-labelledby": props["aria-labelledby"],
|
|
19171
|
-
"aria-describedby": props["aria-describedby"]
|
|
19172
|
-
className: "grow"
|
|
19250
|
+
"aria-describedby": props["aria-describedby"]
|
|
19173
19251
|
}
|
|
19174
19252
|
),
|
|
19175
19253
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex-row-1 items-center", children: [
|
|
19176
19254
|
actions,
|
|
19177
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Visibility, { isVisible:
|
|
19255
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Visibility, { isVisible: hasClear, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
19178
19256
|
IconButton,
|
|
19179
19257
|
{
|
|
19180
19258
|
tooltip: translation("clearValue"),
|
|
@@ -19188,7 +19266,7 @@ var DateTimeInput = (0, import_react84.forwardRef)(function DateTimeInput2({
|
|
|
19188
19266
|
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react22.X, { className: "size-5" })
|
|
19189
19267
|
}
|
|
19190
19268
|
) }),
|
|
19191
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Visibility, { isVisible:
|
|
19269
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Visibility, { isVisible: hasTimePicker, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
19192
19270
|
IconButton,
|
|
19193
19271
|
{
|
|
19194
19272
|
tooltip: translation("sDateTimeSelect", { datetimeMode: mode }),
|
|
@@ -20913,7 +20991,7 @@ var TableHeader = ({ isSticky = false }) => {
|
|
|
20913
20991
|
"data-name": "table-header-cell",
|
|
20914
20992
|
className: (0, import_clsx35.default)("group/table-header-cell", header.column.columnDef.meta?.className),
|
|
20915
20993
|
children: [
|
|
20916
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Visibility, { isVisible: !header.isPlaceholder, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "
|
|
20994
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Visibility, { isVisible: !header.isPlaceholder, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "table-header-cell-content", children: [
|
|
20917
20995
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Visibility, { isVisible: header.column.getCanSort(), children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
20918
20996
|
TableSortButton,
|
|
20919
20997
|
{
|
|
@@ -23337,6 +23415,7 @@ var DateProperty = ({
|
|
|
23337
23415
|
onValueChange,
|
|
23338
23416
|
onEditComplete,
|
|
23339
23417
|
"data-name": "property-input",
|
|
23418
|
+
className: "flex-row-4 pr-0",
|
|
23340
23419
|
"data-invalid": PropsUtil.dataAttributes.bool(invalid)
|
|
23341
23420
|
}
|
|
23342
23421
|
)
|
|
@@ -23819,7 +23898,6 @@ var useSwipeGesture = ({
|
|
|
23819
23898
|
const listenTouch = inputMode === "touch" || inputMode === "both";
|
|
23820
23899
|
const listenMouse = inputMode === "mouse" || inputMode === "both";
|
|
23821
23900
|
const onGestureStart = (x, y, eventTarget) => {
|
|
23822
|
-
console.log("onGestureStart", x, y);
|
|
23823
23901
|
if (!isWithinStartRegion(x, y)) return;
|
|
23824
23902
|
const scrollableParent = findScrollableParent(eventTarget);
|
|
23825
23903
|
gestureEndRef.current = null;
|
|
@@ -23832,7 +23910,6 @@ var useSwipeGesture = ({
|
|
|
23832
23910
|
isScrollingRef.current = !!scrollableParent;
|
|
23833
23911
|
};
|
|
23834
23912
|
const onGestureMove = (x, y, eventTarget) => {
|
|
23835
|
-
console.log("onGestureMove", x, y);
|
|
23836
23913
|
const scrollableParent = findScrollableParent(eventTarget);
|
|
23837
23914
|
const currentScrollY = scrollableParent?.scrollTop ?? window.scrollY;
|
|
23838
23915
|
gestureEndRef.current = {
|
|
@@ -24553,6 +24630,7 @@ var PromiseUtils = {
|
|
|
24553
24630
|
processModelLibrary,
|
|
24554
24631
|
range,
|
|
24555
24632
|
resolveSetState,
|
|
24633
|
+
resolveTreeNodePath,
|
|
24556
24634
|
segmentBounds,
|
|
24557
24635
|
segmentPlaceholder,
|
|
24558
24636
|
setDayPeriod,
|