@dloizides/ui-nav 1.24.0 → 1.26.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/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.25.0
|
|
4
|
+
|
|
5
|
+
- `PillNav` / `PillNavMenu` get an optional `menuHeading`: a visible, non-focusable heading at the top of the open `Menu` that also names it (needs `@dloizides/ui-layout` >= 1.30.0) (KEFI-EDITOR-HEADER-1 "Compact the landing editor header").
|
|
6
|
+
|
|
3
7
|
## 1.24.0
|
|
4
8
|
|
|
5
9
|
- `Topbar` gets an optional `center` slot between `left` and the actions (testID `topbar-center`); callers that do not pass it render as before (KEFI-EDITOR-HEADER-1 "Compact the landing editor header").
|
package/dist/index.d.mts
CHANGED
|
@@ -941,6 +941,8 @@ interface PillNavProps {
|
|
|
941
941
|
variant?: PillNavVariant;
|
|
942
942
|
/** a11y hint for the `Menu` trigger. Defaults to `regionLabel`. */
|
|
943
943
|
menuHint?: string;
|
|
944
|
+
/** Visible heading at the top of the open `Menu` (e.g. "Your dashboards"); also names the menu. */
|
|
945
|
+
menuHeading?: string;
|
|
944
946
|
/** testID for the `Menu` trigger. Defaults to `NAV_TEST_IDS.pillNavMenu`. */
|
|
945
947
|
menuTestID?: string;
|
|
946
948
|
/** Forces the `Menu` dropdown variant (default: responsive). */
|
|
@@ -948,7 +950,7 @@ interface PillNavProps {
|
|
|
948
950
|
/** Extra container style overrides. */
|
|
949
951
|
containerStyle?: ViewStyle | ViewStyle[];
|
|
950
952
|
}
|
|
951
|
-
declare const PillNav: ({ items, pathname, onNavigate, regionLabel, navigateHint, minItems, variant, menuHint, menuTestID, dropdownVariant, containerStyle, }: PillNavProps) => React.ReactElement | null;
|
|
953
|
+
declare const PillNav: ({ items, pathname, onNavigate, regionLabel, navigateHint, minItems, variant, menuHint, menuHeading, menuTestID, dropdownVariant, containerStyle, }: PillNavProps) => React.ReactElement | null;
|
|
952
954
|
|
|
953
955
|
/** The label the compact menu trigger shows: the active item's label, else `fallback`. */
|
|
954
956
|
declare function resolvePillMenuLabel(items: NavItem[], pathname: string, fallback: string): string;
|
|
@@ -1446,6 +1448,9 @@ declare const pillNavStyles: {
|
|
|
1446
1448
|
menuTriggerText: {
|
|
1447
1449
|
flexShrink: number;
|
|
1448
1450
|
};
|
|
1451
|
+
pillOutline: {
|
|
1452
|
+
borderWidth: number;
|
|
1453
|
+
};
|
|
1449
1454
|
};
|
|
1450
1455
|
declare const darkModeStyles: {
|
|
1451
1456
|
segmentRow: {
|
package/dist/index.d.ts
CHANGED
|
@@ -941,6 +941,8 @@ interface PillNavProps {
|
|
|
941
941
|
variant?: PillNavVariant;
|
|
942
942
|
/** a11y hint for the `Menu` trigger. Defaults to `regionLabel`. */
|
|
943
943
|
menuHint?: string;
|
|
944
|
+
/** Visible heading at the top of the open `Menu` (e.g. "Your dashboards"); also names the menu. */
|
|
945
|
+
menuHeading?: string;
|
|
944
946
|
/** testID for the `Menu` trigger. Defaults to `NAV_TEST_IDS.pillNavMenu`. */
|
|
945
947
|
menuTestID?: string;
|
|
946
948
|
/** Forces the `Menu` dropdown variant (default: responsive). */
|
|
@@ -948,7 +950,7 @@ interface PillNavProps {
|
|
|
948
950
|
/** Extra container style overrides. */
|
|
949
951
|
containerStyle?: ViewStyle | ViewStyle[];
|
|
950
952
|
}
|
|
951
|
-
declare const PillNav: ({ items, pathname, onNavigate, regionLabel, navigateHint, minItems, variant, menuHint, menuTestID, dropdownVariant, containerStyle, }: PillNavProps) => React.ReactElement | null;
|
|
953
|
+
declare const PillNav: ({ items, pathname, onNavigate, regionLabel, navigateHint, minItems, variant, menuHint, menuHeading, menuTestID, dropdownVariant, containerStyle, }: PillNavProps) => React.ReactElement | null;
|
|
952
954
|
|
|
953
955
|
/** The label the compact menu trigger shows: the active item's label, else `fallback`. */
|
|
954
956
|
declare function resolvePillMenuLabel(items: NavItem[], pathname: string, fallback: string): string;
|
|
@@ -1446,6 +1448,9 @@ declare const pillNavStyles: {
|
|
|
1446
1448
|
menuTriggerText: {
|
|
1447
1449
|
flexShrink: number;
|
|
1448
1450
|
};
|
|
1451
|
+
pillOutline: {
|
|
1452
|
+
borderWidth: number;
|
|
1453
|
+
};
|
|
1449
1454
|
};
|
|
1450
1455
|
declare const darkModeStyles: {
|
|
1451
1456
|
segmentRow: {
|
package/dist/index.js
CHANGED
|
@@ -226,7 +226,8 @@ var pillNavStyles = reactNative.StyleSheet.create({
|
|
|
226
226
|
justifyContent: "center"
|
|
227
227
|
},
|
|
228
228
|
pillText: { fontSize: 14, fontWeight: "600" },
|
|
229
|
-
menuTriggerText: { flexShrink: 1 }
|
|
229
|
+
menuTriggerText: { flexShrink: 1 },
|
|
230
|
+
pillOutline: { borderWidth: 2 }
|
|
230
231
|
});
|
|
231
232
|
var darkModeStyles = reactNative.StyleSheet.create({
|
|
232
233
|
// Segmented Light / Dark / System control.
|
|
@@ -1874,7 +1875,6 @@ function resolvePillMenuLabel(items, pathname, fallback) {
|
|
|
1874
1875
|
const active = items.find((item) => item.route === activeRoute);
|
|
1875
1876
|
return active?.label ?? fallback;
|
|
1876
1877
|
}
|
|
1877
|
-
var TEXT_ON_PRIMARY4 = "#ffffff";
|
|
1878
1878
|
var NO_ACTIVE_ROUTE2 = "";
|
|
1879
1879
|
var PILL_MENU_MIN_WIDTH = 200;
|
|
1880
1880
|
var PillNavMenu = ({
|
|
@@ -1884,10 +1884,11 @@ var PillNavMenu = ({
|
|
|
1884
1884
|
regionLabel,
|
|
1885
1885
|
hint,
|
|
1886
1886
|
testID = NAV_TEST_IDS.pillNavMenu,
|
|
1887
|
-
dropdownVariant
|
|
1887
|
+
dropdownVariant,
|
|
1888
|
+
menuHeading
|
|
1888
1889
|
}) => {
|
|
1889
1890
|
const { theme } = uiFeedback.useUi();
|
|
1890
|
-
const
|
|
1891
|
+
const { colors } = theme;
|
|
1891
1892
|
const options = React.useMemo(() => items.map((item) => ({ label: item.label, value: item.route })), [items]);
|
|
1892
1893
|
const activeRoute = resolveActiveRoute(items, pathname) ?? NO_ACTIVE_ROUTE2;
|
|
1893
1894
|
const label = resolvePillMenuLabel(items, pathname, regionLabel);
|
|
@@ -1900,16 +1901,18 @@ var PillNavMenu = ({
|
|
|
1900
1901
|
{
|
|
1901
1902
|
accessibilityHint: hint,
|
|
1902
1903
|
accessibilityLabel: label,
|
|
1904
|
+
menuHeading,
|
|
1903
1905
|
menuMinWidth: PILL_MENU_MIN_WIDTH,
|
|
1904
1906
|
optionTestID,
|
|
1905
1907
|
options,
|
|
1906
1908
|
testID,
|
|
1907
1909
|
value: activeRoute,
|
|
1908
|
-
|
|
1910
|
+
selectedMarker: uiLayout.SelectedMarker.AccentCheck,
|
|
1911
|
+
variant: dropdownVariant ?? uiLayout.DropdownVariant.Menu,
|
|
1909
1912
|
onChange: onNavigate,
|
|
1910
|
-
renderTrigger: ({ isOpen }) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [pillNavStyles.pill, { backgroundColor:
|
|
1911
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [pillNavStyles.pillText, pillNavStyles.menuTriggerText, { color:
|
|
1912
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [pillNavStyles.pillText, { color:
|
|
1913
|
+
renderTrigger: ({ isOpen }) => /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [pillNavStyles.pill, pillNavStyles.pillOutline, { backgroundColor: colors.background, borderColor: colors.text }], children: [
|
|
1914
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [pillNavStyles.pillText, pillNavStyles.menuTriggerText, { color: colors.text }], children: label }),
|
|
1915
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [pillNavStyles.pillText, { color: colors.text }], children: isOpen ? "\u25B4" : "\u25BE" })
|
|
1913
1916
|
] })
|
|
1914
1917
|
}
|
|
1915
1918
|
);
|
|
@@ -1921,7 +1924,7 @@ var PillNavVariant = /* @__PURE__ */ ((PillNavVariant2) => {
|
|
|
1921
1924
|
PillNavVariant2["Menu"] = "menu";
|
|
1922
1925
|
return PillNavVariant2;
|
|
1923
1926
|
})(PillNavVariant || {});
|
|
1924
|
-
var
|
|
1927
|
+
var TEXT_ON_PRIMARY4 = "#ffffff";
|
|
1925
1928
|
var DEFAULT_MIN_ITEMS = 1;
|
|
1926
1929
|
var PillNav = ({
|
|
1927
1930
|
items,
|
|
@@ -1932,6 +1935,7 @@ var PillNav = ({
|
|
|
1932
1935
|
minItems = DEFAULT_MIN_ITEMS,
|
|
1933
1936
|
variant = "pills" /* Pills */,
|
|
1934
1937
|
menuHint,
|
|
1938
|
+
menuHeading,
|
|
1935
1939
|
menuTestID,
|
|
1936
1940
|
dropdownVariant,
|
|
1937
1941
|
containerStyle
|
|
@@ -1947,6 +1951,7 @@ var PillNav = ({
|
|
|
1947
1951
|
dropdownVariant,
|
|
1948
1952
|
hint: menuHint ?? regionLabel,
|
|
1949
1953
|
items,
|
|
1954
|
+
menuHeading,
|
|
1950
1955
|
pathname,
|
|
1951
1956
|
regionLabel,
|
|
1952
1957
|
testID: menuTestID,
|
|
@@ -1963,7 +1968,7 @@ var PillNav = ({
|
|
|
1963
1968
|
style: [pillNavStyles.container, containerStyle],
|
|
1964
1969
|
children: items.map((item) => {
|
|
1965
1970
|
const active = item.route === activeRoute;
|
|
1966
|
-
const textColor = active ?
|
|
1971
|
+
const textColor = active ? TEXT_ON_PRIMARY4 : colors.textSecondary;
|
|
1967
1972
|
const pillStyle = active ? { backgroundColor: primaryColor } : { backgroundColor: colors.surfaceElevated };
|
|
1968
1973
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1969
1974
|
FocusableTouchable,
|
|
@@ -1986,7 +1991,7 @@ var PillNav = ({
|
|
|
1986
1991
|
}
|
|
1987
1992
|
);
|
|
1988
1993
|
};
|
|
1989
|
-
var
|
|
1994
|
+
var TEXT_ON_PRIMARY5 = "#ffffff";
|
|
1990
1995
|
var DARK_MODE_ICON_SIZE = 16;
|
|
1991
1996
|
var DarkModeControl = ({
|
|
1992
1997
|
value,
|
|
@@ -2035,7 +2040,7 @@ var DarkModeControl = ({
|
|
|
2035
2040
|
style: [darkModeStyles.segmentRow, { borderColor: colors.border }, containerStyle],
|
|
2036
2041
|
children: options.map((option) => {
|
|
2037
2042
|
const active = option.value === value;
|
|
2038
|
-
const textColor = active ?
|
|
2043
|
+
const textColor = active ? TEXT_ON_PRIMARY5 : colors.textSecondary;
|
|
2039
2044
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2040
2045
|
FocusableTouchable,
|
|
2041
2046
|
{
|