@helpwave/hightide 0.12.4 → 0.12.5
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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +38 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -17
- package/dist/index.mjs.map +1 -1
- package/dist/style/globals.css +20 -3
- package/dist/style/uncompiled/theme/components/app-page.css +2 -2
- package/dist/style/uncompiled/theme/components/vertical-navigation.css +5 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -14557,7 +14557,7 @@ function VerticalNavigationItem({
|
|
|
14557
14557
|
tabIndex: -1,
|
|
14558
14558
|
children: [
|
|
14559
14559
|
label,
|
|
14560
|
-
/* @__PURE__ */ jsx41(ExternalLink2, { className: "
|
|
14560
|
+
/* @__PURE__ */ jsx41(ExternalLink2, { className: "vertical-navigation-item-link-external-icon" })
|
|
14561
14561
|
]
|
|
14562
14562
|
}
|
|
14563
14563
|
) : /* @__PURE__ */ jsx41(
|
|
@@ -14577,11 +14577,12 @@ function VerticalNavigationItem({
|
|
|
14577
14577
|
role: "treeitem",
|
|
14578
14578
|
"data-name": "vertical-navigation-item",
|
|
14579
14579
|
"data-depth": depth,
|
|
14580
|
-
"data-
|
|
14580
|
+
"data-focused": isFocused ? "" : void 0,
|
|
14581
14581
|
"aria-selected": isFocused ? true : void 0,
|
|
14582
14582
|
tabIndex: isFocused ? 0 : -1,
|
|
14583
14583
|
onKeyDown: handleKeyDown,
|
|
14584
14584
|
onClick: handleLeafActivate,
|
|
14585
|
+
className: "group/tree-leaf",
|
|
14585
14586
|
children: labelContent
|
|
14586
14587
|
}
|
|
14587
14588
|
);
|
|
@@ -14593,7 +14594,7 @@ function VerticalNavigationItem({
|
|
|
14593
14594
|
role: "treeitem",
|
|
14594
14595
|
"data-name": "vertical-navigation-node",
|
|
14595
14596
|
"data-depth": depth,
|
|
14596
|
-
"data-
|
|
14597
|
+
"data-focused": isFocused ? "" : void 0,
|
|
14597
14598
|
"data-expanded": expanded ? "" : void 0,
|
|
14598
14599
|
"aria-expanded": expanded,
|
|
14599
14600
|
tabIndex: isFocused ? 0 : -1,
|
|
@@ -14605,7 +14606,7 @@ function VerticalNavigationItem({
|
|
|
14605
14606
|
{
|
|
14606
14607
|
ref: headerRef,
|
|
14607
14608
|
"data-name": "vertical-navigation-node-header",
|
|
14608
|
-
"data-
|
|
14609
|
+
"data-focused": isFocused ? "" : void 0,
|
|
14609
14610
|
onClick: handleHeaderActivate,
|
|
14610
14611
|
children: [
|
|
14611
14612
|
label,
|
|
@@ -14705,11 +14706,12 @@ var AppPageSidebarWithNavigation = ({
|
|
|
14705
14706
|
footer,
|
|
14706
14707
|
navigationItems,
|
|
14707
14708
|
contentOverwrite,
|
|
14709
|
+
initialActiveId,
|
|
14708
14710
|
...props
|
|
14709
14711
|
}) => {
|
|
14710
14712
|
return /* @__PURE__ */ jsx43(AppSidebar, { ...props, children: /* @__PURE__ */ jsxs24("div", { className: "app-page-sidebar-with-navigation", children: [
|
|
14711
14713
|
header && /* @__PURE__ */ jsx43("div", { className: "app-page-sidebar-with-navigation-header", children: header }),
|
|
14712
|
-
navigationItems && !contentOverwrite && /* @__PURE__ */ jsx43("div", { className: "app-page-sidebar-with-navigation-scroll", children: /* @__PURE__ */ jsx43(VerticalNavigationTree, { items: navigationItems }) }),
|
|
14714
|
+
navigationItems && !contentOverwrite && /* @__PURE__ */ jsx43("div", { className: "app-page-sidebar-with-navigation-scroll", children: /* @__PURE__ */ jsx43(VerticalNavigationTree, { items: navigationItems, initialActiveId }) }),
|
|
14713
14715
|
contentOverwrite && /* @__PURE__ */ jsx43("div", { className: "app-page-sidebar-with-navigation-scroll", children: contentOverwrite }),
|
|
14714
14716
|
footer && /* @__PURE__ */ jsx43("div", { className: "app-page-sidebar-with-navigation-footer", children: footer })
|
|
14715
14717
|
] }) });
|
|
@@ -14718,20 +14720,38 @@ var AppPage = ({ children, headerActions, sidebarProps, ...props }) => {
|
|
|
14718
14720
|
const translation = useHightideTranslation();
|
|
14719
14721
|
const [isSidebarOpen, setIsSidebarOpen] = useState22(false);
|
|
14720
14722
|
const toNavigationItems = useCallback28((items) => {
|
|
14721
|
-
return items?.map((item) =>
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
item
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14723
|
+
return items?.map((item) => {
|
|
14724
|
+
const isActive = sidebarProps.activeUrl === item.url && !!sidebarProps.activeUrl || item.id === sidebarProps.initialActiveId;
|
|
14725
|
+
return {
|
|
14726
|
+
id: item.id,
|
|
14727
|
+
label: /* @__PURE__ */ jsxs24("span", { className: "app-page-navigation-item-label", "data-active-page": isActive ? "" : void 0, children: [
|
|
14728
|
+
item.icon && /* @__PURE__ */ jsx43("span", { className: "size-5", children: item.icon }),
|
|
14729
|
+
item.label
|
|
14730
|
+
] }),
|
|
14731
|
+
url: item.url,
|
|
14732
|
+
external: item.external,
|
|
14733
|
+
items: toNavigationItems(item.items)
|
|
14734
|
+
};
|
|
14735
|
+
}) ?? void 0;
|
|
14736
|
+
}, [sidebarProps.activeUrl, sidebarProps.initialActiveId]);
|
|
14732
14737
|
const navigationItems = useMemo22(() => toNavigationItems(
|
|
14733
14738
|
sidebarProps.items
|
|
14734
14739
|
), [sidebarProps.items, toNavigationItems]);
|
|
14740
|
+
const initialActiveId = useMemo22(() => {
|
|
14741
|
+
if (sidebarProps.initialActiveId) return sidebarProps.initialActiveId;
|
|
14742
|
+
if (!navigationItems) return void 0;
|
|
14743
|
+
const findActiveId = (items) => {
|
|
14744
|
+
for (const item of items) {
|
|
14745
|
+
if (item.url === sidebarProps.activeUrl) return item.id;
|
|
14746
|
+
if (item.items) {
|
|
14747
|
+
const found = findActiveId(item.items);
|
|
14748
|
+
if (found) return found;
|
|
14749
|
+
}
|
|
14750
|
+
}
|
|
14751
|
+
return void 0;
|
|
14752
|
+
};
|
|
14753
|
+
return findActiveId(navigationItems);
|
|
14754
|
+
}, [navigationItems, sidebarProps.activeUrl, sidebarProps.initialActiveId]);
|
|
14735
14755
|
return /* @__PURE__ */ jsxs24(
|
|
14736
14756
|
"div",
|
|
14737
14757
|
{
|
|
@@ -14747,7 +14767,8 @@ var AppPage = ({ children, headerActions, sidebarProps, ...props }) => {
|
|
|
14747
14767
|
header: sidebarProps.header,
|
|
14748
14768
|
footer: sidebarProps.footer,
|
|
14749
14769
|
navigationItems,
|
|
14750
|
-
contentOverwrite: sidebarProps.contentOverwrite
|
|
14770
|
+
contentOverwrite: sidebarProps.contentOverwrite,
|
|
14771
|
+
initialActiveId
|
|
14751
14772
|
}
|
|
14752
14773
|
),
|
|
14753
14774
|
/* @__PURE__ */ jsxs24("div", { "data-name": "app-page-content", children: [
|