@dloizides/ui-nav 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/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { StyleSheet, Platform, TouchableOpacity, View, Text, useWindowDimensions, ActivityIndicator, ScrollView, Pressable, TextInput } from 'react-native';
2
2
  import { useUi, UiProvider } from '@dloizides/ui-feedback';
3
3
  import React2, { useState, useCallback, useMemo, useEffect, useRef } from 'react';
4
+ import { Collapse } from '@dloizides/ui-motion';
4
5
  import { jsxs, jsx } from 'react/jsx-runtime';
5
6
  import { ModalDropdown } from '@dloizides/ui-layout';
6
7
  import { resolveAccessibleRoutes } from '@dloizides/auth-web';
@@ -407,7 +408,7 @@ var NavExpandableItem = ({
407
408
  ]
408
409
  }
409
410
  ),
410
- expanded ? /* @__PURE__ */ jsx(View, { style: expandableStyles.childrenContainer, children: item.children?.map((child) => /* @__PURE__ */ jsx(
411
+ /* @__PURE__ */ jsx(Collapse, { open: expanded, children: /* @__PURE__ */ jsx(View, { style: expandableStyles.childrenContainer, children: item.children?.map((child) => /* @__PURE__ */ jsx(
411
412
  NavExpandableItem,
412
413
  {
413
414
  collapseHint,
@@ -420,7 +421,7 @@ var NavExpandableItem = ({
420
421
  onNavigate
421
422
  },
422
423
  child.key
423
- )) }) : null
424
+ )) }) })
424
425
  ] });
425
426
  };
426
427
  function isBareText(node) {
@@ -1048,6 +1049,10 @@ var SCRIM_Z_INDEX = 1;
1048
1049
  var PANEL_Z_INDEX = 2;
1049
1050
  var NAV_ACTIVATABLE_SELECTOR = 'a, [role="button"], [role="link"]';
1050
1051
  var NAV_TOGGLE_SELECTOR = "[aria-expanded]";
1052
+ function deferClose(close) {
1053
+ if (typeof setTimeout === "function") setTimeout(close, 0);
1054
+ else close();
1055
+ }
1051
1056
  var DEFAULT_DRAWER_LABELS = {
1052
1057
  openLabel: "Menu",
1053
1058
  openHint: "Open the navigation menu",
@@ -1113,7 +1118,7 @@ var MobileDrawer = ({
1113
1118
  if (target === null) return;
1114
1119
  const activatable = target.closest(NAV_ACTIVATABLE_SELECTOR);
1115
1120
  const isToggle = activatable !== null && activatable.closest(NAV_TOGGLE_SELECTOR) !== null;
1116
- if (activatable !== null && !isToggle) onClose();
1121
+ if (activatable !== null && !isToggle) deferClose(onClose);
1117
1122
  };
1118
1123
  node.addEventListener("click", handleClick);
1119
1124
  return () => node.removeEventListener("click", handleClick);