pixelize-design-library 2.4.2-beta.59 → 2.4.2-beta.61

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.
Files changed (157) hide show
  1. package/CHANGELOG.md +110 -13
  2. package/COMPONENT-GOTCHAS.md +159 -21
  3. package/DESIGN-GUIDE.md +26 -7
  4. package/dist/Components/AudioRecorder/AudioRecorder.d.ts +8 -0
  5. package/dist/Components/AudioRecorder/AudioRecorder.js +169 -0
  6. package/dist/Components/AudioRecorder/AudioRecorderProps.d.ts +20 -0
  7. package/dist/Components/AudioRecorder/AudioRecorderProps.js +2 -0
  8. package/dist/Components/BulkSelectionBar/BulkSelectionBar.d.ts +3 -0
  9. package/dist/Components/BulkSelectionBar/BulkSelectionBar.js +43 -0
  10. package/dist/Components/BulkSelectionBar/BulkSelectionBarProps.d.ts +35 -0
  11. package/dist/Components/BulkSelectionBar/BulkSelectionBarProps.js +2 -0
  12. package/dist/Components/BulkSelectionBar/index.d.ts +2 -0
  13. package/dist/Components/BulkSelectionBar/index.js +8 -0
  14. package/dist/Components/CalendarGrid/CalendarGrid.d.ts +3 -0
  15. package/dist/Components/CalendarGrid/CalendarGrid.js +173 -0
  16. package/dist/Components/CalendarGrid/CalendarGridProps.d.ts +54 -0
  17. package/dist/Components/CalendarGrid/CalendarGridProps.js +2 -0
  18. package/dist/Components/CalendarGrid/calendarMath.d.ts +49 -0
  19. package/dist/Components/CalendarGrid/calendarMath.js +178 -0
  20. package/dist/Components/CircularProgress/CircularProgress.d.ts +4 -0
  21. package/dist/Components/CircularProgress/CircularProgress.js +39 -0
  22. package/dist/Components/CircularProgress/CircularProgressProps.d.ts +22 -0
  23. package/dist/Components/CircularProgress/CircularProgressProps.js +2 -0
  24. package/dist/Components/CircularProgress/arc.d.ts +12 -0
  25. package/dist/Components/CircularProgress/arc.js +16 -0
  26. package/dist/Components/Common/fieldStyles.d.ts +1 -0
  27. package/dist/Components/Common/fieldStyles.js +2 -1
  28. package/dist/Components/Drawer/Drawer.d.ts +1 -1
  29. package/dist/Components/Drawer/Drawer.js +4 -2
  30. package/dist/Components/Drawer/DrawerProps.d.ts +3 -1
  31. package/dist/Components/EmptyState/EmptyState.js +2 -1
  32. package/dist/Components/EmptyState/EmptyStateProps.d.ts +2 -2
  33. package/dist/Components/FormDrawer/FormDrawer.d.ts +2 -0
  34. package/dist/Components/FormDrawer/FormDrawer.js +97 -0
  35. package/dist/Components/FormDrawer/FormDrawerProps.d.ts +55 -0
  36. package/dist/Components/FormDrawer/FormDrawerProps.js +2 -0
  37. package/dist/Components/LauncherTrigger/LauncherTrigger.d.ts +1 -1
  38. package/dist/Components/LauncherTrigger/LauncherTrigger.js +8 -1
  39. package/dist/Components/LauncherTrigger/LauncherTriggerProps.d.ts +2 -0
  40. package/dist/Components/Modal/Modal.d.ts +1 -1
  41. package/dist/Components/Modal/Modal.js +4 -2
  42. package/dist/Components/Modal/ModalProps.d.ts +3 -1
  43. package/dist/Components/Modal/warnDroppedSlotChildren.d.ts +2 -0
  44. package/dist/Components/Modal/warnDroppedSlotChildren.js +45 -0
  45. package/dist/Components/NavLauncher/LauncherTabs.d.ts +18 -0
  46. package/dist/Components/NavLauncher/LauncherTabs.js +64 -0
  47. package/dist/Components/NavLauncher/NavLauncher.d.ts +1 -1
  48. package/dist/Components/NavLauncher/NavLauncher.js +268 -61
  49. package/dist/Components/NavLauncher/NavLauncherProps.d.ts +29 -10
  50. package/dist/Components/NavLauncher/NewTabLink.d.ts +2 -2
  51. package/dist/Components/NavLauncher/NewTabLink.js +7 -3
  52. package/dist/Components/NavLauncher/launcherParts.d.ts +64 -2
  53. package/dist/Components/NavLauncher/launcherParts.js +103 -13
  54. package/dist/Components/NavLauncher/resultNavigation.d.ts +3 -0
  55. package/dist/Components/NavLauncher/resultNavigation.js +65 -0
  56. package/dist/Components/NavLauncher/revealStyles.d.ts +1 -1
  57. package/dist/Components/NavLauncher/revealStyles.js +2 -2
  58. package/dist/Components/NavigationBar/NavigationBar.js +2 -1
  59. package/dist/Components/NavigationBar/NavigationBarProps.d.ts +1 -0
  60. package/dist/Components/OrgSwitcher/OrgSwitcher.js +18 -6
  61. package/dist/Components/OrgSwitcher/OrgSwitcherProps.d.ts +4 -0
  62. package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +5 -0
  63. package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewerProps.d.ts +1 -1
  64. package/dist/Components/QueryState/QueryStateBoundary.d.ts +2 -2
  65. package/dist/Components/QueryState/QueryStateBoundary.js +9 -3
  66. package/dist/Components/QueryState/QueryStateProps.d.ts +19 -2
  67. package/dist/Components/SectionRail/SectionRail.d.ts +3 -0
  68. package/dist/Components/SectionRail/SectionRail.js +49 -0
  69. package/dist/Components/SectionRail/SectionRailProps.d.ts +23 -0
  70. package/dist/Components/SectionRail/SectionRailProps.js +2 -0
  71. package/dist/Components/SectionRail/index.d.ts +2 -0
  72. package/dist/Components/SectionRail/index.js +8 -0
  73. package/dist/Components/SegmentedControl/SegmentedControl.js +9 -14
  74. package/dist/Components/SegmentedControl/segmentedInk.d.ts +0 -2
  75. package/dist/Components/SegmentedControl/segmentedInk.js +1 -5
  76. package/dist/Components/StatCard/StatCard.d.ts +1 -1
  77. package/dist/Components/StatCard/StatCard.js +6 -2
  78. package/dist/Components/StatCard/StatCardProps.d.ts +3 -0
  79. package/dist/Components/StatusTag/StatusTag.d.ts +4 -0
  80. package/dist/Components/StatusTag/StatusTag.js +24 -0
  81. package/dist/Components/StatusTag/StatusTagProps.d.ts +20 -0
  82. package/dist/Components/StatusTag/StatusTagProps.js +2 -0
  83. package/dist/Components/Table/Table.d.ts +1 -1
  84. package/dist/Components/Table/Table.js +6 -2
  85. package/dist/Components/Table/TableProps.d.ts +20 -0
  86. package/dist/Components/Table/components/TableBody.d.ts +1 -1
  87. package/dist/Components/Table/components/TableBody.js +43 -18
  88. package/dist/Components/Table/components/TableHeader.d.ts +1 -1
  89. package/dist/Components/Table/components/TableHeader.js +7 -5
  90. package/dist/Components/Table/components/rowDetail.d.ts +32 -0
  91. package/dist/Components/Table/components/rowDetail.js +20 -0
  92. package/dist/Components/Table/hooks/useRowExpansion.d.ts +7 -0
  93. package/dist/Components/Table/hooks/useRowExpansion.js +27 -0
  94. package/dist/Components/Tabs/Tabs.d.ts +1 -1
  95. package/dist/Components/Tabs/Tabs.js +15 -2
  96. package/dist/Components/Tabs/TabsProps.d.ts +6 -2
  97. package/dist/Components/Tabs/components/Tab.js +4 -33
  98. package/dist/Components/Tabs/components/TabLinkList.d.ts +7 -0
  99. package/dist/Components/Tabs/components/TabLinkList.js +34 -0
  100. package/dist/Components/Tabs/useTabAppearance.d.ts +17 -0
  101. package/dist/Components/Tabs/useTabAppearance.js +67 -0
  102. package/dist/Components/Tag/Tag.js +11 -1
  103. package/dist/Components/Tag/TagProps.d.ts +4 -0
  104. package/dist/Components/Tag/tagDot.d.ts +3 -0
  105. package/dist/Components/Tag/tagDot.js +21 -0
  106. package/dist/esm/Components/AudioRecorder/AudioRecorder.js +161 -0
  107. package/dist/esm/Components/AudioRecorder/AudioRecorderProps.js +1 -0
  108. package/dist/esm/Components/BulkSelectionBar/BulkSelectionBar.js +38 -0
  109. package/dist/esm/Components/BulkSelectionBar/BulkSelectionBarProps.js +1 -0
  110. package/dist/esm/Components/BulkSelectionBar/index.js +1 -0
  111. package/dist/esm/Components/CalendarGrid/CalendarGrid.js +168 -0
  112. package/dist/esm/Components/CalendarGrid/CalendarGridProps.js +1 -0
  113. package/dist/esm/Components/CalendarGrid/calendarMath.js +155 -0
  114. package/dist/esm/Components/CircularProgress/CircularProgress.js +37 -0
  115. package/dist/esm/Components/CircularProgress/CircularProgressProps.js +1 -0
  116. package/dist/esm/Components/CircularProgress/arc.js +11 -0
  117. package/dist/esm/Components/Common/fieldStyles.js +2 -1
  118. package/dist/esm/Components/Drawer/Drawer.js +4 -2
  119. package/dist/esm/Components/EmptyState/EmptyState.js +2 -1
  120. package/dist/esm/Components/FormDrawer/FormDrawer.js +58 -0
  121. package/dist/esm/Components/FormDrawer/FormDrawerProps.js +1 -0
  122. package/dist/esm/Components/LauncherTrigger/LauncherTrigger.js +5 -1
  123. package/dist/esm/Components/Modal/Modal.js +4 -2
  124. package/dist/esm/Components/Modal/warnDroppedSlotChildren.js +38 -0
  125. package/dist/esm/Components/NavLauncher/LauncherTabs.js +58 -0
  126. package/dist/esm/Components/NavLauncher/NavLauncher.js +270 -63
  127. package/dist/esm/Components/NavLauncher/NewTabLink.js +4 -3
  128. package/dist/esm/Components/NavLauncher/launcherParts.js +98 -14
  129. package/dist/esm/Components/NavLauncher/resultNavigation.js +61 -0
  130. package/dist/esm/Components/NavLauncher/revealStyles.js +2 -2
  131. package/dist/esm/Components/NavigationBar/NavigationBar.js +2 -1
  132. package/dist/esm/Components/OrgSwitcher/OrgSwitcher.js +16 -7
  133. package/dist/esm/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +5 -0
  134. package/dist/esm/Components/QueryState/QueryStateBoundary.js +10 -4
  135. package/dist/esm/Components/SectionRail/SectionRail.js +44 -0
  136. package/dist/esm/Components/SectionRail/SectionRailProps.js +1 -0
  137. package/dist/esm/Components/SectionRail/index.js +1 -0
  138. package/dist/esm/Components/SegmentedControl/SegmentedControl.js +11 -16
  139. package/dist/esm/Components/SegmentedControl/segmentedInk.js +0 -3
  140. package/dist/esm/Components/StatCard/StatCard.js +6 -2
  141. package/dist/esm/Components/StatusTag/StatusTag.js +19 -0
  142. package/dist/esm/Components/StatusTag/StatusTagProps.js +1 -0
  143. package/dist/esm/Components/Table/Table.js +7 -3
  144. package/dist/esm/Components/Table/components/TableBody.js +43 -18
  145. package/dist/esm/Components/Table/components/TableHeader.js +7 -5
  146. package/dist/esm/Components/Table/components/rowDetail.js +14 -0
  147. package/dist/esm/Components/Table/hooks/useRowExpansion.js +23 -0
  148. package/dist/esm/Components/Tabs/Tabs.js +15 -2
  149. package/dist/esm/Components/Tabs/components/Tab.js +4 -33
  150. package/dist/esm/Components/Tabs/components/TabLinkList.js +29 -0
  151. package/dist/esm/Components/Tabs/useTabAppearance.js +63 -0
  152. package/dist/esm/Components/Tag/Tag.js +12 -2
  153. package/dist/esm/Components/Tag/tagDot.js +17 -0
  154. package/dist/esm/index.js +7 -0
  155. package/dist/index.d.ts +17 -2
  156. package/dist/index.js +18 -4
  157. package/package.json +1 -1
@@ -1,28 +1,52 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Box, Flex, Heading, IconButton, Text } from "@chakra-ui/react";
3
- import { Compass, Search as SearchIcon, X } from "lucide-react";
2
+ import { Box, Flex, IconButton, Text, VisuallyHidden } from "@chakra-ui/react";
3
+ import { Search as SearchIcon, X } from "lucide-react";
4
4
  import { useCallback, useEffect, useId, useMemo, useRef, useState, } from "react";
5
5
  import { useMatchMedia } from "../../Hooks/useMatchMedia.js";
6
- import { focusRingShadow, focusVisibleStyles, } from "../../Theme/chakra/focusRing.styles.js";
6
+ import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
7
+ import { reducedMotionSx } from "../../Theme/chakra/motion.js";
7
8
  import { chartMode } from "../../Theme/tokens/builders/chartColorsFromTheme.js";
8
9
  import { placeholderInk } from "../../Theme/tokens/builders/placeholderInk.js";
9
- import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
10
10
  import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
11
11
  import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
12
12
  import { useCustomTheme } from "../../Theme/useCustomTheme.js";
13
13
  import { assignAppHues } from "../AppSwitcher/AppMark.js";
14
14
  import Drawer, { DrawerBody, DrawerFooter, DrawerHeader, } from "../Drawer/Drawer.js";
15
15
  import EmptyState from "../EmptyState/EmptyState.js";
16
- import Kbd from "../Kbd/Kbd.js";
16
+ import Kbd, { KbdShortcut } from "../Kbd/Kbd.js";
17
+ import ToolTip from "../ToolTip/ToolTip.js";
18
+ import { useIsTruncated } from "../../Hooks/useIsTruncated.js";
19
+ import { shortcutKeys } from "../AppSwitcher/AppSwitcherProps.js";
17
20
  import Skeletons from "../Skeletons/Skeletons.js";
18
- import { AppsSection, CountBadge, Highlight, isPlainClick, ITEM_SELECTOR, ModuleRow, NewTag, PinnedTile, PinTextButton, RailRow, RowActions, RowIcon, RowTip, SectionHeader, } from "./launcherParts.js";
21
+ import { activeRowSurface, AppsSection, CountBadge, Highlight, isPlainClick, ITEM_SELECTOR, ModuleRow, NewTag, PinnedTile, PinTextButton, RailRow, ROW_CONTAINER, RowActions, RowIcon, RowTip, SectionHeader, titleInset, TouchDensity, useTouchDensity, WIDE_ROW, } from "./launcherParts.js";
22
+ import { LauncherTabs, panelId, tabId, } from "./LauncherTabs.js";
19
23
  import { searchLauncherSections } from "./match.js";
20
24
  import NewTabLink from "./NewTabLink.js";
21
25
  import PinToggle from "./PinToggle.js";
26
+ import { moveResult } from "./resultNavigation.js";
22
27
  const NO_APPS = [];
23
28
  const MD_QUERY = "(min-width: 48em)";
29
+ const LG_QUERY = "(min-width: 62em)";
24
30
  const XL_QUERY = "(min-width: 80em)";
25
31
  const CELL_SELECTOR = "[data-nav-cell]";
32
+ const RAIL_WIDTH = "clamp(20rem, 30%, 26rem)";
33
+ const PINNED_COLUMNS = 2;
34
+ const ENTER_CHIP_WIDTH = 50;
35
+ const ARROW_KEYS = ["↑", "↓", "←", "→"];
36
+ const ENTER_KEY = shortcutKeys("enter")[0];
37
+ const MOD_KEY = shortcutKeys("mod+enter")[0];
38
+ const RESULT_KEYS = [
39
+ "ArrowUp",
40
+ "ArrowDown",
41
+ "ArrowLeft",
42
+ "ArrowRight",
43
+ "Home",
44
+ "End",
45
+ "PageUp",
46
+ "PageDown",
47
+ ];
48
+ const TEXT_TARGET = "input, textarea, select, [contenteditable=true]";
49
+ const ROW_HEIGHT = 46;
26
50
  const DEFAULT_LABELS = {
27
51
  title: "Menu",
28
52
  searchPlaceholder: "Search menus and screens",
@@ -48,6 +72,13 @@ const DEFAULT_LABELS = {
48
72
  hintPin: "pin",
49
73
  hintClose: "close",
50
74
  hintOpenMenu: "open",
75
+ hintClickNewTab: "+ click for new tab",
76
+ newTabTip: "Open in new tab",
77
+ resultsCount: (count) => `${count} ${count === 1 ? "result" : "results"}`,
78
+ tabsLabel: "Menu sections",
79
+ tabMenu: "Menu",
80
+ tabQuickAccess: "Quick access",
81
+ tabApps: "Apps",
51
82
  apps: "Your apps",
52
83
  found: (count) => `${count} found`,
53
84
  pinTip: "Pin to quick access",
@@ -59,8 +90,6 @@ const DEFAULT_LABELS = {
59
90
  footerNote: "Pins follow your account",
60
91
  suggestionsHint: "Try one of these",
61
92
  };
62
- const isApplePlatform = () => typeof navigator !== "undefined" &&
63
- /Mac|iPhone|iPad/.test(navigator.platform);
64
93
  const visibleSections = (sections) => sections
65
94
  .map((section) => ({
66
95
  ...section,
@@ -83,22 +112,22 @@ const GRID_COLUMNS = {
83
112
  md: "repeat(2, minmax(0, 1fr))",
84
113
  xl: "repeat(3, minmax(0, 1fr))",
85
114
  };
86
- function ItemGrid({ children }) {
87
- return (_jsx(Box, { "data-nav-grid": true, display: "grid", gridTemplateColumns: GRID_COLUMNS, gap: "1px 8px", alignItems: "start", children: children }));
115
+ function ItemGrid({ children, columns, }) {
116
+ return (_jsx(Box, { "data-nav-grid": true, "data-nav-columns": columns, display: "grid", gridTemplateColumns: GRID_COLUMNS, gap: "1px 8px", alignItems: "start", children: children }));
88
117
  }
89
- function Pane({ children }) {
90
- return (_jsx(Flex, { direction: "column", gap: "14px", flex: 1, minW: 0, px: "18px", pt: "12px", pb: "16px", overflowY: { base: "visible", lg: "auto" }, children: children }));
118
+ function Pane({ children, scrolls = false, }) {
119
+ return (_jsx(Flex, { "data-scroll-region": scrolls || undefined, direction: "column", gap: "14px", flex: 1, minW: 0, px: "18px", pt: "12px", pb: "16px", overflowY: { base: "visible", lg: "auto" }, children: children }));
91
120
  }
92
- function Rail({ label, children }) {
121
+ function Rail({ label, children, scrolls = false, }) {
93
122
  const { colors } = useCustomTheme();
94
- return (_jsx(Flex, { as: "aside", "aria-label": label, direction: "column", gap: "16px", w: { base: "100%", lg: "300px" }, flexShrink: 0, px: "14px", pt: "12px", pb: "16px", bg: colors.backgroundColor.subtle, borderTopWidth: { base: "1px", lg: 0 }, borderLeftWidth: { base: 0, lg: "1px" }, borderColor: colors.boxborder[200], overflowY: { base: "visible", lg: "auto" }, children: children }));
123
+ return (_jsx(Flex, { "data-scroll-region": scrolls || undefined, as: "aside", "aria-label": label, direction: "column", gap: "16px", w: { base: "100%", lg: RAIL_WIDTH }, flexShrink: 0, px: "14px", pt: "12px", pb: "16px", bg: colors.backgroundColor.subtle, borderTopWidth: { base: "1px", lg: 0 }, borderLeftWidth: { base: 0, lg: "1px" }, borderColor: colors.boxborder[200], overflowY: { base: "visible", lg: "auto" }, children: children }));
95
124
  }
96
125
  function SkeletonLayout({ label }) {
97
126
  return (_jsxs(Flex, { role: "status", "aria-busy": "true", "aria-label": label, direction: { base: "column", lg: "row" }, flex: 1, minH: 0, children: [_jsx(Pane, { children: [0, 1, 2].map((section) => (_jsxs(Box, { children: [_jsx(Skeletons, { type: "skeleton", height: "0.75rem", width: "6rem" }), _jsx(ItemGrid, { children: [0, 1, 2, 3].map((row) => (_jsxs(Flex, { align: "center", gap: "10px", h: "34px", mt: 2, children: [_jsx(Skeletons, { type: "skeleton", height: "1rem", width: "1rem" }), _jsx(Skeletons, { type: "skeleton", height: "0.875rem", width: "8rem" })] }, row))) })] }, section))) }), _jsx(Rail, { label: label, children: [0, 1].map((group) => (_jsxs(Box, { children: [_jsx(Skeletons, { type: "skeleton", height: "0.75rem", width: "5rem" }), [0, 1, 2].map((row) => (_jsx(Skeletons, { type: "skeleton", height: "1.5rem", width: "100%", mt: 2 }, row)))] }, group))) })] }));
98
127
  }
99
128
  function SearchField({ inputRef, value, onChange, onKeyDown, labels, hint, listboxId, activeId, isExpanded, hasResults, }) {
100
129
  const { colors } = useCustomTheme();
101
- return (_jsxs(Flex, { flex: 1, maxW: "520px", h: "38px", align: "center", gap: "10px", pl: "12px", pr: "8px", borderRadius: "10px", borderWidth: "1px", borderColor: colors.primary[500], bg: colors.surfaceRaised, boxShadow: `0 0 0 3px ${colors.primary.opacity[16]}`, children: [_jsx(Box, { as: "span", color: colors.accentText, display: "inline-flex", flexShrink: 0, children: _jsx(SearchIcon, { size: 16, strokeWidth: 2.2, "aria-hidden": true }) }), _jsx(Box, { as: "input", ref: inputRef, value: value, onChange: (event) => onChange(event.target.value), onKeyDown: onKeyDown, placeholder: labels.searchPlaceholder, "aria-label": labels.searchPlaceholder, role: "combobox", "aria-expanded": isExpanded, "aria-controls": isExpanded && hasResults ? listboxId : undefined, "aria-autocomplete": "list", "aria-activedescendant": activeId, autoComplete: "off", flex: 1, minW: 0, h: "34px", border: 0, outline: "none", bg: "transparent", fontSize: "14.5px", color: colors.text[900], _placeholder: { color: placeholderInk(colors), opacity: 1 } }), value ? (_jsx(Box, { as: "button", type: "button", "aria-label": labels.clearSearch, onClick: () => {
130
+ return (_jsxs(Flex, { flex: 1, minW: 0, h: { base: "40px", md: "44px" }, align: "center", gap: "10px", pl: "14px", pr: "10px", borderRadius: { base: "10px", md: "12px" }, borderWidth: "1px", borderColor: colors.primary[500], bg: colors.surfaceRaised, boxShadow: `0 0 0 3px ${colors.primary.opacity[16]}`, children: [_jsx(Box, { as: "span", color: colors.accentText, display: "inline-flex", flexShrink: 0, children: _jsx(SearchIcon, { size: 18, strokeWidth: 2.2, "aria-hidden": true }) }), _jsx(Box, { as: "input", ref: inputRef, value: value, onChange: (event) => onChange(event.target.value), onKeyDown: onKeyDown, placeholder: labels.searchPlaceholder, "aria-label": labels.searchPlaceholder, role: "combobox", "aria-expanded": isExpanded, "aria-controls": isExpanded && hasResults ? listboxId : undefined, "aria-autocomplete": "list", "aria-activedescendant": activeId, autoComplete: "off", flex: 1, minW: 0, h: "100%", border: 0, outline: "none", bg: "transparent", fontSize: "16px", color: colors.text[900], _placeholder: { color: placeholderInk(colors), opacity: 1 } }), value ? (_jsx(Box, { as: "button", type: "button", "aria-label": labels.clearSearch, onClick: () => {
102
131
  var _a;
103
132
  onChange("");
104
133
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
@@ -106,27 +135,43 @@ function SearchField({ inputRef, value, onChange, onKeyDown, labels, hint, listb
106
135
  }
107
136
  function SearchRow({ item, query, isActive, link, labels, optionId, isPinned, canPin, onPin, onOpen, onHover, }) {
108
137
  const { colors } = useCustomTheme();
138
+ const isTouch = useTouchDensity();
109
139
  const isScreen = item.kind === "screen";
110
140
  const hasStar = Boolean(item.screenId) && canPin;
111
141
  const base = item.badge ? 24 : 0;
112
142
  const open = base + (hasStar ? 46 : item.href ? 24 : 0);
113
- return (_jsxs(Flex, { role: "presentation", "data-group": true, "data-reveal": isActive, position: "relative", align: "flex-start", gap: "10px", minH: "34px", pl: "8px", pr: "4px", pt: "7px", pb: "5px", borderRadius: "8px", bg: isActive ? colors.primary[50] : "transparent", boxShadow: isActive ? focusRingShadow(colors) : "none", transition: transitionFor(["background-color"]), onMouseMove: onHover, children: [_jsxs(Flex, { id: optionId, role: "option", "aria-selected": isActive, "data-active": isActive, title: isScreen ? `${item.label} — ${item.context}` : item.label, flex: 1, minW: 0, align: "flex-start", gap: "10px", cursor: "pointer", onClick: () => {
114
- if (!item.href)
115
- onOpen();
116
- }, children: [_jsx(RowIcon, { icon: item.icon, size: 16, mt: "2px" }), _jsxs(Flex, { direction: "column", flex: 1, minW: 0, children: [_jsxs(Flex, { align: "center", gap: "6px", minW: 0, h: "19px", pr: `${isActive ? open + 26 : base}px`, _groupHover: { pr: `${isActive ? open + 26 : open}px` }, children: [_jsxs(Text, { fontSize: "13.5px", fontWeight: 500, color: colors.text[900], noOfLines: 1, minW: 0, children: [_jsx(Highlight, { text: item.label, query: query }), isScreen ? (_jsx(Text, { as: "span", fontWeight: 400, color: colors.textMuted, children: ` — ${item.context}` })) : null] }), item.isNew ? _jsx(NewTag, { label: labels.newBadge }) : null, item.keywordHint ? (_jsx(Text, { as: "span", fontSize: "11.5px", color: colors.textMuted, whiteSpace: "nowrap", children: ` · ${item.keywordHint}` })) : null, item.hint ? (_jsx(Text, { as: "span", fontSize: "11.5px", color: colors.textMuted, whiteSpace: "nowrap", children: item.hint })) : null] }), item.context && !isScreen ? (_jsx(Text, { fontSize: "11.5px", lineHeight: "15px", color: colors.textMuted, noOfLines: 1, children: item.context })) : null] })] }), item.href ? (_jsx(Box, { as: link.linkAs, href: item.href, tabIndex: -1, "aria-hidden": true, onClick: link.onPlainClick, position: "absolute", inset: 0, borderRadius: "8px" })) : null, _jsx(RowActions, { children: _jsxs(Box, { "aria-hidden": true, display: "contents", children: [_jsx(CountBadge, { value: item.badge }), isActive ? _jsx(Kbd, { size: "xs", children: "\u21B5" }) : null, hasStar ? (_jsx(PinToggle, { isPinned: isPinned, label: isPinned ? labels.unpin(item.label) : labels.pin(item.label), title: "", onToggle: onPin, tabIndex: -1 })) : null, item.href ? (_jsx(NewTabLink, { href: item.href, label: labels.openInNewTab(isScreen ? `${item.label} — ${item.context}` : item.label), linkAs: link.linkAs, tabIndex: -1 })) : null] }) }), hasStar ? (_jsx(RowTip, { text: isPinned ? labels.unpinTip : labels.pinTip })) : null] }));
143
+ const fullLabel = isScreen ? `${item.label} — ${item.context}` : item.label;
144
+ const title = useIsTruncated(fullLabel);
145
+ const context = useIsTruncated(item.context);
146
+ const titleRef = title.ref;
147
+ const contextRef = context.ref;
148
+ const tipLabel = isScreen || !item.context ? fullLabel : `${fullLabel} · ${item.context}`;
149
+ return (_jsx(ToolTip, { label: tipLabel, placement: "top-start", isDisabled: !title.isTruncated && !context.isTruncated, children: _jsxs(Flex, { role: "presentation", "data-group": true, "data-reveal": isActive, position: "relative", align: "flex-start", gap: "10px", minH: isTouch ? "44px" : "34px", pl: "8px", pr: "4px", pt: isTouch ? "12px" : "7px", pb: isTouch ? "8px" : "5px", borderRadius: "8px", transition: transitionFor(["background-color"]), onMouseMove: onHover, sx: isActive
150
+ ? { ...ROW_CONTAINER, ...activeRowSurface(colors) }
151
+ : ROW_CONTAINER, children: [_jsxs(Flex, { id: optionId, role: "option", "aria-selected": isActive, "data-active": isActive, flex: 1, minW: 0, align: "flex-start", gap: "10px", cursor: "pointer", onClick: () => {
152
+ if (!item.href)
153
+ onOpen();
154
+ }, children: [_jsx(RowIcon, { icon: item.icon, size: 16, mt: "2px" }), _jsxs(Flex, { direction: "column", flex: 1, minW: 0, children: [_jsxs(Flex, { align: "center", gap: "6px", minW: 0, h: "19px", sx: titleInset(base, open, ENTER_CHIP_WIDTH), children: [_jsxs(Text, { ref: titleRef, fontSize: "13.5px", fontWeight: 500, color: colors.text[900], noOfLines: 1, minW: 0, children: [_jsx(Highlight, { text: item.label, query: query }), isScreen ? (_jsx(Text, { as: "span", fontWeight: 400, color: colors.textMuted, children: ` — ${item.context}` })) : null] }), item.isNew ? _jsx(NewTag, { label: labels.newBadge }) : null, item.keywordHint ? (_jsx(Text, { as: "span", fontSize: "11.5px", color: colors.textMuted, whiteSpace: "nowrap", children: ` · ${item.keywordHint}` })) : null, item.hint ? (_jsx(Text, { as: "span", fontSize: "11.5px", color: colors.textMuted, whiteSpace: "nowrap", children: item.hint })) : null] }), item.context && !isScreen ? (_jsx(Text, { ref: contextRef, fontSize: "11.5px", lineHeight: "15px", color: colors.textMuted, noOfLines: 1, children: item.context })) : null] })] }), item.href ? (_jsx(Box, { as: link.linkAs, href: item.href, tabIndex: -1, "aria-hidden": true, onClick: link.onPlainClick, position: "absolute", inset: 0, borderRadius: "8px" })) : null, _jsx(RowActions, { children: _jsxs(Box, { "aria-hidden": true, display: "contents", children: [isActive ? (_jsx(Box, { sx: {
155
+ display: "none",
156
+ [WIDE_ROW]: { display: "inline-flex" },
157
+ "@media (hover: none)": { display: "none" },
158
+ }, children: _jsx(KbdShortcut, { shortcut: "enter", size: "xs" }) })) : null, _jsx(CountBadge, { value: item.badge }), hasStar ? (_jsx(PinToggle, { isPinned: isPinned, label: isPinned ? labels.unpin(item.label) : labels.pin(item.label), title: "", onToggle: onPin, tabIndex: -1 })) : null, item.href ? (_jsx(NewTabLink, { href: item.href, label: labels.openInNewTab(isScreen ? `${item.label} — ${item.context}` : item.label), tip: labels.newTabTip, linkAs: link.linkAs, tabIndex: -1 })) : null] }) }), hasStar ? (_jsx(RowTip, { text: isPinned ? labels.unpinTip : labels.pinTip })) : null] }) }));
117
159
  }
118
160
  /** Left-drawer navigation launcher: browse every module, pins, Frequent, Recent, search and (compact) the suite's apps. */
119
- export default function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, frequentIds, recentIds, onTogglePin, onNavigate, linkAs = "a", actions, extraResults, query: controlledQuery, onQueryChange, isSearching = false, isLoading = false, keyScreenLimit = 3, frequentLimit = 4, suggestions, searchHint, openShortcutHint, modKeyLabel, maxWidth = "1180px", labels: labelOverrides, apps, currentAppId, onAppSelect, appsVisibility = "apps-on-compact", "data-testid": testId, }) {
161
+ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, frequentIds, recentIds, onTogglePin, onNavigate, linkAs = "a", actions, extraResults, query: controlledQuery, onQueryChange, isSearching = false, isLoading = false, keyScreenLimit = 3, frequentLimit = 4, suggestions, searchHint, modKeyLabel, headerActions, maxWidth = "1080px", labels: labelOverrides, apps, currentAppId, onAppSelect, appsVisibility = "apps-on-compact", "data-testid": testId, }) {
120
162
  const theme = useCustomTheme();
121
163
  const { colors } = theme;
122
164
  const inputRef = useRef(null);
123
165
  const bodyRef = useRef(null);
124
166
  const baseId = useId();
125
167
  const isDesktop = useMatchMedia(MD_QUERY, true);
168
+ const isLg = useMatchMedia(LG_QUERY, true);
126
169
  const isWide = useMatchMedia(XL_QUERY, false);
127
170
  const columns = isWide ? 3 : isDesktop ? 2 : 1;
128
171
  const [innerQuery, setInnerQuery] = useState("");
129
172
  const [activeIndex, setActiveIndex] = useState(0);
173
+ const [tab, setTab] = useState("menu");
174
+ const navigating = useRef(false);
130
175
  const labels = useMemo(() => ({ ...DEFAULT_LABELS, ...labelOverrides }), [labelOverrides]);
131
176
  const isControlled = controlledQuery !== undefined;
132
177
  const query = isControlled ? controlledQuery : innerQuery;
@@ -138,10 +183,16 @@ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pi
138
183
  const latest = useRef({ query, setQuery });
139
184
  latest.current = { query, setQuery };
140
185
  useEffect(() => {
141
- if (!isOpen && latest.current.query !== "")
186
+ if (isOpen)
187
+ return;
188
+ setTab("menu");
189
+ if (latest.current.query !== "")
142
190
  latest.current.setQuery("");
143
191
  }, [isOpen]);
144
- useEffect(() => setActiveIndex(0), [query]);
192
+ useEffect(() => {
193
+ navigating.current = false;
194
+ setActiveIndex(0);
195
+ }, [query]);
145
196
  const sections = useMemo(() => visibleSections(rawSections), [rawSections]);
146
197
  const byId = useMemo(() => indexScreens(sections), [sections]);
147
198
  const pinned = useMemo(() => new Set(pinnedIds), [pinnedIds]);
@@ -167,6 +218,27 @@ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pi
167
218
  const results = useMemo(() => groups.flatMap((g) => g.items), [groups]);
168
219
  const groupStarts = useMemo(() => groups.map((_, i) => groups.slice(0, i).reduce((n, g) => n + g.items.length, 0)), [groups]);
169
220
  const isSearchView = query.trim().length > 0;
221
+ const active = Math.min(activeIndex, Math.max(results.length - 1, 0));
222
+ const appList = apps !== null && apps !== void 0 ? apps : NO_APPS;
223
+ const showApps = appList.some((app) => app.id !== currentAppId) &&
224
+ (appsVisibility === "always" || !isDesktop);
225
+ const railFrequent = frequentItems
226
+ .filter(({ screen }) => !pinned.has(screen.id))
227
+ .slice(0, frequentLimit);
228
+ const hasQuick = pinnedItems.length > 0 || railFrequent.length > 0 || recentItems.length > 0;
229
+ const tabs = useMemo(() => [
230
+ { id: "menu", label: labels.tabMenu },
231
+ ...(hasQuick
232
+ ? [{ id: "quick", label: labels.tabQuickAccess }]
233
+ : []),
234
+ ...(showApps ? [{ id: "apps", label: labels.tabApps }] : []),
235
+ ], [hasQuick, showApps, labels]);
236
+ const isTabbed = !isLg && !isSearchView && !isLoading && tabs.length > 1;
237
+ const activeTab = tabs.some((item) => item.id === tab) ? tab : "menu";
238
+ const countText = isSearchView && results.length > 0
239
+ ? labels.resultsCount(results.length)
240
+ : "";
241
+ const groupSizes = useMemo(() => groups.map((g) => g.items.length), [groups]);
170
242
  const link = useMemo(() => ({
171
243
  linkAs,
172
244
  onPlainClick: (event) => {
@@ -186,19 +258,56 @@ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pi
186
258
  onClose();
187
259
  onNavigate(item.href, { newTab });
188
260
  }, [onClose, onNavigate]);
261
+ const focusField = (shouldSelect = false) => {
262
+ var _a, _b;
263
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
264
+ if (shouldSelect)
265
+ (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.select();
266
+ };
267
+ const scrollHeight = (from) => {
268
+ var _a, _b, _c, _d, _e;
269
+ return (_e = (_b = (_a = from === null || from === void 0 ? void 0 : from.closest("[data-scroll-region]")) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : (_d = (_c = bodyRef.current) === null || _c === void 0 ? void 0 : _c.querySelector("[data-scroll-region]")) === null || _d === void 0 ? void 0 : _d.clientHeight) !== null && _e !== void 0 ? _e : 0;
270
+ };
271
+ const leaveTop = () => {
272
+ var _a;
273
+ const selected = isTabbed
274
+ ? document.getElementById(tabId(baseId, activeTab))
275
+ : null;
276
+ (_a = (selected !== null && selected !== void 0 ? selected : inputRef.current)) === null || _a === void 0 ? void 0 : _a.focus();
277
+ };
189
278
  const moveFocus = (delta) => {
190
279
  var _a, _b;
191
280
  const items = Array.from((_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(ITEM_SELECTOR)) !== null && _b !== void 0 ? _b : []);
192
281
  if (items.length === 0)
193
282
  return;
194
283
  const current = items.indexOf(document.activeElement);
284
+ if (typeof delta === "number" && current + delta < 0) {
285
+ leaveTop();
286
+ return;
287
+ }
195
288
  const next = delta === "first"
196
289
  ? 0
197
290
  : delta === "last"
198
291
  ? items.length - 1
199
- : Math.min(items.length - 1, Math.max(0, current + delta));
292
+ : Math.min(items.length - 1, current + delta);
200
293
  items[next].focus();
201
294
  };
295
+ const pageFocus = (direction) => {
296
+ var _a, _b;
297
+ const items = Array.from((_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(ITEM_SELECTOR)) !== null && _b !== void 0 ? _b : []);
298
+ const from = document.activeElement;
299
+ const current = items.indexOf(from);
300
+ if (items.length === 0 || current < 0)
301
+ return;
302
+ const height = scrollHeight(from);
303
+ const goal = from.getBoundingClientRect().top + direction * height * 0.85;
304
+ const byDistance = items
305
+ .filter((_, i) => (direction > 0 ? i > current : i < current))
306
+ .sort((a, b) => Math.abs(a.getBoundingClientRect().top - goal) -
307
+ Math.abs(b.getBoundingClientRect().top - goal));
308
+ const fallback = items[Math.min(items.length - 1, Math.max(0, current + direction * 3))];
309
+ (height > 0 && byDistance.length ? byDistance[0] : fallback).focus();
310
+ };
202
311
  const onInputKeyDown = (event) => {
203
312
  if (!isSearchView) {
204
313
  if (event.key === "ArrowDown") {
@@ -207,20 +316,32 @@ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pi
207
316
  }
208
317
  return;
209
318
  }
210
- if (results.length === 0)
319
+ if (results.length === 0 || event.nativeEvent.isComposing)
211
320
  return;
212
- if (event.key === "ArrowDown") {
321
+ if (event.key === "Enter") {
213
322
  event.preventDefault();
214
- setActiveIndex((i) => (i + 1) % results.length);
215
- }
216
- else if (event.key === "ArrowUp") {
217
- event.preventDefault();
218
- setActiveIndex((i) => (i - 1 + results.length) % results.length);
323
+ open(results[active], event.metaKey || event.ctrlKey);
324
+ return;
219
325
  }
220
- else if (event.key === "Enter") {
221
- event.preventDefault();
222
- open(results[activeIndex], event.metaKey || event.ctrlKey);
326
+ const hasModifier = event.altKey || event.metaKey || event.ctrlKey || event.shiftKey;
327
+ if (!RESULT_KEYS.includes(event.key) || hasModifier)
328
+ return;
329
+ const input = event.currentTarget;
330
+ const atEnd = input.selectionStart === input.value.length &&
331
+ input.selectionEnd === input.value.length;
332
+ const isSideways = event.key === "ArrowLeft" || event.key === "ArrowRight";
333
+ const isEdit = isSideways || event.key === "Home" || event.key === "End";
334
+ if (isEdit && !navigating.current) {
335
+ const entersGrid = event.key === "ArrowRight" && atEnd && columns > 1;
336
+ if (!entersGrid)
337
+ return;
223
338
  }
339
+ if (isSideways && columns === 1)
340
+ return;
341
+ event.preventDefault();
342
+ navigating.current = true;
343
+ const pageRows = Math.max(3, Math.floor(scrollHeight(input) / ROW_HEIGHT) - 1);
344
+ setActiveIndex(moveResult(groupSizes, columns, active, event.key, pageRows));
224
345
  };
225
346
  const moveInGrid = (event, cell) => {
226
347
  var _a, _b, _c, _d;
@@ -233,6 +354,7 @@ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pi
233
354
  return;
234
355
  }
235
356
  const down = event.key === "ArrowDown";
357
+ const columns = Number(grid === null || grid === void 0 ? void 0 : grid.dataset.navColumns);
236
358
  const within = cells[index + (down ? columns : -columns)];
237
359
  if (within)
238
360
  return focusCell(within);
@@ -272,22 +394,39 @@ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pi
272
394
  };
273
395
  const onBodyKeyDown = (event) => {
274
396
  var _a;
275
- if (isSearchView || event.target === inputRef.current)
397
+ const target = event.target;
398
+ if (target.closest(TEXT_TARGET))
276
399
  return;
400
+ const inBody = Boolean((_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.contains(target));
277
401
  const isArrow = event.key.startsWith("Arrow");
278
- const cell = event.target.closest(CELL_SELECTOR);
279
- if (isArrow && cell && !event.altKey && !event.metaKey && !event.ctrlKey) {
402
+ const cell = target.closest(CELL_SELECTOR);
403
+ if (inBody &&
404
+ isArrow &&
405
+ cell &&
406
+ !event.altKey &&
407
+ !event.metaKey &&
408
+ !event.ctrlKey) {
280
409
  event.preventDefault();
281
410
  moveInGrid(event, cell);
282
411
  }
283
- else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
412
+ else if (inBody &&
413
+ (event.key === "ArrowDown" || event.key === "ArrowUp")) {
284
414
  event.preventDefault();
285
415
  moveFocus(event.key === "ArrowDown" ? 1 : -1);
286
416
  }
287
- else if (event.key === "Home" || event.key === "End") {
417
+ else if (inBody && (event.key === "Home" || event.key === "End")) {
288
418
  event.preventDefault();
289
419
  moveFocus(event.key === "Home" ? "first" : "last");
290
420
  }
421
+ else if (inBody && (event.key === "PageDown" || event.key === "PageUp")) {
422
+ event.preventDefault();
423
+ pageFocus(event.key === "PageDown" ? 1 : -1);
424
+ }
425
+ else if (event.key === "Backspace" && query) {
426
+ event.preventDefault();
427
+ setQuery(query.slice(0, -1));
428
+ focusField();
429
+ }
291
430
  else if (event.key.length === 1 &&
292
431
  !event.metaKey &&
293
432
  !event.ctrlKey &&
@@ -297,33 +436,94 @@ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pi
297
436
  return;
298
437
  event.preventDefault();
299
438
  setQuery(query + event.key);
300
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
439
+ focusField();
301
440
  }
302
441
  };
442
+ const onContentKeyDown = (event) => {
443
+ if (event.key === "Escape") {
444
+ event.stopPropagation();
445
+ if (event.nativeEvent.isComposing)
446
+ return;
447
+ event.preventDefault();
448
+ if (query) {
449
+ setQuery("");
450
+ focusField();
451
+ }
452
+ else {
453
+ onClose();
454
+ }
455
+ return;
456
+ }
457
+ const hasMod = event.metaKey || event.ctrlKey;
458
+ if (hasMod &&
459
+ !event.altKey &&
460
+ !event.shiftKey &&
461
+ event.key.toLowerCase() === "k") {
462
+ event.preventDefault();
463
+ focusField(true);
464
+ return;
465
+ }
466
+ const target = event.target;
467
+ if (target === inputRef.current)
468
+ return;
469
+ if (event.key === "/" &&
470
+ !hasMod &&
471
+ !event.altKey &&
472
+ !target.closest(TEXT_TARGET)) {
473
+ event.preventDefault();
474
+ focusField(true);
475
+ return;
476
+ }
477
+ onBodyKeyDown(event);
478
+ };
303
479
  useEffect(() => {
304
480
  var _a, _b, _c;
305
481
  (_c = (_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[data-active="true"]')) === null || _b === void 0 ? void 0 : _b.scrollIntoView) === null || _c === void 0 ? void 0 : _c.call(_b, { block: "nearest" });
306
- }, [activeIndex, results]);
307
- const appList = apps !== null && apps !== void 0 ? apps : NO_APPS;
482
+ }, [active, results]);
483
+ const lastItemIndex = useRef(-1);
484
+ useEffect(() => {
485
+ if (!isOpen)
486
+ return undefined;
487
+ const remember = (event) => {
488
+ var _a, _b;
489
+ const items = Array.from((_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(ITEM_SELECTOR)) !== null && _b !== void 0 ? _b : []);
490
+ lastItemIndex.current = items.indexOf(event.target);
491
+ };
492
+ const forget = () => {
493
+ lastItemIndex.current = -1;
494
+ };
495
+ document.addEventListener("focusin", remember);
496
+ document.addEventListener("pointerdown", forget);
497
+ return () => {
498
+ document.removeEventListener("focusin", remember);
499
+ document.removeEventListener("pointerdown", forget);
500
+ };
501
+ }, [isOpen]);
502
+ useEffect(() => {
503
+ var _a, _b;
504
+ if (lastItemIndex.current < 0 || document.activeElement !== document.body)
505
+ return;
506
+ const items = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(ITEM_SELECTOR);
507
+ if (!(items === null || items === void 0 ? void 0 : items.length))
508
+ return (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
509
+ items[Math.min(lastItemIndex.current, items.length - 1)].focus();
510
+ }, [appList]);
308
511
  const hues = useMemo(() => assignAppHues(appList, chartMode(colors)), [appList, colors]);
309
- const showApps = appList.some((app) => app.id !== currentAppId) &&
310
- (appsVisibility === "always" || !isDesktop);
311
512
  const handleAppSelect = (app, event) => {
312
513
  onAppSelect === null || onAppSelect === void 0 ? void 0 : onAppSelect(app, event);
313
514
  if (!event.defaultPrevented)
314
515
  onClose();
315
516
  };
316
- const appsBlock = showApps ? (_jsx(AppsSection, { apps: appList, hues: hues, currentAppId: currentAppId, heading: labels.apps, onSelect: handleAppSelect })) : null;
517
+ const renderApps = (hideHeading) => (_jsx(AppsSection, { apps: appList, hues: hues, currentAppId: currentAppId, heading: labels.apps, hideHeading: hideHeading, onSelect: handleAppSelect }));
317
518
  const listboxId = `${baseId}-results`;
318
519
  const optionId = (index) => `${baseId}-opt-${index}`;
319
520
  const togglePinFor = (id) => onTogglePin ? () => onTogglePin(id) : undefined;
320
521
  const hasResults = results.length > 0;
321
522
  const trimmed = query.trim();
322
- const railFrequent = frequentItems
323
- .filter(({ screen }) => !pinned.has(screen.id))
324
- .slice(0, frequentLimit);
325
- const rail = (_jsxs(Rail, { label: labels.quickAccess, children: [_jsxs(Flex, { as: "section", direction: "column", gap: "6px", children: [_jsx(SectionHeader, { label: labels.pinned, meta: `(${pinnedItems.length})`, isRail: true }), pinnedItems.length === 0 ? (_jsx(Text, { fontSize: "13px", color: colors.textMuted, px: "4px", children: labels.pinnedEmpty })) : (_jsx(Box, { display: "grid", gridTemplateColumns: "repeat(2, minmax(0, 1fr))", gap: "6px", children: pinnedItems.map(({ screen, module }) => (_jsx(PinnedTile, { screen: screen, module: module, link: link, labels: labels, onTogglePin: togglePinFor(screen.id) }, screen.id))) }))] }), railFrequent.length ? (_jsxs(Flex, { as: "section", direction: "column", gap: "2px", children: [_jsx(SectionHeader, { label: labels.frequent, isRail: true, hasCount: false }), railFrequent.map(({ screen, module }) => (_jsx(RailRow, { screen: screen, module: module, link: link, isStrong: true, pinId: onTogglePin ? screen.id : undefined, trailing: _jsxs(_Fragment, { children: [onTogglePin ? (_jsx(PinTextButton, { label: labels.pin(screen.label), text: labels.pinShort, onToggle: () => onTogglePin(screen.id) })) : null, _jsx(NewTabLink, { href: screen.href, label: labels.openInNewTab(screen.label), linkAs: link.linkAs })] }) }, screen.id)))] })) : null, recentItems.length ? (_jsxs(Flex, { as: "section", direction: "column", gap: "2px", children: [_jsx(SectionHeader, { label: labels.recent, isRail: true, hasCount: false }), recentItems.map(({ screen, module }) => (_jsx(RailRow, { screen: screen, module: module, link: link, trailing: _jsx(NewTabLink, { href: screen.href, label: labels.openInNewTab(screen.label), linkAs: link.linkAs }) }, screen.id)))] })) : null, appsBlock] }));
326
- const browsePane = sections.length === 0 ? (_jsx(EmptyState, { title: labels.empty, titleAs: "h3", size: "sm" })) : (sections.map((section) => (_jsxs(Flex, { as: "section", "aria-label": section.label, direction: "column", gap: "3px", children: [_jsx(SectionHeader, { label: section.label, meta: `(${section.modules.length})` }), _jsx(ItemGrid, { children: section.modules.map((module) => {
523
+ const pinnedColumns = !isLg && isDesktop ? 3 : PINNED_COLUMNS;
524
+ const quickSections = (_jsxs(_Fragment, { children: [_jsxs(Flex, { as: "section", direction: "column", gap: "6px", children: [_jsx(SectionHeader, { label: labels.pinned, meta: `(${pinnedItems.length})`, isRail: true }), pinnedItems.length === 0 ? (_jsx(Text, { fontSize: "13px", color: colors.textMuted, px: "4px", children: labels.pinnedEmpty })) : (_jsx(Box, { "data-nav-grid": true, "data-nav-columns": pinnedColumns, display: "grid", gridTemplateColumns: `repeat(${pinnedColumns}, minmax(0, 1fr))`, gap: "6px", children: pinnedItems.map(({ screen, module }) => (_jsx(PinnedTile, { screen: screen, module: module, link: link, labels: labels, onTogglePin: togglePinFor(screen.id) }, screen.id))) }))] }), railFrequent.length ? (_jsxs(Flex, { as: "section", direction: "column", gap: "2px", children: [_jsx(SectionHeader, { label: labels.frequent, isRail: true, hasCount: false }), railFrequent.map(({ screen, module }) => (_jsx(RailRow, { screen: screen, module: module, link: link, isStrong: true, pinId: onTogglePin ? screen.id : undefined, trailing: _jsxs(_Fragment, { children: [onTogglePin ? (_jsx(PinTextButton, { label: labels.pin(screen.label), text: labels.pinShort, onToggle: () => onTogglePin(screen.id) })) : null, _jsx(NewTabLink, { href: screen.href, label: labels.openInNewTab(screen.label), tip: labels.newTabTip, linkAs: link.linkAs })] }) }, screen.id)))] })) : null, recentItems.length ? (_jsxs(Flex, { as: "section", direction: "column", gap: "2px", children: [_jsx(SectionHeader, { label: labels.recent, isRail: true, hasCount: false }), recentItems.map(({ screen, module }) => (_jsx(RailRow, { screen: screen, module: module, link: link, trailing: _jsx(NewTabLink, { href: screen.href, label: labels.openInNewTab(screen.label), tip: labels.newTabTip, linkAs: link.linkAs }) }, screen.id)))] })) : null] }));
525
+ const rail = (_jsxs(Rail, { label: labels.quickAccess, scrolls: isLg, children: [quickSections, showApps ? renderApps(false) : null] }));
526
+ const browsePane = sections.length === 0 ? (_jsx(EmptyState, { title: labels.empty, titleAs: "h3", size: "sm" })) : (sections.map((section) => (_jsxs(Flex, { as: "section", "aria-label": section.label, direction: "column", gap: "3px", children: [_jsx(SectionHeader, { label: section.label, meta: `(${section.modules.length})` }), _jsx(ItemGrid, { columns: columns, children: section.modules.map((module) => {
327
527
  const pinId = module.screens[0].id;
328
528
  return (_jsx(ModuleRow, { module: module, keyScreens: module.screens
329
529
  .filter((s) => s.isKey && s.href !== module.href)
@@ -337,20 +537,27 @@ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pi
337
537
  const noResults = (_jsxs(Flex, { direction: "column", align: "center", gap: "12px", py: "48px", px: "20px", textAlign: "center", role: "status", children: [_jsx(Flex, { boxSize: "40px", borderRadius: "12px", bg: colors.backgroundColor.subtle, color: colors.textMuted, align: "center", justify: "center", children: _jsx(SearchIcon, { size: 18, strokeWidth: 2, "aria-hidden": true }) }), _jsxs(Flex, { direction: "column", gap: "3px", children: [_jsx(Text, { fontSize: "14px", fontWeight: 600, color: colors.text[900], children: isSearching ? labels.searching : labels.noResults(trimmed) }), isSearching ? null : (_jsx(Text, { fontSize: "12.5px", color: colors.textMuted, children: (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length)
338
538
  ? labels.suggestionsHint
339
539
  : labels.noResultsHint }))] }), !isSearching && (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) ? (_jsx(Flex, { wrap: "wrap", justify: "center", gap: "6px", children: suggestions.map((suggestion) => (_jsx(Box, { as: "button", type: "button", onClick: () => pickSuggestion(suggestion), h: "28px", px: "11px", borderRadius: "full", borderWidth: "1px", borderColor: colors.boxborder[200], bg: colors.surfaceRaised, fontSize: "12.5px", fontWeight: 500, color: colors.text[900], transition: transitionFor(["background-color"]), _hover: { bg: listRowBackgrounds(colors).active }, sx: focusVisibleStyles(colors), children: suggestion }, suggestion))) })) : null] }));
340
- const searchPane = hasResults ? (_jsx(Flex, { role: "listbox", id: listboxId, "aria-label": labels.title, "aria-busy": isSearching || undefined, direction: "column", gap: "14px", children: groups.map((group, groupIndex) => (_jsxs(Flex, { role: "group", "aria-label": group.meta ? `${group.label}, ${group.meta}` : group.label, direction: "column", gap: "3px", children: [_jsx(SectionHeader, { label: group.label, meta: group.meta ? `(${group.meta})` : undefined, isDecorative: true }), _jsx(ItemGrid, { children: group.items.map((item, itemIndex) => {
540
+ const searchPane = hasResults ? (_jsx(Flex, { role: "listbox", id: listboxId, "aria-label": labels.title, "aria-busy": isSearching || undefined, direction: "column", gap: "14px", children: groups.map((group, groupIndex) => (_jsxs(Flex, { role: "group", "aria-label": group.meta ? `${group.label}, ${group.meta}` : group.label, direction: "column", gap: "3px", children: [_jsx(SectionHeader, { label: group.label, meta: group.meta ? `(${group.meta})` : undefined, isDecorative: true }), _jsx(ItemGrid, { columns: columns, children: group.items.map((item, itemIndex) => {
341
541
  const index = groupStarts[groupIndex] + itemIndex;
342
- return (_jsx(SearchRow, { item: item, query: query, isActive: index === activeIndex, link: link, labels: labels, optionId: optionId(index), isPinned: item.screenId ? pinned.has(item.screenId) : false, canPin: Boolean(onTogglePin) && item.kind === "module", onPin: () => item.screenId && (onTogglePin === null || onTogglePin === void 0 ? void 0 : onTogglePin(item.screenId)), onOpen: () => open(item, false), onHover: () => setActiveIndex(index) }, item.id));
542
+ return (_jsx(SearchRow, { item: item, query: query, isActive: index === active, link: link, labels: labels, optionId: optionId(index), isPinned: item.screenId ? pinned.has(item.screenId) : false, canPin: Boolean(onTogglePin) && item.kind === "module", onPin: () => item.screenId && (onTogglePin === null || onTogglePin === void 0 ? void 0 : onTogglePin(item.screenId)), onOpen: () => open(item, false), onHover: () => setActiveIndex(index) }, item.id));
343
543
  }) })] }, group.id))) })) : (noResults);
344
- const body = isLoading ? (_jsx(SkeletonLayout, { label: labels.loading })) : (_jsxs(_Fragment, { children: [_jsx(Pane, { children: isSearchView ? searchPane : browsePane }), rail] }));
345
- const pill = resolveFilledSurface(colors.primary, colors);
346
- return (_jsxs(Drawer, { isOpen: isOpen, onClose: onClose, placement: "left", size: "full", initialFocusRef: inputRef, hideCloseButton: true, contentProps: {
347
- maxW: { base: "100vw", lg: `min(${maxWidth}, calc(100vw - 56px))` },
348
- h: { base: "100%", lg: "auto" },
349
- maxH: "100%",
350
- bg: colors.surfaceRaised,
351
- borderBottomRightRadius: { base: 0, lg: "16px" },
352
- boxShadow: colors.boxShadow.default,
353
- overflow: "hidden",
354
- ...{ "data-testid": testId },
355
- }, children: [_jsx(DrawerHeader, { p: 0, flexShrink: 0, children: _jsxs(Flex, { align: "center", gap: "12px", h: "60px", pl: "18px", pr: "12px", children: [_jsxs(Heading, { as: "h2", display: "inline-flex", alignItems: "center", gap: "7px", h: "32px", pl: "9px", pr: "11px", borderRadius: "9px", bg: pill.fill, color: pill.color, fontSize: "13px", fontWeight: 600, flexShrink: 0, children: [_jsx(Compass, { size: 16, strokeWidth: 2, "aria-hidden": true }), labels.title] }), _jsx(SearchField, { inputRef: inputRef, value: query, onChange: setQuery, onKeyDown: onInputKeyDown, labels: labels, hint: searchHint, listboxId: listboxId, activeId: isSearchView && hasResults ? optionId(activeIndex) : undefined, isExpanded: isSearchView, hasResults: hasResults }), _jsx(IconButton, { "aria-label": labels.close, icon: _jsx(X, { size: 18, "aria-hidden": true }), variant: "ghost", boxSize: "34px", minW: "34px", borderRadius: "9px", color: colors.textMuted, ml: "auto", onClick: onClose })] }) }), _jsx(DrawerBody, { p: 0, display: "flex", flexDirection: { base: "column", lg: "row" }, overflowY: { base: "auto", lg: "hidden" }, minH: 0, children: _jsx(Flex, { ref: bodyRef, onKeyDown: onBodyKeyDown, direction: { base: "column", lg: "row" }, flex: 1, minH: 0, minW: 0, children: body }) }), _jsxs(DrawerFooter, { p: 0, minH: "32px", flexShrink: 0, px: "18px", py: "6px", gap: "6px 14px", flexWrap: "wrap", bg: colors.backgroundColor.subtle, fontSize: "11.5px", color: colors.textMuted, whiteSpace: "nowrap", justifyContent: "flex-start", children: [_jsxs(Flex, { gap: "6px 14px", align: "center", wrap: "wrap", "aria-hidden": true, children: [openShortcutHint ? (_jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: openShortcutHint }), labels.hintOpenMenu] })) : null, _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: "\u2191\u2193\u2190\u2192" }), labels.hintMove] }), _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: "\u21B5" }), labels.hintOpen] }), _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: `${modKeyLabel !== null && modKeyLabel !== void 0 ? modKeyLabel : (isApplePlatform() ? "⌘" : "Ctrl")}↵` }), labels.hintNewTab] }), onTogglePin ? (_jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: "P" }), labels.hintPin] })) : null, _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: "esc" }), labels.hintClose] })] }), _jsx(Text, { as: "span", ml: "auto", children: labels.footerNote })] })] }));
544
+ const stacked = (_jsxs(_Fragment, { children: [_jsx(Pane, { scrolls: isLg, children: isSearchView ? searchPane : browsePane }), rail] }));
545
+ const body = isLoading ? _jsx(SkeletonLayout, { label: labels.loading }) : stacked;
546
+ const tabPanels = {
547
+ menu: _jsx(Pane, { children: browsePane }),
548
+ quick: (_jsx(Flex, { direction: "column", gap: "16px", px: "18px", pt: "14px", pb: "16px", children: quickSections })),
549
+ apps: (_jsx(Box, { px: "14px", pt: "10px", pb: "16px", children: renderApps(true) })),
550
+ };
551
+ const compactBody = (_jsx(Flex, { "data-scroll-region": true, role: isTabbed ? "tabpanel" : undefined, id: isTabbed ? panelId(baseId) : undefined, "aria-labelledby": isTabbed ? tabId(baseId, activeTab) : undefined, direction: "column", flex: 1, minH: 0, overflowY: "auto", children: isTabbed ? tabPanels[activeTab] : body }));
552
+ return (_jsx(TouchDensity, { value: !isLg, children: _jsxs(Drawer, { isOpen: isOpen, onClose: onClose, placement: "left", size: "full", initialFocusRef: inputRef, hideCloseButton: true, closeOnEsc: false, contentProps: {
553
+ maxW: { base: "100vw", lg: `min(${maxWidth}, calc(100vw - 56px))` },
554
+ h: { base: "100%", lg: "auto" },
555
+ maxH: "100%",
556
+ bg: colors.surfaceRaised,
557
+ borderBottomRightRadius: { base: 0, lg: "16px" },
558
+ boxShadow: colors.boxShadow.default,
559
+ overflow: "hidden",
560
+ onKeyDown: onContentKeyDown,
561
+ ...{ "data-testid": testId },
562
+ }, children: [_jsx(DrawerHeader, { p: 0, flexShrink: 0, children: _jsxs(Flex, { align: "center", gap: { base: "8px", md: "12px" }, minH: { base: "60px", md: "68px" }, pl: { base: "12px", md: "18px" }, pr: { base: "8px", md: "12px" }, children: [_jsx(VisuallyHidden, { as: "h2", children: labels.title }), _jsx(SearchField, { inputRef: inputRef, value: query, onChange: setQuery, onKeyDown: onInputKeyDown, labels: labels, hint: searchHint, listboxId: listboxId, activeId: isSearchView && hasResults ? optionId(active) : undefined, isExpanded: isSearchView, hasResults: hasResults }), _jsx(Box, { "aria-hidden": true, "data-testid": "launcher-count", display: { base: "none", sm: "block" }, flexShrink: 0, overflow: "hidden", w: countText ? "88px" : "0", opacity: countText ? 1 : 0, textAlign: "right", fontSize: "13px", whiteSpace: "nowrap", color: colors.textMuted, transition: transitionFor(["width", "opacity"]), sx: { fontVariantNumeric: "tabular-nums", ...reducedMotionSx() }, children: countText }), headerActions ? (_jsx(Flex, { align: "center", gap: "4px", flexShrink: 0, children: headerActions })) : null, _jsx(IconButton, { "aria-label": labels.close, icon: _jsx(X, { size: 18, "aria-hidden": true }), variant: "ghost", boxSize: { base: "40px", md: "44px" }, minW: { base: "40px", md: "44px" }, borderRadius: "10px", flexShrink: 0, color: colors.textMuted, onClick: onClose })] }) }), _jsx(DrawerBody, { p: 0, display: "flex", flexDirection: "column", overflowY: "hidden", minH: 0, children: _jsxs(Flex, { ref: bodyRef, direction: "column", flex: 1, minH: 0, minW: 0, children: [_jsx(VisuallyHidden, { "data-testid": "launcher-live", "aria-live": "polite", "aria-atomic": "true", children: countText }), isTabbed ? (_jsx(LauncherTabs, { tabs: tabs, selected: activeTab, onSelect: setTab, idBase: baseId, label: labels.tabsLabel, onLeaveUp: () => focusField(), onLeaveDown: () => moveFocus("first") })) : null, isLg ? (_jsx(Flex, { direction: "row", flex: 1, minH: 0, minW: 0, children: body })) : (compactBody)] }) }), _jsxs(DrawerFooter, { p: 0, minH: "32px", flexShrink: 0, px: "18px", py: "6px", gap: "6px 14px", flexWrap: "wrap", bg: colors.backgroundColor.subtle, fontSize: "11.5px", color: colors.textMuted, whiteSpace: "nowrap", justifyContent: "flex-start", children: [_jsxs(Flex, { gap: "6px 14px", align: "center", wrap: "wrap", "aria-hidden": true, sx: { "@media (hover: none)": { display: "none" } }, children: [_jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Flex, { as: "span", gap: "2px", children: ARROW_KEYS.map((arrow) => (_jsx(Kbd, { size: "xs", children: arrow }, arrow))) }), labels.hintMove] }), _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(KbdShortcut, { shortcut: "enter", size: "xs" }), labels.hintOpen] }), _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [modKeyLabel ? (_jsxs(Flex, { as: "span", gap: "4px", children: [_jsx(Kbd, { size: "xs", children: modKeyLabel }), _jsx(Kbd, { size: "xs", children: ENTER_KEY })] })) : (_jsx(KbdShortcut, { shortcut: "mod+enter", size: "xs" })), labels.hintNewTab] }), _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: modKeyLabel !== null && modKeyLabel !== void 0 ? modKeyLabel : MOD_KEY }), labels.hintClickNewTab] }), onTogglePin ? (_jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: "P" }), labels.hintPin] })) : null, _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(KbdShortcut, { shortcut: "esc", size: "xs" }), labels.hintClose] })] }), _jsx(Text, { as: "span", ml: "auto", children: labels.footerNote })] })] }) }));
356
563
  }
@@ -3,9 +3,10 @@ import { Box } from "@chakra-ui/react";
3
3
  import { ArrowUpRight } from "lucide-react";
4
4
  import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
5
5
  import { useCustomTheme } from "../../Theme/useCustomTheme.js";
6
+ import ToolTip from "../ToolTip/ToolTip.js";
6
7
  import { revealStyles } from "./revealStyles.js";
7
- /** "Open in a new tab" anchor; visible on row hover, focus-within or its own focus only. */
8
- export default function NewTabLink({ href, label, linkAs = "a", tabIndex }) {
8
+ /** "Open in a new tab" anchor with a tooltip; visible on row hover, keyboard-active or focus-within, or its own focus. */
9
+ export default function NewTabLink({ href, label, tip, linkAs = "a", tabIndex, }) {
9
10
  const { colors } = useCustomTheme();
10
- return (_jsx(Box, { as: linkAs, href: href, target: "_blank", rel: "noopener noreferrer", "aria-label": label, title: label, tabIndex: tabIndex, display: "inline-flex", alignItems: "center", justifyContent: "center", w: "22px", h: "22px", flexShrink: 0, borderRadius: "md", color: colors.textMuted, opacity: 0, transition: transitionFor(["opacity", "background-color"]), sx: revealStyles(colors), _hover: { bg: colors.backgroundColor.subtle }, children: _jsx(ArrowUpRight, { size: 13, "aria-hidden": true }) }));
11
+ return (_jsx(ToolTip, { label: tip !== null && tip !== void 0 ? tip : label, placement: "bottom", children: _jsx(Box, { as: linkAs, href: href, target: "_blank", rel: "noopener noreferrer", "aria-label": label, tabIndex: tabIndex, display: "inline-flex", alignItems: "center", justifyContent: "center", w: "22px", h: "22px", flexShrink: 0, borderRadius: "md", color: colors.textMuted, opacity: 0, transition: transitionFor(["opacity", "background-color"]), sx: revealStyles(colors), _hover: { bg: colors.backgroundColor.subtle }, children: _jsx(ArrowUpRight, { size: 13, "aria-hidden": true }) }) }));
11
12
  }