@dloizides/ui-nav 1.36.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 +8 -0
- package/README.md +18 -0
- package/dist/index.d.mts +35 -10
- package/dist/index.d.ts +35 -10
- package/dist/index.js +155 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,7 +28,6 @@ var NAV_LINK_GAP = 4;
|
|
|
28
28
|
var navStyles = reactNative.StyleSheet.create({
|
|
29
29
|
// --- Sidebar ---
|
|
30
30
|
sidebarContainer: {
|
|
31
|
-
width: 220,
|
|
32
31
|
paddingTop: 24,
|
|
33
32
|
paddingHorizontal: 12,
|
|
34
33
|
borderRightWidth: 1,
|
|
@@ -837,6 +836,20 @@ var SidebarSearch = ({
|
|
|
837
836
|
}
|
|
838
837
|
);
|
|
839
838
|
};
|
|
839
|
+
|
|
840
|
+
// src/types.ts
|
|
841
|
+
var SIDEBAR_WIDTH_PX = {
|
|
842
|
+
default: 220,
|
|
843
|
+
sm: 240,
|
|
844
|
+
md: 264,
|
|
845
|
+
lg: 288
|
|
846
|
+
};
|
|
847
|
+
var NAV_BRAND_DEFAULTS = {
|
|
848
|
+
placement: "sidebar",
|
|
849
|
+
railWidth: "default",
|
|
850
|
+
drawerHeader: "none",
|
|
851
|
+
drawerWidth: "default"
|
|
852
|
+
};
|
|
840
853
|
function isBareText(node) {
|
|
841
854
|
return typeof node === "string" || typeof node === "number";
|
|
842
855
|
}
|
|
@@ -901,11 +914,12 @@ var Sidebar = ({
|
|
|
901
914
|
role: "navigation",
|
|
902
915
|
style: [
|
|
903
916
|
navStyles.sidebarContainer,
|
|
917
|
+
{ width: SIDEBAR_WIDTH_PX.default },
|
|
904
918
|
{ backgroundColor: colors.surface, borderRightColor: colors.border },
|
|
905
919
|
containerStyle
|
|
906
920
|
],
|
|
907
921
|
children: [
|
|
908
|
-
typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [navStyles.sidebarTitle, { color: colors.text }], children: title }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: navStyles.sidebarBrand, children: title }),
|
|
922
|
+
title === null ? null : typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { accessibilityRole: "header", style: [navStyles.sidebarTitle, { color: colors.text }], children: title }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: navStyles.sidebarBrand, children: title }),
|
|
909
923
|
showInlineSearch && search !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
910
924
|
SidebarSearch,
|
|
911
925
|
{
|
|
@@ -1835,6 +1849,33 @@ function useContentBody(state, children, testID) {
|
|
|
1835
1849
|
) : null
|
|
1836
1850
|
] });
|
|
1837
1851
|
}
|
|
1852
|
+
var CLOSE_GLYPH = "\u2715";
|
|
1853
|
+
var CLOSE_GLYPH_FONT_SIZE = 18;
|
|
1854
|
+
var BAR_PADDING = 12;
|
|
1855
|
+
var styles8 = reactNative.StyleSheet.create({
|
|
1856
|
+
bar: { flexDirection: "row", alignItems: "center", paddingLeft: BAR_PADDING, borderBottomWidth: 1 },
|
|
1857
|
+
brand: { flex: 1 },
|
|
1858
|
+
close: { minWidth: MIN_TOUCH_TARGET, minHeight: MIN_TOUCH_TARGET, alignItems: "center", justifyContent: "center" },
|
|
1859
|
+
glyph: { fontSize: CLOSE_GLYPH_FONT_SIZE, fontWeight: "700" }
|
|
1860
|
+
});
|
|
1861
|
+
var DrawerHeaderBar = ({ brand, closeLabel, closeHint, onClose, testID }) => {
|
|
1862
|
+
const { theme } = uiFeedback.useUi();
|
|
1863
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles8.bar, { borderBottomColor: theme.colors.border }], testID, children: [
|
|
1864
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles8.brand, children: brand }),
|
|
1865
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1866
|
+
FocusableTouchable,
|
|
1867
|
+
{
|
|
1868
|
+
accessibilityHint: closeHint,
|
|
1869
|
+
accessibilityLabel: closeLabel,
|
|
1870
|
+
ringColor: theme.palette.primary["500"],
|
|
1871
|
+
style: styles8.close,
|
|
1872
|
+
testID: `${testID}-close`,
|
|
1873
|
+
onPress: onClose,
|
|
1874
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.glyph, { color: theme.colors.text }], children: CLOSE_GLYPH })
|
|
1875
|
+
}
|
|
1876
|
+
)
|
|
1877
|
+
] });
|
|
1878
|
+
};
|
|
1838
1879
|
var SCRIM_COLOR = "rgba(0, 0, 0, 0.5)";
|
|
1839
1880
|
var MENU_GLYPH2 = "\u2630";
|
|
1840
1881
|
var MENU_GLYPH_FONT_SIZE = 20;
|
|
@@ -1855,7 +1896,7 @@ var DEFAULT_DRAWER_LABELS = {
|
|
|
1855
1896
|
closeLabel: "Close menu",
|
|
1856
1897
|
closeHint: "Close the navigation menu"
|
|
1857
1898
|
};
|
|
1858
|
-
var
|
|
1899
|
+
var styles9 = reactNative.StyleSheet.create({
|
|
1859
1900
|
overlay: { ...reactNative.StyleSheet.absoluteFillObject, zIndex: DRAWER_Z_INDEX },
|
|
1860
1901
|
// The scrim's tap-to-close hit area is anchored to the RIGHT of the panel
|
|
1861
1902
|
// (`left: DRAWER_WIDTH`), so it NEVER overlaps the panel: nav-item taps always
|
|
@@ -1873,6 +1914,8 @@ var styles8 = reactNative.StyleSheet.create({
|
|
|
1873
1914
|
// so on react-native-web it — and the nav leaves inside it — sit above the scrim
|
|
1874
1915
|
// and receive presses instead of the scrim swallowing them.
|
|
1875
1916
|
panel: { position: "absolute", top: 0, bottom: 0, left: 0, width: DRAWER_WIDTH, zIndex: PANEL_Z_INDEX },
|
|
1917
|
+
panelFull: { width: "100%" },
|
|
1918
|
+
panelBody: { flex: 1 },
|
|
1876
1919
|
menuToggle: {
|
|
1877
1920
|
minWidth: MIN_TOUCH_TARGET,
|
|
1878
1921
|
minHeight: MIN_TOUCH_TARGET,
|
|
@@ -1890,10 +1933,10 @@ var MenuToggle = ({ label, hint, onOpen, testID }) => {
|
|
|
1890
1933
|
accessibilityHint: hint,
|
|
1891
1934
|
accessibilityLabel: label,
|
|
1892
1935
|
ringColor: theme.palette.primary["500"],
|
|
1893
|
-
style:
|
|
1936
|
+
style: styles9.menuToggle,
|
|
1894
1937
|
testID,
|
|
1895
1938
|
onPress: onOpen,
|
|
1896
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1939
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.menuToggleGlyph, { color: theme.colors.text }], children: MENU_GLYPH2 })
|
|
1897
1940
|
}
|
|
1898
1941
|
);
|
|
1899
1942
|
};
|
|
@@ -1902,10 +1945,14 @@ var MobileDrawer = ({
|
|
|
1902
1945
|
labels,
|
|
1903
1946
|
onClose,
|
|
1904
1947
|
drawerTestID,
|
|
1905
|
-
scrimTestID
|
|
1948
|
+
scrimTestID,
|
|
1949
|
+
header,
|
|
1950
|
+
width = "default"
|
|
1906
1951
|
}) => {
|
|
1907
1952
|
const { theme } = uiFeedback.useUi();
|
|
1908
1953
|
const panelRef = React.useRef(null);
|
|
1954
|
+
const isFull = width === "full";
|
|
1955
|
+
const showHeaderBar = header !== void 0 || isFull;
|
|
1909
1956
|
React.useEffect(() => {
|
|
1910
1957
|
const node = panelRef.current;
|
|
1911
1958
|
if (node === null || typeof node.addEventListener !== "function") return void 0;
|
|
@@ -1919,27 +1966,39 @@ var MobileDrawer = ({
|
|
|
1919
1966
|
node.addEventListener("click", handleClick);
|
|
1920
1967
|
return () => node.removeEventListener("click", handleClick);
|
|
1921
1968
|
}, [onClose]);
|
|
1922
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1923
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1969
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles9.overlay, children: [
|
|
1970
|
+
isFull ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1924
1971
|
reactNative.Pressable,
|
|
1925
1972
|
{
|
|
1926
1973
|
accessibilityHint: labels.closeHint,
|
|
1927
1974
|
accessibilityLabel: labels.closeLabel,
|
|
1928
1975
|
accessibilityRole: "button",
|
|
1929
|
-
style:
|
|
1976
|
+
style: styles9.scrim,
|
|
1930
1977
|
testID: scrimTestID,
|
|
1931
1978
|
onPress: onClose
|
|
1932
1979
|
}
|
|
1933
1980
|
),
|
|
1934
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1981
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1935
1982
|
reactNative.View,
|
|
1936
1983
|
{
|
|
1937
1984
|
ref: panelRef,
|
|
1938
1985
|
"aria-modal": true,
|
|
1939
1986
|
role: "dialog",
|
|
1940
|
-
style: [
|
|
1987
|
+
style: [styles9.panel, isFull ? styles9.panelFull : null, { backgroundColor: theme.colors.surface }],
|
|
1941
1988
|
testID: drawerTestID,
|
|
1942
|
-
children:
|
|
1989
|
+
children: [
|
|
1990
|
+
showHeaderBar ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1991
|
+
DrawerHeaderBar,
|
|
1992
|
+
{
|
|
1993
|
+
brand: header,
|
|
1994
|
+
closeHint: labels.closeHint,
|
|
1995
|
+
closeLabel: labels.closeLabel,
|
|
1996
|
+
testID: `${drawerTestID}-header`,
|
|
1997
|
+
onClose
|
|
1998
|
+
}
|
|
1999
|
+
) : null,
|
|
2000
|
+
/* @__PURE__ */ jsxRuntime.jsx(NavAccordionContext.Provider, { value: true, children: showHeaderBar ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles9.panelBody, children: renderTextSlot(sidebar, { color: theme.colors.text }) }) : renderTextSlot(sidebar, { color: theme.colors.text }) })
|
|
2001
|
+
]
|
|
1943
2002
|
}
|
|
1944
2003
|
)
|
|
1945
2004
|
] });
|
|
@@ -1955,7 +2014,7 @@ function useContentMaxWidth(width) {
|
|
|
1955
2014
|
return resolveContentMaxWidth(width, viewport);
|
|
1956
2015
|
}
|
|
1957
2016
|
var DEFAULT_CONTENT_PADDING = 24;
|
|
1958
|
-
var
|
|
2017
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
1959
2018
|
root: { flex: 1 },
|
|
1960
2019
|
// Auth-pending spinner: an opaque absolute overlay over the mounted shell, so
|
|
1961
2020
|
// `children` (and any navigator they host) are never unmounted while the gate
|
|
@@ -2017,13 +2076,13 @@ var AppShell = ({
|
|
|
2017
2076
|
}, [isUnauthenticated, gate]);
|
|
2018
2077
|
const gatePending = gate?.pending === true;
|
|
2019
2078
|
if (isUnauthenticated) return null;
|
|
2020
|
-
const columnStyle = maxWidth === "full" ?
|
|
2021
|
-
const navInnerStyle = chromeAlignment === "content" && maxWidth !== "full" ? [
|
|
2079
|
+
const columnStyle = maxWidth === "full" ? styles10.columnFull : [styles10.columnCapped, { maxWidth }];
|
|
2080
|
+
const navInnerStyle = chromeAlignment === "content" && maxWidth !== "full" ? [styles10.chromeCapped, { maxWidth, paddingHorizontal: contentPadding }] : void 0;
|
|
2022
2081
|
const scroller = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2023
2082
|
reactNative.ScrollView,
|
|
2024
2083
|
{
|
|
2025
|
-
contentContainerStyle: [
|
|
2026
|
-
style:
|
|
2084
|
+
contentContainerStyle: [styles10.scrollContent, { padding: contentPadding }],
|
|
2085
|
+
style: styles10.scroll,
|
|
2027
2086
|
testID: `${testID}${APP_SHELL_SUFFIX.content}`,
|
|
2028
2087
|
children: [
|
|
2029
2088
|
look.band,
|
|
@@ -2031,7 +2090,7 @@ var AppShell = ({
|
|
|
2031
2090
|
]
|
|
2032
2091
|
}
|
|
2033
2092
|
);
|
|
2034
|
-
const headerRegion = useDrawer ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2093
|
+
const headerRegion = useDrawer ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles10.headerRow, look.chrome], testID: `${testID}${APP_SHELL_SUFFIX.header}`, children: [
|
|
2035
2094
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2036
2095
|
MenuToggle,
|
|
2037
2096
|
{
|
|
@@ -2041,14 +2100,14 @@ var AppShell = ({
|
|
|
2041
2100
|
onOpen: openDrawer
|
|
2042
2101
|
}
|
|
2043
2102
|
),
|
|
2044
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2103
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles10.headerFill, children: renderTextSlot(header, { color: look.chromeText }) })
|
|
2045
2104
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: look.chrome, testID: `${testID}${APP_SHELL_SUFFIX.header}`, children: renderTextSlot(header, { color: look.chromeText }) });
|
|
2046
2105
|
const railRegion = railMode === "full" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: `${testID}${APP_SHELL_SUFFIX.sidebar}`, children: renderTextSlot(sidebar, { color: theme.colors.text }) }) : railMode === "collapsed" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: `${testID}${APP_SHELL_SUFFIX.collapsedSidebar}`, children: renderTextSlot(collapsedSidebar, { color: theme.colors.text }) }) : null;
|
|
2047
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2106
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles10.root, look.root], testID, children: [
|
|
2048
2107
|
headerRegion,
|
|
2049
2108
|
nav !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: look.chrome, testID: `${testID}${APP_SHELL_SUFFIX.nav}`, children: navInnerStyle !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: navInnerStyle, children: renderTextSlot(nav, { color: look.chromeText }) }) : renderTextSlot(nav, { color: look.chromeText }) }) : null,
|
|
2050
2109
|
banner !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: `${testID}${APP_SHELL_SUFFIX.banner}`, children: renderTextSlot(banner, { color: theme.colors.text }) }) : null,
|
|
2051
|
-
railRegion !== null ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2110
|
+
railRegion !== null ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles10.bodyRow, children: [
|
|
2052
2111
|
railRegion,
|
|
2053
2112
|
scroller
|
|
2054
2113
|
] }) : scroller,
|
|
@@ -2057,15 +2116,17 @@ var AppShell = ({
|
|
|
2057
2116
|
{
|
|
2058
2117
|
drawerTestID: `${testID}${APP_SHELL_SUFFIX.drawer}`,
|
|
2059
2118
|
labels: drawerLabels,
|
|
2119
|
+
header: mobileMenu?.header,
|
|
2060
2120
|
scrimTestID: `${testID}${APP_SHELL_SUFFIX.scrim}`,
|
|
2061
|
-
sidebar,
|
|
2121
|
+
sidebar: mobileMenu?.sidebar ?? sidebar,
|
|
2122
|
+
width: mobileMenu?.width,
|
|
2062
2123
|
onClose: closeDrawer
|
|
2063
2124
|
}
|
|
2064
2125
|
) : null,
|
|
2065
2126
|
gatePending ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2066
2127
|
reactNative.View,
|
|
2067
2128
|
{
|
|
2068
|
-
style: [
|
|
2129
|
+
style: [styles10.pendingOverlay, { backgroundColor: theme.colors.background }],
|
|
2069
2130
|
testID: `${testID}${APP_SHELL_SUFFIX.pending}`,
|
|
2070
2131
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ActivityIndicator, { color: primary, size: "large" })
|
|
2071
2132
|
}
|
|
@@ -2126,6 +2187,45 @@ var CollapsedRail = ({
|
|
|
2126
2187
|
}
|
|
2127
2188
|
);
|
|
2128
2189
|
};
|
|
2190
|
+
function renderShellSidebar({ sideRail, nav, width, showBrand }) {
|
|
2191
|
+
const brandSlot = sideRail.brand ?? sideRail.title;
|
|
2192
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2193
|
+
Sidebar,
|
|
2194
|
+
{
|
|
2195
|
+
collapseHint: sideRail.collapseHint,
|
|
2196
|
+
containerStyle: { width: SIDEBAR_WIDTH_PX[width], ...reactNative.StyleSheet.flatten(sideRail.containerStyle) },
|
|
2197
|
+
enableInlineSearch: sideRail.enableInlineSearch,
|
|
2198
|
+
expandHint: sideRail.expandHint,
|
|
2199
|
+
footer: sideRail.footer,
|
|
2200
|
+
header: sideRail.header,
|
|
2201
|
+
items: sideRail.items,
|
|
2202
|
+
navigateHint: nav.navigateHint,
|
|
2203
|
+
paletteTrigger: sideRail.paletteTrigger,
|
|
2204
|
+
pathname: nav.pathname,
|
|
2205
|
+
regionLabel: nav.regionLabel,
|
|
2206
|
+
renderChevron: sideRail.renderChevron,
|
|
2207
|
+
search: sideRail.search,
|
|
2208
|
+
searchQuery: sideRail.searchQuery,
|
|
2209
|
+
title: showBrand ? brandSlot : null,
|
|
2210
|
+
onNavigate: nav.onNavigate,
|
|
2211
|
+
onSearchChange: sideRail.onSearchChange
|
|
2212
|
+
}
|
|
2213
|
+
);
|
|
2214
|
+
}
|
|
2215
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
2216
|
+
row: { flexDirection: "row", alignItems: "center" },
|
|
2217
|
+
brand: { justifyContent: "center", alignSelf: "stretch", paddingHorizontal: 12, borderBottomWidth: 1 },
|
|
2218
|
+
fill: { flex: 1 }
|
|
2219
|
+
});
|
|
2220
|
+
var TopbarBrandRow = ({ brand, brandWidth, testID, children }) => {
|
|
2221
|
+
const { width } = reactNative.useWindowDimensions();
|
|
2222
|
+
const { colors } = uiFeedback.useUi().theme;
|
|
2223
|
+
if (width < RAIL_FULL_BREAKPOINT) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
2224
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.row, testID, children: [
|
|
2225
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles11.brand, { backgroundColor: colors.background, borderBottomColor: colors.border }, brandWidth !== void 0 ? { width: brandWidth } : null], testID: `${testID}-brand`, children: brand }),
|
|
2226
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles11.fill, children })
|
|
2227
|
+
] });
|
|
2228
|
+
};
|
|
2129
2229
|
function wantsTopBar(layout, hasHeader) {
|
|
2130
2230
|
return layout === "top" || layout === "both" || hasHeader;
|
|
2131
2231
|
}
|
|
@@ -2144,6 +2244,8 @@ var NavShell = ({
|
|
|
2144
2244
|
children,
|
|
2145
2245
|
collapsedSidebar: collapsedSidebarProp,
|
|
2146
2246
|
collapsedRailRange: collapsedRailRangeProp,
|
|
2247
|
+
brand,
|
|
2248
|
+
mobileMenu,
|
|
2147
2249
|
...shellProps
|
|
2148
2250
|
}) => {
|
|
2149
2251
|
const showTopBar = wantsTopBar(layout, header !== void 0);
|
|
@@ -2169,28 +2271,14 @@ var NavShell = ({
|
|
|
2169
2271
|
onNavigate
|
|
2170
2272
|
}
|
|
2171
2273
|
) : null;
|
|
2172
|
-
const
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
header: sideRail.header,
|
|
2181
|
-
items: sideRail.items,
|
|
2182
|
-
navigateHint,
|
|
2183
|
-
paletteTrigger: sideRail.paletteTrigger,
|
|
2184
|
-
pathname,
|
|
2185
|
-
regionLabel,
|
|
2186
|
-
renderChevron: sideRail.renderChevron,
|
|
2187
|
-
search: sideRail.search,
|
|
2188
|
-
searchQuery: sideRail.searchQuery,
|
|
2189
|
-
title: sideRail.brand ?? sideRail.title,
|
|
2190
|
-
onNavigate,
|
|
2191
|
-
onSearchChange: sideRail.onSearchChange
|
|
2192
|
-
}
|
|
2193
|
-
) : void 0;
|
|
2274
|
+
const nav = { pathname, onNavigate, regionLabel, navigateHint };
|
|
2275
|
+
const rail = showSideRail ? sideRail : void 0;
|
|
2276
|
+
const { placement, railWidth, drawerHeader, drawerWidth } = { ...NAV_BRAND_DEFAULTS, ...brand };
|
|
2277
|
+
const brandInBar = placement === "topbar" && rail?.brand !== void 0;
|
|
2278
|
+
const brandInDrawer = drawerHeader === "brand" ? rail?.brand : void 0;
|
|
2279
|
+
const sidebarNode = rail === void 0 ? void 0 : renderShellSidebar({ sideRail: rail, nav, width: railWidth, showBrand: !brandInBar });
|
|
2280
|
+
const drawerSidebar = rail !== void 0 && brandInDrawer !== void 0 && !brandInBar ? renderShellSidebar({ sideRail: rail, nav, width: railWidth, showBrand: false }) : void 0;
|
|
2281
|
+
const shellHeader = brandInBar ? /* @__PURE__ */ jsxRuntime.jsx(TopbarBrandRow, { brand: rail?.brand, brandWidth: SIDEBAR_WIDTH_PX[railWidth], testID: `${shellProps.testID}-topbar-brand-row`, children: headerNode }) : headerNode;
|
|
2194
2282
|
const collapsedCfg = showSideRail ? sideRail?.collapsed : void 0;
|
|
2195
2283
|
const collapsedNode = collapsedCfg !== void 0 && sideRail !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2196
2284
|
CollapsedRail,
|
|
@@ -2211,7 +2299,8 @@ var NavShell = ({
|
|
|
2211
2299
|
...shellProps,
|
|
2212
2300
|
collapsedRailRange: collapsedRange,
|
|
2213
2301
|
collapsedSidebar: collapsedNode,
|
|
2214
|
-
header:
|
|
2302
|
+
header: shellHeader,
|
|
2303
|
+
mobileMenu: { ...mobileMenu, header: brandInDrawer, width: drawerWidth, sidebar: drawerSidebar },
|
|
2215
2304
|
sidebar: sidebarNode,
|
|
2216
2305
|
children
|
|
2217
2306
|
}
|
|
@@ -2434,7 +2523,7 @@ var KEY_DOWN = "ArrowDown";
|
|
|
2434
2523
|
var KEY_UP = "ArrowUp";
|
|
2435
2524
|
var KEY_ENTER = "Enter";
|
|
2436
2525
|
var KEY_ESCAPE = "Escape";
|
|
2437
|
-
var
|
|
2526
|
+
var styles12 = reactNative.StyleSheet.create({
|
|
2438
2527
|
overlay: { ...reactNative.StyleSheet.absoluteFillObject, zIndex: OVERLAY_Z_INDEX, alignItems: "center" },
|
|
2439
2528
|
scrim: { ...reactNative.StyleSheet.absoluteFillObject, backgroundColor: SCRIM_COLOR2 },
|
|
2440
2529
|
panel: {
|
|
@@ -2463,14 +2552,14 @@ var PaletteRow = ({ item, selected, onChoose }) => {
|
|
|
2463
2552
|
accessibilityLabel: item.label,
|
|
2464
2553
|
accessibilityRole: "button",
|
|
2465
2554
|
accessibilityState: { selected },
|
|
2466
|
-
style: [
|
|
2555
|
+
style: [styles12.row, selected ? { backgroundColor: colors.border } : void 0],
|
|
2467
2556
|
testID: item.testID ?? item.key,
|
|
2468
2557
|
onPress: () => onChoose(item),
|
|
2469
2558
|
children: [
|
|
2470
2559
|
typeof item.renderIcon === "function" ? item.renderIcon(colors.textSecondary, NAV_ICON_SIZE) : null,
|
|
2471
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2472
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2473
|
-
item.hint ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2560
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.rowText, children: [
|
|
2561
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles12.rowLabel, { color: colors.text }], children: item.label }),
|
|
2562
|
+
item.hint ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles12.rowHint, { color: colors.textSecondary }], children: item.hint }) : null
|
|
2474
2563
|
] })
|
|
2475
2564
|
]
|
|
2476
2565
|
}
|
|
@@ -2510,14 +2599,14 @@ var CommandPalette = ({ open, items, onClose, labels, testID }) => {
|
|
|
2510
2599
|
[results, selected, choose, onClose]
|
|
2511
2600
|
);
|
|
2512
2601
|
if (!open) return null;
|
|
2513
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2602
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.overlay, children: [
|
|
2514
2603
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2515
2604
|
reactNative.Pressable,
|
|
2516
2605
|
{
|
|
2517
2606
|
accessibilityHint: labels.closeHint,
|
|
2518
2607
|
accessibilityLabel: labels.closeLabel,
|
|
2519
2608
|
accessibilityRole: "button",
|
|
2520
|
-
style:
|
|
2609
|
+
style: styles12.scrim,
|
|
2521
2610
|
testID: `${testID ?? "command-palette"}-scrim`,
|
|
2522
2611
|
onPress: onClose
|
|
2523
2612
|
}
|
|
@@ -2528,7 +2617,7 @@ var CommandPalette = ({ open, items, onClose, labels, testID }) => {
|
|
|
2528
2617
|
"aria-modal": true,
|
|
2529
2618
|
"aria-label": labels.regionLabel,
|
|
2530
2619
|
role: "dialog",
|
|
2531
|
-
style: [
|
|
2620
|
+
style: [styles12.panel, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
2532
2621
|
testID: testID ?? "command-palette",
|
|
2533
2622
|
children: [
|
|
2534
2623
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2538,14 +2627,14 @@ var CommandPalette = ({ open, items, onClose, labels, testID }) => {
|
|
|
2538
2627
|
accessibilityLabel: labels.placeholder,
|
|
2539
2628
|
placeholder: labels.placeholder,
|
|
2540
2629
|
placeholderTextColor: colors.textSecondary,
|
|
2541
|
-
style: [
|
|
2630
|
+
style: [styles12.input, { color: colors.text, borderBottomColor: colors.border }],
|
|
2542
2631
|
testID: `${testID ?? "command-palette"}-input`,
|
|
2543
2632
|
value: query,
|
|
2544
2633
|
onChangeText: setQuery,
|
|
2545
2634
|
onKeyPress
|
|
2546
2635
|
}
|
|
2547
2636
|
),
|
|
2548
|
-
results.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2637
|
+
results.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles12.empty, { color: colors.textSecondary }], children: labels.emptyText }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { keyboardShouldPersistTaps: "handled", style: styles12.list, children: results.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(PaletteRow, { item, selected: index === selected, onChoose: choose }, item.key)) })
|
|
2549
2638
|
]
|
|
2550
2639
|
}
|
|
2551
2640
|
)
|
|
@@ -2650,7 +2739,7 @@ var TAB_MIN_HEIGHT = 56;
|
|
|
2650
2739
|
var LABEL_SIZE = 12;
|
|
2651
2740
|
var LABEL_GAP = 2;
|
|
2652
2741
|
var TAB_PADDING = 4;
|
|
2653
|
-
var
|
|
2742
|
+
var styles13 = reactNative.StyleSheet.create({
|
|
2654
2743
|
tab: {
|
|
2655
2744
|
flex: 1,
|
|
2656
2745
|
minHeight: TAB_MIN_HEIGHT,
|
|
@@ -2687,31 +2776,31 @@ var BottomTab = ({
|
|
|
2687
2776
|
accessibilityLabel: item.label,
|
|
2688
2777
|
accessibilityRole: "link",
|
|
2689
2778
|
accessibilityState: { selected: isActive },
|
|
2690
|
-
style: [
|
|
2779
|
+
style: [styles13.tab, { opacity: feedback.opacity }],
|
|
2691
2780
|
testID: item.testID ?? item.key,
|
|
2692
2781
|
onPress: () => onPress(item.route),
|
|
2693
2782
|
onPressIn: () => setPressed(true),
|
|
2694
2783
|
onPressOut: () => setPressed(false),
|
|
2695
2784
|
...ariaCurrentProps3(isActive),
|
|
2696
2785
|
children: [
|
|
2697
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.Animated.View, { style: [
|
|
2786
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.Animated.View, { style: [styles13.iconWrap, { transform: [{ scale }] }], children: [
|
|
2698
2787
|
feedback.pillScale === null ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2699
2788
|
reactNative.View,
|
|
2700
2789
|
{
|
|
2701
2790
|
pointerEvents: "none",
|
|
2702
|
-
style: [
|
|
2791
|
+
style: [styles13.pill, { backgroundColor: colors.pill, transform: [{ scale: feedback.pillScale }] }, motion]
|
|
2703
2792
|
}
|
|
2704
2793
|
),
|
|
2705
2794
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [{ transform: feedback.iconTransform }, motion], children: item.renderIcon?.(color, ICON_SIZE) })
|
|
2706
2795
|
] }),
|
|
2707
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2796
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles13.label, { color }], children: item.label })
|
|
2708
2797
|
]
|
|
2709
2798
|
}
|
|
2710
2799
|
);
|
|
2711
2800
|
};
|
|
2712
2801
|
var DEFAULT_TEST_ID = "bottom-tab-bar";
|
|
2713
2802
|
var SLIDER_HEIGHT = 3;
|
|
2714
|
-
var
|
|
2803
|
+
var styles14 = reactNative.StyleSheet.create({
|
|
2715
2804
|
bar: { flexDirection: "row", borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
2716
2805
|
slider: { position: "absolute", top: 0, height: SLIDER_HEIGHT }
|
|
2717
2806
|
});
|
|
@@ -2738,14 +2827,14 @@ var BottomTabBar = ({
|
|
|
2738
2827
|
{
|
|
2739
2828
|
"aria-label": regionLabel,
|
|
2740
2829
|
role: "navigation",
|
|
2741
|
-
style: [
|
|
2830
|
+
style: [styles14.bar, { backgroundColor: theme.colors.surface, borderTopColor: theme.colors.border }, containerStyle],
|
|
2742
2831
|
testID,
|
|
2743
2832
|
children: [
|
|
2744
2833
|
bar === null ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2745
2834
|
reactNative.View,
|
|
2746
2835
|
{
|
|
2747
2836
|
pointerEvents: "none",
|
|
2748
|
-
style: [
|
|
2837
|
+
style: [styles14.slider, { left: bar.left, width: bar.width, backgroundColor: primary }, webTransition("left", barMs, reducedMotion)]
|
|
2749
2838
|
}
|
|
2750
2839
|
),
|
|
2751
2840
|
items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2782,6 +2871,7 @@ exports.DEFAULT_COLLAPSED_RAIL_MAX = DEFAULT_COLLAPSED_RAIL_MAX;
|
|
|
2782
2871
|
exports.DEFAULT_SEARCH_BREAKPOINT = DEFAULT_SEARCH_BREAKPOINT;
|
|
2783
2872
|
exports.DarkModeControl = DarkModeControl;
|
|
2784
2873
|
exports.HOVER_TINT_OPACITY = HOVER_TINT_OPACITY;
|
|
2874
|
+
exports.NAV_BRAND_DEFAULTS = NAV_BRAND_DEFAULTS;
|
|
2785
2875
|
exports.NAV_ICON_SIZE = NAV_ICON_SIZE;
|
|
2786
2876
|
exports.NAV_LINK_GAP = NAV_LINK_GAP;
|
|
2787
2877
|
exports.NAV_ROW_RADIUS = NAV_ROW_RADIUS;
|
|
@@ -2795,6 +2885,7 @@ exports.NavShell = NavShell;
|
|
|
2795
2885
|
exports.PillNav = PillNav;
|
|
2796
2886
|
exports.PillNavVariant = PillNavVariant;
|
|
2797
2887
|
exports.RAIL_FULL_BREAKPOINT = RAIL_FULL_BREAKPOINT;
|
|
2888
|
+
exports.SIDEBAR_WIDTH_PX = SIDEBAR_WIDTH_PX;
|
|
2798
2889
|
exports.Sidebar = Sidebar;
|
|
2799
2890
|
exports.SidebarChevron = SidebarChevron;
|
|
2800
2891
|
exports.SidebarSearch = SidebarSearch;
|