@dloizides/ui-nav 1.12.0 → 1.13.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/dist/index.d.mts +30 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -972,6 +972,35 @@ interface CommandPaletteProps {
|
|
|
972
972
|
/** The overlay palette. Renders null when closed. */
|
|
973
973
|
declare const CommandPalette: ({ open, items, onClose, labels, testID }: CommandPaletteProps) => React.ReactElement | null;
|
|
974
974
|
|
|
975
|
+
/**
|
|
976
|
+
* CommandPaletteTrigger — the VISIBLE, discoverable affordance that opens the
|
|
977
|
+
* {@link CommandPalette}. A ⌘K shortcut alone is invisible; a docs-style search
|
|
978
|
+
* pill (muted placeholder on the left, a keyboard-shortcut badge on the right)
|
|
979
|
+
* tells operators the palette exists and is one click away. Place it in a shell
|
|
980
|
+
* header / sidebar; wire `onPress` to the same open handler as the ⌘K hotkey.
|
|
981
|
+
*
|
|
982
|
+
* Self-contained on purpose: the shared icon set has no magnifier, so this uses
|
|
983
|
+
* text + a shortcut badge (the recognizable "Search … ⌘K" pattern) rather than a
|
|
984
|
+
* render-slot icon — one less thing every consumer must supply. Colours come from
|
|
985
|
+
* the `@dloizides/ui-feedback` UiProvider theme; the label/shortcut are
|
|
986
|
+
* pre-localized strings (package discipline: no FM/router imports).
|
|
987
|
+
*/
|
|
988
|
+
|
|
989
|
+
interface CommandPaletteTriggerProps {
|
|
990
|
+
/** Placeholder-style label, e.g. "Search". */
|
|
991
|
+
label: string;
|
|
992
|
+
/** a11y hint describing what activating it does. */
|
|
993
|
+
hint: string;
|
|
994
|
+
/** The shortcut badge text, e.g. "⌘K" (already chosen per-platform by the caller). */
|
|
995
|
+
shortcut: string;
|
|
996
|
+
/** Open the palette (same handler as the ⌘K hotkey). */
|
|
997
|
+
onPress: () => void;
|
|
998
|
+
/** testID for the trigger. */
|
|
999
|
+
testID: string;
|
|
1000
|
+
}
|
|
1001
|
+
/** The visible "Search … ⌘K" pill that opens the command palette. */
|
|
1002
|
+
declare const CommandPaletteTrigger: ({ label, hint, shortcut, onPress, testID, }: CommandPaletteTriggerProps) => React.ReactElement;
|
|
1003
|
+
|
|
975
1004
|
/**
|
|
976
1005
|
* Call `onOpen` when the operator presses ⌘K (macOS) or Ctrl-K (Windows/Linux),
|
|
977
1006
|
* anywhere in the document. `enabled=false` unbinds (e.g. when the shell has no
|
|
@@ -1232,4 +1261,4 @@ declare const NAV_ICON_SIZE = 14;
|
|
|
1232
1261
|
/** Chevron icon size for expandable sections. */
|
|
1233
1262
|
declare const CHEVRON_ICON_SIZE = 12;
|
|
1234
1263
|
|
|
1235
|
-
export { ACTIVE_BORDER_RADIUS, APP_SHELL_SUFFIX, type AccountPlan, type AccountState, AppShell, type AppShellProps, type AppShellWidth, BASE_INDENT, CHEVRON_ICON_SIZE, CollapsedRail, type CollapsedRailProps, type CollapsedRailRange, type CommandItem, CommandPalette, type CommandPaletteLabels, type CommandPaletteProps, DEFAULT_COLLAPSED_RAIL_MAX, DarkModeControl, type DarkModeControlProps, type DarkModeOption, type DarkModeVariant, NAV_ICON_SIZE, NAV_LINK_GAP, NAV_TEST_IDS, Nav, NavBar, type NavBarProps, NavExpandableItem, type NavExpandableItemProps, type NavItem, type NavOrientation, NavOverflowMenu, type NavOverflowMenuProps, type NavProps, NavShell, type NavShellCollapsedRail, type NavShellLayout, type NavShellProps, type NavShellSideRail, type NavShellTopBar, type NavUser, PillNav, type PillNavProps, RAIL_FULL_BREAKPOINT, type RailMode, type ResolveRailModeArgs, type ShellMessage, Sidebar, type SidebarProps, Topbar, type TopbarAction, type TopbarProps, type TopbarUser, accessibleNavItems, collapsedRailStyles, darkModeStyles, expandableStyles, filterCommands, isRouteActive, navStyles, pillNavStyles, resolveContentMaxWidth, resolveRailMode, roleRoutesToNavItems, useCommandPaletteHotkey, useContentMaxWidth };
|
|
1264
|
+
export { ACTIVE_BORDER_RADIUS, APP_SHELL_SUFFIX, type AccountPlan, type AccountState, AppShell, type AppShellProps, type AppShellWidth, BASE_INDENT, CHEVRON_ICON_SIZE, CollapsedRail, type CollapsedRailProps, type CollapsedRailRange, type CommandItem, CommandPalette, type CommandPaletteLabels, type CommandPaletteProps, CommandPaletteTrigger, type CommandPaletteTriggerProps, DEFAULT_COLLAPSED_RAIL_MAX, DarkModeControl, type DarkModeControlProps, type DarkModeOption, type DarkModeVariant, NAV_ICON_SIZE, NAV_LINK_GAP, NAV_TEST_IDS, Nav, NavBar, type NavBarProps, NavExpandableItem, type NavExpandableItemProps, type NavItem, type NavOrientation, NavOverflowMenu, type NavOverflowMenuProps, type NavProps, NavShell, type NavShellCollapsedRail, type NavShellLayout, type NavShellProps, type NavShellSideRail, type NavShellTopBar, type NavUser, PillNav, type PillNavProps, RAIL_FULL_BREAKPOINT, type RailMode, type ResolveRailModeArgs, type ShellMessage, Sidebar, type SidebarProps, Topbar, type TopbarAction, type TopbarProps, type TopbarUser, accessibleNavItems, collapsedRailStyles, darkModeStyles, expandableStyles, filterCommands, isRouteActive, navStyles, pillNavStyles, resolveContentMaxWidth, resolveRailMode, roleRoutesToNavItems, useCommandPaletteHotkey, useContentMaxWidth };
|
package/dist/index.d.ts
CHANGED
|
@@ -972,6 +972,35 @@ interface CommandPaletteProps {
|
|
|
972
972
|
/** The overlay palette. Renders null when closed. */
|
|
973
973
|
declare const CommandPalette: ({ open, items, onClose, labels, testID }: CommandPaletteProps) => React.ReactElement | null;
|
|
974
974
|
|
|
975
|
+
/**
|
|
976
|
+
* CommandPaletteTrigger — the VISIBLE, discoverable affordance that opens the
|
|
977
|
+
* {@link CommandPalette}. A ⌘K shortcut alone is invisible; a docs-style search
|
|
978
|
+
* pill (muted placeholder on the left, a keyboard-shortcut badge on the right)
|
|
979
|
+
* tells operators the palette exists and is one click away. Place it in a shell
|
|
980
|
+
* header / sidebar; wire `onPress` to the same open handler as the ⌘K hotkey.
|
|
981
|
+
*
|
|
982
|
+
* Self-contained on purpose: the shared icon set has no magnifier, so this uses
|
|
983
|
+
* text + a shortcut badge (the recognizable "Search … ⌘K" pattern) rather than a
|
|
984
|
+
* render-slot icon — one less thing every consumer must supply. Colours come from
|
|
985
|
+
* the `@dloizides/ui-feedback` UiProvider theme; the label/shortcut are
|
|
986
|
+
* pre-localized strings (package discipline: no FM/router imports).
|
|
987
|
+
*/
|
|
988
|
+
|
|
989
|
+
interface CommandPaletteTriggerProps {
|
|
990
|
+
/** Placeholder-style label, e.g. "Search". */
|
|
991
|
+
label: string;
|
|
992
|
+
/** a11y hint describing what activating it does. */
|
|
993
|
+
hint: string;
|
|
994
|
+
/** The shortcut badge text, e.g. "⌘K" (already chosen per-platform by the caller). */
|
|
995
|
+
shortcut: string;
|
|
996
|
+
/** Open the palette (same handler as the ⌘K hotkey). */
|
|
997
|
+
onPress: () => void;
|
|
998
|
+
/** testID for the trigger. */
|
|
999
|
+
testID: string;
|
|
1000
|
+
}
|
|
1001
|
+
/** The visible "Search … ⌘K" pill that opens the command palette. */
|
|
1002
|
+
declare const CommandPaletteTrigger: ({ label, hint, shortcut, onPress, testID, }: CommandPaletteTriggerProps) => React.ReactElement;
|
|
1003
|
+
|
|
975
1004
|
/**
|
|
976
1005
|
* Call `onOpen` when the operator presses ⌘K (macOS) or Ctrl-K (Windows/Linux),
|
|
977
1006
|
* anywhere in the document. `enabled=false` unbinds (e.g. when the shell has no
|
|
@@ -1232,4 +1261,4 @@ declare const NAV_ICON_SIZE = 14;
|
|
|
1232
1261
|
/** Chevron icon size for expandable sections. */
|
|
1233
1262
|
declare const CHEVRON_ICON_SIZE = 12;
|
|
1234
1263
|
|
|
1235
|
-
export { ACTIVE_BORDER_RADIUS, APP_SHELL_SUFFIX, type AccountPlan, type AccountState, AppShell, type AppShellProps, type AppShellWidth, BASE_INDENT, CHEVRON_ICON_SIZE, CollapsedRail, type CollapsedRailProps, type CollapsedRailRange, type CommandItem, CommandPalette, type CommandPaletteLabels, type CommandPaletteProps, DEFAULT_COLLAPSED_RAIL_MAX, DarkModeControl, type DarkModeControlProps, type DarkModeOption, type DarkModeVariant, NAV_ICON_SIZE, NAV_LINK_GAP, NAV_TEST_IDS, Nav, NavBar, type NavBarProps, NavExpandableItem, type NavExpandableItemProps, type NavItem, type NavOrientation, NavOverflowMenu, type NavOverflowMenuProps, type NavProps, NavShell, type NavShellCollapsedRail, type NavShellLayout, type NavShellProps, type NavShellSideRail, type NavShellTopBar, type NavUser, PillNav, type PillNavProps, RAIL_FULL_BREAKPOINT, type RailMode, type ResolveRailModeArgs, type ShellMessage, Sidebar, type SidebarProps, Topbar, type TopbarAction, type TopbarProps, type TopbarUser, accessibleNavItems, collapsedRailStyles, darkModeStyles, expandableStyles, filterCommands, isRouteActive, navStyles, pillNavStyles, resolveContentMaxWidth, resolveRailMode, roleRoutesToNavItems, useCommandPaletteHotkey, useContentMaxWidth };
|
|
1264
|
+
export { ACTIVE_BORDER_RADIUS, APP_SHELL_SUFFIX, type AccountPlan, type AccountState, AppShell, type AppShellProps, type AppShellWidth, BASE_INDENT, CHEVRON_ICON_SIZE, CollapsedRail, type CollapsedRailProps, type CollapsedRailRange, type CommandItem, CommandPalette, type CommandPaletteLabels, type CommandPaletteProps, CommandPaletteTrigger, type CommandPaletteTriggerProps, DEFAULT_COLLAPSED_RAIL_MAX, DarkModeControl, type DarkModeControlProps, type DarkModeOption, type DarkModeVariant, NAV_ICON_SIZE, NAV_LINK_GAP, NAV_TEST_IDS, Nav, NavBar, type NavBarProps, NavExpandableItem, type NavExpandableItemProps, type NavItem, type NavOrientation, NavOverflowMenu, type NavOverflowMenuProps, type NavProps, NavShell, type NavShellCollapsedRail, type NavShellLayout, type NavShellProps, type NavShellSideRail, type NavShellTopBar, type NavUser, PillNav, type PillNavProps, RAIL_FULL_BREAKPOINT, type RailMode, type ResolveRailModeArgs, type ShellMessage, Sidebar, type SidebarProps, Topbar, type TopbarAction, type TopbarProps, type TopbarUser, accessibleNavItems, collapsedRailStyles, darkModeStyles, expandableStyles, filterCommands, isRouteActive, navStyles, pillNavStyles, resolveContentMaxWidth, resolveRailMode, roleRoutesToNavItems, useCommandPaletteHotkey, useContentMaxWidth };
|
package/dist/index.js
CHANGED
|
@@ -1671,6 +1671,55 @@ var CommandPalette = ({ open, items, onClose, labels, testID }) => {
|
|
|
1671
1671
|
)
|
|
1672
1672
|
] });
|
|
1673
1673
|
};
|
|
1674
|
+
var MIN_TARGET = 36;
|
|
1675
|
+
var styles5 = reactNative.StyleSheet.create({
|
|
1676
|
+
trigger: {
|
|
1677
|
+
flexDirection: "row",
|
|
1678
|
+
alignItems: "center",
|
|
1679
|
+
justifyContent: "space-between",
|
|
1680
|
+
columnGap: 8,
|
|
1681
|
+
paddingHorizontal: 12,
|
|
1682
|
+
minHeight: MIN_TARGET,
|
|
1683
|
+
borderWidth: 1,
|
|
1684
|
+
borderRadius: 8
|
|
1685
|
+
},
|
|
1686
|
+
label: { fontSize: 14 },
|
|
1687
|
+
badge: { paddingHorizontal: 6, paddingVertical: 2, borderRadius: 4, borderWidth: 1 },
|
|
1688
|
+
badgeText: { fontSize: 11, fontWeight: "700" }
|
|
1689
|
+
});
|
|
1690
|
+
var CommandPaletteTrigger = ({
|
|
1691
|
+
label,
|
|
1692
|
+
hint,
|
|
1693
|
+
shortcut,
|
|
1694
|
+
onPress,
|
|
1695
|
+
testID
|
|
1696
|
+
}) => {
|
|
1697
|
+
const { theme } = uiFeedback.useUi();
|
|
1698
|
+
const colors = theme.colors;
|
|
1699
|
+
const primary = theme.palette.primary["500"];
|
|
1700
|
+
const [focused, setFocused] = React2__default.default.useState(false);
|
|
1701
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1702
|
+
reactNative.Pressable,
|
|
1703
|
+
{
|
|
1704
|
+
accessibilityHint: hint,
|
|
1705
|
+
accessibilityLabel: label,
|
|
1706
|
+
accessibilityRole: "button",
|
|
1707
|
+
style: [
|
|
1708
|
+
styles5.trigger,
|
|
1709
|
+
{ backgroundColor: colors.surface, borderColor: colors.border },
|
|
1710
|
+
focusRingStyle(focused, primary)
|
|
1711
|
+
],
|
|
1712
|
+
testID,
|
|
1713
|
+
onBlur: () => setFocused(false),
|
|
1714
|
+
onFocus: () => setFocused(true),
|
|
1715
|
+
onPress,
|
|
1716
|
+
children: [
|
|
1717
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.label, { color: colors.textSecondary }], children: label }),
|
|
1718
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles5.badge, { borderColor: colors.border }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.badgeText, { color: colors.textSecondary }], children: shortcut }) })
|
|
1719
|
+
]
|
|
1720
|
+
}
|
|
1721
|
+
);
|
|
1722
|
+
};
|
|
1674
1723
|
var LAUNCH_KEY = "k";
|
|
1675
1724
|
function useCommandPaletteHotkey(onOpen, enabled = true) {
|
|
1676
1725
|
React2.useEffect(() => {
|
|
@@ -1703,6 +1752,7 @@ exports.BASE_INDENT = BASE_INDENT;
|
|
|
1703
1752
|
exports.CHEVRON_ICON_SIZE = CHEVRON_ICON_SIZE;
|
|
1704
1753
|
exports.CollapsedRail = CollapsedRail;
|
|
1705
1754
|
exports.CommandPalette = CommandPalette;
|
|
1755
|
+
exports.CommandPaletteTrigger = CommandPaletteTrigger;
|
|
1706
1756
|
exports.DEFAULT_COLLAPSED_RAIL_MAX = DEFAULT_COLLAPSED_RAIL_MAX;
|
|
1707
1757
|
exports.DarkModeControl = DarkModeControl;
|
|
1708
1758
|
exports.NAV_ICON_SIZE = NAV_ICON_SIZE;
|