@helpwave/hightide 0.12.4 → 0.12.6

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.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,
@@ -14435,6 +14436,22 @@ function buildTreeIndex(nodes) {
14435
14436
  roots: [...nodes]
14436
14437
  };
14437
14438
  }
14439
+ function resolveTreeNodePath(nodes, id) {
14440
+ if (id == null) return null;
14441
+ const entry = buildTreeIndex(nodes).byId.get(id);
14442
+ return entry?.path ?? null;
14443
+ }
14444
+ function flattenAllItems(nodes, expandedIds, path = []) {
14445
+ const result = [];
14446
+ for (const node of nodes) {
14447
+ const currentPath = [...path, node.id];
14448
+ const hasChildren = node.items.length > 0;
14449
+ const expanded = hasChildren && expandedIds.has(node.id);
14450
+ result.push({ id: node.id, path: currentPath, expanded });
14451
+ result.push(...flattenAllItems(node.items, expandedIds, currentPath));
14452
+ }
14453
+ return result;
14454
+ }
14438
14455
  function flattenVisibleItems(nodes, expandedIds, path = []) {
14439
14456
  const result = [];
14440
14457
  for (const node of nodes) {
@@ -14471,11 +14488,11 @@ function isAncestorOf(ancestorId, descendantPath) {
14471
14488
  const index = descendantPath.indexOf(ancestorId);
14472
14489
  return index >= 0 && index < descendantPath.length - 1;
14473
14490
  }
14474
- function pruneExpandedIds(expandedIds, activePath, onlyOneExpandedTree, index) {
14475
- if (!onlyOneExpandedTree || activePath == null) {
14491
+ function pruneExpandedIds(expandedIds, focusedPath, onlyOneExpandedTree, index) {
14492
+ if (!onlyOneExpandedTree || focusedPath == null) {
14476
14493
  return new Set(expandedIds);
14477
14494
  }
14478
- const pathSet = new Set(activePath);
14495
+ const pathSet = new Set(focusedPath);
14479
14496
  const pruned = /* @__PURE__ */ new Set();
14480
14497
  for (const id of expandedIds) {
14481
14498
  if (!pathSet.has(id)) continue;
@@ -14486,77 +14503,80 @@ function pruneExpandedIds(expandedIds, activePath, onlyOneExpandedTree, index) {
14486
14503
  }
14487
14504
  return pruned;
14488
14505
  }
14489
- function syncExpansionForActive(expandedIds, activePath, onlyOneExpandedTree, index) {
14506
+ function syncExpansionForFocused(expandedIds, focusedPath, onlyOneExpandedTree, index) {
14490
14507
  const next = new Set(expandedIds);
14491
- for (const id of getExpandableAncestorIds(activePath, index)) {
14508
+ for (const id of getExpandableAncestorIds(focusedPath, index)) {
14492
14509
  next.add(id);
14493
14510
  }
14494
- return pruneExpandedIds(next, activePath, onlyOneExpandedTree, index);
14511
+ return pruneExpandedIds(next, focusedPath, onlyOneExpandedTree, index);
14495
14512
  }
14496
14513
  function useTreeNavigation({
14497
14514
  nodes,
14498
- activeId: controlledActiveId,
14499
- onActiveIdChange,
14500
- initialActiveId,
14515
+ focusedId: controlledFocusedId,
14516
+ onFocusedIdChange,
14517
+ initialFocusedId,
14501
14518
  onlyOneExpandedTree = false
14502
14519
  }) {
14503
14520
  const index = (0, import_react57.useMemo)(() => buildTreeIndex(nodes), [nodes]);
14504
- const [activeId, setActiveId] = useControlledState({
14505
- value: controlledActiveId,
14506
- onValueChange: onActiveIdChange,
14507
- defaultValue: initialActiveId ?? null
14521
+ const [focusedId, setFocusedId] = useControlledState({
14522
+ value: controlledFocusedId,
14523
+ onValueChange: onFocusedIdChange,
14524
+ defaultValue: initialFocusedId ?? null
14508
14525
  });
14509
- const resolvedActiveId = (0, import_react57.useMemo)(() => {
14510
- if (activeId == null) return null;
14511
- if (index.byId.has(activeId)) return activeId;
14526
+ const resolvedFocusedId = (0, import_react57.useMemo)(() => {
14527
+ if (focusedId == null) return null;
14528
+ if (index.byId.has(focusedId)) return focusedId;
14512
14529
  return null;
14513
- }, [activeId, index]);
14530
+ }, [focusedId, index]);
14514
14531
  const [expandedIds, setExpandedIds] = (0, import_react57.useState)(() => /* @__PURE__ */ new Set());
14515
14532
  (0, import_react57.useEffect)(() => {
14516
- if (resolvedActiveId == null) return;
14517
- const entry = index.byId.get(resolvedActiveId);
14533
+ if (resolvedFocusedId == null) return;
14534
+ const entry = index.byId.get(resolvedFocusedId);
14518
14535
  if (entry == null) return;
14519
- setExpandedIds((prev) => syncExpansionForActive(prev, entry.path, onlyOneExpandedTree, index));
14520
- }, [resolvedActiveId, onlyOneExpandedTree, index]);
14521
- const items = (0, import_react57.useMemo)(() => {
14536
+ setExpandedIds((prev) => syncExpansionForFocused(prev, entry.path, onlyOneExpandedTree, index));
14537
+ }, [resolvedFocusedId, onlyOneExpandedTree, index]);
14538
+ const visibleItems = (0, import_react57.useMemo)(() => {
14522
14539
  return flattenVisibleItems(nodes, expandedIds);
14523
14540
  }, [nodes, expandedIds]);
14524
- const activeItem = (0, import_react57.useMemo)(() => {
14525
- if (resolvedActiveId == null) return null;
14526
- return items.find((item) => item.id === resolvedActiveId) ?? null;
14527
- }, [items, resolvedActiveId]);
14541
+ const allItems = (0, import_react57.useMemo)(() => {
14542
+ return flattenAllItems(nodes, expandedIds);
14543
+ }, [nodes, expandedIds]);
14544
+ const focusedItem = (0, import_react57.useMemo)(() => {
14545
+ if (resolvedFocusedId == null) return null;
14546
+ return allItems.find((item) => item.id === resolvedFocusedId) ?? null;
14547
+ }, [allItems, resolvedFocusedId]);
14528
14548
  const navigateTo = (0, import_react57.useCallback)((id) => {
14529
14549
  const entry = index.byId.get(id);
14530
14550
  if (entry == null) {
14531
14551
  console.warn(`Attempted to navigate to node ${id} that does not exist`);
14532
14552
  return;
14533
14553
  }
14534
- setActiveId(id);
14554
+ setFocusedId(id);
14535
14555
  setExpandedIds((prev) => {
14536
- const next2 = syncExpansionForActive(prev, entry.path, onlyOneExpandedTree, index);
14556
+ const next2 = syncExpansionForFocused(prev, entry.path, onlyOneExpandedTree, index);
14537
14557
  return next2;
14538
14558
  });
14539
- }, [index, onlyOneExpandedTree, setActiveId]);
14559
+ }, [index, onlyOneExpandedTree, setFocusedId]);
14540
14560
  const expand = (0, import_react57.useCallback)((id, options) => {
14541
14561
  const entry = index.byId.get(id);
14542
14562
  if (entry == null || entry.node.items.length === 0) return;
14543
14563
  if (options?.isFocusing) {
14544
- setActiveId(id);
14564
+ setFocusedId(id);
14545
14565
  }
14546
14566
  setExpandedIds((prev) => {
14547
14567
  const next2 = new Set(prev);
14548
14568
  next2.add(id);
14549
- const activePath = options?.isFocusing ? entry.path : resolvedActiveId != null ? index.byId.get(resolvedActiveId)?.path ?? null : null;
14550
- return pruneExpandedIds(next2, activePath, onlyOneExpandedTree, index);
14569
+ const focusedPath = options?.isFocusing ? entry.path : resolvedFocusedId != null ? index.byId.get(resolvedFocusedId)?.path ?? null : null;
14570
+ return pruneExpandedIds(next2, focusedPath, onlyOneExpandedTree, index);
14551
14571
  });
14552
- }, [index, onlyOneExpandedTree, resolvedActiveId, setActiveId]);
14572
+ }, [index, onlyOneExpandedTree, resolvedFocusedId, setFocusedId]);
14553
14573
  const collapse = (0, import_react57.useCallback)((id, options) => {
14554
- if (!options?.isFocusing && resolvedActiveId != null) {
14555
- const activeEntry = index.byId.get(resolvedActiveId);
14556
- if (activeEntry != null && isAncestorOf(id, activeEntry.path)) return;
14574
+ if (!options?.isFocusing && resolvedFocusedId != null) {
14575
+ const focusedEntry = index.byId.get(resolvedFocusedId);
14576
+ if (focusedEntry != null && isAncestorOf(id, focusedEntry.path)) return;
14557
14577
  }
14558
14578
  if (options?.isFocusing) {
14559
- setActiveId(id);
14579
+ setFocusedId(id);
14560
14580
  }
14561
14581
  const descendantIds = getDescendantIds(index, id);
14562
14582
  setExpandedIds((prev) => {
@@ -14567,12 +14587,12 @@ function useTreeNavigation({
14567
14587
  }
14568
14588
  return next2;
14569
14589
  });
14570
- }, [index, resolvedActiveId, setActiveId]);
14590
+ }, [index, resolvedFocusedId, setFocusedId]);
14571
14591
  const toggleExpansion = (0, import_react57.useCallback)((id, options) => {
14572
14592
  const entry = index.byId.get(id);
14573
14593
  if (entry == null || entry.node.items.length === 0) return;
14574
14594
  if (options?.isFocusing) {
14575
- setActiveId(id);
14595
+ setFocusedId(id);
14576
14596
  setExpandedIds((prev) => {
14577
14597
  if (prev.has(id)) {
14578
14598
  const next3 = new Set(prev);
@@ -14597,44 +14617,45 @@ function useTreeNavigation({
14597
14617
  } else {
14598
14618
  expand(id);
14599
14619
  }
14600
- }, [index, expandedIds, expand, collapse, onlyOneExpandedTree, setActiveId]);
14620
+ }, [index, expandedIds, expand, collapse, onlyOneExpandedTree, setFocusedId]);
14601
14621
  const next = (0, import_react57.useCallback)(() => {
14602
- if (items.length === 0) return;
14603
- if (resolvedActiveId == null) {
14604
- navigateTo(items[0].id);
14622
+ if (visibleItems.length === 0) return;
14623
+ if (resolvedFocusedId == null) {
14624
+ navigateTo(visibleItems[0].id);
14605
14625
  return;
14606
14626
  }
14607
- const currentIndex = items.findIndex((item) => item.id === resolvedActiveId);
14627
+ const currentIndex = visibleItems.findIndex((item) => item.id === resolvedFocusedId);
14608
14628
  const startIndex = currentIndex < 0 ? 0 : currentIndex;
14609
- if (startIndex < items.length - 1) {
14610
- navigateTo(items[startIndex + 1].id);
14629
+ if (startIndex < visibleItems.length - 1) {
14630
+ navigateTo(visibleItems[startIndex + 1].id);
14611
14631
  return;
14612
14632
  }
14613
- }, [items, resolvedActiveId, navigateTo]);
14633
+ }, [visibleItems, resolvedFocusedId, navigateTo]);
14614
14634
  const previous = (0, import_react57.useCallback)(() => {
14615
- if (items.length === 0) return;
14616
- if (resolvedActiveId == null) {
14617
- navigateTo(items[items.length - 1].id);
14635
+ if (visibleItems.length === 0) return;
14636
+ if (resolvedFocusedId == null) {
14637
+ navigateTo(visibleItems[visibleItems.length - 1].id);
14618
14638
  return;
14619
14639
  }
14620
- const currentIndex = items.findIndex((item) => item.id === resolvedActiveId);
14621
- const startIndex = currentIndex < 0 ? items.length - 1 : currentIndex;
14640
+ const currentIndex = visibleItems.findIndex((item) => item.id === resolvedFocusedId);
14641
+ const startIndex = currentIndex < 0 ? visibleItems.length - 1 : currentIndex;
14622
14642
  if (startIndex > 0) {
14623
- navigateTo(items[startIndex - 1].id);
14643
+ navigateTo(visibleItems[startIndex - 1].id);
14624
14644
  return;
14625
14645
  }
14626
- }, [items, resolvedActiveId, navigateTo]);
14646
+ }, [visibleItems, resolvedFocusedId, navigateTo]);
14627
14647
  const first = (0, import_react57.useCallback)(() => {
14628
- if (items.length === 0) return;
14629
- navigateTo(items[0].id);
14630
- }, [items, navigateTo]);
14648
+ if (visibleItems.length === 0) return;
14649
+ navigateTo(visibleItems[0].id);
14650
+ }, [visibleItems, navigateTo]);
14631
14651
  const last = (0, import_react57.useCallback)(() => {
14632
- if (items.length === 0) return;
14633
- navigateTo(items[items.length - 1].id);
14634
- }, [items, navigateTo]);
14652
+ if (visibleItems.length === 0) return;
14653
+ navigateTo(visibleItems[visibleItems.length - 1].id);
14654
+ }, [visibleItems, navigateTo]);
14635
14655
  return (0, import_react57.useMemo)(() => ({
14636
- items,
14637
- activeItem,
14656
+ visibleItems,
14657
+ allItems,
14658
+ focusedItem,
14638
14659
  navigateTo,
14639
14660
  expand,
14640
14661
  collapse,
@@ -14643,7 +14664,7 @@ function useTreeNavigation({
14643
14664
  previous,
14644
14665
  first,
14645
14666
  last
14646
- }), [items, activeItem, navigateTo, expand, collapse, toggleExpansion, next, previous, first, last]);
14667
+ }), [visibleItems, allItems, focusedItem, navigateTo, expand, collapse, toggleExpansion, next, previous, first, last]);
14647
14668
  }
14648
14669
 
14649
14670
  // src/components/layout/navigation/navigation-menus/NavigationContext.tsx
@@ -14651,22 +14672,41 @@ var import_jsx_runtime40 = require("react/jsx-runtime");
14651
14672
  var NavigationContext = (0, import_react58.createContext)(null);
14652
14673
  function NavigationProvider({
14653
14674
  children,
14654
- ...options
14675
+ activeId = null,
14676
+ ...treeOptions
14655
14677
  }) {
14656
- const navigation = useTreeNavigation(options);
14678
+ const navigation = useTreeNavigation({
14679
+ ...treeOptions,
14680
+ initialFocusedId: treeOptions.initialFocusedId ?? activeId ?? treeOptions.nodes[0]?.id ?? null
14681
+ });
14657
14682
  const itemRefs = (0, import_react58.useRef)(/* @__PURE__ */ new Map());
14658
- const focusedId = navigation.activeItem?.id ?? navigation.items[0]?.id ?? null;
14683
+ const [hasNavigatedToActiveId, setHasNavigatedToActiveId] = (0, import_react58.useState)(false);
14684
+ (0, import_react58.useEffect)(() => {
14685
+ if (activeId == null || hasNavigatedToActiveId) return;
14686
+ const navigationItem = navigation.allItems.find((item) => item.id === activeId);
14687
+ if (navigationItem == null) return;
14688
+ navigation.navigateTo(activeId);
14689
+ setHasNavigatedToActiveId(true);
14690
+ }, [activeId, navigation, navigation.navigateTo, navigation.allItems, hasNavigatedToActiveId]);
14691
+ const focusedId = (0, import_react58.useMemo)(() => {
14692
+ return navigation.focusedItem?.id ?? navigation.visibleItems[0]?.id ?? null;
14693
+ }, [navigation.focusedItem, navigation.visibleItems]);
14694
+ const activePath = (0, import_react58.useMemo)(() => {
14695
+ return resolveTreeNodePath(treeOptions.nodes, activeId);
14696
+ }, [treeOptions.nodes, activeId]);
14659
14697
  const itemStateById = (0, import_react58.useMemo)(() => {
14660
14698
  const map = /* @__PURE__ */ new Map();
14661
- for (const item of navigation.items) {
14699
+ for (const item of navigation.allItems) {
14662
14700
  map.set(item.id, {
14663
14701
  expanded: item.expanded,
14664
14702
  isFocused: focusedId === item.id,
14703
+ isActive: activeId === item.id,
14704
+ isOnActivePath: activePath?.includes(item.id) ?? false,
14665
14705
  path: item.path
14666
14706
  });
14667
14707
  }
14668
14708
  return map;
14669
- }, [navigation.items, focusedId]);
14709
+ }, [navigation.allItems, focusedId, activeId, activePath]);
14670
14710
  const getItemState = (0, import_react58.useCallback)((id) => {
14671
14711
  return itemStateById.get(id) ?? null;
14672
14712
  }, [itemStateById]);
@@ -14682,9 +14722,12 @@ function NavigationProvider({
14682
14722
  itemRefs.current.get(focusedId)?.focus();
14683
14723
  }, [focusedId]);
14684
14724
  const value = (0, import_react58.useMemo)(() => ({
14685
- activeItem: navigation.activeItem,
14725
+ focusedItem: navigation.focusedItem,
14686
14726
  focusedId,
14687
- items: navigation.items,
14727
+ activeId,
14728
+ activePath,
14729
+ visibleItems: navigation.visibleItems,
14730
+ allItems: navigation.allItems,
14688
14731
  getItemState,
14689
14732
  navigateTo: navigation.navigateTo,
14690
14733
  expand: navigation.expand,
@@ -14696,8 +14739,9 @@ function NavigationProvider({
14696
14739
  toggleExpansion: navigation.toggleExpansion,
14697
14740
  registerItemRef
14698
14741
  }), [
14699
- navigation.activeItem,
14700
- navigation.items,
14742
+ navigation.focusedItem,
14743
+ navigation.visibleItems,
14744
+ navigation.allItems,
14701
14745
  navigation.navigateTo,
14702
14746
  navigation.expand,
14703
14747
  navigation.collapse,
@@ -14707,6 +14751,8 @@ function NavigationProvider({
14707
14751
  navigation.last,
14708
14752
  navigation.toggleExpansion,
14709
14753
  focusedId,
14754
+ activeId,
14755
+ activePath,
14710
14756
  getItemState,
14711
14757
  registerItemRef
14712
14758
  ]);
@@ -14853,7 +14899,7 @@ function VerticalNavigationItem({
14853
14899
  tabIndex: -1,
14854
14900
  children: [
14855
14901
  label,
14856
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react9.ExternalLink, { className: "size-force-5 text-description" })
14902
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_lucide_react9.ExternalLink, { className: "vertical-navigation-item-link-external-icon" })
14857
14903
  ]
14858
14904
  }
14859
14905
  ) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
@@ -14873,11 +14919,12 @@ function VerticalNavigationItem({
14873
14919
  role: "treeitem",
14874
14920
  "data-name": "vertical-navigation-item",
14875
14921
  "data-depth": depth,
14876
- "data-active": isFocused ? "" : void 0,
14922
+ "data-focused": isFocused ? "" : void 0,
14877
14923
  "aria-selected": isFocused ? true : void 0,
14878
14924
  tabIndex: isFocused ? 0 : -1,
14879
14925
  onKeyDown: handleKeyDown,
14880
14926
  onClick: handleLeafActivate,
14927
+ className: "group/tree-leaf",
14881
14928
  children: labelContent
14882
14929
  }
14883
14930
  );
@@ -14889,7 +14936,7 @@ function VerticalNavigationItem({
14889
14936
  role: "treeitem",
14890
14937
  "data-name": "vertical-navigation-node",
14891
14938
  "data-depth": depth,
14892
- "data-active": isFocused ? "" : void 0,
14939
+ "data-focused": isFocused ? "" : void 0,
14893
14940
  "data-expanded": expanded ? "" : void 0,
14894
14941
  "aria-expanded": expanded,
14895
14942
  tabIndex: isFocused ? 0 : -1,
@@ -14901,7 +14948,7 @@ function VerticalNavigationItem({
14901
14948
  {
14902
14949
  ref: headerRef,
14903
14950
  "data-name": "vertical-navigation-node-header",
14904
- "data-active": isFocused ? "" : void 0,
14951
+ "data-focused": isFocused ? "" : void 0,
14905
14952
  onClick: handleHeaderActivate,
14906
14953
  children: [
14907
14954
  label,
@@ -15001,30 +15048,61 @@ var AppPageSidebarWithNavigation = ({
15001
15048
  footer,
15002
15049
  navigationItems,
15003
15050
  contentOverwrite,
15051
+ initialFocusedId,
15052
+ focusedId,
15053
+ onFocusedIdChange,
15054
+ activeId,
15004
15055
  ...props
15005
15056
  }) => {
15006
15057
  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
15058
  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 }) }),
15059
+ navigationItems && !contentOverwrite && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
15060
+ VerticalNavigationTree,
15061
+ {
15062
+ items: navigationItems,
15063
+ initialFocusedId,
15064
+ focusedId,
15065
+ onFocusedIdChange,
15066
+ activeId
15067
+ }
15068
+ ) }),
15009
15069
  contentOverwrite && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-scroll", children: contentOverwrite }),
15010
15070
  footer && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "app-page-sidebar-with-navigation-footer", children: footer })
15011
15071
  ] }) });
15012
15072
  };
15073
+ function findActiveIdByUrl(items, activeUrl) {
15074
+ for (const item of items) {
15075
+ if (item.url === activeUrl) return item.id;
15076
+ if (item.items != null) {
15077
+ const found = findActiveIdByUrl(item.items, activeUrl);
15078
+ if (found != null) return found;
15079
+ }
15080
+ }
15081
+ return null;
15082
+ }
15013
15083
  var AppPage = ({ children, headerActions, sidebarProps, ...props }) => {
15014
15084
  const translation = useHightideTranslation();
15015
15085
  const [isSidebarOpen, setIsSidebarOpen] = (0, import_react60.useState)(false);
15086
+ const resolvedActiveId = (0, import_react60.useMemo)(() => {
15087
+ if (sidebarProps.activeId !== void 0) return sidebarProps.activeId;
15088
+ if (sidebarProps.activeUrl == null || sidebarProps.items == null) return null;
15089
+ return findActiveIdByUrl(sidebarProps.items, sidebarProps.activeUrl);
15090
+ }, [sidebarProps.activeId, sidebarProps.activeUrl, sidebarProps.items]);
15016
15091
  const toNavigationItems = (0, import_react60.useCallback)((items) => {
15017
- return items?.map((item) => ({
15018
- id: item.id,
15019
- label: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "app-page-navigation-item-label", "data-acitve": item.isActive ? "" : void 0, children: [
15020
- item.icon && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "size-5", children: item.icon }),
15021
- item.label
15022
- ] }),
15023
- url: item.url,
15024
- external: item.external,
15025
- items: toNavigationItems(item.items)
15026
- })) ?? void 0;
15027
- }, []);
15092
+ return items?.map((item) => {
15093
+ const isActive = item.id === resolvedActiveId;
15094
+ return {
15095
+ id: item.id,
15096
+ label: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("span", { className: "app-page-navigation-item-label", "data-active-page": isActive ? "" : void 0, children: [
15097
+ item.icon && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "size-5", children: item.icon }),
15098
+ item.label
15099
+ ] }),
15100
+ url: item.url,
15101
+ external: item.external,
15102
+ items: toNavigationItems(item.items)
15103
+ };
15104
+ }) ?? void 0;
15105
+ }, [resolvedActiveId]);
15028
15106
  const navigationItems = (0, import_react60.useMemo)(() => toNavigationItems(
15029
15107
  sidebarProps.items
15030
15108
  ), [sidebarProps.items, toNavigationItems]);
@@ -15043,7 +15121,11 @@ var AppPage = ({ children, headerActions, sidebarProps, ...props }) => {
15043
15121
  header: sidebarProps.header,
15044
15122
  footer: sidebarProps.footer,
15045
15123
  navigationItems,
15046
- contentOverwrite: sidebarProps.contentOverwrite
15124
+ contentOverwrite: sidebarProps.contentOverwrite,
15125
+ initialFocusedId: sidebarProps.initialFocusedId,
15126
+ focusedId: sidebarProps.focusedId,
15127
+ onFocusedIdChange: sidebarProps.onFocusedIdChange,
15128
+ activeId: resolvedActiveId
15047
15129
  }
15048
15130
  ),
15049
15131
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { "data-name": "app-page-content", children: [
@@ -15488,7 +15570,6 @@ var ThemeSelect = ({ ...props }) => {
15488
15570
  {
15489
15571
  value: theme,
15490
15572
  onEditComplete: (value) => {
15491
- console.log("onEditComplete", value);
15492
15573
  props.onEditComplete?.(value);
15493
15574
  setTheme(value);
15494
15575
  },
@@ -23798,7 +23879,6 @@ var useSwipeGesture = ({
23798
23879
  const listenTouch = inputMode === "touch" || inputMode === "both";
23799
23880
  const listenMouse = inputMode === "mouse" || inputMode === "both";
23800
23881
  const onGestureStart = (x, y, eventTarget) => {
23801
- console.log("onGestureStart", x, y);
23802
23882
  if (!isWithinStartRegion(x, y)) return;
23803
23883
  const scrollableParent = findScrollableParent(eventTarget);
23804
23884
  gestureEndRef.current = null;
@@ -23811,7 +23891,6 @@ var useSwipeGesture = ({
23811
23891
  isScrollingRef.current = !!scrollableParent;
23812
23892
  };
23813
23893
  const onGestureMove = (x, y, eventTarget) => {
23814
- console.log("onGestureMove", x, y);
23815
23894
  const scrollableParent = findScrollableParent(eventTarget);
23816
23895
  const currentScrollY = scrollableParent?.scrollTop ?? window.scrollY;
23817
23896
  gestureEndRef.current = {
@@ -24532,6 +24611,7 @@ var PromiseUtils = {
24532
24611
  processModelLibrary,
24533
24612
  range,
24534
24613
  resolveSetState,
24614
+ resolveTreeNodePath,
24535
24615
  segmentBounds,
24536
24616
  segmentPlaceholder,
24537
24617
  setDayPeriod,