@dloizides/ui-nav 1.38.0 → 1.39.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.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { ViewStyle, ImageSourcePropType, StyleProp } from 'react-native';
3
3
  import { UiTheme } from '@dloizides/ui-feedback';
4
4
  import { DropdownVariant } from '@dloizides/ui-layout';
@@ -498,9 +498,10 @@ interface BrandMarkProps {
498
498
  onNavigate: (route: string) => void;
499
499
  size?: number;
500
500
  iconOnly?: boolean;
501
+ mark?: ReactNode;
501
502
  }
502
- /** The app icon with its name, as a link to the app's home route. */
503
- declare const BrandMark: ({ source, name, route, label, onNavigate, size, iconOnly, }: BrandMarkProps) => React.ReactElement;
503
+ /** The app icon (or a caller-drawn `mark` in the same box) with its name, as a link to the app's home route. */
504
+ declare const BrandMark: ({ source, name, route, label, onNavigate, size, iconOnly, mark, }: BrandMarkProps) => React.ReactElement;
504
505
 
505
506
  /**
506
507
  * `Nav` — ONE component that renders EITHER the horizontal top bar (`NavBar`) or the
@@ -1169,6 +1170,7 @@ declare const NAV_TEST_IDS: {
1169
1170
  readonly topbarCenter: "topbar-center";
1170
1171
  readonly brandHome: "nav-brand-home";
1171
1172
  readonly brandMarkIcon: "nav-brand-mark-icon";
1173
+ readonly brandMarkSlot: "nav-brand-mark-slot";
1172
1174
  readonly brandMarkName: "nav-brand-mark-name";
1173
1175
  };
1174
1176
  /** Suffixes appended to an `AppShell`'s required `testID` to name its regions. */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { ViewStyle, ImageSourcePropType, StyleProp } from 'react-native';
3
3
  import { UiTheme } from '@dloizides/ui-feedback';
4
4
  import { DropdownVariant } from '@dloizides/ui-layout';
@@ -498,9 +498,10 @@ interface BrandMarkProps {
498
498
  onNavigate: (route: string) => void;
499
499
  size?: number;
500
500
  iconOnly?: boolean;
501
+ mark?: ReactNode;
501
502
  }
502
- /** The app icon with its name, as a link to the app's home route. */
503
- declare const BrandMark: ({ source, name, route, label, onNavigate, size, iconOnly, }: BrandMarkProps) => React.ReactElement;
503
+ /** The app icon (or a caller-drawn `mark` in the same box) with its name, as a link to the app's home route. */
504
+ declare const BrandMark: ({ source, name, route, label, onNavigate, size, iconOnly, mark, }: BrandMarkProps) => React.ReactElement;
504
505
 
505
506
  /**
506
507
  * `Nav` — ONE component that renders EITHER the horizontal top bar (`NavBar`) or the
@@ -1169,6 +1170,7 @@ declare const NAV_TEST_IDS: {
1169
1170
  readonly topbarCenter: "topbar-center";
1170
1171
  readonly brandHome: "nav-brand-home";
1171
1172
  readonly brandMarkIcon: "nav-brand-mark-icon";
1173
+ readonly brandMarkSlot: "nav-brand-mark-slot";
1172
1174
  readonly brandMarkName: "nav-brand-mark-name";
1173
1175
  };
1174
1176
  /** Suffixes appended to an `AppShell`'s required `testID` to name its regions. */
package/dist/index.js CHANGED
@@ -986,6 +986,7 @@ var NAV_TEST_IDS = {
986
986
  topbarCenter: "topbar-center",
987
987
  brandHome: "nav-brand-home",
988
988
  brandMarkIcon: "nav-brand-mark-icon",
989
+ brandMarkSlot: "nav-brand-mark-slot",
989
990
  brandMarkName: "nav-brand-mark-name"
990
991
  };
991
992
  var APP_SHELL_SUFFIX = {
@@ -1726,19 +1727,21 @@ var BrandMark = ({
1726
1727
  label,
1727
1728
  onNavigate,
1728
1729
  size = DEFAULT_ICON_SIZE,
1729
- iconOnly = false
1730
+ iconOnly = false,
1731
+ mark
1730
1732
  }) => {
1731
1733
  const { theme } = uiFeedback.useUi();
1734
+ const box = { height: size, width: size };
1732
1735
  return /* @__PURE__ */ jsxRuntime.jsx(BrandHomeLink, { label, route, onNavigate, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles5.row, children: [
1733
- /* @__PURE__ */ jsxRuntime.jsx(
1736
+ mark === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1734
1737
  reactNative.Image,
1735
1738
  {
1736
1739
  accessibilityElementsHidden: true,
1737
1740
  source,
1738
- style: { height: size, width: size },
1741
+ style: box,
1739
1742
  testID: NAV_TEST_IDS.brandMarkIcon
1740
1743
  }
1741
- ),
1744
+ ) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityElementsHidden: true, style: box, testID: NAV_TEST_IDS.brandMarkSlot, children: mark }),
1742
1745
  iconOnly ? null : /* @__PURE__ */ jsxRuntime.jsx(
1743
1746
  reactNative.Text,
1744
1747
  {
@@ -1914,7 +1917,7 @@ var styles9 = reactNative.StyleSheet.create({
1914
1917
  // so on react-native-web it — and the nav leaves inside it — sit above the scrim
1915
1918
  // and receive presses instead of the scrim swallowing them.
1916
1919
  panel: { position: "absolute", top: 0, bottom: 0, left: 0, width: DRAWER_WIDTH, zIndex: PANEL_Z_INDEX },
1917
- panelFull: { width: "100%" },
1920
+ windowFill: { right: void 0, bottom: void 0 },
1918
1921
  panelBody: { flex: 1 },
1919
1922
  menuToggle: {
1920
1923
  minWidth: MIN_TOUCH_TARGET,
@@ -1952,6 +1955,8 @@ var MobileDrawer = ({
1952
1955
  const { theme } = uiFeedback.useUi();
1953
1956
  const panelRef = React.useRef(null);
1954
1957
  const isFull = width === "full";
1958
+ const viewport = reactNative.useWindowDimensions();
1959
+ const windowSize = isFull ? [styles9.windowFill, { width: viewport.width, height: viewport.height }] : null;
1955
1960
  const showHeaderBar = header !== void 0 || isFull;
1956
1961
  React.useEffect(() => {
1957
1962
  const node = panelRef.current;
@@ -1966,7 +1971,7 @@ var MobileDrawer = ({
1966
1971
  node.addEventListener("click", handleClick);
1967
1972
  return () => node.removeEventListener("click", handleClick);
1968
1973
  }, [onClose]);
1969
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles9.overlay, children: [
1974
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles9.overlay, windowSize], children: [
1970
1975
  isFull ? null : /* @__PURE__ */ jsxRuntime.jsx(
1971
1976
  reactNative.Pressable,
1972
1977
  {
@@ -1984,7 +1989,7 @@ var MobileDrawer = ({
1984
1989
  ref: panelRef,
1985
1990
  "aria-modal": true,
1986
1991
  role: "dialog",
1987
- style: [styles9.panel, isFull ? styles9.panelFull : null, { backgroundColor: theme.colors.surface }],
1992
+ style: [styles9.panel, windowSize, { backgroundColor: theme.colors.surface }],
1988
1993
  testID: drawerTestID,
1989
1994
  children: [
1990
1995
  showHeaderBar ? /* @__PURE__ */ jsxRuntime.jsx(