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