@dloizides/ui-nav 1.8.0 → 1.9.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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.0
4
+
5
+ **`NavBar.contentMaxWidth` — a full-bleed bar with a centred content column.**
6
+ An optional content-column cap (px), forwarded via `NavShell.topBar.contentMaxWidth`.
7
+ When set, the OUTER `NavBar` container — which carries the bar background + bottom
8
+ border (from `barTheme` / theme surface + any `containerStyle`, e.g. the AML
9
+ radial-glow appbar) — stays FULL WIDTH (full-bleed), while the INNER row (brand +
10
+ links + right) is capped to `contentMaxWidth` and centred. This restores the v1-console
11
+ `.ui-appbar` (full-bleed) + `.ui-appbar-inner { max-width; margin: 0 auto }` shape:
12
+ previously an app had to put the cap on the container's `containerStyle`, which also
13
+ capped the dark background and left light gutters on wide viewports. Omit it and the
14
+ inner spans the full container (unchanged — byte-identical to before). The priority+
15
+ overflow "…" fit measures the capped inner's rendered width, so it keeps working
16
+ against the content column, not the full-bleed container. Purely additive.
17
+
3
18
  ## 1.8.0
4
19
 
5
20
  The navigation shell becomes the ONE shell for every portal: a first-class
package/README.md CHANGED
@@ -126,6 +126,7 @@ import { NavShell, type NavItem } from '@dloizides/ui-nav';
126
126
  right: <><LanguageSwitcher /><UserChip /></>,
127
127
  overflowLabel: FM('menu.more'),
128
128
  barTheme: darkChromeTheme, // optional: dark bar over a light page
129
+ contentMaxWidth: 1180, // optional: full-bleed bar, inner capped + centred
129
130
  }}
130
131
  sideRail={{
131
132
  items: sectionItems, // side sections (leaf + expandable)
@@ -169,6 +170,19 @@ are re-passed so labels keep localizing; every colour still flows through the th
169
170
  (style-only). Custom appbar backgrounds (e.g. a radial-glow gradient) stay
170
171
  expressible via `containerStyle`.
171
172
 
173
+ ### Full-bleed bar with a centred content column (`NavBar.contentMaxWidth`)
174
+
175
+ Pass `contentMaxWidth` (px) — via `NavBar.contentMaxWidth` or
176
+ `NavShell.topBar.contentMaxWidth` — to make the bar **full-bleed** while its content
177
+ stays in a centred column. The OUTER container (which carries the bar background +
178
+ bottom border from `barTheme` / theme surface + any `containerStyle`, e.g. AML's
179
+ radial-glow appbar) spans the full viewport width; the INNER row (brand + links +
180
+ right) is capped to `contentMaxWidth` and centred — the v1-console `.ui-appbar`
181
+ (full-bleed) + `.ui-appbar-inner { max-width; margin: 0 auto }` shape. Omit it and
182
+ the inner spans the full container (unchanged). The priority+ overflow "…" fit
183
+ measures the capped inner's rendered width, so it keeps working against the content
184
+ column, not the full-bleed container.
185
+
172
186
  ### Cross-navigation pills (`PillNav`)
173
187
 
174
188
  A row of fully-rounded pills from a `NavItem[]` — kefi's coral dashboard switcher.
package/dist/index.d.mts CHANGED
@@ -210,6 +210,16 @@ interface NavBarProps {
210
210
  overflowHint?: string;
211
211
  /** Extra container style overrides. */
212
212
  containerStyle?: ViewStyle | ViewStyle[];
213
+ /**
214
+ * Optional content-column cap (px). When set, the OUTER container — which carries
215
+ * the background + bottom border (`barTheme`/theme surface + any `containerStyle`,
216
+ * e.g. the AML radial-glow appbar) — stays FULL WIDTH (full-bleed), while the INNER
217
+ * row (brand + links + right) is capped to this width and centred. Omit for the
218
+ * default where the inner spans the full container. The priority+ overflow "…" fit
219
+ * measures the (now capped) inner's rendered width via `onLayout`, so it keeps
220
+ * working against the capped column, not the full-bleed container.
221
+ */
222
+ contentMaxWidth?: number;
213
223
  /**
214
224
  * Optional CHROME theme override — re-provisions the `@dloizides/ui-feedback`
215
225
  * theme for the bar ONLY, so the top bar can be dark while the page below keeps
@@ -508,6 +518,13 @@ interface NavShellTopBar {
508
518
  * `ViewStyle`, the AML radial-glow appbar). Style-only.
509
519
  */
510
520
  containerStyle?: ViewStyle | ViewStyle[];
521
+ /**
522
+ * Optional content-column cap (px) for the top bar. When set, the bar's
523
+ * background + bottom border (from `containerStyle` / `barTheme`) stay FULL WIDTH
524
+ * (full-bleed) while the inner brand + links + right row is capped to this width
525
+ * and centred — the AML v1-console appbar shape. Forwarded to `NavBar.contentMaxWidth`.
526
+ */
527
+ contentMaxWidth?: number;
511
528
  /**
512
529
  * Optional CHROME theme override for the top bar only (dark bar over a light
513
530
  * page). Forwarded to `NavBar.barTheme`. Style-only — see `NavBar`.
package/dist/index.d.ts CHANGED
@@ -210,6 +210,16 @@ interface NavBarProps {
210
210
  overflowHint?: string;
211
211
  /** Extra container style overrides. */
212
212
  containerStyle?: ViewStyle | ViewStyle[];
213
+ /**
214
+ * Optional content-column cap (px). When set, the OUTER container — which carries
215
+ * the background + bottom border (`barTheme`/theme surface + any `containerStyle`,
216
+ * e.g. the AML radial-glow appbar) — stays FULL WIDTH (full-bleed), while the INNER
217
+ * row (brand + links + right) is capped to this width and centred. Omit for the
218
+ * default where the inner spans the full container. The priority+ overflow "…" fit
219
+ * measures the (now capped) inner's rendered width via `onLayout`, so it keeps
220
+ * working against the capped column, not the full-bleed container.
221
+ */
222
+ contentMaxWidth?: number;
213
223
  /**
214
224
  * Optional CHROME theme override — re-provisions the `@dloizides/ui-feedback`
215
225
  * theme for the bar ONLY, so the top bar can be dark while the page below keeps
@@ -508,6 +518,13 @@ interface NavShellTopBar {
508
518
  * `ViewStyle`, the AML radial-glow appbar). Style-only.
509
519
  */
510
520
  containerStyle?: ViewStyle | ViewStyle[];
521
+ /**
522
+ * Optional content-column cap (px) for the top bar. When set, the bar's
523
+ * background + bottom border (from `containerStyle` / `barTheme`) stay FULL WIDTH
524
+ * (full-bleed) while the inner brand + links + right row is capped to this width
525
+ * and centred — the AML v1-console appbar shape. Forwarded to `NavBar.contentMaxWidth`.
526
+ */
527
+ contentMaxWidth?: number;
511
528
  /**
512
529
  * Optional CHROME theme override for the top bar only (dark bar over a light
513
530
  * page). Forwarded to `NavBar.barTheme`. Style-only — see `NavBar`.
package/dist/index.js CHANGED
@@ -806,7 +806,8 @@ var NavBarInner = ({
806
806
  collapseBelow = DEFAULT_COLLAPSE_BELOW,
807
807
  overflowLabel = "More",
808
808
  overflowHint = "",
809
- containerStyle
809
+ containerStyle,
810
+ contentMaxWidth
810
811
  }) => {
811
812
  const { theme } = uiFeedback.useUi();
812
813
  const colors = theme.colors;
@@ -818,6 +819,10 @@ var NavBarInner = ({
818
819
  const { visibleCount, setAvailableWidth, setItemWidth, setMoreWidth } = useNavOverflow(items.length, NAV_LINK_GAP);
819
820
  const collapsed = width < collapseBelow;
820
821
  const showLinks = !collapsed || open;
822
+ const innerCapStyle = React5.useMemo(
823
+ () => contentMaxWidth === void 0 ? null : { maxWidth: contentMaxWidth, width: "100%", alignSelf: "center" },
824
+ [contentMaxWidth]
825
+ );
821
826
  const toggleMenu = React5.useCallback(() => setOpen((v) => !v), []);
822
827
  const handlePress = React5.useCallback(
823
828
  (route) => {
@@ -847,7 +852,7 @@ var NavBarInner = ({
847
852
  { backgroundColor: colors.surface, borderBottomColor: colors.border },
848
853
  containerStyle
849
854
  ],
850
- children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [navBarStyles.inner, collapsed ? null : navBarStyles.innerNoWrap], children: [
855
+ children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [navBarStyles.inner, collapsed ? null : navBarStyles.innerNoWrap, innerCapStyle], children: [
851
856
  brand !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: navBarStyles.brand, children: brand }) : null,
852
857
  collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
853
858
  reactNative.Pressable,
@@ -1265,6 +1270,7 @@ var NavShell = ({
1265
1270
  brand: topBar.brand,
1266
1271
  collapseBelow: topBar.collapseBelow,
1267
1272
  containerStyle: topBar.containerStyle,
1273
+ contentMaxWidth: topBar.contentMaxWidth,
1268
1274
  items: topBar.items,
1269
1275
  menuHint: topBar.menuHint,
1270
1276
  menuLabel: topBar.menuLabel,