@dloizides/ui-nav 1.37.0 → 1.38.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 +4 -0
- package/README.md +5 -5
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +13 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -839,8 +839,8 @@ var SIDEBAR_WIDTH_PX = {
|
|
|
839
839
|
lg: 288
|
|
840
840
|
};
|
|
841
841
|
var NAV_BRAND_DEFAULTS = {
|
|
842
|
-
|
|
843
|
-
|
|
842
|
+
placement: "sidebar",
|
|
843
|
+
railWidth: "default",
|
|
844
844
|
drawerHeader: "none",
|
|
845
845
|
drawerWidth: "default"
|
|
846
846
|
};
|
|
@@ -861,7 +861,6 @@ var Sidebar = ({
|
|
|
861
861
|
pathname,
|
|
862
862
|
onNavigate,
|
|
863
863
|
title,
|
|
864
|
-
width: railWidth = "default",
|
|
865
864
|
regionLabel,
|
|
866
865
|
navigateHint = (label) => label,
|
|
867
866
|
expandHint = "",
|
|
@@ -909,7 +908,7 @@ var Sidebar = ({
|
|
|
909
908
|
role: "navigation",
|
|
910
909
|
style: [
|
|
911
910
|
navStyles.sidebarContainer,
|
|
912
|
-
{ width: SIDEBAR_WIDTH_PX
|
|
911
|
+
{ width: SIDEBAR_WIDTH_PX.default },
|
|
913
912
|
{ backgroundColor: colors.surface, borderRightColor: colors.border },
|
|
914
913
|
containerStyle
|
|
915
914
|
],
|
|
@@ -2188,7 +2187,7 @@ function renderShellSidebar({ sideRail, nav, width, showBrand }) {
|
|
|
2188
2187
|
Sidebar,
|
|
2189
2188
|
{
|
|
2190
2189
|
collapseHint: sideRail.collapseHint,
|
|
2191
|
-
containerStyle: sideRail.containerStyle,
|
|
2190
|
+
containerStyle: { width: SIDEBAR_WIDTH_PX[width], ...StyleSheet.flatten(sideRail.containerStyle) },
|
|
2192
2191
|
enableInlineSearch: sideRail.enableInlineSearch,
|
|
2193
2192
|
expandHint: sideRail.expandHint,
|
|
2194
2193
|
footer: sideRail.footer,
|
|
@@ -2202,7 +2201,6 @@ function renderShellSidebar({ sideRail, nav, width, showBrand }) {
|
|
|
2202
2201
|
search: sideRail.search,
|
|
2203
2202
|
searchQuery: sideRail.searchQuery,
|
|
2204
2203
|
title: showBrand ? brandSlot : null,
|
|
2205
|
-
width,
|
|
2206
2204
|
onNavigate: nav.onNavigate,
|
|
2207
2205
|
onSearchChange: sideRail.onSearchChange
|
|
2208
2206
|
}
|
|
@@ -2210,14 +2208,15 @@ function renderShellSidebar({ sideRail, nav, width, showBrand }) {
|
|
|
2210
2208
|
}
|
|
2211
2209
|
var styles11 = StyleSheet.create({
|
|
2212
2210
|
row: { flexDirection: "row", alignItems: "center" },
|
|
2213
|
-
brand: { justifyContent: "center", paddingHorizontal: 12 },
|
|
2211
|
+
brand: { justifyContent: "center", alignSelf: "stretch", paddingHorizontal: 12, borderBottomWidth: 1 },
|
|
2214
2212
|
fill: { flex: 1 }
|
|
2215
2213
|
});
|
|
2216
2214
|
var TopbarBrandRow = ({ brand, brandWidth, testID, children }) => {
|
|
2217
2215
|
const { width } = useWindowDimensions();
|
|
2216
|
+
const { colors } = useUi().theme;
|
|
2218
2217
|
if (width < RAIL_FULL_BREAKPOINT) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
2219
2218
|
return /* @__PURE__ */ jsxs(View, { style: styles11.row, testID, children: [
|
|
2220
|
-
/* @__PURE__ */ jsx(View, { style: [styles11.brand, brandWidth !== void 0 ? { width: brandWidth } : null], testID: `${testID}-brand`, children: brand }),
|
|
2219
|
+
/* @__PURE__ */ jsx(View, { style: [styles11.brand, { backgroundColor: colors.background, borderBottomColor: colors.border }, brandWidth !== void 0 ? { width: brandWidth } : null], testID: `${testID}-brand`, children: brand }),
|
|
2221
2220
|
/* @__PURE__ */ jsx(View, { style: styles11.fill, children })
|
|
2222
2221
|
] });
|
|
2223
2222
|
};
|
|
@@ -2239,10 +2238,7 @@ var NavShell = ({
|
|
|
2239
2238
|
children,
|
|
2240
2239
|
collapsedSidebar: collapsedSidebarProp,
|
|
2241
2240
|
collapsedRailRange: collapsedRailRangeProp,
|
|
2242
|
-
|
|
2243
|
-
sidebarWidth = NAV_BRAND_DEFAULTS.sidebarWidth,
|
|
2244
|
-
drawerHeader = NAV_BRAND_DEFAULTS.drawerHeader,
|
|
2245
|
-
drawerWidth = NAV_BRAND_DEFAULTS.drawerWidth,
|
|
2241
|
+
brand,
|
|
2246
2242
|
mobileMenu,
|
|
2247
2243
|
...shellProps
|
|
2248
2244
|
}) => {
|
|
@@ -2271,11 +2267,12 @@ var NavShell = ({
|
|
|
2271
2267
|
) : null;
|
|
2272
2268
|
const nav = { pathname, onNavigate, regionLabel, navigateHint };
|
|
2273
2269
|
const rail = showSideRail ? sideRail : void 0;
|
|
2274
|
-
const
|
|
2270
|
+
const { placement, railWidth, drawerHeader, drawerWidth } = { ...NAV_BRAND_DEFAULTS, ...brand };
|
|
2271
|
+
const brandInBar = placement === "topbar" && rail?.brand !== void 0;
|
|
2275
2272
|
const brandInDrawer = drawerHeader === "brand" ? rail?.brand : void 0;
|
|
2276
|
-
const sidebarNode = rail === void 0 ? void 0 : renderShellSidebar({ sideRail: rail, nav, width:
|
|
2277
|
-
const drawerSidebar = rail !== void 0 && brandInDrawer !== void 0 && !brandInBar ? renderShellSidebar({ sideRail: rail, nav, width:
|
|
2278
|
-
const shellHeader = brandInBar ? /* @__PURE__ */ jsx(TopbarBrandRow, { brand: rail?.brand, brandWidth: SIDEBAR_WIDTH_PX[
|
|
2273
|
+
const sidebarNode = rail === void 0 ? void 0 : renderShellSidebar({ sideRail: rail, nav, width: railWidth, showBrand: !brandInBar });
|
|
2274
|
+
const drawerSidebar = rail !== void 0 && brandInDrawer !== void 0 && !brandInBar ? renderShellSidebar({ sideRail: rail, nav, width: railWidth, showBrand: false }) : void 0;
|
|
2275
|
+
const shellHeader = brandInBar ? /* @__PURE__ */ jsx(TopbarBrandRow, { brand: rail?.brand, brandWidth: SIDEBAR_WIDTH_PX[railWidth], testID: `${shellProps.testID}-topbar-brand-row`, children: headerNode }) : headerNode;
|
|
2279
2276
|
const collapsedCfg = showSideRail ? sideRail?.collapsed : void 0;
|
|
2280
2277
|
const collapsedNode = collapsedCfg !== void 0 && sideRail !== void 0 ? /* @__PURE__ */ jsx(
|
|
2281
2278
|
CollapsedRail,
|