@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/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { StyleSheet, Platform, Pressable, Text, View, TextInput, useWindowDimens
|
|
|
3
3
|
import { useUi, UiProvider } from '@dloizides/ui-feedback';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
import { Collapse } from '@dloizides/ui-motion';
|
|
6
|
-
import { LAYOUT_COLLAPSE_BREAKPOINT, ModalDropdown } from '@dloizides/ui-layout';
|
|
6
|
+
import { LAYOUT_COLLAPSE_BREAKPOINT, ModalDropdown, DropdownVariant, SelectedMarker } from '@dloizides/ui-layout';
|
|
7
7
|
import { Z_INDEX } from '@dloizides/design-tokens';
|
|
8
8
|
import { resolveAccessibleRoutes } from '@dloizides/auth-web';
|
|
9
9
|
|
|
@@ -220,7 +220,8 @@ var pillNavStyles = StyleSheet.create({
|
|
|
220
220
|
justifyContent: "center"
|
|
221
221
|
},
|
|
222
222
|
pillText: { fontSize: 14, fontWeight: "600" },
|
|
223
|
-
menuTriggerText: { flexShrink: 1 }
|
|
223
|
+
menuTriggerText: { flexShrink: 1 },
|
|
224
|
+
pillOutline: { borderWidth: 2 }
|
|
224
225
|
});
|
|
225
226
|
var darkModeStyles = StyleSheet.create({
|
|
226
227
|
// Segmented Light / Dark / System control.
|
|
@@ -1868,7 +1869,6 @@ function resolvePillMenuLabel(items, pathname, fallback) {
|
|
|
1868
1869
|
const active = items.find((item) => item.route === activeRoute);
|
|
1869
1870
|
return active?.label ?? fallback;
|
|
1870
1871
|
}
|
|
1871
|
-
var TEXT_ON_PRIMARY4 = "#ffffff";
|
|
1872
1872
|
var NO_ACTIVE_ROUTE2 = "";
|
|
1873
1873
|
var PILL_MENU_MIN_WIDTH = 200;
|
|
1874
1874
|
var PillNavMenu = ({
|
|
@@ -1878,10 +1878,11 @@ var PillNavMenu = ({
|
|
|
1878
1878
|
regionLabel,
|
|
1879
1879
|
hint,
|
|
1880
1880
|
testID = NAV_TEST_IDS.pillNavMenu,
|
|
1881
|
-
dropdownVariant
|
|
1881
|
+
dropdownVariant,
|
|
1882
|
+
menuHeading
|
|
1882
1883
|
}) => {
|
|
1883
1884
|
const { theme } = useUi();
|
|
1884
|
-
const
|
|
1885
|
+
const { colors } = theme;
|
|
1885
1886
|
const options = useMemo(() => items.map((item) => ({ label: item.label, value: item.route })), [items]);
|
|
1886
1887
|
const activeRoute = resolveActiveRoute(items, pathname) ?? NO_ACTIVE_ROUTE2;
|
|
1887
1888
|
const label = resolvePillMenuLabel(items, pathname, regionLabel);
|
|
@@ -1894,16 +1895,18 @@ var PillNavMenu = ({
|
|
|
1894
1895
|
{
|
|
1895
1896
|
accessibilityHint: hint,
|
|
1896
1897
|
accessibilityLabel: label,
|
|
1898
|
+
menuHeading,
|
|
1897
1899
|
menuMinWidth: PILL_MENU_MIN_WIDTH,
|
|
1898
1900
|
optionTestID,
|
|
1899
1901
|
options,
|
|
1900
1902
|
testID,
|
|
1901
1903
|
value: activeRoute,
|
|
1902
|
-
|
|
1904
|
+
selectedMarker: SelectedMarker.AccentCheck,
|
|
1905
|
+
variant: dropdownVariant ?? DropdownVariant.Menu,
|
|
1903
1906
|
onChange: onNavigate,
|
|
1904
|
-
renderTrigger: ({ isOpen }) => /* @__PURE__ */ jsxs(View, { style: [pillNavStyles.pill, { backgroundColor:
|
|
1905
|
-
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [pillNavStyles.pillText, pillNavStyles.menuTriggerText, { color:
|
|
1906
|
-
/* @__PURE__ */ jsx(Text, { style: [pillNavStyles.pillText, { color:
|
|
1907
|
+
renderTrigger: ({ isOpen }) => /* @__PURE__ */ jsxs(View, { style: [pillNavStyles.pill, pillNavStyles.pillOutline, { backgroundColor: colors.background, borderColor: colors.text }], children: [
|
|
1908
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [pillNavStyles.pillText, pillNavStyles.menuTriggerText, { color: colors.text }], children: label }),
|
|
1909
|
+
/* @__PURE__ */ jsx(Text, { style: [pillNavStyles.pillText, { color: colors.text }], children: isOpen ? "\u25B4" : "\u25BE" })
|
|
1907
1910
|
] })
|
|
1908
1911
|
}
|
|
1909
1912
|
);
|
|
@@ -1915,7 +1918,7 @@ var PillNavVariant = /* @__PURE__ */ ((PillNavVariant2) => {
|
|
|
1915
1918
|
PillNavVariant2["Menu"] = "menu";
|
|
1916
1919
|
return PillNavVariant2;
|
|
1917
1920
|
})(PillNavVariant || {});
|
|
1918
|
-
var
|
|
1921
|
+
var TEXT_ON_PRIMARY4 = "#ffffff";
|
|
1919
1922
|
var DEFAULT_MIN_ITEMS = 1;
|
|
1920
1923
|
var PillNav = ({
|
|
1921
1924
|
items,
|
|
@@ -1926,6 +1929,7 @@ var PillNav = ({
|
|
|
1926
1929
|
minItems = DEFAULT_MIN_ITEMS,
|
|
1927
1930
|
variant = "pills" /* Pills */,
|
|
1928
1931
|
menuHint,
|
|
1932
|
+
menuHeading,
|
|
1929
1933
|
menuTestID,
|
|
1930
1934
|
dropdownVariant,
|
|
1931
1935
|
containerStyle
|
|
@@ -1941,6 +1945,7 @@ var PillNav = ({
|
|
|
1941
1945
|
dropdownVariant,
|
|
1942
1946
|
hint: menuHint ?? regionLabel,
|
|
1943
1947
|
items,
|
|
1948
|
+
menuHeading,
|
|
1944
1949
|
pathname,
|
|
1945
1950
|
regionLabel,
|
|
1946
1951
|
testID: menuTestID,
|
|
@@ -1957,7 +1962,7 @@ var PillNav = ({
|
|
|
1957
1962
|
style: [pillNavStyles.container, containerStyle],
|
|
1958
1963
|
children: items.map((item) => {
|
|
1959
1964
|
const active = item.route === activeRoute;
|
|
1960
|
-
const textColor = active ?
|
|
1965
|
+
const textColor = active ? TEXT_ON_PRIMARY4 : colors.textSecondary;
|
|
1961
1966
|
const pillStyle = active ? { backgroundColor: primaryColor } : { backgroundColor: colors.surfaceElevated };
|
|
1962
1967
|
return /* @__PURE__ */ jsxs(
|
|
1963
1968
|
FocusableTouchable,
|
|
@@ -1980,7 +1985,7 @@ var PillNav = ({
|
|
|
1980
1985
|
}
|
|
1981
1986
|
);
|
|
1982
1987
|
};
|
|
1983
|
-
var
|
|
1988
|
+
var TEXT_ON_PRIMARY5 = "#ffffff";
|
|
1984
1989
|
var DARK_MODE_ICON_SIZE = 16;
|
|
1985
1990
|
var DarkModeControl = ({
|
|
1986
1991
|
value,
|
|
@@ -2029,7 +2034,7 @@ var DarkModeControl = ({
|
|
|
2029
2034
|
style: [darkModeStyles.segmentRow, { borderColor: colors.border }, containerStyle],
|
|
2030
2035
|
children: options.map((option) => {
|
|
2031
2036
|
const active = option.value === value;
|
|
2032
|
-
const textColor = active ?
|
|
2037
|
+
const textColor = active ? TEXT_ON_PRIMARY5 : colors.textSecondary;
|
|
2033
2038
|
return /* @__PURE__ */ jsxs(
|
|
2034
2039
|
FocusableTouchable,
|
|
2035
2040
|
{
|