@dloizides/ui-nav 1.36.0 → 1.37.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 +18 -0
- package/dist/index.d.mts +37 -12
- package/dist/index.d.ts +37 -12
- package/dist/index.js +158 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +157 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,6 @@ var NAV_LINK_GAP = 4;
|
|
|
22
22
|
var navStyles = StyleSheet.create({
|
|
23
23
|
// --- Sidebar ---
|
|
24
24
|
sidebarContainer: {
|
|
25
|
-
width: 220,
|
|
26
25
|
paddingTop: 24,
|
|
27
26
|
paddingHorizontal: 12,
|
|
28
27
|
borderRightWidth: 1,
|
|
@@ -831,6 +830,20 @@ var SidebarSearch = ({
|
|
|
831
830
|
}
|
|
832
831
|
);
|
|
833
832
|
};
|
|
833
|
+
|
|
834
|
+
// src/types.ts
|
|
835
|
+
var SIDEBAR_WIDTH_PX = {
|
|
836
|
+
default: 220,
|
|
837
|
+
sm: 240,
|
|
838
|
+
md: 264,
|
|
839
|
+
lg: 288
|
|
840
|
+
};
|
|
841
|
+
var NAV_BRAND_DEFAULTS = {
|
|
842
|
+
brandPlacement: "sidebar",
|
|
843
|
+
sidebarWidth: "default",
|
|
844
|
+
drawerHeader: "none",
|
|
845
|
+
drawerWidth: "default"
|
|
846
|
+
};
|
|
834
847
|
function isBareText(node) {
|
|
835
848
|
return typeof node === "string" || typeof node === "number";
|
|
836
849
|
}
|
|
@@ -848,6 +861,7 @@ var Sidebar = ({
|
|
|
848
861
|
pathname,
|
|
849
862
|
onNavigate,
|
|
850
863
|
title,
|
|
864
|
+
width: railWidth = "default",
|
|
851
865
|
regionLabel,
|
|
852
866
|
navigateHint = (label) => label,
|
|
853
867
|
expandHint = "",
|
|
@@ -895,11 +909,12 @@ var Sidebar = ({
|
|
|
895
909
|
role: "navigation",
|
|
896
910
|
style: [
|
|
897
911
|
navStyles.sidebarContainer,
|
|
912
|
+
{ width: SIDEBAR_WIDTH_PX[railWidth] },
|
|
898
913
|
{ backgroundColor: colors.surface, borderRightColor: colors.border },
|
|
899
914
|
containerStyle
|
|
900
915
|
],
|
|
901
916
|
children: [
|
|
902
|
-
typeof title === "string" ? /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [navStyles.sidebarTitle, { color: colors.text }], children: title }) : /* @__PURE__ */ jsx(View, { style: navStyles.sidebarBrand, children: title }),
|
|
917
|
+
title === null ? null : typeof title === "string" ? /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [navStyles.sidebarTitle, { color: colors.text }], children: title }) : /* @__PURE__ */ jsx(View, { style: navStyles.sidebarBrand, children: title }),
|
|
903
918
|
showInlineSearch && search !== void 0 ? /* @__PURE__ */ jsx(
|
|
904
919
|
SidebarSearch,
|
|
905
920
|
{
|
|
@@ -1829,6 +1844,33 @@ function useContentBody(state, children, testID) {
|
|
|
1829
1844
|
) : null
|
|
1830
1845
|
] });
|
|
1831
1846
|
}
|
|
1847
|
+
var CLOSE_GLYPH = "\u2715";
|
|
1848
|
+
var CLOSE_GLYPH_FONT_SIZE = 18;
|
|
1849
|
+
var BAR_PADDING = 12;
|
|
1850
|
+
var styles8 = StyleSheet.create({
|
|
1851
|
+
bar: { flexDirection: "row", alignItems: "center", paddingLeft: BAR_PADDING, borderBottomWidth: 1 },
|
|
1852
|
+
brand: { flex: 1 },
|
|
1853
|
+
close: { minWidth: MIN_TOUCH_TARGET, minHeight: MIN_TOUCH_TARGET, alignItems: "center", justifyContent: "center" },
|
|
1854
|
+
glyph: { fontSize: CLOSE_GLYPH_FONT_SIZE, fontWeight: "700" }
|
|
1855
|
+
});
|
|
1856
|
+
var DrawerHeaderBar = ({ brand, closeLabel, closeHint, onClose, testID }) => {
|
|
1857
|
+
const { theme } = useUi();
|
|
1858
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles8.bar, { borderBottomColor: theme.colors.border }], testID, children: [
|
|
1859
|
+
/* @__PURE__ */ jsx(View, { style: styles8.brand, children: brand }),
|
|
1860
|
+
/* @__PURE__ */ jsx(
|
|
1861
|
+
FocusableTouchable,
|
|
1862
|
+
{
|
|
1863
|
+
accessibilityHint: closeHint,
|
|
1864
|
+
accessibilityLabel: closeLabel,
|
|
1865
|
+
ringColor: theme.palette.primary["500"],
|
|
1866
|
+
style: styles8.close,
|
|
1867
|
+
testID: `${testID}-close`,
|
|
1868
|
+
onPress: onClose,
|
|
1869
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles8.glyph, { color: theme.colors.text }], children: CLOSE_GLYPH })
|
|
1870
|
+
}
|
|
1871
|
+
)
|
|
1872
|
+
] });
|
|
1873
|
+
};
|
|
1832
1874
|
var SCRIM_COLOR = "rgba(0, 0, 0, 0.5)";
|
|
1833
1875
|
var MENU_GLYPH2 = "\u2630";
|
|
1834
1876
|
var MENU_GLYPH_FONT_SIZE = 20;
|
|
@@ -1849,7 +1891,7 @@ var DEFAULT_DRAWER_LABELS = {
|
|
|
1849
1891
|
closeLabel: "Close menu",
|
|
1850
1892
|
closeHint: "Close the navigation menu"
|
|
1851
1893
|
};
|
|
1852
|
-
var
|
|
1894
|
+
var styles9 = StyleSheet.create({
|
|
1853
1895
|
overlay: { ...StyleSheet.absoluteFillObject, zIndex: DRAWER_Z_INDEX },
|
|
1854
1896
|
// The scrim's tap-to-close hit area is anchored to the RIGHT of the panel
|
|
1855
1897
|
// (`left: DRAWER_WIDTH`), so it NEVER overlaps the panel: nav-item taps always
|
|
@@ -1867,6 +1909,8 @@ var styles8 = StyleSheet.create({
|
|
|
1867
1909
|
// so on react-native-web it — and the nav leaves inside it — sit above the scrim
|
|
1868
1910
|
// and receive presses instead of the scrim swallowing them.
|
|
1869
1911
|
panel: { position: "absolute", top: 0, bottom: 0, left: 0, width: DRAWER_WIDTH, zIndex: PANEL_Z_INDEX },
|
|
1912
|
+
panelFull: { width: "100%" },
|
|
1913
|
+
panelBody: { flex: 1 },
|
|
1870
1914
|
menuToggle: {
|
|
1871
1915
|
minWidth: MIN_TOUCH_TARGET,
|
|
1872
1916
|
minHeight: MIN_TOUCH_TARGET,
|
|
@@ -1884,10 +1928,10 @@ var MenuToggle = ({ label, hint, onOpen, testID }) => {
|
|
|
1884
1928
|
accessibilityHint: hint,
|
|
1885
1929
|
accessibilityLabel: label,
|
|
1886
1930
|
ringColor: theme.palette.primary["500"],
|
|
1887
|
-
style:
|
|
1931
|
+
style: styles9.menuToggle,
|
|
1888
1932
|
testID,
|
|
1889
1933
|
onPress: onOpen,
|
|
1890
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1934
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles9.menuToggleGlyph, { color: theme.colors.text }], children: MENU_GLYPH2 })
|
|
1891
1935
|
}
|
|
1892
1936
|
);
|
|
1893
1937
|
};
|
|
@@ -1896,10 +1940,14 @@ var MobileDrawer = ({
|
|
|
1896
1940
|
labels,
|
|
1897
1941
|
onClose,
|
|
1898
1942
|
drawerTestID,
|
|
1899
|
-
scrimTestID
|
|
1943
|
+
scrimTestID,
|
|
1944
|
+
header,
|
|
1945
|
+
width = "default"
|
|
1900
1946
|
}) => {
|
|
1901
1947
|
const { theme } = useUi();
|
|
1902
1948
|
const panelRef = useRef(null);
|
|
1949
|
+
const isFull = width === "full";
|
|
1950
|
+
const showHeaderBar = header !== void 0 || isFull;
|
|
1903
1951
|
useEffect(() => {
|
|
1904
1952
|
const node = panelRef.current;
|
|
1905
1953
|
if (node === null || typeof node.addEventListener !== "function") return void 0;
|
|
@@ -1913,27 +1961,39 @@ var MobileDrawer = ({
|
|
|
1913
1961
|
node.addEventListener("click", handleClick);
|
|
1914
1962
|
return () => node.removeEventListener("click", handleClick);
|
|
1915
1963
|
}, [onClose]);
|
|
1916
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
1917
|
-
/* @__PURE__ */ jsx(
|
|
1964
|
+
return /* @__PURE__ */ jsxs(View, { style: styles9.overlay, children: [
|
|
1965
|
+
isFull ? null : /* @__PURE__ */ jsx(
|
|
1918
1966
|
Pressable,
|
|
1919
1967
|
{
|
|
1920
1968
|
accessibilityHint: labels.closeHint,
|
|
1921
1969
|
accessibilityLabel: labels.closeLabel,
|
|
1922
1970
|
accessibilityRole: "button",
|
|
1923
|
-
style:
|
|
1971
|
+
style: styles9.scrim,
|
|
1924
1972
|
testID: scrimTestID,
|
|
1925
1973
|
onPress: onClose
|
|
1926
1974
|
}
|
|
1927
1975
|
),
|
|
1928
|
-
/* @__PURE__ */
|
|
1976
|
+
/* @__PURE__ */ jsxs(
|
|
1929
1977
|
View,
|
|
1930
1978
|
{
|
|
1931
1979
|
ref: panelRef,
|
|
1932
1980
|
"aria-modal": true,
|
|
1933
1981
|
role: "dialog",
|
|
1934
|
-
style: [
|
|
1982
|
+
style: [styles9.panel, isFull ? styles9.panelFull : null, { backgroundColor: theme.colors.surface }],
|
|
1935
1983
|
testID: drawerTestID,
|
|
1936
|
-
children:
|
|
1984
|
+
children: [
|
|
1985
|
+
showHeaderBar ? /* @__PURE__ */ jsx(
|
|
1986
|
+
DrawerHeaderBar,
|
|
1987
|
+
{
|
|
1988
|
+
brand: header,
|
|
1989
|
+
closeHint: labels.closeHint,
|
|
1990
|
+
closeLabel: labels.closeLabel,
|
|
1991
|
+
testID: `${drawerTestID}-header`,
|
|
1992
|
+
onClose
|
|
1993
|
+
}
|
|
1994
|
+
) : null,
|
|
1995
|
+
/* @__PURE__ */ jsx(NavAccordionContext.Provider, { value: true, children: showHeaderBar ? /* @__PURE__ */ jsx(View, { style: styles9.panelBody, children: renderTextSlot(sidebar, { color: theme.colors.text }) }) : renderTextSlot(sidebar, { color: theme.colors.text }) })
|
|
1996
|
+
]
|
|
1937
1997
|
}
|
|
1938
1998
|
)
|
|
1939
1999
|
] });
|
|
@@ -1949,7 +2009,7 @@ function useContentMaxWidth(width) {
|
|
|
1949
2009
|
return resolveContentMaxWidth(width, viewport);
|
|
1950
2010
|
}
|
|
1951
2011
|
var DEFAULT_CONTENT_PADDING = 24;
|
|
1952
|
-
var
|
|
2012
|
+
var styles10 = StyleSheet.create({
|
|
1953
2013
|
root: { flex: 1 },
|
|
1954
2014
|
// Auth-pending spinner: an opaque absolute overlay over the mounted shell, so
|
|
1955
2015
|
// `children` (and any navigator they host) are never unmounted while the gate
|
|
@@ -2011,13 +2071,13 @@ var AppShell = ({
|
|
|
2011
2071
|
}, [isUnauthenticated, gate]);
|
|
2012
2072
|
const gatePending = gate?.pending === true;
|
|
2013
2073
|
if (isUnauthenticated) return null;
|
|
2014
|
-
const columnStyle = maxWidth === "full" ?
|
|
2015
|
-
const navInnerStyle = chromeAlignment === "content" && maxWidth !== "full" ? [
|
|
2074
|
+
const columnStyle = maxWidth === "full" ? styles10.columnFull : [styles10.columnCapped, { maxWidth }];
|
|
2075
|
+
const navInnerStyle = chromeAlignment === "content" && maxWidth !== "full" ? [styles10.chromeCapped, { maxWidth, paddingHorizontal: contentPadding }] : void 0;
|
|
2016
2076
|
const scroller = /* @__PURE__ */ jsxs(
|
|
2017
2077
|
ScrollView,
|
|
2018
2078
|
{
|
|
2019
|
-
contentContainerStyle: [
|
|
2020
|
-
style:
|
|
2079
|
+
contentContainerStyle: [styles10.scrollContent, { padding: contentPadding }],
|
|
2080
|
+
style: styles10.scroll,
|
|
2021
2081
|
testID: `${testID}${APP_SHELL_SUFFIX.content}`,
|
|
2022
2082
|
children: [
|
|
2023
2083
|
look.band,
|
|
@@ -2025,7 +2085,7 @@ var AppShell = ({
|
|
|
2025
2085
|
]
|
|
2026
2086
|
}
|
|
2027
2087
|
);
|
|
2028
|
-
const headerRegion = useDrawer ? /* @__PURE__ */ jsxs(View, { style: [
|
|
2088
|
+
const headerRegion = useDrawer ? /* @__PURE__ */ jsxs(View, { style: [styles10.headerRow, look.chrome], testID: `${testID}${APP_SHELL_SUFFIX.header}`, children: [
|
|
2029
2089
|
/* @__PURE__ */ jsx(
|
|
2030
2090
|
MenuToggle,
|
|
2031
2091
|
{
|
|
@@ -2035,14 +2095,14 @@ var AppShell = ({
|
|
|
2035
2095
|
onOpen: openDrawer
|
|
2036
2096
|
}
|
|
2037
2097
|
),
|
|
2038
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
2098
|
+
/* @__PURE__ */ jsx(View, { style: styles10.headerFill, children: renderTextSlot(header, { color: look.chromeText }) })
|
|
2039
2099
|
] }) : /* @__PURE__ */ jsx(View, { style: look.chrome, testID: `${testID}${APP_SHELL_SUFFIX.header}`, children: renderTextSlot(header, { color: look.chromeText }) });
|
|
2040
2100
|
const railRegion = railMode === "full" ? /* @__PURE__ */ jsx(View, { testID: `${testID}${APP_SHELL_SUFFIX.sidebar}`, children: renderTextSlot(sidebar, { color: theme.colors.text }) }) : railMode === "collapsed" ? /* @__PURE__ */ jsx(View, { testID: `${testID}${APP_SHELL_SUFFIX.collapsedSidebar}`, children: renderTextSlot(collapsedSidebar, { color: theme.colors.text }) }) : null;
|
|
2041
|
-
return /* @__PURE__ */ jsxs(View, { style: [
|
|
2101
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles10.root, look.root], testID, children: [
|
|
2042
2102
|
headerRegion,
|
|
2043
2103
|
nav !== void 0 ? /* @__PURE__ */ jsx(View, { style: look.chrome, testID: `${testID}${APP_SHELL_SUFFIX.nav}`, children: navInnerStyle !== void 0 ? /* @__PURE__ */ jsx(View, { style: navInnerStyle, children: renderTextSlot(nav, { color: look.chromeText }) }) : renderTextSlot(nav, { color: look.chromeText }) }) : null,
|
|
2044
2104
|
banner !== void 0 ? /* @__PURE__ */ jsx(View, { testID: `${testID}${APP_SHELL_SUFFIX.banner}`, children: renderTextSlot(banner, { color: theme.colors.text }) }) : null,
|
|
2045
|
-
railRegion !== null ? /* @__PURE__ */ jsxs(View, { style:
|
|
2105
|
+
railRegion !== null ? /* @__PURE__ */ jsxs(View, { style: styles10.bodyRow, children: [
|
|
2046
2106
|
railRegion,
|
|
2047
2107
|
scroller
|
|
2048
2108
|
] }) : scroller,
|
|
@@ -2051,15 +2111,17 @@ var AppShell = ({
|
|
|
2051
2111
|
{
|
|
2052
2112
|
drawerTestID: `${testID}${APP_SHELL_SUFFIX.drawer}`,
|
|
2053
2113
|
labels: drawerLabels,
|
|
2114
|
+
header: mobileMenu?.header,
|
|
2054
2115
|
scrimTestID: `${testID}${APP_SHELL_SUFFIX.scrim}`,
|
|
2055
|
-
sidebar,
|
|
2116
|
+
sidebar: mobileMenu?.sidebar ?? sidebar,
|
|
2117
|
+
width: mobileMenu?.width,
|
|
2056
2118
|
onClose: closeDrawer
|
|
2057
2119
|
}
|
|
2058
2120
|
) : null,
|
|
2059
2121
|
gatePending ? /* @__PURE__ */ jsx(
|
|
2060
2122
|
View,
|
|
2061
2123
|
{
|
|
2062
|
-
style: [
|
|
2124
|
+
style: [styles10.pendingOverlay, { backgroundColor: theme.colors.background }],
|
|
2063
2125
|
testID: `${testID}${APP_SHELL_SUFFIX.pending}`,
|
|
2064
2126
|
children: /* @__PURE__ */ jsx(ActivityIndicator, { color: primary, size: "large" })
|
|
2065
2127
|
}
|
|
@@ -2120,6 +2182,45 @@ var CollapsedRail = ({
|
|
|
2120
2182
|
}
|
|
2121
2183
|
);
|
|
2122
2184
|
};
|
|
2185
|
+
function renderShellSidebar({ sideRail, nav, width, showBrand }) {
|
|
2186
|
+
const brandSlot = sideRail.brand ?? sideRail.title;
|
|
2187
|
+
return /* @__PURE__ */ jsx(
|
|
2188
|
+
Sidebar,
|
|
2189
|
+
{
|
|
2190
|
+
collapseHint: sideRail.collapseHint,
|
|
2191
|
+
containerStyle: sideRail.containerStyle,
|
|
2192
|
+
enableInlineSearch: sideRail.enableInlineSearch,
|
|
2193
|
+
expandHint: sideRail.expandHint,
|
|
2194
|
+
footer: sideRail.footer,
|
|
2195
|
+
header: sideRail.header,
|
|
2196
|
+
items: sideRail.items,
|
|
2197
|
+
navigateHint: nav.navigateHint,
|
|
2198
|
+
paletteTrigger: sideRail.paletteTrigger,
|
|
2199
|
+
pathname: nav.pathname,
|
|
2200
|
+
regionLabel: nav.regionLabel,
|
|
2201
|
+
renderChevron: sideRail.renderChevron,
|
|
2202
|
+
search: sideRail.search,
|
|
2203
|
+
searchQuery: sideRail.searchQuery,
|
|
2204
|
+
title: showBrand ? brandSlot : null,
|
|
2205
|
+
width,
|
|
2206
|
+
onNavigate: nav.onNavigate,
|
|
2207
|
+
onSearchChange: sideRail.onSearchChange
|
|
2208
|
+
}
|
|
2209
|
+
);
|
|
2210
|
+
}
|
|
2211
|
+
var styles11 = StyleSheet.create({
|
|
2212
|
+
row: { flexDirection: "row", alignItems: "center" },
|
|
2213
|
+
brand: { justifyContent: "center", paddingHorizontal: 12 },
|
|
2214
|
+
fill: { flex: 1 }
|
|
2215
|
+
});
|
|
2216
|
+
var TopbarBrandRow = ({ brand, brandWidth, testID, children }) => {
|
|
2217
|
+
const { width } = useWindowDimensions();
|
|
2218
|
+
if (width < RAIL_FULL_BREAKPOINT) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
2219
|
+
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 }),
|
|
2221
|
+
/* @__PURE__ */ jsx(View, { style: styles11.fill, children })
|
|
2222
|
+
] });
|
|
2223
|
+
};
|
|
2123
2224
|
function wantsTopBar(layout, hasHeader) {
|
|
2124
2225
|
return layout === "top" || layout === "both" || hasHeader;
|
|
2125
2226
|
}
|
|
@@ -2138,6 +2239,11 @@ var NavShell = ({
|
|
|
2138
2239
|
children,
|
|
2139
2240
|
collapsedSidebar: collapsedSidebarProp,
|
|
2140
2241
|
collapsedRailRange: collapsedRailRangeProp,
|
|
2242
|
+
brandPlacement = NAV_BRAND_DEFAULTS.brandPlacement,
|
|
2243
|
+
sidebarWidth = NAV_BRAND_DEFAULTS.sidebarWidth,
|
|
2244
|
+
drawerHeader = NAV_BRAND_DEFAULTS.drawerHeader,
|
|
2245
|
+
drawerWidth = NAV_BRAND_DEFAULTS.drawerWidth,
|
|
2246
|
+
mobileMenu,
|
|
2141
2247
|
...shellProps
|
|
2142
2248
|
}) => {
|
|
2143
2249
|
const showTopBar = wantsTopBar(layout, header !== void 0);
|
|
@@ -2163,28 +2269,13 @@ var NavShell = ({
|
|
|
2163
2269
|
onNavigate
|
|
2164
2270
|
}
|
|
2165
2271
|
) : null;
|
|
2166
|
-
const
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
footer: sideRail.footer,
|
|
2174
|
-
header: sideRail.header,
|
|
2175
|
-
items: sideRail.items,
|
|
2176
|
-
navigateHint,
|
|
2177
|
-
paletteTrigger: sideRail.paletteTrigger,
|
|
2178
|
-
pathname,
|
|
2179
|
-
regionLabel,
|
|
2180
|
-
renderChevron: sideRail.renderChevron,
|
|
2181
|
-
search: sideRail.search,
|
|
2182
|
-
searchQuery: sideRail.searchQuery,
|
|
2183
|
-
title: sideRail.brand ?? sideRail.title,
|
|
2184
|
-
onNavigate,
|
|
2185
|
-
onSearchChange: sideRail.onSearchChange
|
|
2186
|
-
}
|
|
2187
|
-
) : void 0;
|
|
2272
|
+
const nav = { pathname, onNavigate, regionLabel, navigateHint };
|
|
2273
|
+
const rail = showSideRail ? sideRail : void 0;
|
|
2274
|
+
const brandInBar = brandPlacement === "topbar" && rail?.brand !== void 0;
|
|
2275
|
+
const brandInDrawer = drawerHeader === "brand" ? rail?.brand : void 0;
|
|
2276
|
+
const sidebarNode = rail === void 0 ? void 0 : renderShellSidebar({ sideRail: rail, nav, width: sidebarWidth, showBrand: !brandInBar });
|
|
2277
|
+
const drawerSidebar = rail !== void 0 && brandInDrawer !== void 0 && !brandInBar ? renderShellSidebar({ sideRail: rail, nav, width: sidebarWidth, showBrand: false }) : void 0;
|
|
2278
|
+
const shellHeader = brandInBar ? /* @__PURE__ */ jsx(TopbarBrandRow, { brand: rail?.brand, brandWidth: SIDEBAR_WIDTH_PX[sidebarWidth], testID: `${shellProps.testID}-topbar-brand-row`, children: headerNode }) : headerNode;
|
|
2188
2279
|
const collapsedCfg = showSideRail ? sideRail?.collapsed : void 0;
|
|
2189
2280
|
const collapsedNode = collapsedCfg !== void 0 && sideRail !== void 0 ? /* @__PURE__ */ jsx(
|
|
2190
2281
|
CollapsedRail,
|
|
@@ -2205,7 +2296,8 @@ var NavShell = ({
|
|
|
2205
2296
|
...shellProps,
|
|
2206
2297
|
collapsedRailRange: collapsedRange,
|
|
2207
2298
|
collapsedSidebar: collapsedNode,
|
|
2208
|
-
header:
|
|
2299
|
+
header: shellHeader,
|
|
2300
|
+
mobileMenu: { ...mobileMenu, header: brandInDrawer, width: drawerWidth, sidebar: drawerSidebar },
|
|
2209
2301
|
sidebar: sidebarNode,
|
|
2210
2302
|
children
|
|
2211
2303
|
}
|
|
@@ -2428,7 +2520,7 @@ var KEY_DOWN = "ArrowDown";
|
|
|
2428
2520
|
var KEY_UP = "ArrowUp";
|
|
2429
2521
|
var KEY_ENTER = "Enter";
|
|
2430
2522
|
var KEY_ESCAPE = "Escape";
|
|
2431
|
-
var
|
|
2523
|
+
var styles12 = StyleSheet.create({
|
|
2432
2524
|
overlay: { ...StyleSheet.absoluteFillObject, zIndex: OVERLAY_Z_INDEX, alignItems: "center" },
|
|
2433
2525
|
scrim: { ...StyleSheet.absoluteFillObject, backgroundColor: SCRIM_COLOR2 },
|
|
2434
2526
|
panel: {
|
|
@@ -2457,14 +2549,14 @@ var PaletteRow = ({ item, selected, onChoose }) => {
|
|
|
2457
2549
|
accessibilityLabel: item.label,
|
|
2458
2550
|
accessibilityRole: "button",
|
|
2459
2551
|
accessibilityState: { selected },
|
|
2460
|
-
style: [
|
|
2552
|
+
style: [styles12.row, selected ? { backgroundColor: colors.border } : void 0],
|
|
2461
2553
|
testID: item.testID ?? item.key,
|
|
2462
2554
|
onPress: () => onChoose(item),
|
|
2463
2555
|
children: [
|
|
2464
2556
|
typeof item.renderIcon === "function" ? item.renderIcon(colors.textSecondary, NAV_ICON_SIZE) : null,
|
|
2465
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
2466
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
2467
|
-
item.hint ? /* @__PURE__ */ jsx(Text, { style: [
|
|
2557
|
+
/* @__PURE__ */ jsxs(View, { style: styles12.rowText, children: [
|
|
2558
|
+
/* @__PURE__ */ jsx(Text, { style: [styles12.rowLabel, { color: colors.text }], children: item.label }),
|
|
2559
|
+
item.hint ? /* @__PURE__ */ jsx(Text, { style: [styles12.rowHint, { color: colors.textSecondary }], children: item.hint }) : null
|
|
2468
2560
|
] })
|
|
2469
2561
|
]
|
|
2470
2562
|
}
|
|
@@ -2504,14 +2596,14 @@ var CommandPalette = ({ open, items, onClose, labels, testID }) => {
|
|
|
2504
2596
|
[results, selected, choose, onClose]
|
|
2505
2597
|
);
|
|
2506
2598
|
if (!open) return null;
|
|
2507
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
2599
|
+
return /* @__PURE__ */ jsxs(View, { style: styles12.overlay, children: [
|
|
2508
2600
|
/* @__PURE__ */ jsx(
|
|
2509
2601
|
Pressable,
|
|
2510
2602
|
{
|
|
2511
2603
|
accessibilityHint: labels.closeHint,
|
|
2512
2604
|
accessibilityLabel: labels.closeLabel,
|
|
2513
2605
|
accessibilityRole: "button",
|
|
2514
|
-
style:
|
|
2606
|
+
style: styles12.scrim,
|
|
2515
2607
|
testID: `${testID ?? "command-palette"}-scrim`,
|
|
2516
2608
|
onPress: onClose
|
|
2517
2609
|
}
|
|
@@ -2522,7 +2614,7 @@ var CommandPalette = ({ open, items, onClose, labels, testID }) => {
|
|
|
2522
2614
|
"aria-modal": true,
|
|
2523
2615
|
"aria-label": labels.regionLabel,
|
|
2524
2616
|
role: "dialog",
|
|
2525
|
-
style: [
|
|
2617
|
+
style: [styles12.panel, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
2526
2618
|
testID: testID ?? "command-palette",
|
|
2527
2619
|
children: [
|
|
2528
2620
|
/* @__PURE__ */ jsx(
|
|
@@ -2532,14 +2624,14 @@ var CommandPalette = ({ open, items, onClose, labels, testID }) => {
|
|
|
2532
2624
|
accessibilityLabel: labels.placeholder,
|
|
2533
2625
|
placeholder: labels.placeholder,
|
|
2534
2626
|
placeholderTextColor: colors.textSecondary,
|
|
2535
|
-
style: [
|
|
2627
|
+
style: [styles12.input, { color: colors.text, borderBottomColor: colors.border }],
|
|
2536
2628
|
testID: `${testID ?? "command-palette"}-input`,
|
|
2537
2629
|
value: query,
|
|
2538
2630
|
onChangeText: setQuery,
|
|
2539
2631
|
onKeyPress
|
|
2540
2632
|
}
|
|
2541
2633
|
),
|
|
2542
|
-
results.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [
|
|
2634
|
+
results.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles12.empty, { color: colors.textSecondary }], children: labels.emptyText }) : /* @__PURE__ */ jsx(ScrollView, { keyboardShouldPersistTaps: "handled", style: styles12.list, children: results.map((item, index) => /* @__PURE__ */ jsx(PaletteRow, { item, selected: index === selected, onChoose: choose }, item.key)) })
|
|
2543
2635
|
]
|
|
2544
2636
|
}
|
|
2545
2637
|
)
|
|
@@ -2644,7 +2736,7 @@ var TAB_MIN_HEIGHT = 56;
|
|
|
2644
2736
|
var LABEL_SIZE = 12;
|
|
2645
2737
|
var LABEL_GAP = 2;
|
|
2646
2738
|
var TAB_PADDING = 4;
|
|
2647
|
-
var
|
|
2739
|
+
var styles13 = StyleSheet.create({
|
|
2648
2740
|
tab: {
|
|
2649
2741
|
flex: 1,
|
|
2650
2742
|
minHeight: TAB_MIN_HEIGHT,
|
|
@@ -2681,31 +2773,31 @@ var BottomTab = ({
|
|
|
2681
2773
|
accessibilityLabel: item.label,
|
|
2682
2774
|
accessibilityRole: "link",
|
|
2683
2775
|
accessibilityState: { selected: isActive },
|
|
2684
|
-
style: [
|
|
2776
|
+
style: [styles13.tab, { opacity: feedback.opacity }],
|
|
2685
2777
|
testID: item.testID ?? item.key,
|
|
2686
2778
|
onPress: () => onPress(item.route),
|
|
2687
2779
|
onPressIn: () => setPressed(true),
|
|
2688
2780
|
onPressOut: () => setPressed(false),
|
|
2689
2781
|
...ariaCurrentProps3(isActive),
|
|
2690
2782
|
children: [
|
|
2691
|
-
/* @__PURE__ */ jsxs(Animated.View, { style: [
|
|
2783
|
+
/* @__PURE__ */ jsxs(Animated.View, { style: [styles13.iconWrap, { transform: [{ scale }] }], children: [
|
|
2692
2784
|
feedback.pillScale === null ? null : /* @__PURE__ */ jsx(
|
|
2693
2785
|
View,
|
|
2694
2786
|
{
|
|
2695
2787
|
pointerEvents: "none",
|
|
2696
|
-
style: [
|
|
2788
|
+
style: [styles13.pill, { backgroundColor: colors.pill, transform: [{ scale: feedback.pillScale }] }, motion]
|
|
2697
2789
|
}
|
|
2698
2790
|
),
|
|
2699
2791
|
/* @__PURE__ */ jsx(View, { style: [{ transform: feedback.iconTransform }, motion], children: item.renderIcon?.(color, ICON_SIZE) })
|
|
2700
2792
|
] }),
|
|
2701
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
2793
|
+
/* @__PURE__ */ jsx(Text, { style: [styles13.label, { color }], children: item.label })
|
|
2702
2794
|
]
|
|
2703
2795
|
}
|
|
2704
2796
|
);
|
|
2705
2797
|
};
|
|
2706
2798
|
var DEFAULT_TEST_ID = "bottom-tab-bar";
|
|
2707
2799
|
var SLIDER_HEIGHT = 3;
|
|
2708
|
-
var
|
|
2800
|
+
var styles14 = StyleSheet.create({
|
|
2709
2801
|
bar: { flexDirection: "row", borderTopWidth: StyleSheet.hairlineWidth },
|
|
2710
2802
|
slider: { position: "absolute", top: 0, height: SLIDER_HEIGHT }
|
|
2711
2803
|
});
|
|
@@ -2732,14 +2824,14 @@ var BottomTabBar = ({
|
|
|
2732
2824
|
{
|
|
2733
2825
|
"aria-label": regionLabel,
|
|
2734
2826
|
role: "navigation",
|
|
2735
|
-
style: [
|
|
2827
|
+
style: [styles14.bar, { backgroundColor: theme.colors.surface, borderTopColor: theme.colors.border }, containerStyle],
|
|
2736
2828
|
testID,
|
|
2737
2829
|
children: [
|
|
2738
2830
|
bar === null ? null : /* @__PURE__ */ jsx(
|
|
2739
2831
|
View,
|
|
2740
2832
|
{
|
|
2741
2833
|
pointerEvents: "none",
|
|
2742
|
-
style: [
|
|
2834
|
+
style: [styles14.slider, { left: bar.left, width: bar.width, backgroundColor: primary }, webTransition("left", barMs, reducedMotion)]
|
|
2743
2835
|
}
|
|
2744
2836
|
),
|
|
2745
2837
|
items.map((item) => /* @__PURE__ */ jsx(
|
|
@@ -2760,6 +2852,6 @@ var BottomTabBar = ({
|
|
|
2760
2852
|
);
|
|
2761
2853
|
};
|
|
2762
2854
|
|
|
2763
|
-
export { ACTIVE_BORDER_RADIUS, ACTIVE_TINT_OPACITY, APP_SHELL_SUFFIX, AppShell, BASE_INDENT, BottomTabBar, BrandHomeLink, BrandMark, CHEVRON_ICON_SIZE, CollapsedRail, CommandPalette, CommandPaletteTrigger, DEFAULT_COLLAPSED_RAIL_MAX, DEFAULT_SEARCH_BREAKPOINT, DarkModeControl, HOVER_TINT_OPACITY, NAV_ICON_SIZE, NAV_LINK_GAP, NAV_ROW_RADIUS, NAV_TEST_IDS, Nav, NavBar, NavExpandableItem, NavHoverFeedback, NavOverflowMenu, NavShell, PillNav, PillNavVariant, RAIL_FULL_BREAKPOINT, Sidebar, SidebarChevron, SidebarSearch, TabFeedback, Topbar, accessibleNavItems, collapsedRailStyles, darkModeStyles, expandableStyles, filterCommands, filterNavItems, isFilterActive, isRouteActive, navStyles, pillNavStyles, resolveActiveRoute, resolveContentMaxWidth, resolvePillMenuLabel, resolveRailMode, resolveSearchAffordance, roleRoutesToNavItems, searchTokens, useCommandPaletteHotkey, useContentMaxWidth };
|
|
2855
|
+
export { ACTIVE_BORDER_RADIUS, ACTIVE_TINT_OPACITY, APP_SHELL_SUFFIX, AppShell, BASE_INDENT, BottomTabBar, BrandHomeLink, BrandMark, CHEVRON_ICON_SIZE, CollapsedRail, CommandPalette, CommandPaletteTrigger, DEFAULT_COLLAPSED_RAIL_MAX, DEFAULT_SEARCH_BREAKPOINT, DarkModeControl, HOVER_TINT_OPACITY, NAV_BRAND_DEFAULTS, NAV_ICON_SIZE, NAV_LINK_GAP, NAV_ROW_RADIUS, NAV_TEST_IDS, Nav, NavBar, NavExpandableItem, NavHoverFeedback, NavOverflowMenu, NavShell, PillNav, PillNavVariant, RAIL_FULL_BREAKPOINT, SIDEBAR_WIDTH_PX, Sidebar, SidebarChevron, SidebarSearch, TabFeedback, Topbar, accessibleNavItems, collapsedRailStyles, darkModeStyles, expandableStyles, filterCommands, filterNavItems, isFilterActive, isRouteActive, navStyles, pillNavStyles, resolveActiveRoute, resolveContentMaxWidth, resolvePillMenuLabel, resolveRailMode, resolveSearchAffordance, roleRoutesToNavItems, searchTokens, useCommandPaletteHotkey, useContentMaxWidth };
|
|
2764
2856
|
//# sourceMappingURL=index.mjs.map
|
|
2765
2857
|
//# sourceMappingURL=index.mjs.map
|