@dloizides/ui-nav 1.25.0 → 1.26.1

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
@@ -3,7 +3,7 @@ import { StyleSheet, Platform, Pressable, Text, View, TextInput, useWindowDimens
3
3
  import { useUi, UiProvider } from '@dloizides/ui-feedback';
4
4
  import { jsxs, jsx } from 'react/jsx-runtime';
5
5
  import { Collapse } from '@dloizides/ui-motion';
6
- import { LAYOUT_COLLAPSE_BREAKPOINT, ModalDropdown } from '@dloizides/ui-layout';
6
+ import { LAYOUT_COLLAPSE_BREAKPOINT, ModalDropdown, DropdownVariant, SelectedMarker } from '@dloizides/ui-layout';
7
7
  import { Z_INDEX } from '@dloizides/design-tokens';
8
8
  import { resolveAccessibleRoutes } from '@dloizides/auth-web';
9
9
 
@@ -64,9 +64,9 @@ var navStyles = StyleSheet.create({
64
64
  alignItems: "center",
65
65
  justifyContent: "space-between"
66
66
  },
67
- topbarLeft: { flex: 1 },
67
+ topbarLeft: { flexGrow: 1, flexShrink: 0 },
68
68
  topbarCenter: { flexShrink: 1, minWidth: 0, flexDirection: "row", alignItems: "center", marginHorizontal: 8 },
69
- topbarRight: { flexDirection: "row", alignItems: "center" },
69
+ topbarRight: { flexDirection: "row", alignItems: "center", flexShrink: 1, minWidth: 0 },
70
70
  topbarRowItem: {
71
71
  marginHorizontal: 8,
72
72
  alignItems: "center",
@@ -75,14 +75,9 @@ var navStyles = StyleSheet.create({
75
75
  minWidth: MIN_TOUCH_TARGET
76
76
  },
77
77
  topbarLabel: { fontSize: 14 },
78
- userBlock: { marginHorizontal: 12, alignItems: "flex-end" },
79
- userName: { fontWeight: "600" },
80
- accountNameBtn: {
81
- minHeight: MIN_TOUCH_TARGET,
82
- minWidth: MIN_TOUCH_TARGET,
83
- justifyContent: "center",
84
- alignItems: "flex-end"
85
- },
78
+ userBlock: { marginHorizontal: 12, alignItems: "flex-end", flexShrink: 1, minWidth: 0 },
79
+ userName: { fontWeight: "600", maxWidth: "100%" },
80
+ accountNameBtn: { flexShrink: 1, maxWidth: "100%", minHeight: MIN_TOUCH_TARGET, minWidth: MIN_TOUCH_TARGET, justifyContent: "center", alignItems: "flex-end" },
86
81
  userEmail: { fontSize: 12 },
87
82
  accountBtn: {
88
83
  marginLeft: 8,
@@ -220,7 +215,8 @@ var pillNavStyles = StyleSheet.create({
220
215
  justifyContent: "center"
221
216
  },
222
217
  pillText: { fontSize: 14, fontWeight: "600" },
223
- menuTriggerText: { flexShrink: 1 }
218
+ menuTriggerText: { flexShrink: 1 },
219
+ pillOutline: { borderWidth: 2 }
224
220
  });
225
221
  var darkModeStyles = StyleSheet.create({
226
222
  // Segmented Light / Dark / System control.
@@ -994,9 +990,9 @@ var Topbar = ({
994
990
  style: navStyles.accountNameBtn,
995
991
  testID: richAccount.accountTestID ?? NAV_TEST_IDS.accountName,
996
992
  onPress: richAccount.onAccount,
997
- children: /* @__PURE__ */ jsx(Text, { style: [navStyles.userName, { color: colors.text }], children: richAccount.displayName })
993
+ children: /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [navStyles.userName, { color: colors.text }], children: richAccount.displayName })
998
994
  }
999
- ) : /* @__PURE__ */ jsx(Text, { style: [navStyles.userName, { color: colors.text }], testID: NAV_TEST_IDS.accountName, children: richAccount.displayName }),
995
+ ) : /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [navStyles.userName, { color: colors.text }], testID: NAV_TEST_IDS.accountName, children: richAccount.displayName }),
1000
996
  richAccount.tenantName !== void 0 ? /* @__PURE__ */ jsx(
1001
997
  Text,
1002
998
  {
@@ -1868,7 +1864,6 @@ function resolvePillMenuLabel(items, pathname, fallback) {
1868
1864
  const active = items.find((item) => item.route === activeRoute);
1869
1865
  return active?.label ?? fallback;
1870
1866
  }
1871
- var TEXT_ON_PRIMARY4 = "#ffffff";
1872
1867
  var NO_ACTIVE_ROUTE2 = "";
1873
1868
  var PILL_MENU_MIN_WIDTH = 200;
1874
1869
  var PillNavMenu = ({
@@ -1882,7 +1877,7 @@ var PillNavMenu = ({
1882
1877
  menuHeading
1883
1878
  }) => {
1884
1879
  const { theme } = useUi();
1885
- const primaryColor = theme.palette.primary["500"];
1880
+ const { colors } = theme;
1886
1881
  const options = useMemo(() => items.map((item) => ({ label: item.label, value: item.route })), [items]);
1887
1882
  const activeRoute = resolveActiveRoute(items, pathname) ?? NO_ACTIVE_ROUTE2;
1888
1883
  const label = resolvePillMenuLabel(items, pathname, regionLabel);
@@ -1901,11 +1896,12 @@ var PillNavMenu = ({
1901
1896
  options,
1902
1897
  testID,
1903
1898
  value: activeRoute,
1904
- variant: dropdownVariant,
1899
+ selectedMarker: SelectedMarker.AccentCheck,
1900
+ variant: dropdownVariant ?? DropdownVariant.Menu,
1905
1901
  onChange: onNavigate,
1906
- renderTrigger: ({ isOpen }) => /* @__PURE__ */ jsxs(View, { style: [pillNavStyles.pill, { backgroundColor: primaryColor }], children: [
1907
- /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [pillNavStyles.pillText, pillNavStyles.menuTriggerText, { color: TEXT_ON_PRIMARY4 }], children: label }),
1908
- /* @__PURE__ */ jsx(Text, { style: [pillNavStyles.pillText, { color: TEXT_ON_PRIMARY4 }], children: isOpen ? "\u25B4" : "\u25BE" })
1902
+ renderTrigger: ({ isOpen }) => /* @__PURE__ */ jsxs(View, { style: [pillNavStyles.pill, pillNavStyles.pillOutline, { backgroundColor: colors.background, borderColor: colors.text }], children: [
1903
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [pillNavStyles.pillText, pillNavStyles.menuTriggerText, { color: colors.text }], children: label }),
1904
+ /* @__PURE__ */ jsx(Text, { style: [pillNavStyles.pillText, { color: colors.text }], children: isOpen ? "\u25B4" : "\u25BE" })
1909
1905
  ] })
1910
1906
  }
1911
1907
  );
@@ -1917,7 +1913,7 @@ var PillNavVariant = /* @__PURE__ */ ((PillNavVariant2) => {
1917
1913
  PillNavVariant2["Menu"] = "menu";
1918
1914
  return PillNavVariant2;
1919
1915
  })(PillNavVariant || {});
1920
- var TEXT_ON_PRIMARY5 = "#ffffff";
1916
+ var TEXT_ON_PRIMARY4 = "#ffffff";
1921
1917
  var DEFAULT_MIN_ITEMS = 1;
1922
1918
  var PillNav = ({
1923
1919
  items,
@@ -1961,7 +1957,7 @@ var PillNav = ({
1961
1957
  style: [pillNavStyles.container, containerStyle],
1962
1958
  children: items.map((item) => {
1963
1959
  const active = item.route === activeRoute;
1964
- const textColor = active ? TEXT_ON_PRIMARY5 : colors.textSecondary;
1960
+ const textColor = active ? TEXT_ON_PRIMARY4 : colors.textSecondary;
1965
1961
  const pillStyle = active ? { backgroundColor: primaryColor } : { backgroundColor: colors.surfaceElevated };
1966
1962
  return /* @__PURE__ */ jsxs(
1967
1963
  FocusableTouchable,
@@ -1984,7 +1980,7 @@ var PillNav = ({
1984
1980
  }
1985
1981
  );
1986
1982
  };
1987
- var TEXT_ON_PRIMARY6 = "#ffffff";
1983
+ var TEXT_ON_PRIMARY5 = "#ffffff";
1988
1984
  var DARK_MODE_ICON_SIZE = 16;
1989
1985
  var DarkModeControl = ({
1990
1986
  value,
@@ -2033,7 +2029,7 @@ var DarkModeControl = ({
2033
2029
  style: [darkModeStyles.segmentRow, { borderColor: colors.border }, containerStyle],
2034
2030
  children: options.map((option) => {
2035
2031
  const active = option.value === value;
2036
- const textColor = active ? TEXT_ON_PRIMARY6 : colors.textSecondary;
2032
+ const textColor = active ? TEXT_ON_PRIMARY5 : colors.textSecondary;
2037
2033
  return /* @__PURE__ */ jsxs(
2038
2034
  FocusableTouchable,
2039
2035
  {