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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/COMPONENT-GOTCHAS.md +88 -2
  3. package/DESIGN-GUIDE.md +27 -4
  4. package/dist/Components/AppSwitcher/AppSwitcher.js +5 -1
  5. package/dist/Components/AppSwitcher/AppSwitcherProps.d.ts +2 -0
  6. package/dist/Components/AppSwitcher/AppSwitcherProps.js +7 -4
  7. package/dist/Components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  8. package/dist/Components/Breadcrumbs/Breadcrumbs.js +33 -10
  9. package/dist/Components/Breadcrumbs/BreadcrumbsProps.d.ts +16 -2
  10. package/dist/Components/Card/Card.d.ts +3 -1
  11. package/dist/Components/Card/Card.js +12 -2
  12. package/dist/Components/Card/CardProps.d.ts +5 -1
  13. package/dist/Components/Commerce/commerceTypes.d.ts +5 -0
  14. package/dist/Components/Editor/Editor.js +50 -2
  15. package/dist/Components/Editor/EditorFieldBar.d.ts +15 -0
  16. package/dist/Components/Editor/EditorFieldBar.js +19 -0
  17. package/dist/Components/Editor/EditorProps.d.ts +74 -1
  18. package/dist/Components/Editor/MakeDynamicDialog.d.ts +12 -0
  19. package/dist/Components/Editor/MakeDynamicDialog.js +59 -0
  20. package/dist/Components/Editor/editorLabels.d.ts +4 -0
  21. package/dist/Components/Editor/editorLabels.js +24 -0
  22. package/dist/Components/Editor/editorTokenStyles.d.ts +28 -0
  23. package/dist/Components/Editor/editorTokenStyles.js +30 -0
  24. package/dist/Components/Editor/editorTokens.d.ts +26 -0
  25. package/dist/Components/Editor/editorTokens.js +134 -0
  26. package/dist/Components/Editor/useEditorBridge.d.ts +40 -0
  27. package/dist/Components/Editor/useEditorBridge.js +141 -0
  28. package/dist/Components/Kbd/Kbd.d.ts +6 -0
  29. package/dist/Components/Kbd/Kbd.js +33 -0
  30. package/dist/Components/Kbd/KbdProps.d.ts +17 -0
  31. package/dist/Components/Kbd/KbdProps.js +2 -0
  32. package/dist/Components/LauncherTrigger/LauncherTrigger.d.ts +4 -0
  33. package/dist/Components/LauncherTrigger/LauncherTrigger.js +41 -0
  34. package/dist/Components/LauncherTrigger/LauncherTriggerProps.d.ts +16 -0
  35. package/dist/Components/LauncherTrigger/LauncherTriggerProps.js +2 -0
  36. package/dist/Components/MediaGallery/MediaGallery.js +1 -1
  37. package/dist/Components/NavLauncher/NavLauncher.d.ts +3 -0
  38. package/dist/Components/NavLauncher/NavLauncher.js +395 -0
  39. package/dist/Components/NavLauncher/NavLauncherProps.d.ts +187 -0
  40. package/dist/Components/NavLauncher/NavLauncherProps.js +2 -0
  41. package/dist/Components/NavLauncher/NewTabLink.d.ts +3 -0
  42. package/dist/Components/NavLauncher/NewTabLink.js +14 -0
  43. package/dist/Components/NavLauncher/PinToggle.d.ts +3 -0
  44. package/dist/Components/NavLauncher/PinToggle.js +21 -0
  45. package/dist/Components/NavLauncher/launcherParts.d.ts +93 -0
  46. package/dist/Components/NavLauncher/launcherParts.js +130 -0
  47. package/dist/Components/NavLauncher/match.d.ts +53 -0
  48. package/dist/Components/NavLauncher/match.js +178 -0
  49. package/dist/Components/NavLauncher/revealStyles.d.ts +4 -0
  50. package/dist/Components/NavLauncher/revealStyles.js +19 -0
  51. package/dist/Components/NavigationBar/NavigationBar.d.ts +1 -1
  52. package/dist/Components/NavigationBar/NavigationBar.js +2 -2
  53. package/dist/Components/NavigationBar/NavigationBarProps.d.ts +2 -0
  54. package/dist/Components/PageHeader/PageHeader.d.ts +1 -1
  55. package/dist/Components/PageHeader/PageHeader.js +9 -2
  56. package/dist/Components/PageHeader/PageHeaderProps.d.ts +8 -0
  57. package/dist/Components/PdfViewer/PdfViewer.d.ts +21 -4
  58. package/dist/Components/PdfViewer/PdfViewer.js +124 -3
  59. package/dist/Components/ProductCard/ProductCard.js +8 -3
  60. package/dist/Components/ProductCard/ProductCardMedia.js +3 -3
  61. package/dist/Components/ProductCard/QuickAddSheet.js +2 -2
  62. package/dist/Components/ProductCard/cardMetrics.d.ts +1 -0
  63. package/dist/Components/ProductCard/cardMetrics.js +3 -2
  64. package/dist/Components/ProductDetails/ProductDetails.d.ts +1 -1
  65. package/dist/Components/ProductDetails/ProductDetails.js +6 -5
  66. package/dist/Components/ProductDetails/ProductDetailsProps.d.ts +2 -0
  67. package/dist/Components/Search/Search.js +2 -1
  68. package/dist/Components/SideBar/SecondaryBar.js +4 -3
  69. package/dist/Components/SideBar/SideBar.d.ts +1 -1
  70. package/dist/Components/SideBar/SideBar.js +30 -9
  71. package/dist/Components/SideBar/SideBarProps.d.ts +32 -0
  72. package/dist/Components/SideBar/components/MenuItemBox.d.ts +6 -0
  73. package/dist/Components/SideBar/components/MenuItemBox.js +8 -4
  74. package/dist/Components/SideBar/components/MenuPopoverContent.js +3 -2
  75. package/dist/Components/SideBar/components/OtherApps.js +2 -1
  76. package/dist/Components/SideBar/components/PinnedSection.d.ts +17 -0
  77. package/dist/Components/SideBar/components/PinnedSection.js +98 -0
  78. package/dist/Components/SideBar/sidebarFocus.d.ts +23 -0
  79. package/dist/Components/SideBar/sidebarFocus.js +20 -0
  80. package/dist/Components/StageProgress/StageProgress.js +2 -2
  81. package/dist/Components/StageProgress/StageProgressProps.d.ts +2 -0
  82. package/dist/Components/StageProgress/StepperStage.js +5 -2
  83. package/dist/Components/WizardDialog/WizardDialog.d.ts +9 -0
  84. package/dist/Components/WizardDialog/WizardDialog.js +102 -0
  85. package/dist/Components/WizardDialog/WizardDialogProps.d.ts +48 -0
  86. package/dist/Components/WizardDialog/WizardDialogProps.js +2 -0
  87. package/dist/Components/WizardDialog/useWizardFlow.d.ts +22 -0
  88. package/dist/Components/WizardDialog/useWizardFlow.js +47 -0
  89. package/dist/Components/WizardDialog/wizardSteps.d.ts +31 -0
  90. package/dist/Components/WizardDialog/wizardSteps.js +40 -0
  91. package/dist/Hooks/useMatchMedia.d.ts +2 -0
  92. package/dist/Hooks/useMatchMedia.js +36 -0
  93. package/dist/Theme/chakra/motion.js +2 -16
  94. package/dist/Utils/price.js +11 -6
  95. package/dist/esm/Components/AppSwitcher/AppSwitcher.js +2 -1
  96. package/dist/esm/Components/AppSwitcher/AppSwitcherProps.js +5 -3
  97. package/dist/esm/Components/Breadcrumbs/Breadcrumbs.js +35 -12
  98. package/dist/esm/Components/Card/Card.js +12 -2
  99. package/dist/esm/Components/Editor/Editor.js +48 -3
  100. package/dist/esm/Components/Editor/EditorFieldBar.js +13 -0
  101. package/dist/esm/Components/Editor/MakeDynamicDialog.js +20 -0
  102. package/dist/esm/Components/Editor/editorLabels.js +20 -0
  103. package/dist/esm/Components/Editor/editorTokenStyles.js +25 -0
  104. package/dist/esm/Components/Editor/editorTokens.js +121 -0
  105. package/dist/esm/Components/Editor/useEditorBridge.js +138 -0
  106. package/dist/esm/Components/Kbd/Kbd.js +28 -0
  107. package/dist/esm/Components/Kbd/KbdProps.js +1 -0
  108. package/dist/esm/Components/LauncherTrigger/LauncherTrigger.js +37 -0
  109. package/dist/esm/Components/LauncherTrigger/LauncherTriggerProps.js +1 -0
  110. package/dist/esm/Components/MediaGallery/MediaGallery.js +1 -1
  111. package/dist/esm/Components/NavLauncher/NavLauncher.js +356 -0
  112. package/dist/esm/Components/NavLauncher/NavLauncherProps.js +1 -0
  113. package/dist/esm/Components/NavLauncher/NewTabLink.js +11 -0
  114. package/dist/esm/Components/NavLauncher/PinToggle.js +18 -0
  115. package/dist/esm/Components/NavLauncher/launcherParts.js +110 -0
  116. package/dist/esm/Components/NavLauncher/match.js +172 -0
  117. package/dist/esm/Components/NavLauncher/revealStyles.js +15 -0
  118. package/dist/esm/Components/NavigationBar/NavigationBar.js +3 -3
  119. package/dist/esm/Components/PageHeader/PageHeader.js +9 -2
  120. package/dist/esm/Components/PdfViewer/PdfViewer.js +123 -2
  121. package/dist/esm/Components/ProductCard/ProductCard.js +9 -4
  122. package/dist/esm/Components/ProductCard/ProductCardMedia.js +3 -3
  123. package/dist/esm/Components/ProductCard/QuickAddSheet.js +2 -2
  124. package/dist/esm/Components/ProductCard/cardMetrics.js +2 -1
  125. package/dist/esm/Components/ProductDetails/ProductDetails.js +6 -5
  126. package/dist/esm/Components/Search/Search.js +3 -2
  127. package/dist/esm/Components/SideBar/SecondaryBar.js +4 -3
  128. package/dist/esm/Components/SideBar/SideBar.js +31 -10
  129. package/dist/esm/Components/SideBar/components/MenuItemBox.js +4 -2
  130. package/dist/esm/Components/SideBar/components/MenuPopoverContent.js +3 -2
  131. package/dist/esm/Components/SideBar/components/OtherApps.js +2 -1
  132. package/dist/esm/Components/SideBar/components/PinnedSection.js +92 -0
  133. package/dist/esm/Components/SideBar/sidebarFocus.js +15 -0
  134. package/dist/esm/Components/StageProgress/StageProgress.js +2 -2
  135. package/dist/esm/Components/StageProgress/StepperStage.js +5 -2
  136. package/dist/esm/Components/WizardDialog/WizardDialog.js +58 -0
  137. package/dist/esm/Components/WizardDialog/WizardDialogProps.js +1 -0
  138. package/dist/esm/Components/WizardDialog/useWizardFlow.js +44 -0
  139. package/dist/esm/Components/WizardDialog/wizardSteps.js +35 -0
  140. package/dist/esm/Hooks/useMatchMedia.js +32 -0
  141. package/dist/esm/Theme/chakra/motion.js +2 -16
  142. package/dist/esm/Utils/price.js +11 -6
  143. package/dist/esm/index.js +7 -0
  144. package/dist/index.d.ts +19 -4
  145. package/dist/index.js +21 -1
  146. package/package.json +1 -1
  147. package/dist/Components/MediaGallery/useMatchMedia.d.ts +0 -2
  148. package/dist/Components/MediaGallery/useMatchMedia.js +0 -20
  149. package/dist/Components/ProductCard/useMinWidth.d.ts +0 -2
  150. package/dist/Components/ProductCard/useMinWidth.js +0 -20
  151. package/dist/esm/Components/MediaGallery/useMatchMedia.js +0 -16
  152. package/dist/esm/Components/ProductCard/useMinWidth.js +0 -16
@@ -0,0 +1,356 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, Flex, Heading, IconButton, Text } from "@chakra-ui/react";
3
+ import { Compass, Search as SearchIcon, X } from "lucide-react";
4
+ import { useCallback, useEffect, useId, useMemo, useRef, useState, } from "react";
5
+ import { useMatchMedia } from "../../Hooks/useMatchMedia.js";
6
+ import { focusRingShadow, focusVisibleStyles, } from "../../Theme/chakra/focusRing.styles.js";
7
+ import { chartMode } from "../../Theme/tokens/builders/chartColorsFromTheme.js";
8
+ import { placeholderInk } from "../../Theme/tokens/builders/placeholderInk.js";
9
+ import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
10
+ import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
11
+ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
12
+ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
13
+ import { assignAppHues } from "../AppSwitcher/AppMark.js";
14
+ import Drawer, { DrawerBody, DrawerFooter, DrawerHeader, } from "../Drawer/Drawer.js";
15
+ import EmptyState from "../EmptyState/EmptyState.js";
16
+ import Kbd from "../Kbd/Kbd.js";
17
+ import Skeletons from "../Skeletons/Skeletons.js";
18
+ import { AppsSection, CountBadge, Highlight, isPlainClick, ITEM_SELECTOR, ModuleRow, NewTag, PinnedTile, PinTextButton, RailRow, RowActions, RowIcon, RowTip, SectionHeader, } from "./launcherParts.js";
19
+ import { searchLauncherSections } from "./match.js";
20
+ import NewTabLink from "./NewTabLink.js";
21
+ import PinToggle from "./PinToggle.js";
22
+ const NO_APPS = [];
23
+ const MD_QUERY = "(min-width: 48em)";
24
+ const XL_QUERY = "(min-width: 80em)";
25
+ const CELL_SELECTOR = "[data-nav-cell]";
26
+ const DEFAULT_LABELS = {
27
+ title: "Menu",
28
+ searchPlaceholder: "Search menus and screens",
29
+ clearSearch: "Clear search",
30
+ close: "Close menu",
31
+ pinned: "Pinned",
32
+ pinnedEmpty: "Pin the screens you use most. Pins follow your account.",
33
+ frequent: "Frequently visited",
34
+ recent: "Recent",
35
+ screensGroup: "Screens",
36
+ actionsGroup: "Actions",
37
+ pin: (label) => `Pin ${label}`,
38
+ unpin: (label) => `Unpin ${label}`,
39
+ openInNewTab: (label) => `Open ${label} in a new tab`,
40
+ noResults: (query) => `Nothing called “${query}”`,
41
+ noResultsHint: "Try a module name, or another word for it.",
42
+ searching: "Searching…",
43
+ loading: "Loading menu",
44
+ empty: "Nothing to show yet",
45
+ hintMove: "move",
46
+ hintOpen: "open here",
47
+ hintNewTab: "new tab",
48
+ hintPin: "pin",
49
+ hintClose: "close",
50
+ hintOpenMenu: "open",
51
+ apps: "Your apps",
52
+ found: (count) => `${count} found`,
53
+ pinTip: "Pin to quick access",
54
+ unpinTip: "Pinned — click to unpin",
55
+ quickAccess: "Quick access",
56
+ newBadge: "New",
57
+ screens: "screens",
58
+ pinShort: "Pin",
59
+ footerNote: "Pins follow your account",
60
+ suggestionsHint: "Try one of these",
61
+ };
62
+ const isApplePlatform = () => typeof navigator !== "undefined" &&
63
+ /Mac|iPhone|iPad/.test(navigator.platform);
64
+ const visibleSections = (sections) => sections
65
+ .map((section) => ({
66
+ ...section,
67
+ modules: section.modules.filter((m) => m.screens.length > 0),
68
+ }))
69
+ .filter((section) => section.modules.length > 0);
70
+ const indexScreens = (sections) => {
71
+ const map = new Map();
72
+ for (const section of sections) {
73
+ for (const module of section.modules) {
74
+ for (const screen of module.screens)
75
+ if (!map.has(screen.id))
76
+ map.set(screen.id, { screen, module });
77
+ }
78
+ }
79
+ return map;
80
+ };
81
+ const GRID_COLUMNS = {
82
+ base: "minmax(0, 1fr)",
83
+ md: "repeat(2, minmax(0, 1fr))",
84
+ xl: "repeat(3, minmax(0, 1fr))",
85
+ };
86
+ function ItemGrid({ children }) {
87
+ return (_jsx(Box, { "data-nav-grid": true, display: "grid", gridTemplateColumns: GRID_COLUMNS, gap: "1px 8px", alignItems: "start", children: children }));
88
+ }
89
+ function Pane({ children }) {
90
+ return (_jsx(Flex, { direction: "column", gap: "14px", flex: 1, minW: 0, px: "18px", pt: "12px", pb: "16px", overflowY: { base: "visible", lg: "auto" }, children: children }));
91
+ }
92
+ function Rail({ label, children }) {
93
+ const { colors } = useCustomTheme();
94
+ return (_jsx(Flex, { as: "aside", "aria-label": label, direction: "column", gap: "16px", w: { base: "100%", lg: "300px" }, flexShrink: 0, px: "14px", pt: "12px", pb: "16px", bg: colors.backgroundColor.subtle, borderTopWidth: { base: "1px", lg: 0 }, borderLeftWidth: { base: 0, lg: "1px" }, borderColor: colors.boxborder[200], overflowY: { base: "visible", lg: "auto" }, children: children }));
95
+ }
96
+ function SkeletonLayout({ label }) {
97
+ return (_jsxs(Flex, { role: "status", "aria-busy": "true", "aria-label": label, direction: { base: "column", lg: "row" }, flex: 1, minH: 0, children: [_jsx(Pane, { children: [0, 1, 2].map((section) => (_jsxs(Box, { children: [_jsx(Skeletons, { type: "skeleton", height: "0.75rem", width: "6rem" }), _jsx(ItemGrid, { children: [0, 1, 2, 3].map((row) => (_jsxs(Flex, { align: "center", gap: "10px", h: "34px", mt: 2, children: [_jsx(Skeletons, { type: "skeleton", height: "1rem", width: "1rem" }), _jsx(Skeletons, { type: "skeleton", height: "0.875rem", width: "8rem" })] }, row))) })] }, section))) }), _jsx(Rail, { label: label, children: [0, 1].map((group) => (_jsxs(Box, { children: [_jsx(Skeletons, { type: "skeleton", height: "0.75rem", width: "5rem" }), [0, 1, 2].map((row) => (_jsx(Skeletons, { type: "skeleton", height: "1.5rem", width: "100%", mt: 2 }, row)))] }, group))) })] }));
98
+ }
99
+ function SearchField({ inputRef, value, onChange, onKeyDown, labels, hint, listboxId, activeId, isExpanded, hasResults, }) {
100
+ const { colors } = useCustomTheme();
101
+ return (_jsxs(Flex, { flex: 1, maxW: "520px", h: "38px", align: "center", gap: "10px", pl: "12px", pr: "8px", borderRadius: "10px", borderWidth: "1px", borderColor: colors.primary[500], bg: colors.surfaceRaised, boxShadow: `0 0 0 3px ${colors.primary.opacity[16]}`, children: [_jsx(Box, { as: "span", color: colors.accentText, display: "inline-flex", flexShrink: 0, children: _jsx(SearchIcon, { size: 16, strokeWidth: 2.2, "aria-hidden": true }) }), _jsx(Box, { as: "input", ref: inputRef, value: value, onChange: (event) => onChange(event.target.value), onKeyDown: onKeyDown, placeholder: labels.searchPlaceholder, "aria-label": labels.searchPlaceholder, role: "combobox", "aria-expanded": isExpanded, "aria-controls": isExpanded && hasResults ? listboxId : undefined, "aria-autocomplete": "list", "aria-activedescendant": activeId, autoComplete: "off", flex: 1, minW: 0, h: "34px", border: 0, outline: "none", bg: "transparent", fontSize: "14.5px", color: colors.text[900], _placeholder: { color: placeholderInk(colors), opacity: 1 } }), value ? (_jsx(Box, { as: "button", type: "button", "aria-label": labels.clearSearch, onClick: () => {
102
+ var _a;
103
+ onChange("");
104
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
105
+ }, boxSize: "24px", borderRadius: "6px", bg: colors.backgroundColor.subtle, color: colors.textMuted, display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, sx: focusVisibleStyles(colors), children: _jsx(X, { size: 12, strokeWidth: 2.4, "aria-hidden": true }) })) : null, hint ? (_jsx(Box, { "aria-hidden": true, display: { base: "none", md: "block" }, children: _jsx(Kbd, { size: "xs", children: hint }) })) : null] }));
106
+ }
107
+ function SearchRow({ item, query, isActive, link, labels, optionId, isPinned, canPin, onPin, onOpen, onHover, }) {
108
+ const { colors } = useCustomTheme();
109
+ const isScreen = item.kind === "screen";
110
+ const hasStar = Boolean(item.screenId) && canPin;
111
+ const base = item.badge ? 24 : 0;
112
+ const open = base + (hasStar ? 46 : item.href ? 24 : 0);
113
+ return (_jsxs(Flex, { role: "presentation", "data-group": true, "data-reveal": isActive, position: "relative", align: "flex-start", gap: "10px", minH: "34px", pl: "8px", pr: "4px", pt: "7px", pb: "5px", borderRadius: "8px", bg: isActive ? colors.primary[50] : "transparent", boxShadow: isActive ? focusRingShadow(colors) : "none", transition: transitionFor(["background-color"]), onMouseMove: onHover, children: [_jsxs(Flex, { id: optionId, role: "option", "aria-selected": isActive, "data-active": isActive, title: isScreen ? `${item.label} — ${item.context}` : item.label, flex: 1, minW: 0, align: "flex-start", gap: "10px", cursor: "pointer", onClick: () => {
114
+ if (!item.href)
115
+ onOpen();
116
+ }, children: [_jsx(RowIcon, { icon: item.icon, size: 16, mt: "2px" }), _jsxs(Flex, { direction: "column", flex: 1, minW: 0, children: [_jsxs(Flex, { align: "center", gap: "6px", minW: 0, h: "19px", pr: `${isActive ? open + 26 : base}px`, _groupHover: { pr: `${isActive ? open + 26 : open}px` }, children: [_jsxs(Text, { fontSize: "13.5px", fontWeight: 500, color: colors.text[900], noOfLines: 1, minW: 0, children: [_jsx(Highlight, { text: item.label, query: query }), isScreen ? (_jsx(Text, { as: "span", fontWeight: 400, color: colors.textMuted, children: ` — ${item.context}` })) : null] }), item.isNew ? _jsx(NewTag, { label: labels.newBadge }) : null, item.keywordHint ? (_jsx(Text, { as: "span", fontSize: "11.5px", color: colors.textMuted, whiteSpace: "nowrap", children: ` · ${item.keywordHint}` })) : null, item.hint ? (_jsx(Text, { as: "span", fontSize: "11.5px", color: colors.textMuted, whiteSpace: "nowrap", children: item.hint })) : null] }), item.context && !isScreen ? (_jsx(Text, { fontSize: "11.5px", lineHeight: "15px", color: colors.textMuted, noOfLines: 1, children: item.context })) : null] })] }), item.href ? (_jsx(Box, { as: link.linkAs, href: item.href, tabIndex: -1, "aria-hidden": true, onClick: link.onPlainClick, position: "absolute", inset: 0, borderRadius: "8px" })) : null, _jsx(RowActions, { children: _jsxs(Box, { "aria-hidden": true, display: "contents", children: [_jsx(CountBadge, { value: item.badge }), isActive ? _jsx(Kbd, { size: "xs", children: "\u21B5" }) : null, hasStar ? (_jsx(PinToggle, { isPinned: isPinned, label: isPinned ? labels.unpin(item.label) : labels.pin(item.label), title: "", onToggle: onPin, tabIndex: -1 })) : null, item.href ? (_jsx(NewTabLink, { href: item.href, label: labels.openInNewTab(isScreen ? `${item.label} — ${item.context}` : item.label), linkAs: link.linkAs, tabIndex: -1 })) : null] }) }), hasStar ? (_jsx(RowTip, { text: isPinned ? labels.unpinTip : labels.pinTip })) : null] }));
117
+ }
118
+ /** Left-drawer navigation launcher: browse every module, pins, Frequent, Recent, search and (compact) the suite's apps. */
119
+ export default function NavLauncher({ isOpen, onClose, sections: rawSections, pinnedIds, frequentIds, recentIds, onTogglePin, onNavigate, linkAs = "a", actions, extraResults, query: controlledQuery, onQueryChange, isSearching = false, isLoading = false, keyScreenLimit = 3, frequentLimit = 4, suggestions, searchHint, openShortcutHint, modKeyLabel, maxWidth = "1180px", labels: labelOverrides, apps, currentAppId, onAppSelect, appsVisibility = "apps-on-compact", "data-testid": testId, }) {
120
+ const theme = useCustomTheme();
121
+ const { colors } = theme;
122
+ const inputRef = useRef(null);
123
+ const bodyRef = useRef(null);
124
+ const baseId = useId();
125
+ const isDesktop = useMatchMedia(MD_QUERY, true);
126
+ const isWide = useMatchMedia(XL_QUERY, false);
127
+ const columns = isWide ? 3 : isDesktop ? 2 : 1;
128
+ const [innerQuery, setInnerQuery] = useState("");
129
+ const [activeIndex, setActiveIndex] = useState(0);
130
+ const labels = useMemo(() => ({ ...DEFAULT_LABELS, ...labelOverrides }), [labelOverrides]);
131
+ const isControlled = controlledQuery !== undefined;
132
+ const query = isControlled ? controlledQuery : innerQuery;
133
+ const setQuery = useCallback((next) => {
134
+ if (!isControlled)
135
+ setInnerQuery(next);
136
+ onQueryChange === null || onQueryChange === void 0 ? void 0 : onQueryChange(next);
137
+ }, [isControlled, onQueryChange]);
138
+ const latest = useRef({ query, setQuery });
139
+ latest.current = { query, setQuery };
140
+ useEffect(() => {
141
+ if (!isOpen && latest.current.query !== "")
142
+ latest.current.setQuery("");
143
+ }, [isOpen]);
144
+ useEffect(() => setActiveIndex(0), [query]);
145
+ const sections = useMemo(() => visibleSections(rawSections), [rawSections]);
146
+ const byId = useMemo(() => indexScreens(sections), [sections]);
147
+ const pinned = useMemo(() => new Set(pinnedIds), [pinnedIds]);
148
+ const pinnedItems = useMemo(() => pinnedIds.flatMap((id) => { var _a; return (_a = byId.get(id)) !== null && _a !== void 0 ? _a : []; }), [pinnedIds, byId]);
149
+ const frequentItems = useMemo(() => frequentIds.flatMap((id) => { var _a; return (_a = byId.get(id)) !== null && _a !== void 0 ? _a : []; }), [frequentIds, byId]);
150
+ const recentItems = useMemo(() => recentIds.flatMap((id) => { var _a; return (_a = byId.get(id)) !== null && _a !== void 0 ? _a : []; }), [recentIds, byId]);
151
+ const found = useMemo(() => searchLauncherSections({
152
+ query,
153
+ sections,
154
+ actions,
155
+ extraResults,
156
+ actionsLabel: labels.actionsGroup,
157
+ }), [query, sections, actions, extraResults, labels.actionsGroup]);
158
+ const groups = useMemo(() => [
159
+ ...found.sections.map((s) => ({
160
+ id: `section:${s.id}`,
161
+ label: s.label,
162
+ meta: labels.found(s.items.length),
163
+ items: s.items,
164
+ })),
165
+ ...found.groups,
166
+ ], [found, labels]);
167
+ const results = useMemo(() => groups.flatMap((g) => g.items), [groups]);
168
+ const groupStarts = useMemo(() => groups.map((_, i) => groups.slice(0, i).reduce((n, g) => n + g.items.length, 0)), [groups]);
169
+ const isSearchView = query.trim().length > 0;
170
+ const link = useMemo(() => ({
171
+ linkAs,
172
+ onPlainClick: (event) => {
173
+ if (isPlainClick(event))
174
+ onClose();
175
+ },
176
+ }), [linkAs, onClose]);
177
+ const open = useCallback((item, newTab) => {
178
+ if (item.run) {
179
+ onClose();
180
+ item.run();
181
+ return;
182
+ }
183
+ if (!item.href)
184
+ return;
185
+ if (!newTab)
186
+ onClose();
187
+ onNavigate(item.href, { newTab });
188
+ }, [onClose, onNavigate]);
189
+ const moveFocus = (delta) => {
190
+ var _a, _b;
191
+ const items = Array.from((_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(ITEM_SELECTOR)) !== null && _b !== void 0 ? _b : []);
192
+ if (items.length === 0)
193
+ return;
194
+ const current = items.indexOf(document.activeElement);
195
+ const next = delta === "first"
196
+ ? 0
197
+ : delta === "last"
198
+ ? items.length - 1
199
+ : Math.min(items.length - 1, Math.max(0, current + delta));
200
+ items[next].focus();
201
+ };
202
+ const onInputKeyDown = (event) => {
203
+ if (!isSearchView) {
204
+ if (event.key === "ArrowDown") {
205
+ event.preventDefault();
206
+ moveFocus("first");
207
+ }
208
+ return;
209
+ }
210
+ if (results.length === 0)
211
+ return;
212
+ if (event.key === "ArrowDown") {
213
+ event.preventDefault();
214
+ setActiveIndex((i) => (i + 1) % results.length);
215
+ }
216
+ else if (event.key === "ArrowUp") {
217
+ event.preventDefault();
218
+ setActiveIndex((i) => (i - 1 + results.length) % results.length);
219
+ }
220
+ else if (event.key === "Enter") {
221
+ event.preventDefault();
222
+ open(results[activeIndex], event.metaKey || event.ctrlKey);
223
+ }
224
+ };
225
+ const moveInGrid = (event, cell) => {
226
+ var _a, _b, _c, _d;
227
+ const grid = cell.closest("[data-nav-grid]");
228
+ const cells = Array.from((_a = grid === null || grid === void 0 ? void 0 : grid.querySelectorAll(CELL_SELECTOR)) !== null && _a !== void 0 ? _a : []);
229
+ const index = cells.indexOf(cell);
230
+ const focusCell = (target) => { var _a; return (_a = target === null || target === void 0 ? void 0 : target.querySelector(ITEM_SELECTOR)) === null || _a === void 0 ? void 0 : _a.focus(); };
231
+ if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
232
+ focusCell(cells[index + (event.key === "ArrowRight" ? 1 : -1)]);
233
+ return;
234
+ }
235
+ const down = event.key === "ArrowDown";
236
+ const within = cells[index + (down ? columns : -columns)];
237
+ if (within)
238
+ return focusCell(within);
239
+ const hasRowAfter = down &&
240
+ Math.floor(index / columns) < Math.floor((cells.length - 1) / columns);
241
+ if (hasRowAfter)
242
+ return focusCell(cells[cells.length - 1]);
243
+ const grids = Array.from((_c = (_b = bodyRef.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll("[data-nav-grid]")) !== null && _c !== void 0 ? _c : []);
244
+ const neighbour = grids[grids.indexOf(grid) + (down ? 1 : -1)];
245
+ const neighbourCells = Array.from((_d = neighbour === null || neighbour === void 0 ? void 0 : neighbour.querySelectorAll(CELL_SELECTOR)) !== null && _d !== void 0 ? _d : []);
246
+ if (neighbourCells.length === 0)
247
+ return moveFocus(down ? 1 : -1);
248
+ const column = index % columns;
249
+ const row = down ? 0 : Math.floor((neighbourCells.length - 1) / columns);
250
+ focusCell(neighbourCells[Math.min(neighbourCells.length - 1, row * columns + column)]);
251
+ };
252
+ const pinFromKeyboard = (event) => {
253
+ var _a, _b;
254
+ const target = event.target;
255
+ const pinId = target.matches(ITEM_SELECTOR)
256
+ ? target.getAttribute("data-pin-id")
257
+ : null;
258
+ if (!pinId || !onTogglePin)
259
+ return false;
260
+ event.preventDefault();
261
+ const before = Array.from((_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(ITEM_SELECTOR)) !== null && _b !== void 0 ? _b : []);
262
+ const position = before.indexOf(target);
263
+ onTogglePin(pinId);
264
+ setTimeout(() => {
265
+ var _a, _b, _c;
266
+ if ((_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement))
267
+ return;
268
+ const after = (_b = bodyRef.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll(ITEM_SELECTOR);
269
+ (_c = after === null || after === void 0 ? void 0 : after[Math.min(position, after.length - 1)]) === null || _c === void 0 ? void 0 : _c.focus();
270
+ }, 0);
271
+ return true;
272
+ };
273
+ const onBodyKeyDown = (event) => {
274
+ var _a;
275
+ if (isSearchView || event.target === inputRef.current)
276
+ return;
277
+ const isArrow = event.key.startsWith("Arrow");
278
+ const cell = event.target.closest(CELL_SELECTOR);
279
+ if (isArrow && cell && !event.altKey && !event.metaKey && !event.ctrlKey) {
280
+ event.preventDefault();
281
+ moveInGrid(event, cell);
282
+ }
283
+ else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
284
+ event.preventDefault();
285
+ moveFocus(event.key === "ArrowDown" ? 1 : -1);
286
+ }
287
+ else if (event.key === "Home" || event.key === "End") {
288
+ event.preventDefault();
289
+ moveFocus(event.key === "Home" ? "first" : "last");
290
+ }
291
+ else if (event.key.length === 1 &&
292
+ !event.metaKey &&
293
+ !event.ctrlKey &&
294
+ !event.altKey &&
295
+ event.key !== " ") {
296
+ if ((event.key === "p" || event.key === "P") && pinFromKeyboard(event))
297
+ return;
298
+ event.preventDefault();
299
+ setQuery(query + event.key);
300
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
301
+ }
302
+ };
303
+ useEffect(() => {
304
+ var _a, _b, _c;
305
+ (_c = (_b = (_a = bodyRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('[data-active="true"]')) === null || _b === void 0 ? void 0 : _b.scrollIntoView) === null || _c === void 0 ? void 0 : _c.call(_b, { block: "nearest" });
306
+ }, [activeIndex, results]);
307
+ const appList = apps !== null && apps !== void 0 ? apps : NO_APPS;
308
+ const hues = useMemo(() => assignAppHues(appList, chartMode(colors)), [appList, colors]);
309
+ const showApps = appList.some((app) => app.id !== currentAppId) &&
310
+ (appsVisibility === "always" || !isDesktop);
311
+ const handleAppSelect = (app, event) => {
312
+ onAppSelect === null || onAppSelect === void 0 ? void 0 : onAppSelect(app, event);
313
+ if (!event.defaultPrevented)
314
+ onClose();
315
+ };
316
+ const appsBlock = showApps ? (_jsx(AppsSection, { apps: appList, hues: hues, currentAppId: currentAppId, heading: labels.apps, onSelect: handleAppSelect })) : null;
317
+ const listboxId = `${baseId}-results`;
318
+ const optionId = (index) => `${baseId}-opt-${index}`;
319
+ const togglePinFor = (id) => onTogglePin ? () => onTogglePin(id) : undefined;
320
+ const hasResults = results.length > 0;
321
+ const trimmed = query.trim();
322
+ const railFrequent = frequentItems
323
+ .filter(({ screen }) => !pinned.has(screen.id))
324
+ .slice(0, frequentLimit);
325
+ const rail = (_jsxs(Rail, { label: labels.quickAccess, children: [_jsxs(Flex, { as: "section", direction: "column", gap: "6px", children: [_jsx(SectionHeader, { label: labels.pinned, meta: `(${pinnedItems.length})`, isRail: true }), pinnedItems.length === 0 ? (_jsx(Text, { fontSize: "13px", color: colors.textMuted, px: "4px", children: labels.pinnedEmpty })) : (_jsx(Box, { display: "grid", gridTemplateColumns: "repeat(2, minmax(0, 1fr))", gap: "6px", children: pinnedItems.map(({ screen, module }) => (_jsx(PinnedTile, { screen: screen, module: module, link: link, labels: labels, onTogglePin: togglePinFor(screen.id) }, screen.id))) }))] }), railFrequent.length ? (_jsxs(Flex, { as: "section", direction: "column", gap: "2px", children: [_jsx(SectionHeader, { label: labels.frequent, isRail: true, hasCount: false }), railFrequent.map(({ screen, module }) => (_jsx(RailRow, { screen: screen, module: module, link: link, isStrong: true, pinId: onTogglePin ? screen.id : undefined, trailing: _jsxs(_Fragment, { children: [onTogglePin ? (_jsx(PinTextButton, { label: labels.pin(screen.label), text: labels.pinShort, onToggle: () => onTogglePin(screen.id) })) : null, _jsx(NewTabLink, { href: screen.href, label: labels.openInNewTab(screen.label), linkAs: link.linkAs })] }) }, screen.id)))] })) : null, recentItems.length ? (_jsxs(Flex, { as: "section", direction: "column", gap: "2px", children: [_jsx(SectionHeader, { label: labels.recent, isRail: true, hasCount: false }), recentItems.map(({ screen, module }) => (_jsx(RailRow, { screen: screen, module: module, link: link, trailing: _jsx(NewTabLink, { href: screen.href, label: labels.openInNewTab(screen.label), linkAs: link.linkAs }) }, screen.id)))] })) : null, appsBlock] }));
326
+ const browsePane = sections.length === 0 ? (_jsx(EmptyState, { title: labels.empty, titleAs: "h3", size: "sm" })) : (sections.map((section) => (_jsxs(Flex, { as: "section", "aria-label": section.label, direction: "column", gap: "3px", children: [_jsx(SectionHeader, { label: section.label, meta: `(${section.modules.length})` }), _jsx(ItemGrid, { children: section.modules.map((module) => {
327
+ const pinId = module.screens[0].id;
328
+ return (_jsx(ModuleRow, { module: module, keyScreens: module.screens
329
+ .filter((s) => s.isKey && s.href !== module.href)
330
+ .slice(0, keyScreenLimit), isPinned: pinned.has(pinId), onTogglePin: togglePinFor(pinId), pinId: pinId, labels: labels, link: link }, module.id));
331
+ }) })] }, section.id))));
332
+ const pickSuggestion = (value) => {
333
+ var _a;
334
+ setQuery(value);
335
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
336
+ };
337
+ const noResults = (_jsxs(Flex, { direction: "column", align: "center", gap: "12px", py: "48px", px: "20px", textAlign: "center", role: "status", children: [_jsx(Flex, { boxSize: "40px", borderRadius: "12px", bg: colors.backgroundColor.subtle, color: colors.textMuted, align: "center", justify: "center", children: _jsx(SearchIcon, { size: 18, strokeWidth: 2, "aria-hidden": true }) }), _jsxs(Flex, { direction: "column", gap: "3px", children: [_jsx(Text, { fontSize: "14px", fontWeight: 600, color: colors.text[900], children: isSearching ? labels.searching : labels.noResults(trimmed) }), isSearching ? null : (_jsx(Text, { fontSize: "12.5px", color: colors.textMuted, children: (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length)
338
+ ? labels.suggestionsHint
339
+ : labels.noResultsHint }))] }), !isSearching && (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) ? (_jsx(Flex, { wrap: "wrap", justify: "center", gap: "6px", children: suggestions.map((suggestion) => (_jsx(Box, { as: "button", type: "button", onClick: () => pickSuggestion(suggestion), h: "28px", px: "11px", borderRadius: "full", borderWidth: "1px", borderColor: colors.boxborder[200], bg: colors.surfaceRaised, fontSize: "12.5px", fontWeight: 500, color: colors.text[900], transition: transitionFor(["background-color"]), _hover: { bg: listRowBackgrounds(colors).active }, sx: focusVisibleStyles(colors), children: suggestion }, suggestion))) })) : null] }));
340
+ const searchPane = hasResults ? (_jsx(Flex, { role: "listbox", id: listboxId, "aria-label": labels.title, "aria-busy": isSearching || undefined, direction: "column", gap: "14px", children: groups.map((group, groupIndex) => (_jsxs(Flex, { role: "group", "aria-label": group.meta ? `${group.label}, ${group.meta}` : group.label, direction: "column", gap: "3px", children: [_jsx(SectionHeader, { label: group.label, meta: group.meta ? `(${group.meta})` : undefined, isDecorative: true }), _jsx(ItemGrid, { children: group.items.map((item, itemIndex) => {
341
+ const index = groupStarts[groupIndex] + itemIndex;
342
+ return (_jsx(SearchRow, { item: item, query: query, isActive: index === activeIndex, link: link, labels: labels, optionId: optionId(index), isPinned: item.screenId ? pinned.has(item.screenId) : false, canPin: Boolean(onTogglePin) && item.kind === "module", onPin: () => item.screenId && (onTogglePin === null || onTogglePin === void 0 ? void 0 : onTogglePin(item.screenId)), onOpen: () => open(item, false), onHover: () => setActiveIndex(index) }, item.id));
343
+ }) })] }, group.id))) })) : (noResults);
344
+ const body = isLoading ? (_jsx(SkeletonLayout, { label: labels.loading })) : (_jsxs(_Fragment, { children: [_jsx(Pane, { children: isSearchView ? searchPane : browsePane }), rail] }));
345
+ const pill = resolveFilledSurface(colors.primary, colors);
346
+ return (_jsxs(Drawer, { isOpen: isOpen, onClose: onClose, placement: "left", size: "full", initialFocusRef: inputRef, hideCloseButton: true, contentProps: {
347
+ maxW: { base: "100vw", lg: `min(${maxWidth}, calc(100vw - 56px))` },
348
+ h: { base: "100%", lg: "auto" },
349
+ maxH: "100%",
350
+ bg: colors.surfaceRaised,
351
+ borderBottomRightRadius: { base: 0, lg: "16px" },
352
+ boxShadow: colors.boxShadow.default,
353
+ overflow: "hidden",
354
+ ...{ "data-testid": testId },
355
+ }, children: [_jsx(DrawerHeader, { p: 0, flexShrink: 0, children: _jsxs(Flex, { align: "center", gap: "12px", h: "60px", pl: "18px", pr: "12px", children: [_jsxs(Heading, { as: "h2", display: "inline-flex", alignItems: "center", gap: "7px", h: "32px", pl: "9px", pr: "11px", borderRadius: "9px", bg: pill.fill, color: pill.color, fontSize: "13px", fontWeight: 600, flexShrink: 0, children: [_jsx(Compass, { size: 16, strokeWidth: 2, "aria-hidden": true }), labels.title] }), _jsx(SearchField, { inputRef: inputRef, value: query, onChange: setQuery, onKeyDown: onInputKeyDown, labels: labels, hint: searchHint, listboxId: listboxId, activeId: isSearchView && hasResults ? optionId(activeIndex) : undefined, isExpanded: isSearchView, hasResults: hasResults }), _jsx(IconButton, { "aria-label": labels.close, icon: _jsx(X, { size: 18, "aria-hidden": true }), variant: "ghost", boxSize: "34px", minW: "34px", borderRadius: "9px", color: colors.textMuted, ml: "auto", onClick: onClose })] }) }), _jsx(DrawerBody, { p: 0, display: "flex", flexDirection: { base: "column", lg: "row" }, overflowY: { base: "auto", lg: "hidden" }, minH: 0, children: _jsx(Flex, { ref: bodyRef, onKeyDown: onBodyKeyDown, direction: { base: "column", lg: "row" }, flex: 1, minH: 0, minW: 0, children: body }) }), _jsxs(DrawerFooter, { p: 0, minH: "32px", flexShrink: 0, px: "18px", py: "6px", gap: "6px 14px", flexWrap: "wrap", bg: colors.backgroundColor.subtle, fontSize: "11.5px", color: colors.textMuted, whiteSpace: "nowrap", justifyContent: "flex-start", children: [_jsxs(Flex, { gap: "6px 14px", align: "center", wrap: "wrap", "aria-hidden": true, children: [openShortcutHint ? (_jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: openShortcutHint }), labels.hintOpenMenu] })) : null, _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: "\u2191\u2193\u2190\u2192" }), labels.hintMove] }), _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: "\u21B5" }), labels.hintOpen] }), _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: `${modKeyLabel !== null && modKeyLabel !== void 0 ? modKeyLabel : (isApplePlatform() ? "⌘" : "Ctrl")}↵` }), labels.hintNewTab] }), onTogglePin ? (_jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: "P" }), labels.hintPin] })) : null, _jsxs(Flex, { as: "span", align: "center", gap: "5px", children: [_jsx(Kbd, { size: "xs", children: "esc" }), labels.hintClose] })] }), _jsx(Text, { as: "span", ml: "auto", children: labels.footerNote })] })] }));
356
+ }
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from "@chakra-ui/react";
3
+ import { ArrowUpRight } from "lucide-react";
4
+ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
5
+ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
6
+ import { revealStyles } from "./revealStyles.js";
7
+ /** "Open in a new tab" anchor; visible on row hover, focus-within or its own focus only. */
8
+ export default function NewTabLink({ href, label, linkAs = "a", tabIndex }) {
9
+ const { colors } = useCustomTheme();
10
+ return (_jsx(Box, { as: linkAs, href: href, target: "_blank", rel: "noopener noreferrer", "aria-label": label, title: label, tabIndex: tabIndex, display: "inline-flex", alignItems: "center", justifyContent: "center", w: "22px", h: "22px", flexShrink: 0, borderRadius: "md", color: colors.textMuted, opacity: 0, transition: transitionFor(["opacity", "background-color"]), sx: revealStyles(colors), _hover: { bg: colors.backgroundColor.subtle }, children: _jsx(ArrowUpRight, { size: 13, "aria-hidden": true }) }));
11
+ }
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { IconButton } from "@chakra-ui/react";
3
+ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
4
+ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
5
+ import { revealStyles } from "./revealStyles.js";
6
+ const STAR = "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01z";
7
+ function Star({ filled, size }) {
8
+ return (_jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: filled ? "currentColor" : "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinejoin: "round", "aria-hidden": true, children: _jsx("path", { d: STAR }) }));
9
+ }
10
+ /** Star toggle: outline when unpinned, filled in the accent when pinned; appears on row hover or focus and never follows the row link. */
11
+ export default function PinToggle({ isPinned, label, onToggle, title, size = 13, tabIndex }) {
12
+ const { colors } = useCustomTheme();
13
+ return (_jsx(IconButton, { "aria-label": label, "aria-pressed": isPinned, title: title !== null && title !== void 0 ? title : label, icon: _jsx(Star, { filled: isPinned, size: size }), variant: "ghost", minW: "22px", w: "22px", h: "22px", borderRadius: "md", tabIndex: tabIndex, color: isPinned ? colors.accentText : colors.textMuted, opacity: 0, transition: transitionFor(["opacity", "background-color"]), sx: revealStyles(colors), onClick: (event) => {
14
+ event.preventDefault();
15
+ event.stopPropagation();
16
+ onToggle();
17
+ } }));
18
+ }
@@ -0,0 +1,110 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, Flex, Heading, Text } from "@chakra-ui/react";
3
+ import { Lock, Star } from "lucide-react";
4
+ import { Fragment, } from "react";
5
+ import { focusVisibleStyles } from "../../Theme/chakra/focusRing.styles.js";
6
+ import { resolveFilledSurface } from "../../Theme/tokens/builders/filledSurface.js";
7
+ import { listRowBackgrounds } from "../../Theme/tokens/builders/rowStates.js";
8
+ import { transitionFor } from "../../Theme/tokens/primitives/motion.js";
9
+ import { useCustomTheme } from "../../Theme/useCustomTheme.js";
10
+ import AppMark from "../AppSwitcher/AppMark.js";
11
+ import { highlightSegments } from "./match.js";
12
+ import NewTabLink from "./NewTabLink.js";
13
+ import PinToggle from "./PinToggle.js";
14
+ import { revealStyles } from "./revealStyles.js";
15
+ export const ITEM_SELECTOR = "[data-launcher-item]";
16
+ export const isPlainClick = (event) => event.button === 0 &&
17
+ !event.metaKey &&
18
+ !event.ctrlKey &&
19
+ !event.shiftKey &&
20
+ !event.altKey;
21
+ export const useRowHover = () => {
22
+ const { colors } = useCustomTheme();
23
+ const hover = listRowBackgrounds(colors).active;
24
+ return { bg: hover, _hover: { bg: hover }, _focusWithin: { bg: hover } };
25
+ };
26
+ export function CountBadge({ value, size = "row" }) {
27
+ const { colors } = useCustomTheme();
28
+ if (value === undefined || value === 0 || value === "")
29
+ return null;
30
+ const fill = resolveFilledSurface(colors.primary, colors);
31
+ const isRow = size === "row";
32
+ return (_jsx(Box, { as: "span", flexShrink: 0, minW: isRow ? "20px" : undefined, h: isRow ? "18px" : "17px", px: "6px", mr: isRow ? "2px" : 0, borderRadius: "full", bg: fill.fill, color: fill.color, fontSize: isRow ? "10.5px" : "10px", fontWeight: 700, display: "inline-flex", alignItems: "center", justifyContent: "center", sx: { fontVariantNumeric: "tabular-nums" }, children: value }));
33
+ }
34
+ export function NewTag({ label }) {
35
+ const { colors } = useCustomTheme();
36
+ return (_jsx(Box, { as: "span", flexShrink: 0, fontSize: "10px", fontWeight: 600, letterSpacing: "0.02em", color: colors.accentText, opacity: 0.85, children: label }));
37
+ }
38
+ export function SectionHeader({ label, meta, isDecorative = false, isRail = false, hasCount = true, }) {
39
+ const { colors } = useCustomTheme();
40
+ return (_jsxs(Flex, { align: "baseline", gap: "6px", px: isRail ? "4px" : "8px", pb: "5px", mb: hasCount ? 0 : "2px", borderBottomWidth: "1px", borderColor: colors.boxborder[200], "aria-hidden": isDecorative || undefined, children: [_jsx(Heading, { as: isDecorative ? "div" : "h2", m: 0, fontSize: "12.5px", fontWeight: 600, letterSpacing: "-0.003em", color: colors.text[900], children: label }), meta ? (_jsx(Text, { as: "span", fontSize: "11.5px", color: colors.textMuted, sx: { fontVariantNumeric: "tabular-nums" }, children: meta })) : null] }));
41
+ }
42
+ export function RowIcon({ icon: Icon, size, stroke = 1.75, mt }) {
43
+ const { colors } = useCustomTheme();
44
+ if (!Icon)
45
+ return null;
46
+ return (_jsx(Box, { as: "span", color: colors.textMuted, display: "inline-flex", flexShrink: 0, mt: mt, transition: transitionFor(["color"]), _groupHover: { color: colors.accentText }, _groupFocusWithin: { color: colors.accentText }, sx: { "[data-reveal=true] &": { color: colors.accentText } }, children: _jsx(Icon, { size: size, strokeWidth: stroke, "aria-hidden": true }) }));
47
+ }
48
+ export function Highlight({ text, query }) {
49
+ const { colors } = useCustomTheme();
50
+ return (_jsx(_Fragment, { children: highlightSegments(text, query).map((segment, i) => segment.isMatch ? (_jsx(Box, { as: "mark", bg: colors.primary.opacity[24], color: "inherit", borderRadius: "3px", px: "1px", children: segment.text }, i)) : (_jsx(Fragment, { children: segment.text }, i))) }));
51
+ }
52
+ export function RowActions({ children }) {
53
+ return (_jsx(Flex, { position: "absolute", top: "7px", right: "4px", h: "19px", align: "center", gap: "2px", zIndex: 1, children: children }));
54
+ }
55
+ export function RowTip({ text }) {
56
+ const { colors } = useCustomTheme();
57
+ return (_jsx(Box, { role: "tooltip", position: "absolute", right: "20px", top: "-26px", zIndex: 2, px: "8px", py: "3px", borderRadius: "6px", fontSize: "11px", fontWeight: 600, whiteSpace: "nowrap", bg: colors.text[900], color: colors.surfaceRaised, visibility: "hidden", pointerEvents: "none", _groupHover: { visibility: "visible" }, children: text }));
58
+ }
59
+ export function ModuleRow({ module, keyScreens, isPinned, onTogglePin, pinId, labels, link, }) {
60
+ const { colors } = useCustomTheme();
61
+ const hover = useRowHover();
62
+ const ring = focusVisibleStyles(colors);
63
+ const base = typeof module.badge === "number" || module.badge ? 24 : 0;
64
+ const open = base + (onTogglePin ? 46 : 24);
65
+ return (_jsxs(Flex, { "data-group": true, "data-nav-cell": true, position: "relative", align: "flex-start", gap: "10px", minH: "34px", pl: "8px", pr: "4px", pt: "7px", pb: "5px", borderRadius: "8px", transition: transitionFor(["background-color"]), _hover: hover._hover, _focusWithin: hover._focusWithin, children: [_jsx(RowIcon, { icon: module.icon, size: 16, mt: "2px" }), _jsxs(Flex, { direction: "column", flex: 1, minW: 0, children: [_jsxs(Flex, { align: "center", gap: "6px", h: "19px", minW: 0, pr: `${base}px`, _groupHover: { pr: `${open}px` }, _groupFocusWithin: { pr: `${open}px` }, children: [_jsx(Box, { as: link.linkAs, href: module.href, "data-launcher-item": true, "data-pin-id": onTogglePin ? pinId : undefined, title: module.label, onClick: link.onPlainClick, minW: 0, fontSize: "13.5px", fontWeight: 500, color: colors.text[900], noOfLines: 1, borderRadius: "sm", sx: ring, children: module.label }), module.isNew ? _jsx(NewTag, { label: labels.newBadge }) : null] }), keyScreens.length ? (_jsx(Box, { role: "group", "aria-label": `${module.label} ${labels.screens}`, fontSize: "11.5px", lineHeight: "15px", color: colors.textMuted, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", children: keyScreens.map((screen, i) => (_jsxs(Fragment, { children: [i > 0 ? (_jsx(Box, { as: "span", "aria-hidden": true, mx: "5px", opacity: 0.7, children: "\u00B7" })) : null, _jsx(Box, { as: link.linkAs, href: screen.href, "data-launcher-item": true, title: `${screen.label} — ${module.label}`, onClick: link.onPlainClick, color: "inherit", borderRadius: "sm", _hover: {
66
+ textDecoration: "underline",
67
+ textUnderlineOffset: "2px",
68
+ }, sx: ring, children: screen.label })] }, screen.id))) })) : null] }), _jsxs(RowActions, { children: [_jsx(CountBadge, { value: module.badge }), onTogglePin ? (_jsx(PinToggle, { isPinned: isPinned, label: isPinned ? labels.unpin(module.label) : labels.pin(module.label), title: "", onToggle: onTogglePin })) : null, _jsx(NewTabLink, { href: module.href, label: labels.openInNewTab(module.label), linkAs: link.linkAs })] }), onTogglePin ? (_jsx(RowTip, { text: isPinned ? labels.unpinTip : labels.pinTip })) : null] }));
69
+ }
70
+ export function RailRow({ screen, module, link, isStrong = false, trailing, pinId, }) {
71
+ var _a;
72
+ const { colors } = useCustomTheme();
73
+ const hover = useRowHover();
74
+ return (_jsxs(Flex, { "data-group": true, align: "center", gap: "10px", h: "32px", pl: "8px", pr: "4px", borderRadius: "8px", transition: transitionFor(["background-color"]), _hover: hover._hover, _focusWithin: hover._focusWithin, children: [_jsx(RowIcon, { icon: (_a = screen.icon) !== null && _a !== void 0 ? _a : module.icon, size: 15 }), _jsx(Box, { as: link.linkAs, href: screen.href, "data-launcher-item": true, "data-pin-id": pinId, onClick: link.onPlainClick, flex: 1, minW: 0, fontSize: "13px", fontWeight: isStrong ? 500 : 400, color: colors.text[900], noOfLines: 1, borderRadius: "sm", sx: focusVisibleStyles(colors), children: screen.label }), trailing] }));
75
+ }
76
+ export function PinTextButton({ label, text, onToggle }) {
77
+ const { colors } = useCustomTheme();
78
+ return (_jsxs(Box, { as: "button", type: "button", "aria-label": label, flexShrink: 0, h: "22px", px: "7px", display: "inline-flex", alignItems: "center", gap: "4px", borderRadius: "6px", borderWidth: "1px", borderColor: colors.boxborder[200], bg: colors.surfaceRaised, color: colors.text[700], fontSize: "11px", fontWeight: 600, cursor: "pointer", opacity: 0, transition: transitionFor(["opacity", "background-color"]), sx: { ...revealStyles(colors), "@media (hover: none)": { opacity: 1 } }, onClick: (event) => {
79
+ event.preventDefault();
80
+ event.stopPropagation();
81
+ onToggle();
82
+ }, children: [_jsx(Star, { size: 11, strokeWidth: 2, "aria-hidden": true }), text] }));
83
+ }
84
+ export function PinnedTile({ screen, module, link, labels, onTogglePin, }) {
85
+ var _a;
86
+ const { colors } = useCustomTheme();
87
+ const Icon = (_a = screen.icon) !== null && _a !== void 0 ? _a : module.icon;
88
+ return (_jsxs(Flex, { "data-group": true, align: "center", gap: "8px", h: "36px", pl: "9px", pr: "4px", borderRadius: "9px", borderWidth: "1px", borderColor: colors.boxborder[200], bg: colors.surfaceRaised, title: screen.label, transition: transitionFor(["border-color"]), _hover: { borderColor: colors.gray[300] }, children: [Icon ? (_jsx(Box, { as: "span", display: "inline-flex", flexShrink: 0, color: colors.accentText, children: _jsx(Icon, { size: 15, strokeWidth: 1.8, "aria-hidden": true }) })) : null, _jsx(Box, { as: link.linkAs, href: screen.href, "data-launcher-item": true, "data-pin-id": onTogglePin ? screen.id : undefined, onClick: link.onPlainClick, flex: 1, minW: 0, fontSize: "13px", fontWeight: 500, color: colors.text[900], noOfLines: 1, borderRadius: "sm", sx: focusVisibleStyles(colors), children: screen.label }), _jsx(CountBadge, { value: screen.badge, size: "tile" }), onTogglePin ? (_jsx(Box, { flexShrink: 0, w: "0", overflow: "hidden", transition: transitionFor(["width"]), _groupHover: { w: "22px" }, _groupFocusWithin: { w: "22px" }, children: _jsx(PinToggle, { isPinned: true, size: 12, label: labels.unpin(screen.label), title: labels.unpinTip, onToggle: onTogglePin }) })) : null] }));
89
+ }
90
+ export function AppsSection({ apps, hues, currentAppId, heading, onSelect, }) {
91
+ const { colors } = useCustomTheme();
92
+ const rows = listRowBackgrounds(colors);
93
+ const ring = focusVisibleStyles(colors);
94
+ return (_jsxs(Box, { children: [_jsx(SectionHeader, { label: heading, isRail: true, hasCount: false }), _jsx(Box, { as: "ul", listStyleType: "none", m: 0, p: 0, "aria-label": heading, children: apps.map((app, index) => {
95
+ var _a;
96
+ const isCurrent = app.id === currentAppId;
97
+ const interactive = !isCurrent && !app.locked;
98
+ return (_jsx(Box, { as: "li", children: _jsxs(Flex, { as: interactive ? "a" : "div", ...(interactive
99
+ ? {
100
+ href: app.url,
101
+ target: "_blank",
102
+ rel: "noopener noreferrer",
103
+ "data-launcher-item": true,
104
+ onClick: (event) => onSelect(app, event),
105
+ }
106
+ : {}), "aria-current": isCurrent ? "true" : undefined, title: app.locked
107
+ ? ((_a = app.lockedReason) !== null && _a !== void 0 ? _a : `${app.name} is not available on your plan`)
108
+ : undefined, "data-app-locked": app.locked ? "true" : undefined, align: "center", gap: 3, minH: "44px", px: 2, py: 1, borderRadius: "8px", textDecoration: "none", cursor: interactive ? "pointer" : "default", bg: isCurrent ? rows.selected : "transparent", transition: transitionFor(["background-color"]), _hover: interactive ? { bg: rows.active } : undefined, sx: ring, children: [_jsx(AppMark, { app: app, hue: hues[index], boxSize: "28px", iconSize: 15, muted: app.locked }), _jsx(Text, { flex: 1, minW: 0, fontSize: "sm", fontWeight: "medium", noOfLines: 1, color: app.locked ? colors.textMuted : colors.text[900], children: app.name }), app.locked ? (_jsx(Box, { as: Lock, size: 14, color: colors.textMuted, flexShrink: 0, "aria-hidden": true })) : null] }) }, app.id || app.name));
109
+ }) })] }));
110
+ }