pixelize-design-library 2.4.2-beta.63 → 2.4.2-beta.65
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 +130 -8
- package/COMPONENT-GOTCHAS.md +63 -7
- package/DESIGN-GUIDE.md +8 -3
- package/dist/Components/Button/Button.styles.js +7 -2
- package/dist/Components/CopyButton/CopyButton.d.ts +3 -1
- package/dist/Components/CopyButton/CopyButton.js +2 -2
- package/dist/Components/Drawer/Drawer.d.ts +1 -1
- package/dist/Components/Drawer/Drawer.js +6 -2
- package/dist/Components/Drawer/DrawerProps.d.ts +4 -0
- package/dist/Components/Dropdown/DropDown.js +2 -9
- package/dist/Components/FilePreview/FilePreview.js +2 -1
- package/dist/Components/FileUploader/FileUploader.js +4 -0
- package/dist/Components/FileUploader/FileUploaderProps.d.ts +1 -1
- package/dist/Components/FormDrawer/FormDrawer.d.ts +1 -1
- package/dist/Components/FormDrawer/FormDrawer.js +3 -3
- package/dist/Components/FormDrawer/FormDrawerProps.d.ts +2 -0
- package/dist/Components/Input/TextInput.styles.js +10 -6
- package/dist/Components/KanbanBoard/KanbanBoard.js +6 -5
- package/dist/Components/Modal/dialogNaming.d.ts +8 -0
- package/dist/Components/Modal/dialogNaming.js +21 -0
- package/dist/Components/NavLauncher/LauncherTabs.js +2 -2
- package/dist/Components/NavLauncher/NavLauncher.d.ts +1 -1
- package/dist/Components/NavLauncher/NavLauncher.js +257 -47
- package/dist/Components/NavLauncher/NavLauncherProps.d.ts +79 -3
- package/dist/Components/NavLauncher/ScopeBar.d.ts +14 -0
- package/dist/Components/NavLauncher/ScopeBar.js +137 -0
- package/dist/Components/NavLauncher/engine/distance.d.ts +4 -0
- package/dist/Components/NavLauncher/engine/distance.js +41 -0
- package/dist/Components/NavLauncher/engine/engine.d.ts +84 -0
- package/dist/Components/NavLauncher/engine/engine.js +471 -0
- package/dist/Components/NavLauncher/engine/fold.d.ts +15 -0
- package/dist/Components/NavLauncher/engine/fold.js +83 -0
- package/dist/Components/NavLauncher/engine/index.d.ts +21 -0
- package/dist/Components/NavLauncher/engine/index.js +17 -0
- package/dist/Components/NavLauncher/launcherParts.d.ts +2 -0
- package/dist/Components/NavLauncher/launcherParts.js +11 -7
- package/dist/Components/NavLauncher/match.d.ts +13 -2
- package/dist/Components/NavLauncher/match.js +26 -12
- package/dist/Components/NavLauncher/searchLayout.d.ts +60 -0
- package/dist/Components/NavLauncher/searchLayout.js +108 -0
- package/dist/Components/NavLauncher/spotlight.d.ts +39 -0
- package/dist/Components/NavLauncher/spotlight.js +202 -0
- package/dist/Components/NavLauncher/spotlightParts.d.ts +49 -0
- package/dist/Components/NavLauncher/spotlightParts.js +108 -0
- package/dist/Components/NavigationBar/NavigationBar.js +2 -1
- package/dist/Components/OrgSwitcher/OrgSwitcher.js +2 -4
- package/dist/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +6 -5
- package/dist/Components/ScrollToTop/ScrollToTop.js +4 -3
- package/dist/Components/SearchSelect/SearchSelect.js +4 -16
- package/dist/Components/Select/SelectPopup.js +1 -3
- package/dist/Components/Select/optionRowInk.d.ts +12 -0
- package/dist/Components/Select/optionRowInk.js +10 -1
- package/dist/Components/SelectSearch/SelectSearch.js +1 -10
- package/dist/Components/Table/Table.js +3 -2
- package/dist/Components/Table/TableProps.d.ts +1 -1
- package/dist/Components/Table/components/TableBody.js +9 -1
- package/dist/Components/Table/components/TableHeader.js +9 -2
- package/dist/Components/Table/components/TableLoading.d.ts +4 -1
- package/dist/Components/Table/components/TableLoading.js +13 -6
- package/dist/Components/Table/filters/CompactSelect.js +1 -10
- package/dist/Components/Table/variants/TableVariantContext.d.ts +1 -1
- package/dist/Components/Table/variants/TableVariantContext.js +3 -3
- package/dist/Components/WizardDialog/WizardDialog.d.ts +1 -1
- package/dist/Components/WizardDialog/WizardDialog.js +15 -3
- package/dist/Components/WizardDialog/WizardDialogProps.d.ts +5 -3
- package/dist/Components/WorkspaceWindow/WorkspaceTrayPreview.js +4 -0
- package/dist/Components/WorkspaceWindow/WorkspaceWindow.d.ts +2 -2
- package/dist/Components/WorkspaceWindow/WorkspaceWindow.js +26 -18
- package/dist/Components/WorkspaceWindow/WorkspaceWindowProps.d.ts +38 -8
- package/dist/Theme/chakra/Menu.styles.d.ts +8 -0
- package/dist/Theme/chakra/Menu.styles.js +7 -0
- package/dist/Theme/chakra/componentStyles.d.ts +8 -0
- package/dist/Theme/chakra/componentStyles.js +2 -2
- package/dist/Theme/chakra/ringShadow.d.ts +3 -0
- package/dist/Theme/chakra/ringShadow.js +7 -0
- package/dist/Theme/tokens/builders/accentText.d.ts +2 -0
- package/dist/Theme/tokens/builders/accentText.js +7 -1
- package/dist/Theme/tokens/builders/buildDarkPalette.d.ts +1 -1
- package/dist/Theme/tokens/builders/buildDarkPalette.js +5 -5
- package/dist/Theme/tokens/builders/filledSurface.d.ts +5 -1
- package/dist/Theme/tokens/builders/filledSurface.js +17 -4
- package/dist/Theme/tokens/builders/planeStep.d.ts +1 -0
- package/dist/Theme/tokens/builders/planeStep.js +5 -4
- package/dist/Utils/table.js +2 -2
- package/dist/esm/Components/Button/Button.styles.js +8 -3
- package/dist/esm/Components/CopyButton/CopyButton.js +2 -2
- package/dist/esm/Components/Drawer/Drawer.js +6 -2
- package/dist/esm/Components/Dropdown/DropDown.js +2 -9
- package/dist/esm/Components/FilePreview/FilePreview.js +3 -2
- package/dist/esm/Components/FileUploader/FileUploader.js +4 -0
- package/dist/esm/Components/FormDrawer/FormDrawer.js +3 -3
- package/dist/esm/Components/Input/TextInput.styles.js +10 -6
- package/dist/esm/Components/KanbanBoard/KanbanBoard.js +6 -5
- package/dist/esm/Components/Modal/dialogNaming.js +18 -0
- package/dist/esm/Components/NavLauncher/LauncherTabs.js +2 -2
- package/dist/esm/Components/NavLauncher/NavLauncher.js +259 -49
- package/dist/esm/Components/NavLauncher/ScopeBar.js +134 -0
- package/dist/esm/Components/NavLauncher/engine/distance.js +37 -0
- package/dist/esm/Components/NavLauncher/engine/engine.js +458 -0
- package/dist/esm/Components/NavLauncher/engine/fold.js +74 -0
- package/dist/esm/Components/NavLauncher/engine/index.js +14 -0
- package/dist/esm/Components/NavLauncher/launcherParts.js +10 -6
- package/dist/esm/Components/NavLauncher/match.js +25 -12
- package/dist/esm/Components/NavLauncher/searchLayout.js +100 -0
- package/dist/esm/Components/NavLauncher/spotlight.js +194 -0
- package/dist/esm/Components/NavLauncher/spotlightParts.js +95 -0
- package/dist/esm/Components/NavigationBar/NavigationBar.js +2 -1
- package/dist/esm/Components/OrgSwitcher/OrgSwitcher.js +2 -4
- package/dist/esm/Components/ProfilePhotoViewer/ProfilePhotoViewer.js +7 -6
- package/dist/esm/Components/ScrollToTop/ScrollToTop.js +5 -4
- package/dist/esm/Components/SearchSelect/SearchSelect.js +6 -18
- package/dist/esm/Components/Select/SelectPopup.js +2 -4
- package/dist/esm/Components/Select/optionRowInk.js +7 -0
- package/dist/esm/Components/SelectSearch/SelectSearch.js +2 -11
- package/dist/esm/Components/Table/Table.js +4 -3
- package/dist/esm/Components/Table/components/TableBody.js +10 -2
- package/dist/esm/Components/Table/components/TableHeader.js +10 -3
- package/dist/esm/Components/Table/components/TableLoading.js +10 -6
- package/dist/esm/Components/Table/filters/CompactSelect.js +2 -11
- package/dist/esm/Components/Table/variants/TableVariantContext.js +3 -3
- package/dist/esm/Components/WizardDialog/WizardDialog.js +15 -3
- package/dist/esm/Components/WorkspaceWindow/WorkspaceTrayPreview.js +4 -0
- package/dist/esm/Components/WorkspaceWindow/WorkspaceWindow.js +28 -20
- package/dist/esm/Theme/chakra/Menu.styles.js +7 -0
- package/dist/esm/Theme/chakra/componentStyles.js +2 -2
- package/dist/esm/Theme/chakra/ringShadow.js +3 -0
- package/dist/esm/Theme/tokens/builders/accentText.js +5 -0
- package/dist/esm/Theme/tokens/builders/buildDarkPalette.js +5 -5
- package/dist/esm/Theme/tokens/builders/filledSurface.js +18 -5
- package/dist/esm/Theme/tokens/builders/planeStep.js +3 -3
- package/dist/esm/Utils/table.js +2 -2
- package/dist/esm/index.js +6 -5
- package/dist/index.d.ts +10 -8
- package/dist/index.js +14 -6
- package/package.json +1 -1
|
@@ -63,6 +63,10 @@ const match_1 = require("./match");
|
|
|
63
63
|
const NewTabLink_1 = __importDefault(require("./NewTabLink"));
|
|
64
64
|
const PinToggle_1 = __importDefault(require("./PinToggle"));
|
|
65
65
|
const resultNavigation_1 = require("./resultNavigation");
|
|
66
|
+
const ScopeBar_1 = require("./ScopeBar");
|
|
67
|
+
const searchLayout_1 = require("./searchLayout");
|
|
68
|
+
const spotlight_1 = require("./spotlight");
|
|
69
|
+
const spotlightParts_1 = require("./spotlightParts");
|
|
66
70
|
const NO_APPS = [];
|
|
67
71
|
const MD_QUERY = "(min-width: 48em)";
|
|
68
72
|
const LG_QUERY = "(min-width: 62em)";
|
|
@@ -86,6 +90,11 @@ const RESULT_KEYS = [
|
|
|
86
90
|
];
|
|
87
91
|
const TEXT_TARGET = "input, textarea, select, [contenteditable=true]";
|
|
88
92
|
const ROW_HEIGHT = 46;
|
|
93
|
+
const SPOTLIGHT_GROUP_LIMIT = 5;
|
|
94
|
+
const FIELD_MIN_WIDTH = "max(15rem, 36%)";
|
|
95
|
+
const NO_GROUPS = new Set();
|
|
96
|
+
const NO_RESULTS = [];
|
|
97
|
+
const NO_SEARCH_GROUPS = [];
|
|
89
98
|
const DEFAULT_LABELS = {
|
|
90
99
|
title: "Menu",
|
|
91
100
|
searchPlaceholder: "Search menus and screens",
|
|
@@ -110,7 +119,6 @@ const DEFAULT_LABELS = {
|
|
|
110
119
|
hintNewTab: "new tab",
|
|
111
120
|
hintPin: "pin",
|
|
112
121
|
hintClose: "close",
|
|
113
|
-
hintOpenMenu: "open",
|
|
114
122
|
hintClickNewTab: "+ click for new tab",
|
|
115
123
|
newTabTip: "Open in new tab",
|
|
116
124
|
resultsCount: (count) => `${count} ${count === 1 ? "result" : "results"}`,
|
|
@@ -128,6 +136,31 @@ const DEFAULT_LABELS = {
|
|
|
128
136
|
pinShort: "Pin",
|
|
129
137
|
footerNote: "Pins follow your account",
|
|
130
138
|
suggestionsHint: "Try one of these",
|
|
139
|
+
topHit: "Top hit",
|
|
140
|
+
matchedOn: "Matches",
|
|
141
|
+
answers: "Answers",
|
|
142
|
+
hintCopy: "copy",
|
|
143
|
+
scopes: "Search in",
|
|
144
|
+
scopeAll: "All",
|
|
145
|
+
scopeChanged: (label) => `Showing ${label}`,
|
|
146
|
+
scopeCount: (label, count) => `${label}, ${count} ${count === 1 ? "result" : "results"}`,
|
|
147
|
+
scopeEmpty: (label) => `Type to search ${label}`,
|
|
148
|
+
quickActions: "Quick actions",
|
|
149
|
+
showMore: (count) => `Show ${count} more`,
|
|
150
|
+
preview: "Preview",
|
|
151
|
+
copy: (label) => `Copy ${label}`,
|
|
152
|
+
copied: "Copied",
|
|
153
|
+
copySelected: "Clipboard blocked, text selected — copy it with your keyboard",
|
|
154
|
+
};
|
|
155
|
+
const selectNode = (node) => {
|
|
156
|
+
var _a;
|
|
157
|
+
const selection = (_a = window.getSelection) === null || _a === void 0 ? void 0 : _a.call(window);
|
|
158
|
+
if (!node || !selection)
|
|
159
|
+
return;
|
|
160
|
+
const range = document.createRange();
|
|
161
|
+
range.selectNodeContents(node);
|
|
162
|
+
selection.removeAllRanges();
|
|
163
|
+
selection.addRange(range);
|
|
131
164
|
};
|
|
132
165
|
const visibleSections = (sections) => sections
|
|
133
166
|
.map((section) => ({
|
|
@@ -164,15 +197,15 @@ function Rail({ label, children, scrolls = false, }) {
|
|
|
164
197
|
function SkeletonLayout({ label }) {
|
|
165
198
|
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))) })] }));
|
|
166
199
|
}
|
|
167
|
-
function SearchField({ inputRef, value, onChange, onKeyDown, labels, hint, listboxId, activeId, isExpanded, hasResults, }) {
|
|
200
|
+
function SearchField({ inputRef, value, onChange, onKeyDown, labels, placeholder, hint, listboxId, activeId, isExpanded, hasResults, minW, }) {
|
|
168
201
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
169
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { flex: 1, minW:
|
|
202
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { flex: 1, minW: minW, 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: placeholder, "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: () => {
|
|
170
203
|
var _a;
|
|
171
204
|
onChange("");
|
|
172
205
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
173
206
|
}, boxSize: "24px", borderRadius: "6px", bg: colors.backgroundColor.subtle, color: colors.textMuted, display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, sx: (0, focusRing_styles_1.focusVisibleStyles)(colors), children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: 12, strokeWidth: 2.4, "aria-hidden": true }) })) : null, hint ? ((0, jsx_runtime_1.jsx)(react_1.Box, { "aria-hidden": true, display: { base: "none", md: "block" }, children: (0, jsx_runtime_1.jsx)(Kbd_1.default, { size: "xs", children: hint }) })) : null] }));
|
|
174
207
|
}
|
|
175
|
-
function SearchRow({ item, query, isActive, link, labels, optionId, isPinned, canPin, onPin, onOpen, onHover, }) {
|
|
208
|
+
function SearchRow({ item, query, isActive, link, labels, optionId, isPinned, canPin, onPin, onOpen, onHover, describedBy, }) {
|
|
176
209
|
const { colors } = (0, useCustomTheme_1.useCustomTheme)();
|
|
177
210
|
const isTouch = (0, launcherParts_1.useTouchDensity)();
|
|
178
211
|
const isScreen = item.kind === "screen";
|
|
@@ -187,17 +220,18 @@ function SearchRow({ item, query, isActive, link, labels, optionId, isPinned, ca
|
|
|
187
220
|
const tipLabel = isScreen || !item.context ? fullLabel : `${fullLabel} · ${item.context}`;
|
|
188
221
|
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
222
|
? { ...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: () => {
|
|
223
|
+
: launcherParts_1.ROW_CONTAINER, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { id: optionId, role: "option", "aria-selected": isActive, "aria-describedby": describedBy, "data-active": isActive, flex: 1, minW: 0, align: "flex-start", gap: "10px", cursor: "pointer", onClick: () => {
|
|
191
224
|
if (!item.href)
|
|
192
225
|
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: {
|
|
226
|
+
}, 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", overflow: item.keywordHint ? "hidden" : undefined, 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, ...(item.keywordHint ? { flexShrink: 0, maxW: "100%" } : {}), 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", minW: 0, flexShrink: 100, overflow: "hidden", textOverflow: "ellipsis", 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
227
|
display: "none",
|
|
195
228
|
[launcherParts_1.WIDE_ROW]: { display: "inline-flex" },
|
|
196
229
|
"@media (hover: none)": { display: "none" },
|
|
197
230
|
}, 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] }) }));
|
|
198
231
|
}
|
|
199
232
|
/** Left-drawer navigation launcher: browse every module, pins, Frequent, Recent, search and (compact) the suite's apps. */
|
|
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, }) {
|
|
233
|
+
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", searchMode = "classic", synonyms, scopes, activeScope, onScopeChange, quickActions, answers, groupLimit, "data-testid": testId, }) {
|
|
234
|
+
var _a, _b, _c;
|
|
201
235
|
const theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
202
236
|
const { colors } = theme;
|
|
203
237
|
const inputRef = (0, react_2.useRef)(null);
|
|
@@ -210,54 +244,157 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
210
244
|
const [innerQuery, setInnerQuery] = (0, react_2.useState)("");
|
|
211
245
|
const [activeIndex, setActiveIndex] = (0, react_2.useState)(0);
|
|
212
246
|
const [tab, setTab] = (0, react_2.useState)("menu");
|
|
247
|
+
const [innerScope, setInnerScope] = (0, react_2.useState)(spotlight_1.SCOPE_ALL);
|
|
248
|
+
const [expanded, setExpanded] = (0, react_2.useState)(NO_GROUPS);
|
|
249
|
+
const [announcement, setAnnouncement] = (0, react_2.useState)({ text: "", n: 0 });
|
|
213
250
|
const navigating = (0, react_2.useRef)(false);
|
|
214
251
|
const labels = (0, react_2.useMemo)(() => ({ ...DEFAULT_LABELS, ...labelOverrides }), [labelOverrides]);
|
|
215
252
|
const isControlled = controlledQuery !== undefined;
|
|
216
253
|
const query = isControlled ? controlledQuery : innerQuery;
|
|
254
|
+
const isSpotlight = searchMode === "spotlight";
|
|
217
255
|
const setQuery = (0, react_2.useCallback)((next) => {
|
|
218
256
|
if (!isControlled)
|
|
219
257
|
setInnerQuery(next);
|
|
220
258
|
onQueryChange === null || onQueryChange === void 0 ? void 0 : onQueryChange(next);
|
|
221
259
|
}, [isControlled, onQueryChange]);
|
|
222
|
-
const
|
|
223
|
-
|
|
260
|
+
const scopeList = (0, react_2.useMemo)(() => {
|
|
261
|
+
if (!(scopes === null || scopes === void 0 ? void 0 : scopes.length))
|
|
262
|
+
return [];
|
|
263
|
+
if (scopes.some((s) => s.id === spotlight_1.SCOPE_ALL))
|
|
264
|
+
return [...scopes];
|
|
265
|
+
return [{ id: spotlight_1.SCOPE_ALL, label: labels.scopeAll }, ...scopes];
|
|
266
|
+
}, [scopes, labels.scopeAll]);
|
|
267
|
+
const rawScope = activeScope !== null && activeScope !== void 0 ? activeScope : innerScope;
|
|
268
|
+
const scope = scopeList.some((s) => s.id === rawScope) ? rawScope : spotlight_1.SCOPE_ALL;
|
|
269
|
+
const announce = (0, react_2.useCallback)((text) => setAnnouncement((prev) => ({ text, n: prev.n + 1 })), []);
|
|
270
|
+
const setScope = (0, react_2.useCallback)((next, isSilent = false) => {
|
|
271
|
+
var _a;
|
|
272
|
+
if (activeScope === undefined)
|
|
273
|
+
setInnerScope(next);
|
|
274
|
+
onScopeChange === null || onScopeChange === void 0 ? void 0 : onScopeChange(next);
|
|
275
|
+
const label = (_a = scopeList.find((s) => s.id === next)) === null || _a === void 0 ? void 0 : _a.label;
|
|
276
|
+
if (!isSilent && label)
|
|
277
|
+
announce(labels.scopeChanged(label));
|
|
278
|
+
}, [activeScope, onScopeChange, scopeList, announce, labels]);
|
|
279
|
+
const latest = (0, react_2.useRef)({ query, setQuery, scope, setScope });
|
|
280
|
+
latest.current = { query, setQuery, scope, setScope };
|
|
224
281
|
(0, react_2.useEffect)(() => {
|
|
225
282
|
if (isOpen)
|
|
226
283
|
return;
|
|
227
284
|
setTab("menu");
|
|
285
|
+
setExpanded(NO_GROUPS);
|
|
286
|
+
setAnnouncement({ text: "", n: 0 });
|
|
228
287
|
if (latest.current.query !== "")
|
|
229
288
|
latest.current.setQuery("");
|
|
289
|
+
if (latest.current.scope !== spotlight_1.SCOPE_ALL)
|
|
290
|
+
latest.current.setScope(spotlight_1.SCOPE_ALL, true);
|
|
230
291
|
}, [isOpen]);
|
|
231
292
|
(0, react_2.useEffect)(() => {
|
|
232
293
|
navigating.current = false;
|
|
233
294
|
setActiveIndex(0);
|
|
234
|
-
}, [query]);
|
|
295
|
+
}, [query, scope]);
|
|
235
296
|
const sections = (0, react_2.useMemo)(() => visibleSections(rawSections), [rawSections]);
|
|
236
297
|
const byId = (0, react_2.useMemo)(() => indexScreens(sections), [sections]);
|
|
237
298
|
const pinned = (0, react_2.useMemo)(() => new Set(pinnedIds), [pinnedIds]);
|
|
238
299
|
const pinnedItems = (0, react_2.useMemo)(() => pinnedIds.flatMap((id) => { var _a; return (_a = byId.get(id)) !== null && _a !== void 0 ? _a : []; }), [pinnedIds, byId]);
|
|
239
300
|
const frequentItems = (0, react_2.useMemo)(() => frequentIds.flatMap((id) => { var _a; return (_a = byId.get(id)) !== null && _a !== void 0 ? _a : []; }), [frequentIds, byId]);
|
|
240
301
|
const recentItems = (0, react_2.useMemo)(() => recentIds.flatMap((id) => { var _a; return (_a = byId.get(id)) !== null && _a !== void 0 ? _a : []; }), [recentIds, byId]);
|
|
241
|
-
const
|
|
302
|
+
const spotIndex = (0, react_2.useMemo)(() => isSpotlight
|
|
303
|
+
? (0, spotlight_1.createSpotlightIndex)(sections, actions, labels.actionsGroup)
|
|
304
|
+
: null, [isSpotlight, sections, actions, labels.actionsGroup]);
|
|
305
|
+
const boosts = (0, react_2.useMemo)(() => spotIndex
|
|
306
|
+
? (0, spotlight_1.spotlightBoosts)(spotIndex, { pinnedIds, frequentIds, recentIds })
|
|
307
|
+
: undefined, [spotIndex, pinnedIds, frequentIds, recentIds]);
|
|
308
|
+
const modelGroups = (0, react_2.useMemo)(() => {
|
|
309
|
+
if (spotIndex) {
|
|
310
|
+
return (0, spotlight_1.searchSpotlight)(spotIndex, {
|
|
311
|
+
query,
|
|
312
|
+
extraResults,
|
|
313
|
+
synonyms,
|
|
314
|
+
boosts,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
const local = (extraResults !== null && extraResults !== void 0 ? extraResults : []).map((g) => g.matchLocally ? { ...g, items: (0, match_1.filterItems)(g.items, query) } : g);
|
|
318
|
+
const found = (0, match_1.searchLauncherSections)({
|
|
319
|
+
query,
|
|
320
|
+
sections,
|
|
321
|
+
actions,
|
|
322
|
+
extraResults: local,
|
|
323
|
+
actionsLabel: labels.actionsGroup,
|
|
324
|
+
});
|
|
325
|
+
const scopeOf = new Map(local.map((g) => { var _a; return [g.id, (_a = g.scope) !== null && _a !== void 0 ? _a : g.id]; }));
|
|
326
|
+
return [
|
|
327
|
+
...found.sections.map((s) => ({
|
|
328
|
+
id: `section:${s.id}`,
|
|
329
|
+
label: s.label,
|
|
330
|
+
scope: spotlight_1.SCOPE_SCREENS,
|
|
331
|
+
isSection: true,
|
|
332
|
+
items: s.items,
|
|
333
|
+
})),
|
|
334
|
+
...found.groups.map((g) => {
|
|
335
|
+
var _a;
|
|
336
|
+
return ({
|
|
337
|
+
...g,
|
|
338
|
+
scope: g.id === "actions" ? spotlight_1.SCOPE_ACTIONS : ((_a = scopeOf.get(g.id)) !== null && _a !== void 0 ? _a : g.id),
|
|
339
|
+
isSection: false,
|
|
340
|
+
});
|
|
341
|
+
}),
|
|
342
|
+
];
|
|
343
|
+
}, [
|
|
344
|
+
spotIndex,
|
|
242
345
|
query,
|
|
346
|
+
extraResults,
|
|
347
|
+
synonyms,
|
|
348
|
+
boosts,
|
|
243
349
|
sections,
|
|
244
350
|
actions,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
})),
|
|
255
|
-
...found.groups,
|
|
256
|
-
], [found, labels]);
|
|
257
|
-
const results = (0, react_2.useMemo)(() => groups.flatMap((g) => g.items), [groups]);
|
|
258
|
-
const groupStarts = (0, react_2.useMemo)(() => groups.map((_, i) => groups.slice(0, i).reduce((n, g) => n + g.items.length, 0)), [groups]);
|
|
351
|
+
labels.actionsGroup,
|
|
352
|
+
]);
|
|
353
|
+
const matchedAnswers = (0, react_2.useMemo)(() => (0, spotlight_1.matchAnswers)(answers, query, synonyms), [answers, query, synonyms]);
|
|
354
|
+
const answerResults = scope === spotlight_1.SCOPE_ALL ? matchedAnswers : NO_RESULTS;
|
|
355
|
+
const scoped = (0, react_2.useMemo)(() => {
|
|
356
|
+
const groups = (0, searchLayout_1.inScope)(modelGroups, scope);
|
|
357
|
+
return isSpotlight ? (0, searchLayout_1.takeTopHit)(groups) : { groups };
|
|
358
|
+
}, [modelGroups, scope, isSpotlight]);
|
|
359
|
+
const highlightOptions = (0, react_2.useMemo)(() => (isSpotlight ? { fuzzy: true, synonyms } : undefined), [isSpotlight, synonyms]);
|
|
259
360
|
const isSearchView = query.trim().length > 0;
|
|
260
|
-
const
|
|
361
|
+
const hasScopes = scopeList.length > 1;
|
|
362
|
+
const currentScope = scopeList.find((s) => s.id === scope);
|
|
363
|
+
const isScopeBrowse = !isSearchView && hasScopes && scope !== spotlight_1.SCOPE_ALL && scope !== spotlight_1.SCOPE_SCREENS;
|
|
364
|
+
const isListView = isSearchView || isScopeBrowse;
|
|
365
|
+
const browseGroups = (0, react_2.useMemo)(() => isScopeBrowse
|
|
366
|
+
? (0, searchLayout_1.scopeGroups)({
|
|
367
|
+
scope,
|
|
368
|
+
actions,
|
|
369
|
+
extraResults,
|
|
370
|
+
actionsLabel: labels.actionsGroup,
|
|
371
|
+
})
|
|
372
|
+
: NO_SEARCH_GROUPS, [isScopeBrowse, scope, actions, extraResults, labels.actionsGroup]);
|
|
373
|
+
const limit = groupLimit !== null && groupLimit !== void 0 ? groupLimit : (isSpotlight ? SPOTLIGHT_GROUP_LIMIT : undefined);
|
|
374
|
+
const layout = (0, react_2.useMemo)(() => isScopeBrowse
|
|
375
|
+
? (0, searchLayout_1.layoutSearch)({ answers: NO_RESULTS, groups: browseGroups, expanded })
|
|
376
|
+
: (0, searchLayout_1.layoutSearch)({
|
|
377
|
+
answers: answerResults,
|
|
378
|
+
topHit: scoped.topHit,
|
|
379
|
+
groups: scoped.groups,
|
|
380
|
+
limit,
|
|
381
|
+
expanded,
|
|
382
|
+
}), [isScopeBrowse, browseGroups, answerResults, scoped, limit, expanded]);
|
|
383
|
+
const scopeChips = (0, react_2.useMemo)(() => {
|
|
384
|
+
const counts = isSearchView && hasScopes
|
|
385
|
+
? (0, searchLayout_1.countByScope)(modelGroups, matchedAnswers.length)
|
|
386
|
+
: undefined;
|
|
387
|
+
return scopeList.map((s) => {
|
|
388
|
+
var _a;
|
|
389
|
+
return ({
|
|
390
|
+
id: s.id,
|
|
391
|
+
label: s.label,
|
|
392
|
+
count: counts ? ((_a = counts.get(s.id)) !== null && _a !== void 0 ? _a : 0) : undefined,
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
}, [isSearchView, hasScopes, modelGroups, matchedAnswers, scopeList]);
|
|
396
|
+
const entries = layout.entries;
|
|
397
|
+
const active = Math.min(activeIndex, Math.max(entries.length - 1, 0));
|
|
261
398
|
const appList = apps !== null && apps !== void 0 ? apps : NO_APPS;
|
|
262
399
|
const showApps = appList.some((app) => app.id !== currentAppId) &&
|
|
263
400
|
(appsVisibility === "always" || !isDesktop);
|
|
@@ -272,12 +409,9 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
272
409
|
: []),
|
|
273
410
|
...(showApps ? [{ id: "apps", label: labels.tabApps }] : []),
|
|
274
411
|
], [hasQuick, showApps, labels]);
|
|
275
|
-
const isTabbed = !isLg && !
|
|
412
|
+
const isTabbed = !isLg && !isListView && !isLoading && tabs.length > 1;
|
|
276
413
|
const activeTab = tabs.some((item) => item.id === tab) ? tab : "menu";
|
|
277
|
-
const countText = isSearchView &&
|
|
278
|
-
? labels.resultsCount(results.length)
|
|
279
|
-
: "";
|
|
280
|
-
const groupSizes = (0, react_2.useMemo)(() => groups.map((g) => g.items.length), [groups]);
|
|
414
|
+
const countText = isSearchView && layout.total > 0 ? labels.resultsCount(layout.total) : "";
|
|
281
415
|
const link = (0, react_2.useMemo)(() => ({
|
|
282
416
|
linkAs,
|
|
283
417
|
onPlainClick: (event) => {
|
|
@@ -297,6 +431,38 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
297
431
|
onClose();
|
|
298
432
|
onNavigate(item.href, { newTab });
|
|
299
433
|
}, [onClose, onNavigate]);
|
|
434
|
+
const copyValue = (0, react_2.useCallback)(async (value, node) => {
|
|
435
|
+
try {
|
|
436
|
+
await navigator.clipboard.writeText(value);
|
|
437
|
+
announce(labels.copied);
|
|
438
|
+
}
|
|
439
|
+
catch {
|
|
440
|
+
selectNode(node);
|
|
441
|
+
announce(labels.copySelected);
|
|
442
|
+
}
|
|
443
|
+
}, [announce, labels]);
|
|
444
|
+
const onCopied = (0, react_2.useCallback)(() => announce(labels.copied), [announce, labels]);
|
|
445
|
+
const onCopyBlocked = (0, react_2.useCallback)((node) => {
|
|
446
|
+
selectNode(node);
|
|
447
|
+
announce(labels.copySelected);
|
|
448
|
+
}, [announce, labels]);
|
|
449
|
+
const activate = (index, newTab) => {
|
|
450
|
+
var _a, _b;
|
|
451
|
+
const entry = entries[index];
|
|
452
|
+
if (!entry)
|
|
453
|
+
return;
|
|
454
|
+
if (entry.type === "more") {
|
|
455
|
+
setExpanded((prev) => new Set(prev).add(entry.groupId));
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
const { item } = entry;
|
|
459
|
+
if (entry.type === "answer" && !item.run && !item.href) {
|
|
460
|
+
const node = document.getElementById(`${baseId}-opt-${index}-value`);
|
|
461
|
+
void copyValue((_b = (_a = item.answer) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : item.label, node);
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
open(item, newTab);
|
|
465
|
+
};
|
|
300
466
|
const focusField = (shouldSelect = false) => {
|
|
301
467
|
var _a, _b;
|
|
302
468
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
@@ -348,18 +514,18 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
348
514
|
(height > 0 && byDistance.length ? byDistance[0] : fallback).focus();
|
|
349
515
|
};
|
|
350
516
|
const onInputKeyDown = (event) => {
|
|
351
|
-
if (!
|
|
517
|
+
if (!isListView) {
|
|
352
518
|
if (event.key === "ArrowDown") {
|
|
353
519
|
event.preventDefault();
|
|
354
520
|
moveFocus("first");
|
|
355
521
|
}
|
|
356
522
|
return;
|
|
357
523
|
}
|
|
358
|
-
if (
|
|
524
|
+
if (entries.length === 0 || event.nativeEvent.isComposing)
|
|
359
525
|
return;
|
|
360
526
|
if (event.key === "Enter") {
|
|
361
527
|
event.preventDefault();
|
|
362
|
-
|
|
528
|
+
activate(active, event.metaKey || event.ctrlKey);
|
|
363
529
|
return;
|
|
364
530
|
}
|
|
365
531
|
const hasModifier = event.altKey || event.metaKey || event.ctrlKey || event.shiftKey;
|
|
@@ -380,7 +546,7 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
380
546
|
event.preventDefault();
|
|
381
547
|
navigating.current = true;
|
|
382
548
|
const pageRows = Math.max(3, Math.floor(scrollHeight(input) / ROW_HEIGHT) - 1);
|
|
383
|
-
setActiveIndex((0, resultNavigation_1.moveResult)(
|
|
549
|
+
setActiveIndex((0, resultNavigation_1.moveResult)(layout.sizes, columns, active, event.key, pageRows));
|
|
384
550
|
};
|
|
385
551
|
const moveInGrid = (event, cell) => {
|
|
386
552
|
var _a, _b, _c, _d;
|
|
@@ -518,7 +684,7 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
518
684
|
(0, react_2.useEffect)(() => {
|
|
519
685
|
var _a, _b, _c;
|
|
520
686
|
(_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" });
|
|
521
|
-
}, [active,
|
|
687
|
+
}, [active, entries]);
|
|
522
688
|
const lastItemIndex = (0, react_2.useRef)(-1);
|
|
523
689
|
(0, react_2.useEffect)(() => {
|
|
524
690
|
if (!isOpen)
|
|
@@ -557,38 +723,82 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
557
723
|
const listboxId = `${baseId}-results`;
|
|
558
724
|
const optionId = (index) => `${baseId}-opt-${index}`;
|
|
559
725
|
const togglePinFor = (id) => onTogglePin ? () => onTogglePin(id) : undefined;
|
|
560
|
-
const hasResults =
|
|
726
|
+
const hasResults = entries.length > 0;
|
|
561
727
|
const trimmed = query.trim();
|
|
562
728
|
const pinnedColumns = !isLg && isDesktop ? 3 : PINNED_COLUMNS;
|
|
563
729
|
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
730
|
const rail = ((0, jsx_runtime_1.jsxs)(Rail, { label: labels.quickAccess, scrolls: isLg, children: [quickSections, showApps ? renderApps(false) : null] }));
|
|
565
|
-
const
|
|
731
|
+
const quickBlock = scope === spotlight_1.SCOPE_ALL && (quickActions === null || quickActions === void 0 ? void 0 : quickActions.length) ? ((0, jsx_runtime_1.jsxs)(react_1.Flex, { as: "section", direction: "column", gap: "8px", children: [(0, jsx_runtime_1.jsx)(launcherParts_1.SectionHeader, { label: labels.quickActions, isDecorative: true, hasCount: false }), (0, jsx_runtime_1.jsx)(spotlightParts_1.QuickActionsRow, { items: quickActions, label: labels.quickActions, link: link, onRun: (item) => open(item, false) })] })) : null;
|
|
732
|
+
const sectionsPane = 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) => {
|
|
566
733
|
const pinId = module.screens[0].id;
|
|
567
734
|
return ((0, jsx_runtime_1.jsx)(launcherParts_1.ModuleRow, { module: module, keyScreens: module.screens
|
|
568
735
|
.filter((s) => s.isKey && s.href !== module.href)
|
|
569
736
|
.slice(0, keyScreenLimit), isPinned: pinned.has(pinId), onTogglePin: togglePinFor(pinId), pinId: pinId, labels: labels, link: link }, module.id));
|
|
570
737
|
}) })] }, section.id))));
|
|
738
|
+
const browsePane = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [quickBlock, sectionsPane] }));
|
|
571
739
|
const pickSuggestion = (value) => {
|
|
572
740
|
var _a;
|
|
573
741
|
setQuery(value);
|
|
574
742
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
575
743
|
};
|
|
576
|
-
const
|
|
744
|
+
const hasHint = !isSearching && !isScopeBrowse;
|
|
745
|
+
const emptyTitle = isSearching
|
|
746
|
+
? labels.searching
|
|
747
|
+
: isScopeBrowse
|
|
748
|
+
? labels.scopeEmpty((_a = currentScope === null || currentScope === void 0 ? void 0 : currentScope.label) !== null && _a !== void 0 ? _a : "")
|
|
749
|
+
: labels.noResults(trimmed);
|
|
750
|
+
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: emptyTitle }), hasHint ? ((0, jsx_runtime_1.jsx)(react_1.Text, { fontSize: "12.5px", color: colors.textMuted, children: (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length)
|
|
577
751
|
? labels.suggestionsHint
|
|
578
|
-
: labels.noResultsHint }))] }),
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
752
|
+
: labels.noResultsHint })) : null] }), hasHint && (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] }));
|
|
753
|
+
const factsId = (index) => `${optionId(index)}-facts`;
|
|
754
|
+
const describedBy = (item, index) => { var _a; return ((_a = item.facts) === null || _a === void 0 ? void 0 : _a.length) ? factsId(index) : undefined; };
|
|
755
|
+
const cardProps = (item, index) => ({
|
|
756
|
+
item,
|
|
757
|
+
isActive: index === active,
|
|
758
|
+
optionId: optionId(index),
|
|
759
|
+
link,
|
|
760
|
+
labels,
|
|
761
|
+
onOpen: () => activate(index, false),
|
|
762
|
+
onHover: () => setActiveIndex(index),
|
|
763
|
+
describedBy: describedBy(item, index),
|
|
764
|
+
});
|
|
765
|
+
const renderBlock = (block) => {
|
|
766
|
+
if (block.type === "answers") {
|
|
767
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Flex, { role: "group", "aria-label": labels.answers, direction: "column", gap: "6px", children: block.items.map((item, i) => ((0, jsx_runtime_1.jsx)(spotlightParts_1.AnswerCard, { ...cardProps(item, block.start + i) }, item.id))) }, "answers"));
|
|
768
|
+
}
|
|
769
|
+
if (block.type === "top") {
|
|
770
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { role: "group", "aria-label": labels.topHit, direction: "column", gap: "6px", children: [(0, jsx_runtime_1.jsx)(launcherParts_1.SectionHeader, { label: labels.topHit, isDecorative: true }), (0, jsx_runtime_1.jsx)(spotlightParts_1.TopHitCard, { ...cardProps(block.item, block.start), query: query })] }, "top"));
|
|
771
|
+
}
|
|
772
|
+
const { group, more } = block;
|
|
773
|
+
const meta = group.isSection ? labels.found(group.items.length) : undefined;
|
|
774
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Flex, { role: "group", "aria-label": meta ? `${group.label}, ${meta}` : group.label, direction: "column", gap: "3px", children: [(0, jsx_runtime_1.jsx)(launcherParts_1.SectionHeader, { label: group.label, meta: meta ? `(${meta})` : undefined, isDecorative: true }), (0, jsx_runtime_1.jsx)(ItemGrid, { columns: columns, children: block.visible.map((item, i) => {
|
|
775
|
+
const index = block.start + i;
|
|
776
|
+
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), describedBy: describedBy(item, index) }, item.id));
|
|
777
|
+
}) }), more ? ((0, jsx_runtime_1.jsx)(spotlightParts_1.ShowMoreOption, { count: more.count, isActive: more.index === active, optionId: optionId(more.index), label: labels.showMore, onExpand: () => activate(more.index, false), onHover: () => setActiveIndex(more.index) })) : null] }, group.id));
|
|
778
|
+
};
|
|
779
|
+
const searchPane = hasResults ? ((0, jsx_runtime_1.jsxs)(launcherParts_1.HighlightOptionsProvider, { value: highlightOptions, children: [(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: layout.blocks.map(renderBlock) }), entries.map((entry, index) => {
|
|
780
|
+
var _a;
|
|
781
|
+
return entry.type !== "more" && ((_a = entry.item.facts) === null || _a === void 0 ? void 0 : _a.length) ? ((0, jsx_runtime_1.jsx)("span", { id: factsId(index), hidden: true, children: (0, spotlightParts_1.describeFacts)(entry.item.facts) }, entry.item.id)) : null;
|
|
782
|
+
})] })) : (noResults);
|
|
783
|
+
const showPreview = isLg &&
|
|
784
|
+
isListView &&
|
|
785
|
+
entries.some((entry) => { var _a; return entry.type !== "more" && ((_a = entry.item.facts) === null || _a === void 0 ? void 0 : _a.length); });
|
|
786
|
+
const activeEntry = entries[active];
|
|
787
|
+
const activeItem = activeEntry && activeEntry.type !== "more" ? activeEntry.item : undefined;
|
|
788
|
+
const dock = !isLg && isListView && !isLoading && ((_b = activeItem === null || activeItem === void 0 ? void 0 : activeItem.facts) === null || _b === void 0 ? void 0 : _b.length) ? ((0, jsx_runtime_1.jsx)(spotlightParts_1.PreviewPane, { item: activeItem, placement: "dock", labels: labels, onCopied: onCopied, onCopyBlocked: onCopyBlocked })) : null;
|
|
789
|
+
const stacked = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Pane, { scrolls: isLg, children: isListView ? searchPane : browsePane }), showPreview ? ((0, jsx_runtime_1.jsx)(spotlightParts_1.PreviewPane, { item: activeItem, placement: "side", width: RAIL_WIDTH, labels: labels, onCopied: onCopied, onCopyBlocked: onCopyBlocked })) : (rail)] }));
|
|
584
790
|
const body = isLoading ? (0, jsx_runtime_1.jsx)(SkeletonLayout, { label: labels.loading }) : stacked;
|
|
791
|
+
const titleId = `${baseId}-title`;
|
|
792
|
+
const scopeBar = hasScopes ? ((0, jsx_runtime_1.jsx)(ScopeBar_1.ScopeBar, { scopes: scopeChips, value: scope, onChange: (next) => setScope(next), label: labels.scopes, countLabel: labels.scopeCount })) : null;
|
|
793
|
+
const inlineScopes = isDesktop ? scopeBar : null;
|
|
794
|
+
const scopeRow = isDesktop ? null : scopeBar;
|
|
585
795
|
const tabPanels = {
|
|
586
796
|
menu: (0, jsx_runtime_1.jsx)(Pane, { children: browsePane }),
|
|
587
797
|
quick: ((0, jsx_runtime_1.jsx)(react_1.Flex, { direction: "column", gap: "16px", px: "18px", pt: "14px", pb: "16px", children: quickSections })),
|
|
588
798
|
apps: ((0, jsx_runtime_1.jsx)(react_1.Box, { px: "14px", pt: "10px", pb: "16px", children: renderApps(true) })),
|
|
589
799
|
};
|
|
590
800
|
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: {
|
|
801
|
+
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, "aria-labelledby": titleId, contentProps: {
|
|
592
802
|
maxW: { base: "100vw", lg: `min(${maxWidth}, calc(100vw - 56px))` },
|
|
593
803
|
h: { base: "100%", lg: "auto" },
|
|
594
804
|
maxH: "100%",
|
|
@@ -598,5 +808,5 @@ function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, freque
|
|
|
598
808
|
overflow: "hidden",
|
|
599
809
|
onKeyDown: onContentKeyDown,
|
|
600
810
|
...{ "data-testid": testId },
|
|
601
|
-
}, children: [(0, jsx_runtime_1.
|
|
811
|
+
}, children: [(0, jsx_runtime_1.jsxs)(Drawer_1.DrawerHeader, { p: 0, flexShrink: 0, children: [(0, jsx_runtime_1.jsxs)(react_1.Flex, { "data-testid": "launcher-header-row", 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", id: titleId, children: labels.title }), (0, jsx_runtime_1.jsx)(SearchField, { inputRef: inputRef, value: query, onChange: setQuery, onKeyDown: onInputKeyDown, labels: labels, placeholder: (_c = currentScope === null || currentScope === void 0 ? void 0 : currentScope.placeholder) !== null && _c !== void 0 ? _c : labels.searchPlaceholder, hint: searchHint, listboxId: listboxId, activeId: isListView && hasResults ? optionId(active) : undefined, isExpanded: isListView, hasResults: hasResults, minW: inlineScopes ? FIELD_MIN_WIDTH : 0 }), inlineScopes, (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 })] }), scopeRow ? ((0, jsx_runtime_1.jsx)(react_1.Box, { "data-testid": "launcher-scope-row", pl: "7px", pr: "3px", mt: "-6px", pb: "4px", children: scopeRow })) : null] }), (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 }), (0, jsx_runtime_1.jsx)(react_1.VisuallyHidden, { "data-testid": "launcher-announce", "aria-live": "polite", "aria-atomic": "true", children: (0, jsx_runtime_1.jsx)("span", { children: announcement.text }, announcement.n) }), 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), dock] }) }), (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 })] })] }) }));
|
|
602
812
|
}
|