@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.d.mts
CHANGED
|
@@ -899,18 +899,20 @@ interface AppPageSidebarWithNavigationProps extends AppSidebarProps {
|
|
|
899
899
|
footer?: ReactNode;
|
|
900
900
|
navigationItems?: NavigationItemData[];
|
|
901
901
|
contentOverwrite?: ReactNode;
|
|
902
|
+
initialActiveId?: string;
|
|
902
903
|
}
|
|
903
|
-
declare const AppPageSidebarWithNavigation: ({ header, footer, navigationItems, contentOverwrite, ...props }: AppPageSidebarWithNavigationProps) => react_jsx_runtime.JSX.Element;
|
|
904
|
+
declare const AppPageSidebarWithNavigation: ({ header, footer, navigationItems, contentOverwrite, initialActiveId, ...props }: AppPageSidebarWithNavigationProps) => react_jsx_runtime.JSX.Element;
|
|
904
905
|
interface AppPageNavigationItem {
|
|
905
906
|
id: string;
|
|
906
907
|
label: ReactNode;
|
|
907
908
|
icon?: ReactNode;
|
|
908
|
-
isActive?: boolean;
|
|
909
909
|
url?: string;
|
|
910
910
|
external?: boolean;
|
|
911
911
|
items?: AppPageNavigationItem[];
|
|
912
912
|
}
|
|
913
913
|
interface AppPageSidebarProps {
|
|
914
|
+
activeUrl?: string;
|
|
915
|
+
initialActiveId?: string;
|
|
914
916
|
header?: ReactNode;
|
|
915
917
|
items?: AppPageNavigationItem[];
|
|
916
918
|
contentOverwrite?: ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -899,18 +899,20 @@ interface AppPageSidebarWithNavigationProps extends AppSidebarProps {
|
|
|
899
899
|
footer?: ReactNode;
|
|
900
900
|
navigationItems?: NavigationItemData[];
|
|
901
901
|
contentOverwrite?: ReactNode;
|
|
902
|
+
initialActiveId?: string;
|
|
902
903
|
}
|
|
903
|
-
declare const AppPageSidebarWithNavigation: ({ header, footer, navigationItems, contentOverwrite, ...props }: AppPageSidebarWithNavigationProps) => react_jsx_runtime.JSX.Element;
|
|
904
|
+
declare const AppPageSidebarWithNavigation: ({ header, footer, navigationItems, contentOverwrite, initialActiveId, ...props }: AppPageSidebarWithNavigationProps) => react_jsx_runtime.JSX.Element;
|
|
904
905
|
interface AppPageNavigationItem {
|
|
905
906
|
id: string;
|
|
906
907
|
label: ReactNode;
|
|
907
908
|
icon?: ReactNode;
|
|
908
|
-
isActive?: boolean;
|
|
909
909
|
url?: string;
|
|
910
910
|
external?: boolean;
|
|
911
911
|
items?: AppPageNavigationItem[];
|
|
912
912
|
}
|
|
913
913
|
interface AppPageSidebarProps {
|
|
914
|
+
activeUrl?: string;
|
|
915
|
+
initialActiveId?: string;
|
|
914
916
|
header?: ReactNode;
|
|
915
917
|
items?: AppPageNavigationItem[];
|
|
916
918
|
contentOverwrite?: ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -14853,7 +14853,7 @@ function VerticalNavigationItem({
|
|
|
14853
14853
|
tabIndex: -1,
|
|
14854
14854
|
children: [
|
|
14855
14855
|
label,
|
|
14856
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react9.ExternalLink, { className: "
|
|
14856
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react9.ExternalLink, { className: "vertical-navigation-item-link-external-icon" })
|
|
14857
14857
|
]
|
|
14858
14858
|
}
|
|
14859
14859
|
) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
@@ -14873,11 +14873,12 @@ function VerticalNavigationItem({
|
|
|
14873
14873
|
role: "treeitem",
|
|
14874
14874
|
"data-name": "vertical-navigation-item",
|
|
14875
14875
|
"data-depth": depth,
|
|
14876
|
-
"data-
|
|
14876
|
+
"data-focused": isFocused ? "" : void 0,
|
|
14877
14877
|
"aria-selected": isFocused ? true : void 0,
|
|
14878
14878
|
tabIndex: isFocused ? 0 : -1,
|
|
14879
14879
|
onKeyDown: handleKeyDown,
|
|
14880
14880
|
onClick: handleLeafActivate,
|
|
14881
|
+
className: "group/tree-leaf",
|
|
14881
14882
|
children: labelContent
|
|
14882
14883
|
}
|
|
14883
14884
|
);
|
|
@@ -14889,7 +14890,7 @@ function VerticalNavigationItem({
|
|
|
14889
14890
|
role: "treeitem",
|
|
14890
14891
|
"data-name": "vertical-navigation-node",
|
|
14891
14892
|
"data-depth": depth,
|
|
14892
|
-
"data-
|
|
14893
|
+
"data-focused": isFocused ? "" : void 0,
|
|
14893
14894
|
"data-expanded": expanded ? "" : void 0,
|
|
14894
14895
|
"aria-expanded": expanded,
|
|
14895
14896
|
tabIndex: isFocused ? 0 : -1,
|
|
@@ -14901,7 +14902,7 @@ function VerticalNavigationItem({
|
|
|
14901
14902
|
{
|
|
14902
14903
|
ref: headerRef,
|
|
14903
14904
|
"data-name": "vertical-navigation-node-header",
|
|
14904
|
-
"data-
|
|
14905
|
+
"data-focused": isFocused ? "" : void 0,
|
|
14905
14906
|
onClick: handleHeaderActivate,
|
|
14906
14907
|
children: [
|
|
14907
14908
|
label,
|
|
@@ -15001,11 +15002,12 @@ var AppPageSidebarWithNavigation = ({
|
|
|
15001
15002
|
footer,
|
|
15002
15003
|
navigationItems,
|
|
15003
15004
|
contentOverwrite,
|
|
15005
|
+
initialActiveId,
|
|
15004
15006
|
...props
|
|
15005
15007
|
}) => {
|
|
15006
15008
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppSidebar, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "app-page-sidebar-with-navigation", children: [
|
|
15007
15009
|
header && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-header", children: header }),
|
|
15008
|
-
navigationItems && !contentOverwrite && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(VerticalNavigationTree, { items: navigationItems }) }),
|
|
15010
|
+
navigationItems && !contentOverwrite && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(VerticalNavigationTree, { items: navigationItems, initialActiveId }) }),
|
|
15009
15011
|
contentOverwrite && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-scroll", children: contentOverwrite }),
|
|
15010
15012
|
footer && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-footer", children: footer })
|
|
15011
15013
|
] }) });
|
|
@@ -15014,20 +15016,38 @@ var AppPage = ({ children, headerActions, sidebarProps, ...props }) => {
|
|
|
15014
15016
|
const translation = useHightideTranslation();
|
|
15015
15017
|
const [isSidebarOpen, setIsSidebarOpen] = (0, import_react60.useState)(false);
|
|
15016
15018
|
const toNavigationItems = (0, import_react60.useCallback)((items) => {
|
|
15017
|
-
return items?.map((item) =>
|
|
15018
|
-
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
item
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15027
|
-
|
|
15019
|
+
return items?.map((item) => {
|
|
15020
|
+
const isActive = sidebarProps.activeUrl === item.url && !!sidebarProps.activeUrl || item.id === sidebarProps.initialActiveId;
|
|
15021
|
+
return {
|
|
15022
|
+
id: item.id,
|
|
15023
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "app-page-navigation-item-label", "data-active-page": isActive ? "" : void 0, children: [
|
|
15024
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "size-5", children: item.icon }),
|
|
15025
|
+
item.label
|
|
15026
|
+
] }),
|
|
15027
|
+
url: item.url,
|
|
15028
|
+
external: item.external,
|
|
15029
|
+
items: toNavigationItems(item.items)
|
|
15030
|
+
};
|
|
15031
|
+
}) ?? void 0;
|
|
15032
|
+
}, [sidebarProps.activeUrl, sidebarProps.initialActiveId]);
|
|
15028
15033
|
const navigationItems = (0, import_react60.useMemo)(() => toNavigationItems(
|
|
15029
15034
|
sidebarProps.items
|
|
15030
15035
|
), [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]);
|
|
15031
15051
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
15032
15052
|
"div",
|
|
15033
15053
|
{
|
|
@@ -15043,7 +15063,8 @@ var AppPage = ({ children, headerActions, sidebarProps, ...props }) => {
|
|
|
15043
15063
|
header: sidebarProps.header,
|
|
15044
15064
|
footer: sidebarProps.footer,
|
|
15045
15065
|
navigationItems,
|
|
15046
|
-
contentOverwrite: sidebarProps.contentOverwrite
|
|
15066
|
+
contentOverwrite: sidebarProps.contentOverwrite,
|
|
15067
|
+
initialActiveId
|
|
15047
15068
|
}
|
|
15048
15069
|
),
|
|
15049
15070
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { "data-name": "app-page-content", children: [
|